Revision: 4452
          http://skim-app.svn.sourceforge.net/skim-app/?rev=4452&view=rev
Author:   hofman
Date:     2008-08-26 17:07:43 +0000 (Tue, 26 Aug 2008)

Log Message:
-----------
Move some method implementation to UI category. Add a hidden pref to disable 
preview tooltips in tables.

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

Modified: trunk/SKMainWindowController.h
===================================================================
--- trunk/SKMainWindowController.h      2008-08-26 16:33:27 UTC (rev 4451)
+++ trunk/SKMainWindowController.h      2008-08-26 17:07:43 UTC (rev 4452)
@@ -259,7 +259,6 @@
 }
 
 - (IBAction)changeColor:(id)sender;
-- (IBAction)changeColorFill:(id)sender;
 - (IBAction)selectColor:(id)sender;
 - (IBAction)changeFont:(id)sender;
 - (IBAction)createNewNote:(id)sender;

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2008-08-26 16:33:27 UTC (rev 4451)
+++ trunk/SKMainWindowController.m      2008-08-26 17:07:43 UTC (rev 4452)
@@ -175,14 +175,10 @@
 - (void)exitPresentationMode;
 - (void)activityTimerFired:(NSTimer *)timer;
 
-- (void)goToSelectedOutlineItem;
-
 - (void)goToFindResults:(NSArray *)findResults scrollToVisible:(BOOL)scroll;
 - (void)goToFindResults:(NSArray *)findResults;
 - (void)updateFindResultHighlights:(BOOL)scroll;
 
-- (void)showHoverWindowForDestination:(PDFDestination *)dest;
-
 - (void)updateNoteFilterPredicate;
 
 - (void)replaceSideView:(NSView *)oldView withView:(NSView *)newView 
animate:(BOOL)animate;
@@ -585,74 +581,6 @@
 
 #pragma mark UI updating
 
