[Bibdesk-commit] SF.net SVN: bibdesk:[28266] trunk/bibdesk/BDSKWebView.m

2023-05-28 Thread hofman--- via Bibdesk-commit
Revision: 28266
  http://sourceforge.net/p/bibdesk/svn/28266
Author:   hofman
Date: 2023-05-28 15:48:38 + (Sun, 28 May 2023)
Log Message:
---
use variable

Modified Paths:
--
trunk/bibdesk/BDSKWebView.m

Modified: trunk/bibdesk/BDSKWebView.m
===
--- trunk/bibdesk/BDSKWebView.m 2023-05-28 15:47:07 UTC (rev 28265)
+++ trunk/bibdesk/BDSKWebView.m 2023-05-28 15:48:38 UTC (rev 28266)
@@ -300,7 +300,7 @@
 if ([origUrlString isEqualToString:urlString])
 origUrlString = nil;
 if (icon) {
-[[BDSKWebIconDatabase sharedDatabase] setIcon:icon withData:nil 
fromURLString:[faviconURL absoluteString] forURLString:[self mainFrameURL] 
originalURLString:origUrlString];
+[[BDSKWebIconDatabase sharedDatabase] setIcon:icon withData:nil 
fromURLString:[faviconURL absoluteString] forURLString:urlString 
originalURLString:origUrlString];
 if (icon != favicon)
 [self setFavicon:icon];
 return;

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28267] trunk/bibdesk/BDSKWebView.m

2023-05-28 Thread hofman--- via Bibdesk-commit
Revision: 28267
  http://sourceforge.net/p/bibdesk/svn/28267
Author:   hofman
Date: 2023-05-28 16:31:50 + (Sun, 28 May 2023)
Log Message:
---
don't bother saving favicon for original url if it only differes by trailing 
slash

Modified Paths:
--
trunk/bibdesk/BDSKWebView.m

Modified: trunk/bibdesk/BDSKWebView.m
===
--- trunk/bibdesk/BDSKWebView.m 2023-05-28 15:48:38 UTC (rev 28266)
+++ trunk/bibdesk/BDSKWebView.m 2023-05-28 16:31:50 UTC (rev 28267)
@@ -297,7 +297,7 @@
 icon = faviconFromOrigin ? nil : [[BDSKWebIconDatabase sharedDatabase] 
recentIconForURLString:[faviconURL absoluteString]];
 urlString = [self mainFrameURL];
 NSString *origUrlString = [self mainFrame] dataSource] initialRequest] 
URL] absoluteString];
-if ([origUrlString isEqualToString:urlString])
+if ([origUrlString isEqualToString:urlString] || [([origUrlString
hasPrefix:@"/"] ? [origUrlString substringToIndex:[origUrlString length] - 1] : 
[origUrlString stringByAppendingString:@"/"]) isEqualToString:urlString])
 origUrlString = nil;
 if (icon) {
 [[BDSKWebIconDatabase sharedDatabase] setIcon:icon withData:nil 
fromURLString:[faviconURL absoluteString] forURLString:urlString 
originalURLString:origUrlString];

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28268] trunk/bibdesk/BDSKWebIconDatabase.m

2023-05-28 Thread hofman--- via Bibdesk-commit
Revision: 28268
  http://sourceforge.net/p/bibdesk/svn/28268
Author:   hofman
Date: 2023-05-28 21:24:19 + (Sun, 28 May 2023)
Log Message:
---
Only try to get favicon from URL adding or removing slash when there is no 
fragment or query. Also try to get from recent icons.

Modified Paths:
--
trunk/bibdesk/BDSKWebIconDatabase.m

Modified: trunk/bibdesk/BDSKWebIconDatabase.m
===
--- trunk/bibdesk/BDSKWebIconDatabase.m 2023-05-28 16:31:50 UTC (rev 28267)
+++ trunk/bibdesk/BDSKWebIconDatabase.m 2023-05-28 21:24:19 UTC (rev 28268)
@@ -97,11 +97,13 @@
 if (icon)
 return icon;
 NSString *iconURLString = [[pages objectForKey:pageURLString] 
objectForKey:ICONURL_KEY];
-if (iconURLString == nil) {
+if (iconURLString == nil && [pageURLString containsString:@"?"] == NO && 
[pageURLString containsString:@"#"] == NO && [pageURLString 
containsString:@"://"]) {
 if ([pageURLString hasSuffix:@"/"])
 pageURLString = [pageURLString substringToIndex:[pageURLString 
length] - 1];
 else
 pageURLString = [pageURLString stringByAppendingString:@"/"];
+if ((icon = [recentIcons objectForKey:pageURLString]))
+return icon;
 iconURLString = [[pages objectForKey:pageURLString] 
objectForKey:ICONURL_KEY];
 }
 if (iconURLString == nil)

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28269] trunk/bibdesk

2023-05-30 Thread hofman--- via Bibdesk-commit
Revision: 28269
  http://sourceforge.net/p/bibdesk/svn/28269
Author:   hofman
Date: 2023-05-30 14:39:06 + (Tue, 30 May 2023)
Log Message:
---
add method to call when dismissing a sheet. Use it to cclear object controllers.

Modified Paths:
--
trunk/bibdesk/BDSKFieldSheetController.m
trunk/bibdesk/BDSKFilterController.m
trunk/bibdesk/BDSKScriptGroupSheetController.m
trunk/bibdesk/BDSKURLGroupSheetController.m
trunk/bibdesk/NSWindowController_BDSKExtensions.h
trunk/bibdesk/NSWindowController_BDSKExtensions.m

Modified: trunk/bibdesk/BDSKFieldSheetController.m
===
--- trunk/bibdesk/BDSKFieldSheetController.m2023-05-28 21:24:19 UTC (rev 
28268)
+++ trunk/bibdesk/BDSKFieldSheetController.m2023-05-30 14:39:06 UTC (rev 
28269)
@@ -129,11 +129,14 @@
 
 - (IBAction)dismiss:(id)sender {
 if ([sender tag] == NSCancelButton || [objectController commitEditing]) {
-[objectController setContent:nil];
 [super dismiss:sender];
 }
 }
 
+- (void)didDismissSheet {
+[objectController setContent:nil];
+}
+
 #pragma mark Touch Bar
 
 - (NSTouchBar *)makeTouchBar {

Modified: trunk/bibdesk/BDSKFilterController.m
===
--- trunk/bibdesk/BDSKFilterController.m2023-05-28 21:24:19 UTC (rev 
28268)
+++ trunk/bibdesk/BDSKFilterController.m2023-05-30 14:39:06 UTC (rev 
28269)
@@ -125,10 +125,13 @@
 - (IBAction)dismiss:(id)sender {
 if ([sender tag] == NSOKButton && [self commitEditing] == NO) {
 NSBeep();
-return;
+} else {
+[super dismiss:sender];
 }
+}
+
+- (void)didDismissSheet {
 [conditionControllers setValue:nil forKey:@"filterController"];
-[super dismiss:sender];
 }
 
 - (void)insertNewConditionAfter:(BDSKConditionController 
*)aConditionController {

Modified: trunk/bibdesk/BDSKScriptGroupSheetController.m
===
--- trunk/bibdesk/BDSKScriptGroupSheetController.m  2023-05-28 21:24:19 UTC 
(rev 28268)
+++ trunk/bibdesk/BDSKScriptGroupSheetController.m  2023-05-30 14:39:06 UTC 
(rev 28269)
@@ -115,12 +115,13 @@
 - (IBAction)dismiss:(id)sender {
 if ([sender tag] == NSOKButton && [self commitEditing] == NO) {
 NSBeep();
-return;
+} else {
+[super dismiss:sender];
 }
-
+}
+
+- (void)didDismissSheet {
 [objectController setContent:nil];
-
-[super dismiss:sender];
 }
 
 // open panel delegate method

Modified: trunk/bibdesk/BDSKURLGroupSheetController.m
===
--- trunk/bibdesk/BDSKURLGroupSheetController.m 2023-05-28 21:24:19 UTC (rev 
28268)
+++ trunk/bibdesk/BDSKURLGroupSheetController.m 2023-05-30 14:39:06 UTC (rev 
28269)
@@ -88,12 +88,13 @@
 - (IBAction)dismiss:(id)sender {
 if ([sender tag] == NSOKButton && [self commitEditing] == NO) {
 NSBeep();
-return;
+} else {
+[super dismiss:sender];
 }
-
+}
+
+- (void)didDismissSheet {
 [objectController setContent:nil];
-
-[super dismiss:sender];
 }
 
 - (IBAction)chooseURL:(id)sender {

Modified: trunk/bibdesk/NSWindowController_BDSKExtensions.h
===
--- trunk/bibdesk/NSWindowController_BDSKExtensions.h   2023-05-28 21:24:19 UTC 
(rev 28268)
+++ trunk/bibdesk/NSWindowController_BDSKExtensions.h   2023-05-30 14:39:06 UTC 
(rev 28269)
@@ -52,4 +52,6 @@
 
 - (IBAction)dismiss:(id)sender;
 
+- (void)didDismissSheet;
+
 @end

Modified: trunk/bibdesk/NSWindowController_BDSKExtensions.m
===
--- trunk/bibdesk/NSWindowController_BDSKExtensions.m   2023-05-28 21:24:19 UTC 
(rev 28268)
+++ trunk/bibdesk/NSWindowController_BDSKExtensions.m   2023-05-30 14:39:06 UTC 
(rev 28269)
@@ -98,10 +98,13 @@
 [window beginSheet:[self window] completionHandler:handler];
 }
 
+- (void)didDismissSheet {}
+
 - (IBAction)dismiss:(id)sender {
 NSWindow *window = [[self window] sheetParent];
 if (window) {
 [window endSheet:[self window] returnCode:[sender tag]];
+[self didDismissSheet];
 [self autorelease];
 }
 }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28270] trunk/bibdesk

2023-05-31 Thread hofman--- via Bibdesk-commit
Revision: 28270
  http://sourceforge.net/p/bibdesk/svn/28270
Author:   hofman
Date: 2023-05-31 17:12:24 + (Wed, 31 May 2023)
Log Message:
---
Don't pass tmp citekey to import method and error, as it is always the standard 
one. Pass whether to show temporary citekey warning in options.

Modified Paths:
--
trunk/bibdesk/BDSKDocumentController.m
trunk/bibdesk/BDSKStringParser.m
trunk/bibdesk/BibDocument+Scripting.m
trunk/bibdesk/BibDocument.h
trunk/bibdesk/BibDocument.m
trunk/bibdesk/BibDocument_Actions.m
trunk/bibdesk/NSError_BDSKExtensions.h
trunk/bibdesk/NSError_BDSKExtensions.m

Modified: trunk/bibdesk/BDSKDocumentController.m
===
--- trunk/bibdesk/BDSKDocumentController.m  2023-05-30 14:39:06 UTC (rev 
28269)
+++ trunk/bibdesk/BDSKDocumentController.m  2023-05-31 17:12:24 UTC (rev 
28270)
@@ -468,7 +468,7 @@
 if ([NSString isEmptyString:searchString] == NO && [document 
respondsToSelector:@selector(setSearchString:)])
 [(BibDocument *)document setSearchString:searchString];
 if (shouldReportTempCiteKeys)
-[(BibDocument *)document reportTemporaryCiteKeys:[BibItem 
placeholderCiteKey] forNewDocument:YES];
+[(BibDocument *)document 
reportTemporaryCiteKeysForNewDocument:YES];
 if (completionHandler)
 completionHandler(document, documentWasAlreadyOpen, error);
 }];

Modified: trunk/bibdesk/BDSKStringParser.m
===
--- trunk/bibdesk/BDSKStringParser.m2023-05-30 14:39:06 UTC (rev 28269)
+++ trunk/bibdesk/BDSKStringParser.m2023-05-31 17:12:24 UTC (rev 28270)
@@ -132,8 +132,7 @@
if(type == BDSKStringTypeNoKeyBibTeX && parseError == nil){
 // return an error when we inserted temporary keys, let the caller 
decide what to do with it
 // don't override a parseError though, as that is probably more 
relevant
-parseError = [NSError 
mutableLocalErrorWithCode:kBDSKHadMissingCiteKeys 
localizedDescription:NSLocalizedString(@"Temporary Cite Keys", @"Error 
description")];
-[parseError setValue:[BibItem placeholderCiteKey] 
forKey:BDSKTemporaryCiteKeyErrorKey];
+parseError = [NSError localErrorWithCode:kBDSKHadMissingCiteKeys 
localizedDescription:NSLocalizedString(@"Temporary Cite Keys", @"Error 
description")];
 }
 
if(outError) *outError = parseError;

Modified: trunk/bibdesk/BibDocument+Scripting.m
===
--- trunk/bibdesk/BibDocument+Scripting.m   2023-05-30 14:39:06 UTC (rev 
28269)
+++ trunk/bibdesk/BibDocument+Scripting.m   2023-05-31 17:12:24 UTC (rev 
28270)
@@ -1158,7 +1158,7 @@
 [pub addFileForURL:url autoFile:NO 
runScriptHook:NO];
 }
 }
-[self importPublications:result publicationsToAutoFile:([url 
isFileURL] ? result : nil) temporaryCiteKey:nil options:BDSKImportAggregate | 
BDSKImportNoEdit];
+[self importPublications:result publicationsToAutoFile:([url 
isFileURL] ? result : nil) options:BDSKImportAggregate | BDSKImportNoEdit];
 }
 };
 }

Modified: trunk/bibdesk/BibDocument.h
===
--- trunk/bibdesk/BibDocument.h 2023-05-30 14:39:06 UTC (rev 28269)
+++ trunk/bibdesk/BibDocument.h 2023-05-31 17:12:24 UTC (rev 28270)
@@ -77,7 +77,8 @@
 BDSKImportSelectLibrary = 1 << 0,
 BDSKImportAggregate = 1 << 1,
 BDSKImportNoEdit = 1 << 2,
-BDSKImportNonVerbose = 1 << 3
+BDSKImportNonVerbose = 1 << 3,
+BDSKImportWithTemporaryCiteKey = 1 << 4
 };
 
 typedef NS_OPTIONS(NSInteger, BDSKAutoGenerateStatus) {
@@ -344,7 +345,7 @@
 
 - (BOOL)readFromBibTeXData:(NSData *)data string:(NSString *)string 
fromURL:(NSURL *)absoluteURL encoding:(NSStringEncoding)encoding error:(NSError 
**)outError;
 
-- (void)reportTemporaryCiteKeys:(NSString *)tmpKey 
forNewDocument:(BOOL)isNewFile;
+- (void)reportTemporaryCiteKeysForNewDocument:(BOOL)isNewFile;
 - (void)markAsImported;
 
 - (NSString *)bibTeXStringForPublications:(NSArray *)items;
@@ -374,7 +375,7 @@
 
 @property (nonatomic, readonly) BDSKMacroResolver *macroResolver;
 
-- (void)importPublications:(NSArray *)newPubs publicationsToAutoFile:(NSArray 
*)pubsToAutoFile temporaryCiteKey:(NSString *)tmpCiteKey 
options:(BDSKImportOptions)options;
+- (void)importPublications:(NSArray *)newPubs publicationsToAutoFile:(NSArray 
*)pubsToAutoFile options:(BDSKImportOptions)options;
 - (void)importPublications:(NSArray *)newPubs 
options:(BDSKImportOptions)options;
 - (NSArray *)importPublicationsFromPasteboard:(NSPasteboard *)pb 
options:(BDSKImportOptions)options;
 - (NSArray *)extractPublicationsFromFileURL:(NSURL *)fileURL 
verbose:(BOOL)verb

[Bibdesk-commit] SF.net SVN: bibdesk:[28271] trunk/bibdesk

2023-05-31 Thread hofman--- via Bibdesk-commit
Revision: 28271
  http://sourceforge.net/p/bibdesk/svn/28271
Author:   hofman
Date: 2023-05-31 22:20:25 + (Wed, 31 May 2023)
Log Message:
---
Mark cite key as edited when reading for document rather than in init, so it is 
not marked for items imported from an external file

Modified Paths:
--
trunk/bibdesk/BibDocument.m
trunk/bibdesk/BibItem.h
trunk/bibdesk/BibItem.m

Modified: trunk/bibdesk/BibDocument.m
===
--- trunk/bibdesk/BibDocument.m 2023-05-31 17:12:24 UTC (rev 28270)
+++ trunk/bibdesk/BibDocument.m 2023-05-31 22:20:25 UTC (rev 28271)
@@ -1855,6 +1855,9 @@
 
 newPubs = [BDSKBibTeXParser itemsFromData:data macros:&newMacros 
documentInfo:&newDocumentInfo groups:&newGroups frontMatter:&newFrontMatter 
filePath:[fileURL path] owner:self encoding:parserEncoding error:&error];
 
+// do not autogenerate the cite key, unless it is empty or a placeholder
+[newPubs makeObjectsPerformSelector:@selector(markCiteKeyEdited)];
+
 // @@ move this to NSDocumentController; need to figure out where to add 
it, though
 // @@ should we check for kBDSKBibTeXParserFailed instead? The difference 
is whether we ignore warnings for circular macros 
(kBDSKParserIgnoredFrontMatter), which we used to do
 if (error) {

Modified: trunk/bibdesk/BibItem.h
===
--- trunk/bibdesk/BibItem.h 2023-05-31 17:12:24 UTC (rev 28270)
+++ trunk/bibdesk/BibItem.h 2023-05-31 22:20:25 UTC (rev 28271)
@@ -451,6 +451,8 @@
 
 - (void)markNeWithDate:(NSDate *)date description:(NSString *)dateDescription;
 
+- (void)markCiteKeyEdited;
+
 /*!
@method setPubType:withModDate:
@abstract   Basic setter for the publication type, with undo. Sets up 
the fields if necessary.

Modified: trunk/bibdesk/BibItem.m
===
--- trunk/bibdesk/BibItem.m 2023-05-31 17:12:24 UTC (rev 28270)
+++ trunk/bibdesk/BibItem.m 2023-05-31 22:20:25 UTC (rev 28271)
@@ -294,7 +294,7 @@
 [self markNeWithDate:date description:[date standardDescription]];
 }
 
-hasEditedCiteKey = isNew == NO && [self hasEmptyOrDefaultCiteKey] == 
NO;
+hasEditedCiteKey = NO;
 
 filesToBeFiled = nil;
 localUrlNeedsToBeFiled = NO;
@@ -581,6 +581,10 @@
 [self setDateModified:date];
 }
 
+- (void)markCiteKeyEdited {
+hasEditedCiteKey = NO == [self hasEmptyOrDefaultCiteKey];
+}
+
 #pragma mark Archiving
 
 + (NSData *)archivedPublications:(NSArray *)array {

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28272] trunk/bibdesk/BibDocument.m

2023-06-01 Thread hofman--- via Bibdesk-commit
Revision: 28272
  http://sourceforge.net/p/bibdesk/svn/28272
Author:   hofman
Date: 2023-06-01 14:19:27 + (Thu, 01 Jun 2023)
Log Message:
---
make sure undo ation name is set before editing pubs, possibly showing a dialog

Modified Paths:
--
trunk/bibdesk/BibDocument.m

Modified: trunk/bibdesk/BibDocument.m
===
--- trunk/bibdesk/BibDocument.m 2023-05-31 22:20:25 UTC (rev 28271)
+++ trunk/bibdesk/BibDocument.m 2023-06-01 14:19:27 UTC (rev 28272)
@@ -2236,11 +2236,11 @@
 }
 }
 
+[[self undoManager] setActionName:NSLocalizedString(@"Add Publication", 
@"Undo action name")];
+
if((options & BDSKImportNoEdit) == 0 && [sud 
boolForKey:BDSKEditOnPasteKey])
[self editPublications:newPubs]; // this will ask the user when 
there are many pubs

-   [[self undoManager] setActionName:NSLocalizedString(@"Add Publication", 
@"Undo action name")];
-
 NSMutableArray *importedItems = [NSMutableArray array];
 BOOL aggregate = (options & BDSKImportAggregate) != 0;
 BDSKLastImportGroup *lastImportGroup = [groups lastImportGroup];

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28273] trunk/bibdesk/BDSKEditor.m

2023-06-01 Thread hofman--- via Bibdesk-commit
Revision: 28273
  http://sourceforge.net/p/bibdesk/svn/28273
Author:   hofman
Date: 2023-06-01 14:58:39 + (Thu, 01 Jun 2023)
Log Message:
---
remove unused method

Modified Paths:
--
trunk/bibdesk/BDSKEditor.m

Modified: trunk/bibdesk/BDSKEditor.m
===
--- trunk/bibdesk/BDSKEditor.m  2023-06-01 14:19:27 UTC (rev 28272)
+++ trunk/bibdesk/BDSKEditor.m  2023-06-01 14:58:39 UTC (rev 28273)
@@ -1578,37 +1578,6 @@
 [previewRecentURLs release];
 }
 
-- (NSMenu *)recentDownloadsMenu{
-static dispatch_once_t onceToken;
-dispatch_once(&onceToken, ^{
-// limit the scope to the default downloads directory
-NSURL *downloadURL = [[NSFileManager defaultManager] 
downloadFolderURL];
-if(downloadURL){
-[[BDSKPersistentSearch sharedSearch] addQuery:recentDownloadsQuery 
scopes:[NSArray arrayWithObject:downloadURL]];
-}
-});
-
-NSMenu *menu = [[NSMenu allocWithZone:[NSMenu menuZone]] init];
-
-NSArray *paths = [[BDSKPersistentSearch sharedSearch] 
resultsForQuery:recentDownloadsQuery attribute:(NSString *)kMDItemPath];
-NSMenuItem *item;
-
-for (NSString *filePath in paths) {
-item = [menu addItemWithTitle:[filePath lastPathComponent]
-   action:@selector(addLinkedFileFromMenuItem:)
-keyEquivalent:@""];
-[item setRepresentedObject:[NSURL fileURLWithPath:filePath 
isDirectory:NO]];
-[item setImageAndSize:[[NSWorkspace sharedWorkspace] 
iconForFile:filePath]];
-}
-
-if ([menu numberOfItems] == 0) {
-[menu release];
-menu = nil;
-}
-
-return [menu autorelease];
-}
-
 - (void)updateContextMenu:(NSMenu *)menu {
 NSInteger row = [tableView clickedRow];
 NSInteger column = [tableView clickedColumn];

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28274] trunk/bibdesk

2023-06-01 Thread hofman--- via Bibdesk-commit
Revision: 28274
  http://sourceforge.net/p/bibdesk/svn/28274
Author:   hofman
Date: 2023-06-01 15:46:27 + (Thu, 01 Jun 2023)
Log Message:
---
Add downloads directory selected in prefs to recent downloads persistent search 
query. Let the persistent search query add it, and observe defaults to update 
it when te downloads folder changes.

Modified Paths:
--
trunk/bibdesk/BDSKEditor.m
trunk/bibdesk/BDSKPersistentSearch.h
trunk/bibdesk/BDSKPersistentSearch.m

Modified: trunk/bibdesk/BDSKEditor.m
===
--- trunk/bibdesk/BDSKEditor.m  2023-06-01 14:58:39 UTC (rev 28273)
+++ trunk/bibdesk/BDSKEditor.m  2023-06-01 15:46:27 UTC (rev 28274)
@@ -110,9 +110,6 @@
 
 #define FIELD_COLUMNID @"field"
 
-// this was copied verbatim from a Finder saved search for all items of kind 
document modified in the last week
-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 };
 
@@ -1464,14 +1461,10 @@
 
 static dispatch_once_t onceToken;
 dispatch_once(&onceToken, ^{
-// limit the scope to the default downloads directory
-NSURL *downloadURL = [[NSFileManager defaultManager] 
downloadFolderURL];
-if(downloadURL){
-[[BDSKPersistentSearch sharedSearch] addQuery:recentDownloadsQuery 
scopes:[NSArray arrayWithObject:downloadURL]];
-}
+[[BDSKPersistentSearch sharedSearch] addRecentDownloadsQuery];
 });
 
-NSArray *paths = [[BDSKPersistentSearch sharedSearch] 
resultsForQuery:recentDownloadsQuery attribute:(NSString *)kMDItemPath];
+NSArray *paths = [[BDSKPersistentSearch sharedSearch] 
resultsForQuery:[BDSKPersistentSearch recentDownloadsQuery] attribute:(NSString 
*)kMDItemPath];
 NSMenuItem *item;
 
 for (NSString *filePath in paths) {

Modified: trunk/bibdesk/BDSKPersistentSearch.h
===
--- trunk/bibdesk/BDSKPersistentSearch.h2023-06-01 14:58:39 UTC (rev 
28273)
+++ trunk/bibdesk/BDSKPersistentSearch.h2023-06-01 15:46:27 UTC (rev 
28274)
@@ -56,4 +56,8 @@
 // returns nil if no results (yet)
 - (NSArray *)resultsForQuery:(NSString *)queryString attribute:(NSString 
*)attribute;
 
++ (NSString *)recentDownloadsQuery;
+
+- (BOOL)addRecentDownloadsQuery;
+
 @end

Modified: trunk/bibdesk/BDSKPersistentSearch.m
===
--- trunk/bibdesk/BDSKPersistentSearch.m2023-06-01 14:58:39 UTC (rev 
28273)
+++ trunk/bibdesk/BDSKPersistentSearch.m2023-06-01 15:46:27 UTC (rev 
28274)
@@ -37,10 +37,17 @@
  */
 
 #import "BDSKPersistentSearch.h"
+#import "BDSKStringConstants.h"
+#import "NSFileManager_BDSKExtensions.h"
 
 static id sharedSearch = nil;
 static void *nullQueryMarker = @"Null MDQuery Marker"; /* any CFTypeRef would 
work here */
 
+// this was copied verbatim from a Finder saved search for all items of kind 
document modified in the last week
+static NSString * const recentDownloadsQuery = @"(kMDItemContentTypeTree = 
'public.content') && (kMDItemFSContentChangeDate >= $time.today(-7)) && 
(kMDItemContentType != com.apple.mail.emlx) && (kMDItemContentType != 
public.vcard)";
+
+static char BDSKPersistentSearchDefaultsObservationContext;
+
 @implementation BDSKPersistentSearch
 
 + (id)sharedSearch;
@@ -52,14 +59,26 @@
 
 - (id)init
 {
-if(self = [super init])
+if(self = [super init]) {
 queries = CFDictionaryCreateMutable(CFAllocatorGetDefault(), 0, 
&kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
-
+[[NSUserDefaultsController sharedUserDefaultsController]
+addObserver:self
+ forKeyPath:[@"values." 
stringByAppendingString:BDSKDownloadsDirectoryKey]
+options:0
+context:&BDSKPersistentSearchDefaultsObservationContext];
+}
 return self;
 }
 
 - (void)dealloc
 {
+@try {
+[[NSUserDefaultsController sharedUserDefaultsController]
+removeObserver:self
+forKeyPath:[@"values." 
stringByAppendingString:BDSKDownloadsDirectoryKey]
+   context:&BDSKPersistentSearchDefaultsObservationContext];
+}
+@catch (id e) {}
 BDSKCFDESTROY(queries);
 [super dealloc];
 }
@@ -147,4 +166,33 @@
 return results;
 }
 
++ (NSString *)recentDownloadsQuery {
+return recentDownloadsQuery;
+}
+
+- (BOOL)addRecentDownloadsQuery {
+// limit the scope to the default downloads directory and our downloads 
directory
+NSURL *downloadURL = [[NSFileManager defaultManager] downloadFolderURL];
+NSStr

[Bibdesk-commit] SF.net SVN: bibdesk:[28275] trunk/bibdesk/RelNotes.rtf

2023-06-01 Thread hofman--- via Bibdesk-commit
Revision: 28275
  http://sourceforge.net/p/bibdesk/svn/28275
Author:   hofman
Date: 2023-06-01 22:03:32 + (Thu, 01 Jun 2023)
Log Message:
---
update release notes

Modified Paths:
--
trunk/bibdesk/RelNotes.rtf

Modified: trunk/bibdesk/RelNotes.rtf
===
(Binary files differ)

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28276] trunk/bibdesk

2023-06-02 Thread hofman--- via Bibdesk-commit
Revision: 28276
  http://sourceforge.net/p/bibdesk/svn/28276
Author:   hofman
Date: 2023-06-02 09:20:20 + (Fri, 02 Jun 2023)
Log Message:
---
update version numbers for release

Modified Paths:
--
trunk/bibdesk/BibDesk.help/Contents/Resources/en.lproj/version.texi
trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj
trunk/bibdesk/Info.plist

Modified: trunk/bibdesk/BibDesk.help/Contents/Resources/en.lproj/version.texi
===
--- trunk/bibdesk/BibDesk.help/Contents/Resources/en.lproj/version.texi 
2023-06-01 22:03:32 UTC (rev 28275)
+++ trunk/bibdesk/BibDesk.help/Contents/Resources/en.lproj/version.texi 
2023-06-02 09:20:20 UTC (rev 28276)
@@ -1 +1 @@
-@set VERSION 1.8.17
\ No newline at end of file
+@set VERSION 1.8.18
\ No newline at end of file

Modified: trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj
===
--- trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj 2023-06-01 22:03:32 UTC 
(rev 28275)
+++ trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj 2023-06-02 09:20:20 UTC 
(rev 28276)
@@ -6114,7 +6114,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = CE17EE7E0E24F27400DE06EA 
/* BibDesk-App.xcconfig */;
buildSettings = {
-   CURRENT_PROJECT_VERSION = 6106;
+   CURRENT_PROJECT_VERSION = 6107;
VERSIONING_SYSTEM = "apple-generic";
};
name = Debug;
@@ -6123,7 +6123,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = CE17EE7E0E24F27400DE06EA 
/* BibDesk-App.xcconfig */;
buildSettings = {
-   CURRENT_PROJECT_VERSION = 6106;
+   CURRENT_PROJECT_VERSION = 6107;
VERSIONING_SYSTEM = "apple-generic";
};
name = Release;

Modified: trunk/bibdesk/Info.plist
===
--- trunk/bibdesk/Info.plist2023-06-01 22:03:32 UTC (rev 28275)
+++ trunk/bibdesk/Info.plist2023-06-02 09:20:20 UTC (rev 28276)
@@ -291,7 +291,7 @@
CFBundlePackageType
APPL
CFBundleShortVersionString
-   1.8.17
+   1.8.18
CFBundleSignature
BDSK
CFBundleURLTypes

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28277] tags/REL_1_8_18/

2023-06-02 Thread hofman--- via Bibdesk-commit
Revision: 28277
  http://sourceforge.net/p/bibdesk/svn/28277
Author:   hofman
Date: 2023-06-02 09:20:45 + (Fri, 02 Jun 2023)
Log Message:
---
Tag for release

Added Paths:
---
tags/REL_1_8_18/

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28278] trunk/bibdesk_vendorsrc/amaxwell/FileView/ FVFileView.m

2023-06-03 Thread hofman--- via Bibdesk-commit
Revision: 28278
  http://sourceforge.net/p/bibdesk/svn/28278
Author:   hofman
Date: 2023-06-03 13:40:03 + (Sat, 03 Jun 2023)
Log Message:
---
update drawing when dragging exits

Modified Paths:
--
trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m
===
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m  2023-06-02 
09:20:45 UTC (rev 28277)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m  2023-06-03 
13:40:03 UTC (rev 28278)
@@ -2972,6 +2972,7 @@
 _fvFlags.dropOperation = FVDropBefore;
 if (_fvFlags.needsReload)
 [self reloadIcons];
+[self setNeedsDisplay:YES];
 }
 
 // only invoked if performDragOperation returned YES

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28279] trunk/bibdesk_vendorsrc/amaxwell/FileView/ FVFileView.m

2023-06-03 Thread hofman--- via Bibdesk-commit
Revision: 28279
  http://sourceforge.net/p/bibdesk/svn/28279
Author:   hofman
Date: 2023-06-03 13:41:30 + (Sat, 03 Jun 2023)
Log Message:
---
only need to reset display when not reloading icons

Modified Paths:
--
trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m
===
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m  2023-06-03 
13:40:03 UTC (rev 28278)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m  2023-06-03 
13:41:30 UTC (rev 28279)
@@ -2972,7 +2972,8 @@
 _fvFlags.dropOperation = FVDropBefore;
 if (_fvFlags.needsReload)
 [self reloadIcons];
-[self setNeedsDisplay:YES];
+else
+[self setNeedsDisplay:YES];
 }
 
 // only invoked if performDragOperation returned YES

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28280] trunk/bibdesk_vendorsrc/amaxwell/FileView/ FVFileView.m

2023-06-03 Thread hofman--- via Bibdesk-commit
Revision: 28280
  http://sourceforge.net/p/bibdesk/svn/28280
