diff options
author | Sven Weidauer <sven@5sw.de> | 2017-06-05 11:20:56 +0200 |
---|---|---|
committer | Sven Weidauer <sven@5sw.de> | 2017-06-05 11:20:56 +0200 |
commit | 2ba97ae0dbd01a4f46c543ae025249e5349e0585 (patch) | |
tree | 5028ee570078f80f98049bd5a68b209ecfdaca59 /frontends/cocoa/SearchWindowController.m | |
parent | 3ee40a10b123c36be3e29602767840a7a71aaafa (diff) | |
download | netsurf-2ba97ae0dbd01a4f46c543ae025249e5349e0585.tar.gz netsurf-2ba97ae0dbd01a4f46c543ae025249e5349e0585.tar.bz2 |
Reformat code using clang-format.
Diffstat (limited to 'frontends/cocoa/SearchWindowController.m')
-rw-r--r-- | frontends/cocoa/SearchWindowController.m | 94 |
1 files changed, 48 insertions, 46 deletions
diff --git a/frontends/cocoa/SearchWindowController.m b/frontends/cocoa/SearchWindowController.m index bbde827bf..5dccc5950 100644 --- a/frontends/cocoa/SearchWindowController.m +++ b/frontends/cocoa/SearchWindowController.m @@ -16,7 +16,6 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - #import "cocoa/SearchWindowController.h" #import "cocoa/BrowserViewController.h" @@ -24,12 +23,12 @@ #import "netsurf/browser_window.h" #import "desktop/search.h" -static void cocoa_search_set_back( bool active, void *p ); -static void cocoa_search_set_forward( bool active, void *p ); +static void cocoa_search_set_back(bool active, void *p); +static void cocoa_search_set_forward(bool active, void *p); static struct gui_search_table search_table = { - .forward_state = cocoa_search_set_forward, - .back_state = cocoa_search_set_back, + .forward_state = cocoa_search_set_forward, + .back_state = cocoa_search_set_back, }; struct gui_search_table *cocoa_search_table = &search_table; @@ -45,74 +44,77 @@ struct gui_search_table *cocoa_search_table = &search_table; - (instancetype)init { - if ((self = [super initWithWindowNibName: @"SearchWindow"]) == nil) return nil; - - [self bind: @"browser" toObject: NSApp withKeyPath: @"frontTab" options: nil]; - canGoBack = canGoForward = YES; - - return self; + if ((self = [super initWithWindowNibName:@"SearchWindow"]) == nil) + return nil; + + [self bind:@"browser" toObject:NSApp withKeyPath:@"frontTab" options:nil]; + canGoBack = canGoForward = YES; + + return self; } -- (void) dealloc +- (void)dealloc { - [self unbind: @"browser"]; + [self unbind:@"browser"]; } -- (IBAction) searchNext: (id) sender +- (IBAction)searchNext:(id)sender { - [self search: SearchForward]; + [self search:SearchForward]; } -- (IBAction) searchPrevious: (id) sender +- (IBAction)searchPrevious:(id)sender { - [self search: SearchBackward]; + [self search:SearchBackward]; } -- (void) search: (SearchDirection)direction +- (void)search:(SearchDirection)direction { - search_flags_t flags = (direction == SearchForward) ? SEARCH_FLAG_FORWARDS : 0; - if (caseSensitive) flags |= SEARCH_FLAG_CASE_SENSITIVE; - if (selectAll) flags |= SEARCH_FLAG_SHOWALL; - - struct browser_window *bw = [browser browser]; - browser_window_search( bw, (__bridge void *)self, flags, [searchString UTF8String] ); + search_flags_t flags = (direction == SearchForward) ? SEARCH_FLAG_FORWARDS : 0; + if (caseSensitive) + flags |= SEARCH_FLAG_CASE_SENSITIVE; + if (selectAll) + flags |= SEARCH_FLAG_SHOWALL; + + struct browser_window *bw = [browser browser]; + browser_window_search(bw, (__bridge void *)self, flags, [searchString UTF8String]); } -- (IBAction) searchStringDidChange: (id) sender +- (IBAction)searchStringDidChange:(id)sender { - struct browser_window *bw = [browser browser]; - browser_window_search_clear( bw ); - - [self setCanGoBack: YES]; - [self setCanGoForward: YES]; + struct browser_window *bw = [browser browser]; + browser_window_search_clear(bw); + + [self setCanGoBack:YES]; + [self setCanGoForward:YES]; } -- (void) setCaseSensitive: (BOOL) newValue +- (void)setCaseSensitive:(BOOL)newValue { - if (caseSensitive != newValue) { - caseSensitive = newValue; - [self setCanGoBack: YES]; - [self setCanGoForward: YES]; - } + if (caseSensitive != newValue) { + caseSensitive = newValue; + [self setCanGoBack:YES]; + [self setCanGoForward:YES]; + } } -- (void) setSelectAll: (BOOL) newValue +- (void)setSelectAll:(BOOL)newValue { - if (selectAll != newValue) { - selectAll = newValue; - [self setCanGoBack: YES]; - [self setCanGoForward: YES]; - } + if (selectAll != newValue) { + selectAll = newValue; + [self setCanGoBack:YES]; + [self setCanGoForward:YES]; + } } -static void cocoa_search_set_back( bool active, void *p ) +static void cocoa_search_set_back(bool active, void *p) { - [(__bridge SearchWindowController *)p setCanGoBack: active]; + [(__bridge SearchWindowController *)p setCanGoBack:active]; } -static void cocoa_search_set_forward( bool active, void *p ) +static void cocoa_search_set_forward(bool active, void *p) { - [(__bridge SearchWindowController *)p setCanGoForward: active]; + [(__bridge SearchWindowController *)p setCanGoForward:active]; } @end |