MAINT-1537 Size of navigation/favourites bars is not saved after restart of viewer
parent
ef2b007a6b
commit
e5d827bbe9
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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)));
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue