Revision: 6570
          http://skim-app.svn.sourceforge.net/skim-app/?rev=6570&view=rev
Author:   hofman
Date:     2010-06-01 17:40:32 +0000 (Tue, 01 Jun 2010)

Log Message:
-----------
add scriptable properties for default note font attributes

Modified Paths:
--------------
    trunk/SKApplicationController.h
    trunk/SKApplicationController.m
    trunk/Skim.sdef

Modified: trunk/SKApplicationController.h
===================================================================
--- trunk/SKApplicationController.h     2010-05-31 23:46:24 UTC (rev 6569)
+++ trunk/SKApplicationController.h     2010-06-01 17:40:32 UTC (rev 6570)
@@ -59,8 +59,8 @@
 - (IBAction)openBookmarkAction:(id)sender;
 
 @property (nonatomic, copy) NSDictionary *defaultPdfViewSettings, 
*defaultFullScreenPdfViewSettings;
-...@property (nonatomic, copy) NSColor *backgroundColor, 
*fullScreenBackgroundColor, *pageBackgroundColor;
-...@property (nonatomic, copy) NSDictionary *defaultNoteColors, 
*defaultLineWidths, *defaultLineStyles, *defaultDashPatterns;
+...@property (nonatomic, copy) NSColor *backgroundColor, 
*fullScreenBackgroundColor, *pageBackgroundColor, *defaultTextNoteFontColor;
+...@property (nonatomic, copy) NSDictionary *defaultNoteColors, 
*defaultLineWidths, *defaultLineStyles, *defaultDashPatterns, 
*defaultFontNames, *defaultFontSizes;
 @property (nonatomic) FourCharCode defaultStartLineStyle, defaultEndLineStyle, 
defaultIconType;
 
 @end

Modified: trunk/SKApplicationController.m
===================================================================
--- trunk/SKApplicationController.m     2010-05-31 23:46:24 UTC (rev 6569)
+++ trunk/SKApplicationController.m     2010-06-01 17:40:32 UTC (rev 6570)
@@ -107,7 +107,7 @@
 
 @implementation SKApplicationController
 
-...@dynamic defaultPdfViewSettings, defaultFullScreenPdfViewSettings, 
backgroundColor, fullScreenBackgroundColor, pageBackgroundColor, 
defaultNoteColors, defaultLineWidths, defaultLineStyles, defaultDashPatterns, 
defaultStartLineStyle, defaultEndLineStyle, defaultIconType;
+...@dynamic defaultPdfViewSettings, defaultFullScreenPdfViewSettings, 
backgroundColor, fullScreenBackgroundColor, pageBackgroundColor, 
defaultNoteColors, defaultLineWidths, defaultLineStyles, defaultDashPatterns, 
defaultStartLineStyle, defaultEndLineStyle, defaultFontNames, defaultFontSizes, 
defaultTextNoteFontColor, defaultIconType;
 
 + (void)initialize{
     SKINITIALIZE;
@@ -444,7 +444,7 @@
     static NSSet *applicationScriptingKeys = nil;
     if (applicationScriptingKeys == nil)
         applicationScriptingKeys = [[NSSet alloc] 
initWithObjects:@"defaultPdfViewSettings", @"defaultFullScreenPdfViewSettings", 
@"backgroundColor", @"fullScreenBackgroundColor", @"pageBackgroundColor", 
-            @"defaultNoteColors", @"defaultLineWidths", @"defaultLineStyles", 
@"defaultDashPatterns", @"defaultStartLineStyle", @"defaultEndLineStyle", 
@"defaultIconType", nil];
+            @"defaultNoteColors", @"defaultLineWidths", @"defaultLineStyles", 
@"defaultDashPatterns", @"defaultStartLineStyle", @"defaultEndLineStyle", 
@"defaultFontNames", @"defaultFontNames", @"defaultIconType", nil];
        return [applicationScriptingKeys containsObject:key];
 }
 
@@ -629,6 +629,48 @@
         [sud setObject:array forKey:SKInkNoteDashPatternKey];
 }
 
