Revision: 12502 http://sourceforge.net/p/skim-app/code/12502 Author: hofman Date: 2021-11-01 16:00:15 +0000 (Mon, 01 Nov 2021) Log Message: ----------- No need for snapshot page cell subclass
Modified Paths: -------------- trunk/Skim.xcodeproj/project.pbxproj Removed Paths: ------------- trunk/SKSnapshotPageCell.h trunk/SKSnapshotPageCell.m Deleted: trunk/SKSnapshotPageCell.h =================================================================== --- trunk/SKSnapshotPageCell.h 2021-11-01 15:59:28 UTC (rev 12501) +++ trunk/SKSnapshotPageCell.h 2021-11-01 16:00:15 UTC (rev 12502) @@ -1,46 +0,0 @@ -// -// SKSnapshotPageCell.h -// Skim -// -// Created by Christiaan Hofman on 4/10/08. -/* - This software is Copyright (c) 2008-2021 - 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> - -extern NSString *SKSnapshotPageCellLabelKey; -extern NSString *SKSnapshotPageCellHasWindowKey; - - -@interface SKSnapshotPageCell : NSTextFieldCell -@end Deleted: trunk/SKSnapshotPageCell.m =================================================================== --- trunk/SKSnapshotPageCell.m 2021-11-01 15:59:28 UTC (rev 12501) +++ trunk/SKSnapshotPageCell.m 2021-11-01 16:00:15 UTC (rev 12502) @@ -1,138 +0,0 @@ -// -// SKSnapshotPageCell.m -// Skim -// -// Created by Christiaan Hofman on 4/10/08. -/* - This software is Copyright (c) 2008-2021 - 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 "SKSnapshotPageCell.h" -#import "NSGeometry_SKExtensions.h" -#import "NSShadow_SKExtensions.h" -#import "NSImage_SKExtensions.h" - -NSString *SKSnapshotPageCellLabelKey = @"label"; -NSString *SKSnapshotPageCellHasWindowKey = @"hasWindow"; - -#define MIN_CELL_WIDTH 16.0 - -@interface SKSnapshotPageFormatter : NSFormatter -@end - -@implementation SKSnapshotPageCell - -static SKSnapshotPageFormatter *snapshotPageCellFormatter = nil; - -+ (void)initialize { - SKINITIALIZE; - snapshotPageCellFormatter = [[SKSnapshotPageFormatter alloc] init]; -} - -- (id)initTextCell:(NSString *)aString { - self = [super initTextCell:aString]; - if (self) { - [self setFormatter:snapshotPageCellFormatter]; - } - return self; -} - -- (id)initWithCoder:(NSCoder *)decoder { - self = [super initWithCoder:decoder]; - if (self) { - if ([self formatter] == nil) - [self setFormatter:snapshotPageCellFormatter]; - } - return self; -} - -- (NSSize)cellSizeForBounds:(NSRect)aRect { - NSSize size = [super cellSizeForBounds:aRect]; - size.width = fmin(fmax(size.width, MIN_CELL_WIDTH), NSWidth(aRect)); - return size; -} - -+ (NSImage *)windowImage { - static NSImage *windowImage = nil; - if (windowImage == nil) { - windowImage = [[NSImage imageWithSize:NSMakeSize(12.0, 12.0) flipped:NO drawingHandler:^(NSRect dstRect){ - NSBezierPath *path = [NSBezierPath bezierPath]; - [path moveToPoint:NSMakePoint(1.0, 2.0)]; - [path appendBezierPathWithArcWithCenter:NSMakePoint(3.0, 10.0) radius:2.0 startAngle:180.0 endAngle:90.0 clockwise:YES]; - [path appendBezierPathWithArcWithCenter:NSMakePoint(9.0, 10.0) radius:2.0 startAngle:90.0 endAngle:0.0 clockwise:YES]; - [path lineToPoint:NSMakePoint(11.0, 2.0)]; - [path closePath]; - [path appendBezierPath:[NSBezierPath bezierPathWithRect:NSMakeRect(2.0, 3.0, 8.0, 7.0)]]; - [path setWindingRule:NSEvenOddWindingRule]; - [[NSColor blackColor] setFill]; - [path fill]; - return YES; - }] retain]; - [windowImage setTemplate:YES]; - } - return windowImage; -} - -- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView { - NSRect textRect, imageRect; - NSRectEdge topEdge = [controlView isFlipped] ? NSMinYEdge : NSMaxYEdge; - NSDivideRect(cellFrame, &textRect, &imageRect, [super cellSizeForBounds:cellFrame].height + 1.0, topEdge); - - [super drawInteriorWithFrame:textRect inView:controlView]; - - id obj = [self objectValue]; - BOOL hasWindow = [obj respondsToSelector:@selector(objectForKey:)] ? [[obj objectForKey:SKSnapshotPageCellHasWindowKey] boolValue] : NO; - if (hasWindow) { - NSImageCell *imageCell = [[NSImageCell alloc] initImageCell:[[self class] windowImage]]; - [imageCell setBackgroundStyle:[self backgroundStyle]]; - imageRect = NSOffsetRect(SKSliceRect(SKSliceRect(imageRect, 12.0, topEdge), 12.0, NSMinXEdge), 3.0, 0.0); - [imageCell drawInteriorWithFrame:imageRect inView:controlView]; - [imageCell release]; - } -} - -@end - -#pragma mark - - -@implementation SKSnapshotPageFormatter - -- (NSString *)stringForObjectValue:(id)obj { - return [obj respondsToSelector:@selector(objectForKey:)] ? [obj objectForKey:SKSnapshotPageCellLabelKey] : nil; -} - -- (BOOL)getObjectValue:(id *)obj forString:(NSString *)string errorDescription:(NSString **)error { - *obj = [NSDictionary dictionaryWithObjectsAndKeys:[[string copy] autorelease], SKSnapshotPageCellLabelKey, nil]; - return YES; -} - -@end Modified: trunk/Skim.xcodeproj/project.pbxproj =================================================================== --- trunk/Skim.xcodeproj/project.pbxproj 2021-11-01 15:59:28 UTC (rev 12501) +++ trunk/Skim.xcodeproj/project.pbxproj 2021-11-01 16:00:15 UTC (rev 12502) @@ -43,7 +43,6 @@ CE05DAA12524C32200BB9288 /* SKColorList.m in Sources */ = {isa = PBXBuildFile; fileRef = CE05DAA02524C32200BB9288 /* SKColorList.m */; }; CE07158B0B8A3D6500733CC8 /* NoteDocument.icns in Resources */ = {isa = PBXBuildFile; fileRef = CE0715890B8A3D6300733CC8 /* NoteDocument.icns */; }; CE07158C0B8A3D6500733CC8 /* PDFDocument.icns in Resources */ = {isa = PBXBuildFile; fileRef = CE07158A0B8A3D6300733CC8 /* PDFDocument.icns */; }; - CE0859D20DAE912500760AFC /* SKSnapshotPageCell.m in Sources */ = {isa = PBXBuildFile; fileRef = CE0859D10DAE912500760AFC /* SKSnapshotPageCell.m */; }; CE08EBF5218C5DCD00D2DFCC /* NSPasteboard_SKExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = CE08EBF4218C5DCD00D2DFCC /* NSPasteboard_SKExtensions.m */; }; CE099663112577A000EDB88F /* SKNotesPage.m in Sources */ = {isa = PBXBuildFile; fileRef = CE099662112577A000EDB88F /* SKNotesPage.m */; }; CE09FC3C0E3886C100BDF413 /* SKRuntime.m in Sources */ = {isa = PBXBuildFile; fileRef = CE09FC3B0E3886C100BDF413 /* SKRuntime.m */; }; @@ -596,8 +595,6 @@ CE05DAA02524C32200BB9288 /* SKColorList.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SKColorList.m; sourceTree = "<group>"; }; CE0715890B8A3D6300733CC8 /* NoteDocument.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = NoteDocument.icns; sourceTree = "<group>"; }; CE07158A0B8A3D6300733CC8 /* PDFDocument.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = PDFDocument.icns; sourceTree = "<group>"; }; - CE0859D00DAE912500760AFC /* SKSnapshotPageCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SKSnapshotPageCell.h; sourceTree = "<group>"; }; - CE0859D10DAE912500760AFC /* SKSnapshotPageCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SKSnapshotPageCell.m; sourceTree = "<group>"; }; CE08EBF3218C5DCD00D2DFCC /* NSPasteboard_SKExtensions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NSPasteboard_SKExtensions.h; sourceTree = "<group>"; }; CE08EBF4218C5DCD00D2DFCC /* NSPasteboard_SKExtensions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NSPasteboard_SKExtensions.m; sourceTree = "<group>"; }; CE099661112577A000EDB88F /* SKNotesPage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SKNotesPage.h; sourceTree = "<group>"; }; @@ -1818,8 +1815,6 @@ CED76F001A1825DE00D1ACA4 /* SKScrollView.m */, CEAE1C450CA1877F00849B0F /* SKSecondaryPDFView.h */, CEAE1C460CA1877F00849B0F /* SKSecondaryPDFView.m */, - CE0859D00DAE912500760AFC /* SKSnapshotPageCell.h */, - CE0859D10DAE912500760AFC /* SKSnapshotPageCell.m */, F92DB5AA0B36FE1F002A26E9 /* SKSnapshotPDFView.h */, F92DB5AB0B36FE1F002A26E9 /* SKSnapshotPDFView.m */, CE4EC88A0B7E6EDB0091F228 /* SKSplitView.h */, @@ -2731,7 +2726,6 @@ CEE54F6C0DA3FB060037169F /* SKMainToolbarController.m in Sources */, CEE54F700DA3FBE00037169F /* NSSegmentedControl_SKExtensions.m in Sources */, CEE54F900DA3FE9A0037169F /* NSValueTransformer_SKExtensions.m in Sources */, - CE0859D20DAE912500760AFC /* SKSnapshotPageCell.m in Sources */, CECF61FF0DB258D600587D96 /* SKFontWell.m in Sources */, CEE7E77824426C180034690E /* PDFAnnotationButtonWidget_SKExtensions.m in Sources */, CEE176E40DBD5B0C00E6C317 /* PDFDocumentView_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 Skim-app-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/skim-app-commit