From 67344f4d2f157658a8f2d5a24bf366a2fe300788 Mon Sep 17 00:00:00 2001
From: Puck Meerburg <puck@puckipedia.nl>
Date: Tue, 19 Nov 2013 17:01:29 +0000
Subject: [PATCH] Added location bar shortcut to Tracker
* Uses new constant message to message the Navigator to focus the location bar
---
src/kits/tracker/ContainerWindow.cpp | 6 ++++++
src/kits/tracker/Navigator.cpp | 9 ++++++++-
src/kits/tracker/Navigator.h | 4 +++-
3 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/src/kits/tracker/ContainerWindow.cpp b/src/kits/tracker/ContainerWindow.cpp
index 294bca4..6d77e8b 100644
a
|
b
|
BContainerWindow::ShowNavigator(bool show)
|
3995 | 3995 | Navigator()->MoveTo(0, KeyMenuBar()->Bounds().Height() + 1); |
3996 | 3996 | // This is if the navigator was created with a .top = 0. |
3997 | 3997 | Navigator()->Show(); |
| 3998 | |
3998 | 3999 | } |
3999 | 4000 | |
4000 | 4001 | float displacement = Navigator()->Frame().Height() + 1; |
… |
… |
BContainerWindow::SetSingleWindowBrowseShortcuts(bool enabled)
|
4056 | 4057 | new BMessage(kNavigatorCommandUp), Navigator()); |
4057 | 4058 | AddShortcut(B_DOWN_ARROW, B_OPTION_KEY | B_COMMAND_KEY, |
4058 | 4059 | new BMessage(kOpenSelection), PoseView()); |
| 4060 | AddShortcut('L', B_COMMAND_KEY, |
| 4061 | new BMessage(kNavigatorCommandFocusLocation), Navigator()); |
| 4062 | |
4059 | 4063 | |
4060 | 4064 | } else { |
| 4065 | RemoveShortcut('L', B_COMMAND_KEY); |
| 4066 | |
4061 | 4067 | RemoveShortcut(B_LEFT_ARROW, B_COMMAND_KEY); |
4062 | 4068 | RemoveShortcut(B_RIGHT_ARROW, B_COMMAND_KEY); |
4063 | 4069 | RemoveShortcut(B_UP_ARROW, B_COMMAND_KEY); |
diff --git a/src/kits/tracker/Navigator.cpp b/src/kits/tracker/Navigator.cpp
index 3d0ef5c..8d1e8e1 100644
a
|
b
|
BNavigator::MessageReceived(BMessage* message)
|
229 | 229 | case kNavigatorCommandUp: |
230 | 230 | GoUp((modifiers() & B_OPTION_KEY) == B_OPTION_KEY); |
231 | 231 | break; |
232 | | |
| 232 | case kNavigatorCommandFocusLocation: |
| 233 | FocusLocation(); |
| 234 | break; |
233 | 235 | case kNavigatorCommandLocation: |
234 | 236 | GoTo(); |
235 | 237 | break; |
… |
… |
BNavigator::MessageReceived(BMessage* message)
|
255 | 257 | } |
256 | 258 | } |
257 | 259 | |
| 260 | void |
| 261 | BNavigator::FocusLocation() |
| 262 | { |
| 263 | fLocation->MakeFocus(); |
| 264 | } |
258 | 265 | |
259 | 266 | void |
260 | 267 | BNavigator::GoBackward(bool option) |
diff --git a/src/kits/tracker/Navigator.h b/src/kits/tracker/Navigator.h
index d290a2f..19e7eea 100644
a
|
b
|
enum NavigationAction
|
58 | 58 | kNavigatorCommandBackward = 'NVBW', |
59 | 59 | kNavigatorCommandForward = 'NVFW', |
60 | 60 | kNavigatorCommandUp = 'NVUP', |
61 | | kNavigatorCommandLocation = 'NVLC' |
| 61 | kNavigatorCommandLocation = 'NVLC', |
| 62 | kNavigatorCommandFocusLocation = 'NVFL' |
62 | 63 | }; |
63 | 64 | |
64 | 65 | |
… |
… |
protected:
|
104 | 105 | void GoBackward(bool option); |
105 | 106 | void GoUp(bool option); |
106 | 107 | void SendNavigationMessage(NavigationAction, BEntry*, bool option); |
| 108 | void FocusLocation(); |
107 | 109 | |
108 | 110 | void GoTo(); |
109 | 111 | |