Author:   hofman
Date: 2023-06-03 16:21:16 + (Sat, 03 Jun 2023)
Log Message:
---
fix determination of drop operation, column mode was inverted

Modified Paths:
--
trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m
===
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m  2023-06-03 
13:41:30 UTC (rev 28279)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m  2023-06-03 
16:21:16 UTC (rev 28280)
@@ -1466,7 +1466,7 @@
 start = [self _leftMargin];
 
 if (point.x <= start) {
-if (dropOp == NULL || isColumn == NO)
+if (dropOp == NULL || isColumn)
 return NO;
 if (colIndex)
 *colIndex = 0;
@@ -1477,11 +1477,11 @@
 if (point.x < (start + _iconSize.width)) {
 if (colIndex)
 *colIndex = idx;
-if (dropOp && isColumn)
+if (dropOp && isColumn == NO)
 *dropOp = FVDropOn;
 break;
 } else if (point.x <= (start + columnWidth)) {
-if (dropOp == NULL || isColumn == NO)
+if (dropOp == NULL || isColumn)
 return NO;
 if (colIndex)
 *colIndex = idx;
@@ -1497,7 +1497,7 @@
 start = [self _topMargin];
 
 if (point.y <= start) {
-if (dropOp == NULL || isColumn)
+if (dropOp == NULL || isColumn == NO)
 return NO;
 if (rowIndex)
 *rowIndex = 0;
@@ -1509,11 +1509,11 @@
 if (point.y < (start + _iconSize.height)) {
 if (rowIndex)
 *rowIndex = idx;
-if (dropOp && isColumn == NO)
+if (dropOp && isColumn)
 *dropOp = FVDropOn;
 break;
 } else if (point.y <= (start + rowHeight)) {
-if (dropOp == NULL || isColumn)
+if (dropOp == NULL || isColumn == NO)
 return NO;
 if (rowIndex)
 *rowIndex = idx;

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28281] trunk/bibdesk/BDSKCondition.m

2023-06-04 Thread hofman--- via Bibdesk-commit
Revision: 28281
  http://sourceforge.net/p/bibdesk/svn/28281
Author:   hofman
Date: 2023-06-04 14:37:51 + (Sun, 04 Jun 2023)
Log Message:
---
use the correct comparison variable

Modified Paths:
--
trunk/bibdesk/BDSKCondition.m

Modified: trunk/bibdesk/BDSKCondition.m
===
--- trunk/bibdesk/BDSKCondition.m   2023-06-03 16:21:16 UTC (rev 28280)
+++ trunk/bibdesk/BDSKCondition.m   2023-06-04 14:37:51 UTC (rev 28281)
@@ -256,7 +256,7 @@
 options |= kCFCompareBackwards | kCFCompareAnchored;
 else if (attachmentComparison == BDSKAttachmentStartWith)
 options |= kCFCompareAnchored;
-BOOL matchReturnValue = (stringComparison != BDSKAttachmentNotContain);
+BOOL matchReturnValue = (attachmentComparison != 
BDSKAttachmentNotContain);
 CFRange range;
 
 for (NSString *itemValue in itemValues) {

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28282] trunk/bibdesk/BDSKMacroWindowController.m

2023-06-04 Thread hofman--- via Bibdesk-commit
Revision: 28282
  http://sourceforge.net/p/bibdesk/svn/28282
Author:   hofman
Date: 2023-06-04 14:53:19 + (Sun, 04 Jun 2023)
Log Message:
---
register macro table for dragging destination

Modified Paths:
--
trunk/bibdesk/BDSKMacroWindowController.m

Modified: trunk/bibdesk/BDSKMacroWindowController.m
===
--- trunk/bibdesk/BDSKMacroWindowController.m   2023-06-04 14:37:51 UTC (rev 
28281)
+++ trunk/bibdesk/BDSKMacroWindowController.m   2023-06-04 14:53:19 UTC (rev 
28282)
@@ -146,6 +146,9 @@
 [tableView setDraggingSourceOperationMask:NSDragOperationCopy 
forLocal:YES];
 [tableView setDraggingSourceOperationMask:NSDragOperationCopy forLocal:NO];
 
+if (isEditable)
+[tableView registerForDraggedTypes:[NSArray 
arrayWithObjects:NSPasteboardTypeString, (NSString *)kUTTypeURL, (NSString 
*)kUTTypeFileURL, NSURLPboardType, NSFilenamesPboardType, nil]];
+
 BDSKTypeSelectHelper *aTypeSelectHelper = [[BDSKTypeSelectHelper alloc] 
init];
 [aTypeSelectHelper setCyclesSimilarResults:YES];
 [aTypeSelectHelper setMatchesPrefix:NO];

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28283] trunk/bibdesk/BDSKDOIParser.m

2023-06-04 Thread hofman--- via Bibdesk-commit
Revision: 28283
  http://sourceforge.net/p/bibdesk/svn/28283
Author:   hofman
Date: 2023-06-04 16:01:41 + (Sun, 04 Jun 2023)
Log Message:
---
check whether returned data for DOI parser is bibtex, it may return a not found 
HTML page instead

Modified Paths:
--
trunk/bibdesk/BDSKDOIParser.m

Modified: trunk/bibdesk/BDSKDOIParser.m
===
--- trunk/bibdesk/BDSKDOIParser.m   2023-06-04 14:53:19 UTC (rev 28282)
+++ trunk/bibdesk/BDSKDOIParser.m   2023-06-04 16:01:41 UTC (rev 28283)
@@ -88,7 +88,7 @@
 if (encoding == kCFStringEncodingInvalidId)
 encoding = NSUTF8StringEncoding;
 bibtexString = NSString alloc] initWithData:data 
encoding:encoding] autorelease] stringByRemovingSurroundingWhitespace];
-if (bibtexString) {
+if (bibtexString && [BDSKBibTeXParser canParseString:bibtexString]) {
 NSError *error = nil;
 item = [[BDSKBibTeXParser itemsFromString:bibtexString owner:owner 
error:&error] firstObject];
 if ([error isLocalErrorWithCode:kBDSKBibTeXParserFailed])

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28284] trunk/bibdesk/BibItem.m

2023-06-04 Thread hofman--- via Bibdesk-commit
Revision: 28284
  http://sourceforge.net/p/bibdesk/svn/28284
Author:   hofman
Date: 2023-06-04 17:17:41 + (Sun, 04 Jun 2023)
Log Message:
---
Don't remove leading 0 from tail of DOI

Modified Paths:
--
trunk/bibdesk/BibItem.m

Modified: trunk/bibdesk/BibItem.m
===
--- trunk/bibdesk/BibItem.m 2023-06-04 16:01:41 UTC (rev 28283)
+++ trunk/bibdesk/BibItem.m 2023-06-04 17:17:41 UTC (rev 28284)
@@ -3873,12 +3873,13 @@
 static inline NSArray *extractAllDOIsFromString(NSString *string) {
 NSMutableArray *dois = [NSMutableArray array];
 // here is another exampled of a doi regex = 
10\.[0-9]+\/[a-z0-9\.\-\+\/\(\)]+;
-AGRegex *doiRegex = [AGRegex 
regexWithPattern:@"doi[:\\s/]{1,2}(10\\.[0-9]{4,}(?:\\.[0-9]+)*)[\\s/0]{1,3}(\\S+)"
+AGRegex *doiRegex = [AGRegex 
regexWithPattern:@"doi[:\\s/]{1,2}(10\\.[0-9]{4,}(?:\\.[0-9]+)*)[\\s/]{1,3}(\\S+)"
   
options:AGRegexMultiline|AGRegexCaseInsensitive];
 AGRegexMatch *match;
 for (match in [doiRegex findEnumeratorInString:string]) {
 if ([match groupAtIndex:1] != nil && [match groupAtIndex:2] != nil)
 [dois addObject:[NSString stringWithFormat:@"%@/%@", [match 
groupAtIndex:1], [match groupAtIndex:2]]];
+NSLog(@"%@ %@",[match groupAtIndex:1],[match groupAtIndex:2]);
 }
 return dois;
 }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28285] trunk/bibdesk/BDSKDOIWebParser.m

2023-06-04 Thread hofman--- via Bibdesk-commit
Revision: 28285
  http://sourceforge.net/p/bibdesk/svn/28285
Author:   hofman
Date: 2023-06-04 21:01:23 + (Sun, 04 Jun 2023)
Log Message:
---
don't try to parse html error page as bibtex for doi web parser

Modified Paths:
--
trunk/bibdesk/BDSKDOIWebParser.m

Modified: trunk/bibdesk/BDSKDOIWebParser.m
===
--- trunk/bibdesk/BDSKDOIWebParser.m2023-06-04 17:17:41 UTC (rev 28284)
+++ trunk/bibdesk/BDSKDOIWebParser.m2023-06-04 21:01:23 UTC (rev 28285)
@@ -124,7 +124,10 @@
 }
 
 - (NSString *)bibTeXStringFromDownload:(BDSKCitationDownload *)download {
-return [[download string] stringByRemovingSurroundingWhitespace];
+NSString *bibtexString = [[download string] 
stringByRemovingSurroundingWhitespace];
+if ([bibtexString hasCaseInsensitivePrefix:@"https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28286] trunk/bibdesk/BDSKMainTableView.m

2023-06-04 Thread hofman--- via Bibdesk-commit
Revision: 28286
  http://sourceforge.net/p/bibdesk/svn/28286
Author:   hofman
Date: 2023-06-04 21:20:17 + (Sun, 04 Jun 2023)
Log Message:
---
remove method used by cell based tableview

Modified Paths:
--
trunk/bibdesk/BDSKMainTableView.m

Modified: trunk/bibdesk/BDSKMainTableView.m
===
--- trunk/bibdesk/BDSKMainTableView.m   2023-06-04 21:01:23 UTC (rev 28285)
+++ trunk/bibdesk/BDSKMainTableView.m   2023-06-04 21:20:17 UTC (rev 28286)
@@ -143,32 +143,6 @@
 NSBeep();
 }
 
-- (void)drawRow:(NSInteger)row clipRect:(NSRect)clipRect {
-if ([[self delegate] 
respondsToSelector:@selector(tableView:highlightColorForRow:)]) {
-NSColor *color = [[self delegate] tableView:self 
highlightColorForRow:row];
-if (color) {
-NSRect rect;
-if (RUNNING_AFTER(10_15))
-rect = NSInsetRect([self rectOfRow:row], 13.0, 1.0);
-else
-rect = BDSKShrinkRect(BDSKShrinkRect([self rectOfRow:row], 
2.0, NSMaxYEdge), 1.0, NSMinYEdge);
-if (NSIntersectsRect(clipRect, rect)) {
-[NSGraphicsContext saveGraphicsState];
-[color set];
-if ([self isRowSelected:row]) {
-[NSBezierPath setDefaultLineWidth:2.0];
-[NSBezierPath strokeHorizontalOvalInRect:NSInsetRect(rect, 
1.0, 1.0)];
-[NSBezierPath setDefaultLineWidth:1.0];
-} else {
-[NSBezierPath fillHorizontalOvalInRect:rect];
-}
-[NSGraphicsContext restoreGraphicsState];
-}
-}
-}
-[super drawRow:row clipRect:clipRect];
-}
-
 #pragma mark Alternating row color
 
 - (void)setAlternatingRowBackgroundColors:(NSArray *)colorArray{

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28287] trunk/bibdesk/NSTableView_BDSKExtensions.m

2023-06-04 Thread hofman--- via Bibdesk-commit
Revision: 28287
  http://sourceforge.net/p/bibdesk/svn/28287
Author:   hofman
Date: 2023-06-04 21:44:01 + (Sun, 04 Jun 2023)
Log Message:
---
remove unused declaration

Modified Paths:
--
trunk/bibdesk/NSTableView_BDSKExtensions.m

Modified: trunk/bibdesk/NSTableView_BDSKExtensions.m
===
--- trunk/bibdesk/NSTableView_BDSKExtensions.m  2023-06-04 21:20:17 UTC (rev 
28286)
+++ trunk/bibdesk/NSTableView_BDSKExtensions.m  2023-06-04 21:44:01 UTC (rev 
28287)
@@ -41,10 +41,6 @@
 #import "BDSKRuntime.h"
 
 
-@interface NSTableView (BDSApplePrivate)
--(void)_drawDropHighlightOnRow:(NSInteger)rowIndex;
-@end
-
 @implementation NSTableView (BDSKExtensions)
 
 static BOOL (*original_validateUserInterfaceItem)(id, SEL, id) = NULL;

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28288] trunk/bibdesk

2023-06-05 Thread hofman--- via Bibdesk-commit
Revision: 28288
  http://sourceforge.net/p/bibdesk/svn/28288
Author:   hofman
Date: 2023-06-05 08:40:36 + (Mon, 05 Jun 2023)
Log Message:
---
check for returned error html in generic web poarser class

Modified Paths:
--
trunk/bibdesk/BDSKACMDLParser.m
trunk/bibdesk/BDSKAsynchronousWebParser.m
trunk/bibdesk/BDSKDOIWebParser.m
trunk/bibdesk/BDSKMASParser.m

Modified: trunk/bibdesk/BDSKACMDLParser.m
===
--- trunk/bibdesk/BDSKACMDLParser.m 2023-06-04 21:44:01 UTC (rev 28287)
+++ trunk/bibdesk/BDSKACMDLParser.m 2023-06-05 08:40:36 UTC (rev 28288)
@@ -93,10 +93,6 @@
 return nil;
 }
 
-- (NSString *)bibTeXStringFromDownload:(BDSKCitationDownload *)download {
-return [[download string] stringByRemovingSurroundingWhitespace];
-}
-
 - (NSArray *)itemsFromDownload:(BDSKCitationDownload *)download error:(NSError 
**)outError {
 NSArray *items = [super itemsFromDownload:download error:outError];
 

Modified: trunk/bibdesk/BDSKAsynchronousWebParser.m
===
--- trunk/bibdesk/BDSKAsynchronousWebParser.m   2023-06-04 21:44:01 UTC (rev 
28287)
+++ trunk/bibdesk/BDSKAsynchronousWebParser.m   2023-06-05 08:40:36 UTC (rev 
28288)
@@ -40,6 +40,7 @@
 #import "BibItem.h"
 #import "DOMNode_BDSKExtensions.h"
 #import "NSURL_BDSKExtensions.h"
+#import "NSString_BDSKExtensions.h"
 #import "BDSKDownloader.h"
 
 
@@ -162,7 +163,10 @@
 }
 
 - (NSString *)bibTeXStringFromDownload:(BDSKCitationDownload *)download {
-return [download string];
+NSString *bibtexString = [download string];
+if ([bibtexString hasCaseInsensitivePrefix:@"https://www.doi.org/";; }

Modified: trunk/bibdesk/BDSKMASParser.m
===
--- trunk/bibdesk/BDSKMASParser.m   2023-06-04 21:44:01 UTC (rev 28287)
+++ trunk/bibdesk/BDSKMASParser.m   2023-06-05 08:40:36 UTC (rev 28288)
@@ -62,7 +62,7 @@
 }
 
 - (NSString *)bibTeXStringFromDownload:(BDSKCitationDownload *)download {
-return [[download string] stringWithPhoneyCiteKeys:[BibItem 
defaultCiteKey]];
+return [[super bibTeXStringFromDownload:download] 
stringWithPhoneyCiteKeys:[BibItem defaultCiteKey]];
 }
 
 + (NSString *)name { return @"MAS"; }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28289] trunk/bibdesk/BibItem.m

2023-06-05 Thread hofman--- via Bibdesk-commit
Revision: 28289
  http://sourceforge.net/p/bibdesk/svn/28289
Author:   hofman
Date: 2023-06-05 09:22:52 + (Mon, 05 Jun 2023)
Log Message:
---
remove log, rewrite loop condition

Modified Paths:
--
trunk/bibdesk/BibItem.m

Modified: trunk/bibdesk/BibItem.m
===
--- trunk/bibdesk/BibItem.m 2023-06-05 08:40:36 UTC (rev 28288)
+++ trunk/bibdesk/BibItem.m 2023-06-05 09:22:52 UTC (rev 28289)
@@ -3879,7 +3879,6 @@
 for (match in [doiRegex findEnumeratorInString:string]) {
 if ([match groupAtIndex:1] != nil && [match groupAtIndex:2] != nil)
 [dois addObject:[NSString stringWithFormat:@"%@/%@", [match 
groupAtIndex:1], [match groupAtIndex:2]]];
-NSLog(@"%@ %@",[match groupAtIndex:1],[match groupAtIndex:2]);
 }
 return dois;
 }
@@ -3976,8 +3975,8 @@
 
 if (bi == nil) {
 // ... else directly parse text of first two pages for doi
-NSUInteger i = 0;
-for (; bi == nil && i < 2 && i < [pdfDoc pageCount]; i++) {
+NSUInteger i;
+for (i = 0; bi == nil && i < MIN(2, [pdfDoc pageCount]); i++) {
 
 NSString *pageText = [[pdfDoc pageAtIndex:i] string];
 // If we've got nothing to parse, try the next page

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28290] trunk/bibdesk_vendorsrc/amaxwell/FileView/ FVFileView.m

2023-06-05 Thread hofman--- via Bibdesk-commit
Revision: 28290
  http://sourceforge.net/p/bibdesk/svn/28290
Author:   hofman
Date: 2023-06-05 16:07:26 + (Mon, 05 Jun 2023)
Log Message:
---
add tooltips for titles, include subtitle if supported

Modified Paths:
--
trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m
===
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m  2023-06-05 
09:22:52 UTC (rev 28289)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m  2023-06-05 
16:07:26 UTC (rev 28290)
@@ -1628,16 +1628,18 @@
 NSPoint mouseLoc = [self convertPoint:[[self window] 
mouseLocationOutsideOfEventStream] fromView:nil];
 NSUInteger mouseIndex = NSNotFound;
 NSTrackingAreaOptions options = NSTrackingMouseEnteredAndExited | 
NSTrackingActiveInActiveApp;
+CGFloat textHeight = [self _textHeight];
 
 for (r = rMin, i = iMin; r < rMax; r++) 
 {
 for (c = cMin; c < cMax && i < iMax; c++, i++) 
 {
-NSRect iconRect = NSIntersectionRect(visibleRect, [self 
_rectOfIconInRow:r column:c]);
+NSRect iconRect = [self _rectOfIconInRow:r column:c];
+NSRect rect = NSIntersectionRect(visibleRect, iconRect);
 
-if (NSIsEmptyRect(iconRect) == NO) {
+if (NSIsEmptyRect(rect) == NO) {
 // Finder doesn't show buttons unless it's the front app.  
If Finder is the front app, it shows them for any window, regardless of 
main/key state, so we'll do the same.
-BOOL mouseInside = NSPointInRect(mouseLoc, iconRect);
+BOOL mouseInside = NSPointInRect(mouseLoc, rect);
 
 if (mouseInside) {
 mouseIndex = i;
@@ -1646,14 +1648,20 @@
 options &= ~NSTrackingAssumeInside;
 }
 
-NSTrackingArea *area = [[NSTrackingArea alloc] 
initWithRect:iconRect options:options owner:self userInfo:nil];
+NSTrackingArea *area = [[NSTrackingArea alloc] 
initWithRect:rect options:options owner:self userInfo:nil];
 [self addTrackingArea:area];
 [_trackingAreas addObject:area];
 [area release];
 
 // don't pass the URL as owner, as it's not retained; use 
the delegate method instead
-[self addToolTipRect:iconRect owner:self userData:NULL];
+[self addToolTipRect:rect owner:self userData:NULL];
 }
+
+rect = NSIntersectionRect(visibleRect, 
NSMakeRect(NSMinX(iconRect), NSMaxY(iconRect) + TEXT_OFFSET, NSWidth(iconRect), 
textHeight));
+
+if (NSIsEmptyRect(rect) == NO) {
+[self addToolTipRect:rect owner:self userData:(void *)1];
+}
 }
 }
 
@@ -3292,6 +3300,12 @@
 
 - (NSString *)view:(NSView *)view stringForToolTip:(NSToolTipTag)tag 
point:(NSPoint)point userData:(void *)userData
 {
+BOOL isTitle = (userData == (void *)1);
+if (isTitle) {
+// shift the point for title toool tips so it falls within its icon 
rect
+point.y -= TEXT_OFFSET + [self _textHeight];
+}
+
 NSURL *theURL = [self _URLAtPoint:point];
 NSString *name = nil;
 if ([theURL isFileURL]) {
@@ -3301,6 +3315,14 @@
 } else {
 name = [[theURL absoluteString] 
stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
 }
+if (isTitle && [_dataSource 
respondsToSelector:@selector(fileView:subtitleAtIndex:)]) {
+NSUInteger i = [self _indexAtPoint:point dropOperation:NULL];
+if (i != NSNotFound) {
+NSString *subtitle = [self subtitleAtIndex:i];
+if (subtitle)
+name = [name stringByAppendingFormat:@"\n%@", subtitle];
+}
+}
 return name;
 }
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28291] trunk/bibdesk_vendorsrc/amaxwell/FileView/ FVFileView.m

2023-06-06 Thread hofman--- via Bibdesk-commit
Revision: 28291
  http://sourceforge.net/p/bibdesk/svn/28291
Author:   hofman
Date: 2023-06-06 14:16:14 + (Tue, 06 Jun 2023)
Log Message:
---
check for NULL rather than 1 in userData

Modified Paths:
--
trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m
===
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m  2023-06-05 
16:07:26 UTC (rev 28290)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m  2023-06-06 
14:16:14 UTC (rev 28291)
@@ -3300,7 +3300,7 @@
 
 - (NSString *)view:(NSView *)view stringForToolTip:(NSToolTipTag)tag 
point:(NSPoint)point userData:(void *)userData
 {
-BOOL isTitle = (userData == (void *)1);
+BOOL isTitle = (userData != NULL);
 if (isTitle) {
 // shift the point for title toool tips so it falls within its icon 
rect
 point.y -= TEXT_OFFSET + [self _textHeight];

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28292] trunk/bibdesk_vendorsrc/amaxwell/FileView/ FVFileView.m

2023-06-06 Thread hofman--- via Bibdesk-commit
Revision: 28292
  http://sourceforge.net/p/bibdesk/svn/28292
Author:   hofman
Date: 2023-06-06 14:32:56 + (Tue, 06 Jun 2023)
Log Message:
---
simplify calculation

Modified Paths:
--
trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m
===
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m  2023-06-06 
14:16:14 UTC (rev 28291)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m  2023-06-06 
14:32:56 UTC (rev 28292)
@@ -2329,12 +2329,12 @@
 bounds.origin.y += [self _topMargin];
 
 rmin = (NSMinY(aRect) - NSMinY(bounds)) / [self _rowHeight];
-rmax = (NSMinY(aRect) - NSMinY(bounds)) / [self _rowHeight] + 
NSHeight(aRect) / [self _rowHeight];
+rmax = (NSMaxY(aRect) - NSMinY(bounds)) / [self _rowHeight];
 // add 1 to account for integer truncation
 rmax = MIN(rmax + 1, [self numberOfRows]);
 
 cmin = (NSMinX(aRect) - NSMinX(bounds)) / [self _columnWidth];
-cmax = (NSMinX(aRect) - NSMinX(bounds)) / [self _columnWidth] + 
NSWidth(aRect) / [self _columnWidth];
+cmax = (NSMaxX(aRect) - NSMinX(bounds)) / [self _columnWidth];
 // add 1 to account for integer truncation
 cmax = MIN(cmax + 1, [self numberOfColumns]);
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28293] trunk/bibdesk_vendorsrc/amaxwell/FileView/ FVFileView.m

2023-06-06 Thread hofman--- via Bibdesk-commit
Revision: 28293
  http://sourceforge.net/p/bibdesk/svn/28293
Author:   hofman
Date: 2023-06-06 15:52:51 + (Tue, 06 Jun 2023)
Log Message:
---
outset of text labels was too much, NSTextFieldCell has margin 2

Modified Paths:
--
trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m
===
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m  2023-06-06 
14:32:56 UTC (rev 28292)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m  2023-06-06 
15:52:51 UTC (rev 28293)
@@ -2517,7 +2517,7 @@
 if ((FVDrawText & drawOption)) {
 CGContextSaveGState(cgContext);
 
-textRect = [self centerScanRect:NSInsetRect(textRect, 
-4.0, 0.0)];
+textRect = [self centerScanRect:NSInsetRect(textRect, 
-2.0, 0.0)];
 
 NSString *name, *subtitle = [self subtitleAtIndex:i];
 NSUInteger label;
@@ -2526,7 +2526,7 @@
 
 [_titleCell setStringValue:name ?: @""];
 if (label > 0) {
-NSRect labelRect = [self 
centerScanRect:NSInsetRect(textRect, 4.0, 0.0)];
+NSRect labelRect = [self 
centerScanRect:NSInsetRect(textRect, 2.0, 0.0)];
 
 labelRect.size.height = titleHeight;
 [FVFinderLabel drawFinderLabelHighlight:label 
inRect:labelRect];
@@ -2535,7 +2535,7 @@
 // @@ Dark mode
 NSColor *titleColor = [[_titleCell textColor] 
retain];
 [_titleCell setTextColor:[NSColor 
controlTextColor]];
-[_titleCell drawWithFrame:NSInsetRect(textRect, 
titleHeight / 2.0 , 0) inView:self];
+[_titleCell drawWithFrame:NSInsetRect(textRect, 
titleHeight / 2.0, 0.0) inView:self];
 [_titleCell setTextColor:titleColor];
 [titleColor release];
 }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28294] trunk/bibdesk_vendorsrc/amaxwell/FileView/ FVFileView.m

2023-06-06 Thread hofman--- via Bibdesk-commit
Revision: 28294
  http://sourceforge.net/p/bibdesk/svn/28294
Author:   hofman
Date: 2023-06-06 15:55:25 + (Tue, 06 Jun 2023)
Log Message:
---
reduce debug grid by text margins

Modified Paths:
--
trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m
===
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m  2023-06-06 
15:52:51 UTC (rev 28293)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m  2023-06-06 
15:55:25 UTC (rev 28294)
@@ -2558,7 +2558,7 @@
 [[NSColor redColor] setFill];
 else
 [[NSColor greenColor] setFill];
-NSFrameRect(NSUnionRect(NSInsetRect(fileRect, -2.0 * [self 
iconScale], 0), textRect));
+NSFrameRect(NSUnionRect(NSInsetRect(fileRect, -shadowBlur, 0), 
NSInsetRect(textRect, 2.0, 0.0)));
 [NSGraphicsContext restoreGraphicsState];
 #endif
 }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28295] trunk/bibdesk_vendorsrc/amaxwell/FileView/ FVFileView.m

2023-06-06 Thread hofman--- via Bibdesk-commit
Revision: 28295
  http://sourceforge.net/p/bibdesk/svn/28295
Author:   hofman
Date: 2023-06-06 16:43:50 + (Tue, 06 Jun 2023)
Log Message:
---
use 0.0

Modified Paths:
--
trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m
===
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m  2023-06-06 
15:55:25 UTC (rev 28294)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m  2023-06-06 
16:43:50 UTC (rev 28295)
@@ -2558,7 +2558,7 @@
 [[NSColor redColor] setFill];
 else
 [[NSColor greenColor] setFill];
-NSFrameRect(NSUnionRect(NSInsetRect(fileRect, -shadowBlur, 0), 
NSInsetRect(textRect, 2.0, 0.0)));
+NSFrameRect(NSUnionRect(NSInsetRect(fileRect, -shadowBlur, 
0.0), NSInsetRect(textRect, 2.0, 0.0)));
 [NSGraphicsContext restoreGraphicsState];
 #endif
 }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28296] trunk/bibdesk_vendorsrc/amaxwell/FileView/ FVFileView.m

2023-06-06 Thread hofman--- via Bibdesk-commit
Revision: 28296
  http://sourceforge.net/p/bibdesk/svn/28296
Author:   hofman
Date: 2023-06-06 17:09:54 + (Tue, 06 Jun 2023)
Log Message:
---
check for icon index rather than URL when we don't use the URL

Modified Paths:
--
trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m
===
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m  2023-06-06 
16:43:50 UTC (rev 28295)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m  2023-06-06 
17:09:54 UTC (rev 28296)
@@ -2558,7 +2558,7 @@
 [[NSColor redColor] setFill];
 else
 [[NSColor greenColor] setFill];
-NSFrameRect(NSUnionRect(NSInsetRect(fileRect, -shadowBlur, 
0.0), NSInsetRect(textRect, 2.0, 0.0)));
+NSFrameRect(NSUnionRect(NSInsetRect(fileRect, -shadowBlur, 
0.0), NSInsetRect(textRect, 2.0, 0.0)));
 [NSGraphicsContext restoreGraphicsState];
 #endif
 }
@@ -3329,12 +3329,12 @@
 // this method and shouldDelayWindowOrderingForEvent: are overriden to allow 
dragging from the view without making our window key
 - (BOOL)acceptsFirstMouse:(NSEvent *)event
 {
-return ([self _URLAtPoint:[self convertPoint:[event locationInWindow] 
fromView:nil]] != nil);
+return ([self _indexAtPoint:[self convertPoint:[event locationInWindow] 
fromView:nil] dropOperation:NULL] != NSNotFound);
 }
 
 - (BOOL)shouldDelayWindowOrderingForEvent:(NSEvent *)event
 {
-return ([self _URLAtPoint:[self convertPoint:[event locationInWindow] 
fromView:nil]] != nil);
+return ([self _indexAtPoint:[self convertPoint:[event locationInWindow] 
fromView:nil] dropOperation:NULL] != NSNotFound);
 }
 
 - (void)keyDown:(NSEvent *)event
@@ -3441,7 +3441,7 @@
 _lastClickedIndex = i;
 
 // change selection first, as Finder does
-if ([event clickCount] > 1 && [self _URLAtPoint:p] != nil) {
+if ([event clickCount] > 1 && i != NSNotFound) {
 if (flags & NSAlternateKeyMask) {
 [self _previewURL:[self _URLAtPoint:p] forIconInRect:[self 
_rectOfIconInRow:r column:c]];
 } else {

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28297] trunk/bibdesk_vendorsrc/amaxwell/FileView/ FVFileView.m

2023-06-06 Thread hofman--- via Bibdesk-commit
Revision: 28297
  http://sourceforge.net/p/bibdesk/svn/28297
Author:   hofman
Date: 2023-06-06 21:25:31 + (Tue, 06 Jun 2023)
Log Message:
---
Pass icon index as userData for tooltiprect

Modified Paths:
--
trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m
===
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m  2023-06-06 
17:09:54 UTC (rev 28296)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m  2023-06-06 
21:25:31 UTC (rev 28297)
@@ -1628,7 +1628,6 @@
 NSPoint mouseLoc = [self convertPoint:[[self window] 
mouseLocationOutsideOfEventStream] fromView:nil];
 NSUInteger mouseIndex = NSNotFound;
 NSTrackingAreaOptions options = NSTrackingMouseEnteredAndExited | 
NSTrackingActiveInActiveApp;
-CGFloat textHeight = [self _textHeight];
 
 for (r = rMin, i = iMin; r < rMax; r++) 
 {
@@ -1654,13 +1653,13 @@
 [area release];
 
 // don't pass the URL as owner, as it's not retained; use 
the delegate method instead
-[self addToolTipRect:rect owner:self userData:NULL];
+[self addToolTipRect:rect owner:self userData:(void *)i];
 }
 
-rect = NSIntersectionRect(visibleRect, 
NSMakeRect(NSMinX(iconRect), NSMaxY(iconRect) + TEXT_OFFSET, NSWidth(iconRect), 
textHeight));
+rect = NSIntersectionRect(visibleRect, [self 
_rectOfTextForIconRect:iconRect]);
 
 if (NSIsEmptyRect(rect) == NO) {
-[self addToolTipRect:rect owner:self userData:(void *)1];
+[self addToolTipRect:rect owner:self userData:(void *)(i + 
iMax)];
 }
 }
 }
@@ -3300,13 +3299,14 @@
 
 - (NSString *)view:(NSView *)view stringForToolTip:(NSToolTipTag)tag 
