Revision: 7461
          http://skim-app.svn.sourceforge.net/skim-app/?rev=7461&view=rev
Author:   hofman
Date:     2011-08-30 20:32:48 +0000 (Tue, 30 Aug 2011)
Log Message:
-----------
rename methods for templates based on type rather than file

Modified Paths:
--------------
    trunk/NSDocument_SKExtensions.h
    trunk/NSDocument_SKExtensions.m
    trunk/SKMainDocument.m
    trunk/SKNotesDocument.m

Modified: trunk/NSDocument_SKExtensions.h
===================================================================
--- trunk/NSDocument_SKExtensions.h     2011-08-30 18:12:44 UTC (rev 7460)
+++ trunk/NSDocument_SKExtensions.h     2011-08-30 20:32:48 UTC (rev 7461)
@@ -74,9 +74,9 @@
 
 - (NSData *)notesData;
 
-- (NSString *)notesStringUsingTemplateFile:(NSString *)templateFile;
-- (NSData *)notesDataUsingTemplateFile:(NSString *)templateFile;
-- (NSFileWrapper *)notesFileWrapperUsingTemplateFile:(NSString *)templateFile;
+- (NSString *)notesStringForTemplateType:(NSString *)typeName;
+- (NSData *)notesDataForTemplateType:(NSString *)typeName;
+- (NSFileWrapper *)notesFileWrapperForTemplateType:(NSString *)typeName;
 
 - (NSString *)notesString;
 - (NSData *)notesRTFData;

Modified: trunk/NSDocument_SKExtensions.m
===================================================================
--- trunk/NSDocument_SKExtensions.m     2011-08-30 18:12:44 UTC (rev 7460)
+++ trunk/NSDocument_SKExtensions.m     2011-08-30 20:32:48 UTC (rev 7461)
@@ -142,10 +142,10 @@
     return array ? [NSKeyedArchiver archivedDataWithRootObject:array] : nil;
 }
 
