From e2e65c39bf6b80934ab0dba507ff361c938b946d Mon Sep 17 00:00:00 2001 From: Shyotl Date: Sun, 19 Feb 2012 17:41:54 -0600 Subject: [PATCH] Fixed up LLMenuGL and variants a bit. --- indra/llui/lllineeditor.cpp | 20 +- indra/llui/llmenugl.cpp | 884 +++++++++++------- indra/llui/llmenugl.h | 158 ++-- indra/llui/lltexteditor.cpp | 21 +- indra/newview/llfloatermessagelog.cpp | 10 +- indra/newview/llinventorybridge.cpp | 20 +- indra/newview/llpanelobjectinventory.cpp | 2 +- indra/newview/llviewermenu.cpp | 676 +++++++------- indra/newview/llvoavatarself.cpp | 28 +- .../default/xui/en-us/floater_inventory.xml | 4 +- 10 files changed, 1047 insertions(+), 776 deletions(-) diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 9caaf70fd..98f2e7311 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -186,12 +186,12 @@ LLLineEditor::LLLineEditor(const std::string& name, const LLRect& rect, { menu = new LLMenuGL(LLStringUtil::null); }*/ - menu->append(new LLMenuItemCallGL("Cut", context_cut, NULL, this)); - menu->append(new LLMenuItemCallGL("Copy", context_copy, NULL, this)); - menu->append(new LLMenuItemCallGL("Paste", context_paste, NULL, this)); - menu->append(new LLMenuItemCallGL("Delete", context_delete, NULL, this)); - menu->append(new LLMenuItemCallGL("Select All", context_selectall, NULL, this)); - menu->appendSeparator("Spelsep"); + menu->addChild(new LLMenuItemCallGL("Cut", context_cut, NULL, this)); + menu->addChild(new LLMenuItemCallGL("Copy", context_copy, NULL, this)); + menu->addChild(new LLMenuItemCallGL("Paste", context_paste, NULL, this)); + menu->addChild(new LLMenuItemCallGL("Delete", context_delete, NULL, this)); + menu->addChild(new LLMenuItemCallGL("Select All", context_selectall, NULL, this)); + menu->addSeparator(); //menu->setBackgroundColor(gColors.getColor("MenuPopupBgColor")); menu->setCanTearOff(FALSE); menu->setVisible(FALSE); @@ -668,7 +668,7 @@ BOOL LLLineEditor::handleRightMouseDown( S32 x, S32 y, MASK mask ) SpellMenuBind * tempBind = suggestionMenuItems[i]; if(tempBind) { - menu->remove((LLMenuItemCallGL *)tempBind->menuItem); + menu->removeChild((LLMenuItemCallGL *)tempBind->menuItem); ((LLMenuItemCallGL *)tempBind->menuItem)->die(); //delete tempBind->menuItem; //tempBind->menuItem = NULL; @@ -705,7 +705,7 @@ BOOL LLLineEditor::handleRightMouseDown( S32 x, S32 y, MASK mask ) //new LLMenuItemCallGL("Select All", context_selectall, NULL, this)); tempStruct->menuItem = suggMenuItem; suggestionMenuItems.push_back(tempStruct); - menu->append(suggMenuItem); + menu->addChild(suggMenuItem); } SpellMenuBind * tempStruct = new SpellMenuBind; tempStruct->origin = this; @@ -716,7 +716,7 @@ BOOL LLLineEditor::handleRightMouseDown( S32 x, S32 y, MASK mask ) "Add Word", spell_add, NULL, tempStruct); tempStruct->menuItem = suggMenuItem; suggestionMenuItems.push_back(tempStruct); - menu->append(suggMenuItem); + menu->addChild(suggMenuItem); } } @@ -734,7 +734,7 @@ BOOL LLLineEditor::handleRightMouseDown( S32 x, S32 y, MASK mask ) tempStruct->word, spell_show, NULL, tempStruct); tempStruct->menuItem = suggMenuItem; suggestionMenuItems.push_back(tempStruct); - menu->append(suggMenuItem); + menu->addChild(suggMenuItem); } mLastContextMenuX = x; diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 4a1368419..048c7c9b2 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -46,20 +46,21 @@ #include "llmenugl.h" +#include "llgl.h" #include "llmath.h" #include "llrender.h" #include "llfocusmgr.h" -#include "llfont.h" #include "llcoord.h" #include "llwindow.h" #include "llcriticaldamp.h" #include "lluictrlfactory.h" +#include "llbutton.h" #include "llfontgl.h" #include "llresmgr.h" +#include "lltrans.h" #include "llui.h" -#include "lltrans.h" #include "llstl.h" #include "v2math.h" @@ -100,10 +101,10 @@ const std::string SEPARATOR_LABEL( "-----------" ); const std::string VERTICAL_SEPARATOR_LABEL( "|" ); const std::string TEAROFF_SEPARATOR_LABEL( "~~~~~~~~~~~" ); -const std::string BOOLEAN_TRUE_PREFIX( "\xE2\x9C\x94" ); // U+2714 HEAVY CHECK MARK -const std::string BRANCH_SUFFIX( "\xE2\x96\xB6" ); // U+25B6 BLACK RIGHT-POINTING TRIANGLE -const std::string ARROW_UP ("^^^^^^^"); -const std::string ARROW_DOWN("vvvvvvv"); +const std::string LLMenuGL::BOOLEAN_TRUE_PREFIX( "\xE2\x9C\x94" ); // U+2714 HEAVY CHECK MARK +const std::string LLMenuGL::BRANCH_SUFFIX( "\xE2\x96\xB6" ); // U+25B6 BLACK RIGHT-POINTING TRIANGLE +const std::string LLMenuGL::ARROW_UP ("^^^^^^^"); +const std::string LLMenuGL::ARROW_DOWN("vvvvvvv"); const F32 MAX_MOUSE_SLOPE_SUB_MENU = 0.9f; @@ -133,21 +134,31 @@ const F32 ACTIVATE_HIGHLIGHT_TIME = 0.3f; // Default constructor LLMenuItemGL::LLMenuItemGL( const std::string& name, const std::string& label, KEY key, MASK mask ) : - LLView( name, TRUE ), + LLUICtrl( name, LLRect(), TRUE, NULL, NULL ), mJumpKey(KEY_NONE), - mAcceleratorKey( key ), - mAcceleratorMask( mask ), mAllowKeyRepeat(FALSE), mHighlight( FALSE ), mGotHover( FALSE ), mBriefItem( FALSE ), - mFont( LLFontGL::getFontSansSerif() ), mStyle(LLFontGL::NORMAL), - mDrawTextDisabled( FALSE ) + mDrawTextDisabled( FALSE ), + mFont( LLFontGL::getFontSansSerif() ), + mAcceleratorKey( key ), + mAcceleratorMask( mask ), + mLabel( label ), + mEnabledColor( sEnabledColor ), + mDisabledColor( sDisabledColor ), + mHighlightBackground( sHighlightBackground ), + mHighlightForeground( sHighlightForeground ) { setLabel( label ); } +LLMenuItemGL::~LLMenuItemGL() +{ + lldebugs << "Menu destroyed:" << this->getName() << llendl; +}; + // virtual LLXMLNodePtr LLMenuItemGL::getXML(bool save_children) const { @@ -190,6 +201,20 @@ LLXMLNodePtr LLMenuItemGL::getXML(bool save_children) const return node; } + +//virtual +void LLMenuItemGL::setValue(const LLSD& value) +{ + setLabel(value.asString()); +} + +//virtual +LLSD LLMenuItemGL::getValue() const +{ + return getLabel(); +} + +//virtual BOOL LLMenuItemGL::handleAcceleratorKey(KEY key, MASK mask) { if( getEnabled() && (!gKeyboard->getKeyRepeated(key) || mAllowKeyRepeat) && (key == mAcceleratorKey) && (mask == (mAcceleratorMask & MASK_NORMALKEYS)) ) @@ -207,6 +232,26 @@ BOOL LLMenuItemGL::handleHover(S32 x, S32 y, MASK mask) return TRUE; } +//virtual +BOOL LLMenuItemGL::handleRightMouseDown(S32 x, S32 y, MASK mask) +{ + return LLUICtrl::handleRightMouseDown(x,y,mask); +} + +//virtual +BOOL LLMenuItemGL::handleRightMouseUp(S32 x, S32 y, MASK mask) +{ + // If this event came from a right-click context menu spawn, + // process as a left-click to allow menu items to be hit + if (LLMenuHolderGL::sContextMenuSpawnPos.mX != S32_MAX + || LLMenuHolderGL::sContextMenuSpawnPos.mY != S32_MAX) + { + BOOL handled = handleMouseUp(x, y, mask); + return handled; + } + return LLUICtrl::handleRightMouseUp(x,y,mask); +} + // This function checks to see if the accelerator key is already in use; // if not, it will be added to the list BOOL LLMenuItemGL::addToAcceleratorList(std::list *listp) @@ -311,9 +356,20 @@ U32 LLMenuItemGL::getNominalHeight( void ) const return llround(mFont->getLineHeight()) + MENU_ITEM_PADDING; } +//virtual +void LLMenuItemGL::setBriefItem(BOOL brief) +{ + mBriefItem = brief; +} + +//virtual +BOOL LLMenuItemGL::isBriefItem() const +{ + return mBriefItem; +} // Get the parent menu for this item -LLMenuGL* LLMenuItemGL::getMenu() +LLMenuGL* LLMenuItemGL::getMenu() const { return (LLMenuGL*) getParent(); } @@ -337,7 +393,7 @@ U32 LLMenuItemGL::getNominalWidth( void ) const if( KEY_NONE != mAcceleratorKey ) { - width += ACCEL_PAD_PIXELS; + width += getMenu()->getShortcutPad(); std::string temp; appendAcceleratorString( temp ); width += mFont->getWidth( temp ); @@ -357,8 +413,10 @@ void LLMenuItemGL::buildDrawLabel( void ) void LLMenuItemGL::doIt( 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()) { @@ -373,6 +431,12 @@ void LLMenuItemGL::doIt( void ) { getMenu()->clearHoverItem(); } + + if (mHighlight != highlight) + { + //dirtyRect(); + } + mHighlight = highlight; } @@ -411,25 +475,30 @@ BOOL LLMenuItemGL::handleKeyHere( KEY key, MASK mask ) return FALSE; } -BOOL LLMenuItemGL::handleMouseUp( S32 x, S32 y, MASK ) +BOOL LLMenuItemGL::handleMouseUp( S32 x, S32 y, MASK mask) { // switch to mouse navigation mode LLMenuGL::setKeyboardMode(FALSE); doIt(); make_ui_sound("UISndClickRelease"); - return TRUE; + return LLView::handleMouseUp(x, y, mask); } -BOOL LLMenuItemGL::handleMouseDown( S32 x, S32 y, MASK ) +BOOL LLMenuItemGL::handleMouseDown( S32 x, S32 y, MASK mask) { // switch to mouse navigation mode LLMenuGL::setKeyboardMode(FALSE); setHighlight(TRUE); - return TRUE; + return LLView::handleMouseDown(x, y, mask); } +BOOL LLMenuItemGL::handleScrollWheel( S32 x, S32 y, S32 clicks ) +{ + // If the menu is scrollable let it handle the wheel event. + return FALSE;//!getMenu()->isScrollable(); +} void LLMenuItemGL::draw( void ) { @@ -440,7 +509,11 @@ void LLMenuItemGL::draw( void ) // let disabled items be highlighted, just don't draw them as such if( getEnabled() && getHighlight() && !mBriefItem) { - gGL.color4fv( sHighlightBackground.mV ); + int debug_count = 0; + if (dynamic_cast(this)) + debug_count++; + gGL.color4fv( mHighlightBackground.mV ); + gl_rect_2d( 0, getRect().getHeight(), getRect().getWidth(), 0 ); } @@ -454,15 +527,15 @@ void LLMenuItemGL::draw( void ) if ( getEnabled() && getHighlight() ) { - color = sHighlightForeground; + color = mHighlightForeground; } else if( getEnabled() && !mDrawTextDisabled ) { - color = sEnabledColor; + color = mEnabledColor; } else { - color = sDisabledColor; + color = mDisabledColor; } // Draw the text on top. @@ -516,6 +589,14 @@ BOOL LLMenuItemGL::setLabelArg( const std::string& key, const LLStringExplicit& return TRUE; } +void LLMenuItemGL::handleVisibilityChange(BOOL new_visibility) +{ + if (getMenu()) + { + getMenu()->needsArrange(); + } + LLView::handleVisibilityChange(new_visibility); +} //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLMenuItemSeparatorGL // @@ -543,7 +624,7 @@ LLXMLNodePtr LLMenuItemSeparatorGL::getXML(bool save_children) const void LLMenuItemSeparatorGL::draw( void ) { - gGL.color4fv( getDisabledColor().mV ); + gGL.color4fv( mDisabledColor.mV ); const S32 y = getRect().getHeight() / 2; const S32 PAD = 6; gl_line_2d( PAD, y, getRect().getWidth() - PAD, y ); @@ -554,11 +635,14 @@ BOOL LLMenuItemSeparatorGL::handleMouseDown(S32 x, S32 y, MASK mask) LLMenuGL* parent_menu = getMenu(); if (y > getRect().getHeight() / 2) { - return parent_menu->handleMouseDown(x + getRect().mLeft, getRect().mTop + 1, mask); + // the menu items are in the child list in bottom up order + LLView* prev_menu_item = parent_menu->findNextSibling(this); + return prev_menu_item ? prev_menu_item->handleMouseDown(x, prev_menu_item->getRect().getHeight(), mask) : FALSE; } else { - return parent_menu->handleMouseDown(x + getRect().mLeft, getRect().mBottom - 1, mask); + LLView* next_menu_item = parent_menu->findPrevSibling(this); + return next_menu_item ? next_menu_item->handleMouseDown(x, 0, mask) : FALSE; } } @@ -567,11 +651,13 @@ BOOL LLMenuItemSeparatorGL::handleMouseUp(S32 x, S32 y, MASK mask) LLMenuGL* parent_menu = getMenu(); if (y > getRect().getHeight() / 2) { - return parent_menu->handleMouseUp(x + getRect().mLeft, getRect().mTop + 1, mask); + LLView* prev_menu_item = parent_menu->findNextSibling(this); + return prev_menu_item ? prev_menu_item->handleMouseUp(x, prev_menu_item->getRect().getHeight(), mask) : FALSE; } else { - return parent_menu->handleMouseUp(x + getRect().mLeft, getRect().mBottom - 1, mask); + LLView* next_menu_item = parent_menu->findPrevSibling(this); + return next_menu_item ? next_menu_item->handleMouseUp(x, 0, mask) : FALSE; } } @@ -590,7 +676,6 @@ BOOL LLMenuItemSeparatorGL::handleHover(S32 x, S32 y, MASK mask) } } - //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLMenuItemVerticalSeparatorGL // @@ -614,9 +699,8 @@ LLMenuItemVerticalSeparatorGL::LLMenuItemVerticalSeparatorGL( void ) //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLMenuItemTearOffGL //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -LLMenuItemTearOffGL::LLMenuItemTearOffGL(LLHandle parent_floater_handle) : - LLMenuItemGL(std::string("tear off"), TEAROFF_SEPARATOR_LABEL), - mParentHandle(parent_floater_handle) +LLMenuItemTearOffGL::LLMenuItemTearOffGL() : + LLMenuItemGL(std::string("tear off"), TEAROFF_SEPARATOR_LABEL) { } @@ -630,6 +714,35 @@ LLXMLNodePtr LLMenuItemTearOffGL::getXML(bool save_children) const return node; } +// Returns the first floater ancestor if there is one +LLFloater* LLMenuItemTearOffGL::getParentFloater() +{ + LLView* parent_view = getMenu(); + + while (parent_view) + { + if (dynamic_cast(parent_view)) + { + return dynamic_cast(parent_view); + } + + bool parent_is_menu = dynamic_cast(parent_view) && !dynamic_cast(parent_view); + + if (parent_is_menu) + { + // use menu parent + parent_view = dynamic_cast(parent_view)->getParentMenuItem(); + } + else + { + // just use regular view parent + parent_view = parent_view->getParent(); + } + } + + return NULL; +} + void LLMenuItemTearOffGL::doIt() { if (getMenu()->getTornOff()) @@ -647,7 +760,7 @@ void LLMenuItemTearOffGL::doIt() getMenu()->needsArrange(); - LLFloater* parent_floater = mParentHandle.get(); + LLFloater* parent_floater = getParentFloater(); LLFloater* tear_off_menu = LLTearOffMenu::create(getMenu()); if (tear_off_menu) @@ -662,7 +775,7 @@ void LLMenuItemTearOffGL::doIt() tear_off_menu->setFocus(TRUE); } } - LLMenuItemGL::doIt(); + LLMenuItemGL::onCommit(); } void LLMenuItemTearOffGL::draw() @@ -670,17 +783,17 @@ void LLMenuItemTearOffGL::draw() // disabled items can be highlighted, but shouldn't render as such if( getEnabled() && getHighlight() && !isBriefItem()) { - gGL.color4fv( getHighlightBGColor().mV ); + gGL.color4fv( mHighlightBackground.mV ); gl_rect_2d( 0, getRect().getHeight(), getRect().getWidth(), 0 ); } if (getEnabled()) { - gGL.color4fv( getEnabledColor().mV ); + gGL.color4fv( mEnabledColor.mV ); } else { - gGL.color4fv( getDisabledColor().mV ); + gGL.color4fv( mDisabledColor.mV ); } const S32 y = getRect().getHeight() / 3; const S32 PAD = 6; @@ -866,14 +979,21 @@ void LLMenuItemCallGL::doIt( void ) LLMenuItemGL::doIt(); } -void LLMenuItemCallGL::buildDrawLabel( void ) +void LLMenuItemCallGL::updateEnabled( void ) { - LLPointer fired_event = new LLEvent(this); - fireEvent(fired_event, "on_build"); if( mEnabledCallback ) { setEnabled( mEnabledCallback( mUserData ) ); } +} + +void LLMenuItemCallGL::buildDrawLabel( void ) +{ + updateEnabled(); + + LLPointer fired_event = new LLEvent(this); + fireEvent(fired_event, "on_build"); + if(mLabelCallback) { std::string label; @@ -883,16 +1003,18 @@ void LLMenuItemCallGL::buildDrawLabel( void ) LLMenuItemGL::buildDrawLabel(); } +BOOL LLMenuItemCallGL::handleKeyHere( KEY key, MASK mask ) +{ + return LLMenuItemGL::handleKeyHere(key, mask); +} + BOOL LLMenuItemCallGL::handleAcceleratorKey( KEY key, MASK mask ) { if( (!gKeyboard->getKeyRepeated(key) || getAllowKeyRepeat()) && (key == mAcceleratorKey) && (mask == (mAcceleratorMask & MASK_NORMALKEYS)) ) { LLPointer fired_event = new LLEvent(this); fireEvent(fired_event, "on_build"); - if( mEnabledCallback ) - { - setEnabled( mEnabledCallback( mUserData ) ); - } + updateEnabled(); if( !getEnabled() ) { if( mOnDisabledCallback ) @@ -953,7 +1075,7 @@ void LLMenuItemCheckGL::setValue(const LLSD& value) mChecked = value.asBoolean(); if(mChecked) { - mDrawBoolLabel = BOOLEAN_TRUE_PREFIX; + mDrawBoolLabel = LLMenuGL::BOOLEAN_TRUE_PREFIX; } else { @@ -993,7 +1115,7 @@ void LLMenuItemCheckGL::buildDrawLabel( void ) { if(mChecked || (mCheckCallback && mCheckCallback( getUserData() ) ) ) { - mDrawBoolLabel = BOOLEAN_TRUE_PREFIX; + mDrawBoolLabel = LLMenuGL::BOOLEAN_TRUE_PREFIX; } else { @@ -1027,7 +1149,7 @@ void LLMenuItemToggleGL::buildDrawLabel( void ) { if( *mToggle ) { - mDrawBoolLabel = BOOLEAN_TRUE_PREFIX; + mDrawBoolLabel = LLMenuGL::BOOLEAN_TRUE_PREFIX; } else { @@ -1050,47 +1172,51 @@ void LLMenuItemToggleGL::doIt( void ) } -LLMenuItemBranchGL::LLMenuItemBranchGL( const std::string& name, const std::string& label, LLHandle branch, +LLMenuItemBranchGL::LLMenuItemBranchGL( const std::string& name, const std::string& label, LLHandle branch_handle, KEY key, MASK mask ) : - LLMenuItemGL( name, label, key, mask ), - mBranch( branch ) + LLMenuItemGL( name, label, key, mask ) { - if(!dynamic_cast(branch.get())) + LLMenuGL* branch = dynamic_cast(branch_handle.get()); + if(!branch) { llerrs << "Non-menu handle passed as branch reference." << llendl; } - if(getBranch()) + if (branch) { - getBranch()->setVisible( FALSE ); - getBranch()->setParentMenuItem(this); + mBranchHandle = branch->getHandle(); + branch->setVisible(FALSE); + branch->setParentMenuItem(this); } } LLMenuItemBranchGL::~LLMenuItemBranchGL() { - LLView::deleteViewByHandle(mBranch); + if (mBranchHandle.get()) + { + mBranchHandle.get()->die(); + } } // virtual LLView* LLMenuItemBranchGL::getChildView(const std::string& name, BOOL recurse, BOOL create_if_missing) const { - // richard: this is redundant with parent, remove - if (getBranch()) + LLMenuGL* branch = getBranch(); + if (branch) { - if(getBranch()->getName() == name) + if (branch->getName() == name) { - return getBranch(); + return branch; } // Always recurse on branches - LLView* child = getBranch()->getChildView(name, recurse, FALSE); + LLView* child = branch->getChildView(name, recurse, FALSE); if(child) { return child; } } - return LLView::getChildView(name, recurse, create_if_missing);; + return LLView::getChildView(name, recurse, create_if_missing); } // virtual @@ -1106,11 +1232,7 @@ BOOL LLMenuItemBranchGL::handleMouseUp(S32 x, S32 y, MASK mask) BOOL LLMenuItemBranchGL::handleAcceleratorKey(KEY key, MASK mask) { - if(getBranch()) - { - return getBranch()->handleAcceleratorKey(key, mask); - } - return FALSE; + return getBranch() && getBranch()->handleAcceleratorKey(key, mask); } // virtual @@ -1129,19 +1251,21 @@ LLXMLNodePtr LLMenuItemBranchGL::getXML(bool save_children) const // if not, it will be added to the list BOOL LLMenuItemBranchGL::addToAcceleratorList(std::list *listp) { - if(getBranch()) - { - U32 item_count = getBranch()->getItemCount(); - LLMenuItemGL *item; + LLMenuGL* branch = getBranch(); + if (!branch) + return FALSE; - while (item_count--) + U32 item_count = branch->getItemCount(); + LLMenuItemGL *item; + + while (item_count--) + { + if ((item = branch->getItem(item_count))) { - if ((item = getBranch()->getItem(item_count))) - { - return item->addToAcceleratorList(listp); - } + return item->addToAcceleratorList(listp); } } + return FALSE; } @@ -1153,7 +1277,7 @@ void LLMenuItemBranchGL::buildDrawLabel( void ) std::string st = mDrawAccelLabel; appendAcceleratorString( st ); mDrawAccelLabel = st; - mDrawBranchLabel = BRANCH_SUFFIX; + mDrawBranchLabel = LLMenuGL::BRANCH_SUFFIX; } // doIt() - do the primary functionality of the menu item. @@ -1163,7 +1287,7 @@ void LLMenuItemBranchGL::doIt( void ) // keyboard navigation automatically propagates highlight to sub-menu // to facilitate fast menu control via jump keys - if (getBranch() && LLMenuGL::getKeyboardMode() && !getBranch()->getHighlightedItem()) + if (LLMenuGL::getKeyboardMode() && getBranch()&& !getBranch()->getHighlightedItem()) { getBranch()->highlightNextItem(NULL); } @@ -1172,7 +1296,7 @@ void LLMenuItemBranchGL::doIt( void ) BOOL LLMenuItemBranchGL::handleKey(KEY key, MASK mask, BOOL called_from_parent) { BOOL handled = FALSE; - if (called_from_parent && getBranch()) + if (getBranch() && called_from_parent) { handled = getBranch()->handleKey(key, mask, called_from_parent); } @@ -1188,7 +1312,7 @@ BOOL LLMenuItemBranchGL::handleKey(KEY key, MASK mask, BOOL called_from_parent) BOOL LLMenuItemBranchGL::handleUnicodeChar(llwchar uni_char, BOOL called_from_parent) { BOOL handled = FALSE; - if (called_from_parent && getBranch()) + if (getBranch() && called_from_parent) { handled = getBranch()->handleUnicodeChar(uni_char, TRUE); } @@ -1204,21 +1328,21 @@ BOOL LLMenuItemBranchGL::handleUnicodeChar(llwchar uni_char, BOOL called_from_pa void LLMenuItemBranchGL::setHighlight( BOOL highlight ) { - if (highlight == getHighlight()) return; - - if(!getBranch()) - { + if (highlight == getHighlight()) return; - } - BOOL auto_open = getEnabled() && (!getBranch()->getVisible() || getBranch()->getTornOff()); + LLMenuGL* branch = getBranch(); + if (!branch) + return; + + BOOL auto_open = getEnabled() && (!branch->getVisible() || branch->getTornOff()); // torn off menus don't open sub menus on hover unless they have focus if (getMenu()->getTornOff() && !((LLFloater*)getMenu()->getParent())->hasFocus()) { auto_open = FALSE; } // don't auto open torn off sub-menus (need to explicitly active menu item to give them focus) - if (getBranch()->getTornOff()) + if (branch->getTornOff()) { auto_open = FALSE; } @@ -1232,14 +1356,14 @@ void LLMenuItemBranchGL::setHighlight( BOOL highlight ) } else { - if (getBranch()->getTornOff()) + if (branch->getTornOff()) { - ((LLFloater*)getBranch()->getParent())->setFocus(FALSE); - getBranch()->clearHoverItem(); + ((LLFloater*)branch->getParent())->setFocus(FALSE); + branch->clearHoverItem(); } else { - getBranch()->setVisible( FALSE ); + branch->setVisible( FALSE ); } } } @@ -1266,6 +1390,7 @@ void LLMenuItemBranchGL::handleVisibilityChange( BOOL new_visibility ) { if (new_visibility == FALSE && getBranch() && !getBranch()->getTornOff()) { + lldebugs << "Forcing branch to visible. Menu: " << getName() << " Branch: " << getBranch()->getName() << llendl; getBranch()->setVisible(FALSE); } LLMenuItemGL::handleVisibilityChange(new_visibility); @@ -1273,40 +1398,60 @@ void LLMenuItemBranchGL::handleVisibilityChange( BOOL new_visibility ) BOOL LLMenuItemBranchGL::handleKeyHere( KEY key, MASK mask ) { - if (getMenu()->getVisible() && getBranch() && getBranch()->getVisible() && key == KEY_LEFT) + LLMenuGL* branch = getBranch(); + if (!branch) + return LLMenuItemGL::handleKeyHere(key, mask); + + // an item is highlighted, my menu is open, and I have an active sub menu or we are in + // keyboard navigation mode + if (getHighlight() + && getMenu()->isOpen() + && (isActive() || LLMenuGL::getKeyboardMode())) { - // switch to keyboard navigation mode - LLMenuGL::setKeyboardMode(TRUE); - - BOOL handled = getBranch()->clearHoverItem(); - if (getBranch()->getTornOff()) + if (branch->getVisible() && key == KEY_LEFT) { - ((LLFloater*)getBranch()->getParent())->setFocus(FALSE); + // switch to keyboard navigation mode + LLMenuGL::setKeyboardMode(TRUE); + + BOOL handled = branch->clearHoverItem(); + if (branch->getTornOff()) + { + ((LLFloater*)branch->getParent())->setFocus(FALSE); + } + if (handled && getMenu()->getTornOff()) + { + ((LLFloater*)getMenu()->getParent())->setFocus(TRUE); + } + return handled; } - if (handled && getMenu()->getTornOff()) - { - ((LLFloater*)getMenu()->getParent())->setFocus(TRUE); - } - return handled; - } - if (getHighlight() && - getMenu()->isOpen() && - key == KEY_RIGHT && getBranch() && !getBranch()->getHighlightedItem()) - { - // switch to keyboard navigation mode - LLMenuGL::setKeyboardMode(TRUE); - - LLMenuItemGL* itemp = getBranch()->highlightNextItem(NULL); - if (itemp) + if (key == KEY_RIGHT && !branch->getHighlightedItem()) { - return TRUE; + // switch to keyboard navigation mode + LLMenuGL::setKeyboardMode(TRUE); + + LLMenuItemGL* itemp = branch->highlightNextItem(NULL); + if (itemp) + { + return TRUE; + } } } - return LLMenuItemGL::handleKeyHere(key, mask); } +//virtual +BOOL LLMenuItemBranchGL::isActive() const +{ + return isOpen() && getBranch() && getBranch()->getHighlightedItem(); +} + +//virtual +BOOL LLMenuItemBranchGL::isOpen() const +{ + return getBranch() && getBranch()->isOpen(); +} + void LLMenuItemBranchGL::openMenu() { LLMenuGL* branch = getBranch(); @@ -1341,18 +1486,20 @@ void LLMenuItemBranchGL::openMenu() branch_rect.translate(0, TEAROFF_SEPARATOR_HEIGHT_PIXELS); } branch->setRect( branch_rect ); - S32 x = 0; - S32 y = 0; + + // if branch extends outside of menu region change the direction it opens in + S32 x, y; S32 delta_x = 0; S32 delta_y = 0; branch->localPointToOtherView( 0, 0, &x, &y, branch->getParent() ); if( y < menu_region_rect.mBottom ) { - delta_y = menu_region_rect.mBottom - y; + // open upwards if menu extends past bottom + // adjust by the height of the menu item branch since it is a submenu + delta_y = branch_rect.getHeight() - getRect().getHeight(); } - S32 menu_region_width = menu_region_rect.getWidth(); - if( x - menu_region_rect.mLeft > menu_region_width - branch_rect.getWidth() ) + if( x + branch_rect.getWidth() > menu_region_rect.mRight ) { // move sub-menu over to left side delta_x = llmax(-x, ( -(branch_rect.getWidth() + getRect().getWidth()))); @@ -1525,6 +1672,7 @@ BOOL LLMenuItemBranchDownGL::handleMouseDown( S32 x, S32 y, MASK mask ) LLMenuGL::setKeyboardMode(FALSE); doIt(); make_ui_sound("UISndClick"); + setVisible(TRUE); return TRUE; } @@ -1620,7 +1768,7 @@ void LLMenuItemBranchDownGL::draw( void ) if( getHighlight() ) { - gGL.color4fv( getHighlightBGColor().mV ); + gGL.color4fv( mHighlightBackground.mV ); gl_rect_2d( 0, getRect().getHeight(), getRect().getWidth(), 0 ); } @@ -1633,20 +1781,19 @@ void LLMenuItemBranchDownGL::draw( void ) LLColor4 color; if (getHighlight()) { - color = getHighlightFGColor(); + color = mHighlightForeground; } else if( getEnabled() ) { - color = getEnabledColor(); + color = mEnabledColor; } else { - color = getDisabledColor(); + color = mDisabledColor; } getFont()->render( mLabel.getWString(), 0, (F32)getRect().getWidth() / 2.f, (F32)LABEL_BOTTOM_PAD_PIXELS, color, LLFontGL::HCENTER, LLFontGL::BOTTOM, getFontStyle(), font_shadow ); - // underline navigation key only when keyboard navigation has been initiated if (getMenu()->jumpKeysActive() && LLMenuGL::getKeyboardMode()) { @@ -1674,7 +1821,7 @@ void LLMenuItemBranchDownGL::draw( void ) static LLRegisterWidget r1("menu"); // Default constructor -LLMenuGL::LLMenuGL( const std::string& name, const std::string& label, LLHandle parent_floater_handle ) +LLMenuGL::LLMenuGL( const std::string& name, const std::string& label ) : LLUICtrl( name, LLRect(), FALSE, NULL, NULL ), mBackgroundColor( sDefaultBackgroundColor ), mBgVisible( TRUE ), @@ -1689,17 +1836,17 @@ LLMenuGL::LLMenuGL( const std::string& name, const std::string& label, LLHandle< mTornOff(FALSE), mTearOffItem(NULL), mSpilloverBranch(NULL), + mFirstVisibleItem(NULL), mSpilloverMenu(NULL), - mParentFloaterHandle(parent_floater_handle), mJumpKey(KEY_NONE), - mNeedsArrange(FALSE) + mNeedsArrange(FALSE), + mShortcutPad(ACCEL_PAD_PIXELS) { mFadeTimer.stop(); - setCanTearOff(TRUE, parent_floater_handle); setTabStop(FALSE); } -LLMenuGL::LLMenuGL( const std::string& label, LLHandle parent_floater_handle ) +LLMenuGL::LLMenuGL( const std::string& label) : LLUICtrl( label, LLRect(), FALSE, NULL, NULL ), mBackgroundColor( sDefaultBackgroundColor ), mBgVisible( TRUE ), @@ -1715,11 +1862,12 @@ LLMenuGL::LLMenuGL( const std::string& label, LLHandle parent_floater mTearOffItem(NULL), mSpilloverBranch(NULL), mSpilloverMenu(NULL), - mParentFloaterHandle(parent_floater_handle), - mJumpKey(KEY_NONE) + mFirstVisibleItem(NULL), + mJumpKey(KEY_NONE), + mNeedsArrange(FALSE), + mShortcutPad(ACCEL_PAD_PIXELS) { mFadeTimer.stop(); - setCanTearOff(TRUE, parent_floater_handle); setTabStop(FALSE); } @@ -1732,14 +1880,12 @@ LLMenuGL::~LLMenuGL( void ) mJumpKeys.clear(); } -void LLMenuGL::setCanTearOff(BOOL tear_off, LLHandle parent_floater_handle ) +void LLMenuGL::setCanTearOff(BOOL tear_off) { if (tear_off && mTearOffItem == NULL) { - mTearOffItem = new LLMenuItemTearOffGL(parent_floater_handle); - mItems.insert(mItems.begin(), mTearOffItem); - addChildAtEnd(mTearOffItem); - needsArrange(); + mTearOffItem = new LLMenuItemTearOffGL(); + addChild(mTearOffItem); } else if (!tear_off && mTearOffItem != NULL) { @@ -1838,7 +1984,7 @@ void LLMenuGL::parseChildXML(LLXMLNodePtr child, LLView *parent, LLUICtrlFactory if (child->hasName(LL_MENU_ITEM_SEPARATOR_GL_TAG)) { - appendSeparator(item_name); + addSeparator(); } else { @@ -2074,6 +2220,40 @@ void LLMenuGL::parseChildXML(LLXMLNodePtr child, LLView *parent, LLUICtrlFactory } } +bool LLMenuGL::addChild(LLView* view, S32 tab_group) +{ + if (LLMenuGL* menup = dynamic_cast(view)) + { + lldebugs << "Adding menu " << menup->getName() << " to " << getName() << llendl; + appendMenu(menup); + return true; + } + else if (LLMenuItemGL* itemp = dynamic_cast(view)) + { + lldebugs << "Adding " << itemp->getName() << " to " << getName() << llendl; + append(itemp); + return true; + } + lldebugs << "Error adding unknown child '"<<(view ? view->getName() : std::string("NULL")) << "' to " << getName() << llendl; + return false; +} + +void LLMenuGL::removeChild( LLView* ctrl) +{ + // previously a dynamic_cast with if statement to check validity + // unfortunately removeChild is called by ~LLView, and at that point the + // object being deleted is no longer a LLMenuItemGL so a dynamic_cast will fail + LLMenuItemGL* itemp = static_cast(ctrl); + + item_list_t::iterator found_it = std::find(mItems.begin(), mItems.end(), (itemp)); + if (found_it != mItems.end()) + { + mItems.erase(found_it); + } + + return LLUICtrl::removeChild(ctrl); +} + // are we the childmost active menu and hence our jump keys should be enabled? // or are we a free-standing torn-off menu (which uses jump keys too) BOOL LLMenuGL::jumpKeysActive() @@ -2206,39 +2386,59 @@ void LLMenuGL::arrange( void ) // torn off menus are not constrained to the size of the screen U32 max_width = getTornOff() ? U32_MAX : menu_region_rect.getWidth(); - U32 max_height = getTornOff() ? U32_MAX : menu_region_rect.getHeight(); + U32 max_height = U32_MAX; + if (!getTornOff()) + { + max_height = getRect().mTop - menu_region_rect.mBottom; + if (menu_region_rect.mTop - getRect().mTop > (S32)max_height) + { + max_height = menu_region_rect.mTop - getRect().mTop; + } + } + // *FIX: create the item first and then ask for its dimensions? - S32 spillover_item_width = PLAIN_PAD_PIXELS + LLFontGL::getFontSansSerif()->getWidth( std::string("More") ); + S32 spillover_item_width = PLAIN_PAD_PIXELS + LLFontGL::getFontSansSerif()->getWidth( std::string("More") ); // *TODO: Translate S32 spillover_item_height = llround(LLFontGL::getFontSansSerif()->getLineHeight()) + MENU_ITEM_PADDING; + // Scrolling support + item_list_t::iterator first_visible_item_iter; + item_list_t::iterator first_hidden_item_iter = mItems.end(); + //S32 height_before_first_visible_item = -1; + //S32 visible_items_height = 0; + //U32 scrollable_items_cnt = 0; + if (mHorizontalLayout) { item_list_t::iterator item_iter; for (item_iter = mItems.begin(); item_iter != mItems.end(); ++item_iter) { + // do first so LLMenuGLItemCall can call on_visible to determine if visible + (*item_iter)->buildDrawLabel(); + if ((*item_iter)->getVisible()) { if (!getTornOff() - && item_iter != mItems.begin() // Don't spillover the first item! + && *item_iter != mSpilloverBranch && width + (*item_iter)->getNominalWidth() > max_width - spillover_item_width) { // no room for any more items createSpilloverBranch(); - item_list_t::iterator spillover_iter; - for (spillover_iter = item_iter; spillover_iter != mItems.end(); ++spillover_iter) + std::vector items_to_remove; + std::copy(item_iter, mItems.end(), std::back_inserter(items_to_remove)); + std::vector::iterator spillover_iter; + for (spillover_iter= items_to_remove.begin(); spillover_iter != items_to_remove.end(); ++spillover_iter) { LLMenuItemGL* itemp = (*spillover_iter); removeChild(itemp); - mSpilloverMenu->appendNoArrange(itemp); // *NOTE:Mani Favor addChild() in merge with skinning + mSpilloverMenu->addChild(itemp); } - mSpilloverMenu->arrange(); // *NOTE: Mani Remove line in merge with skinning/viewer2.0 branch - mSpilloverMenu->updateParent(LLMenuGL::sMenuContainer); // *NOTE: Mani Remove line in merge with skinning/viewer2.0 branch - mItems.erase(item_iter, mItems.end()); - mItems.push_back(mSpilloverBranch); + addChild(mSpilloverBranch); + height = llmax(height, mSpilloverBranch->getNominalHeight()); width += mSpilloverBranch->getNominalWidth(); + break; } else @@ -2255,29 +2455,33 @@ void LLMenuGL::arrange( void ) item_list_t::iterator item_iter; for (item_iter = mItems.begin(); item_iter != mItems.end(); ++item_iter) { + llassert_always((*item_iter)!=NULL); + // do first so LLMenuGLItemCall can call on_visible to determine if visible + (*item_iter)->buildDrawLabel(); + if ((*item_iter)->getVisible()) { if (!getTornOff() - && item_iter != mItems.begin() // Don't spillover the first item! + && *item_iter != mSpilloverBranch && height + (*item_iter)->getNominalHeight() > max_height - spillover_item_height) { // no room for any more items createSpilloverBranch(); - item_list_t::iterator spillover_iter; - for (spillover_iter= item_iter; spillover_iter != mItems.end(); ++spillover_iter) + std::vector items_to_remove; + std::copy(item_iter, mItems.end(), std::back_inserter(items_to_remove)); + std::vector::iterator spillover_iter; + for (spillover_iter= items_to_remove.begin(); spillover_iter != items_to_remove.end(); ++spillover_iter) { LLMenuItemGL* itemp = (*spillover_iter); removeChild(itemp); - mSpilloverMenu->appendNoArrange(itemp); // *NOTE:Mani Favor addChild() in merge with skinning + mSpilloverMenu->addChild(itemp); } - mSpilloverMenu->arrange(); // *NOTE: Mani Remove line in merge with skinning/viewer2.0 branch - mSpilloverMenu->updateParent(LLMenuGL::sMenuContainer); // *NOTE: Mani Remove line in merge with skinning/viewer2.0 branch - mItems.erase(item_iter, mItems.end()); - mItems.push_back(mSpilloverBranch); addChild(mSpilloverBranch); + height += mSpilloverBranch->getNominalHeight(); width = llmax( width, mSpilloverBranch->getNominalWidth() ); + break; } else @@ -2294,6 +2498,7 @@ void LLMenuGL::arrange( void ) S32 cur_height = (S32)llmin(max_height, height); S32 cur_width = 0; + S32 offset = 0; item_list_t::iterator item_iter; for (item_iter = mItems.begin(); item_iter != mItems.end(); ++item_iter) { @@ -2308,15 +2513,15 @@ void LLMenuGL::arrange( void ) } else { - rect.setLeftTopAndSize( 0, cur_height, width, (*item_iter)->getNominalHeight()); - cur_height -= (*item_iter)->getNominalHeight(); + rect.setLeftTopAndSize( 0 + offset, cur_height, width, (*item_iter)->getNominalHeight()); + if (offset == 0) + { + cur_height -= (*item_iter)->getNominalHeight(); + } } (*item_iter)->setRect( rect ); - (*item_iter)->buildDrawLabel(); } } - - cleanupSpilloverBranch(); } if (mKeepFixedSize) { @@ -2324,7 +2529,6 @@ void LLMenuGL::arrange( void ) } } - void LLMenuGL::arrangeAndClear( void ) { if (mNeedsArrange) @@ -2342,11 +2546,10 @@ void LLMenuGL::createSpilloverBranch() delete mSpilloverMenu; // technically, you can't tear off spillover menus, but we're passing the handle // along just to be safe - mSpilloverMenu = new LLMenuGL(std::string("More"), std::string("More"), mParentFloaterHandle); + mSpilloverMenu = new LLMenuGL(std::string("More"), std::string("More")); mSpilloverMenu->updateParent(LLMenuGL::sMenuContainer); // Inherit colors mSpilloverMenu->setBackgroundColor( mBackgroundColor ); - mSpilloverMenu->setCanTearOff(FALSE); mSpilloverBranch = new LLMenuItemBranchGL(std::string("More"), std::string("More"), mSpilloverMenu->getHandle()); mSpilloverBranch->setFontStyle(LLFontGL::ITALIC); @@ -2360,22 +2563,12 @@ void LLMenuGL::cleanupSpilloverBranch() // head-recursion to propagate items back up to root menu mSpilloverMenu->cleanupSpilloverBranch(); - removeChild(mSpilloverBranch); - - item_list_t::iterator found_iter = std::find(mItems.begin(), mItems.end(), mSpilloverBranch); - if (found_iter != mItems.end()) - { - mItems.erase(found_iter); - } - // pop off spillover items while (mSpilloverMenu->getItemCount()) { LLMenuItemGL* itemp = mSpilloverMenu->getItem(0); mSpilloverMenu->removeChild(itemp); - mSpilloverMenu->mItems.erase(mSpilloverMenu->mItems.begin()); // put them at the end of our own list - mItems.push_back(itemp); addChild(itemp); } @@ -2489,6 +2682,7 @@ void LLMenuGL::empty( void ) cleanupSpilloverBranch(); mItems.clear(); + mFirstVisibleItem = NULL; deleteAllChildren(); @@ -2511,9 +2705,6 @@ BOOL LLMenuGL::handleJumpKey(KEY key) // switch to keyboard navigation mode LLMenuGL::setKeyboardMode(TRUE); - // force highlight to close old menus and any open sub-menus - - //clearHoverItem(); // force highlight to close old menus and open and sub-menus found_it->second->setHighlight(TRUE); found_it->second->doIt(); @@ -2528,40 +2719,18 @@ BOOL LLMenuGL::handleJumpKey(KEY key) // Add the menu item to this menu. BOOL LLMenuGL::append( LLMenuItemGL* item ) { - if (mSpilloverMenu) - { - return mSpilloverMenu->append(item); - } - + if (!item) return FALSE; mItems.push_back( item ); - addChild( item ); + LLUICtrl::addChild(item); needsArrange(); return TRUE; } -// *NOTE:Mani - appendNoArrange() should be removed when merging to skinning/viewer2.0 -// Its added as a fix to a viewer 1.23 bug that has already been address by skinning work. -BOOL LLMenuGL::appendNoArrange( LLMenuItemGL* item ) -{ - if (mSpilloverMenu) - { - return mSpilloverMenu->append(item); - } - - mItems.push_back( item ); - addChild( item ); - return TRUE; -} - // add a separator to this menu -BOOL LLMenuGL::appendSeparator( const std::string &separator_name ) +BOOL LLMenuGL::addSeparator() { - LLMenuItemGL* separator; - if (separator_name.empty()) - separator = new LLMenuItemSeparatorGL(std::string("separator")); - else - separator = new LLMenuItemSeparatorGL(separator_name); - return append( separator ); + LLMenuItemGL* separator = new LLMenuItemSeparatorGL(); + return addChild(separator); } // add a menu - this will create a cascading menu @@ -2581,35 +2750,10 @@ BOOL LLMenuGL::appendMenu( LLMenuGL* menu ) // Inherit colors menu->setBackgroundColor( mBackgroundColor ); - + menu->updateParent(LLMenuGL::sMenuContainer); return success; } -// Remove a menu item from this menu. -BOOL LLMenuGL::remove( LLMenuItemGL* item ) -{ - if (mSpilloverMenu) - { - cleanupSpilloverBranch(); - } - - item_list_t::iterator found_iter = std::find(mItems.begin(), mItems.end(), item); - if (found_iter != mItems.end()) - { - mItems.erase(found_iter); - } - - removeChild( item ); - - // We keep it around in case someone is pointing at it. - // The caller can delete it if it's safe. - // Note that getMenu() will still not work since its parent isn't a menu. - sMenuContainer->addChild( item ); - - needsArrange(); - return TRUE; -} - void LLMenuGL::setEnabledSubMenus(BOOL enable) { setEnabled(enable); @@ -2709,6 +2853,7 @@ LLMenuItemGL* LLMenuGL::getHighlightedItem() LLMenuItemGL* LLMenuGL::highlightNextItem(LLMenuItemGL* cur_item, BOOL skip_disabled) { + if (mItems.empty()) return NULL; // highlighting first item on a torn off menu is the // same as giving focus to it if (!cur_item && getTornOff()) @@ -2716,14 +2861,8 @@ LLMenuItemGL* LLMenuGL::highlightNextItem(LLMenuItemGL* cur_item, BOOL skip_disa ((LLFloater*)getParent())->setFocus(TRUE); } - item_list_t::iterator cur_item_iter; - for (cur_item_iter = mItems.begin(); cur_item_iter != mItems.end(); ++cur_item_iter) - { - if( (*cur_item_iter) == cur_item) - { - break; - } - } + // Current item position in the items list + item_list_t::iterator cur_item_iter = std::find(mItems.begin(), mItems.end(), cur_item); item_list_t::iterator next_item_iter; if (cur_item_iter == mItems.end()) @@ -2734,6 +2873,10 @@ LLMenuItemGL* LLMenuGL::highlightNextItem(LLMenuItemGL* cur_item, BOOL skip_disa { next_item_iter = cur_item_iter; next_item_iter++; + + // First visible item position in the items list + item_list_t::iterator first_visible_item_iter = std::find(mItems.begin(), mItems.end(), mFirstVisibleItem); + if (next_item_iter == mItems.end()) { next_item_iter = mItems.begin(); @@ -2755,7 +2898,7 @@ LLMenuItemGL* LLMenuGL::highlightNextItem(LLMenuItemGL* cur_item, BOOL skip_disa while(1) { // skip separators and disabled/invisible items - if ((*next_item_iter)->getEnabled() && (*next_item_iter)->getVisible() && (*next_item_iter)->getType() != SEPARATOR_NAME) + if ((*next_item_iter)->getEnabled() && (*next_item_iter)->getVisible() && !dynamic_cast(*next_item_iter)) { if (cur_item) { @@ -2787,6 +2930,8 @@ LLMenuItemGL* LLMenuGL::highlightNextItem(LLMenuItemGL* cur_item, BOOL skip_disa LLMenuItemGL* LLMenuGL::highlightPrevItem(LLMenuItemGL* cur_item, BOOL skip_disabled) { + if (mItems.empty()) return NULL; + // highlighting first item on a torn off menu is the // same as giving focus to it if (!cur_item && getTornOff()) @@ -2794,14 +2939,8 @@ LLMenuItemGL* LLMenuGL::highlightPrevItem(LLMenuItemGL* cur_item, BOOL skip_disa ((LLFloater*)getParent())->setFocus(TRUE); } - item_list_t::reverse_iterator cur_item_iter; - for (cur_item_iter = mItems.rbegin(); cur_item_iter != mItems.rend(); ++cur_item_iter) - { - if( (*cur_item_iter) == cur_item) - { - break; - } - } + // Current item reverse position from the end of the list + item_list_t::reverse_iterator cur_item_iter = std::find(mItems.rbegin(), mItems.rend(), cur_item); item_list_t::reverse_iterator prev_item_iter; if (cur_item_iter == mItems.rend()) @@ -2812,6 +2951,10 @@ LLMenuItemGL* LLMenuGL::highlightPrevItem(LLMenuItemGL* cur_item, BOOL skip_disa { prev_item_iter = cur_item_iter; prev_item_iter++; + + // First visible item reverse position in the items list + item_list_t::reverse_iterator first_visible_item_iter = std::find(mItems.rbegin(), mItems.rend(), mFirstVisibleItem); + if (prev_item_iter == mItems.rend()) { prev_item_iter = mItems.rbegin(); @@ -2821,7 +2964,7 @@ LLMenuItemGL* LLMenuGL::highlightPrevItem(LLMenuItemGL* cur_item, BOOL skip_disa while(1) { // skip separators and disabled/invisible items - if ((*prev_item_iter)->getEnabled() && (*prev_item_iter)->getVisible() && (*prev_item_iter)->getType() != SEPARATOR_NAME) + if ((*prev_item_iter)->getEnabled() && (*prev_item_iter)->getVisible() && (*prev_item_iter)->getName() != SEPARATOR_NAME) { (*prev_item_iter)->setHighlight(TRUE); return (*prev_item_iter); @@ -2862,17 +3005,15 @@ void LLMenuGL::updateParent(LLView* parentp) { getParent()->removeChild(this); } - parentp->addChild(this); + if (parentp) + { + parentp->addChild(this); + } item_list_t::iterator item_iter; for (item_iter = mItems.begin(); item_iter != mItems.end(); ++item_iter) { (*item_iter)->updateBranchParent(parentp); } - - if (mSpilloverMenu) - { - mSpilloverMenu->updateParent(parentp); - } } BOOL LLMenuGL::handleAcceleratorKey(KEY key, MASK mask) @@ -2965,14 +3106,25 @@ BOOL LLMenuGL::handleHover( S32 x, S32 y, MASK mask ) ((LLMenuItemGL*)viewp)->setHighlight(TRUE); LLMenuGL::setKeyboardMode(FALSE); } - mHasSelection = TRUE; + mHasSelection = true; } } } getWindow()->setCursor(UI_CURSOR_ARROW); + + // *HACK Release the mouse capture + // This is done to release the mouse after the Navigation Bar "Back" or "Forward" button + // drop-down menu is shown. Otherwise any other view won't be able to handle mouse events + // until the user chooses one of the drop-down menu items. + return TRUE; } +BOOL LLMenuGL::handleScrollWheel( S32 x, S32 y, S32 clicks ) +{ + return blockMouseEvent(x, y); +} + void LLMenuGL::draw( void ) { if (mNeedsArrange) @@ -2993,6 +3145,20 @@ void LLMenuGL::draw( void ) { gl_rect_2d( 0, getRect().getHeight(), getRect().getWidth(), 0, mBackgroundColor ); } + + + /*LLRect rootRect = getRootView()->getRect(); + for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it) + { + LLMenuItemGL* itemp = static_cast(*child_it); + if(itemp) + { + LLRect screenRect; + localRectToScreen(itemp->getRect(),&screenRect); + lldebugs << itemp->getName() << "Visible:" << itemp->getVisible() << " ValidRect: " << itemp->getRect().isValid() << " Overlaps: " << rootRect.overlaps(screenRect) << llendl; + } + }*/ + LLView::draw(); } @@ -3007,8 +3173,10 @@ void LLMenuGL::setVisible(BOOL visible) { if (visible != getVisible()) { + LLView::setVisible(visible); if (!visible) { + lldebugs << "Hiding " << getName() << llendl; mFadeTimer.start(); clearHoverItem(); // reset last known mouse coordinates so @@ -3017,12 +3185,11 @@ void LLMenuGL::setVisible(BOOL visible) mLastMouseY = 0; } else - { - mHasSelection = FALSE; + { + lldebugs << "Showing " << getName() << llendl; + mHasSelection = true; mFadeTimer.stop(); } - - LLView::setVisible(visible); } } @@ -3067,48 +3234,60 @@ void hide_top_view( LLView* view ) } +// x and y are the desired location for the popup, in the spawning_view's +// coordinate frame, NOT necessarily the mouse location // static void LLMenuGL::showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y) { - const LLRect menu_region_rect = LLMenuGL::sMenuContainer->getMenuRect(); + const S32 CURSOR_HEIGHT = 22; // Approximate "normal" cursor size + const S32 CURSOR_WIDTH = 12; + + if(menu->getChildList()->empty()) + { + return; + } + + // Save click point for detecting cursor moves before mouse-up. + // Must be in local coords to compare with mouseUp events. + // If the mouse doesn't move, the menu will stay open ala the Mac. + // See also LLContextMenu::show() + S32 mouse_x, mouse_y; + + // Resetting scrolling position + if (menu->isScrollable() && menu->isScrollPositionOnShowReset()) + { + menu->mFirstVisibleItem = NULL; + } + + menu->setVisible( TRUE ); + + // Fix menu rect if needed. + menu->needsArrange(); + menu->arrangeAndClear(); + + LLUI::getMousePositionLocal(menu->getParent(), &mouse_x, &mouse_y); + LLMenuHolderGL::sContextMenuSpawnPos.set(mouse_x,mouse_y); + + const LLRect menu_region_rect = LLMenuGL::sMenuContainer->getRect(); const S32 HPAD = 2; LLRect rect = menu->getRect(); - //LLView* cur_view = spawning_view; S32 left = x + HPAD; S32 top = y; spawning_view->localPointToOtherView(left, top, &left, &top, menu->getParent()); rect.setLeftTopAndSize( left, top, rect.getWidth(), rect.getHeight() ); - - - //rect.setLeftTopAndSize(x + HPAD, y, rect.getWidth(), rect.getHeight()); menu->setRect( rect ); - S32 bottom; - left = rect.mLeft; - bottom = rect.mBottom; - //menu->getParent()->localPointToScreen( rect.mLeft, rect.mBottom, - // &left, &bottom ); - S32 delta_x = 0; - S32 delta_y = 0; - if( bottom < menu_region_rect.mBottom ) - { - // At this point, we need to move the context menu to the - // other side of the mouse. - //delta_y = menu_region_rect.mBottom - bottom; - delta_y = (rect.getHeight() + 2 * HPAD); - } - if( left > menu_region_rect.mRight - rect.getWidth() ) - { - // At this point, we need to move the context menu to the - // other side of the mouse. - //delta_x = (window_width - rect.getWidth()) - x; - delta_x = -(rect.getWidth() + 2 * HPAD); - } - menu->translate( delta_x, delta_y ); - menu->setVisible( TRUE ); + // Adjust context menu to fit onscreen + LLRect mouse_rect; + const S32 MOUSE_CURSOR_PADDING = 5; + mouse_rect.setLeftTopAndSize(mouse_x - MOUSE_CURSOR_PADDING, + mouse_y + MOUSE_CURSOR_PADDING, + CURSOR_WIDTH + MOUSE_CURSOR_PADDING * 2, + CURSOR_HEIGHT + MOUSE_CURSOR_PADDING * 2); + menu->translateIntoRectWithExclusion( menu_region_rect, mouse_rect, FALSE ); menu->getParent()->sendChildToFront(menu); } @@ -3218,7 +3397,6 @@ LLPieMenu::LLPieMenu(const std::string& name, const std::string& label) mRightMouseDown(FALSE) { LLMenuGL::setVisible(FALSE); - setCanTearOff(FALSE); } LLPieMenu::LLPieMenu(const std::string& name) @@ -3233,7 +3411,6 @@ LLPieMenu::LLPieMenu(const std::string& name) mRightMouseDown(FALSE) { LLMenuGL::setVisible(FALSE); - setCanTearOff(FALSE); } @@ -3635,7 +3812,7 @@ BOOL LLPieMenu::append(LLMenuItemGL *item) } // virtual -BOOL LLPieMenu::appendSeparator(const std::string &separator_name) +BOOL LLPieMenu::addSeparator() { LLMenuItemGL* separator = new LLMenuItemBlankGL(); separator->setFont( LLFontGL::getFontSansSerifSmall() ); @@ -3916,10 +4093,10 @@ void LLPieMenu::hide(BOOL item_selected) static LLRegisterWidget r2("menu_bar"); // Default constructor -LLMenuBarGL::LLMenuBarGL( const std::string& name ) : LLMenuGL ( name, name ) +LLMenuBarGL::LLMenuBarGL( const std::string& name ) +: LLMenuGL ( name, name ) { mHorizontalLayout = TRUE; - setCanTearOff(FALSE); mKeepFixedSize = TRUE; mAltKeyTrigger = FALSE; } @@ -4004,13 +4181,6 @@ LLView* LLMenuBarGL::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory if (child->hasName("menu")) { LLMenuGL *menu = (LLMenuGL*)LLMenuGL::fromXML(child, parent, factory); - // because of lazy initialization, have to disable tear off functionality - // and then re-enable with proper parent handle - if (menu->getCanTearOff()) - { - menu->setCanTearOff(FALSE); - menu->setCanTearOff(TRUE, parent_handle); - } menubar->appendMenu(menu); if (LLMenuGL::sMenuContainer != NULL) { @@ -4050,7 +4220,9 @@ BOOL LLMenuBarGL::handleAcceleratorKey(KEY key, MASK mask) mAltKeyTrigger = FALSE; } - if(!result && (key == KEY_F10 && mask == MASK_CONTROL) && !gKeyboard->getKeyRepeated(key)) + if(!result + && (key == KEY_F10 && mask == MASK_CONTROL) + && !gKeyboard->getKeyRepeated(key)) { if (getHighlightedItem()) { @@ -4121,19 +4293,22 @@ BOOL LLMenuBarGL::handleMouseDown(S32 x, S32 y, MASK mask) return LLMenuGL::handleMouseDown(x, y, mask); } -BOOL LLMenuBarGL::handleRightMouseDown(S32 x, S32 y, MASK mask) +void LLMenuBarGL::setVisible(BOOL visible) { - // clicks on menu bar closes existing menus from other contexts but leave - // own menu open so that we get toggle behavior - if (!getHighlightedItem() || !getHighlightedItem()->isActive()) + if(visible != getVisible()) { - LLMenuGL::sMenuContainer->hideMenus(); + if(!visible) + { + lldebugs << "Hiding " << getName() << llendl; + } + else + { + lldebugs << "Showing " << getName() << llendl; + } } - - return LLMenuGL::handleMouseDown(x, y, mask); + LLUICtrl::setVisible(visible); } - void LLMenuBarGL::draw() { LLMenuItemGL* itemp = getHighlightedItem(); @@ -4227,7 +4402,7 @@ S32 LLMenuBarGL::getRightmostMenuEdge() } // add a vertical separator to this menu -BOOL LLMenuBarGL::appendSeparator( const std::string &separator_name ) +BOOL LLMenuBarGL::addSeparator() { LLMenuItemGL* separator = new LLMenuItemVerticalSeparatorGL(); return append( separator ); @@ -4249,6 +4424,8 @@ BOOL LLMenuBarGL::appendMenu( LLMenuGL* menu ) success &= branch->addToAcceleratorList(&mAccelerators); success &= append( branch ); branch->setJumpKey(branch->getJumpKey()); + menu->updateParent(LLMenuGL::sMenuContainer); + return success; } @@ -4325,6 +4502,7 @@ BOOL LLMenuBarGL::handleHover( S32 x, S32 y, MASK mask ) ///============================================================================ /// Class LLMenuHolderGL ///============================================================================ +LLCoordGL LLMenuHolderGL::sContextMenuSpawnPos(S32_MAX, S32_MAX); LLMenuHolderGL::LLMenuHolderGL() : LLPanel(std::string("Menu Holder")) { @@ -4347,7 +4525,7 @@ void LLMenuHolderGL::draw() LLView::draw(); // now draw last selected item as overlay LLMenuItemGL* selecteditem = (LLMenuItemGL*)sItemLastSelectedHandle.get(); - if (selecteditem && sItemActivationTimer.getStarted() && sItemActivationTimer.getElapsedTimeF32() < ACTIVATE_HIGHLIGHT_TIME) + if (selecteditem && selecteditem->getVisible() && sItemActivationTimer.getStarted() && sItemActivationTimer.getElapsedTimeF32() < ACTIVATE_HIGHLIGHT_TIME) { // make sure toggle items, for example, show the proper state when fading out selecteditem->buildDrawLabel(); @@ -4356,10 +4534,10 @@ void LLMenuHolderGL::draw() selecteditem->localRectToOtherView(selecteditem->getLocalRect(), &item_rect, this); F32 interpolant = sItemActivationTimer.getElapsedTimeF32() / ACTIVATE_HIGHLIGHT_TIME; - F32 alpha = lerp(LLMenuItemGL::getHighlightBGColor().mV[VALPHA], 0.f, interpolant); - LLColor4 bg_color(LLMenuItemGL::getHighlightBGColor().mV[VRED], - LLMenuItemGL::getHighlightBGColor().mV[VGREEN], - LLMenuItemGL::getHighlightBGColor().mV[VBLUE], + F32 alpha = lerp(LLMenuItemGL::sHighlightBackground.mV[VALPHA], 0.f, interpolant); + LLColor4 bg_color(LLMenuItemGL::sHighlightBackground.mV[VRED], + LLMenuItemGL::sHighlightBackground.mV[VGREEN], + LLMenuItemGL::sHighlightBackground.mV[VBLUE], alpha); LLUI::pushMatrix(); @@ -4394,6 +4572,68 @@ BOOL LLMenuHolderGL::handleRightMouseDown( S32 x, S32 y, MASK mask ) return handled; } +// This occurs when you mouse-down to spawn a context menu, hold the button +// down, move off the menu, then mouse-up. We want this to close the menu. +BOOL LLMenuHolderGL::handleRightMouseUp( S32 x, S32 y, MASK mask ) +{ + const S32 SLOP = 2; + S32 spawn_dx = (x - sContextMenuSpawnPos.mX); + S32 spawn_dy = (y - sContextMenuSpawnPos.mY); + if (-SLOP <= spawn_dx && spawn_dx <= SLOP + && -SLOP <= spawn_dy && spawn_dy <= SLOP) + { + // we're still inside the slop region from spawning this menu + // so interpret the mouse-up as a single-click to show and leave on + // screen + sContextMenuSpawnPos.set(S32_MAX, S32_MAX); + return TRUE; + } + + BOOL handled = LLView::childrenHandleRightMouseUp(x, y, mask) != NULL; + if (!handled) + { + // clicked off of menu, hide them all + hideMenus(); + } + return handled; +} + +BOOL LLMenuHolderGL::handleKey(KEY key, MASK mask, BOOL called_from_parent) +{ + BOOL handled = false; + LLMenuGL* const pMenu = dynamic_cast(getVisibleMenu()); + + if (pMenu) + { + //eat TAB key - EXT-7000 + if (key == KEY_TAB && mask == MASK_NONE) + { + return TRUE; + } + + //handle ESCAPE and RETURN key + handled = LLPanel::handleKey(key, mask, called_from_parent); + if (!handled) + { + if (pMenu->getHighlightedItem()) + { + handled = pMenu->handleKey(key, mask, TRUE); + } + else + { + //highlight first enabled one + if(pMenu->highlightNextItem(NULL)) + { + handled = true; + } + } + } + } + + return handled; + +} + void LLMenuHolderGL::reshape(S32 width, S32 height, BOOL called_from_parent) { if (width != getRect().getWidth() || height != getRect().getHeight()) @@ -4403,17 +4643,17 @@ void LLMenuHolderGL::reshape(S32 width, S32 height, BOOL called_from_parent) LLView::reshape(width, height, called_from_parent); } -BOOL LLMenuHolderGL::hasVisibleMenu() const +LLView* const LLMenuHolderGL::getVisibleMenu() const { for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it) { LLView* viewp = *child_it; - if (viewp->getVisible() && dynamic_cast(viewp) == NULL) + if (viewp->getVisible() && dynamic_cast(viewp) != NULL) { - return TRUE; + return viewp; } } - return FALSE; + return NULL; } @@ -4434,8 +4674,7 @@ BOOL LLMenuHolderGL::hideMenus() for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it) { LLView* viewp = *child_it; - // clicks off of menu do not hide menu bar - if (dynamic_cast(viewp) == NULL && viewp->getVisible()) + if (dynamic_cast(viewp) != NULL && viewp->getVisible() && !dynamic_cast(viewp)) { viewp->setVisible(FALSE); } @@ -4461,6 +4700,11 @@ void LLMenuHolderGL::setActivatedItem(LLMenuItemGL* item) LLTearOffMenu::LLTearOffMenu(LLMenuGL* menup) : LLFloater(menup->getName(), LLRect(0, 100, 100, 0), menup->getLabel(), FALSE, DEFAULT_MIN_WIDTH, DEFAULT_MIN_HEIGHT, FALSE, FALSE) { + //S32 floater_header_size = LLFLOATER_HEADER_SIZE; + + setName(menup->getName()); + setTitle(menup->getLabel()); + setCanMinimize(FALSE); // flag menu as being torn off menup->setTornOff(TRUE); // update menu layout as torn off menu (no spillover menus) diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h index 94fab5b16..b8a5f614d 100644 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h @@ -76,32 +76,40 @@ typedef void (*label_callback)(std::string&,void*); // The LLMenuItemGL represents a single menu item in a menu. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLMenuItemGL : public LLView +class LLMenuItemGL : public LLUICtrl { public: // static functions to control the global color scheme. - static void setEnabledColor( const LLColor4& color ) { sEnabledColor = color; } + /*static void setEnabledColor( const LLColor4& color ) { sEnabledColor = color; } static const LLColor4& getEnabledColor() { return sEnabledColor; } static void setDisabledColor( const LLColor4& color ) { sDisabledColor = color; } static const LLColor4& getDisabledColor() { return sDisabledColor; } static void setHighlightBGColor( const LLColor4& color ) { sHighlightBackground = color; } static const LLColor4& getHighlightBGColor() { return sHighlightBackground; } static void setHighlightFGColor( const LLColor4& color ) { sHighlightForeground = color; } - static const LLColor4& getHighlightFGColor() { return sHighlightForeground; } + static const LLColor4& getHighlightFGColor() { return sHighlightForeground; }*/ LLMenuItemGL( const std::string& name, const std::string& label, KEY key = KEY_NONE, MASK = MASK_NONE ); - virtual ~LLMenuItemGL() {}; + virtual ~LLMenuItemGL(); - virtual void setValue(const LLSD& value) { setLabel(value.asString()); } virtual LLXMLNodePtr getXML(bool save_children = true) const; virtual std::string getType() const { return "item"; } - virtual BOOL handleHover(S32 x, S32 y, MASK mask); + /*virtual*/ void handleVisibilityChange(BOOL new_visibility); + /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleRightMouseUp(S32 x, S32 y, MASK mask); + + // LLUICtrl overrides + /*virtual*/ void setValue(const LLSD& value); + /*virtual*/ LLSD getValue() const; virtual BOOL handleAcceleratorKey(KEY key, MASK mask); + LLColor4 getHighlightBgColor() { return mHighlightBackground; } + void setJumpKey(KEY key); KEY getJumpKey() const { return mJumpKey; } @@ -115,8 +123,8 @@ public: virtual U32 getNominalHeight( void ) const; // Marks item as not needing space for check marks or accelerator keys - virtual void setBriefItem(BOOL brief) { mBriefItem = brief; } - virtual BOOL isBriefItem() const { return mBriefItem; } + virtual void setBriefItem(BOOL brief); + virtual BOOL isBriefItem() const; virtual BOOL addToAcceleratorList(std::list *listp); void setAllowKeyRepeat(BOOL allow) { mAllowKeyRepeat = allow; } @@ -128,7 +136,7 @@ public: virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ); // Get the parent menu for this item - virtual class LLMenuGL* getMenu(); + virtual class LLMenuGL* getMenu() const; // returns the normal width of this control in pixels - this is // used for calculating the widest item, as well as for horizontal @@ -167,6 +175,7 @@ public: virtual BOOL handleKeyHere( KEY key, MASK mask ); virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask ); virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask ); + virtual BOOL handleScrollWheel( S32 x, S32 y, S32 clicks ); virtual void draw( void ); BOOL getHover() const { return mGotHover; } @@ -193,13 +202,19 @@ protected: LLUIString mDrawAccelLabel; LLUIString mDrawBranchLabel; + LLColor4 mEnabledColor; + LLColor4 mDisabledColor; + LLColor4 mHighlightBackground; + LLColor4 mHighlightForeground; + BOOL mHighlight; -private: +public: static LLColor4 sEnabledColor; static LLColor4 sDisabledColor; static LLColor4 sHighlightBackground; static LLColor4 sHighlightForeground; +private: // Keyboard and mouse variables BOOL mAllowKeyRepeat; BOOL mGotHover; @@ -302,6 +317,9 @@ public: void setUserData(void *userdata) { mUserData = userdata; } void* getUserData() const { return mUserData; } +protected: + void updateEnabled( void ); +public: // called to rebuild the draw label virtual void buildDrawLabel( void ); @@ -309,7 +327,8 @@ public: virtual void doIt( void ); virtual BOOL handleAcceleratorKey(KEY key, MASK mask); - + virtual BOOL handleKeyHere(KEY key, MASK mask); + //virtual void draw(); @@ -427,24 +446,35 @@ class LLMenuGL // TODO: The menu and menu item classes share a great deal of functionality and perhaps should be united. // I think it may make the most sense to make LLMenuGL be a subclass of LLMenuItemGL. -MG { +public: + // textual artwork which menugl-imitators may want to match + static const std::string BOOLEAN_TRUE_PREFIX; + static const std::string BRANCH_SUFFIX; + static const std::string ARROW_UP; + static const std::string ARROW_DOWN; + +protected: // let branching menu items use my protected traversal methods friend class LLMenuItemBranchGL; public: - LLMenuGL( const std::string& name, const std::string& label, LLHandle parent_floater = LLHandle()); - LLMenuGL( const std::string& label, LLHandle parent_floater = LLHandle() ); + LLMenuGL( const std::string& name, const std::string& label); + LLMenuGL( const std::string& label); virtual ~LLMenuGL( void ); virtual LLXMLNodePtr getXML(bool save_children = true) const; static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); void parseChildXML(LLXMLNodePtr child, LLView *parent, LLUICtrlFactory *factory); - // LLView Functionality - virtual BOOL handleUnicodeCharHere( llwchar uni_char ); - virtual BOOL handleHover( S32 x, S32 y, MASK mask ); - virtual void draw( void ); + /*virtual*/ BOOL handleUnicodeCharHere( llwchar uni_char ); + /*virtual*/ BOOL handleHover( S32 x, S32 y, MASK mask ); + /*virtual*/ BOOL handleScrollWheel( S32 x, S32 y, S32 clicks ); + /*virtual*/ void draw( void ); virtual void drawBackground(LLMenuItemGL* itemp, LLColor4& color); - virtual void setVisible(BOOL visible); + /*virtual*/ void setVisible(BOOL visible); + /*virtual*/ bool addChild(LLView* view, S32 tab_group = 0); + /*virtual*/ void removeChild( LLView* ctrl); + /*virtual*/ BOOL postBuild(); virtual BOOL handleAcceleratorKey(KEY key, MASK mask); @@ -461,23 +491,10 @@ public: void setBackgroundColor( const LLColor4& color ) { mBackgroundColor = color; } const LLColor4& getBackgroundColor() const { return mBackgroundColor; } void setBackgroundVisible( BOOL b ) { mBgVisible = b; } - void setCanTearOff(BOOL tear_off, LLHandle parent_floater_handle = LLHandle()); - - // Add the menu item to this menu. - virtual BOOL append( LLMenuItemGL* item ); - - // Remove a menu item from this menu. - virtual BOOL remove( LLMenuItemGL* item ); - - // *NOTE:Mani - appendNoArrange() should be removed when merging to skinning/viewer2.0 - // Its added as a fix to a viewer 1.23 bug that has already been address by skinning work. - virtual BOOL appendNoArrange( LLMenuItemGL* item ); + void setCanTearOff(BOOL tear_off); // add a separator to this menu - virtual BOOL appendSeparator( const std::string &separator_name = LLStringUtil::null ); - - // add a menu - this will create a cascading menu - virtual BOOL appendMenu( LLMenuGL* menu ); + virtual BOOL addSeparator(); // for branching menu items, bring sub menus up to root level of menu hierarchy virtual void updateParent( LLView* parentp ); @@ -512,10 +529,6 @@ public: // remove all items on the menu void empty( void ); - // Rearrange the components, and do the right thing if the menu doesn't - // fit in the bounds. - // virtual void arrangeWithBounds(LLRect bounds); - void setItemLastSelected(LLMenuItemGL* item); // must be in menu U32 getItemCount(); // number of menu items LLMenuItemGL* getItem(S32 number); // 0 = first item @@ -550,15 +563,26 @@ public: static void setKeyboardMode(BOOL mode) { sKeyboardMode = mode; } static BOOL getKeyboardMode() { return sKeyboardMode; } + S32 getShortcutPad() { return mShortcutPad; } + BOOL isScrollable() const { return FALSE; } + static class LLMenuHolderGL* sMenuContainer; + bool isScrollPositionOnShowReset() { return false; } protected: void createSpilloverBranch(); void cleanupSpilloverBranch(); + // Add the menu item to this menu. + virtual BOOL append( LLMenuItemGL* item ); + + // add a menu - this will create a cascading menu + virtual BOOL appendMenu( LLMenuGL* menu ); // TODO: create accessor methods for these? typedef std::list< LLMenuItemGL* > item_list_t; item_list_t mItems; + LLMenuItemGL*mFirstVisibleItem; + typedef std::map navigation_key_map_t; navigation_key_map_t mJumpKeys; S32 mLastMouseX; @@ -578,14 +602,14 @@ private: LLHandle mParentMenuItem; LLUIString mLabel; BOOL mDropShadowed; // Whether to drop shadow - BOOL mHasSelection; + bool mHasSelection; LLFrameTimer mFadeTimer; BOOL mTornOff; class LLMenuItemTearOffGL* mTearOffItem; class LLMenuItemBranchGL* mSpilloverBranch; LLMenuGL* mSpilloverMenu; - LLHandle mParentFloaterHandle; KEY mJumpKey; + S32 mShortcutPad; }; // end class LLMenuGL @@ -631,11 +655,11 @@ public: virtual BOOL handleKeyHere(KEY key, MASK mask); - virtual BOOL isActive() const { return isOpen() && getBranch()->getHighlightedItem(); } + virtual BOOL isActive() const; - virtual BOOL isOpen() const { return getBranch() && getBranch()->isOpen(); } + virtual BOOL isOpen() const; - LLMenuGL *getBranch() const { return (LLMenuGL*)(mBranch.get()); } + LLMenuGL* getBranch() const { return (LLMenuGL*)mBranchHandle.get(); } virtual void updateBranchParent( LLView* parentp ); @@ -651,7 +675,7 @@ public: virtual LLView* getChildView(const std::string& name, BOOL recurse = TRUE, BOOL create_if_missing = TRUE) const; private: - LLHandle mBranch; + LLHandle mBranchHandle; }; // end class LLMenuItemBranchGL @@ -684,8 +708,10 @@ public: virtual void draw(); virtual void drawBackground(LLMenuItemGL* itemp, LLColor4& color); +private: virtual BOOL append(LLMenuItemGL* item); - virtual BOOL appendSeparator( const std::string &separator_name = LLStringUtil::null ); +public: + virtual BOOL addSeparator(); BOOL appendPieMenu(LLPieMenu *menu); @@ -730,23 +756,17 @@ public: virtual LLXMLNodePtr getXML(bool save_children = true) const; static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); - virtual BOOL handleAcceleratorKey(KEY key, MASK mask); - virtual BOOL handleKeyHere(KEY key, MASK mask); - virtual BOOL handleJumpKey(KEY key); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); + void setVisible(BOOL visible); + /*virtual*/ BOOL handleAcceleratorKey(KEY key, MASK mask); + /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); + /*virtual*/ BOOL handleJumpKey(KEY key); + /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); - // rearrange the child rects so they fit the shape of the menu - // bar. - virtual void arrange( void ); - virtual void draw(); - virtual BOOL jumpKeysActive(); + /*virtual*/ void draw(); + /*virtual*/ BOOL jumpKeysActive(); // add a vertical separator to this menu - virtual BOOL appendSeparator( const std::string &separator_name = LLStringUtil::null ); - - // add a menu - this will create a drop down menu. - virtual BOOL appendMenu( LLMenuGL* menu ); + virtual BOOL addSeparator(); // LLView Functionality virtual BOOL handleHover( S32 x, S32 y, MASK mask ); @@ -757,6 +777,12 @@ public: void resetMenuTrigger() { mAltKeyTrigger = FALSE; } private: + // add a menu - this will create a drop down menu. + virtual BOOL appendMenu( LLMenuGL* menu ); + // rearrange the child rects so they fit the shape of the menu + // bar. + virtual void arrange( void ); + void checkMenuTrigger(); std::list mAccelerators; @@ -784,11 +810,20 @@ public: virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask ); virtual BOOL handleRightMouseDown( S32 x, S32 y, MASK mask ); + // Close context menus on right mouse up not handled by menus. + /*virtual*/ BOOL handleRightMouseUp( S32 x, S32 y, MASK mask ); + + virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); virtual const LLRect getMenuRect() const { return getLocalRect(); } - virtual BOOL hasVisibleMenu() const; + LLView*const getVisibleMenu() const; + virtual BOOL hasVisibleMenu() const {return getVisibleMenu() != NULL;} static void setActivatedItem(LLMenuItemGL* item); + // Need to detect if mouse-up after context menu spawn has moved. + // If not, need to keep the menu up. + static LLCoordGL sContextMenuSpawnPos; + private: static LLHandle sItemLastSelectedHandle; static LLFrameTimer sItemActivationTimer; @@ -832,7 +867,7 @@ private: class LLMenuItemTearOffGL : public LLMenuItemGL { public: - LLMenuItemTearOffGL( LLHandle parent_floater_handle = LLHandle()); + LLMenuItemTearOffGL(); virtual LLXMLNodePtr getXML(bool save_children = true) const; virtual std::string getType() const { return "tearoff_menu"; } @@ -841,8 +876,7 @@ public: virtual void draw(void); virtual U32 getNominalHeight() const; -private: - LLHandle mParentHandle; + LLFloater* getParentFloater(); }; diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index cd9d06c58..bc6d176c5 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -356,12 +356,12 @@ LLTextEditor::LLTextEditor( { menu = new LLMenuGL(LLStringUtil::null); }*/ - menu->append(new LLMenuItemCallGL("Cut", context_cut, NULL, this)); - menu->append(new LLMenuItemCallGL("Copy", context_copy, NULL, this)); - menu->append(new LLMenuItemCallGL("Paste", context_paste, NULL, this)); - menu->append(new LLMenuItemCallGL("Delete", context_delete, NULL, this)); - menu->append(new LLMenuItemCallGL("Select All", context_selectall, NULL, this)); - menu->appendSeparator("Spelsep"); + menu->addChild(new LLMenuItemCallGL("Cut", context_cut, NULL, this)); + menu->addChild(new LLMenuItemCallGL("Copy", context_copy, NULL, this)); + menu->addChild(new LLMenuItemCallGL("Paste", context_paste, NULL, this)); + menu->addChild(new LLMenuItemCallGL("Delete", context_delete, NULL, this)); + menu->addChild(new LLMenuItemCallGL("Select All", context_selectall, NULL, this)); + menu->addSeparator(); menu->setCanTearOff(FALSE); menu->setVisible(FALSE); mPopupMenuHandle = menu->getHandle(); @@ -1389,7 +1389,7 @@ BOOL LLTextEditor::handleRightMouseDown( S32 x, S32 y, MASK mask ) SpellMenuBind * tempBind = suggestionMenuItems[i]; if(tempBind) { - menu->remove(tempBind->menuItem); + menu->removeChild(tempBind->menuItem); tempBind->menuItem->die(); //delete tempBind->menuItem; //tempBind->menuItem = NULL; @@ -1425,7 +1425,7 @@ BOOL LLTextEditor::handleRightMouseDown( S32 x, S32 y, MASK mask ) tempStruct->word, spell_correct, NULL, tempStruct); tempStruct->menuItem = suggMenuItem; suggestionMenuItems.push_back(tempStruct); - menu->append(suggMenuItem); + menu->addChild(suggMenuItem); } SpellMenuBind * tempStruct = new SpellMenuBind; tempStruct->origin = this; @@ -1437,7 +1437,7 @@ BOOL LLTextEditor::handleRightMouseDown( S32 x, S32 y, MASK mask ) "Add Word", spell_add, NULL, tempStruct); tempStruct->menuItem = suggMenuItem; suggestionMenuItems.push_back(tempStruct); - menu->append(suggMenuItem); + menu->addChild(suggMenuItem); } } @@ -1456,12 +1456,11 @@ BOOL LLTextEditor::handleRightMouseDown( S32 x, S32 y, MASK mask ) tempStruct->word, spell_show, NULL, tempStruct); tempStruct->menuItem = suggMenuItem; suggestionMenuItems.push_back(tempStruct); - menu->append(suggMenuItem); + menu->addChild(suggMenuItem); } mLastContextMenuX = x; mLastContextMenuY = y; menu->buildDrawLabels(); - menu->updateParent(LLMenuGL::sMenuContainer); LLMenuGL::showPopup(this, menu, x, y); } return TRUE; diff --git a/indra/newview/llfloatermessagelog.cpp b/indra/newview/llfloatermessagelog.cpp index 57ffac013..08cfa1200 100644 --- a/indra/newview/llfloatermessagelog.cpp +++ b/indra/newview/llfloatermessagelog.cpp @@ -935,11 +935,11 @@ void LLFloaterMessageLog::onClickClearLog(void* user_data) void LLFloaterMessageLog::onClickFilterChoice(void* user_data) { LLMenuGL* menu = new LLMenuGL(LLStringUtil::null); - menu->append(new LLMenuItemCallGL("No filter", onClickFilterMenu, NULL, (void*)"")); - menu->append(new LLMenuItemCallGL("Fewer spammy messages", onClickFilterMenu, NULL, (void*)"!StartPingCheck !CompletePingCheck !PacketAck !SimulatorViewerTimeMessage !SimStats !AgentUpdate !AgentAnimation !AvatarAnimation !ViewerEffect !CoarseLocationUpdate !LayerData !CameraConstraint !ObjectUpdateCached !RequestMultipleObjects !ObjectUpdate !ObjectUpdateCompressed !ImprovedTerseObjectUpdate !KillObject !ImagePacket !SendXferPacket !ConfirmXferPacket !TransferPacket")); - menu->append(new LLMenuItemCallGL("Fewer spammy messages (minus sound crap)", onClickFilterMenu, NULL, (void*)"!StartPingCheck !CompletePingCheck !PacketAck !SimulatorViewerTimeMessage !SimStats !AgentUpdate !AgentAnimation !AvatarAnimation !ViewerEffect !CoarseLocationUpdate !LayerData !CameraConstraint !ObjectUpdateCached !RequestMultipleObjects !ObjectUpdate !ObjectUpdateCompressed !ImprovedTerseObjectUpdate !KillObject !ImagePacket !SendXferPacket !ConfirmXferPacket !TransferPacket !SoundTrigger !AttachedSound !PreloadSound")); - menu->append(new LLMenuItemCallGL("Object updates", onClickFilterMenu, NULL, (void*)"ObjectUpdateCached ObjectUpdate ObjectUpdateCompressed ImprovedTerseObjectUpdate KillObject RequestMultipleObjects")); - menu->append(new LLMenuItemCallGL("Abnormal", onClickFilterMenu, NULL, (void*)"Invalid TestMessage AddCircuitCode NeighborList AvatarTextureUpdate SimulatorMapUpdate SimulatorSetMap SubscribeLoad UnsubscribeLoad SimulatorReady SimulatorPresentAtLocation SimulatorLoad SimulatorShutdownRequest RegionPresenceRequestByRegionID RegionPresenceRequestByHandle RegionPresenceResponse UpdateSimulator LogDwellTime FeatureDisabled LogFailedMoneyTransaction UserReportInternal SetSimStatusInDatabase SetSimPresenceInDatabase OpenCircuit CloseCircuit DirFindQueryBackend DirPlacesQueryBackend DirClassifiedQueryBackend DirLandQueryBackend DirPopularQueryBackend GroupNoticeAdd DataHomeLocationRequest DataHomeLocationReply DerezContainer ObjectCategory ObjectExportSelected StateSave ReportAutosaveCrash AgentAlertMessage NearestLandingRegionRequest NearestLandingRegionReply NearestLandingRegionUpdated TeleportLandingStatusChanged ConfirmEnableSimulator KickUserAck SystemKickUser AvatarPropertiesRequestBackend UpdateParcel RemoveParcel MergeParcel LogParcelChanges CheckParcelSales ParcelSales StartAuction ConfirmAuctionStart CompleteAuction CancelAuction CheckParcelAuctions ParcelAuctions ChatPass EdgeDataPacket SimStatus ChildAgentUpdate ChildAgentAlive ChildAgentPositionUpdate ChildAgentDying ChildAgentUnknown AtomicPassObject KillChildAgents ScriptSensorRequest ScriptSensorReply DataServerLogout RequestInventoryAsset InventoryAssetResponse TransferInventory TransferInventoryAck EventLocationRequest EventLocationReply MoneyTransferBackend RoutedMoneyBalanceReply SetStartLocation NetTest SetCPURatio SimCrashed NameValuePair RemoveNameValuePair UpdateAttachment RemoveAttachment EmailMessageRequest EmailMessageReply InternalScriptMail ScriptDataRequest ScriptDataReply InviteGroupResponse TallyVotes LiveHelpGroupRequest LiveHelpGroupReply GroupDataUpdate LogTextMessage CreateTrustedCircuit ParcelRename SystemMessage RpcChannelRequest RpcChannelReply RpcScriptRequestInbound RpcScriptRequestInboundForward RpcScriptReplyInbound ScriptMailRegistration Error")); + menu->addChild(new LLMenuItemCallGL("No filter", onClickFilterMenu, NULL, (void*)"")); + menu->addChild(new LLMenuItemCallGL("Fewer spammy messages", onClickFilterMenu, NULL, (void*)"!StartPingCheck !CompletePingCheck !PacketAck !SimulatorViewerTimeMessage !SimStats !AgentUpdate !AgentAnimation !AvatarAnimation !ViewerEffect !CoarseLocationUpdate !LayerData !CameraConstraint !ObjectUpdateCached !RequestMultipleObjects !ObjectUpdate !ObjectUpdateCompressed !ImprovedTerseObjectUpdate !KillObject !ImagePacket !SendXferPacket !ConfirmXferPacket !TransferPacket")); + menu->addChild(new LLMenuItemCallGL("Fewer spammy messages (minus sound crap)", onClickFilterMenu, NULL, (void*)"!StartPingCheck !CompletePingCheck !PacketAck !SimulatorViewerTimeMessage !SimStats !AgentUpdate !AgentAnimation !AvatarAnimation !ViewerEffect !CoarseLocationUpdate !LayerData !CameraConstraint !ObjectUpdateCached !RequestMultipleObjects !ObjectUpdate !ObjectUpdateCompressed !ImprovedTerseObjectUpdate !KillObject !ImagePacket !SendXferPacket !ConfirmXferPacket !TransferPacket !SoundTrigger !AttachedSound !PreloadSound")); + menu->addChild(new LLMenuItemCallGL("Object updates", onClickFilterMenu, NULL, (void*)"ObjectUpdateCached ObjectUpdate ObjectUpdateCompressed ImprovedTerseObjectUpdate KillObject RequestMultipleObjects")); + menu->addChild(new LLMenuItemCallGL("Abnormal", onClickFilterMenu, NULL, (void*)"Invalid TestMessage AddCircuitCode NeighborList AvatarTextureUpdate SimulatorMapUpdate SimulatorSetMap SubscribeLoad UnsubscribeLoad SimulatorReady SimulatorPresentAtLocation SimulatorLoad SimulatorShutdownRequest RegionPresenceRequestByRegionID RegionPresenceRequestByHandle RegionPresenceResponse UpdateSimulator LogDwellTime FeatureDisabled LogFailedMoneyTransaction UserReportInternal SetSimStatusInDatabase SetSimPresenceInDatabase OpenCircuit CloseCircuit DirFindQueryBackend DirPlacesQueryBackend DirClassifiedQueryBackend DirLandQueryBackend DirPopularQueryBackend GroupNoticeAdd DataHomeLocationRequest DataHomeLocationReply DerezContainer ObjectCategory ObjectExportSelected StateSave ReportAutosaveCrash AgentAlertMessage NearestLandingRegionRequest NearestLandingRegionReply NearestLandingRegionUpdated TeleportLandingStatusChanged ConfirmEnableSimulator KickUserAck SystemKickUser AvatarPropertiesRequestBackend UpdateParcel RemoveParcel MergeParcel LogParcelChanges CheckParcelSales ParcelSales StartAuction ConfirmAuctionStart CompleteAuction CancelAuction CheckParcelAuctions ParcelAuctions ChatPass EdgeDataPacket SimStatus ChildAgentUpdate ChildAgentAlive ChildAgentPositionUpdate ChildAgentDying ChildAgentUnknown AtomicPassObject KillChildAgents ScriptSensorRequest ScriptSensorReply DataServerLogout RequestInventoryAsset InventoryAssetResponse TransferInventory TransferInventoryAck EventLocationRequest EventLocationReply MoneyTransferBackend RoutedMoneyBalanceReply SetStartLocation NetTest SetCPURatio SimCrashed NameValuePair RemoveNameValuePair UpdateAttachment RemoveAttachment EmailMessageRequest EmailMessageReply InternalScriptMail ScriptDataRequest ScriptDataReply InviteGroupResponse TallyVotes LiveHelpGroupRequest LiveHelpGroupReply GroupDataUpdate LogTextMessage CreateTrustedCircuit ParcelRename SystemMessage RpcChannelRequest RpcChannelReply RpcScriptRequestInbound RpcScriptRequestInboundForward RpcScriptReplyInbound ScriptMailRegistration Error")); menu->updateParent(LLMenuGL::sMenuContainer); menu->setCanTearOff(FALSE); LLView* buttonp = sInstance->getChild("filter_choice_btn"); diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index c23a87bcf..736a8a224 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -2890,7 +2890,7 @@ void LLFolderBridge::buildContextMenuFolderOptions(U32 flags) mItems.push_back(std::string("Add To Outfit")); } else if(!InventoryLinksEnabled()) - mItems.push_back(std::string("Wear Items")); + mItems.push_back(std::string("Wearable And Object Wear")); mItems.push_back(std::string("Replace Outfit")); } mItems.push_back(std::string("Remove From Outfit")); @@ -4738,7 +4738,7 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) disabled_items.push_back(std::string("Attach To")); disabled_items.push_back(std::string("Attach To HUD")); } -// [RLVa:KB] - Checked: 2010-09-03 (RLVa-1.2.1a) | Modified: RLVa-1.2.1a | OK +/*// [RLVa:KB] - Checked: 2010-09-03 (RLVa-1.2.1a) | Modified: RLVa-1.2.1a | OK else if (rlv_handler_t::isEnabled()) { ERlvWearMask eWearMask = gRlvAttachmentLocks.canAttach(item); @@ -4747,7 +4747,7 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) if ((eWearMask & RLV_WEAR_ADD) == 0) disabled_items.push_back(std::string("Object Add")); } -// [/RLVa:KB] +// [/RLVa:KB]*/ LLMenuGL* attach_menu = menu.getChildMenuByName("Attach To", TRUE); LLMenuGL* attach_hud_menu = menu.getChildMenuByName("Attach To HUD", TRUE); @@ -4766,7 +4766,7 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) if (attachment->getIsHUDAttachment()) { // [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) - attach_hud_menu->append(new_item = new LLMenuItemCallGL(attachment->getName(), + attach_hud_menu->addChild(new_item = new LLMenuItemCallGL(attachment->getName(), NULL, //&LLObjectBridge::attachToAvatar, (rlv_handler_t::isEnabled()) ? &rlvAttachToEnabler : NULL, &attach_label, (void*)attachment)); @@ -4775,7 +4775,7 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) else { // [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) - attach_menu->append(new_item = new LLMenuItemCallGL(attachment->getName(), + attach_menu->addChild(new_item = new LLMenuItemCallGL(attachment->getName(), NULL, //&LLObjectBridge::attachToAvatar, (rlv_handler_t::isEnabled()) ? &rlvAttachToEnabler : NULL, &attach_label, (void*)attachment)); @@ -4790,7 +4790,7 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) } } LLMenuItemCallGL *new_item = new LLMenuItemCallGL("Custom...", NULL, NULL); - attach_menu->append(new_item); + attach_menu->addChild(new_item); LLSimpleListener* callback = mInventoryPanel.get()->getListenerByName("Inventory.AttachCustom"); new_item->addListener(callback, "on_click", LLSD()); } @@ -5138,13 +5138,13 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags) items.push_back(std::string("Wearable And Object Separator")); items.push_back(std::string("Wearable Edit")); -// [RLVa:KB] - Checked: 2011-09-16 (RLVa-1.1.4a) | Added: RLVa-1.1.4a +/*// [RLVa:KB] - Checked: 2011-09-16 (RLVa-1.1.4a) | Added: RLVa-1.1.4a if ( (rlv_handler_t::isEnabled()) && (!gRlvWearableLocks.canRemove(item)) ) { disabled_items.push_back(std::string("Wearable And Object Wear")); disabled_items.push_back(std::string("Wearable Edit")); } -// [/RLVa:KB] +// [/RLVa:KB]*/ if ((flags & FIRST_SELECTED_ITEM) == 0) { @@ -5165,10 +5165,10 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { case LLAssetType::AT_CLOTHING: items.push_back(std::string("Take Off")); -// [RLVa:KB] - Checked: 2011-09-16 (RLVa-1.1.4a) | Added: RLVa-1.1.4a +/*// [RLVa:KB] - Checked: 2011-09-16 (RLVa-1.1.4a) | Added: RLVa-1.1.4a if ( (rlv_handler_t::isEnabled()) && (!gRlvWearableLocks.canRemove(item)) ) disabled_items.push_back(std::string("Take Off")); -// [/RLVa:KB] +// [/RLVa:KB]*/ // Fallthrough since clothing and bodypart share wear options case LLAssetType::AT_BODYPART: if (get_is_item_worn(item->getUUID())) diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index 1619d6743..058afb29d 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -1127,7 +1127,7 @@ void LLTaskSoundBridge::buildContextMenu(LLMenuGL& menu, U32 flags) } items.push_back(std::string("Task Play")); - /*menu.appendSeparator(); + /*menu.addSeparator(); menu.append(new LLMenuItemCallGL("Play", &LLTaskSoundBridge::playSound, NULL, diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 9ac3ca3cf..77966f665 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -648,17 +648,11 @@ void LLMenuParcelObserver::changed() void pre_init_menus() { // static information - LLColor4 color; - color = gColors.getColor( "MenuDefaultBgColor" ); - LLMenuGL::setDefaultBackgroundColor( color ); - color = gColors.getColor( "MenuItemEnabledColor" ); - LLMenuItemGL::setEnabledColor( color ); - color = gColors.getColor( "MenuItemDisabledColor" ); - LLMenuItemGL::setDisabledColor( color ); - color = gColors.getColor( "MenuItemHighlightBgColor" ); - LLMenuItemGL::setHighlightBGColor( color ); - color = gColors.getColor( "MenuItemHighlightFgColor" ); - LLMenuItemGL::setHighlightFGColor( color ); + LLMenuGL::setDefaultBackgroundColor( gColors.getColor( "MenuDefaultBgColor" ) ); + LLMenuItemGL::sEnabledColor = gColors.getColor( "MenuItemEnabledColor" ); + LLMenuItemGL::sDisabledColor = gColors.getColor( "MenuItemDisabledColor" ); + LLMenuItemGL::sHighlightBackground = gColors.getColor( "MenuItemHighlightBgColor" ); + LLMenuItemGL::sHighlightForeground = gColors.getColor( "MenuItemHighlightFgColor" ); } void initialize_menus(); @@ -766,7 +760,7 @@ void init_menus() gMenuBarView->setBackgroundColor( color ); // gMenuBarView->setItemVisible("Tools", FALSE); - gMenuBarView->arrange(); + gMenuBarView->needsArrange(); gMenuHolder->addChild(gMenuBarView); @@ -799,34 +793,35 @@ void init_menus() LLMenuGL*menu; menu = new LLMenuGL("Singularity"); - menu->append(new LLMenuItemCallGL( "Close All Dialogs", + menu->setCanTearOff(TRUE); + menu->addChild(new LLMenuItemCallGL( "Close All Dialogs", &handle_close_all_notifications, NULL, NULL, 'D', MASK_CONTROL | MASK_ALT | MASK_SHIFT)); - menu->appendSeparator(); - menu->append(new LLMenuItemCallGL( "Fake Away Status", &handle_fake_away_status, NULL)); - menu->append(new LLMenuItemCallGL( "Force Ground Sit", &handle_force_ground_sit, NULL)); - menu->append(new LLMenuItemCallGL( "Phantom Avatar", &handle_phantom_avatar, NULL, NULL, 'P', MASK_CONTROL | MASK_ALT)); - menu->appendSeparator(); - menu->append(new LLMenuItemCallGL( "Animation Override...", + menu->addSeparator(); + menu->addChild(new LLMenuItemCallGL( "Fake Away Status", &handle_fake_away_status, NULL)); + menu->addChild(new LLMenuItemCallGL( "Force Ground Sit", &handle_force_ground_sit, NULL)); + menu->addChild(new LLMenuItemCallGL( "Phantom Avatar", &handle_phantom_avatar, NULL, NULL, 'P', MASK_CONTROL | MASK_ALT)); + menu->addSeparator(); + menu->addChild(new LLMenuItemCallGL( "Animation Override...", &handle_edit_ao, NULL)); - menu->append(new LLMenuItemCheckGL( "Nimble", + menu->addChild(new LLMenuItemCheckGL( "Nimble", &menu_toggle_control, NULL, &menu_check_control, (void*)"Nimble")); - menu->append(new LLMenuItemCheckGL( "ReSit", + menu->addChild(new LLMenuItemCheckGL( "ReSit", &menu_toggle_control, NULL, &menu_check_control, (void*)"ReSit")); - menu->appendSeparator(); - menu->append(new LLMenuItemCallGL( "Object Area Search", &handle_area_search, NULL)); - menu->append(new LLMenuItemCallGL( "Message Log", &handle_open_message_log, NULL)); + menu->addSeparator(); + menu->addChild(new LLMenuItemCallGL( "Object Area Search", &handle_area_search, NULL)); + menu->addChild(new LLMenuItemCallGL( "Message Log", &handle_open_message_log, NULL)); - menu->append(new LLMenuItemCallGL( "Sound Explorer", + menu->addChild(new LLMenuItemCallGL( "Sound Explorer", &handle_sounds_explorer, NULL)); - menu->append(new LLMenuItemCallGL( "Asset Blacklist", + menu->addChild(new LLMenuItemCallGL( "Asset Blacklist", &handle_blacklist, NULL)); - menu->append(new LLMenuItemCheckGL( "Streaming Audio Display", + menu->addChild(new LLMenuItemCheckGL( "Streaming Audio Display", &handle_ticker_toggle, &handle_ticker_enabled, &handle_ticker_check, NULL )); @@ -834,33 +829,32 @@ void init_menus() // // Add in the pose stand ------------------------------------------- /*LLMenuGL* sub = new LLMenuGL("Pose Stand..."); - menu->appendMenu(sub); + menu->addChild(sub); - sub->append(new LLMenuItemCallGL( "Legs Together Arms Out", &handle_pose_stand_ltao, NULL)); - sub->append(new LLMenuItemCallGL( "Legs Together Arms Half", &handle_pose_stand_ltah, NULL)); - sub->append(new LLMenuItemCallGL( "Legs Together Arms Down", &handle_pose_stand_ltad, NULL)); - sub->append(new LLMenuItemCallGL( "Legs Out Arms Up", &handle_pose_stand_loau, NULL)); - sub->append(new LLMenuItemCallGL( "Legs Out Arms Out", &handle_pose_stand_loao, NULL)); - sub->append(new LLMenuItemCallGL( "Legs Half Arms Out", &handle_pose_stand_lhao, NULL)); - sub->append(new LLMenuItemCallGL( "Stop Pose Stand", &handle_pose_stand_stop, NULL)); + sub->addChild(new LLMenuItemCallGL( "Legs Together Arms Out", &handle_pose_stand_ltao, NULL)); + sub->addChild(new LLMenuItemCallGL( "Legs Together Arms Half", &handle_pose_stand_ltah, NULL)); + sub->addChild(new LLMenuItemCallGL( "Legs Together Arms Down", &handle_pose_stand_ltad, NULL)); + sub->addChild(new LLMenuItemCallGL( "Legs Out Arms Up", &handle_pose_stand_loau, NULL)); + sub->addChild(new LLMenuItemCallGL( "Legs Out Arms Out", &handle_pose_stand_loao, NULL)); + sub->addChild(new LLMenuItemCallGL( "Legs Half Arms Out", &handle_pose_stand_lhao, NULL)); + sub->addChild(new LLMenuItemCallGL( "Stop Pose Stand", &handle_pose_stand_stop, NULL)); // ------------------------------------------------------*/ - menu->append(new LLMenuItemCheckGL("Pose Stand",&handle_toggle_pose, NULL, &handle_check_pose, NULL)); + menu->addChild(new LLMenuItemCheckGL("Pose Stand",&handle_toggle_pose, NULL, &handle_check_pose, NULL)); //these should always be last in a sub menu menu->createJumpKeys(); - gMenuBarView->appendMenu( menu ); - menu->updateParent(LLMenuGL::sMenuContainer); + gMenuBarView->addChild( menu ); menu = new LLMenuGL(CLIENT_MENU_NAME); + menu->setCanTearOff(TRUE); init_client_menu(menu); - gMenuBarView->appendMenu( menu ); - menu->updateParent(LLMenuGL::sMenuContainer); + gMenuBarView->addChild( menu ); menu = new LLMenuGL(SERVER_MENU_NAME); + menu->setCanTearOff(TRUE); init_server_menu(menu); - gMenuBarView->appendMenu( menu ); - menu->updateParent(LLMenuGL::sMenuContainer); + gMenuBarView->addChild( menu ); gMenuBarView->createJumpKeys(); @@ -877,8 +871,8 @@ void init_menus() menu = new LLMenuGL(CLIENT_MENU_NAME); menu->setCanTearOff(FALSE); - menu->append(new LLMenuItemCallGL("Debug Settings...", LLFloaterSettingsDebug::show, NULL, NULL)); - gLoginMenuBarView->appendMenu(menu); + menu->addChild(new LLMenuItemCallGL("Debug Settings...", LLFloaterSettingsDebug::show, NULL, NULL)); + gLoginMenuBarView->addChild(menu); menu->updateParent(LLMenuGL::sMenuContainer); gLoginMenuBarView->setRect(LLRect(menuBarRect.mLeft, menuBarRect.mTop, @@ -897,27 +891,27 @@ void init_client_menu(LLMenuGL* menu) { LLMenuGL* sub_menu = NULL; - //menu->append(new LLMenuItemCallGL("Permissions Control", &show_permissions_control)); + //menu->addChild(new LLMenuItemCallGL("Permissions Control", &show_permissions_control)); // this is now in the view menu so we don't need it here! { // *TODO: Translate LLMenuGL* sub = new LLMenuGL("Consoles"); - menu->appendMenu(sub); - sub->append(new LLMenuItemCheckGL("Frame Console", + menu->addChild(sub); + sub->addChild(new LLMenuItemCheckGL("Frame Console", &toggle_visibility, NULL, &get_visibility, (void*)gDebugView->mFrameStatView, '2', MASK_CONTROL|MASK_SHIFT ) ); - sub->append(new LLMenuItemCheckGL("Texture Console", + sub->addChild(new LLMenuItemCheckGL("Texture Console", &toggle_visibility, NULL, &get_visibility, (void*)gTextureView, '3', MASK_CONTROL|MASK_SHIFT ) ); LLView* debugview = gDebugView->mDebugConsolep; - sub->append(new LLMenuItemCheckGL("Debug Console", + sub->addChild(new LLMenuItemCheckGL("Debug Console", &toggle_visibility, NULL, &get_visibility, @@ -926,13 +920,13 @@ void init_client_menu(LLMenuGL* menu) if(gAuditTexture) { - sub->append(new LLMenuItemCheckGL("Texture Size Console", + sub->addChild(new LLMenuItemCheckGL("Texture Size Console", &toggle_visibility, NULL, &get_visibility, (void*)gTextureSizeView, '5', MASK_CONTROL|MASK_SHIFT ) ); - sub->append(new LLMenuItemCheckGL("Texture Category Console", + sub->addChild(new LLMenuItemCheckGL("Texture Category Console", &toggle_visibility, NULL, &get_visibility, @@ -940,14 +934,14 @@ void init_client_menu(LLMenuGL* menu) '6', MASK_CONTROL|MASK_SHIFT ) ); } - sub->append(new LLMenuItemCheckGL("Fast Timers", + sub->addChild(new LLMenuItemCheckGL("Fast Timers", &toggle_visibility, NULL, &get_visibility, (void*)gDebugView->mFastTimerView, '9', MASK_CONTROL|MASK_SHIFT ) ); //#if MEM_TRACK_MEM - sub->append(new LLMenuItemCheckGL("Memory", + sub->addChild(new LLMenuItemCheckGL("Memory", &toggle_visibility, NULL, &get_visibility, @@ -955,68 +949,68 @@ void init_client_menu(LLMenuGL* menu) '0', MASK_CONTROL|MASK_SHIFT ) ); //#endif - sub->appendSeparator(); + sub->addSeparator(); // Debugging view for unified notifications - sub->append(new LLMenuItemCallGL("Notifications Console...", + sub->addChild(new LLMenuItemCallGL("Notifications Console...", &handle_show_notifications_console, NULL, NULL, '5', MASK_CONTROL|MASK_SHIFT )); - sub->appendSeparator(); + sub->addSeparator(); - sub->append(new LLMenuItemCallGL("Region Info to Debug Console", + sub->addChild(new LLMenuItemCallGL("Region Info to Debug Console", &handle_region_dump_settings, NULL)); - sub->append(new LLMenuItemCallGL("Group Info to Debug Console", + sub->addChild(new LLMenuItemCallGL("Group Info to Debug Console", &handle_dump_group_info, NULL, NULL)); - sub->append(new LLMenuItemCallGL("Capabilities Info to Debug Console", + sub->addChild(new LLMenuItemCallGL("Capabilities Info to Debug Console", &handle_dump_capabilities_info, NULL, NULL)); sub->createJumpKeys(); } // neither of these works particularly well at the moment - /*menu->append(new LLMenuItemCallGL( "Reload UI XML", &reload_ui, + /*menu->addChild(new LLMenuItemCallGL( "Reload UI XML", &reload_ui, NULL, NULL) );*/ - /*menu->append(new LLMenuItemCallGL("Reload settings/colors", + /*menu->addChild(new LLMenuItemCallGL("Reload settings/colors", &handle_reload_settings, NULL, NULL));*/ - menu->append(new LLMenuItemCallGL("Reload personal setting overrides", + menu->addChild(new LLMenuItemCallGL("Reload personal setting overrides", &reload_personal_settings_overrides, NULL, NULL, KEY_F2, MASK_CONTROL|MASK_SHIFT)); sub_menu = new LLMenuGL("HUD Info"); { - sub_menu->append(new LLMenuItemCheckGL("Velocity", + sub_menu->addChild(new LLMenuItemCheckGL("Velocity", &toggle_visibility, NULL, &get_visibility, (void*)gVelocityBar)); - sub_menu->append(new LLMenuItemToggleGL("Camera", &gDisplayCameraPos ) ); - sub_menu->append(new LLMenuItemToggleGL("Wind", &gDisplayWindInfo) ); - sub_menu->append(new LLMenuItemToggleGL("FOV", &gDisplayFOV ) ); + sub_menu->addChild(new LLMenuItemToggleGL("Camera", &gDisplayCameraPos ) ); + sub_menu->addChild(new LLMenuItemToggleGL("Wind", &gDisplayWindInfo) ); + sub_menu->addChild(new LLMenuItemToggleGL("FOV", &gDisplayFOV ) ); sub_menu->createJumpKeys(); } - menu->appendMenu(sub_menu); + menu->addChild(sub_menu); - menu->appendSeparator(); + menu->addSeparator(); - menu->append(new LLMenuItemCheckGL( "High-res Snapshot", + menu->addChild(new LLMenuItemCheckGL( "High-res Snapshot", &menu_toggle_control, NULL, &menu_check_control, (void*)"HighResSnapshot")); - menu->append(new LLMenuItemCheckGL( "Quiet Snapshots to Disk", + menu->addChild(new LLMenuItemCheckGL( "Quiet Snapshots to Disk", &menu_toggle_control, NULL, &menu_check_control, (void*)"QuietSnapshotsToDisk")); - menu->append(new LLMenuItemCheckGL("Show Mouselook Crosshairs", + menu->addChild(new LLMenuItemCheckGL("Show Mouselook Crosshairs", &menu_toggle_control, NULL, &menu_check_control, (void*)"ShowCrosshairs")); - menu->append(new LLMenuItemCheckGL("Debug Permissions", + menu->addChild(new LLMenuItemCheckGL("Debug Permissions", &menu_toggle_control, NULL, &menu_check_control, @@ -1028,7 +1022,7 @@ void init_client_menu(LLMenuGL* menu) #ifdef TOGGLE_HACKED_GODLIKE_VIEWER if (!LLViewerLogin::getInstance()->isInProductionGrid()) { - menu->append(new LLMenuItemCheckGL("Hacked Godmode", + menu->addChild(new LLMenuItemCheckGL("Hacked Godmode", &handle_toggle_hacked_godmode, NULL, &check_toggle_hacked_godmode, @@ -1036,20 +1030,20 @@ void init_client_menu(LLMenuGL* menu) } #endif // - menu->append(new LLMenuItemCallGL("Clear Group Cache", + menu->addChild(new LLMenuItemCallGL("Clear Group Cache", LLGroupMgr::debugClearAllGroups)); - menu->append(new LLMenuItemCheckGL("Use Web Map Tiles", menu_toggle_control, NULL, menu_check_control, (void*)"UseWebMapTiles")); + menu->addChild(new LLMenuItemCheckGL("Use Web Map Tiles", menu_toggle_control, NULL, menu_check_control, (void*)"UseWebMapTiles")); - menu->appendSeparator(); + menu->addSeparator(); sub_menu = new LLMenuGL("Rendering"); init_debug_rendering_menu(sub_menu); - menu->appendMenu(sub_menu); + menu->addChild(sub_menu); sub_menu = new LLMenuGL("World"); init_debug_world_menu(sub_menu); - menu->appendMenu(sub_menu); + menu->addChild(sub_menu); // [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | Modified: RLVa-0.2.1b | OK #ifdef RLV_ADVANCED_MENU @@ -1057,7 +1051,7 @@ void init_client_menu(LLMenuGL* menu) { sub_menu = new LLMenuGL("RLVa"); init_debug_rlva_menu(sub_menu); - menu->appendMenu(sub_menu); + menu->addChild(sub_menu); sub_menu->setVisible(rlv_handler_t::isEnabled()); sub_menu->setEnabled(rlv_handler_t::isEnabled()); } @@ -1066,107 +1060,107 @@ void init_client_menu(LLMenuGL* menu) sub_menu = new LLMenuGL("UI"); init_debug_ui_menu(sub_menu); - menu->appendMenu(sub_menu); + menu->addChild(sub_menu); sub_menu = new LLMenuGL("XUI"); init_debug_xui_menu(sub_menu); - menu->appendMenu(sub_menu); + menu->addChild(sub_menu); sub_menu = new LLMenuGL("Character"); init_debug_avatar_menu(sub_menu); - menu->appendMenu(sub_menu); + menu->addChild(sub_menu); { LLMenuGL* sub = NULL; sub = new LLMenuGL("Network"); - sub->append(new LLMenuItemCallGL("Enable Message Log", + sub->addChild(new LLMenuItemCallGL("Enable Message Log", &handle_viewer_enable_message_log, NULL)); - sub->append(new LLMenuItemCallGL("Disable Message Log", + sub->addChild(new LLMenuItemCallGL("Disable Message Log", &handle_viewer_disable_message_log, NULL)); - sub->appendSeparator(); + sub->addSeparator(); - sub->append(new LLMenuItemCheckGL("Velocity Interpolate Objects", + sub->addChild(new LLMenuItemCheckGL("Velocity Interpolate Objects", &velocity_interpolate, NULL, &menu_check_control, (void*)"VelocityInterpolate")); - sub->append(new LLMenuItemCheckGL("Ping Interpolate Object Positions", + sub->addChild(new LLMenuItemCheckGL("Ping Interpolate Object Positions", &menu_toggle_control, NULL, &menu_check_control, (void*)"PingInterpolate")); - sub->appendSeparator(); + sub->addSeparator(); - sub->append(new LLMenuItemCallGL("Drop a Packet", + sub->addChild(new LLMenuItemCallGL("Drop a Packet", &drop_packet, NULL, NULL, 'L', MASK_ALT | MASK_CONTROL)); - menu->appendMenu( sub ); + menu->addChild( sub ); sub->createJumpKeys(); } { LLMenuGL* sub = NULL; sub = new LLMenuGL("Recorder"); - sub->append(new LLMenuItemCheckGL("Full Session Logging", &menu_toggle_control, NULL, &menu_check_control, (void*)"StatsSessionTrackFrameStats")); + sub->addChild(new LLMenuItemCheckGL("Full Session Logging", &menu_toggle_control, NULL, &menu_check_control, (void*)"StatsSessionTrackFrameStats")); - sub->append(new LLMenuItemCallGL("Start Logging", &LLFrameStats::startLogging, NULL)); - sub->append(new LLMenuItemCallGL("Stop Logging", &LLFrameStats::stopLogging, NULL)); - sub->append(new LLMenuItemCallGL("Log 10 Seconds", &LLFrameStats::timedLogging10, NULL)); - sub->append(new LLMenuItemCallGL("Log 30 Seconds", &LLFrameStats::timedLogging30, NULL)); - sub->append(new LLMenuItemCallGL("Log 60 Seconds", &LLFrameStats::timedLogging60, NULL)); - sub->appendSeparator(); - sub->append(new LLMenuItemCallGL("Start Playback", &LLAgentPilot::startPlayback, NULL)); - sub->append(new LLMenuItemCallGL("Stop Playback", &LLAgentPilot::stopPlayback, NULL)); - sub->append(new LLMenuItemToggleGL("Loop Playback", &LLAgentPilot::sLoop) ); - sub->append(new LLMenuItemCallGL("Start Record", &LLAgentPilot::startRecord, NULL)); - sub->append(new LLMenuItemCallGL("Stop Record", &LLAgentPilot::saveRecord, NULL)); + sub->addChild(new LLMenuItemCallGL("Start Logging", &LLFrameStats::startLogging, NULL)); + sub->addChild(new LLMenuItemCallGL("Stop Logging", &LLFrameStats::stopLogging, NULL)); + sub->addChild(new LLMenuItemCallGL("Log 10 Seconds", &LLFrameStats::timedLogging10, NULL)); + sub->addChild(new LLMenuItemCallGL("Log 30 Seconds", &LLFrameStats::timedLogging30, NULL)); + sub->addChild(new LLMenuItemCallGL("Log 60 Seconds", &LLFrameStats::timedLogging60, NULL)); + sub->addSeparator(); + sub->addChild(new LLMenuItemCallGL("Start Playback", &LLAgentPilot::startPlayback, NULL)); + sub->addChild(new LLMenuItemCallGL("Stop Playback", &LLAgentPilot::stopPlayback, NULL)); + sub->addChild(new LLMenuItemToggleGL("Loop Playback", &LLAgentPilot::sLoop) ); + sub->addChild(new LLMenuItemCallGL("Start Record", &LLAgentPilot::startRecord, NULL)); + sub->addChild(new LLMenuItemCallGL("Stop Record", &LLAgentPilot::saveRecord, NULL)); - menu->appendMenu( sub ); + menu->addChild( sub ); sub->createJumpKeys(); } { LLMenuGL* sub = NULL; sub = new LLMenuGL("Media"); - sub->append(new LLMenuItemCallGL("Reload MIME types", &LLMIMETypes::reload)); - sub->append(new LLMenuItemCallGL("Web Browser Test", &handle_web_browser_test)); - menu->appendMenu( sub ); + sub->addChild(new LLMenuItemCallGL("Reload MIME types", &LLMIMETypes::reload)); + sub->addChild(new LLMenuItemCallGL("Web Browser Test", &handle_web_browser_test)); + menu->addChild( sub ); sub->createJumpKeys(); } - menu->appendSeparator(); + menu->addSeparator(); - menu->append(new LLMenuItemToggleGL("Show Updates", + menu->addChild(new LLMenuItemToggleGL("Show Updates", &gShowObjectUpdates)); - menu->appendSeparator(); + menu->addSeparator(); - menu->append(new LLMenuItemCallGL("Compress Images...", + menu->addChild(new LLMenuItemCallGL("Compress Images...", &handle_compress_image, NULL, NULL)); - menu->append(new LLMenuItemCheckGL("Limit Select Distance", + menu->addChild(new LLMenuItemCheckGL("Limit Select Distance", &menu_toggle_control, NULL, &menu_check_control, (void*)"LimitSelectDistance")); - menu->append(new LLMenuItemCheckGL("Disable Camera Constraints", + menu->addChild(new LLMenuItemCheckGL("Disable Camera Constraints", &menu_toggle_control, NULL, &menu_check_control, (void*)"DisableCameraConstraints")); - menu->append(new LLMenuItemCheckGL("Mouse Smoothing", + menu->addChild(new LLMenuItemCheckGL("Mouse Smoothing", &menu_toggle_control, NULL, &menu_check_control, (void*) "MouseSmooth")); - menu->appendSeparator(); + menu->addSeparator(); - menu->append(new LLMenuItemCheckGL( "Console Window", + menu->addChild(new LLMenuItemCheckGL( "Console Window", &menu_toggle_control, NULL, &menu_check_control, @@ -1175,7 +1169,7 @@ void init_client_menu(LLMenuGL* menu) // [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | Modified: RLVa-1.0.0e | OK #ifdef RLV_ADVANCED_TOGGLE_RLVA if (gSavedSettings.controlExists(RLV_SETTING_MAIN)) - menu->append(new LLMenuItemCheckGL("RestrainedLove API", &rlvToggleEnabled, NULL, &rlvGetEnabled, NULL)); + menu->addChild(new LLMenuItemCheckGL("RestrainedLove API", &rlvToggleEnabled, NULL, &rlvGetEnabled, NULL)); #endif // RLV_ADVANCED_TOGGLE_RLVA // [/RLVa:KB] @@ -1184,31 +1178,31 @@ void init_client_menu(LLMenuGL* menu) LLMenuGL* sub = NULL; sub = new LLMenuGL("Debugging"); #if LL_WINDOWS - sub->append(new LLMenuItemCallGL("Force Breakpoint", &force_error_breakpoint, NULL, NULL, 'B', MASK_CONTROL | MASK_ALT)); + sub->addChild(new LLMenuItemCallGL("Force Breakpoint", &force_error_breakpoint, NULL, NULL, 'B', MASK_CONTROL | MASK_ALT)); #endif - sub->append(new LLMenuItemCallGL("Force LLError And Crash", &force_error_llerror)); - sub->append(new LLMenuItemCallGL("Force Bad Memory Access", &force_error_bad_memory_access)); - sub->append(new LLMenuItemCallGL("Force Infinite Loop", &force_error_infinite_loop)); - sub->append(new LLMenuItemCallGL("Force Driver Crash", &force_error_driver_crash)); - sub->append(new LLMenuItemCallGL("Force Disconnect Viewer", &handle_disconnect_viewer)); - // *NOTE:Mani this isn't handled yet... sub->append(new LLMenuItemCallGL("Force Software Exception", &force_error_unhandled_exception)); + sub->addChild(new LLMenuItemCallGL("Force LLError And Crash", &force_error_llerror)); + sub->addChild(new LLMenuItemCallGL("Force Bad Memory Access", &force_error_bad_memory_access)); + sub->addChild(new LLMenuItemCallGL("Force Infinite Loop", &force_error_infinite_loop)); + sub->addChild(new LLMenuItemCallGL("Force Driver Crash", &force_error_driver_crash)); + sub->addChild(new LLMenuItemCallGL("Force Disconnect Viewer", &handle_disconnect_viewer)); + // *NOTE:Mani this isn't handled yet... sub->addChild(new LLMenuItemCallGL("Force Software Exception", &force_error_unhandled_exception)); sub->createJumpKeys(); - menu->appendMenu(sub); + menu->addChild(sub); } - menu->append(new LLMenuItemCheckGL( "Output Debug Minidump", + menu->addChild(new LLMenuItemCheckGL( "Output Debug Minidump", &menu_toggle_control, NULL, &menu_check_control, (void*)"SaveMinidump")); - menu->append(new LLMenuItemCallGL("Debug Settings...", LLFloaterSettingsDebug::show, NULL, NULL)); - menu->append(new LLMenuItemCheckGL("View Admin Options", &handle_admin_override_toggle, NULL, &check_admin_override, NULL, 'V', MASK_CONTROL | MASK_ALT)); + menu->addChild(new LLMenuItemCallGL("Debug Settings...", LLFloaterSettingsDebug::show, NULL, NULL)); + menu->addChild(new LLMenuItemCheckGL("View Admin Options", &handle_admin_override_toggle, NULL, &check_admin_override, NULL, 'V', MASK_CONTROL | MASK_ALT)); - menu->append(new LLMenuItemCallGL("Request Admin Status", + menu->addChild(new LLMenuItemCallGL("Request Admin Status", &handle_god_mode, NULL, NULL, 'G', MASK_ALT | MASK_CONTROL)); - menu->append(new LLMenuItemCallGL("Leave Admin Status", + menu->addChild(new LLMenuItemCallGL("Leave Admin Status", &handle_leave_god_mode, NULL, NULL, 'G', MASK_ALT | MASK_SHIFT | MASK_CONTROL)); menu->createJumpKeys(); @@ -1217,26 +1211,26 @@ void init_client_menu(LLMenuGL* menu) void init_debug_world_menu(LLMenuGL* menu) { /* REMOVE mouse move sun from menu options - menu->append(new LLMenuItemCheckGL("Mouse Moves Sun", + menu->addChild(new LLMenuItemCheckGL("Mouse Moves Sun", &menu_toggle_control, NULL, &menu_check_control, (void*)"MouseSun", 'M', MASK_CONTROL|MASK_ALT)); */ - menu->append(new LLMenuItemCheckGL("Sim Sun Override", + menu->addChild(new LLMenuItemCheckGL("Sim Sun Override", &menu_toggle_control, NULL, &menu_check_control, (void*)"SkyOverrideSimSunPosition")); - menu->append(new LLMenuItemCallGL("Dump Scripted Camera", + menu->addChild(new LLMenuItemCallGL("Dump Scripted Camera", &handle_dump_followcam, NULL, NULL)); - menu->append(new LLMenuItemCheckGL("Fixed Weather", + menu->addChild(new LLMenuItemCheckGL("Fixed Weather", &menu_toggle_control, NULL, &menu_check_control, (void*)"FixedWeather")); - menu->append(new LLMenuItemCallGL("Dump Region Object Cache", + menu->addChild(new LLMenuItemCallGL("Dump Region Object Cache", &handle_dump_region_object_cache, NULL, NULL)); menu->createJumpKeys(); } @@ -1263,60 +1257,60 @@ static void handle_export_menus_to_xml_continued(AIFilePicker* filepicker) void init_debug_ui_menu(LLMenuGL* menu) { - menu->append(new LLMenuItemCheckGL("Rotate Mini-Map", menu_toggle_control, NULL, menu_check_control, (void*)"MiniMapRotate")); - menu->append(new LLMenuItemCheckGL("Use default system color picker", menu_toggle_control, NULL, menu_check_control, (void*)"UseDefaultColorPicker")); - menu->append(new LLMenuItemCheckGL("Show search panel in overlay bar", menu_toggle_control, NULL, menu_check_control, (void*)"ShowSearchBar")); - menu->appendSeparator(); + menu->addChild(new LLMenuItemCheckGL("Rotate Mini-Map", menu_toggle_control, NULL, menu_check_control, (void*)"MiniMapRotate")); + menu->addChild(new LLMenuItemCheckGL("Use default system color picker", menu_toggle_control, NULL, menu_check_control, (void*)"UseDefaultColorPicker")); + menu->addChild(new LLMenuItemCheckGL("Show search panel in overlay bar", menu_toggle_control, NULL, menu_check_control, (void*)"ShowSearchBar")); + menu->addSeparator(); // commented out until work is complete: DEV-32268 - // menu->append(new LLMenuItemCallGL("Buy Currency Test", &handle_buy_currency_test)); - menu->append(new LLMenuItemCallGL("Editable UI", &edit_ui)); - menu->append(new LLMenuItemCallGL( "Dump SelectMgr", &dump_select_mgr)); - menu->append(new LLMenuItemCallGL( "Dump Inventory", &dump_inventory)); - menu->append(new LLMenuItemCallGL( "Dump Focus Holder", &handle_dump_focus, NULL, NULL, 'F', MASK_ALT | MASK_CONTROL)); - menu->append(new LLMenuItemCallGL( "Print Selected Object Info", &print_object_info, NULL, NULL, 'P', MASK_CONTROL|MASK_SHIFT )); - menu->append(new LLMenuItemCallGL( "Print Agent Info", &print_agent_nvpairs, NULL, NULL, 'P', MASK_SHIFT )); - menu->append(new LLMenuItemCallGL( "Memory Stats", &output_statistics, NULL, NULL, 'M', MASK_SHIFT | MASK_ALT | MASK_CONTROL)); - menu->append(new LLMenuItemCheckGL("Double-Click Auto-Pilot", + // menu->addChild(new LLMenuItemCallGL("Buy Currency Test", &handle_buy_currency_test)); + menu->addChild(new LLMenuItemCallGL("Editable UI", &edit_ui)); + menu->addChild(new LLMenuItemCallGL( "Dump SelectMgr", &dump_select_mgr)); + menu->addChild(new LLMenuItemCallGL( "Dump Inventory", &dump_inventory)); + menu->addChild(new LLMenuItemCallGL( "Dump Focus Holder", &handle_dump_focus, NULL, NULL, 'F', MASK_ALT | MASK_CONTROL)); + menu->addChild(new LLMenuItemCallGL( "Print Selected Object Info", &print_object_info, NULL, NULL, 'P', MASK_CONTROL|MASK_SHIFT )); + menu->addChild(new LLMenuItemCallGL( "Print Agent Info", &print_agent_nvpairs, NULL, NULL, 'P', MASK_SHIFT )); + menu->addChild(new LLMenuItemCallGL( "Memory Stats", &output_statistics, NULL, NULL, 'M', MASK_SHIFT | MASK_ALT | MASK_CONTROL)); + menu->addChild(new LLMenuItemCheckGL("Double-Click Auto-Pilot", menu_toggle_control, NULL, menu_check_control, (void*)"DoubleClickAutoPilot")); // add for double click teleport support - menu->append(new LLMenuItemCheckGL("Double-Click Teleport", + menu->addChild(new LLMenuItemCheckGL("Double-Click Teleport", menu_toggle_control, NULL, menu_check_control, (void*)"DoubleClickTeleport")); - menu->appendSeparator(); -// menu->append(new LLMenuItemCallGL( "Print Packets Lost", &print_packets_lost, NULL, NULL, 'L', MASK_SHIFT )); - menu->append(new LLMenuItemCheckGL("Debug SelectMgr", menu_toggle_control, NULL, menu_check_control, (void*)"DebugSelectMgr")); - menu->append(new LLMenuItemToggleGL("Debug Clicks", &gDebugClicks)); - menu->append(new LLMenuItemToggleGL("Debug Views", &LLView::sDebugRects)); - menu->append(new LLMenuItemCheckGL("Show Name Tooltips", toggle_show_xui_names, NULL, check_show_xui_names, NULL)); - menu->append(new LLMenuItemToggleGL("Debug Mouse Events", &LLView::sDebugMouseHandling)); - menu->append(new LLMenuItemToggleGL("Debug Keys", &LLView::sDebugKeys)); - menu->append(new LLMenuItemToggleGL("Debug WindowProc", &gDebugWindowProc)); - menu->append(new LLMenuItemToggleGL("Debug Text Editor Tips", &gDebugTextEditorTips)); - menu->appendSeparator(); - menu->append(new LLMenuItemCheckGL("Show Time", menu_toggle_control, NULL, menu_check_control, (void*)"DebugShowTime")); - menu->append(new LLMenuItemCheckGL("Show Render Info", menu_toggle_control, NULL, menu_check_control, (void*)"DebugShowRenderInfo")); - menu->append(new LLMenuItemCheckGL("Show Matrices", menu_toggle_control, NULL, menu_check_control, (void*)"DebugShowRenderMatrices")); - menu->append(new LLMenuItemCheckGL("Show Color Under Cursor", menu_toggle_control, NULL, menu_check_control, (void*)"DebugShowColor")); + menu->addSeparator(); +// menu->addChild(new LLMenuItemCallGL( "Print Packets Lost", &print_packets_lost, NULL, NULL, 'L', MASK_SHIFT )); + menu->addChild(new LLMenuItemCheckGL("Debug SelectMgr", menu_toggle_control, NULL, menu_check_control, (void*)"DebugSelectMgr")); + menu->addChild(new LLMenuItemToggleGL("Debug Clicks", &gDebugClicks)); + menu->addChild(new LLMenuItemToggleGL("Debug Views", &LLView::sDebugRects)); + menu->addChild(new LLMenuItemCheckGL("Show Name Tooltips", toggle_show_xui_names, NULL, check_show_xui_names, NULL)); + menu->addChild(new LLMenuItemToggleGL("Debug Mouse Events", &LLView::sDebugMouseHandling)); + menu->addChild(new LLMenuItemToggleGL("Debug Keys", &LLView::sDebugKeys)); + menu->addChild(new LLMenuItemToggleGL("Debug WindowProc", &gDebugWindowProc)); + menu->addChild(new LLMenuItemToggleGL("Debug Text Editor Tips", &gDebugTextEditorTips)); + menu->addSeparator(); + menu->addChild(new LLMenuItemCheckGL("Show Time", menu_toggle_control, NULL, menu_check_control, (void*)"DebugShowTime")); + menu->addChild(new LLMenuItemCheckGL("Show Render Info", menu_toggle_control, NULL, menu_check_control, (void*)"DebugShowRenderInfo")); + menu->addChild(new LLMenuItemCheckGL("Show Matrices", menu_toggle_control, NULL, menu_check_control, (void*)"DebugShowRenderMatrices")); + menu->addChild(new LLMenuItemCheckGL("Show Color Under Cursor", menu_toggle_control, NULL, menu_check_control, (void*)"DebugShowColor")); menu->createJumpKeys(); } void init_debug_xui_menu(LLMenuGL* menu) { - menu->append(new LLMenuItemCallGL("Floater Test...", LLFloaterTest::show)); - menu->append(new LLMenuItemCallGL("Font Test...", LLFloaterFontTest::show)); - menu->append(new LLMenuItemCallGL("Export Menus to XML...", handle_export_menus_to_xml)); - menu->append(new LLMenuItemCallGL("Edit UI...", LLFloaterEditUI::show)); - menu->append(new LLMenuItemCallGL("Load from XML...", handle_load_from_xml)); + menu->addChild(new LLMenuItemCallGL("Floater Test...", LLFloaterTest::show)); + menu->addChild(new LLMenuItemCallGL("Font Test...", LLFloaterFontTest::show)); + menu->addChild(new LLMenuItemCallGL("Export Menus to XML...", handle_export_menus_to_xml)); + menu->addChild(new LLMenuItemCallGL("Edit UI...", LLFloaterEditUI::show)); + menu->addChild(new LLMenuItemCallGL("Load from XML...", handle_load_from_xml)); // - //menu->append(new LLMenuItemCallGL("Save to XML...", handle_save_to_xml)); - menu->append(new LLMenuItemCallGL("Save to XML...", handle_save_to_xml, NULL, NULL, 'X', MASK_CONTROL | MASK_ALT | MASK_SHIFT)); + //menu->addChild(new LLMenuItemCallGL("Save to XML...", handle_save_to_xml)); + menu->addChild(new LLMenuItemCallGL("Save to XML...", handle_save_to_xml, NULL, NULL, 'X', MASK_CONTROL | MASK_ALT | MASK_SHIFT)); // - menu->append(new LLMenuItemCheckGL("Show XUI Names", toggle_show_xui_names, NULL, check_show_xui_names, NULL)); + menu->addChild(new LLMenuItemCheckGL("Show XUI Names", toggle_show_xui_names, NULL, check_show_xui_names, NULL)); - //menu->append(new LLMenuItemCallGL("Buy Currency...", handle_buy_currency)); + //menu->addChild(new LLMenuItemCallGL("Buy Currency...", handle_buy_currency)); menu->createJumpKeys(); } @@ -1329,94 +1323,94 @@ void init_debug_rendering_menu(LLMenuGL* menu) // Debug menu for types/pools // sub_menu = new LLMenuGL("Types"); - menu->appendMenu(sub_menu); + menu->addChild(sub_menu); - sub_menu->append(new LLMenuItemCheckGL("Simple", + sub_menu->addChild(new LLMenuItemCheckGL("Simple", &LLPipeline::toggleRenderTypeControl, NULL, &LLPipeline::hasRenderTypeControl, (void*)LLPipeline::RENDER_TYPE_SIMPLE, '1', MASK_CONTROL|MASK_ALT|MASK_SHIFT)); - sub_menu->append(new LLMenuItemCheckGL("Alpha", + sub_menu->addChild(new LLMenuItemCheckGL("Alpha", &LLPipeline::toggleRenderTypeControl, NULL, &LLPipeline::hasRenderTypeControl, (void*)LLPipeline::RENDER_TYPE_ALPHA, '2', MASK_CONTROL|MASK_ALT|MASK_SHIFT)); - sub_menu->append(new LLMenuItemCheckGL("Tree", + sub_menu->addChild(new LLMenuItemCheckGL("Tree", &LLPipeline::toggleRenderTypeControl, NULL, &LLPipeline::hasRenderTypeControl, (void*)LLPipeline::RENDER_TYPE_TREE, '3', MASK_CONTROL|MASK_ALT|MASK_SHIFT)); - sub_menu->append(new LLMenuItemCheckGL("Character", + sub_menu->addChild(new LLMenuItemCheckGL("Character", &LLPipeline::toggleRenderTypeControl, NULL, &LLPipeline::hasRenderTypeControl, (void*)LLPipeline::RENDER_TYPE_AVATAR, '4', MASK_CONTROL|MASK_ALT|MASK_SHIFT)); - sub_menu->append(new LLMenuItemCheckGL("SurfacePatch", + sub_menu->addChild(new LLMenuItemCheckGL("SurfacePatch", &LLPipeline::toggleRenderTypeControl, NULL, &LLPipeline::hasRenderTypeControl, (void*)LLPipeline::RENDER_TYPE_TERRAIN, '5', MASK_CONTROL|MASK_ALT|MASK_SHIFT)); - sub_menu->append(new LLMenuItemCheckGL("Sky", + sub_menu->addChild(new LLMenuItemCheckGL("Sky", &LLPipeline::toggleRenderTypeControl, NULL, &LLPipeline::hasRenderTypeControl, (void*)LLPipeline::RENDER_TYPE_SKY, '6', MASK_CONTROL|MASK_ALT|MASK_SHIFT)); - sub_menu->append(new LLMenuItemCheckGL("Water", + sub_menu->addChild(new LLMenuItemCheckGL("Water", &LLPipeline::toggleRenderTypeControl, NULL, &LLPipeline::hasRenderTypeControl, (void*)LLPipeline::RENDER_TYPE_WATER, '7', MASK_CONTROL|MASK_ALT|MASK_SHIFT)); - sub_menu->append(new LLMenuItemCheckGL("Ground", + sub_menu->addChild(new LLMenuItemCheckGL("Ground", &LLPipeline::toggleRenderTypeControl, NULL, &LLPipeline::hasRenderTypeControl, (void*)LLPipeline::RENDER_TYPE_GROUND, '8', MASK_CONTROL|MASK_ALT|MASK_SHIFT)); - sub_menu->append(new LLMenuItemCheckGL("Volume", + sub_menu->addChild(new LLMenuItemCheckGL("Volume", &LLPipeline::toggleRenderTypeControl, NULL, &LLPipeline::hasRenderTypeControl, (void*)LLPipeline::RENDER_TYPE_VOLUME, '9', MASK_CONTROL|MASK_ALT|MASK_SHIFT)); - sub_menu->append(new LLMenuItemCheckGL("Grass", + sub_menu->addChild(new LLMenuItemCheckGL("Grass", &LLPipeline::toggleRenderTypeControl, NULL, &LLPipeline::hasRenderTypeControl, (void*)LLPipeline::RENDER_TYPE_GRASS, '0', MASK_CONTROL|MASK_ALT|MASK_SHIFT)); //NOTE: Using a static variable, as an unsigned long long cannot fit in the space of a pointer. Pass pointer to callbacks static U64 cloud_flags = (1ULL<append(new LLMenuItemCheckGL("Clouds", //This clobbers skyuseclassicclouds, but.. big deal. + sub_menu->addChild(new LLMenuItemCheckGL("Clouds", //This clobbers skyuseclassicclouds, but.. big deal. &LLPipeline::toggleRenderPairedTypeControl, NULL, &LLPipeline::hasRenderPairedTypeControl, (void*)&cloud_flags, '-', MASK_CONTROL|MASK_ALT| MASK_SHIFT)); - sub_menu->append(new LLMenuItemCheckGL("Particles", + sub_menu->addChild(new LLMenuItemCheckGL("Particles", &LLPipeline::toggleRenderTypeControl, NULL, &LLPipeline::hasRenderTypeControl, (void*)LLPipeline::RENDER_TYPE_PARTICLES, '=', MASK_CONTROL|MASK_ALT|MASK_SHIFT)); - sub_menu->append(new LLMenuItemCheckGL("Bump", + sub_menu->addChild(new LLMenuItemCheckGL("Bump", &LLPipeline::toggleRenderTypeControl, NULL, &LLPipeline::hasRenderTypeControl, (void*)LLPipeline::RENDER_TYPE_BUMP, '\\', MASK_CONTROL|MASK_ALT|MASK_SHIFT)); sub_menu->createJumpKeys(); sub_menu = new LLMenuGL("Features"); - menu->appendMenu(sub_menu); - sub_menu->append(new LLMenuItemCheckGL("UI", + menu->addChild(sub_menu); + sub_menu->addChild(new LLMenuItemCheckGL("UI", &LLPipeline::toggleRenderDebugFeature, NULL, &LLPipeline::toggleRenderDebugFeatureControl, (void*)LLPipeline::RENDER_DEBUG_FEATURE_UI, KEY_F1, MASK_ALT|MASK_CONTROL)); - sub_menu->append(new LLMenuItemCheckGL("Selected", + sub_menu->addChild(new LLMenuItemCheckGL("Selected", &LLPipeline::toggleRenderDebugFeature, NULL, &LLPipeline::toggleRenderDebugFeatureControl, (void*)LLPipeline::RENDER_DEBUG_FEATURE_SELECTED, KEY_F2, MASK_ALT|MASK_CONTROL)); - sub_menu->append(new LLMenuItemCheckGL("Highlighted", + sub_menu->addChild(new LLMenuItemCheckGL("Highlighted", &LLPipeline::toggleRenderDebugFeature, NULL, &LLPipeline::toggleRenderDebugFeatureControl, (void*)LLPipeline::RENDER_DEBUG_FEATURE_HIGHLIGHTED, KEY_F3, MASK_ALT|MASK_CONTROL)); - sub_menu->append(new LLMenuItemCheckGL("Dynamic Textures", + sub_menu->addChild(new LLMenuItemCheckGL("Dynamic Textures", &LLPipeline::toggleRenderDebugFeature, NULL, &LLPipeline::toggleRenderDebugFeatureControl, (void*)LLPipeline::RENDER_DEBUG_FEATURE_DYNAMIC_TEXTURES, KEY_F4, MASK_ALT|MASK_CONTROL)); - sub_menu->append(new LLMenuItemCheckGL( "Foot Shadows", + sub_menu->addChild(new LLMenuItemCheckGL( "Foot Shadows", &LLPipeline::toggleRenderDebugFeature, NULL, &LLPipeline::toggleRenderDebugFeatureControl, (void*)LLPipeline::RENDER_DEBUG_FEATURE_FOOT_SHADOWS, KEY_F5, MASK_ALT|MASK_CONTROL)); - sub_menu->append(new LLMenuItemCheckGL("Fog", + sub_menu->addChild(new LLMenuItemCheckGL("Fog", &LLPipeline::toggleRenderDebugFeature, NULL, &LLPipeline::toggleRenderDebugFeatureControl, (void*)LLPipeline::RENDER_DEBUG_FEATURE_FOG, KEY_F6, MASK_ALT|MASK_CONTROL)); - sub_menu->append(new LLMenuItemCheckGL("Test FRInfo", + sub_menu->addChild(new LLMenuItemCheckGL("Test FRInfo", &LLPipeline::toggleRenderDebugFeature, NULL, &LLPipeline::toggleRenderDebugFeatureControl, (void*)LLPipeline::RENDER_DEBUG_FEATURE_FR_INFO, KEY_F8, MASK_ALT|MASK_CONTROL)); - sub_menu->append(new LLMenuItemCheckGL( "Flexible Objects", + sub_menu->addChild(new LLMenuItemCheckGL( "Flexible Objects", &LLPipeline::toggleRenderDebugFeature, NULL, &LLPipeline::toggleRenderDebugFeatureControl, (void*)LLPipeline::RENDER_DEBUG_FEATURE_FLEXIBLE, KEY_F9, MASK_ALT|MASK_CONTROL)); @@ -1427,165 +1421,165 @@ void init_debug_rendering_menu(LLMenuGL* menu) // Debug menu for info displays // sub_menu = new LLMenuGL("Info Displays"); - menu->appendMenu(sub_menu); + menu->addChild(sub_menu); - sub_menu->append(new LLMenuItemCheckGL("Verify", &LLPipeline::toggleRenderDebug, NULL, + sub_menu->addChild(new LLMenuItemCheckGL("Verify", &LLPipeline::toggleRenderDebug, NULL, &LLPipeline::toggleRenderDebugControl, (void*)LLPipeline::RENDER_DEBUG_VERIFY)); - sub_menu->append(new LLMenuItemCheckGL("BBoxes", &LLPipeline::toggleRenderDebug, NULL, + sub_menu->addChild(new LLMenuItemCheckGL("BBoxes", &LLPipeline::toggleRenderDebug, NULL, &LLPipeline::toggleRenderDebugControl, (void*)LLPipeline::RENDER_DEBUG_BBOXES)); - sub_menu->append(new LLMenuItemCheckGL("Points", &LLPipeline::toggleRenderDebug, NULL, + sub_menu->addChild(new LLMenuItemCheckGL("Points", &LLPipeline::toggleRenderDebug, NULL, &LLPipeline::toggleRenderDebugControl, (void*)LLPipeline::RENDER_DEBUG_POINTS)); - sub_menu->append(new LLMenuItemCheckGL("Octree", &LLPipeline::toggleRenderDebug, NULL, + sub_menu->addChild(new LLMenuItemCheckGL("Octree", &LLPipeline::toggleRenderDebug, NULL, &LLPipeline::toggleRenderDebugControl, (void*)LLPipeline::RENDER_DEBUG_OCTREE)); - sub_menu->append(new LLMenuItemCheckGL("Shadow Frusta", &LLPipeline::toggleRenderDebug, NULL, + sub_menu->addChild(new LLMenuItemCheckGL("Shadow Frusta", &LLPipeline::toggleRenderDebug, NULL, &LLPipeline::toggleRenderDebugControl, (void*)LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA)); - sub_menu->append(new LLMenuItemCheckGL("Occlusion", &LLPipeline::toggleRenderDebug, NULL, + sub_menu->addChild(new LLMenuItemCheckGL("Occlusion", &LLPipeline::toggleRenderDebug, NULL, &LLPipeline::toggleRenderDebugControl, (void*)LLPipeline::RENDER_DEBUG_OCCLUSION)); - sub_menu->append(new LLMenuItemCheckGL("Render Batches", &LLPipeline::toggleRenderDebug, NULL, + sub_menu->addChild(new LLMenuItemCheckGL("Render Batches", &LLPipeline::toggleRenderDebug, NULL, &LLPipeline::toggleRenderDebugControl, (void*)LLPipeline::RENDER_DEBUG_BATCH_SIZE)); - sub_menu->append(new LLMenuItemCheckGL("Animated Textures", &LLPipeline::toggleRenderDebug, NULL, + sub_menu->addChild(new LLMenuItemCheckGL("Animated Textures", &LLPipeline::toggleRenderDebug, NULL, &LLPipeline::toggleRenderDebugControl, (void*)LLPipeline::RENDER_DEBUG_TEXTURE_ANIM)); - sub_menu->append(new LLMenuItemCheckGL("Texture Priority", &LLPipeline::toggleRenderDebug, NULL, + sub_menu->addChild(new LLMenuItemCheckGL("Texture Priority", &LLPipeline::toggleRenderDebug, NULL, &LLPipeline::toggleRenderDebugControl, (void*)LLPipeline::RENDER_DEBUG_TEXTURE_PRIORITY)); - sub_menu->append(new LLMenuItemCheckGL("Avatar Rendering Cost", &LLPipeline::toggleRenderDebug, NULL, + sub_menu->addChild(new LLMenuItemCheckGL("Avatar Rendering Cost", &LLPipeline::toggleRenderDebug, NULL, &LLPipeline::toggleRenderDebugControl, (void*)LLPipeline::RENDER_DEBUG_SHAME)); - sub_menu->append(new LLMenuItemCheckGL("Texture Area (sqrt(A))",&LLPipeline::toggleRenderDebug, NULL, + sub_menu->addChild(new LLMenuItemCheckGL("Texture Area (sqrt(A))",&LLPipeline::toggleRenderDebug, NULL, &LLPipeline::toggleRenderDebugControl, (void*)LLPipeline::RENDER_DEBUG_TEXTURE_AREA)); - sub_menu->append(new LLMenuItemCheckGL("Face Area (sqrt(A))",&LLPipeline::toggleRenderDebug, NULL, + sub_menu->addChild(new LLMenuItemCheckGL("Face Area (sqrt(A))",&LLPipeline::toggleRenderDebug, NULL, &LLPipeline::toggleRenderDebugControl, (void*)LLPipeline::RENDER_DEBUG_FACE_AREA)); - sub_menu->append(new LLMenuItemCheckGL("Lights", &LLPipeline::toggleRenderDebug, NULL, + sub_menu->addChild(new LLMenuItemCheckGL("Lights", &LLPipeline::toggleRenderDebug, NULL, &LLPipeline::toggleRenderDebugControl, (void*)LLPipeline::RENDER_DEBUG_LIGHTS)); - sub_menu->append(new LLMenuItemCheckGL("Particles", &LLPipeline::toggleRenderDebug, NULL, + sub_menu->addChild(new LLMenuItemCheckGL("Particles", &LLPipeline::toggleRenderDebug, NULL, &LLPipeline::toggleRenderDebugControl, (void*)LLPipeline::RENDER_DEBUG_PARTICLES)); - sub_menu->append(new LLMenuItemCheckGL("Composition", &LLPipeline::toggleRenderDebug, NULL, + sub_menu->addChild(new LLMenuItemCheckGL("Composition", &LLPipeline::toggleRenderDebug, NULL, &LLPipeline::toggleRenderDebugControl, (void*)LLPipeline::RENDER_DEBUG_COMPOSITION)); - sub_menu->append(new LLMenuItemCheckGL("Glow",&LLPipeline::toggleRenderDebug, NULL, + sub_menu->addChild(new LLMenuItemCheckGL("Glow",&LLPipeline::toggleRenderDebug, NULL, &LLPipeline::toggleRenderDebugControl, (void*)LLPipeline::RENDER_DEBUG_GLOW)); - sub_menu->append(new LLMenuItemCheckGL("Raycasting", &LLPipeline::toggleRenderDebug, NULL, + sub_menu->addChild(new LLMenuItemCheckGL("Raycasting", &LLPipeline::toggleRenderDebug, NULL, &LLPipeline::toggleRenderDebugControl, (void*)LLPipeline::RENDER_DEBUG_RAYCAST)); - sub_menu->append(new LLMenuItemCheckGL("Sculpt", &LLPipeline::toggleRenderDebug, NULL, + sub_menu->addChild(new LLMenuItemCheckGL("Sculpt", &LLPipeline::toggleRenderDebug, NULL, &LLPipeline::toggleRenderDebugControl, (void*)LLPipeline::RENDER_DEBUG_SCULPTED)); - sub_menu->append(new LLMenuItemCheckGL("Build Queue", &LLPipeline::toggleRenderDebug, NULL, + sub_menu->addChild(new LLMenuItemCheckGL("Build Queue", &LLPipeline::toggleRenderDebug, NULL, &LLPipeline::toggleRenderDebugControl, (void*)LLPipeline::RENDER_DEBUG_BUILD_QUEUE)); - sub_menu->append(new LLMenuItemCheckGL("Update Types", &LLPipeline::toggleRenderDebug, NULL, + sub_menu->addChild(new LLMenuItemCheckGL("Update Types", &LLPipeline::toggleRenderDebug, NULL, &LLPipeline::toggleRenderDebugControl, (void*)LLPipeline::RENDER_DEBUG_UPDATE_TYPE)); - sub_menu->append(new LLMenuItemCheckGL("Physics Shapes", &LLPipeline::toggleRenderDebug, NULL, + sub_menu->addChild(new LLMenuItemCheckGL("Physics Shapes", &LLPipeline::toggleRenderDebug, NULL, &LLPipeline::toggleRenderDebugControl, (void*)LLPipeline::RENDER_DEBUG_PHYSICS_SHAPES)); - sub_menu->append(new LLMenuItemCheckGL("Normals", &LLPipeline::toggleRenderDebug, NULL, + sub_menu->addChild(new LLMenuItemCheckGL("Normals", &LLPipeline::toggleRenderDebug, NULL, &LLPipeline::toggleRenderDebugControl, (void*)LLPipeline::RENDER_DEBUG_NORMALS)); - sub_menu->append(new LLMenuItemCheckGL("LOD Info", &LLPipeline::toggleRenderDebug, NULL, + sub_menu->addChild(new LLMenuItemCheckGL("LOD Info", &LLPipeline::toggleRenderDebug, NULL, &LLPipeline::toggleRenderDebugControl, (void*)LLPipeline::RENDER_DEBUG_LOD_INFO)); - sub_menu->append(new LLMenuItemCheckGL("Wind Vectors", &LLPipeline::toggleRenderDebug, NULL, + sub_menu->addChild(new LLMenuItemCheckGL("Wind Vectors", &LLPipeline::toggleRenderDebug, NULL, &LLPipeline::toggleRenderDebugControl, (void*)LLPipeline::RENDER_DEBUG_WIND_VECTORS)); - sub_menu->append(new LLMenuItemCheckGL("Complexity", &LLPipeline::toggleRenderDebug, NULL, + sub_menu->addChild(new LLMenuItemCheckGL("Complexity", &LLPipeline::toggleRenderDebug, NULL, &LLPipeline::toggleRenderDebugControl, (void*)LLPipeline::RENDER_DEBUG_RENDER_COMPLEXITY)); ; sub_menu = new LLMenuGL("Render Tests"); - sub_menu->append(new LLMenuItemCheckGL("Camera Offset", + sub_menu->addChild(new LLMenuItemCheckGL("Camera Offset", &menu_toggle_control, NULL, &menu_check_control, (void*)"CameraOffset")); - sub_menu->append(new LLMenuItemToggleGL("Randomize Framerate", &gRandomizeFramerate)); + sub_menu->addChild(new LLMenuItemToggleGL("Randomize Framerate", &gRandomizeFramerate)); - sub_menu->append(new LLMenuItemToggleGL("Periodic Slow Frame", &gPeriodicSlowFrame)); + sub_menu->addChild(new LLMenuItemToggleGL("Periodic Slow Frame", &gPeriodicSlowFrame)); - sub_menu->append(new LLMenuItemToggleGL("Frame Test", &LLPipeline::sRenderFrameTest)); + sub_menu->addChild(new LLMenuItemToggleGL("Frame Test", &LLPipeline::sRenderFrameTest)); sub_menu->createJumpKeys(); - menu->appendMenu( sub_menu ); + menu->addChild( sub_menu ); - menu->appendSeparator(); - menu->append(new LLMenuItemCheckGL("Axes", menu_toggle_control, NULL, menu_check_control, (void*)"ShowAxes")); - //menu->append(new LLMenuItemCheckGL("Cull Small Objects", toggle_cull_small, NULL, menu_check_control, (void*)"RenderCullBySize")); + menu->addSeparator(); + menu->addChild(new LLMenuItemCheckGL("Axes", menu_toggle_control, NULL, menu_check_control, (void*)"ShowAxes")); + //menu->addChild(new LLMenuItemCheckGL("Cull Small Objects", toggle_cull_small, NULL, menu_check_control, (void*)"RenderCullBySize")); - menu->appendSeparator(); - menu->append(new LLMenuItemCheckGL("Hide Selected", menu_toggle_control, NULL, menu_check_control, (void*)"HideSelectedObjects")); - menu->appendSeparator(); - menu->append(new LLMenuItemCheckGL("Tangent Basis", menu_toggle_control, NULL, menu_check_control, (void*)"ShowTangentBasis")); - menu->append(new LLMenuItemCallGL("Selected Texture Info", handle_selected_texture_info, NULL, NULL, 'T', MASK_CONTROL|MASK_SHIFT|MASK_ALT)); - //menu->append(new LLMenuItemCallGL("Dump Image List", handle_dump_image_list, NULL, NULL, 'I', MASK_CONTROL|MASK_SHIFT)); + menu->addSeparator(); + menu->addChild(new LLMenuItemCheckGL("Hide Selected", menu_toggle_control, NULL, menu_check_control, (void*)"HideSelectedObjects")); + menu->addSeparator(); + menu->addChild(new LLMenuItemCheckGL("Tangent Basis", menu_toggle_control, NULL, menu_check_control, (void*)"ShowTangentBasis")); + menu->addChild(new LLMenuItemCallGL("Selected Texture Info", handle_selected_texture_info, NULL, NULL, 'T', MASK_CONTROL|MASK_SHIFT|MASK_ALT)); + //menu->addChild(new LLMenuItemCallGL("Dump Image List", handle_dump_image_list, NULL, NULL, 'I', MASK_CONTROL|MASK_SHIFT)); - menu->append(new LLMenuItemToggleGL("Wireframe", &gUseWireframe, + menu->addChild(new LLMenuItemToggleGL("Wireframe", &gUseWireframe, 'R', MASK_CONTROL|MASK_SHIFT)); LLMenuItemCheckGL* item; item = new LLMenuItemCheckGL("Object-Object Occlusion", menu_toggle_control, NULL, menu_check_control, (void*)"UseOcclusion", 'O', MASK_CONTROL|MASK_SHIFT); item->setEnabled(gGLManager.mHasOcclusionQuery && LLFeatureManager::getInstance()->isFeatureAvailable("UseOcclusion")); - menu->append(item); + menu->addChild(item); item = new LLMenuItemCheckGL("Debug GL", menu_toggle_control, NULL, menu_check_control, (void*)"RenderDebugGL"); - menu->append(item); + menu->addChild(item); item = new LLMenuItemCheckGL("Debug Pipeline", menu_toggle_control, NULL, menu_check_control, (void*)"RenderDebugPipeline"); - menu->append(item); + menu->addChild(item); item = new LLMenuItemCheckGL("Automatic Alpha Masks (non-deferred)", menu_toggle_control, NULL, menu_check_control, (void*)"RenderAutoMaskAlphaNonDeferred"); - menu->append(item); + menu->addChild(item); item = new LLMenuItemCheckGL("Automatic Alpha Masks (deferred)", menu_toggle_control, NULL, menu_check_control, (void*)"RenderAutoMaskAlphaDeferred"); - menu->append(item); + menu->addChild(item); item = new LLMenuItemCheckGL("Animate Textures", menu_toggle_control, NULL, menu_check_control, (void*)"AnimateTextures"); - menu->append(item); + menu->addChild(item); item = new LLMenuItemCheckGL("Disable Textures", menu_toggle_control, NULL, menu_check_control, (void*)"TextureDisable"); - menu->append(item); + menu->addChild(item); item = new LLMenuItemCheckGL("HTTP Get Textures", menu_toggle_control, NULL, menu_check_control, (void*)"ImagePipelineUseHTTP"); - menu->append(item); + menu->addChild(item); item = new LLMenuItemCheckGL("Run Multiple Threads", menu_toggle_control, NULL, menu_check_control, (void*)"RunMultipleThreads"); - menu->append(item); + menu->addChild(item); item = new LLMenuItemCheckGL("Cheesy Beacon", menu_toggle_control, NULL, menu_check_control, (void*)"CheesyBeacon"); - menu->append(item); + menu->addChild(item); item = new LLMenuItemCheckGL("Attached Lights", menu_toggle_attached_lights, NULL, menu_check_control, (void*)"RenderAttachedLights"); - menu->append(item); + menu->addChild(item); item = new LLMenuItemCheckGL("Attached Particles", menu_toggle_attached_particles, NULL, menu_check_control, (void*)"RenderAttachedParticles"); - menu->append(item); + menu->addChild(item); item = new LLMenuItemCheckGL("Audit Texture", menu_toggle_control, NULL, menu_check_control, (void*)"AuditTexture"); - menu->append(item); + menu->addChild(item); #ifndef LL_RELEASE_FOR_DOWNLOAD - menu->appendSeparator(); - menu->append(new LLMenuItemCallGL("Memory Leaking Simulation", LLFloaterMemLeak::show, NULL, NULL)); + menu->addSeparator(); + menu->addChild(new LLMenuItemCallGL("Memory Leaking Simulation", LLFloaterMemLeak::show, NULL, NULL)); #else if(gSavedSettings.getBOOL("QAMode")) { - menu->appendSeparator(); - menu->append(new LLMenuItemCallGL("Memory Leaking Simulation", LLFloaterMemLeak::show, NULL, NULL)); + menu->addSeparator(); + menu->addChild(new LLMenuItemCallGL("Memory Leaking Simulation", LLFloaterMemLeak::show, NULL, NULL)); } #endif @@ -1595,74 +1589,74 @@ void init_debug_rendering_menu(LLMenuGL* menu) void init_debug_avatar_menu(LLMenuGL* menu) { LLMenuGL* sub_menu = new LLMenuGL("Character Tests"); - menu->appendMenu(sub_menu); - sub_menu->append(new LLMenuItemToggleGL("Go Away/AFK When Idle", + menu->addChild(sub_menu); + sub_menu->addChild(new LLMenuItemToggleGL("Go Away/AFK When Idle", &gAllowIdleAFK)); - sub_menu->append(new LLMenuItemCallGL("Appearance To XML", + sub_menu->addChild(new LLMenuItemCallGL("Appearance To XML", &LLVOAvatar::dumpArchetypeXML)); // HACK for easy testing of avatar geometry - sub_menu->append(new LLMenuItemCallGL( "Toggle Character Geometry", + sub_menu->addChild(new LLMenuItemCallGL( "Toggle Character Geometry", &handle_god_request_avatar_geometry, &enable_god_customer_service, NULL)); - sub_menu->append(new LLMenuItemCallGL("Test Male", + sub_menu->addChild(new LLMenuItemCallGL("Test Male", handle_test_male)); - sub_menu->append(new LLMenuItemCallGL("Test Female", + sub_menu->addChild(new LLMenuItemCallGL("Test Female", handle_test_female)); - sub_menu->append(new LLMenuItemCallGL("Toggle PG", handle_toggle_pg)); + sub_menu->addChild(new LLMenuItemCallGL("Toggle PG", handle_toggle_pg)); - sub_menu->append(new LLMenuItemCheckGL("Allow Select Avatar", menu_toggle_control, NULL, menu_check_control, (void*)"AllowSelectAvatar")); + sub_menu->addChild(new LLMenuItemCheckGL("Allow Select Avatar", menu_toggle_control, NULL, menu_check_control, (void*)"AllowSelectAvatar")); sub_menu->createJumpKeys(); - menu->appendMenu(sub_menu); + menu->addChild(sub_menu); - menu->append(new LLMenuItemToggleGL("Tap-Tap-Hold To Run", &gAllowTapTapHoldRun)); - menu->append(new LLMenuItemCallGL("Force Params to Default", &LLAgent::clearVisualParams, NULL)); - menu->append(new LLMenuItemCallGL("Reload Vertex Shader", &reload_vertex_shader, NULL)); - menu->append(new LLMenuItemToggleGL("Animation Info", &LLVOAvatar::sShowAnimationDebug)); - menu->append(new LLMenuItemCallGL("Slow Motion Animations", &slow_mo_animations, NULL)); + menu->addChild(new LLMenuItemToggleGL("Tap-Tap-Hold To Run", &gAllowTapTapHoldRun)); + menu->addChild(new LLMenuItemCallGL("Force Params to Default", &LLAgent::clearVisualParams, NULL)); + menu->addChild(new LLMenuItemCallGL("Reload Vertex Shader", &reload_vertex_shader, NULL)); + menu->addChild(new LLMenuItemToggleGL("Animation Info", &LLVOAvatar::sShowAnimationDebug)); + menu->addChild(new LLMenuItemCallGL("Slow Motion Animations", &slow_mo_animations, NULL)); LLMenuItemCheckGL* item; item = new LLMenuItemCheckGL("Show Look At", menu_toggle_control, NULL, menu_check_control, (void*)"AscentShowLookAt"); - menu->append(item); + menu->addChild(item); - menu->append(new LLMenuItemToggleGL("Show Point At", &LLHUDEffectPointAt::sDebugPointAt)); - menu->append(new LLMenuItemToggleGL("Debug Joint Updates", &LLVOAvatar::sJointDebug)); - menu->append(new LLMenuItemToggleGL("Disable LOD", &LLViewerJoint::sDisableLOD)); - menu->append(new LLMenuItemToggleGL("Debug Character Vis", &LLVOAvatar::sDebugInvisible)); - //menu->append(new LLMenuItemToggleGL("Show Attachment Points", &LLVOAvatar::sShowAttachmentPoints)); + menu->addChild(new LLMenuItemToggleGL("Show Point At", &LLHUDEffectPointAt::sDebugPointAt)); + menu->addChild(new LLMenuItemToggleGL("Debug Joint Updates", &LLVOAvatar::sJointDebug)); + menu->addChild(new LLMenuItemToggleGL("Disable LOD", &LLViewerJoint::sDisableLOD)); + menu->addChild(new LLMenuItemToggleGL("Debug Character Vis", &LLVOAvatar::sDebugInvisible)); + //menu->addChild(new LLMenuItemToggleGL("Show Attachment Points", &LLVOAvatar::sShowAttachmentPoints)); //diabling collision plane due to DEV-14477 -brad - //menu->append(new LLMenuItemToggleGL("Show Collision Plane", &LLVOAvatar::sShowFootPlane)); - menu->append(new LLMenuItemCheckGL("Show Collision Skeleton", + //menu->addChild(new LLMenuItemToggleGL("Show Collision Plane", &LLVOAvatar::sShowFootPlane)); + menu->addChild(new LLMenuItemCheckGL("Show Collision Skeleton", &LLPipeline::toggleRenderDebug, NULL, &LLPipeline::toggleRenderDebugControl, (void*)LLPipeline::RENDER_DEBUG_AVATAR_VOLUME)); - menu->append(new LLMenuItemCheckGL("Display Agent Target", + menu->addChild(new LLMenuItemCheckGL("Display Agent Target", &LLPipeline::toggleRenderDebug, NULL, &LLPipeline::toggleRenderDebugControl, (void*)LLPipeline::RENDER_DEBUG_AGENT_TARGET)); - menu->append(new LLMenuItemCheckGL("Attachment Bytes", + menu->addChild(new LLMenuItemCheckGL("Attachment Bytes", &LLPipeline::toggleRenderDebug, NULL, &LLPipeline::toggleRenderDebugControl, (void*)LLPipeline::RENDER_DEBUG_ATTACHMENT_BYTES)); - menu->append(new LLMenuItemToggleGL( "Debug Rotation", &LLVOAvatar::sDebugAvatarRotation)); - menu->append(new LLMenuItemCallGL("Dump Attachments", handle_dump_attachments)); - menu->append(new LLMenuItemCallGL("Rebake Textures", handle_rebake_textures, NULL, NULL, 'R', MASK_ALT | MASK_CONTROL )); + menu->addChild(new LLMenuItemToggleGL( "Debug Rotation", &LLVOAvatar::sDebugAvatarRotation)); + menu->addChild(new LLMenuItemCallGL("Dump Attachments", handle_dump_attachments)); + menu->addChild(new LLMenuItemCallGL("Rebake Textures", handle_rebake_textures, NULL, NULL, 'R', MASK_ALT | MASK_CONTROL )); // //#ifndef LL_RELEASE_FOR_DOWNLOAD // - menu->append(new LLMenuItemCallGL("Debug Avatar Textures", handle_debug_avatar_textures, NULL, NULL, 'A', MASK_SHIFT|MASK_CONTROL|MASK_ALT)); - menu->append(new LLMenuItemCallGL("Dump Local Textures", handle_dump_avatar_local_textures, NULL, NULL, 'M', MASK_SHIFT|MASK_ALT )); + menu->addChild(new LLMenuItemCallGL("Debug Avatar Textures", handle_debug_avatar_textures, NULL, NULL, 'A', MASK_SHIFT|MASK_CONTROL|MASK_ALT)); + menu->addChild(new LLMenuItemCallGL("Dump Local Textures", handle_dump_avatar_local_textures, NULL, NULL, 'M', MASK_SHIFT|MASK_ALT )); // //#endif // LLMenuItemCallGL* mesh_item = new LLMenuItemCallGL("Meshes And Morphs...", handle_meshes_and_morphs); mesh_item->setUserData((void*)mesh_item); // So we can remove it later - menu->append(mesh_item); + menu->addChild(mesh_item); menu->createJumpKeys(); } @@ -1675,41 +1669,41 @@ void init_debug_rlva_menu(LLMenuGL* menu) LLMenuGL* pDbgMenu = new LLMenuGL("Debug"); if (gSavedSettings.controlExists(RLV_SETTING_DEBUG)) - pDbgMenu->append(new LLMenuItemCheckGL("Show Debug Messages", menu_toggle_control, NULL, menu_check_control, (void*)RLV_SETTING_DEBUG)); - pDbgMenu->appendSeparator(); + pDbgMenu->addChild(new LLMenuItemCheckGL("Show Debug Messages", menu_toggle_control, NULL, menu_check_control, (void*)RLV_SETTING_DEBUG)); + pDbgMenu->addSeparator(); if (gSavedSettings.controlExists(RLV_SETTING_ENABLELEGACYNAMING)) - pDbgMenu->append(new LLMenuItemCheckGL("Enable Legacy Naming", menu_toggle_control, NULL, menu_check_control, (void*)RLV_SETTING_ENABLELEGACYNAMING)); + pDbgMenu->addChild(new LLMenuItemCheckGL("Enable Legacy Naming", menu_toggle_control, NULL, menu_check_control, (void*)RLV_SETTING_ENABLELEGACYNAMING)); if (gSavedSettings.controlExists(RLV_SETTING_SHAREDINVAUTORENAME)) - pDbgMenu->append(new LLMenuItemCheckGL("Rename Shared Items on Wear", menu_toggle_control, NULL, menu_check_control, (void*)RLV_SETTING_SHAREDINVAUTORENAME)); + pDbgMenu->addChild(new LLMenuItemCheckGL("Rename Shared Items on Wear", menu_toggle_control, NULL, menu_check_control, (void*)RLV_SETTING_SHAREDINVAUTORENAME)); - menu->appendMenu(pDbgMenu); - menu->appendSeparator(); + menu->addChild(pDbgMenu); + menu->addSeparator(); } if (gSavedSettings.controlExists(RLV_SETTING_ENABLESHAREDWEAR)) - menu->append(new LLMenuItemCheckGL("Enable Shared Wear", menu_toggle_control, NULL, menu_check_control, (void*)RLV_SETTING_ENABLESHAREDWEAR)); - menu->appendSeparator(); + menu->addChild(new LLMenuItemCheckGL("Enable Shared Wear", menu_toggle_control, NULL, menu_check_control, (void*)RLV_SETTING_ENABLESHAREDWEAR)); + menu->addSeparator(); #ifdef RLV_EXTENSION_HIDELOCKED if ( (gSavedSettings.controlExists(RLV_SETTING_HIDELOCKEDLAYER)) && (gSavedSettings.controlExists(RLV_SETTING_HIDELOCKEDATTACH)) ) { - menu->append(new LLMenuItemCheckGL("Hide Locked Layers", menu_toggle_control, NULL, menu_check_control, (void*)RLV_SETTING_HIDELOCKEDLAYER)); - menu->append(new LLMenuItemCheckGL("Hide Locked Attachments", menu_toggle_control, NULL, menu_check_control, (void*)RLV_SETTING_HIDELOCKEDATTACH)); - //sub_menu->append(new LLMenuItemToggleGL("Hide locked inventory", &rlv_handler_t::fHideLockedInventory)); - menu->appendSeparator(); + menu->addChild(new LLMenuItemCheckGL("Hide Locked Layers", menu_toggle_control, NULL, menu_check_control, (void*)RLV_SETTING_HIDELOCKEDLAYER)); + menu->addChild(new LLMenuItemCheckGL("Hide Locked Attachments", menu_toggle_control, NULL, menu_check_control, (void*)RLV_SETTING_HIDELOCKEDATTACH)); + //sub_menu->addChild(new LLMenuItemToggleGL("Hide locked inventory", &rlv_handler_t::fHideLockedInventory)); + menu->addSeparator(); } #endif // RLV_EXTENSION_HIDELOCKED if (gSavedSettings.controlExists(RLV_SETTING_FORBIDGIVETORLV)) - menu->append(new LLMenuItemCheckGL("Forbid Give to #RLV", menu_toggle_control, NULL, menu_check_control, (void*)RLV_SETTING_FORBIDGIVETORLV)); + menu->addChild(new LLMenuItemCheckGL("Forbid Give to #RLV", menu_toggle_control, NULL, menu_check_control, (void*)RLV_SETTING_FORBIDGIVETORLV)); if (gSavedSettings.controlExists(RLV_SETTING_ENABLELEGACYNAMING)) - menu->append(new LLMenuItemCheckGL("Show Name Tags", menu_toggle_control, NULL, menu_check_control, (void*)RLV_SETTING_SHOWNAMETAGS)); - menu->appendSeparator(); + menu->addChild(new LLMenuItemCheckGL("Show Name Tags", menu_toggle_control, NULL, menu_check_control, (void*)RLV_SETTING_SHOWNAMETAGS)); + menu->addSeparator(); #ifdef RLV_EXTENSION_FLOATER_RESTRICTIONS // TODO-RLVa: figure out a way to tell if floater_rlv_behaviour.xml exists - menu->append(new LLMenuItemCallGL("Restrictions...", RlvFloaterBehaviour::show, NULL, NULL)); + menu->addChild(new LLMenuItemCallGL("Restrictions...", RlvFloaterBehaviour::show, NULL, NULL)); #endif // RLV_EXTENSION_FLOATER_RESTRICTIONS } // [/RLVa:KB] @@ -1718,73 +1712,73 @@ void init_server_menu(LLMenuGL* menu) { { LLMenuGL* sub = new LLMenuGL("Object"); - menu->appendMenu(sub); + menu->addChild(sub); - sub->append(new LLMenuItemCallGL( "Take Copy", + sub->addChild(new LLMenuItemCallGL( "Take Copy", &force_take_copy, &enable_god_customer_service, NULL, 'O', MASK_SHIFT | MASK_ALT | MASK_CONTROL)); #ifdef _CORY_TESTING - sub->append(new LLMenuItemCallGL( "Export Copy", + sub->addChild(new LLMenuItemCallGL( "Export Copy", &force_export_copy, NULL, NULL)); - sub->append(new LLMenuItemCallGL( "Import Geometry", + sub->addChild(new LLMenuItemCallGL( "Import Geometry", &force_import_geometry, NULL, NULL)); #endif - //sub->append(new LLMenuItemCallGL( "Force Public", + //sub->addChild(new LLMenuItemCallGL( "Force Public", // &handle_object_owner_none, NULL, NULL)); - //sub->append(new LLMenuItemCallGL( "Force Ownership/Permissive", + //sub->addChild(new LLMenuItemCallGL( "Force Ownership/Permissive", // &handle_object_owner_self_and_permissive, NULL, NULL, 'K', MASK_SHIFT | MASK_ALT | MASK_CONTROL)); - sub->append(new LLMenuItemCallGL( "Force Owner To Me", + sub->addChild(new LLMenuItemCallGL( "Force Owner To Me", &handle_object_owner_self, &enable_god_customer_service)); - sub->append(new LLMenuItemCallGL( "Force Owner Permissive", + sub->addChild(new LLMenuItemCallGL( "Force Owner Permissive", &handle_object_owner_permissive, &enable_god_customer_service)); - //sub->append(new LLMenuItemCallGL( "Force Totally Permissive", + //sub->addChild(new LLMenuItemCallGL( "Force Totally Permissive", // &handle_object_permissive)); - sub->append(new LLMenuItemCallGL( "Delete", + sub->addChild(new LLMenuItemCallGL( "Delete", &handle_force_delete, &enable_god_customer_service, NULL, KEY_DELETE, MASK_SHIFT | MASK_ALT | MASK_CONTROL)); - sub->append(new LLMenuItemCallGL( "Lock", + sub->addChild(new LLMenuItemCallGL( "Lock", &handle_object_lock, &enable_god_customer_service, NULL, 'L', MASK_SHIFT | MASK_ALT | MASK_CONTROL)); - sub->append(new LLMenuItemCallGL( "Get Asset IDs", + sub->addChild(new LLMenuItemCallGL( "Get Asset IDs", &handle_object_asset_ids, &enable_god_customer_service, NULL, 'I', MASK_SHIFT | MASK_ALT | MASK_CONTROL)); sub->createJumpKeys(); } { LLMenuGL* sub = new LLMenuGL("Parcel"); - menu->appendMenu(sub); + menu->addChild(sub); - sub->append(new LLMenuItemCallGL("Owner To Me", + sub->addChild(new LLMenuItemCallGL("Owner To Me", &handle_force_parcel_owner_to_me, &enable_god_customer_service, NULL)); - sub->append(new LLMenuItemCallGL("Set to Linden Content", + sub->addChild(new LLMenuItemCallGL("Set to Linden Content", &handle_force_parcel_to_content, &enable_god_customer_service, NULL, 'C', MASK_SHIFT | MASK_ALT | MASK_CONTROL)); - sub->appendSeparator(); - sub->append(new LLMenuItemCallGL("Claim Public Land", + sub->addSeparator(); + sub->addChild(new LLMenuItemCallGL("Claim Public Land", &handle_claim_public_land, &enable_god_customer_service)); sub->createJumpKeys(); } { LLMenuGL* sub = new LLMenuGL("Region"); - menu->appendMenu(sub); - sub->append(new LLMenuItemCallGL("Dump Temp Asset Data", + menu->addChild(sub); + sub->addChild(new LLMenuItemCallGL("Dump Temp Asset Data", &handle_region_dump_temp_asset_data, &enable_god_customer_service, NULL)); sub->createJumpKeys(); } - menu->append(new LLMenuItemCallGL( "God Tools...", + menu->addChild(new LLMenuItemCallGL( "God Tools...", &LLFloaterGodTools::show, &enable_god_basic, NULL)); - menu->appendSeparator(); + menu->addSeparator(); - menu->append(new LLMenuItemCallGL("Save Region State", + menu->addChild(new LLMenuItemCallGL("Save Region State", &LLPanelRegionTools::onSaveState, &enable_god_customer_service, NULL)); -// menu->append(new LLMenuItemCallGL("Force Join Group", handle_force_join_group)); +// menu->addChild(new LLMenuItemCallGL("Force Join Group", handle_force_join_group)); // -// menu->appendSeparator(); +// menu->addSeparator(); // -// menu->append(new LLMenuItemCallGL( "OverlayTitle", +// menu->addChild(new LLMenuItemCallGL( "OverlayTitle", // &handle_show_overlay_title, &enable_god_customer_service, NULL)); menu->createJumpKeys(); } @@ -5792,7 +5786,7 @@ void show_debug_menus() //gMenuBarView->setItemVisible("DebugOptions", visible); //gMenuBarView->setItemVisible(std::string(AVI_TOOLS), visible); - gMenuBarView->arrange(); // clean-up positioning + gMenuBarView->needsArrange(); // clean-up positioning }; } @@ -8293,11 +8287,11 @@ void handle_meshes_and_morphs(void* menu_item) { LLMenuItemCallGL* item = (LLMenuItemCallGL*) menu_item; LLMenuGL* parent_menu = (LLMenuGL*) item->getParent(); - parent_menu->remove(item); + parent_menu->removeChild(item); LLMenuGL* menu = new LLMenuGL("Meshes And Morphs"); - menu->append(new LLMenuItemCallGL("Dump Avatar Mesh Info", &LLPolyMesh::dumpDiagInfo)); - menu->appendSeparator(); + menu->addChild(new LLMenuItemCallGL("Dump Avatar Mesh Info", &LLPolyMesh::dumpDiagInfo)); + menu->addSeparator(); LLVOAvatar::mesh_info_t mesh_info; LLVOAvatar::getMeshInfo(&mesh_info); @@ -8329,30 +8323,30 @@ void handle_meshes_and_morphs(void* menu_item) LLPolyMesh::getMorphList(mesh, &morph_list); LLMenuGL* lod_menu = new LLMenuGL(caption); - lod_menu->append(new LLMenuItemCallGL("Save LLM", handle_mesh_save_llm, NULL, (void*) mesh_shared)); + lod_menu->addChild(new LLMenuItemCallGL("Save LLM", handle_mesh_save_llm, NULL, (void*) mesh_shared)); LLMenuGL* action_menu = new LLMenuGL("Base Mesh"); - action_menu->append(new LLMenuItemCallGL("Save OBJ", handle_mesh_save_obj, NULL, (void*) mesh_shared)); + action_menu->addChild(new LLMenuItemCallGL("Save OBJ", handle_mesh_save_obj, NULL, (void*) mesh_shared)); if (lod == 0) { // Since an LOD mesh has only faces, we won't enable this for // LOD meshes until we add code for processing the face commands. - action_menu->append(new LLMenuItemCallGL("Load OBJ", handle_mesh_load_obj, NULL, (void*) mesh_shared)); + action_menu->addChild(new LLMenuItemCallGL("Load OBJ", handle_mesh_load_obj, NULL, (void*) mesh_shared)); } action_menu->createJumpKeys(); - lod_menu->appendMenu(action_menu); + lod_menu->addChild(action_menu); action_menu = new LLMenuGL("Current Mesh"); - action_menu->append(new LLMenuItemCallGL("Save OBJ", handle_mesh_save_current_obj, NULL, (void*) mesh_shared)); + action_menu->addChild(new LLMenuItemCallGL("Save OBJ", handle_mesh_save_current_obj, NULL, (void*) mesh_shared)); action_menu->createJumpKeys(); - lod_menu->appendMenu(action_menu); + lod_menu->addChild(action_menu); - lod_menu->appendSeparator(); + lod_menu->addSeparator(); for(LLPolyMesh::morph_list_t::iterator morph_iter = morph_list.begin(); morph_iter != morph_list.end(); ++morph_iter) @@ -8362,23 +8356,23 @@ void handle_meshes_and_morphs(void* menu_item) action_menu = new LLMenuGL(morph_name); - action_menu->append(new LLMenuItemCallGL("Save OBJ", handle_morph_save_obj, NULL, (void*) morph_data)); - action_menu->append(new LLMenuItemCallGL("Load OBJ", handle_morph_load_obj, NULL, (void*) morph_data)); + action_menu->addChild(new LLMenuItemCallGL("Save OBJ", handle_morph_save_obj, NULL, (void*) morph_data)); + action_menu->addChild(new LLMenuItemCallGL("Load OBJ", handle_morph_load_obj, NULL, (void*) morph_data)); action_menu->createJumpKeys(); - lod_menu->appendMenu(action_menu); + lod_menu->addChild(action_menu); } lod_menu->createJumpKeys(); - type_menu->appendMenu(lod_menu); + type_menu->addChild(lod_menu); } type_menu->createJumpKeys(); - menu->appendMenu(type_menu); + menu->addChild(type_menu); } menu->createJumpKeys(); menu->updateParent(LLMenuGL::sMenuContainer); - parent_menu->appendMenu(menu); + parent_menu->addChild(menu); LLMenuGL::sMenuContainer->hideMenus(); LLFloater* tear_off_menu = LLTearOffMenu::create(menu); diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 15aac7dd5..471f5c371 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -290,7 +290,7 @@ BOOL LLVOAvatarSelf::buildMenus() // object_selected_and_point_valid); item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", iter->first); - gAttachPieMenu->append(item); + gAttachPieMenu->addChild(item); attachment_found = TRUE; break; @@ -306,7 +306,7 @@ BOOL LLVOAvatarSelf::buildMenus() if (!attachment_found) { - gAttachPieMenu->appendSeparator(); + gAttachPieMenu->addSeparator(); } } @@ -324,7 +324,7 @@ BOOL LLVOAvatarSelf::buildMenus() LLViewerJointAttachment* attachment = iter->second; if (attachment->getGroup() == i) { - gDetachPieMenu->append(new LLMenuItemCallGL(attachment->getName(), + gDetachPieMenu->addChild(new LLMenuItemCallGL(attachment->getName(), &handle_detach_from_avatar, object_attached, attachment)); attachment_found = TRUE; @@ -334,7 +334,7 @@ BOOL LLVOAvatarSelf::buildMenus() if (!attachment_found) { - gDetachPieMenu->appendSeparator(); + gDetachPieMenu->addSeparator(); } } } @@ -358,8 +358,8 @@ BOOL LLVOAvatarSelf::buildMenus() // NULL, // object_selected_and_point_valid); item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", iter->first); - gAttachScreenPieMenu->append(item); - gDetachScreenPieMenu->append(new LLMenuItemCallGL(attachment->getName(), + gAttachScreenPieMenu->addChild(item); + gDetachScreenPieMenu->addChild(new LLMenuItemCallGL(attachment->getName(), &handle_detach_from_avatar, object_attached, attachment)); } } @@ -387,17 +387,17 @@ BOOL LLVOAvatarSelf::buildMenus() NULL, &object_selected_and_point_valid, &attach_label, attachment); item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", iter->first); - gAttachSubMenu->append(item); + gAttachSubMenu->addChild(item); - gDetachSubMenu->append(new LLMenuItemCallGL(attachment->getName(), + gDetachSubMenu->addChild(new LLMenuItemCallGL(attachment->getName(), &handle_detach_from_avatar, object_attached, &detach_label, attachment)); } if (pass == 0) { // put separator between non-hud and hud attachments - gAttachSubMenu->appendSeparator(); - gDetachSubMenu->appendSeparator(); + gAttachSubMenu->addSeparator(); + gDetachSubMenu->addSeparator(); } } @@ -434,8 +434,8 @@ BOOL LLVOAvatarSelf::buildMenus() S32 attach_index = attach_it->second; while (cur_pie_slice < requested_pie_slice) { - gAttachBodyPartPieMenus[group]->appendSeparator(); - gDetachBodyPartPieMenus[group]->appendSeparator(); + gAttachBodyPartPieMenus[group]->addSeparator(); + gDetachBodyPartPieMenus[group]->addSeparator(); cur_pie_slice++; } @@ -449,9 +449,9 @@ BOOL LLVOAvatarSelf::buildMenus() // [/RLVa:KB] // LLMenuItemCallGL* item = new LLMenuItemCallGL(attachment->getName(), // NULL, object_selected_and_point_valid); - gAttachBodyPartPieMenus[group]->append(item); + gAttachBodyPartPieMenus[group]->addChild(item); item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", attach_index); - gDetachBodyPartPieMenus[group]->append(new LLMenuItemCallGL(attachment->getName(), + gDetachBodyPartPieMenus[group]->addChild(new LLMenuItemCallGL(attachment->getName(), &handle_detach_from_avatar, object_attached, attachment)); cur_pie_slice++; diff --git a/indra/newview/skins/default/xui/en-us/floater_inventory.xml b/indra/newview/skins/default/xui/en-us/floater_inventory.xml index 4c56c695b..0571d8518 100644 --- a/indra/newview/skins/default/xui/en-us/floater_inventory.xml +++ b/indra/newview/skins/default/xui/en-us/floater_inventory.xml @@ -58,8 +58,8 @@ left_delta="0" mouse_opaque="true" name="Worn Items" sort_order="WornItemsSortOrder" width="461" /> - +