Revision: 4118
http://skim-app.svn.sourceforge.net/skim-app/?rev=4118&view=rev
Author: hofman
Date: 2008-07-02 10:53:53 -0700 (Wed, 02 Jul 2008)
Log Message:
-----------
move boohmark tableview to separate object files
Modified Paths:
--------------
trunk/SKBookmarkController.h
trunk/SKBookmarkController.m
trunk/Skim.xcodeproj/project.pbxproj
Added Paths:
-----------
trunk/SKBookmarkOutlineView.h
trunk/SKBookmarkOutlineView.m
Modified: trunk/SKBookmarkController.h
===================================================================
--- trunk/SKBookmarkController.h 2008-07-02 17:30:33 UTC (rev 4117)
+++ trunk/SKBookmarkController.h 2008-07-02 17:53:53 UTC (rev 4118)
@@ -37,7 +37,6 @@
*/
#import <Cocoa/Cocoa.h>
-#import "SKOutlineView.h"
@class SKBookmark, SKBookmarkOutlineView, SKStatusBar;
@@ -78,12 +77,3 @@
- (void)setupToolbar;
@end
-
-
[EMAIL PROTECTED] SKBookmarkOutlineView : SKOutlineView
[EMAIL PROTECTED]
-
-
[EMAIL PROTECTED] NSObject (SKBookmarkOutlineViewDelegate)
-- (BOOL)outlineView:(NSOutlineView *)anOutlineView
drawSeparatorRowForItem:(id)item;
[EMAIL PROTECTED]
Modified: trunk/SKBookmarkController.m
===================================================================
--- trunk/SKBookmarkController.m 2008-07-02 17:30:33 UTC (rev 4117)
+++ trunk/SKBookmarkController.m 2008-07-02 17:53:53 UTC (rev 4118)
@@ -42,6 +42,7 @@
#import "SKPDFDocument.h"
#import "SKMainWindowController.h"
#import "Files_SKExtensions.h"
+#import "SKBookmarkOutlineView.h"
#import "SKOutlineView.h"
#import "SKTypeSelectHelper.h"
#import "SKStatusBar.h"
@@ -50,7 +51,6 @@
#import "NSImage_SKExtensions.h"
#import "SKStringConstants.h"
#import "SKUtilities.h"
-#import "NSUserDefaultsController_SKExtensions.h"
static NSString *SKBookmarkRowsPboardType = @"SKBookmarkRowsPboardType";
@@ -71,7 +71,6 @@
static NSString *SKRecentDocumentAliasDataKey = @"_BDAlias";
static NSString *SKRecentDocumentSnapshotsKey = @"snapshots";
-static void *SKBookmarkDefaultsObservationContext = (void
*)@"SKBookmarkDefaultsObservationContext";
@implementation SKBookmarkController
@@ -707,49 +706,3 @@
}
@end
-
-#pragma mark -
-
[EMAIL PROTECTED] SKBookmarkOutlineView
-
-#define SEPARATOR_LEFT_INDENT 20.0
-#define SEPARATOR_RIGHT_INDENT 2.0
-
-- (void)dealloc {
- [[NSUserDefaultsController sharedUserDefaultsController]
removeObserver:self forKey:SKTableFontSizeKey];
- [super dealloc];
-}
-
-- (void)drawRow:(int)rowIndex clipRect:(NSRect)clipRect {
- if ([[self delegate]
respondsToSelector:@selector(outlineView:drawSeparatorRowForItem:)] &&
- [[self delegate] outlineView:self drawSeparatorRowForItem:[self
itemAtRow:rowIndex]]) {
- float indent = [self levelForItem:[self itemAtRow:rowIndex]] * [self
indentationPerLevel];
- NSRect rect = [self rectOfRow:rowIndex];
- [[NSColor gridColor] setStroke];
- [NSBezierPath setDefaultLineWidth:1.0];
- [NSBezierPath strokeLineFromPoint:NSMakePoint(NSMinX(rect) + indent +
SEPARATOR_LEFT_INDENT, floorf(NSMidY(rect)) + 0.5)
toPoint:NSMakePoint(NSMaxX(rect) - SEPARATOR_RIGHT_INDENT, floorf(NSMidY(rect))
+ 0.5)];
- } else {
- [super drawRow:rowIndex clipRect:clipRect];
- }
-}
-
-- (void)awakeFromNib {
- NSNumber *fontSize = [[NSUserDefaults standardUserDefaults]
objectForKey:SKTableFontSizeKey];
- if (fontSize)
- [self setFont:[NSFont systemFontOfSize:[fontSize floatValue]]];
- [[NSUserDefaultsController sharedUserDefaultsController] addObserver:self
forKey:SKTableFontSizeKey context:SKBookmarkDefaultsObservationContext];
-}
-
-- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object
change:(NSDictionary *)change context:(void *)context {
- if (context == SKBookmarkDefaultsObservationContext) {
- NSString *key = [keyPath substringFromIndex:7];
- if ([key isEqualToString:SKTableFontSizeKey]) {
- NSFont *font = [NSFont systemFontOfSize:[[NSUserDefaults
standardUserDefaults] floatForKey:SKTableFontSizeKey]];
- [self setFont:font];
- }
- } else {
- [super observeValueForKeyPath:keyPath ofObject:object change:change
context:context];
- }
-}
-
[EMAIL PROTECTED]
Added: trunk/SKBookmarkOutlineView.h
===================================================================
--- trunk/SKBookmarkOutlineView.h (rev 0)
+++ trunk/SKBookmarkOutlineView.h 2008-07-02 17:53:53 UTC (rev 4118)
@@ -0,0 +1,49 @@
+//
+// SKBookmarkOutlineView.h
+// Skim
+//
+// Created by Christiaan Hofman on 7/2/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>
+#import "SKOutlineView.h"
+
+
[EMAIL PROTECTED] SKBookmarkOutlineView : SKOutlineView
[EMAIL PROTECTED]
+
+
[EMAIL PROTECTED] NSObject (SKBookmarkOutlineViewDelegate)
+- (BOOL)outlineView:(NSOutlineView *)anOutlineView
drawSeparatorRowForItem:(id)item;
[EMAIL PROTECTED]
Added: trunk/SKBookmarkOutlineView.m
===================================================================
--- trunk/SKBookmarkOutlineView.m (rev 0)
+++ trunk/SKBookmarkOutlineView.m 2008-07-02 17:53:53 UTC (rev 4118)
@@ -0,0 +1,88 @@
+//
+// SKBookmarkOutlineView.m
+// Skim
+//
+// Created by Christiaan Hofman on 7/2/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 "SKBookmarkOutlineView.h"
+#import "NSUserDefaultsController_SKExtensions.h"
+#import "SKStringConstants.h"
+
+static void *SKBookmarkOutlineViewDefaultsObservationContext = (void
*)@"SKBookmarkOutlineViewDefaultsObservationContext";
+
+
[EMAIL PROTECTED] SKBookmarkOutlineView
+
+#define SEPARATOR_LEFT_INDENT 20.0
+#define SEPARATOR_RIGHT_INDENT 2.0
+
+- (void)dealloc {
+ [[NSUserDefaultsController sharedUserDefaultsController]
removeObserver:self forKey:SKTableFontSizeKey];
+ [super dealloc];
+}
+
+- (void)drawRow:(int)rowIndex clipRect:(NSRect)clipRect {
+ if ([[self delegate]
respondsToSelector:@selector(outlineView:drawSeparatorRowForItem:)] &&
+ [[self delegate] outlineView:self drawSeparatorRowForItem:[self
itemAtRow:rowIndex]]) {
+ float indent = [self levelForItem:[self itemAtRow:rowIndex]] * [self
indentationPerLevel];
+ NSRect rect = [self rectOfRow:rowIndex];
+ [[NSColor gridColor] setStroke];
+ [NSBezierPath setDefaultLineWidth:1.0];
+ [NSBezierPath strokeLineFromPoint:NSMakePoint(NSMinX(rect) + indent +
SEPARATOR_LEFT_INDENT, floorf(NSMidY(rect)) + 0.5)
toPoint:NSMakePoint(NSMaxX(rect) - SEPARATOR_RIGHT_INDENT, floorf(NSMidY(rect))
+ 0.5)];
+ } else {
+ [super drawRow:rowIndex clipRect:clipRect];
+ }
+}
+
+- (void)awakeFromNib {
+ NSNumber *fontSize = [[NSUserDefaults standardUserDefaults]
objectForKey:SKTableFontSizeKey];
+ if (fontSize)
+ [self setFont:[NSFont systemFontOfSize:[fontSize floatValue]]];
+ [[NSUserDefaultsController sharedUserDefaultsController] addObserver:self
forKey:SKTableFontSizeKey
context:SKBookmarkOutlineViewDefaultsObservationContext];
+}
+
+- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object
change:(NSDictionary *)change context:(void *)context {
+ if (context == SKBookmarkOutlineViewDefaultsObservationContext) {
+ NSString *key = [keyPath substringFromIndex:7];
+ if ([key isEqualToString:SKTableFontSizeKey]) {
+ NSFont *font = [NSFont systemFontOfSize:[[NSUserDefaults
standardUserDefaults] floatForKey:SKTableFontSizeKey]];
+ [self setFont:font];
+ }
+ } else {
+ [super observeValueForKeyPath:keyPath ofObject:object change:change
context:context];
+ }
+}
+
[EMAIL PROTECTED]
Modified: trunk/Skim.xcodeproj/project.pbxproj
===================================================================
--- trunk/Skim.xcodeproj/project.pbxproj 2008-07-02 17:30:33 UTC (rev
4117)
+++ trunk/Skim.xcodeproj/project.pbxproj 2008-07-02 17:53:53 UTC (rev
4118)
@@ -129,6 +129,7 @@
CE5FA1680C909886008BE480 /* SKFDFParser.m in Sources */ = {isa
= PBXBuildFile; fileRef = CE5FA1660C909886008BE480 /* SKFDFParser.m */; };
CE64E81A0D92BB97000AD050 /* ToolbarFontsBlack.tiff in Resources
*/ = {isa = PBXBuildFile; fileRef = CE64E8190D92BB97000AD050 /*
ToolbarFontsBlack.tiff */; };
CE64E8A30D92E670000AD050 /* SKCFCallBacks.m in Sources */ =
{isa = PBXBuildFile; fileRef = CE64E8A20D92E670000AD050 /* SKCFCallBacks.m */;
};
+ CE665A140E1BF43700D0704D /* SKBookmarkOutlineView.m in Sources
*/ = {isa = PBXBuildFile; fileRef = CE665A130E1BF43700D0704D /*
SKBookmarkOutlineView.m */; };
CE67BB260BC44AC9007B6929 /* ZoomValues.strings in Resources */
= {isa = PBXBuildFile; fileRef = CE67BB240BC44AC9007B6929 /* ZoomValues.strings
*/; };
CE6A5B9E0D663491003B7CC3 /* ToolbarCustomize.tiff in Resources
*/ = {isa = PBXBuildFile; fileRef = CE6A5B9D0D663491003B7CC3 /*
ToolbarCustomize.tiff */; };
CE6A5BB20D663771003B7CC3 /* ToolbarPrint.tiff in Resources */ =
{isa = PBXBuildFile; fileRef = CE6A5BB10D663771003B7CC3 /* ToolbarPrint.tiff
*/; };
@@ -628,6 +629,8 @@
CE64E8190D92BB97000AD050 /* ToolbarFontsBlack.tiff */ = {isa =
PBXFileReference; lastKnownFileType = image.tiff; name =
ToolbarFontsBlack.tiff; path = Images/ToolbarFontsBlack.tiff; sourceTree =
"<group>"; };
CE64E8A10D92E670000AD050 /* SKCFCallBacks.h */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path =
SKCFCallBacks.h; sourceTree = "<group>"; };
CE64E8A20D92E670000AD050 /* SKCFCallBacks.m */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path
= SKCFCallBacks.m; sourceTree = "<group>"; };
+ CE665A120E1BF43700D0704D /* SKBookmarkOutlineView.h */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path =
SKBookmarkOutlineView.h; sourceTree = "<group>"; };
+ CE665A130E1BF43700D0704D /* SKBookmarkOutlineView.m */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path
= SKBookmarkOutlineView.m; sourceTree = "<group>"; };
CE67BB250BC44AC9007B6929 /* English */ = {isa =
PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings;
name = English; path = English.lproj/ZoomValues.strings; sourceTree =
"<group>"; };
CE67BB290BC44AD5007B6929 /* Dutch */ = {isa = PBXFileReference;
fileEncoding = 10; lastKnownFileType = text.plist.strings; name = Dutch; path =
Dutch.lproj/ZoomValues.strings; sourceTree = "<group>"; };
CE68C62F0CEF891B00B082F1 /* German */ = {isa =
PBXFileReference; lastKnownFileType = wrapper.nib; name = German; path =
German.lproj/InfoWindow.nib; sourceTree = "<group>"; };
@@ -1253,6 +1256,8 @@
children = (
CE199DFB0D957A16009B2055 /*
SKAnnotationTypeImageCell.h */,
CE199DFC0D957A16009B2055 /*
SKAnnotationTypeImageCell.m */,
+ CE665A120E1BF43700D0704D /*
SKBookmarkOutlineView.h */,
+ CE665A130E1BF43700D0704D /*
SKBookmarkOutlineView.m */,
CECDD2960C5B68580026AAEC /*
SKCenteredTextFieldCell.h */,
CECDD2970C5B68580026AAEC /*
SKCenteredTextFieldCell.m */,
CE4D97FA0C3C2BFF002C20CB /* SKColorSwatch.h */,
@@ -2073,6 +2078,7 @@
CE3400AC0E0034DF00A7FFE6 /*
NSMenu_SKExtensions.m in Sources */,
CE3401E00E01378A00A7FFE6 /*
NSAttributedString_SKExtensions.m in Sources */,
CE3401E60E01388700A7FFE6 /*
NSNumber_SKExtensions.m in Sources */,
+ CE665A140E1BF43700D0704D /*
SKBookmarkOutlineView.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit