From de1ece909c0125d0bd7aece788deeb0764bb070e Mon Sep 17 00:00:00 2001
From: Aleric Inglewood
Date: Fri, 22 Oct 2010 00:33:41 +0200
Subject: LindenUserDir fixes, part 2.

After the previous commit, the menu text - after logging in - had
disappeared. This fixes that.
---
 linden/indra/newview/llstartup.cpp      |  4 +--
 linden/indra/newview/llviewerwindow.cpp | 55 +++++++++++++++------------------
 linden/indra/newview/llviewerwindow.h   |  2 +-
 3 files changed, 28 insertions(+), 33 deletions(-)

diff --git a/linden/indra/newview/llstartup.cpp b/linden/indra/newview/llstartup.cpp
index fad3df2..4683df1 100644
--- a/linden/indra/newview/llstartup.cpp
+++ b/linden/indra/newview/llstartup.cpp
@@ -839,7 +839,7 @@ bool idle_startup()
 			LLToolMgr::getInstance()->initTools();
 
 			// Quickly get something onscreen to look at.
-			gViewerWindow->pre_initWorldUI();
+			gViewerWindow->initWorldUI();
 		}
 		
 		gViewerWindow->setNormalControlsVisible( FALSE );	
@@ -1825,7 +1825,7 @@ bool idle_startup()
 		set_startup_status(0.40f, LLTrans::getString("LoginInitializingWorld"), gAgent.mMOTD);
 
 		// Initialize the rest of the world.
-		gViewerWindow->initWorldUI();
+		gViewerWindow->initWorldUI_postLogin();
 
 		gDisconnected=FALSE;
 		display_startup();
diff --git a/linden/indra/newview/llviewerwindow.cpp b/linden/indra/newview/llviewerwindow.cpp
index 07fef53..2af6fe3 100644
--- a/linden/indra/newview/llviewerwindow.cpp
+++ b/linden/indra/newview/llviewerwindow.cpp
@@ -1652,7 +1652,7 @@ void LLViewerWindow::adjustControlRectanglesForFirstUse(const LLRect& window)
 	adjust_rect_top_center("FloaterCameraRect3", window);
 }
 
-void LLViewerWindow::pre_initWorldUI()
+void LLViewerWindow::initWorldUI()
 {
 	pre_init_menus();
 
@@ -1681,16 +1681,13 @@ void LLViewerWindow::pre_initWorldUI()
 		init_menus();
 	}
 
+	// Toolbox floater
 	if (!gFloaterTools)
 	{
 		gFloaterTools = new LLFloaterTools();
 		gFloaterTools->setVisible(FALSE);
 	}
 
-	// menu holder appears on top to get first pass at all mouse events
-
-	mRootView->sendChildToFront(gMenuHolder);
-
 	if ( gHUDView == NULL )
 	{
 		LLRect hud_rect = full_window;
@@ -1705,12 +1702,34 @@ void LLViewerWindow::pre_initWorldUI()
 	}
 }
 
-void LLViewerWindow::initWorldUI()
+// initWorldUI that wasn't before logging in. Some of this may require the access the 'LindenUserDir'.
+void LLViewerWindow::initWorldUI_postLogin()
 {
 	S32 height = mRootView->getRect().getHeight();
 	S32 width = mRootView->getRect().getWidth();
 	LLRect full_window(0, height, width, 0);
 
+	// The status base must be created before calling sendChildToFront below,
+	// or the text of the menu (after logging in) won't be visible.
+	if (!gStatusBar)
+	{
+		// Status bar
+		S32 menu_bar_height = gMenuBarView->getRect().getHeight();
+		LLRect root_rect = mRootView->getRect();
+		LLRect status_rect(0, root_rect.getHeight(), root_rect.getWidth(), root_rect.getHeight() - menu_bar_height);
+		gStatusBar = new LLStatusBar(std::string("status"), status_rect);
+		gStatusBar->setFollows(FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_TOP);
+	
+		gStatusBar->reshape(root_rect.getWidth(), gStatusBar->getRect().getHeight(), TRUE);
+		gStatusBar->translate(0, root_rect.getHeight() - gStatusBar->getRect().getHeight());
+		// sync bg color with menu bar
+		gStatusBar->setBackgroundColor( gMenuBarView->getBackgroundColor() );
+		mRootView->addChild(gStatusBar);
+	}
+
+	// Menu holder appears on top to get first pass at all mouse events
+	mRootView->sendChildToFront(gMenuHolder);
+
 	if ( gSavedPerAccountSettings.getBOOL("LogShowHistory") )
 	{
 		LLFloaterChat::getInstance(LLSD())->loadHistory();
@@ -1726,8 +1745,6 @@ void LLViewerWindow::initWorldUI()
 	mRootView->addChild(gMorphView);
 	gMorphView->setVisible(FALSE);
 
-	// *Note: this is where gFloaterMute used to be initialized.
-
 	LLWorldMapView::initClass();
 
 	adjust_rect_centered_partial_zoom("FloaterWorldMapRect2", full_window);
@@ -1745,28 +1762,6 @@ void LLViewerWindow::initWorldUI()
 		gFloaterTeleportHistory->setVisible(FALSE);
 	}
 
-	//
-	// Tools for building
-	//
-
-	// Toolbox floater
-
-	if (!gStatusBar)
-	{
-		// Status bar
-		S32 menu_bar_height = gMenuBarView->getRect().getHeight();
-		LLRect root_rect = mRootView->getRect();
-		LLRect status_rect(0, root_rect.getHeight(), root_rect.getWidth(), root_rect.getHeight() - menu_bar_height);
-		gStatusBar = new LLStatusBar(std::string("status"), status_rect);
-		gStatusBar->setFollows(FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_TOP);
-	
-		gStatusBar->reshape(root_rect.getWidth(), gStatusBar->getRect().getHeight(), TRUE);
-		gStatusBar->translate(0, root_rect.getHeight() - gStatusBar->getRect().getHeight());
-		// sync bg color with menu bar
-		gStatusBar->setBackgroundColor( gMenuBarView->getBackgroundColor() );
-		mRootView->addChild(gStatusBar);
-	}
-
 	LLFloaterChatterBox::createInstance(LLSD());
 }
 
diff --git a/linden/indra/newview/llviewerwindow.h b/linden/indra/newview/llviewerwindow.h
index ee8f3fe..d26d820 100644
--- a/linden/indra/newview/llviewerwindow.h
+++ b/linden/indra/newview/llviewerwindow.h
@@ -143,8 +143,8 @@ public:
 	void			initBase();
 	void			adjustRectanglesForFirstUse(const LLRect& window);
 	void            adjustControlRectanglesForFirstUse(const LLRect& window);
-	void			pre_initWorldUI();
 	void			initWorldUI();
+	void			initWorldUI_postLogin();
 
 	//
 	// LLWindowCallback interface implementation
-- 
cgit v1.1