From afb42263ab7bd1469708ec534ba43bd45c16f1fc Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Fri, 22 Jun 2012 16:47:08 -0700 Subject: PATH-761: Better calling out the various status of the simulator status through the highlight colors. --- indra/newview/llfloaterpathfindingconsole.cpp | 128 +++++++++++++++----------- indra/newview/llfloaterpathfindingconsole.h | 11 ++- 2 files changed, 79 insertions(+), 60 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 047559fa5d..810650621d 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -181,6 +181,9 @@ BOOL LLFloaterPathfindingConsole::postBuild() llassert(mClearPathButton != NULL); mClearPathButton->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onClearPathClicked, this)); + mErrorColor = LLUIColorTable::instance().getColor("PathfindingErrorColor"); + mWarningColor = LLUIColorTable::instance().getColor("PathfindingWarningColor"); + if (LLPathingLib::getInstance() != NULL) { mPathfindingToolset = new LLToolset(); @@ -473,6 +476,8 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mCharacterTypeComboBox(NULL), mPathTestingStatus(NULL), mClearPathButton(NULL), + mErrorColor(), + mWarningColor(), mNavMeshZoneSlot(), mNavMeshZone(), mIsNavMeshUpdating(false), @@ -648,7 +653,8 @@ void LLFloaterPathfindingConsole::setConsoleState(EConsoleState pConsoleState) { mConsoleState = pConsoleState; updateControlsOnConsoleState(); - updateStatusOnConsoleState(); + updateViewerStatusOnConsoleState(); + updateSimulatorStatusOnConsoleState(); } void LLFloaterPathfindingConsole::setWorldRenderState() @@ -797,44 +803,34 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() } } -void LLFloaterPathfindingConsole::updateStatusOnConsoleState() +void LLFloaterPathfindingConsole::updateViewerStatusOnConsoleState() { - static const LLColor4 errorColor = LLUIColorTable::instance().getColor("PathfindingErrorColor"); - static const LLColor4 warningColor = LLUIColorTable::instance().getColor("PathfindingWarningColor"); - - std::string simulatorStatusText(""); std::string viewerStatusText(""); LLStyle::Params viewerStyleParams; switch (mConsoleState) { case kConsoleStateUnknown : - simulatorStatusText = getString("navmesh_simulator_status_unknown"); viewerStatusText = getString("navmesh_viewer_status_unknown"); - viewerStyleParams.color = errorColor; + viewerStyleParams.color = mErrorColor; break; case kConsoleStateLibraryNotImplemented : - simulatorStatusText = getString("navmesh_simulator_status_unknown"); viewerStatusText = getString("navmesh_viewer_status_library_not_implemented"); - viewerStyleParams.color = errorColor; + viewerStyleParams.color = mErrorColor; break; case kConsoleStateRegionNotEnabled : - simulatorStatusText = getString("navmesh_simulator_status_unknown"); viewerStatusText = getString("navmesh_viewer_status_region_not_enabled"); - viewerStyleParams.color = errorColor; + viewerStyleParams.color = mErrorColor; break; case kConsoleStateRegionLoading : - simulatorStatusText = getString("navmesh_simulator_status_unknown"); viewerStatusText = getString("navmesh_viewer_status_region_loading"); - viewerStyleParams.color = warningColor; + viewerStyleParams.color = mWarningColor; break; case kConsoleStateCheckingVersion : - simulatorStatusText = getString("navmesh_simulator_status_unknown"); viewerStatusText = getString("navmesh_viewer_status_checking_version"); - viewerStyleParams.color = warningColor; + viewerStyleParams.color = mWarningColor; break; case kConsoleStateDownloading : - simulatorStatusText = getSimulatorStatusText(); if (mIsNavMeshUpdating) { viewerStatusText = getString("navmesh_viewer_status_updating"); @@ -843,59 +839,82 @@ void LLFloaterPathfindingConsole::updateStatusOnConsoleState() { viewerStatusText = getString("navmesh_viewer_status_downloading"); } - viewerStyleParams.color = warningColor; + viewerStyleParams.color = mWarningColor; break; case kConsoleStateHasNavMesh : - simulatorStatusText = getSimulatorStatusText(); viewerStatusText = getString("navmesh_viewer_status_has_navmesh"); break; case kConsoleStateError : - simulatorStatusText = getString("navmesh_simulator_status_unknown"); viewerStatusText = getString("navmesh_viewer_status_error"); - viewerStyleParams.color = errorColor; + viewerStyleParams.color = mErrorColor; break; default : - simulatorStatusText = getString("navmesh_simulator_status_unknown"); viewerStatusText = getString("navmesh_viewer_status_unknown"); - viewerStyleParams.color = errorColor; + viewerStyleParams.color = mErrorColor; llassert(0); break; } mPathfindingViewerStatus->setText((LLStringExplicit)viewerStatusText, viewerStyleParams); - mPathfindingSimulatorStatus->setText((LLStringExplicit)simulatorStatusText); } -std::string LLFloaterPathfindingConsole::getSimulatorStatusText() const +void LLFloaterPathfindingConsole::updateSimulatorStatusOnConsoleState() { std::string simulatorStatusText(""); + LLStyle::Params simulatorStyleParams; - switch (mNavMeshZone.getNavMeshZoneStatus()) + switch (mConsoleState) { - case LLPathfindingNavMeshZone::kNavMeshZonePending : - simulatorStatusText = getString("navmesh_simulator_status_pending"); - break; - case LLPathfindingNavMeshZone::kNavMeshZoneBuilding : - simulatorStatusText = getString("navmesh_simulator_status_building"); - break; - case LLPathfindingNavMeshZone::kNavMeshZoneSomePending : - simulatorStatusText = getString("navmesh_simulator_status_some_pending"); - break; - case LLPathfindingNavMeshZone::kNavMeshZoneSomeBuilding : - simulatorStatusText = getString("navmesh_simulator_status_some_building"); - break; - case LLPathfindingNavMeshZone::kNavMeshZonePendingAndBuilding : - simulatorStatusText = getString("navmesh_simulator_status_pending_and_building"); + case kConsoleStateUnknown : + case kConsoleStateLibraryNotImplemented : + case kConsoleStateRegionNotEnabled : + case kConsoleStateRegionLoading : + case kConsoleStateCheckingVersion : + case kConsoleStateError : + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + simulatorStyleParams.color = mErrorColor; break; - case LLPathfindingNavMeshZone::kNavMeshZoneComplete : - simulatorStatusText = getString("navmesh_simulator_status_complete"); + case kConsoleStateDownloading : + case kConsoleStateHasNavMesh : + switch (mNavMeshZone.getNavMeshZoneStatus()) + { + case LLPathfindingNavMeshZone::kNavMeshZonePending : + simulatorStatusText = getString("navmesh_simulator_status_pending"); + simulatorStyleParams.color = mWarningColor; + break; + case LLPathfindingNavMeshZone::kNavMeshZoneBuilding : + simulatorStatusText = getString("navmesh_simulator_status_building"); + simulatorStyleParams.color = mWarningColor; + break; + case LLPathfindingNavMeshZone::kNavMeshZoneSomePending : + simulatorStatusText = getString("navmesh_simulator_status_some_pending"); + simulatorStyleParams.color = mWarningColor; + break; + case LLPathfindingNavMeshZone::kNavMeshZoneSomeBuilding : + simulatorStatusText = getString("navmesh_simulator_status_some_building"); + simulatorStyleParams.color = mWarningColor; + break; + case LLPathfindingNavMeshZone::kNavMeshZonePendingAndBuilding : + simulatorStatusText = getString("navmesh_simulator_status_pending_and_building"); + simulatorStyleParams.color = mWarningColor; + break; + case LLPathfindingNavMeshZone::kNavMeshZoneComplete : + simulatorStatusText = getString("navmesh_simulator_status_complete"); + break; + default : + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + simulatorStyleParams.color = mErrorColor; + break; + } break; - default : + default : simulatorStatusText = getString("navmesh_simulator_status_unknown"); + simulatorStyleParams.color = mErrorColor; + llassert(0); break; } - return simulatorStatusText; + mPathfindingSimulatorStatus->setText((LLStringExplicit)simulatorStatusText, simulatorStyleParams); } void LLFloaterPathfindingConsole::initializeNavMeshZoneForCurrentRegion() @@ -990,9 +1009,6 @@ void LLFloaterPathfindingConsole::clearPath() void LLFloaterPathfindingConsole::updatePathTestStatus() { - static const LLColor4 errorColor = LLUIColorTable::instance().getColor("PathfindingErrorColor"); - static const LLColor4 warningColor = LLUIColorTable::instance().getColor("PathfindingWarningColor"); - std::string statusText(""); LLStyle::Params styleParams; @@ -1000,42 +1016,42 @@ void LLFloaterPathfindingConsole::updatePathTestStatus() { case LLPathfindingPathTool::kPathStatusUnknown : statusText = getString("pathing_unknown"); - styleParams.color = errorColor; + styleParams.color = mErrorColor; break; case LLPathfindingPathTool::kPathStatusChooseStartAndEndPoints : statusText = getString("pathing_choose_start_and_end_points"); - styleParams.color = warningColor; + styleParams.color = mWarningColor; break; case LLPathfindingPathTool::kPathStatusChooseStartPoint : statusText = getString("pathing_choose_start_point"); - styleParams.color = warningColor; + styleParams.color = mWarningColor; break; case LLPathfindingPathTool::kPathStatusChooseEndPoint : statusText = getString("pathing_choose_end_point"); - styleParams.color = warningColor; + styleParams.color = mWarningColor; break; case LLPathfindingPathTool::kPathStatusHasValidPath : statusText = getString("pathing_path_valid"); break; case LLPathfindingPathTool::kPathStatusHasInvalidPath : statusText = getString("pathing_path_invalid"); - styleParams.color = errorColor; + styleParams.color = mErrorColor; break; case LLPathfindingPathTool::kPathStatusNotEnabled : statusText = getString("pathing_region_not_enabled"); - styleParams.color = errorColor; + styleParams.color = mErrorColor; break; case LLPathfindingPathTool::kPathStatusNotImplemented : statusText = getString("pathing_library_not_implemented"); - styleParams.color = errorColor; + styleParams.color = mErrorColor; break; case LLPathfindingPathTool::kPathStatusError : statusText = getString("pathing_error"); - styleParams.color = errorColor; + styleParams.color = mErrorColor; break; default : statusText = getString("pathing_unknown"); - styleParams.color = errorColor; + styleParams.color = mErrorColor; break; } diff --git a/indra/newview/llfloaterpathfindingconsole.h b/indra/newview/llfloaterpathfindingconsole.h index 238dfeb2a0..b0c14e5345 100644 --- a/indra/newview/llfloaterpathfindingconsole.h +++ b/indra/newview/llfloaterpathfindingconsole.h @@ -33,6 +33,7 @@ #include "llpathinglib.h" #include "llpathfindingnavmeshzone.h" #include "llpathfindingpathtool.h" +#include "v4color.h" #include @@ -46,7 +47,6 @@ class LLTabContainer; class LLComboBox; class LLButton; class LLToolset; -class LLColor4; class LLControlVariable; class LLFloaterPathfindingConsole @@ -133,9 +133,9 @@ private: void setNavMeshRenderState(); void updateRenderablesObjects(); - void updateControlsOnConsoleState(); - void updateStatusOnConsoleState(); - std::string getSimulatorStatusText() const; + void updateControlsOnConsoleState(); + void updateViewerStatusOnConsoleState(); + void updateSimulatorStatusOnConsoleState(); void initializeNavMeshZoneForCurrentRegion(); @@ -181,6 +181,9 @@ private: LLTextBase *mPathTestingStatus; LLButton *mClearPathButton; + LLColor4 mErrorColor; + LLColor4 mWarningColor; + LLPathfindingNavMeshZone::navmesh_zone_slot_t mNavMeshZoneSlot; LLPathfindingNavMeshZone mNavMeshZone; bool mIsNavMeshUpdating; -- cgit v1.2.3