home *** CD-ROM | disk | FTP | other *** search
/ Freelog Special Freeware 31 / FreelogHS31.iso / Texte / scribus / scribus-1.3.3.9-win32-install.exe / tcl / tix8.1 / pref / tixmkpref < prev    next >
Text File  |  2002-09-21  |  10KB  |  382 lines

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