diff options
Diffstat (limited to 'indra/newview/llsidetray.cpp')
-rw-r--r-- | indra/newview/llsidetray.cpp | 100 |
1 files changed, 74 insertions, 26 deletions
diff --git a/indra/newview/llsidetray.cpp b/indra/newview/llsidetray.cpp index eb537c7d7b..8aaa7f0e13 100644 --- a/indra/newview/llsidetray.cpp +++ b/indra/newview/llsidetray.cpp @@ -629,8 +629,16 @@ LLPanel* LLSideTray::openChildPanel(LLSideTrayTab* tab, const std::string& panel std::string tab_name = tab->getName(); + bool tab_attached = isTabAttached(tab_name); + + if (tab_attached && LLUI::sSettingGroups["config"]->getBOOL("OpenSidePanelsInFloaters")) + { + tab->toggleTabDocked(); + tab_attached = false; + } + // Select tab and expand Side Tray only when a tab is attached. - if (isTabAttached(tab_name)) + if (tab_attached) { selectTabByName(tab_name); if (mCollapsed) @@ -641,14 +649,7 @@ LLPanel* LLSideTray::openChildPanel(LLSideTrayTab* tab, const std::string& panel LLFloater* floater_tab = LLFloaterReg::getInstance("side_bar_tab", tab_name); if (!floater_tab) return NULL; - // Restore the floater if it was minimized. - if (floater_tab->isMinimized()) - { - floater_tab->setMinimized(FALSE); - } - - // Send the floater to the front. - floater_tab->setFrontmost(); + floater_tab->openFloater(panel_name); } LLSideTrayPanelContainer* container = dynamic_cast<LLSideTrayPanelContainer*>(view->getParent()); @@ -979,16 +980,7 @@ void LLSideTray::reflectCollapseChange() { updateSidetrayVisibility(); - if(mCollapsed) - { - gFloaterView->setSnapOffsetRight(0); - setFocus(FALSE); - } - else - { - gFloaterView->setSnapOffsetRight(getRect().getWidth()); - setFocus(TRUE); - } + setFocus(!mCollapsed); gFloaterView->refresh(); } @@ -1161,23 +1153,43 @@ void LLSideTray::reshape(S32 width, S32 height, BOOL called_from_parent) */ LLPanel* LLSideTray::showPanel (const std::string& panel_name, const LLSD& params) { + LLPanel* new_panel = NULL; + // Look up the tab in the list of detached tabs. child_vector_const_iter_t child_it; for ( child_it = mDetachedTabs.begin(); child_it != mDetachedTabs.end(); ++child_it) { - LLPanel* panel = openChildPanel(*child_it, panel_name, params); - if (panel) return panel; - } + new_panel = openChildPanel(*child_it, panel_name, params); + if (new_panel) break; + } // Look up the tab in the list of attached tabs. for ( child_it = mTabs.begin(); child_it != mTabs.end(); ++child_it) - { - LLPanel* panel = openChildPanel(*child_it, panel_name, params); - if (panel) return panel; + { + new_panel = openChildPanel(*child_it, panel_name, params); + if (new_panel) break; + } + + return new_panel; +} + +void LLSideTray::hidePanel(const std::string& panel_name) +{ + LLPanel* panelp = getPanel(panel_name); + if (panelp) + { + if(isTabAttached(panel_name)) + { + collapseSideBar(); + } + else + { + LLFloaterReg::hideInstance("side_bar_tab", panel_name); + } } - return NULL; } + void LLSideTray::togglePanel(LLPanel* &sub_panel, const std::string& panel_name, const LLSD& params) { if(!sub_panel) @@ -1267,6 +1279,42 @@ bool LLSideTray::isPanelActive(const std::string& panel_name) return (panel->getName() == panel_name); } +void LLSideTray::setTabDocked(const std::string& tab_name, bool dock) +{ + LLSideTrayTab* tab = getTab(tab_name); + if (!tab) + { // not a docked tab, look through detached tabs + for(child_vector_iter_t tab_it = mDetachedTabs.begin(), tab_end_it = mDetachedTabs.end(); + tab_it != tab_end_it; + ++tab_it) + { + if ((*tab_it)->getName() == tab_name) + { + tab = *tab_it; + break; + } + } + + } + + if (tab) + { + bool tab_attached = isTabAttached(tab_name); + LLFloater* floater_tab = LLFloaterReg::getInstance("side_bar_tab", tab_name); + if (!floater_tab) return; + + if (dock && !tab_attached) + { + tab->dock(floater_tab); + } + else if (!dock && tab_attached) + { + tab->undock(floater_tab); + } + } +} + + void LLSideTray::updateSidetrayVisibility() { // set visibility of parent container based on collapsed state |