Revision: 4422
http://skim-app.svn.sourceforge.net/skim-app/?rev=4422&view=rev
Author: hofman
Date: 2008-08-18 11:07:56 +0000 (Mon, 18 Aug 2008)
Log Message:
-----------
Reorganize windows menu code to make it a bit more readable
Modified Paths:
--------------
trunk/SKApplication.m
Modified: trunk/SKApplication.m
===================================================================
--- trunk/SKApplication.m 2008-08-18 10:02:12 UTC (rev 4421)
+++ trunk/SKApplication.m 2008-08-18 11:07:56 UTC (rev 4422)
@@ -96,16 +96,20 @@
if ([windowController document] == nil) {
int anIndex = numberOfItems;
- 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;
+ while (anIndex--) {
+ NSMenuItem *anItem = [windowsMenu itemAtIndex:anIndex];
+ if ([anItem isSeparatorItem] ||
+ [[[anItem target] windowController] document] != nil ||
+ [[anItem title] caseInsensitiveCompare:title] ==
NSOrderedAscending)
+ break;
}
++anIndex;
if (itemIndex != anIndex) {
+ if (itemIndex < anIndex)
+ anIndex--;
[item retain];
[windowsMenu removeItem:item];
- [windowsMenu insertItem:item atIndex:itemIndex < anIndex ?
--anIndex : anIndex];
+ [windowsMenu insertItem:item atIndex:anIndex];
[item release];
}
if (anIndex > 0 && [[windowsMenu itemAtIndex:anIndex - 1]
isSeparatorItem] == NO && [[[[windowsMenu itemAtIndex:anIndex - 1] target]
windowController] document] != nil)
@@ -171,14 +175,17 @@
[item setIndentationLevel:1];
if (anIndex >= 0) {
- while (++anIndex < numberOfItems && [[windowsMenu
itemAtIndex:anIndex] isSeparatorItem] == NO) {
- if ([[[windowsMenu itemAtIndex:anIndex] title]
caseInsensitiveCompare:title] == NSOrderedDescending)
+ while (++anIndex < numberOfItems) {
+ NSMenuItem *anItem = [windowsMenu itemAtIndex:anIndex];
+ if ([anItem isSeparatorItem] || [[anItem title]
caseInsensitiveCompare:title] == NSOrderedDescending)
break;
}
if (itemIndex != anIndex - 1) {
+ if (itemIndex < anIndex)
+ anIndex--;
[item retain];
[windowsMenu removeItem:item];
- [windowsMenu insertItem:item atIndex:itemIndex < anIndex ?
--anIndex : anIndex];
+ [windowsMenu insertItem:item atIndex:anIndex];
[item release];
}
}
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 Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit