From 4020b91ec6e8ab4994969ddda37f5ebbd9985367 Mon Sep 17 00:00:00 2001 From: Vadim Savchuk Date: Wed, 1 Sep 2010 21:11:25 +0300 Subject: VWR-21127 WIP Implemented saving position and dimensions of detached sidebar tabs. Reviewed by Sergey Litovchuk. --- indra/llui/llfloater.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index e1203971ea..0c4c857022 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -2664,18 +2664,26 @@ void LLFloater::setInstanceName(const std::string& name) mInstanceName = name; if (!mInstanceName.empty()) { + std::string ctrl_name = mInstanceName; + + // Add the key to the control name if appropriate. + if (mKey.isString() && !mKey.asString().empty()) + { + ctrl_name += "_" + mKey.asString(); + } + // save_rect and save_visibility only apply to registered floaters if (!mRectControl.empty()) { - mRectControl = LLFloaterReg::declareRectControl(mInstanceName); + mRectControl = LLFloaterReg::declareRectControl(ctrl_name); } if (!mVisibilityControl.empty()) { - mVisibilityControl = LLFloaterReg::declareVisibilityControl(mInstanceName); + mVisibilityControl = LLFloaterReg::declareVisibilityControl(ctrl_name); } if(!mDocStateControl.empty()) { - mDocStateControl = LLFloaterReg::declareDockStateControl(mInstanceName); + mDocStateControl = LLFloaterReg::declareDockStateControl(ctrl_name); } } -- cgit v1.2.3 From 785de381de313673fa38e86d9df10599aa22d03b Mon Sep 17 00:00:00 2001 From: Vadim Savchuk Date: Fri, 3 Sep 2010 00:32:26 +0300 Subject: VWR-21127 FIXED Implemented restoring sidebar tabs that were detached in previous session. It is now possible to detach some sidebar tabs, exit the viewer, login again and see those tabs still detached. Also fixed incorrect saving of tabs dimensions implemented in the previous commit (766d6e749836). Reviewed by Sergey Litovchuk --- indra/llui/llfloater.cpp | 38 +++++++++++++++++++++++++++++++------- indra/llui/llfloater.h | 4 ++++ 2 files changed, 35 insertions(+), 7 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 0c4c857022..ff90806271 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -519,6 +519,36 @@ void LLFloater::storeDockStateControl() } } +LLRect LLFloater::getSavedRect() const +{ + LLRect rect; + + if (mRectControl.size() > 1) + { + rect = LLUI::sSettingGroups["floater"]->getRect(mRectControl); + } + + return rect; +} + +bool LLFloater::hasSavedRect() const +{ + return !getSavedRect().isEmpty(); +} + +// static +std::string LLFloater::getControlName(const std::string& name, const LLSD& key) +{ + std::string ctrl_name = name; + + // Add the key to the control name if appropriate. + if (key.isString() && !key.asString().empty()) + { + ctrl_name += "_" + key.asString(); + } + + return ctrl_name; +} void LLFloater::setVisible( BOOL visible ) { @@ -2664,13 +2694,7 @@ void LLFloater::setInstanceName(const std::string& name) mInstanceName = name; if (!mInstanceName.empty()) { - std::string ctrl_name = mInstanceName; - - // Add the key to the control name if appropriate. - if (mKey.isString() && !mKey.asString().empty()) - { - ctrl_name += "_" + mKey.asString(); - } + std::string ctrl_name = getControlName(mInstanceName, mKey); // save_rect and save_visibility only apply to registered floaters if (!mRectControl.empty()) diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 5e482cbac3..ed1f0715af 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -203,6 +203,10 @@ public: BOOL isResizable() const { return mResizable; } void setResizeLimits( S32 min_width, S32 min_height ); void getResizeLimits( S32* min_width, S32* min_height ) { *min_width = mMinWidth; *min_height = mMinHeight; } + LLRect getSavedRect() const; + bool hasSavedRect() const; + + static std::string getControlName(const std::string& name, const LLSD& key); bool isMinimizeable() const{ return mCanMinimize; } bool isCloseable() const{ return mCanClose; } -- cgit v1.2.3 From e04dabd2b3309b595bbc1afa0dfa7d4081439eba Mon Sep 17 00:00:00 2001 From: Andrew Dyukov Date: Mon, 6 Sep 2010 21:35:01 +0300 Subject: VWR-20705 VWR-20706 FIXED Implemented drag'n'drop of buttons in bottomtray. - Though visually user drags buttons, layout panels are really moved. To move one panel before other, new method movePanelBeforeOther() was added to layout stack. - When drag'n'drop is finished, order of panels in layout stack mToolbarStack is changed, and also order vectors are updated in bottomtray.These are vectors mButtonsProcessOrder and mButtonsOrder. mButtonsOrder was introduced in this changeset to store order of all bottomtray buttons that may change place via drag'n'drop and should save and load it between sessions. mButtonsProcessOrder is not enough for it because it contains only buttons that may be hidden(and for example Speak button is not included in it). - To pass mouse events from buttons to bottomtray, new class LLBottomtrayButton was added (and new widget bottomtray_button for it). Reviewed by Vadim Savchuk. --- indra/llui/lllayoutstack.cpp | 16 ++++++++++++++++ indra/llui/lllayoutstack.h | 4 ++++ 2 files changed, 20 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 5cc9add1e2..ab25d1d62b 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -368,6 +368,22 @@ S32 LLLayoutStack::getDefaultWidth(S32 cur_width) return cur_width; } +void LLLayoutStack::movePanel(LLPanel* panel_to_move, LLPanel* target_panel) +{ + LayoutPanel* embedded_panel_to_move = findEmbeddedPanel(panel_to_move); + LayoutPanel* embedded_target_panel = findEmbeddedPanel(target_panel); + + if (!embedded_panel_to_move || !embedded_target_panel || embedded_panel_to_move == embedded_target_panel) + { + llwarns << "One of the panels was not found in stack or NULL was passed instead of valid panel" << llendl; + return; + } + e_panel_list_t::iterator it = std::find(mPanels.begin(), mPanels.end(), embedded_panel_to_move); + mPanels.erase(it); + it = std::find(mPanels.begin(), mPanels.end(), embedded_target_panel); + mPanels.insert(it, embedded_panel_to_move); +} + void LLLayoutStack::addPanel(LLPanel* panel, S32 min_width, S32 min_height, S32 max_width, S32 max_height, BOOL auto_resize, BOOL user_resize, EAnimate animate, S32 index) { // panel starts off invisible (collapsed) diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h index cd59ee3966..b5287db1cf 100644 --- a/indra/llui/lllayoutstack.h +++ b/indra/llui/lllayoutstack.h @@ -72,6 +72,10 @@ public: void removePanel(LLPanel* panel); void collapsePanel(LLPanel* panel, BOOL collapsed = TRUE); S32 getNumPanels() { return mPanels.size(); } + /** + * Moves panel_to_move before target_panel inside layout stack (both panels should already be there). + */ + void movePanel(LLPanel* panel_to_move, LLPanel* target_panel); void updatePanelAutoResize(const std::string& panel_name, BOOL auto_resize); void setPanelUserResize(const std::string& panel_name, BOOL user_resize); -- cgit v1.2.3 From a30bc718bbeb660e92eb3f70c1ec0364903069a8 Mon Sep 17 00:00:00 2001 From: Andrew Dyukov Date: Mon, 6 Sep 2010 22:56:14 +0300 Subject: VWR-22690 FIXED Implemented save/load of bottomtray button order. - Added methods responsible for saving and loading order of buttons to bottomtray. Order is saved after each drag'n'drop to ensure user's customization of bottomtray is not lost because of crash. - Added additional argument to layoutstack movePanel() method which tells it to move panel to the beginning of mPanels vector without requiring a pointer to panel before which it should be inserted. Reviewed by Vadim Savchuk. --- indra/llui/lllayoutstack.cpp | 6 +++--- indra/llui/lllayoutstack.h | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index ab25d1d62b..0ff7557ead 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -368,10 +368,10 @@ S32 LLLayoutStack::getDefaultWidth(S32 cur_width) return cur_width; } -void LLLayoutStack::movePanel(LLPanel* panel_to_move, LLPanel* target_panel) +void LLLayoutStack::movePanel(LLPanel* panel_to_move, LLPanel* target_panel, bool move_to_front) { LayoutPanel* embedded_panel_to_move = findEmbeddedPanel(panel_to_move); - LayoutPanel* embedded_target_panel = findEmbeddedPanel(target_panel); + LayoutPanel* embedded_target_panel = move_to_front ? *mPanels.begin() : findEmbeddedPanel(target_panel); if (!embedded_panel_to_move || !embedded_target_panel || embedded_panel_to_move == embedded_target_panel) { @@ -380,7 +380,7 @@ void LLLayoutStack::movePanel(LLPanel* panel_to_move, LLPanel* target_panel) } e_panel_list_t::iterator it = std::find(mPanels.begin(), mPanels.end(), embedded_panel_to_move); mPanels.erase(it); - it = std::find(mPanels.begin(), mPanels.end(), embedded_target_panel); + it = move_to_front ? mPanels.begin() : std::find(mPanels.begin(), mPanels.end(), embedded_target_panel); mPanels.insert(it, embedded_panel_to_move); } diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h index b5287db1cf..6fcc8e2ac3 100644 --- a/indra/llui/lllayoutstack.h +++ b/indra/llui/lllayoutstack.h @@ -74,8 +74,9 @@ public: S32 getNumPanels() { return mPanels.size(); } /** * Moves panel_to_move before target_panel inside layout stack (both panels should already be there). + * If move_to_front is true target_panel is ignored and panel_to_move is moved to the beginning of mPanels */ - void movePanel(LLPanel* panel_to_move, LLPanel* target_panel); + void movePanel(LLPanel* panel_to_move, LLPanel* target_panel, bool move_to_front = false); void updatePanelAutoResize(const std::string& panel_name, BOOL auto_resize); void setPanelUserResize(const std::string& panel_name, BOOL user_resize); -- cgit v1.2.3 From 31c6ad3d609aaf28a9e2d3ca6536e0fd215d823a Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Thu, 9 Sep 2010 12:28:43 +0100 Subject: CID-508 Checker: UNINIT_CTOR Function: LLFloaterView::LLFloaterView(const LLFloaterView::Params &) File: /indra/llui/llfloater.cpp --- indra/llui/llfloater.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index ff90806271..8d24150e1e 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -1984,6 +1984,7 @@ LLFloaterView::LLFloaterView (const Params& p) : LLUICtrl (p), mFocusCycleMode(FALSE), + mMinimizePositionVOffset(0), mSnapOffsetBottom(0), mSnapOffsetRight(0) { -- cgit v1.2.3 From baeded61a7cc281062efdecea2c8a385c619fe74 Mon Sep 17 00:00:00 2001 From: Vadim Savchuk Date: Mon, 13 Sep 2010 20:06:48 +0300 Subject: STORM-101 FIXED Moved floater settings (rect, visibility, docked state) to account-specific XML file. The settings are now stored to settings_per_account.xml. This change affects all floaters having save_rect/save_visibility/save_dock_state params set to "true", not just detached sidebar tabs as the ticket requests. --- indra/llui/llbutton.cpp | 4 ++-- indra/llui/llfloater.cpp | 19 +++++++++++++------ indra/llui/llfloater.h | 3 ++- indra/llui/llfloaterreg.cpp | 16 ++++++++-------- 4 files changed, 25 insertions(+), 17 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index f0f34ebd4f..d51276bf26 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -1117,7 +1117,7 @@ void LLButton::setFloaterToggle(LLUICtrl* ctrl, const LLSD& sdname) // Get the visibility control name for the floater std::string vis_control_name = LLFloaterReg::declareVisibilityControl(sdname.asString()); // Set the button control value (toggle state) to the floater visibility control (Sets the value as well) - button->setControlVariable(LLUI::sSettingGroups["floater"]->getControl(vis_control_name)); + button->setControlVariable(LLFloater::getControlGroup()->getControl(vis_control_name)); // Set the clicked callback to toggle the floater button->setClickedCallback(boost::bind(&LLFloaterReg::toggleFloaterInstance, sdname)); } @@ -1131,7 +1131,7 @@ void LLButton::setDockableFloaterToggle(LLUICtrl* ctrl, const LLSD& sdname) // Get the visibility control name for the floater std::string vis_control_name = LLFloaterReg::declareVisibilityControl(sdname.asString()); // Set the button control value (toggle state) to the floater visibility control (Sets the value as well) - button->setControlVariable(LLUI::sSettingGroups["floater"]->getControl(vis_control_name)); + button->setControlVariable(LLFloater::getControlGroup()->getControl(vis_control_name)); // Set the clicked callback to toggle the floater button->setClickedCallback(boost::bind(&LLDockableFloater::toggleInstance, sdname)); } diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 8d24150e1e..c0942cf3c7 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -499,7 +499,7 @@ void LLFloater::storeRectControl() { if( mRectControl.size() > 1 ) { - LLUI::sSettingGroups["floater"]->setRect( mRectControl, getRect() ); + getControlGroup()->setRect( mRectControl, getRect() ); } } @@ -507,7 +507,7 @@ void LLFloater::storeVisibilityControl() { if( !sQuitting && mVisibilityControl.size() > 1 ) { - LLUI::sSettingGroups["floater"]->setBOOL( mVisibilityControl, getVisible() ); + getControlGroup()->setBOOL( mVisibilityControl, getVisible() ); } } @@ -515,7 +515,7 @@ void LLFloater::storeDockStateControl() { if( !sQuitting && mDocStateControl.size() > 1 ) { - LLUI::sSettingGroups["floater"]->setBOOL( mDocStateControl, isDocked() ); + getControlGroup()->setBOOL( mDocStateControl, isDocked() ); } } @@ -525,7 +525,7 @@ LLRect LLFloater::getSavedRect() const if (mRectControl.size() > 1) { - rect = LLUI::sSettingGroups["floater"]->getRect(mRectControl); + rect = getControlGroup()->getRect(mRectControl); } return rect; @@ -550,6 +550,13 @@ std::string LLFloater::getControlName(const std::string& name, const LLSD& key) return ctrl_name; } +// static +LLControlGroup* LLFloater::getControlGroup() +{ + // Floater size, position, visibility, etc are saved in per-account settings. + return LLUI::sSettingGroups["account"]; +} + void LLFloater::setVisible( BOOL visible ) { LLPanel::setVisible(visible); // calls handleVisibilityChange() @@ -805,7 +812,7 @@ void LLFloater::applyRectControl() // override center if we have saved rect control if (mRectControl.size() > 1) { - const LLRect& rect = LLUI::sSettingGroups["floater"]->getRect(mRectControl); + const LLRect& rect = getControlGroup()->getRect(mRectControl); if (rect.getWidth() > 0 && rect.getHeight() > 0) { translate( rect.mLeft - getRect().mLeft, rect.mBottom - getRect().mBottom); @@ -821,7 +828,7 @@ void LLFloater::applyDockState() { if (mDocStateControl.size() > 1) { - bool dockState = LLUI::sSettingGroups["floater"]->getBOOL(mDocStateControl); + bool dockState = getControlGroup()->getBOOL(mDocStateControl); setDocked(dockState); } diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index ed1f0715af..5ecf515cf9 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -206,7 +206,8 @@ public: LLRect getSavedRect() const; bool hasSavedRect() const; - static std::string getControlName(const std::string& name, const LLSD& key); + static std::string getControlName(const std::string& name, const LLSD& key); + static LLControlGroup* getControlGroup(); bool isMinimizeable() const{ return mCanMinimize; } bool isCloseable() const{ return mCanClose; } diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp index ccffe98c96..4720ebb822 100644 --- a/indra/llui/llfloaterreg.cpp +++ b/indra/llui/llfloaterreg.cpp @@ -284,9 +284,9 @@ void LLFloaterReg::showInitialVisibleInstances() { const std::string& name = iter->first; std::string controlname = getVisibilityControlName(name); - if (LLUI::sSettingGroups["floater"]->controlExists(controlname)) + if (LLFloater::getControlGroup()->controlExists(controlname)) { - BOOL isvis = LLUI::sSettingGroups["floater"]->getBOOL(controlname); + BOOL isvis = LLFloater::getControlGroup()->getBOOL(controlname); if (isvis) { showInstance(name, LLSD()); // keyed floaters shouldn't set save_vis to true @@ -340,7 +340,7 @@ std::string LLFloaterReg::getRectControlName(const std::string& name) std::string LLFloaterReg::declareRectControl(const std::string& name) { std::string controlname = getRectControlName(name); - LLUI::sSettingGroups["floater"]->declareRect(controlname, LLRect(), + LLFloater::getControlGroup()->declareRect(controlname, LLRect(), llformat("Window Position and Size for %s", name.c_str()), TRUE); return controlname; @@ -358,7 +358,7 @@ std::string LLFloaterReg::getVisibilityControlName(const std::string& name) std::string LLFloaterReg::declareVisibilityControl(const std::string& name) { std::string controlname = getVisibilityControlName(name); - LLUI::sSettingGroups["floater"]->declareBOOL(controlname, FALSE, + LLFloater::getControlGroup()->declareBOOL(controlname, FALSE, llformat("Window Visibility for %s", name.c_str()), TRUE); return controlname; @@ -368,7 +368,7 @@ std::string LLFloaterReg::declareVisibilityControl(const std::string& name) std::string LLFloaterReg::declareDockStateControl(const std::string& name) { std::string controlname = getDockStateControlName(name); - LLUI::sSettingGroups["floater"]->declareBOOL(controlname, TRUE, + LLFloater::getControlGroup()->declareBOOL(controlname, TRUE, llformat("Window Docking state for %s", name.c_str()), TRUE); return controlname; @@ -391,11 +391,11 @@ void LLFloaterReg::registerControlVariables() for (build_map_t::iterator iter = sBuildMap.begin(); iter != sBuildMap.end(); ++iter) { const std::string& name = iter->first; - if (LLUI::sSettingGroups["floater"]->controlExists(getRectControlName(name))) + if (LLFloater::getControlGroup()->controlExists(getRectControlName(name))) { declareRectControl(name); } - if (LLUI::sSettingGroups["floater"]->controlExists(getVisibilityControlName(name))) + if (LLFloater::getControlGroup()->controlExists(getVisibilityControlName(name))) { declareVisibilityControl(name); } @@ -419,7 +419,7 @@ void LLFloaterReg::initUICtrlToFloaterVisibilityControl(LLUICtrl* ctrl, const LL // Get the visibility control name for the floater std::string vis_control_name = LLFloaterReg::declareVisibilityControl(sdname.asString()); // Set the control value to the floater visibility control (Sets the value as well) - ctrl->setControlVariable(LLUI::sSettingGroups["floater"]->getControl(vis_control_name)); + ctrl->setControlVariable(LLFloater::getControlGroup()->getControl(vis_control_name)); } // callback args may use "floatername.key" format -- cgit v1.2.3