mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-24 21:16:50 +03:00
Local history view now is responsible for hiding itself after selecting a web page. Also gets redrawn when selecting other pages using the back/forward buttons.
svn path=/trunk/netsurf/; revision=11837
This commit is contained in:
parent
1842be491d
commit
e190188969
@ -46,5 +46,6 @@
|
||||
- (void) addCaretAt: (NSPoint) point height: (CGFloat) height;
|
||||
|
||||
- (void) reformat;
|
||||
- (void) updateHistory;
|
||||
|
||||
@end
|
||||
|
@ -76,6 +76,11 @@ static NSMutableArray *cocoa_reformat_pending = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (void) updateHistory;
|
||||
{
|
||||
[history redraw];
|
||||
}
|
||||
|
||||
static inline NSRect cocoa_get_caret_rect( BrowserView *view )
|
||||
{
|
||||
NSRect caretRect = {
|
||||
@ -413,7 +418,7 @@ static browser_mouse_state cocoa_mouse_flags_for_event( NSEvent *evt )
|
||||
historyVisible = newVisible;
|
||||
|
||||
if (historyVisible) {
|
||||
if (nil == history) history = [[LocalHistoryController alloc] initWithBrowser: browser];
|
||||
if (nil == history) history = [[LocalHistoryController alloc] initWithBrowser: self];
|
||||
[history attachToView: [(BrowserWindowController *)[[self window] windowController] historyButton]];
|
||||
} else {
|
||||
[history detach];
|
||||
|
@ -34,7 +34,6 @@ struct browser_window;
|
||||
NSImage *favicon;
|
||||
BOOL canGoBack;
|
||||
BOOL canGoForward;
|
||||
BOOL navigatedUsingBackForwards;
|
||||
}
|
||||
|
||||
@property (readwrite, assign, nonatomic) struct browser_window *browser;
|
||||
|
@ -97,7 +97,6 @@
|
||||
- (IBAction) goBack: (id) sender;
|
||||
{
|
||||
if (browser && history_back_available( browser->history )) {
|
||||
navigatedUsingBackForwards = YES;
|
||||
history_back(browser, browser->history);
|
||||
[self updateBackForward];
|
||||
}
|
||||
@ -106,7 +105,6 @@
|
||||
- (IBAction) goForward: (id) sender;
|
||||
{
|
||||
if (browser && history_forward_available( browser->history )) {
|
||||
navigatedUsingBackForwards = YES;
|
||||
history_forward(browser, browser->history);
|
||||
[self updateBackForward];
|
||||
}
|
||||
@ -174,14 +172,14 @@ 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 )];
|
||||
}
|
||||
|
||||
- (void) contentUpdated;
|
||||
{
|
||||
if (!navigatedUsingBackForwards) [browserView setHistoryVisible: NO];
|
||||
navigatedUsingBackForwards = NO;
|
||||
[browserView updateHistory];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -19,12 +19,14 @@
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@class HistoryView;
|
||||
@class BrowserView;
|
||||
|
||||
@interface HistoryView : NSView {
|
||||
struct browser_window *browser;
|
||||
BrowserView *browserView;
|
||||
}
|
||||
|
||||
@property (readwrite, assign, nonatomic) struct browser_window *browser;
|
||||
@property (readwrite, assign, nonatomic) BrowserView *browser;
|
||||
|
||||
- (void) updateHistory;
|
||||
- (NSSize) size;
|
||||
|
@ -20,6 +20,8 @@
|
||||
#import "cocoa/font.h"
|
||||
#import "cocoa/coordinates.h"
|
||||
#import "cocoa/plotter.h"
|
||||
#import "cocoa/LocalHistoryController.h"
|
||||
#import "cocoa/BrowserView.h"
|
||||
|
||||
#import "desktop/browser.h"
|
||||
#import "desktop/history_core.h"
|
||||
@ -27,11 +29,12 @@
|
||||
|
||||
@implementation HistoryView
|
||||
|
||||
@synthesize browser;
|
||||
@synthesize browser = browserView;
|
||||
|
||||
- (void) setBrowser: (struct browser_window *) bw;
|
||||
- (void) setBrowser: (BrowserView *) bw;
|
||||
{
|
||||
browser = bw;
|
||||
browserView = bw;
|
||||
browser = [bw browser];
|
||||
[self updateHistory];
|
||||
}
|
||||
|
||||
@ -63,9 +66,11 @@
|
||||
{
|
||||
const NSPoint location = [self convertPoint: [theEvent locationInWindow] fromView: nil];
|
||||
const bool newWindow = [theEvent modifierFlags] & NSCommandKeyMask;
|
||||
history_click( browser, browser->history,
|
||||
cocoa_pt_to_px( location.x ), cocoa_pt_to_px( location.y ),
|
||||
newWindow );
|
||||
if (history_click( browser, browser->history,
|
||||
cocoa_pt_to_px( location.x ), cocoa_pt_to_px( location.y ),
|
||||
newWindow )) {
|
||||
[browserView setHistoryVisible: NO];
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL) isFlipped;
|
||||
|
@ -19,18 +19,20 @@
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@class HistoryView;
|
||||
@class BrowserView;
|
||||
|
||||
@interface LocalHistoryController : NSWindowController {
|
||||
HistoryView *history;
|
||||
struct browser_window *browser;
|
||||
BrowserView *browser;
|
||||
}
|
||||
|
||||
@property (readwrite, assign, nonatomic) struct browser_window *browser;
|
||||
@property (readwrite, assign, nonatomic) BrowserView *browser;
|
||||
@property (readwrite, assign, nonatomic) IBOutlet HistoryView *history;
|
||||
|
||||
- initWithBrowser: (struct browser_window *) bw;
|
||||
- initWithBrowser: (BrowserView *) bw;
|
||||
|
||||
- (void) attachToView: (NSView *) view;
|
||||
- (void) detach;
|
||||
- (void) redraw;
|
||||
|
||||
@end
|
||||
|
@ -26,7 +26,7 @@
|
||||
@synthesize browser;
|
||||
@synthesize history;
|
||||
|
||||
- initWithBrowser: (struct browser_window *) bw;
|
||||
- initWithBrowser: (BrowserView *) bw;
|
||||
{
|
||||
if ((self = [super initWithWindowNibName: @"LocalHistoryPanel"]) == nil) return nil;
|
||||
|
||||
@ -102,4 +102,9 @@
|
||||
[history setBrowser: browser];
|
||||
}
|
||||
|
||||
- (void) redraw;
|
||||
{
|
||||
[history setNeedsDisplay: YES];
|
||||
}
|
||||
|
||||
@end
|
||||
|
Loading…
Reference in New Issue
Block a user