Revision: 6621
          http://skim-app.svn.sourceforge.net/skim-app/?rev=6621&view=rev
Author:   hofman
Date:     2010-07-16 11:11:13 +0000 (Fri, 16 Jul 2010)

Log Message:
-----------
Don't show fullscreen window on all spaces.
Add navigation window as child window.
Change UI mode according to the status of the document of the main window when 
the main window changes.

Modified Paths:
--------------
    trunk/SKApplicationController.m
    trunk/SKFullScreenWindow.m
    trunk/SKMainWindowController.m
    trunk/SKNavigationWindow.m
    trunk/SKNoteWindowController.m
    trunk/SKPDFView.m
    trunk/SKSideWindow.m
    trunk/SKSnapshotWindowController.m

Modified: trunk/SKApplicationController.m
===================================================================
--- trunk/SKApplicationController.m     2010-07-15 18:24:50 UTC (rev 6620)
+++ trunk/SKApplicationController.m     2010-07-16 11:11:13 UTC (rev 6621)
@@ -154,6 +154,25 @@
     [[[NSDocumentController sharedDocumentController] documents] 
makeObjectsPerformSelector:@selector(saveRecentDocumentInfo)];
 }
 
+- (void)handleWindowDidBecomeMainNotification:(NSNotification *)aNotification {
+    SystemUIMode currentMode, mode = kUIModeNormal;
+    SystemUIOptions currentOptions, options = 0;
+    GetSystemUIMode(&currentMode, &currentOptions);
+    id doc = [[[aNotification object] windowController] document];
+    SKMainWindowController *mwc = [doc 
respondsToSelector:@selector(mainWindowController)] ? [doc 
mainWindowController] : nil;
+    if ([[[mwc window] screen] isEqual:[[NSScreen screens] objectAtIndex:0]]) {
+        if ([mwc isPresentation]) {
+            mode = kUIModeAllHidden;
+            options = kUIOptionDisableProcessSwitch;
+        } else if ([mwc isFullScreen]) {
+            mode = kUIModeAllHidden;
+            options = kUIOptionAutoShowMenuBar;
+        }
+    }
+    if (mode != currentMode || options != currentOptions)
+        SetSystemUIMode(mode, options);
+}
+
 #pragma mark NSApplication delegate
 
 - (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender{
@@ -209,6 +228,8 @@
                              name:SKDocumentDidShowNotification object:nil];
     [nc addObserver:self selector:@selector(registerCurrentDocuments:) 
                              
name:SKDocumentControllerDidRemoveDocumentNotification object:nil];
+    [nc addObserver:self 
selector:@selector(handleWindowDidBecomeMainNotification:) 
+                             name:NSWindowDidBecomeMainNotification 
object:nil];
     [self registerCurrentDocuments:nil];
 }
 
