Revision: 18192
          http://bibdesk.svn.sourceforge.net/bibdesk/?rev=18192&view=rev
Author:   hofman
Date:     2011-10-27 12:14:50 +0000 (Thu, 27 Oct 2011)
Log Message:
-----------
move scripting extension to attributed strings to separate files

Modified Paths:
--------------
    trunk/bibdesk/BDSKRichTextForCommand.m
    trunk/bibdesk/BDSKTemplatedTextCommand.m
    trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj
    trunk/bibdesk/NSAttributedString_BDSKExtensions.h
    trunk/bibdesk/NSAttributedString_BDSKExtensions.m

Added Paths:
-----------
    trunk/bibdesk/NSAttributedString+Scripting.h
    trunk/bibdesk/NSAttributedString+Scripting.m

Modified: trunk/bibdesk/BDSKRichTextForCommand.m
===================================================================
--- trunk/bibdesk/BDSKRichTextForCommand.m      2011-10-27 11:33:52 UTC (rev 
18191)
+++ trunk/bibdesk/BDSKRichTextForCommand.m      2011-10-27 12:14:50 UTC (rev 
18192)
@@ -37,7 +37,7 @@
  */
 
 #import "BDSKRichTextForCommand.h"
-#import "NSAttributedString_BDSKExtensions.h"
+#import "NSAttributedString+SCripting.h"
 
 
 @implementation BDSKRichTextForCommand

Modified: trunk/bibdesk/BDSKTemplatedTextCommand.m
===================================================================
--- trunk/bibdesk/BDSKTemplatedTextCommand.m    2011-10-27 11:33:52 UTC (rev 
18191)
+++ trunk/bibdesk/BDSKTemplatedTextCommand.m    2011-10-27 12:14:50 UTC (rev 
18192)
@@ -43,7 +43,7 @@
 #import "BDSKPublicationsArray.h"
 #import "NSArray_BDSKExtensions.h"
 #import "BibItem.h"
-#import "NSAttributedString_BDSKExtensions.h"
+#import "NSAttributedString+Scripting.h"
 
 @implementation BDSKTemplatedTextCommand
 

Modified: trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj
===================================================================
--- trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj     2011-10-27 11:33:52 UTC 
(rev 18191)
+++ trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj     2011-10-27 12:14:50 UTC 
(rev 18192)
@@ -85,6 +85,8 @@
                CE095D52135C52B5000E4396 /* BDSKSelectCommand.m in Sources */ = 
{isa = PBXBuildFile; fileRef = CE095D50135C52B5000E4396 /* BDSKSelectCommand.m 
*/; };
                CE09CEA70DDEF65E00F3F2FE /* BDSKCompletionManager.m in Sources 
*/ = {isa = PBXBuildFile; fileRef = CE09CEA50DDEF65E00F3F2FE /* 
BDSKCompletionManager.m */; };
                CE0B3B3C1292E1A500BA05EB /* BDSKErrorObject.m in Sources */ = 
{isa = PBXBuildFile; fileRef = CE0B3B3A1292E1A500BA05EB /* BDSKErrorObject.m 
*/; };
+               CE0CD73B1459812300488DE1 /* NSAttributedString+Scripting.h in 
Headers */ = {isa = PBXBuildFile; fileRef = CE0CD7391459812300488DE1 /* 
NSAttributedString+Scripting.h */; };
+               CE0CD73C1459812300488DE1 /* NSAttributedString+Scripting.m in 
Sources */ = {isa = PBXBuildFile; fileRef = CE0CD73A1459812300488DE1 /* 
NSAttributedString+Scripting.m */; };
                CE0EB4440DCFDE8A0034DF92 /* NSInvocation_BDSKExtensions.m in 
Sources */ = {isa = PBXBuildFile; fileRef = CE0EB4420DCFDE8A0034DF92 /* 
NSInvocation_BDSKExtensions.m */; };
                CE0ECDAB0DE78619006EEDDB /* BDSKSpiresParser.m in Sources */ = 
{isa = PBXBuildFile; fileRef = CE0ECDA90DE78619006EEDDB /* BDSKSpiresParser.m 
*/; };
                CE117D240D7047A5005BFCEB /* 
NSScriptClassDescription_BDSKExtensions.m in Sources */ = {isa = PBXBuildFile; 
fileRef = CE117D220D7047A4005BFCEB /* NSScriptClassDescription_BDSKExtensions.m 
*/; };
@@ -876,6 +878,8 @@
                CE09CEA50DDEF65E00F3F2FE /* BDSKCompletionManager.m */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path 
