Revision: 27476
http://sourceforge.net/p/bibdesk/svn/27476
Author: hofman
Date: 2022-05-25 14:44:27 +0000 (Wed, 25 May 2022)
Log Message:
-----------
use enum values rather than raw numbers
Modified Paths:
--------------
trunk/bibdesk/BDSKEditor.m
Modified: trunk/bibdesk/BDSKEditor.m
===================================================================
--- trunk/bibdesk/BDSKEditor.m 2022-05-25 06:30:18 UTC (rev 27475)
+++ trunk/bibdesk/BDSKEditor.m 2022-05-25 14:44:27 UTC (rev 27476)
@@ -111,6 +111,7 @@
static NSString * const recentDownloadsQuery = @"(kMDItemContentTypeTree =
'public.content') && (kMDItemFSContentChangeDate >= $time.today(-7)) &&
(kMDItemContentType != com.apple.mail.emlx) && (kMDItemContentType !=
public.vcard)";
enum { BDSKMoveToTrashAsk = -1, BDSKMoveToTrashNo = 0, BDSKMoveToTrashYes = 1
};
+enum { BDSKUpdateTable = -1, BDSKNoReload = 0, BDSKReloadTable = 1 };
@interface BDSKEditor (Private)
@@ -220,7 +221,7 @@
citeKeyConstraint = [[NSLayoutConstraint constraintWithWidth:[citeKeyTitle
intrinsicContentSize].width forItem:citeKeyTitle] retain];
[citeKeyTitle addConstraint:citeKeyConstraint];
- [self resetFields:1];
+ [self resetFields:BDSKReloadTable];
[self setupCollectionView];
if (editorFlags.isEditable)
[tableView registerForDraggedTypes:[NSArray
arrayWithObjects:BDSKPasteboardTypePublications, NSPasteboardTypeString,
(NSString *)kUTTypeURL, (NSString *)kUTTypeFileURL, NSURLPboardType,
NSFilenamesPboardType, nil]];
@@ -794,7 +795,7 @@
addedFields = [[NSMutableSet alloc] init];
[addedFields addObject:newField];
[tabView selectFirstTabViewItem:nil];
- [self resetFields:1];
+ [self resetFields:BDSKReloadTable];
[self setKeyField:newField];
}
}];
@@ -842,7 +843,7 @@
[addedFields removeObject:oldField];
[tabView selectFirstTabViewItem:nil];
if ([NSString isEmptyString:oldValue]) {
- [self resetFields:1];
+ [self resetFields:BDSKReloadTable];
} else {
[publication setField:oldField toValue:nil];
[[self undoManager]
setActionName:NSLocalizedString(@"Remove Field", @"Undo action name")];
@@ -2429,7 +2430,7 @@
[self updatePreviewing];
}
else if([changeKey isEqualToString:BDSKPubTypeString]){
- [self resetFields:0];
+ [self resetFields:BDSKNoReload];
[self updateTypePopup];
[self synchronizeWindowTitleWithDocumentName];
}
@@ -2441,7 +2442,7 @@
[[[self textFieldAtRow:editedRow] currentEditor]
setString:newValue ?: @""];
if ([changeKey isEqualToString:BDSKCrossrefString] && [NSString
isEmptyString:newValue] != [NSString isEmptyString:oldValue]) {
// Crossref field was added or removed
- [self resetFields:0];
+ [self resetFields:BDSKNoReload];
} else {
// every field value could change, but not the displayed field
names
[self reloadTableWithFields:nil];
@@ -2495,7 +2496,7 @@
NSTextField *textField = [self textFieldAtRow:editedRow];
[[textField currentEditor] setString:[textField formatter] ?
[[textField formatter] editingStringForObjectValue:tmpValue] : tmpValue];
}
- [self resetFields:1];
+ [self resetFields:BDSKReloadTable];
[self setupCollectionView];
[self synchronizeWindowTitleWithDocumentName];
[authorTableView reloadData];
@@ -2534,7 +2535,7 @@
BDSKEditorTextField *textField = [self
textFieldAtRow:editedRow];
[[textField currentEditor] setString:[textField formatter] ?
[[textField formatter] editingStringForObjectValue:tmpValue] : tmpValue];
}
- [self resetFields:1];
+ [self resetFields:BDSKReloadTable];
} else {
// a field value changed
NSUInteger row = [fields indexOfObject:changeKey];
@@ -2570,7 +2571,7 @@
- (void)typeInfoDidChange:(NSNotification *)aNotification{
if ([self commitEditing]) {
[self setupTypePopUp];
- [self resetFields:0];
+ [self resetFields:BDSKNoReload];
}
}
@@ -2578,7 +2579,7 @@
// ensure that the pub updates first, since it observes this notification
also
[publication customFieldsDidChange:aNotification];
if ([self commitEditing]) {
- [self resetFields:-1];
+ [self resetFields:BDSKUpdateTable];
[self setupCollectionView];
[authorTableView reloadData];
}
@@ -3448,9 +3449,9 @@
if ([fields isEqualToArray:currentFields])
currentFields = nil;
- if (reloadTable == 1 || currentFields)
+ if (reloadTable == BDSKReloadTable || currentFields)
[self reloadTableWithFields:currentFields];
- else if (reloadTable == -1)
+ else if (reloadTable == BDSKUpdateTable)
[self updateTableViewDisplay];
}
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