You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
(9) |
Apr
(2) |
May
(8) |
Jun
|
Jul
(17) |
Aug
(1) |
Sep
(14) |
Oct
(28) |
Nov
(34) |
Dec
(43) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(37) |
Feb
(52) |
Mar
(130) |
Apr
(52) |
May
(23) |
Jun
(48) |
Jul
(78) |
Aug
(97) |
Sep
(73) |
Oct
(53) |
Nov
(148) |
Dec
(322) |
| 2005 |
Jan
(164) |
Feb
(259) |
Mar
(287) |
Apr
(413) |
May
(272) |
Jun
(231) |
Jul
(353) |
Aug
(363) |
Sep
(245) |
Oct
(361) |
Nov
(802) |
Dec
(493) |
| 2006 |
Jan
(345) |
Feb
(438) |
Mar
(388) |
Apr
(283) |
May
(416) |
Jun
(216) |
Jul
(180) |
Aug
(442) |
Sep
(150) |
Oct
(454) |
Nov
(416) |
Dec
(338) |
| 2007 |
Jan
(516) |
Feb
(512) |
Mar
(364) |
Apr
(152) |
May
(165) |
Jun
(93) |
Jul
(106) |
Aug
(160) |
Sep
(160) |
Oct
(256) |
Nov
(421) |
Dec
(418) |
| 2008 |
Jan
(620) |
Feb
(180) |
Mar
(236) |
Apr
(163) |
May
(196) |
Jun
(281) |
Jul
(175) |
Aug
(72) |
Sep
(56) |
Oct
(95) |
Nov
(73) |
Dec
(82) |
| 2009 |
Jan
(261) |
Feb
(340) |
Mar
(371) |
Apr
(334) |
May
(131) |
Jun
(104) |
Jul
(125) |
Aug
(106) |
Sep
(106) |
Oct
(133) |
Nov
(268) |
Dec
(201) |
| 2010 |
Jan
(183) |
Feb
(112) |
Mar
(77) |
Apr
(52) |
May
(79) |
Jun
(49) |
Jul
(46) |
Aug
(44) |
Sep
(95) |
Oct
(225) |
Nov
(203) |
Dec
(60) |
| 2011 |
Jan
(58) |
Feb
(33) |
Mar
(66) |
Apr
(57) |
May
(49) |
Jun
(72) |
Jul
(44) |
Aug
(66) |
Sep
(53) |
Oct
(49) |
Nov
(62) |
Dec
(83) |
| 2012 |
Jan
(109) |
Feb
(70) |
Mar
(47) |
Apr
(37) |
May
(43) |
Jun
(44) |
Jul
(40) |
Aug
(34) |
Sep
(18) |
Oct
(65) |
Nov
(114) |
Dec
(47) |
| 2013 |
Jan
(46) |
Feb
(51) |
Mar
(49) |
Apr
(47) |
May
(37) |
Jun
(64) |
Jul
(45) |
Aug
(36) |
Sep
(42) |
Oct
(36) |
Nov
(54) |
Dec
(58) |
| 2014 |
Jan
(42) |
Feb
(33) |
Mar
(48) |
Apr
(105) |
May
(58) |
Jun
(39) |
Jul
(53) |
Aug
(32) |
Sep
(34) |
Oct
(56) |
Nov
(34) |
Dec
(27) |
| 2015 |
Jan
(51) |
Feb
(62) |
Mar
(37) |
Apr
(36) |
May
(41) |
Jun
(31) |
Jul
(25) |
Aug
(32) |
Sep
(49) |
Oct
(80) |
Nov
(33) |
Dec
(32) |
| 2016 |
Jan
(35) |
Feb
(55) |
Mar
(58) |
Apr
(51) |
May
(33) |
Jun
(52) |
Jul
(35) |
Aug
(66) |
Sep
(37) |
Oct
(42) |
Nov
(32) |
Dec
(33) |
| 2017 |
Jan
(48) |
Feb
(11) |
Mar
(70) |
Apr
(30) |
May
(43) |
Jun
(27) |
Jul
(33) |
Aug
(34) |
Sep
(27) |
Oct
(50) |
Nov
(22) |
Dec
(33) |
| 2018 |
Jan
(157) |
Feb
(238) |
Mar
(75) |
Apr
(40) |
May
(72) |
Jun
(105) |
Jul
(93) |
Aug
(73) |
Sep
(146) |
Oct
(213) |
Nov
(101) |
Dec
(136) |
| 2019 |
Jan
(213) |
Feb
(84) |
Mar
(210) |
Apr
(117) |
May
(77) |
Jun
(61) |
Jul
(189) |
Aug
(79) |
Sep
(87) |
Oct
(95) |
Nov
(55) |
Dec
(79) |
| 2020 |
Jan
(80) |
Feb
(79) |
Mar
(40) |
Apr
(51) |
May
(41) |
Jun
(79) |
Jul
(37) |
Aug
(37) |
Sep
(34) |
Oct
(65) |
Nov
(62) |
Dec
(169) |
| 2021 |
Jan
(233) |
Feb
(61) |
Mar
(107) |
Apr
(131) |
May
(305) |
Jun
(210) |
Jul
(199) |
Aug
(248) |
Sep
(201) |
Oct
(120) |
Nov
(54) |
Dec
(45) |
| 2022 |
Jan
(34) |
Feb
(18) |
Mar
(79) |
Apr
(55) |
May
(118) |
Jun
(150) |
Jul
(112) |
Aug
(74) |
Sep
(124) |
Oct
(77) |
Nov
(36) |
Dec
(66) |
| 2023 |
Jan
(15) |
Feb
(8) |
Mar
(22) |
Apr
(39) |
May
(31) |
Jun
(33) |
Jul
(28) |
Aug
(1) |
Sep
(47) |
Oct
(30) |
Nov
(56) |
Dec
(26) |
| 2024 |
Jan
(192) |
Feb
(129) |
Mar
(19) |
Apr
(38) |
May
(42) |
Jun
|
Jul
(3) |
Aug
(17) |
Sep
(5) |
Oct
(19) |
Nov
(7) |
Dec
(1) |
| 2025 |
Jan
(7) |
Feb
(96) |
Mar
(11) |
Apr
(159) |
May
(18) |
Jun
(6) |
Jul
(134) |
Aug
(108) |
Sep
(131) |
Oct
(110) |
Nov
(163) |
Dec
(19) |
| 2026 |
Jan
(42) |
Feb
(104) |
Mar
(94) |
Apr
(160) |
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <ho...@us...> - 2026-05-01 09:35:26
|
Revision: 30343
http://sourceforge.net/p/bibdesk/svn/30343
Author: hofman
Date: 2026-05-01 09:35:24 +0000 (Fri, 01 May 2026)
Log Message:
-----------
property declaration
Modified Paths:
--------------
trunk/bibdesk/BDSKCondition.h
Modified: trunk/bibdesk/BDSKCondition.h
===================================================================
--- trunk/bibdesk/BDSKCondition.h 2026-05-01 09:22:13 UTC (rev 30342)
+++ trunk/bibdesk/BDSKCondition.h 2026-05-01 09:35:24 UTC (rev 30343)
@@ -129,6 +129,7 @@
// Generic accessors
@property (nonatomic, null_resettable, strong) NSString *key;
+@property (nonatomic, readonly) BDSKConditionKeyType keyType;
@property (nonatomic, null_resettable, strong) NSString *value;
@property (nonatomic) NSInteger comparison;
@@ -136,7 +137,7 @@
@property (nonatomic) BDSKStringComparison stringComparison;
@property (nonatomic, null_resettable, strong) NSString *stringValue;
-// Count accessors
+// Attachment accessors
@property (nonatomic) BDSKAttachmentComparison attachmentComparison;
@property (nonatomic) NSInteger countValue;
@@ -151,8 +152,6 @@
- (void)setDefaultComparison;
- (void)setDefaultValue;
-@property (nonatomic, readonly) BDSKConditionKeyType keyType;
-
@property (nonatomic, nullable, weak) id<BDSKSmartGroup> group;
@property (nonatomic, readonly) NSString *defaultName;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ho...@us...> - 2026-05-01 09:22:16
|
Revision: 30342
http://sourceforge.net/p/bibdesk/svn/30342
Author: hofman
Date: 2026-05-01 09:22:13 +0000 (Fri, 01 May 2026)
Log Message:
-----------
rename an enum value
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 2026-05-01 09:11:33 UTC (rev 30341)
+++ trunk/bibdesk/BDSKCondition+Scripting.m 2026-05-01 09:22:13 UTC (rev 30342)
@@ -117,7 +117,7 @@
break;
}
}
- } else if ([self keyType] == BDSKConditionKeyLinked) {
+ } else if ([self keyType] == BDSKConditionKeyAttachment) {
switch ([comparisonNumber unsignedIntValue]) {
case BDSKScriptingCountEqual: [self setAttachmentComparison:BDSKCountEqual]; break;
case BDSKScriptingCountNotEqual: [self setAttachmentComparison:BDSKCountNotEqual]; break;
@@ -184,7 +184,7 @@
[cmd setScriptErrorNumber:NSArgumentsWrongScriptError];
[cmd setScriptErrorString:@"Invalid value for smart condition."];
}
- } else if ([self keyType] == BDSKConditionKeyLinked) {
+ } else if ([self keyType] == BDSKConditionKeyAttachment) {
[self setDefaultValue];
if ([newValue isKindOfClass:[NSNumber class]] || [newValue isKindOfClass:[NSString class]]) {
switch ([self attachmentComparison]) {
@@ -263,7 +263,7 @@
case BDSKInDateRange: return BDSKInDateRange;
default: return BDSKScriptingToday;
}
- case BDSKConditionKeyLinked:
+ case BDSKConditionKeyAttachment:
switch ([self attachmentComparison]) {
case BDSKCountEqual: return BDSKScriptingCountEqual;
case BDSKCountNotEqual: return BDSKScriptingCountNotEqual;
@@ -311,7 +311,7 @@
default:
return nil;
}
- case BDSKConditionKeyLinked:
+ case BDSKConditionKeyAttachment:
switch ([self attachmentComparison]) {
case BDSKCountEqual:
case BDSKCountNotEqual:
Modified: trunk/bibdesk/BDSKCondition.h
===================================================================
--- trunk/bibdesk/BDSKCondition.h 2026-05-01 09:11:33 UTC (rev 30341)
+++ trunk/bibdesk/BDSKCondition.h 2026-05-01 09:22:13 UTC (rev 30342)
@@ -86,7 +86,7 @@
typedef NS_ENUM(NSInteger, BDSKConditionKeyType) {
BDSKConditionKeyDate,
- BDSKConditionKeyLinked,
+ BDSKConditionKeyAttachment,
BDSKConditionKeyString,
BDSKConditionKeyBoolean,
BDSKConditionKeyTriState,
Modified: trunk/bibdesk/BDSKCondition.m
===================================================================
--- trunk/bibdesk/BDSKCondition.m 2026-05-01 09:11:33 UTC (rev 30341)
+++ trunk/bibdesk/BDSKCondition.m 2026-05-01 09:22:13 UTC (rev 30342)
@@ -117,7 +117,7 @@
else
[self setDefaultComparison];
- if (keyType == BDSKDate || keyType == BDSKConditionKeyLinked || aValue == nil)
+ if (keyType == BDSKDate || keyType == BDSKConditionKeyAttachment || aValue == nil)
[self setDefaultValue];
if (aValue != nil)
@@ -160,7 +160,7 @@
cacheTimer = nil;
// the order is important
[self setComparison:[decoder decodeIntegerForKey:@"comparison"]];
- if (keyType == BDSKDate || keyType == BDSKConditionKeyLinked)
+ if (keyType == BDSKDate || keyType == BDSKConditionKeyAttachment)
[self setDefaultValue];
[self setValue:[decoder decodeObjectOfClass:[NSString class] forKey:@"value"]];
BDSKASSERT([self value] != nil);
@@ -186,7 +186,7 @@
// the order is important
[copy setKey:[self key]];
[copy setComparison:[self comparison]];
- if (keyType == BDSKConditionKeyDate || keyType == BDSKConditionKeyLinked)
+ if (keyType == BDSKConditionKeyDate || keyType == BDSKConditionKeyAttachment)
[copy setDefaultValue];
[copy setValue:[self value]];
return copy;
@@ -241,7 +241,7 @@
return (cachedStartDate == nil || (date && [date compare:cachedStartDate] != NSOrderedAscending)) &&
(cachedEndDate == nil || (date == nil || [date compare:cachedEndDate] == NSOrderedAscending));
}
- case BDSKConditionKeyLinked:
+ case BDSKConditionKeyAttachment:
{
if (attachmentComparison < BDSKAttachmentContain) {
NSInteger count = 0;
@@ -397,7 +397,7 @@
switch (keyType) {
case BDSKConditionKeyDate:
return dateComparison;
- case BDSKConditionKeyLinked:
+ case BDSKConditionKeyAttachment:
return attachmentComparison;
default:
return stringComparison;
@@ -409,7 +409,7 @@
case BDSKConditionKeyDate:
[self setDateComparison:(BDSKDateComparison)newComparison];
break;
- case BDSKConditionKeyLinked:
+ case BDSKConditionKeyAttachment:
[self setAttachmentComparison:(BDSKAttachmentComparison)newComparison];
break;
default:
@@ -437,7 +437,7 @@
default:
return @"";
}
- case BDSKConditionKeyLinked:
+ case BDSKConditionKeyAttachment:
switch (attachmentComparison) {
case BDSKCountEqual:
case BDSKCountNotEqual:
@@ -506,7 +506,7 @@
}
}
break;
- case BDSKConditionKeyLinked:
+ case BDSKConditionKeyAttachment:
switch (attachmentComparison) {
case BDSKCountEqual:
case BDSKCountNotEqual:
@@ -548,7 +548,7 @@
case BDSKConditionKeyDate:
[self setDateComparison:BDSKToday];
break;
- case BDSKConditionKeyLinked:
+ case BDSKConditionKeyAttachment:
[self setAttachmentComparison:BDSKCountNotEqual];
break;
case BDSKConditionKeyString:
@@ -573,7 +573,7 @@
[self setToDateValue:today];
break;
}
- case BDSKConditionKeyLinked:
+ case BDSKConditionKeyAttachment:
[self setCountValue:0];
[self setStringValue:@""];
break;
@@ -621,7 +621,7 @@
return [dateValue shortDateDescription];
else
return [NSString stringWithFormat:@"%@ - %@", [dateValue shortDateDescription], [toDateValue shortDateDescription]];
- case BDSKConditionKeyLinked:
+ case BDSKConditionKeyAttachment:
if ([self attachmentComparison] < BDSKAttachmentContain)
return [self key];
else
@@ -753,7 +753,7 @@
if ([key isEqualToString:BDSKDateAddedString] || [key isEqualToString:BDSKDateModifiedString])
return BDSKConditionKeyDate;
else if ([key isEqualToString:BDSKLocalFileString] || [key isEqualToString:BDSKRemoteURLString])
- return BDSKConditionKeyLinked;
+ return BDSKConditionKeyAttachment;
else if ([key isBooleanField])
return BDSKConditionKeyBoolean;
else if ([key isTriStateField])
Modified: trunk/bibdesk/BDSKConditionController.m
===================================================================
--- trunk/bibdesk/BDSKConditionController.m 2026-05-01 09:11:33 UTC (rev 30341)
+++ trunk/bibdesk/BDSKConditionController.m 2026-05-01 09:22:13 UTC (rev 30342)
@@ -189,7 +189,7 @@
break;
}
break;
- case BDSKConditionKeyLinked:
+ case BDSKConditionKeyAttachment:
switch ([[self condition] attachmentComparison]) {
case BDSKCountEqual:
case BDSKCountNotEqual:
@@ -253,7 +253,7 @@
case BDSKConditionKeyDate:
view = dateComparisonPopUp;
break;
- case BDSKConditionKeyLinked:
+ case BDSKConditionKeyAttachment:
view = attachmentComparisonPopUp;
break;
default:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ho...@us...> - 2026-05-01 09:11:36
|
Revision: 30341
http://sourceforge.net/p/bibdesk/svn/30341
Author: hofman
Date: 2026-05-01 09:11:33 +0000 (Fri, 01 May 2026)
Log Message:
-----------
rename field type to condition keey type
Modified Paths:
--------------
trunk/bibdesk/BDSKCondition+Scripting.m
trunk/bibdesk/BDSKCondition.h
trunk/bibdesk/BDSKCondition.m
trunk/bibdesk/BDSKConditionController.m
trunk/bibdesk/Base.lproj/BDSKCondition.xib
Modified: trunk/bibdesk/BDSKCondition+Scripting.m
===================================================================
--- trunk/bibdesk/BDSKCondition+Scripting.m 2026-04-30 22:32:48 UTC (rev 30340)
+++ trunk/bibdesk/BDSKCondition+Scripting.m 2026-05-01 09:11:33 UTC (rev 30341)
@@ -94,7 +94,7 @@
NSNumber *comparisonNumber = [properties objectForKey:@"scriptingComparison"];
if (comparisonNumber == nil) {
[self setDefaultComparison];
- } else if ([self fieldType] == BDSKDateField) {
+ } else if ([self keyType] == BDSKConditionKeyDate) {
switch ([comparisonNumber unsignedIntValue]) {
case BDSKScriptingToday: [self setDateComparison:BDSKToday]; break;
case BDSKScriptingYesterday: [self setDateComparison:BDSKYesterday]; break;
@@ -117,7 +117,7 @@
break;
}
}
- } else if ([self fieldType] == BDSKLinkedField) {
+ } else if ([self keyType] == BDSKConditionKeyLinked) {
switch ([comparisonNumber unsignedIntValue]) {
case BDSKScriptingCountEqual: [self setAttachmentComparison:BDSKCountEqual]; break;
case BDSKScriptingCountNotEqual: [self setAttachmentComparison:BDSKCountNotEqual]; break;
@@ -162,7 +162,7 @@
newValue = nil;
if (newValue == nil) {
[self setDefaultValue];
- } else if ([self fieldType] == BDSKDateField) {
+ } else if ([self keyType] == BDSKConditionKeyDate) {
[self setDefaultValue];
if ([newValue isKindOfClass:[NSDictionary class]]) {
id value;
@@ -184,7 +184,7 @@
[cmd setScriptErrorNumber:NSArgumentsWrongScriptError];
[cmd setScriptErrorString:@"Invalid value for smart condition."];
}
- } else if ([self fieldType] == BDSKLinkedField) {
+ } else if ([self keyType] == BDSKConditionKeyLinked) {
[self setDefaultValue];
if ([newValue isKindOfClass:[NSNumber class]] || [newValue isKindOfClass:[NSString class]]) {
switch ([self attachmentComparison]) {
@@ -246,8 +246,8 @@
}
- (NSInteger)scriptingComparison {
- switch ([self fieldType]) {
- case BDSKDateField:
+ switch ([self keyType]) {
+ case BDSKConditionKeyDate:
switch ([self dateComparison]) {
case BDSKToday: return BDSKScriptingToday;
case BDSKYesterday: return BDSKScriptingYesterday;
@@ -263,7 +263,7 @@
case BDSKInDateRange: return BDSKInDateRange;
default: return BDSKScriptingToday;
}
- case BDSKLinkedField:
+ case BDSKConditionKeyLinked:
switch ([self attachmentComparison]) {
case BDSKCountEqual: return BDSKScriptingCountEqual;
case BDSKCountNotEqual: return BDSKScriptingCountNotEqual;
@@ -293,8 +293,8 @@
}
- (id)scriptingValue {
- switch ([self fieldType]) {
- case BDSKDateField:
+ switch ([self keyType]) {
+ case BDSKConditionKeyDate:
switch ([self dateComparison]) {
case BDSKExactly:
case BDSKInLast:
@@ -311,7 +311,7 @@
default:
return nil;
}
- case BDSKLinkedField:
+ case BDSKConditionKeyLinked:
switch ([self attachmentComparison]) {
case BDSKCountEqual:
case BDSKCountNotEqual:
@@ -325,7 +325,7 @@
default:
return [self stringValue];
}
- case BDSKColorField:
+ case BDSKConditionKeyColor:
return [NSColor colorWithFourByteString:[self stringValue]];
default:
return [self stringValue];
Modified: trunk/bibdesk/BDSKCondition.h
===================================================================
--- trunk/bibdesk/BDSKCondition.h 2026-04-30 22:32:48 UTC (rev 30340)
+++ trunk/bibdesk/BDSKCondition.h 2026-05-01 09:11:33 UTC (rev 30341)
@@ -84,14 +84,14 @@
BDSKThisSession
};
-typedef NS_ENUM(NSInteger, BDSKFieldType) {
- BDSKDateField,
- BDSKLinkedField,
- BDSKStringField,
- BDSKBooleanField,
- BDSKTriStateField,
- BDSKRatingField,
- BDSKColorField
+typedef NS_ENUM(NSInteger, BDSKConditionKeyType) {
+ BDSKConditionKeyDate,
+ BDSKConditionKeyLinked,
+ BDSKConditionKeyString,
+ BDSKConditionKeyBoolean,
+ BDSKConditionKeyTriState,
+ BDSKConditionKeyRating,
+ BDSKConditionKeyColor
};
@protocol BDSKSmartGroup;
@@ -99,7 +99,7 @@
@interface BDSKCondition : NSObject <NSCopying, NSSecureCoding> {
NSString *key;
- BDSKFieldType fieldType;
+ BDSKConditionKeyType keyType;
BDSKStringComparison stringComparison;
BDSKAttachmentComparison attachmentComparison;
BDSKDateComparison dateComparison;
@@ -151,7 +151,7 @@
- (void)setDefaultComparison;
- (void)setDefaultValue;
-@property (nonatomic, readonly) BDSKFieldType fieldType;
+@property (nonatomic, readonly) BDSKConditionKeyType keyType;
@property (nonatomic, nullable, weak) id<BDSKSmartGroup> group;
@@ -159,6 +159,6 @@
@end
-BDSKFieldType BDSKFieldTypeForKey(NSString *key);
+BDSKConditionKeyType BDSKKeyType(NSString *key);
NS_ASSUME_NONNULL_END
Modified: trunk/bibdesk/BDSKCondition.m
===================================================================
--- trunk/bibdesk/BDSKCondition.m 2026-04-30 22:32:48 UTC (rev 30340)
+++ trunk/bibdesk/BDSKCondition.m 2026-05-01 09:11:33 UTC (rev 30341)
@@ -60,12 +60,12 @@
+ (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key {
NSSet *keyPaths = [super keyPathsForValuesAffectingValueForKey:key];
- if ([key isEqualToString:@"fieldType"])
+ if ([key isEqualToString:@"keyType"])
keyPaths = [keyPaths setByAddingObjectsFromSet:[NSSet setWithObjects:@"key", nil]];
return keyPaths;
}
-@synthesize key, stringComparison, stringValue, attachmentComparison, countValue, dateComparison, numberValue, andNumberValue, periodValue, dateValue, toDateValue, fieldType, group;
+@synthesize key, stringComparison, stringValue, attachmentComparison, countValue, dateComparison, numberValue, andNumberValue, periodValue, dateValue, toDateValue, keyType, group;
@dynamic dictionaryValue, value, comparison, defaultName;
+ (NSString *)dictionaryVersion {
@@ -77,6 +77,7 @@
if (self) {
key = @"";
stringValue = @"";
+ keyType = BDSKConditionKeyString;
stringComparison = BDSKContain;
attachmentComparison = BDSKCountNotEqual;
countValue = 0;
@@ -87,7 +88,6 @@
dateValue = nil;
toDateValue = nil;
authorValue = nil;
- fieldType = BDSKStringField;
group = nil;
cachedStartDate = nil;
cachedEndDate = nil;
@@ -117,7 +117,7 @@
else
[self setDefaultComparison];
- if (fieldType == BDSKDate || fieldType == BDSKLinkedField || aValue == nil)
+ if (keyType == BDSKDate || keyType == BDSKConditionKeyLinked || aValue == nil)
[self setDefaultValue];
if (aValue != nil)
@@ -126,7 +126,7 @@
static BOOL didWarn = NO;
if (([[dictionary objectForKey:@"version"] integerValue] < [[[self class] dictionaryVersion] integerValue]) &&
- fieldType == BDSKDateField && didWarn == NO) {
+ keyType == BDSKConditionKeyDate && didWarn == NO) {
NSAlert *alert = [[NSAlert alloc] init];
[alert setMessageText:NSLocalizedString(@"Smart Groups Need Updating", @"Message in alert dialog when smart groups with obsolete date format are detected")];
[alert setInformativeText:NSLocalizedString(@"The format for date conditions in smart groups has been changed. You should manually fix smart groups conditioning on Date-Added or Date-Modified.", @"Informative text in alert dialog")];
@@ -142,6 +142,7 @@
self = [super init];
if (self) {
key = [decoder decodeObjectOfClass:[NSString class] forKey:@"key"] ?: @"";
+ keyType = BDSKKeyType(key);
stringValue = @"";
stringComparison = BDSKContain;
attachmentComparison = BDSKCountNotEqual;
@@ -153,7 +154,6 @@
dateValue = nil;
toDateValue = nil;
authorValue = nil;
- fieldType = BDSKFieldTypeForKey(key);
group = nil;
cachedStartDate = nil;
cachedEndDate = nil;
@@ -160,7 +160,7 @@
cacheTimer = nil;
// the order is important
[self setComparison:[decoder decodeIntegerForKey:@"comparison"]];
- if (fieldType == BDSKDate || fieldType == BDSKLinkedField)
+ if (keyType == BDSKDate || keyType == BDSKConditionKeyLinked)
[self setDefaultValue];
[self setValue:[decoder decodeObjectOfClass:[NSString class] forKey:@"value"]];
BDSKASSERT([self value] != nil);
@@ -186,7 +186,7 @@
// the order is important
[copy setKey:[self key]];
[copy setComparison:[self comparison]];
- if (fieldType == BDSKDateField || fieldType == BDSKLinkedField)
+ if (keyType == BDSKConditionKeyDate || keyType == BDSKConditionKeyLinked)
[copy setDefaultValue];
[copy setValue:[self value]];
return copy;
@@ -227,8 +227,8 @@
- (BOOL)isSatisfiedByItem:(BibItem *)item {
if ([NSString isEmptyString:key])
return YES; // empty condition matches anything
- switch (fieldType) {
- case BDSKDateField:
+ switch (keyType) {
+ case BDSKConditionKeyDate:
{
if (cachedStartDate == nil && cachedEndDate == nil && group)
[self getCachedDates];
@@ -241,7 +241,7 @@
return (cachedStartDate == nil || (date && [date compare:cachedStartDate] != NSOrderedAscending)) &&
(cachedEndDate == nil || (date == nil || [date compare:cachedEndDate] == NSOrderedAscending));
}
- case BDSKLinkedField:
+ case BDSKConditionKeyLinked:
{
if (attachmentComparison < BDSKAttachmentContain) {
NSInteger count = 0;
@@ -318,7 +318,7 @@
// to speed up comparisons
itemValue = [itemValue expandedString];
- if (fieldType == BDSKBooleanField || fieldType == BDSKTriStateField || fieldType == BDSKRatingField || fieldType == BDSKColorField) {
+ if (keyType == BDSKConditionKeyBoolean || keyType == BDSKConditionKeyTriState || keyType == BDSKConditionKeyRating || keyType == BDSKConditionKeyColor) {
if (comparison == BDSKStartWith || comparison == BDSKEndWith || comparison == BDSKContain)
comparison = BDSKEqual;
else if (comparison == BDSKNotContain)
@@ -332,11 +332,11 @@
value = [NSString stringWithFormat:@"%C%@%C", (unichar)0x1E, stringValue, (unichar)0x1E];
} else {
BOOL result;
- if (fieldType == BDSKBooleanField)
+ if (keyType == BDSKConditionKeyBoolean)
result = [value booleanValue] == [itemValue booleanValue];
- else if (fieldType == BDSKTriStateField)
+ else if (keyType == BDSKConditionKeyTriState)
result = [value triStateValue] == [itemValue triStateValue];
- else if (fieldType == BDSKRatingField)
+ else if (keyType == BDSKConditionKeyRating)
result = [value integerValue] == [itemValue integerValue];
else
result = [value isCaseInsensitiveEqual:itemValue];
@@ -344,13 +344,13 @@
}
} else if (comparison == BDSKSmaller || comparison == BDSKLarger) {
NSComparisonResult result;
- if (fieldType == BDSKBooleanField)
+ if (keyType == BDSKConditionKeyBoolean)
result = compareIntegerValues([value booleanValue], [itemValue booleanValue], NO);
- else if (fieldType == BDSKTriStateField)
+ else if (keyType == BDSKConditionKeyTriState)
result = compareIntegerValues([value triStateValue], [itemValue triStateValue], YES);
- else if (fieldType == BDSKRatingField)
+ else if (keyType == BDSKConditionKeyRating)
result = compareIntegerValues([value integerValue], [itemValue integerValue], NO);
- else if (fieldType == BDSKColorField)
+ else if (keyType == BDSKConditionKeyColor)
result = [([NSColor colorWithFourByteString:value] ?: [NSColor clearSRGBColor]) colorCompare:([NSColor colorWithFourByteString:itemValue] ?: [NSColor clearSRGBColor])];
else
result = [value localizedCaseInsensitiveNumericCompare:itemValue];
@@ -389,24 +389,27 @@
- (void)setKey:(NSString *)newKey {
if (key != newKey) {
key = newKey ?: @"";
- fieldType = BDSKFieldTypeForKey(key);
+ keyType = BDSKKeyType(key);
}
}
- (NSInteger)comparison {
- switch (fieldType) {
- case BDSKDateField: return dateComparison;
- case BDSKLinkedField: return attachmentComparison;
- default: return stringComparison;
+ switch (keyType) {
+ case BDSKConditionKeyDate:
+ return dateComparison;
+ case BDSKConditionKeyLinked:
+ return attachmentComparison;
+ default:
+ return stringComparison;
}
}
- (void)setComparison:(NSInteger)newComparison {
- switch (fieldType) {
- case BDSKDateField:
+ switch (keyType) {
+ case BDSKConditionKeyDate:
[self setDateComparison:(BDSKDateComparison)newComparison];
break;
- case BDSKLinkedField:
+ case BDSKConditionKeyLinked:
[self setAttachmentComparison:(BDSKAttachmentComparison)newComparison];
break;
default:
@@ -416,8 +419,8 @@
}
- (NSString *)value {
- switch (fieldType) {
- case BDSKDateField:
+ switch (keyType) {
+ case BDSKConditionKeyDate:
switch (dateComparison) {
case BDSKExactly:
case BDSKInLast:
@@ -434,7 +437,7 @@
default:
return @"";
}
- case BDSKLinkedField:
+ case BDSKConditionKeyLinked:
switch (attachmentComparison) {
case BDSKCountEqual:
case BDSKCountNotEqual:
@@ -456,8 +459,8 @@
- (void)setValue:(NSString *)newValue {
// we never want the value to be nil. It is set to nil sometimes by the binding mechanism
if (newValue == nil) newValue = @"";
- switch (fieldType) {
- case BDSKDateField:
+ switch (keyType) {
+ case BDSKConditionKeyDate:
{
NSArray *values = nil;
switch (dateComparison) {
@@ -503,7 +506,7 @@
}
}
break;
- case BDSKLinkedField:
+ case BDSKConditionKeyLinked:
switch (attachmentComparison) {
case BDSKCountEqual:
case BDSKCountNotEqual:
@@ -541,14 +544,14 @@
- (void)setDefaultComparison {
// set some default comparison
- switch (fieldType) {
- case BDSKDateField:
+ switch (keyType) {
+ case BDSKConditionKeyDate:
[self setDateComparison:BDSKToday];
break;
- case BDSKLinkedField:
+ case BDSKConditionKeyLinked:
[self setAttachmentComparison:BDSKCountNotEqual];
break;
- case BDSKStringField:
+ case BDSKConditionKeyString:
[self setStringComparison:BDSKContain];
break;
default:
@@ -559,8 +562,8 @@
- (void)setDefaultValue {
// set some default values
- switch (fieldType) {
- case BDSKDateField:
+ switch (keyType) {
+ case BDSKConditionKeyDate:
{
NSDate *today = [[NSDate date] startOfPeriod:BDSKPeriodDay byAdding:0 atHour:12 minute:0 second:0];
[self setNumberValue:7];
@@ -570,17 +573,17 @@
[self setToDateValue:today];
break;
}
- case BDSKLinkedField:
+ case BDSKConditionKeyLinked:
[self setCountValue:0];
[self setStringValue:@""];
break;
- case BDSKBooleanField:
+ case BDSKConditionKeyBoolean:
[self setStringValue:[NSString stringWithBool:NO]];
break;
- case BDSKTriStateField:
+ case BDSKConditionKeyTriState:
[self setStringValue:[NSString stringWithTriStateValue:NSControlStateValueOff]];
break;
- case BDSKRatingField:
+ case BDSKConditionKeyRating:
[self setStringValue:@"0"];
break;
default:
@@ -591,7 +594,7 @@
- (void)setGroup:(id<BDSKSmartGroup>)newGroup {
group = newGroup;
- if (fieldType == BDSKDateField && group == nil) {
+ if (keyType == BDSKConditionKeyDate && group == nil) {
[cacheTimer invalidate];
cacheTimer = nil;
cachedStartDate = nil;
@@ -610,8 +613,8 @@
}
- (NSString *)defaultName {
- switch (fieldType) {
- case BDSKDateField:
+ switch (keyType) {
+ case BDSKConditionKeyDate:
if ([self dateComparison] < BDSKDate || [self dateComparison] == BDSKThisSession)
return [self key];
else if ([self dateComparison] < BDSKInDateRange)
@@ -618,7 +621,7 @@
return [dateValue shortDateDescription];
else
return [NSString stringWithFormat:@"%@ - %@", [dateValue shortDateDescription], [toDateValue shortDateDescription]];
- case BDSKLinkedField:
+ case BDSKConditionKeyLinked:
if ([self attachmentComparison] < BDSKAttachmentContain)
return [self key];
else
@@ -746,19 +749,19 @@
@end
-BDSKFieldType BDSKFieldTypeForKey(NSString *key) {
+BDSKConditionKeyType BDSKKeyType(NSString *key) {
if ([key isEqualToString:BDSKDateAddedString] || [key isEqualToString:BDSKDateModifiedString])
- return BDSKDateField;
+ return BDSKConditionKeyDate;
else if ([key isEqualToString:BDSKLocalFileString] || [key isEqualToString:BDSKRemoteURLString])
- return BDSKLinkedField;
+ return BDSKConditionKeyLinked;
else if ([key isBooleanField])
- return BDSKBooleanField;
+ return BDSKConditionKeyBoolean;
else if ([key isTriStateField])
- return BDSKTriStateField;
+ return BDSKConditionKeyTriState;
else if ([key isRatingField])
- return BDSKRatingField;
+ return BDSKConditionKeyRating;
else if ([key isEqualToString:BDSKColorLabelString] || [key isEqualToString:BDSKColorString])
- return BDSKColorField;
+ return BDSKConditionKeyColor;
else
- return BDSKStringField;
+ return BDSKConditionKeyString;
}
Modified: trunk/bibdesk/BDSKConditionController.m
===================================================================
--- trunk/bibdesk/BDSKConditionController.m 2026-04-30 22:32:48 UTC (rev 30340)
+++ trunk/bibdesk/BDSKConditionController.m 2026-05-01 09:11:33 UTC (rev 30341)
@@ -164,8 +164,8 @@
- (void)layoutValueControls {
NSArray *controls = nil;
- switch ([[self condition] fieldType]) {
- case BDSKDateField:
+ switch ([[self condition] keyType]) {
+ case BDSKConditionKeyDate:
switch ([[self condition] dateComparison]) {
case BDSKExactly:
controls = @[numberTextField, periodPopUp, agoText];
@@ -189,7 +189,7 @@
break;
}
break;
- case BDSKLinkedField:
+ case BDSKConditionKeyLinked:
switch ([[self condition] attachmentComparison]) {
case BDSKCountEqual:
case BDSKCountNotEqual:
@@ -207,16 +207,16 @@
break;
}
break;
- case BDSKBooleanField:
+ case BDSKConditionKeyBoolean:
controls = @[booleanButton];
break;
- case BDSKTriStateField:
+ case BDSKConditionKeyTriState:
controls = @[triStateButton];
break;
- case BDSKRatingField:
+ case BDSKConditionKeyRating:
controls = @[ratingButton];
break;
- case BDSKColorField:
+ case BDSKConditionKeyColor:
controls = @[colorWell];
break;
default:
@@ -249,11 +249,11 @@
- (void)layoutComparisonControls {
NSView *currentView = [[comparisonView subviews] firstObject];
NSView *view = nil;
- switch ([[self condition] fieldType]) {
- case BDSKDateField:
+ switch ([[self condition] keyType]) {
+ case BDSKConditionKeyDate:
view = dateComparisonPopUp;
break;
- case BDSKLinkedField:
+ case BDSKConditionKeyLinked:
view = attachmentComparisonPopUp;
break;
default:
@@ -285,9 +285,9 @@
NSString *newValue = [change objectForKey:NSKeyValueChangeNewKey];
if ((id)newValue == [NSNull null])
newValue = nil;
- BDSKFieldType oldFieldType = BDSKFieldTypeForKey(oldValue);
- BDSKFieldType newFieldType = [object fieldType];
- if(MIN(oldFieldType, BDSKStringField) != MIN(newFieldType, BDSKStringField))
+ BDSKConditionKeyType oldFieldType = BDSKKeyType(oldValue);
+ BDSKConditionKeyType newFieldType = [object keyType];
+ if(MIN(oldFieldType, BDSKConditionKeyString) != MIN(newFieldType, BDSKConditionKeyString))
[self layoutComparisonControls];
if(oldFieldType != newFieldType) {
[self layoutValueControls];
Modified: trunk/bibdesk/Base.lproj/BDSKCondition.xib
===================================================================
--- trunk/bibdesk/Base.lproj/BDSKCondition.xib 2026-04-30 22:32:48 UTC (rev 30340)
+++ trunk/bibdesk/Base.lproj/BDSKCondition.xib 2026-05-01 09:11:33 UTC (rev 30341)
@@ -56,7 +56,7 @@
<menuItem title="does not contain part" tag="1" id="232"/>
<menuItem title="contains" tag="2" id="234">
<connections>
- <binding destination="-2" name="enabled" keyPath="representedObject.fieldType" id="UuA-lJ-bL9">
+ <binding destination="-2" name="enabled" keyPath="representedObject.keyType" id="d5l-6J-O6L">
<dictionary key="options">
<string key="NSValueTransformerName">BDSKIsTwo</string>
</dictionary>
@@ -65,7 +65,7 @@
</menuItem>
<menuItem title="does not contain" tag="3" id="228">
<connections>
- <binding destination="-2" name="enabled" keyPath="representedObject.fieldType" id="kyq-f3-73D">
+ <binding destination="-2" name="enabled" keyPath="representedObject.keyType" id="ah0-A3-Exf">
<dictionary key="options">
<string key="NSValueTransformerName">BDSKIsTwo</string>
</dictionary>
@@ -74,7 +74,7 @@
</menuItem>
<menuItem title="starts with" tag="6" id="227">
<connections>
- <binding destination="-2" name="enabled" keyPath="representedObject.fieldType" id="bQl-8J-oa3">
+ <binding destination="-2" name="enabled" keyPath="representedObject.keyType" id="6HM-Z7-Vj8">
<dictionary key="options">
<string key="NSValueTransformerName">BDSKIsTwo</string>
</dictionary>
@@ -83,7 +83,7 @@
</menuItem>
<menuItem title="ends with" tag="7" id="229">
<connections>
- <binding destination="-2" name="enabled" keyPath="representedObject.fieldType" id="gDh-5O-K9d">
+ <binding destination="-2" name="enabled" keyPath="representedObject.keyType" id="cwH-re-Qjs">
<dictionary key="options">
<string key="NSValueTransformerName">BDSKIsTwo</string>
</dictionary>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ho...@us...> - 2026-04-30 22:32:49
|
Revision: 30340
http://sourceforge.net/p/bibdesk/svn/30340
Author: hofman
Date: 2026-04-30 22:32:48 +0000 (Thu, 30 Apr 2026)
Log Message:
-----------
replace isDateCondition and isAttachmentCondition by fieldType
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 2026-04-30 22:02:14 UTC (rev 30339)
+++ trunk/bibdesk/BDSKCondition+Scripting.m 2026-04-30 22:32:48 UTC (rev 30340)
@@ -94,7 +94,7 @@
NSNumber *comparisonNumber = [properties objectForKey:@"scriptingComparison"];
if (comparisonNumber == nil) {
[self setDefaultComparison];
- } else if ([self isDateCondition]) {
+ } else if ([self fieldType] == BDSKDateField) {
switch ([comparisonNumber unsignedIntValue]) {
case BDSKScriptingToday: [self setDateComparison:BDSKToday]; break;
case BDSKScriptingYesterday: [self setDateComparison:BDSKYesterday]; break;
@@ -117,7 +117,7 @@
break;
}
}
- } else if ([self isAttachmentCondition]) {
+ } else if ([self fieldType] == BDSKLinkedField) {
switch ([comparisonNumber unsignedIntValue]) {
case BDSKScriptingCountEqual: [self setAttachmentComparison:BDSKCountEqual]; break;
case BDSKScriptingCountNotEqual: [self setAttachmentComparison:BDSKCountNotEqual]; break;
@@ -162,7 +162,7 @@
newValue = nil;
if (newValue == nil) {
[self setDefaultValue];
- } else if ([self isDateCondition]) {
+ } else if ([self fieldType] == BDSKDateField) {
[self setDefaultValue];
if ([newValue isKindOfClass:[NSDictionary class]]) {
id value;
@@ -184,7 +184,7 @@
[cmd setScriptErrorNumber:NSArgumentsWrongScriptError];
[cmd setScriptErrorString:@"Invalid value for smart condition."];
}
- } else if ([self isAttachmentCondition]) {
+ } else if ([self fieldType] == BDSKLinkedField) {
[self setDefaultValue];
if ([newValue isKindOfClass:[NSNumber class]] || [newValue isKindOfClass:[NSString class]]) {
switch ([self attachmentComparison]) {
@@ -246,87 +246,89 @@
}
- (NSInteger)scriptingComparison {
- if ([self isDateCondition]) {
- switch ([self dateComparison]) {
- case BDSKToday: return BDSKScriptingToday;
- case BDSKYesterday: return BDSKScriptingYesterday;
- case BDSKThisWeek: return BDSKScriptingThisWeek;
- case BDSKLastWeek: return BDSKScriptingLastWeek;
- case BDSKExactly: return BDSKScriptingExactly;
- case BDSKInLast: return BDSKScriptingInLast;
- case BDSKNotInLast: return BDSKScriptingNotInLast;
- case BDSKBetween: return BDSKScriptingBetween;
- case BDSKDate: return BDSKScriptingDate;
- case BDSKAfterDate: return BDSKScriptingAfterDate;
- case BDSKBeforeDate: return BDSKScriptingBeforeDate;
- case BDSKInDateRange: return BDSKInDateRange;
- default: return BDSKScriptingToday;
- }
- } else if ([self isAttachmentCondition]) {
- switch ([self attachmentComparison]) {
- case BDSKCountEqual: return BDSKScriptingCountEqual;
- case BDSKCountNotEqual: return BDSKScriptingCountNotEqual;
- case BDSKCountLarger: return BDSKScriptingCountLarger;
- case BDSKCountSmaller: return BDSKScriptingCountSmaller;
- case BDSKAttachmentContain: return BDSKScriptingContain;
- case BDSKAttachmentNotContain: return BDSKScriptingNotContain;
- case BDSKAttachmentStartWith: return BDSKScriptingStartWith;
- case BDSKAttachmentEndWith: return BDSKScriptingEndWith;
- default: return BDSKScriptingCountEqual;
- }
- } else {
- switch ([self stringComparison]) {
- case BDSKGroupContain: return BDSKScriptingGroupContain;
- case BDSKGroupNotContain: return BDSKScriptingGroupNotContain;
- case BDSKContain: return BDSKScriptingContain;
- case BDSKNotContain: return BDSKScriptingNotContain;
- case BDSKEqual: return BDSKScriptingEqual;
- case BDSKNotEqual: return BDSKScriptingNotEqual;
- case BDSKStartWith: return BDSKScriptingStartWith;
- case BDSKEndWith: return BDSKScriptingEndWith;
- case BDSKSmaller: return BDSKScriptingSmaller;
- case BDSKLarger: return BDSKScriptingLarger;
- default: return BDSKScriptingContain;
- }
+ switch ([self fieldType]) {
+ case BDSKDateField:
+ switch ([self dateComparison]) {
+ case BDSKToday: return BDSKScriptingToday;
+ case BDSKYesterday: return BDSKScriptingYesterday;
+ case BDSKThisWeek: return BDSKScriptingThisWeek;
+ case BDSKLastWeek: return BDSKScriptingLastWeek;
+ case BDSKExactly: return BDSKScriptingExactly;
+ case BDSKInLast: return BDSKScriptingInLast;
+ case BDSKNotInLast: return BDSKScriptingNotInLast;
+ case BDSKBetween: return BDSKScriptingBetween;
+ case BDSKDate: return BDSKScriptingDate;
+ case BDSKAfterDate: return BDSKScriptingAfterDate;
+ case BDSKBeforeDate: return BDSKScriptingBeforeDate;
+ case BDSKInDateRange: return BDSKInDateRange;
+ default: return BDSKScriptingToday;
+ }
+ case BDSKLinkedField:
+ switch ([self attachmentComparison]) {
+ case BDSKCountEqual: return BDSKScriptingCountEqual;
+ case BDSKCountNotEqual: return BDSKScriptingCountNotEqual;
+ case BDSKCountLarger: return BDSKScriptingCountLarger;
+ case BDSKCountSmaller: return BDSKScriptingCountSmaller;
+ case BDSKAttachmentContain: return BDSKScriptingContain;
+ case BDSKAttachmentNotContain: return BDSKScriptingNotContain;
+ case BDSKAttachmentStartWith: return BDSKScriptingStartWith;
+ case BDSKAttachmentEndWith: return BDSKScriptingEndWith;
+ default: return BDSKScriptingCountEqual;
+ }
+ default:
+ switch ([self stringComparison]) {
+ case BDSKGroupContain: return BDSKScriptingGroupContain;
+ case BDSKGroupNotContain: return BDSKScriptingGroupNotContain;
+ case BDSKContain: return BDSKScriptingContain;
+ case BDSKNotContain: return BDSKScriptingNotContain;
+ case BDSKEqual: return BDSKScriptingEqual;
+ case BDSKNotEqual: return BDSKScriptingNotEqual;
+ case BDSKStartWith: return BDSKScriptingStartWith;
+ case BDSKEndWith: return BDSKScriptingEndWith;
+ case BDSKSmaller: return BDSKScriptingSmaller;
+ case BDSKLarger: return BDSKScriptingLarger;
+ default: return BDSKScriptingContain;
+ }
}
}
- (id)scriptingValue {
- if ([self isDateCondition]) {
- switch ([self dateComparison]) {
- case BDSKExactly:
- case BDSKInLast:
- case BDSKNotInLast:
- return [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInteger:numberValue], @"numberValue", [NSNumber numberWithInteger:periodValue], @"periodValue", nil];
- case BDSKBetween:
- return [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInteger:numberValue], @"numberValue", [NSNumber numberWithInteger:andNumberValue], @"andNumberValue", [NSNumber numberWithInteger:periodValue], @"periodValue", nil];
- case BDSKDate:
- case BDSKAfterDate:
- case BDSKBeforeDate:
- return [NSDictionary dictionaryWithObjectsAndKeys:dateValue, @"dateValue", nil];
- case BDSKInDateRange:
- return [NSDictionary dictionaryWithObjectsAndKeys:dateValue, @"dateValue", toDateValue, @"dateValue", nil];
- default:
- return nil;
- }
- } else if ([self isAttachmentCondition]) {
- switch ([self attachmentComparison]) {
- case BDSKCountEqual:
- case BDSKCountNotEqual:
- case BDSKCountLarger:
- case BDSKCountSmaller:
- return [NSNumber numberWithInteger:countValue];
- case BDSKAttachmentContain:
- case BDSKAttachmentNotContain:
- case BDSKAttachmentStartWith:
- case BDSKAttachmentEndWith:
- default:
- return [self stringValue];
- }
- } else if ([[self key] isEqualToString:BDSKColorLabelString] || [[self key] isEqualToString:BDSKColorString]) {
- return [NSColor colorWithFourByteString:[self stringValue]];
- } else {
- return [self stringValue];
+ switch ([self fieldType]) {
+ case BDSKDateField:
+ switch ([self dateComparison]) {
+ case BDSKExactly:
+ case BDSKInLast:
+ case BDSKNotInLast:
+ return [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInteger:numberValue], @"numberValue", [NSNumber numberWithInteger:periodValue], @"periodValue", nil];
+ case BDSKBetween:
+ return [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInteger:numberValue], @"numberValue", [NSNumber numberWithInteger:andNumberValue], @"andNumberValue", [NSNumber numberWithInteger:periodValue], @"periodValue", nil];
+ case BDSKDate:
+ case BDSKAfterDate:
+ case BDSKBeforeDate:
+ return [NSDictionary dictionaryWithObjectsAndKeys:dateValue, @"dateValue", nil];
+ case BDSKInDateRange:
+ return [NSDictionary dictionaryWithObjectsAndKeys:dateValue, @"dateValue", toDateValue, @"dateValue", nil];
+ default:
+ return nil;
+ }
+ case BDSKLinkedField:
+ switch ([self attachmentComparison]) {
+ case BDSKCountEqual:
+ case BDSKCountNotEqual:
+ case BDSKCountLarger:
+ case BDSKCountSmaller:
+ return [NSNumber numberWithInteger:countValue];
+ case BDSKAttachmentContain:
+ case BDSKAttachmentNotContain:
+ case BDSKAttachmentStartWith:
+ case BDSKAttachmentEndWith:
+ default:
+ return [self stringValue];
+ }
+ case BDSKColorField:
+ return [NSColor colorWithFourByteString:[self stringValue]];
+ default:
+ return [self stringValue];
}
}
Modified: trunk/bibdesk/BDSKCondition.h
===================================================================
--- trunk/bibdesk/BDSKCondition.h 2026-04-30 22:02:14 UTC (rev 30339)
+++ trunk/bibdesk/BDSKCondition.h 2026-04-30 22:32:48 UTC (rev 30340)
@@ -148,13 +148,10 @@
@property (nonatomic, nullable, strong) NSDate *dateValue;
@property (nonatomic, nullable, strong) NSDate *toDateValue;
-@property (nonatomic, readonly) BDSKFieldType fieldType;
-
- (void)setDefaultComparison;
- (void)setDefaultValue;
-@property (nonatomic, readonly, getter=isDateCondition) BOOL dateCondition;
-@property (nonatomic, readonly, getter=isAttachmentCondition) BOOL attachmentCondition;
+@property (nonatomic, readonly) BDSKFieldType fieldType;
@property (nonatomic, nullable, weak) id<BDSKSmartGroup> group;
Modified: trunk/bibdesk/BDSKCondition.m
===================================================================
--- trunk/bibdesk/BDSKCondition.m 2026-04-30 22:02:14 UTC (rev 30339)
+++ trunk/bibdesk/BDSKCondition.m 2026-04-30 22:32:48 UTC (rev 30340)
@@ -66,7 +66,7 @@
}
@synthesize key, stringComparison, stringValue, attachmentComparison, countValue, dateComparison, numberValue, andNumberValue, periodValue, dateValue, toDateValue, fieldType, group;
-@dynamic dictionaryValue, value, comparison, dateCondition, attachmentCondition, defaultName;
+@dynamic dictionaryValue, value, comparison, defaultName;
+ (NSString *)dictionaryVersion {
return @"1";
@@ -117,7 +117,7 @@
else
[self setDefaultComparison];
- if (([self isDateCondition] || [self isAttachmentCondition]) || aValue == nil)
+ if (fieldType == BDSKDate || fieldType == BDSKLinkedField || aValue == nil)
[self setDefaultValue];
if (aValue != nil)
@@ -126,7 +126,7 @@
static BOOL didWarn = NO;
if (([[dictionary objectForKey:@"version"] integerValue] < [[[self class] dictionaryVersion] integerValue]) &&
- [self isDateCondition] && didWarn == NO) {
+ fieldType == BDSKDateField && didWarn == NO) {
NSAlert *alert = [[NSAlert alloc] init];
[alert setMessageText:NSLocalizedString(@"Smart Groups Need Updating", @"Message in alert dialog when smart groups with obsolete date format are detected")];
[alert setInformativeText:NSLocalizedString(@"The format for date conditions in smart groups has been changed. You should manually fix smart groups conditioning on Date-Added or Date-Modified.", @"Informative text in alert dialog")];
@@ -160,7 +160,7 @@
cacheTimer = nil;
// the order is important
[self setComparison:[decoder decodeIntegerForKey:@"comparison"]];
- if ([self isDateCondition] || [self isAttachmentCondition])
+ if (fieldType == BDSKDate || fieldType == BDSKLinkedField)
[self setDefaultValue];
[self setValue:[decoder decodeObjectOfClass:[NSString class] forKey:@"value"]];
BDSKASSERT([self value] != nil);
@@ -186,7 +186,7 @@
// the order is important
[copy setKey:[self key]];
[copy setComparison:[self comparison]];
- if ([copy isDateCondition] || [copy isAttachmentCondition])
+ if (fieldType == BDSKDateField || fieldType == BDSKLinkedField)
[copy setDefaultValue];
[copy setValue:[self value]];
return copy;
@@ -227,156 +227,158 @@
- (BOOL)isSatisfiedByItem:(BibItem *)item {
if ([NSString isEmptyString:key])
return YES; // empty condition matches anything
-
- if ([self isDateCondition]) {
- if (cachedStartDate == nil && cachedEndDate == nil && group)
- [self getCachedDates];
-
- NSDate *date = nil;
- if ([key isEqualToString:BDSKDateAddedString])
- date = [item dateAdded];
- else if ([key isEqualToString:BDSKDateModifiedString])
- date = [item dateModified];
- return (cachedStartDate == nil || (date && [date compare:cachedStartDate] != NSOrderedAscending)) &&
- (cachedEndDate == nil || (date == nil || [date compare:cachedEndDate] == NSOrderedAscending));
-
- } else if ([self isAttachmentCondition]) {
-
- if (attachmentComparison < BDSKAttachmentContain) {
- NSInteger count = 0;
+ switch (fieldType) {
+ case BDSKDateField:
+ {
+ if (cachedStartDate == nil && cachedEndDate == nil && group)
+ [self getCachedDates];
+
+ NSDate *date = nil;
+ if ([key isEqualToString:BDSKDateAddedString])
+ date = [item dateAdded];
+ else if ([key isEqualToString:BDSKDateModifiedString])
+ date = [item dateModified];
+ return (cachedStartDate == nil || (date && [date compare:cachedStartDate] != NSOrderedAscending)) &&
+ (cachedEndDate == nil || (date == nil || [date compare:cachedEndDate] == NSOrderedAscending));
+ }
+ case BDSKLinkedField:
+ {
+ if (attachmentComparison < BDSKAttachmentContain) {
+ NSInteger count = 0;
+ if ([key isEqualToString:BDSKLocalFileString])
+ count = [[item localFiles] count];
+ else if ([key isEqualToString:BDSKRemoteURLString])
+ count = [[item remoteURLs] count];
+
+ switch (attachmentComparison) {
+ case BDSKCountEqual:
+ return count == countValue;
+ case BDSKCountNotEqual:
+ return count != countValue;
+ case BDSKCountLarger:
+ return count > countValue;
+ case BDSKCountSmaller:
+ return count < countValue;
+ default:
+ break; // other enum values are handled below, but the compiler doesn't know that
+ }
+ }
+
+ BOOL matchReturnValue = (attachmentComparison != BDSKAttachmentNotContain);
+ NSArray *itemValues = nil;
if ([key isEqualToString:BDSKLocalFileString])
- count = [[item localFiles] count];
+ itemValues = [[item existingLocalFiles] valueForKey:@"path"];
else if ([key isEqualToString:BDSKRemoteURLString])
- count = [[item remoteURLs] count];
+ itemValues = [[item remoteURLs] valueForKey:@"absoluteString"];
- switch (attachmentComparison) {
- case BDSKCountEqual:
- return count == countValue;
- case BDSKCountNotEqual:
- return count != countValue;
- case BDSKCountLarger:
- return count > countValue;
- case BDSKCountSmaller:
- return count < countValue;
- default:
- break; // other enum values are handled below, but the compiler doesn't know that
+ if ([itemValues count]) {
+ CFOptionFlags options = kCFCompareCaseInsensitive;
+ if (attachmentComparison == BDSKAttachmentEndWith)
+ options |= kCFCompareBackwards | kCFCompareAnchored;
+ else if (attachmentComparison == BDSKAttachmentStartWith)
+ options |= kCFCompareAnchored;
+
+ for (NSString *itemValue in itemValues) {
+ if (CFStringFindWithOptions((__bridge CFStringRef)itemValue, (__bridge CFStringRef)stringValue, CFRangeMake(0, [itemValue length]), options, NULL))
+ return matchReturnValue;
+ }
}
+ return NO == matchReturnValue;
}
-
- BOOL matchReturnValue = (attachmentComparison != BDSKAttachmentNotContain);
- NSArray *itemValues = nil;
- if ([key isEqualToString:BDSKLocalFileString])
- itemValues = [[item existingLocalFiles] valueForKey:@"path"];
- else if ([key isEqualToString:BDSKRemoteURLString])
- itemValues = [[item remoteURLs] valueForKey:@"absoluteString"];
-
- if ([itemValues count]) {
- CFOptionFlags options = kCFCompareCaseInsensitive;
- if (attachmentComparison == BDSKAttachmentEndWith)
- options |= kCFCompareBackwards | kCFCompareAnchored;
- else if (attachmentComparison == BDSKAttachmentStartWith)
- options |= kCFCompareAnchored;
+ default:
+ {
+ BDSKASSERT(stringValue != nil);
- for (NSString *itemValue in itemValues) {
- if (CFStringFindWithOptions((__bridge CFStringRef)itemValue, (__bridge CFStringRef)stringValue, CFRangeMake(0, [itemValue length]), options, NULL))
- return matchReturnValue;
+ if (stringComparison == BDSKGroupContain || stringComparison == BDSKGroupNotContain) {
+ BOOL isContain = stringComparison == BDSKGroupContain;
+ if ([key isEqualToString:BDSKAllFieldsString]) {
+ if (authorValue == nil)
+ authorValue = [BibAuthor authorWithName:stringValue];
+ NSArray *fields = [item allFieldNames];
+ if ([item crossrefParent] != nil) {
+ NSMutableArray *tmpFields = [fields mutableCopy];
+ [tmpFields addNonDuplicateObjectsFromArray:[[BDSKTypeManager sharedManager] regularFieldsForType:[item pubType]]];
+ fields = tmpFields;
+ }
+ for (NSString *field in fields) {
+ if ([field isInvalidGroupField] == NO && [self item:item isContainedInGroupForField:field])
+ return isContain;
+ }
+ return NO == isContain;
+ } else {
+ return isContain == [self item:item isContainedInGroupForField:key];
+ }
}
- }
- return NO == matchReturnValue;
-
- } else {
-
- BDSKASSERT(stringValue != nil);
-
- if (stringComparison == BDSKGroupContain || stringComparison == BDSKGroupNotContain) {
- BOOL isContain = stringComparison == BDSKGroupContain;
- if ([key isEqualToString:BDSKAllFieldsString]) {
- if (authorValue == nil)
- authorValue = [BibAuthor authorWithName:stringValue];
- NSArray *fields = [item allFieldNames];
- if ([item crossrefParent] != nil) {
- NSMutableArray *tmpFields = [fields mutableCopy];
- [tmpFields addNonDuplicateObjectsFromArray:[[BDSKTypeManager sharedManager] regularFieldsForType:[item pubType]]];
- fields = tmpFields;
+
+ // use local values, as we may change them to support "Any Field"
+ NSInteger comparison = stringComparison;
+ NSString *value = stringValue;
+ // unset values are considered empty strings
+ NSString *itemValue = [item stringValueOfField:key] ?: @"";
+ // to speed up comparisons
+ itemValue = [itemValue expandedString];
+
+ if (fieldType == BDSKBooleanField || fieldType == BDSKTriStateField || fieldType == BDSKRatingField || fieldType == BDSKColorField) {
+ if (comparison == BDSKStartWith || comparison == BDSKEndWith || comparison == BDSKContain)
+ comparison = BDSKEqual;
+ else if (comparison == BDSKNotContain)
+ comparison = BDSKNotEqual;
+ }
+
+ if (comparison == BDSKEqual || comparison == BDSKNotEqual) {
+ if ([key isEqualToString:BDSKAllFieldsString]) {
+ comparison = comparison == BDSKEqual ? BDSKContain : BDSKNotContain;
+ itemValue = [NSString stringWithFormat:@"%C%@%C", (unichar)0x1E, itemValue, (unichar)0x1E];
+ value = [NSString stringWithFormat:@"%C%@%C", (unichar)0x1E, stringValue, (unichar)0x1E];
+ } else {
+ BOOL result;
+ if (fieldType == BDSKBooleanField)
+ result = [value booleanValue] == [itemValue booleanValue];
+ else if (fieldType == BDSKTriStateField)
+ result = [value triStateValue] == [itemValue triStateValue];
+ else if (fieldType == BDSKRatingField)
+ result = [value integerValue] == [itemValue integerValue];
+ else
+ result = [value isCaseInsensitiveEqual:itemValue];
+ return comparison == BDSKEqual ? result : result == NO;
}
- for (NSString *field in fields) {
- if ([field isInvalidGroupField] == NO && [self item:item isContainedInGroupForField:field])
- return isContain;
- }
- return NO == isContain;
- } else {
- return isContain == [self item:item isContainedInGroupForField:key];
- }
- }
-
- // use local values, as we may change them to support "Any Field"
- NSInteger comparison = stringComparison;
- NSString *value = stringValue;
- // unset values are considered empty strings
- NSString *itemValue = [item stringValueOfField:key] ?: @"";
- // to speed up comparisons
- itemValue = [itemValue expandedString];
-
- if (fieldType == BDSKBooleanField || fieldType == BDSKTriStateField || fieldType == BDSKRatingField || fieldType == BDSKColorField) {
- if (comparison == BDSKStartWith || comparison == BDSKEndWith || comparison == BDSKContain)
- comparison = BDSKEqual;
- else if (comparison == BDSKNotContain)
- comparison = BDSKNotEqual;
- }
-
- if (comparison == BDSKEqual || comparison == BDSKNotEqual) {
- if ([key isEqualToString:BDSKAllFieldsString]) {
- comparison = comparison == BDSKEqual ? BDSKContain : BDSKNotContain;
- itemValue = [NSString stringWithFormat:@"%C%@%C", (unichar)0x1E, itemValue, (unichar)0x1E];
- value = [NSString stringWithFormat:@"%C%@%C", (unichar)0x1E, stringValue, (unichar)0x1E];
- } else {
- BOOL result;
+ } else if (comparison == BDSKSmaller || comparison == BDSKLarger) {
+ NSComparisonResult result;
if (fieldType == BDSKBooleanField)
- result = [value booleanValue] == [itemValue booleanValue];
+ result = compareIntegerValues([value booleanValue], [itemValue booleanValue], NO);
else if (fieldType == BDSKTriStateField)
- result = [value triStateValue] == [itemValue triStateValue];
+ result = compareIntegerValues([value triStateValue], [itemValue triStateValue], YES);
else if (fieldType == BDSKRatingField)
- result = [value integerValue] == [itemValue integerValue];
+ result = compareIntegerValues([value integerValue], [itemValue integerValue], NO);
+ else if (fieldType == BDSKColorField)
+ result = [([NSColor colorWithFourByteString:value] ?: [NSColor clearSRGBColor]) colorCompare:([NSColor colorWithFourByteString:itemValue] ?: [NSColor clearSRGBColor])];
else
- result = [value isCaseInsensitiveEqual:itemValue];
- return comparison == BDSKEqual ? result : result == NO;
+ result = [value localizedCaseInsensitiveNumericCompare:itemValue];
+ return result == (comparison == BDSKSmaller ? NSOrderedDescending : NSOrderedAscending);
}
- } else if (comparison == BDSKSmaller || comparison == BDSKLarger) {
- NSComparisonResult result;
- if (fieldType == BDSKBooleanField)
- result = compareIntegerValues([value booleanValue], [itemValue booleanValue], NO);
- else if (fieldType == BDSKTriStateField)
- result = compareIntegerValues([value triStateValue], [itemValue triStateValue], YES);
- else if (fieldType == BDSKRatingField)
- result = compareIntegerValues([value integerValue], [itemValue integerValue], NO);
- else if (fieldType == BDSKColorField)
- result = [([NSColor colorWithFourByteString:value] ?: [NSColor clearSRGBColor]) colorCompare:([NSColor colorWithFourByteString:itemValue] ?: [NSColor clearSRGBColor])];
- else
- result = [value localizedCaseInsensitiveNumericCompare:itemValue];
- return result == (comparison == BDSKSmaller ? NSOrderedDescending : NSOrderedAscending);
- }
-
- // minor optimization: Shark showed -[NSString rangeOfString:options:] as a bottleneck, calling through to CFStringFindWithOptions
- CFOptionFlags options = kCFCompareCaseInsensitive;
- if (comparison == BDSKEndWith || comparison == BDSKStartWith) {
- if ([key isEqualToString:BDSKAllFieldsString]) {
- if (comparison == BDSKEndWith) {
- itemValue = [NSString stringWithFormat:@"%@%C", itemValue, (unichar)0x1E];
- value = [NSString stringWithFormat:@"%@%C", stringValue, (unichar)0x1E];
- } else if (comparison == BDSKStartWith) {
- itemValue = [NSString stringWithFormat:@"%C%@", (unichar)0x1E, itemValue];
- value = [NSString stringWithFormat:@"%C%@", (unichar)0x1E, stringValue];
+
+ // minor optimization: Shark showed -[NSString rangeOfString:options:] as a bottleneck, calling through to CFStringFindWithOptions
+ CFOptionFlags options = kCFCompareCaseInsensitive;
+ if (comparison == BDSKEndWith || comparison == BDSKStartWith) {
+ if ([key isEqualToString:BDSKAllFieldsString]) {
+ if (comparison == BDSKEndWith) {
+ itemValue = [NSString stringWithFormat:@"%@%C", itemValue, (unichar)0x1E];
+ value = [NSString stringWithFormat:@"%@%C", stringValue, (unichar)0x1E];
+ } else if (comparison == BDSKStartWith) {
+ itemValue = [NSString stringWithFormat:@"%C%@", (unichar)0x1E, itemValue];
+ value = [NSString stringWithFormat:@"%C%@", (unichar)0x1E, stringValue];
+ }
+ } else {
+ options |= kCFCompareAnchored;
+ if (comparison == BDSKEndWith)
+ options |= kCFCompareBackwards;
}
- } else {
- options |= kCFCompareAnchored;
- if (comparison == BDSKEndWith)
- options |= kCFCompareBackwards;
}
+ CFIndex itemLength = CFStringGetLength((__bridge CFStringRef)itemValue);
+ Boolean foundString = CFStringFindWithOptions((__bridge CFStringRef)itemValue, (__bridge CFStringRef)value, CFRangeMake(0, itemLength), options, NULL);
+
+ return comparison == BDSKNotContain ? foundString == FALSE : foundString;
}
- CFIndex itemLength = CFStringGetLength((__bridge CFStringRef)itemValue);
- Boolean foundString = CFStringFindWithOptions((__bridge CFStringRef)itemValue, (__bridge CFStringRef)value, CFRangeMake(0, itemLength), options, NULL);
-
- return comparison == BDSKNotContain ? foundString == FALSE : foundString;
}
}
@@ -392,52 +394,62 @@
}
- (NSInteger)comparison {
- return [self isDateCondition] ? dateComparison : [self isAttachmentCondition] ? attachmentComparison : stringComparison;
+ switch (fieldType) {
+ case BDSKDateField: return dateComparison;
+ case BDSKLinkedField: return attachmentComparison;
+ default: return stringComparison;
+ }
}
- (void)setComparison:(NSInteger)newComparison {
- if ([self isDateCondition])
- [self setDateComparison:(BDSKDateComparison)newComparison];
- else if ([self isAttachmentCondition])
- [self setAttachmentComparison:(BDSKAttachmentComparison)newComparison];
- else
- [self setStringComparison:(BDSKStringComparison)newComparison];
+ switch (fieldType) {
+ case BDSKDateField:
+ [self setDateComparison:(BDSKDateComparison)newComparison];
+ break;
+ case BDSKLinkedField:
+ [self setAttachmentComparison:(BDSKAttachmentComparison)newComparison];
+ break;
+ default:
+ [self setStringComparison:(BDSKStringComparison)newComparison];
+ break;
+ }
}
- (NSString *)value {
- if ([self isDateCondition]) {
- switch (dateComparison) {
- case BDSKExactly:
- case BDSKInLast:
- case BDSKNotInLast:
- return [NSString stringWithFormat:@"%ld %ld", (long)numberValue, (long)periodValue];
- case BDSKBetween:
- return [NSString stringWithFormat:@"%ld %ld %ld", (long)numberValue, (long)andNumberValue, (long)periodValue];
- case BDSKDate:
- case BDSKAfterDate:
- case BDSKBeforeDate:
- return [dateValue standardDescription];
- case BDSKInDateRange:
- return [NSString stringWithFormat:@"%@ to %@", [dateValue standardDescription], [toDateValue standardDescription]];
- default:
- return @"";
- }
- } else if ([self isAttachmentCondition]) {
- switch (attachmentComparison) {
- case BDSKCountEqual:
- case BDSKCountNotEqual:
- case BDSKCountLarger:
- case BDSKCountSmaller:
- return [NSString stringWithFormat:@"%ld", (long)countValue];
- case BDSKAttachmentContain:
- case BDSKAttachmentNotContain:
- case BDSKAttachmentStartWith:
- case BDSKAttachmentEndWith:
- default:
- return [self stringValue];
- }
- } else {
- return [self stringValue];
+ switch (fieldType) {
+ case BDSKDateField:
+ switch (dateComparison) {
+ case BDSKExactly:
+ case BDSKInLast:
+ case BDSKNotInLast:
+ return [NSString stringWithFormat:@"%ld %ld", (long)numberValue, (long)periodValue];
+ case BDSKBetween:
+ return [NSString stringWithFormat:@"%ld %ld %ld", (long)numberValue, (long)andNumberValue, (long)periodValue];
+ case BDSKDate:
+ case BDSKAfterDate:
+ case BDSKBeforeDate:
+ return [dateValue standardDescription];
+ case BDSKInDateRange:
+ return [NSString stringWithFormat:@"%@ to %@", [dateValue standardDescription], [toDateValue standardDescription]];
+ default:
+ return @"";
+ }
+ case BDSKLinkedField:
+ switch (attachmentComparison) {
+ case BDSKCountEqual:
+ case BDSKCountNotEqual:
+ case BDSKCountLarger:
+ case BDSKCountSmaller:
+ return [NSString stringWithFormat:@"%ld", (long)countValue];
+ case BDSKAttachmentContain:
+ case BDSKAttachmentNotContain:
+ case BDSKAttachmentStartWith:
+ case BDSKAttachmentEndWith:
+ default:
+ return [self stringValue];
+ }
+ default:
+ return [self stringValue];
}
}
@@ -444,68 +456,74 @@
- (void)setValue:(NSString *)newValue {
// we never want the value to be nil. It is set to nil sometimes by the binding mechanism
if (newValue == nil) newValue = @"";
- if ([self isDateCondition]) {
- NSArray *values = nil;
- switch (dateComparison) {
- case BDSKExactly:
- case BDSKInLast:
- case BDSKNotInLast:
- values = [newValue componentsSeparatedByString:@" "];
- BDSKASSERT([values count] == 2);
- if ([values count] > 0) {
- [self setNumberValue:[[values objectAtIndex:0] integerValue]];
- if ([values count] > 1)
- [self setPeriodValue:[[values objectAtIndex:1] integerValue]];
- }
- break;
- case BDSKBetween:
- values = [newValue componentsSeparatedByString:@" "];
- BDSKASSERT([values count] == 3);
- if ([values count] > 0) {
- [self setNumberValue:[[values objectAtIndex:0] integerValue]];
- if ([values count] > 1) {
- [self setAndNumberValue:[[values objectAtIndex:1] integerValue]];
- if ([values count] > 2)
- [self setPeriodValue:[[values objectAtIndex:2] integerValue]];
+ switch (fieldType) {
+ case BDSKDateField:
+ {
+ NSArray *values = nil;
+ switch (dateComparison) {
+ case BDSKExactly:
+ case BDSKInLast:
+ case BDSKNotInLast:
+ values = [newValue componentsSeparatedByString:@" "];
+ BDSKASSERT([values count] == 2);
+ if ([values count] > 0) {
+ [self setNumberValue:[[values objectAtIndex:0] integerValue]];
+ if ([values count] > 1)
+ [self setPeriodValue:[[values objectAtIndex:1] integerValue]];
}
- }
- break;
- case BDSKDate:
- case BDSKAfterDate:
- case BDSKBeforeDate:
- [self setDateValue:[NSDate dateWithStandardDescription:newValue]];
- break;
- case BDSKInDateRange:
- values = [newValue componentsSeparatedByString:@" to "];
- BDSKASSERT([values count] == 2);
- if ([values count] > 0) {
- [self setDateValue:[NSDate dateWithStandardDescription:[values objectAtIndex:0]]];
- if ([values count] > 1)
- [self setToDateValue:[NSDate dateWithStandardDescription:[values objectAtIndex:1]]];
- }
- break;
- default:
- break;
+ break;
+ case BDSKBetween:
+ values = [newValue componentsSeparatedByString:@" "];
+ BDSKASSERT([values count] == 3);
+ if ([values count] > 0) {
+ [self setNumberValue:[[values objectAtIndex:0] integerValue]];
+ if ([values count] > 1) {
+ [self setAndNumberValue:[[values objectAtIndex:1] integerValue]];
+ if ([values count] > 2)
+ [self setPeriodValue:[[values objectAtIndex:2] integerValue]];
+ }
+ }
+ break;
+ case BDSKDate:
+ case BDSKAfterDate:
+ case BDSKBeforeDate:
+ [self setDateValue:[NSDate dateWithStandardDescription:newValue]];
+ break;
+ case BDSKInDateRange:
+ values = [newValue componentsSeparatedByString:@" to "];
+ BDSKASSERT([values count] == 2);
+ if ([values count] > 0) {
+ [self setDateValue:[NSDate dateWithStandardDescription:[values objectAtIndex:0]]];
+ if ([values count] > 1)
+ [self setToDateValue:[NSDate dateWithStandardDescription:[values objectAtIndex:1]]];
+ }
+ break;
+ default:
+ break;
+ }
}
- } else if ([self isAttachmentCondition]) {
- switch (attachmentComparison) {
- case BDSKCountEqual:
- case BDSKCountNotEqual:
- case BDSKCountLarger:
- case BDSKCountSmaller:
- [self setCountValue:[newValue integerValue]];
- break;
- case BDSKAttachmentContain:
- case BDSKAttachmentNotContain:
- case BDSKAttachmentStartWith:
- case BDSKAttachmentEndWith:
- [self setStringValue:newValue];
- break;
- default:
- break;
- }
- } else {
- [self setStringValue:newValue];
+ break;
+ case BDSKLinkedField:
+ switch (attachmentComparison) {
+ case BDSKCountEqual:
+ case BDSKCountNotEqual:
+ case BDSKCountLarger:
+ case BDSKCountSmaller:
+ [self setCountValue:[newValue integerValue]];
+ break;
+ case BDSKAttachmentContain:
+ case BDSKAttachmentNotContain:
+ case BDSKAttachmentStartWith:
+ case BDSKAttachmentEndWith:
+ [self setStringValue:newValue];
+ break;
+ default:
+ break;
+ }
+ break;
+ default:
+ [self setStringValue:newValue];
+ break;
}
}
@@ -521,14 +539,6 @@
#pragma mark Other
-- (BOOL)isDateCondition {
- return fieldType == BDSKDateField;
-}
-
-- (BOOL)isAttachmentCondition {
- return fieldType == BDSKLinkedField;
-}
-
- (void)setDefaultComparison {
// set some default comparison
switch (fieldType) {
@@ -581,7 +591,7 @@
- (void)setGroup:(id<BDSKSmartGroup>)newGroup {
group = newGroup;
- if ([self isDateCondition] && group == nil) {
+ if (fieldType == BDSKDateField && group == nil) {
[cacheTimer invalidate];
cacheTimer = nil;
cachedStartDate = nil;
@@ -600,20 +610,21 @@
}
- (NSString *)defaultName {
- if ([self isDateCondition]) {
- if ([self dateComparison] < BDSKDate || [self dateComparison] == BDSKThisSession)
- return [self key];
- else if ([self dateComparison] < BDSKInDateRange)
- return [dateValue shortDateDescription];
- else
- return [NSString stringWithFormat:@"%@ - %@", [dateValue shortDateDescription], [toDateValue shortDateDescription]];
- } else if ([self isAttachmentCondition]) {
- if ([self attachmentComparison] < BDSKAttachmentContain)
- return [self key];
- else
- return [self value];
- } else {
- return [self stringValue];
+ switch (fieldType) {
+ case BDSKDateField:
+ if ([self dateComparison] < BDSKDate || [self dateComparison] == BDSKThisSession)
+ return [self key];
+ else if ([self dateComparison] < BDSKInDateRange)
+ return [dateValue shortDateDescription];
+ else
+ return [NSString stringWithFormat:@"%@ - %@", [dateValue shortDateDescription], [toDateValue shortDateDescription]];
+ case BDSKLinkedField:
+ if ([self attachmentComparison] < BDSKAttachmentContain)
+ return [self key];
+ else
+ return [self value];
+ default:
+ return [self stringValue];
}
}
Modified: trunk/bibdesk/BDSKConditionController.m
===================================================================
--- trunk/bibdesk/BDSKConditionController.m 2026-04-30 22:02:14 UTC (rev 30339)
+++ trunk/bibdesk/BDSKConditionController.m 2026-04-30 22:32:48 UTC (rev 30340)
@@ -249,12 +249,17 @@
- (void)layoutComparisonControls {
NSView *currentView = [[comparisonView subviews] firstObject];
NSView *view = nil;
- if ([[self condition] isDateCondition])
- view = dateComparisonPopUp;
- else if ([[self condition] isAttachmentCondition])
- view = attachmentComparisonPopUp;
- else
- view = comparisonPopUp;
+ switch ([[self condition] fieldType]) {
+ case BDSKDateField:
+ view = dateComparisonPopUp;
+ break;
+ case BDSKLinkedField:
+ view = attachmentComparisonPopUp;
+ break;
+ default:
+ view = comparisonPopUp;
+ break;
+ }
view = [view superview];
if (view != currentView) {
[currentView removeFromSuperview];
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ho...@us...> - 2026-04-30 22:02:15
|
Revision: 30339
http://sourceforge.net/p/bibdesk/svn/30339
Author: hofman
Date: 2026-04-30 22:02:14 +0000 (Thu, 30 Apr 2026)
Log Message:
-----------
bind to fieldType with value transformer instead of using stringComparison
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 2026-04-30 21:38:01 UTC (rev 30338)
+++ trunk/bibdesk/BDSKCondition.h 2026-04-30 22:02:14 UTC (rev 30339)
@@ -155,7 +155,6 @@
@property (nonatomic, readonly, getter=isDateCondition) BOOL dateCondition;
@property (nonatomic, readonly, getter=isAttachmentCondition) BOOL attachmentCondition;
-@property (nonatomic, readonly, getter=isStringCondition) BOOL stringCondition;
@property (nonatomic, nullable, weak) id<BDSKSmartGroup> group;
Modified: trunk/bibdesk/BDSKCondition.m
===================================================================
--- trunk/bibdesk/BDSKCondition.m 2026-04-30 21:38:01 UTC (rev 30338)
+++ trunk/bibdesk/BDSKCondition.m 2026-04-30 22:02:14 UTC (rev 30339)
@@ -60,13 +60,13 @@
+ (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key {
NSSet *keyPaths = [super keyPathsForValuesAffectingValueForKey:key];
- if ([key isEqualToString:@"stringCondition"] || [key isEqualToString:@"attachmentCondition"] || [key isEqualToString:@"dateCondition"])
+ if ([key isEqualToString:@"fieldType"])
keyPaths = [keyPaths setByAddingObjectsFromSet:[NSSet setWithObjects:@"key", nil]];
return keyPaths;
}
@synthesize key, stringComparison, stringValue, attachmentComparison, countValue, dateComparison, numberValue, andNumberValue, periodValue, dateValue, toDateValue, fieldType, group;
-@dynamic dictionaryValue, value, comparison, dateCondition, attachmentCondition, stringCondition, defaultName;
+@dynamic dictionaryValue, value, comparison, dateCondition, attachmentCondition, defaultName;
+ (NSString *)dictionaryVersion {
return @"1";
@@ -529,10 +529,6 @@
return fieldType == BDSKLinkedField;
}
-- (BOOL)isStringCondition {
- return fieldType == BDSKStringField;
-}
-
- (void)setDefaultComparison {
// set some default comparison
switch (fieldType) {
Modified: trunk/bibdesk/Base.lproj/BDSKCondition.xib
===================================================================
--- trunk/bibdesk/Base.lproj/BDSKCondition.xib 2026-04-30 21:38:01 UTC (rev 30338)
+++ trunk/bibdesk/Base.lproj/BDSKCondition.xib 2026-04-30 22:02:14 UTC (rev 30339)
@@ -56,22 +56,38 @@
<menuItem title="does not contain part" tag="1" id="232"/>
<menuItem title="contains" tag="2" id="234">
<connections>
- <binding destination="-2" name="enabled" keyPath="representedObject.stringCondition" id="78u-0B-S9h"/>
+ <binding destination="-2" name="enabled" keyPath="representedObject.fieldType" id="UuA-lJ-bL9">
+ <dictionary key="options">
+ <string key="NSValueTransformerName">BDSKIsTwo</string>
+ </dictionary>
+ </binding>
</connections>
</menuItem>
<menuItem title="does not contain" tag="3" id="228">
<connections>
- <binding destination="-2" name="enabled" keyPath="representedObject.stringCondition" id="ohc-bq-pNm"/>
+ <binding destination="-2" name="enabled" keyPath="representedObject.fieldType" id="kyq-f3-73D">
+ <dictionary key="options">
+ <string key="NSValueTransformerName">BDSKIsTwo</string>
+ </dictionary>
+ </binding>
</connections>
</menuItem>
<menuItem title="starts with" tag="6" id="227">
<connections>
- <binding destination="-2" name="enabled" keyPath="representedObject.stringCondition" id="fyW-wu-eDL"/>
+ <binding destination="-2" name="enabled" keyPath="representedObject.fieldType" id="bQl-8J-oa3">
+ <dictionary key="options">
+ <string key="NSValueTransformerName">BDSKIsTwo</string>
+ </dictionary>
+ </binding>
</connections>
</menuItem>
<menuItem title="ends with" tag="7" id="229">
<connections>
- <binding destination="-2" name="enabled" keyPath="representedObject.stringCondition" id="y5K-hh-GRo"/>
+ <binding destination="-2" name="enabled" keyPath="representedObject.fieldType" id="gDh-5O-K9d">
+ <dictionary key="options">
+ <string key="NSValueTransformerName">BDSKIsTwo</string>
+ </dictionary>
+ </binding>
</connections>
</menuItem>
<menuItem title="comes before" tag="8" id="230"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ho...@us...> - 2026-04-30 21:38:04
|
Revision: 30338
http://sourceforge.net/p/bibdesk/svn/30338
Author: hofman
Date: 2026-04-30 21:38:01 +0000 (Thu, 30 Apr 2026)
Log Message:
-----------
cache fieldtype of condition key in ivar
Modified Paths:
--------------
trunk/bibdesk/BDSKCondition.h
trunk/bibdesk/BDSKCondition.m
trunk/bibdesk/BDSKConditionController.m
Modified: trunk/bibdesk/BDSKCondition.h
===================================================================
--- trunk/bibdesk/BDSKCondition.h 2026-04-30 19:15:08 UTC (rev 30337)
+++ trunk/bibdesk/BDSKCondition.h 2026-04-30 21:38:01 UTC (rev 30338)
@@ -99,6 +99,7 @@
@interface BDSKCondition : NSObject <NSCopying, NSSecureCoding> {
NSString *key;
+ BDSKFieldType fieldType;
BDSKStringComparison stringComparison;
BDSKAttachmentComparison attachmentComparison;
BDSKDateComparison dateComparison;
@@ -147,6 +148,8 @@
@property (nonatomic, nullable, strong) NSDate *dateValue;
@property (nonatomic, nullable, strong) NSDate *toDateValue;
+@property (nonatomic, readonly) BDSKFieldType fieldType;
+
- (void)setDefaultComparison;
- (void)setDefaultValue;
@@ -160,9 +163,6 @@
@end
+BDSKFieldType BDSKFieldTypeForKey(NSString *key);
-@interface NSString (BDSKConditionExtensions)
-@property (nonatomic, readonly) BDSKFieldType fieldType;
-@end
-
NS_ASSUME_NONNULL_END
Modified: trunk/bibdesk/BDSKCondition.m
===================================================================
--- trunk/bibdesk/BDSKCondition.m 2026-04-30 19:15:08 UTC (rev 30337)
+++ trunk/bibdesk/BDSKCondition.m 2026-04-30 21:38:01 UTC (rev 30338)
@@ -65,7 +65,7 @@
return keyPaths;
}
-@synthesize key, stringComparison, stringValue, attachmentComparison, countValue, dateComparison, numberValue, andNumberValue, periodValue, dateValue, toDateValue, group;
+@synthesize key, stringComparison, stringValue, attachmentComparison, countValue, dateComparison, numberValue, andNumberValue, periodValue, dateValue, toDateValue, fieldType, group;
@dynamic dictionaryValue, value, comparison, dateCondition, attachmentCondition, stringCondition, defaultName;
+ (NSString *)dictionaryVersion {
@@ -87,6 +87,7 @@
dateValue = nil;
toDateValue = nil;
authorValue = nil;
+ fieldType = BDSKStringField;
group = nil;
cachedStartDate = nil;
cachedEndDate = nil;
@@ -152,6 +153,7 @@
dateValue = nil;
toDateValue = nil;
authorValue = nil;
+ fieldType = BDSKFieldTypeForKey(key);
group = nil;
cachedStartDate = nil;
cachedEndDate = nil;
@@ -315,7 +317,7 @@
// to speed up comparisons
itemValue = [itemValue expandedString];
- if ([key isIntegerField] || [key isEqualToString:BDSKColorLabelString] || [key isEqualToString:BDSKColorString]) {
+ if (fieldType == BDSKBooleanField || fieldType == BDSKTriStateField || fieldType == BDSKRatingField || fieldType == BDSKColorField) {
if (comparison == BDSKStartWith || comparison == BDSKEndWith || comparison == BDSKContain)
comparison = BDSKEqual;
else if (comparison == BDSKNotContain)
@@ -329,11 +331,11 @@
value = [NSString stringWithFormat:@"%C%@%C", (unichar)0x1E, stringValue, (unichar)0x1E];
} else {
BOOL result;
- if ([key isBooleanField])
+ if (fieldType == BDSKBooleanField)
result = [value booleanValue] == [itemValue booleanValue];
- else if ([key isTriStateField])
+ else if (fieldType == BDSKTriStateField)
result = [value triStateValue] == [itemValue triStateValue];
- else if ([key isRatingField])
+ else if (fieldType == BDSKRatingField)
result = [value integerValue] == [itemValue integerValue];
else
result = [value isCaseInsensitiveEqual:itemValue];
@@ -341,13 +343,13 @@
}
} else if (comparison == BDSKSmaller || comparison == BDSKLarger) {
NSComparisonResult result;
- if ([key isBooleanField])
+ if (fieldType == BDSKBooleanField)
result = compareIntegerValues([value booleanValue], [itemValue booleanValue], NO);
- else if ([key isTriStateField])
+ else if (fieldType == BDSKTriStateField)
result = compareIntegerValues([value triStateValue], [itemValue triStateValue], YES);
- else if ([key isRatingField])
+ else if (fieldType == BDSKRatingField)
result = compareIntegerValues([value integerValue], [itemValue integerValue], NO);
- else if ([key isEqualToString:BDSKColorLabelString] || [key isEqualToString:BDSKColorString])
+ else if (fieldType == BDSKColorField)
result = [([NSColor colorWithFourByteString:value] ?: [NSColor clearSRGBColor]) colorCompare:([NSColor colorWithFourByteString:itemValue] ?: [NSColor clearSRGBColor])];
else
result = [value localizedCaseInsensitiveNumericCompare:itemValue];
@@ -385,6 +387,7 @@
- (void)setKey:(NSString *)newKey {
if (key != newKey) {
key = newKey ?: @"";
+ fieldType = BDSKFieldTypeForKey(key);
}
}
@@ -519,20 +522,20 @@
#pragma mark Other
- (BOOL)isDateCondition {
- return [key fieldType] == BDSKDateField;
+ return fieldType == BDSKDateField;
}
- (BOOL)isAttachmentCondition {
- return [key fieldType] == BDSKLinkedField;
+ return fieldType == BDSKLinkedField;
}
- (BOOL)isStringCondition {
- return [key fieldType] == BDSKStringField;
+ return fieldType == BDSKStringField;
}
- (void)setDefaultComparison {
// set some default comparison
- switch ([key fieldType]) {
+ switch (fieldType) {
case BDSKDateField:
[self setDateComparison:BDSKToday];
break;
@@ -550,7 +553,7 @@
- (void)setDefaultValue {
// set some default values
- switch ([key fieldType]) {
+ switch (fieldType) {
case BDSKDateField:
{
NSDate *today = [[NSDate date] startOfPeriod:BDSKPeriodDay byAdding:0 atHour:12 minute:0 second:0];
@@ -736,23 +739,19 @@
@end
-@implementation NSString (BDSKConditionExtensions)
-
-- (BDSKFieldType)fieldType {
- if ([self isEqualToString:BDSKDateAddedString] || [self isEqualToString:BDSKDateModifiedString])
+BDSKFieldType BDSKFieldTypeForKey(NSString *key) {
+ if ([key isEqualToString:BDSKDateAddedString] || [key isEqualToString:BDSKDateModifiedString])
return BDSKDateField;
- else if ([self isEqualToString:BDSKLocalFileString] || [self isEqualToString:BDSKRemoteURLString])
+ else if ([key isEqualToString:BDSKLocalFileString] || [key isEqualToString:BDSKRemoteURLString])
return BDSKLinkedField;
- else if ([self isBooleanField])
+ else if ([key isBooleanField])
return BDSKBooleanField;
- else if ([self isTriStateField])
+ else if ([key isTriStateField])
return BDSKTriStateField;
- else if ([self isRatingField])
+ else if ([key isRatingField])
return BDSKRatingField;
- else if ([self isEqualToString:BDSKColorLabelString] || [self isEqualToString:BDSKColorString])
+ else if ([key isEqualToString:BDSKColorLabelString] || [key isEqualToString:BDSKColorString])
return BDSKColorField;
else
return BDSKStringField;
}
-
-@end
Modified: trunk/bibdesk/BDSKConditionController.m
===================================================================
--- trunk/bibdesk/BDSKConditionController.m 2026-04-30 19:15:08 UTC (rev 30337)
+++ trunk/bibdesk/BDSKConditionController.m 2026-04-30 21:38:01 UTC (rev 30338)
@@ -164,7 +164,7 @@
- (void)layoutValueControls {
NSArray *controls = nil;
- switch ([[[self condition] key] fieldType]) {
+ switch ([[self condition] fieldType]) {
case BDSKDateField:
switch ([[self condition] dateComparison]) {
case BDSKExactly:
@@ -280,8 +280,8 @@
NSString *newValue = [change objectForKey:NSKeyValueChangeNewKey];
if ((id)newValue == [NSNull null])
newValue = nil;
- BDSKFieldType oldFieldType = [oldValue fieldType];
- BDSKFieldType newFieldType = [newValue fieldType];
+ BDSKFieldType oldFieldType = BDSKFieldTypeForKey(oldValue);
+ BDSKFieldType newFieldType = [object fieldType];
if(MIN(oldFieldType, BDSKStringField) != MIN(newFieldType, BDSKStringField))
[self layoutComparisonControls];
if(oldFieldType != newFieldType) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ho...@us...> - 2026-04-30 19:15:09
|
Revision: 30337
http://sourceforge.net/p/bibdesk/svn/30337
Author: hofman
Date: 2026-04-30 19:15:08 +0000 (Thu, 30 Apr 2026)
Log Message:
-----------
check whether we get valid values
Modified Paths:
--------------
trunk/bibdesk/BDSKCondition.m
Modified: trunk/bibdesk/BDSKCondition.m
===================================================================
--- trunk/bibdesk/BDSKCondition.m 2026-04-30 19:00:33 UTC (rev 30336)
+++ trunk/bibdesk/BDSKCondition.m 2026-04-30 19:15:08 UTC (rev 30337)
@@ -449,15 +449,23 @@
case BDSKNotInLast:
values = [newValue componentsSeparatedByString:@" "];
BDSKASSERT([values count] == 2);
- [self setNumberValue:[[values objectAtIndex:0] integerValue]];
- [self setPeriodValue:[[values objectAtIndex:1] integerValue]];
+ if ([values count] > 0) {
+ [self setNumberValue:[[values objectAtIndex:0] integerValue]];
+ if ([values count] > 1)
+ [self setPeriodValue:[[values objectAtIndex:1] integerValue]];
+ }
break;
case BDSKBetween:
values = [newValue componentsSeparatedByString:@" "];
BDSKASSERT([values count] == 3);
- [self setNumberValue:[[values objectAtIndex:0] integerValue]];
- [self setAndNumberValue:[[values objectAtIndex:1] integerValue]];
- [self setPeriodValue:[[values objectAtIndex:2] integerValue]];
+ if ([values count] > 0) {
+ [self setNumberValue:[[values objectAtIndex:0] integerValue]];
+ if ([values count] > 1) {
+ [self setAndNumberValue:[[values objectAtIndex:1] integerValue]];
+ if ([values count] > 2)
+ [self setPeriodValue:[[values objectAtIndex:2] integerValue]];
+ }
+ }
break;
case BDSKDate:
case BDSKAfterDate:
@@ -467,8 +475,11 @@
case BDSKInDateRange:
values = [newValue componentsSeparatedByString:@" to "];
BDSKASSERT([values count] == 2);
- [self setDateValue:[NSDate dateWithStandardDescription:[values objectAtIndex:0]]];
- [self setToDateValue:[NSDate dateWithStandardDescription:[values objectAtIndex:1]]];
+ if ([values count] > 0) {
+ [self setDateValue:[NSDate dateWithStandardDescription:[values objectAtIndex:0]]];
+ if ([values count] > 1)
+ [self setToDateValue:[NSDate dateWithStandardDescription:[values objectAtIndex:1]]];
+ }
break;
default:
break;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ho...@us...> - 2026-04-30 19:00:35
|
Revision: 30336
http://sourceforge.net/p/bibdesk/svn/30336
Author: hofman
Date: 2026-04-30 19:00:33 +0000 (Thu, 30 Apr 2026)
Log Message:
-----------
no need for switch
Modified Paths:
--------------
trunk/bibdesk/BDSKCondition.m
Modified: trunk/bibdesk/BDSKCondition.m
===================================================================
--- trunk/bibdesk/BDSKCondition.m 2026-04-30 18:56:18 UTC (rev 30335)
+++ trunk/bibdesk/BDSKCondition.m 2026-04-30 19:00:33 UTC (rev 30336)
@@ -373,21 +373,9 @@
}
CFIndex itemLength = CFStringGetLength((__bridge CFStringRef)itemValue);
Boolean foundString = CFStringFindWithOptions((__bridge CFStringRef)itemValue, (__bridge CFStringRef)value, CFRangeMake(0, itemLength), options, NULL);
- switch (comparison) {
- case BDSKContain:
- case BDSKStartWith:
- case BDSKEndWith:
- return foundString;
- case BDSKNotContain:
- return foundString == FALSE;
- default:
- break; // other enum types are handled before the switch, but the compiler doesn't know that
- }
+ return comparison == BDSKNotContain ? foundString == FALSE : foundString;
}
-
- BDSKASSERT_NOT_REACHED("undefined comparison");
- return NO;
}
#pragma mark Accessors
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ho...@us...> - 2026-04-30 18:56:19
|
Revision: 30335
http://sourceforge.net/p/bibdesk/svn/30335
Author: hofman
Date: 2026-04-30 18:56:18 +0000 (Thu, 30 Apr 2026)
Log Message:
-----------
use else for mutually exclusive cases
Modified Paths:
--------------
trunk/bibdesk/BDSKCondition.m
Modified: trunk/bibdesk/BDSKCondition.m
===================================================================
--- trunk/bibdesk/BDSKCondition.m 2026-04-30 18:49:37 UTC (rev 30334)
+++ trunk/bibdesk/BDSKCondition.m 2026-04-30 18:56:18 UTC (rev 30335)
@@ -339,9 +339,7 @@
result = [value isCaseInsensitiveEqual:itemValue];
return comparison == BDSKEqual ? result : result == NO;
}
- }
-
- if (comparison == BDSKSmaller || comparison == BDSKLarger) {
+ } else if (comparison == BDSKSmaller || comparison == BDSKLarger) {
NSComparisonResult result;
if ([key isBooleanField])
result = compareIntegerValues([value booleanValue], [itemValue booleanValue], NO);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ho...@us...> - 2026-04-30 18:49:39
|
Revision: 30334
http://sourceforge.net/p/bibdesk/svn/30334
Author: hofman
Date: 2026-04-30 18:49:37 +0000 (Thu, 30 Apr 2026)
Log Message:
-----------
don't need the found range
Modified Paths:
--------------
trunk/bibdesk/BDSKCondition.m
Modified: trunk/bibdesk/BDSKCondition.m
===================================================================
--- trunk/bibdesk/BDSKCondition.m 2026-04-30 18:42:13 UTC (rev 30333)
+++ trunk/bibdesk/BDSKCondition.m 2026-04-30 18:49:37 UTC (rev 30334)
@@ -274,10 +274,9 @@
options |= kCFCompareBackwards | kCFCompareAnchored;
else if (attachmentComparison == BDSKAttachmentStartWith)
options |= kCFCompareAnchored;
- CFRange range;
for (NSString *itemValue in itemValues) {
- if (CFStringFindWithOptions((__bridge CFStringRef)itemValue, (__bridge CFStringRef)stringValue, CFRangeMake(0, [itemValue length]), options, &range))
+ if (CFStringFindWithOptions((__bridge CFStringRef)itemValue, (__bridge CFStringRef)stringValue, CFRangeMake(0, [itemValue length]), options, NULL))
return matchReturnValue;
}
}
@@ -374,9 +373,8 @@
options |= kCFCompareBackwards;
}
}
- CFRange range;
CFIndex itemLength = CFStringGetLength((__bridge CFStringRef)itemValue);
- Boolean foundString = CFStringFindWithOptions((__bridge CFStringRef)itemValue, (__bridge CFStringRef)value, CFRangeMake(0, itemLength), options, &range);
+ Boolean foundString = CFStringFindWithOptions((__bridge CFStringRef)itemValue, (__bridge CFStringRef)value, CFRangeMake(0, itemLength), options, NULL);
switch (comparison) {
case BDSKContain:
case BDSKStartWith:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ho...@us...> - 2026-04-30 18:42:15
|
Revision: 30333
http://sourceforge.net/p/bibdesk/svn/30333
Author: hofman
Date: 2026-04-30 18:42:13 +0000 (Thu, 30 Apr 2026)
Log Message:
-----------
fix value to compare for tri state fields
Modified Paths:
--------------
trunk/bibdesk/BDSKCondition.m
Modified: trunk/bibdesk/BDSKCondition.m
===================================================================
--- trunk/bibdesk/BDSKCondition.m 2026-04-30 18:26:01 UTC (rev 30332)
+++ trunk/bibdesk/BDSKCondition.m 2026-04-30 18:42:13 UTC (rev 30333)
@@ -211,9 +211,9 @@
return 31 * ([[self value] hash] + 31 * [self comparison]) + [[self key] hash];
}
-static inline NSComparisonResult compareIntegerValues(NSInteger value1, NSInteger value2) {
+static inline NSComparisonResult compareIntegerValues(NSInteger value1, NSInteger value2, BOOL isTriState) {
// order negative mixed state between on and off, irrelevant when all are positive
- NSInteger diff = ABS(value1) + 2 * value1 - ABS(value2) - 2 * value2;
+ NSInteger diff = isTriState ? 2 * ABS(value1) + value1 - 2 * ABS(value2) - value2 : value1 - value2;
if (diff > 0)
return NSOrderedDescending;
else if (diff < 0)
@@ -340,16 +340,16 @@
result = [value isCaseInsensitiveEqual:itemValue];
return comparison == BDSKEqual ? result : result == NO;
}
- }
+ }
if (comparison == BDSKSmaller || comparison == BDSKLarger) {
NSComparisonResult result;
if ([key isBooleanField])
- result = compareIntegerValues([value booleanValue], [itemValue booleanValue]);
+ result = compareIntegerValues([value booleanValue], [itemValue booleanValue], NO);
else if ([key isTriStateField])
- result = compareIntegerValues([value triStateValue], [itemValue triStateValue]);
+ result = compareIntegerValues([value triStateValue], [itemValue triStateValue], YES);
else if ([key isRatingField])
- result = compareIntegerValues([value integerValue], [itemValue integerValue]);
+ result = compareIntegerValues([value integerValue], [itemValue integerValue], NO);
else if ([key isEqualToString:BDSKColorLabelString] || [key isEqualToString:BDSKColorString])
result = [([NSColor colorWithFourByteString:value] ?: [NSColor clearSRGBColor]) colorCompare:([NSColor colorWithFourByteString:itemValue] ?: [NSColor clearSRGBColor])];
else
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ho...@us...> - 2026-04-30 18:26:04
|
Revision: 30332
http://sourceforge.net/p/bibdesk/svn/30332
Author: hofman
Date: 2026-04-30 18:26:01 +0000 (Thu, 30 Apr 2026)
Log Message:
-----------
add common bit first
Modified Paths:
--------------
trunk/bibdesk/BDSKCondition.m
Modified: trunk/bibdesk/BDSKCondition.m
===================================================================
--- trunk/bibdesk/BDSKCondition.m 2026-04-30 18:21:35 UTC (rev 30331)
+++ trunk/bibdesk/BDSKCondition.m 2026-04-30 18:26:01 UTC (rev 30332)
@@ -369,10 +369,9 @@
value = [NSString stringWithFormat:@"%C%@", (unichar)0x1E, stringValue];
}
} else {
+ options |= kCFCompareAnchored;
if (comparison == BDSKEndWith)
- options |= kCFCompareBackwards | kCFCompareAnchored;
- else if (comparison == BDSKStartWith)
- options |= kCFCompareAnchored;
+ options |= kCFCompareBackwards;
}
}
CFRange range;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ho...@us...> - 2026-04-30 18:21:38
|
Revision: 30331
http://sourceforge.net/p/bibdesk/svn/30331
Author: hofman
Date: 2026-04-30 18:21:35 +0000 (Thu, 30 Apr 2026)
Log Message:
-----------
no need to compare when no linked files
Modified Paths:
--------------
trunk/bibdesk/BDSKCondition.m
Modified: trunk/bibdesk/BDSKCondition.m
===================================================================
--- trunk/bibdesk/BDSKCondition.m 2026-04-30 18:12:12 UTC (rev 30330)
+++ trunk/bibdesk/BDSKCondition.m 2026-04-30 18:21:35 UTC (rev 30331)
@@ -200,7 +200,7 @@
- (BOOL)isEqual:(id)other {
if (self == other)
return YES;
- if (![other isKindOfClass:[BDSKCondition class]])
+ if (NO == [other isKindOfClass:[BDSKCondition class]])
return NO;
return [[self key] isEqualToString:[(BDSKCondition *)other key]] &&
[self comparison] == [(BDSKCondition *)other comparison] &&
@@ -261,6 +261,7 @@
}
}
+ BOOL matchReturnValue = (attachmentComparison != BDSKAttachmentNotContain);
NSArray *itemValues = nil;
if ([key isEqualToString:BDSKLocalFileString])
itemValues = [[item existingLocalFiles] valueForKey:@"path"];
@@ -267,17 +268,18 @@
else if ([key isEqualToString:BDSKRemoteURLString])
itemValues = [[item remoteURLs] valueForKey:@"absoluteString"];
- CFOptionFlags options = kCFCompareCaseInsensitive;
- if (attachmentComparison == BDSKAttachmentEndWith)
- options |= kCFCompareBackwards | kCFCompareAnchored;
- else if (attachmentComparison == BDSKAttachmentStartWith)
- options |= kCFCompareAnchored;
- BOOL matchReturnValue = (attachmentComparison != BDSKAttachmentNotContain);
- CFRange range;
-
- for (NSString *itemValue in itemValues) {
- if (CFStringFindWithOptions((__bridge CFStringRef)itemValue, (__bridge CFStringRef)stringValue, CFRangeMake(0, [itemValue length]), options, &range))
- return matchReturnValue;
+ if ([itemValues count]) {
+ CFOptionFlags options = kCFCompareCaseInsensitive;
+ if (attachmentComparison == BDSKAttachmentEndWith)
+ options |= kCFCompareBackwards | kCFCompareAnchored;
+ else if (attachmentComparison == BDSKAttachmentStartWith)
+ options |= kCFCompareAnchored;
+ CFRange range;
+
+ for (NSString *itemValue in itemValues) {
+ if (CFStringFindWithOptions((__bridge CFStringRef)itemValue, (__bridge CFStringRef)stringValue, CFRangeMake(0, [itemValue length]), options, &range))
+ return matchReturnValue;
+ }
}
return NO == matchReturnValue;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ho...@us...> - 2026-04-30 18:12:13
|
Revision: 30330
http://sourceforge.net/p/bibdesk/svn/30330
Author: hofman
Date: 2026-04-30 18:12:12 +0000 (Thu, 30 Apr 2026)
Log Message:
-----------
only get count when we use it
Modified Paths:
--------------
trunk/bibdesk/BDSKCondition.m
Modified: trunk/bibdesk/BDSKCondition.m
===================================================================
--- trunk/bibdesk/BDSKCondition.m 2026-04-30 18:06:46 UTC (rev 30329)
+++ trunk/bibdesk/BDSKCondition.m 2026-04-30 18:12:12 UTC (rev 30330)
@@ -240,23 +240,25 @@
} else if ([self isAttachmentCondition]) {
- NSInteger count = 0;
- if ([key isEqualToString:BDSKLocalFileString])
- count = [[item localFiles] count];
- else if ([key isEqualToString:BDSKRemoteURLString])
- count = [[item remoteURLs] count];
-
- switch (attachmentComparison) {
- case BDSKCountEqual:
- return count == countValue;
- case BDSKCountNotEqual:
- return count != countValue;
- case BDSKCountLarger:
- return count > countValue;
- case BDSKCountSmaller:
- return count < countValue;
- default:
- break; // other enum values are handled below, but the compiler doesn't know that
+ if (attachmentComparison < BDSKAttachmentContain) {
+ NSInteger count = 0;
+ if ([key isEqualToString:BDSKLocalFileString])
+ count = [[item localFiles] count];
+ else if ([key isEqualToString:BDSKRemoteURLString])
+ count = [[item remoteURLs] count];
+
+ switch (attachmentComparison) {
+ case BDSKCountEqual:
+ return count == countValue;
+ case BDSKCountNotEqual:
+ return count != countValue;
+ case BDSKCountLarger:
+ return count > countValue;
+ case BDSKCountSmaller:
+ return count < countValue;
+ default:
+ break; // other enum values are handled below, but the compiler doesn't know that
+ }
}
NSArray *itemValues = nil;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ho...@us...> - 2026-04-30 18:06:48
|
Revision: 30329
http://sourceforge.net/p/bibdesk/svn/30329
Author: hofman
Date: 2026-04-30 18:06:46 +0000 (Thu, 30 Apr 2026)
Log Message:
-----------
recalculate hash
Modified Paths:
--------------
trunk/bibdesk/BDSKCondition.m
Modified: trunk/bibdesk/BDSKCondition.m
===================================================================
--- trunk/bibdesk/BDSKCondition.m 2026-04-30 18:03:33 UTC (rev 30328)
+++ trunk/bibdesk/BDSKCondition.m 2026-04-30 18:06:46 UTC (rev 30329)
@@ -208,9 +208,7 @@
}
- (NSUInteger)hash {
- NSUInteger prime = 31;
- NSUInteger hash = prime * ([[self key] hash] + prime * [[self value] hash]) + [self comparison];
- return hash;
+ return 31 * ([[self value] hash] + 31 * [self comparison]) + [[self key] hash];
}
static inline NSComparisonResult compareIntegerValues(NSInteger value1, NSInteger value2) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ho...@us...> - 2026-04-30 18:03:34
|
Revision: 30328
http://sourceforge.net/p/bibdesk/svn/30328
Author: hofman
Date: 2026-04-30 18:03:33 +0000 (Thu, 30 Apr 2026)
Log Message:
-----------
compare comparison before value
Modified Paths:
--------------
trunk/bibdesk/BDSKCondition.m
Modified: trunk/bibdesk/BDSKCondition.m
===================================================================
--- trunk/bibdesk/BDSKCondition.m 2026-04-30 17:41:30 UTC (rev 30327)
+++ trunk/bibdesk/BDSKCondition.m 2026-04-30 18:03:33 UTC (rev 30328)
@@ -203,8 +203,8 @@
if (![other isKindOfClass:[BDSKCondition class]])
return NO;
return [[self key] isEqualToString:[(BDSKCondition *)other key]] &&
- [[self value] isEqualToString:[(BDSKCondition *)other value]] &&
- [self comparison] == [(BDSKCondition *)other comparison];
+ [self comparison] == [(BDSKCondition *)other comparison] &&
+ [[self value] isEqualToString:[(BDSKCondition *)other value]];
}
- (NSUInteger)hash {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ho...@us...> - 2026-04-30 17:41:33
|
Revision: 30327
http://sourceforge.net/p/bibdesk/svn/30327
Author: hofman
Date: 2026-04-30 17:41:30 +0000 (Thu, 30 Apr 2026)
Log Message:
-----------
only redirect first responder if we don't remove the only one
Modified Paths:
--------------
trunk/bibdesk/BDSKFilterController.m
Modified: trunk/bibdesk/BDSKFilterController.m
===================================================================
--- trunk/bibdesk/BDSKFilterController.m 2026-04-30 17:27:58 UTC (rev 30326)
+++ trunk/bibdesk/BDSKFilterController.m 2026-04-30 17:41:30 UTC (rev 30327)
@@ -148,14 +148,8 @@
[[[self undoManager] prepareWithInvocationTarget:self] insertObject:aConditionController inConditionControllersAtIndex:idx];
id firstResponder = [[self window] firstResponder];
- if ([firstResponder respondsToSelector:@selector(isDescendantOf:)] && [firstResponder isDescendantOf:[aConditionController view]]) {
- if (idx + 1 < [conditionControllers count])
- [[[conditionControllers objectAtIndex:idx + 1] keyComboBox] selectText:nil];
- else if (idx > 0)
- [[[conditionControllers objectAtIndex:idx - 1] keyComboBox] selectText:nil];
- else
- [[self window] makeFirstResponder:[self window]];
- }
+ if ([firstResponder respondsToSelector:@selector(isDescendantOf:)] && [firstResponder isDescendantOf:[aConditionController view]] && [self hasMultipleConditions])
+ [[[conditionControllers objectAtIndex:idx + 1 < [conditionControllers count] ? idx + 1 : idx - 1] keyComboBox] selectText:nil];
[aConditionController setFilterController:nil];
[self removeConditionView:aConditionController];
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ho...@us...> - 2026-04-30 17:28:00
|
Revision: 30326
http://sourceforge.net/p/bibdesk/svn/30326
Author: hofman
Date: 2026-04-30 17:27:58 +0000 (Thu, 30 Apr 2026)
Log Message:
-----------
redirect first responder after animating adding new condition and before removing condition
Modified Paths:
--------------
trunk/bibdesk/BDSKFilterController.m
Modified: trunk/bibdesk/BDSKFilterController.m
===================================================================
--- trunk/bibdesk/BDSKFilterController.m 2026-04-30 17:03:41 UTC (rev 30325)
+++ trunk/bibdesk/BDSKFilterController.m 2026-04-30 17:27:58 UTC (rev 30326)
@@ -125,7 +125,7 @@
++idx;
BDSKConditionController *newController = [[BDSKConditionController alloc] init];
[self insertObject:newController inConditionControllersAtIndex:idx];
- [[newController keyComboBox] selectText:self];
+ [[newController keyComboBox] performSelector:@selector(selectText:) withObject:nil afterDelay:[NSAnimationContext defaultAnimationTimeInterval]];
}
- (void)insertObject:(BDSKConditionController *)newController inConditionControllersAtIndex:(NSUInteger)idx {
@@ -147,6 +147,16 @@
[[[self undoManager] prepareWithInvocationTarget:self] insertObject:aConditionController inConditionControllersAtIndex:idx];
+ id firstResponder = [[self window] firstResponder];
+ if ([firstResponder respondsToSelector:@selector(isDescendantOf:)] && [firstResponder isDescendantOf:[aConditionController view]]) {
+ if (idx + 1 < [conditionControllers count])
+ [[[conditionControllers objectAtIndex:idx + 1] keyComboBox] selectText:nil];
+ else if (idx > 0)
+ [[[conditionControllers objectAtIndex:idx - 1] keyComboBox] selectText:nil];
+ else
+ [[self window] makeFirstResponder:[self window]];
+ }
+
[aConditionController setFilterController:nil];
[self removeConditionView:aConditionController];
[conditionControllers removeObject:aConditionController];
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ho...@us...> - 2026-04-30 17:03:44
|
Revision: 30325
http://sourceforge.net/p/bibdesk/svn/30325
Author: hofman
Date: 2026-04-30 17:03:41 +0000 (Thu, 30 Apr 2026)
Log Message:
-----------
remove title from filter sheet
Modified Paths:
--------------
trunk/bibdesk/Base.lproj/BDSKFilter.xib
trunk/bibdesk/de.lproj/BDSKFilter.strings
trunk/bibdesk/en.lproj/BDSKFilter.strings
trunk/bibdesk/fr.lproj/BDSKFilter.strings
Modified: trunk/bibdesk/Base.lproj/BDSKFilter.xib
===================================================================
--- trunk/bibdesk/Base.lproj/BDSKFilter.xib 2026-04-30 17:00:50 UTC (rev 30324)
+++ trunk/bibdesk/Base.lproj/BDSKFilter.xib 2026-04-30 17:03:41 UTC (rev 30325)
@@ -17,7 +17,7 @@
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
- <window title="Smart Group" allowsToolTipsWhenApplicationIsInactive="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="6" userLabel="Window">
+ <window allowsToolTipsWhenApplicationIsInactive="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="6" userLabel="Window">
<windowStyleMask key="styleMask" titled="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="50" y="400" width="630" height="190"/>
Modified: trunk/bibdesk/de.lproj/BDSKFilter.strings
===================================================================
(Binary files differ)
Modified: trunk/bibdesk/en.lproj/BDSKFilter.strings
===================================================================
(Binary files differ)
Modified: trunk/bibdesk/fr.lproj/BDSKFilter.strings
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ho...@us...> - 2026-04-30 17:00:51
|
Revision: 30324
http://sourceforge.net/p/bibdesk/svn/30324
Author: hofman
Date: 2026-04-30 17:00:50 +0000 (Thu, 30 Apr 2026)
Log Message:
-----------
make some views smaller in ib
Modified Paths:
--------------
trunk/bibdesk/Base.lproj/BDSKCondition.xib
trunk/bibdesk/Base.lproj/BDSKFilter.xib
Modified: trunk/bibdesk/Base.lproj/BDSKCondition.xib
===================================================================
--- trunk/bibdesk/Base.lproj/BDSKCondition.xib 2026-04-29 22:06:36 UTC (rev 30323)
+++ trunk/bibdesk/Base.lproj/BDSKCondition.xib 2026-04-30 17:00:50 UTC (rev 30324)
@@ -579,10 +579,10 @@
<point key="canvasLocation" x="62" y="150"/>
</customView>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="1Np-fm-P1q" userLabel="View">
- <rect key="frame" x="0.0" y="0.0" width="631" height="28"/>
+ <rect key="frame" x="0.0" y="0.0" width="583" height="28"/>
<subviews>
<button verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="270" userLabel="Remove Button">
- <rect key="frame" x="593" y="5" width="16" height="17"/>
+ <rect key="frame" x="545" y="5" width="16" height="17"/>
<constraints>
<constraint firstAttribute="width" secondItem="270" secondAttribute="height" multiplier="1:1" id="TZA-Ic-0zn"/>
</constraints>
@@ -611,7 +611,7 @@
</connections>
</button>
<button verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="271" userLabel="Add Button">
- <rect key="frame" x="613" y="5" width="16" height="17"/>
+ <rect key="frame" x="565" y="5" width="16" height="17"/>
<constraints>
<constraint firstAttribute="width" secondItem="271" secondAttribute="height" multiplier="1:1" id="HOv-hg-yPq"/>
</constraints>
@@ -633,9 +633,9 @@
</connections>
</button>
<comboBox verticalHuggingPriority="750" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="272">
- <rect key="frame" x="10" y="2" width="142" height="22"/>
+ <rect key="frame" x="10" y="2" width="123" height="22"/>
<constraints>
- <constraint firstAttribute="width" constant="139" id="a3h-dq-jbs"/>
+ <constraint firstAttribute="width" constant="120" id="a3h-dq-jbs"/>
</constraints>
<comboBoxCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" numberOfVisibleItems="5" id="456" customClass="BDSKComboBoxCell">
<font key="font" metaFont="smallSystem"/>
@@ -653,10 +653,10 @@
</connections>
</comboBox>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="0gC-VL-mI4" userLabel="Comparison View">
- <rect key="frame" x="153" y="0.0" width="192" height="28"/>
+ <rect key="frame" x="134" y="0.0" width="163" height="28"/>
<constraints>
<constraint firstAttribute="height" constant="28" id="OMd-Cu-LTZ"/>
- <constraint firstAttribute="width" constant="192" id="YRk-AL-o36"/>
+ <constraint firstAttribute="width" constant="163" id="YRk-AL-o36"/>
</constraints>
<connections>
<binding destination="-2" name="hidden" keyPath="representedObject" id="dy4-gO-Vyn">
@@ -667,7 +667,7 @@
</connections>
</customView>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="z1V-0e-oWA" userLabel="Value View">
- <rect key="frame" x="345" y="0.0" width="240" height="28"/>
+ <rect key="frame" x="297" y="0.0" width="240" height="28"/>
<constraints>
<constraint firstAttribute="height" constant="28" id="fnK-xP-Wvx"/>
<constraint firstAttribute="width" constant="240" id="khh-IA-HtI"/>
Modified: trunk/bibdesk/Base.lproj/BDSKFilter.xib
===================================================================
--- trunk/bibdesk/Base.lproj/BDSKFilter.xib 2026-04-29 22:06:36 UTC (rev 30323)
+++ trunk/bibdesk/Base.lproj/BDSKFilter.xib 2026-04-30 17:00:50 UTC (rev 30324)
@@ -20,20 +20,20 @@
<window title="Smart Group" allowsToolTipsWhenApplicationIsInactive="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="6" userLabel="Window">
<windowStyleMask key="styleMask" titled="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
- <rect key="contentRect" x="54" y="461" width="700" height="200"/>
+ <rect key="contentRect" x="50" y="400" width="630" height="190"/>
<rect key="screenRect" x="0.0" y="0.0" width="1280" height="775"/>
<view key="contentView" id="5">
- <rect key="frame" x="0.0" y="0.0" width="700" height="200"/>
+ <rect key="frame" x="0.0" y="0.0" width="630" height="190"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<scrollView autohidesScrollers="YES" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="81">
- <rect key="frame" x="20" y="60" width="660" height="68"/>
+ <rect key="frame" x="20" y="60" width="590" height="58"/>
<clipView key="contentView" autoresizesSubviews="NO" drawsBackground="NO" copiesOnScroll="NO" id="vHk-Pm-is4">
- <rect key="frame" x="1" y="1" width="658" height="66"/>
+ <rect key="frame" x="1" y="1" width="588" height="56"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="23" customClass="BDSKFlippedView">
- <rect key="frame" x="0.0" y="0.0" width="652" height="66"/>
+ <rect key="frame" x="0.0" y="0.0" width="582" height="56"/>
</customView>
</subviews>
<constraints>
@@ -51,13 +51,13 @@
<rect key="frame" x="-100" y="-100" width="606" height="11"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
- <scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" controlSize="small" horizontal="NO" id="95">
- <rect key="frame" x="645" y="1" width="14" height="66"/>
+ <scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" doubleValue="1" controlSize="small" horizontal="NO" id="95">
+ <rect key="frame" x="565" y="1" width="14" height="56"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
</scrollView>
<button verticalHuggingPriority="750" tag="1" translatesAutoresizingMaskIntoConstraints="NO" id="10">
- <rect key="frame" x="611" y="13" width="76" height="32"/>
+ <rect key="frame" x="541" y="13" width="76" height="32"/>
<buttonCell key="cell" type="push" title="OK" bezelStyle="rounded" alignment="center" borderStyle="border" tag="1" inset="2" id="89">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
@@ -70,7 +70,7 @@
</connections>
</button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="11">
- <rect key="frame" x="537" y="13" width="76" height="32"/>
+ <rect key="frame" x="467" y="13" width="76" height="32"/>
<buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" borderStyle="border" inset="2" id="90">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
@@ -83,7 +83,7 @@
</connections>
</button>
<popUpButton horizontalHuggingPriority="750" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="55">
- <rect key="frame" x="63" y="132" width="61" height="25"/>
+ <rect key="frame" x="63" y="122" width="61" height="25"/>
<popUpButtonCell key="cell" type="push" title="all" bezelStyle="rounded" alignment="left" lineBreakMode="clipping" state="on" borderStyle="borderAndBezel" inset="2" selectedItem="53" id="91">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
@@ -105,7 +105,7 @@
</connections>
</popUpButton>
<textField horizontalHuggingPriority="750" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="57">
- <rect key="frame" x="126" y="139" width="168" height="16"/>
+ <rect key="frame" x="126" y="129" width="168" height="16"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="left" title="of the following conditions:" id="92">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -120,7 +120,7 @@
</connections>
</textField>
<textField horizontalHuggingPriority="750" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="78">
- <rect key="frame" x="18" y="139" width="42" height="16"/>
+ <rect key="frame" x="18" y="129" width="42" height="16"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Match" id="93">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -135,7 +135,7 @@
</connections>
</textField>
<textField horizontalHuggingPriority="750" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Oh1-Yd-YN3">
- <rect key="frame" x="18" y="139" width="187" height="16"/>
+ <rect key="frame" x="18" y="129" width="187" height="16"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Match the following condition:" id="rVM-jM-6Yw">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -146,7 +146,7 @@
</connections>
</textField>
<textField horizontalHuggingPriority="750" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="86">
- <rect key="frame" x="18" y="164" width="144" height="16"/>
+ <rect key="frame" x="18" y="154" width="144" height="16"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Smart Group Settings" id="94">
<font key="font" metaFont="systemBold"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ho...@us...> - 2026-04-29 22:06:39
|
Revision: 30323
http://sourceforge.net/p/bibdesk/svn/30323
Author: hofman
Date: 2026-04-29 22:06:36 +0000 (Wed, 29 Apr 2026)
Log Message:
-----------
reserve space for scrollers only when it is not hidden
Modified Paths:
--------------
trunk/bibdesk/BDSKFilterController.m
trunk/bibdesk/Base.lproj/BDSKCondition.xib
Modified: trunk/bibdesk/BDSKFilterController.m
===================================================================
--- trunk/bibdesk/BDSKFilterController.m 2026-04-29 17:19:34 UTC (rev 30322)
+++ trunk/bibdesk/BDSKFilterController.m 2026-04-29 22:06:36 UTC (rev 30323)
@@ -97,15 +97,15 @@
return @"BDSKFilter";
}
-- (void)handleScrollerStyleChanged:(NSNotification *)notification {
- [widthConstraint setConstant:[NSScroller preferredScrollerStyle] == NSScrollerStyleLegacy ? [NSScroller scrollerWidthForControlSize:NSControlSizeRegular scrollerStyle:NSScrollerStyleLegacy] : SCROLLVIEW_MARGIN];
+- (void)updateScrollerMargin:(NSNotification *)notification {
+ [widthConstraint setConstant:[NSScroller preferredScrollerStyle] == NSScrollerStyleLegacy && [conditionControllers count] > 10 ? [NSScroller scrollerWidthForControlSize:NSControlSizeRegular scrollerStyle:NSScrollerStyleLegacy] : SCROLLVIEW_MARGIN];
}
- (void)windowDidLoad {
[self addConditionViews:[conditionControllers valueForKey:@"view"]];
[conditionControllers setValue:self forKey:@"filterController"];
- [self handleScrollerStyleChanged:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleScrollerStyleChanged:) name:NSPreferredScrollerStyleDidChangeNotification object:nil];
+ [self updateScrollerMargin:nil];
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateScrollerMargin:) name:NSPreferredScrollerStyleDidChangeNotification object:nil];
}
- (void)didDismissSheet {
@@ -134,6 +134,7 @@
[conditionControllers insertObject:newController atIndex:idx];
[newController setFilterController:self];
[self insertConditionView:newController atIndex:idx];
+ [self updateScrollerMargin:nil];
}
- (void)removeConditionController:(BDSKConditionController *)aConditionController {
@@ -149,6 +150,7 @@
[aConditionController setFilterController:nil];
[self removeConditionView:aConditionController];
[conditionControllers removeObject:aConditionController];
+ [self updateScrollerMargin:nil];
}
- (void)setConjunction:(BDSKConjunction)newConjunction {
Modified: trunk/bibdesk/Base.lproj/BDSKCondition.xib
===================================================================
--- trunk/bibdesk/Base.lproj/BDSKCondition.xib 2026-04-29 17:19:34 UTC (rev 30322)
+++ trunk/bibdesk/Base.lproj/BDSKCondition.xib 2026-04-29 22:06:36 UTC (rev 30323)
@@ -579,7 +579,7 @@
<point key="canvasLocation" x="62" y="150"/>
</customView>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="1Np-fm-P1q" userLabel="View">
- <rect key="frame" x="0.0" y="0.0" width="633" height="28"/>
+ <rect key="frame" x="0.0" y="0.0" width="631" height="28"/>
<subviews>
<button verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="270" userLabel="Remove Button">
<rect key="frame" x="593" y="5" width="16" height="17"/>
@@ -686,7 +686,7 @@
<constraint firstItem="272" firstAttribute="leading" secondItem="1Np-fm-P1q" secondAttribute="leading" constant="10" id="5HK-wS-0hV"/>
<constraint firstItem="z1V-0e-oWA" firstAttribute="centerY" secondItem="1Np-fm-P1q" secondAttribute="centerY" id="GCr-qg-IIZ"/>
<constraint firstItem="271" firstAttribute="centerY" secondItem="1Np-fm-P1q" secondAttribute="centerY" id="HD4-3G-2Ao"/>
- <constraint firstAttribute="trailing" secondItem="271" secondAttribute="trailing" constant="4" id="Hbz-4S-pFW"/>
+ <constraint firstAttribute="trailing" secondItem="271" secondAttribute="trailing" constant="2" id="Hbz-4S-pFW"/>
<constraint firstItem="271" firstAttribute="leading" secondItem="270" secondAttribute="trailing" constant="4" id="Lo0-be-pzZ"/>
<constraint firstItem="270" firstAttribute="leading" secondItem="z1V-0e-oWA" secondAttribute="trailing" constant="8" id="OM2-u4-H34"/>
<constraint firstItem="0gC-VL-mI4" firstAttribute="leading" secondItem="272" secondAttribute="trailing" constant="4" id="bqW-Gd-tO8"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ho...@us...> - 2026-04-29 17:19:36
|
Revision: 30322
http://sourceforge.net/p/bibdesk/svn/30322
Author: hofman
Date: 2026-04-29 17:19:34 +0000 (Wed, 29 Apr 2026)
Log Message:
-----------
use typeename in enum values
Modified Paths:
--------------
trunk/bibdesk/BDSKFilter.h
trunk/bibdesk/BDSKFilter.m
trunk/bibdesk/BDSKGroup+Scripting.m
Modified: trunk/bibdesk/BDSKFilter.h
===================================================================
--- trunk/bibdesk/BDSKFilter.h 2026-04-29 17:07:25 UTC (rev 30321)
+++ trunk/bibdesk/BDSKFilter.h 2026-04-29 17:19:34 UTC (rev 30322)
@@ -41,8 +41,8 @@
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSInteger, BDSKConjunction) {
- BDSKAnd = 0,
- BDSKOr = 1
+ BDSKConjunctionAnd = 0,
+ BDSKConjunctionOr = 1
};
@protocol BDSKSmartGroup;
Modified: trunk/bibdesk/BDSKFilter.m
===================================================================
--- trunk/bibdesk/BDSKFilter.m 2026-04-29 17:07:25 UTC (rev 30321)
+++ trunk/bibdesk/BDSKFilter.m 2026-04-29 17:19:34 UTC (rev 30322)
@@ -51,7 +51,7 @@
@dynamic dictionaryValue, conditions, undoManager;
- (instancetype)init {
- return [self initWithConditions:@[[[BDSKCondition alloc] init]] conjunction:BDSKAnd];
+ return [self initWithConditions:@[[[BDSKCondition alloc] init]] conjunction:BDSKConjunctionAnd];
}
- (instancetype)initWithConditions:(NSArray *)aConditions conjunction:(BDSKConjunction)aConjunction {
@@ -111,7 +111,7 @@
}
- (NSString *)description {
- return [NSString stringWithFormat:@"%@ conditions=\"%@\" conjunction=\"%@\"", [super description], conditions, (conjunction == BDSKAnd ? @"AND" : @"OR")];
+ return [NSString stringWithFormat:@"%@ conditions=\"%@\" conjunction=\"%@\"", [super description], conditions, (conjunction == BDSKConjunctionAnd ? @"AND" : @"OR")];
}
- (NSDictionary *)dictionaryValue {
@@ -139,7 +139,7 @@
if ([conditions count] == 0)
return YES;
- BOOL isOr = (conjunction == BDSKOr);
+ BOOL isOr = (conjunction == BDSKConjunctionOr);
for (BDSKCondition *condition in conditions) {
if ([condition isSatisfiedByItem:item] == isOr)
Modified: trunk/bibdesk/BDSKGroup+Scripting.m
===================================================================
--- trunk/bibdesk/BDSKGroup+Scripting.m 2026-04-29 17:07:25 UTC (rev 30321)
+++ trunk/bibdesk/BDSKGroup+Scripting.m 2026-04-29 17:19:34 UTC (rev 30322)
@@ -397,11 +397,11 @@
}
- (BOOL)satisfyAll {
- return [[self filter] conjunction] == BDSKAnd;
+ return [[self filter] conjunction] == BDSKConjunctionAnd;
}
- (void)setSatisfyAll:(BOOL)flag {
- return [[self filter] setConjunction:flag ? BDSKAnd : BDSKOr];
+ return [[self filter] setConjunction:flag ? BDSKConjunctionAnd : BDSKConjunctionOr];
}
@end
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ho...@us...> - 2026-04-29 17:07:26
|
Revision: 30321
http://sourceforge.net/p/bibdesk/svn/30321
Author: hofman
Date: 2026-04-29 17:07:25 +0000 (Wed, 29 Apr 2026)
Log Message:
-----------
remove unused macro
Modified Paths:
--------------
trunk/bibdesk/BDSKFilterController.m
Modified: trunk/bibdesk/BDSKFilterController.m
===================================================================
--- trunk/bibdesk/BDSKFilterController.m 2026-04-29 16:52:12 UTC (rev 30320)
+++ trunk/bibdesk/BDSKFilterController.m 2026-04-29 17:07:25 UTC (rev 30321)
@@ -43,7 +43,6 @@
#import "BDSKTouchBarButtonGroup.h"
#import "NSAnimationContext_BDSKExtensions.h"
-#define MAX_HEIGHT 320.0
#define SCROLLVIEW_MARGIN 8.0
#define BDSKTouchBarItemIdentifierButtons @"edu.ucsd.mmccrack.bibdesk.touchbar-item.buttons"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ho...@us...> - 2026-04-29 16:52:15
|
Revision: 30320
http://sourceforge.net/p/bibdesk/svn/30320
Author: hofman
Date: 2026-04-29 16:52:12 +0000 (Wed, 29 Apr 2026)
Log Message:
-----------
don't animate removing conditions when disabbling animations
Modified Paths:
--------------
trunk/bibdesk/BDSKFilterController.m
Modified: trunk/bibdesk/BDSKFilterController.m
===================================================================
--- trunk/bibdesk/BDSKFilterController.m 2026-04-29 16:49:34 UTC (rev 30319)
+++ trunk/bibdesk/BDSKFilterController.m 2026-04-29 16:52:12 UTC (rev 30320)
@@ -247,17 +247,30 @@
NSView *view = [aConditionController view];
NSArray *subviews = [conditionsView subviews];
NSUInteger idx = [subviews indexOfObjectIdenticalTo:view];
+ NSTimeInterval duration = [NSAnimationContext defaultAnimationTimeInterval];
if (idx != NSNotFound) {
NSView *prevView = idx == 0 ? nil : [subviews objectAtIndex:idx - 1];
NSView *nextView = idx + 1 == [subviews count] ? nil : [subviews objectAtIndex:idx + 1];
- NSLayoutConstraint *heightConstraint = [aConditionController heightConstraint];
- CGFloat height = [heightConstraint constant];
- [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context){
- [[heightConstraint animator] setConstant:0.0];
- } completionHandler:^{
- [heightConstraint setConstant:height];
+ if (duration > 0.0) {
+ NSLayoutConstraint *heightConstraint = [aConditionController heightConstraint];
+ CGFloat height = [heightConstraint constant];
+ [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context){
+ [context setDuration:duration];
+ [[heightConstraint animator] setConstant:0.0];
+ } completionHandler:^{
+ [heightConstraint setConstant:height];
+ [view removeFromSuperview];
+ [verticalConstraints removeObjectAtIndex:idx];
+ [verticalConstraints removeObjectAtIndex:idx];
+ if (prevView || nextView) {
+ NSLayoutConstraint *constraint = [(nextView ? [nextView topAnchor] : [conditionsView bottomAnchor]) constraintEqualToAnchor:(prevView ? [prevView bottomAnchor] : [conditionsView topAnchor])];
+ [constraint setActive:YES];
+ [verticalConstraints insertObject:constraint atIndex:idx];
+ }
+ }];
+ } else {
[view removeFromSuperview];
[verticalConstraints removeObjectAtIndex:idx];
[verticalConstraints removeObjectAtIndex:idx];
@@ -266,7 +279,7 @@
[constraint setActive:YES];
[verticalConstraints insertObject:constraint atIndex:idx];
}
- }];
+ }
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ho...@us...> - 2026-04-29 16:49:38
|
Revision: 30319
http://sourceforge.net/p/bibdesk/svn/30319
Author: hofman
Date: 2026-04-29 16:49:34 +0000 (Wed, 29 Apr 2026)
Log Message:
-----------
use default animation duration
Modified Paths:
--------------
trunk/bibdesk/BDSKFilterController.m
Modified: trunk/bibdesk/BDSKFilterController.m
===================================================================
--- trunk/bibdesk/BDSKFilterController.m 2026-04-29 16:47:16 UTC (rev 30318)
+++ trunk/bibdesk/BDSKFilterController.m 2026-04-29 16:49:34 UTC (rev 30319)
@@ -209,6 +209,7 @@
if (duration > 0.0) {
[NSAnimationContext runAnimationGroup:^(NSAnimationContext *context){
+ [context setDuration:duration];
[[heightConstraint animator] setConstant:height];
} completionHandler:^{
[conditionsView scrollRectToVisible:[view frame]];
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|