summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Savchuk <vsavchuk@productengine.com>2010-09-13 20:06:48 +0300
committerVadim Savchuk <vsavchuk@productengine.com>2010-09-13 20:06:48 +0300
commitbaeded61a7cc281062efdecea2c8a385c619fe74 (patch)
tree8289df9f8041f22426227456de4daf97fe749cfd
parent1f46b1d87bf4664e62131e7823ab5a7fcafe4b73 (diff)
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.
-rw-r--r--indra/llui/llbutton.cpp4
-rw-r--r--indra/llui/llfloater.cpp19
-rw-r--r--indra/llui/llfloater.h3
-rw-r--r--indra/llui/llfloaterreg.cpp16
-rw-r--r--indra/newview/llbottomtray.cpp2
-rw-r--r--indra/newview/llnearbychat.cpp6
-rw-r--r--indra/newview/llsidetray.cpp4
7 files changed, 31 insertions, 23 deletions
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
diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp
index f3ade83d00..3f41424818 100644
--- a/indra/newview/llbottomtray.cpp
+++ b/indra/newview/llbottomtray.cpp
@@ -1526,7 +1526,7 @@ void LLBottomTray::setButtonsControlsAndListeners()
// set control name for Build button. It is not enough to link it with Button.SetFloaterToggle in xml
std::string vis_control_name = LLFloaterReg::declareVisibilityControl("build");
// Set the button control value (toggle state) to the floater visibility control (Sets the value as well)
- build_btn->setControlVariable(LLUI::sSettingGroups["floater"]->getControl(vis_control_name));
+ build_btn->setControlVariable(LLFloater::getControlGroup()->getControl(vis_control_name));
}
bool LLBottomTray::toggleShowButton(LLBottomTray::EResizeState button_type, const LLSD& new_visibility)
diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp
index 5f71d7100b..28aea7ae3d 100644
--- a/indra/newview/llnearbychat.cpp
+++ b/indra/newview/llnearbychat.cpp
@@ -115,7 +115,7 @@ void LLNearbyChat::applySavedVariables()
{
if (mRectControl.size() > 1)
{
- const LLRect& rect = LLUI::sSettingGroups["floater"]->getRect(mRectControl);
+ const LLRect& rect = LLFloater::getControlGroup()->getRect(mRectControl);
if(!rect.isEmpty() && rect.isValid())
{
reshape(rect.getWidth(), rect.getHeight());
@@ -124,7 +124,7 @@ void LLNearbyChat::applySavedVariables()
}
- if(!LLUI::sSettingGroups["floater"]->controlExists(mDocStateControl))
+ if(!LLFloater::getControlGroup()->controlExists(mDocStateControl))
{
setDocked(true);
}
@@ -132,7 +132,7 @@ void LLNearbyChat::applySavedVariables()
{
if (mDocStateControl.size() > 1)
{
- bool dockState = LLUI::sSettingGroups["floater"]->getBOOL(mDocStateControl);
+ bool dockState = LLFloater::getControlGroup()->getBOOL(mDocStateControl);
setDocked(dockState);
}
}
diff --git a/indra/newview/llsidetray.cpp b/indra/newview/llsidetray.cpp
index 1d32b58948..342b73d9c0 100644
--- a/indra/newview/llsidetray.cpp
+++ b/indra/newview/llsidetray.cpp
@@ -998,9 +998,9 @@ void LLSideTray::detachTabs()
std::string floater_ctrl_name = LLFloater::getControlName("side_bar_tab", LLSD(tab->getName()));
std::string vis_ctrl_name = LLFloaterReg::getVisibilityControlName(floater_ctrl_name);
- if (!LLUI::sSettingGroups["floater"]->controlExists(vis_ctrl_name)) continue;
+ if (!LLFloater::getControlGroup()->controlExists(vis_ctrl_name)) continue;
- bool is_visible = LLUI::sSettingGroups["floater"]->getBOOL(vis_ctrl_name);
+ bool is_visible = LLFloater::getControlGroup()->getBOOL(vis_ctrl_name);
if (!is_visible) continue;
llassert(isTabAttached(tab->getName()));