diff options
Diffstat (limited to 'ds9/library')
-rw-r--r-- | ds9/library/command.tcl | 23 | ||||
-rw-r--r-- | ds9/library/ds9.tcl | 35 | ||||
-rw-r--r-- | ds9/library/util.tcl | 10 |
3 files changed, 49 insertions, 19 deletions
diff --git a/ds9/library/command.tcl b/ds9/library/command.tcl index 6fd1e53..adaad7b 100644 --- a/ds9/library/command.tcl +++ b/ds9/library/command.tcl @@ -14,7 +14,6 @@ proc BadVisualError {} { proc ProcessCommandLineFirst {} { global argc global argv - global icolorbar global ds9 global pds9 @@ -23,10 +22,26 @@ proc ProcessCommandLineFirst {} { set item [lindex $argv $i] switch -- $item { - -help { - puts "For more information, use --help" - QuitDS9 + -prefs { + incr i + ProcessPrefsFirstCmd argv i } + } + incr i + } +} + +proc ProcessCommandLineSecond {} { + global argc + global argv + global ds9 + global pds9 + + set i 0 + while {$i < $argc} { + set item [lindex $argv $i] + + switch -- $item { -debug { incr i ProcessDebugTclCmd argv i diff --git a/ds9/library/ds9.tcl b/ds9/library/ds9.tcl index 61e3bad..54cd852 100644 --- a/ds9/library/ds9.tcl +++ b/ds9/library/ds9.tcl @@ -24,6 +24,7 @@ proc DS9Def {} { set ds9(depth) 8 set ds9(FTY_MAXAXES) 10 set ds9(threads) [GetNumCores] + set ds9(prefs) 1 set ds9(helvetica) [font configure TkDefaultFont -family] set ds9(courier) [font configure TkFixedFont -family] @@ -383,19 +384,6 @@ event add <<SelectAll>> <${ds9(ctrl)}a> event add <<Find>> <${ds9(ctrl)}f> event add <<FindNext>> <${ds9(ctrl)}g> -# Init Temporary Dir before prefs -InitTempDir - -# Init the filter compiler -InitFilterCompiler - -# Load any preferences here, before we do any real work -LoadPrefs - -# set fonts -SetDefaultFont false -SetDefaultTextFont false - switch $ds9(wm) { x11 - win32 {} @@ -413,10 +401,27 @@ wm title $ds9(top) "SAOImage $ds9(title)" wm iconname $ds9(top) "SAOImage $ds9(title)" wm protocol $ds9(top) WM_DELETE_WINDOW QuitDS9 -# we need to set certain variables before anything else -# such as color, title, language +# Init Temporary Dir before prefs +InitTempDir + +# Init the filter compiler +InitFilterCompiler + +# we need to check to see to run prefs first ProcessCommandLineFirst +# Load any preferences here, before we do any real work +if {$ds9(prefs)} { + LoadPrefs +} + +# set fonts +SetDefaultFont false +SetDefaultTextFont false + +# we need to set certain variables such as color, title, language +ProcessCommandLineSecond + # initialize language switch $pds9(language) { locale { diff --git a/ds9/library/util.tcl b/ds9/library/util.tcl index c3a297f..5cdfd5c 100644 --- a/ds9/library/util.tcl +++ b/ds9/library/util.tcl @@ -1377,6 +1377,16 @@ proc DS9Backup {ch which} { # Process Cmds +proc ProcessPrefsFirstCmd {varname iname} { + upvar $varname var + upvar $iname i + + prefsfirst::YY_FLUSH_BUFFER + prefsfirst::yy_scan_string [lrange $var $i end] + prefsfirst::yyparse + incr i [expr $prefsfirst::yycnt-1] +} + proc ProcessPrefsCmd {varname iname} { upvar $varname var upvar $iname i |