-- (void)updateFontPanel {
-    PDFAnnotation *annotation = [pdfView activeAnnotation];
-    
-    if ([[self window] isMainWindow]) {
-        if ([annotation isSkimNote]) {
-            if ([annotation respondsToSelector:@selector(font)]) {
-                updatingFont = YES;
-                [[NSFontManager sharedFontManager] 
setSelectedFont:[(PDFAnnotationFreeText *)annotation font] isMultiple:NO];
-                updatingFont = NO;
-            }
-            if ([annotation respondsToSelector:@selector(fontColor)]) {
-                updatingFontAttributes = YES;
-                [[NSFontManager sharedFontManager] 
setSelectedAttributes:[NSDictionary 
dictionaryWithObjectsAndKeys:[(PDFAnnotationFreeText *)annotation fontColor], 
NSForegroundColorAttributeName, nil] isMultiple:NO];
-                updatingFontAttributes = NO;
-            }
-        }
-    }
-}
-
-- (void)updateColorPanel {
-    PDFAnnotation *annotation = [pdfView activeAnnotation];
-    NSColor *color = nil;
-    NSView *accessoryView = nil;
-    
-    if ([[self window] isMainWindow]) {
-        if ([annotation isSkimNote]) {
-            if ([annotation respondsToSelector:@selector(setInteriorColor:)]) {
-                if (colorAccessoryView == nil) {
-                    colorAccessoryView = [[NSButton alloc] init];
-                    [colorAccessoryView setButtonType:NSSwitchButton];
-                    [colorAccessoryView setTitle:NSLocalizedString(@"Fill 
color", @"Button title")];
-                    [[colorAccessoryView cell] 
setControlSize:NSSmallControlSize];
-                    [colorAccessoryView setTarget:self];
-                    [colorAccessoryView setAction:@selector(changeColorFill:)];
-                    [colorAccessoryView sizeToFit];
-                }
-                accessoryView = colorAccessoryView;
-            }
-            if ([annotation respondsToSelector:@selector(setInteriorColor:)] 
&& [colorAccessoryView state] == NSOnState) {
-                color = [(id)annotation interiorColor] ?: [NSColor clearColor];
-            } else {
-                color = [annotation color];
-            }
-        }
-        if ([[NSColorPanel sharedColorPanel] accessoryView] != accessoryView)
-            [[NSColorPanel sharedColorPanel] setAccessoryView:accessoryView];
-    }
-    
-    if (color) {
-        updatingColor = YES;
-        [[NSColorPanel sharedColorPanel] setColor:color];
-        updatingColor = NO;
-    }
-}
-
-- (void)updateLineInspector {
-    PDFAnnotation *annotation = [pdfView activeAnnotation];
-    NSString *type = [annotation type];
-    
-    if ([[self window] isMainWindow]) {
-        if ([annotation isSkimNote] && ([type 
isEqualToString:SKNFreeTextString] || [type isEqualToString:SKNCircleString] || 
[type isEqualToString:SKNSquareString] || [type isEqualToString:@""] || [type 
isEqualToString:SKNLineString])) {
-            updatingLine = YES;
-            [[SKLineInspector sharedLineInspector] 
setAnnotationStyle:annotation];
-            updatingLine = NO;
-        }
-    }
-}
-
 - (void)updateLeftStatus {
     NSString *message = [NSString stringWithFormat:NSLocalizedString(@"Page %i 
of %i", @"Status message"), [self pageNumber], [[pdfView document] pageCount]];
     [statusBar setLeftStringValue:message];
@@ -1279,10 +1207,6 @@
     }
 }
 
-- (IBAction)changeColorFill:(id)sender{
-   [self updateColorPanel];
-}
-
 - (IBAction)selectColor:(id)sender{
     PDFAnnotation *annotation = [pdfView activeAnnotation];
     if ([annotation isSkimNote]) {
@@ -1418,17 +1342,6 @@
     } else NSBeep();
 }
 
-- (void)selectSelectedNote{
-    if ([pdfView hideNotes] == NO) {
-        NSArray *selectedNotes = [self selectedNotes];
-        if ([selectedNotes count] == 1) {
-            PDFAnnotation *annotation = [selectedNotes lastObject];
-            [pdfView scrollAnnotationToVisible:annotation];
-            [pdfView setActiveAnnotation:annotation];
-        }
-    } else NSBeep();
-}
-
 - (IBAction)toggleHideNotes:(id)sender{
     BOOL wasHidden = [pdfView hideNotes];
     NSEnumerator *noteEnum = [notes objectEnumerator];
@@ -1440,17 +1353,6 @@
     [pdfView setHideNotes:wasHidden == NO];
 }
 
-- (void)goToSelectedOutlineItem {
-    PDFOutline *outlineItem = [outlineView itemAtRow: [outlineView 
selectedRow]];
-    PDFDestination *dest = [outlineItem destination];
-    updatingOutlineSelection = YES;
-    if (dest)
-        [self goToDestination:dest];
-    else if ([outlineItem respondsToSelector:@selector(action)] && 
[outlineItem action])
-        [pdfView performAction:[outlineItem action]];
-    updatingOutlineSelection = NO;
-}
-
 - (IBAction)takeSnapshot:(id)sender{
     [pdfView takeSnapshot:sender];
 }
@@ -3354,33 +3256,6 @@
     [wc showWindow:self];
 }
 
-- (void)showHoverWindowForDestination:(PDFDestination *)dest {
-    if ([NSApp isActive]) { 
-        PDFAnnotationLink *annotation = [[[PDFAnnotationLink alloc] 
initWithBounds:NSZeroRect] autorelease];
-        NSPoint point = [dest point];
-        switch ([[dest page] rotation]) {
-            case 0:
-                point.x -= 50.0;
-                point.y += 20.0;
-                break;
-            case 90:
-                point.x -= 20.0;
-                point.y -= 50.0;
-                break;
-            case 180:
-                point.x += 50.0;
-                point.y -= 20.0;
-                break;
-            case 270:
-                point.x += 20.0;
-                point.y += 50.0;
-                break;
-        }
-        [annotation setDestination:[[[PDFDestination alloc] initWithPage:[dest 
page] atPoint:point] autorelease]];
-        [[SKPDFHoverWindow sharedHoverWindow] showForAnnotation:annotation 
atPoint:NSZeroPoint];
-    }
-}
-
 #pragma mark Observer registration
 
 - (void)registerAsObserver {

Modified: trunk/SKMainWindowController_UI.m
===================================================================
--- trunk/SKMainWindowController_UI.m   2008-08-26 16:33:27 UTC (rev 4451)
+++ trunk/SKMainWindowController_UI.m   2008-08-26 17:07:43 UTC (rev 4452)
@@ -61,6 +61,7 @@
 #import "NSString_SKExtensions.h"
 #import "SKApplication.h"
 #import "NSMenu_SKExtensions.h"
+#import "SKLineInspector.h"
 
 static NSString *SKMainWindowLabelColumnIdentifer = @"label";
 static NSString *SKMainWindowNoteColumnIdentifer = @"note";
@@ -69,12 +70,10 @@
 
 static NSString *noteToolImageNames[] = {@"ToolbarTextNoteMenu", 
@"ToolbarAnchoredNoteMenu", @"ToolbarCircleNoteMenu", @"ToolbarSquareNoteMenu", 
@"ToolbarHighlightNoteMenu", @"ToolbarUnderlineNoteMenu", 
@"ToolbarStrikeOutNoteMenu", @"ToolbarLineNoteMenu"};
 
+static NSString *SKDisableTableToolTipsKey = @"SKDisableTableToolTips";
+
 @interface SKMainWindowController (SKPrivateMain)
 
-- (void)updateFontPanel;
-- (void)updateColorPanel;
-- (void)updateLineInspector;
-
 - (void)updateLeftStatus;
 - (void)updateRightStatus;
 
@@ -89,21 +88,134 @@
 - (void)hideRightSideWindow;
 
 - (void)goToPage:(PDFPage *)page;
+- (void)goToDestination:(PDFDestination *)destination;
 
-- (void)goToSelectedOutlineItem;
-
-- (void)showHoverWindowForDestination:(PDFDestination *)dest;
-
-- (void)selectSelectedNote;
-
 - (void)observeUndoManagerCheckpoint:(NSNotification *)notification;
 
 @end
 
[EMAIL PROTECTED] SKMainWindowController (UIPrivate)
+- (void)changeColorFill:(id)sender;
[EMAIL PROTECTED]
+
 #pragma mark -
 
 @implementation SKMainWindowController (UI)
 
+#pragma mark Support
+
+- (void)showHoverWindowForDestination:(PDFDestination *)dest {
+    if ([NSApp isActive] && [[NSUserDefaults standardUserDefaults] 
boolForKey:SKDisableTableToolTipsKey] == NO) { 
+        PDFAnnotationLink *annotation = [[[PDFAnnotationLink alloc] 
initWithBounds:NSZeroRect] autorelease];
+        NSPoint point = [dest point];
+        switch ([[dest page] rotation]) {
+            case 0:
+                point.x -= 50.0;
+                point.y += 20.0;
+                break;
+            case 90:
+                point.x -= 20.0;
+                point.y -= 50.0;
+                break;
+            case 180:
+                point.x += 50.0;
+                point.y -= 20.0;
+                break;
+            case 270:
+                point.x += 20.0;
+                point.y += 50.0;
+                break;
+        }
+        [annotation setDestination:[[[PDFDestination alloc] initWithPage:[dest 
page] atPoint:point] autorelease]];
+        [[SKPDFHoverWindow sharedHoverWindow] showForAnnotation:annotation 
atPoint:NSZeroPoint];
+    }
+}
+
+- (void)selectSelectedNote{
+    if ([pdfView hideNotes] == NO) {
+        NSArray *selectedNotes = [self selectedNotes];
+        if ([selectedNotes count] == 1) {
+            PDFAnnotation *annotation = [selectedNotes lastObject];
+            [pdfView scrollAnnotationToVisible:annotation];
+            [pdfView setActiveAnnotation:annotation];
+        }
+    } else NSBeep();
+}
+
+#pragma mark UI updating
+
+- (void)updateFontPanel {
+    PDFAnnotation *annotation = [pdfView activeAnnotation];
+    
+    if ([[self window] isMainWindow]) {
+        if ([annotation isSkimNote]) {
+            if ([annotation respondsToSelector:@selector(font)]) {
+                updatingFont = YES;
+                [[NSFontManager sharedFontManager] 
setSelectedFont:[(PDFAnnotationFreeText *)annotation font] isMultiple:NO];
+                updatingFont = NO;
+            }
+            if ([annotation respondsToSelector:@selector(fontColor)]) {
+                updatingFontAttributes = YES;
+                [[NSFontManager sharedFontManager] 
setSelectedAttributes:[NSDictionary 
dictionaryWithObjectsAndKeys:[(PDFAnnotationFreeText *)annotation fontColor], 
NSForegroundColorAttributeName, nil] isMultiple:NO];
+                updatingFontAttributes = NO;
+            }
+        }
+    }
+}
+
+- (void)updateColorPanel {
+    PDFAnnotation *annotation = [pdfView activeAnnotation];
+    NSColor *color = nil;
+    NSView *accessoryView = nil;
+    
+    if ([[self window] isMainWindow]) {
+        if ([annotation isSkimNote]) {
+            if ([annotation respondsToSelector:@selector(setInteriorColor:)]) {
+                if (colorAccessoryView == nil) {
+                    colorAccessoryView = [[NSButton alloc] init];
+                    [colorAccessoryView setButtonType:NSSwitchButton];
+                    [colorAccessoryView setTitle:NSLocalizedString(@"Fill 
color", @"Button title")];
+                    [[colorAccessoryView cell] 
setControlSize:NSSmallControlSize];
+                    [colorAccessoryView setTarget:self];
+                    [colorAccessoryView setAction:@selector(changeColorFill:)];
+                    [colorAccessoryView sizeToFit];
+                }
+                accessoryView = colorAccessoryView;
+            }
+            if ([annotation respondsToSelector:@selector(setInteriorColor:)] 
&& [colorAccessoryView state] == NSOnState) {
+                color = [(id)annotation interiorColor] ?: [NSColor clearColor];
+            } else {
+                color = [annotation color];
+            }
+        }
+        if ([[NSColorPanel sharedColorPanel] accessoryView] != accessoryView)
+            [[NSColorPanel sharedColorPanel] setAccessoryView:accessoryView];
+    }
+    
+    if (color) {
+        updatingColor = YES;
+        [[NSColorPanel sharedColorPanel] setColor:color];
+        updatingColor = NO;
+    }
+}
+
+- (void)changeColorFill:(id)sender{
+   [self updateColorPanel];
+}
+
+- (void)updateLineInspector {
+    PDFAnnotation *annotation = [pdfView activeAnnotation];
+    NSString *type = [annotation type];
+    
+    if ([[self window] isMainWindow]) {
+        if ([annotation isSkimNote] && ([type 
isEqualToString:SKNFreeTextString] || [type isEqualToString:SKNCircleString] || 
[type isEqualToString:SKNSquareString] || [type isEqualToString:@""] || [type 
isEqualToString:SKNLineString])) {
+            updatingLine = YES;
+            [[SKLineInspector sharedLineInspector] 
setAnnotationStyle:annotation];
+            updatingLine = NO;
+        }
+    }
+}
+
 #pragma mark NSWindow delegate protocol
 
 - (NSString *)windowTitleForDocumentDisplayName:(NSString *)displayName {
@@ -556,7 +668,14 @@
 - (void)outlineViewSelectionDidChange:(NSNotification *)notification{
        // Get the destination associated with the search result list. Tell the 
PDFView to go there.
        if ([[notification object] isEqual:outlineView] && 
(updatingOutlineSelection == NO)){
-        [self goToSelectedOutlineItem];
+        PDFOutline *outlineItem = [outlineView itemAtRow: [outlineView 
selectedRow]];
+        PDFDestination *dest = [outlineItem destination];
+        updatingOutlineSelection = YES;
+        if (dest)
+            [self goToDestination:dest];
+        else if ([outlineItem respondsToSelector:@selector(action)] && 
[outlineItem action])
+            [pdfView performAction:[outlineItem action]];
+        updatingOutlineSelection = NO;
         if ([self isPresentation] && [[NSUserDefaults standardUserDefaults] 
boolForKey:SKAutoHidePresentationContentsKey])
             [self hideLeftSideWindow];
     }


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