Revision: 6401
          http://skim-app.svn.sourceforge.net/skim-app/?rev=6401&view=rev
Author:   hofman
Date:     2010-03-31 12:57:10 +0000 (Wed, 31 Mar 2010)

Log Message:
-----------
move common code to separate method

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

Modified: trunk/SKMainToolbarController.m
===================================================================
--- trunk/SKMainToolbarController.m     2010-03-31 12:51:59 UTC (rev 6400)
+++ trunk/SKMainToolbarController.m     2010-03-31 12:57:10 UTC (rev 6401)
@@ -915,37 +915,26 @@
     [pdfView setDisplayMode:displayMode];
 }
 
-- (void)createNewTextNote:(id)sender {
+- (void)createNewNoteWithType:(NSInteger)type forButton:(NSSegmentedControl 
*)button {
     if ([pdfView hideNotes] == NO) {
-        NSInteger type = [sender tag];
         [pdfView addAnnotationWithType:type];
-        if (type != [textNoteButton tagForSegment:0]) {
-            [textNoteButton setTag:type forSegment:0];
-            [textNoteButton setImage:[NSImage 
imageNamed:noteToolImageNames[type]] forSegment:0];
+        if (type != [button tagForSegment:0]) {
+            [button setTag:type forSegment:0];
+            [button setImage:[NSImage imageNamed:noteToolImageNames[type]] 
forSegment:0];
         }
     } else NSBeep();
 }
 
+- (void)createNewTextNote:(id)sender {
+    [self createNewNoteWithType:[sender tag] forButton:textNoteButton];
+}
+
 - (void)createNewCircleNote:(id)sender {
-    if ([pdfView hideNotes] == NO) {
-        NSInteger type = [sender tag];
-        [pdfView addAnnotationWithType:type];
-        if (type != [circleNoteButton tagForSegment:0]) {
-            [circleNoteButton setTag:type forSegment:0];
-            [circleNoteButton setImage:[NSImage 
imageNamed:noteToolImageNames[type]] forSegment:0];
-        }
-    } else NSBeep();
+    [self createNewNoteWithType:[sender tag] forButton:circleNoteButton];
 }
 
 - (void)createNewMarkupNote:(id)sender {
-    if ([pdfView hideNotes] == NO) {
-        NSInteger type = [sender tag];
-        [pdfView addAnnotationWithType:type];
-        if (type != [markupNoteButton tagForSegment:0]) {
-            [markupNoteButton setTag:type forSegment:0];
-            [markupNoteButton setImage:[NSImage 
imageNamed:noteToolImageNames[type]] forSegment:0];
-        }
-    } else NSBeep();
+    [self createNewNoteWithType:[sender tag] forButton:markupNoteButton];
 }
 
 - (IBAction)createNewNote:(id)sender {


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to