Revision: 22283
          http://sourceforge.net/p/bibdesk/svn/22283
Author:   hofman
Date:     2018-06-01 21:52:19 +0000 (Fri, 01 Jun 2018)
Log Message:
-----------
add scripting properties for URL field values

Modified Paths:
--------------
    trunk/bibdesk/BDSKField.h
    trunk/bibdesk/BDSKField.m
    trunk/bibdesk/Scripting/BibDesk.sdef

Modified: trunk/bibdesk/BDSKField.h
===================================================================
--- trunk/bibdesk/BDSKField.h   2018-06-01 21:35:51 UTC (rev 22282)
+++ trunk/bibdesk/BDSKField.h   2018-06-01 21:52:19 UTC (rev 22283)
@@ -58,6 +58,12 @@
 
 - (NSInteger)integerValue;
 
+- (NSString *)URLStringValue;
+
+- (NSURL *)fileURLValue;
+
+- (NSString *)relativePathValue;
+
 - (BOOL)isInherited;
 
 @end

Modified: trunk/bibdesk/BDSKField.m
===================================================================
--- trunk/bibdesk/BDSKField.m   2018-06-01 21:35:51 UTC (rev 22282)
+++ trunk/bibdesk/BDSKField.m   2018-06-01 21:52:19 UTC (rev 22283)
@@ -127,6 +127,20 @@
     return [bibItem integerValueOfField:name];
 }
 
+- (NSString *)URLStringValue {
+    return [name isURLField] ? [[bibItem remoteURLForField:name] 
absoluteString] : nil;
+}
+
+- (NSURL *)fileURLValue {
+    return [name isLocalFileField] ? [bibItem localFileURLForField:name] : nil;
+}
+
+- (NSString *)relativePathValue {
+    NSString *basePath = [bibItem basePath];
+    NSString *path = [[self fileURLValue] path];
+    return path && basePath ? [path relativePathFromPath:basePath] : nil;
+}
+
 - (BOOL)isInherited {
        return [[bibItem valueOfField:name] isInherited];
 }

Modified: trunk/bibdesk/Scripting/BibDesk.sdef
===================================================================
--- trunk/bibdesk/Scripting/BibDesk.sdef        2018-06-01 21:35:51 UTC (rev 
22282)
+++ trunk/bibdesk/Scripting/BibDesk.sdef        2018-06-01 21:52:19 UTC (rev 
22283)
@@ -1161,6 +1161,18 @@
                 description="The integer value of the field">
                 <cocoa key="integerValue"/>
             </property>
+            <property name="URL value" code="URLv" type="text" access="r"
+                description="The URL value of the remote URL field">
+                <cocoa key="relativePathValue"/>
+            </property>
+            <property name="file value" code="Filv" type="file" access="r"
+                description="The file value of the local file field">
+                <cocoa key="fileURLValue"/>
+            </property>
+            <property name="relative path value" code="rPtv" type="text" 
access="r"
+                description="The relative path value of the local file field">
+                <cocoa key="relativePathValue"/>
+            </property>
             <property name="inherited" code="Inhe" type="boolean"
                 description="Whether the value of the field is inherited 
(crossreffed)">
                 <cocoa key="isInherited"/>

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


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to