From 4a534759b6fac7c69d2723ea25d0c9943e200cba Mon Sep 17 00:00:00 2001 From: anthony Date: Tue, 30 Mar 2021 21:01:05 +0100 Subject: [PATCH] Open the website when it's suggested entry is clicked, begin hooking the suggestion control up to keyboard events@ --- frontends/gnustep/BrowserWindowController.m | 3 ++- frontends/gnustep/Makefile | 1 + frontends/gnustep/NotifyingTextField.h | 12 ++++++++++ frontends/gnustep/NotifyingTextField.m | 21 ++++++++++++++++++ frontends/gnustep/UrlSuggestionView.h | 6 ++++- frontends/gnustep/UrlSuggestionView.m | 5 ++++- .../gnustep/res/Browser.gorm/data.classes | 7 ++++++ .../gnustep/res/Browser.gorm/objects.gorm | Bin 5473 -> 5021 bytes 8 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 frontends/gnustep/NotifyingTextField.h create mode 100644 frontends/gnustep/NotifyingTextField.m diff --git a/frontends/gnustep/BrowserWindowController.m b/frontends/gnustep/BrowserWindowController.m index 4d4c381c0..0eaaa48d6 100644 --- a/frontends/gnustep/BrowserWindowController.m +++ b/frontends/gnustep/BrowserWindowController.m @@ -94,7 +94,8 @@ static id newTabTarget; selector: @selector(onPreferencesUpdated:) name: PreferencesUpdatedNotificationName object: nil]; - urlSuggestionView = [[UrlSuggestionView alloc] initForUrlBar: urlBar]; + urlSuggestionView = [[UrlSuggestionView alloc] initForUrlBar: urlBar + inBrowserWindowController: self]; NSLog(@"Browser window loaded"); } diff --git a/frontends/gnustep/Makefile b/frontends/gnustep/Makefile index 20fd41653..73a37241e 100644 --- a/frontends/gnustep/Makefile +++ b/frontends/gnustep/Makefile @@ -57,6 +57,7 @@ S_FRONTEND := \ PreferencesWindowController.m \ VerticalTabsView.m \ UrlSuggestionView.m \ + NotifyingTextField.m \ Website.m \ BookmarkFolder.m \ SearchProvider.m \ diff --git a/frontends/gnustep/NotifyingTextField.h b/frontends/gnustep/NotifyingTextField.h new file mode 100644 index 000000000..c82365be3 --- /dev/null +++ b/frontends/gnustep/NotifyingTextField.h @@ -0,0 +1,12 @@ +#import + +// TODO: Are these defined anywhere in GNUStep? +#define KEY_UP 98 +#define KEY_DOWN 104 +#define SpecialKeyPressedNotification @"SpecialKeyPressed" + +@interface NotifyingTextField: NSTextField { + +} + +@end diff --git a/frontends/gnustep/NotifyingTextField.m b/frontends/gnustep/NotifyingTextField.m new file mode 100644 index 000000000..fd72441ba --- /dev/null +++ b/frontends/gnustep/NotifyingTextField.m @@ -0,0 +1,21 @@ +#import +#import "NotifyingTextField.h" + + + +@implementation NotifyingTextField + +-(void)keyUp: (NSEvent*)theEvent { + [super keyUp: theEvent]; + NSLog(@"code: %d", [theEvent keyCode]); + switch ([theEvent keyCode]) { + case KEY_UP: + + case KEY_DOWN: + + defualt: + break; + } +} + +@end diff --git a/frontends/gnustep/UrlSuggestionView.h b/frontends/gnustep/UrlSuggestionView.h index 2846ac259..d7828f609 100644 --- a/frontends/gnustep/UrlSuggestionView.h +++ b/frontends/gnustep/UrlSuggestionView.h @@ -1,5 +1,6 @@ #import +@class BrowserWindowController; @class UrlSuggestionView; @protocol UrlSuggestionViewDelegate @@ -7,7 +8,10 @@ @end @interface UrlSuggestionView: NSScrollView { + // Not Retained id urlBar; + id browserWindowController; + BOOL isActive; NSTableView *tableView; NSArray *recentWebsites; @@ -15,7 +19,7 @@ NSString *previousQuery; } --(id)initForUrlBar: (NSTextField*)aUrlBar; +-(id)initForUrlBar: (NSTextField*)aUrlBar inBrowserWindowController: (BrowserWindowController*)aBrowserWindowController; -(void)dismiss; @end diff --git a/frontends/gnustep/UrlSuggestionView.m b/frontends/gnustep/UrlSuggestionView.m index 3c72e0dbe..03b9dedc8 100644 --- a/frontends/gnustep/UrlSuggestionView.m +++ b/frontends/gnustep/UrlSuggestionView.m @@ -1,5 +1,6 @@ #import #import "UrlSuggestionView.h" +#import "BrowserWindowController.h" #import "Preferences.h" #define ENTRY_HEIGHT 25 @@ -14,9 +15,10 @@ @implementation UrlSuggestionView --(id)initForUrlBar: (NSTextField*)aUrlBar { +-(id)initForUrlBar: (NSTextField*)aUrlBar inBrowserWindowController: (BrowserWindowController*)aBrowserWindowController { if ((self = [super init])) { urlBar = aUrlBar; + browserWindowController = aBrowserWindowController; NSRect frame = [aUrlBar frame]; frame.size.height = 0; [self setFrame: frame]; @@ -160,6 +162,7 @@ Website *selectedWebsite = [filteredWebsites objectAtIndex: row]; [urlBar setStringValue: [selectedWebsite url]]; [self updateQuery: @""]; + [browserWindowController openWebsite: selectedWebsite]; NSLog(@"Selection changed"); } diff --git a/frontends/gnustep/res/Browser.gorm/data.classes b/frontends/gnustep/res/Browser.gorm/data.classes index 3f717a23f..54504a408 100644 --- a/frontends/gnustep/res/Browser.gorm/data.classes +++ b/frontends/gnustep/res/Browser.gorm/data.classes @@ -33,6 +33,13 @@ ); Super = NSObject; }; + NotifyingTextField = { + Actions = ( + ); + Outlets = ( + ); + Super = NSTextField; + }; PlotView = { Actions = ( ); diff --git a/frontends/gnustep/res/Browser.gorm/objects.gorm b/frontends/gnustep/res/Browser.gorm/objects.gorm index 7107b25320854b3006475f2e259beb43353f2efe..da3aa435fb495288459d60493577580c07dee350 100644 GIT binary patch literal 5021 zcmdT|TX);W5ne*1C<(e>ZOa#>zDZ5$%-T-kD2XLrLdms6Mxqs`*94LvnK48#AQVQq zDwj4%A9`^7OThO&=&=v|0e$Z259lB0Ii1-7Kv0yN_@y}!k8lRNA9iNGnVlVAskl*h z&DxCNY(1)cXac~_?VGn@9tHfn847odU<7a^AroS7sa&jV=Ip9#RH~*UgwUiWdWz-J z=KJQBi}yl+Cc8v`vAnwP8k?3`Hr239id3;2+=y$4OF)-QiQ%R4!%B7AZagseYL?-e zG$Xr7Q_eE#^>V|g)s!Y&IVsbmtn50K>MjA*LOoYe?3=(#Pf`>`Sv(XKQ5D<577f`$ z53mLVbjedQeQX}LeC5fF{$U54uzf{I1;lsH*_5@+N7TQ zHx1r85|EO8qPtjryJ9wQ>IasEa93(cP zTSO(~kmxOjOVU7#p4@$OBA+69a{oXvbA)1>Z_#kvw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