Revision: 4406
          http://skim-app.svn.sourceforge.net/skim-app/?rev=4406&view=rev
Author:   hofman
Date:     2008-08-14 17:03:30 +0000 (Thu, 14 Aug 2008)

Log Message:
-----------
Edit notes using a pdfview delegate method rather than a notification.

Modified Paths:
--------------
    trunk/SKMainWindowController.m
    trunk/SKMainWindowController_UI.m
    trunk/SKPDFView.h
    trunk/SKPDFView.m

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2008-08-14 16:35:53 UTC (rev 4405)
+++ trunk/SKMainWindowController.m      2008-08-14 17:03:30 UTC (rev 4406)
@@ -396,6 +396,8 @@
     [pdfView setGreekingThreshold:[sud floatForKey:SKGreekingThresholdKey]];
     [pdfView setBackgroundColor:[sud colorForKey:SKBackgroundColorKey]];
     
+    [pdfView setDelegate:self];
+    
     NSNumber *leftWidth = [savedNormalSetup 
objectForKey:SKMainWindowLeftSidePaneWidthKey] ?: [sud 
objectForKey:SKLeftSidePaneWidthKey];
     NSNumber *rightWidth = [savedNormalSetup 
objectForKey:SKMainWindowRightSidePaneWidthKey] ?: [sud 
objectForKey:SKRightSidePaneWidthKey];
     

Modified: trunk/SKMainWindowController_UI.m
===================================================================
--- trunk/SKMainWindowController_UI.m   2008-08-14 16:35:53 UTC (rev 4405)
+++ trunk/SKMainWindowController_UI.m   2008-08-14 17:03:30 UTC (rev 4406)
@@ -926,6 +926,12 @@
     }
 }
 
+#pragma mark SKPDFView delegate protocol
+
+- (void)PDFView:(PDFView *)sender editAnnotation:(PDFAnnotation *)annotation {
+    [self showNote:annotation];
+}
+
 #pragma mark SKSplitView delegate protocol
 
 - (void)splitView:(SKSplitView *)sender doubleClickedDividerAt:(int)offset{
@@ -1452,12 +1458,6 @@
     [noteOutlineView reloadData];
 }
 
-- (void)handleDoubleClickedAnnotationNotification:(NSNotification 
*)notification {
-    PDFAnnotation *annotation = [[notification userInfo] 
objectForKey:SKPDFViewAnnotationKey];
-    
-    [self showNote:annotation];
-}
-
 - (void)handleReadingBarDidChangeNotification:(NSNotification *)notification {
     NSDictionary *userInfo = [notification userInfo];
     PDFPage *oldPage = [userInfo objectForKey:SKPDFViewOldPageKey];
@@ -1509,8 +1509,6 @@
                              name:SKPDFViewDidRemoveAnnotationNotification 
object:pdfView];
     [nc addObserver:self 
selector:@selector(handleDidMoveAnnotationNotification:) 
                              name:SKPDFViewDidMoveAnnotationNotification 
object:pdfView];
-    [nc addObserver:self 
selector:@selector(handleDoubleClickedAnnotationNotification:) 
-                             name:SKPDFViewAnnotationDoubleClickedNotification 
object:pdfView];
     [nc addObserver:self 
selector:@selector(handleReadingBarDidChangeNotification:) 
                              name:SKPDFViewReadingBarDidChangeNotification 
object:pdfView];
     [nc addObserver:self selector:@selector(observeUndoManagerCheckpoint:) 

Modified: trunk/SKPDFView.h
===================================================================
--- trunk/SKPDFView.h   2008-08-14 16:35:53 UTC (rev 4405)
+++ trunk/SKPDFView.h   2008-08-14 17:03:30 UTC (rev 4406)
@@ -47,7 +47,6 @@
 extern NSString *SKPDFViewDidAddAnnotationNotification;
 extern NSString *SKPDFViewDidRemoveAnnotationNotification;
 extern NSString *SKPDFViewDidMoveAnnotationNotification;
-extern NSString *SKPDFViewAnnotationDoubleClickedNotification;
 extern NSString *SKPDFViewReadingBarDidChangeNotification;
 extern NSString *SKPDFViewSelectionChangedNotification;
 extern NSString *SKPDFViewMagnificationChangedNotification;
@@ -216,3 +215,9 @@
 - (NSUndoManager *)undoManager;
 
 @end
+
+#pragma mark -
+
[EMAIL PROTECTED] NSObject (SKPDFViewDelegate)
+- (void)PDFView:(PDFView *)sender editAnnotation:(PDFAnnotation *)annotation;
[EMAIL PROTECTED]

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2008-08-14 16:35:53 UTC (rev 4405)
+++ trunk/SKPDFView.m   2008-08-14 17:03:30 UTC (rev 4406)
@@ -78,7 +78,6 @@
 NSString *SKPDFViewDidAddAnnotationNotification = 
@"SKPDFViewDidAddAnnotationNotification";
 NSString *SKPDFViewDidRemoveAnnotationNotification = 
@"SKPDFViewDidRemoveAnnotationNotification";
 NSString *SKPDFViewDidMoveAnnotationNotification = 
@"SKPDFViewDidMoveAnnotationNotification";
-NSString *SKPDFViewAnnotationDoubleClickedNotification = 
@"SKPDFViewAnnotationDoubleClickedNotification";
 NSString *SKPDFViewReadingBarDidChangeNotification = 
@"SKPDFViewReadingBarDidChangeNotification";
 NSString *SKPDFViewSelectionChangedNotification = 
@"SKPDFViewSelectionChangedNotification";
 NSString *SKPDFViewMagnificationChangedNotification = 
@"SKPDFViewMagnificationChangedNotification";
@@ -1917,9 +1916,8 @@
 
         [self setActiveAnnotation:newAnnotation];
         [newAnnotation release];
-        if (annotationType == SKAnchoredNote)
-            [[NSNotificationCenter defaultCenter] 
postNotificationName:SKPDFViewAnnotationDoubleClickedNotification object:self 
-                userInfo:[NSDictionary 
dictionaryWithObjectsAndKeys:activeAnnotation, SKPDFViewAnnotationKey, nil]];
+        if (annotationType == SKAnchoredNote && [[self delegate] 
respondsToSelector:@selector(PDFView:editAnnotation:)])
+            [[self delegate] PDFView:self editAnnotation:activeAnnotation];
     } else NSBeep();
 }
 
@@ -2050,8 +2048,8 @@
         
         [[SKPDFHoverWindow sharedHoverWindow] orderOut:self];
         
-               [[NSNotificationCenter defaultCenter] 
postNotificationName:SKPDFViewAnnotationDoubleClickedNotification object:self 
-            userInfo:[NSDictionary 
dictionaryWithObjectsAndKeys:activeAnnotation, SKPDFViewAnnotationKey, nil]];
+        if ([[self delegate] 
respondsToSelector:@selector(PDFView:editAnnotation:)])
+            [[self delegate] PDFView:self editAnnotation:activeAnnotation];
         
     }
     


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