Skip to content
Snippets Groups Projects
Commit e6688f99 authored by Tofu Linden's avatar Tofu Linden
Browse files

merge

parents 595cbb77 fa22f0a6
No related branches found
No related tags found
No related merge requests found
...@@ -315,6 +315,20 @@ void LLFocusMgr::removeKeyboardFocusWithoutCallback( const LLFocusableElement* f ...@@ -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 ) void LLFocusMgr::setMouseCapture( LLMouseHandler* new_captor )
{ {
......
...@@ -118,6 +118,8 @@ class LLFocusMgr ...@@ -118,6 +118,8 @@ class LLFocusMgr
void unlockFocus(); void unlockFocus();
BOOL focusLocked() const { return mLockedView != NULL; } BOOL focusLocked() const { return mLockedView != NULL; }
bool keyboardFocusHasAccelerators() const;
private: private:
LLUICtrl* mLockedView; LLUICtrl* mLockedView;
......
...@@ -273,6 +273,11 @@ class LLView : public LLMouseHandler, public LLMortician, public LLFocusableElem ...@@ -273,6 +273,11 @@ class LLView : public LLMouseHandler, public LLMortician, public LLFocusableElem
BOOL focusNextRoot(); BOOL focusNextRoot();
BOOL focusPrevRoot(); 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 // delete all children. Override this function if you need to
// perform any extra clean up such as cached pointers to selected // perform any extra clean up such as cached pointers to selected
// children, etc. // children, etc.
......
...@@ -138,6 +138,9 @@ class LLFloaterScriptSearch : public LLFloater ...@@ -138,6 +138,9 @@ class LLFloaterScriptSearch : public LLFloater
LLScriptEdCore* getEditorCore() { return mEditorCore; } LLScriptEdCore* getEditorCore() { return mEditorCore; }
static LLFloaterScriptSearch* getInstance() { return sInstance; } static LLFloaterScriptSearch* getInstance() { return sInstance; }
virtual bool hasAccelerators() const;
virtual BOOL handleKeyHere(KEY key, MASK mask);
private: private:
LLScriptEdCore* mEditorCore; LLScriptEdCore* mEditorCore;
...@@ -242,7 +245,24 @@ void LLFloaterScriptSearch::handleBtnReplaceAll() ...@@ -242,7 +245,24 @@ void LLFloaterScriptSearch::handleBtnReplaceAll()
mEditorCore->mEditor->replaceTextAll(getChild<LLUICtrl>("search_text")->getValue().asString(), getChild<LLUICtrl>("replace_text")->getValue().asString(), caseChk->get()); 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 /// LLScriptEdCore
......
...@@ -87,6 +87,8 @@ class LLScriptEdCore : public LLPanel ...@@ -87,6 +87,8 @@ class LLScriptEdCore : public LLPanel
static void onBtnInsertSample(void*); static void onBtnInsertSample(void*);
static void onBtnInsertFunction(LLUICtrl*, void*); static void onBtnInsertFunction(LLUICtrl*, void*);
virtual bool hasAccelerators() const { return true; }
private: private:
void onBtnHelp(); void onBtnHelp();
void onBtnDynamicHelp(); void onBtnDynamicHelp();
......
...@@ -2136,10 +2136,20 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) ...@@ -2136,10 +2136,20 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
return TRUE; return TRUE;
} }
LLFocusableElement* keyboard_focus = gFocusMgr.getKeyboardFocus();
// give menus a chance to handle modified (Ctrl, Alt) shortcut keys before current focus // give menus a chance to handle modified (Ctrl, Alt) shortcut keys before current focus
// as long as focus isn't locked // as long as focus isn't locked
if (mask & (MASK_CONTROL | MASK_ALT) && !gFocusMgr.focusLocked()) 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)) if ((gMenuBarView && gMenuBarView->handleAcceleratorKey(key, mask))
||(gLoginMenuBarView && gLoginMenuBarView->handleAcceleratorKey(key, mask))) ||(gLoginMenuBarView && gLoginMenuBarView->handleAcceleratorKey(key, mask)))
{ {
...@@ -2175,7 +2185,6 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) ...@@ -2175,7 +2185,6 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
} }
// Traverses up the hierarchy // Traverses up the hierarchy
LLFocusableElement* keyboard_focus = gFocusMgr.getKeyboardFocus();
if( keyboard_focus ) if( keyboard_focus )
{ {
LLLineEditor* chat_editor = LLBottomTray::instanceExists() ? LLBottomTray::getInstance()->getNearbyChatBar()->getChatBox() : NULL; LLLineEditor* chat_editor = LLBottomTray::instanceExists() ? LLBottomTray::getInstance()->getNearbyChatBar()->getChatBox() : NULL;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment