diff options
author | Mnikolenko ProductEngine <mnikolenko@productengine.com> | 2016-02-04 11:49:37 +0200 |
---|---|---|
committer | Mnikolenko ProductEngine <mnikolenko@productengine.com> | 2016-02-04 11:49:37 +0200 |
commit | e5d827bbe9ccca26490f07f69aa467af57e6eeaf (patch) | |
tree | 4402c01cb95a70dc6232556a1626bf3f0204a306 | |
parent | ef2b007a6b5f487a946d9930341591f3f1d0437e (diff) |
MAINT-1537 Size of navigation/favourites bars is not saved after restart of viewer
-rwxr-xr-x | indra/newview/app_settings/settings_per_account.xml | 13 | ||||
-rwxr-xr-x | indra/newview/llnavigationbar.cpp | 36 | ||||
-rwxr-xr-x | indra/newview/llnavigationbar.h | 11 |
3 files changed, 56 insertions, 4 deletions
diff --git a/indra/newview/app_settings/settings_per_account.xml b/indra/newview/app_settings/settings_per_account.xml index c62b45ed81..fd6b1b5b3f 100755 --- a/indra/newview/app_settings/settings_per_account.xml +++ b/indra/newview/app_settings/settings_per_account.xml @@ -98,7 +98,18 @@ <string>Boolean</string> <key>Value</key> <integer>1</integer> - </map> + </map> + <key>NavigationBarRatio</key> + <map> + <key>Comment</key> + <string>The ratio between the width of Navigation layout panel and the width of whole Navigation layout stack</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>0.6</real> + </map> <key>InstantMessageLogPath</key> <map> <key>Comment</key> diff --git a/indra/newview/llnavigationbar.cpp b/indra/newview/llnavigationbar.cpp index 8c4849d28d..84a2cd8be1 100755 --- a/indra/newview/llnavigationbar.cpp +++ b/indra/newview/llnavigationbar.cpp @@ -44,6 +44,7 @@ #include "lllocationinputctrl.h" #include "llpaneltopinfobar.h" #include "llteleporthistory.h" +#include "llresizebar.h" #include "llsearchcombobox.h" #include "llslurl.h" #include "llurlregistry.h" @@ -267,7 +268,10 @@ LLNavigationBar::LLNavigationBar() mBtnForward(NULL), mBtnHome(NULL), mCmbLocation(NULL), - mSaveToLocationHistory(false) + mSaveToLocationHistory(false), + mNavigationPanel(NULL), + mFavoritePanel(NULL), + mNavPanWidth(0) { buildFromFile( "panel_navigation_bar.xml"); @@ -286,7 +290,7 @@ BOOL LLNavigationBar::postBuild() mBtnBack = getChild<LLPullButton>("back_btn"); mBtnForward = getChild<LLPullButton>("forward_btn"); mBtnHome = getChild<LLButton>("home_btn"); - + mCmbLocation= getChild<LLLocationInputCtrl>("location_combo"); mBtnBack->setEnabled(FALSE); @@ -318,6 +322,11 @@ BOOL LLNavigationBar::postBuild() LLHints::registerHintTarget("nav_bar", getHandle()); + mNavigationPanel = getChild<LLLayoutPanel>("navigation_layout_panel"); + mFavoritePanel = getChild<LLLayoutPanel>("favorites_layout_panel"); + mNavigationPanel->getResizeBar()->setResizeListener(boost::bind(&LLNavigationBar::onNavbarResized, this)); + mFavoritePanel->getResizeBar()->setResizeListener(boost::bind(&LLNavigationBar::onNavbarResized, this)); + return TRUE; } @@ -356,7 +365,6 @@ BOOL LLNavigationBar::handleRightMouseDown(S32 x, S32 y, MASK mask) show_navbar_context_menu(this,x,y); handled = true; } - return handled; } @@ -365,6 +373,18 @@ void LLNavigationBar::onBackButtonClicked() LLTeleportHistory::getInstance()->goBack(); } +void LLNavigationBar::onNavbarResized() +{ + S32 new_nav_pan_width = mNavigationPanel->getRect().getWidth(); + if(mNavPanWidth != new_nav_pan_width) + { + S32 new_stack_width = new_nav_pan_width + mFavoritePanel->getRect().getWidth(); + F32 ratio = (F32)new_nav_pan_width / (F32)new_stack_width; + gSavedPerAccountSettings.setF32("NavigationBarRatio", ratio); + mNavPanWidth = new_nav_pan_width; + } +} + void LLNavigationBar::onBackOrForwardButtonHeldDown(LLUICtrl* ctrl, const LLSD& param) { if (param["count"].asInteger() == 0) @@ -667,8 +687,18 @@ void LLNavigationBar::handleLoginComplete() LLTeleportHistory::getInstance()->handleLoginComplete(); LLPanelTopInfoBar::instance().handleLoginComplete(); mCmbLocation->handleLoginComplete(); + resizeLayoutPanel(); } +void LLNavigationBar::resizeLayoutPanel() +{ + LLRect nav_bar_rect = mNavigationPanel->getRect(); + + S32 nav_panel_width = (nav_bar_rect.getWidth() + mFavoritePanel->getRect().getWidth()) * gSavedPerAccountSettings.getF32("NavigationBarRatio"); + + nav_bar_rect.setLeftTopAndSize(nav_bar_rect.mLeft, nav_bar_rect.mTop, nav_panel_width, nav_bar_rect.getHeight()); + mNavigationPanel->handleReshape(nav_bar_rect,true); +} void LLNavigationBar::invokeSearch(std::string search_text) { LLFloaterReg::showInstance("search", LLSD().with("category", "all").with("query", LLSD(search_text))); diff --git a/indra/newview/llnavigationbar.h b/indra/newview/llnavigationbar.h index 7878bab24e..66e52f47e5 100755 --- a/indra/newview/llnavigationbar.h +++ b/indra/newview/llnavigationbar.h @@ -29,6 +29,7 @@ #include "llpanel.h" #include "llbutton.h" +#include "lllayoutstack.h" class LLLocationInputCtrl; class LLMenuGL; @@ -108,6 +109,7 @@ private: void rebuildTeleportHistoryMenu(); void showTeleportHistoryMenu(LLUICtrl* btn_ctrl); void invokeSearch(std::string search_text); + void resizeLayoutPanel(); // callbacks void onTeleportHistoryMenuItemClicked(const LLSD& userdata); void onTeleportHistoryChanged(); @@ -120,6 +122,7 @@ private: void onLocationPrearrange(const LLSD& data); void onTeleportFinished(const LLVector3d& global_agent_pos); void onTeleportFailed(); + void onNavbarResized(); void onRegionNameResponse( std::string typed_location, std::string region_name, @@ -135,6 +138,7 @@ private: } } + S32 mNavPanWidth; LLMenuGL* mTeleportHistoryMenu; LLPullButton* mBtnBack; LLPullButton* mBtnForward; @@ -142,11 +146,18 @@ private: LLLocationInputCtrl* mCmbLocation; LLRect mDefaultNbRect; LLRect mDefaultFpRect; + LLLayoutPanel* mNavigationPanel; + LLLayoutPanel* mFavoritePanel; boost::signals2::connection mTeleportFailedConnection; boost::signals2::connection mTeleportFinishConnection; boost::signals2::connection mHistoryMenuConnection; // if true, save location to location history when teleport finishes bool mSaveToLocationHistory; + boost::signals2::connection resizeSignalUpNavBar; + boost::signals2::connection resizeSignalDownNavBar; + boost::signals2::connection resizeSignalUpFavPan; + boost::signals2::connection resizeSignalDownFavPan; + }; #endif |