From 37e757832a7f2c690cea41df5bf9cfa9ee18f67f Mon Sep 17 00:00:00 2001 From: William Joye Date: Thu, 9 May 2019 13:31:49 -0400 Subject: DARWIN: reposition window to upper left corner if X11 and Darwin for SaveAs and Movie --- ds9/library/movie.tcl | 36 ++++++++++++------------------------ ds9/library/plotdialog.tcl | 7 ------- ds9/library/util.tcl | 4 +++- 3 files changed, 15 insertions(+), 32 deletions(-) diff --git a/ds9/library/movie.tcl b/ds9/library/movie.tcl index 2756590..84d507d 100644 --- a/ds9/library/movie.tcl +++ b/ds9/library/movie.tcl @@ -148,6 +148,9 @@ proc MovieCreate {fn} { DisplayMode } + # for darwin only + set geom [DarwinPhotoFix] + set movie(fn) $fn switch $movie(action) { frame {MovieFrame} @@ -155,10 +158,19 @@ proc MovieCreate {fn} { 3d {Movie3d} } + # close + switch $movie(type) { + mpeg {mpeg close} + gif {agif close} + } + if {[info exists modesav]} { set current(display) $modesav DisplayMode } + + # reset if needed + DarwinPhotoRestore $geom } proc MovieFrame {} { @@ -177,7 +189,6 @@ proc MovieFrame {} { break } } - MovieClose set ds9(next) $framesav GotoFrame @@ -202,7 +213,6 @@ proc MovieSlice {} { break } } - MovieClose # reset current slice $current(frame) update fits slice $slice @@ -260,7 +270,6 @@ proc Movie3d {} { } } } - MovieClose MovieStatusDestroyDialog @@ -283,15 +292,6 @@ proc MoviePhoto {} { return 1 } -proc MovieClose {} { - global movie - - switch $movie(type) { - mpeg {mpeg close} - gif {agif close} - } -} - proc MoviePhotoMPEG {} { global ds9 global movie @@ -301,12 +301,8 @@ 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 } @@ -321,8 +317,6 @@ proc MoviePhotoMPEG {} { mpeg add $ph image delete $ph - # reset if needed - DarwinPhotoRestore $geom return 0 } @@ -336,12 +330,8 @@ 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 } @@ -353,8 +343,6 @@ 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 4f20525..1054014 100644 --- a/ds9/library/plotdialog.tcl +++ b/ds9/library/plotdialog.tcl @@ -566,12 +566,8 @@ 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} { - DarwinPhotoRestore $geom Error $iap(error) return } @@ -586,7 +582,4 @@ proc PlotExport {varname fn format} { } image delete $ph - - # reset if needed - DarwinPhotoRestore $geom } diff --git a/ds9/library/util.tcl b/ds9/library/util.tcl index 7d04674..c3a297f 100644 --- a/ds9/library/util.tcl +++ b/ds9/library/util.tcl @@ -1359,7 +1359,9 @@ proc DarwinPhotoRestore {geom} { global ds9 global tcl_platform - if {$ds9(wm) == {x11} && $tcl_platform(os) == {Darwin}} { + if {$geom != {} && + $ds9(wm) == {x11} && + $tcl_platform(os) == {Darwin}} { wm geometry $ds9(top) $geom } } -- cgit v0.12