Revision: 5623
          http://skim-app.svn.sourceforge.net/skim-app/?rev=5623&view=rev
Author:   hofman
Date:     2009-09-02 12:02:16 +0000 (Wed, 02 Sep 2009)

Log Message:
-----------
Boolean method to check whether an annotation supports lines. Allow setting the 
font color of a text note from the favorite colors.

Modified Paths:
--------------
    trunk/PDFAnnotationMarkup_SKExtensions.m
    trunk/PDFAnnotation_SKExtensions.h
    trunk/PDFAnnotation_SKExtensions.m
    trunk/SKMainWindowController_Actions.m
    trunk/SKNPDFAnnotationNote_SKExtensions.m

Modified: trunk/PDFAnnotationMarkup_SKExtensions.m
===================================================================
--- trunk/PDFAnnotationMarkup_SKExtensions.m    2009-09-02 11:42:44 UTC (rev 
5622)
+++ trunk/PDFAnnotationMarkup_SKExtensions.m    2009-09-02 12:02:16 UTC (rev 
5623)
@@ -374,6 +374,8 @@
 
 - (BOOL)isMarkup { return YES; }
 
+- (BOOL)hasBorder { return NO; }
+
 - (BOOL)isConvertibleAnnotation { return YES; }
 
 #pragma mark Scripting support

Modified: trunk/PDFAnnotation_SKExtensions.h
===================================================================
--- trunk/PDFAnnotation_SKExtensions.h  2009-09-02 11:42:44 UTC (rev 5622)
+++ trunk/PDFAnnotation_SKExtensions.h  2009-09-02 12:02:16 UTC (rev 5623)
@@ -93,6 +93,7 @@
 - (BOOL)isResizable;
 - (BOOL)isMovable;
 - (BOOL)isEditable;
+- (BOOL)hasBorder;
 
 - (BOOL)isConvertibleAnnotation;
 

Modified: trunk/PDFAnnotation_SKExtensions.m
===================================================================
--- trunk/PDFAnnotation_SKExtensions.m  2009-09-02 11:42:44 UTC (rev 5622)
+++ trunk/PDFAnnotation_SKExtensions.m  2009-09-02 12:02:16 UTC (rev 5623)
@@ -211,6 +211,8 @@
 
 - (BOOL)isEditable { return [self isSkimNote]; }
 
+- (BOOL)hasBorder { return [self isSkimNote]; }
+
 - (BOOL)isConvertibleAnnotation { return NO; }
 
 - (BOOL)hitTest:(NSPoint)point {

Modified: trunk/SKMainWindowController_Actions.m
===================================================================
--- trunk/SKMainWindowController_Actions.m      2009-09-02 11:42:44 UTC (rev 
5622)
+++ trunk/SKMainWindowController_Actions.m      2009-09-02 12:02:16 UTC (rev 
5623)
@@ -89,11 +89,14 @@
     PDFAnnotation *annotation = [pdfView activeAnnotation];
     if ([annotation isSkimNote]) {
         BOOL isFill = (GetCurrentKeyModifiers() & optionKey) != 0 && 
[annotation respondsToSelector:@selector(setInteriorColor:)];
-        NSColor *color = (isFill ? [(id)annotation interiorColor] : 
[annotation color]) ?: [NSColor clearColor];
+        BOOL isText = (GetCurrentKeyModifiers() & optionKey) != 0 && 
[annotation respondsToSelector:@selector(setFontColor:)];
+        NSColor *color = (isFill ? [(id)annotation interiorColor] : (isText ? 
[(id)annotation fontColor] : [annotation color])) ?: [NSColor clearColor];
         NSColor *newColor = [sender 
respondsToSelector:@selector(representedObject)] ? [sender representedObject] : 
[sender respondsToSelector:@selector(color)] ? [sender color] : nil;
         if (newColor && [color isEqual:newColor] == NO) {
             if (isFill)
-                [(id)annotation setInteriorColor:newColor];
+                [(id)annotation setInteriorColor:[newColor alphaComponent] > 
0.0 ? newColor : nil];
+            else if (isText)
+                [(id)annotation setFontColor:[newColor alphaComponent] > 0.0 ? 
newColor : nil];
             else
                 [annotation setColor:newColor];
         }
@@ -126,7 +129,7 @@
 - (void)changeLineAttribute:(id)sender {
     SKLineChangeAction action = [sender currentLineChangeAction];
     PDFAnnotation *annotation = [pdfView activeAnnotation];
-    if (mwcFlags.updatingLine == 0 && [annotation isSkimNote] && [[annotation 
keysForValuesToObserveForUndo] containsObject:SKNPDFAnnotationBorderKey]) {
+    if (mwcFlags.updatingLine == 0 && [annotation hasBorder]) {
         mwcFlags.updatingLine = 1;
         switch (action) {
             case SKLineWidthLineChangeAction:

Modified: trunk/SKNPDFAnnotationNote_SKExtensions.m
===================================================================
--- trunk/SKNPDFAnnotationNote_SKExtensions.m   2009-09-02 11:42:44 UTC (rev 
5622)
+++ trunk/SKNPDFAnnotationNote_SKExtensions.m   2009-09-02 12:02:16 UTC (rev 
5623)
@@ -93,6 +93,8 @@
 
 - (BOOL)isEditable { return [self isSkimNote]; }
 
+- (BOOL)hasBorder { return NO; }
+
 // override these Leopard methods to avoid showing the standard tool tips over 
our own
 - (NSString *)toolTip { return @""; }
 - (NSString *)toolTipNoLabel { return @""; }


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

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to