Revision: 3497
          http://skim-app.svn.sourceforge.net/skim-app/?rev=3497&view=rev
Author:   hofman
Date:     2008-03-18 06:10:49 -0700 (Tue, 18 Mar 2008)

Log Message:
-----------
Fix adding separator to windows menu before non-document window.

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

Modified: trunk/SKApplication.m
===================================================================
--- trunk/SKApplication.m       2008-03-18 10:22:11 UTC (rev 3496)
+++ trunk/SKApplication.m       2008-03-18 13:10:49 UTC (rev 3497)
@@ -143,19 +143,20 @@
         
         if ([windowController document] == nil) {
             int anIndex = numberOfItems;
-            while (anIndex-- && [[windowsMenu itemAtIndex:anIndex] 
isSeparatorItem] == NO && 
+            while (anIndex-- && anIndex >= 0 && [[windowsMenu 
itemAtIndex:anIndex] isSeparatorItem] == NO && 
                    [[[[windowsMenu itemAtIndex:anIndex] target] 
windowController] document] == nil) {
                     if ([[[windowsMenu itemAtIndex:anIndex] title] 
caseInsensitiveCompare:title] == NSOrderedAscending)
                         break;
             }
-            if (itemIndex != anIndex + 1) {
+            ++anIndex;
+            if (itemIndex != anIndex) {
                 [item retain];
                 [windowsMenu removeItem:item];
-                [windowsMenu insertItem:item atIndex:itemIndex <= anIndex ? 
anIndex : ++anIndex];
+                [windowsMenu insertItem:item atIndex:itemIndex < anIndex ? 
--anIndex : anIndex];
                 [item release];
-                if (anIndex > 0 && [[windowsMenu itemAtIndex:anIndex - 1] 
isSeparatorItem] == NO)
-                    [windowsMenu insertItem:[NSMenuItem separatorItem] 
atIndex:anIndex];
             }
+            if (anIndex > 0 && [[windowsMenu itemAtIndex:anIndex - 1] 
isSeparatorItem] == NO && [[[[windowsMenu itemAtIndex:anIndex - 1] target] 
windowController] document] != nil)
+                [windowsMenu insertItem:[NSMenuItem separatorItem] 
atIndex:anIndex];
         } else if ([windowController isEqual:mainWindowController]) {
             NSMutableArray *subitems = [NSMutableArray array];
             NSMenuItem *anItem;


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: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to