Revision: 15671
http://sourceforge.net/p/skim-app/code/15671
Author: hofman
Date: 2025-08-17 16:33:02 +0000 (Sun, 17 Aug 2025)
Log Message:
-----------
Move annotation type image cell code to view class files
Modified Paths:
--------------
trunk/SKAnnotationTypeImageView.h
trunk/SKAnnotationTypeImageView.m
trunk/Skim.xcodeproj/project.pbxproj
Removed Paths:
-------------
trunk/SKAnnotationTypeImageCell.h
trunk/SKAnnotationTypeImageCell.m
Deleted: trunk/SKAnnotationTypeImageCell.h
===================================================================
--- trunk/SKAnnotationTypeImageCell.h 2025-08-17 16:27:05 UTC (rev 15670)
+++ trunk/SKAnnotationTypeImageCell.h 2025-08-17 16:33:02 UTC (rev 15671)
@@ -1,49 +0,0 @@
-//
-// SKAnnotationTypeImageCell.h
-// Skim
-//
-// Created by Christiaan Hofman on 3/22/08.
-/*
- This software is Copyright (c) 2008
- Christiaan Hofman. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
- - Neither the name of Christiaan Hofman nor the names of any
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import <Cocoa/Cocoa.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface SKAnnotationTypeImageCell : NSImageCell {
- BOOL hasOutline;
-}
-@property (nonatomic) BOOL hasOutline;
-@end
-
-NS_ASSUME_NONNULL_END
Deleted: trunk/SKAnnotationTypeImageCell.m
===================================================================
--- trunk/SKAnnotationTypeImageCell.m 2025-08-17 16:27:05 UTC (rev 15670)
+++ trunk/SKAnnotationTypeImageCell.m 2025-08-17 16:33:02 UTC (rev 15671)
@@ -1,94 +0,0 @@
-//
-// SKAnnotationTypeImageCell.m
-// Skim
-//
-// Created by Christiaan Hofman on 3/22/08.
-/*
- This software is Copyright (c) 2008
- Christiaan Hofman. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
- - Neither the name of Christiaan Hofman nor the names of any
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "SKAnnotationTypeImageCell.h"
-#import "NSImage_SKExtensions.h"
-#import "NSString_SKExtensions.h"
-#import <SkimNotes/SkimNotes.h>
-
-
-@implementation SKAnnotationTypeImageCell
-
-@synthesize hasOutline;
-
-static NSMutableDictionary *activeImages;
-
-+ (void)initialize {
- SKINITIALIZE;
- activeImages = [[NSMutableDictionary alloc] init];
-}
-
-- (instancetype)initWithCoder:(NSCoder *)decoder {
- self = [super initWithCoder:decoder];
- if (self) {
- hasOutline = [decoder decodeBoolForKey:@"hasOutline"];
- }
- return self;
-}
-
-- (void)encodeWithCoder:(NSCoder *)coder {
- [super encodeWithCoder:coder];
- [coder encodeBool:hasOutline forKey:@"hasOutline"];
-}
-
-- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView {
- [super drawWithFrame:cellFrame inView:controlView];
-
- if ([self hasOutline]) {
- NSSize size = cellFrame.size;
- size.height = fmin(size.width, size.height);
- NSString *sizeKey = NSStringFromSize(size);
- NSImage *image = [activeImages objectForKey:sizeKey];
- if (image == nil) {
- image = [NSImage imageWithSize:size drawingHandler:^(NSRect r){
- [[NSColor blackColor] setStroke];
- [NSBezierPath setDefaultLineWidth:1.0];
- [NSBezierPath strokeRect:NSMakeRect(0.5, 1.5, NSWidth(r) -
1.0, NSHeight(r) - 2.0)];
- return YES;
- }];
- [image setTemplate:YES];
- [activeImages setObject:image forKey:sizeKey];
- }
- id object = [self objectValue];
- [self setObjectValue:image];
- [super drawWithFrame:cellFrame inView:controlView];
- [self setObjectValue:object];
- }
-}
-
-@end
Modified: trunk/SKAnnotationTypeImageView.h
===================================================================
--- trunk/SKAnnotationTypeImageView.h 2025-08-17 16:27:05 UTC (rev 15670)
+++ trunk/SKAnnotationTypeImageView.h 2025-08-17 16:33:02 UTC (rev 15671)
@@ -2,9 +2,9 @@
// SKAnnotationTypeImageView.h
// Skim
//
-// Created by Christiaan Hofman on 23/04/2019.
+// Created by Christiaan Hofman on 3/22/08.
/*
- This software is Copyright (c) 2019
+ This software is Copyright (c) 2008
Christiaan Hofman. All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -46,4 +46,14 @@
@end
+#pragma mark -
+
+@interface SKAnnotationTypeImageCell : NSImageCell {
+ BOOL hasOutline;
+}
+
+@property (nonatomic) BOOL hasOutline;
+
+@end
+
NS_ASSUME_NONNULL_END
Modified: trunk/SKAnnotationTypeImageView.m
===================================================================
--- trunk/SKAnnotationTypeImageView.m 2025-08-17 16:27:05 UTC (rev 15670)
+++ trunk/SKAnnotationTypeImageView.m 2025-08-17 16:33:02 UTC (rev 15671)
@@ -2,9 +2,9 @@
// SKAnnotationTypeImageView.m
// Skim
//
-// Created by Christiaan Hofman on 23/04/2019.
+// Created by Christiaan Hofman on 3/22/08.
/*
- This software is Copyright (c) 2019
+ This software is Copyright (c) 2008
Christiaan Hofman. All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -37,7 +37,9 @@
*/
#import "SKAnnotationTypeImageView.h"
-#import "SKAnnotationTypeImageCell.h"
+#import "NSImage_SKExtensions.h"
+#import "NSString_SKExtensions.h"
+#import <SkimNotes/SkimNotes.h>
@implementation SKAnnotationTypeImageView
@@ -58,3 +60,56 @@
}
@end
+
+#pragma mark -
+
+@implementation SKAnnotationTypeImageCell
+
+@synthesize hasOutline;
+
+static NSMutableDictionary *activeImages;
+
++ (void)initialize {
+ SKINITIALIZE;
+ activeImages = [[NSMutableDictionary alloc] init];
+}
+
+- (instancetype)initWithCoder:(NSCoder *)decoder {
+ self = [super initWithCoder:decoder];
+ if (self) {
+ hasOutline = [decoder decodeBoolForKey:@"hasOutline"];
+ }
+ return self;
+}
+
+- (void)encodeWithCoder:(NSCoder *)coder {
+ [super encodeWithCoder:coder];
+ [coder encodeBool:hasOutline forKey:@"hasOutline"];
+}
+
+- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView {
+ [super drawWithFrame:cellFrame inView:controlView];
+
+ if ([self hasOutline]) {
+ NSSize size = cellFrame.size;
+ size.height = fmin(size.width, size.height);
+ NSString *sizeKey = NSStringFromSize(size);
+ NSImage *image = [activeImages objectForKey:sizeKey];
+ if (image == nil) {
+ image = [NSImage imageWithSize:size drawingHandler:^(NSRect r){
+ [[NSColor blackColor] setStroke];
+ [NSBezierPath setDefaultLineWidth:1.0];
+ [NSBezierPath strokeRect:NSMakeRect(0.5, 1.5, NSWidth(r) -
1.0, NSHeight(r) - 2.0)];
+ return YES;
+ }];
+ [image setTemplate:YES];
+ [activeImages setObject:image forKey:sizeKey];
+ }
+ id object = [self objectValue];
+ [self setObjectValue:image];
+ [super drawWithFrame:cellFrame inView:controlView];
+ [self setObjectValue:object];
+ }
+}
+
+@end
Modified: trunk/Skim.xcodeproj/project.pbxproj
===================================================================
--- trunk/Skim.xcodeproj/project.pbxproj 2025-08-17 16:27:05 UTC (rev
15670)
+++ trunk/Skim.xcodeproj/project.pbxproj 2025-08-17 16:33:02 UTC (rev
15671)
@@ -73,7 +73,6 @@
CE19446710627483007E8770 /* ProgressSheet.xib in Resources */ =
{isa = PBXBuildFile; fileRef = CE19446010627483007E8770 /* ProgressSheet.xib
*/; };
CE19446910627483007E8770 /* SnapshotWindow.xib in Resources */
= {isa = PBXBuildFile; fileRef = CE19446210627483007E8770 /* SnapshotWindow.xib
*/; };
CE19641516E811D40027E2CF /* SKSnapshotWindow.m in Sources */ =
{isa = PBXBuildFile; fileRef = CE19641416E811D40027E2CF /* SKSnapshotWindow.m
*/; };
- CE199DFD0D957A16009B2055 /* SKAnnotationTypeImageCell.m in
Sources */ = {isa = PBXBuildFile; fileRef = CE199DFC0D957A16009B2055 /*
SKAnnotationTypeImageCell.m */; };
CE19E7A9275B7BC1007EBD8B /* SKDisplayPrefs.m in Sources */ =
{isa = PBXBuildFile; fileRef = CE19E7A8275B7BC1007EBD8B /* SKDisplayPrefs.m */;
};
CE1ADEBF0C4C341100071840 /* SKTransitionController.m in Sources
*/ = {isa = PBXBuildFile; fileRef = CE1ADEBE0C4C341100071840 /*
SKTransitionController.m */; };
CE1C77B6123FB41E00C73F1A /* SKNoteTextView.m in Sources */ =
{isa = PBXBuildFile; fileRef = CE1C77B5123FB41E00C73F1A /* SKNoteTextView.m */;
};
@@ -828,8 +827,6 @@
CE19446210627483007E8770 /* SnapshotWindow.xib */ = {isa =
PBXFileReference; lastKnownFileType = file.xib; path = SnapshotWindow.xib;
sourceTree = "<group>"; };
CE19641316E811D40027E2CF /* SKSnapshotWindow.h */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path =
SKSnapshotWindow.h; sourceTree = "<group>"; };
CE19641416E811D40027E2CF /* SKSnapshotWindow.m */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path
= SKSnapshotWindow.m; sourceTree = "<group>"; };
- CE199DFB0D957A16009B2055 /* SKAnnotationTypeImageCell.h */ =
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h;
path = SKAnnotationTypeImageCell.h; sourceTree = "<group>"; };
- CE199DFC0D957A16009B2055 /* SKAnnotationTypeImageCell.m */ =
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType =
sourcecode.c.objc; path = SKAnnotationTypeImageCell.m; sourceTree = "<group>";
};
CE19E7A7275B7BC1007EBD8B /* SKDisplayPrefs.h */ = {isa =
PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SKDisplayPrefs.h;
sourceTree = "<group>"; };
CE19E7A8275B7BC1007EBD8B /* SKDisplayPrefs.m */ = {isa =
PBXFileReference; lastKnownFileType = sourcecode.c.objc; path =
SKDisplayPrefs.m; sourceTree = "<group>"; };
CE1ADB170C4BC6DE00071840 /* OpenGL.framework */ = {isa =
PBXFileReference; lastKnownFileType = wrapper.framework; name =
OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework;
sourceTree = "<absolute>"; };
@@ -1860,8 +1857,6 @@
CE2DE4D10B85D92F00D0DA12 /* Views and Cells */ = {
isa = PBXGroup;
children = (
- CE199DFB0D957A16009B2055 /*
SKAnnotationTypeImageCell.h */,
- CE199DFC0D957A16009B2055 /*
SKAnnotationTypeImageCell.m */,
CE325590226F73810032390F /*
SKAnnotationTypeImageView.h */,
CE325591226F73810032390F /*
SKAnnotationTypeImageView.m */,
CEED148A2709EE4D00A8C4AA /* SKBasePDFView.h */,
@@ -2911,7 +2906,6 @@
CE2E9A592C14D2F300044B01 /*
SKSnapshotConfiguration.m in Sources */,
CEA8FCD60D89C34A00E8A6F4 /*
SKAnimatedBorderlessWindow.m in Sources */,
CEB4EC502D87409100CA01A1 /*
SKNoteToolbarController.m in Sources */,
- CE199DFD0D957A16009B2055 /*
SKAnnotationTypeImageCell.m in Sources */,
CEE54D880DA2E37B0037169F /*
PDFAnnotation_SKExtensions.m in Sources */,
CEE54D930DA2E5E10037169F /*
PDFAnnotationCircle_SKExtensions.m in Sources */,
CEE54D980DA2E6FC0037169F /*
PDFAnnotationSquare_SKExtensions.m in Sources */,
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