diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2019-09-27 19:41:33 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2019-09-27 19:41:33 (GMT) |
commit | 3ae8f7a898af81826d1488fa9875aa11221c3da7 (patch) | |
tree | fc0d81804b345c432fe1599897f44793dc6ee94d /ds9 | |
parent | 947e96456ef63e2ab31e7190cb567d8fb63b5316 (diff) | |
download | blt-3ae8f7a898af81826d1488fa9875aa11221c3da7.zip blt-3ae8f7a898af81826d1488fa9875aa11221c3da7.tar.gz blt-3ae8f7a898af81826d1488fa9875aa11221c3da7.tar.bz2 |
fix macos open/print doc
Diffstat (limited to 'ds9')
-rw-r--r-- | ds9/library/ds9.tcl | 31 | ||||
-rw-r--r-- | ds9/library/macosx.tcl | 34 |
2 files changed, 58 insertions, 7 deletions
diff --git a/ds9/library/ds9.tcl b/ds9/library/ds9.tcl index 5f80b29..f0a3166 100644 --- a/ds9/library/ds9.tcl +++ b/ds9/library/ds9.tcl @@ -59,6 +59,9 @@ proc DS9Def {} { set ds9(next,num) 1 set ds9(last) {} + set ds9(event,opendoc) {} + set ds9(event,printdoc) {} + set ds9(tmpdir) {} switch $ds9(wm) { @@ -263,17 +266,21 @@ switch $ds9(wm) { proc ::tk::mac::OpenDocument {args} { global ds9 - if {$args != {}} { - foreach ff $args { - MultiLoad - LoadFitsFile $ff {} {} - FileLast fitsfbox $ff - } - FinishLoad + # we can recieve this event before everything has been + # initiated, so save and process later + set ds9(event,opendoc) $args + if {!$ds9(init)} { + MacOSOpenDocEvent } } proc ::tk::mac::PrintDocument {args} { + global ds9 + + regsub -all {file://} $args {} ds9(event,printdoc) + if {!$ds9(init)} { + MacOSPrintDocEvent 0 + } } proc ::tk::mac::Quit {} { @@ -560,6 +567,16 @@ ProcessCommandLine # after command line options to set port/fifo/unix... catch {IISInit} +# any os events received? +switch $ds9(wm) { + x11 - + win32 {} + aqua { + MacOSOpenDocEvent + MacOSPrintDocEvent 1 + } +} + # Load any initalization tcl code SourceInitFileDir {.ini} diff --git a/ds9/library/macosx.tcl b/ds9/library/macosx.tcl index 3098692..952829a 100644 --- a/ds9/library/macosx.tcl +++ b/ds9/library/macosx.tcl @@ -4,6 +4,40 @@ package provide DS9 1.0 +proc MacOSOpenDocEvent {} { + global ds9 + + if {$ds9(event,opendoc) != {}} { + foreach ff $ds9(event,opendoc) { + MultiLoad + LoadFitsFile $ff {} {} + FileLast fitsfbox $ff + } + FinishLoad + } +} + +proc MacOSPrintDocEvent {bye} { + global ds9 + + if {$ds9(event,printdoc) != {}} { + foreach ff $ds9(event,printdoc) { + RealizeDS9 + + MultiLoad + LoadFitsFile $ff {} {} + FileLast fitsfbox $ff + + FinishLoad + PostScript + } + + if {$bye} { + Quit + } + } +} + proc MacOSXGetLocale {} { return [macosx locale] } |