From ef0aaff5e62f47b4b5e3d9a6d2ececc098234ea5 Mon Sep 17 00:00:00 2001 From: William Joye Date: Fri, 22 Mar 2019 17:11:22 -0400 Subject: add background color option --- ds9/library/ds9.tcl | 37 ++++++++++++++++++++++--------------- ds9/library/graph.tcl | 4 ++-- ds9/library/plot.tcl | 4 ++++ ds9/library/scale.tcl | 2 ++ 4 files changed, 30 insertions(+), 17 deletions(-) diff --git a/ds9/library/ds9.tcl b/ds9/library/ds9.tcl index 2153905..8d5878b 100644 --- a/ds9/library/ds9.tcl +++ b/ds9/library/ds9.tcl @@ -173,27 +173,34 @@ if {[catch {tk windowingsystem} ds9(wm)]} { set ds9(app) [file tail [info nameofexecutable]] # Themes are now hardcoded +# can't be defined in ds9def() +set ds9(background) #d9d9d9 +#set ds9(background) white + switch $ds9(wm) { x11 { - # set bg for non ttk widgets - set bg [ttk::style lookup "." -background] - # standard widgets - option add {*Text.Background} $bg - option add {*Listbox.Background} $bg - option add {*PlotBackground} $bg + option add {*background} $ds9(background) # ttk widgets - ttk::style configure TLabel -borderwidth 2 -padding 1 - ttk::style configure TEntry -fieldbackground $bg -padding 1 - } - aqua { - # set bg for non ttk widgets - set bg [ttk::style lookup "." -background] - - # standard widgets - option add {*PlotBackground} $bg + ttk::style configure TFrame -background $ds9(background) + ttk::style configure TLabelframe -background $ds9(background) + ttk::style configure TLabelframe.Label -background $ds9(background) + ttk::style configure TLabel -background $ds9(background) + ttk::style configure TEntry -fieldbackground $ds9(background) + ttk::style configure TButton -background $ds9(background) + ttk::style configure TCheckbutton -background $ds9(background) + ttk::style configure TRadiobutton -background $ds9(background) + ttk::style configure TMenubutton -background $ds9(background) + ttk::style configure TScale -background $ds9(background) + ttk::style configure TScrollbar -background $ds9(background) \ + -troughcolor $ds9(background) + ttk::style configure TProgressbar -troughcolor $ds9(background) + + ttk::style configure TEntry -padding 1 + ttk::style configure TLabel -borderwidth 2 -padding 1 } + aqua {} win32 {ttk::style theme use xpnative} } diff --git a/ds9/library/graph.tcl b/ds9/library/graph.tcl index edf88e4..6f7d396 100644 --- a/ds9/library/graph.tcl +++ b/ds9/library/graph.tcl @@ -55,11 +55,11 @@ proc CreateGraphs {} { -width $canvas(width) -height $igraph(size) \ -takefocus 0 \ -background $ds9(bg) \ + -plotbackground $ds9(bg) \ -highlightthickness 0 \ -borderwidth 0 \ -plotborderwidth 1 \ -plotrelief solid \ - -plotbackground $ds9(bg) \ -font [font actual TkDefaultFont] \ -rm $igraph(gap,x) \ -plotpadx -2 \ @@ -97,11 +97,11 @@ proc CreateGraphs {} { -width $igraph(size) -height $canvas(height) \ -takefocus 0 \ -background $ds9(bg) \ + -plotbackground $ds9(bg) \ -highlightthickness 0 \ -borderwidth 0 \ -plotborderwidth 1 \ -plotrelief solid \ - -plotbackground $ds9(bg) \ -font [font actual TkDefaultFont] \ -bm $igraph(gap,y) \ -plotpady -2 \ diff --git a/ds9/library/plot.tcl b/ds9/library/plot.tcl index 19cd77d..98cf932 100644 --- a/ds9/library/plot.tcl +++ b/ds9/library/plot.tcl @@ -1105,17 +1105,21 @@ proc PlotUpdateGraph {varname} { -bg $var(graph,bg) -plotbackground $var(graph,bg) $var(graph) xaxis configure \ + -bg $var(graph,bg) \ -grid $var(axis,x,grid) -logscale $var(axis,x,log) \ -title $var(axis,x,title) \ -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)" + $var(graph) yaxis configure \ + -bg $var(graph,bg) \ -grid $var(axis,y,grid) -logscale $var(axis,y,log) \ -title $var(axis,y,title) \ -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)" $var(graph) legend configure -hide [expr !$var(legend)] \ + -bg $var(graph,bg) \ -position $var(legend,position) -title $var(legend,title) \ -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)" diff --git a/ds9/library/scale.tcl b/ds9/library/scale.tcl index 012937a..e3ee8bf 100644 --- a/ds9/library/scale.tcl +++ b/ds9/library/scale.tcl @@ -305,6 +305,8 @@ proc ScaleDialog {} { # Graph set dscale(hist) [blt::graph $f.chart \ + -background $ds9(background) \ + -plotbackground $ds9(background) \ -width 500 \ -height 200 \ -title [msgcat::mc {Pixel Distribution}] \ -- cgit v0.12