point:(NSPoint)point userData:(void *)userData
 {
-BOOL isTitle = (userData != NULL);
-if (isTitle) {
-// shift the point for title toool tips so it falls within its icon 
rect
-point.y -= TEXT_OFFSET + [self _textHeight];
+NSUInteger i = (NSUInteger)userData;
+BOOL isTitle = NO;
+if (i >= [self numberOfIcons]) {
+i = i % [self numberOfIcons];
+isTitle = YES;
 }
 
-NSURL *theURL = [self _URLAtPoint:point];
+NSURL *theURL = [self URLAtIndex:i];
 NSString *name = nil;
 if ([theURL isFileURL]) {
 [theURL getResourceValue:&name forKey:NSURLLocalizedNameKey 
error:NULL];
@@ -3316,12 +3316,9 @@
 name = [[theURL absoluteString] 
stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
 }
 if (isTitle && [_dataSource 
respondsToSelector:@selector(fileView:subtitleAtIndex:)]) {
-NSUInteger i = [self _indexAtPoint:point dropOperation:NULL];
-if (i != NSNotFound) {
-NSString *subtitle = [self subtitleAtIndex:i];
-if (subtitle)
-name = [name stringByAppendingFormat:@"\n%@", subtitle];
-}
+NSString *subtitle = [self subtitleAtIndex:i];
+if (subtitle)
+name = [name stringByAppendingFormat:@"\n%@", subtitle];
 }
 return name;
 }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28298] trunk/bibdesk_vendorsrc/amaxwell/FileView/ FVFileView.m

2023-06-06 Thread hofman--- via Bibdesk-commit
Revision: 28298
  http://sourceforge.net/p/bibdesk/svn/28298
Author:   hofman
Date: 2023-06-06 21:33:58 + (Tue, 06 Jun 2023)
Log Message:
---
Track icon indexes rather than URLs from point

Modified Paths:
--
trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m
===
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m  2023-06-06 
21:25:31 UTC (rev 28297)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m  2023-06-06 
21:33:58 UTC (rev 28298)
@@ -3279,12 +3279,6 @@
 [self _hideArrows];
 }
 
-- (NSURL *)_URLAtPoint:(NSPoint)point;
-{
-NSUInteger anIndex = [self _indexAtPoint:point dropOperation:NULL];
-return NSNotFound == anIndex ? nil : [self URLAtIndex:anIndex];
-}
-
 - (void)_openURLs:(NSArray *)URLs
 {
 NSEnumerator *e = [URLs objectEnumerator];
@@ -3440,7 +3434,7 @@
 // change selection first, as Finder does
 if ([event clickCount] > 1 && i != NSNotFound) {
 if (flags & NSAlternateKeyMask) {
-[self _previewURL:[self _URLAtPoint:p] forIconInRect:[self 
_rectOfIconInRow:r column:c]];
+[self _previewURL:[self URLAtIndex:i] forIconInRect:[self 
_rectOfIconInRow:r column:c]];
 } else {
 [self openSelectedURLs:self];
 }
@@ -3523,34 +3517,31 @@
 // in mouseDragged:, we're either tracking an arrow button, drawing a 
rubber band selection, or initiating a drag
 
 NSPoint p = [self convertPoint:[event locationInWindow] fromView:nil];
-NSURL *pointURL = [self _URLAtPoint:p];
+NSUInteger i = [self _indexAtPoint:p dropOperation:NULL];
 
 // _fvFlags.isMouseDown tells us if the mouseDown: event originated in 
this view; if not, just ignore it
 
-if (NSEqualRects(_rubberBandRect, NSZeroRect) && nil != pointURL && 
_fvFlags.isMouseDown) {
+if (NSEqualRects(_rubberBandRect, NSZeroRect) && NSNotFound != i && 
_fvFlags.isMouseDown) {
 // No previous rubber band selection, so check to see if we're 
dragging an icon at this point.
 // The condition is also false when we're getting a repeated call to 
mouseDragged: for rubber band drawing.
 
-NSArray *selectedURLs = nil;
+NSIndexSet *selectionIndexes = nil;
 
 // we may have a selection based on a previous rubber band, but only 
use that if we dragged one of the icons in it
-selectedURLs = [self _selectedURLs];
-if ([selectedURLs containsObject:pointURL] == NO) {
-selectedURLs = nil;
+selectionIndexes = [self selectionIndexes];
+if ([selectionIndexes containsIndex:i] == NO) {
+selectionIndexes = nil;
 [self _setSelectionIndexes:[NSIndexSet indexSet]];
 }
 
 // not using a rubber band, so select and use the clicked URL if 
available (mouseDown: should have already done this)
-if (0 == [selectedURLs count] && nil != pointURL) {
-NSUInteger i = [self _indexAtPoint:p dropOperation:NULL];
-if (i != NSNotFound) {
-selectedURLs = [NSArray arrayWithObject:pointURL];
-[self _setSelectionIndexes:[NSIndexSet indexSetWithIndex:i]];
-}
+if (0 == [selectionIndexes count] && NSNotFound != i) {
+selectionIndexes = [NSIndexSet indexSetWithIndex:i];
+[self _setSelectionIndexes:selectionIndexes];
 }
 
 // if we have anything to drag, start a drag session
-if ([selectedURLs count]) {
+if ([selectionIndexes count]) {
 
 // add all URLs (file and other schemes)
 // Finder will create weblocs for us unless schemes are mixed 
(gives a stupid file busy error message)

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28299] trunk/bibdesk_vendorsrc/amaxwell/FileView/ FVFileView.m

2023-06-06 Thread hofman--- via Bibdesk-commit
Revision: 28299
  http://sourceforge.net/p/bibdesk/svn/28299
Author:   hofman
Date: 2023-06-06 22:23:25 + (Tue, 06 Jun 2023)
Log Message:
---
don't try to preview missing file

Modified Paths:
--
trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m
===
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m  2023-06-06 
21:33:58 UTC (rev 28298)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m  2023-06-06 
22:23:25 UTC (rev 28299)
@@ -3434,7 +3434,9 @@
 // change selection first, as Finder does
 if ([event clickCount] > 1 && i != NSNotFound) {
 if (flags & NSAlternateKeyMask) {
-[self _previewURL:[self URLAtIndex:i] forIconInRect:[self 
_rectOfIconInRow:r column:c]];
+NSURL *aURL = [self URLAtIndex:i];
+if (aURL && NO == [aURL isEqual:[FVIcon missingFileURL]])
+[self _previewURL:aURL forIconInRect:[self 
_rectOfIconInRow:r column:c]];
 } else {
 [self openSelectedURLs:self];
 }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28300] trunk/bibdesk_vendorsrc/amaxwell/FileView

2023-06-07 Thread hofman--- via Bibdesk-commit
Revision: 28300
  http://sourceforge.net/p/bibdesk/svn/28300
Author:   hofman
Date: 2023-06-07 09:34:23 + (Wed, 07 Jun 2023)
Log Message:
---
no need for progress indicator in file view to be an NSCell subclass, we don't 
use any method from NSCell

Modified Paths:
--
trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m
trunk/bibdesk_vendorsrc/amaxwell/FileView/FVProgressIndicatorCell.h
trunk/bibdesk_vendorsrc/amaxwell/FileView/FVProgressIndicatorCell.m

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m
===
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m  2023-06-06 
22:23:25 UTC (rev 28299)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m  2023-06-07 
09:34:23 UTC (rev 28300)
@@ -2698,7 +2698,7 @@
 NSUInteger anIndex = [progressIndicator indexInView];
 // we only draw a if there's an active download for this 
URL/index pair
 if (anIndex < [self numberOfIcons] && [[self 
URLAtIndex:anIndex] isEqual:url])
-[progressIndicator drawWithFrame:[self 
_rectOfProgressIndicatorForIconAtIndex:anIndex] inView:self];
+[progressIndicator drawWithFrame:[self 
_rectOfProgressIndicatorForIconAtIndex:anIndex]];
 }
 }
 }

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVProgressIndicatorCell.h
===
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVProgressIndicatorCell.h 
2023-06-06 22:23:25 UTC (rev 28299)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVProgressIndicatorCell.h 
2023-06-07 09:34:23 UTC (rev 28300)
@@ -52,7 +52,7 @@
 };
 typedef NSInteger FVProgressIndicatorStyle;
 
-@interface FVProgressIndicatorCell : NSCell
+@interface FVProgressIndicatorCell : NSObject
 {
 @private
 CGFloat  _currentProgress;
@@ -61,8 +61,8 @@
 NSUInteger   _indexInView;
 }
 
+- (CGFloat)currentProgress;
 - (void)setCurrentProgress:(CGFloat)progress;
-- (CGFloat)currentProgress;
 
 // default is FVProgressIndicatorDeterminate
 - (FVProgressIndicatorStyle)style;
@@ -73,4 +73,6 @@
 
 - (void)animate;
 
+- (void)drawWithFrame:(NSRect)aRect;
+
 @end

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVProgressIndicatorCell.m
===
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVProgressIndicatorCell.m 
2023-06-06 22:23:25 UTC (rev 28299)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVProgressIndicatorCell.m 
2023-06-07 09:34:23 UTC (rev 28300)
@@ -76,7 +76,7 @@
 _currentStep = (_currentStep + 1) % numSteps;
 }
 
-- (void)drawWithFrame:(NSRect)aRect inView:(NSView *)aView
+- (void)drawWithFrame:(NSRect)aRect
 {
 CGContextRef context = [[NSGraphicsContext currentContext] graphicsPort];
 CGContextSaveGState(context);

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28301] trunk/bibdesk

2023-06-08 Thread hofman--- via Bibdesk-commit
Revision: 28301
  http://sourceforge.net/p/bibdesk/svn/28301
Author:   hofman
Date: 2023-06-08 09:46:00 + (Thu, 08 Jun 2023)
Log Message:
---
Make spelling menu in main Edit menu the same as the system

Modified Paths:
--
trunk/bibdesk/Base.lproj/MainMenu.xib
trunk/bibdesk/de.lproj/MainMenu.strings
trunk/bibdesk/en.lproj/MainMenu.strings
trunk/bibdesk/fr.lproj/MainMenu.strings

Modified: trunk/bibdesk/Base.lproj/MainMenu.xib
===
--- trunk/bibdesk/Base.lproj/MainMenu.xib   2023-06-07 09:34:23 UTC (rev 
28300)
+++ trunk/bibdesk/Base.lproj/MainMenu.xib   2023-06-08 09:46:00 UTC (rev 
28301)
@@ -1,9 +1,8 @@
 
-
+
 
 
-
-
+
 
 
 
@@ -407,24 +406,35 @@
 
 
 
-
-
+
+
 
-
+
 
 
 
 
-
+
 
 
 
 
-
+
+
 
 
 
 
+
+
+
+
+
+
+
+
+
+
 
 
 

Modified: trunk/bibdesk/de.lproj/MainMenu.strings
===
(Binary files differ)

Modified: trunk/bibdesk/en.lproj/MainMenu.strings
===
(Binary files differ)

Modified: trunk/bibdesk/fr.lproj/MainMenu.strings
===
(Binary files differ)

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28302] trunk/bibdesk/BDSKMathSciNetParser.m

2023-06-19 Thread hofman--- via Bibdesk-commit
Revision: 28302
  http://sourceforge.net/p/bibdesk/svn/28302
Author:   hofman
Date: 2023-06-19 23:04:31 + (Mon, 19 Jun 2023)
Log Message:
---
redirect mathscinet web searches to legacy api

Modified Paths:
--
trunk/bibdesk/BDSKMathSciNetParser.m

Modified: trunk/bibdesk/BDSKMathSciNetParser.m
===
--- trunk/bibdesk/BDSKMathSciNetParser.m2023-06-08 09:46:00 UTC (rev 
28301)
+++ trunk/bibdesk/BDSKMathSciNetParser.m2023-06-19 23:04:31 UTC (rev 
28302)
@@ -117,7 +117,7 @@
 firstElement += MSNBATCHSIZE;
 
 NSString * queryString = [processArray 
componentsJoinedByString:@"%20or%20"];
-NSString * URLString = [NSString 
stringWithFormat:@"https://%@/mathscinet/search/publications.html?&fmt=bibtex&pg1=MR&s1=%@";,
 serverName, queryString];
+NSString * URLString = [NSString 
stringWithFormat:@"https://%@/mathscinet/2006/mathscinet/search/publications.html?&fmt=bibtex&pg1=MR&s1=%@";,
 serverName, queryString];
 NSURL * bibTeXBatchDownloadURL = [NSURL URLWithString:URLString];
 
 NSURLRequest * request = [NSURLRequest 
requestWithURL:bibTeXBatchDownloadURL];

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28303] trunk/bibdesk/BDSKMathSciNetParser.m

2023-06-20 Thread hofman--- via Bibdesk-commit
Revision: 28303
  http://sourceforge.net/p/bibdesk/svn/28303
Author:   hofman
Date: 2023-06-20 09:07:22 + (Tue, 20 Jun 2023)
Log Message:
---
refer mathscinet parser to legacy interface

Modified Paths:
--
trunk/bibdesk/BDSKMathSciNetParser.m

Modified: trunk/bibdesk/BDSKMathSciNetParser.m
===
--- trunk/bibdesk/BDSKMathSciNetParser.m2023-06-19 23:04:31 UTC (rev 
28302)
+++ trunk/bibdesk/BDSKMathSciNetParser.m2023-06-20 09:07:22 UTC (rev 
28303)
@@ -105,7 +105,7 @@
 + (NSArray *)bibTeXRequestsForMRIDs:(NSArray *)IDs serverName:(NSString 
*)serverName error:(NSError **)outError {
 
 if (serverName == nil)
-   serverName = @"www.ams.org";
+   serverName = @"mathscinet.ams.org";
 
 // Loop through IDs in batches of MSNBATCHSIZE. */
 NSUInteger count = [IDs count];
@@ -187,7 +187,7 @@
 
 + (NSString *)name { return @"MathSciNet"; }
 
-+ (NSString *)address { return @"https://www.ams.org/mathscinet/";; }
++ (NSString *)address { return 
@"https://mathscinet.ams.org/mathscinet/2006/mathscinet/";; }
 
 + (NSString *)info { return NSLocalizedString(@"Database of Mathematical 
Reviews by the American Mathematical Society.", @"Description for MathSciNet 
site"); }
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28304] trunk/bibdesk_vendorsrc/amaxwell/FileView

2023-06-20 Thread hofman--- via Bibdesk-commit
Revision: 28304
  http://sourceforge.net/p/bibdesk/svn/28304
Author:   hofman
Date: 2023-06-20 14:22:21 + (Tue, 20 Jun 2023)
Log Message:
---
define and use NSAppKitVersionNumber13_0 to check for PostScript conversion 
support

Modified Paths:
--
trunk/bibdesk_vendorsrc/amaxwell/FileView/FVPDFIcon.m
trunk/bibdesk_vendorsrc/amaxwell/FileView/FileView_Prefix.pch

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVPDFIcon.m
===
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVPDFIcon.m   2023-06-20 
09:07:22 UTC (rev 28303)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVPDFIcon.m   2023-06-20 
14:22:21 UTC (rev 28304)
@@ -672,7 +672,7 @@
 
 + (BOOL)canInitWithURL:(NSURL *)aURL withType:(NSString *)type
 {
-return UTTypeConformsTo((CFStringRef)type, FVSTR("com.adobe.postscript"));
+return floor(NSAppKitVersionNumber) <= NSAppKitVersionNumber13_0 && 
UTTypeConformsTo((CFStringRef)type, FVSTR("com.adobe.postscript"));
 }
 
 - (id)initWithURL:(NSURL *)aURL drawsLinkBadge:(BOOL)drawsLinkBadge

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FileView_Prefix.pch
===
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FileView_Prefix.pch   
2023-06-20 09:07:22 UTC (rev 28303)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FileView_Prefix.pch   
2023-06-20 14:22:21 UTC (rev 28304)
@@ -110,21 +110,57 @@
 #define NSAppKitVersionNumber10_15 1894
 #endif
 
+#ifndef NSAppKitVersionNumber11_0
+#define NSAppKitVersionNumber11_0 2022
+#endif
+
+#ifndef NSAppKitVersionNumber12_0
+#define NSAppKitVersionNumber12_0 2113
+#endif
+
+#ifndef NSAppKitVersionNumber13_0
+#define NSAppKitVersionNumber13_0 2299
+#endif
+
 #elif !defined(MAC_OS_X_VERSION_10_14) || MAC_OS_X_VERSION_MAX_ALLOWED < 
MAC_OS_X_VERSION_10_14
 
 static const NSAppKitVersion NSAppKitVersionNumber10_13 = 1561;
 static const NSAppKitVersion NSAppKitVersionNumber10_14 = 1671;
 static const NSAppKitVersion NSAppKitVersionNumber10_15 = 1894;
+static const NSAppKitVersion NSAppKitVersionNumber11_0 = 2022;
+static const NSAppKitVersion NSAppKitVersionNumber12_0 = 2113;
+static const NSAppKitVersion NSAppKitVersionNumber13_0 = 2299;
 
 #elif !defined(MAC_OS_X_VERSION_10_15) || MAC_OS_X_VERSION_MAX_ALLOWED < 
MAC_OS_X_VERSION_10_15
 
 static const NSAppKitVersion NSAppKitVersionNumber10_14 = 1671;
 static const NSAppKitVersion NSAppKitVersionNumber10_15 = 1894;
+static const NSAppKitVersion NSAppKitVersionNumber11_0 = 2022;
+static const NSAppKitVersion NSAppKitVersionNumber12_0 = 2113;
+static const NSAppKitVersion NSAppKitVersionNumber13_0 = 2299;
 
 #elif !defined(MAC_OS_VERSION_11_0) || MAC_OS_X_VERSION_MAX_ALLOWED < 
MAC_OS_VERSION_11_0
 
 static const NSAppKitVersion NSAppKitVersionNumber10_15 = 1894;
+static const NSAppKitVersion NSAppKitVersionNumber11_0 = 2022;
+static const NSAppKitVersion NSAppKitVersionNumber12_0 = 2113;
+static const NSAppKitVersion NSAppKitVersionNumber13_0 = 2299;
 
+#elif !defined(MAC_OS_VERSION_12_0) || MAC_OS_X_VERSION_MAX_ALLOWED < 
MAC_OS_VERSION_12_0
+
+static const NSAppKitVersion NSAppKitVersionNumber11_0 = 2022;
+static const NSAppKitVersion NSAppKitVersionNumber12_0 = 2113;
+static const NSAppKitVersion NSAppKitVersionNumber13_0 = 2299;
+
+#elif !defined(MAC_OS_VERSION_13_0) || MAC_OS_X_VERSION_MAX_ALLOWED < 
MAC_OS_VERSION_13_0
+
+static const NSAppKitVersion NSAppKitVersionNumber12_0 = 2113;
+static const NSAppKitVersion NSAppKitVersionNumber13_0 = 2299;
+
+#elif !defined(MAC_OS_VERSION_14_0) || MAC_OS_X_VERSION_MAX_ALLOWED < 
MAC_OS_VERSION_14_0
+
+static const NSAppKitVersion NSAppKitVersionNumber13_0 = 2299;
+
 #endif
 
 #if !defined(MAC_OS_X_VERSION_10_7) || MAC_OS_X_VERSION_MAX_ALLOWED < 
MAC_OS_X_VERSION_10_7

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28305] trunk/bibdesk/RelNotes.rtf

2023-07-03 Thread hofman--- via Bibdesk-commit
Revision: 28305
  http://sourceforge.net/p/bibdesk/svn/28305
Author:   hofman
Date: 2023-07-03 13:55:22 + (Mon, 03 Jul 2023)
Log Message:
---
update release notes

Modified Paths:
--
trunk/bibdesk/RelNotes.rtf

Modified: trunk/bibdesk/RelNotes.rtf
===
(Binary files differ)

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28306] trunk/bibdesk/RelNotes.rtf

2023-07-03 Thread hofman--- via Bibdesk-commit
Revision: 28306
  http://sourceforge.net/p/bibdesk/svn/28306
Author:   hofman
Date: 2023-07-03 14:42:03 + (Mon, 03 Jul 2023)
Log Message:
---
update release notes

Modified Paths:
--
trunk/bibdesk/RelNotes.rtf

Modified: trunk/bibdesk/RelNotes.rtf
===
(Binary files differ)

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28307] trunk/bibdesk

2023-07-05 Thread hofman--- via Bibdesk-commit
Revision: 28307
  http://sourceforge.net/p/bibdesk/svn/28307
Author:   hofman
Date: 2023-07-05 09:00:39 + (Wed, 05 Jul 2023)
Log Message:
---
update version numbers for release

Modified Paths:
--
trunk/bibdesk/BibDesk.help/Contents/Resources/en.lproj/version.texi
trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj
trunk/bibdesk/Info.plist

Modified: trunk/bibdesk/BibDesk.help/Contents/Resources/en.lproj/version.texi
===
--- trunk/bibdesk/BibDesk.help/Contents/Resources/en.lproj/version.texi 
2023-07-03 14:42:03 UTC (rev 28306)
+++ trunk/bibdesk/BibDesk.help/Contents/Resources/en.lproj/version.texi 
2023-07-05 09:00:39 UTC (rev 28307)
@@ -1 +1 @@
-@set VERSION 1.8.18
\ No newline at end of file
+@set VERSION 1.8.19
\ No newline at end of file

Modified: trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj
===
--- trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj 2023-07-03 14:42:03 UTC 
(rev 28306)
+++ trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj 2023-07-05 09:00:39 UTC 
(rev 28307)
@@ -6114,7 +6114,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = CE17EE7E0E24F27400DE06EA 
/* BibDesk-App.xcconfig */;
buildSettings = {
-   CURRENT_PROJECT_VERSION = 6107;
+   CURRENT_PROJECT_VERSION = 6108;
VERSIONING_SYSTEM = "apple-generic";
};
name = Debug;
@@ -6123,7 +6123,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = CE17EE7E0E24F27400DE06EA 
/* BibDesk-App.xcconfig */;
buildSettings = {
-   CURRENT_PROJECT_VERSION = 6107;
+   CURRENT_PROJECT_VERSION = 6108;
VERSIONING_SYSTEM = "apple-generic";
};
name = Release;

Modified: trunk/bibdesk/Info.plist
===
--- trunk/bibdesk/Info.plist2023-07-03 14:42:03 UTC (rev 28306)
+++ trunk/bibdesk/Info.plist2023-07-05 09:00:39 UTC (rev 28307)
@@ -291,7 +291,7 @@
CFBundlePackageType
APPL
CFBundleShortVersionString
-   1.8.18
+   1.8.19
CFBundleSignature
BDSK
CFBundleURLTypes

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28308] tags/REL_1_8_19/

2023-07-05 Thread hofman--- via Bibdesk-commit
Revision: 28308
  http://sourceforge.net/p/bibdesk/svn/28308
Author:   hofman
Date: 2023-07-05 09:01:16 + (Wed, 05 Jul 2023)
Log Message:
---
Tag for release

Added Paths:
---
tags/REL_1_8_19/

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28309] trunk/bibdesk/BibDocument.m

2023-07-13 Thread hofman--- via Bibdesk-commit
Revision: 28309
  http://sourceforge.net/p/bibdesk/svn/28309
Author:   hofman
Date: 2023-07-13 14:24:46 + (Thu, 13 Jul 2023)
Log Message:
---
always remove temporary folder for archive

Modified Paths:
--
trunk/bibdesk/BibDocument.m

Modified: trunk/bibdesk/BibDocument.m
===
--- trunk/bibdesk/BibDocument.m 2023-07-05 09:01:16 UTC (rev 28308)
+++ trunk/bibdesk/BibDocument.m 2023-07-13 14:24:46 UTC (rev 28309)
@@ -1264,10 +1264,10 @@
 NSWorkspace *ws = [NSWorkspace sharedWorkspace];
 NSString *filePath;
 NSString *commonParent = nil;
-BOOL success = YES;
 NSMutableSet *localFiles = [NSMutableSet set];
+BOOL success = [fm createDirectoryAtURL:folderURL 
withIntermediateDirectories:NO attributes:nil error:NULL];
 
-if ((success = [fm createDirectoryAtURL:folderURL 
withIntermediateDirectories:NO attributes:nil error:NULL])) {
+if (success) {
 for (BibItem *item in [self publicationsForSaving]) {
 for (BDSKLinkedFile *file in [item localFiles]) {
 if ((filePath = [file path]) && [fm fileExistsAtPath:filePath] 
&& [ws isFolderAtPath:filePath] == NO) {
@@ -1306,8 +1306,9 @@
 @catch (id e) {}
 [task waitUntilExit];
 success = [task terminationStatus] == 0;
-[fm removeItemAtURL:folderURL error:NULL];
 }
+
+[fm removeItemAtURL:folderURL error:NULL];
 }
 
 return success;

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28310] trunk/bibdesk/BibDocument.m

2023-07-14 Thread hofman--- via Bibdesk-commit
Revision: 28310
  http://sourceforge.net/p/bibdesk/svn/28310
Author:   hofman
Date: 2023-07-14 08:40:42 + (Fri, 14 Jul 2023)
Log Message:
---
save files for local file fields in archive when not using linked files

Modified Paths:
--
trunk/bibdesk/BibDocument.m

Modified: trunk/bibdesk/BibDocument.m
===
--- trunk/bibdesk/BibDocument.m 2023-07-13 14:24:46 UTC (rev 28309)
+++ trunk/bibdesk/BibDocument.m 2023-07-14 08:40:42 UTC (rev 28310)
@@ -1265,6 +1265,7 @@
 NSString *filePath;
 NSString *commonParent = nil;
 NSMutableSet *localFiles = [NSMutableSet set];
+NSSet *localFileFields = [[NSUserDefaults standardUserDefaults] 
boolForKey:BDSKUseLocalUrlAndUrlKey] ? [[BDSKTypeManager sharedManager] 
localFileFieldsSet] : nil;
 BOOL success = [fm createDirectoryAtURL:folderURL 
withIntermediateDirectories:NO attributes:nil error:NULL];
 
 if (success) {
@@ -1278,6 +1279,15 @@
 commonParent = [filePath 
stringByDeletingLastPathComponent];
 }
 }
+for (NSString *field in localFileFields) {
+if ((filePath = [[item localFileURLForField:field] path]) && 
[fm fileExistsAtPath:filePath] && [ws isFolderAtPath:filePath] == NO) {
+[localFiles addObject:filePath];
+if (commonParent)
+commonParent = [[filePath 
stringByDeletingLastPathComponent] commonRootPathOfFile:commonParent];
+else
+commonParent = [filePath 
stringByDeletingLastPathComponent];
+}
+}
 }
 
 NSData *bibtexData = [self bibTeXDataDroppingInternal:NO 
relativeToPath:commonParent error:outError];

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28311] trunk/bibdesk/BibDocument.m

2023-07-14 Thread hofman--- via Bibdesk-commit
Revision: 28311
  http://sourceforge.net/p/bibdesk/svn/28311
Author:   hofman
Date: 2023-07-14 08:54:20 + (Fri, 14 Jul 2023)
Log Message:
---
calculate parent directory first

Modified Paths:
--
trunk/bibdesk/BibDocument.m

Modified: trunk/bibdesk/BibDocument.m
===
--- trunk/bibdesk/BibDocument.m 2023-07-14 08:40:42 UTC (rev 28310)
+++ trunk/bibdesk/BibDocument.m 2023-07-14 08:54:20 UTC (rev 28311)
@@ -1263,6 +1263,7 @@
 NSFileManager *fm = [NSFileManager defaultManager];
 NSWorkspace *ws = [NSWorkspace sharedWorkspace];
 NSString *filePath;
+NSString *parent;
 NSString *commonParent = nil;
 NSMutableSet *localFiles = [NSMutableSet set];
 NSSet *localFileFields = [[NSUserDefaults standardUserDefaults] 
boolForKey:BDSKUseLocalUrlAndUrlKey] ? [[BDSKTypeManager sharedManager] 
localFileFieldsSet] : nil;
@@ -1273,19 +1274,15 @@
 for (BDSKLinkedFile *file in [item localFiles]) {
 if ((filePath = [file path]) && [fm fileExistsAtPath:filePath] 
&& [ws isFolderAtPath:filePath] == NO) {
 [localFiles addObject:filePath];
-if (commonParent)
-commonParent = [[filePath 
stringByDeletingLastPathComponent] commonRootPathOfFile:commonParent];
-else
-commonParent = [filePath 
stringByDeletingLastPathComponent];
+parent = [filePath stringByDeletingLastPathComponent];
+commonParent = commonParent ? [parent 
commonRootPathOfFile:commonParent] : parent;
 }
 }
 for (NSString *field in localFileFields) {
 if ((filePath = [[item localFileURLForField:field] path]) && 
[fm fileExistsAtPath:filePath] && [ws isFolderAtPath:filePath] == NO) {
 [localFiles addObject:filePath];
-if (commonParent)
-commonParent = [[filePath 
stringByDeletingLastPathComponent] commonRootPathOfFile:commonParent];
-else
-commonParent = [filePath 
stringByDeletingLastPathComponent];
+parent = [filePath stringByDeletingLastPathComponent];
+commonParent = commonParent ? [parent 
commonRootPathOfFile:commonParent] : parent;
 }
 }
 }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28312] trunk/bibdesk/BibDocument.m

2023-07-14 Thread hofman--- via Bibdesk-commit
Revision: 28312
  http://sourceforge.net/p/bibdesk/svn/28312
Author:   hofman
Date: 2023-07-14 09:28:42 + (Fri, 14 Jul 2023)
Log Message:
---
calculate common parent after getting all parents, many or all of them may be 
the same

Modified Paths:
--
trunk/bibdesk/BibDocument.m

Modified: trunk/bibdesk/BibDocument.m
===
--- trunk/bibdesk/BibDocument.m 2023-07-14 08:54:20 UTC (rev 28311)
+++ trunk/bibdesk/BibDocument.m 2023-07-14 09:28:42 UTC (rev 28312)
@@ -1263,7 +1263,7 @@
 NSFileManager *fm = [NSFileManager defaultManager];
 NSWorkspace *ws = [NSWorkspace sharedWorkspace];
 NSString *filePath;
-NSString *parent;
+NSMutableSet *parents = [NSMutableSet set];
 NSString *commonParent = nil;
 NSMutableSet *localFiles = [NSMutableSet set];
 NSSet *localFileFields = [[NSUserDefaults standardUserDefaults] 
boolForKey:BDSKUseLocalUrlAndUrlKey] ? [[BDSKTypeManager sharedManager] 
localFileFieldsSet] : nil;
@@ -1274,19 +1274,20 @@
 for (BDSKLinkedFile *file in [item localFiles]) {
 if ((filePath = [file path]) && [fm fileExistsAtPath:filePath] 
&& [ws isFolderAtPath:filePath] == NO) {
 [localFiles addObject:filePath];
-parent = [filePath stringByDeletingLastPathComponent];
-commonParent = commonParent ? [parent 
commonRootPathOfFile:commonParent] : parent;
+[parents addObject:[filePath 
stringByDeletingLastPathComponent]];
 }
 }
 for (NSString *field in localFileFields) {
 if ((filePath = [[item localFileURLForField:field] path]) && 
[fm fileExistsAtPath:filePath] && [ws isFolderAtPath:filePath] == NO) {
 [localFiles addObject:filePath];
-parent = [filePath stringByDeletingLastPathComponent];
-commonParent = commonParent ? [parent 
commonRootPathOfFile:commonParent] : parent;
+[parents addObject:[filePath 
stringByDeletingLastPathComponent]];
 }
 }
 }
 
+for (filePath in parents)
+commonParent = commonParent ? [filePath 
commonRootPathOfFile:commonParent] : filePath;
+
 NSData *bibtexData = [self bibTeXDataDroppingInternal:NO 
relativeToPath:commonParent error:outError];
 NSURL *bibtexURL = [folderURL URLByAppendingPathComponent:[targetName 
stringByAppendingPathExtension:@"bib"] isDirectory:NO];
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28313] trunk/bibdesk/BibDocument.m

2023-07-14 Thread hofman--- via Bibdesk-commit
Revision: 28313
  http://sourceforge.net/p/bibdesk/svn/28313
Author:   hofman
Date: 2023-07-14 14:49:10 + (Fri, 14 Jul 2023)
Log Message:
---
create tar archive directly from linked files and .bib file, no need to copy 
them to a temporary folder

Modified Paths:
--
trunk/bibdesk/BibDocument.m

