Revision: 14199
          http://sourceforge.net/p/skim-app/code/14199
Author:   hofman
Date:     2024-04-09 21:25:58 +0000 (Tue, 09 Apr 2024)
Log Message:
-----------
Restore tab when exiting presentation. Show scrreen show of window before 
removing the window from the tab.

Modified Paths:
--------------
    trunk/SKMainWindowController.m
    trunk/SKMainWindowController_FullScreen.m

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2024-04-09 09:06:48 UTC (rev 14198)
+++ trunk/SKMainWindowController.m      2024-04-09 21:25:58 UTC (rev 14199)
@@ -151,6 +151,8 @@
 #define HASVERTICALSCROLLER_KEY     @"hasVerticalScroller"
 #define AUTOHIDESSCROLLERS_KEY      @"autoHidesScrollers"
 #define DRAWSBACKGROUND_KEY         @"drawsBackground"
+#define TABGROUP_KEY                @"tabGroup"
+#define TABINDEX_KEY                @"tabIndex"
 #define PAGEINDEX_KEY               @"pageIndex"
 #define SCROLLPOINT_KEY             @"scrollPoint"
 #define LOCKED_KEY                  @"locked"
@@ -592,7 +594,7 @@
         [setup addEntriesFromDictionary:[self currentPDFSettings]];
     } else {
         [setup addEntriesFromDictionary:savedNormalSetup];
-        [setup removeObjectsForKeys:@[HASHORIZONTALSCROLLER_KEY, 
HASVERTICALSCROLLER_KEY, AUTOHIDESSCROLLERS_KEY, DRAWSBACKGROUND_KEY, 
LOCKED_KEY]];
+        [setup removeObjectsForKeys:@[HASHORIZONTALSCROLLER_KEY, 
HASVERTICALSCROLLER_KEY, AUTOHIDESSCROLLERS_KEY, DRAWSBACKGROUND_KEY, 
TABGROUP_KEY, TABINDEX_KEY, LOCKED_KEY]];
     }
     
     return setup;

Modified: trunk/SKMainWindowController_FullScreen.m
===================================================================
--- trunk/SKMainWindowController_FullScreen.m   2024-04-09 09:06:48 UTC (rev 
14198)
+++ trunk/SKMainWindowController_FullScreen.m   2024-04-09 21:25:58 UTC (rev 
14199)
@@ -73,6 +73,8 @@
 #define HASVERTICALSCROLLER_KEY     @"hasVerticalScroller"
 #define AUTOHIDESSCROLLERS_KEY      @"autoHidesScrollers"
 #define DRAWSBACKGROUND_KEY         @"drawsBackground"
+#define TABGROUP_KEY                @"tabGroup"
+#define TABINDEX_KEY                @"tabIndex"
 
 #define WINDOW_KEY @"window"
 
@@ -392,18 +394,24 @@
         return;
     }
     
-    if ([[[self window] tabbedWindows] count] > 1)
-        [[self window] moveTabToNewWindow:nil];
-    
     PDFPage *page = [[self pdfView] currentPage];
     
+    mwcFlags.isSwitchingFullScreen = 1;
+    
+    interactionMode = SKPresentationMode;
+    
+    [self showStaticContentForWindow:mainWindow];
+    
     // remember normal setup to return to, we must do this before changing the 
interactionMode
     [savedNormalSetup setDictionary:[self currentPDFSettings]];
     
-    mwcFlags.isSwitchingFullScreen = 1;
+    if ([[[self window] tabbedWindows] count] > 1) {
+        NSUInteger tabIndex = [[[self window] tabbedWindows] 
indexOfObject:[self window]];
+        [savedNormalSetup setObject:[[self window] tabGroup] 
forKey:TABGROUP_KEY];
+        [savedNormalSetup setObject:[NSNumber 
numberWithUnsignedInteger:tabIndex] forKey:TABINDEX_KEY];
+        [[self window] moveTabToNewWindow:nil];
+    }
     
-    interactionMode = SKPresentationMode;
-    
     NSScreen *screen = [mainWindow screen];
     if ([self presentationNotesDocument] && [self presentationNotesDocument] 
!= [self document]) {
         NSArray *screens = [self alternateScreensForScreen:[[[self 
presentationNotesDocument] mainWindow] screen]];
@@ -411,8 +419,6 @@
             screen = [screens firstObject];
     }
     
-    [self showStaticContentForWindow:mainWindow];
-    
     [self addPresentationWindowOnScreen:screen];
     
     if ([self hasOverview])
@@ -501,6 +507,9 @@
     if ([self hasOverview])
         [overviewContentView removeFromSuperview];
     
+    NSWindowTabGroup *tabGroup = [savedNormalSetup objectForKey:TABGROUP_KEY];
+    NSUInteger tabIndex = [[savedNormalSetup objectForKey:TABINDEX_KEY] 
unsignedIntegerValue];
+    
     [self exitPresentationMode];
     [self applyPDFSettings:savedNormalSetup rewind:YES];
     [savedNormalSetup removeAllObjects];
@@ -525,6 +534,9 @@
     if (covered)
         [mainWindow setAlphaValue:1.0];
     
+    if ([[tabGroup windows] count])
+        [tabGroup insertWindow:mainWindow atIndex:MAX(tabIndex, [[tabGroup 
windows] count])];
+    
     [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context) {
             [context setDuration:PRESENTATION_DURATION];
             [context setTimingFunction:[CAMediaTimingFunction 
functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];

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