#792 Allow Option-Command-F to focus the filter field in the main window

This commit is contained in:
Mitchell Livingston 2008-03-16 14:24:27 +00:00
parent c4646711a1
commit a149f8992b
3 changed files with 26 additions and 6 deletions

View File

@ -241,6 +241,7 @@ typedef enum
- (void) showStatusBar: (BOOL) show animate: (BOOL) animate; - (void) showStatusBar: (BOOL) show animate: (BOOL) animate;
- (void) toggleFilterBar: (id) sender; - (void) toggleFilterBar: (id) sender;
- (void) showFilterBar: (BOOL) show animate: (BOOL) animate; - (void) showFilterBar: (BOOL) show animate: (BOOL) animate;
- (void) focusFilterField;
- (void) allToolbarClicked: (id) sender; - (void) allToolbarClicked: (id) sender;
- (void) selectedToolbarClicked: (id) sender; - (void) selectedToolbarClicked: (id) sender;

View File

@ -2796,12 +2796,6 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
[fTableView display]; [fTableView display];
} }
- (void) toggleStatusBar: (id) sender
{
[self showStatusBar: [fStatusBar isHidden] animate: YES];
[fDefaults setBool: ![fStatusBar isHidden] forKey: @"StatusBar"];
}
- (NSRect) windowFrameByAddingHeight: (float) height checkLimits: (BOOL) check - (NSRect) windowFrameByAddingHeight: (float) height checkLimits: (BOOL) check
{ {
NSScrollView * scrollView = [fTableView enclosingScrollView]; NSScrollView * scrollView = [fTableView enclosingScrollView];
@ -2837,6 +2831,13 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
return windowFrame; return windowFrame;
} }
- (void) toggleStatusBar: (id) sender
{
[self showStatusBar: [fStatusBar isHidden] animate: YES];
[fDefaults setBool: ![fStatusBar isHidden] forKey: @"StatusBar"];
}
//doesn't save shown state
- (void) showStatusBar: (BOOL) show animate: (BOOL) animate - (void) showStatusBar: (BOOL) show animate: (BOOL) animate
{ {
if (show != [fStatusBar isHidden]) if (show != [fStatusBar isHidden])
@ -2907,6 +2908,7 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
[fDefaults setBool: ![fFilterBar isHidden] forKey: @"FilterBar"]; [fDefaults setBool: ![fFilterBar isHidden] forKey: @"FilterBar"];
} }
//doesn't save shown state
- (void) showFilterBar: (BOOL) show animate: (BOOL) animate - (void) showFilterBar: (BOOL) show animate: (BOOL) animate
{ {
if (show != [fFilterBar isHidden]) if (show != [fFilterBar isHidden])
@ -2961,6 +2963,13 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
} }
} }
- (void) focusFilterField
{
[fWindow makeFirstResponder: fSearchFilterField];
if ([fFilterBar isHidden])
[self toggleFilterBar: self];
}
- (ButtonToolbarItem *) standardToolbarButtonWithIdentifier: (NSString *) ident - (ButtonToolbarItem *) standardToolbarButtonWithIdentifier: (NSString *) ident
{ {
ButtonToolbarItem * item = [[ButtonToolbarItem alloc] initWithItemIdentifier: ident]; ButtonToolbarItem * item = [[ButtonToolbarItem alloc] initWithItemIdentifier: ident];

View File

@ -507,6 +507,16 @@
[super flagsChanged: event]; [super flagsChanged: event];
} }
//option-command-f will focus the filter bar's search field
- (void) keyDown: (NSEvent *) event
{
if ([[event charactersIgnoringModifiers] isEqualToString: @"f"] && [event modifierFlags] & NSAlternateKeyMask
&& [event modifierFlags] & NSCommandKeyMask)
[fController focusFilterField];
else
[super keyDown: event];
}
- (void) toggleControlForTorrent: (Torrent *) torrent - (void) toggleControlForTorrent: (Torrent *) torrent
{ {
if ([torrent isActive]) if ([torrent isActive])