Skip to content
Snippets Groups Projects
Commit 01c7b50e authored by James Cook's avatar James Cook
Browse files

EXT-646 Pinned menus display incorrectly. Menu needs to follow bottom-left...

EXT-646 Pinned menus display incorrectly.  Menu needs to follow bottom-left corner to avoid being pulled up when floater resizes to accommodate.  Fixed floater height computation, removed magic numbers.  Added XML configuration file for menu_item_tear_off so we can set colors to make the lines visible when highlighted.  Reviewed with Richard.
parent fed64f4b
Branches
Tags
No related merge requests found
...@@ -121,6 +121,8 @@ const F32 ACTIVATE_HIGHLIGHT_TIME = 0.3f; ...@@ -121,6 +121,8 @@ const F32 ACTIVATE_HIGHLIGHT_TIME = 0.3f;
static MenuRegistry::Register<LLMenuItemSeparatorGL> register_separator("menu_item_separator"); static MenuRegistry::Register<LLMenuItemSeparatorGL> register_separator("menu_item_separator");
static MenuRegistry::Register<LLMenuItemCallGL> register_menu_item_call("menu_item_call"); static MenuRegistry::Register<LLMenuItemCallGL> register_menu_item_call("menu_item_call");
static MenuRegistry::Register<LLMenuItemCheckGL> register_menu_item_check("menu_item_check"); 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 MenuRegistry::Register<LLMenuGL> register_menu("menu");
static LLDefaultChildRegistry::Register<LLMenuGL> register_menu_default("menu"); static LLDefaultChildRegistry::Register<LLMenuGL> register_menu_default("menu");
...@@ -390,8 +392,10 @@ void LLMenuItemGL::buildDrawLabel( void ) ...@@ -390,8 +392,10 @@ void LLMenuItemGL::buildDrawLabel( void )
void LLMenuItemGL::onCommit( void ) void LLMenuItemGL::onCommit( void )
{ {
// close all open menus by default // Check torn-off status to allow left-arrow keyboard navigation back
// if parent menu is actually visible (and we are not triggering menu item via accelerator) // to parent menu.
// Also, don't hide if item triggered by keyboard shortcut (and hence
// parent not visible).
if (!getMenu()->getTornOff() if (!getMenu()->getTornOff()
&& getMenu()->getVisible()) && getMenu()->getVisible())
{ {
...@@ -3484,16 +3488,19 @@ LLTearOffMenu::LLTearOffMenu(LLMenuGL* menup) : ...@@ -3484,16 +3488,19 @@ LLTearOffMenu::LLTearOffMenu(LLMenuGL* menup) :
LLRect rect; LLRect rect;
menup->localRectToOtherView(LLRect(-1, menup->getRect().getHeight(), menup->getRect().getWidth() + 3, 0), &rect, gFloaterView); menup->localRectToOtherView(LLRect(-1, menup->getRect().getHeight(), menup->getRect().getWidth() + 3, 0), &rect, gFloaterView);
// make sure this floater is big enough for menu // 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()); reshape(rect.getWidth(), rect.getHeight());
setRect(rect); setRect(rect);
// attach menu to floater // attach menu to floater
menup->setFollowsAll(); menup->setFollows( FOLLOWS_LEFT | FOLLOWS_BOTTOM );
mOldParent = menup->getParent(); mOldParent = menup->getParent();
addChild(menup); addChild(menup);
menup->setVisible(TRUE); 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); menup->setDropShadowed(FALSE);
mMenu = menup; mMenu = menup;
...@@ -3521,12 +3528,6 @@ void LLTearOffMenu::draw() ...@@ -3521,12 +3528,6 @@ void LLTearOffMenu::draw()
// animate towards target height // animate towards target height
reshape(getRect().getWidth(), llceil(lerp((F32)getRect().getHeight(), mTargetHeight, LLCriticalDamp::getInterpolant(0.05f)))); 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(); LLFloater::draw();
} }
......
...@@ -64,7 +64,8 @@ ...@@ -64,7 +64,8 @@
create_jump_keys="true" create_jump_keys="true"
label="Debug" label="Debug"
layout="topleft" layout="topleft"
name="Debug"> name="Debug"
tear_off="true">
<!-- Need a copy of the edit menu here so keyboard shortcuts like <!-- 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) control-C work to copy text at login screen and About dialog (for QA)
--> -->
......
<?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>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment