OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tix/] [library/] [pref/] [tixmkpref] - Blame information for rev 1781

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
#!/usr/local/bin/tclsh
2
# Undocumented program. Don't use it.
3
#
4
# Usage:
5
#
6
#       tixmkpref option name.src > name.tcl
7
#
8
 
9
proc tixDefOption {classes specs {level \$tixOption(prioLevel)}} {
10
    global isFont tixOption
11
 
12
    foreach class $classes {
13
        foreach spec $specs {
14
            if [regexp (Font)|(font) $spec] {
15
                if {$isFont} {
16
                    puts "option add *$class$spec $level"
17
                }
18
            } else {
19
                if {!$isFont} {
20
                    set aspec [subst $spec]
21
                    puts "option add *$class$spec $level"
22
                }
23
            }
24
        }
25
    }
26
}
27
 
28
proc option {classes specs {level \$tixOption(prioLevel)}} {
29
    tixDefOption $classes $specs $level
30
}
31
 
32
proc tixInitOptionDatabase {isWin} {
33
    global tixOption isFont
34
 
35
    # general stuff, everything gets these defaults unless otherwise specified
36
    #-------------------------------------------------------------------------
37
    if {! $isWin} then {
38
        tixDefOption {""} {{Font                        $tixOption(font)}}
39
        tixDefOption {""} {{font                        $tixOption(font)}}
40
 
41
        tixDefOption {""} {{background          $tixOption(bg)}}        10
42
        tixDefOption {""} {{Background          $tixOption(bg)}}
43
        tixDefOption {""} {{background          $tixOption(bg)}}
44
        tixDefOption {""} {{Foreground          $tixOption(fg)}}
45
        tixDefOption {""} {{foreground          $tixOption(fg)}}
46
        tixDefOption {""} {{activeBackground    $tixOption(active_bg)}}
47
        tixDefOption {""} {{activeForeground    $tixOption(active_fg)}}
48
        tixDefOption {""} {{HighlightBackground $tixOption(bg)}}
49
        tixDefOption {""} {{selectBackground    $tixOption(select_bg)}}
50
        tixDefOption {""} {{selectForeground    $tixOption(select_fg)}}
51
        tixDefOption {""} {{selectBorderWidth   0}}
52
    }
53
 
54
    #----------------------------------------
55
    # Standard TK Widget Options
56
    #
57
    # We set up the options for the TK widgets only if
58
    # the strictTK option is not selected.
59
    #----------------------------------------
60
 
61
    if {$isWin} then {
62
        tixDefOption {Menu TixMenu} {
63
            {.font                      $tixOption(menu_font)}
64
        }
65
    } else {
66
        tixDefOption {Menu TixMenu} {
67
            {.font                      $tixOption(menu_font)}
68
            {.selectColor               $tixOption(selector)}
69
        }
70
    }
71
 
72
    tixDefOption {Menubutton} {
73
        {.font                  $tixOption(menu_font)}
74
        {.padY                  5}
75
    }
76
 
77
    tixDefOption {Button} {
78
        {.borderWidth           2}
79
        {.anchor                c}
80
    }
81
 
82
    if {! $isWin} then {
83
        tixDefOption {Checkbutton Radiobutton} {
84
            {.selectColor               $tixOption(selector)}
85
        }
86
    }
87
 
88
    tixDefOption {Entry} {
89
        {.relief                sunken}
90
        {.highlightBackground   $tixOption(bg)}
91
        {.background            $tixOption(input1_bg)}
92
        {.foreground            black}
93
        {.insertBackground      black}
94
    }
95
 
96
    tixDefOption {Label} {
97
        {.anchor                w}
98
        {.borderWidth           0}
99
        {.font                  $tixOption(bold_font)}
100
    }
101
 
102
    tixDefOption {Listbox} {
103
        {.background            $tixOption(light1_bg)}
104
        {.relief                sunken}
105
    }
106
 
107
    tixDefOption {Scale} {
108
        {.foreground            $tixOption(fg)}
109
        {.activeForeground      $tixOption(bg)}
110
        {.background            $tixOption(bg)}
111
        {.sliderForeground      $tixOption(bg)}
112
        {.sliderBackground      $tixOption(light1_bg)}
113
        {.font                  $tixOption(italic_font)}
114
    }
115
 
116
    tixDefOption {Scrollbar} {
117
        {.background            $tixOption(bg)}
118
        {.troughColor           $tixOption(light1_bg)}
119
        {.relief                sunken}
120
        {.borderWidth           1}
121
        {.width                 15}
122
    }
123
 
124
    tixDefOption {Text} {
125
        {.background            $tixOption(input1_bg)}
126
        {.relief                sunken}
127
    }
128
 
129
    #----------------------------------------------------------------------
130
    # TIX WIDGETS
131
    #----------------------------------------------------------------------
132
 
133
    tixDefOption {TixBalloon} {
134
        {*background                    "#ffff60"}
135
        {*foreground                    black}
136
        {.background                    black}
137
        {*Label.font                    $tixOption(font)}
138
        {*Label.anchor                  w}
139
    }
140
 
141
    tixDefOption {TixBitmapButton} {
142
        {*label.font                    $tixOption(font)}
143
    }
144
 
145
    tixDefOption {TixControl} {
146
        {*entry.highlightBackground     $tixOption(bg)}
147
        {*entry.background              $tixOption(input1_bg)}
148
        {*entry.foreground              black}
149
        {*entry.insertBackground        black}
150
        {*label.font                    $tixOption(bold_font)}
151
    }
152
 
153
    # DLG_BTNS
154
    #
155
    tixDefOption {TixStdButtonBox} {
156
    }
157
 
158
    # DIR_LIST
159
    #
160
    tixDefOption {TixDirTree TixDirList TixScrolledHList TixTree} {
161
        {*Scrollbar.background          $tixOption(bg)}
162
        {*Scrollbar.troughColor         $tixOption(light1_bg)}
163
        {*hlist.highlightBackground     $tixOption(bg)}
164
        {*hlist.background              $tixOption(input1_bg)}
165
        {*hlist.activeBackground        $tixOption(input1_bg)}
166
        {*hlist.disabledBackground      $tixOption(input1_bg)}
167
        {*f1.borderWidth                1}
168
        {*f1.relief                     sunken}
169
    }
170
 
171
    tixDefOption {TixFileEntry} {
172
        {*Entry.background              $tixOption(input1_bg)}
173
    }
174
 
175
    tixDefOption {TixHList} {
176
        {.background                    $tixOption(light1_bg)}
177
        {.activeBackground              $tixOption(light1_bg)}
178
        {.disabledBackground            $tixOption(light1_bg)}
179
    }
180
 
181
    tixDefOption {TixLabelEntry} {
182
        {*entry.highlightBackground     $tixOption(bg)}
183
        {*entry.background              $tixOption(input1_bg)}
184
        {*entry.foreground              black}
185
        {*entry.insertBackground        black}
186
        {*label.font                    $tixOption(bold_font)}
187
    }
188
 
189
    tixDefOption {TixLabelFrame} {
190
        {*label.font                    $tixOption(bold_font)}
191
    }
192
 
193
    tixDefOption {TixMultiList} {
194
        {*Listbox.borderWidth           0}
195
        {*Listbox.highlightThickness    0}
196
        {*Scrollbar.background          $tixOption(bg)}
197
        {*Scrollbar.troughColor         $tixOption(light1_bg)}
198
        {*Scrollbar.relief              sunken}
199
        {*Scrollbar.width               15}
200
        {*f1.borderWidth                2}
201
        {*f1.relief                     sunken}
202
        {*f1.highlightThickness         2}
203
    }
204
 
205
    # MwmClient
206
    #
207
    tixDefOption {TixMwmClient} {
208
        {*title.font                    $tixOption(menu_font)}
209
    }
210
 
211
    tixDefOption {TixMDIMenuBar} {
212
        {*menubar.relief                raised}
213
        {*menubar.borderWidth           2}
214
        {*Menubutton.padY               2}
215
    }
216
 
217
    # NoteBook
218
    #
219
    tixDefOption {TixNoteBook} {
220
        {.Background                    $tixOption(bg)}
221
        {.nbframe.Background            $tixOption(bg)}
222
        {.nbframe.font                  $tixOption(menu_font)}
223
        {.nbframe.backPageColor         $tixOption(bg)}
224
        {.nbframe.inactiveBackground    $tixOption(inactive_bg)}
225
    }
226
 
227
    # OPTION_MENU
228
    #
229
    tixDefOption {TixOptionMenu} {
230
        {*menubutton.font               $tixOption(font)}
231
    }
232
 
233
    # PANED_WINDOW
234
    #
235
    tixDefOption {TixPanedWindow} {
236
        {.handleActiveBg                $tixOption(active_bg)}
237
        {.separatorBg                   $tixOption(bg)}
238
        {.handleBg                      $tixOption(bg)}
239
    }
240
 
241
    # POPUP MENU
242
    #
243
    tixDefOption {TixPopupMenu} {
244
        {*menubutton.background         $tixOption(dark1_bg)}
245
    }
246
 
247
    # SCROLLED_HLIST
248
    #
249
    tixDefOption {TixScrolledHList} {
250
        {*Scrollbar.background          $tixOption(bg)}
251
        {*Scrollbar.troughColor         $tixOption(light1_bg)}
252
        {*hlist.highlightBackground     $tixOption(bg)}
253
        {*hlist.background              $tixOption(light1_bg)}
254
    }
255
 
256
    tixDefOption {TixScrolledTList} {
257
        {*Scrollbar.background          $tixOption(bg)}
258
        {*Scrollbar.troughColor         $tixOption(light1_bg)}
259
        {*tlist.highlightBackground     $tixOption(bg)}
260
        {*tlist.background              $tixOption(light1_bg)}
261
    }
262
 
263
    # SCROLLED_LISTBOX, .. ETC
264
    #
265
    tixDefOption {TixScrolledListBox} {
266
        {.background                    $tixOption(bg)}
267
        {*Scrollbar.background          $tixOption(bg)}
268
        {*Scrollbar.troughColor         $tixOption(light1_bg)}
269
        {*listbox.highlightBackground   $tixOption(bg)}
270
        {*listbox.background            $tixOption(light1_bg)}
271
    }
272
 
273
    tixDefOption {TixScrolledText} {
274
        {.background                    $tixOption(bg)}
275
        {*Scrollbar.background          $tixOption(bg)}
276
        {*Scrollbar.troughColor         $tixOption(light1_bg)}
277
    }
278
 
279
 
280
    # SCROLLED_WINDOW
281
    #
282
    tixDefOption {TixScrolledWindow} {
283
        {.background                    $tixOption(bg)}
284
        {*Scrollbar.background          $tixOption(bg)}
285
        {*Scrollbar.troughColor         $tixOption(light1_bg)}
286
        {.frame.background              $tixOption(light1_bg)}
287
    }
288
 
289
 
290
    # SELECT
291
    #
292
    tixDefOption {TixSelect} {
293
    }
294
 
295
    tixDefOption {TixTree} {
296
        {.background                    $tixOption(bg)}
297
        {*Scrollbar.background          $tixOption(bg)}
298
        {*Scrollbar.troughColor         $tixOption(light1_bg)}
299
        {*hlist.highlightBackground     $tixOption(bg)}
300
        {*hlist.background              $tixOption(light1_bg)}
301
        {*hlist.borderWidth             1}
302
    }
303
    # NON ALPHABETICAL ORDER WIDGETS
304
 
305
    # Since TK's option database follows the order-of-declaration rule, not
306
    # specific-vs-general rule, the options of the widgets below depends on
307
    # the options of the widget above, so their options must be defined here
308
 
309
    # COMBOBOX
310
    if {! $isWin} then {
311
        tixDefOption {TixComboBox} {
312
            {*Entry.font                                $tixOption(font)}
313
            {*Entry.highlightBackground         $tixOption(bg)}
314
            {*Entry.background                  $tixOption(input1_bg)}
315
            {*Entry.foreground                  black}
316
            {*Entry.insertBackground            black}
317
        }
318
    } else {
319
        tixDefOption {TixComboBox} {
320
            {*Entry.font                                $tixOption(font)}
321
            {*Entry.highlightBackground         $tixOption(input1_bg)}
322
            {*Entry.background                  $tixOption(input1_bg)}
323
            {*Entry.foreground                  SystemWindowText}
324
            {*Entry.insertBackground            SystemWindowText}
325
            {*Entry.selectBackground    $tixOption(select_bg)}
326
            {*Entry.selectForeground    $tixOption(select_fg)}
327
            {*TixScrolledListBox.selectBackground       $tixOption(select_bg)}
328
            {*TixScrolledListBox.selectForeground       $tixOption(select_fg)}
329
        }
330
    }
331
 
332
    # FILE_SELECT_BOX
333
    #
334
    tixDefOption {TixFileSelectBox} {
335
        {*Label.font                            $tixOption(bold_font)}
336
    }
337
 
338
    tixDefOption {TixExFileSelectBox} {
339
    }
340
}
341
 
