Revision: 28354 http://sourceforge.net/p/bibdesk/svn/28354 Author: hofman Date: 2023-09-18 15:27:26 +0000 (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 <Cocoa/Cocoa.h> - - -@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 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 14:30:28 UTC (rev 28353) +++ trunk/bibdesk/Base.lproj/BDSKCondition.xib 2023-09-18 15:27:26 UTC (rev 28354) @@ -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" customClass="BDSKNoonDateFormatter"/> + <dateFormatter key="formatter" dateStyle="short" id="198"/> <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" customClass="BDSKNoonDateFormatter"/> + <dateFormatter key="formatter" dateStyle="short" id="202"/> <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 14:30:28 UTC (rev 28353) +++ trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj 2023-09-18 15:27:26 UTC (rev 28354) @@ -469,8 +469,6 @@ 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 */; }; @@ -1492,8 +1490,6 @@ 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>"; }; @@ -2852,7 +2848,6 @@ CE5C868826D44E1F00C3A2CE /* BDSKFileImageTransformer.m */, CEA1A0A226F5054800897A84 /* BDSKFilePathTransformer.m */, CE6DA03011052C81001CD28E /* BDSKFormatStringFormatter.m */, - CE3B47B22AB89381001593B1 /* BDSKNoonDateFormatter.m */, CEF942100926458C00750FFA /* BDSKPathColorTransformer.m */, CEB596C0263C5029000798F9 /* BDSKRadioTransformer.m */, CEF5460E0F56BDDB008A630F /* BDSKStringArrayFormatter.m */, @@ -3362,7 +3357,6 @@ CE20787323EACF7200953DD7 /* BDSKMergeController.h */, CE8DAD8D1098976400896F69 /* BDSKMetadataCacheOperation.h */, F9D0E5340BF92768001C6C22 /* BDSKMODSParser.h */, - CE3B47B12AB89381001593B1 /* BDSKNoonDateFormatter.h */, CEF536681192EFE400027C3C /* BDSKNotesOutlineView.h */, CEE50488104D664200636237 /* BDSKNotesSearchIndex.h */, CEF71AD80B91BBCB003A2771 /* BDSKNotesWindowController.h */, @@ -3736,7 +3730,6 @@ 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 */, @@ -4628,7 +4621,6 @@ 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 Bibdesk-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bibdesk-commit