Revision: 12245
http://bibdesk.svn.sourceforge.net/bibdesk/?rev=12245&view=rev
Author: amaxwell
Date: 2008-01-03 21:25:59 -0800 (Thu, 03 Jan 2008)
Log Message:
-----------
Don't run the runloop while migrating. Instead, update progress indicator with
-displayIfNeeded. This removes the chance of closing windows while in the loop.
Change some titles and message text to hopefully better represent the actual
operation.
Modified Paths:
--------------
trunk/bibdesk/BDSKFileMigrationController.h
trunk/bibdesk/BDSKFileMigrationController.m
trunk/bibdesk/BibDocument.m
trunk/bibdesk/English.lproj/BDSKFileMigration.nib/classes.nib
trunk/bibdesk/English.lproj/BDSKFileMigration.nib/info.nib
trunk/bibdesk/English.lproj/BDSKFileMigration.nib/keyedobjects.nib
Modified: trunk/bibdesk/BDSKFileMigrationController.h
===================================================================
--- trunk/bibdesk/BDSKFileMigrationController.h 2008-01-04 04:41:27 UTC (rev
12244)
+++ trunk/bibdesk/BDSKFileMigrationController.h 2008-01-04 05:25:59 UTC (rev
12245)
@@ -45,12 +45,10 @@
IBOutlet NSTextField *statusField;
BOOL keepOriginalValues;
BOOL useSelection;
- BOOL stopped;
NSMutableArray *results;
}
- (IBAction)migrate:(id)sender;
-- (IBAction)stop:(id)sender;
- (IBAction)openParentDirectory:(id)sender;
- (IBAction)editPublication:(id)sender;
- (IBAction)showHelp:(id)sender;
Modified: trunk/bibdesk/BDSKFileMigrationController.m
===================================================================
--- trunk/bibdesk/BDSKFileMigrationController.m 2008-01-04 04:41:27 UTC (rev
12244)
+++ trunk/bibdesk/BDSKFileMigrationController.m 2008-01-04 05:25:59 UTC (rev
12245)
@@ -72,7 +72,6 @@
results = [NSMutableArray new];
keepOriginalValues = YES;
useSelection = NO;
- stopped = NO;
}
return self;
}
@@ -95,7 +94,7 @@
- (NSString *)windowNibName { return @"BDSKFileMigration"; }
- (NSString *)windowTitleForDocumentDisplayName:(NSString *)displayName{
- NSString *title = NSLocalizedString(@"Migrate Files", @"title for file
migration window");
+ NSString *title = NSLocalizedString(@"Convert Files and URLs", @"title for
file migration window");
if ([NSString isEmptyString:displayName] == NO)
title = [NSString stringWithFormat:@"%@ %@ %@", title, [NSString
emdashString], displayName];
return title;
@@ -123,8 +122,6 @@
- (IBAction)migrate:(id)sender;
{
NSMutableArray *observedResults = [self
mutableArrayValueForKey:@"results"];
- // keep a reference to the document, because it may go away when the
window closes while we're busy
- BibDocument *document = (BibDocument *)[[self document] retain];
// get rid of leftovers from a previous run
[observedResults removeAllObjects];
@@ -133,9 +130,9 @@
NSArray *pubs = nil;
if (useSelection == NO)
- pubs = [document publications];
+ pubs = [[self document] publications];
else if ([[self document] hasExternalGroupsSelected] == NO)
- pubs = [document selectedPublications];
+ pubs = [[self document] selectedPublications];
// Workaround for an AppKit bug in Tiger, the progress bar does not work
after the first time it is used, so we replace it by a copy. Apparently also
in Leopard under some conditions
NSProgressIndicator *newProgressBar = [NSKeyedUnarchiver
unarchiveObjectWithData:[NSKeyedArchiver
archivedDataWithRootObject:progressBar]];
@@ -151,16 +148,13 @@
int numberOfAddedFiles = 0, numberOfRemovedFields = 0, addedFiles,
removedFields;
NSEnumerator *pubEnum = [pubs objectEnumerator];
BibItem *aPub;
-
- stopped = NO;
-
- while (stopped == NO && (aPub = [pubEnum nextObject])) {
- if ((current++ % 5) == 0) {
- // Causes the progress bar and other UI to update; tickling the
runloop rather than using -displayIfNeeded keeps spindump from running on
Leopard and slowing things down even more.
- [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode
beforeDate:[NSDate distantPast]];
- }
+ while ((aPub = [pubEnum nextObject])) {
+ // Causes the progress bar and other UI to update
+ if ((current++ % 5) == 0)
+ [[self window] displayIfNeeded];
+
NSError *error;
if (NO == [aPub migrateFilesAndRemove:(NO == keepOriginalValues)
numberOfAddedFiles:&addedFiles numberOfRemovedFields:&removedFields
error:&error]) {
NSArray *messages = [error valueForKey:@"messages"];
@@ -184,23 +178,16 @@
NSString *messageFormat = nil;
if (keepOriginalValues)
- messageFormat = NSLocalizedString(@"Migrated %i files or URLs.",
@"Status message");
+ messageFormat = NSLocalizedString(@"Converted %i files or URLs.",
@"Status message");
else
- messageFormat = NSLocalizedString(@"Migrated %i files or URLs, removed
%i fields.", @"Status message");
+ messageFormat = NSLocalizedString(@"Converted %i files or URLs,
removed %i fields.", @"Status message");
[statusField setStringValue:[NSString stringWithFormat:messageFormat,
numberOfAddedFiles, numberOfRemovedFields]];
// BibItem change notifications are only posted if the old fields are
removed, so this ensures that the file view is updated
if (numberOfAddedFiles > 0)
- [document updatePreviews];
-
- [document release];
+ [[self document] updatePreviews];
}
-- (IBAction)stop:(id)sender;
-{
- stopped = YES;
-}
-
- (IBAction)editPublication:(id)sender;
{
int row = [tableView clickedRow];
Modified: trunk/bibdesk/BibDocument.m
===================================================================
--- trunk/bibdesk/BibDocument.m 2008-01-04 04:41:27 UTC (rev 12244)
+++ trunk/bibdesk/BibDocument.m 2008-01-04 05:25:59 UTC (rev 12245)
@@ -566,14 +566,15 @@
}
- (void)windowWillClose:(NSNotification *)notification{
-
+
// see comment in invalidateSearchFieldCellTimer
- [documentWindow endEditingFor:nil];
- [self invalidateSearchFieldCellTimer];
+ if (floor(NSAppKitVersionNumber <= NSAppKitVersionNumber10_4)) {
+ [documentWindow endEditingFor:nil];
+ [self invalidateSearchFieldCellTimer];
+ }
docState.isDocumentClosed = YES;
-
- [migrationController stop:self];
+
[fileSearchController terminate];
if([drawerController isDrawerOpen])
[drawerController toggle:nil];
Modified: trunk/bibdesk/English.lproj/BDSKFileMigration.nib/classes.nib
===================================================================
--- trunk/bibdesk/English.lproj/BDSKFileMigration.nib/classes.nib
2008-01-04 04:41:27 UTC (rev 12244)
+++ trunk/bibdesk/English.lproj/BDSKFileMigration.nib/classes.nib
2008-01-04 05:25:59 UTC (rev 12245)
@@ -1,36 +1,125 @@
-{
- IBClasses = (
- {
- ACTIONS = {editPublication = id; migrate = id; openParentDirectory
= id; showHelp = id; };
- CLASS = BDSKFileMigrationController;
- LANGUAGE = ObjC;
- OUTLETS = {
- migrateButton = NSButton;
- progressBar = NSProgressIndicator;
- statusField = NSTextField;
- tableView = NSTableView;
- };
- SUPERCLASS = NSWindowController;
- },
- {CLASS = BDSKTextWithIconCell; LANGUAGE = ObjC; SUPERCLASS =
NSTextFieldCell; },
- {CLASS = NSControl; LANGUAGE = ObjC; SUPERCLASS = NSView; },
- {CLASS = NSMenu; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
- {CLASS = NSObject; LANGUAGE = ObjC; },
- {CLASS = NSScrollView; LANGUAGE = ObjC; SUPERCLASS = NSView; },
- {CLASS = NSTableHeaderView; LANGUAGE = ObjC; SUPERCLASS = NSView; },
- {
- ACTIONS = {changeFont = id; invertSelection = id; };
- CLASS = NSTableView;
- LANGUAGE = ObjC;
- SUPERCLASS = NSControl;
- },
- {CLASS = NSWindow; LANGUAGE = ObjC; SUPERCLASS = NSResponder; },
- {
- ACTIONS = {hideWindow = id; toggleShowingWindow = id; };
- CLASS = NSWindowController;
- LANGUAGE = ObjC;
- SUPERCLASS = NSResponder;
- }
- );
- IBVersion = 1;
-}
\ No newline at end of file
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>IBClasses</key>
+ <array>
+ <dict>
+ <key>CLASS</key>
+ <string>BDSKTextWithIconCell</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSTextFieldCell</string>
+ </dict>
+ <dict>
+ <key>ACTIONS</key>
+ <dict>
+ <key>editPublication</key>
+ <string>id</string>
+ <key>migrate</key>
+ <string>id</string>
+ <key>openParentDirectory</key>
+ <string>id</string>
+ <key>showHelp</key>
+ <string>id</string>
+ </dict>
+ <key>CLASS</key>
+ <string>BDSKFileMigrationController</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>OUTLETS</key>
+ <dict>
+ <key>migrateButton</key>
+ <string>NSButton</string>
+ <key>progressBar</key>
+ <string>NSProgressIndicator</string>
+ <key>statusField</key>
+ <string>NSTextField</string>
+ <key>tableView</key>
+ <string>NSTableView</string>
+ </dict>
+ <key>SUPERCLASS</key>
+ <string>NSWindowController</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
+ <string>NSControl</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSView</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
+ <string>NSMenu</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSObject</string>
+ </dict>
+ <dict>
+ <key>ACTIONS</key>
+ <dict>
+ <key>hideWindow</key>
+ <string>id</string>
+ <key>toggleShowingWindow</key>
+ <string>id</string>
+ </dict>
+ <key>CLASS</key>
+ <string>NSWindowController</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSResponder</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
+ <string>NSObject</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
+ <string>NSWindow</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSResponder</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
+ <string>NSScrollView</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSView</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
+ <string>NSTableHeaderView</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSView</string>
+ </dict>
+ <dict>
+ <key>ACTIONS</key>
+ <dict>
+ <key>changeFont</key>
+ <string>id</string>
+ <key>invertSelection</key>
+ <string>id</string>
+ </dict>
+ <key>CLASS</key>
+ <string>NSTableView</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSControl</string>
+ </dict>
+ </array>
+ <key>IBVersion</key>
+ <string>1</string>
+</dict>
+</plist>
Modified: trunk/bibdesk/English.lproj/BDSKFileMigration.nib/info.nib
===================================================================
--- trunk/bibdesk/English.lproj/BDSKFileMigration.nib/info.nib 2008-01-04
04:41:27 UTC (rev 12244)
+++ trunk/bibdesk/English.lproj/BDSKFileMigration.nib/info.nib 2008-01-04
05:25:59 UTC (rev 12245)
@@ -1,21 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
- <key>IBDocumentLocation</key>
- <string>69 58 356 240 0 0 1440 938 </string>
<key>IBFramework Version</key>
- <string>489.0</string>
- <key>IBLastKnownRelativeProjectPath</key>
- <string>../../Bibdesk.xcodeproj</string>
+ <string>629</string>
<key>IBOldestOS</key>
<integer>5</integer>
<key>IBOpenObjects</key>
<array>
- <integer>1</integer>
+ <integer>2</integer>
</array>
<key>IBSystem Version</key>
- <string>8S165</string>
+ <string>9C7</string>
<key>targetFramework</key>
<string>IBCocoaFramework</string>
</dict>
Modified: trunk/bibdesk/English.lproj/BDSKFileMigration.nib/keyedobjects.nib
===================================================================
(Binary files differ)
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: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit