Revision: 5514
          http://skim-app.svn.sourceforge.net/skim-app/?rev=5514&view=rev
Author:   hofman
Date:     2009-07-26 19:35:44 +0000 (Sun, 26 Jul 2009)

Log Message:
-----------
add color accessory view to choose text color of FreeText note

Modified Paths:
--------------
    trunk/Dutch.lproj/Localizable.strings
    trunk/French.lproj/Localizable.strings
    trunk/German.lproj/Localizable.strings
    trunk/Italian.lproj/Localizable.strings
    trunk/SKMainWindowController.h
    trunk/SKMainWindowController.m
    trunk/SKMainWindowController_Actions.m
    trunk/SKMainWindowController_UI.m
    trunk/SKPDFView.m
    trunk/Spanish.lproj/Localizable.strings
    trunk/ru.lproj/Localizable.strings
    trunk/zh_TW.lproj/Localizable.strings

Modified: trunk/Dutch.lproj/Localizable.strings
===================================================================
(Binary files differ)

Modified: trunk/French.lproj/Localizable.strings
===================================================================
(Binary files differ)

Modified: trunk/German.lproj/Localizable.strings
===================================================================
(Binary files differ)

Modified: trunk/Italian.lproj/Localizable.strings
===================================================================
(Binary files differ)

Modified: trunk/SKMainWindowController.h
===================================================================
--- trunk/SKMainWindowController.h      2009-07-25 16:50:41 UTC (rev 5513)
+++ trunk/SKMainWindowController.h      2009-07-26 19:35:44 UTC (rev 5514)
@@ -190,6 +190,7 @@
     SKProgressController            *progressController;
     
     NSButton                        *colorAccessoryView;
+    NSButton                        *textColorAccessoryView;
     
     NSMutableArray                  *pageLabels;
     

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2009-07-25 16:50:41 UTC (rev 5513)
+++ trunk/SKMainWindowController.m      2009-07-26 19:35:44 UTC (rev 5514)
@@ -270,6 +270,7 @@
     [savedNormalSetup release];
     [progressController release];
     [colorAccessoryView release];
+    [textColorAccessoryView release];
     [leftSideDrawer release];
     [rightSideDrawer release];
     [secondaryPdfEdgeView release];

Modified: trunk/SKMainWindowController_Actions.m
===================================================================
--- trunk/SKMainWindowController_Actions.m      2009-07-25 16:50:41 UTC (rev 
5513)
+++ trunk/SKMainWindowController_Actions.m      2009-07-26 19:35:44 UTC (rev 
5514)
@@ -69,11 +69,14 @@
     PDFAnnotation *annotation = [pdfView activeAnnotation];
     if (mwcFlags.updatingColor == 0 && [annotation isSkimNote]) {
         BOOL isFill = [colorAccessoryView state] == NSOnState && [annotation 
respondsToSelector:@selector(setInteriorColor:)];
-        NSColor *color = (isFill ? [(id)annotation interiorColor] : 
[annotation color]) ?: [NSColor clearColor];
+        BOOL isText = [textColorAccessoryView state] == NSOnState && 
[annotation respondsToSelector:@selector(setFontColor:)];
+        NSColor *color = (isFill ? [(id)annotation interiorColor] : (isText ? 
[(id)annotation fontColor] : [annotation color])) ?: [NSColor clearColor];
         if ([color isEqual:[sender color]] == NO) {
             mwcFlags.updatingColor = 1;
             if (isFill)
                 [(id)annotation setInteriorColor:[[sender color] 
alphaComponent] > 0.0 ? [sender color] : nil];
+            else if (isText)
+                [(id)annotation setFontColor:[[sender color] alphaComponent] > 
0.0 ? [sender color] : nil];
             else
                 [annotation setColor:[sender color]];
             mwcFlags.updatingColor = 0;

Modified: trunk/SKMainWindowController_UI.m
===================================================================
--- trunk/SKMainWindowController_UI.m   2009-07-25 16:50:41 UTC (rev 5513)
+++ trunk/SKMainWindowController_UI.m   2009-07-26 19:35:44 UTC (rev 5514)
@@ -100,6 +100,7 @@
 
 @interface SKMainWindowController (UIPrivate)
 - (void)changeColorFill:(id)sender;
+- (void)changeColorText:(id)sender;
 @end
 
 #pragma mark -
@@ -174,15 +175,30 @@
                     [colorAccessoryView sizeToFit];
                 }
                 accessoryView = colorAccessoryView;
+            } else if ([annotation 
respondsToSelector:@selector(setFontColor:)]) {
+                if (textColorAccessoryView == nil) {
+                    textColorAccessoryView = [[NSButton alloc] init];
+                    [textColorAccessoryView setButtonType:NSSwitchButton];
+                    [textColorAccessoryView setTitle:NSLocalizedString(@"Text 
color", @"Button title")];
+                    [[textColorAccessoryView cell] 
setControlSize:NSSmallControlSize];
+                    [textColorAccessoryView setTarget:self];
+                    [textColorAccessoryView 
setAction:@selector(changeColorText:)];
+                    [textColorAccessoryView sizeToFit];
+                }
+                accessoryView = textColorAccessoryView;
             }
             if ([annotation respondsToSelector:@selector(setInteriorColor:)] 
&& [colorAccessoryView state] == NSOnState) {
                 color = [(id)annotation interiorColor] ?: [NSColor clearColor];
+            } else if ([annotation 
respondsToSelector:@selector(setFontColor:)] && [textColorAccessoryView state] 
== NSOnState) {
+                color = [(id)annotation fontColor] ?: [NSColor blackColor];
             } else {
                 color = [annotation color];
             }
         }
-        if ([[NSColorPanel sharedColorPanel] accessoryView] != accessoryView)
+        if ([[NSColorPanel sharedColorPanel] accessoryView] != accessoryView) {
+            [[NSColorPanel sharedColorPanel] setAccessoryView:nil];
             [[NSColorPanel sharedColorPanel] setAccessoryView:accessoryView];
+        }
     }
     
     if (color) {
@@ -196,6 +212,10 @@
    [self updateColorPanel];
 }
 
+- (void)changeColorText:(id)sender{
+   [self updateColorPanel];
+}
+
 - (void)updateLineInspector {
     PDFAnnotation *annotation = [pdfView activeAnnotation];
     NSString *type = [annotation type];

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2009-07-25 16:50:41 UTC (rev 5513)
+++ trunk/SKPDFView.m   2009-07-26 19:35:44 UTC (rev 5514)
@@ -1765,6 +1765,8 @@
             if ([pboardType isEqualToString:NSColorPboardType]) {
                 if ((GetCurrentKeyModifiers() & optionKey) && 
[highlightAnnotation respondsToSelector:@selector(setInteriorColor:)])
                     [(id)highlightAnnotation setInteriorColor:[NSColor 
colorFromPasteboard:pboard]];
+                else if ((GetCurrentKeyModifiers() & optionKey) && 
[highlightAnnotation respondsToSelector:@selector(setFontColor:)])
+                    [(id)highlightAnnotation setFontColor:[NSColor 
colorFromPasteboard:pboard]];
                 else
                     [highlightAnnotation setColor:[NSColor 
colorFromPasteboard:pboard]];
                 performedDrag = YES;

Modified: trunk/Spanish.lproj/Localizable.strings
===================================================================
(Binary files differ)

Modified: trunk/ru.lproj/Localizable.strings
===================================================================
(Binary files differ)

Modified: trunk/zh_TW.lproj/Localizable.strings
===================================================================
(Binary files differ)


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

------------------------------------------------------------------------------
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to