Revision: 3651
          http://skim-app.svn.sourceforge.net/skim-app/?rev=3651&view=rev
Author:   hofman
Date:     2008-04-06 07:58:44 -0700 (Sun, 06 Apr 2008)

Log Message:
-----------
Remove possible double separators from windows menu after reorganizing it.

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

Modified: trunk/SKApplication.m
===================================================================
--- trunk/SKApplication.m       2008-04-06 12:16:37 UTC (rev 3650)
+++ trunk/SKApplication.m       2008-04-06 14:58:44 UTC (rev 3651)
@@ -130,6 +130,22 @@
     return;
 }
 
+- (void)removeDoubleSpearatorsFromWindowMenu {
+    int anIndex = [[self windowsMenu] numberOfItems];
+    BOOL wasSeparator = YES;
+    
+    while (anIndex--) {
+        if ([[[self windowsMenu] itemAtIndex:anIndex] isSeparatorItem]) {
+            if (wasSeparator)
+                [[self windowsMenu] removeItemAtIndex:anIndex];
+            else
+                wasSeparator = YES;
+        } else {
+            wasSeparator = NO;
+        }
+    }
+}
+
 - (void)reorganizeWindowsItem:(NSWindow *)aWindow {
     NSMenu *windowsMenu = [self windowsMenu];
     NSWindowController *windowController = [aWindow windowController];
@@ -231,6 +247,9 @@
             }
         }
     }
+    
+    // shouldn't be necessary, but just be sure. There have been reports of 
extra separators being inserted after a "swipe" event
+    [self removeDoubleSpearatorsFromWindowMenu];
 }
 
 - (void)addWindowsItem:(NSWindow *)aWindow title:(NSString *)aString 
filename:(BOOL)isFilename {
@@ -251,19 +270,7 @@
 - (void)removeWindowsItem:(NSWindow *)aWindow {
     [super removeWindowsItem:aWindow];
     
-    int anIndex = [[self windowsMenu] numberOfItems];
-    BOOL wasSeparator = YES;
-    
-    while (anIndex--) {
-        if ([[[self windowsMenu] itemAtIndex:anIndex] isSeparatorItem]) {
-            if (wasSeparator)
-                [[self windowsMenu] removeItemAtIndex:anIndex];
-            else
-                wasSeparator = YES;
-        } else {
-            wasSeparator = NO;
-        }
-    }
+    [self removeDoubleSpearatorsFromWindowMenu];
 }
 
 #pragma mark Scripting support


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 the 2008 JavaOne(SM) Conference 
Register now and save $200. Hurry, offer ends at 11:59 p.m., 
Monday, April 7! Use priority code J8TLD2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to