342
#----------------------------------------------------------------------
343
# The default fontset and schemes
344
#
345
#----------------------------------------------------------------------
346
 
347
source ../DefSchm.tcl
348
rename tixSetDefaultFontset             tixSetFontset
349
rename tixSetDefaultScheme-Color        tixSetScheme-Color
350
rename tixSetDefaultScheme-Mono         tixSetScheme-Mono
351
 
352
#----------------------------------------------------------------------
353
# Action:
354
#----------------------------------------------------------------------
355
if [string match TK* [lindex $argv 1]] {
356
    set isTK 1
357
} elseif {[string match TkWin* [lindex $argv 1]]} {
358
    set isTK 0
359
    set isWin 1
360
} else {
361
    set isTK 0
362
    set isWin 0
363
}
364
set schemeName [lindex [split [lindex $argv 1] "."] 0]
365
source [lindex $argv 1]
366
 
367
 
368
tixSetFontset
369
 
370
if {[lindex $argv 0] == "-font"} {
371
 
372
    set isFont 1
373
 
374
    # FontSets will be set in two steps.
375
    # (1) init fontsets
376
    #     ... tix checks the validity of the fonts ...
377
    # (2) add the fontsets into the option database.
378
    #
379
    puts "proc tixPref:InitFontSet:$schemeName {} { "
380
    puts [info body tixSetFontset]
381
    puts "}"
382
 
383
    puts "proc tixPref:SetFontSet:$schemeName {} { "
384
    puts "global tixOption"
385
    if {! $isTK} {
386
        tixInitOptionDatabase $isWin
387
    }
388
    puts "}"
389
 
390
 
391
} else {
392
    set isFont 0
393
 
394
    # Do the Color First
395
    #
396
    puts "proc tixPref:SetScheme-Color:$schemeName {} {"
397
    puts [info body tixSetScheme-Color]
398
    if {! $isTK} {
399
        tixSetScheme-Color
400
        tixInitOptionDatabase $isWin
401
    }
402
    puts "}"
403
 
404
    # Now Do the Mono
405
    #
406
    puts "proc tixPref:SetScheme-Mono:$schemeName {} {"
407
    puts [info body tixSetScheme-Mono]
408
    if {! $isTK} {
409
        tixSetScheme-Mono
410
        tixInitOptionDatabase $isWin
411
    }
412
    puts "}"
413
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.