summaryrefslogtreecommitdiffstats
path: root/ds9
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2020-04-15 18:41:15 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2020-04-15 18:41:15 (GMT)
commitcc929ca3661d69cf645e8742a5d4c8a79d0eb2b1 (patch)
treeca5e37b01af6672b33bb89ca71036c68476d90a8 /ds9
parent134fac780b7d893435bb3032fa3b8e030205bce8 (diff)
downloadblt-cc929ca3661d69cf645e8742a5d4c8a79d0eb2b1.zip
blt-cc929ca3661d69cf645e8742a5d4c8a79d0eb2b1.tar.gz
blt-cc929ca3661d69cf645e8742a5d4c8a79d0eb2b1.tar.bz2
support themes
Diffstat (limited to 'ds9')
-rw-r--r--ds9/library/ds9.tcl145
-rw-r--r--ds9/library/prefsdialog.tcl25
-rw-r--r--ds9/library/util.tcl8
3 files changed, 87 insertions, 91 deletions
diff --git a/ds9/library/ds9.tcl b/ds9/library/ds9.tcl
index 5c1e1d0..9508e63 100644
--- a/ds9/library/ds9.tcl
+++ b/ds9/library/ds9.tcl
@@ -50,7 +50,6 @@ proc DS9Def {} {
set ds9(graph,sp) {}
set ds9(graph,horz) {}
set ds9(graph,vert) {}
- set ds9(themes) {}
set ds9(frames) {}
set ds9(active) {}
@@ -164,6 +163,13 @@ proc DS9Def {} {
set pds9(language,dir) {}
set pds9(theme) default
+
+ # colors
+ # ds9(foreground) color of fg
+ # ds9(background) color of bg
+ # ds9(gui,fg) color of gui fg text
+ # ds9(gui,bg) color of gui bg features
+ # ds9(gui,bold) color for gui fg bold text
}
# if we have a problem at this point, dump simple message and exit
@@ -200,20 +206,6 @@ package require base64
package require ftp
package require math::fuzzy
-# themes
-package require ttk::theme::aquativo
-package require ttk::theme::black
-package require ttk::theme::blue
-package require ttk::theme::clearlooks
-package require ttk::theme::elegance
-#package require ttk::theme::itft1
-package require ttk::theme::keramik
-#package require ttk::theme::kroc
-package require ttk::theme::plastik
-package require ttk::theme::radiance
-#package require ttk::theme::smog
-#package require ttk::theme::winxpblue
-
package require tkcon
package require Tkblt
package require Tls
@@ -224,11 +216,56 @@ package require DS9
# post package load
switch $ds9(wm) {
x11 {
+ # themes
+ package require ttk::theme::aquativo
+ package require ttk::theme::black
+ package require ttk::theme::blue
+ package require ttk::theme::clearlooks
+ package require ttk::theme::elegance
+ #package require ttk::theme::itft1
+ package require ttk::theme::keramik
+ #package require ttk::theme::kroc
+ package require ttk::theme::plastik
+ package require ttk::theme::radiance
+ #package require ttk::theme::smog
+ #package require ttk::theme::winxpblue
+
+ set ds9(foreground) black
+ set ds9(background) white
+ set ds9(gui,fg) $ds9(foreground)
+ set ds9(gui,bg) $ds9(background)
+ set ds9(gui,bold) blue
+
+ # edit theme list
+ set ds9(themes) [lsort [ttk::style theme names]]
+ set ds9(themes) [lsearch -all -inline -not -exact $ds9(themes) alt]
+ set ds9(themes) [lsearch -all -inline -not -exact $ds9(themes) classic]
+
+ # fix TEntry TLabel
+ foreach tt [ttk::style theme names] {
+ ttk::style theme use $tt
+ ttk::style configure TEntry -padding 1
+ ttk::style configure TLabel -borderwidth 2 -padding 1
+ }
+ ttk::style theme use default
+
# fix ::tk::dialog::file
set ::tk::dialog::file::showHiddenVar 0
set ::tk::dialog::file::showHiddenBtn 1
}
aqua {
+ set ds9(foreground) systemTextColor
+ set ds9(background) systemTextBackgroundColor
+ set ds9(gui,fg) $ds9(foreground)
+ set ds9(gui,bg) $ds9(background)
+ set ds9(gui,bold) systemControlAccentColor
+
+ set pap(fg) $ds9(foreground)
+ set pap(bg) $ds9(background)
+
+ ::tk::unsupported::MacWindowStyle style $ds9(top) document \
+ "closeBox fullZoom collapseBox resizable"
+
proc ::tk::mac::ShowPreferences {} {
PrefsDialog
}
@@ -282,7 +319,15 @@ switch $ds9(wm) {
proc ::tk::mac::LaunchURL {} {
}
}
- win32 {}
+ win32 {
+ set ds9(foreground) black
+ set ds9(background) white
+ set ds9(gui,fg) $ds9(foreground)
+ set ds9(gui,bg) $ds9(background)
+ set ds9(gui,bold) blue
+
+ ttk::style theme use xpnative
+ }
}
# Define Variables
@@ -353,70 +398,6 @@ VODef
WCSDef
ZScaleDef
-# colors
-# ds9(foreground) color of fg
-# ds9(background) color of bg
-# ds9(gui,fg) color of gui fg text
-# ds9(gui,bg) color of gui bg features
-# ds9(gui,bold) color for gui fg bold text
-
-switch $ds9(wm) {
- x11 {
- set ds9(foreground) black
- set ds9(background) white
- set ds9(gui,fg) $ds9(foreground)
- set ds9(gui,bg) $ds9(background)
- set ds9(gui,bold) blue
-
- # edit theme list
- set ds9(themes) [lsort [ttk::style theme names]]
- set ii [lsearch $ds9(themes) alt]
- if {$ii!=-1} {
- set ds9(themes) [lreplace $ds9(themes) $ii $ii]
- }
- set ii [lsearch $ds9(themes) classic]
- if {$ii!=-1} {
- set ds9(themes) [lreplace $ds9(themes) $ii $ii]
- }
-
- # fix TEntry TLabel
- foreach tt [ttk::style theme names] {
- ttk::style theme use $tt
- ttk::style configure TEntry -padding 1
- ttk::style configure TLabel -borderwidth 2 -padding 1
- }
-
- ttk::style theme use $pds9(theme)
-
- if {0} {
- set ds9(gui,bg) #d9d9d9
- option add {*background} $ds9(gui,bg)
- }
- }
- aqua {
- set ds9(foreground) systemTextColor
- set ds9(background) systemTextBackgroundColor
- set ds9(gui,fg) $ds9(foreground)
- set ds9(gui,bg) $ds9(background)
- set ds9(gui,bold) systemControlAccentColor
-
- set pap(fg) $ds9(foreground)
- set pap(bg) $ds9(background)
-
- ::tk::unsupported::MacWindowStyle style $ds9(top) document \
- "closeBox fullZoom collapseBox resizable"
- }
- win32 {
- set ds9(foreground) black
- set ds9(background) white
- set ds9(gui,fg) $ds9(foreground)
- set ds9(gui,bg) $ds9(background)
- set ds9(gui,bold) blue
-
- ttk::style theme use xpnative
- }
-}
-
# let's start
set ds9(init) 1
@@ -515,8 +496,8 @@ ProcessCommandLineFirst
if {$ds9(prefs)} {
LoadPrefs
- # if theme changes
- ttk::style theme use $pds9(theme)
+ # theme may have changed
+ PrefsTheme
}
# set fonts
diff --git a/ds9/library/prefsdialog.tcl b/ds9/library/prefsdialog.tcl
index 7d95dc5..4c9cbb5 100644
--- a/ds9/library/prefsdialog.tcl
+++ b/ds9/library/prefsdialog.tcl
@@ -250,13 +250,23 @@ proc PrefsDialogGeneral {} {
# Color
set f [ttk::labelframe $w.general.color -text [msgcat::mc {Color}]]
- ttk::label $f.ttheme -text [msgcat::mc {Theme}]
- ttk::menubutton $f.theme -textvariable pds9(theme) -menu $f.theme.menu
-
- set m $f.theme.menu
- menu $m
- foreach tt $ds9(themes) {
- $m add radiobutton -label $tt -variable pds9(theme) -command PrefsTheme
+ switch $ds9(wm) {
+ x11 {
+ ttk::label $f.ttheme -text [msgcat::mc {Theme}]
+ ttk::menubutton $f.theme -textvariable pds9(theme) \
+ -menu $f.theme.menu
+
+ set m $f.theme.menu
+ menu $m
+ foreach tt $ds9(themes) {
+ $m add radiobutton -label $tt -variable pds9(theme) \
+ -command PrefsTheme
+ }
+
+ grid $f.ttheme $f.theme -padx 2 -pady 2 -sticky w
+ }
+ aqua -
+ win32 {}
}
ttk::label $f.tbg -text [msgcat::mc {Background Color}]
@@ -265,7 +275,6 @@ proc PrefsDialogGeneral {} {
ttk::label $f.tnan -text [msgcat::mc {Blank/Inf/NaN Color}]
ColorMenuButton $f.nan pds9 nan PrefsNanColor
- grid $f.ttheme $f.theme -padx 2 -pady 2 -sticky w
grid $f.tbg $f.bg -padx 2 -pady 2 -sticky w
grid $f.tnan $f.nan -padx 2 -pady 2 -sticky w
diff --git a/ds9/library/util.tcl b/ds9/library/util.tcl
index 0196b68..f57c0c4 100644
--- a/ds9/library/util.tcl
+++ b/ds9/library/util.tcl
@@ -1075,8 +1075,14 @@ proc SetDefaultTextFont {which} {
}
proc PrefsTheme {} {
+ global ds9
global pds9
- ttk::style theme use $pds9(theme)
+
+ switch $ds9(wm) {
+ x11 {ttk::style theme use $pds9(theme)}
+ aqua -
+ win32 {}
+ }
}
proc PrefsBgColor {} {