Revision: 3675
          http://skim-app.svn.sourceforge.net/skim-app/?rev=3675&view=rev
Author:   hofman
Date:     2008-04-08 07:59:23 -0700 (Tue, 08 Apr 2008)

Log Message:
-----------
Avoid some unnecessary actions.

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

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2008-04-08 14:35:13 UTC (rev 3674)
+++ trunk/SKMainWindowController.m      2008-04-08 14:59:23 UTC (rev 3675)
@@ -1155,31 +1155,34 @@
         [undoGroupInsertedNotes unionSet:added];
     }
     
-    NSEnumerator *wcEnum = [[[self document] windowControllers] 
objectEnumerator];
-    NSWindowController *wc = [wcEnum nextObject];
-    
-    while (wc = [wcEnum nextObject]) {
-        if ([wc isKindOfClass:[SKNoteWindowController class]] && [removed 
containsObject:[(SKNoteWindowController *)wc note]])
-            [[wc window] orderOut:self];
+    if ([removed count]) {
+        NSEnumerator *wcEnum = [[[self document] windowControllers] 
objectEnumerator];
+        NSWindowController *wc = [wcEnum nextObject];
+        
+        while (wc = [wcEnum nextObject]) {
+            if ([wc isKindOfClass:[SKNoteWindowController class]] && [removed 
containsObject:[(SKNoteWindowController *)wc note]])
+                [[wc window] orderOut:self];
+        }
+        
+        NSEnumerator *noteEnum = [removed objectEnumerator];
+        PDFAnnotation *note;
+        
+        while (note = [noteEnum nextObject]) {
+            if ([[note texts] count])
+                CFDictionaryRemoveValue(rowHeights, (const void *)[[note 
texts] lastObject]);
+            CFDictionaryRemoveValue(rowHeights, (const void *)note);
+        }
+        
+        // Stop observing the removed notes so that
+        [self stopObservingNotes:[removed allObjects]];
     }
-    
-    NSEnumerator *noteEnum = [removed objectEnumerator];
-    PDFAnnotation *note;
-    
-    while (note = [noteEnum nextObject]) {
-        if ([[note texts] count])
-            CFDictionaryRemoveValue(rowHeights, (const void *)[[note texts] 
lastObject]);
-        CFDictionaryRemoveValue(rowHeights, (const void *)note);
-    }
-    
-    // Stop observing the removed notes so that
-    [self stopObservingNotes:[removed allObjects]];
     [removed release];
     
     [notes setArray:notes];
     
     // Start observing the added notes so that, when they're changed, we can 
record undo operations.
-    [self startObservingNotes:[added allObjects]];
+    if ([added count])
+        [self startObservingNotes:[added allObjects]];
     [added release];
     
     [noteOutlineView reloadData];
@@ -1274,7 +1277,8 @@
     [removed minusSet:new];
     [new release];
     
-    [dirtySnapshots removeObjectsInArray:[removed allObjects]];
+    if ([removed count])
+        [dirtySnapshots removeObjectsInArray:[removed allObjects]];
     [removed release];
     
     [snapshots setArray:snapshots];


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
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to