diff options
-rw-r--r-- | ds9/library/ds9.tcl | 52 | ||||
-rw-r--r-- | ds9/library/graph.tcl | 58 | ||||
-rw-r--r-- | ds9/library/plot.tcl | 24 | ||||
-rw-r--r-- | ds9/library/plotdialog.tcl | 46 | ||||
-rw-r--r-- | ds9/library/plotstate.tcl | 5 | ||||
-rw-r--r-- | ds9/library/scale.tcl | 4 |
6 files changed, 126 insertions, 63 deletions
diff --git a/ds9/library/ds9.tcl b/ds9/library/ds9.tcl index 7622d6e..f54ca53 100644 --- a/ds9/library/ds9.tcl +++ b/ds9/library/ds9.tcl @@ -75,6 +75,12 @@ proc DS9Def {} { set ds9(menu,size,wrap) 20 set ds9(display) single + + # ds9(foreground) color of GUI text + # ds9(background) color of GUI bg + # ds9(plot,fg) color of Plot fg + # ds9(plot,bg) color of Plot bg + # ds9(bg) color of canvas,frame bg set ds9(bg) white set ds9(array,x) 512 @@ -175,7 +181,10 @@ set ds9(app) [file tail [info nameofexecutable]] switch $ds9(wm) { x11 { + set ds9(foreground) black set ds9(background) #d9d9d9 + set ds9(plot,fg) black + set ds9(plot,bg) white # standard widgets option add {*background} $ds9(background) @@ -199,11 +208,17 @@ switch $ds9(wm) { ttk::style configure TLabel -borderwidth 2 -padding 1 } aqua { - # dark mode bg #222 text #ddd + set ds9(foreground) black set ds9(background) white + set ds9(plot,fg) black + set ds9(plot,bg) white } win32 { + set ds9(foreground) black set ds9(background) white + set ds9(plot,fg) black + set ds9(plot,bg) white + ttk::style theme use xpnative } } @@ -287,14 +302,17 @@ switch $ds9(wm) { QuitDS9 } - proc ::tk::mac::onHide {} { + proc ::tk::mac::ShowHelp {} { + HelpRef } - proc ::tk::mac::onShow {} { + proc ::tk::mac::DoScriptFile {args} { } - proc ::tk::mac::ShowHelp {} { - HelpRef + proc ::tk::mac::DoScriptText {args} { + } + + proc ::tk::mac::LaunchURL {} { } } win32 {} @@ -406,8 +424,28 @@ switch $ds9(wm) { # and test for dark mode update idletasks - ::tk::unsupported::MacWindowStyle style $ds9(top) document "closeBox fullZoom collapseBox resizable" - # set rr [tk::unsupported::MacWindowStyle isdark $ds9(top)] + ::tk::unsupported::MacWindowStyle style $ds9(top) document \ + "closeBox fullZoom collapseBox resizable" + + # check for darkmode + if {[tk::unsupported::MacWindowStyle isdark $ds9(top)]} { + # dark mode bg #222 text #ddd + set ds9(foreground) #ddd + set ds9(background) #222 + set ds9(plot,fg) $ds9(foreground) + set ds9(plot,bg) $ds9(background) + } else { + set ds9(foreground) black + set ds9(background) white + set ds9(plot,fg) black + set ds9(plot,bg) white + } + global pds9 + set ds9(bg) $ds9(background) + set pds9(bg) $ds9(background) + global pap + set pap(foreground) $ds9(plot,fg) + set pap(background) $ds9(plot,bg) } } diff --git a/ds9/library/graph.tcl b/ds9/library/graph.tcl index 6f7d396..09860eb 100644 --- a/ds9/library/graph.tcl +++ b/ds9/library/graph.tcl @@ -54,31 +54,32 @@ proc CreateGraphs {} { set ds9(graph,horz) [blt::graph $ds9(main).horz \ -width $canvas(width) -height $igraph(size) \ -takefocus 0 \ - -background $ds9(bg) \ - -plotbackground $ds9(bg) \ + -background $ds9(plot,bg) \ + -plotbackground $ds9(plot,bg) \ + -foreground $ds9(plot,fg) \ -highlightthickness 0 \ -borderwidth 0 \ - -plotborderwidth 1 \ - -plotrelief solid \ -font [font actual TkDefaultFont] \ -rm $igraph(gap,x) \ -plotpadx -2 \ ] - # we need to manually set the element foreground color, i.e. use graph fg - set fgcolor [$ds9(graph,horz) cget -foreground] $ds9(graph,horz) legend configure -hide yes $ds9(graph,horz) crosshairs configure -color green $ds9(graph,horz) xaxis configure -hide no -showticks no -linewidth 0 \ - -bg $ds9(bg) - $ds9(graph,horz) x2axis configure -hide yes - $ds9(graph,horz) yaxis configure -hide yes - $ds9(graph,horz) y2axis configure -hide no -bg $ds9(bg) \ - -tickfont [font actual TkDefaultFont] - - $ds9(graph,horz) element create line1 -xdata graphHorzX -ydata graphHorzY \ - -color $fgcolor -symbol none + -bg $ds9(plot,bg) -color $ds9(plot,fg) + $ds9(graph,horz) x2axis configure -hide yes \ + -bg $ds9(plot,bg) -color $ds9(plot,fg) + $ds9(graph,horz) yaxis configure -hide yes \ + -bg $ds9(plot,bg) -color $ds9(plot,fg) + $ds9(graph,horz) y2axis configure -hide no -bg $ds9(plot,bg) \ + -tickfont [font actual TkDefaultFont] \ + -bg $ds9(plot,bg) -color $ds9(plot,fg) + + $ds9(graph,horz) element create line1 \ + -xdata graphHorzX -ydata graphHorzY -symbol none \ + -color $ds9(plot,fg) bind $ds9(graph,horz) <Enter> [list EnterGraph $ds9(graph,horz) 1] bind $ds9(graph,horz) <Leave> [list LeaveGraph $ds9(graph,horz)] @@ -96,12 +97,11 @@ proc CreateGraphs {} { -invertxy yes \ -width $igraph(size) -height $canvas(height) \ -takefocus 0 \ - -background $ds9(bg) \ - -plotbackground $ds9(bg) \ + -background $ds9(plot,bg) \ + -plotbackground $ds9(plot,bg) \ + -foreground $ds9(plot,fg) \ -highlightthickness 0 \ -borderwidth 0 \ - -plotborderwidth 1 \ - -plotrelief solid \ -font [font actual TkDefaultFont] \ -bm $igraph(gap,y) \ -plotpady -2 \ @@ -109,15 +109,21 @@ proc CreateGraphs {} { $ds9(graph,vert) legend configure -hide yes $ds9(graph,vert) crosshairs configure -color green - $ds9(graph,vert) xaxis configure -hide yes -descending yes - $ds9(graph,vert) x2axis configure -hide no -descending yes \ - -showticks no -linewidth 0 -bg $ds9(bg) - $ds9(graph,vert) yaxis configure -hide no -descending yes \ - -bg $ds9(bg) -tickfont [font actual TkDefaultFont] - $ds9(graph,vert) y2axis configure -hide yes -descending yes + $ds9(graph,vert) xaxis configure -hide yes -descending yes \ + -bg $ds9(plot,bg) -color $ds9(plot,fg) + $ds9(graph,vert) x2axis configure -hide no -descending yes \ + -showticks no -linewidth 0 \ + -bg $ds9(plot,bg) -color $ds9(plot,fg) \ - $ds9(graph,vert) element create line1 -xdata graphVertX -ydata graphVertY \ - -color $fgcolor -symbol none + $ds9(graph,vert) yaxis configure -hide no -descending yes \ + -tickfont [font actual TkDefaultFont] \ + -bg $ds9(plot,bg) -color $ds9(plot,fg) + $ds9(graph,vert) y2axis configure -hide yes -descending yes \ + -bg $ds9(plot,bg) -color $ds9(plot,fg) + + $ds9(graph,vert) element create line1 \ + -xdata graphVertX -ydata graphVertY -symbol none \ + -color $ds9(plot,fg) bind $ds9(graph,vert) <Enter> [list EnterGraph $ds9(graph,vert) 0] bind $ds9(graph,vert) <Leave> [list LeaveGraph $ds9(graph,vert)] diff --git a/ds9/library/plot.tcl b/ds9/library/plot.tcl index 9b9b438..8af822b 100644 --- a/ds9/library/plot.tcl +++ b/ds9/library/plot.tcl @@ -807,23 +807,29 @@ proc PlotUpdateCanvas {varname} { foreach cc $var(graphs) { $var($cc,graph) configure -plotpadx 0 -plotpady 0 \ - -font "{$ds9($var(graph,title,family))} $var(graph,title,size) $var(graph,title,weight) $var(graph,title,slant)" \ - -bg $var(background) -plotbackground $var(background) + -bg $var(background) -plotbackground $var(background) \ + -fg $var(foreground) \ + -font "{$ds9($var(graph,title,family))} $var(graph,title,size) $var(graph,title,weight) $var(graph,title,slant)" $var($cc,graph) xaxis configure \ - -bg $var(background) \ + -bg $var(background) -color $var(foreground) \ -tickfont "{$ds9($var(axis,font,family))} $var(axis,font,size) $var(axis,font,weight) $var(axis,font,slant)" \ - -titlefont "{$ds9($var(axis,title,family))} $var(axis,title,size) $var(axis,title,weight) $var(axis,title,slant)" + -titlefont "{$ds9($var(axis,title,family))} $var(axis,title,size) $var(axis,title,weight) $var(axis,title,slant)" \ + -titlecolor $var(foreground) \ + -gridcolor $var(grid,color) -gridminorcolor $var(grid,color) $var($cc,graph) yaxis configure \ - -bg $var(background) \ + -bg $var(background) -color $var(foreground) \ -tickfont "{$ds9($var(axis,font,family))} $var(axis,font,size) $var(axis,font,weight) $var(axis,font,slant)" \ - -titlefont "{$ds9($var(axis,title,family))} $var(axis,title,size) $var(axis,title,weight) $var(axis,title,slant)" + -titlefont "{$ds9($var(axis,title,family))} $var(axis,title,size) $var(axis,title,weight) $var(axis,title,slant)" \ + -titlecolor $var(foreground) \ + -gridcolor $var(grid,color) -gridminorcolor $var(grid,color) $var($cc,graph) legend configure \ - -bg $var(background) \ + -bg $var(background) -fg $var(foreground) \ -font "{$ds9($var(legend,font,family))} $var(legend,font,size) $var(legend,font,weight) $var(legend,font,slant)" \ - -titlefont "{$ds9($var(legend,title,family))} $var(legend,title,size) $var(legend,title,weight) $var(legend,title,slant)" + -titlefont "{$ds9($var(legend,title,family))} $var(legend,title,size) $var(legend,title,weight) $var(legend,title,slant)" \ + -titlecolor $var(foreground) switch $var(layout) { grid - @@ -1123,7 +1129,9 @@ proc PlotBackup {ch dir} { puts $ch "set ${varname}(layout,strip,scale) $var(layout,strip,scale)" puts $ch "PlotChangeLayout $varname" + puts $ch "set ${varname}(foreground) $var(foreground)" puts $ch "set ${varname}(background) $var(background)" + puts $ch "set ${varname}(grid,color) $var(grid,color)" puts $ch "set ${varname}(bar,mode) $var(bar,mode)" puts $ch "PlotUpdateCanvas $varname" diff --git a/ds9/library/plotdialog.tcl b/ds9/library/plotdialog.tcl index 3c663f9..e253c1d 100644 --- a/ds9/library/plotdialog.tcl +++ b/ds9/library/plotdialog.tcl @@ -120,10 +120,24 @@ proc PlotDialog {varname wtt} { $var(mb).canvas add cascade -label [msgcat::mc {Layout}] \ -menu $var(mb).canvas.layout $var(mb).canvas add separator - $var(mb).canvas add cascade -label [msgcat::mc {Font}] \ - -menu $var(mb).canvas.font + $var(mb).canvas add cascade -label [msgcat::mc {Title}] \ + -menu $var(mb).canvas.title + $var(mb).canvas add cascade -label [msgcat::mc {Axes Title}] \ + -menu $var(mb).canvas.textlab + $var(mb).canvas add cascade -label [msgcat::mc {Axes Number}] \ + -menu $var(mb).canvas.numlab + $var(mb).canvas add cascade -label [msgcat::mc {Legend Title}] \ + -menu $var(mb).canvas.legendtitle + $var(mb).canvas add cascade -label [msgcat::mc {Legend}] \ + -menu $var(mb).canvas.legend + + $var(mb).canvas add separator + $var(mb).canvas add cascade -label [msgcat::mc {Forground}] \ + -menu $var(mb).canvas.fg $var(mb).canvas add cascade -label [msgcat::mc {Background}] \ -menu $var(mb).canvas.bg + $var(mb).canvas add cascade -label [msgcat::mc {Grid}] \ + -menu $var(mb).canvas.grid menu $var(mb).canvas.select @@ -154,37 +168,31 @@ proc PlotDialog {varname wtt} { -label "[msgcat::mc {Strip Parameters}]..." \ -command [list PlotStripDialog $varname] - menu $var(mb).canvas.font - $var(mb).canvas.font add cascade -label [msgcat::mc {Title}] \ - -menu $var(mb).canvas.font.title - $var(mb).canvas.font add cascade -label [msgcat::mc {Axes Title}] \ - -menu $var(mb).canvas.font.textlab - $var(mb).canvas.font add cascade -label [msgcat::mc {Axes Number}] \ - -menu $var(mb).canvas.font.numlab - $var(mb).canvas.font add cascade -label [msgcat::mc {Legend Title}] \ - -menu $var(mb).canvas.font.legendtitle - $var(mb).canvas.font add cascade -label [msgcat::mc {Legend}] \ - -menu $var(mb).canvas.font.legend - - FontMenu $var(mb).canvas.font.title \ + FontMenu $var(mb).canvas.title \ $varname graph,title,family graph,title,size graph,title,weight \ graph,title,slant [list PlotUpdateCanvas $varname] - FontMenu $var(mb).canvas.font.textlab \ + FontMenu $var(mb).canvas.textlab \ $varname axis,title,family axis,title,size axis,title,weight \ axis,title,slant [list PlotUpdateCanvas $varname] - FontMenu $var(mb).canvas.font.numlab \ + FontMenu $var(mb).canvas.numlab \ $varname axis,font,family axis,font,size axis,font,weight \ axis,font,slant [list PlotUpdateCanvas $varname] - FontMenu $var(mb).canvas.font.legendtitle \ + FontMenu $var(mb).canvas.legendtitle \ $varname legend,title,family legend,title,size legend,title,weight \ legend,title,slant [list PlotUpdateCanvas $varname] - FontMenu $var(mb).canvas.font.legend \ + FontMenu $var(mb).canvas.legend \ $varname legend,font,family legend,font,size legend,font,weight \ legend,font,slant [list PlotUpdateCanvas $varname] + PlotColorMenu $var(mb).canvas.fg $varname foreground \ + [list PlotUpdateCanvas $varname] + PlotColorMenu $var(mb).canvas.bg $varname background \ [list PlotUpdateCanvas $varname] + PlotColorMenu $var(mb).canvas.grid $varname grid,color \ + [list PlotUpdateCanvas $varname] + # Graph menu $var(mb).graph diff --git a/ds9/library/plotstate.tcl b/ds9/library/plotstate.tcl index c79fd31..bf56afb 100644 --- a/ds9/library/plotstate.tcl +++ b/ds9/library/plotstate.tcl @@ -7,6 +7,7 @@ package provide DS9 1.0 # Plot State proc PlotDefState {} { global pap + global ds9 # per Canvas set pap(layout) grid @@ -18,7 +19,9 @@ proc PlotDefState {} { set pap(layout,axis,x,log) 0 set pap(layout,axis,x,flip) 0 - set pap(background) white + set pap(foreground) $ds9(plot,fg) + set pap(background) $ds9(plot,bg) + set pap(grid,color) gray64 set pap(bar,mode) normal set pap(graph,format) 1 diff --git a/ds9/library/scale.tcl b/ds9/library/scale.tcl index e3ee8bf..7e1d6ae 100644 --- a/ds9/library/scale.tcl +++ b/ds9/library/scale.tcl @@ -305,8 +305,8 @@ proc ScaleDialog {} { # Graph set dscale(hist) [blt::graph $f.chart \ - -background $ds9(background) \ - -plotbackground $ds9(background) \ + -background $ds9(plot,bg) \ + -plotbackground $ds9(plot,bg) \ -width 500 \ -height 200 \ -title [msgcat::mc {Pixel Distribution}] \ |