diff options
author | Todd Stinson <stinson@lindenlab.com> | 2012-06-19 17:20:24 -0700 |
---|---|---|
committer | Todd Stinson <stinson@lindenlab.com> | 2012-06-19 17:20:24 -0700 |
commit | e4aa2038812c2cf2cfed1b17a437ba620929f84f (patch) | |
tree | 90718ad298e6283c3b8e80e46f7626b73be1e4f1 /indra | |
parent | c1c3b856fbc4e911436e93d76a7c7807afca7ca8 (diff) |
PATH-702: Positioning the rebake navmesh button to align with the Stand/StopFlying buttons. Also, parenting the buttons to the toolbar UI elements.
Diffstat (limited to 'indra')
-rwxr-xr-x | indra/newview/llagent.cpp | 3 | ||||
-rw-r--r-- | indra/newview/llmoveview.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llpanelnavmeshrebake.cpp | 98 | ||||
-rw-r--r-- | indra/newview/llpanelnavmeshrebake.h | 39 | ||||
-rw-r--r-- | indra/newview/llpathfindingmanager.cpp | 14 | ||||
-rw-r--r-- | indra/newview/llviewerdisplay.cpp | 3 | ||||
-rw-r--r-- | indra/newview/llviewerwindow.cpp | 8 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_navmesh_rebake.xml | 6 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_toolbar_view.xml | 2 |
9 files changed, 102 insertions, 73 deletions
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index d94e01ee47..14772b11d6 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -56,6 +56,7 @@ #include "llnavigationbar.h" // to show/hide navigation bar when changing mouse look state #include "llnearbychatbar.h" #include "llnotificationsutil.h" +#include "llpanelnavmeshrebake.h" #include "llpaneltopinfobar.h" #include "llparcel.h" #include "llrendersphere.h" @@ -1870,6 +1871,7 @@ void LLAgent::endAnimationUpdateUI() LLChicletBar::getInstance()->setVisible(TRUE); LLPanelStandStopFlying::getInstance()->setVisible(TRUE); + LLPanelNavMeshRebake::getInstance()->setVisible(TRUE); LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); @@ -1979,6 +1981,7 @@ void LLAgent::endAnimationUpdateUI() LLChicletBar::getInstance()->setVisible(FALSE); LLPanelStandStopFlying::getInstance()->setVisible(FALSE); + LLPanelNavMeshRebake::getInstance()->setVisible(FALSE); // clear out camera lag effect gAgentCamera.clearCameraLag(); diff --git a/indra/newview/llmoveview.cpp b/indra/newview/llmoveview.cpp index c3d8b91d67..65c73bb0ec 100644 --- a/indra/newview/llmoveview.cpp +++ b/indra/newview/llmoveview.cpp @@ -710,7 +710,7 @@ void LLPanelStandStopFlying::updatePosition() left_tb_width = toolbar_left->getRect().getWidth(); } - if(LLPanel* panel_ssf_container = getRootView()->getChild<LLPanel>("stand_stop_flying_container")) + if(LLPanel* panel_ssf_container = getRootView()->getChild<LLPanel>("state_management_buttons_container")) { panel_ssf_container->setOrigin(0, y_pos); } diff --git a/indra/newview/llpanelnavmeshrebake.cpp b/indra/newview/llpanelnavmeshrebake.cpp index 993ade89c9..e1c1548de1 100644 --- a/indra/newview/llpanelnavmeshrebake.cpp +++ b/indra/newview/llpanelnavmeshrebake.cpp @@ -26,27 +26,21 @@ */ #include "llviewerprecompiledheaders.h" -#include "llpathfindingmanager.h" -#include <string> -#include <map> -#include <boost/function.hpp> -#include <boost/signals2.hpp> + #include "llpanelnavmeshrebake.h" -#include "llagent.h" -#include "llhints.h" -#include "lltooltip.h" + +#include <boost/bind.hpp> + #include "llbutton.h" +#include "llhandle.h" +#include "llhints.h" #include "llpanel.h" - -LLPanelNavMeshRebake::LLPanelNavMeshRebake() -: mNavMeshRebakeButton( NULL ) -, mNavMeshBakingButton( NULL ) -{ - // make sure we have the only instance of this class - static bool b = true; - llassert_always(b); - b=false; -} +#include "llpathfindingmanager.h" +#include "lltoolbar.h" +#include "lltoolbarview.h" +#include "lltoolmgr.h" +#include "lltooltip.h" +#include "llview.h" LLPanelNavMeshRebake* LLPanelNavMeshRebake::getInstance() { @@ -54,24 +48,33 @@ LLPanelNavMeshRebake* LLPanelNavMeshRebake::getInstance() return panel; } +void LLPanelNavMeshRebake::setMode(ERebakeNavMeshMode pRebakeNavMeshMode) +{ + mNavMeshRebakeButton->setVisible(pRebakeNavMeshMode == kRebakeNavMesh_Available); + mNavMeshBakingButton->setVisible(pRebakeNavMeshMode == kRebakeNavMesh_RequestSent); + setVisible(pRebakeNavMeshMode != kRebakeNavMesh_NotAvailable); +} + BOOL LLPanelNavMeshRebake::postBuild() { //Rebake initiated mNavMeshRebakeButton = getChild<LLButton>("navmesh_btn"); mNavMeshRebakeButton->setCommitCallback(boost::bind(&LLPanelNavMeshRebake::onNavMeshRebakeClick, this)); - mNavMeshRebakeButton->setVisible( TRUE ); LLHints::registerHintTarget("navmesh_btn", mNavMeshRebakeButton->getHandle()); //Baking... mNavMeshBakingButton = getChild<LLButton>("navmesh_btn_baking"); - mNavMeshBakingButton->setVisible( FALSE ); LLHints::registerHintTarget("navmesh_btn_baking", mNavMeshBakingButton->getHandle()); - return TRUE; + + setMode(kRebakeNavMesh_Default); + + return LLPanel::postBuild(); } -void LLPanelNavMeshRebake::setVisible( BOOL visible ) +void LLPanelNavMeshRebake::draw() { - LLPanel::setVisible(visible); + updatePosition(); + LLPanel::draw(); } BOOL LLPanelNavMeshRebake::handleToolTip( S32 x, S32 y, MASK mask ) @@ -82,17 +85,22 @@ BOOL LLPanelNavMeshRebake::handleToolTip( S32 x, S32 y, MASK mask ) { LLToolTipMgr::instance().show(mNavMeshRebakeButton->getToolTip()); } + return LLPanel::handleToolTip(x, y, mask); } -void LLPanelNavMeshRebake::reparent( LLView* rootp ) +LLPanelNavMeshRebake::LLPanelNavMeshRebake() + : mNavMeshRebakeButton( NULL ), + mNavMeshBakingButton( NULL ) +{ + // make sure we have the only instance of this class + static bool b = true; + llassert_always(b); + b=false; +} + +LLPanelNavMeshRebake::~LLPanelNavMeshRebake() { - LLPanel* parent = dynamic_cast<LLPanel*>( getParent() ); - if (!parent) - { - return; - } - rootp->addChild(this); } LLPanelNavMeshRebake* LLPanelNavMeshRebake::getPanel() @@ -105,15 +113,37 @@ LLPanelNavMeshRebake* LLPanelNavMeshRebake::getPanel() void LLPanelNavMeshRebake::onNavMeshRebakeClick() { +#if 0 mNavMeshRebakeButton->setVisible( FALSE ); mNavMeshBakingButton->setVisible( TRUE ); mNavMeshBakingButton->setForcePressedState( TRUE ); +#endif LLPathfindingManager::getInstance()->triggerNavMeshRebuild(); } -void LLPanelNavMeshRebake::resetButtonStates() +void LLPanelNavMeshRebake::updatePosition() { - mNavMeshRebakeButton->setVisible( TRUE ); - mNavMeshBakingButton->setVisible( FALSE ); -} + S32 y_pos = 0; + S32 bottom_tb_center = 0; + if (LLToolBar* toolbar_bottom = gToolBarView->getChild<LLToolBar>("toolbar_bottom")) + { + y_pos = toolbar_bottom->getRect().getHeight(); + bottom_tb_center = toolbar_bottom->getRect().getCenterX(); + } + + S32 left_tb_width = 0; + if (LLToolBar* toolbar_left = gToolBarView->getChild<LLToolBar>("toolbar_left")) + { + left_tb_width = toolbar_left->getRect().getWidth(); + } + + if(LLPanel* panel_ssf_container = getRootView()->getChild<LLPanel>("state_management_buttons_container")) + { + panel_ssf_container->setOrigin(0, y_pos); + } + + S32 x_pos = bottom_tb_center-getRect().getWidth()/2 - left_tb_width + 113 /*width of stand/fly button */ + 10; + + setOrigin( x_pos, 0); +} diff --git a/indra/newview/llpanelnavmeshrebake.h b/indra/newview/llpanelnavmeshrebake.h index 468081313e..0a3f3bea93 100644 --- a/indra/newview/llpanelnavmeshrebake.h +++ b/indra/newview/llpanelnavmeshrebake.h @@ -28,6 +28,11 @@ #ifndef LL_NAVMESHREBAKE_H #define LL_NAVMESHREBAKE_H +#include "llhandle.h" +#include "llpanel.h" + +class LLButton; +class LLView; class LLPanelNavMeshRebake : public LLPanel { @@ -36,38 +41,36 @@ class LLPanelNavMeshRebake : public LLPanel public: - typedef enum navmesh_rebake_mode_t + typedef enum { - NMRM_Visible, - NMRM_Visible_Waiting_Response, - NVRM_Hiddeb - } ESNavMeshRebakeMode; + kRebakeNavMesh_Available, + kRebakeNavMesh_RequestSent, + kRebakeNavMesh_NotAvailable, + kRebakeNavMesh_Default = kRebakeNavMesh_NotAvailable + } ERebakeNavMeshMode; - void reparent( LLView* rootp ); - void resetButtonStates(); static LLPanelNavMeshRebake* getInstance(); - - /*virtual*/ BOOL postBuild(); - /*virtual*/ void setVisible( BOOL visible ); + void setMode(ERebakeNavMeshMode pRebakeNavMeshMode); - /*virtual*/ void draw(){ LLPanel::draw(); } - /*virtual*/ BOOL handleToolTip( S32 x, S32 y, MASK mask ); + virtual BOOL postBuild(); + + virtual void draw(); + virtual BOOL handleToolTip( S32 x, S32 y, MASK mask ); protected: +private: LLPanelNavMeshRebake(); + virtual ~LLPanelNavMeshRebake(); -private: static LLPanelNavMeshRebake* getPanel(); + void onNavMeshRebakeClick(); + void updatePosition(); LLButton* mNavMeshRebakeButton; - LLButton* mNavMeshBakingButton; - - LLHandle<LLPanel> mOriginalParent; - + LLButton* mNavMeshBakingButton; }; #endif //LL_NAVMESHREBAKE_H - diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp index d1a249edc5..d4c689e30d 100644 --- a/indra/newview/llpathfindingmanager.cpp +++ b/indra/newview/llpathfindingmanager.cpp @@ -770,22 +770,12 @@ void LLPathfindingManager::handleNavMeshStatus(LLPathfindingNavMesh::ENavMeshReq void LLPathfindingManager::displayNavMeshRebakePanel() { - if ( LLStartUp::getStartupState() == STATE_STARTED && gAgent.getTeleportState() == LLAgent::TELEPORT_NONE ) - { - LLView* rootp = LLUI::getRootView(); - LLPanel* panel_nmr_container = rootp->getChild<LLPanel>("navmesh_rebake_container"); - LLPanelNavMeshRebake* panel_namesh_rebake = LLPanelNavMeshRebake::getInstance(); - panel_nmr_container->addChild( panel_namesh_rebake ); - panel_nmr_container->setVisible( TRUE ); - panel_namesh_rebake->reparent( rootp ); - LLPanelNavMeshRebake::getInstance()->setVisible( TRUE ); - LLPanelNavMeshRebake::getInstance()->resetButtonStates(); - } + LLPanelNavMeshRebake::getInstance()->setMode(LLPanelNavMeshRebake::kRebakeNavMesh_Available); } void LLPathfindingManager::hideNavMeshRebakePanel() { - LLPanelNavMeshRebake::getInstance()->setVisible( FALSE ); + LLPanelNavMeshRebake::getInstance()->setMode(LLPanelNavMeshRebake::kRebakeNavMesh_NotAvailable); } void LLPathfindingManager::handleNavMeshRebakeError(U32 pStatus, const std::string &pReason, const std::string &pURL) diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 7249f72c64..a3661fd15d 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -393,14 +393,12 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) gAgent.setTeleportState( LLAgent::TELEPORT_REQUESTED ); gAgent.setTeleportMessage( LLAgent::sTeleportProgressMessages["requesting"]); - if ( LLPathfindingManager::getInstance() ) { LLPathfindingManager::getInstance()->hideNavMeshRebakePanel(); } break; case LLAgent::TELEPORT_REQUESTED: // Waiting for source simulator to respond gViewerWindow->setProgressPercent( llmin(teleport_percent, 37.5f) ); gViewerWindow->setProgressString(message); - if ( LLPathfindingManager::getInstance() ) { LLPathfindingManager::getInstance()->hideNavMeshRebakePanel(); } break; case LLAgent::TELEPORT_MOVING: @@ -454,7 +452,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) // No teleport in progress gViewerWindow->setShowProgress(FALSE); gTeleportDisplay = FALSE; - if ( LLPathfindingManager::getInstance() ) { LLPathfindingManager::getInstance()->requestGetAgentState(); } break; } } diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 8bdab7d27a..66e8d3be56 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -126,6 +126,7 @@ #include "llmorphview.h" #include "llmoveview.h" #include "llnavigationbar.h" +#include "llpanelnavmeshrebake.h" #include "llpaneltopinfobar.h" #include "llpopupview.h" #include "llpreviewtexture.h" @@ -1919,9 +1920,14 @@ void LLViewerWindow::initWorldUI() getRootView()->addChild(gHUDView); } - LLPanel* panel_ssf_container = getRootView()->getChild<LLPanel>("stand_stop_flying_container"); + LLPanel* panel_ssf_container = getRootView()->getChild<LLPanel>("state_management_buttons_container"); + LLPanelStandStopFlying* panel_stand_stop_flying = LLPanelStandStopFlying::getInstance(); panel_ssf_container->addChild(panel_stand_stop_flying); + + LLPanelNavMeshRebake *panel_rebake_navmesh = LLPanelNavMeshRebake::getInstance(); + panel_ssf_container->addChild(panel_rebake_navmesh); + panel_ssf_container->setVisible(TRUE); // Load and make the toolbars visible diff --git a/indra/newview/skins/default/xui/en/panel_navmesh_rebake.xml b/indra/newview/skins/default/xui/en/panel_navmesh_rebake.xml index 94ca00945b..35d07eea99 100644 --- a/indra/newview/skins/default/xui/en/panel_navmesh_rebake.xml +++ b/indra/newview/skins/default/xui/en/panel_navmesh_rebake.xml @@ -9,7 +9,7 @@ <button follows="left|bottom" height="19" - label="Rebake NavMesh" + label="Rebake navmesh" layout="topleft" left="10" name="navmesh_btn" @@ -20,11 +20,11 @@ <button follows="left|bottom" height="19" - label="NavMesh Baking..." + label="Navmesh baking..." layout="topleft" left="10" name="navmesh_btn_baking" - tool_tip="NavMesh is baking" + tool_tip="Navmesh is baking." top="2" visible="false" width="113" /> diff --git a/indra/newview/skins/default/xui/en/panel_toolbar_view.xml b/indra/newview/skins/default/xui/en/panel_toolbar_view.xml index 107683f1f0..f5c559fe1d 100644 --- a/indra/newview/skins/default/xui/en/panel_toolbar_view.xml +++ b/indra/newview/skins/default/xui/en/panel_toolbar_view.xml @@ -93,7 +93,7 @@ left="0" mouse_opaque="false" tab_stop="false" - name="stand_stop_flying_container" + name="state_management_buttons_container" visible="false" width="200"/> </layout_panel> |