Revision: 6651
          http://skim-app.svn.sourceforge.net/skim-app/?rev=6651&view=rev
Author:   hofman
Date:     2010-07-26 09:45:12 +0000 (Mon, 26 Jul 2010)

Log Message:
-----------
move all Carbon system UI settings to SKApplication, let the document only 
report the required interaction mode

Modified Paths:
--------------
    trunk/NSDocument_SKExtensions.h
    trunk/NSDocument_SKExtensions.m
    trunk/SKApplication.m
    trunk/SKMainDocument.m

Modified: trunk/NSDocument_SKExtensions.h
===================================================================
--- trunk/NSDocument_SKExtensions.h     2010-07-25 21:40:15 UTC (rev 6650)
+++ trunk/NSDocument_SKExtensions.h     2010-07-26 09:45:12 UTC (rev 6651)
@@ -38,7 +38,7 @@
 
 #import <Cocoa/Cocoa.h>
 #import <Quartz/Quartz.h>
-#import <Carbon/Carbon.h>
+#import "SKMainWindowController.h"
 
 extern NSString *SKDocumentErrorDomain;
 
@@ -50,7 +50,7 @@
 
 @interface NSDocument (SKExtensions)
 
-- (void)getRequiredSystemUIMode:(SystemUIMode *)mode 
systemUIOptions:(SystemUIOptions *)options;
+- (SKInteractionMode)systemInteractionMode;
 
 #pragma mark Document Setup
 

Modified: trunk/NSDocument_SKExtensions.m
===================================================================
--- trunk/NSDocument_SKExtensions.m     2010-07-25 21:40:15 UTC (rev 6650)
+++ trunk/NSDocument_SKExtensions.m     2010-07-26 09:45:12 UTC (rev 6651)
@@ -57,10 +57,7 @@
 
 @implementation NSDocument (SKExtensions)
 
-- (void)getRequiredSystemUIMode:(SystemUIMode *)mode 
systemUIOptions:(SystemUIOptions *)options {
-    if (mode) *mode = kUIModeNormal;
-    if (options) *options = 0;
-}
+- (SKInteractionMode)systemInteractionMode { return SKNormalMode; }
 
 #pragma mark Document Setup
 

Modified: trunk/SKApplication.m
===================================================================
--- trunk/SKApplication.m       2010-07-25 21:40:15 UTC (rev 6650)
+++ trunk/SKApplication.m       2010-07-26 09:45:12 UTC (rev 6651)
@@ -40,6 +40,7 @@
 #import "NSMenu_SKExtensions.h"
 #import "NSResponder_SKExtensions.h"
 #import "NSDocument_SKExtensions.h"
+#import <Carbon/Carbon.h>
 
 NSString *SKApplicationStartsTerminatingNotification = 
@"SKApplicationStartsTerminatingNotification";
 
@@ -91,7 +92,14 @@
     SystemUIOptions currentOptions, options = 0;
     GetSystemUIMode(&currentMode, &currentOptions);
     NSDocument *doc = [[[self mainWindow] windowController] document];
-    [doc getRequiredSystemUIMode:&mode systemUIOptions:&options];
+    SKInteractionMode interactionMode = [doc systemInteractionMode];
+    if (interactionMode == SKPresentationMode) {
+        mode = kUIModeAllHidden;
+        options = kUIOptionDisableProcessSwitch;
+    } else if (interactionMode == SKFullScreenMode) {
+        mode = kUIModeAllHidden;
+        options = kUIOptionAutoShowMenuBar;
+    }
     if (mode != currentMode || options != currentOptions)
         SetSystemUIMode(mode, options);
 }

Modified: trunk/SKMainDocument.m
===================================================================
--- trunk/SKMainDocument.m      2010-07-25 21:40:15 UTC (rev 6650)
+++ trunk/SKMainDocument.m      2010-07-26 09:45:12 UTC (rev 6651)
@@ -273,22 +273,11 @@
        [self 
performSelector:@selector(undoableActionDoesntDirtyDocumentDeferred:) 
withObject:[NSNumber numberWithBool:[[self undoManager] isUndoing]] 
afterDelay:0.0];
 }
 
-
-- (void)getRequiredSystemUIMode:(SystemUIMode *)mode 
systemUIOptions:(SystemUIOptions *)options {
-    SystemUIMode aMode = kUIModeNormal;
-    SystemUIOptions anOptions = 0;
-    SKMainWindowController *mwc = [self mainWindowController];
-    if ([[[mwc window] screen] isEqual:[NSScreen primaryScreen]]) {
-        if ([mwc interactionMode] == SKPresentationMode) {
-            aMode = kUIModeAllHidden;
-            anOptions = kUIOptionDisableProcessSwitch;
-        } else if ([mwc interactionMode] == SKFullScreenMode) {
-            aMode = kUIModeAllHidden;
-            anOptions = kUIOptionAutoShowMenuBar;
-        }
-    }
-    if (mode) *mode = aMode;
-    if (options) *options = anOptions;
+- (SKInteractionMode)systemInteractionMode {
+    // only return the real interaction mode when the fullscreen window is on 
the primary screen, otherwise no need to block main menu and dock
+    if ([[[[self mainWindowController] window] screen] isEqual:[NSScreen 
primaryScreen]])
+        return [[self mainWindowController] interactionMode];
+    return SKNormalMode;
 }
 
 #pragma mark Writing


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

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to