Modified: trunk/bibdesk/BibDocument.m
===
--- trunk/bibdesk/BibDocument.m 2023-07-14 09:28:42 UTC (rev 28312)
+++ trunk/bibdesk/BibDocument.m 2023-07-14 14:49:10 UTC (rev 28313)
@@ -1258,8 +1258,7 @@
 
 - (BOOL)writeArchiveToURL:(NSURL *)fileURL error:(NSError **)outError{
 NSURL *dirURL = [fileURL URLByDeletingLastPathComponent];
-NSString *targetName = [[saveTargetURL lastPathComponent] 
stringByDeletingPathExtension];
-NSURL *folderURL = [dirURL URLByAppendingPathComponent:targetName 
isDirectory:YES];
+NSString *bibtexFile = [[[saveTargetURL lastPathComponent] 
stringByDeletingPathExtension] stringByAppendingPathExtension:@"bib"];
 NSFileManager *fm = [NSFileManager defaultManager];
 NSWorkspace *ws = [NSWorkspace sharedWorkspace];
 NSString *filePath;
@@ -1267,56 +1266,43 @@
 NSString *commonParent = nil;
 NSMutableSet *localFiles = [NSMutableSet set];
 NSSet *localFileFields = [[NSUserDefaults standardUserDefaults] 
boolForKey:BDSKUseLocalUrlAndUrlKey] ? [[BDSKTypeManager sharedManager] 
localFileFieldsSet] : nil;
-BOOL success = [fm createDirectoryAtURL:folderURL 
withIntermediateDirectories:NO attributes:nil error:NULL];
+BOOL success = YES;
 
-if (success) {
-for (BibItem *item in [self publicationsForSaving]) {
-for (BDSKLinkedFile *file in [item localFiles]) {
-if ((filePath = [file path]) && [fm fileExistsAtPath:filePath] 
&& [ws isFolderAtPath:filePath] == NO) {
-[localFiles addObject:filePath];
-[parents addObject:[filePath 
stringByDeletingLastPathComponent]];
-}
+for (BibItem *item in [self publicationsForSaving]) {
+for (BDSKLinkedFile *file in [item localFiles]) {
+if ((filePath = [file path]) && [fm fileExistsAtPath:filePath] && 
[ws isFolderAtPath:filePath] == NO) {
+[localFiles addObject:filePath];
+[parents addObject:[filePath 
stringByDeletingLastPathComponent]];
 }
-for (NSString *field in localFileFields) {
-if ((filePath = [[item localFileURLForField:field] path]) && 
[fm fileExistsAtPath:filePath] && [ws isFolderAtPath:filePath] == NO) {
-[localFiles addObject:filePath];
-[parents addObject:[filePath 
stringByDeletingLastPathComponent]];
-}
+}
+for (NSString *field in localFileFields) {
+if ((filePath = [[item localFileURLForField:field] path]) && [fm 
fileExistsAtPath:filePath] && [ws isFolderAtPath:filePath] == NO) {
+[localFiles addObject:filePath];
+[parents addObject:[filePath 
stringByDeletingLastPathComponent]];
 }
 }
-
-for (filePath in parents)
-commonParent = commonParent ? [filePath 
commonRootPathOfFile:commonParent] : filePath;
-
-NSData *bibtexData = [self bibTeXDataDroppingInternal:NO 
relativeToPath:commonParent error:outError];
-NSURL *bibtexURL = [folderURL URLByAppendingPathComponent:[targetName 
stringByAppendingPathExtension:@"bib"] isDirectory:NO];
+}
+
+for (filePath in parents)
+commonParent = commonParent ? [filePath 
commonRootPathOfFile:commonParent] : filePath;
+
+NSData *bibtexData = [self bibTeXDataDroppingInternal:NO 
relativeToPath:commonParent error:outError];
+NSURL *bibtexURL = [dirURL URLByAppendingPathComponent:bibtexFile 
isDirectory:NO];
 
-success = [bibtexData writeToURL:bibtexURL options:0 error:outError];
-
-for (filePath in localFiles) {
-if (success == NO) break;
-NSString *relativePath = commonParent ? [filePath 
relativePathFromPath:commonParent] : [filePath lastPathComponent];
-NSURL *targetURL = [folderURL 
URLByAppendingPathComponent:relativePath isDirectory:NO];
-
-if ([targetURL checkResourceIsReachableAndReturnError:NULL])
-targetURL = [fm uniqueFileURL:targetURL];
-success = [fm createPathToURL:targetURL attributes:nil];
-if (success)
-success = [fm copyItemAtURL:[NSURL fileURLWithPath:filePath 
isDirectory:NO] toURL:targetURL error:NULL];
-}
-
-if (success) {
-NSTask *task = [[[BDSKTask alloc] init] autorelease];
-[task setLaunchPath:@"/usr/bin/tar"];
-[task setArguments:[NSArray arrayWithObjects:@"-czf", [[fileURL 
path] lastPathComponent], targetName, nil]];
-[task set

[Bibdesk-commit] SF.net SVN: bibdesk:[28314] trunk/bibdesk/BibDocument.m

2023-07-14 Thread hofman--- via Bibdesk-commit
Revision: 28314
  http://sourceforge.net/p/bibdesk/svn/28314
Author:   hofman
Date: 2023-07-14 15:42:22 + (Fri, 14 Jul 2023)
Log Message:
---
get local variable when needed

Modified Paths:
--
trunk/bibdesk/BibDocument.m

Modified: trunk/bibdesk/BibDocument.m
===
--- trunk/bibdesk/BibDocument.m 2023-07-14 14:49:10 UTC (rev 28313)
+++ trunk/bibdesk/BibDocument.m 2023-07-14 15:42:22 UTC (rev 28314)
@@ -1266,7 +1266,6 @@
 NSString *commonParent = nil;
 NSMutableSet *localFiles = [NSMutableSet set];
 NSSet *localFileFields = [[NSUserDefaults standardUserDefaults] 
boolForKey:BDSKUseLocalUrlAndUrlKey] ? [[BDSKTypeManager sharedManager] 
localFileFieldsSet] : nil;
-BOOL success = YES;
 
 for (BibItem *item in [self publicationsForSaving]) {
 for (BDSKLinkedFile *file in [item localFiles]) {
@@ -1288,8 +1287,7 @@
 
 NSData *bibtexData = [self bibTeXDataDroppingInternal:NO 
relativeToPath:commonParent error:outError];
 NSURL *bibtexURL = [dirURL URLByAppendingPathComponent:bibtexFile 
isDirectory:NO];
-
-success = [bibtexData writeToURL:bibtexURL options:0 error:outError];
+BOOL success = [bibtexData writeToURL:bibtexURL options:0 error:outError];
 
 if (success) {
 NSMutableArray *args = [NSMutableArray arrayWithObjects:@"-czf", 
[fileURL path], bibtexFile, @"-C", commonParent, nil];
@@ -1303,6 +1301,7 @@
 @catch (id e) {}
 [task waitUntilExit];
 success = [task terminationStatus] == 0;
+[fm removeItemAtURL:bibtexURL error:NULL];
 }
 
 return success;

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28315] trunk/bibdesk/BibDocument.m

2023-07-14 Thread hofman--- via Bibdesk-commit
Revision: 28315
  http://sourceforge.net/p/bibdesk/svn/28315
Author:   hofman
Date: 2023-07-14 16:27:53 + (Fri, 14 Jul 2023)
Log Message:
---
don't pass invalid arguments when no linked files to archive

Modified Paths:
--
trunk/bibdesk/BibDocument.m

Modified: trunk/bibdesk/BibDocument.m
===
--- trunk/bibdesk/BibDocument.m 2023-07-14 15:42:22 UTC (rev 28314)
+++ trunk/bibdesk/BibDocument.m 2023-07-14 16:27:53 UTC (rev 28315)
@@ -1290,9 +1290,13 @@
 BOOL success = [bibtexData writeToURL:bibtexURL options:0 error:outError];
 
 if (success) {
-NSMutableArray *args = [NSMutableArray arrayWithObjects:@"-czf", 
[fileURL path], bibtexFile, @"-C", commonParent, nil];
-for (filePath in localFiles)
-[args addObject:[filePath relativePathFromPath:commonParent]];
+NSMutableArray *args = [NSMutableArray arrayWithObjects:@"-czf", 
[fileURL path], bibtexFile, nil];
+if ([localFiles count]) {
+[args addObject:@"-C"];
+[args addObject:commonParent];
+for (filePath in localFiles)
+[args addObject:[filePath relativePathFromPath:commonParent]];
+}
 NSTask *task = [[[BDSKTask alloc] init] autorelease];
 [task setLaunchPath:@"/usr/bin/tar"];
 [task setArguments:args];

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28316] trunk/bibdesk/BibItem.m

2023-07-15 Thread hofman--- via Bibdesk-commit
Revision: 28316
  http://sourceforge.net/p/bibdesk/svn/28316
Author:   hofman
Date: 2023-07-15 09:05:29 + (Sat, 15 Jul 2023)
Log Message:
---
check variable first

Modified Paths:
--
trunk/bibdesk/BibItem.m

Modified: trunk/bibdesk/BibItem.m
===
--- trunk/bibdesk/BibItem.m 2023-07-14 16:27:53 UTC (rev 28315)
+++ trunk/bibdesk/BibItem.m 2023-07-15 09:05:29 UTC (rev 28316)
@@ -1918,7 +1918,7 @@
 value = [pubFields objectForKey:field];
 
 // only use the normalized author name if it's not complex
-if([personFields containsObject:field] && shouldNormalizeAuthors 
&& NO == [value isComplex])
+if(shouldNormalizeAuthors && [personFields containsObject:field] 
&& NO == [value isComplex])
 value = [self bibTeXNameStringForField:field normalized:YES 
inherit:NO];
 
 // TeXifying URLs leads to serious problems

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28317] trunk/bibdesk

2023-07-16 Thread hofman--- via Bibdesk-commit
Revision: 28317
  http://sourceforge.net/p/bibdesk/svn/28317
Author:   hofman
Date: 2023-07-16 14:39:50 + (Sun, 16 Jul 2023)
Log Message:
---
change relative local files in fields when saving bibtex to a different loaction

Modified Paths:
--
trunk/bibdesk/BibDocument.m
trunk/bibdesk/BibItem.h
trunk/bibdesk/BibItem.m

Modified: trunk/bibdesk/BibDocument.m
===
--- trunk/bibdesk/BibDocument.m 2023-07-15 09:05:29 UTC (rev 28316)
+++ trunk/bibdesk/BibDocument.m 2023-07-16 14:39:50 UTC (rev 28317)
@@ -1430,6 +1430,8 @@
 options |= BDSKBibTeXOptionTeXify;
 if (drop)
 options |= BDSKBibTeXOptionDropInternal;
+if (aBasePath && [self fileURL] && [aBasePath isEqualToString:[self 
basePath]] == NO)
+options |= BDSKBibTeXOptionRedirectRelativeFiles;
 
 if([[NSUserDefaults standardUserDefaults] 
boolForKey:BDSKShouldUseTemplateFileKey]){
 NSMutableString *templateFile = [NSMutableString 
stringWithContentsOfFile:[[[NSUserDefaults standardUserDefaults] 
stringForKey:BDSKOutputTemplateFileKey] stringByExpandingTildeInPath] 
usedEncoding:NULL error:NULL] ?: [NSMutableString string];

Modified: trunk/bibdesk/BibItem.h
===
--- trunk/bibdesk/BibItem.h 2023-07-15 09:05:29 UTC (rev 28316)
+++ trunk/bibdesk/BibItem.h 2023-07-16 14:39:50 UTC (rev 28317)
@@ -71,7 +71,8 @@
 BDSKBibTeXOptionTeXify = 1,
 BDSKBibTeXOptionDropLinkedURLs = 2,
 BDSKBibTeXOptionDropNonStandard = 4,
-BDSKBibTeXOptionDropInternal = 6
+BDSKBibTeXOptionDropInternal = 6,
+BDSKBibTeXOptionRedirectRelativeFiles = 8
 };
 
 typedef NS_ENUM(NSInteger, BDSKFieldAction) {

Modified: trunk/bibdesk/BibItem.m
===
--- trunk/bibdesk/BibItem.m 2023-07-15 09:05:29 UTC (rev 28316)
+++ trunk/bibdesk/BibItem.m 2023-07-16 14:39:50 UTC (rev 28317)
@@ -1847,7 +1847,8 @@
 BOOL shouldNormalizeAuthors = [sud 
boolForKey:BDSKShouldSaveNormalizedAuthorNamesKey];
 
NSMutableSet *knownKeys = nil;
-   NSSet *urlKeys = nil;
+NSSet *urlKeys = nil;
+NSSet *fileKeys = nil;
NSString *field;
 NSString *value;
 NSMutableData *data = [NSMutableData dataWithCapacity:200];
@@ -1856,7 +1857,8 @@
 BOOL shouldTeXify = (options & BDSKBibTeXOptionTeXify) != 0;
 BOOL dropLinkedURLs = (options & BDSKBibTeXOptionDropLinkedURLs) != 0;
 BOOL dropInternal = (options & BDSKBibTeXOptionDropNonStandard) != 0;
-
+BOOL redirectRelPaths = (options & BDSKBibTeXOptionRedirectRelativeFiles) 
!= 0;
+
 BDSKTypeManager *btm = [BDSKTypeManager sharedManager];
 NSString *type = [self pubType];
 NSAssert1(type != nil, @"Tried to use a nil pubtype in %@.", [self 
citeKey]);
@@ -1891,8 +1893,10 @@
}
 
 // Sets are used directly instead of the NSString category methods because 
+[BDSKTypeManager sharedManager] uses @synchronized, which kills performance in 
a loop.
-   if(shouldTeXify)
+if(shouldTeXify)
 urlKeys = [btm allURLFieldsSet];
+if(redirectRelPaths)
+fileKeys = [btm localFileFieldsSet];
 NSSet *personFields = [btm personFieldsSet];
 
 // citekey is the only thing that could fail here, and that's not likely 
if we read it in originally
@@ -1925,6 +1929,9 @@
 if(shouldTeXify && NO == [urlKeys containsObject:field])
 value = [value stringByTeXifyingString];
 
+if(redirectRelPaths && [fileKeys containsObject:field] && [value 
hasCaseInsensitivePrefix:@"file://"] == NO && [value isAbsolutePath] == NO && 
[[self URLForField:field] checkResourceIsReachableAndReturnError:NULL])
+value = [[[self URLForField:field] path] 
relativePathFromPath:basePath];
+
 // We used to keep empty strings in fields as markers for the 
editor; now they're generally nil
 BOOL isEmpty = [NSString isEmptyAsComplexString:value];
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28318] trunk/bibdesk/BibItem.m

2023-07-16 Thread hofman--- via Bibdesk-commit
Revision: 28318
  http://sourceforge.net/p/bibdesk/svn/28318
Author:   hofman
Date: 2023-07-16 14:45:24 + (Sun, 16 Jul 2023)
Log Message:
---
use -basePath from owner for local file fields

Modified Paths:
--
trunk/bibdesk/BibItem.m

Modified: trunk/bibdesk/BibItem.m
===
--- trunk/bibdesk/BibItem.m 2023-07-16 14:39:50 UTC (rev 28317)
+++ trunk/bibdesk/BibItem.m 2023-07-16 14:45:24 UTC (rev 28318)
@@ -2992,8 +2992,7 @@
 
 // check to see if it's a relative path
 if([localURLFieldValue isAbsolutePath] == NO){
-NSString *docPath = [[owner fileURL] path];
-NSString *basePath = [NSString isEmptyString:docPath] ? 
NSHomeDirectory() : [docPath stringByDeletingLastPathComponent];
+NSString *basePath = [owner basePath] ?: NSHomeDirectory();
 // It's a relative path from the containing document's path
 localURLFieldValue = [basePath 
stringByAppendingPathComponent:localURLFieldValue];
 }
@@ -3195,7 +3194,7 @@

if (nil == requiredFields || 
 ([NSString isEmptyString:[[NSUserDefaults standardUserDefaults] 
stringForKey:BDSKPapersFolderPathKey]] && 
-   [NSString isEmptyString:[[[owner fileURL] path] 
stringByDeletingLastPathComponent]]))
+   [NSString isEmptyString:[owner basePath]]))
return NO;

for (NSString *fieldName in requiredFields) {
@@ -3277,7 +3276,7 @@
 
 if (nil == requiredFields ||
 ([NSString isEmptyString:[[NSUserDefaults standardUserDefaults] 
stringForKey:BDSKPapersFolderPathKey]] &&
- [NSString isEmptyString:[[[owner fileURL] path] 
stringByDeletingLastPathComponent]]))
+ [NSString isEmptyString:[owner basePath]]))
 return NO;
 
 for (NSString *fieldName in requiredFields) {

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28319] trunk/bibdesk/BibItem.m

2023-07-16 Thread hofman--- via Bibdesk-commit
Revision: 28319
  http://sourceforge.net/p/bibdesk/svn/28319
Author:   hofman
Date: 2023-07-16 14:47:33 + (Sun, 16 Jul 2023)
Log Message:
---
fall back to local file value

Modified Paths:
--
trunk/bibdesk/BibItem.m

Modified: trunk/bibdesk/BibItem.m
===
--- trunk/bibdesk/BibItem.m 2023-07-16 14:45:24 UTC (rev 28318)
+++ trunk/bibdesk/BibItem.m 2023-07-16 14:47:33 UTC (rev 28319)
@@ -1930,7 +1930,7 @@
 value = [value stringByTeXifyingString];
 
 if(redirectRelPaths && [fileKeys containsObject:field] && [value 
hasCaseInsensitivePrefix:@"file://"] == NO && [value isAbsolutePath] == NO && 
[[self URLForField:field] checkResourceIsReachableAndReturnError:NULL])
-value = [[[self URLForField:field] path] 
relativePathFromPath:basePath];
+value = [[[self URLForField:field] path] 
relativePathFromPath:basePath] ?: value;
 
 // We used to keep empty strings in fields as markers for the 
editor; now they're generally nil
 BOOL isEmpty = [NSString isEmptyAsComplexString:value];

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28320] trunk/bibdesk

2023-07-16 Thread hofman--- via Bibdesk-commit
Revision: 28320
  http://sourceforge.net/p/bibdesk/svn/28320
Author:   hofman
Date: 2023-07-16 21:43:18 + (Sun, 16 Jul 2023)
Log Message:
---
only redirect relative paths in fields for SaveAs and SaveTo operations, not 
for any Autosave operation

Modified Paths:
--
trunk/bibdesk/BibDocument.h
trunk/bibdesk/BibDocument.m

Modified: trunk/bibdesk/BibDocument.h
===
--- trunk/bibdesk/BibDocument.h 2023-07-16 14:47:33 UTC (rev 28319)
+++ trunk/bibdesk/BibDocument.h 2023-07-16 21:43:18 UTC (rev 28320)
@@ -284,6 +284,7 @@
 NSDictionary *mainWindowSetupDictionary;
 
 NSURL *saveTargetURL;
+NSSaveOperationType currentSaveOperation;
 
 NSInvocation *shouldCloseInvocation;
 

Modified: trunk/bibdesk/BibDocument.m
===
--- trunk/bibdesk/BibDocument.m 2023-07-16 14:47:33 UTC (rev 28319)
+++ trunk/bibdesk/BibDocument.m 2023-07-16 21:43:18 UTC (rev 28320)
@@ -237,6 +237,9 @@
 // need to set this for new documents
 docState.documentStringEncoding = [BDSKStringEncodingManager 
defaultEncoding];
 
+saveTargetURL = nil;
+currentSaveOperation = NSNotFound;
+
 // these are created lazily when needed
 pboardHelper = nil;
 fileSearchController = nil;
@@ -1213,10 +1216,12 @@
 - (BOOL)writeSafelyToURL:(NSURL *)absoluteURL ofType:(NSString *)typeName 
forSaveOperation:(NSSaveOperationType)saveOperation error:(NSError **)outError;
 {
 saveTargetURL = [absoluteURL copy];
+currentSaveOperation = saveOperation;
 
 BOOL didSave = [super writeSafelyToURL:absoluteURL ofType:typeName 
forSaveOperation:saveOperation error:outError];
 
 BDSKDESTROY(saveTargetURL);
+currentSaveOperation = NSNotFound;
 
 if (didSave) {
 NSFileManager *fm = [NSFileManager defaultManager];
@@ -1430,7 +1435,7 @@
 options |= BDSKBibTeXOptionTeXify;
 if (drop)
 options |= BDSKBibTeXOptionDropInternal;
-if (aBasePath && [self fileURL] && [aBasePath isEqualToString:[self 
basePath]] == NO)
+if ((currentSaveOperation == NSSaveAsOperation || currentSaveOperation == 
NSSaveToOperation) && aBasePath && [self fileURL] && [aBasePath 
isEqualToString:[self basePath]] == NO)
 options |= BDSKBibTeXOptionRedirectRelativeFiles;
 
 if([[NSUserDefaults standardUserDefaults] 
boolForKey:BDSKShouldUseTemplateFileKey]){

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28321] trunk/bibdesk

2023-07-17 Thread hofman--- via Bibdesk-commit
Revision: 28321
  http://sourceforge.net/p/bibdesk/svn/28321
Author:   hofman
Date: 2023-07-17 08:49:09 + (Mon, 17 Jul 2023)
Log Message:
---
only redirect relative local file fields forExport, as the data will not change 
for Save As

Modified Paths:
--
trunk/bibdesk/BibDocument.h
trunk/bibdesk/BibDocument.m

Modified: trunk/bibdesk/BibDocument.h
===
--- trunk/bibdesk/BibDocument.h 2023-07-16 21:43:18 UTC (rev 28320)
+++ trunk/bibdesk/BibDocument.h 2023-07-17 08:49:09 UTC (rev 28321)
@@ -284,7 +284,6 @@
 NSDictionary *mainWindowSetupDictionary;
 
 NSURL *saveTargetURL;
-NSSaveOperationType currentSaveOperation;
 
 NSInvocation *shouldCloseInvocation;
 

Modified: trunk/bibdesk/BibDocument.m
===
--- trunk/bibdesk/BibDocument.m 2023-07-16 21:43:18 UTC (rev 28320)
+++ trunk/bibdesk/BibDocument.m 2023-07-17 08:49:09 UTC (rev 28321)
@@ -237,9 +237,6 @@
 // need to set this for new documents
 docState.documentStringEncoding = [BDSKStringEncodingManager 
defaultEncoding];
 
-saveTargetURL = nil;
-currentSaveOperation = NSNotFound;
-
 // these are created lazily when needed
 pboardHelper = nil;
 fileSearchController = nil;
@@ -1216,12 +1213,10 @@
 - (BOOL)writeSafelyToURL:(NSURL *)absoluteURL ofType:(NSString *)typeName 
forSaveOperation:(NSSaveOperationType)saveOperation error:(NSError **)outError;
 {
 saveTargetURL = [absoluteURL copy];
-currentSaveOperation = saveOperation;
 
 BOOL didSave = [super writeSafelyToURL:absoluteURL ofType:typeName 
forSaveOperation:saveOperation error:outError];
 
 BDSKDESTROY(saveTargetURL);
-currentSaveOperation = NSNotFound;
 
 if (didSave) {
 NSFileManager *fm = [NSFileManager defaultManager];
@@ -1435,7 +1430,7 @@
 options |= BDSKBibTeXOptionTeXify;
 if (drop)
 options |= BDSKBibTeXOptionDropInternal;
-if ((currentSaveOperation == NSSaveAsOperation || currentSaveOperation == 
NSSaveToOperation) && aBasePath && [self fileURL] && [aBasePath 
isEqualToString:[self basePath]] == NO)
+if (docFlags.isExporting && aBasePath && [self fileURL] && [aBasePath 
isEqualToString:[self basePath]] == NO)
 options |= BDSKBibTeXOptionRedirectRelativeFiles;
 
 if([[NSUserDefaults standardUserDefaults] 
boolForKey:BDSKShouldUseTemplateFileKey]){

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28322] trunk/bibdesk/BibDocument.m

2023-07-17 Thread hofman--- via Bibdesk-commit
Revision: 28322
  http://sourceforge.net/p/bibdesk/svn/28322
Author:   hofman
Date: 2023-07-17 09:15:42 + (Mon, 17 Jul 2023)
Log Message:
---
make sure base path from saved publications is compared

Modified Paths:
--
trunk/bibdesk/BibDocument.m

Modified: trunk/bibdesk/BibDocument.m
===
--- trunk/bibdesk/BibDocument.m 2023-07-17 08:49:09 UTC (rev 28321)
+++ trunk/bibdesk/BibDocument.m 2023-07-17 09:15:42 UTC (rev 28322)
@@ -1425,14 +1425,6 @@
 NSString *encodingName = [NSString localizedNameOfStringEncoding:encoding];
 NSStringEncoding groupsEncoding = [BDSKBibTeXParser 
isUnparseableEncoding:encoding] ? encoding : NSUTF8StringEncoding;
 
-BDSKBibTeXOption options = 0;
-if ([[NSUserDefaults standardUserDefaults] 
boolForKey:BDSKShouldTeXifyWhenSavingAndCopyingKey])
-options |= BDSKBibTeXOptionTeXify;
-if (drop)
-options |= BDSKBibTeXOptionDropInternal;
-if (docFlags.isExporting && aBasePath && [self fileURL] && [aBasePath 
isEqualToString:[self basePath]] == NO)
-options |= BDSKBibTeXOptionRedirectRelativeFiles;
-
 if([[NSUserDefaults standardUserDefaults] 
boolForKey:BDSKShouldUseTemplateFileKey]){
 NSMutableString *templateFile = [NSMutableString 
stringWithContentsOfFile:[[[NSUserDefaults standardUserDefaults] 
stringForKey:BDSKOutputTemplateFileKey] stringByExpandingTildeInPath] 
usedEncoding:NULL error:NULL] ?: [NSMutableString string];
 
@@ -1502,6 +1494,18 @@
 
 NSArray *pubs = [self publicationsForSaving];
 if ([pubs count] > 0) {
+BDSKBibTeXOption options = 0;
+if ([[NSUserDefaults standardUserDefaults] 
boolForKey:BDSKShouldTeXifyWhenSavingAndCopyingKey])
+options |= BDSKBibTeXOptionTeXify;
+if (drop)
+options |= BDSKBibTeXOptionDropInternal;
+if (docFlags.isExporting && aBasePath) {
+// exported pubs can come from an external group
+NSString *pubBasePath = [[[pubs firstObject] owner] basePath];
+if (pubBasePath && [aBasePath isEqualToString:pubBasePath] == NO)
+options |= BDSKBibTeXOptionRedirectRelativeFiles;
+}
+
 hasData = YES;
 for (BibItem *pub in pubs){
 if (isOK == NO) break;

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28323] trunk/bibdesk

2023-07-17 Thread hofman--- via Bibdesk-commit
Revision: 28323
  http://sourceforge.net/p/bibdesk/svn/28323
Author:   hofman
Date: 2023-07-17 14:16:45 + (Mon, 17 Jul 2023)
Log Message:
---
ignore temporary save target URL when duplicating

Modified Paths:
--
trunk/bibdesk/BibDocument.h
trunk/bibdesk/BibDocument.m

Modified: trunk/bibdesk/BibDocument.h
===
--- trunk/bibdesk/BibDocument.h 2023-07-17 09:15:42 UTC (rev 28322)
+++ trunk/bibdesk/BibDocument.h 2023-07-17 14:16:45 UTC (rev 28323)
@@ -268,6 +268,7 @@
 unsigned intisDocumentClosed:1;
 unsigned intisExporting:1;
 unsigned intisSaving:1;
+unsigned intisDuplicating:1;
 unsigned intaggregateImport:1;
 unsigned intdisplayMigrationAlert:1;
 unsigned intinOptionKeyState:1;

Modified: trunk/bibdesk/BibDocument.m
===
--- trunk/bibdesk/BibDocument.m 2023-07-17 09:15:42 UTC (rev 28322)
+++ trunk/bibdesk/BibDocument.m 2023-07-17 14:16:45 UTC (rev 28323)
@@ -1212,7 +1212,8 @@
 
 - (BOOL)writeSafelyToURL:(NSURL *)absoluteURL ofType:(NSString *)typeName 
forSaveOperation:(NSSaveOperationType)saveOperation error:(NSError **)outError;
 {
-saveTargetURL = [absoluteURL copy];
+if (docFlags.isDuplicating == NO)
+saveTargetURL = [absoluteURL copy];
 
 BOOL didSave = [super writeSafelyToURL:absoluteURL ofType:typeName 
forSaveOperation:saveOperation error:outError];
 
@@ -1253,7 +1254,10 @@
 
 - (id)duplicateAndReturnError:(NSError **)outError {
 [[NSDocumentController sharedDocumentController] willDuplicateTemplate:NO 
withEncoding:[self documentStringEncoding]];
-return [super duplicateAndReturnError:outError];
+docFlags.isDuplicating = YES;
+id doc = [super duplicateAndReturnError:outError];
+docFlags.isDuplicating = NO;
+return doc;
 }
 
 - (BOOL)writeArchiveToURL:(NSURL *)fileURL error:(NSError **)outError{

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28324] trunk/bibdesk/BibDocument.m

2023-07-17 Thread hofman--- via Bibdesk-commit
Revision: 28324
  http://sourceforge.net/p/bibdesk/svn/28324
Author:   hofman
Date: 2023-07-17 14:54:03 + (Mon, 17 Jul 2023)
Log Message:
---
completion handler as variable to avoid implementing code twice

Modified Paths:
--
trunk/bibdesk/BibDocument.m

Modified: trunk/bibdesk/BibDocument.m
===
--- trunk/bibdesk/BibDocument.m 2023-07-17 14:16:45 UTC (rev 28323)
+++ trunk/bibdesk/BibDocument.m 2023-07-17 14:54:03 UTC (rev 28324)
@@ -1161,22 +1161,20 @@
 if (completionHandler)
 completionHandler(errorOrNil);
 
-if (errorOrNil == nil && BDSKIsSaveOrSaveAsOperation(saveOperation)) {
-// rebuild metadata cache for this document whenever we save
-[[BDSKMetadataCacheQueue sharedQueue] 
saveMetadataCacheForPublications:[self publications] documentURL:absoluteURL 
isUpdate:BDSKIsSaveOperation(saveOperation)];
-[self runScriptHookWithName:BDSKScriptHookNameSaveDocument 
forPublications:nil completionHandler:^(BOOL cancelled){
-docFlags.isSaving = NO;
-if (shouldCloseInvocation) {
-[shouldCloseInvocation invoke];
-BDSKDESTROY(shouldCloseInvocation);
-}
-}];
-} else {
+void (^saveCompletionHandler)(BOOL) = ^(BOOL cancelled){
 docFlags.isSaving = NO;
 if (shouldCloseInvocation) {
 [shouldCloseInvocation invoke];
 BDSKDESTROY(shouldCloseInvocation);
 }
+};
+
+if (errorOrNil == nil && BDSKIsSaveOrSaveAsOperation(saveOperation)) {
+// rebuild metadata cache for this document whenever we save
+[[BDSKMetadataCacheQueue sharedQueue] 
saveMetadataCacheForPublications:[self publications] documentURL:absoluteURL 
isUpdate:BDSKIsSaveOperation(saveOperation)];
+[self runScriptHookWithName:BDSKScriptHookNameSaveDocument 
forPublications:nil completionHandler:saveCompletionHandler];
+} else {
+saveCompletionHandler(NO);
 }
 }];
 }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28325] trunk/bibdesk/BibDocument.m

2023-07-17 Thread hofman--- via Bibdesk-commit
Revision: 28325
  http://sourceforge.net/p/bibdesk/svn/28325
Author:   hofman
Date: 2023-07-17 15:04:27 + (Mon, 17 Jul 2023)
Log Message:
---
don't bother saving extended attributes to temporary file for duplication

Modified Paths:
--
trunk/bibdesk/BibDocument.m

Modified: trunk/bibdesk/BibDocument.m
===
--- trunk/bibdesk/BibDocument.m 2023-07-17 14:54:03 UTC (rev 28324)
+++ trunk/bibdesk/BibDocument.m 2023-07-17 15:04:27 UTC (rev 28325)
@@ -1217,7 +1217,7 @@
 
 BDSKDESTROY(saveTargetURL);
 
-if (didSave) {
+if (didSave && docFlags.isDuplicating == NO) {
 NSFileManager *fm = [NSFileManager defaultManager];
 NSStringEncoding encoding = NSUTF8StringEncoding;
 if ([self needsEncodingForType:typeName]) {

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28326] trunk/bibdesk

2023-07-18 Thread hofman--- via Bibdesk-commit
Revision: 28326
  http://sourceforge.net/p/bibdesk/svn/28326
Author:   hofman
Date: 2023-07-18 14:25:44 + (Tue, 18 Jul 2023)
Log Message:
---
remove an intermediate conveniene method and print selection through common 
method

Modified Paths:
--
trunk/bibdesk/BibDocument.h
trunk/bibdesk/BibDocument.m
trunk/bibdesk/BibDocument_Actions.m
trunk/bibdesk/BibDocument_DataSource.m

Modified: trunk/bibdesk/BibDocument.h
===
--- trunk/bibdesk/BibDocument.h 2023-07-17 15:04:27 UTC (rev 28325)
+++ trunk/bibdesk/BibDocument.h 2023-07-18 14:25:44 UTC (rev 28326)
@@ -349,7 +349,6 @@
 - (void)reportTemporaryCiteKeysForNewDocument:(BOOL)isNewFile;
 - (void)markAsImported;
 
-- (NSString *)bibTeXStringForPublications:(NSArray *)items;
 - (NSString *)bibTeXStringDroppingInternal:(BOOL)drop forPublications:(NSArray 
*)items;
 - (NSString *)previewBibTeXStringForPublications:(NSArray *)items;
 

Modified: trunk/bibdesk/BibDocument.m
===
--- trunk/bibdesk/BibDocument.m 2023-07-17 15:04:27 UTC (rev 28325)
+++ trunk/bibdesk/BibDocument.m 2023-07-18 14:25:44 UTC (rev 28326)
@@ -2027,10 +2027,6 @@
 #pragma mark -
 #pragma mark String representations
 
-- (NSString *)bibTeXStringForPublications:(NSArray *)items{
-   return [self bibTeXStringDroppingInternal:NO forPublications:items];
-}
-
 - (NSString *)bibTeXStringDroppingInternal:(BOOL)drop forPublications:(NSArray 
*)items{
 NSMutableString *s = [NSMutableString string];
BDSKBibTeXOption options = 0;
@@ -2583,7 +2579,7 @@
 #pragma mark Printing support
 
 - (NSPrintOperation *)printOperationWithSettings:(NSDictionary *)printSettings 
error:(NSError **)outError {
-NSString *string = [self bibTeXStringForPublications:[self publications]];
+NSString *string = [self bibTeXStringDroppingInternal:NO 
forPublications:[self publications]];
 NSAttributedString *attrString = [[[NSAttributedString alloc] 
initWithString:string attributeName:NSFontAttributeName attributeValue:[NSFont 
userFontOfSize:0.0]] autorelease];
 return [NSPrintOperation printOperationWithAttributedString:attrString 
printInfo:[self printInfo] settings:printSettings];
 }

Modified: trunk/bibdesk/BibDocument_Actions.m
===
--- trunk/bibdesk/BibDocument_Actions.m 2023-07-17 15:04:27 UTC (rev 28325)
+++ trunk/bibdesk/BibDocument_Actions.m 2023-07-18 14:25:44 UTC (rev 28326)
@@ -742,7 +742,7 @@
 }
 
 - (void)printPublications:(NSArray *)pubs {
-NSString *string = [self bibTeXStringForPublications:pubs];
+NSString *string = [self bibTeXStringDroppingInternal:NO 
forPublications:pubs];
 NSAttributedString *attrString = [[[NSAttributedString alloc] 
initWithString:string attributeName:NSFontAttributeName attributeValue:[NSFont 
userFontOfSize:0.0]] autorelease];
 NSPrintOperation *printOp = [NSPrintOperation 
printOperationWithAttributedString:attrString printInfo:[self printInfo] 
settings:nil];
 [printOp runOperationModalForWindow:documentWindow delegate:nil 
didRunSelector:NULL contextInfo:NULL];
@@ -750,10 +750,7 @@
 
 - (IBAction)printSelection:(id)sender {
 NSArray *pubs = [self numberOfSelectedPubs] == 0 ? groupedPublications : 
[self selectedPublications];
-NSString *string = [self bibTeXStringForPublications:pubs];
-NSAttributedString *attrString = [[[NSAttributedString alloc] 
initWithString:string attributeName:NSFontAttributeName attributeValue:[NSFont 
userFontOfSize:0.0]] autorelease];
-NSPrintOperation *printOp = [NSPrintOperation 
printOperationWithAttributedString:attrString printInfo:[self printInfo] 
settings:nil];
-[printOp runOperationModalForWindow:documentWindow delegate:nil 
didRunSelector:NULL contextInfo:NULL];
+[self printPublications:pubs];
 }
 
 - (IBAction)changeFlag:(id)sender {

Modified: trunk/bibdesk/BibDocument_DataSource.m
===
--- trunk/bibdesk/BibDocument_DataSource.m  2023-07-17 15:04:27 UTC (rev 
28325)
+++ trunk/bibdesk/BibDocument_DataSource.m  2023-07-18 14:25:44 UTC (rev 
28326)
@@ -440,7 +440,7 @@

switch(dragCopyType){
case BDSKDragCopyBibTeX:
-   text = [self bibTeXStringForPublications:pubs];
+text = [self bibTeXStringDroppingInternal:NO forPublications:pubs];
break;
case BDSKDragCopyCite:
text = [self citeStringForPublications:pubs 
citeString:citeString];

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28327] trunk/bibdesk/BibDocument.m

2023-07-19 Thread hofman--- via Bibdesk-commit
Revision: 28327
  http://sourceforge.net/p/bibdesk/svn/28327
Author:   hofman
Date: 2023-07-19 15:58:31 + (Wed, 19 Jul 2023)
Log Message:
---
use NSChangeReadOtherContents and set displayName when opening document with 
filter or tmp keys

Modified Paths:
--
trunk/bibdesk/BibDocument.m

Modified: trunk/bibdesk/BibDocument.m
===
--- trunk/bibdesk/BibDocument.m 2023-07-18 14:25:44 UTC (rev 28326)
+++ trunk/bibdesk/BibDocument.m 2023-07-19 15:58:31 UTC (rev 28327)
@@ -1975,7 +1975,10 @@
 #pragma mark -
 
 - (void)markAsImported {
+NSString *fileName = [[[self fileURL] lastPathComponent] 
stringByDeletingPathExtension];
 [self setFileURL:nil];
+if (fileName)
+[self setDisplayName:fileName];
 // set date-added for imports
 NSDate *importDate = [NSDate date];
 NSString *importDateDescription = [importDate standardDescription];
@@ -1983,7 +1986,7 @@
 [pub markNeWithDate:importDate description:importDateDescription];
 [[self undoManager] removeAllActions];
 // mark as dirty, since we've changed the content
-[self updateChangeCount:NSChangeDone];
+[self updateChangeCount:NSChangeReadOtherContents];
 }
 
 - (void)generateForTemporaryCiteKey:(NSString *)tmpKey {

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28328] trunk/bibdesk

2023-07-19 Thread hofman--- via Bibdesk-commit
Revision: 28328
  http://sourceforge.net/p/bibdesk/svn/28328
Author:   hofman
Date: 2023-07-19 16:38:54 + (Wed, 19 Jul 2023)
Log Message:
---
open documents from filter or tmp cite keys without fileURL

Modified Paths:
--
trunk/bibdesk/BDSKDocumentController.m
trunk/bibdesk/BibDocument.m

Modified: trunk/bibdesk/BDSKDocumentController.m
===
--- trunk/bibdesk/BDSKDocumentController.m  2023-07-19 15:58:31 UTC (rev 
28327)
+++ trunk/bibdesk/BDSKDocumentController.m  2023-07-19 16:38:54 UTC (rev 
28328)
@@ -350,8 +350,10 @@
 NSURL *tmpFileURL = [[NSFileManager defaultManager] 
temporaryFileURLWithBasename:tmpFileName];
 
 if ([filteredString writeToURL:tmpFileURL atomically:YES 
encoding:encoding error:outError]) {
-if ((doc = [super makeDocumentWithContentsOfURL:tmpFileURL 
ofType:BDSKBibTeXDocumentType error:outError]))
+if ((doc = [super makeDocumentForURL:nil 
withContentsOfURL:tmpFileURL ofType:BDSKBibTeXDocumentType error:outError])) {
+[doc setDisplayName:[[absoluteURL lastPathComponent] 
stringByDeletingPathExtension]];
 [(BibDocument *)doc markAsImported];
+}
 [[NSFileManager defaultManager] removeItemAtPath:[tmpFileURL 
path] error:NULL];
 }
 }

Modified: trunk/bibdesk/BibDocument.m
===
--- trunk/bibdesk/BibDocument.m 2023-07-19 15:58:31 UTC (rev 28327)
+++ trunk/bibdesk/BibDocument.m 2023-07-19 16:38:54 UTC (rev 28328)
@@ -1975,16 +1975,11 @@
 #pragma mark -
 
 - (void)markAsImported {
-NSString *fileName = [[[self fileURL] lastPathComponent] 
stringByDeletingPathExtension];
-[self setFileURL:nil];
-if (fileName)
-[self setDisplayName:fileName];
 // set date-added for imports
 NSDate *importDate = [NSDate date];
 NSString *importDateDescription = [importDate standardDescription];
 for (BibItem *pub in publications)
 [pub markNeWithDate:importDate description:importDateDescription];
-[[self undoManager] removeAllActions];
 // mark as dirty, since we've changed the content
 [self updateChangeCount:NSChangeReadOtherContents];
 }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28329] trunk/bibdesk/BibDocument.m

2023-07-19 Thread hofman--- via Bibdesk-commit
Revision: 28329
  http://sourceforge.net/p/bibdesk/svn/28329
Author:   hofman
Date: 2023-07-19 16:52:52 + (Wed, 19 Jul 2023)
Log Message:
---
no need to update change count, the initializer already does

Modified Paths:
--
trunk/bibdesk/BibDocument.m

Modified: trunk/bibdesk/BibDocument.m
===
--- trunk/bibdesk/BibDocument.m 2023-07-19 16:38:54 UTC (rev 28328)
+++ trunk/bibdesk/BibDocument.m 2023-07-19 16:52:52 UTC (rev 28329)
@@ -1980,8 +1980,6 @@
 NSString *importDateDescription = [importDate standardDescription];
 for (BibItem *pub in publications)
 [pub markNeWithDate:importDate description:importDateDescription];
-// mark as dirty, since we've changed the content
-[self updateChangeCount:NSChangeReadOtherContents];
 }
 
 - (void)generateForTemporaryCiteKey:(NSString *)tmpKey {

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28330] trunk/bibdesk

2023-07-19 Thread hofman--- via Bibdesk-commit
Revision: 28330
  http://sourceforge.net/p/bibdesk/svn/28330
Author:   hofman
Date: 2023-07-19 17:08:36 + (Wed, 19 Jul 2023)
Log Message:
---
mark items as imported in initializer override

Modified Paths:
--
trunk/bibdesk/BDSKDocumentController.m
trunk/bibdesk/BibDocument.h
trunk/bibdesk/BibDocument.m

Modified: trunk/bibdesk/BDSKDocumentController.m
===
--- trunk/bibdesk/BDSKDocumentController.m  2023-07-19 16:52:52 UTC (rev 
28329)
+++ trunk/bibdesk/BDSKDocumentController.m  2023-07-19 17:08:36 UTC (rev 
28330)
@@ -350,10 +350,8 @@
 NSURL *tmpFileURL = [[NSFileManager defaultManager] 
temporaryFileURLWithBasename:tmpFileName];
 
 if ([filteredString writeToURL:tmpFileURL atomically:YES 
encoding:encoding error:outError]) {
-if ((doc = [super makeDocumentForURL:nil 
withContentsOfURL:tmpFileURL ofType:BDSKBibTeXDocumentType error:outError])) {
-[doc setDisplayName:[[absoluteURL lastPathComponent] 
stringByDeletingPathExtension]];
-[(BibDocument *)doc markAsImported];
-}
+if ((doc = [self makeDocumentForURL:nil 
withContentsOfURL:tmpFileURL ofType:BDSKBibTeXDocumentType error:outError]))
+[doc setDisplayName:[tmpFileName 
stringByDeletingPathExtension]];
 [[NSFileManager defaultManager] removeItemAtPath:[tmpFileURL 
path] error:NULL];
 }
 }

Modified: trunk/bibdesk/BibDocument.h
===
--- trunk/bibdesk/BibDocument.h 2023-07-19 16:52:52 UTC (rev 28329)
+++ trunk/bibdesk/BibDocument.h 2023-07-19 17:08:36 UTC (rev 28330)
@@ -347,7 +347,6 @@
 - (BOOL)readFromBibTeXData:(NSData *)data string:(NSString *)string 
fromURL:(NSURL *)absoluteURL encoding:(NSStringEncoding)encoding error:(NSError 
**)outError;
 
 - (void)reportTemporaryCiteKeysForNewDocument:(BOOL)isNewFile;
-- (void)markAsImported;
 
 - (NSString *)bibTeXStringDroppingInternal:(BOOL)drop forPublications:(NSArray 
*)items;
 - (NSString *)previewBibTeXStringForPublications:(NSArray *)items;

Modified: trunk/bibdesk/BibDocument.m
===
--- trunk/bibdesk/BibDocument.m 2023-07-19 16:52:52 UTC (rev 28329)
+++ trunk/bibdesk/BibDocument.m 2023-07-19 17:08:36 UTC (rev 28330)
@@ -267,6 +267,18 @@
 
 - (void)encodeWithCoder:(NSCoder *)encoder {}
 
+- (id)initForURL:(NSURL *)urlOrNil withContentsOfURL:(NSURL *)contentsURL 
ofType:(NSString *)typeName error:(NSError * _Nullable *)outError {
+self = [super initForURL:urlOrNil withContentsOfURL:contentsURL 
ofType:typeName error:outError];
+if (self) {
+// set date-added for imports
+NSDate *importDate = [NSDate date];
+NSString *importDateDescription = [importDate standardDescription];
+for (BibItem *pub in publications)
+[pub markNeWithDate:importDate description:importDateDescription];
+}
+return self;
+}
+
 - (void)invalidateSearchFieldCellTimer{
 // AppKit bug workarounds:  NSSearchFieldCell's timer creates a retain 
cycle after typing in it, so we manually invalidate it when the document is 
deallocated to avoid leaking the cell and timer.  Further, if the insertion 
point is in the searchfield cell when the window closes, the field editor (and 
associated text system) and undo manager also leak, so we send -[documentWindow 
endEditingFor:nil] in windowWillClose:.
 id timer = [[searchField cell] valueForKey:@"_partialStringTimer"];
@@ -1974,14 +1986,6 @@
 
 #pragma mark -
 
-- (void)markAsImported {
-// set date-added for imports
-NSDate *importDate = [NSDate date];
-NSString *importDateDescription = [importDate standardDescription];
-for (BibItem *pub in publications)
-[pub markNeWithDate:importDate description:importDateDescription];
-}
-
 - (void)generateForTemporaryCiteKey:(NSString *)tmpKey {
 NSArray *selItems = [self selectedPublications];
 [self selectPublications:[[self publications] allItemsForCiteKey:tmpKey]];

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28331] trunk/bibdesk

2023-07-20 Thread hofman--- via Bibdesk-commit
Revision: 28331
  http://sourceforge.net/p/bibdesk/svn/28331
Author:   hofman
Date: 2023-07-20 09:18:19 + (Thu, 20 Jul 2023)
Log Message:
---
revert last commit, explicit set date added for filtered douments, not sure 
whether generic initializer is called for autosaving mecchanisms

Modified Paths:
--
trunk/bibdesk/BDSKDocumentController.m
trunk/bibdesk/BibDocument.h
trunk/bibdesk/BibDocument.m

Modified: trunk/bibdesk/BDSKDocumentController.m
===
--- trunk/bibdesk/BDSKDocumentController.m  2023-07-19 17:08:36 UTC (rev 
28330)
+++ trunk/bibdesk/BDSKDocumentController.m  2023-07-20 09:18:19 UTC (rev 
28331)
@@ -350,8 +350,10 @@
 NSURL *tmpFileURL = [[NSFileManager defaultManager] 
temporaryFileURLWithBasename:tmpFileName];
 
 if ([filteredString writeToURL:tmpFileURL atomically:YES 
encoding:encoding error:outError]) {
-if ((doc = [self makeDocumentForURL:nil 
withContentsOfURL:tmpFileURL ofType:BDSKBibTeXDocumentType error:outError]))
+if ((doc = [self makeDocumentForURL:nil 
withContentsOfURL:tmpFileURL ofType:BDSKBibTeXDocumentType error:outError])) {
 [doc setDisplayName:[tmpFileName 
stringByDeletingPathExtension]];
+[(BibDocument *)doc markAsImported];
+}
 [[NSFileManager defaultManager] removeItemAtPath:[tmpFileURL 
path] error:NULL];
 }
 }

Modified: trunk/bibdesk/BibDocument.h
===
--- trunk/bibdesk/BibDocument.h 2023-07-19 17:08:36 UTC (rev 28330)
+++ trunk/bibdesk/BibDocument.h 2023-07-20 09:18:19 UTC (rev 28331)
@@ -347,6 +347,7 @@
 - (BOOL)readFromBibTeXData:(NSData *)data string:(NSString *)string 
fromURL:(NSURL *)absoluteURL encoding:(NSStringEncoding)encoding error:(NSError 
**)outError;
 
 - (void)reportTemporaryCiteKeysForNewDocument:(BOOL)isNewFile;
+- (void)markAsImported;
 
 - (NSString *)bibTeXStringDroppingInternal:(BOOL)drop forPublications:(NSArray 
*)items;
 - (NSString *)previewBibTeXStringForPublications:(NSArray *)items;

Modified: trunk/bibdesk/BibDocument.m
===
--- trunk/bibdesk/BibDocument.m 2023-07-19 17:08:36 UTC (rev 28330)
+++ trunk/bibdesk/BibDocument.m 2023-07-20 09:18:19 UTC (rev 28331)
@@ -267,18 +267,6 @@
 
 - (void)encodeWithCoder:(NSCoder *)encoder {}
 
-- (id)initForURL:(NSURL *)urlOrNil withContentsOfURL:(NSURL *)contentsURL 
ofType:(NSString *)typeName error:(NSError * _Nullable *)outError {
-self = [super initForURL:urlOrNil withContentsOfURL:contentsURL 
ofType:typeName error:outError];
-if (self) {
-// set date-added for imports
-NSDate *importDate = [NSDate date];
-NSString *importDateDescription = [importDate standardDescription];
-for (BibItem *pub in publications)
-[pub markNeWithDate:importDate description:importDateDescription];
-}
-return self;
-}
-
 - (void)invalidateSearchFieldCellTimer{
 // AppKit bug workarounds:  NSSearchFieldCell's timer creates a retain 
cycle after typing in it, so we manually invalidate it when the document is 
deallocated to avoid leaking the cell and timer.  Further, if the insertion 
point is in the searchfield cell when the window closes, the field editor (and 
associated text system) and undo manager also leak, so we send -[documentWindow 
endEditingFor:nil] in windowWillClose:.
 id timer = [[searchField cell] valueForKey:@"_partialStringTimer"];
@@ -1986,6 +1974,14 @@
 
 #pragma mark -
 
+- (void)markAsImported {
+// set date-added for imports
+NSDate *importDate = [NSDate date];
+NSString *importDateDescription = [importDate standardDescription];
+for (BibItem *pub in publications)
+[pub markNeWithDate:importDate description:importDateDescription];
+}
+
 - (void)generateForTemporaryCiteKey:(NSString *)tmpKey {
 NSArray *selItems = [self selectedPublications];
 [self selectPublications:[[self publications] allItemsForCiteKey:tmpKey]];

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28332] trunk/bibdesk/BDSKDocumentController.m

2023-07-20 Thread hofman--- via Bibdesk-commit
Revision: 28332
  http://sourceforge.net/p/bibdesk/svn/28332
Author:   hofman
Date: 2023-07-20 14:47:29 + (Thu, 20 Jul 2023)
Log Message:
---
add number to temporary displayname when document with the displayname already 
exists

Modified Paths:
--
trunk/bibdesk/BDSKDocumentController.m

Modified: trunk/bibdesk/BDSKDocumentController.m
===
--- trunk/bibdesk/BDSKDocumentController.m  2023-07-20 09:18:19 UTC (rev 
28331)
+++ trunk/bibdesk/BDSKDocumentController.m  2023-07-20 14:47:29 UTC (rev 
28332)
@@ -351,7 +351,12 @@
 
 if ([filteredString writeToURL:tmpFileURL atomically:YES 
encoding:encoding error:outError]) {
 if ((doc = [self makeDocumentForURL:nil 
withContentsOfURL:tmpFileURL ofType:BDSKBibTeXDocumentType error:outError])) {
-[doc setDisplayName:[tmpFileName 
stringByDeletingPathExtension]];
+NSArray *displayNames = [[self documents] 
valueForKey:@"displayName"];
+NSString *displayName = [tmpFileName 
stringByDeletingPathExtension];
+NSInteger i = 1;
+while ([displayNames containsObject:displayName])
+displayName = [NSString stringWithFormat:@"%@ %ld", 
[tmpFileName stringByDeletingPathExtension], ++i];
+[doc setDisplayName:displayName];
 [(BibDocument *)doc markAsImported];
 }
 [[NSFileManager defaultManager] removeItemAtPath:[tmpFileURL 
path] error:NULL];

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28333] trunk/bibdesk_vendorsrc/amaxwell/FileView

2023-08-01 Thread hofman--- via Bibdesk-commit
Revision: 28333
  http://sourceforge.net/p/bibdesk/svn/28333
Author:   hofman
Date: 2023-08-01 14:14:07 + (Tue, 01 Aug 2023)
Log Message:
---
don't pass assume inside flag

Modified Paths:
--
trunk/bibdesk_vendorsrc/amaxwell/FileView/FVColorMenuView.m
trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVColorMenuView.m
===
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVColorMenuView.m 2023-07-20 
14:47:29 UTC (rev 28332)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVColorMenuView.m 2023-08-01 
14:14:07 UTC (rev 28333)
@@ -367,7 +367,7 @@
 
 for (c = 0; c < nc; c++) {
 
-NSTrackingAreaOptions options = NSTrackingMouseEnteredAndExited | 
NSTrackingActiveInKeyWindow | NSTrackingAssumeInside;
+NSTrackingAreaOptions options = NSTrackingMouseEnteredAndExited | 
NSTrackingActiveInKeyWindow;
 NSRect cellFrame = [self cellFrameAtRow:r column:c];
 NSTrackingArea *area = [[NSTrackingArea alloc] 
initWithRect:cellFrame options:options owner:self userInfo:nil];
 [self addTrackingArea:area];

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m
===
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m  2023-07-20 
14:47:29 UTC (rev 28332)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m  2023-08-01 
14:14:07 UTC (rev 28333)
@@ -1638,15 +1638,6 @@
 
 if (NSIsEmptyRect(rect) == NO) {
 // Finder doesn't show buttons unless it's the front app.  
If Finder is the front app, it shows them for any window, regardless of 
main/key state, so we'll do the same.
-BOOL mouseInside = NSPointInRect(mouseLoc, rect);
-
-if (mouseInside) {
-mouseIndex = i;
-options |= NSTrackingAssumeInside;
-} else {
-options &= ~NSTrackingAssumeInside;
-}
-
 NSTrackingArea *area = [[NSTrackingArea alloc] 
initWithRect:rect options:options owner:self userInfo:nil];
 [self addTrackingArea:area];
 [_trackingAreas addObject:area];
@@ -1672,10 +1663,6 @@
 
 if (_fvFlags.displayMode == FVDisplayModeGrid) {
 NSRect sliderRect = NSIntersectionRect([self _topSliderRect], 
visibleRect);
-if (NSPointInRect(mouseLoc, sliderRect))
-options |= NSTrackingAssumeInside;
-else
-options &= ~NSTrackingAssumeInside;
 _topSliderArea = [[NSTrackingArea alloc] initWithRect:sliderRect 
options:options owner:self userInfo:nil];
 [self addTrackingArea:_topSliderArea];
 sliderRect = NSIntersectionRect([self _bottomSliderRect], 
visibleRect);

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28334] trunk/bibdesk

2023-09-12 Thread hofman--- via Bibdesk-commit
Revision: 28334
  http://sourceforge.net/p/bibdesk/svn/28334
Author:   hofman
Date: 2023-09-12 14:37:54 + (Tue, 12 Sep 2023)
Log Message:
---
add smart group date condition comparison for a date in the current session

Modified Paths:
--
trunk/bibdesk/BDSKApplication.h
trunk/bibdesk/BDSKApplication.m
trunk/bibdesk/BDSKCondition.h
trunk/bibdesk/BDSKCondition.m
trunk/bibdesk/Base.lproj/BDSKCondition.xib
trunk/bibdesk/de.lproj/BDSKCondition.strings
trunk/bibdesk/en.lproj/BDSKCondition.strings
trunk/bibdesk/fr.lproj/BDSKCondition.strings

Modified: trunk/bibdesk/BDSKApplication.h
===
--- trunk/bibdesk/BDSKApplication.h 2023-08-01 14:14:07 UTC (rev 28333)
+++ trunk/bibdesk/BDSKApplication.h 2023-09-12 14:37:54 UTC (rev 28334)
@@ -40,8 +40,12 @@
 
 @protocol BDSKApplicationDelegate;
 
-@interface BDSKApplication : NSApplication
+@interface BDSKApplication : NSApplication {
+NSDate *launchDate;
+}
 
+@property (nonatomic, readonly) NSDate *launchDate;
+
 - (void)relaunch;
 
 - (id )delegate;

Modified: trunk/bibdesk/BDSKApplication.m
===
--- trunk/bibdesk/BDSKApplication.m 2023-08-01 14:14:07 UTC (rev 28333)
+++ trunk/bibdesk/BDSKApplication.m 2023-09-12 14:37:54 UTC (rev 28334)
@@ -46,6 +46,8 @@
 
 @implementation BDSKApplication
 
+@synthesize launchDate;
+
 // I don't know where else to do this
 // the documentation says applicationWillFinishLaunching:, but that comes too 
late
 - (id)init {
@@ -52,6 +54,9 @@
 self = [super init];
 if (!RUNNING_BEFORE(10_11))
 [NSFontManager setFontManagerFactory:[BDSKFontManager class]];
+if (self) {
+launchDate = [[NSDate alloc] init];
+}
 return self;
 }
 

Modified: trunk/bibdesk/BDSKCondition.h
===
--- trunk/bibdesk/BDSKCondition.h   2023-08-01 14:14:07 UTC (rev 28333)
+++ trunk/bibdesk/BDSKCondition.h   2023-09-12 14:37:54 UTC (rev 28334)
@@ -78,7 +78,8 @@
 BDSKDate, 
 BDSKAfterDate, 
 BDSKBeforeDate, 
-BDSKInDateRange
+BDSKInDateRange,
+BDSKThisSession
 };
 
 typedef NS_ENUM(NSInteger, BDSKFieldType) {

Modified: trunk/bibdesk/BDSKCondition.m
===
--- trunk/bibdesk/BDSKCondition.m   2023-08-01 14:14:07 UTC (rev 28333)
+++ trunk/bibdesk/BDSKCondition.m   2023-09-12 14:37:54 UTC (rev 28334)
@@ -46,6 +46,7 @@
 #import "BDSKCondition+Scripting.h"
 #import "NSColor_BDSKExtensions.h"
 #import "NSArray_BDSKExtensions.h"
+#import "BDSKApplication.h"
 
 
 @interface BDSKCondition (Private)
@@ -800,6 +801,10 @@
 *startDate = [dateValue startOfPeriod:BDSKPeriodDay];
 *endDate = [toDateValue startOfPeriod:BDSKPeriodDay byAdding:1];
 break;
+case BDSKThisSession:
+*startDate = [NSApp launchDate];
+*endDate = nil;
+break;
 }
 }
 

Modified: trunk/bibdesk/Base.lproj/BDSKCondition.xib
===
--- trunk/bibdesk/Base.lproj/BDSKCondition.xib  2023-08-01 14:14:07 UTC (rev 
28333)
+++ trunk/bibdesk/Base.lproj/BDSKCondition.xib  2023-09-12 14:37:54 UTC (rev 
28334)
@@ -1,9 +1,8 @@
 
-
+
 
 
-
-
+
 
 
 
@@ -155,6 +154,7 @@
 
 
 
+
 
 
 

Modified: trunk/bibdesk/de.lproj/BDSKCondition.strings
===
(Binary files differ)

Modified: trunk/bibdesk/en.lproj/BDSKCondition.strings
===
(Binary files differ)

Modified: trunk/bibdesk/fr.lproj/BDSKCondition.strings
===
(Binary files differ)

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28335] trunk/bibdesk

2023-09-12 Thread hofman--- via Bibdesk-commit
Revision: 28335
  http://sourceforge.net/p/bibdesk/svn/28335
Author:   hofman
Date: 2023-09-12 15:35:25 + (Tue, 12 Sep 2023)
Log Message:
---
interpret session smart group condition relative to opening the document rather 
than launching the app

Modified Paths:
--
trunk/bibdesk/BDSKApplication.h
trunk/bibdesk/BDSKApplication.m
trunk/bibdesk/BDSKCondition.m
trunk/bibdesk/BDSKSmartGroup.h
trunk/bibdesk/BibDocument.h
trunk/bibdesk/BibDocument.m

Modified: trunk/bibdesk/BDSKApplication.h
===
--- trunk/bibdesk/BDSKApplication.h 2023-09-12 14:37:54 UTC (rev 28334)
+++ trunk/bibdesk/BDSKApplication.h 2023-09-12 15:35:25 UTC (rev 28335)
@@ -40,12 +40,8 @@
 
 @protocol BDSKApplicationDelegate;
 
-@interface BDSKApplication : NSApplication {
-NSDate *launchDate;
-}
+@interface BDSKApplication : NSApplication
 
-@property (nonatomic, readonly) NSDate *launchDate;
-
 - (void)relaunch;
 
 - (id )delegate;

Modified: trunk/bibdesk/BDSKApplication.m
===
--- trunk/bibdesk/BDSKApplication.m 2023-09-12 14:37:54 UTC (rev 28334)
+++ trunk/bibdesk/BDSKApplication.m 2023-09-12 15:35:25 UTC (rev 28335)
@@ -46,8 +46,6 @@
 
 @implementation BDSKApplication
 
-@synthesize launchDate;
-
 // I don't know where else to do this
 // the documentation says applicationWillFinishLaunching:, but that comes too 
late
 - (id)init {
@@ -54,9 +52,6 @@
 self = [super init];
 if (!RUNNING_BEFORE(10_11))
 [NSFontManager setFontManagerFactory:[BDSKFontManager class]];
-if (self) {
-launchDate = [[NSDate alloc] init];
-}
 return self;
 }
 

Modified: trunk/bibdesk/BDSKCondition.m
===
--- trunk/bibdesk/BDSKCondition.m   2023-09-12 14:37:54 UTC (rev 28334)
+++ trunk/bibdesk/BDSKCondition.m   2023-09-12 15:35:25 UTC (rev 28335)
@@ -46,7 +46,7 @@
 #import "BDSKCondition+Scripting.h"
 #import "NSColor_BDSKExtensions.h"
 #import "NSArray_BDSKExtensions.h"
-#import "BDSKApplication.h"
+#import "BibDocument.h"
 
 
 @interface BDSKCondition (Private)
@@ -802,7 +802,7 @@
 *endDate = [toDateValue startOfPeriod:BDSKPeriodDay byAdding:1];
 break;
 case BDSKThisSession:
-*startDate = [NSApp launchDate];
+*startDate = [[group document] openDate];
 *endDate = nil;
 break;
 }

Modified: trunk/bibdesk/BDSKSmartGroup.h
===
--- trunk/bibdesk/BDSKSmartGroup.h  2023-09-12 14:37:54 UTC (rev 28334)
+++ trunk/bibdesk/BDSKSmartGroup.h  2023-09-12 15:35:25 UTC (rev 28335)
@@ -39,10 +39,11 @@
 #import 
 #import "BDSKGroup.h"
 
-@class BDSKFilter;
+@class BDSKFilter, BibDocument;
 
 @protocol BDSKSmartGroup 
 @property (nonatomic, readonly) BDSKFilter *filter;
+@property (nonatomic, readonly) BibDocument *document;
 @end
 
 @interface BDSKSmartGroup : BDSKMutableGroup  {

Modified: trunk/bibdesk/BibDocument.h
===
--- trunk/bibdesk/BibDocument.h 2023-09-12 14:37:54 UTC (rev 28334)
+++ trunk/bibdesk/BibDocument.h 2023-09-12 15:35:25 UTC (rev 28335)
@@ -223,6 +223,8 @@
 BDSKGroupsArray *groups;
 
 NSMutableArray *shownFiles;
+
+NSDate *openDate;

 #pragma mark Macros, Document Info and Front Matter variables
 
@@ -430,4 +432,6 @@
 
 @property (nonatomic, readonly) NSArray *sharingServices;
 
+@property (nonatomic, readonly) NSDate *openDate;
+
 @end

Modified: trunk/bibdesk/BibDocument.m
===
--- trunk/bibdesk/BibDocument.m 2023-09-12 14:37:54 UTC (rev 28334)
+++ trunk/bibdesk/BibDocument.m 2023-09-12 15:35:25 UTC (rev 28335)
@@ -186,7 +186,7 @@
 
 @implementation BibDocument
 
-@synthesize documentWindow, tableView, splitView, mainBox, mainView, 
controlContentView, statusBar, groupOutlineView, groupSplitView, 
groupActionButton, groupAddButton, groupButtonView, groupFieldMenu, 
sidePreviewTabView, sidePreviewTextView, sideFileView, sidePreviewButton, 
sidePreviewButtonView, bottomPreviewTabView, bottomPreviewTextView, 
bottomFileView, bottomPreviewButton, actionMenuButton, groupActionMenuButton, 
searchField, groupMenu, actionMenu, alternateCopyMenu, sharingMenu, 
publications, shownPublications, groups, documentInfo, macroResolver, basePath;
+@synthesize documentWindow, tableView, splitView, mainBox, mainView, 
controlContentView, statusBar, groupOutlineView, groupSplitView, 
groupActionButton, groupAddButton, groupButtonView, groupFieldMenu, 
sidePreviewTabView, sidePreviewTextView, sideFileView, sidePreviewButton, 
sidePreviewButtonView, bottomPreviewTabView, bottomPreviewTextView, 
bottomFileView, bottomPreviewButton, actionMenuButton, groupActionMenuButton, 

[Bibdesk-commit] SF.net SVN: bibdesk:[28336] trunk/bibdesk/BDSKCondition.m

2023-09-12 Thread hofman--- via Bibdesk-commit
Revision: 28336
  http://sourceforge.net/p/bibdesk/svn/28336
Author:   hofman
Date: 2023-09-12 21:52:15 + (Tue, 12 Sep 2023)
Log Message:
---
Get cached dates for smart group conditions lazily, the document may not be set 
yet when the group is set on the condition

Modified Paths:
--
trunk/bibdesk/BDSKCondition.m

Modified: trunk/bibdesk/BDSKCondition.m
===
--- trunk/bibdesk/BDSKCondition.m   2023-09-12 15:35:25 UTC (rev 28335)
+++ trunk/bibdesk/BDSKCondition.m   2023-09-12 21:52:15 UTC (rev 28336)
@@ -55,7 +55,8 @@
 - (void)setCachedEndDate:(NSDate *)newCachedDate;
 - (NSDate *)cachedStartDate;
 - (void)setCachedStartDate:(NSDate *)newCachedDate;
-- (void)updateCachedDates;
+- (void)invalidateCachedDates;
+- (void)getCachedDatesIfNeeded;
 - (void)getStartDate:(NSDate **)startDate endDate:(NSDate **)endDate;
 - (void)refreshCachedDate:(NSTimer *)timer;
 @end
@@ -216,6 +217,7 @@
return YES; // empty condition matches anything

 if ([self isDateCondition]) {
+[self getCachedDatesIfNeeded];
 
 NSDate *date = nil;
 if ([key isEqualToString:BDSKDateAddedString])
@@ -409,7 +411,7 @@
 [key release];
 key = [(newKey ?: @"") copy];
 if ([self isDateCondition] != wasDateCondition)
-[self updateCachedDates]; // remove the cached date and stop the 
timer
+[self invalidateCachedDates]; // remove the cached date and stop 
the timer
 }
 }
 
@@ -542,7 +544,7 @@
 - (void)setDateComparison:(BDSKDateComparison)newComparison {
 if (dateComparison != newComparison) {
 dateComparison = newComparison;
-[self updateCachedDates];
+[self invalidateCachedDates];
 }
 }
 
@@ -549,7 +551,7 @@
 - (void)setNumberValue:(NSInteger)newNumber {
 if (numberValue != newNumber) {
 numberValue = newNumber;
-[self updateCachedDates];
+[self invalidateCachedDates];
 }
 }
 
@@ -556,7 +558,7 @@
 - (void)setAndNumberValue:(NSInteger)newNumber {
 if (andNumberValue != newNumber) {
 andNumberValue = newNumber;
-[self updateCachedDates];
+[self invalidateCachedDates];
 }
 }
 
@@ -563,7 +565,7 @@
 - (void)setPeriodValue:(BDSKPeriod)newPeriod {
 if (periodValue != newPeriod) {
 periodValue = newPeriod;
-[self updateCachedDates];
+[self invalidateCachedDates];
 }
 }
 
@@ -575,7 +577,7 @@
 if (dateValue != newDate) {
 [dateValue release];
 dateValue = [newDate retain];
-[self updateCachedDates];
+[self invalidateCachedDates];
 }
 }
 
@@ -587,7 +589,7 @@
 if (toDateValue != newDate) {
 [toDateValue release];
 toDateValue = [newDate retain];
-[self updateCachedDates];
+[self invalidateCachedDates];
 }
 }
 
@@ -655,7 +657,7 @@
 if (group != newGroup) {
 group = newGroup;
 if ([self isDateCondition])
-[self updateCachedDates];
+[self invalidateCachedDates];
 }
 }
 
@@ -697,23 +699,29 @@
}
 }
 
