From 84b4a01f4f2032a17e5dc93e4b4f1f37a71ab04c Mon Sep 17 00:00:00 2001 From: Sven Weidauer Date: Tue, 1 Feb 2011 08:39:35 +0000 Subject: Implemented global history window using new Tree class. svn path=/trunk/netsurf/; revision=11578 --- cocoa/HistoryWindowController.h | 31 +++ cocoa/HistoryWindowController.m | 54 +++++ cocoa/Makefile.target | 4 +- cocoa/NetSurf.xcodeproj/project.pbxproj | 6 + cocoa/NetSurfAppDelegate.h | 6 +- cocoa/NetSurfAppDelegate.m | 16 +- cocoa/res/HistoryWindow.xib | 338 ++++++++++++++++++++++++++++++++ cocoa/res/MainMenu.xib | 206 +++---------------- 8 files changed, 471 insertions(+), 190 deletions(-) create mode 100644 cocoa/HistoryWindowController.h create mode 100644 cocoa/HistoryWindowController.m create mode 100644 cocoa/res/HistoryWindow.xib (limited to 'cocoa') diff --git a/cocoa/HistoryWindowController.h b/cocoa/HistoryWindowController.h new file mode 100644 index 000000000..b590dfe1d --- /dev/null +++ b/cocoa/HistoryWindowController.h @@ -0,0 +1,31 @@ +/* + * Copyright 2011 Sven Weidauer + * + * This file is part of NetSurf, http://www.netsurf-browser.org/ + * + * NetSurf is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * NetSurf is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#import + +@class Tree; +@class TreeView; + +@interface HistoryWindowController : NSWindowController { + Tree *tree; + TreeView *view; +} + +@property (readwrite, retain, nonatomic) IBOutlet TreeView *view; + +@end diff --git a/cocoa/HistoryWindowController.m b/cocoa/HistoryWindowController.m new file mode 100644 index 000000000..438551bca --- /dev/null +++ b/cocoa/HistoryWindowController.m @@ -0,0 +1,54 @@ +/* + * Copyright 2011 Sven Weidauer + * + * This file is part of NetSurf, http://www.netsurf-browser.org/ + * + * NetSurf is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * NetSurf is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#import "cocoa/HistoryWindowController.h" +#import "cocoa/Tree.h" +#import "cocoa/TreeView.h" + +#import "desktop/history_global_core.h" + +@implementation HistoryWindowController + +@synthesize view; + +- init; +{ + if ((self = [super initWithWindowNibName: @"HistoryWindow"]) == nil) return nil; + + tree = [[Tree alloc] initWithFlags: history_global_get_tree_flags()]; + history_global_initialise( [tree tree], "" ); + + return self; +} + +- (void) dealloc; +{ + history_global_cleanup(); + [tree release]; + [self setView: nil]; + + [super dealloc]; +} + +- (void)awakeFromNib; +{ + [view setTree: tree]; + [[self window] setExcludedFromWindowsMenu: YES]; +} + +@end diff --git a/cocoa/Makefile.target b/cocoa/Makefile.target index 2c429f3f6..b281cc44c 100644 --- a/cocoa/Makefile.target +++ b/cocoa/Makefile.target @@ -77,6 +77,7 @@ S_COCOA := \ Tree.m \ TreeView.m \ HistoryView.m \ + HistoryWindowController.m \ FormSelectMenu.m \ bitmap.m \ fetch.m \ @@ -116,7 +117,8 @@ SOURCES := $(addprefix $(shell pwd)/,$(SOURCES)) EXETARGET := NetSurf -S_XIBS := MainMenu.xib Browser.xib BrowserWindow.xib DownloadWindow.xib SearchWindow.xib PreferencesWindow.xib +S_XIBS := MainMenu.xib Browser.xib BrowserWindow.xib DownloadWindow.xib SearchWindow.xib PreferencesWindow.xib \ + HistoryWindow.xib R_RESOURCES := default.css adblock.css quirks.css NetSurf.icns R_RESOURCES := $(addprefix cocoa/res/,$(R_RESOURCES)) diff --git a/cocoa/NetSurf.xcodeproj/project.pbxproj b/cocoa/NetSurf.xcodeproj/project.pbxproj index b15887b9f..7b799fd77 100644 --- a/cocoa/NetSurf.xcodeproj/project.pbxproj +++ b/cocoa/NetSurf.xcodeproj/project.pbxproj @@ -186,6 +186,9 @@ 263629CA12F69B120048542C /* system_colour.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = system_colour.m; sourceTree = ""; }; 263769A912F7EBE2000F45FE /* Tree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Tree.h; sourceTree = ""; }; 263769AA12F7EBE2000F45FE /* Tree.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Tree.m; sourceTree = ""; }; + 26376A4112F7FA67000F45FE /* HistoryWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = HistoryWindow.xib; sourceTree = ""; }; + 26376A4312F7FA86000F45FE /* HistoryWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HistoryWindowController.h; sourceTree = ""; }; + 26376A4412F7FA86000F45FE /* HistoryWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HistoryWindowController.m; sourceTree = ""; }; 2639E20512F2ADEE00699678 /* coordinates.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = coordinates.h; sourceTree = ""; }; 264C344112F0987E00D11246 /* gui.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gui.h; sourceTree = ""; }; 265F30A712D6637E0048B600 /* NetSurf-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "NetSurf-Info.plist"; sourceTree = ""; }; @@ -546,6 +549,8 @@ 265F30AB12D6637E0048B600 /* Prefix.pch */, 2625095112F72AA70090D236 /* PreferencesWindowController.h */, 2625095212F72AA70090D236 /* PreferencesWindowController.m */, + 26376A4312F7FA86000F45FE /* HistoryWindowController.h */, + 26376A4412F7FA86000F45FE /* HistoryWindowController.m */, ); name = "Cocoa Frontend"; sourceTree = ""; @@ -565,6 +570,7 @@ 26CDCFF212E70AD1004FC66B /* BrowserWindow.xib */, 2666DC5B12F6D1770045E8B6 /* SearchWindow.xib */, 2625095012F72A8F0090D236 /* PreferencesWindow.xib */, + 26376A4112F7FA67000F45FE /* HistoryWindow.xib */, ); name = Resources; path = res; diff --git a/cocoa/NetSurfAppDelegate.h b/cocoa/NetSurfAppDelegate.h index b4ea15e8f..a22c4ceee 100644 --- a/cocoa/NetSurfAppDelegate.h +++ b/cocoa/NetSurfAppDelegate.h @@ -20,21 +20,23 @@ @class SearchWindowController; @class PreferencesWindowController; +@class HistoryWindowController; @interface NetSurfAppDelegate : NSObject { - NSWindow *historyWindow; SearchWindowController *search; PreferencesWindowController *preferences; + HistoryWindowController *history; } -@property (readwrite, retain, nonatomic) IBOutlet NSWindow *historyWindow; @property (readwrite, retain, nonatomic) SearchWindowController *search; @property (readwrite, retain, nonatomic) PreferencesWindowController *preferences; +@property (readwrite, retain, nonatomic) HistoryWindowController *history; - (IBAction) showSearchWindow: (id) sender; - (IBAction) searchForward: (id) sender; - (IBAction) searchBackward: (id) sender; - (IBAction) showPreferences: (id) sender; +- (IBAction) showGlobalHistory: (id) sender; @end diff --git a/cocoa/NetSurfAppDelegate.m b/cocoa/NetSurfAppDelegate.m index b37ff9a9b..2d15d05a3 100644 --- a/cocoa/NetSurfAppDelegate.m +++ b/cocoa/NetSurfAppDelegate.m @@ -19,6 +19,7 @@ #import "cocoa/NetSurfAppDelegate.h" #import "cocoa/SearchWindowController.h" #import "cocoa/PreferencesWindowController.h" +#import "cocoa/HistoryWindowController.h" #import "desktop/browser.h" #import "desktop/options.h" @@ -32,7 +33,7 @@ @implementation NetSurfAppDelegate -@synthesize historyWindow; +@synthesize history; @synthesize search; @synthesize preferences; @@ -58,11 +59,6 @@ browser_window_create( [urlAsString UTF8String], NULL, NULL, true, false ); } -- (void) awakeFromNib; -{ - [historyWindow setExcludedFromWindowsMenu: YES]; -} - - (IBAction) showSearchWindow: (id) sender; { if (search == nil) { @@ -102,6 +98,14 @@ [preferences showWindow: sender]; } +- (IBAction) showGlobalHistory: (id) sender; +{ + if (history == nil) { + [self setHistory: [[[HistoryWindowController alloc] init] autorelease]]; + } + [history showWindow: sender]; +} + // Application delegate methods - (BOOL) applicationOpenUntitledFile: (NSApplication *)sender; diff --git a/cocoa/res/HistoryWindow.xib b/cocoa/res/HistoryWindow.xib new file mode 100644 index 000000000..a5ec90e1a --- /dev/null +++ b/cocoa/res/HistoryWindow.xib @@ -0,0 +1,338 @@ + + + + 1060 + 10J567 + 804 + 1038.35 + 462.00 + + com.apple.InterfaceBuilder.CocoaPlugin + 804 + + + YES + + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + YES + + + YES + + + + YES + + HistoryWindowController + + + FirstResponder + + + NSApplication + + + 15 + 2 + {{196, 112}, {327, 398}} + 1618477056 + History + NSWindow + + {1.79769e+308, 1.79769e+308} + + + 256 + + YES + + + 274 + + YES + + + 2304 + + YES + + + 274 + {312, 383} + + TreeView + + + {{1, 1}, {312, 383}} + + + + + 6 + System + controlColor + + 3 + MC42NjY2NjY2NjY3AA + + + 4 + + + + 256 + {{313, 1}, {15, 383}} + + + _doScroller: + 1 + 0.96363627910614014 + + + + 256 + {{1, 384}, {312, 15}} + + 1 + + _doScroller: + 0.50602412223815918 + + + {{-1, -1}, {329, 400}} + + + 50 + + + + + + {327, 398} + + + {{0, 0}, {1680, 1028}} + {1.79769e+308, 1.79769e+308} + + + + + YES + + + window + + + + 3 + + + + view + + + + 8 + + + + + YES + + 0 + + + + + + -2 + + + File's Owner + + + -1 + + + First Responder + + + -3 + + + Application + + + 1 + + + YES + + + + + + 2 + + + YES + + + + + + 4 + + + YES + + + + + + + + 5 + + + + + 6 + + + + + 7 + + + + + + + YES + + YES + 1.IBEditorWindowLastContentRect + 1.IBPluginDependency + 1.IBWindowTemplateEditedContentRect + 1.NSWindowTemplate.visibleAtLaunch + 1.WindowOrigin + 1.editorWindowContentRectSynchronizationRect + 2.IBPluginDependency + 4.IBPluginDependency + 5.IBPluginDependency + 6.IBPluginDependency + 7.IBPluginDependency + + + YES + {{361, 416}, {327, 398}} + com.apple.InterfaceBuilder.CocoaPlugin + {{361, 416}, {327, 398}} + + {196, 240} + {{202, 428}, {480, 270}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + + YES + + + YES + + + + + YES + + + YES + + + + 8 + + + + YES + + HistoryWindowController + NSWindowController + + view + TreeView + + + view + + view + TreeView + + + + IBProjectSource + HistoryWindowController.h + + + + NSApplication + + IBProjectSource + PSMTabBarControl/PSMTabDragAssistant.h + + + + NSObject + + IBProjectSource + PSMTabBarControl/PSMTabBarCell.h + + + + NSObject + + IBProjectSource + PSMTabBarControl/PSMTabBarControl.h + + + + ScrollableView + NSView + + IBProjectSource + ScrollableView.h + + + + TreeView + ScrollableView + + IBProjectSource + TreeView.h + + + + + 0 + IBCocoaFramework + + com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 + + + YES + ../NetSurf.xcodeproj + 3 + + diff --git a/cocoa/res/MainMenu.xib b/cocoa/res/MainMenu.xib index 7ca05ec2b..028a970a5 100644 --- a/cocoa/res/MainMenu.xib +++ b/cocoa/res/MainMenu.xib @@ -12,7 +12,7 @@ YES - + YES @@ -643,87 +643,6 @@ _NSMainMenu - - 15 - 2 - {{196, 123}, {300, 387}} - 1685585920 - History - NSWindow - - {1.79769e+308, 1.79769e+308} - - - 256 - - YES - - - 274 - - YES - - - 2304 - - YES - - - 268 - {300, 387} - - TreeView - - - {{1, 1}, {300, 387}} - - - - - 6 - System - controlColor - - 3 - MC42NjY2NjY2NjY3AA - - - 4 - - - - -2147483392 - {{319, 1}, {15, 371}} - - - _doScroller: - 0.99741602067183466 - - - - -2147483392 - {{1, 373}, {500, 15}} - - 1 - - _doScroller: - 1 - - - {{-1, -1}, {302, 389}} - - - 562 - - - - - - {300, 387} - - {{0, 0}, {1680, 1028}} - {1.79769e+308, 1.79769e+308} - NetSurfAppDelegate @@ -915,14 +834,6 @@ 759 - - - makeKeyAndOrderFront: - - - - 819 - delegate @@ -931,14 +842,6 @@ 821 - - - historyWindow - - - - 822 - newDocument: @@ -1043,6 +946,14 @@ 845 + + + showGlobalHistory: + + + + 846 + @@ -1490,50 +1401,6 @@ - - 811 - - - YES - - - - - - 812 - - - YES - - - - - - 813 - - - YES - - - - - - - - 814 - - - - - 815 - - - - - 816 - - - 817 @@ -1701,15 +1568,6 @@ 81.IBPluginDependency 81.ImportedFromIB2 81.editorWindowContentRectSynchronizationRect - 811.IBEditorWindowLastContentRect - 811.IBPluginDependency - 811.IBWindowTemplateEditedContentRect - 811.NSWindowTemplate.visibleAtLaunch - 812.IBPluginDependency - 813.IBPluginDependency - 814.IBPluginDependency - 815.IBPluginDependency - 816.IBPluginDependency 817.IBPluginDependency 818.IBPluginDependency 82.IBPluginDependency @@ -1769,7 +1627,7 @@ com.apple.InterfaceBuilder.CocoaPlugin - {{810, 694}, {194, 103}} + {{876, 712}, {194, 103}} com.apple.InterfaceBuilder.CocoaPlugin {{525, 802}, {197, 73}} @@ -1836,15 +1694,6 @@ com.apple.InterfaceBuilder.CocoaPlugin {{323, 672}, {199, 203}} - {{331, 320}, {300, 387}} - com.apple.InterfaceBuilder.CocoaPlugin - {{331, 320}, {300, 387}} - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -1880,7 +1729,7 @@ - 845 + 846 @@ -1903,6 +1752,7 @@ backForwardSelected: goBack: goForward: + goHome: navigate: reloadPage: stopLoading: @@ -1921,6 +1771,7 @@ id id id + id @@ -1930,6 +1781,7 @@ backForwardSelected: goBack: goForward: + goHome: navigate: reloadPage: stopLoading: @@ -1951,6 +1803,10 @@ goForward: id + + goHome: + id + navigate: id @@ -2116,6 +1972,7 @@ YES searchBackward: searchForward: + showGlobalHistory: showPreferences: showSearchWindow: @@ -2125,6 +1982,7 @@ id id id + id @@ -2133,6 +1991,7 @@ YES searchBackward: searchForward: + showGlobalHistory: showPreferences: showSearchWindow: @@ -2146,6 +2005,10 @@ searchForward: id + + showGlobalHistory: + id + showPreferences: id @@ -2156,17 +2019,6 @@ - - historyWindow - NSWindow - - - historyWindow - - historyWindow - NSWindow - - IBProjectSource NetSurfAppDelegate.h @@ -2293,14 +2145,6 @@ SearchWindowController.h - - TreeView - ScrollableView - - IBProjectSource - TreeView.h - - URLFieldCell NSTextFieldCell -- cgit v1.2.3