Revision: 14276
http://sourceforge.net/p/skim-app/code/14276
Author: hofman
Date: 2024-05-30 09:36:44 +0000 (Thu, 30 May 2024)
Log Message:
-----------
Move stamp wrapper class to separate file
Modified Paths:
--------------
trunk/SKMainWindowController.m
trunk/Skim.xcodeproj/project.pbxproj
Added Paths:
-----------
trunk/SKThumbnailStamp.h
trunk/SKThumbnailStamp.m
Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m 2024-05-30 09:31:31 UTC (rev 14275)
+++ trunk/SKMainWindowController.m 2024-05-30 09:36:44 UTC (rev 14276)
@@ -107,6 +107,7 @@
#import "NSColor_SKExtensions.h"
#import "NSObject_SKExtensions.h"
#import "SKChainedUndoManager.h"
+#import "SKThumbnailStamp.h"
#define MULTIPLICATION_SIGN_CHARACTER (unichar)0x00d7
@@ -181,18 +182,8 @@
#define SKDisableSearchBarBlurringKey @"SKDisableSearchBarBlurring"
-#pragma mark -
+#pragma mark -
-@interface SKPageImage : NSObject {
- NSImage *image;
- NSRect rect;
- CGFloat fraction;
-}
-- (instancetype)initWithImage:(NSImage *)anImage rect:(NSRect)aRect
fraction:(CGFloat)aFraction;
-- (void)drawForPage:(PDFPage *)pdfPage withBox:(PDFDisplayBox)box
active:(BOOL)active;
-@end
-
-
@interface SKMainWindowController (SKPrivate)
- (void)cleanup;
@@ -2885,9 +2876,9 @@
else
type = @"PDF";
- [stamps addObject:[[SKPageImage alloc] initWithImage:[NSImage
stampForType:type] rect:rect fraction:1.0]];
+ [stamps addObject:[[SKThumbnailStamp alloc] initWithImage:[NSImage
stampForType:type] rect:rect fraction:1.0]];
if ([[pdfView document] isLocked])
- [stamps addObject:[[SKPageImage alloc] initWithImage:[[NSWorkspace
sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode(kLockedBadgeIcon)]
rect:rect fraction:0.5]];
+ [stamps addObject:[[SKThumbnailStamp alloc]
initWithImage:[[NSWorkspace sharedWorkspace]
iconForFileType:NSFileTypeForHFSTypeCode(kLockedBadgeIcon)] rect:rect
fraction:0.5]];
NSImage *pageImage = [emptyPage thumbnailWithSize:thumbnailCacheSize
forBox:box highlights:stamps];
@@ -3148,24 +3139,3 @@
}
@end
-
-
-@implementation SKPageImage
-
-- (instancetype)initWithImage:(NSImage *)anImage rect:(NSRect)aRect
fraction:(CGFloat)aFraction {
- self = [super init];
- if (self) {
- image = anImage;
- rect = aRect;
- fraction = aFraction;
- }
- return self;
-}
-
-- (void)drawForPage:(PDFPage *)pdfPage withBox:(PDFDisplayBox)box
active:(BOOL)active {
- // ignore transformContext:forBox:, as we only use it when this does
nothing
- [image drawInRect:rect fromRect:NSZeroRect
operation:NSCompositingOperationSourceOver fraction:fraction];
-}
-
-@end
-
Added: trunk/SKThumbnailStamp.h
===================================================================
--- trunk/SKThumbnailStamp.h (rev 0)
+++ trunk/SKThumbnailStamp.h 2024-05-30 09:36:44 UTC (rev 14276)
@@ -0,0 +1,56 @@
+//
+// SKThumbnailStamp.h
+// Skim
+//
+// Created by Christiaan Hofman on 30/05/2024.
+/*
+ This software is Copyright (c) 2024
+ 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>
+#import <Quartz/Quartz.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface SKThumbnailStamp : NSObject {
+ NSImage *image;
+ NSRect rect;
+ CGFloat fraction;
+}
+
+- (instancetype)initWithImage:(NSImage *)anImage rect:(NSRect)aRect
fraction:(CGFloat)aFraction;
+
+- (void)drawForPage:(PDFPage *)pdfPage withBox:(PDFDisplayBox)box
active:(BOOL)active;
+
+@end
+
+NS_ASSUME_NONNULL_END
Added: trunk/SKThumbnailStamp.m
===================================================================
--- trunk/SKThumbnailStamp.m (rev 0)
+++ trunk/SKThumbnailStamp.m 2024-05-30 09:36:44 UTC (rev 14276)
@@ -0,0 +1,59 @@
+//
+// SKThumbnailStamp.m
+// Skim
+//
+// Created by Christiaan Hofman on 30/05/2024.
+/*
+ This software is Copyright (c) 2024
+ 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 "SKThumbnailStamp.h"
+
+@implementation SKThumbnailStamp
+
+- (instancetype)initWithImage:(NSImage *)anImage rect:(NSRect)aRect
fraction:(CGFloat)aFraction {
+ self = [super init];
+ if (self) {
+ image = anImage;
+ rect = aRect;
+ fraction = aFraction;
+ }
+ return self;
+}
+
+- (void)drawForPage:(PDFPage *)pdfPage withBox:(PDFDisplayBox)box
active:(BOOL)active {
+ // ignore transformContext:forBox:, as we only use it when this does
nothing
+ [image drawInRect:rect fromRect:NSZeroRect
operation:NSCompositingOperationSourceOver fraction:fraction];
+}
+
+@end
+
Modified: trunk/Skim.xcodeproj/project.pbxproj
===================================================================
--- trunk/Skim.xcodeproj/project.pbxproj 2024-05-30 09:31:31 UTC (rev
14275)
+++ trunk/Skim.xcodeproj/project.pbxproj 2024-05-30 09:36:44 UTC (rev
14276)
@@ -278,6 +278,7 @@
CEECD61C12E9E30B00B9E35E /* NSError_SKExtensions.m in Sources
*/ = {isa = PBXBuildFile; fileRef = CEECD61B12E9E30B00B9E35E /*
NSError_SKExtensions.m */; };
CEED148C2709EE4D00A8C4AA /* SKBasePDFView.m in Sources */ =
{isa = PBXBuildFile; fileRef = CEED148B2709EE4D00A8C4AA /* SKBasePDFView.m */;
};
CEEE7C520E7D3F2000B7B208 /* PDFAnnotationInk_SKExtensions.m in
Sources */ = {isa = PBXBuildFile; fileRef = CEEE7C510E7D3F2000B7B208 /*
PDFAnnotationInk_SKExtensions.m */; };
+ CEF02AEA2C087F3A001C150A /* SKThumbnailStamp.m in Sources */ =
{isa = PBXBuildFile; fileRef = CEF02AE92C087F3A001C150A /* SKThumbnailStamp.m
*/; };
CEF60D6A114C0DA60074ACC4 /* TransitionSheet.strings in
Resources */ = {isa = PBXBuildFile; fileRef = CEF60D40114C0DA60074ACC4 /*
TransitionSheet.strings */; };
CEF60D6C114C0DA60074ACC4 /* ScaleSheet.strings in Resources */
= {isa = PBXBuildFile; fileRef = CEF60D44114C0DA60074ACC4 /* ScaleSheet.strings
*/; };
CEF60D6D114C0DA60074ACC4 /* ReleaseNotes.strings in Resources
*/ = {isa = PBXBuildFile; fileRef = CEF60D46114C0DA60074ACC4 /*
ReleaseNotes.strings */; };
@@ -1235,6 +1236,8 @@
CEED148B2709EE4D00A8C4AA /* SKBasePDFView.m */ = {isa =
PBXFileReference; lastKnownFileType = sourcecode.c.objc; path =
SKBasePDFView.m; sourceTree = "<group>"; };
CEEE7C500E7D3F2000B7B208 /* PDFAnnotationInk_SKExtensions.h */
= {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType =
sourcecode.c.h; path = PDFAnnotationInk_SKExtensions.h; sourceTree = "<group>";
};
CEEE7C510E7D3F2000B7B208 /* PDFAnnotationInk_SKExtensions.m */
= {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType =
sourcecode.c.objc; path = PDFAnnotationInk_SKExtensions.m; sourceTree =
"<group>"; };
+ CEF02AE82C087F3A001C150A /* SKThumbnailStamp.h */ = {isa =
PBXFileReference; lastKnownFileType = sourcecode.c.h; path =
SKThumbnailStamp.h; sourceTree = "<group>"; };
+ CEF02AE92C087F3A001C150A /* SKThumbnailStamp.m */ = {isa =
PBXFileReference; lastKnownFileType = sourcecode.c.objc; path =
SKThumbnailStamp.m; sourceTree = "<group>"; };
CEF1D626117EFB760069E249 /* applehelp.init */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path =
applehelp.init; sourceTree = "<group>"; };
CEF60D41114C0DA60074ACC4 /* en */ = {isa = PBXFileReference;
fileEncoding = 10; lastKnownFileType = text.plist.strings; name = en; path =
en.lproj/TransitionSheet.strings; sourceTree = "<group>"; };
CEF60D45114C0DA60074ACC4 /* en */ = {isa = PBXFileReference;
fileEncoding = 10; lastKnownFileType = text.plist.strings; name = en; path =
en.lproj/ScaleSheet.strings; sourceTree = "<group>"; };
@@ -1970,6 +1973,8 @@
CE8978CC0CBFC70B00EA2D98 /* SKTemplateTag.m */,
CEB402C113EDAD6100851D1B /* SKTemporaryData.h
*/,
CEB402C213EDAD6100851D1B /* SKTemporaryData.m
*/,
+ CEF02AE82C087F3A001C150A /* SKThumbnailStamp.h
*/,
+ CEF02AE92C087F3A001C150A /* SKThumbnailStamp.m
*/,
CE9B80481030642400EA8774 /* SKTransitionInfo.h
*/,
CE9B80491030642400EA8774 /* SKTransitionInfo.m
*/,
CEF7117C0B90B58E003A2771 /* SKVersionNumber.h
*/,
@@ -2972,6 +2977,7 @@
CEECD61C12E9E30B00B9E35E /*
NSError_SKExtensions.m in Sources */,
CEC1B0432BBF00D8006786B0 /* SKSyncTeXParser.m
in Sources */,
CE12A73E134F215F003AED67 /* SKSelectCommand.m
in Sources */,
+ CEF02AEA2C087F3A001C150A /* SKThumbnailStamp.m
in Sources */,
CE030C6113C07A57007A47E9 /*
PDFView_SKExtensions.m in Sources */,
CEB402C313EDAD6100851D1B /* SKTemporaryData.m
in Sources */,
CE1248C513FEDCF200FFAE20 /* SKTemplateManager.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