= BDSKCompletionManager.m; sourceTree = "<group>"; };
                CE0B3B3A1292E1A500BA05EB /* BDSKErrorObject.m */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path 
= BDSKErrorObject.m; sourceTree = "<group>"; };
                CE0B3B3B1292E1A500BA05EB /* BDSKErrorObject.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
BDSKErrorObject.h; sourceTree = "<group>"; };
+               CE0CD7391459812300488DE1 /* NSAttributedString+Scripting.h */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; 
path = "NSAttributedString+Scripting.h"; sourceTree = "<group>"; };
+               CE0CD73A1459812300488DE1 /* NSAttributedString+Scripting.m */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.c.objc; path = "NSAttributedString+Scripting.m"; sourceTree = 
"<group>"; };
                CE0EB4410DCFDE8A0034DF92 /* NSInvocation_BDSKExtensions.h */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; 
path = NSInvocation_BDSKExtensions.h; sourceTree = "<group>"; };
                CE0EB4420DCFDE8A0034DF92 /* NSInvocation_BDSKExtensions.m */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.c.objc; path = NSInvocation_BDSKExtensions.m; sourceTree = 
"<group>"; };
                CE0ECDA80DE78619006EEDDB /* BDSKSpiresParser.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
BDSKSpiresParser.h; sourceTree = "<group>"; };
@@ -1995,6 +1999,7 @@
                                F9022FBE07580B9400C3F701 /* 
BibAuthor+Scripting.m */,
                                F9022FC307580B9400C3F701 /* 
BibDocument+Scripting.m */,
                                F9022FC507580B9400C3F701 /* BibItem+Scripting.m 
*/,
+                               CE0CD73A1459812300488DE1 /* 
NSAttributedString+Scripting.m */,
                                CEFD45870BFFC1F80027B933 /* 
NSWindow+Scripting.m */,
                        );
                        name = Scripting;
