Revision: 28392
http://sourceforge.net/p/bibdesk/svn/28392
Author: hofman
Date: 2023-10-05 16:18:03 +0000 (Thu, 05 Oct 2023)
Log Message:
-----------
pass option to filer for undo, rather than initisl filing
Modified Paths:
--------------
trunk/bibdesk/BDSKFiler.h
trunk/bibdesk/BDSKFiler.m
trunk/bibdesk/BibItem+Scripting.m
Modified: trunk/bibdesk/BDSKFiler.h
===================================================================
--- trunk/bibdesk/BDSKFiler.h 2023-10-05 14:52:02 UTC (rev 28391)
+++ trunk/bibdesk/BDSKFiler.h 2023-10-05 16:18:03 UTC (rev 28392)
@@ -62,7 +62,7 @@
};
typedef NS_OPTIONS(NSUInteger, BDSKFilerOptions) {
- BDSKAutoFileOptionInitial = 1 << 0,
+ BDSKAutoFileOptionUndo = 1 << 0,
BDSKAutoFileOptionGenerate = 1 << 1,
BDSKAutoFileOptionCheckComplete = 1 << 2,
BDSKAutoFileOptionForce = 1 << 3
Modified: trunk/bibdesk/BDSKFiler.m
===================================================================
--- trunk/bibdesk/BDSKFiler.m 2023-10-05 14:52:02 UTC (rev 28391)
+++ trunk/bibdesk/BDSKFiler.m 2023-10-05 16:18:03 UTC (rev 28392)
@@ -115,7 +115,7 @@
if ([self checkPapersFolder] == NO)
return;
- BDSKFilerOptions mask = BDSKAutoFileOptionInitial |
BDSKAutoFileOptionGenerate;
+ BDSKFilerOptions mask = BDSKAutoFileOptionGenerate;
if (check) mask |= BDSKAutoFileOptionCheckComplete;
NSMutableArray *paperInfos = [NSMutableArray arrayWithCapacity:[papers
count]];
@@ -129,7 +129,7 @@
if ([self checkPapersFolder] == NO)
return;
- BDSKFilerOptions mask = BDSKAutoFileOptionInitial |
BDSKAutoFileOptionGenerate;
+ BDSKFilerOptions mask = BDSKAutoFileOptionGenerate;
if (check) mask |= BDSKAutoFileOptionCheckComplete;
NSMutableArray *paperInfos = [NSMutableArray arrayWithCapacity:[items
count]];
@@ -172,7 +172,7 @@
NSMutableArray *fileInfoDicts = [NSMutableArray
arrayWithCapacity:numberOfPapers];
NSMutableArray *errorInfoDicts = [NSMutableArray arrayWithCapacity:5];
- BOOL initial = (mask & BDSKAutoFileOptionInitial) != 0;
+ BOOL undo = (mask & BDSKAutoFileOptionUndo) != 0;
BOOL generate = (mask & BDSKAutoFileOptionGenerate) != 0;
BOOL force = (mask & BDSKAutoFileOptionForce) != 0;
BOOL check = generate && (mask & BDSKAutoFileOptionCheckComplete) != 0;
@@ -208,10 +208,10 @@
newPath = [[pub suggestedURLForField:field] path];
if (isLinkedFiles)
oldPath = [file path];
- else if (initial)
+ else if (undo)
+ oldPath = [paperInfo valueForKey:BDSKFilerOldPathKey];
+ else
oldPath = [[pub localFileURLForField:field] path];
- else
- oldPath = [paperInfo valueForKey:BDSKFilerOldPathKey];
if (numberOfPapers > 1) {
[progressIndicator incrementBy:1.0];
@@ -313,8 +313,8 @@
[[self window] orderOut:nil];
if ([fileInfoDicts count] > 0) {
- if (isLinkedFiles == NO && initial) {
- // for initial changes to local fiole fields, set the
field now,
+ if (isLinkedFiles == NO && undo == NO) {
+ // for initial changes to local file fields, set the field
now,
// so it will be in the same undo group
// if this is not an initial move, undo should take care
of this
for (NSDictionary *info in fileInfoDicts) {
@@ -323,7 +323,7 @@
}
}
- [[[doc undoManager] prepareWithInvocationTarget:self]
movePapers:fileInfoDicts forField:field fromDocument:doc options:0
actionName:nil];
+ [[[doc undoManager] prepareWithInvocationTarget:self]
movePapers:fileInfoDicts forField:field fromDocument:doc
options:BDSKAutoFileOptionUndo actionName:nil];
if (actionName)
[[doc undoManager] setActionName:actionName];
}
Modified: trunk/bibdesk/BibItem+Scripting.m
===================================================================
--- trunk/bibdesk/BibItem+Scripting.m 2023-10-05 14:52:02 UTC (rev 28391)
+++ trunk/bibdesk/BibItem+Scripting.m 2023-10-05 16:18:03 UTC (rev 28392)
@@ -691,7 +691,7 @@
else if ([location isAbsolutePath] == NO) // or should we use the
papers folder?
location = [[([doc basePath] ?: NSHomeDirectory())
stringByAppendingPathComponent:location] stringByStandardizingPath];
NSArray *paperInfos = [NSArray arrayWithObject:[NSDictionary
dictionaryWithObjectsAndKeys:self, BDSKFilerPublicationKey, location,
BDSKFilerNewPathKey, [linkedFiles firstObject], BDSKFilerFileKey, nil]];
- [[BDSKFiler sharedFiler] movePapers:paperInfos forField:field
fromDocument:doc options:BDSKAutoFileOptionInitial
actionName:NSLocalizedString(@"AppleScript",@"Undo action name for
AppleScript")];
+ [[BDSKFiler sharedFiler] movePapers:paperInfos forField:field
fromDocument:doc options:0 actionName:NSLocalizedString(@"AppleScript",@"Undo
action name for AppleScript")];
if (linkedFiles)
return [linkedFiles valueForKey:@"URL"];
else
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit