Revision: 4819
http://skim-app.svn.sourceforge.net/skim-app/?rev=4819&view=rev
Author: hofman
Date: 2008-10-19 15:31:44 +0000 (Sun, 19 Oct 2008)
Log Message:
-----------
Custom capsule style segmented control for Tiger
Modified Paths:
--------------
trunk/MainWindow.nib/classes.nib
trunk/MainWindow.nib/info.nib
trunk/MainWindow.nib/keyedobjects.nib
trunk/NSImage_SKExtensions.m
trunk/SKMainWindowController_Toolbar.m
trunk/Skim.xcodeproj/project.pbxproj
Added Paths:
-----------
trunk/Images/Segment_LeftCap.tiff
trunk/Images/Segment_LeftCapPress.tiff
trunk/Images/Segment_Middle.tiff
trunk/Images/Segment_MiddlePress.tiff
trunk/Images/Segment_RightCap.tiff
trunk/Images/Segment_RightCapPress.tiff
trunk/Images/Segment_Separator.tiff
trunk/Images/Segment_SeparatorPress.tiff
trunk/SKSegmentedControl.h
trunk/SKSegmentedControl.m
Removed Paths:
-------------
trunk/Images/ToolbarFontsBlack.tiff
Added: trunk/Images/Segment_LeftCap.tiff
===================================================================
(Binary files differ)
Property changes on: trunk/Images/Segment_LeftCap.tiff
___________________________________________________________________
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream
Added: trunk/Images/Segment_LeftCapPress.tiff
===================================================================
(Binary files differ)
Property changes on: trunk/Images/Segment_LeftCapPress.tiff
___________________________________________________________________
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream
Added: trunk/Images/Segment_Middle.tiff
===================================================================
(Binary files differ)
Property changes on: trunk/Images/Segment_Middle.tiff
___________________________________________________________________
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream
Added: trunk/Images/Segment_MiddlePress.tiff
===================================================================
(Binary files differ)
Property changes on: trunk/Images/Segment_MiddlePress.tiff
___________________________________________________________________
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream
Added: trunk/Images/Segment_RightCap.tiff
===================================================================
(Binary files differ)
Property changes on: trunk/Images/Segment_RightCap.tiff
___________________________________________________________________
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream
Added: trunk/Images/Segment_RightCapPress.tiff
===================================================================
(Binary files differ)
Property changes on: trunk/Images/Segment_RightCapPress.tiff
___________________________________________________________________
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream
Added: trunk/Images/Segment_Separator.tiff
===================================================================
(Binary files differ)
Property changes on: trunk/Images/Segment_Separator.tiff
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/Images/Segment_SeparatorPress.tiff
===================================================================
(Binary files differ)
Property changes on: trunk/Images/Segment_SeparatorPress.tiff
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Deleted: trunk/Images/ToolbarFontsBlack.tiff
===================================================================
(Binary files differ)
Modified: trunk/MainWindow.nib/classes.nib
===================================================================
--- trunk/MainWindow.nib/classes.nib 2008-10-18 21:06:39 UTC (rev 4818)
+++ trunk/MainWindow.nib/classes.nib 2008-10-19 15:31:44 UTC (rev 4819)
@@ -64,14 +64,6 @@
</dict>
<dict>
<key>CLASS</key>
- <string>SKTocOutlineView</string>
- <key>LANGUAGE</key>
- <string>ObjC</string>
- <key>SUPERCLASS</key>
- <string>SKOutlineView</string>
- </dict>
- <dict>
- <key>CLASS</key>
<string>SKMainWindow</string>
<key>LANGUAGE</key>
<string>ObjC</string>
@@ -80,11 +72,11 @@
</dict>
<dict>
<key>CLASS</key>
- <string>NSMenu</string>
+ <string>SKTocOutlineView</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>SUPERCLASS</key>
- <string>NSObject</string>
+ <string>SKOutlineView</string>
</dict>
<dict>
<key>ACTIONS</key>
@@ -435,6 +427,14 @@
<string>NSResponder</string>
</dict>
<dict>
+ <key>CLASS</key>
+ <string>NSMenu</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSObject</string>
+ </dict>
+ <dict>
<key>ACTIONS</key>
<dict>
<key>changeDashPattern</key>
@@ -518,7 +518,15 @@
</dict>
<dict>
<key>CLASS</key>
+ <string>SKSegmentedControl</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
<string>NSSegmentedControl</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
+ <string>NSSegmentedControl</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>SUPERCLASS</key>
@@ -533,6 +541,14 @@
<string>NSImageCell</string>
</dict>
<dict>
+ <key>CLASS</key>
+ <string>BDSKCollapsibleView</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>BDSKContainerView</string>
+ </dict>
+ <dict>
<key>ACTIONS</key>
<dict>
<key>editBookmarks</key>
@@ -565,14 +581,6 @@
</dict>
<dict>
<key>CLASS</key>
- <string>BDSKCollapsibleView</string>
- <key>LANGUAGE</key>
- <string>ObjC</string>
- <key>SUPERCLASS</key>
- <string>BDSKContainerView</string>
- </dict>
- <dict>
- <key>CLASS</key>
<string>SKSnapshotPageCell</string>
<key>LANGUAGE</key>
<string>ObjC</string>
Modified: trunk/MainWindow.nib/info.nib
===================================================================
--- trunk/MainWindow.nib/info.nib 2008-10-18 21:06:39 UTC (rev 4818)
+++ trunk/MainWindow.nib/info.nib 2008-10-19 15:31:44 UTC (rev 4819)
@@ -10,7 +10,7 @@
<integer>5</integer>
<key>IBOpenObjects</key>
<array>
- <integer>315</integer>
+ <integer>168</integer>
</array>
<key>IBSystem Version</key>
<string>9F33</string>
Modified: trunk/MainWindow.nib/keyedobjects.nib
===================================================================
(Binary files differ)
Modified: trunk/NSImage_SKExtensions.m
===================================================================
--- trunk/NSImage_SKExtensions.m 2008-10-18 21:06:39 UTC (rev 4818)
+++ trunk/NSImage_SKExtensions.m 2008-10-19 15:31:44 UTC (rev 4819)
@@ -270,7 +270,6 @@
static NSImage *toolbarAddLineNoteMenuImage = nil;
static NSImage *toolbarAddInkNoteMenuImage = nil;
static NSImage *toolbarTextToolImage = nil;
- static NSImage *toolbarMoveToolImage = nil;
static NSImage *toolbarMagnifyToolImage = nil;
static NSImage *toolbarSelectToolImage = nil;
static NSImage *toolbarNewFolderImage = nil;
@@ -296,14 +295,6 @@
NSColor *fgColor = [NSColor whiteColor];
- BOOL isTiger = floor(NSAppKitVersionNumber) <= NSAppKitVersionNumber10_4;
-
- if (isTiger) {
- [shadow1 setShadowBlurRadius:1.0];
- [shadow1 setShadowColor:[NSColor colorWithCalibratedWhite:0.0
alpha:0.5]];
- fgColor = [NSColor blackColor];
- }
-
NSBezierPath *path;
[NSBezierPath setDefaultLineWidth:1.0];
@@ -419,7 +410,7 @@
[toolbarBackImage unlockFocus];
[toolbarBackImage setName:SKImageNameToolbarBack];
- if (isTiger) {
+ if (floor(NSAppKitVersionNumber) <= NSAppKitVersionNumber10_4) {
// the image drawn right after ToolbarBack on Tiger has drawing
artifacts, a gray upward pointing arrow at the bottom, so we make it a dummy
image
NSImage *dummy = [[NSImage alloc] initWithSize:NSMakeSize(27.0, 13.0)];
[dummy lockFocus];
@@ -837,12 +828,6 @@
[toolbarCropBoxImage setName:SKImageNameToolbarCropBox];
float outStartGray = 0.925, outEndGray = 1.0, inStartGray = 0.868,
inEndGray = 1.0;
- if (isTiger) {
- outStartGray = 0.0;
- outEndGray = 0.1;
- inStartGray = 0.15;
- inEndGray = 0.3;
- }
toolbarLeftPaneImage = [[NSImage alloc] initWithSize:NSMakeSize(27.0,
17.0)];
[toolbarLeftPaneImage lockFocus];
@@ -1025,8 +1010,6 @@
[path closePath];
[path appendBezierPathWithRect:NSMakeRect(12.0, 7.0, 2.0, 2.0)];
[path setWindingRule:NSEvenOddWindingRule];
- if (isTiger == NO)
- [path fillPathVerticallyWithStartColor:[CIColor colorWithRed:0.988
green:0.988 blue:0.988 alpha:1.0] endColor:[CIColor colorWithRed:0.762
green:0.762 blue:0.762 alpha:1.0]];
[NSGraphicsContext restoreGraphicsState];
[toolbarAnchoredNoteImage unlockFocus];
[toolbarAnchoredNoteImage setName:SKImageNameToolbarAnchoredNote];
@@ -1294,52 +1277,10 @@
[NSGraphicsContext saveGraphicsState];
[path setClip];
path = [NSBezierPath bezierPathWithRect:NSMakeRect(7.0, 4.0, 13.0, 6.0)];
- if (isTiger == NO)
- [path fillPathVerticallyWithStartColor:[CIColor colorWithRed:0.976
green:0.976 blue:0.976 alpha:1.0] endColor:[CIColor colorWithRed:0.798
green:0.798 blue:0.798 alpha:1.0]];
[NSGraphicsContext restoreGraphicsState];
[toolbarTextToolImage unlockFocus];
[toolbarTextToolImage setName:SKImageNameToolbarTextTool];
- if (isTiger) {
- toolbarMoveToolImage = [[NSImage alloc] initWithSize:NSMakeSize(27.0,
17.0)];
- [toolbarMoveToolImage lockFocus];
- [NSGraphicsContext saveGraphicsState];
- [[NSColor clearColor] setFill];
- NSRectFill(NSMakeRect(0.0, 0.0, 27.0, 17.0));
- [shadow1 set];
- [fgColor setFill];
- path = [NSBezierPath bezierPath];
- [path moveToPoint:NSMakePoint(10.0, 7.5)];
- [path lineToPoint:NSMakePoint(8.0, 9.5)];
- [path lineToPoint:NSMakePoint(10.0, 11.5)];
- [path lineToPoint:NSMakePoint(10.0, 10.0)];
- [path lineToPoint:NSMakePoint(13.0, 10.0)];
- [path lineToPoint:NSMakePoint(13.0, 13.0)];
- [path lineToPoint:NSMakePoint(11.5, 13.0)];
- [path lineToPoint:NSMakePoint(13.5, 15.0)];
- [path lineToPoint:NSMakePoint(15.5, 13.0)];
- [path lineToPoint:NSMakePoint(14.0, 13.0)];
- [path lineToPoint:NSMakePoint(14.0, 10.0)];
- [path lineToPoint:NSMakePoint(17.0, 10.0)];
- [path lineToPoint:NSMakePoint(17.0, 11.5)];
- [path lineToPoint:NSMakePoint(19.0, 9.5)];
- [path lineToPoint:NSMakePoint(17.0, 7.5)];
- [path lineToPoint:NSMakePoint(17.0, 9.0)];
- [path lineToPoint:NSMakePoint(14.0, 9.0)];
- [path lineToPoint:NSMakePoint(14.0, 6.0)];
- [path lineToPoint:NSMakePoint(15.5, 6.0)];
- [path lineToPoint:NSMakePoint(13.5, 4.0)];
- [path lineToPoint:NSMakePoint(11.5, 6.0)];
- [path lineToPoint:NSMakePoint(13.0, 6.0)];
- [path lineToPoint:NSMakePoint(13.0, 9.0)];
- [path lineToPoint:NSMakePoint(10.0, 9.0)];
- [path closePath];
- [path fill];
- [NSGraphicsContext restoreGraphicsState];
- [toolbarMoveToolImage unlockFocus];
- [toolbarMoveToolImage setName:SKImageNameToolbarMoveTool];
- }
-
toolbarMagnifyToolImage = [[NSImage alloc] initWithSize:NSMakeSize(27.0,
19.0)];
[toolbarMagnifyToolImage lockFocus];
[NSGraphicsContext saveGraphicsState];
Modified: trunk/SKMainWindowController_Toolbar.m
===================================================================
--- trunk/SKMainWindowController_Toolbar.m 2008-10-18 21:06:39 UTC (rev
4818)
+++ trunk/SKMainWindowController_Toolbar.m 2008-10-19 15:31:44 UTC (rev
4819)
@@ -547,8 +547,6 @@
[item setToolTip:NSLocalizedString(@"Fonts", @"Tool tip message")];
[item setImageNamed:@"ToolbarFonts"];
[item setSegmentedControl:fontsButton];
- if (floor(NSAppKitVersionNumber) <= NSAppKitVersionNumber10_4)
- [fontsButton setImage:[NSImage
imageNamed:@"ToolbarFontsBlack"] forSegment:0];
[item setMenuFormRepresentation:menuItem];
} else if ([identifier
isEqualToString:SKDocumentToolbarLinesItemIdentifier]) {
Added: trunk/SKSegmentedControl.h
===================================================================
--- trunk/SKSegmentedControl.h (rev 0)
+++ trunk/SKSegmentedControl.h 2008-10-19 15:31:44 UTC (rev 4819)
@@ -0,0 +1,47 @@
+//
+// SKSegmentedControl.h
+// Skim
+//
+// Created by Christiaan Hofman on 10/19/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>
+
+
[EMAIL PROTECTED] SKSegmentedControl : NSSegmentedControl
[EMAIL PROTECTED]
+
+
[EMAIL PROTECTED] SKSegmentedCell : NSSegmentedCell
[EMAIL PROTECTED]
Added: trunk/SKSegmentedControl.m
===================================================================
--- trunk/SKSegmentedControl.m (rev 0)
+++ trunk/SKSegmentedControl.m 2008-10-19 15:31:44 UTC (rev 4819)
@@ -0,0 +1,166 @@
+//
+// SKSegmentedControl.m
+// Skim
+//
+// Created by Christiaan Hofman on 10/19/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 "SKSegmentedControl.h"
+#import "NSImage_SKExtensions.h"
+#import "NSGeometry_SKExtensions.h"
+
+
[EMAIL PROTECTED] SKSegmentedControl
+
+- (id)initWithCoder:(NSCoder *)coder {
+ if (self = [super initWithCoder:coder]) {
+ if ([self respondsToSelector:@selector(setSegmentStyle:)] == NO) {
+ SKSegmentedCell *cell = [[[SKSegmentedCell alloc] init]
autorelease];
+ id oldCell = [self cell];
+ unsigned int i, count = [self segmentCount];
+
+ [cell setSegmentCount:count];
+ [cell setTrackingMode:[oldCell trackingMode]];
+ [cell setAction:[oldCell action]];
+ [cell setTarget:[oldCell target]];
+ [cell setTag:[oldCell tag]];
+ [cell setEnabled:[oldCell isEnabled]];
+ [cell setBezeled:NO];
+ [cell setBordered:NO];
+
+ for (i = 0; i < count; i++) {
+ [cell setWidth:[oldCell widthForSegment:i] forSegment:i];
+ [cell setImage:[oldCell imageForSegment:i] forSegment:i];
+ [cell setLabel:[oldCell labelForSegment:i] forSegment:i];
+ [cell setToolTip:[oldCell toolTipForSegment:i] forSegment:i];
+ [cell setEnabled:[oldCell isEnabledForSegment:i] forSegment:i];
+ [cell setSelected:[oldCell isSelectedForSegment:i]
forSegment:i];
+ [cell setMenu:[oldCell menuForSegment:i] forSegment:i];
+ [cell setTag:[oldCell tagForSegment:i] forSegment:i];
+ }
+
+ [self setCell:cell];
+ }
+ }
+ return self;
+}
+
[EMAIL PROTECTED]
+
+
[EMAIL PROTECTED] NSSegmentedCell (SKApplePrivateDeclarations)
+- (int)_trackingSegment;
+- (int)_keySegment;
[EMAIL PROTECTED]
+
+
+#define SEGMENT_HEIGHT 23.0
+#define SEGMENT_HEIGHT_OFFSET 1.0
+#define SEGMENT_CAP_WIDTH 15.0
+#define SEGMENT_CAP_EXTRA_WIDTH 3.0
+#define SEGMENT_SLIVER_WIDTH 1.0
+
[EMAIL PROTECTED] SKSegmentedCell
+
+- (BOOL)isPressedSegment:(int)segment {
+ return [self isSelectedForSegment:segment] || ([self
respondsToSelector:@selector(_trackingSegment)] && segment == [self
_trackingSegment]);
+}
+
+- (void)drawWithFrame:(NSRect)frame inView:(NSView *)controlView {
+ int i, count = [self segmentCount];
+ int keySegment = [self respondsToSelector:@selector(_keySegment)] ? [self
_keySegment] : -1;
+ NSRect rect = SKCenterRectVertically(frame, SEGMENT_HEIGHT, [controlView
isFlipped]), keyRect = NSZeroRect;
+
+ for (i = 0; i < count; i++) {
+ NSRect sideRect, midRect;
+ NSRect capRect = NSMakeRect(0.0, 0.0, SEGMENT_CAP_WIDTH,
SEGMENT_HEIGHT);
+ NSRect sliverRect = NSMakeRect(0.0, 0.0, SEGMENT_SLIVER_WIDTH,
SEGMENT_HEIGHT);
+ rect.size.width = [self widthForSegment:i];
+ midRect = rect;
+ BOOL isPressed = [self isPressedSegment:i];
+ NSImage *image;
+ if (i == 0) {
+ rect.size.width += SEGMENT_CAP_EXTRA_WIDTH;
+ NSDivideRect(rect, &sideRect, &midRect, SEGMENT_CAP_WIDTH,
NSMinXEdge);
+ image = [NSImage imageNamed:isPressed ? @"Segment_LeftCapPress" :
@"Segment_LeftCap"];
+ [image drawFlipped:[controlView isFlipped] inRect:sideRect
fromRect:capRect operation:NSCompositeSourceOver fraction:1.0];
+ }
+ if (i == count - 1) {
+ rect.size.width += SEGMENT_CAP_EXTRA_WIDTH;
+ midRect.size.width += SEGMENT_CAP_EXTRA_WIDTH;
+ NSDivideRect(midRect, &sideRect, &midRect, SEGMENT_CAP_WIDTH,
NSMaxXEdge);
+ image = [NSImage imageNamed:isPressed ? @"Segment_RightCapPress" :
@"Segment_RightCap"];
+ [image drawFlipped:[controlView isFlipped] inRect:sideRect
fromRect:capRect operation:NSCompositeSourceOver fraction:1.0];
+ } else {
+ NSDivideRect(midRect, &sideRect, &midRect, -SEGMENT_SLIVER_WIDTH,
NSMaxXEdge);
+ NSDivideRect(midRect, &sideRect, &midRect, SEGMENT_SLIVER_WIDTH,
NSMaxXEdge);
+ image = [NSImage imageNamed:isPressed || [self isPressedSegment:i
+ 1] ? @"Segment_SeparatorPress" : @"Segment_Separator"];
+ [image drawFlipped:[controlView isFlipped] inRect:sideRect
fromRect:sliverRect operation:NSCompositeSourceOver fraction:1.0];
+ }
+ if (NSWidth(midRect) > 0.0) {
+ image = [NSImage imageNamed:isPressed ? @"Segment_MiddlePress" :
@"Segment_Middle"];
+ [image drawFlipped:[controlView isFlipped] inRect:midRect
fromRect:sliverRect operation:NSCompositeSourceOver fraction:1.0];
+ }
+ if (keySegment == i && [[controlView window] isKeyWindow] &&
[[controlView window] firstResponder] == controlView)
+ NSDivideRect(rect, &sideRect, &keyRect, SEGMENT_HEIGHT_OFFSET,
[controlView isFlipped] ? NSMaxYEdge : NSMinYEdge);
+ rect.origin.x = NSMaxX(rect) + SEGMENT_SLIVER_WIDTH;
+ }
+
+ if (NSIsEmptyRect(keyRect) == NO) {
+ [NSGraphicsContext saveGraphicsState];
+ NSSetFocusRingStyle(NSFocusRingOnly);
+ NSBezierPath *path = [NSBezierPath bezierPath];
+ if (keySegment == 0) {
+ [path moveToPoint:NSMakePoint(NSMaxX(keyRect), NSMaxY(keyRect))];
+ [path
appendBezierPathWithArcFromPoint:NSMakePoint(NSMinX(keyRect), NSMaxY(keyRect))
toPoint:NSMakePoint(NSMinX(keyRect), NSMidY(keyRect)) radius:0.5 *
(SEGMENT_HEIGHT - SEGMENT_HEIGHT_OFFSET)];
+ [path
appendBezierPathWithArcFromPoint:NSMakePoint(NSMinX(keyRect), NSMinY(keyRect))
toPoint:NSMakePoint(NSMaxX(keyRect), NSMinY(keyRect)) radius:0.5 *
(SEGMENT_HEIGHT - SEGMENT_HEIGHT_OFFSET)];
+ [path lineToPoint:NSMakePoint(NSMaxX(keyRect), NSMinY(keyRect))];
+ [path closePath];
+ } else if (keySegment == count - 1) {
+ [path moveToPoint:NSMakePoint(NSMinX(keyRect), NSMinY(keyRect))];
+ [path
appendBezierPathWithArcFromPoint:NSMakePoint(NSMaxX(keyRect), NSMinY(keyRect))
toPoint:NSMakePoint(NSMaxX(keyRect), NSMidY(keyRect)) radius:0.5 *
(SEGMENT_HEIGHT - SEGMENT_HEIGHT_OFFSET)];
+ [path
appendBezierPathWithArcFromPoint:NSMakePoint(NSMaxX(keyRect), NSMaxY(keyRect))
toPoint:NSMakePoint(NSMinX(keyRect), NSMaxY(keyRect)) radius:0.5 *
(SEGMENT_HEIGHT - SEGMENT_HEIGHT_OFFSET)];
+ [path lineToPoint:NSMakePoint(NSMinX(keyRect), NSMaxY(keyRect))];
+ [path closePath];
+ } else {
+ [path appendBezierPathWithRect:keyRect];
+ }
+ [path fill];
+ [NSGraphicsContext restoreGraphicsState];
+ }
+
+ [self drawInteriorWithFrame:[self drawingRectForBounds:frame]
inView:controlView];
+}
+
[EMAIL PROTECTED]
Modified: trunk/Skim.xcodeproj/project.pbxproj
===================================================================
--- trunk/Skim.xcodeproj/project.pbxproj 2008-10-18 21:06:39 UTC (rev
4818)
+++ trunk/Skim.xcodeproj/project.pbxproj 2008-10-19 15:31:44 UTC (rev
4819)
@@ -264,6 +264,16 @@
CE4EC8830B7E6E920091F228 /* CIImage_BDSKExtensions.m in Sources
*/ = {isa = PBXBuildFile; fileRef = CE4EC8820B7E6E920091F228 /*
CIImage_BDSKExtensions.m */; };
CE4EC88C0B7E6EDB0091F228 /* SKSplitView.m in Sources */ = {isa
= PBXBuildFile; fileRef = CE4EC88B0B7E6EDB0091F228 /* SKSplitView.m */; };
CE4F9DEE0BC1BE3A005BE0A1 /* Localizable.strings in Resources */
= {isa = PBXBuildFile; fileRef = CE4F9DEC0BC1BE3A005BE0A1 /*
Localizable.strings */; };
+ CE51630A0EAB5A1A009FA237 /* SKSegmentedControl.h in Headers */
= {isa = PBXBuildFile; fileRef = CE5163080EAB5A1A009FA237 /*
SKSegmentedControl.h */; };
+ CE51630B0EAB5A1A009FA237 /* SKSegmentedControl.m in Sources */
= {isa = PBXBuildFile; fileRef = CE5163090EAB5A1A009FA237 /*
SKSegmentedControl.m */; };
+ CE5163350EAB5EE2009FA237 /* Segment_LeftCap.tiff in Resources
*/ = {isa = PBXBuildFile; fileRef = CE5163290EAB5EE2009FA237 /*
Segment_LeftCap.tiff */; };
+ CE5163370EAB5EE2009FA237 /* Segment_LeftCapPress.tiff in
Resources */ = {isa = PBXBuildFile; fileRef = CE51632B0EAB5EE2009FA237 /*
Segment_LeftCapPress.tiff */; };
+ CE5163380EAB5EE2009FA237 /* Segment_RightCap.tiff in Resources
*/ = {isa = PBXBuildFile; fileRef = CE51632C0EAB5EE2009FA237 /*
Segment_RightCap.tiff */; };
+ CE51633A0EAB5EE2009FA237 /* Segment_RightCapPress.tiff in
Resources */ = {isa = PBXBuildFile; fileRef = CE51632E0EAB5EE2009FA237 /*
Segment_RightCapPress.tiff */; };
+ CE51633C0EAB5EE2009FA237 /* Segment_SeparatorPress.tiff in
Resources */ = {isa = PBXBuildFile; fileRef = CE5163300EAB5EE2009FA237 /*
Segment_SeparatorPress.tiff */; };
+ CE51633D0EAB5EE2009FA237 /* Segment_Separator.tiff in Resources
*/ = {isa = PBXBuildFile; fileRef = CE5163310EAB5EE2009FA237 /*
Segment_Separator.tiff */; };
+ CE5163400EAB5EE2009FA237 /* Segment_Middle.tiff in Resources */
= {isa = PBXBuildFile; fileRef = CE5163340EAB5EE2009FA237 /*
Segment_Middle.tiff */; };
+ CE51635C0EAB618A009FA237 /* Segment_MiddlePress.tiff in
Resources */ = {isa = PBXBuildFile; fileRef = CE51635B0EAB618A009FA237 /*
Segment_MiddlePress.tiff */; };
CE546FC40B32D5DB00F8AFB6 /* SKNoteWindowController.m in Sources
*/ = {isa = PBXBuildFile; fileRef = CE546FC30B32D5DB00F8AFB6 /*
SKNoteWindowController.m */; };
CE5470030B32D96500F8AFB6 /* NoteWindow.nib in Resources */ =
{isa = PBXBuildFile; fileRef = CE5470010B32D96500F8AFB6 /* NoteWindow.nib */; };
CE54898C0B35D4EF00F8AFB6 /* InfoWindow.nib in Resources */ =
{isa = PBXBuildFile; fileRef = CE54898A0B35D4EF00F8AFB6 /* InfoWindow.nib */; };
@@ -275,7 +285,6 @@
CE5F43730BF8A3410069D89C /* IOKit.framework in Frameworks */ =
{isa = PBXBuildFile; fileRef = CE5F42D30BF8A3400069D89C /* IOKit.framework */;
};
CE5F71560C8CDF9A008BE480 /* NSCell_SKExtensions.m in Sources */
= {isa = PBXBuildFile; fileRef = CE5F71540C8CDF9A008BE480 /*
NSCell_SKExtensions.m */; };
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
*/; };
@@ -770,6 +779,16 @@
CE4F96F70CFB4ACA00DBEA14 /* ru */ = {isa = PBXFileReference;
fileEncoding = 10; lastKnownFileType = text.plist.strings; name = ru; path =
ru.lproj/Localizable.strings; sourceTree = "<group>"; };
CE4F96FA0CFB4AD400DBEA14 /* ru */ = {isa = PBXFileReference;
fileEncoding = 10; lastKnownFileType = text.plist.strings; name = ru; path =
ru.lproj/ZoomValues.strings; sourceTree = "<group>"; };
CE4F9DED0BC1BE3A005BE0A1 /* English */ = {isa =
PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings;
name = English; path = English.lproj/Localizable.strings; sourceTree =
"<group>"; };
+ CE5163080EAB5A1A009FA237 /* SKSegmentedControl.h */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path =
SKSegmentedControl.h; sourceTree = "<group>"; };
+ CE5163090EAB5A1A009FA237 /* SKSegmentedControl.m */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path
= SKSegmentedControl.m; sourceTree = "<group>"; };
+ CE5163290EAB5EE2009FA237 /* Segment_LeftCap.tiff */ = {isa =
PBXFileReference; lastKnownFileType = image.tiff; path = Segment_LeftCap.tiff;
sourceTree = "<group>"; };
+ CE51632B0EAB5EE2009FA237 /* Segment_LeftCapPress.tiff */ = {isa
= PBXFileReference; lastKnownFileType = image.tiff; path =
Segment_LeftCapPress.tiff; sourceTree = "<group>"; };
+ CE51632C0EAB5EE2009FA237 /* Segment_RightCap.tiff */ = {isa =
PBXFileReference; lastKnownFileType = image.tiff; path = Segment_RightCap.tiff;
sourceTree = "<group>"; };
+ CE51632E0EAB5EE2009FA237 /* Segment_RightCapPress.tiff */ =
{isa = PBXFileReference; lastKnownFileType = image.tiff; path =
Segment_RightCapPress.tiff; sourceTree = "<group>"; };
+ CE5163300EAB5EE2009FA237 /* Segment_SeparatorPress.tiff */ =
{isa = PBXFileReference; lastKnownFileType = image.tiff; path =
Segment_SeparatorPress.tiff; sourceTree = "<group>"; };
+ CE5163310EAB5EE2009FA237 /* Segment_Separator.tiff */ = {isa =
PBXFileReference; lastKnownFileType = image.tiff; path =
Segment_Separator.tiff; sourceTree = "<group>"; };
+ CE5163340EAB5EE2009FA237 /* Segment_Middle.tiff */ = {isa =
PBXFileReference; lastKnownFileType = image.tiff; path = Segment_Middle.tiff;
sourceTree = "<group>"; };
+ CE51635B0EAB618A009FA237 /* Segment_MiddlePress.tiff */ = {isa
= PBXFileReference; lastKnownFileType = image.tiff; path =
Segment_MiddlePress.tiff; sourceTree = "<group>"; };
CE546FC20B32D5DB00F8AFB6 /* SKNoteWindowController.h */ = {isa
= PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path
= SKNoteWindowController.h; sourceTree = "<group>"; };
CE546FC30B32D5DB00F8AFB6 /* SKNoteWindowController.m */ = {isa
= PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc;
path = SKNoteWindowController.m; sourceTree = "<group>"; };
CE5470020B32D96500F8AFB6 /* English */ = {isa =
PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path =
English.lproj/NoteWindow.nib; sourceTree = "<group>"; };
@@ -811,7 +830,6 @@
CE5F71540C8CDF9A008BE480 /* NSCell_SKExtensions.m */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path
= NSCell_SKExtensions.m; sourceTree = "<group>"; };
CE5FA1650C909886008BE480 /* SKFDFParser.h */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path =
SKFDFParser.h; sourceTree = "<group>"; };
CE5FA1660C909886008BE480 /* SKFDFParser.m */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path
= SKFDFParser.m; sourceTree = "<group>"; };
- CE64E8190D92BB97000AD050 /* ToolbarFontsBlack.tiff */ = {isa =
PBXFileReference; lastKnownFileType = image.tiff; path =
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>"; };
@@ -1423,6 +1441,8 @@
CEAA55B50C6DE452006BD633 /* SKProgressCell.m */,
CEAE1C450CA1877F00849B0F /*
SKSecondaryPDFView.h */,
CEAE1C460CA1877F00849B0F /*
SKSecondaryPDFView.m */,
+ CE5163080EAB5A1A009FA237 /*
SKSegmentedControl.h */,
+ CE5163090EAB5A1A009FA237 /*
SKSegmentedControl.m */,
CE0859D00DAE912500760AFC /*
SKSnapshotPageCell.h */,
CE0859D10DAE912500760AFC /*
SKSnapshotPageCell.m */,
CE4EC88A0B7E6EDB0091F228 /* SKSplitView.h */,
@@ -1577,11 +1597,18 @@
CEAFFD7A0C40ED5400C3ECBB /* ToolbarColors.tiff
*/,
CE6A5B9D0D663491003B7CC3 /*
ToolbarCustomize.tiff */,
CEAFFD7B0C40ED5400C3ECBB /* ToolbarFonts.tiff
*/,
- CE64E8190D92BB97000AD050 /*
ToolbarFontsBlack.tiff */,
CE7467330B7F2ED700CBF969 /* ToolbarInfo.tiff */,
CEAFFD9C0C40F2A800C3ECBB /* ToolbarLines.tiff
*/,
CE6DC8890D68C657003A072F /*
ToolbarMoveTool.tiff */,
CE6A5BB10D663771003B7CC3 /* ToolbarPrint.tiff
*/,
+ CE5163290EAB5EE2009FA237 /*
Segment_LeftCap.tiff */,
+ CE51632B0EAB5EE2009FA237 /*
Segment_LeftCapPress.tiff */,
+ CE51632C0EAB5EE2009FA237 /*
Segment_RightCap.tiff */,
+ CE51632E0EAB5EE2009FA237 /*
Segment_RightCapPress.tiff */,
+ CE5163310EAB5EE2009FA237 /*
Segment_Separator.tiff */,
+ CE5163300EAB5EE2009FA237 /*
Segment_SeparatorPress.tiff */,
+ CE5163340EAB5EE2009FA237 /* Segment_Middle.tiff
*/,
+ CE51635B0EAB618A009FA237 /*
Segment_MiddlePress.tiff */,
CEF84C620C78A89900A3AD51 /*
SmallPreferences.tiff */,
CE7B85FC0CCF4AA800793F46 /* SmallMenu.tiff */,
CEAA56D20C6DEE83006BD633 /* Cancel.tiff */,
@@ -1932,6 +1959,7 @@
CEAA8EF70EA2A14700C16FE4 /* SKNote.h in Headers
*/,
CEAA8F2E0EA2A86200C16FE4 /* SKNoteText.h in
Headers */,
CE7611640EA49D1400301E45 /* SKPrintableView.h
in Headers */,
+ CE51630A0EAB5A1A009FA237 /*
SKSegmentedControl.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -2157,7 +2185,6 @@
CE6DC7770D687252003A072F /*
PrintAccessoryView.nib in Resources */,
CE6DC88A0D68C657003A072F /*
ToolbarMoveTool.tiff in Resources */,
CE6DC9940D699F21003A072F /* TransitionMask.jpg
in Resources */,
- CE64E81A0D92BB97000AD050 /*
ToolbarFontsBlack.tiff in Resources */,
CE816B0E0D719700008D807D /* Skim-Leopard.bundle
in Resources */,
CE0ECCD90DE71868006EEDDB /* Templates in
Resources */,
CEAF36B20E67246A00491E3B /* ReleaseNotes.nib in
Resources */,
@@ -2166,6 +2193,14 @@
CEAF36D70E672BB900491E3B /* MainWindow.nib in
Resources */,
CEAF371A0E676EC300491E3B /* BookmarksWindow.nib
in Resources */,
CE39C6E70E9BCA7B003FF992 /* NotesDocument.nib
in Resources */,
+ CE5163350EAB5EE2009FA237 /*
Segment_LeftCap.tiff in Resources */,
+ CE5163370EAB5EE2009FA237 /*
Segment_LeftCapPress.tiff in Resources */,
+ CE5163380EAB5EE2009FA237 /*
Segment_RightCap.tiff in Resources */,
+ CE51633A0EAB5EE2009FA237 /*
Segment_RightCapPress.tiff in Resources */,
+ CE51633C0EAB5EE2009FA237 /*
Segment_SeparatorPress.tiff in Resources */,
+ CE51633D0EAB5EE2009FA237 /*
Segment_Separator.tiff in Resources */,
+ CE5163400EAB5EE2009FA237 /* Segment_Middle.tiff
in Resources */,
+ CE51635C0EAB618A009FA237 /*
Segment_MiddlePress.tiff in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -2438,6 +2473,7 @@
CEAA8EF80EA2A14700C16FE4 /* SKNote.m in Sources
*/,
CEAA8F2F0EA2A86200C16FE4 /* SKNoteText.m in
Sources */,
CE7611650EA49D1400301E45 /* SKPrintableView.m
in Sources */,
+ CE51630B0EAB5A1A009FA237 /*
SKSegmentedControl.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit