Revision: 28352
http://sourceforge.net/p/bibdesk/svn/28352
Author: hofman
Date: 2023-09-18 14:26:30 +0000 (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 <Cocoa/Cocoa.h>
+
+
+@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
+ 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 "BDSKNoonDateFormatter.h"
+#import "NSDate_BDSKExtensions.h"
+
+@implementation BDSKNoonDateFormatter
+
+- (BOOL)getObjectValue:(id *)obj forString:(NSString *)string
errorDescription:(NSString **)error{
+ if ([super getObjectValue:obj forString:string errorDescription:error] ==
NO)
+ return NO;
+ *obj = [*obj startOfPeriod:BDSKPeriodDay byAdding:0 atHour:12 minute:0
second:0];
+ return YES;
+}
+
+@end
Modified: trunk/bibdesk/Base.lproj/BDSKCondition.xib
===================================================================
--- trunk/bibdesk/Base.lproj/BDSKCondition.xib 2023-09-18 09:11:10 UTC (rev
28351)
+++ trunk/bibdesk/Base.lproj/BDSKCondition.xib 2023-09-18 14:26:30 UTC (rev
28352)
@@ -369,7 +369,7 @@
<constraint firstAttribute="width"
constant="80" id="SZ7-4I-2Uc"/>
</constraints>
<textFieldCell key="cell" scrollable="YES"
lineBreakMode="clipping" selectable="YES" editable="YES"
sendsActionOnEndEditing="YES" state="on" borderStyle="bezel"
drawsBackground="YES" id="443">
- <dateFormatter key="formatter"
dateStyle="short" id="198"/>
+ <dateFormatter key="formatter"
dateStyle="short" id="198" customClass="BDSKNoonDateFormatter"/>
<font key="font" metaFont="cellTitle"/>
<color key="textColor"
name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor"
name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
@@ -397,7 +397,7 @@
<constraint firstAttribute="width"
constant="80" id="Yfh-fq-wKL"/>
</constraints>
<textFieldCell key="cell" scrollable="YES"
lineBreakMode="clipping" selectable="YES" editable="YES"
sendsActionOnEndEditing="YES" state="on" borderStyle="bezel"
drawsBackground="YES" id="445">
- <dateFormatter key="formatter"
dateStyle="short" id="202"/>
+ <dateFormatter key="formatter"
dateStyle="short" id="202" customClass="BDSKNoonDateFormatter"/>
<font key="font" metaFont="cellTitle"/>
<color key="textColor"
name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor"
name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
Modified: trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj
===================================================================
--- trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj 2023-09-18 09:11:10 UTC
(rev 28351)
+++ trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj 2023-09-18 14:26:30 UTC
(rev 28352)
@@ -469,6 +469,8 @@
CE3A241A0B750424006B64D3 /* webGroup.tiff in Resources */ =
{isa = PBXBuildFile; fileRef = CE3A24190B750424006B64D3 /* webGroup.tiff */; };
CE3A25500B75FF09006B64D3 /* BDSKWebParser.m in Sources */ =
{isa = PBXBuildFile; fileRef = CE3A254E0B75FF09006B64D3 /* BDSKWebParser.m */;
};
CE3A32D60A345C2400984DC2 /* NSAttributedString_BDSKExtensions.m
in Sources */ = {isa = PBXBuildFile; fileRef = CEB772E90A34529D00B8A299 /*
NSAttributedString_BDSKExtensions.m */; };
+ CE3B47B32AB89381001593B1 /* BDSKNoonDateFormatter.h in Headers
*/ = {isa = PBXBuildFile; fileRef = CE3B47B12AB89381001593B1 /*
BDSKNoonDateFormatter.h */; };
+ CE3B47B42AB89381001593B1 /* BDSKNoonDateFormatter.m in Sources
*/ = {isa = PBXBuildFile; fileRef = CE3B47B22AB89381001593B1 /*
BDSKNoonDateFormatter.m */; };
CE3B5E7D09CEDE470017D339 /* BDSKMacroResolver.m in Sources */ =
{isa = PBXBuildFile; fileRef = CE3B5E7B09CEDE470017D339 /* BDSKMacroResolver.m
*/; };
CE3B682B09D1B0190017D339 /* BDSKImagePopUpButton.m in Sources
*/ = {isa = PBXBuildFile; fileRef = CE3B682709D1B0190017D339 /*
BDSKImagePopUpButton.m */; };
CE3B682D09D1B0190017D339 /* BDSKImagePopUpButtonCell.m in
Sources */ = {isa = PBXBuildFile; fileRef = CE3B682909D1B0190017D339 /*
BDSKImagePopUpButtonCell.m */; };
@@ -1490,6 +1492,8 @@
CE3A24190B750424006B64D3 /* webGroup.tiff */ = {isa =
PBXFileReference; lastKnownFileType = image.tiff; path = webGroup.tiff;
sourceTree = "<group>"; };
CE3A254D0B75FF09006B64D3 /* BDSKWebParser.h */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path =
BDSKWebParser.h; sourceTree = "<group>"; };
CE3A254E0B75FF09006B64D3 /* BDSKWebParser.m */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path
= BDSKWebParser.m; sourceTree = "<group>"; };
+ CE3B47B12AB89381001593B1 /* BDSKNoonDateFormatter.h */ = {isa =
PBXFileReference; lastKnownFileType = sourcecode.c.h; path =
BDSKNoonDateFormatter.h; sourceTree = "<group>"; };
+ CE3B47B22AB89381001593B1 /* BDSKNoonDateFormatter.m */ = {isa =
PBXFileReference; lastKnownFileType = sourcecode.c.objc; path =
BDSKNoonDateFormatter.m; sourceTree = "<group>"; };
CE3B5E7A09CEDE470017D339 /* BDSKMacroResolver.h */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path =
BDSKMacroResolver.h; sourceTree = "<group>"; };
CE3B5E7B09CEDE470017D339 /* BDSKMacroResolver.m */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path
= BDSKMacroResolver.m; sourceTree = "<group>"; };
CE3B682609D1B0190017D339 /* BDSKImagePopUpButton.h */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path =
BDSKImagePopUpButton.h; sourceTree = "<group>"; };
@@ -2848,10 +2852,11 @@
CE5C868826D44E1F00C3A2CE /*
BDSKFileImageTransformer.m */,
CEA1A0A226F5054800897A84 /*
BDSKFilePathTransformer.m */,
CE6DA03011052C81001CD28E /*
BDSKFormatStringFormatter.m */,
- 3D7406920849F5430081EC6F /*
BDSKTypeNameFormatter.m */,
+ CE3B47B22AB89381001593B1 /*
BDSKNoonDateFormatter.m */,
CEF942100926458C00750FFA /*
BDSKPathColorTransformer.m */,
CEB596C0263C5029000798F9 /*
BDSKRadioTransformer.m */,
CEF5460E0F56BDDB008A630F /*
BDSKStringArrayFormatter.m */,
+ 3D7406920849F5430081EC6F /*
BDSKTypeNameFormatter.m */,
);
name = "Data Handling";
sourceTree = "<group>";
@@ -3357,6 +3362,7 @@
CE20787323EACF7200953DD7 /*
BDSKMergeController.h */,
CE8DAD8D1098976400896F69 /*
BDSKMetadataCacheOperation.h */,
F9D0E5340BF92768001C6C22 /* BDSKMODSParser.h */,
+ CE3B47B12AB89381001593B1 /*
BDSKNoonDateFormatter.h */,
CEF536681192EFE400027C3C /*
BDSKNotesOutlineView.h */,
CEE50488104D664200636237 /*
BDSKNotesSearchIndex.h */,
CEF71AD80B91BBCB003A2771 /*
BDSKNotesWindowController.h */,
@@ -3730,6 +3736,7 @@
CE15419C2649753D001F1655 /*
BDSKFormatTextField.h in Headers */,
CE2A0A8222459A3100A8F31C /* BDSKTableView.h in
Headers */,
CE2A0A8E22459A3600A8F31C /*
BDSKTextWithIconCell.h in Headers */,
+ CE3B47B32AB89381001593B1 /*
BDSKNoonDateFormatter.h in Headers */,
CE2A0A29224599EF00A8F31C /* BDSKMacroResolver.h
in Headers */,
CE2A0AD322459A4B00A8F31C /*
NSImage_BDSKExtensions.h in Headers */,
CE2A0AA022459A3B00A8F31C /* BDSKWebParser.h in
Headers */,
@@ -4621,6 +4628,7 @@
8D11072D0486CEB800E47090 /* main.m in Sources
*/,
F9022C4A0758027800C3F701 /*
BDSKCiteKeyFormatter.m in Sources */,
F9022C4B0758027800C3F701 /* BDSKConverter.m in
Sources */,
+ CE3B47B42AB89381001593B1 /*
BDSKNoonDateFormatter.m in Sources */,
CEA6BCA72365E569004AF7B1 /* BDSKACLParser.m in
Sources */,
F9022C4E0758027800C3F701 /* BDSKMainTableView.m
in Sources */,
CE6958F7223A9B94001239A6 /* BDSKDownloader.m in
Sources */,
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit