summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llfloater.cpp38
-rw-r--r--indra/llui/llfloater.h4
-rw-r--r--indra/llui/lllayoutstack.cpp16
-rw-r--r--indra/llui/lllayoutstack.h5
4 files changed, 60 insertions, 3 deletions
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index e1203971ea..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,18 +2694,20 @@ void LLFloater::setInstanceName(const std::string& name)
mInstanceName = name;
if (!mInstanceName.empty())
{
+ std::string ctrl_name = getControlName(mInstanceName, mKey);
+
// 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);
}
}
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; }
diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp
index 5cc9add1e2..0ff7557ead 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, bool move_to_front)
+{
+ LayoutPanel* embedded_panel_to_move = findEmbeddedPanel(panel_to_move);
+ 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)
+ {
+ 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 = move_to_front ? mPanels.begin() : 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..6fcc8e2ac3 100644
--- a/indra/llui/lllayoutstack.h
+++ b/indra/llui/lllayoutstack.h
@@ -72,6 +72,11 @@ 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).
+ * 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, 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);