+- (NSDictionary *)defaultFontNames {
+    NSUserDefaults *sud = [NSUserDefaults standardUserDefaults];
+    return [NSDictionary dictionaryWithObjectsAndKeys: 
+        [sud colorForKey:SKFreeTextNoteFontNameKey], SKNFreeTextString, 
+        [sud colorForKey:SKAnchoredNoteFontNameKey], SKNNoteString, 
+        nil];
+}
+
+- (void)setDefaultFontNames:(NSDictionary *)fontNameDict {
+    NSUserDefaults *sud = [NSUserDefaults standardUserDefaults];
+    NSString *fontName;
+    if (fontName = [fontNameDict objectForKey:SKNFreeTextString])
+        [sud setObject:fontName forKey:SKFreeTextNoteFontNameKey];
+    if (fontName = [fontNameDict objectForKey:SKNNoteString])
+        [sud setObject:fontName forKey:SKAnchoredNoteFontNameKey];
+}
+
+- (NSDictionary *)defaultFontSizes {
+    NSUserDefaults *sud = [NSUserDefaults standardUserDefaults];
+    return [NSDictionary dictionaryWithObjectsAndKeys: 
+        [sud objectForKey:SKFreeTextNoteFontNameKey], SKNFreeTextString, 
+        [sud objectForKey:SKAnchoredNoteFontNameKey], SKNNoteString, 
+        nil];
+}
+
+- (void)setDefaultFontSizes:(NSDictionary *)fontSizeDict {
+    NSUserDefaults *sud = [NSUserDefaults standardUserDefaults];
+    NSNumber *fontSize;
+    if (fontSize = [fontSizeDict objectForKey:SKNFreeTextString])
+        [sud setObject:fontSize forKey:SKFreeTextNoteFontNameKey];
+    if (fontSize = [fontSizeDict objectForKey:SKNNoteString])
+        [sud setObject:fontSize forKey:SKAnchoredNoteFontNameKey];
+}
+
+- (NSColor *)defaultTextNoteFontColor {
+    return [[NSUserDefaults standardUserDefaults] 
colorForKey:SKFreeTextNoteFontColorKey];
+}
+
+- (void)setDefaultTextNoteFontColor:(NSColor *)color {
+    [[NSUserDefaults standardUserDefaults] setColor:color 
forKey:SKFreeTextNoteFontColorKey];
+}
+
 - (FourCharCode)defaultStartLineStyle {
     return SKScriptingLineStyleFromLineStyle([[NSUserDefaults 
standardUserDefaults] integerForKey:SKLineNoteStartLineStyleKey]);
 }

Modified: trunk/Skim.sdef
===================================================================
--- trunk/Skim.sdef     2010-05-31 23:46:24 UTC (rev 6569)
+++ trunk/Skim.sdef     2010-06-01 17:40:32 UTC (rev 6570)
@@ -814,6 +814,18 @@
                 description="The default end line style used for new lines.">
                 <cocoa key="defaultEndLineStyle"/>
             </property>
+            <property name="default note font names" type="note font names" 
code="DNFN"
+                description="The default font names used for new notes.">
+                <cocoa key="defaultFontNames"/>
+            </property>
+            <property name="default note font sizes" type="note font sizes" 
code="DNFS"
+                description="The default font sizes used for new notes.">
+                <cocoa key="defaultFontSizes"/>
+            </property>
+            <property name="default text note font color" type="RGBA color" 
code="DNFC"
+                description="The default font color used for new text notes.">
+                <cocoa key="defaultTextNoteFontColor"/>
+            </property>
             <property name="default note icon type" type="icon type" 
code="DNtI"
                 description="The default icon type used for new anchored 
notes.">
                 <cocoa key="defaultIconType"/>
@@ -1351,6 +1363,28 @@
             </property>
         </record-type>
 
+        <record-type name="note font names" code="NDFN">
+            <property name="text note font name" code="FNTx" type="text"
+                description="Default text note font name.">
+                <cocoa key="FreeText"/>
+            </property>
+            <property name="anchored note font name" code="FNAn" type="text"
+                description="Default anchored note font name.">
+                <cocoa key="Note"/>
+            </property>
+        </record-type>
+
+        <record-type name="note font sizes" code="NDFS">
+            <property name="text note font size" code="FSTx" type="integer"
+                description="Default text note font size.">
+                <cocoa key="FreeText"/>
+            </property>
+            <property name="anchored note font size" code="FSAn" type="integer"
+                description="Default anchored note font size.">
+                <cocoa key="Note"/>
+            </property>
+        </record-type>
+
         <value-type name="PDF" code="PDF ">
             <cocoa class="NSData"/>
         </value-type>


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