diff options
65 files changed, 1012 insertions, 870 deletions
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 06781f1bdf..f259e8027e 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -554,6 +554,16 @@ BOOL LLButton::handleHover(S32 x, S32 y, MASK mask) return TRUE; } +void LLButton::getOverlayImageSize(S32& overlay_width, S32& overlay_height) +{ + overlay_width = mImageOverlay->getWidth(); + overlay_height = mImageOverlay->getHeight(); + + F32 scale_factor = llmin((F32)getRect().getWidth() / (F32)overlay_width, (F32)getRect().getHeight() / (F32)overlay_height, 1.f); + overlay_width = llround((F32)overlay_width * scale_factor); + overlay_height = llround((F32)overlay_height * scale_factor); +} + // virtual void LLButton::draw() @@ -781,12 +791,10 @@ void LLButton::draw() if (mImageOverlay.notNull()) { // get max width and height (discard level 0) - S32 overlay_width = mImageOverlay->getWidth(); - S32 overlay_height = mImageOverlay->getHeight(); + S32 overlay_width; + S32 overlay_height; - F32 scale_factor = llmin((F32)getRect().getWidth() / (F32)overlay_width, (F32)getRect().getHeight() / (F32)overlay_height, 1.f); - overlay_width = llround((F32)overlay_width * scale_factor); - overlay_height = llround((F32)overlay_height * scale_factor); + getOverlayImageSize(overlay_width, overlay_height); S32 center_x = getLocalRect().getCenterX(); S32 center_y = getLocalRect().getCenterY(); @@ -811,6 +819,7 @@ void LLButton::draw() { case LLFontGL::LEFT: text_left += overlay_width + mImgOverlayLabelSpace; + text_width -= overlay_width + mImgOverlayLabelSpace; mImageOverlay->draw( mLeftHPad, center_y - (overlay_height / 2), @@ -828,6 +837,7 @@ void LLButton::draw() break; case LLFontGL::RIGHT: text_right -= overlay_width + mImgOverlayLabelSpace; + text_width -= overlay_width + mImgOverlayLabelSpace; mImageOverlay->draw( getRect().getWidth() - mRightHPad - overlay_width, center_y - (overlay_height / 2), @@ -994,13 +1004,18 @@ void LLButton::resize(LLUIString label) S32 min_width = label_width + mLeftHPad + mRightHPad; if (mImageOverlay) { + S32 overlay_width = mImageOverlay->getWidth(); + F32 scale_factor = getRect().getHeight() / (F32)mImageOverlay->getHeight(); + overlay_width = llround((F32)overlay_width * scale_factor); + switch(mImageOverlayAlignment) { case LLFontGL::LEFT: case LLFontGL::RIGHT: - min_width += mImageOverlay->getWidth() + mImgOverlayLabelSpace; + min_width += overlay_width + mImgOverlayLabelSpace; break; case LLFontGL::HCENTER: + min_width = llmax(min_width, overlay_width + mLeftHPad + mRightHPad); break; default: // draw nothing diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index bc5e69fad5..08b45e01b3 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -270,6 +270,7 @@ public: protected: LLPointer<LLUIImage> getImageUnselected() const { return mImageUnselected; } LLPointer<LLUIImage> getImageSelected() const { return mImageSelected; } + void getOverlayImageSize(S32& overlay_width, S32& overlay_height); LLFrameTimer mMouseDownTimer; diff --git a/indra/llui/llcommandmanager.h b/indra/llui/llcommandmanager.h index 8435d915f3..4781f77177 100644 --- a/indra/llui/llcommandmanager.h +++ b/indra/llui/llcommandmanager.h @@ -81,6 +81,8 @@ private: std::string mName; }; +typedef std::list<LLCommandId> command_id_list_t; + class LLCommand { public: diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 0d1f608e61..4991c4afa6 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -55,11 +55,12 @@ LLLayoutPanel::LLLayoutPanel(const Params& p) mMaxDim(p.max_dim), mAutoResize(p.auto_resize), mUserResize(p.user_resize), - mFitContent(p.fit_content), mCollapsed(FALSE), mCollapseAmt(0.f), mVisibleAmt(1.f), // default to fully visible - mResizeBar(NULL) + mResizeBar(NULL), + mFractionalSize(0.f), + mOrientation(LLLayoutStack::HORIZONTAL) { // Set the expanded min dim if it is provided, otherwise it gets the p.min_dim value if (p.expanded_min_dim.isProvided()) @@ -89,9 +90,22 @@ LLLayoutPanel::~LLLayoutPanel() mResizeBar = NULL; } -F32 LLLayoutPanel::getCollapseFactor(LLLayoutStack::ELayoutOrientation orientation) +void LLLayoutPanel::reshape(S32 width, S32 height, BOOL called_from_parent) { - if (orientation == LLLayoutStack::HORIZONTAL) + if (mOrientation == LLLayoutStack::HORIZONTAL) + { + mFractionalSize += width - llround(mFractionalSize); + } + else + { + mFractionalSize += height - llround(mFractionalSize); + } + LLPanel::reshape(width, height, called_from_parent); +} + +F32 LLLayoutPanel::getCollapseFactor() +{ + if (mOrientation == LLLayoutStack::HORIZONTAL) { F32 collapse_amt = clamp_rescale(mCollapseAmt, 0.f, 1.f, 1.f, (F32)getRelevantMinDim() / (F32)llmax(1, getRect().getWidth())); @@ -105,14 +119,6 @@ F32 LLLayoutPanel::getCollapseFactor(LLLayoutStack::ELayoutOrientation orientati } } -void LLLayoutPanel::fitToContent() -{ - if (mFitContent) - { - setShape(calcBoundingRect()); - } -} - // // LLLayoutStack // @@ -158,11 +164,11 @@ void LLLayoutStack::draw() // scale clipping rectangle by visible amount if (mOrientation == HORIZONTAL) { - clip_rect.mRight = clip_rect.mLeft + llround((F32)clip_rect.getWidth() * (*panel_it)->getCollapseFactor(mOrientation)); + clip_rect.mRight = clip_rect.mLeft + llround((F32)clip_rect.getWidth() * (*panel_it)->getCollapseFactor()); } else { - clip_rect.mBottom = clip_rect.mTop - llround((F32)clip_rect.getHeight() * (*panel_it)->getCollapseFactor(mOrientation)); + clip_rect.mBottom = clip_rect.mTop - llround((F32)clip_rect.getHeight() * (*panel_it)->getCollapseFactor()); } LLPanel* panelp = (*panel_it); @@ -202,36 +208,15 @@ bool LLLayoutStack::addChild(LLView* child, S32 tab_group) LLLayoutPanel* panelp = dynamic_cast<LLLayoutPanel*>(child); if (panelp) { + panelp->mFractionalSize = (mOrientation == HORIZONTAL) + ? panelp->getRect().getWidth() + : panelp->getRect().getHeight(); + panelp->setOrientation(mOrientation); mPanels.push_back(panelp); } return LLView::addChild(child, tab_group); } - -S32 LLLayoutStack::getDefaultHeight(S32 cur_height) -{ - // if we are spanning our children (crude upward propagation of size) - // then don't enforce our size on our children - if (mOrientation == HORIZONTAL) - { - cur_height = llmax(mMinHeight, getRect().getHeight()); - } - - return cur_height; -} - -S32 LLLayoutStack::getDefaultWidth(S32 cur_width) -{ - // if we are spanning our children (crude upward propagation of size) - // then don't enforce our size on our children - if (mOrientation == VERTICAL) - { - cur_width = llmax(mMinWidth, getRect().getWidth()); - } - - return cur_width; -} - void LLLayoutStack::movePanel(LLPanel* panel_to_move, LLPanel* target_panel, bool move_to_front) { LLLayoutPanel* embedded_panel_to_move = findEmbeddedPanel(panel_to_move); @@ -326,14 +311,15 @@ void LLLayoutStack::updateLayout(BOOL force_resize) createResizeBars(); // calculate current extents - S32 total_width = 0; - S32 total_height = 0; + F32 total_size = 0.f; + // + // animate visibility + // e_panel_list_t::iterator panel_it; for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it) { LLLayoutPanel* panelp = (*panel_it); - panelp->fitToContent(); if (panelp->getVisible()) { if (mAnimate) @@ -371,181 +357,110 @@ void LLLayoutStack::updateLayout(BOOL force_resize) } } - if (panelp->mCollapsed) - { - panelp->mCollapseAmt = lerp(panelp->mCollapseAmt, 1.f, LLCriticalDamp::getInterpolant(mCloseTimeConstant)); - } - else - { - panelp->mCollapseAmt = lerp(panelp->mCollapseAmt, 0.f, LLCriticalDamp::getInterpolant(mCloseTimeConstant)); - } + F32 collapse_state = panelp->mCollapsed ? 1.f : 0.f; + panelp->mCollapseAmt = lerp(panelp->mCollapseAmt, collapse_state, LLCriticalDamp::getInterpolant(mCloseTimeConstant)); - if (mOrientation == HORIZONTAL) + total_size += panelp->mFractionalSize * panelp->getCollapseFactor(); + // want n-1 panel gaps for n panels + if (panel_it != mPanels.begin()) { - // enforce minimize size constraint by default - if (panelp->getRect().getWidth() < panelp->getRelevantMinDim()) - { - panelp->reshape(panelp->getRelevantMinDim(), panelp->getRect().getHeight()); - } - total_width += llround(panelp->getRect().getWidth() * panelp->getCollapseFactor(mOrientation)); - // want n-1 panel gaps for n panels - if (panel_it != mPanels.begin()) - { - total_width += mPanelSpacing; - } - } - else //VERTICAL - { - // enforce minimize size constraint by default - if (panelp->getRect().getHeight() < panelp->getRelevantMinDim()) - { - panelp->reshape(panelp->getRect().getWidth(), panelp->getRelevantMinDim()); - } - total_height += llround(panelp->getRect().getHeight() * panelp->getCollapseFactor(mOrientation)); - if (panel_it != mPanels.begin()) - { - total_height += mPanelSpacing; - } + total_size += mPanelSpacing; } } S32 num_resizable_panels = 0; - S32 shrink_headroom_available = 0; - S32 shrink_headroom_total = 0; + F32 shrink_headroom_available = 0.f; + F32 shrink_headroom_total = 0.f; for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it) { + LLLayoutPanel* panelp = (*panel_it); + // panels that are not fully visible do not count towards shrink headroom - if ((*panel_it)->getCollapseFactor(mOrientation) < 1.f) + if (panelp->getCollapseFactor() < 1.f) { continue; } - S32 relevant_dimension = (mOrientation == HORIZONTAL) ? (*panel_it)->getRect().getWidth() : (*panel_it)->getRect().getHeight(); - S32 relevant_min = (*panel_it)->getRelevantMinDim(); + F32 cur_size = panelp->mFractionalSize; + F32 min_size = (F32)panelp->getRelevantMinDim(); // if currently resizing a panel or the panel is flagged as not automatically resizing // only track total available headroom, but don't use it for automatic resize logic - if ((*panel_it)->mResizeBar->hasMouseCapture() - || (!(*panel_it)->mAutoResize + if (panelp->mResizeBar->hasMouseCapture() + || (!panelp->mAutoResize && !force_resize)) { - shrink_headroom_total += relevant_dimension - relevant_min; + shrink_headroom_total += cur_size - min_size; } else { num_resizable_panels++; - shrink_headroom_available += relevant_dimension - relevant_min; - shrink_headroom_total += relevant_dimension - relevant_min; + shrink_headroom_available += cur_size - min_size; + shrink_headroom_total += cur_size - min_size; } } // calculate how many pixels need to be distributed among layout panels // positive means panels need to grow, negative means shrink - S32 pixels_to_distribute; - if (mOrientation == HORIZONTAL) - { - pixels_to_distribute = getRect().getWidth() - total_width; - } - else //VERTICAL - { - pixels_to_distribute = getRect().getHeight() - total_height; - } + F32 pixels_to_distribute = (mOrientation == HORIZONTAL) + ? getRect().getWidth() - total_size + : getRect().getHeight() - total_size; // now we distribute the pixels... - S32 cur_x = 0; - S32 cur_y = getRect().getHeight(); + F32 cur_x = 0.f; + F32 cur_y = (F32)getRect().getHeight(); for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it) { LLLayoutPanel* panelp = (*panel_it); - S32 cur_width = panelp->getRect().getWidth(); - S32 cur_height = panelp->getRect().getHeight(); - S32 new_width = cur_width; - S32 new_height = cur_height; - S32 relevant_min = panelp->getRelevantMinDim(); - - if (mOrientation == HORIZONTAL) - { - new_width = llmax(relevant_min, new_width); - } - else - { - new_height = llmax(relevant_min, new_height); - } - S32 delta_size = 0; + F32 min_size = panelp->getRelevantMinDim(); + F32 delta_size = 0.f; // if panel can automatically resize (not animating, and resize flag set)... - if (panelp->getCollapseFactor(mOrientation) == 1.f + if (panelp->getCollapseFactor() == 1.f && (force_resize || panelp->mAutoResize) && !panelp->mResizeBar->hasMouseCapture()) { - if (mOrientation == HORIZONTAL) + if (pixels_to_distribute < 0.f) { - // if we're shrinking - if (pixels_to_distribute < 0) - { - // shrink proportionally to amount over minimum - // so we can do this in one pass - delta_size = (shrink_headroom_available > 0) - ? llround((F32)pixels_to_distribute * ((F32)(cur_width - relevant_min) / (F32)shrink_headroom_available)) - : 0; - shrink_headroom_available -= (cur_width - relevant_min); - } - else - { - // grow all elements equally - delta_size = llround((F32)pixels_to_distribute / (F32)num_resizable_panels); - num_resizable_panels--; - } - pixels_to_distribute -= delta_size; - new_width = llmax(relevant_min, cur_width + delta_size); + // shrink proportionally to amount over minimum + // so we can do this in one pass + delta_size = (shrink_headroom_available > 0.f) + ? pixels_to_distribute * ((F32)(panelp->mFractionalSize - min_size) / shrink_headroom_available) + : 0.f; + shrink_headroom_available -= (panelp->mFractionalSize - min_size); } else { - new_width = getDefaultWidth(new_width); - } - - if (mOrientation == VERTICAL) - { - if (pixels_to_distribute < 0) - { - // shrink proportionally to amount over minimum - // so we can do this in one pass - delta_size = (shrink_headroom_available > 0) ? llround((F32)pixels_to_distribute * ((F32)(cur_height - relevant_min) / (F32)shrink_headroom_available)) : 0; - shrink_headroom_available -= (cur_height - relevant_min); - } - else - { - delta_size = llround((F32)pixels_to_distribute / (F32)num_resizable_panels); - num_resizable_panels--; - } - pixels_to_distribute -= delta_size; - new_height = llmax(relevant_min, cur_height + delta_size); - } - else - { - new_height = getDefaultHeight(new_height); - } - } - else - { - if (mOrientation == HORIZONTAL) - { - new_height = getDefaultHeight(new_height); - } - else // VERTICAL - { - new_width = getDefaultWidth(new_width); + // grow all elements equally + delta_size = pixels_to_distribute / (F32)num_resizable_panels; + num_resizable_panels--; } + + panelp->mFractionalSize = llmax(min_size, panelp->mFractionalSize + delta_size); + pixels_to_distribute -= delta_size; } // adjust running headroom count based on new sizes shrink_headroom_total += delta_size; LLRect panel_rect; - panel_rect.setLeftTopAndSize(cur_x, cur_y, new_width, new_height); + if (mOrientation == HORIZONTAL) + { + panel_rect.setLeftTopAndSize(llround(cur_x), + llround(cur_y), + llround(panelp->mFractionalSize), + getRect().getHeight()); + } + else + { + panel_rect.setLeftTopAndSize(llround(cur_x), + llround(cur_y), + getRect().getWidth(), + llround(panelp->mFractionalSize)); + } panelp->setShape(panel_rect); LLRect resize_bar_rect = panel_rect; @@ -561,13 +476,14 @@ void LLLayoutStack::updateLayout(BOOL force_resize) } (*panel_it)->mResizeBar->setRect(resize_bar_rect); + F32 size = ((*panel_it)->mFractionalSize * (*panel_it)->getCollapseFactor()) + (F32)mPanelSpacing; if (mOrientation == HORIZONTAL) { - cur_x += llround(new_width * (*panel_it)->getCollapseFactor(mOrientation)) + mPanelSpacing; + cur_x += size; } else //VERTICAL { - cur_y -= llround(new_height * (*panel_it)->getCollapseFactor(mOrientation)) + mPanelSpacing; + cur_y -= size; } } @@ -582,13 +498,13 @@ void LLLayoutStack::updateLayout(BOOL force_resize) { (*panel_it)->mResizeBar->setResizeLimits( relevant_min, - relevant_min + shrink_headroom_total); + relevant_min + llround(shrink_headroom_total)); } else //VERTICAL { (*panel_it)->mResizeBar->setResizeLimits( relevant_min, - relevant_min + shrink_headroom_total); + relevant_min + llround(shrink_headroom_total)); } // toggle resize bars based on panel visibility, resizability, etc diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h index 2ed32a2fa9..5d79505fc3 100644 --- a/indra/llui/lllayoutstack.h +++ b/indra/llui/lllayoutstack.h @@ -126,8 +126,6 @@ protected: private: void createResizeBars(); void calcMinExtents(); - S32 getDefaultHeight(S32 cur_height); - S32 getDefaultWidth(S32 cur_width); const ELayoutOrientation mOrientation; @@ -161,16 +159,14 @@ public: min_dim, max_dim; Optional<bool> user_resize, - auto_resize, - fit_content; + auto_resize; Params() : expanded_min_dim("expanded_min_dim", 0), min_dim("min_dim", 0), max_dim("max_dim", 0), user_resize("user_resize", true), - auto_resize("auto_resize", true), - fit_content("fit_content", false) + auto_resize("auto_resize", true) { addSynonym(min_dim, "min_width"); addSynonym(min_dim, "min_height"); @@ -183,6 +179,8 @@ public: void initFromParams(const Params& p); + void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + S32 getMinDim() const { return mMinDim; } void setMinDim(S32 value) { mMinDim = value; if (!mExpandedMinDimSpecified) mExpandedMinDim = value; } @@ -204,11 +202,12 @@ public: return min_dim; } + void setOrientation(LLLayoutStack::ELayoutOrientation orientation) { mOrientation = orientation; } + protected: LLLayoutPanel(const Params& p); - F32 getCollapseFactor(LLLayoutStack::ELayoutOrientation orientation); - void fitToContent(); + F32 getCollapseFactor(); bool mExpandedMinDimSpecified; S32 mExpandedMinDim; @@ -218,9 +217,10 @@ protected: bool mAutoResize; bool mUserResize; bool mCollapsed; - bool mFitContent; F32 mVisibleAmt; F32 mCollapseAmt; + F32 mFractionalSize; + LLLayoutStack::ELayoutOrientation mOrientation; class LLResizeBar* mResizeBar; }; diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h index 790025cb2d..ab1c87caff 100644 --- a/indra/llui/llpanel.h +++ b/indra/llui/llpanel.h @@ -96,9 +96,6 @@ public: Params(); }; - // valid children for LLPanel are stored in this registry - typedef LLDefaultChildRegistry child_registry_t; - protected: friend class LLUICtrlFactory; // RN: for some reason you can't just use LLUICtrlFactory::getDefaultParams as a default argument in VC8 diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 8249df3e9d..c5219b11e8 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -30,6 +30,7 @@ #include <boost/foreach.hpp> #include "lltoolbar.h" +#include "llcommandmanager.h" #include "llmenugl.h" #include "lltrans.h" @@ -125,14 +126,13 @@ void LLToolBar::createContextMenu() { // Setup bindings specific to this instance for the context menu options - LLUICtrl::CommitCallbackRegistry::Registrar& commit_reg = LLUICtrl::CommitCallbackRegistry::defaultRegistrar(); + LLUICtrl::CommitCallbackRegistry::ScopedRegistrar commit_reg; commit_reg.add("Toolbars.EnableSetting", boost::bind(&LLToolBar::onSettingEnable, this, _2)); - LLUICtrl::EnableCallbackRegistry::Registrar& enable_reg = LLUICtrl::EnableCallbackRegistry::defaultRegistrar(); + LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_reg; enable_reg.add("Toolbars.CheckSetting", boost::bind(&LLToolBar::isSettingChecked, this, _2)); // Create the context menu - LLContextMenu* menu = LLUICtrlFactory::instance().createFromFile<LLContextMenu>("menu_toolbars.xml", LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance()); if (menu) @@ -145,10 +145,6 @@ void LLToolBar::createContextMenu() { llwarns << "Unable to load toolbars context menu." << llendl; } - - // Remove this instance's bindings - commit_reg.remove("Toolbars.EnableSetting"); - enable_reg.remove("Toolbars.CheckSetting"); } } @@ -183,7 +179,6 @@ void LLToolBar::initFromParams(const LLToolBar::Params& p) center_panel_p.rect = getLocalRect(); center_panel_p.auto_resize = false; center_panel_p.user_resize = false; - center_panel_p.fit_content = true; LLLayoutPanel* center_panel = LLUICtrlFactory::create<LLLayoutPanel>(center_panel_p); mCenteringStack->addChild(center_panel); @@ -195,6 +190,11 @@ void LLToolBar::initFromParams(const LLToolBar::Params& p) mCenteringStack->addChild(LLUICtrlFactory::create<LLLayoutPanel>(border_panel_p)); + BOOST_FOREACH(LLCommandId::Params params, p.commands) + { + addCommand(params); + } + mNeedsLayout = true; } @@ -207,7 +207,7 @@ bool LLToolBar::addCommand(const LLCommandId& commandId) if (add_command) { mButtonCommands.push_back(commandId); - createButtons(); + createButton(commandId); } return add_command; @@ -219,9 +219,9 @@ bool LLToolBar::hasCommand(const LLCommandId& commandId) const if (commandId != LLCommandId::null) { - for (std::list<LLCommandId>::const_iterator cmd = mButtonCommands.begin(); cmd != mButtonCommands.end(); ++cmd) + BOOST_FOREACH(LLCommandId cmd, mButtonCommands) { - if ((*cmd) == commandId) + if (cmd == commandId) { has_command = true; break; @@ -251,7 +251,9 @@ bool LLToolBar::enableCommand(const LLCommandId& commandId, bool enabled) BOOL LLToolBar::handleRightMouseDown(S32 x, S32 y, MASK mask) { - BOOL handle_it_here = !mReadOnly; + LLRect button_panel_rect; + mButtonPanel->localRectToOtherView(mButtonPanel->getLocalRect(), &button_panel_rect, this); + BOOL handle_it_here = !mReadOnly && button_panel_rect.pointInRect(x, y); if (handle_it_here) { @@ -407,11 +409,11 @@ void LLToolBar::updateLayoutAsNeeded() cur_start = row_pad_start; cur_row += max_row_girth + mPadBetween; max_row_girth = 0; - } + } - LLRect button_rect; - if (orientation == LLLayoutStack::HORIZONTAL) - { + LLRect button_rect; + if (orientation == LLLayoutStack::HORIZONTAL) + { button_rect.setLeftTopAndSize(cur_start, panel_rect.mTop - cur_row, button_clamped_width, button->getRect().getHeight()); } else // VERTICAL @@ -457,6 +459,9 @@ void LLToolBar::updateLayoutAsNeeded() mButtonPanel->reshape(total_girth, max_row_length); } + // make parent fit button panel + mButtonPanel->getParent()->setShape(mButtonPanel->getLocalRect()); + // re-center toolbar buttons mCenteringStack->updateLayout(); @@ -467,7 +472,13 @@ void LLToolBar::updateLayoutAsNeeded() void LLToolBar::draw() { + if (mButtons.empty()) return; updateLayoutAsNeeded(); + // rect may have shifted during layout + LLUI::popMatrix(); + LLUI::pushMatrix(); + LLUI::translate((F32)getRect().mLeft, (F32)getRect().mBottom, 0.f); + LLUICtrl::draw(); } @@ -487,19 +498,25 @@ void LLToolBar::createButtons() BOOST_FOREACH(LLCommandId& command_id, mButtonCommands) { - LLCommand* commandp = LLCommandManager::instance().getCommand(command_id); - if (!commandp) continue; + createButton(command_id); + } + +} - LLToolBarButton::Params button_p; - button_p.label = LLTrans::getString(commandp->labelRef()); - button_p.image_overlay = LLUI::getUIImage(commandp->icon()); - button_p.overwriteFrom(mButtonParams[mButtonType]); - LLToolBarButton* button = LLUICtrlFactory::create<LLToolBarButton>(button_p); +void LLToolBar::createButton(const LLCommandId& id) +{ + LLCommand* commandp = LLCommandManager::instance().getCommand(id); + if (!commandp) return; - mButtons.push_back(button); - mButtonPanel->addChild(button); - } + LLToolBarButton::Params button_p; + button_p.label = LLTrans::getString(commandp->labelRef()); + button_p.tool_tip = button_p.label(); + button_p.image_overlay = LLUI::getUIImage(commandp->icon()); + button_p.overwriteFrom(mButtonParams[mButtonType]); + LLToolBarButton* button = LLUICtrlFactory::create<LLToolBarButton>(button_p); + + mButtons.push_back(button); + mButtonPanel->addChild(button); mNeedsLayout = true; } - diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index 75ae499a3d..8e484c7e13 100644 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -123,6 +123,7 @@ public: bool addCommand(const LLCommandId& commandId); bool hasCommand(const LLCommandId& commandId) const; bool enableCommand(const LLCommandId& commandId, bool enabled); + command_id_list_t& getCommandsList() { return mButtonCommands; } protected: friend class LLUICtrlFactory; @@ -135,6 +136,7 @@ private: void createContextMenu(); void updateLayoutAsNeeded(); void createButtons(); + void createButton(const LLCommandId& id); void resizeButtonsInRow(std::vector<LLToolBarButton*>& buttons_in_row, S32 max_row_girth); BOOL isSettingChecked(const LLSD& userdata); void onSettingEnable(const LLSD& userdata); @@ -142,7 +144,7 @@ private: const bool mReadOnly; std::list<LLToolBarButton*> mButtons; - std::list<LLCommandId> mButtonCommands; + command_id_list_t mButtonCommands; LLToolBarEnums::ButtonType mButtonType; LLLayoutStack* mCenteringStack; LLLayoutStack* mWrapStack; diff --git a/indra/llui/lltoolbarview.cpp b/indra/llui/lltoolbarview.cpp index 7047cca948..b374a0bfc4 100644 --- a/indra/llui/lltoolbarview.cpp +++ b/indra/llui/lltoolbarview.cpp @@ -50,14 +50,79 @@ LLToolBarView::ToolbarSet::ToolbarSet() bottom_toolbar("bottom_toolbar") {} -bool LLToolBarView::load() + +LLToolBarView::LLToolBarView(const LLToolBarView::Params& p) +: LLUICtrl(p), + mToolbarLeft(NULL), + mToolbarRight(NULL), + mToolbarBottom(NULL) +{ +} + +void LLToolBarView::initFromParams(const LLToolBarView::Params& p) +{ + // Initialize the base object + LLUICtrl::initFromParams(p); +} + +LLToolBarView::~LLToolBarView() +{ + saveToolbars(); +} + +BOOL LLToolBarView::postBuild() +{ + mToolbarLeft = getChild<LLToolBar>("toolbar_left"); + mToolbarRight = getChild<LLToolBar>("toolbar_right"); + mToolbarBottom = getChild<LLToolBar>("toolbar_bottom"); + + // Load the toolbars from the settings + loadToolbars(); + + return TRUE; +} + +bool LLToolBarView::hasCommand(const LLCommandId& commandId) const +{ + bool has_command = false; + if (mToolbarLeft && !has_command) + { + has_command = mToolbarLeft->hasCommand(commandId); + } + if (mToolbarRight && !has_command) + { + has_command = mToolbarRight->hasCommand(commandId); + } + if (mToolbarBottom && !has_command) + { + has_command = mToolbarBottom->hasCommand(commandId); + } + return has_command; +} + +bool LLToolBarView::addCommand(const LLCommandId& command, LLToolBar* toolbar) +{ + LLCommandManager& mgr = LLCommandManager::instance(); + if (mgr.getCommand(command)) + { + toolbar->addCommand(command); + } + else + { + llwarns << "Toolbars creation : the command " << command.name() << " cannot be found in the command manager" << llendl; + return false; + } + return true; +} + +bool LLToolBarView::loadToolbars() { LLToolBarView::ToolbarSet toolbar_set; - + // Load the default toolbars.xml file // *TODO : pick up the user's toolbar setting if existing std::string toolbar_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "toolbars.xml"); - + LLXMLNodePtr root; if(!LLXMLNode::parseFile(toolbar_file, root, NULL)) { @@ -69,7 +134,7 @@ bool LLToolBarView::load() llwarns << toolbar_file << " is not a valid toolbars definition file" << llendl; return false; } - + // Parse the toolbar settings LLXUIParser parser; parser.readXUI(root, toolbar_set, toolbar_file); @@ -80,103 +145,90 @@ bool LLToolBarView::load() } // Add commands to each toolbar - // *TODO: factorize that code : tricky with Blocks though, simple lexical approach fails - LLCommandManager& mgr = LLCommandManager::instance(); - if (toolbar_set.left_toolbar.isProvided() && mToolbarLeft) { BOOST_FOREACH(LLCommandId::Params& command, toolbar_set.left_toolbar.commands) { - LLCommandId* commandId = new LLCommandId(command); - if (mgr.getCommand(*commandId)) - { - mToolbarLeft->addCommand(*commandId); - } - else - { - llwarns << "Toolbars creation : the command " << commandId->name() << " cannot be found in the command manager" << llendl; - } + addCommand(LLCommandId(command),mToolbarLeft); } } if (toolbar_set.right_toolbar.isProvided() && mToolbarRight) { BOOST_FOREACH(LLCommandId::Params& command, toolbar_set.right_toolbar.commands) { - LLCommandId* commandId = new LLCommandId(command); - if (mgr.getCommand(*commandId)) - { - mToolbarRight->addCommand(*commandId); - } - else - { - llwarns << "Toolbars creation : the command " << commandId->name() << " cannot be found in the command manager" << llendl; - } + addCommand(LLCommandId(command),mToolbarRight); } } if (toolbar_set.bottom_toolbar.isProvided() && mToolbarBottom) { BOOST_FOREACH(LLCommandId::Params& command, toolbar_set.bottom_toolbar.commands) { - LLCommandId* commandId = new LLCommandId(command); - if (mgr.getCommand(*commandId)) - { - mToolbarBottom->addCommand(*commandId); - } - else - { - llwarns << "Toolbars creation : the command " << commandId->name() << " cannot be found in the command manager" << llendl; - } + addCommand(LLCommandId(command),mToolbarBottom); } } return true; } -LLToolBarView::LLToolBarView(const LLToolBarView::Params& p) -: LLUICtrl(p), - mToolbarLeft(NULL), - mToolbarRight(NULL), - mToolbarBottom(NULL) -{ -} - -void LLToolBarView::initFromParams(const LLToolBarView::Params& p) +void LLToolBarView::saveToolbars() const { - // Initialize the base object - LLUICtrl::initFromParams(p); -} - -LLToolBarView::~LLToolBarView() -{ -} - -BOOL LLToolBarView::postBuild() -{ - mToolbarLeft = getChild<LLToolBar>("toolbar_left"); - mToolbarRight = getChild<LLToolBar>("toolbar_right"); - mToolbarBottom = getChild<LLToolBar>("toolbar_bottom"); - - // Load the toolbars from the settings - load(); + // Build the parameter tree from the toolbar data + LLToolBarView::ToolbarSet toolbar_set; - return TRUE; -} - -bool LLToolBarView::hasCommand(const LLCommandId& commandId) const -{ - bool has_command = false; - if (mToolbarLeft && !has_command) + // *TODO : factorize that code a bit... + if (mToolbarLeft) { - has_command = mToolbarLeft->hasCommand(commandId); + command_id_list_t& command_list = mToolbarLeft->getCommandsList(); + for (command_id_list_t::const_iterator it = command_list.begin(); + it != command_list.end(); + ++it) + { + LLCommandId::Params command; + command.name = it->name(); + toolbar_set.left_toolbar.commands.add(command); + } } - if (mToolbarRight && !has_command) + if (mToolbarRight) { - has_command = mToolbarRight->hasCommand(commandId); + command_id_list_t& command_list = mToolbarRight->getCommandsList(); + for (command_id_list_t::const_iterator it = command_list.begin(); + it != command_list.end(); + ++it) + { + LLCommandId::Params command; + command.name = it->name(); + toolbar_set.right_toolbar.commands.add(command); + } } - if (mToolbarBottom && !has_command) + if (mToolbarBottom) { - has_command = mToolbarBottom->hasCommand(commandId); + command_id_list_t& command_list = mToolbarBottom->getCommandsList(); + for (command_id_list_t::const_iterator it = command_list.begin(); + it != command_list.end(); + ++it) + { + LLCommandId::Params command; + command.name = it->name(); + toolbar_set.bottom_toolbar.commands.add(command); + } + } + + // Serialize the parameter tree + LLXMLNodePtr output_node = new LLXMLNode("toolbars", false); + LLXUIParser parser; + parser.writeXUI(output_node, toolbar_set); + + // Write the resulting XML to file + if(!output_node->isNull()) + { + const std::string& filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "toolbars.xml"); + LLFILE *fp = LLFile::fopen(filename, "w"); + if (fp != NULL) + { + LLXMLNode::writeHeaderToFile(fp); + output_node->writeToFile(fp); + fclose(fp); + } } - return has_command; } void LLToolBarView::draw() @@ -189,10 +241,21 @@ void LLToolBarView::draw() LLRect bottom_rect, left_rect, right_rect; - if (mToolbarBottom) mToolbarBottom->localRectToOtherView(mToolbarBottom->getLocalRect(), &bottom_rect, this); - if (mToolbarLeft) mToolbarLeft->localRectToOtherView(mToolbarLeft->getLocalRect(), &left_rect, this); - if (mToolbarRight) mToolbarRight->localRectToOtherView(mToolbarRight->getLocalRect(), &right_rect, this); - + if (mToolbarBottom) + { + mToolbarBottom->getParent()->reshape(mToolbarBottom->getParent()->getRect().getWidth(), mToolbarBottom->getRect().getHeight()); + mToolbarBottom->localRectToOtherView(mToolbarBottom->getLocalRect(), &bottom_rect, this); + } + if (mToolbarLeft) + { + mToolbarLeft->getParent()->reshape(mToolbarLeft->getRect().getWidth(), mToolbarLeft->getParent()->getRect().getHeight()); + mToolbarLeft->localRectToOtherView(mToolbarLeft->getLocalRect(), &left_rect, this); + } + if (mToolbarRight) + { + mToolbarRight->getParent()->reshape(mToolbarRight->getRect().getWidth(), mToolbarRight->getParent()->getRect().getHeight()); + mToolbarRight->localRectToOtherView(mToolbarRight->getLocalRect(), &right_rect, this); + } if ((old_width != getRect().getWidth()) || (old_height != getRect().getHeight())) debug_print = true; @@ -215,9 +278,9 @@ void LLToolBarView::draw() back_color_hori[VALPHA] = 0.5f; back_color_vert[VALPHA] = 0.5f; //gl_rect_2d(getLocalRect(), back_color, TRUE); - gl_rect_2d(bottom_rect, back_color_hori, TRUE); - gl_rect_2d(left_rect, back_color_vert, TRUE); - gl_rect_2d(right_rect, back_color_vert, TRUE); + //gl_rect_2d(bottom_rect, back_color_hori, TRUE); + //gl_rect_2d(left_rect, back_color_vert, TRUE); + //gl_rect_2d(right_rect, back_color_vert, TRUE); LLUICtrl::draw(); } diff --git a/indra/llui/lltoolbarview.h b/indra/llui/lltoolbarview.h index 0f16b89ecc..646a1fd636 100644 --- a/indra/llui/lltoolbarview.h +++ b/indra/llui/lltoolbarview.h @@ -77,7 +77,9 @@ protected: private: // Loads the toolbars from the existing user or default settings - bool load(); // return false if load fails + bool loadToolbars(); // return false if load fails + void saveToolbars() const; + bool addCommand(const LLCommandId& commandId, LLToolBar* toolbar); // Pointers to the toolbars handled by the toolbar view LLToolBar* mToolbarLeft; diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 7a1b2e4ba0..9039366e7e 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -95,9 +95,6 @@ private: static std::vector<LLViewDrawContext*> sDrawContextStack; }; -class LLViewWidgetRegistry : public LLChildRegistry<LLViewWidgetRegistry> -{}; - class LLView : public LLMouseHandler, public LLMortician, public LLFocusableElement { public: @@ -150,7 +147,8 @@ public: Params(); }; - typedef LLViewWidgetRegistry child_registry_t; + // most widgets are valid children of LLView + typedef LLDefaultChildRegistry child_registry_t; void initFromParams(const LLView::Params&); diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 38d6ff0f58..59e1ca10e6 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -228,6 +228,7 @@ set(viewer_SOURCE_FILES llfloatersearch.cpp llfloatersellland.cpp llfloatersettingsdebug.cpp + llfloatersidepanelcontainer.cpp llfloatersidetraytab.cpp llfloatersnapshot.cpp llfloatersounddevices.cpp @@ -792,6 +793,7 @@ set(viewer_HEADER_FILES llfloatersearch.h llfloatersellland.h llfloatersettingsdebug.h + llfloatersidepanelcontainer.h llfloatersidetraytab.h llfloatersnapshot.h llfloatersounddevices.h diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 642a1907f0..1587ed2dd7 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -1797,7 +1797,7 @@ void LLAgent::endAnimationUpdateUI() gViewerWindow->showCursor(); // show menus gMenuBarView->setVisible(TRUE); - LLNavigationBar::getInstance()->setVisible(TRUE); + LLNavigationBar::getInstance()->setVisible(TRUE && gSavedSettings.getBOOL("ShowNavbarNavigationPanel")); gStatusBar->setVisibleForMouselook(true); if (gSavedSettings.getBOOL("ShowMiniLocationPanel")) diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index b9125ec8d3..404cd8e5b6 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -33,6 +33,7 @@ #include "llagentwearablesfetch.h" #include "llappearancemgr.h" #include "llcallbacklist.h" +#include "llfloatersidepanelcontainer.h" #include "llgesturemgr.h" #include "llinventorybridge.h" #include "llinventoryfunctions.h" @@ -2015,7 +2016,7 @@ void LLAgentWearables::editWearable(const LLUUID& item_id) } const BOOL disable_camera_switch = LLWearableType::getDisableCameraSwitch(wearable->getType()); - LLPanel* panel = LLSideTray::getInstance()->getPanel("sidepanel_appearance"); + LLPanel* panel = LLFloaterSidePanelContainer::getPanel("appearance"); LLSidepanelAppearance::editWearable(wearable, panel, disable_camera_switch); } diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 3cb9b77010..c638f881a5 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -34,6 +34,7 @@ #include "llattachmentsmgr.h" #include "llcommandhandler.h" #include "lleventtimer.h" +#include "llfloatersidepanelcontainer.h" #include "llgesturemgr.h" #include "llinventorybridge.h" #include "llinventoryfunctions.h" @@ -116,7 +117,7 @@ public: return true; } - LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD()); + LLFloaterSidePanelContainer::showPanel("appearance", LLSD()); return true; } }; @@ -1505,7 +1506,7 @@ void LLAppearanceMgr::updateCOF(const LLUUID& category, bool append) void LLAppearanceMgr::updatePanelOutfitName(const std::string& name) { LLSidepanelAppearance* panel_appearance = - dynamic_cast<LLSidepanelAppearance *>(LLSideTray::getInstance()->getPanel("sidepanel_appearance")); + dynamic_cast<LLSidepanelAppearance *>(LLFloaterSidePanelContainer::getPanel("appearance")); if (panel_appearance) { panel_appearance->refreshCurrentOutfitName(name); @@ -1943,7 +1944,7 @@ void LLAppearanceMgr::wearInventoryCategoryOnAvatar( LLInventoryCategory* catego if (gAgentCamera.cameraCustomizeAvatar()) { // switching to outfit editor should automagically save any currently edited wearable - LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "edit_outfit")); + LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "edit_outfit")); } LLAppearanceMgr::changeOutfit(TRUE, category->getUUID(), append); @@ -2468,7 +2469,7 @@ public: LLSideTray::getInstance()->showPanel("panel_outfits_inventory", key); } LLOutfitsList *outfits_list = - dynamic_cast<LLOutfitsList*>(LLSideTray::getInstance()->getPanel("outfitslist_tab")); + dynamic_cast<LLOutfitsList*>(LLFloaterSidePanelContainer::getPanel("appearance", "outfitslist_tab")); if (outfits_list) { outfits_list->setSelectedOutfitByUUID(mFolderID); diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index 4cdfcea64e..fb7517a98b 100755 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -47,6 +47,7 @@ #include "llfloatergroups.h" #include "llfloaterreg.h" #include "llfloaterpay.h" +#include "llfloatersidepanelcontainer.h" #include "llfloaterwebcontent.h" #include "llfloaterworldmap.h" #include "llfolderview.h" @@ -438,8 +439,7 @@ void LLAvatarActions::csr(const LLUUID& id, std::string name) void LLAvatarActions::share(const LLUUID& id) { LLSD key; - LLSideTray::getInstance()->showPanel("sidepanel_inventory", key); - + LLFloaterSidePanelContainer::showPanel("my_inventory", key); LLUUID session_id = gIMMgr->computeSessionID(IM_NOTHING_SPECIAL,id); @@ -462,7 +462,7 @@ namespace action_give_inventory */ static LLInventoryPanel* get_outfit_editor_inventory_panel() { - LLPanelOutfitEdit* panel_outfit_edit = dynamic_cast<LLPanelOutfitEdit*>(LLSideTray::getInstance()->getPanel("panel_outfit_edit")); + LLPanelOutfitEdit* panel_outfit_edit = dynamic_cast<LLPanelOutfitEdit*>(LLFloaterSidePanelContainer::getPanel("appearance", "panel_outfit_edit")); if (NULL == panel_outfit_edit) return NULL; LLInventoryPanel* inventory_panel = panel_outfit_edit->findChild<LLInventoryPanel>("folder_view"); @@ -696,9 +696,11 @@ std::set<LLUUID> LLAvatarActions::getInventorySelectedUUIDs() if (inventory_selected_uuids.empty()) { - LLSidepanelInventory * sidepanel_inventory = LLSideTray::getInstance()->getPanel<LLSidepanelInventory>("sidepanel_inventory"); - - inventory_selected_uuids = sidepanel_inventory->getInboxOrOutboxSelectionList(); + LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("my_inventory"); + if (sidepanel_inventory) + { + inventory_selected_uuids = sidepanel_inventory->getInboxOrOutboxSelectionList(); + } } return inventory_selected_uuids; diff --git a/indra/newview/llcofwearables.cpp b/indra/newview/llcofwearables.cpp index 254c0adef1..80e0cca780 100644 --- a/indra/newview/llcofwearables.cpp +++ b/indra/newview/llcofwearables.cpp @@ -33,6 +33,7 @@ #include "llagentdata.h" #include "llagentwearables.h" #include "llappearancemgr.h" +#include "llfloatersidepanelcontainer.h" #include "llinventory.h" #include "llinventoryfunctions.h" #include "lllistcontextmenu.h" @@ -165,7 +166,7 @@ protected: // absent instance. Explicit relations between components avoids situations // when we tries to construct instance with unsatisfied implicit input conditions. LLPanelOutfitEdit * panel_outfit_edit = - dynamic_cast<LLPanelOutfitEdit*> (LLSideTray::getInstance()->getPanel( + dynamic_cast<LLPanelOutfitEdit*> (LLFloaterSidePanelContainer::getPanel("appearance", "panel_outfit_edit")); if (panel_outfit_edit != NULL) { @@ -237,7 +238,7 @@ protected: // *HACK* need to pass pointer to LLPanelOutfitEdit instead of LLSideTray::getInstance()->getPanel(). // LLSideTray::getInstance()->getPanel() is rather slow variant - LLPanelOutfitEdit* panel_oe = dynamic_cast<LLPanelOutfitEdit*>(LLSideTray::getInstance()->getPanel("panel_outfit_edit")); + LLPanelOutfitEdit* panel_oe = dynamic_cast<LLPanelOutfitEdit*>(LLFloaterSidePanelContainer::getPanel("appearance", "panel_outfit_edit")); registrar.add("BodyPart.Replace", boost::bind(&LLPanelOutfitEdit::onReplaceMenuItemClicked, panel_oe, selected_id)); registrar.add("BodyPart.Edit", boost::bind(LLAgentWearables::editWearable, selected_id)); registrar.add("BodyPart.Create", boost::bind(&CofBodyPartContextMenu::createNew, this, selected_id)); diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp index 836c580ea8..1eabf32b9f 100644 --- a/indra/newview/llfavoritesbar.cpp +++ b/indra/newview/llfavoritesbar.cpp @@ -41,6 +41,7 @@ #include "llinventoryclipboard.h" #include "llinventorybridge.h" #include "llinventoryfunctions.h" +#include "llfloatersidepanelcontainer.h" #include "llfloaterworldmap.h" #include "lllandmarkactions.h" #include "llnotificationsutil.h" @@ -360,7 +361,7 @@ struct LLFavoritesSort LLFavoritesBarCtrl::Params::Params() : image_drag_indication("image_drag_indication"), - chevron_button("chevron_button"), + more_button("more_button"), label("label") { } @@ -389,10 +390,10 @@ LLFavoritesBarCtrl::LLFavoritesBarCtrl(const LLFavoritesBarCtrl::Params& p) gInventory.addObserver(this); //make chevron button - LLButton::Params chevron_button_params(p.chevron_button); - chevron_button_params.click_callback.function(boost::bind(&LLFavoritesBarCtrl::showDropDownMenu, this)); - mChevronButton = LLUICtrlFactory::create<LLButton> (chevron_button_params); - addChild(mChevronButton); + LLTextBox::Params more_button_params(p.more_button); + mMoreTextBox = LLUICtrlFactory::create<LLTextBox> (more_button_params); + mMoreTextBox->setClickedCallback(boost::bind(&LLFavoritesBarCtrl::showDropDownMenu, this)); + addChild(mMoreTextBox); LLTextBox::Params label_param(p.label); mBarLabel = LLUICtrlFactory::create<LLTextBox> (label_param); @@ -692,7 +693,7 @@ void LLFavoritesBarCtrl::updateButtons() const child_list_t* childs = getChildList(); child_list_const_iter_t child_it = childs->begin(); int first_changed_item_index = 0; - int rightest_point = getRect().mRight - mChevronButton->getRect().getWidth(); + int rightest_point = getRect().mRight - mMoreTextBox->getRect().getWidth(); //lets find first changed button while (child_it != childs->end() && first_changed_item_index < mItems.count()) { @@ -735,9 +736,9 @@ void LLFavoritesBarCtrl::updateButtons() } // we have to remove ChevronButton to make sure that the last item will be LandmarkButton to get the right aligning // keep in mind that we are cutting all buttons in space between the last visible child of favbar and ChevronButton - if (mChevronButton->getParent() == this) + if (mMoreTextBox->getParent() == this) { - removeChild(mChevronButton); + removeChild(mMoreTextBox); } int last_right_edge = 0; //calculate new buttons offset @@ -777,13 +778,13 @@ void LLFavoritesBarCtrl::updateButtons() S32 buttonHGap = button_params.rect.left; // default value LLRect rect; // Chevron button should stay right aligned - rect.setOriginAndSize(getRect().mRight - mChevronButton->getRect().getWidth() - buttonHGap, 0, - mChevronButton->getRect().getWidth(), - mChevronButton->getRect().getHeight()); + rect.setOriginAndSize(getRect().mRight - mMoreTextBox->getRect().getWidth() - buttonHGap, 0, + mMoreTextBox->getRect().getWidth(), + mMoreTextBox->getRect().getHeight()); - addChild(mChevronButton); - mChevronButton->setRect(rect); - mChevronButton->setVisible(TRUE); + addChild(mMoreTextBox); + mMoreTextBox->setRect(rect); + mMoreTextBox->setVisible(TRUE); } // Update overflow menu LLToggleableMenu* overflow_menu = static_cast <LLToggleableMenu*> (mOverflowMenuHandle.get()); @@ -816,8 +817,8 @@ LLButton* LLFavoritesBarCtrl::createButton(const LLPointer<LLViewerInventoryItem int width = required_width > def_button_width? def_button_width : required_width; LLFavoriteLandmarkButton* fav_btn = NULL; - // do we have a place for next button + double buttonHGap + mChevronButton ? - if(curr_x + width + 2*button_x_delta + mChevronButton->getRect().getWidth() > getRect().mRight ) + // do we have a place for next button + double buttonHGap + mMoreTextBox ? + if(curr_x + width + 2*button_x_delta + mMoreTextBox->getRect().getWidth() > getRect().mRight ) { return NULL; } @@ -967,7 +968,7 @@ void LLFavoritesBarCtrl::showDropDownMenu() menu->buildDrawLabels(); menu->updateParent(LLMenuGL::sMenuContainer); - menu->setButtonRect(mChevronButton->getRect(), this); + menu->setButtonRect(mMoreTextBox->getRect(), this); LLMenuGL::showPopup(this, menu, getRect().getWidth() - max_width, 0); } @@ -1057,7 +1058,7 @@ void LLFavoritesBarCtrl::doToSelected(const LLSD& userdata) key["type"] = "landmark"; key["id"] = mSelectedItemID; - LLSideTray::getInstance()->showPanel("panel_places", key); + LLFloaterSidePanelContainer::showPanel("places", key); } else if (action == "copy_slurl") { diff --git a/indra/newview/llfavoritesbar.h b/indra/newview/llfavoritesbar.h index 1a28731c4f..a41795a080 100644 --- a/indra/newview/llfavoritesbar.h +++ b/indra/newview/llfavoritesbar.h @@ -40,7 +40,7 @@ public: struct Params : public LLInitParam::Block<Params, LLUICtrl::Params> { Optional<LLUIImage*> image_drag_indication; - Optional<LLButton::Params> chevron_button; + Optional<LLTextBox::Params> more_button; Optional<LLTextBox::Params> label; Params(); }; @@ -135,7 +135,7 @@ private: BOOL mShowDragMarker; LLUICtrl* mLandingTab; LLUICtrl* mLastTab; - LLButton* mChevronButton; + LLTextBox* mMoreTextBox; LLTextBox* mBarLabel; LLUUID mDragItemId; diff --git a/indra/newview/llfloatersidepanelcontainer.cpp b/indra/newview/llfloatersidepanelcontainer.cpp new file mode 100644 index 0000000000..c73ec90a12 --- /dev/null +++ b/indra/newview/llfloatersidepanelcontainer.cpp @@ -0,0 +1,101 @@ +/** + * @file llfloatersidepanelcontainer.cpp + * @brief LLFloaterSidePanelContainer class definition + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llfloaterreg.h" +#include "llfloatersidepanelcontainer.h" + +// newview includes +#include "llsidetraypanelcontainer.h" +#include "lltransientfloatermgr.h" + +//static +const std::string LLFloaterSidePanelContainer::sMainPanelName("main_panel"); + +LLFloaterSidePanelContainer::LLFloaterSidePanelContainer(const LLSD& key, const Params& params) +: LLFloater(key, params) +{ + // Prevent transient floaters (e.g. IM windows) from hiding + // when this floater is clicked. + LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::GLOBAL, this); +} + +LLFloaterSidePanelContainer::~LLFloaterSidePanelContainer() +{ + LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::GLOBAL, this); +} + +void LLFloaterSidePanelContainer::onOpen(const LLSD& key) +{ + getChild<LLPanel>(sMainPanelName)->onOpen(key); +} + +LLPanel* LLFloaterSidePanelContainer::openChildPanel(const std::string& panel_name, const LLSD& params) +{ + LLView* view = findChildView(panel_name, true); + if (!view) return NULL; + + openFloater(); + + LLPanel* panel = NULL; + + LLSideTrayPanelContainer* container = dynamic_cast<LLSideTrayPanelContainer*>(view->getParent()); + if (container) + { + LLSD new_params = params; + new_params[LLSideTrayPanelContainer::PARAM_SUB_PANEL_NAME] = panel_name; + container->onOpen(new_params); + + panel = container->getCurrentPanel(); + } + else if ((panel = dynamic_cast<LLPanel*>(view)) != NULL) + { + panel->onOpen(params); + } + + return panel; +} + +void LLFloaterSidePanelContainer::showPanel(const std::string& floater_name, const LLSD& panel_name) +{ + LLFloaterSidePanelContainer* floaterp = LLFloaterReg::getTypedInstance<LLFloaterSidePanelContainer>(floater_name); + if (floaterp) + { + floaterp->openChildPanel(sMainPanelName, panel_name); + } +} + +LLPanel* LLFloaterSidePanelContainer::getPanel(const std::string& floater_name, const std::string& panel_name) +{ + LLFloaterSidePanelContainer* floaterp = LLFloaterReg::getTypedInstance<LLFloaterSidePanelContainer>(floater_name); + if (floaterp) + { + return floaterp->findChild<LLPanel>(panel_name, true); + } + + return NULL; +} diff --git a/indra/newview/llfloatersidepanelcontainer.h b/indra/newview/llfloatersidepanelcontainer.h new file mode 100644 index 0000000000..b230500f56 --- /dev/null +++ b/indra/newview/llfloatersidepanelcontainer.h @@ -0,0 +1,79 @@ +/** + * @file llfloatersidepanelcontainer.h + * @brief LLFloaterSidePanelContainer class + * + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLFLOATERSIDEPANELCONTAINER_H +#define LL_LLFLOATERSIDEPANELCONTAINER_H + +#include "llfloater.h" + +/** + * Class LLFloaterSidePanelContainer + * + * Provides an interface for all former Side Tray panels. + * + * This class helps to make sure that clicking a floater containing the side panel + * doesn't make transient floaters (e.g. IM windows) hide, so that it's possible to + * drag an inventory item from My Inventory window to a docked IM window, + * i.e. share the item (see VWR-22891). + */ +class LLFloaterSidePanelContainer : public LLFloater +{ +private: + static const std::string sMainPanelName; + +public: + LLFloaterSidePanelContainer(const LLSD& key, const Params& params = getDefaultParams()); + ~LLFloaterSidePanelContainer(); + + /*virtual*/ void onOpen(const LLSD& key); + + LLPanel* openChildPanel(const std::string& panel_name, const LLSD& params); + + static void showPanel(const std::string& floater_name, const LLSD& panel_name); + + static LLPanel* getPanel(const std::string& floater_name, const std::string& panel_name = sMainPanelName); + + /** + * Gets the panel of given type T (doesn't show it or do anything else with it). + * + * @param floater_name a string specifying the floater to be searched for a child panel. + * @param panel_name a string specifying the child panel to get. + * @returns a pointer to the panel of given type T. + */ + template <typename T> + static T* getPanel(const std::string& floater_name, const std::string& panel_name = sMainPanelName) + { + T* panel = dynamic_cast<T*>(getPanel(floater_name, panel_name)); + if (!panel) + { + llwarns << "Child named \"" << panel_name << "\" of type " << typeid(T*).name() << " not found" << llendl; + } + return panel; + } +}; + +#endif // LL_LLFLOATERSIDEPANELCONTAINER_H diff --git a/indra/newview/llinspectobject.cpp b/indra/newview/llinspectobject.cpp index ee076f68ea..29d7a4a6b0 100644 --- a/indra/newview/llinspectobject.cpp +++ b/indra/newview/llinspectobject.cpp @@ -28,6 +28,7 @@ #include "llinspectobject.h" // Viewer +#include "llfloatersidepanelcontainer.h" #include "llinspect.h" #include "llmediaentry.h" #include "llnotificationsutil.h" // *TODO: Eliminate, add LLNotificationsUtil wrapper @@ -640,7 +641,7 @@ void LLInspectObject::onClickMoreInfo() { LLSD key; key["task"] = "task"; - LLSideTray::getInstance()->showPanel("sidepanel_inventory", key); + LLFloaterSidePanelContainer::showPanel("my_inventory", key); closeFloater(); } diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index a36aa3dedf..b6041c7f31 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -39,6 +39,7 @@ #include "llavataractions.h" #include "llfloateropenobject.h" #include "llfloaterreg.h" +#include "llfloatersidepanelcontainer.h" #include "llfloaterworldmap.h" #include "llfolderview.h" #include "llfriendcard.h" @@ -3851,7 +3852,7 @@ void LLLandmarkBridge::performAction(LLInventoryModel* model, std::string action key["type"] = "landmark"; key["id"] = item->getUUID(); - LLSideTray::getInstance()->showPanel("panel_places", key); + LLFloaterSidePanelContainer::showPanel("places", key); } } else @@ -4780,7 +4781,7 @@ void remove_inventory_category_from_avatar( LLInventoryCategory* category ) if (gAgentCamera.cameraCustomizeAvatar()) { // switching to outfit editor should automagically save any currently edited wearable - LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "edit_outfit")); + LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "edit_outfit")); } remove_inventory_category_from_avatar_step2(TRUE, category->getUUID() ); diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 0af013fde5..acec02b507 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -47,6 +47,7 @@ #include "llappviewer.h" //#include "llfirstuse.h" #include "llfloaterinventory.h" +#include "llfloatersidepanelcontainer.h" #include "llfocusmgr.h" #include "llfolderview.h" #include "llgesturemgr.h" @@ -459,22 +460,28 @@ BOOL get_is_category_renameable(const LLInventoryModel* model, const LLUUID& id) void show_task_item_profile(const LLUUID& item_uuid, const LLUUID& object_id) { - LLSideTray::getInstance()->showPanel("sidepanel_inventory", LLSD().with("id", item_uuid).with("object", object_id)); + LLFloaterSidePanelContainer::showPanel("my_inventory", LLSD().with("id", item_uuid).with("object", object_id)); } void show_item_profile(const LLUUID& item_uuid) { LLUUID linked_uuid = gInventory.getLinkedItemID(item_uuid); - LLSideTray::getInstance()->showPanel("sidepanel_inventory", LLSD().with("id", linked_uuid)); + LLFloaterSidePanelContainer::showPanel("my_inventory", LLSD().with("id", linked_uuid)); } void show_item_original(const LLUUID& item_uuid) { + LLFloater* floater_my_inventory = LLFloaterReg::getInstance("my_inventory"); + if (!floater_my_inventory) + { + llwarns << "Could not find My Inventory floater" << llendl; + return; + } + //sidetray inventory panel - LLSidepanelInventory *sidepanel_inventory = - dynamic_cast<LLSidepanelInventory *>(LLSideTray::getInstance()->getPanel("sidepanel_inventory")); + LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("my_inventory"); - bool reset_inventory_filter = !LLSideTray::getInstance()->isPanelActive("sidepanel_inventory"); + bool reset_inventory_filter = !floater_my_inventory->isInVisibleChain(); LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(); if (!active_panel) diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 615d3aefde..27db28367c 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -35,6 +35,7 @@ #include "llavataractions.h" #include "llfloaterinventory.h" #include "llfloaterreg.h" +#include "llfloatersidepanelcontainer.h" #include "llfolderview.h" #include "llimfloater.h" #include "llimview.h" @@ -1077,10 +1078,9 @@ void LLInventoryPanel::dumpSelectionInformation(void* user_data) BOOL is_inventorysp_active() { - if (!LLSideTray::getInstance()->isPanelActive("sidepanel_inventory")) return FALSE; - LLSidepanelInventory *inventorySP = dynamic_cast<LLSidepanelInventory *>(LLSideTray::getInstance()->getPanel("sidepanel_inventory")); - if (!inventorySP) return FALSE; - return inventorySP->isMainInventoryPanelActive(); + LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("my_inventory"); + if (!sidepanel_inventory || !sidepanel_inventory->isInVisibleChain()) return FALSE; + return sidepanel_inventory->isMainInventoryPanelActive(); } // static @@ -1090,34 +1090,24 @@ LLInventoryPanel* LLInventoryPanel::getActiveInventoryPanel(BOOL auto_open) LLInventoryPanel* res = NULL; LLFloater* active_inv_floaterp = NULL; - // A. If the inventory side panel is open, use that preferably. - if (is_inventorysp_active()) + LLFloater* floater_my_inventory = LLFloaterReg::getInstance("my_inventory"); + if (!floater_my_inventory) { - LLSidepanelInventory *inventorySP = dynamic_cast<LLSidepanelInventory *>(LLSideTray::getInstance()->getPanel("sidepanel_inventory")); - if (inventorySP) - { - return inventorySP->getActivePanel(); - } + llwarns << "Could not find My Inventory floater" << llendl; + return FALSE; } - // or if it is in floater undocked from sidetray get it and remember z order of floater to later compare it - // with other inventory floaters order. - else if (!LLSideTray::getInstance()->isTabAttached("sidebar_inventory")) + + LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("my_inventory"); + + // A. If the inventory side panel floater is open, use that preferably. + if (is_inventorysp_active()) { - LLSidepanelInventory *inventorySP = - dynamic_cast<LLSidepanelInventory *>(LLSideTray::getInstance()->getPanel("sidepanel_inventory")); - LLFloater* inv_floater = LLFloaterReg::findInstance("side_bar_tab", LLSD("sidebar_inventory")); - if (inventorySP && inv_floater) - { - res = inventorySP->getActivePanel(); - z_min = gFloaterView->getZOrder(inv_floater); - active_inv_floaterp = inv_floater; - } - else - { - llwarns << "Inventory tab is detached from sidetray, but either panel or floater were not found!" << llendl; - } + // Get the floater's z order to compare it to other inventory floaters' order later. + res = sidepanel_inventory->getActivePanel(); + z_min = gFloaterView->getZOrder(floater_my_inventory); + active_inv_floaterp = floater_my_inventory; } - + // B. Iterate through the inventory floaters and return whichever is on top. LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("inventory"); for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); iter != inst_list.end(); ++iter) @@ -1147,14 +1137,9 @@ LLInventoryPanel* LLInventoryPanel::getActiveInventoryPanel(BOOL auto_open) // C. If no panels are open and we don't want to force open a panel, then just abort out. if (!auto_open) return NULL; - // D. Open the inventory side panel and use that. - LLSD key; - LLSidepanelInventory *sidepanel_inventory = - dynamic_cast<LLSidepanelInventory *>(LLSideTray::getInstance()->showPanel("sidepanel_inventory", key)); - if (sidepanel_inventory) - { - return sidepanel_inventory->getActivePanel(); - } + // D. Open the inventory side panel floater and use that. + floater_my_inventory->openFloater(); + return sidepanel_inventory->getActivePanel(); return NULL; } diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp index 1c8f6b6c98..f519ad759e 100644 --- a/indra/newview/lllocationinputctrl.cpp +++ b/indra/newview/lllocationinputctrl.cpp @@ -44,6 +44,7 @@ // newview includes #include "llagent.h" +#include "llfloatersidepanelcontainer.h" #include "llinventoryobserver.h" #include "lllandmarkactions.h" #include "lllandmarklist.h" @@ -600,7 +601,7 @@ void LLLocationInputCtrl::reshape(S32 width, S32 height, BOOL called_from_parent void LLLocationInputCtrl::onInfoButtonClicked() { - LLSideTray::getInstance()->showPanel("panel_places", LLSD().with("type", "agent")); + LLFloaterSidePanelContainer::showPanel("places", LLSD().with("type", "agent")); } void LLLocationInputCtrl::onForSaleButtonClicked() @@ -618,11 +619,11 @@ void LLLocationInputCtrl::onAddLandmarkButtonClicked() key["type"] = "landmark"; key["id"] = landmark->getUUID(); - LLSideTray::getInstance()->showPanel("panel_places", key); + LLFloaterSidePanelContainer::showPanel("places", key); } else { - LLSideTray::getInstance()->showPanel("panel_places", LLSD().with("type", "create_landmark")); + LLFloaterSidePanelContainer::showPanel("places", LLSD().with("type", "create_landmark")); } } @@ -1087,12 +1088,12 @@ void LLLocationInputCtrl::onLocationContextMenuItemClicked(const LLSD& userdata) if(!landmark) { - LLSideTray::getInstance()->showPanel("panel_places", LLSD().with("type", "create_landmark")); + LLFloaterSidePanelContainer::showPanel("places", LLSD().with("type", "create_landmark")); } else { - LLSideTray::getInstance()->showPanel("panel_places", - LLSD().with("type", "landmark").with("id",landmark->getUUID())); + LLFloaterSidePanelContainer::showPanel("places", LLSD().with("type", "landmark").with("id",landmark->getUUID())); + } } else if (item == "cut") diff --git a/indra/newview/llnavigationbar.cpp b/indra/newview/llnavigationbar.cpp index 9d54ad7463..4c0823874c 100644 --- a/indra/newview/llnavigationbar.cpp +++ b/indra/newview/llnavigationbar.cpp @@ -269,7 +269,6 @@ LLNavigationBar::LLNavigationBar() mBtnForward(NULL), mBtnHome(NULL), mCmbLocation(NULL), - mSearchComboBox(NULL), mPurgeTPHistoryItems(false), mSaveToLocationHistory(false) { @@ -291,10 +290,7 @@ BOOL LLNavigationBar::postBuild() mBtnForward = getChild<LLPullButton>("forward_btn"); mBtnHome = getChild<LLButton>("home_btn"); - mCmbLocation= getChild<LLLocationInputCtrl>("location_combo"); - mSearchComboBox = getChild<LLSearchComboBox>("search_combo_box"); - - fillSearchComboBox(); + mCmbLocation= getChild<LLLocationInputCtrl>("location_combo"); mBtnBack->setEnabled(FALSE); mBtnBack->setClickedCallback(boost::bind(&LLNavigationBar::onBackButtonClicked, this)); @@ -309,8 +305,6 @@ BOOL LLNavigationBar::postBuild() mBtnHome->setClickedCallback(boost::bind(&LLNavigationBar::onHomeButtonClicked, this)); mCmbLocation->setCommitCallback(boost::bind(&LLNavigationBar::onLocationSelection, this)); - - mSearchComboBox->setCommitCallback(boost::bind(&LLNavigationBar::onSearchCommit, this)); mTeleportFinishConnection = LLViewerParcelMgr::getInstance()-> setTeleportFinishedCallback(boost::bind(&LLNavigationBar::onTeleportFinished, this, _1)); @@ -344,26 +338,6 @@ void LLNavigationBar::setVisible(BOOL visible) } } - -void LLNavigationBar::fillSearchComboBox() -{ - if(!mSearchComboBox) - { - return; - } - - LLSearchHistory::getInstance()->load(); - - LLSearchHistory::search_history_list_t search_list = - LLSearchHistory::getInstance()->getSearchHistoryList(); - LLSearchHistory::search_history_list_t::const_iterator it = search_list.begin(); - for( ; search_list.end() != it; ++it) - { - LLSearchHistory::LLSearchHistoryItem item = *it; - mSearchComboBox->add(item.search_query); - } -} - void LLNavigationBar::draw() { if(mPurgeTPHistoryItems) @@ -416,16 +390,6 @@ void LLNavigationBar::onHomeButtonClicked() gAgent.teleportHome(); } -void LLNavigationBar::onSearchCommit() -{ - std::string search_query = mSearchComboBox->getSimple(); - if(!search_query.empty()) - { - LLSearchHistory::getInstance()->addEntry(search_query); - } - invokeSearch(search_query); -} - void LLNavigationBar::onTeleportHistoryMenuItemClicked(const LLSD& userdata) { int idx = userdata.asInteger(); @@ -736,151 +700,3 @@ int LLNavigationBar::getDefFavBarHeight() { return mDefaultFpRect.getHeight(); } - -void LLNavigationBar::showNavigationPanel(BOOL visible) -{ - bool fpVisible = gSavedSettings.getBOOL("ShowNavbarFavoritesPanel"); - - LLFavoritesBarCtrl* fb = getChild<LLFavoritesBarCtrl>("favorite"); - LLPanel* navPanel = getChild<LLPanel>("navigation_panel"); - - LLRect nbRect(getRect()); - LLRect fbRect(fb->getRect()); - - navPanel->setVisible(visible); - - if (visible) - { - if (fpVisible) - { - // Navigation Panel must be shown. Favorites Panel is visible. - - nbRect.setLeftTopAndSize(nbRect.mLeft, nbRect.mTop, nbRect.getWidth(), mDefaultNbRect.getHeight()); - fbRect.setLeftTopAndSize(fbRect.mLeft, mDefaultFpRect.mTop, fbRect.getWidth(), fbRect.getHeight()); - - // this is duplicated in 'else' section because it should be called BEFORE fb->reshape - reshape(nbRect.getWidth(), nbRect.getHeight()); - setRect(nbRect); - // propagate size to parent container - getParent()->reshape(nbRect.getWidth(), nbRect.getHeight()); - - fb->reshape(fbRect.getWidth(), fbRect.getHeight()); - fb->setRect(fbRect); - } - else - { - // Navigation Panel must be shown. Favorites Panel is hidden. - - S32 height = mDefaultNbRect.getHeight() - mDefaultFpRect.getHeight() - FAVBAR_TOP_PADDING; - nbRect.setLeftTopAndSize(nbRect.mLeft, nbRect.mTop, nbRect.getWidth(), height); - - reshape(nbRect.getWidth(), nbRect.getHeight()); - setRect(nbRect); - getParent()->reshape(nbRect.getWidth(), nbRect.getHeight()); - } - } - else - { - if (fpVisible) - { - // Navigation Panel must be hidden. Favorites Panel is visible. - - S32 fpHeight = mDefaultFpRect.getHeight() + FAVBAR_TOP_PADDING; - S32 fpTop = fpHeight - (mDefaultFpRect.getHeight() / 2) + 1; - - nbRect.setLeftTopAndSize(nbRect.mLeft, nbRect.mTop, nbRect.getWidth(), fpHeight); - fbRect.setLeftTopAndSize(fbRect.mLeft, fpTop, fbRect.getWidth(), mDefaultFpRect.getHeight()); - - // this is duplicated in 'else' section because it should be called BEFORE fb->reshape - reshape(nbRect.getWidth(), nbRect.getHeight()); - setRect(nbRect); - getParent()->reshape(nbRect.getWidth(), nbRect.getHeight()); - - fb->reshape(fbRect.getWidth(), fbRect.getHeight()); - fb->setRect(fbRect); - } - else - { - // Navigation Panel must be hidden. Favorites Panel is hidden. - - nbRect.setLeftTopAndSize(nbRect.mLeft, nbRect.mTop, nbRect.getWidth(), 0); - - reshape(nbRect.getWidth(), nbRect.getHeight()); - setRect(nbRect); - getParent()->reshape(nbRect.getWidth(), nbRect.getHeight()); - } - } - - getChildView("bg_icon")->setVisible( visible && fpVisible); - getChildView("bg_icon_no_fav_bevel")->setVisible( visible && !fpVisible); - getChildView("bg_icon_no_nav_bevel")->setVisible( !visible && fpVisible); -} - -void LLNavigationBar::showFavoritesPanel(BOOL visible) -{ - bool npVisible = gSavedSettings.getBOOL("ShowNavbarNavigationPanel"); - - LLFavoritesBarCtrl* fb = getChild<LLFavoritesBarCtrl>("favorite"); - - LLRect nbRect(getRect()); - LLRect fbRect(fb->getRect()); - - if (visible) - { - if (npVisible) - { - // Favorites Panel must be shown. Navigation Panel is visible. - - S32 fbHeight = fbRect.getHeight(); - S32 newHeight = nbRect.getHeight() + fbHeight + FAVBAR_TOP_PADDING; - - nbRect.setLeftTopAndSize(nbRect.mLeft, nbRect.mTop, nbRect.getWidth(), newHeight); - fbRect.setLeftTopAndSize(mDefaultFpRect.mLeft, mDefaultFpRect.mTop, fbRect.getWidth(), fbRect.getHeight()); - } - else - { - // Favorites Panel must be shown. Navigation Panel is hidden. - - S32 fpHeight = mDefaultFpRect.getHeight() + FAVBAR_TOP_PADDING; - S32 fpTop = fpHeight - (mDefaultFpRect.getHeight() / 2) + 1; - - nbRect.setLeftTopAndSize(nbRect.mLeft, nbRect.mTop, nbRect.getWidth(), fpHeight); - fbRect.setLeftTopAndSize(fbRect.mLeft, fpTop, fbRect.getWidth(), mDefaultFpRect.getHeight()); - } - - reshape(nbRect.getWidth(), nbRect.getHeight()); - setRect(nbRect); - getParent()->reshape(nbRect.getWidth(), nbRect.getHeight()); - - fb->reshape(fbRect.getWidth(), fbRect.getHeight()); - fb->setRect(fbRect); - } - else - { - if (npVisible) - { - // Favorites Panel must be hidden. Navigation Panel is visible. - - S32 fbHeight = fbRect.getHeight(); - S32 newHeight = nbRect.getHeight() - fbHeight - FAVBAR_TOP_PADDING; - - nbRect.setLeftTopAndSize(nbRect.mLeft, nbRect.mTop, nbRect.getWidth(), newHeight); - } - else - { - // Favorites Panel must be hidden. Navigation Panel is hidden. - - nbRect.setLeftTopAndSize(nbRect.mLeft, nbRect.mTop, nbRect.getWidth(), 0); - } - - reshape(nbRect.getWidth(), nbRect.getHeight()); - setRect(nbRect); - getParent()->reshape(nbRect.getWidth(), nbRect.getHeight()); - } - - getChildView("bg_icon")->setVisible( npVisible && visible); - getChildView("bg_icon_no_fav_bevel")->setVisible( npVisible && !visible); - getChildView("bg_icon_no_nav_bevel")->setVisible( !npVisible && visible); - - fb->setVisible(visible); -} diff --git a/indra/newview/llnavigationbar.h b/indra/newview/llnavigationbar.h index 3c9f8a762d..e4ce9e3998 100644 --- a/indra/newview/llnavigationbar.h +++ b/indra/newview/llnavigationbar.h @@ -98,9 +98,6 @@ public: void handleLoginComplete(); void clearHistoryCache(); - void showNavigationPanel(BOOL visible); - void showFavoritesPanel(BOOL visible); - int getDefNavBarHeight(); int getDefFavBarHeight(); @@ -121,7 +118,6 @@ private: void onHomeButtonClicked(); void onLocationSelection(); void onLocationPrearrange(const LLSD& data); - void onSearchCommit(); void onTeleportFinished(const LLVector3d& global_agent_pos); void onTeleportFailed(); void onRegionNameResponse( @@ -131,8 +127,6 @@ private: U64 region_handle, const std::string& url, const LLUUID& snapshot_id, bool teleport); - void fillSearchComboBox(); - static void destroyClass() { if (LLNavigationBar::instanceExists()) @@ -145,7 +139,6 @@ private: LLPullButton* mBtnBack; LLPullButton* mBtnForward; LLButton* mBtnHome; - LLSearchComboBox* mSearchComboBox; LLLocationInputCtrl* mCmbLocation; LLRect mDefaultNbRect; LLRect mDefaultFpRect; diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 10887aa53a..c2739867b1 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -35,6 +35,7 @@ #include "llaccordionctrltab.h" #include "llagentwearables.h" #include "llappearancemgr.h" +#include "llfloatersidepanelcontainer.h" #include "llinventoryfunctions.h" #include "llinventorymodel.h" #include "lllistcontextmenu.h" @@ -327,7 +328,7 @@ protected: static void editOutfit() { - LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "edit_outfit")); + LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "edit_outfit")); } static void renameOutfit(const LLUUID& outfit_cat_id) diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp index a9cc247d1b..1b9eb4813b 100644 --- a/indra/newview/llpanellandmarks.cpp +++ b/indra/newview/llpanellandmarks.cpp @@ -42,6 +42,7 @@ #include "llagentui.h" #include "llcallbacklist.h" #include "lldndbutton.h" +#include "llfloatersidepanelcontainer.h" #include "llfloaterworldmap.h" #include "llfolderviewitem.h" #include "llinventorymodelbackgroundfetch.h" @@ -367,7 +368,7 @@ void LLLandmarksPanel::onSelectorButtonClicked() key["type"] = "landmark"; key["id"] = listenerp->getUUID(); - LLSideTray::getInstance()->showPanel("panel_places", key); + LLFloaterSidePanelContainer::showPanel("places", key); } } @@ -786,7 +787,7 @@ void LLLandmarksPanel::onAddAction(const LLSD& userdata) const } else { - LLSideTray::getInstance()->showPanel("panel_places", LLSD().with("type", "create_landmark")); + LLFloaterSidePanelContainer::showPanel("places", LLSD().with("type", "create_landmark")); } } else if ("category" == command_name) @@ -1309,7 +1310,13 @@ void LLLandmarksPanel::doProcessParcelInfo(LLLandmark* landmark, landmark->getGlobalPos(landmark_global_pos); // let's toggle pick panel into panel places - LLPanel* panel_places = LLSideTray::getInstance()->getPanel("panel_places");//-> sidebar_places + LLPanel* panel_places = NULL; + LLFloaterSidePanelContainer* floaterp = LLFloaterReg::getTypedInstance<LLFloaterSidePanelContainer>("places"); + if (floaterp) + { + panel_places = floaterp->findChild<LLPanel>("main_panel"); + } + if (!panel_places) { llassert(NULL != panel_places); diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 858f5cf575..c1341af2ef 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -38,6 +38,7 @@ #include "llinventorymodelbackgroundfetch.h" #include "llinventorypanel.h" #include "llfiltereditor.h" +#include "llfloatersidepanelcontainer.h" #include "llfloaterreg.h" #include "llmenubutton.h" #include "lloutfitobserver.h" @@ -579,8 +580,13 @@ void LLPanelMainInventory::updateItemcountText() void LLPanelMainInventory::onFocusReceived() { - LLSidepanelInventory * sidepanel_inventory = LLSideTray::getInstance()->getPanel<LLSidepanelInventory>("sidepanel_inventory"); - + LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("my_inventory"); + if (!sidepanel_inventory) + { + llwarns << "Could not find Inventory Panel in My Inventory floater" << llendl; + return; + } + sidepanel_inventory->clearSelections(false, true, true); } @@ -1164,7 +1170,7 @@ BOOL LLPanelMainInventory::isActionEnabled(const LLSD& userdata) if (command_name == "share") { - LLSidepanelInventory* parent = dynamic_cast<LLSidepanelInventory*>(LLSideTray::getInstance()->getPanel("sidepanel_inventory")); + LLSidepanelInventory* parent = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("my_inventory"); return parent ? parent->canShare() : FALSE; } diff --git a/indra/newview/llpanelmarketplaceinbox.cpp b/indra/newview/llpanelmarketplaceinbox.cpp index 0579ecbb90..a336472fc0 100644 --- a/indra/newview/llpanelmarketplaceinbox.cpp +++ b/indra/newview/llpanelmarketplaceinbox.cpp @@ -32,6 +32,7 @@ #include "llappviewer.h" #include "llbutton.h" #include "llinventorypanel.h" +#include "llfloatersidepanelcontainer.h" #include "llfolderview.h" #include "llsidepanelinventory.h" #include "llviewercontrol.h" @@ -67,7 +68,7 @@ BOOL LLPanelMarketplaceInbox::postBuild() void LLPanelMarketplaceInbox::onSelectionChange() { - LLSidepanelInventory* sidepanel_inventory = dynamic_cast<LLSidepanelInventory*>(LLSideTray::getInstance()->getPanel("sidepanel_inventory")); + LLSidepanelInventory* sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("my_inventory"); sidepanel_inventory->updateVerbs(); } @@ -113,9 +114,11 @@ LLInventoryPanel * LLPanelMarketplaceInbox::setupInventoryPanel() void LLPanelMarketplaceInbox::onFocusReceived() { - LLSidepanelInventory * sidepanel_inventory = LLSideTray::getInstance()->getPanel<LLSidepanelInventory>("sidepanel_inventory"); - - sidepanel_inventory->clearSelections(true, false, true); + LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("my_inventory"); + if (sidepanel_inventory) + { + sidepanel_inventory->clearSelections(true, false, true); + } gSavedPerAccountSettings.setU32("LastInventoryInboxActivity", time_corrected()); } @@ -186,9 +189,10 @@ std::string LLPanelMarketplaceInbox::getBadgeString() const { std::string item_count_str(""); + LLPanel *inventory_panel = LLFloaterSidePanelContainer::getPanel("my_inventory"); + // If the inbox is visible, and the side panel is collapsed or expanded and not the inventory panel - if (getParent()->getVisible() && - (LLSideTray::getInstance()->getCollapsed() || !LLSideTray::getInstance()->isPanelActive("sidepanel_inventory"))) + if (getParent()->getVisible() && inventory_panel && !inventory_panel->isInVisibleChain()) { U32 item_count = getFreshItemCount(); diff --git a/indra/newview/llpanelmarketplaceoutbox.cpp b/indra/newview/llpanelmarketplaceoutbox.cpp index 73fb92ff72..c0de5deb0a 100644 --- a/indra/newview/llpanelmarketplaceoutbox.cpp +++ b/indra/newview/llpanelmarketplaceoutbox.cpp @@ -33,6 +33,7 @@ #include "llbutton.h" #include "llcoros.h" #include "lleventcoro.h" +#include "llfloatersidepanelcontainer.h" #include "llinventorypanel.h" #include "llloadingindicator.h" #include "llnotificationsutil.h" @@ -89,16 +90,20 @@ void LLPanelMarketplaceOutbox::handleLoginComplete() void LLPanelMarketplaceOutbox::onFocusReceived() { - LLSidepanelInventory * sidepanel_inventory = LLSideTray::getInstance()->getPanel<LLSidepanelInventory>("sidepanel_inventory"); - - sidepanel_inventory->clearSelections(true, true, false); + LLSidepanelInventory * sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("my_inventory"); + if (sidepanel_inventory) + { + sidepanel_inventory->clearSelections(true, true, false); + } } void LLPanelMarketplaceOutbox::onSelectionChange() { - LLSidepanelInventory* sidepanel_inventory = dynamic_cast<LLSidepanelInventory*>(LLSideTray::getInstance()->getPanel("sidepanel_inventory")); - - sidepanel_inventory->updateVerbs(); + LLSidepanelInventory* sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("my_inventory"); + if (sidepanel_inventory) + { + sidepanel_inventory->updateVerbs(); + } } LLInventoryPanel * LLPanelMarketplaceOutbox::setupInventoryPanel() diff --git a/indra/newview/llpanelme.cpp b/indra/newview/llpanelme.cpp index 1347a02a52..4d86fa15df 100644 --- a/indra/newview/llpanelme.cpp +++ b/indra/newview/llpanelme.cpp @@ -37,7 +37,6 @@ #include "llfirstuse.h" #include "llfloaterreg.h" #include "llhints.h" -#include "llsidetray.h" #include "llviewercontrol.h" #include "llviewerdisplayname.h" @@ -89,45 +88,6 @@ void LLPanelMe::onOpen(const LLSD& key) //} } -bool LLPanelMe::notifyChildren(const LLSD& info) -{ - if (info.has("task-panel-action") && info["task-panel-action"].asString() == "handle-tri-state") - { - // Implement task panel tri-state behavior. - // - // When the button of an active open task panel is clicked, side tray - // calls notifyChildren() on the panel, passing task-panel-action=>handle-tri-state as an argument. - // The task panel is supposed to handle this by reverting to the default view, - // i.e. closing any dependent panels like "pick info" or "profile edit". - - bool on_default_view = true; - - const LLRect& task_panel_rect = getRect(); - for (LLView* child = getFirstChild(); child; child = findNextSibling(child)) - { - LLPanel* panel = dynamic_cast<LLPanel*>(child); - if (!panel) - continue; - - // *HACK: implement panel stack instead (e.g. me->pick_info->pick_edit). - if (panel->getRect().getWidth() == task_panel_rect.getWidth() && - panel->getRect().getHeight() == task_panel_rect.getHeight() && - panel->getVisible()) - { - panel->setVisible(FALSE); - on_default_view = false; - } - } - - if (on_default_view) - LLSideTray::getInstance()->collapseSideBar(); - - return true; // this notification is only supposed to be handled by task panels - } - - return LLPanel::notifyChildren(info); -} - void LLPanelMe::buildEditPanel() { if (NULL == mEditPanel) diff --git a/indra/newview/llpanelme.h b/indra/newview/llpanelme.h index f27f5a268e..22cbb9e055 100644 --- a/indra/newview/llpanelme.h +++ b/indra/newview/llpanelme.h @@ -49,7 +49,6 @@ public: LLPanelMe(); /*virtual*/ void onOpen(const LLSD& key); - /*virtual*/ bool notifyChildren(const LLSD& info); /*virtual*/ BOOL postBuild(); diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp index a90f864ae2..3ac0d6616b 100644 --- a/indra/newview/llpaneloutfitsinventory.cpp +++ b/indra/newview/llpaneloutfitsinventory.cpp @@ -31,6 +31,7 @@ #include "llnotificationsutil.h" #include "lltabcontainer.h" +#include "llfloatersidepanelcontainer.h" #include "llinventoryfunctions.h" #include "llinventorymodelbackgroundfetch.h" #include "llagentwearables.h" @@ -222,7 +223,7 @@ void LLPanelOutfitsInventory::onSave() //static LLPanelOutfitsInventory* LLPanelOutfitsInventory::findInstance() { - return dynamic_cast<LLPanelOutfitsInventory*>(LLSideTray::getInstance()->getPanel("panel_outfits_inventory")); + return dynamic_cast<LLPanelOutfitsInventory*>(LLFloaterSidePanelContainer::getPanel("appearance", "panel_outfits_inventory")); } ////////////////////////////////////////////////////////////////////////////////// @@ -319,8 +320,7 @@ void LLPanelOutfitsInventory::onWearablesLoading() // static LLSidepanelAppearance* LLPanelOutfitsInventory::getAppearanceSP() { - static LLSidepanelAppearance* panel_appearance = - dynamic_cast<LLSidepanelAppearance*> - (LLSideTray::getInstance()->getPanel("sidepanel_appearance")); + LLSidepanelAppearance* panel_appearance = + dynamic_cast<LLSidepanelAppearance*>(LLFloaterSidePanelContainer::getPanel("appearance")); return panel_appearance; } diff --git a/indra/newview/llpanelpicks.cpp b/indra/newview/llpanelpicks.cpp index ddce83c616..15b5fc8301 100755 --- a/indra/newview/llpanelpicks.cpp +++ b/indra/newview/llpanelpicks.cpp @@ -48,11 +48,11 @@ #include "llaccordionctrl.h" #include "llaccordionctrltab.h" #include "llavatarpropertiesprocessor.h" +#include "llfloatersidepanelcontainer.h" #include "llpanelavatar.h" #include "llpanelprofile.h" #include "llpanelpick.h" #include "llpanelclassified.h" -#include "llsidetray.h" static const std::string XML_BTN_NEW = "new_btn"; static const std::string XML_BTN_DELETE = "trash_btn"; @@ -133,7 +133,7 @@ public: params["id"] = gAgent.getID(); params["open_tab_name"] = "panel_picks"; params["show_tab_panel"] = "create_pick"; - LLSideTray::getInstance()->showPanel("panel_me", params); + LLFloaterSidePanelContainer::showPanel("my_profile", params); } void editPick(LLPickData* pick_info) @@ -146,8 +146,7 @@ public: params["snapshot_id"] = pick_info->snapshot_id; params["pick_name"] = pick_info->name; params["pick_desc"] = pick_info->desc; - - LLSideTray::getInstance()->showPanel("panel_me", params); + LLFloaterSidePanelContainer::showPanel("my_profile", params); } /*virtual*/ void processProperties(void* data, EAvatarProcessorType type) @@ -252,7 +251,7 @@ public: params["id"] = gAgent.getID(); params["open_tab_name"] = "panel_picks"; params["show_tab_panel"] = "create_classified"; - LLSideTray::getInstance()->showPanel("panel_me", params); + LLFloaterSidePanelContainer::showPanel("my_profile", params); } void openClassified(LLAvatarClassifiedInfo* c_info) @@ -270,7 +269,11 @@ public: params["classified_name"] = c_info->name; params["classified_desc"] = c_info->description; params["from_search"] = true; - LLSideTray::getInstance()->showPanel("panel_profile_view", params); + LLFloaterSidePanelContainer* floaterp = LLFloaterReg::getTypedInstance<LLFloaterSidePanelContainer>("people"); + if (floaterp) + { + floaterp->openChildPanel("panel_profile_view", params); + } } else if (mRequestVerb == "edit") { @@ -283,7 +286,7 @@ public: params["open_tab_name"] = "panel_picks"; params["show_tab_panel"] = "edit_classified"; params["classified_id"] = c_info->classified_id; - LLSideTray::getInstance()->showPanel("panel_me", params); + LLFloaterSidePanelContainer::showPanel("my_profile", params); } else { diff --git a/indra/newview/llpanelplaces.cpp b/indra/newview/llpanelplaces.cpp index 1e510a2d7b..0129ac753a 100644 --- a/indra/newview/llpanelplaces.cpp +++ b/indra/newview/llpanelplaces.cpp @@ -39,6 +39,7 @@ #include "llfiltereditor.h" #include "llfirstuse.h" #include "llfloaterreg.h" +#include "llfloatersidepanelcontainer.h" #include "llmenubutton.h" #include "llnotificationsutil.h" #include "lltabcontainer.h" @@ -115,7 +116,7 @@ public: LLSD key; key["type"] = "remote_place"; key["id"] = parcel_id; - LLSideTray::getInstance()->showPanel("panel_places", key); + LLFloaterSidePanelContainer::showPanel("places", key); return true; } } @@ -151,18 +152,16 @@ class LLPlacesInventoryObserver : public LLInventoryAddedObserver { public: LLPlacesInventoryObserver(LLPanelPlaces* places_panel) : - mPlaces(places_panel), - mTabsCreated(false) + mPlaces(places_panel) {} /*virtual*/ void changed(U32 mask) { LLInventoryAddedObserver::changed(mask); - if (!mTabsCreated && mPlaces) + if (mPlaces && !mPlaces->tabsCreated()) { mPlaces->createTabs(); - mTabsCreated = true; } } @@ -175,7 +174,6 @@ protected: private: LLPanelPlaces* mPlaces; - bool mTabsCreated; }; class LLPlacesRemoteParcelInfoObserver : public LLRemoteParcelInfoObserver @@ -244,7 +242,8 @@ LLPanelPlaces::LLPanelPlaces() mPlaceMenu(NULL), mLandmarkMenu(NULL), mPosGlobal(), - isLandmarkEditModeOn(false) + isLandmarkEditModeOn(false), + mTabsCreated(false) { mParcelObserver = new LLPlacesParcelObserver(this); mInventoryObserver = new LLPlacesInventoryObserver(this); @@ -252,7 +251,7 @@ LLPanelPlaces::LLPanelPlaces() gInventory.addObserver(mInventoryObserver); - LLViewerParcelMgr::getInstance()->addAgentParcelChangedCallback( + mAgentParcelChangedConnection = LLViewerParcelMgr::getInstance()->addAgentParcelChangedCallback( boost::bind(&LLPanelPlaces::updateVerbs, this)); //buildFromFile( "panel_places.xml"); // Called from LLRegisterPanelClass::defaultPanelClassBuilder() @@ -268,6 +267,11 @@ LLPanelPlaces::~LLPanelPlaces() delete mInventoryObserver; delete mParcelObserver; delete mRemoteParcelObserver; + + if (mAgentParcelChangedConnection.connected()) + { + mAgentParcelChangedConnection.disconnect(); + } } BOOL LLPanelPlaces::postBuild() @@ -349,6 +353,9 @@ BOOL LLPanelPlaces::postBuild() LLComboBox* folder_combo = mLandmarkInfo->getChild<LLComboBox>("folder_combo"); folder_combo->setCommitCallback(boost::bind(&LLPanelPlaces::onEditButtonClicked, this)); + createTabs(); + updateVerbs(); + return TRUE; } @@ -1025,7 +1032,7 @@ void LLPanelPlaces::changedParcelSelection() void LLPanelPlaces::createTabs() { - if (!(gInventory.isInventoryUsable() && LLTeleportHistory::getInstance())) + if (!(gInventory.isInventoryUsable() && LLTeleportHistory::getInstance() && !mTabsCreated)) return; LLLandmarksPanel* landmarks_panel = new LLLandmarksPanel(); @@ -1059,6 +1066,8 @@ void LLPanelPlaces::createTabs() // Filter applied to show all items. if (mActivePanel) mActivePanel->onSearchEdit(mActivePanel->getFilterSubString()); + + mTabsCreated = true; } void LLPanelPlaces::changedGlobalPos(const LLVector3d &global_pos) diff --git a/indra/newview/llpanelplaces.h b/indra/newview/llpanelplaces.h index b335f88a48..85bdc2c4e1 100644 --- a/indra/newview/llpanelplaces.h +++ b/indra/newview/llpanelplaces.h @@ -77,6 +77,8 @@ public: std::string getPlaceInfoType() { return mPlaceInfoType; } + bool tabsCreated() { return mTabsCreated;} + /*virtual*/ S32 notifyParent(const LLSD& info); private: @@ -146,7 +148,12 @@ private: bool isLandmarkEditModeOn; + // Holds info whether "My Landmarks" and "Teleport History" tabs have been created. + bool mTabsCreated; + LLSafeHandle<LLParcelSelection> mParcel; + + boost::signals2::connection mAgentParcelChangedConnection; }; #endif //LL_LLPANELPLACES_H diff --git a/indra/newview/llpanelteleporthistory.cpp b/indra/newview/llpanelteleporthistory.cpp index dfa8c75493..52dd70f005 100644 --- a/indra/newview/llpanelteleporthistory.cpp +++ b/indra/newview/llpanelteleporthistory.cpp @@ -39,6 +39,7 @@ #include "llaccordionctrl.h" #include "llaccordionctrltab.h" #include "llflatlistview.h" +#include "llfloatersidepanelcontainer.h" #include "llnotificationsutil.h" #include "lltextbox.h" #include "lltoggleablemenu.h" @@ -221,7 +222,7 @@ void LLTeleportHistoryFlatItem::showPlaceInfoPanel(S32 index) params["id"] = index; params["type"] = "teleport_history"; - LLSideTray::getInstance()->showPanel("panel_places", params); + LLFloaterSidePanelContainer::showPanel("places", params); } void LLTeleportHistoryFlatItem::onProfileBtnClick() @@ -396,7 +397,7 @@ BOOL LLTeleportHistoryPanel::postBuild() mTeleportHistory = LLTeleportHistoryStorage::getInstance(); if (mTeleportHistory) { - mTeleportHistory->setHistoryChangedCallback(boost::bind(&LLTeleportHistoryPanel::onTeleportHistoryChange, this, _1)); + mTeleportHistoryChangedConnection = mTeleportHistory->setHistoryChangedCallback(boost::bind(&LLTeleportHistoryPanel::onTeleportHistoryChange, this, _1)); } mHistoryAccordion = getChild<LLAccordionCtrl>("history_accordion"); diff --git a/indra/newview/llpanelteleporthistory.h b/indra/newview/llpanelteleporthistory.h index 3d29454d15..47b607a2f4 100644 --- a/indra/newview/llpanelteleporthistory.h +++ b/indra/newview/llpanelteleporthistory.h @@ -119,6 +119,8 @@ private: LLContextMenu* mAccordionTabMenu; LLHandle<LLView> mGearMenuHandle; LLMenuButton* mMenuGearButton; + + boost::signals2::connection mTeleportHistoryChangedConnection; }; diff --git a/indra/newview/llpaneltopinfobar.cpp b/indra/newview/llpaneltopinfobar.cpp index 7087541fc8..b6e32dba78 100644 --- a/indra/newview/llpaneltopinfobar.cpp +++ b/indra/newview/llpaneltopinfobar.cpp @@ -31,6 +31,7 @@ #include "llagent.h" #include "llagentui.h" #include "llclipboard.h" +#include "llfloatersidepanelcontainer.h" #include "lllandmarkactions.h" #include "lllocationinputctrl.h" #include "llnotificationsutil.h" @@ -436,12 +437,11 @@ void LLPanelTopInfoBar::onContextMenuItemClicked(const LLSD::String& item) if(landmark == NULL) { - LLSideTray::getInstance()->showPanel("panel_places", LLSD().with("type", "create_landmark")); + LLFloaterSidePanelContainer::showPanel("places", LLSD().with("type", "create_landmark")); } else { - LLSideTray::getInstance()->showPanel("panel_places", - LLSD().with("type", "landmark").with("id",landmark->getUUID())); + LLFloaterSidePanelContainer::showPanel("places", LLSD().with("type", "landmark").with("id",landmark->getUUID())); } } else if (item == "copy") @@ -456,5 +456,5 @@ void LLPanelTopInfoBar::onContextMenuItemClicked(const LLSD::String& item) void LLPanelTopInfoBar::onInfoButtonClicked() { - LLSideTray::getInstance()->showPanel("panel_places", LLSD().with("type", "agent")); + LLFloaterSidePanelContainer::showPanel("places", LLSD().with("type", "agent")); } diff --git a/indra/newview/llpanelwearing.cpp b/indra/newview/llpanelwearing.cpp index f19b54c1d4..87e9bb7b28 100644 --- a/indra/newview/llpanelwearing.cpp +++ b/indra/newview/llpanelwearing.cpp @@ -31,6 +31,7 @@ #include "lltoggleablemenu.h" #include "llappearancemgr.h" +#include "llfloatersidepanelcontainer.h" #include "llinventoryfunctions.h" #include "llinventorymodel.h" #include "llinventoryobserver.h" @@ -44,7 +45,7 @@ // Context menu and Gear menu helper. static void edit_outfit() { - LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "edit_outfit")); + LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "edit_outfit")); } ////////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp index 28ec11d1c7..a356013830 100644 --- a/indra/newview/llsidepanelappearance.cpp +++ b/indra/newview/llsidepanelappearance.cpp @@ -32,6 +32,7 @@ #include "llagentcamera.h" #include "llagentwearables.h" #include "llappearancemgr.h" +#include "llfloatersidepanelcontainer.h" #include "llfolderview.h" #include "llinventorypanel.h" #include "llfiltereditor.h" @@ -456,7 +457,7 @@ void LLSidepanelAppearance::refreshCurrentOutfitName(const std::string& name) //static void LLSidepanelAppearance::editWearable(LLWearable *wearable, LLView *data, BOOL disable_camera_switch) { - LLSideTray::getInstance()->showPanel("sidepanel_appearance"); + LLFloaterSidePanelContainer::showPanel("appearance", LLSD()); LLSidepanelAppearance *panel = dynamic_cast<LLSidepanelAppearance*>(data); if (panel) diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index bd62b5c101..0226896f54 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -34,6 +34,7 @@ #include "llbutton.h" #include "lldate.h" #include "llfirstuse.h" +#include "llfloatersidepanelcontainer.h" #include "llfoldertype.h" #include "llhttpclient.h" #include "llinventorybridge.h" @@ -172,16 +173,20 @@ LLSidepanelInventory::~LLSidepanelInventory() void handleInventoryDisplayInboxChanged() { - LLSidepanelInventory* sidepanel_inventory = dynamic_cast<LLSidepanelInventory*>(LLSideTray::getInstance()->getPanel("sidepanel_inventory")); - - sidepanel_inventory->enableInbox(gSavedSettings.getBOOL("InventoryDisplayInbox")); + LLSidepanelInventory* sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("my_inventory"); + if (sidepanel_inventory) + { + sidepanel_inventory->enableInbox(gSavedSettings.getBOOL("InventoryDisplayInbox")); + } } void handleInventoryDisplayOutboxChanged() { - LLSidepanelInventory* sidepanel_inventory = dynamic_cast<LLSidepanelInventory*>(LLSideTray::getInstance()->getPanel("sidepanel_inventory")); - - sidepanel_inventory->enableOutbox(gSavedSettings.getBOOL("InventoryDisplayOutbox")); + LLSidepanelInventory* sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("my_inventory"); + if (sidepanel_inventory) + { + sidepanel_inventory->enableOutbox(gSavedSettings.getBOOL("InventoryDisplayOutbox")); + } } BOOL LLSidepanelInventory::postBuild() @@ -283,6 +288,9 @@ BOOL LLSidepanelInventory::postBuild() gSavedSettings.getControl("InventoryDisplayInbox")->getCommitSignal()->connect(boost::bind(&handleInventoryDisplayInboxChanged)); gSavedSettings.getControl("InventoryDisplayOutbox")->getCommitSignal()->connect(boost::bind(&handleInventoryDisplayOutboxChanged)); + // Update the verbs buttons state. + updateVerbs(); + return TRUE; } diff --git a/indra/newview/llurldispatcher.cpp b/indra/newview/llurldispatcher.cpp index ed4d278e90..477718d118 100644 --- a/indra/newview/llurldispatcher.cpp +++ b/indra/newview/llurldispatcher.cpp @@ -32,6 +32,7 @@ #include "llcommandhandler.h" #include "llfloaterhelpbrowser.h" #include "llfloaterreg.h" +#include "llfloatersidepanelcontainer.h" #include "llfloaterworldmap.h" #include "llpanellogin.h" #include "llregionhandle.h" @@ -246,7 +247,7 @@ void LLURLDispatcherImpl::regionHandleCallback(U64 region_handle, const LLSLURL& key["y"] = global_pos.mdV[VY]; key["z"] = global_pos.mdV[VZ]; - LLSideTray::getInstance()->showPanel("panel_places", key); + LLFloaterSidePanelContainer::showPanel("places", key); } } diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index b87ca1eaec..cd522c9121 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -538,18 +538,12 @@ bool toggle_show_navigation_panel(const LLSD& newvalue) { bool value = newvalue.asBoolean(); - LLNavigationBar::getInstance()->showNavigationPanel(value); + LLNavigationBar::getInstance()->setVisible(value); gSavedSettings.setBOOL("ShowMiniLocationPanel", !value); return true; } -bool toggle_show_favorites_panel(const LLSD& newvalue) -{ - LLNavigationBar::getInstance()->showFavoritesPanel(newvalue.asBoolean()); - return true; -} - bool toggle_show_mini_location_panel(const LLSD& newvalue) { bool value = newvalue.asBoolean(); @@ -732,7 +726,6 @@ void settings_setup_listeners() gSavedSettings.getControl("UseDebugMenus")->getSignal()->connect(boost::bind(&show_debug_menus)); gSavedSettings.getControl("AgentPause")->getSignal()->connect(boost::bind(&toggle_agent_pause, _2)); gSavedSettings.getControl("ShowNavbarNavigationPanel")->getSignal()->connect(boost::bind(&toggle_show_navigation_panel, _2)); - gSavedSettings.getControl("ShowNavbarFavoritesPanel")->getSignal()->connect(boost::bind(&toggle_show_favorites_panel, _2)); gSavedSettings.getControl("ShowMiniLocationPanel")->getSignal()->connect(boost::bind(&toggle_show_mini_location_panel, _2)); gSavedSettings.getControl("ShowObjectRenderingCost")->getSignal()->connect(boost::bind(&toggle_show_object_render_cost, _2)); gSavedSettings.getControl("UpdaterServiceSetting")->getSignal()->connect(boost::bind(&toggle_updater_service_active, _2)); diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 2ebf41299a..0b3b8e23a5 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -94,6 +94,7 @@ #include "llfloaterscriptlimits.h" #include "llfloatersellland.h" #include "llfloatersettingsdebug.h" +#include "llfloatersidepanelcontainer.h" #include "llfloatersidetraytab.h" #include "llfloatersnapshot.h" #include "llfloatersounddevices.h" @@ -164,6 +165,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterAboutUtil::registerFloater(); LLFloaterReg::add("fast_timers", "floater_fast_timers.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFastTimerView>); LLFloaterReg::add("about_land", "floater_about_land.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterLand>); + LLFloaterReg::add("appearance", "floater_my_appearance.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSidePanelContainer>); LLFloaterReg::add("auction", "floater_auction.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAuction>); LLFloaterReg::add("avatar_picker", "floater_avatar_picker.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAvatarPicker>); LLFloaterReg::add("avatar_textures", "floater_avatar_textures.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAvatarTextures>); @@ -226,6 +228,8 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("moveview", "floater_moveview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMove>); LLFloaterReg::add("mute_object_by_name", "floater_mute_object.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterGetBlockedObjectName>); LLFloaterReg::add("mini_map", "floater_map.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMap>); + LLFloaterReg::add("my_inventory", "floater_my_inventory.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSidePanelContainer>); + LLFloaterReg::add("my_profile", "floater_my_profile.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSidePanelContainer>); LLFloaterReg::add("notifications_console", "floater_notifications_console.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterNotificationConsole>); LLFloaterReg::add("notification_well_window", "floater_sys_well.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLNotificationWellWindow>); @@ -234,6 +238,8 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("outgoing_call", "floater_outgoing_call.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLOutgoingCallDialog>); LLFloaterPayUtil::registerFloater(); + LLFloaterReg::add("people", "floater_people.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSidePanelContainer>); + LLFloaterReg::add("places", "floater_places.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSidePanelContainer>); LLFloaterReg::add("postcard", "floater_postcard.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPostcard>); LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPreference>); LLFloaterReg::add("prefs_proxy", "floater_preferences_proxy.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPreferenceProxy>); diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index ad65a8846c..50fb5a00e4 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -34,7 +34,9 @@ #include "llagent.h" #include "llagentcamera.h" #include "llagentwearables.h" +#include "llfloatersidepanelcontainer.h" #include "llviewerfoldertype.h" +#include "llfloatersidepanelcontainer.h" #include "llfolderview.h" #include "llviewercontrol.h" #include "llconsole.h" @@ -220,7 +222,7 @@ public: // support secondlife:///app/inventory/show if (params[0].asString() == "show") { - LLSideTray::getInstance()->showPanel("sidepanel_inventory", LLSD()); + LLFloaterSidePanelContainer::showPanel("my_inventory", LLSD()); return true; } @@ -976,7 +978,7 @@ void ModifiedCOFCallback::fire(const LLUUID& inv_item) if( gAgentCamera.cameraCustomizeAvatar() ) { // If we're in appearance editing mode, the current tab may need to be refreshed - LLSidepanelAppearance *panel = dynamic_cast<LLSidepanelAppearance*>(LLSideTray::getInstance()->getPanel("sidepanel_appearance")); + LLSidepanelAppearance *panel = dynamic_cast<LLSidepanelAppearance*>(LLFloaterSidePanelContainer::getPanel("appearance")); if (panel) { panel->showDefaultSubpart(); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 0f983ed0d5..5e781e0e4c 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -30,6 +30,7 @@ // linden library includes #include "llavatarnamecache.h" // IDEVO #include "llfloaterreg.h" +#include "llfloatersidepanelcontainer.h" #include "llcombobox.h" #include "llinventorypanel.h" #include "llnotifications.h" @@ -2588,7 +2589,7 @@ void handle_object_inspect() { LLSD key; key["task"] = "task"; - LLSideTray::getInstance()->showPanel("sidepanel_inventory", key); + LLFloaterSidePanelContainer::showPanel("my_inventory", key); } /* @@ -3712,7 +3713,7 @@ void handle_reset_view() if (gAgentCamera.cameraCustomizeAvatar()) { // switching to outfit selector should automagically save any currently edited wearable - LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "my_outfits")); + LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "my_outfits")); } gAgentCamera.switchCameraPreset(CAMERA_PRESET_REAR_VIEW); @@ -5279,7 +5280,7 @@ class LLWorldCreateLandmark : public view_listener_t { bool handleEvent(const LLSD& userdata) { - LLSideTray::getInstance()->showPanel("panel_places", LLSD().with("type", "create_landmark")); + LLFloaterSidePanelContainer::showPanel("places", LLSD().with("type", "create_landmark")); return true; } @@ -5289,7 +5290,7 @@ class LLWorldPlaceProfile : public view_listener_t { bool handleEvent(const LLSD& userdata) { - LLSideTray::getInstance()->showPanel("panel_places", LLSD().with("type", "agent")); + LLFloaterSidePanelContainer::showPanel("places", LLSD().with("type", "agent")); return true; } @@ -5530,22 +5531,22 @@ void handle_viewer_disable_message_log(void*) void handle_customize_avatar() { - LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "my_outfits")); + LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "my_outfits")); } void handle_edit_outfit() { - LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "edit_outfit")); + LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "edit_outfit")); } void handle_edit_shape() { - LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "edit_shape")); + LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "edit_shape")); } void handle_edit_physics() { - LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "edit_physics")); + LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "edit_physics")); } void handle_report_abuse() @@ -5615,18 +5616,18 @@ class LLShowSidetrayPanel : public view_listener_t { bool handleEvent(const LLSD& userdata) { - std::string panel_name = userdata.asString(); + std::string floater_name = userdata.asString(); - LLPanel* panel = LLSideTray::getInstance()->getPanel(panel_name); + LLPanel* panel = LLFloaterSidePanelContainer::getPanel(floater_name); if (panel) { if (panel->isInVisibleChain()) { - LLSideTray::getInstance()->hidePanel(panel_name); + LLFloaterReg::getInstance(floater_name)->closeFloater(); } else { - LLSideTray::getInstance()->showPanel(panel_name); + LLFloaterReg::getInstance(floater_name)->openFloater(); } } return true; @@ -5637,9 +5638,9 @@ class LLSidetrayPanelVisible : public view_listener_t { bool handleEvent(const LLSD& userdata) { - std::string panel_name = userdata.asString(); + std::string floater_name = userdata.asString(); // Toggle the panel - if (LLSideTray::getInstance()->isPanelActive(panel_name)) + if (LLFloaterReg::getInstance(floater_name)->isInVisibleChain()) { return true; } diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 961c931c02..5665a68add 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -61,6 +61,7 @@ #include "llfloaterlandholdings.h" #include "llfloaterpostcard.h" #include "llfloaterpreference.h" +#include "llfloatersidepanelcontainer.h" #include "llhudeffecttrail.h" #include "llhudmanager.h" #include "llinventoryfunctions.h" @@ -1192,9 +1193,7 @@ void open_inventory_offer(const uuid_vec_t& objects, const std::string& from_nam LLInventoryCategory* parent_folder = gInventory.getCategory(item->getParentUUID()); if ("inventory_handler" == from_name) { - //we have to filter inventory_handler messages to avoid notification displaying - LLSideTray::getInstance()->showPanel("panel_places", - LLSD().with("type", "landmark").with("id", item->getUUID())); + LLFloaterSidePanelContainer::showPanel("places", LLSD().with("type", "landmark").with("id", item->getUUID())); } else if("group_offer" == from_name) { @@ -1203,7 +1202,7 @@ void open_inventory_offer(const uuid_vec_t& objects, const std::string& from_nam LLSD args; args["type"] = "landmark"; args["id"] = obj_id; - LLSideTray::getInstance()->showPanel("panel_places", args); + LLFloaterSidePanelContainer::showPanel("places", args); continue; } diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index 4798bb536f..b308e952ad 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -32,6 +32,7 @@ #include "llaudioengine.h" #include "llavataractions.h" #include "llfloaterreg.h" +#include "llfloatersidepanelcontainer.h" #include "llfloaterworldmap.h" #include "llfocusmgr.h" #include "llinventorybridge.h" @@ -80,7 +81,7 @@ public: LLSD key; key["type"] = "landmark"; key["id"] = landmark_inv_id; - LLSideTray::getInstance()->showPanel("panel_places", key); + LLFloaterSidePanelContainer::showPanel("places", key); } static void processForeignLandmark(LLLandmark* landmark, const LLUUID& object_id, const LLUUID& notecard_inventory_id, diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 6d69932e93..7c930b80c2 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1899,12 +1899,7 @@ void LLViewerWindow::initWorldUI() if (!gSavedSettings.getBOOL("ShowNavbarNavigationPanel")) { - navbar->showNavigationPanel(FALSE); - } - - if (!gSavedSettings.getBOOL("ShowNavbarFavoritesPanel")) - { - navbar->showFavoritesPanel(FALSE); + navbar->setVisible(FALSE); } // Top Info bar @@ -2198,7 +2193,9 @@ void LLViewerWindow::setNormalControlsVisible( BOOL visible ) LLNavigationBar* navbarp = LLUI::getRootView()->findChild<LLNavigationBar>("navigation_bar"); if (navbarp) { - navbarp->setVisible( visible ); + // when it's time to show navigation bar we need to ensure that the user wants to see it + // i.e. ShowNavbarNavigationPanel option is true + navbarp->setVisible( visible && gSavedSettings.getBOOL("ShowNavbarNavigationPanel") ); } } diff --git a/indra/newview/llwearable.cpp b/indra/newview/llwearable.cpp index d1c0990f90..276e8f462d 100644 --- a/indra/newview/llwearable.cpp +++ b/indra/newview/llwearable.cpp @@ -30,6 +30,7 @@ #include "llagentcamera.h" #include "llagentwearables.h" #include "lldictionary.h" +#include "llfloatersidepanelcontainer.h" #include "lllocaltextureobject.h" #include "llnotificationsutil.h" #include "llviewertexturelist.h" @@ -697,7 +698,7 @@ void LLWearable::removeFromAvatar( LLWearableType::EType type, BOOL upload_bake if(gAgentCamera.cameraCustomizeAvatar()) { - LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "edit_outfit")); + LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "edit_outfit")); } gAgentAvatarp->updateVisualParams(); @@ -967,7 +968,7 @@ void LLWearable::revertValues() syncImages(mSavedTEMap, mTEMap); - LLSidepanelAppearance *panel = dynamic_cast<LLSidepanelAppearance*>(LLSideTray::getInstance()->getPanel("sidepanel_appearance")); + LLSidepanelAppearance *panel = dynamic_cast<LLSidepanelAppearance*>(LLFloaterSidePanelContainer::getPanel("appearance")); if( panel ) { panel->updateScrollingPanelList(); @@ -1008,7 +1009,7 @@ void LLWearable::saveValues() syncImages(mTEMap, mSavedTEMap); - LLSidepanelAppearance *panel = dynamic_cast<LLSidepanelAppearance*>(LLSideTray::getInstance()->getPanel("sidepanel_appearance")); + LLSidepanelAppearance *panel = dynamic_cast<LLSidepanelAppearance*>(LLFloaterSidePanelContainer::getPanel("appearance")); if( panel ) { panel->updateScrollingPanelList(); diff --git a/indra/newview/skins/default/xui/en/floater_my_appearance.xml b/indra/newview/skins/default/xui/en/floater_my_appearance.xml new file mode 100644 index 0000000000..8f97887b3f --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_my_appearance.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> + +<floater + legacy_header_height="18" + can_resize="true" + height="588" + layout="topleft" + name="floater_my_appearance" + save_rect="true" + single_instance="true" + title="MY APPEARANCE" + width="333"> + <panel + top="18" + class="sidepanel_appearance" + name="main_panel" + filename="sidepanel_appearance.xml" + label="Edit Appearance" + font="SansSerifBold"/> +</floater> diff --git a/indra/newview/skins/default/xui/en/floater_my_inventory.xml b/indra/newview/skins/default/xui/en/floater_my_inventory.xml new file mode 100644 index 0000000000..fd03a5324e --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_my_inventory.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<floater + can_close="true" + can_resize="true" + height="570" + help_topic="sidebar_inventory" + min_width="333" + min_height="440" + name="floater_my_inventory" + save_rect="true" + save_visibility="true" + title="My Inventory" + width="333" > + <panel + class="sidepanel_inventory" + name="main_panel" + filename="sidepanel_inventory.xml" + follows="all" + top="0"/> +</floater> diff --git a/indra/newview/skins/default/xui/en/floater_my_profile.xml b/indra/newview/skins/default/xui/en/floater_my_profile.xml new file mode 100644 index 0000000000..b3ebe7f791 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_my_profile.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<floater + can_close="true" + can_resize="true" + height="570" + help_topic="sidebar_me" + min_width="333" + min_height="440" + name="floater_profile" + save_rect="true" + save_visibility="true" + title="My Profile" + width="333" > + <panel + class="panel_me" + name="main_panel" + filename="panel_me.xml" + follows="all"/> +</floater> diff --git a/indra/newview/skins/default/xui/en/floater_people.xml b/indra/newview/skins/default/xui/en/floater_people.xml new file mode 100644 index 0000000000..13e0738e52 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_people.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<floater + can_close="true" + can_resize="true" + height="570" + help_topic="sidebar_people" + min_width="333" + min_height="440" + name="floater_people" + save_rect="true" + save_visibility="true" + title="People" + width="333" > + <panel_container + follows="all" + height="570" + name="main_panel" + default_panel_name="panel_people" + width="333"> + <panel + class="panel_people" + name="panel_people" + filename="panel_people.xml"/> + <panel + class="panel_profile_view" + name="panel_profile_view" + filename="panel_profile_view.xml"/> + <panel + class="panel_group_info_sidetray" + name="panel_group_info_sidetray" + filename="panel_group_info_sidetray.xml" + label="Group Profile" + font="SansSerifBold"/> + <panel + class="panel_block_list_sidetray" + name="panel_block_list_sidetray" + filename="panel_block_list_sidetray.xml" + label="Blocked Residents & Objects" + font="SansSerifBold"/> + </panel_container> +</floater> diff --git a/indra/newview/skins/default/xui/en/floater_places.xml b/indra/newview/skins/default/xui/en/floater_places.xml new file mode 100644 index 0000000000..d589eb7d20 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_places.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> + +<floater + legacy_header_height="18" + can_resize="true" + height="588" + layout="topleft" + name="floater_places" + save_rect="true" + title="PLACES" + width="333"> + <panel + top="18" + class="panel_places" + name="main_panel" + filename="panel_places.xml" + label="Places" + font="SansSerifBold"/> +</floater> diff --git a/indra/newview/skins/default/xui/en/floater_test_toolbar.xml b/indra/newview/skins/default/xui/en/floater_test_toolbar.xml index fbfbe51a69..067c1fed82 100644 --- a/indra/newview/skins/default/xui/en/floater_test_toolbar.xml +++ b/indra/newview/skins/default/xui/en/floater_test_toolbar.xml @@ -8,6 +8,7 @@ translate="false" width="500"> <toolbar name="test_toolbar_top" + button_display_mode="icons_with_text" follows="left|right|top" height="50" width="500" @@ -21,6 +22,7 @@ <command name="chat"/> </toolbar> <toolbar name="test_toolbar_left" + button_display_mode="icons_with_text" follows="left|bottom|top" height="380" width="200" @@ -33,6 +35,7 @@ <command name="chat"/> </toolbar> <toolbar name="test_toolbar_right" + button_display_mode="icons_with_text" follows="right|bottom|top" height="380" width="200" @@ -44,6 +47,7 @@ <command name="chat"/> </toolbar> <toolbar name="test_toolbar_bottom" + button_display_mode="icons_with_text" follows="left|right|bottom" height="50" width="500" diff --git a/indra/newview/skins/default/xui/en/main_view.xml b/indra/newview/skins/default/xui/en/main_view.xml index 448f10a93c..6ece01b2ba 100644 --- a/indra/newview/skins/default/xui/en/main_view.xml +++ b/indra/newview/skins/default/xui/en/main_view.xml @@ -16,7 +16,7 @@ orientation="vertical" top="19"> <layout_panel auto_resize="false" - height="60" + height="34" mouse_opaque="false" name="nav_bar_container" tab_stop="false" diff --git a/indra/newview/skins/default/xui/en/menu_hide_navbar.xml b/indra/newview/skins/default/xui/en/menu_hide_navbar.xml index 3f38d734b9..b517fd7957 100644 --- a/indra/newview/skins/default/xui/en/menu_hide_navbar.xml +++ b/indra/newview/skins/default/xui/en/menu_hide_navbar.xml @@ -9,7 +9,7 @@ visible="false" width="128"> <menu_item_check - label="Show Navigation Bar" + label="Show Navigation & Favorites Bar" layout="topleft" name="ShowNavbarNavigationPanel"> <on_click @@ -20,17 +20,6 @@ parameter="ShowNavbarNavigationPanel" /> </menu_item_check> <menu_item_check - label="Show Favorites Bar" - layout="topleft" - name="ShowNavbarFavoritesPanel"> - <on_click - function="ToggleControl" - parameter="ShowNavbarFavoritesPanel" /> - <on_check - function="CheckControl" - parameter="ShowNavbarFavoritesPanel" /> - </menu_item_check> - <menu_item_check label="Show Mini-Location Bar" layout="topleft" name="ShowMiniLocationPanel"> diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 923430d6fd..733b97d827 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -75,10 +75,10 @@ visible="true"> <menu_item_check.on_check function="SidetrayPanelVisible" - parameter="sidepanel_inventory" /> + parameter="my_inventory" /> <menu_item_check.on_click function="ShowSidetrayPanel" - parameter="sidepanel_inventory" /> + parameter="my_inventory" /> </menu_item_check> <menu_item_check label="My Gestures" diff --git a/indra/newview/skins/default/xui/en/panel_navigation_bar.xml b/indra/newview/skins/default/xui/en/panel_navigation_bar.xml index 8a7bd53054..719d3531ed 100644 --- a/indra/newview/skins/default/xui/en/panel_navigation_bar.xml +++ b/indra/newview/skins/default/xui/en/panel_navigation_bar.xml @@ -5,21 +5,21 @@ bg_opaque_color="MouseGray" follows="left|top|right" focus_root="true" - height="60" + height="34" layout="topleft" name="navigation_bar" chrome="true" - width="600"> + width="800"> <icon follows="all" image_name="NavBar_BG" mouse_opaque="false" name="bg_icon" scale_image="true" - visible="true" + visible="false" left="0" top="0" - height="60" + height="34" width="600"/> <icon follows="all" @@ -30,7 +30,7 @@ visible="false" left="0" top="0" - height="60" + height="34" width="600"/> <icon follows="all" @@ -41,145 +41,153 @@ visible="false" left="0" top="0" - height="60" + height="34" width="600"/> - <panel - background_visible="false" - follows="left|top|right" - top="3" - height="23" - layout="topleft" - name="navigation_panel" - width="600"> - <pull_button - follows="left|top" - direction="down" - height="23" - image_overlay="Arrow_Left_Off" - image_bottom_pad="1" - layout="topleft" - left="10" - name="back_btn" - tool_tip="Go back to previous location" - top="2" - width="31" /> - <pull_button - follows="left|top" - direction="down" - height="23" - image_overlay="Arrow_Right_Off" - image_bottom_pad="1" - layout="topleft" - left_pad="0" - name="forward_btn" - tool_tip="Go forward one location" - top_delta="0" - width="31" /> - <button - follows="left|top" - height="23" - image_bottom_pad="1" - image_overlay="Home_Off" - layout="topleft" - left_pad="7" - name="home_btn" - tool_tip="Teleport to my home location" - top_delta="0" - width="32" /> - <location_input - follows="left|right|top" - halign="right" - height="23" - label="Location" - layout="topleft" - left_pad="7" - max_chars="254" - mouse_opaque="false" - name="location_combo" - top_delta="0" - width="266"> - <combo_list - mouse_wheel_opaque="true"/> - <!-- *TODO: Delete. Let the location_input use the correct art sizes. - <location_input.add_landmark_button - height="18" - name="location_combo_add" - width="20" /> - <location_input.info_button - height="18" - name="location_combo_info" - width="20" /> - --> - </location_input> - <!-- <button --> - <!-- follows="right|top" --> - <!-- height="20" --> - <!-- image_disabled="TextField_Search_Off" --> - <!-- image_disabled_selected="TextField_Search_Off" --> - <!-- image_hover_selected="TextField_Search_Off" --> - <!-- image_hover_unselected="TextField_Search_Off" --> - <!-- image_selected="TextField_Search_Off" --> - <!-- image_unselected="TextField_Search_Off" --> - <!-- layout="topleft" --> - <!-- left_pad="5" --> - <!-- mouse_opaque="false" --> - <!-- name="search_bg" --> - <!-- top_delta="0" --> - <!-- width="168" /> --> - <search_combo_box - follows="right|top" - halign="right" - height="23" - label="Search" - layout="topleft" - right="-10" - mouse_opaque="false" - name="search_combo_box" - tool_tip="Search" - top_delta="0" - width="200" > - <combo_editor - label="Search [SECOND_LIFE]" - name="search_combo_editor"/> - <combo_list - draw_border="true" - border.highlight_light_color="FocusColor" - border.highlight_dark_color="FocusColor" - border.shadow_light_color="FocusColor" - border.shadow_dark_color="FocusColor"/> - </search_combo_box> - </panel> - <favorites_bar - follows="left|right|top" - font="SansSerifSmall" - height="15" - layout="topleft" - left="0" - name="favorite" - image_drag_indication="Accordion_ArrowOpened_Off" - bottom="55" - tool_tip="Drag Landmarks here for quick access to your favorite places in Second Life!" - width="590"> - <label - follows="left|top" - height="15" - layout="topleft" - left="10" - name="favorites_bar_label" - text_color="LtGray" - tool_tip="Drag Landmarks here for quick access to your favorite places in Second Life!" - top="12" - width="102"> - Favorites Bar - </label> - <chevron_button name=">>" - image_unselected="TabIcon_Close_Off" - image_selected="TabIcon_Close_Off" - tab_stop="false" - follows="left|bottom" - tool_tip="Show more of My Favorites" - width="15" - top="15" - height="15"/> - </favorites_bar> + <layout_stack + use_border="true" + bevel_style="none" + follows="all" + height="34" + layout="topleft" + left="0" + mouse_opaque="false" + name="nvp_stack" + orientation="horizontal" + top="0" + width="800"> + <layout_panel + follows="top|left" + layout="topleft" + auto_resize="true" + user_resize="true" + min_width="340" + name="navigation_layout_panel" + width="340"> + <panel + background_visible="false" + follows="left|top|right" + top="3" + height="23" + layout="topleft" + left="0" + name="navigation_panel" + width="340"> + <pull_button + follows="left|top" + direction="down" + height="23" + image_overlay="Arrow_Left_Off" + image_bottom_pad="1" + layout="topleft" + left="10" + name="back_btn" + tool_tip="Go back to previous location" + top="2" + width="31" /> + <pull_button + follows="left|top" + direction="down" + height="23" + image_overlay="Arrow_Right_Off" + image_bottom_pad="1" + layout="topleft" + left_pad="0" + name="forward_btn" + tool_tip="Go forward one location" + top_delta="0" + width="31" /> + <button + follows="left|top" + height="23" + image_bottom_pad="1" + image_overlay="Home_Off" + layout="topleft" + left_pad="7" + name="home_btn" + tool_tip="Teleport to my home location" + top_delta="0" + width="32"/> + <location_input + follows="all" + halign="right" + height="23" + label="Location" + layout="topleft" + left_pad="7" + max_chars="254" + mouse_opaque="false" + name="location_combo" + top_delta="0" + width="215"> + <combo_list + mouse_wheel_opaque="true"/> + </location_input> + </panel> + </layout_panel> + + <layout_panel + auto_resize="false" + layout="topleft" + max_width="5" + min_width="5" + name="nav_bar_resize_handle_panel" + user_resize="false" + width="5"> + <icon + follows="top|right" + height="25" + image_name="ChatBarHandle" + layout="topleft" + left="-6" + name="resize_handle" + top="4" + width="5" /> + </layout_panel> + + <layout_panel + follows="top|left" + layout="topleft" + auto_resize="true" + user_resize="true" + min_width="335" + name="favorites_layout_panel" + width="335"> + <favorites_bar + follows="left|right|top" + font="SansSerifSmall" + height="20" + layout="topleft" + left="0" + name="favorite" + image_drag_indication="Accordion_ArrowOpened_Off" + tool_tip="Drag Landmarks here for quick access to your favorite places in Second Life!" + width="331"> + <label + follows="left|top" + height="15" + layout="topleft" + left="10" + name="favorites_bar_label" + text_color="LtGray" + tool_tip="Drag Landmarks here for quick access to your favorite places in Second Life!" + top="12" + width="102"> + Favorites Bar + </label> + <!-- More button actually is a text box. --> + <more_button + follows="left|bottom" + font.name="SansSerifSmall" + font.style="UNDERLINE" + name=">>" + tab_stop="false" + tool_tip="Show more of My Favorites" + top="15" + width="50"> + More... + </more_button> + </favorites_bar> + </layout_panel> + + </layout_stack> </panel> diff --git a/indra/newview/skins/default/xui/en/sidepanel_inventory.xml b/indra/newview/skins/default/xui/en/sidepanel_inventory.xml index 7a176ff367..2b5e3143a4 100644 --- a/indra/newview/skins/default/xui/en/sidepanel_inventory.xml +++ b/indra/newview/skins/default/xui/en/sidepanel_inventory.xml @@ -67,6 +67,8 @@ top="0" orientation="vertical" name="inbox_outbox_layout_stack" + open_time_constant="0.02" + close_time_constant="0.02" height="235" width="330"> <layout_panel |