-- (void)updateCachedDates {
+- (void)invalidateCachedDates {
+[cacheTimer invalidate];
+cacheTimer = nil;
+
+[self setCachedStartDate:nil];
+[self setCachedEndDate:nil];
+}
+
+- (void)getCachedDatesIfNeeded {
+if ([self isDateCondition] == NO || group == nil || cachedStartDate || 
cachedEndDate)
+return;
+
 NSDate *startDate = nil;
 NSDate *endDate = nil;
 
-[cacheTimer invalidate];
-cacheTimer = nil;
-
-if ([self isDateCondition]) {
-[self getStartDate:&startDate endDate:&endDate];
-if (dateComparison < BDSKDate && group) {
-// we fire every day at 1 second past midnight, because the 
condition changes at midnight
-NSTimeInterval refreshInterval = 24 * 3600;
-NSDate *fireDate = [[[NSDate date] startOfPeriod:BDSKPeriodDay] 
dateByAddingTimeInterval:refreshInterval + 1];
-cacheTimer = [[NSTimer alloc] initWithFireDate:fireDate 
interval:refreshInterval target:self selector:@selector(refreshCachedDate:) 
userInfo:NULL repeats:YES];
-[[NSRunLoop currentRunLoop] addTimer:cacheTimer 
forMode:NSDefaultRunLoopMode];
-[cacheTimer release];
-}
+[self getStartDate:&startDate endDate:&endDate];
+if (dateComparison < BDSKDate) {
+// we fire every day at 1 second past midnight, because the condition 
changes at midnight
+NSTimeInterval refreshInterval = 24 * 3600;
+NSDate *fireDate = [[[NSDate date] startOfPeriod:BDSKPeriodDay] 
dateByAddingTimeInterval:refreshInterval + 1];
+cacheTimer = [[NSTimer alloc] initWithFireDate:fireDate 
interval:refreshInterval target:self selector:@selector(refreshCachedDate:) 
userInfo:NULL repeats:YES];
+[[NSRunLoop currentRunLoop] addTimer:cacheTimer 
forMode:NSDefaul

[Bibdesk-commit] SF.net SVN: bibdesk:[28337] trunk/bibdesk/BDSKCondition.m

2023-09-13 Thread hofman--- via Bibdesk-commit
Revision: 28337
  http://sourceforge.net/p/bibdesk/svn/28337
Author:   hofman
Date: 2023-09-13 08:57:00 + (Wed, 13 Sep 2023)
Log Message:
---
no need for cahced date accessors and some declarations

Modified Paths:
--
trunk/bibdesk/BDSKCondition.m

Modified: trunk/bibdesk/BDSKCondition.m
===
--- trunk/bibdesk/BDSKCondition.m   2023-09-12 21:52:15 UTC (rev 28336)
+++ trunk/bibdesk/BDSKCondition.m   2023-09-13 08:57:00 UTC (rev 28337)
@@ -49,16 +49,10 @@
 #import "BibDocument.h"
 
 
-@interface BDSKCondition (Private)
+@interface BDSKCondition ()
 - (BOOL)item:(BibItem *)item isContainedInGroupForField:(NSString *)field;
-- (NSDate *)cachedEndDate;
-- (void)setCachedEndDate:(NSDate *)newCachedDate;
-- (NSDate *)cachedStartDate;
-- (void)setCachedStartDate:(NSDate *)newCachedDate;
 - (void)invalidateCachedDates;
 - (void)getCachedDatesIfNeeded;
-- (void)getStartDate:(NSDate **)startDate endDate:(NSDate **)endDate;
-- (void)refreshCachedDate:(NSTimer *)timer;
 @end
 
 @implementation BDSKCondition
@@ -661,10 +655,6 @@
 }
 }
 
-@end
-
-@implementation BDSKCondition (Private)
-
 - (BOOL)item:(BibItem *)item isContainedInGroupForField:(NSString *)field {
 id value = stringValue;
 if ([field isPersonField]) {
@@ -677,86 +667,6 @@
 
 #pragma mark Cached dates
 
-- (NSDate *)cachedEndDate {
-return cachedEndDate;
-}
-
-- (void)setCachedEndDate:(NSDate *)newCachedDate {
-if (cachedEndDate != newCachedDate) {
-[cachedEndDate release];
-cachedEndDate = [newCachedDate retain];
-   }
-}
-
-- (NSDate *)cachedStartDate {
-return cachedStartDate;
-}
-
-- (void)setCachedStartDate:(NSDate *)newCachedDate {
-if (cachedStartDate != newCachedDate) {
-[cachedStartDate release];
-cachedStartDate = [newCachedDate retain];
-   }
-}
-
-- (void)invalidateCachedDates {
-[cacheTimer invalidate];
-cacheTimer = nil;
-
-[self setCachedStartDate:nil];
-[self setCachedEndDate:nil];
-}
-
-- (void)getCachedDatesIfNeeded {
-if ([self isDateCondition] == NO || group == nil || cachedStartDate || 
cachedEndDate)
-return;
-
-NSDate *startDate = nil;
-NSDate *endDate = nil;
-
-[self getStartDate:&startDate endDate:&endDate];
-if (dateComparison < BDSKDate) {
-// we fire every day at 1 second past midnight, because the condition 
changes at midnight
-NSTimeInterval refreshInterval = 24 * 3600;
-NSDate *fireDate = [[[NSDate date] startOfPeriod:BDSKPeriodDay] 
dateByAddingTimeInterval:refreshInterval + 1];
-cacheTimer = [[NSTimer alloc] initWithFireDate:fireDate 
interval:refreshInterval target:self selector:@selector(refreshCachedDate:) 
userInfo:NULL repeats:YES];
-[[NSRunLoop currentRunLoop] addTimer:cacheTimer 
forMode:NSDefaultRunLoopMode];
-[cacheTimer release];
-}
-
-[self setCachedStartDate:startDate];
-[self setCachedEndDate:endDate];
-}
-
-static BOOL differentDates(NSDate *date1, NSDate *date2) {
-if (date1 == nil)
-return date2 != nil;
-else if (date2 == nil)
-return date1 != nil;
-else
-return [date1 compare:date2] != NSOrderedSame;
-}
-
-- (void)refreshCachedDate:(NSTimer *)timer {
-NSDate *startDate = nil;
-NSDate *endDate = nil;
-BOOL changed = NO;
-
-   [self getStartDate:&startDate endDate:&endDate];
-if (differentDates(cachedStartDate, startDate)) {
-[self setCachedStartDate:startDate];
-changed = YES;
-}
-if (differentDates(cachedEndDate, endDate)) {
-[self setCachedEndDate:endDate];
-changed = YES;
-}
-
-if (changed && group) {
-   [[NSNotificationCenter defaultCenter] 
postNotificationName:BDSKFilterChangedNotification object:group];
-}
-}
-
 - (void)getStartDate:(NSDate **)startDate endDate:(NSDate **)endDate {
 NSDate *today = [NSDate date];
 
@@ -765,43 +675,43 @@
 *startDate = [today startOfPeriod:BDSKPeriodDay];
 *endDate = nil;
 break;
-case BDSKYesterday: 
+case BDSKYesterday:
 *startDate = [today startOfPeriod:BDSKPeriodDay byAdding:-1];
 *endDate = [today startOfPeriod:BDSKPeriodDay];
 break;
-case BDSKThisWeek: 
+case BDSKThisWeek:
 *startDate = [today startOfPeriod:BDSKPeriodWeek];
 *endDate = nil;
 break;
-case BDSKLastWeek: 
+case BDSKLastWeek:
 *startDate = [today startOfPeriod:BDSKPeriodWeek byAdding:-1];
 *endDate = [today startOfPeriod:BDSKPeriodWeek];
 break;
-case BDSKExactly: 
+case BDSKExactly:
 *startDate = [today startOfPeriod:periodValue 
byAdding:-numberValue];
 *endDate = [today startOfPeriod:periodValue 
byAdding:1-numberValue];
 break;

[Bibdesk-commit] SF.net SVN: bibdesk:[28338] trunk/bibdesk

2023-09-13 Thread hofman--- via Bibdesk-commit
Revision: 28338
  http://sourceforge.net/p/bibdesk/svn/28338
Author:   hofman
Date: 2023-09-13 14:15:40 + (Wed, 13 Sep 2023)
Log Message:
---
Don't set default comparison and value in setKey: for condition. Instead, set 
them in controller when not undoing/redoing and type changes. Otherwise KVO and 
binding gets confused, because primitiveKey did not trigger KVO for key.

Modified Paths:
--
trunk/bibdesk/BDSKCondition+Scripting.m
trunk/bibdesk/BDSKCondition.h
trunk/bibdesk/BDSKCondition.m
trunk/bibdesk/BDSKConditionController.m

Modified: trunk/bibdesk/BDSKCondition+Scripting.m
===
--- trunk/bibdesk/BDSKCondition+Scripting.m 2023-09-13 08:57:00 UTC (rev 
28337)
+++ trunk/bibdesk/BDSKCondition+Scripting.m 2023-09-13 14:15:40 UTC (rev 
28338)
@@ -91,6 +91,7 @@
 
 NSNumber *comparisonNumber = [properties 
objectForKey:@"scriptingComparison"];
 if (comparisonNumber == nil) {
+[self setDefaultComparison];
 } else if ([self isDateCondition]) {
 switch ([comparisonNumber unsignedIntValue]) {
 case BDSKScriptingToday:   [self 
setDateComparison:BDSKToday]; break; 
@@ -157,6 +158,7 @@
 if ([newValue isEqual:[NSNull null]])
 newValue = nil;
 if (newValue == nil) {
+[self setDefaultValue];
 } else if ([self isDateCondition]) {
 if ([newValue isKindOfClass:[NSDictionary class]]) {
 id value;

Modified: trunk/bibdesk/BDSKCondition.h
===
--- trunk/bibdesk/BDSKCondition.h   2023-09-13 08:57:00 UTC (rev 28337)
+++ trunk/bibdesk/BDSKCondition.h   2023-09-13 14:15:40 UTC (rev 28338)
@@ -127,8 +127,6 @@
 @property (nonatomic, retain) NSString *value;
 @property (nonatomic) NSInteger comparison;
 
-@property (nonatomic, retain) NSString *primitiveKey;
-
 // String accessors
 @property (nonatomic) BDSKStringComparison stringComparison;
 @property (nonatomic, retain) NSString *stringValue;

Modified: trunk/bibdesk/BDSKCondition.m
===
--- trunk/bibdesk/BDSKCondition.m   2023-09-13 08:57:00 UTC (rev 28337)
+++ trunk/bibdesk/BDSKCondition.m   2023-09-13 14:15:40 UTC (rev 28338)
@@ -58,7 +58,7 @@
 @implementation BDSKCondition
 
 @synthesize stringComparison, attachmentComparison, countValue, 
dateComparison, numberValue, andNumberValue, periodValue, group;
-@dynamic dictionaryValue, key, value, comparison, primitiveKey, stringValue, 
dateValue, toDateValue, dateCondition, attachmentCondition;
+@dynamic dictionaryValue, key, value, comparison, stringValue, dateValue, 
toDateValue, dateCondition, attachmentCondition;
 
 + (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key {
 NSSet *keyPaths = [super keyPathsForValuesAffectingValueForKey:key];
@@ -386,19 +386,6 @@
 }
 
 - (void)setKey:(NSString *)newKey {
-BDSKFieldType oldFieldType = [key fieldType];
-[self setPrimitiveKey:newKey];
-if (oldFieldType != [key fieldType]) {
-[self setDefaultComparison];
-[self setDefaultValue];
-}
-}
-
-- (NSString *)primitiveKey {
-return [[key retain] autorelease];
-}
-
-- (void)setPrimitiveKey:(NSString *)newKey {
 // we never want the key to be nil. It is set to nil sometimes by the 
binding mechanism
 if (key != newKey) {
 BOOL wasDateCondition = [self isDateCondition];

Modified: trunk/bibdesk/BDSKConditionController.m
===
--- trunk/bibdesk/BDSKConditionController.m 2023-09-13 08:57:00 UTC (rev 
28337)
+++ trunk/bibdesk/BDSKConditionController.m 2023-09-13 14:15:40 UTC (rev 
28338)
@@ -273,15 +273,22 @@
 id oldValue = [change objectForKey:NSKeyValueChangeOldKey];
 if (oldValue == [NSNull null])
 oldValue = nil;
-if ([keyPath isEqualToString:@"primitiveKey"]){
+if ([keyPath isEqualToString:@"key"]){
 NSString *newValue = [change 
objectForKey:NSKeyValueChangeNewKey];
+if ((id)newValue == [NSNull null])
+newValue = nil;
 BDSKFieldType oldFieldType = [oldValue fieldType];
 BDSKFieldType newFieldType = [newValue fieldType];
 if(MIN(oldFieldType, BDSKStringField) != MIN(newFieldType, 
BDSKStringField))
 [self layoutComparisonControls];
-if(oldFieldType != newFieldType)
+if(oldFieldType != newFieldType) {
 [self layoutValueControls];
-[[undoManager prepareWithInvocationTarget:condition] 
setPrimitiveKey:oldValue];
+if ([undoManager isUndoing] == NO && [undoManager 
isRedoing] == NO) {
+[object setDefault

[Bibdesk-commit] SF.net SVN: bibdesk:[28339] trunk/bibdesk/BDSKCondition+Scripting.m

2023-09-13 Thread hofman--- via Bibdesk-commit
Revision: 28339
  http://sourceforge.net/p/bibdesk/svn/28339
Author:   hofman
Date: 2023-09-13 14:26:12 + (Wed, 13 Sep 2023)
Log Message:
---
make sure default value is set on comparison from scripting

Modified Paths:
--
trunk/bibdesk/BDSKCondition+Scripting.m

Modified: trunk/bibdesk/BDSKCondition+Scripting.m
===
--- trunk/bibdesk/BDSKCondition+Scripting.m 2023-09-13 14:15:40 UTC (rev 
28338)
+++ trunk/bibdesk/BDSKCondition+Scripting.m 2023-09-13 14:26:12 UTC (rev 
28339)
@@ -157,8 +157,8 @@
 id newValue = [properties objectForKey:@"scriptingValue"];
 if ([newValue isEqual:[NSNull null]])
 newValue = nil;
+[self setDefaultValue];
 if (newValue == nil) {
-[self setDefaultValue];
 } else if ([self isDateCondition]) {
 if ([newValue isKindOfClass:[NSDictionary class]]) {
 id value;

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28340] trunk/bibdesk

2023-09-13 Thread hofman--- via Bibdesk-commit
Revision: 28340
  http://sourceforge.net/p/bibdesk/svn/28340
Author:   hofman
Date: 2023-09-13 14:38:03 + (Wed, 13 Sep 2023)
Log Message:
---
make sure default condition value is set, always for date or attachment 
conditions as they set multiple default values

Modified Paths:
--
trunk/bibdesk/BDSKCondition+Scripting.m
trunk/bibdesk/BDSKCondition.m

Modified: trunk/bibdesk/BDSKCondition+Scripting.m
===
--- trunk/bibdesk/BDSKCondition+Scripting.m 2023-09-13 14:26:12 UTC (rev 
28339)
+++ trunk/bibdesk/BDSKCondition+Scripting.m 2023-09-13 14:38:03 UTC (rev 
28340)
@@ -157,9 +157,10 @@
 id newValue = [properties objectForKey:@"scriptingValue"];
 if ([newValue isEqual:[NSNull null]])
 newValue = nil;
-[self setDefaultValue];
 if (newValue == nil) {
+[self setDefaultValue];
 } else if ([self isDateCondition]) {
+[self setDefaultValue];
 if ([newValue isKindOfClass:[NSDictionary class]]) {
 id value;
 if ((value = [newValue objectForKey:@"numberValue"])) {
@@ -181,6 +182,7 @@
 [cmd setScriptErrorString:@"Invalid value for smart 
condition."];
 }
 } else if ([self isAttachmentCondition]) {
+[self setDefaultValue];
 if ([newValue isKindOfClass:[NSNumber class]] || [newValue 
isKindOfClass:[NSString class]]) {
 switch ([self attachmentComparison]) {
 case BDSKCountEqual:

Modified: trunk/bibdesk/BDSKCondition.m
===
--- trunk/bibdesk/BDSKCondition.m   2023-09-13 14:26:12 UTC (rev 28339)
+++ trunk/bibdesk/BDSKCondition.m   2023-09-13 14:38:03 UTC (rev 28340)
@@ -113,7 +113,12 @@
// the order is important
 if (comparisonNumber != nil) 
[self setComparison:[comparisonNumber integerValue]];
+else
+[self setDefaultComparison];
 
+if (([self isDateCondition] || [self isAttachmentCondition]) || aValue 
== nil)
+[self setDefaultValue];
+
if (aValue != nil)
[self setValue:aValue];
 
@@ -138,6 +143,8 @@
// the order is important
[self setKey:[decoder decodeObjectForKey:@"key"]];
[self setComparison:[decoder 
decodeIntegerForKey:@"comparison"]];
+if ([self isDateCondition] || [self isAttachmentCondition])
+[self setDefaultValue];
[self setValue:[decoder decodeObjectForKey:@"value"]];
BDSKASSERT(key != nil);
BDSKASSERT([self value] != nil);
@@ -168,6 +175,8 @@
 // the order is important
[copy setKey:[self key]];
[copy setComparison:[self comparison]];
+if ([copy isDateCondition] || [copy isAttachmentCondition])
+[copy setDefaultValue];
[copy setValue:[self value]];
return copy;
 }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28341] trunk/bibdesk

2023-09-13 Thread hofman--- via Bibdesk-commit
Revision: 28341
  http://sourceforge.net/p/bibdesk/svn/28341
Author:   hofman
Date: 2023-09-13 16:23:42 + (Wed, 13 Sep 2023)
Log Message:
---
no need for separate method to add periods to date

Modified Paths:
--
trunk/bibdesk/NSDate_BDSKExtensions.h
trunk/bibdesk/NSDate_BDSKExtensions.m

Modified: trunk/bibdesk/NSDate_BDSKExtensions.h
===
--- trunk/bibdesk/NSDate_BDSKExtensions.h   2023-09-13 14:38:03 UTC (rev 
28340)
+++ trunk/bibdesk/NSDate_BDSKExtensions.h   2023-09-13 16:23:42 UTC (rev 
28341)
@@ -72,7 +72,6 @@
 - (NSString *)standardDescription;
 
 - (NSDate *)startOfPeriod:(BDSKPeriod)period;
-- (NSDate *)dateByAddingAmount:(NSInteger)offset ofPeriod:(BDSKPeriod)period;
 - (NSDate *)startOfPeriod:(BDSKPeriod)period byAdding:(NSInteger)offset;
 
 @end

Modified: trunk/bibdesk/NSDate_BDSKExtensions.m
===
--- trunk/bibdesk/NSDate_BDSKExtensions.m   2023-09-13 14:38:03 UTC (rev 
28340)
+++ trunk/bibdesk/NSDate_BDSKExtensions.m   2023-09-13 16:23:42 UTC (rev 
28341)
@@ -305,38 +305,36 @@
 return date;
 }
 
-- (NSDate *)dateByAddingAmount:(NSInteger)offset ofPeriod:(BDSKPeriod)period {
-NSDateComponents *components = [[NSDateComponents alloc] init];
-[components setDay:0];
-[components setMonth:0];
-[components setYear:0];
-switch (period) {
-case BDSKPeriodDay:
-[components setDay:offset];
-break;
-case BDSKPeriodWeek:
-[components setWeekday:0];
-[components setWeekOfYear:offset];
-[components setDay:NSUndefinedDateComponent];
-[components setMonth:NSUndefinedDateComponent];
-break;
-case BDSKPeriodMonth:
-[components setMonth:offset];
-break;
-case BDSKPeriodYear:
-[components setYear:offset];
-break;
-default:
-NSLog(@"Unknown period %ld", (long)period);
-break;
+- (NSDate *)startOfPeriod:(BDSKPeriod)period byAdding:(NSInteger)offset {
+NSDate *date = self;
+if (offset != 0) {
+NSDateComponents *components = [[NSDateComponents alloc] init];
+[components setDay:0];
+[components setMonth:0];
+[components setYear:0];
+switch (period) {
+case BDSKPeriodDay:
+[components setDay:offset];
+break;
+case BDSKPeriodWeek:
+[components setWeekday:0];
+[components setWeekOfYear:offset];
+[components setDay:NSUndefinedDateComponent];
+[components setMonth:NSUndefinedDateComponent];
+break;
+case BDSKPeriodMonth:
+[components setMonth:offset];
+break;
+case BDSKPeriodYear:
+[components setYear:offset];
+break;
+default:
+NSLog(@"Unknown period %ld", (long)period);
+break;
+}
+date = [[NSCalendar currentCalendar] dateByAddingComponents:components 
toDate:self options:0];
+[components release];
 }
-NSDate *date = [[NSCalendar currentCalendar] 
dateByAddingComponents:components toDate:self options:0];
-[components release];
-return date;
-}
-
-- (NSDate *)startOfPeriod:(BDSKPeriod)period byAdding:(NSInteger)offset {
-NSDate *date = offset == 0 ? self : [self dateByAddingAmount:offset 
ofPeriod:period];
 return [date startOfPeriod:period];
 }
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28342] trunk/bibdesk/NSDate_BDSKExtensions.m

2023-09-13 Thread hofman--- via Bibdesk-commit
Revision: 28342
  http://sourceforge.net/p/bibdesk/svn/28342
Author:   hofman
Date: 2023-09-13 17:07:35 + (Wed, 13 Sep 2023)
Log Message:
---
use calendar for offset of date by one week for workaround

Modified Paths:
--
trunk/bibdesk/NSDate_BDSKExtensions.m

Modified: trunk/bibdesk/NSDate_BDSKExtensions.m
===
--- trunk/bibdesk/NSDate_BDSKExtensions.m   2023-09-13 16:23:42 UTC (rev 
28341)
+++ trunk/bibdesk/NSDate_BDSKExtensions.m   2023-09-13 17:07:35 UTC (rev 
28342)
@@ -270,12 +270,19 @@
 NSUInteger unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit;
 unitFlags |= period == BDSKPeriodWeek ? NSWeekCalendarUnit : 
NSDayCalendarUnit;
 NSDateComponents *components = [calendar components:unitFlags 
fromDate:self];
-BOOL needsWorkaround = NO;
+NSDateComponents *weekOffset = nil;
 
 // workaround for a known bug, week is 1 for last week of the year
 if (period == BDSKPeriodWeek && [components weekOfYear] == 1 && 
[components month] > 1) {
 components = [calendar components:unitFlags fromDate:[self 
dateByAddingTimeInterval:-7 * 24 * 3600]];
-needsWorkaround = YES;
+weekOffset = [[[NSDateComponents alloc] init] autorelease];
+[weekOffset setWeekday:0];
+[weekOffset setWeekOfYear:-1];
+[weekOffset setDay:NSUndefinedDateComponent];
+[weekOffset setMonth:NSUndefinedDateComponent];
+[weekOffset setYear:0];
+components = [calendar components:unitFlags fromDate:[calendar 
dateByAddingComponents:weekOffset toDate:self options:0]];
+[weekOffset setWeekOfYear:1];
 }
 [components setHour:0];
 [components setMinute:0];
@@ -300,8 +307,8 @@
 break;
 }
 NSDate *date = [calendar dateFromComponents:components];
-if (needsWorkaround)
-date = [date dateByAddingTimeInterval:7 * 24 * 3600];
+if (weekOffset)
+date = [calendar dateByAddingComponents:weekOffset toDate:date 
options:0];
 return date;
 }
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28343] trunk/bibdesk/NSDate_BDSKExtensions.m

2023-09-13 Thread hofman--- via Bibdesk-commit
Revision: 28343
  http://sourceforge.net/p/bibdesk/svn/28343
Author:   hofman
Date: 2023-09-13 22:51:58 + (Wed, 13 Sep 2023)
Log Message:
---
workaround for start of week for first partial week of the year, which is 
wrongly set to 52 rather than 0

Modified Paths:
--
trunk/bibdesk/NSDate_BDSKExtensions.m

Modified: trunk/bibdesk/NSDate_BDSKExtensions.m
===
--- trunk/bibdesk/NSDate_BDSKExtensions.m   2023-09-13 17:07:35 UTC (rev 
28342)
+++ trunk/bibdesk/NSDate_BDSKExtensions.m   2023-09-13 22:51:58 UTC (rev 
28343)
@@ -268,21 +268,31 @@
 - (NSDate *)startOfPeriod:(BDSKPeriod)period {
 NSCalendar *calendar = [NSCalendar currentCalendar];
 NSUInteger unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit;
-unitFlags |= period == BDSKPeriodWeek ? NSWeekCalendarUnit : 
NSDayCalendarUnit;
+unitFlags |= period == BDSKPeriodWeek ? NSWeekOfYearCalendarUnit | 
NSWeekdayCalendarUnit : NSDayCalendarUnit;
 NSDateComponents *components = [calendar components:unitFlags 
fromDate:self];
 NSDateComponents *weekOffset = nil;
 
-// workaround for a known bug, week is 1 for last week of the year
-if (period == BDSKPeriodWeek && [components weekOfYear] == 1 && 
[components month] > 1) {
-components = [calendar components:unitFlags fromDate:[self 
dateByAddingTimeInterval:-7 * 24 * 3600]];
-weekOffset = [[[NSDateComponents alloc] init] autorelease];
-[weekOffset setWeekday:0];
-[weekOffset setWeekOfYear:-1];
-[weekOffset setDay:NSUndefinedDateComponent];
-[weekOffset setMonth:NSUndefinedDateComponent];
-[weekOffset setYear:0];
-components = [calendar components:unitFlags fromDate:[calendar 
dateByAddingComponents:weekOffset toDate:self options:0]];
-[weekOffset setWeekOfYear:1];
+// workaround for a known bug, week is 1 for last week of the year, or 52 
for the first week of the year
+if (period == BDSKPeriodWeek) {
+if ([components weekOfYear] == 1 && [components month] > 1) {
+weekOffset = [[[NSDateComponents alloc] init] autorelease];
+[weekOffset setWeekday:0];
+[weekOffset setWeekOfYear:-1];
+[weekOffset setDay:NSUndefinedDateComponent];
+[weekOffset setMonth:NSUndefinedDateComponent];
+[weekOffset setYear:0];
+components = [calendar components:unitFlags fromDate:[calendar 
dateByAddingComponents:weekOffset toDate:self options:0]];
+[weekOffset setWeekOfYear:1];
+} else if ([components month] == 1 && [components weekOfYear] > 6) {
+weekOffset = [[[NSDateComponents alloc] init] autorelease];
+[weekOffset setWeekday:0];
+[weekOffset setWeekOfYear:1];
+[weekOffset setDay:NSUndefinedDateComponent];
+[weekOffset setMonth:NSUndefinedDateComponent];
+[weekOffset setYear:0];
+components = [calendar components:unitFlags fromDate:[calendar 
dateByAddingComponents:weekOffset toDate:self options:0]];
+[weekOffset setWeekOfYear:-1];
+}
 }
 [components setHour:0];
 [components setMinute:0];

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28344] trunk/bibdesk/NSDate_BDSKExtensions.m

2023-09-13 Thread hofman--- via Bibdesk-commit
Revision: 28344
  http://sourceforge.net/p/bibdesk/svn/28344
Author:   hofman
Date: 2023-09-13 22:54:39 + (Wed, 13 Sep 2023)
Log Message:
---
combine two workarounds

Modified Paths:
--
trunk/bibdesk/NSDate_BDSKExtensions.m

Modified: trunk/bibdesk/NSDate_BDSKExtensions.m
===
--- trunk/bibdesk/NSDate_BDSKExtensions.m   2023-09-13 22:51:58 UTC (rev 
28343)
+++ trunk/bibdesk/NSDate_BDSKExtensions.m   2023-09-13 22:54:39 UTC (rev 
28344)
@@ -273,26 +273,15 @@
 NSDateComponents *weekOffset = nil;
 
 // workaround for a known bug, week is 1 for last week of the year, or 52 
for the first week of the year
-if (period == BDSKPeriodWeek) {
-if ([components weekOfYear] == 1 && [components month] > 1) {
-weekOffset = [[[NSDateComponents alloc] init] autorelease];
-[weekOffset setWeekday:0];
-[weekOffset setWeekOfYear:-1];
-[weekOffset setDay:NSUndefinedDateComponent];
-[weekOffset setMonth:NSUndefinedDateComponent];
-[weekOffset setYear:0];
-components = [calendar components:unitFlags fromDate:[calendar 
dateByAddingComponents:weekOffset toDate:self options:0]];
-[weekOffset setWeekOfYear:1];
-} else if ([components month] == 1 && [components weekOfYear] > 6) {
-weekOffset = [[[NSDateComponents alloc] init] autorelease];
-[weekOffset setWeekday:0];
-[weekOffset setWeekOfYear:1];
-[weekOffset setDay:NSUndefinedDateComponent];
-[weekOffset setMonth:NSUndefinedDateComponent];
-[weekOffset setYear:0];
-components = [calendar components:unitFlags fromDate:[calendar 
dateByAddingComponents:weekOffset toDate:self options:0]];
-[weekOffset setWeekOfYear:-1];
-}
+if (period == BDSKPeriodWeek && (([components weekOfYear] == 1 && 
[components month] > 1) || ([components month] == 1 && [components weekOfYear] 
> 6))) {
+weekOffset = [[[NSDateComponents alloc] init] autorelease];
+[weekOffset setWeekday:0];
+[weekOffset setWeekOfYear:[components month] == 1 ? 1 : -1];
+[weekOffset setDay:NSUndefinedDateComponent];
+[weekOffset setMonth:NSUndefinedDateComponent];
+[weekOffset setYear:0];
+components = [calendar components:unitFlags fromDate:[calendar 
dateByAddingComponents:weekOffset toDate:self options:0]];
+[weekOffset setWeekOfYear:-[weekOffset weekOfYear]];
 }
 [components setHour:0];
 [components setMinute:0];

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28345] trunk/bibdesk/NSDate_BDSKExtensions.m

2023-09-14 Thread hofman--- via Bibdesk-commit
Revision: 28345
  http://sourceforge.net/p/bibdesk/svn/28345
Author:   hofman
Date: 2023-09-14 09:39:03 + (Thu, 14 Sep 2023)
Log Message:
---
use week of month unit to get start of the week rather than week of year, as 
that uses the correct values at the start and end of the month, while week of 
year gets wrong values at the start and end of the year.

Modified Paths:
--
trunk/bibdesk/NSDate_BDSKExtensions.m

Modified: trunk/bibdesk/NSDate_BDSKExtensions.m
===
--- trunk/bibdesk/NSDate_BDSKExtensions.m   2023-09-13 22:54:39 UTC (rev 
28344)
+++ trunk/bibdesk/NSDate_BDSKExtensions.m   2023-09-14 09:39:03 UTC (rev 
28345)
@@ -268,21 +268,9 @@
 - (NSDate *)startOfPeriod:(BDSKPeriod)period {
 NSCalendar *calendar = [NSCalendar currentCalendar];
 NSUInteger unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit;
-unitFlags |= period == BDSKPeriodWeek ? NSWeekOfYearCalendarUnit | 
NSWeekdayCalendarUnit : NSDayCalendarUnit;
+unitFlags |= period == BDSKPeriodWeek ? NSWeekOfMonthCalendarUnit | 
NSWeekdayCalendarUnit : NSDayCalendarUnit;
 NSDateComponents *components = [calendar components:unitFlags 
fromDate:self];
-NSDateComponents *weekOffset = nil;
 
-// workaround for a known bug, week is 1 for last week of the year, or 52 
for the first week of the year
-if (period == BDSKPeriodWeek && (([components weekOfYear] == 1 && 
[components month] > 1) || ([components month] == 1 && [components weekOfYear] 
> 6))) {
-weekOffset = [[[NSDateComponents alloc] init] autorelease];
-[weekOffset setWeekday:0];
-[weekOffset setWeekOfYear:[components month] == 1 ? 1 : -1];
-[weekOffset setDay:NSUndefinedDateComponent];
-[weekOffset setMonth:NSUndefinedDateComponent];
-[weekOffset setYear:0];
-components = [calendar components:unitFlags fromDate:[calendar 
dateByAddingComponents:weekOffset toDate:self options:0]];
-[weekOffset setWeekOfYear:-[weekOffset weekOfYear]];
-}
 [components setHour:0];
 [components setMinute:0];
 [components setSecond:0];
@@ -292,7 +280,6 @@
 break;
 case BDSKPeriodWeek:
 [components setWeekday:[calendar firstWeekday]];
-[components setMonth:NSUndefinedDateComponent];
 break;
 case BDSKPeriodMonth:
 [components setDay:1];
@@ -305,10 +292,7 @@
 NSLog(@"Unknown period %ld", (long)period);
 break;
 }
-NSDate *date = [calendar dateFromComponents:components];
-if (weekOffset)
-date = [calendar dateByAddingComponents:weekOffset toDate:date 
options:0];
-return date;
+return [calendar dateFromComponents:components];
 }
 
 - (NSDate *)startOfPeriod:(BDSKPeriod)period byAdding:(NSInteger)offset {

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28346] trunk/bibdesk/NSDate_BDSKExtensions.m

2023-09-14 Thread hofman--- via Bibdesk-commit
Revision: 28346
  http://sourceforge.net/p/bibdesk/svn/28346
Author:   hofman
Date: 2023-09-14 14:54:50 + (Thu, 14 Sep 2023)
Log Message:
---
use NSCalendarUnitYearForWeekOfYear to calculate the bstart of the week

Modified Paths:
--
trunk/bibdesk/NSDate_BDSKExtensions.m

Modified: trunk/bibdesk/NSDate_BDSKExtensions.m
===
--- trunk/bibdesk/NSDate_BDSKExtensions.m   2023-09-14 09:39:03 UTC (rev 
28345)
+++ trunk/bibdesk/NSDate_BDSKExtensions.m   2023-09-14 14:54:50 UTC (rev 
28346)
@@ -267,8 +267,11 @@
 
 - (NSDate *)startOfPeriod:(BDSKPeriod)period {
 NSCalendar *calendar = [NSCalendar currentCalendar];
-NSUInteger unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit;
-unitFlags |= period == BDSKPeriodWeek ? NSWeekOfMonthCalendarUnit | 
NSWeekdayCalendarUnit : NSDayCalendarUnit;
+NSUInteger unitFlags;
+if (period == BDSKPeriodWeek)
+unitFlags = NSCalendarUnitYearForWeekOfYear | NSCalendarUnitWeekOfYear;
+else
+unitFlags = NSCalendarUnitYear | NSCalendarUnitMonth | 
NSCalendarUnitDay;
 NSDateComponents *components = [calendar components:unitFlags 
fromDate:self];
 
 [components setHour:0];
@@ -309,8 +312,8 @@
 case BDSKPeriodWeek:
 [components setWeekday:0];
 [components setWeekOfYear:offset];
-[components setDay:NSUndefinedDateComponent];
-[components setMonth:NSUndefinedDateComponent];
+[components setDay:NSDateComponentUndefined];
+[components setMonth:NSDateComponentUndefined];
 break;
 case BDSKPeriodMonth:
 [components setMonth:offset];

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28347] trunk/bibdesk/NSDate_BDSKExtensions.m

2023-09-14 Thread hofman--- via Bibdesk-commit
Revision: 28347
  http://sourceforge.net/p/bibdesk/svn/28347
Author:   hofman
Date: 2023-09-14 21:47:53 + (Thu, 14 Sep 2023)
Log Message:
---
Add periods to date after getting start of period, so we can be sure we don't 
overflow.

Modified Paths:
--
trunk/bibdesk/NSDate_BDSKExtensions.m

Modified: trunk/bibdesk/NSDate_BDSKExtensions.m
===
--- trunk/bibdesk/NSDate_BDSKExtensions.m   2023-09-14 14:54:50 UTC (rev 
28346)
+++ trunk/bibdesk/NSDate_BDSKExtensions.m   2023-09-14 21:47:53 UTC (rev 
28347)
@@ -265,7 +265,7 @@
 return [formatter stringFromDate:self];
 }
 
-- (NSDate *)startOfPeriod:(BDSKPeriod)period {
+- (NSDate *)startOfPeriod:(BDSKPeriod)period byAdding:(NSInteger)offset {
 NSCalendar *calendar = [NSCalendar currentCalendar];
 NSUInteger unitFlags;
 if (period == BDSKPeriodWeek)
@@ -295,40 +295,37 @@
 NSLog(@"Unknown period %ld", (long)period);
 break;
 }
-return [calendar dateFromComponents:components];
-}
-
-- (NSDate *)startOfPeriod:(BDSKPeriod)period byAdding:(NSInteger)offset {
-NSDate *date = self;
+
+NSDate *date = [calendar dateFromComponents:components];
+
 if (offset != 0) {
-NSDateComponents *components = [[NSDateComponents alloc] init];
-[components setDay:0];
-[components setMonth:0];
-[components setYear:0];
+NSCalendarUnit unit = 0;
 switch (period) {
 case BDSKPeriodDay:
-[components setDay:offset];
+unit = NSCalendarUnitDay;
 break;
 case BDSKPeriodWeek:
-[components setWeekday:0];
-[components setWeekOfYear:offset];
-[components setDay:NSDateComponentUndefined];
-[components setMonth:NSDateComponentUndefined];
+unit = NSCalendarUnitWeekOfYear;
 break;
 case BDSKPeriodMonth:
-[components setMonth:offset];
+unit = NSCalendarUnitMonth;
 break;
 case BDSKPeriodYear:
-[components setYear:offset];
+unit = NSCalendarUnitYear;
 break;
 default:
 NSLog(@"Unknown period %ld", (long)period);
 break;
 }
-date = [[NSCalendar currentCalendar] dateByAddingComponents:components 
toDate:self options:0];
-[components release];
+if (unit != 0)
+date = [calendar dateByAddingUnit:unit value:offset toDate:date 
options:0];
 }
-return [date startOfPeriod:period];
+
+return date;
 }
 
+- (NSDate *)startOfPeriod:(BDSKPeriod)period {
+return [self startOfPeriod:period byAdding:0];
+}
+
 @end

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28348] trunk/bibdesk

2023-09-17 Thread hofman--- via Bibdesk-commit
Revision: 28348
  http://sourceforge.net/p/bibdesk/svn/28348
Author:   hofman
Date: 2023-09-17 15:32:04 + (Sun, 17 Sep 2023)
Log Message:
---
fire cached date timer for condition 1 sec after the end of the current period 
rather than  each day. Retain the timer to be sure.

Modified Paths:
--
trunk/bibdesk/BDSKCondition.m
trunk/bibdesk/NSDate_BDSKExtensions.h
trunk/bibdesk/NSDate_BDSKExtensions.m

Modified: trunk/bibdesk/BDSKCondition.m
===
--- trunk/bibdesk/BDSKCondition.m   2023-09-14 21:47:53 UTC (rev 28347)
+++ trunk/bibdesk/BDSKCondition.m   2023-09-17 15:32:04 UTC (rev 28348)
@@ -161,7 +161,7 @@
 - (void)dealloc {
//NSLog(@"dealloc condition");
 [cacheTimer invalidate];
-cacheTimer = nil;
+BDSKDESTROY(cacheTimer);
 BDSKDESTROY(key);
 BDSKDESTROY(stringValue);
 BDSKDESTROY(authorValue);
@@ -724,8 +724,7 @@
 
 - (void)invalidateCachedDates {
 [cacheTimer invalidate];
-cacheTimer = nil;
-
+BDSKDESTROY(cacheTimer);
 BDSKDESTROY(cachedStartDate);
 BDSKDESTROY(cachedEndDate);
 }
@@ -756,6 +755,12 @@
 changed = YES;
 }
 
+NSDate *fireDate = [[NSDate date] startOfPeriod:periodValue byAdding:1 
seconds:1];
+[cacheTimer invalidate];
+BDSKDESTROY(cacheTimer);
+cacheTimer = [[NSTimer alloc] initWithFireDate:fireDate interval:0.0 
target:self selector:@selector(refreshCachedDates:) userInfo:NULL repeats:NO];
+[[NSRunLoop currentRunLoop] addTimer:cacheTimer 
forMode:NSDefaultRunLoopMode];
+
 if (changed && group) {
 [[NSNotificationCenter defaultCenter] 
postNotificationName:BDSKFilterChangedNotification object:group];
 }
@@ -769,13 +774,11 @@
 NSDate *endDate = nil;
 
 [self getStartDate:&startDate endDate:&endDate];
-if (dateComparison < BDSKDate) {
-// we fire every day at 1 second past midnight, because the condition 
changes at midnight
-NSTimeInterval refreshInterval = 24 * 3600;
-NSDate *fireDate = [[[NSDate date] startOfPeriod:BDSKPeriodDay] 
dateByAddingTimeInterval:refreshInterval + 1];
-cacheTimer = [[NSTimer alloc] initWithFireDate:fireDate 
interval:refreshInterval target:self selector:@selector(refreshCachedDates:) 
userInfo:NULL repeats:YES];
+if (dateComparison < BDSKDate && (startDate || endDate)) {
+// we fire 1 second past midnight after the end of the current period, 
because the condition changes at midnight
+NSDate *fireDate = [[NSDate date] startOfPeriod:periodValue byAdding:1 
seconds:1];
+cacheTimer = [[NSTimer alloc] initWithFireDate:fireDate interval:0.0 
target:self selector:@selector(refreshCachedDates:) userInfo:NULL repeats:NO];
 [[NSRunLoop currentRunLoop] addTimer:cacheTimer 
forMode:NSDefaultRunLoopMode];
-[cacheTimer release];
 }
 
 cachedStartDate = [startDate retain];

Modified: trunk/bibdesk/NSDate_BDSKExtensions.h
===
--- trunk/bibdesk/NSDate_BDSKExtensions.h   2023-09-14 21:47:53 UTC (rev 
28347)
+++ trunk/bibdesk/NSDate_BDSKExtensions.h   2023-09-17 15:32:04 UTC (rev 
28348)
@@ -73,5 +73,6 @@
 
 - (NSDate *)startOfPeriod:(BDSKPeriod)period;
 - (NSDate *)startOfPeriod:(BDSKPeriod)period byAdding:(NSInteger)offset;
+- (NSDate *)startOfPeriod:(BDSKPeriod)period byAdding:(NSInteger)offset 
seconds:(NSInteger)seconds;
 
 @end

Modified: trunk/bibdesk/NSDate_BDSKExtensions.m
===
--- trunk/bibdesk/NSDate_BDSKExtensions.m   2023-09-14 21:47:53 UTC (rev 
28347)
+++ trunk/bibdesk/NSDate_BDSKExtensions.m   2023-09-17 15:32:04 UTC (rev 
28348)
@@ -265,7 +265,7 @@
 return [formatter stringFromDate:self];
 }
 
-- (NSDate *)startOfPeriod:(BDSKPeriod)period byAdding:(NSInteger)offset {
+- (NSDate *)startOfPeriod:(BDSKPeriod)period byAdding:(NSInteger)offset 
seconds:(NSInteger)seconds {
 NSCalendar *calendar = [NSCalendar currentCalendar];
 NSUInteger unitFlags;
 if (period == BDSKPeriodWeek)
@@ -299,33 +299,40 @@
 NSDate *date = [calendar dateFromComponents:components];
 
 if (offset != 0) {
-NSCalendarUnit unit = 0;
+components = [[NSDateComponents alloc] init];
+[components setHour:0];
+[components setMinute:0];
+[components setSecond:seconds];
 switch (period) {
 case BDSKPeriodDay:
-unit = NSCalendarUnitDay;
+[components setDay:offset];
 break;
 case BDSKPeriodWeek:
-unit = NSCalendarUnitWeekOfYear;
+[components setWeekOfYear:offset];
 break;
 case BDSKPeriodMonth:
-unit = NSCalendarUnitMonth;
+[components setMonth:offset];
 break;
 case BDSKPeriodYea

[Bibdesk-commit] SF.net SVN: bibdesk:[28349] trunk/bibdesk/NSDate_BDSKExtensions.m

2023-09-17 Thread hofman--- via Bibdesk-commit
Revision: 28349
  http://sourceforge.net/p/bibdesk/svn/28349
Author:   hofman
Date: 2023-09-17 21:39:57 + (Sun, 17 Sep 2023)
Log Message:
---
set seconds in components for beginning of period, no need to pass zero time 
componments for shift

Modified Paths:
--
trunk/bibdesk/NSDate_BDSKExtensions.m

Modified: trunk/bibdesk/NSDate_BDSKExtensions.m
===
--- trunk/bibdesk/NSDate_BDSKExtensions.m   2023-09-17 15:32:04 UTC (rev 
28348)
+++ trunk/bibdesk/NSDate_BDSKExtensions.m   2023-09-17 21:39:57 UTC (rev 
28349)
@@ -276,7 +276,7 @@
 
 [components setHour:0];
 [components setMinute:0];
-[components setSecond:0];
+[components setSecond:seconds];
 
 switch (period) {
 case BDSKPeriodDay:
@@ -300,9 +300,6 @@
 
 if (offset != 0) {
 components = [[NSDateComponents alloc] init];
-[components setHour:0];
-[components setMinute:0];
-[components setSecond:seconds];
 switch (period) {
 case BDSKPeriodDay:
 [components setDay:offset];

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28350] trunk/bibdesk

2023-09-18 Thread hofman--- via Bibdesk-commit
Revision: 28350
  http://sourceforge.net/p/bibdesk/svn/28350
Author:   hofman
Date: 2023-09-18 08:59:49 + (Mon, 18 Sep 2023)
Log Message:
---
set explicit dates for conditions to noon to allow for some wiggle room on 
timezone changes

Modified Paths:
--
trunk/bibdesk/BDSKCondition.m
trunk/bibdesk/NSDate_BDSKExtensions.h
trunk/bibdesk/NSDate_BDSKExtensions.m

Modified: trunk/bibdesk/BDSKCondition.m
===
--- trunk/bibdesk/BDSKCondition.m   2023-09-17 21:39:57 UTC (rev 28349)
+++ trunk/bibdesk/BDSKCondition.m   2023-09-18 08:59:49 UTC (rev 28350)
@@ -564,6 +564,7 @@
 }
 
 - (void)setDateValue:(NSDate *)newDate {
+newDate = [newDate startOfPeriod:BDSKPeriodDay byAdding:0 atHour:12 
minute:0 second:0];
 if (dateValue != newDate) {
 [dateValue release];
 dateValue = [newDate retain];
@@ -576,6 +577,7 @@
 }
 
 - (void)setToDateValue:(NSDate *)newDate {
+newDate = [newDate startOfPeriod:BDSKPeriodDay byAdding:0 atHour:12 
minute:0 second:0];
 if (toDateValue != newDate) {
 [toDateValue release];
 toDateValue = [newDate retain];
@@ -755,7 +757,7 @@
 changed = YES;
 }
 
-NSDate *fireDate = [[NSDate date] startOfPeriod:periodValue byAdding:1 
seconds:1];
+NSDate *fireDate = [[NSDate date] startOfPeriod:periodValue byAdding:1 
atHour:0 minute:0 second:1];
 [cacheTimer invalidate];
 BDSKDESTROY(cacheTimer);
 cacheTimer = [[NSTimer alloc] initWithFireDate:fireDate interval:0.0 
target:self selector:@selector(refreshCachedDates:) userInfo:NULL repeats:NO];
@@ -776,7 +778,7 @@
 [self getStartDate:&startDate endDate:&endDate];
 if (dateComparison < BDSKDate && (startDate || endDate)) {
 // we fire 1 second past midnight after the end of the current period, 
because the condition changes at midnight
-NSDate *fireDate = [[NSDate date] startOfPeriod:periodValue byAdding:1 
seconds:1];
+NSDate *fireDate = [[NSDate date] startOfPeriod:periodValue byAdding:1 
atHour:0 minute:0 second:1];
 cacheTimer = [[NSTimer alloc] initWithFireDate:fireDate interval:0.0 
target:self selector:@selector(refreshCachedDates:) userInfo:NULL repeats:NO];
 [[NSRunLoop currentRunLoop] addTimer:cacheTimer 
forMode:NSDefaultRunLoopMode];
 }

Modified: trunk/bibdesk/NSDate_BDSKExtensions.h
===
--- trunk/bibdesk/NSDate_BDSKExtensions.h   2023-09-17 21:39:57 UTC (rev 
28349)
+++ trunk/bibdesk/NSDate_BDSKExtensions.h   2023-09-18 08:59:49 UTC (rev 
28350)
@@ -73,6 +73,6 @@
 
 - (NSDate *)startOfPeriod:(BDSKPeriod)period;
 - (NSDate *)startOfPeriod:(BDSKPeriod)period byAdding:(NSInteger)offset;
-- (NSDate *)startOfPeriod:(BDSKPeriod)period byAdding:(NSInteger)offset 
seconds:(NSInteger)seconds;
+- (NSDate *)startOfPeriod:(BDSKPeriod)period byAdding:(NSInteger)offset 
atHour:(NSInteger)hour minute:(NSInteger)minute second:(NSInteger)second;
 
 @end

Modified: trunk/bibdesk/NSDate_BDSKExtensions.m
===
--- trunk/bibdesk/NSDate_BDSKExtensions.m   2023-09-17 21:39:57 UTC (rev 
28349)
+++ trunk/bibdesk/NSDate_BDSKExtensions.m   2023-09-18 08:59:49 UTC (rev 
28350)
@@ -265,7 +265,7 @@
 return [formatter stringFromDate:self];
 }
 
-- (NSDate *)startOfPeriod:(BDSKPeriod)period byAdding:(NSInteger)offset 
seconds:(NSInteger)seconds {
+- (NSDate *)startOfPeriod:(BDSKPeriod)period byAdding:(NSInteger)offset 
atHour:(NSInteger)hour minute:(NSInteger)minute second:(NSInteger)second {
 NSCalendar *calendar = [NSCalendar currentCalendar];
 NSUInteger unitFlags;
 if (period == BDSKPeriodWeek)
@@ -274,9 +274,9 @@
 unitFlags = NSCalendarUnitYear | NSCalendarUnitMonth | 
NSCalendarUnitDay;
 NSDateComponents *components = [calendar components:unitFlags 
fromDate:self];
 
-[components setHour:0];
-[components setMinute:0];
-[components setSecond:seconds];
+[components setHour:hour];
+[components setMinute:minute];
+[components setSecond:second];
 
 switch (period) {
 case BDSKPeriodDay:
@@ -325,11 +325,11 @@
 }
 
 - (NSDate *)startOfPeriod:(BDSKPeriod)period byAdding:(NSInteger)offset {
-return [self startOfPeriod:period byAdding:offset seconds:0];
+return [self startOfPeriod:period byAdding:offset atHour:0 minute:0 
second:0];
 }
 
 - (NSDate *)startOfPeriod:(BDSKPeriod)period {
-return [self startOfPeriod:period byAdding:0 seconds:0];
+return [self startOfPeriod:period byAdding:0 atHour:0 minute:0 second:0];
 }
 
 @end

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinf

[Bibdesk-commit] SF.net SVN: bibdesk:[28351] trunk/bibdesk/BDSKCondition.m

2023-09-18 Thread hofman--- via Bibdesk-commit
Revision: 28351
  http://sourceforge.net/p/bibdesk/svn/28351
Author:   hofman
Date: 2023-09-18 09:11:10 + (Mon, 18 Sep 2023)
Log Message:
---
combine statements

Modified Paths:
--
trunk/bibdesk/BDSKCondition.m

Modified: trunk/bibdesk/BDSKCondition.m
===
--- trunk/bibdesk/BDSKCondition.m   2023-09-18 08:59:49 UTC (rev 28350)
+++ trunk/bibdesk/BDSKCondition.m   2023-09-18 09:11:10 UTC (rev 28351)
@@ -276,10 +276,10 @@
 BDSKASSERT(stringValue != nil);
 
 if (stringComparison == BDSKGroupContain || stringComparison == 
BDSKGroupNotContain) {
+BOOL isContain = stringComparison == BDSKGroupContain;
 if ([key isEqualToString:BDSKAllFieldsString]) {
 if (authorValue == nil)
 authorValue = [[BibAuthor authorWithName:stringValue] 
retain];
-BOOL isContain = stringComparison == BDSKGroupContain;
 NSArray *fields = [item allFieldNames];
 if ([item crossrefParent] != nil) {
 NSMutableArray *tmpFields = [[fields mutableCopy] 
autorelease];
@@ -292,10 +292,7 @@
 }
 return NO == isContain;
 } else {
-if (stringComparison == BDSKGroupContain)
-return [self item:item isContainedInGroupForField:key];
-if (stringComparison == BDSKGroupNotContain) 
-return NO == [self item:item 
isContainedInGroupForField:key];
+return isContain == [self item:item 
isContainedInGroupForField:key];
 }
 }
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28352] trunk/bibdesk

2023-09-18 Thread hofman--- via Bibdesk-commit
Revision: 28352
  http://sourceforge.net/p/bibdesk/svn/28352
Author:   hofman
Date: 2023-09-18 14:26:30 + (Mon, 18 Sep 2023)
Log Message:
---
Get date at noon for smart group conditions from formatter instead of changing 
it in the setters

Modified Paths:
--
trunk/bibdesk/BDSKCondition.m
trunk/bibdesk/Base.lproj/BDSKCondition.xib
trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj

Added Paths:
---
trunk/bibdesk/BDSKNoonDateFormatter.h
trunk/bibdesk/BDSKNoonDateFormatter.m

Modified: trunk/bibdesk/BDSKCondition.m
===
--- trunk/bibdesk/BDSKCondition.m   2023-09-18 09:11:10 UTC (rev 28351)
+++ trunk/bibdesk/BDSKCondition.m   2023-09-18 14:26:30 UTC (rev 28352)
@@ -561,7 +561,6 @@
 }
 
 - (void)setDateValue:(NSDate *)newDate {
-newDate = [newDate startOfPeriod:BDSKPeriodDay byAdding:0 atHour:12 
minute:0 second:0];
 if (dateValue != newDate) {
 [dateValue release];
 dateValue = [newDate retain];
@@ -574,7 +573,6 @@
 }
 
 - (void)setToDateValue:(NSDate *)newDate {
-newDate = [newDate startOfPeriod:BDSKPeriodDay byAdding:0 atHour:12 
minute:0 second:0];
 if (toDateValue != newDate) {
 [toDateValue release];
 toDateValue = [newDate retain];

Added: trunk/bibdesk/BDSKNoonDateFormatter.h
===
--- trunk/bibdesk/BDSKNoonDateFormatter.h   (rev 0)
+++ trunk/bibdesk/BDSKNoonDateFormatter.h   2023-09-18 14:26:30 UTC (rev 
28352)
@@ -0,0 +1,43 @@
+//
+//  BDSKNoonDateFormatter.h
+//  BibDesk
+//
+//  Created by Christiaan Hofman on 18/09/2023.
+/*
+ This software is Copyright (c) 2023
+ Christiaan Hofman. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in
+the documentation and/or other materials provided with the
+distribution.
+
+ - Neither the name of Christiaan Hofman nor the names of any
+contributors may be used to endorse or promote products derived
+from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import 
+
+
+@interface BDSKNoonDateFormatter : NSDateFormatter
+@end

Added: trunk/bibdesk/BDSKNoonDateFormatter.m
===
--- trunk/bibdesk/BDSKNoonDateFormatter.m   (rev 0)
+++ trunk/bibdesk/BDSKNoonDateFormatter.m   2023-09-18 14:26:30 UTC (rev 
28352)
@@ -0,0 +1,51 @@
+//
+//  BDSKNoonDateFormatter.m
+//  BibDesk
+//
+//  Created by Christiaan Hofman on 18/09/2023.
+/*
+ This software is Copyright (c) 2023
+ Christiaan Hofman. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in
+the documentation and/or other materials provided with the
+distribution.
+
+ - Neither the name of Christiaan Hofman nor the names of any
+contributors may be used to endorse or promote products derived
+from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIM

[Bibdesk-commit] SF.net SVN: bibdesk:[28353] trunk/bibdesk

2023-09-18 Thread hofman--- via Bibdesk-commit
Revision: 28353
  http://sourceforge.net/p/bibdesk/svn/28353
Author:   hofman
Date: 2023-09-18 14:30:28 + (Mon, 18 Sep 2023)
Log Message:
---
Set noon dates in scripting and as default value

Modified Paths:
--
trunk/bibdesk/BDSKCondition+Scripting.m
trunk/bibdesk/BDSKCondition.m

Modified: trunk/bibdesk/BDSKCondition+Scripting.m
===
--- trunk/bibdesk/BDSKCondition+Scripting.m 2023-09-18 14:26:30 UTC (rev 
28352)
+++ trunk/bibdesk/BDSKCondition+Scripting.m 2023-09-18 14:30:28 UTC (rev 
28353)
@@ -170,12 +170,12 @@
 if ((value = [newValue objectForKey:@"andNumberValue"]))
 [self setAndNumberValue:[value integerValue]];
 } else if ((value = [newValue objectForKey:@"dateValue"])) {
-[self setDateValue:value];
+[self setDateValue:[value startOfPeriod:BDSKPeriodDay 
byAdding:0 atHour:12 minute:0 second:0]];
 if ((value = [newValue objectForKey:@"toDateValue"]))
-[self setToDateValue:value];
+[self setToDateValue:[value 
startOfPeriod:BDSKPeriodDay byAdding:0 atHour:12 minute:0 second:0]];
 }
 } else if ([newValue isKindOfClass:[NSDate class]]) {
-[self setDateValue:newValue];
+[self setDateValue:[newValue startOfPeriod:BDSKPeriodDay 
byAdding:0 atHour:12 minute:0 second:0]];
 } else if (newValue) {
 NSScriptCommand *cmd = [NSScriptCommand currentCommand];
 [cmd setScriptErrorNumber:NSArgumentsWrongScriptError];

Modified: trunk/bibdesk/BDSKCondition.m
===
--- trunk/bibdesk/BDSKCondition.m   2023-09-18 14:26:30 UTC (rev 28352)
+++ trunk/bibdesk/BDSKCondition.m   2023-09-18 14:30:28 UTC (rev 28353)
@@ -613,7 +613,7 @@
 switch ([key fieldType]) {
 case BDSKDateField:
 {
-NSDate *today = [NSDate date];
+NSDate *today = [[NSDate date] startOfPeriod:BDSKPeriodDay 
byAdding:0 atHour:12 minute:0 second:0];
 [self setNumberValue:7];
 [self setAndNumberValue:9];
 [self setPeriodValue:BDSKPeriodDay];

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28354] trunk/bibdesk

2023-09-18 Thread hofman--- via Bibdesk-commit
Revision: 28354
  http://sourceforge.net/p/bibdesk/svn/28354
Author:   hofman
Date: 2023-09-18 15:27:26 + (Mon, 18 Sep 2023)
Log Message:
---
Return noon from condition formatters by setting the defaultDate instead of a 
formatter subclass

Modified Paths:
--
trunk/bibdesk/BDSKConditionController.m
trunk/bibdesk/Base.lproj/BDSKCondition.xib
trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj

Removed Paths:
-
trunk/bibdesk/BDSKNoonDateFormatter.h
trunk/bibdesk/BDSKNoonDateFormatter.m

Modified: trunk/bibdesk/BDSKConditionController.m
===
--- trunk/bibdesk/BDSKConditionController.m 2023-09-18 14:30:28 UTC (rev 
28353)
+++ trunk/bibdesk/BDSKConditionController.m 2023-09-18 15:27:26 UTC (rev 
28354)
@@ -45,6 +45,7 @@
 #import "BDSKFieldNameFormatter.h"
 #import "NSColor_BDSKExtensions.h"
 #import "NSLayoutConstraint_BDSKExtensions.h"
+#import "NSDate_BDSKExtensions.h"
 
 #define BDSKBooleanValueTransformerName @"BDSKBooleanFromString"
 #define BDSKTriStateValueTransformerName @"BDSKTriStateFromString"
@@ -136,6 +137,10 @@
 [valueWidthConstraint setConstant:width];
 [stringvalueWidthConstraint setConstant:width];
 
+NSDate *date = [[NSDate date] startOfPeriod:BDSKPeriodDay byAdding:0 
atHour:12 minute:0 second:0];
+[(NSDateFormatter *)[dateTextField formatter] setDefaultDate:date];
+[(NSDateFormatter *)[toDateTextField formatter] setDefaultDate:date];
+
 [self layoutComparisonControls];
 [self layoutValueControls];
 }

Deleted: trunk/bibdesk/BDSKNoonDateFormatter.h
===
--- trunk/bibdesk/BDSKNoonDateFormatter.h   2023-09-18 14:30:28 UTC (rev 
28353)
+++ trunk/bibdesk/BDSKNoonDateFormatter.h   2023-09-18 15:27:26 UTC (rev 
28354)
@@ -1,43 +0,0 @@
-//
-//  BDSKNoonDateFormatter.h
-//  BibDesk
-//
-//  Created by Christiaan Hofman on 18/09/2023.
-/*
- This software is Copyright (c) 2023
- Christiaan Hofman. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
-notice, this list of conditions and the following disclaimer in
-the documentation and/or other materials provided with the
-distribution.
-
- - Neither the name of Christiaan Hofman nor the names of any
-contributors may be used to endorse or promote products derived
-from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import 
-
-
-@interface BDSKNoonDateFormatter : NSDateFormatter
-@end

Deleted: trunk/bibdesk/BDSKNoonDateFormatter.m
===
--- trunk/bibdesk/BDSKNoonDateFormatter.m   2023-09-18 14:30:28 UTC (rev 
28353)
+++ trunk/bibdesk/BDSKNoonDateFormatter.m   2023-09-18 15:27:26 UTC (rev 
28354)
@@ -1,51 +0,0 @@
-//
-//  BDSKNoonDateFormatter.m
-//  BibDesk
-//
-//  Created by Christiaan Hofman on 18/09/2023.
-/*
- This software is Copyright (c) 2023
- Christiaan Hofman. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
-notice, this list of conditions and the following disclaimer in
-the documentation and/or other materials provided with the
-distribution.
-
- - Neither the name of Christiaan Hofman nor the names of any
-contributors may be used to endorse or promote products derived
-from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT N

[Bibdesk-commit] SF.net SVN: bibdesk:[28355] trunk/bibdesk/NSDate_BDSKExtensions.m

2023-09-18 Thread hofman--- via Bibdesk-commit
Revision: 28355
  http://sourceforge.net/p/bibdesk/svn/28355
Author:   hofman
Date: 2023-09-18 15:32:11 + (Mon, 18 Sep 2023)
Log Message:
---
set hour of start of a period to 1 when the date with hour 0 does not exist, 
this can happen when daylght saving time changes at midnight

Modified Paths:
--
trunk/bibdesk/NSDate_BDSKExtensions.m

Modified: trunk/bibdesk/NSDate_BDSKExtensions.m
===
--- trunk/bibdesk/NSDate_BDSKExtensions.m   2023-09-18 15:27:26 UTC (rev 
28354)
+++ trunk/bibdesk/NSDate_BDSKExtensions.m   2023-09-18 15:32:11 UTC (rev 
28355)
@@ -298,6 +298,12 @@
 
 NSDate *date = [calendar dateFromComponents:components];
 
+if (date == nil && hour == 0) {
+// the date may not exist because of a switch to daylight saving time 
at midnight
+[components setHour:1];
+date = [calendar dateFromComponents:components];
+}
+
 if (offset != 0) {
 components = [[NSDateComponents alloc] init];
 switch (period) {

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28356] trunk/bibdesk/NSDate_BDSKExtensions.m

2023-09-18 Thread hofman--- via Bibdesk-commit
Revision: 28356
  http://sourceforge.net/p/bibdesk/svn/28356
Author:   hofman
Date: 2023-09-18 15:40:00 + (Mon, 18 Sep 2023)
Log Message:
---
get first day or month from calendar

Modified Paths:
--
trunk/bibdesk/NSDate_BDSKExtensions.m

Modified: trunk/bibdesk/NSDate_BDSKExtensions.m
===
--- trunk/bibdesk/NSDate_BDSKExtensions.m   2023-09-18 15:32:11 UTC (rev 
28355)
+++ trunk/bibdesk/NSDate_BDSKExtensions.m   2023-09-18 15:40:00 UTC (rev 
28356)
@@ -285,11 +285,11 @@
 [components setWeekday:[calendar firstWeekday]];
 break;
 case BDSKPeriodMonth:
-[components setDay:1];
+[components setDay:[calendar rangeOfUnit:NSCalendarUnitDay 
inUnit:NSCalendarUnitMonth forDate:self].location];
 break;
 case BDSKPeriodYear:
-[components setDay:1];
-[components setMonth:1];
+[components setDay:[calendar 
minimumRangeOfUnit:NSCalendarUnitDay].location];
+[components setMonth:[calendar rangeOfUnit:NSCalendarUnitMonth 
inUnit:NSCalendarUnitYear forDate:self].location];
 break;
 default:
 NSLog(@"Unknown period %ld", (long)period);

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28357] trunk/bibdesk/NSDate_BDSKExtensions.m

2023-09-18 Thread hofman--- via Bibdesk-commit
Revision: 28357
  http://sourceforge.net/p/bibdesk/svn/28357
Author:   hofman
Date: 2023-09-18 21:28:40 + (Mon, 18 Sep 2023)
Log Message:
---
make sure we end up at the requested time after shifting by an hour to work 
around midnight daylight saving time

Modified Paths:
--
trunk/bibdesk/NSDate_BDSKExtensions.m

Modified: trunk/bibdesk/NSDate_BDSKExtensions.m
===
--- trunk/bibdesk/NSDate_BDSKExtensions.m   2023-09-18 15:40:00 UTC (rev 
28356)
+++ trunk/bibdesk/NSDate_BDSKExtensions.m   2023-09-18 21:28:40 UTC (rev 
28357)
@@ -273,6 +273,7 @@
 else
 unitFlags = NSCalendarUnitYear | NSCalendarUnitMonth | 
NSCalendarUnitDay;
 NSDateComponents *components = [calendar components:unitFlags 
fromDate:self];
+BOOL shifted = NO;
 
 [components setHour:hour];
 [components setMinute:minute];
@@ -302,6 +303,7 @@
 // the date may not exist because of a switch to daylight saving time 
at midnight
 [components setHour:1];
 date = [calendar dateFromComponents:components];
+shifted = YES;
 }
 
 if (offset != 0) {
@@ -325,6 +327,8 @@
 }
 date = [calendar dateByAddingComponents:components toDate:date 
options:0];
 [components release];
+if (shifted)
+date = [date startOfPeriod:BDSKPeriodDay byAdding:0 atHour:hour 
minute:minute second:second];
 }
 
 return date;

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28358] trunk/bibdesk

2023-09-18 Thread hofman--- via Bibdesk-commit
Revision: 28358
  http://sourceforge.net/p/bibdesk/svn/28358
Author:   hofman
Date: 2023-09-18 23:22:47 + (Mon, 18 Sep 2023)
Log Message:
---
scripting support for this session date comparison

Modified Paths:
--
trunk/bibdesk/BDSKCondition+Scripting.m
trunk/bibdesk/Scripting/BibDesk.sdef

Modified: trunk/bibdesk/BDSKCondition+Scripting.m
===
--- trunk/bibdesk/BDSKCondition+Scripting.m 2023-09-18 21:28:40 UTC (rev 
28357)
+++ trunk/bibdesk/BDSKCondition+Scripting.m 2023-09-18 23:22:47 UTC (rev 
28358)
@@ -66,8 +66,9 @@
 BDSKScriptingToday = 'CTdy', 
 BDSKScriptingYesterday = 'CYst', 
 BDSKScriptingThisWeek = 'CTWk', 
-BDSKScriptingLastWeek = 'CLWk', 
-BDSKScriptingExactly = 'CAgo', 
+BDSKScriptingLastWeek = 'CLWk',
+BDSKScriptingThisSession = 'CSes',
+BDSKScriptingExactly = 'CAgo',
 BDSKScriptingInLast = 'CLPe', 
 BDSKScriptingNotInLast = 'CNLP', 
 BDSKScriptingBetween = 'CPeR', 
@@ -97,8 +98,9 @@
 case BDSKScriptingToday:   [self 
setDateComparison:BDSKToday]; break; 
 case BDSKScriptingYesterday:   [self 
setDateComparison:BDSKYesterday]; break; 
 case BDSKScriptingThisWeek:[self 
setDateComparison:BDSKThisWeek];  break; 
-case BDSKScriptingLastWeek:[self 
setDateComparison:BDSKLastWeek];  break; 
-case BDSKScriptingExactly: [self 
setDateComparison:BDSKExactly];   break; 
+case BDSKScriptingLastWeek:[self 
setDateComparison:BDSKLastWeek];  break;
+case BDSKScriptingThisSession: [self 
setDateComparison:BDSKThisSession];  break;
+case BDSKScriptingExactly: [self 
setDateComparison:BDSKExactly];   break;
 case BDSKScriptingInLast:  [self 
setDateComparison:BDSKInLast];break; 
 case BDSKScriptingNotInLast:   [self 
setDateComparison:BDSKNotInLast]; break; 
 case BDSKScriptingBetween: [self 
setDateComparison:BDSKBetween];   break; 

Modified: trunk/bibdesk/Scripting/BibDesk.sdef
===
--- trunk/bibdesk/Scripting/BibDesk.sdef2023-09-18 21:28:40 UTC (rev 
28357)
+++ trunk/bibdesk/Scripting/BibDesk.sdef2023-09-18 23:22:47 UTC (rev 
28358)
@@ -1733,6 +1733,8 @@
 description="Is this week date comparison."/>
 
+
 
 https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28359] trunk/bibdesk/BDSKCondition.m

2023-09-20 Thread hofman--- via Bibdesk-commit
Revision: 28359
  http://sourceforge.net/p/bibdesk/svn/28359
Author:   hofman
Date: 2023-09-20 09:30:18 + (Wed, 20 Sep 2023)
Log Message:
---
no need to invalidate cached dates for conditions, as parameters cannot be 
changed when the condition is in use

Modified Paths:
--
trunk/bibdesk/BDSKCondition.m

Modified: trunk/bibdesk/BDSKCondition.m
===
--- trunk/bibdesk/BDSKCondition.m   2023-09-18 23:22:47 UTC (rev 28358)
+++ trunk/bibdesk/BDSKCondition.m   2023-09-20 09:30:18 UTC (rev 28359)
@@ -51,8 +51,8 @@
 
 @interface BDSKCondition ()
 - (BOOL)item:(BibItem *)item isContainedInGroupForField:(NSString *)field;
-- (void)invalidateCachedDates;
-- (void)getCachedDatesIfNeeded;
+- (void)getCachedDates;
+- (void)startCacheTimer;
 @end
 
 @implementation BDSKCondition
@@ -220,7 +220,8 @@
return YES; // empty condition matches anything

 if ([self isDateCondition]) {
-[self getCachedDatesIfNeeded];
+if (cachedStartDate == nil && cachedEndDate == nil && group)
+[self getCachedDates];
 
 NSDate *date = nil;
 if ([key isEqualToString:BDSKDateAddedString])
@@ -394,11 +395,8 @@
 - (void)setKey:(NSString *)newKey {
 // we never want the key to be nil. It is set to nil sometimes by the 
binding mechanism
 if (key != newKey) {
-BOOL wasDateCondition = [self isDateCondition];
 [key release];
 key = [(newKey ?: @"") copy];
-if ([self isDateCondition] != wasDateCondition)
-[self invalidateCachedDates]; // remove the cached date and stop 
the timer
 }
 }
 
@@ -524,64 +522,8 @@
 }
 }
 
-#pragma mark | count (linked files/URLs)
+#pragma mark Other
 
-#pragma mark | dates
-
-- (void)setDateComparison:(BDSKDateComparison)newComparison {
-if (dateComparison != newComparison) {
-dateComparison = newComparison;
-[self invalidateCachedDates];
-}
-}
-
-- (void)setNumberValue:(NSInteger)newNumber {
-if (numberValue != newNumber) {
-numberValue = newNumber;
-[self invalidateCachedDates];
-}
-}
-
-- (void)setAndNumberValue:(NSInteger)newNumber {
-if (andNumberValue != newNumber) {
-andNumberValue = newNumber;
-[self invalidateCachedDates];
-}
-}
-
-- (void)setPeriodValue:(BDSKPeriod)newPeriod {
-if (periodValue != newPeriod) {
-periodValue = newPeriod;
-[self invalidateCachedDates];
-}
-}
-
-- (NSDate *)dateValue {
-return [[dateValue retain] autorelease];
-}
-
-- (void)setDateValue:(NSDate *)newDate {
-if (dateValue != newDate) {
-[dateValue release];
-dateValue = [newDate retain];
-[self invalidateCachedDates];
-}
-}
-
-- (NSDate *)toDateValue {
-return [[toDateValue retain] autorelease];
-}
-
-- (void)setToDateValue:(NSDate *)newDate {
-if (toDateValue != newDate) {
-[toDateValue release];
-toDateValue = [newDate retain];
-[self invalidateCachedDates];
-}
-}
-
-#pragma mark Other 
-
 - (BOOL)isDateCondition {
 return [key fieldType] == BDSKDateField;
 }
@@ -643,8 +585,12 @@
 - (void)setGroup:(id)newGroup {
 if (group != newGroup) {
 group = newGroup;
-if ([self isDateCondition])
-[self invalidateCachedDates];
+if ([self isDateCondition] && group == nil) {
+[cacheTimer invalidate];
+BDSKDESTROY(cacheTimer);
+BDSKDESTROY(cachedStartDate);
+BDSKDESTROY(cachedEndDate);
+}
 }
 }
 
@@ -719,13 +665,6 @@
 }
 }
 
-- (void)invalidateCachedDates {
-[cacheTimer invalidate];
-BDSKDESTROY(cacheTimer);
-BDSKDESTROY(cachedStartDate);
-BDSKDESTROY(cachedEndDate);
-}
-
 static BOOL differentDates(NSDate *date1, NSDate *date2) {
 if (date1 == nil)
 return date2 != nil;
@@ -752,34 +691,31 @@
 changed = YES;
 }
 
-NSDate *fireDate = [[NSDate date] startOfPeriod:periodValue byAdding:1 
atHour:0 minute:0 second:1];
 [cacheTimer invalidate];
 BDSKDESTROY(cacheTimer);
-cacheTimer = [[NSTimer alloc] initWithFireDate:fireDate interval:0.0 
target:self selector:@selector(refreshCachedDates:) userInfo:NULL repeats:NO];
-[[NSRunLoop currentRunLoop] addTimer:cacheTimer 
forMode:NSDefaultRunLoopMode];
+[self startCacheTimer];
 
-if (changed && group) {
+if (changed && group)
 [[NSNotificationCenter defaultCenter] 
postNotificationName:BDSKFilterChangedNotification object:group];
-}
 }
 
-- (void)getCachedDatesIfNeeded {
-if ([self isDateCondition] == NO || group == nil || cachedStartDate || 
cachedEndDate)
-return;
-
+- (void)startCacheTimer {
+// we fire 1 second past midnight after the end of the current period, 
because the condition changes at midnight
+NSDate *fireDate = [[NSDate date] startOfPeriod:periodValue byAdding:1 
atHo

[Bibdesk-commit] SF.net SVN: bibdesk:[28360] trunk/bibdesk/BDSKCondition.m

2023-09-20 Thread hofman--- via Bibdesk-commit
Revision: 28360
  http://sourceforge.net/p/bibdesk/svn/28360
Author:   hofman
Date: 2023-09-20 14:09:32 + (Wed, 20 Sep 2023)
Log Message:
---
Make sure properties are synthesized. No need for dependent keys, as the 
generic properties are not bound to or observed.

Modified Paths:
--
trunk/bibdesk/BDSKCondition.m

Modified: trunk/bibdesk/BDSKCondition.m
===
--- trunk/bibdesk/BDSKCondition.m   2023-09-20 09:30:18 UTC (rev 28359)
+++ trunk/bibdesk/BDSKCondition.m   2023-09-20 14:09:32 UTC (rev 28360)
@@ -57,18 +57,9 @@
 
 @implementation BDSKCondition
 
-@synthesize stringComparison, attachmentComparison, countValue, 
dateComparison, numberValue, andNumberValue, periodValue, group;
-@dynamic dictionaryValue, key, value, comparison, stringValue, dateValue, 
toDateValue, dateCondition, attachmentCondition;
+@synthesize key, stringComparison, stringValue, attachmentComparison, 
countValue, dateComparison, numberValue, andNumberValue, periodValue, 
dateValue, toDateValue, group;
+@dynamic dictionaryValue, value, comparison, dateCondition, 
attachmentCondition;
 
-+ (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key {
-NSSet *keyPaths = [super keyPathsForValuesAffectingValueForKey:key];
-if ([key isEqualToString:@"comparison"])
-keyPaths = [keyPaths setByAddingObjectsFromSet:[NSSet 
setWithObjects:@"stringComparison", @"attachmentComparison", @"dateComparison", 
nil]];
-else if ([key isEqualToString:@"value"])
-keyPaths = [keyPaths setByAddingObjectsFromSet:[NSSet 
setWithObjects:@"stringValue", @"countValue", @"numberValue", 
@"andNumberValue", @"periodValue", @"dateValue", @"toDateValue", nil]];
-return keyPaths;
-}
-
 + (NSString *)dictionaryVersion {
 return @"1";
 }
@@ -388,18 +379,13 @@
 
 #pragma mark | generic
 
-- (NSString *)key {
-return [[key retain] autorelease];
-}
-
 - (void)setKey:(NSString *)newKey {
-// we never want the key to be nil. It is set to nil sometimes by the 
binding mechanism
 if (key != newKey) {
 [key release];
-key = [(newKey ?: @"") copy];
+key = [(newKey ?: @"") retain];
 }
 }
-
+
 - (NSInteger)comparison {
 return [self isDateCondition] ? dateComparison : [self 
isAttachmentCondition] ? attachmentComparison : stringComparison;
 }
@@ -509,10 +495,6 @@
 
 #pragma mark | strings
 
-- (NSString *)stringValue {
-return [[stringValue retain] autorelease];
-}
-
 - (void)setStringValue:(NSString *)newValue {
// we never want the value to be nil. It is set to nil sometimes by the 
binding mechanism
 if (stringValue != newValue) {

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28361] trunk/bibdesk

2023-09-20 Thread hofman--- via Bibdesk-commit
Revision: 28361
  http://sourceforge.net/p/bibdesk/svn/28361
Author:   hofman
Date: 2023-09-20 15:29:55 + (Wed, 20 Sep 2023)
Log Message:
---
dependent key for checking date conditions, binding to propertoes of string 
properties is dangerous as the string can go away

Modified Paths:
--
trunk/bibdesk/BDSKCondition.h
trunk/bibdesk/BDSKCondition.m
trunk/bibdesk/Base.lproj/BDSKCondition.xib

Modified: trunk/bibdesk/BDSKCondition.h
===
--- trunk/bibdesk/BDSKCondition.h   2023-09-20 14:09:32 UTC (rev 28360)
+++ trunk/bibdesk/BDSKCondition.h   2023-09-20 15:29:55 UTC (rev 28361)
@@ -148,6 +148,7 @@
 
 @property (nonatomic, readonly, getter=isDateCondition) BOOL dateCondition;
 @property (nonatomic, readonly, getter=isAttachmentCondition) BOOL 
attachmentCondition;
+@property (nonatomic, readonly, getter=isStringCondition) BOOL stringCondition;
 
 @property (nonatomic, assign) id group;
 

Modified: trunk/bibdesk/BDSKCondition.m
===
--- trunk/bibdesk/BDSKCondition.m   2023-09-20 14:09:32 UTC (rev 28360)
+++ trunk/bibdesk/BDSKCondition.m   2023-09-20 15:29:55 UTC (rev 28361)
@@ -57,8 +57,15 @@
 
 @implementation BDSKCondition
 
++ (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key {
+NSSet *keyPaths = [super keyPathsForValuesAffectingValueForKey:key];
+if ([key isEqualToString:@"stringCondition"] || [key 
isEqualToString:@"attachmentCondition"] || [key 
isEqualToString:@"dateCondition"])
+keyPaths = [keyPaths setByAddingObjectsFromSet:[NSSet 
setWithObjects:@"key", nil]];
+return keyPaths;
+}
+
 @synthesize key, stringComparison, stringValue, attachmentComparison, 
countValue, dateComparison, numberValue, andNumberValue, periodValue, 
dateValue, toDateValue, group;
-@dynamic dictionaryValue, value, comparison, dateCondition, 
attachmentCondition;
+@dynamic dictionaryValue, value, comparison, dateCondition, 
attachmentCondition, stringCondition;
 
 + (NSString *)dictionaryVersion {
 return @"1";
@@ -514,6 +521,10 @@
 return [key fieldType] == BDSKLinkedField;
 }
 
+- (BOOL)isStringCondition {
+return [key fieldType] == BDSKStringField;
+}
+
 - (void)setDefaultComparison {
 // set some default comparison
 switch ([key fieldType]) {

Modified: trunk/bibdesk/Base.lproj/BDSKCondition.xib
===
--- trunk/bibdesk/Base.lproj/BDSKCondition.xib  2023-09-20 14:09:32 UTC (rev 
28360)
+++ trunk/bibdesk/Base.lproj/BDSKCondition.xib  2023-09-20 15:29:55 UTC (rev 
28361)
@@ -89,38 +89,22 @@
 
 
 
-
-
-BDSKIsTwo
-
-
+
 
 
 
 
-
-
-BDSKIsTwo
-
-
+
 
 
 
 
-
-
-BDSKIsTwo
-
-
+
 
 
 
 
-
-
-BDSKIsTwo
-
-
+
 
 
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mai

[Bibdesk-commit] SF.net SVN: bibdesk:[28362] trunk/bibdesk/NSDate_BDSKExtensions.m

2023-09-21 Thread hofman--- via Bibdesk-commit
Revision: 28362
  http://sourceforge.net/p/bibdesk/svn/28362
Author:   hofman
Date: 2023-09-21 09:37:58 + (Thu, 21 Sep 2023)
Log Message:
---
use en_US_POSIX locale

Modified Paths:
--
trunk/bibdesk/NSDate_BDSKExtensions.m

Modified: trunk/bibdesk/NSDate_BDSKExtensions.m
===
--- trunk/bibdesk/NSDate_BDSKExtensions.m   2023-09-20 15:29:55 UTC (rev 
28361)
+++ trunk/bibdesk/NSDate_BDSKExtensions.m   2023-09-21 09:37:58 UTC (rev 
28362)
@@ -59,7 +59,7 @@
 static CFDateFormatterRef dateFormatter = nil;
 if (NULL == dateFormatter) {
 // use the en locale, since dates use en short names as keys in BibTeX
-CFLocaleRef enLocale = CFLocaleCreate(alloc, CFSTR("en"));
+CFLocaleRef enLocale = CFLocaleCreate(alloc, CFSTR("en_US_POSIX"));
 
 // the formatter styles aren't used here, since we set an explicit 
format
 dateFormatter = CFDateFormatterCreate(alloc, enLocale, 
kCFDateFormatterLongStyle, kCFDateFormatterLongStyle);
@@ -75,7 +75,7 @@
 static CFDateFormatterRef numericDateFormatter = nil;
 if (NULL == numericDateFormatter) {
 // use the en locale, since dates use en short names as keys in BibTeX
-CFLocaleRef enLocale = CFLocaleCreate(alloc, CFSTR("en"));
+CFLocaleRef enLocale = CFLocaleCreate(alloc, CFSTR("en_US_POSIX"));
 
 // the formatter styles aren't used here, since we set an explicit 
format
 numericDateFormatter = CFDateFormatterCreate(alloc, enLocale, 
kCFDateFormatterLongStyle, kCFDateFormatterLongStyle);

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28363] trunk/bibdesk/NSDate_BDSKExtensions.m

2023-09-21 Thread hofman--- via Bibdesk-commit
Revision: 28363
  http://sourceforge.net/p/bibdesk/svn/28363
Author:   hofman
Date: 2023-09-21 15:48:29 + (Thu, 21 Sep 2023)
Log Message:
---
construct date from month and year from components

Modified Paths:
--
trunk/bibdesk/NSDate_BDSKExtensions.m

Modified: trunk/bibdesk/NSDate_BDSKExtensions.m
===
--- trunk/bibdesk/NSDate_BDSKExtensions.m   2023-09-21 09:37:58 UTC (rev 
28362)
+++ trunk/bibdesk/NSDate_BDSKExtensions.m   2023-09-21 15:48:29 UTC (rev 
28363)
@@ -141,9 +141,38 @@
 if (start > 0 || end < [monthString length])
 monthString = [monthString 
substringWithRange:NSMakeRange(start, end - start)];
 }
+static NSCalendar *calendar = nil;
+if (calendar == nil) {
+calendar = [[NSCalendar alloc] 
initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
+[calendar setLocale:[NSLocale 
localeWithLocaleIdentifier:@"en_US_POSIX"]];
+}
 if ([NSString isEmptyString:monthString])
 monthString = @"1";
-return [self initWithMonthDayYearString:[NSString 
stringWithFormat:@"%@-15-%@", monthString, yearString]];
+NSInteger year = [yearString integerValue], month = 1;
+if ([monthString length] <= 2 && [[NSCharacterSet 
decimalDigitCharacterSet] characterIsMember:[monthString characterAtIndex:0]]) {
+month = [monthString integerValue];
+} else {
+NSUInteger i = [[[calendar monthSymbols] 
valueForKey:@"lowercaseString"] indexOfObject:[monthString lowercaseString]];
+if (i == NSNotFound)
+i = [[[calendar shortMonthSymbols] 
valueForKey:@"lowercaseString"] indexOfObject:[monthString lowercaseString]];
+month = i == NSNotFound ? 1 : i + 1;
+}
+if ([yearString length] <= 2) {
+year += 2000;
+if (year > [calendar component:NSCalendarUnitYear fromDate:[NSDate 
date]])
+year -= 100;
+}
+NSDateComponents *components = [[[NSDateComponents alloc] init] 
autorelease];
+[components setYear:year];
+[components setMonth:month];
+[components setDay:15];
+[components setHour:12];
+[components setMonth:0];
+[components setSecond:0];
+NSDate *date = [calendar dateFromComponents:components];
+if (date == nil)
+date = [self initWithMonthDayYearString:[NSString 
stringWithFormat:@"%@-15-%@", monthString, yearString]];
+return date;
 }
 }
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28364] trunk/bibdesk/NSDate_BDSKExtensions.m

2023-09-21 Thread hofman--- via Bibdesk-commit
Revision: 28364
  http://sourceforge.net/p/bibdesk/svn/28364
Author:   hofman
Date: 2023-09-21 15:58:36 + (Thu, 21 Sep 2023)
Log Message:
---
retain return value from init

Modified Paths:
--
trunk/bibdesk/NSDate_BDSKExtensions.m

Modified: trunk/bibdesk/NSDate_BDSKExtensions.m
===
--- trunk/bibdesk/NSDate_BDSKExtensions.m   2023-09-21 15:48:29 UTC (rev 
28363)
+++ trunk/bibdesk/NSDate_BDSKExtensions.m   2023-09-21 15:58:36 UTC (rev 
28364)
@@ -108,7 +108,7 @@
 yearString = [(BDSKStringNode *)[[yearString nodes] objectAtIndex:0] 
value];
 if ([NSString isEmptyString:yearString]) {
 [[self init] release];
-return nil;
+self = nil;
 } else {
 if([monthString isComplex]) {
 BDSKStringNode *node = nil;
@@ -170,10 +170,14 @@
 [components setMonth:0];
 [components setSecond:0];
 NSDate *date = [calendar dateFromComponents:components];
-if (date == nil)
-date = [self initWithMonthDayYearString:[NSString 
stringWithFormat:@"%@-15-%@", monthString, yearString]];
-return date;
+if (date) {
+[self release];
+self = [date retain];
+} else {
+self = [self initWithMonthDayYearString:[NSString 
stringWithFormat:@"%@-15-%@", monthString, yearString]];
+}
 }
+return self;
 }
 
 - (NSString *)dateDescription{

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



___
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit


[Bibdesk-commit] SF.net SVN: bibdesk:[28365] trunk/bibdesk

2023-09-22 Thread hofman--- via Bibdesk-commit
Revision: 28365
  http://sourceforge.net/p/bibdesk/svn/28365
Author:   hofman
Date: 2023-09-22 14:52:05 + (Fri, 22 Sep 2023)
Log Message:
---
don't bother to do full date parsing when just normalizing year format

Modified Paths:
--
trunk/bibdesk/BDSKFormatParser.m
trunk/bibdesk/BibItem.m
trunk/bibdesk/NSDate_BDSKExtensions.h
trunk/bibdesk/NSDate_BDSKExtensions.m

Modified: trunk/bibdesk/BDSKFormatParser.m
===
--- trunk/bibdesk/BDSKFormatParser.m2023-09-21 15:58:36 UTC (rev 28364)
+++ trunk/bibdesk/BDSKFormatParser.m2023-09-22 14:52:05 UTC (rev 28365)
@@ -350,10 +350,8 @@
// year without century
 NSString *yearString = [pub 
stringValueOfField:BDSKYearString];
 if ([NSString isEmptyString:yearString] == NO) {
-NSDate *date = [[NSDate alloc] 
initWithMonthString:@"6" yearString:yearString];
-   yearString = [date 
descriptionWithCalendarFormat:@"%y" timeZone:nil locale:nil];
+yearString = [NSString stringWithFormat:@"%.2ld", 
(long)([yearString integerValue] % 100)];
[parsedStr 
appendString:yearString];
-[date release];
}
break;
}
@@ -362,10 +360,11 @@
// year with century
 NSString *yearString = [pub 
stringValueOfField:BDSKYearString];
 if ([NSString isEmptyString:yearString] == NO) {
-NSDate *date = [[NSDate alloc] 
initWithMonthString:@"6" yearString:yearString];
-   yearString = [date 
descriptionWithCalendarFormat:@"%Y" timeZone:nil locale:nil];
+NSInteger y = [yearString integerValue];
+if ([yearString length] <= 2)
+y += y < 50 ? 2000 : 1900;
+yearString = [NSString stringWithFormat:@"%ld", 
(long)y];
[parsedStr 
appendString:yearString];
-[date release];
}
break;
}
@@ -383,10 +382,9 @@
 else
 monthString = [(BDSKStringNode *)[nodes 
objectAtIndex:0] value];
 }
-NSDate *date = [[NSDate alloc] 
initWithMonthString:monthString yearString:@"2000"];
+NSDate *date = [NSDate dateWithMonthString:monthString 
yearString:@"2000"];
monthString = [date 
descriptionWithCalendarFormat:@"%m" timeZone:nil locale:nil];
[parsedStr 
appendString:monthString];
-[date release];
}
break;
}

Modified: trunk/bibdesk/BibItem.m
===
--- trunk/bibdesk/BibItem.m 2023-09-21 15:58:36 UTC (rev 28364)
+++ trunk/bibdesk/BibItem.m 2023-09-22 14:52:05 UTC (rev 28365)
@@ -4183,9 +4183,8 @@
 // pubDate is a derived field based on Month and Year fields; we take the 
15th day of the month to avoid edge cases
 if (key == nil || allFieldsChanged || [BDSKYearString isEqualToString:key] 
|| [BDSKMonthString isEqualToString:key]) {
 // allows month as number, name or abbreviated name
-theDate = [[NSDate alloc] initWithMonthString:[pubFields 
objectForKey:BDSKMonthString] yearString:[pubFields 
objectForKey:BDSKYearString]];
+theDate = [NSDate dateWithMonthString:[pubFields 
objectForKey:BDSKMonthString] yearString:[pubFields 
objectForKey:BDSKYearString]];
 [self setDate:theDate];
-[theDate release];
}

 // initially or when all fields are changed set the added and modified 
date based on the field values

Modified: trunk/bibdesk/NSDate_BDSKExtensions.h
===
--- trunk/bibdesk/NSDate_BDSKExtensions.h   2023-09-21 15:58:36 UTC (rev 
28364)
+++ trunk/bibdesk/NSDate_BDSKExtensions.h   2023-09-22 14:52:05 UTC (rev 
28365)
@@ -48,17 +48,7 @@
 
 @interface NSDate (BDSKExtensions)
 
-/*!
-@method initWithMonthDayYearString:
-@abstract   Creates a new string by parsing a month-day-year string of the 
form Jan-1-1999; uses fuzzy matching, so Jan
-could be january.
-@discussion (comprehensive description)
-@param  dateString (description)
-@result (description)
-*/
-- (id)initWi

  1   2   3   4   5   6   7   8   9   10   >