diff options
-rw-r--r-- | indra/newview/llnavigationbar.cpp | 11 | ||||
-rw-r--r-- | indra/newview/llnavigationbar.h | 5 | ||||
-rw-r--r-- | indra/newview/llviewercontrol.cpp | 25 | ||||
-rw-r--r-- | indra/newview/llviewercontrol.h | 3 | ||||
-rw-r--r-- | indra/newview/llviewerwindow.cpp | 12 |
5 files changed, 44 insertions, 12 deletions
diff --git a/indra/newview/llnavigationbar.cpp b/indra/newview/llnavigationbar.cpp index c32ef2f22b..9a05812847 100644 --- a/indra/newview/llnavigationbar.cpp +++ b/indra/newview/llnavigationbar.cpp @@ -164,8 +164,6 @@ TODO: - Load navbar height from saved settings (as it's done for status bar) or think of a better way. */ -S32 NAVIGATION_BAR_HEIGHT = 60; // *HACK, used in llviewerwindow.cpp - LLNavigationBar::LLNavigationBar() : mTeleportHistoryMenu(NULL), mBtnBack(NULL), @@ -545,6 +543,15 @@ void LLNavigationBar::clearHistoryCache() mPurgeTPHistoryItems= true; } +int LLNavigationBar::getDefNavBarHeight() +{ + return mDefaultNbRect.getHeight(); +} +int LLNavigationBar::getDefFavBarHeight() +{ + return mDefaultFpRect.getHeight(); +} + void LLNavigationBar::showNavigationPanel(BOOL visible) { bool fpVisible = gSavedSettings.getBOOL("ShowNavbarFavoritesPanel"); diff --git a/indra/newview/llnavigationbar.h b/indra/newview/llnavigationbar.h index f1a1b85a86..8b625e7fa6 100644 --- a/indra/newview/llnavigationbar.h +++ b/indra/newview/llnavigationbar.h @@ -35,8 +35,6 @@ #include "llpanel.h" -extern S32 NAVIGATION_BAR_HEIGHT; - class LLButton; class LLLocationInputCtrl; class LLMenuGL; @@ -63,6 +61,9 @@ public: void showNavigationPanel(BOOL visible); void showFavoritesPanel(BOOL visible); + + int getDefNavBarHeight(); + int getDefFavBarHeight(); private: diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index b71291f834..35226a1632 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -511,13 +511,34 @@ bool toggle_show_snapshot_button(const LLSD& newvalue) bool toggle_show_navigation_panel(const LLSD& newvalue) { - LLNavigationBar::getInstance()->showNavigationPanel(newvalue.asBoolean()); + LLRect floater_view_rect = gFloaterView->getRect(); + LLRect notify_view_rect = gNotifyBoxView->getRect(); + LLNavigationBar* navbar = LLNavigationBar::getInstance(); + + //if newvalue contains 0 => navbar should turn invisible, so floater_view_rect should get higher, + //and to do this pm=1, else if navbar becomes visible pm=-1 so floater_view_rect gets lower. + int pm=newvalue.asBoolean()?-1:1; + floater_view_rect.mTop += pm*(navbar->getDefNavBarHeight()-navbar->getDefFavBarHeight()); + notify_view_rect.mTop += pm*(navbar->getDefNavBarHeight()-navbar->getDefFavBarHeight()); + gFloaterView->setRect(floater_view_rect); + floater_view_rect = gFloaterView->getRect(); + navbar->showNavigationPanel(newvalue.asBoolean()); return true; } bool toggle_show_favorites_panel(const LLSD& newvalue) { - LLNavigationBar::getInstance()->showFavoritesPanel(newvalue.asBoolean()); + LLRect floater_view_rect = gFloaterView->getRect(); + LLRect notify_view_rect = gNotifyBoxView->getRect(); + LLNavigationBar* navbar = LLNavigationBar::getInstance(); + + //if newvalue contains 0 => favbar should turn invisible, so floater_view_rect should get higher, + //and to do this pm=1, else if favbar becomes visible pm=-1 so floater_view_rect gets lower. + int pm=newvalue.asBoolean()?-1:1; + floater_view_rect.mTop += pm*navbar->getDefFavBarHeight(); + notify_view_rect.mTop += pm*navbar->getDefFavBarHeight(); + gFloaterView->setRect(floater_view_rect); + navbar->showFavoritesPanel(newvalue.asBoolean()); return true; } diff --git a/indra/newview/llviewercontrol.h b/indra/newview/llviewercontrol.h index b1f14eca7b..9b4e80cae0 100644 --- a/indra/newview/llviewercontrol.h +++ b/indra/newview/llviewercontrol.h @@ -43,6 +43,9 @@ extern BOOL gHackGodmode; #endif +bool toggle_show_navigation_panel(const LLSD& newvalue); +bool toggle_show_favorites_panel(const LLSD& newvalue); + // These functions found in llcontroldef.cpp *TODO: clean this up! //setting variables are declared in this function void settings_setup_listeners(); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index b0b69fbae6..ba32e07464 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1518,11 +1518,12 @@ void LLViewerWindow::initWorldUI() getRootView()->addChild(gMorphView); // Make space for nav bar. + LLNavigationBar* navbar = LLNavigationBar::getInstance(); LLRect floater_view_rect = gFloaterView->getRect(); LLRect notify_view_rect = gNotifyBoxView->getRect(); - floater_view_rect.mTop -= NAVIGATION_BAR_HEIGHT; + floater_view_rect.mTop -= navbar->getDefNavBarHeight(); floater_view_rect.mBottom += LLBottomTray::getInstance()->getRect().getHeight(); - notify_view_rect.mTop -= NAVIGATION_BAR_HEIGHT; + notify_view_rect.mTop -= navbar->getDefNavBarHeight(); notify_view_rect.mBottom += LLBottomTray::getInstance()->getRect().getHeight(); gFloaterView->setRect(floater_view_rect); gNotifyBoxView->setRect(notify_view_rect); @@ -1549,20 +1550,19 @@ void LLViewerWindow::initWorldUI() gStatusBar->setBackgroundColor( gMenuBarView->getBackgroundColor().get() ); // Navigation bar - - LLNavigationBar* navbar = LLNavigationBar::getInstance(); navbar->reshape(root_rect.getWidth(), navbar->getRect().getHeight(), TRUE); // *TODO: redundant? navbar->translate(0, root_rect.getHeight() - menu_bar_height - navbar->getRect().getHeight()); // FIXME navbar->setBackgroundColor(gMenuBarView->getBackgroundColor().get()); + if (!gSavedSettings.getBOOL("ShowNavbarNavigationPanel")) { - navbar->showNavigationPanel(FALSE); + toggle_show_navigation_panel(LLSD(0)); } if (!gSavedSettings.getBOOL("ShowNavbarFavoritesPanel")) { - navbar->showFavoritesPanel(FALSE); + toggle_show_favorites_panel(LLSD(0)); } if (!gSavedSettings.getBOOL("ShowCameraButton")) |