Revision: 11394
          http://bibdesk.svn.sourceforge.net/bibdesk/?rev=11394&view=rev
Author:   hofman
Date:     2007-10-26 04:13:35 -0700 (Fri, 26 Oct 2007)

Log Message:
-----------
use KVC compliant accessors for files. Update file objects when the fileURL may 
change. Should be tested if it does not slow down too much, in particular for 
Save As.

Modified Paths:
--------------
    branches/TRY_ARM_FILE_INTERFACE/bibdesk/BDSKFile.h
    branches/TRY_ARM_FILE_INTERFACE/bibdesk/BDSKFile.m
    branches/TRY_ARM_FILE_INTERFACE/bibdesk/BibDocument.m
    branches/TRY_ARM_FILE_INTERFACE/bibdesk/BibEditor.m
    branches/TRY_ARM_FILE_INTERFACE/bibdesk/BibItem.h
    branches/TRY_ARM_FILE_INTERFACE/bibdesk/BibItem.m

Modified: branches/TRY_ARM_FILE_INTERFACE/bibdesk/BDSKFile.h
===================================================================
--- branches/TRY_ARM_FILE_INTERFACE/bibdesk/BDSKFile.h  2007-10-26 09:46:21 UTC 
(rev 11393)
+++ branches/TRY_ARM_FILE_INTERFACE/bibdesk/BDSKFile.h  2007-10-26 11:13:35 UTC 
(rev 11394)
@@ -69,10 +69,12 @@
 - (id)initWithPath:(NSString *)aPath delegate:(id)aDelegate;
 - (id)initWithURL:(NSURL *)aURL delegate:(id)aDelegate;
 
+- (void)setFileRef:(const FSRef *)newFileRef;
 - (const FSRef *)fileRef;
 - (NSURL *)fileURL;
 - (NSString *)path;
 
+- (NSData *)aliasDataRelativeToPath:(NSString *)newBasePath;
 - (NSString *)base64StringRelativeToPath:(NSString *)newBasePath;
 - (NSData *)aliasDataRelativeToPath:(NSString *)newBasePath;
 

Modified: branches/TRY_ARM_FILE_INTERFACE/bibdesk/BDSKFile.m
===================================================================
--- branches/TRY_ARM_FILE_INTERFACE/bibdesk/BDSKFile.m  2007-10-26 09:46:21 UTC 
(rev 11393)
+++ branches/TRY_ARM_FILE_INTERFACE/bibdesk/BDSKFile.m  2007-10-26 11:13:35 UTC 
(rev 11394)
@@ -508,7 +508,7 @@
         // this does the updating if possible
         [self fileRef];
     } else {
-        CFURLRef aURL = CFURLCreateFromFSRef(CFAllocatorGetDefault(), aRef);
+        CFURLRef aURL = CFURLCreateFromFSRef(CFAllocatorGetDefault(), fileRef);
         if (aURL == NULL) {
             // the fileRef was invalid, reset it and update
             [self setFileRef:NULL];

Modified: branches/TRY_ARM_FILE_INTERFACE/bibdesk/BibDocument.m
===================================================================
--- branches/TRY_ARM_FILE_INTERFACE/bibdesk/BibDocument.m       2007-10-26 
09:46:21 UTC (rev 11393)
+++ branches/TRY_ARM_FILE_INTERFACE/bibdesk/BibDocument.m       2007-10-26 
11:13:35 UTC (rev 11394)
@@ -3479,6 +3479,8 @@
     [super setFileURL:absoluteURL];
     [self didChangeValueForKey:@"displayName"];
     
+    if (absoluteURL)
+        [[publications valueForKeyPath:@"@unionOfArrays.files"]  
makeObjectsPerformSelector:@selector(update)];
     [self updatePreviews];
        [[NSNotificationCenter defaultCenter] 
postNotificationName:BDSKDocumentFileURLDidChangeNotification object:self];
 }

Modified: branches/TRY_ARM_FILE_INTERFACE/bibdesk/BibEditor.m
===================================================================
--- branches/TRY_ARM_FILE_INTERFACE/bibdesk/BibEditor.m 2007-10-26 09:46:21 UTC 
(rev 11393)
+++ branches/TRY_ARM_FILE_INTERFACE/bibdesk/BibEditor.m 2007-10-26 11:13:35 UTC 
(rev 11394)
@@ -118,7 +118,7 @@
 
 - (NSURL *)fileView:(FileView *)aFileView URLAtIndex:(NSUInteger)idx;
 {
-    BDSKAliasFile *file = [publication fileAtIndex:idx];
+    BDSKAliasFile *file = [publication objectInFilesAtIndex:idx];
     NSURL *aURL = [file fileURL];
     NSString *relativePath;
     if (aURL == nil && (relativePath = [file relativePath]))

Modified: branches/TRY_ARM_FILE_INTERFACE/bibdesk/BibItem.h
===================================================================
--- branches/TRY_ARM_FILE_INTERFACE/bibdesk/BibItem.h   2007-10-26 09:46:21 UTC 
(rev 11393)
+++ branches/TRY_ARM_FILE_INTERFACE/bibdesk/BibItem.h   2007-10-26 11:13:35 UTC 
(rev 11394)
@@ -84,7 +84,7 @@
 }
 
 - (NSUInteger)countOfFiles;
-- (BDSKAliasFile *)fileAtIndex:(NSUInteger)idx;
+- (BDSKAliasFile *)objectInFilesAtIndex:(NSUInteger)idx;
 - (void)insertObject:(BDSKAliasFile *)aFile inFilesAtIndex:(NSUInteger)idx;
 - (void)removeObjectFromFilesAtIndex:(NSUInteger)idx;
 - (void)moveFilesAtIndexes:(NSIndexSet *)aSet toIndex:(NSUInteger)idx;

Modified: branches/TRY_ARM_FILE_INTERFACE/bibdesk/BibItem.m
===================================================================
--- branches/TRY_ARM_FILE_INTERFACE/bibdesk/BibItem.m   2007-10-26 09:46:21 UTC 
(rev 11393)
+++ branches/TRY_ARM_FILE_INTERFACE/bibdesk/BibItem.m   2007-10-26 11:13:35 UTC 
(rev 11394)
@@ -2486,6 +2486,9 @@
         key = [NSString stringWithFormat:@"Bdsk-File-%d", i];
     }
     
+    if ([owner fileURL])
+        [files makeObjectPerformSelector:@selector(update)];
+    
     // !!! get these out of pubFields for now to avoid duplication when saving
     [pubFields removeObjectsForKeys:keysToRemove];
     
@@ -2498,7 +2501,7 @@
 
 - (NSUInteger)countOfFiles { return [files count]; }
 
-- (BDSKAliasFile *)fileAtIndex:(NSUInteger)idx
+- (BDSKAliasFile *)objectInFilesAtIndex:(NSUInteger)idx
 {
     return [files objectAtIndex:idx];
 }
@@ -2507,6 +2510,8 @@
 {
     [files insertObject:aFile atIndex:idx];
     [aFile setDelegate:self];
+    if ([owner fileURL])
+        [file update];
 }
 
 - (void)removeObjectFromFilesAtIndex:(NSUInteger)idx


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

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to