From b3145ce58007f51c211c1b03d7e7adc2e02f3181 Mon Sep 17 00:00:00 2001 From: William Joye Date: Wed, 8 May 2019 16:34:14 -0400 Subject: DARWIN: reposition window to upper left corner if X11 and Darwin for SaveAs and Movie --- ds9/doc/release/r8.1.html | 1 + ds9/library/movie.tcl | 14 +++++++++++++- ds9/library/plotdialog.tcl | 10 +++++++++- ds9/library/saveimage.tcl | 11 ++++++++++- ds9/library/util.tcl | 22 ++++++++++++++++++++++ 5 files changed, 55 insertions(+), 3 deletions(-) diff --git a/ds9/doc/release/r8.1.html b/ds9/doc/release/r8.1.html index 75aed02..93bdb5a 100644 --- a/ds9/doc/release/r8.1.html +++ b/ds9/doc/release/r8.1.html @@ -80,6 +80,7 @@
  • 05.03.2019 REGION: fixed statistics dialog if region off image.
  • 05.07.2019 SAMP: removed previous added -keepalive to http::geturl calls except for URL cda.harvard.edu.
  • 05.08.2019 GUI: display 3d coordinates in infobox if available for all types of frames.
  • +
  • 05.08.2019 DARWIN: reposition window to upper left corner if X11 and Darwin for SaveAs and Movie.
  • xx.xx.2019 RELEASE version 8.1b1
  • 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 -- cgit v0.12