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