add a QuickLook button to the toolbar
This commit is contained in:
parent
958f2447da
commit
4b4347a675
|
@ -257,6 +257,7 @@ typedef enum
|
||||||
|
|
||||||
- (NSArray *) quickLookURLs;
|
- (NSArray *) quickLookURLs;
|
||||||
- (NSRect) quickLookFrameWithURL: (NSURL*) url;
|
- (NSRect) quickLookFrameWithURL: (NSURL*) url;
|
||||||
|
- (void) toggleQuickLook;
|
||||||
|
|
||||||
- (void) linkHomepage: (id) sender;
|
- (void) linkHomepage: (id) sender;
|
||||||
- (void) linkForums: (id) sender;
|
- (void) linkForums: (id) sender;
|
||||||
|
|
|
@ -60,6 +60,7 @@
|
||||||
#define TOOLBAR_RESUME_SELECTED @"Toolbar Resume Selected"
|
#define TOOLBAR_RESUME_SELECTED @"Toolbar Resume Selected"
|
||||||
#define TOOLBAR_PAUSE_RESUME_SELECTED @"Toolbar Pause / Resume Selected"
|
#define TOOLBAR_PAUSE_RESUME_SELECTED @"Toolbar Pause / Resume Selected"
|
||||||
#define TOOLBAR_FILTER @"Toolbar Toggle Filter"
|
#define TOOLBAR_FILTER @"Toolbar Toggle Filter"
|
||||||
|
#define TOOLBAR_QUICKLOOK @"Toolbar QuickLook"
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
|
@ -3266,6 +3267,19 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
else if ([ident isEqualToString: TOOLBAR_QUICKLOOK])
|
||||||
|
{
|
||||||
|
ButtonToolbarItem * item = [self standardToolbarButtonWithIdentifier: ident];
|
||||||
|
|
||||||
|
[item setLabel: NSLocalizedString(@"QuickLook", "QuickLook toolbar item -> label")];
|
||||||
|
[item setPaletteLabel: NSLocalizedString(@"Quick Look", "QuickLook toolbar item -> palette label")];
|
||||||
|
[item setToolTip: NSLocalizedString(@"Quick Look", "QuickLook toolbar item -> tooltip")];
|
||||||
|
[item setImage: [NSImage imageNamed: NSImageNameQuickLookTemplate]];
|
||||||
|
[item setTarget: self];
|
||||||
|
[item setAction: @selector(toggleQuickLook)];
|
||||||
|
|
||||||
|
return item;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
@ -3302,24 +3316,43 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
||||||
|
|
||||||
- (NSArray *) toolbarAllowedItemIdentifiers: (NSToolbar *) toolbar
|
- (NSArray *) toolbarAllowedItemIdentifiers: (NSToolbar *) toolbar
|
||||||
{
|
{
|
||||||
return [NSArray arrayWithObjects:
|
NSMutableArray * idents = [NSMutableArray arrayWithObjects:
|
||||||
TOOLBAR_CREATE, TOOLBAR_OPEN_FILE, TOOLBAR_OPEN_WEB,
|
TOOLBAR_CREATE, TOOLBAR_OPEN_FILE, TOOLBAR_OPEN_WEB,
|
||||||
TOOLBAR_REMOVE, TOOLBAR_PAUSE_RESUME_SELECTED, TOOLBAR_PAUSE_RESUME_ALL,
|
TOOLBAR_REMOVE, TOOLBAR_PAUSE_RESUME_SELECTED, TOOLBAR_PAUSE_RESUME_ALL,
|
||||||
TOOLBAR_FILTER, TOOLBAR_INFO,
|
TOOLBAR_FILTER, TOOLBAR_INFO,
|
||||||
NSToolbarSeparatorItemIdentifier,
|
NSToolbarSeparatorItemIdentifier,
|
||||||
NSToolbarSpaceItemIdentifier,
|
NSToolbarSpaceItemIdentifier,
|
||||||
NSToolbarFlexibleSpaceItemIdentifier,
|
NSToolbarFlexibleSpaceItemIdentifier,
|
||||||
NSToolbarCustomizeToolbarItemIdentifier, nil];
|
NSToolbarCustomizeToolbarItemIdentifier, nil];
|
||||||
|
|
||||||
|
//allow quicklook on leopard
|
||||||
|
if ([NSApp isOnLeopardOrBetter])
|
||||||
|
[idents insertObject: TOOLBAR_QUICKLOOK atIndex: 6];
|
||||||
|
|
||||||
|
return idents;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray *) toolbarDefaultItemIdentifiers: (NSToolbar *) toolbar
|
- (NSArray *) toolbarDefaultItemIdentifiers: (NSToolbar *) toolbar
|
||||||
{
|
{
|
||||||
return [NSArray arrayWithObjects:
|
//has quicklook on leopard
|
||||||
TOOLBAR_CREATE, TOOLBAR_OPEN_FILE, TOOLBAR_REMOVE,
|
if ([NSApp isOnLeopardOrBetter])
|
||||||
NSToolbarSeparatorItemIdentifier,
|
{
|
||||||
TOOLBAR_PAUSE_RESUME_ALL,
|
return [NSArray arrayWithObjects:
|
||||||
NSToolbarFlexibleSpaceItemIdentifier,
|
TOOLBAR_CREATE, TOOLBAR_OPEN_FILE, TOOLBAR_REMOVE,
|
||||||
TOOLBAR_FILTER, TOOLBAR_INFO, nil];
|
NSToolbarSeparatorItemIdentifier,
|
||||||
|
TOOLBAR_PAUSE_RESUME_ALL,
|
||||||
|
NSToolbarFlexibleSpaceItemIdentifier,
|
||||||
|
TOOLBAR_QUICKLOOK, TOOLBAR_FILTER, TOOLBAR_INFO, nil];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return [NSArray arrayWithObjects:
|
||||||
|
TOOLBAR_CREATE, TOOLBAR_OPEN_FILE, TOOLBAR_REMOVE,
|
||||||
|
NSToolbarSeparatorItemIdentifier,
|
||||||
|
TOOLBAR_PAUSE_RESUME_ALL,
|
||||||
|
NSToolbarFlexibleSpaceItemIdentifier,
|
||||||
|
TOOLBAR_FILTER, TOOLBAR_INFO, nil];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) validateToolbarItem: (NSToolbarItem *) toolbarItem
|
- (BOOL) validateToolbarItem: (NSToolbarItem *) toolbarItem
|
||||||
|
@ -4057,6 +4090,12 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
||||||
return NSZeroRect;
|
return NSZeroRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#warning move to QuickLookController?
|
||||||
|
- (void) toggleQuickLook
|
||||||
|
{
|
||||||
|
[[QuickLookController quickLook] toggleQuickLook];
|
||||||
|
}
|
||||||
|
|
||||||
- (void) linkHomepage: (id) sender
|
- (void) linkHomepage: (id) sender
|
||||||
{
|
{
|
||||||
[[NSWorkspace sharedWorkspace] openURL: [NSURL URLWithString: WEBSITE_URL]];
|
[[NSWorkspace sharedWorkspace] openURL: [NSURL URLWithString: WEBSITE_URL]];
|
||||||
|
|
Loading…
Reference in New Issue