summaryrefslogtreecommitdiff
path: root/indra/newview/llnavigationbar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llnavigationbar.cpp')
-rwxr-xr-xindra/newview/llnavigationbar.cpp36
1 files changed, 33 insertions, 3 deletions
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)));