From a38a63a37ef8bdc62661d398fb485296c0bed470 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sat, 15 Feb 2014 18:43:59 +0000 Subject: Make history internal to browser_window module. --- cocoa/BrowserView.m | 1 - cocoa/BrowserViewController.m | 24 ++++++++++++------------ cocoa/HistoryView.m | 17 ++++++++--------- cocoa/NetsurfApp.m | 1 - 4 files changed, 20 insertions(+), 23 deletions(-) (limited to 'cocoa') diff --git a/cocoa/BrowserView.m b/cocoa/BrowserView.m index 092c1bfd0..b0042f760 100644 --- a/cocoa/BrowserView.m +++ b/cocoa/BrowserView.m @@ -24,7 +24,6 @@ #import "cocoa/BrowserWindowController.h" #import "desktop/browser_private.h" -#import "desktop/local_history.h" #import "desktop/plotters.h" #import "desktop/textinput.h" #import "utils/nsoption.h" diff --git a/cocoa/BrowserViewController.m b/cocoa/BrowserViewController.m index 4870446b6..b4e436063 100644 --- a/cocoa/BrowserViewController.m +++ b/cocoa/BrowserViewController.m @@ -21,8 +21,8 @@ #import "cocoa/BrowserWindowController.h" #import "cocoa/fetch.h" +#import "desktop/browser_history.h" #import "desktop/browser_private.h" -#import "desktop/local_history.h" #import "desktop/textinput.h" #import "utils/nsoption.h" @@ -116,16 +116,16 @@ - (IBAction) goBack: (id) sender; { - if (browser && history_back_available( browser->history )) { - history_back(browser->history, false); + if (browser && browser_window_history_back_available( browser )) { + browser_window_history_back(browser, false); [self updateBackForward]; } } - (IBAction) goForward: (id) sender; { - if (browser && history_forward_available( browser->history )) { - history_forward(browser->history, false); + if (browser && browser_window_history_forward_available( browser )) { + browser_window_history_forward(browser, false); [self updateBackForward]; } } @@ -272,8 +272,8 @@ static inline bool compare_float( float a, float b ) - (void) updateBackForward; { [browserView updateHistory]; - [self setCanGoBack: browser != NULL && history_back_available( browser->history )]; - [self setCanGoForward: browser != NULL && history_forward_available( browser->history )]; + [self setCanGoBack: browser != NULL && browser_window_history_back_available( browser )]; + [self setCanGoForward: browser != NULL && browser_window_history_forward_available( browser )]; } - (void) contentUpdated; @@ -287,7 +287,7 @@ struct history_add_menu_item_data { id target; }; -static bool history_add_menu_item_cb( const struct history *history, int x0, int y0, int x1, int y1, +static bool history_add_menu_item_cb( const struct browser_window *bw, int x0, int y0, int x1, int y1, const struct history_entry *page, void *user_data ) { struct history_add_menu_item_data *data = user_data; @@ -305,7 +305,7 @@ static bool history_add_menu_item_cb( const struct history *history, int x0, int ++data->index; [item setTarget: data->target]; - [item setTitle: [NSString stringWithUTF8String: history_entry_get_title( page )]]; + [item setTitle: [NSString stringWithUTF8String: browser_window_history_entry_get_title( page )]]; [item setRepresentedObject: [NSValue valueWithPointer: page]]; return true; @@ -314,7 +314,7 @@ static bool history_add_menu_item_cb( const struct history *history, int x0, int - (IBAction) historyItemSelected: (id) sender; { struct history_entry *entry = [[sender representedObject] pointerValue]; - history_go( browser->history, entry, false ); + browser_window_history_go( browser, entry, false ); [self updateBackForward]; } @@ -325,7 +325,7 @@ static bool history_add_menu_item_cb( const struct history *history, int x0, int .menu = menu, .target = self }; - history_enumerate_back( browser->history, history_add_menu_item_cb, &data ); + browser_window_history_enumerate_back( browser, history_add_menu_item_cb, &data ); while (data.index < [menu numberOfItems]) [menu removeItemAtIndex: data.index]; } @@ -336,7 +336,7 @@ static bool history_add_menu_item_cb( const struct history *history, int x0, int .menu = menu, .target = self }; - history_enumerate_forward( browser->history, history_add_menu_item_cb, &data ); + browser_window_history_enumerate_forward( browser, history_add_menu_item_cb, &data ); while (data.index < [menu numberOfItems]) [menu removeItemAtIndex: data.index]; } diff --git a/cocoa/HistoryView.m b/cocoa/HistoryView.m index c7181650b..7b192336e 100644 --- a/cocoa/HistoryView.m +++ b/cocoa/HistoryView.m @@ -23,8 +23,7 @@ #import "cocoa/LocalHistoryController.h" #import "cocoa/BrowserView.h" -#import "desktop/browser_private.h" -#import "desktop/local_history.h" +#import "desktop/browser_history.h" #import "desktop/plotters.h" @implementation HistoryView @@ -41,7 +40,7 @@ - (NSSize) size; { int width, height; - history_size( browser->history, &width, &height ); + browser_window_history_size( browser, &width, &height ); return cocoa_size( width, height ); } @@ -65,14 +64,14 @@ cocoa_set_clip( rect ); - history_redraw( browser->history, &ctx ); + browser_window_history_redraw( browser, &ctx ); } - (void) mouseUp: (NSEvent *)theEvent; { const NSPoint location = [self convertPoint: [theEvent locationInWindow] fromView: nil]; const bool newWindow = [theEvent modifierFlags] & NSCommandKeyMask; - if (history_click( browser->history, + if (browser_window_history_click( browser, cocoa_pt_to_px( location.x ), cocoa_pt_to_px( location.y ), newWindow )) { [browserView setHistoryVisible: NO]; @@ -94,7 +93,7 @@ [[NSCursor arrowCursor] set]; } -static bool cursor_rects_cb( const struct history *history, int x0, int y0, int x1, int y1, +static bool cursor_rects_cb( const struct browser_window *bw, int x0, int y0, int x1, int y1, const struct history_entry *page, void *user_data ) { HistoryView *view = user_data; @@ -102,8 +101,8 @@ static bool cursor_rects_cb( const struct history *history, int x0, int y0, int NSRect rect = NSIntersectionRect( [view visibleRect], cocoa_rect( x0, y0, x1, y1 ) ); if (!NSIsEmptyRect( rect )) { - NSString *toolTip = [NSString stringWithFormat: @"%s\n%s", history_entry_get_title(page), - history_entry_get_url( page )]; + NSString *toolTip = [NSString stringWithFormat: @"%s\n%s", browser_window_history_entry_get_title(page), + browser_window_history_entry_get_url( page )]; [view addToolTipRect: rect owner: toolTip userData: nil]; NSTrackingArea *area = [[NSTrackingArea alloc] initWithRect: rect @@ -138,7 +137,7 @@ static bool cursor_rects_cb( const struct history *history, int x0, int y0, int [self removeTrackingArea: area]; } - history_enumerate( browser->history, cursor_rects_cb, self ); + browser_window_history_enumerate( browser, cursor_rects_cb, self ); [super updateTrackingAreas]; } diff --git a/cocoa/NetsurfApp.m b/cocoa/NetsurfApp.m index 88424220d..a1f1564ee 100644 --- a/cocoa/NetsurfApp.m +++ b/cocoa/NetsurfApp.m @@ -28,7 +28,6 @@ #import "content/urldb.h" #import "css/utils.h" #import "desktop/gui.h" -#import "desktop/local_history.h" #import "desktop/mouse.h" #import "desktop/netsurf.h" #import "utils/nsoption.h" -- cgit v1.2.3