Revision: 14137
          http://sourceforge.net/p/skim-app/code/14137
Author:   hofman
Date:     2024-03-24 18:07:25 +0000 (Sun, 24 Mar 2024)
Log Message:
-----------
pass argument to determine whether to miniaturize or deminiatarize

Modified Paths:
--------------
    trunk/SKSnapshotWindowController.m

Modified: trunk/SKSnapshotWindowController.m
===================================================================
--- trunk/SKSnapshotWindowController.m  2024-03-24 17:51:16 UTC (rev 14136)
+++ trunk/SKSnapshotWindowController.m  2024-03-24 18:07:25 UTC (rev 14137)
@@ -596,13 +596,12 @@
     return imageView;
 }
 
-- (void)miniaturizeWindowFromRect:(NSRect)startRect toRect:(NSRect)endRect {
-    BOOL hadWindow = [self hasWindow];
+- (void)miniaturizeWindow:(BOOL)miniaturize fromRect:(NSRect)startRect 
toRect:(NSRect)endRect {
     NSWindow *window = [self window];
     NSImage *contentImage = [self thumbnailWithSize:-1.0];
     NSImage *windowImage;
     
-    if (hadWindow) {
+    if (miniaturize) {
         windowImage = [(SKSnapshotWindow *)window windowImage];
     } else {
         windowImage = [[NSImage alloc] initWithSize:[window frame].size];
@@ -616,20 +615,26 @@
     NSImageView *imageView = addImageView([miniaturizeWindow contentView], 
windowImage);
     NSImageView *contentImageView = addImageView([miniaturizeWindow 
contentView], contentImage);
     [contentImageView setContentFilters:SKColorEffectFilters()];
-    if (hadWindow == NO)
+    if (miniaturize == NO)
         [imageView setAlphaValue:0.0];
     
     [miniaturizeWindow orderFront:nil];
     
+    if (miniaturize) {
+        [window setAnimationBehavior:NSWindowAnimationBehaviorNone];
+        [window orderFront:nil];
+        [window setAnimationBehavior:NSWindowAnimationBehaviorDefault];
+    }
+    
     animating = YES;
     
     [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context){
             [context setDuration:RESIZE_TIME_FACTOR * [miniaturizeWindow 
animationResizeTime:endRect]];
             [[miniaturizeWindow animator] setFrame:endRect display:YES];
-            [[imageView animator] setAlphaValue:hadWindow ? 0.0 : 1.0];
+            [[imageView animator] setAlphaValue:miniaturize ? 0.0 : 1.0];
         }
         completionHandler:^{
-            if (hadWindow == NO) {
+            if (miniaturize == NO) {
                 [window setAnimationBehavior:NSWindowAnimationBehaviorNone];
                 [window orderFront:nil];
                 [self updateWindowLevel];
@@ -649,12 +654,10 @@
         NSRect startRect = [[self window] frame];
         NSRect endRect = [self miniaturizedRectForDockingRect:dockRect];
         
-        [self miniaturizeWindowFromRect:startRect toRect:endRect];
-        
-        [[self window] setAnimationBehavior:NSWindowAnimationBehaviorNone];
+        [self miniaturizeWindow:YES fromRect:startRect toRect:endRect];
+    } else {
+        [[self window] orderOut:nil];
     }
-    [[self window] orderOut:nil];
-    [[self window] setAnimationBehavior:NSWindowAnimationBehaviorDefault];
     [self setHasWindow:NO];
 }
 
@@ -666,7 +669,7 @@
         NSRect endRect = [[self window] frame];
         NSRect startRect = [self miniaturizedRectForDockingRect:dockRect];
         
-        [self miniaturizeWindowFromRect:startRect toRect:endRect];
+        [self miniaturizeWindow:NO fromRect:startRect toRect:endRect];
     } else {
         [self showWindow:self];
     }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to