@@ -230,6 +251,7 @@
     NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
     [nc removeObserver:self name:SKDocumentDidShowNotification object:nil];
     [nc removeObserver:self 
name:SKDocumentControllerDidRemoveDocumentNotification object:nil];
+    [nc removeObserver:self name:NSWindowDidBecomeMainNotification object:nil];
 }
 
 - (void)applicationWillTerminate:(NSNotification *)aNotification {

Modified: trunk/SKFullScreenWindow.m
===================================================================
--- trunk/SKFullScreenWindow.m  2010-07-15 18:24:50 UTC (rev 6620)
+++ trunk/SKFullScreenWindow.m  2010-07-16 11:11:13 UTC (rev 6621)
@@ -57,7 +57,6 @@
     if (self = [self initWithContentRect:[screen frame] 
styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO 
screen:screen]) {
         canBecomeMain = flag;
         [self setBackgroundColor:[NSColor blackColor]];
-        [self 
setCollectionBehavior:NSWindowCollectionBehaviorCanJoinAllSpaces];
         [self setReleasedWhenClosed:canBecomeMain == NO];
         [self setDisplaysWhenScreenProfileChanges:canBecomeMain];
         [self setAcceptsMouseMovedEvents:canBecomeMain];

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2010-07-15 18:24:50 UTC (rev 6620)
+++ trunk/SKMainWindowController.m      2010-07-16 11:11:13 UTC (rev 6621)
@@ -1490,6 +1490,9 @@
     if ([[fullScreenWindow firstResponder] isDescendantOf:pdfView])
         [fullScreenWindow makeFirstResponder:nil];
     
+    // do this first, otherwise the navigation window may be covered by 
fadeWindow and then reveiled again, which looks odd
+    [pdfView setInteractionMode:SKNormalMode screen:[[self window] screen]];
+    
     // first fade out the pdfView so we can move the pdfView to the main 
window before it's revealed
     // animating the view itself does no work as PDFView does not work nicely 
with CoreAnimation, so we use a temporary window
     SKFullScreenWindow *fadeWindow = [[SKFullScreenWindow alloc] 
initWithScreen:[fullScreenWindow screen] canBecomeMain:NO];
@@ -1503,7 +1506,6 @@
     [fadeWindow fadeOutBlocking];
     [fadeWindow release];
     
-    [pdfView setInteractionMode:SKNormalMode screen:[[self window] screen]];
     // this should be done before exitPresentationMode to get a smooth 
transition
     if ([self isFullScreen]) {
         [pdfSplitView setFrame:[centerContentView bounds]];

Modified: trunk/SKNavigationWindow.m
===================================================================
--- trunk/SKNavigationWindow.m  2010-07-15 18:24:50 UTC (rev 6620)
+++ trunk/SKNavigationWindow.m  2010-07-16 11:11:13 UTC (rev 6621)
@@ -76,7 +76,6 @@
         [self setLevel:[[pdfView window] level]];
         [self setHidesOnDeactivate:YES];
         [self setMovableByWindowBackground:YES];
-        [self 
setCollectionBehavior:NSWindowCollectionBehaviorCanJoinAllSpaces];
         
         [self setContentView:[[[SKNavigationContentView alloc] init] 
autorelease]];
         
@@ -186,8 +185,9 @@
 }
 
 - (void)orderOut:(id)sender {
+    [[self parentWindow] removeChildWindow:self];
+    [[SKNavigationToolTipWindow sharedToolTipWindow] orderOut:nil];
     [super orderOut:sender];
-    [[SKNavigationToolTipWindow sharedToolTipWindow] orderOut:self];
 }
 
 - (void)handleScaleChangedNotification:(NSNotification *)notification {

Modified: trunk/SKNoteWindowController.m
===================================================================
--- trunk/SKNoteWindowController.m      2010-07-15 18:24:50 UTC (rev 6620)
+++ trunk/SKNoteWindowController.m      2010-07-16 11:11:13 UTC (rev 6621)
@@ -262,7 +262,6 @@
     forceOnTop = flag;
     [[self window] setLevel:keepOnTop || forceOnTop ? NSFloatingWindowLevel : 
NSNormalWindowLevel];
     [[self window] setHidesOnDeactivate:keepOnTop || forceOnTop];
-    [[self window] setCollectionBehavior:forceOnTop ? 
NSWindowCollectionBehaviorCanJoinAllSpaces : NSWindowCollectionBehaviorDefault];
 }
 
 - (void)statusBarClicked:(id)sender {

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2010-07-15 18:24:50 UTC (rev 6620)
+++ trunk/SKPDFView.m   2010-07-16 11:11:13 UTC (rev 6621)
@@ -1173,10 +1173,12 @@
     }
     
     if ([navWindow isVisible] == NO) {
-        if (navigationMode == SKNavigationEverywhere)
+        if (navigationMode == SKNavigationEverywhere) {
             [navWindow fadeIn];
-        else if (navigationMode == SKNavigationBottom && [theEvent 
locationInWindow].y < 3.0)
+            [[self window] addChildWindow:navWindow ordered:NSWindowAbove];
+        } else if (navigationMode == SKNavigationBottom && [theEvent 
locationInWindow].y < 3.0) {
             [self showNavWindow:YES];
+        }
     }
     if (navigationMode != SKNavigationNone || interactionMode == 
SKPresentationMode)
         [self doAutohide:YES];
@@ -2422,7 +2424,7 @@
     }
     navWindow = [[SKNavigationWindow alloc] initWithPDFView:self 
hasSlider:interactionMode == SKFullScreenMode];
     [navWindow moveToScreen:screen];
-    [navWindow setLevel:[[self window] level] + 1];
+    [navWindow setLevel:[[self window] level]];
     
     [self doAutohide:YES];
 }
@@ -2451,8 +2453,10 @@
 }
 
 - (void)showNavWindowDelayed {
-    if ([navWindow isVisible] == NO && [[self window] 
mouseLocationOutsideOfEventStream].y < 3.0)
+    if ([navWindow isVisible] == NO && [[self window] 
mouseLocationOutsideOfEventStream].y < 3.0) {
         [navWindow fadeIn];
+        [[self window] addChildWindow:navWindow ordered:NSWindowAbove];
+    }
 }
 
 - (void)showNavWindow:(BOOL)flag {

Modified: trunk/SKSideWindow.m
===================================================================
--- trunk/SKSideWindow.m        2010-07-15 18:24:50 UTC (rev 6620)
+++ trunk/SKSideWindow.m        2010-07-16 11:11:13 UTC (rev 6621)
@@ -88,7 +88,6 @@
                [self setHasShadow:YES];
         [self setDisplaysWhenScreenProfileChanges:YES];
         [self setReleasedWhenClosed:NO];
-        [self 
setCollectionBehavior:NSWindowCollectionBehaviorCanJoinAllSpaces];
         
         controller = aController;
         edge = anEdge;

Modified: trunk/SKSnapshotWindowController.m
===================================================================
--- trunk/SKSnapshotWindowController.m  2010-07-15 18:24:50 UTC (rev 6620)
+++ trunk/SKSnapshotWindowController.m  2010-07-16 11:11:13 UTC (rev 6621)
@@ -301,7 +301,6 @@
     BOOL onTop = forceOnTop || [[NSUserDefaults standardUserDefaults] 
boolForKey:SKSnapshotsOnTopKey];
     [[self window] setLevel:onTop ? NSFloatingWindowLevel : 
NSNormalWindowLevel];
     [[self window] setHidesOnDeactivate:onTop];
-    [[self window] setCollectionBehavior:forceOnTop ? 
NSWindowCollectionBehaviorCanJoinAllSpaces : NSWindowCollectionBehaviorDefault];
 }
 
 - (NSDictionary *)currentSetup {


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

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to