tixmkpref 9.4 KB

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