diff --git a/indra/newview/llscriptfloater.cpp b/indra/newview/llscriptfloater.cpp
index 2315c4ff4a..007ddc354f 100755
--- a/indra/newview/llscriptfloater.cpp
+++ b/indra/newview/llscriptfloater.cpp
@@ -769,6 +769,44 @@ void LLScriptFloaterManager::setFloaterVisible(const LLUUID& notification_id, bo
}
}
+// script dialogs position
+// Since we can't initialize the member variables in the class itself,
+// we need to do that in the constructor -Zi
+LLScriptFloaterManager::LLScriptFloaterManager()
+: mNavigationPanelPad(-1), // The height of the favorite and navigation panels might not be known yet
+ mFavoritesPanelPad(-1) // so don't fill the values in here yet, but remember to do it at first use
+{
+}
+
+S32 LLScriptFloaterManager::getTopPad()
+{
+ // initialize if needed
+ if(mNavigationPanelPad==-1)
+ {
+ mNavigationPanelPad=LLUI::getRootView()->getChild("location_search_layout")->getRect().getHeight();
+ }
+
+ // initialize if needed
+ if(mFavoritesPanelPad==-1)
+ {
+ mFavoritesPanelPad=LLUI::getRootView()->getChild("favorite")->getRect().getHeight();
+ }
+
+ S32 pad=0;
+ if (gSavedSettings.getBOOL("ShowNavbarNavigationPanel"))
+ {
+ pad=mNavigationPanelPad;
+ }
+
+ if (gSavedSettings.getBOOL("ShowNavbarFavoritesPanel"))
+ {
+ pad+=mFavoritesPanelPad;
+ }
+
+ return pad;
+}
+//
+
//////////////////////////////////////////////////////////////////
bool LLScriptFloater::isScriptTextbox(LLNotificationPtr notification)
@@ -859,16 +897,7 @@ LLScriptFloater* LLScriptFloater::show(const LLUUID& notification_id)
floater->setDocked(false, true);
}
- S32 topPad = 0;
- if (gSavedSettings.getBOOL("ShowNavbarNavigationPanel"))
- {
- topPad += LLUI::getRootView()->getChild("location_search_layout")->getRect().getHeight();
- }
-
- if (gSavedSettings.getBOOL("ShowNavbarFavoritesPanel"))
- {
- topPad += LLUI::getRootView()->getChild("favorite")->getRect().getHeight();
- }
+ S32 topPad=LLScriptFloaterManager::instance().getTopPad();
S32 bottomPad = 0;
if (gToolBarView->getToolbar(LLToolBarView::TOOLBAR_BOTTOM)->hasButtons())
diff --git a/indra/newview/llscriptfloater.h b/indra/newview/llscriptfloater.h
index fcd99235e6..4ea071d910 100755
--- a/indra/newview/llscriptfloater.h
+++ b/indra/newview/llscriptfloater.h
@@ -123,6 +123,18 @@ private:
typedef std::map floater_position_map_t;
floater_position_map_t mFloaterPositions;
+
+// script dialogs position
+private:
+ LLScriptFloaterManager();
+ friend class LLSingleton;
+
+public:
+ S32 mNavigationPanelPad;
+ S32 mFavoritesPanelPad;
+
+ S32 getTopPad();
+//
};
/**