[425] | 1 | # $Id: opts.tcl 534 2009-12-04 23:07:47Z toby $ |
---|
[417] | 2 | proc SetTkDefaultOptions {"basefont 14"} { |
---|
[127] | 3 | |
---|
[417] | 4 | set Opt(prio) 10 |
---|
| 5 | set Opt(font) "Helvetica -$basefont" |
---|
| 6 | set Opt(bold_font) "Helvetica -$basefont bold" |
---|
| 7 | set Opt(menu_font) "Helvetica -$basefont bold" |
---|
| 8 | set Opt(italic_font) "Helvetica -$basefont bold italic" |
---|
| 9 | #set Opt(fixed_font) -*-courier-medium-r-*-*-14-*-*-*-*-*-*-* |
---|
| 10 | incr basefont -2 |
---|
| 11 | set Opt(graph_font) "Helvetica -$basefont" |
---|
| 12 | set Opt(small_bold_font) "Helvetica -$basefont bold" |
---|
| 13 | set Opt(small_font) "Helvetica -$basefont" |
---|
| 14 | set Opt(coord_font) "Courier -$basefont bold" |
---|
[127] | 15 | |
---|
[417] | 16 | option add *Font $Opt(font) $Opt(prio) |
---|
| 17 | option add *font $Opt(font) $Opt(prio) |
---|
| 18 | option add *Graph*Font $Opt(graph_font) $Opt(prio) |
---|
| 19 | option add *Graph.font $Opt(graph_font) $Opt(prio) |
---|
| 20 | option add *Canvas.font $Opt(bold_font) $Opt(prio) |
---|
| 21 | option add *Button.font $Opt(font) $Opt(prio) |
---|
| 22 | option add *Menu.font $Opt(menu_font) $Opt(prio) |
---|
| 23 | option add *Menubutton.font $Opt(menu_font) $Opt(prio) |
---|
| 24 | option add *Label.font $Opt(bold_font) $Opt(prio) |
---|
| 25 | option add *Scale.font $Opt(italic_font) $Opt(prio) |
---|
| 26 | option add *TitleFrame.font $Opt(italic_font) $Opt(prio) |
---|
[488] | 27 | option add *SmallFont.Label.font $Opt(small_bold_font) $Opt(prio) |
---|
[534] | 28 | option add *SmallFont.Checkbutton.font $Opt(small_font) $Opt(prio) |
---|
[417] | 29 | option add *SmallFont.Button.font $Opt(small_font) $Opt(prio) |
---|
| 30 | option add *Coord.Listbox.font $Opt(coord_font) $Opt(prio) |
---|
| 31 | option add *HistList.Listbox.font $Opt(coord_font) $Opt(prio) |
---|
| 32 | option add *MonoSpc.Label.font $Opt(coord_font) $Opt(prio) |
---|
[127] | 33 | |
---|
[417] | 34 | set Opt(bg) lightgray |
---|
| 35 | set Opt(fg) black |
---|
[127] | 36 | |
---|
[417] | 37 | set Opt(dark1_bg) gray86 |
---|
| 38 | set Opt(dark1_fg) black |
---|
| 39 | #set Opt(dark2_bg) gray77 |
---|
| 40 | #set Opt(dark2_fg) black |
---|
| 41 | set Opt(inactive_bg) gray77 |
---|
| 42 | set Opt(inactive_fg) black |
---|
[127] | 43 | |
---|
[417] | 44 | set Opt(light1_bg) gray92 |
---|
| 45 | #set Opt(light1_fg) white |
---|
| 46 | #set Opt(light2_bg) gray95 |
---|
| 47 | #set Opt(light2_fg) white |
---|
[127] | 48 | |
---|
[417] | 49 | set Opt(active_bg) $Opt(dark1_bg) |
---|
| 50 | set Opt(active_fg) $Opt(fg) |
---|
| 51 | set Opt(disabled_fg) gray55 |
---|
[127] | 52 | |
---|
[417] | 53 | set Opt(input1_bg) gray95 |
---|
| 54 | set Opt(input2_bg) gray95 |
---|
| 55 | set Opt(output1_bg) $Opt(dark1_bg) |
---|
| 56 | set Opt(output2_bg) $Opt(bg) |
---|
[127] | 57 | |
---|
[417] | 58 | set Opt(select_fg) black |
---|
| 59 | set Opt(select_bg) lightblue |
---|
[127] | 60 | |
---|
[417] | 61 | set Opt(selector) yellow |
---|
[127] | 62 | |
---|
[417] | 63 | option add *background $Opt(bg) 10 |
---|
| 64 | option add *Background $Opt(bg) $Opt(prio) |
---|
| 65 | option add *background $Opt(bg) $Opt(prio) |
---|
| 66 | option add *Foreground $Opt(fg) $Opt(prio) |
---|
| 67 | option add *foreground $Opt(fg) $Opt(prio) |
---|
| 68 | option add *activeBackground $Opt(active_bg) $Opt(prio) |
---|
| 69 | option add *activeForeground $Opt(active_fg) $Opt(prio) |
---|
| 70 | option add *HighlightBackground $Opt(bg) $Opt(prio) |
---|
| 71 | option add *selectBackground $Opt(select_bg) $Opt(prio) |
---|
| 72 | option add *selectForeground $Opt(select_fg) $Opt(prio) |
---|
| 73 | option add *selectBorderWidth 0 $Opt(prio) |
---|
| 74 | option add *Menu.selectColor $Opt(selector) $Opt(prio) |
---|
[501] | 75 | option add *Menubutton.padY 1p $Opt(prio) |
---|
[417] | 76 | option add *Button.borderWidth 2 $Opt(prio) |
---|
| 77 | option add *Button.anchor c $Opt(prio) |
---|
| 78 | option add *Checkbutton.selectColor $Opt(selector) $Opt(prio) |
---|
| 79 | option add *Radiobutton.selectColor $Opt(selector) $Opt(prio) |
---|
| 80 | option add *Entry.relief sunken $Opt(prio) |
---|
| 81 | option add *Entry.highlightBacground $Opt(bg) $Opt(prio) |
---|
| 82 | option add *Entry.background $Opt(input1_bg) $Opt(prio) |
---|
| 83 | option add *Entry.foreground black $Opt(prio) |
---|
| 84 | option add *Entry.insertBackground black $Opt(prio) |
---|
| 85 | option add *Label.anchor w $Opt(prio) |
---|
| 86 | option add *Label.borderWidth 0 $Opt(prio) |
---|
| 87 | option add *Listbox.background $Opt(light1_bg) $Opt(prio) |
---|
| 88 | option add *Listbox.relief sunken $Opt(prio) |
---|
| 89 | option add *Scale.foreground $Opt(fg) $Opt(prio) |
---|
| 90 | option add *Scale.activeForeground $Opt(bg) $Opt(prio) |
---|
| 91 | option add *Scale.background $Opt(bg) $Opt(prio) |
---|
| 92 | option add *Scale.sliderForeground $Opt(bg) $Opt(prio) |
---|
| 93 | option add *Scale.sliderBackground $Opt(light1_bg) $Opt(prio) |
---|
| 94 | option add *Scrollbar.background $Opt(bg) $Opt(prio) |
---|
| 95 | option add *Scrollbar.troughColor $Opt(light1_bg) $Opt(prio) |
---|
| 96 | option add *Scrollbar.relief sunken $Opt(prio) |
---|
| 97 | option add *Scrollbar.borderWidth 1 $Opt(prio) |
---|
| 98 | option add *Scrollbar.width 15 $Opt(prio) |
---|
| 99 | option add *Text.background $Opt(input1_bg) $Opt(prio) |
---|
| 100 | option add *Text.relief sunken $Opt(prio) |
---|
| 101 | . config -background $Opt(bg) |
---|
[127] | 102 | } |
---|
[417] | 103 | SetTkDefaultOptions |
---|
| 104 | |
---|
| 105 | # recursive routine to set all |
---|
| 106 | proc ResizeFont {path} { |
---|
| 107 | foreach child [winfo children $path] { |
---|
| 108 | set childtype [winfo class $child] |
---|
| 109 | # class "FixedFont" should not be resized |
---|
| 110 | if {$childtype == "FixedFont"} continue |
---|
| 111 | set font [option get $child font $childtype] |
---|
[425] | 112 | # handle BLT objects specially |
---|
| 113 | if {$childtype == "Graph"} { |
---|
[452] | 114 | foreach w {legend xaxis yaxis xaxis yaxis \ |
---|
| 115 | x2axis y2axis x2axis y2axis} \ |
---|
| 116 | o {-font -tickfont -tickfont -titlefont -titlefont \ |
---|
| 117 | -tickfont -tickfont -titlefont -titlefont} { |
---|
[425] | 118 | catch { |
---|
| 119 | $child $w configure $o $font |
---|
| 120 | } |
---|
| 121 | } |
---|
| 122 | } |
---|
[417] | 123 | if {$font != ""} { |
---|
| 124 | catch { |
---|
| 125 | set curfont [$child cget -font] |
---|
| 126 | if {[string tolower [lindex $curfont 0]] == "symbol"} { |
---|
| 127 | $child configure -font "Symbol [lrange $font 1 end]" |
---|
| 128 | } else { |
---|
| 129 | $child configure -font $font |
---|
| 130 | } |
---|
| 131 | } |
---|
| 132 | } |
---|
| 133 | ResizeFont $child |
---|
| 134 | } |
---|
| 135 | } |
---|