diff options
-rw-r--r-- | indra/llui/llmenugl.cpp | 23 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_login.xml | 3 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/widgets/menu_item_tear_off.xml | 7 |
3 files changed, 21 insertions, 12 deletions
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 03374b856b..75b0803890 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -121,6 +121,8 @@ const F32 ACTIVATE_HIGHLIGHT_TIME = 0.3f; static MenuRegistry::Register<LLMenuItemSeparatorGL> register_separator("menu_item_separator"); static MenuRegistry::Register<LLMenuItemCallGL> register_menu_item_call("menu_item_call"); static MenuRegistry::Register<LLMenuItemCheckGL> register_menu_item_check("menu_item_check"); +// Created programmatically but we need to specify custom colors in xml +static MenuRegistry::Register<LLMenuItemTearOffGL> register_menu_item_tear_off("menu_item_tear_off"); static MenuRegistry::Register<LLMenuGL> register_menu("menu"); static LLDefaultChildRegistry::Register<LLMenuGL> register_menu_default("menu"); @@ -390,8 +392,10 @@ void LLMenuItemGL::buildDrawLabel( void ) void LLMenuItemGL::onCommit( void ) { - // close all open menus by default - // if parent menu is actually visible (and we are not triggering menu item via accelerator) + // Check torn-off status to allow left-arrow keyboard navigation back + // to parent menu. + // Also, don't hide if item triggered by keyboard shortcut (and hence + // parent not visible). if (!getMenu()->getTornOff() && getMenu()->getVisible()) { @@ -3484,16 +3488,19 @@ LLTearOffMenu::LLTearOffMenu(LLMenuGL* menup) : LLRect rect; menup->localRectToOtherView(LLRect(-1, menup->getRect().getHeight(), menup->getRect().getWidth() + 3, 0), &rect, gFloaterView); // make sure this floater is big enough for menu - mTargetHeight = (F32)(rect.getHeight() + floater_header_size + 5); + mTargetHeight = (F32)(rect.getHeight() + floater_header_size); reshape(rect.getWidth(), rect.getHeight()); setRect(rect); // attach menu to floater - menup->setFollowsAll(); + menup->setFollows( FOLLOWS_LEFT | FOLLOWS_BOTTOM ); mOldParent = menup->getParent(); addChild(menup); menup->setVisible(TRUE); - menup->translate(-menup->getRect().mLeft + 1, -menup->getRect().mBottom + 1); + LLRect menu_rect = menup->getRect(); + menu_rect.setOriginAndSize( 1, 1, + menu_rect.getWidth(), menu_rect.getHeight()); + menup->setRect(menu_rect); menup->setDropShadowed(FALSE); mMenu = menup; @@ -3521,12 +3528,6 @@ void LLTearOffMenu::draw() // animate towards target height reshape(getRect().getWidth(), llceil(lerp((F32)getRect().getHeight(), mTargetHeight, LLCriticalDamp::getInterpolant(0.05f)))); } - else - { - // when in stasis, remain big enough to hold menu contents - mTargetHeight = (F32)(mMenu->getRect().getHeight() + floater_header_size + 4); - reshape(mMenu->getRect().getWidth() + 3, mMenu->getRect().getHeight() + floater_header_size + 5); - } LLFloater::draw(); } diff --git a/indra/newview/skins/default/xui/en/menu_login.xml b/indra/newview/skins/default/xui/en/menu_login.xml index b08b87a19c..6db6448677 100644 --- a/indra/newview/skins/default/xui/en/menu_login.xml +++ b/indra/newview/skins/default/xui/en/menu_login.xml @@ -64,7 +64,8 @@ create_jump_keys="true" label="Debug" layout="topleft" - name="Debug"> + name="Debug" + tear_off="true"> <!-- Need a copy of the edit menu here so keyboard shortcuts like control-C work to copy text at login screen and About dialog (for QA) --> diff --git a/indra/newview/skins/default/xui/en/widgets/menu_item_tear_off.xml b/indra/newview/skins/default/xui/en/widgets/menu_item_tear_off.xml new file mode 100644 index 0000000000..185ed6ee3e --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/menu_item_tear_off.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<!-- Use "disabled color" to make it look like menu separators --> +<menu_item_tear_off enabled_color="MenuItemDisabledColor" + disabled_color="MenuItemDisabledColor" + highlight_bg_color="MenuItemHighlightBgColor" + highlight_fg_color="MenuItemHighlightFgColor"> +</menu_item_tear_off> |