diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2019-05-08 20:34:14 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2019-05-08 20:34:14 (GMT) |
commit | b3145ce58007f51c211c1b03d7e7adc2e02f3181 (patch) | |
tree | dddf6d1bef91bb2f2d0badccbbe93fe9f2fc547e /ds9/library | |
parent | 1a590027c4000f8068e421237ace87479f77c2f0 (diff) | |
download | blt-b3145ce58007f51c211c1b03d7e7adc2e02f3181.zip blt-b3145ce58007f51c211c1b03d7e7adc2e02f3181.tar.gz blt-b3145ce58007f51c211c1b03d7e7adc2e02f3181.tar.bz2 |
DARWIN: reposition window to upper left corner if X11 and Darwin for SaveAs and Movie
Diffstat (limited to 'ds9/library')
-rw-r--r-- | ds9/library/movie.tcl | 14 | ||||
-rw-r--r-- | ds9/library/plotdialog.tcl | 10 | ||||
-rw-r--r-- | ds9/library/saveimage.tcl | 11 | ||||
-rw-r--r-- | ds9/library/util.tcl | 22 |
4 files changed, 54 insertions, 3 deletions
diff --git a/ds9/library/movie.tcl b/ds9/library/movie.tcl index 3320f6a..2756590 100644 --- a/ds9/library/movie.tcl +++ b/ds9/library/movie.tcl @@ -301,8 +301,12 @@ proc MoviePhotoMPEG {} { UpdateDS9 RealizeDS9 1 + # for darwin only + set geom [DarwinPhotoFix] + set rr [catch {image create photo -format window -data $ds9(canvas)} ph] if {$rr} { + DarwinPhotoRestore $geom Error $movie(error) return $rr } @@ -315,8 +319,10 @@ proc MoviePhotoMPEG {} { set movie(first) 0 } mpeg add $ph - image delete $ph + + # reset if needed + DarwinPhotoRestore $geom return 0 } @@ -330,8 +336,12 @@ proc MoviePhotoGIF {} { UpdateDS9 RealizeDS9 1 + # for darwin only + set geom [DarwinPhotoFix] + set rr [catch {image create photo -format window -data $ds9(canvas)} ph] if {$rr} { + DarwinPhotoRestore $geom Error $movie(error) return $rr } @@ -343,6 +353,8 @@ proc MoviePhotoGIF {} { agif add $ph image delete $ph + # reset if needed + DarwinPhotoRestore $geom return 0 } diff --git a/ds9/library/plotdialog.tcl b/ds9/library/plotdialog.tcl index a00976f..4f20525 100644 --- a/ds9/library/plotdialog.tcl +++ b/ds9/library/plotdialog.tcl @@ -566,9 +566,14 @@ proc PlotExport {varname fn format} { # besure we are on top raise $var(top) + # for darwin only + set geom [DarwinPhotoFix] + set rr [catch {image create photo -format window -data $var(graph)} ph] - if {$rr != 0} { + if {$rr} { + DarwinPhotoRestore $geom Error $iap(error) + return } switch -- $format { @@ -581,4 +586,7 @@ proc PlotExport {varname fn format} { } image delete $ph + + # reset if needed + DarwinPhotoRestore $geom } diff --git a/ds9/library/saveimage.tcl b/ds9/library/saveimage.tcl index cffd3cb..ebe0a34 100644 --- a/ds9/library/saveimage.tcl +++ b/ds9/library/saveimage.tcl @@ -90,11 +90,17 @@ proc SaveImage {fn format} { proc SaveImagePhoto {fn format} { global ds9 + global tcl_platform global saveimage + # for darwin only + set geom [DarwinPhotoFix] + set rr [catch {image create photo -format window -data $ds9(canvas)} ph] - if {$rr != 0} { + if {$rr} { + DarwinPhotoRestore $geom Error $saveimage(error) + return } switch -- $format { @@ -107,6 +113,9 @@ proc SaveImagePhoto {fn format} { } image delete $ph + + # reset if needed + DarwinPhotoRestore $geom } # Process Cmds diff --git a/ds9/library/util.tcl b/ds9/library/util.tcl index 0722489..7d04674 100644 --- a/ds9/library/util.tcl +++ b/ds9/library/util.tcl @@ -1342,6 +1342,28 @@ proc FixSpec {sysname skyname formatname defsys defsky defformat} { return $rr } +proc DarwinPhotoFix {} { + global ds9 + global tcl_platform + + if {$ds9(wm) == {x11} && $tcl_platform(os) == {Darwin}} { + set geom [wm geometry $ds9(top)] + wm geometry $ds9(top) "[lindex [split $geom {+}] 0]+0+1" + update + return $geom + } + return {} +} + +proc DarwinPhotoRestore {geom} { + global ds9 + global tcl_platform + + if {$ds9(wm) == {x11} && $tcl_platform(os) == {Darwin}} { + wm geometry $ds9(top) $geom + } +} + proc DS9Backup {ch which} { global pds9 |