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