Commits

Kelly Washington  committed a4ff3d2

VWR-21377 Script editor ctrl-f fix.
let some LLViews handle shortcut keys if they want.
reviewed with ambroff

  • Participants
  • Parent commits 8df2d0d

Comments (0)

Files changed (5)

File indra/llui/llfocusmgr.cpp

 	}
 }
 
+bool LLFocusMgr::keyboardFocusHasMenus() const
+{
+	LLView* focus_view = dynamic_cast<LLView*>(mKeyboardFocus);
+	while( focus_view )
+	{
+		if(focus_view->hasMenus())
+		{
+			return true;
+		}
+
+		focus_view = focus_view->getParent();
+	}
+	return false;
+}
 
 void LLFocusMgr::setMouseCapture( LLMouseHandler* new_captor )
 {

File indra/llui/llfocusmgr.h

 	void			unlockFocus();
 	BOOL			focusLocked() const { return mLockedView != NULL; }
 
+	bool			keyboardFocusHasMenus() const;
+
 private:
 	LLUICtrl*			mLockedView;
 

File indra/llui/llview.h

 	BOOL focusNextRoot();
 	BOOL focusPrevRoot();
 
+	// Normally we want the app menus to get priority on modified keys
+	// However, if this item claims to have menus then we want to give
+	// it first chance at handling them. (eg. the script editor)
+	virtual bool	hasMenus() 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.

File indra/newview/llpreviewscript.h

 	static void		onBtnInsertSample(void*);
 	static void		onBtnInsertFunction(LLUICtrl*, void*);
 
+	virtual bool	hasMenus() const { return true; }
+
 private:
 	void		onBtnHelp();
 	void		onBtnDynamicHelp();

File indra/newview/llviewerwindow.cpp

 		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.keyboardFocusHasMenus()
+			&& keyboard_focus 
+			&& keyboard_focus->handleKey(key,mask,FALSE))
+		{
+			return TRUE;
+		}
+
 		if ((gMenuBarView && gMenuBarView->handleAcceleratorKey(key, mask))
 			||(gLoginMenuBarView && gLoginMenuBarView->handleAcceleratorKey(key, mask)))
 		{
 	}
 
 	// Traverses up the hierarchy
-	LLFocusableElement* keyboard_focus = gFocusMgr.getKeyboardFocus();
 	if( keyboard_focus )
 	{
 		LLLineEditor* chat_editor = LLBottomTray::instanceExists() ? LLBottomTray::getInstance()->getNearbyChatBar()->getChatBox() : NULL;