summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llui/llfocusmgr.cpp14
-rw-r--r--indra/llui/llfocusmgr.h2
-rw-r--r--indra/llui/llview.h5
-rw-r--r--indra/newview/llpreviewscript.cpp20
-rw-r--r--indra/newview/llpreviewscript.h2
-rw-r--r--indra/newview/llviewerwindow.cpp11
6 files changed, 53 insertions, 1 deletions
diff --git a/indra/llui/llfocusmgr.cpp b/indra/llui/llfocusmgr.cpp
index 1f16d12add..43e5f6b051 100644
--- a/indra/llui/llfocusmgr.cpp
+++ b/indra/llui/llfocusmgr.cpp
@@ -315,6 +315,20 @@ void LLFocusMgr::removeKeyboardFocusWithoutCallback( const LLFocusableElement* f
}
}
+bool LLFocusMgr::keyboardFocusHasAccelerators() const
+{
+ LLView* focus_view = dynamic_cast<LLView*>(mKeyboardFocus);
+ while( focus_view )
+ {
+ if(focus_view->hasAccelerators())
+ {
+ return true;
+ }
+
+ focus_view = focus_view->getParent();
+ }
+ return false;
+}
void LLFocusMgr::setMouseCapture( LLMouseHandler* new_captor )
{
diff --git a/indra/llui/llfocusmgr.h b/indra/llui/llfocusmgr.h
index eef82a3b5a..22c1895075 100644
--- a/indra/llui/llfocusmgr.h
+++ b/indra/llui/llfocusmgr.h
@@ -118,6 +118,8 @@ public:
void unlockFocus();
BOOL focusLocked() const { return mLockedView != NULL; }
+ bool keyboardFocusHasAccelerators() const;
+
private:
LLUICtrl* mLockedView;
diff --git a/indra/llui/llview.h b/indra/llui/llview.h
index 6bcee98f26..33d345beff 100644
--- a/indra/llui/llview.h
+++ b/indra/llui/llview.h
@@ -273,6 +273,11 @@ public:
BOOL focusNextRoot();
BOOL focusPrevRoot();
+ // Normally we want the app menus to get priority on accelerated keys
+ // However, sometimes we want to give specific views a first chance
+ // iat handling them. (eg. the script editor)
+ virtual bool hasAccelerators() const { return false; };
+
// delete all children. Override this function if you need to
// perform any extra clean up such as cached pointers to selected
// children, etc.
diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp
index 627010bb53..cf2ea38288 100644
--- a/indra/newview/llpreviewscript.cpp
+++ b/indra/newview/llpreviewscript.cpp
@@ -138,6 +138,9 @@ public:
LLScriptEdCore* getEditorCore() { return mEditorCore; }
static LLFloaterScriptSearch* getInstance() { return sInstance; }
+ virtual bool hasAccelerators() const;
+ virtual BOOL handleKeyHere(KEY key, MASK mask);
+
private:
LLScriptEdCore* mEditorCore;
@@ -242,7 +245,24 @@ void LLFloaterScriptSearch::handleBtnReplaceAll()
mEditorCore->mEditor->replaceTextAll(getChild<LLUICtrl>("search_text")->getValue().asString(), getChild<LLUICtrl>("replace_text")->getValue().asString(), caseChk->get());
}
+bool LLFloaterScriptSearch::hasAccelerators() const
+{
+ if (mEditorCore)
+ {
+ return mEditorCore->hasAccelerators();
+ }
+ return FALSE;
+}
+
+BOOL LLFloaterScriptSearch::handleKeyHere(KEY key, MASK mask)
+{
+ if (mEditorCore)
+ {
+ return mEditorCore->handleKeyHere(key, mask);
+ }
+ return FALSE;
+}
/// ---------------------------------------------------------------------------
/// LLScriptEdCore
diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h
index ef4f0d9c20..f4b31e5962 100644
--- a/indra/newview/llpreviewscript.h
+++ b/indra/newview/llpreviewscript.h
@@ -87,6 +87,8 @@ public:
static void onBtnInsertSample(void*);
static void onBtnInsertFunction(LLUICtrl*, void*);
+ virtual bool hasAccelerators() const { return true; }
+
private:
void onBtnHelp();
void onBtnDynamicHelp();
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index b2ff39bbd2..983a2d25c8 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -2136,10 +2136,20 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
return TRUE;
}
+ LLFocusableElement* keyboard_focus = gFocusMgr.getKeyboardFocus();
+
// give menus a chance to handle modified (Ctrl, Alt) shortcut keys before current focus
// as long as focus isn't locked
if (mask & (MASK_CONTROL | MASK_ALT) && !gFocusMgr.focusLocked())
{
+ // Check the current floater's menu first, if it has one.
+ if (gFocusMgr.keyboardFocusHasAccelerators()
+ && keyboard_focus
+ && keyboard_focus->handleKey(key,mask,FALSE))
+ {
+ return TRUE;
+ }
+
if ((gMenuBarView && gMenuBarView->handleAcceleratorKey(key, mask))
||(gLoginMenuBarView && gLoginMenuBarView->handleAcceleratorKey(key, mask)))
{
@@ -2175,7 +2185,6 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
}
// Traverses up the hierarchy
- LLFocusableElement* keyboard_focus = gFocusMgr.getKeyboardFocus();
if( keyboard_focus )
{
LLLineEditor* chat_editor = LLBottomTray::instanceExists() ? LLBottomTray::getInstance()->getNearbyChatBar()->getChatBox() : NULL;