-- (NSString *)notesStringUsingTemplateFile:(NSString *)templateFile {
+- (NSString *)notesStringForTemplateType:(NSString *)typeName {
     NSString *string = nil;
-    if ([[SKTemplateManager sharedManager] 
isRichTextTemplateType:templateFile] == NO) {
-        NSString *templatePath = [[SKTemplateManager sharedManager] 
pathForTemplateType:templateFile];
+    if ([[SKTemplateManager sharedManager] isRichTextTemplateType:typeName] == 
NO) {
+        NSString *templatePath = [[SKTemplateManager sharedManager] 
pathForTemplateType:typeName];
         NSError *error = nil;
         NSString *templateString = [[NSString alloc] 
initWithContentsOfFile:templatePath encoding:NSUTF8StringEncoding error:&error];
         string = [SKTemplateParser 
stringByParsingTemplateString:templateString usingObject:self];
@@ -154,10 +154,10 @@
     return string;
 }
 
-- (NSData *)notesDataUsingTemplateFile:(NSString *)templateFile {
+- (NSData *)notesDataForTemplateType:(NSString *)typeName {
     NSData *data = nil;
-    if ([[SKTemplateManager sharedManager] 
isRichTextTemplateType:templateFile]) {
-        NSString *templatePath = [[SKTemplateManager sharedManager] 
pathForTemplateType:templateFile];
+    if ([[SKTemplateManager sharedManager] isRichTextTemplateType:typeName]) {
+        NSString *templatePath = [[SKTemplateManager sharedManager] 
pathForTemplateType:typeName];
         NSDictionary *docAttributes = nil;
         NSError *error = nil;
         NSAttributedString *templateAttrString = [[NSAttributedString alloc] 
initWithPath:templatePath documentAttributes:&docAttributes];
@@ -170,15 +170,15 @@
         data = [attrString dataFromRange:NSMakeRange(0, [attrString length]) 
documentAttributes:docAttributes error:&error];
         [templateAttrString release];
     } else {
-        data = [[self notesStringUsingTemplateFile:templateFile] 
dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:NO];
+        data = [[self notesStringForTemplateType:typeName] 
dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:NO];
     }
     return data;
 }
 
-- (NSFileWrapper *)notesFileWrapperUsingTemplateFile:(NSString *)templateFile {
+- (NSFileWrapper *)notesFileWrapperForTemplateType:(NSString *)typeName {
     NSFileWrapper *fileWrapper = nil;
-    if ([[templateFile pathExtension] isCaseInsensitiveEqual:@"rtfd"]) {
-        NSString *templatePath = [[SKTemplateManager sharedManager] 
pathForTemplateType:templateFile];
+    if ([[typeName pathExtension] isCaseInsensitiveEqual:@"rtfd"]) {
+        NSString *templatePath = [[SKTemplateManager sharedManager] 
pathForTemplateType:typeName];
         NSDictionary *docAttributes = nil;
         NSAttributedString *templateAttrString = [[NSAttributedString alloc] 
initWithPath:templatePath documentAttributes:&docAttributes];
         NSAttributedString *attrString = [SKTemplateParser 
attributedStringByParsingTemplateAttributedString:templateAttrString 
usingObject:self];
@@ -194,15 +194,15 @@
 }
 
 - (NSString *)notesString {
-    return [self notesStringUsingTemplateFile:@"notesTemplate.txt"];
+    return [self notesStringForTemplateType:@"notesTemplate.txt"];
 }
 
 - (NSData *)notesRTFData {
-    return [self notesDataUsingTemplateFile:@"notesTemplate.rtf"];
+    return [self notesDataForTemplateType:@"notesTemplate.rtf"];
 }
 
 - (NSFileWrapper *)notesRTFDFileWrapper {
-    return [self notesFileWrapperUsingTemplateFile:@"notesTemplate.rtfd"];
+    return [self notesFileWrapperForTemplateType:@"notesTemplate.rtfd"];
 }
 
 - (NSData *)notesFDFDataForFile:(NSString *)filename fileIDStrings:(NSArray 
*)fileIDStrings {

Modified: trunk/SKMainDocument.m
===================================================================
--- trunk/SKMainDocument.m      2011-08-30 18:12:44 UTC (rev 7460)
+++ trunk/SKMainDocument.m      2011-08-30 20:32:48 UTC (rev 7461)
@@ -590,13 +590,13 @@
         else 
             error = [NSError 
writeFileErrorWithLocalizedDescription:NSLocalizedString(@"Unable to write 
notes as FDF", @"Error description")];
     } else if ([[typeName pathExtension] isCaseInsensitiveEqual:@"rtfd"]) {
-        NSFileWrapper *fileWrapper = [self 
notesFileWrapperUsingTemplateFile:typeName];
+        NSFileWrapper *fileWrapper = [self 
notesFileWrapperForTemplateType:typeName];
         if (fileWrapper)
             didWrite = [fileWrapper writeToFile:[absoluteURL path] 
atomically:NO updateFilenames:NO];
         else
             error = [NSError 
writeFileErrorWithLocalizedDescription:NSLocalizedString(@"Unable to write 
notes using template", @"Error description")];
     } else {
-        NSData *data = [self notesDataUsingTemplateFile:typeName];
+        NSData *data = [self notesDataForTemplateType:typeName];
         if (data)
             didWrite = [data writeToURL:absoluteURL options:0 error:&error];
         else

Modified: trunk/SKNotesDocument.m
===================================================================
--- trunk/SKNotesDocument.m     2011-08-30 18:12:44 UTC (rev 7460)
+++ trunk/SKNotesDocument.m     2011-08-30 20:32:48 UTC (rev 7461)
@@ -247,7 +247,7 @@
     else if ([typeName isEqualToString:SKNotesDocumentType] || [typeName 
isEqualToString:SKNotesTextDocumentType] || [typeName 
isEqualToString:SKNotesRTFDocumentType] || [typeName 
isEqualToString:SKNotesFDFDocumentType] || [[typeName pathExtension] 
isCaseInsensitiveEqual:@"rtfd"] == NO)
         fileWrapper = [super fileWrapperOfType:typeName error:outError];
     else
-        fileWrapper = [self notesFileWrapperUsingTemplateFile:typeName];
+        fileWrapper = [self notesFileWrapperForTemplateType:typeName];
     
     if (fileWrapper == nil && outError != NULL)
         *outError = [NSError 
writeFileErrorWithLocalizedDescription:NSLocalizedString(@"Unable to write 
notes", @"Error description")];
@@ -272,7 +272,7 @@
             filename = nil;
         data = [self notesFDFDataForFile:filename fileIDStrings:nil];
     } else {
-        data = [self notesDataUsingTemplateFile:typeName];
+        data = [self notesDataForTemplateType:typeName];
     }
     
     if (data == nil && outError != NULL)

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


------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to