Bumped version to 0.98.0
[tcl-tlc.git] / init.tcl
blob7bba9e9a7f50bb0fe1d07f52fb5e50f27537276a
1 # vim: foldmarker=<<<,>>>
3 package require TLC-base
5 namespace eval :: {
6 package require Itk 3.1
8 namespace import -force ::itcl::*
9 namespace import -force ::itk::*
11 package require blttable
12 namespace eval ::blt {
13 proc table {args} {
14 return [uplevel [list ::blttable::table] $args]
19 namespace eval ::tlc {
20 namespace eval ::blt {}
21 namespace eval ::blttable {namespace export *}
23 variable version 0.98.0
25 variable guilibrary \
26 [file normalize [file join [pwd] [file dirname [info script]]]]
28 namespace import ::blt::*
29 if {[info commands ::blttable::table] != ""} {
30 catch {namespace import ::blttable::*}
34 lappend auto_path [file join $::tlc::guilibrary scripts]
36 if {[info exists tlc::custom_theme_object]} {
37 set tlc::theme $tlc::custom_theme_object ::#auto]
38 } else {
39 if {[info exists ::tlc_UserThemeOverride]} {
40 set tlc::theme [tlc::Daftheme ::#auto]
41 } else {
42 set tlc::theme [tlc::Theme ::#auto]
46 package provide TLC $::tlc::version
48 # Set saner defaults
50 bind Text <Key-Tab> {tk_focusNext %W}
51 bind Text <Shift-Key-Tab> {tk_focusPrev %W}
53 tlc::Baseconfig tlc::default_config -configfile ""
54 array set tlc::config [tlc::default_config dump_config]
56 # Default options <<<
58 foreach {opt settingkey} {
59 *activeBackground background
60 *highlightBackground highlightbackground
61 *highlightColor highlightcolor
62 *font font
63 *labelFont font
64 *textFont font
65 *selectBorderWidth selectborderwidth
66 *selectBackground selectbackground
67 *selectForeground selectforeground
68 *Tabset*selectBackground background
69 *textBackground textbackground
70 *Listbox.background textbackground
71 *disabledBackground disabledbackground
72 *Entry.disabledForeground disabledforeground
73 *Text.disabledForeground disabledforeground
74 *Text.TextHighlightBackground texthighlightbackground
75 *.hidebg hidebg
76 *enabledBackground textbackground
77 *TreeView.background textbackground
78 *TreeView.borderwidth borderwidth
79 *TreeView.highlightThickness borderwidth
80 *Labelframe.font boldfont
81 *labelFont boldfont
82 *Button.padY button_pady
83 *Form.padding formpadding
84 } {
85 option add $opt [$tlc::theme setting $settingkey] startupFile
88 # Hacks. userdefault priority == 60
89 foreach {opt settingkey} {
90 *Entry.background textbackground
91 *Entry.highlightBackground background
92 *TreeCtrl.background textbackground
93 } {
94 option add $opt [$tlc::theme setting $settingkey] 61
97 switch -exact $tcl_platform(platform) {
98 "unix" {
99 option add *Scrollbar.width 12 startupFile
100 option add *Scrollbar.borderWidth 1 startupFile
101 option add *sbWidth 12 startupFile
102 option add *scrollMargin 0 startupFile
103 option add *elementBorderWidth 1 startupFile
104 option add *textFont [$tlc::theme setting font] startupFile
105 option add *Menu.font [$tlc::theme setting boldfont] startupFile
106 option add *Menu.borderWidth 1 startupFile
108 "windows" {
109 option add *Radiobutton.borderWidth 0 startupFile
110 option add *Checkbutton.borderWidth 0 startupFile
111 option add *Entry.highlightThickness 0 startupFile
114 #>>>
116 namespace eval tlc::Form {
117 variable custom_type
118 set custom_types(sql_lookup) "tlc::form::Datavaultlookup"
121 namespace eval tlc {
122 proc set_theme {name} {
123 ttk::setTheme $name
125 ttk::style map TLabel -foreground {invalid red}
128 # Try to choose a reasonable default
129 apply {{} {
130 switch -- [tk windowingsystem] {
131 "win32" {
132 set try [list xpnative winnative clam]
135 "aqua" {
136 set try [list aqua clam]
139 default -
140 "x11" {
141 set try [list clam]
145 foreach theme $try {
146 if {[catch {
147 ::tlc::set_theme $try
148 } errmsg]} {
149 #puts "Could not use theme: ($theme): $errmsg\n$::errorInfo"
150 } else {
151 break