From af56db7f8599b9604e1191927005967437091ebc Mon Sep 17 00:00:00 2001 From: William Joye Date: Fri, 12 Jan 2018 13:46:55 -0500 Subject: add precision command --- ds9/library/ds9.tcl | 6 +++--- ds9/library/frame.tcl | 1 + ds9/library/prefsdialog.tcl | 49 +++++++++++++++++++++++++++++++++++++++++++++ ds9/library/util.tcl | 4 ++++ 4 files changed, 57 insertions(+), 3 deletions(-) diff --git a/ds9/library/ds9.tcl b/ds9/library/ds9.tcl index a7794bb..276fb0d 100644 --- a/ds9/library/ds9.tcl +++ b/ds9/library/ds9.tcl @@ -133,9 +133,6 @@ proc DS9Def {} { win32 {set pds9(xpa) 0} } - set pds9(bg) white - set pds9(nan) white - set pds9(prec,linear) 8 set pds9(prec,deg) 10 set pds9(prec,hms) 4 @@ -143,6 +140,9 @@ proc DS9Def {} { set pds9(prec,arcmin) 5 set pds9(prec,arcsec) 3 + set pds9(bg) white + set pds9(nan) white + set pds9(samp) 1 set pds9(confirm) 1 set pds9(iraf) 1 diff --git a/ds9/library/frame.tcl b/ds9/library/frame.tcl index 3da0029..7a9024e 100644 --- a/ds9/library/frame.tcl +++ b/ds9/library/frame.tcl @@ -142,6 +142,7 @@ proc CreateNameNumberFrame {which type} { $ds9(next) bg color $pds9(bg) $ds9(next) nan color $pds9(nan) + $ds9(next) iraf align $pds9(iraf) $ds9(next) marker epsilon $pmarker(epsilon) diff --git a/ds9/library/prefsdialog.tcl b/ds9/library/prefsdialog.tcl index cdc02e7..fa36c64 100644 --- a/ds9/library/prefsdialog.tcl +++ b/ds9/library/prefsdialog.tcl @@ -53,6 +53,7 @@ proc PrefsDialog {{which {}}} { set dprefs(tabs) {} PrefsDialogGeneral + PrefsDialogPrecision PrefsDialogStartup PrefsDialogMenu PrefsDialogPanner @@ -295,6 +296,54 @@ proc PrefsDialogGeneral {} { -side top -fill both -expand true } +proc PrefsDialogPrecision {} { + global dprefs + global ds9 + global pds9 + + set w $dprefs(tab) + + $dprefs(list) insert end [msgcat::mc {Precision}] + lappend dprefs(tabs) [ttk::frame $w.precision] + + # Coordinates + set f [ttk::labelframe $w.precision.coord -text [msgcat::mc {Coordinates}]] + + ttk::label $f.tlinear -text [msgcat::mc {Linear}] + ttk::entry $f.linear -textvariable pds9(prec,linear) \ + -validate focusout -validatecommand PrefsPrecision -width 8 + ttk::label $f.tdeg -text [msgcat::mc {Degrees}] + ttk::entry $f.deg -textvariable pds9(prec,deg) \ + -validate focusout -validatecommand PrefsPrecision -width 8 + ttk::label $f.thms -text [msgcat::mc {HMS}] + ttk::entry $f.hms -textvariable pds9(prec,hms) \ + -validate focusout -validatecommand PrefsPrecision -width 8 + ttk::label $f.tdms -text [msgcat::mc {DMS}] + ttk::entry $f.dms -textvariable pds9(prec,dms) \ + -validate focusout -validatecommand PrefsPrecision -width 8 + + grid $f.tlinear $f.linear -padx 2 -pady 2 -sticky w + grid $f.tdeg $f.deg -padx 2 -pady 2 -sticky w + grid $f.thms $f.hms -padx 2 -pady 2 -sticky w + grid $f.tdms $f.dms -padx 2 -pady 2 -sticky w + + # Length + set f [ttk::labelframe $w.precision.length -text [msgcat::mc {Length}]] + + ttk::label $f.tarcmin -text [msgcat::mc {ArcMin}] + ttk::entry $f.arcmin -textvariable pds9(prec,arcmin) \ + -validate focusout -validatecommand PrefsPrecision -width 8 + ttk::label $f.tarcsec -text [msgcat::mc {ArcSec}] + ttk::entry $f.arcsec -textvariable pds9(prec,arcsec) \ + -validate focusout -validatecommand PrefsPrecision -width 8 + + grid $f.tarcmin $f.arcmin -padx 2 -pady 2 -sticky w + grid $f.tarcsec $f.arcsec -padx 2 -pady 2 -sticky w + + pack $w.precision.coord $w.precision.length \ + -side top -fill both -expand true +} + proc PrefsDialogStartup {} { global dprefs diff --git a/ds9/library/util.tcl b/ds9/library/util.tcl index a647097..c4e8a2a 100644 --- a/ds9/library/util.tcl +++ b/ds9/library/util.tcl @@ -865,6 +865,8 @@ proc PrefsPrecision {} { $pds9(prec,deg) $pds9(prec,hms) $pds9(prec,dms) \ $pds9(prec,arcmin) $pds9(prec,arcsec) } + # prefs validation command + return true } proc ChangeThreads {} { @@ -873,6 +875,8 @@ proc ChangeThreads {} { foreach ff $ds9(frames) { $ff threads $ds9(threads) } + # prefs validation command + return true } proc PrefsIRAFAlign {} { -- cgit v0.12