Revision: 3430
http://skim-app.svn.sourceforge.net/skim-app/?rev=3430&view=rev
Author: hofman
Date: 2008-02-22 15:30:19 -0800 (Fri, 22 Feb 2008)
Log Message:
-----------
Remove files for obsolete class from project.
Modified Paths:
--------------
trunk/SKMainWindowController.h
trunk/Skim.xcodeproj/project.pbxproj
Removed Paths:
-------------
trunk/BDSKImagePopUpButton.h
trunk/BDSKImagePopUpButton.m
trunk/BDSKImagePopUpButtonCell.h
trunk/BDSKImagePopUpButtonCell.m
Deleted: trunk/BDSKImagePopUpButton.h
===================================================================
--- trunk/BDSKImagePopUpButton.h 2008-02-22 18:20:43 UTC (rev 3429)
+++ trunk/BDSKImagePopUpButton.h 2008-02-22 23:30:19 UTC (rev 3430)
@@ -1,91 +0,0 @@
-//
-// BDSKImagePopUpButton.h
-// Bibdesk
-//
-// Created by Christiaan Hofman on 3/22/05.
-//
-/*
- This software is Copyright (c) 2005-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 "BDSKImagePopUpButtonCell.h"
-
[EMAIL PROTECTED] BDSKImageFadeAnimation;
-
[EMAIL PROTECTED] BDSKImagePopUpButton : NSPopUpButton
-{
- BOOL highlight;
- id delegate;
- BDSKImageFadeAnimation *animation;
-}
-- (NSSize)iconSize;
-- (void)setIconSize:(NSSize)iconSize;
-
-- (BOOL)showsMenuWhenIconClicked;
-- (void)setShowsMenuWhenIconClicked:(BOOL)showsMenuWhenIconClicked;
-
-- (NSImage *)iconImage;
-- (void)setIconImage:(NSImage *)iconImage;
-
-- (NSImage *)arrowImage;
-- (void) setArrowImage:(NSImage *)arrowImage;
-
-- (BOOL)iconActionEnabled;
-- (void)setIconActionEnabled:(BOOL)iconActionEnabled;
-
-- (BOOL)refreshesMenu;
-- (void)setRefreshesMenu:(BOOL)refreshesMenu;
-
-- (id)delegate;
-- (void)setDelegate:(id)newDelegate;
-
-- (NSMenu *)menuForCell:(id)cell;
-
-- (BOOL)startDraggingWithEvent:(NSEvent *)theEvent;
-
[EMAIL PROTECTED]
-
[EMAIL PROTECTED] NSObject (BDSKImagePopUpButtonDelegate)
-- (NSMenu *)menuForImagePopUpButton:(BDSKImagePopUpButton *)view;
[EMAIL PROTECTED]
-
[EMAIL PROTECTED] NSObject (BDSKImagePopUpButtonDraggingDestination)
-- (NSDragOperation)imagePopUpButton:(BDSKImagePopUpButton *)view
canReceiveDrag:(id <NSDraggingInfo>)sender;
-- (BOOL)imagePopUpButton:(BDSKImagePopUpButton *)view receiveDrag:(id
<NSDraggingInfo>)sender;
[EMAIL PROTECTED]
-
[EMAIL PROTECTED] NSObject (BDSKImagePopUpButtonDraggingSource)
-- (BOOL)imagePopUpButton:(BDSKImagePopUpButton *)view
writeDataToPasteboard:(NSPasteboard *)pasteboard;
-- (NSArray *)imagePopUpButton:(BDSKImagePopUpButton *)view
namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropDestination;
-- (void)imagePopUpButton:(BDSKImagePopUpButton *)view
cleanUpAfterDragOperation:(NSDragOperation)operation;
[EMAIL PROTECTED]
Deleted: trunk/BDSKImagePopUpButton.m
===================================================================
--- trunk/BDSKImagePopUpButton.m 2008-02-22 18:20:43 UTC (rev 3429)
+++ trunk/BDSKImagePopUpButton.m 2008-02-22 23:30:19 UTC (rev 3430)
@@ -1,251 +0,0 @@
-//
-// BDSKImagePopUpButton.m
-// Bibdesk
-//
-// Created by Christiaan Hofman on 3/22/05.
-//
-/*
- This software is Copyright (c) 2005-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 "BDSKImagePopUpButton.h"
-#import "NSBezierPath_BDSKExtensions.h"
-
[EMAIL PROTECTED] BDSKImagePopUpButton
-
-+ (Class)cellClass{
- return [BDSKImagePopUpButtonCell class];
-}
-
-- (id)initWithFrame:(NSRect)frameRect {
- if (self = [super initWithFrame:frameRect]) {
- highlight = NO;
- delegate = nil;
- }
- return self;
-}
-
-- (id)initWithCoder:(NSCoder *)coder{
- if (self = [super initWithCoder:coder]) {
- highlight = NO;
- [self setDelegate:[coder decodeObjectForKey:@"delegate"]];
-
- if (![[self cell] isKindOfClass:[BDSKImagePopUpButtonCell
class]]) {
- BDSKImagePopUpButtonCell *cell =
[[[BDSKImagePopUpButtonCell alloc] init] autorelease];
-
- if ([self image] != nil) {
- [cell setIconImage:[self image]];
- [cell setIconSize:[[self image] size]];
- }
- if ([self menu] != nil) {
- if ([self pullsDown])
- [[self menu] removeItemAtIndex:0];
- [cell setMenu:[self menu]];
- }
- [self setCell:cell];
- }
- }
- return self;
-}
-
-- (void)encodeWithCoder:(NSCoder *)encoder{
- [super encodeWithCoder:encoder];
- [encoder encodeConditionalObject:delegate forKey:@"delegate"];
-}
-
-- (void)dealloc{
- [animation setDelegate:nil];
- [animation stopAnimation];
- [animation release];
- [super dealloc];
-}
-
-#pragma mark Accessors
-
-- (id)delegate {
- return delegate;
-}
-
-- (void)setDelegate:(id)newDelegate {
- delegate = newDelegate;
-}
-
-- (NSSize)iconSize{
- return [[self cell] iconSize];
-}
-
-- (void) setIconSize:(NSSize)iconSize{
- [[self cell] setIconSize:iconSize];
-}
-
-- (BOOL)showsMenuWhenIconClicked{
- return [[self cell] showsMenuWhenIconClicked];
-}
-
-- (void)setShowsMenuWhenIconClicked:(BOOL)showsMenuWhenIconClicked{
- [[self cell] setShowsMenuWhenIconClicked: showsMenuWhenIconClicked];
-}
-
-- (NSImage *)iconImage{
- return [[self cell] iconImage];
-}
-
-- (void)setIconImage:(NSImage *)iconImage{
- [[self cell] setIconImage: iconImage];
- [self setNeedsDisplay:YES];
-}
-
-- (NSImage *)arrowImage{
- return [[self cell] arrowImage];
-}
-
-- (void)setArrowImage:(NSImage *)arrowImage{
- [[self cell] setArrowImage: arrowImage];
-}
-
-- (BOOL)iconActionEnabled{
- return [[self cell] iconActionEnabled];
-}
-
-- (void)setIconActionEnabled:(BOOL)iconActionEnabled{
- [[self cell] setIconActionEnabled: iconActionEnabled];
-}
-- (BOOL)refreshesMenu{
- return [[self cell] refreshesMenu];
-}
-
-- (void)setRefreshesMenu:(BOOL)refreshesMenu{
- [[self cell] setRefreshesMenu:refreshesMenu];
-}
-
-- (NSMenu *)menuForCell:(id)cell{
- if ([self refreshesMenu] &&
- [delegate
respondsToSelector:@selector(menuForImagePopUpButton:)]) {
- return [delegate menuForImagePopUpButton:self];
- } else {
- return [cell menu];
- }
-}
-
-#pragma mark Dragging source
-
-- (unsigned int)draggingSourceOperationMaskForLocal:(BOOL)isLocal {
- return (isLocal) ? NSDragOperationEvery : NSDragOperationCopy;
-}
-
-- (BOOL)startDraggingWithEvent:(NSEvent *)theEvent {
- NSPasteboard *pboard = [NSPasteboard pasteboardWithName:NSDragPboard];
-
- if ([delegate
respondsToSelector:@selector(imagePopUpButton:writeDataToPasteboard:)] == NO ||
- [delegate imagePopUpButton:self writeDataToPasteboard:pboard]
== NO)
- return NO;
-
- NSImage *iconImage;
- NSSize size = [[self cell] iconSize];
- NSImage *dragImage = [[[NSImage alloc] initWithSize:size] autorelease];
- NSPoint mouseLoc = [self convertPoint:[theEvent locationInWindow]
fromView:nil];
-
- mouseLoc.x -= 0.5f * size.width;
- mouseLoc.y += 0.5f * size.height;
-
- if ([[self cell] usesItemFromMenu] == NO) {
- iconImage = [self iconImage];
- } else {
- iconImage = [[self selectedItem] image];
- }
- NSSize srcSize = [iconImage size];
- [dragImage lockFocus];
- [iconImage drawInRect:NSMakeRect(0, 0, size.width, size.height)
fromRect:NSMakeRect(0, 0, srcSize.width, srcSize.height)
operation:NSCompositeCopy fraction:0.6];
- [dragImage unlockFocus];
-
- [self dragImage:dragImage at:mouseLoc offset:NSZeroSize event:theEvent
pasteboard:pboard source:self slideBack:YES];
-
- return YES;
-}
-
-- (NSArray *)namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropDestination
{
- if ([delegate
respondsToSelector:@selector(imagePopUpButton:namesOfPromisedFilesDroppedAtDestination:)])
- return [delegate imagePopUpButton:self
namesOfPromisedFilesDroppedAtDestination:dropDestination];
- return nil;
-}
-
-- (void)draggedImage:(NSImage *)anImage endedAt:(NSPoint)aPoint
operation:(NSDragOperation)operation{
- if ([delegate
respondsToSelector:@selector(imagePopUpButton:cleanUpAfterDragOperation:)])
- [delegate imagePopUpButton:self
cleanUpAfterDragOperation:operation];
-}
-
-#pragma mark Dragging destination
-
-- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender {
- NSDragOperation dragOp = NSDragOperationNone;
- if ([delegate respondsToSelector:@selector(imagePopUpButton:receiveDrag:)]
&&
- [delegate
respondsToSelector:@selector(imagePopUpButton:canReceiveDrag:)]) {
-
- dragOp = [delegate imagePopUpButton:self canReceiveDrag:sender];
- if (dragOp != NSDragOperationNone) {
- highlight = YES;
- [self setNeedsDisplay:YES];
- }
- }
- return dragOp;
-}
-
-- (void)draggingExited:(id <NSDraggingInfo>)sender {
- highlight = NO;
- [self setNeedsDisplay:YES];
-}
-
-- (BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender {
- highlight = NO;
- [self setNeedsDisplay:YES];
- return YES;
-}
-
-- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender {
- if(delegate == nil) return NO;
-
- return [delegate imagePopUpButton:self receiveDrag:sender];
-}
-
-#pragma mark Drawing and Highlighting
-
--(void)drawRect:(NSRect)rect {
- [super drawRect:rect];
-
- if (highlight) {
- [NSGraphicsContext saveGraphicsState];
- [NSBezierPath drawHighlightInRect:[self bounds] radius:4.0
lineWidth:2.0 color:[NSColor alternateSelectedControlColor]];
- [NSGraphicsContext restoreGraphicsState];
- }
-}
-
[EMAIL PROTECTED]
Deleted: trunk/BDSKImagePopUpButtonCell.h
===================================================================
--- trunk/BDSKImagePopUpButtonCell.h 2008-02-22 18:20:43 UTC (rev 3429)
+++ trunk/BDSKImagePopUpButtonCell.h 2008-02-22 23:30:19 UTC (rev 3430)
@@ -1,74 +0,0 @@
-//
-// BDSKImagePopUpButtonCell.h
-// Bibdesk
-//
-// Created by Christiaan Hofman on 3/22/05.
-//
-/*
- This software is Copyright (c) 2005-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] BDSKImagePopUpButtonCell : NSPopUpButtonCell
-{
- NSButtonCell *buttonCell;
- NSSize iconSize;
- BOOL showsMenuWhenIconClicked;
- NSImage *iconImage;
- NSImage *arrowImage;
- BOOL iconActionEnabled;
- BOOL alwaysUsesFirstItemAsSelected;
- BOOL refreshesMenu;
-}
-
-- (BOOL)iconActionEnabled;
-- (void)setIconActionEnabled:(BOOL)flag;
-
-- (NSSize)iconSize;
-- (void)setIconSize:(NSSize)aSize;
-
-- (BOOL)showsMenuWhenIconClicked;
-- (void)setShowsMenuWhenIconClicked:(BOOL)flag;
-
-- (NSImage *)iconImage;
-- (void)setIconImage:(NSImage *)anImage;
-- (NSImage *) arrowImage;
-- (void)setArrowImage:(NSImage *)anImage;
-
-- (BOOL)alwaysUsesFirstItemAsSelected;
-- (void)setAlwaysUsesFirstItemAsSelected:(BOOL)flag;
-
-- (BOOL)refreshesMenu;
-- (void)setRefreshesMenu:(BOOL)flag;
-
[EMAIL PROTECTED]
Deleted: trunk/BDSKImagePopUpButtonCell.m
===================================================================
--- trunk/BDSKImagePopUpButtonCell.m 2008-02-22 18:20:43 UTC (rev 3429)
+++ trunk/BDSKImagePopUpButtonCell.m 2008-02-22 23:30:19 UTC (rev 3430)
@@ -1,495 +0,0 @@
-//
-// BDSKImagePopUpButtonCell.m
-// Bibdesk
-//
-// Created by Christiaan Hofman on 3/22/05.
-//
-/*
- This software is Copyright (c) 2005-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 "BDSKImagePopUpButtonCell.h"
-#import "BDSKImagePopUpButton.h"
-
[EMAIL PROTECTED] BDSKImagePopUpButtonCell (Private)
-
-- (void)setButtonCell:(NSButtonCell *)buttonCell;
-- (void)showMenuInView:(NSView *)controlView withEvent:(NSEvent *)event;
-- (NSSize)iconDrawSize;
-
[EMAIL PROTECTED]
-
[EMAIL PROTECTED] BDSKImagePopUpButtonCell
-
-// this used to be the designated intializer
-- (id)initTextCell:(NSString *)stringValue pullsDown:(BOOL)pullsDown{
- self = [self initImageCell:nil];
- return self;
-}
-
-// this is now the designated intializer
-- (id)initImageCell:(NSImage *)anImage{
- if (self = [super initTextCell:@"" pullsDown:NO]) {
- NSButtonCell *cell = [[NSButtonCell alloc] initTextCell: @""];
- [cell setBordered: NO];
- [cell setHighlightsBy: NSContentsCellMask];
- [cell setImagePosition: NSImageLeft];
- [self setButtonCell:cell];
- [cell release];
-
- iconSize = NSMakeSize(32.0, 32.0);
- showsMenuWhenIconClicked = NO;
- iconActionEnabled = YES;
- alwaysUsesFirstItemAsSelected = NO;
- refreshesMenu = NO;
-
- static NSImage *defaultArrowImage = nil;
- if (defaultArrowImage == nil) {
- defaultArrowImage = [[NSImage alloc] initWithSize:NSMakeSize(7.0,
5.0)];
- [defaultArrowImage lockFocus];
- NSBezierPath *path = [NSBezierPath bezierPath];
- [path moveToPoint:NSMakePoint(0.5, 5.0)];
- [path lineToPoint:NSMakePoint(6.5, 5.0)];
- [path lineToPoint:NSMakePoint(3.5, 0.0)];
- [path closePath];
- [[NSColor colorWithCalibratedWhite:0.0 alpha:0.75] setFill];
- [path fill];
- [defaultArrowImage unlockFocus];
- }
-
- [self setIconImage: anImage];
- [self setArrowImage: defaultArrowImage];
- }
-
- return self;
-}
-
-- (id)initWithCoder:(NSCoder *)coder{
- if (self = [super initWithCoder:coder]) {
- [self setButtonCell:[coder decodeObjectForKey:@"buttonCell"]];
-
- iconSize = [coder decodeSizeForKey:@"iconSize"];
- showsMenuWhenIconClicked = [coder
decodeBoolForKey:@"showsMenuWhenIconClicked"];
- iconActionEnabled = [coder
decodeBoolForKey:@"iconActionEnabled"];
- alwaysUsesFirstItemAsSelected = [coder
decodeBoolForKey:@"alwaysUsesFirstItemAsSelected"];
- refreshesMenu = [coder decodeBoolForKey:@"refreshesMenu"];
-
- [self setIconImage:[coder decodeObjectForKey:@"iconImage"]];
- [self setArrowImage:[coder decodeObjectForKey:@"arrowImage"]];
-
- // hack to always get regular controls in a toolbar
customization palette, there should be a better way
- [self setControlSize:NSRegularControlSize];
- }
- return self;
-}
-
-- (void)encodeWithCoder:(NSCoder *)encoder{
- [super encodeWithCoder:encoder];
- [encoder encodeObject:buttonCell forKey:@"buttonCell"];
-
- [encoder encodeSize:iconSize forKey:@"iconSize"];
- [encoder encodeBool:showsMenuWhenIconClicked
forKey:@"showsMenuWhenIconClicked"];
- [encoder encodeBool:iconActionEnabled forKey:@"iconActionEnabled"];
- [encoder encodeBool:alwaysUsesFirstItemAsSelected
forKey:@"alwaysUsesFirstItemAsSelected"];
- [encoder encodeBool:refreshesMenu forKey:@"refreshesMenu"];
-
- [encoder encodeObject:iconImage forKey:@"iconImage"];
-
- [encoder encodeObject:arrowImage forKey:@"arrowImage"];
-}
-
-- (void)dealloc{
- [self setButtonCell:nil]; // release the ivar and set to nil, or [super
dealloc] causes a crash
- [iconImage release];
- [arrowImage release];
- [super dealloc];
-}
-
-#pragma mark Accessors
-
-- (NSSize)iconSize{
- return iconSize;
-}
-
-- (void)setIconSize:(NSSize)aSize{
- iconSize = aSize;
- [buttonCell setImage:nil]; // invalidate the image
-}
-
-- (BOOL)iconActionEnabled {
- return iconActionEnabled;
-}
-
-- (void)setIconActionEnabled:(BOOL)flag {
- iconActionEnabled = flag;
-}
-
-- (BOOL)showsMenuWhenIconClicked{
- return showsMenuWhenIconClicked;
-}
-
-
-- (void)setShowsMenuWhenIconClicked:(BOOL)flag{
- showsMenuWhenIconClicked = flag;
-}
-
-- (NSImage *)iconImage{
- return iconImage;
-}
-
-- (void)setIconImage:(NSImage *)anImage{
- if (anImage != iconImage) {
- [iconImage release];
- iconImage = [anImage retain];
- [buttonCell setImage:nil]; // invalidate the image
- }
-}
-
-- (NSImage *)arrowImage{
- return arrowImage;
-}
-
-- (void)setArrowImage:(NSImage *)anImage{
- if (anImage != iconImage) {
- [arrowImage release];
- arrowImage = [anImage retain];
- [buttonCell setImage:nil]; // invalidate the image
- }
-}
-
-- (void)setAlternateImage:(NSImage *)anImage{
- [super setAlternateImage:anImage];
- [buttonCell setAlternateImage:nil]; // invalidate the image
- [buttonCell setImage:nil]; // invalidate the image
-}
-
-
-- (BOOL)alwaysUsesFirstItemAsSelected {
- return alwaysUsesFirstItemAsSelected;
-}
-
-- (void)setAlwaysUsesFirstItemAsSelected:(BOOL)flag {
- alwaysUsesFirstItemAsSelected = flag;
-}
-
-- (NSMenuItem *)selectedItem{
- if (alwaysUsesFirstItemAsSelected) {
- return (NSMenuItem *)[self itemAtIndex:0];
- } else {
- return (NSMenuItem *)[super selectedItem];
- }
-}
-
-- (BOOL)refreshesMenu {
- return refreshesMenu;
-}
-
-- (void)setRefreshesMenu:(BOOL)flag {
- if (refreshesMenu != flag) {
- refreshesMenu = flag;
- }
-}
-
-- (BOOL)isEnabled {
- return [buttonCell isEnabled];
-}
-
-- (void)setEnabled:(BOOL)flag {
- [buttonCell setEnabled:flag];
-}
-
-- (BOOL)showsFirstResponder{
- return [buttonCell showsFirstResponder];
-}
-
-- (void)setShowsFirstResponder:(BOOL)flag{
- [buttonCell setShowsFirstResponder:flag];
-}
-
-- (void)setUsesItemFromMenu:(BOOL)flag{
- [super setUsesItemFromMenu:flag];
- [buttonCell setImage:nil]; // invalidate the image
-}
-
-#pragma mark Handling mouse/keyboard events
-
-- (BOOL) trackMouse: (NSEvent *) event
- inRect: (NSRect) cellFrame
- ofView: (NSView *) controlView
- untilMouseUp: (BOOL) untilMouseUp{
- BOOL trackingResult = YES;
-
- if ([event type] == NSKeyDown) {
- // Keyboard event
- NSString *characters = [event charactersIgnoringModifiers];
- unichar ch = [characters length] > 0 ? [characters characterAtIndex:0]
: 0;
-
- if ([self showsMenuWhenIconClicked] == YES || ch ==
NSUpArrowFunctionKey || ch == NSDownArrowFunctionKey) {
- [self showMenuInView:controlView withEvent:event];
- } else if (ch == ' ') {
- [self performClick: controlView];
- }
- } else {
- // Mouse event
- NSPoint mouseLocation = [controlView convertPoint: [event
locationInWindow] fromView: nil];
- NSSize iconDrawSize = [self iconDrawSize];
- NSSize arrowSize = NSZeroSize;
- NSRect arrowRect;
-
- if ([self arrowImage] != nil) {
- arrowSize = [[self arrowImage] size];
- }
-
- arrowRect = NSMakeRect(cellFrame.origin.x + iconDrawSize.width
+ 1.0, cellFrame.origin.y,
-
arrowSize.width, arrowSize.height);
-
- if ([controlView isFlipped]) {
- arrowRect.origin.y += iconDrawSize.height;
- arrowRect.origin.y -= arrowSize.height;
- }
-
-/* NSLog(@"mouseLocation: %@", NSStringFromPoint(mouseLocation));
- NSLog(@"isFlipped: %d", [controlView isFlipped]);
- NSLog(@"arrowRect: %@", NSStringFromRect(arrowRect));
-*/
- BOOL shouldSendAction = NO;
-
-
- if ([event type] == NSLeftMouseDown) {
- if (([self showsMenuWhenIconClicked] == YES && [self
iconActionEnabled])
- || [controlView mouse: mouseLocation inRect:
arrowRect]) {
- [self showMenuInView:controlView
withEvent:event];
- } else {
- // Here we use periodic events to get
- // the menu to show up after a delay, but
- // only if we didn't mouse-up first.
- // Mouse-up causes the action to be sent
- // Drag or waiting for the delay causes the
menu to show.
- // The period is meaningless because we
- // cancel after the first event every time.
- [NSEvent startPeriodicEventsAfterDelay:0.7
-
withPeriod:1];
-
- NSEvent *nextEvent = [NSApp
nextEventMatchingMask:(NSLeftMouseUpMask | NSPeriodicMask |
NSLeftMouseDraggedMask)
-
untilDate:[NSDate distantFuture]
-
inMode:NSEventTrackingRunLoopMode
-
dequeue:YES];
- [NSEvent stopPeriodicEvents];
- if ([nextEvent type] == NSLeftMouseUp) {
- // if we mouse-up inside the button,
send the action.
- // note that because we show the menu
on drags,
- // we don't need to check that we're
still inside
- // before we send the action.
-
- if ([self iconActionEnabled]) {
- shouldSendAction = YES;
- } else {
- [self
showMenuInView:controlView withEvent:nextEvent];
- }
-
- } else if([nextEvent type] ==
NSLeftMouseDragged) {
- // test option key to see if we should drag-copy or show
the menu, since the drag-to-copy behavior is inconsistent, particularly in
BibEditor (see bug #1519481)
- shouldSendAction = NO;
- if (([nextEvent modifierFlags] &
NSAlternateKeyMask) > 0 &&
- [controlView
respondsToSelector:@selector(startDraggingWithEvent:)]){
- if([(id)controlView startDraggingWithEvent:nextEvent]
== NO)
- [self showMenuInView:controlView
withEvent:nextEvent];
- } else {
- [self showMenuInView:controlView withEvent:nextEvent];
- }
-
- } else {
- // NSLog(@"periodic event %@",
nextEvent);
- shouldSendAction = NO;
-
- // showMenu expects a mouseEvent,
- // so we send it the original event:
- [self showMenuInView:controlView
withEvent:event];
- }
-
- }
- } else {
- trackingResult = [buttonCell trackMouse: event
-
inRect: cellFrame
-
ofView: controlView
-
untilMouseUp: [[buttonCell class] prefersTrackingUntilMouseUp]]; // NO for
NSButton
-
- if (trackingResult == YES && [self iconActionEnabled]) {
- shouldSendAction = YES;
- }
- }
- if (shouldSendAction) {
- NSMenuItem *selectedItem = [self selectedItem];
- [NSEvent stopPeriodicEvents];
- [NSApp sendAction: [selectedItem action] to: [selectedItem target]
from: selectedItem];
- }
- }
-
-// NSLog(@"trackingResult: %d", trackingResult);
-
- return trackingResult;
-}
-
-- (void)performClick:(id)sender{
- [buttonCell performClick: sender];
- [super performClick: sender];
- if ([self iconActionEnabled]) {
- NSMenuItem *selectedItem = [self selectedItem];
- [NSApp sendAction: [selectedItem action] to: [selectedItem target]
from: selectedItem];
- }
-}
-
-
-#pragma mark Drawing and highlighting
-
-- (NSSize)cellSize {
- NSSize size = [self iconDrawSize];
- if ([self arrowImage]) {
- size.width += [[self arrowImage] size].width;
- }
- return size;
-}
-
-- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView{
- if ([buttonCell image] == nil || [self usesItemFromMenu]) {
- // we need to redraw the image
-
- NSImage *image = [self usesItemFromMenu] ? [[self selectedItem]
image] : [self iconImage];
-
- NSSize drawSize = [self iconDrawSize];
- NSRect iconRect = NSZeroRect;
- NSRect iconDrawRect = NSZeroRect;
- NSRect arrowRect = NSZeroRect;
- NSRect arrowDrawRect = NSZeroRect;
-
- iconRect.size = [image size];
- iconDrawRect.size = drawSize;
- if (arrowImage) {
- arrowRect.size = arrowDrawRect.size = [arrowImage size];
- arrowDrawRect.origin =
NSMakePoint(NSWidth(iconDrawRect), 1.0);
- drawSize.width += NSWidth(arrowRect);
- }
-
- NSImage *popUpImage = [[NSImage alloc] initWithSize: drawSize];
-
- [popUpImage lockFocus];
- if (image)
- [image drawInRect: iconDrawRect fromRect: iconRect
operation: NSCompositeSourceOver fraction: 1.0];
- if (arrowImage)
- [arrowImage drawInRect: arrowDrawRect fromRect:
arrowRect operation: NSCompositeSourceOver fraction: 1.0];
- [popUpImage unlockFocus];
-
- [buttonCell setImage: popUpImage];
- [popUpImage release];
-
- if ([self alternateImage]) {
- popUpImage = [[NSImage alloc] initWithSize: drawSize];
-
- [popUpImage lockFocus];
- [[self alternateImage] drawInRect: iconDrawRect
fromRect: iconRect operation: NSCompositeSourceOver fraction: 1.0];
- if (arrowImage)
- [arrowImage drawInRect: arrowDrawRect
fromRect: arrowRect operation: NSCompositeSourceOver fraction: 1.0];
- [popUpImage unlockFocus];
-
- [buttonCell setAlternateImage: popUpImage];
- [popUpImage release];
- }
- }
- // NSLog(@"cellFrame: %@ selectedItem: %@",
NSStringFromRect(cellFrame), [[self selectedItem] title]);
-
- [buttonCell drawWithFrame: cellFrame inView: controlView];
-}
-
-- (void)highlight:(BOOL)flag withFrame:(NSRect)cellFrame inView:(NSView
*)controlView{
- [buttonCell highlight: flag withFrame: cellFrame inView: controlView];
- [super highlight: flag withFrame: cellFrame inView: controlView];
-}
-
[EMAIL PROTECTED]
-
[EMAIL PROTECTED] BDSKImagePopUpButtonCell (Private)
-
-- (void)setButtonCell:(NSButtonCell *)aCell{
- if(aCell != buttonCell){
- [buttonCell release];
- buttonCell = [aCell retain];
- }
-}
-
-- (void)showMenuInView:(NSView *)controlView withEvent:(NSEvent *)event{
- NSPoint newLoc = NSMakePoint(NSMinX([controlView bounds]),
NSMaxY([controlView bounds]) + 4);
- newLoc = [controlView convertPoint:newLoc toView:nil];
- NSEventType evt = [event type];
- NSEvent *newEvent;
-
- switch(evt){
- case NSKeyDown:
- newEvent = [NSEvent keyEventWithType:evt
- location:newLoc
- modifierFlags:[event modifierFlags]
- timestamp:[event timestamp]
- windowNumber:[event windowNumber]
- context:[event context]
- characters:[event characters]
- charactersIgnoringModifiers:[event
charactersIgnoringModifiers]
- isARepeat:[event isARepeat]
- keyCode:[event keyCode]];
- break;
-
- default:
- newEvent = [NSEvent mouseEventWithType: [event type]
- location: newLoc
- modifierFlags: [event modifierFlags]
- timestamp: [event timestamp]
- windowNumber: [event windowNumber]
- context: [event context]
- eventNumber: [event eventNumber]
- clickCount: [event clickCount]
- pressure: [event pressure]];
- }
-
- if ([self refreshesMenu] && [controlView
respondsToSelector:@selector(menuForCell:)]) {
- [self setMenu:[controlView
performSelector:@selector(menuForCell:) withObject:self]];
- }
- [NSMenu popUpContextMenu: [self menu] withEvent: newEvent forView:
controlView];
-}
-
-- (NSSize)iconDrawSize {
- NSSize size = [self iconSize];
- if ([self controlSize] != NSRegularControlSize) {
- // for small and mini controls we just scale the icon by 75%
- size = NSMakeSize(size.width * 0.75, size.height * 0.75);
- }
- return size;
-}
-
[EMAIL PROTECTED]
Modified: trunk/SKMainWindowController.h
===================================================================
--- trunk/SKMainWindowController.h 2008-02-22 18:20:43 UTC (rev 3429)
+++ trunk/SKMainWindowController.h 2008-02-22 23:30:19 UTC (rev 3430)
@@ -69,7 +69,7 @@
} SKPDFViewState;
@class PDFOutline, SKThumbnail;
[EMAIL PROTECTED] SKPDFView, SKSecondaryPDFView, SKTocOutlineView,
SKNoteOutlineView, SKThumbnailTableView, SKSnapshotTableView, SKSplitView,
BDSKCollapsibleView, BDSKEdgeView, BDSKGradientView, BDSKImagePopUpButton,
SKColorSwatch, SKStatusBar;
[EMAIL PROTECTED] SKPDFView, SKSecondaryPDFView, SKTocOutlineView,
SKNoteOutlineView, SKThumbnailTableView, SKSnapshotTableView, SKSplitView,
BDSKCollapsibleView, BDSKEdgeView, BDSKGradientView, SKColorSwatch, SKStatusBar;
@class SKFullScreenWindow, SKNavigationWindow, SKSideWindow,
SKSnapshotWindowController, SKProgressController, SKPageSheetController,
SKScaleSheetController, SKPasswordSheetController, SKBookmarkSheetController,
SKPrintAccessoryViewController;
@interface SKMainWindowController : NSWindowController {
Modified: trunk/Skim.xcodeproj/project.pbxproj
===================================================================
--- trunk/Skim.xcodeproj/project.pbxproj 2008-02-22 18:20:43 UTC (rev
3429)
+++ trunk/Skim.xcodeproj/project.pbxproj 2008-02-22 23:30:19 UTC (rev
3430)
@@ -223,8 +223,6 @@
F977319F0B939B7D002A7823 /* libbz2.dylib in Frameworks */ =
{isa = PBXBuildFile; fileRef = F977319E0B939B7D002A7823 /* libbz2.dylib */; };
F97751600B37460100DF673B /* ConversionProgressWindow.nib in
Resources */ = {isa = PBXBuildFile; fileRef = F977515E0B37460100DF673B /*
ConversionProgressWindow.nib */; };
F97751630B37461000DF673B /* SKPSProgressController.m in Sources
*/ = {isa = PBXBuildFile; fileRef = F97751620B37461000DF673B /*
SKPSProgressController.m */; };
- F98DC2680BA090D8008E46EC /* BDSKImagePopUpButton.m in Sources
*/ = {isa = PBXBuildFile; fileRef = F98DC2650BA090D8008E46EC /*
BDSKImagePopUpButton.m */; };
- F98DC2690BA090D8008E46EC /* BDSKImagePopUpButtonCell.m in
Sources */ = {isa = PBXBuildFile; fileRef = F98DC2670BA090D8008E46EC /*
BDSKImagePopUpButtonCell.m */; };
F98E24BF0B702D9400914AF0 /* Carbon.framework in Frameworks */ =
{isa = PBXBuildFile; fileRef = F98E24BE0B702D9400914AF0 /* Carbon.framework */;
};
F9CDD67B0B837A7F006363C3 /* SKPreferenceController.m in Sources
*/ = {isa = PBXBuildFile; fileRef = CE4EC4F40B7E24490091F228 /*
SKPreferenceController.m */; };
F9F220890C14BDFF00041284 /* UKFileWatcher.m in Sources */ =
{isa = PBXBuildFile; fileRef = F9F220860C14BDFF00041284 /* UKFileWatcher.m */;
};
@@ -817,10 +815,6 @@
F977515F0B37460100DF673B /* English */ = {isa =
PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path =
English.lproj/ConversionProgressWindow.nib; sourceTree = "<group>"; };
F97751610B37461000DF673B /* SKPSProgressController.h */ = {isa
= PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path
= SKPSProgressController.h; sourceTree = "<group>"; };
F97751620B37461000DF673B /* SKPSProgressController.m */ = {isa
= PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc;
path = SKPSProgressController.m; sourceTree = "<group>"; };
- F98DC2640BA090D8008E46EC /* BDSKImagePopUpButton.h */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path =
BDSKImagePopUpButton.h; sourceTree = "<group>"; };
- F98DC2650BA090D8008E46EC /* BDSKImagePopUpButton.m */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path
= BDSKImagePopUpButton.m; sourceTree = "<group>"; };
- F98DC2660BA090D8008E46EC /* BDSKImagePopUpButtonCell.h */ =
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h;
path = BDSKImagePopUpButtonCell.h; sourceTree = "<group>"; };
- F98DC2670BA090D8008E46EC /* BDSKImagePopUpButtonCell.m */ =
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType =
sourcecode.c.objc; path = BDSKImagePopUpButtonCell.m; sourceTree = "<group>"; };
F98E24BE0B702D9400914AF0 /* Carbon.framework */ = {isa =
PBXFileReference; lastKnownFileType = wrapper.framework; name =
Carbon.framework; path = /System/Library/Frameworks/Carbon.framework;
sourceTree = "<absolute>"; };
F9F220840C14BD9C00041284 /* UKFileWatcher.h */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name =
UKFileWatcher.h; path = vendorsrc/ulikusterer/UKFileWatcher.h; sourceTree =
"<group>"; };
F9F220860C14BDFF00041284 /* UKFileWatcher.m */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name
= UKFileWatcher.m; path = vendorsrc/ulikusterer/UKFileWatcher.m; sourceTree =
"<group>"; };
@@ -1185,10 +1179,6 @@
CE0710160B89BDD600733CC8 /* BDSKEdgeView.m */,
CE20938E0C5F9A8D009D3EFB /* BDSKGradientView.h
*/,
CE20938F0C5F9A8D009D3EFB /* BDSKGradientView.m
*/,
- F98DC2640BA090D8008E46EC /*
BDSKImagePopUpButton.h */,
- F98DC2650BA090D8008E46EC /*
BDSKImagePopUpButton.m */,
- F98DC2660BA090D8008E46EC /*
BDSKImagePopUpButtonCell.h */,
- F98DC2670BA090D8008E46EC /*
BDSKImagePopUpButtonCell.m */,
CE3A41560B790C56006B64D3 /* BDSKDragImageView.h
*/,
CE3A41570B790C56006B64D3 /* BDSKDragImageView.m
*/,
CE2DED6A0B86334900D0DA12 /*
BDSKFindFieldEditor.h */,
@@ -1743,8 +1733,6 @@
CEA575CE0B9206E60003D2E7 /* SKNoteOutlineView.m
in Sources */,
CEA575E50B9207B80003D2E7 /*
SKThumbnailTableView.m in Sources */,
CEA575FD0B9208B60003D2E7 /* SKTocOutlineView.m
in Sources */,
- F98DC2680BA090D8008E46EC /*
BDSKImagePopUpButton.m in Sources */,
- F98DC2690BA090D8008E46EC /*
BDSKImagePopUpButtonCell.m in Sources */,
CE4A659F0BAB1598004AD07D /*
SKBookmarkController.m in Sources */,
CE4A8BA20BB15980004AD07D /*
NSWindowController_SKExtensions.m in Sources */,
CE4294A30BBD29120016FDC2 /* SKReadingBar.m in
Sources */,
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: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit