Revision: 28234
http://sourceforge.net/p/bibdesk/svn/28234
Author: hofman
Date: 2023-04-20 15:43:50 +0000 (Thu, 20 Apr 2023)
Log Message:
-----------
revert part of changes of last commit with temporary code
Modified Paths:
--------------
trunk/bibdesk/BibDocument_Actions.m
Modified: trunk/bibdesk/BibDocument_Actions.m
===================================================================
--- trunk/bibdesk/BibDocument_Actions.m 2023-04-20 15:42:10 UTC (rev 28233)
+++ trunk/bibdesk/BibDocument_Actions.m 2023-04-20 15:43:50 UTC (rev 28234)
@@ -95,33 +95,9 @@
#import "BDSKColorLabelWell.h"
#import "BDSKMergeController.h"
#import "BDSKFindController.h"
-#import "NSSet_BDSKExtensions.h"
#define BDSKLyXPipePathKey @"BDSKLyXPipePath"
-@interface BDSKJournal : NSObject <NSCopying> {
- NSString *name;
- NSString *abbreviatedName;
- NSString *dotlessAbbreviatedName;
-}
-
-+ (NSArray *)journals;
-+ (BDSKJournal *)journalForName:(NSString *)name;
-+ (void)loadJournals;
-
-- (id)initWithName:(NSString *)aName abbreviatedName:(NSString
*)anAbbreviatedName;
-- (id)initWithDictionary:(NSDictionary *)dictionary;
-
-@property (nonatomic, retain) NSString *name;
-@property (nonatomic, retain) NSString *abbreviatedName;
-@property (nonatomic, readonly) NSString *dotlessAbbreviatedName;
-@property (nonatomic, readonly) NSDictionary *dictionaryValue;
-
-- (BOOL)isMatchedBy:(NSString *)name;
-
-@end
-
-
@implementation BibDocument (Actions)
#pragma mark -
@@ -1689,37 +1665,6 @@
}];
}
-- (IBAction)normalizeJournalNames:(id)sender {
- if ([self numberOfSelectedPubs] == 0 ||
- [self displaysFileSearch] == NSMixedState ||
- [self hasGroupTypeSelected:BDSKExternalGroupType] ||
- [self commitPendingEdits] == NO) {
- NSBeep();
- return;
- }
-
- NSInteger format = [sender tag];
- BOOL didChange = NO;
- NSMutableSet *unknownJournals = [NSMutableSet
setForCaseInsensitiveStrings];
-
- for (BibItem *pub in [self selectedPublications]) {
- NSString *journalName = [pub valueOfField:BDSKJournalString
inherit:NO];
- if ([NSString isEmptyString:journalName]) continue;
-
- BDSKJournal *journal = [BDSKJournal journalForName:journalName];
- if (journal == nil) {
- [unknownJournals addObject:journal];
- continue;
- }
-
- NSString *newJournalName = format == 0 ? [journal name] : format == 1
? [journal abbreviatedName] : [journal dotlessAbbreviatedName];
- if ([journalName isEqualToString:newJournalName]) continue;
-
- [pub setField:BDSKJournalString toValue:newJournalName];
- didChange = YES;
- }
-}
-
#pragma mark Duplicate and Incomplete searching
// select duplicates, then allow user to delete/copy/whatever
@@ -1896,116 +1841,3 @@
}
@end
-
-#define JOURNAL_NAMES_FILENAME @"JournalNames.plist"
-
-#define NAME_KEY @"name"
-#define ABBREVIATED_KEY @"abbreviated"
-
-@implementation BDSKJournal
-
-@synthesize name, abbreviatedName, dotlessAbbreviatedName;
-@dynamic dictionaryValue;
-
-static NSMutableArray *journals = nil;
-
-+ (NSArray *)journals {
- if (journals == nil)
- [self loadJournals];
- return journals;
-}
-
-+ (BDSKJournal *)journalForName:(NSString *)name {
- for (BDSKJournal *journal in [self journals]) {
- if ([journal isMatchedBy:name])
- return journal;
- }
- return nil;
-}
-
-+ (void)loadJournals {
- NSURL *journalsURL = [[NSBundle mainBundle]
URLForResource:JOURNAL_NAMES_FILENAME withExtension:nil];
- NSArray *journalDicts = [NSArray arrayWithContentsOfURL:journalsURL];
- NSMutableArray *names = [NSMutableArray array];
-
- if (journals == nil)
- journals = [[NSMutableArray alloc] init];
- else
- [journals removeAllObjects];
- for (NSDictionary *dict in journalDicts) {
- BDSKJournal *journal = [[BDSKJournal alloc] initWithDictionary:dict];
- [journals addObject:journal];
- [names addObject:[[journal name] lowercaseString]];
- [journal release];
- }
-
- journalsURL = [[[NSFileManager defaultManager]
applicationSupportDirectoryURL]
URLByAppendingPathComponent:JOURNAL_NAMES_FILENAME isDirectory:NO];
- if ([journalsURL checkResourceIsReachableAndReturnError:NULL]) {
- journalDicts = [NSArray arrayWithContentsOfURL:journalsURL];
- for (NSDictionary *dict in journalDicts) {
- BDSKJournal *journal = [[BDSKJournal alloc]
initWithDictionary:dict];
- NSUInteger i = [names indexOfObject:[[journal name]
lowercaseString]];
- if (i == NSNotFound)
- [journals addObject:journal];
- else
- [journals replaceObjectAtIndex:i withObject:journal];
- [journal release];
- }
- }
-}
-
-- (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_KEY]
abbreviatedName:[dictionary objectForKey:ABBREVIATED_KEY]];
-}
-
-- (id)copyWithZone:(NSZone *)zone {
- return [[BDSKJournal allocWithZone:zone] initWithName:[self name]
abbreviatedName:[self abbreviatedName]];
-}
-
-- (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:[(BDSKJournal *)other name]] &&
[abbreviatedName isEqualToString:[(BDSKJournal *)other abbreviatedName]];
-}
-
-- (NSUInteger)hash {
- return [name hash];
-}
-
-- (NSDictionary *)dictionaryValue {
- return [NSDictionary dictionaryWithObjectsAndKeys:name, NAME_KEY,
abbreviatedName, ABBREVIATED_KEY, nil];
-}
-
-- (void)setAbbreviatedName:(NSString *)newAbbreviatedName {
- if (newAbbreviatedName != abbreviatedName) {
- [abbreviatedName release];
- abbreviatedName = [newAbbreviatedName retain];
- [dotlessAbbreviatedName release];
- dotlessAbbreviatedName = [[abbreviatedName
stringByDeletingCharactersInSet:[NSCharacterSet
characterSetWithCharactersInString:@"."]] retain];
- }
-}
-
-- (BOOL)isMatchedBy:(NSString *)aName {
- return [aName isCaseInsensitiveEqual:[self name]] || [aName
isCaseInsensitiveEqual:[self abbreviatedName]] || [aName
isCaseInsensitiveEqual:[self dotlessAbbreviatedName]];
-}
-
-@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