@@ -2819,6 +2824,7 @@
                                F9022C9B0758038000C3F701 /* html2tex.h */,
                                CE3011B70D5CC4D100C0B7FA /* 
NSAppleEventDescriptor_BDSKExtensions.h */,
                                F99BC25C095A5C7000E018C3 /* 
NSArray_BDSKExtensions.h */,
+                               CE0CD7391459812300488DE1 /* 
NSAttributedString+Scripting.h */,
                                CEB772E80A34529D00B8A299 /* 
NSAttributedString_BDSKExtensions.h */,
                                F97BF0B7090AE7520063504B /* 
NSBezierPath_BDSKExtensions.h */,
                                F9025DC70969AD2C008A551C /* 
NSCharacterSet_BDSKExtensions.h */,
@@ -2947,6 +2953,7 @@
                        buildActionMask = 2147483647;
                        files = (
                                CE424A450D0F123500F824E7 /* 
BDSKCompletionServerProtocol.h in Headers */,
+                               CE0CD73B1459812300488DE1 /* 
NSAttributedString+Scripting.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
@@ -3789,6 +3796,7 @@
                                CE33D607136AB73600ACE924 /* 
BDSKTextImportItemTableView.m in Sources */,
                                CE33D61C136AB8A700ACE924 /* 
BDSKImportTextView.m in Sources */,
                                CE24BA69143F2A1900B3216B /* 
BDSKRichTextForCommand.m in Sources */,
+                               CE0CD73C1459812300488DE1 /* 
NSAttributedString+Scripting.m in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };

Added: trunk/bibdesk/NSAttributedString+Scripting.h
===================================================================
--- trunk/bibdesk/NSAttributedString+Scripting.h                                
(rev 0)
+++ trunk/bibdesk/NSAttributedString+Scripting.h        2011-10-27 12:14:50 UTC 
(rev 18192)
@@ -0,0 +1,63 @@
+//
+//  NSAttributedString+Scripting.h
+//  Bibdesk
+//
+//  Created by Christiaan Hofman on 10/27/11.
+/*
+ This software is Copyright (c) 2008-2011
+ Christiaan Hofman. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
+
+ - Neither the name of Christiaan Hofman nor the names of any
+    contributors may be used to endorse or promote products derived
+    from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <Cocoa/Cocoa.h>
+
+
+@interface NSAttributedString (BDSKScripting)
+
+- (NSString *)scriptingName;
+- (NSTextStorage *)scriptingRichText;
+
+- (NSScriptObjectSpecifier *)objectSpecifier;
+- (NSScriptObjectSpecifier *)richTextSpecifier;
+
+@end
+
+
+@interface NSTextStorage (BDSKExtensions)
+
+- (id)scriptingRTF;
+- (void)setScriptingRTF:(id)data;
+
+@end
+
+
+@interface NSApplication (BDSKRichTextFormat)
+- (NSAttributedString *)valueInRichTextFormatWithName:(NSString *)name;
+@end

Added: trunk/bibdesk/NSAttributedString+Scripting.m
===================================================================
--- trunk/bibdesk/NSAttributedString+Scripting.m                                
(rev 0)
+++ trunk/bibdesk/NSAttributedString+Scripting.m        2011-10-27 12:14:50 UTC 
(rev 18192)
@@ -0,0 +1,93 @@
+//
+//  NSAttributedString+Scripting.m
+//  Bibdesk
+//
+//  Created by Christiaan Hofman on 10/27/11.
+/*
+ This software is Copyright (c) 2008-2011
+ Christiaan Hofman. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
+
+ - Neither the name of Christiaan Hofman nor the names of any
+    contributors may be used to endorse or promote products derived
+    from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "NSAttributedString+Scripting.h"
+#import "NSData_BDSKExtensions.h"
+
+
+@implementation NSAttributedString (BDSKScripting)
+
+- (NSString *)scriptingName {
+    return [[self RTFFromRange:NSMakeRange(0, [self length]) 
documentAttributes:nil] hexString];
+}
+
+- (NSTextStorage *)scriptingRichText {
+    return [[[NSTextStorage alloc] initWithAttributedString:self] autorelease];
+}
+
+- (NSScriptObjectSpecifier *)objectSpecifier {
+    NSScriptClassDescription *containerClassDescription = 
[NSScriptClassDescription classDescriptionForClass:[NSApp class]];
+    return [[[NSNameSpecifier allocWithZone:[self zone]] 
initWithContainerClassDescription:containerClassDescription 
containerSpecifier:nil key:@"richTextFormat" name:[self scriptingName]] 
autorelease];
+}
+
+- (NSScriptObjectSpecifier *)richTextSpecifier {
+    NSScriptObjectSpecifier *rtfSpecifier = [self objectSpecifier];
+    return [[[NSPropertySpecifier alloc] 
initWithContainerClassDescription:[rtfSpecifier keyClassDescription] 
containerSpecifier:rtfSpecifier key:@"scriptingRichText"] autorelease];
+}
+
+@end
+
+#pragma mark -
+
+@implementation NSTextStorage (BDSKScripting)
+
+- (id)scriptingRTF {
+    return [self RTFFromRange:NSMakeRange(0, [self length]) 
documentAttributes:nil];
+}
+
+- (void)setScriptingRTF:(id)data {
+    if (data) {
+        NSAttributedString *attrString = [[NSAttributedString alloc] 
initWithData:data options:[NSDictionary dictionary] documentAttributes:NULL 
error:NULL];
+        if (attrString)
+            [self setAttributedString:attrString];
+        [attrString release];
+    }
+}
+
+@end
+
+#pragma mark -
+
+@implementation NSApplication (BDSKRichTextFormat)
+
+- (NSAttributedString *)valueInRichTextFormatWithName:(NSString *)name {
+    NSData *data = [[[NSData alloc] initWithHexString:name] autorelease];
+    return data ? [[[NSAttributedString alloc] initWithData:data 
options:[NSDictionary dictionary] documentAttributes:NULL error:NULL] 
autorelease] : nil;
+}
+
+@end

Modified: trunk/bibdesk/NSAttributedString_BDSKExtensions.h
===================================================================
--- trunk/bibdesk/NSAttributedString_BDSKExtensions.h   2011-10-27 11:33:52 UTC 
(rev 18191)
+++ trunk/bibdesk/NSAttributedString_BDSKExtensions.h   2011-10-27 12:14:50 UTC 
(rev 18192)
@@ -47,12 +47,6 @@
 
 - 
(NSComparisonResult)localizedCaseInsensitiveNonTeXNonArticleCompare:(NSAttributedString
 *)other;
 
-- (NSString *)scriptingName;
-- (NSTextStorage *)scriptingRichText;
-
-- (NSScriptObjectSpecifier *)objectSpecifier;
-- (NSScriptObjectSpecifier *)richTextSpecifier;
-
 @end
 
 
@@ -61,16 +55,3 @@
 - (void)appendString:(NSString *)string attributes:(NSDictionary *)attributes;
 
 @end
-
-
-@interface NSTextStorage (BDSKExtensions)
-
-- (id)scriptingRTF;
-- (void)setScriptingRTF:(id)data;
-
-@end
-
-
-@interface NSApplication (BDSKRichTextFormat)
-- (NSAttributedString *)valueInRichTextFormatWithName:(NSString *)name;
-@end

Modified: trunk/bibdesk/NSAttributedString_BDSKExtensions.m
===================================================================
--- trunk/bibdesk/NSAttributedString_BDSKExtensions.m   2011-10-27 11:33:52 UTC 
(rev 18191)
+++ trunk/bibdesk/NSAttributedString_BDSKExtensions.m   2011-10-27 12:14:50 UTC 
(rev 18192)
@@ -40,7 +40,6 @@
 #import "BDSKComplexString.h"
 #import "NSString_BDSKExtensions.h"
 #import "NSCharacterSet_BDSKExtensions.h"
-#import "NSData_BDSKExtensions.h"
 
 #define BDSKRangeKey @"__BDSKRange"
 
@@ -225,26 +224,6 @@
     return [[[NSAttributedString alloc] initWithString:string attributes:[self 
attributesAtIndex:0 effectiveRange:NULL]] autorelease];
 }
 
-#pragma mark Scripting support
-
-- (NSString *)scriptingName {
-    return [[self RTFFromRange:NSMakeRange(0, [self length]) 
documentAttributes:nil] hexString];
-}
-
-- (NSTextStorage *)scriptingRichText {
-    return [[[NSTextStorage alloc] initWithAttributedString:self] autorelease];
-}
-
-- (NSScriptObjectSpecifier *)objectSpecifier {
-    NSScriptClassDescription *containerClassDescription = 
[NSScriptClassDescription classDescriptionForClass:[NSApp class]];
-    return [[[NSNameSpecifier allocWithZone:[self zone]] 
initWithContainerClassDescription:containerClassDescription 
containerSpecifier:nil key:@"richTextFormat" name:[self scriptingName]] 
autorelease];
-}
-
-- (NSScriptObjectSpecifier *)richTextSpecifier {
-    NSScriptObjectSpecifier *rtfSpecifier = [self objectSpecifier];
-    return [[[NSPropertySpecifier alloc] 
initWithContainerClassDescription:[rtfSpecifier keyClassDescription] 
containerSpecifier:rtfSpecifier key:@"scriptingRichText"] autorelease];
-}
-
 @end
 
 
@@ -257,32 +236,3 @@
 }
 
 @end
-
-
-@implementation NSTextStorage (BDSKExtensions)
-
-- (id)scriptingRTF {
-    return [self RTFFromRange:NSMakeRange(0, [self length]) 
documentAttributes:nil];
-}
-
-- (void)setScriptingRTF:(id)data {
-    if (data) {
-        NSAttributedString *attrString = [[NSAttributedString alloc] 
initWithData:data options:[NSDictionary dictionary] documentAttributes:NULL 
error:NULL];
-        if (attrString)
-            [self setAttributedString:attrString];
-        [attrString release];
-    }
-}
-
-@end
-
-
-@implementation NSApplication (BDSKRichTextFormat)
-
-- (NSAttributedString *)valueInRichTextFormatWithName:(NSString *)name {
-    NSData *data = [[[NSData alloc] initWithHexString:name] autorelease];
-    return data ? [[[NSAttributedString alloc] initWithData:data 
options:[NSDictionary dictionary] documentAttributes:NULL error:NULL] 
autorelease] : nil;
-}
-
-@end
-

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


------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to