Revision: 28205
http://sourceforge.net/p/bibdesk/svn/28205
Author: hofman
Date: 2023-04-06 11:41:46 +0000 (Thu, 06 Apr 2023)
Log Message:
-----------
revert part of last commit, unfinished temporary changes
Modified Paths:
--------------
trunk/bibdesk/BibDocument_Actions.m
Modified: trunk/bibdesk/BibDocument_Actions.m
===================================================================
--- trunk/bibdesk/BibDocument_Actions.m 2023-04-06 09:18:12 UTC (rev 28204)
+++ trunk/bibdesk/BibDocument_Actions.m 2023-04-06 11:41:46 UTC (rev 28205)
@@ -98,29 +98,6 @@
#define BDSKLyXPipePathKey @"BDSKLyXPipePath"
-@interface BDSKJournalName : NSObject {
- NSString *name;
- NSString *abbreviatedName;
- NSString *dotlessAbbreviatedName;
-}
-- (id)initWithName:(NSString *)aName abbreviatedName:(NSString
*)anAbbreviatedName;
-- (id)initWithDictionary:(NSDictionary *)dictionary;
-@property (nonatomic, readonly) NSString *name;
-@property (nonatomic, readonly) NSString *abbreviatedName;
-@property (nonatomic, readonly) NSString *dotlessAbbreviatedName;
-@property (nonatomic, readonly) NSDictionary *dictionaryValue;
-- (BOOL)isMatchedBy:(NSString *)name;
-@end
-
-@interface BDSKJournalNameManager : NSObject {
- NSMutableArray *journalNames;
-}
-+ (BDSKJournalNameManager *)sharedManager;
-@property (nonatomic, readonly) NSArray *journalNames;
-- (void)loadNames;
-- (BDSKJournalName *)journalNameForName:(NSString *)name;
-@end
-
@implementation BibDocument (Actions)
#pragma mark -
@@ -1688,38 +1665,6 @@
}];
}
-- (IBAction)normalizeJournalNames:(id)sender {
- if ([self numberOfSelectedPubs] == 0 ||
- [self displaysFileSearch] == NSMixedState ||
- [self hasGroupTypeSelected:BDSKExternalGroupType] ||
- [self commitPendingEdits] == NO) {
- NSBeep();
- return;
- }
-
- BDSKJournalNameManager *journalNames = [BDSKJournalNameManager
sharedManager];
- NSInteger type = [sender tag];
- BOOL didChange = NO;
- NSMutableSet *unknownJournals = [NSMutableSet set];
-
- for (BibItem *pub in [self selectedPublications]) {
- NSString *journal = [pub valueOfField:BDSKJournalString inherit:NO];
- if ([NSString isEmptyString:journal]) continue;
-
- BDSKJournalName *journalName = [journalNames
journalNameForName:journal];
- if (journalName == nil) {
- [unknownJournals addObject:journalName];
- continue;
- }
-
- NSString *newJournal = type == 0 ? [journalName name] : type == 1 ?
[journalName abbreviatedName] : [journalName dotlessAbbreviatedName];
- if ([journal isEqualToString:newJournal]) continue;
-
- [pub setField:BDSKJournalString toValue:newJournal];
- didChange = YES;
- }
-}
-
#pragma mark Duplicate and Incomplete searching
// select duplicates, then allow user to delete/copy/whatever
@@ -1896,115 +1841,3 @@
}
@end
-
-
-@implementation BDSKJournalName
-
-@synthesize name, abbreviatedName, dotlessAbbreviatedName;
-@dynamic dictionaryValue;
-
-- (id)initWithName:(NSString *)aName abbreviatedName:(NSString
*)anAbbreviatedName {
- self = [super init];
- if (self) {
- name = [aName retain];
- abbreviatedName = [anAbbreviatedName retain];
- dotlessAbbreviatedName = [[abbreviatedName
stringByDeletingCharactersInSet:[NSCharacterSet
characterSetWithCharactersInString:@"."]] retain];
- }
- return self;
-}
-
-- (id)initWithDictionary:(NSDictionary *)dictionary {
- return [self initWithName:[dictionary objectForKey:@"name"]
abbreviatedName:[dictionary objectForKey:@"abbreviated"]];
-}
-
-- (void)dealloc {
- BDSKDESTROY(name);
- BDSKDESTROY(abbreviatedName);
- BDSKDESTROY(dotlessAbbreviatedName);
- [super dealloc];
-}
-
-- (BOOL)isEqual:(id)other {
- if (self == other)
- return YES;
- if (NO == [other isKindOfClass:[self class]])
- return NO;
- return [name isEqualToString:[(BDSKJournalName *)other name]] &&
[abbreviatedName isEqualToString:[other abbreviatedName]];
-}
-
-- (NSUInteger)hash {
- return [name hash];
-}
-
-- (NSDictionary *)dictionaryValue {
- return [NSDictionary dictionaryWithObjectsAndKeys:name, @"name",
abbreviatedName, @"abbreviated", nil];
-}
-
-- (BOOL)isMatchedBy:(NSString *)aName {
- return [aName isCaseInsensitiveEqual:[self name]] || [aName
isCaseInsensitiveEqual:[self abbreviatedName]] || [aName
isCaseInsensitiveEqual:[self dotlessAbbreviatedName]];
-}
-
-@end
-
-@implementation BDSKJournalNameManager
-
-@synthesize journalNames;
-
-+ (BDSKJournalNameManager *)sharedManager {
- static BDSKJournalNameManager *sharedManager = nil;
- if (sharedManager == nil)
- sharedManager = [[BDSKJournalNameManager alloc] init];
- return sharedManager;
-}
-
-- (id)init {
- self = [super init];
- if (self) {
- journalNames = [[NSMutableArray alloc] init];
- [self loadNames];
- }
- return nil;
-}
-
-- (void)dealloc {
- BDSKDESTROY(journalNames);
- [super dealloc];
-}
-
-- (void)loadNames {
- NSURL *namesURL = [[NSBundle mainBundle]
URLForResource:@"JournalNames.plist" withExtension:nil];
- NSArray *nameDicts = [NSArray arrayWithContentsOfURL:namesURL];
- NSMutableArray *names = [NSMutableArray array];
-
- [journalNames removeAllObjects];
- for (NSDictionary *dict in nameDicts) {
- BDSKJournalName *journal = [[BDSKJournalName alloc]
initWithDictionary:dict];
- [journalNames addObject:journal];
- [names addObject:[[journal name] lowercaseString]];
- [journal release];
- }
-
- namesURL = [[[NSFileManager defaultManager]
applicationSupportDirectoryURL]
URLByAppendingPathComponent:@"JournalNames.plist" isDirectory:NO];
- if ([namesURL checkResourceIsReachableAndReturnError:NULL]) {
- nameDicts = [NSArray arrayWithContentsOfURL:namesURL];
- for (NSDictionary *dict in nameDicts) {
- BDSKJournalName *journal = [[BDSKJournalName alloc]
initWithDictionary:dict];
- NSUInteger i = [names indexOfObject:[[journal name]
lowercaseString]];
- if (i == NSNotFound)
- [journalNames addObject:journal];
- else
- [journalNames replaceObjectAtIndex:i withObject:journal];
- [journal release];
- }
- }
-}
-
-- (BDSKJournalName *)journalNameForName:(NSString *)name {
- for (BDSKJournalName *journalName in journalNames) {
- if ([journalName isMatchedBy:name])
- return journalName;
- }
- return nil;
-}
-
-@end
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