Revision: 14042
http://sourceforge.net/p/skim-app/code/14042
Author: hofman
Date: 2024-02-13 00:14:04 +0000 (Tue, 13 Feb 2024)
Log Message:
-----------
implement hash and isEqual: for some scripting classes
Modified Paths:
--------------
trunk/SKDisplayPrefs.m
trunk/SKLine.m
trunk/SKNotePrefs.m
Modified: trunk/SKDisplayPrefs.m
===================================================================
--- trunk/SKDisplayPrefs.m 2024-02-04 15:17:04 UTC (rev 14041)
+++ trunk/SKDisplayPrefs.m 2024-02-13 00:14:04 UTC (rev 14042)
@@ -64,6 +64,16 @@
return self;
}
+- (NSUInteger)hash {
+ return 31 * (1 + 31 * fullScreen);
+}
+
+- (BOOL)isEqual:(id)other {
+ if ([other isKindOfClass:[self class]] == NO)
+ return NO;
+ return ((SKDisplayPrefs *)other)->fullScreen == fullScreen;
+}
+
- (NSString *)name {
return fullScreen ? @"FullScreen" : @"Normal";
}
Modified: trunk/SKLine.m
===================================================================
--- trunk/SKLine.m 2024-02-04 15:17:04 UTC (rev 14041)
+++ trunk/SKLine.m 2024-02-13 00:14:04 UTC (rev 14042)
@@ -61,6 +61,16 @@
return [NSString stringWithFormat:@"<%@: line=%ld, page=%@>", [self
class], (long)index, page];
}
+- (NSUInteger)hash {
+ return [page hash] + 31 * index;
+}
+
+- (BOOL)isEqual:(id)other {
+ if ([self isKindOfClass:[self class]] == NO)
+ return NO;
+ return index == [(SKLine *)other index] && page == [(SKLine *)other page];
+}
+
- (NSRect)bounds {
return [[page lineRects] rectAtIndex:index];
}
Modified: trunk/SKNotePrefs.m
===================================================================
--- trunk/SKNotePrefs.m 2024-02-04 15:17:04 UTC (rev 14041)
+++ trunk/SKNotePrefs.m 2024-02-13 00:14:04 UTC (rev 14042)
@@ -96,6 +96,16 @@
return self;
}
+- (NSUInteger)hash {
+ return [type hash];
+}
+
+- (BOOL)isEqual:(id)other {
+ if ([other isKindOfClass:[self class]] == NO)
+ return NO;
+ return [[(SKNotePrefs *)other type] isEqualToString:type];
+}
+
- (NSScriptObjectSpecifier *)objectSpecifier {
NSScriptClassDescription *containerClassDescription =
[NSScriptClassDescription classDescriptionForClass:[NSApp class]];
return [[NSNameSpecifier alloc]
initWithContainerClassDescription:containerClassDescription
containerSpecifier:nil key:@"notePreferences" name:[self type]];
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit