Revision: 4602
          http://skim-app.svn.sourceforge.net/skim-app/?rev=4602&view=rev
Author:   hofman
Date:     2008-09-10 17:22:32 +0000 (Wed, 10 Sep 2008)

Log Message:
-----------
simplify datasource code for toc outline

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

Modified: trunk/SKMainWindowController_UI.m
===================================================================
--- trunk/SKMainWindowController_UI.m   2008-09-10 11:39:39 UTC (rev 4601)
+++ trunk/SKMainWindowController_UI.m   2008-09-10 17:22:32 UTC (rev 4602)
@@ -535,23 +535,13 @@
 
 - (id)outlineView:(NSOutlineView *)ov child:(int)anIndex ofItem:(id)item{
     if ([ov isEqual:outlineView]) {
-        if (item == nil){
-            if ((pdfOutline) && ([[pdfView document] isLocked] == NO)){
-                // Apple's sample code retains this object before returning 
it, which prevents a crash, but also causes a leak.  We could rewrite 
PDFOutline, but it's easier just to collect these objects and release them in 
-dealloc.
-                id obj = [pdfOutline childAtIndex:anIndex];
-                if (obj)
-                    [pdfOutlineItems addObject:obj];
-                return obj;
-                
-            }else{
-                return nil;
-            }
-        }else{
-            id obj = [(PDFOutline *)item childAtIndex:anIndex];
-            if (obj)
-                [pdfOutlineItems addObject:obj];
-            return obj;
-        }
+        if (item == nil && [[pdfView document] isLocked] == NO)
+            item = pdfOutline;
+        PDFOutline *obj = [(PDFOutline *)item childAtIndex:anIndex];
+        // Apple's sample code retains this object before returning it, which 
prevents a crash, but also causes a leak.  We could rewrite PDFOutline, but 
it's easier just to collect these objects and release them in -dealloc.
+        if (obj)
+            [pdfOutlineItems addObject:obj];
+        return obj;
     } else if ([ov isEqual:noteOutlineView]) {
         if (item == nil) {
             return [[noteArrayController arrangedObjects] 
objectAtIndex:anIndex];


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

Reply via email to