diff options
author | Steven Bennetts <steve@lindenlab.com> | 2008-04-01 17:45:04 +0000 |
---|---|---|
committer | Steven Bennetts <steve@lindenlab.com> | 2008-04-01 17:45:04 +0000 |
commit | 941cb9f4124c9ccfd5c845bc94639fa46df12c3d (patch) | |
tree | e0f525e7bd6cc76d89b2df69c6f1554d191561e8 /indra/newview | |
parent | ecec626dec93524f7ef5831a5ba344d6449b99bc (diff) |
merge release@83343 skinning-1-merge@83714 -> release
QAR-424
Diffstat (limited to 'indra/newview')
279 files changed, 5022 insertions, 6086 deletions
diff --git a/indra/newview/app_settings/grass.xml b/indra/newview/app_settings/grass.xml index 7cc29fa771..4fc3b798af 100644 --- a/indra/newview/app_settings/grass.xml +++ b/indra/newview/app_settings/grass.xml @@ -3,35 +3,35 @@ <grass name="Grass 0" species_id="0" - texture_name="grass_texture_2.tga" + texture_id="6c4727b8-ac79-ba44-3b81-f9aa887b47eb" blade_size_x="1.35" blade_size_y="1.35" /> <grass name="Grass 1" species_id="1" - texture_name="grass_texture_1.tga" + texture_id="79504bf5-c3ec-0763-6563-d843de66d0a1" blade_size_x="1.0" blade_size_y="0.66" /> <grass name="Grass 2" species_id="2" - texture_name="grass_texture_2.tga" + texture_id="6c4727b8-ac79-ba44-3b81-f9aa887b47eb" blade_size_x="1.8" blade_size_y="1.8" /> <grass name="Grass 3" species_id="3" - texture_name="grass_texture_3.tga" + texture_id="99bd60a2-3250-efc9-2e39-2fbcadefbecc" blade_size_x="1.0" blade_size_y="1.0" /> <grass name="Grass 4" species_id="4" - texture_name="grass_texture_4.tga" + texture_id="7a2b3a4a-53c2-53ac-5716-aac7d743c020" blade_size_x="2.25" blade_size_y="2.25" /> @@ -44,4 +44,4 @@ /> -</grass_defs> +</grass_defs>
\ No newline at end of file diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 40e9b01b45..7e687a5e64 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -38,6 +38,22 @@ <real>1</real> </array> </map> + <key>IMChatColor</key> + <map> + <key>Comment</key> + <string>Color of instant messages from other residents</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Color4</string> + <key>Value</key> + <array> + <real>1</real> + <real>1</real> + <real>1</real> + <real>1</real> + </array> + </map> <key>AllowIdleAFK</key> <map> <key>Comment</key> @@ -8992,6 +9008,17 @@ <key>Value</key> <integer>1</integer> </map> + <key>WarnFirstMedia</key> + <map> + <key>Comment</key> + <string>Enables FirstMedia warning dialog</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>1</integer> + </map> <key>WarnFirstAttach</key> <map> <key>Comment</key> diff --git a/indra/newview/app_settings/std_bump.ini b/indra/newview/app_settings/std_bump.ini index 9509c357ff..f34e21ce32 100644 --- a/indra/newview/app_settings/std_bump.ini +++ b/indra/newview/app_settings/std_bump.ini @@ -1,18 +1,18 @@ LLStandardBumpmap version 1 -woodgrain bump_woodgrain.tga -bark bump_bark.tga -bricks bump_bricks.tga -checker bump_checker.tga -concrete bump_concrete.tga -crustytile bump_crustytile.tga -cutstone bump_cutstone.tga -discs bump_discs.tga -gravel bump_gravel.tga -petridish bump_petridish.tga -siding bump_siding.tga -stonetile bump_stonetile.tga -stucco bump_stucco.tga -suction bump_suction.tga -weave bump_weave.tga +woodgrain 058c75c0-a0d5-f2f8-43f3-e9699a89c2fc.j2c +bark 6c9fa78a-1c69-2168-325b-3e03ffa348ce.j2c +bricks b8eed5f0-64b7-6e12-b67f-43fa8e773440.j2c +checker 9deab416-9c63-78d6-d558-9a156f12044c.j2c +concrete db9d39ec-a896-c287-1ced-64566217021e.j2c +crustytile f2d7b6f6-4200-1e9a-fd5b-96459e950f94.j2c +cutstone d9258671-868f-7511-c321-7baef9e948a4.j2c +discs d21e44ca-ff1c-a96e-b2ef-c0753426b7d9.j2c +gravel 4726f13e-bd07-f2fb-feb0-bfa2ac58ab61.j2c +petridish e569711a-27c2-aad4-9246-0c910239a179.j2c +siding 073c9723-540c-5449-cdd4-0e87fdc159e3.j2c +stonetile ae874d1a-93ef-54fb-5fd3-eb0cb156afc0.j2c +stucco 92e66e00-f56f-598a-7997-048aa64cde18.j2c +suction 83b77fc6-10b4-63ec-4de7-f40629f238c5.j2c +weave 735198cf-6ea0-2550-e222-21d3c6a341ae.j2c diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 4dab653d19..a9d4e8a2f6 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -96,7 +96,6 @@ #include "llstatusbar.h" #include "llimview.h" #include "lltool.h" -#include "lltoolcomp.h" // for gToolGun #include "lltoolfocus.h" #include "lltoolgrab.h" #include "lltoolmgr.h" @@ -432,14 +431,14 @@ void LLAgent::init() { mDrawDistance = gSavedSettings.getF32("RenderFarClip"); - gCamera = new LLViewerCamera(); + // *Note: this is where LLViewerCamera::getInstance() used to be constructed. - gCamera->setView(DEFAULT_FIELD_OF_VIEW); + LLViewerCamera::getInstance()->setView(DEFAULT_FIELD_OF_VIEW); // Leave at 0.1 meters until we have real near clip management - gCamera->setNear(0.1f); - gCamera->setFar(mDrawDistance); // if you want to change camera settings, do so in camera.h - gCamera->setAspect( gViewerWindow->getDisplayAspectRatio() ); // default, overridden in LLViewerWindow::reshape - gCamera->setViewHeightInPixels(768); // default, overridden in LLViewerWindow::reshape + LLViewerCamera::getInstance()->setNear(0.1f); + LLViewerCamera::getInstance()->setFar(mDrawDistance); // if you want to change camera settings, do so in camera.h + LLViewerCamera::getInstance()->setAspect( gViewerWindow->getDisplayAspectRatio() ); // default, overridden in LLViewerWindow::reshape + LLViewerCamera::getInstance()->setViewHeightInPixels(768); // default, overridden in LLViewerWindow::reshape setFlying( gSavedSettings.getBOOL("FlyingAtExit") ); @@ -483,8 +482,7 @@ LLAgent::~LLAgent() delete [] mActiveCacheQueries; mActiveCacheQueries = NULL; - delete gCamera; - gCamera = NULL; + // *Note: this is where LLViewerCamera::getInstance() used to be deleted. } // Change camera back to third person, stop the autopilot, @@ -501,16 +499,16 @@ void LLAgent::resetView(BOOL reset_camera) if (!gNoRender) { - gSelectMgr->unhighlightAll(); + LLSelectMgr::getInstance()->unhighlightAll(); // By popular request, keep land selection while walking around. JC - // gParcelMgr->deselectLand(); + // LLViewerParcelMgr::getInstance()->deselectLand(); // force deselect when walking and attachment is selected // this is so people don't wig out when their avatar moves without animating - if (gSelectMgr->getSelection()->isAttachment()) + if (LLSelectMgr::getInstance()->getSelection()->isAttachment()) { - gSelectMgr->deselectAll(); + LLSelectMgr::getInstance()->deselectAll(); } // Hide all popup menus @@ -547,7 +545,7 @@ void LLAgent::onAppFocusGained() if (CAMERA_MODE_MOUSELOOK == mCameraMode) { changeCameraToDefault(); - gToolMgr->clearSavedTool(); + LLToolMgr::getInstance()->clearSavedTool(); } } @@ -732,12 +730,10 @@ BOOL LLAgent::canFly() { if (isGodlike()) return TRUE; - if (!gParcelMgr) return FALSE; - LLViewerRegion* regionp = getRegion(); if (regionp && regionp->getBlockFly()) return FALSE; - LLParcel* parcel = gParcelMgr->getAgentParcel(); + LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if (!parcel) return FALSE; // Allow owners to fly on their own land. @@ -772,20 +768,17 @@ void LLAgent::setFlying(BOOL fly) if (fly) { BOOL was_flying = getFlying(); - if (gParcelMgr) + if (!canFly() && !was_flying) { - if (!canFly() && !was_flying) - { - // parcel doesn't let you start fly - // gods can always fly - // and it's OK if you're already flying - make_ui_sound("UISndBadKeystroke"); - return; - } + // parcel doesn't let you start fly + // gods can always fly + // and it's OK if you're already flying + make_ui_sound("UISndBadKeystroke"); + return; } if( !was_flying ) { - gViewerStats->incStat(LLViewerStats::ST_FLY_COUNT); + LLViewerStats::getInstance()->incStat(LLViewerStats::ST_FLY_COUNT); } setControlFlags(AGENT_CONTROL_FLY); gSavedSettings.setBOOL("FlyBtnState", TRUE); @@ -839,12 +832,12 @@ void LLAgent::setRegion(LLViewerRegion *regionp) delta.setVec(regionp->getOriginGlobal() - mRegionp->getOriginGlobal()); setPositionAgent(getPositionAgent() - delta); - LLVector3 camera_position_agent = gCamera->getOrigin(); - - gCamera->setOrigin(camera_position_agent - delta); + + LLVector3 camera_position_agent = LLViewerCamera::getInstance()->getOrigin(); + LLViewerCamera::getInstance()->setOrigin(camera_position_agent - delta); // Update all of the regions. - gWorldPointer->updateAgentOffset(agent_offset_global); + LLWorld::getInstance()->updateAgentOffset(agent_offset_global); // Hack to keep sky in the agent's region, otherwise it may get deleted - DJS 08/02/02 // *TODO: possibly refactor into gSky->setAgentRegion(regionp)? -Brad @@ -868,18 +861,18 @@ void LLAgent::setRegion(LLViewerRegion *regionp) delta.setVec(regionp->getOriginGlobal()); setPositionAgent(getPositionAgent() - delta); - LLVector3 camera_position_agent = gCamera->getOrigin(); - gCamera->setOrigin(camera_position_agent - delta); + LLVector3 camera_position_agent = LLViewerCamera::getInstance()->getOrigin(); + LLViewerCamera::getInstance()->setOrigin(camera_position_agent - delta); // Update all of the regions. - gWorldPointer->updateAgentOffset(mAgentOriginGlobal); + LLWorld::getInstance()->updateAgentOffset(mAgentOriginGlobal); } } mRegionp = regionp; // Must shift hole-covering water object locations because local // coordinate frame changed. - gWorldPointer->updateWaterObjects(); + LLWorld::getInstance()->updateWaterObjects(); // keep a list of regions we've been too // this is just an interesting stat, logged at the dataserver @@ -887,7 +880,7 @@ void LLAgent::setRegion(LLViewerRegion *regionp) U64 handle = regionp->getHandle(); mRegionsVisited.insert(handle); - gSelectMgr->updateSelectionCenter(); + LLSelectMgr::getInstance()->updateSelectionCenter(); } @@ -1301,7 +1294,7 @@ LLVector3d LLAgent::calcFocusOffset(LLViewerObject *object, S32 x, S32 y) LLVector3 obj_pos = is_avatar ? ((LLVOAvatar*)object)->mPelvisp->getWorldPosition() : object->getRenderPosition(); LLQuaternion inv_obj_rot = ~obj_rot; - LLVector3 obj_dir_abs = obj_pos - gCamera->getOrigin(); + LLVector3 obj_dir_abs = obj_pos - LLViewerCamera::getInstance()->getOrigin(); obj_dir_abs.rotVec(inv_obj_rot); obj_dir_abs.normVec(); obj_dir_abs.abs(); @@ -1335,7 +1328,7 @@ LLVector3d LLAgent::calcFocusOffset(LLViewerObject *object, S32 x, S32 y) gViewerWindow->mousePointOnPlaneGlobal(focus_pt_global, x, y, gAgent.getPosGlobalFromAgent(obj_pos), normal); LLVector3 focus_pt = gAgent.getPosAgentFromGlobal(focus_pt_global); // find vector from camera to focus point in object coordinates - LLVector3 camera_focus_vec = focus_pt - gCamera->getOrigin(); + LLVector3 camera_focus_vec = focus_pt - LLViewerCamera::getInstance()->getOrigin(); // convert to object-local space camera_focus_vec.rotVec(inv_obj_rot); @@ -1395,7 +1388,6 @@ LLVector3d LLAgent::calcFocusOffset(LLViewerObject *object, S32 x, S32 y) if (!is_avatar) { //unproject relative clicked coordinate from window coordinate using GL - GLint viewport[4]; GLdouble modelview[16]; GLdouble projection[16]; @@ -1403,14 +1395,14 @@ LLVector3d LLAgent::calcFocusOffset(LLViewerObject *object, S32 x, S32 y) GLdouble posX, posY, posZ; // convert our matrices to something that has a multiply that works - glh::matrix4f newModel((F32*)gCamera->getModelview().mMatrix); + glh::matrix4f newModel((F32*)LLViewerCamera::getInstance()->getModelview().mMatrix); glh::matrix4f tmpObjMat((F32*)obj_matrix.mMatrix); newModel *= tmpObjMat; for(U32 i = 0; i < 16; ++i) { modelview[i] = newModel.m[i]; - projection[i] = gCamera->getProjection().mMatrix[i/4][i%4]; + projection[i] = LLViewerCamera::getInstance()->getProjection().mMatrix[i/4][i%4]; } glGetIntegerv( GL_VIEWPORT, viewport ); @@ -1429,8 +1421,8 @@ LLVector3d LLAgent::calcFocusOffset(LLViewerObject *object, S32 x, S32 y) //now that we have the object relative position, we should bias toward the center of the object //based on the distance of the camera to the focus point vs. the distance of the camera to the focus - F32 relDist = llabs(obj_rel * gCamera->getAtAxis()); - F32 viewDist = dist_vec(obj_center + obj_rel, gCamera->getOrigin()); + F32 relDist = llabs(obj_rel * LLViewerCamera::getInstance()->getAtAxis()); + F32 viewDist = dist_vec(obj_center + obj_rel, LLViewerCamera::getInstance()->getOrigin()); LLBBox obj_bbox = object->getBoundingBoxAgent(); @@ -1632,7 +1624,7 @@ BOOL LLAgent::calcCameraMinDistance(F32 &obj_min_distance) // clamp obj distance to diagonal of 10 by 10 cube obj_min_distance = llmin(obj_min_distance, 10.f * F_SQRT3); - obj_min_distance += gCamera->getNear() + (soft_limit ? 0.1f : 0.2f); + obj_min_distance += LLViewerCamera::getInstance()->getNear() + (soft_limit ? 0.1f : 0.2f); return TRUE; } @@ -1641,7 +1633,7 @@ F32 LLAgent::getCameraZoomFraction() { // 0.f -> camera zoomed all the way out // 1.f -> camera zoomed all the way in - LLObjectSelectionHandle selection = gSelectMgr->getSelection(); + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) { // already [0,1] @@ -1660,9 +1652,9 @@ F32 LLAgent::getCameraZoomFraction() { F32 min_zoom; const F32 DIST_FUDGE = 16.f; // meters - F32 max_zoom = gWorldPointer ? llmin(mDrawDistance - DIST_FUDGE, - gWorldPointer->getRegionWidthInMeters() - DIST_FUDGE, - MAX_CAMERA_DISTANCE_FROM_AGENT) : MAX_CAMERA_DISTANCE_FROM_AGENT; + F32 max_zoom = llmin(mDrawDistance - DIST_FUDGE, + LLWorld::getInstance()->getRegionWidthInMeters() - DIST_FUDGE, + MAX_CAMERA_DISTANCE_FROM_AGENT); F32 distance = (F32)mCameraFocusOffsetTarget.magVec(); if (mFocusObject.notNull()) @@ -1689,7 +1681,7 @@ void LLAgent::setCameraZoomFraction(F32 fraction) { // 0.f -> camera zoomed all the way out // 1.f -> camera zoomed all the way in - LLObjectSelectionHandle selection = gSelectMgr->getSelection(); + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) { @@ -1710,7 +1702,7 @@ void LLAgent::setCameraZoomFraction(F32 fraction) F32 min_zoom = LAND_MIN_ZOOM; const F32 DIST_FUDGE = 16.f; // meters F32 max_zoom = llmin(mDrawDistance - DIST_FUDGE, - gWorldPointer->getRegionWidthInMeters() - DIST_FUDGE, + LLWorld::getInstance()->getRegionWidthInMeters() - DIST_FUDGE, MAX_CAMERA_DISTANCE_FROM_AGENT); if (mFocusObject.notNull()) @@ -1741,7 +1733,7 @@ void LLAgent::setCameraZoomFraction(F32 fraction) //----------------------------------------------------------------------------- void LLAgent::cameraOrbitAround(const F32 radians) { - LLObjectSelectionHandle selection = gSelectMgr->getSelection(); + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) { // do nothing for hud selection @@ -1764,7 +1756,7 @@ void LLAgent::cameraOrbitAround(const F32 radians) //----------------------------------------------------------------------------- void LLAgent::cameraOrbitOver(const F32 angle) { - LLObjectSelectionHandle selection = gSelectMgr->getSelection(); + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) { // do nothing for hud selection @@ -1781,7 +1773,7 @@ void LLAgent::cameraOrbitOver(const F32 angle) F32 angle_from_up = acos( camera_offset_unit * getReferenceUpVector() ); LLVector3d left_axis; - left_axis.setVec(gCamera->getLeftAxis()); + left_axis.setVec(LLViewerCamera::getInstance()->getLeftAxis()); F32 new_angle = llclamp(angle_from_up - angle, 1.f * DEG_TO_RAD, 179.f * DEG_TO_RAD); mCameraFocusOffsetTarget.rotVec(angle_from_up - new_angle, left_axis); @@ -1799,7 +1791,7 @@ void LLAgent::cameraZoomIn(const F32 fraction) return; } - LLObjectSelectionHandle selection = gSelectMgr->getSelection(); + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) { // just update hud zoom level @@ -1834,7 +1826,7 @@ void LLAgent::cameraZoomIn(const F32 fraction) // Don't zoom too far back const F32 DIST_FUDGE = 16.f; // meters F32 max_distance = llmin(mDrawDistance - DIST_FUDGE, - gWorldPointer->getRegionWidthInMeters() - DIST_FUDGE ); + LLWorld::getInstance()->getRegionWidthInMeters() - DIST_FUDGE ); if (new_distance > max_distance) { @@ -1902,7 +1894,7 @@ void LLAgent::cameraOrbitIn(const F32 meters) // Don't zoom too far back const F32 DIST_FUDGE = 16.f; // meters F32 max_distance = llmin(mDrawDistance - DIST_FUDGE, - gWorldPointer->getRegionWidthInMeters() - DIST_FUDGE ); + LLWorld::getInstance()->getRegionWidthInMeters() - DIST_FUDGE ); if (new_distance > max_distance) { @@ -1931,7 +1923,7 @@ void LLAgent::cameraOrbitIn(const F32 meters) void LLAgent::cameraPanIn(F32 meters) { LLVector3d at_axis; - at_axis.setVec(gCamera->getAtAxis()); + at_axis.setVec(LLViewerCamera::getInstance()->getAtAxis()); mFocusTargetGlobal += meters * at_axis; mFocusGlobal = mFocusTargetGlobal; @@ -1945,7 +1937,7 @@ void LLAgent::cameraPanIn(F32 meters) void LLAgent::cameraPanLeft(F32 meters) { LLVector3d left_axis; - left_axis.setVec(gCamera->getLeftAxis()); + left_axis.setVec(LLViewerCamera::getInstance()->getLeftAxis()); mFocusTargetGlobal += meters * left_axis; mFocusGlobal = mFocusTargetGlobal; @@ -1959,7 +1951,7 @@ void LLAgent::cameraPanLeft(F32 meters) void LLAgent::cameraPanUp(F32 meters) { LLVector3d up_axis; - up_axis.setVec(gCamera->getUpAxis()); + up_axis.setVec(LLViewerCamera::getInstance()->getUpAxis()); mFocusTargetGlobal += meters * up_axis; mFocusGlobal = mFocusTargetGlobal; @@ -2134,10 +2126,7 @@ void LLAgent::setBusy() //*TODO:Translate gBusyMenu->setLabel(LLString("Set Not Busy")); } - if (gFloaterMute) - { - gFloaterMute->updateButtons(); - } + LLFloaterMute::getInstance()->updateButtons(); } //----------------------------------------------------------------------------- @@ -2152,10 +2141,7 @@ void LLAgent::clearBusy() //*TODO:Translate gBusyMenu->setLabel(LLString("Set Busy")); } - if (gFloaterMute) - { - gFloaterMute->updateButtons(); - } + LLFloaterMute::getInstance()->updateButtons(); } //----------------------------------------------------------------------------- @@ -2172,7 +2158,7 @@ BOOL LLAgent::getBusy() const //----------------------------------------------------------------------------- void LLAgent::startAutoPilotGlobal(const LLVector3d &target_global, const std::string& behavior_name, const LLQuaternion *target_rotation, void (*finish_callback)(BOOL, void *), void *callback_data, F32 stop_distance, F32 rot_threshold) { - if (!gAgent.getAvatarObject() || !gWorldPointer) + if (!gAgent.getAvatarObject()) { return; } @@ -2192,7 +2178,7 @@ void LLAgent::startAutoPilotGlobal(const LLVector3d &target_global, const std::s LLVector3d intersection; LLVector3 normal; LLViewerObject *hit_obj; - F32 heightDelta = gWorldPointer->resolveStepHeightGlobal(NULL, target_global, trace_target, intersection, normal, &hit_obj); + F32 heightDelta = LLWorld::getInstance()->resolveStepHeightGlobal(NULL, target_global, trace_target, intersection, normal, &hit_obj); if (stop_distance > 0.f) { @@ -2232,7 +2218,7 @@ void LLAgent::startAutoPilotGlobal(const LLVector3d &target_global, const std::s LLVector3 groundNorm; LLViewerObject *obj; - gWorldPointer->resolveStepHeightGlobal(NULL, target_global, traceEndPt, targetOnGround, groundNorm, &obj); + LLWorld::getInstance()->resolveStepHeightGlobal(NULL, target_global, traceEndPt, targetOnGround, groundNorm, &obj); F64 target_height = llmax((F64)gAgent.getAvatarObject()->getPelvisToFoot(), target_global.mdV[VZ] - targetOnGround.mdV[VZ]); // clamp z value of target to minimum height above ground @@ -2588,7 +2574,7 @@ void LLAgent::updateLookAt(const S32 mouse_x, const S32 mouse_y) // Move head based on cursor position ELookAtType lookAtType = LOOKAT_TARGET_NONE; LLVector3 headLookAxis; - LLCoordFrame frameCamera = *((LLCoordFrame*)gCamera); + LLCoordFrame frameCamera = *((LLCoordFrame*)LLViewerCamera::getInstance()); F32 x_from_center = ((F32) mouse_x / (F32) gViewerWindow->getWindowWidth() ) - 0.5f; F32 y_from_center = ((F32) mouse_y / (F32) gViewerWindow->getWindowHeight() ) - 0.5f; @@ -2644,11 +2630,11 @@ void LLAgent::setAvatarObject(LLVOAvatar *avatar) if (!mLookAt) { - mLookAt = (LLHUDEffectLookAt *)gHUDManager->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_LOOKAT); + mLookAt = (LLHUDEffectLookAt *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_LOOKAT); } if (!mPointAt) { - mPointAt = (LLHUDEffectPointAt *)gHUDManager->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINTAT); + mPointAt = (LLHUDEffectPointAt *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINTAT); } if (!mLookAt.isNull()) @@ -2749,7 +2735,7 @@ void LLAgent::clearRenderState(U8 clearstate) //----------------------------------------------------------------------------- U8 LLAgent::getRenderState() { - if (gNoRender || gToolMgr == NULL || gSelectMgr == NULL || gKeyboard == NULL) + if (gNoRender || gKeyboard == NULL) { return 0; } @@ -2761,8 +2747,8 @@ U8 LLAgent::getRenderState() stopTyping(); } - if ((!gSelectMgr->getSelection()->isEmpty() && gSelectMgr->shouldShowSelection()) - || gToolMgr->getCurrentTool()->isEditing() ) + if ((!LLSelectMgr::getInstance()->getSelection()->isEmpty() && LLSelectMgr::getInstance()->shouldShowSelection()) + || LLToolMgr::getInstance()->getCurrentTool()->isEditing() ) { setRenderState(AGENT_STATE_EDITING); } @@ -2804,7 +2790,7 @@ void LLAgent::endAnimationUpdateUI() gMenuBarView->setVisible(TRUE); gStatusBar->setVisibleForMouselook(true); - gToolMgr->setCurrentToolset(gBasicToolset); + LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); // Only pop if we have pushed... if (TRUE == mViewsPushed) @@ -2852,7 +2838,7 @@ void LLAgent::endAnimationUpdateUI() { // make sure we ask to save changes - gToolMgr->setCurrentToolset(gBasicToolset); + LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); // HACK: If we're quitting, and we were in customize avatar, don't // let the mini-map go visible again. JC @@ -2895,7 +2881,7 @@ void LLAgent::endAnimationUpdateUI() // JC - Added for always chat in third person option gFocusMgr.setKeyboardFocus(NULL); - gToolMgr->setCurrentToolset(gMouselookToolset); + LLToolMgr::getInstance()->setCurrentToolset(gMouselookToolset); mViewsPushed = TRUE; @@ -2937,7 +2923,7 @@ void LLAgent::endAnimationUpdateUI() } if (mAvatarObject->getParent()) { - LLVector3 at_axis = gCamera->getAtAxis(); + LLVector3 at_axis = LLViewerCamera::getInstance()->getAtAxis(); LLViewerObject* root_object = (LLViewerObject*)mAvatarObject->getRoot(); if (root_object->flagCameraDecoupled()) { @@ -2953,7 +2939,7 @@ void LLAgent::endAnimationUpdateUI() } else if (mCameraMode == CAMERA_MODE_CUSTOMIZE_AVATAR) { - gToolMgr->setCurrentToolset(gFaceEditToolset); + LLToolMgr::getInstance()->setCurrentToolset(gFaceEditToolset); gFloaterMap->pushVisible(FALSE); /* @@ -3076,7 +3062,7 @@ void LLAgent::updateCamera() { F32 input_rate = mOrbitInKey - mOrbitOutKey; - LLVector3d to_focus = gAgent.getPosGlobalFromAgent(gCamera->getOrigin()) - calcFocusPositionTargetGlobal(); + LLVector3d to_focus = gAgent.getPosGlobalFromAgent(LLViewerCamera::getInstance()->getOrigin()) - calcFocusPositionTargetGlobal(); F32 distance_to_focus = (F32)to_focus.magVec(); // Move at distance (in meters) meters per second cameraOrbitIn( input_rate * distance_to_focus / gFPSClamped ); @@ -3278,15 +3264,15 @@ void LLAgent::updateCamera() // Move the camera //Ventrella - gCamera->updateCameraLocation(mCameraPositionAgent, mCameraUpVector, focus_agent); - //gCamera->updateCameraLocation(mCameraPositionAgent, camera_skyward, focus_agent); + LLViewerCamera::getInstance()->updateCameraLocation(mCameraPositionAgent, mCameraUpVector, focus_agent); + //LLViewerCamera::getInstance()->updateCameraLocation(mCameraPositionAgent, camera_skyward, focus_agent); //end Ventrella //RN: translate UI offset after camera is oriented properly - gCamera->translate(gCamera->getLeftAxis() * ui_offset); + LLViewerCamera::getInstance()->translate(LLViewerCamera::getInstance()->getLeftAxis() * ui_offset); // Change FOV - gCamera->setView(gCamera->getDefaultFOV() / (1.f + mCameraCurrentFOVZoomFactor)); + LLViewerCamera::getInstance()->setView(LLViewerCamera::getInstance()->getDefaultFOV() / (1.f + mCameraCurrentFOVZoomFactor)); // follow camera when in customize mode if (cameraCustomizeAvatar()) @@ -3298,11 +3284,11 @@ void LLAgent::updateCamera() if(gVoiceClient && getRegion()) { LLMatrix3 rot; - rot.setRows(gCamera->getAtAxis(), gCamera->getLeftAxis (), gCamera->getUpAxis()); + rot.setRows(LLViewerCamera::getInstance()->getAtAxis(), LLViewerCamera::getInstance()->getLeftAxis (), LLViewerCamera::getInstance()->getUpAxis()); // MBW -- XXX -- Setting velocity to 0 for now. May figure it out later... gVoiceClient->setCameraPosition( - getRegion()->getPosGlobalFromRegion(gCamera->getOrigin()),// position + getRegion()->getPosGlobalFromRegion(LLViewerCamera::getInstance()->getOrigin()),// position LLVector3::zero, // velocity rot); // rotation matrix } @@ -3404,7 +3390,7 @@ F32 LLAgent::calcCustomizeAvatarUIOffset( const LLVector3d& camera_pos_global ) // Move the camera so that the avatar isn't covered up by this floater. F32 fraction_of_fov = 0.5f - (0.5f * (1.f - llmin(1.f, ((F32)rect.getWidth() / (F32)gViewerWindow->getWindowWidth())))); - F32 apparent_angle = fraction_of_fov * gCamera->getView() * gCamera->getAspect(); // radians + F32 apparent_angle = fraction_of_fov * LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect(); // radians F32 offset = tan(apparent_angle); if( rect.mLeft < (gViewerWindow->getWindowWidth() - rect.mRight) ) @@ -3544,7 +3530,7 @@ void LLAgent::setupSitCamera() //----------------------------------------------------------------------------- const LLVector3 &LLAgent::getCameraPositionAgent() const { - return gCamera->getOrigin(); + return LLViewerCamera::getInstance()->getOrigin(); } //----------------------------------------------------------------------------- @@ -3552,14 +3538,7 @@ const LLVector3 &LLAgent::getCameraPositionAgent() const //----------------------------------------------------------------------------- LLVector3d LLAgent::getCameraPositionGlobal() const { - if (gCamera) - { - return getPosGlobalFromAgent(gCamera->getOrigin()); - } - else - { - return (LLVector3d::zero); - } + return getPosGlobalFromAgent(LLViewerCamera::getInstance()->getOrigin()); } //----------------------------------------------------------------------------- @@ -3809,7 +3788,7 @@ LLVector3d LLAgent::calcCameraPositionTargetGlobal(BOOL *hit_limit) if (!gSavedSettings.getBOOL("DisableCameraConstraints") && !gAgent.isGodlike()) { - LLViewerRegion* regionp = gWorldPointer->getRegionFromPosGlobal( + LLViewerRegion* regionp = LLWorld::getInstance()->getRegionFromPosGlobal( camera_position_global); bool constrain = true; if(regionp && regionp->canManageEstate()) @@ -3834,7 +3813,7 @@ LLVector3d LLAgent::calcCameraPositionTargetGlobal(BOOL *hit_limit) } // JC - Could constrain camera based on parcel stuff here. -// LLViewerRegion *regionp = gWorldPointer->getRegionFromPosGlobal(camera_position_global); +// LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromPosGlobal(camera_position_global); // // if (regionp && !regionp->mParcelOverlay->isBuildCameraAllowed(regionp->getPosRegionFromGlobal(camera_position_global))) // { @@ -3847,14 +3826,7 @@ LLVector3d LLAgent::calcCameraPositionTargetGlobal(BOOL *hit_limit) // Don't let camera go underground F32 camera_min_off_ground = getCameraMinOffGround(); - if (gWorldPointer) - { - camera_land_height = gWorldPointer->resolveLandHeightGlobal(camera_position_global); - } - else - { - camera_land_height = 0.f; - } + camera_land_height = LLWorld::getInstance()->resolveLandHeightGlobal(camera_position_global); if (camera_position_global.mdV[VZ] < camera_land_height + camera_min_off_ground) { @@ -3890,7 +3862,7 @@ void LLAgent::handleScrollWheel(S32 clicks) } else { - LLObjectSelectionHandle selection = gSelectMgr->getSelection(); + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); const F32 ROOT_ROOT_TWO = sqrt(F_SQRT2); // Block if camera is animating @@ -3970,7 +3942,7 @@ void LLAgent::changeCameraToMouselook(BOOL animate) // unpause avatar animation mPauseRequest = NULL; - gToolMgr->setCurrentToolset(gMouselookToolset); + LLToolMgr::getInstance()->setCurrentToolset(gMouselookToolset); gSavedSettings.setBOOL("FirstPersonBtnState", FALSE); gSavedSettings.setBOOL("MouselookBtnState", TRUE); @@ -3984,7 +3956,7 @@ void LLAgent::changeCameraToMouselook(BOOL animate) } //gViewerWindow->stopGrab(); - gSelectMgr->deselectAll(); + LLSelectMgr::getInstance()->deselectAll(); gViewerWindow->hideCursor(); gViewerWindow->moveCursorToCenter(); @@ -4048,11 +4020,11 @@ void LLAgent::changeCameraToFollow(BOOL animate) mCameraMode = CAMERA_MODE_FOLLOW; // bang-in the current focus, position, and up vector of the follow cam - mFollowCam.reset( mCameraPositionAgent, gCamera->getPointOfInterest(), LLVector3::z_axis ); + mFollowCam.reset( mCameraPositionAgent, LLViewerCamera::getInstance()->getPointOfInterest(), LLVector3::z_axis ); if (gBasicToolset) { - gToolMgr->setCurrentToolset(gBasicToolset); + LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); } if (mAvatarObject) @@ -4121,7 +4093,7 @@ void LLAgent::changeCameraToThirdPerson(BOOL animate) { if (gBasicToolset) { - gToolMgr->setCurrentToolset(gBasicToolset); + LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); } mCameraLag.clearVec(); @@ -4146,7 +4118,7 @@ void LLAgent::changeCameraToThirdPerson(BOOL animate) if (!mAvatarObject.isNull() && mAvatarObject->getParent()) { LLQuaternion obj_rot = ((LLViewerObject*)mAvatarObject->getParent())->getRenderRotation(); - at_axis = gCamera->getAtAxis(); + at_axis = LLViewerCamera::getInstance()->getAtAxis(); at_axis.mV[VZ] = 0.f; at_axis.normVec(); resetAxes(at_axis * ~obj_rot); @@ -4181,7 +4153,7 @@ void LLAgent::changeCameraToCustomizeAvatar(BOOL avatar_animate, BOOL camera_ani if (gFaceEditToolset) { - gToolMgr->setCurrentToolset(gFaceEditToolset); + LLToolMgr::getInstance()->setCurrentToolset(gFaceEditToolset); } gSavedSettings.setBOOL("FirstPersonBtnState", FALSE); @@ -4401,11 +4373,11 @@ void LLAgent::setCameraPosAndFocusGlobal(const LLVector3d& camera_pos, const LLV if( CAMERA_MODE_CUSTOMIZE_AVATAR == mCameraMode ) { // Compensate for the fact that the camera has already been offset to make room for LLFloaterCustomize. - mAnimationCameraStartGlobal -= LLVector3d(gCamera->getLeftAxis() * calcCustomizeAvatarUIOffset( mAnimationCameraStartGlobal )); + mAnimationCameraStartGlobal -= LLVector3d(LLViewerCamera::getInstance()->getLeftAxis() * calcCustomizeAvatarUIOffset( mAnimationCameraStartGlobal )); } } - //gCamera->setOrigin( gAgent.getPosAgentFromGlobal( camera_pos ) ); + //LLViewerCamera::getInstance()->setOrigin( gAgent.getPosAgentFromGlobal( camera_pos ) ); setFocusObject(gObjectList.findObject(object_id)); mFocusTargetGlobal = focus; mCameraFocusOffsetTarget = camera_pos - focus; @@ -4496,14 +4468,14 @@ void LLAgent::setFocusOnAvatar(BOOL focus_on_avatar, BOOL animate) if (!mAvatarObject.isNull() && mAvatarObject->getParent()) { LLQuaternion obj_rot = ((LLViewerObject*)mAvatarObject->getParent())->getRenderRotation(); - at_axis = gCamera->getAtAxis(); + at_axis = LLViewerCamera::getInstance()->getAtAxis(); at_axis.mV[VZ] = 0.f; at_axis.normVec(); resetAxes(at_axis * ~obj_rot); } else { - at_axis = gCamera->getAtAxis(); + at_axis = LLViewerCamera::getInstance()->getAtAxis(); at_axis.mV[VZ] = 0.f; at_axis.normVec(); resetAxes(at_axis); @@ -4521,7 +4493,7 @@ void LLAgent::heardChat(const LLUUID& id) { // log text and voice chat to speaker mgr // for keeping track of active speakers, etc. - gLocalSpeakerMgr->speakerChatted(id); + LLLocalSpeakerMgr::getInstance()->speakerChatted(id); // don't respond to your own voice if (id == getID()) return; @@ -4631,7 +4603,7 @@ void LLAgent::setStartPosition(U32 location_id) // this simulator. Clamp it to the region the agent is // in, a little bit in on each side. const F32 INSET = 0.5f; //meters - const F32 REGION_WIDTH = gWorldPointer->getRegionWidthInMeters(); + const F32 REGION_WIDTH = LLWorld::getInstance()->getRegionWidthInMeters(); LLVector3 agent_pos = getPositionAgent(); @@ -4647,7 +4619,7 @@ void LLAgent::setStartPosition(U32 location_id) // Don't let them go below ground, or too high. agent_pos.mV[VZ] = llclamp( agent_pos.mV[VZ], mRegionp->getLandHeightRegion( agent_pos ), - gWorldPointer->getRegionMaxHeight() ); + LLWorld::getInstance()->getRegionMaxHeight() ); LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_SetStartLocationRequest); @@ -4937,7 +4909,7 @@ void LLAgent::buildLocationString(std::string& str) // create a defult name and description for the landmark std::string buffer; - if( gParcelMgr->getAgentParcelName().empty() ) + if( LLViewerParcelMgr::getInstance()->getAgentParcelName().empty() ) { // the parcel doesn't have a name buffer = llformat("%.32s (%d, %d, %d)", @@ -4948,7 +4920,7 @@ void LLAgent::buildLocationString(std::string& str) { // the parcel has a name, so include it in the landmark name buffer = llformat("%.32s, %.32s (%d, %d, %d)", - gParcelMgr->getAgentParcelName().c_str(), + LLViewerParcelMgr::getInstance()->getAgentParcelName().c_str(), getRegion()->getName().c_str(), pos_x, pos_y, pos_z); } @@ -4968,7 +4940,7 @@ LLQuaternion LLAgent::getHeadRotation() } // We must be in mouselook - LLVector3 look_dir( gCamera->getAtAxis() ); + LLVector3 look_dir( LLViewerCamera::getInstance()->getAtAxis() ); LLVector3 up = look_dir % mFrameAgent.getLeftAxis(); LLVector3 left = up % look_dir; @@ -5209,7 +5181,7 @@ void LLAgent::processAgentDropGroup(LLMessageSystem *msg, void **) // refresh all group information gAgent.sendAgentDataUpdateRequest(); - gGroupMgr->clearGroupData(group_id); + LLGroupMgr::getInstance()->clearGroupData(group_id); // close the floater for this group, if any. LLFloaterGroupInfo::closeGroup(group_id); // refresh the group panel of the search window, if necessary. @@ -5288,7 +5260,7 @@ class LLAgentDropGroupViewerNode : public LLHTTPNode // refresh all group information gAgent.sendAgentDataUpdateRequest(); - gGroupMgr->clearGroupData(group_id); + LLGroupMgr::getInstance()->clearGroupData(group_id); // close the floater for this group, if any. LLFloaterGroupInfo::closeGroup(group_id); // refresh the group panel of the search window, @@ -5749,14 +5721,14 @@ bool LLAgent::teleportCore(bool is_local) LLFloaterWorldMap::hide(NULL); LLFloaterDirectory::hide(NULL); - gParcelMgr->deselectLand(); + LLViewerParcelMgr::getInstance()->deselectLand(); // Close all pie menus, deselect land, etc. // Don't change the camera until we know teleport succeeded. JC resetView(FALSE); // local logic - gViewerStats->incStat(LLViewerStats::ST_TELEPORT_COUNT); + LLViewerStats::getInstance()->incStat(LLViewerStats::ST_TELEPORT_COUNT); if (!is_local) { gTeleportDisplay = TRUE; @@ -5864,7 +5836,7 @@ void LLAgent::teleportCancel() void LLAgent::teleportViaLocation(const LLVector3d& pos_global) { LLViewerRegion* regionp = getRegion(); - LLSimInfo* info = gWorldMap->simInfoFromPosGlobal(pos_global); + LLSimInfo* info = LLWorldMap::getInstance()->simInfoFromPosGlobal(pos_global); if(regionp && info) { U32 x_pos; diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 0a611c9bfa..aefa1af106 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -35,7 +35,7 @@ #include "llversionviewer.h" #include "llfeaturemanager.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llalertdialog.h" #include "llerrorcontrol.h" #include "llviewerimagelist.h" @@ -45,7 +45,6 @@ #include "llviewerstats.h" #include "llmd5.h" #include "llpumpio.h" -#include "llfloateractivespeakers.h" #include "llimpanel.h" #include "llmimetypes.h" #include "llstartup.h" @@ -96,7 +95,6 @@ #include "lltoolmgr.h" #include "llassetstorage.h" #include "llpolymesh.h" -#include "lleconomy.h" #include "llcachename.h" #include "audioengine.h" #include "llviewermenu.h" @@ -337,8 +335,8 @@ void request_initial_instant_messages() { static BOOL requested = FALSE; if (!requested - && gMuteListp - && gMuteListp->isLoaded() + && gMessageSystem + && LLMuteList::getInstance()->isLoaded() && gAgent.getAvatarObject()) { // Auto-accepted inventory items may require the avatar object @@ -503,6 +501,7 @@ void initGridChoice() gGridName = custom_server.c_str(); } } + gSavedSettings.setString("GridChoice", gGridInfo[gGridChoice].mLabel); } #endif @@ -669,13 +668,6 @@ bool LLAppViewer::init() } // Load art UUID information, don't require these strings to be declared in code. - LLString viewer_art_filename = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"viewerart.xml"); - llinfos << "Loading art table from " << viewer_art_filename << llendl; - gViewerArt.loadFromFileLegacy(viewer_art_filename.c_str(), FALSE); - LLString textures_filename = gDirUtilp->getExpandedFilename(LL_PATH_SKINS, "textures", "textures.xml"); - llinfos << "Loading art table from " << textures_filename << llendl; - gViewerArt.loadFromFileLegacy(textures_filename.c_str(), FALSE); - LLString colors_base_filename = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "colors_base.xml"); llinfos << "Loading base colors from " << colors_base_filename << llendl; gColors.loadFromFileLegacy(colors_base_filename.c_str(), FALSE, TYPE_COL4U); @@ -691,13 +683,12 @@ bool LLAppViewer::init() // Widget construction depends on LLUI being initialized LLUI::initClass(&gSavedSettings, &gColors, - &gViewerArt, - &gImageList, + LLUIImageList::getInstance(), ui_audio_callback, &LLUI::sGLScaleFactor); LLWeb::initClass(); // do this after LLUI - gUICtrlFactory->setupPaths(); // update paths with correct language set + LLUICtrlFactory::getInstance()->setupPaths(); // update paths with correct language set ///////////////////////////////////////////////// // @@ -740,7 +731,7 @@ bool LLAppViewer::init() MemSetErrorHandler(first_mem_error_handler); #endif // LL_WINDOWS && LL_RELEASE_FOR_DOWNLOAD && LL_USE_SMARTHEAP - gViewerStats = new LLViewerStats(); + // *Note: this is where gViewerStats used to be created. // // Initialize the VFS, and gracefully handle initialization errors @@ -829,7 +820,7 @@ bool LLAppViewer::init() minRAMString >> minRAM; minRAM = minRAM * 1024 * 1024; - if(!gFeatureManagerp->isGPUSupported()) + if(!LLFeatureManager::getInstance()->isGPUSupported()) { minSpecs += LLAlertDialog::getTemplateMessage("UnsupportedGPU"); minSpecs += "\n"; @@ -878,9 +869,7 @@ bool LLAppViewer::mainLoop() LLHTTPClient::setPump(*gServicePump); LLCurl::setCAFile(gDirUtilp->getCAFile()); - // initialize voice stuff here - gLocalSpeakerMgr = new LLLocalSpeakerMgr(); - gActiveChannelSpeakerMgr = new LLActiveSpeakerMgr(); + // Note: this is where gLocalSpeakerMgr and gActiveSpeakerMgr used to be instantiated. LLVoiceChannel::initClass(); LLVoiceClient::init(gServicePump); @@ -1097,15 +1086,9 @@ bool LLAppViewer::cleanup() gTransferManager.cleanup(); #endif - // Clean up map data storage - delete gWorldMap; - gWorldMap = NULL; + // Note: this is where gWorldMap used to be deleted. - delete gHUDManager; - gHUDManager = NULL; - - delete gToolMgr; - gToolMgr = NULL; + // Note: this is where gHUDManager used to be deleted. delete gAssetStorage; gAssetStorage = NULL; @@ -1115,17 +1098,12 @@ bool LLAppViewer::cleanup() delete gCacheName; gCacheName = NULL; - delete gGlobalEconomy; - gGlobalEconomy = NULL; - - delete gActiveChannelSpeakerMgr; - gActiveChannelSpeakerMgr = NULL; - - delete gLocalSpeakerMgr; - gLocalSpeakerMgr = NULL; + // Note: this is where gLocalSpeakerMgr and gActiveSpeakerMgr used to be deleted. LLNotifyBox::cleanup(); + LLWorldMap::getInstance()->reset(); // release any images + llinfos << "Global stuff deleted" << llendflush; #if !LL_RELEASE_FOR_DOWNLOAD @@ -1139,9 +1117,7 @@ bool LLAppViewer::cleanup() llwarns << "Hack, skipping audio engine cleanup" << llendflush; #endif - llinfos << "Cleaning up feature manager" << llendflush; - delete gFeatureManagerp; - gFeatureManagerp = NULL; + // Note: this is where LLFeatureManager::getInstance()-> used to be deleted. // Patch up settings for next time // Must do this before we delete the viewer window, @@ -1224,8 +1200,7 @@ bool LLAppViewer::cleanup() LLViewerParcelMgr::cleanupGlobals(); - delete gViewerStats; - gViewerStats = NULL; + // *Note: this is where gViewerStats used to be deleted. //end_messaging_system(); @@ -1258,25 +1233,15 @@ bool LLAppViewer::cleanup() // save all settings, even if equals defaults gCrashSettings.saveToFile(crash_settings_filename.c_str(), FALSE); - delete gUICtrlFactory; - gUICtrlFactory = NULL; - gSavedSettings.cleanup(); - gViewerArt.cleanup(); gColors.cleanup(); gCrashSettings.cleanup(); // Save URL history file LLURLHistory::saveFile("url_history.xml"); - if (gMuteListp) - { - // save mute list - gMuteListp->cache(gAgent.getID()); - - delete gMuteListp; - gMuteListp = NULL; - } + // save mute list. gMuteList used to also be deleted here too. + LLMuteList::getInstance()->cache(gAgent.getID()); if (mPurgeOnExit) { @@ -1536,9 +1501,15 @@ bool LLAppViewer::initConfiguration() // *before* the user settings. Having to do this init here // seems odd. - // Need to do this before calling parseAlerts - gUICtrlFactory = new LLViewerUICtrlFactory(); + // This is where gUICtrlFactory used to be instantiated with a new LLUICtrlFactory + // which needed to happen before calling parseAlerts below. + // TODO: That method is still dependant upon the base LLUICtrlFactory constructor being called + // which registers some callbacks so I'm leaving in a call to getInstance here to cause that to + // still happen. This needs to be cleaned up later when the base and derived classes + // are planned to be combined. -MG + LLUICtrlFactory::getInstance(); + // Pre-load alerts.xml to define the warnings settings (always loads from skins/xui/en-us/) // Do this *before* loading the settings file LLAlertDialog::parseAlerts("alerts.xml", &gSavedSettings, TRUE); @@ -1783,10 +1754,7 @@ bool LLAppViewer::initConfiguration() LLVolumeMgr::initClass(); - // Initialize the feature manager - // The feature manager is responsible for determining what features - // are turned on/off in the app. - gFeatureManagerp = new LLFeatureManager; + // Note: this is where we used to initialize LLFeatureManager::getInstance()->. gStartTime = totalTime(); @@ -2194,10 +2162,8 @@ void LLAppViewer::handleViewerCrash() gMessageSystem->getCircuitInfo(gDebugInfo["CircuitInfo"]); gMessageSystem->stopLogging(); } - if (gWorldp) - { - gWorldp->getInfo(gDebugInfo); - } + + LLWorld::getInstance()->getInfo(gDebugInfo); // Close the debug file pApp->closeDebug(); @@ -2353,13 +2319,10 @@ void LLAppViewer::requestQuit() return; } - if (gHUDManager) - { - LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral*)gHUDManager->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE); - effectp->setPositionGlobal(gAgent.getPositionGlobal()); - effectp->setColor(LLColor4U(gAgent.getEffectColor())); - gHUDManager->sendEffects(); - } + LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral*)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE); + effectp->setPositionGlobal(gAgent.getPositionGlobal()); + effectp->setColor(LLColor4U(gAgent.getEffectColor())); + LLHUDManager::getInstance()->sendEffects(); // Attempt to close all floaters that might be // editing things. @@ -2922,7 +2885,7 @@ void LLAppViewer::idle() { LLFastTimer t(LLFastTimer::FTM_NETWORK); // Update spaceserver timeinfo - gWorldp->setSpaceTimeUSec(gWorldp->getSpaceTimeUSec() + (U32)(dt_raw * SEC_TO_MICROSEC)); + LLWorld::getInstance()->setSpaceTimeUSec(LLWorld::getInstance()->getSpaceTimeUSec() + (U32)(dt_raw * SEC_TO_MICROSEC)); ////////////////////////////////////// @@ -3056,7 +3019,7 @@ void LLAppViewer::idle() { // After agent and camera moved, figure out if we need to // deselect objects. - gSelectMgr->deselectAllIfTooFar(); + LLSelectMgr::getInstance()->deselectAllIfTooFar(); } @@ -3073,7 +3036,7 @@ void LLAppViewer::idle() if (!(logoutRequestSent() && hasSavedFinalSnapshot())) { - gObjectList.update(gAgent, *gWorldp); + gObjectList.update(gAgent, *LLWorld::getInstance()); } } @@ -3105,9 +3068,9 @@ void LLAppViewer::idle() { gFrameStats.start(LLFrameStats::UPDATE_EFFECTS); - gSelectMgr->updateEffects(); - gHUDManager->cleanupEffects(); - gHUDManager->sendEffects(); + LLSelectMgr::getInstance()->updateEffects(); + LLHUDManager::getInstance()->cleanupEffects(); + LLHUDManager::getInstance()->sendEffects(); } stop_glerror(); @@ -3127,11 +3090,11 @@ void LLAppViewer::idle() // Update surfaces, and surface textures as well. // - gWorldp->updateVisibilities(); + LLWorld::getInstance()->updateVisibilities(); { const F32 max_region_update_time = .001f; // 1ms LLFastTimer t(LLFastTimer::FTM_REGION_UPDATE); - gWorldp->updateRegions(max_region_update_time); + LLWorld::getInstance()->updateRegions(max_region_update_time); } ///////////////////////// @@ -3140,7 +3103,7 @@ void LLAppViewer::idle() // if (!gNoRender) { - gWorldp->updateClouds(gFrameDTClamped); + LLWorld::getInstance()->updateClouds(gFrameDTClamped); gSky.propagateHeavenlyBodies(gFrameDTClamped); // moves sun, moon, and planets // Update wind vector @@ -3148,7 +3111,7 @@ void LLAppViewer::idle() static LLVector3 average_wind; LLViewerRegion *regionp; - regionp = gWorldp->resolveRegionGlobal(wind_position_region, gAgent.getPositionGlobal()); // puts agent's local coords into wind_position + regionp = LLWorld::getInstance()->resolveRegionGlobal(wind_position_region, gAgent.getPositionGlobal()); // puts agent's local coords into wind_position if (regionp) { gWindVec = regionp->mWind.getVelocity(wind_position_region); @@ -3182,7 +3145,7 @@ void LLAppViewer::idle() gPipeline.updateMove(); gFrameStats.start(LLFrameStats::UPDATE_PARTICLES); - gWorldp->updateParticles(); + LLWorld::getInstance()->updateParticles(); } stop_glerror(); @@ -3449,9 +3412,9 @@ void LLAppViewer::disconnectViewer() } } - if (gSelectMgr) + if (LLSelectMgr::getInstance()) { - gSelectMgr->deselectAll(); + LLSelectMgr::getInstance()->deselectAll(); } if (!gNoRender) @@ -3472,9 +3435,9 @@ void LLAppViewer::disconnectViewer() // Also writes cached agent settings to gSavedSettings gAgent.cleanup(); - gObjectList.destroy(); - delete gWorldp; - gWorldp = NULL; + // This is where we used to call gObjectList.destroy() and then delete gWorldp. + // Now we just ask the LLWorld singleton to cleanly shut down. + LLWorld::getInstance()->destroyClass(); cleanup_xfer_manager(); gDisconnected = TRUE; diff --git a/indra/newview/llassetuploadresponders.cpp b/indra/newview/llassetuploadresponders.cpp index 76cfe92c4c..b43c9db40a 100644 --- a/indra/newview/llassetuploadresponders.cpp +++ b/indra/newview/llassetuploadresponders.cpp @@ -159,7 +159,7 @@ void LLAssetUploadResponder::uploadFailure(const LLSD& content) // deal with L$ errors if (reason == "insufficient funds") { - LLFloaterBuyCurrency::buyCurrency("Uploading costs", gGlobalEconomy->getPriceUpload()); + LLFloaterBuyCurrency::buyCurrency("Uploading costs", LLGlobalEconomy::Singleton::getInstance()->getPriceUpload()); } else { @@ -209,7 +209,7 @@ void LLNewAgentInventoryResponder::uploadComplete(const LLSD& content) gAgent.sendReliableMessage(); LLString::format_map_t args; - args["[AMOUNT]"] = llformat("%d",gGlobalEconomy->getPriceUpload()); + args["[AMOUNT]"] = llformat("%d",LLGlobalEconomy::Singleton::getInstance()->getPriceUpload()); LLNotifyBox::showXml("UploadPayment", args); } diff --git a/indra/newview/llaudiosourcevo.cpp b/indra/newview/llaudiosourcevo.cpp index fac2e7bff2..b7f4820a59 100644 --- a/indra/newview/llaudiosourcevo.cpp +++ b/indra/newview/llaudiosourcevo.cpp @@ -71,51 +71,49 @@ void LLAudioSourceVO::updateGain() } BOOL mute = FALSE; - if (gParcelMgr) - { - LLVector3d pos_global; + LLVector3d pos_global; - if (mObjectp->isAttachment()) + if (mObjectp->isAttachment()) + { + LLViewerObject* parent = mObjectp; + while (parent && !parent->isAvatar()) { - LLViewerObject* parent = mObjectp; - while (parent - && !parent->isAvatar()) - { - parent = (LLViewerObject*)parent->getParent(); - } - if (parent) - pos_global = parent->getPositionGlobal(); + parent = (LLViewerObject*)parent->getParent(); } - - else - pos_global = mObjectp->getPositionGlobal(); - - if (!gParcelMgr->canHearSound(pos_global)) + if (parent) { - mute = TRUE; + pos_global = parent->getPositionGlobal(); } } + else + { + pos_global = mObjectp->getPositionGlobal(); + } + + if (!LLViewerParcelMgr::getInstance()->canHearSound(pos_global)) + { + mute = TRUE; + } - if (!mute && gMuteListp) + if (!mute) { - if (gMuteListp->isMuted(mObjectp->getID())) + if (LLMuteList::getInstance()->isMuted(mObjectp->getID())) { mute = TRUE; } - else if (gMuteListp->isMuted(mOwnerID, LLMute::flagObjectSounds)) + else if (LLMuteList::getInstance()->isMuted(mOwnerID, LLMute::flagObjectSounds)) { mute = TRUE; } else if (mObjectp->isAttachment()) { LLViewerObject* parent = mObjectp; - while (parent - && !parent->isAvatar()) + while (parent && !parent->isAvatar()) { parent = (LLViewerObject*)parent->getParent(); } if (parent - && gMuteListp->isMuted(parent->getID())) + && LLMuteList::getInstance()->isMuted(parent->getID())) { mute = TRUE; } diff --git a/indra/newview/llchatbar.cpp b/indra/newview/llchatbar.cpp index 73c00c1d82..01b093e6f6 100644 --- a/indra/newview/llchatbar.cpp +++ b/indra/newview/llchatbar.cpp @@ -65,7 +65,7 @@ #include "llmultigesture.h" #include "llui.h" #include "llviewermenu.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" // @@ -125,7 +125,7 @@ BOOL LLChatBar::postBuild() childSetCommitCallback("Say", onClickSay, this); // attempt to bind to an existing combo box named gesture - setGestureCombo(LLUICtrlFactory::getComboBoxByName(this, "Gesture")); + setGestureCombo(getChild<LLComboBox>( "Gesture")); LLButton * sayp = getChild<LLButton>("Say"); if(sayp) @@ -133,7 +133,7 @@ BOOL LLChatBar::postBuild() setDefaultBtn(sayp); } - mInputEditor = LLUICtrlFactory::getLineEditorByName(this, "Chat Editor"); + mInputEditor = getChild<LLLineEditor>("Chat Editor"); if (mInputEditor) { mInputEditor->setCallbackUserData(this); @@ -159,36 +159,34 @@ BOOL LLChatBar::postBuild() //----------------------------------------------------------------------- // virtual -BOOL LLChatBar::handleKeyHere( KEY key, MASK mask, BOOL called_from_parent ) +BOOL LLChatBar::handleKeyHere( KEY key, MASK mask ) { BOOL handled = FALSE; - if( getVisible() && getEnabled() && !called_from_parent) + // ALT-RETURN is reserved for windowed/fullscreen toggle + if( KEY_RETURN == key ) { - // ALT-RETURN is reserved for windowed/fullscreen toggle - if( KEY_RETURN == key ) + if (mask == MASK_CONTROL) { - if (mask == MASK_CONTROL) - { - // shout - sendChat(CHAT_TYPE_SHOUT); - handled = TRUE; - } - else if (mask == MASK_NONE) - { - // say - sendChat( CHAT_TYPE_NORMAL ); - handled = TRUE; - } + // shout + sendChat(CHAT_TYPE_SHOUT); + handled = TRUE; } - // only do this in main chatbar - else if ( KEY_ESCAPE == key && gChatBar == this) + else if (mask == MASK_NONE) { - stopChat(); - + // say + sendChat( CHAT_TYPE_NORMAL ); handled = TRUE; } } + // only do this in main chatbar + else if ( KEY_ESCAPE == key && gChatBar == this) + { + stopChat(); + + handled = TRUE; + } + return handled; } @@ -633,7 +631,7 @@ void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 gAgent.sendReliableMessage(); - gViewerStats->incStat(LLViewerStats::ST_CHAT_COUNT); + LLViewerStats::getInstance()->incStat(LLViewerStats::ST_CHAT_COUNT); } diff --git a/indra/newview/llchatbar.h b/indra/newview/llchatbar.h index f677218dc1..c5cb741453 100644 --- a/indra/newview/llchatbar.h +++ b/indra/newview/llchatbar.h @@ -53,7 +53,7 @@ public: ~LLChatBar(); virtual BOOL postBuild(); - virtual BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent); + virtual BOOL handleKeyHere(KEY key, MASK mask); void refresh(); void refreshGestures(); diff --git a/indra/newview/llcloud.cpp b/indra/newview/llcloud.cpp index ee793bf6e4..f5cb5e8256 100644 --- a/indra/newview/llcloud.cpp +++ b/indra/newview/llcloud.cpp @@ -157,7 +157,7 @@ void LLCloudGroup::updatePuffOwnership() } //llinfos << "Cloud moving to new group" << llendl; - LLCloudGroup *new_cgp = gWorldPointer->findCloudGroup(mCloudPuffs[i]); + LLCloudGroup *new_cgp = LLWorld::getInstance()->findCloudGroup(mCloudPuffs[i]); if (!new_cgp) { //llinfos << "Killing puff not in group" << llendl; diff --git a/indra/newview/llcolorswatch.cpp b/indra/newview/llcolorswatch.cpp index caf506a21e..8571046c6e 100644 --- a/indra/newview/llcolorswatch.cpp +++ b/indra/newview/llcolorswatch.cpp @@ -50,6 +50,8 @@ #include "llviewerimagelist.h" #include "llfocusmgr.h" +static LLRegisterWidget<LLColorSwatchCtrl> r("color_swatch"); + LLColorSwatchCtrl::LLColorSwatchCtrl(const std::string& name, const LLRect& rect, const LLColor4& color, void (*commit_callback)(LLUICtrl* ctrl, void* userdata), void* userdata ) @@ -74,8 +76,7 @@ LLColorSwatchCtrl::LLColorSwatchCtrl(const std::string& name, const LLRect& rect mBorder = new LLViewBorder("border", border_rect, LLViewBorder::BEVEL_IN); addChild(mBorder); - mAlphaGradientImage = gImageList.getImageFromUUID(LLUUID(gViewerArt.getString("color_swatch_alpha.tga")), - MIPMAP_FALSE, TRUE, GL_ALPHA8, GL_ALPHA); + mAlphaGradientImage = LLUI::getUIImage("color_swatch_alpha.tga"); } LLColorSwatchCtrl::LLColorSwatchCtrl(const std::string& name, const LLRect& rect, const std::string& label, const LLColor4& color, @@ -102,8 +103,7 @@ LLColorSwatchCtrl::LLColorSwatchCtrl(const std::string& name, const LLRect& rect mBorder = new LLViewBorder("border", border_rect, LLViewBorder::BEVEL_IN); addChild(mBorder); - mAlphaGradientImage = gImageList.getImageFromUUID(LLUUID(gViewerArt.getString("color_swatch_alpha.tga")), - MIPMAP_FALSE, TRUE, GL_ALPHA8, GL_ALPHA); + mAlphaGradientImage = LLUI::getUIImage("color_swatch_alpha.tga"); } LLColorSwatchCtrl::~LLColorSwatchCtrl () @@ -129,13 +129,13 @@ BOOL LLColorSwatchCtrl::handleHover(S32 x, S32 y, MASK mask) return TRUE; } -BOOL LLColorSwatchCtrl::handleUnicodeCharHere(llwchar uni_char, BOOL called_from_parent) +BOOL LLColorSwatchCtrl::handleUnicodeCharHere(llwchar uni_char) { - if( getVisible() && getEnabled() && !called_from_parent && ' ' == uni_char ) + if( ' ' == uni_char ) { showPicker(TRUE); } - return LLUICtrl::handleUnicodeCharHere(uni_char, called_from_parent); + return LLUICtrl::handleUnicodeCharHere(uni_char); } // forces color of this swatch and any associated floater to the input value, if currently invalid @@ -203,46 +203,41 @@ BOOL LLColorSwatchCtrl::handleMouseUp(S32 x, S32 y, MASK mask) // assumes GL state is set for 2D void LLColorSwatchCtrl::draw() { - if( getVisible() ) - { - mBorder->setKeyboardFocusHighlight(hasFocus()); - // Draw border - LLRect border( 0, getRect().getHeight(), getRect().getWidth(), BTN_HEIGHT_SMALL ); - gl_rect_2d( border, mBorderColor, FALSE ); + mBorder->setKeyboardFocusHighlight(hasFocus()); + // Draw border + LLRect border( 0, getRect().getHeight(), getRect().getWidth(), BTN_HEIGHT_SMALL ); + gl_rect_2d( border, mBorderColor, FALSE ); - LLRect interior = border; - interior.stretch( -1 ); + LLRect interior = border; + interior.stretch( -1 ); - // Check state - if ( mValid ) + // Check state + if ( mValid ) + { + // Draw the color swatch + gl_rect_2d_checkerboard( interior ); + gl_rect_2d(interior, mColor, TRUE); + LLColor4 opaque_color = mColor; + opaque_color.mV[VALPHA] = 1.f; + gGL.color4fv(opaque_color.mV); + if (mAlphaGradientImage.notNull()) { - // Draw the color swatch - gl_rect_2d_checkerboard( interior ); - gl_rect_2d(interior, mColor, TRUE); - LLColor4 opaque_color = mColor; - opaque_color.mV[VALPHA] = 1.f; - gGL.color4fv(opaque_color.mV); - if (mAlphaGradientImage.notNull()) + gGL.pushMatrix(); { - gGL.pushMatrix(); - { - gGL.translatef((F32)interior.mLeft, (F32)interior.mBottom, 0.f); - LLViewerImage::bindTexture(mAlphaGradientImage); - gl_rect_2d_simple_tex(interior.getWidth(), interior.getHeight()); - } - gGL.popMatrix(); + mAlphaGradientImage->draw(interior, mColor); } + gGL.popMatrix(); } - else - { - // Draw grey and an X - gl_rect_2d(interior, LLColor4::grey, TRUE); - - gl_draw_x(interior, LLColor4::black); - } + } + else + { + // Draw grey and an X + gl_rect_2d(interior, LLColor4::grey, TRUE); - LLUICtrl::draw(); + gl_draw_x(interior, LLColor4::black); } + + LLUICtrl::draw(); } void LLColorSwatchCtrl::setEnabled( BOOL enabled ) diff --git a/indra/newview/llcolorswatch.h b/indra/newview/llcolorswatch.h index cc9b9ad017..4b69df8dbb 100644 --- a/indra/newview/llcolorswatch.h +++ b/indra/newview/llcolorswatch.h @@ -66,8 +66,7 @@ public: ~LLColorSwatchCtrl (); virtual void setValue(const LLSD& value); - virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_COLOR_SWATCH; } - virtual LLString getWidgetTag() const { return LL_COLOR_SWATCH_CTRL_TAG; } + virtual LLSD getValue() const { return mColor.getValue(); } const LLColor4& get() { return mColor; } @@ -85,7 +84,7 @@ public: virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); virtual BOOL handleDoubleClick(S32 x,S32 y,MASK mask); virtual BOOL handleHover(S32 x, S32 y, MASK mask); - virtual BOOL handleUnicodeCharHere(llwchar uni_char, BOOL called_from_parent); + virtual BOOL handleUnicodeCharHere(llwchar uni_char); virtual void draw(); virtual void setEnabled( BOOL enabled ); virtual LLXMLNodePtr getXML(bool save_children = true) const; @@ -104,7 +103,7 @@ protected: LLUICtrlCallback mOnCancelCallback; LLUICtrlCallback mOnSelectCallback; - LLPointer<LLViewerImage> mAlphaGradientImage; + LLPointer<LLUIImage> mAlphaGradientImage; }; #endif // LL_LLBUTTON_H diff --git a/indra/newview/llcompilequeue.cpp b/indra/newview/llcompilequeue.cpp index 087f8ac673..619b393d0b 100644 --- a/indra/newview/llcompilequeue.cpp +++ b/indra/newview/llcompilequeue.cpp @@ -56,7 +56,7 @@ #include "lldir.h" #include "llfloaterchat.h" #include "llviewerstats.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" ///---------------------------------------------------------------------------- /// Local function declarations, constants, enums, and typedefs @@ -106,7 +106,7 @@ LLFloaterScriptQueue::LLFloaterScriptQueue(const std::string& name, DRAG_ON_TOP, MINIMIZE_YES, CLOSE_YES) { - gUICtrlFactory->buildFloater(this,"floater_script_queue.xml"); + LLUICtrlFactory::getInstance()->buildFloater(this,"floater_script_queue.xml"); childSetAction("close",onCloseBtn,this); childSetEnabled("close",FALSE); @@ -201,7 +201,7 @@ BOOL LLFloaterScriptQueue::start() char buffer[MAX_STRING]; /*Flawfinder: ignore*/ snprintf(buffer, sizeof(buffer), "Starting %s of %d items.", mStartString, mObjectIDs.count()); /* Flawfinder: ignore */ - LLScrollListCtrl* list = LLUICtrlFactory::getScrollListByName(this, "queue output"); + LLScrollListCtrl* list = getChild<LLScrollListCtrl>("queue output"); list->addCommentText(buffer); return nextObject(); @@ -235,7 +235,7 @@ BOOL LLFloaterScriptQueue::nextObject() if(isDone() && !mDone) { - LLScrollListCtrl* list = LLUICtrlFactory::getScrollListByName(this, "queue output"); + LLScrollListCtrl* list = getChild<LLScrollListCtrl>("queue output"); mDone = TRUE; char buffer[MAX_STRING]; /*Flawfinder: ignore*/ @@ -412,10 +412,7 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id, } else { - if( gViewerStats ) - { - gViewerStats->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); - } + LLViewerStats::getInstance()->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status ) { @@ -442,7 +439,7 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id, } if(queue) { - LLScrollListCtrl* list = LLUICtrlFactory::getScrollListByName(queue, "queue output"); + LLScrollListCtrl* list = queue->getChild<LLScrollListCtrl>("queue output"); list->addCommentText(buffer); } delete data; @@ -621,7 +618,7 @@ void LLFloaterResetQueue::handleInventory(LLViewerObject* viewer_obj, if (object) { LLInventoryItem* item = (LLInventoryItem*)((LLInventoryObject*)(*it)); - LLScrollListCtrl* list = LLUICtrlFactory::getScrollListByName(this, "queue output"); + LLScrollListCtrl* list = getChild<LLScrollListCtrl>("queue output"); char buffer[MAX_STRING]; /*Flawfinder: ignore*/ snprintf(buffer, sizeof(buffer), "Resetting '%s'.", item->getName().c_str()); /* Flawfinder: ignore */ list->addCommentText(buffer); @@ -684,7 +681,7 @@ void LLFloaterRunQueue::handleInventory(LLViewerObject* viewer_obj, if (object) { LLInventoryItem* item = (LLInventoryItem*)((LLInventoryObject*)(*it)); - LLScrollListCtrl* list = LLUICtrlFactory::getScrollListByName(this, "queue output"); + LLScrollListCtrl* list = getChild<LLScrollListCtrl>("queue output"); char buffer[MAX_STRING]; /*Flawfinder: ignore*/ snprintf(buffer, sizeof(buffer), "Running '%s'.", item->getName().c_str()); /* Flawfinder: ignore */ list->addCommentText(buffer); @@ -749,7 +746,7 @@ void LLFloaterNotRunQueue::handleInventory(LLViewerObject* viewer_obj, if (object) { LLInventoryItem* item = (LLInventoryItem*)((LLInventoryObject*)(*it)); - LLScrollListCtrl* list = LLUICtrlFactory::getScrollListByName(this, "queue output"); + LLScrollListCtrl* list = getChild<LLScrollListCtrl>("queue output"); char buffer[MAX_STRING]; /*Flawfinder: ignore*/ snprintf(buffer, sizeof(buffer), "Not running '%s'.", item->getName().c_str()); /* Flawfinder: ignore */ list->addCommentText(buffer); diff --git a/indra/newview/llcurrencyuimanager.cpp b/indra/newview/llcurrencyuimanager.cpp index 61ff316a2f..6aee25deca 100644 --- a/indra/newview/llcurrencyuimanager.cpp +++ b/indra/newview/llcurrencyuimanager.cpp @@ -349,7 +349,7 @@ void LLCurrencyUIManager::Impl::onCurrencyKey( void LLCurrencyUIManager::Impl::prepare() { - LLLineEditor* lindenAmount = LLUICtrlFactory::getLineEditorByName(&mPanel,"currency_amt"); + LLLineEditor* lindenAmount = mPanel.getChild<LLLineEditor>("currency_amt"); if (lindenAmount) { lindenAmount->setPrevalidate(LLLineEditor::prevalidateNonNegativeS32); @@ -370,7 +370,7 @@ void LLCurrencyUIManager::Impl::updateUI() mPanel.childShow("currency_action"); - LLLineEditor* lindenAmount = LLUICtrlFactory::getLineEditorByName(&mPanel,"currency_amt"); + LLLineEditor* lindenAmount = mPanel.getChild<LLLineEditor>("currency_amt"); if (lindenAmount) { lindenAmount->setVisible(true); diff --git a/indra/newview/lldebugview.cpp b/indra/newview/lldebugview.cpp index 3fb7da7baa..4aeb1d74bf 100644 --- a/indra/newview/lldebugview.cpp +++ b/indra/newview/lldebugview.cpp @@ -131,13 +131,3 @@ LLDebugView::~LLDebugView() gTextureView = NULL; } -EWidgetType LLDebugView::getWidgetType() const -{ - return WIDGET_TYPE_DEBUG_VIEW; -} - -LLString LLDebugView::getWidgetTag() const -{ - return LL_DEBUG_VIEW_TAG; -} - diff --git a/indra/newview/lldebugview.h b/indra/newview/lldebugview.h index 36d367e40d..7678ad543a 100644 --- a/indra/newview/lldebugview.h +++ b/indra/newview/lldebugview.h @@ -54,9 +54,6 @@ public: LLDebugView(const std::string& name, const LLRect &rect); ~LLDebugView(); - virtual EWidgetType getWidgetType() const; - virtual LLString getWidgetTag() const; - LLFrameStatView* mFrameStatView; LLFastTimerView* mFastTimerView; LLMemoryView* mMemoryView; diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index fd36ed666d..b73ea09a0c 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -85,7 +85,7 @@ LLDynamicArrayPtr<LLPointer<LLDrawable> > LLDrawable::sDeadList; void LLDrawable::incrementVisible() { sCurVisible++; - sCurPixelAngle = (F32) gViewerWindow->getWindowDisplayHeight()/gCamera->getView(); + sCurPixelAngle = (F32) gViewerWindow->getWindowDisplayHeight()/LLViewerCamera::getInstance()->getView(); } void LLDrawable::init() { diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 4428854369..d22c459278 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -208,7 +208,7 @@ void LLDrawPoolAlpha::renderGroupAlpha(LLSpatialGroup* group, U32 type, U32 mask // and it's close if(is_particle && !gSavedSettings.getBOOL("RenderUseShaderNearParticles")) { - if((dist < gCamera->getFar() * gSavedSettings.getF32("RenderShaderParticleThreshold"))) + if((dist < LLViewerCamera::getInstance()->getFar() * gSavedSettings.getF32("RenderShaderParticleThreshold"))) { use_shaders = FALSE; } diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 316c002c1b..6db67fb269 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -463,7 +463,7 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass) if ((sShaderLevel >= SHADER_LEVEL_CLOTH)) { LLMatrix4 rot_mat; - gCamera->getMatrixToLocal(rot_mat); + LLViewerCamera::getInstance()->getMatrixToLocal(rot_mat); LLMatrix4 cfr(OGL_TO_CFR_ROTATION); rot_mat *= cfr; diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index f4bc157168..4a9d8d1ec9 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -141,7 +141,12 @@ void LLStandardBumpmap::restoreGL() // llinfos << "Loading bumpmap: " << bump_file << " from viewerart" << llendl; gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mLabel = label; - gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage = gImageList.getImage( LLUUID(gViewerArt.getString(bump_file)) ); + gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage = + gImageList.getImageFromFile(bump_file, + TRUE, + FALSE, + 0, + 0); LLStandardBumpmap::sStandardBumpmapCount++; } diff --git a/indra/newview/lldrawpoolground.cpp b/indra/newview/lldrawpoolground.cpp index 31c4e4fde9..d71c6de9cd 100644 --- a/indra/newview/lldrawpoolground.cpp +++ b/indra/newview/lldrawpoolground.cpp @@ -79,7 +79,7 @@ void LLDrawPoolGround::render(S32 pass) F32 water_height = gAgent.getRegion()->getWaterHeight(); glPushMatrix(); - LLVector3 origin = gCamera->getOrigin(); + LLVector3 origin = LLViewerCamera::getInstance()->getOrigin(); glTranslatef(origin.mV[0], origin.mV[1], llmax(origin.mV[2], water_height)); LLFace *facep = mDrawFace[0]; diff --git a/indra/newview/lldrawpoolsky.cpp b/indra/newview/lldrawpoolsky.cpp index 9276ee50e1..d3273f2eeb 100644 --- a/indra/newview/lldrawpoolsky.cpp +++ b/indra/newview/lldrawpoolsky.cpp @@ -103,14 +103,14 @@ void LLDrawPoolSky::render(S32 pass) LLGLClampToFarClip far_clip(glh_get_current_projection()); - LLGLEnable fog_enable( (mVertexShaderLevel < 1 && gCamera->cameraUnderWater()) ? GL_FOG : 0); + LLGLEnable fog_enable( (mVertexShaderLevel < 1 && LLViewerCamera::getInstance()->cameraUnderWater()) ? GL_FOG : 0); gPipeline.disableLights(); LLGLDisable clip(GL_CLIP_PLANE0); glPushMatrix(); - LLVector3 origin = gCamera->getOrigin(); + LLVector3 origin = LLViewerCamera::getInstance()->getOrigin(); glTranslatef(origin.mV[0], origin.mV[1], origin.mV[2]); glEnableClientState(GL_VERTEX_ARRAY); diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp index d8ebf33d38..634b502057 100644 --- a/indra/newview/lldrawpoolterrain.cpp +++ b/indra/newview/lldrawpoolterrain.cpp @@ -68,13 +68,15 @@ LLDrawPoolTerrain::LLDrawPoolTerrain(LLViewerImage *texturep) : // Hack! sDetailScale = 1.f/gSavedSettings.getF32("RenderTerrainScale"); sDetailMode = gSavedSettings.getS32("RenderTerrainDetail"); - mAlphaRampImagep = gImageList.getImageFromUUID(LLUUID(gViewerArt.getString("alpha_gradient.tga")), - TRUE, TRUE, GL_ALPHA8, GL_ALPHA); + mAlphaRampImagep = gImageList.getImageFromFile("alpha_gradient.tga", + TRUE, TRUE, GL_ALPHA8, GL_ALPHA, + LLUUID("e97cf410-8e61-7005-ec06-629eba4cd1fb")); mAlphaRampImagep->bind(0); mAlphaRampImagep->setClamp(TRUE, TRUE); - m2DAlphaRampImagep = gImageList.getImageFromUUID(LLUUID(gViewerArt.getString("alpha_gradient_2d.tga")), - TRUE, TRUE, GL_ALPHA8, GL_ALPHA); + m2DAlphaRampImagep = gImageList.getImageFromFile("alpha_gradient_2d.j2c", + TRUE, TRUE, GL_ALPHA8, GL_ALPHA, + LLUUID("38b86f85-2575-52a9-a531-23108d8da837")); m2DAlphaRampImagep->bind(0); m2DAlphaRampImagep->setClamp(TRUE, TRUE); diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index 4dfe725731..f4e22a57f6 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -75,8 +75,7 @@ LLDrawPoolWater::LLDrawPoolWater() : mHBTex[1]->setClamp(TRUE, TRUE); mWaterImagep = gImageList.getImage(WATER_TEST); - //mWaterNormp = gImageList.getImage(LLUUID(gViewerArt.getString("water_normal.tga"))); - mWaterNormp = gImageList.getImage(LLWaterParamManager::instance()->getNormalMapID()); + mWaterNormp = gImageList.getImage(DEFAULT_WATER_NORMAL); restoreGL(); } @@ -100,7 +99,7 @@ LLDrawPool *LLDrawPoolWater::instancePool() void LLDrawPoolWater::prerender() { - mVertexShaderLevel = (gGLManager.mHasCubeMap && gFeatureManagerp->isFeatureAvailable("RenderCubeMap")) ? + mVertexShaderLevel = (gGLManager.mHasCubeMap && LLFeatureManager::getInstance()->isFeatureAvailable("RenderCubeMap")) ? LLShaderMgr::getVertexShaderLevel(LLShaderMgr::SHADER_WATER) : 0; // got rid of modulation by light color since it got a little too @@ -112,7 +111,7 @@ void LLDrawPoolWater::prerender() S32 LLDrawPoolWater::getNumPasses() { - if (gCamera->getOrigin().mV[2] < 1024.f) + if (LLViewerCamera::getInstance()->getOrigin().mV[2] < 1024.f) { return 1; } @@ -177,11 +176,11 @@ void LLDrawPoolWater::render(S32 pass) glDisableClientState(GL_TEXTURE_COORD_ARRAY); glEnable(GL_TEXTURE_2D); // Texture unit 1 - LLVector3 camera_up = gCamera->getUpAxis(); + LLVector3 camera_up = LLViewerCamera::getInstance()->getUpAxis(); F32 up_dot = camera_up * LLVector3::z_axis; LLColor4 water_color; - if (gCamera->cameraUnderWater()) + if (LLViewerCamera::getInstance()->cameraUnderWater()) { water_color.setVec(1.f, 1.f, 1.f, 0.4f); } @@ -261,7 +260,7 @@ void LLDrawPoolWater::render(S32 pass) glMatrixMode(GL_TEXTURE); glLoadIdentity(); - LLMatrix4 camera_mat = gCamera->getModelview(); + LLMatrix4 camera_mat = LLViewerCamera::getInstance()->getModelview(); LLMatrix4 camera_rot(camera_mat.getMat3()); camera_rot.invert(); @@ -405,7 +404,7 @@ void LLDrawPoolWater::shade() LLGLSLShader* shader; - F32 eyedepth = gCamera->getOrigin().mV[2] - gAgent.getRegion()->getWaterHeight(); + F32 eyedepth = LLViewerCamera::getInstance()->getOrigin().mV[2] - gAgent.getRegion()->getWaterHeight(); if (eyedepth < 0.f && LLPipeline::sWaterReflections) { @@ -488,7 +487,7 @@ void LLDrawPoolWater::shade() //shader->uniformMatrix4fv("inverse_ref", 1, GL_FALSE, (GLfloat*) gGLObliqueProjectionInverse.mMatrix); shader->uniform1f(LLShaderMgr::WATER_WATERHEIGHT, eyedepth); shader->uniform1f(LLShaderMgr::WATER_TIME, sTime); - shader->uniform3fv(LLShaderMgr::WATER_EYEVEC, 1, gCamera->getOrigin().mV); + shader->uniform3fv(LLShaderMgr::WATER_EYEVEC, 1, LLViewerCamera::getInstance()->getOrigin().mV); shader->uniform3fv(LLShaderMgr::WATER_SPECULAR, 1, light_diffuse.mV); shader->uniform1f(LLShaderMgr::WATER_SPECULAR_EXP, light_exp); shader->uniform2fv(LLShaderMgr::WATER_WAVE_DIR1, 1, param_mgr->getWave1Dir().mV); @@ -508,9 +507,9 @@ void LLDrawPoolWater::shade() shader->uniform1f("sunAngle2", 0.1f + 0.2f*sunAngle); LLColor4 water_color; - LLVector3 camera_up = gCamera->getUpAxis(); + LLVector3 camera_up = LLViewerCamera::getInstance()->getUpAxis(); F32 up_dot = camera_up * LLVector3::z_axis; - if (gCamera->cameraUnderWater()) + if (LLViewerCamera::getInstance()->cameraUnderWater()) { water_color.setVec(1.f, 1.f, 1.f, 0.4f); shader->uniform1f(LLShaderMgr::WATER_REFSCALE, param_mgr->getScaleBelow()); diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index e080e4e29b..ee0d9e58ad 100644 --- a/indra/newview/lldrawpoolwlsky.cpp +++ b/indra/newview/lldrawpoolwlsky.cpp @@ -96,7 +96,7 @@ void LLDrawPoolWLSky::endRenderPass( S32 pass ) void LLDrawPoolWLSky::renderDome(F32 camHeightLocal, LLGLSLShader * shader) const { - LLVector3 const & origin = gCamera->getOrigin(); + LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin(); llassert_always(NULL != shader); @@ -288,7 +288,7 @@ void LLDrawPoolWLSky::render(S32 pass) renderSkyHaze(camHeightLocal); - LLVector3 const & origin = gCamera->getOrigin(); + LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin(); glPushMatrix(); glTranslatef(origin.mV[0], origin.mV[1], origin.mV[2]); diff --git a/indra/newview/lldynamictexture.cpp b/indra/newview/lldynamictexture.cpp index c925cc058c..24ee701ff2 100644 --- a/indra/newview/lldynamictexture.cpp +++ b/indra/newview/lldynamictexture.cpp @@ -148,11 +148,11 @@ void LLDynamicTexture::preRender(BOOL clear_depth) LLImageGL::unbindTexture(0, GL_TEXTURE_2D); } // Set up camera - mCamera.setOrigin(*gCamera); - mCamera.setAxes(*gCamera); - mCamera.setAspect(gCamera->getAspect()); - mCamera.setView(gCamera->getView()); - mCamera.setNear(gCamera->getNear()); + mCamera.setOrigin(*LLViewerCamera::getInstance()); + mCamera.setAxes(*LLViewerCamera::getInstance()); + mCamera.setAspect(LLViewerCamera::getInstance()->getAspect()); + mCamera.setView(LLViewerCamera::getInstance()->getView()); + mCamera.setNear(LLViewerCamera::getInstance()->getNear()); glViewport(mOrigin.mX, mOrigin.mY, mWidth, mHeight); if (clear_depth) @@ -177,11 +177,11 @@ void LLDynamicTexture::postRender(BOOL success) gViewerWindow->setupViewport(); // restore camera - gCamera->setOrigin(mCamera); - gCamera->setAxes(mCamera); - gCamera->setAspect(mCamera.getAspect()); - gCamera->setView(mCamera.getView()); - gCamera->setNear(mCamera.getNear()); + LLViewerCamera::getInstance()->setOrigin(mCamera); + LLViewerCamera::getInstance()->setAxes(mCamera); + LLViewerCamera::getInstance()->setAspect(mCamera.getAspect()); + LLViewerCamera::getInstance()->setView(mCamera.getView()); + LLViewerCamera::getInstance()->setNear(mCamera.getNear()); } //----------------------------------------------------------------------------- diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 3e8d518c02..2157b50eb5 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -471,10 +471,8 @@ void LLFace::renderSelected(LLImageGL *imagep, const LLColor4& color, const S32 void LLFace::renderSelectedUV(const S32 offset, const S32 count) { #if 0 - LLUUID uv_img_red_blue_id(gViewerArt.getString("uv_test1.tga")); - LLUUID uv_img_green_id(gViewerArt.getString("uv_test2.tga")); - LLViewerImage* red_blue_imagep = gImageList.getImage(uv_img_red_blue_id, TRUE, TRUE); - LLViewerImage* green_imagep = gImageList.getImage(uv_img_green_id, TRUE, TRUE); + LLViewerImage* red_blue_imagep = gImageList.getImageFromFile("uv_test1.j2c", TRUE, TRUE); + LLViewerImage* green_imagep = gImageList.getImageFromFile("uv_test2.tga", TRUE, TRUE); LLGLSObjectSelect object_select; LLGLEnable blend(GL_BLEND); diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp index f0ac46b7d6..5ebf599583 100644 --- a/indra/newview/llfasttimerview.cpp +++ b/indra/newview/llfasttimerview.cpp @@ -270,16 +270,6 @@ LLFastTimerView::~LLFastTimerView() delete[] mBarEnd; } -EWidgetType LLFastTimerView::getWidgetType() const -{ - return WIDGET_TYPE_FAST_TIMER_VIEW; -} - -LLString LLFastTimerView::getWidgetTag() const -{ - return LL_FAST_TIMER_VIEW_TAG; -} - BOOL LLFastTimerView::handleRightMouseDown(S32 x, S32 y, MASK mask) { if (mBarRect.pointInRect(x, y)) @@ -408,14 +398,10 @@ BOOL LLFastTimerView::handleHover(S32 x, S32 y, MASK mask) BOOL LLFastTimerView::handleScrollWheel(S32 x, S32 y, S32 clicks) { - if (getVisible() && pointInView(x, y)) - { - LLFastTimer::sPauseHistory = TRUE; - mScrollIndex = llclamp(mScrollIndex - clicks, - 0, llmin(LLFastTimer::sLastFrameIndex, (S32)LLFastTimer::FTM_HISTORY_NUM-MAX_VISIBLE_HISTORY)); - return TRUE; - } - return FALSE; + LLFastTimer::sPauseHistory = TRUE; + mScrollIndex = llclamp(mScrollIndex - clicks, + 0, llmin(LLFastTimer::sLastFrameIndex, (S32)LLFastTimer::FTM_HISTORY_NUM-MAX_VISIBLE_HISTORY)); + return TRUE; } void LLFastTimerView::draw() @@ -437,7 +423,7 @@ void LLFastTimerView::draw() S32 left, top, right, bottom; S32 x, y, barw, barh, dx, dy; S32 texth, textw; - LLViewerImage* box_imagep = gImageList.getImage(LLUUID(gViewerArt.getString("rounded_square.tga")), MIPMAP_FALSE, TRUE); + LLPointer<LLUIImage> box_imagep = LLUI::getUIImage("rounded_square.tga"); // Make sure all timers are accounted for // Set 'FTM_OTHER' to unaccounted ticks last frame @@ -806,7 +792,7 @@ void LLFastTimerView::draw() // Draw bars for each history entry // Special: -1 = show running average - LLViewerImage::bindTexture(box_imagep); + LLViewerImage::bindTexture(box_imagep->getImage()); for (S32 j=-1; j<histmax && y > LINE_GRAPH_HEIGHT; j++) { int sublevel_dx[FTV_DISPLAY_NUM+1]; @@ -938,7 +924,7 @@ void LLFastTimerView::draw() gGL.color4fv(color.mV); F32 start_fragment = llclamp((F32)(left - sublevel_left[level]) / (F32)sublevel_dx[level], 0.f, 1.f); F32 end_fragment = llclamp((F32)(right - sublevel_left[level]) / (F32)sublevel_dx[level], 0.f, 1.f); - gl_segmented_rect_2d_fragment_tex(sublevel_left[level], top - level + scale_offset, sublevel_right[level], bottom + level - scale_offset, box_imagep->getWidth(), box_imagep->getHeight(), 16, start_fragment, end_fragment); + gl_segmented_rect_2d_fragment_tex(sublevel_left[level], top - level + scale_offset, sublevel_right[level], bottom + level - scale_offset, box_imagep->getTextureWidth(), box_imagep->getTextureHeight(), 16, start_fragment, end_fragment); } diff --git a/indra/newview/llfasttimerview.h b/indra/newview/llfasttimerview.h index d47cc003ac..3a1f99a9ae 100644 --- a/indra/newview/llfasttimerview.h +++ b/indra/newview/llfasttimerview.h @@ -41,9 +41,6 @@ public: LLFastTimerView(const std::string& name, const LLRect& rect); virtual ~LLFastTimerView(); - virtual EWidgetType getWidgetType() const; - virtual LLString getWidgetTag() const; - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp index e6fcfb6d40..4d8dbbebac 100644 --- a/indra/newview/llfeaturemanager.cpp +++ b/indra/newview/llfeaturemanager.cpp @@ -75,8 +75,6 @@ const char FEATURE_TABLE_FILENAME[] = "featuretable.txt"; const char GPU_TABLE_FILENAME[] = "gpu_table.txt"; -LLFeatureManager *gFeatureManagerp = NULL; - LLFeatureInfo::LLFeatureInfo(const char *name, const BOOL available, const F32 level) : mValid(TRUE) { mName = name; diff --git a/indra/newview/llfeaturemanager.h b/indra/newview/llfeaturemanager.h index 3d05bbe2e0..927f4ada45 100644 --- a/indra/newview/llfeaturemanager.h +++ b/indra/newview/llfeaturemanager.h @@ -1,6 +1,6 @@ /** * @file llfeaturemanager.h - * @brief LLFeatureManager class definition + * @brief The feature manager is responsible for determining what features are turned on/off in the app. * * $LicenseInfo:firstyear=2003&license=viewergpl$ * @@ -94,7 +94,7 @@ protected: }; -class LLFeatureManager : public LLFeatureList +class LLFeatureManager : public LLFeatureList, public LLSingleton<LLFeatureManager> { public: LLFeatureManager() : mInited(FALSE), mTableVersion(0), mSafe(FALSE), mGPUClass(GPU_CLASS_UNKNOWN) {} @@ -148,6 +148,5 @@ protected: BOOL mGPUSupported; }; -extern LLFeatureManager *gFeatureManagerp; #endif // LL_LLFEATUREMANAGER_H diff --git a/indra/newview/llflexibleobject.cpp b/indra/newview/llflexibleobject.cpp index f69f66bce2..b700faeccc 100644 --- a/indra/newview/llflexibleobject.cpp +++ b/indra/newview/llflexibleobject.cpp @@ -246,7 +246,6 @@ void LLVolumeImplFlexible::setAttributesOfAllSections() void LLVolumeImplFlexible::onSetVolume(const LLVolumeParams &volume_params, const S32 detail) { - } //--------------------------------------------------------------------------------- @@ -280,7 +279,7 @@ BOOL LLVolumeImplFlexible::doIdleUpdate(LLAgent &agent, LLWorld &world, const F6 F32 app_angle = llround((F32) atan2( mVO->getScale().mV[2]*2.f, mVO->mDrawable->mDistanceWRTCamera) * RAD_TO_DEG, 0.01f); // Rendering sections increases with visible angle on the screen - mRenderRes = (S32)(FLEXIBLE_OBJECT_MAX_SECTIONS*4*app_angle*DEG_TO_RAD/gCamera->getView()); + mRenderRes = (S32)(FLEXIBLE_OBJECT_MAX_SECTIONS*4*app_angle*DEG_TO_RAD/LLViewerCamera::getInstance()->getView()); if (mRenderRes > FLEXIBLE_OBJECT_MAX_SECTIONS) { mRenderRes = FLEXIBLE_OBJECT_MAX_SECTIONS; @@ -330,7 +329,7 @@ BOOL LLVolumeImplFlexible::doIdleUpdate(LLAgent &agent, LLWorld &world, const F6 id = parent->getVolumeInterfaceID(); } - U32 update_period = (U32) (gCamera->getScreenPixelArea()*0.01f/(pixel_area*(sUpdateFactor+1.f)))+1; + U32 update_period = (U32) (LLViewerCamera::getInstance()->getScreenPixelArea()*0.01f/(pixel_area*(sUpdateFactor+1.f)))+1; if ((LLDrawable::getCurrentFrame()+id)%update_period == 0) { @@ -359,7 +358,7 @@ void LLVolumeImplFlexible::doFlexibleUpdate() if (mSimulateRes == 0) { mVO->markForUpdate(TRUE); - if (!doIdleUpdate(gAgent, *gWorldp, 0.0)) + if (!doIdleUpdate(gAgent, *LLWorld::getInstance(), 0.0)) { return; // we did not get updated or initialized, proceeding without can be dangerous } diff --git a/indra/newview/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp index 60385b8ca5..62fe68f67a 100644 --- a/indra/newview/llfloaterabout.cpp +++ b/indra/newview/llfloaterabout.cpp @@ -46,7 +46,7 @@ #include "llviewerregion.h" #include "llversionviewer.h" #include "llviewerbuild.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llappviewer.h" #include "llglheaders.h" #include "llmediamanager.h" @@ -70,7 +70,7 @@ LLFloaterAbout* LLFloaterAbout::sInstance = NULL; LLFloaterAbout::LLFloaterAbout() : LLFloater("floater_about", "FloaterAboutRect", "") { - gUICtrlFactory->buildFloater(this, "floater_about.xml"); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_about.xml"); // Support for changing product name. LLString title("About "); @@ -157,13 +157,12 @@ LLFloaterAbout::LLFloaterAbout() } } - if (gViewerStats - && gPacketsIn > 0) + if (gPacketsIn > 0) { LLString packet_loss = llformat("Packets Lost: %.0f/%.0f (%.1f%%)", - gViewerStats->mPacketsLostStat.getCurrent(), + LLViewerStats::getInstance()->mPacketsLostStat.getCurrent(), F32(gPacketsIn), - 100.f*gViewerStats->mPacketsLostStat.getCurrent() / F32(gPacketsIn) ); + 100.f*LLViewerStats::getInstance()->mPacketsLostStat.getCurrent() / F32(gPacketsIn) ); support.append(packet_loss); support.append("\n"); } diff --git a/indra/newview/llfloateranimpreview.cpp b/indra/newview/llfloateranimpreview.cpp index d966f0d3c8..afa3fcddbe 100644 --- a/indra/newview/llfloateranimpreview.cpp +++ b/indra/newview/llfloateranimpreview.cpp @@ -61,7 +61,7 @@ #include "llviewermenufile.h" // upload_new_resource() #include "llvoavatar.h" #include "pipeline.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" S32 LLFloaterAnimPreview::sUploadAmount = 10; @@ -143,7 +143,7 @@ BOOL LLFloaterAnimPreview::postBuild() S32 btn_left = PREVIEW_HPAD; r.set( btn_left, y, btn_left + 32, y - BTN_HEIGHT ); - mPlayButton = LLViewerUICtrlFactory::getButtonByName(this, "play_btn"); + mPlayButton = getChild<LLButton>( "play_btn"); if (!mPlayButton) { mPlayButton = new LLButton("play_btn", LLRect(0,0,0,0)); @@ -157,7 +157,7 @@ BOOL LLFloaterAnimPreview::postBuild() mPlayButton->setScaleImage(TRUE); - mStopButton = LLViewerUICtrlFactory::getButtonByName(this, "stop_btn"); + mStopButton = getChild<LLButton>( "stop_btn"); if (!mStopButton) { mStopButton = new LLButton("stop_btn", LLRect(0,0,0,0)); @@ -265,7 +265,7 @@ BOOL LLFloaterAnimPreview::postBuild() //temp.mV[VZ] = 0.f; F32 pelvis_max_displacement = pelvis_offset + (temp.magVec() * 0.5f) + 1.f; - F32 camera_zoom = gCamera->getDefaultFOV() / (2.f * atan(pelvis_max_displacement / PREVIEW_CAMERA_DISTANCE)); + F32 camera_zoom = LLViewerCamera::getInstance()->getDefaultFOV() / (2.f * atan(pelvis_max_displacement / PREVIEW_CAMERA_DISTANCE)); mAnimPreview->setZoom(camera_zoom); @@ -1015,7 +1015,7 @@ LLPreviewAnimation::LLPreviewAnimation(S32 width, S32 height) : LLDynamicTexture mDummyAvatar->updateGeometry(mDummyAvatar->mDrawable); mDummyAvatar->startMotion(ANIM_AGENT_STAND, 5.f); mDummyAvatar->mSkirtLOD.setVisible(FALSE, TRUE); - gPipeline.markVisible(mDummyAvatar->mDrawable, *gCamera); + gPipeline.markVisible(mDummyAvatar->mDrawable, *LLViewerCamera::getInstance()); // stop extraneous animations mDummyAvatar->stopMotion( ANIM_AGENT_HEAD_ROT, TRUE ); @@ -1069,15 +1069,15 @@ BOOL LLPreviewAnimation::render() LLQuaternion(mCameraYaw, LLVector3::z_axis); LLQuaternion av_rot = avatarp->mRoot.getWorldRotation() * camera_rot; - gCamera->setOriginAndLookAt( + LLViewerCamera::getInstance()->setOriginAndLookAt( target_pos + ((LLVector3(mCameraDistance, 0.f, 0.f) + mCameraOffset) * av_rot), // camera LLVector3::z_axis, // up target_pos + (mCameraOffset * av_rot) ); // point of interest - gCamera->setView(gCamera->getDefaultFOV() / mCameraZoom); - gCamera->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mWidth, mHeight, FALSE); + LLViewerCamera::getInstance()->setView(LLViewerCamera::getInstance()->getDefaultFOV() / mCameraZoom); + LLViewerCamera::getInstance()->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mWidth, mHeight, FALSE); - mCameraRelPos = gCamera->getOrigin() - avatarp->mHeadp->getWorldPosition(); + mCameraRelPos = LLViewerCamera::getInstance()->getOrigin() - avatarp->mHeadp->getWorldPosition(); //avatarp->setAnimationData("LookAtPoint", (void *)&mCameraRelPos); diff --git a/indra/newview/llfloaterauction.cpp b/indra/newview/llfloaterauction.cpp index f1bba7d9c5..faa69f7a03 100644 --- a/indra/newview/llfloaterauction.cpp +++ b/indra/newview/llfloaterauction.cpp @@ -48,7 +48,7 @@ #include "llviewerimagelist.h" #include "llviewerparcelmgr.h" #include "llviewerregion.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llviewerwindow.h" #include "llviewerdisplay.h" #include "llviewercontrol.h" @@ -74,7 +74,7 @@ LLFloaterAuction::LLFloaterAuction() : LLFloater("floater_auction"), mParcelID(-1) { - gUICtrlFactory->buildFloater(this, "floater_auction.xml"); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_auction.xml"); childSetValue("fence_check", LLSD( gSavedSettings.getBOOL("AuctionShowFence") ) ); @@ -106,8 +106,8 @@ void LLFloaterAuction::show() void LLFloaterAuction::initialize() { - mParcelp = gParcelMgr->getParcelSelection(); - LLViewerRegion* region = gParcelMgr->getSelectionRegion(); + mParcelp = LLViewerParcelMgr::getInstance()->getParcelSelection(); + LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion(); LLParcel* parcelp = mParcelp->getParcel(); if(parcelp && region && !parcelp->getForSale()) { @@ -141,7 +141,7 @@ void LLFloaterAuction::draw() { LLFloater::draw(); - if(getVisible() && !isMinimized() && mImage.notNull()) + if(!isMinimized() && mImage.notNull()) { LLRect rect; if (childGetRect("snapshot_icon", rect)) diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp index a44b3b3755..0c1175b26c 100644 --- a/indra/newview/llfloateravatarpicker.cpp +++ b/indra/newview/llfloateravatarpicker.cpp @@ -41,7 +41,7 @@ #include "lllineeditor.h" #include "llscrolllistctrl.h" #include "lltextbox.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llagent.h" const S32 MIN_WIDTH = 200; @@ -88,7 +88,7 @@ LLFloaterAvatarPicker::LLFloaterAvatarPicker() : mCallback(NULL), mCallbackUserdata(NULL) { - gUICtrlFactory->buildFloater(this, "floater_avatar_picker.xml", NULL); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_avatar_picker.xml", NULL); } BOOL LLFloaterAvatarPicker::postBuild() @@ -98,7 +98,7 @@ BOOL LLFloaterAvatarPicker::postBuild() childSetAction("Find", onBtnFind, this); childDisable("Find"); - mListNames = LLViewerUICtrlFactory::getScrollListByName(this, "Names"); + mListNames = getChild<LLScrollListCtrl>("Names"); childSetDoubleClickCallback("Names",onBtnAdd); childSetCommitCallback("Names", onList, this); childDisable("Names"); @@ -115,7 +115,7 @@ BOOL LLFloaterAvatarPicker::postBuild() mListNames->addCommentText("No results"); } - mInventoryPanel = (LLInventoryPanel*)this->getCtrlByNameAndType("Inventory Panel", WIDGET_TYPE_INVENTORY_PANEL); + mInventoryPanel = getChild<LLInventoryPanel>("Inventory Panel"); if(mInventoryPanel) { mInventoryPanel->setFilterTypes(0x1 << LLInventoryType::IT_CALLINGCARD); @@ -388,7 +388,7 @@ void LLFloaterAvatarPicker::editKeystroke(LLLineEditor* caller, void* user_data) } // virtual -BOOL LLFloaterAvatarPicker::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent) +BOOL LLFloaterAvatarPicker::handleKeyHere(KEY key, MASK mask) { if (key == KEY_RETURN && mask == MASK_NONE) @@ -410,5 +410,5 @@ BOOL LLFloaterAvatarPicker::handleKeyHere(KEY key, MASK mask, BOOL called_from_p return TRUE; } - return LLFloater::handleKeyHere(key, mask, called_from_parent); + return LLFloater::handleKeyHere(key, mask); } diff --git a/indra/newview/llfloateravatarpicker.h b/indra/newview/llfloateravatarpicker.h index ace2d64d22..32e4c583c2 100644 --- a/indra/newview/llfloateravatarpicker.h +++ b/indra/newview/llfloateravatarpicker.h @@ -74,7 +74,7 @@ protected: void find(); void setAllowMultiple(BOOL allow_multiple); - virtual BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent); + virtual BOOL handleKeyHere(KEY key, MASK mask); protected: LLScrollListCtrl* mListNames; diff --git a/indra/newview/llfloateravatartextures.cpp b/indra/newview/llfloateravatartextures.cpp index f05f9a7b52..3870448652 100644 --- a/indra/newview/llfloateravatartextures.cpp +++ b/indra/newview/llfloateravatartextures.cpp @@ -35,7 +35,7 @@ #include "lltexturectrl.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llviewerobjectlist.h" #include "llvoavatar.h" @@ -55,7 +55,7 @@ LLFloaterAvatarTextures* LLFloaterAvatarTextures::show(const LLUUID &id) LLFloaterAvatarTextures* floaterp = new LLFloaterAvatarTextures(id); // Builds and adds to gFloaterView - gUICtrlFactory->buildFloater(floaterp, "floater_avatar_textures.xml"); + LLUICtrlFactory::getInstance()->buildFloater(floaterp, "floater_avatar_textures.xml"); gFloaterView->addChild(floaterp); floaterp->open(); /*Flawfinder: ignore*/ diff --git a/indra/newview/llfloaterbuildoptions.cpp b/indra/newview/llfloaterbuildoptions.cpp index 5e4cc89f8e..35add8d5b5 100644 --- a/indra/newview/llfloaterbuildoptions.cpp +++ b/indra/newview/llfloaterbuildoptions.cpp @@ -37,7 +37,7 @@ #include "llviewerprecompiledheaders.h" #include "llfloaterbuildoptions.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" // library includes #include "llfontgl.h" @@ -79,7 +79,7 @@ void LLFloaterBuildOptions::show(void*) { LLFloaterBuildOptions* floater = new LLFloaterBuildOptions(); - gUICtrlFactory->buildFloater(floater, "floater_build_options.xml"); + LLUICtrlFactory::getInstance()->buildFloater(floater, "floater_build_options.xml"); floater->open(); /*Flawfinder: ignore*/ } } diff --git a/indra/newview/llfloaterbump.cpp b/indra/newview/llfloaterbump.cpp index 2cf1f555ea..ce2d56612c 100644 --- a/indra/newview/llfloaterbump.cpp +++ b/indra/newview/llfloaterbump.cpp @@ -36,7 +36,7 @@ #include "llscrolllistctrl.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llviewermessage.h" #include "llappviewer.h" // gPacificDaylightTime @@ -55,7 +55,7 @@ LLFloaterBump::LLFloaterBump() { sInstance = this; - gUICtrlFactory->buildFloater(this, "floater_bumps.xml"); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_bumps.xml"); } @@ -78,7 +78,7 @@ void LLFloaterBump::show(void *contents) sInstance = new LLFloaterBump(); } - LLScrollListCtrl* list = LLUICtrlFactory::getScrollListByName(sInstance, "bump_list"); + LLScrollListCtrl* list = sInstance->getChild<LLScrollListCtrl>("bump_list"); if (!list) return; list->deleteAllItems(); diff --git a/indra/newview/llfloaterbuy.cpp b/indra/newview/llfloaterbuy.cpp index 5ce5d8616b..34bdaffd76 100644 --- a/indra/newview/llfloaterbuy.cpp +++ b/indra/newview/llfloaterbuy.cpp @@ -46,7 +46,7 @@ #include "llselectmgr.h" #include "llscrolllistctrl.h" #include "llviewerobject.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llviewerwindow.h" LLFloaterBuy* LLFloaterBuy::sInstance = NULL; @@ -54,7 +54,7 @@ LLFloaterBuy* LLFloaterBuy::sInstance = NULL; LLFloaterBuy::LLFloaterBuy() : LLFloater("floater_buy_object", "FloaterBuyRect", "") { - gUICtrlFactory->buildFloater(this, "floater_buy_object.xml"); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_buy_object.xml"); childDisable("object_list"); childDisable("item_list"); @@ -72,17 +72,17 @@ LLFloaterBuy::~LLFloaterBuy() void LLFloaterBuy::reset() { - LLScrollListCtrl* object_list = LLUICtrlFactory::getScrollListByName(this, "object_list"); + LLScrollListCtrl* object_list = getChild<LLScrollListCtrl>("object_list"); if (object_list) object_list->deleteAllItems(); - LLScrollListCtrl* item_list = LLUICtrlFactory::getScrollListByName(this, "item_list"); + LLScrollListCtrl* item_list = getChild<LLScrollListCtrl>("item_list"); if (item_list) item_list->deleteAllItems(); } // static void LLFloaterBuy::show(const LLSaleInfo& sale_info) { - LLObjectSelectionHandle selection = gSelectMgr->getSelection(); + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); if (selection->getRootObjectCount() != 1) { @@ -104,7 +104,7 @@ void LLFloaterBuy::show(const LLSaleInfo& sale_info) sInstance->open(); /*Flawfinder: ignore*/ sInstance->setFocus(TRUE); sInstance->mSaleInfo = sale_info; - sInstance->mObjectSelection = gSelectMgr->getEditSelection(); + sInstance->mObjectSelection = LLSelectMgr::getInstance()->getEditSelection(); // Always center the dialog. User can change the size, // but purchases are important and should be center screen. @@ -133,7 +133,7 @@ void LLFloaterBuy::show(const LLSaleInfo& sale_info) LLUUID owner_id; LLString owner_name; - BOOL owners_identical = gSelectMgr->selectGetOwner(owner_id, owner_name); + BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name); if (!owners_identical) { gViewerWindow->alertXml("BuyObjectOneOwner"); @@ -151,13 +151,13 @@ void LLFloaterBuy::show(const LLSaleInfo& sale_info) LLSD row; // Compute icon for this item - LLUUID icon_id = get_item_icon_uuid(LLAssetType::AT_OBJECT, - LLInventoryType::IT_OBJECT, - 0x0, FALSE); + LLString icon_name = get_item_icon_name(LLAssetType::AT_OBJECT, + LLInventoryType::IT_OBJECT, + 0x0, FALSE); row["columns"][0]["column"] = "icon"; row["columns"][0]["type"] = "icon"; - row["columns"][0]["value"] = icon_id; + row["columns"][0]["value"] = icon_name; // Append the permissions that you will acquire (not the current // permissions). @@ -256,13 +256,13 @@ void LLFloaterBuy::inventoryChanged(LLViewerObject* obj, item_is_multi = TRUE; } - LLUUID icon_id = get_item_icon_uuid(inv_item->getType(), + LLString icon_name = get_item_icon_name(inv_item->getType(), inv_item->getInventoryType(), inv_item->getFlags(), item_is_multi); row["columns"][0]["column"] = "icon"; row["columns"][0]["type"] = "icon"; - row["columns"][0]["value"] = icon_id; + row["columns"][0]["value"] = icon_name; // Append the permissions that you will acquire (not the current // permissions). @@ -307,7 +307,7 @@ void LLFloaterBuy::onClickBuy(void*) // *NOTE: doesn't work for multiple object buy, which UI does not // currently support sale info is used for verification only, if // it doesn't match region info then sale is canceled. - gSelectMgr->sendBuy(gAgent.getID(), category_id, sInstance->mSaleInfo ); + LLSelectMgr::getInstance()->sendBuy(gAgent.getID(), category_id, sInstance->mSaleInfo ); sInstance->close(); } diff --git a/indra/newview/llfloaterbuycontents.cpp b/indra/newview/llfloaterbuycontents.cpp index b133a1e88b..34be223286 100644 --- a/indra/newview/llfloaterbuycontents.cpp +++ b/indra/newview/llfloaterbuycontents.cpp @@ -50,7 +50,7 @@ #include "llscrolllistctrl.h" #include "llviewerobject.h" #include "llviewerregion.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llviewerwindow.h" LLFloaterBuyContents* LLFloaterBuyContents::sInstance = NULL; @@ -58,7 +58,7 @@ LLFloaterBuyContents* LLFloaterBuyContents::sInstance = NULL; LLFloaterBuyContents::LLFloaterBuyContents() : LLFloater("floater_buy_contents", "FloaterBuyContentsRect", "") { - gUICtrlFactory->buildFloater(this, "floater_buy_contents.xml"); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_buy_contents.xml"); childSetAction("cancel_btn", onClickCancel, this); childSetAction("buy_btn", onClickBuy, this); @@ -79,7 +79,7 @@ LLFloaterBuyContents::~LLFloaterBuyContents() // static void LLFloaterBuyContents::show(const LLSaleInfo& sale_info) { - LLObjectSelectionHandle selection = gSelectMgr->getSelection(); + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); if (selection->getRootObjectCount() != 1) { @@ -90,7 +90,7 @@ void LLFloaterBuyContents::show(const LLSaleInfo& sale_info) // Create a new instance only if needed if (sInstance) { - LLScrollListCtrl* list = LLUICtrlFactory::getScrollListByName(sInstance, "item_list"); + LLScrollListCtrl* list = sInstance->getChild<LLScrollListCtrl>("item_list"); if (list) list->deleteAllItems(); } else @@ -100,7 +100,7 @@ void LLFloaterBuyContents::show(const LLSaleInfo& sale_info) sInstance->open(); /*Flawfinder: ignore*/ sInstance->setFocus(TRUE); - sInstance->mObjectSelection = gSelectMgr->getEditSelection(); + sInstance->mObjectSelection = LLSelectMgr::getInstance()->getEditSelection(); // Always center the dialog. User can change the size, // but purchases are important and should be center screen. @@ -110,7 +110,7 @@ void LLFloaterBuyContents::show(const LLSaleInfo& sale_info) LLUUID owner_id; LLString owner_name; - BOOL owners_identical = gSelectMgr->selectGetOwner(owner_id, owner_name); + BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name); if (!owners_identical) { gViewerWindow->alertXml("BuyContentsOneOwner"); @@ -223,13 +223,13 @@ void LLFloaterBuyContents::inventoryChanged(LLViewerObject* obj, item_is_multi = TRUE; } - LLUUID icon_id = get_item_icon_uuid(inv_item->getType(), - inv_item->getInventoryType(), - inv_item->getFlags(), - item_is_multi); + LLString icon_name = get_item_icon_name(inv_item->getType(), + inv_item->getInventoryType(), + inv_item->getFlags(), + item_is_multi); row["columns"][0]["column"] = "icon"; row["columns"][0]["type"] = "icon"; - row["columns"][0]["value"] = icon_id; + row["columns"][0]["value"] = icon_name; // Append the permissions that you will acquire (not the current // permissions). @@ -291,7 +291,7 @@ void LLFloaterBuyContents::onClickBuy(void*) // *NOTE: doesn't work for multiple object buy, which UI does not // currently support sale info is used for verification only, if // it doesn't match region info then sale is canceled. - gSelectMgr->sendBuy(gAgent.getID(), category_id, sInstance->mSaleInfo); + LLSelectMgr::getInstance()->sendBuy(gAgent.getID(), category_id, sInstance->mSaleInfo); sInstance->close(); } diff --git a/indra/newview/llfloaterbuycurrency.cpp b/indra/newview/llfloaterbuycurrency.cpp index fb6cb40401..9741fbb7c7 100644 --- a/indra/newview/llfloaterbuycurrency.cpp +++ b/indra/newview/llfloaterbuycurrency.cpp @@ -40,7 +40,7 @@ #include "lltextbox.h" #include "llviewchildren.h" #include "llviewerwindow.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llweb.h" #include "llwindow.h" #include "llappviewer.h" @@ -97,7 +97,7 @@ LLFloaterBuyCurrencyUI* LLFloaterBuyCurrencyUI::soleInstance(bool createIfNeeded { sInstance = new LLFloaterBuyCurrencyUI(); - gUICtrlFactory->buildFloater(sInstance, "floater_buy_currency.xml"); + LLUICtrlFactory::getInstance()->buildFloater(sInstance, "floater_buy_currency.xml"); sInstance->center(); } @@ -221,7 +221,7 @@ void LLFloaterBuyCurrencyUI::updateUI() { mChildren.setBadge("step_error", LLViewChildren::BADGE_ERROR); - LLTextBox* message = LLUICtrlFactory::getTextBoxByName(this, "error_message"); + LLTextBox* message = getChild<LLTextBox>("error_message"); if (message) { message->setVisible(true); diff --git a/indra/newview/llfloaterbuyland.cpp b/indra/newview/llfloaterbuyland.cpp index 5450b6de26..4d8f85159f 100644 --- a/indra/newview/llfloaterbuyland.cpp +++ b/indra/newview/llfloaterbuyland.cpp @@ -53,7 +53,7 @@ #include "lltexturectrl.h" #include "llviewchildren.h" #include "llviewercontrol.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llviewerparcelmgr.h" #include "llviewerregion.h" #include "llviewertexteditor.h" @@ -291,7 +291,7 @@ LLFloaterBuyLandUI* LLFloaterBuyLandUI::soleInstance(bool createIfNeeded) { sInstance = new LLFloaterBuyLandUI(); - gUICtrlFactory->buildFloater(sInstance, "floater_buy_land.xml"); + LLUICtrlFactory::getInstance()->buildFloater(sInstance, "floater_buy_land.xml"); sInstance->center(); static bool observingCacheName = false; @@ -305,7 +305,7 @@ LLFloaterBuyLandUI* LLFloaterBuyLandUI::soleInstance(bool createIfNeeded) if (!parcelSelectionObserver) { parcelSelectionObserver = new SelectionObserver; - gParcelMgr->addObserver(parcelSelectionObserver); + LLViewerParcelMgr::getInstance()->addObserver(parcelSelectionObserver); } } @@ -334,7 +334,7 @@ LLFloaterBuyLandUI::~LLFloaterBuyLandUI() { delete mTransaction; - gParcelMgr->deleteParcelBuy(mParcelBuyInfo); + LLViewerParcelMgr::getInstance()->deleteParcelBuy(mParcelBuyInfo); if (sInstance == this) { @@ -347,14 +347,14 @@ void LLFloaterBuyLandUI::SelectionObserver::changed() LLFloaterBuyLandUI* ui = LLFloaterBuyLandUI::soleInstance(false); if (ui) { - if (gParcelMgr->selectionEmpty()) + if (LLViewerParcelMgr::getInstance()->selectionEmpty()) { ui->close(); } else { ui->setParcel( - gParcelMgr->getSelectionRegion(), - gParcelMgr->getParcelSelection()); + LLViewerParcelMgr::getInstance()->getSelectionRegion(), + LLViewerParcelMgr::getInstance()->getParcelSelection()); } } } @@ -431,7 +431,7 @@ void LLFloaterBuyLandUI::updateParcelInfo() parcel->getMaxPrimCapacity() * parcel->getParcelPrimBonus()); // Can't have more than region max tasks, regardless of parcel // object bonus factor. - LLViewerRegion* region = gParcelMgr->getSelectionRegion(); + LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion(); if(region) { S32 max_tasks_per_region = (S32)region->getMaxTasks(); @@ -519,7 +519,7 @@ void LLFloaterBuyLandUI::updateParcelInfo() void LLFloaterBuyLandUI::updateCovenantInfo() { - LLViewerRegion* region = gParcelMgr->getSelectionRegion(); + LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion(); if(!region) return; LLTextBox* region_name = getChild<LLTextBox>("region_name_text"); @@ -729,7 +729,7 @@ void LLFloaterBuyLandUI::runWebSitePrep(const std::string& password) } BOOL remove_contribution = childGetValue("remove_contribution").asBoolean(); - mParcelBuyInfo = gParcelMgr->setupParcelBuy(gAgent.getID(), gAgent.getSessionID(), + mParcelBuyInfo = LLViewerParcelMgr::getInstance()->setupParcelBuy(gAgent.getID(), gAgent.getSessionID(), gAgent.getGroupID(), mIsForGroup, mIsClaim, remove_contribution); if (mParcelBuyInfo @@ -747,7 +747,7 @@ void LLFloaterBuyLandUI::runWebSitePrep(const std::string& password) if (mSiteMembershipUpgrade) { - LLComboBox* levels = LLUICtrlFactory::getComboBoxByName(this, "account_level"); + LLComboBox* levels = getChild<LLComboBox>( "account_level"); if (levels) { mUserPlanChoice = levels->getCurrentIndex(); @@ -798,8 +798,8 @@ void LLFloaterBuyLandUI::sendBuyLand() { if (mParcelBuyInfo) { - gParcelMgr->sendParcelBuy(mParcelBuyInfo); - gParcelMgr->deleteParcelBuy(mParcelBuyInfo); + LLViewerParcelMgr::getInstance()->sendParcelBuy(mParcelBuyInfo); + LLViewerParcelMgr::getInstance()->deleteParcelBuy(mParcelBuyInfo); mBought = true; } } @@ -1003,7 +1003,7 @@ void LLFloaterBuyLandUI::refreshUI() { // section zero: title area { - LLTextureCtrl* snapshot = LLViewerUICtrlFactory::getTexturePickerByName(this, "info_image"); + LLTextureCtrl* snapshot = getChild<LLTextureCtrl>("info_image"); if (snapshot) { snapshot->setImageAssetID( @@ -1061,7 +1061,7 @@ void LLFloaterBuyLandUI::refreshUI() ? LLViewChildren::BADGE_ERROR : LLViewChildren::BADGE_WARN); - LLTextBox* message = LLUICtrlFactory::getTextBoxByName(this, "error_message"); + LLTextBox* message = getChild<LLTextBox>("error_message"); if (message) { message->setVisible(true); @@ -1095,7 +1095,7 @@ void LLFloaterBuyLandUI::refreshUI() : getString("cant_own_land") ); - LLComboBox* levels = LLUICtrlFactory::getComboBoxByName(this, "account_level"); + LLComboBox* levels = getChild<LLComboBox>( "account_level"); if (levels) { levels->setVisible(mSiteMembershipUpgrade); @@ -1296,7 +1296,7 @@ void LLFloaterBuyLandUI::startBuyPreConfirm() action += mSiteMembershipAction; action += "\n"; - LLComboBox* levels = LLUICtrlFactory::getComboBoxByName(this, "account_level"); + LLComboBox* levels = getChild<LLComboBox>( "account_level"); if (levels) { action += " * "; diff --git a/indra/newview/llfloaterchat.cpp b/indra/newview/llfloaterchat.cpp index 3f510fc500..5ff75c4969 100644 --- a/indra/newview/llfloaterchat.cpp +++ b/indra/newview/llfloaterchat.cpp @@ -66,7 +66,7 @@ #include "llviewermessage.h" #include "llviewerwindow.h" #include "llviewercontrol.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llchatbar.h" #include "lllogchat.h" #include "lltexteditor.h" @@ -81,7 +81,6 @@ extern void AddNewChatToLCD(const LLString &newLine); // const F32 INSTANT_MSG_SIZE = 8.0f; const F32 CHAT_MSG_SIZE = 8.0f; -const LLColor4 INSTANT_MSG_COLOR(1, 1, 1, 1); const LLColor4 MUTED_MSG_COLOR(0.5f, 0.5f, 0.5f, 1.f); const S32 MAX_CHATTER_COUNT = 16; @@ -102,7 +101,7 @@ LLFloaterChat::LLFloaterChat(const LLSD& seed) mFactoryMap["active_speakers_panel"] = LLCallbackMap(createSpeakersPanel, NULL); // do not automatically open singleton floaters (as result of getInstance()) BOOL no_open = FALSE; - gUICtrlFactory->buildFloater(this,"floater_chat_history.xml",&getFactoryMap(),no_open); + LLUICtrlFactory::getInstance()->buildFloater(this,"floater_chat_history.xml",&getFactoryMap(),no_open); childSetCommitCallback("show mutes",onClickToggleShowMute,this); //show mutes childSetVisible("Chat History Editor with mute",FALSE); @@ -140,12 +139,12 @@ void LLFloaterChat::draw() BOOL LLFloaterChat::postBuild() { - mPanel = (LLPanelActiveSpeakers*)LLUICtrlFactory::getPanelByName(this, "active_speakers_panel"); + mPanel = (LLPanelActiveSpeakers*)getChild<LLPanel>("active_speakers_panel"); LLChatBar* chat_barp = getChild<LLChatBar>("chat_panel", TRUE); if (chat_barp) { - chat_barp->setGestureCombo(LLUICtrlFactory::getComboBoxByName(this, "Gesture")); + chat_barp->setGestureCombo(getChild<LLComboBox>( "Gesture")); } return TRUE; } @@ -274,7 +273,7 @@ void LLFloaterChat::onClickMute(void *data) { LLFloaterChat* self = (LLFloaterChat*)data; - LLComboBox* chatter_combo = LLUICtrlFactory::getComboBoxByName(self,"chatter combobox"); + LLComboBox* chatter_combo = self->getChild<LLComboBox>("chatter combobox"); const LLString& name = chatter_combo->getSimple(); LLUUID id = chatter_combo->getCurrentID(); @@ -283,12 +282,9 @@ void LLFloaterChat::onClickMute(void *data) LLMute mute(id); mute.setFromDisplayName(name); - gMuteListp->add(mute); + LLMuteList::getInstance()->add(mute); - if (gFloaterMute) - { - LLFloaterMute::showInstance(); - } + LLFloaterMute::showInstance(); } //static @@ -298,7 +294,7 @@ void LLFloaterChat::onClickToggleShowMute(LLUICtrl* caller, void *data) //LLCheckBoxCtrl* - BOOL show_mute = LLUICtrlFactory::getCheckBoxByName(floater,"show mutes")->get(); + BOOL show_mute = floater->getChild<LLCheckBoxCtrl>("show mutes")->get(); LLViewerTextEditor* history_editor = floater->getChild<LLViewerTextEditor>("Chat History Editor"); LLViewerTextEditor* history_editor_with_mute = floater->getChild<LLViewerTextEditor>("Chat History Editor with mute"); @@ -351,9 +347,13 @@ void LLFloaterChat::addChat(const LLChat& chat, && !local_agent) { F32 size = CHAT_MSG_SIZE; - if(from_instant_message) + if (chat.mSourceType == CHAT_SOURCE_SYSTEM) + { + text_color = gSavedSettings.getColor("SystemChatColor"); + } + else if(from_instant_message) { - text_color = INSTANT_MSG_COLOR; + text_color = gSavedSettings.getColor("IMChatColor"); size = INSTANT_MSG_SIZE; } gConsole->addLine(chat.mText, size, text_color); @@ -458,7 +458,7 @@ void LLFloaterChat::chatFromLogFile(LLLogChat::ELogLineType type , LLString line //static void* LLFloaterChat::createSpeakersPanel(void* data) { - return new LLPanelActiveSpeakers(gLocalSpeakerMgr, TRUE); + return new LLPanelActiveSpeakers(LLLocalSpeakerMgr::getInstance(), TRUE); } //static diff --git a/indra/newview/llfloaterchatterbox.cpp b/indra/newview/llfloaterchatterbox.cpp index f18c31baf9..71de859703 100644 --- a/indra/newview/llfloaterchatterbox.cpp +++ b/indra/newview/llfloaterchatterbox.cpp @@ -35,7 +35,7 @@ #include "llviewerprecompiledheaders.h" #include "llfloaterchatterbox.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llfloaterchat.h" #include "llfloaterfriends.h" #include "llfloatergroups.h" @@ -53,7 +53,7 @@ LLFloaterMyFriends::LLFloaterMyFriends(const LLSD& seed) mFactoryMap["groups_panel"] = LLCallbackMap(LLFloaterMyFriends::createGroupsPanel, NULL); // do not automatically open singleton floaters (as result of getInstance()) BOOL no_open = FALSE; - gUICtrlFactory->buildFloater(this, "floater_my_friends.xml", &getFactoryMap(), no_open); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_my_friends.xml", &getFactoryMap(), no_open); } LLFloaterMyFriends::~LLFloaterMyFriends() @@ -62,7 +62,7 @@ LLFloaterMyFriends::~LLFloaterMyFriends() BOOL LLFloaterMyFriends::postBuild() { - mTabs = LLUICtrlFactory::getTabContainerByName(this, "friends_and_groups"); + mTabs = getChild<LLTabContainer>("friends_and_groups"); return TRUE; } @@ -93,7 +93,7 @@ LLFloaterChatterBox::LLFloaterChatterBox(const LLSD& seed) : { mAutoResize = FALSE; - gUICtrlFactory->buildFloater(this, "floater_chatterbox.xml", NULL, FALSE); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_chatterbox.xml", NULL, FALSE); if (gSavedSettings.getBOOL("ContactsTornOff")) { LLFloaterMyFriends* floater_contacts = LLFloaterMyFriends::getInstance(0); @@ -128,33 +128,29 @@ LLFloaterChatterBox::~LLFloaterChatterBox() { } -BOOL LLFloaterChatterBox::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent) +BOOL LLFloaterChatterBox::handleKeyHere(KEY key, MASK mask) { - if (getEnabled() - && mask == MASK_CONTROL) + if (key == 'W' && mask == MASK_CONTROL) { - if (key == 'W') + LLFloater* floater = getActiveFloater(); + // is user closeable and is system closeable + if (floater && floater->canClose()) { - LLFloater* floater = getActiveFloater(); - // is user closeable and is system closeable - if (floater && floater->canClose()) + if (floater->isCloseable()) { - if (floater->isCloseable()) - { - floater->close(); - } - else - { - // close chatterbox window if frontmost tab is reserved, non-closeable tab - // such as contacts or near me - close(); - } + floater->close(); + } + else + { + // close chatterbox window if frontmost tab is reserved, non-closeable tab + // such as contacts or near me + close(); } - return TRUE; } + return TRUE; } - return LLMultiFloater::handleKeyHere(key, mask, called_from_parent); + return LLMultiFloater::handleKeyHere(key, mask); } void LLFloaterChatterBox::draw() @@ -247,7 +243,7 @@ void LLFloaterChatterBox::addFloater(LLFloater* floaterp, { mTabContainer->unlockTabs(); // add chat history as second tab if contact window is present, first tab otherwise - if (getChildByName("floater_my_friends", TRUE)) + if (getChildView("floater_my_friends")) { // assuming contacts window is first tab, select it mTabContainer->selectFirstTab(); diff --git a/indra/newview/llfloaterchatterbox.h b/indra/newview/llfloaterchatterbox.h index 4b1da9c9bc..e74a2e3ffd 100644 --- a/indra/newview/llfloaterchatterbox.h +++ b/indra/newview/llfloaterchatterbox.h @@ -47,7 +47,7 @@ public: LLFloaterChatterBox(const LLSD& seed); virtual ~LLFloaterChatterBox(); - /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent); + /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); /*virtual*/ void draw(); /*virtual*/ void onOpen(); /*virtual*/ void onClose(bool app_quitting); diff --git a/indra/newview/llfloatercolorpicker.cpp b/indra/newview/llfloatercolorpicker.cpp index 19793550cc..c805eea6ae 100644 --- a/indra/newview/llfloatercolorpicker.cpp +++ b/indra/newview/llfloatercolorpicker.cpp @@ -47,7 +47,7 @@ #include "v4coloru.h" #include "llbutton.h" #include "llviewercontrol.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llviewerwindow.h" #include "llgl.h" #include "llmemory.h" @@ -138,7 +138,7 @@ LLFloaterColorPicker:: createUI () { // build the majority of the gui using the factory builder - gUICtrlFactory->buildFloater ( this, "floater_color_picker.xml" ); + LLUICtrlFactory::getInstance()->buildFloater ( this, "floater_color_picker.xml" ); setVisible ( FALSE ); // create RGB type area (not really RGB but it's got R,G & B in it.,.. @@ -221,23 +221,23 @@ BOOL LLFloaterColorPicker:: postBuild() { - mCancelBtn = LLViewerUICtrlFactory::getButtonByName( this, "cancel_btn" ); + mCancelBtn = getChild<LLButton>( "cancel_btn" ); mCancelBtn->setClickedCallback ( onClickCancel ); mCancelBtn->setCallbackUserData ( this ); - mSelectBtn = LLViewerUICtrlFactory::getButtonByName( this, "select_btn"); + mSelectBtn = getChild<LLButton>( "select_btn"); mSelectBtn->setClickedCallback ( onClickSelect ); mSelectBtn->setCallbackUserData ( this ); mSelectBtn->setFocus ( TRUE ); - mPipetteBtn = LLViewerUICtrlFactory::getButtonByName ( this, "color_pipette" ); + mPipetteBtn = getChild<LLButton>("color_pipette" ); mPipetteBtn->setImages("eye_button_inactive.tga", "eye_button_active.tga"); mPipetteBtn->setClickedCallback( onClickPipette ); mPipetteBtn->setCallbackUserData ( this ); - mApplyImmediateCheck = LLViewerUICtrlFactory::getCheckBoxByName( this, "apply_immediate"); + mApplyImmediateCheck = getChild<LLCheckBoxCtrl>("apply_immediate"); mApplyImmediateCheck->set(gSavedSettings.getBOOL("ApplyColorImmediately")); mApplyImmediateCheck->setCommitCallback(onImmediateCheck); mApplyImmediateCheck->setCallbackUserData(this); @@ -468,18 +468,18 @@ void LLFloaterColorPicker::onClickPipette( void* data ) { LLFloaterColorPicker* self = ( LLFloaterColorPicker* )data; - if ( self && gToolMgr) + if ( self) { BOOL pipette_active = self->mPipetteBtn->getToggleState(); pipette_active = !pipette_active; if (pipette_active) { - gToolPipette->setSelectCallback(onColorSelect, self); - gToolMgr->setTransientTool(gToolPipette); + LLToolPipette::getInstance()->setSelectCallback(onColorSelect, self); + LLToolMgr::getInstance()->setTransientTool(LLToolPipette::getInstance()); } else { - gToolMgr->clearTransientTool(); + LLToolMgr::getInstance()->clearTransientTool(); } } } @@ -587,8 +587,7 @@ void LLFloaterColorPicker::draw() mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLCriticalDamp::getInterpolant(CONTEXT_FADE_TIME)); } - mPipetteBtn->setEnabled(gToolMgr != NULL); - mPipetteBtn->setToggleState(gToolMgr && gToolMgr->getCurrentTool() == gToolPipette); + mPipetteBtn->setToggleState(LLToolMgr::getInstance()->getCurrentTool() == LLToolPipette::getInstance()); mApplyImmediateCheck->setEnabled(mActive && mCanApplyImmediately); mSelectBtn->setEnabled(mActive); @@ -1227,8 +1226,8 @@ void LLFloaterColorPicker::setActive(BOOL active) void LLFloaterColorPicker::stopUsingPipette() { - if (gToolMgr && gToolMgr->getCurrentTool() == gToolPipette) + if (LLToolMgr::getInstance()->getCurrentTool() == LLToolPipette::getInstance()) { - gToolMgr->clearTransientTool(); + LLToolMgr::getInstance()->clearTransientTool(); } } diff --git a/indra/newview/llfloaterdaycycle.cpp b/indra/newview/llfloaterdaycycle.cpp index 67694f49c2..ca1131face 100644 --- a/indra/newview/llfloaterdaycycle.cpp +++ b/indra/newview/llfloaterdaycycle.cpp @@ -41,7 +41,7 @@ #include "llmultisliderctrl.h" #include "llspinctrl.h" #include "llcheckboxctrl.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llviewercamera.h" #include "llcombobox.h" #include "lllineeditor.h" @@ -64,10 +64,10 @@ const F32 LLFloaterDayCycle::sHoursPerDay = 24.0f; LLFloaterDayCycle::LLFloaterDayCycle() : LLFloater("Day Cycle Floater") { - gUICtrlFactory->buildFloater(this, "floater_day_cycle_options.xml"); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_day_cycle_options.xml"); // add the combo boxes - LLComboBox* keyCombo = LLUICtrlFactory::getComboBoxByName(this, "WLKeyPresets"); + LLComboBox* keyCombo = getChild<LLComboBox>("WLKeyPresets"); if(keyCombo != NULL) { @@ -83,8 +83,7 @@ LLFloaterDayCycle::LLFloaterDayCycle() : LLFloater("Day Cycle Floater") } // add the time slider - LLMultiSliderCtrl* sldr = LLUICtrlFactory::getMultiSliderByName(this, - "WLTimeSlider"); + LLMultiSliderCtrl* sldr = getChild<LLMultiSliderCtrl>("WLTimeSlider"); sldr->addSlider(); @@ -148,16 +147,12 @@ void LLFloaterDayCycle::syncMenu() // std::map<std::string, LLVector4> & currentParams = LLWLParamManager::instance()->mCurParams.mParamValues; // set time - LLMultiSliderCtrl* sldr = LLUICtrlFactory::getMultiSliderByName(LLFloaterDayCycle::sDayCycle, - "WLTimeSlider"); + LLMultiSliderCtrl* sldr = LLFloaterDayCycle::sDayCycle->getChild<LLMultiSliderCtrl>("WLTimeSlider"); sldr->setCurSliderValue((F32)LLWLParamManager::instance()->mAnimator.getDayTime() * sHoursPerDay); - LLSpinCtrl* secSpin = LLUICtrlFactory::getSpinnerByName(sDayCycle, - "WLLengthOfDaySec"); - LLSpinCtrl* minSpin = LLUICtrlFactory::getSpinnerByName(sDayCycle, - "WLLengthOfDayMin"); - LLSpinCtrl* hourSpin = LLUICtrlFactory::getSpinnerByName(sDayCycle, - "WLLengthOfDayHour"); + LLSpinCtrl* secSpin = sDayCycle->getChild<LLSpinCtrl>("WLLengthOfDaySec"); + LLSpinCtrl* minSpin = sDayCycle->getChild<LLSpinCtrl>("WLLengthOfDayMin"); + LLSpinCtrl* hourSpin = sDayCycle->getChild<LLSpinCtrl>("WLLengthOfDayHour"); F32 curRate; F32 hours, min, sec; @@ -188,8 +183,7 @@ void LLFloaterDayCycle::syncMenu() void LLFloaterDayCycle::syncSliderTrack() { // clear the slider - LLMultiSliderCtrl* kSldr = LLUICtrlFactory::getMultiSliderByName(sDayCycle, - "WLDayCycleKeys"); + LLMultiSliderCtrl* kSldr = sDayCycle->getChild<LLMultiSliderCtrl>("WLDayCycleKeys"); kSldr->clear(); sSliderToKey.clear(); @@ -212,12 +206,12 @@ void LLFloaterDayCycle::syncTrack() } LLMultiSliderCtrl* sldr; - sldr = LLUICtrlFactory::getMultiSliderByName(sDayCycle, + sldr = sDayCycle->getChild<LLMultiSliderCtrl>( "WLDayCycleKeys"); llassert_always(sSliderToKey.size() == sldr->getValue().size()); LLMultiSliderCtrl* tSldr; - tSldr = LLUICtrlFactory::getMultiSliderByName(sDayCycle, + tSldr = sDayCycle->getChild<LLMultiSliderCtrl>( "WLTimeSlider"); // create a new animation track @@ -267,7 +261,7 @@ void LLFloaterDayCycle::show() syncSliderTrack(); // comment in if you want the menu to rebuild each time - //gUICtrlFactory->buildFloater(dayCycle, "floater_day_cycle_options.xml"); + //LLUICtrlFactory::getInstance()->buildFloater(dayCycle, "floater_day_cycle_options.xml"); //dayCycle->initCallbacks(); dayCycle->open(); @@ -291,13 +285,11 @@ void LLFloaterDayCycle::onRunAnimSky(void* userData) } LLMultiSliderCtrl* sldr; - sldr = LLUICtrlFactory::getMultiSliderByName(sDayCycle, - "WLDayCycleKeys"); + sldr = sDayCycle->getChild<LLMultiSliderCtrl>("WLDayCycleKeys"); llassert_always(sSliderToKey.size() == sldr->getValue().size()); LLMultiSliderCtrl* tSldr; - tSldr = LLUICtrlFactory::getMultiSliderByName(sDayCycle, - "WLTimeSlider"); + tSldr = sDayCycle->getChild<LLMultiSliderCtrl>("WLTimeSlider"); // turn off linden time LLWLParamManager::instance()->mAnimator.mUseLindenTime = false; @@ -324,7 +316,7 @@ void LLFloaterDayCycle::onStopAnimSky(void* userData) void LLFloaterDayCycle::onUseLindenTime(void* userData) { LLFloaterWindLight* wl = LLFloaterWindLight::instance(); - LLComboBox* box = LLUICtrlFactory::getComboBoxByName(wl, "WLPresetsCombo"); + LLComboBox* box = wl->getChild<LLComboBox>("WLPresetsCombo"); box->selectByValue(""); LLWLParamManager::instance()->mAnimator.mIsRunning = true; @@ -341,7 +333,7 @@ void LLFloaterDayCycle::onLoadDayCycle(void* userData) // set the param manager's track to the new one LLMultiSliderCtrl* tSldr; - tSldr = LLUICtrlFactory::getMultiSliderByName(sDayCycle, + tSldr = sDayCycle->getChild<LLMultiSliderCtrl>( "WLTimeSlider"); LLWLParamManager::instance()->resetAnimator( tSldr->getCurSliderValue() / sHoursPerDay, false); @@ -359,7 +351,7 @@ void LLFloaterDayCycle::onSaveDayCycle(void* userData) void LLFloaterDayCycle::onTimeSliderMoved(LLUICtrl* ctrl, void* userData) { - LLMultiSliderCtrl* sldr = LLUICtrlFactory::getMultiSliderByName(sDayCycle, + LLMultiSliderCtrl* sldr = sDayCycle->getChild<LLMultiSliderCtrl>( "WLTimeSlider"); /// get the slider value @@ -377,14 +369,10 @@ void LLFloaterDayCycle::onTimeSliderMoved(LLUICtrl* ctrl, void* userData) void LLFloaterDayCycle::onKeyTimeMoved(LLUICtrl* ctrl, void* userData) { - LLComboBox* comboBox = LLUICtrlFactory::getComboBoxByName(sDayCycle, - "WLKeyPresets"); - LLMultiSliderCtrl* sldr = LLUICtrlFactory::getMultiSliderByName(sDayCycle, - "WLDayCycleKeys"); - LLSpinCtrl* hourSpin = LLUICtrlFactory::getSpinnerByName(sDayCycle, - "WLCurKeyHour"); - LLSpinCtrl* minSpin = LLUICtrlFactory::getSpinnerByName(sDayCycle, - "WLCurKeyMin"); + LLComboBox* comboBox = sDayCycle->getChild<LLComboBox>("WLKeyPresets"); + LLMultiSliderCtrl* sldr = sDayCycle->getChild<LLMultiSliderCtrl>("WLDayCycleKeys"); + LLSpinCtrl* hourSpin = sDayCycle->getChild<LLSpinCtrl>("WLCurKeyHour"); + LLSpinCtrl* minSpin = sDayCycle->getChild<LLSpinCtrl>("WLCurKeyMin"); if(sldr->getValue().size() == 0) { return; @@ -429,11 +417,11 @@ void LLFloaterDayCycle::onKeyTimeChanged(LLUICtrl* ctrl, void* userData) return; } - LLMultiSliderCtrl* sldr = LLUICtrlFactory::getMultiSliderByName(sDayCycle, + LLMultiSliderCtrl* sldr = sDayCycle->getChild<LLMultiSliderCtrl>( "WLDayCycleKeys"); - LLSpinCtrl* hourSpin = LLUICtrlFactory::getSpinnerByName(sDayCycle, + LLSpinCtrl* hourSpin = sDayCycle->getChild<LLSpinCtrl>( "WLCurKeyHour"); - LLSpinCtrl* minSpin = LLUICtrlFactory::getSpinnerByName(sDayCycle, + LLSpinCtrl* minSpin = sDayCycle->getChild<LLSpinCtrl>( "WLCurKeyMin"); F32 hour = hourSpin->get(); @@ -454,9 +442,9 @@ void LLFloaterDayCycle::onKeyTimeChanged(LLUICtrl* ctrl, void* userData) void LLFloaterDayCycle::onKeyPresetChanged(LLUICtrl* ctrl, void* userData) { // get the time - LLComboBox* comboBox = LLUICtrlFactory::getComboBoxByName(sDayCycle, + LLComboBox* comboBox = sDayCycle->getChild<LLComboBox>( "WLKeyPresets"); - LLMultiSliderCtrl* sldr = LLUICtrlFactory::getMultiSliderByName(sDayCycle, + LLMultiSliderCtrl* sldr = sDayCycle->getChild<LLMultiSliderCtrl>( "WLDayCycleKeys"); // do nothing if no sliders @@ -481,13 +469,13 @@ void LLFloaterDayCycle::onKeyPresetChanged(LLUICtrl* ctrl, void* userData) void LLFloaterDayCycle::onTimeRateChanged(LLUICtrl* ctrl, void* userData) { // get the time - LLSpinCtrl* secSpin = LLUICtrlFactory::getSpinnerByName(sDayCycle, + LLSpinCtrl* secSpin = sDayCycle->getChild<LLSpinCtrl>( "WLLengthOfDaySec"); - LLSpinCtrl* minSpin = LLUICtrlFactory::getSpinnerByName(sDayCycle, + LLSpinCtrl* minSpin = sDayCycle->getChild<LLSpinCtrl>( "WLLengthOfDayMin"); - LLSpinCtrl* hourSpin = LLUICtrlFactory::getSpinnerByName(sDayCycle, + LLSpinCtrl* hourSpin = sDayCycle->getChild<LLSpinCtrl>( "WLLengthOfDayHour"); F32 hour; @@ -508,11 +496,11 @@ void LLFloaterDayCycle::onTimeRateChanged(LLUICtrl* ctrl, void* userData) void LLFloaterDayCycle::onAddKey(void* userData) { - LLComboBox* comboBox = LLUICtrlFactory::getComboBoxByName(sDayCycle, + LLComboBox* comboBox = sDayCycle->getChild<LLComboBox>( "WLKeyPresets"); - LLMultiSliderCtrl* kSldr = LLUICtrlFactory::getMultiSliderByName(sDayCycle, + LLMultiSliderCtrl* kSldr = sDayCycle->getChild<LLMultiSliderCtrl>( "WLDayCycleKeys"); - LLMultiSliderCtrl* tSldr = LLUICtrlFactory::getMultiSliderByName(sDayCycle, + LLMultiSliderCtrl* tSldr = sDayCycle->getChild<LLMultiSliderCtrl>( "WLTimeSlider"); llassert_always(sSliderToKey.size() == kSldr->getValue().size()); @@ -528,7 +516,7 @@ void LLFloaterDayCycle::onAddKey(void* userData) void LLFloaterDayCycle::addSliderKey(F32 time, const LLString & presetName) { - LLMultiSliderCtrl* kSldr = LLUICtrlFactory::getMultiSliderByName(sDayCycle, + LLMultiSliderCtrl* kSldr = sDayCycle->getChild<LLMultiSliderCtrl>( "WLDayCycleKeys"); // make a slider @@ -553,8 +541,7 @@ void LLFloaterDayCycle::addSliderKey(F32 time, const LLString & presetName) void LLFloaterDayCycle::deletePreset(LLString& presetName) { - LLMultiSliderCtrl* sldr = LLUICtrlFactory::getMultiSliderByName( - sDayCycle, "WLDayCycleKeys"); + LLMultiSliderCtrl* sldr = sDayCycle->getChild<LLMultiSliderCtrl>("WLDayCycleKeys"); /// delete any reference std::map<LLString, LLWLSkyKey>::iterator curr_preset, next_preset; @@ -576,10 +563,9 @@ void LLFloaterDayCycle::onDeleteKey(void* userData) return; } - LLComboBox* comboBox = LLUICtrlFactory::getComboBoxByName(sDayCycle, + LLComboBox* comboBox = sDayCycle->getChild<LLComboBox>( "WLKeyPresets"); - LLMultiSliderCtrl* sldr = LLUICtrlFactory::getMultiSliderByName( - sDayCycle, "WLDayCycleKeys"); + LLMultiSliderCtrl* sldr = sDayCycle->getChild<LLMultiSliderCtrl>("WLDayCycleKeys"); // delete from map const LLString& sldrName = sldr->getCurSlider(); @@ -596,10 +582,8 @@ void LLFloaterDayCycle::onDeleteKey(void* userData) comboBox->selectByValue(sSliderToKey[name].presetName); F32 time = sSliderToKey[name].time; - LLSpinCtrl* hourSpin = LLUICtrlFactory::getSpinnerByName(sDayCycle, - "WLCurKeyHour"); - LLSpinCtrl* minSpin = LLUICtrlFactory::getSpinnerByName(sDayCycle, - "WLCurKeyMin"); + LLSpinCtrl* hourSpin = sDayCycle->getChild<LLSpinCtrl>("WLCurKeyHour"); + LLSpinCtrl* minSpin = sDayCycle->getChild<LLSpinCtrl>("WLCurKeyMin"); // now set the spinners F32 hour = (F32)((S32)time); diff --git a/indra/newview/llfloaterenvsettings.cpp b/indra/newview/llfloaterenvsettings.cpp index 197e2ba15e..8570515f07 100644 --- a/indra/newview/llfloaterenvsettings.cpp +++ b/indra/newview/llfloaterenvsettings.cpp @@ -35,7 +35,7 @@ #include "llfloaterwindlight.h" #include "llfloaterwater.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llsliderctrl.h" #include "llcombobox.h" #include "llcolorswatch.h" @@ -55,7 +55,7 @@ LLFloaterEnvSettings* LLFloaterEnvSettings::sEnvSettings = NULL; LLFloaterEnvSettings::LLFloaterEnvSettings() : LLFloater("Environment Settings Floater") { - gUICtrlFactory->buildFloater(this, "floater_env_settings.xml"); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_env_settings.xml"); // load it up initCallbacks(); @@ -106,24 +106,14 @@ void LLFloaterEnvSettings::initCallbacks(void) void LLFloaterEnvSettings::syncMenu() { LLSliderCtrl* sldr; - sldr = LLUICtrlFactory::getSliderByName(sEnvSettings, - "EnvTimeSlider"); - if(NULL == sldr) - { - return; - } + sldr = sEnvSettings->getChild<LLSliderCtrl>("EnvTimeSlider"); // sync the clock F32 val = (F32)LLWLParamManager::instance()->mAnimator.getDayTime(); LLString timeStr = timeToString(val); LLTextBox* textBox; - textBox = LLUICtrlFactory::getTextBoxByName(sEnvSettings, - "EnvTimeText"); - if(NULL == textBox) - { - return; - } + textBox = sEnvSettings->getChild<LLTextBox>("EnvTimeText"); textBox->setValue(timeStr); @@ -204,7 +194,7 @@ void LLFloaterEnvSettings::show() envSettings->syncMenu(); // comment in if you want the menu to rebuild each time - //gUICtrlFactory->buildFloater(envSettings, "floater_env_settings.xml"); + //LLUICtrlFactory::getInstance()->buildFloater(envSettings, "floater_env_settings.xml"); //envSettings->initCallbacks(); envSettings->open(); @@ -232,8 +222,7 @@ void LLFloaterEnvSettings::onClose(bool app_quitting) void LLFloaterEnvSettings::onChangeDayTime(LLUICtrl* ctrl, void* userData) { LLSliderCtrl* sldr; - sldr = LLUICtrlFactory::getSliderByName(sEnvSettings, - "EnvTimeSlider"); + sldr = sEnvSettings->getChild<LLSliderCtrl>("EnvTimeSlider"); // deactivate animator LLWLParamManager::instance()->mAnimator.mIsRunning = false; @@ -253,8 +242,7 @@ void LLFloaterEnvSettings::onChangeDayTime(LLUICtrl* ctrl, void* userData) void LLFloaterEnvSettings::onChangeCloudCoverage(LLUICtrl* ctrl, void* userData) { LLSliderCtrl* sldr; - sldr = LLUICtrlFactory::getSliderByName(sEnvSettings, - "EnvCloudSlider"); + sldr = sEnvSettings->getChild<LLSliderCtrl>("EnvCloudSlider"); // deactivate animator //LLWLParamManager::instance()->mAnimator.mIsRunning = false; @@ -267,10 +255,9 @@ void LLFloaterEnvSettings::onChangeCloudCoverage(LLUICtrl* ctrl, void* userData) void LLFloaterEnvSettings::onChangeWaterFogDensity(LLUICtrl* ctrl, void* userData) { LLSliderCtrl* sldr; - sldr = LLUICtrlFactory::getSliderByName(sEnvSettings, - "EnvWaterFogSlider"); + sldr = sEnvSettings->getChild<LLSliderCtrl>("EnvWaterFogSlider"); - if(NULL == sldr || NULL == userData) + if(NULL == userData) { return; } @@ -313,7 +300,7 @@ void LLFloaterEnvSettings::onUseEstateTime(void* userData) { // select the blank value in LLFloaterWindLight* wl = LLFloaterWindLight::instance(); - LLComboBox* box = LLUICtrlFactory::getComboBoxByName(wl, "WLPresetsCombo"); + LLComboBox* box = wl->getChild<LLComboBox>("WLPresetsCombo"); box->selectByValue(""); } diff --git a/indra/newview/llfloaterevent.cpp b/indra/newview/llfloaterevent.cpp index 7c76923190..3579b2a058 100644 --- a/indra/newview/llfloaterevent.cpp +++ b/indra/newview/llfloaterevent.cpp @@ -37,10 +37,10 @@ // viewer project includes #include "llcommandhandler.h" #include "llpanelevent.h" -#include "llvieweruictrlfactory.h" // linden library includes #include "lluuid.h" +#include "lluictrlfactory.h" //////////////////////////////////////////////////////////////////////////// // LLFloaterEventInfo @@ -79,7 +79,7 @@ LLFloaterEventInfo::LLFloaterEventInfo(const std::string& name, const U32 event_ { mFactoryMap["event_details_panel"] = LLCallbackMap(LLFloaterEventInfo::createEventDetail, this); - gUICtrlFactory->buildFloater(this, "floater_preview_event.xml", &getFactoryMap()); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_preview_event.xml", &getFactoryMap()); gEventInfoInstances.addData(event_id, this); } @@ -100,7 +100,7 @@ void* LLFloaterEventInfo::createEventDetail(void* userdata) { LLFloaterEventInfo *self = (LLFloaterEventInfo*)userdata; self->mPanelEventp = new LLPanelEvent(); - gUICtrlFactory->buildPanel(self->mPanelEventp, "panel_event.xml"); + LLUICtrlFactory::getInstance()->buildPanel(self->mPanelEventp, "panel_event.xml"); return self->mPanelEventp; } diff --git a/indra/newview/llfloaterfriends.cpp b/indra/newview/llfloaterfriends.cpp index f5942cfbdd..b7e50145c3 100644 --- a/indra/newview/llfloaterfriends.cpp +++ b/indra/newview/llfloaterfriends.cpp @@ -51,7 +51,7 @@ #include "llnotify.h" #include "llresmgr.h" #include "llimview.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llmenucommands.h" #include "llviewercontrol.h" #include "llviewermessage.h" @@ -178,7 +178,7 @@ void LLPanelFriends::updateFriends(U32 changed_mask) // virtual BOOL LLPanelFriends::postBuild() { - mFriendsList = LLUICtrlFactory::getScrollListByName(this, "friend_list"); + mFriendsList = getChild<LLScrollListCtrl>("friend_list"); mFriendsList->setMaxSelectable(MAX_FRIEND_SELECT); mFriendsList->setMaximumSelectCallback(onMaximumSelect); mFriendsList->setCommitOnSelectionChange(TRUE); @@ -201,7 +201,7 @@ BOOL LLPanelFriends::postBuild() // primary sort = online status, secondary sort = name mFriendsList->sortByColumn("friend_name", TRUE); - mFriendsList->sortByColumn("icon_online_status", TRUE); + mFriendsList->sortByColumn("icon_online_status", FALSE); return TRUE; } @@ -219,37 +219,46 @@ BOOL LLPanelFriends::addFriend(const LLUUID& agent_id) LLSD element; element["id"] = agent_id; - element["columns"][LIST_FRIEND_NAME]["column"] = "friend_name"; - element["columns"][LIST_FRIEND_NAME]["value"] = fullname; - element["columns"][LIST_FRIEND_NAME]["font"] = "SANSSERIF"; - element["columns"][LIST_FRIEND_NAME]["font-style"] = "NORMAL"; - element["columns"][LIST_ONLINE_STATUS]["column"] = "icon_online_status"; - element["columns"][LIST_ONLINE_STATUS]["type"] = "icon"; + LLSD& friend_column = element["columns"][LIST_FRIEND_NAME]; + friend_column["column"] = "friend_name"; + friend_column["value"] = fullname; + friend_column["font"] = "SANSSERIF"; + friend_column["font-style"] = "NORMAL"; + + LLSD& online_status_column = element["columns"][LIST_ONLINE_STATUS]; + online_status_column["column"] = "icon_online_status"; + online_status_column["type"] = "icon"; + if (online) { - element["columns"][LIST_FRIEND_NAME]["font-style"] = "BOLD"; - element["columns"][LIST_ONLINE_STATUS]["value"] = gViewerArt.getString("icon_avatar_online.tga"); + friend_column["font-style"] = "BOLD"; + online_status_column["value"] = "icon_avatar_online.tga"; } - element["columns"][LIST_VISIBLE_ONLINE]["column"] = "icon_visible_online"; - element["columns"][LIST_VISIBLE_ONLINE]["type"] = "checkbox"; - element["columns"][LIST_VISIBLE_ONLINE]["value"] = relationInfo->isRightGrantedTo(LLRelationship::GRANT_ONLINE_STATUS); + LLSD& online_column = element["columns"][LIST_VISIBLE_ONLINE]; + online_column["column"] = "icon_visible_online"; + online_column["type"] = "checkbox"; + online_column["value"] = relationInfo->isRightGrantedTo(LLRelationship::GRANT_ONLINE_STATUS); - element["columns"][LIST_VISIBLE_MAP]["column"] = "icon_visible_map"; - element["columns"][LIST_VISIBLE_MAP]["type"] = "checkbox"; - element["columns"][LIST_VISIBLE_MAP]["value"] = relationInfo->isRightGrantedTo(LLRelationship::GRANT_MAP_LOCATION); + LLSD& visible_map_column = element["columns"][LIST_VISIBLE_MAP]; + visible_map_column["column"] = "icon_visible_map"; + visible_map_column["type"] = "checkbox"; + visible_map_column["value"] = relationInfo->isRightGrantedTo(LLRelationship::GRANT_MAP_LOCATION); - element["columns"][LIST_EDIT_MINE]["column"] = "icon_edit_mine"; - element["columns"][LIST_EDIT_MINE]["type"] = "checkbox"; - element["columns"][LIST_EDIT_MINE]["value"] = relationInfo->isRightGrantedTo(LLRelationship::GRANT_MODIFY_OBJECTS); + LLSD& edit_my_object_column = element["columns"][LIST_EDIT_MINE]; + edit_my_object_column["column"] = "icon_edit_mine"; + edit_my_object_column["type"] = "checkbox"; + edit_my_object_column["value"] = relationInfo->isRightGrantedTo(LLRelationship::GRANT_MODIFY_OBJECTS); - element["columns"][LIST_EDIT_THEIRS]["column"] = "icon_edit_theirs"; - element["columns"][LIST_EDIT_THEIRS]["type"] = "checkbox"; - element["columns"][LIST_EDIT_THEIRS]["enabled"] = ""; - element["columns"][LIST_EDIT_THEIRS]["value"] = relationInfo->isRightGrantedFrom(LLRelationship::GRANT_MODIFY_OBJECTS); + LLSD& edit_their_object_column = element["columns"][LIST_EDIT_THEIRS]; + edit_their_object_column["column"] = "icon_edit_theirs"; + edit_their_object_column["type"] = "checkbox"; + edit_their_object_column["enabled"] = ""; + edit_their_object_column["value"] = relationInfo->isRightGrantedFrom(LLRelationship::GRANT_MODIFY_OBJECTS); - element["columns"][LIST_FRIEND_UPDATE_GEN]["column"] = "friend_last_update_generation"; - element["columns"][LIST_FRIEND_UPDATE_GEN]["value"] = have_name ? relationInfo->getChangeSerialNum() : -1; + LLSD& update_gen_column = element["columns"][LIST_FRIEND_UPDATE_GEN]; + update_gen_column["column"] = "friend_last_update_generation"; + update_gen_column["value"] = have_name ? relationInfo->getChangeSerialNum() : -1; mFriendsList->addElement(element, ADD_BOTTOM); return have_name; @@ -265,7 +274,7 @@ BOOL LLPanelFriends::updateFriendItem(const LLUUID& agent_id, const LLRelationsh std::string fullname; BOOL have_name = gCacheName->getFullName(agent_id, fullname); - itemp->getColumn(LIST_ONLINE_STATUS)->setValue(info->isOnline() ? gViewerArt.getString("icon_avatar_online.tga") : LLString()); + itemp->getColumn(LIST_ONLINE_STATUS)->setValue(info->isOnline() ? "icon_avatar_online.tga" : LLString::null); itemp->getColumn(LIST_FRIEND_NAME)->setValue(fullname); // render name of online friends in bold text ((LLScrollListText*)itemp->getColumn(LIST_FRIEND_NAME))->setFontStyle(info->isOnline() ? LLFontGL::BOLD : LLFontGL::NORMAL); @@ -292,7 +301,7 @@ void LLPanelFriends::refreshRightsChangeList() bool can_offer_teleport = num_selected >= 1; bool selected_friends_online = true; - LLTextBox* processing_label = LLUICtrlFactory::getTextBoxByName(this, "process_rights_label"); + LLTextBox* processing_label = getChild<LLTextBox>("process_rights_label"); if(!mAllowRightsChange) { diff --git a/indra/newview/llfloatergesture.cpp b/indra/newview/llfloatergesture.cpp index 171c7da0f9..e361309a61 100644 --- a/indra/newview/llfloatergesture.cpp +++ b/indra/newview/llfloatergesture.cpp @@ -52,7 +52,7 @@ #include "llscrollcontainer.h" #include "llscrolllistctrl.h" #include "lltextbox.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llviewergesture.h" #include "llviewerimagelist.h" #include "llviewerinventory.h" @@ -144,7 +144,7 @@ void LLFloaterGesture::show() LLFloaterGesture *self = new LLFloaterGesture(); // Builds and adds to gFloaterView - gUICtrlFactory->buildFloater(self, "floater_gesture.xml"); + LLUICtrlFactory::getInstance()->buildFloater(self, "floater_gesture.xml"); // Fix up rectangle LLRect rect = gSavedSettings.getRect("FloaterGestureRect2"); diff --git a/indra/newview/llfloatergodtools.cpp b/indra/newview/llfloatergodtools.cpp index 27d427115b..c919302424 100644 --- a/indra/newview/llfloatergodtools.cpp +++ b/indra/newview/llfloatergodtools.cpp @@ -71,7 +71,7 @@ #include "llvlcomposition.h" #include "llsurface.h" #include "llviewercontrol.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "lltransfertargetfile.h" #include "lltransfersourcefile.h" @@ -124,7 +124,7 @@ LLFloaterGodTools::LLFloaterGodTools() factory_map["region"] = LLCallbackMap(createPanelRegion, this); factory_map["objects"] = LLCallbackMap(createPanelObjects, this); factory_map["request"] = LLCallbackMap(createPanelRequest, this); - gUICtrlFactory->buildFloater(this, "floater_god_tools.xml", &factory_map); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_god_tools.xml", &factory_map); childSetTabChangeCallback("GodTools Tabs", "grid", onTabChanged, this); childSetTabChangeCallback("GodTools Tabs", "region", onTabChanged, this); @@ -853,18 +853,14 @@ void LLPanelRegionTools::onSelectRegion(void* userdata) { llinfos << "LLPanelRegionTools::onSelectRegion" << llendl; - if (!gWorldp) - { - return; - } - LLViewerRegion *regionp = gWorldp->getRegionFromPosGlobal(gAgent.getPositionGlobal()); + LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromPosGlobal(gAgent.getPositionGlobal()); if (!regionp) { return; } LLVector3d north_east(REGION_WIDTH_METERS, REGION_WIDTH_METERS, 0); - gParcelMgr->selectLand(regionp->getOriginGlobal(), + LLViewerParcelMgr::getInstance()->selectLand(regionp->getOriginGlobal(), regionp->getOriginGlobal() + north_east, FALSE); } @@ -1261,12 +1257,12 @@ void LLPanelObjectTools::onClickSetBySelection(void* data) if (!panelp) return; const BOOL non_root_ok = TRUE; - LLSelectNode* node = gSelectMgr->getSelection()->getFirstRootNode(NULL, non_root_ok); + LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(NULL, non_root_ok); if (!node) return; LLString owner_name; LLUUID owner_id; - gSelectMgr->selectGetOwner(owner_id, owner_name); + LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name); panelp->mTargetAvatar = owner_id; LLString name = "Object " + node->mName + " owned by " + owner_name; @@ -1348,8 +1344,8 @@ void LLPanelRequestTools::refresh() list->operateOnAll(LLCtrlListInterface::OP_DELETE); list->addSimpleElement(SELECTION); list->addSimpleElement(AGENT_REGION); - for (LLWorld::region_list_t::iterator iter = gWorldp->mActiveRegionList.begin(); - iter != gWorldp->mActiveRegionList.end(); ++iter) + for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->mActiveRegionList.begin(); + iter != LLWorld::getInstance()->mActiveRegionList.end(); ++iter) { LLViewerRegion* regionp = *iter; LLString name = regionp->getName(); @@ -1400,7 +1396,7 @@ void LLPanelRequestTools::onClickRequest(void* data) std::string req = self->childGetValue("request"); req = req.substr(0, req.find_first_of(" ")); std::string param = self->childGetValue("parameter"); - gSelectMgr->sendGodlikeRequest(req, param); + LLSelectMgr::getInstance()->sendGodlikeRequest(req, param); } else if(dest == AGENT_REGION) { @@ -1409,8 +1405,8 @@ void LLPanelRequestTools::onClickRequest(void* data) else { // find region by name - for (LLWorld::region_list_t::iterator iter = gWorldp->mActiveRegionList.begin(); - iter != gWorldp->mActiveRegionList.end(); ++iter) + for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->mActiveRegionList.begin(); + iter != LLWorld::getInstance()->mActiveRegionList.end(); ++iter) { LLViewerRegion* regionp = *iter; if(dest == regionp->getName()) diff --git a/indra/newview/llfloatergroups.cpp b/indra/newview/llfloatergroups.cpp index 7a0f01e5a6..26ed03951c 100644 --- a/indra/newview/llfloatergroups.cpp +++ b/indra/newview/llfloatergroups.cpp @@ -52,7 +52,7 @@ #include "llselectmgr.h" #include "llscrolllistctrl.h" #include "lltextbox.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llviewerwindow.h" #include "llimview.h" @@ -81,7 +81,7 @@ LLFloaterGroupPicker* LLFloaterGroupPicker::findInstance(const LLSD& seed) LLFloaterGroupPicker* LLFloaterGroupPicker::createInstance(const LLSD &seed) { LLFloaterGroupPicker* pickerp = new LLFloaterGroupPicker(seed); - gUICtrlFactory->buildFloater(pickerp, "floater_choose_group.xml"); + LLUICtrlFactory::getInstance()->buildFloater(pickerp, "floater_choose_group.xml"); return pickerp; } @@ -115,7 +115,7 @@ void LLFloaterGroupPicker::setPowersMask(U64 powers_mask) BOOL LLFloaterGroupPicker::postBuild() { - init_group_list(LLUICtrlFactory::getScrollListByName(this, "group list"), gAgent.getGroupID(), mPowersMask); + init_group_list(getChild<LLScrollListCtrl>("group list"), gAgent.getGroupID(), mPowersMask); childSetAction("OK", onBtnOK, this); @@ -199,7 +199,7 @@ void LLPanelGroups::reset() childSetTextArg("groupcount", "[COUNT]", llformat("%d",gAgent.mGroups.count())); childSetTextArg("groupcount", "[MAX]", llformat("%d",MAX_AGENT_GROUPS)); - init_group_list(LLUICtrlFactory::getScrollListByName(this, "group list"), gAgent.getGroupID()); + init_group_list(getChild<LLScrollListCtrl>("group list"), gAgent.getGroupID()); enableButtons(); } @@ -210,7 +210,7 @@ BOOL LLPanelGroups::postBuild() childSetTextArg("groupcount", "[COUNT]", llformat("%d",gAgent.mGroups.count())); childSetTextArg("groupcount", "[MAX]", llformat("%d",MAX_AGENT_GROUPS)); - init_group_list(LLUICtrlFactory::getScrollListByName(this, "group list"), gAgent.getGroupID()); + init_group_list(getChild<LLScrollListCtrl>("group list"), gAgent.getGroupID()); childSetAction("Activate", onBtnActivate, this); diff --git a/indra/newview/llfloaterhardwaresettings.cpp b/indra/newview/llfloaterhardwaresettings.cpp index a3c3acd3bb..d58517ee92 100644 --- a/indra/newview/llfloaterhardwaresettings.cpp +++ b/indra/newview/llfloaterhardwaresettings.cpp @@ -40,7 +40,7 @@ #include "llstartup.h" #include "llradiogroup.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llimagegl.h" #include "pipeline.h" @@ -49,7 +49,7 @@ LLFloaterHardwareSettings* LLFloaterHardwareSettings::sHardwareSettings = NULL; LLFloaterHardwareSettings::LLFloaterHardwareSettings() : LLFloater("Hardware Settings Floater") { - gUICtrlFactory->buildFloater(this, "floater_hardware_settings.xml"); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_hardware_settings.xml"); // load it up initCallbacks(); @@ -94,7 +94,7 @@ void LLFloaterHardwareSettings::refreshEnabledState() childSetMinValue("GrapicsCardTextureMemory", min_tex_mem); childSetMaxValue("GrapicsCardTextureMemory", max_tex_mem); - if (!gFeatureManagerp->isFeatureAvailable("RenderVBOEnable") || + if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderVBOEnable") || !gGLManager.mHasVertexBufferObject) { childSetEnabled("vbo", FALSE); @@ -124,7 +124,7 @@ void LLFloaterHardwareSettings::show() hardSettings->center(); // comment in if you want the menu to rebuild each time - //gUICtrlFactory->buildFloater(hardSettings, "floater_hardware_settings.xml"); + //LLUICtrlFactory::getInstance()->buildFloater(hardSettings, "floater_hardware_settings.xml"); //hardSettings->initCallbacks(); hardSettings->open(); @@ -153,17 +153,6 @@ void LLFloaterHardwareSettings::onClose(bool app_quitting) BOOL LLFloaterHardwareSettings::postBuild() { - requires("ani", WIDGET_TYPE_CHECKBOX); - requires("gamma", WIDGET_TYPE_SPINNER); - requires("vbo", WIDGET_TYPE_CHECKBOX); - requires("GrapicsCardTextureMemory", WIDGET_TYPE_SLIDER); - requires("fog", WIDGET_TYPE_SPINNER); - - if (!checkRequirements()) - { - return FALSE; - } - childSetAction("OK", onBtnOK, this); refresh(); diff --git a/indra/newview/llfloaterhud.cpp b/indra/newview/llfloaterhud.cpp index 72110e4fff..7f311be9fd 100644 --- a/indra/newview/llfloaterhud.cpp +++ b/indra/newview/llfloaterhud.cpp @@ -11,7 +11,7 @@ #include "llfloaterhud.h" #include "llviewercontrol.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llwebbrowserctrl.h" #include "llalertdialog.h" @@ -37,14 +37,14 @@ LLFloaterHUD::LLFloaterHUD() setBackgroundOpaque(TRUE); // Create floater from its XML definition - gUICtrlFactory->buildFloater(this, "floater_hud.xml"); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_hud.xml"); // Position floater based on saved location LLRect saved_position_rect = gSavedSettings.getRect("FloaterHUDRect"); reshape(saved_position_rect.getWidth(), saved_position_rect.getHeight(), FALSE); setRect(saved_position_rect); - mWebBrowser = LLViewerUICtrlFactory::getWebBrowserByName(this, "floater_hud_browser" ); + mWebBrowser = getChild<LLWebBrowserCtrl>("floater_hud_browser" ); if (mWebBrowser) { // Always refresh the browser diff --git a/indra/newview/llfloaterimagepreview.cpp b/indra/newview/llfloaterimagepreview.cpp index eb5ee352b9..0fdc1ccdc6 100644 --- a/indra/newview/llfloaterimagepreview.cpp +++ b/indra/newview/llfloaterimagepreview.cpp @@ -52,7 +52,7 @@ #include "llviewerwindow.h" #include "llvoavatar.h" #include "pipeline.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llviewerimagelist.h" //static @@ -616,7 +616,7 @@ LLImagePreviewAvatar::LLImagePreviewAvatar(S32 width, S32 height) : LLDynamicTex mDummyAvatar->slamPosition(); mDummyAvatar->updateJointLODs(); mDummyAvatar->updateGeometry(mDummyAvatar->mDrawable); - // gPipeline.markVisible(mDummyAvatar->mDrawable, *gCamera); + // gPipeline.markVisible(mDummyAvatar->mDrawable, *LLViewerCamera::getInstance()); mTextureName = 0; } @@ -696,16 +696,16 @@ BOOL LLImagePreviewAvatar::render() LLQuaternion(mCameraYaw, LLVector3::z_axis); LLQuaternion av_rot = avatarp->mPelvisp->getWorldRotation() * camera_rot; - gCamera->setOriginAndLookAt( + LLViewerCamera::getInstance()->setOriginAndLookAt( target_pos + ((LLVector3(mCameraDistance, 0.f, 0.f) + mCameraOffset) * av_rot), // camera LLVector3::z_axis, // up target_pos + (mCameraOffset * av_rot) ); // point of interest stop_glerror(); - gCamera->setAspect((F32)mWidth / mHeight); - gCamera->setView(gCamera->getDefaultFOV() / mCameraZoom); - gCamera->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mWidth, mHeight, FALSE); + LLViewerCamera::getInstance()->setAspect((F32)mWidth / mHeight); + LLViewerCamera::getInstance()->setView(LLViewerCamera::getInstance()->getDefaultFOV() / mCameraZoom); + LLViewerCamera::getInstance()->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mWidth, mHeight, FALSE); LLVertexBuffer::stopRender(); avatarp->updateLOD(); @@ -787,7 +787,7 @@ LLImagePreviewSculpted::LLImagePreviewSculpted(S32 width, S32 height) : LLDynami mDummyAvatar->slamPosition(); mDummyAvatar->updateJointLODs(); mDummyAvatar->updateGeometry(mDummyAvatar->mDrawable); - gPipeline.markVisible(mDummyAvatar->mDrawable, *gCamera); + gPipeline.markVisible(mDummyAvatar->mDrawable, *LLViewerCamera::getInstance()); mTextureName = 0; */ } @@ -856,16 +856,16 @@ BOOL LLImagePreviewSculpted::render() LLQuaternion(mCameraYaw, LLVector3::z_axis); LLQuaternion av_rot = camera_rot; - gCamera->setOriginAndLookAt( + LLViewerCamera::getInstance()->setOriginAndLookAt( target_pos + ((LLVector3(mCameraDistance, 0.f, 0.f) + mCameraOffset) * av_rot), // camera LLVector3::z_axis, // up target_pos + (mCameraOffset * av_rot) ); // point of interest stop_glerror(); - gCamera->setAspect((F32) mWidth / mHeight); - gCamera->setView(gCamera->getDefaultFOV() / mCameraZoom); - gCamera->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mWidth, mHeight, FALSE); + LLViewerCamera::getInstance()->setAspect((F32) mWidth / mHeight); + LLViewerCamera::getInstance()->setView(LLViewerCamera::getInstance()->getDefaultFOV() / mCameraZoom); + LLViewerCamera::getInstance()->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mWidth, mHeight, FALSE); gPipeline.enableLightsAvatar(); diff --git a/indra/newview/llfloaterinspect.cpp b/indra/newview/llfloaterinspect.cpp index 4280e250d7..a2e26d27a8 100644 --- a/indra/newview/llfloaterinspect.cpp +++ b/indra/newview/llfloaterinspect.cpp @@ -40,7 +40,7 @@ #include "lltoolmgr.h" #include "llviewercontrol.h" #include "llviewerobject.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" LLFloaterInspect* LLFloaterInspect::sInstance = NULL; @@ -49,19 +49,19 @@ LLFloaterInspect::LLFloaterInspect(void) : mDirty(FALSE) { sInstance = this; - gUICtrlFactory->buildFloater(this, "floater_inspect.xml"); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_inspect.xml"); } LLFloaterInspect::~LLFloaterInspect(void) { if(!gFloaterTools->getVisible()) { - if(gToolMgr->getBaseTool() == gToolInspect) + if(LLToolMgr::getInstance()->getBaseTool() == LLToolCompInspect::getInstance()) { - gToolMgr->clearTransientTool(); + LLToolMgr::getInstance()->clearTransientTool(); } // Switch back to basic toolset - gToolMgr->setCurrentToolset(gBasicToolset); + LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); } else { @@ -80,7 +80,7 @@ void LLFloaterInspect::show(void* ignored) // setForceSelection ensures that the pie menu does not deselect things when it // looses the focus (this can happen with "select own objects only" enabled // VWR-1471 - BOOL forcesel = gSelectMgr->setForceSelection(TRUE); + BOOL forcesel = LLSelectMgr::getInstance()->setForceSelection(TRUE); if (!sInstance) // first use { @@ -88,10 +88,10 @@ void LLFloaterInspect::show(void* ignored) } sInstance->open(); - gToolMgr->setTransientTool(gToolInspect); - gSelectMgr->setForceSelection(forcesel); // restore previouis value + LLToolMgr::getInstance()->setTransientTool(LLToolCompInspect::getInstance()); + LLSelectMgr::getInstance()->setForceSelection(forcesel); // restore previouis value - sInstance->mObjectSelection = gSelectMgr->getSelection(); + sInstance->mObjectSelection = LLSelectMgr::getInstance()->getSelection(); sInstance->refresh(); } @@ -152,7 +152,7 @@ void LLFloaterInspect::onClickOwnerProfile(void* ctrl) BOOL LLFloaterInspect::postBuild() { - mObjectList = LLUICtrlFactory::getScrollListByName(this, "object_list"); + mObjectList = getChild<LLScrollListCtrl>("object_list"); childSetAction("button owner",onClickOwnerProfile, this); childSetAction("button creator",onClickCreatorProfile, this); childSetCommitCallback("object_list", onSelectObject); @@ -256,7 +256,7 @@ void LLFloaterInspect::refresh() void LLFloaterInspect::onFocusReceived() { - gToolMgr->setTransientTool(gToolInspect); + LLToolMgr::getInstance()->setTransientTool(LLToolCompInspect::getInstance()); LLFloater::onFocusReceived(); } diff --git a/indra/newview/llfloaterlagmeter.cpp b/indra/newview/llfloaterlagmeter.cpp index 9f1bef5be7..1213d436cc 100644 --- a/indra/newview/llfloaterlagmeter.cpp +++ b/indra/newview/llfloaterlagmeter.cpp @@ -33,7 +33,7 @@ #include "llfloaterlagmeter.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llviewerstats.h" #include "llviewerimage.h" #include "llviewercontrol.h" @@ -54,23 +54,23 @@ LLFloaterLagMeter * LLFloaterLagMeter::sInstance = NULL; LLFloaterLagMeter::LLFloaterLagMeter() : LLFloater("floater_lagmeter") { - gUICtrlFactory->buildFloater(this, "floater_lagmeter.xml"); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_lagmeter.xml"); // Don't let this window take keyboard focus -- it's confusing to // lose arrow-key driving when testing lag. setIsChrome(TRUE); - mClientButton = LLUICtrlFactory::getButtonByName(this, "client_lagmeter"); - mClientText = LLUICtrlFactory::getTextBoxByName(this, "client_text"); - mClientCause = LLUICtrlFactory::getTextBoxByName(this, "client_lag_cause"); + mClientButton = getChild<LLButton>("client_lagmeter"); + mClientText = getChild<LLTextBox>("client_text"); + mClientCause = getChild<LLTextBox>("client_lag_cause"); - mNetworkButton = LLUICtrlFactory::getButtonByName(this, "network_lagmeter"); - mNetworkText = LLUICtrlFactory::getTextBoxByName(this, "network_text"); - mNetworkCause = LLUICtrlFactory::getTextBoxByName(this, "network_lag_cause"); + mNetworkButton = getChild<LLButton>("network_lagmeter"); + mNetworkText = getChild<LLTextBox>("network_text"); + mNetworkCause = getChild<LLTextBox>("network_lag_cause"); - mServerButton = LLUICtrlFactory::getButtonByName(this, "server_lagmeter"); - mServerText = LLUICtrlFactory::getTextBoxByName(this, "server_text"); - mServerCause = LLUICtrlFactory::getTextBoxByName(this, "server_lag_cause"); + mServerButton = getChild<LLButton>("server_lagmeter"); + mServerText = getChild<LLTextBox>("server_text"); + mServerCause = getChild<LLTextBox>("server_lag_cause"); LLString config_string = getString("client_frame_rate_critical_fps", mStringArgs); mClientFrameTimeCritical = 1.0f / (float)atof( config_string.c_str() ); @@ -156,7 +156,7 @@ void LLFloaterLagMeter::show(void *data) void LLFloaterLagMeter::determineClient() { - F32 client_frame_time = gViewerStats->mFPSStat.getMeanDuration(); + F32 client_frame_time = LLViewerStats::getInstance()->mFPSStat.getMeanDuration(); bool find_cause = false; if (!gFocusMgr.getAppHasFocus()) @@ -207,8 +207,8 @@ void LLFloaterLagMeter::determineClient() void LLFloaterLagMeter::determineNetwork() { - F32 packet_loss = gViewerStats->mPacketsLostPercentStat.getMean(); - F32 ping_time = gViewerStats->mSimPingStat.getMean(); + F32 packet_loss = LLViewerStats::getInstance()->mPacketsLostPercentStat.getMean(); + F32 ping_time = LLViewerStats::getInstance()->mSimPingStat.getMean(); bool find_cause_loss = false; bool find_cause_ping = false; @@ -258,7 +258,7 @@ void LLFloaterLagMeter::determineNetwork() void LLFloaterLagMeter::determineServer() { - F32 sim_frame_time = gViewerStats->mSimFrameMsec.getCurrent(); + F32 sim_frame_time = LLViewerStats::getInstance()->mSimFrameMsec.getCurrent(); bool find_cause = false; if(sim_frame_time >= mServerFrameTimeCritical) @@ -282,23 +282,23 @@ void LLFloaterLagMeter::determineServer() if(find_cause) { - if(gViewerStats->mSimSimPhysicsMsec.getCurrent() > mServerSingleProcessMaxTime) + if(LLViewerStats::getInstance()->mSimSimPhysicsMsec.getCurrent() > mServerSingleProcessMaxTime) { mServerCause->setText( getString("server_physics_cause_msg", mStringArgs) ); } - else if(gViewerStats->mSimScriptMsec.getCurrent() > mServerSingleProcessMaxTime) + else if(LLViewerStats::getInstance()->mSimScriptMsec.getCurrent() > mServerSingleProcessMaxTime) { mServerCause->setText( getString("server_scripts_cause_msg", mStringArgs) ); } - else if(gViewerStats->mSimNetMsec.getCurrent() > mServerSingleProcessMaxTime) + else if(LLViewerStats::getInstance()->mSimNetMsec.getCurrent() > mServerSingleProcessMaxTime) { mServerCause->setText( getString("server_net_cause_msg", mStringArgs) ); } - else if(gViewerStats->mSimAgentMsec.getCurrent() > mServerSingleProcessMaxTime) + else if(LLViewerStats::getInstance()->mSimAgentMsec.getCurrent() > mServerSingleProcessMaxTime) { mServerCause->setText( getString("server_agent_cause_msg", mStringArgs) ); } - else if(gViewerStats->mSimImagesMsec.getCurrent() > mServerSingleProcessMaxTime) + else if(LLViewerStats::getInstance()->mSimImagesMsec.getCurrent() > mServerSingleProcessMaxTime) { mServerCause->setText( getString("server_images_cause_msg", mStringArgs) ); } diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index aafd5d7cb4..595f4afd72 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -60,7 +60,7 @@ #include "lltextbox.h" #include "lltexturectrl.h" #include "lluiconstants.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llviewermessage.h" #include "llviewerparcelmgr.h" #include "llviewerregion.h" @@ -130,12 +130,12 @@ void send_parcel_select_objects(S32 parcel_local_id, S32 return_type, { LLMessageSystem *msg = gMessageSystem; - LLViewerRegion* region = gParcelMgr->getSelectionRegion(); + LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion(); if (!region) return; // Since new highlight will be coming in, drop any highlights // that exist right now. - gSelectMgr->unhighlightAll(); + LLSelectMgr::getInstance()->unhighlightAll(); msg->newMessageFast(_PREHASH_ParcelSelectObjects); msg->nextBlockFast(_PREHASH_AgentData); @@ -191,9 +191,9 @@ void LLFloaterLand::onOpen() { // Done automatically when the selected parcel's properties arrive // (and hence we have the local id). - // gParcelMgr->sendParcelAccessListRequest(AL_ACCESS | AL_BAN | AL_RENTER); + // LLViewerParcelMgr::getInstance()->sendParcelAccessListRequest(AL_ACCESS | AL_BAN | AL_RENTER); - mParcel = gParcelMgr->getFloatingParcelSelection(); + mParcel = LLViewerParcelMgr::getInstance()->getFloatingParcelSelection(); // Refresh even if not over a region so we don't get an // uninitialized dialog. The dialog is 0-region aware. @@ -204,12 +204,12 @@ void LLFloaterLand::onOpen() // virtual void LLFloaterLand::onClose(bool app_quitting) { - gParcelMgr->removeObserver( sObserver ); + LLViewerParcelMgr::getInstance()->removeObserver( sObserver ); delete sObserver; sObserver = NULL; // Might have been showing owned objects - gSelectMgr->unhighlightAll(); + LLSelectMgr::getInstance()->unhighlightAll(); // Save which panel we had open sLastTab = mTabLand->getCurrentPanelIndex(); @@ -233,19 +233,18 @@ LLFloaterLand::LLFloaterLand(const LLSD& seed) factory_map["land_media_panel"] = LLCallbackMap(createPanelLandMedia, this); factory_map["land_access_panel"] = LLCallbackMap(createPanelLandAccess, this); - gUICtrlFactory->buildFloater(this, "floater_about_land.xml", &factory_map, false); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_about_land.xml", &factory_map, false); sObserver = new LLParcelSelectionObserver(); - gParcelMgr->addObserver( sObserver ); + LLViewerParcelMgr::getInstance()->addObserver( sObserver ); } BOOL LLFloaterLand::postBuild() { - LLTabContainer* tab = LLUICtrlFactory::getTabContainerByName(this, "landtab"); + LLTabContainer* tab = getChild<LLTabContainer>("landtab"); mTabLand = (LLTabContainer*) tab; - if (tab) { tab->selectTab(sLastTab); @@ -280,8 +279,6 @@ void* LLFloaterLand::createPanelLandGeneral(void* data) } // static - - void* LLFloaterLand::createPanelLandCovenant(void* data) { LLFloaterLand* self = (LLFloaterLand*)data; @@ -337,96 +334,96 @@ LLPanelLandGeneral::LLPanelLandGeneral(LLParcelSelectionHandle& parcel) BOOL LLPanelLandGeneral::postBuild() { - mEditName = LLUICtrlFactory::getLineEditorByName(this, "Name"); + mEditName = getChild<LLLineEditor>("Name"); mEditName->setCommitCallback(onCommitAny); childSetPrevalidate("Name", LLLineEditor::prevalidatePrintableNotPipe); childSetUserData("Name", this); - mEditDesc = LLUICtrlFactory::getTextEditorByName(this, "Description"); + mEditDesc = getChild<LLTextEditor>("Description"); mEditDesc->setCommitOnFocusLost(TRUE); mEditDesc->setCommitCallback(onCommitAny); childSetPrevalidate("Description", LLLineEditor::prevalidatePrintableNotPipe); childSetUserData("Description", this); - mTextSalePending = LLUICtrlFactory::getTextBoxByName(this, "SalePending"); - mTextOwnerLabel = LLUICtrlFactory::getTextBoxByName(this, "Owner:"); - mTextOwner = LLUICtrlFactory::getTextBoxByName(this, "OwnerText"); + mTextSalePending = getChild<LLTextBox>("SalePending"); + mTextOwnerLabel = getChild<LLTextBox>("Owner:"); + mTextOwner = getChild<LLTextBox>("OwnerText"); - mBtnProfile = LLUICtrlFactory::getButtonByName(this, "Profile..."); + mBtnProfile = getChild<LLButton>("Profile..."); mBtnProfile->setClickedCallback(onClickProfile, this); - mTextGroupLabel = LLUICtrlFactory::getTextBoxByName(this, "Group:"); - mTextGroup = LLUICtrlFactory::getTextBoxByName(this, "GroupText"); + mTextGroupLabel = getChild<LLTextBox>("Group:"); + mTextGroup = getChild<LLTextBox>("GroupText"); - mBtnSetGroup = LLUICtrlFactory::getButtonByName(this, "Set..."); + mBtnSetGroup = getChild<LLButton>("Set..."); mBtnSetGroup->setClickedCallback(onClickSetGroup, this); - mCheckDeedToGroup = LLUICtrlFactory::getCheckBoxByName(this, "check deed"); + mCheckDeedToGroup = getChild<LLCheckBoxCtrl>( "check deed"); childSetCommitCallback("check deed", onCommitAny, this); - mBtnDeedToGroup = LLUICtrlFactory::getButtonByName(this, "Deed..."); + mBtnDeedToGroup = getChild<LLButton>("Deed..."); mBtnDeedToGroup->setClickedCallback(onClickDeed, this); - mCheckContributeWithDeed = LLUICtrlFactory::getCheckBoxByName(this, "check contrib"); + mCheckContributeWithDeed = getChild<LLCheckBoxCtrl>( "check contrib"); childSetCommitCallback("check contrib", onCommitAny, this); - mSaleInfoNotForSale = LLUICtrlFactory::getTextBoxByName(this, "Not for sale."); + mSaleInfoNotForSale = getChild<LLTextBox>("Not for sale."); - mSaleInfoForSale1 = LLUICtrlFactory::getTextBoxByName(this, "For Sale: Price L$[PRICE]."); + mSaleInfoForSale1 = getChild<LLTextBox>("For Sale: Price L$[PRICE]."); - mBtnSellLand = LLUICtrlFactory::getButtonByName(this, "Sell Land..."); + mBtnSellLand = getChild<LLButton>("Sell Land..."); mBtnSellLand->setClickedCallback(onClickSellLand, this); - mSaleInfoForSale2 = LLUICtrlFactory::getTextBoxByName(this, "For sale to"); + mSaleInfoForSale2 = getChild<LLTextBox>("For sale to"); - mSaleInfoForSaleObjects = LLUICtrlFactory::getTextBoxByName(this, "Sell with landowners objects in parcel."); + mSaleInfoForSaleObjects = getChild<LLTextBox>("Sell with landowners objects in parcel."); - mSaleInfoForSaleNoObjects = LLUICtrlFactory::getTextBoxByName(this, "Selling with no objects in parcel."); + mSaleInfoForSaleNoObjects = getChild<LLTextBox>("Selling with no objects in parcel."); - mBtnStopSellLand = LLUICtrlFactory::getButtonByName(this, "Cancel Land Sale"); + mBtnStopSellLand = getChild<LLButton>("Cancel Land Sale"); mBtnStopSellLand->setClickedCallback(onClickStopSellLand, this); - mTextClaimDateLabel = LLUICtrlFactory::getTextBoxByName(this, "Claimed:"); - mTextClaimDate = LLUICtrlFactory::getTextBoxByName(this, "DateClaimText"); + mTextClaimDateLabel = getChild<LLTextBox>("Claimed:"); + mTextClaimDate = getChild<LLTextBox>("DateClaimText"); - mTextPriceLabel = LLUICtrlFactory::getTextBoxByName(this, "PriceLabel"); - mTextPrice = LLUICtrlFactory::getTextBoxByName(this, "PriceText"); + mTextPriceLabel = getChild<LLTextBox>("PriceLabel"); + mTextPrice = getChild<LLTextBox>("PriceText"); - mTextDwell = LLUICtrlFactory::getTextBoxByName(this, "DwellText"); + mTextDwell = getChild<LLTextBox>("DwellText"); - mBtnBuyLand = LLUICtrlFactory::getButtonByName(this, "Buy Land..."); + mBtnBuyLand = getChild<LLButton>("Buy Land..."); mBtnBuyLand->setClickedCallback(onClickBuyLand, (void*)&BUY_PERSONAL_LAND); - mBtnBuyGroupLand = LLUICtrlFactory::getButtonByName(this, "Buy For Group..."); + mBtnBuyGroupLand = getChild<LLButton>("Buy For Group..."); mBtnBuyGroupLand->setClickedCallback(onClickBuyLand, (void*)&BUY_GROUP_LAND); - mBtnBuyPass = LLUICtrlFactory::getButtonByName(this, "Buy Pass..."); + mBtnBuyPass = getChild<LLButton>("Buy Pass..."); mBtnBuyPass->setClickedCallback(onClickBuyPass, this); - mBtnReleaseLand = LLUICtrlFactory::getButtonByName(this, "Abandon Land..."); + mBtnReleaseLand = getChild<LLButton>("Abandon Land..."); mBtnReleaseLand->setClickedCallback(onClickRelease, NULL); - mBtnReclaimLand = LLUICtrlFactory::getButtonByName(this, "Reclaim Land..."); + mBtnReclaimLand = getChild<LLButton>("Reclaim Land..."); mBtnReclaimLand->setClickedCallback(onClickReclaim, NULL); - mBtnStartAuction = LLUICtrlFactory::getButtonByName(this, "Linden Sale..."); + mBtnStartAuction = getChild<LLButton>("Linden Sale..."); mBtnStartAuction->setClickedCallback(onClickStartAuction, NULL); return TRUE; @@ -445,7 +442,7 @@ void LLPanelLandGeneral::refresh() LLParcel *parcel = mParcel->getParcel(); bool region_owner = false; - LLViewerRegion* regionp = gParcelMgr->getSelectionRegion(); + LLViewerRegion* regionp = LLViewerParcelMgr::getInstance()->getSelectionRegion(); if(regionp && (regionp->getOwner() == gAgent.getID())) { region_owner = true; @@ -672,16 +669,16 @@ void LLPanelLandGeneral::refresh() refreshNames(); mBtnBuyLand->setEnabled( - gParcelMgr->canAgentBuyParcel(parcel, false)); + LLViewerParcelMgr::getInstance()->canAgentBuyParcel(parcel, false)); mBtnBuyGroupLand->setEnabled( - gParcelMgr->canAgentBuyParcel(parcel, true)); + LLViewerParcelMgr::getInstance()->canAgentBuyParcel(parcel, true)); // show pricing information S32 area; S32 claim_price; S32 rent_price; F32 dwell; - gParcelMgr->getDisplayInfo(&area, + LLViewerParcelMgr::getInstance()->getDisplayInfo(&area, &claim_price, &rent_price, &for_sale, @@ -710,7 +707,7 @@ void LLPanelLandGeneral::refresh() mBtnReleaseLand->setEnabled( can_release ); } - BOOL use_pass = parcel->getParcelFlag(PF_USE_PASS_LIST) && !gParcelMgr->isCollisionBanned();; + BOOL use_pass = parcel->getParcelFlag(PF_USE_PASS_LIST) && !LLViewerParcelMgr::getInstance()->isCollisionBanned();; mBtnBuyPass->setEnabled(use_pass); } } @@ -827,7 +824,7 @@ void LLPanelLandGeneral::setGroup(const LLUUID& group_id) //mTextGroup->setText(group_name); // Send update - gParcelMgr->sendParcelPropertiesUpdate(parcel); + LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate(parcel); // Update UI refresh(); @@ -837,7 +834,7 @@ void LLPanelLandGeneral::setGroup(const LLUUID& group_id) void LLPanelLandGeneral::onClickBuyLand(void* data) { BOOL* for_group = (BOOL*)data; - gParcelMgr->startBuyLand(*for_group); + LLViewerParcelMgr::getInstance()->startBuyLand(*for_group); } BOOL LLPanelLandGeneral::enableDeedToGroup(void* data) @@ -853,29 +850,29 @@ void LLPanelLandGeneral::onClickDeed(void*) //LLParcel* parcel = mParcel->getParcel(); //if (parcel) //{ - gParcelMgr->startDeedLandToGroup(); + LLViewerParcelMgr::getInstance()->startDeedLandToGroup(); //} } // static void LLPanelLandGeneral::onClickRelease(void*) { - gParcelMgr->startReleaseLand(); + LLViewerParcelMgr::getInstance()->startReleaseLand(); } // static void LLPanelLandGeneral::onClickReclaim(void*) { lldebugs << "LLPanelLandGeneral::onClickReclaim()" << llendl; - gParcelMgr->reclaimParcel(); + LLViewerParcelMgr::getInstance()->reclaimParcel(); } // static BOOL LLPanelLandGeneral::enableBuyPass(void* data) { LLPanelLandGeneral* panelp = (LLPanelLandGeneral*)data; - LLParcel* parcel = panelp != NULL ? panelp->mParcel->getParcel() : gParcelMgr->getParcelSelection()->getParcel(); - return (parcel != NULL) && (parcel->getParcelFlag(PF_USE_PASS_LIST) && !gParcelMgr->isCollisionBanned()); + LLParcel* parcel = panelp != NULL ? panelp->mParcel->getParcel() : LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel(); + return (parcel != NULL) && (parcel->getParcelFlag(PF_USE_PASS_LIST) && !LLViewerParcelMgr::getInstance()->isCollisionBanned()); } @@ -883,7 +880,7 @@ BOOL LLPanelLandGeneral::enableBuyPass(void* data) void LLPanelLandGeneral::onClickBuyPass(void* data) { LLPanelLandGeneral* panelp = (LLPanelLandGeneral*)data; - LLParcel* parcel = panelp != NULL ? panelp->mParcel->getParcel() : gParcelMgr->getParcelSelection()->getParcel(); + LLParcel* parcel = panelp != NULL ? panelp->mParcel->getParcel() : LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel(); if (!parcel) return; @@ -927,7 +924,7 @@ void LLPanelLandGeneral::cbBuyPass(S32 option, void* data) if (0 == option) { // User clicked OK - gParcelMgr->buyPass(); + LLViewerParcelMgr::getInstance()->buyPass(); } } @@ -965,7 +962,7 @@ void LLPanelLandGeneral::onCommitAny(LLUICtrl *ctrl, void *userdata) parcel->setContributeWithDeed(contribute_with_deed); // Send update to server - gParcelMgr->sendParcelPropertiesUpdate( parcel ); + LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel ); // Might have changed properties, so let's redraw! panelp->refresh(); @@ -974,7 +971,7 @@ void LLPanelLandGeneral::onCommitAny(LLUICtrl *ctrl, void *userdata) // static void LLPanelLandGeneral::onClickSellLand(void* data) { - gParcelMgr->startSellLand(); + LLViewerParcelMgr::getInstance()->startSellLand(); } // static @@ -987,7 +984,7 @@ void LLPanelLandGeneral::onClickStopSellLand(void* data) parcel->setSalePrice(0); parcel->setAuthorizedBuyerID(LLUUID::null); - gParcelMgr->sendParcelPropertiesUpdate(parcel); + LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate(parcel); } //--------------------------------------------------------------------------- @@ -1004,34 +1001,34 @@ BOOL LLPanelLandObjects::postBuild() { mFirstReply = TRUE; - mParcelObjectBonus = LLUICtrlFactory::getTextBoxByName(this, "parcel_object_bonus"); - mSWTotalObjects = LLUICtrlFactory::getTextBoxByName(this, "objects_available"); - mObjectContribution = LLUICtrlFactory::getTextBoxByName(this, "object_contrib_text"); - mTotalObjects = LLUICtrlFactory::getTextBoxByName(this, "total_objects_text"); - mOwnerObjects = LLUICtrlFactory::getTextBoxByName(this, "owner_objects_text"); + mParcelObjectBonus = getChild<LLTextBox>("parcel_object_bonus"); + mSWTotalObjects = getChild<LLTextBox>("objects_available"); + mObjectContribution = getChild<LLTextBox>("object_contrib_text"); + mTotalObjects = getChild<LLTextBox>("total_objects_text"); + mOwnerObjects = getChild<LLTextBox>("owner_objects_text"); - mBtnShowOwnerObjects = LLUICtrlFactory::getButtonByName(this, "ShowOwner"); + mBtnShowOwnerObjects = getChild<LLButton>("ShowOwner"); mBtnShowOwnerObjects->setClickedCallback(onClickShowOwnerObjects, this); - mBtnReturnOwnerObjects = LLUICtrlFactory::getButtonByName(this, "ReturnOwner..."); + mBtnReturnOwnerObjects = getChild<LLButton>("ReturnOwner..."); mBtnReturnOwnerObjects->setClickedCallback(onClickReturnOwnerObjects, this); - mGroupObjects = LLUICtrlFactory::getTextBoxByName(this, "group_objects_text"); - mBtnShowGroupObjects = LLUICtrlFactory::getButtonByName(this, "ShowGroup"); + mGroupObjects = getChild<LLTextBox>("group_objects_text"); + mBtnShowGroupObjects = getChild<LLButton>("ShowGroup"); mBtnShowGroupObjects->setClickedCallback(onClickShowGroupObjects, this); - mBtnReturnGroupObjects = LLUICtrlFactory::getButtonByName(this, "ReturnGroup..."); + mBtnReturnGroupObjects = getChild<LLButton>("ReturnGroup..."); mBtnReturnGroupObjects->setClickedCallback(onClickReturnGroupObjects, this); - mOtherObjects = LLUICtrlFactory::getTextBoxByName(this, "other_objects_text"); - mBtnShowOtherObjects = LLUICtrlFactory::getButtonByName(this, "ShowOther"); + mOtherObjects = getChild<LLTextBox>("other_objects_text"); + mBtnShowOtherObjects = getChild<LLButton>("ShowOther"); mBtnShowOtherObjects->setClickedCallback(onClickShowOtherObjects, this); - mBtnReturnOtherObjects = LLUICtrlFactory::getButtonByName(this, "ReturnOther..."); + mBtnReturnOtherObjects = getChild<LLButton>("ReturnOther..."); mBtnReturnOtherObjects->setClickedCallback(onClickReturnOtherObjects, this); - mSelectedObjects = LLUICtrlFactory::getTextBoxByName(this, "selected_objects_text"); - mCleanOtherObjectsTime = LLUICtrlFactory::getLineEditorByName(this, "clean other time"); + mSelectedObjects = getChild<LLTextBox>("selected_objects_text"); + mCleanOtherObjectsTime = getChild<LLLineEditor>("clean other time"); mCleanOtherObjectsTime->setFocusLostCallback(onLostFocus, this); mCleanOtherObjectsTime->setCommitCallback(onCommitClean); @@ -1039,22 +1036,15 @@ BOOL LLPanelLandObjects::postBuild() childSetPrevalidate("clean other time", LLLineEditor::prevalidateNonNegativeS32); childSetUserData("clean other time", this); - mBtnRefresh = LLUICtrlFactory::getButtonByName(this, "Refresh List"); + mBtnRefresh = getChild<LLButton>("Refresh List"); mBtnRefresh->setClickedCallback(onClickRefresh, this); - mBtnReturnOwnerList = LLUICtrlFactory::getButtonByName(this, "Return objects..."); + mBtnReturnOwnerList = getChild<LLButton>("Return objects..."); mBtnReturnOwnerList->setClickedCallback(onClickReturnOwnerList, this); - LLUUID image_id; - - image_id.set( gViewerArt.getString("icon_avatar_online.tga") ); - mIconAvatarOnline = gImageList.getImage(image_id, MIPMAP_FALSE, TRUE); - - image_id.set( gViewerArt.getString("icon_avatar_offline.tga") ); - mIconAvatarOffline = gImageList.getImage(image_id, MIPMAP_FALSE, TRUE); - - image_id.set( gViewerArt.getString("icon_group.tga") ); - mIconGroup = gImageList.getImage(image_id, MIPMAP_FALSE, TRUE); + mIconAvatarOnline = LLUIImageList::getInstance()->getUIImage("icon_avatar_online.tga"); + mIconAvatarOffline = LLUIImageList::getInstance()->getUIImage("icon_avatar_offline.tga"); + mIconGroup = LLUIImageList::getInstance()->getUIImage("icon_group.tga"); mOwnerList = getChild<LLNameListCtrl>("owner list"); mOwnerList->sortByColumn(3, FALSE); @@ -1146,7 +1136,7 @@ void LLPanelLandObjects::refresh() // Can't have more than region max tasks, regardless of parcel // object bonus factor. - LLViewerRegion* region = gParcelMgr->getSelectionRegion(); + LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion(); if (region) { S32 max_tasks_per_region = (S32)region->getMaxTasks(); @@ -1223,7 +1213,7 @@ void send_other_clean_time_message(S32 parcel_local_id, S32 other_clean_time) { LLMessageSystem *msg = gMessageSystem; - LLViewerRegion* region = gParcelMgr->getSelectionRegion(); + LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion(); if (!region) return; msg->newMessageFast(_PREHASH_ParcelSetOtherCleanTime); @@ -1242,7 +1232,7 @@ void send_return_objects_message(S32 parcel_local_id, S32 return_type, { LLMessageSystem *msg = gMessageSystem; - LLViewerRegion* region = gParcelMgr->getSelectionRegion(); + LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion(); if (!region) return; msg->newMessageFast(_PREHASH_ParcelReturnObjects); @@ -1306,8 +1296,8 @@ void LLPanelLandObjects::callbackReturnOwnerObjects(S32 option, void* userdata) } } - gSelectMgr->unhighlightAll(); - gParcelMgr->sendParcelPropertiesUpdate( parcel ); + LLSelectMgr::getInstance()->unhighlightAll(); + LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel ); lop->refresh(); } @@ -1328,8 +1318,8 @@ void LLPanelLandObjects::callbackReturnGroupObjects(S32 option, void* userdata) send_return_objects_message(parcel->getLocalID(), RT_GROUP); } } - gSelectMgr->unhighlightAll(); - gParcelMgr->sendParcelPropertiesUpdate( parcel ); + LLSelectMgr::getInstance()->unhighlightAll(); + LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel ); lop->refresh(); } @@ -1346,8 +1336,8 @@ void LLPanelLandObjects::callbackReturnOtherObjects(S32 option, void* userdata) send_return_objects_message(parcel->getLocalID(), RT_OTHER); } } - gSelectMgr->unhighlightAll(); - gParcelMgr->sendParcelPropertiesUpdate( parcel ); + LLSelectMgr::getInstance()->unhighlightAll(); + LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel ); lop->refresh(); } @@ -1380,8 +1370,8 @@ void LLPanelLandObjects::callbackReturnOwnerList(S32 option, void* userdata) } } } - gSelectMgr->unhighlightAll(); - gParcelMgr->sendParcelPropertiesUpdate( parcel ); + LLSelectMgr::getInstance()->unhighlightAll(); + LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel ); self->refresh(); } @@ -1428,7 +1418,7 @@ void LLPanelLandObjects::onClickRefresh(void* userdata) LLParcel* parcel = self->mParcel->getParcel(); if (!parcel) return; - LLViewerRegion* region = gParcelMgr->getSelectionRegion(); + LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion(); if (!region) return; // ready the list for results @@ -1494,17 +1484,17 @@ void LLPanelLandObjects::processParcelObjectOwnersReply(LLMessageSystem *msg, vo LLScrollListItem *row = new LLScrollListItem( TRUE, NULL, owner_id); if (is_group_owned) { - row->addColumn(self->mIconGroup.notNull() ? self->mIconGroup->getID() : LLUUID::null); + row->addColumn(self->mIconGroup); row->addColumn(OWNER_GROUP, FONT); } else if (is_online) { - row->addColumn(self->mIconAvatarOnline.notNull() ? self->mIconAvatarOnline->getID() : LLUUID::null); + row->addColumn(self->mIconAvatarOnline); row->addColumn(OWNER_ONLINE, FONT); } else // offline { - row->addColumn(self->mIconAvatarOffline.notNull() ? self->mIconAvatarOffline->getID() : LLUUID::null); + row->addColumn(self->mIconAvatarOffline); row->addColumn(OWNER_OFFLINE, FONT); } // Placeholder for name. @@ -1749,56 +1739,56 @@ BOOL LLPanelLandOptions::postBuild() { - mCheckEditObjects = LLUICtrlFactory::getCheckBoxByName(this, "edit objects check"); + mCheckEditObjects = getChild<LLCheckBoxCtrl>( "edit objects check"); childSetCommitCallback("edit objects check", onCommitAny, this); - mCheckEditGroupObjects = LLUICtrlFactory::getCheckBoxByName(this, "edit group objects check"); + mCheckEditGroupObjects = getChild<LLCheckBoxCtrl>( "edit group objects check"); childSetCommitCallback("edit group objects check", onCommitAny, this); - mCheckAllObjectEntry = LLUICtrlFactory::getCheckBoxByName(this, "all object entry check"); + mCheckAllObjectEntry = getChild<LLCheckBoxCtrl>( "all object entry check"); childSetCommitCallback("all object entry check", onCommitAny, this); - mCheckGroupObjectEntry = LLUICtrlFactory::getCheckBoxByName(this, "group object entry check"); + mCheckGroupObjectEntry = getChild<LLCheckBoxCtrl>( "group object entry check"); childSetCommitCallback("group object entry check", onCommitAny, this); - mCheckEditLand = LLUICtrlFactory::getCheckBoxByName(this, "edit land check"); + mCheckEditLand = getChild<LLCheckBoxCtrl>( "edit land check"); childSetCommitCallback("edit land check", onCommitAny, this); - mCheckLandmark = LLUICtrlFactory::getCheckBoxByName(this, "check landmark"); + mCheckLandmark = getChild<LLCheckBoxCtrl>( "check landmark"); childSetCommitCallback("check landmark", onCommitAny, this); - mCheckGroupScripts = LLUICtrlFactory::getCheckBoxByName(this, "check group scripts"); + mCheckGroupScripts = getChild<LLCheckBoxCtrl>( "check group scripts"); childSetCommitCallback("check group scripts", onCommitAny, this); - mCheckFly = LLUICtrlFactory::getCheckBoxByName(this, "check fly"); + mCheckFly = getChild<LLCheckBoxCtrl>( "check fly"); childSetCommitCallback("check fly", onCommitAny, this); - mCheckOtherScripts = LLUICtrlFactory::getCheckBoxByName(this, "check other scripts"); + mCheckOtherScripts = getChild<LLCheckBoxCtrl>( "check other scripts"); childSetCommitCallback("check other scripts", onCommitAny, this); - mCheckSafe = LLUICtrlFactory::getCheckBoxByName(this, "check safe"); + mCheckSafe = getChild<LLCheckBoxCtrl>( "check safe"); childSetCommitCallback("check safe", onCommitAny, this); - mPushRestrictionCtrl = LLUICtrlFactory::getCheckBoxByName(this, "PushRestrictCheck"); + mPushRestrictionCtrl = getChild<LLCheckBoxCtrl>( "PushRestrictCheck"); childSetCommitCallback("PushRestrictCheck", onCommitAny, this); - mCheckShowDirectory = LLUICtrlFactory::getCheckBoxByName(this, "ShowDirectoryCheck"); + mCheckShowDirectory = getChild<LLCheckBoxCtrl>( "ShowDirectoryCheck"); childSetCommitCallback("ShowDirectoryCheck", onCommitAny, this); - mCategoryCombo = LLUICtrlFactory::getComboBoxByName(this, "land category"); + mCategoryCombo = getChild<LLComboBox>( "land category"); childSetCommitCallback("land category", onCommitAny, this); - mMatureCtrl = LLUICtrlFactory::getCheckBoxByName(this, "MatureCheck"); + mMatureCtrl = getChild<LLCheckBoxCtrl>( "MatureCheck"); childSetCommitCallback("MatureCheck", onCommitAny, this); - mPublishHelpButton = LLUICtrlFactory::getButtonByName(this, "?"); + mPublishHelpButton = getChild<LLButton>("?"); mPublishHelpButton->setClickedCallback(onClickPublishHelp, this); @@ -1847,17 +1837,17 @@ BOOL LLPanelLandOptions::postBuild() } - mLocationText = LLUICtrlFactory::getTextBoxByName(this, "landing_point"); + mLocationText = getChild<LLTextBox>("landing_point"); - mSetBtn = LLUICtrlFactory::getButtonByName(this, "Set"); + mSetBtn = getChild<LLButton>("Set"); mSetBtn->setClickedCallback(onClickSet, this); - mClearBtn = LLUICtrlFactory::getButtonByName(this, "Clear"); + mClearBtn = getChild<LLButton>("Clear"); mClearBtn->setClickedCallback(onClickClear, this); - mLandingTypeCombo = LLUICtrlFactory::getComboBoxByName(this, "landing type"); + mLandingTypeCombo = getChild<LLComboBox>( "landing type"); childSetCommitCallback("landing type", onCommitAny, this); return TRUE; @@ -2031,12 +2021,12 @@ void LLPanelLandOptions::refresh() // virtual void LLPanelLandOptions::draw() { - LLParcel *parcel = gParcelMgr->getFloatingParcelSelection()->getParcel(); + LLParcel *parcel = LLViewerParcelMgr::getInstance()->getFloatingParcelSelection()->getParcel(); if(parcel) { LLViewerRegion* region; - region = gParcelMgr->getSelectionRegion(); + region = LLViewerParcelMgr::getInstance()->getSelectionRegion(); llassert(region); // Region should never be null. BOOL can_change_identity = region ? @@ -2091,7 +2081,7 @@ void LLPanelLandOptions::onCommitAny(LLUICtrl *ctrl, void *userdata) S32 landing_type_index = self->mLandingTypeCombo->getCurrentIndex(); LLUUID snapshot_id = self->mSnapshotCtrl->getImageAssetID(); LLViewerRegion* region; - region = gParcelMgr->getSelectionRegion(); + region = LLViewerParcelMgr::getInstance()->getSelectionRegion(); if (!allow_other_scripts && region && region->getAllowDamage()) { @@ -2120,7 +2110,7 @@ void LLPanelLandOptions::onCommitAny(LLUICtrl *ctrl, void *userdata) parcel->setSnapshotID(snapshot_id); // Send current parcel data upstream to server - gParcelMgr->sendParcelPropertiesUpdate( parcel ); + LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel ); // Might have changed properties, so let's redraw! self->refresh(); @@ -2135,7 +2125,7 @@ void LLPanelLandOptions::onClickSet(void* userdata) LLParcel* selected_parcel = self->mParcel->getParcel(); if (!selected_parcel) return; - LLParcel* agent_parcel = gParcelMgr->getAgentParcel(); + LLParcel* agent_parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if (!agent_parcel) return; if (agent_parcel->getLocalID() != selected_parcel->getLocalID()) @@ -2148,7 +2138,7 @@ void LLPanelLandOptions::onClickSet(void* userdata) selected_parcel->setUserLocation(pos_region); selected_parcel->setUserLookAt(gAgent.getFrameAgent().getAtAxis()); - gParcelMgr->sendParcelPropertiesUpdate(selected_parcel); + LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate(selected_parcel); self->refresh(); } @@ -2165,7 +2155,7 @@ void LLPanelLandOptions::onClickClear(void* userdata) selected_parcel->setUserLocation(zero_vec); selected_parcel->setUserLookAt(zero_vec); - gParcelMgr->sendParcelPropertiesUpdate(selected_parcel); + LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate(selected_parcel); self->refresh(); } @@ -2173,8 +2163,8 @@ void LLPanelLandOptions::onClickClear(void* userdata) // static void LLPanelLandOptions::onClickPublishHelp(void*) { - LLViewerRegion* region = gParcelMgr->getSelectionRegion(); - LLParcel *parcel = gParcelMgr->getFloatingParcelSelection()->getParcel(); + LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion(); + LLParcel *parcel = LLViewerParcelMgr::getInstance()->getFloatingParcelSelection()->getParcel(); llassert(region); // Region should never be null. bool can_change_identity = region && parcel ? @@ -2585,7 +2575,7 @@ void LLPanelLandAccess::onCommitAny(LLUICtrl *ctrl, void *userdata) parcel->setPassHours( pass_hours ); // Send current parcel data upstream to server - gParcelMgr->sendParcelPropertiesUpdate( parcel ); + LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel ); // Might have changed properties, so let's redraw! self->refresh(); @@ -2612,7 +2602,7 @@ void LLPanelLandAccess::callbackAvatarCBAccess(const std::vector<std::string>& n if (parcel) { parcel->addToAccessList(id, 0); - gParcelMgr->sendParcelAccessListUpdate(AL_ACCESS); + LLViewerParcelMgr::getInstance()->sendParcelAccessListUpdate(AL_ACCESS); panelp->refresh(); } } @@ -2635,7 +2625,7 @@ void LLPanelLandAccess::onClickRemoveAccess(void* data) const LLUUID& agent_id = item->getUUID(); parcel->removeFromAccessList(agent_id); } - gParcelMgr->sendParcelAccessListUpdate(AL_ACCESS); + LLViewerParcelMgr::getInstance()->sendParcelAccessListUpdate(AL_ACCESS); panelp->refresh(); } } @@ -2659,7 +2649,7 @@ void LLPanelLandAccess::callbackAvatarCBBanned(const std::vector<std::string>& n if (parcel) { parcel->addToBanList(id, 0); - gParcelMgr->sendParcelAccessListUpdate(AL_BAN); + LLViewerParcelMgr::getInstance()->sendParcelAccessListUpdate(AL_BAN); panelp->refresh(); } } @@ -2682,7 +2672,7 @@ void LLPanelLandAccess::onClickRemoveBanned(void* data) const LLUUID& agent_id = item->getUUID(); parcel->removeFromBanList(agent_id); } - gParcelMgr->sendParcelAccessListUpdate(AL_BAN); + LLViewerParcelMgr::getInstance()->sendParcelAccessListUpdate(AL_BAN); panelp->refresh(); } } @@ -2709,7 +2699,7 @@ BOOL LLPanelLandCovenant::postBuild() // virtual void LLPanelLandCovenant::refresh() { - LLViewerRegion* region = gParcelMgr->getSelectionRegion(); + LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion(); if(!region) return; LLTextBox* region_name = getChild<LLTextBox>("region_name_text"); diff --git a/indra/newview/llfloaterland.h b/indra/newview/llfloaterland.h index 38d58fabfe..9979e8b24a 100644 --- a/indra/newview/llfloaterland.h +++ b/indra/newview/llfloaterland.h @@ -68,7 +68,7 @@ class LLPanelLandRenters; class LLPanelLandCovenant; class LLFloaterLand -: public LLFloater, public LLUISingleton<LLFloaterLand, VisibilityPolicy<LLFloater> > +: public LLFloater, public LLFloaterSingleton<LLFloaterLand> { friend class LLUISingleton<LLFloaterLand, VisibilityPolicy<LLFloater> >; public: @@ -281,9 +281,9 @@ protected: LLButton *mBtnReturnOwnerList; LLNameListCtrl *mOwnerList; - LLPointer<LLViewerImage> mIconAvatarOnline; - LLPointer<LLViewerImage> mIconAvatarOffline; - LLPointer<LLViewerImage> mIconGroup; + LLUIImagePtr mIconAvatarOnline; + LLUIImagePtr mIconAvatarOffline; + LLUIImagePtr mIconGroup; BOOL mFirstReply; diff --git a/indra/newview/llfloaterlandholdings.cpp b/indra/newview/llfloaterlandholdings.cpp index b150c873fe..08ea7e1b8e 100644 --- a/indra/newview/llfloaterlandholdings.cpp +++ b/indra/newview/llfloaterlandholdings.cpp @@ -49,7 +49,7 @@ #include "llbutton.h" #include "lluiconstants.h" #include "llviewermessage.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" // statics LLFloaterLandHoldings* LLFloaterLandHoldings::sInstance = NULL; @@ -59,7 +59,7 @@ LLFloaterLandHoldings* LLFloaterLandHoldings::sInstance = NULL; void LLFloaterLandHoldings::show(void*) { LLFloaterLandHoldings* floater = new LLFloaterLandHoldings(); - gUICtrlFactory->buildFloater(floater, "floater_land_holdings.xml"); + LLUICtrlFactory::getInstance()->buildFloater(floater, "floater_land_holdings.xml"); floater->center(); // query_id null is known to be us @@ -250,7 +250,7 @@ void LLFloaterLandHoldings::processPlacesReply(LLMessageSystem* msg, void**) void LLFloaterLandHoldings::buttonCore(S32 which) { - LLScrollListCtrl *list = LLUICtrlFactory::getScrollListByName(this, "parcel list"); + LLScrollListCtrl *list = getChild<LLScrollListCtrl>("parcel list"); if (!list) return; S32 index = list->getFirstSelectedIndex(); diff --git a/indra/newview/llfloatermap.cpp b/indra/newview/llfloatermap.cpp index 7de980a075..d147f863ef 100644 --- a/indra/newview/llfloatermap.cpp +++ b/indra/newview/llfloatermap.cpp @@ -184,23 +184,20 @@ BOOL LLFloaterMap::canClose() // virtual void LLFloaterMap::draw() { - if( getVisible() ) + // Note: we can't just gAgent.check cameraMouselook() because the transition states are wrong. + if( gAgent.cameraMouselook()) { - // Note: we can't just gAgent.check cameraMouselook() because the transition states are wrong. - if( gAgent.cameraMouselook()) - { - setMouseOpaque(FALSE); - getDragHandle()->setMouseOpaque(FALSE); + setMouseOpaque(FALSE); + getDragHandle()->setMouseOpaque(FALSE); - drawChild(mMap); - } - else - { - setMouseOpaque(TRUE); - getDragHandle()->setMouseOpaque(TRUE); + drawChild(mMap); + } + else + { + setMouseOpaque(TRUE); + getDragHandle()->setMouseOpaque(TRUE); - LLFloater::draw(); - } + LLFloater::draw(); } } diff --git a/indra/newview/llfloaternamedesc.cpp b/indra/newview/llfloaternamedesc.cpp index 1cac8fd4c5..2c7d40695b 100644 --- a/indra/newview/llfloaternamedesc.cpp +++ b/indra/newview/llfloaternamedesc.cpp @@ -45,7 +45,7 @@ #include "lldir.h" #include "llviewercontrol.h" #include "llviewermenufile.h" // upload_new_resource() -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" // linden includes #include "llassetstorage.h" @@ -119,7 +119,7 @@ BOOL LLFloaterNameDesc::postBuild() childSetCommitCallback("name_form", doCommit, this); childSetValue("name_form", LLSD(asset_name)); - LLLineEditor *NameEditor = LLViewerUICtrlFactory::getLineEditorByName(this, "name_form"); + LLLineEditor *NameEditor = getChild<LLLineEditor>("name_form"); if (NameEditor) { NameEditor->setMaxTextLength(DB_INV_ITEM_NAME_STR_LEN); @@ -131,7 +131,7 @@ BOOL LLFloaterNameDesc::postBuild() r.setLeftTopAndSize( PREVIEW_HPAD, y, line_width, PREVIEW_LINE_HEIGHT ); childSetCommitCallback("description_form", doCommit, this); - LLLineEditor *DescEditor = LLViewerUICtrlFactory::getLineEditorByName(this, "description_form"); + LLLineEditor *DescEditor = getChild<LLLineEditor>("description_form"); if (DescEditor) { DescEditor->setMaxTextLength(DB_INV_ITEM_DESC_STR_LEN); diff --git a/indra/newview/llfloateropenobject.cpp b/indra/newview/llfloateropenobject.cpp index 0b79c85963..a3350b5225 100644 --- a/indra/newview/llfloateropenobject.cpp +++ b/indra/newview/llfloateropenobject.cpp @@ -50,7 +50,7 @@ #include "llselectmgr.h" #include "lluiconstants.h" #include "llviewerobject.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llviewerwindow.h" @@ -63,7 +63,7 @@ LLFloaterOpenObject::LLFloaterOpenObject() { LLCallbackMap::map_t factory_map; factory_map["object_contents"] = LLCallbackMap(createPanelInventory, this); - gUICtrlFactory->buildFloater(this,"floater_openobject.xml",&factory_map); + LLUICtrlFactory::getInstance()->buildFloater(this,"floater_openobject.xml",&factory_map); childSetAction("copy_to_inventory_button", onClickMoveToInventory, this); childSetAction("copy_and_wear_button", onClickMoveAndWear, this); @@ -106,7 +106,7 @@ void LLFloaterOpenObject::dirty() // static void LLFloaterOpenObject::show() { - LLObjectSelectionHandle object_selection = gSelectMgr->getSelection(); + LLObjectSelectionHandle object_selection = LLSelectMgr::getInstance()->getSelection(); if (object_selection->getRootObjectCount() != 1) { gViewerWindow->alertXml("UnableToViewContentsMoreThanOne"); @@ -123,7 +123,7 @@ void LLFloaterOpenObject::show() sInstance->open(); /* Flawfinder: ignore */ sInstance->setFocus(TRUE); - sInstance->mObjectSelection = gSelectMgr->getEditSelection(); + sInstance->mObjectSelection = LLSelectMgr::getInstance()->getEditSelection(); } diff --git a/indra/newview/llfloaterparcel.cpp b/indra/newview/llfloaterparcel.cpp index bca4f4f42f..59e95fb943 100644 --- a/indra/newview/llfloaterparcel.cpp +++ b/indra/newview/llfloaterparcel.cpp @@ -37,10 +37,10 @@ // viewer project includes #include "llcommandhandler.h" #include "llpanelplace.h" -#include "llvieweruictrlfactory.h" // linden library includes #include "lluuid.h" +#include "lluictrlfactory.h" //----------------------------------------------------------------------------- // Globals @@ -84,7 +84,7 @@ void* LLFloaterParcelInfo::createPanelPlace(void* data) { LLFloaterParcelInfo* self = (LLFloaterParcelInfo*)data; self->mPanelParcelp = new LLPanelPlace(); // allow edit self - gUICtrlFactory->buildPanel(self->mPanelParcelp, "panel_place.xml"); + LLUICtrlFactory::getInstance()->buildPanel(self->mPanelParcelp, "panel_place.xml"); return self->mPanelParcelp; } @@ -96,7 +96,7 @@ LLFloaterParcelInfo::LLFloaterParcelInfo(const std::string& name, const LLUUID & mParcelID( parcel_id ) { mFactoryMap["place_details_panel"] = LLCallbackMap(LLFloaterParcelInfo::createPanelPlace, this); - gUICtrlFactory->buildFloater(this, "floater_preview_url.xml", &getFactoryMap()); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_preview_url.xml", &getFactoryMap()); gPlaceInfoInstances.addData(parcel_id, this); } diff --git a/indra/newview/llfloaterpostcard.cpp b/indra/newview/llfloaterpostcard.cpp index 4d97688b2a..8741cdf510 100644 --- a/indra/newview/llfloaterpostcard.cpp +++ b/indra/newview/llfloaterpostcard.cpp @@ -46,7 +46,7 @@ #include "llbutton.h" #include "llviewercontrol.h" #include "llviewernetwork.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "lluploaddialog.h" #include "llviewerstats.h" #include "llviewerwindow.h" @@ -119,7 +119,7 @@ BOOL LLFloaterPostcard::postBuild() gAgent.buildFullname(name_string); childSetValue("name_form", LLSD(name_string)); - LLTextEditor* MsgField = LLUICtrlFactory::getTextEditorByName(this, "msg_form"); + LLTextEditor* MsgField = getChild<LLTextEditor>("msg_form"); if (MsgField) { MsgField->setWordWrap(TRUE); @@ -142,7 +142,7 @@ LLFloaterPostcard* LLFloaterPostcard::showFromSnapshot(LLImageJPEG *jpeg, LLImag // It's now our job to clean them up LLFloaterPostcard *instance = new LLFloaterPostcard(jpeg, img, image_scale, pos_taken_global); - gUICtrlFactory->buildFloater(instance, "floater_postcard.xml"); + LLUICtrlFactory::getInstance()->buildFloater(instance, "floater_postcard.xml"); S32 left, top; gFloaterView->getNewFloaterPosition(&left, &top); @@ -158,7 +158,7 @@ void LLFloaterPostcard::draw() LLGLSUIDefault gls_ui; LLFloater::draw(); - if(getVisible() && !isMinimized() && mViewerImage.notNull() && mJPEGImage.notNull()) + if(!isMinimized() && mViewerImage.notNull() && mJPEGImage.notNull()) { LLRect rect(getRect()); @@ -332,7 +332,7 @@ void LLFloaterPostcard::onMsgFormFocusRecieved(LLFocusableElement* receiver, voi LLFloaterPostcard* self = (LLFloaterPostcard *)data; if(self) { - LLTextEditor* msgForm = LLUICtrlFactory::getTextEditorByName(self, "msg_form"); + LLTextEditor* msgForm = self->getChild<LLTextEditor>("msg_form"); if(msgForm && msgForm == receiver && msgForm->hasFocus() && !(self->mHasFirstMsgFocus)) { self->mHasFirstMsgFocus = true; diff --git a/indra/newview/llfloaterpostprocess.cpp b/indra/newview/llfloaterpostprocess.cpp index 33704fc720..5c42f1222f 100644 --- a/indra/newview/llfloaterpostprocess.cpp +++ b/indra/newview/llfloaterpostprocess.cpp @@ -35,7 +35,7 @@ #include "llsliderctrl.h" #include "llcheckboxctrl.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llviewerdisplay.h" #include "llpostprocess.h" #include "llcombobox.h" @@ -48,7 +48,7 @@ LLFloaterPostProcess* LLFloaterPostProcess::sPostProcess = NULL; LLFloaterPostProcess::LLFloaterPostProcess() : LLFloater("Post-Process Floater") { - gUICtrlFactory->buildFloater(this, "floater_post_process.xml"); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_post_process.xml"); /// Color Filter Callbacks childSetCommitCallback("ColorFilterToggle", &LLFloaterPostProcess::onBoolToggle, (char*)"enable_color_filter"); @@ -75,11 +75,11 @@ LLFloaterPostProcess::LLFloaterPostProcess() : LLFloater("Post-Process Floater") childSetCommitCallback("BloomStrength", &LLFloaterPostProcess::onFloatControlMoved, (char*)"bloom_strength"); // Effect loading and saving. - LLComboBox* comboBox = LLUICtrlFactory::getComboBoxByName(this, "PPEffectsCombo"); + LLComboBox* comboBox = getChild<LLComboBox>("PPEffectsCombo"); childSetAction("PPLoadEffect", &LLFloaterPostProcess::onLoadEffect, comboBox); comboBox->setCommitCallback(onChangeEffectName); - LLLineEditor* editBox = LLUICtrlFactory::getLineEditorByName(this, "PPEffectNameEditor"); + LLLineEditor* editBox = getChild<LLLineEditor>("PPEffectNameEditor"); childSetAction("PPSaveEffect", &LLFloaterPostProcess::onSaveEffect, editBox); syncMenu(); @@ -186,8 +186,7 @@ void LLFloaterPostProcess::onChangeEffectName(LLUICtrl* ctrl, void * userData) { // get the combo box and name LLComboBox * comboBox = static_cast<LLComboBox*>(ctrl); - LLLineEditor* editBox = LLUICtrlFactory::getLineEditorByName(sPostProcess, - "PPEffectNameEditor"); + LLLineEditor* editBox = sPostProcess->getChild<LLLineEditor>("PPEffectNameEditor"); // set the parameter's new name editBox->setValue(comboBox->getSelectedValue()); @@ -231,23 +230,21 @@ void LLFloaterPostProcess::onClose(bool app_quitting) void LLFloaterPostProcess::syncMenu() { // add the combo boxe contents - LLComboBox* comboBox = LLUICtrlFactory::getComboBoxByName(this, "PPEffectsCombo"); + LLComboBox* comboBox = getChild<LLComboBox>("PPEffectsCombo"); - if(comboBox != NULL) { - comboBox->removeall(); - - LLSD::map_const_iterator currEffect; - for(currEffect = gPostProcess->mAllEffects.beginMap(); - currEffect != gPostProcess->mAllEffects.endMap(); - ++currEffect) - { - comboBox->add(currEffect->first); - } - - // set the current effect as selected. - comboBox->selectByValue(gPostProcess->getSelectedEffect()); + comboBox->removeall(); + + LLSD::map_const_iterator currEffect; + for(currEffect = gPostProcess->mAllEffects.beginMap(); + currEffect != gPostProcess->mAllEffects.endMap(); + ++currEffect) + { + comboBox->add(currEffect->first); } + // set the current effect as selected. + comboBox->selectByValue(gPostProcess->getSelectedEffect()); + /// Sync Color Filter Menu childSetValue("ColorFilterToggle", gPostProcess->tweaks.useColorFilter()); //childSetValue("ColorFilterGamma", gPostProcess->tweaks.gamma()); diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 345561f551..1ad58f2706 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -69,7 +69,7 @@ #include "llagent.h" #include "llviewercontrol.h" #include "llviewernetwork.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llviewerwindow.h" #include "llkeyboard.h" #include "llscrollcontainer.h" @@ -326,36 +326,36 @@ void LLPreferenceCore::refreshEnabledGraphics() LLFloaterPreference::LLFloaterPreference() { - gUICtrlFactory->buildFloater(this, "floater_preferences.xml"); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_preferences.xml"); } BOOL LLFloaterPreference::postBuild() { - requires("About...", WIDGET_TYPE_BUTTON); - requires("OK", WIDGET_TYPE_BUTTON); - requires("Cancel", WIDGET_TYPE_BUTTON); - requires("Apply", WIDGET_TYPE_BUTTON); - requires("pref core", WIDGET_TYPE_TAB_CONTAINER); + requires<LLButton>("About..."); + requires<LLButton>("OK"); + requires<LLButton>("Cancel"); + requires<LLButton>("Apply"); + requires<LLTabContainer>("pref core"); if (!checkRequirements()) { return FALSE; } - mAboutBtn = LLUICtrlFactory::getButtonByName(this, "About..."); + mAboutBtn = getChild<LLButton>("About..."); mAboutBtn->setClickedCallback(onClickAbout, this); - mApplyBtn = LLUICtrlFactory::getButtonByName(this, "Apply"); + mApplyBtn = getChild<LLButton>("Apply"); mApplyBtn->setClickedCallback(onBtnApply, this); - mCancelBtn = LLUICtrlFactory::getButtonByName(this, "Cancel"); + mCancelBtn = getChild<LLButton>("Cancel"); mCancelBtn->setClickedCallback(onBtnCancel, this); - mOKBtn = LLUICtrlFactory::getButtonByName(this, "OK"); + mOKBtn = getChild<LLButton>("OK"); mOKBtn->setClickedCallback(onBtnOK, this); mPreferenceCore = new LLPreferenceCore( - LLUICtrlFactory::getTabContainerByName(this, "pref core"), + getChild<LLTabContainer>("pref core"), getChild<LLButton>("OK") ); @@ -371,16 +371,6 @@ LLFloaterPreference::~LLFloaterPreference() delete mPreferenceCore; } - -void LLFloaterPreference::draw() -{ - if( getVisible() ) - { - LLFloater::draw(); - } -} - - void LLFloaterPreference::apply() { this->mPreferenceCore->apply(); diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index 52592c0bad..b915dff660 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -118,7 +118,6 @@ public: protected: LLPreferenceCore *mPreferenceCore; - /*virtual*/ void draw(); /*virtual*/ void onClose(bool app_quitting); LLButton* mAboutBtn; diff --git a/indra/newview/llfloaterproperties.cpp b/indra/newview/llfloaterproperties.cpp index ace3eeac66..bea12fe017 100644 --- a/indra/newview/llfloaterproperties.cpp +++ b/indra/newview/llfloaterproperties.cpp @@ -56,7 +56,7 @@ #include "llviewerregion.h" #include "llviewercontrol.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -65,7 +65,7 @@ // helper class to watch the inventory. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLPropertiesObserver : public LLInventoryObserver +class LLPropertiesObserver : public LLInventoryObserver, public LLSingleton<LLPropertiesObserver> { public: LLPropertiesObserver() {} @@ -73,7 +73,6 @@ public: virtual void changed(U32 mask); }; -LLPropertiesObserver* gPropertiesObserver = NULL; void LLPropertiesObserver::changed(U32 mask) { // if there's a change we're interested in. @@ -144,13 +143,13 @@ LLFloaterProperties::LLFloaterProperties(const std::string& name, const LLRect& mObjectID(object_id), mDirty(TRUE) { - gUICtrlFactory->buildFloater(this,"floater_inventory_item_properties.xml"); + LLUICtrlFactory::getInstance()->buildFloater(this,"floater_inventory_item_properties.xml"); // hack to make sure these floaters are observing the inventory. - if(!gPropertiesObserver) + if(!gInventory.containsObserver(LLPropertiesObserver::getInstance())) { - gPropertiesObserver = new LLPropertiesObserver; - gInventory.addObserver(gPropertiesObserver); + // Note: this is where gPropertiesObserver used to be constructed. + gInventory.addObserver(LLPropertiesObserver::getInstance()); } // add the object to the static structure LLUUID key = mItemID ^ mObjectID; @@ -473,7 +472,7 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) { childSetValue("CheckShareWithGroup",LLSD((BOOL)TRUE)); - LLCheckBoxCtrl* ctl = LLUICtrlFactory::getCheckBoxByName(this,"CheckShareWithGroup"); + LLCheckBoxCtrl* ctl = getChild<LLCheckBoxCtrl>("CheckShareWithGroup"); if(ctl) { ctl->setTentative(FALSE); @@ -482,7 +481,7 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) else if (!is_group_copy && !is_group_modify && !is_group_move) { childSetValue("CheckShareWithGroup",LLSD((BOOL)FALSE)); - LLCheckBoxCtrl* ctl = LLUICtrlFactory::getCheckBoxByName(this,"CheckShareWithGroup"); + LLCheckBoxCtrl* ctl = getChild<LLCheckBoxCtrl>("CheckShareWithGroup"); if(ctl) { ctl->setTentative(FALSE); @@ -490,7 +489,7 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) } else { - LLCheckBoxCtrl* ctl = LLUICtrlFactory::getCheckBoxByName(this,"CheckShareWithGroup"); + LLCheckBoxCtrl* ctl = getChild<LLCheckBoxCtrl>("CheckShareWithGroup"); if(ctl) { ctl->setTentative(TRUE); @@ -543,7 +542,7 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) childSetValue("CheckNextOwnerCopy",LLSD(BOOL(next_owner_mask & PERM_COPY))); childSetValue("CheckNextOwnerTransfer",LLSD(BOOL(next_owner_mask & PERM_TRANSFER))); - LLRadioGroup* radioSaleType = LLUICtrlFactory::getRadioGroupByName(this,"RadioSaleType"); + LLRadioGroup* radioSaleType = getChild<LLRadioGroup>("RadioSaleType"); if (is_for_sale) { radioSaleType->setSelectedIndex((S32)sale_info.getSaleType() - 1); @@ -605,7 +604,7 @@ void LLFloaterProperties::onCommitName(LLUICtrl* ctrl, void* data) { return; } - LLLineEditor* labelItemName = LLUICtrlFactory::getLineEditorByName(self,"LabelItemName"); + LLLineEditor* labelItemName = self->getChild<LLLineEditor>("LabelItemName"); if(labelItemName&& (item->getName() != labelItemName->getText()) && @@ -642,7 +641,7 @@ void LLFloaterProperties::onCommitDescription(LLUICtrl* ctrl, void* data) LLViewerInventoryItem* item = (LLViewerInventoryItem*)self->findItem(); if(!item) return; - LLLineEditor* labelItemDesc = LLUICtrlFactory::getLineEditorByName(self,"LabelItemDesc"); + LLLineEditor* labelItemDesc = self->getChild<LLLineEditor>("LabelItemDesc"); if(!labelItemDesc) { return; @@ -684,7 +683,7 @@ void LLFloaterProperties::onCommitPermissions(LLUICtrl* ctrl, void* data) LLPermissions perm(item->getPermissions()); - LLCheckBoxCtrl* CheckShareWithGroup = LLUICtrlFactory::getCheckBoxByName(self,"CheckShareWithGroup"); + LLCheckBoxCtrl* CheckShareWithGroup = self->getChild<LLCheckBoxCtrl>("CheckShareWithGroup"); if(CheckShareWithGroup) { @@ -692,26 +691,26 @@ void LLFloaterProperties::onCommitPermissions(LLUICtrl* ctrl, void* data) CheckShareWithGroup->get(), PERM_MODIFY | PERM_MOVE | PERM_COPY); } - LLCheckBoxCtrl* CheckEveryoneCopy = LLUICtrlFactory::getCheckBoxByName(self,"CheckEveryoneCopy"); + LLCheckBoxCtrl* CheckEveryoneCopy = self->getChild<LLCheckBoxCtrl>("CheckEveryoneCopy"); if(CheckEveryoneCopy) { perm.setEveryoneBits(gAgent.getID(), gAgent.getGroupID(), CheckEveryoneCopy->get(), PERM_COPY); } - LLCheckBoxCtrl* CheckNextOwnerModify = LLUICtrlFactory::getCheckBoxByName(self,"CheckNextOwnerModify"); + LLCheckBoxCtrl* CheckNextOwnerModify = self->getChild<LLCheckBoxCtrl>("CheckNextOwnerModify"); if(CheckNextOwnerModify) { perm.setNextOwnerBits(gAgent.getID(), gAgent.getGroupID(), CheckNextOwnerModify->get(), PERM_MODIFY); } - LLCheckBoxCtrl* CheckNextOwnerCopy = LLUICtrlFactory::getCheckBoxByName(self,"CheckNextOwnerCopy"); + LLCheckBoxCtrl* CheckNextOwnerCopy = self->getChild<LLCheckBoxCtrl>("CheckNextOwnerCopy"); if(CheckNextOwnerCopy) { perm.setNextOwnerBits(gAgent.getID(), gAgent.getGroupID(), CheckNextOwnerCopy->get(), PERM_COPY); } - LLCheckBoxCtrl* CheckNextOwnerTransfer = LLUICtrlFactory::getCheckBoxByName(self,"CheckNextOwnerTransfer"); + LLCheckBoxCtrl* CheckNextOwnerTransfer = self->getChild<LLCheckBoxCtrl>("CheckNextOwnerTransfer"); if(CheckNextOwnerTransfer) { perm.setNextOwnerBits(gAgent.getID(), gAgent.getGroupID(), @@ -805,7 +804,7 @@ void LLFloaterProperties::updateSaleInfo() // turn on sale info LLSaleInfo::EForSale sale_type = LLSaleInfo::FS_COPY; - LLRadioGroup* RadioSaleType = LLUICtrlFactory::getRadioGroupByName(this,"RadioSaleType"); + LLRadioGroup* RadioSaleType = getChild<LLRadioGroup>("RadioSaleType"); if(RadioSaleType) { switch (RadioSaleType->getSelectedIndex()) @@ -832,7 +831,7 @@ void LLFloaterProperties::updateSaleInfo() sale_type = LLSaleInfo::FS_ORIGINAL; } - LLLineEditor* EditPrice = LLUICtrlFactory::getLineEditorByName(this,"EditPrice"); + LLLineEditor* EditPrice = getChild<LLLineEditor>("EditPrice"); S32 price = -1; if(EditPrice) diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 00c6f0de73..fa9c9c9374 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -68,7 +68,7 @@ #include "llinventory.h" #include "lltexturectrl.h" #include "llviewercontrol.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llviewerimage.h" #include "llviewerimagelist.h" #include "llviewerregion.h" @@ -85,20 +85,6 @@ const S32 CORNER_COUNT = 4; /// Local class declaration ///---------------------------------------------------------------------------- -/* -class LLDispatchSetEstateOwner : public LLDispatchHandler -{ -public: - LLDispatchSetEstateOwner() {} - virtual ~LLDispatchSetEstateOwner() {} - virtual bool operator()( - const LLDispatcher* dispatcher, - const std::string& key, - const sparam_t& strings, - const iparam_t& integers); -}; -*/ - class LLDispatchEstateUpdateInfo : public LLDispatchHandler { public: @@ -168,43 +154,43 @@ LLUUID LLFloaterRegionInfo::sRequestInvoice; LLFloaterRegionInfo::LLFloaterRegionInfo(const LLSD& seed) { - gUICtrlFactory->buildFloater(this, "floater_region_info.xml", NULL, FALSE); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_region_info.xml", NULL, FALSE); } BOOL LLFloaterRegionInfo::postBuild() { - mTab = gUICtrlFactory->getTabContainerByName(this, "region_panels"); + mTab = getChild<LLTabContainer>("region_panels"); // contruct the panels LLPanelRegionInfo* panel; panel = new LLPanelRegionGeneralInfo; mInfoPanels.push_back(panel); - gUICtrlFactory->buildPanel(panel, "panel_region_general.xml"); + LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_general.xml"); mTab->addTabPanel(panel, panel->getLabel(), TRUE); panel = new LLPanelRegionDebugInfo; mInfoPanels.push_back(panel); - gUICtrlFactory->buildPanel(panel, "panel_region_debug.xml"); + LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_debug.xml"); mTab->addTabPanel(panel, panel->getLabel(), FALSE); panel = new LLPanelRegionTextureInfo; mInfoPanels.push_back(panel); - gUICtrlFactory->buildPanel(panel, "panel_region_texture.xml"); + LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_texture.xml"); mTab->addTabPanel(panel, panel->getLabel(), FALSE); panel = new LLPanelRegionTerrainInfo; mInfoPanels.push_back(panel); - gUICtrlFactory->buildPanel(panel, "panel_region_terrain.xml"); + LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_terrain.xml"); mTab->addTabPanel(panel, panel->getLabel(), FALSE); panel = new LLPanelEstateInfo; mInfoPanels.push_back(panel); - gUICtrlFactory->buildPanel(panel, "panel_region_estate.xml"); + LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_estate.xml"); mTab->addTabPanel(panel, panel->getLabel(), FALSE); panel = new LLPanelEstateCovenant; mInfoPanels.push_back(panel); - gUICtrlFactory->buildPanel(panel, "panel_region_covenant.xml"); + LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_covenant.xml"); mTab->addTabPanel(panel, panel->getLabel(), FALSE); gMessageSystem->setHandlerFunc( @@ -233,24 +219,12 @@ void LLFloaterRegionInfo::onOpen() // static void LLFloaterRegionInfo::requestRegionInfo() { - LLTabContainer* tab = LLUICtrlFactory::getTabContainerByName(findInstance(), "region_panels"); - if(tab) - { - LLPanel* panel; - - panel = LLUICtrlFactory::getPanelByName(tab, "General"); - if (panel) panel->setCtrlsEnabled(FALSE); + LLTabContainer* tab = findInstance()->getChild<LLTabContainer>("region_panels"); - panel = LLUICtrlFactory::getPanelByName(tab, "Debug"); - if (panel) panel->setCtrlsEnabled(FALSE); - - panel = LLUICtrlFactory::getPanelByName(tab, "Terrain"); - if (panel) panel->setCtrlsEnabled(FALSE); - - panel = LLUICtrlFactory::getPanelByName(tab, "Estate"); - if (panel) panel->setCtrlsEnabled(FALSE); - - } + tab->getChild<LLPanel>("General")->setCtrlsEnabled(FALSE); + tab->getChild<LLPanel>("Debug")->setCtrlsEnabled(FALSE); + tab->getChild<LLPanel>("Terrain")->setCtrlsEnabled(FALSE); + tab->getChild<LLPanel>("Estate")->setCtrlsEnabled(FALSE); // Must allow anyone to request the RegionInfo data // so non-owners/non-gods can see the values. @@ -261,7 +235,6 @@ void LLFloaterRegionInfo::requestRegionInfo() msg->addUUID("AgentID", gAgent.getID()); msg->addUUID("SessionID", gAgent.getSessionID()); gAgent.sendReliableMessage(); - } // static @@ -278,11 +251,8 @@ void LLFloaterRegionInfo::processEstateOwnerRequest(LLMessageSystem* msg,void**) LLPanelEstateInfo::initDispatch(dispatch); } - LLTabContainer* tab = LLUICtrlFactory::getTabContainerByName(findInstance(), "region_panels"); - if (!tab) return; - - LLPanelEstateInfo* panel = (LLPanelEstateInfo*)LLUICtrlFactory::getPanelByName(tab, "Estate"); - if (!panel) return; + LLTabContainer* tab = findInstance()->getChild<LLTabContainer>("region_panels"); + LLPanelEstateInfo* panel = (LLPanelEstateInfo*)tab->getChild<LLPanel>("Estate"); // unpack the message std::string request; @@ -316,8 +286,7 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) return; } - LLTabContainer* tab = LLUICtrlFactory::getTabContainerByName(findInstance(), "region_panels"); - if(!tab) return; + LLTabContainer* tab = findInstance()->getChild<LLTabContainer>("region_panels"); LLViewerRegion* region = gAgent.getRegion(); BOOL allow_modify = gAgent.isGodlike() || (region && region->canManageEstate()); @@ -346,8 +315,7 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) msg->getF32("RegionInfo", "SunHour", sun_hour); // GENERAL PANEL - panel = LLUICtrlFactory::getPanelByName(tab, "General"); - if(!panel) return; + panel = tab->getChild<LLPanel>("General"); panel->childSetValue("region_text", LLSD(sim_name)); panel->childSetValue("block_terraform_check", (region_flags & REGION_FLAGS_BLOCK_TERRAFORM) ? TRUE : FALSE ); @@ -372,8 +340,7 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) // DEBUG PANEL - panel = LLUICtrlFactory::getPanelByName(tab, "Debug"); - if(!panel) return; + panel = tab->getChild<LLPanel>("Debug"); panel->childSetValue("region_text", LLSD(sim_name) ); panel->childSetValue("disable_scripts_check", LLSD((BOOL)(region_flags & REGION_FLAGS_SKIP_SCRIPTS)) ); @@ -382,8 +349,7 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) panel->setCtrlsEnabled(allow_modify); // TERRAIN PANEL - panel = LLUICtrlFactory::getPanelByName(tab, "Terrain"); - if(!panel) return; + panel = tab->getChild<LLPanel>("Terrain"); panel->childSetValue("region_text", LLSD(sim_name)); panel->childSetValue("water_height_spin", LLSD(water_height)); @@ -405,9 +371,8 @@ LLPanelEstateInfo* LLFloaterRegionInfo::getPanelEstate() { LLFloaterRegionInfo* floater = LLFloaterRegionInfo::getInstance(); if (!floater) return NULL; - LLTabContainer* tab = LLUICtrlFactory::getTabContainerByName(floater, "region_panels"); - if (!tab) return NULL; - LLPanelEstateInfo* panel = (LLPanelEstateInfo*)LLUICtrlFactory::getPanelByName(tab,"Estate"); + LLTabContainer* tab = floater->getChild<LLTabContainer>("region_panels"); + LLPanelEstateInfo* panel = (LLPanelEstateInfo*)tab->getChild<LLPanel>("Estate"); return panel; } @@ -416,9 +381,8 @@ LLPanelEstateCovenant* LLFloaterRegionInfo::getPanelCovenant() { LLFloaterRegionInfo* floater = LLFloaterRegionInfo::getInstance(); if (!floater) return NULL; - LLTabContainer* tab = LLUICtrlFactory::getTabContainerByName(floater, "region_panels"); - if (!tab) return NULL; - LLPanelEstateCovenant* panel = (LLPanelEstateCovenant*)LLUICtrlFactory::getPanelByName(tab, "Covenant"); + LLTabContainer* tab = floater->getChild<LLTabContainer>("region_panels"); + LLPanelEstateCovenant* panel = (LLPanelEstateCovenant*)tab->getChild<LLPanel>("Covenant"); return panel; } @@ -1055,7 +1019,7 @@ bool LLPanelRegionTextureInfo::refreshFromRegion(LLViewerRegion* region) for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i) { snprintf(buffer, MAX_STRING, "texture_detail_%d", i); /* Flawfinder: ignore */ - texture_ctrl = LLViewerUICtrlFactory::getTexturePickerByName(this, buffer); + texture_ctrl = getChild<LLTextureCtrl>(buffer); if(texture_ctrl) { lldebugs << "Detail Texture " << i << ": " @@ -1103,14 +1067,6 @@ BOOL LLPanelRegionTextureInfo::postBuild() return LLPanelRegionInfo::postBuild(); } -void LLPanelRegionTextureInfo::draw() -{ - if(getVisible()) - { - LLPanel::draw(); - } -} - BOOL LLPanelRegionTextureInfo::sendUpdate() { llinfos << "LLPanelRegionTextureInfo::sendUpdate()" << llendl; @@ -1133,7 +1089,7 @@ BOOL LLPanelRegionTextureInfo::sendUpdate() for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i) { snprintf(buffer, MAX_STRING, "texture_detail_%d", i); /* Flawfinder: ignore */ - texture_ctrl = LLViewerUICtrlFactory::getTexturePickerByName(this, buffer); + texture_ctrl = getChild<LLTextureCtrl>(buffer); if(texture_ctrl) { LLUUID tmp_id(texture_ctrl->getImageAssetID()); @@ -1163,7 +1119,7 @@ BOOL LLPanelRegionTextureInfo::validateTextureSizes() { char buffer[MAX_STRING]; /* Flawfinder: ignore */ snprintf(buffer, MAX_STRING, "texture_detail_%d", i); /* Flawfinder: ignore */ - LLTextureCtrl* texture_ctrl = LLViewerUICtrlFactory::getTexturePickerByName(this, buffer); + LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>(buffer); if (!texture_ctrl) continue; LLUUID image_asset_id = texture_ctrl->getImageAssetID(); @@ -1285,10 +1241,10 @@ BOOL LLPanelRegionTerrainInfo::sendUpdate() LLFloaterRegionInfo* floater = LLFloaterRegionInfo::getInstance(); if (!floater) return true; - LLTabContainer* tab = LLUICtrlFactory::getTabContainerByName(floater, "region_panels"); + LLTabContainer* tab = floater->getChild<LLTabContainer>("region_panels"); if (!tab) return true; - LLPanelEstateInfo* panel = (LLPanelEstateInfo*)LLUICtrlFactory::getPanelByName(tab, "Estate"); + LLPanelEstateInfo* panel = (LLPanelEstateInfo*)tab->getChild<LLPanel>("Estate"); if (!panel) return true; BOOL estate_global_time = panel->getGlobalTime(); @@ -1854,7 +1810,7 @@ void LLPanelEstateInfo::accessRemoveCore(U32 operation_flag, const char* dialog_ { LLPanelEstateInfo* panel = LLFloaterRegionInfo::getPanelEstate(); if (!panel) return; - LLNameListCtrl* name_list = LLViewerUICtrlFactory::getNameListByName(panel, list_ctrl_name); + LLNameListCtrl* name_list = panel->getChild<LLNameListCtrl>(list_ctrl_name); if (!name_list) return; std::vector<LLScrollListItem*> list_vector = name_list->getAllSelected(); @@ -2120,7 +2076,7 @@ BOOL LLPanelEstateInfo::postBuild() childSetCommitCallback("sun_hour_slider", onChangeChildCtrl, this); childSetCommitCallback("allowed_avatar_name_list", onChangeChildCtrl, this); - LLNameListCtrl *avatar_name_list = LLViewerUICtrlFactory::getNameListByName(this, "allowed_avatar_name_list"); + LLNameListCtrl *avatar_name_list = getChild<LLNameListCtrl>("allowed_avatar_name_list"); if (avatar_name_list) { avatar_name_list->setCommitOnSelectionChange(TRUE); @@ -2131,7 +2087,7 @@ BOOL LLPanelEstateInfo::postBuild() childSetAction("remove_allowed_avatar_btn", onClickRemoveAllowedAgent, this); childSetCommitCallback("allowed_group_name_list", onChangeChildCtrl, this); - LLNameListCtrl* group_name_list = LLViewerUICtrlFactory::getNameListByName(this, "allowed_group_name_list"); + LLNameListCtrl* group_name_list = getChild<LLNameListCtrl>("allowed_group_name_list"); if (group_name_list) { group_name_list->setCommitOnSelectionChange(TRUE); @@ -2142,7 +2098,7 @@ BOOL LLPanelEstateInfo::postBuild() childSetAction("remove_allowed_group_btn", onClickRemoveAllowedGroup, this); childSetCommitCallback("banned_avatar_name_list", onChangeChildCtrl, this); - LLNameListCtrl* banned_name_list = LLViewerUICtrlFactory::getNameListByName(this, "banned_avatar_name_list"); + LLNameListCtrl* banned_name_list = getChild<LLNameListCtrl>("banned_avatar_name_list"); if (banned_name_list) { banned_name_list->setCommitOnSelectionChange(TRUE); @@ -2153,7 +2109,7 @@ BOOL LLPanelEstateInfo::postBuild() childSetAction("remove_banned_avatar_btn", onClickRemoveBannedAgent, this); childSetCommitCallback("estate_manager_name_list", onChangeChildCtrl, this); - LLNameListCtrl* manager_name_list = LLViewerUICtrlFactory::getNameListByName(this, "estate_manager_name_list"); + LLNameListCtrl* manager_name_list = getChild<LLNameListCtrl>("estate_manager_name_list"); if (manager_name_list) { manager_name_list->setCommitOnSelectionChange(TRUE); @@ -2556,13 +2512,13 @@ void LLPanelEstateInfo::callbackCacheName( void LLPanelEstateInfo::clearAccessLists() { - LLNameListCtrl* name_list = LLViewerUICtrlFactory::getNameListByName(this, "allowed_avatar_name_list"); + LLNameListCtrl* name_list = getChild<LLNameListCtrl>("allowed_avatar_name_list"); if (name_list) { name_list->deleteAllItems(); } - name_list = LLViewerUICtrlFactory::getNameListByName(this, "banned_avatar_name_list"); + name_list = getChild<LLNameListCtrl>("banned_avatar_name_list"); if (name_list) { name_list->deleteAllItems(); @@ -2596,7 +2552,7 @@ BOOL LLPanelEstateInfo::checkRemovalButton(std::string name) } // enable the remove button if something is selected - LLNameListCtrl* name_list = LLViewerUICtrlFactory::getNameListByName(this, name); + LLNameListCtrl* name_list = getChild<LLNameListCtrl>(name); childSetEnabled(btn_name.c_str(), name_list && name_list->getFirstSelected() ? TRUE : FALSE); return (btn_name != ""); @@ -2869,10 +2825,7 @@ void LLPanelEstateCovenant::onLoadComplete(LLVFS *vfs, } else { - if( gViewerStats ) - { - gViewerStats->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); - } + LLViewerStats::getInstance()->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status || LL_ERR_FILE_EMPTY == status) @@ -2993,33 +2946,6 @@ void LLPanelEstateCovenant::setCovenantTextEditor(const std::string& text) mEditor->setText(text); } -/* -// AgentData = agent_id -// RequestData = "setowner" -// StringData[0] = compressed owner id -// IntegerData[0] = serial -bool LLDispatchSetEstateOwner::operator()( - const LLDispatcher* dispatcher, - const std::string& key, - const sparam_t& strings, - const iparam_t& integers) -{ - LLFloaterRegionInfo* floater = LLFloaterRegionInfo::getInstance(); - if (!floater) return true; - - LLTabContainer* tab = (LLTabContainer*)(floater->getChildByName("region_panels")); - if (!tab) return true; - - LLPanelEstateInfo* panel = (LLPanelEstateInfo*)(tab->getChildByName("Estate")); - if (!panel) return true; - - // TODO -- check owner, and disable floater if owner - // does not match - - return true; -} -*/ - // key = "estateupdateinfo" // strings[0] = estate name // strings[1] = str(owner_id) @@ -3152,7 +3078,7 @@ bool LLDispatchSetEstateAccess::operator()( if (access_flags & ESTATE_ACCESS_ALLOWED_AGENTS) { LLNameListCtrl* allowed_agent_name_list; - allowed_agent_name_list = LLViewerUICtrlFactory::getNameListByName(panel, "allowed_avatar_name_list"); + allowed_agent_name_list = panel->getChild<LLNameListCtrl>("allowed_avatar_name_list"); int totalAllowedAgents = num_allowed_agents; @@ -3183,7 +3109,7 @@ bool LLDispatchSetEstateAccess::operator()( if (access_flags & ESTATE_ACCESS_ALLOWED_GROUPS) { LLNameListCtrl* allowed_group_name_list; - allowed_group_name_list = LLViewerUICtrlFactory::getNameListByName(panel, "allowed_group_name_list"); + allowed_group_name_list = panel->getChild<LLNameListCtrl>("allowed_group_name_list"); std::string msg = llformat("Allowed groups: (%d, max %d)", num_allowed_groups, @@ -3207,7 +3133,7 @@ bool LLDispatchSetEstateAccess::operator()( if (access_flags & ESTATE_ACCESS_BANNED_AGENTS) { LLNameListCtrl* banned_agent_name_list; - banned_agent_name_list = LLViewerUICtrlFactory::getNameListByName(panel, "banned_avatar_name_list"); + banned_agent_name_list = panel->getChild<LLNameListCtrl>("banned_avatar_name_list"); int totalBannedAgents = num_banned_agents; @@ -3244,7 +3170,7 @@ bool LLDispatchSetEstateAccess::operator()( panel->childSetValue("estate_manager_label", LLSD(msg)); LLNameListCtrl* estate_manager_name_list = - LLViewerUICtrlFactory::getNameListByName(panel, "estate_manager_name_list"); + panel->getChild<LLNameListCtrl>("estate_manager_name_list"); if (estate_manager_name_list) { estate_manager_name_list->deleteAllItems(); // Clear existing entries diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h index 6ef276a739..b7ee1cc17b 100644 --- a/indra/newview/llfloaterregioninfo.h +++ b/indra/newview/llfloaterregioninfo.h @@ -212,7 +212,6 @@ public: // LLPanel && LLView virtual BOOL postBuild(); - virtual void draw(); protected: virtual BOOL sendUpdate(); diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp index 7dc404cab1..25b8abefc7 100644 --- a/indra/newview/llfloaterreporter.cpp +++ b/indra/newview/llfloaterreporter.cpp @@ -80,7 +80,7 @@ #include "lldir.h" #include "llselectmgr.h" #include "llviewerbuild.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llappviewer.h" #include "llassetuploadresponders.h" @@ -124,16 +124,16 @@ LLFloaterReporter::LLFloaterReporter( { if (report_type == BUG_REPORT) { - gUICtrlFactory->buildFloater(this, "floater_report_bug.xml"); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_report_bug.xml"); } else { - gUICtrlFactory->buildFloater(this, "floater_report_abuse.xml"); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_report_abuse.xml"); } childSetText("abuse_location_edit", gAgent.getSLURL() ); - LLButton* pick_btn = LLUICtrlFactory::getButtonByName(this, "pick_btn"); + LLButton* pick_btn = getChild<LLButton>("pick_btn"); if (pick_btn) { // XUI: Why aren't these in viewerart.ini? @@ -145,7 +145,7 @@ LLFloaterReporter::LLFloaterReporter( if (report_type != BUG_REPORT) { // abuser name is selected from a list - LLLineEditor* le = (LLLineEditor*)getCtrlByNameAndType("abuser_name_edit", WIDGET_TYPE_LINE_EDITOR); + LLLineEditor* le = getChild<LLLineEditor>("abuser_name_edit"); le->setEnabled( FALSE ); } @@ -454,12 +454,12 @@ void LLFloaterReporter::onClickCancel(void *userdata) void LLFloaterReporter::onClickObjPicker(void *userdata) { LLFloaterReporter *self = (LLFloaterReporter *)userdata; - gToolObjPicker->setExitCallback(LLFloaterReporter::closePickTool, self); - gToolMgr->setTransientTool(gToolObjPicker); + LLToolObjPicker::getInstance()->setExitCallback(LLFloaterReporter::closePickTool, self); + LLToolMgr::getInstance()->setTransientTool(LLToolObjPicker::getInstance()); self->mPicking = TRUE; self->childSetText("object_name", LLString::null); self->childSetText("owner_name", LLString::null); - LLButton* pick_btn = LLUICtrlFactory::getButtonByName(self, "pick_btn"); + LLButton* pick_btn = self->getChild<LLButton>("pick_btn"); if (pick_btn) pick_btn->setToggleState(TRUE); } @@ -469,12 +469,12 @@ void LLFloaterReporter::closePickTool(void *userdata) { LLFloaterReporter *self = (LLFloaterReporter *)userdata; - LLUUID object_id = gToolObjPicker->getObjectID(); + LLUUID object_id = LLToolObjPicker::getInstance()->getObjectID(); self->getObjectInfo(object_id); - gToolMgr->clearTransientTool(); + LLToolMgr::getInstance()->clearTransientTool(); self->mPicking = FALSE; - LLButton* pick_btn = LLUICtrlFactory::getButtonByName(self, "pick_btn"); + LLButton* pick_btn = self->getChild<LLButton>("pick_btn"); if (pick_btn) pick_btn->setToggleState(FALSE); } @@ -662,7 +662,7 @@ LLSD LLFloaterReporter::gatherReport() } LLString category_name; - LLComboBox* combo = LLUICtrlFactory::getComboBoxByName(this, "category_combo"); + LLComboBox* combo = getChild<LLComboBox>( "category_combo"); if (combo) { category_name = combo->getSelectedItemLabel(); // want label, not value @@ -1003,7 +1003,7 @@ void LLFloaterReporter::addDescription(const LLString& description, LLMeanCollis LLFloaterReporter *self = gReporterInstances[COMPLAINT_REPORT]; if (self) { - LLTextEditor* text = LLUICtrlFactory::getTextEditorByName(self, "details_edit"); + LLTextEditor* text = self->getChild<LLTextEditor>("details_edit"); if (text) { text->insertText(description); diff --git a/indra/newview/llfloaterscriptdebug.cpp b/indra/newview/llfloaterscriptdebug.cpp index 3a17e232b6..9a7634a739 100644 --- a/indra/newview/llfloaterscriptdebug.cpp +++ b/indra/newview/llfloaterscriptdebug.cpp @@ -31,7 +31,7 @@ #include "llviewerprecompiledheaders.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llfloaterscriptdebug.h" #include "llfontgl.h" @@ -84,7 +84,7 @@ BOOL LLFloaterScriptDebug::postBuild() if (mTabContainer) { // *FIX: apparantly fails for tab containers? -// mTabContainer->requires("all_scripts", WIDGET_TYPE_FLOATER); +// mTabContainer->requires<LLFloater>("all_scripts"); // mTabContainer->checkRequirements(); return TRUE; } @@ -104,7 +104,7 @@ LLFloater* LLFloaterScriptDebug::addOutputWindow(const LLUUID &object_id) sInstance = new LLFloaterScriptDebug(); LLCallbackMap::map_t factory_map; factory_map["all_scripts"] = LLCallbackMap(getOutputWindow, NULL); - gUICtrlFactory->buildFloater(sInstance, "floater_script_debug.xml", &factory_map); + LLUICtrlFactory::getInstance()->buildFloater(sInstance, "floater_script_debug.xml", &factory_map); sInstance->setVisible(FALSE); } @@ -128,7 +128,7 @@ void LLFloaterScriptDebug::addScriptLine(const std::string &utf8mesg, const std: if (objectp) { - objectp->setIcon(gImageList.getImage(LLUUID(gViewerArt.getString("script_error.tga")))); + objectp->setIcon(gImageList.getImageFromFile("script_error.j2c", TRUE, TRUE)); floater_label = llformat("%s(%.2f, %.2f)", user_name.c_str(), objectp->getPositionRegion().mV[VX], objectp->getPositionRegion().mV[VY]); } else diff --git a/indra/newview/llfloatersellland.cpp b/indra/newview/llfloatersellland.cpp index f3d8996b6a..025d726b82 100644 --- a/indra/newview/llfloatersellland.cpp +++ b/indra/newview/llfloatersellland.cpp @@ -42,7 +42,7 @@ #include "lltexturectrl.h" #include "llviewercontrol.h" #include "llviewerparcelmgr.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llviewerwindow.h" // defined in llfloaterland.cpp @@ -122,7 +122,7 @@ LLFloaterSellLandUI* LLFloaterSellLandUI::soleInstance(bool createIfNeeded) { sInstance = new LLFloaterSellLandUI(); - gUICtrlFactory->buildFloater(sInstance, "floater_sell_land.xml"); + LLUICtrlFactory::getInstance()->buildFloater(sInstance, "floater_sell_land.xml"); sInstance->center(); } @@ -131,7 +131,7 @@ LLFloaterSellLandUI* LLFloaterSellLandUI::soleInstance(bool createIfNeeded) if (!parcelSelectionObserver) { parcelSelectionObserver = new SelectionObserver; - gParcelMgr->addObserver(parcelSelectionObserver); + LLViewerParcelMgr::getInstance()->addObserver(parcelSelectionObserver); } return sInstance; @@ -156,14 +156,14 @@ void LLFloaterSellLandUI::SelectionObserver::changed() LLFloaterSellLandUI* ui = LLFloaterSellLandUI::soleInstance(false); if (ui) { - if (gParcelMgr->selectionEmpty()) + if (LLViewerParcelMgr::getInstance()->selectionEmpty()) { ui->close(); } else { ui->setParcel( - gParcelMgr->getSelectionRegion(), - gParcelMgr->getParcelSelection()); + LLViewerParcelMgr::getInstance()->getSelectionRegion(), + LLViewerParcelMgr::getInstance()->getParcelSelection()); } } } @@ -251,22 +251,22 @@ void LLFloaterSellLandUI::updateParcelInfo() void LLFloaterSellLandUI::setBadge(const char* id, Badge badge) { - static LLUUID badgeOK(gViewerArt.getString("badge_ok.tga")); - static LLUUID badgeNote(gViewerArt.getString("badge_note.tga")); - static LLUUID badgeWarn(gViewerArt.getString("badge_warn.tga")); - static LLUUID badgeError(gViewerArt.getString("badge_error.tga")); + static LLString badgeOK("badge_ok.j2c"); + static LLString badgeNote("badge_note.j2c"); + static LLString badgeWarn("badge_warn.j2c"); + static LLString badgeError("badge_error.j2c"); - LLUUID badgeUUID; + LLString badgeName; switch (badge) { default: - case BADGE_OK: badgeUUID = badgeOK; break; - case BADGE_NOTE: badgeUUID = badgeNote; break; - case BADGE_WARN: badgeUUID = badgeWarn; break; - case BADGE_ERROR: badgeUUID = badgeError; break; + case BADGE_OK: badgeName = badgeOK; break; + case BADGE_NOTE: badgeName = badgeNote; break; + case BADGE_WARN: badgeName = badgeWarn; break; + case BADGE_ERROR: badgeName = badgeError; break; } - childSetValue(id, badgeUUID); + childSetValue(id, badgeName); } void LLFloaterSellLandUI::refreshUI() @@ -274,7 +274,7 @@ void LLFloaterSellLandUI::refreshUI() LLParcel* parcelp = mParcelSelection->getParcel(); if (!parcelp) return; - LLTextureCtrl* snapshot = LLViewerUICtrlFactory::getTexturePickerByName(this, "info_image"); + LLTextureCtrl* snapshot = getChild<LLTextureCtrl>("info_image"); if (snapshot) { snapshot->setImageAssetID(mParcelSnapshot); @@ -451,7 +451,7 @@ void LLFloaterSellLandUI::doShowObjects(void *userdata) // static void LLFloaterSellLandUI::callbackHighlightTransferable(S32 option, void* userdata) { - gSelectMgr->unhighlightAll(); + LLSelectMgr::getInstance()->unhighlightAll(); } // static @@ -546,7 +546,7 @@ void LLFloaterSellLandUI::onConfirmSale(S32 option, void *userdata) } // Send update to server - gParcelMgr->sendParcelPropertiesUpdate( parcel ); + LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel ); self->close(); } diff --git a/indra/newview/llfloatersettingsdebug.cpp b/indra/newview/llfloatersettingsdebug.cpp index 7975bd95ef..bb44304ae6 100644 --- a/indra/newview/llfloatersettingsdebug.cpp +++ b/indra/newview/llfloatersettingsdebug.cpp @@ -32,7 +32,7 @@ #include "llviewerprecompiledheaders.h" #include "llfloatersettingsdebug.h" #include "llfloater.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llfirstuse.h" #include "llcombobox.h" #include "llspinctrl.h" @@ -52,7 +52,7 @@ LLFloaterSettingsDebug::~LLFloaterSettingsDebug() BOOL LLFloaterSettingsDebug::postBuild() { - LLComboBox* settings_combo = LLUICtrlFactory::getComboBoxByName(this, "settings_combo"); + LLComboBox* settings_combo = getChild<LLComboBox>("settings_combo"); struct f : public LLControlGroup::ApplyFunctor { @@ -108,7 +108,7 @@ void LLFloaterSettingsDebug::show(void*) { sInstance = new LLFloaterSettingsDebug(); - gUICtrlFactory->buildFloater(sInstance, "floater_settings_debug.xml"); + LLUICtrlFactory::getInstance()->buildFloater(sInstance, "floater_settings_debug.xml"); } sInstance->open(); /* Flawfinder: ignore */ @@ -216,10 +216,10 @@ void LLFloaterSettingsDebug::onClickDefault(void* user_data) // we've switched controls, or doing per-frame update, so update spinners, etc. void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) { - LLSpinCtrl* spinner1 = LLUICtrlFactory::getSpinnerByName(this, "val_spinner_1"); - LLSpinCtrl* spinner2 = LLUICtrlFactory::getSpinnerByName(this, "val_spinner_2"); - LLSpinCtrl* spinner3 = LLUICtrlFactory::getSpinnerByName(this, "val_spinner_3"); - LLSpinCtrl* spinner4 = LLUICtrlFactory::getSpinnerByName(this, "val_spinner_4"); + LLSpinCtrl* spinner1 = getChild<LLSpinCtrl>("val_spinner_1"); + LLSpinCtrl* spinner2 = getChild<LLSpinCtrl>("val_spinner_2"); + LLSpinCtrl* spinner3 = getChild<LLSpinCtrl>("val_spinner_3"); + LLSpinCtrl* spinner4 = getChild<LLSpinCtrl>("val_spinner_4"); LLColorSwatchCtrl* color_swatch = getChild<LLColorSwatchCtrl>("color_swatch"); if (!spinner1 || !spinner2 || !spinner3 || !spinner4 || !color_swatch) diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index 1af6683218..962269ca89 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -53,7 +53,7 @@ #include "llsliderctrl.h" #include "llspinctrl.h" #include "llviewercontrol.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llviewerstats.h" #include "llviewercamera.h" #include "llviewerwindow.h" @@ -109,9 +109,6 @@ public: LLSnapshotLivePreview(const LLRect& rect); ~LLSnapshotLivePreview(); - virtual EWidgetType getWidgetType() const; - virtual LLString getWidgetTag() const; - /*virtual*/ void draw(); /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent); @@ -208,8 +205,8 @@ LLSnapshotLivePreview::LLSnapshotLivePreview (const LLRect& rect) : mDataSize(0), mSnapshotType(SNAPSHOT_POSTCARD), mSnapshotUpToDate(FALSE), - mCameraPos(gCamera->getOrigin()), - mCameraRot(gCamera->getQuaternion()), + mCameraPos(LLViewerCamera::getInstance()->getOrigin()), + mCameraRot(LLViewerCamera::getInstance()->getQuaternion()), mSnapshotActive(FALSE), mSnapshotBufferType(LLViewerWindow::SNAPSHOT_TYPE_COLOR) { @@ -355,16 +352,6 @@ void LLSnapshotLivePreview::setSnapshotQuality(S32 quality) } } -EWidgetType LLSnapshotLivePreview::getWidgetType() const -{ - return WIDGET_TYPE_SNAPSHOT_LIVE_PREVIEW; -} - -LLString LLSnapshotLivePreview::getWidgetTag() const -{ - return LL_SNAPSHOT_LIVE_PREVIEW_TAG; -} - void LLSnapshotLivePreview::drawPreviewRect(S32 offset_x, S32 offset_y) { F32 line_width ; @@ -406,186 +393,183 @@ void LLSnapshotLivePreview::drawPreviewRect(S32 offset_x, S32 offset_y) void LLSnapshotLivePreview::draw() { - if(getVisible()) - { - if (mViewerImage[mCurImageIndex].notNull() && - mRawImageEncoded.notNull() && - mSnapshotUpToDate) + if (mViewerImage[mCurImageIndex].notNull() && + mRawImageEncoded.notNull() && + mSnapshotUpToDate) + { + LLColor4 bg_color(0.f, 0.f, 0.3f, 0.4f); + gl_rect_2d(getRect(), bg_color); + LLRect &rect = mImageRect[mCurImageIndex]; + LLRect shadow_rect = mImageRect[mCurImageIndex]; + shadow_rect.stretch(BORDER_WIDTH); + gl_drop_shadow(shadow_rect.mLeft, shadow_rect.mTop, shadow_rect.mRight, shadow_rect.mBottom, LLColor4(0.f, 0.f, 0.f, mNeedsFlash ? 0.f :0.5f), 10); + + LLColor4 image_color(1.f, 1.f, 1.f, 1.f); + gGL.color4fv(image_color.mV); + LLViewerImage::bindTexture(mViewerImage[mCurImageIndex]); + // calculate UV scale + F32 uv_width = mImageScaled[mCurImageIndex] ? 1.f : llmin((F32)mWidth[mCurImageIndex] / (F32)mViewerImage[mCurImageIndex]->getWidth(), 1.f); + F32 uv_height = mImageScaled[mCurImageIndex] ? 1.f : llmin((F32)mHeight[mCurImageIndex] / (F32)mViewerImage[mCurImageIndex]->getHeight(), 1.f); + glPushMatrix(); { - LLColor4 bg_color(0.f, 0.f, 0.3f, 0.4f); - gl_rect_2d(getRect(), bg_color); - LLRect &rect = mImageRect[mCurImageIndex]; - LLRect shadow_rect = mImageRect[mCurImageIndex]; - shadow_rect.stretch(BORDER_WIDTH); - gl_drop_shadow(shadow_rect.mLeft, shadow_rect.mTop, shadow_rect.mRight, shadow_rect.mBottom, LLColor4(0.f, 0.f, 0.f, mNeedsFlash ? 0.f :0.5f), 10); - - LLColor4 image_color(1.f, 1.f, 1.f, 1.f); - gGL.color4fv(image_color.mV); - LLViewerImage::bindTexture(mViewerImage[mCurImageIndex]); - // calculate UV scale - F32 uv_width = mImageScaled[mCurImageIndex] ? 1.f : llmin((F32)mWidth[mCurImageIndex] / (F32)mViewerImage[mCurImageIndex]->getWidth(), 1.f); - F32 uv_height = mImageScaled[mCurImageIndex] ? 1.f : llmin((F32)mHeight[mCurImageIndex] / (F32)mViewerImage[mCurImageIndex]->getHeight(), 1.f); - glPushMatrix(); + glTranslatef((F32)rect.mLeft, (F32)rect.mBottom, 0.f); + gGL.begin(GL_QUADS); { - glTranslatef((F32)rect.mLeft, (F32)rect.mBottom, 0.f); - gGL.begin(GL_QUADS); - { - gGL.texCoord2f(uv_width, uv_height); - gGL.vertex2i(rect.getWidth(), rect.getHeight() ); + gGL.texCoord2f(uv_width, uv_height); + gGL.vertex2i(rect.getWidth(), rect.getHeight() ); - gGL.texCoord2f(0.f, uv_height); - gGL.vertex2i(0, rect.getHeight() ); + gGL.texCoord2f(0.f, uv_height); + gGL.vertex2i(0, rect.getHeight() ); - gGL.texCoord2f(0.f, 0.f); - gGL.vertex2i(0, 0); + gGL.texCoord2f(0.f, 0.f); + gGL.vertex2i(0, 0); - gGL.texCoord2f(uv_width, 0.f); - gGL.vertex2i(rect.getWidth(), 0); - } - gGL.end(); + gGL.texCoord2f(uv_width, 0.f); + gGL.vertex2i(rect.getWidth(), 0); } - glPopMatrix(); + gGL.end(); + } + glPopMatrix(); - gGL.color4f(1.f, 1.f, 1.f, mFlashAlpha); - gl_rect_2d(getRect()); - if (mNeedsFlash) + gGL.color4f(1.f, 1.f, 1.f, mFlashAlpha); + gl_rect_2d(getRect()); + if (mNeedsFlash) + { + if (mFlashAlpha < 1.f) { - if (mFlashAlpha < 1.f) - { - mFlashAlpha = lerp(mFlashAlpha, 1.f, LLCriticalDamp::getInterpolant(0.02f)); - } - else - { - mNeedsFlash = FALSE; - } + mFlashAlpha = lerp(mFlashAlpha, 1.f, LLCriticalDamp::getInterpolant(0.02f)); } else { - mFlashAlpha = lerp(mFlashAlpha, 0.f, LLCriticalDamp::getInterpolant(0.15f)); + mNeedsFlash = FALSE; } + } + else + { + mFlashAlpha = lerp(mFlashAlpha, 0.f, LLCriticalDamp::getInterpolant(0.15f)); + } - if (mShineCountdown > 0) + if (mShineCountdown > 0) + { + mShineCountdown--; + if (mShineCountdown == 0) { - mShineCountdown--; - if (mShineCountdown == 0) - { - mShineAnimTimer.start(); - } + mShineAnimTimer.start(); } - else if (mShineAnimTimer.getStarted()) + } + else if (mShineAnimTimer.getStarted()) + { + //LLDebugVarMessageBox::show("Shine time", &SHINE_TIME, 10.f, 0.1f); + //LLDebugVarMessageBox::show("Shine width", &SHINE_WIDTH, 2.f, 0.05f); + //LLDebugVarMessageBox::show("Shine opacity", &SHINE_OPACITY, 1.f, 0.05f); + + F32 shine_interp = llmin(1.f, mShineAnimTimer.getElapsedTimeF32() / SHINE_TIME); + + // draw "shine" effect + LLLocalClipRect clip(getLocalRect()); { - //LLDebugVarMessageBox::show("Shine time", &SHINE_TIME, 10.f, 0.1f); - //LLDebugVarMessageBox::show("Shine width", &SHINE_WIDTH, 2.f, 0.05f); - //LLDebugVarMessageBox::show("Shine opacity", &SHINE_OPACITY, 1.f, 0.05f); - - F32 shine_interp = llmin(1.f, mShineAnimTimer.getElapsedTimeF32() / SHINE_TIME); - - // draw "shine" effect - LLLocalClipRect clip(getLocalRect()); + // draw diagonal stripe with gradient that passes over screen + S32 x1 = gViewerWindow->getWindowWidth() * llround((clamp_rescale(shine_interp, 0.f, 1.f, -1.f - SHINE_WIDTH, 1.f))); + S32 x2 = x1 + llround(gViewerWindow->getWindowWidth() * SHINE_WIDTH); + S32 x3 = x2 + llround(gViewerWindow->getWindowWidth() * SHINE_WIDTH); + S32 y1 = 0; + S32 y2 = gViewerWindow->getWindowHeight(); + + LLGLSNoTexture no_texture; + gGL.begin(GL_QUADS); { - // draw diagonal stripe with gradient that passes over screen - S32 x1 = gViewerWindow->getWindowWidth() * llround((clamp_rescale(shine_interp, 0.f, 1.f, -1.f - SHINE_WIDTH, 1.f))); - S32 x2 = x1 + llround(gViewerWindow->getWindowWidth() * SHINE_WIDTH); - S32 x3 = x2 + llround(gViewerWindow->getWindowWidth() * SHINE_WIDTH); - S32 y1 = 0; - S32 y2 = gViewerWindow->getWindowHeight(); - - LLGLSNoTexture no_texture; - gGL.begin(GL_QUADS); - { - gGL.color4f(1.f, 1.f, 1.f, 0.f); - gGL.vertex2i(x1, y1); - gGL.vertex2i(x1 + gViewerWindow->getWindowWidth(), y2); - gGL.color4f(1.f, 1.f, 1.f, SHINE_OPACITY); - gGL.vertex2i(x2 + gViewerWindow->getWindowWidth(), y2); - gGL.vertex2i(x2, y1); - - gGL.color4f(1.f, 1.f, 1.f, SHINE_OPACITY); - gGL.vertex2i(x2, y1); - gGL.vertex2i(x2 + gViewerWindow->getWindowWidth(), y2); - gGL.color4f(1.f, 1.f, 1.f, 0.f); - gGL.vertex2i(x3 + gViewerWindow->getWindowWidth(), y2); - gGL.vertex2i(x3, y1); - } - gGL.end(); + gGL.color4f(1.f, 1.f, 1.f, 0.f); + gGL.vertex2i(x1, y1); + gGL.vertex2i(x1 + gViewerWindow->getWindowWidth(), y2); + gGL.color4f(1.f, 1.f, 1.f, SHINE_OPACITY); + gGL.vertex2i(x2 + gViewerWindow->getWindowWidth(), y2); + gGL.vertex2i(x2, y1); + + gGL.color4f(1.f, 1.f, 1.f, SHINE_OPACITY); + gGL.vertex2i(x2, y1); + gGL.vertex2i(x2 + gViewerWindow->getWindowWidth(), y2); + gGL.color4f(1.f, 1.f, 1.f, 0.f); + gGL.vertex2i(x3 + gViewerWindow->getWindowWidth(), y2); + gGL.vertex2i(x3, y1); } + gGL.end(); + } - if (mShineAnimTimer.getElapsedTimeF32() > SHINE_TIME) - { - mShineAnimTimer.stop(); - } + if (mShineAnimTimer.getElapsedTimeF32() > SHINE_TIME) + { + mShineAnimTimer.stop(); } } + } - // draw framing rectangle + // draw framing rectangle + { + LLGLSNoTexture no_texture; + gGL.color4f(1.f, 1.f, 1.f, 1.f); + LLRect outline_rect = mImageRect[mCurImageIndex]; + gGL.begin(GL_QUADS); { - LLGLSNoTexture no_texture; - gGL.color4f(1.f, 1.f, 1.f, 1.f); - LLRect outline_rect = mImageRect[mCurImageIndex]; - gGL.begin(GL_QUADS); - { - gGL.vertex2i(outline_rect.mLeft - BORDER_WIDTH, outline_rect.mTop + BORDER_WIDTH); - gGL.vertex2i(outline_rect.mRight + BORDER_WIDTH, outline_rect.mTop + BORDER_WIDTH); - gGL.vertex2i(outline_rect.mRight, outline_rect.mTop); - gGL.vertex2i(outline_rect.mLeft, outline_rect.mTop); - - gGL.vertex2i(outline_rect.mLeft, outline_rect.mBottom); - gGL.vertex2i(outline_rect.mRight, outline_rect.mBottom); - gGL.vertex2i(outline_rect.mRight + BORDER_WIDTH, outline_rect.mBottom - BORDER_WIDTH); - gGL.vertex2i(outline_rect.mLeft - BORDER_WIDTH, outline_rect.mBottom - BORDER_WIDTH); - - gGL.vertex2i(outline_rect.mLeft, outline_rect.mTop); - gGL.vertex2i(outline_rect.mLeft, outline_rect.mBottom); - gGL.vertex2i(outline_rect.mLeft - BORDER_WIDTH, outline_rect.mBottom - BORDER_WIDTH); - gGL.vertex2i(outline_rect.mLeft - BORDER_WIDTH, outline_rect.mTop + BORDER_WIDTH); - - gGL.vertex2i(outline_rect.mRight, outline_rect.mBottom); - gGL.vertex2i(outline_rect.mRight, outline_rect.mTop); - gGL.vertex2i(outline_rect.mRight + BORDER_WIDTH, outline_rect.mTop + BORDER_WIDTH); - gGL.vertex2i(outline_rect.mRight + BORDER_WIDTH, outline_rect.mBottom - BORDER_WIDTH); - } - gGL.end(); + gGL.vertex2i(outline_rect.mLeft - BORDER_WIDTH, outline_rect.mTop + BORDER_WIDTH); + gGL.vertex2i(outline_rect.mRight + BORDER_WIDTH, outline_rect.mTop + BORDER_WIDTH); + gGL.vertex2i(outline_rect.mRight, outline_rect.mTop); + gGL.vertex2i(outline_rect.mLeft, outline_rect.mTop); + + gGL.vertex2i(outline_rect.mLeft, outline_rect.mBottom); + gGL.vertex2i(outline_rect.mRight, outline_rect.mBottom); + gGL.vertex2i(outline_rect.mRight + BORDER_WIDTH, outline_rect.mBottom - BORDER_WIDTH); + gGL.vertex2i(outline_rect.mLeft - BORDER_WIDTH, outline_rect.mBottom - BORDER_WIDTH); + + gGL.vertex2i(outline_rect.mLeft, outline_rect.mTop); + gGL.vertex2i(outline_rect.mLeft, outline_rect.mBottom); + gGL.vertex2i(outline_rect.mLeft - BORDER_WIDTH, outline_rect.mBottom - BORDER_WIDTH); + gGL.vertex2i(outline_rect.mLeft - BORDER_WIDTH, outline_rect.mTop + BORDER_WIDTH); + + gGL.vertex2i(outline_rect.mRight, outline_rect.mBottom); + gGL.vertex2i(outline_rect.mRight, outline_rect.mTop); + gGL.vertex2i(outline_rect.mRight + BORDER_WIDTH, outline_rect.mTop + BORDER_WIDTH); + gGL.vertex2i(outline_rect.mRight + BORDER_WIDTH, outline_rect.mBottom - BORDER_WIDTH); } + gGL.end(); + } - // draw old image dropping away - if (mFallAnimTimer.getStarted()) + // draw old image dropping away + if (mFallAnimTimer.getStarted()) + { + S32 old_image_index = (mCurImageIndex + 1) % 2; + if (mViewerImage[old_image_index].notNull() && mFallAnimTimer.getElapsedTimeF32() < FALL_TIME) { - S32 old_image_index = (mCurImageIndex + 1) % 2; - if (mViewerImage[old_image_index].notNull() && mFallAnimTimer.getElapsedTimeF32() < FALL_TIME) + F32 fall_interp = mFallAnimTimer.getElapsedTimeF32() / FALL_TIME; + F32 alpha = clamp_rescale(fall_interp, 0.f, 1.f, 0.8f, 0.4f); + LLColor4 image_color(1.f, 1.f, 1.f, alpha); + gGL.color4fv(image_color.mV); + LLViewerImage::bindTexture(mViewerImage[old_image_index]); + // calculate UV scale + // *FIX get this to work with old image + BOOL rescale = !mImageScaled[old_image_index] && mViewerImage[mCurImageIndex].notNull(); + F32 uv_width = rescale ? llmin((F32)mWidth[old_image_index] / (F32)mViewerImage[mCurImageIndex]->getWidth(), 1.f) : 1.f; + F32 uv_height = rescale ? llmin((F32)mHeight[old_image_index] / (F32)mViewerImage[mCurImageIndex]->getHeight(), 1.f) : 1.f; + glPushMatrix(); { - F32 fall_interp = mFallAnimTimer.getElapsedTimeF32() / FALL_TIME; - F32 alpha = clamp_rescale(fall_interp, 0.f, 1.f, 0.8f, 0.4f); - LLColor4 image_color(1.f, 1.f, 1.f, alpha); - gGL.color4fv(image_color.mV); - LLViewerImage::bindTexture(mViewerImage[old_image_index]); - // calculate UV scale - // *FIX get this to work with old image - BOOL rescale = !mImageScaled[old_image_index] && mViewerImage[mCurImageIndex].notNull(); - F32 uv_width = rescale ? llmin((F32)mWidth[old_image_index] / (F32)mViewerImage[mCurImageIndex]->getWidth(), 1.f) : 1.f; - F32 uv_height = rescale ? llmin((F32)mHeight[old_image_index] / (F32)mViewerImage[mCurImageIndex]->getHeight(), 1.f) : 1.f; - glPushMatrix(); + LLRect& rect = mImageRect[old_image_index]; + glTranslatef((F32)rect.mLeft, (F32)rect.mBottom - llround(getRect().getHeight() * 2.f * (fall_interp * fall_interp)), 0.f); + glRotatef(-45.f * fall_interp, 0.f, 0.f, 1.f); + gGL.begin(GL_QUADS); { - LLRect& rect = mImageRect[old_image_index]; - glTranslatef((F32)rect.mLeft, (F32)rect.mBottom - llround(getRect().getHeight() * 2.f * (fall_interp * fall_interp)), 0.f); - glRotatef(-45.f * fall_interp, 0.f, 0.f, 1.f); - gGL.begin(GL_QUADS); - { - gGL.texCoord2f(uv_width, uv_height); - gGL.vertex2i(rect.getWidth(), rect.getHeight() ); - - gGL.texCoord2f(0.f, uv_height); - gGL.vertex2i(0, rect.getHeight() ); - - gGL.texCoord2f(0.f, 0.f); - gGL.vertex2i(0, 0); - - gGL.texCoord2f(uv_width, 0.f); - gGL.vertex2i(rect.getWidth(), 0); - } - gGL.end(); + gGL.texCoord2f(uv_width, uv_height); + gGL.vertex2i(rect.getWidth(), rect.getHeight() ); + + gGL.texCoord2f(0.f, uv_height); + gGL.vertex2i(0, rect.getHeight() ); + + gGL.texCoord2f(0.f, 0.f); + gGL.vertex2i(0, 0); + + gGL.texCoord2f(uv_width, 0.f); + gGL.vertex2i(rect.getWidth(), 0); } - glPopMatrix(); + gGL.end(); } + glPopMatrix(); } } } @@ -729,8 +713,8 @@ void LLSnapshotLivePreview::onIdle( void* snapshot_preview ) { LLSnapshotLivePreview* previewp = (LLSnapshotLivePreview*)snapshot_preview; - LLVector3 new_camera_pos = gCamera->getOrigin(); - LLQuaternion new_camera_rot = gCamera->getQuaternion(); + LLVector3 new_camera_pos = LLViewerCamera::getInstance()->getOrigin(); + LLQuaternion new_camera_rot = LLViewerCamera::getInstance()->getQuaternion(); if (gSavedSettings.getBOOL("FreezeTime") && (new_camera_pos != previewp->mCameraPos || dot(new_camera_rot, previewp->mCameraRot) < 0.995f)) { @@ -744,7 +728,7 @@ void LLSnapshotLivePreview::onIdle( void* snapshot_preview ) previewp->mSnapshotDelayTimer.hasExpired()); // don't take snapshots while ALT-zoom active - if (gToolCamera->hasMouseCapture()) + if (LLToolCamera::getInstance()->hasMouseCapture()) { previewp->mSnapshotActive = FALSE; } @@ -924,7 +908,7 @@ void LLSnapshotLivePreview::saveTexture() llwarns << "Error encoding snapshot" << llendl; } - gViewerStats->incStat(LLViewerStats::ST_SNAPSHOT_COUNT ); + LLViewerStats::getInstance()->incStat(LLViewerStats::ST_SNAPSHOT_COUNT ); } BOOL LLSnapshotLivePreview::saveLocal() @@ -1034,7 +1018,7 @@ LLViewerWindow::ESnapshotType LLFloaterSnapshot::Impl::getLayerType(LLFloaterSna // static void LLFloaterSnapshot::Impl::setResolution(LLFloaterSnapshot* floater, const std::string& comboname) { - LLComboBox* combo = LLUICtrlFactory::getComboBoxByName(floater, comboname); + LLComboBox* combo = floater->getChild<LLComboBox>(comboname); if (combo) { combo->setVisible(TRUE); @@ -1054,15 +1038,15 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp) { previewp->mKeepAspectRatio = TRUE ; - combo = LLUICtrlFactory::getComboBoxByName(floaterp, "postcard_size_combo"); + combo = floaterp->getChild<LLComboBox>("postcard_size_combo"); combo->setCurrentByIndex(0) ; gSavedSettings.setS32("SnapshotPostcardLastResolution", 0) ; - combo = LLUICtrlFactory::getComboBoxByName(floaterp, "texture_size_combo"); + combo = floaterp->getChild<LLComboBox>("texture_size_combo"); combo->setCurrentByIndex(0) ; gSavedSettings.setS32("SnapshotTextureLastResolution", 0) ; - combo = LLUICtrlFactory::getComboBoxByName(floaterp, "local_size_combo"); + combo = floaterp->getChild<LLComboBox>("local_size_combo"); combo->setCurrentByIndex(0) ; gSavedSettings.setS32("SnapshotLocalLastResolution", 0) ; @@ -1097,13 +1081,10 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp) // freeze everything else gSavedSettings.setBOOL("FreezeTime", TRUE); - if (gToolMgr->getCurrentToolset() != gCameraToolset) + if (LLToolMgr::getInstance()->getCurrentToolset() != gCameraToolset) { - sInstance->impl.mLastToolset = gToolMgr->getCurrentToolset(); - if (gToolMgr) - { - gToolMgr->setCurrentToolset(gCameraToolset); - } + sInstance->impl.mLastToolset = LLToolMgr::getInstance()->getCurrentToolset(); + LLToolMgr::getInstance()->setCurrentToolset(gCameraToolset); } } else // turning off freeze frame mode @@ -1125,10 +1106,7 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp) // restore last tool (e.g. pie menu, etc) if (sInstance->impl.mLastToolset) { - if (gToolMgr) - { - gToolMgr->setCurrentToolset(sInstance->impl.mLastToolset); - } + LLToolMgr::getInstance()->setCurrentToolset(sInstance->impl.mLastToolset); } } } @@ -1138,8 +1116,7 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp) void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) { BOOL is_advance = gSavedSettings.getBOOL("AdvanceSnapshot") ; - - LLRadioGroup* snapshot_type_radio = LLUICtrlFactory::getRadioGroupByName(floater, "snapshot_type_radio"); + LLRadioGroup* snapshot_type_radio = floater->getChild<LLRadioGroup>("snapshot_type_radio"); snapshot_type_radio->setSelectedIndex(gSavedSettings.getS32("LastSnapshotType")); LLSnapshotLivePreview::ESnapshotType shot_type = getTypeIndex(floater); LLViewerWindow::ESnapshotType layer_type = getLayerType(floater); @@ -1149,11 +1126,11 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) floater->childSetVisible("local_size_combo", FALSE); LLComboBox* combo; - combo = LLUICtrlFactory::getComboBoxByName(floater, "postcard_size_combo"); + combo = floater->getChild<LLComboBox>("postcard_size_combo"); if (combo) combo->selectNthItem(gSavedSettings.getS32("SnapshotPostcardLastResolution")); - combo = LLUICtrlFactory::getComboBoxByName(floater, "texture_size_combo"); + combo = floater->getChild<LLComboBox>("texture_size_combo"); if (combo) combo->selectNthItem(gSavedSettings.getS32("SnapshotTextureLastResolution")); - combo = LLUICtrlFactory::getComboBoxByName(floater, "local_size_combo"); + combo = floater->getChild<LLComboBox>("local_size_combo"); if (combo) combo->selectNthItem(gSavedSettings.getS32("SnapshotLocalLastResolution")); floater->childSetVisible("upload_btn", FALSE); @@ -1438,7 +1415,6 @@ void LLFloaterSnapshot::Impl::onClickKeepAspectCheck(LLUICtrl* ctrl, void* data) } previewp->setSize(w, h) ; - checkAutoSnapshot(previewp, TRUE); } } @@ -1535,11 +1511,11 @@ void LLFloaterSnapshot::Impl::onCommitResolution(LLUICtrl* ctrl, void* data) // save off all selected resolution values LLComboBox* combo; - combo = LLUICtrlFactory::getComboBoxByName(view, "postcard_size_combo"); + combo = view->getChild<LLComboBox>("postcard_size_combo"); gSavedSettings.setS32("SnapshotPostcardLastResolution", combo->getCurrentIndex()); - combo = LLUICtrlFactory::getComboBoxByName(view, "texture_size_combo"); + combo = view->getChild<LLComboBox>("texture_size_combo"); gSavedSettings.setS32("SnapshotTextureLastResolution", combo->getCurrentIndex()); - combo = LLUICtrlFactory::getComboBoxByName(view, "local_size_combo"); + combo = view->getChild<LLComboBox>("local_size_combo"); gSavedSettings.setS32("SnapshotLocalLastResolution", combo->getCurrentIndex()); std::string sdstring = combobox->getSelectedValue(); @@ -1617,7 +1593,7 @@ void LLFloaterSnapshot::Impl::onCommitSnapshotType(LLUICtrl* ctrl, void* data) // static void LLFloaterSnapshot::Impl::comboSetCustom(LLFloaterSnapshot* floater, const std::string& comboname) { - LLComboBox* combo = LLUICtrlFactory::getComboBoxByName(floater, comboname); + LLComboBox* combo = floater->getChild<LLComboBox>(comboname); if (combo) { combo->setCurrentByIndex(combo->getItemCount() - 1); @@ -1695,13 +1671,13 @@ BOOL LLFloaterSnapshot::Impl::checkImageSize(LLSnapshotLivePreview* previewp, S3 //static void LLFloaterSnapshot::Impl::resetSnapshotSizeOnUI(LLFloaterSnapshot *view, S32 width, S32 height) { - LLSpinCtrl *sctrl = LLViewerUICtrlFactory::getSpinnerByName(view, "snapshot_width") ; + LLSpinCtrl *sctrl = view->getChild<LLSpinCtrl>("snapshot_width") ; if(sctrl) { sctrl->setValue(width) ; } - sctrl = LLViewerUICtrlFactory::getSpinnerByName(view, "snapshot_height") ; + sctrl = view->getChild<LLSpinCtrl>("snapshot_height") ; if(sctrl) { sctrl->setValue(height) ; @@ -1773,10 +1749,7 @@ LLFloaterSnapshot::~LLFloaterSnapshot() if (impl.mLastToolset) { - if (gToolMgr) - { - gToolMgr->setCurrentToolset(impl.mLastToolset); - } + LLToolMgr::getInstance()->setCurrentToolset(impl.mLastToolset); } delete &impl; @@ -1858,7 +1831,7 @@ void LLFloaterSnapshot::draw() return; } - if(getVisible() && !isMinimized()) + if(!isMinimized()) { if (previewp && previewp->getDataSize() > 0) { @@ -1880,7 +1853,7 @@ void LLFloaterSnapshot::draw() if (previewp->getSnapshotUpToDate()) { LLString bytes_string; - gResMgr->getIntegerString(bytes_string, (previewp->getDataSize()) >> 10 ); + LLResMgr::getInstance()->getIntegerString(bytes_string, (previewp->getDataSize()) >> 10 ); childSetTextArg("file_size_label", "[SIZE]", bytes_string); } else @@ -1976,7 +1949,7 @@ void LLFloaterSnapshot::show(void*) { sInstance = new LLFloaterSnapshot(); - gUICtrlFactory->buildFloater(sInstance, "floater_snapshot.xml", NULL, FALSE); + LLUICtrlFactory::getInstance()->buildFloater(sInstance, "floater_snapshot.xml", NULL, FALSE); //move snapshot floater to special purpose snapshotfloaterview gFloaterView->removeChild(sInstance); gSnapshotFloaterView->addChild(sInstance); @@ -2028,24 +2001,17 @@ BOOL LLSnapshotFloaterView::handleKey(KEY key, MASK mask, BOOL called_from_paren return LLFloaterView::handleKey(key, mask, called_from_parent); } - if (!getEnabled()) + if (called_from_parent) { - return FALSE; + // pass all keystrokes down + LLFloaterView::handleKey(key, mask, called_from_parent); } else { - if (called_from_parent) - { - // pass all keystrokes down - LLFloaterView::handleKey(key, mask, called_from_parent); - } - else - { - // bounce keystrokes back down - LLFloaterView::handleKey(key, mask, TRUE); - } - return TRUE; + // bounce keystrokes back down + LLFloaterView::handleKey(key, mask, TRUE); } + return TRUE; } BOOL LLSnapshotFloaterView::handleMouseDown(S32 x, S32 y, MASK mask) @@ -2058,7 +2024,7 @@ BOOL LLSnapshotFloaterView::handleMouseDown(S32 x, S32 y, MASK mask) // give floater a change to handle mouse, else camera tool if (childrenHandleMouseDown(x, y, mask) == NULL) { - gToolMgr->getCurrentTool()->handleMouseDown( x, y, mask ); + LLToolMgr::getInstance()->getCurrentTool()->handleMouseDown( x, y, mask ); } return TRUE; } @@ -2073,7 +2039,7 @@ BOOL LLSnapshotFloaterView::handleMouseUp(S32 x, S32 y, MASK mask) // give floater a change to handle mouse, else camera tool if (childrenHandleMouseUp(x, y, mask) == NULL) { - gToolMgr->getCurrentTool()->handleMouseUp( x, y, mask ); + LLToolMgr::getInstance()->getCurrentTool()->handleMouseUp( x, y, mask ); } return TRUE; } @@ -2088,7 +2054,7 @@ BOOL LLSnapshotFloaterView::handleHover(S32 x, S32 y, MASK mask) // give floater a change to handle mouse, else camera tool if (childrenHandleHover(x, y, mask) == NULL) { - gToolMgr->getCurrentTool()->handleHover( x, y, mask ); + LLToolMgr::getInstance()->getCurrentTool()->handleHover( x, y, mask ); } return TRUE; } diff --git a/indra/newview/llfloatertelehub.cpp b/indra/newview/llfloatertelehub.cpp index 9c837135d8..65b6d55480 100644 --- a/indra/newview/llfloatertelehub.cpp +++ b/indra/newview/llfloatertelehub.cpp @@ -45,7 +45,7 @@ #include "lltoolmgr.h" #include "llviewerobject.h" #include "llviewerobjectlist.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" LLFloaterTelehub* LLFloaterTelehub::sInstance = NULL; @@ -62,8 +62,8 @@ void LLFloaterTelehub::show() sInstance = new LLFloaterTelehub(); // Show tools floater by selecting translate (select) tool - gToolMgr->setCurrentToolset(gBasicToolset); - gToolMgr->getCurrentToolset()->selectTool( gToolTranslate ); + LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); + LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolCompTranslate::getInstance() ); // Find tools floater, glue to bottom if (gFloaterTools) @@ -92,21 +92,21 @@ LLFloaterTelehub::LLFloaterTelehub() gMessageSystem->setHandlerFunc("TelehubInfo", processTelehubInfo); - gUICtrlFactory->buildFloater(sInstance, "floater_telehub.xml"); + LLUICtrlFactory::getInstance()->buildFloater(sInstance, "floater_telehub.xml"); childSetAction("connect_btn", onClickConnect, this); childSetAction("disconnect_btn", onClickDisconnect, this); childSetAction("add_spawn_point_btn", onClickAddSpawnPoint, this); childSetAction("remove_spawn_point_btn", onClickRemoveSpawnPoint, this); - LLScrollListCtrl* list = LLUICtrlFactory::getScrollListByName(this, "spawn_points_list"); + LLScrollListCtrl* list = getChild<LLScrollListCtrl>("spawn_points_list"); if (list) { // otherwise you can't walk with arrow keys while floater is up list->setAllowKeyboardMovement(FALSE); } - mObjectSelection = gSelectMgr->getEditSelection(); + mObjectSelection = LLSelectMgr::getInstance()->getEditSelection(); } LLFloaterTelehub::~LLFloaterTelehub() @@ -119,7 +119,7 @@ LLFloaterTelehub::~LLFloaterTelehub() void LLFloaterTelehub::draw() { - if (getVisible() && !isMinimized()) + if (!isMinimized()) { refresh(); } @@ -133,7 +133,7 @@ void LLFloaterTelehub::refresh() LLViewerObject* object = mObjectSelection->getFirstRootObject(children_ok); BOOL have_selection = (object != NULL); - BOOL all_volume = gSelectMgr->selectionAllPCode( LL_PCODE_VOLUME ); + BOOL all_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ); childSetEnabled("connect_btn", have_selection && all_volume); BOOL have_telehub = mTelehubObjectID.notNull(); @@ -142,7 +142,7 @@ void LLFloaterTelehub::refresh() BOOL space_avail = (mNumSpawn < MAX_SPAWNPOINTS_PER_TELEHUB); childSetEnabled("add_spawn_point_btn", have_selection && all_volume && space_avail); - LLScrollListCtrl* list = LLUICtrlFactory::getScrollListByName(this, "spawn_points_list"); + LLScrollListCtrl* list = getChild<LLScrollListCtrl>("spawn_points_list"); if (list) { BOOL enable_remove = (list->getFirstSelected() != NULL); @@ -175,7 +175,7 @@ void LLFloaterTelehub::addBeacons() // Draw nice thick 3-pixel lines. gObjectList.addDebugBeacon(hub_pos_region, "", LLColor4::yellow, LLColor4::white, 4); - LLScrollListCtrl* list = LLUICtrlFactory::getScrollListByName(sInstance, "spawn_points_list"); + LLScrollListCtrl* list = sInstance->getChild<LLScrollListCtrl>("spawn_points_list"); if (list) { S32 spawn_index = list->getFirstSelectedIndex(); @@ -189,26 +189,26 @@ void LLFloaterTelehub::addBeacons() void LLFloaterTelehub::sendTelehubInfoRequest() { - gSelectMgr->sendGodlikeRequest("telehub", "info ui"); + LLSelectMgr::getInstance()->sendGodlikeRequest("telehub", "info ui"); } // static void LLFloaterTelehub::onClickConnect(void* data) { - gSelectMgr->sendGodlikeRequest("telehub", "connect"); + LLSelectMgr::getInstance()->sendGodlikeRequest("telehub", "connect"); } // static void LLFloaterTelehub::onClickDisconnect(void* data) { - gSelectMgr->sendGodlikeRequest("telehub", "delete"); + LLSelectMgr::getInstance()->sendGodlikeRequest("telehub", "delete"); } // static void LLFloaterTelehub::onClickAddSpawnPoint(void* data) { - gSelectMgr->sendGodlikeRequest("telehub", "spawnpoint add"); - gSelectMgr->deselectAll(); + LLSelectMgr::getInstance()->sendGodlikeRequest("telehub", "spawnpoint add"); + LLSelectMgr::getInstance()->deselectAll(); } // static @@ -216,7 +216,7 @@ void LLFloaterTelehub::onClickRemoveSpawnPoint(void* data) { if (!sInstance) return; - LLScrollListCtrl* list = LLUICtrlFactory::getScrollListByName(sInstance, "spawn_points_list"); + LLScrollListCtrl* list = sInstance->getChild<LLScrollListCtrl>("spawn_points_list"); if (!list) return; S32 spawn_index = list->getFirstSelectedIndex(); @@ -295,7 +295,7 @@ void LLFloaterTelehub::unpackTelehubInfo(LLMessageSystem* msg) childSetVisible("help_text_not_connected", false); } - LLScrollListCtrl* list = LLUICtrlFactory::getScrollListByName(this, "spawn_points_list"); + LLScrollListCtrl* list = getChild<LLScrollListCtrl>("spawn_points_list"); if (list) { list->deleteAllItems(); diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp index 6c65ace89a..7777544a4c 100644 --- a/indra/newview/llfloatertools.cpp +++ b/indra/newview/llfloatertools.cpp @@ -69,7 +69,6 @@ #include "lltoolpie.h" #include "lltoolpipette.h" #include "lltoolplacer.h" -#include "lltoolselect.h" #include "lltoolselectland.h" #include "llui.h" #include "llviewermenu.h" @@ -77,7 +76,7 @@ #include "llviewerwindow.h" #include "llviewercontrol.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" // Globals LLFloaterTools *gFloaterTools = NULL; @@ -184,50 +183,50 @@ BOOL LLFloaterTools::postBuild() getDragHandle()->setEnabled( !gSavedSettings.getBOOL("ToolboxAutoMove") ); LLRect rect; - mBtnFocus = LLUICtrlFactory::getButtonByName(this,"button focus");//btn; - childSetAction("button focus",LLFloaterTools::setEditTool, (void*)gToolCamera); - mBtnMove = LLUICtrlFactory::getButtonByName(this,"button move"); - childSetAction("button move",LLFloaterTools::setEditTool, (void*)gToolGrab); - mBtnEdit = LLUICtrlFactory::getButtonByName(this,"button edit"); - childSetAction("button edit",LLFloaterTools::setEditTool, (void*)gToolTranslate); - mBtnCreate = LLUICtrlFactory::getButtonByName(this,"button create"); - childSetAction("button create",LLFloaterTools::setEditTool, (void*)gToolCreate); - mBtnLand = LLUICtrlFactory::getButtonByName(this, "button land" ); - childSetAction("button land",LLFloaterTools::setEditTool, (void*)gToolParcel); - mTextStatus = LLUICtrlFactory::getTextBoxByName(this,"text status"); - mRadioZoom = LLUICtrlFactory::getCheckBoxByName(this,"radio zoom"); + mBtnFocus = getChild<LLButton>("button focus");//btn; + childSetAction("button focus",LLFloaterTools::setEditTool, (void*)LLToolCamera::getInstance()); + mBtnMove = getChild<LLButton>("button move"); + childSetAction("button move",LLFloaterTools::setEditTool, (void*)LLToolGrab::getInstance()); + mBtnEdit = getChild<LLButton>("button edit"); + childSetAction("button edit",LLFloaterTools::setEditTool, (void*)LLToolCompTranslate::getInstance()); + mBtnCreate = getChild<LLButton>("button create"); + childSetAction("button create",LLFloaterTools::setEditTool, (void*)LLToolCompCreate::getInstance()); + mBtnLand = getChild<LLButton>("button land" ); + childSetAction("button land",LLFloaterTools::setEditTool, (void*)LLToolSelectLand::getInstance()); + mTextStatus = getChild<LLTextBox>("text status"); + mRadioZoom = getChild<LLCheckBoxCtrl>("radio zoom"); childSetCommitCallback("slider zoom",commit_slider_zoom,this); - mRadioOrbit = LLUICtrlFactory::getCheckBoxByName(this,"radio orbit"); + mRadioOrbit = getChild<LLCheckBoxCtrl>("radio orbit"); childSetCommitCallback("radio orbit",commit_radio_orbit,this); - mRadioPan = LLUICtrlFactory::getCheckBoxByName(this,"radio pan"); + mRadioPan = getChild<LLCheckBoxCtrl>("radio pan"); childSetCommitCallback("radio pan",commit_radio_pan,this); - mRadioMove = LLUICtrlFactory::getCheckBoxByName(this,"radio move"); + mRadioMove = getChild<LLCheckBoxCtrl>("radio move"); childSetCommitCallback("radio move",click_popup_grab_drag,this); - mRadioLift = LLUICtrlFactory::getCheckBoxByName(this,"radio lift"); + mRadioLift = getChild<LLCheckBoxCtrl>("radio lift"); childSetCommitCallback("radio lift",click_popup_grab_lift,this); - mRadioSpin = LLUICtrlFactory::getCheckBoxByName(this,"radio spin"); + mRadioSpin = getChild<LLCheckBoxCtrl>("radio spin"); childSetCommitCallback("radio spin",click_popup_grab_spin,NULL); - mRadioPosition = LLUICtrlFactory::getCheckBoxByName(this,"radio position"); - childSetCommitCallback("radio position",commit_select_tool,gToolTranslate); - mRadioRotate = LLUICtrlFactory::getCheckBoxByName(this,"radio rotate"); - childSetCommitCallback("radio rotate",commit_select_tool,gToolRotate); - mRadioStretch = LLUICtrlFactory::getCheckBoxByName(this,"radio stretch"); - childSetCommitCallback("radio stretch",commit_select_tool,gToolStretch); - mRadioSelectFace = LLUICtrlFactory::getCheckBoxByName(this,"radio select face"); - childSetCommitCallback("radio select face",commit_select_tool,gToolFace); - mCheckSelectIndividual = LLUICtrlFactory::getCheckBoxByName(this,"checkbox edit linked parts"); + mRadioPosition = getChild<LLCheckBoxCtrl>("radio position"); + childSetCommitCallback("radio position",commit_select_tool,LLToolCompTranslate::getInstance()); + mRadioRotate = getChild<LLCheckBoxCtrl>("radio rotate"); + childSetCommitCallback("radio rotate",commit_select_tool,LLToolCompRotate::getInstance()); + mRadioStretch = getChild<LLCheckBoxCtrl>("radio stretch"); + childSetCommitCallback("radio stretch",commit_select_tool,LLToolCompScale::getInstance()); + mRadioSelectFace = getChild<LLCheckBoxCtrl>("radio select face"); + childSetCommitCallback("radio select face",commit_select_tool,LLToolFace::getInstance()); + mCheckSelectIndividual = getChild<LLCheckBoxCtrl>("checkbox edit linked parts"); childSetValue("checkbox edit linked parts",(BOOL)gSavedSettings.getBOOL("EditLinkedParts")); childSetCommitCallback("checkbox edit linked parts",commit_select_component,this); - mCheckSnapToGrid = LLUICtrlFactory::getCheckBoxByName(this,"checkbox snap to grid"); + mCheckSnapToGrid = getChild<LLCheckBoxCtrl>("checkbox snap to grid"); childSetValue("checkbox snap to grid",(BOOL)gSavedSettings.getBOOL("SnapEnabled")); - mBtnGridOptions = LLUICtrlFactory::getButtonByName(this,"Options..."); + mBtnGridOptions = getChild<LLButton>("Options..."); childSetAction("Options...",onClickGridOptions, this); - mCheckStretchUniform = LLUICtrlFactory::getCheckBoxByName(this,"checkbox uniform"); + mCheckStretchUniform = getChild<LLCheckBoxCtrl>("checkbox uniform"); childSetValue("checkbox uniform",(BOOL)gSavedSettings.getBOOL("ScaleUniform")); - mCheckStretchTexture = LLUICtrlFactory::getCheckBoxByName(this,"checkbox stretch textures"); + mCheckStretchTexture = getChild<LLCheckBoxCtrl>("checkbox stretch textures"); childSetValue("checkbox stretch textures",(BOOL)gSavedSettings.getBOOL("ScaleStretchTextures")); - mTextGridMode = LLUICtrlFactory::getTextBoxByName(this,"text ruler mode"); - mComboGridMode = LLUICtrlFactory::getComboBoxByName(this,"combobox grid mode"); + mTextGridMode = getChild<LLTextBox>("text ruler mode"); + mComboGridMode = getChild<LLComboBox>("combobox grid mode"); childSetCommitCallback("combobox grid mode",commit_grid_mode, this); // // Create Buttons @@ -267,7 +266,7 @@ BOOL LLFloaterTools::postBuild() &LLToolPlacerPanel::sGrass}; for(size_t t=0; t<sizeof(toolNames)/sizeof(toolNames[0]); ++t) { - LLButton *found = LLViewerUICtrlFactory::getButtonByName(this,toolNames[t]); + LLButton *found = getChild<LLButton>(toolNames[t]); if(found) { found->setClickedCallback(setObjectType,toolData[t]); @@ -276,38 +275,38 @@ BOOL LLFloaterTools::postBuild() llwarns << "Tool button not found! DOA Pending." << llendl; } } - mCheckCopySelection = LLUICtrlFactory::getCheckBoxByName(this,"checkbox copy selection"); + mCheckCopySelection = getChild<LLCheckBoxCtrl>("checkbox copy selection"); childSetValue("checkbox copy selection",(BOOL)gSavedSettings.getBOOL("CreateToolCopySelection")); - mCheckSticky = LLUICtrlFactory::getCheckBoxByName(this,"checkbox sticky"); + mCheckSticky = getChild<LLCheckBoxCtrl>("checkbox sticky"); childSetValue("checkbox sticky",(BOOL)gSavedSettings.getBOOL("CreateToolKeepSelected")); - mCheckCopyCenters = LLUICtrlFactory::getCheckBoxByName(this,"checkbox copy centers"); + mCheckCopyCenters = getChild<LLCheckBoxCtrl>("checkbox copy centers"); childSetValue("checkbox copy centers",(BOOL)gSavedSettings.getBOOL("CreateToolCopyCenters")); - mCheckCopyRotates = LLUICtrlFactory::getCheckBoxByName(this,"checkbox copy rotates"); + mCheckCopyRotates = getChild<LLCheckBoxCtrl>("checkbox copy rotates"); childSetValue("checkbox copy rotates",(BOOL)gSavedSettings.getBOOL("CreateToolCopyRotates")); - mRadioSelectLand = LLUICtrlFactory::getCheckBoxByName(this,"radio select land"); - childSetCommitCallback("radio select land",commit_select_tool, gToolParcel); - mRadioDozerFlatten = LLUICtrlFactory::getCheckBoxByName(this,"radio flatten"); + mRadioSelectLand = getChild<LLCheckBoxCtrl>("radio select land"); + childSetCommitCallback("radio select land",commit_select_tool, LLToolSelectLand::getInstance()); + mRadioDozerFlatten = getChild<LLCheckBoxCtrl>("radio flatten"); childSetCommitCallback("radio flatten",click_popup_dozer_mode, (void*)0); - mRadioDozerRaise = LLUICtrlFactory::getCheckBoxByName(this,"radio raise"); + mRadioDozerRaise = getChild<LLCheckBoxCtrl>("radio raise"); childSetCommitCallback("radio raise",click_popup_dozer_mode, (void*)1); - mRadioDozerLower = LLUICtrlFactory::getCheckBoxByName(this,"radio lower"); + mRadioDozerLower = getChild<LLCheckBoxCtrl>("radio lower"); childSetCommitCallback("radio lower",click_popup_dozer_mode, (void*)2); - mRadioDozerSmooth = LLUICtrlFactory::getCheckBoxByName(this,"radio smooth"); + mRadioDozerSmooth = getChild<LLCheckBoxCtrl>("radio smooth"); childSetCommitCallback("radio smooth",click_popup_dozer_mode, (void*)3); - mRadioDozerNoise = LLUICtrlFactory::getCheckBoxByName(this,"radio noise"); + mRadioDozerNoise = getChild<LLCheckBoxCtrl>("radio noise"); childSetCommitCallback("radio noise",click_popup_dozer_mode, (void*)4); - mRadioDozerRevert = LLUICtrlFactory::getCheckBoxByName(this,"radio revert"); + mRadioDozerRevert = getChild<LLCheckBoxCtrl>("radio revert"); childSetCommitCallback("radio revert",click_popup_dozer_mode, (void*)5); - mComboDozerSize = LLUICtrlFactory::getComboBoxByName(this,"combobox brush size"); + mComboDozerSize = getChild<LLComboBox>("combobox brush size"); childSetCommitCallback("combobox brush size",click_dozer_size, (void*)0); if(mComboDozerSize) mComboDozerSize->setCurrentByIndex(0); - mBtnApplyToSelection = LLUICtrlFactory::getButtonByName(this,"button apply to selection"); + mBtnApplyToSelection = getChild<LLButton>("button apply to selection"); childSetAction("button apply to selection",click_apply_to_selection, (void*)0); - mCheckShowOwners = LLUICtrlFactory::getCheckBoxByName(this,"checkbox show owners"); + mCheckShowOwners = getChild<LLCheckBoxCtrl>("checkbox show owners"); childSetValue("checkbox show owners",gSavedSettings.getBOOL("ShowParcelOwners")); childSetAction("button more", click_show_more, this); childSetAction("button less", click_show_more, this); - mTab = LLUICtrlFactory::getTabContainerByName(this,"Object Info Tabs"); + mTab = getChild<LLTabContainer>("Object Info Tabs"); if(mTab) { mTab->setVisible( gSavedSettings.getBOOL("ToolboxShowMore") ); @@ -406,7 +405,7 @@ LLFloaterTools::LLFloaterTools() factory_map["ContentsInventory"] = LLCallbackMap(createPanelContentsInventory, this);//LLPanelContents factory_map["land info panel"] = LLCallbackMap(createPanelLandInfo, this);//LLPanelLandInfo - gUICtrlFactory->buildFloater(this,"floater_tools.xml",&factory_map,FALSE); + LLUICtrlFactory::getInstance()->buildFloater(this,"floater_tools.xml",&factory_map,FALSE); mLargeHeight = getRect().getHeight(); mSmallHeight = mLargeHeight; @@ -445,7 +444,7 @@ void LLFloaterTools::refresh() const S32 INFO_WIDTH = getRect().getWidth(); const S32 INFO_HEIGHT = 384; LLRect object_info_rect(0, 0, INFO_WIDTH, -INFO_HEIGHT); - BOOL all_volume = gSelectMgr->selectionAllPCode( LL_PCODE_VOLUME ); + BOOL all_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ); S32 idx_features = mTab->getPanelIndexByTitle(PANEL_NAMES[PANEL_FEATURES]); S32 idx_face = mTab->getPanelIndexByTitle(PANEL_NAMES[PANEL_FACE]); @@ -502,7 +501,7 @@ void LLFloaterTools::resetToolState() void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) { - LLTool *tool = gToolMgr->getCurrentTool(); + LLTool *tool = LLToolMgr::getInstance()->getCurrentTool(); // HACK to allow seeing the buttons when you have the app in a window. // Keep the visibility the same as it @@ -517,7 +516,7 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) } // Focus buttons - BOOL focus_visible = ( tool == gToolCamera ); + BOOL focus_visible = ( tool == LLToolCamera::getInstance() ); mBtnFocus ->setToggleState( focus_visible ); @@ -545,7 +544,7 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) childSetValue( "slider zoom", gAgent.getCameraZoomFraction() * 0.5f); // Move buttons - BOOL move_visible = (tool == gToolGrab); + BOOL move_visible = (tool == LLToolGrab::getInstance()); if (mBtnMove) mBtnMove ->setToggleState( move_visible ); @@ -574,12 +573,12 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) } // Edit buttons - BOOL edit_visible = tool == gToolTranslate || - tool == gToolRotate || - tool == gToolStretch || - tool == gToolFace || - tool == gToolIndividual || - tool == gToolPipette; + BOOL edit_visible = tool == LLToolCompTranslate::getInstance() || + tool == LLToolCompRotate::getInstance() || + tool == LLToolCompScale::getInstance() || + tool == LLToolFace::getInstance() || + tool == LLToolIndividual::getInstance() || + tool == LLToolPipette::getInstance(); mBtnEdit ->setToggleState( edit_visible ); @@ -589,7 +588,7 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) if (mRadioSelectFace) { mRadioSelectFace->setVisible( edit_visible ); - mRadioSelectFace->set( tool == gToolFace ); + mRadioSelectFace->set( tool == LLToolFace::getInstance() ); } if (mCheckSelectIndividual) @@ -598,9 +597,9 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) //mCheckSelectIndividual->set(gSavedSettings.getBOOL("EditLinkedParts")); } - mRadioPosition ->set( tool == gToolTranslate ); - mRadioRotate ->set( tool == gToolRotate ); - mRadioStretch ->set( tool == gToolStretch ); + mRadioPosition ->set( tool == LLToolCompTranslate::getInstance() ); + mRadioRotate ->set( tool == LLToolCompRotate::getInstance() ); + mRadioStretch ->set( tool == LLToolCompScale::getInstance() ); if (mComboGridMode) { @@ -632,17 +631,17 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) if (mTextGridMode) mTextGridMode->setVisible( edit_visible ); // Snap to grid disabled for grab tool - very confusing - if (mCheckSnapToGrid) mCheckSnapToGrid->setVisible( edit_visible /* || tool == gToolGrab */ ); - if (mBtnGridOptions) mBtnGridOptions->setVisible( edit_visible /* || tool == gToolGrab */ ); + if (mCheckSnapToGrid) mCheckSnapToGrid->setVisible( edit_visible /* || tool == LLToolGrab::getInstance() */ ); + if (mBtnGridOptions) mBtnGridOptions->setVisible( edit_visible /* || tool == LLToolGrab::getInstance() */ ); //mCheckSelectLinked ->setVisible( edit_visible ); if (mCheckStretchUniform) mCheckStretchUniform->setVisible( edit_visible ); if (mCheckStretchTexture) mCheckStretchTexture->setVisible( edit_visible ); // Create buttons - BOOL create_visible = (tool == gToolCreate); + BOOL create_visible = (tool == LLToolCompCreate::getInstance()); - mBtnCreate ->setToggleState( tool == gToolCreate ); + mBtnCreate ->setToggleState( tool == LLToolCompCreate::getInstance() ); if (mCheckCopySelection && mCheckCopySelection->get()) @@ -678,12 +677,12 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) if (mCheckCopyRotates) mCheckCopyRotates->setEnabled( mCheckCopySelection->get() ); // Land buttons - BOOL land_visible = (tool == gToolLand || tool == gToolParcel ); + BOOL land_visible = (tool == LLToolBrushLand::getInstance() || tool == LLToolSelectLand::getInstance() ); if (mBtnLand) mBtnLand ->setToggleState( land_visible ); - // mRadioEditLand ->set( tool == gToolLand ); - if (mRadioSelectLand) mRadioSelectLand->set( tool == gToolParcel ); + // mRadioEditLand ->set( tool == LLToolBrushLand::getInstance() ); + if (mRadioSelectLand) mRadioSelectLand->set( tool == LLToolSelectLand::getInstance() ); // mRadioEditLand ->setVisible( land_visible ); if (mRadioSelectLand) mRadioSelectLand->setVisible( land_visible ); @@ -693,44 +692,44 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) if (mRadioDozerFlatten) { - mRadioDozerFlatten ->set( tool == gToolLand && dozer_mode == 0); + mRadioDozerFlatten ->set( tool == LLToolBrushLand::getInstance() && dozer_mode == 0); mRadioDozerFlatten ->setVisible( land_visible ); } if (mRadioDozerRaise) { - mRadioDozerRaise ->set( tool == gToolLand && dozer_mode == 1); + mRadioDozerRaise ->set( tool == LLToolBrushLand::getInstance() && dozer_mode == 1); mRadioDozerRaise ->setVisible( land_visible ); } if (mRadioDozerLower) { - mRadioDozerLower ->set( tool == gToolLand && dozer_mode == 2); + mRadioDozerLower ->set( tool == LLToolBrushLand::getInstance() && dozer_mode == 2); mRadioDozerLower ->setVisible( land_visible ); } if (mRadioDozerSmooth) { - mRadioDozerSmooth ->set( tool == gToolLand && dozer_mode == 3); + mRadioDozerSmooth ->set( tool == LLToolBrushLand::getInstance() && dozer_mode == 3); mRadioDozerSmooth ->setVisible( land_visible ); } if (mRadioDozerNoise) { - mRadioDozerNoise ->set( tool == gToolLand && dozer_mode == 4); + mRadioDozerNoise ->set( tool == LLToolBrushLand::getInstance() && dozer_mode == 4); mRadioDozerNoise ->setVisible( land_visible ); } if (mRadioDozerRevert) { - mRadioDozerRevert ->set( tool == gToolLand && dozer_mode == 5); + mRadioDozerRevert ->set( tool == LLToolBrushLand::getInstance() && dozer_mode == 5); mRadioDozerRevert ->setVisible( land_visible ); } if (mComboDozerSize) { mComboDozerSize ->setCurrentByIndex(dozer_size); mComboDozerSize ->setVisible( land_visible ); - mComboDozerSize ->setEnabled( tool == gToolLand ); + mComboDozerSize ->setEnabled( tool == LLToolBrushLand::getInstance() ); } if (mBtnApplyToSelection) { mBtnApplyToSelection->setVisible( land_visible ); - mBtnApplyToSelection->setEnabled( land_visible && !gParcelMgr->selectionEmpty() && tool != gToolParcel); + mBtnApplyToSelection->setEnabled( land_visible && !LLViewerParcelMgr::getInstance()->selectionEmpty() && tool != LLToolSelectLand::getInstance()); } if (mCheckShowOwners) { @@ -742,8 +741,8 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) // BOOL show_more = gSavedSettings.getBOOL("ToolboxShowMore"); - mTab->setVisible(show_more && tool != gToolLand && tool != gToolParcel); - mPanelLandInfo->setVisible(show_more && (tool == gToolLand || tool == gToolParcel)); + mTab->setVisible(show_more && tool != LLToolBrushLand::getInstance() && tool != LLToolSelectLand::getInstance()); + mPanelLandInfo->setVisible(show_more && (tool == LLToolBrushLand::getInstance() || tool == LLToolSelectLand::getInstance())); } @@ -757,8 +756,8 @@ BOOL LLFloaterTools::canClose() // virtual void LLFloaterTools::onOpen() { - mParcelSelection = gParcelMgr->getFloatingParcelSelection(); - mObjectSelection = gSelectMgr->getEditSelection(); + mParcelSelection = LLViewerParcelMgr::getInstance()->getFloatingParcelSelection(); + mObjectSelection = LLSelectMgr::getInstance()->getEditSelection(); gMenuBarView->setItemVisible("Tools", TRUE); gMenuBarView->arrange(); @@ -776,7 +775,7 @@ void LLFloaterTools::onClose(bool app_quitting) gAgent.resetView(gSavedSettings.getBOOL("EditCameraMovement")); // exit component selection mode - gSelectMgr->promoteSelectionToRoot(); + LLSelectMgr::getInstance()->promoteSelectionToRoot(); gSavedSettings.setBOOL("EditLinkedParts", FALSE); gViewerWindow->showCursor(); @@ -787,10 +786,10 @@ void LLFloaterTools::onClose(bool app_quitting) mObjectSelection = NULL; // Switch back to basic toolset - gToolMgr->setCurrentToolset(gBasicToolset); + LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); // we were already in basic toolset, using build tools // so manually reset tool to default (pie menu tool) - gToolMgr->getCurrentToolset()->selectFirstTool(); + LLToolMgr::getInstance()->getCurrentToolset()->selectFirstTool(); gMenuBarView->setItemVisible("Tools", FALSE); gMenuBarView->arrange(); @@ -891,19 +890,19 @@ void commit_slider_zoom(LLUICtrl *ctrl, void*) void click_popup_rotate_left(void*) { - gSelectMgr->selectionRotateAroundZ( 45.f ); + LLSelectMgr::getInstance()->selectionRotateAroundZ( 45.f ); dialog_refresh_all(); } void click_popup_rotate_reset(void*) { - gSelectMgr->selectionResetRotation(); + LLSelectMgr::getInstance()->selectionResetRotation(); dialog_refresh_all(); } void click_popup_rotate_right(void*) { - gSelectMgr->selectionRotateAroundZ( -45.f ); + LLSelectMgr::getInstance()->selectionRotateAroundZ( -45.f ); dialog_refresh_all(); } @@ -912,7 +911,7 @@ void click_popup_dozer_mode(LLUICtrl *, void *user) { S32 show_owners = gSavedSettings.getBOOL("ShowParcelOwners"); S32 mode = (S32)(intptr_t) user; - gFloaterTools->setEditTool( gToolLand ); + gFloaterTools->setEditTool( LLToolBrushLand::getInstance() ); gSavedSettings.setS32("RadioLandBrushAction", mode); gSavedSettings.setBOOL("ShowParcelOwners", show_owners); } @@ -931,7 +930,7 @@ void click_dozer_size(LLUICtrl *ctrl, void *user) void click_apply_to_selection(void* user) { - gToolLand->modifyLandInSelectionGlobal(); + LLToolBrushLand::getInstance()->modifyLandInSelectionGlobal(); } void commit_select_tool(LLUICtrl *ctrl, void *data) @@ -957,11 +956,11 @@ void commit_select_component(LLUICtrl *ctrl, void *data) if (select_individuals) { - gSelectMgr->demoteSelectionToIndividuals(); + LLSelectMgr::getInstance()->demoteSelectionToIndividuals(); } else { - gSelectMgr->promoteSelectionToRoot(); + LLSelectMgr::getInstance()->promoteSelectionToRoot(); } } @@ -969,7 +968,7 @@ void commit_grid_mode(LLUICtrl *ctrl, void *data) { LLComboBox* combo = (LLComboBox*)ctrl; - gSelectMgr->setGridMode((EGridMode)combo->getCurrentIndex()); + LLSelectMgr::getInstance()->setGridMode((EGridMode)combo->getCurrentIndex()); } // static @@ -997,6 +996,6 @@ void LLFloaterTools::setEditTool(void* tool_pointer) void LLFloaterTools::onFocusReceived() { - gToolMgr->setCurrentToolset(gBasicToolset); + LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); LLFloater::onFocusReceived(); } diff --git a/indra/newview/llfloatertopobjects.cpp b/indra/newview/llfloatertopobjects.cpp index 593d1f5114..5d2f21e370 100644 --- a/indra/newview/llfloatertopobjects.cpp +++ b/indra/newview/llfloatertopobjects.cpp @@ -46,7 +46,7 @@ #include "lltracker.h" #include "llviewerparcelmgr.h" #include "llviewerregion.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llviewerwindow.h" LLFloaterTopObjects* LLFloaterTopObjects::sInstance = NULL; @@ -62,7 +62,7 @@ void LLFloaterTopObjects::show() } sInstance = new LLFloaterTopObjects(); - gUICtrlFactory->buildFloater(sInstance, "floater_top_objects.xml"); + LLUICtrlFactory::getInstance()->buildFloater(sInstance, "floater_top_objects.xml"); sInstance->center(); } @@ -85,7 +85,7 @@ BOOL LLFloaterTopObjects::postBuild() childSetCommitCallback("objects_list", onCommitObjectsList, this); childSetDoubleClickCallback("objects_list", onDoubleClickObjectsList); childSetFocus("objects_list"); - LLScrollListCtrl *objects_list = LLUICtrlFactory::getScrollListByName(this, "objects_list"); + LLScrollListCtrl *objects_list = getChild<LLScrollListCtrl>("objects_list"); if (objects_list) { objects_list->setCommitOnSelectionChange(TRUE); @@ -106,7 +106,7 @@ BOOL LLFloaterTopObjects::postBuild() /* - LLLineEditor* line_editor = LLUICtrlFactory::getLineEditorByName(this, "owner_name_editor"); + LLLineEditor* line_editor = getChild<LLLineEditor>("owner_name_editor"); if (line_editor) { line_editor->setCommitOnFocusLost(FALSE); @@ -114,7 +114,7 @@ BOOL LLFloaterTopObjects::postBuild() line_editor->setCallbackUserData(this); } - line_editor = LLUICtrlFactory::getLineEditorByName(this, "object_name_editor"); + line_editor = getChild<LLLineEditor>("object_name_editor"); if (line_editor) { line_editor->setCommitOnFocusLost(FALSE); @@ -247,7 +247,7 @@ void LLFloaterTopObjects::onCommitObjectsList(LLUICtrl* ctrl, void* data) void LLFloaterTopObjects::updateSelectionInfo() { - LLScrollListCtrl* list = LLUICtrlFactory::getScrollListByName(this, "objects_list"); + LLScrollListCtrl* list = getChild<LLScrollListCtrl>("objects_list"); if (!list) return; @@ -445,7 +445,7 @@ void LLFloaterTopObjects::onGetByOwnerName(LLUICtrl* ctrl, void* data) void LLFloaterTopObjects::showBeacon() { - LLScrollListCtrl* list = LLUICtrlFactory::getScrollListByName(this, "objects_list"); + LLScrollListCtrl* list = getChild<LLScrollListCtrl>("objects_list"); if (!list) return; LLScrollListItem* first_selected = list->getFirstSelected(); diff --git a/indra/newview/llfloatertos.cpp b/indra/newview/llfloatertos.cpp index 5875c4bef7..6b51687c68 100644 --- a/indra/newview/llfloatertos.cpp +++ b/indra/newview/llfloatertos.cpp @@ -42,7 +42,7 @@ #include "llstartup.h" #include "message.h" #include "llagent.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llviewerwindow.h" #include "llviewerstats.h" #include "llui.h" @@ -62,11 +62,11 @@ LLFloaterTOS* LLFloaterTOS::show(ETOSType type, const std::string & message) if (type == TOS_TOS) { - gUICtrlFactory->buildFloater(LLFloaterTOS::sInstance, "floater_tos.xml"); + LLUICtrlFactory::getInstance()->buildFloater(LLFloaterTOS::sInstance, "floater_tos.xml"); } else { - gUICtrlFactory->buildFloater(LLFloaterTOS::sInstance, "floater_critical.xml"); + LLUICtrlFactory::getInstance()->buildFloater(LLFloaterTOS::sInstance, "floater_critical.xml"); } return LLFloaterTOS::sInstance; @@ -132,7 +132,7 @@ BOOL LLFloaterTOS::postBuild() if ( mType != TOS_TOS ) { // this displays the critical message - LLTextEditor *Editor = LLUICtrlFactory::getTextEditorByName(this, "tos_text"); + LLTextEditor *Editor = getChild<LLTextEditor>("tos_text"); if (Editor) { Editor->setHandleEditKeysDirectly( TRUE ); @@ -146,14 +146,14 @@ BOOL LLFloaterTOS::postBuild() } // disable Agree to TOS radio button until the page has fully loaded - LLRadioGroup* tos_agreement = LLUICtrlFactory::getRadioGroupByName(this, "tos_agreement"); + LLRadioGroup* tos_agreement = getChild<LLRadioGroup>("tos_agreement"); if ( tos_agreement ) { tos_agreement->setEnabled( false ); }; // hide the SL text widget if we're displaying TOS with using a browser widget. - LLTextEditor *editor = LLUICtrlFactory::getTextEditorByName(this, "tos_text"); + LLTextEditor *editor = getChild<LLTextEditor>("tos_text"); if ( editor ) { editor->setVisible( FALSE ); @@ -194,7 +194,7 @@ void LLFloaterTOS::setSiteIsAlive( bool alive ) { // normally this is set when navigation to TOS page navigation completes (so you can't accept before TOS loads) // but if the page is unavailable, we need to do this now - LLRadioGroup* tos_agreement = LLUICtrlFactory::getRadioGroupByName(this, "tos_agreement"); + LLRadioGroup* tos_agreement = getChild<LLRadioGroup>("tos_agreement"); if ( tos_agreement ) { tos_agreement->setEnabled( true ); @@ -286,7 +286,7 @@ void LLFloaterTOS::onNavigateComplete( const EventType& eventIn ) { llinfos << "NAVIGATE COMPLETE" << llendl; // enable Agree to TOS radio button now that page has loaded - LLRadioGroup* tos_agreement = LLUICtrlFactory::getRadioGroupByName(this, "tos_agreement"); + LLRadioGroup* tos_agreement = getChild<LLRadioGroup>("tos_agreement"); if ( tos_agreement ) { tos_agreement->setEnabled( true ); diff --git a/indra/newview/llfloaterurldisplay.cpp b/indra/newview/llfloaterurldisplay.cpp index e0d547b34e..c68c6d3edb 100644 --- a/indra/newview/llfloaterurldisplay.cpp +++ b/indra/newview/llfloaterurldisplay.cpp @@ -35,7 +35,7 @@ #include "llfloaterurldisplay.h" #include "llpanelplace.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "v3dmath.h" @@ -46,7 +46,7 @@ LLFloaterURLDisplay::LLFloaterURLDisplay(const LLSD& sd) { mFactoryMap["place_details_panel"] = LLCallbackMap(LLFloaterURLDisplay::createPlaceDetail, this); - gUICtrlFactory->buildFloater(this, "floater_preview_url.xml", &getFactoryMap()); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_preview_url.xml", &getFactoryMap()); this->setVisible(false); // If positioned at 0,0 the teleport button is behind the toolbar. @@ -101,7 +101,7 @@ void* LLFloaterURLDisplay::createPlaceDetail(void* userdata) { LLFloaterURLDisplay *self = (LLFloaterURLDisplay*)userdata; self->mPlacePanel = new LLPanelPlace(); - gUICtrlFactory->buildPanel(self->mPlacePanel, "panel_place.xml"); + LLUICtrlFactory::getInstance()->buildPanel(self->mPlacePanel, "panel_place.xml"); return self->mPlacePanel; } diff --git a/indra/newview/llfloaterurlentry.cpp b/indra/newview/llfloaterurlentry.cpp index e9e2584b17..400927632c 100644 --- a/indra/newview/llfloaterurlentry.cpp +++ b/indra/newview/llfloaterurlentry.cpp @@ -38,7 +38,7 @@ // project includes #include "llcombobox.h" #include "llurlhistory.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llwindow.h" #include "llviewerwindow.h" @@ -89,9 +89,9 @@ LLFloaterURLEntry::LLFloaterURLEntry(LLHandle<LLPanel> parent) LLFloater(), mPanelLandMediaHandle(parent) { - gUICtrlFactory->buildFloater(this, "floater_url_entry.xml"); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_url_entry.xml"); - mMediaURLEdit = LLUICtrlFactory::getComboBoxByName(this, "media_entry"); + mMediaURLEdit = getChild<LLComboBox>("media_entry"); // Cancel button childSetAction("cancel_btn", onBtnCancel, this); diff --git a/indra/newview/llfloaterwater.cpp b/indra/newview/llfloaterwater.cpp index 0b02ea2623..f3f25f7847 100644 --- a/indra/newview/llfloaterwater.cpp +++ b/indra/newview/llfloaterwater.cpp @@ -41,12 +41,13 @@ #include "llcolorswatch.h" #include "llcheckboxctrl.h" #include "lltexturectrl.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llviewercamera.h" #include "llcombobox.h" #include "lllineeditor.h" #include "llfloaterdaycycle.h" #include "llboost.h" +#include "llmultisliderctrl.h" #include "v4math.h" #include "llviewerdisplay.h" @@ -66,10 +67,10 @@ std::set<std::string> LLFloaterWater::sDefaultPresets; LLFloaterWater::LLFloaterWater() : LLFloater("water floater") { - gUICtrlFactory->buildFloater(this, "floater_water.xml"); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_water.xml"); // add the combo boxes - LLComboBox* comboBox = LLUICtrlFactory::getComboBoxByName(this, "WaterPresetsCombo"); + LLComboBox* comboBox = getChild<LLComboBox>("WaterPresetsCombo"); if(comboBox != NULL) { @@ -150,7 +151,7 @@ void LLFloaterWater::initCallbacks(void) { childSetCommitCallback("WaterBlurMult", onFloatControlMoved, ¶m_mgr->mBlurMultiplier); // Load/save - LLComboBox* comboBox = LLUICtrlFactory::getComboBoxByName(this, "WaterPresetsCombo"); + LLComboBox* comboBox = getChild<LLComboBox>("WaterPresetsCombo"); //childSetAction("WaterLoadPreset", onLoadPreset, comboBox); childSetAction("WaterNewPreset", onNewPreset, comboBox); @@ -166,7 +167,7 @@ void LLFloaterWater::initCallbacks(void) { comboBox->setCommitCallback(onChangePresetName); LLTextureCtrl* textCtrl = getChild<LLTextureCtrl>("WaterNormalMap"); - textCtrl->setDefaultImageAssetID(LLUUID(gViewerArt.getString("water_normal.tga"))); + textCtrl->setDefaultImageAssetID(DEFAULT_WATER_NORMAL); childSetCommitCallback("WaterNormalMap", onNormalMapPicked, NULL); } @@ -199,8 +200,7 @@ void LLFloaterWater::newPromptCallback(S32 option, const LLString& text, void* u } if(option == 0) { - LLComboBox* comboBox = LLUICtrlFactory::getComboBoxByName(sWaterMenu, - "WaterPresetsCombo"); + LLComboBox* comboBox = sWaterMenu->getChild<LLComboBox>( "WaterPresetsCombo"); LLWaterParamManager * param_mgr = LLWaterParamManager::instance(); @@ -311,7 +311,7 @@ void LLFloaterWater::show() water->syncMenu(); // comment in if you want the menu to rebuild each time - //gUICtrlFactory->buildFloater(water, "floater_water.xml"); + //LLUICtrlFactory::getInstance()->buildFloater(water, "floater_water.xml"); //water->initCallbacks(); water->open(); @@ -604,8 +604,7 @@ void LLFloaterWater::onNewPreset(void* userData) void LLFloaterWater::onSavePreset(void* userData) { // get the name - LLComboBox* comboBox = LLUICtrlFactory::getComboBoxByName(sWaterMenu, - "WaterPresetsCombo"); + LLComboBox* comboBox = sWaterMenu->getChild<LLComboBox>("WaterPresetsCombo"); // don't save the empty name if(comboBox->getSelectedItemLabel() == "") @@ -647,8 +646,7 @@ void LLFloaterWater::saveAlertCallback(S32 option, void* userdata) void LLFloaterWater::onDeletePreset(void* userData) { - LLComboBox* combo_box = LLUICtrlFactory::getComboBoxByName(sWaterMenu, - "WaterPresetsCombo"); + LLComboBox* combo_box = sWaterMenu->getChild<LLComboBox>("WaterPresetsCombo"); if(combo_box->getSelectedValue().asString() == "") { @@ -665,8 +663,7 @@ void LLFloaterWater::deleteAlertCallback(S32 option, void* userdata) // if they choose delete, do it. Otherwise, don't do anything if(option == 0) { - LLComboBox* combo_box = LLUICtrlFactory::getComboBoxByName(sWaterMenu, - "WaterPresetsCombo"); + LLComboBox* combo_box = sWaterMenu->getChild<LLComboBox>("WaterPresetsCombo"); LLFloaterDayCycle* day_cycle = NULL; LLComboBox* key_combo = NULL; LLMultiSliderCtrl* mult_sldr = NULL; @@ -674,10 +671,8 @@ void LLFloaterWater::deleteAlertCallback(S32 option, void* userdata) if(LLFloaterDayCycle::isOpen()) { day_cycle = LLFloaterDayCycle::instance(); - key_combo = LLUICtrlFactory::getComboBoxByName(day_cycle, - "WaterKeyPresets"); - mult_sldr = LLUICtrlFactory::getMultiSliderByName(day_cycle, - "WaterDayCycleKeys"); + key_combo = day_cycle->getChild<LLComboBox>("WaterKeyPresets"); + mult_sldr = day_cycle->getChild<LLMultiSliderCtrl>("WaterDayCycleKeys"); } LLString name = combo_box->getSelectedValue().asString(); diff --git a/indra/newview/llfloaterwindlight.cpp b/indra/newview/llfloaterwindlight.cpp index 2627ea3705..a83530e53c 100644 --- a/indra/newview/llfloaterwindlight.cpp +++ b/indra/newview/llfloaterwindlight.cpp @@ -41,7 +41,7 @@ #include "llmultisliderctrl.h" #include "llspinctrl.h" #include "llcheckboxctrl.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llviewercamera.h" #include "llcombobox.h" #include "lllineeditor.h" @@ -68,10 +68,10 @@ static const F32 WL_SUN_AMBIENT_SLIDER_SCALE = 3.0f; LLFloaterWindLight::LLFloaterWindLight() : LLFloater("windlight floater") { - gUICtrlFactory->buildFloater(this, "floater_windlight_options.xml"); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_windlight_options.xml"); // add the combo boxes - LLComboBox* comboBox = LLUICtrlFactory::getComboBoxByName(this, "WLPresetsCombo"); + LLComboBox* comboBox = getChild<LLComboBox>("WLPresetsCombo"); if(comboBox != NULL) { @@ -214,7 +214,7 @@ void LLFloaterWindLight::initCallbacks(void) { // WL Top childSetAction("WLDayCycleMenuButton", onOpenDayCycle, NULL); // Load/save - LLComboBox* comboBox = LLUICtrlFactory::getComboBoxByName(this, "WLPresetsCombo"); + LLComboBox* comboBox = getChild<LLComboBox>("WLPresetsCombo"); //childSetAction("WLLoadPreset", onLoadPreset, comboBox); childSetAction("WLNewPreset", onNewPreset, comboBox); @@ -259,7 +259,7 @@ void LLFloaterWindLight::newPromptCallback(S32 option, const LLString& text, voi } if(option == 0) { - LLComboBox* comboBox = LLUICtrlFactory::getComboBoxByName(sWindLight, + LLComboBox* comboBox = sWindLight->getChild<LLComboBox>( "WLPresetsCombo"); LLFloaterDayCycle* sDayCycle = NULL; @@ -267,7 +267,7 @@ void LLFloaterWindLight::newPromptCallback(S32 option, const LLString& text, voi if(LLFloaterDayCycle::isOpen()) { sDayCycle = LLFloaterDayCycle::instance(); - keyCombo = LLUICtrlFactory::getComboBoxByName(sDayCycle, + keyCombo = sDayCycle->getChild<LLComboBox>( "WLKeyPresets"); } @@ -459,7 +459,7 @@ void LLFloaterWindLight::show() windLight->syncMenu(); // comment in if you want the menu to rebuild each time - //gUICtrlFactory->buildFloater(windLight, "floater_windlight_options.xml"); + //LLUICtrlFactory::getInstance()->buildFloater(windLight, "floater_windlight_options.xml"); //windLight->initCallbacks(); windLight->open(); @@ -740,10 +740,8 @@ void LLFloaterWindLight::onSunMoved(LLUICtrl* ctrl, void* userData) { deactivateAnimator(); - LLSliderCtrl* sunSldr = LLUICtrlFactory::getSliderByName(sWindLight, - "WLSunAngle"); - LLSliderCtrl* eastSldr = LLUICtrlFactory::getSliderByName(sWindLight, - "WLEastAngle"); + LLSliderCtrl* sunSldr = sWindLight->getChild<LLSliderCtrl>("WLSunAngle"); + LLSliderCtrl* eastSldr = sWindLight->getChild<LLSliderCtrl>("WLEastAngle"); WLColorControl * colorControl = static_cast<WLColorControl *>(userData); @@ -794,7 +792,7 @@ void LLFloaterWindLight::onNewPreset(void* userData) void LLFloaterWindLight::onSavePreset(void* userData) { // get the name - LLComboBox* comboBox = LLUICtrlFactory::getComboBoxByName(sWindLight, + LLComboBox* comboBox = sWindLight->getChild<LLComboBox>( "WLPresetsCombo"); // don't save the empty name @@ -835,7 +833,7 @@ void LLFloaterWindLight::saveAlertCallback(S32 option, void* userdata) void LLFloaterWindLight::onDeletePreset(void* userData) { - LLComboBox* combo_box = LLUICtrlFactory::getComboBoxByName(sWindLight, + LLComboBox* combo_box = sWindLight->getChild<LLComboBox>( "WLPresetsCombo"); if(combo_box->getSelectedValue().asString() == "") @@ -853,7 +851,7 @@ void LLFloaterWindLight::deleteAlertCallback(S32 option, void* userdata) // if they choose delete, do it. Otherwise, don't do anything if(option == 0) { - LLComboBox* combo_box = LLUICtrlFactory::getComboBoxByName(sWindLight, + LLComboBox* combo_box = sWindLight->getChild<LLComboBox>( "WLPresetsCombo"); LLFloaterDayCycle* day_cycle = NULL; LLComboBox* key_combo = NULL; @@ -862,10 +860,9 @@ void LLFloaterWindLight::deleteAlertCallback(S32 option, void* userdata) if(LLFloaterDayCycle::isOpen()) { day_cycle = LLFloaterDayCycle::instance(); - key_combo = LLUICtrlFactory::getComboBoxByName(day_cycle, + key_combo = day_cycle->getChild<LLComboBox>( "WLKeyPresets"); - mult_sldr = LLUICtrlFactory::getMultiSliderByName(day_cycle, - "WLDayCycleKeys"); + mult_sldr = day_cycle->getChild<LLMultiSliderCtrl>("WLDayCycleKeys"); } LLString name(combo_box->getSelectedValue().asString()); @@ -956,7 +953,7 @@ void LLFloaterWindLight::onCloudScrollXToggled(LLUICtrl* ctrl, void* userData) bool lock = cbCtrl->get(); LLWLParamManager::instance()->mCurParams.setEnableCloudScrollX(!lock); - LLSliderCtrl* sldr = LLUICtrlFactory::getSliderByName(sWindLight, + LLSliderCtrl* sldr = sWindLight->getChild<LLSliderCtrl>( "WLCloudScrollX"); if(cbCtrl->get()) @@ -978,7 +975,7 @@ void LLFloaterWindLight::onCloudScrollYToggled(LLUICtrl* ctrl, void* userData) bool lock = cbCtrl->get(); LLWLParamManager::instance()->mCurParams.setEnableCloudScrollY(!lock); - LLSliderCtrl* sldr = LLUICtrlFactory::getSliderByName(sWindLight, + LLSliderCtrl* sldr = sWindLight->getChild<LLSliderCtrl>( "WLCloudScrollY"); if(cbCtrl->get()) diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index 8a40cdd062..3a4a3f3e1b 100644 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -64,7 +64,7 @@ #include "llviewerstats.h" #include "llworldmap.h" #include "llworldmapview.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llappviewer.h" #include "llmapimagetype.h" #include "llweb.h" @@ -165,7 +165,7 @@ LLFloaterWorldMap::LLFloaterWorldMap() LLCallbackMap::map_t factory_map; factory_map["objects_mapview"] = LLCallbackMap(createWorldMapView, NULL); factory_map["terrain_mapview"] = LLCallbackMap(createWorldMapView, NULL); - gUICtrlFactory->buildFloater(this, "floater_world_map.xml", &factory_map); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_world_map.xml", &factory_map); } // static @@ -176,29 +176,34 @@ void* LLFloaterWorldMap::createWorldMapView(void* data) BOOL LLFloaterWorldMap::postBuild() { - mTabs = LLUICtrlFactory::getTabContainerByName(this, "maptab"); + mTabs = getChild<LLTabContainer>("maptab"); if (!mTabs) return FALSE; LLPanel *panel; - panel = LLUICtrlFactory::getPanelByName(mTabs, "objects_mapview"); + panel = mTabs->getChild<LLPanel>("objects_mapview"); if (panel) { mTabs->setTabChangeCallback(panel, onCommitBackground); mTabs->setTabUserData(panel, this); } - panel = LLUICtrlFactory::getPanelByName(mTabs, "terrain_mapview"); + panel = mTabs->getChild<LLPanel>("terrain_mapview"); if (panel) { mTabs->setTabChangeCallback(panel, onCommitBackground); mTabs->setTabUserData(panel, this); } - onCommitBackground((void*)this, false); + // The following callback syncs the worlmap tabs with the images. + // Commented out since it was crashing when LLWorldMap became a singleton. + // We should be fine without it but override the onOpen method and put it + // there if it turns out to be needed. -MG + // + //onCommitBackground((void*)this, false); //childSetCommitCallback("friend combo", onAvatarComboCommit, this); - //LLComboBox *avatar_combo = LLUICtrlFactory::getComboBoxByName(this, "friend combo"); + //LLComboBox *avatar_combo = getChild<LLComboBox>( "friend combo"); //if (avatar_combo) //{ // avatar_combo->selectFirstItem(); @@ -210,7 +215,7 @@ BOOL LLFloaterWorldMap::postBuild() childSetFocusChangedCallback("location", onLocationFocusChanged, this); - LLLineEditor *location_editor = LLUICtrlFactory::getLineEditorByName(this, "location"); + LLLineEditor *location_editor = getChild<LLLineEditor>("location"); if (location_editor) { location_editor->setKeystrokeCallback( onSearchTextEntry ); @@ -224,7 +229,7 @@ BOOL LLFloaterWorldMap::postBuild() childSetCommitCallback("landmark combo", onLandmarkComboCommit, this); - LLComboBox *landmark_combo = LLUICtrlFactory::getComboBoxByName(this, "landmark combo"); + LLComboBox *landmark_combo = getChild<LLComboBox>( "landmark combo"); if (landmark_combo) { landmark_combo->selectFirstItem(); @@ -294,14 +299,14 @@ void LLFloaterWorldMap::show(void*, BOOL center_on_target) map_panel->updateVisibleBlocks(); // Reload the agent positions when we show the window - gWorldMap->eraseItems(); + LLWorldMap::getInstance()->eraseItems(); // Reload any maps that may have changed - gWorldMap->clearSimFlags(); + LLWorldMap::getInstance()->clearSimFlags(); const S32 panel_num = gFloaterWorldMap->mTabs->getCurrentPanelIndex(); const bool request_from_sim = true; - gWorldMap->setCurrentLayer(panel_num, request_from_sim); + LLWorldMap::getInstance()->setCurrentLayer(panel_num, request_from_sim); // We may already have a bounding box for the regions of the world, // so use that to adjust the view. @@ -335,9 +340,9 @@ void LLFloaterWorldMap::show(void*, BOOL center_on_target) // static void LLFloaterWorldMap::reloadIcons(void*) { - gWorldMap->eraseItems(); + LLWorldMap::getInstance()->eraseItems(); - gWorldMap->sendMapLayerRequest(); + LLWorldMap::getInstance()->sendMapLayerRequest(); } @@ -376,10 +381,7 @@ void LLFloaterWorldMap::setVisible( BOOL visible ) if( !visible ) { // While we're not visible, discard the overlay images we're using - if (gWorldMap) - { - gWorldMap->clearImageRefs(); - } + LLWorldMap::getInstance()->clearImageRefs(); } } @@ -394,7 +396,7 @@ BOOL LLFloaterWorldMap::handleHover(S32 x, S32 y, MASK mask) BOOL LLFloaterWorldMap::handleScrollWheel(S32 x, S32 y, S32 clicks) { - if (getVisible() && !isMinimized() && isFrontmost()) + if (!isMinimized() && isFrontmost()) { F32 slider_value = (F32)childGetValue("zoom slider").asReal(); slider_value += ((F32)clicks * -0.3333f); @@ -421,11 +423,6 @@ void LLFloaterWorldMap::reshape( S32 width, S32 height, BOOL called_from_parent // virtual void LLFloaterWorldMap::draw() { - if( !getVisible() ) - { - return; - } - // Hide/Show Mature Events controls childSetVisible("events_mature_icon", !gAgent.isTeen()); childSetVisible("events_mature_label", !gAgent.isTeen()); @@ -488,7 +485,7 @@ void LLFloaterWorldMap::draw() childSetEnabled("Teleport", (BOOL)tracking_status); // childSetEnabled("Clear", (BOOL)tracking_status); - childSetEnabled("Show Destination", (BOOL)tracking_status || gWorldMap->mIsTrackingUnknownLocation); + childSetEnabled("Show Destination", (BOOL)tracking_status || LLWorldMap::getInstance()->mIsTrackingUnknownLocation); childSetEnabled("copy_slurl", (mSLURL.size() > 0) ); setMouseOpaque(TRUE); @@ -558,7 +555,7 @@ void LLFloaterWorldMap::trackLandmark( const LLUUID& landmark_item_id ) { LLUUID asset_id = mLandmarkAssetIDList.get( idx ); LLString name; - LLComboBox* combo = LLUICtrlFactory::getComboBoxByName(this, "landmark combo"); + LLComboBox* combo = getChild<LLComboBox>( "landmark combo"); if (combo) name = combo->getSimple(); mTrackedStatus = LLTracker::TRACKING_LANDMARK; LLTracker::trackLandmark(mLandmarkAssetIDList.get( idx ), // assetID @@ -598,32 +595,32 @@ void LLFloaterWorldMap::trackGenericItem(const LLItemInfo &item) void LLFloaterWorldMap::trackLocation(const LLVector3d& pos_global) { - LLSimInfo* sim_info = gWorldMap->simInfoFromPosGlobal(pos_global); + LLSimInfo* sim_info = LLWorldMap::getInstance()->simInfoFromPosGlobal(pos_global); if (!sim_info) { - gWorldMap->mIsTrackingUnknownLocation = TRUE; - gWorldMap->mInvalidLocation = FALSE; - gWorldMap->mUnknownLocation = pos_global; + LLWorldMap::getInstance()->mIsTrackingUnknownLocation = TRUE; + LLWorldMap::getInstance()->mInvalidLocation = FALSE; + LLWorldMap::getInstance()->mUnknownLocation = pos_global; LLTracker::stopTracking(NULL); S32 world_x = S32(pos_global.mdV[0] / 256); S32 world_y = S32(pos_global.mdV[1] / 256); - gWorldMap->sendMapBlockRequest(world_x, world_y, world_x, world_y, true); + LLWorldMap::getInstance()->sendMapBlockRequest(world_x, world_y, world_x, world_y, true); setDefaultBtn(""); return; } if (sim_info->mAccess == SIM_ACCESS_DOWN) { // Down sim. Show the blue circle of death! - gWorldMap->mIsTrackingUnknownLocation = TRUE; - gWorldMap->mUnknownLocation = pos_global; - gWorldMap->mInvalidLocation = TRUE; + LLWorldMap::getInstance()->mIsTrackingUnknownLocation = TRUE; + LLWorldMap::getInstance()->mUnknownLocation = pos_global; + LLWorldMap::getInstance()->mInvalidLocation = TRUE; LLTracker::stopTracking(NULL); setDefaultBtn(""); return; } LLString sim_name; - gWorldMap->simNameFromPosGlobal( pos_global, sim_name ); + LLWorldMap::getInstance()->simNameFromPosGlobal( pos_global, sim_name ); F32 region_x = (F32)fmod( pos_global.mdV[VX], (F64)REGION_WIDTH_METERS ); F32 region_y = (F32)fmod( pos_global.mdV[VY], (F64)REGION_WIDTH_METERS ); LLString full_name = llformat("%s (%d, %d, %d)", @@ -635,9 +632,9 @@ void LLFloaterWorldMap::trackLocation(const LLVector3d& pos_global) LLString tooltip(""); mTrackedStatus = LLTracker::TRACKING_LOCATION; LLTracker::trackLocation(pos_global, full_name, tooltip); - gWorldMap->mIsTrackingUnknownLocation = FALSE; - gWorldMap->mIsTrackingDoubleClick = FALSE; - gWorldMap->mIsTrackingCommit = FALSE; + LLWorldMap::getInstance()->mIsTrackingUnknownLocation = FALSE; + LLWorldMap::getInstance()->mIsTrackingDoubleClick = FALSE; + LLWorldMap::getInstance()->mIsTrackingCommit = FALSE; setDefaultBtn("Teleport"); } @@ -660,7 +657,7 @@ void LLFloaterWorldMap::updateLocation() { // Make sure we know where we are before setting the current user position LLString agent_sim_name; - gotSimName = gWorldMap->simNameFromPosGlobal( agentPos, agent_sim_name ); + gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal( agentPos, agent_sim_name ); if ( gotSimName ) { mSetToUserPosition = FALSE; @@ -687,7 +684,7 @@ void LLFloaterWorldMap::updateLocation() return; // invalid location } LLString sim_name; - gotSimName = gWorldMap->simNameFromPosGlobal( pos_global, sim_name ); + gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal( pos_global, sim_name ); if ((status != LLTracker::TRACKING_NOTHING) && (status != mTrackedStatus || pos_global != mTrackedLocation || sim_name != mTrackedSimName)) { @@ -728,7 +725,7 @@ void LLFloaterWorldMap::updateLocation() void LLFloaterWorldMap::trackURL(const LLString& region_name, S32 x_coord, S32 y_coord, S32 z_coord) { - LLSimInfo* sim_info = gWorldMap->simInfoFromName(region_name); + LLSimInfo* sim_info = LLWorldMap::getInstance()->simInfoFromName(region_name); z_coord = llclamp(z_coord, 0, 1000); if (sim_info) { @@ -750,9 +747,9 @@ void LLFloaterWorldMap::trackURL(const LLString& region_name, S32 x_coord, S32 y // pass sim name to combo box gFloaterWorldMap->mCompletingRegionName = region_name; - gWorldMap->sendNamedRegionRequest(region_name); + LLWorldMap::getInstance()->sendNamedRegionRequest(region_name); LLString::toLower(gFloaterWorldMap->mCompletingRegionName); - gWorldMap->mIsTrackingCommit = TRUE; + LLWorldMap::getInstance()->mIsTrackingCommit = TRUE; } } @@ -934,7 +931,7 @@ void LLFloaterWorldMap::clearLocationSelection(BOOL clear_ui) { childSetValue("spin z", 0); } - gWorldMap->mIsTrackingCommit = FALSE; + LLWorldMap::getInstance()->mIsTrackingCommit = FALSE; mCompletingRegionName = ""; mExactMatch = FALSE; } @@ -972,8 +969,8 @@ void LLFloaterWorldMap::clearLandmarkSelection(BOOL clear_ui) void LLFloaterWorldMap::adjustZoomSliderBounds() { // World size in regions - S32 world_width_regions = gWorldMap->getWorldWidth() / REGION_WIDTH_UNITS; - S32 world_height_regions = gWorldMap->getWorldHeight() / REGION_WIDTH_UNITS; + S32 world_width_regions = LLWorldMap::getInstance()->getWorldWidth() / REGION_WIDTH_UNITS; + S32 world_height_regions = LLWorldMap::getInstance()->getWorldHeight() / REGION_WIDTH_UNITS; // Pad the world size a little bit, so we have a nice border on // the edge @@ -1130,7 +1127,7 @@ void LLFloaterWorldMap::onLandmarkComboCommit( LLUICtrl* ctrl, void* userdata ) // Reset to user postion if nothing is tracked self->mSetToUserPosition = ( LLTracker::getTrackingStatus() == LLTracker::TRACKING_NOTHING ); } -// + //// static //void LLFloaterWorldMap::onAvatarComboPrearrange( LLUICtrl* ctrl, void* userdata ) //{ @@ -1175,7 +1172,7 @@ void LLFloaterWorldMap::onLandmarkComboCommit( LLUICtrl* ctrl, void* userdata ) // if (new_avatar_id.notNull()) // { // LLString name; -// LLComboBox* combo = LLUICtrlFactory::getComboBoxByName(gFloaterWorldMap, "friend combo"); +// LLComboBox* combo = gFloaterWorldMap->getChild<LLComboBox>("friend combo"); // if (combo) name = combo->getSimple(); // self->trackAvatar(new_avatar_id, name); // onShowTargetBtn(self); @@ -1232,16 +1229,16 @@ void LLFloaterWorldMap::onLocationCommit( void* userdata ) LLString::toLower(str); gFloaterWorldMap->mCompletingRegionName = str; - gWorldMap->mIsTrackingCommit = TRUE; + LLWorldMap::getInstance()->mIsTrackingCommit = TRUE; self->mExactMatch = FALSE; if (str.length() >= 3) { - gWorldMap->sendNamedRegionRequest(str); + LLWorldMap::getInstance()->sendNamedRegionRequest(str); } else { str += "#"; - gWorldMap->sendNamedRegionRequest(str); + LLWorldMap::getInstance()->sendNamedRegionRequest(str); } } @@ -1252,7 +1249,7 @@ void LLFloaterWorldMap::onClearBtn(void* data) LLFloaterWorldMap* self = (LLFloaterWorldMap*)data; self->mTrackedStatus = LLTracker::TRACKING_NOTHING; LLTracker::stopTracking((void *)(intptr_t)TRUE); - gWorldMap->mIsTrackingUnknownLocation = FALSE; + LLWorldMap::getInstance()->mIsTrackingUnknownLocation = FALSE; self->mSLURL = ""; // Clear the SLURL since it's invalid self->mSetToUserPosition = TRUE; // Revert back to the current user position } @@ -1326,9 +1323,9 @@ void LLFloaterWorldMap::centerOnTarget(BOOL animate) pos_global = LLTracker::getTrackedPositionGlobal() - gAgent.getCameraPositionGlobal(); } } - else if(gWorldMap->mIsTrackingUnknownLocation) + else if(LLWorldMap::getInstance()->mIsTrackingUnknownLocation) { - pos_global = gWorldMap->mUnknownLocation - gAgent.getCameraPositionGlobal();; + pos_global = LLWorldMap::getInstance()->mUnknownLocation - gAgent.getCameraPositionGlobal();; } else { @@ -1521,10 +1518,7 @@ void LLFloaterWorldMap::onCommitBackground(void* userdata, bool from_click) // Find my index S32 index = self->mTabs->getCurrentPanelIndex(); - if (gWorldMap) - { - gWorldMap->setCurrentLayer(index); - } + LLWorldMap::getInstance()->setCurrentLayer(index); } void LLFloaterWorldMap::updateSims(bool found_null_sim) @@ -1534,8 +1528,7 @@ void LLFloaterWorldMap::updateSims(bool found_null_sim) return; } - LLScrollListCtrl *list = gUICtrlFactory->getScrollListByName(this, "search_results"); - if (!list) return; + LLScrollListCtrl *list = getChild<LLScrollListCtrl>("search_results"); list->operateOnAll(LLCtrlListInterface::OP_DELETE); LLSD selected_value = list->getSelectedValue(); @@ -1545,7 +1538,7 @@ void LLFloaterWorldMap::updateSims(bool found_null_sim) BOOL match_found = FALSE; S32 num_results = 0; std::map<U64, LLSimInfo*>::const_iterator it; - for (it = gWorldMap->mSimInfoMap.begin(); it != gWorldMap->mSimInfoMap.end(); ++it) + for (it = LLWorldMap::getInstance()->mSimInfoMap.begin(); it != LLWorldMap::getInstance()->mSimInfoMap.end(); ++it) { LLSimInfo* info = (*it).second; LLString sim_name = info->mName; @@ -1554,7 +1547,7 @@ void LLFloaterWorldMap::updateSims(bool found_null_sim) if (sim_name_lower.substr(0, name_length) == mCompletingRegionName) { - if (gWorldMap->mIsTrackingCommit) + if (LLWorldMap::getInstance()->mIsTrackingCommit) { if (sim_name_lower == mCompletingRegionName) { @@ -1633,7 +1626,7 @@ void LLFloaterWorldMap::onCommitSearchResult(LLUICtrl*, void* userdata) LLString::toLower(sim_name); std::map<U64, LLSimInfo*>::const_iterator it; - for (it = gWorldMap->mSimInfoMap.begin(); it != gWorldMap->mSimInfoMap.end(); ++it) + for (it = LLWorldMap::getInstance()->mSimInfoMap.begin(); it != LLWorldMap::getInstance()->mSimInfoMap.end(); ++it) { LLSimInfo* info = (*it).second; LLString info_sim_name = info->mName; diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index 9ec7676195..1739cd5fef 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -58,7 +58,7 @@ #include "llviewerimagelist.h" #include "llviewerjointattachment.h" #include "llviewermenu.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llviewerwindow.h" #include "llvoavatar.h" #include "llfloaterproperties.h" @@ -114,10 +114,11 @@ LLColor4 LLFolderViewItem::sHighlightBgColor; LLColor4 LLFolderViewItem::sHighlightFgColor; LLColor4 LLFolderViewItem::sFilterBGColor; LLColor4 LLFolderViewItem::sFilterTextColor; -LLColor4 LLFolderViewItem::sLoadingMessageTextColor; +LLColor4 LLFolderViewItem::sSuffixColor; +LLColor4 LLFolderViewItem::sSearchStatusColor; // Default constructor -LLFolderViewItem::LLFolderViewItem( const LLString& name, LLViewerImage* icon, +LLFolderViewItem::LLFolderViewItem( const LLString& name, LLUIImagePtr icon, S32 creation_date, LLFolderView* root, LLFolderViewEventListener* listener ) : @@ -145,12 +146,12 @@ LLFolderViewItem::LLFolderViewItem( const LLString& name, LLViewerImage* icon, setIcon(icon); if( !LLFolderViewItem::sFont ) { - LLFolderViewItem::sFont = gResMgr->getRes( LLFONT_SANSSERIF_SMALL ); + LLFolderViewItem::sFont = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF_SMALL ); } if (!LLFolderViewItem::sSmallFont) { - LLFolderViewItem::sSmallFont = gResMgr->getRes( LLFONT_SMALL ); + LLFolderViewItem::sSmallFont = LLResMgr::getInstance()->getRes( LLFONT_SMALL ); } // HACK: Can't be set above because gSavedSettings might not be constructed. @@ -159,10 +160,12 @@ LLFolderViewItem::LLFolderViewItem( const LLString& name, LLViewerImage* icon, LLFolderViewItem::sHighlightFgColor = gColors.getColor( "MenuItemHighlightFgColor" ); LLFolderViewItem::sFilterBGColor = gColors.getColor( "FilterBackgroundColor" ); LLFolderViewItem::sFilterTextColor = gColors.getColor( "FilterTextColor" ); - LLFolderViewItem::sLoadingMessageTextColor = gColors.getColor( "FolderViewLoadingMessageTextColor" ); + LLFolderViewItem::sSuffixColor = gColors.getColor( "InventoryItemSuffixColor" ); + LLFolderViewItem::sSearchStatusColor = gColors.getColor( "InventorySearchStatusColor" ); - mArrowImage = gImageList.getImage(LLUUID(gViewerArt.getString("folder_arrow.tga")), MIPMAP_FALSE, TRUE); - mBoxImage = gImageList.getImage(LLUUID(gViewerArt.getString("rounded_square.tga")), MIPMAP_FALSE, TRUE); + + mArrowImage = LLUI::getUIImage("folder_arrow.tga"); + mBoxImage = LLUI::getUIImage("rounded_square.tga"); refresh(); setTabStop(FALSE); @@ -267,13 +270,9 @@ void LLFolderViewItem::setFiltered(BOOL filtered, S32 filter_generation) mLastFilterGeneration = filter_generation; } -void LLFolderViewItem::setIcon(LLViewerImage* icon) +void LLFolderViewItem::setIcon(LLUIImagePtr icon) { mIcon = icon; - if (mIcon) - { - mIcon->setBoostLevel(LLViewerImage::BOOST_UI); - } } // refresh information from the listener @@ -369,16 +368,6 @@ void LLFolderViewItem::extendSelectionFromRoot(LLFolderViewItem* selection) getRoot()->extendSelection(selection, NULL, selected_items); } -EWidgetType LLFolderViewItem::getWidgetType() const -{ - return WIDGET_TYPE_FOLDER_ITEM; -} - -LLString LLFolderViewItem::getWidgetTag() const -{ - return LL_FOLDER_VIEW_ITEM_TAG; -} - EInventorySortGroup LLFolderViewItem::getSortGroup() { return SG_ITEM; @@ -649,7 +638,7 @@ BOOL LLFolderViewItem::handleMouseDown( S32 x, S32 y, MASK mask ) S32 screen_x; S32 screen_y; localPointToScreen(x, y, &screen_x, &screen_y ); - gToolDragAndDrop->setDragStart( screen_x, screen_y ); + LLToolDragAndDrop::getInstance()->setDragStart( screen_x, screen_y ); } return TRUE; } @@ -662,7 +651,7 @@ BOOL LLFolderViewItem::handleHover( S32 x, S32 y, MASK mask ) S32 screen_y; localPointToScreen(x, y, &screen_x, &screen_y ); BOOL can_drag = TRUE; - if( gToolDragAndDrop->isOverThreshold( screen_x, screen_y ) ) + if( LLToolDragAndDrop::getInstance()->isOverThreshold( screen_x, screen_y ) ) { LLFolderView* root = getRoot(); @@ -694,7 +683,7 @@ BOOL LLFolderViewItem::handleHover( S32 x, S32 y, MASK mask ) // item. gViewerWindow->setKeyboardFocus(NULL); - return gToolDragAndDrop->handleHover( x, y, mask ); + return LLToolDragAndDrop::getInstance()->handleHover( x, y, mask ); } } } @@ -813,7 +802,7 @@ void LLFolderViewItem::draw() if (mArrowImage) { gl_draw_scaled_rotated_image(mIndentation, getRect().getHeight() - ARROW_SIZE - TEXT_PAD, - ARROW_SIZE, ARROW_SIZE, mControlLabelRotation, mArrowImage, sFgColor); + ARROW_SIZE, ARROW_SIZE, mControlLabelRotation, mArrowImage->getImage(), sFgColor); } } @@ -905,8 +894,7 @@ void LLFolderViewItem::draw() if(mIcon) { - gl_draw_image(mIndentation + ARROW_SIZE + TEXT_PAD, getRect().getHeight() - mIcon->getHeight(), mIcon); - mIcon->addTextureStats( (F32)(mIcon->getWidth() * mIcon->getHeight())); + mIcon->draw(mIndentation + ARROW_SIZE + TEXT_PAD, getRect().getHeight() - mIcon->getHeight()); } if (!mLabel.empty()) @@ -934,7 +922,7 @@ void LLFolderViewItem::draw() if ( mIsLoading && mTimeSinceRequestStart.getElapsedTimeF32() >= gSavedSettings.getF32("FolderLoadingMessageWaitTime") ) { - sFont->renderUTF8( "Loading... ", 0, text_left, y, sLoadingMessageTextColor, + sFont->renderUTF8( "Loading... ", 0, text_left, y, sSearchStatusColor, LLFontGL::LEFT, LLFontGL::BOTTOM, mLabelStyle, S32_MAX, S32_MAX, &right_x, FALSE); text_left = right_x; } @@ -944,7 +932,7 @@ void LLFolderViewItem::draw() S32_MAX, S32_MAX, &right_x, FALSE ); if (!mLabelSuffix.empty()) { - sFont->renderUTF8( mLabelSuffix, 0, right_x, y, LLColor4(0.75f, 0.85f, 0.85f, 1.f), + sFont->renderUTF8( mLabelSuffix, 0, right_x, y, sSuffixColor, LLFontGL::LEFT, LLFontGL::BOTTOM, mLabelStyle, S32_MAX, S32_MAX, &right_x, FALSE ); } @@ -961,9 +949,8 @@ void LLFolderViewItem::draw() S32 bottom = llfloor(getRect().getHeight() - sFont->getLineHeight() - 3); S32 top = getRect().getHeight(); - LLViewerImage::bindTexture(mBoxImage); - gGL.color4fv(sFilterBGColor.mV); - gl_segmented_rect_2d_tex(left, top, right, bottom, mBoxImage->getWidth(), mBoxImage->getHeight(), 16); + LLRect box_rect(left, top, right, bottom); + mBoxImage->draw(box_rect, sFilterBGColor); F32 match_string_left = text_left + sFont->getWidthF32(combined_string, 0, mStringMatchOffset); F32 y = (F32)getRect().getHeight() - sFont->getLineHeight() - (F32)TEXT_PAD; sFont->renderUTF8( combined_string, mStringMatchOffset, match_string_left, y, @@ -985,7 +972,7 @@ void LLFolderViewItem::draw() ///---------------------------------------------------------------------------- // Default constructor -LLFolderViewFolder::LLFolderViewFolder( const LLString& name, LLViewerImage* icon, +LLFolderViewFolder::LLFolderViewFolder( const LLString& name, LLUIImagePtr icon, LLFolderView* root, LLFolderViewEventListener* listener ): LLFolderViewItem( name, icon, 0, root, listener ), // 0 = no create time @@ -1019,16 +1006,6 @@ LLFolderViewFolder::~LLFolderViewFolder( void ) //mFolders.removeAllNodes(); } -EWidgetType LLFolderViewFolder::getWidgetType() const -{ - return WIDGET_TYPE_FOLDER; -} - -LLString LLFolderViewFolder::getWidgetTag() const -{ - return LL_FOLDER_VIEW_FOLDER_TAG; -} - // addToFolder() returns TRUE if it succeeds. FALSE otherwise BOOL LLFolderViewFolder::addToFolder(LLFolderViewFolder* folder, LLFolderView* root) { @@ -2098,20 +2075,17 @@ BOOL LLFolderViewFolder::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL LLFolderViewFolder::handleRightMouseDown( S32 x, S32 y, MASK mask ) { BOOL handled = FALSE; - if( getVisible() ) + // fetch contents of this folder, as context menu can depend on contents + // still, user would have to open context menu again to see the changes + gInventory.fetchDescendentsOf(mListener->getUUID()); + + if( mIsOpen ) { - // fetch contents of this folder, as context menu can depend on contents - // still, user would have to open context menu again to see the changes - gInventory.fetchDescendentsOf(mListener->getUUID()); - - if( mIsOpen ) - { - handled = childrenHandleRightMouseDown( x, y, mask ) != NULL; - } - if (!handled) - { - handled = LLFolderViewItem::handleRightMouseDown( x, y, mask ); - } + handled = childrenHandleRightMouseDown( x, y, mask ) != NULL; + } + if (!handled) + { + handled = LLFolderViewItem::handleRightMouseDown( x, y, mask ); } return handled; } @@ -2162,16 +2136,12 @@ BOOL LLFolderViewFolder::handleMouseDown( S32 x, S32 y, MASK mask ) BOOL LLFolderViewFolder::handleDoubleClick( S32 x, S32 y, MASK mask ) { - if (!getVisible()) - { - return FALSE; - } - BOOL rv = false; + BOOL handled = FALSE; if( mIsOpen ) { - rv = childrenHandleDoubleClick( x, y, mask ) != NULL; + handled = childrenHandleDoubleClick( x, y, mask ) != NULL; } - if( !rv ) + if( !handled ) { if(x < LEFT_INDENTATION + mIndentation && x > mIndentation - LEFT_PAD) { @@ -2184,9 +2154,9 @@ BOOL LLFolderViewFolder::handleDoubleClick( S32 x, S32 y, MASK mask ) setSelectionFromRoot(this, FALSE); toggleOpen(); } - return TRUE; + handled = TRUE; } - return rv; + return handled; } void LLFolderViewFolder::draw() @@ -2529,7 +2499,7 @@ void LLCloseAllFoldersFunctor::doItem(LLFolderViewItem* item) ///---------------------------------------------------------------------------- // Default constructor -LLFolderView::LLFolderView( const LLString& name, LLViewerImage* root_folder_icon, +LLFolderView::LLFolderView( const LLString& name, LLUIImagePtr root_folder_icon, const LLRect& rect, const LLUUID& source_id, LLView *parent_view ) : #if LL_WINDOWS #pragma warning( push ) @@ -2584,18 +2554,15 @@ LLFolderView::LLFolderView( const LLString& name, LLViewerImage* root_folder_ico NULL, NULL, this, - &LLLineEditor::prevalidatePrintableNotPipe, - LLViewBorder::BEVEL_NONE, - LLViewBorder::STYLE_LINE, - 2); - mRenamer->setWriteableBgColor(LLColor4::white); + &LLLineEditor::prevalidatePrintableNotPipe); + //mRenamer->setWriteableBgColor(LLColor4::white); // Escape is handled by reverting the rename, not commiting it (default behavior) mRenamer->setCommitOnFocusLost(TRUE); mRenamer->setVisible(FALSE); addChild(mRenamer); // make the popup menu available - LLMenuGL* menu = gUICtrlFactory->buildMenu("menu_inventory.xml", parent_view); + LLMenuGL* menu = LLUICtrlFactory::getInstance()->buildMenu("menu_inventory.xml", parent_view); if (!menu) { menu = new LLMenuGL(""); @@ -2643,16 +2610,6 @@ LLFolderView::~LLFolderView( void ) mItemMap.clear(); } -EWidgetType LLFolderView::getWidgetType() const -{ - return WIDGET_TYPE_FOLDER_VIEW; -} - -LLString LLFolderView::getWidgetTag() const -{ - return LL_FOLDER_VIEW_TAG; -} - BOOL LLFolderView::canFocusChildren() const { return FALSE; @@ -3156,7 +3113,7 @@ BOOL LLFolderView::startDrag(LLToolDragAndDrop::ESource source) cargo_ids.push_back(id); } - gToolDragAndDrop->beginMultiDrag(types, cargo_ids, source, mSourceID); + LLToolDragAndDrop::getInstance()->beginMultiDrag(types, cargo_ids, source, mSourceID); } return can_drag; } @@ -3187,15 +3144,11 @@ void LLFolderView::draw() { closeAutoOpenedFolders(); } - if(gViewerWindow->hasKeyboardFocus(this) && !getVisible()) - { - gViewerWindow->setKeyboardFocus( NULL ); - } // while dragging, update selection rendering to reflect single/multi drag status - if (gToolDragAndDrop->hasMouseCapture()) + if (LLToolDragAndDrop::getInstance()->hasMouseCapture()) { - EAcceptance last_accept = gToolDragAndDrop->getLastAccept(); + EAcceptance last_accept = LLToolDragAndDrop::getInstance()->getLastAccept(); if (last_accept == ACCEPT_YES_SINGLE || last_accept == ACCEPT_YES_COPY_SINGLE) { setShowSingleSelection(TRUE); @@ -3225,12 +3178,12 @@ void LLFolderView::draw() if (gInventory.backgroundFetchActive() || mCompletedFilterGeneration < mFilter.getMinRequiredGeneration()) { mStatusText = "Searching..."; // *TODO:translate - sFont->renderUTF8(mStatusText, 0, 2, 1, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::NORMAL, S32_MAX, S32_MAX, NULL, FALSE ); + sFont->renderUTF8(mStatusText, 0, 2, 1, sSearchStatusColor, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::NORMAL, S32_MAX, S32_MAX, NULL, FALSE ); } else { mStatusText = "No matching items found in inventory."; // *TODO:translate - sFont->renderUTF8(mStatusText, 0, 2, 1, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::NORMAL, S32_MAX, S32_MAX, NULL, FALSE ); + sFont->renderUTF8(mStatusText, 0, 2, 1, sSearchStatusColor, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::NORMAL, S32_MAX, S32_MAX, NULL, FALSE ); } } @@ -3698,7 +3651,7 @@ void LLFolderView::setFocus(BOOL focus) LLFolderViewFolder::setFocus(focus); } -BOOL LLFolderView::handleKeyHere( KEY key, MASK mask, BOOL called_from_parent ) +BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) { BOOL handled = FALSE; @@ -3716,202 +3669,199 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask, BOOL called_from_parent ) item = *(getChildList()->begin()); } - if( getVisible() && getEnabled() && !called_from_parent ) + switch( key ) { - switch( key ) - { - case KEY_F2: - mSearchString.clear(); - startRenamingSelectedItem(); - handled = TRUE; - break; - - case KEY_RETURN: - if (mask == MASK_NONE) - { - if( mRenameItem && mRenamer->getVisible() ) - { - finishRenamingItem(); - mSearchString.clear(); - handled = TRUE; - } - else - { - LLFolderView::openSelectedItems(); - handled = TRUE; - } - } - break; + case KEY_F2: + mSearchString.clear(); + startRenamingSelectedItem(); + handled = TRUE; + break; - case KEY_ESCAPE: - // mark flag don't commit + case KEY_RETURN: + if (mask == MASK_NONE) + { if( mRenameItem && mRenamer->getVisible() ) { - revertRenamingItem(); + finishRenamingItem(); + mSearchString.clear(); handled = TRUE; } else { - if( gViewerWindow->childHasKeyboardFocus( this ) ) - { - gViewerWindow->setKeyboardFocus( NULL ); - } + LLFolderView::openSelectedItems(); + handled = TRUE; } - mSearchString.clear(); - break; + } + break; - case KEY_PAGE_UP: - mSearchString.clear(); - mScrollContainer->pageUp(30); + case KEY_ESCAPE: + // mark flag don't commit + if( mRenameItem && mRenamer->getVisible() ) + { + revertRenamingItem(); handled = TRUE; - break; + } + else + { + if( gViewerWindow->childHasKeyboardFocus( this ) ) + { + gViewerWindow->setKeyboardFocus( NULL ); + } + } + mSearchString.clear(); + break; - case KEY_PAGE_DOWN: - mSearchString.clear(); - mScrollContainer->pageDown(30); - handled = TRUE; - break; + case KEY_PAGE_UP: + mSearchString.clear(); + mScrollContainer->pageUp(30); + handled = TRUE; + break; - case KEY_HOME: - mSearchString.clear(); - mScrollContainer->goToTop(); - handled = TRUE; - break; + case KEY_PAGE_DOWN: + mSearchString.clear(); + mScrollContainer->pageDown(30); + handled = TRUE; + break; - case KEY_END: - mSearchString.clear(); - mScrollContainer->goToBottom(); - break; + case KEY_HOME: + mSearchString.clear(); + mScrollContainer->goToTop(); + handled = TRUE; + break; - case KEY_DOWN: - if((mSelectedItems.size() > 0) && mScrollContainer) - { - LLFolderViewItem* last_selected = getCurSelectedItem(); + case KEY_END: + mSearchString.clear(); + mScrollContainer->goToBottom(); + break; - if (!mKeyboardSelection) - { - setSelection(last_selected, FALSE, TRUE); - mKeyboardSelection = TRUE; - } + case KEY_DOWN: + if((mSelectedItems.size() > 0) && mScrollContainer) + { + LLFolderViewItem* last_selected = getCurSelectedItem(); - LLFolderViewItem* next = NULL; - if (mask & MASK_SHIFT) + if (!mKeyboardSelection) + { + setSelection(last_selected, FALSE, TRUE); + mKeyboardSelection = TRUE; + } + + LLFolderViewItem* next = NULL; + if (mask & MASK_SHIFT) + { + // don't shift select down to children of folders (they are implicitly selected through parent) + next = last_selected->getNextOpenNode(FALSE); + if (next) { - // don't shift select down to children of folders (they are implicitly selected through parent) - next = last_selected->getNextOpenNode(FALSE); - if (next) + if (next->isSelected()) { - if (next->isSelected()) - { - // shrink selection - changeSelectionFromRoot(last_selected, FALSE); - } - else if (last_selected->getParentFolder() == next->getParentFolder()) - { - // grow selection - changeSelectionFromRoot(next, TRUE); - } + // shrink selection + changeSelectionFromRoot(last_selected, FALSE); + } + else if (last_selected->getParentFolder() == next->getParentFolder()) + { + // grow selection + changeSelectionFromRoot(next, TRUE); } } - else + } + else + { + next = last_selected->getNextOpenNode(); + if( next ) { - next = last_selected->getNextOpenNode(); - if( next ) + if (next == last_selected) { - if (next == last_selected) - { - return FALSE; - } - setSelection( next, FALSE, TRUE ); + return FALSE; } + setSelection( next, FALSE, TRUE ); } - scrollToShowSelection(); - mSearchString.clear(); - handled = TRUE; } - break; + scrollToShowSelection(); + mSearchString.clear(); + handled = TRUE; + } + break; - case KEY_UP: - if((mSelectedItems.size() > 0) && mScrollContainer) - { - LLFolderViewItem* last_selected = mSelectedItems.back(); + case KEY_UP: + if((mSelectedItems.size() > 0) && mScrollContainer) + { + LLFolderViewItem* last_selected = mSelectedItems.back(); - if (!mKeyboardSelection) - { - setSelection(last_selected, FALSE, TRUE); - mKeyboardSelection = TRUE; - } + if (!mKeyboardSelection) + { + setSelection(last_selected, FALSE, TRUE); + mKeyboardSelection = TRUE; + } - LLFolderViewItem* prev = NULL; - if (mask & MASK_SHIFT) + LLFolderViewItem* prev = NULL; + if (mask & MASK_SHIFT) + { + // don't shift select down to children of folders (they are implicitly selected through parent) + prev = last_selected->getPreviousOpenNode(FALSE); + if (prev) { - // don't shift select down to children of folders (they are implicitly selected through parent) - prev = last_selected->getPreviousOpenNode(FALSE); - if (prev) + if (prev->isSelected()) { - if (prev->isSelected()) - { - // shrink selection - changeSelectionFromRoot(last_selected, FALSE); - } - else if (last_selected->getParentFolder() == prev->getParentFolder()) - { - // grow selection - changeSelectionFromRoot(prev, TRUE); - } + // shrink selection + changeSelectionFromRoot(last_selected, FALSE); + } + else if (last_selected->getParentFolder() == prev->getParentFolder()) + { + // grow selection + changeSelectionFromRoot(prev, TRUE); } } - else + } + else + { + prev = last_selected->getPreviousOpenNode(); + if( prev ) { - prev = last_selected->getPreviousOpenNode(); - if( prev ) + if (prev == this) { - if (prev == this) - { - return FALSE; - } - setSelection( prev, FALSE, TRUE ); + return FALSE; } + setSelection( prev, FALSE, TRUE ); } - scrollToShowSelection(); - mSearchString.clear(); - - handled = TRUE; } - break; + scrollToShowSelection(); + mSearchString.clear(); + + handled = TRUE; + } + break; + + case KEY_RIGHT: + if(mSelectedItems.size()) + { + LLFolderViewItem* last_selected = getCurSelectedItem(); + last_selected->setOpen( TRUE ); + mSearchString.clear(); + handled = TRUE; + } + break; - case KEY_RIGHT: - if(mSelectedItems.size()) + case KEY_LEFT: + if(mSelectedItems.size()) + { + LLFolderViewItem* last_selected = getCurSelectedItem(); + LLFolderViewItem* parent_folder = last_selected->getParentFolder(); + if (!last_selected->isOpen() && parent_folder && parent_folder->getParentFolder()) { - LLFolderViewItem* last_selected = getCurSelectedItem(); - last_selected->setOpen( TRUE ); - mSearchString.clear(); - handled = TRUE; + setSelection(parent_folder, FALSE, TRUE); } - break; - - case KEY_LEFT: - if(mSelectedItems.size()) + else { - LLFolderViewItem* last_selected = getCurSelectedItem(); - LLFolderViewItem* parent_folder = last_selected->getParentFolder(); - if (!last_selected->isOpen() && parent_folder && parent_folder->getParentFolder()) - { - setSelection(parent_folder, FALSE, TRUE); - } - else - { - last_selected->setOpen( FALSE ); - } - mSearchString.clear(); - scrollToShowSelection(); - handled = TRUE; + last_selected->setOpen( FALSE ); } - break; + mSearchString.clear(); + scrollToShowSelection(); + handled = TRUE; } + break; } - if (!handled && gFocusMgr.childHasKeyboardFocus(getRoot())) + if (!handled && hasFocus()) { if (key == KEY_BACKSPACE) { @@ -3929,7 +3879,7 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask, BOOL called_from_parent ) } -BOOL LLFolderView::handleUnicodeCharHere(llwchar uni_char, BOOL called_from_parent) +BOOL LLFolderView::handleUnicodeCharHere(llwchar uni_char) { if ((uni_char < 0x20) || (uni_char == 0x7F)) // Control character or DEL { @@ -4082,11 +4032,7 @@ BOOL LLFolderView::search(LLFolderViewItem* first_item, const LLString &search_s BOOL LLFolderView::handleDoubleClick( S32 x, S32 y, MASK mask ) { - if (!getVisible()) - { - return FALSE; - } - + // skip LLFolderViewFolder::handleDoubleClick() return LLView::handleDoubleClick( x, y, mask ); } diff --git a/indra/newview/llfolderview.h b/indra/newview/llfolderview.h index d451e75fa6..28c2268952 100644 --- a/indra/newview/llfolderview.h +++ b/indra/newview/llfolderview.h @@ -81,7 +81,7 @@ public: virtual const LLUUID& getUUID() const = 0; virtual U32 getCreationDate() const = 0; // UTC seconds virtual PermissionMask getPermissionMask() const = 0; - virtual LLViewerImage* getIcon() const = 0; + virtual LLUIImagePtr getIcon() const = 0; virtual LLFontGL::StyleFlags getLabelStyle() const = 0; virtual LLString getLabelSuffix() const = 0; virtual void openItem( void ) = 0; @@ -323,7 +323,8 @@ protected: static LLColor4 sHighlightFgColor; static LLColor4 sFilterBGColor; static LLColor4 sFilterTextColor; - static LLColor4 sLoadingMessageTextColor; + static LLColor4 sSuffixColor; + static LLColor4 sSearchStatusColor; LLString mLabel; LLString mSearchableLabel; @@ -337,7 +338,7 @@ protected: BOOL mSelectPending; LLFontGL::StyleFlags mLabelStyle; LLString mLabelSuffix; - LLPointer<LLViewerImage> mIcon; + LLUIImagePtr mIcon; LLString mStatusText; BOOL mHasVisibleChildren; S32 mIndentation; @@ -348,8 +349,8 @@ protected: F32 mControlLabelRotation; LLFolderView* mRoot; BOOL mDragAndDropTarget; - LLPointer<LLViewerImage> mArrowImage; - LLPointer<LLViewerImage> mBoxImage; + LLUIImagePtr mArrowImage; + LLUIImagePtr mBoxImage; BOOL mIsLoading; LLTimer mTimeSinceRequestStart; @@ -379,12 +380,9 @@ public: void filterFromRoot( void ); // creation_date is in UTC seconds - LLFolderViewItem( const LLString& name, LLViewerImage* icon, S32 creation_date, LLFolderView* root, LLFolderViewEventListener* listener ); + LLFolderViewItem( const LLString& name, LLUIImagePtr icon, S32 creation_date, LLFolderView* root, LLFolderViewEventListener* listener ); virtual ~LLFolderViewItem( void ); - virtual EWidgetType getWidgetType() const; - virtual LLString getWidgetTag() const; - // addToFolder() returns TRUE if it succeeds. FALSE otherwise enum { ARRANGE = TRUE, DO_NOT_ARRANGE = FALSE }; virtual BOOL addToFolder(LLFolderViewFolder* folder, LLFolderView* root); @@ -497,7 +495,7 @@ public: virtual void setFiltered(BOOL filtered, S32 filter_generation); // change the icon - void setIcon(LLViewerImage* icon); + void setIcon(LLUIImagePtr icon); // refresh information from the object being viewed. virtual void refresh(); @@ -569,14 +567,11 @@ public: RECURSE_UP_DOWN } ERecurseType; - LLFolderViewFolder( const LLString& name, LLViewerImage* icon, + LLFolderViewFolder( const LLString& name, LLUIImagePtr icon, LLFolderView* root, LLFolderViewEventListener* listener ); virtual ~LLFolderViewFolder( void ); - virtual EWidgetType getWidgetType() const; - virtual LLString getWidgetTag() const; - virtual BOOL potentiallyVisible(); LLFolderViewItem* getNextFromChild( LLFolderViewItem*, BOOL include_children = TRUE ); @@ -726,12 +721,10 @@ public: static F32 sAutoOpenTime; - LLFolderView( const LLString& name, LLViewerImage* root_folder_icon, const LLRect& rect, + LLFolderView( const LLString& name, LLUIImagePtr root_folder_icon, const LLRect& rect, const LLUUID& source_id, LLView *parent_view ); virtual ~LLFolderView( void ); - virtual EWidgetType getWidgetType() const; - virtual LLString getWidgetTag() const; virtual BOOL canFocusChildren() const; // FolderViews default to sort by name. This will change that, @@ -833,8 +826,8 @@ public: // LLView functionality ///*virtual*/ BOOL handleKey( KEY key, MASK mask, BOOL called_from_parent ); - /*virtual*/ BOOL handleKeyHere( KEY key, MASK mask, BOOL called_from_parent ); - /*virtual*/ BOOL handleUnicodeCharHere(llwchar uni_char, BOOL called_from_parent); + /*virtual*/ BOOL handleKeyHere( KEY key, MASK mask ); + /*virtual*/ BOOL handleUnicodeCharHere(llwchar uni_char); /*virtual*/ BOOL handleMouseDown( S32 x, S32 y, MASK mask ); /*virtual*/ BOOL handleDoubleClick( S32 x, S32 y, MASK mask ); /*virtual*/ BOOL handleRightMouseDown( S32 x, S32 y, MASK mask ); diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp index 51e28047f5..adafd8e4c2 100644 --- a/indra/newview/llgesturemgr.cpp +++ b/indra/newview/llgesturemgr.cpp @@ -1002,10 +1002,7 @@ void LLGestureManager::onLoadComplete(LLVFS *vfs, } else { - if( gViewerStats ) - { - gViewerStats->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); - } + LLViewerStats::getInstance()->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status || LL_ERR_FILE_EMPTY == status) diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp index 6459cd5033..a29136214c 100644 --- a/indra/newview/llglsandbox.cpp +++ b/indra/newview/llglsandbox.cpp @@ -86,7 +86,7 @@ BOOL LLAgent::setLookAt(ELookAtType target_type, LLViewerObject *object, LLVecto } if(!mLookAt || mLookAt->isDead()) { - mLookAt = (LLHUDEffectLookAt *)gHUDManager->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_LOOKAT); + mLookAt = (LLHUDEffectLookAt *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_LOOKAT); mLookAt->setSourceObject(mAvatarObject); } @@ -103,7 +103,7 @@ BOOL LLAgent::setPointAt(EPointAtType target_type, LLViewerObject *object, LLVec if(!mPointAt || mPointAt->isDead()) { - mPointAt = (LLHUDEffectPointAt *)gHUDManager->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINTAT); + mPointAt = (LLHUDEffectPointAt *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINTAT); mPointAt->setSourceObject(mAvatarObject); } @@ -181,8 +181,8 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask) top = llround((F32) top * LLUI::sGLScaleFactor.mV[VY]); bottom = llround((F32) bottom * LLUI::sGLScaleFactor.mV[VY]); - F32 old_far_plane = gCamera->getFar(); - F32 old_near_plane = gCamera->getNear(); + F32 old_far_plane = LLViewerCamera::getInstance()->getFar(); + F32 old_near_plane = LLViewerCamera::getInstance()->getNear(); S32 width = right - left + 1; S32 height = top - bottom + 1; @@ -220,17 +220,17 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask) { // ...select distance from control LLVector3 relative_av_pos = av_pos; - relative_av_pos -= gCamera->getOrigin(); + relative_av_pos -= LLViewerCamera::getInstance()->getOrigin(); - F32 new_far = relative_av_pos * gCamera->getAtAxis() + gSavedSettings.getF32("MaxSelectDistance"); - F32 new_near = relative_av_pos * gCamera->getAtAxis() - gSavedSettings.getF32("MaxSelectDistance"); + F32 new_far = relative_av_pos * LLViewerCamera::getInstance()->getAtAxis() + gSavedSettings.getF32("MaxSelectDistance"); + F32 new_near = relative_av_pos * LLViewerCamera::getInstance()->getAtAxis() - gSavedSettings.getF32("MaxSelectDistance"); new_near = llmax(new_near, 0.1f); - gCamera->setFar(new_far); - gCamera->setNear(new_near); + LLViewerCamera::getInstance()->setFar(new_far); + LLViewerCamera::getInstance()->setNear(new_near); } - gCamera->setPerspective(FOR_SELECTION, + LLViewerCamera::getInstance()->setPerspective(FOR_SELECTION, center_x-width/2, center_y-height/2, width, height, limit_select_distance); @@ -245,17 +245,17 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask) { return true; } - S32 result = gCamera->sphereInFrustum(drawable->getPositionAgent(), drawable->getRadius()); + S32 result = LLViewerCamera::getInstance()->sphereInFrustum(drawable->getPositionAgent(), drawable->getRadius()); switch (result) { case 0: - gSelectMgr->unhighlightObjectOnly(vobjp); + LLSelectMgr::getInstance()->unhighlightObjectOnly(vobjp); break; case 1: // check vertices - if (!gCamera->areVertsVisible(vobjp, LLSelectMgr::sRectSelectInclusive)) + if (!LLViewerCamera::getInstance()->areVertsVisible(vobjp, LLSelectMgr::sRectSelectInclusive)) { - gSelectMgr->unhighlightObjectOnly(vobjp); + LLSelectMgr::getInstance()->unhighlightObjectOnly(vobjp); } break; default: @@ -264,15 +264,15 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask) return true; } } func; - gSelectMgr->getHighlightedObjects()->applyToObjects(&func); + LLSelectMgr::getInstance()->getHighlightedObjects()->applyToObjects(&func); } if (grow_selection) { std::vector<LLDrawable*> potentials; - for (LLWorld::region_list_t::iterator iter = gWorldp->getRegionList().begin(); - iter != gWorldp->getRegionList().end(); ++iter) + for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->getRegionList().begin(); + iter != LLWorld::getInstance()->getRegionList().end(); ++iter) { LLViewerRegion* region = *iter; for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++) @@ -280,7 +280,7 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask) LLSpatialPartition* part = region->getSpatialPartition(i); if (part) { - part->cull(*gCamera, &potentials, TRUE); + part->cull(*LLViewerCamera::getInstance(), &potentials, TRUE); } } } @@ -304,20 +304,20 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask) continue; } - S32 result = gCamera->sphereInFrustum(drawable->getPositionAgent(), drawable->getRadius()); + S32 result = LLViewerCamera::getInstance()->sphereInFrustum(drawable->getPositionAgent(), drawable->getRadius()); if (result) { switch (result) { case 1: // check vertices - if (gCamera->areVertsVisible(vobjp, LLSelectMgr::sRectSelectInclusive)) + if (LLViewerCamera::getInstance()->areVertsVisible(vobjp, LLSelectMgr::sRectSelectInclusive)) { - gSelectMgr->highlightObjectOnly(vobjp); + LLSelectMgr::getInstance()->highlightObjectOnly(vobjp); } break; case 2: - gSelectMgr->highlightObjectOnly(vobjp); + LLSelectMgr::getInstance()->highlightObjectOnly(vobjp); break; default: break; @@ -332,8 +332,8 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask) glMatrixMode(GL_MODELVIEW); // restore camera - gCamera->setFar(old_far_plane); - gCamera->setNear(old_near_plane); + LLViewerCamera::getInstance()->setFar(old_far_plane); + LLViewerCamera::getInstance()->setNear(old_near_plane); gViewerWindow->setup3DRender(); } @@ -343,10 +343,6 @@ static const F32 COMPASS_RANGE = 0.33f; void LLCompass::draw() { -// S32 left, top, right, bottom; - - if (!getVisible()) return; - glMatrixMode(GL_MODELVIEW); gGL.pushMatrix(); @@ -413,8 +409,6 @@ void LLCompass::draw() void LLHorizontalCompass::draw() { - if (!getVisible()) return; - LLGLSUIDefault gls_ui; S32 width = getRect().getWidth(); @@ -423,7 +417,7 @@ void LLHorizontalCompass::draw() if( mTexture ) { - const LLVector3& at_axis = gCamera->getAtAxis(); + const LLVector3& at_axis = LLViewerCamera::getInstance()->getAtAxis(); F32 center = atan2( at_axis.mV[VX], at_axis.mV[VY] ); center += F_PI; @@ -469,7 +463,7 @@ void LLWind::renderVectors() S32 i,j; F32 x,y; - F32 region_width_meters = gWorldPointer->getRegionWidthInMeters(); + F32 region_width_meters = LLWorld::getInstance()->getRegionWidthInMeters(); LLGLSNoTexture gls_no_texture; gGL.pushMatrix(); @@ -524,10 +518,10 @@ void LLViewerParcelMgr::renderRect(const LLVector3d &west_south_bottom_global, // resolves correctly so we can get a height value. const F32 FUDGE = 0.01f; - F32 sw_bottom = gWorldp->resolveLandHeightAgent( LLVector3( west, south, 0.f ) ); - F32 se_bottom = gWorldp->resolveLandHeightAgent( LLVector3( east-FUDGE, south, 0.f ) ); - F32 ne_bottom = gWorldp->resolveLandHeightAgent( LLVector3( east-FUDGE, north-FUDGE, 0.f ) ); - F32 nw_bottom = gWorldp->resolveLandHeightAgent( LLVector3( west, north-FUDGE, 0.f ) ); + F32 sw_bottom = LLWorld::getInstance()->resolveLandHeightAgent( LLVector3( west, south, 0.f ) ); + F32 se_bottom = LLWorld::getInstance()->resolveLandHeightAgent( LLVector3( east-FUDGE, south, 0.f ) ); + F32 ne_bottom = LLWorld::getInstance()->resolveLandHeightAgent( LLVector3( east-FUDGE, north-FUDGE, 0.f ) ); + F32 nw_bottom = LLWorld::getInstance()->resolveLandHeightAgent( LLVector3( west, north-FUDGE, 0.f ) ); F32 sw_top = sw_bottom + PARCEL_POST_HEIGHT; F32 se_top = se_bottom + PARCEL_POST_HEIGHT; @@ -601,10 +595,10 @@ void LLViewerParcelMgr::renderParcel(LLParcel* parcel ) // resolves correctly so we can get a height value. const F32 FUDGE = 0.01f; - F32 sw_bottom = gWorldp->resolveLandHeightAgent( LLVector3( west, south, 0.f ) ); - F32 se_bottom = gWorldp->resolveLandHeightAgent( LLVector3( east-FUDGE, south, 0.f ) ); - F32 ne_bottom = gWorldp->resolveLandHeightAgent( LLVector3( east-FUDGE, north-FUDGE, 0.f ) ); - F32 nw_bottom = gWorldp->resolveLandHeightAgent( LLVector3( west, north-FUDGE, 0.f ) ); + F32 sw_bottom = LLWorld::getInstance()->resolveLandHeightAgent( LLVector3( west, south, 0.f ) ); + F32 se_bottom = LLWorld::getInstance()->resolveLandHeightAgent( LLVector3( east-FUDGE, south, 0.f ) ); + F32 ne_bottom = LLWorld::getInstance()->resolveLandHeightAgent( LLVector3( east-FUDGE, north-FUDGE, 0.f ) ); + F32 nw_bottom = LLWorld::getInstance()->resolveLandHeightAgent( LLVector3( west, north-FUDGE, 0.f ) ); // little hack to make nearby lines not Z-fight east -= 0.1f; @@ -856,11 +850,11 @@ void LLViewerParcelMgr::renderCollisionSegments(U8* segments, BOOL use_pass, LLV if (use_pass && (mCollisionBanned == BA_NOT_ON_LIST)) { - LLViewerImage::bindTexture( getPassImage() ); + LLViewerImage::bindTexture(mPassImage); } else { - LLViewerImage::bindTexture( getBlockedImage() ); + LLViewerImage::bindTexture(mBlockedImage); } gGL.begin(GL_QUADS); @@ -1013,7 +1007,7 @@ void LLViewerObjectList::renderObjectBeacons() } S32 i; - //const LLFontGL *font = gResMgr->getRes(LLFONT_SANSSERIF); + //const LLFontGL *font = LLResMgr::getInstance()->getRes(LLFONT_SANSSERIF); LLGLSUIDefault gls_ui; diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp index bb6abcd95b..542274b295 100644 --- a/indra/newview/llgroupmgr.cpp +++ b/indra/newview/llgroupmgr.cpp @@ -53,8 +53,6 @@ #include "llfloatergroupinfo.h" #include "lluictrlfactory.h" -LLGroupMgr sGroupMgr; // use local instance so that it gets cleaned up on application exit -LLGroupMgr* gGroupMgr = &sGroupMgr; const U32 MAX_CACHED_GROUPS = 10; @@ -705,7 +703,7 @@ void LLGroupMgrGroupData::sendRoleChanges() // If we create a new role, then we need to re-fetch all the role data. if (need_role_data) { - gGroupMgr->sendGroupRoleDataRequest(getID()); + LLGroupMgr::getInstance()->sendGroupRoleDataRequest(getID()); } // Clean up change lists @@ -811,7 +809,7 @@ void LLGroupMgr::processGroupMembersReply(LLMessageSystem* msg, void** data) LLUUID request_id; msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_RequestID, request_id); - LLGroupMgrGroupData* group_datap = gGroupMgr->createGroupData(group_id); + LLGroupMgrGroupData* group_datap = LLGroupMgr::getInstance()->createGroupData(group_id); if (group_datap->mMemberRequestID != request_id) { llwarns << "processGroupMembersReply: Received incorrect (stale?) request id" << llendl; @@ -867,7 +865,7 @@ void LLGroupMgr::processGroupMembersReply(LLMessageSystem* msg, void** data) //if group members are loaded while titles are missing, load the titles. if(group_datap->mTitles.size() < 1) { - gGroupMgr->sendGroupTitlesRequest(group_id); + LLGroupMgr::getInstance()->sendGroupTitlesRequest(group_id); } } @@ -879,12 +877,12 @@ void LLGroupMgr::processGroupMembersReply(LLMessageSystem* msg, void** data) if (group_datap->mPendingRoleMemberRequest) { group_datap->mPendingRoleMemberRequest = FALSE; - gGroupMgr->sendGroupRoleMembersRequest(group_datap->mID); + LLGroupMgr::getInstance()->sendGroupRoleMembersRequest(group_datap->mID); } } group_datap->mChanged = TRUE; - gGroupMgr->notifyObservers(GC_MEMBER_DATA); + LLGroupMgr::getInstance()->notifyObservers(GC_MEMBER_DATA); } //static @@ -933,7 +931,7 @@ void LLGroupMgr::processGroupPropertiesReply(LLMessageSystem* msg, void** data) msg->getBOOL("GroupData", "MaturePublish", mature); msg->getUUID(_PREHASH_GroupData, "OwnerRole", owner_role); - LLGroupMgrGroupData* group_datap = gGroupMgr->createGroupData(group_id); + LLGroupMgrGroupData* group_datap = LLGroupMgr::getInstance()->createGroupData(group_id); group_datap->mName = name; group_datap->mCharter = charter; @@ -951,7 +949,7 @@ void LLGroupMgr::processGroupPropertiesReply(LLMessageSystem* msg, void** data) group_datap->mGroupPropertiesDataComplete = TRUE; group_datap->mChanged = TRUE; - gGroupMgr->notifyObservers(GC_PROPERTIES); + LLGroupMgr::getInstance()->notifyObservers(GC_PROPERTIES); } // static @@ -972,7 +970,7 @@ void LLGroupMgr::processGroupRoleDataReply(LLMessageSystem* msg, void** data) LLUUID request_id; msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_RequestID, request_id); - LLGroupMgrGroupData* group_data = gGroupMgr->createGroupData(group_id); + LLGroupMgrGroupData* group_data = LLGroupMgr::getInstance()->createGroupData(group_id); if (group_data->mRoleDataRequestID != request_id) { llwarns << "processGroupRoleDataReply: Received incorrect (stale?) request id" << llendl; @@ -1013,12 +1011,12 @@ void LLGroupMgr::processGroupRoleDataReply(LLMessageSystem* msg, void** data) if (group_data->mPendingRoleMemberRequest) { group_data->mPendingRoleMemberRequest = FALSE; - gGroupMgr->sendGroupRoleMembersRequest(group_data->mID); + LLGroupMgr::getInstance()->sendGroupRoleMembersRequest(group_data->mID); } } group_data->mChanged = TRUE; - gGroupMgr->notifyObservers(GC_ROLE_DATA); + LLGroupMgr::getInstance()->notifyObservers(GC_ROLE_DATA); } // static @@ -1042,7 +1040,7 @@ void LLGroupMgr::processGroupRoleMembersReply(LLMessageSystem* msg, void** data) U32 total_pairs; msg->getU32(_PREHASH_AgentData, "TotalPairs", total_pairs); - LLGroupMgrGroupData* group_data = gGroupMgr->createGroupData(group_id); + LLGroupMgrGroupData* group_data = LLGroupMgr::getInstance()->createGroupData(group_id); if (group_data->mRoleMembersRequestID != request_id) { @@ -1127,7 +1125,7 @@ void LLGroupMgr::processGroupRoleMembersReply(LLMessageSystem* msg, void** data) } group_data->mChanged = TRUE; - gGroupMgr->notifyObservers(GC_ROLE_MEMBER_DATA); + LLGroupMgr::getInstance()->notifyObservers(GC_ROLE_MEMBER_DATA); } // static @@ -1145,7 +1143,7 @@ void LLGroupMgr::processGroupTitlesReply(LLMessageSystem* msg, void** data) LLUUID group_id; msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_GroupID, group_id ); - LLGroupMgrGroupData* group_data = gGroupMgr->createGroupData(group_id); + LLGroupMgrGroupData* group_data = LLGroupMgr::getInstance()->createGroupData(group_id); LLUUID request_id; msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_RequestID, request_id); @@ -1177,7 +1175,7 @@ void LLGroupMgr::processGroupTitlesReply(LLMessageSystem* msg, void** data) } group_data->mChanged = TRUE; - gGroupMgr->notifyObservers(GC_TITLES); + LLGroupMgr::getInstance()->notifyObservers(GC_TITLES); } // static @@ -1210,7 +1208,7 @@ void LLGroupMgr::processJoinGroupReply(LLMessageSystem* msg, void ** data) // refresh all group information gAgent.sendAgentDataUpdateRequest(); - gGroupMgr->clearGroupData(group_id); + LLGroupMgr::getInstance()->clearGroupData(group_id); // refresh the floater for this group, if any. LLFloaterGroupInfo::refreshGroup(group_id); // refresh the group panel of the search window, if necessary. @@ -1232,7 +1230,7 @@ void LLGroupMgr::processLeaveGroupReply(LLMessageSystem* msg, void ** data) // refresh all group information gAgent.sendAgentDataUpdateRequest(); - gGroupMgr->clearGroupData(group_id); + LLGroupMgr::getInstance()->clearGroupData(group_id); // close the floater for this group, if any. LLFloaterGroupInfo::closeGroup(group_id); // refresh the group panel of the search window, if necessary. @@ -1286,11 +1284,11 @@ LLGroupMgrGroupData* LLGroupMgr::createGroupData(const LLUUID& id) { LLGroupMgrGroupData* group_datap; - group_map_t::iterator existing_group = gGroupMgr->mGroups.find(id); - if (existing_group == gGroupMgr->mGroups.end()) + group_map_t::iterator existing_group = LLGroupMgr::getInstance()->mGroups.find(id); + if (existing_group == LLGroupMgr::getInstance()->mGroups.end()) { group_datap = new LLGroupMgrGroupData(id); - gGroupMgr->addGroup(group_datap); + LLGroupMgr::getInstance()->addGroup(group_datap); } else { @@ -1647,7 +1645,7 @@ void LLGroupMgr::sendGroupMemberEjects(const LLUUID& group_id, bool start_message = true; LLMessageSystem* msg = gMessageSystem; - LLGroupMgrGroupData* group_datap = gGroupMgr->getGroupData(group_id); + LLGroupMgrGroupData* group_datap = LLGroupMgr::getInstance()->getGroupData(group_id); if (!group_datap) return; for (std::vector<LLUUID>::iterator it = member_ids.begin(); @@ -1832,7 +1830,7 @@ bool LLGroupMgr::parseRoleActions(const LLString& xml_filename) role_action_data->mPowerBit = set_power_mask; role_action_set->mActionSetData = role_action_data; - gGroupMgr->mRoleActionSets.push_back(role_action_set); + LLGroupMgr::getInstance()->mRoleActionSets.push_back(role_action_set); } return true; } @@ -1840,7 +1838,7 @@ bool LLGroupMgr::parseRoleActions(const LLString& xml_filename) // static void LLGroupMgr::debugClearAllGroups(void*) { - gGroupMgr->clearGroups(); + LLGroupMgr::getInstance()->clearGroups(); LLGroupMgr::parseRoleActions("role_actions.xml"); } diff --git a/indra/newview/llgroupmgr.h b/indra/newview/llgroupmgr.h index ee848ec16d..2cab236954 100644 --- a/indra/newview/llgroupmgr.h +++ b/indra/newview/llgroupmgr.h @@ -295,7 +295,7 @@ struct LLRoleActionSet std::vector<LLRoleAction*> mActions; }; -class LLGroupMgr +class LLGroupMgr : public LLSingleton<LLGroupMgr> { LOG_CLASS(LLGroupMgr); @@ -350,19 +350,18 @@ public: static void debugClearAllGroups(void*); void clearGroups(); void clearGroupData(const LLUUID& group_id); -protected: + +private: void notifyObservers(LLGroupChange gc); void addGroup(LLGroupMgrGroupData* group_datap); LLGroupMgrGroupData* createGroupData(const LLUUID &id); -protected: typedef std::multimap<LLUUID,LLGroupMgrObserver*> observer_multimap_t; observer_multimap_t mObservers; typedef std::map<LLUUID, LLGroupMgrGroupData*> group_map_t; group_map_t mGroups; }; -extern LLGroupMgr* gGroupMgr; #endif diff --git a/indra/newview/llhudeffectbeam.cpp b/indra/newview/llhudeffectbeam.cpp index 236fdaf70f..613a234ba5 100644 --- a/indra/newview/llhudeffectbeam.cpp +++ b/indra/newview/llhudeffectbeam.cpp @@ -274,7 +274,7 @@ void LLHUDEffectBeam::render() // Init the color of the particles LLColor4U coloru = mColor; - + // Draw the particles S32 i; for (i = 0; i < NUM_POINTS; i++) diff --git a/indra/newview/llhudeffecttrail.cpp b/indra/newview/llhudeffecttrail.cpp index da734d6104..30d753dd81 100644 --- a/indra/newview/llhudeffecttrail.cpp +++ b/indra/newview/llhudeffecttrail.cpp @@ -196,7 +196,7 @@ void LLHUDEffectSpiral::triggerLocal() psb->setSourceObject(mSourceObject); psb->setTargetObject(mTargetObject); psb->setOwnerUUID(gAgent.getID()); - gWorldPointer->mPartSim.addPartSource(psb); + LLViewerPartSim::getInstance()->addPartSource(psb); mPartSourcep = psb; } } @@ -212,7 +212,7 @@ void LLHUDEffectSpiral::triggerLocal() psb->setColor(color); psb->mLKGTargetPosGlobal = mPositionGlobal; psb->setOwnerUUID(gAgent.getID()); - gWorldPointer->mPartSim.addPartSource(psb); + LLViewerPartSim::getInstance()->addPartSource(psb); mPartSourcep = psb; } } @@ -234,7 +234,7 @@ void LLHUDEffectSpiral::triggerLocal() } pss->setColor(color); pss->setOwnerUUID(gAgent.getID()); - gWorldPointer->mPartSim.addPartSource(pss); + LLViewerPartSim::getInstance()->addPartSource(pss); mPartSourcep = pss; } } diff --git a/indra/newview/llhudicon.cpp b/indra/newview/llhudicon.cpp index 1260a268e3..248caf07a9 100644 --- a/indra/newview/llhudicon.cpp +++ b/indra/newview/llhudicon.cpp @@ -102,28 +102,28 @@ void LLHUDIcon::renderIcon(BOOL for_select) // put icon above object, and in front // RN: don't use drawable radius, it's fricking HUGE - LLVector3 icon_relative_pos = (gCamera->getUpAxis() * ~mSourceObject->getRenderRotation()); + LLVector3 icon_relative_pos = (LLViewerCamera::getInstance()->getUpAxis() * ~mSourceObject->getRenderRotation()); icon_relative_pos.abs(); F32 distance_scale = llmin(mSourceObject->getScale().mV[VX] / icon_relative_pos.mV[VX], mSourceObject->getScale().mV[VY] / icon_relative_pos.mV[VY], mSourceObject->getScale().mV[VZ] / icon_relative_pos.mV[VZ]); F32 up_distance = 0.5f * distance_scale; - LLVector3 icon_position = obj_position + (up_distance * gCamera->getUpAxis()) * 1.2f; + LLVector3 icon_position = obj_position + (up_distance * LLViewerCamera::getInstance()->getUpAxis()) * 1.2f; - LLVector3 icon_to_cam = gCamera->getOrigin() - icon_position; + LLVector3 icon_to_cam = LLViewerCamera::getInstance()->getOrigin() - icon_position; icon_to_cam.normVec(); icon_position += icon_to_cam * mSourceObject->mDrawable->getRadius() * 1.1f; - mDistance = dist_vec(icon_position, gCamera->getOrigin()); + mDistance = dist_vec(icon_position, LLViewerCamera::getInstance()->getOrigin()); F32 alpha_factor = for_select ? 1.f : clamp_rescale(mDistance, DIST_START_FADE, DIST_END_FADE, 1.f, 0.f); LLVector3 x_pixel_vec; LLVector3 y_pixel_vec; - gCamera->getPixelVectors(icon_position, y_pixel_vec, x_pixel_vec); + LLViewerCamera::getInstance()->getPixelVectors(icon_position, y_pixel_vec, x_pixel_vec); F32 scale_factor = 1.f; if (mAnimTimer.getElapsedTimeF32() < ANIM_TIME) diff --git a/indra/newview/llhudmanager.cpp b/indra/newview/llhudmanager.cpp index 30a09a96d3..a936118ccf 100644 --- a/indra/newview/llhudmanager.cpp +++ b/indra/newview/llhudmanager.cpp @@ -42,8 +42,6 @@ #include "llviewercontrol.h" #include "llviewerobjectlist.h" -LLHUDManager *gHUDManager = NULL; - extern BOOL gNoRender; // These are loaded from saved settings. @@ -155,12 +153,6 @@ void LLHUDManager::processViewerEffect(LLMessageSystem *mesgsys, void **user_dat return; } - if (!gHUDManager) - { - llwarns << "No gHUDManager!" << llendl; - return; - } - LLHUDEffect *effectp = NULL; LLUUID effect_id; U8 effect_type = 0; @@ -172,20 +164,20 @@ void LLHUDManager::processViewerEffect(LLMessageSystem *mesgsys, void **user_dat effectp = NULL; LLHUDEffect::getIDType(mesgsys, k, effect_id, effect_type); S32 i; - for (i = 0; i < gHUDManager->mHUDEffects.count(); i++) + for (i = 0; i < LLHUDManager::getInstance()->mHUDEffects.count(); i++) { - LLHUDEffect *cur_effectp = gHUDManager->mHUDEffects[i]; + LLHUDEffect *cur_effectp = LLHUDManager::getInstance()->mHUDEffects[i]; if (!cur_effectp) { llwarns << "Null effect in effect manager, skipping" << llendl; - gHUDManager->mHUDEffects.remove(i); + LLHUDManager::getInstance()->mHUDEffects.remove(i); i--; continue; } if (cur_effectp->isDead()) { // llwarns << "Dead effect in effect manager, removing" << llendl; - gHUDManager->mHUDEffects.remove(i); + LLHUDManager::getInstance()->mHUDEffects.remove(i); i--; continue; } @@ -204,7 +196,7 @@ void LLHUDManager::processViewerEffect(LLMessageSystem *mesgsys, void **user_dat { if (!effectp) { - effectp = gHUDManager->createViewerEffect(effect_type, FALSE, FALSE); + effectp = LLHUDManager::getInstance()->createViewerEffect(effect_type, FALSE, FALSE); } if (effectp) diff --git a/indra/newview/llhudmanager.h b/indra/newview/llhudmanager.h index 934bcf44a1..c77dc1bfe5 100644 --- a/indra/newview/llhudmanager.h +++ b/indra/newview/llhudmanager.h @@ -44,7 +44,7 @@ class LLHUDAnimalControls; // End Ventrella class LLMessageSystem; -class LLHUDManager +class LLHUDManager : public LLSingleton<LLHUDManager> { public: LLHUDManager(); @@ -65,6 +65,4 @@ protected: LLDynamicArrayPtr<LLPointer<LLHUDEffect> > mHUDEffects; }; -extern LLHUDManager *gHUDManager; - #endif // LL_LLHUDMANAGER_H diff --git a/indra/newview/llhudrender.cpp b/indra/newview/llhudrender.cpp index bdbc849dc2..0f83da8240 100644 --- a/indra/newview/llhudrender.cpp +++ b/indra/newview/llhudrender.cpp @@ -61,10 +61,10 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent, const BOOL orthographic) { // Do cheap plane culling - LLVector3 dir_vec = pos_agent - gCamera->getOrigin(); + LLVector3 dir_vec = pos_agent - LLViewerCamera::getInstance()->getOrigin(); dir_vec /= dir_vec.magVec(); - if (wstr.empty() || (!orthographic && dir_vec * gCamera->getAtAxis() <= 0.f)) + if (wstr.empty() || (!orthographic && dir_vec * LLViewerCamera::getInstance()->getAtAxis() <= 0.f)) { return; } @@ -78,15 +78,15 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent, } else { - gCamera->getPixelVectors(pos_agent, up_axis, right_axis); + LLViewerCamera::getInstance()->getPixelVectors(pos_agent, up_axis, right_axis); } - LLCoordFrame render_frame = *gCamera; + LLCoordFrame render_frame = *LLViewerCamera::getInstance(); LLQuaternion rot; if (!orthographic) { rot = render_frame.getQuaternion(); - rot = rot * LLQuaternion(-F_PI_BY_TWO, gCamera->getYAxis()); - rot = rot * LLQuaternion(F_PI_BY_TWO, gCamera->getXAxis()); + rot = rot * LLQuaternion(-F_PI_BY_TWO, LLViewerCamera::getInstance()->getYAxis()); + rot = rot * LLQuaternion(F_PI_BY_TWO, LLViewerCamera::getInstance()->getXAxis()); } else { diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp index e04a62167c..47e23f1c6a 100644 --- a/indra/newview/llhudtext.cpp +++ b/indra/newview/llhudtext.cpp @@ -175,9 +175,7 @@ void LLHUDText::renderText(BOOL for_select) mOffsetY = lltrunc(mHeight * ((mVertAlignment == ALIGN_VERT_CENTER) ? 0.5f : 1.f)); // *TODO: cache this image - LLUUID image_id; - image_id.set(gViewerArt.getString("rounded_square.tga")); - LLViewerImage* imagep = gImageList.getImage(image_id, MIPMAP_FALSE, TRUE); + LLUIImagePtr imagep = LLUI::getUIImage("rounded_square.tga"); // *TODO: make this a per-text setting LLColor4 bg_color = gSavedSettings.getColor4("BackgroundChatColor"); @@ -211,10 +209,10 @@ void LLHUDText::renderText(BOOL for_select) } else { - gCamera->getPixelVectors(mPositionAgent, y_pixel_vec, x_pixel_vec); + LLViewerCamera::getInstance()->getPixelVectors(mPositionAgent, y_pixel_vec, x_pixel_vec); } - LLVector2 border_scale_vec((F32)border_width / (F32)imagep->getWidth(), (F32)border_height / (F32)imagep->getHeight()); + LLVector2 border_scale_vec((F32)border_width / (F32)imagep->getTextureWidth(), (F32)border_height / (F32)imagep->getTextureHeight()); LLVector3 width_vec = mWidth * x_pixel_vec; LLVector3 height_vec = mHeight * y_pixel_vec; LLVector3 scaled_border_width = (F32)llfloor(border_scale * (F32)border_width) * x_pixel_vec; @@ -223,7 +221,7 @@ void LLHUDText::renderText(BOOL for_select) mRadius = (width_vec + height_vec).magVec() * 0.5f; LLCoordGL screen_pos; - gCamera->projectPosAgentToScreen(mPositionAgent, screen_pos, FALSE); + LLViewerCamera::getInstance()->projectPosAgentToScreen(mPositionAgent, screen_pos, FALSE); LLVector2 screen_offset; if (!mUseBubble) @@ -246,7 +244,7 @@ void LLHUDText::renderText(BOOL for_select) //} //else //{ - // render_position = gCamera->roundToPixel(render_position); + // render_position = LLViewerCamera::getInstance()->roundToPixel(render_position); //} if (mUseBubble) @@ -272,7 +270,7 @@ void LLHUDText::renderText(BOOL for_select) } else { - LLViewerImage::bindTexture(imagep); + LLViewerImage::bindTexture(imagep->getImage()); gGL.color4fv(bg_color.mV); gl_segmented_rect_3d_tex(border_scale_vec, scaled_border_width, scaled_border_height, width_vec, height_vec); @@ -616,25 +614,25 @@ void LLHUDText::updateVisibility() } // push text towards camera by radius of object, but not past camera - LLVector3 vec_from_camera = mPositionAgent - gCamera->getOrigin(); + LLVector3 vec_from_camera = mPositionAgent - LLViewerCamera::getInstance()->getOrigin(); LLVector3 dir_from_camera = vec_from_camera; dir_from_camera.normVec(); - if (dir_from_camera * gCamera->getAtAxis() <= 0.f) + if (dir_from_camera * LLViewerCamera::getInstance()->getAtAxis() <= 0.f) { - mPositionAgent -= projected_vec(vec_from_camera, gCamera->getAtAxis()) * 1.f; - mPositionAgent += gCamera->getAtAxis() * (gCamera->getNear() + 0.1f); + mPositionAgent -= projected_vec(vec_from_camera, LLViewerCamera::getInstance()->getAtAxis()) * 1.f; + mPositionAgent += LLViewerCamera::getInstance()->getAtAxis() * (LLViewerCamera::getInstance()->getNear() + 0.1f); } - else if (vec_from_camera * gCamera->getAtAxis() <= gCamera->getNear() + 0.1f + mSourceObject->getVObjRadius()) + else if (vec_from_camera * LLViewerCamera::getInstance()->getAtAxis() <= LLViewerCamera::getInstance()->getNear() + 0.1f + mSourceObject->getVObjRadius()) { - mPositionAgent = gCamera->getOrigin() + vec_from_camera * ((gCamera->getNear() + 0.1f) / (vec_from_camera * gCamera->getAtAxis())); + mPositionAgent = LLViewerCamera::getInstance()->getOrigin() + vec_from_camera * ((LLViewerCamera::getInstance()->getNear() + 0.1f) / (vec_from_camera * LLViewerCamera::getInstance()->getAtAxis())); } else { mPositionAgent -= dir_from_camera * mSourceObject->getVObjRadius(); } - mLastDistance = (mPositionAgent - gCamera->getOrigin()).magVec(); + mLastDistance = (mPositionAgent - LLViewerCamera::getInstance()->getOrigin()).magVec(); if (mLOD >= 3 || !mTextSegments.size() || (mDoFade && (mLastDistance > mFadeDistance + mFadeRange))) { @@ -645,14 +643,14 @@ void LLHUDText::updateVisibility() LLVector3 x_pixel_vec; LLVector3 y_pixel_vec; - gCamera->getPixelVectors(mPositionAgent, y_pixel_vec, x_pixel_vec); + LLViewerCamera::getInstance()->getPixelVectors(mPositionAgent, y_pixel_vec, x_pixel_vec); LLVector3 render_position = mPositionAgent + (x_pixel_vec * mPositionOffset.mV[VX]) + (y_pixel_vec * mPositionOffset.mV[VY]); mOffscreen = FALSE; - if (!gCamera->sphereInFrustum(render_position, mRadius)) + if (!LLViewerCamera::getInstance()->sphereInFrustum(render_position, mRadius)) { if (!mVisibleOffScreen) { @@ -675,9 +673,9 @@ LLVector2 LLHUDText::updateScreenPos(LLVector2 &offset) LLVector2 screen_pos_vec; LLVector3 x_pixel_vec; LLVector3 y_pixel_vec; - gCamera->getPixelVectors(mPositionAgent, y_pixel_vec, x_pixel_vec); + LLViewerCamera::getInstance()->getPixelVectors(mPositionAgent, y_pixel_vec, x_pixel_vec); LLVector3 world_pos = mPositionAgent + (offset.mV[VX] * x_pixel_vec) + (offset.mV[VY] * y_pixel_vec); - if (!gCamera->projectPosAgentToScreen(world_pos, screen_pos, FALSE) && mVisibleOffScreen) + if (!LLViewerCamera::getInstance()->projectPosAgentToScreen(world_pos, screen_pos, FALSE) && mVisibleOffScreen) { // bubble off-screen, so find a spot for it along screen edge LLVector2 window_center(gViewerWindow->getWindowDisplayWidth() * 0.5f, gViewerWindow->getWindowDisplayHeight() * 0.5f); @@ -685,7 +683,7 @@ LLVector2 LLHUDText::updateScreenPos(LLVector2 &offset) screen_pos.mY - window_center.mV[VY]); delta_from_center.normVec(); - F32 camera_aspect = gCamera->getAspect(); + F32 camera_aspect = LLViewerCamera::getInstance()->getAspect(); F32 delta_aspect = llabs(delta_from_center.mV[VX] / delta_from_center.mV[VY]); if (camera_aspect / llmax(delta_aspect, 0.001f) > 1.f) { @@ -835,7 +833,7 @@ void LLHUDText::updateAll() } } - LLStat* camera_vel_stat = gCamera->getVelocityStat(); + LLStat* camera_vel_stat = LLViewerCamera::getInstance()->getVelocityStat(); F32 camera_vel = camera_vel_stat->getCurrent(); if (camera_vel > MAX_STABLE_CAMERA_VELOCITY) { diff --git a/indra/newview/llhudview.cpp b/indra/newview/llhudview.cpp index 7f549bb2eb..59478cb031 100644 --- a/indra/newview/llhudview.cpp +++ b/indra/newview/llhudview.cpp @@ -59,16 +59,6 @@ LLHUDView::LLHUDView() LLHUDView::~LLHUDView() { } -EWidgetType LLHUDView::getWidgetType() const -{ - return WIDGET_TYPE_HUD_VIEW; -} - -LLString LLHUDView::getWidgetTag() const -{ - return LL_HUD_VIEW_TAG; -} - // virtual void LLHUDView::draw() { diff --git a/indra/newview/llhudview.h b/indra/newview/llhudview.h index cbefdc121e..ccd5f96f5f 100644 --- a/indra/newview/llhudview.h +++ b/indra/newview/llhudview.h @@ -44,9 +44,6 @@ public: LLHUDView(); virtual ~LLHUDView(); - virtual EWidgetType getWidgetType() const; - virtual LLString getWidgetTag() const; - virtual void draw(); const LLColor4& colorFromType(S32 type); diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp index f0a48b9df5..7eac7eb598 100644 --- a/indra/newview/llimpanel.cpp +++ b/indra/newview/llimpanel.cpp @@ -62,7 +62,7 @@ #include "llviewermessage.h" #include "llviewerstats.h" #include "llviewercontrol.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llviewerwindow.h" #include "lllogchat.h" #include "llfloaterhtml.h" @@ -1154,7 +1154,7 @@ void LLFloaterIMPanel::init(const LLString& session_label) mSpeakers = new LLIMSpeakerMgr(mVoiceChannel); - gUICtrlFactory->buildFloater(this, + LLUICtrlFactory::getInstance()->buildFloater(this, xml_filename, &getFactoryMap(), FALSE); @@ -1217,12 +1217,12 @@ LLFloaterIMPanel::~LLFloaterIMPanel() BOOL LLFloaterIMPanel::postBuild() { - requires("chat_editor", WIDGET_TYPE_LINE_EDITOR); - requires("im_history", WIDGET_TYPE_TEXT_EDITOR); + requires<LLLineEditor>("chat_editor"); + requires<LLTextEditor>("im_history"); if (checkRequirements()) { - mInputEditor = LLUICtrlFactory::getLineEditorByName(this, "chat_editor"); + mInputEditor = getChild<LLLineEditor>("chat_editor"); mInputEditor->setFocusReceivedCallback( onInputEditorFocusReceived, this ); mInputEditor->setFocusLostCallback( onInputEditorFocusLost, this ); mInputEditor->setKeystrokeCallback( onInputEditorKeystroke ); @@ -1240,10 +1240,10 @@ BOOL LLFloaterIMPanel::postBuild() childSetAction("toggle_active_speakers_btn", onClickToggleActiveSpeakers, this); childSetAction("moderator_kick_speaker", onKickSpeaker, this); - //LLButton* close_btn = LLUICtrlFactory::getButtonByName(this, "close_btn"); + //LLButton* close_btn = getChild<LLButton>("close_btn"); //close_btn->setClickedCallback(&LLFloaterIMPanel::onClickClose, this); - mHistoryEditor = LLViewerUICtrlFactory::getViewerTextEditorByName(this, "im_history"); + mHistoryEditor = getChild<LLViewerTextEditor>("im_history"); mHistoryEditor->setParseHTML(TRUE); if ( IM_SESSION_GROUP_START == mDialog ) @@ -1286,16 +1286,16 @@ void LLFloaterIMPanel::onClickMuteVoice(void* user_data) LLFloaterIMPanel* floaterp = (LLFloaterIMPanel*)user_data; if (floaterp) { - BOOL is_muted = gMuteListp->isMuted(floaterp->mOtherParticipantUUID, LLMute::flagVoiceChat); + BOOL is_muted = LLMuteList::getInstance()->isMuted(floaterp->mOtherParticipantUUID, LLMute::flagVoiceChat); LLMute mute(floaterp->mOtherParticipantUUID, floaterp->getTitle(), LLMute::AGENT); if (!is_muted) { - gMuteListp->add(mute, LLMute::flagVoiceChat); + LLMuteList::getInstance()->add(mute, LLMute::flagVoiceChat); } else { - gMuteListp->remove(mute, LLMute::flagVoiceChat); + LLMuteList::getInstance()->remove(mute, LLMute::flagVoiceChat); } } } @@ -1384,7 +1384,7 @@ void LLFloaterIMPanel::draw() childSetVisible("speaker_volume", LLVoiceClient::voiceEnabled() && mVoiceChannel->isActive()); childSetValue("speaker_volume", gVoiceClient->getUserVolume(mOtherParticipantUUID)); - childSetValue("mute_btn", gMuteListp->isMuted(mOtherParticipantUUID, LLMute::flagVoiceChat)); + childSetValue("mute_btn", LLMuteList::getInstance()->isMuted(mOtherParticipantUUID, LLMute::flagVoiceChat)); childSetVisible("mute_btn", LLVoiceClient::voiceEnabled() && mVoiceChannel->isActive()); } LLFloater::draw(); @@ -1540,33 +1540,30 @@ void LLFloaterIMPanel::selectNone() } -BOOL LLFloaterIMPanel::handleKeyHere( KEY key, MASK mask, BOOL called_from_parent ) +BOOL LLFloaterIMPanel::handleKeyHere( KEY key, MASK mask ) { BOOL handled = FALSE; - if( getVisible() && getEnabled() && !called_from_parent && gFocusMgr.childHasKeyboardFocus(this)) + if( KEY_RETURN == key && mask == MASK_NONE) { - if( KEY_RETURN == key && mask == MASK_NONE) - { - sendMsg(); - handled = TRUE; + sendMsg(); + handled = TRUE; - // Close talk panels on hitting return - // but not shift-return or control-return - if ( !gSavedSettings.getBOOL("PinTalkViewOpen") && !(mask & MASK_CONTROL) && !(mask & MASK_SHIFT) ) - { - gIMMgr->toggle(NULL); - } - } - else if ( KEY_ESCAPE == key ) + // Close talk panels on hitting return + // but not shift-return or control-return + if ( !gSavedSettings.getBOOL("PinTalkViewOpen") && !(mask & MASK_CONTROL) && !(mask & MASK_SHIFT) ) { - handled = TRUE; - gFocusMgr.setKeyboardFocus(NULL); + gIMMgr->toggle(NULL); + } + } + else if ( KEY_ESCAPE == key ) + { + handled = TRUE; + gFocusMgr.setKeyboardFocus(NULL); - // Close talk panel with escape - if( !gSavedSettings.getBOOL("PinTalkViewOpen") ) - { - gIMMgr->toggle(NULL); - } + // Close talk panel with escape + if( !gSavedSettings.getBOOL("PinTalkViewOpen") ) + { + gIMMgr->toggle(NULL); } } @@ -1889,7 +1886,7 @@ void LLFloaterIMPanel::sendMsg() BOOL other_was_typing = mOtherTyping; - addHistoryLine(gAgent.getID(), history_echo); + addHistoryLine(gAgent.getID(), history_echo, gSavedSettings.getColor("IMChatColor")); if (other_was_typing) { @@ -1905,7 +1902,7 @@ void LLFloaterIMPanel::sendMsg() mQueuedMsgsForInit.append(utf8_text); } - gViewerStats->incStat(LLViewerStats::ST_IM_COUNT); + LLViewerStats::getInstance()->incStat(LLViewerStats::ST_IM_COUNT); } mInputEditor->setText(LLString::null); @@ -2190,3 +2187,4 @@ void LLFloaterIMPanel::onConfirmForceCloseError(S32 option, void* data) } + diff --git a/indra/newview/llimpanel.h b/indra/newview/llimpanel.h index 7abfbbb937..c5bb8956cd 100644 --- a/indra/newview/llimpanel.h +++ b/indra/newview/llimpanel.h @@ -217,7 +217,7 @@ public: S32 getNumUnreadMessages() { return mNumUnreadMessages; } - BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent); + BOOL handleKeyHere(KEY key, MASK mask); BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 3242e7d474..203adc2fb5 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -40,7 +40,7 @@ #include "llhttpclient.h" #include "llsdutil.h" #include "llstring.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llagent.h" #include "llcallingcard.h" @@ -152,7 +152,7 @@ LLFloaterIM::LLFloaterIM() // the size of the im-sesssion when they were created. This happens in // LLMultiFloater::resizeToContents() when called through LLMultiFloater::addFloater()) this->mAutoResize = FALSE; - gUICtrlFactory->buildFloater(this, "floater_im.xml"); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_im.xml"); } BOOL LLFloaterIM::postBuild() @@ -403,12 +403,12 @@ void LLIMMgr::addMessage( const LLVector3& position) { LLUUID other_participant_id = target_id; - bool is_from_system = target_id.isNull(); + bool is_from_system = target_id.isNull() || !strcmp(from, SYSTEM_FROM); // don't process muted IMs - if (gMuteListp->isMuted( + if (LLMuteList::getInstance()->isMuted( other_participant_id, - LLMute::flagTextChat) && !gMuteListp->isLinden(from)) + LLMute::flagTextChat) && !LLMuteList::getInstance()->isLinden(from)) { return; } @@ -488,7 +488,7 @@ void LLIMMgr::addMessage( } else { - floater->addHistoryLine(other_participant_id, msg); + floater->addHistoryLine(other_participant_id, msg, gSavedSettings.getColor("IMChatColor")); } LLFloaterChatterBox* chat_floater = LLFloaterChatterBox::getInstance(LLSD()); @@ -693,7 +693,7 @@ void LLIMMgr::inviteToSession( const LLString& session_handle) { //ignore invites from muted residents - if (gMuteListp->isMuted(caller_id)) + if (LLMuteList::getInstance()->isMuted(caller_id)) { return; } @@ -953,10 +953,10 @@ void LLIMMgr::inviteUserResponse(S32 option, void* user_data) case 2: // mute (also implies ignore, so this falls through to the "ignore" case below) { // mute the sender of this invite - if (!gMuteListp->isMuted(invitep->mCallerID)) + if (!LLMuteList::getInstance()->isMuted(invitep->mCallerID)) { LLMute mute(invitep->mCallerID, invitep->mCallerName, LLMute::AGENT); - gMuteListp->add(mute); + LLMuteList::getInstance()->add(mute); } } /* FALLTHROUGH */ @@ -1482,12 +1482,12 @@ public: (time_t) message_params["timestamp"].asInteger(); BOOL is_busy = gAgent.getBusy(); - BOOL is_muted = gMuteListp->isMuted( + BOOL is_muted = LLMuteList::getInstance()->isMuted( from_id, name.c_str(), LLMute::flagTextChat); - BOOL is_linden = gMuteListp->isLinden( + BOOL is_linden = LLMuteList::getInstance()->isLinden( name.c_str()); char separator_string[3]=": "; /* Flawfinder: ignore */ int message_offset=0; @@ -1631,3 +1631,4 @@ LLHTTPRegistration<LLViewerChatterBoxInvitation> gHTTPRegistrationMessageChatterBoxInvitation( "/message/ChatterBoxInvitation"); + diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index a0fa0e083c..c3a0a2d931 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -81,7 +81,7 @@ #include "llviewermessage.h" #include "llviewerregion.h" #include "lltabcontainer.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llselectmgr.h" #include "llfloateropenobject.h" @@ -124,11 +124,11 @@ const char* ICON_NAME[ICON_NAME_COUNT] = "inv_item_object.tga", "inv_item_object_multi.tga", "inv_item_notecard.tga", - "inv_item_bodypart.tga", + "inv_item_skin.tga", "inv_item_snapshot.tga", "inv_item_shape.tga", - "inv_item_bodypart.tga", + "inv_item_skin.tga", "inv_item_hair.tga", "inv_item_eyes.tga", "inv_item_shirt.tga", @@ -388,9 +388,10 @@ void hideContextEntries(LLMenuGL& menu, LLString name = (*itor)->getName(); // descend into split menus: - if ((name == "More") && (WIDGET_TYPE_MENU_ITEM_BRANCH == (*itor)->getWidgetType())) + LLMenuItemBranchGL* branchp = dynamic_cast<LLMenuItemBranchGL*>(*itor); + if ((name == "More") && branchp) { - hideContextEntries(*((LLMenuItemBranchGL *)(*itor))->getBranch(), entries_to_show, disabled_entries); + hideContextEntries(*branchp->getBranch(), entries_to_show, disabled_entries); } @@ -807,10 +808,9 @@ void LLItemBridge::restoreItem() } } -LLViewerImage* LLItemBridge::getIcon() const +LLUIImagePtr LLItemBridge::getIcon() const { - LLString uuid_string = gViewerArt.getString(ICON_NAME[OBJECT_ICON_NAME]); - return gImageList.getImage(LLUUID(uuid_string), MIPMAP_FALSE, TRUE); + return LLUI::getUIImage(ICON_NAME[OBJECT_ICON_NAME]); } PermissionMask LLItemBridge::getPermissionMask() const @@ -1133,7 +1133,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, } // check to make sure source is agent inventory, and is represented there. - LLToolDragAndDrop::ESource source = gToolDragAndDrop->getSource(); + LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource(); BOOL is_agent_inventory = (model->getCategory(inv_cat->getUUID()) != NULL) && (LLToolDragAndDrop::SOURCE_AGENT == source); @@ -1626,7 +1626,7 @@ void LLFolderBridge::restoreItem() } // Icons for folders are based on the preferred type -LLViewerImage* LLFolderBridge::getIcon() const +LLUIImagePtr LLFolderBridge::getIcon() const { const char* control = NULL; LLAssetType::EType preferred_type = LLAssetType::AT_NONE; @@ -1687,8 +1687,7 @@ LLViewerImage* LLFolderBridge::getIcon() const control = "inv_folder_plain_closed.tga"; break; } - LLString uuid_string = gViewerArt.getString(control); - return gImageList.getImage(LLUUID(uuid_string), MIPMAP_FALSE, TRUE); + return LLUI::getUIImage(control); } BOOL LLFolderBridge::renameItem(const LLString& new_name) @@ -2195,7 +2194,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, LLVOAvatar* avatar = gAgent.getAvatarObject(); if(!avatar) return FALSE; - LLToolDragAndDrop::ESource source = gToolDragAndDrop->getSource(); + LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource(); BOOL accept = FALSE; LLViewerObject* object = NULL; if(LLToolDragAndDrop::SOURCE_AGENT == source) @@ -2318,8 +2317,8 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, accept = TRUE; if(drop) { - copy_inventory_from_notecard(gToolDragAndDrop->getObjectID(), - gToolDragAndDrop->getSourceID(), inv_item); + copy_inventory_from_notecard(LLToolDragAndDrop::getInstance()->getObjectID(), + LLToolDragAndDrop::getInstance()->getSourceID(), inv_item); } } else if(LLToolDragAndDrop::SOURCE_LIBRARY == source) @@ -2351,7 +2350,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, // | LLScriptBridge (DEPRECTED) | // +=================================================+ -LLViewerImage* LLScriptBridge::getIcon() const +LLUIImagePtr LLScriptBridge::getIcon() const { return get_item_icon(LLAssetType::AT_SCRIPT, LLInventoryType::IT_LSL, 0, FALSE); } @@ -2363,7 +2362,7 @@ LLViewerImage* LLScriptBridge::getIcon() const LLString LLTextureBridge::sPrefix("Texture: "); -LLViewerImage* LLTextureBridge::getIcon() const +LLUIImagePtr LLTextureBridge::getIcon() const { return get_item_icon(LLAssetType::AT_TEXTURE, mInvType, 0, FALSE); } @@ -2413,7 +2412,7 @@ void LLTextureBridge::openItem() LLString LLSoundBridge::sPrefix("Sound: "); -LLViewerImage* LLSoundBridge::getIcon() const +LLUIImagePtr LLSoundBridge::getIcon() const { return get_item_icon(LLAssetType::AT_SOUND, LLInventoryType::IT_SOUND, 0, FALSE); } @@ -2508,7 +2507,7 @@ void LLSoundBridge::buildContextMenu(LLMenuGL& menu, U32 flags) LLString LLLandmarkBridge::sPrefix("Landmark: "); -LLViewerImage* LLLandmarkBridge::getIcon() const +LLUIImagePtr LLLandmarkBridge::getIcon() const { return get_item_icon(LLAssetType::AT_LANDMARK, LLInventoryType::IT_LANDMARK, mVisited, FALSE); } @@ -2695,7 +2694,7 @@ void LLCallingCardBridge::performAction(LLFolderView* folder, LLInventoryModel* else LLItemBridge::performAction(folder, model, action); } -LLViewerImage* LLCallingCardBridge::getIcon() const +LLUIImagePtr LLCallingCardBridge::getIcon() const { BOOL online = FALSE; LLViewerInventoryItem* item = getItem(); @@ -2855,7 +2854,7 @@ BOOL LLCallingCardBridge::dragOrDrop(MASK mask, BOOL drop, LLString LLNotecardBridge::sPrefix("Note: "); -LLViewerImage* LLNotecardBridge::getIcon() const +LLUIImagePtr LLNotecardBridge::getIcon() const { return get_item_icon(LLAssetType::AT_NOTECARD, LLInventoryType::IT_NOTECARD, 0, FALSE); } @@ -2923,7 +2922,7 @@ void LLNotecardBridge::openItem() LLString LLGestureBridge::sPrefix("Gesture: "); -LLViewerImage* LLGestureBridge::getIcon() const +LLUIImagePtr LLGestureBridge::getIcon() const { return get_item_icon(LLAssetType::AT_GESTURE, LLInventoryType::IT_GESTURE, 0, FALSE); } @@ -3055,7 +3054,7 @@ void LLGestureBridge::buildContextMenu(LLMenuGL& menu, U32 flags) LLString LLAnimationBridge::sPrefix("Animation: "); -LLViewerImage* LLAnimationBridge::getIcon() const +LLUIImagePtr LLAnimationBridge::getIcon() const { return get_item_icon(LLAssetType::AT_ANIMATION, LLInventoryType::IT_ANIMATION, 0, FALSE); } @@ -3173,7 +3172,7 @@ BOOL LLObjectBridge::isItemRemovable() return LLInvFVBridge::isItemRemovable(); } -LLViewerImage* LLObjectBridge::getIcon() const +LLUIImagePtr LLObjectBridge::getIcon() const { return get_item_icon(LLAssetType::AT_OBJECT, mInvType, mAttachPt, mIsMultiObject ); } @@ -3223,7 +3222,7 @@ void LLObjectBridge::performAction(LLFolderView* folder, LLInventoryModel* model gObjectList.findObject(item->getUUID()); if (found_obj) { - gSelectMgr->remove(found_obj); + LLSelectMgr::getInstance()->remove(found_obj); } else { @@ -3432,10 +3431,10 @@ BOOL LLObjectBridge::renameItem(const LLString& new_name) LLViewerObject* obj = avatar->getWornAttachment( item->getUUID() ); if( obj ) { - gSelectMgr->deselectAll(); - gSelectMgr->addAsIndividual( obj, SELECT_ALL_TES, FALSE ); - gSelectMgr->selectionSetObjectName( new_name ); - gSelectMgr->deselectAll(); + LLSelectMgr::getInstance()->deselectAll(); + LLSelectMgr::getInstance()->addAsIndividual( obj, SELECT_ALL_TES, FALSE ); + LLSelectMgr::getInstance()->selectionSetObjectName( new_name ); + LLSelectMgr::getInstance()->deselectAll(); } } } @@ -3450,7 +3449,7 @@ BOOL LLObjectBridge::renameItem(const LLString& new_name) LLString LLLSLTextBridge::sPrefix("Script: "); -LLViewerImage* LLLSLTextBridge::getIcon() const +LLUIImagePtr LLLSLTextBridge::getIcon() const { return get_item_icon(LLAssetType::AT_SCRIPT, LLInventoryType::IT_LSL, 0, FALSE); } @@ -4176,7 +4175,7 @@ void remove_inventory_category_from_avatar_step2( BOOL proceed, void* userdata) LLViewerObject *found_obj = gObjectList.findObject( obj_item_array.get(i)->getUUID()); if (found_obj) { - gSelectMgr->remove(found_obj); + LLSelectMgr::getInstance()->remove(found_obj); } else { @@ -4243,7 +4242,7 @@ LLString LLWearableBridge::getLabelSuffix() const } } -LLViewerImage* LLWearableBridge::getIcon() const +LLUIImagePtr LLWearableBridge::getIcon() const { return get_item_icon(mAssetType, mInvType, mWearableType, FALSE); } diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index 432854f62e..9fbdd09c40 100644 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -235,7 +235,7 @@ public: virtual void selectItem(); virtual void restoreItem(); - virtual LLViewerImage* getIcon() const; + virtual LLUIImagePtr getIcon() const; virtual const LLString& getDisplayName() const; virtual LLString getLabelSuffix() const; virtual PermissionMask getPermissionMask() const; @@ -275,7 +275,7 @@ public: virtual void restoreItem(); - virtual LLViewerImage* getIcon() const; + virtual LLUIImagePtr getIcon() const; virtual BOOL renameItem(const LLString& new_name); virtual BOOL removeItem(); virtual BOOL isClipboardPasteable() const; @@ -337,7 +337,7 @@ class LLScriptBridge : public LLItemBridge { friend class LLInvFVBridge; public: - LLViewerImage* getIcon() const; + LLUIImagePtr getIcon() const; protected: LLScriptBridge( LLInventoryPanel* inventory, const LLUUID& uuid ) : @@ -351,7 +351,7 @@ class LLTextureBridge : public LLItemBridge public: virtual const LLString& getPrefix() { return sPrefix; } - virtual LLViewerImage* getIcon() const; + virtual LLUIImagePtr getIcon() const; virtual void openItem(); protected: @@ -367,7 +367,7 @@ class LLSoundBridge : public LLItemBridge public: virtual const LLString& getPrefix() { return sPrefix; } - virtual LLViewerImage* getIcon() const; + virtual LLUIImagePtr getIcon() const; virtual void openItem(); virtual void previewItem(); virtual void buildContextMenu(LLMenuGL& menu, U32 flags); @@ -387,7 +387,7 @@ public: virtual const LLString& getPrefix() { return sPrefix; } virtual void performAction(LLFolderView* folder, LLInventoryModel* model, LLString action); virtual void buildContextMenu(LLMenuGL& menu, U32 flags); - virtual LLViewerImage* getIcon() const; + virtual LLUIImagePtr getIcon() const; virtual void openItem(); protected: @@ -427,7 +427,7 @@ public: virtual LLString getLabelSuffix() const; //virtual const LLString& getDisplayName() const; - virtual LLViewerImage* getIcon() const; + virtual LLUIImagePtr getIcon() const; virtual void performAction(LLFolderView* folder, LLInventoryModel* model, LLString action); virtual void openItem(); virtual void buildContextMenu(LLMenuGL& menu, U32 flags); @@ -454,7 +454,7 @@ class LLNotecardBridge : public LLItemBridge public: virtual const LLString& getPrefix() { return sPrefix; } - virtual LLViewerImage* getIcon() const; + virtual LLUIImagePtr getIcon() const; virtual void openItem(); protected: @@ -471,7 +471,7 @@ class LLGestureBridge : public LLItemBridge public: virtual const LLString& getPrefix() { return sPrefix; } - virtual LLViewerImage* getIcon() const; + virtual LLUIImagePtr getIcon() const; // Only suffix for gesture items, not task items, because only // gestures in your inventory can be active. @@ -501,7 +501,7 @@ public: virtual void performAction(LLFolderView* folder, LLInventoryModel* model, LLString action); virtual void buildContextMenu(LLMenuGL& menu, U32 flags); - virtual LLViewerImage* getIcon() const; + virtual LLUIImagePtr getIcon() const; virtual void openItem(); protected: @@ -519,7 +519,7 @@ class LLObjectBridge : public LLItemBridge public: virtual const LLString& getPrefix() { return sPrefix; } - virtual LLViewerImage* getIcon() const; + virtual LLUIImagePtr getIcon() const; virtual void performAction(LLFolderView* folder, LLInventoryModel* model, LLString action); virtual void openItem(); virtual LLFontGL::StyleFlags getLabelStyle() const; @@ -552,7 +552,7 @@ class LLLSLTextBridge : public LLItemBridge public: virtual const LLString& getPrefix() { return sPrefix; } - virtual LLViewerImage* getIcon() const; + virtual LLUIImagePtr getIcon() const; virtual void openItem(); protected: @@ -568,7 +568,7 @@ class LLWearableBridge : public LLItemBridge { friend class LLInvFVBridge; public: - virtual LLViewerImage* getIcon() const; + virtual LLUIImagePtr getIcon() const; virtual void performAction(LLFolderView* folder, LLInventoryModel* model, LLString action); virtual void openItem(); virtual void buildContextMenu(LLMenuGL& menu, U32 flags); diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 17a8b84472..49f2256f61 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -930,6 +930,11 @@ void LLInventoryModel::removeObserver(LLInventoryObserver* observer) mObservers.erase(observer); } +BOOL LLInventoryModel::containsObserver(LLInventoryObserver* observer) +{ + return mObservers.find(observer) != mObservers.end(); +} + // Call this method when it's time to update everyone on a new state, // by default, the inventory model will not update observers // automatically. diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h index c2ec01a1a0..6ec2af5d7b 100644 --- a/indra/newview/llinventorymodel.h +++ b/indra/newview/llinventorymodel.h @@ -243,6 +243,7 @@ public: // to remove it. void addObserver(LLInventoryObserver* observer); void removeObserver(LLInventoryObserver* observer); + BOOL containsObserver(LLInventoryObserver* observer); // // Misc Methods diff --git a/indra/newview/lljoystickbutton.cpp b/indra/newview/lljoystickbutton.cpp index 0027036b36..21dc28784b 100644 --- a/indra/newview/lljoystickbutton.cpp +++ b/indra/newview/lljoystickbutton.cpp @@ -48,6 +48,10 @@ #include "llglheaders.h" +static LLRegisterWidget<LLJoystickAgentSlide> r1("joystick_slide"); +static LLRegisterWidget<LLJoystickAgentTurn> r2("joystick_turn"); + + const F32 NUDGE_TIME = 0.25f; // in seconds const F32 ORBIT_NUDGE_RATE = 0.05f; // fraction of normal speed @@ -603,37 +607,33 @@ void LLJoystickCameraRotate::setToggleState( BOOL left, BOOL top, BOOL right, BO void LLJoystickCameraRotate::draw() { - - if( getVisible() ) - { - LLGLSUIDefault gls_ui; + LLGLSUIDefault gls_ui; - getImageUnselected()->draw( 0, 0 ); + getImageUnselected()->draw( 0, 0 ); - if( mInTop ) - { - drawRotatedImage( getImageSelected()->getImage(), 0 ); - } + if( mInTop ) + { + drawRotatedImage( getImageSelected()->getImage(), 0 ); + } - if( mInRight ) - { - drawRotatedImage( getImageSelected()->getImage(), 1 ); - } + if( mInRight ) + { + drawRotatedImage( getImageSelected()->getImage(), 1 ); + } - if( mInBottom ) - { - drawRotatedImage( getImageSelected()->getImage(), 2 ); - } + if( mInBottom ) + { + drawRotatedImage( getImageSelected()->getImage(), 2 ); + } - if( mInLeft ) - { - drawRotatedImage( getImageSelected()->getImage(), 3 ); - } + if( mInLeft ) + { + drawRotatedImage( getImageSelected()->getImage(), 3 ); + } - if (sDebugRects) - { - drawDebugRect(); - } + if (sDebugRects) + { + drawDebugRect(); } } @@ -722,8 +722,8 @@ LLJoystickCameraZoom::LLJoystickCameraZoom(const LLString& name, LLRect rect, co mInTop( FALSE ), mInBottom( FALSE ) { - mPlusInImage = gImageList.getImage(LLUI::findAssetUUIDByName(plus_in_img), MIPMAP_FALSE, TRUE); - mMinusInImage = gImageList.getImage(LLUI::findAssetUUIDByName(minus_in_img), MIPMAP_FALSE, TRUE); + mPlusInImage = LLUIImageList::getInstance()->getUIImage(plus_in_img); + mMinusInImage = LLUIImageList::getInstance()->getUIImage(minus_in_img); } @@ -789,26 +789,23 @@ void LLJoystickCameraZoom::setToggleState( BOOL top, BOOL bottom ) void LLJoystickCameraZoom::draw() { - if( getVisible() ) + if( mInTop ) { - if( mInTop ) - { - gl_draw_image( 0, 0, mPlusInImage ); - } - else - if( mInBottom ) - { - gl_draw_image( 0, 0, mMinusInImage ); - } - else - { - getImageUnselected()->draw( 0, 0 ); - } + mPlusInImage->draw(0,0); + } + else + if( mInBottom ) + { + mMinusInImage->draw(0,0); + } + else + { + getImageUnselected()->draw( 0, 0 ); + } - if (sDebugRects) - { - drawDebugRect(); - } + if (sDebugRects) + { + drawDebugRect(); } } diff --git a/indra/newview/lljoystickbutton.h b/indra/newview/lljoystickbutton.h index 2cd53b4146..e2d95e184e 100644 --- a/indra/newview/lljoystickbutton.h +++ b/indra/newview/lljoystickbutton.h @@ -94,9 +94,6 @@ public: : LLJoystick(name, rect, default_image, selected_image, initial) { } - virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_JOYSTICK_TURN; } - virtual LLString getWidgetTag() const { return LL_JOYSTICK_TURN; } - virtual void onHeldDown(); static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); @@ -113,10 +110,6 @@ public: : LLJoystick(name, rect, default_image, selected_image, initial) { } - virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_JOYSTICK_SLIDE; } - virtual LLString getWidgetTag() const { return LL_JOYSTICK_SLIDE; } - - virtual void onHeldDown(); virtual void onMouseUp(); @@ -183,8 +176,8 @@ protected: protected: BOOL mInTop; BOOL mInBottom; - LLPointer<LLViewerImage> mPlusInImage; - LLPointer<LLViewerImage> mMinusInImage; + LLUIImagePtr mPlusInImage; + LLUIImagePtr mMinusInImage; }; diff --git a/indra/newview/lllandmarklist.cpp b/indra/newview/lllandmarklist.cpp index 1d23dff54d..59b4d245ac 100644 --- a/indra/newview/lllandmarklist.cpp +++ b/indra/newview/lllandmarklist.cpp @@ -115,10 +115,7 @@ void LLLandmarkList::processGetAssetReply( } else { - if( gViewerStats ) - { - gViewerStats->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); - } + LLViewerStats::getInstance()->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status ) { diff --git a/indra/newview/llmanip.cpp b/indra/newview/llmanip.cpp index 9b6ef2d079..af682508c9 100644 --- a/indra/newview/llmanip.cpp +++ b/indra/newview/llmanip.cpp @@ -53,7 +53,7 @@ #include "llviewerobject.h" #include "llviewerwindow.h" #include "llvoavatar.h" -#include "llworld.h" // for gWorldPointer +#include "llworld.h" // for LLWorld::getInstance() #include "llresmgr.h" #include "pipeline.h" #include "llglheaders.h" @@ -106,14 +106,14 @@ void LLManip::getManipNormal(LLViewerObject* object, EManipPart manip, LLVector3 LLVector3 grid_scale; LLQuaternion grid_rotation; - gSelectMgr->getGrid(grid_origin, grid_rotation, grid_scale); + LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale); if (manip >= LL_X_ARROW && manip <= LL_Z_ARROW) { LLVector3 arrow_axis; getManipAxis(object, manip, arrow_axis); - LLVector3 cross = arrow_axis % gCamera->getAtAxis(); + LLVector3 cross = arrow_axis % LLViewerCamera::getInstance()->getAtAxis(); normal = cross % arrow_axis; normal.normVec(); } @@ -148,7 +148,7 @@ BOOL LLManip::getManipAxis(LLViewerObject* object, EManipPart manip, LLVector3 & LLVector3 grid_scale; LLQuaternion grid_rotation; - gSelectMgr->getGrid(grid_origin, grid_rotation, grid_scale); + LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale); if (manip == LL_X_ARROW) { @@ -181,12 +181,12 @@ F32 LLManip::getSubdivisionLevel(const LLVector3 &reference_point, const LLVecto } else { - cam_to_reference = reference_point - gCamera->getOrigin(); + cam_to_reference = reference_point - LLViewerCamera::getInstance()->getOrigin(); } F32 current_range = cam_to_reference.normVec(); F32 projected_translation_axis_length = (translate_axis % cam_to_reference).magVec(); - F32 subdivisions = llmax(projected_translation_axis_length * grid_scale / (current_range / gCamera->getPixelMeterRatio() * min_pixel_spacing), 0.f); + F32 subdivisions = llmax(projected_translation_axis_length * grid_scale / (current_range / LLViewerCamera::getInstance()->getPixelMeterRatio() * min_pixel_spacing), 0.f); subdivisions = llclamp((F32)pow(2.f, llfloor(log(subdivisions) / log(2.f))), 1.f / 32.f, 32.f); return subdivisions; @@ -194,7 +194,7 @@ F32 LLManip::getSubdivisionLevel(const LLVector3 &reference_point, const LLVecto void LLManip::handleSelect() { - mObjectSelection = gSelectMgr->getEditSelection(); + mObjectSelection = LLSelectMgr::getInstance()->getEditSelection(); } void LLManip::handleDeselect() @@ -260,7 +260,7 @@ BOOL LLManip::getMousePointOnPlaneGlobal(LLVector3d& point, S32 x, S32 y, LLVect if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) { BOOL result = FALSE; - F32 mouse_x = ((F32)x / gViewerWindow->getWindowWidth() - 0.5f) * gCamera->getAspect() / gAgent.getAvatarObject()->mHUDCurZoom; + F32 mouse_x = ((F32)x / gViewerWindow->getWindowWidth() - 0.5f) * LLViewerCamera::getInstance()->getAspect() / gAgent.getAvatarObject()->mHUDCurZoom; F32 mouse_y = ((F32)y / gViewerWindow->getWindowHeight() - 0.5f) / gAgent.getAvatarObject()->mHUDCurZoom; LLVector3 origin_agent = gAgent.getPosAgentFromGlobal(origin); @@ -299,7 +299,7 @@ BOOL LLManip::nearestPointOnLineFromMouse( S32 x, S32 y, const LLVector3& b1, co if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) { - F32 mouse_x = (((F32)x / gViewerWindow->getWindowWidth()) - 0.5f) * gCamera->getAspect() / gAgent.getAvatarObject()->mHUDCurZoom; + F32 mouse_x = (((F32)x / gViewerWindow->getWindowWidth()) - 0.5f) * LLViewerCamera::getInstance()->getAspect() / gAgent.getAvatarObject()->mHUDCurZoom; F32 mouse_y = (((F32)y / gViewerWindow->getWindowHeight()) - 0.5f) / gAgent.getAvatarObject()->mHUDCurZoom; a1 = LLVector3(llmin(b1.mV[VX] - 0.1f, b2.mV[VX] - 0.1f, 0.f), -mouse_x, mouse_y); a2 = a1 + LLVector3(1.f, 0.f, 0.f); @@ -342,7 +342,7 @@ BOOL LLManip::nearestPointOnLineFromMouse( S32 x, S32 y, const LLVector3& b1, co LLVector3 LLManip::getSavedPivotPoint() const { - return gSelectMgr->getSavedBBoxOfSelection().getCenterAgent(); + return LLSelectMgr::getInstance()->getSavedBBoxOfSelection().getCenterAgent(); } LLVector3 LLManip::getPivotPoint() @@ -351,7 +351,7 @@ LLVector3 LLManip::getPivotPoint() { return mObjectSelection->getFirstObject()->getPivotPositionAgent(); } - return gSelectMgr->getBBoxOfSelection().getCenterAgent(); + return LLSelectMgr::getInstance()->getBBoxOfSelection().getCenterAgent(); } @@ -360,7 +360,7 @@ void LLManip::renderGuidelines(BOOL draw_x, BOOL draw_y, BOOL draw_z) LLVector3 grid_origin; LLQuaternion grid_rot; LLVector3 grid_scale; - gSelectMgr->getGrid(grid_origin, grid_rot, grid_scale); + LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rot, grid_scale); const BOOL children_ok = TRUE; LLViewerObject* object = mObjectSelection->getFirstRootObject(children_ok); @@ -369,7 +369,7 @@ void LLManip::renderGuidelines(BOOL draw_x, BOOL draw_y, BOOL draw_z) return; } - //LLVector3 center_agent = gSelectMgr->getBBoxOfSelection().getCenterAgent(); + //LLVector3 center_agent = LLSelectMgr::getInstance()->getBBoxOfSelection().getCenterAgent(); LLVector3 center_agent = getPivotPoint(); glPushMatrix(); @@ -381,7 +381,7 @@ void LLManip::renderGuidelines(BOOL draw_x, BOOL draw_y, BOOL draw_z) grid_rot.getAngleAxis(&angle_radians, &x, &y, &z); glRotatef(angle_radians * RAD_TO_DEG, x, y, z); - F32 region_size = gWorldPointer->getRegionWidthInMeters(); + F32 region_size = LLWorld::getInstance()->getRegionWidthInMeters(); const F32 LINE_ALPHA = 0.33f; @@ -423,29 +423,24 @@ void LLManip::renderXYZ(const LLVector3 &vec) { const S32 PAD = 10; char feedback_string[128]; /*Flawfinder: ignore*/ - LLVector3 camera_pos = gCamera->getOrigin() + gCamera->getAtAxis(); + LLVector3 camera_pos = LLViewerCamera::getInstance()->getOrigin() + LLViewerCamera::getInstance()->getAtAxis(); S32 vertical_offset = gViewerWindow->getWindowHeight() / 2 - VERTICAL_OFFSET; S32 window_center_x = gViewerWindow->getWindowWidth() / 2; S32 window_center_y = gViewerWindow->getWindowHeight() / 2; - LLUUID image_id; - image_id.set(gViewerArt.getString("rounded_square.tga")); - LLViewerImage* imagep = gImageList.getImage(image_id, MIPMAP_FALSE, TRUE); - glPushMatrix(); { + LLUIImagePtr imagep = LLUI::getUIImage("rounded_square.tga"); gViewerWindow->setup2DRender(); const LLVector2& display_scale = gViewerWindow->getDisplayScale(); glScalef(display_scale.mV[VX], display_scale.mV[VY], 1.f); gGL.color4f(0.f, 0.f, 0.f, 0.7f); - gl_draw_scaled_image_with_border(window_center_x - 115, + imagep->draw( + window_center_x - 115, window_center_y + vertical_offset - PAD, - 16, - 16, 235, PAD * 2 + 10, - imagep, LLColor4(0.f, 0.f, 0.f, 0.7f) ); } glPopMatrix(); @@ -457,31 +452,31 @@ void LLManip::renderXYZ(const LLVector3 &vec) LLGLDepthTest gls_depth(GL_FALSE); // render drop shadowed text snprintf(feedback_string, sizeof(feedback_string), "X: %.3f", vec.mV[VX]); /* Flawfinder: ignore */ - hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *gResMgr->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, -102.f + 1.f, (F32)vertical_offset - 1.f, LLColor4::black, FALSE); + hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, -102.f + 1.f, (F32)vertical_offset - 1.f, LLColor4::black, FALSE); snprintf(feedback_string, sizeof(feedback_string), "Y: %.3f", vec.mV[VY]); /* Flawfinder: ignore */ - hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *gResMgr->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, -27.f + 1.f, (F32)vertical_offset - 1.f, LLColor4::black, FALSE); + hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, -27.f + 1.f, (F32)vertical_offset - 1.f, LLColor4::black, FALSE); snprintf(feedback_string, sizeof(feedback_string), "Z: %.3f", vec.mV[VZ]); /* Flawfinder: ignore */ - hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *gResMgr->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, 48.f + 1.f, (F32)vertical_offset - 1.f, LLColor4::black, FALSE); + hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, 48.f + 1.f, (F32)vertical_offset - 1.f, LLColor4::black, FALSE); // render text on top snprintf(feedback_string, sizeof(feedback_string), "X: %.3f", vec.mV[VX]); /* Flawfinder: ignore */ - hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *gResMgr->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, -102.f, (F32)vertical_offset, LLColor4(1.f, 0.5f, 0.5f, 1.f), FALSE); + hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, -102.f, (F32)vertical_offset, LLColor4(1.f, 0.5f, 0.5f, 1.f), FALSE); glColor3f(0.5f, 1.f, 0.5f); snprintf(feedback_string, sizeof(feedback_string), "Y: %.3f", vec.mV[VY]); /* Flawfinder: ignore */ - hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *gResMgr->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, -27.f, (F32)vertical_offset, LLColor4(0.5f, 1.f, 0.5f, 1.f), FALSE); + hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, -27.f, (F32)vertical_offset, LLColor4(0.5f, 1.f, 0.5f, 1.f), FALSE); glColor3f(0.5f, 0.5f, 1.f); snprintf(feedback_string, sizeof(feedback_string), "Z: %.3f", vec.mV[VZ]); /* Flawfinder: ignore */ - hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *gResMgr->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, 48.f, (F32)vertical_offset, LLColor4(0.5f, 0.5f, 1.f, 1.f), FALSE); + hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, 48.f, (F32)vertical_offset, LLColor4(0.5f, 0.5f, 1.f, 1.f), FALSE); } } void LLManip::renderTickText(const LLVector3& pos, const char* text, const LLColor4 &color) { - const LLFontGL* big_fontp = gResMgr->getRes( LLFONT_SANSSERIF ); + const LLFontGL* big_fontp = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ); BOOL hud_selection = mObjectSelection->getSelectType() == SELECT_TYPE_HUD; glMatrixMode(GL_MODELVIEW); @@ -511,8 +506,8 @@ void LLManip::renderTickValue(const LLVector3& pos, F32 value, const char* suffi { LLLocale locale(LLLocale::USER_LOCALE); - const LLFontGL* big_fontp = gResMgr->getRes( LLFONT_SANSSERIF ); - const LLFontGL* small_fontp = gResMgr->getRes( LLFONT_SANSSERIF_SMALL ); + const LLFontGL* big_fontp = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ); + const LLFontGL* small_fontp = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF_SMALL ); char val_string[128]; /*Flawfinder: ignore*/ char fraction_string[128]; /*Flawfinder: ignore*/ @@ -559,7 +554,7 @@ void LLManip::renderTickValue(const LLVector3& pos, F32 value, const char* suffi if (fractional_portion != 0) { - snprintf(fraction_string, sizeof(fraction_string), "%c%02d%s", gResMgr->getDecimalPoint(), fractional_portion, suffix); /* Flawfinder: ignore */ + snprintf(fraction_string, sizeof(fraction_string), "%c%02d%s", LLResMgr::getInstance()->getDecimalPoint(), fractional_portion, suffix); /* Flawfinder: ignore */ gViewerWindow->setupViewport(1, -1); hud_render_utf8text(val_string, render_pos, *big_fontp, LLFontGL::NORMAL, -1.f * big_fontp->getWidthF32(val_string), 3.f, shadow_color, hud_selection); diff --git a/indra/newview/llmaniprotate.cpp b/indra/newview/llmaniprotate.cpp index fb85c81d01..d98de5cb80 100644 --- a/indra/newview/llmaniprotate.cpp +++ b/indra/newview/llmaniprotate.cpp @@ -54,7 +54,6 @@ #include "llstatusbar.h" #include "llui.h" #include "llvoavatar.h" -#include "llviewborder.h" #include "llviewercamera.h" #include "llviewerobject.h" #include "llviewerobject.h" @@ -109,7 +108,7 @@ LLManipRotate::LLManipRotate( LLToolComposite* composite ) void LLManipRotate::handleSelect() { // *FIX: put this in mouseDown? - gSelectMgr->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK); + LLSelectMgr::getInstance()->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK); gFloaterTools->setStatusText("rotate"); LLManip::handleSelect(); } @@ -225,7 +224,7 @@ void LLManipRotate::render() LLVector3 grid_scale; LLQuaternion grid_rotation; - gSelectMgr->getGrid(grid_origin, grid_rotation, grid_scale); + LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale); grid_rotation.getAngleAxis(&angle_radians, &x, &y, &z); glRotatef(angle_radians * RAD_TO_DEG, x, y, z); @@ -386,10 +385,10 @@ BOOL LLManipRotate::handleMouseDownOnPart( S32 x, S32 y, MASK mask ) highlightManipulators(x, y); S32 hit_part = mHighlightedPart; // we just started a drag, so save initial object positions - gSelectMgr->saveSelectedObjectTransform(SELECT_ACTION_TYPE_ROTATE); + LLSelectMgr::getInstance()->saveSelectedObjectTransform(SELECT_ACTION_TYPE_ROTATE); // save selection center - mRotationCenter = gAgent.getPosGlobalFromAgent( getPivotPoint() ); //gSelectMgr->getSelectionCenterGlobal(); + mRotationCenter = gAgent.getPosGlobalFromAgent( getPivotPoint() ); //LLSelectMgr::getInstance()->getSelectionCenterGlobal(); mManipPart = (EManipPart)hit_part; LLVector3 center = gAgent.getPosAgentFromGlobal( mRotationCenter ); @@ -435,7 +434,7 @@ BOOL LLManipRotate::handleMouseDownOnPart( S32 x, S32 y, MASK mask ) // Route future Mouse messages here preemptively. (Release on mouse up.) setMouseCapture( TRUE ); - gSelectMgr->enableSilhouette(FALSE); + LLSelectMgr::getInstance()->enableSilhouette(FALSE); return TRUE; } @@ -461,12 +460,12 @@ BOOL LLManipRotate::handleMouseUp(S32 x, S32 y, MASK mask) mManipPart = LL_NO_PART; // Might have missed last update due to timing. - gSelectMgr->sendMultipleUpdate( UPD_ROTATION | UPD_POSITION ); - gSelectMgr->enableSilhouette(TRUE); + LLSelectMgr::getInstance()->sendMultipleUpdate( UPD_ROTATION | UPD_POSITION ); + LLSelectMgr::getInstance()->enableSilhouette(TRUE); //gAgent.setObjectTracking(gSavedSettings.getBOOL("TrackFocusObject")); - gSelectMgr->updateSelectionCenter(); - gSelectMgr->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK); + LLSelectMgr::getInstance()->updateSelectionCenter(); + LLSelectMgr::getInstance()->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK); } return LLManip::handleMouseUp(x, y, mask); @@ -635,7 +634,7 @@ void LLManipRotate::drag( S32 x, S32 y ) if (object->isRootEdit() && !object->isAttachment()) { LLVector3d new_pos_global = gAgent.getPosGlobalFromAgent(new_position); - new_pos_global = gWorldp->clipToVisibleRegions(selectNode->mSavedPositionGlobal, new_pos_global); + new_pos_global = LLWorld::getInstance()->clipToVisibleRegions(selectNode->mSavedPositionGlobal, new_pos_global); new_position = gAgent.getPosAgentFromGlobal(new_pos_global); } @@ -704,8 +703,8 @@ void LLManipRotate::drag( S32 x, S32 y ) } // store changes to override updates - for (LLObjectSelection::iterator iter = gSelectMgr->getSelection()->begin(); - iter != gSelectMgr->getSelection()->end(); iter++) + for (LLObjectSelection::iterator iter = LLSelectMgr::getInstance()->getSelection()->begin(); + iter != LLSelectMgr::getInstance()->getSelection()->end(); iter++) { LLSelectNode* selectNode = *iter; LLViewerObject*cur = selectNode->getObject(); @@ -716,7 +715,7 @@ void LLManipRotate::drag( S32 x, S32 y ) } } - gSelectMgr->updateSelectionCenter(); + LLSelectMgr::getInstance()->updateSelectionCenter(); // RN: just clear focus so camera doesn't follow spurious object updates gAgent.clearFocusObject(); @@ -744,7 +743,7 @@ void LLManipRotate::renderSnapGuides() LLQuaternion grid_rotation; LLVector3 constraint_axis = getConstraintAxis(); - gSelectMgr->getGrid(grid_origin, grid_rotation, grid_scale); + LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale); if (!gSavedSettings.getBOOL("SnapEnabled")) { @@ -771,7 +770,7 @@ void LLManipRotate::renderSnapGuides() { test_axis = test_axis * ~grid_rotation; } - else if (gSelectMgr->getGridMode() == GRID_MODE_REF_OBJECT) + else if (LLSelectMgr::getInstance()->getGridMode() == GRID_MODE_REF_OBJECT) { test_axis = test_axis * ~grid_rotation; constrain_to_ref_object = TRUE; @@ -1118,7 +1117,7 @@ BOOL LLManipRotate::updateVisiblity() // JC - 03.26.2002 if (!hasMouseCapture()) { - mRotationCenter = gAgent.getPosGlobalFromAgent( getPivotPoint() );//gSelectMgr->getSelectionCenterGlobal(); + mRotationCenter = gAgent.getPosGlobalFromAgent( getPivotPoint() );//LLSelectMgr::getInstance()->getSelectionCenterGlobal(); } BOOL visible = FALSE; @@ -1130,7 +1129,7 @@ BOOL LLManipRotate::updateVisiblity() mCenterToCamNorm = mCenterToCam; mCenterToCamMag = mCenterToCamNorm.normVec(); - mRadiusMeters = RADIUS_PIXELS / (F32) gCamera->getViewHeightInPixels(); + mRadiusMeters = RADIUS_PIXELS / (F32) LLViewerCamera::getInstance()->getViewHeightInPixels(); mRadiusMeters /= gAgent.getAvatarObject()->mHUDCurZoom; mCenterToProfilePlaneMag = mRadiusMeters * mRadiusMeters / mCenterToCamMag; @@ -1142,13 +1141,13 @@ BOOL LLManipRotate::updateVisiblity() } else { - visible = gCamera->projectPosAgentToScreen(center, mCenterScreen ); + visible = LLViewerCamera::getInstance()->projectPosAgentToScreen(center, mCenterScreen ); if( visible ) { mCenterToCam = gAgent.getCameraPositionAgent() - center; mCenterToCamNorm = mCenterToCam; mCenterToCamMag = mCenterToCamNorm.normVec(); - LLVector3 cameraAtAxis = gCamera->getAtAxis(); + LLVector3 cameraAtAxis = LLViewerCamera::getInstance()->getAtAxis(); cameraAtAxis.normVec(); F32 z_dist = -1.f * (mCenterToCam * cameraAtAxis); @@ -1165,8 +1164,8 @@ BOOL LLManipRotate::updateVisiblity() if (mCenterToCamMag > 0.001f) { - F32 fraction_of_fov = RADIUS_PIXELS / (F32) gCamera->getViewHeightInPixels(); - F32 apparent_angle = fraction_of_fov * gCamera->getView(); // radians + F32 fraction_of_fov = RADIUS_PIXELS / (F32) LLViewerCamera::getInstance()->getViewHeightInPixels(); + F32 apparent_angle = fraction_of_fov * LLViewerCamera::getInstance()->getView(); // radians mRadiusMeters = z_dist * tan(apparent_angle); mCenterToProfilePlaneMag = mRadiusMeters * mRadiusMeters / mCenterToCamMag; @@ -1274,7 +1273,7 @@ LLVector3 LLManipRotate::getConstraintAxis() LLVector3 grid_scale; LLQuaternion grid_rotation; - gSelectMgr->getGrid(grid_origin, grid_rotation, grid_scale); + LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale); LLSelectNode* first_node = mObjectSelection->getFirstMoveableNode(TRUE); if (first_node) @@ -1301,7 +1300,7 @@ LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y ) LLVector3 grid_scale; LLQuaternion grid_rotation; - gSelectMgr->getGrid(grid_origin, grid_rotation, grid_scale); + LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale); LLVector3 axis1; LLVector3 axis2; @@ -1311,7 +1310,7 @@ LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y ) { test_axis = test_axis * ~grid_rotation; } - else if (gSelectMgr->getGridMode() == GRID_MODE_REF_OBJECT) + else if (LLSelectMgr::getInstance()->getGridMode() == GRID_MODE_REF_OBJECT) { test_axis = test_axis * ~grid_rotation; } @@ -1335,7 +1334,7 @@ LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y ) { axis1 = axis1 * grid_rotation; } - else if (gSelectMgr->getGridMode() == GRID_MODE_REF_OBJECT) + else if (LLSelectMgr::getInstance()->getGridMode() == GRID_MODE_REF_OBJECT) { axis1 = axis1 * grid_rotation; } @@ -1651,7 +1650,7 @@ LLVector3 LLManipRotate::intersectRayWithSphere( const LLVector3& ray_pt, const //static void LLManipRotate::mouseToRay( S32 x, S32 y, LLVector3* ray_pt, LLVector3* ray_dir ) { - if (gSelectMgr->getSelection()->getSelectType() == SELECT_TYPE_HUD) + if (LLSelectMgr::getInstance()->getSelection()->getSelectType() == SELECT_TYPE_HUD) { F32 mouse_x = (((F32)x / gViewerWindow->getWindowWidth()) - 0.5f) / gAgent.getAvatarObject()->mHUDCurZoom; F32 mouse_y = ((((F32)y) / gViewerWindow->getWindowHeight()) - 0.5f) / gAgent.getAvatarObject()->mHUDCurZoom; @@ -1662,7 +1661,7 @@ void LLManipRotate::mouseToRay( S32 x, S32 y, LLVector3* ray_pt, LLVector3* ray_ else { *ray_pt = gAgent.getCameraPositionAgent(); - gCamera->projectScreenToPosAgent(x, y, ray_dir); + LLViewerCamera::getInstance()->projectScreenToPosAgent(x, y, ray_dir); *ray_dir -= *ray_pt; ray_dir->normVec(); } @@ -1672,7 +1671,7 @@ void LLManipRotate::highlightManipulators( S32 x, S32 y ) { mHighlightedPart = LL_NO_PART; - //LLBBox bbox = gSelectMgr->getBBoxOfSelection(); + //LLBBox bbox = LLSelectMgr::getInstance()->getBBoxOfSelection(); LLViewerObject *first_object = mObjectSelection->getFirstMoveableObject(TRUE); if (!first_object) @@ -1691,7 +1690,7 @@ void LLManipRotate::highlightManipulators( S32 x, S32 y ) LLVector3 grid_scale; LLQuaternion grid_rotation; - gSelectMgr->getGrid(grid_origin, grid_rotation, grid_scale); + LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale); LLVector3 rot_x_axis = LLVector3::x_axis * grid_rotation; LLVector3 rot_y_axis = LLVector3::y_axis * grid_rotation; diff --git a/indra/newview/llmanipscale.cpp b/indra/newview/llmanipscale.cpp index 5252e3e3c6..cd9cd83968 100644 --- a/indra/newview/llmanipscale.cpp +++ b/indra/newview/llmanipscale.cpp @@ -159,9 +159,9 @@ inline void LLManipScale::conditionalHighlight( U32 part, const LLColor4* highli void LLManipScale::handleSelect() { - LLBBox bbox = gSelectMgr->getBBoxOfSelection(); + LLBBox bbox = LLSelectMgr::getInstance()->getBBoxOfSelection(); updateSnapGuides(bbox); - gSelectMgr->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK); + LLSelectMgr::getInstance()->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK); gFloaterTools->setStatusText("scale"); LLManip::handleSelect(); } @@ -226,13 +226,13 @@ void LLManipScale::render() const F32 BOX_HANDLE_BASE_SIZE = 50.0f; // box size in pixels = BOX_HANDLE_BASE_SIZE * BOX_HANDLE_BASE_FACTOR const F32 BOX_HANDLE_BASE_FACTOR = 0.2f; - LLVector3 center_agent = gAgent.getPosAgentFromGlobal(gSelectMgr->getSelectionCenterGlobal()); + LLVector3 center_agent = gAgent.getPosAgentFromGlobal(LLSelectMgr::getInstance()->getSelectionCenterGlobal()); F32 range; F32 range_from_agent; if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) { - mBoxHandleSize = BOX_HANDLE_BASE_SIZE * BOX_HANDLE_BASE_FACTOR / (F32) gCamera->getViewHeightInPixels(); + mBoxHandleSize = BOX_HANDLE_BASE_SIZE * BOX_HANDLE_BASE_FACTOR / (F32) LLViewerCamera::getInstance()->getViewHeightInPixels(); mBoxHandleSize /= gAgent.getAvatarObject()->mHUDCurZoom; } else @@ -253,8 +253,8 @@ void LLManipScale::render() if (range > 0.001f) { // range != zero - F32 fraction_of_fov = BOX_HANDLE_BASE_SIZE / (F32) gCamera->getViewHeightInPixels(); - F32 apparent_angle = fraction_of_fov * gCamera->getView(); // radians + F32 fraction_of_fov = BOX_HANDLE_BASE_SIZE / (F32) LLViewerCamera::getInstance()->getViewHeightInPixels(); + F32 apparent_angle = fraction_of_fov * LLViewerCamera::getInstance()->getView(); // radians mBoxHandleSize = range * tan(apparent_angle) * BOX_HANDLE_BASE_FACTOR; } else @@ -267,7 +267,7 @@ void LLManipScale::render() //////////////////////////////////////////////////////////////////////// // Draw bounding box - LLBBox bbox = gSelectMgr->getBBoxOfSelection(); + LLBBox bbox = LLSelectMgr::getInstance()->getBBoxOfSelection(); LLVector3 pos_agent = bbox.getPositionAgent(); LLQuaternion rot = bbox.getRotation(); @@ -338,10 +338,10 @@ BOOL LLManipScale::handleMouseDownOnPart( S32 x, S32 y, MASK mask ) highlightManipulators(x, y); S32 hit_part = mHighlightedPart; - gSelectMgr->enableSilhouette(FALSE); + LLSelectMgr::getInstance()->enableSilhouette(FALSE); mManipPart = (EManipPart)hit_part; - LLBBox bbox = gSelectMgr->getBBoxOfSelection(); + LLBBox bbox = LLSelectMgr::getInstance()->getBBoxOfSelection(); LLVector3 box_center_agent = bbox.getCenterAgent(); LLVector3 box_corner_agent = bbox.localToAgent( unitVectorToLocalBBoxExtent( partToUnitVector( mManipPart ), bbox ) ); @@ -354,7 +354,7 @@ BOOL LLManipScale::handleMouseDownOnPart( S32 x, S32 y, MASK mask ) mDragPointGlobal = mDragStartPointGlobal; // we just started a drag, so save initial object positions, orientations, and scales - gSelectMgr->saveSelectedObjectTransform(SELECT_ACTION_TYPE_SCALE); + LLSelectMgr::getInstance()->saveSelectedObjectTransform(SELECT_ACTION_TYPE_SCALE); // Route future Mouse messages here preemptively. (Release on mouse up.) setMouseCapture( TRUE ); @@ -384,16 +384,16 @@ BOOL LLManipScale::handleMouseUp(S32 x, S32 y, MASK mask) } //send texture update - gSelectMgr->adjustTexturesByScale(TRUE, getStretchTextures()); + LLSelectMgr::getInstance()->adjustTexturesByScale(TRUE, getStretchTextures()); - gSelectMgr->enableSilhouette(TRUE); + LLSelectMgr::getInstance()->enableSilhouette(TRUE); mManipPart = LL_NO_PART; // Might have missed last update due to UPDATE_DELAY timing - gSelectMgr->sendMultipleUpdate( mLastUpdateFlags ); + LLSelectMgr::getInstance()->sendMultipleUpdate( mLastUpdateFlags ); //gAgent.setObjectTracking(gSavedSettings.getBOOL("TrackFocusObject")); - gSelectMgr->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK); + LLSelectMgr::getInstance()->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK); } return LLManip::handleMouseUp(x, y, mask); } @@ -422,7 +422,7 @@ BOOL LLManipScale::handleHover(S32 x, S32 y, MASK mask) } // Patch up textures, if possible. - gSelectMgr->adjustTexturesByScale(FALSE, getStretchTextures()); + LLSelectMgr::getInstance()->adjustTexturesByScale(FALSE, getStretchTextures()); gViewerWindow->getWindow()->setCursor(UI_CURSOR_TOOLSCALE); return TRUE; @@ -434,7 +434,7 @@ void LLManipScale::highlightManipulators(S32 x, S32 y) // If we have something selected, try to hit its manipulator handles. // Don't do this with nothing selected, as it kills the framerate. - LLBBox bbox = gSelectMgr->getBBoxOfSelection(); + LLBBox bbox = LLSelectMgr::getInstance()->getBBoxOfSelection(); if( canAffectSelection() ) { @@ -447,15 +447,15 @@ void LLManipScale::highlightManipulators(S32 x, S32 y) transform *= cfr; LLMatrix4 window_scale; F32 zoom_level = 2.f * gAgent.getAvatarObject()->mHUDCurZoom; - window_scale.initAll(LLVector3(zoom_level / gCamera->getAspect(), zoom_level, 0.f), + window_scale.initAll(LLVector3(zoom_level / LLViewerCamera::getInstance()->getAspect(), zoom_level, 0.f), LLQuaternion::DEFAULT, LLVector3::zero); transform *= window_scale; } else { - LLMatrix4 projMatrix = gCamera->getProjection(); - LLMatrix4 modelView = gCamera->getModelview(); + LLMatrix4 projMatrix = LLViewerCamera::getInstance()->getProjection(); + LLMatrix4 modelView = LLViewerCamera::getInstance()->getModelview(); transform.initAll(LLVector3(1.f, 1.f, 1.f), bbox.getRotation(), bbox.getPositionAgent()); transform *= modelView; @@ -819,8 +819,8 @@ void LLManipScale::drag( S32 x, S32 y ) } // store changes to override updates - for (LLObjectSelection::iterator iter = gSelectMgr->getSelection()->begin(); - iter != gSelectMgr->getSelection()->end(); iter++) + for (LLObjectSelection::iterator iter = LLSelectMgr::getInstance()->getSelection()->begin(); + iter != LLSelectMgr::getInstance()->getSelection()->end(); iter++) { LLSelectNode* selectNode = *iter; LLViewerObject*cur = selectNode->getObject(); @@ -831,14 +831,14 @@ void LLManipScale::drag( S32 x, S32 y ) } } - gSelectMgr->updateSelectionCenter(); + LLSelectMgr::getInstance()->updateSelectionCenter(); gAgent.clearFocusObject(); } // Scale around the void LLManipScale::dragCorner( S32 x, S32 y ) { - LLBBox bbox = gSelectMgr->getBBoxOfSelection(); + LLBBox bbox = LLSelectMgr::getInstance()->getBBoxOfSelection(); // Suppress scale if mouse hasn't moved. if (x == mLastMouseX && y == mLastMouseY) @@ -1003,7 +1003,7 @@ void LLManipScale::dragCorner( S32 x, S32 y ) LLVector3d new_pos_global = drag_global + (selectNode->mSavedPositionGlobal - drag_global) * scale_factor; if (!cur->isAttachment()) { - new_pos_global = gWorldp->clipToVisibleRegions(selectNode->mSavedPositionGlobal, new_pos_global); + new_pos_global = LLWorld::getInstance()->clipToVisibleRegions(selectNode->mSavedPositionGlobal, new_pos_global); } cur->setPositionAbsoluteGlobal( new_pos_global ); rebuild(cur); @@ -1081,7 +1081,7 @@ void LLManipScale::dragFace( S32 x, S32 y ) LLVector3 drag_start_dir_f; drag_start_dir_f.setVec(drag_start_dir_d); - LLBBox bbox = gSelectMgr->getBBoxOfSelection(); + LLBBox bbox = LLSelectMgr::getInstance()->getBBoxOfSelection(); F32 s = 0; F32 t = 0; @@ -1224,7 +1224,7 @@ void LLManipScale::sendUpdates( BOOL send_position_update, BOOL send_scale_updat // enforce minimum update delay and don't stream updates on sub-object selections if( elapsed_time > UPDATE_DELAY && !gSavedSettings.getBOOL("EditLinkedParts") ) { - gSelectMgr->sendMultipleUpdate( update_flags ); + LLSelectMgr::getInstance()->sendMultipleUpdate( update_flags ); update_timer.reset(); mSendUpdateOnMouseUp = FALSE; } @@ -1288,7 +1288,7 @@ void LLManipScale::stretchFace( const LLVector3& drag_start_agent, const LLVecto if (cur->isRootEdit() && !cur->isAttachment()) { - LLVector3d new_pos_global = gWorldp->clipToVisibleRegions(selectNode->mSavedPositionGlobal, selectNode->mSavedPositionGlobal + delta_pos_global); + LLVector3d new_pos_global = LLWorld::getInstance()->clipToVisibleRegions(selectNode->mSavedPositionGlobal, selectNode->mSavedPositionGlobal + delta_pos_global); cur->setPositionGlobal( new_pos_global ); } else @@ -1340,7 +1340,7 @@ void LLManipScale::renderGuidelinesPart( const LLBBox& bbox ) guideline_end -= guideline_start; guideline_end.normVec(); - guideline_end *= gWorldPointer->getRegionWidthInMeters(); + guideline_end *= LLWorld::getInstance()->getRegionWidthInMeters(); guideline_end += guideline_start; { @@ -1358,7 +1358,7 @@ void LLManipScale::updateSnapGuides(const LLBBox& bbox) LLVector3 grid_origin; LLVector3 grid_scale; LLQuaternion grid_rotation; - gSelectMgr->getGrid(grid_origin, grid_rotation, grid_scale); + LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale); LLVector3 box_corner_agent = bbox.localToAgent(unitVectorToLocalBBoxExtent( partToUnitVector( mManipPart ), bbox )); mScaleCenter = getUniform() ? bbox.getCenterAgent() : bbox.localToAgent(unitVectorToLocalBBoxExtent( -1.f * partToUnitVector( mManipPart ), bbox )); @@ -1372,8 +1372,8 @@ void LLManipScale::updateSnapGuides(const LLBBox& bbox) } else { - F32 object_distance = dist_vec(mScaleCenter, gCamera->getOrigin()); - mSnapRegimeOffset = (SNAP_GUIDE_SCREEN_OFFSET * gViewerWindow->getWindowWidth() * object_distance) / gCamera->getPixelMeterRatio(); + F32 object_distance = dist_vec(mScaleCenter, LLViewerCamera::getInstance()->getOrigin()); + mSnapRegimeOffset = (SNAP_GUIDE_SCREEN_OFFSET * gViewerWindow->getWindowWidth() * object_distance) / LLViewerCamera::getInstance()->getPixelMeterRatio(); } LLVector3 cam_at_axis; F32 snap_guide_length; @@ -1384,9 +1384,9 @@ void LLManipScale::updateSnapGuides(const LLBBox& bbox) } else { - cam_at_axis = gCamera->getAtAxis(); - F32 manipulator_distance = dist_vec(box_corner_agent, gCamera->getOrigin()); - snap_guide_length = (SNAP_GUIDE_SCREEN_LENGTH * gViewerWindow->getWindowWidth() * manipulator_distance) / gCamera->getPixelMeterRatio(); + cam_at_axis = LLViewerCamera::getInstance()->getAtAxis(); + F32 manipulator_distance = dist_vec(box_corner_agent, LLViewerCamera::getInstance()->getOrigin()); + snap_guide_length = (SNAP_GUIDE_SCREEN_LENGTH * gViewerWindow->getWindowWidth() * manipulator_distance) / LLViewerCamera::getInstance()->getPixelMeterRatio(); } mSnapGuideLength = snap_guide_length / llmax(0.1f, (llmin(mSnapGuideDir1 * cam_at_axis, mSnapGuideDir2 * cam_at_axis))); @@ -1415,7 +1415,7 @@ void LLManipScale::updateSnapGuides(const LLBBox& bbox) LLVector3 scale_snap = grid_scale; mScaleSnapUnit1 = scale_snap.scaleVec(partToUnitVector( mManipPart )).magVec(); mScaleSnapUnit2 = mScaleSnapUnit1; - mSnapGuideDir1 *= mSnapGuideDir1 * gCamera->getUpAxis() > 0.f ? 1.f : -1.f; + mSnapGuideDir1 *= mSnapGuideDir1 * LLViewerCamera::getInstance()->getUpAxis() > 0.f ? 1.f : -1.f; mSnapGuideDir2 = mSnapGuideDir1 * -1.f; mSnapDir1 = mScaleDir; mSnapDir2 = mScaleDir; @@ -1430,7 +1430,7 @@ void LLManipScale::updateSnapGuides(const LLBBox& bbox) } else { - local_camera_dir = (gCamera->getOrigin() - bbox.getCenterAgent()) * ~bbox.getRotation(); + local_camera_dir = (LLViewerCamera::getInstance()->getOrigin() - bbox.getCenterAgent()) * ~bbox.getRotation(); local_camera_dir.normVec(); } local_scale_dir -= projected_vec(local_scale_dir, local_camera_dir); @@ -1622,7 +1622,7 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox) gGL.end(); } - LLVector2 screen_translate_axis(llabs(mScaleDir * gCamera->getLeftAxis()), llabs(mScaleDir * gCamera->getUpAxis())); + LLVector2 screen_translate_axis(llabs(mScaleDir * LLViewerCamera::getInstance()->getLeftAxis()), llabs(mScaleDir * LLViewerCamera::getInstance()->getUpAxis())); screen_translate_axis.normVec(); S32 tick_label_spacing = llround(screen_translate_axis * sTickLabelSpacing); @@ -1728,7 +1728,7 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox) LLVector3 text_origin = tick_pos + (mSnapGuideDir1 * mSnapRegimeOffset * (1.f + tick_scale)); - EGridMode grid_mode = gSelectMgr->getGridMode(); + EGridMode grid_mode = LLSelectMgr::getInstance()->getGridMode(); F32 tick_val; if (grid_mode == GRID_MODE_WORLD) { @@ -1780,7 +1780,7 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox) LLVector3 text_origin = tick_pos + (mSnapGuideDir2 * mSnapRegimeOffset * (1.f + tick_scale)); - EGridMode grid_mode = gSelectMgr->getGridMode(); + EGridMode grid_mode = LLSelectMgr::getInstance()->getGridMode(); F32 tick_val; if (grid_mode == GRID_MODE_WORLD) { @@ -1814,10 +1814,10 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox) { if (mHelpTextTimer.getElapsedTimeF32() < sHelpTextVisibleTime + sHelpTextFadeTime && sNumTimesHelpTextShown < sMaxTimesShowHelpText) { - LLVector3 selection_center_start = gSelectMgr->getSavedBBoxOfSelection().getCenterAgent(); + LLVector3 selection_center_start = LLSelectMgr::getInstance()->getSavedBBoxOfSelection().getCenterAgent(); LLVector3 offset_dir; - if (mSnapGuideDir1 * gCamera->getAtAxis() > mSnapGuideDir2 * gCamera->getAtAxis()) + if (mSnapGuideDir1 * LLViewerCamera::getInstance()->getAtAxis() > mSnapGuideDir2 * LLViewerCamera::getInstance()->getAtAxis()) { offset_dir = mSnapGuideDir2; } @@ -1834,7 +1834,7 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox) help_text_color.mV[VALPHA] = clamp_rescale(mHelpTextTimer.getElapsedTimeF32(), sHelpTextVisibleTime, sHelpTextVisibleTime + sHelpTextFadeTime, grid_alpha, 0.f); hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD); help_text = "to snap to grid"; - help_text_pos -= gCamera->getUpAxis() * mSnapRegimeOffset * 0.4f; + help_text_pos -= LLViewerCamera::getInstance()->getUpAxis() * mSnapRegimeOffset * 0.4f; hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD); } } diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp index 98d67f3804..9856b47830 100644 --- a/indra/newview/llmaniptranslate.cpp +++ b/indra/newview/llmaniptranslate.cpp @@ -252,7 +252,7 @@ LLManipTranslate::~LLManipTranslate() void LLManipTranslate::handleSelect() { - gSelectMgr->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK); + LLSelectMgr::getInstance()->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK); gFloaterTools->setStatusText("move"); LLManip::handleSelect(); } @@ -309,12 +309,12 @@ BOOL LLManipTranslate::handleMouseDownOnPart( S32 x, S32 y, MASK mask ) mHelpTextTimer.reset(); sNumTimesHelpTextShown++; - gSelectMgr->getGrid(mGridOrigin, mGridRotation, mGridScale); + LLSelectMgr::getInstance()->getGrid(mGridOrigin, mGridRotation, mGridScale); - gSelectMgr->enableSilhouette(FALSE); + LLSelectMgr::getInstance()->enableSilhouette(FALSE); // we just started a drag, so save initial object positions - gSelectMgr->saveSelectedObjectTransform(SELECT_ACTION_TYPE_MOVE); + LLSelectMgr::getInstance()->saveSelectedObjectTransform(SELECT_ACTION_TYPE_MOVE); mManipPart = (EManipPart)hit_part; mMouseDownX = x; @@ -345,7 +345,7 @@ BOOL LLManipTranslate::handleMouseDownOnPart( S32 x, S32 y, MASK mask ) BOOL axis_exists = getManipAxis(selected_object, mManipPart, axis); getManipNormal(selected_object, mManipPart, mManipNormal); - //LLVector3 select_center_agent = gAgent.getPosAgentFromGlobal(gSelectMgr->getSelectionCenterGlobal()); + //LLVector3 select_center_agent = gAgent.getPosAgentFromGlobal(LLSelectMgr::getInstance()->getSelectionCenterGlobal()); // TomY: The above should (?) be identical to the below LLVector3 select_center_agent = getPivotPoint(); mSubdivisions = llclamp(getSubdivisionLevel(select_center_agent, axis_exists ? axis : LLVector3::z_axis, getMinGridScale()), sGridMinSubdivisionLevel, sGridMaxSubdivisionLevel); @@ -354,7 +354,7 @@ BOOL LLManipTranslate::handleMouseDownOnPart( S32 x, S32 y, MASK mask ) if (mManipPart >= LL_YZ_PLANE && mManipPart <= LL_XY_PLANE) { LLCoordGL mouse_pos; - if (!gCamera->projectPosAgentToScreen(select_center_agent, mouse_pos)) + if (!LLViewerCamera::getInstance()->projectPosAgentToScreen(select_center_agent, mouse_pos)) { // mouse_pos may be nonsense llwarns << "Failed to project object center to screen" << llendl; @@ -367,7 +367,7 @@ BOOL LLManipTranslate::handleMouseDownOnPart( S32 x, S32 y, MASK mask ) } } - gSelectMgr->updateSelectionCenter(); + LLSelectMgr::getInstance()->updateSelectionCenter(); LLVector3d object_start_global = gAgent.getPosGlobalFromAgent(getPivotPoint()); getMousePointOnPlaneGlobal(mDragCursorStartGlobal, x, y, object_start_global, mManipNormal); mDragSelectionStartGlobal = object_start_global; @@ -445,7 +445,7 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) if (mask == MASK_COPY) { // ...we're trying to make a copy - gSelectMgr->selectDuplicate(LLVector3::zero, FALSE); + LLSelectMgr::getInstance()->selectDuplicate(LLVector3::zero, FALSE); mCopyMadeThisDrag = TRUE; // When we make the copy, we don't want to do any other processing. @@ -487,7 +487,7 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) axis_d.setVec(axis_f); - gSelectMgr->updateSelectionCenter(); + LLSelectMgr::getInstance()->updateSelectionCenter(); LLVector3d current_pos_global = gAgent.getPosGlobalFromAgent(getPivotPoint()); mSubdivisions = llclamp(getSubdivisionLevel(getPivotPoint(), axis_f, getMinGridScale()), sGridMinSubdivisionLevel, sGridMaxSubdivisionLevel); @@ -558,7 +558,7 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) // snap to planar grid LLVector3 cursor_point_agent = gAgent.getPosAgentFromGlobal(cursor_point_global); - LLVector3 camera_plane_projection = gCamera->getAtAxis(); + LLVector3 camera_plane_projection = LLViewerCamera::getInstance()->getAtAxis(); camera_plane_projection -= projected_vec(camera_plane_projection, mManipNormal); camera_plane_projection.normVec(); LLVector3 camera_projected_dir = camera_plane_projection; @@ -709,7 +709,7 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) LLVector3d new_position_global = selectNode->mSavedPositionGlobal + clamped_relative_move; // Don't let object centers go too far underground - F64 min_height = gWorldp->getMinAllowedZ(object); + F64 min_height = LLWorld::getInstance()->getMinAllowedZ(object); if (new_position_global.mdV[VZ] < min_height) { new_position_global.mdV[VZ] = min_height; @@ -724,12 +724,12 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) // Grass is always drawn on the ground, so clamp its position to the ground if (object->getPCode() == LL_PCODE_LEGACY_GRASS) { - new_position_global.mdV[VZ] = gWorldp->resolveLandHeightGlobal(new_position_global) + 1.f; + new_position_global.mdV[VZ] = LLWorld::getInstance()->resolveLandHeightGlobal(new_position_global) + 1.f; } if (object->isRootEdit()) { - new_position_global = gWorldp->clipToVisibleRegions(object->getPositionGlobal(), new_position_global); + new_position_global = LLWorld::getInstance()->clipToVisibleRegions(object->getPositionGlobal(), new_position_global); } // PR: Only update if changed @@ -776,7 +776,7 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) } } - gSelectMgr->updateSelectionCenter(); + LLSelectMgr::getInstance()->updateSelectionCenter(); gAgent.clearFocusObject(); dialog_refresh_all(); // ??? is this necessary? @@ -794,9 +794,9 @@ void LLManipTranslate::highlightManipulators(S32 x, S32 y) return; } - //LLBBox bbox = gSelectMgr->getBBoxOfSelection(); - LLMatrix4 projMatrix = gCamera->getProjection(); - LLMatrix4 modelView = gCamera->getModelview(); + //LLBBox bbox = LLSelectMgr::getInstance()->getBBoxOfSelection(); + LLMatrix4 projMatrix = LLViewerCamera::getInstance()->getProjection(); + LLMatrix4 modelView = LLViewerCamera::getInstance()->getModelview(); LLVector3 object_position = getPivotPoint(); @@ -804,7 +804,7 @@ void LLManipTranslate::highlightManipulators(S32 x, S32 y) LLVector3 grid_scale; LLQuaternion grid_rotation; - gSelectMgr->getGrid(grid_origin, grid_rotation, grid_scale); + LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale); LLVector3 relative_camera_dir; @@ -819,14 +819,14 @@ void LLManipTranslate::highlightManipulators(S32 x, S32 y) transform *= cfr; LLMatrix4 window_scale; F32 zoom_level = 2.f * gAgent.getAvatarObject()->mHUDCurZoom; - window_scale.initAll(LLVector3(zoom_level / gCamera->getAspect(), zoom_level, 0.f), + window_scale.initAll(LLVector3(zoom_level / LLViewerCamera::getInstance()->getAspect(), zoom_level, 0.f), LLQuaternion::DEFAULT, LLVector3::zero); transform *= window_scale; } else { - relative_camera_dir = (object_position - gCamera->getOrigin()) * ~grid_rotation; + relative_camera_dir = (object_position - LLViewerCamera::getInstance()->getOrigin()) * ~grid_rotation; relative_camera_dir.normVec(); transform.initRotTrans(grid_rotation, LLVector4(object_position)); @@ -1036,13 +1036,13 @@ BOOL LLManipTranslate::handleMouseUp(S32 x, S32 y, MASK mask) { // make sure arrow colors go back to normal mManipPart = LL_NO_PART; - gSelectMgr->enableSilhouette(TRUE); + LLSelectMgr::getInstance()->enableSilhouette(TRUE); // Might have missed last update due to UPDATE_DELAY timing. - gSelectMgr->sendMultipleUpdate( UPD_POSITION ); + LLSelectMgr::getInstance()->sendMultipleUpdate( UPD_POSITION ); mInSnapRegime = FALSE; - gSelectMgr->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK); + LLSelectMgr::getInstance()->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK); //gAgent.setObjectTracking(gSavedSettings.getBOOL("TrackFocusObject")); } @@ -1105,8 +1105,8 @@ void LLManipTranslate::renderSnapGuides() LLVector3 grid_scale; LLQuaternion grid_rotation; - gSelectMgr->getGrid(grid_origin, grid_rotation, grid_scale); - LLVector3 saved_selection_center = getSavedPivotPoint(); //gSelectMgr->getSavedBBoxOfSelection().getCenterAgent(); + LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale); + LLVector3 saved_selection_center = getSavedPivotPoint(); //LLSelectMgr::getInstance()->getSavedBBoxOfSelection().getCenterAgent(); LLVector3 selection_center = getPivotPoint(); LLViewerObject *first_object = first_node->getObject(); @@ -1149,7 +1149,7 @@ void LLManipTranslate::renderSnapGuides() } else { - at_axis_abs = saved_selection_center - gCamera->getOrigin(); + at_axis_abs = saved_selection_center - LLViewerCamera::getInstance()->getOrigin(); at_axis_abs.normVec(); at_axis_abs = at_axis_abs * ~grid_rotation; @@ -1225,14 +1225,14 @@ void LLManipTranslate::renderSnapGuides() } else { - LLVector3 cam_to_selection = getPivotPoint() - gCamera->getOrigin(); + LLVector3 cam_to_selection = getPivotPoint() - LLViewerCamera::getInstance()->getOrigin(); F32 current_range = cam_to_selection.normVec(); - guide_size_meters = SNAP_GUIDE_SCREEN_SIZE * gViewerWindow->getWindowHeight() * current_range / gCamera->getPixelMeterRatio(); + guide_size_meters = SNAP_GUIDE_SCREEN_SIZE * gViewerWindow->getWindowHeight() * current_range / LLViewerCamera::getInstance()->getPixelMeterRatio(); - F32 fraction_of_fov = mAxisArrowLength / (F32) gCamera->getViewHeightInPixels(); - F32 apparent_angle = fraction_of_fov * gCamera->getView(); // radians + F32 fraction_of_fov = mAxisArrowLength / (F32) LLViewerCamera::getInstance()->getViewHeightInPixels(); + F32 apparent_angle = fraction_of_fov * LLViewerCamera::getInstance()->getView(); // radians F32 offset_at_camera = tan(apparent_angle) * 1.5f; - F32 range = dist_vec(gAgent.getPosAgentFromGlobal(first_node->mSavedPositionGlobal), gCamera->getOrigin()); + F32 range = dist_vec(gAgent.getPosAgentFromGlobal(first_node->mSavedPositionGlobal), LLViewerCamera::getInstance()->getOrigin()); mSnapOffsetMeters = range * offset_at_camera; } @@ -1362,7 +1362,7 @@ void LLManipTranslate::renderSnapGuides() sub_div_offset = llround(fmod(dist_grid_axis - offset_nearest_grid_unit, getMinGridScale() * 32.f) / smallest_grid_unit_scale); - LLVector2 screen_translate_axis(llabs(translate_axis * gCamera->getLeftAxis()), llabs(translate_axis * gCamera->getUpAxis())); + LLVector2 screen_translate_axis(llabs(translate_axis * LLViewerCamera::getInstance()->getLeftAxis()), llabs(translate_axis * LLViewerCamera::getInstance()->getUpAxis())); screen_translate_axis.normVec(); S32 tick_label_spacing = llround(screen_translate_axis * sTickLabelSpacing); @@ -1387,7 +1387,7 @@ void LLManipTranslate::renderSnapGuides() { F32 snap_offset_meters; - if (mSnapOffsetAxis * gCamera->getUpAxis() > 0.f) + if (mSnapOffsetAxis * LLViewerCamera::getInstance()->getUpAxis() > 0.f) { snap_offset_meters = mSnapOffsetMeters; } @@ -1401,7 +1401,7 @@ void LLManipTranslate::renderSnapGuides() LLVector3 tick_offset = (tick_pos - mGridOrigin) * ~mGridRotation; F32 offset_val = 0.5f * tick_offset.mV[ARROW_TO_AXIS[mManipPart]] / getMinGridScale(); - EGridMode grid_mode = gSelectMgr->getGridMode(); + EGridMode grid_mode = LLSelectMgr::getInstance()->getGridMode(); F32 text_highlight = 0.8f; if(i - llround(offset_nearest_grid_unit / smallest_grid_unit_scale) == 0 && mInSnapRegime) { @@ -1426,7 +1426,7 @@ void LLManipTranslate::renderSnapGuides() if (mHelpTextTimer.getElapsedTimeF32() < sHelpTextVisibleTime + sHelpTextFadeTime && sNumTimesHelpTextShown < sMaxTimesShowHelpText) { F32 snap_offset_meters_up; - if (mSnapOffsetAxis * gCamera->getUpAxis() > 0.f) + if (mSnapOffsetAxis * LLViewerCamera::getInstance()->getUpAxis() > 0.f) { snap_offset_meters_up = mSnapOffsetMeters; } @@ -1435,7 +1435,7 @@ void LLManipTranslate::renderSnapGuides() snap_offset_meters_up = -mSnapOffsetMeters; } - LLVector3 selection_center_start = getSavedPivotPoint();//gSelectMgr->getSavedBBoxOfSelection().getCenterAgent(); + LLVector3 selection_center_start = getSavedPivotPoint();//LLSelectMgr::getInstance()->getSavedBBoxOfSelection().getCenterAgent(); LLVector3 help_text_pos = selection_center_start + (snap_offset_meters_up * 3.f * mSnapOffsetAxis); const LLFontGL* big_fontp = LLFontGL::sSansSerif; @@ -1445,7 +1445,7 @@ void LLManipTranslate::renderSnapGuides() help_text_color.mV[VALPHA] = clamp_rescale(mHelpTextTimer.getElapsedTimeF32(), sHelpTextVisibleTime, sHelpTextVisibleTime + sHelpTextFadeTime, line_alpha, 0.f); hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD); help_text = "to snap to grid"; - help_text_pos -= gCamera->getUpAxis() * mSnapOffsetMeters * 0.2f; + help_text_pos -= LLViewerCamera::getInstance()->getUpAxis() * mSnapOffsetMeters * 0.2f; hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD); } } @@ -1655,7 +1655,7 @@ void LLManipTranslate::highlightIntersection(LLVector3 normal, //setup clip plane normal = normal * grid_rotation; - if (normal * (gCamera->getOrigin()-selection_center) < 0) + if (normal * (LLViewerCamera::getInstance()->getOrigin()-selection_center) < 0) { normal = -normal; } @@ -1756,7 +1756,7 @@ void LLManipTranslate::renderTranslationHandles() LLQuaternion grid_rotation; LLGLDepthTest gls_depth(GL_FALSE); - gSelectMgr->getGrid(grid_origin, grid_rotation, grid_scale); + LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale); LLVector3 at_axis; if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) { @@ -1764,7 +1764,7 @@ void LLManipTranslate::renderTranslationHandles() } else { - at_axis = gCamera->getAtAxis() * ~grid_rotation; + at_axis = LLViewerCamera::getInstance()->getAtAxis() * ~grid_rotation; } if (at_axis.mV[VX] > 0.f) @@ -1823,8 +1823,8 @@ void LLManipTranslate::renderTranslationHandles() if (range > 0.001f) { // range != zero - F32 fraction_of_fov = mAxisArrowLength / (F32) gCamera->getViewHeightInPixels(); - F32 apparent_angle = fraction_of_fov * gCamera->getView(); // radians + F32 fraction_of_fov = mAxisArrowLength / (F32) LLViewerCamera::getInstance()->getViewHeightInPixels(); + F32 apparent_angle = fraction_of_fov * LLViewerCamera::getInstance()->getView(); // radians mArrowLengthMeters = range * tan(apparent_angle); } else @@ -1859,7 +1859,7 @@ void LLManipTranslate::renderTranslationHandles() } else { - relative_camera_dir = (selection_center - gCamera->getOrigin()) * invRotation; + relative_camera_dir = (selection_center - LLViewerCamera::getInstance()->getOrigin()) * invRotation; } relative_camera_dir.normVec(); diff --git a/indra/newview/llmemoryview.cpp b/indra/newview/llmemoryview.cpp index d554c272ee..4b4b0a36dc 100644 --- a/indra/newview/llmemoryview.cpp +++ b/indra/newview/llmemoryview.cpp @@ -67,16 +67,6 @@ LLMemoryView::~LLMemoryView() { } -EWidgetType LLMemoryView::getWidgetType() const -{ - return WIDGET_TYPE_MEMORY_VIEW; -} - -LLString LLMemoryView::getWidgetTag() const -{ - return LL_MEMORY_VIEW_TAG; -} - BOOL LLMemoryView::handleMouseDown(S32 x, S32 y, MASK mask) { if (mask & MASK_SHIFT) diff --git a/indra/newview/llmemoryview.h b/indra/newview/llmemoryview.h index 88889d18de..625499fab3 100644 --- a/indra/newview/llmemoryview.h +++ b/indra/newview/llmemoryview.h @@ -40,9 +40,6 @@ public: LLMemoryView(const std::string& name, const LLRect& rect); virtual ~LLMemoryView(); - virtual EWidgetType getWidgetType() const; - virtual LLString getWidgetTag() const; - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); virtual BOOL handleHover(S32 x, S32 y, MASK mask); diff --git a/indra/newview/llmenucommands.cpp b/indra/newview/llmenucommands.cpp index 080413bb56..9c3c374a79 100644 --- a/indra/newview/llmenucommands.cpp +++ b/indra/newview/llmenucommands.cpp @@ -62,7 +62,7 @@ #include "llviewerparceloverlay.h" #include "llviewerregion.h" #include "llviewerstats.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llviewerwindow.h" #include "llworld.h" #include "llworldmap.h" diff --git a/indra/newview/llmimetypes.cpp b/indra/newview/llmimetypes.cpp index e1bc3dbf11..e165650da1 100644 --- a/indra/newview/llmimetypes.cpp +++ b/indra/newview/llmimetypes.cpp @@ -34,7 +34,7 @@ #include "llmimetypes.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" LLMIMETypes::mime_info_map_t LLMIMETypes::sMap; LLMIMETypes::mime_widget_set_map_t LLMIMETypes::sWidgetMap; @@ -52,7 +52,7 @@ LLString sDefaultImpl; bool LLMIMETypes::parseMIMETypes(const LLString& xml_filename) { LLXMLNodePtr root; - bool success = LLViewerUICtrlFactory::getLayeredXMLNode(xml_filename, root); + bool success = LLUICtrlFactory::getLayeredXMLNode(xml_filename, root); if ( ! success || root.isNull() || ! root->hasName( "mimetypes" ) ) { llwarns << "Unable to read MIME type file: " diff --git a/indra/newview/llmorphview.cpp b/indra/newview/llmorphview.cpp index 81e677433b..3318b04625 100644 --- a/indra/newview/llmorphview.cpp +++ b/indra/newview/llmorphview.cpp @@ -80,16 +80,6 @@ LLMorphView::LLMorphView(const std::string& name, const LLRect& rect) { } -EWidgetType LLMorphView::getWidgetType() const -{ - return WIDGET_TYPE_MORPH_VIEW; -} - -LLString LLMorphView::getWidgetTag() const -{ - return LL_MORPH_VIEW_TAG; -} - //----------------------------------------------------------------------------- // initialize() //----------------------------------------------------------------------------- @@ -110,8 +100,8 @@ void LLMorphView::initialize() avatarp->mSpecialRenderMode = 3; // set up camera for close look at avatar - mOldCameraNearClip = gCamera->getNear(); - gCamera->setNear(MORPH_NEAR_CLIP); + mOldCameraNearClip = LLViewerCamera::getInstance()->getNear(); + LLViewerCamera::getInstance()->setNear(MORPH_NEAR_CLIP); } //----------------------------------------------------------------------------- @@ -127,7 +117,7 @@ void LLMorphView::shutdown() avatarp->startMotion( ANIM_AGENT_BODY_NOISE ); avatarp->mSpecialRenderMode = 0; // reset camera - gCamera->setNear(mOldCameraNearClip); + LLViewerCamera::getInstance()->setNear(mOldCameraNearClip); } } diff --git a/indra/newview/llmorphview.h b/indra/newview/llmorphview.h index ecabaa9b81..670ddf601c 100644 --- a/indra/newview/llmorphview.h +++ b/indra/newview/llmorphview.h @@ -44,9 +44,6 @@ class LLMorphView : public LLView public: LLMorphView(const std::string& name, const LLRect& rect); - virtual EWidgetType getWidgetType() const; - virtual LLString getWidgetTag() const; - void initialize(); void shutdown(); diff --git a/indra/newview/llmoveview.cpp b/indra/newview/llmoveview.cpp index eea729393c..a73da0940e 100644 --- a/indra/newview/llmoveview.cpp +++ b/indra/newview/llmoveview.cpp @@ -42,7 +42,7 @@ #include "llbutton.h" #include "llviewerwindow.h" #include "lljoystickbutton.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" // // Constants @@ -68,34 +68,34 @@ LLFloaterMove::LLFloaterMove() : LLFloater("move floater") { setIsChrome(TRUE); - gUICtrlFactory->buildFloater(this,"floater_moveview.xml"); + LLUICtrlFactory::getInstance()->buildFloater(this,"floater_moveview.xml"); - mForwardButton = LLViewerUICtrlFactory::getJoystickAgentTurnByName(this, "forward btn"); + mForwardButton = getChild<LLJoystickAgentTurn>("forward btn"); mForwardButton->setHeldDownDelay(MOVE_BUTTON_DELAY); - mBackwardButton = LLViewerUICtrlFactory::getJoystickAgentTurnByName(this, "backward btn"); + mBackwardButton = getChild<LLJoystickAgentTurn>("backward btn"); mBackwardButton->setHeldDownDelay(MOVE_BUTTON_DELAY); - mSlideLeftButton = LLViewerUICtrlFactory::getJoystickAgentSlideByName(this, "slide left btn"); + mSlideLeftButton = getChild<LLJoystickAgentSlide>("slide left btn"); mSlideLeftButton->setHeldDownDelay(MOVE_BUTTON_DELAY); - mSlideRightButton = LLViewerUICtrlFactory::getJoystickAgentSlideByName(this, "slide right btn"); + mSlideRightButton = getChild<LLJoystickAgentSlide>("slide right btn"); mSlideRightButton->setHeldDownDelay(MOVE_BUTTON_DELAY); - mTurnLeftButton = LLUICtrlFactory::getButtonByName(this, "turn left btn"); + mTurnLeftButton = getChild<LLButton>("turn left btn"); mTurnLeftButton->setHeldDownDelay(MOVE_BUTTON_DELAY); mTurnLeftButton->setHeldDownCallback( turnLeft ); - mTurnRightButton = LLUICtrlFactory::getButtonByName(this, "turn right btn"); + mTurnRightButton = getChild<LLButton>("turn right btn"); mTurnRightButton->setHeldDownDelay(MOVE_BUTTON_DELAY); mTurnRightButton->setHeldDownCallback( turnRight ); - mMoveUpButton = LLUICtrlFactory::getButtonByName(this, "move up btn"); + mMoveUpButton = getChild<LLButton>("move up btn"); childSetAction("move up btn",moveUp,NULL); mMoveUpButton->setHeldDownDelay(MOVE_BUTTON_DELAY); mMoveUpButton->setHeldDownCallback( moveUp ); - mMoveDownButton = LLUICtrlFactory::getButtonByName(this, "move down btn"); + mMoveDownButton = getChild<LLButton>("move down btn"); childSetAction("move down btn",moveDown,NULL); mMoveDownButton->setHeldDownDelay(MOVE_BUTTON_DELAY); mMoveDownButton->setHeldDownCallback( moveDown ); diff --git a/indra/newview/llmutelist.cpp b/indra/newview/llmutelist.cpp index 60d39b62bd..24eb9ee34a 100644 --- a/indra/newview/llmutelist.cpp +++ b/indra/newview/llmutelist.cpp @@ -59,14 +59,12 @@ #include "message.h" #include "llagent.h" -#include "llfloatermute.h" #include "llviewergenericmessage.h" // for gGenericDispatcher #include "llviewerwindow.h" #include "llworld.h" //for particle system banning #include "llviewerobject.h" #include "llviewerobjectlist.h" -LLMuteList* gMuteListp = NULL; std::map<LLUUID, F32> LLMuteList::sUserVolumeSettings; @@ -81,7 +79,7 @@ public: const LLUUID& invoice, const sparam_t& strings) { - gMuteListp->setLoaded(); + LLMuteList::getInstance()->setLoaded(); return true; } }; @@ -159,18 +157,27 @@ void LLMute::setFromDisplayName(const LLString& display_name) return; } +/* static */ +LLMuteList* LLMuteList::getInstance() +{ + // Register callbacks at the first time that we find that the message system has been created. + static BOOL registered = FALSE; + if( !registered && gMessageSystem != NULL) + { + registered = TRUE; + // Register our various callbacks + gMessageSystem->setHandlerFuncFast(_PREHASH_MuteListUpdate, processMuteListUpdate); + gMessageSystem->setHandlerFuncFast(_PREHASH_UseCachedMuteList, processUseCachedMuteList); + } + return LLSingleton<LLMuteList>::getInstance(); // Call the "base" implementation. +} + //----------------------------------------------------------------------------- // LLMuteList() //----------------------------------------------------------------------------- LLMuteList::LLMuteList() : mIsLoaded(FALSE) { - LLMessageSystem* msg = gMessageSystem; - - // Register our various callbacks - msg->setHandlerFuncFast(_PREHASH_MuteListUpdate, processMuteListUpdate); - msg->setHandlerFuncFast(_PREHASH_UseCachedMuteList, processUseCachedMuteList); - gGenericDispatcher.addHandler("emptymutelist", &sDispatchEmptyMuteList); // load per-resident voice volume information @@ -318,7 +325,7 @@ BOOL LLMuteList::add(const LLMute& mute, U32 flags) //Kill all particle systems owned by muted task if(localmute.mType == LLMute::AGENT || localmute.mType == LLMute::OBJECT) { - gWorldPointer->mPartSim.clearParticlesByOwnerID(localmute.mID); + LLViewerPartSim::getInstance()->clearParticlesByOwnerID(localmute.mID); } } return TRUE; @@ -345,7 +352,7 @@ void LLMuteList::updateAdd(const LLMute& mute) msg->addU32("MuteFlags", mute.mFlags); gAgent.sendReliableMessage(); - mIsLoaded = TRUE; + mIsLoaded = TRUE; // why is this here? -MG } @@ -398,8 +405,7 @@ BOOL LLMuteList::remove(const LLMute& mute, U32 flags) } // Must be after erase. - notifyObservers(); - found = TRUE; + setLoaded(); // why is this here? -MG } // Clean up any legacy mutes @@ -411,8 +417,7 @@ BOOL LLMuteList::remove(const LLMute& mute, U32 flags) updateRemove(mute); mLegacyMutes.erase(legacy_it); // Must be after erase. - notifyObservers(); - found = TRUE; + setLoaded(); // why is this here? -MG } return found; @@ -502,8 +507,7 @@ BOOL LLMuteList::loadFromFile(const LLString& filename) } } fclose(fp); - mIsLoaded = TRUE; - notifyObservers(); + setLoaded(); return TRUE; } @@ -673,24 +677,22 @@ void LLMuteList::processMuteListUpdate(LLMessageSystem* msg, void**) void LLMuteList::processUseCachedMuteList(LLMessageSystem* msg, void**) { llinfos << "LLMuteList::processUseCachedMuteList()" << llendl; - if (!gMuteListp) return; char agent_id_string[UUID_STR_LENGTH]; /*Flawfinder: ignore*/ gAgent.getID().toString(agent_id_string); char filename[LL_MAX_PATH]; /*Flawfinder: ignore*/ snprintf(filename, sizeof(filename), "%s.cached_mute", gDirUtilp->getExpandedFilename(LL_PATH_CACHE,agent_id_string).c_str()); /* Flawfinder: ignore */ - gMuteListp->loadFromFile(filename); + LLMuteList::getInstance()->loadFromFile(filename); } void LLMuteList::onFileMuteList(void** user_data, S32 error_code, LLExtStat ext_status) { llinfos << "LLMuteList::processMuteListFile()" << llendl; - if (!gMuteListp) return; std::string *local_filename_and_path = (std::string*)user_data; if(local_filename_and_path && !local_filename_and_path->empty() && (error_code == 0)) { - gMuteListp->loadFromFile(local_filename_and_path->c_str()); + LLMuteList::getInstance()->loadFromFile(local_filename_and_path->c_str()); LLFile::remove(local_filename_and_path->c_str()); } delete local_filename_and_path; @@ -714,14 +716,6 @@ void LLMuteList::setLoaded() void LLMuteList::notifyObservers() { - // HACK: LLFloaterMute is constructed before LLMuteList, - // so it can't easily observe it. Changing this requires - // much reshuffling of the startup process. JC - if (gFloaterMute) - { - gFloaterMute->refreshMuteList(); - } - for (observer_set_t::iterator it = mObservers.begin(); it != mObservers.end(); ) diff --git a/indra/newview/llmutelist.h b/indra/newview/llmutelist.h index 413a2933b3..dc69e98286 100644 --- a/indra/newview/llmutelist.h +++ b/indra/newview/llmutelist.h @@ -79,12 +79,17 @@ public: U32 mFlags; // flags pertaining to this mute entry }; -class LLMuteList +class LLMuteList : public LLSingleton<LLMuteList> { public: LLMuteList(); ~LLMuteList(); + // Implemented locally so that we can perform some delayed initialization. + // Callers should be careful to call this one and not LLSingleton<LLMuteList>::getInstance() + // which would circumvent that mechanism. -MG + static LLMuteList* getInstance(); + void addObserver(LLMuteListObserver* observer); void removeObserver(LLMuteListObserver* observer); @@ -170,6 +175,5 @@ public: virtual void onChange() = 0; }; -extern LLMuteList *gMuteListp; #endif //LL_MUTELIST_H diff --git a/indra/newview/llnameeditor.cpp b/indra/newview/llnameeditor.cpp index a36c67a879..3b4ac4f81e 100644 --- a/indra/newview/llnameeditor.cpp +++ b/indra/newview/llnameeditor.cpp @@ -42,6 +42,7 @@ #include "llstring.h" #include "llui.h" +static LLRegisterWidget<LLNameEditor> r("name_editor"); // statics std::set<LLNameEditor*> LLNameEditor::sInstances; @@ -55,10 +56,7 @@ LLNameEditor::LLNameEditor(const std::string& name, const LLRect& rect, void (*keystroke_callback)(LLLineEditor* caller, void* user_data), void (*focus_lost_callback)(LLFocusableElement* caller, void* user_data), void* userdata, - LLLinePrevalidateFunc prevalidate_func, - LLViewBorder::EBevel border_bevel, - LLViewBorder::EStyle border_style, - S32 border_thickness) + LLLinePrevalidateFunc prevalidate_func) : LLLineEditor(name, rect, "(retrieving)", glfont, @@ -67,10 +65,7 @@ LLNameEditor::LLNameEditor(const std::string& name, const LLRect& rect, keystroke_callback, focus_lost_callback, userdata, - prevalidate_func, - border_bevel, - border_style, - border_thickness), + prevalidate_func), mNameID(name_id) { LLNameEditor::sInstances.insert(this); @@ -157,19 +152,6 @@ LLView* LLNameEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory node->getAttributeS32("max_length", max_text_length); LLFontGL* font = LLView::selectFont(node); - - LLViewBorder::EStyle border_style = LLViewBorder::STYLE_LINE; - LLString border_string; - node->getAttributeString("border_style", border_string); - LLString::toLower(border_string); - - if (border_string == "texture") - { - border_style = LLViewBorder::STYLE_TEXTURE; - } - - S32 border_thickness = 1; - node->getAttributeS32("border_thickness", border_thickness); LLUICtrlCallback commit_callback = NULL; @@ -178,14 +160,7 @@ LLView* LLNameEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory LLUUID::null, FALSE, font, max_text_length, - commit_callback, - NULL, - NULL, - NULL, - NULL, - LLViewBorder::BEVEL_IN, - border_style, - border_thickness); + commit_callback); LLString label; if(node->getAttributeString("label", label)) diff --git a/indra/newview/llnameeditor.h b/indra/newview/llnameeditor.h index a5a0c5d9c8..c7c94f458a 100644 --- a/indra/newview/llnameeditor.h +++ b/indra/newview/llnameeditor.h @@ -54,10 +54,7 @@ public: void (*keystroke_callback)(LLLineEditor* caller, void* user_data) = NULL, void (*focus_lost_callback)(LLFocusableElement* caller, void* user_data) = NULL, void* userdata = NULL, - LLLinePrevalidateFunc prevalidate_func = NULL, - LLViewBorder::EBevel border_bevel = LLViewBorder::BEVEL_IN, - LLViewBorder::EStyle border_style = LLViewBorder::STYLE_LINE, - S32 border_thickness = 1); + LLLinePrevalidateFunc prevalidate_func = NULL); // By default, follows top and left and is mouse-opaque. // If no text, text = name. // If no font, uses default system font. @@ -74,8 +71,6 @@ public: static void refreshAll(const LLUUID& id, const char* firstname, const char* lastname, BOOL is_group); - virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_NAME_EDITOR; } - virtual LLString getWidgetTag() const { return LL_NAME_EDITOR_TAG; } // Take/return agent UUIDs virtual void setValue( LLSD value ); diff --git a/indra/newview/llnamelistctrl.cpp b/indra/newview/llnamelistctrl.cpp index 5f1afccbdc..6e08eff6ee 100644 --- a/indra/newview/llnamelistctrl.cpp +++ b/indra/newview/llnamelistctrl.cpp @@ -39,6 +39,8 @@ #include "llagent.h" #include "llinventory.h" +static LLRegisterWidget<LLNameListCtrl> r("name_list"); + // statics std::set<LLNameListCtrl*> LLNameListCtrl::sInstances; diff --git a/indra/newview/llnamelistctrl.h b/indra/newview/llnamelistctrl.h index e6efd4e7e1..c49a163ba8 100644 --- a/indra/newview/llnamelistctrl.h +++ b/indra/newview/llnamelistctrl.h @@ -50,8 +50,7 @@ public: S32 name_column_index = 0, const LLString& tooltip = LLString::null); virtual ~LLNameListCtrl(); - virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_NAME_LIST; } - virtual LLString getWidgetTag() const { return LL_NAME_LIST_CTRL_TAG; } + virtual LLXMLNodePtr getXML(bool save_children = true) const; static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index e24b5251e0..1550751e7f 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -103,15 +103,20 @@ LLNetMap::LLNetMap( mObjectImageCenterGlobal = gAgent.getCameraPositionGlobal(); + // TODO: exteralize hardcoded constants. const S32 DIR_WIDTH = 10; const S32 DIR_HEIGHT = 10; LLRect major_dir_rect( 0, DIR_HEIGHT, DIR_WIDTH, 0 ); - - mTextBoxNorth = new LLTextBox( "N", major_dir_rect ); - mTextBoxNorth->setFontStyle(LLFontGL::DROP_SHADOW_SOFT); + const LLColor4 minor_color( 1.f, 1.f, 1.f, .7f ); + const LLRect minor_dir_rect( 0, DIR_HEIGHT, DIR_WIDTH * 2, 0 ); + + // Note: removing special treatment for north compass point (DEV-10559). -MG + //mTextBoxNorth = new LLTextBox( "N", major_dir_rect ); + //mTextBoxNorth->setFontStyle(LLFontGL::DROP_SHADOW_SOFT); + //addChild( mTextBoxNorth ); + mTextBoxNorth = new LLTextBox( "N", major_dir_rect ); + mTextBoxNorth->setColor( minor_color ); addChild( mTextBoxNorth ); - - LLColor4 minor_color( 1.f, 1.f, 1.f, .7f ); mTextBoxEast = new LLTextBox( "E", major_dir_rect ); mTextBoxEast->setColor( minor_color ); @@ -127,8 +132,6 @@ LLNetMap::LLNetMap( mTextBoxSouth->setColor( minor_color ); addChild( mTextBoxSouth ); - LLRect minor_dir_rect( 0, DIR_HEIGHT, DIR_WIDTH * 2, 0 ); - mTextBoxSouthEast = new LLTextBox( "SE", minor_dir_rect ); mTextBoxSouthEast->setColor( minor_color ); addChild( mTextBoxSouthEast ); @@ -170,17 +173,6 @@ LLNetMap::~LLNetMap() sInstance = NULL; } -EWidgetType LLNetMap::getWidgetType() const -{ - return WIDGET_TYPE_NET_MAP; -} - -LLString LLNetMap::getWidgetTag() const -{ - return LL_NET_MAP_TAG; -} - - void LLNetMap::setScale( F32 scale ) { gMiniMapScale = scale; @@ -194,20 +186,8 @@ void LLNetMap::setScale( F32 scale ) F32 half_width = (F32)(getRect().getWidth() / 2); F32 half_height = (F32)(getRect().getHeight() / 2); F32 radius = sqrt( half_width * half_width + half_height * half_height ); - F32 region_widths = (2.f*radius)/gMiniMapScale; - - F32 meters; - if (!gWorldPointer) - { - // Hack! Sometimes world hasn't been initialized at this point. - meters = 256.f*region_widths; - } - else - { - meters = region_widths * gWorldPointer->getRegionWidthInMeters(); - } - + F32 meters = region_widths * LLWorld::getInstance()->getRegionWidthInMeters(); F32 num_pixels = (F32)mObjectImagep->getWidth(); mObjectMapTPM = num_pixels/meters; mObjectMapPixels = 2.f*radius; @@ -231,10 +211,6 @@ void LLNetMap::draw() { static LLFrameTimer map_timer; - if (!getVisible() || !gWorldPointer) - { - return; - } if (mObjectImagep.isNull()) { createObjectImage(); @@ -271,15 +247,15 @@ void LLNetMap::draw() if( LLNetMap::sRotateMap ) { // rotate subsequent draws to agent rotation - rotation = atan2( gCamera->getAtAxis().mV[VX], gCamera->getAtAxis().mV[VY] ); + rotation = atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] ); glRotatef( rotation * RAD_TO_DEG, 0.f, 0.f, 1.f); } // figure out where agent is - S32 region_width = llround(gWorldPointer->getRegionWidthInMeters()); + S32 region_width = llround(LLWorld::getInstance()->getRegionWidthInMeters()); - for (LLWorld::region_list_t::iterator iter = gWorldp->mActiveRegionList.begin(); - iter != gWorldp->mActiveRegionList.end(); ++iter) + for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->mActiveRegionList.begin(); + iter != LLWorld::getInstance()->mActiveRegionList.end(); ++iter) { LLViewerRegion* regionp = *iter; // Find x and y position relative to camera's center. @@ -395,8 +371,8 @@ void LLNetMap::draw() LLVector3 pos_map; // Draw avatars - for (LLWorld::region_list_t::iterator iter = gWorldp->mActiveRegionList.begin(); - iter != gWorldp->mActiveRegionList.end(); ++iter) + for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->mActiveRegionList.begin(); + iter != LLWorld::getInstance()->mActiveRegionList.end(); ++iter) { LLViewerRegion* regionp = *iter; const LLVector3d& origin_global = regionp->getOriginGlobal(); @@ -463,16 +439,13 @@ void LLNetMap::draw() //drawTracking( gAgent.getPosGlobalFromAgent(gAgent.getFrameAgent().getCenter()), gSelfMapColor ); pos_global = gAgent.getPositionGlobal(); pos_map = globalPosToView(pos_global); - gl_draw_image(llround(pos_map.mV[VX]) - 4, - llround(pos_map.mV[VY]) - 4, - LLWorldMapView::sAvatarYouSmallImage, - LLColor4::white); + LLWorldMapView::sAvatarYouSmallImage->draw(llround(pos_map.mV[VX]) - 4, llround(pos_map.mV[VY]) - 4); // Draw frustum - F32 meters_to_pixels = gMiniMapScale/ gWorldPointer->getRegionWidthInMeters(); + F32 meters_to_pixels = gMiniMapScale/ LLWorld::getInstance()->getRegionWidthInMeters(); - F32 horiz_fov = gCamera->getView() * gCamera->getAspect(); - F32 far_clip_meters = gCamera->getFar(); + F32 horiz_fov = LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect(); + F32 far_clip_meters = LLViewerCamera::getInstance()->getFar(); F32 far_clip_pixels = far_clip_meters * meters_to_pixels; F32 half_width_meters = far_clip_meters * tan( horiz_fov / 2 ); @@ -501,7 +474,7 @@ void LLNetMap::draw() // If we don't rotate the map, we have to rotate the frustum. gGL.pushMatrix(); gGL.translatef( ctr_x, ctr_y, 0 ); - glRotatef( atan2( gCamera->getAtAxis().mV[VX], gCamera->getAtAxis().mV[VY] ) * RAD_TO_DEG, 0.f, 0.f, -1.f); + glRotatef( atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] ) * RAD_TO_DEG, 0.f, 0.f, -1.f); gGL.begin( GL_TRIANGLES ); gGL.vertex2f( 0, 0 ); gGL.vertex2f( -half_width_pixels, far_clip_pixels ); @@ -537,7 +510,7 @@ LLVector3 LLNetMap::globalPosToView( const LLVector3d& global_pos ) if( LLNetMap::sRotateMap ) { - F32 radians = atan2( gCamera->getAtAxis().mV[VX], gCamera->getAtAxis().mV[VY] ); + F32 radians = atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] ); LLQuaternion rot(radians, LLVector3(0.f, 0.f, 1.f)); pos_local.rotVec( rot ); } @@ -581,7 +554,7 @@ LLVector3d LLNetMap::viewPosToGlobal( S32 x, S32 y ) LLVector3 pos_local( (F32)x, (F32)y, 0 ); - F32 radians = - atan2( gCamera->getAtAxis().mV[VX], gCamera->getAtAxis().mV[VY] ); + F32 radians = - atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] ); if( LLNetMap::sRotateMap ) { @@ -589,7 +562,7 @@ LLVector3d LLNetMap::viewPosToGlobal( S32 x, S32 y ) pos_local.rotVec( rot ); } - pos_local *= ( gWorldPointer->getRegionWidthInMeters() / gMiniMapScale ); + pos_local *= ( LLWorld::getInstance()->getRegionWidthInMeters() / gMiniMapScale ); LLVector3d pos_global; pos_global.setVec( pos_local ); @@ -612,7 +585,7 @@ BOOL LLNetMap::handleToolTip( S32 x, S32 y, LLString& msg, LLRect* sticky_rect_s { return FALSE; } - LLViewerRegion* region = gWorldPointer->getRegionFromPosGlobal( viewPosToGlobal( x, y ) ); + LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal( viewPosToGlobal( x, y ) ); if( region ) { msg.assign( region->getName() ); diff --git a/indra/newview/llnetmap.h b/indra/newview/llnetmap.h index dc696238ea..5d506c473c 100644 --- a/indra/newview/llnetmap.h +++ b/indra/newview/llnetmap.h @@ -51,9 +51,6 @@ public: LLNetMap(const std::string& name, const LLRect& rect, const LLColor4& bg_color ); virtual ~LLNetMap(); - virtual EWidgetType getWidgetType() const; - virtual LLString getWidgetTag() const; - virtual void draw(); virtual BOOL handleDoubleClick( S32 x, S32 y, MASK mask ); virtual BOOL handleRightMouseDown( S32 x, S32 y, MASK mask ); diff --git a/indra/newview/lloverlaybar.cpp b/indra/newview/lloverlaybar.cpp index 89f2e6239a..993125ce0a 100644 --- a/indra/newview/lloverlaybar.cpp +++ b/indra/newview/lloverlaybar.cpp @@ -55,7 +55,7 @@ #include "llviewermedia.h" #include "llviewerparcelmedia.h" #include "llviewerparcelmgr.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llviewerwindow.h" #include "llvoiceclient.h" #include "llvoavatar.h" @@ -113,7 +113,7 @@ LLOverlayBar::LLOverlayBar() factory_map["voice_remote"] = LLCallbackMap(LLOverlayBar::createVoiceRemote, this); factory_map["chat_bar"] = LLCallbackMap(LLOverlayBar::createChatBar, this); - gUICtrlFactory->buildPanel(this, "panel_overlaybar.xml", &factory_map); + LLUICtrlFactory::getInstance()->buildPanel(this, "panel_overlaybar.xml", &factory_map); } BOOL LLOverlayBar::postBuild() @@ -137,16 +137,6 @@ LLOverlayBar::~LLOverlayBar() // LLView destructor cleans up children } -EWidgetType LLOverlayBar::getWidgetType() const -{ - return WIDGET_TYPE_OVERLAY_BAR; -} - -LLString LLOverlayBar::getWidgetTag() const -{ - return LL_OVERLAY_BAR_TAG; -} - // virtual void LLOverlayBar::reshape(S32 width, S32 height, BOOL called_from_parent) { @@ -160,12 +150,12 @@ void LLOverlayBar::reshape(S32 width, S32 height, BOOL called_from_parent) void LLOverlayBar::layoutButtons() { - LLView* state_buttons_panel = getChildByName("state_buttons", TRUE); + LLView* state_buttons_panel = getChildView("state_buttons"); - if (state_buttons_panel && state_buttons_panel->getVisible()) + if (state_buttons_panel->getVisible()) { LLViewQuery query; - LLWidgetTypeFilter widget_filter(WIDGET_TYPE_BUTTON); + LLWidgetTypeFilter<LLButton> widget_filter; query.addPreFilter(LLEnabledFilter::getInstance()); query.addPreFilter(&widget_filter); @@ -201,7 +191,7 @@ void LLOverlayBar::refresh() BOOL buttons_changed = FALSE; BOOL im_received = gIMMgr->getIMReceived(); - LLButton* button = LLUICtrlFactory::getButtonByName(this, "IM Received"); + LLButton* button = getChild<LLButton>("IM Received"); if (button && button->getVisible() != im_received) { button->setVisible(im_received); @@ -211,7 +201,7 @@ void LLOverlayBar::refresh() } BOOL busy = gAgent.getBusy(); - button = LLUICtrlFactory::getButtonByName(this, "Set Not Busy"); + button = getChild<LLButton>("Set Not Busy"); if (button && button->getVisible() != busy) { button->setVisible(busy); @@ -221,7 +211,7 @@ void LLOverlayBar::refresh() } BOOL controls_grabbed = gAgent.anyControlGrabbed(); - button = LLUICtrlFactory::getButtonByName(this, "Release Keys"); + button = getChild<LLButton>("Release Keys"); if (button && button->getVisible() != controls_grabbed) { @@ -234,7 +224,7 @@ void LLOverlayBar::refresh() BOOL mouselook_grabbed; mouselook_grabbed = gAgent.isControlGrabbed(CONTROL_ML_LBUTTON_DOWN_INDEX) || gAgent.isControlGrabbed(CONTROL_ML_LBUTTON_UP_INDEX); - button = LLUICtrlFactory::getButtonByName(this, "Mouselook"); + button = getChild<LLButton>("Mouselook"); if (button && button->getVisible() != mouselook_grabbed) { @@ -249,7 +239,7 @@ void LLOverlayBar::refresh() { sitting = gAgent.getAvatarObject()->mIsSitting; } - button = LLUICtrlFactory::getButtonByName(this, "Stand Up"); + button = getChild<LLButton>("Stand Up"); if (button && button->getVisible() != sitting) { @@ -326,7 +316,7 @@ void LLOverlayBar::onClickMouselook(void*) //static void LLOverlayBar::onClickStandUp(void*) { - gSelectMgr->deselectAllForStandingUp(); + LLSelectMgr::getInstance()->deselectAllForStandingUp(); gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); } @@ -361,7 +351,7 @@ void LLOverlayBar::toggleMediaPlay(void*) } else { - LLParcel* parcel = gParcelMgr->getAgentParcel(); + LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if (parcel) { LLViewerParcelMedia::play(parcel); @@ -382,7 +372,7 @@ void LLOverlayBar::toggleMusicPlay(void*) gOverlayBar->mMusicState = PLAYING; // desired state if (gAudiop) { - LLParcel* parcel = gParcelMgr->getAgentParcel(); + LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if ( parcel ) { // this doesn't work properly when crossing parcel boundaries - even when the diff --git a/indra/newview/lloverlaybar.h b/indra/newview/lloverlaybar.h index 4fb438a712..06b39aa23a 100644 --- a/indra/newview/lloverlaybar.h +++ b/indra/newview/lloverlaybar.h @@ -57,9 +57,6 @@ public: LLOverlayBar(); ~LLOverlayBar(); - virtual EWidgetType getWidgetType() const; - virtual LLString getWidgetTag() const; - /*virtual*/ void refresh(); /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent); /*virtual*/ BOOL postBuild(); diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index 9a0eef9a10..94bf17f531 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -74,14 +74,13 @@ #include "llviewergenericmessage.h" // send_generic_message #include "llviewerobjectlist.h" #include "llviewerregion.h" -#include "llviewborder.h" #include "llweb.h" #include "llinventorymodel.h" #include "roles_constants.h" #define kArraySize( _kArray ) ( sizeof( (_kArray) ) / sizeof( _kArray[0] ) ) -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" // Statics std::list<LLPanelAvatar*> LLPanelAvatar::sAllPanels; @@ -104,9 +103,6 @@ public: LLDropTarget(const std::string& name, const LLRect& rect, const LLUUID& agent_id); ~LLDropTarget(); - virtual EWidgetType getWidgetType() const; - virtual LLString getWidgetTag() const; - void doDrop(EDragAndDropType cargo_type, void* cargo_data); // @@ -133,16 +129,6 @@ LLDropTarget::~LLDropTarget() { } -EWidgetType LLDropTarget::getWidgetType() const -{ - return WIDGET_TYPE_DROP_TARGET; -} - -LLString LLDropTarget::getWidgetTag() const -{ - return LL_DROP_TARGET_TAG; -} - void LLDropTarget::doDrop(EDragAndDropType cargo_type, void* cargo_data) { llinfos << "LLDropTarget::doDrop()" << llendl; @@ -243,12 +229,9 @@ LLPanelAvatarTab::LLPanelAvatarTab(const std::string& name, const LLRect &rect, // virtual void LLPanelAvatarTab::draw() { - if (getVisible()) - { - refresh(); + refresh(); - LLPanel::draw(); - } + LLPanel::draw(); } void LLPanelAvatarTab::sendAvatarProfileRequestIfNeeded(const char* method) @@ -314,12 +297,12 @@ void LLPanelAvatarSecondLife::clearControls() mPartnerID = LLUUID::null; - LLScrollListCtrl* group_list = LLUICtrlFactory::getScrollListByName(this,"groups"); + LLScrollListCtrl* group_list = getChild<LLScrollListCtrl>("groups"); if(group_list) { group_list->deleteAllItems(); } - LLScrollListCtrl* ratings_list = LLUICtrlFactory::getScrollListByName(this,"ratings"); + LLScrollListCtrl* ratings_list = getChild<LLScrollListCtrl>("ratings"); if(ratings_list) { ratings_list->deleteAllItems(); @@ -339,15 +322,6 @@ void LLPanelAvatarSecondLife::enableControls(BOOL self) childSetEnabled("allow_publish", self); childSetVisible("?", self); childSetEnabled("?", self); - - if (!self) - { - // This is because the LLTextEditor - // appears to reset the read only background color when - // setEnable is called, for some reason - LLTextEditor* about = LLUICtrlFactory::getTextEditorByName(this,"about"); - if (about) about->setReadOnlyBgColor(LLColor4::transparent); - } } @@ -361,7 +335,7 @@ void LLPanelAvatarSecondLife::onDoubleClickGroup(void* data) LLPanelAvatarSecondLife* self = (LLPanelAvatarSecondLife*)data; - LLScrollListCtrl* group_list = LLUICtrlFactory::getScrollListByName(self,"groups"); + LLScrollListCtrl* group_list = self->getChild<LLScrollListCtrl>("groups"); if(group_list) { LLScrollListItem* item = group_list->getFirstSelected(); @@ -478,7 +452,7 @@ BOOL LLPanelAvatarNotes::postBuild(void) { childSetCommitCallback("notes edit",onCommitNotes,this); - LLTextEditor* te = LLUICtrlFactory::getTextEditorByName(this,"notes edit"); + LLTextEditor* te = getChild<LLTextEditor>("notes edit"); if(te) te->setCommitOnFocusLost(TRUE); return TRUE; } @@ -529,7 +503,7 @@ BOOL LLPanelAvatarAdvanced::postBuild() for(S32 tt=0; tt < mWantToCount; ++tt) { LLString ctlname = llformat("chk%d", tt); - mWantToCheck[tt] = LLUICtrlFactory::getCheckBoxByName(this,ctlname); + mWantToCheck[tt] = getChild<LLCheckBoxCtrl>(ctlname); } mSkillsCount = (6>kArraySize(mSkillsCheck))?kArraySize(mSkillsCheck):6; @@ -537,11 +511,11 @@ BOOL LLPanelAvatarAdvanced::postBuild() { //Find the Skills checkboxes and save off thier controls LLString ctlname = llformat("schk%d",tt); - mSkillsCheck[tt] = LLUICtrlFactory::getCheckBoxByName(this,ctlname); + mSkillsCheck[tt] = getChild<LLCheckBoxCtrl>(ctlname); } - mWantToEdit = LLUICtrlFactory::getLineEditorByName(this,"want_to_edit"); - mSkillsEdit = LLUICtrlFactory::getLineEditorByName(this,"skills_edit"); + mWantToEdit = getChild<LLLineEditor>("want_to_edit"); + mSkillsEdit = getChild<LLLineEditor>("skills_edit"); childSetVisible("skills_edit",LLPanelAvatar::sAllowFirstLife); childSetVisible("want_to_edit",LLPanelAvatar::sAllowFirstLife); @@ -717,17 +691,6 @@ void LLPanelAvatarAdvanced::enableControls(BOOL self) if (mWantToEdit) mWantToEdit->setEnabled(self); if (mSkillsEdit) mSkillsEdit->setEnabled(self); childSetEnabled("languages_edit",self); - - if (!self) - { - // This is because the LLTextEditor - // appears to reset the read only background color when - // setEnable is called, for some reason - if (mWantToEdit) mWantToEdit->setReadOnlyBgColor(LLColor4::transparent); - if (mSkillsEdit) mSkillsEdit->setReadOnlyBgColor(LLColor4::transparent); - LLLineEditor* languages_edit = getChild<LLLineEditor>("languages_edit"); - languages_edit->setReadOnlyBgColor(LLColor4::transparent); - } } void LLPanelAvatarAdvanced::setWantSkills(U32 want_to_mask, const std::string& want_to_text, @@ -828,7 +791,7 @@ void LLPanelAvatarClassified::refresh() { BOOL self = (gAgent.getID() == getPanelAvatar()->getAvatarID()); - LLTabContainer* tabs = LLUICtrlFactory::getTabContainerByName(this,"classified tab"); + LLTabContainer* tabs = getChild<LLTabContainer>("classified tab"); S32 tab_count = tabs ? tabs->getTabCount() : 0; @@ -862,7 +825,7 @@ void LLPanelAvatarClassified::refresh() BOOL LLPanelAvatarClassified::canClose() { - LLTabContainer* tabs = LLViewerUICtrlFactory::getTabContainerByName(this, "classified tab"); + LLTabContainer* tabs = getChild<LLTabContainer>("classified tab"); for (S32 i = 0; i < tabs->getTabCount(); i++) { LLPanelClassified* panel = (LLPanelClassified*)tabs->getPanelByIndex(i); @@ -876,7 +839,7 @@ BOOL LLPanelAvatarClassified::canClose() BOOL LLPanelAvatarClassified::titleIsValid() { - LLTabContainer* tabs = LLViewerUICtrlFactory::getTabContainerByName(this, "classified tab"); + LLTabContainer* tabs = getChild<LLTabContainer>("classified tab"); if ( tabs ) { LLPanelClassified* panel = (LLPanelClassified*)tabs->getCurrentPanel(); @@ -894,7 +857,7 @@ BOOL LLPanelAvatarClassified::titleIsValid() void LLPanelAvatarClassified::apply() { - LLTabContainer* tabs = LLViewerUICtrlFactory::getTabContainerByName(this, "classified tab"); + LLTabContainer* tabs = getChild<LLTabContainer>("classified tab"); for (S32 i = 0; i < tabs->getTabCount(); i++) { LLPanelClassified* panel = (LLPanelClassified*)tabs->getPanelByIndex(i); @@ -905,7 +868,7 @@ void LLPanelAvatarClassified::apply() void LLPanelAvatarClassified::deleteClassifiedPanels() { - LLTabContainer* tabs = LLViewerUICtrlFactory::getTabContainerByName(this,"classified tab"); + LLTabContainer* tabs = getChild<LLTabContainer>("classified tab"); if (tabs) { tabs->deleteAllTabs(); @@ -925,7 +888,7 @@ void LLPanelAvatarClassified::processAvatarClassifiedReply(LLMessageSystem* msg, char classified_name[DB_PICK_NAME_SIZE]; /*Flawfinder: ignore*/ LLPanelClassified* panel_classified = NULL; - LLTabContainer* tabs = LLViewerUICtrlFactory::getTabContainerByName(this,"classified tab"); + LLTabContainer* tabs = getChild<LLTabContainer>("classified tab"); // Don't remove old panels. We need to be able to process multiple // packets for people who have lots of classifieds. JC @@ -983,7 +946,7 @@ void LLPanelAvatarClassified::callbackNew(S32 option, void* data) { LLPanelClassified* panel_classified = new LLPanelClassified(false, false); panel_classified->initNewClassified(); - LLTabContainer* tabs = LLViewerUICtrlFactory::getTabContainerByName(self,"classified tab"); + LLTabContainer* tabs = self->getChild<LLTabContainer>("classified tab"); if(tabs) { tabs->addTabPanel(panel_classified, panel_classified->getClassifiedName()); @@ -998,7 +961,7 @@ void LLPanelAvatarClassified::onClickDelete(void* data) { LLPanelAvatarClassified* self = (LLPanelAvatarClassified*)data; - LLTabContainer* tabs = LLViewerUICtrlFactory::getTabContainerByName(self,"classified tab"); + LLTabContainer* tabs = self->getChild<LLTabContainer>("classified tab"); LLPanelClassified* panel_classified = NULL; if(tabs) { @@ -1017,7 +980,7 @@ void LLPanelAvatarClassified::onClickDelete(void* data) void LLPanelAvatarClassified::callbackDelete(S32 option, void* data) { LLPanelAvatarClassified* self = (LLPanelAvatarClassified*)data; - LLTabContainer* tabs = LLViewerUICtrlFactory::getTabContainerByName(self,"classified tab"); + LLTabContainer* tabs = self->getChild<LLTabContainer>("classified tab"); LLPanelClassified* panel_classified=NULL; if(tabs) { @@ -1062,7 +1025,7 @@ LLPanelAvatarPicks::LLPanelAvatarPicks(const std::string& name, void LLPanelAvatarPicks::refresh() { BOOL self = (gAgent.getID() == getPanelAvatar()->getAvatarID()); - LLTabContainer* tabs = LLViewerUICtrlFactory::getTabContainerByName(this,"picks tab"); + LLTabContainer* tabs = getChild<LLTabContainer>("picks tab"); S32 tab_count = tabs ? tabs->getTabCount() : 0; childSetEnabled("New...", self && tab_count < MAX_AVATAR_PICKS); childSetEnabled("Delete...", self && tab_count > 0); @@ -1075,7 +1038,7 @@ void LLPanelAvatarPicks::refresh() void LLPanelAvatarPicks::deletePickPanels() { - LLTabContainer* tabs = LLUICtrlFactory::getTabContainerByName(this,"picks tab"); + LLTabContainer* tabs = getChild<LLTabContainer>("picks tab"); if(tabs) { tabs->deleteAllTabs(); @@ -1094,7 +1057,7 @@ void LLPanelAvatarPicks::processAvatarPicksReply(LLMessageSystem* msg, void**) char pick_name[DB_PICK_NAME_SIZE]; /*Flawfinder: ignore*/ LLPanelPick* panel_pick = NULL; - LLTabContainer* tabs = LLUICtrlFactory::getTabContainerByName(this,"picks tab"); + LLTabContainer* tabs = getChild<LLTabContainer>("picks tab"); // Clear out all the old panels. We'll replace them with the correct // number of new panels. @@ -1144,7 +1107,7 @@ void LLPanelAvatarPicks::onClickNew(void* data) { LLPanelAvatarPicks* self = (LLPanelAvatarPicks*)data; LLPanelPick* panel_pick = new LLPanelPick(FALSE); - LLTabContainer* tabs = LLUICtrlFactory::getTabContainerByName(self,"picks tab"); + LLTabContainer* tabs = self->getChild<LLTabContainer>("picks tab"); panel_pick->initNewPick(); if(tabs) @@ -1159,7 +1122,7 @@ void LLPanelAvatarPicks::onClickNew(void* data) void LLPanelAvatarPicks::onClickDelete(void* data) { LLPanelAvatarPicks* self = (LLPanelAvatarPicks*)data; - LLTabContainer* tabs = LLUICtrlFactory::getTabContainerByName(self,"picks tab"); + LLTabContainer* tabs = self->getChild<LLTabContainer>("picks tab"); LLPanelPick* panel_pick = tabs?(LLPanelPick*)tabs->getCurrentPanel():NULL; if (!panel_pick) return; @@ -1177,7 +1140,7 @@ void LLPanelAvatarPicks::onClickDelete(void* data) void LLPanelAvatarPicks::callbackDelete(S32 option, void* data) { LLPanelAvatarPicks* self = (LLPanelAvatarPicks*)data; - LLTabContainer* tabs = LLUICtrlFactory::getTabContainerByName(self,"picks tab"); + LLTabContainer* tabs = self->getChild<LLTabContainer>("picks tab"); LLPanelPick* panel_pick = tabs?(LLPanelPick*)tabs->getCurrentPanel():NULL; LLMessageSystem* msg = gMessageSystem; @@ -1257,7 +1220,7 @@ LLPanelAvatar::LLPanelAvatar( factory_map["1st Life"] = LLCallbackMap(createPanelAvatarFirstLife, this); factory_map["My Notes"] = LLCallbackMap(createPanelAvatarNotes, this); - gUICtrlFactory->buildPanel(this, "panel_avatar.xml", &factory_map); + LLUICtrlFactory::getInstance()->buildPanel(this, "panel_avatar.xml", &factory_map); selectTab(0); @@ -1266,7 +1229,7 @@ LLPanelAvatar::LLPanelAvatar( BOOL LLPanelAvatar::postBuild(void) { - mTab = LLUICtrlFactory::getTabContainerByName(this,"tab"); + mTab = getChild<LLTabContainer>("tab"); childSetAction("Kick",onClickKick,this); childSetAction("Freeze",onClickFreeze, this); childSetAction("Unfreeze", onClickUnfreeze, this); @@ -1406,7 +1369,7 @@ void LLPanelAvatar::setAvatarID(const LLUUID &avatar_id, const LLString &name, mDropTarget->setAgentID(mAvatarID); } - LLNameEditor* name_edit = LLViewerUICtrlFactory::getNameEditorByName(this, "name"); + LLNameEditor* name_edit = getChild<LLNameEditor>("name"); if(name_edit) { if (name.empty()) @@ -1535,7 +1498,7 @@ void LLPanelAvatar::resetGroupList() if (mPanelSecondLife) { - LLScrollListCtrl* group_list = LLUICtrlFactory::getScrollListByName(mPanelSecondLife,"groups"); + LLScrollListCtrl* group_list = mPanelSecondLife->getChild<LLScrollListCtrl>("groups"); if (group_list) { group_list->deleteAllItems(); @@ -1584,7 +1547,7 @@ void LLPanelAvatar::onClickIM(void* userdata) gIMMgr->setFloaterOpen(TRUE); std::string name; - LLNameEditor* nameedit = LLViewerUICtrlFactory::getNameEditorByName(self->mPanelSecondLife, "name"); + LLNameEditor* nameedit = self->mPanelSecondLife->getChild<LLNameEditor>("name"); if (nameedit) name = nameedit->getText(); gIMMgr->addSession(name, IM_NOTHING_SPECIAL, self->mAvatarID); } @@ -1601,7 +1564,7 @@ void LLPanelAvatar::onClickTrack(void* userdata) if( gFloaterWorldMap ) { std::string name; - LLNameEditor* nameedit = LLViewerUICtrlFactory::getNameEditorByName(self->mPanelSecondLife, "name"); + LLNameEditor* nameedit = self->mPanelSecondLife->getChild<LLNameEditor>("name"); if (nameedit) name = nameedit->getText(); gFloaterWorldMap->trackAvatar(self->mAvatarID, name); LLFloaterWorldMap::show(NULL, TRUE); @@ -1613,7 +1576,7 @@ void LLPanelAvatar::onClickTrack(void* userdata) void LLPanelAvatar::onClickAddFriend(void* userdata) { LLPanelAvatar* self = (LLPanelAvatar*) userdata; - LLNameEditor* name_edit = LLViewerUICtrlFactory::getNameEditorByName(self->mPanelSecondLife, "name"); + LLNameEditor* name_edit = self->mPanelSecondLife->getChild<LLNameEditor>("name"); if (name_edit) { LLPanelFriends::requestFriendshipDialog(self->getAvatarID(), @@ -1629,21 +1592,21 @@ void LLPanelAvatar::onClickMute(void *userdata) LLPanelAvatar* self = (LLPanelAvatar*) userdata; LLUUID agent_id = self->getAvatarID(); - LLNameEditor* name_edit = LLViewerUICtrlFactory::getNameEditorByName(self->mPanelSecondLife, "name"); + LLNameEditor* name_edit = self->mPanelSecondLife->getChild<LLNameEditor>("name"); if (name_edit) { std::string agent_name = name_edit->getText(); LLFloaterMute::showInstance(); - if (gMuteListp->isMuted(agent_id)) + if (LLMuteList::getInstance()->isMuted(agent_id)) { - gFloaterMute->selectMute(agent_id); + LLFloaterMute::getInstance()->selectMute(agent_id); } else { LLMute mute(agent_id, agent_name, LLMute::AGENT); - gMuteListp->add(mute); + LLMuteList::getInstance()->add(mute); } } } @@ -1679,7 +1642,7 @@ void LLPanelAvatar::onClickOK(void *userdata) { self->sendAvatarPropertiesUpdate(); - LLTabContainer* tabs = LLUICtrlFactory::getTabContainerByName(self,"tab"); + LLTabContainer* tabs = self->getChild<LLTabContainer>("tab"); if ( tabs->getCurrentPanel() != self->mPanelClassified ) { self->mPanelClassified->apply(); @@ -1984,7 +1947,7 @@ void LLPanelAvatar::processAvatarGroupsReply(LLMessageSystem *msg, void**) continue; } - LLScrollListCtrl* group_list = LLUICtrlFactory::getScrollListByName(self->mPanelSecondLife,"groups"); + LLScrollListCtrl* group_list = self->mPanelSecondLife->getChild<LLScrollListCtrl>("groups"); // if(group_list) // { // group_list->deleteAllItems(); @@ -2316,7 +2279,7 @@ void LLPanelAvatar::onClickCSR(void* userdata) LLPanelAvatar* self = (LLPanelAvatar*)userdata; if (!self) return; - LLNameEditor* name_edit = LLViewerUICtrlFactory::getNameEditorByName(self, "name"); + LLNameEditor* name_edit = self->getChild<LLNameEditor>("name"); if (!name_edit) return; LLString name = name_edit->getText(); diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp index fcf3eea7eb..560ed1768d 100644 --- a/indra/newview/llpanelclassified.cpp +++ b/indra/newview/llpanelclassified.cpp @@ -60,7 +60,7 @@ #include "lltexturectrl.h" #include "lluiconstants.h" #include "llurldispatcher.h" // for classified HTML detail click teleports -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llviewerparcelmgr.h" #include "llviewerwindow.h" #include "llworldmap.h" @@ -184,11 +184,11 @@ LLPanelClassified::LLPanelClassified(bool in_finder, bool from_search) std::string classified_def_file; if (mInFinder) { - gUICtrlFactory->buildPanel(this, "panel_classified.xml"); + LLUICtrlFactory::getInstance()->buildPanel(this, "panel_classified.xml"); } else { - gUICtrlFactory->buildPanel(this, "panel_avatar_classified.xml"); + LLUICtrlFactory::getInstance()->buildPanel(this, "panel_avatar_classified.xml"); } // Register dispatcher @@ -223,12 +223,12 @@ void LLPanelClassified::reset() BOOL LLPanelClassified::postBuild() { - mSnapshotCtrl = LLViewerUICtrlFactory::getTexturePickerByName(this, "snapshot_ctrl"); + mSnapshotCtrl = getChild<LLTextureCtrl>("snapshot_ctrl"); mSnapshotCtrl->setCommitCallback(onCommitAny); mSnapshotCtrl->setCallbackUserData(this); mSnapshotSize = mSnapshotCtrl->getRect(); - mNameEditor = LLViewerUICtrlFactory::getLineEditorByName(this, "given_name_editor"); + mNameEditor = getChild<LLLineEditor>("given_name_editor"); mNameEditor->setMaxTextLength(DB_PARCEL_NAME_LEN); mNameEditor->setCommitOnFocusLost(TRUE); mNameEditor->setFocusReceivedCallback(onFocusReceived, this); @@ -236,35 +236,35 @@ BOOL LLPanelClassified::postBuild() mNameEditor->setCallbackUserData(this); mNameEditor->setPrevalidate( LLLineEditor::prevalidateASCII ); - mDescEditor = LLUICtrlFactory::getTextEditorByName(this, "desc_editor"); + mDescEditor = getChild<LLTextEditor>("desc_editor"); mDescEditor->setCommitOnFocusLost(TRUE); mDescEditor->setFocusReceivedCallback(onFocusReceived, this); mDescEditor->setCommitCallback(onCommitAny); mDescEditor->setCallbackUserData(this); mDescEditor->setTabsToNextField(TRUE); - mLocationEditor = LLViewerUICtrlFactory::getLineEditorByName(this, "location_editor"); + mLocationEditor = getChild<LLLineEditor>("location_editor"); - mSetBtn = LLViewerUICtrlFactory::getButtonByName(this, "set_location_btn"); + mSetBtn = getChild<LLButton>( "set_location_btn"); mSetBtn->setClickedCallback(onClickSet); mSetBtn->setCallbackUserData(this); - mTeleportBtn = LLViewerUICtrlFactory::getButtonByName(this, "classified_teleport_btn"); + mTeleportBtn = getChild<LLButton>( "classified_teleport_btn"); mTeleportBtn->setClickedCallback(onClickTeleport); mTeleportBtn->setCallbackUserData(this); - mMapBtn = LLViewerUICtrlFactory::getButtonByName(this, "classified_map_btn"); + mMapBtn = getChild<LLButton>( "classified_map_btn"); mMapBtn->setClickedCallback(onClickMap); mMapBtn->setCallbackUserData(this); if(mInFinder) { - mProfileBtn = LLViewerUICtrlFactory::getButtonByName(this, "classified_profile_btn"); + mProfileBtn = getChild<LLButton>( "classified_profile_btn"); mProfileBtn->setClickedCallback(onClickProfile); mProfileBtn->setCallbackUserData(this); } - mCategoryCombo = LLViewerUICtrlFactory::getComboBoxByName(this, "classified_category_combo"); + mCategoryCombo = getChild<LLComboBox>( "classified_category_combo"); LLClassifiedInfo::cat_map::iterator iter; for (iter = LLClassifiedInfo::sCategories.begin(); iter != LLClassifiedInfo::sCategories.end(); @@ -276,7 +276,7 @@ BOOL LLPanelClassified::postBuild() mCategoryCombo->setCommitCallback(onCommitAny); mCategoryCombo->setCallbackUserData(this); - mMatureCheck = LLViewerUICtrlFactory::getCheckBoxByName(this, "classified_mature_check"); + mMatureCheck = getChild<LLCheckBoxCtrl>( "classified_mature_check"); mMatureCheck->setCommitCallback(onCommitAny); mMatureCheck->setCallbackUserData(this); if (gAgent.isTeen()) @@ -287,18 +287,18 @@ BOOL LLPanelClassified::postBuild() if (!mInFinder) { - mAutoRenewCheck = LLUICtrlFactory::getCheckBoxByName(this, "auto_renew_check"); + mAutoRenewCheck = getChild<LLCheckBoxCtrl>( "auto_renew_check"); mAutoRenewCheck->setCommitCallback(onCommitAny); mAutoRenewCheck->setCallbackUserData(this); } - mUpdateBtn = LLUICtrlFactory::getButtonByName(this, "classified_update_btn"); + mUpdateBtn = getChild<LLButton>("classified_update_btn"); mUpdateBtn->setClickedCallback(onClickUpdate); mUpdateBtn->setCallbackUserData(this); if (!mInFinder) { - mClickThroughText = LLUICtrlFactory::getTextBoxByName(this, "click_through_text"); + mClickThroughText = getChild<LLTextBox>("click_through_text"); } return TRUE; @@ -351,10 +351,10 @@ void LLPanelClassified::saveCallback(S32 option, void* data) LLView* view = self; while (view) { - if (view->getWidgetType() == WIDGET_TYPE_FLOATER) + LLFloater* floaterp = dynamic_cast<LLFloater*>(view); + if (floaterp) { - LLFloater* f = (LLFloater*)view; - f->close(); + floaterp->close(); break; } view = view->getParent(); @@ -393,7 +393,7 @@ void LLPanelClassified::initNewClassified() mPaidFor = FALSE; // Try to fill in the current parcel - LLParcel* parcel = gParcelMgr->getAgentParcel(); + LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if (parcel) { mNameEditor->setText(parcel->getName()); @@ -674,17 +674,16 @@ void LLPanelClassified::processClassifiedInfoReply(LLMessageSystem *msg, void ** self->mUpdateBtn->setLabel(self->getString("update_txt")); self->resetDirty(); + + self->resetDirty(); } } void LLPanelClassified::draw() { - if (getVisible()) - { - refresh(); + refresh(); - LLPanel::draw(); - } + LLPanel::draw(); } @@ -709,12 +708,13 @@ void LLPanelClassified::refresh() if(godlike) { //make it smaller, so text is more legible - mSnapshotCtrl->setRect(LLRect(20, 375, 320, 175)); - + mSnapshotCtrl->setOrigin(20, 175); + mSnapshotCtrl->reshape(300, 200); } else { - mSnapshotCtrl->setRect(mSnapshotSize); + mSnapshotCtrl->setOrigin(mSnapshotSize.mLeft, mSnapshotSize.mBottom); + mSnapshotCtrl->reshape(mSnapshotSize.getWidth(), mSnapshotSize.getHeight()); //normal } mNameEditor->setEnabled(godlike); @@ -1004,7 +1004,7 @@ LLFloaterPriceForListing::~LLFloaterPriceForListing() //virtual BOOL LLFloaterPriceForListing::postBuild() { - LLLineEditor* edit = LLUICtrlFactory::getLineEditorByName(this, "price_edit"); + LLLineEditor* edit = getChild<LLLineEditor>("price_edit"); if (edit) { edit->setPrevalidate(LLLineEditor::prevalidateNonNegativeS32); @@ -1028,7 +1028,7 @@ void LLFloaterPriceForListing::show( void (*callback)(S32, LLString, void*), voi LLFloaterPriceForListing *self = new LLFloaterPriceForListing(); // Builds and adds to gFloaterView - gUICtrlFactory->buildFloater(self, "floater_price_for_listing.xml"); + LLUICtrlFactory::getInstance()->buildFloater(self, "floater_price_for_listing.xml"); self->center(); self->mCallback = callback; diff --git a/indra/newview/llpanelcontents.cpp b/indra/newview/llpanelcontents.cpp index fa7cdfbc97..e76a3dd554 100644 --- a/indra/newview/llpanelcontents.cpp +++ b/indra/newview/llpanelcontents.cpp @@ -109,20 +109,20 @@ void LLPanelContents::getState(LLViewerObject *objectp ) } LLUUID group_id; // used for SL-23488 - gSelectMgr->selectGetGroup(group_id); // sets group_id as a side effect SL-23488 + LLSelectMgr::getInstance()->selectGetGroup(group_id); // sets group_id as a side effect SL-23488 // BUG? Check for all objects being editable? BOOL editable = gAgent.isGodlike() || (objectp->permModify() && ( objectp->permYouOwner() || ( !group_id.isNull() && gAgent.isInGroup(group_id) ))); // solves SL-23488 - BOOL all_volume = gSelectMgr->selectionAllPCode( LL_PCODE_VOLUME ); + BOOL all_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ); // Edit script button - ok if object is editable and there's an // unambiguous destination for the object. if( editable && all_volume && - ((gSelectMgr->getSelection()->getRootObjectCount() == 1) - || (gSelectMgr->getSelection()->getObjectCount() == 1))) + ((LLSelectMgr::getInstance()->getSelection()->getRootObjectCount() == 1) + || (LLSelectMgr::getInstance()->getSelection()->getObjectCount() == 1))) { //mBtnNewScript->setEnabled(TRUE); childSetEnabled("button new script",TRUE); @@ -138,7 +138,7 @@ void LLPanelContents::getState(LLViewerObject *objectp ) void LLPanelContents::refresh() { const BOOL children_ok = TRUE; - LLViewerObject* object = gSelectMgr->getSelection()->getFirstRootObject(children_ok); + LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject(children_ok); getState(object); if (mPanelInventory) @@ -157,7 +157,7 @@ void LLPanelContents::refresh() void LLPanelContents::onClickNewScript(void *userdata) { const BOOL children_ok = TRUE; - LLViewerObject* object = gSelectMgr->getSelection()->getFirstRootObject(children_ok); + LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject(children_ok); if(object) { LLPermissions perm; diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index b87d18a545..8cc7844c0f 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -60,7 +60,7 @@ #include "llviewermedia.h" #include "llviewerobject.h" #include "llviewerstats.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" // // Methods @@ -100,7 +100,7 @@ BOOL LLPanelFace::postBuild() // Allow any texture to be used during non-immediate mode. mTextureCtrl->setNonImmediateFilterPermMask(PERM_NONE); LLAggregatePermissions texture_perms; - if (gSelectMgr->selectGetAggregateTexturePermissions(texture_perms)) + if (LLSelectMgr::getInstance()->selectGetAggregateTexturePermissions(texture_perms)) { BOOL can_copy = texture_perms.getValue(PERM_COPY) == LLAggregatePermissions::AP_EMPTY || @@ -128,14 +128,14 @@ BOOL LLPanelFace::postBuild() mColorSwatch->setCanApplyImmediately(TRUE); } - mLabelColorTransp = LLUICtrlFactory::getTextBoxByName(this,"color trans"); + mLabelColorTransp = getChild<LLTextBox>("color trans"); if(mLabelColorTransp) { mLabelColorTransp->setFollowsTop(); mLabelColorTransp->setFollowsLeft(); } - mCtrlColorTransp = LLUICtrlFactory::getSpinnerByName(this,"ColorTrans"); + mCtrlColorTransp = getChild<LLSpinCtrl>("ColorTrans"); if(mCtrlColorTransp) { mCtrlColorTransp->setCommitCallback(LLPanelFace::onCommitAlpha); @@ -145,14 +145,14 @@ BOOL LLPanelFace::postBuild() mCtrlColorTransp->setFollowsLeft(); } - mCheckFullbright = LLUICtrlFactory::getCheckBoxByName(this,"checkbox fullbright"); + mCheckFullbright = getChild<LLCheckBoxCtrl>("checkbox fullbright"); if (mCheckFullbright) { mCheckFullbright->setCommitCallback(LLPanelFace::onCommitFullbright); mCheckFullbright->setCallbackUserData( this ); } - mLabelTexGen = LLUICtrlFactory::getTextBoxByName(this,"tex gen"); - mComboTexGen = LLUICtrlFactory::getComboBoxByName(this,"combobox texgen"); + mLabelTexGen = getChild<LLTextBox>("tex gen"); + mComboTexGen = getChild<LLComboBox>("combobox texgen"); if(mComboTexGen) { mComboTexGen->setCommitCallback(LLPanelFace::onCommitTexGen); @@ -160,8 +160,8 @@ BOOL LLPanelFace::postBuild() mComboTexGen->setCallbackUserData( this ); } - mLabelGlow = LLUICtrlFactory::getTextBoxByName(this,"glow label"); - mCtrlGlow = LLUICtrlFactory::getSpinnerByName(this,"glow"); + mLabelGlow = getChild<LLTextBox>("glow label"); + mCtrlGlow = getChild<LLSpinCtrl>("glow"); if(mCtrlGlow) { mCtrlGlow->setCommitCallback(LLPanelFace::onCommitGlow); @@ -210,69 +210,68 @@ void LLPanelFace::sendTexture() { id = mTextureCtrl->getImageAssetID(); } - gSelectMgr->selectionSetImage(id); + LLSelectMgr::getInstance()->selectionSetImage(id); } } void LLPanelFace::sendBump() { - LLComboBox* mComboBumpiness = gUICtrlFactory->getComboBoxByName(this,"combobox bumpiness"); + LLComboBox* mComboBumpiness = getChild<LLComboBox>("combobox bumpiness"); if(!mComboBumpiness)return; U8 bump = (U8) mComboBumpiness->getCurrentIndex() & TEM_BUMP_MASK; - gSelectMgr->selectionSetBumpmap( bump ); + LLSelectMgr::getInstance()->selectionSetBumpmap( bump ); } void LLPanelFace::sendTexGen() { - LLComboBox* mComboTexGen = gUICtrlFactory->getComboBoxByName(this,"combobox texgen"); + LLComboBox* mComboTexGen = getChild<LLComboBox>("combobox texgen"); if(!mComboTexGen)return; U8 tex_gen = (U8) mComboTexGen->getCurrentIndex() << TEM_TEX_GEN_SHIFT; - gSelectMgr->selectionSetTexGen( tex_gen ); + LLSelectMgr::getInstance()->selectionSetTexGen( tex_gen ); } void LLPanelFace::sendShiny() { - LLComboBox* mComboShininess = gUICtrlFactory->getComboBoxByName(this,"combobox shininess"); + LLComboBox* mComboShininess = getChild<LLComboBox>("combobox shininess"); if(!mComboShininess)return; U8 shiny = (U8) mComboShininess->getCurrentIndex() & TEM_SHINY_MASK; - gSelectMgr->selectionSetShiny( shiny ); + LLSelectMgr::getInstance()->selectionSetShiny( shiny ); } void LLPanelFace::sendFullbright() { - LLCheckBoxCtrl* mCheckFullbright = gUICtrlFactory->getCheckBoxByName(this,"checkbox fullbright"); + LLCheckBoxCtrl* mCheckFullbright = getChild<LLCheckBoxCtrl>("checkbox fullbright"); if(!mCheckFullbright)return; U8 fullbright = mCheckFullbright->get() ? TEM_FULLBRIGHT_MASK : 0; - gSelectMgr->selectionSetFullbright( fullbright ); + LLSelectMgr::getInstance()->selectionSetFullbright( fullbright ); } void LLPanelFace::sendColor() { - LLColorSwatchCtrl* mColorSwatch = LLViewerUICtrlFactory::getColorSwatchByName(this,"colorswatch"); + LLColorSwatchCtrl* mColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch"); if(!mColorSwatch)return; LLColor4 color = mColorSwatch->get(); - gSelectMgr->selectionSetColorOnly( color ); + LLSelectMgr::getInstance()->selectionSetColorOnly( color ); } void LLPanelFace::sendAlpha() { - LLSpinCtrl* mCtrlColorTransp = LLViewerUICtrlFactory::getSpinnerByName(this,"ColorTrans"); + LLSpinCtrl* mCtrlColorTransp = getChild<LLSpinCtrl>("ColorTrans"); if(!mCtrlColorTransp)return; F32 alpha = (100.f - mCtrlColorTransp->get()) / 100.f; - gSelectMgr->selectionSetAlphaOnly( alpha ); + LLSelectMgr::getInstance()->selectionSetAlphaOnly( alpha ); } void LLPanelFace::sendGlow() { - LLSpinCtrl* mCtrlGlow = LLViewerUICtrlFactory::getSpinnerByName(this,"glow"); - if(!mCtrlGlow)return; + LLSpinCtrl* mCtrlGlow = getChild<LLSpinCtrl>("glow"); F32 glow = mCtrlGlow->get(); - gSelectMgr->selectionSetGlow( glow ); + LLSelectMgr::getInstance()->selectionSetGlow( glow ); } struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor @@ -282,14 +281,14 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor { BOOL valid; F32 value; - LLSpinCtrl* ctrlTexScaleS = LLViewerUICtrlFactory::getSpinnerByName(mPanel,"TexScaleU"); - LLSpinCtrl* ctrlTexScaleT = LLViewerUICtrlFactory::getSpinnerByName(mPanel,"TexScaleV"); - LLSpinCtrl* ctrlTexOffsetS = LLViewerUICtrlFactory::getSpinnerByName(mPanel,"TexOffsetU"); - LLSpinCtrl* ctrlTexOffsetT = LLViewerUICtrlFactory::getSpinnerByName(mPanel,"TexOffsetV"); - LLSpinCtrl* ctrlTexRotation = LLViewerUICtrlFactory::getSpinnerByName(mPanel,"TexRot"); - LLCheckBoxCtrl* checkFlipScaleS = LLViewerUICtrlFactory::getCheckBoxByName(mPanel,"checkbox flip s"); - LLCheckBoxCtrl* checkFlipScaleT = LLViewerUICtrlFactory::getCheckBoxByName(mPanel,"checkbox flip t"); - LLComboBox* comboTexGen = LLViewerUICtrlFactory::getComboBoxByName(mPanel,"combobox texgen"); + LLSpinCtrl* ctrlTexScaleS = mPanel->getChild<LLSpinCtrl>("TexScaleU"); + LLSpinCtrl* ctrlTexScaleT = mPanel->getChild<LLSpinCtrl>("TexScaleV"); + LLSpinCtrl* ctrlTexOffsetS = mPanel->getChild<LLSpinCtrl>("TexOffsetU"); + LLSpinCtrl* ctrlTexOffsetT = mPanel->getChild<LLSpinCtrl>("TexOffsetV"); + LLSpinCtrl* ctrlTexRotation = mPanel->getChild<LLSpinCtrl>("TexRot"); + LLCheckBoxCtrl* checkFlipScaleS = mPanel->getChild<LLCheckBoxCtrl>("checkbox flip s"); + LLCheckBoxCtrl* checkFlipScaleT = mPanel->getChild<LLCheckBoxCtrl>("checkbox flip t"); + LLComboBox* comboTexGen = mPanel->getChild<LLComboBox>("combobox texgen"); if (ctrlTexScaleS) { valid = !ctrlTexScaleS->getTentative() || !checkFlipScaleS->getTentative(); @@ -373,15 +372,15 @@ struct LLPanelFaceSendFunctor : public LLSelectedObjectFunctor void LLPanelFace::sendTextureInfo() { LLPanelFaceSetTEFunctor setfunc(this); - gSelectMgr->getSelection()->applyToTEs(&setfunc); + LLSelectMgr::getInstance()->getSelection()->applyToTEs(&setfunc); LLPanelFaceSendFunctor sendfunc; - gSelectMgr->getSelection()->applyToObjects(&sendfunc); + LLSelectMgr::getInstance()->getSelection()->applyToObjects(&sendfunc); } void LLPanelFace::getState() { - LLViewerObject* objectp = gSelectMgr->getSelection()->getFirstObject(); + LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getFirstObject(); if( objectp && objectp->getPCode() == LL_PCODE_VOLUME @@ -411,7 +410,7 @@ void LLPanelFace::getState() childSetEnabled("button apply",editable); bool identical; - LLTextureCtrl* texture_ctrl = LLViewerUICtrlFactory::getTexturePickerByName(this,"texture control"); + LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("texture control"); // Texture { @@ -424,7 +423,7 @@ void LLPanelFace::getState() return image ? image->getID() : LLUUID::null; } } func; - identical = gSelectMgr->getSelection()->getSelectedTEValue( &func, id ); + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, id ); if (identical) { @@ -463,7 +462,7 @@ void LLPanelFace::getState() { // texture_ctrl->setValid( editable ); - if (gSelectMgr->selectGetAggregateTexturePermissions(texture_perms)) + if (LLSelectMgr::getInstance()->selectGetAggregateTexturePermissions(texture_perms)) { BOOL can_copy = texture_perms.getValue(PERM_COPY) == LLAggregatePermissions::AP_EMPTY || @@ -491,7 +490,7 @@ void LLPanelFace::getState() return object->getTE(face)->mScaleS; } } func; - identical = gSelectMgr->getSelection()->getSelectedTEValue( &func, scale_s ); + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, scale_s ); childSetValue("TexScaleU",editable ? llabs(scale_s) : 0); childSetTentative("TexScaleU",LLSD((BOOL)(!identical))); childSetEnabled("TexScaleU",editable); @@ -509,7 +508,7 @@ void LLPanelFace::getState() return object->getTE(face)->mScaleT; } } func; - identical = gSelectMgr->getSelection()->getSelectedTEValue( &func, scale_t ); + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, scale_t ); childSetValue("TexScaleV",llabs(editable ? llabs(scale_t) : 0)); childSetTentative("TexScaleV",LLSD((BOOL)(!identical))); @@ -530,7 +529,7 @@ void LLPanelFace::getState() return object->getTE(face)->mOffsetS; } } func; - identical = gSelectMgr->getSelection()->getSelectedTEValue( &func, offset_s ); + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, offset_s ); childSetValue("TexOffsetU", editable ? offset_s : 0); childSetTentative("TexOffsetU",!identical); childSetEnabled("TexOffsetU",editable); @@ -545,7 +544,7 @@ void LLPanelFace::getState() return object->getTE(face)->mOffsetT; } } func; - identical = gSelectMgr->getSelection()->getSelectedTEValue( &func, offset_t ); + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, offset_t ); childSetValue("TexOffsetV", editable ? offset_t : 0); childSetTentative("TexOffsetV",!identical); childSetEnabled("TexOffsetV",editable); @@ -562,14 +561,14 @@ void LLPanelFace::getState() return object->getTE(face)->mRotation; } } func; - identical = gSelectMgr->getSelection()->getSelectedTEValue( &func, rotation ); + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, rotation ); childSetValue("TexRot", editable ? rotation * RAD_TO_DEG : 0); childSetTentative("TexRot",!identical); childSetEnabled("TexRot",editable); } // Color swatch - LLColorSwatchCtrl* mColorSwatch = LLViewerUICtrlFactory::getColorSwatchByName(this,"colorswatch"); + LLColorSwatchCtrl* mColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch"); LLColor4 color = LLColor4::white; if(mColorSwatch) { @@ -580,7 +579,7 @@ void LLPanelFace::getState() return object->getTE(face)->getColor(); } } func; - identical = gSelectMgr->getSelection()->getSelectedTEValue( &func, color ); + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, color ); mColorSwatch->setOriginal(color); mColorSwatch->set(color, TRUE); @@ -609,7 +608,7 @@ void LLPanelFace::getState() return object->getTE(face)->getGlow(); } } func; - identical = gSelectMgr->getSelection()->getSelectedTEValue( &func, glow ); + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, glow ); childSetValue("glow",glow); childSetEnabled("glow",editable); @@ -628,7 +627,7 @@ void LLPanelFace::getState() return (F32)(object->getTE(face)->getShiny()); } } func; - identical = gSelectMgr->getSelection()->getSelectedTEValue( &func, shinyf ); + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, shinyf ); LLCtrlSelectionInterface* combobox_shininess = childGetSelectionInterface("combobox shininess"); if (combobox_shininess) @@ -653,7 +652,7 @@ void LLPanelFace::getState() return (F32)(object->getTE(face)->getBumpmap()); } } func; - identical = gSelectMgr->getSelection()->getSelectedTEValue( &func, bumpf ); + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, bumpf ); LLCtrlSelectionInterface* combobox_bumpiness = childGetSelectionInterface("combobox bumpiness"); if (combobox_bumpiness) @@ -678,7 +677,7 @@ void LLPanelFace::getState() return (F32)(object->getTE(face)->getTexGen()); } } func; - identical = gSelectMgr->getSelection()->getSelectedTEValue( &func, genf ); + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, genf ); S32 selected_texgen = ((S32) genf) >> TEM_TEX_GEN_SHIFT; LLCtrlSelectionInterface* combobox_texgen = childGetSelectionInterface("combobox texgen"); @@ -716,7 +715,7 @@ void LLPanelFace::getState() return (F32)(object->getTE(face)->getFullbright()); } } func; - identical = gSelectMgr->getSelection()->getSelectedTEValue( &func, fullbrightf ); + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, fullbrightf ); childSetValue("checkbox fullbright",(S32)fullbrightf); childSetEnabled("checkbox fullbright",editable); @@ -743,11 +742,11 @@ void LLPanelFace::getState() return object->getTE(face)->mScaleS / object->getScale().mV[s_axis]; } } func; - identical = gSelectMgr->getSelection()->getSelectedTEValue( &func, repeats ); + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, repeats ); childSetValue("rptctrl", editable ? repeats : 0); childSetTentative("rptctrl",!identical); - LLComboBox* mComboTexGen = LLViewerUICtrlFactory::getComboBoxByName(this,"combobox texgen"); + LLComboBox* mComboTexGen = getChild<LLComboBox>("combobox texgen"); if (mComboTexGen) { BOOL enabled = editable && (!mComboTexGen || mComboTexGen->getCurrentIndex() != 1); @@ -825,14 +824,14 @@ void LLPanelFace::onCommitAlpha(LLUICtrl* ctrl, void* userdata) // static void LLPanelFace::onCancelColor(LLUICtrl* ctrl, void* userdata) { - gSelectMgr->selectionRevertColors(); + LLSelectMgr::getInstance()->selectionRevertColors(); } // static void LLPanelFace::onSelectColor(LLUICtrl* ctrl, void* userdata) { LLPanelFace* self = (LLPanelFace*) userdata; - gSelectMgr->saveSelectedObjectColors(); + LLSelectMgr::getInstance()->saveSelectedObjectColors(); self->sendColor(); } @@ -875,8 +874,8 @@ void LLPanelFace::onCommitGlow(LLUICtrl* ctrl, void* userdata) BOOL LLPanelFace::onDragTexture(LLUICtrl*, LLInventoryItem* item, void*) { BOOL accept = TRUE; - for (LLObjectSelection::root_iterator iter = gSelectMgr->getSelection()->root_begin(); - iter != gSelectMgr->getSelection()->root_end(); iter++) + for (LLObjectSelection::root_iterator iter = LLSelectMgr::getInstance()->getSelection()->root_begin(); + iter != LLSelectMgr::getInstance()->getSelection()->root_end(); iter++) { LLSelectNode* node = *iter; LLViewerObject* obj = node->getObject(); @@ -894,7 +893,7 @@ void LLPanelFace::onCommitTexture( LLUICtrl* ctrl, void* userdata ) { LLPanelFace* self = (LLPanelFace*) userdata; - gViewerStats->incStat(LLViewerStats::ST_EDIT_TEXTURE_COUNT ); + LLViewerStats::getInstance()->incStat(LLViewerStats::ST_EDIT_TEXTURE_COUNT ); self->sendTexture(); } @@ -902,14 +901,14 @@ void LLPanelFace::onCommitTexture( LLUICtrl* ctrl, void* userdata ) // static void LLPanelFace::onCancelTexture(LLUICtrl* ctrl, void* userdata) { - gSelectMgr->selectionRevertTextures(); + LLSelectMgr::getInstance()->selectionRevertTextures(); } // static void LLPanelFace::onSelectTexture(LLUICtrl* ctrl, void* userdata) { LLPanelFace* self = (LLPanelFace*) userdata; - gSelectMgr->saveSelectedObjectTextures(); + LLSelectMgr::getInstance()->saveSelectedObjectTextures(); self->sendTexture(); } @@ -931,7 +930,7 @@ void LLPanelFace::onClickApply(void* userdata) //F32 repeats_per_meter = self->mCtrlRepeatsPerMeter->get(); F32 repeats_per_meter = (F32)self->childGetValue( "rptctrl" ).asReal();//self->mCtrlRepeatsPerMeter->get(); - gSelectMgr->selectionTexScaleAutofit( repeats_per_meter ); + LLSelectMgr::getInstance()->selectionTexScaleAutofit( repeats_per_meter ); } // commit the fit media texture to prim button @@ -965,8 +964,8 @@ struct LLPanelFaceSetMediaFunctor : public LLSelectedTEFunctor void LLPanelFace::onClickAutoFix(void* userdata) { LLPanelFaceSetMediaFunctor setfunc; - gSelectMgr->getSelection()->applyToTEs(&setfunc); + LLSelectMgr::getInstance()->getSelection()->applyToTEs(&setfunc); LLPanelFaceSendFunctor sendfunc; - gSelectMgr->getSelection()->applyToObjects(&sendfunc); + LLSelectMgr::getInstance()->getSelection()->applyToObjects(&sendfunc); } diff --git a/indra/newview/llpanelgroup.cpp b/indra/newview/llpanelgroup.cpp index d8faecf83d..fb86366cc6 100644 --- a/indra/newview/llpanelgroup.cpp +++ b/indra/newview/llpanelgroup.cpp @@ -42,7 +42,7 @@ #include "lltabcontainer.h" #include "lltextbox.h" #include "llviewermessage.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llviewerwindow.h" #include "llappviewer.h" @@ -160,16 +160,16 @@ LLPanelGroup::LLPanelGroup(const std::string& filename, mFactoryMap["roles_sub_tab"] = LLCallbackMap(LLPanelGroupRolesSubTab::createTab, &mID); mFactoryMap["actions_sub_tab"] = LLCallbackMap(LLPanelGroupActionsSubTab::createTab, &mID); - gGroupMgr->addObserver(this); + LLGroupMgr::getInstance()->addObserver(this); // Pass on construction of this panel to the control factory. - gUICtrlFactory->buildPanel(this, filename, &getFactoryMap()); + LLUICtrlFactory::getInstance()->buildPanel(this, filename, &getFactoryMap()); mFilename = filename; } LLPanelGroup::~LLPanelGroup() { - gGroupMgr->removeObserver(this); + LLGroupMgr::getInstance()->removeObserver(this); int i; int tab_count = mTabContainer->getTabCount(); @@ -360,9 +360,9 @@ void LLPanelGroup::setGroupID(const LLUUID& group_id) { LLRect rect(getRect()); - gGroupMgr->removeObserver(this); + LLGroupMgr::getInstance()->removeObserver(this); mID = group_id; - gGroupMgr->addObserver(this); + LLGroupMgr::getInstance()->addObserver(this); //TODO: this is really bad, we should add a method // where the panels can just update themselves // on a group id change. Similar to update() but with a group @@ -371,7 +371,7 @@ void LLPanelGroup::setGroupID(const LLUUID& group_id) // For now, rebuild panel //delete children and rebuild panel deleteAllChildren(); - gUICtrlFactory->buildPanel(this, mFilename, &getFactoryMap()); + LLUICtrlFactory::getInstance()->buildPanel(this, mFilename, &getFactoryMap()); } void LLPanelGroup::selectTab(std::string tab_name) @@ -603,7 +603,7 @@ void LLPanelGroup::draw() void LLPanelGroup::refreshData() { - gGroupMgr->clearGroupData(getID()); + LLGroupMgr::getInstance()->clearGroupData(getID()); mCurrentTab->activate(); // 5 second timeout @@ -616,14 +616,13 @@ void LLPanelGroup::close() { // Pass this to the parent, if it is a floater. LLView* viewp = getParent(); - if (viewp - && WIDGET_TYPE_FLOATER == viewp->getWidgetType()) + LLFloater* floaterp = dynamic_cast<LLFloater*>(viewp); + if (floaterp) { // First, set the force close flag, since the floater // will be asking us whether it can close. mForceClose = TRUE; // Tell the parent floater to close. - LLFloater* floaterp = (LLFloater*) viewp; floaterp->close(); } } diff --git a/indra/newview/llpanelgroupgeneral.cpp b/indra/newview/llpanelgroupgeneral.cpp index 64c4354d36..86a8c4a399 100644 --- a/indra/newview/llpanelgroupgeneral.cpp +++ b/indra/newview/llpanelgroupgeneral.cpp @@ -33,7 +33,7 @@ #include "llpanelgroupgeneral.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llagent.h" #include "roles_constants.h" #include "llfloateravatarinfo.h" @@ -304,7 +304,7 @@ void LLPanelGroupGeneral::onCommitTitle(LLUICtrl* ctrl, void* data) { LLPanelGroupGeneral* self = (LLPanelGroupGeneral*)data; if (self->mGroupID.isNull() || !self->mAllowEdit) return; - gGroupMgr->sendGroupTitleUpdate(self->mGroupID,self->mComboActiveTitle->getCurrentID()); + LLGroupMgr::getInstance()->sendGroupTitleUpdate(self->mGroupID,self->mComboActiveTitle->getCurrentID()); self->update(GC_TITLES); } @@ -329,7 +329,7 @@ void LLPanelGroupGeneral::onClickJoin(void *userdata) lldebugs << "joining group: " << self->mGroupID << llendl; - LLGroupMgrGroupData* gdatap = gGroupMgr->getGroupData(self->mGroupID); + LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(self->mGroupID); if (gdatap) { @@ -350,7 +350,7 @@ void LLPanelGroupGeneral::onClickJoin(void *userdata) } else { - llwarns << "gGroupMgr->getGroupData(" << self->mGroupID + llwarns << "LLGroupMgr::getInstance()->getGroupData(" << self->mGroupID << ") was NULL" << llendl; } } @@ -366,7 +366,7 @@ void LLPanelGroupGeneral::joinDlgCB(S32 which, void *userdata) return; } - gGroupMgr->sendGroupMemberJoin(self->mGroupID); + LLGroupMgr::getInstance()->sendGroupMemberJoin(self->mGroupID); } // static @@ -392,17 +392,17 @@ bool LLPanelGroupGeneral::needsApply(LLString& mesg) void LLPanelGroupGeneral::activate() { - LLGroupMgrGroupData* gdatap = gGroupMgr->getGroupData(mGroupID); + LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); if (mGroupID.notNull() && (!gdatap || mFirstUse)) { - gGroupMgr->sendGroupTitlesRequest(mGroupID); - gGroupMgr->sendGroupPropertiesRequest(mGroupID); + LLGroupMgr::getInstance()->sendGroupTitlesRequest(mGroupID); + LLGroupMgr::getInstance()->sendGroupPropertiesRequest(mGroupID); if (!gdatap || !gdatap->isMemberDataComplete() ) { - gGroupMgr->sendGroupMembersRequest(mGroupID); + LLGroupMgr::getInstance()->sendGroupMembersRequest(mGroupID); } mFirstUse = FALSE; @@ -446,12 +446,12 @@ bool LLPanelGroupGeneral::apply(LLString& mesg) LLString::format_map_t args; args["[MESSAGE]"] = mConfirmGroupCreateStr; gViewerWindow->alertXml("GenericAlertYesCancel", args, - createGroupCallback,this); + createGroupCallback,new LLHandle<LLPanel>(getHandle())); return false; } - LLGroupMgrGroupData* gdatap = gGroupMgr->getGroupData(mGroupID); + LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); if (!gdatap) { @@ -496,7 +496,7 @@ bool LLPanelGroupGeneral::apply(LLString& mesg) if (can_change_ident || can_change_member_opts) { - gGroupMgr->sendUpdateGroupInfo(mGroupID); + LLGroupMgr::getInstance()->sendUpdateGroupInfo(mGroupID); } } @@ -526,7 +526,10 @@ void LLPanelGroupGeneral::cancel() // static void LLPanelGroupGeneral::createGroupCallback(S32 option, void* userdata) { - LLPanelGroupGeneral* self = (LLPanelGroupGeneral*)userdata; + LLHandle<LLPanel> panel_handle = *(LLHandle<LLPanel>*)userdata; + delete (LLHandle<LLPanel>*)userdata; + + LLPanelGroupGeneral* self = dynamic_cast<LLPanelGroupGeneral*>(panel_handle.get()); if (!self) return; switch(option) @@ -537,7 +540,7 @@ void LLPanelGroupGeneral::createGroupCallback(S32 option, void* userdata) U32 enrollment_fee = (self->mCtrlEnrollmentFee->get() ? (U32) self->mSpinEnrollmentFee->get() : 0); - gGroupMgr->sendCreateGroupRequest(self->mGroupNameEditor->getText(), + LLGroupMgr::getInstance()->sendCreateGroupRequest(self->mGroupNameEditor->getText(), self->mEditCharter->getText(), self->mCtrlShowInGroupList->get(), self->mInsignia->getImageAssetID(), @@ -563,7 +566,7 @@ void LLPanelGroupGeneral::update(LLGroupChange gc) { if (mGroupID.isNull()) return; - LLGroupMgrGroupData* gdatap = gGroupMgr->getGroupData(mGroupID); + LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); if (!gdatap) return; @@ -734,7 +737,7 @@ void LLPanelGroupGeneral::updateMembers() { mPendingMemberUpdate = FALSE; - LLGroupMgrGroupData* gdatap = gGroupMgr->getGroupData(mGroupID); + LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); if (!mListVisibleMembers || !gdatap || !gdatap->isMemberDataComplete()) diff --git a/indra/newview/llpanelgroupinvite.cpp b/indra/newview/llpanelgroupinvite.cpp index f5b4fc83ca..fed7247816 100644 --- a/indra/newview/llpanelgroupinvite.cpp +++ b/indra/newview/llpanelgroupinvite.cpp @@ -42,7 +42,7 @@ #include "lltextbox.h" #include "llviewerobject.h" #include "llviewerobjectlist.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llviewerwindow.h" class LLPanelGroupInvite::impl @@ -77,7 +77,7 @@ public: LLButton *mOKButton; LLButton *mRemoveButton; LLTextBox *mGroupName; - LLTextBox *mOwnerWarning; + LLString mOwnerWarning; bool mConfirmedOwnerInvite; void (*mCloseCallback)(void* data); @@ -94,7 +94,6 @@ LLPanelGroupInvite::impl::impl(const LLUUID& group_id): mOKButton ( NULL ), mRemoveButton( NULL ), mGroupName( NULL ), - mOwnerWarning ( NULL ), mConfirmedOwnerInvite( false ), mCloseCallback( NULL ), mCloseCallbackUserData( NULL ) @@ -147,7 +146,7 @@ void LLPanelGroupInvite::impl::submitInvitations() { std::map<LLUUID, LLUUID> role_member_pairs; - LLGroupMgrGroupData* gdatap = gGroupMgr->getGroupData(mGroupID); + LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); // Default to everyone role. LLUUID role_id = LLUUID::null; @@ -160,7 +159,7 @@ void LLPanelGroupInvite::impl::submitInvitations() if ((role_id == gdatap->mOwnerRole) && (!mConfirmedOwnerInvite)) { LLString::format_map_t args; - args["[MESSAGE]"] = mOwnerWarning->getText(); + args["[MESSAGE]"] = mOwnerWarning; gViewerWindow->alertXml("GenericAlertYesCancel", args, inviteOwnerCallback, this); return; // we'll be called again if user confirms } @@ -175,7 +174,7 @@ void LLPanelGroupInvite::impl::submitInvitations() role_member_pairs[item->getUUID()] = role_id; } - gGroupMgr->sendGroupMemberInvites(mGroupID, role_member_pairs); + LLGroupMgr::getInstance()->sendGroupMemberInvites(mGroupID, role_member_pairs); //then close (*mCloseCallback)(mCloseCallbackUserData); @@ -363,7 +362,7 @@ LLPanelGroupInvite::LLPanelGroupInvite(const std::string& name, std::string panel_def_file; // Pass on construction of this panel to the control factory. - gUICtrlFactory->buildPanel(this, "panel_group_invite.xml", &getFactoryMap()); + LLUICtrlFactory::getInstance()->buildPanel(this, "panel_group_invite.xml", &getFactoryMap()); } LLPanelGroupInvite::~LLPanelGroupInvite() @@ -452,7 +451,7 @@ void LLPanelGroupInvite::update() void LLPanelGroupInvite::updateLists() { - LLGroupMgrGroupData* gdatap = gGroupMgr->getGroupData(mImplementation->mGroupID); + LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mImplementation->mGroupID); bool waiting = false; if (gdatap) @@ -494,9 +493,9 @@ void LLPanelGroupInvite::updateLists() { if (!mPendingUpdate) { - gGroupMgr->sendGroupPropertiesRequest(mImplementation->mGroupID); - gGroupMgr->sendGroupMembersRequest(mImplementation->mGroupID); - gGroupMgr->sendGroupRoleDataRequest(mImplementation->mGroupID); + LLGroupMgr::getInstance()->sendGroupPropertiesRequest(mImplementation->mGroupID); + LLGroupMgr::getInstance()->sendGroupMembersRequest(mImplementation->mGroupID); + LLGroupMgr::getInstance()->sendGroupRoleDataRequest(mImplementation->mGroupID); } mPendingUpdate = TRUE; } @@ -563,7 +562,7 @@ BOOL LLPanelGroupInvite::postBuild() button->setCallbackUserData(mImplementation); } - mImplementation->mOwnerWarning = (LLTextBox*)getChildByName("confirm_invite_owner_str", recurse); + mImplementation->mOwnerWarning = getString("confirm_invite_owner_str"); update(); diff --git a/indra/newview/llpanelgrouplandmoney.cpp b/indra/newview/llpanelgrouplandmoney.cpp index b19d3723a7..4ec8c0763b 100644 --- a/indra/newview/llpanelgrouplandmoney.cpp +++ b/indra/newview/llpanelgrouplandmoney.cpp @@ -46,7 +46,7 @@ #include "lltextbox.h" #include "lltabcontainer.h" #include "lltransactiontypes.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llstatusbar.h" #include "llfloaterworldmap.h" diff --git a/indra/newview/llpanelgroupnotices.cpp b/indra/newview/llpanelgroupnotices.cpp index 4c16936b68..9c9c058685 100644 --- a/indra/newview/llpanelgroupnotices.cpp +++ b/indra/newview/llpanelgroupnotices.cpp @@ -76,8 +76,6 @@ public: // // LLView functionality - virtual EWidgetType getWidgetType() const; - virtual LLString getWidgetTag() const; virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void* cargo_data, @@ -96,16 +94,6 @@ LLGroupDropTarget::LLGroupDropTarget(const std::string& name, const LLRect& rect { } -EWidgetType LLGroupDropTarget::getWidgetType() const -{ - return WIDGET_TYPE_DONTCARE; -} - -LLString LLGroupDropTarget::getWidgetTag() const -{ - return LL_GROUP_DROP_TARGET_TAG; -} - void LLGroupDropTarget::doDrop(EDragAndDropType cargo_type, void* cargo_data) { llinfos << "LLGroupDropTarget::doDrop()" << llendl; @@ -328,12 +316,12 @@ void LLPanelGroupNotices::setItem(LLPointer<LLInventoryItem> inv_item) item_is_multi = TRUE; }; - LLViewerImage* item_icon = get_item_icon(inv_item->getType(), + LLString icon_name = get_item_icon_name(inv_item->getType(), inv_item->getInventoryType(), inv_item->getFlags(), item_is_multi ); - mCreateInventoryIcon->setImage(item_icon->getID()); + mCreateInventoryIcon->setImage(icon_name); mCreateInventoryIcon->setVisible(TRUE); std::stringstream ss; @@ -486,11 +474,11 @@ void LLPanelGroupNotices::processNotices(LLMessageSystem* msg) row["columns"][0]["column"] = "icon"; if (has_attachment) { - LLUUID icon_id = get_item_icon_uuid( - (LLAssetType::EType)asset_type, - LLInventoryType::IT_NONE,FALSE, FALSE); + LLString icon_name = get_item_icon_name( + (LLAssetType::EType)asset_type, + LLInventoryType::IT_NONE,FALSE, FALSE); row["columns"][0]["type"] = "icon"; - row["columns"][0]["value"] = icon_id; + row["columns"][0]["value"] = icon_name; } row["columns"][1]["column"] = "subject"; @@ -554,11 +542,11 @@ void LLPanelGroupNotices::showNotice(const char* subject, { mInventoryOffer = inventory_offer; - LLViewerImage* item_icon = get_item_icon(mInventoryOffer->mType, + LLString icon_name = get_item_icon_name(mInventoryOffer->mType, LLInventoryType::IT_TEXTURE, 0, FALSE); - mViewInventoryIcon->setImage(item_icon->getID()); + mViewInventoryIcon->setImage(icon_name); mViewInventoryIcon->setVisible(TRUE); std::stringstream ss; diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp index 8034ed6f03..c04b1b72cd 100644 --- a/indra/newview/llpanelgrouproles.cpp +++ b/indra/newview/llpanelgrouproles.cpp @@ -61,7 +61,7 @@ bool agentCanRemoveFromRole(const LLUUID& group_id, bool agentCanAddToRole(const LLUUID& group_id, const LLUUID& role_id) { - LLGroupMgrGroupData* gdatap = gGroupMgr->getGroupData(group_id); + LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(group_id); if (!gdatap) { llwarns << "agentCanAddToRole " @@ -414,14 +414,14 @@ void LLPanelGroupRoles::update(LLGroupChange gc) void LLPanelGroupRoles::activate() { // Start requesting member and role data if needed. - LLGroupMgrGroupData* gdatap = gGroupMgr->getGroupData(mGroupID); + LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); //if (!gdatap || mFirstUse) { // Check member data. if (!gdatap || !gdatap->isMemberDataComplete() ) { - gGroupMgr->sendGroupMembersRequest(mGroupID); + LLGroupMgr::getInstance()->sendGroupMembersRequest(mGroupID); } // Check role data. @@ -430,19 +430,19 @@ void LLPanelGroupRoles::activate() // Mildly hackish - clear all pending changes cancel(); - gGroupMgr->sendGroupRoleDataRequest(mGroupID); + LLGroupMgr::getInstance()->sendGroupRoleDataRequest(mGroupID); } // Check role-member mapping data. if (!gdatap || !gdatap->isRoleMemberDataComplete() ) { - gGroupMgr->sendGroupRoleMembersRequest(mGroupID); + LLGroupMgr::getInstance()->sendGroupRoleMembersRequest(mGroupID); } // Need this to get base group member powers if (!gdatap || !gdatap->isGroupPropertiesDataComplete() ) { - gGroupMgr->sendGroupPropertiesRequest(mGroupID); + LLGroupMgr::getInstance()->sendGroupPropertiesRequest(mGroupID); } mFirstUse = FALSE; @@ -529,23 +529,23 @@ BOOL LLPanelGroupSubTab::postBuild() bool no_recurse = false; LLIconCtrl* icon = getChild<LLIconCtrl>("power_folder_icon",no_recurse); - if (icon && icon->getImage().notNull()) + if (icon && !icon->getImageName().empty()) { - mActionIcons["folder"] = icon->getImage(); + mActionIcons["folder"] = icon->getImageName(); removeChild(icon, TRUE); } icon = getChild<LLIconCtrl>("power_all_have_icon",no_recurse); - if (icon && icon->getImage().notNull()) + if (icon && !icon->getImageName().empty()) { - mActionIcons["full"] = icon->getImage(); + mActionIcons["full"] = icon->getImageName(); removeChild(icon, TRUE); } icon = getChild<LLIconCtrl>("power_partial_icon",no_recurse); - if (icon && icon->getImage().notNull()) + if (icon && !icon->getImageName().empty()) { - mActionIcons["partial"] = icon->getImage(); + mActionIcons["partial"] = icon->getImageName(); removeChild(icon, TRUE); } @@ -679,14 +679,14 @@ void LLPanelGroupSubTab::buildActionsList(LLScrollListCtrl* ctrl, BOOL filter, BOOL is_owner_role) { - if (gGroupMgr->mRoleActionSets.empty()) + if (LLGroupMgr::getInstance()->mRoleActionSets.empty()) { llwarns << "Can't build action list - no actions found." << llendl; return; } - std::vector<LLRoleActionSet*>::iterator ras_it = gGroupMgr->mRoleActionSets.begin(); - std::vector<LLRoleActionSet*>::iterator ras_end = gGroupMgr->mRoleActionSets.end(); + std::vector<LLRoleActionSet*>::iterator ras_it = LLGroupMgr::getInstance()->mRoleActionSets.begin(); + std::vector<LLRoleActionSet*>::iterator ras_end = LLGroupMgr::getInstance()->mRoleActionSets.end(); for ( ; ras_it != ras_end; ++ras_it) { @@ -951,7 +951,7 @@ void LLPanelGroupMembersSubTab::handleMemberSelect() mAssignedRolesList->deleteAllItems(); mAllowedActionsList->deleteAllItems(); - LLGroupMgrGroupData* gdatap = gGroupMgr->getGroupData(mGroupID); + LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); if (!gdatap) { llwarns << "LLPanelGroupMembersSubTab::handleMemberSelect() " @@ -1199,14 +1199,14 @@ void LLPanelGroupMembersSubTab::handleEjectMembers() mMembersList->deleteSelectedItems(); - gGroupMgr->sendGroupMemberEjects(mGroupID, + LLGroupMgr::getInstance()->sendGroupMemberEjects(mGroupID, selected_members); } void LLPanelGroupMembersSubTab::handleRoleCheck(const LLUUID& role_id, LLRoleMemberChangeType type) { - LLGroupMgrGroupData* gdatap = gGroupMgr->getGroupData(mGroupID); + LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); if (!gdatap) return; //add that the user is requesting to change the roles for selected @@ -1356,7 +1356,7 @@ void LLPanelGroupMembersSubTab::cancel() bool LLPanelGroupMembersSubTab::apply(LLString& mesg) { - LLGroupMgrGroupData* gdatap = gGroupMgr->getGroupData(mGroupID); + LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); if (!gdatap) { llwarns << "Unable to get group data for group " << mGroupID << llendl; @@ -1421,7 +1421,7 @@ void LLPanelGroupMembersSubTab::applyMemberChanges() { //sucks to do a find again here, but it is in constant time, so, could //be worse - LLGroupMgrGroupData* gdatap = gGroupMgr->getGroupData(mGroupID); + LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); if (!gdatap) { llwarns << "Unable to get group data for group " << mGroupID << llendl; @@ -1446,7 +1446,7 @@ void LLPanelGroupMembersSubTab::applyMemberChanges() } mMemberRoleChangeData.clear(); - gGroupMgr->sendGroupRoleMemberChanges(mGroupID); + LLGroupMgr::getInstance()->sendGroupRoleMemberChanges(mGroupID); //force a UI update handleMemberSelect(); @@ -1485,7 +1485,7 @@ U64 LLPanelGroupMembersSubTab::getAgentPowersBasedOnRoleChanges(const LLUUID& ag //and then we have to build the powers up bases on the roles the agent //is in - LLGroupMgrGroupData* gdatap = gGroupMgr->getGroupData(mGroupID); + LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); if (!gdatap) { llwarns << "LLPanelGroupMembersSubTab::getAgentPowersBasedOnRoleChanges() -- No group data!" << llendl; @@ -1598,7 +1598,7 @@ void LLPanelGroupMembersSubTab::update(LLGroupChange gc) return; } - LLGroupMgrGroupData* gdatap = gGroupMgr->getGroupData(mGroupID); + LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); if (!gdatap) { llwarns << "LLPanelGroupMembersSubTab::update() -- No group data!" << llendl; @@ -1649,7 +1649,7 @@ void LLPanelGroupMembersSubTab::updateMembers() lldebugs << "LLPanelGroupMembersSubTab::updateMembers()" << llendl; - LLGroupMgrGroupData* gdatap = gGroupMgr->getGroupData(mGroupID); + LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); if (!gdatap) { llwarns << "LLPanelGroupMembersSubTab::updateMembers() -- No group data!" << llendl; @@ -1856,7 +1856,7 @@ bool LLPanelGroupRolesSubTab::needsApply(LLString& mesg) { lldebugs << "LLPanelGroupRolesSubTab::needsApply()" << llendl; - LLGroupMgrGroupData* gdatap = gGroupMgr->getGroupData(mGroupID); + LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); return (mHasRoleChange // Text changed in current role || (gdatap && gdatap->pendingRoleChanges())); // Pending role changes in the group @@ -1867,7 +1867,7 @@ bool LLPanelGroupRolesSubTab::apply(LLString& mesg) lldebugs << "LLPanelGroupRolesSubTab::apply()" << llendl; saveRoleChanges(); - gGroupMgr->sendGroupRoleChanges(mGroupID); + LLGroupMgr::getInstance()->sendGroupRoleChanges(mGroupID); notifyObservers(); @@ -1877,7 +1877,7 @@ bool LLPanelGroupRolesSubTab::apply(LLString& mesg) void LLPanelGroupRolesSubTab::cancel() { mHasRoleChange = FALSE; - gGroupMgr->cancelGroupRoleChanges(mGroupID); + LLGroupMgr::getInstance()->cancelGroupRoleChanges(mGroupID); notifyObservers(); } @@ -1930,11 +1930,11 @@ void LLPanelGroupRolesSubTab::update(LLGroupChange gc) if (mGroupID.isNull()) return; - LLGroupMgrGroupData* gdatap = gGroupMgr->getGroupData(mGroupID); + LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); if (!gdatap || !gdatap->isRoleDataComplete()) { - gGroupMgr->sendGroupRoleDataRequest(mGroupID); + LLGroupMgr::getInstance()->sendGroupRoleDataRequest(mGroupID); } else { @@ -2005,12 +2005,12 @@ void LLPanelGroupRolesSubTab::update(LLGroupChange gc) if (!gdatap || !gdatap->isMemberDataComplete()) { - gGroupMgr->sendGroupMembersRequest(mGroupID); + LLGroupMgr::getInstance()->sendGroupMembersRequest(mGroupID); } if (!gdatap || !gdatap->isRoleMemberDataComplete()) { - gGroupMgr->sendGroupRoleMembersRequest(mGroupID); + LLGroupMgr::getInstance()->sendGroupRoleMembersRequest(mGroupID); } if ((GC_ROLE_MEMBER_DATA == gc || GC_MEMBER_DATA == gc) @@ -2037,7 +2037,7 @@ void LLPanelGroupRolesSubTab::handleRoleSelect() mAssignedMembersList->deleteAllItems(); mAllowedActionsList->deleteAllItems(); - LLGroupMgrGroupData* gdatap = gGroupMgr->getGroupData(mGroupID); + LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); if (!gdatap) { llwarns << "LLPanelGroupRolesSubTab::handleRoleSelect() " @@ -2118,7 +2118,7 @@ void LLPanelGroupRolesSubTab::buildMembersList() { mAssignedMembersList->deleteAllItems(); - LLGroupMgrGroupData* gdatap = gGroupMgr->getGroupData(mGroupID); + LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); if (!gdatap) { llwarns << "LLPanelGroupRolesSubTab::handleRoleSelect() " @@ -2179,7 +2179,7 @@ void LLPanelGroupRolesSubTab::handleActionCheck(LLCheckBoxCtrl* check, bool forc { lldebugs << "LLPanelGroupRolesSubTab::handleActionSelect()" << llendl; - LLGroupMgrGroupData* gdatap = gGroupMgr->getGroupData(mGroupID); + LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); if (!gdatap) { llwarns << "LLPanelGroupRolesSubTab::handleRoleSelect() " @@ -2313,7 +2313,7 @@ void LLPanelGroupRolesSubTab::handleMemberVisibilityChange(bool value) { lldebugs << "LLPanelGroupRolesSubTab::handleMemberVisibilityChange()" << llendl; - LLGroupMgrGroupData* gdatap = gGroupMgr->getGroupData(mGroupID); + LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); if (!gdatap) { llwarns << "LLPanelGroupRolesSubTab::handleRoleSelect() " @@ -2348,7 +2348,7 @@ void LLPanelGroupRolesSubTab::onCreateRole(void* user_data) void LLPanelGroupRolesSubTab::handleCreateRole() { - LLGroupMgrGroupData* gdatap = gGroupMgr->getGroupData(mGroupID); + LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); if (!gdatap) return; @@ -2389,7 +2389,7 @@ void LLPanelGroupRolesSubTab::onDeleteRole(void* user_data) void LLPanelGroupRolesSubTab::handleDeleteRole() { - LLGroupMgrGroupData* gdatap = gGroupMgr->getGroupData(mGroupID); + LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); if (!gdatap) return; @@ -2416,7 +2416,7 @@ void LLPanelGroupRolesSubTab::handleDeleteRole() void LLPanelGroupRolesSubTab::saveRoleChanges() { - LLGroupMgrGroupData* gdatap = gGroupMgr->getGroupData(mGroupID); + LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); if (!gdatap) return; @@ -2589,7 +2589,7 @@ void LLPanelGroupActionsSubTab::handleActionSelect() mActionDescription->clear(); } - LLGroupMgrGroupData* gdatap = gGroupMgr->getGroupData(mGroupID); + LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); if (!gdatap) return; @@ -2611,7 +2611,7 @@ void LLPanelGroupActionsSubTab::handleActionSelect() } else { - gGroupMgr->sendGroupMembersRequest(mGroupID); + LLGroupMgr::getInstance()->sendGroupMembersRequest(mGroupID); } if (gdatap->isRoleDataComplete()) @@ -2632,6 +2632,6 @@ void LLPanelGroupActionsSubTab::handleActionSelect() } else { - gGroupMgr->sendGroupRoleDataRequest(mGroupID); + LLGroupMgr::getInstance()->sendGroupRoleDataRequest(mGroupID); } } diff --git a/indra/newview/llpanelgrouproles.h b/indra/newview/llpanelgrouproles.h index 89264abc94..8d16d613e9 100644 --- a/indra/newview/llpanelgrouproles.h +++ b/indra/newview/llpanelgrouproles.h @@ -45,7 +45,7 @@ class LLScrollListItem; // Forward declare for friend usage. //virtual BOOL LLPanelGroupSubTab::postBuildSubTab(LLView*); -typedef std::map<std::string,LLUUID> icon_map_t; +typedef std::map<std::string,std::string> icon_map_t; class LLPanelGroupRoles : public LLPanelGroupTab, public LLPanelGroupTabObserver diff --git a/indra/newview/llpanelland.cpp b/indra/newview/llpanelland.cpp index 45e78f257f..a994a94fb7 100644 --- a/indra/newview/llpanelland.cpp +++ b/indra/newview/llpanelland.cpp @@ -43,7 +43,7 @@ #include "llviewerregion.h" #include "roles_constants.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" LLPanelLandSelectObserver* LLPanelLandInfo::sObserver = NULL; LLPanelLandInfo* LLPanelLandInfo::sInstance = NULL; @@ -81,7 +81,7 @@ LLPanelLandInfo::LLPanelLandInfo(const std::string& name) if (!sObserver) { sObserver = new LLPanelLandSelectObserver(); - gParcelMgr->addObserver( sObserver ); + LLViewerParcelMgr::getInstance()->addObserver( sObserver ); } } @@ -90,7 +90,7 @@ LLPanelLandInfo::LLPanelLandInfo(const std::string& name) // virtual LLPanelLandInfo::~LLPanelLandInfo() { - gParcelMgr->removeObserver( sObserver ); + LLViewerParcelMgr::getInstance()->removeObserver( sObserver ); delete sObserver; sObserver = NULL; @@ -111,8 +111,8 @@ void LLPanelLandInfo::refreshAll() // public void LLPanelLandInfo::refresh() { - LLParcel *parcel = gParcelMgr->getParcelSelection()->getParcel(); - LLViewerRegion *regionp = gParcelMgr->getSelectionRegion(); + LLParcel *parcel = LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel(); + LLViewerRegion *regionp = LLViewerParcelMgr::getInstance()->getSelectionRegion(); if (!parcel || !regionp) { @@ -177,9 +177,9 @@ void LLPanelLandInfo::refresh() // not just a single unit of land, // you must own part of it, // and it must not be a whole parcel. - if (gParcelMgr->getSelectedArea() > PARCEL_UNIT_AREA - //&& gParcelMgr->getSelfCount() > 1 - && !gParcelMgr->getParcelSelection()->getWholeParcelSelected()) + if (LLViewerParcelMgr::getInstance()->getSelectedArea() > PARCEL_UNIT_AREA + //&& LLViewerParcelMgr::getInstance()->getSelfCount() > 1 + && !LLViewerParcelMgr::getInstance()->getParcelSelection()->getWholeParcelSelected()) { childSetEnabled("button join land",TRUE); } @@ -197,12 +197,12 @@ void LLPanelLandInfo::refresh() S32 rent_price; BOOL for_sale; F32 dwell; - gParcelMgr->getDisplayInfo(&area, + LLViewerParcelMgr::getInstance()->getDisplayInfo(&area, &claim_price, &rent_price, &for_sale, &dwell); - if(is_public || (is_for_sale && gParcelMgr->getParcelSelection()->getWholeParcelSelected())) + if(is_public || (is_for_sale && LLViewerParcelMgr::getInstance()->getParcelSelection()->getWholeParcelSelected())) { childSetTextArg("label_area_price","[PRICE]", llformat("%d",claim_price)); childSetTextArg("label_area_price","[AREA]", llformat("%d",area)); @@ -222,35 +222,35 @@ void LLPanelLandInfo::refresh() //static void LLPanelLandInfo::onClickClaim(void*) { - gParcelMgr->startBuyLand(); + LLViewerParcelMgr::getInstance()->startBuyLand(); } //static void LLPanelLandInfo::onClickRelease(void*) { - gParcelMgr->startReleaseLand(); + LLViewerParcelMgr::getInstance()->startReleaseLand(); } // static void LLPanelLandInfo::onClickDivide(void*) { - gParcelMgr->startDivideLand(); + LLViewerParcelMgr::getInstance()->startDivideLand(); } // static void LLPanelLandInfo::onClickJoin(void*) { - gParcelMgr->startJoinLand(); + LLViewerParcelMgr::getInstance()->startJoinLand(); } //static void LLPanelLandInfo::onClickAbout(void*) { // Promote the rectangle selection to a parcel selection - if (!gParcelMgr->getParcelSelection()->getWholeParcelSelected()) + if (!LLViewerParcelMgr::getInstance()->getParcelSelection()->getWholeParcelSelected()) { - gParcelMgr->selectParcelInRectangle(); + LLViewerParcelMgr::getInstance()->selectParcelInRectangle(); } LLFloaterLand::showInstance(); diff --git a/indra/newview/llpanellandmedia.cpp b/indra/newview/llpanellandmedia.cpp index db85294fcc..8df677a755 100644 --- a/indra/newview/llpanellandmedia.cpp +++ b/indra/newview/llpanellandmedia.cpp @@ -37,7 +37,7 @@ // viewer includes #include "llmimetypes.h" #include "llviewerparcelmgr.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" // library includes #include "llcheckboxctrl.h" @@ -80,59 +80,52 @@ LLPanelLandMedia::~LLPanelLandMedia() BOOL LLPanelLandMedia::postBuild() { - mCheckSoundLocal = LLUICtrlFactory::getCheckBoxByName(this, "check sound local"); + mCheckSoundLocal = getChild<LLCheckBoxCtrl>("check sound local"); childSetCommitCallback("check sound local", onCommitAny, this); - mRadioVoiceChat = LLUICtrlFactory::getRadioGroupByName(this, "parcel_voice_channel"); + mRadioVoiceChat = getChild<LLRadioGroup>("parcel_voice_channel"); childSetCommitCallback("parcel_voice_channel", onCommitAny, this); - mMusicURLEdit = LLUICtrlFactory::getLineEditorByName(this, "music_url"); + mMusicURLEdit = getChild<LLLineEditor>("music_url"); childSetCommitCallback("music_url", onCommitAny, this); - mMediaTextureCtrl = LLViewerUICtrlFactory::getTexturePickerByName(this, "media texture"); - if (mMediaTextureCtrl) - { - mMediaTextureCtrl->setCommitCallback( onCommitAny ); - mMediaTextureCtrl->setCallbackUserData( this ); - mMediaTextureCtrl->setAllowNoTexture ( TRUE ); - mMediaTextureCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); - mMediaTextureCtrl->setNonImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); - } - else - { - llwarns << "LLViewerUICtrlFactory::getTexturePickerByName() returned NULL for 'media texure'" << llendl; - } + mMediaTextureCtrl = getChild<LLTextureCtrl>("media texture"); + mMediaTextureCtrl->setCommitCallback( onCommitAny ); + mMediaTextureCtrl->setCallbackUserData( this ); + mMediaTextureCtrl->setAllowNoTexture ( TRUE ); + mMediaTextureCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); + mMediaTextureCtrl->setNonImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); - mMediaAutoScaleCheck = LLUICtrlFactory::getCheckBoxByName(this, "media_auto_scale"); + mMediaAutoScaleCheck = getChild<LLCheckBoxCtrl>("media_auto_scale"); childSetCommitCallback("media_auto_scale", onCommitAny, this); - mMediaLoopCheck = LLUICtrlFactory::getCheckBoxByName(this, "media_loop"); + mMediaLoopCheck = getChild<LLCheckBoxCtrl>("media_loop"); childSetCommitCallback("media_loop", onCommitAny, this); - mMediaUrlCheck = LLUICtrlFactory::getCheckBoxByName(this, "hide_media_url"); + mMediaUrlCheck = getChild<LLCheckBoxCtrl>("hide_media_url"); childSetCommitCallback("hide_media_url", onCommitAny, this); - mMusicUrlCheck = LLUICtrlFactory::getCheckBoxByName(this, "hide_music_url"); + mMusicUrlCheck = getChild<LLCheckBoxCtrl>("hide_music_url"); childSetCommitCallback("hide_music_url", onCommitAny, this); - mMediaURLEdit = LLUICtrlFactory::getLineEditorByName(this, "media_url"); + mMediaURLEdit = getChild<LLLineEditor>("media_url"); childSetCommitCallback("media_url", onCommitAny, this); - mMediaDescEdit = LLUICtrlFactory::getLineEditorByName(this, "url_description"); + mMediaDescEdit = getChild<LLLineEditor>("url_description"); childSetCommitCallback("url_description", onCommitAny, this); - mMediaTypeCombo = LLUICtrlFactory::getComboBoxByName(this, "media type"); + mMediaTypeCombo = getChild<LLComboBox>("media type"); childSetCommitCallback("media type", onCommitType, this); populateMIMECombo(); mMediaTypeCombo->sortByName(); - mMediaWidthCtrl = LLUICtrlFactory::getSpinnerByName(this, "media_size_width"); + mMediaWidthCtrl = getChild<LLSpinCtrl>("media_size_width"); childSetCommitCallback("media_size_width", onCommitAny, this); - mMediaHeightCtrl = LLUICtrlFactory::getSpinnerByName(this, "media_size_height"); + mMediaHeightCtrl = getChild<LLSpinCtrl>("media_size_height"); childSetCommitCallback("media_size_height", onCommitAny, this); - mMediaSizeCtrlLabel = LLUICtrlFactory::getTextBoxByName(this, "media_size"); + mMediaSizeCtrlLabel = getChild<LLTextBox>("media_size"); - mSetURLButton = LLUICtrlFactory::getButtonByName(this, "set_media_url"); + mSetURLButton = getChild<LLButton>("set_media_url"); childSetAction("set_media_url", onSetBtn, this); return TRUE; @@ -383,7 +376,7 @@ void LLPanelLandMedia::onCommitAny(LLUICtrl *ctrl, void *userdata) parcel->setObscureMusic( obscure_music ); // Send current parcel data upstream to server - gParcelMgr->sendParcelPropertiesUpdate( parcel ); + LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel ); // Might have changed properties, so let's redraw! self->refresh(); diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index b6e8c1a7f3..4047cd022f 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -65,7 +65,7 @@ #include "llnotify.h" #include "llappviewer.h" // for gHideLinks #include "llurlsimstring.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llhttpclient.h" #include "llweb.h" #include "llwebbrowserctrl.h" @@ -349,9 +349,9 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, gViewerWindow->getRootView()->addChildAtEnd(this); // Logo - mLogoImage = gImageList.getImage("startup_logo.tga", LLUUID::null, MIPMAP_FALSE, TRUE); + mLogoImage = LLUI::getUIImage("startup_logo.j2c"); - gUICtrlFactory->buildPanel(this, "panel_login.xml"); + LLUICtrlFactory::getInstance()->buildPanel(this, "panel_login.xml"); #if USE_VIEWER_AUTH //leave room for the login menu bar @@ -368,44 +368,41 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, childSetUserData("password_edit", this); // change z sort of clickable text to be behind buttons - sendChildToBack(getChildByName("channel_text")); - sendChildToBack(getChildByName("version_text")); - sendChildToBack(getChildByName("forgot_password_text")); + sendChildToBack(getChildView("channel_text")); + sendChildToBack(getChildView("version_text")); + sendChildToBack(getChildView("forgot_password_text")); - LLLineEditor* edit = LLUICtrlFactory::getLineEditorByName(this, "password_edit"); + LLLineEditor* edit = getChild<LLLineEditor>("password_edit"); if (edit) edit->setDrawAsterixes(TRUE); - LLComboBox* combo = LLUICtrlFactory::getComboBoxByName(this, "start_location_combo"); - if (combo) - { - combo->setAllowTextEntry(TRUE, 128, FALSE); + LLComboBox* combo = getChild<LLComboBox>("start_location_combo"); + combo->setAllowTextEntry(TRUE, 128, FALSE); - // The XML file loads the combo with the following labels: - // 0 - "My Home" - // 1 - "My Last Location" - // 2 - "<Type region name>" + // The XML file loads the combo with the following labels: + // 0 - "My Home" + // 1 - "My Last Location" + // 2 - "<Type region name>" - BOOL login_last = gSavedSettings.getBOOL("LoginLastLocation"); - LLString sim_string = LLURLSimString::sInstance.mSimString; - if (!sim_string.empty()) - { - // Replace "<Type region name>" with this region name - combo->remove(2); - combo->add( sim_string ); - combo->setTextEntry(sim_string); - combo->setCurrentByIndex( 2 ); - } - else if (login_last) - { - combo->setCurrentByIndex( 1 ); - } - else - { - combo->setCurrentByIndex( 0 ); - } - - combo->setCommitCallback( &LLPanelGeneral::set_start_location ); + BOOL login_last = gSavedSettings.getBOOL("LoginLastLocation"); + LLString sim_string = LLURLSimString::sInstance.mSimString; + if (!sim_string.empty()) + { + // Replace "<Type region name>" with this region name + combo->remove(2); + combo->add( sim_string ); + combo->setTextEntry(sim_string); + combo->setCurrentByIndex( 2 ); + } + else if (login_last) + { + combo->setCurrentByIndex( 1 ); } + else + { + combo->setCurrentByIndex( 0 ); + } + + combo->setCommitCallback( &LLPanelGeneral::set_start_location ); childSetAction("connect_btn", onClickConnect, this); @@ -413,71 +410,59 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, childSetAction("quit_btn", onClickQuit, this); - LLTextBox* version_text = LLUICtrlFactory::getTextBoxByName(this, "version_text"); - if (version_text) - { - LLString version = llformat("%d.%d.%d (%d)", - LL_VERSION_MAJOR, - LL_VERSION_MINOR, - LL_VERSION_PATCH, - LL_VIEWER_BUILD ); - version_text->setText(version); - version_text->setClickedCallback(onClickVersion); - version_text->setCallbackUserData(this); - } - - LLTextBox* channel_text = LLUICtrlFactory::getTextBoxByName(this, "channel_text"); - if (channel_text) - { - channel_text->setText(gSavedSettings.getString("VersionChannelName")); - channel_text->setClickedCallback(onClickVersion); - channel_text->setCallbackUserData(this); - } + LLTextBox* version_text = getChild<LLTextBox>("version_text"); + LLString version = llformat("%d.%d.%d (%d)", + LL_VERSION_MAJOR, + LL_VERSION_MINOR, + LL_VERSION_PATCH, + LL_VIEWER_BUILD ); + version_text->setText(version); + version_text->setClickedCallback(onClickVersion); + version_text->setCallbackUserData(this); + + LLTextBox* channel_text = getChild<LLTextBox>("channel_text"); + channel_text->setText(gSavedSettings.getString("VersionChannelName")); + channel_text->setClickedCallback(onClickVersion); + channel_text->setCallbackUserData(this); - LLTextBox* forgot_password_text = LLUICtrlFactory::getTextBoxByName(this, "forgot_password_text"); - if (forgot_password_text) - { - forgot_password_text->setClickedCallback(onClickForgotPassword); - } + LLTextBox* forgot_password_text = getChild<LLTextBox>("forgot_password_text"); + forgot_password_text->setClickedCallback(onClickForgotPassword); #endif // get the web browser control LLWebBrowserCtrl* web_browser = getChild<LLWebBrowserCtrl>("login_html"); - if ( web_browser ) - { - // Need to handle login secondlife:///app/ URLs - web_browser->setOpenAppSLURLs( true ); + // Need to handle login secondlife:///app/ URLs + web_browser->setOpenAppSLURLs( true ); - // observe browser events - web_browser->addObserver( this ); + // observe browser events + web_browser->addObserver( this ); - // don't make it a tab stop until SL-27594 is fixed - web_browser->setTabStop(FALSE); - web_browser->navigateToLocalPage( "loading", "loading.html" ); + // don't make it a tab stop until SL-27594 is fixed + web_browser->setTabStop(FALSE); + web_browser->navigateToLocalPage( "loading", "loading.html" ); - // make links open in external browser - web_browser->setOpenInExternalBrowser( true ); + // make links open in external browser + web_browser->setOpenInExternalBrowser( true ); - // force the size to be correct (XML doesn't seem to be sufficient to do this) (with some padding so the other login screen doesn't show through) - LLRect htmlRect = getRect(); + // force the size to be correct (XML doesn't seem to be sufficient to do this) (with some padding so the other login screen doesn't show through) + LLRect htmlRect = getRect(); #if USE_VIEWER_AUTH - htmlRect.setCenterAndSize( getRect().getCenterX() - 2, getRect().getCenterY(), getRect().getWidth() + 6, getRect().getHeight()); + htmlRect.setCenterAndSize( getRect().getCenterX() - 2, getRect().getCenterY(), getRect().getWidth() + 6, getRect().getHeight()); #else - htmlRect.setCenterAndSize( getRect().getCenterX() - 2, getRect().getCenterY() + 40, getRect().getWidth() + 6, getRect().getHeight() - 78 ); + htmlRect.setCenterAndSize( getRect().getCenterX() - 2, getRect().getCenterY() + 40, getRect().getWidth() + 6, getRect().getHeight() - 78 ); #endif - web_browser->setRect( htmlRect ); - web_browser->reshape( htmlRect.getWidth(), htmlRect.getHeight(), TRUE ); - reshape( getRect().getWidth(), getRect().getHeight(), 1 ); - - // kick off a request to grab the url manually - gResponsePtr = LLIamHereLogin::build( this ); - std::string login_page = gSavedSettings.getString("LoginPage"); - if (login_page.empty()) - { - login_page = getString( "real_url" ); - } - LLHTTPClient::head( login_page, gResponsePtr ); - }; + web_browser->setRect( htmlRect ); + web_browser->reshape( htmlRect.getWidth(), htmlRect.getHeight(), TRUE ); + reshape( getRect().getWidth(), getRect().getHeight(), 1 ); + + // kick off a request to grab the url manually + gResponsePtr = LLIamHereLogin::build( this ); + std::string login_page = gSavedSettings.getString("LoginPage"); + if (login_page.empty()) + { + login_page = getString( "real_url" ); + } + LLHTTPClient::head( login_page, gResponsePtr ); #if !USE_VIEWER_AUTH // Initialize visibility (and don't force visibility - use prefs) @@ -549,15 +534,13 @@ LLPanelLogin::~LLPanelLogin() if ( gResponsePtr ) gResponsePtr->setParent( 0 ); - // We know we're done with the image, so be rid of it. - gImageList.deleteImage( mLogoImage ); + //// We know we're done with the image, so be rid of it. + //gImageList.deleteImage( mLogoImage ); } // virtual void LLPanelLogin::draw() { - if (!getVisible()) return; - glPushMatrix(); { F32 image_aspect = 1.333333f; @@ -578,14 +561,14 @@ void LLPanelLogin::draw() // draw a background box in black gl_rect_2d( 0, height - 264, width, 264, LLColor4( 0.0f, 0.0f, 0.0f, 1.f ) ); // draw the bottom part of the background image - just the blue background to the native client UI - gl_draw_scaled_image(0, -264, width + 8, mLogoImage->getHeight(), mLogoImage); + mLogoImage->draw(0, -264, width + 8, mLogoImage->getHeight()); #endif } else { // the HTML login page is not available so default to the original screen S32 offscreen_part = height / 3; - gl_draw_scaled_image(0, -offscreen_part, width, height+offscreen_part, mLogoImage); + mLogoImage->draw(0, -offscreen_part, width, height+offscreen_part); }; } glPopMatrix(); @@ -594,56 +577,50 @@ void LLPanelLogin::draw() } // virtual -BOOL LLPanelLogin::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent) +BOOL LLPanelLogin::handleKeyHere(KEY key, MASK mask) { - if (getVisible() && getEnabled()) + if (( KEY_RETURN == key ) && (MASK_ALT == mask)) { - if (( KEY_RETURN == key ) && (MASK_ALT == mask)) - { - gViewerWindow->toggleFullscreen(FALSE); - return TRUE; - } + gViewerWindow->toggleFullscreen(FALSE); + return TRUE; + } - if (('P' == key) && (MASK_CONTROL == mask)) - { - LLFloaterPreference::show(NULL); - return TRUE; - } + if (('P' == key) && (MASK_CONTROL == mask)) + { + LLFloaterPreference::show(NULL); + return TRUE; + } - if (('T' == key) && (MASK_CONTROL == mask)) - { - new LLFloaterSimple("floater_test.xml"); - return TRUE; - } - - if ( KEY_F1 == key ) - { - llinfos << "Spawning HTML help window" << llendl; - gViewerHtmlHelp.show(); - return TRUE; - } + if (('T' == key) && (MASK_CONTROL == mask)) + { + new LLFloaterSimple("floater_test.xml"); + return TRUE; + } + + if ( KEY_F1 == key ) + { + llinfos << "Spawning HTML help window" << llendl; + gViewerHtmlHelp.show(); + return TRUE; + } # if !LL_RELEASE_FOR_DOWNLOAD - if ( KEY_F2 == key ) - { - llinfos << "Spawning floater TOS window" << llendl; - LLFloaterTOS* tos_dialog = LLFloaterTOS::show(LLFloaterTOS::TOS_TOS,""); - tos_dialog->startModal(); - return TRUE; - } + if ( KEY_F2 == key ) + { + llinfos << "Spawning floater TOS window" << llendl; + LLFloaterTOS* tos_dialog = LLFloaterTOS::show(LLFloaterTOS::TOS_TOS,""); + tos_dialog->startModal(); + return TRUE; + } #endif - if (!called_from_parent) - { - if (KEY_RETURN == key && MASK_NONE == mask) - { - // let the panel handle UICtrl processing: calls onClickConnect() - return LLPanel::handleKeyHere(key, mask, called_from_parent); - } - } + if (KEY_RETURN == key && MASK_NONE == mask) + { + // let the panel handle UICtrl processing: calls onClickConnect() + return LLPanel::handleKeyHere(key, mask); } - return LLPanel::handleKeyHere(key, mask, called_from_parent); + return LLPanel::handleKeyHere(key, mask); } // virtual @@ -685,12 +662,12 @@ void LLPanelLogin::giveFocus() { // User saved his name but not his password. Move // focus to password field. - edit = LLUICtrlFactory::getLineEditorByName(sInstance, "password_edit"); + edit = sInstance->getChild<LLLineEditor>("password_edit"); } else { // User doesn't have a name, so start there. - edit = LLUICtrlFactory::getLineEditorByName(sInstance, "first_name_edit"); + edit = sInstance->getChild<LLLineEditor>("first_name_edit"); } if (edit) @@ -771,12 +748,9 @@ void LLPanelLogin::addServer(const char *server, S32 domain_name) return; } - LLComboBox* combo = LLUICtrlFactory::getComboBoxByName(sInstance, "server_combo"); - if (combo) - { - combo->add(server, LLSD(domain_name) ); - combo->setCurrentByIndex(0); - } + LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo"); + combo->add(server, LLSD(domain_name) ); + combo->setCurrentByIndex(0); } // static @@ -810,27 +784,24 @@ BOOL LLPanelLogin::getServer(LLString &server, S32 &domain_name) } else { - LLComboBox* combo = LLUICtrlFactory::getComboBoxByName(sInstance, "server_combo"); - if (combo) + LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo"); + LLSD combo_val = combo->getValue(); + if (LLSD::TypeInteger == combo_val.type()) { - LLSD combo_val = combo->getValue(); - if (LLSD::TypeInteger == combo_val.type()) - { - domain_name = combo->getValue().asInteger(); + domain_name = combo->getValue().asInteger(); - if ((S32)GRID_INFO_OTHER == domain_name) - { - server = gGridName; - } - } - else + if ((S32)GRID_INFO_OTHER == domain_name) { - // no valid selection, return other - domain_name = (S32)GRID_INFO_OTHER; - server = combo_val.asString(); + server = gGridName; } - user_picked = combo->isDirty(); } + else + { + // no valid selection, return other + domain_name = (S32)GRID_INFO_OTHER; + server = combo_val.asString(); + } + user_picked = combo->isDirty(); } return user_picked; @@ -845,11 +816,8 @@ void LLPanelLogin::getLocation(LLString &location) return; } - LLComboBox* combo = LLUICtrlFactory::getComboBoxByName(sInstance, "start_location_combo"); - if (combo) - { - location = combo->getValue().asString(); - } + LLComboBox* combo = sInstance->getChild<LLComboBox>("start_location_combo"); + location = combo->getValue().asString(); } // static @@ -860,8 +828,7 @@ void LLPanelLogin::refreshLocation( bool force_visible ) #if USE_VIEWER_AUTH loadLoginPage(); #else - LLComboBox* combo = LLUICtrlFactory::getComboBoxByName(sInstance, "start_location_combo"); - if (!combo) return; + LLComboBox* combo = sInstance->getChild<LLComboBox>("start_location_combo"); if (LLURLSimString::parse()) { @@ -1093,15 +1060,12 @@ void LLPanelLogin::onClickConnect(void *) // has both first and last name typed // store off custom server entry, if currently selected - LLComboBox* combo = LLUICtrlFactory::getComboBoxByName(sInstance, "server_combo"); - if (combo) + LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo"); + S32 selected_server = combo->getValue(); + if (selected_server == GRID_INFO_NONE) { - S32 selected_server = combo->getValue(); - if (selected_server == GRID_INFO_NONE) - { - LLString custom_server = combo->getValue().asString(); - gSavedSettings.setString("CustomServer", custom_server); - } + LLString custom_server = combo->getValue().asString(); + gSavedSettings.setString("CustomServer", custom_server); } sInstance->mCallback(0, sInstance->mCallbackData); } diff --git a/indra/newview/llpanellogin.h b/indra/newview/llpanellogin.h index 76a16528cb..ac6e3b0426 100644 --- a/indra/newview/llpanellogin.h +++ b/indra/newview/llpanellogin.h @@ -74,7 +74,7 @@ public: void *callback_data); ~LLPanelLogin(); - virtual BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent); + virtual BOOL handleKeyHere(KEY key, MASK mask); virtual void draw(); virtual void setFocus( BOOL b ); @@ -114,7 +114,7 @@ private: static void onPassKey(LLLineEditor* caller, void* user_data); private: - LLPointer<LLViewerImage> mLogoImage; + LLPointer<LLUIImage> mLogoImage; void (*mCallback)(S32 option, void *userdata); void* mCallbackData; diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index 1ad71075ae..83f72160e1 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -69,7 +69,7 @@ #include "llworld.h" #include "pipeline.h" #include "llviewercontrol.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llfirstuse.h" #include "lldrawpool.h" @@ -110,57 +110,57 @@ BOOL LLPanelObject::postBuild() //-------------------------------------------------------- // Lock checkbox - mCheckLock = gUICtrlFactory->getCheckBoxByName(this,"checkbox locked"); + mCheckLock = getChild<LLCheckBoxCtrl>("checkbox locked"); childSetCommitCallback("checkbox locked",onCommitLock,this); // Physical checkbox - mCheckPhysics = gUICtrlFactory->getCheckBoxByName(this,"Physical Checkbox Ctrl"); + mCheckPhysics = getChild<LLCheckBoxCtrl>("Physical Checkbox Ctrl"); childSetCommitCallback("Physical Checkbox Ctrl",onCommitPhysics,this); // Temporary checkbox - mCheckTemporary = gUICtrlFactory->getCheckBoxByName(this,"Temporary Checkbox Ctrl"); + mCheckTemporary = getChild<LLCheckBoxCtrl>("Temporary Checkbox Ctrl"); childSetCommitCallback("Temporary Checkbox Ctrl",onCommitTemporary,this); // Phantom checkbox - mCheckPhantom = gUICtrlFactory->getCheckBoxByName(this,"Phantom Checkbox Ctrl"); + mCheckPhantom = getChild<LLCheckBoxCtrl>("Phantom Checkbox Ctrl"); childSetCommitCallback("Phantom Checkbox Ctrl",onCommitPhantom,this); // Position - mLabelPosition = gUICtrlFactory->getTextBoxByName(this,"label position"); - mCtrlPosX = gUICtrlFactory->getSpinnerByName(this,"Pos X"); + mLabelPosition = getChild<LLTextBox>("label position"); + mCtrlPosX = getChild<LLSpinCtrl>("Pos X"); childSetCommitCallback("Pos X",onCommitPosition,this); - mCtrlPosY = gUICtrlFactory->getSpinnerByName(this,"Pos Y"); + mCtrlPosY = getChild<LLSpinCtrl>("Pos Y"); childSetCommitCallback("Pos Y",onCommitPosition,this); - mCtrlPosZ = gUICtrlFactory->getSpinnerByName(this,"Pos Z"); + mCtrlPosZ = getChild<LLSpinCtrl>("Pos Z"); childSetCommitCallback("Pos Z",onCommitPosition,this); // Scale - mLabelSize = gUICtrlFactory->getTextBoxByName(this,"label size"); - mCtrlScaleX = gUICtrlFactory->getSpinnerByName(this,"Scale X"); + mLabelSize = getChild<LLTextBox>("label size"); + mCtrlScaleX = getChild<LLSpinCtrl>("Scale X"); childSetCommitCallback("Scale X",onCommitScale,this); // Scale Y - mCtrlScaleY = gUICtrlFactory->getSpinnerByName(this,"Scale Y"); + mCtrlScaleY = getChild<LLSpinCtrl>("Scale Y"); childSetCommitCallback("Scale Y",onCommitScale,this); // Scale Z - mCtrlScaleZ = gUICtrlFactory->getSpinnerByName(this,"Scale Z"); + mCtrlScaleZ = getChild<LLSpinCtrl>("Scale Z"); childSetCommitCallback("Scale Z",onCommitScale,this); // Rotation - mLabelRotation = gUICtrlFactory->getTextBoxByName(this,"label rotation"); - mCtrlRotX = gUICtrlFactory->getSpinnerByName(this,"Rot X"); + mLabelRotation = getChild<LLTextBox>("label rotation"); + mCtrlRotX = getChild<LLSpinCtrl>("Rot X"); childSetCommitCallback("Rot X",onCommitRotation,this); - mCtrlRotY = gUICtrlFactory->getSpinnerByName(this,"Rot Y"); + mCtrlRotY = getChild<LLSpinCtrl>("Rot Y"); childSetCommitCallback("Rot Y",onCommitRotation,this); - mCtrlRotZ = gUICtrlFactory->getSpinnerByName(this,"Rot Z"); + mCtrlRotZ = getChild<LLSpinCtrl>("Rot Z"); childSetCommitCallback("Rot Z",onCommitRotation,this); //-------------------------------------------------------- // material type popup - mLabelMaterial = gUICtrlFactory->getTextBoxByName(this,"label material"); - mComboMaterial = gUICtrlFactory->getComboBoxByName(this,"material"); + mLabelMaterial = getChild<LLTextBox>("label material"); + mComboMaterial = getChild<LLComboBox>("material"); childSetCommitCallback("material",onCommitMaterial,this); mComboMaterial->removeall(); // *TODO:translate @@ -176,84 +176,84 @@ BOOL LLPanelObject::postBuild() mComboMaterialItemCount = mComboMaterial->getItemCount(); // Base Type - mLabelBaseType = gUICtrlFactory->getTextBoxByName(this,"label basetype"); - mComboBaseType = gUICtrlFactory->getComboBoxByName(this,"comboBaseType"); + mLabelBaseType = getChild<LLTextBox>("label basetype"); + mComboBaseType = getChild<LLComboBox>("comboBaseType"); childSetCommitCallback("comboBaseType",onCommitParametric,this); // Cut - mLabelCut = gUICtrlFactory->getTextBoxByName(this,"text cut"); - mSpinCutBegin = gUICtrlFactory->getSpinnerByName(this,"cut begin"); + mLabelCut = getChild<LLTextBox>("text cut"); + mSpinCutBegin = getChild<LLSpinCtrl>("cut begin"); childSetCommitCallback("cut begin",onCommitParametric,this); mSpinCutBegin->setValidateBeforeCommit( precommitValidate ); - mSpinCutEnd = gUICtrlFactory->getSpinnerByName(this,"cut end"); + mSpinCutEnd = getChild<LLSpinCtrl>("cut end"); childSetCommitCallback("cut end",onCommitParametric,this); mSpinCutEnd->setValidateBeforeCommit( &precommitValidate ); // Hollow / Skew - mLabelHollow = gUICtrlFactory->getTextBoxByName(this,"text hollow"); - mLabelSkew = gUICtrlFactory->getTextBoxByName(this,"text skew"); - mSpinHollow = gUICtrlFactory->getSpinnerByName(this,"Scale 1"); + mLabelHollow = getChild<LLTextBox>("text hollow"); + mLabelSkew = getChild<LLTextBox>("text skew"); + mSpinHollow = getChild<LLSpinCtrl>("Scale 1"); childSetCommitCallback("Scale 1",onCommitParametric,this); mSpinHollow->setValidateBeforeCommit( &precommitValidate ); - mSpinSkew = gUICtrlFactory->getSpinnerByName(this,"Skew"); + mSpinSkew = getChild<LLSpinCtrl>("Skew"); childSetCommitCallback("Skew",onCommitParametric,this); mSpinSkew->setValidateBeforeCommit( &precommitValidate ); - mLabelHoleType = gUICtrlFactory->getTextBoxByName(this,"Hollow Shape"); + mLabelHoleType = getChild<LLTextBox>("Hollow Shape"); // Hole Type - mComboHoleType = gUICtrlFactory->getComboBoxByName(this,"hole"); + mComboHoleType = getChild<LLComboBox>("hole"); childSetCommitCallback("hole",onCommitParametric,this); // Twist - mLabelTwist = gUICtrlFactory->getTextBoxByName(this,"text twist"); - mSpinTwistBegin = gUICtrlFactory->getSpinnerByName(this,"Twist Begin"); + mLabelTwist = getChild<LLTextBox>("text twist"); + mSpinTwistBegin = getChild<LLSpinCtrl>("Twist Begin"); childSetCommitCallback("Twist Begin",onCommitParametric,this); mSpinTwistBegin->setValidateBeforeCommit( precommitValidate ); - mSpinTwist = gUICtrlFactory->getSpinnerByName(this,"Twist End"); + mSpinTwist = getChild<LLSpinCtrl>("Twist End"); childSetCommitCallback("Twist End",onCommitParametric,this); mSpinTwist->setValidateBeforeCommit( &precommitValidate ); // Scale - mSpinScaleX = gUICtrlFactory->getSpinnerByName(this,"Taper Scale X"); + mSpinScaleX = getChild<LLSpinCtrl>("Taper Scale X"); childSetCommitCallback("Taper Scale X",onCommitParametric,this); mSpinScaleX->setValidateBeforeCommit( &precommitValidate ); - mSpinScaleY = gUICtrlFactory->getSpinnerByName(this,"Taper Scale Y"); + mSpinScaleY = getChild<LLSpinCtrl>("Taper Scale Y"); childSetCommitCallback("Taper Scale Y",onCommitParametric,this); mSpinScaleY->setValidateBeforeCommit( &precommitValidate ); // Shear - mLabelShear = gUICtrlFactory->getTextBoxByName(this,"text topshear"); - mSpinShearX = gUICtrlFactory->getSpinnerByName(this,"Shear X"); + mLabelShear = getChild<LLTextBox>("text topshear"); + mSpinShearX = getChild<LLSpinCtrl>("Shear X"); childSetCommitCallback("Shear X",onCommitParametric,this); mSpinShearX->setValidateBeforeCommit( &precommitValidate ); - mSpinShearY = gUICtrlFactory->getSpinnerByName(this,"Shear Y"); + mSpinShearY = getChild<LLSpinCtrl>("Shear Y"); childSetCommitCallback("Shear Y",onCommitParametric,this); mSpinShearY->setValidateBeforeCommit( &precommitValidate ); // Path / Profile - mCtrlPathBegin = gUICtrlFactory->getSpinnerByName(this,"Path Limit Begin"); + mCtrlPathBegin = getChild<LLSpinCtrl>("Path Limit Begin"); childSetCommitCallback("Path Limit Begin",onCommitParametric,this); mCtrlPathBegin->setValidateBeforeCommit( &precommitValidate ); - mCtrlPathEnd = gUICtrlFactory->getSpinnerByName(this,"Path Limit End"); + mCtrlPathEnd = getChild<LLSpinCtrl>("Path Limit End"); childSetCommitCallback("Path Limit End",onCommitParametric,this); mCtrlPathEnd->setValidateBeforeCommit( &precommitValidate ); // Taper - mLabelTaper = gUICtrlFactory->getTextBoxByName(this,"text taper2"); - mSpinTaperX = gUICtrlFactory->getSpinnerByName(this,"Taper X"); + mLabelTaper = getChild<LLTextBox>("text taper2"); + mSpinTaperX = getChild<LLSpinCtrl>("Taper X"); childSetCommitCallback("Taper X",onCommitParametric,this); mSpinTaperX->setValidateBeforeCommit( precommitValidate ); - mSpinTaperY = gUICtrlFactory->getSpinnerByName(this,"Taper Y"); + mSpinTaperY = getChild<LLSpinCtrl>("Taper Y"); childSetCommitCallback("Taper Y",onCommitParametric,this); mSpinTaperY->setValidateBeforeCommit( precommitValidate ); // Radius Offset / Revolutions - mLabelRadiusOffset = gUICtrlFactory->getTextBoxByName(this,"text radius delta"); - mLabelRevolutions = gUICtrlFactory->getTextBoxByName(this,"text revolutions"); - mSpinRadiusOffset = gUICtrlFactory->getSpinnerByName(this,"Radius Offset"); + mLabelRadiusOffset = getChild<LLTextBox>("text radius delta"); + mLabelRevolutions = getChild<LLTextBox>("text revolutions"); + mSpinRadiusOffset = getChild<LLSpinCtrl>("Radius Offset"); childSetCommitCallback("Radius Offset",onCommitParametric,this); mSpinRadiusOffset->setValidateBeforeCommit( &precommitValidate ); - mSpinRevolutions = gUICtrlFactory->getSpinnerByName(this,"Revolutions"); + mSpinRevolutions = getChild<LLSpinCtrl>("Revolutions"); childSetCommitCallback("Revolutions",onCommitParametric,this); mSpinRevolutions->setValidateBeforeCommit( &precommitValidate ); @@ -272,7 +272,7 @@ BOOL LLPanelObject::postBuild() // Allow any texture to be used during non-immediate mode. mCtrlSculptTexture->setNonImmediateFilterPermMask(PERM_NONE); LLAggregatePermissions texture_perms; - if (gSelectMgr->selectGetAggregateTexturePermissions(texture_perms)) + if (LLSelectMgr::getInstance()->selectGetAggregateTexturePermissions(texture_perms)) { BOOL can_copy = texture_perms.getValue(PERM_COPY) == LLAggregatePermissions::AP_EMPTY || @@ -288,8 +288,8 @@ BOOL LLPanelObject::postBuild() } } - mLabelSculptType = gUICtrlFactory->getTextBoxByName(this, "label sculpt type"); - mCtrlSculptType = gUICtrlFactory->getComboBoxByName(this, "sculpt type control"); + mLabelSculptType = getChild<LLTextBox>("label sculpt type"); + mCtrlSculptType = getChild<LLComboBox>( "sculpt type control"); childSetCommitCallback("sculpt type control", onCommitSculptType, this); @@ -317,11 +317,11 @@ LLPanelObject::~LLPanelObject() void LLPanelObject::getState( ) { - LLViewerObject* objectp = gSelectMgr->getSelection()->getFirstRootObject(); + LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject(); LLViewerObject* root_objectp = objectp; if(!objectp) { - objectp = gSelectMgr->getSelection()->getFirstObject(); + objectp = LLSelectMgr::getInstance()->getSelection()->getFirstObject(); // *FIX: shouldn't we just keep the child? if (objectp) { @@ -430,13 +430,13 @@ void LLPanelObject::getState( ) BOOL owners_identical; LLUUID owner_id; LLString owner_name; - owners_identical = gSelectMgr->selectGetOwner(owner_id, owner_name); + owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name); // BUG? Check for all objects being editable? - S32 roots_selected = gSelectMgr->getSelection()->getRootObjectCount(); + S32 roots_selected = LLSelectMgr::getInstance()->getSelection()->getRootObjectCount(); BOOL editable = root_objectp->permModify(); - S32 selected_count = gSelectMgr->getSelection()->getObjectCount(); - BOOL single_volume = (gSelectMgr->selectionAllPCode( LL_PCODE_VOLUME )) + S32 selected_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount(); + BOOL single_volume = (LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME )) && (selected_count == 1); // Select Single Message @@ -460,7 +460,7 @@ void LLPanelObject::getState( ) BOOL valid; U32 owner_mask_on; U32 owner_mask_off; - valid = gSelectMgr->selectGetPerm(PERM_OWNER, &owner_mask_on, &owner_mask_off); + valid = LLSelectMgr::getInstance()->selectGetPerm(PERM_OWNER, &owner_mask_on, &owner_mask_off); if(valid) { @@ -517,7 +517,7 @@ void LLPanelObject::getState( ) return object->getMaterial(); } } func; - bool material_same = gSelectMgr->getSelection()->getSelectedTEValue( &func, material_code ); + bool material_same = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, material_code ); if (editable && single_volume && material_same) { @@ -1075,7 +1075,7 @@ void LLPanelObject::getState( ) mSculptTypeRevert = sculpt_params->getSculptType(); } - LLTextureCtrl* mTextureCtrl = LLViewerUICtrlFactory::getTexturePickerByName(this,"sculpt texture control"); + LLTextureCtrl* mTextureCtrl = getChild<LLTextureCtrl>("sculpt texture control"); if(mTextureCtrl) { mTextureCtrl->setTentative(FALSE); @@ -1122,7 +1122,7 @@ void LLPanelObject::sendIsPhysical() BOOL value = mCheckPhysics->get(); if( mIsPhysical != value ) { - gSelectMgr->selectionUpdatePhysics(value); + LLSelectMgr::getInstance()->selectionUpdatePhysics(value); mIsPhysical = value; llinfos << "update physics sent" << llendl; @@ -1138,7 +1138,7 @@ void LLPanelObject::sendIsTemporary() BOOL value = mCheckTemporary->get(); if( mIsTemporary != value ) { - gSelectMgr->selectionUpdateTemporary(value); + LLSelectMgr::getInstance()->selectionUpdateTemporary(value); mIsTemporary = value; llinfos << "update temporary sent" << llendl; @@ -1155,7 +1155,7 @@ void LLPanelObject::sendIsPhantom() BOOL value = mCheckPhantom->get(); if( mIsPhantom != value ) { - gSelectMgr->selectionUpdatePhantom(value); + LLSelectMgr::getInstance()->selectionUpdatePhantom(value); mIsPhantom = value; llinfos << "update phantom sent" << llendl; @@ -1171,7 +1171,7 @@ void LLPanelObject::sendCastShadows() BOOL value = mCheckCastShadows->get(); if( mCastShadows != value ) { - gSelectMgr->selectionUpdateCastShadows(value); + LLSelectMgr::getInstance()->selectionUpdateCastShadows(value); mCastShadows = value; llinfos << "update cast shadows sent" << llendl; @@ -1195,7 +1195,7 @@ void LLPanelObject::onCommitMaterial( LLUICtrl* ctrl, void* userdata ) if (material_name != LEGACY_FULLBRIGHT_DESC) { U8 material_code = LLMaterialTable::basic.getMCode(material_name.c_str()); - gSelectMgr->selectionSetMaterial(material_code); + LLSelectMgr::getInstance()->selectionSetMaterial(material_code); } } } @@ -1573,7 +1573,7 @@ void LLPanelObject::sendRotation() mObject->setRotation(rotation, TRUE ); - gSelectMgr->sendMultipleUpdate(UPD_ROTATION); + LLSelectMgr::getInstance()->sendMultipleUpdate(UPD_ROTATION); } } @@ -1595,13 +1595,13 @@ void LLPanelObject::sendScale() BOOL dont_stretch_textures = !LLManipScale::getStretchTextures(); if (dont_stretch_textures) { - gSelectMgr->saveSelectedObjectTransform(SELECT_ACTION_TYPE_SCALE); + LLSelectMgr::getInstance()->saveSelectedObjectTransform(SELECT_ACTION_TYPE_SCALE); } mObject->setScale(newscale, TRUE); - gSelectMgr->sendMultipleUpdate(UPD_SCALE | UPD_POSITION); + LLSelectMgr::getInstance()->sendMultipleUpdate(UPD_SCALE | UPD_POSITION); - gSelectMgr->adjustTexturesByScale(TRUE, !dont_stretch_textures); + LLSelectMgr::getInstance()->adjustTexturesByScale(TRUE, !dont_stretch_textures); // llinfos << "scale sent" << llendl; } else @@ -1620,8 +1620,8 @@ void LLPanelObject::sendPosition() // Clamp the Z height const F32 height = newpos.mV[VZ]; - const F32 min_height = gWorldp->getMinAllowedZ(mObject); - const F32 max_height = gWorldPointer->getRegionMaxHeight(); + const F32 min_height = LLWorld::getInstance()->getMinAllowedZ(mObject); + const F32 max_height = LLWorld::getInstance()->getRegionMaxHeight(); if (!mObject->isAttachment()) { @@ -1639,7 +1639,7 @@ void LLPanelObject::sendPosition() // Grass is always drawn on the ground, so clamp its position to the ground if (mObject->getPCode() == LL_PCODE_LEGACY_GRASS) { - mCtrlPosZ->set(gWorldp->resolveLandHeightAgent(newpos) + 1.f); + mCtrlPosZ->set(LLWorld::getInstance()->resolveLandHeightAgent(newpos) + 1.f); } } @@ -1647,7 +1647,7 @@ void LLPanelObject::sendPosition() // won't get dumped by the simulator. LLVector3d new_pos_global = regionp->getPosGlobalFromRegion(newpos); - if ( gWorldPointer->positionRegionValidGlobal(new_pos_global) ) + if ( LLWorld::getInstance()->positionRegionValidGlobal(new_pos_global) ) { // send only if the position is changed, that is, the delta vector is not zero LLVector3d old_pos_global = mObject->getPositionGlobal(); @@ -1665,10 +1665,10 @@ void LLPanelObject::sendPosition() { mObject->setPositionEdit(newpos); } - gSelectMgr->sendMultipleUpdate(UPD_POSITION); + LLSelectMgr::getInstance()->sendMultipleUpdate(UPD_POSITION); //mRootObject->sendPositionUpdate(); - gSelectMgr->updateSelectionCenter(); + LLSelectMgr::getInstance()->updateSelectionCenter(); // llinfos << "position sent" << llendl; } @@ -1726,9 +1726,9 @@ void LLPanelObject::draw() const LLColor4 blue( 0.f, 0.5f, 1.0f, 1); // Tune the colors of the labels - LLTool* tool = gToolMgr->getCurrentTool(); + LLTool* tool = LLToolMgr::getInstance()->getCurrentTool(); - if (tool == gToolTranslate) + if (tool == LLToolCompTranslate::getInstance()) { mCtrlPosX ->setLabelColor(red); mCtrlPosY ->setLabelColor(green); @@ -1742,7 +1742,7 @@ void LLPanelObject::draw() mCtrlRotY ->setLabelColor(white); mCtrlRotZ ->setLabelColor(white); } - else if ( tool == gToolStretch ) + else if ( tool == LLToolCompScale::getInstance() ) { mCtrlPosX ->setLabelColor(white); mCtrlPosY ->setLabelColor(white); @@ -1756,7 +1756,7 @@ void LLPanelObject::draw() mCtrlRotY ->setLabelColor(white); mCtrlRotZ ->setLabelColor(white); } - else if ( tool == gToolRotate ) + else if ( tool == LLToolCompRotate::getInstance() ) { mCtrlPosX ->setLabelColor(white); mCtrlPosY ->setLabelColor(white); @@ -1846,7 +1846,7 @@ void LLPanelObject::onCommitLock(LLUICtrl *ctrl, void *data) BOOL new_state = self->mCheckLock->get(); - gSelectMgr->selectionSetObjectPermissions(PERM_OWNER, !new_state, PERM_MOVE | PERM_MODIFY); + LLSelectMgr::getInstance()->selectionSetObjectPermissions(PERM_OWNER, !new_state, PERM_MOVE | PERM_MODIFY); } // static diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp index 8ab31acb49..7f9dae8a64 100644 --- a/indra/newview/llpanelpermissions.cpp +++ b/indra/newview/llpanelpermissions.cpp @@ -61,7 +61,7 @@ #include "llfloatergroups.h" #include "llnamebox.h" #include "llviewercontrol.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "roles_constants.h" ///---------------------------------------------------------------------------- @@ -109,7 +109,7 @@ BOOL LLPanelPermissions::postBuild() this->childSetCommitCallback("clickaction",LLPanelPermissions::onCommitClickAction,this); this->childSetCommitCallback("search_check",LLPanelPermissions::onCommitIncludeInSearch,this); - LLTextBox* group_rect_proxy = gUICtrlFactory->getTextBoxByName(this,"Group Name Proxy"); + LLTextBox* group_rect_proxy = getChild<LLTextBox>("Group Name Proxy"); if(group_rect_proxy ) { mLabelGroupName = new LLNameBox("Group Name", group_rect_proxy->getRect()); @@ -132,7 +132,7 @@ LLPanelPermissions::~LLPanelPermissions() void LLPanelPermissions::refresh() { - LLButton* BtnDeedToGroup = gUICtrlFactory->getButtonByName(this,"button deed"); + LLButton* BtnDeedToGroup = getChild<LLButton>("button deed"); if(BtnDeedToGroup) { LLString deedText; @@ -148,16 +148,16 @@ void LLPanelPermissions::refresh() BtnDeedToGroup->setLabelUnselected(deedText); } BOOL root_selected = TRUE; - LLSelectNode* nodep = gSelectMgr->getSelection()->getFirstRootNode(); - S32 object_count = gSelectMgr->getSelection()->getRootObjectCount(); + LLSelectNode* nodep = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); + S32 object_count = LLSelectMgr::getInstance()->getSelection()->getRootObjectCount(); if(!nodep || 0 == object_count) { - nodep = gSelectMgr->getSelection()->getFirstNode(); - object_count = gSelectMgr->getSelection()->getObjectCount(); + nodep = LLSelectMgr::getInstance()->getSelection()->getFirstNode(); + object_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount(); root_selected = FALSE; } - //BOOL attachment_selected = gSelectMgr->getSelection()->isAttachment(); + //BOOL attachment_selected = LLSelectMgr::getInstance()->getSelection()->isAttachment(); //attachment_selected = false; LLViewerObject* objectp = NULL; if(nodep) objectp = nodep->getObject(); @@ -222,7 +222,7 @@ void LLPanelPermissions::refresh() childSetValue("search_check", FALSE); childSetEnabled("search_check", false); - LLRadioGroup* RadioSaleType = gUICtrlFactory->getRadioGroupByName(this,"sale type"); + LLRadioGroup* RadioSaleType = getChild<LLRadioGroup>("sale type"); if(RadioSaleType) { RadioSaleType->setSelectedIndex(-1); @@ -234,7 +234,7 @@ void LLPanelPermissions::refresh() childSetEnabled("EdCost",false); childSetEnabled("label click action",false); - LLComboBox* ComboClickAction = gUICtrlFactory->getComboBoxByName(this,"clickaction"); + LLComboBox* ComboClickAction = getChild<LLComboBox>("clickaction"); if(ComboClickAction) { ComboClickAction->setEnabled(FALSE); @@ -254,9 +254,9 @@ void LLPanelPermissions::refresh() BOOL is_one_object = (object_count == 1); // BUG: fails if a root and non-root are both single-selected. - BOOL is_perm_modify = (gSelectMgr->getSelection()->getFirstRootNode() - && gSelectMgr->selectGetRootsModify()) - || gSelectMgr->selectGetModify(); + BOOL is_perm_modify = (LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() + && LLSelectMgr::getInstance()->selectGetRootsModify()) + || LLSelectMgr::getInstance()->selectGetModify(); const LLView* keyboard_focus_view = gFocusMgr.getKeyboardFocus(); S32 string_index = 0; LLString MODIFY_INFO_STRINGS[] = @@ -283,7 +283,7 @@ void LLPanelPermissions::refresh() childSetEnabled("Creator:",true); BOOL creators_identical; LLString creator_name; - creators_identical = gSelectMgr->selectGetCreator(mCreatorID, + creators_identical = LLSelectMgr::getInstance()->selectGetCreator(mCreatorID, creator_name); childSetText("Creator Name",creator_name); @@ -295,13 +295,13 @@ void LLPanelPermissions::refresh() BOOL owners_identical; LLString owner_name; - owners_identical = gSelectMgr->selectGetOwner(mOwnerID, owner_name); + owners_identical = LLSelectMgr::getInstance()->selectGetOwner(mOwnerID, owner_name); // llinfos << "owners_identical " << (owners_identical ? "TRUE": "FALSE") << llendl; if (mOwnerID.isNull()) { - if(gSelectMgr->selectIsGroupOwned()) + if(LLSelectMgr::getInstance()->selectIsGroupOwned()) { // Group owned already displayed by selectGetOwner } @@ -309,7 +309,7 @@ void LLPanelPermissions::refresh() { // Display last owner if public LLString last_owner_name; - gSelectMgr->selectGetLastOwner(mLastOwnerID, last_owner_name); + LLSelectMgr::getInstance()->selectGetLastOwner(mLastOwnerID, last_owner_name); // It should never happen that the last owner is null and the owner // is null, but it seems to be a bug in the simulator right now. JC @@ -323,12 +323,12 @@ void LLPanelPermissions::refresh() childSetText("Owner Name",owner_name); childSetEnabled("Owner Name",TRUE); - childSetEnabled("button owner profile",owners_identical && (mOwnerID.notNull() || gSelectMgr->selectIsGroupOwned())); + childSetEnabled("button owner profile",owners_identical && (mOwnerID.notNull() || LLSelectMgr::getInstance()->selectIsGroupOwned())); // update group text field childSetEnabled("Group:",true); LLUUID group_id; - BOOL groups_identical = gSelectMgr->selectGetGroup(group_id); + BOOL groups_identical = LLSelectMgr::getInstance()->selectGetGroup(group_id); if (groups_identical) { if(mLabelGroupName) @@ -348,14 +348,14 @@ void LLPanelPermissions::refresh() if(is_one_object) { childSetEnabled("Name:",true); - LLLineEditor* LineEditorObjectName = gUICtrlFactory->getLineEditorByName(this,"Object Name"); + LLLineEditor* LineEditorObjectName = getChild<LLLineEditor>("Object Name"); if(keyboard_focus_view != LineEditorObjectName) { childSetText("Object Name",nodep->mName); } childSetEnabled("Description:",true); - LLLineEditor* LineEditorObjectDesc = gUICtrlFactory->getLineEditorByName(this,"Object Description"); + LLLineEditor* LineEditorObjectDesc = getChild<LLLineEditor>("Object Description"); if(LineEditorObjectDesc) { if(keyboard_focus_view != LineEditorObjectDesc) @@ -378,8 +378,8 @@ void LLPanelPermissions::refresh() // Pre-compute object info string - S32 prim_count = gSelectMgr->getSelection()->getObjectCount(); - S32 obj_count = gSelectMgr->getSelection()->getRootObjectCount(); + S32 prim_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount(); + S32 obj_count = LLSelectMgr::getInstance()->getSelection()->getRootObjectCount(); LLString object_info_string; if (1 == obj_count) @@ -406,17 +406,17 @@ void LLPanelPermissions::refresh() childSetEnabled("prim info",true); S32 price; - BOOL is_for_sale = gSelectMgr->selectIsForSale(price); + BOOL is_for_sale = LLSelectMgr::getInstance()->selectIsForSale(price); if (!is_for_sale) { price = DEFAULT_PRICE; } BOOL self_owned = (gAgent.getID() == mOwnerID); - BOOL group_owned = gSelectMgr->selectIsGroupOwned() ; - BOOL public_owned = (mOwnerID.isNull() && !gSelectMgr->selectIsGroupOwned()); - BOOL can_transfer = gSelectMgr->selectGetRootsTransfer(); - BOOL can_copy = gSelectMgr->selectGetRootsCopy(); + BOOL group_owned = LLSelectMgr::getInstance()->selectIsGroupOwned() ; + BOOL public_owned = (mOwnerID.isNull() && !LLSelectMgr::getInstance()->selectIsGroupOwned()); + BOOL can_transfer = LLSelectMgr::getInstance()->selectGetRootsTransfer(); + BOOL can_copy = LLSelectMgr::getInstance()->selectGetRootsCopy(); if(!owners_identical) { @@ -426,7 +426,7 @@ void LLPanelPermissions::refresh() } else if(self_owned || (group_owned && gAgent.hasPowerInGroup(group_id,GP_OBJECT_SET_SALE))) { - LLLineEditor* EditPrice = gUICtrlFactory->getLineEditorByName(this,"EdCost"); + LLLineEditor* EditPrice = getChild<LLLineEditor>("EdCost"); if(keyboard_focus_view != EditPrice) { childSetText("EdCost",llformat("%d",price)); @@ -478,23 +478,23 @@ void LLPanelPermissions::refresh() U32 next_owner_mask_on = 0; U32 next_owner_mask_off = 0; - valid_base_perms = gSelectMgr->selectGetPerm(PERM_BASE, + valid_base_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_BASE, &base_mask_on, &base_mask_off); - valid_owner_perms = gSelectMgr->selectGetPerm(PERM_OWNER, + valid_owner_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_OWNER, &owner_mask_on, &owner_mask_off); - valid_group_perms = gSelectMgr->selectGetPerm(PERM_GROUP, + valid_group_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_GROUP, &group_mask_on, &group_mask_off); - valid_everyone_perms = gSelectMgr->selectGetPerm(PERM_EVERYONE, + valid_everyone_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_EVERYONE, &everyone_mask_on, &everyone_mask_off); - valid_next_perms = gSelectMgr->selectGetPerm(PERM_NEXT_OWNER, + valid_next_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_NEXT_OWNER, &next_owner_mask_on, &next_owner_mask_off); @@ -724,10 +724,10 @@ void LLPanelPermissions::refresh() // reflect sale information LLSaleInfo sale_info; - BOOL valid_sale_info = gSelectMgr->selectGetSaleInfo(sale_info); + BOOL valid_sale_info = LLSelectMgr::getInstance()->selectGetSaleInfo(sale_info); LLSaleInfo::EForSale sale_type = sale_info.getSaleType(); - LLRadioGroup* RadioSaleType = gUICtrlFactory->getRadioGroupByName(this,"sale type"); + LLRadioGroup* RadioSaleType = getChild<LLRadioGroup>("sale type"); if(RadioSaleType) { if (valid_sale_info) @@ -753,18 +753,18 @@ void LLPanelPermissions::refresh() } // Check search status of objects - BOOL all_volume = gSelectMgr->selectionAllPCode( LL_PCODE_VOLUME ); + BOOL all_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ); bool include_in_search; - bool all_include_in_search = gSelectMgr->selectionGetIncludeInSearch(&include_in_search); + bool all_include_in_search = LLSelectMgr::getInstance()->selectionGetIncludeInSearch(&include_in_search); childSetEnabled("search_check", has_change_sale_ability && all_volume); childSetValue("search_check", include_in_search); childSetTentative("search_check", ! all_include_in_search); // Click action (touch, sit, buy) U8 click_action = 0; - if (gSelectMgr->selectionGetClickAction(&click_action)) + if (LLSelectMgr::getInstance()->selectionGetClickAction(&click_action)) { - LLComboBox* ComboClickAction = gUICtrlFactory->getComboBoxByName(this,"clickaction"); + LLComboBox* ComboClickAction = getChild<LLComboBox>("clickaction"); if(ComboClickAction) { ComboClickAction->setCurrentByIndex((S32)click_action); @@ -779,14 +779,14 @@ void LLPanelPermissions::refresh() void LLPanelPermissions::onClickClaim(void*) { // try to claim ownership - gSelectMgr->sendOwner(gAgent.getID(), gAgent.getGroupID()); + LLSelectMgr::getInstance()->sendOwner(gAgent.getID(), gAgent.getGroupID()); } // static void LLPanelPermissions::onClickRelease(void*) { // try to release ownership - gSelectMgr->sendOwner(LLUUID::null, LLUUID::null); + LLSelectMgr::getInstance()->sendOwner(LLUUID::null, LLUUID::null); } // static @@ -802,10 +802,10 @@ void LLPanelPermissions::onClickOwner(void *data) { LLPanelPermissions *self = (LLPanelPermissions *)data; - if (gSelectMgr->selectIsGroupOwned()) + if (LLSelectMgr::getInstance()->selectIsGroupOwned()) { LLUUID group_id; - gSelectMgr->selectGetGroup(group_id); + LLSelectMgr::getInstance()->selectGetGroup(group_id); LLFloaterGroupInfo::showFromUUID(group_id); } else @@ -819,7 +819,7 @@ void LLPanelPermissions::onClickGroup(void* data) LLPanelPermissions* panelp = (LLPanelPermissions*)data; LLUUID owner_id; LLString name; - BOOL owners_identical = gSelectMgr->selectGetOwner(owner_id, name); + BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, name); LLFloater* parent_floater = gFloaterView->getParentFloater(panelp); if(owners_identical && (owner_id == gAgent.getID())) @@ -845,7 +845,7 @@ void LLPanelPermissions::cbGroupID(LLUUID group_id, void* userdata) { self->mLabelGroupName->setNameID(group_id, TRUE); } - gSelectMgr->sendGroup(group_id); + LLSelectMgr::getInstance()->sendGroup(group_id); } void callback_deed_to_group(S32 option, void*) @@ -853,11 +853,11 @@ void callback_deed_to_group(S32 option, void*) if (0 == option) { LLUUID group_id; - BOOL groups_identical = gSelectMgr->selectGetGroup(group_id); + BOOL groups_identical = LLSelectMgr::getInstance()->selectGetGroup(group_id); if(groups_identical && (gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED))) { - gSelectMgr->sendOwner(LLUUID::null, group_id, FALSE); -// gViewerStats->incStat(LLViewerStats::ST_RELEASE_COUNT); + LLSelectMgr::getInstance()->sendOwner(LLUUID::null, group_id, FALSE); +// LLViewerStats::getInstance()->incStat(LLViewerStats::ST_RELEASE_COUNT); } } } @@ -875,7 +875,7 @@ void LLPanelPermissions::onClickDeedToGroup(void* data) // static void LLPanelPermissions::onCommitPerm(LLUICtrl *ctrl, void *data, U8 field, U32 perm) { - LLViewerObject* object = gSelectMgr->getSelection()->getFirstRootObject(); + LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject(); if(!object) return; // Checkbox will have toggled itself @@ -883,7 +883,7 @@ void LLPanelPermissions::onCommitPerm(LLUICtrl *ctrl, void *data, U8 field, U32 LLCheckBoxCtrl *check = (LLCheckBoxCtrl *)ctrl; BOOL new_state = check->get(); - gSelectMgr->selectionSetObjectPermissions(field, new_state, perm); + LLSelectMgr::getInstance()->selectionSetObjectPermissions(field, new_state, perm); } // static @@ -931,11 +931,11 @@ void LLPanelPermissions::onCommitName(LLUICtrl*, void* data) { //llinfos << "LLPanelPermissions::onCommitName()" << llendl; LLPanelPermissions* self = (LLPanelPermissions*)data; - LLLineEditor* tb = gUICtrlFactory->getLineEditorByName(self,"Object Name"); + LLLineEditor* tb = self->getChild<LLLineEditor>("Object Name"); if(tb) { - gSelectMgr->selectionSetObjectName(tb->getText()); -// gSelectMgr->selectionSetObjectName(self->mLabelObjectName->getText()); + LLSelectMgr::getInstance()->selectionSetObjectName(tb->getText()); +// LLSelectMgr::getInstance()->selectionSetObjectName(self->mLabelObjectName->getText()); } } @@ -945,10 +945,10 @@ void LLPanelPermissions::onCommitDesc(LLUICtrl*, void* data) { //llinfos << "LLPanelPermissions::onCommitDesc()" << llendl; LLPanelPermissions* self = (LLPanelPermissions*)data; - LLLineEditor* le = gUICtrlFactory->getLineEditorByName(self,"Object Description"); + LLLineEditor* le = self->getChild<LLLineEditor>("Object Description"); if(le) { - gSelectMgr->selectionSetObjectDescription(le->getText()); + LLSelectMgr::getInstance()->selectionSetObjectDescription(le->getText()); } } @@ -971,11 +971,11 @@ void LLPanelPermissions::setAllSaleInfo() llinfos << "LLPanelPermissions::setAllSaleInfo()" << llendl; LLSaleInfo::EForSale sale_type = LLSaleInfo::FS_NOT; - LLCheckBoxCtrl* mCheckPurchase = gUICtrlFactory->getCheckBoxByName(this,"checkbox for sale"); + LLCheckBoxCtrl* mCheckPurchase = getChild<LLCheckBoxCtrl>("checkbox for sale"); if(mCheckPurchase && mCheckPurchase->get()) { - LLRadioGroup* RadioSaleType = gUICtrlFactory->getRadioGroupByName(this,"sale type"); + LLRadioGroup* RadioSaleType = getChild<LLRadioGroup>("sale type"); if(RadioSaleType) { switch(RadioSaleType->getSelectedIndex()) @@ -995,7 +995,7 @@ void LLPanelPermissions::setAllSaleInfo() } } } - LLLineEditor* mEditPrice = gUICtrlFactory->getLineEditorByName(this,"EdCost"); + LLLineEditor* mEditPrice = getChild<LLLineEditor>("EdCost"); S32 price = -1; if(mEditPrice) @@ -1010,17 +1010,17 @@ void LLPanelPermissions::setAllSaleInfo() } LLSaleInfo sale_info(sale_type, price); - gSelectMgr->selectionSetObjectSaleInfo(sale_info); + LLSelectMgr::getInstance()->selectionSetObjectSaleInfo(sale_info); // If turned off for-sale, make sure click-action buy is turned // off as well if (sale_type == LLSaleInfo::FS_NOT) { U8 click_action = 0; - gSelectMgr->selectionGetClickAction(&click_action); + LLSelectMgr::getInstance()->selectionGetClickAction(&click_action); if (click_action == CLICK_ACTION_BUY) { - gSelectMgr->selectionSetClickAction(CLICK_ACTION_TOUCH); + LLSelectMgr::getInstance()->selectionSetClickAction(CLICK_ACTION_TOUCH); } } } @@ -1046,14 +1046,14 @@ void LLPanelPermissions::onCommitClickAction(LLUICtrl* ctrl, void*) if (click_action == CLICK_ACTION_BUY) { LLSaleInfo sale_info; - gSelectMgr->selectGetSaleInfo(sale_info); + LLSelectMgr::getInstance()->selectGetSaleInfo(sale_info); if (!sale_info.isForSale()) { gViewerWindow->alertXml("CantSetBuyObject"); // Set click action back to its old value U8 click_action = 0; - gSelectMgr->selectionGetClickAction(&click_action); + LLSelectMgr::getInstance()->selectionGetClickAction(&click_action); box->setCurrentByIndex((S32)click_action); return; @@ -1063,14 +1063,14 @@ void LLPanelPermissions::onCommitClickAction(LLUICtrl* ctrl, void*) { // Verify object has script with money() handler LLSelectionPayable payable; - bool can_pay = gSelectMgr->getSelection()->applyToObjects(&payable); + bool can_pay = LLSelectMgr::getInstance()->getSelection()->applyToObjects(&payable); if (!can_pay) { // Warn, but do it anyway. gViewerWindow->alertXml("ClickActionNotPayable"); } } - gSelectMgr->selectionSetClickAction(click_action); + LLSelectMgr::getInstance()->selectionSetClickAction(click_action); } // static @@ -1079,6 +1079,6 @@ void LLPanelPermissions::onCommitIncludeInSearch(LLUICtrl* ctrl, void*) LLCheckBoxCtrl* box = (LLCheckBoxCtrl*)ctrl; llassert(box); - gSelectMgr->selectionSetIncludeInSearch(box->get()); + LLSelectMgr::getInstance()->selectionSetIncludeInSearch(box->get()); } diff --git a/indra/newview/llpanelpick.cpp b/indra/newview/llpanelpick.cpp index 2a85d52689..674515273b 100644 --- a/indra/newview/llpanelpick.cpp +++ b/indra/newview/llpanelpick.cpp @@ -52,7 +52,7 @@ #include "lltexturectrl.h" #include "lluiconstants.h" #include "llviewergenericmessage.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llviewerparcelmgr.h" #include "llworldmap.h" #include "llfloaterworldmap.h" @@ -88,11 +88,11 @@ LLPanelPick::LLPanelPick(BOOL top_pick) std::string pick_def_file; if (top_pick) { - gUICtrlFactory->buildPanel(this, "panel_top_pick.xml"); + LLUICtrlFactory::getInstance()->buildPanel(this, "panel_top_pick.xml"); } else { - gUICtrlFactory->buildPanel(this, "panel_avatar_pick.xml"); + LLUICtrlFactory::getInstance()->buildPanel(this, "panel_avatar_pick.xml"); } } @@ -121,44 +121,44 @@ void LLPanelPick::reset() BOOL LLPanelPick::postBuild() { - mSnapshotCtrl = LLViewerUICtrlFactory::getTexturePickerByName(this, "snapshot_ctrl"); + mSnapshotCtrl = getChild<LLTextureCtrl>("snapshot_ctrl"); mSnapshotCtrl->setCommitCallback(onCommitAny); mSnapshotCtrl->setCallbackUserData(this); - mNameEditor = LLViewerUICtrlFactory::getLineEditorByName(this, "given_name_editor"); + mNameEditor = getChild<LLLineEditor>("given_name_editor"); mNameEditor->setCommitOnFocusLost(TRUE); mNameEditor->setCommitCallback(onCommitAny); mNameEditor->setCallbackUserData(this); - mDescEditor = LLUICtrlFactory::getTextEditorByName(this, "desc_editor"); + mDescEditor = getChild<LLTextEditor>("desc_editor"); mDescEditor->setCommitOnFocusLost(TRUE); mDescEditor->setCommitCallback(onCommitAny); mDescEditor->setCallbackUserData(this); mDescEditor->setTabsToNextField(TRUE); - mLocationEditor = LLViewerUICtrlFactory::getLineEditorByName(this, "location_editor"); + mLocationEditor = getChild<LLLineEditor>("location_editor"); - mSetBtn = LLViewerUICtrlFactory::getButtonByName(this, "set_location_btn"); + mSetBtn = getChild<LLButton>( "set_location_btn"); mSetBtn->setClickedCallback(onClickSet); mSetBtn->setCallbackUserData(this); - mTeleportBtn = LLViewerUICtrlFactory::getButtonByName(this, "pick_teleport_btn"); + mTeleportBtn = getChild<LLButton>( "pick_teleport_btn"); mTeleportBtn->setClickedCallback(onClickTeleport); mTeleportBtn->setCallbackUserData(this); - mMapBtn = LLViewerUICtrlFactory::getButtonByName(this, "pick_map_btn"); + mMapBtn = getChild<LLButton>( "pick_map_btn"); mMapBtn->setClickedCallback(onClickMap); mMapBtn->setCallbackUserData(this); - mSortOrderText = LLViewerUICtrlFactory::getTextBoxByName(this, "sort_order_text"); + mSortOrderText = getChild<LLTextBox>("sort_order_text"); - mSortOrderEditor = LLViewerUICtrlFactory::getLineEditorByName(this, "sort_order_editor"); + mSortOrderEditor = getChild<LLLineEditor>("sort_order_editor"); mSortOrderEditor->setPrevalidate(LLLineEditor::prevalidateInt); mSortOrderEditor->setCommitOnFocusLost(TRUE); mSortOrderEditor->setCommitCallback(onCommitAny); mSortOrderEditor->setCallbackUserData(this); - mEnabledCheck = LLViewerUICtrlFactory::getCheckBoxByName(this, "enabled_check"); + mEnabledCheck = getChild<LLCheckBoxCtrl>( "enabled_check"); mEnabledCheck->setCommitCallback(onCommitAny); mEnabledCheck->setCallbackUserData(this); @@ -176,7 +176,7 @@ void LLPanelPick::initNewPick() mPosGlobal = gAgent.getPositionGlobal(); // Try to fill in the current parcel - LLParcel* parcel = gParcelMgr->getAgentParcel(); + LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if (parcel) { mNameEditor->setText(parcel->getName()); @@ -367,12 +367,9 @@ void LLPanelPick::processPickInfoReply(LLMessageSystem *msg, void **) void LLPanelPick::draw() { - if (getVisible()) - { - refresh(); + refresh(); - LLPanel::draw(); - } + LLPanel::draw(); } diff --git a/indra/newview/llpanelplace.cpp b/indra/newview/llpanelplace.cpp index aa10dda62c..9985486170 100644 --- a/indra/newview/llpanelplace.cpp +++ b/indra/newview/llpanelplace.cpp @@ -52,7 +52,7 @@ #include "lltexturectrl.h" #include "llworldmap.h" #include "llviewerregion.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" //#include "llviewermenu.h" // create_landmark() #include "llweb.h" #include "llsdutil.h" @@ -85,33 +85,33 @@ BOOL LLPanelPlace::postBuild() // Since this is only used in the directory browser, always // disable the snapshot control. Otherwise clicking on it will // open a texture picker. - mSnapshotCtrl = LLViewerUICtrlFactory::getTexturePickerByName(this, "snapshot_ctrl"); + mSnapshotCtrl = getChild<LLTextureCtrl>("snapshot_ctrl"); mSnapshotCtrl->setEnabled(FALSE); - mNameEditor = LLViewerUICtrlFactory::getTextBoxByName(this, "name_editor"); + mNameEditor = getChild<LLTextBox>("name_editor"); // Text boxes appear to have a " " in them by default. This breaks the // emptiness test for filling in data from the network. Slam to empty. mNameEditor->setText( LLString::null ); - mDescEditor = LLUICtrlFactory::getTextEditorByName(this, "desc_editor"); + mDescEditor = getChild<LLTextEditor>("desc_editor"); - mInfoEditor = LLViewerUICtrlFactory::getTextBoxByName(this, "info_editor"); + mInfoEditor = getChild<LLTextBox>("info_editor"); - mLocationEditor = LLViewerUICtrlFactory::getTextBoxByName(this, "location_editor"); + mLocationEditor = getChild<LLTextBox>("location_editor"); - mTeleportBtn = LLViewerUICtrlFactory::getButtonByName(this, "teleport_btn"); + mTeleportBtn = getChild<LLButton>( "teleport_btn"); mTeleportBtn->setClickedCallback(onClickTeleport); mTeleportBtn->setCallbackUserData(this); - mMapBtn = LLViewerUICtrlFactory::getButtonByName(this, "map_btn"); + mMapBtn = getChild<LLButton>( "map_btn"); mMapBtn->setClickedCallback(onClickMap); mMapBtn->setCallbackUserData(this); - //mLandmarkBtn = LLViewerUICtrlFactory::getButtonByName(this, "landmark_btn"); + //mLandmarkBtn = getChild<LLButton>( "landmark_btn"); //mLandmarkBtn->setClickedCallback(onClickLandmark); //mLandmarkBtn->setCallbackUserData(this); - mAuctionBtn = LLViewerUICtrlFactory::getButtonByName(this, "auction_btn"); + mAuctionBtn = getChild<LLButton>( "auction_btn"); mAuctionBtn->setClickedCallback(onClickAuction); mAuctionBtn->setCallbackUserData(this); @@ -371,9 +371,9 @@ void LLPanelPlace::onClickTeleport(void* data) LLPanelPlace* self = (LLPanelPlace*)data; LLView* parent_viewp = self->getParent(); - if (parent_viewp->getWidgetType() == WIDGET_TYPE_FLOATER) + LLFloater* parent_floaterp = dynamic_cast<LLFloater*>(parent_viewp); + if (parent_floaterp) { - LLFloater* parent_floaterp = (LLFloater*)parent_viewp; parent_floaterp->close(); } // LLFloater* parent_floaterp = (LLFloater*)self->getParent(); diff --git a/indra/newview/llpanelvolume.cpp b/indra/newview/llpanelvolume.cpp index a9198cd6b4..c96f35d8dd 100644 --- a/indra/newview/llpanelvolume.cpp +++ b/indra/newview/llpanelvolume.cpp @@ -74,7 +74,7 @@ #include "pipeline.h" #include "lldrawpool.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" // "Features" Tab @@ -139,11 +139,11 @@ LLPanelVolume::~LLPanelVolume() void LLPanelVolume::getState( ) { - LLViewerObject* objectp = gSelectMgr->getSelection()->getFirstRootObject(); + LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject(); LLViewerObject* root_objectp = objectp; if(!objectp) { - objectp = gSelectMgr->getSelection()->getFirstObject(); + objectp = LLSelectMgr::getInstance()->getSelection()->getFirstObject(); // *FIX: shouldn't we just keep the child? if (objectp) { @@ -183,12 +183,12 @@ void LLPanelVolume::getState( ) BOOL owners_identical; LLUUID owner_id; LLString owner_name; - owners_identical = gSelectMgr->selectGetOwner(owner_id, owner_name); + owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name); // BUG? Check for all objects being editable? BOOL editable = root_objectp->permModify(); - BOOL single_volume = gSelectMgr->selectionAllPCode( LL_PCODE_VOLUME ) - && gSelectMgr->getSelection()->getObjectCount() == 1; + BOOL single_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ) + && LLSelectMgr::getInstance()->getSelection()->getObjectCount() == 1; // Select Single Message if (single_volume) @@ -232,9 +232,9 @@ void LLPanelVolume::getState( ) } else { - ((LLPanel *) getChildByName ("Light Intensity", true))->clear(); - ((LLPanel *) getChildByName ("Light Radius", true))->clear(); - ((LLPanel *) getChildByName ("Light Falloff", true))->clear(); + getChild<LLSpinCtrl>("Light Intensity", true)->clear(); + getChild<LLSpinCtrl>("Light Radius", true)->clear(); + getChild<LLSpinCtrl>("Light Falloff", true)->clear(); childSetEnabled("label color",false); LLColorSwatchCtrl* LightColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch"); @@ -292,14 +292,14 @@ void LLPanelVolume::getState( ) } else { - ((LLPanel *) getChildByName ("FlexNumSections", true))->clear(); - ((LLPanel *) getChildByName ("FlexGravity", true))->clear(); - ((LLPanel *) getChildByName ("FlexTension", true))->clear(); - ((LLPanel *) getChildByName ("FlexFriction", true))->clear(); - ((LLPanel *) getChildByName ("FlexWind", true))->clear(); - ((LLPanel *) getChildByName ("FlexForceX", true))->clear(); - ((LLPanel *) getChildByName ("FlexForceY", true))->clear(); - ((LLPanel *) getChildByName ("FlexForceZ", true))->clear(); + getChild<LLSpinCtrl>("FlexNumSections", true)->clear(); + getChild<LLSpinCtrl>("FlexGravity", true)->clear(); + getChild<LLSpinCtrl>("FlexTension", true)->clear(); + getChild<LLSpinCtrl>("FlexFriction", true)->clear(); + getChild<LLSpinCtrl>("FlexWind", true)->clear(); + getChild<LLSpinCtrl>("FlexForceX", true)->clear(); + getChild<LLSpinCtrl>("FlexForceY", true)->clear(); + getChild<LLSpinCtrl>("FlexForceZ", true)->clear(); childSetEnabled("FlexNumSections",false); childSetEnabled("FlexGravity",false); @@ -412,7 +412,7 @@ void LLPanelVolume::sendIsFlexible() if (objectp->getClickAction() == CLICK_ACTION_SIT) { - gSelectMgr->selectionSetClickAction(CLICK_ACTION_NONE); + LLSelectMgr::getInstance()->selectionSetClickAction(CLICK_ACTION_NONE); } } @@ -420,7 +420,7 @@ void LLPanelVolume::sendIsFlexible() if (volobjp->setIsFlexible(is_flexible)) { mObject->sendShapeUpdate(); - gSelectMgr->selectionUpdatePhantom(volobjp->flagPhantom()); + LLSelectMgr::getInstance()->selectionUpdatePhantom(volobjp->flagPhantom()); } llinfos << "update flexible sent" << llendl; diff --git a/indra/newview/llpreview.cpp b/indra/newview/llpreview.cpp index cad38e36ff..d5f91596e8 100644 --- a/indra/newview/llpreview.cpp +++ b/indra/newview/llpreview.cpp @@ -231,11 +231,11 @@ void LLPreview::onCommit() LLViewerObject* obj = avatar->getWornAttachment( item->getUUID() ); if( obj ) { - gSelectMgr->deselectAll(); - gSelectMgr->addAsIndividual( obj, SELECT_ALL_TES, FALSE ); - gSelectMgr->selectionSetObjectDescription( childGetText("desc") ); + LLSelectMgr::getInstance()->deselectAll(); + LLSelectMgr::getInstance()->addAsIndividual( obj, SELECT_ALL_TES, FALSE ); + LLSelectMgr::getInstance()->selectionSetObjectDescription( childGetText("desc") ); - gSelectMgr->deselectAll(); + LLSelectMgr::getInstance()->deselectAll(); } } } @@ -374,7 +374,7 @@ BOOL LLPreview::handleMouseDown(S32 x, S32 y, MASK mask) S32 screen_x; S32 screen_y; localPointToScreen(x, y, &screen_x, &screen_y ); - gToolDragAndDrop->setDragStart(screen_x, screen_y); + LLToolDragAndDrop::getInstance()->setDragStart(screen_x, screen_y); return TRUE; } return LLFloater::handleMouseDown(x, y, mask); @@ -402,7 +402,7 @@ BOOL LLPreview::handleHover(S32 x, S32 y, MASK mask) if(item && item->getPermissions().allowCopyBy(gAgent.getID(), gAgent.getGroupID()) - && gToolDragAndDrop->isOverThreshold(screen_x, screen_y)) + && LLToolDragAndDrop::getInstance()->isOverThreshold(screen_x, screen_y)) { EDragAndDropType type; type = LLAssetType::lookupDragAndDropType(item->getType()); @@ -415,11 +415,11 @@ BOOL LLPreview::handleHover(S32 x, S32 y, MASK mask) { src = LLToolDragAndDrop::SOURCE_AGENT; } - gToolDragAndDrop->beginDrag(type, + LLToolDragAndDrop::getInstance()->beginDrag(type, item->getUUID(), src, mObjectUUID); - return gToolDragAndDrop->handleHover(x, y, mask ); + return LLToolDragAndDrop::getInstance()->handleHover(x, y, mask ); } } return LLFloater::handleHover(x,y,mask); diff --git a/indra/newview/llpreviewanim.cpp b/indra/newview/llpreviewanim.cpp index 105103d10b..868278472f 100644 --- a/indra/newview/llpreviewanim.cpp +++ b/indra/newview/llpreviewanim.cpp @@ -42,14 +42,14 @@ #include "llfilepicker.h" #include "lllineeditor.h" #include "lluictrlfactory.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" extern LLAgent gAgent; LLPreviewAnim::LLPreviewAnim(const std::string& name, const LLRect& rect, const std::string& title, const LLUUID& item_uuid, const S32& activate, const LLUUID& object_uuid ) : LLPreview( name, rect, title, item_uuid, object_uuid) { - gUICtrlFactory->buildFloater(this,"floater_preview_animation.xml"); + LLUICtrlFactory::getInstance()->buildFloater(this,"floater_preview_animation.xml"); childSetAction("Anim play btn",playAnim,this); childSetAction("Anim audition btn",auditionAnim,this); @@ -116,7 +116,7 @@ void LLPreviewAnim::playAnim( void *userdata ) { LLUUID itemID=item->getAssetUUID(); - LLButton* btn = LLUICtrlFactory::getButtonByName(self, "Anim play btn"); + LLButton* btn = self->getChild<LLButton>("Anim play btn"); if (btn) { btn->toggleState(); @@ -153,7 +153,7 @@ void LLPreviewAnim::auditionAnim( void *userdata ) { LLUUID itemID=item->getAssetUUID(); - LLButton* btn = LLUICtrlFactory::getButtonByName(self, "Anim audition btn"); + LLButton* btn = self->getChild<LLButton>("Anim audition btn"); if (btn) { btn->toggleState(); diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp index 691a786245..07e65e3d54 100644 --- a/indra/newview/llpreviewgesture.cpp +++ b/indra/newview/llpreviewgesture.cpp @@ -59,7 +59,7 @@ #include "llradiogroup.h" #include "llscrolllistctrl.h" #include "lltextbox.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llviewerinventory.h" #include "llviewerobject.h" #include "llviewerobjectlist.h" @@ -134,7 +134,7 @@ LLPreviewGesture* LLPreviewGesture::show(const std::string& title, const LLUUID& self->init(item_id, object_id); // Builds and adds to gFloaterView - gUICtrlFactory->buildFloater(self, "floater_preview_gesture.xml"); + LLUICtrlFactory::getInstance()->buildFloater(self, "floater_preview_gesture.xml"); self->setTitle(title); // Move window to top-left of screen @@ -185,18 +185,15 @@ LLPreviewGesture* LLPreviewGesture::show(const std::string& title, const LLUUID& // virtual -BOOL LLPreviewGesture::handleKeyHere(KEY key, MASK mask, - BOOL called_from_parent) +BOOL LLPreviewGesture::handleKeyHere(KEY key, MASK mask) { - if(getVisible() && getEnabled()) + if(('S' == key) && (MASK_CONTROL == (mask & MASK_CONTROL))) { - if(('S' == key) && (MASK_CONTROL == (mask & MASK_CONTROL))) - { - saveIfNeeded(); - return TRUE; - } + saveIfNeeded(); + return TRUE; } - return LLPreview::handleKeyHere(key, mask, called_from_parent); + + return LLPreview::handleKeyHere(key, mask); } @@ -397,7 +394,7 @@ BOOL LLPreviewGesture::postBuild() LLTextBox* text; LLCheckBoxCtrl* check; - edit = LLViewerUICtrlFactory::getLineEditorByName(this, "trigger_editor"); + edit = getChild<LLLineEditor>("trigger_editor"); edit->setKeystrokeCallback(onKeystrokeCommit); edit->setCommitCallback(onCommitSetDirty); edit->setCommitOnFocusLost(TRUE); @@ -405,11 +402,11 @@ BOOL LLPreviewGesture::postBuild() edit->setIgnoreTab(TRUE); mTriggerEditor = edit; - text = LLViewerUICtrlFactory::getTextBoxByName(this, "replace_text"); + text = getChild<LLTextBox>("replace_text"); text->setEnabled(FALSE); mReplaceText = text; - edit = LLViewerUICtrlFactory::getLineEditorByName(this, "replace_editor"); + edit = getChild<LLLineEditor>("replace_editor"); edit->setEnabled(FALSE); edit->setKeystrokeCallback(onKeystrokeCommit); edit->setCommitCallback(onCommitSetDirty); @@ -418,76 +415,76 @@ BOOL LLPreviewGesture::postBuild() edit->setIgnoreTab(TRUE); mReplaceEditor = edit; - combo = LLViewerUICtrlFactory::getComboBoxByName(this, "modifier_combo"); + combo = getChild<LLComboBox>( "modifier_combo"); combo->setCommitCallback(onCommitSetDirty); combo->setCallbackUserData(this); mModifierCombo = combo; - combo = LLViewerUICtrlFactory::getComboBoxByName(this, "key_combo"); + combo = getChild<LLComboBox>( "key_combo"); combo->setCommitCallback(onCommitSetDirty); combo->setCallbackUserData(this); mKeyCombo = combo; - list = LLViewerUICtrlFactory::getScrollListByName(this, "library_list"); + list = getChild<LLScrollListCtrl>("library_list"); list->setCommitCallback(onCommitLibrary); list->setDoubleClickCallback(onClickAdd); list->setCallbackUserData(this); mLibraryList = list; - btn = LLViewerUICtrlFactory::getButtonByName(this, "add_btn"); + btn = getChild<LLButton>( "add_btn"); btn->setClickedCallback(onClickAdd); btn->setCallbackUserData(this); btn->setEnabled(FALSE); mAddBtn = btn; - btn = LLViewerUICtrlFactory::getButtonByName(this, "up_btn"); + btn = getChild<LLButton>( "up_btn"); btn->setClickedCallback(onClickUp); btn->setCallbackUserData(this); btn->setEnabled(FALSE); mUpBtn = btn; - btn = LLViewerUICtrlFactory::getButtonByName(this, "down_btn"); + btn = getChild<LLButton>( "down_btn"); btn->setClickedCallback(onClickDown); btn->setCallbackUserData(this); btn->setEnabled(FALSE); mDownBtn = btn; - btn = LLViewerUICtrlFactory::getButtonByName(this, "delete_btn"); + btn = getChild<LLButton>( "delete_btn"); btn->setClickedCallback(onClickDelete); btn->setCallbackUserData(this); btn->setEnabled(FALSE); mDeleteBtn = btn; - list = LLViewerUICtrlFactory::getScrollListByName(this, "step_list"); + list = getChild<LLScrollListCtrl>("step_list"); list->setCommitCallback(onCommitStep); list->setCallbackUserData(this); mStepList = list; // Options - text = LLViewerUICtrlFactory::getTextBoxByName(this, "options_text"); + text = getChild<LLTextBox>("options_text"); text->setBorderVisible(TRUE); mOptionsText = text; - combo = LLViewerUICtrlFactory::getComboBoxByName(this, "animation_list"); + combo = getChild<LLComboBox>( "animation_list"); combo->setVisible(FALSE); combo->setCommitCallback(onCommitAnimation); combo->setCallbackUserData(this); mAnimationCombo = combo; LLRadioGroup* group; - group = LLViewerUICtrlFactory::getRadioGroupByName(this, "animation_trigger_type"); + group = getChild<LLRadioGroup>("animation_trigger_type"); group->setVisible(FALSE); group->setCommitCallback(onCommitAnimationTrigger); group->setCallbackUserData(this); mAnimationRadio = group; - combo = LLViewerUICtrlFactory::getComboBoxByName(this, "sound_list"); + combo = getChild<LLComboBox>( "sound_list"); combo->setVisible(FALSE); combo->setCommitCallback(onCommitSound); combo->setCallbackUserData(this); mSoundCombo = combo; - edit = LLViewerUICtrlFactory::getLineEditorByName(this, "chat_editor"); + edit = getChild<LLLineEditor>("chat_editor"); edit->setVisible(FALSE); edit->setCommitCallback(onCommitChat); //edit->setKeystrokeCallback(onKeystrokeCommit); @@ -496,19 +493,19 @@ BOOL LLPreviewGesture::postBuild() edit->setIgnoreTab(TRUE); mChatEditor = edit; - check = LLViewerUICtrlFactory::getCheckBoxByName(this, "wait_anim_check"); + check = getChild<LLCheckBoxCtrl>( "wait_anim_check"); check->setVisible(FALSE); check->setCommitCallback(onCommitWait); check->setCallbackUserData(this); mWaitAnimCheck = check; - check = LLViewerUICtrlFactory::getCheckBoxByName(this, "wait_time_check"); + check = getChild<LLCheckBoxCtrl>( "wait_time_check"); check->setVisible(FALSE); check->setCommitCallback(onCommitWait); check->setCallbackUserData(this); mWaitTimeCheck = check; - edit = LLViewerUICtrlFactory::getLineEditorByName(this, "wait_time_editor"); + edit = getChild<LLLineEditor>("wait_time_editor"); edit->setEnabled(FALSE); edit->setVisible(FALSE); edit->setPrevalidate(LLLineEditor::prevalidateFloat); @@ -520,17 +517,17 @@ BOOL LLPreviewGesture::postBuild() mWaitTimeEditor = edit; // Buttons at the bottom - check = LLViewerUICtrlFactory::getCheckBoxByName(this, "active_check"); + check = getChild<LLCheckBoxCtrl>( "active_check"); check->setCommitCallback(onCommitActive); check->setCallbackUserData(this); mActiveCheck = check; - btn = LLViewerUICtrlFactory::getButtonByName(this, "save_btn"); + btn = getChild<LLButton>( "save_btn"); btn->setClickedCallback(onClickSave); btn->setCallbackUserData(this); mSaveBtn = btn; - btn = LLViewerUICtrlFactory::getButtonByName(this, "preview_btn"); + btn = getChild<LLButton>( "preview_btn"); btn->setClickedCallback(onClickPreview); btn->setCallbackUserData(this); mPreviewBtn = btn; @@ -956,10 +953,7 @@ void LLPreviewGesture::onLoadComplete(LLVFS *vfs, } else { - if( gViewerStats ) - { - gViewerStats->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); - } + LLViewerStats::getInstance()->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status || LL_ERR_FILE_EMPTY == status) @@ -988,7 +982,7 @@ void LLPreviewGesture::loadUIFromGesture(LLMultiGesture* gesture) if (item) { - LLLineEditor* descEditor = LLUICtrlFactory::getLineEditorByName(this, "desc"); + LLLineEditor* descEditor = getChild<LLLineEditor>("desc"); descEditor->setText(item->getDescription()); }*/ @@ -1179,7 +1173,7 @@ void LLPreviewGesture::saveIfNeeded() } else if (gAssetStorage) { - LLLineEditor* descEditor = LLUICtrlFactory::getLineEditorByName(this, "desc"); + LLLineEditor* descEditor = getChild<LLLineEditor>("desc"); LLSaveInfo* info = new LLSaveInfo(mItemUUID, mObjectUUID, descEditor->getText(), tid); gAssetStorage->storeAssetData(tid, LLAssetType::AT_GESTURE, onSaveComplete, info, FALSE); } diff --git a/indra/newview/llpreviewgesture.h b/indra/newview/llpreviewgesture.h index 4dea34ba1c..b4fa63b69b 100644 --- a/indra/newview/llpreviewgesture.h +++ b/indra/newview/llpreviewgesture.h @@ -53,7 +53,7 @@ public: static LLPreviewGesture* show(const std::string& title, const LLUUID& item_id, const LLUUID& object_id, BOOL take_focus = TRUE); // LLView - virtual BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent); + virtual BOOL handleKeyHere(KEY key, MASK mask); virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void* cargo_data, diff --git a/indra/newview/llpreviewnotecard.cpp b/indra/newview/llpreviewnotecard.cpp index 37d0ba8303..f9e1fc04dc 100644 --- a/indra/newview/llpreviewnotecard.cpp +++ b/indra/newview/llpreviewnotecard.cpp @@ -58,7 +58,7 @@ #include "llviewercontrol.h" // gSavedSettings #include "llappviewer.h" // app_abort_quit() #include "lllineeditor.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" ///---------------------------------------------------------------------------- /// Local function declarations, constants, enums, and typedefs @@ -99,13 +99,13 @@ LLPreviewNotecard::LLPreviewNotecard(const std::string& name, if (show_keep_discard) { - gUICtrlFactory->buildFloater(this,"floater_preview_notecard_keep_discard.xml"); + LLUICtrlFactory::getInstance()->buildFloater(this,"floater_preview_notecard_keep_discard.xml"); childSetAction("Keep",onKeepBtn,this); childSetAction("Discard",onDiscardBtn,this); } else { - gUICtrlFactory->buildFloater(this,"floater_preview_notecard.xml"); + LLUICtrlFactory::getInstance()->buildFloater(this,"floater_preview_notecard.xml"); childSetAction("Save",onClickSave,this); if( mAssetID.isNull() ) @@ -136,7 +136,7 @@ LLPreviewNotecard::LLPreviewNotecard(const std::string& name, setTitle(title); - LLViewerTextEditor* editor = LLViewerUICtrlFactory::getViewerTextEditorByName(this, "Notecard Editor"); + LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor"); if (editor) { @@ -154,7 +154,7 @@ LLPreviewNotecard::~LLPreviewNotecard() BOOL LLPreviewNotecard::postBuild() { - LLViewerTextEditor *ed = (LLViewerTextEditor *)gUICtrlFactory->getTextEditorByName(this, "Notecard Editor"); + LLViewerTextEditor *ed = getChild<LLViewerTextEditor>("Notecard Editor"); if (ed) { ed->setNotecardInfo(mNotecardItemID, mObjectID); @@ -181,7 +181,7 @@ bool LLPreviewNotecard::saveItem(LLPointer<LLInventoryItem>* itemptr) void LLPreviewNotecard::setEnabled( BOOL enabled ) { - LLViewerTextEditor* editor = LLViewerUICtrlFactory::getViewerTextEditorByName(this, "Notecard Editor"); + LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor"); childSetEnabled("Notecard Editor", enabled); childSetVisible("lock", !enabled); @@ -197,7 +197,7 @@ void LLPreviewNotecard::draw() //childSetFocus("Save", FALSE); - LLViewerTextEditor* editor = LLViewerUICtrlFactory::getViewerTextEditorByName(this, "Notecard Editor"); + LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor"); BOOL script_changed = !editor->isPristine(); childSetEnabled("Save", script_changed && getEnabled()); @@ -206,24 +206,21 @@ void LLPreviewNotecard::draw() } // virtual -BOOL LLPreviewNotecard::handleKeyHere(KEY key, MASK mask, - BOOL called_from_parent) +BOOL LLPreviewNotecard::handleKeyHere(KEY key, MASK mask) { - if(getVisible() && getEnabled()) + if(('S' == key) && (MASK_CONTROL == (mask & MASK_CONTROL))) { - if(('S' == key) && (MASK_CONTROL == (mask & MASK_CONTROL))) - { - saveIfNeeded(); - return TRUE; - } + saveIfNeeded(); + return TRUE; } - return LLPreview::handleKeyHere(key, mask, called_from_parent); + + return LLPreview::handleKeyHere(key, mask); } // virtual BOOL LLPreviewNotecard::canClose() { - LLViewerTextEditor* editor = LLViewerUICtrlFactory::getViewerTextEditorByName(this, "Notecard Editor"); + LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor"); if(mForceClose || editor->isPristine()) { @@ -242,7 +239,7 @@ BOOL LLPreviewNotecard::canClose() const LLInventoryItem* LLPreviewNotecard::getDragItem() { - LLViewerTextEditor* editor = LLViewerUICtrlFactory::getViewerTextEditorByName(this, "Notecard Editor"); + LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor"); if(editor) { @@ -254,9 +251,7 @@ const LLInventoryItem* LLPreviewNotecard::getDragItem() bool LLPreviewNotecard::hasEmbeddedInventory() { LLViewerTextEditor* editor = NULL; - editor = LLViewerUICtrlFactory::getViewerTextEditorByName( - this, - "Notecard Editor"); + editor = getChild<LLViewerTextEditor>("Notecard Editor"); if (!editor) return false; return editor->hasEmbeddedInventory(); } @@ -271,7 +266,7 @@ void LLPreviewNotecard::loadAsset() { // request the asset. const LLInventoryItem* item = getItem(); - LLViewerTextEditor* editor = LLViewerUICtrlFactory::getViewerTextEditorByName(this, "Notecard Editor"); + LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor"); if (!editor) return; @@ -377,7 +372,7 @@ void LLPreviewNotecard::onLoadComplete(LLVFS *vfs, buffer[file_length] = 0; - LLViewerTextEditor* previewEditor = LLViewerUICtrlFactory::getViewerTextEditorByName(preview, "Notecard Editor"); + LLViewerTextEditor* previewEditor = preview->getChild<LLViewerTextEditor>("Notecard Editor"); if( (file_length > 19) && !strncmp( buffer, "Linden text version", 19 ) ) { @@ -403,10 +398,7 @@ void LLPreviewNotecard::onLoadComplete(LLVFS *vfs, } else { - if( gViewerStats ) - { - gViewerStats->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); - } + LLViewerStats::getInstance()->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status || LL_ERR_FILE_EMPTY == status) @@ -475,7 +467,7 @@ bool LLPreviewNotecard::saveIfNeeded(LLInventoryItem* copyitem) } - LLViewerTextEditor* editor = LLViewerUICtrlFactory::getViewerTextEditorByName(this, "Notecard Editor"); + LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor"); if(!editor->isPristine()) { @@ -592,7 +584,7 @@ void LLPreviewNotecard::onSaveComplete(const LLUUID& asset_uuid, void* user_data // Perform item copy to inventory if (info->mCopyItem.notNull()) { - LLViewerTextEditor* editor = LLViewerUICtrlFactory::getViewerTextEditorByName(info->mSelf, "Notecard Editor"); + LLViewerTextEditor* editor = info->mSelf->getChild<LLViewerTextEditor>("Notecard Editor"); if (editor) { editor->copyInventory(info->mCopyItem); diff --git a/indra/newview/llpreviewnotecard.h b/indra/newview/llpreviewnotecard.h index 233246ceaa..1c801abf59 100644 --- a/indra/newview/llpreviewnotecard.h +++ b/indra/newview/llpreviewnotecard.h @@ -61,7 +61,7 @@ public: // llview virtual void draw(); - virtual BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent); + virtual BOOL handleKeyHere(KEY key, MASK mask); virtual void setEnabled( BOOL enabled ); virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index dd49262cb2..26052968fc 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -78,7 +78,7 @@ #include "llviewerstats.h" #include "llviewertexteditor.h" #include "llviewerwindow.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llwebbrowserctrl.h" #include "lluictrlfactory.h" @@ -176,7 +176,7 @@ LLFloaterScriptSearch::LLFloaterScriptSearch(std::string title, LLRect rect, LLS : LLFloater("script search",rect,title), mEditorCore(editor_core) { - gUICtrlFactory->buildFloater(this,"floater_script_search.xml"); + LLUICtrlFactory::getInstance()->buildFloater(this,"floater_script_search.xml"); childSetAction("search_btn", onBtnSearch,this); childSetAction("replace_btn", onBtnReplace,this); @@ -198,9 +198,10 @@ LLFloaterScriptSearch::LLFloaterScriptSearch(std::string title, LLRect rect, LLS LLView* viewp = (LLView*)editor_core; while(viewp) { - if (viewp->getWidgetType() == WIDGET_TYPE_FLOATER) + LLFloater* floaterp = dynamic_cast<LLFloater*>(viewp); + if (floaterp) { - ((LLFloater*)viewp)->addDependentFloater(this); + floaterp->addDependentFloater(this); break; } viewp = viewp->getParent(); @@ -243,7 +244,7 @@ void LLFloaterScriptSearch::onBtnSearch(void *userdata) void LLFloaterScriptSearch::handleBtnSearch() { - LLCheckBoxCtrl* caseChk = LLUICtrlFactory::getCheckBoxByName(this,"case_text"); + LLCheckBoxCtrl* caseChk = getChild<LLCheckBoxCtrl>("case_text"); mEditorCore->mEditor->selectNext(childGetText("search_text"), caseChk->get()); } @@ -256,7 +257,7 @@ void LLFloaterScriptSearch::onBtnReplace(void *userdata) void LLFloaterScriptSearch::handleBtnReplace() { - LLCheckBoxCtrl* caseChk = LLUICtrlFactory::getCheckBoxByName(this,"case_text"); + LLCheckBoxCtrl* caseChk = getChild<LLCheckBoxCtrl>("case_text"); mEditorCore->mEditor->replaceText(childGetText("search_text"), childGetText("replace_text"), caseChk->get()); } @@ -269,7 +270,7 @@ void LLFloaterScriptSearch::onBtnReplaceAll(void *userdata) void LLFloaterScriptSearch::handleBtnReplaceAll() { - LLCheckBoxCtrl* caseChk = LLUICtrlFactory::getCheckBoxByName(this,"case_text"); + LLCheckBoxCtrl* caseChk = getChild<LLCheckBoxCtrl>("case_text"); mEditorCore->mEditor->replaceTextAll(childGetText("search_text"), childGetText("replace_text"), caseChk->get()); } @@ -311,16 +312,15 @@ LLScriptEdCore::LLScriptEdCore( setBorderVisible(FALSE); - gUICtrlFactory->buildPanel(this, "floater_script_ed_panel.xml"); + LLUICtrlFactory::getInstance()->buildPanel(this, "floater_script_ed_panel.xml"); - mErrorList = LLUICtrlFactory::getScrollListByName(this, "lsl errors"); + mErrorList = getChild<LLScrollListCtrl>("lsl errors"); - mFunctions = LLUICtrlFactory::getComboBoxByName(this, "Insert..."); + mFunctions = getChild<LLComboBox>( "Insert..."); childSetCommitCallback("Insert...", &LLScriptEdCore::onBtnInsertFunction, this); - mEditor = LLViewerUICtrlFactory::getViewerTextEditorByName(this, "Script Editor"); - mEditor->setReadOnlyBgColor(gColors.getColor( "ScriptBgReadOnlyColor" ) ); + mEditor = getChild<LLViewerTextEditor>("Script Editor"); mEditor->setFollowsAll(); mEditor->setHandleEditKeysDirectly(TRUE); mEditor->setEnabled(TRUE); @@ -389,47 +389,47 @@ LLScriptEdCore::~LLScriptEdCore() void LLScriptEdCore::initMenu() { - LLMenuItemCallGL* menuItem = LLUICtrlFactory::getMenuItemCallByName(this, "Save"); + LLMenuItemCallGL* menuItem = getChild<LLMenuItemCallGL>("Save"); menuItem->setMenuCallback(onBtnSave, this); menuItem->setEnabledCallback(hasChanged); - menuItem = LLUICtrlFactory::getMenuItemCallByName(this, "Revert All Changes"); + menuItem = getChild<LLMenuItemCallGL>("Revert All Changes"); menuItem->setMenuCallback(onBtnUndoChanges, this); menuItem->setEnabledCallback(hasChanged); - menuItem = LLUICtrlFactory::getMenuItemCallByName(this, "Undo"); + menuItem = getChild<LLMenuItemCallGL>("Undo"); menuItem->setMenuCallback(onUndoMenu, this); menuItem->setEnabledCallback(enableUndoMenu); - menuItem = LLUICtrlFactory::getMenuItemCallByName(this, "Redo"); + menuItem = getChild<LLMenuItemCallGL>("Redo"); menuItem->setMenuCallback(onRedoMenu, this); menuItem->setEnabledCallback(enableRedoMenu); - menuItem = LLUICtrlFactory::getMenuItemCallByName(this, "Cut"); + menuItem = getChild<LLMenuItemCallGL>("Cut"); menuItem->setMenuCallback(onCutMenu, this); menuItem->setEnabledCallback(enableCutMenu); - menuItem = LLUICtrlFactory::getMenuItemCallByName(this, "Copy"); + menuItem = getChild<LLMenuItemCallGL>("Copy"); menuItem->setMenuCallback(onCopyMenu, this); menuItem->setEnabledCallback(enableCopyMenu); - menuItem = LLUICtrlFactory::getMenuItemCallByName(this, "Paste"); + menuItem = getChild<LLMenuItemCallGL>("Paste"); menuItem->setMenuCallback(onPasteMenu, this); menuItem->setEnabledCallback(enablePasteMenu); - menuItem = LLUICtrlFactory::getMenuItemCallByName(this, "Select All"); + menuItem = getChild<LLMenuItemCallGL>("Select All"); menuItem->setMenuCallback(onSelectAllMenu, this); menuItem->setEnabledCallback(enableSelectAllMenu); - menuItem = LLUICtrlFactory::getMenuItemCallByName(this, "Search / Replace..."); + menuItem = getChild<LLMenuItemCallGL>("Search / Replace..."); menuItem->setMenuCallback(onSearchMenu, this); menuItem->setEnabledCallback(NULL); - menuItem = LLUICtrlFactory::getMenuItemCallByName(this, "Help..."); + menuItem = getChild<LLMenuItemCallGL>("Help..."); menuItem->setMenuCallback(onBtnHelp, this); menuItem->setEnabledCallback(NULL); - menuItem = LLUICtrlFactory::getMenuItemCallByName(this, "LSL Wiki Help..."); + menuItem = getChild<LLMenuItemCallGL>("LSL Wiki Help..."); menuItem->setMenuCallback(onBtnDynamicHelp, this); menuItem->setEnabledCallback(NULL); } @@ -472,8 +472,8 @@ void LLScriptEdCore::updateDynamicHelp(BOOL immediate) if (!help_floater) return; // update back and forward buttons - LLButton* fwd_button = LLUICtrlFactory::getButtonByName(help_floater, "fwd_btn"); - LLButton* back_button = LLUICtrlFactory::getButtonByName(help_floater, "back_btn"); + LLButton* fwd_button = help_floater->getChild<LLButton>("fwd_btn"); + LLButton* back_button = help_floater->getChild<LLButton>("back_btn"); LLWebBrowserCtrl* browser = help_floater->getChild<LLWebBrowserCtrl>("lsl_guide_html"); back_button->setEnabled(browser->canNavigateBack()); fwd_button->setEnabled(browser->canNavigateForward()); @@ -536,7 +536,7 @@ void LLScriptEdCore::setHelpPage(const LLString& help_string) LLWebBrowserCtrl* web_browser = help_floater->getChild<LLWebBrowserCtrl>("lsl_guide_html"); if (!web_browser) return; - LLComboBox* history_combo = gUICtrlFactory->getComboBoxByName(help_floater, "history_combo"); + LLComboBox* history_combo = help_floater->getChild<LLComboBox>("history_combo"); if (!history_combo) return; LLUIString url_string = gSavedSettings.getString("LSLHelpURL"); @@ -556,7 +556,7 @@ void LLScriptEdCore::addHelpItemToHistory(const LLString& help_string) LLFloater* help_floater = mLiveHelpHandle.get(); if (!help_floater) return; - LLComboBox* history_combo = gUICtrlFactory->getComboBoxByName(help_floater, "history_combo"); + LLComboBox* history_combo = help_floater->getChild<LLComboBox>("history_combo"); if (!history_combo) return; // separate history items from full item list @@ -670,7 +670,7 @@ void LLScriptEdCore::onBtnDynamicHelp(void* userdata) } live_help_floater = new LLFloater("lsl_help"); - gUICtrlFactory->buildFloater(live_help_floater, "floater_lsl_guide.xml"); + LLUICtrlFactory::getInstance()->buildFloater(live_help_floater, "floater_lsl_guide.xml"); ((LLFloater*)corep->getParent())->addDependentFloater(live_help_floater, TRUE); live_help_floater->childSetCommitCallback("lock_check", onCheckLock, userdata); live_help_floater->childSetValue("lock_check", gSavedSettings.getBOOL("ScriptHelpFollowsCursor")); @@ -681,7 +681,7 @@ void LLScriptEdCore::onBtnDynamicHelp(void* userdata) LLWebBrowserCtrl* browser = live_help_floater->getChild<LLWebBrowserCtrl>("lsl_guide_html"); browser->setAlwaysRefresh(TRUE); - LLComboBox* help_combo = LLUICtrlFactory::getComboBoxByName(live_help_floater, "history_combo"); + LLComboBox* help_combo = live_help_floater->getChild<LLComboBox>("history_combo"); LLKeywordToken *token; LLKeywords::keyword_iterator_t token_it; for (token_it = corep->mEditor->keywordsBegin(); @@ -789,10 +789,7 @@ void LLScriptEdCore::onBtnInsertFunction(LLUICtrl *ui, void* userdata) // static void LLScriptEdCore::doSave( void* userdata, BOOL close_after_save ) { - if( gViewerStats ) - { - gViewerStats->incStat( LLViewerStats::ST_LSL_SAVE_COUNT ); - } + LLViewerStats::getInstance()->incStat( LLViewerStats::ST_LSL_SAVE_COUNT ); LLScriptEdCore* self = (LLScriptEdCore*) userdata; @@ -1015,33 +1012,31 @@ void LLScriptEdCore::deleteBridges() } // virtual -BOOL LLScriptEdCore::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent) +BOOL LLScriptEdCore::handleKeyHere(KEY key, MASK mask) { - if(getVisible() && getEnabled()) - { - bool just_control = MASK_CONTROL == (mask & MASK_MODIFIERS); + bool just_control = MASK_CONTROL == (mask & MASK_MODIFIERS); - if(('S' == key) && just_control) + if(('S' == key) && just_control) + { + if(mSaveCallback) { - if(mSaveCallback) - { - // don't close after saving - mSaveCallback(mUserdata, FALSE); - } - - return TRUE; + // don't close after saving + mSaveCallback(mUserdata, FALSE); } - if(('F' == key) && just_control) + return TRUE; + } + + if(('F' == key) && just_control) + { + if(mSearchReplaceCallback) { - if(mSearchReplaceCallback) - { - mSearchReplaceCallback(mUserdata); - } - - return TRUE; + mSearchReplaceCallback(mUserdata); } + + return TRUE; } + return FALSE; } @@ -1096,7 +1091,7 @@ LLPreviewLSL::LLPreviewLSL(const std::string& name, const LLRect& rect, factory_map["script panel"] = LLCallbackMap(LLPreviewLSL::createScriptEdPanel, this); - gUICtrlFactory->buildFloater(this,"floater_script_preview.xml", &factory_map); + LLUICtrlFactory::getInstance()->buildFloater(this,"floater_script_preview.xml", &factory_map); const LLInventoryItem* item = getItem(); @@ -1316,7 +1311,7 @@ void LLPreviewLSL::uploadAssetLegacy(const std::string& filename, const LLUUID& item_id, const LLTransactionID& tid) { - LLLineEditor* descEditor = LLUICtrlFactory::getLineEditorByName(this, "desc"); + LLLineEditor* descEditor = getChild<LLLineEditor>("desc"); LLScriptSaveInfo* info = new LLScriptSaveInfo(item_id, descEditor->getText(), tid); @@ -1517,10 +1512,7 @@ void LLPreviewLSL::onLoadComplete( LLVFS *vfs, const LLUUID& asset_uuid, LLAsset } else { - if( gViewerStats ) - { - gViewerStats->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); - } + LLViewerStats::getInstance()->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status || LL_ERR_FILE_EMPTY == status) @@ -1627,7 +1619,7 @@ LLLiveLSLEditor::LLLiveLSLEditor(const std::string& name, LLCallbackMap::map_t factory_map; factory_map["script ed panel"] = LLCallbackMap(LLLiveLSLEditor::createScriptEdPanel, this); - gUICtrlFactory->buildFloater(this,"floater_live_lsleditor.xml", &factory_map); + LLUICtrlFactory::getInstance()->buildFloater(this,"floater_live_lsleditor.xml", &factory_map); childSetCommitCallback("running", LLLiveLSLEditor::onRunningCheckboxClicked, this); @@ -1830,10 +1822,7 @@ void LLLiveLSLEditor::onLoadComplete(LLVFS *vfs, const LLUUID& asset_id, } else { - if( gViewerStats ) - { - gViewerStats->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); - } + LLViewerStats::getInstance()->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status || LL_ERR_FILE_EMPTY == status) @@ -1913,7 +1902,7 @@ void LLLiveLSLEditor::onRunningCheckboxClicked( LLUICtrl*, void* userdata ) { LLLiveLSLEditor* self = (LLLiveLSLEditor*) userdata; LLViewerObject* object = gObjectList.findObject( self->mObjectID ); - LLCheckBoxCtrl* runningCheckbox = LLUICtrlFactory::getCheckBoxByName(self, "running"); + LLCheckBoxCtrl* runningCheckbox = self->getChild<LLCheckBoxCtrl>("running"); BOOL running = runningCheckbox->get(); //self->mRunningCheckbox->get(); if( object ) @@ -1961,39 +1950,37 @@ void LLLiveLSLEditor::onReset(void *userdata) void LLLiveLSLEditor::draw() { - if(getVisible()) + LLViewerObject* object = gObjectList.findObject(mObjectID); + LLCheckBoxCtrl* runningCheckbox = getChild<LLCheckBoxCtrl>( "running"); + if(object && mAskedForRunningInfo && mHaveRunningInfo) { - LLViewerObject* object = gObjectList.findObject(mObjectID); - LLCheckBoxCtrl* runningCheckbox = LLUICtrlFactory::getCheckBoxByName(this, "running"); - if(object && mAskedForRunningInfo && mHaveRunningInfo) + if(object->permAnyOwner()) { - if(object->permAnyOwner()) - { - runningCheckbox->setLabel(getString("script_running")); - runningCheckbox->setEnabled(TRUE); - } - else - { - runningCheckbox->setLabel(getString("public_objects_can_not_run")); - runningCheckbox->setEnabled(FALSE); - // *FIX: Set it to false so that the ui is correct for - // a box that is released to public. It could be - // incorrect after a release/claim cycle, but will be - // correct after clicking on it. - runningCheckbox->set(FALSE); - } + runningCheckbox->setLabel(getString("script_running")); + runningCheckbox->setEnabled(TRUE); } - else if(!object) + else { - // HACK: Display this information in the title bar. - // Really ought to put in main window. - setTitle("Script (object out of range)"); + runningCheckbox->setLabel(getString("public_objects_can_not_run")); runningCheckbox->setEnabled(FALSE); - // object may have fallen out of range. - mHaveRunningInfo = FALSE; + // *FIX: Set it to false so that the ui is correct for + // a box that is released to public. It could be + // incorrect after a release/claim cycle, but will be + // correct after clicking on it. + runningCheckbox->set(FALSE); } - LLFloater::draw(); } + else if(!object) + { + // HACK: Display this information in the title bar. + // Really ought to put in main window. + setTitle("Script (object out of range)"); + runningCheckbox->setEnabled(FALSE); + // object may have fallen out of range. + mHaveRunningInfo = FALSE; + } + + LLFloater::draw(); } @@ -2103,7 +2090,7 @@ void LLLiveLSLEditor::saveIfNeeded() std::string url = gAgent.getRegion()->getCapability("UpdateScriptTaskInventory"); getWindow()->incBusyCount(); mPendingUploads++; - BOOL is_running = LLUICtrlFactory::getCheckBoxByName(this, "running")->get(); + BOOL is_running = getChild<LLCheckBoxCtrl>( "running")->get(); if (!url.empty()) { uploadAssetViaCaps(url, filename, mObjectID, @@ -2221,7 +2208,7 @@ void LLLiveLSLEditor::uploadAssetLegacy(const std::string& filename, LLFile::remove(dst_filename.c_str()); // If we successfully saved it, then we should be able to check/uncheck the running box! - LLCheckBoxCtrl* runningCheckbox = LLUICtrlFactory::getCheckBoxByName(this, "running"); + LLCheckBoxCtrl* runningCheckbox = getChild<LLCheckBoxCtrl>( "running"); runningCheckbox->setLabel(getString("script_running")); runningCheckbox->setEnabled(TRUE); } @@ -2389,7 +2376,7 @@ void LLLiveLSLEditor::processScriptRunningReply(LLMessageSystem* msg, void**) instance->mHaveRunningInfo = TRUE; BOOL running; msg->getBOOLFast(_PREHASH_Script, _PREHASH_Running, running); - LLCheckBoxCtrl* runningCheckbox = LLUICtrlFactory::getCheckBoxByName(instance, "running"); + LLCheckBoxCtrl* runningCheckbox = instance->getChild<LLCheckBoxCtrl>("running"); runningCheckbox->set(running); } } diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h index 55b006908f..d7d96e2037 100644 --- a/indra/newview/llpreviewscript.h +++ b/indra/newview/llpreviewscript.h @@ -52,12 +52,11 @@ class LLMenuBarGL; class LLFloaterScriptSearch; class LLKeywordToken; -// Inner, implementation class. LLPreviewScript and LLLiveScriptEditor each own one of these. +// Inner, implementation class. LLPreviewScript and LLLiveLSLEditor each own one of these. class LLScriptEdCore : public LLPanel { friend class LLPreviewScript; friend class LLPreviewLSL; - friend class LLLiveScriptEditor; friend class LLLiveLSLEditor; friend class LLFloaterScriptSearch; @@ -118,7 +117,7 @@ public: void selectFirstError(); - virtual BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent); + virtual BOOL handleKeyHere(KEY key, MASK mask); protected: void deleteBridges(); diff --git a/indra/newview/llpreviewsound.cpp b/indra/newview/llpreviewsound.cpp index b92a6d58c8..3c23bf15ae 100644 --- a/indra/newview/llpreviewsound.cpp +++ b/indra/newview/llpreviewsound.cpp @@ -41,7 +41,7 @@ #include "llresmgr.h" #include "llviewercontrol.h" #include "llviewermessage.h" // send_guid_sound_trigger -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" extern LLAudioEngine* gAudiop; extern LLAgent gAgent; @@ -52,15 +52,15 @@ LLPreviewSound::LLPreviewSound(const std::string& name, const LLRect& rect, cons LLPreview( name, rect, title, item_uuid, object_uuid) { - gUICtrlFactory->buildFloater(this,"floater_preview_sound.xml"); + LLUICtrlFactory::getInstance()->buildFloater(this,"floater_preview_sound.xml"); childSetAction("Sound play btn",&LLPreviewSound::playSound,this); childSetAction("Sound audition btn",&LLPreviewSound::auditionSound,this); - LLButton* button = LLUICtrlFactory::getButtonByName(this, "Sound play btn"); + LLButton* button = getChild<LLButton>("Sound play btn"); button->setSoundFlags(LLView::SILENT); - button = LLUICtrlFactory::getButtonByName(this, "Sound audition btn"); + button = getChild<LLButton>("Sound audition btn"); button->setSoundFlags(LLView::SILENT); const LLInventoryItem* item = getItem(); diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp index e1a9636fd0..392c9724a0 100644 --- a/indra/newview/llpreviewtexture.cpp +++ b/indra/newview/llpreviewtexture.cpp @@ -45,7 +45,7 @@ #include "llui.h" #include "llviewerimage.h" #include "llviewerimagelist.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llviewerwindow.h" #include "lllineeditor.h" @@ -159,14 +159,14 @@ void LLPreviewTexture::init() if (mCopyToInv) { - gUICtrlFactory->buildFloater(this,"floater_preview_embedded_texture.xml"); + LLUICtrlFactory::getInstance()->buildFloater(this,"floater_preview_embedded_texture.xml"); childSetAction("Copy To Inventory",LLPreview::onBtnCopyToInv,this); } else if (mShowKeepDiscard) { - gUICtrlFactory->buildFloater(this,"floater_preview_texture_keep_discard.xml"); + LLUICtrlFactory::getInstance()->buildFloater(this,"floater_preview_texture_keep_discard.xml"); childSetAction("Keep",onKeepBtn,this); childSetAction("Discard",onDiscardBtn,this); @@ -174,7 +174,7 @@ void LLPreviewTexture::init() else { - gUICtrlFactory->buildFloater(this,"floater_preview_texture.xml"); + LLUICtrlFactory::getInstance()->buildFloater(this,"floater_preview_texture.xml"); } @@ -193,100 +193,97 @@ void LLPreviewTexture::init() void LLPreviewTexture::draw() { - if( getVisible() ) + updateAspectRatio(); + + LLPreview::draw(); + + if (!isMinimized()) { - updateAspectRatio(); + LLGLSUIDefault gls_ui; + LLGLSNoTexture gls_notex; + + const LLRect& border = mClientRect; + LLRect interior = mClientRect; + interior.stretch( -PREVIEW_BORDER_WIDTH ); - LLPreview::draw(); + // ...border + gl_rect_2d( border, LLColor4(0.f, 0.f, 0.f, 1.f)); + gl_rect_2d_checkerboard( interior ); - if (!isMinimized()) + if ( mImage.notNull() ) { - LLGLSUIDefault gls_ui; - LLGLSNoTexture gls_notex; - - const LLRect& border = mClientRect; - LLRect interior = mClientRect; - interior.stretch( -PREVIEW_BORDER_WIDTH ); - - // ...border - gl_rect_2d( border, LLColor4(0.f, 0.f, 0.f, 1.f)); - gl_rect_2d_checkerboard( interior ); - - if ( mImage.notNull() ) + // Draw the texture + glColor3f( 1.f, 1.f, 1.f ); + gl_draw_scaled_image(interior.mLeft, + interior.mBottom, + interior.getWidth(), + interior.getHeight(), + mImage); + + // Pump the texture priority + F32 pixel_area = mLoadingFullImage ? (F32)MAX_IMAGE_AREA : (F32)(interior.getWidth() * interior.getHeight() ); + mImage->addTextureStats( pixel_area ); + + // Don't bother decoding more than we can display, unless + // we're loading the full image. + if (!mLoadingFullImage) { - // Draw the texture - glColor3f( 1.f, 1.f, 1.f ); - gl_draw_scaled_image(interior.mLeft, - interior.mBottom, - interior.getWidth(), - interior.getHeight(), - mImage); - - // Pump the texture priority - F32 pixel_area = mLoadingFullImage ? (F32)MAX_IMAGE_AREA : (F32)(interior.getWidth() * interior.getHeight() ); - mImage->addTextureStats( pixel_area ); - - // Don't bother decoding more than we can display, unless - // we're loading the full image. - if (!mLoadingFullImage) - { - S32 int_width = interior.getWidth(); - S32 int_height = interior.getHeight(); - mImage->setKnownDrawSize(int_width, int_height); - } - else - { - // Don't use this feature - mImage->setKnownDrawSize(0, 0); - } + S32 int_width = interior.getWidth(); + S32 int_height = interior.getHeight(); + mImage->setKnownDrawSize(int_width, int_height); + } + else + { + // Don't use this feature + mImage->setKnownDrawSize(0, 0); + } - if( mLoadingFullImage ) + if( mLoadingFullImage ) + { + LLFontGL::sSansSerif->renderUTF8("Receiving:", 0, + interior.mLeft + 4, + interior.mBottom + 4, + LLColor4::white, LLFontGL::LEFT, LLFontGL::BOTTOM, + LLFontGL::DROP_SHADOW); + + F32 data_progress = mImage->mDownloadProgress; + + // Draw the progress bar. + const S32 BAR_HEIGHT = 12; + const S32 BAR_LEFT_PAD = 80; + S32 left = interior.mLeft + 4 + BAR_LEFT_PAD; + S32 bar_width = getRect().getWidth() - left - RESIZE_HANDLE_WIDTH - 2; + S32 top = interior.mBottom + 4 + BAR_HEIGHT; + S32 right = left + bar_width; + S32 bottom = top - BAR_HEIGHT; + + LLColor4 background_color(0.f, 0.f, 0.f, 0.75f); + LLColor4 decoded_color(0.f, 1.f, 0.f, 1.0f); + LLColor4 downloaded_color(0.f, 0.5f, 0.f, 1.0f); + + gl_rect_2d(left, top, right, bottom, background_color); + + if (data_progress > 0.0f) { - LLFontGL::sSansSerif->renderUTF8("Receiving:", 0, - interior.mLeft + 4, - interior.mBottom + 4, - LLColor4::white, LLFontGL::LEFT, LLFontGL::BOTTOM, - LLFontGL::DROP_SHADOW); - - F32 data_progress = mImage->mDownloadProgress; - - // Draw the progress bar. - const S32 BAR_HEIGHT = 12; - const S32 BAR_LEFT_PAD = 80; - S32 left = interior.mLeft + 4 + BAR_LEFT_PAD; - S32 bar_width = getRect().getWidth() - left - RESIZE_HANDLE_WIDTH - 2; - S32 top = interior.mBottom + 4 + BAR_HEIGHT; - S32 right = left + bar_width; - S32 bottom = top - BAR_HEIGHT; - - LLColor4 background_color(0.f, 0.f, 0.f, 0.75f); - LLColor4 decoded_color(0.f, 1.f, 0.f, 1.0f); - LLColor4 downloaded_color(0.f, 0.5f, 0.f, 1.0f); - - gl_rect_2d(left, top, right, bottom, background_color); - - if (data_progress > 0.0f) + // Downloaded bytes + right = left + llfloor(data_progress * (F32)bar_width); + if (right > left) { - // Downloaded bytes - right = left + llfloor(data_progress * (F32)bar_width); - if (right > left) - { - gl_rect_2d(left, top, right, bottom, downloaded_color); - } + gl_rect_2d(left, top, right, bottom, downloaded_color); } } - else - if( !mSavedFileTimer.hasExpired() ) - { - LLFontGL::sSansSerif->renderUTF8("File Saved", 0, - interior.mLeft + 4, - interior.mBottom + 4, - LLColor4::white, LLFontGL::LEFT, LLFontGL::BOTTOM, - LLFontGL::DROP_SHADOW); - } } - } - } + else + if( !mSavedFileTimer.hasExpired() ) + { + LLFontGL::sSansSerif->renderUTF8("File Saved", 0, + interior.mLeft + 4, + interior.mBottom + 4, + LLColor4::white, LLFontGL::LEFT, LLFontGL::BOTTOM, + LLFontGL::DROP_SHADOW); + } + } + } } diff --git a/indra/newview/llprogressview.cpp b/indra/newview/llprogressview.cpp index 2d67e432c3..76da53ea7b 100644 --- a/indra/newview/llprogressview.cpp +++ b/indra/newview/llprogressview.cpp @@ -102,16 +102,6 @@ LLProgressView::~LLProgressView() sInstance = NULL; } -EWidgetType LLProgressView::getWidgetType() const -{ - return WIDGET_TYPE_PROGRESS_VIEW; -} - -LLString LLProgressView::getWidgetTag() const -{ - return LL_PROGRESS_VIEW_TAG; -} - BOOL LLProgressView::handleMouseDown(S32 x, S32 y, MASK mask) { if ( mOutlineRect.pointInRect( x, y ) ) @@ -168,18 +158,14 @@ BOOL LLProgressView::handleHover(S32 x, S32 y, MASK mask) } -BOOL LLProgressView::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent) +BOOL LLProgressView::handleKeyHere(KEY key, MASK mask) { - if( getVisible() ) + // Suck up all keystokes except CTRL-Q. + if( ('Q' == key) && (MASK_CONTROL == mask) ) { - // Suck up all keystokes except CTRL-Q. - if( ('Q' == key) && (MASK_CONTROL == mask) ) - { - LLAppViewer::instance()->userQuit(); - } - return TRUE; + LLAppViewer::instance()->userQuit(); } - return FALSE; + return TRUE; } void LLProgressView::setVisible(BOOL visible) @@ -191,6 +177,7 @@ void LLProgressView::setVisible(BOOL visible) else if (!getVisible() && visible) { gFocusMgr.setTopCtrl(this); + setFocus(TRUE); mFadeTimer.stop(); mProgressTimer.start(); LLView::setVisible(visible); @@ -265,8 +252,8 @@ void LLProgressView::draw() S32 line_two_y = line_one_y - LINE_SPACING; const LLFontGL* font = LLFontGL::sSansSerif; - LLViewerImage* shadow_imagep = gImageList.getImage(LLUUID(gViewerArt.getString("rounded_square_soft.tga")), MIPMAP_FALSE, TRUE); - LLViewerImage* bar_imagep = gImageList.getImage(LLUUID(gViewerArt.getString("rounded_square.tga")), MIPMAP_FALSE, TRUE); + LLUIImagePtr shadow_imagep = LLUI::getUIImage("rounded_square_soft.tga"); + LLUIImagePtr bar_imagep = LLUI::getUIImage("rounded_square.tga"); //LLColor4 background_color = gColors.getColor("DefaultShadowLight"); LLColor4 background_color = LLColor4(0.3254f, 0.4f, 0.5058f, 1.0f); @@ -289,31 +276,21 @@ void LLProgressView::draw() S32 background_box_width = background_box_right - background_box_left + 1; S32 background_box_height = background_box_top - background_box_bottom + 1; - gl_draw_scaled_image_with_border( background_box_left + 2, + shadow_imagep->draw( background_box_left + 2, background_box_bottom - 2, - 16, - 16, background_box_width, background_box_height, - shadow_imagep, gColors.getColor( "ColorDropShadow" ) ); - - gl_draw_scaled_image_with_border( background_box_left, + bar_imagep->draw( background_box_left, background_box_bottom, - 16, - 16, background_box_width, background_box_height, - bar_imagep, LLColor4( 0.0f, 0.0f, 0.0f, 0.4f ) ); - gl_draw_scaled_image_with_border( background_box_left + 1, + bar_imagep->draw( background_box_left + 1, background_box_bottom + 1, - 16, - 16, background_box_width - 2, background_box_height - 2, - bar_imagep, LLColor4( 0.4f, 0.4f, 0.4f, 0.3f ) ); // we'll need this later for catching a click if it looks like it contains a link @@ -334,36 +311,34 @@ void LLProgressView::draw() LLFontGL::HCENTER, LLFontGL::BASELINE, LLFontGL::DROP_SHADOW); - gl_draw_scaled_image_with_border( + shadow_imagep->draw( bar_left + 2, bar_bottom - 2, - 16, - 16, bar_width, bar_height, - shadow_imagep, gColors.getColor("ColorDropShadow")); - gl_draw_scaled_image_with_border( + bar_imagep->draw( bar_left, bar_bottom, - 16, - 16, bar_width, bar_height, - bar_imagep, LLColor4(0.7f, 0.7f, 0.8f, 1.0f)); - gl_draw_scaled_image_with_border(bar_left + 2, bar_bottom + 2, 16, 16, - bar_width - 4, bar_height - 4, - bar_imagep, + bar_imagep->draw( + bar_left + 2, + bar_bottom + 2, + bar_width - 4, + bar_height - 4, background_color); LLColor4 bar_color = LLColor4(0.5764f, 0.6627f, 0.8352f, 1.0f); bar_color.mV[3] = alpha; - gl_draw_scaled_image_with_border(bar_left + 2, bar_bottom + 2, 16, 16, - llround((bar_width - 4) * (mPercentDone / 100.f)), bar_height - 4, - bar_imagep, + bar_imagep->draw( + bar_left + 2, + bar_bottom + 2, + llround((bar_width - 4) * (mPercentDone / 100.f)), + bar_height - 4, bar_color); S32 line_three_y = line_two_y - LINE_SPACING * 3; diff --git a/indra/newview/llprogressview.h b/indra/newview/llprogressview.h index e9fe7e817e..63d19c27dc 100644 --- a/indra/newview/llprogressview.h +++ b/indra/newview/llprogressview.h @@ -44,15 +44,12 @@ public: LLProgressView(const std::string& name, const LLRect& rect); virtual ~LLProgressView(); - virtual EWidgetType getWidgetType() const; - virtual LLString getWidgetTag() const; - /*virtual*/ void draw(); /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent); + /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); /*virtual*/ void setVisible(BOOL visible); void setText(const LLString& text); diff --git a/indra/newview/llregionposition.cpp b/indra/newview/llregionposition.cpp index e900bd076f..c9e1304a64 100644 --- a/indra/newview/llregionposition.cpp +++ b/indra/newview/llregionposition.cpp @@ -85,7 +85,7 @@ LLVector3d LLRegionPosition::getPositionGlobal() const void LLRegionPosition::setPositionGlobal(const LLVector3d& position_global ) { - mRegionp = gWorldPointer->getRegionFromPosGlobal(position_global); + mRegionp = LLWorld::getInstance()->getRegionFromPosGlobal(position_global); if (mRegionp) { mPositionRegion = mRegionp->getPosRegionFromGlobal(position_global); diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index f468ce97ac..ba2434d7b0 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -100,7 +100,6 @@ extern LLVector3d gLastHitObjectOffset; // // Globals // -LLSelectMgr* gSelectMgr = NULL; BOOL gDebugSelectMgr = FALSE; @@ -156,8 +155,6 @@ static LLPointer<LLObjectSelection> sNullSelection; void LLSelectMgr::cleanupGlobals() { - delete gSelectMgr; - gSelectMgr = NULL; sNullSelection = NULL; } @@ -506,7 +503,7 @@ BOOL LLSelectMgr::removeObjectFromSelections(const LLUUID &id) LLTool *tool = NULL; if (!gNoRender) { - tool = gToolMgr->getCurrentTool(); + tool = LLToolMgr::getInstance()->getCurrentTool(); // It's possible that the tool is editing an object that is not selected LLViewerObject* tool_editing_object = tool->getEditingObject(); @@ -1420,7 +1417,7 @@ void LLSelectMgr::selectionSetImage(const LLUUID& imageid) { object->sendTEUpdate(); // 1 particle effect per object - LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)gHUDManager->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE); + LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE); effectp->setSourceObject(gAgent.getAvatarObject()); effectp->setTargetObject(object); effectp->setDuration(LL_HUD_DUR_SHORT); @@ -2770,28 +2767,28 @@ void LLSelectMgr::confirmDelete(S32 option, void* data) LLUUID trash_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_TRASH); // attempt to derez into the trash. LLDeRezInfo* info = new LLDeRezInfo(DRD_TRASH, trash_id); - gSelectMgr->sendListToRegions("DeRezObject", + LLSelectMgr::getInstance()->sendListToRegions("DeRezObject", packDeRezHeader, packObjectLocalID, (void*)info, SEND_ONLY_ROOTS); // VEFFECT: Delete Object - one effect for all deletes - if (gSelectMgr->mSelectedObjects->mSelectType != SELECT_TYPE_HUD) + if (LLSelectMgr::getInstance()->mSelectedObjects->mSelectType != SELECT_TYPE_HUD) { - LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)gHUDManager->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE); - effectp->setPositionGlobal( gSelectMgr->getSelectionCenterGlobal() ); + LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE); + effectp->setPositionGlobal( LLSelectMgr::getInstance()->getSelectionCenterGlobal() ); effectp->setColor(LLColor4U(gAgent.getEffectColor())); F32 duration = 0.5f; - duration += gSelectMgr->mSelectedObjects->getObjectCount() / 64.f; + duration += LLSelectMgr::getInstance()->mSelectedObjects->getObjectCount() / 64.f; effectp->setDuration(duration); } gAgent.setLookAt(LOOKAT_TARGET_CLEAR); // Keep track of how many objects have been deleted. - F64 obj_delete_count = gViewerStats->getStat(LLViewerStats::ST_OBJECT_DELETE_COUNT); - obj_delete_count += gSelectMgr->mSelectedObjects->getObjectCount(); - gViewerStats->setStat(LLViewerStats::ST_OBJECT_DELETE_COUNT, obj_delete_count ); + F64 obj_delete_count = LLViewerStats::getInstance()->getStat(LLViewerStats::ST_OBJECT_DELETE_COUNT); + obj_delete_count += LLSelectMgr::getInstance()->mSelectedObjects->getObjectCount(); + LLViewerStats::getInstance()->setStat(LLViewerStats::ST_OBJECT_DELETE_COUNT, obj_delete_count ); } break; case 1: @@ -3509,7 +3506,7 @@ void LLSelectMgr::sendAttach(U8 attachment_point) return; } - BOOL build_mode = gToolMgr->inEdit(); + BOOL build_mode = LLToolMgr::getInstance()->inEdit(); // Special case: Attach to default location for this object. if (0 == attachment_point || get_if_there(gAgent.getAvatarObject()->mAttachmentPoints, (S32)attachment_point, (LLViewerJointAttachment*)NULL)) @@ -4298,7 +4295,7 @@ void LLSelectMgr::processObjectProperties(LLMessageSystem* msg, void** user_data return (node->getObject()->mID == mID); } } func(id); - LLSelectNode* node = gSelectMgr->getSelection()->getFirstNode(&func); + LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstNode(&func); if (node) { @@ -4441,7 +4438,7 @@ void LLSelectMgr::processObjectPropertiesFamily(LLMessageSystem* msg, void** use return (node->getObject()->mID == mID); } } func(id); - LLSelectNode* node = gSelectMgr->getHoverObjects()->getFirstNode(&func); + LLSelectNode* node = LLSelectMgr::getInstance()->getHoverObjects()->getFirstNode(&func); if (node) { @@ -4467,7 +4464,7 @@ void LLSelectMgr::processForceObjectSelect(LLMessageSystem* msg, void**) if (reset_list) { - gSelectMgr->deselectAll(); + LLSelectMgr::getInstance()->deselectAll(); } LLUUID full_id; @@ -4493,7 +4490,7 @@ void LLSelectMgr::processForceObjectSelect(LLMessageSystem* msg, void**) } // Don't select, just highlight - gSelectMgr->highlightObjectAndFamily(objects); + LLSelectMgr::getInstance()->highlightObjectAndFamily(objects); } @@ -4508,9 +4505,7 @@ void LLSelectMgr::updateSilhouettes() if (!mSilhouetteImagep) { - LLUUID id; - id.set( gViewerArt.getString("silhouette.tga") ); - mSilhouetteImagep = gImageList.getImage(id, TRUE, TRUE); + mSilhouetteImagep = gImageList.getImageFromFile("silhouette.j2c", TRUE, TRUE); } mHighlightedObjects->cleanupNodes(); @@ -4561,7 +4556,7 @@ void LLSelectMgr::updateSilhouettes() { if (num_sils_genned++ < MAX_SILS_PER_FRAME)// && objectp->mDrawable->isVisible()) { - generateSilhouette(node, gCamera->getOrigin()); + generateSilhouette(node, LLViewerCamera::getInstance()->getOrigin()); changed_objects.push_back(objectp); } else if (objectp->isAttachment()) @@ -4722,7 +4717,7 @@ void LLSelectMgr::updateSilhouettes() { if (num_sils_genned++ < MAX_SILS_PER_FRAME) { - generateSilhouette(node, gCamera->getOrigin()); + generateSilhouette(node, LLViewerCamera::getInstance()->getOrigin()); changed_objects.push_back(objectp); } else if (objectp->isAttachment() && objectp->getRootEdit()->mDrawable.notNull()) @@ -4792,7 +4787,7 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud) glPushMatrix(); glLoadIdentity(); F32 depth = llmax(1.f, hud_bbox.getExtentLocal().mV[VX] * 1.1f); - glOrtho(-0.5f * gCamera->getAspect(), 0.5f * gCamera->getAspect(), -0.5f, 0.5f, 0.f, depth); + glOrtho(-0.5f * LLViewerCamera::getInstance()->getAspect(), 0.5f * LLViewerCamera::getInstance()->getAspect(), -0.5f, 0.5f, 0.f, depth); glMatrixMode(GL_MODELVIEW); glPushMatrix(); @@ -5231,8 +5226,8 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color) } else { - LLVector3 view_vector = gCamera->getOrigin() - objectp->getRenderPosition(); - silhouette_thickness = view_vector.magVec() * LLSelectMgr::sHighlightThickness * (gCamera->getView() / gCamera->getDefaultFOV()); + LLVector3 view_vector = LLViewerCamera::getInstance()->getOrigin() - objectp->getRenderPosition(); + silhouette_thickness = view_vector.magVec() * LLSelectMgr::sHighlightThickness * (LLViewerCamera::getInstance()->getView() / LLViewerCamera::getInstance()->getDefaultFOV()); } F32 animationTime = (F32)LLFrameTimer::getElapsedSeconds(); @@ -5246,10 +5241,10 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color) gGL.blendFunc(GL_SRC_COLOR, GL_ONE); LLGLEnable fog(GL_FOG); glFogi(GL_FOG_MODE, GL_LINEAR); - float d = (gCamera->getPointOfInterest()-gCamera->getOrigin()).magVec(); - LLColor4 fogCol = color * (F32)llclamp((gSelectMgr->getSelectionCenterGlobal()-gAgent.getCameraPositionGlobal()).magVec()/(gSelectMgr->getBBoxOfSelection().getExtentLocal().magVec()*4), 0.0, 1.0); + float d = (LLViewerCamera::getInstance()->getPointOfInterest()-LLViewerCamera::getInstance()->getOrigin()).magVec(); + LLColor4 fogCol = color * (F32)llclamp((LLSelectMgr::getInstance()->getSelectionCenterGlobal()-gAgent.getCameraPositionGlobal()).magVec()/(LLSelectMgr::getInstance()->getBBoxOfSelection().getExtentLocal().magVec()*4), 0.0, 1.0); glFogf(GL_FOG_START, d); - glFogf(GL_FOG_END, d*(1 + (gCamera->getView() / gCamera->getDefaultFOV()))); + glFogf(GL_FOG_END, d*(1 + (LLViewerCamera::getInstance()->getView() / LLViewerCamera::getInstance()->getDefaultFOV()))); glFogfv(GL_FOG_COLOR, fogCol.mV); LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE, GL_GEQUAL); @@ -5377,7 +5372,7 @@ S32 get_family_count(LLViewerObject *parent) } else { - if (gSelectMgr->canSelectObject(child)) + if (LLSelectMgr::getInstance()->canSelectObject(child)) { count += get_family_count( child ); } @@ -5467,9 +5462,9 @@ void LLSelectMgr::updateSelectionCenter() } - if ( !(gAgentID == LLUUID::null) && gToolMgr) + if ( !(gAgentID == LLUUID::null)) { - LLTool *tool = gToolMgr->getCurrentTool(); + LLTool *tool = LLToolMgr::getInstance()->getCurrentTool(); if (mShowSelection) { LLVector3d select_center_global; @@ -5658,9 +5653,9 @@ void LLSelectMgr::validateSelection() { virtual bool apply(LLViewerObject* object) { - if (!gSelectMgr->canSelectObject(object)) + if (!LLSelectMgr::getInstance()->canSelectObject(object)) { - gSelectMgr->deselectObjectOnly(object); + LLSelectMgr::getInstance()->deselectObjectOnly(object); } return true; } diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h index 570bcef79a..598a962b3c 100644 --- a/indra/newview/llselectmgr.h +++ b/indra/newview/llselectmgr.h @@ -333,7 +333,7 @@ private: typedef LLSafeHandle<LLObjectSelection> LLObjectSelectionHandle; -class LLSelectMgr : public LLEditMenuHandler +class LLSelectMgr : public LLEditMenuHandler, public LLSingleton<LLSelectMgr> { public: static BOOL sRectSelectInclusive; // do we need to surround an object to pick it? @@ -708,8 +708,6 @@ private: LLAnimPauseRequest mPauseRequest; }; -extern LLSelectMgr* gSelectMgr; - // Utilities void dialog_refresh_all(); // Update subscribers to the selection list diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 84e14ef341..d610cd3fdf 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -1800,7 +1800,7 @@ S32 LLSpatialPartition::cull(LLCamera &camera, std::vector<LLDrawable *>* result BOOL earlyFail(LLCamera* camera, LLSpatialGroup* group) { - const F32 vel = (gCamera->getVelocityStat()->getCurrent()+0.2f); + const F32 vel = (LLViewerCamera::getInstance()->getVelocityStat()->getCurrent()+0.2f); LLVector3 c = group->mBounds[0]; LLVector3 r = group->mBounds[1]*SG_OCCLUSION_FUDGE + LLVector3(vel,vel,vel); @@ -2491,7 +2491,7 @@ void LLSpatialPartition::renderDebug() if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_PRIORITY)) { //sLastMaxTexPriority = lerp(sLastMaxTexPriority, sCurMaxTexPriority, gFrameIntervalSeconds); - sLastMaxTexPriority = (F32) gCamera->getScreenPixelArea(); + sLastMaxTexPriority = (F32) LLViewerCamera::getInstance()->getScreenPixelArea(); sCurMaxTexPriority = 0.f; } @@ -2504,7 +2504,7 @@ void LLSpatialPartition::renderDebug() gPipeline.disableLights(); LLSpatialBridge* bridge = asBridge(); - LLCamera* camera = gCamera; + LLCamera* camera = LLViewerCamera::getInstance(); if (bridge) { @@ -2521,7 +2521,7 @@ void LLSpatialPartition::renderDebug() BOOL LLSpatialPartition::isVisible(const LLVector3& v) { - if (!gCamera->sphereInFrustum(v, 4.0f)) + if (!LLViewerCamera::getInstance()->sphereInFrustum(v, 4.0f)) { return FALSE; } diff --git a/indra/newview/llsprite.cpp b/indra/newview/llsprite.cpp index 92fcbb6e6c..f74173425c 100644 --- a/indra/newview/llsprite.cpp +++ b/indra/newview/llsprite.cpp @@ -92,7 +92,7 @@ LLSprite::~LLSprite() void LLSprite::updateFace(LLFace &face) { - LLViewerCamera &camera = *gCamera; + LLViewerCamera &camera = *LLViewerCamera::getInstance(); // First, figure out how many vertices/indices we need. U32 num_vertices, num_indices; diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index f7de5a8c35..daaa117a9c 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -51,7 +51,6 @@ #include "llcameraview.h" #include "llviewercontrol.h" #include "lldir.h" -#include "lleconomy.h" #include "llerrorcontrol.h" #include "llfiltersd2xmlrpc.h" #include "llfocusmgr.h" @@ -324,8 +323,6 @@ BOOL idle_startup() static LLString password; static std::vector<const char*> requested_options; - static U32 region_size = 256; - static F32 region_scale = 1.f; static U64 first_sim_handle = 0; static LLHost first_sim; static std::string first_sim_seed_cap; @@ -376,11 +373,11 @@ BOOL idle_startup() // Initialize stuff that doesn't need data from simulators // - if (gFeatureManagerp->isSafe()) + if (LLFeatureManager::getInstance()->isSafe()) { gViewerWindow->alertXml("DisplaySetToSafe"); } - else if ((gSavedSettings.getS32("LastFeatureVersion") < gFeatureManagerp->getVersion()) && + else if ((gSavedSettings.getS32("LastFeatureVersion") < LLFeatureManager::getInstance()->getVersion()) && (gSavedSettings.getS32("LastFeatureVersion") != 0)) { gViewerWindow->alertXml("DisplaySetToRecommended"); @@ -390,7 +387,7 @@ BOOL idle_startup() gViewerWindow->alertXml(gViewerWindow->getInitAlert()); } - gSavedSettings.setS32("LastFeatureVersion", gFeatureManagerp->getVersion()); + gSavedSettings.setS32("LastFeatureVersion", LLFeatureManager::getInstance()->getVersion()); LLString xml_file = LLUI::locateSkin("xui_version.xml"); LLXMLNodePtr root; @@ -536,11 +533,6 @@ BOOL idle_startup() } } - // initialize the economy - gGlobalEconomy = new LLGlobalEconomy(); - - - //------------------------------------------------- // Init audio, which may be needed for prefs dialog // or audio cues in connection UI. @@ -701,24 +693,19 @@ BOOL idle_startup() // skip directly to message template verification LLStartUp::setStartupState( STATE_LOGIN_CLEANUP ); } - - // Create selection manager - // Must be done before menus created, because many enabled callbacks - // require its existance. - gSelectMgr = new LLSelectMgr(); - gParcelMgr = new LLViewerParcelMgr(); - gHUDManager = new LLHUDManager(); - gMuteListp = new LLMuteList(); + + // *NOTE: This is where LLViewerParcelMgr::getInstance() used to get allocated before becoming LLViewerParcelMgr::getInstance(). + + // *NOTE: This is where gHUDManager used to bet allocated before becoming LLHUDManager::getInstance(). + + // *NOTE: This is where gMuteList used to get allocated before becoming LLMuteList::getInstance(). // Initialize UI if (!gNoRender) { // Initialize all our tools. Must be done after saved settings loaded. - if ( gToolMgr == NULL ) - { - gToolMgr = new LLToolMgr(); - gToolMgr->initTools(); - } + // NOTE: This also is where gToolMgr used to be instantiated before being turned into a singleton. + LLToolMgr::getInstance()->initTools(); // Quickly get something onscreen to look at. gViewerWindow->initWorldUI(); @@ -920,11 +907,8 @@ BOOL idle_startup() //#define LL_MINIMIAL_REQUESTED_OPTIONS gDebugInfo["GridName"] = gGridInfo[gGridChoice].mLabel; - lldebugs << "STATE_LOGIN_AUTH_INIT" << llendl; - if (!gUserAuthp) - { - gUserAuthp = new LLUserAuth(); - } + // *Note: this is where gUserAuth used to be created. + requested_options.clear(); requested_options.push_back("inventory-root"); requested_options.push_back("inventory-skeleton"); @@ -1009,7 +993,7 @@ BOOL idle_startup() hashed_mac.hex_digest(hashed_mac_string); // TODO if statement here to use web_login_key - gUserAuthp->authenticate( + LLUserAuth::getInstance()->authenticate( sAuthUris[sAuthUriNum].c_str(), auth_method.c_str(), firstname.c_str(), @@ -1039,17 +1023,13 @@ BOOL idle_startup() // in curl, so take "may appear frozen" out of progress bar. JC auth_desc = "Logging in..."; set_startup_status(progress, auth_desc.c_str(), auth_message.c_str()); - if (!gUserAuthp) - { - llerrs << "No userauth in STATE_LOGIN_NO_DATA_YET!" << llendl; - } // Process messages to keep from dropping circuit. LLMessageSystem* msg = gMessageSystem; while (msg->checkAllMessages(gFrameCount, gServicePump)) { } msg->processAcks(); - LLUserAuth::UserAuthcode error = gUserAuthp->authResponse(); + LLUserAuth::UserAuthcode error = LLUserAuth::getInstance()->authResponse(); if(LLUserAuth::E_NO_RESPONSE_YET == error) { //llinfos << "waiting..." << llendl; @@ -1064,17 +1044,13 @@ BOOL idle_startup() if(STATE_LOGIN_DOWNLOADING == LLStartUp::getStartupState()) { lldebugs << "STATE_LOGIN_DOWNLOADING" << llendl; - if (!gUserAuthp) - { - llerrs << "No userauth in STATE_LOGIN_DOWNLOADING!" << llendl; - } // Process messages to keep from dropping circuit. LLMessageSystem* msg = gMessageSystem; while (msg->checkAllMessages(gFrameCount, gServicePump)) { } msg->processAcks(); - LLUserAuth::UserAuthcode error = gUserAuthp->authResponse(); + LLUserAuth::UserAuthcode error = LLUserAuth::getInstance()->authResponse(); if(LLUserAuth::E_DOWNLOADING == error) { //llinfos << "downloading..." << llendl; @@ -1095,14 +1071,14 @@ BOOL idle_startup() const char* reason_response = NULL; const char* message_response = NULL; BOOL successful_login = FALSE; - LLUserAuth::UserAuthcode error = gUserAuthp->authResponse(); + LLUserAuth::UserAuthcode error = LLUserAuth::getInstance()->authResponse(); // reset globals gAcceptTOS = FALSE; gAcceptCriticalMessage = FALSE; switch(error) { case LLUserAuth::E_OK: - login_response = gUserAuthp->getResponse("login"); + login_response = LLUserAuth::getInstance()->getResponse("login"); if(login_response && (0 == strcmp(login_response, "true"))) { // Yay, login! @@ -1111,10 +1087,10 @@ BOOL idle_startup() else if(login_response && (0 == strcmp(login_response, "indeterminate"))) { llinfos << "Indeterminate login..." << llendl; - sAuthUris = LLSRV::rewriteURI(gUserAuthp->getResponse("next_url")); + sAuthUris = LLSRV::rewriteURI(LLUserAuth::getInstance()->getResponse("next_url")); sAuthUriNum = 0; - auth_method = gUserAuthp->getResponse("next_method"); - auth_message = gUserAuthp->getResponse("message"); + auth_method = LLUserAuth::getInstance()->getResponse("next_method"); + auth_message = LLUserAuth::getInstance()->getResponse("message"); if(auth_method.substr(0, 5) == "login") { auth_desc.assign("Authenticating..."); @@ -1131,8 +1107,8 @@ BOOL idle_startup() else { emsg << "Login failed.\n"; - reason_response = gUserAuthp->getResponse("reason"); - message_response = gUserAuthp->getResponse("message"); + reason_response = LLUserAuth::getInstance()->getResponse("reason"); + message_response = LLUserAuth::getInstance()->getResponse("message"); if (gHideLinks && reason_response && (0 == strcmp(reason_response, "disabled"))) { @@ -1195,7 +1171,7 @@ BOOL idle_startup() } if(reason_response && (0 == strcmp(reason_response, "update"))) { - auth_message = gUserAuthp->getResponse("message"); + auth_message = LLUserAuth::getInstance()->getResponse("message"); if (show_connect_box) { update_app(TRUE, auth_message); @@ -1210,7 +1186,7 @@ BOOL idle_startup() if(reason_response && (0 == strcmp(reason_response, "optional"))) { llinfos << "Login got optional update" << llendl; - auth_message = gUserAuthp->getResponse("message"); + auth_message = LLUserAuth::getInstance()->getResponse("message"); if (show_connect_box) { update_app(FALSE, auth_message); @@ -1230,7 +1206,7 @@ BOOL idle_startup() if (sAuthUriNum >= (int) sAuthUris.size() - 1) { emsg << "Unable to connect to " << LLAppViewer::instance()->getSecondLifeTitle() << ".\n"; - emsg << gUserAuthp->errorMessage(); + emsg << LLUserAuth::getInstance()->errorMessage(); } else { sAuthUriNum++; std::ostringstream s; @@ -1246,33 +1222,27 @@ BOOL idle_startup() // Version update and we're not showing the dialog if(quit) { - delete gUserAuthp; - gUserAuthp = NULL; + LLUserAuth::getInstance()->reset(); LLAppViewer::instance()->forceQuit(); return FALSE; } if(successful_login) { - if (!gUserAuthp) - { - llerrs << "No userauth on successful login!" << llendl; - } - // unpack login data needed by the application const char* text; - text = gUserAuthp->getResponse("agent_id"); + text = LLUserAuth::getInstance()->getResponse("agent_id"); if(text) gAgentID.set(text); gDebugInfo["AgentID"] = text; - text = gUserAuthp->getResponse("session_id"); + text = LLUserAuth::getInstance()->getResponse("session_id"); if(text) gAgentSessionID.set(text); gDebugInfo["SessionID"] = text; - text = gUserAuthp->getResponse("secure_session_id"); + text = LLUserAuth::getInstance()->getResponse("secure_session_id"); if(text) gAgent.mSecureSessionID.set(text); - text = gUserAuthp->getResponse("first_name"); + text = LLUserAuth::getInstance()->getResponse("first_name"); if(text) { // Remove quotes from string. Login.cgi sends these to force @@ -1281,7 +1251,7 @@ BOOL idle_startup() LLString::replaceChar(firstname, '"', ' '); LLString::trim(firstname); } - text = gUserAuthp->getResponse("last_name"); + text = LLUserAuth::getInstance()->getResponse("last_name"); if(text) lastname.assign(text); gSavedSettings.setString("FirstName", firstname); gSavedSettings.setString("LastName", lastname); @@ -1297,7 +1267,7 @@ BOOL idle_startup() gSavedSettings.setBOOL("RememberPassword", remember_password); gSavedSettings.setBOOL("LoginLastLocation", gSavedSettings.getBOOL("LoginLastLocation")); - text = gUserAuthp->getResponse("agent_access"); + text = LLUserAuth::getInstance()->getResponse("agent_access"); if(text && (text[0] == 'M')) { gAgent.setTeen(false); @@ -1307,15 +1277,15 @@ BOOL idle_startup() gAgent.setTeen(true); } - text = gUserAuthp->getResponse("start_location"); + text = LLUserAuth::getInstance()->getResponse("start_location"); if(text) agent_start_location.assign(text); - text = gUserAuthp->getResponse("circuit_code"); + text = LLUserAuth::getInstance()->getResponse("circuit_code"); if(text) { gMessageSystem->mOurCircuitCode = strtoul(text, NULL, 10); } - const char* sim_ip_str = gUserAuthp->getResponse("sim_ip"); - const char* sim_port_str = gUserAuthp->getResponse("sim_port"); + const char* sim_ip_str = LLUserAuth::getInstance()->getResponse("sim_ip"); + const char* sim_port_str = LLUserAuth::getInstance()->getResponse("sim_port"); if(sim_ip_str && sim_port_str) { U32 sim_port = strtoul(sim_port_str, NULL, 10); @@ -1325,8 +1295,8 @@ BOOL idle_startup() gMessageSystem->enableCircuit(first_sim, TRUE); } } - const char* region_x_str = gUserAuthp->getResponse("region_x"); - const char* region_y_str = gUserAuthp->getResponse("region_y"); + const char* region_x_str = LLUserAuth::getInstance()->getResponse("region_x"); + const char* region_y_str = LLUserAuth::getInstance()->getResponse("region_y"); if(region_x_str && region_y_str) { U32 region_x = strtoul(region_x_str, NULL, 10); @@ -1334,7 +1304,7 @@ BOOL idle_startup() first_sim_handle = to_region_handle(region_x, region_y); } - const char* look_at_str = gUserAuthp->getResponse("look_at"); + const char* look_at_str = LLUserAuth::getInstance()->getResponse("look_at"); if (look_at_str) { #if !LL_WINDOWS && !LL_DARWIN @@ -1347,10 +1317,10 @@ BOOL idle_startup() agent_start_look_at = ll_vector3_from_sd(sd); } - text = gUserAuthp->getResponse("seed_capability"); + text = LLUserAuth::getInstance()->getResponse("seed_capability"); if (text) first_sim_seed_cap = text; - text = gUserAuthp->getResponse("seconds_since_epoch"); + text = LLUserAuth::getInstance()->getResponse("seconds_since_epoch"); if(text) { U32 server_utc_time = strtoul(text, NULL, 10); @@ -1361,7 +1331,7 @@ BOOL idle_startup() } } - const char* home_location = gUserAuthp->getResponse("home"); + const char* home_location = LLUserAuth::getInstance()->getResponse("home"); if(home_location) { #if !LL_WINDOWS && !LL_DARWIN @@ -1378,9 +1348,9 @@ BOOL idle_startup() gAgent.setHomePosRegion(region_handle, position); } - gAgent.mMOTD.assign(gUserAuthp->getResponse("message")); + gAgent.mMOTD.assign(LLUserAuth::getInstance()->getResponse("message")); LLUserAuth::options_t options; - if(gUserAuthp->getOptions("inventory-root", options)) + if(LLUserAuth::getInstance()->getOptions("inventory-root", options)) { LLUserAuth::response_t::iterator it; it = options[0].find("folder_id"); @@ -1392,7 +1362,7 @@ BOOL idle_startup() } options.clear(); - if(gUserAuthp->getOptions("login-flags", options)) + if(LLUserAuth::getInstance()->getOptions("login-flags", options)) { LLUserAuth::response_t::iterator it; LLUserAuth::response_t::iterator no_flag = options[0].end(); @@ -1420,7 +1390,7 @@ BOOL idle_startup() } } options.clear(); - if (gUserAuthp->getOptions("initial-outfit", options) + if (LLUserAuth::getInstance()->getOptions("initial-outfit", options) && !options.empty()) { LLUserAuth::response_t::iterator it; @@ -1438,7 +1408,7 @@ BOOL idle_startup() } options.clear(); - if(gUserAuthp->getOptions("global-textures", options)) + if(LLUserAuth::getInstance()->getOptions("global-textures", options)) { // Extract sun and moon texture IDs. These are used // in the LLVOSky constructor, but I can't figure out @@ -1553,11 +1523,11 @@ BOOL idle_startup() display_startup(); + // This is where we used to initialize gWorldp. Original comment said: // World initialization must be done after above window init - gWorldp = new LLWorld(region_size, region_scale); // User might have overridden far clip - gWorldp->setLandFarClip( gAgent.mDrawDistance ); + LLWorld::getInstance()->setLandFarClip( gAgent.mDrawDistance ); // Before we create the first region, we need to set the agent's mOriginGlobal // This is necessary because creating objects before this is set will result in a @@ -1565,9 +1535,9 @@ BOOL idle_startup() gAgent.initOriginGlobal(from_region_handle(first_sim_handle)); - gWorldp->addRegion(first_sim_handle, first_sim); + LLWorld::getInstance()->addRegion(first_sim_handle, first_sim); - LLViewerRegion *regionp = gWorldp->getRegionFromHandle(first_sim_handle); + LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(first_sim_handle); llinfos << "Adding initial simulator " << regionp->getOriginGlobal() << llendl; LLStartUp::setStartupState( STATE_SEED_GRANTED_WAIT ); @@ -1603,7 +1573,7 @@ BOOL idle_startup() { update_texture_fetch(); - if ( gViewerWindow != NULL && gToolMgr != NULL ) + if ( gViewerWindow != NULL) { // This isn't the first logon attempt, so show the UI gViewerWindow->setNormalControlsVisible( TRUE ); } @@ -1659,18 +1629,14 @@ BOOL idle_startup() LLAppViewer::instance()->loadNameCache(); } - // Data storage for map of world. - if ( gWorldMap == NULL ) - { - gWorldMap = new LLWorldMap(); - } + // *Note: this is where gWorldMap used to be initialized. // register null callbacks for audio until the audio system is initialized gMessageSystem->setHandlerFuncFast(_PREHASH_SoundTrigger, null_message_callback, NULL); gMessageSystem->setHandlerFuncFast(_PREHASH_AttachedSound, null_message_callback, NULL); //reset statistics - gViewerStats->resetStats(); + LLViewerStats::getInstance()->resetStats(); if (!gNoRender) { @@ -1700,14 +1666,14 @@ BOOL idle_startup() } // Make sure agent knows correct aspect ratio - gCamera->setViewHeightInPixels(gViewerWindow->getWindowDisplayHeight()); + LLViewerCamera::getInstance()->setViewHeightInPixels(gViewerWindow->getWindowDisplayHeight()); if (gViewerWindow->mWindow->getFullscreen()) { - gCamera->setAspect(gViewerWindow->getDisplayAspectRatio()); + LLViewerCamera::getInstance()->setAspect(gViewerWindow->getDisplayAspectRatio()); } else { - gCamera->setAspect( (F32) gViewerWindow->getWindowWidth() / (F32) gViewerWindow->getWindowHeight()); + LLViewerCamera::getInstance()->setAspect( (F32) gViewerWindow->getWindowWidth() / (F32) gViewerWindow->getWindowHeight()); } // Move agent to starting location. The position handed to us by @@ -1820,10 +1786,10 @@ BOOL idle_startup() // But not on first login, because you can't see your avatar then if (!gAgent.isFirstLogin()) { - LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)gHUDManager->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE); + LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE); effectp->setPositionGlobal(gAgent.getPositionGlobal()); effectp->setColor(LLColor4U(gAgent.getEffectColor())); - gHUDManager->sendEffects(); + LLHUDManager::getInstance()->sendEffects(); } LLStartUp::setStartupState( STATE_AGENT_WAIT ); // Go to STATE_AGENT_WAIT @@ -1869,17 +1835,12 @@ BOOL idle_startup() //--------------------------------------------------------------------- if (STATE_INVENTORY_SEND == LLStartUp::getStartupState()) { - if (!gUserAuthp) - { - llerrs << "No userauth in STATE_INVENTORY_SEND!" << llendl; - } - // unpack thin inventory LLUserAuth::options_t options; options.clear(); //bool dump_buffer = false; - if(gUserAuthp->getOptions("inventory-lib-root", options) + if(LLUserAuth::getInstance()->getOptions("inventory-lib-root", options) && !options.empty()) { // should only be one @@ -1891,7 +1852,7 @@ BOOL idle_startup() } } options.clear(); - if(gUserAuthp->getOptions("inventory-lib-owner", options) + if(LLUserAuth::getInstance()->getOptions("inventory-lib-owner", options) && !options.empty()) { // should only be one @@ -1903,7 +1864,7 @@ BOOL idle_startup() } } options.clear(); - if(gUserAuthp->getOptions("inventory-skel-lib", options) + if(LLUserAuth::getInstance()->getOptions("inventory-skel-lib", options) && gInventoryLibraryOwner.notNull()) { if(!gInventory.loadSkeleton(options, gInventoryLibraryOwner)) @@ -1912,7 +1873,7 @@ BOOL idle_startup() } } options.clear(); - if(gUserAuthp->getOptions("inventory-skeleton", options)) + if(LLUserAuth::getInstance()->getOptions("inventory-skeleton", options)) { if(!gInventory.loadSkeleton(options, gAgent.getID())) { @@ -1922,7 +1883,7 @@ BOOL idle_startup() } options.clear(); - if(gUserAuthp->getOptions("buddy-list", options)) + if(LLUserAuth::getInstance()->getOptions("buddy-list", options)) { LLUserAuth::options_t::iterator it = options.begin(); LLUserAuth::options_t::iterator end = options.end(); @@ -1953,7 +1914,7 @@ BOOL idle_startup() } options.clear(); - if(gUserAuthp->getOptions("ui-config", options)) + if(LLUserAuth::getInstance()->getOptions("ui-config", options)) { LLUserAuth::options_t::iterator it = options.begin(); LLUserAuth::options_t::iterator end = options.end(); @@ -1971,7 +1932,7 @@ BOOL idle_startup() } } options.clear(); - if(gUserAuthp->getOptions("tutorial_setting", options)) + if(LLUserAuth::getInstance()->getOptions("tutorial_setting", options)) { LLUserAuth::options_t::iterator it = options.begin(); LLUserAuth::options_t::iterator end = options.end(); @@ -1995,16 +1956,16 @@ BOOL idle_startup() } options.clear(); - if(gUserAuthp->getOptions("event_categories", options)) + if(LLUserAuth::getInstance()->getOptions("event_categories", options)) { LLEventInfo::loadCategories(options); } - if(gUserAuthp->getOptions("event_notifications", options)) + if(LLUserAuth::getInstance()->getOptions("event_notifications", options)) { gEventNotifier.load(options); } options.clear(); - if(gUserAuthp->getOptions("classified_categories", options)) + if(LLUserAuth::getInstance()->getOptions("classified_categories", options)) { LLClassifiedInfo::loadCategories(options); } @@ -2019,7 +1980,7 @@ BOOL idle_startup() LLLandmark::registerCallbacks(msg); // request mute list - gMuteListp->requestFromServer(gAgent.getID()); + LLMuteList::getInstance()->requestFromServer(gAgent.getID()); // Get L$ and ownership credit information msg->newMessageFast(_PREHASH_MoneyBalanceRequest); @@ -2057,13 +2018,12 @@ BOOL idle_startup() // We have a region, and just did a big inventory download. // We can estimate the user's connection speed, and set their // max bandwidth accordingly. JC - if (gSavedSettings.getBOOL("FirstLoginThisInstall") - && gUserAuthp) + if (gSavedSettings.getBOOL("FirstLoginThisInstall")) { // This is actually a pessimistic computation, because TCP may not have enough // time to ramp up on the (small) default inventory file to truly measure max // bandwidth. JC - F64 rate_bps = gUserAuthp->getLastTransferRateBPS(); + F64 rate_bps = LLUserAuth::getInstance()->getLastTransferRateBPS(); const F32 FAST_RATE_BPS = 600.f * 1024.f; const F32 FASTER_RATE_BPS = 750.f * 1024.f; F32 max_bandwidth = gViewerThrottle.getMaxBandwidth(); @@ -2110,7 +2070,7 @@ BOOL idle_startup() // many gesture downloads, if this is the user's first // time on this machine or -purge has been run. LLUserAuth::options_t gesture_options; - if (gUserAuthp->getOptions("gestures", gesture_options)) + if (LLUserAuth::getInstance()->getOptions("gestures", gesture_options)) { llinfos << "Gesture Manager loading " << gesture_options.size() << llendl; @@ -2274,7 +2234,7 @@ BOOL idle_startup() else if (wearables_time > MAX_WEARABLES_TIME) { gViewerWindow->alertXml("ClothingLoading"); - gViewerStats->incStat(LLViewerStats::ST_WEARABLES_TOO_LONG); + LLViewerStats::getInstance()->incStat(LLViewerStats::ST_WEARABLES_TOO_LONG); LLStartUp::setStartupState( STATE_CLEANUP ); } else @@ -2334,13 +2294,9 @@ BOOL idle_startup() // If we've got a startup URL, dispatch it LLStartUp::dispatchURL(); - + // Clean up the userauth stuff. - if (gUserAuthp) - { - delete gUserAuthp; - gUserAuthp = NULL; - } + LLUserAuth::getInstance()->reset(); LLStartUp::setStartupState( STATE_STARTED ); @@ -3073,7 +3029,7 @@ void init_stat_view() stat_viewp = new LLStatView("basic stat view", "Basic", "OpenDebugStatBasic", rect); gDebugView->mFloaterStatsp->addStatView(stat_viewp); - stat_barp = stat_viewp->addStat("FPS", &(gViewerStats->mFPSStat)); + stat_barp = stat_viewp->addStat("FPS", &(LLViewerStats::getInstance()->mFPSStat)); stat_barp->setUnitLabel(" fps"); stat_barp->mMinBar = 0.f; stat_barp->mMaxBar = 45.f; @@ -3083,7 +3039,7 @@ void init_stat_view() stat_barp->mDisplayBar = TRUE; stat_barp->mDisplayHistory = TRUE; - stat_barp = stat_viewp->addStat("Bandwidth", &(gViewerStats->mKBitStat)); + stat_barp = stat_viewp->addStat("Bandwidth", &(LLViewerStats::getInstance()->mKBitStat)); stat_barp->setUnitLabel(" kbps"); stat_barp->mMinBar = 0.f; stat_barp->mMaxBar = 900.f; @@ -3092,7 +3048,7 @@ void init_stat_view() stat_barp->mDisplayBar = TRUE; stat_barp->mDisplayHistory = FALSE; - stat_barp = stat_viewp->addStat("Packet Loss", &(gViewerStats->mPacketsLostPercentStat)); + stat_barp = stat_viewp->addStat("Packet Loss", &(LLViewerStats::getInstance()->mPacketsLostPercentStat)); stat_barp->setUnitLabel(" %"); stat_barp->mMinBar = 0.f; stat_barp->mMaxBar = 5.f; @@ -3103,7 +3059,7 @@ void init_stat_view() stat_barp->mDisplayMean = TRUE; stat_barp->mPrecision = 1; - stat_barp = stat_viewp->addStat("Ping Sim", &(gViewerStats->mSimPingStat)); + stat_barp = stat_viewp->addStat("Ping Sim", &(LLViewerStats::getInstance()->mSimPingStat)); stat_barp->setUnitLabel(" msec"); stat_barp->mMinBar = 0.f; stat_barp->mMaxBar = 1000.f; @@ -3223,31 +3179,31 @@ void init_stat_view() net_statviewp = new LLStatView("network stat view", "Network", "OpenDebugStatNet", rect); stat_viewp->addChildAtEnd(net_statviewp); - stat_barp = net_statviewp->addStat("Packets In", &(gViewerStats->mPacketsInStat)); + stat_barp = net_statviewp->addStat("Packets In", &(LLViewerStats::getInstance()->mPacketsInStat)); stat_barp->setUnitLabel("/sec"); stat_barp->mDisplayBar = FALSE; - stat_barp = net_statviewp->addStat("Packets Out", &(gViewerStats->mPacketsOutStat)); + stat_barp = net_statviewp->addStat("Packets Out", &(LLViewerStats::getInstance()->mPacketsOutStat)); stat_barp->setUnitLabel("/sec"); stat_barp->mDisplayBar = FALSE; - stat_barp = net_statviewp->addStat("Objects", &(gViewerStats->mObjectKBitStat)); + stat_barp = net_statviewp->addStat("Objects", &(LLViewerStats::getInstance()->mObjectKBitStat)); stat_barp->setUnitLabel(" kbps"); stat_barp->mDisplayBar = FALSE; - stat_barp = net_statviewp->addStat("Texture", &(gViewerStats->mTextureKBitStat)); + stat_barp = net_statviewp->addStat("Texture", &(LLViewerStats::getInstance()->mTextureKBitStat)); stat_barp->setUnitLabel(" kbps"); stat_barp->mDisplayBar = FALSE; - stat_barp = net_statviewp->addStat("Asset", &(gViewerStats->mAssetKBitStat)); + stat_barp = net_statviewp->addStat("Asset", &(LLViewerStats::getInstance()->mAssetKBitStat)); stat_barp->setUnitLabel(" kbps"); stat_barp->mDisplayBar = FALSE; - stat_barp = net_statviewp->addStat("Layers", &(gViewerStats->mLayersKBitStat)); + stat_barp = net_statviewp->addStat("Layers", &(LLViewerStats::getInstance()->mLayersKBitStat)); stat_barp->setUnitLabel(" kbps"); stat_barp->mDisplayBar = FALSE; - stat_barp = net_statviewp->addStat("Actual In", &(gViewerStats->mActualInKBitStat)); + stat_barp = net_statviewp->addStat("Actual In", &(LLViewerStats::getInstance()->mActualInKBitStat)); stat_barp->setUnitLabel(" kbps"); stat_barp->mMinBar = 0.f; stat_barp->mMaxBar = 1024.f; @@ -3256,7 +3212,7 @@ void init_stat_view() stat_barp->mDisplayBar = TRUE; stat_barp->mDisplayHistory = FALSE; - stat_barp = net_statviewp->addStat("Actual Out", &(gViewerStats->mActualOutKBitStat)); + stat_barp = net_statviewp->addStat("Actual Out", &(LLViewerStats::getInstance()->mActualOutKBitStat)); stat_barp->setUnitLabel(" kbps"); stat_barp->mMinBar = 0.f; stat_barp->mMaxBar = 512.f; @@ -3265,7 +3221,7 @@ void init_stat_view() stat_barp->mDisplayBar = TRUE; stat_barp->mDisplayHistory = FALSE; - stat_barp = net_statviewp->addStat("VFS Pending Ops", &(gViewerStats->mVFSPendingOperations)); + stat_barp = net_statviewp->addStat("VFS Pending Ops", &(LLViewerStats::getInstance()->mVFSPendingOperations)); stat_barp->setUnitLabel(" "); stat_barp->mPerSec = FALSE; stat_barp->mDisplayBar = FALSE; @@ -3275,7 +3231,7 @@ void init_stat_view() LLStatView *sim_statviewp = new LLStatView("sim stat view", "Simulator", "OpenDebugStatSim", rect); gDebugView->mFloaterStatsp->addStatView(sim_statviewp); - stat_barp = sim_statviewp->addStat("Time Dilation", &(gViewerStats->mSimTimeDilation)); + stat_barp = sim_statviewp->addStat("Time Dilation", &(LLViewerStats::getInstance()->mSimTimeDilation)); stat_barp->mPrecision = 2; stat_barp->mMinBar = 0.f; stat_barp->mMaxBar = 1.f; @@ -3285,7 +3241,7 @@ void init_stat_view() stat_barp->mDisplayBar = FALSE; stat_barp->mDisplayMean = FALSE; - stat_barp = sim_statviewp->addStat("Sim FPS", &(gViewerStats->mSimFPS)); + stat_barp = sim_statviewp->addStat("Sim FPS", &(LLViewerStats::getInstance()->mSimFPS)); stat_barp->mMinBar = 0.f; stat_barp->mMaxBar = 200.f; stat_barp->mTickSpacing = 20.f; @@ -3294,7 +3250,7 @@ void init_stat_view() stat_barp->mDisplayBar = FALSE; stat_barp->mDisplayMean = FALSE; - stat_barp = sim_statviewp->addStat("Physics FPS", &(gViewerStats->mSimPhysicsFPS)); + stat_barp = sim_statviewp->addStat("Physics FPS", &(LLViewerStats::getInstance()->mSimPhysicsFPS)); stat_barp->mPrecision = 1; stat_barp->mMinBar = 0.f; stat_barp->mMaxBar = 66.f; @@ -3304,7 +3260,7 @@ void init_stat_view() stat_barp->mDisplayBar = FALSE; stat_barp->mDisplayMean = FALSE; - stat_barp = sim_statviewp->addStat("Agent Updates/Sec", &(gViewerStats->mSimAgentUPS)); + stat_barp = sim_statviewp->addStat("Agent Updates/Sec", &(LLViewerStats::getInstance()->mSimAgentUPS)); stat_barp->mPrecision = 1; stat_barp->mMinBar = 0.f; stat_barp->mMaxBar = 100.f; @@ -3314,7 +3270,7 @@ void init_stat_view() stat_barp->mDisplayBar = FALSE; stat_barp->mDisplayMean = FALSE; - stat_barp = sim_statviewp->addStat("Main Agents", &(gViewerStats->mSimMainAgents)); + stat_barp = sim_statviewp->addStat("Main Agents", &(LLViewerStats::getInstance()->mSimMainAgents)); stat_barp->mPrecision = 0; stat_barp->mMinBar = 0.f; stat_barp->mMaxBar = 80.f; @@ -3324,7 +3280,7 @@ void init_stat_view() stat_barp->mDisplayBar = FALSE; stat_barp->mDisplayMean = FALSE; - stat_barp = sim_statviewp->addStat("Child Agents", &(gViewerStats->mSimChildAgents)); + stat_barp = sim_statviewp->addStat("Child Agents", &(LLViewerStats::getInstance()->mSimChildAgents)); stat_barp->mPrecision = 0; stat_barp->mMinBar = 0.f; stat_barp->mMaxBar = 40.f; @@ -3334,7 +3290,7 @@ void init_stat_view() stat_barp->mDisplayBar = FALSE; stat_barp->mDisplayMean = FALSE; - stat_barp = sim_statviewp->addStat("Objects", &(gViewerStats->mSimObjects)); + stat_barp = sim_statviewp->addStat("Objects", &(LLViewerStats::getInstance()->mSimObjects)); stat_barp->mPrecision = 0; stat_barp->mMinBar = 0.f; stat_barp->mMaxBar = 30000.f; @@ -3344,7 +3300,7 @@ void init_stat_view() stat_barp->mDisplayBar = FALSE; stat_barp->mDisplayMean = FALSE; - stat_barp = sim_statviewp->addStat("Active Objects", &(gViewerStats->mSimActiveObjects)); + stat_barp = sim_statviewp->addStat("Active Objects", &(LLViewerStats::getInstance()->mSimActiveObjects)); stat_barp->mPrecision = 0; stat_barp->mMinBar = 0.f; stat_barp->mMaxBar = 800.f; @@ -3354,7 +3310,7 @@ void init_stat_view() stat_barp->mDisplayBar = FALSE; stat_barp->mDisplayMean = FALSE; - stat_barp = sim_statviewp->addStat("Active Scripts", &(gViewerStats->mSimActiveScripts)); + stat_barp = sim_statviewp->addStat("Active Scripts", &(LLViewerStats::getInstance()->mSimActiveScripts)); stat_barp->mPrecision = 0; stat_barp->mMinBar = 0.f; stat_barp->mMaxBar = 800.f; @@ -3364,7 +3320,7 @@ void init_stat_view() stat_barp->mDisplayBar = FALSE; stat_barp->mDisplayMean = FALSE; - stat_barp = sim_statviewp->addStat("Script Perf", &(gViewerStats->mSimLSLIPS)); + stat_barp = sim_statviewp->addStat("Script Perf", &(LLViewerStats::getInstance()->mSimLSLIPS)); stat_barp->setUnitLabel(" ips"); stat_barp->mPrecision = 0; stat_barp->mMinBar = 0.f; @@ -3375,7 +3331,7 @@ void init_stat_view() stat_barp->mDisplayBar = FALSE; stat_barp->mDisplayMean = FALSE; - stat_barp = sim_statviewp->addStat("Packets In", &(gViewerStats->mSimInPPS)); + stat_barp = sim_statviewp->addStat("Packets In", &(LLViewerStats::getInstance()->mSimInPPS)); stat_barp->setUnitLabel(" pps"); stat_barp->mPrecision = 0; stat_barp->mMinBar = 0.f; @@ -3386,7 +3342,7 @@ void init_stat_view() stat_barp->mDisplayBar = FALSE; stat_barp->mDisplayMean = FALSE; - stat_barp = sim_statviewp->addStat("Packets Out", &(gViewerStats->mSimOutPPS)); + stat_barp = sim_statviewp->addStat("Packets Out", &(LLViewerStats::getInstance()->mSimOutPPS)); stat_barp->setUnitLabel(" pps"); stat_barp->mPrecision = 0; stat_barp->mMinBar = 0.f; @@ -3397,7 +3353,7 @@ void init_stat_view() stat_barp->mDisplayBar = FALSE; stat_barp->mDisplayMean = FALSE; - stat_barp = sim_statviewp->addStat("Pending Downloads", &(gViewerStats->mSimPendingDownloads)); + stat_barp = sim_statviewp->addStat("Pending Downloads", &(LLViewerStats::getInstance()->mSimPendingDownloads)); stat_barp->mPrecision = 0; stat_barp->mMinBar = 0.f; stat_barp->mMaxBar = 800.f; @@ -3407,7 +3363,7 @@ void init_stat_view() stat_barp->mDisplayBar = FALSE; stat_barp->mDisplayMean = FALSE; - stat_barp = sim_statviewp->addStat("Pending Uploads", &(gViewerStats->mSimPendingUploads)); + stat_barp = sim_statviewp->addStat("Pending Uploads", &(LLViewerStats::getInstance()->mSimPendingUploads)); stat_barp->mPrecision = 0; stat_barp->mMinBar = 0.f; stat_barp->mMaxBar = 100.f; @@ -3417,7 +3373,7 @@ void init_stat_view() stat_barp->mDisplayBar = FALSE; stat_barp->mDisplayMean = FALSE; - stat_barp = sim_statviewp->addStat("Total Unacked Bytes", &(gViewerStats->mSimTotalUnackedBytes)); + stat_barp = sim_statviewp->addStat("Total Unacked Bytes", &(LLViewerStats::getInstance()->mSimTotalUnackedBytes)); stat_barp->setUnitLabel(" kb"); stat_barp->mPrecision = 0; stat_barp->mMinBar = 0.f; @@ -3432,7 +3388,7 @@ void init_stat_view() sim_time_viewp = new LLStatView("sim perf view", "Time (ms)", "", rect); sim_statviewp->addChildAtEnd(sim_time_viewp); - stat_barp = sim_time_viewp->addStat("Total Frame Time", &(gViewerStats->mSimFrameMsec)); + stat_barp = sim_time_viewp->addStat("Total Frame Time", &(LLViewerStats::getInstance()->mSimFrameMsec)); stat_barp->setUnitLabel("ms"); stat_barp->mPrecision = 1; stat_barp->mMinBar = 0.f; @@ -3443,7 +3399,7 @@ void init_stat_view() stat_barp->mDisplayBar = FALSE; stat_barp->mDisplayMean = FALSE; - stat_barp = sim_time_viewp->addStat("Net Time", &(gViewerStats->mSimNetMsec)); + stat_barp = sim_time_viewp->addStat("Net Time", &(LLViewerStats::getInstance()->mSimNetMsec)); stat_barp->setUnitLabel("ms"); stat_barp->mPrecision = 1; stat_barp->mMinBar = 0.f; @@ -3454,7 +3410,7 @@ void init_stat_view() stat_barp->mDisplayBar = FALSE; stat_barp->mDisplayMean = FALSE; - stat_barp = sim_time_viewp->addStat("Sim Time (Physics)", &(gViewerStats->mSimSimPhysicsMsec)); + stat_barp = sim_time_viewp->addStat("Sim Time (Physics)", &(LLViewerStats::getInstance()->mSimSimPhysicsMsec)); stat_barp->setUnitLabel("ms"); stat_barp->mPrecision = 1; stat_barp->mMinBar = 0.f; @@ -3465,7 +3421,7 @@ void init_stat_view() stat_barp->mDisplayBar = FALSE; stat_barp->mDisplayMean = FALSE; - stat_barp = sim_time_viewp->addStat("Sim Time (Other)", &(gViewerStats->mSimSimOtherMsec)); + stat_barp = sim_time_viewp->addStat("Sim Time (Other)", &(LLViewerStats::getInstance()->mSimSimOtherMsec)); stat_barp->setUnitLabel("ms"); stat_barp->mPrecision = 1; stat_barp->mMinBar = 0.f; @@ -3476,7 +3432,7 @@ void init_stat_view() stat_barp->mDisplayBar = FALSE; stat_barp->mDisplayMean = FALSE; - stat_barp = sim_time_viewp->addStat("Agent Time", &(gViewerStats->mSimAgentMsec)); + stat_barp = sim_time_viewp->addStat("Agent Time", &(LLViewerStats::getInstance()->mSimAgentMsec)); stat_barp->setUnitLabel("ms"); stat_barp->mPrecision = 1; stat_barp->mMinBar = 0.f; @@ -3487,7 +3443,7 @@ void init_stat_view() stat_barp->mDisplayBar = FALSE; stat_barp->mDisplayMean = FALSE; - stat_barp = sim_time_viewp->addStat("Images Time", &(gViewerStats->mSimImagesMsec)); + stat_barp = sim_time_viewp->addStat("Images Time", &(LLViewerStats::getInstance()->mSimImagesMsec)); stat_barp->setUnitLabel("ms"); stat_barp->mPrecision = 1; stat_barp->mMinBar = 0.f; @@ -3498,7 +3454,7 @@ void init_stat_view() stat_barp->mDisplayBar = FALSE; stat_barp->mDisplayMean = FALSE; - stat_barp = sim_time_viewp->addStat("Script Time", &(gViewerStats->mSimScriptMsec)); + stat_barp = sim_time_viewp->addStat("Script Time", &(LLViewerStats::getInstance()->mSimScriptMsec)); stat_barp->setUnitLabel("ms"); stat_barp->mPrecision = 1; stat_barp->mMinBar = 0.f; diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index 00331a2e23..3546d6c888 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -74,7 +74,7 @@ #include "llviewermenu.h" // for gMenuBarView #include "llviewerparcelmgr.h" #include "llviewerthrottle.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llvoiceclient.h" // for gVoiceClient #include "lltoolmgr.h" @@ -137,7 +137,7 @@ LLStatusBar::LLStatusBar(const std::string& name, const LLRect& rect) mBalanceTimer = new LLFrameTimer(); mHealthTimer = new LLFrameTimer(); - gUICtrlFactory->buildPanel(this,"panel_status_bar.xml"); + LLUICtrlFactory::getInstance()->buildPanel(this,"panel_status_bar.xml"); // status bar can never get a tab setFocusRoot(FALSE); @@ -145,11 +145,11 @@ LLStatusBar::LLStatusBar(const std::string& name, const LLRect& rect) // build date necessary data (must do after panel built) setupDate(); - mTextParcelName = LLUICtrlFactory::getTextBoxByName( this, "ParcelNameText" ); - mTextBalance = LLUICtrlFactory::getTextBoxByName( this, "BalanceText" ); + mTextParcelName = getChild<LLTextBox>("ParcelNameText" ); + mTextBalance = getChild<LLTextBox>("BalanceText" ); - mTextHealth = LLUICtrlFactory::getTextBoxByName( this, "HealthText" ); - mTextTime = LLUICtrlFactory::getTextBoxByName( this, "TimeText" ); + mTextHealth = getChild<LLTextBox>("HealthText" ); + mTextTime = getChild<LLTextBox>("TimeText" ); childSetAction("scriptout", onClickScriptDebug, this); childSetAction("health", onClickHealth, this); @@ -166,6 +166,7 @@ LLStatusBar::LLStatusBar(const std::string& name, const LLRect& rect) childSetVisible("search_editor", gSavedSettings.getBOOL("ShowSearchBar")); childSetVisible("search_btn", gSavedSettings.getBOOL("ShowSearchBar")); + childSetVisible("menubar_search_bevel_bg", gSavedSettings.getBOOL("ShowSearchBar")); childSetActionTextbox("ParcelNameText", onClickParcelInfo ); childSetActionTextbox("BalanceText", onClickBalance ); @@ -177,7 +178,7 @@ LLStatusBar::LLStatusBar(const std::string& name, const LLRect& rect) r.set( x-SIM_STAT_WIDTH, y+MENU_BAR_HEIGHT-1, x, y+1); mSGBandwidth = new LLStatGraph("BandwidthGraph", r); mSGBandwidth->setFollows(FOLLOWS_BOTTOM | FOLLOWS_RIGHT); - mSGBandwidth->setStat(&gViewerStats->mKBitStat); + mSGBandwidth->setStat(&LLViewerStats::getInstance()->mKBitStat); LLString text = childGetText("bandwidth_tooltip") + " "; LLUIString bandwidth_tooltip = text; // get the text from XML until this widget is XML driven mSGBandwidth->setLabel(bandwidth_tooltip.getString().c_str()); @@ -190,7 +191,7 @@ LLStatusBar::LLStatusBar(const std::string& name, const LLRect& rect) r.set( x-SIM_STAT_WIDTH, y+MENU_BAR_HEIGHT-1, x, y+1); mSGPacketLoss = new LLStatGraph("PacketLossPercent", r); mSGPacketLoss->setFollows(FOLLOWS_BOTTOM | FOLLOWS_RIGHT); - mSGPacketLoss->setStat(&gViewerStats->mPacketsLostPercentStat); + mSGPacketLoss->setStat(&LLViewerStats::getInstance()->mPacketsLostPercentStat); text = childGetText("packet_loss_tooltip") + " "; LLUIString packet_loss_tooltip = text; // get the text from XML until this widget is XML driven mSGPacketLoss->setLabel(packet_loss_tooltip.getString().c_str()); @@ -220,18 +221,6 @@ LLStatusBar::~LLStatusBar() // LLView destructor cleans up children } -//virtual -EWidgetType LLStatusBar::getWidgetType() const -{ - return WIDGET_TYPE_STATUS_BAR; -} - -//virtual -LLString LLStatusBar::getWidgetTag() const -{ - return LL_STATUS_BAR_TAG; -} - //----------------------------------------------------------------------- // Overrides //----------------------------------------------------------------------- @@ -321,7 +310,7 @@ void LLStatusBar::refresh() } LLViewerRegion *region = gAgent.getRegion(); - LLParcel *parcel = gParcelMgr->getAgentParcel(); + LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); LLRect buttonRect; @@ -464,7 +453,7 @@ void LLStatusBar::refresh() BOOL canBuyLand = parcel && !parcel->isPublic() - && gParcelMgr->canAgentBuyParcel(parcel, false); + && LLViewerParcelMgr::getInstance()->canAgentBuyParcel(parcel, false); childSetVisible("buyland", canBuyLand); if (canBuyLand) { @@ -524,7 +513,7 @@ void LLStatusBar::refresh() mRegionDetails.mZ = pos_z; mRegionDetails.mArea = parcel->getArea(); mRegionDetails.mForSale = parcel->getForSale(); - mRegionDetails.mTraffic = gParcelMgr->getDwelling(); + mRegionDetails.mTraffic = LLViewerParcelMgr::getInstance()->getDwelling(); if (parcel->isPublic()) { @@ -599,15 +588,14 @@ void LLStatusBar::refresh() if (search_visible) { childGetRect("search_btn", r); - r.translate( new_right - r.mRight, 0); - childSetRect("search_btn", r); + //r.translate( new_right - r.mRight, 0); + //childSetRect("search_btn", r); new_right -= r.getWidth(); childGetRect("search_editor", r); - r.translate( new_right - r.mRight, 0); - childSetRect("search_editor", r); + //r.translate( new_right - r.mRight, 0); + //childSetRect("search_editor", r); new_right -= r.getWidth() + 6; - } else { @@ -645,6 +633,7 @@ void LLStatusBar::refresh() // Set search bar visibility childSetVisible("search_editor", search_visible); childSetVisible("search_btn", search_visible); + childSetVisible("menubar_search_bevel_bg", search_visible); mSGBandwidth->setVisible(! search_visible); mSGPacketLoss->setVisible(! search_visible); childSetEnabled("stat_btn", ! search_visible); @@ -674,7 +663,7 @@ void LLStatusBar::creditBalance(S32 credit) void LLStatusBar::setBalance(S32 balance) { - LLString money_str = gResMgr->getMonetaryString( balance ); + LLString money_str = LLResMgr::getInstance()->getMonetaryString( balance ); LLString balance_str = "L$"; balance_str += money_str; mTextBalance->setText( balance_str ); @@ -768,7 +757,7 @@ S32 LLStatusBar::getSquareMetersLeft() const static void onClickParcelInfo(void* data) { - gParcelMgr->selectParcelAt(gAgent.getPositionGlobal()); + LLViewerParcelMgr::getInstance()->selectParcelAt(gAgent.getPositionGlobal()); LLFloaterLand::showInstance(); } @@ -832,8 +821,8 @@ static void onClickScripts(void*) static void onClickBuyLand(void*) { - gParcelMgr->selectParcelAt(gAgent.getPositionGlobal()); - gParcelMgr->startBuyLand(); + LLViewerParcelMgr::getInstance()->selectParcelAt(gAgent.getPositionGlobal()); + LLViewerParcelMgr::getInstance()->startBuyLand(); } // sets the static variables necessary for the date diff --git a/indra/newview/llstatusbar.h b/indra/newview/llstatusbar.h index 0605246f16..91bc787485 100644 --- a/indra/newview/llstatusbar.h +++ b/indra/newview/llstatusbar.h @@ -88,9 +88,6 @@ public: LLStatusBar(const std::string& name, const LLRect& rect ); /*virtual*/ ~LLStatusBar(); - /*virtual*/ EWidgetType getWidgetType() const; - /*virtual*/ LLString getWidgetTag() const; - /*virtual*/ void draw(); // MANIPULATORS diff --git a/indra/newview/llsurface.cpp b/indra/newview/llsurface.cpp index dc1102eba7..6618e3d631 100644 --- a/indra/newview/llsurface.cpp +++ b/indra/newview/llsurface.cpp @@ -175,7 +175,7 @@ void LLSurface::create(const S32 grids_per_edge, mOriginGlobal.setVec(origin_global); - mPVArray.create(mGridsPerEdge, mGridsPerPatchEdge, gWorldPointer->getRegionScale()); + mPVArray.create(mGridsPerEdge, mGridsPerPatchEdge, LLWorld::getInstance()->getRegionScale()); S32 number_of_grids = mGridsPerEdge * mGridsPerEdge; diff --git a/indra/newview/llsurfacepatch.cpp b/indra/newview/llsurfacepatch.cpp index 502ff07b3c..7a475f21ba 100644 --- a/indra/newview/llsurfacepatch.cpp +++ b/indra/newview/llsurfacepatch.cpp @@ -845,7 +845,7 @@ void LLSurfacePatch::updateVisibility() LLVector3 radius = LLVector3(mRadius, mRadius, mRadius); // sphere in frustum on global coordinates - if (gCamera->AABBInFrustumNoFarClip(center, radius)) + if (LLViewerCamera::getInstance()->AABBInFrustumNoFarClip(center, radius)) { // We now need to calculate the render stride based on patchp's distance // from LLCamera render_stride is governed by a relation something like this... diff --git a/indra/newview/lltexlayer.cpp b/indra/newview/lltexlayer.cpp index 78cb53c2a5..7a2d232de6 100644 --- a/indra/newview/lltexlayer.cpp +++ b/indra/newview/lltexlayer.cpp @@ -326,7 +326,7 @@ void LLTexLayerSetBuffer::readBackAndUpload(U8* baked_bump_data) stop_glerror(); llinfos << "Baked " << mTexLayerSet->getBodyRegion() << llendl; - gViewerStats->incStat(LLViewerStats::ST_TEX_BAKES); + LLViewerStats::getInstance()->incStat(LLViewerStats::ST_TEX_BAKES); llassert( gAgent.getAvatarObject() == mTexLayerSet->getAvatar() ); diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp index b60ef6c5ac..474d81b77f 100644 --- a/indra/newview/lltexturecache.cpp +++ b/indra/newview/lltexturecache.cpp @@ -50,15 +50,6 @@ class LLTextureCacheWorker : public LLWorkerClass friend class LLTextureCache; private: - enum e_state - { - INIT = 0, - LOCAL = 1, - CACHE = 2, - HEADER = 3, - BODY = 4 - }; - class ReadResponder : public LLLFSThread::Responder { public: @@ -97,10 +88,9 @@ public: S32 imagesize, // for writes LLTextureCache::Responder* responder) : LLWorkerClass(cache, "LLTextureCacheWorker"), + mID(id), mCache(cache), mPriority(priority), - mID(id), - mState(INIT), mReadData(NULL), mWriteData(data), mDataSize(datasize), @@ -121,8 +111,10 @@ public: delete[] mReadData; } - bool doRead(); - bool doWrite(); + // override this interface + virtual bool doRead() = 0; + virtual bool doWrite() = 0; + virtual bool doWork(S32 param); // Called from LLWorkerThread::processRequest() handle_t read() { addWork(0, LLWorkerThread::PRIORITY_HIGH | mPriority); return mRequestHandle; } @@ -133,24 +125,23 @@ public: mBytesRead = bytes; setPriority(LLWorkerThread::PRIORITY_HIGH | mPriority); } - + private: virtual void startWork(S32 param); // called from addWork() (MAIN THREAD) virtual void finishWork(S32 param, bool completed); // called from finishRequest() (WORK THREAD) virtual void endWork(S32 param, bool aborted); // called from doWork() (MAIN THREAD) -private: +protected: LLTextureCache* mCache; U32 mPriority; - LLUUID mID; - e_state mState; + LLUUID mID; U8* mReadData; U8* mWriteData; S32 mDataSize; S32 mOffset; S32 mImageSize; - S32 mImageFormat; + EImageCodec mImageFormat; BOOL mImageLocal; LLPointer<LLTextureCache::Responder> mResponder; LLLFSThread::handle_t mFileHandle; @@ -158,19 +149,169 @@ private: LLAtomicS32 mBytesRead; }; +class LLTextureCacheLocalFileWorker : public LLTextureCacheWorker +{ +public: + LLTextureCacheLocalFileWorker(LLTextureCache* cache, U32 priority, const LLString& filename, const LLUUID& id, + U8* data, S32 datasize, S32 offset, + S32 imagesize, // for writes + LLTextureCache::Responder* responder) + : LLTextureCacheWorker(cache, priority, id, data, datasize, offset, imagesize, responder), + mFileName(filename) + + { + } + + virtual bool doRead(); + virtual bool doWrite(); + +private: + LLString mFileName; +}; + +bool LLTextureCacheLocalFileWorker::doRead() +{ + S32 local_size = ll_apr_file_size(mFileName, mCache->getFileAPRPool()); + + if (local_size > 0 && mFileName.size() > 4) + { + mDataSize = local_size; // Only a complete file is valid + + LLString extension = mFileName.substr(mFileName.size() - 3, 3); + + mImageFormat = LLImageBase::getCodecFromExtension(extension); + + if (mImageFormat == IMG_CODEC_INVALID) + { + llwarns << "Unrecognized file extension " << extension << " for local texture " << mFileName << llendl; + mDataSize = 0; // no data + return true; + } + } + else + { + // file doesn't exist + mDataSize = 0; // no data + return true; + } + +#if USE_LFS_READ + if (mFileHandle == LLLFSThread::nullHandle()) + { + mImageLocal = TRUE; + mImageSize = local_size; + if (!mDataSize || mDataSize + mOffset > local_size) + { + mDataSize = local_size - mOffset; + } + if (mDataSize <= 0) + { + // no more data to read + mDataSize = 0; + return true; + } + mReadData = new U8[mDataSize]; + mBytesRead = -1; + mBytesToRead = mDataSize; + setPriority(LLWorkerThread::PRIORITY_LOW | mPriority); + mFileHandle = LLLFSThread::sLocal->read(local_filename, mReadData, mOffset, mDataSize, + new ReadResponder(mCache, mRequestHandle)); + return false; + } + else + { + if (mBytesRead >= 0) + { + if (mBytesRead != mBytesToRead) + { + llwarns << "Error reading file from local cache: " << local_filename + << " Bytes: " << mDataSize << " Offset: " << mOffset + << " / " << mDataSize << llendl; + mDataSize = 0; // failed + delete[] mReadData; + mReadData = NULL; + } + return true; + } + else + { + return false; + } + } +#else + if (!mDataSize || mDataSize > local_size) + { + mDataSize = local_size; + } + mReadData = new U8[mDataSize]; + S32 bytes_read = ll_apr_file_read_ex(mFileName, mCache->getFileAPRPool(), + mReadData, mOffset, mDataSize); + if (bytes_read != mDataSize) + { + llwarns << "Error reading file from local cache: " << mFileName + << " Bytes: " << mDataSize << " Offset: " << mOffset + << " / " << mDataSize << llendl; + mDataSize = 0; + delete[] mReadData; + mReadData = NULL; + } + else + { + mImageSize = local_size; + mImageLocal = TRUE; + } + return true; +#endif +} + +bool LLTextureCacheLocalFileWorker::doWrite() +{ + // no writes for local files + return false; +} + +class LLTextureCacheRemoteWorker : public LLTextureCacheWorker +{ +public: + LLTextureCacheRemoteWorker(LLTextureCache* cache, U32 priority, const LLUUID& id, + U8* data, S32 datasize, S32 offset, + S32 imagesize, // for writes + LLTextureCache::Responder* responder) + : LLTextureCacheWorker(cache, priority, id, data, datasize, offset, imagesize, responder), + mState(INIT) + { + } + + virtual bool doRead(); + virtual bool doWrite(); + +private: + enum e_state + { + INIT = 0, + LOCAL = 1, + CACHE = 2, + HEADER = 3, + BODY = 4 + }; + + e_state mState; +}; + + //virtual void LLTextureCacheWorker::startWork(S32 param) { } -bool LLTextureCacheWorker::doRead() +bool LLTextureCacheRemoteWorker::doRead() { S32 local_size = 0; std::string local_filename; if (mState == INIT) { - std::string filename = mCache->getLocalFileName(mID); + std::string filename = mCache->getLocalFileName(mID); local_filename = filename + ".j2c"; local_size = ll_apr_file_size(local_filename, mCache->getFileAPRPool()); if (local_size == 0) @@ -468,19 +609,13 @@ bool LLTextureCacheWorker::doRead() return false; } -bool LLTextureCacheWorker::doWrite() +bool LLTextureCacheRemoteWorker::doWrite() { S32 idx = -1; - if (mState == INIT) - { - llassert_always(mOffset == 0); // Currently don't support offsets - mState = CACHE; - } - // No LOCAL state for write() - if (mState == CACHE) + if (mState == INIT) { S32 cur_imagesize = 0; S32 offset = mOffset; @@ -1250,13 +1385,27 @@ S32 LLTextureCache::getHeaderCacheEntry(const LLUUID& id, bool touch, S32* image // Calls from texture pipeline thread (i.e. LLTextureFetch) +LLTextureCache::handle_t LLTextureCache::readFromCache(const LLString& filename, const LLUUID& id, U32 priority, + S32 offset, S32 size, ReadResponder* responder) +{ + // Note: checking to see if an entry exists can cause a stall, + // so let the thread handle it + LLMutexLock lock(&mWorkersMutex); + LLTextureCacheWorker* worker = new LLTextureCacheLocalFileWorker(this, priority, filename, id, + NULL, size, offset, 0, + responder); + handle_t handle = worker->read(); + mReaders[handle] = worker; + return handle; +} + LLTextureCache::handle_t LLTextureCache::readFromCache(const LLUUID& id, U32 priority, S32 offset, S32 size, ReadResponder* responder) { // Note: checking to see if an entry exists can cause a stall, // so let the thread handle it LLMutexLock lock(&mWorkersMutex); - LLTextureCacheWorker* worker = new LLTextureCacheWorker(this, priority, id, + LLTextureCacheWorker* worker = new LLTextureCacheRemoteWorker(this, priority, id, NULL, size, offset, 0, responder); handle_t handle = worker->read(); @@ -1264,6 +1413,7 @@ LLTextureCache::handle_t LLTextureCache::readFromCache(const LLUUID& id, U32 pri return handle; } + bool LLTextureCache::readComplete(handle_t handle, bool abort) { lockWorkers(); @@ -1306,7 +1456,7 @@ LLTextureCache::handle_t LLTextureCache::writeToCache(const LLUUID& id, U32 prio { LLMutexLock lock(&mWorkersMutex); llassert_always(imagesize > 0); - LLTextureCacheWorker* worker = new LLTextureCacheWorker(this, priority, id, + LLTextureCacheWorker* worker = new LLTextureCacheRemoteWorker(this, priority, id, data, datasize, 0, imagesize, responder); handle_t handle = worker->write(); diff --git a/indra/newview/lltexturecache.h b/indra/newview/lltexturecache.h index e3d3fa3977..28b33d5c4e 100644 --- a/indra/newview/lltexturecache.h +++ b/indra/newview/lltexturecache.h @@ -44,6 +44,8 @@ class LLTextureCacheWorker; class LLTextureCache : public LLWorkerThread { friend class LLTextureCacheWorker; + friend class LLTextureCacheRemoteWorker; + friend class LLTextureCacheLocalFileWorker; public: @@ -81,6 +83,9 @@ public: void purgeCache(ELLPath location); S64 initCache(ELLPath location, S64 maxsize, BOOL read_only); + handle_t readFromCache(const LLString& local_filename, const LLUUID& id, U32 priority, S32 offset, S32 size, + ReadResponder* responder); + handle_t readFromCache(const LLUUID& id, U32 priority, S32 offset, S32 size, ReadResponder* responder); bool readComplete(handle_t handle, bool abort); diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 4f8e562baf..e20cc75b0a 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -64,7 +64,7 @@ #include "llviewerobject.h" #include "llviewercontrol.h" #include "llglheaders.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" static const S32 CLOSE_BTN_WIDTH = 100; @@ -119,7 +119,7 @@ public: EAcceptance *accept, LLString& tooltip_msg); virtual void draw(); - virtual BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent); + virtual BOOL handleKeyHere(KEY key, MASK mask); // LLFloater overrides virtual void onClose(bool app_quitting); @@ -214,11 +214,11 @@ LLFloaterTexturePicker::LLFloaterTexturePicker( mNonImmediateFilterPermMask(non_immediate_filter_perm_mask), mContextConeOpacity(0.f) { - gUICtrlFactory->buildFloater(this,"floater_texture_ctrl.xml"); + LLUICtrlFactory::getInstance()->buildFloater(this,"floater_texture_ctrl.xml"); - mTentativeLabel = LLUICtrlFactory::getTextBoxByName(this,"Multiple"); + mTentativeLabel = getChild<LLTextBox>("Multiple"); - mResolutionLabel = LLUICtrlFactory::getTextBoxByName(this,"unknown"); + mResolutionLabel = getChild<LLTextBox>("unknown"); childSetAction("Default",LLFloaterTexturePicker::onBtnSetToDefault,this); @@ -229,10 +229,10 @@ LLFloaterTexturePicker::LLFloaterTexturePicker( childSetCommitCallback("show_folders_check", onShowFolders, this); childSetVisible("show_folders_check", FALSE); - mSearchEdit = (LLSearchEditor*)getCtrlByNameAndType("inventory search editor", WIDGET_TYPE_SEARCH_EDITOR); + mSearchEdit = getChild<LLSearchEditor>("inventory search editor"); mSearchEdit->setSearchCallback(onSearchEdit, this); - mInventoryPanel = (LLInventoryPanel*)this->getCtrlByNameAndType("inventory panel", WIDGET_TYPE_INVENTORY_PANEL); + mInventoryPanel = getChild<LLInventoryPanel>("inventory panel"); if(mInventoryPanel) { @@ -332,9 +332,9 @@ void LLFloaterTexturePicker::setCanApplyImmediately(BOOL b) void LLFloaterTexturePicker::stopUsingPipette() { - if (gToolMgr && gToolMgr->getCurrentTool() == gToolPipette) + if (LLToolMgr::getInstance()->getCurrentTool() == LLToolPipette::getInstance()) { - gToolMgr->clearTransientTool(); + LLToolMgr::getInstance()->clearTransientTool(); } } @@ -407,15 +407,15 @@ BOOL LLFloaterTexturePicker::handleDragAndDrop( return handled; } -BOOL LLFloaterTexturePicker::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent) +BOOL LLFloaterTexturePicker::handleKeyHere(KEY key, MASK mask) { LLFolderView* root_folder = mInventoryPanel->getRootFolder(); if (root_folder && mSearchEdit) { - if (!called_from_parent && mSearchEdit->hasFocus() && - (key == KEY_RETURN || key == KEY_DOWN) && - mask == MASK_NONE) + if (mSearchEdit->hasFocus() + && (key == KEY_RETURN || key == KEY_DOWN) + && mask == MASK_NONE) { if (!root_folder->getCurSelectedItem()) { @@ -442,7 +442,7 @@ BOOL LLFloaterTexturePicker::handleKeyHere(KEY key, MASK mask, BOOL called_from_ } } - return LLFloater::handleKeyHere(key, mask, called_from_parent); + return LLFloater::handleKeyHere(key, mask); } // virtual @@ -533,14 +533,14 @@ void LLFloaterTexturePicker::draw() // if we're inactive, gray out "apply immediate" checkbox childSetEnabled("show_folders_check", mActive && mCanApplyImmediately && !mNoCopyTextureSelected); childSetEnabled("Select", mActive); - childSetEnabled("Pipette", gToolMgr != NULL && mActive); - childSetValue("Pipette", gToolMgr && gToolMgr->getCurrentTool() == gToolPipette); + childSetEnabled("Pipette", mActive); + childSetValue("Pipette", LLToolMgr::getInstance()->getCurrentTool() == LLToolPipette::getInstance()); //RN: reset search bar to reflect actual search query (all caps, for example) mSearchEdit->setText(mInventoryPanel->getFilterSubString()); //BOOL allow_copy = FALSE; - if( getVisible() && mOwner) + if( mOwner ) { mTexturep = NULL; if(mImageAssetID.notNull()) @@ -739,18 +739,18 @@ void LLFloaterTexturePicker::onBtnPipette( void* userdata ) { LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata; - if ( self && gToolMgr) + if ( self) { BOOL pipette_active = self->childGetValue("Pipette").asBoolean(); pipette_active = !pipette_active; if (pipette_active) { - gToolPipette->setSelectCallback(onTextureSelect, self); - gToolMgr->setTransientTool(gToolPipette); + LLToolPipette::getInstance()->setSelectCallback(onTextureSelect, self); + LLToolMgr::getInstance()->setTransientTool(LLToolPipette::getInstance()); } else { - gToolMgr->clearTransientTool(); + LLToolMgr::getInstance()->clearTransientTool(); } } @@ -859,7 +859,7 @@ void LLFloaterTexturePicker::onTextureSelect( const LLTextureEntry& te, void *da LLUUID inventory_item_id = self->findItemID(te.getID(), TRUE); if (self && inventory_item_id.notNull()) { - gToolPipette->setResult(TRUE, ""); + LLToolPipette::getInstance()->setResult(TRUE, ""); self->setImageID(te.getID()); self->mNoCopyTextureSelected = FALSE; @@ -875,13 +875,15 @@ void LLFloaterTexturePicker::onTextureSelect( const LLTextureEntry& te, void *da } else { - gToolPipette->setResult(FALSE, "You do not have a copy this \nof texture in your inventory"); + LLToolPipette::getInstance()->setResult(FALSE, "You do not have a copy this \nof texture in your inventory"); } } /////////////////////////////////////////////////////////////////////// // LLTextureCtrl +static LLRegisterWidget<LLTextureCtrl> r("texture_picker"); + LLTextureCtrl::LLTextureCtrl( const std::string& name, const LLRect &rect, @@ -933,6 +935,7 @@ LLTextureCtrl::LLTextureCtrl( LLRect border_rect(0, getRect().getHeight(), getRect().getWidth(), 0); border_rect.mBottom += BTN_HEIGHT_SMALL; mBorder = new LLViewBorder("border", border_rect, LLViewBorder::BEVEL_IN); + mBorder->setFollowsAll(); addChild(mBorder); setEnabled(TRUE); // for the tooltip @@ -1276,50 +1279,47 @@ BOOL LLTextureCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask, void LLTextureCtrl::draw() { - if( getVisible() ) - { - mBorder->setKeyboardFocusHighlight(hasFocus()); + mBorder->setKeyboardFocusHighlight(hasFocus()); - if (mImageAssetID.isNull() || !mValid) - { - mTexturep = NULL; - } - else - { - mTexturep = gImageList.getImage(mImageAssetID, MIPMAP_YES, IMMEDIATE_NO); - mTexturep->setBoostLevel(LLViewerImage::BOOST_PREVIEW); - } - - // Border - LLRect border( 0, getRect().getHeight(), getRect().getWidth(), BTN_HEIGHT_SMALL ); - gl_rect_2d( border, mBorderColor, FALSE ); + if (mImageAssetID.isNull() || !mValid) + { + mTexturep = NULL; + } + else + { + mTexturep = gImageList.getImage(mImageAssetID, MIPMAP_YES, IMMEDIATE_NO); + mTexturep->setBoostLevel(LLViewerImage::BOOST_PREVIEW); + } + + // Border + LLRect border( 0, getRect().getHeight(), getRect().getWidth(), BTN_HEIGHT_SMALL ); + gl_rect_2d( border, mBorderColor, FALSE ); - // Interior - LLRect interior = border; - interior.stretch( -1 ); + // Interior + LLRect interior = border; + interior.stretch( -1 ); - if( mTexturep ) + if( mTexturep ) + { + if( mTexturep->getComponents() == 4 ) { - if( mTexturep->getComponents() == 4 ) - { - gl_rect_2d_checkerboard( interior ); - } - - gl_draw_scaled_image( interior.mLeft, interior.mBottom, interior.getWidth(), interior.getHeight(), mTexturep); - mTexturep->addTextureStats( (F32)(interior.getWidth() * interior.getHeight()) ); + gl_rect_2d_checkerboard( interior ); } - else - { - gl_rect_2d( interior, LLColor4::grey, TRUE ); + + gl_draw_scaled_image( interior.mLeft, interior.mBottom, interior.getWidth(), interior.getHeight(), mTexturep); + mTexturep->addTextureStats( (F32)(interior.getWidth() * interior.getHeight()) ); + } + else + { + gl_rect_2d( interior, LLColor4::grey, TRUE ); - // Draw X - gl_draw_x( interior, LLColor4::black ); - } + // Draw X + gl_draw_x( interior, LLColor4::black ); + } - mTentativeLabel->setVisible( !mTexturep.isNull() && getTentative() ); + mTentativeLabel->setVisible( !mTexturep.isNull() && getTentative() ); - LLUICtrl::draw(); - } + LLUICtrl::draw(); } BOOL LLTextureCtrl::allowDrop(LLInventoryItem* item) @@ -1370,14 +1370,14 @@ BOOL LLTextureCtrl::doDrop(LLInventoryItem* item) return TRUE; } -BOOL LLTextureCtrl::handleUnicodeCharHere(llwchar uni_char, BOOL called_from_parent) +BOOL LLTextureCtrl::handleUnicodeCharHere(llwchar uni_char) { - if( getVisible() && getEnabled() && !called_from_parent && ' ' == uni_char ) + if( ' ' == uni_char ) { showPicker(TRUE); return TRUE; } - return LLUICtrl::handleUnicodeCharHere(uni_char, called_from_parent); + return LLUICtrl::handleUnicodeCharHere(uni_char); } void LLTextureCtrl::setValue( LLSD value ) diff --git a/indra/newview/lltexturectrl.h b/indra/newview/lltexturectrl.h index 4a279d4084..5a7b9eede6 100644 --- a/indra/newview/lltexturectrl.h +++ b/indra/newview/lltexturectrl.h @@ -74,8 +74,6 @@ public: virtual ~LLTextureCtrl(); // LLView interface - virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_TEXTURE_PICKER; } - virtual LLString getWidgetTag() const { return LL_TEXTURE_CTRL_TAG; } virtual LLXMLNodePtr getXML(bool save_children = true) const; static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); @@ -85,7 +83,7 @@ public: EAcceptance *accept, LLString& tooltip_msg); virtual BOOL handleHover(S32 x, S32 y, MASK mask); - virtual BOOL handleUnicodeCharHere(llwchar uni_char, BOOL called_from_parent); + virtual BOOL handleUnicodeCharHere(llwchar uni_char); virtual void draw(); virtual void setVisible( BOOL visible ); diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index acd64220d9..4635b1b88a 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -52,8 +52,8 @@ //static class LLTextureFetchWorker : public LLWorkerClass { - friend class LLTextureFetch; - +friend class LLTextureFetch; + private: class URLResponder : public LLHTTPClient::Responder { @@ -233,6 +233,7 @@ private: /*virtual*/ void startWork(S32 param); // called from addWork() (MAIN THREAD) /*virtual*/ void endWork(S32 param, bool aborted); // called from doWork() (MAIN THREAD) + virtual LLString getName() { return LLString::null; } void resetFormattedData(); void setImagePriority(F32 priority); @@ -337,6 +338,26 @@ private: U8 mImageCodec; }; +class LLTextureFetchLocalFileWorker : public LLTextureFetchWorker +{ +friend class LLTextureFetch; + +protected: + LLTextureFetchLocalFileWorker(LLTextureFetch* fetcher, const LLString& filename, const LLUUID& id, const LLHost& host, + F32 priority, S32 discard, S32 size) + : LLTextureFetchWorker(fetcher, id, host, priority, discard, size), + mFileName(filename) + {} + +private: + /*virtual*/ LLString getName() { return mFileName; } + + +private: + LLString mFileName; +}; + + //static const char* LLTextureFetchWorker::sStateDescs[] = { "INVALID", @@ -580,9 +601,19 @@ bool LLTextureFetchWorker::doWork(S32 param) mFileSize = 0; mLoaded = FALSE; setPriority(LLWorkerThread::PRIORITY_LOW | mWorkPriority); // Set priority first since Responder may change it + CacheReadResponder* responder = new CacheReadResponder(mFetcher, mID, mFormattedImage); - mCacheReadHandle = mFetcher->mTextureCache->readFromCache(mID, cache_priority, - offset, size, responder); + if (getName().empty()) + { + mCacheReadHandle = mFetcher->mTextureCache->readFromCache(mID, cache_priority, + offset, size, responder); + } + else + { + // read file from local disk + mCacheReadHandle = mFetcher->mTextureCache->readFromCache(getName(), mID, cache_priority, + offset, size, responder); + } } if (mLoaded) @@ -612,12 +643,17 @@ bool LLTextureFetchWorker::doWork(S32 param) if ((mCachedSize >= mDesiredSize) || mHaveAllData) { // we have enough data, decode it - llassert_always(mFormattedImage->getDataSize() > 0); + llassert_always(mFormattedImage.isNull() || mFormattedImage->getDataSize() > 0); mState = DECODE_IMAGE; // fall through } else { + if (!getName().empty()) + { + // failed to load local file, we're done. + return true; + } // need more data mState = LOAD_FROM_NETWORK; // fall through @@ -821,7 +857,7 @@ bool LLTextureFetchWorker::doWork(S32 param) if (mState == DECODE_IMAGE) { - llassert_always(mFormattedImage->getDataSize() > 0); + llassert_always(mFormattedImage.isNull() || mFormattedImage->getDataSize() > 0); setPriority(LLWorkerThread::PRIORITY_LOW | mWorkPriority); // Set priority first since Responder may change it mRawImage = NULL; mAuxImage = NULL; @@ -1273,6 +1309,12 @@ LLTextureFetch::~LLTextureFetch() } bool LLTextureFetch::createRequest(const LLUUID& id, const LLHost& host, F32 priority, + S32 w, S32 h, S32 c, S32 discard, bool needs_aux) +{ + return createRequest(LLString::null, id, host, priority, w, h, c, discard, needs_aux); +} + +bool LLTextureFetch::createRequest(const LLString& filename, const LLUUID& id, const LLHost& host, F32 priority, S32 w, S32 h, S32 c, S32 discard, bool needs_aux) { if (mDebugPause) @@ -1305,13 +1347,13 @@ bool LLTextureFetch::createRequest(const LLUUID& id, const LLHost& host, F32 pri // we really do get it.) desired_size = worker->mFileSize; } - else if ((discard == 0) && worker == NULL) - { - // if we want the entire image, but we don't know its size, then send - // a sentinel value of zero to request the entire contents of the cache. - // patch supplied by resident Sheet Spotter for VWR-2404 - desired_size = 0; - } + //else if ((discard == 0) && worker == NULL) + //{ + // // if we want the entire image, but we don't know its size, then send + // // a sentinel value of zero to request the entire contents of the cache. + // // patch supplied by resident Sheet Spotter for VWR-2404 + // desired_size = 0; + //} else if (w*h*c > 0) { // If the requester knows the dimentions of the image, @@ -1342,7 +1384,16 @@ bool LLTextureFetch::createRequest(const LLUUID& id, const LLHost& host, F32 pri } else { - worker = new LLTextureFetchWorker(this, id, host, priority, discard, desired_size); + if (filename.empty()) + { + // do remote fetch + worker = new LLTextureFetchWorker(this, id, host, priority, discard, desired_size); + } + else + { + // do local file fetch + worker = new LLTextureFetchLocalFileWorker(this, filename, id, host, priority, discard, desired_size); + } mRequestMap[id] = worker; } worker->mActiveCount++; diff --git a/indra/newview/lltexturefetch.h b/indra/newview/lltexturefetch.h index 8ae4f6d420..9f55a4ee92 100644 --- a/indra/newview/lltexturefetch.h +++ b/indra/newview/lltexturefetch.h @@ -55,6 +55,8 @@ public: bool createRequest(const LLUUID& id, const LLHost& host, F32 priority, S32 w, S32 h, S32 c, S32 discard, bool needs_aux); + bool createRequest(const LLString& filename, const LLUUID& id, const LLHost& host, F32 priority, + S32 w, S32 h, S32 c, S32 discard, bool needs_aux); void deleteRequest(const LLUUID& id, bool cancel); bool getRequestFinished(const LLUUID& id, S32& discard_level, LLPointer<LLImageRaw>& raw, LLPointer<LLImageRaw>& aux); diff --git a/indra/newview/lltextureview.cpp b/indra/newview/lltextureview.cpp index b5d4818fba..7f571a1205 100644 --- a/indra/newview/lltextureview.cpp +++ b/indra/newview/lltextureview.cpp @@ -89,9 +89,6 @@ public: { } - virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_TEXTURE_BAR; } - virtual LLString getWidgetTag() const { return LL_TEXTURE_BAR_TAG; } - virtual void draw(); virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); virtual LLRect getRequiredRect(); // Return the height of this object, given the set options. @@ -376,9 +373,6 @@ public: setRect(LLRect(0,0,100,line_height * 4)); } - virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_TEX_MEM_BAR; }; - virtual LLString getWidgetTag() const { return LL_GL_TEX_MEM_BAR_TAG; }; - virtual void draw(); virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); virtual LLRect getRequiredRect(); // Return the height of this object, given the set options. @@ -545,17 +539,6 @@ LLTextureView::~LLTextureView() mGLTexMemBar = 0; } -EWidgetType LLTextureView::getWidgetType() const -{ - return WIDGET_TYPE_TEXTURE_VIEW; -} - -LLString LLTextureView::getWidgetTag() const -{ - return LL_TEXTURE_VIEW_TAG; -} - - typedef std::pair<F32,LLViewerImage*> decode_pair_t; struct compare_decode_pair { @@ -637,7 +620,7 @@ void LLTextureView::draw() if (!mOrderFetch) { #if 1 - if (pri < HIGH_PRIORITY && gSelectMgr) + if (pri < HIGH_PRIORITY && LLSelectMgr::getInstance()) { struct f : public LLSelectedTEFunctor { @@ -649,7 +632,7 @@ void LLTextureView::draw() } } func(imagep); const bool firstonly = true; - bool match = gSelectMgr->getSelection()->applyToTEs(&func, firstonly); + bool match = LLSelectMgr::getInstance()->getSelection()->applyToTEs(&func, firstonly); if (match) { pri += 3*HIGH_PRIORITY; diff --git a/indra/newview/lltextureview.h b/indra/newview/lltextureview.h index 4c5fb1ce68..e6b7b817bb 100644 --- a/indra/newview/lltextureview.h +++ b/indra/newview/lltextureview.h @@ -46,9 +46,6 @@ public: LLTextureView(const std::string& name, const LLRect& rect); ~LLTextureView(); - virtual EWidgetType getWidgetType() const; - virtual LLString getWidgetTag() const; - /*virtual*/ void draw(); /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); diff --git a/indra/newview/lltool.cpp b/indra/newview/lltool.cpp index 48743aeb39..0398b7a0c1 100644 --- a/indra/newview/lltool.cpp +++ b/indra/newview/lltool.cpp @@ -162,7 +162,7 @@ LLTool* LLTool::getOverrideTool(MASK mask) { if (mask & MASK_ALT) { - return gToolCamera; + return LLToolCamera::getInstance(); } return NULL; } diff --git a/indra/newview/lltoolbar.cpp b/indra/newview/lltoolbar.cpp index 0fb7fbba4c..606bc75103 100644 --- a/indra/newview/lltoolbar.cpp +++ b/indra/newview/lltoolbar.cpp @@ -57,7 +57,7 @@ #include "llviewermenu.h" #include "llfirstuse.h" #include "llviewerparcelmgr.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llviewerwindow.h" #include "lltoolgrab.h" #include "llcombobox.h" @@ -158,10 +158,10 @@ BOOL LLToolBar::postBuild() child_iter != getChildList()->end(); ++child_iter) { LLView *view = *child_iter; - if(view->getWidgetType() == WIDGET_TYPE_BUTTON) + LLButton* buttonp = dynamic_cast<LLButton*>(view); + if(buttonp) { - LLButton* btn = (LLButton*)view; - btn->setSoundFlags(LLView::SILENT); + buttonp->setSoundFlags(LLView::SILENT); } } @@ -171,6 +171,8 @@ BOOL LLToolBar::postBuild() LLRect rect(0, 0, RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT); mResizeHandle = new LLFakeResizeHandle(LLString(""), rect, RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT); this->addChildAtEnd(mResizeHandle); + LLLayoutStack* toolbar_stack = getChild<LLLayoutStack>("toolbar_stack"); + toolbar_stack->reshape(toolbar_stack->getRect().getWidth() - RESIZE_HANDLE_WIDTH, toolbar_stack->getRect().getHeight()); } #endif // LL_DARWIN @@ -191,7 +193,7 @@ BOOL LLToolBar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EAcceptance* accept, LLString& tooltip_msg) { - LLButton* inventory_btn = LLUICtrlFactory::getButtonByName(this, "inventory_btn"); + LLButton* inventory_btn = getChild<LLButton>("inventory_btn"); if (!inventory_btn) return FALSE; LLInventoryView* active_inventory = LLInventoryView::getActiveInventory(); @@ -238,19 +240,14 @@ BOOL LLToolBar::visible(void*) void LLToolBar::layoutButtons() { - // Always spans whole window. JC +#if LL_DARWIN const S32 FUDGE_WIDTH_OF_SCREEN = 4; - S32 width = gViewerWindow->getWindowWidth() + FUDGE_WIDTH_OF_SCREEN; - S32 count = getChildCount(); + S32 width = gViewerWindow->getWindowWidth() + FUDGE_WIDTH_OF_SCREEN; S32 pad = 2; -#if LL_DARWIN // this function may be called before postBuild(), in which case mResizeHandle won't have been set up yet. if(mResizeHandle != NULL) { - // a resize handle has been added as a child, increasing the count by one. - count--; - if(!gViewerWindow->getWindow()->getFullscreen()) { // Only when running in windowed mode on the Mac, leave room for a resize widget on the right edge of the bar. @@ -270,51 +267,6 @@ void LLToolBar::layoutButtons() } } #endif // LL_DARWIN - - LLButton* chat_button = LLUICtrlFactory::getButtonByName(this, "chat_btn"); - if (chat_button) - { - width -= chat_button->getRect().getWidth() + pad; - } - - // We actually want to extend "pad" pixels off the right edge of the - // screen, such that the rightmost button is aligned. - S32 segment_width = llround((F32)(width) / ((F32)count - 1.f)); // ignore chat button - S32 btn_width = segment_width - pad; - - // Evenly space all views - S32 height = -1; - S32 i = count - 1; - S32 x = pad; - for (child_list_const_reverse_iter_t child_iter = getChildList()->rbegin(); - child_iter != getChildList()->rend(); ++child_iter) - { - LLView *btn_view = *child_iter; - if(btn_view->getWidgetType() == WIDGET_TYPE_BUTTON || btn_view->getWidgetType() == WIDGET_TYPE_FLYOUT_BUTTON) - { - if (height < 0) - { - height = btn_view->getRect().getHeight(); - } - - LLRect r; - - if (btn_view->getName() == "chat_btn") - { - r.setOriginAndSize(x, 0, btn_view->getRect().getWidth(), height); - x += btn_view->getRect().getWidth() + pad; - } - else - { - r.setOriginAndSize(x, 0, btn_width, height); - x += segment_width; - } - - btn_view->setOrigin(r.mLeft, r.mBottom); - btn_view->reshape(r.getWidth(), r.getHeight()); - i--; - } - } } @@ -338,13 +290,13 @@ void LLToolBar::refresh() childSetEnabled("fly_btn", gAgent.canFly() || gAgent.getFlying() ); - childSetEnabled("build_btn", gParcelMgr->agentCanBuild() ); + childSetEnabled("build_btn", LLViewerParcelMgr::getInstance()->agentCanBuild() ); // Check to see if we're in build mode - BOOL build_mode = gToolMgr->inEdit(); + BOOL build_mode = LLToolMgr::getInstance()->inEdit(); // And not just clicking on a scripted object - if (gToolGrab->getHideBuildHighlight()) + if (LLToolGrab::getInstance()->getHideBuildHighlight()) { build_mode = FALSE; } @@ -355,69 +307,66 @@ void LLToolBar::refresh() void LLToolBar::updateCommunicateList() { - LLFlyoutButton* communicate_button = (LLFlyoutButton*)getChildByName("communicate_btn", TRUE); - if (communicate_button) - { - LLSD selected = communicate_button->getValue(); + LLFlyoutButton* communicate_button = getChild<LLFlyoutButton>("communicate_btn"); + LLSD selected = communicate_button->getValue(); - communicate_button->removeall(); + communicate_button->removeall(); - LLFloater* frontmost_floater = LLFloaterChatterBox::getInstance()->getActiveFloater(); - LLScrollListItem* itemp = NULL; + LLFloater* frontmost_floater = LLFloaterChatterBox::getInstance()->getActiveFloater(); + LLScrollListItem* itemp = NULL; - itemp = communicate_button->add(LLFloaterMyFriends::getInstance()->getShortTitle(), LLSD("contacts"), ADD_TOP); - if (LLFloaterMyFriends::getInstance() == frontmost_floater) + itemp = communicate_button->add(LLFloaterMyFriends::getInstance()->getShortTitle(), LLSD("contacts"), ADD_TOP); + if (LLFloaterMyFriends::getInstance() == frontmost_floater) + { + ((LLScrollListText*)itemp->getColumn(0))->setFontStyle(LLFontGL::BOLD); + // make sure current tab is selected in list + if (selected.isUndefined()) { - ((LLScrollListText*)itemp->getColumn(0))->setFontStyle(LLFontGL::BOLD); - // make sure current tab is selected in list - if (selected.isUndefined()) - { - selected = itemp->getValue(); - } + selected = itemp->getValue(); } - itemp = communicate_button->add(LLFloaterChat::getInstance()->getShortTitle(), LLSD("local chat"), ADD_TOP); - if (LLFloaterChat::getInstance() == frontmost_floater) + } + itemp = communicate_button->add(LLFloaterChat::getInstance()->getShortTitle(), LLSD("local chat"), ADD_TOP); + if (LLFloaterChat::getInstance() == frontmost_floater) + { + ((LLScrollListText*)itemp->getColumn(0))->setFontStyle(LLFontGL::BOLD); + if (selected.isUndefined()) { - ((LLScrollListText*)itemp->getColumn(0))->setFontStyle(LLFontGL::BOLD); - if (selected.isUndefined()) - { - selected = itemp->getValue(); - } + selected = itemp->getValue(); } - communicate_button->addSeparator(ADD_TOP); - communicate_button->add(getUIString("Redock Windows"), LLSD("redock"), ADD_TOP); - communicate_button->addSeparator(ADD_TOP); - communicate_button->add(LLFloaterMute::getInstance()->getShortTitle(), LLSD("mute list"), ADD_TOP); - - std::set<LLHandle<LLFloater> >::const_iterator floater_handle_it; + } + communicate_button->addSeparator(ADD_TOP); + communicate_button->add(getUIString("Redock Windows"), LLSD("redock"), ADD_TOP); + communicate_button->addSeparator(ADD_TOP); + communicate_button->add(LLFloaterMute::getInstance()->getShortTitle(), LLSD("mute list"), ADD_TOP); + + std::set<LLHandle<LLFloater> >::const_iterator floater_handle_it; - if (gIMMgr->getIMFloaterHandles().size() > 0) - { - communicate_button->addSeparator(ADD_TOP); - } + if (gIMMgr->getIMFloaterHandles().size() > 0) + { + communicate_button->addSeparator(ADD_TOP); + } - for(floater_handle_it = gIMMgr->getIMFloaterHandles().begin(); floater_handle_it != gIMMgr->getIMFloaterHandles().end(); ++floater_handle_it) + for(floater_handle_it = gIMMgr->getIMFloaterHandles().begin(); floater_handle_it != gIMMgr->getIMFloaterHandles().end(); ++floater_handle_it) + { + LLFloaterIMPanel* im_floaterp = (LLFloaterIMPanel*)floater_handle_it->get(); + if (im_floaterp) { - LLFloaterIMPanel* im_floaterp = (LLFloaterIMPanel*)floater_handle_it->get(); - if (im_floaterp) + LLString floater_title = im_floaterp->getNumUnreadMessages() > 0 ? "*" : ""; + floater_title.append(im_floaterp->getShortTitle()); + itemp = communicate_button->add(floater_title, im_floaterp->getSessionID(), ADD_TOP); + if (im_floaterp == frontmost_floater) { - LLString floater_title = im_floaterp->getNumUnreadMessages() > 0 ? "*" : ""; - floater_title.append(im_floaterp->getShortTitle()); - itemp = communicate_button->add(floater_title, im_floaterp->getSessionID(), ADD_TOP); - if (im_floaterp == frontmost_floater) + ((LLScrollListText*)itemp->getColumn(0))->setFontStyle(LLFontGL::BOLD); + if (selected.isUndefined()) { - ((LLScrollListText*)itemp->getColumn(0))->setFontStyle(LLFontGL::BOLD); - if (selected.isUndefined()) - { - selected = itemp->getValue(); - } + selected = itemp->getValue(); } } } - - communicate_button->setToggleState(gSavedSettings.getBOOL("ShowCommunicate")); - communicate_button->setValue(selected); } + + communicate_button->setToggleState(gSavedSettings.getBOOL("ShowCommunicate")); + communicate_button->setValue(selected); } @@ -425,7 +374,7 @@ void LLToolBar::updateCommunicateList() void LLToolBar::onClickCommunicate(LLUICtrl* ctrl, void* user_data) { LLToolBar* toolbar = (LLToolBar*)user_data; - LLFlyoutButton* communicate_button = (LLFlyoutButton*)toolbar->getChildByName("communicate_btn", TRUE); + LLFlyoutButton* communicate_button = toolbar->getChild<LLFlyoutButton>("communicate_btn"); LLSD selected_option = communicate_button->getValue(); diff --git a/indra/newview/lltoolbrush.cpp b/indra/newview/lltoolbrush.cpp index d39ce57e56..a15b01ca04 100644 --- a/indra/newview/lltoolbrush.cpp +++ b/indra/newview/lltoolbrush.cpp @@ -62,8 +62,6 @@ const std::string REGION_BLOCKS_TERRAFORM_MSG = "This region does not allow terraforming.\n" "You will need to buy land in another part of the world to terraform it."; -// Globals -LLToolBrushLand *gToolLand = NULL; ///============================================================================ /// Local function declarations, constants, enums, and typedefs @@ -182,12 +180,12 @@ void LLToolBrushLand::modifyLandAtPointGlobal(const LLVector3d &pos_global, void LLToolBrushLand::modifyLandInSelectionGlobal() { - if (gParcelMgr->selectionEmpty()) + if (LLViewerParcelMgr::getInstance()->selectionEmpty()) { return; } - if (gToolMgr->getCurrentTool() == gToolParcel) + if (LLToolMgr::getInstance()->getCurrentTool() == LLToolSelectLand::getInstance()) { // selecting land, don't do anything return; @@ -196,7 +194,7 @@ void LLToolBrushLand::modifyLandInSelectionGlobal() LLVector3d min; LLVector3d max; - gParcelMgr->getSelection(min, max); + LLViewerParcelMgr::getInstance()->getSelection(min, max); S32 radioAction = gSavedSettings.getS32("RadioLandBrushAction"); @@ -306,8 +304,8 @@ void LLToolBrushLand::modifyLandInSelectionGlobal() msg->addF32Fast(_PREHASH_Seconds, seconds); msg->addF32Fast(_PREHASH_Height, mStartingZ); - BOOL parcel_selected = gParcelMgr->getParcelSelection()->getWholeParcelSelected(); - LLParcel* selected_parcel = gParcelMgr->getParcelSelection()->getParcel(); + BOOL parcel_selected = LLViewerParcelMgr::getInstance()->getParcelSelection()->getWholeParcelSelected(); + LLParcel* selected_parcel = LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel(); if (parcel_selected && selected_parcel) { @@ -376,7 +374,7 @@ BOOL LLToolBrushLand::handleMouseDown(S32 x, S32 y, MASK mask) gIdleCallbacks.addFunction( &LLToolBrushLand::onIdle, (void*)this ); setMouseCapture( TRUE ); - gParcelMgr->setSelectionVisible(FALSE); + LLViewerParcelMgr::getInstance()->setSelectionVisible(FALSE); handled = TRUE; } @@ -404,7 +402,7 @@ BOOL LLToolBrushLand::handleMouseUp(S32 x, S32 y, MASK mask) // Release the mouse setMouseCapture( FALSE ); - gParcelMgr->setSelectionVisible(TRUE); + LLViewerParcelMgr::getInstance()->setSelectionVisible(TRUE); gIdleCallbacks.deleteFunction( &LLToolBrushLand::onIdle, (void*)this ); handled = TRUE; @@ -435,7 +433,7 @@ void LLToolBrushLand::handleDeselect() } mLastShowParcelOwners = gSavedSettings.getBOOL("ShowParcelOwners"); gSavedSettings.setBOOL("ShowParcelOwners", mLastShowParcelOwners); - gParcelMgr->setSelectionVisible(TRUE); + LLViewerParcelMgr::getInstance()->setSelectionVisible(TRUE); mBrushSelected = FALSE; } @@ -506,25 +504,25 @@ void LLToolBrushLand::determineAffectedRegions(region_list_t& regions, corner.mdV[VX] -= (LAND_BRUSH_SIZE[mBrushIndex] / 2); corner.mdV[VY] -= (LAND_BRUSH_SIZE[mBrushIndex] / 2); LLViewerRegion* region = NULL; - region = gWorldPointer->getRegionFromPosGlobal(corner); + region = LLWorld::getInstance()->getRegionFromPosGlobal(corner); if(region && regions.find(region) == regions.end()) { regions.insert(region); } corner.mdV[VY] += LAND_BRUSH_SIZE[mBrushIndex]; - region = gWorldPointer->getRegionFromPosGlobal(corner); + region = LLWorld::getInstance()->getRegionFromPosGlobal(corner); if(region && regions.find(region) == regions.end()) { regions.insert(region); } corner.mdV[VX] += LAND_BRUSH_SIZE[mBrushIndex]; - region = gWorldPointer->getRegionFromPosGlobal(corner); + region = LLWorld::getInstance()->getRegionFromPosGlobal(corner); if(region && regions.find(region) == regions.end()) { regions.insert(region); } corner.mdV[VY] -= LAND_BRUSH_SIZE[mBrushIndex]; - region = gWorldPointer->getRegionFromPosGlobal(corner); + region = LLWorld::getInstance()->getRegionFromPosGlobal(corner); if(region && regions.find(region) == regions.end()) { regions.insert(region); @@ -536,7 +534,7 @@ void LLToolBrushLand::onIdle( void* brush_tool ) { LLToolBrushLand* self = reinterpret_cast<LLToolBrushLand*>(brush_tool); - if( gToolMgr->getCurrentTool() == self ) + if( LLToolMgr::getInstance()->getCurrentTool() == self ) { self->brush(); } diff --git a/indra/newview/lltoolbrush.h b/indra/newview/lltoolbrush.h index c46037a8f7..70e34725af 100644 --- a/indra/newview/lltoolbrush.h +++ b/indra/newview/lltoolbrush.h @@ -46,7 +46,7 @@ class LLViewerRegion; // A toolbrush that modifies the land. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLToolBrushLand : public LLTool, public LLEditMenuHandler +class LLToolBrushLand : public LLTool, public LLEditMenuHandler, public LLSingleton<LLToolBrushLand> { typedef std::set<LLViewerRegion*> region_list_t; @@ -103,6 +103,5 @@ protected: region_list_t mLastAffectedRegions; }; -extern LLToolBrushLand *gToolLand; #endif // LL_LLTOOLBRUSH_H diff --git a/indra/newview/lltoolcomp.cpp b/indra/newview/lltoolcomp.cpp index d8f4e55b0e..7865d8efe3 100644 --- a/indra/newview/lltoolcomp.cpp +++ b/indra/newview/lltoolcomp.cpp @@ -46,7 +46,6 @@ #include "lltoolgrab.h" #include "lltoolgun.h" #include "lltoolmgr.h" -#include "lltoolselect.h" #include "lltoolselectrect.h" #include "lltoolplacer.h" #include "llviewermenu.h" @@ -61,14 +60,6 @@ const S32 BUTTON_WIDTH_SMALL = 32; const S32 BUTTON_WIDTH_BIG = 48; const S32 HPAD = 4; -// Globals -LLToolCompInspect *gToolInspect = NULL; -LLToolCompTranslate *gToolTranslate = NULL; -LLToolCompScale *gToolStretch = NULL; -LLToolCompRotate *gToolRotate = NULL; -LLToolCompCreate *gToolCreate = NULL; -LLToolCompGun *gToolGun = NULL; - extern LLControlGroup gSavedSettings; @@ -126,7 +117,7 @@ void LLToolComposite::handleSelect() { if (!gSavedSettings.getBOOL("EditLinkedParts")) { - gSelectMgr->promoteSelectionToRoot(); + LLSelectMgr::getInstance()->promoteSelectionToRoot(); } mCur = mDefault; mCur->handleSelect(); @@ -162,27 +153,27 @@ void LLToolCompInspect::pickCallback(S32 x, S32 y, MASK mask) { LLViewerObject* hit_obj = gViewerWindow->lastObjectHit(); - if (!gToolInspect->mMouseDown) + if (!LLToolCompInspect::getInstance()->mMouseDown) { // fast click on object, but mouse is already up...just do select - gToolInspect->mSelectRect->handleObjectSelection(hit_obj, mask, gSavedSettings.getBOOL("EditLinkedParts"), FALSE); + LLToolCompInspect::getInstance()->mSelectRect->handleObjectSelection(hit_obj, mask, gSavedSettings.getBOOL("EditLinkedParts"), FALSE); return; } if( hit_obj ) { - if (gSelectMgr->getSelection()->getObjectCount()) + if (LLSelectMgr::getInstance()->getSelection()->getObjectCount()) { - LLEditMenuHandler::gEditMenuHandler = gSelectMgr; + LLEditMenuHandler::gEditMenuHandler = LLSelectMgr::getInstance(); } - gToolInspect->setCurrentTool( gToolInspect->mSelectRect ); - gToolInspect->mSelectRect->handleMouseDown( x, y, mask ); + LLToolCompInspect::getInstance()->setCurrentTool( LLToolCompInspect::getInstance()->mSelectRect ); + LLToolCompInspect::getInstance()->mSelectRect->handleMouseDown( x, y, mask ); } else { - gToolInspect->setCurrentTool( gToolInspect->mSelectRect ); - gToolInspect->mSelectRect->handleMouseDown( x, y, mask); + LLToolCompInspect::getInstance()->setCurrentTool( LLToolCompInspect::getInstance()->mSelectRect ); + LLToolCompInspect::getInstance()->mSelectRect->handleMouseDown( x, y, mask); } } @@ -235,41 +226,41 @@ void LLToolCompTranslate::pickCallback(S32 x, S32 y, MASK mask) { LLViewerObject* hit_obj = gViewerWindow->lastObjectHit(); - gToolTranslate->mManip->highlightManipulators(x, y); - if (!gToolTranslate->mMouseDown) + LLToolCompTranslate::getInstance()->mManip->highlightManipulators(x, y); + if (!LLToolCompTranslate::getInstance()->mMouseDown) { // fast click on object, but mouse is already up...just do select - gToolTranslate->mSelectRect->handleObjectSelection(hit_obj, mask, gSavedSettings.getBOOL("EditLinkedParts"), FALSE); + LLToolCompTranslate::getInstance()->mSelectRect->handleObjectSelection(hit_obj, mask, gSavedSettings.getBOOL("EditLinkedParts"), FALSE); return; } - if( hit_obj || gToolTranslate->mManip->getHighlightedPart() != LLManip::LL_NO_PART ) + if( hit_obj || LLToolCompTranslate::getInstance()->mManip->getHighlightedPart() != LLManip::LL_NO_PART ) { - if (gToolTranslate->mManip->getSelection()->getObjectCount()) + if (LLToolCompTranslate::getInstance()->mManip->getSelection()->getObjectCount()) { - LLEditMenuHandler::gEditMenuHandler = gSelectMgr; + LLEditMenuHandler::gEditMenuHandler = LLSelectMgr::getInstance(); } - BOOL can_move = gToolTranslate->mManip->canAffectSelection(); + BOOL can_move = LLToolCompTranslate::getInstance()->mManip->canAffectSelection(); - if( LLManip::LL_NO_PART != gToolTranslate->mManip->getHighlightedPart() && can_move) + if( LLManip::LL_NO_PART != LLToolCompTranslate::getInstance()->mManip->getHighlightedPart() && can_move) { - gToolTranslate->setCurrentTool( gToolTranslate->mManip ); - gToolTranslate->mManip->handleMouseDownOnPart( x, y, mask ); + LLToolCompTranslate::getInstance()->setCurrentTool( LLToolCompTranslate::getInstance()->mManip ); + LLToolCompTranslate::getInstance()->mManip->handleMouseDownOnPart( x, y, mask ); } else { - gToolTranslate->setCurrentTool( gToolTranslate->mSelectRect ); - gToolTranslate->mSelectRect->handleMouseDown( x, y, mask ); + LLToolCompTranslate::getInstance()->setCurrentTool( LLToolCompTranslate::getInstance()->mSelectRect ); + LLToolCompTranslate::getInstance()->mSelectRect->handleMouseDown( x, y, mask ); // *TODO: add toggle to trigger old click-drag functionality - // gToolTranslate->mManip->handleMouseDownOnPart( XY_part, x, y, mask); + // LLToolCompTranslate::getInstance()->mManip->handleMouseDownOnPart( XY_part, x, y, mask); } } else { - gToolTranslate->setCurrentTool( gToolTranslate->mSelectRect ); - gToolTranslate->mSelectRect->handleMouseDown( x, y, mask); + LLToolCompTranslate::getInstance()->setCurrentTool( LLToolCompTranslate::getInstance()->mSelectRect ); + LLToolCompTranslate::getInstance()->mSelectRect->handleMouseDown( x, y, mask); } } @@ -283,11 +274,11 @@ LLTool* LLToolCompTranslate::getOverrideTool(MASK mask) { if (mask == MASK_CONTROL) { - return gToolRotate; + return LLToolCompRotate::getInstance(); } else if (mask == (MASK_CONTROL | MASK_SHIFT)) { - return gToolStretch; + return LLToolCompScale::getInstance(); } return LLToolComposite::getOverrideTool(mask); } @@ -359,36 +350,36 @@ void LLToolCompScale::pickCallback(S32 x, S32 y, MASK mask) { LLViewerObject* hit_obj = gViewerWindow->lastObjectHit(); - gToolStretch->mManip->highlightManipulators(x, y); - if (!gToolStretch->mMouseDown) + LLToolCompScale::getInstance()->mManip->highlightManipulators(x, y); + if (!LLToolCompScale::getInstance()->mMouseDown) { // fast click on object, but mouse is already up...just do select - gToolStretch->mSelectRect->handleObjectSelection(hit_obj, mask, gSavedSettings.getBOOL("EditLinkedParts"), FALSE); + LLToolCompScale::getInstance()->mSelectRect->handleObjectSelection(hit_obj, mask, gSavedSettings.getBOOL("EditLinkedParts"), FALSE); return; } - if( hit_obj || gToolStretch->mManip->getHighlightedPart() != LLManip::LL_NO_PART) + if( hit_obj || LLToolCompScale::getInstance()->mManip->getHighlightedPart() != LLManip::LL_NO_PART) { - if (gToolStretch->mManip->getSelection()->getObjectCount()) + if (LLToolCompScale::getInstance()->mManip->getSelection()->getObjectCount()) { - LLEditMenuHandler::gEditMenuHandler = gSelectMgr; + LLEditMenuHandler::gEditMenuHandler = LLSelectMgr::getInstance(); } - if( LLManip::LL_NO_PART != gToolStretch->mManip->getHighlightedPart() ) + if( LLManip::LL_NO_PART != LLToolCompScale::getInstance()->mManip->getHighlightedPart() ) { - gToolStretch->setCurrentTool( gToolStretch->mManip ); - gToolStretch->mManip->handleMouseDownOnPart( x, y, mask ); + LLToolCompScale::getInstance()->setCurrentTool( LLToolCompScale::getInstance()->mManip ); + LLToolCompScale::getInstance()->mManip->handleMouseDownOnPart( x, y, mask ); } else { - gToolStretch->setCurrentTool( gToolStretch->mSelectRect ); - gToolStretch->mSelectRect->handleMouseDown( x, y, mask ); + LLToolCompScale::getInstance()->setCurrentTool( LLToolCompScale::getInstance()->mSelectRect ); + LLToolCompScale::getInstance()->mSelectRect->handleMouseDown( x, y, mask ); } } else { - gToolStretch->setCurrentTool( gToolStretch->mSelectRect ); - gToolStretch->mCur->handleMouseDown( x, y, mask ); + LLToolCompScale::getInstance()->setCurrentTool( LLToolCompScale::getInstance()->mSelectRect ); + LLToolCompScale::getInstance()->mCur->handleMouseDown( x, y, mask ); } } @@ -402,7 +393,7 @@ LLTool* LLToolCompScale::getOverrideTool(MASK mask) { if (mask == MASK_CONTROL) { - return gToolRotate; + return LLToolCompRotate::getInstance(); } return LLToolComposite::getOverrideTool(mask); @@ -489,8 +480,8 @@ void LLToolCompCreate::pickCallback(S32 x, S32 y, MASK mask) mask = (mask & ~MASK_SHIFT); mask = (mask & ~MASK_CONTROL); - gToolCreate->setCurrentTool( gToolCreate->mSelectRect ); - gToolCreate->mSelectRect->handleMouseDown( x, y, mask); + LLToolCompCreate::getInstance()->setCurrentTool( LLToolCompCreate::getInstance()->mSelectRect ); + LLToolCompCreate::getInstance()->mSelectRect->handleMouseDown( x, y, mask); } BOOL LLToolCompCreate::handleDoubleClick(S32 x, S32 y, MASK mask) @@ -560,35 +551,35 @@ void LLToolCompRotate::pickCallback(S32 x, S32 y, MASK mask) { LLViewerObject* hit_obj = gViewerWindow->lastObjectHit(); - gToolRotate->mManip->highlightManipulators(x, y); - if (!gToolRotate->mMouseDown) + LLToolCompRotate::getInstance()->mManip->highlightManipulators(x, y); + if (!LLToolCompRotate::getInstance()->mMouseDown) { // fast click on object, but mouse is already up...just do select - gToolRotate->mSelectRect->handleObjectSelection(hit_obj, mask, gSavedSettings.getBOOL("EditLinkedParts"), FALSE); + LLToolCompRotate::getInstance()->mSelectRect->handleObjectSelection(hit_obj, mask, gSavedSettings.getBOOL("EditLinkedParts"), FALSE); return; } - if( hit_obj || gToolRotate->mManip->getHighlightedPart() != LLManip::LL_NO_PART) + if( hit_obj || LLToolCompRotate::getInstance()->mManip->getHighlightedPart() != LLManip::LL_NO_PART) { - if (gToolRotate->mManip->getSelection()->getObjectCount()) + if (LLToolCompRotate::getInstance()->mManip->getSelection()->getObjectCount()) { - LLEditMenuHandler::gEditMenuHandler = gSelectMgr; + LLEditMenuHandler::gEditMenuHandler = LLSelectMgr::getInstance(); } - if( LLManip::LL_NO_PART != gToolRotate->mManip->getHighlightedPart() ) + if( LLManip::LL_NO_PART != LLToolCompRotate::getInstance()->mManip->getHighlightedPart() ) { - gToolRotate->setCurrentTool( gToolRotate->mManip ); - gToolRotate->mManip->handleMouseDownOnPart( x, y, mask ); + LLToolCompRotate::getInstance()->setCurrentTool( LLToolCompRotate::getInstance()->mManip ); + LLToolCompRotate::getInstance()->mManip->handleMouseDownOnPart( x, y, mask ); } else { - gToolRotate->setCurrentTool( gToolRotate->mSelectRect ); - gToolRotate->mSelectRect->handleMouseDown( x, y, mask ); + LLToolCompRotate::getInstance()->setCurrentTool( LLToolCompRotate::getInstance()->mSelectRect ); + LLToolCompRotate::getInstance()->mSelectRect->handleMouseDown( x, y, mask ); } } else { - gToolRotate->setCurrentTool( gToolRotate->mSelectRect ); - gToolRotate->mCur->handleMouseDown( x, y, mask ); + LLToolCompRotate::getInstance()->setCurrentTool( LLToolCompRotate::getInstance()->mSelectRect ); + LLToolCompRotate::getInstance()->mCur->handleMouseDown( x, y, mask ); } } @@ -602,7 +593,7 @@ LLTool* LLToolCompRotate::getOverrideTool(MASK mask) { if (mask == (MASK_CONTROL | MASK_SHIFT)) { - return gToolStretch; + return LLToolCompScale::getInstance(); } return LLToolComposite::getOverrideTool(mask); } @@ -671,7 +662,7 @@ BOOL LLToolCompGun::handleHover(S32 x, S32 y, MASK mask) // item selected from context menu. if ( mCur == mNull && !gPopupMenuView->getVisible() ) { - gSelectMgr->deselectAll(); + LLSelectMgr::getInstance()->deselectAll(); setCurrentTool( (LLTool*) mGrab ); } @@ -712,9 +703,9 @@ BOOL LLToolCompGun::handleMouseDown(S32 x, S32 y, MASK mask) // On mousedown, start grabbing gGrabTransientTool = this; - gToolMgr->getCurrentToolset()->selectTool( (LLTool*) mGrab ); + LLToolMgr::getInstance()->getCurrentToolset()->selectTool( (LLTool*) mGrab ); - return gToolGrab->handleMouseDown(x, y, mask); + return LLToolGrab::getInstance()->handleMouseDown(x, y, mask); } @@ -729,9 +720,9 @@ BOOL LLToolCompGun::handleDoubleClick(S32 x, S32 y, MASK mask) // On mousedown, start grabbing gGrabTransientTool = this; - gToolMgr->getCurrentToolset()->selectTool( (LLTool*) mGrab ); + LLToolMgr::getInstance()->getCurrentToolset()->selectTool( (LLTool*) mGrab ); - return gToolGrab->handleDoubleClick(x, y, mask); + return LLToolGrab::getInstance()->handleDoubleClick(x, y, mask); } diff --git a/indra/newview/lltoolcomp.h b/indra/newview/lltoolcomp.h index 5dacfbb7cf..d6ec6032cd 100644 --- a/indra/newview/lltoolcomp.h +++ b/indra/newview/lltoolcomp.h @@ -104,7 +104,7 @@ public: //----------------------------------------------------------------------- // LLToolCompTranslate -class LLToolCompInspect : public LLToolComposite +class LLToolCompInspect : public LLToolComposite, public LLSingleton<LLToolCompInspect> { public: LLToolCompInspect(); @@ -120,7 +120,7 @@ public: //----------------------------------------------------------------------- // LLToolCompTranslate -class LLToolCompTranslate : public LLToolComposite +class LLToolCompTranslate : public LLToolComposite, public LLSingleton<LLToolCompTranslate> { public: LLToolCompTranslate(); @@ -141,7 +141,7 @@ public: //----------------------------------------------------------------------- // LLToolCompScale -class LLToolCompScale : public LLToolComposite +class LLToolCompScale : public LLToolComposite, public LLSingleton<LLToolCompScale> { public: LLToolCompScale(); @@ -163,7 +163,7 @@ public: //----------------------------------------------------------------------- // LLToolCompRotate -class LLToolCompRotate : public LLToolComposite +class LLToolCompRotate : public LLToolComposite, public LLSingleton<LLToolCompRotate> { public: LLToolCompRotate(); @@ -186,7 +186,7 @@ protected: //----------------------------------------------------------------------- // LLToolCompCreate -class LLToolCompCreate : public LLToolComposite +class LLToolCompCreate : public LLToolComposite, public LLSingleton<LLToolCompCreate> { public: LLToolCompCreate(); @@ -211,7 +211,7 @@ class LLToolGun; class LLToolGrab; class LLToolSelect; -class LLToolCompGun : public LLToolComposite +class LLToolCompGun : public LLToolComposite, public LLSingleton<LLToolCompGun> { public: LLToolCompGun(); @@ -234,11 +234,5 @@ protected: LLTool* mNull; }; -extern LLToolCompInspect *gToolInspect; -extern LLToolCompTranslate *gToolTranslate; -extern LLToolCompScale *gToolStretch; -extern LLToolCompRotate *gToolRotate; -extern LLToolCompCreate *gToolCreate; -extern LLToolCompGun *gToolGun; #endif // LL_TOOLCOMP_H diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index 6e72426976..2f937822cf 100644 --- a/indra/newview/lltooldraganddrop.cpp +++ b/indra/newview/lltooldraganddrop.cpp @@ -64,7 +64,6 @@ #include "llworld.h" #include "object_flags.h" -LLToolDragAndDrop *gToolDragAndDrop = NULL; // MAX ITEMS is based on (sizeof(uuid)+2) * count must be < MTUBYTES // or 18 * count < 1200 => count < 1200/18 => 66. I've cut it down a @@ -78,37 +77,6 @@ const char* FOLDER_INCLUDES_ATTACHMENTS_BEING_WORN = // syntactic sugar #define callMemberFunction(object,ptrToMember) ((object).*(ptrToMember)) -/* -const LLUUID MULTI_CONTAINER_TEXTURE("b2181ea2-1937-2ee1-78b8-bf05c43536b7"); -LLUUID CONTAINER_TEXTURES[LLAssetType::AT_COUNT]; - -const char* CONTAINER_TEXTURE_NAMES[LLAssetType::AT_COUNT] = -{ - "container_texture.tga", - "container_sound.tga", - "container_many_things.tga", - "container_landmark.tga", - "container_script.tga", - "container_clothing.tga", - "container_object.tga", - "container_many_things.tga", - "container_many_things.tga", - "container_many_things.tga", - "container_script.tga", - "container_script.tga", - "container_texture.tga", - "container_bodypart.tga", - "container_many_things.tga", - "container_many_things.tga", - "container_many_things.tga", - "container_sound.tga", - "container_texture.tga", - "container_texture.tga", - "container_animation.tga", - "container_gesture.tga" -}; -*/ - class LLNoPreferredType : public LLInventoryCollectFunctor { public: @@ -610,11 +578,7 @@ LLToolDragAndDrop::LLToolDragAndDrop() mDrop(FALSE), mCurItemIndex(0) { - // setup container texture ids - //for (S32 i = 0; i < LLAssetType::AT_COUNT; i++) - //{ - // CONTAINER_TEXTURES[i].set(gViewerArt.getString(CONTAINER_TEXTURE_NAMES[i])); - //} + } void LLToolDragAndDrop::setDragStart(S32 x, S32 y) @@ -650,7 +614,7 @@ void LLToolDragAndDrop::beginDrag(EDragAndDropType type, mObjectID = object_id; setMouseCapture( TRUE ); - gToolMgr->setTransientTool( this ); + LLToolMgr::getInstance()->setTransientTool( this ); mCursor = UI_CURSOR_NO; if((mCargoTypes[0] == DAD_CATEGORY) && ((mSource == SOURCE_AGENT) || (mSource == SOURCE_LIBRARY))) @@ -719,7 +683,7 @@ void LLToolDragAndDrop::beginMultiDrag( mSourceID = source_id; setMouseCapture( TRUE ); - gToolMgr->setTransientTool( this ); + LLToolMgr::getInstance()->setTransientTool( this ); mCursor = UI_CURSOR_NO; if((mSource == SOURCE_AGENT) || (mSource == SOURCE_LIBRARY)) { @@ -766,14 +730,14 @@ void LLToolDragAndDrop::beginMultiDrag( void LLToolDragAndDrop::endDrag() { - gSelectMgr->unhighlightAll(); + LLSelectMgr::getInstance()->unhighlightAll(); setMouseCapture(FALSE); } void LLToolDragAndDrop::onMouseCaptureLost() { // Called whenever the drag ends or if mouse captue is simply lost - gToolMgr->clearTransientTool(); + LLToolMgr::getInstance()->clearTransientTool(); mCargoTypes.clear(); mCargoIDs.clear(); mSource = SOURCE_AGENT; @@ -1045,7 +1009,7 @@ void LLToolDragAndDrop::pickCallback(S32 x, S32 y, MASK mask) S32 hit_face = -1; LLViewerObject* hit_obj = gViewerWindow->lastNonFloraObjectHit(); - gSelectMgr->unhighlightAll(); + LLSelectMgr::getInstance()->unhighlightAll(); // Treat attachments as part of the avatar they are attached to. if (hit_obj) @@ -1055,9 +1019,9 @@ void LLToolDragAndDrop::pickCallback(S32 x, S32 y, MASK mask) LLVOAvatar* avatar = LLVOAvatar::findAvatarFromAttachment( hit_obj ); if( !avatar ) { - gToolDragAndDrop->mLastAccept = ACCEPT_NO; - gToolDragAndDrop->mCursor = UI_CURSOR_NO; - gViewerWindow->getWindow()->setCursor( gToolDragAndDrop->mCursor ); + LLToolDragAndDrop::getInstance()->mLastAccept = ACCEPT_NO; + LLToolDragAndDrop::getInstance()->mCursor = UI_CURSOR_NO; + gViewerWindow->getWindow()->setCursor( LLToolDragAndDrop::getInstance()->mCursor ); return; } @@ -1083,11 +1047,11 @@ void LLToolDragAndDrop::pickCallback(S32 x, S32 y, MASK mask) hit_face = gLastHitNonFloraObjectFace; // if any item being dragged will be applied to the object under our cursor // highlight that object - for (S32 i = 0; i < (S32)gToolDragAndDrop->mCargoIDs.size(); i++) + for (S32 i = 0; i < (S32)LLToolDragAndDrop::getInstance()->mCargoIDs.size(); i++) { - if (gToolDragAndDrop->mCargoTypes[i] != DAD_OBJECT || (mask & MASK_CONTROL)) + if (LLToolDragAndDrop::getInstance()->mCargoTypes[i] != DAD_OBJECT || (mask & MASK_CONTROL)) { - gSelectMgr->highlightObjectAndFamily(hit_obj); + LLSelectMgr::getInstance()->highlightObjectAndFamily(hit_obj); break; } } @@ -1099,78 +1063,78 @@ void LLToolDragAndDrop::pickCallback(S32 x, S32 y, MASK mask) hit_face = -1; } - gToolDragAndDrop->mLastAccept = ACCEPT_YES_MULTI; + LLToolDragAndDrop::getInstance()->mLastAccept = ACCEPT_YES_MULTI; - for (gToolDragAndDrop->mCurItemIndex = 0; gToolDragAndDrop->mCurItemIndex < (S32)gToolDragAndDrop->mCargoIDs.size(); - gToolDragAndDrop->mCurItemIndex++) + for (LLToolDragAndDrop::getInstance()->mCurItemIndex = 0; LLToolDragAndDrop::getInstance()->mCurItemIndex < (S32)LLToolDragAndDrop::getInstance()->mCargoIDs.size(); + LLToolDragAndDrop::getInstance()->mCurItemIndex++) { // Call the right implementation function - gToolDragAndDrop->mLastAccept = (EAcceptance)llmin( - (U32)gToolDragAndDrop->mLastAccept, - (U32)callMemberFunction((*gToolDragAndDrop), - gToolDragAndDrop->sDragAndDrop3d[gToolDragAndDrop->mCargoTypes[gToolDragAndDrop->mCurItemIndex]][target]) + LLToolDragAndDrop::getInstance()->mLastAccept = (EAcceptance)llmin( + (U32)LLToolDragAndDrop::getInstance()->mLastAccept, + (U32)callMemberFunction((*LLToolDragAndDrop::getInstance()), + LLToolDragAndDrop::getInstance()->sDragAndDrop3d[LLToolDragAndDrop::getInstance()->mCargoTypes[LLToolDragAndDrop::getInstance()->mCurItemIndex]][target]) (hit_obj, hit_face, mask, FALSE)); } - if (gToolDragAndDrop->mDrop && (U32)gToolDragAndDrop->mLastAccept >= ACCEPT_YES_COPY_SINGLE) + if (LLToolDragAndDrop::getInstance()->mDrop && (U32)LLToolDragAndDrop::getInstance()->mLastAccept >= ACCEPT_YES_COPY_SINGLE) { // if target allows multi-drop, go ahead and start iteration at beginning of cargo list - if (gToolDragAndDrop->mLastAccept >= ACCEPT_YES_COPY_MULTI) + if (LLToolDragAndDrop::getInstance()->mLastAccept >= ACCEPT_YES_COPY_MULTI) { - gToolDragAndDrop->mCurItemIndex = 0; + LLToolDragAndDrop::getInstance()->mCurItemIndex = 0; } // otherwise start at end, to follow selection rules (last selected item is most current) else { - gToolDragAndDrop->mCurItemIndex = gToolDragAndDrop->mCargoIDs.size() - 1; + LLToolDragAndDrop::getInstance()->mCurItemIndex = LLToolDragAndDrop::getInstance()->mCargoIDs.size() - 1; } - for (; gToolDragAndDrop->mCurItemIndex < (S32)gToolDragAndDrop->mCargoIDs.size(); - gToolDragAndDrop->mCurItemIndex++) + for (; LLToolDragAndDrop::getInstance()->mCurItemIndex < (S32)LLToolDragAndDrop::getInstance()->mCargoIDs.size(); + LLToolDragAndDrop::getInstance()->mCurItemIndex++) { // Call the right implementation function - (U32)callMemberFunction((*gToolDragAndDrop), - gToolDragAndDrop->sDragAndDrop3d[gToolDragAndDrop->mCargoTypes[gToolDragAndDrop->mCurItemIndex]][target]) + (U32)callMemberFunction((*LLToolDragAndDrop::getInstance()), + LLToolDragAndDrop::getInstance()->sDragAndDrop3d[LLToolDragAndDrop::getInstance()->mCargoTypes[LLToolDragAndDrop::getInstance()->mCurItemIndex]][target]) (hit_obj, hit_face, mask, TRUE); } } - switch( gToolDragAndDrop->mLastAccept ) + switch( LLToolDragAndDrop::getInstance()->mLastAccept ) { case ACCEPT_YES_MULTI: - if (gToolDragAndDrop->mCargoIDs.size() > 1) + if (LLToolDragAndDrop::getInstance()->mCargoIDs.size() > 1) { - gToolDragAndDrop->mCursor = UI_CURSOR_ARROWDRAGMULTI; + LLToolDragAndDrop::getInstance()->mCursor = UI_CURSOR_ARROWDRAGMULTI; } else { - gToolDragAndDrop->mCursor = UI_CURSOR_ARROWDRAG; + LLToolDragAndDrop::getInstance()->mCursor = UI_CURSOR_ARROWDRAG; } break; case ACCEPT_YES_SINGLE: - gToolDragAndDrop->mCursor = UI_CURSOR_ARROWDRAG; + LLToolDragAndDrop::getInstance()->mCursor = UI_CURSOR_ARROWDRAG; break; case ACCEPT_NO_LOCKED: - gToolDragAndDrop->mCursor = UI_CURSOR_NOLOCKED; + LLToolDragAndDrop::getInstance()->mCursor = UI_CURSOR_NOLOCKED; break; case ACCEPT_NO: - gToolDragAndDrop->mCursor = UI_CURSOR_NO; + LLToolDragAndDrop::getInstance()->mCursor = UI_CURSOR_NO; break; case ACCEPT_YES_COPY_MULTI: - if (gToolDragAndDrop->mCargoIDs.size() > 1) + if (LLToolDragAndDrop::getInstance()->mCargoIDs.size() > 1) { - gToolDragAndDrop->mCursor = UI_CURSOR_ARROWCOPYMULTI; + LLToolDragAndDrop::getInstance()->mCursor = UI_CURSOR_ARROWCOPYMULTI; } else { - gToolDragAndDrop->mCursor = UI_CURSOR_ARROWCOPY; + LLToolDragAndDrop::getInstance()->mCursor = UI_CURSOR_ARROWCOPY; } break; case ACCEPT_YES_COPY_SINGLE: - gToolDragAndDrop->mCursor = UI_CURSOR_ARROWCOPY; + LLToolDragAndDrop::getInstance()->mCursor = UI_CURSOR_ARROWCOPY; break; case ACCEPT_POSTPONED: break; @@ -1178,10 +1142,10 @@ void LLToolDragAndDrop::pickCallback(S32 x, S32 y, MASK mask) llassert( FALSE ); } - gToolDragAndDrop->mLastHitPos = gLastHitPosGlobal + gLastHitObjectOffset; - gToolDragAndDrop->mLastCameraPos = gAgent.getCameraPositionGlobal(); + LLToolDragAndDrop::getInstance()->mLastHitPos = gLastHitPosGlobal + gLastHitObjectOffset; + LLToolDragAndDrop::getInstance()->mLastCameraPos = gAgent.getCameraPositionGlobal(); - gViewerWindow->getWindow()->setCursor( gToolDragAndDrop->mCursor ); + gViewerWindow->getWindow()->setCursor( LLToolDragAndDrop::getInstance()->mCursor ); } // static @@ -1294,7 +1258,7 @@ void LLToolDragAndDrop::dropTextureAllFaces(LLViewerObject* hit_obj, return; } LLViewerImage* image = gImageList.getImage(asset_id); - gViewerStats->incStat(LLViewerStats::ST_EDIT_TEXTURE_COUNT ); + LLViewerStats::getInstance()->incStat(LLViewerStats::ST_EDIT_TEXTURE_COUNT ); S32 num_faces = hit_obj->getNumTEs(); for( S32 face = 0; face < num_faces; face++ ) { @@ -1337,7 +1301,7 @@ void LLToolDragAndDrop::dropTextureOneFace(LLViewerObject* hit_obj, } // update viewer side image in anticipation of update from simulator LLViewerImage* image = gImageList.getImage(asset_id); - gViewerStats->incStat(LLViewerStats::ST_EDIT_TEXTURE_COUNT ); + LLViewerStats::getInstance()->incStat(LLViewerStats::ST_EDIT_TEXTURE_COUNT ); hit_obj->setTEImage(hit_face, image); dialog_refresh_all(); @@ -1354,8 +1318,8 @@ void LLToolDragAndDrop::dropScript(LLViewerObject* hit_obj, { // *HACK: In order to resolve SL-22177, we need to block drags // from notecards and objects onto other objects. - if((SOURCE_WORLD == gToolDragAndDrop->mSource) - || (SOURCE_NOTECARD == gToolDragAndDrop->mSource)) + if((SOURCE_WORLD == LLToolDragAndDrop::getInstance()->mSource) + || (SOURCE_NOTECARD == LLToolDragAndDrop::getInstance()->mSource)) { llwarns << "Call to LLToolDragAndDrop::dropScript() from world" << " or notecard." << llendl; @@ -1394,7 +1358,7 @@ void LLToolDragAndDrop::dropScript(LLViewerObject* hit_obj, gFloaterTools->dirty(); // VEFFECT: SetScript - LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)gHUDManager->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE); + LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE); effectp->setSourceObject(gAgent.getAvatarObject()); effectp->setTargetObject(hit_obj); effectp->setDuration(LL_HUD_DUR_SHORT); @@ -1407,7 +1371,7 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target, BOOL from_task_inventory, BOOL remove_from_inventory) { - LLViewerRegion* regionp = gWorldp->getRegionFromPosGlobal(mLastHitPos); + LLViewerRegion* regionp = LLWorld::getInstance()->getRegionFromPosGlobal(mLastHitPos); if (!regionp) { llwarns << "Couldn't find region to rez object" << llendl; @@ -1463,7 +1427,7 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target, LLUUID source_id = from_task_inventory ? mSourceID : LLUUID::null; // Select the object only if we're editing. - BOOL rez_selected = gToolMgr->inEdit(); + BOOL rez_selected = LLToolMgr::getInstance()->inEdit(); LLVector3 ray_start = regionp->getPosRegionFromGlobal(mLastCameraPos); @@ -1542,7 +1506,7 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target, // selected object. if (rez_selected) { - gSelectMgr->deselectAll(); + LLSelectMgr::getInstance()->deselectAll(); gViewerWindow->getWindow()->incBusyCount(); } @@ -1556,13 +1520,13 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target, } // VEFFECT: DropObject - LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)gHUDManager->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE); + LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE); effectp->setSourceObject(gAgent.getAvatarObject()); effectp->setPositionGlobal(mLastHitPos); effectp->setDuration(LL_HUD_DUR_SHORT); effectp->setColor(LLColor4U(gAgent.getEffectColor())); - gViewerStats->incStat(LLViewerStats::ST_REZ_COUNT); + LLViewerStats::getInstance()->incStat(LLViewerStats::ST_REZ_COUNT); } void LLToolDragAndDrop::dropInventory(LLViewerObject* hit_obj, @@ -1572,8 +1536,8 @@ void LLToolDragAndDrop::dropInventory(LLViewerObject* hit_obj, { // *HACK: In order to resolve SL-22177, we need to block drags // from notecards and objects onto other objects. - if((SOURCE_WORLD == gToolDragAndDrop->mSource) - || (SOURCE_NOTECARD == gToolDragAndDrop->mSource)) + if((SOURCE_WORLD == LLToolDragAndDrop::getInstance()->mSource) + || (SOURCE_NOTECARD == LLToolDragAndDrop::getInstance()->mSource)) { llwarns << "Call to LLToolDragAndDrop::dropInventory() from world" << " or notecard." << llendl; @@ -1619,7 +1583,7 @@ void LLToolDragAndDrop::dropInventory(LLViewerObject* hit_obj, } // VEFFECT: AddToInventory - LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)gHUDManager->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE); + LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE); effectp->setSourceObject(gAgent.getAvatarObject()); effectp->setTargetObject(hit_obj); effectp->setDuration(LL_HUD_DUR_SHORT); @@ -1723,7 +1687,7 @@ void LLToolDragAndDrop::commitGiveInventoryItem(const LLUUID& to_agent, gAgent.sendReliableMessage(); // VEFFECT: giveInventory - LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)gHUDManager->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE); + LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE); effectp->setSourceObject(gAgent.getAvatarObject()); effectp->setTargetObject(gObjectList.findObject(to_agent)); effectp->setDuration(LL_HUD_DUR_SHORT); @@ -1925,7 +1889,7 @@ void LLToolDragAndDrop::commitGiveInventoryCategory(const LLUUID& to_agent, delete[] bucket; // VEFFECT: giveInventoryCategory - LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)gHUDManager->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE); + LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE); effectp->setSourceObject(gAgent.getAvatarObject()); effectp->setTargetObject(gObjectList.findObject(to_agent)); effectp->setDuration(LL_HUD_DUR_SHORT); @@ -2378,7 +2342,7 @@ EAcceptance LLToolDragAndDrop::dad3dTextureObject( } // VEFFECT: SetTexture - LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)gHUDManager->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE); + LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE); effectp->setSourceObject(gAgent.getAvatarObject()); effectp->setTargetObject(obj); effectp->setDuration(LL_HUD_DUR_SHORT); diff --git a/indra/newview/lltooldraganddrop.h b/indra/newview/lltooldraganddrop.h index 5da4e6300a..b5517c29c1 100644 --- a/indra/newview/lltooldraganddrop.h +++ b/indra/newview/lltooldraganddrop.h @@ -46,7 +46,7 @@ class LLToolDragAndDrop; class LLViewerRegion; class LLVOAvatar; -class LLToolDragAndDrop : public LLTool +class LLToolDragAndDrop : public LLTool, public LLSingleton<LLToolDragAndDrop> { public: LLToolDragAndDrop(); @@ -253,9 +253,6 @@ public: LLInventoryCategory* item); }; -// Singleton -extern LLToolDragAndDrop *gToolDragAndDrop; - // utility functions void pack_permissions_slam(LLMessageSystem* msg, U32 flags, const LLPermissions& perms); diff --git a/indra/newview/lltoolface.cpp b/indra/newview/lltoolface.cpp index 195998229d..0783cd14b7 100644 --- a/indra/newview/lltoolface.cpp +++ b/indra/newview/lltoolface.cpp @@ -47,9 +47,6 @@ #include "llviewerwindow.h" #include "llfloatertools.h" -// Globals -LLToolFace *gToolFace = NULL; - // // Member functions // @@ -65,7 +62,7 @@ LLToolFace::~LLToolFace() BOOL LLToolFace::handleDoubleClick(S32 x, S32 y, MASK mask) { - if (!gSelectMgr->getSelection()->isEmpty()) + if (!LLSelectMgr::getInstance()->getSelection()->isEmpty()) { // You should already have an object selected from the mousedown. // If so, show its properties @@ -111,17 +108,17 @@ void LLToolFace::pickCallback(S32 x, S32 y, MASK mask) if ( !hit_obj->isSelected() ) { // object wasn't selected so add the object and face - gSelectMgr->selectObjectOnly(hit_obj, hit_face); + LLSelectMgr::getInstance()->selectObjectOnly(hit_obj, hit_face); } - else if (!gSelectMgr->getSelection()->contains(hit_obj, hit_face) ) + else if (!LLSelectMgr::getInstance()->getSelection()->contains(hit_obj, hit_face) ) { // object is selected, but not this face, so add it. - gSelectMgr->addAsIndividual(hit_obj, hit_face); + LLSelectMgr::getInstance()->addAsIndividual(hit_obj, hit_face); } else { // object is selected, as is this face, so remove the face. - gSelectMgr->remove(hit_obj, hit_face); + LLSelectMgr::getInstance()->remove(hit_obj, hit_face); // BUG: If you remove the last face, the simulator won't know about it. } @@ -130,15 +127,15 @@ void LLToolFace::pickCallback(S32 x, S32 y, MASK mask) { // clicked without modifiers, select only // this face - gSelectMgr->deselectAll(); - gSelectMgr->selectObjectOnly(hit_obj, hit_face); + LLSelectMgr::getInstance()->deselectAll(); + LLSelectMgr::getInstance()->selectObjectOnly(hit_obj, hit_face); } } else { if (!(mask == MASK_SHIFT)) { - gSelectMgr->deselectAll(); + LLSelectMgr::getInstance()->deselectAll(); } } } @@ -147,14 +144,14 @@ void LLToolFace::pickCallback(S32 x, S32 y, MASK mask) void LLToolFace::handleSelect() { // From now on, draw faces - gSelectMgr->setTEMode(TRUE); + LLSelectMgr::getInstance()->setTEMode(TRUE); } void LLToolFace::handleDeselect() { // Stop drawing faces - gSelectMgr->setTEMode(FALSE); + LLSelectMgr::getInstance()->setTEMode(FALSE); } diff --git a/indra/newview/lltoolface.h b/indra/newview/lltoolface.h index c752498125..f573bfa9c5 100644 --- a/indra/newview/lltoolface.h +++ b/indra/newview/lltoolface.h @@ -37,7 +37,7 @@ class LLViewerObject; class LLToolFace -: public LLTool +: public LLTool, public LLSingleton<LLToolFace> { public: LLToolFace(); @@ -52,6 +52,4 @@ public: static void pickCallback(S32 x, S32 y, MASK mask); }; -extern LLToolFace *gToolFace; - #endif diff --git a/indra/newview/lltoolfocus.cpp b/indra/newview/lltoolfocus.cpp index 6d33a9c2bc..e2985a0141 100644 --- a/indra/newview/lltoolfocus.cpp +++ b/indra/newview/lltoolfocus.cpp @@ -50,7 +50,6 @@ #include "llselectmgr.h" #include "llstatusbar.h" #include "lltoolmgr.h" -#include "lltoolselect.h" #include "llviewercamera.h" #include "llviewerobject.h" #include "llviewerwindow.h" @@ -58,9 +57,9 @@ #include "llmorphview.h" // Globals -LLToolCamera *gToolCamera = NULL; BOOL gCameraBtnOrbit = FALSE; BOOL gCameraBtnPan = FALSE; + const S32 SLOP_RANGE = 4; const F32 FOCUS_OFFSET_FACTOR = 1.f; @@ -133,13 +132,13 @@ BOOL LLToolCamera::handleMouseDown(S32 x, S32 y, MASK mask) void LLToolCamera::pickCallback(S32 x, S32 y, MASK mask) { - if (!gToolCamera->hasMouseCapture()) + if (!LLToolCamera::getInstance()->hasMouseCapture()) { return; } - gToolCamera->mMouseDownX = x; - gToolCamera->mMouseDownY = y; + LLToolCamera::getInstance()->mMouseDownX = x; + LLToolCamera::getInstance()->mMouseDownY = y; gViewerWindow->moveCursorToCenter(); @@ -149,17 +148,17 @@ void LLToolCamera::pickCallback(S32 x, S32 y, MASK mask) // Check for hit the sky, or some other invalid point if (!hit_obj && gLastHitPosGlobal.isExactlyZero()) { - gToolCamera->mValidClickPoint = FALSE; + LLToolCamera::getInstance()->mValidClickPoint = FALSE; return; } // check for hud attachments if (hit_obj && hit_obj->isHUDAttachment()) { - LLObjectSelectionHandle selection = gSelectMgr->getSelection(); + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); if (!selection->getObjectCount() || selection->getSelectType() != SELECT_TYPE_HUD) { - gToolCamera->mValidClickPoint = FALSE; + LLToolCamera::getInstance()->mValidClickPoint = FALSE; return; } } @@ -185,7 +184,7 @@ void LLToolCamera::pickCallback(S32 x, S32 y, MASK mask) if( !good_customize_avatar_hit ) { - gToolCamera->mValidClickPoint = FALSE; + LLToolCamera::getInstance()->mValidClickPoint = FALSE; return; } @@ -196,7 +195,7 @@ void LLToolCamera::pickCallback(S32 x, S32 y, MASK mask) } //RN: check to see if this is mouse-driving as opposed to ALT-zoom or Focus tool else if (mask & MASK_ALT || - (gToolMgr->getCurrentTool()->getName() == "Camera")) + (LLToolMgr::getInstance()->getCurrentTool()->getName() == "Camera")) { LLViewerObject* hit_obj = gViewerWindow->lastObjectHit(); if (hit_obj) @@ -224,19 +223,19 @@ void LLToolCamera::pickCallback(S32 x, S32 y, MASK mask) (hit_obj == gAgent.getAvatarObject() || (hit_obj && hit_obj->isAttachment() && LLVOAvatar::findAvatarFromAttachment(hit_obj)->mIsSelf))) { - gToolCamera->mMouseSteering = TRUE; + LLToolCamera::getInstance()->mMouseSteering = TRUE; } } - gToolCamera->mValidClickPoint = TRUE; + LLToolCamera::getInstance()->mValidClickPoint = TRUE; if( CAMERA_MODE_CUSTOMIZE_AVATAR == gAgent.getCameraMode() ) { gAgent.setFocusOnAvatar(FALSE, FALSE); LLVector3d cam_pos = gAgent.getCameraPositionGlobal(); - cam_pos -= LLVector3d(gCamera->getLeftAxis() * gAgent.calcCustomizeAvatarUIOffset( cam_pos )); + cam_pos -= LLVector3d(LLViewerCamera::getInstance()->getLeftAxis() * gAgent.calcCustomizeAvatarUIOffset( cam_pos )); gAgent.setCameraPosAndFocusGlobal( cam_pos, gLastHitObjectOffset + gLastHitPosGlobal, gLastHitObjectID); } @@ -255,7 +254,7 @@ void LLToolCamera::releaseMouse() gViewerWindow->showCursor(); - gToolMgr->clearTransientTool(); + LLToolMgr::getInstance()->clearTransientTool(); mMouseSteering = FALSE; mValidClickPoint = FALSE; @@ -279,7 +278,7 @@ BOOL LLToolCamera::handleMouseUp(S32 x, S32 y, MASK mask) { LLCoordGL mouse_pos; LLVector3 focus_pos = gAgent.getPosAgentFromGlobal(gAgent.getFocusGlobal()); - BOOL success = gCamera->projectPosAgentToScreen(focus_pos, mouse_pos); + BOOL success = LLViewerCamera::getInstance()->projectPosAgentToScreen(focus_pos, mouse_pos); if (success) { LLUI::setCursorPositionScreen(mouse_pos.mX, mouse_pos.mY); diff --git a/indra/newview/lltoolfocus.h b/indra/newview/lltoolfocus.h index ff2e6905f2..71df8078e6 100644 --- a/indra/newview/lltoolfocus.h +++ b/indra/newview/lltoolfocus.h @@ -35,7 +35,7 @@ #include "lltool.h" class LLToolCamera -: public LLTool +: public LLTool, public LLSingleton<LLToolCamera> { public: LLToolCamera(); @@ -75,8 +75,6 @@ protected: }; -extern LLToolCamera *gToolCamera; - extern BOOL gCameraBtnOrbit; extern BOOL gCameraBtnPan; diff --git a/indra/newview/lltoolgrab.cpp b/indra/newview/lltoolgrab.cpp index 3f19ed4330..94501507ab 100644 --- a/indra/newview/lltoolgrab.cpp +++ b/indra/newview/lltoolgrab.cpp @@ -69,7 +69,6 @@ const S32 SLOP_DIST_SQ = 4; BOOL gGrabBtnVertical = FALSE; BOOL gGrabBtnSpin = FALSE; LLTool* gGrabTransientTool = NULL; -LLToolGrab *gToolGrab = NULL; extern BOOL gDebugClicks; // @@ -151,26 +150,26 @@ void LLToolGrab::pickCallback(S32 x, S32 y, MASK mask) BOOL extend_select = (mask & MASK_SHIFT); - if (!extend_select && !gSelectMgr->getSelection()->isEmpty()) + if (!extend_select && !LLSelectMgr::getInstance()->getSelection()->isEmpty()) { - gSelectMgr->deselectAll(); - gToolGrab->mDeselectedThisClick = TRUE; + LLSelectMgr::getInstance()->deselectAll(); + LLToolGrab::getInstance()->mDeselectedThisClick = TRUE; } else { - gToolGrab->mDeselectedThisClick = FALSE; + LLToolGrab::getInstance()->mDeselectedThisClick = FALSE; } // if not over object, do nothing if (!objectp) { - gToolGrab->setMouseCapture(TRUE); - gToolGrab->mMode = GRAB_NOOBJECT; - gToolGrab->mHitObjectID.setNull(); + LLToolGrab::getInstance()->setMouseCapture(TRUE); + LLToolGrab::getInstance()->mMode = GRAB_NOOBJECT; + LLToolGrab::getInstance()->mHitObjectID.setNull(); } else { - gToolGrab->handleObjectHit(objectp, x, y, mask); + LLToolGrab::getInstance()->handleObjectHit(objectp, x, y, mask); } } @@ -273,7 +272,7 @@ BOOL LLToolGrab::handleObjectHit(LLViewerObject *objectp, S32 x, S32 y, MASK mas startSpin(); } - gSelectMgr->updateSelectionCenter(); // update selection beam + LLSelectMgr::getInstance()->updateSelectionCenter(); // update selection beam // update point at LLViewerObject *edit_object = gObjectList.findObject(mHitObjectID); @@ -505,7 +504,7 @@ void LLToolGrab::handleHoverActive(S32 x, S32 y, MASK mask) LLQuaternion rotation_around_vertical( dx*RADIANS_PER_PIXEL_X, up ); // y motion maps to rotation around left axis - const LLVector3 &agent_left = gCamera->getLeftAxis(); + const LLVector3 &agent_left = LLViewerCamera::getInstance()->getLeftAxis(); LLQuaternion rotation_around_left( dy*RADIANS_PER_PIXEL_Y, agent_left ); // compose with current rotation @@ -530,14 +529,14 @@ void LLToolGrab::handleHoverActive(S32 x, S32 y, MASK mask) //------------------------------------------------------ LLVector3d x_part; - x_part.setVec(gCamera->getLeftAxis()); + x_part.setVec(LLViewerCamera::getInstance()->getLeftAxis()); x_part.mdV[VZ] = 0.0; x_part.normVec(); LLVector3d y_part; if( mVerticalDragging ) { - y_part.setVec(gCamera->getUpAxis()); + y_part.setVec(LLViewerCamera::getInstance()->getUpAxis()); // y_part.setVec(0.f, 0.f, 1.f); } else @@ -579,7 +578,7 @@ void LLToolGrab::handleHoverActive(S32 x, S32 y, MASK mask) */ // Don't let object centers go underground. - F32 land_height = gWorldPointer->resolveLandHeightGlobal(grab_point_global); + F32 land_height = LLWorld::getInstance()->resolveLandHeightGlobal(grab_point_global); if (grab_point_global.mdV[VZ] < land_height) { @@ -592,7 +591,7 @@ void LLToolGrab::handleHoverActive(S32 x, S32 y, MASK mask) grab_point_global.mdV[VZ] = MAX_OBJECT_Z; } - grab_point_global = gWorldp->clipToVisibleRegions(mDragStartPointGlobal, grab_point_global); + grab_point_global = LLWorld::getInstance()->clipToVisibleRegions(mDragStartPointGlobal, grab_point_global); // propagate constrained grab point back to grab offset mGrabHiddenOffsetFromCamera = grab_point_global - gAgent.getCameraPositionGlobal(); @@ -600,7 +599,7 @@ void LLToolGrab::handleHoverActive(S32 x, S32 y, MASK mask) LLVector3 grab_pos_agent = gAgent.getPosAgentFromGlobal( grab_point_global ); LLCoordGL grab_center_gl( gViewerWindow->getWindowWidth() / 2, gViewerWindow->getWindowHeight() / 2); - gCamera->projectPosAgentToScreen(grab_pos_agent, grab_center_gl); + LLViewerCamera::getInstance()->projectPosAgentToScreen(grab_pos_agent, grab_center_gl); const S32 ROTATE_H_MARGIN = gViewerWindow->getWindowWidth() / 20; const F32 ROTATE_ANGLE_PER_SECOND = 30.f * DEG_TO_RAD; @@ -652,7 +651,7 @@ void LLToolGrab::handleHoverActive(S32 x, S32 y, MASK mask) gViewerWindow->moveCursorToCenter(); - gSelectMgr->updateSelectionCenter(); + LLSelectMgr::getInstance()->updateSelectionCenter(); } @@ -804,7 +803,7 @@ void LLToolGrab::onMouseCaptureLost() LLVector3 grab_point_agent = mGrabObject->getRenderPosition(); LLCoordGL gl_point; - if (gCamera->projectPosAgentToScreen(grab_point_agent, gl_point)) + if (LLViewerCamera::getInstance()->projectPosAgentToScreen(grab_point_agent, gl_point)) { LLUI::setCursorPositionScreen(gl_point.mX, gl_point.mY); } @@ -826,7 +825,7 @@ void LLToolGrab::onMouseCaptureLost() mGrabObject = NULL; - gSelectMgr->updateSelectionCenter(); + LLSelectMgr::getInstance()->updateSelectionCenter(); gAgent.setPointAt(POINTAT_TARGET_CLEAR); gAgent.setLookAt(LOOKAT_TARGET_CLEAR); diff --git a/indra/newview/lltoolgrab.h b/indra/newview/lltoolgrab.h index af0c7ded64..d744c495a5 100644 --- a/indra/newview/lltoolgrab.h +++ b/indra/newview/lltoolgrab.h @@ -42,7 +42,7 @@ class LLView; class LLTextBox; class LLViewerObject; -class LLToolGrab : public LLTool +class LLToolGrab : public LLTool, public LLSingleton<LLToolGrab> { public: LLToolGrab( LLToolComposite* composite = NULL ); @@ -125,8 +125,6 @@ private: BOOL mHideBuildHighlight; }; -extern LLToolGrab *gToolGrab; - extern BOOL gGrabBtnVertical; extern BOOL gGrabBtnSpin; extern LLTool* gGrabTransientTool; diff --git a/indra/newview/lltoolgun.cpp b/indra/newview/lltoolgun.cpp index 9c8bb97343..134188e2f6 100644 --- a/indra/newview/lltoolgun.cpp +++ b/indra/newview/lltoolgun.cpp @@ -51,7 +51,6 @@ LLToolGun::LLToolGun( LLToolComposite* composite ) : LLTool( "gun", composite ) { - mCrosshairImg = gImageList.getImage( LLUUID( gSavedSettings.getString("UIImgCrosshairsUUID") ), MIPMAP_FALSE, TRUE ); } void LLToolGun::handleSelect() @@ -71,9 +70,9 @@ void LLToolGun::handleDeselect() BOOL LLToolGun::handleMouseDown(S32 x, S32 y, MASK mask) { gGrabTransientTool = this; - gToolMgr->getCurrentToolset()->selectTool( gToolGrab ); + LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolGrab::getInstance() ); - return gToolGrab->handleMouseDown(x, y, mask); + return LLToolGrab::getInstance()->handleMouseDown(x, y, mask); } BOOL LLToolGun::handleHover(S32 x, S32 y, MASK mask) @@ -107,9 +106,9 @@ BOOL LLToolGun::handleHover(S32 x, S32 y, MASK mask) if (gSavedSettings.getBOOL("MouseSun")) { - gSky.setSunDirection(gCamera->getAtAxis(), LLVector3(0.f, 0.f, 0.f)); + gSky.setSunDirection(LLViewerCamera::getInstance()->getAtAxis(), LLVector3(0.f, 0.f, 0.f)); gSky.setOverrideSun(TRUE); - gSavedSettings.setVector3("SkySunDefaultPosition", gCamera->getAtAxis()); + gSavedSettings.setVector3("SkySunDefaultPosition", LLViewerCamera::getInstance()->getAtAxis()); } gViewerWindow->moveCursorToCenter(); @@ -133,9 +132,9 @@ void LLToolGun::draw() { if( gSavedSettings.getBOOL("ShowCrosshairs") ) { - gl_draw_image( - ( gViewerWindow->getWindowWidth() - mCrosshairImg->getWidth() ) / 2, - ( gViewerWindow->getWindowHeight() - mCrosshairImg->getHeight() ) / 2, - mCrosshairImg ); + LLUIImagePtr crosshair = LLUI::getUIImage("UIImgCrosshairsUUID"); + crosshair->draw( + ( gViewerWindow->getWindowWidth() - crosshair->getWidth() ) / 2, + ( gViewerWindow->getWindowHeight() - crosshair->getHeight() ) / 2); } } diff --git a/indra/newview/lltoolgun.h b/indra/newview/lltoolgun.h index 14cc502441..19b02a1214 100644 --- a/indra/newview/lltoolgun.h +++ b/indra/newview/lltoolgun.h @@ -33,7 +33,7 @@ #define LL_TOOLGUN_H #include "lltool.h" -#include "llviewerimage.h" +#include "llui.h" class LLToolGun : public LLTool @@ -51,9 +51,6 @@ public: virtual LLTool* getOverrideTool(MASK mask) { return NULL; } virtual BOOL clipMouseWhenDown() { return FALSE; } - -private: - LLPointer<LLViewerImage> mCrosshairImg; }; #endif diff --git a/indra/newview/lltoolindividual.cpp b/indra/newview/lltoolindividual.cpp index 3ec6b7d4d3..0236a5027a 100644 --- a/indra/newview/lltoolindividual.cpp +++ b/indra/newview/lltoolindividual.cpp @@ -49,7 +49,6 @@ /// Globals ///---------------------------------------------------------------------------- -LLToolIndividual* gToolIndividual = NULL; ///---------------------------------------------------------------------------- /// Local function declarations, constants, enums, and typedefs @@ -80,16 +79,16 @@ BOOL LLToolIndividual::handleMouseDown(S32 x, S32 y, MASK mask) void LLToolIndividual::pickCallback(S32 x, S32 y, MASK mask) { LLViewerObject* obj = gViewerWindow->lastObjectHit(); - gSelectMgr->deselectAll(); + LLSelectMgr::getInstance()->deselectAll(); if(obj) { - gSelectMgr->selectObjectOnly(obj); + LLSelectMgr::getInstance()->selectObjectOnly(obj); } } BOOL LLToolIndividual::handleDoubleClick(S32 x, S32 y, MASK mask) { - if(!gSelectMgr->getSelection()->isEmpty()) + if(!LLSelectMgr::getInstance()->getSelection()->isEmpty()) { // You should already have an object selected from the mousedown. // If so, show its inventory. @@ -109,11 +108,11 @@ BOOL LLToolIndividual::handleDoubleClick(S32 x, S32 y, MASK mask) void LLToolIndividual::handleSelect() { const BOOL children_ok = TRUE; - LLViewerObject* obj = gSelectMgr->getSelection()->getFirstRootObject(children_ok); - gSelectMgr->deselectAll(); + LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject(children_ok); + LLSelectMgr::getInstance()->deselectAll(); if(obj) { - gSelectMgr->selectObjectOnly(obj); + LLSelectMgr::getInstance()->selectObjectOnly(obj); } } diff --git a/indra/newview/lltoolindividual.h b/indra/newview/lltoolindividual.h index e5636dd031..48a2365363 100644 --- a/indra/newview/lltoolindividual.h +++ b/indra/newview/lltoolindividual.h @@ -40,7 +40,7 @@ // A tool to select individual objects rather than linked sets. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLToolIndividual : public LLTool +class LLToolIndividual : public LLTool, public LLSingleton<LLToolIndividual> { public: LLToolIndividual(); @@ -58,7 +58,5 @@ protected: }; -extern LLToolIndividual* gToolIndividual; - #endif // LL_LLTOOLINDIVIDUAL_H diff --git a/indra/newview/lltoolmgr.cpp b/indra/newview/lltoolmgr.cpp index c365f14674..b20d4f9d28 100644 --- a/indra/newview/lltoolmgr.cpp +++ b/indra/newview/lltoolmgr.cpp @@ -46,13 +46,10 @@ #include "lltoolmorph.h" #include "lltoolpie.h" #include "lltoolplacer.h" -#include "lltoolselect.h" #include "lltoolselectland.h" #include "lltoolobjpicker.h" #include "lltoolpipette.h" -// Globals (created and destroyed by LLAgent) -LLToolMgr* gToolMgr = NULL; // Used when app not active to avoid processing hover. LLTool* gToolNull = NULL; @@ -87,179 +84,34 @@ LLToolMgr::LLToolMgr() void LLToolMgr::initTools() { - // Initialize all the tools - // Variables that are reused for each tool - LLTool* tool = NULL; - - // - // Pie tool (not visible in UI, implicit) - // - gToolPie = new LLToolPie(); - - gBasicToolset->addTool( gToolPie ); -// gCameraToolset->addTool( gToolPie ); -// gLandToolset->addTool( gToolPie ); - - // Camera tool - gToolCamera = new LLToolCamera(); - gBasicToolset ->addTool( gToolCamera ); - gCameraToolset->addTool( gToolCamera ); - - // - // Grab tool - // - gToolGrab = new LLToolGrab(); - tool = gToolGrab; - - gBasicToolset->addTool( tool ); - - // - // Translation tool - // - gToolTranslate = new LLToolCompTranslate(); - tool = gToolTranslate; - - gBasicToolset->addTool( tool ); - - // - // Scale ("Stretch") tool - // - gToolStretch = new LLToolCompScale(); - tool = gToolStretch; - - - // - // Rotation tool - // - gToolRotate = new LLToolCompRotate(); - tool = gToolRotate; - - - // - // Face tool - // - gToolFace = new LLToolFace(); - tool = gToolFace; - - // - // Pipette tool - // - gToolPipette = new LLToolPipette(); - - // - // Individual object selector - // - gToolIndividual = new LLToolIndividual(); - - - // - // Create object tool - // - gToolCreate = new LLToolCompCreate(); - tool = gToolCreate; - - gBasicToolset->addTool( tool ); - - // - // Land brush tool - // - gToolLand = new LLToolBrushLand(); - tool = gToolLand; - - gBasicToolset->addTool( tool ); - - - // - // Land select tool - // - gToolParcel = new LLToolSelectLand(); - tool = gToolParcel; - - // - // Gun tool - // - gToolGun = new LLToolCompGun(); - gMouselookToolset->addTool( gToolGun ); - - // - // Inspect tool - // - gToolInspect = new LLToolCompInspect(); - gBasicToolset->addTool( gToolInspect ); - - // - // Face edit tool - // -// gToolMorph = new LLToolMorph(); -// gFaceEditToolset->addTool( gToolMorph ); - gFaceEditToolset->addTool( gToolCamera ); - - // Drag and drop tool - gToolDragAndDrop = new LLToolDragAndDrop(); - - gToolObjPicker = new LLToolObjPicker(); + static BOOL initialized = FALSE; + if(initialized) + { + return; + } + initialized = TRUE; + gBasicToolset->addTool( LLToolPie::getInstance() ); + gBasicToolset->addTool( LLToolCamera::getInstance() ); + gCameraToolset->addTool( LLToolCamera::getInstance() ); + gBasicToolset->addTool( LLToolGrab::getInstance() ); + gBasicToolset->addTool( LLToolCompTranslate::getInstance() ); + gBasicToolset->addTool( LLToolCompCreate::getInstance() ); + gBasicToolset->addTool( LLToolBrushLand::getInstance() ); + gMouselookToolset->addTool( LLToolCompGun::getInstance() ); + gBasicToolset->addTool( LLToolCompInspect::getInstance() ); + gFaceEditToolset->addTool( LLToolCamera::getInstance() ); // On startup, use "select" tool setCurrentToolset(gBasicToolset); - gBasicToolset->selectTool( gToolPie ); + + gBasicToolset->selectTool( LLToolPie::getInstance() ); } LLToolMgr::~LLToolMgr() { - delete gToolPie; - gToolPie = NULL; - - delete gToolInspect; - gToolInspect = NULL; - - delete gToolGun; - gToolGun = NULL; - - delete gToolCamera; - gToolCamera = NULL; - -// delete gToolMorph; -// gToolMorph = NULL; - - delete gToolDragAndDrop; - gToolDragAndDrop = NULL; - delete gBasicToolset; gBasicToolset = NULL; - delete gToolGrab; - gToolGrab = NULL; - - delete gToolRotate; - gToolRotate = NULL; - - delete gToolTranslate; - gToolTranslate = NULL; - - delete gToolStretch; - gToolStretch = NULL; - - delete gToolIndividual; - gToolIndividual = NULL; - - delete gToolPipette; - gToolPipette = NULL; - - delete gToolCreate; - gToolCreate = NULL; - - delete gToolFace; - gToolFace = NULL; - - delete gToolLand; - gToolLand = NULL; - - delete gToolParcel; - gToolParcel = NULL; - - delete gToolObjPicker; - gToolObjPicker = NULL; - delete gMouselookToolset; gMouselookToolset = NULL; @@ -372,7 +224,7 @@ void LLToolMgr::updateToolStatus() BOOL LLToolMgr::inEdit() { - return mBaseTool != gToolPie && mBaseTool != gToolNull; + return mBaseTool != LLToolPie::getInstance() && mBaseTool != gToolNull; } void LLToolMgr::setTransientTool(LLTool* tool) @@ -449,7 +301,7 @@ void LLToolset::addTool(LLTool* tool) void LLToolset::selectTool(LLTool* tool) { mSelectedTool = tool; - gToolMgr->setCurrentTool( mSelectedTool ); + LLToolMgr::getInstance()->setCurrentTool( mSelectedTool ); } @@ -459,7 +311,7 @@ void LLToolset::selectToolByIndex( S32 index ) if (tool) { mSelectedTool = tool; - gToolMgr->setCurrentTool( tool ); + LLToolMgr::getInstance()->setCurrentTool( tool ); } } @@ -473,10 +325,7 @@ BOOL LLToolset::isToolSelected( S32 index ) void LLToolset::selectFirstTool() { mSelectedTool = (0 < mToolList.size()) ? mToolList[0] : NULL; - if (gToolMgr) - { - gToolMgr->setCurrentTool( mSelectedTool ); - } + LLToolMgr::getInstance()->setCurrentTool( mSelectedTool ); } @@ -497,7 +346,7 @@ void LLToolset::selectNextTool() if( next ) { mSelectedTool = next; - gToolMgr->setCurrentTool( mSelectedTool ); + LLToolMgr::getInstance()->setCurrentTool( mSelectedTool ); } else { @@ -522,17 +371,16 @@ void LLToolset::selectPrevTool() if( prev ) { mSelectedTool = prev; - gToolMgr->setCurrentTool( mSelectedTool ); + LLToolMgr::getInstance()->setCurrentTool( mSelectedTool ); } else if (mToolList.size() > 0) { selectToolByIndex((S32)mToolList.size()-1); } - } void select_tool( void *tool_pointer ) { LLTool *tool = (LLTool *)tool_pointer; - gToolMgr->getCurrentToolset()->selectTool( tool ); + LLToolMgr::getInstance()->getCurrentToolset()->selectTool( tool ); } diff --git a/indra/newview/lltoolmgr.h b/indra/newview/lltoolmgr.h index c1e144b252..73b8a38c57 100644 --- a/indra/newview/lltoolmgr.h +++ b/indra/newview/lltoolmgr.h @@ -45,7 +45,7 @@ const MASK MASK_ORBIT = MASK_CONTROL; const MASK MASK_PAN = MASK_CONTROL | MASK_SHIFT; const MASK MASK_COPY = MASK_SHIFT; -class LLToolMgr +class LLToolMgr : public LLSingleton<LLToolMgr> { public: LLToolMgr(); @@ -115,8 +115,7 @@ protected: void select_tool(void *tool); -// Globals (created and destroyed by LLViewerWindow) -extern LLToolMgr* gToolMgr; +// Globals extern LLToolset* gBasicToolset; extern LLToolset *gCameraToolset; diff --git a/indra/newview/lltoolmorph.cpp b/indra/newview/lltoolmorph.cpp index 25d20f96aa..265d1082d1 100644 --- a/indra/newview/lltoolmorph.cpp +++ b/indra/newview/lltoolmorph.cpp @@ -64,7 +64,6 @@ #include "llvoavatar.h" #include "pipeline.h" -//LLToolMorph *gToolMorph = NULL; //static LLVisualParamHint::instance_list_t LLVisualParamHint::sInstances; @@ -94,9 +93,7 @@ LLVisualParamHint::LLVisualParamHint( mLastParamWeight(0.f) { LLVisualParamHint::sInstances.insert( this ); - LLUUID id; - id.set( gViewerArt.getString("avatar_thumb_bkgrnd.tga") ); - mBackgroundp = gImageList.getImage(id, FALSE, TRUE); + mBackgroundp = LLUI::getUIImage("avatar_thumb_bkgrnd.j2c"); llassert(width != 0); @@ -180,10 +177,7 @@ BOOL LLVisualParamHint::render() LLGLSUIDefault gls_ui; //LLGLState::verify(TRUE); - LLViewerImage::bindTexture(mBackgroundp); - gGL.color4f(1.f, 1.f, 1.f, 1.f); - gl_rect_2d_simple_tex( mWidth, mHeight ); - mBackgroundp->unbindTexture(0, GL_TEXTURE_2D); + mBackgroundp->draw(0, 0, mWidth, mHeight); glMatrixMode(GL_PROJECTION); glPopMatrix(); @@ -229,13 +223,13 @@ BOOL LLVisualParamHint::render() LLVector3 camera_pos = target_joint_pos + (camera_snapshot_offset * avatar_rotation); gGL.stop(); - gCamera->setAspect((F32)mWidth / (F32)mHeight); - gCamera->setOriginAndLookAt( + LLViewerCamera::getInstance()->setAspect((F32)mWidth / (F32)mHeight); + LLViewerCamera::getInstance()->setOriginAndLookAt( camera_pos, // camera LLVector3(0.f, 0.f, 1.f), // up target_pos ); // point of interest - gCamera->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mWidth, mHeight, FALSE); + LLViewerCamera::getInstance()->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mWidth, mHeight, FALSE); if (avatarp->mDrawable.notNull()) { diff --git a/indra/newview/lltoolmorph.h b/indra/newview/lltoolmorph.h index 4c3489b35f..847518f3c6 100644 --- a/indra/newview/lltoolmorph.h +++ b/indra/newview/lltoolmorph.h @@ -91,7 +91,7 @@ protected: LLRect mRect; F32 mLastParamWeight; - LLPointer<LLViewerImage> mBackgroundp; + LLUIImagePtr mBackgroundp; typedef std::set<LLVisualParamHint*> instance_list_t; static instance_list_t sInstances; diff --git a/indra/newview/lltoolobjpicker.cpp b/indra/newview/lltoolobjpicker.cpp index a8876da131..8354792e31 100644 --- a/indra/newview/lltoolobjpicker.cpp +++ b/indra/newview/lltoolobjpicker.cpp @@ -48,7 +48,6 @@ #include "llviewerwindow.h" #include "lldrawable.h" -LLToolObjPicker* gToolObjPicker = NULL; LLToolObjPicker::LLToolObjPicker() : LLTool( "ObjPicker", NULL ), @@ -98,8 +97,8 @@ void LLToolObjPicker::pickCallback(S32 x, S32 y, MASK mask) objectp = gObjectList.findObject( gLastHitObjectID ); if (objectp) { - gToolObjPicker->mHitObjectID = objectp->mID; - gToolObjPicker->mPicked = TRUE; + LLToolObjPicker::getInstance()->mHitObjectID = objectp->mID; + LLToolObjPicker::getInstance()->mPicked = TRUE; } } diff --git a/indra/newview/lltoolobjpicker.h b/indra/newview/lltoolobjpicker.h index 985ce14e38..794d035a83 100644 --- a/indra/newview/lltoolobjpicker.h +++ b/indra/newview/lltoolobjpicker.h @@ -36,7 +36,7 @@ #include "v3math.h" #include "lluuid.h" -class LLToolObjPicker : public LLTool +class LLToolObjPicker : public LLTool, public LLSingleton<LLToolObjPicker> { public: LLToolObjPicker(); @@ -63,6 +63,5 @@ protected: void *mExitCallbackData; }; -extern LLToolObjPicker* gToolObjPicker; #endif diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index 1bf08d9e22..16ab3c0944 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -67,8 +67,6 @@ #include "llui.h" #include "llweb.h" -LLToolPie *gToolPie = NULL; - LLPointer<LLViewerObject> LLToolPie::sClickActionObject; LLSafeHandle<LLObjectSelection> LLToolPie::sLeftClickSelection = NULL; U8 LLToolPie::sClickAction = 0; @@ -94,8 +92,6 @@ LLToolPie::LLToolPie() BOOL LLToolPie::handleMouseDown(S32 x, S32 y, MASK mask) { - if (!gCamera) return FALSE; - gPickFaces = TRUE; //left mouse down always picks transparent gViewerWindow->hitObjectOrLandGlobalAsync(x, y, mask, leftMouseCallback, @@ -107,7 +103,7 @@ BOOL LLToolPie::handleMouseDown(S32 x, S32 y, MASK mask) // static void LLToolPie::leftMouseCallback(S32 x, S32 y, MASK mask) { - gToolPie->pickAndShowMenu(x, y, mask, FALSE); + LLToolPie::getInstance()->pickAndShowMenu(x, y, mask, FALSE); } BOOL LLToolPie::handleRightMouseDown(S32 x, S32 y, MASK mask) @@ -125,7 +121,7 @@ BOOL LLToolPie::handleRightMouseDown(S32 x, S32 y, MASK mask) // static void LLToolPie::rightMouseCallback(S32 x, S32 y, MASK mask) { - gToolPie->pickAndShowMenu(x, y, mask, TRUE); + LLToolPie::getInstance()->pickAndShowMenu(x, y, mask, TRUE); } // True if you selected an object. @@ -133,12 +129,12 @@ BOOL LLToolPie::pickAndShowMenu(S32 x, S32 y, MASK mask, BOOL always_show) { if (!always_show && gLastHitParcelWall) { - LLParcel* parcel = gParcelMgr->getCollisionParcel(); + LLParcel* parcel = LLViewerParcelMgr::getInstance()->getCollisionParcel(); if (parcel) { - gParcelMgr->selectCollisionParcel(); + LLViewerParcelMgr::getInstance()->selectCollisionParcel(); if (parcel->getParcelFlag(PF_USE_PASS_LIST) - && !gParcelMgr->isCollisionBanned()) + && !LLViewerParcelMgr::getInstance()->isCollisionBanned()) { // if selling passes, just buy one void* deselect_when_done = (void*)TRUE; @@ -161,7 +157,7 @@ BOOL LLToolPie::pickAndShowMenu(S32 x, S32 y, MASK mask, BOOL always_show) mHitLand = !object && !gLastHitPosGlobal.isExactlyZero(); if (!mHitLand) { - gParcelMgr->deselectLand(); + LLViewerParcelMgr::getInstance()->deselectLand(); } if (object) @@ -238,8 +234,8 @@ BOOL LLToolPie::pickAndShowMenu(S32 x, S32 y, MASK mask, BOOL always_show) !always_show) { gGrabTransientTool = this; - gToolMgr->getCurrentToolset()->selectTool( gToolGrab ); - return gToolGrab->handleObjectHit( object, x, y, mask); + LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolGrab::getInstance() ); + return LLToolGrab::getInstance()->handleObjectHit( object, x, y, mask); } if (!object && gLastHitHUDIcon && gLastHitHUDIcon->getSourceObject()) @@ -270,10 +266,10 @@ BOOL LLToolPie::pickAndShowMenu(S32 x, S32 y, MASK mask, BOOL always_show) if (object && object == gAgent.getAvatarObject()) { // we left clicked on avatar, switch to focus mode - gToolMgr->setTransientTool(gToolCamera); + LLToolMgr::getInstance()->setTransientTool(LLToolCamera::getInstance()); gViewerWindow->hideCursor(); - gToolCamera->setMouseCapture(TRUE); - gToolCamera->pickCallback(gViewerWindow->getCurrentMouseX(), gViewerWindow->getCurrentMouseY(), mask); + LLToolCamera::getInstance()->setMouseCapture(TRUE); + LLToolCamera::getInstance()->pickCallback(gViewerWindow->getCurrentMouseX(), gViewerWindow->getCurrentMouseY(), mask); gAgent.setFocusOnAvatar(TRUE, TRUE); return TRUE; @@ -297,12 +293,12 @@ BOOL LLToolPie::pickAndShowMenu(S32 x, S32 y, MASK mask, BOOL always_show) // Spawn pie menu if (mHitLand) { - LLParcelSelectionHandle selection = gParcelMgr->selectParcelAt( gLastHitPosGlobal ); + LLParcelSelectionHandle selection = LLViewerParcelMgr::getInstance()->selectParcelAt( gLastHitPosGlobal ); gMenuHolder->setParcelSelection(selection); gPieLand->show(x, y, mPieMouseButtonDown); // VEFFECT: ShowPie - LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)gHUDManager->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_SPHERE, TRUE); + LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_SPHERE, TRUE); effectp->setPositionGlobal(gLastHitPosGlobal); effectp->setColor(LLColor4U(gAgent.getEffectColor())); effectp->setDuration(0.25f); @@ -313,7 +309,7 @@ BOOL LLToolPie::pickAndShowMenu(S32 x, S32 y, MASK mask, BOOL always_show) } else if (object) { - gMenuHolder->setObjectSelection(gSelectMgr->getSelection()); + gMenuHolder->setObjectSelection(LLSelectMgr::getInstance()->getSelection()); if (object->isAvatar() || (object->isAttachment() && !object->isHUDAttachment() && !object->permYouOwner())) @@ -327,7 +323,7 @@ BOOL LLToolPie::pickAndShowMenu(S32 x, S32 y, MASK mask, BOOL always_show) // Object is an avatar, so check for mute by id. LLVOAvatar* avatar = (LLVOAvatar*)object; LLString name = avatar->getFullname(); - if (gMuteListp->isMuted(avatar->getID(), name)) + if (LLMuteList::getInstance()->isMuted(avatar->getID(), name)) { gMenuHolder->childSetText("Avatar Mute", LLString("Unmute")); // *TODO:Translate //gMutePieMenu->setLabel("Unmute"); @@ -348,12 +344,12 @@ BOOL LLToolPie::pickAndShowMenu(S32 x, S32 y, MASK mask, BOOL always_show) { // BUG: What about chatting child objects? LLString name; - LLSelectNode* node = gSelectMgr->getSelection()->getFirstRootNode(); + LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); if (node) { name = node->mName; } - if (gMuteListp->isMuted(object->getID(), name)) + if (LLMuteList::getInstance()->isMuted(object->getID(), name)) { gMenuHolder->childSetText("Object Mute", LLString("Unmute")); // *TODO:Translate //gMuteObjectPieMenu->setLabel("Unmute"); @@ -369,7 +365,7 @@ BOOL LLToolPie::pickAndShowMenu(S32 x, S32 y, MASK mask, BOOL always_show) // VEFFECT: ShowPie object // Don't show when you click on someone else, it freaks them // out. - LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)gHUDManager->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_SPHERE, TRUE); + LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_SPHERE, TRUE); effectp->setPositionGlobal(gLastHitPosGlobal); effectp->setColor(LLColor4U(gAgent.getEffectColor())); effectp->setDuration(0.25f); @@ -476,7 +472,7 @@ void LLToolPie::selectionPropertiesReceived() { // Make sure all data has been received. // This function will be called repeatedly as the data comes in. - if (!gSelectMgr->selectGetAllValid()) + if (!LLSelectMgr::getInstance()->selectGetAllValid()) { return; } @@ -594,7 +590,7 @@ BOOL LLToolPie::handleMouseUp(S32 x, S32 y, MASK mask) } } mGrabMouseButtonDown = FALSE; - gToolMgr->clearTransientTool(); + LLToolMgr::getInstance()->clearTransientTool(); gAgent.setLookAt(LOOKAT_TARGET_CONVERSATION, obj); // maybe look at object/person clicked on return LLTool::handleMouseUp(x, y, mask); } @@ -602,7 +598,7 @@ BOOL LLToolPie::handleMouseUp(S32 x, S32 y, MASK mask) BOOL LLToolPie::handleRightMouseUp(S32 x, S32 y, MASK mask) { mPieMouseButtonDown = FALSE; - gToolMgr->clearTransientTool(); + LLToolMgr::getInstance()->clearTransientTool(); return LLTool::handleRightMouseUp(x, y, mask); } @@ -668,18 +664,18 @@ void LLToolPie::handleDeselect() setMouseCapture( FALSE ); // Calls onMouseCaptureLost() indirectly } // remove temporary selection for pie menu - gSelectMgr->validateSelection(); + LLSelectMgr::getInstance()->validateSelection(); } LLTool* LLToolPie::getOverrideTool(MASK mask) { if (mask == MASK_CONTROL) { - return gToolGrab; + return LLToolGrab::getInstance(); } else if (mask == (MASK_CONTROL | MASK_SHIFT)) { - return gToolGrab; + return LLToolGrab::getInstance(); } return LLTool::getOverrideTool(mask); @@ -716,7 +712,7 @@ void LLToolPie::render() static void handle_click_action_play() { - LLParcel* parcel = gParcelMgr->getAgentParcel(); + LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if (!parcel) return; LLMediaBase::EStatus status = LLViewerParcelMedia::getStatus(); @@ -739,7 +735,7 @@ static void handle_click_action_play() static void handle_click_action_open_media(LLPointer<LLViewerObject> objectp) { //FIXME: how do we handle object in different parcel than us? - LLParcel* parcel = gParcelMgr->getAgentParcel(); + LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if (!parcel) return; // did we hit an object? @@ -781,7 +777,7 @@ static ECursorType cursor_from_parcel_media(U8 click_action) //FIXME: how do we handle object in different parcel than us? ECursorType open_cursor = UI_CURSOR_ARROW; - LLParcel* parcel = gParcelMgr->getAgentParcel(); + LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if (!parcel) return open_cursor; std::string media_url = std::string ( parcel->getMediaURL () ); diff --git a/indra/newview/lltoolpie.h b/indra/newview/lltoolpie.h index 1af4b26a94..4963940840 100644 --- a/indra/newview/lltoolpie.h +++ b/indra/newview/lltoolpie.h @@ -38,8 +38,7 @@ class LLViewerObject; class LLObjectSelection; -class LLToolPie -: public LLTool +class LLToolPie : public LLTool, public LLSingleton<LLToolPie> { public: LLToolPie( ); @@ -81,6 +80,5 @@ protected: static LLSafeHandle<LLObjectSelection> sLeftClickSelection; }; -extern LLToolPie *gToolPie; #endif diff --git a/indra/newview/lltoolpipette.cpp b/indra/newview/lltoolpipette.cpp index bcddd58e8b..aa9500fc0a 100644 --- a/indra/newview/lltoolpipette.cpp +++ b/indra/newview/lltoolpipette.cpp @@ -46,9 +46,6 @@ #include "llselectmgr.h" #include "lltoolmgr.h" -// Globals -LLToolPipette *gToolPipette = NULL; - // // Member functions // @@ -79,9 +76,9 @@ BOOL LLToolPipette::handleMouseDown(S32 x, S32 y, MASK mask) BOOL LLToolPipette::handleMouseUp(S32 x, S32 y, MASK mask) { mSuccess = TRUE; - gSelectMgr->unhighlightAll(); + LLSelectMgr::getInstance()->unhighlightAll(); // *NOTE: This assumes the pipette tool is a transient tool. - gToolMgr->clearTransientTool(); + LLToolMgr::getInstance()->clearTransientTool(); setMouseCapture(FALSE); return TRUE; } @@ -113,7 +110,7 @@ BOOL LLToolPipette::handleToolTip(S32 x, S32 y, LLString& msg, LLRect *sticky_re void LLToolPipette::pickCallback(S32 x, S32 y, MASK mask) { LLViewerObject* hit_obj = gViewerWindow->lastObjectHit(); - gSelectMgr->unhighlightAll(); + LLSelectMgr::getInstance()->unhighlightAll(); // if we clicked on a face of a valid prim, save off texture entry data if (hit_obj && @@ -121,11 +118,11 @@ void LLToolPipette::pickCallback(S32 x, S32 y, MASK mask) gLastHitObjectFace != -1) { //TODO: this should highlight the selected face only - gSelectMgr->highlightObjectOnly(hit_obj); - gToolPipette->mTextureEntry = *hit_obj->getTE(gLastHitObjectFace); - if (gToolPipette->mSelectCallback) + LLSelectMgr::getInstance()->highlightObjectOnly(hit_obj); + LLToolPipette::getInstance()->mTextureEntry = *hit_obj->getTE(gLastHitObjectFace); + if (LLToolPipette::getInstance()->mSelectCallback) { - gToolPipette->mSelectCallback(gToolPipette->mTextureEntry, gToolPipette->mUserData); + LLToolPipette::getInstance()->mSelectCallback(LLToolPipette::getInstance()->mTextureEntry, LLToolPipette::getInstance()->mUserData); } } } diff --git a/indra/newview/lltoolpipette.h b/indra/newview/lltoolpipette.h index 411cb465b9..ef4718bd62 100644 --- a/indra/newview/lltoolpipette.h +++ b/indra/newview/lltoolpipette.h @@ -43,7 +43,7 @@ class LLViewerObject; class LLToolPipette -: public LLTool +: public LLTool, public LLSingleton<LLToolPipette> { public: LLToolPipette(); @@ -68,6 +68,4 @@ protected: void* mUserData; }; -extern LLToolPipette *gToolPipette; - #endif //LL_LLTOOLPIPETTE_H diff --git a/indra/newview/lltoolplacer.cpp b/indra/newview/lltoolplacer.cpp index a27053faa3..062d760322 100644 --- a/indra/newview/lltoolplacer.cpp +++ b/indra/newview/lltoolplacer.cpp @@ -117,7 +117,7 @@ BOOL LLToolPlacer::raycastForNewObjPos( S32 x, S32 y, LLViewerObject** hit_obj, } // Find the sim where the surface lives. - LLViewerRegion *regionp = gWorldp->getRegionFromPosGlobal(surface_pos_global); + LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromPosGlobal(surface_pos_global); if (!regionp) { llwarns << "Trying to add object outside of all known regions!" << llendl; @@ -130,8 +130,8 @@ BOOL LLToolPlacer::raycastForNewObjPos( S32 x, S32 y, LLViewerObject** hit_obj, *region = regionp; *ray_start_region = regionp->getPosRegionFromGlobal( ray_start_global ); - F32 near_clip = gCamera->getNear() + 0.01f; // Include an epsilon to avoid rounding issues. - *ray_start_region += gCamera->getAtAxis() * near_clip; + F32 near_clip = LLViewerCamera::getInstance()->getNear() + 0.01f; // Include an epsilon to avoid rounding issues. + *ray_start_region += LLViewerCamera::getInstance()->getAtAxis() * near_clip; if( bypass_sim_raycast ) { @@ -415,18 +415,18 @@ BOOL LLToolPlacer::addObject( LLPCode pcode, S32 x, S32 y, U8 use_physics ) // Spawns a message, so must be after above send if (create_selected) { - gSelectMgr->deselectAll(); + LLSelectMgr::getInstance()->deselectAll(); gViewerWindow->getWindow()->incBusyCount(); } // VEFFECT: AddObject - LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)gHUDManager->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE); + LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE); effectp->setSourceObject((LLViewerObject*)gAgent.getAvatarObject()); effectp->setPositionGlobal(regionp->getPosGlobalFromRegion(ray_end_region)); effectp->setDuration(LL_HUD_DUR_SHORT); effectp->setColor(LLColor4U(gAgent.getEffectColor())); - gViewerStats->incStat(LLViewerStats::ST_CREATE_COUNT); + LLViewerStats::getInstance()->incStat(LLViewerStats::ST_CREATE_COUNT); return TRUE; } @@ -468,7 +468,7 @@ BOOL LLToolPlacer::addDuplicate(S32 x, S32 y) ray_target_id.setNull(); } - gSelectMgr->selectDuplicateOnRay(ray_start_region, + LLSelectMgr::getInstance()->selectDuplicateOnRay(ray_start_region, ray_end_region, b_hit_land, // suppress raycast FALSE, // intersection @@ -503,7 +503,7 @@ BOOL LLToolPlacer::placeObject(S32 x, S32 y, MASK mask) // ...and go back to the default tool if (added && !gSavedSettings.getBOOL("CreateToolKeepSelected")) { - gToolMgr->getCurrentToolset()->selectTool( gToolTranslate ); + LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolCompTranslate::getInstance() ); } return added; diff --git a/indra/newview/lltoolselect.cpp b/indra/newview/lltoolselect.cpp index 3f4c823d40..1c19de5571 100644 --- a/indra/newview/lltoolselect.cpp +++ b/indra/newview/lltoolselect.cpp @@ -51,7 +51,6 @@ #include "llworld.h" // Globals -LLToolSelect *gToolSelect = NULL; extern BOOL gAllowSelectAvatar; const F32 SELECTION_ROTATION_TRESHOLD = 0.1f; @@ -106,7 +105,7 @@ LLSafeHandle<LLObjectSelection> LLToolSelect::handleObjectSelection(LLViewerObje { gSavedSettings.setBOOL("SelectOwnedOnly", FALSE); gSavedSettings.setBOOL("SelectMovableOnly", FALSE); - gSelectMgr->setForceSelection(TRUE); + LLSelectMgr::getInstance()->setForceSelection(TRUE); } BOOL extend_select = (mask == MASK_SHIFT) || (mask == MASK_CONTROL); @@ -120,7 +119,7 @@ LLSafeHandle<LLObjectSelection> LLToolSelect::handleObjectSelection(LLViewerObje } else if (!extend_select) { - gSelectMgr->deselectAll(); + LLSelectMgr::getInstance()->deselectAll(); } } else @@ -133,22 +132,22 @@ LLSafeHandle<LLObjectSelection> LLToolSelect::handleObjectSelection(LLViewerObje { if ( ignore_group ) { - gSelectMgr->deselectObjectOnly(object); + LLSelectMgr::getInstance()->deselectObjectOnly(object); } else { - gSelectMgr->deselectObjectAndFamily(object, TRUE, TRUE); + LLSelectMgr::getInstance()->deselectObjectAndFamily(object, TRUE, TRUE); } } else { if ( ignore_group ) { - gSelectMgr->selectObjectOnly(object, SELECT_ALL_TES); + LLSelectMgr::getInstance()->selectObjectOnly(object, SELECT_ALL_TES); } else { - gSelectMgr->selectObjectAndFamily(object); + LLSelectMgr::getInstance()->selectObjectAndFamily(object); } } } @@ -157,27 +156,27 @@ LLSafeHandle<LLObjectSelection> LLToolSelect::handleObjectSelection(LLViewerObje // Save the current zoom values because deselect resets them. F32 target_zoom; F32 current_zoom; - gSelectMgr->getAgentHUDZoom(target_zoom, current_zoom); + LLSelectMgr::getInstance()->getAgentHUDZoom(target_zoom, current_zoom); // JC - Change behavior to make it easier to select children // of linked sets. 9/3/2002 if( !already_selected || ignore_group) { // ...lose current selection in favor of just this object - gSelectMgr->deselectAll(); + LLSelectMgr::getInstance()->deselectAll(); } if ( ignore_group ) { - gSelectMgr->selectObjectOnly(object, SELECT_ALL_TES); + LLSelectMgr::getInstance()->selectObjectOnly(object, SELECT_ALL_TES); } else { - gSelectMgr->selectObjectAndFamily(object); + LLSelectMgr::getInstance()->selectObjectAndFamily(object); } // restore the zoom to the previously stored values. - gSelectMgr->setAgentHUDZoom(target_zoom, current_zoom); + LLSelectMgr::getInstance()->setAgentHUDZoom(target_zoom, current_zoom); } if (!gAgent.getFocusOnAvatar() && // if camera not glued to avatar @@ -185,7 +184,7 @@ LLSafeHandle<LLObjectSelection> LLToolSelect::handleObjectSelection(LLViewerObje object != gAgent.getAvatarObject()) // and it's not you { // have avatar turn to face the selected object(s) - LLVector3d selection_center = gSelectMgr->getSelectionCenterGlobal(); + LLVector3d selection_center = LLSelectMgr::getInstance()->getSelectionCenterGlobal(); selection_center = selection_center - gAgent.getPositionGlobal(); LLVector3 selection_dir; selection_dir.setVec(selection_center); @@ -204,7 +203,7 @@ LLSafeHandle<LLObjectSelection> LLToolSelect::handleObjectSelection(LLViewerObje if (!already_selected) { LLViewerObject* root_object = (LLViewerObject*)object->getRootEdit(); - LLObjectSelectionHandle selection = gSelectMgr->getSelection(); + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); // this is just a temporary selection LLSelectNode* select_node = selection->findNode(root_object); @@ -231,10 +230,10 @@ LLSafeHandle<LLObjectSelection> LLToolSelect::handleObjectSelection(LLViewerObje { gSavedSettings.setBOOL("SelectOwnedOnly", select_owned); gSavedSettings.setBOOL("SelectMovableOnly", select_movable); - gSelectMgr->setForceSelection(FALSE); + LLSelectMgr::getInstance()->setForceSelection(FALSE); } - return gSelectMgr->getSelection(); + return LLSelectMgr::getInstance()->getSelection(); } BOOL LLToolSelect::handleMouseUp(S32 x, S32 y, MASK mask) @@ -268,7 +267,7 @@ void LLToolSelect::onMouseCaptureLost() { // Finish drag - gSelectMgr->enableSilhouette(TRUE); + LLSelectMgr::getInstance()->enableSilhouette(TRUE); // Clean up drag-specific variables mIgnoreGroup = FALSE; diff --git a/indra/newview/lltoolselect.h b/indra/newview/lltoolselect.h index cc9168f7cc..c3d10424b1 100644 --- a/indra/newview/lltoolselect.h +++ b/indra/newview/lltoolselect.h @@ -38,7 +38,7 @@ class LLObjectSelection; -class LLToolSelect : public LLTool +class LLToolSelect : public LLTool, public LLSingleton<LLToolSelect> { public: LLToolSelect( LLToolComposite* composite ); @@ -59,6 +59,5 @@ protected: LLUUID mSelectObjectID; }; -extern LLToolSelect *gToolSelect; #endif // LL_TOOLSELECTION_H diff --git a/indra/newview/lltoolselectland.cpp b/indra/newview/lltoolselectland.cpp index bbbda58cf0..28e4227db4 100644 --- a/indra/newview/lltoolselectland.cpp +++ b/indra/newview/lltoolselectland.cpp @@ -46,9 +46,6 @@ #include "llviewerparcelmgr.h" #include "llviewerwindow.h" -// Globals -LLToolSelectLand *gToolParcel = NULL; - // // Member functions // @@ -98,7 +95,7 @@ BOOL LLToolSelectLand::handleMouseDown(S32 x, S32 y, MASK mask) mMouseOutsideSlop = TRUE; //FALSE; - gParcelMgr->deselectLand(); + LLViewerParcelMgr::getInstance()->deselectLand(); } return hit_land; @@ -112,7 +109,7 @@ BOOL LLToolSelectLand::handleDoubleClick(S32 x, S32 y, MASK mask) if (hit_land) { // Auto-select this parcel - gParcelMgr->selectParcelAt( pos_global ); + LLViewerParcelMgr::getInstance()->selectParcelAt( pos_global ); return TRUE; } return FALSE; @@ -140,7 +137,7 @@ BOOL LLToolSelectLand::handleMouseUp(S32 x, S32 y, MASK mask) roundXY(mEastNorthTop); // Don't auto-select entire parcel. - mSelection = gParcelMgr->selectLand( mWestSouthBottom, mEastNorthTop, FALSE ); + mSelection = LLViewerParcelMgr::getInstance()->selectLand( mWestSouthBottom, mEastNorthTop, FALSE ); } mMouseOutsideSlop = FALSE; @@ -212,7 +209,7 @@ void LLToolSelectLand::render() { if( hasMouseCapture() && /*mMouseOutsideSlop &&*/ mDragEndValid) { - gParcelMgr->renderRect( mWestSouthBottom, mEastNorthTop ); + LLViewerParcelMgr::getInstance()->renderRect( mWestSouthBottom, mEastNorthTop ); } } @@ -228,7 +225,7 @@ void LLToolSelectLand::handleDeselect() { mSelection = NULL; mLastShowParcelOwners = gSavedSettings.getBOOL("ShowParcelOwners"); - //gParcelMgr->deselectLand(); + //LLViewerParcelMgr::getInstance()->deselectLand(); gSavedSettings.setBOOL("ShowParcelOwners", mLastShowParcelOwners); } diff --git a/indra/newview/lltoolselectland.h b/indra/newview/lltoolselectland.h index f847967ac8..37d656289b 100644 --- a/indra/newview/lltoolselectland.h +++ b/indra/newview/lltoolselectland.h @@ -38,7 +38,7 @@ class LLParcelSelection; class LLToolSelectLand -: public LLTool +: public LLTool, public LLSingleton<LLToolSelectLand> { public: LLToolSelectLand( ); @@ -78,6 +78,5 @@ protected: LLSafeHandle<LLParcelSelection> mSelection; // hold on to a parcel selection }; -extern LLToolSelectLand *gToolParcel; #endif diff --git a/indra/newview/lltoolselectrect.cpp b/indra/newview/lltoolselectrect.cpp index 3b68751740..5f54d1f3ba 100644 --- a/indra/newview/lltoolselectrect.cpp +++ b/indra/newview/lltoolselectrect.cpp @@ -106,11 +106,11 @@ BOOL LLToolSelectRect::handleMouseUp(S32 x, S32 y, MASK mask) if (mask == MASK_CONTROL) { - gSelectMgr->deselectHighlightedObjects(); + LLSelectMgr::getInstance()->deselectHighlightedObjects(); } else { - gSelectMgr->selectHighlightedObjects(); + LLSelectMgr::getInstance()->selectHighlightedObjects(); } return TRUE; } @@ -130,7 +130,7 @@ BOOL LLToolSelectRect::handleHover(S32 x, S32 y, MASK mask) if (!mMouseOutsideSlop && !(mask & MASK_SHIFT) && !(mask & MASK_CONTROL)) { // just started rect select, and not adding to current selection - gSelectMgr->deselectAll(); + LLSelectMgr::getInstance()->deselectAll(); } mMouseOutsideSlop = TRUE; mDragEndX = x; diff --git a/indra/newview/lltoolview.cpp b/indra/newview/lltoolview.cpp index ad7a980091..23012993a3 100644 --- a/indra/newview/lltoolview.cpp +++ b/indra/newview/lltoolview.cpp @@ -101,7 +101,7 @@ void LLToolView::addTool(const LLString& icon_off, const LLString& icon_on, LLPa mButtonCount++; const S32 LABEL_TOP_SPACING = 0; - const LLFontGL* font = gResMgr->getRes( LLFONT_SANSSERIF_SMALL ); + const LLFontGL* font = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF_SMALL ); S32 label_width = font->getWidth( label ); LLRect label_rect; label_rect.setLeftTopAndSize( @@ -153,7 +153,7 @@ void LLToolView::draw() { // turn off highlighting for all containers // and hide all option panels except for the selected one. - LLTool* selected = gToolMgr->getCurrentToolset()->getSelectedTool(); + LLTool* selected = LLToolMgr::getInstance()->getCurrentToolset()->getSelectedTool(); for (contain_list_t::iterator iter = mContainList.begin(); iter != mContainList.end(); ++iter) { @@ -194,7 +194,7 @@ void LLToolView::onClickToolButton(void* userdata) LLToolContainer* clicked = (LLToolContainer*) userdata; // Switch to this one - gToolMgr->getCurrentToolset()->selectTool( clicked->mTool ); + LLToolMgr::getInstance()->getCurrentToolset()->selectTool( clicked->mTool ); } diff --git a/indra/newview/lltracker.cpp b/indra/newview/lltracker.cpp index 6938c62d84..1c328612bc 100644 --- a/indra/newview/lltracker.cpp +++ b/indra/newview/lltracker.cpp @@ -135,18 +135,14 @@ void LLTracker::drawHUDArrow() break; case TRACKING_LOCATION: - if (!gWorldp) - { - break; - } // HACK -- try to keep the location just above the terrain #if 0 // UNHACKED by CRO - keep location where the location is instance()->mTrackedPositionGlobal.mdV[VZ] = 0.9f * instance()->mTrackedPositionGlobal.mdV[VZ] - + 0.1f * (gWorldp->resolveLandHeightGlobal(getTrackedPositionGlobal()) + 1.5f); + + 0.1f * (LLWorld::getInstance()->resolveLandHeightGlobal(getTrackedPositionGlobal()) + 1.5f); #endif - instance()->mTrackedPositionGlobal.mdV[VZ] = llclamp((F32)instance()->mTrackedPositionGlobal.mdV[VZ], gWorldp->resolveLandHeightGlobal(getTrackedPositionGlobal()) + 1.5f, (F32)instance()->getTrackedPositionGlobal().mdV[VZ]); + instance()->mTrackedPositionGlobal.mdV[VZ] = llclamp((F32)instance()->mTrackedPositionGlobal.mdV[VZ], LLWorld::getInstance()->resolveLandHeightGlobal(getTrackedPositionGlobal()) + 1.5f, (F32)instance()->getTrackedPositionGlobal().mdV[VZ]); instance()->drawMarker( getTrackedPositionGlobal(), gTrackColor ); break; @@ -480,14 +476,14 @@ void LLTracker::renderBeacon(LLVector3d pos_global, F32 dist = (F32)to_vec.magVec(); F32 color_frac = 1.f; - if (dist > 0.99f * gCamera->getFar()) + if (dist > 0.99f * LLViewerCamera::getInstance()->getFar()) { color_frac = 0.4f; - // pos_global = gAgent.getCameraPositionGlobal() + 0.99f*(gCamera->getFar()/dist)*to_vec; + // pos_global = gAgent.getCameraPositionGlobal() + 0.99f*(LLViewerCamera::getInstance()->getFar()/dist)*to_vec; } else { - color_frac = 1.f - 0.6f*(dist/gCamera->getFar()); + color_frac = 1.f - 0.6f*(dist/LLViewerCamera::getInstance()->getFar()); } LLColor4 fogged_color = color_frac * color + (1 - color_frac)*gSky.getFogColor(); @@ -512,9 +508,9 @@ void LLTracker::renderBeacon(LLVector3d pos_global, const U32 BEACON_VERTS = 256; const F32 step = 1024.0f/BEACON_VERTS; - LLVector3 x_axis = gCamera->getLeftAxis(); + LLVector3 x_axis = LLViewerCamera::getInstance()->getLeftAxis(); F32 t = gRenderStartTime.getElapsedTimeF32(); - F32 dr = dist/gCamera->getFar(); + F32 dr = dist/LLViewerCamera::getInstance()->getFar(); for (U32 i = 0; i < BEACON_VERTS; i++) { @@ -645,11 +641,6 @@ void LLTracker::clearFocus() void LLTracker::drawMarker(const LLVector3d& pos_global, const LLColor4& color) { - if (!gCamera) - { - return; - } - // get position LLVector3 pos_local = gAgent.getPosAgentFromGlobal(pos_global); @@ -659,8 +650,8 @@ void LLTracker::drawMarker(const LLVector3d& pos_global, const LLColor4& color) S32 y = 0; const BOOL CLAMP = TRUE; - if (gCamera->projectPosAgentToScreen(pos_local, screen, CLAMP) - || gCamera->projectPosAgentToScreenEdge(pos_local, screen) ) + if (LLViewerCamera::getInstance()->projectPosAgentToScreen(pos_local, screen, CLAMP) + || LLViewerCamera::getInstance()->projectPosAgentToScreenEdge(pos_local, screen) ) { gHUDView->screenPointToLocal(screen.mX, screen.mY, &x, &y); @@ -727,7 +718,7 @@ void LLTracker::drawMarker(const LLVector3d& pos_global, const LLColor4& color) mHUDArrowCenterY - half_arrow_size, HUD_ARROW_SIZE, HUD_ARROW_SIZE, RAD_TO_DEG * angle, - LLWorldMapView::sTrackArrowImage, + LLWorldMapView::sTrackArrowImage->getImage(), color); } } diff --git a/indra/newview/lluploaddialog.cpp b/indra/newview/lluploaddialog.cpp index ac41e02744..686e386578 100644 --- a/indra/newview/lluploaddialog.cpp +++ b/indra/newview/lluploaddialog.cpp @@ -74,7 +74,7 @@ LLUploadDialog::LLUploadDialog( const std::string& msg) } LLUploadDialog::sDialog = this; - const LLFontGL* font = gResMgr->getRes( LLFONT_SANSSERIF ); + const LLFontGL* font = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ); LLRect msg_rect; for (int line_num=0; line_num<16; ++line_num) { @@ -90,7 +90,7 @@ LLUploadDialog::LLUploadDialog( const std::string& msg) void LLUploadDialog::setMessage( const std::string& msg) { - const LLFontGL* font = gResMgr->getRes( LLFONT_SANSSERIF ); + const LLFontGL* font = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ); const S32 VPAD = 16; const S32 HPAD = 25; diff --git a/indra/newview/llurldispatcher.cpp b/indra/newview/llurldispatcher.cpp index 5f167e62ad..abe0034dc8 100644 --- a/indra/newview/llurldispatcher.cpp +++ b/indra/newview/llurldispatcher.cpp @@ -224,7 +224,7 @@ bool LLURLDispatcherImpl::dispatchRegion(const std::string& url, BOOL right_mous url_displayp->setName(region_name); // Request a region handle by name - gWorldMap->sendNamedRegionRequest(region_name, + LLWorldMap::getInstance()->sendNamedRegionRequest(region_name, LLURLDispatcherImpl::regionNameCallback, url, false); // don't teleport @@ -263,7 +263,7 @@ void LLURLDispatcherImpl::regionNameCallback(U64 region_handle, const std::strin LLVector3d global_pos = from_region_handle(region_handle) + LLVector3d(local_pos); U64 new_region_handle = to_region_handle(global_pos); - gWorldMap->sendHandleRegionRequest(new_region_handle, + LLWorldMap::getInstance()->sendHandleRegionRequest(new_region_handle, LLURLDispatcherImpl::regionHandleCallback, url, teleport); } @@ -375,7 +375,7 @@ public: { url += tokens[i].asString() + "/"; } - gWorldMap->sendNamedRegionRequest(region_name, + LLWorldMap::getInstance()->sendNamedRegionRequest(region_name, LLURLDispatcherImpl::regionHandleCallback, url, true); // teleport diff --git a/indra/newview/llviewchildren.cpp b/indra/newview/llviewchildren.cpp index a06d2fca03..11a5384f85 100644 --- a/indra/newview/llviewchildren.cpp +++ b/indra/newview/llviewchildren.cpp @@ -65,7 +65,7 @@ void LLViewChildren::enable(const char* id, bool enabled) void LLViewChildren::setText( const char* id, const std::string& text, bool visible) { - LLTextBox* child = LLUICtrlFactory::getTextBoxByName(&mParent, id); + LLTextBox* child = mParent.getChild<LLTextBox>(id); if (child) { child->setVisible(visible); @@ -76,7 +76,7 @@ void LLViewChildren::setText( void LLViewChildren::setWrappedText( const char* id, const std::string& text, bool visible) { - LLTextBox* child = LLUICtrlFactory::getTextBoxByName(&mParent, id); + LLTextBox* child = mParent.getChild<LLTextBox>(id); if (child) { child->setVisible(visible); @@ -86,33 +86,25 @@ void LLViewChildren::setWrappedText( void LLViewChildren::setBadge(const char* id, Badge badge, bool visible) { - static LLUUID badgeOK(gViewerArt.getString("badge_ok.tga")); - static LLUUID badgeNote(gViewerArt.getString("badge_note.tga")); - static LLUUID badgeWarn(gViewerArt.getString("badge_warn.tga")); - static LLUUID badgeError(gViewerArt.getString("badge_error.tga")); - - LLUUID badgeUUID; - switch (badge) - { - default: - case BADGE_OK: badgeUUID = badgeOK; break; - case BADGE_NOTE: badgeUUID = badgeNote; break; - case BADGE_WARN: badgeUUID = badgeWarn; break; - case BADGE_ERROR: badgeUUID = badgeError; break; - } - - LLIconCtrl* child = LLUICtrlFactory::getIconByName(&mParent, id); + LLIconCtrl* child = mParent.getChild<LLIconCtrl>(id); if (child) { child->setVisible(visible); - child->setImage(badgeUUID); + switch (badge) + { + default: + case BADGE_OK: child->setImage("badge_ok.j2c"); break; + case BADGE_NOTE: child->setImage("badge_note.j2c"); break; + case BADGE_WARN: child->setImage("badge_warn.j2c"); break; + case BADGE_ERROR: child->setImage("badge_error.j2c"); break; + } } } void LLViewChildren::setAction(const char* id, void(*function)(void*), void* value) { - LLButton* button = LLUICtrlFactory::getButtonByName(&mParent, id); + LLButton* button = mParent.getChild<LLButton>(id); if (button) { button->setClickedCallback(function, value); diff --git a/indra/newview/llvieweraudio.cpp b/indra/newview/llvieweraudio.cpp index fd85ac1bc1..5703a8fdbc 100644 --- a/indra/newview/llvieweraudio.cpp +++ b/indra/newview/llvieweraudio.cpp @@ -57,9 +57,9 @@ void init_audio() lpos_global_f.setVec(lpos_global); gAudiop->setListener(lpos_global_f, - LLVector3::zero, // gCamera->getVelocity(), // !!! BUG need to replace this with smoothed velocity! - gCamera->getUpAxis(), - gCamera->getAtAxis()); + LLVector3::zero, // LLViewerCamera::getInstance()->getVelocity(), // !!! BUG need to replace this with smoothed velocity! + LLViewerCamera::getInstance()->getUpAxis(), + LLViewerCamera::getInstance()->getAtAxis()); // load up our initial set of sounds we'll want so they're in memory and ready to be played @@ -188,11 +188,11 @@ void audio_update_listener() lpos_global_f.setVec(lpos_global); gAudiop->setListener(lpos_global_f, - // gCameraVelocitySmoothed, + // LLViewerCamera::getInstance()VelocitySmoothed, // LLVector3::zero, gAgent.getVelocity(), // !!! *TODO: need to replace this with smoothed velocity! - gCamera->getUpAxis(), - gCamera->getAtAxis()); + LLViewerCamera::getInstance()->getUpAxis(), + LLViewerCamera::getInstance()->getAtAxis()); } } diff --git a/indra/newview/llviewercamera.cpp b/indra/newview/llviewercamera.cpp index 3e8ceaba1b..517a02b4ad 100644 --- a/indra/newview/llviewercamera.cpp +++ b/indra/newview/llviewercamera.cpp @@ -51,8 +51,6 @@ GLfloat gGLZFar; GLfloat gGLZNear; -LLViewerCamera *gCamera = NULL; - //glu pick matrix implementation borrowed from Mesa3D glh::matrix4f gl_pick_matrix(GLfloat x, GLfloat y, GLfloat width, GLfloat height, GLint* viewport) { diff --git a/indra/newview/llviewercamera.h b/indra/newview/llviewercamera.h index c4a0f7ea53..a16f25ff81 100644 --- a/indra/newview/llviewercamera.h +++ b/indra/newview/llviewercamera.h @@ -50,7 +50,7 @@ const F32 OGL_TO_CFR_ROTATION[16] = { 0.f, 0.f, -1.f, 0.f, // -Z becomes X const BOOL FOR_SELECTION = TRUE; const BOOL NOT_FOR_SELECTION = FALSE; -class LLViewerCamera : public LLCamera +class LLViewerCamera : public LLCamera, public LLSingleton<LLViewerCamera> { public: LLViewerCamera(); @@ -111,7 +111,6 @@ protected: public: }; -extern LLViewerCamera *gCamera; extern F64 gGLModelView[16]; extern F64 gGLLastModelView[16]; extern F64 gGLProjection[16]; diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 0df04fccfa..2e76fe33a3 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -79,7 +79,6 @@ BOOL gHackGodmode = FALSE; std::map<LLString, LLControlGroup*> gSettings; LLControlGroup gSavedSettings; // saved at end of session LLControlGroup gSavedPerAccountSettings; // saved at end of session -LLControlGroup gViewerArt; // read-only LLControlGroup gColors; // read-only LLControlGroup gCrashSettings; // saved at end of session @@ -101,10 +100,7 @@ static bool handleRenderFarClipChanged(const LLSD& newvalue) { F32 draw_distance = (F32) newvalue.asReal(); gAgent.mDrawDistance = draw_distance; - if (gWorldPointer) - { - gWorldPointer->setLandFarClip(draw_distance); - } + LLWorld::getInstance()->setLandFarClip(draw_distance); return true; } @@ -267,15 +263,14 @@ static bool handleAudioStreamMusicChanged(const LLSD& newvalue) { if ( newvalue.asBoolean() ) { - if (gParcelMgr - && gParcelMgr->getAgentParcel() - && !gParcelMgr->getAgentParcel()->getMusicURL().empty()) + if (LLViewerParcelMgr::getInstance()->getAgentParcel() + && !LLViewerParcelMgr::getInstance()->getAgentParcel()->getMusicURL().empty()) { // if stream is already playing, don't call this // otherwise music will briefly stop - if ( ! gAudiop->isInternetStreamPlaying() ) + if ( !gAudiop->isInternetStreamPlaying() ) { - gAudiop->startInternetStream(gParcelMgr->getAgentParcel()->getMusicURL().c_str()); + gAudiop->startInternetStream(LLViewerParcelMgr::getInstance()->getAgentParcel()->getMusicURL().c_str()); } } } @@ -290,7 +285,7 @@ static bool handleAudioStreamMusicChanged(const LLSD& newvalue) static bool handleUseOcclusionChanged(const LLSD& newvalue) { LLPipeline::sUseOcclusion = (newvalue.asBoolean() && gGLManager.mHasOcclusionQuery - && gFeatureManagerp->isFeatureAvailable("UseOcclusion") && !gUseWireframe) ? 2 : 0; + && LLFeatureManager::getInstance()->isFeatureAvailable("UseOcclusion") && !gUseWireframe) ? 2 : 0; return true; } diff --git a/indra/newview/llviewercontrol.h b/indra/newview/llviewercontrol.h index 2727e36b53..4ac544b780 100644 --- a/indra/newview/llviewercontrol.h +++ b/indra/newview/llviewercontrol.h @@ -56,9 +56,6 @@ extern LLControlGroup gSavedSettings; extern LLControlGroup gSavedPerAccountSettings; // Read-only -extern LLControlGroup gViewerArt; - -// Read-only extern LLControlGroup gColors; // Saved at end of session diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 41a936ca49..82e889f00a 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -173,18 +173,15 @@ void display_update_camera() { final_far *= 0.5f; } - gCamera->setFar(final_far); + LLViewerCamera::getInstance()->setFar(final_far); gViewerWindow->setup3DRender(); // update all the sky/atmospheric/water settings - LLWLParamManager::instance()->update(gCamera); - LLWaterParamManager::instance()->update(gCamera); + LLWLParamManager::instance()->update(LLViewerCamera::getInstance()); + LLWaterParamManager::instance()->update(LLViewerCamera::getInstance()); // Update land visibility too - if (gWorldp) - { - gWorldp->setLandFarClip(final_far); - } + LLWorld::getInstance()->setLandFarClip(final_far); } @@ -425,8 +422,8 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) // // - gCamera->setZoomParameters(zoom_factor, subfield); - gCamera->setNear(MIN_NEAR_PLANE); + LLViewerCamera::getInstance()->setZoomParameters(zoom_factor, subfield); + LLViewerCamera::getInstance()->setNear(MIN_NEAR_PLANE); ////////////////////////// // @@ -500,7 +497,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) stop_glerror(); // *TODO: merge these two methods - gHUDManager->updateEffects(); + LLHUDManager::getInstance()->updateEffects(); LLHUDObject::updateAll(); stop_glerror(); @@ -514,7 +511,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) if ((LLShaderMgr::getVertexShaderLevel(LLShaderMgr::SHADER_ENVIRONMENT) > 1) && gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_WATER)) { - if (gCamera->cameraUnderWater()) + if (LLViewerCamera::getInstance()->cameraUnderWater()) { water_clip = -1; } @@ -529,7 +526,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) LLPipeline::sUseOcclusion = (!gUseWireframe - && gFeatureManagerp->isFeatureAvailable("UseOcclusion") + && LLFeatureManager::getInstance()->isFeatureAvailable("UseOcclusion") && gSavedSettings.getBOOL("UseOcclusion") && gGLManager.mHasOcclusionQuery) ? 2 : 0; LLPipeline::sFastAlpha = gSavedSettings.getBOOL("RenderFastAlpha"); @@ -543,7 +540,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) } static LLCullResult result; - gPipeline.updateCull(*gCamera, result, water_clip); + gPipeline.updateCull(*LLViewerCamera::getInstance(), result, water_clip); stop_glerror(); BOOL to_texture = !for_snapshot && @@ -590,8 +587,8 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) if (!for_snapshot) { - gPipeline.processImagery(*gCamera); - gPipeline.generateWaterReflection(*gCamera); + gPipeline.processImagery(*LLViewerCamera::getInstance()); + gPipeline.generateWaterReflection(*LLViewerCamera::getInstance()); } ////////////////////////////////////// @@ -606,8 +603,8 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) { LLFastTimer t(LLFastTimer::FTM_IMAGE_UPDATE); - LLViewerImage::updateClass(gCamera->getVelocityStat()->getMean(), - gCamera->getAngularVelocityStat()->getMean()); + LLViewerImage::updateClass(LLViewerCamera::getInstance()->getVelocityStat()->getMean(), + LLViewerCamera::getInstance()->getAngularVelocityStat()->getMean()); gBumpImageList.updateImages(); // must be called before gImageList version so that it's textures are thrown out first. @@ -626,7 +623,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) // { gFrameStats.start(LLFrameStats::STATE_SORT); - gPipeline.stateSort(*gCamera, result); + gPipeline.stateSort(*LLViewerCamera::getInstance(), result); stop_glerror(); if (rebuild) @@ -677,8 +674,8 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) // (F32)floater_rect.mRight / (F32)gViewerWindow->getWindowWidth(), // (F32)floater_rect.mBottom / (F32)gViewerWindow->getWindowHeight()); // floater_3d_rect.translate(-0.5f, -0.5f); - // glTranslatef(0.f, 0.f, -gCamera->getNear()); - // glScalef(gCamera->getNear() * gCamera->getAspect() / sinf(gCamera->getView()), gCamera->getNear() / sinf(gCamera->getView()), 1.f); + // glTranslatef(0.f, 0.f, -LLViewerCamera::getInstance()->getNear()); + // glScalef(LLViewerCamera::getInstance()->getNear() * LLViewerCamera::getInstance()->getAspect() / sinf(LLViewerCamera::getInstance()->getView()), LLViewerCamera::getInstance()->getNear() / sinf(LLViewerCamera::getInstance()->getView()), 1.f); // gGL.color4fv(LLColor4::white.mV); // gGL.begin(GL_QUADS); // { @@ -705,8 +702,8 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) && !gRestoreGL) { glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE); - LLPipeline::sUnderWaterRender = gCamera->cameraUnderWater() ? TRUE : FALSE; - gPipeline.renderGeom(*gCamera, TRUE); + LLPipeline::sUnderWaterRender = LLViewerCamera::getInstance()->cameraUnderWater() ? TRUE : FALSE; + gPipeline.renderGeom(*LLViewerCamera::getInstance(), TRUE); LLPipeline::sUnderWaterRender = FALSE; glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); @@ -760,7 +757,7 @@ void render_hud_attachments() if (LLPipeline::sShowHUDAttachments && !gDisconnected && setup_hud_matrices(FALSE)) { - LLCamera hud_cam = *gCamera; + LLCamera hud_cam = *LLViewerCamera::getInstance(); LLVector3 origin = hud_cam.getOrigin(); hud_cam.setOrigin(-1.f,0,0); hud_cam.setAxes(LLVector3(1,0,0), LLVector3(0,1,0), LLVector3(0,0,1)); @@ -843,12 +840,12 @@ BOOL setup_hud_matrices(BOOL for_select) //RN: reset viewport to window extents so ortho screen is calculated with proper reference frame gViewerWindow->setupViewport(); } - glh::matrix4f proj = gl_ortho(-0.5f * gCamera->getAspect(), 0.5f * gCamera->getAspect(), -0.5f, 0.5f, 0.f, hud_depth); + glh::matrix4f proj = gl_ortho(-0.5f * LLViewerCamera::getInstance()->getAspect(), 0.5f * LLViewerCamera::getInstance()->getAspect(), -0.5f, 0.5f, 0.f, hud_depth); proj.element(2,2) = -0.01f; - + // apply camera zoom transform (for high res screenshots) - F32 zoom_factor = gCamera->getZoomFactor(); - S16 sub_region = gCamera->getZoomSubRegion(); + F32 zoom_factor = LLViewerCamera::getInstance()->getZoomFactor(); + S16 sub_region = LLViewerCamera::getInstance()->getZoomSubRegion(); if (zoom_factor > 1.f) { float offset = zoom_factor - 1.f; @@ -856,7 +853,7 @@ BOOL setup_hud_matrices(BOOL for_select) int pos_x = sub_region - (pos_y*llceil(zoom_factor)); glh::matrix4f mat; mat.set_scale(glh::vec3f(zoom_factor, zoom_factor, 1.f)); - mat.set_translate(glh::vec3f(gCamera->getAspect() * 0.5f * (offset - (F32)pos_x * 2.f), 0.5f * (offset - (F32)pos_y * 2.f), 0.f)); + mat.set_translate(glh::vec3f(LLViewerCamera::getInstance()->getAspect() * 0.5f * (offset - (F32)pos_x * 2.f), 0.5f * (offset - (F32)pos_y * 2.f), 0.f)); proj *= mat; } @@ -1077,8 +1074,8 @@ void render_ui_2d() // Menu overlays, HUD, etc gViewerWindow->setup2DRender(); - F32 zoom_factor = gCamera->getZoomFactor(); - S16 sub_region = gCamera->getZoomSubRegion(); + F32 zoom_factor = LLViewerCamera::getInstance()->getZoomFactor(); + S16 sub_region = LLViewerCamera::getInstance()->getZoomSubRegion(); if (zoom_factor > 1.f) { diff --git a/indra/newview/llviewerjoystick.cpp b/indra/newview/llviewerjoystick.cpp index 27e71c23c9..a8e898999a 100644 --- a/indra/newview/llviewerjoystick.cpp +++ b/indra/newview/llviewerjoystick.cpp @@ -87,9 +87,9 @@ void LLViewerJoystick::updateCamera(BOOL reset) if (reset) { - sFlycamPosition = gCamera->getOrigin(); - sFlycamRotation = gCamera->getQuaternion(); - sFlycamZoom = gCamera->getView(); + sFlycamPosition = LLViewerCamera::getInstance()->getOrigin(); + sFlycamRotation = LLViewerCamera::getInstance()->getQuaternion(); + sFlycamZoom = LLViewerCamera::getInstance()->getView(); for (U32 i = 0; i < 7; i++) { @@ -168,11 +168,11 @@ void LLViewerJoystick::updateCamera(BOOL reset) LLMatrix3 mat(sFlycamRotation); - gCamera->setView(sFlycamZoom); - gCamera->setOrigin(sFlycamPosition); - gCamera->mXAxis = LLVector3(mat.mMatrix[0]); - gCamera->mYAxis = LLVector3(mat.mMatrix[1]); - gCamera->mZAxis = LLVector3(mat.mMatrix[2]); + LLViewerCamera::getInstance()->setView(sFlycamZoom); + LLViewerCamera::getInstance()->setOrigin(sFlycamPosition); + LLViewerCamera::getInstance()->mXAxis = LLVector3(mat.mMatrix[0]); + LLViewerCamera::getInstance()->mYAxis = LLVector3(mat.mMatrix[1]); + LLViewerCamera::getInstance()->mZAxis = LLVector3(mat.mMatrix[2]); } diff --git a/indra/newview/llviewerkeyboard.cpp b/indra/newview/llviewerkeyboard.cpp index db0da19927..b885e4e6b9 100644 --- a/indra/newview/llviewerkeyboard.cpp +++ b/indra/newview/llviewerkeyboard.cpp @@ -170,7 +170,7 @@ void agent_slide_right( EKeystate s ) void agent_turn_left( EKeystate s ) { - if (gToolCamera->mouseSteerMode()) + if (LLToolCamera::getInstance()->mouseSteerMode()) { agent_slide_left(s); } @@ -185,7 +185,7 @@ void agent_turn_left( EKeystate s ) void agent_turn_right( EKeystate s ) { - if (gToolCamera->mouseSteerMode()) + if (LLToolCamera::getInstance()->mouseSteerMode()) { agent_slide_right(s); } @@ -499,7 +499,7 @@ void start_chat( EKeystate s ) void start_gesture( EKeystate s ) { if (KEYSTATE_UP == s && - !gChatBar->inputEditorHasFocus()) + !(gFocusMgr.getKeyboardFocus() && gFocusMgr.getKeyboardFocus()->acceptsTextInput())) { if (gChatBar->getCurrentChat().empty()) { diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 77cfd63847..a1181ccf3a 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -173,7 +173,7 @@ #include "lltoolpie.h" #include "lltoolplacer.h" #include "lltoolselectland.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "lluploaddialog.h" #include "lluserauth.h" #include "lluuid.h" @@ -571,12 +571,12 @@ static LLLandmarkObserver* gLandmarkObserver = NULL; LLMenuParcelObserver::LLMenuParcelObserver() { - gParcelMgr->addObserver(this); + LLViewerParcelMgr::getInstance()->addObserver(this); } LLMenuParcelObserver::~LLMenuParcelObserver() { - gParcelMgr->removeObserver(this); + LLViewerParcelMgr::getInstance()->removeObserver(this); } void LLMenuParcelObserver::changed() @@ -668,23 +668,23 @@ void init_menus() /// /// Pie menus /// - gPieSelf = gUICtrlFactory->buildPieMenu("menu_pie_self.xml", gMenuHolder); + gPieSelf = LLUICtrlFactory::getInstance()->buildPieMenu("menu_pie_self.xml", gMenuHolder); // TomY TODO: what shall we do about these? gDetachScreenPieMenu = gMenuHolder->getChild<LLPieMenu>("Object Detach HUD", true); gDetachPieMenu = gMenuHolder->getChild<LLPieMenu>("Object Detach", true); - gPieAvatar = gUICtrlFactory->buildPieMenu("menu_pie_avatar.xml", gMenuHolder); + gPieAvatar = LLUICtrlFactory::getInstance()->buildPieMenu("menu_pie_avatar.xml", gMenuHolder); - gPieObject = gUICtrlFactory->buildPieMenu("menu_pie_object.xml", gMenuHolder); + gPieObject = LLUICtrlFactory::getInstance()->buildPieMenu("menu_pie_object.xml", gMenuHolder); gAttachScreenPieMenu = gMenuHolder->getChild<LLPieMenu>("Object Attach HUD"); gAttachPieMenu = gMenuHolder->getChild<LLPieMenu>("Object Attach"); gPieRate = gMenuHolder->getChild<LLPieMenu>("Rate Menu"); - gPieAttachment = gUICtrlFactory->buildPieMenu("menu_pie_attachment.xml", gMenuHolder); + gPieAttachment = LLUICtrlFactory::getInstance()->buildPieMenu("menu_pie_attachment.xml", gMenuHolder); - gPieLand = gUICtrlFactory->buildPieMenu("menu_pie_land.xml", gMenuHolder); + gPieLand = LLUICtrlFactory::getInstance()->buildPieMenu("menu_pie_land.xml", gMenuHolder); /// /// set up the colors @@ -710,7 +710,7 @@ void init_menus() { color = gColors.getColor( "MenuNonProductionBgColor" ); } - gMenuBarView = (LLMenuBarGL*)gUICtrlFactory->buildMenu("menu_viewer.xml", gMenuHolder); + gMenuBarView = (LLMenuBarGL*)LLUICtrlFactory::getInstance()->buildMenu("menu_viewer.xml", gMenuHolder); gMenuBarView->setRect(LLRect(0, top, 0, top - MENU_BAR_HEIGHT)); gMenuBarView->setBackgroundColor( color ); @@ -775,7 +775,7 @@ void init_menus() // show_debug_menus(); - gLoginMenuBarView = (LLMenuBarGL*)gUICtrlFactory->buildMenu("menu_login.xml", gMenuHolder); + gLoginMenuBarView = (LLMenuBarGL*)LLUICtrlFactory::getInstance()->buildMenu("menu_login.xml", gMenuHolder); LLRect menuBarRect = gLoginMenuBarView->getRect(); gLoginMenuBarView->setRect(LLRect(menuBarRect.mLeft, menuBarRect.mTop, gViewerWindow->getRootView()->getRect().getWidth() - menuBarRect.mLeft, menuBarRect.mBottom)); @@ -832,14 +832,12 @@ void clear_landmark_menu(LLMenuGL* menu) for ( ; it != child_list->end(); ++it) { LLView* view = *it; - if (view->getWidgetType() == WIDGET_TYPE_MENU_ITEM_CALL) + LLMenuItemCallGL* menu_item = dynamic_cast<LLMenuItemCallGL*>(view); + + if (menu_item && menu_item->getMenuCallback() == landmark_menu_action) { - LLMenuItemCallGL* menu_item = (LLMenuItemCallGL*)view; - if (menu_item->getMenuCallback() == landmark_menu_action) - { - void* user_data = menu_item->getUserData(); - delete (LLUUID*)user_data; - } + void* user_data = menu_item->getUserData(); + delete (LLUUID*)user_data; } } @@ -1427,7 +1425,7 @@ void init_debug_rendering_menu(LLMenuGL* menu) LLMenuItemCheckGL* item; item = new LLMenuItemCheckGL("Object-Object Occlusion", menu_toggle_control, NULL, menu_check_control, (void*)"UseOcclusion", 'O', MASK_CONTROL|MASK_SHIFT); - item->setEnabled(gGLManager.mHasOcclusionQuery && gFeatureManagerp->isFeatureAvailable("UseOcclusion")); + item->setEnabled(gGLManager.mHasOcclusionQuery && LLFeatureManager::getInstance()->isFeatureAvailable("UseOcclusion")); menu->append(item); item = new LLMenuItemCheckGL("Fast Alpha", menu_toggle_control, NULL, menu_check_control, (void*)"RenderFastAlpha"); @@ -1739,7 +1737,7 @@ class LLObjectEnableTouch : public view_listener_t gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); // Update label based on the node touch name if available. - LLSelectNode* node = gSelectMgr->getSelection()->getFirstRootNode(); + LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); if (node && node->mValid && !node->mTouchName.empty()) { gMenuHolder->childSetText("Object Touch", node->mTouchName); @@ -1755,7 +1753,7 @@ class LLObjectEnableTouch : public view_listener_t void label_touch(LLString& label, void*) { - LLSelectNode* node = gSelectMgr->getSelection()->getFirstRootNode(); + LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); if (node && node->mValid && !node->mTouchName.empty()) { label.assign(node->mTouchName); @@ -1807,7 +1805,7 @@ class LLViewCheckBuildMode : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - bool new_value = gToolMgr->inEdit(); + bool new_value = LLToolMgr::getInstance()->inEdit(); gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } @@ -1815,7 +1813,7 @@ class LLViewCheckBuildMode : public view_listener_t bool toggle_build_mode() { - if (gToolMgr->inEdit()) + if (LLToolMgr::getInstance()->inEdit()) { // just reset the view, will pull us out of edit mode handle_reset_view(); @@ -1831,8 +1829,8 @@ bool toggle_build_mode() gAgent.cameraOrbitOver( 30.f * DEG_TO_RAD ); } - gToolMgr->setCurrentToolset(gBasicToolset); - gToolMgr->getCurrentToolset()->selectTool( gToolCreate ); + LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); + LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolCompCreate::getInstance() ); // Could be first use LLFirstUse::useBuild(); @@ -1853,7 +1851,7 @@ class LLObjectBuild : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - if (gAgent.getFocusOnAvatar() && !gToolMgr->inEdit() && gSavedSettings.getBOOL("EditCameraMovement") ) + if (gAgent.getFocusOnAvatar() && !LLToolMgr::getInstance()->inEdit() && gSavedSettings.getBOOL("EditCameraMovement") ) { // zoom in if we're looking at the avatar gAgent.setFocusOnAvatar(FALSE, ANIMATE); @@ -1868,8 +1866,8 @@ class LLObjectBuild : public view_listener_t gViewerWindow->moveCursorToCenter(); } - gToolMgr->setCurrentToolset(gBasicToolset); - gToolMgr->getCurrentToolset()->selectTool( gToolCreate ); + LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); + LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolCompCreate::getInstance() ); // Could be first use LLFirstUse::useBuild(); @@ -1881,11 +1879,11 @@ class LLObjectEdit : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - gParcelMgr->deselectLand(); + LLViewerParcelMgr::getInstance()->deselectLand(); - if (gAgent.getFocusOnAvatar() && !gToolMgr->inEdit()) + if (gAgent.getFocusOnAvatar() && !LLToolMgr::getInstance()->inEdit()) { - LLObjectSelectionHandle selection = gSelectMgr->getSelection(); + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); if (selection->getSelectType() == SELECT_TYPE_HUD || !gSavedSettings.getBOOL("EditCameraMovement")) { @@ -1907,8 +1905,8 @@ class LLObjectEdit : public view_listener_t gFloaterTools->open(); /* Flawfinder: ignore */ - gToolMgr->setCurrentToolset(gBasicToolset); - gFloaterTools->setEditTool( gToolTranslate ); + LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); + gFloaterTools->setEditTool( LLToolCompTranslate::getInstance() ); // Could be first use LLFirstUse::useBuild(); @@ -1933,9 +1931,9 @@ class LLLandBuild : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - gParcelMgr->deselectLand(); + LLViewerParcelMgr::getInstance()->deselectLand(); - if (gAgent.getFocusOnAvatar() && !gToolMgr->inEdit() && gSavedSettings.getBOOL("EditCameraMovement") ) + if (gAgent.getFocusOnAvatar() && !LLToolMgr::getInstance()->inEdit() && gSavedSettings.getBOOL("EditCameraMovement") ) { // zoom in if we're looking at the avatar gAgent.setFocusOnAvatar(FALSE, ANIMATE); @@ -1952,8 +1950,8 @@ class LLLandBuild : public view_listener_t } - gToolMgr->setCurrentToolset(gBasicToolset); - gToolMgr->getCurrentToolset()->selectTool( gToolCreate ); + LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); + LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolCompCreate::getInstance() ); // Could be first use LLFirstUse::useBuild(); @@ -1987,7 +1985,7 @@ BOOL enable_land_build(void*) if (gAgent.inPrelude()) return FALSE; BOOL can_build = FALSE; - LLParcel* agent_parcel = gParcelMgr->getAgentParcel(); + LLParcel* agent_parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if (agent_parcel) { can_build = agent_parcel->getAllowModify(); @@ -2002,7 +2000,7 @@ BOOL enable_object_build(void*) if (gAgent.inPrelude()) return FALSE; BOOL can_build = FALSE; - LLParcel* agent_parcel = gParcelMgr->getAgentParcel(); + LLParcel* agent_parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if (agent_parcel) { can_build = agent_parcel->getAllowModify(); @@ -2123,7 +2121,7 @@ class LLObjectMute : public view_listener_t // it's an object id = object->getID(); - LLSelectNode* node = gSelectMgr->getSelection()->getFirstRootNode(); + LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); if (node) { name = node->mName; @@ -2133,13 +2131,13 @@ class LLObjectMute : public view_listener_t } LLMute mute(id, name, type); - if (gMuteListp->isMuted(mute.mID, mute.mName)) + if (LLMuteList::getInstance()->isMuted(mute.mID, mute.mName)) { - gMuteListp->remove(mute); + LLMuteList::getInstance()->remove(mute); } else { - gMuteListp->add(mute); + LLMuteList::getInstance()->add(mute); LLFloaterMute::showInstance(); } @@ -2160,7 +2158,7 @@ bool handle_go_to() strings.push_back(val); send_generic_message("autopilot", strings); - gParcelMgr->deselectLand(); + LLViewerParcelMgr::getInstance()->deselectLand(); if (gAgent.getAvatarObject() && !gSavedSettings.getBOOL("AutoPilotLocksCamera")) { @@ -2516,9 +2514,9 @@ BOOL enable_buy(void*) { // In order to buy, there must only be 1 purchaseable object in // the selection manger. - if(gSelectMgr->getSelection()->getRootObjectCount() != 1) return FALSE; + if(LLSelectMgr::getInstance()->getSelection()->getRootObjectCount() != 1) return FALSE; LLViewerObject* obj = NULL; - LLSelectNode* node = gSelectMgr->getSelection()->getFirstRootNode(); + LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); if(node) { obj = node->getObject(); @@ -2547,7 +2545,7 @@ class LLObjectEnableBuy : public view_listener_t // received by the viewer and cached in the selection manager. void handle_buy_object(LLSaleInfo sale_info) { - if(!gSelectMgr->selectGetAllRootsValid()) + if(!LLSelectMgr::getInstance()->selectGetAllRootsValid()) { LLNotifyBox::showXml("UnableToBuyWhileDownloading"); return; @@ -2555,7 +2553,7 @@ void handle_buy_object(LLSaleInfo sale_info) LLUUID owner_id; LLString owner_name; - BOOL owners_identical = gSelectMgr->selectGetOwner(owner_id, owner_name); + BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name); if (!owners_identical) { LLNotifyBox::showXml("CannotBuyObjectsFromDifferentOwners"); @@ -2563,9 +2561,9 @@ void handle_buy_object(LLSaleInfo sale_info) } LLPermissions perm; - BOOL valid = gSelectMgr->selectGetPermissions(perm); + BOOL valid = LLSelectMgr::getInstance()->selectGetPermissions(perm); LLAggregatePermissions ag_perm; - valid &= gSelectMgr->selectGetAggregatePermissions(ag_perm); + valid &= LLSelectMgr::getInstance()->selectGetAggregatePermissions(ag_perm); if(!valid || !sale_info.isForSale() || !perm.allowTransferTo(gAgent.getID())) { LLNotifyBox::showXml("ObjectNotForSale"); @@ -2702,14 +2700,14 @@ void set_god_level(U8 god_level) U8 old_god_level = gAgent.getGodLevel(); gAgent.setGodLevel( god_level ); gIMMgr->refresh(); - gParcelMgr->notifyObservers(); + LLViewerParcelMgr::getInstance()->notifyObservers(); // Some classifieds change visibility on god mode LLFloaterDirectory::requestClassifieds(); // God mode changes sim visibility - gWorldMap->reset(); - gWorldMap->setCurrentLayer(0); + LLWorldMap::getInstance()->reset(); + LLWorldMap::getInstance()->setCurrentLayer(0); // inventory in items may change in god mode gObjectList.dirtyAllObjectInventory(); @@ -2975,7 +2973,7 @@ class LLLandSit : public view_listener_t bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); - gParcelMgr->deselectLand(); + LLViewerParcelMgr::getInstance()->deselectLand(); LLVector3d posGlobal = gLastHitPosGlobal; @@ -3075,7 +3073,7 @@ void create_new_landmark(void*) llwarns << "No agent region" << llendl; return; } - LLParcel* agent_parcel = gParcelMgr->getAgentParcel(); + LLParcel* agent_parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if (!agent_parcel) { llwarns << "No agent parcel" << llendl; @@ -3115,7 +3113,7 @@ void landmark_menu_action(void* userdata) void reload_ui(void *) { - gUICtrlFactory->rebuild(); + LLUICtrlFactory::getInstance()->rebuild(); } class LLWorldFly : public view_listener_t @@ -3138,7 +3136,7 @@ void handle_agent_stop_moving(void*) void print_packets_lost(void*) { - gWorldPointer->printPacketsLost(); + LLWorld::getInstance()->printPacketsLost(); } @@ -3187,7 +3185,7 @@ void velocity_interpolate( void* data ) void update_fov(S32 increments) { - F32 old_fov = gCamera->getDefaultFOV(); + F32 old_fov = LLViewerCamera::getInstance()->getDefaultFOV(); // for each increment, FoV is 20% bigger F32 new_fov = old_fov * pow(1.2f, increments); @@ -3210,8 +3208,8 @@ void update_fov(S32 increments) gAgent.sendReliableMessage(); // force agent to update dirty patches - gCamera->setDefaultFOV(new_fov); - gCamera->setView(new_fov); + LLViewerCamera::getInstance()->setDefaultFOV(new_fov); + LLViewerCamera::getInstance()->setView(new_fov); } } @@ -3237,7 +3235,7 @@ class LLViewZoomDefault : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - F32 old_fov = gCamera->getView(); + F32 old_fov = LLViewerCamera::getInstance()->getView(); // for each increment, FoV is 20% bigger F32 new_fov = DEFAULT_FIELD_OF_VIEW; @@ -3256,8 +3254,8 @@ class LLViewZoomDefault : public view_listener_t gAgent.sendReliableMessage(); // force agent to update dirty patches - gCamera->setDefaultFOV(new_fov); - gCamera->setView(new_fov); + LLViewerCamera::getInstance()->setDefaultFOV(new_fov); + LLViewerCamera::getInstance()->setView(new_fov); } return true; } @@ -3342,7 +3340,7 @@ void reset_view_final( BOOL proceed, void* ) gViewerWindow->showCursor(); // Switch back to basic toolset - gToolMgr->setCurrentToolset(gBasicToolset); + LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); } class LLViewLookAtLastChatter : public view_listener_t @@ -3415,7 +3413,7 @@ class LLEditEnableDuplicate : public view_listener_t void disabled_duplicate(void*) { - if (gSelectMgr->getSelection()->getFirstObject()) + if (LLSelectMgr::getInstance()->getSelection()->getFirstObject()) { LLNotifyBox::showXml("CopyFailed"); } @@ -3426,32 +3424,32 @@ void handle_duplicate_in_place(void*) llinfos << "handle_duplicate_in_place" << llendl; LLVector3 offset(0.f, 0.f, 0.f); - gSelectMgr->selectDuplicate(offset, TRUE); + LLSelectMgr::getInstance()->selectDuplicate(offset, TRUE); } void handle_repeat_duplicate(void*) { - gSelectMgr->repeatDuplicate(); + LLSelectMgr::getInstance()->repeatDuplicate(); } void handle_deed_object_to_group(void*) { LLUUID group_id; - gSelectMgr->selectGetGroup(group_id); - gSelectMgr->sendOwner(LLUUID::null, group_id, FALSE); - gViewerStats->incStat(LLViewerStats::ST_RELEASE_COUNT); + LLSelectMgr::getInstance()->selectGetGroup(group_id); + LLSelectMgr::getInstance()->sendOwner(LLUUID::null, group_id, FALSE); + LLViewerStats::getInstance()->incStat(LLViewerStats::ST_RELEASE_COUNT); } BOOL enable_deed_object_to_group(void*) { - if(gSelectMgr->getSelection()->isEmpty()) return FALSE; + if(LLSelectMgr::getInstance()->getSelection()->isEmpty()) return FALSE; LLPermissions perm; LLUUID group_id; - if (gSelectMgr->selectGetGroup(group_id) && + if (LLSelectMgr::getInstance()->selectGetGroup(group_id) && gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED) && - gSelectMgr->selectGetPermissions(perm) && + LLSelectMgr::getInstance()->selectGetPermissions(perm) && perm.deedToGroup(gAgent.getID(), group_id)) { return TRUE; @@ -3504,8 +3502,8 @@ void handle_object_owner_permissive(void*) if(gAgent.isGodlike()) { // do the objects. - gSelectMgr->selectionSetObjectPermissions(PERM_BASE, TRUE, PERM_ALL, TRUE); - gSelectMgr->selectionSetObjectPermissions(PERM_OWNER, TRUE, PERM_ALL, TRUE); + LLSelectMgr::getInstance()->selectionSetObjectPermissions(PERM_BASE, TRUE, PERM_ALL, TRUE); + LLSelectMgr::getInstance()->selectionSetObjectPermissions(PERM_OWNER, TRUE, PERM_ALL, TRUE); } } @@ -3514,14 +3512,14 @@ void handle_object_owner_self(void*) // only send this if they're a god. if(gAgent.isGodlike()) { - gSelectMgr->sendOwner(gAgent.getID(), gAgent.getGroupID(), TRUE); + LLSelectMgr::getInstance()->sendOwner(gAgent.getID(), gAgent.getGroupID(), TRUE); } } // Shortcut to set owner permissions to not editable. void handle_object_lock(void*) { - gSelectMgr->selectionSetObjectPermissions(PERM_OWNER, FALSE, PERM_MODIFY); + LLSelectMgr::getInstance()->selectionSetObjectPermissions(PERM_OWNER, FALSE, PERM_MODIFY); } void handle_object_asset_ids(void*) @@ -3529,23 +3527,23 @@ void handle_object_asset_ids(void*) // only send this if they're a god. if (gAgent.isGodlike()) { - gSelectMgr->sendGodlikeRequest("objectinfo", "assetids"); + LLSelectMgr::getInstance()->sendGodlikeRequest("objectinfo", "assetids"); } } void handle_force_parcel_owner_to_me(void*) { - gParcelMgr->sendParcelGodForceOwner( gAgent.getID() ); + LLViewerParcelMgr::getInstance()->sendParcelGodForceOwner( gAgent.getID() ); } void handle_force_parcel_to_content(void*) { - gParcelMgr->sendParcelGodForceToContent(); + LLViewerParcelMgr::getInstance()->sendParcelGodForceToContent(); } void handle_claim_public_land(void*) { - if (gParcelMgr->getSelectionRegion() != gAgent.getRegion()) + if (LLViewerParcelMgr::getInstance()->getSelectionRegion() != gAgent.getRegion()) { LLNotifyBox::showXml("ClaimPublicLand"); return; @@ -3553,7 +3551,7 @@ void handle_claim_public_land(void*) LLVector3d west_south_global; LLVector3d east_north_global; - gParcelMgr->getSelection(west_south_global, east_north_global); + LLViewerParcelMgr::getInstance()->getSelection(west_south_global, east_north_global); LLVector3 west_south = gAgent.getPosAgentFromGlobal(west_south_global); LLVector3 east_north = gAgent.getPosAgentFromGlobal(east_north_global); @@ -3586,7 +3584,7 @@ void handle_god_request_havok(void *) { if (gAgent.isGodlike()) { - gSelectMgr->sendGodlikeRequest("havok", "infoverbose"); + LLSelectMgr::getInstance()->sendGodlikeRequest("havok", "infoverbose"); } } @@ -3594,7 +3592,7 @@ void handle_god_request_havok(void *) //{ // if (gAgent.isGodlike()) // { -// gSelectMgr->sendGodlikeRequest(GOD_WANTS_FOO); +// LLSelectMgr::getInstance()->sendGodlikeRequest(GOD_WANTS_FOO); // } //} @@ -3602,7 +3600,7 @@ void handle_god_request_havok(void *) //{ // if (gAgent.isGodlike()) // { -// gSelectMgr->sendGodlikeRequest("terrain", "save"); +// LLSelectMgr::getInstance()->sendGodlikeRequest("terrain", "save"); // } //} @@ -3610,7 +3608,7 @@ void handle_god_request_havok(void *) //{ // if (gAgent.isGodlike()) // { -// gSelectMgr->sendGodlikeRequest("terrain", "load"); +// LLSelectMgr::getInstance()->sendGodlikeRequest("terrain", "load"); // } //} @@ -3620,7 +3618,7 @@ void handle_god_request_avatar_geometry(void *) { if (gAgent.isGodlike()) { - gSelectMgr->sendGodlikeRequest("avatar toggle", NULL); + LLSelectMgr::getInstance()->sendGodlikeRequest("avatar toggle", NULL); } } @@ -3645,8 +3643,8 @@ void derez_objects(EDeRezDestination dest, const LLUUID& dest_id) // Check conditions that we can't deal with, building a list of // everything that we'll actually be derezzing. LLViewerRegion* first_region = NULL; - for (LLObjectSelection::valid_root_iterator iter = gSelectMgr->getSelection()->valid_root_begin(); - iter != gSelectMgr->getSelection()->valid_root_end(); iter++) + for (LLObjectSelection::valid_root_iterator iter = LLSelectMgr::getInstance()->getSelection()->valid_root_begin(); + iter != LLSelectMgr::getInstance()->getSelection()->valid_root_end(); iter++) { LLSelectNode* node = *iter; LLViewerObject* object = node->getObject(); @@ -3763,7 +3761,7 @@ void derez_objects(EDeRezDestination dest, const LLUUID& dest_id) msg->nextBlockFast(_PREHASH_ObjectData); msg->addU32Fast(_PREHASH_ObjectLocalID, object->getLocalID()); // VEFFECT: DerezObject - LLHUDEffectSpiral* effectp = (LLHUDEffectSpiral*)gHUDManager->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE); + LLHUDEffectSpiral* effectp = (LLHUDEffectSpiral*)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE); effectp->setPositionGlobal(object->getPositionGlobal()); effectp->setColor(LLColor4U(gAgent.getEffectColor())); } @@ -3788,7 +3786,7 @@ class LLToolsTakeCopy : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - if (gSelectMgr->getSelection()->isEmpty()) return true; + if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) return true; const LLUUID& category_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_OBJECT); derez_objects(DRD_ACQUIRE_TO_AGENT_INVENTORY, category_id); @@ -3803,9 +3801,9 @@ class LLObjectReturn : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - if (gSelectMgr->getSelection()->isEmpty()) return true; + if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) return true; - mObjectSelection = gSelectMgr->getEditSelection(); + mObjectSelection = LLSelectMgr::getInstance()->getEditSelection(); gViewerWindow->alertXml("ReturnToOwner", onReturnToOwner, @@ -3868,7 +3866,7 @@ class LLObjectEnableReturn : public view_listener_t } } func; const bool firstonly = true; - new_value = gSelectMgr->getSelection()->applyToRootObjects(&func, firstonly); + new_value = LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func, firstonly); } } } @@ -3880,7 +3878,7 @@ class LLObjectEnableReturn : public view_listener_t void force_take_copy(void*) { - if (gSelectMgr->getSelection()->isEmpty()) return; + if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) return; const LLUUID& category_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_OBJECT); derez_objects(DRD_FORCE_TO_GOD_INVENTORY, category_id); } @@ -3889,7 +3887,7 @@ void handle_take() { // we want to use the folder this was derezzed from if it's // available. Otherwise, derez to the normal place. - if(gSelectMgr->getSelection()->isEmpty()) + if(LLSelectMgr::getInstance()->getSelection()->isEmpty()) { return; } @@ -3898,8 +3896,8 @@ void handle_take() BOOL locked_but_takeable_object = FALSE; LLUUID category_id; - for (LLObjectSelection::root_iterator iter = gSelectMgr->getSelection()->root_begin(); - iter != gSelectMgr->getSelection()->root_end(); iter++) + for (LLObjectSelection::root_iterator iter = LLSelectMgr::getInstance()->getSelection()->root_begin(); + iter != LLSelectMgr::getInstance()->getSelection()->root_end(); iter++) { LLSelectNode* node = *iter; LLViewerObject* object = node->getObject(); @@ -4015,8 +4013,8 @@ BOOL enable_take() return FALSE; } - for (LLObjectSelection::valid_root_iterator iter = gSelectMgr->getSelection()->valid_root_begin(); - iter != gSelectMgr->getSelection()->valid_root_end(); iter++) + for (LLObjectSelection::valid_root_iterator iter = LLSelectMgr::getInstance()->getSelection()->valid_root_begin(); + iter != LLSelectMgr::getInstance()->getSelection()->valid_root_end(); iter++) { LLSelectNode* node = *iter; LLViewerObject* object = node->getObject(); @@ -4051,7 +4049,7 @@ class LLToolsBuyOrTake : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - if (gSelectMgr->getSelection()->isEmpty()) + if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) { return true; } @@ -4130,8 +4128,8 @@ class LLToolsEnableBuyOrTake : public view_listener_t // FALSE if selection is a 'take' BOOL is_selection_buy_not_take() { - for (LLObjectSelection::root_iterator iter = gSelectMgr->getSelection()->root_begin(); - iter != gSelectMgr->getSelection()->root_end(); iter++) + for (LLObjectSelection::root_iterator iter = LLSelectMgr::getInstance()->getSelection()->root_begin(); + iter != LLSelectMgr::getInstance()->getSelection()->root_end(); iter++) { LLSelectNode* node = *iter; LLViewerObject* obj = node->getObject(); @@ -4148,8 +4146,8 @@ BOOL is_selection_buy_not_take() S32 selection_price() { S32 total_price = 0; - for (LLObjectSelection::root_iterator iter = gSelectMgr->getSelection()->root_begin(); - iter != gSelectMgr->getSelection()->root_end(); iter++) + for (LLObjectSelection::root_iterator iter = LLSelectMgr::getInstance()->getSelection()->root_begin(); + iter != LLSelectMgr::getInstance()->getSelection()->root_end(); iter++) { LLSelectNode* node = *iter; LLViewerObject* obj = node->getObject(); @@ -4202,10 +4200,10 @@ void handle_buy_currency(void*) void handle_buy(void*) { - if (gSelectMgr->getSelection()->isEmpty()) return; + if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) return; LLSaleInfo sale_info; - BOOL valid = gSelectMgr->selectGetSaleInfo(sale_info); + BOOL valid = LLSelectMgr::getInstance()->selectGetSaleInfo(sale_info); if (!valid) return; if (sale_info.getSaleType() == LLSaleInfo::FS_CONTENTS) @@ -4229,7 +4227,7 @@ class LLObjectBuy : public view_listener_t BOOL sitting_on_selection() { - LLSelectNode* node = gSelectMgr->getSelection()->getFirstRootNode(); + LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); if (!node) { return FALSE; @@ -4272,14 +4270,11 @@ class LLToolsSaveToObjectInventory : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - if(gSelectMgr) + LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); + if(node && (node->mValid) && (!node->mFromTaskID.isNull())) { - LLSelectNode* node = gSelectMgr->getSelection()->getFirstRootNode(); - if(node && (node->mValid) && (!node->mFromTaskID.isNull())) - { - // *TODO: check to see if the fromtaskid object exists. - derez_objects(DRD_SAVE_INTO_TASK_INVENTORY, node->mFromTaskID); - } + // *TODO: check to see if the fromtaskid object exists. + derez_objects(DRD_SAVE_INTO_TASK_INVENTORY, node->mFromTaskID); } return true; } @@ -4292,8 +4287,8 @@ class LLToolsSnapObjectXY : public view_listener_t { F64 snap_size = (F64)gSavedSettings.getF32("GridResolution"); - for (LLObjectSelection::root_iterator iter = gSelectMgr->getSelection()->root_begin(); - iter != gSelectMgr->getSelection()->root_end(); iter++) + for (LLObjectSelection::root_iterator iter = LLSelectMgr::getInstance()->getSelection()->root_begin(); + iter != LLSelectMgr::getInstance()->getSelection()->root_end(); iter++) { LLSelectNode* node = *iter; LLViewerObject* obj = node->getObject(); @@ -4327,7 +4322,7 @@ class LLToolsSnapObjectXY : public view_listener_t obj->setPositionGlobal(pos_global, FALSE); } } - gSelectMgr->sendMultipleUpdate(UPD_POSITION); + LLSelectMgr::getInstance()->sendMultipleUpdate(UPD_POSITION); return true; } }; @@ -4351,7 +4346,7 @@ class LLToolsEnableLink : public view_listener_t // in component mode, can't link if (!gSavedSettings.getBOOL("EditLinkedParts")) { - if(gSelectMgr->selectGetAllRootsValid() && gSelectMgr->getSelection()->getRootObjectCount() >= 2) + if(LLSelectMgr::getInstance()->selectGetAllRootsValid() && LLSelectMgr::getInstance()->getSelection()->getRootObjectCount() >= 2) { struct f : public LLSelectedObjectFunctor { @@ -4361,7 +4356,7 @@ class LLToolsEnableLink : public view_listener_t } } func; const bool firstonly = true; - new_value = gSelectMgr->getSelection()->applyToRootObjects(&func, firstonly); + new_value = LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func, firstonly); } } gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); @@ -4373,13 +4368,13 @@ class LLToolsLink : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - if(!gSelectMgr->selectGetAllRootsValid()) + if(!LLSelectMgr::getInstance()->selectGetAllRootsValid()) { LLNotifyBox::showXml("UnableToLinkWhileDownloading"); return true; } - S32 object_count = gSelectMgr->getSelection()->getObjectCount(); + S32 object_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount(); if (object_count > MAX_CHILDREN_PER_TASK + 1) { LLStringBase<char>::format_map_t args; @@ -4390,19 +4385,19 @@ class LLToolsLink : public view_listener_t return true; } - if(gSelectMgr->getSelection()->getRootObjectCount() < 2) + if(LLSelectMgr::getInstance()->getSelection()->getRootObjectCount() < 2) { gViewerWindow->alertXml("CannotLinkIncompleteSet"); return true; } - if(!gSelectMgr->selectGetRootsModify()) + if(!LLSelectMgr::getInstance()->selectGetRootsModify()) { gViewerWindow->alertXml("CannotLinkModify"); return true; } LLUUID owner_id; LLString owner_name; - if(!gSelectMgr->selectGetOwner(owner_id, owner_name)) + if(!LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name)) { // we don't actually care if you're the owner, but novices are // the most likely to be stumped by this one, so offer the @@ -4410,7 +4405,7 @@ class LLToolsLink : public view_listener_t gViewerWindow->alertXml("CannotLinkDifferentOwners"); return true; } - gSelectMgr->sendLink(); + LLSelectMgr::getInstance()->sendLink(); return true; } }; @@ -4419,9 +4414,9 @@ class LLToolsEnableUnlink : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - bool new_value = gSelectMgr->selectGetAllRootsValid() && - gSelectMgr->getSelection()->getFirstEditableObject() && - !gSelectMgr->getSelection()->getFirstEditableObject()->isAttachment(); + bool new_value = LLSelectMgr::getInstance()->selectGetAllRootsValid() && + LLSelectMgr::getInstance()->getSelection()->getFirstEditableObject() && + !LLSelectMgr::getInstance()->getSelection()->getFirstEditableObject()->isAttachment(); gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } @@ -4431,7 +4426,7 @@ class LLToolsUnlink : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - gSelectMgr->sendDelink(); + LLSelectMgr::getInstance()->sendDelink(); return true; } }; @@ -4454,32 +4449,32 @@ class LLToolsStopAllAnimations : public view_listener_t //void handle_hinge(void*) //{ -// gSelectMgr->sendHinge(1); +// LLSelectMgr::getInstance()->sendHinge(1); //} //void handle_ptop(void*) //{ -// gSelectMgr->sendHinge(2); +// LLSelectMgr::getInstance()->sendHinge(2); //} //void handle_lptop(void*) //{ -// gSelectMgr->sendHinge(3); +// LLSelectMgr::getInstance()->sendHinge(3); //} //void handle_wheel(void*) //{ -// gSelectMgr->sendHinge(4); +// LLSelectMgr::getInstance()->sendHinge(4); //} //void handle_dehinge(void*) //{ -// gSelectMgr->sendDehinge(); +// LLSelectMgr::getInstance()->sendDehinge(); //} //BOOL enable_dehinge(void*) //{ -// LLViewerObject* obj = gSelectMgr->getSelection()->getFirstEditableObject(); +// LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getFirstEditableObject(); // return obj && !obj->isAttachment(); //} @@ -4593,7 +4588,7 @@ class LLObjectEnableDelete : public view_listener_t (!LLAppViewer::instance()->isInProductionGrid() && gAgent.isGodlike()) || # endif - (gSelectMgr && gSelectMgr->canDoDelete()); + LLSelectMgr::getInstance()->canDoDelete(); #endif gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; @@ -4613,9 +4608,9 @@ class LLObjectDelete : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - if (gSelectMgr) + if (LLSelectMgr::getInstance()) { - gSelectMgr->doDelete(); + LLSelectMgr::getInstance()->doDelete(); } // and close any pie/context menus when done @@ -4630,7 +4625,7 @@ class LLObjectDelete : public view_listener_t void handle_force_delete(void*) { - gSelectMgr->selectForceDelete(); + LLSelectMgr::getInstance()->selectForceDelete(); } class LLViewEnableLastChatter : public view_listener_t @@ -4738,7 +4733,7 @@ class LLEditRedo : public view_listener_t void print_object_info(void*) { - gSelectMgr->selectionDump(); + LLSelectMgr::getInstance()->selectionDump(); } void print_agent_nvpairs(void*) @@ -4818,7 +4813,7 @@ LLUploadDialog *gExportDialog = NULL; void handle_export_selected( void * ) { - LLObjectSelectionHandle selection = gSelectMgr->getSelection(); + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); if (selection->isEmpty()) { return; @@ -4852,7 +4847,7 @@ void handle_export_selected( void * ) BOOL menu_check_build_tool( void* user_data ) { S32 index = (intptr_t) user_data; - return gToolMgr->getCurrentToolset()->isToolSelected( index ); + return LLToolMgr::getInstance()->getCurrentToolset()->isToolSelected( index ); } void handle_reload_settings(void*) @@ -4965,7 +4960,7 @@ class LLWorldCreateLandmark : public view_listener_t llwarns << "No agent region" << llendl; return true; } - LLParcel* agent_parcel = gParcelMgr->getAgentParcel(); + LLParcel* agent_parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if (!agent_parcel) { llwarns << "No agent parcel" << llendl; @@ -5000,24 +4995,24 @@ class LLToolsLookAtSelection : public view_listener_t { const F32 PADDING_FACTOR = 2.f; BOOL zoom = (userdata.asString() == "zoom"); - if (!gSelectMgr->getSelection()->isEmpty()) + if (!LLSelectMgr::getInstance()->getSelection()->isEmpty()) { gAgent.setFocusOnAvatar(FALSE, ANIMATE); - LLBBox selection_bbox = gSelectMgr->getBBoxOfSelection(); - F32 angle_of_view = llmax(0.1f, gCamera->getAspect() > 1.f ? gCamera->getView() * gCamera->getAspect() : gCamera->getView()); + LLBBox selection_bbox = LLSelectMgr::getInstance()->getBBoxOfSelection(); + F32 angle_of_view = llmax(0.1f, LLViewerCamera::getInstance()->getAspect() > 1.f ? LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect() : LLViewerCamera::getInstance()->getView()); F32 distance = selection_bbox.getExtentLocal().magVec() * PADDING_FACTOR / atan(angle_of_view); - LLVector3 obj_to_cam = gCamera->getOrigin() - selection_bbox.getCenterAgent(); + LLVector3 obj_to_cam = LLViewerCamera::getInstance()->getOrigin() - selection_bbox.getCenterAgent(); obj_to_cam.normVec(); if (zoom) { - gAgent.setCameraPosAndFocusGlobal(gSelectMgr->getSelectionCenterGlobal() + LLVector3d(obj_to_cam * distance), gSelectMgr->getSelectionCenterGlobal(), gSelectMgr->getSelection()->getFirstObject()->mID ); + gAgent.setCameraPosAndFocusGlobal(LLSelectMgr::getInstance()->getSelectionCenterGlobal() + LLVector3d(obj_to_cam * distance), LLSelectMgr::getInstance()->getSelectionCenterGlobal(), LLSelectMgr::getInstance()->getSelection()->getFirstObject()->mID ); } else { - gAgent.setFocusGlobal( gSelectMgr->getSelectionCenterGlobal(), gSelectMgr->getSelection()->getFirstObject()->mID ); + gAgent.setFocusGlobal( LLSelectMgr::getInstance()->getSelectionCenterGlobal(), LLSelectMgr::getInstance()->getSelection()->getFirstObject()->mID ); } } return true; @@ -5113,7 +5108,7 @@ void complete_give_money(S32 option, void* user_data) bool handle_give_money_dialog() { - LLObjectSelectionHandle* handlep = new LLObjectSelectionHandle(gSelectMgr->getSelection()); + LLObjectSelectionHandle* handlep = new LLObjectSelectionHandle(LLSelectMgr::getInstance()->getSelection()); if (gAgent.getBusy()) { // warn users of being in busy mode during a transaction @@ -5189,7 +5184,7 @@ class LLObjectEnableSitOrStand : public view_listener_t } else { - LLSelectNode* node = gSelectMgr->getSelection()->getFirstRootNode(); + LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); if (node && node->mValid && !node->mSitName.empty()) { label.assign(node->mSitName); @@ -5212,7 +5207,7 @@ void edit_ui(void*) void dump_select_mgr(void*) { - gSelectMgr->dump(); + LLSelectMgr::getInstance()->dump(); } void dump_volume_mgr(void*) @@ -5229,7 +5224,7 @@ void dump_inventory(void*) void handle_force_unlock(void*) { // First, make it public. - gSelectMgr->sendOwner(LLUUID::null, LLUUID::null, TRUE); + LLSelectMgr::getInstance()->sendOwner(LLUUID::null, LLUUID::null, TRUE); // Second, lie to the viewer and mark it editable and unowned @@ -5246,7 +5241,7 @@ void handle_force_unlock(void*) return true; } } func; - gSelectMgr->getSelection()->applyToObjects(&func); + LLSelectMgr::getInstance()->getSelection()->applyToObjects(&func); } void handle_dump_followcam(void*) @@ -5350,21 +5345,21 @@ class LLShowFloater : public view_listener_t } else if (floater_name == "about land") { - if (gParcelMgr->selectionEmpty()) + if (LLViewerParcelMgr::getInstance()->selectionEmpty()) { - gParcelMgr->selectParcelAt(gAgent.getPositionGlobal()); + LLViewerParcelMgr::getInstance()->selectParcelAt(gAgent.getPositionGlobal()); } LLFloaterLand::showInstance(); } else if (floater_name == "buy land") { - if (gParcelMgr->selectionEmpty()) + if (LLViewerParcelMgr::getInstance()->selectionEmpty()) { - gParcelMgr->selectParcelAt(gAgent.getPositionGlobal()); + LLViewerParcelMgr::getInstance()->selectParcelAt(gAgent.getPositionGlobal()); } - gParcelMgr->startBuyLand(); + LLViewerParcelMgr::getInstance()->startBuyLand(); } else if (floater_name == "about region") { @@ -5611,8 +5606,8 @@ void handle_focus(void *) gViewerWindow->moveCursorToCenter(); // Switch to camera toolset -// gToolMgr->setCurrentToolset(gCameraToolset); - gToolMgr->getCurrentToolset()->selectTool( gToolCamera ); +// LLToolMgr::getInstance()->setCurrentToolset(gCameraToolset); + LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolCamera::getInstance() ); } class LLLandEdit : public view_listener_t @@ -5635,13 +5630,13 @@ class LLLandEdit : public view_listener_t } - gParcelMgr->selectParcelAt( gLastHitPosGlobal ); + LLViewerParcelMgr::getInstance()->selectParcelAt( gLastHitPosGlobal ); gFloaterTools->showMore(TRUE); gFloaterView->bringToFront( gFloaterTools ); // Switch to land edit toolset - gToolMgr->getCurrentToolset()->selectTool( gToolParcel ); + LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolSelectLand::getInstance() ); return true; } }; @@ -5650,10 +5645,10 @@ class LLWorldEnableBuyLand : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - bool new_value = gParcelMgr->canAgentBuyParcel( - gParcelMgr->selectionEmpty() - ? gParcelMgr->getAgentParcel() - : gParcelMgr->getParcelSelection()->getParcel(), + bool new_value = LLViewerParcelMgr::getInstance()->canAgentBuyParcel( + LLViewerParcelMgr::getInstance()->selectionEmpty() + ? LLViewerParcelMgr::getInstance()->getAgentParcel() + : LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel(), false); gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; @@ -5662,8 +5657,8 @@ class LLWorldEnableBuyLand : public view_listener_t BOOL enable_buy_land(void*) { - return gParcelMgr->canAgentBuyParcel( - gParcelMgr->getParcelSelection()->getParcel(), false); + return LLViewerParcelMgr::getInstance()->canAgentBuyParcel( + LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel(), false); } @@ -5684,8 +5679,8 @@ void handle_move(void*) gViewerWindow->moveCursorToCenter(); - gToolMgr->setCurrentToolset(gBasicToolset); - gToolMgr->getCurrentToolset()->selectTool( gToolGrab ); + LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); + LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolGrab::getInstance() ); } class LLObjectAttachToAvatar : public view_listener_t @@ -5696,7 +5691,7 @@ public: private: bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - setObjectSelection(gSelectMgr->getSelection()); + setObjectSelection(LLSelectMgr::getInstance()->getSelection()); LLViewerObject* selectedObject = sObjectSelection->getFirstRootObject(); if (selectedObject) { @@ -5739,7 +5734,7 @@ void near_attach_object(BOOL success, void *user_data) // interpret 0 as "default location" attachment_id = 0; } - gSelectMgr->sendAttach(attachment_id); + LLSelectMgr::getInstance()->sendAttach(attachment_id); } LLObjectAttachToAvatar::setObjectSelection(NULL); } @@ -5748,7 +5743,7 @@ void confirm_replace_attachment(S32 option, void* user_data) { if (option == 0/*YES*/) { - LLViewerObject* selectedObject = gSelectMgr->getSelection()->getFirstRootObject(); + LLViewerObject* selectedObject = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject(); if (selectedObject) { const F32 MIN_STOP_DISTANCE = 1.f; // meters @@ -5815,7 +5810,7 @@ class LLAttachmentDrop : public view_listener_t // objects. Thus we need to clear the list, make sure it only // contains the object the user clicked, send the message, // then clear the list. - gSelectMgr->sendDropAttachment(); + LLSelectMgr::getInstance()->sendDropAttachment(); return true; } }; @@ -5918,9 +5913,9 @@ class LLAttachmentDetach : public view_listener_t // We use deselectAll to update the simulator's notion of what's // selected, and removeAll just to change things locally. //RN: I thought it was more useful to detach everything that was selected - if (gSelectMgr->getSelection()->isAttachment()) + if (LLSelectMgr::getInstance()->getSelection()->isAttachment()) { - gSelectMgr->sendDetach(); + LLSelectMgr::getInstance()->sendDetach(); } return true; } @@ -5948,7 +5943,7 @@ class LLAttachmentEnableDrop : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - LLParcel* parcel = gParcelMgr->getAgentParcel(); + LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); BOOL can_build = gAgent.isGodlike() || (parcel && parcel->getAllowModify()); //Add an inventory observer to only allow dropping the newly attached item @@ -6037,11 +6032,7 @@ class LLAttachmentEnableDetach : public view_listener_t BOOL object_selected_and_point_valid(void *user_data) { //LLViewerJointAttachment *attachment = (LLViewerJointAttachment *)user_data; - if (gSelectMgr == NULL) - { - return FALSE; - } - LLObjectSelectionHandle selection = gSelectMgr->getSelection(); + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); for (LLObjectSelection::root_iterator iter = selection->root_begin(); iter != selection->root_end(); iter++) { @@ -6074,9 +6065,9 @@ BOOL object_is_wearable() { return FALSE; } - LLObjectSelectionHandle selection = gSelectMgr->getSelection(); - for (LLObjectSelection::valid_root_iterator iter = gSelectMgr->getSelection()->valid_root_begin(); - iter != gSelectMgr->getSelection()->valid_root_end(); iter++) + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); + for (LLObjectSelection::valid_root_iterator iter = LLSelectMgr::getInstance()->getSelection()->valid_root_begin(); + iter != LLSelectMgr::getInstance()->getSelection()->valid_root_end(); iter++) { LLSelectNode* node = *iter; if (node->mPermissions->getOwner() == gAgent.getID()) @@ -6176,7 +6167,7 @@ void queue_actions(LLFloaterScriptQueue* q, const std::string& noscriptmsg, cons // Apply until an object fails QueueObjects func(q); const bool firstonly = true; - bool fail = gSelectMgr->getSelection()->applyToObjects(&func, firstonly); + bool fail = LLSelectMgr::getInstance()->getSelection()->applyToObjects(&func, firstonly); if(fail) { if ( !func.scripted ) @@ -6254,8 +6245,8 @@ void handle_set_not_run_selection(void*) void handle_selected_texture_info(void*) { - for (LLObjectSelection::valid_iterator iter = gSelectMgr->getSelection()->valid_begin(); - iter != gSelectMgr->getSelection()->valid_end(); iter++) + for (LLObjectSelection::valid_iterator iter = LLSelectMgr::getInstance()->getSelection()->valid_begin(); + iter != LLSelectMgr::getInstance()->getSelection()->valid_end(); iter++) { LLSelectNode* node = *iter; @@ -6423,14 +6414,14 @@ BOOL menu_check_variable( void* user_data) BOOL enable_land_selected( void* ) { - return gParcelMgr && !(gParcelMgr->selectionEmpty()); + return !(LLViewerParcelMgr::getInstance()->selectionEmpty()); } class LLSomethingSelected : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - bool new_value = !(gSelectMgr->getSelection()->isEmpty()); + bool new_value = !(LLSelectMgr::getInstance()->getSelection()->isEmpty()); gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } @@ -6440,7 +6431,7 @@ class LLSomethingSelectedNoHUD : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - LLObjectSelectionHandle selection = gSelectMgr->getSelection(); + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); bool new_value = !(selection->isEmpty()) && !(selection->getSelectType() == SELECT_TYPE_HUD); gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; @@ -6449,14 +6440,14 @@ class LLSomethingSelectedNoHUD : public view_listener_t BOOL enable_more_than_one_selected(void* ) { - return (gSelectMgr->getSelection()->getObjectCount() > 1); + return (LLSelectMgr::getInstance()->getSelection()->getObjectCount() > 1); } class LLEditableSelected : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - bool new_value = (gSelectMgr->getSelection()->getFirstEditableObject() != NULL); + bool new_value = (LLSelectMgr::getInstance()->getSelection()->getFirstEditableObject() != NULL); gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } @@ -6467,7 +6458,7 @@ class LLToolsEnableTakeCopy : public view_listener_t bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { bool all_valid = false; - if (gSelectMgr) + if (LLSelectMgr::getInstance()) { all_valid = true; #ifndef HACKED_GODLIKE_VIEWER @@ -6484,7 +6475,7 @@ class LLToolsEnableTakeCopy : public view_listener_t } } func; const bool firstonly = true; - bool any_invalid = gSelectMgr->getSelection()->applyToRootObjects(&func, firstonly); + bool any_invalid = LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func, firstonly); all_valid = !any_invalid; } #endif // HACKED_GODLIKE_VIEWER @@ -6497,7 +6488,7 @@ class LLToolsEnableTakeCopy : public view_listener_t BOOL enable_selection_you_own_all(void*) { - if (gSelectMgr) + if (LLSelectMgr::getInstance()) { struct f : public LLSelectedObjectFunctor { @@ -6507,7 +6498,7 @@ BOOL enable_selection_you_own_all(void*) } } func; const bool firstonly = true; - bool no_perms = gSelectMgr->getSelection()->applyToRootObjects(&func, firstonly); + bool no_perms = LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func, firstonly); if (no_perms) { return FALSE; @@ -6518,7 +6509,7 @@ BOOL enable_selection_you_own_all(void*) BOOL enable_selection_you_own_one(void*) { - if (gSelectMgr) + if (LLSelectMgr::getInstance()) { struct f : public LLSelectedObjectFunctor { @@ -6528,7 +6519,7 @@ BOOL enable_selection_you_own_one(void*) } } func; const bool firstonly = true; - bool any_perms = gSelectMgr->getSelection()->applyToRootObjects(&func, firstonly); + bool any_perms = LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func, firstonly); if (!any_perms) { return FALSE; @@ -6563,40 +6554,37 @@ bool LLHasAsset::operator()(LLInventoryCategory* cat, BOOL enable_save_into_inventory(void*) { - if(gSelectMgr) + // *TODO: clean this up + // find the last root + LLSelectNode* last_node = NULL; + for (LLObjectSelection::root_iterator iter = LLSelectMgr::getInstance()->getSelection()->root_begin(); + iter != LLSelectMgr::getInstance()->getSelection()->root_end(); iter++) { - // *TODO: clean this up - // find the last root - LLSelectNode* last_node = NULL; - for (LLObjectSelection::root_iterator iter = gSelectMgr->getSelection()->root_begin(); - iter != gSelectMgr->getSelection()->root_end(); iter++) - { - last_node = *iter; - } + last_node = *iter; + } #ifdef HACKED_GODLIKE_VIEWER - return TRUE; + return TRUE; #else # ifdef TOGGLE_HACKED_GODLIKE_VIEWER - if (!LLAppViewer::instance()->isInProductionGrid() - && gAgent.isGodlike()) - { - return TRUE; - } + if (!LLAppViewer::instance()->isInProductionGrid() + && gAgent.isGodlike()) + { + return TRUE; + } # endif - // check all pre-req's for save into inventory. - if(last_node && last_node->mValid && !last_node->mItemID.isNull() - && (last_node->mPermissions->getOwner() == gAgent.getID()) - && (gInventory.getItem(last_node->mItemID) != NULL)) + // check all pre-req's for save into inventory. + if(last_node && last_node->mValid && !last_node->mItemID.isNull() + && (last_node->mPermissions->getOwner() == gAgent.getID()) + && (gInventory.getItem(last_node->mItemID) != NULL)) + { + LLViewerObject* obj = last_node->getObject(); + if( obj && !obj->isAttachment() ) { - LLViewerObject* obj = last_node->getObject(); - if( obj && !obj->isAttachment() ) - { - return TRUE; - } + return TRUE; } -#endif } +#endif return FALSE; } @@ -6612,17 +6600,14 @@ class LLToolsEnableSaveToInventory : public view_listener_t BOOL enable_save_into_task_inventory(void*) { - if(gSelectMgr) + LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); + if(node && (node->mValid) && (!node->mFromTaskID.isNull())) { - LLSelectNode* node = gSelectMgr->getSelection()->getFirstRootNode(); - if(node && (node->mValid) && (!node->mFromTaskID.isNull())) + // *TODO: check to see if the fromtaskid object exists. + LLViewerObject* obj = node->getObject(); + if( obj && !obj->isAttachment() ) { - // *TODO: check to see if the fromtaskid object exists. - LLViewerObject* obj = node->getObject(); - if( obj && !obj->isAttachment() ) - { - return TRUE; - } + return TRUE; } } return FALSE; @@ -6646,7 +6631,7 @@ BOOL enable_not_thirdperson(void*) BOOL enable_export_selected(void *) { - if (gSelectMgr->getSelection()->isEmpty()) + if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) { return FALSE; } @@ -6677,7 +6662,7 @@ class LLToolsEnableToolNotPie : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - bool new_value = ( gToolMgr->getBaseTool() != gToolPie ); + bool new_value = ( LLToolMgr::getInstance()->getBaseTool() != LLToolPie::getInstance() ); gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } @@ -6845,11 +6830,11 @@ class LLToolsEditLinkedParts : public view_listener_t BOOL select_individuals = gSavedSettings.getBOOL("EditLinkedParts"); if (select_individuals) { - gSelectMgr->demoteSelectionToIndividuals(); + LLSelectMgr::getInstance()->demoteSelectionToIndividuals(); } else { - gSelectMgr->promoteSelectionToRoot(); + LLSelectMgr::getInstance()->promoteSelectionToRoot(); } return true; } @@ -7069,17 +7054,17 @@ class LLToolsUseSelectionForGrid : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - gSelectMgr->clearGridObjects(); + LLSelectMgr::getInstance()->clearGridObjects(); struct f : public LLSelectedObjectFunctor { virtual bool apply(LLViewerObject* objectp) { - gSelectMgr->addGridObject(objectp); + LLSelectMgr::getInstance()->addGridObject(objectp); return true; } } func; - gSelectMgr->getSelection()->applyToRootObjects(&func); - gSelectMgr->setGridMode(GRID_MODE_REF_OBJECT); + LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func); + LLSelectMgr::getInstance()->setGridMode(GRID_MODE_REF_OBJECT); if (gFloaterTools) { gFloaterTools->mComboGridMode->setCurrentByIndex((S32)GRID_MODE_REF_OBJECT); @@ -7157,7 +7142,7 @@ void handle_save_to_xml(void*) if (picker.getSaveFile(LLFilePicker::FFSAVE_XML, default_name.c_str())) { LLString filename = picker.getFirstFile(); - gUICtrlFactory->saveToXML(frontmost, filename); + LLUICtrlFactory::getInstance()->saveToXML(frontmost, filename); } } @@ -7168,7 +7153,7 @@ void handle_load_from_xml(void*) { LLString filename = picker.getFirstFile(); LLFloater* floater = new LLFloater("sample_floater"); - gUICtrlFactory->buildFloater(floater, filename); + LLUICtrlFactory::getInstance()->buildFloater(floater, filename); } } @@ -7547,23 +7532,23 @@ class LLToolsSelectTool : public view_listener_t LLString tool_name = userdata.asString(); if (tool_name == "focus") { - gToolMgr->getCurrentToolset()->selectToolByIndex(1); + LLToolMgr::getInstance()->getCurrentToolset()->selectToolByIndex(1); } else if (tool_name == "move") { - gToolMgr->getCurrentToolset()->selectToolByIndex(2); + LLToolMgr::getInstance()->getCurrentToolset()->selectToolByIndex(2); } else if (tool_name == "edit") { - gToolMgr->getCurrentToolset()->selectToolByIndex(3); + LLToolMgr::getInstance()->getCurrentToolset()->selectToolByIndex(3); } else if (tool_name == "create") { - gToolMgr->getCurrentToolset()->selectToolByIndex(4); + LLToolMgr::getInstance()->getCurrentToolset()->selectToolByIndex(4); } else if (tool_name == "land") { - gToolMgr->getCurrentToolset()->selectToolByIndex(5); + LLToolMgr::getInstance()->getCurrentToolset()->selectToolByIndex(5); } return true; } diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 9248134188..cb2630380c 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -46,7 +46,7 @@ #include "llstatusbar.h" #include "llviewercontrol.h" // gSavedSettings #include "llviewerimagelist.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llviewermenu.h" // gMenuHolder #include "llviewerregion.h" #include "llviewerstats.h" @@ -86,7 +86,7 @@ class LLFileEnableUpload : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - bool new_value = gStatusBar && gGlobalEconomy && (gStatusBar->getBalance() >= gGlobalEconomy->getPriceUpload()); + bool new_value = gStatusBar && LLGlobalEconomy::Singleton::getInstance() && (gStatusBar->getBalance() >= LLGlobalEconomy::Singleton::getInstance()->getPriceUpload()); gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } @@ -218,7 +218,7 @@ class LLFileUploadImage : public view_listener_t if (filename) { LLFloaterImagePreview* floaterp = new LLFloaterImagePreview(filename); - gUICtrlFactory->buildFloater(floaterp, "floater_image_preview.xml"); + LLUICtrlFactory::getInstance()->buildFloater(floaterp, "floater_image_preview.xml"); } return TRUE; } @@ -232,7 +232,7 @@ class LLFileUploadSound : public view_listener_t if (filename) { LLFloaterNameDesc* floaterp = new LLFloaterNameDesc(filename); - gUICtrlFactory->buildFloater(floaterp, "floater_sound_preview.xml"); + LLUICtrlFactory::getInstance()->buildFloater(floaterp, "floater_sound_preview.xml"); } return true; } @@ -246,7 +246,7 @@ class LLFileUploadAnim : public view_listener_t if (filename) { LLFloaterAnimPreview* floaterp = new LLFloaterAnimPreview(filename); - gUICtrlFactory->buildFloater(floaterp, "floater_animation_preview.xml"); + LLUICtrlFactory::getInstance()->buildFloater(floaterp, "floater_animation_preview.xml"); } return true; } @@ -441,7 +441,7 @@ void handle_upload(void* data) if (filename) { LLFloaterNameDesc* floaterp = new LLFloaterNameDesc(filename); - gUICtrlFactory->buildFloater(floaterp, "floater_name_description.xml"); + LLUICtrlFactory::getInstance()->buildFloater(floaterp, "floater_name_description.xml"); } } @@ -799,7 +799,7 @@ void upload_done_callback(const LLUUID& uuid, void* user_data, S32 result, LLExt { // Charge the user for the upload. LLViewerRegion* region = gAgent.getRegion(); - S32 upload_cost = gGlobalEconomy->getPriceUpload(); + S32 upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); if(!(can_afford_transaction(upload_cost))) { @@ -911,17 +911,17 @@ void upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_ty if( LLAssetType::AT_SOUND == asset_type ) { - gViewerStats->incStat(LLViewerStats::ST_UPLOAD_SOUND_COUNT ); + LLViewerStats::getInstance()->incStat(LLViewerStats::ST_UPLOAD_SOUND_COUNT ); } else if( LLAssetType::AT_TEXTURE == asset_type ) { - gViewerStats->incStat(LLViewerStats::ST_UPLOAD_TEXTURE_COUNT ); + LLViewerStats::getInstance()->incStat(LLViewerStats::ST_UPLOAD_TEXTURE_COUNT ); } else if( LLAssetType::AT_ANIMATION == asset_type) { - gViewerStats->incStat(LLViewerStats::ST_UPLOAD_ANIM_COUNT ); + LLViewerStats::getInstance()->incStat(LLViewerStats::ST_UPLOAD_ANIM_COUNT ); } if(LLInventoryType::IT_NONE == inv_type) @@ -976,7 +976,7 @@ void upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_ty LLAssetType::AT_TEXTURE == asset_type || LLAssetType::AT_ANIMATION == asset_type) { - S32 upload_cost = gGlobalEconomy->getPriceUpload(); + S32 upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); S32 balance = gStatusBar->getBalance(); if (balance < upload_cost) { diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 0f478d86d4..938034a009 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -285,8 +285,7 @@ void process_logout_reply(LLMessageSystem* msg, void**) void process_layer_data(LLMessageSystem *mesgsys, void **user_data) { - if(!gWorldp) return; - LLViewerRegion *regionp = gWorldp->getRegion(mesgsys->getSender()); + LLViewerRegion *regionp = LLWorld::getInstance()->getRegion(mesgsys->getSender()); if (!regionp || gNoRender) { @@ -913,10 +912,10 @@ void inventory_offer_mute_callback(const LLUUID& blocked_id, } LLMute mute(blocked_id, from_name, type); - if (gMuteListp->add(mute)) + if (LLMuteList::getInstance()->add(mute)) { LLFloaterMute::showInstance(); - gFloaterMute->selectMute(blocked_id); + LLFloaterMute::getInstance()->selectMute(blocked_id); } // purge the message queue of any previously queued inventory offers from the same source. @@ -1101,7 +1100,7 @@ void inventory_offer_callback(S32 button, void* user_data) log_message = "You decline " + info->mDesc + " from " + info->mFromName + "."; chat.mText = log_message; - if( gMuteListp->isMuted(info->mFromID ) && ! gMuteListp->isLinden(info->mFromName) ) // muting for SL-42269 + if( LLMuteList::getInstance()->isMuted(info->mFromID ) && ! LLMuteList::getInstance()->isLinden(info->mFromName) ) // muting for SL-42269 { chat.mMuted = TRUE; } @@ -1160,7 +1159,7 @@ void inventory_offer_handler(LLOfferInfo* info, BOOL from_task) } //If muted, don't even go through the messaging stuff. Just curtail the offer here. - if (gMuteListp->isMuted(info->mFromID, info->mFromName)) + if (LLMuteList::getInstance()->isMuted(info->mFromID, info->mFromName)) { inventory_offer_callback(IOR_MUTE, info); return; @@ -1352,13 +1351,14 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) time_t timestamp = (time_t)t; BOOL is_busy = gAgent.getBusy(); - BOOL is_muted = gMuteListp->isMuted(from_id, name, LLMute::flagTextChat); - BOOL is_linden = gMuteListp->isLinden(name); + BOOL is_muted = LLMuteList::getInstance()->isMuted(from_id, name, LLMute::flagTextChat); + BOOL is_linden = LLMuteList::getInstance()->isLinden(name); BOOL is_owned_by_me = FALSE; chat.mMuted = is_muted && !is_linden; chat.mFromID = from_id; chat.mFromName = name; + chat.mSourceType = (from_id.isNull() || !strcmp(name, SYSTEM_FROM)) ? CHAT_SOURCE_SYSTEM : CHAT_SOURCE_AGENT; LLViewerObject *source = gObjectList.findObject(session_id); //Session ID is probably the wrong thing. if (source) @@ -1449,7 +1449,8 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) } else if (from_id.isNull()) { - // Messages from "Second Life" don't go to IM history + // Messages from "Second Life" ID don't go to IM history + // messages which should be routed to IM window come from a user ID with name=SYSTEM_NAME snprintf(buffer, sizeof(buffer), "%s: %s", name, message); /* Flawfinder: ignore */ chat.mText = buffer; LLFloaterChat::addChat(chat, FALSE, FALSE); @@ -2100,7 +2101,7 @@ void process_offer_callingcard(LLMessageSystem* msg, void**) if(!source_name.empty()) { if (gAgent.getBusy() - || gMuteListp->isMuted(source_id, source_name, LLMute::flagTextChat)) + || LLMuteList::getInstance()->isMuted(source_id, source_name, LLMute::flagTextChat)) { // automatically decline offer callingcard_offer_callback(1, (void*)offerdata); @@ -2170,20 +2171,15 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) BOOL is_self = (from_id == gAgent.getID()); BOOL is_busy = gAgent.getBusy(); - // Apparently you can receive chat before app is fully initialized, hence - // gMuteListp can be null. JC BOOL is_muted = FALSE; BOOL is_linden = FALSE; - if (gMuteListp) - { - is_muted = gMuteListp->isMuted( - from_id, - from_name, - LLMute::flagTextChat) - || gMuteListp->isMuted(owner_id, LLMute::flagTextChat); - is_linden = chat.mSourceType != CHAT_SOURCE_OBJECT && - gMuteListp->isLinden(from_name); - } + is_muted = LLMuteList::getInstance()->isMuted( + from_id, + from_name, + LLMute::flagTextChat) + || LLMuteList::getInstance()->isMuted(owner_id, LLMute::flagTextChat); + is_linden = chat.mSourceType != CHAT_SOURCE_OBJECT && + LLMuteList::getInstance()->isLinden(from_name); BOOL is_audible = (CHAT_AUDIBLE_FULLY == chat.mAudible); chatter = gObjectList.findObject(from_id); @@ -2201,7 +2197,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) //We set the particles to be owned by the object's owner, //just in case they should be muted by the mute list psc->setOwnerUUID(owner_id); - gWorldPointer->mPartSim.addPartSource(psc); + LLViewerPartSim::getInstance()->addPartSource(psc); } // record last audible utterance @@ -2243,7 +2239,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) // Look for the start of typing so we can put "..." in the bubbles. if (CHAT_TYPE_START == chat.mChatType) { - gLocalSpeakerMgr->setSpeakerTyping(from_id, TRUE); + LLLocalSpeakerMgr::getInstance()->setSpeakerTyping(from_id, TRUE); // Might not have the avatar constructed yet, eg on login. if (chatter && chatter->isAvatar()) @@ -2254,7 +2250,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) } else if (CHAT_TYPE_STOP == chat.mChatType) { - gLocalSpeakerMgr->setSpeakerTyping(from_id, FALSE); + LLLocalSpeakerMgr::getInstance()->setSpeakerTyping(from_id, FALSE); // Might not have the avatar constructed yet, eg on login. if (chatter && chatter->isAvatar()) @@ -2267,7 +2263,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) // We have a real utterance now, so can stop showing "..." and proceed. if (chatter && chatter->isAvatar()) { - gLocalSpeakerMgr->setSpeakerTyping(from_id, FALSE); + LLLocalSpeakerMgr::getInstance()->setSpeakerTyping(from_id, FALSE); ((LLVOAvatar*)chatter)->stopTyping(); if (!is_muted && !is_busy) @@ -2559,10 +2555,10 @@ void process_teleport_finish(LLMessageSystem* msg, void**) // Do teleport effect for where you're leaving // VEFFECT: TeleportStart - LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)gHUDManager->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE); + LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE); effectp->setPositionGlobal(gAgent.getPositionGlobal()); effectp->setColor(LLColor4U(gAgent.getEffectColor())); - gHUDManager->sendEffects(); + LLHUDManager::getInstance()->sendEffects(); U32 location_id; U32 sim_ip; @@ -2598,8 +2594,7 @@ void process_teleport_finish(LLMessageSystem* msg, void**) // Viewer trusts the simulator. gMessageSystem->enableCircuit(sim_host, TRUE); - if(!gWorldp) return; - LLViewerRegion* regionp = gWorldp->addRegion(region_handle, sim_host); + LLViewerRegion* regionp = LLWorld::getInstance()->addRegion(region_handle, sim_host); /* // send camera update to new region @@ -2643,11 +2638,11 @@ void process_teleport_finish(LLMessageSystem* msg, void**) // Now do teleport effect for where you're going. // VEFFECT: TeleportEnd - effectp = (LLHUDEffectSpiral *)gHUDManager->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE); + effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE); effectp->setPositionGlobal(gAgent.getPositionGlobal()); effectp->setColor(LLColor4U(gAgent.getEffectColor())); - gHUDManager->sendEffects(); + LLHUDManager::getInstance()->sendEffects(); // gTeleportDisplay = TRUE; // gTeleportDisplayTimer.reset(); @@ -2713,8 +2708,7 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**) F32 x, y; from_region_handle(region_handle, &x, &y); - if(!gWorldp) return; - LLViewerRegion* regionp = gWorldp->getRegionFromHandle(region_handle); + LLViewerRegion* regionp = LLWorld::getInstance()->getRegionFromHandle(region_handle); if (!regionp) { if (gAgent.getRegion()) @@ -2870,8 +2864,7 @@ void process_crossed_region(LLMessageSystem* msg, void**) send_complete_agent_movement(sim_host); - if(!gWorldp) return; - LLViewerRegion* regionp = gWorldp->addRegion(region_handle, sim_host); + LLViewerRegion* regionp = LLWorld::getInstance()->addRegion(region_handle, sim_host); regionp->setSeedCapability(std::string(seedCap)); } @@ -2900,6 +2893,12 @@ void send_agent_update(BOOL force_send, BOOL send_reliable) return; } + // no region to send update to + if(gAgent.getRegion() == NULL) + { + return; + } + const F32 TRANSLATE_THRESHOLD = 0.01f; // NOTA BENE: This is (intentionally?) using the small angle sine approximation to test for rotation @@ -2940,7 +2939,7 @@ void send_agent_update(BOOL force_send, BOOL send_reliable) U8 flag_change = 0; cam_center_chg = last_camera_pos_agent - camera_pos_agent; - cam_rot_chg = last_camera_at - gCamera->getAtAxis(); + cam_rot_chg = last_camera_at - LLViewerCamera::getInstance()->getAtAxis(); // If a modifier key is held down, turn off // LBUTTON and ML_LBUTTON so that using the camera (alt-key) doesn't @@ -3048,9 +3047,9 @@ void send_agent_update(BOOL force_send, BOOL send_reliable) // } msg->addVector3Fast(_PREHASH_CameraCenter, camera_pos_agent); - msg->addVector3Fast(_PREHASH_CameraAtAxis, gCamera->getAtAxis()); - msg->addVector3Fast(_PREHASH_CameraLeftAxis, gCamera->getLeftAxis()); - msg->addVector3Fast(_PREHASH_CameraUpAxis, gCamera->getUpAxis()); + msg->addVector3Fast(_PREHASH_CameraAtAxis, LLViewerCamera::getInstance()->getAtAxis()); + msg->addVector3Fast(_PREHASH_CameraLeftAxis, LLViewerCamera::getInstance()->getLeftAxis()); + msg->addVector3Fast(_PREHASH_CameraUpAxis, LLViewerCamera::getInstance()->getUpAxis()); msg->addF32Fast(_PREHASH_Far, gAgent.mDrawDistance); msg->addU32Fast(_PREHASH_ControlFlags, control_flags); @@ -3085,9 +3084,9 @@ void send_agent_update(BOOL force_send, BOOL send_reliable) last_head_rot = head_rotation; last_render_state = render_state; last_camera_pos_agent = camera_pos_agent; - last_camera_at = gCamera->getAtAxis(); - last_camera_left = gCamera->getLeftAxis(); - last_camera_up = gCamera->getUpAxis(); + last_camera_at = LLViewerCamera::getInstance()->getAtAxis(); + last_camera_left = LLViewerCamera::getInstance()->getLeftAxis(); + last_camera_up = LLViewerCamera::getInstance()->getUpAxis(); last_control_flags = control_flags; last_flags = flags; } @@ -3201,7 +3200,7 @@ void process_kill_object(LLMessageSystem *mesgsys, void **user_data) //llinfos << "Kill message for local " << local_id << llendl; } - gSelectMgr->removeObjectFromSelections(id); + LLSelectMgr::getInstance()->removeObjectFromSelections(id); // ...don't kill the avatar if (!(id == gAgentID)) @@ -3255,8 +3254,7 @@ void process_time_synch(LLMessageSystem *mesgsys, void **user_data) mesgsys->getVector3Fast(_PREHASH_TimeInfo, _PREHASH_SunDirection, sun_direction); mesgsys->getVector3Fast(_PREHASH_TimeInfo, _PREHASH_SunAngVelocity, sun_ang_velocity); - if(!gWorldp) return; - gWorldp->setSpaceTimeUSec(space_time_usec); + LLWorld::getInstance()->setSpaceTimeUSec(space_time_usec); //lldebugs << "time_synch() - " << sun_direction << ", " << sun_ang_velocity // << ", " << phase << llendl; @@ -3272,8 +3270,6 @@ void process_time_synch(LLMessageSystem *mesgsys, void **user_data) void process_sound_trigger(LLMessageSystem *msg, void **) { if (!gAudiop) return; - if (!gParcelMgr) return; - if (!gMuteListp) return; U64 region_handle = 0; F32 gain = 0; @@ -3299,17 +3295,17 @@ void process_sound_trigger(LLMessageSystem *msg, void **) // Don't play a trigger sound if you can't hear it due // to parcel "local audio only" settings. - if (!gParcelMgr->canHearSound(pos_global)) return; + if (!LLViewerParcelMgr::getInstance()->canHearSound(pos_global)) return; // Don't play sounds triggered by someone you muted. - if (gMuteListp->isMuted(owner_id, LLMute::flagObjectSounds)) return; + if (LLMuteList::getInstance()->isMuted(owner_id, LLMute::flagObjectSounds)) return; // Don't play sounds from an object you muted - if (gMuteListp->isMuted(object_id)) return; + if (LLMuteList::getInstance()->isMuted(object_id)) return; // Don't play sounds from an object whose parent you muted if (parent_id.notNull() - && gMuteListp->isMuted(parent_id)) + && LLMuteList::getInstance()->isMuted(parent_id)) { return; } @@ -3336,8 +3332,8 @@ void process_preload_sound(LLMessageSystem *msg, void **user_data) LLViewerObject *objectp = gObjectList.findObject(object_id); if (!objectp) return; - if (gMuteListp->isMuted(object_id)) return; - if (gMuteListp->isMuted(owner_id, LLMute::flagObjectSounds)) return; + if (LLMuteList::getInstance()->isMuted(object_id)) return; + if (LLMuteList::getInstance()->isMuted(owner_id, LLMute::flagObjectSounds)) return; LLAudioSource *sourcep = objectp->getAudioSource(owner_id); if (!sourcep) return; @@ -3373,9 +3369,9 @@ void process_attached_sound(LLMessageSystem *msg, void **user_data) return; } - if (gMuteListp->isMuted(object_id)) return; + if (LLMuteList::getInstance()->isMuted(object_id)) return; - if (gMuteListp->isMuted(owner_id, LLMute::flagObjectSounds)) return; + if (LLMuteList::getInstance()->isMuted(owner_id, LLMute::flagObjectSounds)) return; objectp->setAttachedSound(sound_id, owner_id, gain, flags); } @@ -3426,73 +3422,73 @@ void process_sim_stats(LLMessageSystem *msg, void **user_data) switch (stat_id) { case LL_SIM_STAT_TIME_DILATION: - gViewerStats->mSimTimeDilation.addValue(stat_value); + LLViewerStats::getInstance()->mSimTimeDilation.addValue(stat_value); break; case LL_SIM_STAT_FPS: - gViewerStats->mSimFPS.addValue(stat_value); + LLViewerStats::getInstance()->mSimFPS.addValue(stat_value); break; case LL_SIM_STAT_PHYSFPS: - gViewerStats->mSimPhysicsFPS.addValue(stat_value); + LLViewerStats::getInstance()->mSimPhysicsFPS.addValue(stat_value); break; case LL_SIM_STAT_AGENTUPS: - gViewerStats->mSimAgentUPS.addValue(stat_value); + LLViewerStats::getInstance()->mSimAgentUPS.addValue(stat_value); break; case LL_SIM_STAT_FRAMEMS: - gViewerStats->mSimFrameMsec.addValue(stat_value); + LLViewerStats::getInstance()->mSimFrameMsec.addValue(stat_value); break; case LL_SIM_STAT_NETMS: - gViewerStats->mSimNetMsec.addValue(stat_value); + LLViewerStats::getInstance()->mSimNetMsec.addValue(stat_value); break; case LL_SIM_STAT_SIMOTHERMS: - gViewerStats->mSimSimOtherMsec.addValue(stat_value); + LLViewerStats::getInstance()->mSimSimOtherMsec.addValue(stat_value); break; case LL_SIM_STAT_SIMPHYSICSMS: - gViewerStats->mSimSimPhysicsMsec.addValue(stat_value); + LLViewerStats::getInstance()->mSimSimPhysicsMsec.addValue(stat_value); break; case LL_SIM_STAT_AGENTMS: - gViewerStats->mSimAgentMsec.addValue(stat_value); + LLViewerStats::getInstance()->mSimAgentMsec.addValue(stat_value); break; case LL_SIM_STAT_IMAGESMS: - gViewerStats->mSimImagesMsec.addValue(stat_value); + LLViewerStats::getInstance()->mSimImagesMsec.addValue(stat_value); break; case LL_SIM_STAT_SCRIPTMS: - gViewerStats->mSimScriptMsec.addValue(stat_value); + LLViewerStats::getInstance()->mSimScriptMsec.addValue(stat_value); break; case LL_SIM_STAT_NUMTASKS: - gViewerStats->mSimObjects.addValue(stat_value); + LLViewerStats::getInstance()->mSimObjects.addValue(stat_value); break; case LL_SIM_STAT_NUMTASKSACTIVE: - gViewerStats->mSimActiveObjects.addValue(stat_value); + LLViewerStats::getInstance()->mSimActiveObjects.addValue(stat_value); break; case LL_SIM_STAT_NUMAGENTMAIN: - gViewerStats->mSimMainAgents.addValue(stat_value); + LLViewerStats::getInstance()->mSimMainAgents.addValue(stat_value); break; case LL_SIM_STAT_NUMAGENTCHILD: - gViewerStats->mSimChildAgents.addValue(stat_value); + LLViewerStats::getInstance()->mSimChildAgents.addValue(stat_value); break; case LL_SIM_STAT_NUMSCRIPTSACTIVE: - gViewerStats->mSimActiveScripts.addValue(stat_value); + LLViewerStats::getInstance()->mSimActiveScripts.addValue(stat_value); break; case LL_SIM_STAT_LSLIPS: - gViewerStats->mSimLSLIPS.addValue(stat_value); + LLViewerStats::getInstance()->mSimLSLIPS.addValue(stat_value); break; case LL_SIM_STAT_INPPS: - gViewerStats->mSimInPPS.addValue(stat_value); + LLViewerStats::getInstance()->mSimInPPS.addValue(stat_value); break; case LL_SIM_STAT_OUTPPS: - gViewerStats->mSimOutPPS.addValue(stat_value); + LLViewerStats::getInstance()->mSimOutPPS.addValue(stat_value); break; case LL_SIM_STAT_PENDING_DOWNLOADS: - gViewerStats->mSimPendingDownloads.addValue(stat_value); + LLViewerStats::getInstance()->mSimPendingDownloads.addValue(stat_value); break; case LL_SIM_STAT_PENDING_UPLOADS: - gViewerStats->mSimPendingUploads.addValue(stat_value); + LLViewerStats::getInstance()->mSimPendingUploads.addValue(stat_value); break; case LL_SIM_STAT_PENDING_LOCAL_UPLOADS: - gViewerStats->mSimPendingLocalUploads.addValue(stat_value); + LLViewerStats::getInstance()->mSimPendingLocalUploads.addValue(stat_value); break; case LL_SIM_STAT_TOTAL_UNACKED_BYTES: - gViewerStats->mSimTotalUnackedBytes.addValue(stat_value / 1024.f); + LLViewerStats::getInstance()->mSimTotalUnackedBytes.addValue(stat_value / 1024.f); break; default: // llwarns << "Unknown stat id" << stat_id << llendl; @@ -3502,7 +3498,7 @@ void process_sim_stats(LLMessageSystem *msg, void **user_data) /* msg->getF32Fast(_PREHASH_Statistics, _PREHASH_PhysicsTimeDilation, time_dilation); - gViewerStats->mSimTDStat.addValue(time_dilation); + LLViewerStats::getInstance()->mSimTDStat.addValue(time_dilation); // Process information // { CpuUsage F32 } @@ -3517,9 +3513,9 @@ void process_sim_stats(LLMessageSystem *msg, void **user_data) msg->getF32Fast(_PREHASH_Statistics, _PREHASH_SimMemTotal, sim_mem_total); msg->getF32Fast(_PREHASH_Statistics, _PREHASH_SimMemRSS, sim_mem_rss); msg->getF32Fast(_PREHASH_Statistics, _PREHASH_ProcessUptime, process_uptime); - gViewerStats->mSimCPUUsageStat.addValue(cpu_usage); - gViewerStats->mSimMemTotalStat.addValue(sim_mem_total); - gViewerStats->mSimMemRSSStat.addValue(sim_mem_rss); + LLViewerStats::getInstance()->mSimCPUUsageStat.addValue(cpu_usage); + LLViewerStats::getInstance()->mSimMemTotalStat.addValue(sim_mem_total); + LLViewerStats::getInstance()->mSimMemRSSStat.addValue(sim_mem_rss); */ // @@ -3947,7 +3943,7 @@ void process_time_dilation(LLMessageSystem *msg, void **user_data) // get the pointer to the right region U32 ip = msg->getSenderIP(); U32 port = msg->getSenderPort(); - LLViewerRegion *regionp = gWorldp->getRegion(ip, port); + LLViewerRegion *regionp = LLWorld::getInstance()->getRegion(ip, port); if (regionp) { regionp->setTimeDilation(time_dilation); @@ -4047,7 +4043,7 @@ void process_alert_core(const std::string& message, BOOL modal) // HACK -- handle callbacks for specific alerts if ( message == "You died and have been teleported to your home location") { - gViewerStats->incStat(LLViewerStats::ST_KILLED_COUNT); + LLViewerStats::getInstance()->incStat(LLViewerStats::ST_KILLED_COUNT); } else if( message == "Home position set." ) { @@ -4235,9 +4231,9 @@ void process_frozen_message(LLMessageSystem *msgsystem, void **user_data) // do some extra stuff once we get our economy data void process_economy_data(LLMessageSystem *msg, void** /*user_data*/) { - LLGlobalEconomy::processEconomyData(msg, (void**)gGlobalEconomy); + LLGlobalEconomy::processEconomyData(msg, LLGlobalEconomy::Singleton::getInstance()); - S32 upload_cost = gGlobalEconomy->getPriceUpload(); + S32 upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); LLFloaterImagePreview::setUploadAmount(upload_cost); gMenuHolder->childSetLabelArg("Upload Image", "[COST]", llformat("%d", upload_cost)); @@ -4411,7 +4407,7 @@ void script_question_cb(S32 option, void* user_data) if ( option == 2 ) // mute { - gMuteListp->add(LLMute(cbdata->mItemID, cbdata->mObjectName, LLMute::OBJECT)); + LLMuteList::getInstance()->add(LLMute(cbdata->mItemID, cbdata->mObjectName, LLMute::OBJECT)); // purge the message queue of any previously queued requests from the same source. DEV-4879 class OfferMatcher : public LLNotifyBoxView::Matcher @@ -4451,7 +4447,7 @@ void process_script_question(LLMessageSystem *msg, void **user_data) msg->getS32Fast(_PREHASH_Data, _PREHASH_Questions, questions ); // don't display permission requests if this object is muted - JS. - if (gMuteListp->isMuted(taskid)) return; + if (LLMuteList::getInstance()->isMuted(taskid)) return; // throttle excessive requests from any specific user's scripts LLString throttle_owner_name = owner_name; @@ -5081,7 +5077,7 @@ void callback_load_url_name(const LLUUID& id, const char* first, const char* las } // For legacy name-only mutes. - if (gMuteListp->isMuted(LLUUID::null, owner_name)) + if (LLMuteList::getInstance()->isMuted(LLUUID::null, owner_name)) { delete infop; infop = NULL; @@ -5115,10 +5111,8 @@ void process_load_url(LLMessageSystem* msg, void**) // URL is safety checked in load_url above // Check if object or owner is muted - if (gMuteListp && - (gMuteListp->isMuted(infop->mObjectID, infop->mObjectName) || - gMuteListp->isMuted(infop->mOwnerID)) - ) + if (LLMuteList::getInstance()->isMuted(infop->mObjectID, infop->mObjectName) || + LLMuteList::getInstance()->isMuted(infop->mOwnerID)) { llinfos<<"Ignoring load_url from muted object/owner."<<llendl; delete infop; @@ -5322,10 +5316,7 @@ void onCovenantLoadComplete(LLVFS *vfs, } else { - if( gViewerStats ) - { - gViewerStats->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); - } + LLViewerStats::getInstance()->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status || LL_ERR_FILE_EMPTY == status) diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index e89722fde8..60fc733cb5 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -546,9 +546,9 @@ void LLViewerObject::removeChild(LLViewerObject *childp) if (childp->isSelected()) { - gSelectMgr->deselectObjectAndFamily(childp); + LLSelectMgr::getInstance()->deselectObjectAndFamily(childp); BOOL add_to_end = TRUE; - gSelectMgr->selectObjectAndFamily(childp, add_to_end); + LLSelectMgr::getInstance()->selectObjectAndFamily(childp, add_to_end); } } @@ -683,7 +683,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, // Coordinates of objects on simulators are region-local. U64 region_handle; mesgsys->getU64Fast(_PREHASH_RegionData, _PREHASH_RegionHandle, region_handle); - mRegionp = gWorldPointer->getRegionFromHandle(region_handle); + mRegionp = LLWorld::getInstance()->getRegionFromHandle(region_handle); if (!mRegionp) { U32 x, y; @@ -708,9 +708,9 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, U16 valswizzle[4]; #endif U16 *val; - const F32 size = gWorldPointer->getRegionWidthInMeters(); - const F32 MAX_HEIGHT = gWorldPointer->getRegionMaxHeight(); - const F32 MIN_HEIGHT = gWorldPointer->getRegionMinHeight(); + const F32 size = LLWorld::getInstance()->getRegionWidthInMeters(); + const F32 MAX_HEIGHT = LLWorld::getInstance()->getRegionMaxHeight(); + const F32 MIN_HEIGHT = LLWorld::getInstance()->getRegionMinHeight(); S32 length; S32 count; S32 this_update_precision = 32; // in bits @@ -1917,7 +1917,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, if (needs_refresh) { - gSelectMgr->updateSelectionCenter(); + LLSelectMgr::getInstance()->updateSelectionCenter(); dialog_refresh_all(); } @@ -2177,7 +2177,7 @@ void LLViewerObject::doUpdateInventory( // make sure that the serial number does not match. deleteInventoryItem(item_id); LLPermissions perm(item->getPermissions()); - LLPermissions* obj_perm = gSelectMgr->findObjectPermissions(this); + LLPermissions* obj_perm = LLSelectMgr::getInstance()->findObjectPermissions(this); bool is_atomic = ((S32)LLAssetType::AT_OBJECT == item->getType()) ? false : true; if(obj_perm) { @@ -2714,19 +2714,19 @@ void LLViewerObject::setPixelAreaAndAngle(LLAgent &agent) if (range < 0.001f || isHUDAttachment()) // range == zero { mAppAngle = 180.f; - mPixelArea = (F32)gCamera->getScreenPixelArea(); + mPixelArea = (F32)LLViewerCamera::getInstance()->getScreenPixelArea(); } else { mAppAngle = (F32) atan2( max_scale, range) * RAD_TO_DEG; - F32 pixels_per_meter = gCamera->getPixelMeterRatio() / range; + F32 pixels_per_meter = LLViewerCamera::getInstance()->getPixelMeterRatio() / range; mPixelArea = (pixels_per_meter * max_scale) * (pixels_per_meter * mid_scale); - if (mPixelArea > gCamera->getScreenPixelArea()) + if (mPixelArea > LLViewerCamera::getInstance()->getScreenPixelArea()) { mAppAngle = 180.f; - mPixelArea = (F32)gCamera->getScreenPixelArea(); + mPixelArea = (F32)LLViewerCamera::getInstance()->getScreenPixelArea(); } } } @@ -4092,7 +4092,7 @@ void LLViewerObject::unpackParticleSource(const S32 block_num, const LLUUID& own { LLPointer<LLViewerPartSourceScript> pss = LLViewerPartSourceScript::unpackPSS(this, NULL, block_num); //If the owner is muted, don't create the system - if(gMuteListp->isMuted(owner_id, LLMute::flagParticles)) return; + if(LLMuteList::getInstance()->isMuted(owner_id, LLMute::flagParticles)) return; // We need to be able to deal with a particle source that hasn't changed, but still got an update! if (pss) @@ -4100,7 +4100,7 @@ void LLViewerObject::unpackParticleSource(const S32 block_num, const LLUUID& own // llinfos << "Making particle system with owner " << owner_id << llendl; pss->setOwnerUUID(owner_id); mPartSourcep = pss; - gWorldPointer->mPartSim.addPartSource(pss); + LLViewerPartSim::getInstance()->addPartSource(pss); } } if (mPartSourcep) @@ -4110,8 +4110,7 @@ void LLViewerObject::unpackParticleSource(const S32 block_num, const LLUUID& own LLViewerImage* image; if (mPartSourcep->mPartSysData.mPartImageID == LLUUID::null) { - LLUUID id(gViewerArt.getString("pixiesmall.tga")); - image = gImageList.getImage(id); + image = gImageList.getImageFromFile("pixiesmall.j2c"); } else { @@ -4141,14 +4140,14 @@ void LLViewerObject::unpackParticleSource(LLDataPacker &dp, const LLUUID& owner_ { LLPointer<LLViewerPartSourceScript> pss = LLViewerPartSourceScript::unpackPSS(this, NULL, dp); //If the owner is muted, don't create the system - if(gMuteListp->isMuted(owner_id, LLMute::flagParticles)) return; + if(LLMuteList::getInstance()->isMuted(owner_id, LLMute::flagParticles)) return; // We need to be able to deal with a particle source that hasn't changed, but still got an update! if (pss) { // llinfos << "Making particle system with owner " << owner_id << llendl; pss->setOwnerUUID(owner_id); mPartSourcep = pss; - gWorldPointer->mPartSim.addPartSource(pss); + LLViewerPartSim::getInstance()->addPartSource(pss); } } if (mPartSourcep) @@ -4158,8 +4157,7 @@ void LLViewerObject::unpackParticleSource(LLDataPacker &dp, const LLUUID& owner_ LLViewerImage* image; if (mPartSourcep->mPartSysData.mPartImageID == LLUUID::null) { - LLUUID id(gViewerArt.getString("pixiesmall.tga")); - image = gImageList.getImage(id); + image = gImageList.getImageFromFile("pixiesmall.j2c"); } else { diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 8d1867cc31..499476e065 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -235,11 +235,11 @@ void LLViewerObjectList::processUpdateCore(LLViewerObject* objectp, && update_type != OUT_TERSE_IMPROVED && objectp->mCreateSelected) { - if ( gToolMgr->getCurrentTool() != gToolPie ) + if ( LLToolMgr::getInstance()->getCurrentTool() != LLToolPie::getInstance() ) { //llinfos << "DEBUG selecting " << objectp->mID << " " // << objectp->mLocalID << llendl; - gSelectMgr->selectObjectAndFamily(objectp); + LLSelectMgr::getInstance()->selectObjectAndFamily(objectp); dialog_refresh_all(); } @@ -302,7 +302,7 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, U64 region_handle; mesgsys->getU64Fast(_PREHASH_RegionData, _PREHASH_RegionHandle, region_handle); - LLViewerRegion *regionp = gWorldPointer->getRegionFromHandle(region_handle); + LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(region_handle); if (!regionp) { @@ -585,7 +585,7 @@ void LLViewerObjectList::updateApparentAngles(LLAgent &agent) return true; } } func; - gSelectMgr->getSelection()->applyToRootObjects(&func); + LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func); // Iterate through some of the objects and lazy update their texture priorities for (i = mCurLazyUpdateIndex; i < max_value; i++) @@ -710,7 +710,7 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world) // don't factor frames that were paused into the stats if (! mWasPaused) { - gViewerStats->updateFrameStats(time_diff); + LLViewerStats::getInstance()->updateFrameStats(time_diff); } /* @@ -996,7 +996,7 @@ void LLViewerObjectList::shiftObjects(const LLVector3 &offset) } gPipeline.shiftObjects(offset); - gWorldp->shiftRegions(offset); + LLWorld::getInstance()->shiftRegions(offset); } void LLViewerObjectList::renderObjectsForMap(LLNetMap &netmap) @@ -1023,7 +1023,7 @@ void LLViewerObjectList::renderObjectsForMap(LLNetMap &netmap) const LLVector3& scale = objectp->getScale(); const LLVector3d pos = objectp->getPositionGlobal(); const F64 water_height = F64( objectp->getRegion()->getWaterHeight() ); - // gWorldPointer->getWaterHeight(); + // LLWorld::getInstance()->getWaterHeight(); F32 approx_radius = (scale.mV[VX] + scale.mV[VY]) * 0.5f * 0.5f * 1.3f; // 1.3 is a fudge @@ -1097,8 +1097,8 @@ U32 LLViewerObjectList::renderObjectsForSelect(LLCamera &camera, BOOL pick_parce std::vector<LLDrawable*> pick_drawables; - for (LLWorld::region_list_t::iterator iter = gWorldp->getRegionList().begin(); - iter != gWorldp->getRegionList().end(); ++iter) + for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->getRegionList().begin(); + iter != LLWorld::getInstance()->getRegionList().end(); ++iter) { LLViewerRegion* region = *iter; for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++) @@ -1491,12 +1491,12 @@ void LLViewerObjectList::findOrphans(LLViewerObject* objectp, U32 ip, U32 port) if (orphans_found && objectp->isSelected()) { - LLSelectNode* nodep = gSelectMgr->getSelection()->findNode(objectp); + LLSelectNode* nodep = LLSelectMgr::getInstance()->getSelection()->findNode(objectp); if (nodep && !nodep->mIndividualSelection) { // rebuild selection with orphans - gSelectMgr->deselectObjectAndFamily(objectp); - gSelectMgr->selectObjectAndFamily(objectp); + LLSelectMgr::getInstance()->deselectObjectAndFamily(objectp); + LLSelectMgr::getInstance()->selectObjectAndFamily(objectp); } } } diff --git a/indra/newview/llviewerparcelmedia.cpp b/indra/newview/llviewerparcelmedia.cpp index 12523f487b..de37ce253e 100644 --- a/indra/newview/llviewerparcelmedia.cpp +++ b/indra/newview/llviewerparcelmedia.cpp @@ -282,7 +282,7 @@ void LLViewerParcelMedia::processParcelMediaCommandMessage( LLMessageSystem *msg } else { - LLParcel *parcel = gParcelMgr->getAgentParcel(); + LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); play(parcel); } } @@ -308,7 +308,7 @@ void LLViewerParcelMedia::processParcelMediaCommandMessage( LLMessageSystem *msg { if(! LLViewerMedia::hasMedia()) { - LLParcel *parcel = gParcelMgr->getAgentParcel(); + LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); play(parcel); } seek(time); @@ -343,7 +343,7 @@ void LLViewerParcelMedia::processParcelMediaUpdate( LLMessageSystem *msg, void * msg->getS32("DataBlockExtended", "MediaHeight", media_height); } - LLParcel *parcel = gParcelMgr->getAgentParcel(); + LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); BOOL same = FALSE; if (parcel) { diff --git a/indra/newview/llviewerparcelmediaautoplay.cpp b/indra/newview/llviewerparcelmediaautoplay.cpp index e373d7d986..80c22153d4 100644 --- a/indra/newview/llviewerparcelmediaautoplay.cpp +++ b/indra/newview/llviewerparcelmediaautoplay.cpp @@ -84,10 +84,7 @@ BOOL LLViewerParcelMediaAutoPlay::tick() LLUUID this_media_texture_id; S32 this_parcel_id = 0; - if (gParcelMgr) - { - this_parcel = gParcelMgr->getAgentParcel(); - } + this_parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if (this_parcel) { diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp index cc35328887..4a76fe7142 100644 --- a/indra/newview/llviewerparcelmgr.cpp +++ b/indra/newview/llviewerparcelmgr.cpp @@ -74,7 +74,6 @@ const F32 PARCEL_COLLISION_DRAW_SECS = 1.f; // Globals -LLViewerParcelMgr *gParcelMgr = NULL; U8* LLViewerParcelMgr::sPackedOverlay = NULL; @@ -139,11 +138,8 @@ LLViewerParcelMgr::LLViewerParcelMgr() mCollisionSegments = new U8[(mParcelsPerEdge+1)*(mParcelsPerEdge+1)]; resetSegments(mCollisionSegments); - mBlockedImageID.set(gViewerArt.getString("noentrylines.tga")); - sBlockedImage = gImageList.getImage(mBlockedImageID, TRUE, TRUE); - - mPassImageID.set(gViewerArt.getString("noentrypasslines.tga")); - sPassImage = gImageList.getImage(mPassImageID, TRUE, TRUE); + mBlockedImage = gImageList.getImageFromFile("noentrylines.j2c"); + mPassImage = gImageList.getImageFromFile("noentrypasslines.j2c"); S32 overlay_size = mParcelsPerEdge * mParcelsPerEdge / PARCEL_OVERLAY_CHUNKS; sPackedOverlay = new U8[overlay_size]; @@ -217,9 +213,7 @@ void LLViewerParcelMgr::dump() LLViewerRegion* LLViewerParcelMgr::getSelectionRegion() { - if (!gWorldp) return NULL; - - return gWorldp->getRegionFromPosGlobal( mWestSouth ); + return LLWorld::getInstance()->getRegionFromPosGlobal( mWestSouth ); } @@ -436,11 +430,6 @@ LLParcelSelectionHandle LLViewerParcelMgr::selectParcelInRectangle() void LLViewerParcelMgr::selectCollisionParcel() { - if (!gWorldp) - { - return; - } - // BUG: Claim to be in the agent's region mWestSouth = gAgent.getRegion()->getOriginGlobal(); mEastNorth = mWestSouth; @@ -483,11 +472,6 @@ void LLViewerParcelMgr::selectCollisionParcel() LLParcelSelectionHandle LLViewerParcelMgr::selectLand(const LLVector3d &corner1, const LLVector3d &corner2, BOOL snap_selection) { - if (!gWorldp) - { - return NULL; - } - sanitize_corners( corner1, corner2, mWestSouth, mEastNorth ); // ...x isn't more than one meter away @@ -515,8 +499,8 @@ LLParcelSelectionHandle LLViewerParcelMgr::selectLand(const LLVector3d &corner1, east_north_region_check.mdV[VX] -= 0.5; east_north_region_check.mdV[VY] -= 0.5; - LLViewerRegion *region = gWorldp->getRegionFromPosGlobal(mWestSouth); - LLViewerRegion *region_other = gWorldp->getRegionFromPosGlobal( east_north_region_check ); + LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosGlobal(mWestSouth); + LLViewerRegion *region_other = LLWorld::getInstance()->getRegionFromPosGlobal( east_north_region_check ); if(!region) { @@ -689,8 +673,7 @@ F32 LLViewerParcelMgr::agentDrawDistance() const BOOL LLViewerParcelMgr::isOwnedAt(const LLVector3d& pos_global) const { - if (!gWorldp) return FALSE; - LLViewerRegion* region = gWorldp->getRegionFromPosGlobal( pos_global ); + LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal( pos_global ); if (!region) return FALSE; LLViewerParcelOverlay* overlay = region->getParcelOverlay(); @@ -703,8 +686,7 @@ BOOL LLViewerParcelMgr::isOwnedAt(const LLVector3d& pos_global) const BOOL LLViewerParcelMgr::isOwnedSelfAt(const LLVector3d& pos_global) const { - if (!gWorldp) return FALSE; - LLViewerRegion* region = gWorldp->getRegionFromPosGlobal( pos_global ); + LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal( pos_global ); if (!region) return FALSE; LLViewerParcelOverlay* overlay = region->getParcelOverlay(); @@ -717,8 +699,7 @@ BOOL LLViewerParcelMgr::isOwnedSelfAt(const LLVector3d& pos_global) const BOOL LLViewerParcelMgr::isOwnedOtherAt(const LLVector3d& pos_global) const { - if (!gWorldp) return FALSE; - LLViewerRegion* region = gWorldp->getRegionFromPosGlobal( pos_global ); + LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal( pos_global ); if (!region) return FALSE; LLViewerParcelOverlay* overlay = region->getParcelOverlay(); @@ -731,8 +712,7 @@ BOOL LLViewerParcelMgr::isOwnedOtherAt(const LLVector3d& pos_global) const BOOL LLViewerParcelMgr::isSoundLocal(const LLVector3d& pos_global) const { - if (!gWorldp) return FALSE; - LLViewerRegion* region = gWorldp->getRegionFromPosGlobal( pos_global ); + LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal( pos_global ); if (!region) return FALSE; LLViewerParcelOverlay* overlay = region->getParcelOverlay(); @@ -754,12 +734,12 @@ BOOL LLViewerParcelMgr::canHearSound(const LLVector3d &pos_global) const } else { - if (gParcelMgr->getAgentParcel()->getSoundLocal()) + if (LLViewerParcelMgr::getInstance()->getAgentParcel()->getSoundLocal()) { // Not in same parcel, and agent parcel only has local sound return FALSE; } - else if (gParcelMgr->isSoundLocal(pos_global)) + else if (LLViewerParcelMgr::getInstance()->isSoundLocal(pos_global)) { // Not in same parcel, and target parcel only has local sound return FALSE; @@ -775,8 +755,7 @@ BOOL LLViewerParcelMgr::canHearSound(const LLVector3d &pos_global) const BOOL LLViewerParcelMgr::inAgentParcel(const LLVector3d &pos_global) const { - if (!gWorldp) return FALSE; - LLViewerRegion* region = gWorldp->getRegionFromPosGlobal(pos_global); + LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal(pos_global); if (region != gAgent.getRegion()) { // Can't be in the agent parcel if you're not in the same region. @@ -833,8 +812,7 @@ void LLViewerParcelMgr::render() { // Rendering is done in agent-coordinates, so need to supply // an appropriate offset to the render code. - if (!gWorldp) return; - LLViewerRegion* regionp = gWorldp->getRegionFromPosGlobal(mWestSouth); + LLViewerRegion* regionp = LLWorld::getInstance()->getRegionFromPosGlobal(mWestSouth); if (!regionp) return; renderHighlightSegments(mHighlightSegments, regionp); @@ -866,8 +844,7 @@ void LLViewerParcelMgr::sendParcelAccessListRequest(U32 flags) return; } - if(!gWorldp) return; - LLViewerRegion *region = gWorldp->getRegionFromPosGlobal( mWestSouth ); + LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosGlobal( mWestSouth ); if (!region) return; LLMessageSystem *msg = gMessageSystem; @@ -902,8 +879,7 @@ void LLViewerParcelMgr::sendParcelDwellRequest() return; } - if(!gWorldp) return; - LLViewerRegion *region = gWorldp->getRegionFromPosGlobal( mWestSouth ); + LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosGlobal( mWestSouth ); if (!region) return; LLMessageSystem *msg = gMessageSystem; @@ -935,8 +911,7 @@ void LLViewerParcelMgr::sendParcelGodForceOwner(const LLUUID& owner_id) east_north_region_check.mdV[VX] -= 0.5; east_north_region_check.mdV[VY] -= 0.5; - if(!gWorldp) return; - LLViewerRegion *region = gWorldp->getRegionFromPosGlobal( mWestSouth ); + LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosGlobal( mWestSouth ); if (!region) { // TODO: Add a force owner version of this alert. @@ -945,7 +920,7 @@ void LLViewerParcelMgr::sendParcelGodForceOwner(const LLUUID& owner_id) } // BUG: Make work for cross-region selections - LLViewerRegion *region2 = gWorldp->getRegionFromPosGlobal( east_north_region_check ); + LLViewerRegion *region2 = LLWorld::getInstance()->getRegionFromPosGlobal( east_north_region_check ); if (region != region2) { gViewerWindow->alertXml("CannotSetLandOwnerMultipleRegions"); @@ -992,8 +967,7 @@ void LLViewerParcelMgr::sendParcelGodForceToContent() gViewerWindow->alertXml("CannotContentifyNothingSelected"); return; } - if(!gWorldp) return; - LLViewerRegion* region = gWorldp->getRegionFromPosGlobal( mWestSouth ); + LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal( mWestSouth ); if (!region) { gViewerWindow->alertXml("CannotContentifyNoRegion"); @@ -1018,8 +992,7 @@ void LLViewerParcelMgr::sendParcelRelease() return; } - if(!gWorldp) return; - LLViewerRegion *region = gWorldp->getRegionFromPosGlobal( mWestSouth ); + LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosGlobal( mWestSouth ); if (!region) { gViewerWindow->alertXml("CannotReleaseLandNoRegion"); @@ -1081,8 +1054,7 @@ LLViewerParcelMgr::ParcelBuyInfo* LLViewerParcelMgr::setupParcelBuy( return NULL; } - if(!gWorldp) return NULL; - LLViewerRegion *region = gWorldp->getRegionFromPosGlobal( mWestSouth ); + LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosGlobal( mWestSouth ); if (!region) { gViewerWindow->alertXml("CannotBuyLandNoRegion"); @@ -1099,7 +1071,7 @@ LLViewerParcelMgr::ParcelBuyInfo* LLViewerParcelMgr::setupParcelBuy( east_north_region_check.mdV[VX] -= 0.5; east_north_region_check.mdV[VY] -= 0.5; - LLViewerRegion *region2 = gWorldp->getRegionFromPosGlobal( east_north_region_check ); + LLViewerRegion *region2 = LLWorld::getInstance()->getRegionFromPosGlobal( east_north_region_check ); if (region != region2) { @@ -1192,8 +1164,7 @@ void LLViewerParcelMgr::sendParcelDeed(const LLUUID& group_id) gViewerWindow->alertXml("CannotDeedLandNoGroup"); return; } - if(!gWorldp) return; - LLViewerRegion *region = gWorldp->getRegionFromPosGlobal( mWestSouth ); + LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosGlobal( mWestSouth ); if (!region) { gViewerWindow->alertXml("CannotDeedLandNoRegion"); @@ -1231,7 +1202,7 @@ void LLViewerParcelMgr::makeLandmarkAtSelection() global_center *= 0.5f; LLViewerRegion* region; - region = gWorldp->getRegionFromPosGlobal(global_center); + region = LLWorld::getInstance()->getRegionFromPosGlobal(global_center); LLVector3 west_south_bottom_region = region->getPosRegionFromGlobal( mWestSouth ); LLVector3 east_north_top_region = region->getPosRegionFromGlobal( mEastNorth ); @@ -1260,8 +1231,8 @@ const LLString& LLViewerParcelMgr::getAgentParcelName() const void LLViewerParcelMgr::sendParcelPropertiesUpdate(LLParcel* parcel, bool use_agent_region) { if (!parcel) return; - if(!gWorldp) return; - LLViewerRegion *region = use_agent_region ? gAgent.getRegion() : gWorldp->getRegionFromPosGlobal( mWestSouth ); + + LLViewerRegion *region = use_agent_region ? gAgent.getRegion() : LLWorld::getInstance()->getRegionFromPosGlobal( mWestSouth ); if (!region) return; LLSD body; @@ -1302,8 +1273,7 @@ void LLViewerParcelMgr::sendParcelPropertiesUpdate(LLParcel* parcel, bool use_ag void LLViewerParcelMgr::requestHoverParcelProperties(const LLVector3d& pos) { - if(!gWorldp) return; - LLViewerRegion* region = gWorldp->getRegionFromPosGlobal( pos ); + LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal( pos ); if (!region) { return; @@ -1356,7 +1326,7 @@ void LLViewerParcelMgr::processParcelOverlay(LLMessageSystem *msg, void **user) return; } - S32 parcels_per_edge = gParcelMgr->mParcelsPerEdge; + S32 parcels_per_edge = LLViewerParcelMgr::getInstance()->mParcelsPerEdge; S32 expected_size = parcels_per_edge * parcels_per_edge / PARCEL_OVERLAY_CHUNKS; if (packed_overlay_size != expected_size) { @@ -1374,7 +1344,7 @@ void LLViewerParcelMgr::processParcelOverlay(LLMessageSystem *msg, void **user) expected_size); LLHost host = msg->getSender(); - LLViewerRegion *region = gWorldp->getRegion(host); + LLViewerRegion *region = LLWorld::getInstance()->getRegion(host); if (region) { region->mParcelOverlay->uncompressLandOverlay( sequence_id, sPackedOverlay ); @@ -1434,31 +1404,31 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use if (sequence_id == SELECTED_PARCEL_SEQ_ID) { // ...selected parcels report this sequence id - gParcelMgr->mRequestResult = PARCEL_RESULT_SUCCESS; - parcel = gParcelMgr->mCurrentParcel; + LLViewerParcelMgr::getInstance()->mRequestResult = PARCEL_RESULT_SUCCESS; + parcel = LLViewerParcelMgr::getInstance()->mCurrentParcel; } else if (sequence_id == HOVERED_PARCEL_SEQ_ID) { - gParcelMgr->mHoverRequestResult = PARCEL_RESULT_SUCCESS; - parcel = gParcelMgr->mHoverParcel; + LLViewerParcelMgr::getInstance()->mHoverRequestResult = PARCEL_RESULT_SUCCESS; + parcel = LLViewerParcelMgr::getInstance()->mHoverParcel; } else if (sequence_id == COLLISION_NOT_IN_GROUP_PARCEL_SEQ_ID || sequence_id == COLLISION_NOT_ON_LIST_PARCEL_SEQ_ID || sequence_id == COLLISION_BANNED_PARCEL_SEQ_ID) { - gParcelMgr->mHoverRequestResult = PARCEL_RESULT_SUCCESS; - parcel = gParcelMgr->mCollisionParcel; + LLViewerParcelMgr::getInstance()->mHoverRequestResult = PARCEL_RESULT_SUCCESS; + parcel = LLViewerParcelMgr::getInstance()->mCollisionParcel; } - else if (sequence_id == 0 || sequence_id > gParcelMgr->mAgentParcelSequenceID) + else if (sequence_id == 0 || sequence_id > LLViewerParcelMgr::getInstance()->mAgentParcelSequenceID) { // new agent parcel - gParcelMgr->mAgentParcelSequenceID = sequence_id; - parcel = gParcelMgr->mAgentParcel; + LLViewerParcelMgr::getInstance()->mAgentParcelSequenceID = sequence_id; + parcel = LLViewerParcelMgr::getInstance()->mAgentParcel; } else { llinfos << "out of order agent parcel sequence id " << sequence_id - << " last good " << gParcelMgr->mAgentParcelSequenceID + << " last good " << LLViewerParcelMgr::getInstance()->mAgentParcelSequenceID << llendl; return; } @@ -1529,15 +1499,15 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use parcel->setRegionDenyAgeUnverifiedOverride(region_deny_age_unverified_override); parcel->unpackMessage(msg); - if (parcel == gParcelMgr->mAgentParcel) + if (parcel == LLViewerParcelMgr::getInstance()->mAgentParcel) { - S32 bitmap_size = gParcelMgr->mParcelsPerEdge - * gParcelMgr->mParcelsPerEdge + S32 bitmap_size = LLViewerParcelMgr::getInstance()->mParcelsPerEdge + * LLViewerParcelMgr::getInstance()->mParcelsPerEdge / 8; U8* bitmap = new U8[ bitmap_size ]; msg->getBinaryDataFast(_PREHASH_ParcelData, _PREHASH_Bitmap, bitmap, bitmap_size); - gParcelMgr->writeAgentParcelFromBitmap(bitmap); + LLViewerParcelMgr::getInstance()->writeAgentParcelFromBitmap(bitmap); delete[] bitmap; } } @@ -1546,80 +1516,79 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use if (sequence_id == SELECTED_PARCEL_SEQ_ID) { // Update selected counts - gParcelMgr->mCurrentParcelSelection->mSelectedSelfCount = self_count; - gParcelMgr->mCurrentParcelSelection->mSelectedOtherCount = other_count; - gParcelMgr->mCurrentParcelSelection->mSelectedPublicCount = public_count; + LLViewerParcelMgr::getInstance()->mCurrentParcelSelection->mSelectedSelfCount = self_count; + LLViewerParcelMgr::getInstance()->mCurrentParcelSelection->mSelectedOtherCount = other_count; + LLViewerParcelMgr::getInstance()->mCurrentParcelSelection->mSelectedPublicCount = public_count; - gParcelMgr->mCurrentParcelSelection->mSelectedMultipleOwners = + LLViewerParcelMgr::getInstance()->mCurrentParcelSelection->mSelectedMultipleOwners = (request_result == PARCEL_RESULT_MULTIPLE); // Select the whole parcel - if(!gWorldp) return; - LLViewerRegion* region = gWorldp->getRegion( msg->getSender() ); + LLViewerRegion* region = LLWorld::getInstance()->getRegion( msg->getSender() ); if (region) { if (!snap_selection) { // don't muck with the westsouth and eastnorth. // just highlight it - LLVector3 west_south = region->getPosRegionFromGlobal(gParcelMgr->mWestSouth); - LLVector3 east_north = region->getPosRegionFromGlobal(gParcelMgr->mEastNorth); + LLVector3 west_south = region->getPosRegionFromGlobal(LLViewerParcelMgr::getInstance()->mWestSouth); + LLVector3 east_north = region->getPosRegionFromGlobal(LLViewerParcelMgr::getInstance()->mEastNorth); - gParcelMgr->resetSegments(gParcelMgr->mHighlightSegments); - gParcelMgr->writeHighlightSegments( + LLViewerParcelMgr::getInstance()->resetSegments(LLViewerParcelMgr::getInstance()->mHighlightSegments); + LLViewerParcelMgr::getInstance()->writeHighlightSegments( west_south.mV[VX], west_south.mV[VY], east_north.mV[VX], east_north.mV[VY] ); - gParcelMgr->mCurrentParcelSelection->mWholeParcelSelected = FALSE; + LLViewerParcelMgr::getInstance()->mCurrentParcelSelection->mWholeParcelSelected = FALSE; } else if (0 == local_id) { // this is public land, just highlight the selection - gParcelMgr->mWestSouth = region->getPosGlobalFromRegion( aabb_min ); - gParcelMgr->mEastNorth = region->getPosGlobalFromRegion( aabb_max ); + LLViewerParcelMgr::getInstance()->mWestSouth = region->getPosGlobalFromRegion( aabb_min ); + LLViewerParcelMgr::getInstance()->mEastNorth = region->getPosGlobalFromRegion( aabb_max ); - gParcelMgr->resetSegments(gParcelMgr->mHighlightSegments); - gParcelMgr->writeHighlightSegments( + LLViewerParcelMgr::getInstance()->resetSegments(LLViewerParcelMgr::getInstance()->mHighlightSegments); + LLViewerParcelMgr::getInstance()->writeHighlightSegments( aabb_min.mV[VX], aabb_min.mV[VY], aabb_max.mV[VX], aabb_max.mV[VY] ); - gParcelMgr->mCurrentParcelSelection->mWholeParcelSelected = TRUE; + LLViewerParcelMgr::getInstance()->mCurrentParcelSelection->mWholeParcelSelected = TRUE; } else { - gParcelMgr->mWestSouth = region->getPosGlobalFromRegion( aabb_min ); - gParcelMgr->mEastNorth = region->getPosGlobalFromRegion( aabb_max ); + LLViewerParcelMgr::getInstance()->mWestSouth = region->getPosGlobalFromRegion( aabb_min ); + LLViewerParcelMgr::getInstance()->mEastNorth = region->getPosGlobalFromRegion( aabb_max ); // Owned land, highlight the boundaries - S32 bitmap_size = gParcelMgr->mParcelsPerEdge - * gParcelMgr->mParcelsPerEdge + S32 bitmap_size = LLViewerParcelMgr::getInstance()->mParcelsPerEdge + * LLViewerParcelMgr::getInstance()->mParcelsPerEdge / 8; U8* bitmap = new U8[ bitmap_size ]; msg->getBinaryDataFast(_PREHASH_ParcelData, _PREHASH_Bitmap, bitmap, bitmap_size); - gParcelMgr->resetSegments(gParcelMgr->mHighlightSegments); - gParcelMgr->writeSegmentsFromBitmap( bitmap, gParcelMgr->mHighlightSegments ); + LLViewerParcelMgr::getInstance()->resetSegments(LLViewerParcelMgr::getInstance()->mHighlightSegments); + LLViewerParcelMgr::getInstance()->writeSegmentsFromBitmap( bitmap, LLViewerParcelMgr::getInstance()->mHighlightSegments ); delete[] bitmap; bitmap = NULL; - gParcelMgr->mCurrentParcelSelection->mWholeParcelSelected = TRUE; + LLViewerParcelMgr::getInstance()->mCurrentParcelSelection->mWholeParcelSelected = TRUE; } // Request access list information for this land - gParcelMgr->sendParcelAccessListRequest(AL_ACCESS | AL_BAN); + LLViewerParcelMgr::getInstance()->sendParcelAccessListRequest(AL_ACCESS | AL_BAN); // Request dwell for this land, if it's not public land. - gParcelMgr->mSelectedDwell = 0.f; + LLViewerParcelMgr::getInstance()->mSelectedDwell = 0.f; if (0 != local_id) { - gParcelMgr->sendParcelDwellRequest(); + LLViewerParcelMgr::getInstance()->sendParcelDwellRequest(); } - gParcelMgr->mSelected = TRUE; - gParcelMgr->notifyObservers(); + LLViewerParcelMgr::getInstance()->mSelected = TRUE; + LLViewerParcelMgr::getInstance()->notifyObservers(); } } else if (sequence_id == COLLISION_NOT_IN_GROUP_PARCEL_SEQ_ID || @@ -1627,32 +1596,32 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use sequence_id == COLLISION_BANNED_PARCEL_SEQ_ID) { // We're about to collide with this parcel - gParcelMgr->mRenderCollision = TRUE; - gParcelMgr->mCollisionTimer.reset(); + LLViewerParcelMgr::getInstance()->mRenderCollision = TRUE; + LLViewerParcelMgr::getInstance()->mCollisionTimer.reset(); // Differentiate this parcel if we are banned from it. if (sequence_id == COLLISION_BANNED_PARCEL_SEQ_ID) { - gParcelMgr->mCollisionBanned = BA_BANNED; + LLViewerParcelMgr::getInstance()->mCollisionBanned = BA_BANNED; } else if (sequence_id == COLLISION_NOT_IN_GROUP_PARCEL_SEQ_ID) { - gParcelMgr->mCollisionBanned = BA_NOT_IN_GROUP; + LLViewerParcelMgr::getInstance()->mCollisionBanned = BA_NOT_IN_GROUP; } else { - gParcelMgr->mCollisionBanned = BA_NOT_ON_LIST; + LLViewerParcelMgr::getInstance()->mCollisionBanned = BA_NOT_ON_LIST; } - S32 bitmap_size = gParcelMgr->mParcelsPerEdge - * gParcelMgr->mParcelsPerEdge + S32 bitmap_size = LLViewerParcelMgr::getInstance()->mParcelsPerEdge + * LLViewerParcelMgr::getInstance()->mParcelsPerEdge / 8; U8* bitmap = new U8[ bitmap_size ]; msg->getBinaryDataFast(_PREHASH_ParcelData, _PREHASH_Bitmap, bitmap, bitmap_size); - gParcelMgr->resetSegments(gParcelMgr->mCollisionSegments); - gParcelMgr->writeSegmentsFromBitmap( bitmap, gParcelMgr->mCollisionSegments ); + LLViewerParcelMgr::getInstance()->resetSegments(LLViewerParcelMgr::getInstance()->mCollisionSegments); + LLViewerParcelMgr::getInstance()->writeSegmentsFromBitmap( bitmap, LLViewerParcelMgr::getInstance()->mCollisionSegments ); delete[] bitmap; bitmap = NULL; @@ -1660,16 +1629,16 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use } else if (sequence_id == HOVERED_PARCEL_SEQ_ID) { - LLViewerRegion *region = gWorldp->getRegion( msg->getSender() ); + LLViewerRegion *region = LLWorld::getInstance()->getRegion( msg->getSender() ); if (region) { - gParcelMgr->mHoverWestSouth = region->getPosGlobalFromRegion( aabb_min ); - gParcelMgr->mHoverEastNorth = region->getPosGlobalFromRegion( aabb_max ); + LLViewerParcelMgr::getInstance()->mHoverWestSouth = region->getPosGlobalFromRegion( aabb_min ); + LLViewerParcelMgr::getInstance()->mHoverEastNorth = region->getPosGlobalFromRegion( aabb_max ); } else { - gParcelMgr->mHoverWestSouth.clearVec(); - gParcelMgr->mHoverEastNorth.clearVec(); + LLViewerParcelMgr::getInstance()->mHoverWestSouth.clearVec(); + LLViewerParcelMgr::getInstance()->mHoverEastNorth.clearVec(); } } else @@ -1738,7 +1707,6 @@ void optionally_start_music(const LLString& music_url) } } - // static void LLViewerParcelMgr::processParcelAccessListReply(LLMessageSystem *msg, void **user) { @@ -1752,7 +1720,7 @@ void LLViewerParcelMgr::processParcelAccessListReply(LLMessageSystem *msg, void msg->getU32Fast( _PREHASH_Data, _PREHASH_Flags, message_flags); msg->getS32Fast( _PREHASH_Data, _PREHASH_LocalID, parcel_id); - LLParcel* parcel = gParcelMgr->mCurrentParcel; + LLParcel* parcel = LLViewerParcelMgr::getInstance()->mCurrentParcel; if (!parcel) return; if (parcel_id != parcel->getLocalID()) @@ -1775,7 +1743,7 @@ void LLViewerParcelMgr::processParcelAccessListReply(LLMessageSystem *msg, void parcel->unpackAccessEntries(msg, &(parcel->mRenterList) ); }*/ - gParcelMgr->notifyObservers(); + LLViewerParcelMgr::getInstance()->notifyObservers(); } @@ -1794,10 +1762,10 @@ void LLViewerParcelMgr::processParcelDwellReply(LLMessageSystem* msg, void**) F32 dwell; msg->getF32("Data", "Dwell", dwell); - if (local_id == gParcelMgr->mCurrentParcel->getLocalID()) + if (local_id == LLViewerParcelMgr::getInstance()->mCurrentParcel->getLocalID()) { - gParcelMgr->mSelectedDwell = dwell; - gParcelMgr->notifyObservers(); + LLViewerParcelMgr::getInstance()->mSelectedDwell = dwell; + LLViewerParcelMgr::getInstance()->notifyObservers(); } } @@ -1813,8 +1781,7 @@ void LLViewerParcelMgr::sendParcelAccessListUpdate(U32 which) return; } - if(!gWorldp) return; - LLViewerRegion* region = gWorldp->getRegionFromPosGlobal( mWestSouth ); + LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal( mWestSouth ); if (!region) return; LLMessageSystem* msg = gMessageSystem; @@ -1963,13 +1930,13 @@ void LLViewerParcelMgr::deedAlertCB(S32 option, void*) { if (option == 0) { - LLParcel* parcel = gParcelMgr->getParcelSelection()->getParcel(); + LLParcel* parcel = LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel(); LLUUID group_id; if(parcel) { group_id = parcel->getGroupID(); } - gParcelMgr->sendParcelDeed(group_id); + LLViewerParcelMgr::getInstance()->sendParcelDeed(group_id); } } @@ -2002,8 +1969,7 @@ void LLViewerParcelMgr::startReleaseLand() } LLVector3d parcel_center = (mWestSouth + mEastNorth) / 2.0; - if(!gWorldp) return; - LLViewerRegion* region = gWorldp->getRegionFromPosGlobal(parcel_center); + LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal(parcel_center); if (!region) { gViewerWindow->alertXml("CannotReleaseLandRegionNotFound"); @@ -2107,8 +2073,7 @@ void LLViewerParcelMgr::callbackDivideLand(S32 option, void* data) LLViewerParcelMgr* self = (LLViewerParcelMgr*)data; LLVector3d parcel_center = (self->mWestSouth + self->mEastNorth) / 2.0; - if(!gWorldp) return; - LLViewerRegion* region = gWorldp->getRegionFromPosGlobal(parcel_center); + LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal(parcel_center); if (!region) { gViewerWindow->alertXml("CannotDivideLandNoRegion"); @@ -2166,8 +2131,7 @@ void LLViewerParcelMgr::callbackJoinLand(S32 option, void* data) LLViewerParcelMgr* self = (LLViewerParcelMgr*)data; LLVector3d parcel_center = (self->mWestSouth + self->mEastNorth) / 2.0; - if(!gWorldp) return; - LLViewerRegion* region = gWorldp->getRegionFromPosGlobal(parcel_center); + LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal(parcel_center); if (!region) { gViewerWindow->alertXml("CannotJoinLandNoRegion"); @@ -2215,8 +2179,7 @@ void LLViewerParcelMgr::startDeedLandToGroup() } LLVector3d parcel_center = (mWestSouth + mEastNorth) / 2.0; - if(!gWorldp) return; - LLViewerRegion* region = gWorldp->getRegionFromPosGlobal(parcel_center); + LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal(parcel_center); if (!region) { gViewerWindow->alertXml("CannotDeedLandNoRegion"); @@ -2241,8 +2204,8 @@ void LLViewerParcelMgr::startDeedLandToGroup() } void LLViewerParcelMgr::reclaimParcel() { - LLParcel* parcel = gParcelMgr->getParcelSelection()->getParcel(); - LLViewerRegion* regionp = gParcelMgr->getSelectionRegion(); + LLParcel* parcel = LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel(); + LLViewerRegion* regionp = LLViewerParcelMgr::getInstance()->getSelectionRegion(); if(parcel && parcel->getOwnerID().notNull() && (parcel->getOwnerID() != gAgent.getID()) && regionp && (regionp->getOwner() == gAgent.getID())) @@ -2264,7 +2227,7 @@ void LLViewerParcelMgr::releaseAlertCB(S32 option, void *) if (option == 0) { // Send the release message, not a force - gParcelMgr->sendParcelRelease(); + LLViewerParcelMgr::getInstance()->sendParcelRelease(); } } @@ -2367,8 +2330,6 @@ void sanitize_corners(const LLVector3d &corner1, void LLViewerParcelMgr::cleanupGlobals() { - delete gParcelMgr; - gParcelMgr = NULL; LLParcelSelection::sNullSelection = NULL; } diff --git a/indra/newview/llviewerparcelmgr.h b/indra/newview/llviewerparcelmgr.h index f86ffe309f..37499e3751 100644 --- a/indra/newview/llviewerparcelmgr.h +++ b/indra/newview/llviewerparcelmgr.h @@ -37,6 +37,7 @@ #include "llframetimer.h" #include "llmemory.h" #include "llparcelselection.h" +#include "llui.h" class LLUUID; class LLMessageSystem; @@ -73,8 +74,7 @@ public: virtual void changed() = 0; }; - -class LLViewerParcelMgr +class LLViewerParcelMgr : public LLSingleton<LLViewerParcelMgr> { public: @@ -325,15 +325,14 @@ private: BOOL mRenderSelection; S32 mCollisionBanned; LLFrameTimer mCollisionTimer; - LLUUID mBlockedImageID; - LLUUID mPassImageID; + LLImageGL* mBlockedImage; + LLImageGL* mPassImage; // Media S32 mMediaParcelId; U64 mMediaRegionId; }; -extern LLViewerParcelMgr *gParcelMgr; void sanitize_corners(const LLVector3d &corner1, const LLVector3d &corner2, LLVector3d &west_south_bottom, LLVector3d &east_north_top); diff --git a/indra/newview/llviewerparceloverlay.cpp b/indra/newview/llviewerparceloverlay.cpp index 3dc14caa2d..b105267723 100644 --- a/indra/newview/llviewerparceloverlay.cpp +++ b/indra/newview/llviewerparceloverlay.cpp @@ -58,7 +58,6 @@ LLViewerParcelOverlay::LLViewerParcelOverlay(LLViewerRegion* region, F32 region_ mDirty( FALSE ), mTimeSinceLastUpdate(), mOverlayTextureIdx(-1), - mLineImageID( gViewerArt.getString("propertyline.tga") ), mVertexCount(0), mVertexArray(NULL), mColorArray(NULL) @@ -750,20 +749,15 @@ S32 LLViewerParcelOverlay::renderPropertyLines () LLGLSNoTexture gls_no_texture; LLGLDepthTest mDepthTest(GL_TRUE); - // JC - This doesn't work. - //gGLSUITextureDepth.set(); - //LLViewerImage* image = gImageList.getImage( mLineImageID ); - //image->bindTexture(); - // Find camera height off the ground (not from zero) F32 ground_height_at_camera = land.resolveHeightGlobal( gAgent.getCameraPositionGlobal() ); - F32 camera_z = gCamera->getOrigin().mV[VZ]; + F32 camera_z = LLViewerCamera::getInstance()->getOrigin().mV[VZ]; F32 camera_height = camera_z - ground_height_at_camera; camera_height = llclamp(camera_height, 0.f, 100.f); // Pull lines toward camera by 1 cm per meter off the ground. - const LLVector3& CAMERA_AT = gCamera->getAtAxis(); + const LLVector3& CAMERA_AT = LLViewerCamera::getInstance()->getAtAxis(); F32 pull_toward_camera_scale = 0.01f * camera_height; LLVector3 pull_toward_camera = CAMERA_AT; pull_toward_camera *= -pull_toward_camera_scale; @@ -791,7 +785,7 @@ S32 LLViewerParcelOverlay::renderPropertyLines () // Set up a cull plane 2 * PARCEL_GRID_STEP_METERS behind // the camera. The cull plane normal is the camera's at axis. - LLVector3 cull_plane_point = gCamera->getAtAxis(); + LLVector3 cull_plane_point = LLViewerCamera::getInstance()->getAtAxis(); cull_plane_point *= -2.f * PARCEL_GRID_STEP_METERS; cull_plane_point += camera_region; diff --git a/indra/newview/llviewerparceloverlay.h b/indra/newview/llviewerparceloverlay.h index f134795589..7f961b9333 100644 --- a/indra/newview/llviewerparceloverlay.h +++ b/indra/newview/llviewerparceloverlay.h @@ -111,7 +111,6 @@ private: LLFrameTimer mTimeSinceLastUpdate; S32 mOverlayTextureIdx; - LLUUID mLineImageID; S32 mVertexCount; F32* mVertexArray; U8* mColorArray; diff --git a/indra/newview/llviewerpartsim.cpp b/indra/newview/llviewerpartsim.cpp index 93e3ad2919..223078ffe0 100644 --- a/indra/newview/llviewerpartsim.cpp +++ b/indra/newview/llviewerpartsim.cpp @@ -70,7 +70,7 @@ U32 LLViewerPart::sNextPartID = 1; F32 calc_desired_size(LLVector3 pos, LLVector2 scale) { - F32 desired_size = (pos-gCamera->getOrigin()).magVec(); + F32 desired_size = (pos-LLViewerCamera::getInstance()->getOrigin()).magVec(); desired_size /= 4; return llclamp(desired_size, scale.magVec()*0.5f, PART_SIM_BOX_SIDE*2); } @@ -117,7 +117,7 @@ LLViewerPartGroup::LLViewerPartGroup(const LLVector3 ¢er_agent, const F32 bo mVOPartGroupp = NULL; mUniformParticles = TRUE; - mRegionp = gWorldPointer->getRegionFromPosAgent(center_agent); + mRegionp = LLWorld::getInstance()->getRegionFromPosAgent(center_agent); llassert_always(center_agent.isFinite()); if (!mRegionp) @@ -367,7 +367,7 @@ void LLViewerPartGroup::updateParticles(const F32 lastdt) if (!posInGroup(part.mPosAgent, desired_size)) { // Transfer particles between groups - gWorldPointer->mPartSim.put(&part); + LLViewerPartSim::getInstance()->put(&part); end--; LLPointer<LLViewerPart>::swap(mParticles[i], mParticles[end]); // be sure to process the particle we just swapped-in @@ -441,7 +441,7 @@ LLViewerPartSim::LLViewerPartSim() } -LLViewerPartSim::~LLViewerPartSim() +void LLViewerPartSim::destroyClass() { LLMemType mt(LLMemType::MTYPE_PARTICLES); S32 i; diff --git a/indra/newview/llviewerpartsim.h b/indra/newview/llviewerpartsim.h index 343425f3d4..daccac4e8f 100644 --- a/indra/newview/llviewerpartsim.h +++ b/indra/newview/llviewerpartsim.h @@ -35,12 +35,11 @@ #include "lldarrayptr.h" #include "llframetimer.h" #include "llmemory.h" - #include "llpartdata.h" +#include "llviewerpartsource.h" class LLViewerImage; class LLViewerPart; -class LLViewerPartSource; class LLViewerRegion; class LLViewerImage; class LLVOPartGroup; @@ -126,11 +125,12 @@ protected: LLViewerRegion *mRegionp; }; -class LLViewerPartSim +class LLViewerPartSim : public LLSingleton<LLViewerPartSim> { public: LLViewerPartSim(); - virtual ~LLViewerPartSim(); + virtual ~LLViewerPartSim(){} + void destroyClass(); typedef std::vector<LLViewerPartGroup *> group_list_t; typedef std::vector<LLPointer<LLViewerPartSource> > source_list_t; diff --git a/indra/newview/llviewerpartsource.cpp b/indra/newview/llviewerpartsource.cpp index db356064d4..3c3b1bf3ff 100644 --- a/indra/newview/llviewerpartsource.cpp +++ b/indra/newview/llviewerpartsource.cpp @@ -97,9 +97,7 @@ LLViewerPartSourceScript::LLViewerPartSourceScript(LLViewerObject *source_objp) llassert(source_objp); mSourceObjectp = source_objp; mPosAgent = mSourceObjectp->getPositionAgent(); - LLUUID id; - id.set( gViewerArt.getString("pixiesmall.tga") ); - mImagep = gImageList.getImage(id); + mImagep = gImageList.getImageFromFile("pixiesmall.j2c"); mImagep->bind(); mImagep->setClamp(TRUE, TRUE); } @@ -122,7 +120,7 @@ void LLViewerPartSourceScript::update(const F32 dt) F32 old_update_time = mLastUpdateTime; mLastUpdateTime += dt; - F32 ref_rate_travelspeed = llmin(gWorldPointer->mPartSim.getRefRate(), 1.f); + F32 ref_rate_travelspeed = llmin(LLViewerPartSim::getInstance()->getRefRate(), 1.f); F32 dt_update = mLastUpdateTime - mLastPartTime; @@ -212,7 +210,7 @@ void LLViewerPartSourceScript::update(const F32 dt) mRotation.setQuat(0, 0, 0); } - if (gWorldPointer->mPartSim.aboveParticleLimit()) + if (LLViewerPartSim::getInstance()->aboveParticleLimit()) { // Don't bother doing any more updates if we're above the particle limit, // just give up. @@ -234,7 +232,7 @@ void LLViewerPartSourceScript::update(const F32 dt) (mPartSysData.mPartData.mStartScale[1] + mPartSysData.mPartData.mEndScale[1])/2)); - F32 pixel_meter_ratio = gCamera->getPixelMeterRatio(); + F32 pixel_meter_ratio = LLViewerCamera::getInstance()->getPixelMeterRatio(); // Maximum distance at which spawned particles will be viewable F32 max_dist = max_short_side * pixel_meter_ratio; @@ -249,7 +247,7 @@ void LLViewerPartSourceScript::update(const F32 dt) } // Distance from camera - F32 dist = (mPosAgent - gCamera->getOrigin()).magVec(); + F32 dist = (mPosAgent - LLViewerCamera::getInstance()->getOrigin()).magVec(); // Particle size vs distance vs maxage throttling @@ -273,7 +271,7 @@ void LLViewerPartSourceScript::update(const F32 dt) S32 i; for (i = 0; i < mPartSysData.mBurstPartCount; i++) { - if (ll_frand() < llmax(1.0f - gWorldPointer->mPartSim.getBurstRate(), limited_rate)) + if (ll_frand() < llmax(1.0f - LLViewerPartSim::getInstance()->getBurstRate(), limited_rate)) { // Limit particle generation continue; @@ -384,7 +382,7 @@ void LLViewerPartSourceScript::update(const F32 dt) mPartSysData.mBurstRadius = 0; } - gWorldPointer->mPartSim.addPart(part); + LLViewerPartSim::getInstance()->addPart(part); } mLastPartTime = mLastUpdateTime; @@ -527,9 +525,7 @@ void LLViewerPartSourceSpiral::update(const F32 dt) LLMemType mt(LLMemType::MTYPE_PARTICLES); if (!mImagep) { - LLUUID id; - id.set( gViewerArt.getString("pixiesmall.tga") ); - mImagep = gImageList.getImage(id); + mImagep = gImageList.getImageFromFile("pixiesmall.j2c"); } const F32 RATE = 0.025f; @@ -543,7 +539,7 @@ void LLViewerPartSourceSpiral::update(const F32 dt) if (dt_update > RATE) { mLastPartTime = mLastUpdateTime; - if (!gWorldPointer->mPartSim.shouldAddPart()) + if (!LLViewerPartSim::getInstance()->shouldAddPart()) { // Particle simulation says we have too many particles, skip all this return; @@ -566,7 +562,7 @@ void LLViewerPartSourceSpiral::update(const F32 dt) part->mScale.mV[1] = 0.25f; part->mParameter = ll_frand(F_TWO_PI); - gWorldPointer->mPartSim.addPart(part); + LLViewerPartSim::getInstance()->addPart(part); } } @@ -690,7 +686,7 @@ void LLViewerPartSourceBeam::update(const F32 dt) if (dt_update > RATE) { mLastPartTime = mLastUpdateTime; - if (!gWorldPointer->mPartSim.shouldAddPart()) + if (!LLViewerPartSim::getInstance()->shouldAddPart()) { // Particle simulation says we have too many particles, skip all this return; @@ -698,9 +694,7 @@ void LLViewerPartSourceBeam::update(const F32 dt) if (!mImagep) { - LLUUID id; - id.set( gViewerArt.getString("pixiesmall.tga") ); - mImagep = gImageList.getImage(id); + mImagep = gImageList.getImageFromFile("pixiesmall.j2c"); } LLPointer<LLViewerPart> part = new LLViewerPart(); @@ -723,7 +717,7 @@ void LLViewerPartSourceBeam::update(const F32 dt) part->mPosAgent = mPosAgent; part->mVelocity = mTargetPosAgent - mPosAgent; - gWorldPointer->mPartSim.addPart(part); + LLViewerPartSim::getInstance()->addPart(part); } } @@ -786,9 +780,7 @@ void LLViewerPartSourceChat::update(const F32 dt) LLMemType mt(LLMemType::MTYPE_PARTICLES); if (!mImagep) { - LLUUID id; - id.set( gViewerArt.getString("pixiesmall.tga") ); - mImagep = gImageList.getImage(id); + mImagep = gImageList.getImageFromFile("pixiesmall.j2c"); } @@ -812,7 +804,7 @@ void LLViewerPartSourceChat::update(const F32 dt) if (dt_update > RATE) { mLastPartTime = mLastUpdateTime; - if (!gWorldPointer->mPartSim.shouldAddPart()) + if (!LLViewerPartSim::getInstance()->shouldAddPart()) { // Particle simulation says we have too many particles, skip all this return; @@ -835,7 +827,7 @@ void LLViewerPartSourceChat::update(const F32 dt) part->mScale.mV[1] = 0.25f; part->mParameter = ll_frand(F_TWO_PI); - gWorldPointer->mPartSim.addPart(part); + LLViewerPartSim::getInstance()->addPart(part); } } diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 12d461d0d7..4b7c849171 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -179,7 +179,7 @@ LLViewerRegion::~LLViewerRegion() // This should be reference counted... disconnectAllNeighbors(); mCloudLayer.destroy(); - gWorldPointer->mPartSim.cleanupRegion(this); + LLViewerPartSim::getInstance()->cleanupRegion(this); gObjectList.killObjects(this); @@ -626,7 +626,7 @@ F32 LLViewerRegion::getCompositionXY(const S32 x, const S32 y) const if (y >= 256) { LLVector3d center = getCenterGlobal() + LLVector3d(256.f, 256.f, 0.f); - LLViewerRegion *regionp = gWorldPointer->getRegionFromPosGlobal(center); + LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromPosGlobal(center); if (regionp) { // OK, we need to do some hackery here - different simulators no longer use @@ -653,7 +653,7 @@ F32 LLViewerRegion::getCompositionXY(const S32 x, const S32 y) const else { LLVector3d center = getCenterGlobal() + LLVector3d(256.f, 0, 0.f); - LLViewerRegion *regionp = gWorldPointer->getRegionFromPosGlobal(center); + LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromPosGlobal(center); if (regionp) { // OK, we need to do some hackery here - different simulators no longer use @@ -681,7 +681,7 @@ F32 LLViewerRegion::getCompositionXY(const S32 x, const S32 y) const else if (y >= 256) { LLVector3d center = getCenterGlobal() + LLVector3d(0.f, 256.f, 0.f); - LLViewerRegion *regionp = gWorldPointer->getRegionFromPosGlobal(center); + LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromPosGlobal(center); if (regionp) { // OK, we need to do some hackery here - different simulators no longer use @@ -868,9 +868,8 @@ public: const LLSD& context, const LLSD& input) const { - if(!gWorldp) return; LLHost host(input["sender"].asString()); - LLViewerRegion* region = gWorldp->getRegion(host); + LLViewerRegion* region = LLWorld::getInstance()->getRegion(host); if( !region ) { return; diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index 93919fba05..7c99d5f65c 100644 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -59,7 +59,6 @@ #include "lllcd.h" #endif -LLViewerStats *gViewerStats = NULL; class StatAttributes { @@ -223,17 +222,17 @@ LLViewerStats::~LLViewerStats() void LLViewerStats::resetStats() { - gViewerStats->mKBitStat.reset(); - gViewerStats->mLayersKBitStat.reset(); - gViewerStats->mObjectKBitStat.reset(); - gViewerStats->mTextureKBitStat.reset(); - gViewerStats->mVFSPendingOperations.reset(); - gViewerStats->mAssetKBitStat.reset(); - gViewerStats->mPacketsInStat.reset(); - gViewerStats->mPacketsLostStat.reset(); - gViewerStats->mPacketsOutStat.reset(); - gViewerStats->mFPSStat.reset(); - gViewerStats->mTexturePacketsStat.reset(); + LLViewerStats::getInstance()->mKBitStat.reset(); + LLViewerStats::getInstance()->mLayersKBitStat.reset(); + LLViewerStats::getInstance()->mObjectKBitStat.reset(); + LLViewerStats::getInstance()->mTextureKBitStat.reset(); + LLViewerStats::getInstance()->mVFSPendingOperations.reset(); + LLViewerStats::getInstance()->mAssetKBitStat.reset(); + LLViewerStats::getInstance()->mPacketsInStat.reset(); + LLViewerStats::getInstance()->mPacketsLostStat.reset(); + LLViewerStats::getInstance()->mPacketsOutStat.reset(); + LLViewerStats::getInstance()->mFPSStat.reset(); + LLViewerStats::getInstance()->mTexturePacketsStat.reset(); } @@ -511,54 +510,54 @@ void update_statistics(U32 frame_count) { if (gAgent.getCameraMode() == CAMERA_MODE_MOUSELOOK) { - gViewerStats->incStat(LLViewerStats::ST_MOUSELOOK_SECONDS, gFrameIntervalSeconds); + LLViewerStats::getInstance()->incStat(LLViewerStats::ST_MOUSELOOK_SECONDS, gFrameIntervalSeconds); } else if (gAgent.getCameraMode() == CAMERA_MODE_CUSTOMIZE_AVATAR) { - gViewerStats->incStat(LLViewerStats::ST_AVATAR_EDIT_SECONDS, gFrameIntervalSeconds); + LLViewerStats::getInstance()->incStat(LLViewerStats::ST_AVATAR_EDIT_SECONDS, gFrameIntervalSeconds); } else if (gFloaterTools && gFloaterTools->getVisible()) { - gViewerStats->incStat(LLViewerStats::ST_TOOLBOX_SECONDS, gFrameIntervalSeconds); + LLViewerStats::getInstance()->incStat(LLViewerStats::ST_TOOLBOX_SECONDS, gFrameIntervalSeconds); } } - gViewerStats->setStat(LLViewerStats::ST_ENABLE_VBO, (F64)gSavedSettings.getBOOL("RenderVBOEnable")); - gViewerStats->setStat(LLViewerStats::ST_LIGHTING_DETAIL, (F64)gSavedSettings.getS32("RenderLightingDetail")); - gViewerStats->setStat(LLViewerStats::ST_DRAW_DIST, (F64)gSavedSettings.getF32("RenderFarClip")); - gViewerStats->setStat(LLViewerStats::ST_CHAT_BUBBLES, (F64)gSavedSettings.getBOOL("UseChatBubbles")); + LLViewerStats::getInstance()->setStat(LLViewerStats::ST_ENABLE_VBO, (F64)gSavedSettings.getBOOL("RenderVBOEnable")); + LLViewerStats::getInstance()->setStat(LLViewerStats::ST_LIGHTING_DETAIL, (F64)gSavedSettings.getS32("RenderLightingDetail")); + LLViewerStats::getInstance()->setStat(LLViewerStats::ST_DRAW_DIST, (F64)gSavedSettings.getF32("RenderFarClip")); + LLViewerStats::getInstance()->setStat(LLViewerStats::ST_CHAT_BUBBLES, (F64)gSavedSettings.getBOOL("UseChatBubbles")); #if 0 // 1.9.2 - gViewerStats->setStat(LLViewerStats::ST_SHADER_OBJECTS, (F64)gSavedSettings.getS32("VertexShaderLevelObject")); - gViewerStats->setStat(LLViewerStats::ST_SHADER_AVATAR, (F64)gSavedSettings.getBOOL("VertexShaderLevelAvatar")); - gViewerStats->setStat(LLViewerStats::ST_SHADER_ENVIRONMENT, (F64)gSavedSettings.getBOOL("VertexShaderLevelEnvironment")); + LLViewerStats::getInstance()->setStat(LLViewerStats::ST_SHADER_OBJECTS, (F64)gSavedSettings.getS32("VertexShaderLevelObject")); + LLViewerStats::getInstance()->setStat(LLViewerStats::ST_SHADER_AVATAR, (F64)gSavedSettings.getBOOL("VertexShaderLevelAvatar")); + LLViewerStats::getInstance()->setStat(LLViewerStats::ST_SHADER_ENVIRONMENT, (F64)gSavedSettings.getBOOL("VertexShaderLevelEnvironment")); #endif - gViewerStats->setStat(LLViewerStats::ST_FRAME_SECS, gDebugView->mFastTimerView->getTime(LLFastTimer::FTM_FRAME)); + LLViewerStats::getInstance()->setStat(LLViewerStats::ST_FRAME_SECS, gDebugView->mFastTimerView->getTime(LLFastTimer::FTM_FRAME)); F64 idle_secs = gDebugView->mFastTimerView->getTime(LLFastTimer::FTM_IDLE); F64 network_secs = gDebugView->mFastTimerView->getTime(LLFastTimer::FTM_NETWORK); - gViewerStats->setStat(LLViewerStats::ST_UPDATE_SECS, idle_secs - network_secs); - gViewerStats->setStat(LLViewerStats::ST_NETWORK_SECS, network_secs); - gViewerStats->setStat(LLViewerStats::ST_IMAGE_SECS, gDebugView->mFastTimerView->getTime(LLFastTimer::FTM_IMAGE_UPDATE)); - gViewerStats->setStat(LLViewerStats::ST_REBUILD_SECS, gDebugView->mFastTimerView->getTime(LLFastTimer::FTM_STATESORT )); - gViewerStats->setStat(LLViewerStats::ST_RENDER_SECS, gDebugView->mFastTimerView->getTime(LLFastTimer::FTM_RENDER_GEOMETRY)); + LLViewerStats::getInstance()->setStat(LLViewerStats::ST_UPDATE_SECS, idle_secs - network_secs); + LLViewerStats::getInstance()->setStat(LLViewerStats::ST_NETWORK_SECS, network_secs); + LLViewerStats::getInstance()->setStat(LLViewerStats::ST_IMAGE_SECS, gDebugView->mFastTimerView->getTime(LLFastTimer::FTM_IMAGE_UPDATE)); + LLViewerStats::getInstance()->setStat(LLViewerStats::ST_REBUILD_SECS, gDebugView->mFastTimerView->getTime(LLFastTimer::FTM_STATESORT )); + LLViewerStats::getInstance()->setStat(LLViewerStats::ST_RENDER_SECS, gDebugView->mFastTimerView->getTime(LLFastTimer::FTM_RENDER_GEOMETRY)); LLCircuitData *cdp = gMessageSystem->mCircuitInfo.findCircuit(gAgent.getRegion()->getHost()); if (cdp) { - gViewerStats->mSimPingStat.addValue(cdp->getPingDelay()); + LLViewerStats::getInstance()->mSimPingStat.addValue(cdp->getPingDelay()); gAvgSimPing = ((gAvgSimPing * (F32)gSimPingCount) + (F32)(cdp->getPingDelay())) / ((F32)gSimPingCount + 1); gSimPingCount++; } else { - gViewerStats->mSimPingStat.addValue(10000); + LLViewerStats::getInstance()->mSimPingStat.addValue(10000); } - gViewerStats->mFPSStat.addValue(1); + LLViewerStats::getInstance()->mFPSStat.addValue(1); F32 layer_bits = (F32)(gVLManager.getLandBits() + gVLManager.getWindBits() + gVLManager.getCloudBits()); - gViewerStats->mLayersKBitStat.addValue(layer_bits/1024.f); - gViewerStats->mObjectKBitStat.addValue(gObjectBits/1024.f); - gViewerStats->mTextureKBitStat.addValue(LLViewerImageList::sTextureBits/1024.f); - gViewerStats->mVFSPendingOperations.addValue(LLVFile::getVFSThread()->getPending()); - gViewerStats->mAssetKBitStat.addValue(gTransferManager.getTransferBitsIn(LLTCT_ASSET)/1024.f); + LLViewerStats::getInstance()->mLayersKBitStat.addValue(layer_bits/1024.f); + LLViewerStats::getInstance()->mObjectKBitStat.addValue(gObjectBits/1024.f); + LLViewerStats::getInstance()->mTextureKBitStat.addValue(LLViewerImageList::sTextureBits/1024.f); + LLViewerStats::getInstance()->mVFSPendingOperations.addValue(LLVFile::getVFSThread()->getPending()); + LLViewerStats::getInstance()->mAssetKBitStat.addValue(gTransferManager.getTransferBitsIn(LLTCT_ASSET)/1024.f); gTransferManager.resetTransferBitsIn(LLTCT_ASSET); static S32 tex_bits_idle_count = 0; @@ -573,7 +572,7 @@ void update_statistics(U32 frame_count) gDebugTimers[0].unpause(); } - gViewerStats->mTexturePacketsStat.addValue(LLViewerImageList::sTexturePackets); + LLViewerStats::getInstance()->mTexturePacketsStat.addValue(LLViewerImageList::sTexturePackets); { static F32 visible_avatar_frames = 0.f; @@ -584,10 +583,10 @@ void update_statistics(U32 frame_count) visible_avatar_frames = 1.f; avg_visible_avatars = (avg_visible_avatars * (F32)(visible_avatar_frames - 1.f) + visible_avatars) / visible_avatar_frames; } - gViewerStats->setStat(LLViewerStats::ST_VISIBLE_AVATARS, (F64)avg_visible_avatars); + LLViewerStats::getInstance()->setStat(LLViewerStats::ST_VISIBLE_AVATARS, (F64)avg_visible_avatars); } - gWorldp->updateNetStats(); - gWorldp->requestCacheMisses(); + LLWorld::getInstance()->updateNetStats(); + LLWorld::getInstance()->requestCacheMisses(); // Reset all of these values. gVLManager.resetBitCounts(); @@ -599,9 +598,9 @@ void update_statistics(U32 frame_count) #if LL_WINDOWS && LL_LCD_COMPILE bool LCDenabled = gLcdScreen->Enabled(); - gViewerStats->setStat(LLViewerStats::ST_LOGITECH_LCD, LCDenabled); + LLViewerStats::getInstance()->setStat(LLViewerStats::ST_LOGITECH_LCD, LCDenabled); #else - gViewerStats->setStat(LLViewerStats::ST_LOGITECH_LCD, false); + LLViewerStats::getInstance()->setStat(LLViewerStats::ST_LOGITECH_LCD, false); #endif } @@ -704,11 +703,11 @@ void send_stats() std::string gpu_desc = llformat( "%-6s Class %d ", gGLManager.mGLVendorShort.substr(0,6).c_str(), - (S32)gFeatureManagerp->getGPUClass()) - + gFeatureManagerp->getGPUString(); + (S32)LLFeatureManager::getInstance()->getGPUClass()) + + LLFeatureManager::getInstance()->getGPUString(); system["gpu"] = gpu_desc; - system["gpu_class"] = (S32)gFeatureManagerp->getGPUClass(); + system["gpu_class"] = (S32)LLFeatureManager::getInstance()->getGPUClass(); system["gpu_vendor"] = gGLManager.mGLVendorShort; system["gpu_version"] = gGLManager.mDriverVersionVendorString; @@ -754,7 +753,7 @@ void send_stats() misc["int_1"] = LLFloaterDirectory::sOldSearchCount; // Steve: 1.18.6 misc["int_2"] = LLFloaterDirectory::sNewSearchCount; // Steve: 1.18.6 - gViewerStats->addToMessage(body); + LLViewerStats::getInstance()->addToMessage(body); LLHTTPClient::post(url, body, new ViewerStatsResponder()); } diff --git a/indra/newview/llviewerstats.h b/indra/newview/llviewerstats.h index 277bf44e48..819438832d 100644 --- a/indra/newview/llviewerstats.h +++ b/indra/newview/llviewerstats.h @@ -34,7 +34,7 @@ #include "llstat.h" -class LLViewerStats +class LLViewerStats : public LLSingleton<LLViewerStats> { public: LLStat mKBitStat; @@ -185,8 +185,6 @@ private: F64 mLastTimeDiff; // used for time stat updates }; -extern LLViewerStats *gViewerStats; - static const F32 SEND_STATS_PERIOD = 300.0f; // The following are from (older?) statistics code found in appviewer. diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index 8c8d1fff67..17b79fecdf 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -54,13 +54,15 @@ #include "llviewerimagelist.h" #include "llviewerwindow.h" #include "llviewerinventory.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llnotecard.h" #include "llmemorystream.h" #include "llmenugl.h" #include "llappviewer.h" // for gPacificDaylightTime +static LLRegisterWidget<LLViewerTextEditor> r("text_editor"); + ///---------------------------------------------------------------------------- /// Class LLEmbeddedNotecardOpener ///---------------------------------------------------------------------------- @@ -424,15 +426,15 @@ void LLEmbeddedItems::bindEmbeddedChars( LLFontGL* font ) const break; case LLAssetType::AT_NOTECARD: img_name = "inv_item_notecard.tga"; break; case LLAssetType::AT_LSL_TEXT: img_name = "inv_item_script.tga"; break; - case LLAssetType::AT_BODYPART: img_name = "inv_item_bodypart.tga"; break; + case LLAssetType::AT_BODYPART: img_name = "inv_item_skin.tga"; break; case LLAssetType::AT_ANIMATION: img_name = "inv_item_animation.tga";break; case LLAssetType::AT_GESTURE: img_name = "inv_item_gesture.tga"; break; default: llassert(0); continue; } - LLViewerImage* image = gImageList.getImage(LLUUID(gViewerArt.getString(img_name)), MIPMAP_FALSE, TRUE); + LLUIImagePtr image = LLUI::getUIImage(img_name); - font->addEmbeddedChar( wch, image, item->getName() ); + font->addEmbeddedChar( wch, image->getImage(), item->getName() ); } } @@ -575,7 +577,8 @@ LLViewerTextEditor::LLViewerTextEditor(const LLString& name, // *TODO: Add right click menus for SLURLs // Build the right click menu // make the popup menu available - //LLMenuGL* menu = gUICtrlFactory->buildMenu("menu_slurl.xml", this); + + //LLMenuGL* menu = LLUICtrlFactory::getInstance()->buildMenu("menu_slurl.xml", this); //if (!menu) //{ // menu = new LLMenuGL(""); @@ -694,7 +697,7 @@ BOOL LLViewerTextEditor::handleMouseDown(S32 x, S32 y, MASK mask) S32 screen_x; S32 screen_y; localPointToScreen(x, y, &screen_x, &screen_y ); - gToolDragAndDrop->setDragStart( screen_x, screen_y ); + LLToolDragAndDrop::getInstance()->setDragStart( screen_x, screen_y ); start_select = FALSE; } @@ -779,108 +782,105 @@ BOOL LLViewerTextEditor::handleHover(S32 x, S32 y, MASK mask) // leave hover segment active during drag and drop mHoverSegment = NULL; } - if( getVisible() ) + if(hasMouseCapture() ) { - if(hasMouseCapture() ) + if( mIsSelecting ) { - if( mIsSelecting ) + if (x != mLastSelectionX || y != mLastSelectionY) { - if (x != mLastSelectionX || y != mLastSelectionY) - { - mLastSelectionX = x; - mLastSelectionY = y; - } - - if( y > getTextRect().mTop ) - { - mScrollbar->setDocPos( mScrollbar->getDocPos() - 1 ); - } - else - if( y < getTextRect().mBottom ) - { - mScrollbar->setDocPos( mScrollbar->getDocPos() + 1 ); - } + mLastSelectionX = x; + mLastSelectionY = y; + } - setCursorAtLocalPos( x, y, TRUE ); - mSelectionEnd = mCursorPos; - - updateScrollFromCursor(); - getWindow()->setCursor(UI_CURSOR_IBEAM); + if( y > getTextRect().mTop ) + { + mScrollbar->setDocPos( mScrollbar->getDocPos() - 1 ); } - else if( mDragItem ) + else + if( y < getTextRect().mBottom ) { - S32 screen_x; - S32 screen_y; - localPointToScreen(x, y, &screen_x, &screen_y ); - if( gToolDragAndDrop->isOverThreshold( screen_x, screen_y ) ) - { - gToolDragAndDrop->beginDrag( - LLAssetType::lookupDragAndDropType( mDragItem->getType() ), - mDragItem->getUUID(), - LLToolDragAndDrop::SOURCE_NOTECARD, - getSourceID(), mObjectID); - - return gToolDragAndDrop->handleHover( x, y, mask ); - } - getWindow()->setCursor(UI_CURSOR_HAND); + mScrollbar->setDocPos( mScrollbar->getDocPos() + 1 ); } - lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (active)" << llendl; - handled = TRUE; - } - - if( !handled ) - { - // Pass to children - handled = LLView::childrenHandleHover(x, y, mask) != NULL; - } - - if( handled ) - { - // Delay cursor flashing - resetKeystrokeTimer(); + setCursorAtLocalPos( x, y, TRUE ); + mSelectionEnd = mCursorPos; + + updateScrollFromCursor(); + getWindow()->setCursor(UI_CURSOR_IBEAM); } - - // Opaque - if( !handled && mTakesNonScrollClicks) + else if( mDragItem ) { - // Check to see if we're over an HTML-style link - if( !mSegments.empty() ) + S32 screen_x; + S32 screen_y; + localPointToScreen(x, y, &screen_x, &screen_y ); + if( LLToolDragAndDrop::getInstance()->isOverThreshold( screen_x, screen_y ) ) { - const LLTextSegment* cur_segment = getSegmentAtLocalPos( x, y ); - if( cur_segment ) - { - if(cur_segment->getStyle().isLink()) - { - lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (over link, inactive)" << llendl; - getWindow()->setCursor(UI_CURSOR_HAND); - handled = TRUE; - } - else - if(cur_segment->getStyle().getIsEmbeddedItem()) - { - lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (over embedded item, inactive)" << llendl; - getWindow()->setCursor(UI_CURSOR_HAND); - //getWindow()->setCursor(UI_CURSOR_ARROW); - handled = TRUE; - } - mHoverSegment = cur_segment; - } + LLToolDragAndDrop::getInstance()->beginDrag( + LLAssetType::lookupDragAndDropType( mDragItem->getType() ), + mDragItem->getUUID(), + LLToolDragAndDrop::SOURCE_NOTECARD, + getSourceID(), mObjectID); + + return LLToolDragAndDrop::getInstance()->handleHover( x, y, mask ); } + getWindow()->setCursor(UI_CURSOR_HAND); + } + + lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (active)" << llendl; + handled = TRUE; + } + + if( !handled ) + { + // Pass to children + handled = LLView::childrenHandleHover(x, y, mask) != NULL; + } + + if( handled ) + { + // Delay cursor flashing + resetKeystrokeTimer(); + } - if( !handled ) + // Opaque + if( !handled && mTakesNonScrollClicks) + { + // Check to see if we're over an HTML-style link + if( !mSegments.empty() ) + { + const LLTextSegment* cur_segment = getSegmentAtLocalPos( x, y ); + if( cur_segment ) { - lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (inactive)" << llendl; - if (!mScrollbar->getVisible() || x < getRect().getWidth() - SCROLLBAR_SIZE) + if(cur_segment->getStyle().isLink()) { - getWindow()->setCursor(UI_CURSOR_IBEAM); + lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (over link, inactive)" << llendl; + getWindow()->setCursor(UI_CURSOR_HAND); + handled = TRUE; } else + if(cur_segment->getStyle().getIsEmbeddedItem()) { - getWindow()->setCursor(UI_CURSOR_ARROW); + lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (over embedded item, inactive)" << llendl; + getWindow()->setCursor(UI_CURSOR_HAND); + //getWindow()->setCursor(UI_CURSOR_ARROW); + handled = TRUE; } - handled = TRUE; + mHoverSegment = cur_segment; + } + } + + if( !handled ) + { + lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (inactive)" << llendl; + if (!mScrollbar->getVisible() || x < getRect().getWidth() - SCROLLBAR_SIZE) + { + getWindow()->setCursor(UI_CURSOR_IBEAM); } + else + { + getWindow()->setCursor(UI_CURSOR_ARROW); + } + handled = TRUE; } } diff --git a/indra/newview/llviewerthrottle.cpp b/indra/newview/llviewerthrottle.cpp index d427cd6ede..9a9fcdd9ac 100644 --- a/indra/newview/llviewerthrottle.cpp +++ b/indra/newview/llviewerthrottle.cpp @@ -307,7 +307,7 @@ void LLViewerThrottle::updateDynamicThrottle() } mUpdateTimer.reset(); - if (gViewerStats->mPacketsLostPercentStat.getMean() > TIGHTEN_THROTTLE_THRESHOLD) + if (LLViewerStats::getInstance()->mPacketsLostPercentStat.getMean() > TIGHTEN_THROTTLE_THRESHOLD) { if (mThrottleFrac <= MIN_FRACTIONAL || mCurrentBandwidth / 1024.0f <= MIN_BANDWIDTH) { @@ -320,7 +320,7 @@ void LLViewerThrottle::updateDynamicThrottle() mCurrent.sendToSim(); llinfos << "Tightening network throttle to " << mCurrentBandwidth << llendl; } - else if (gViewerStats->mPacketsLostPercentStat.getMean() <= EASE_THROTTLE_THRESHOLD) + else if (LLViewerStats::getInstance()->mPacketsLostPercentStat.getMean() <= EASE_THROTTLE_THRESHOLD) { if (mThrottleFrac >= MAX_FRACTIONAL || mCurrentBandwidth / 1024.0f >= MAX_BANDWIDTH) { diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index d48e3cc4f3..afd1e48921 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -102,7 +102,6 @@ #include "llfloaterland.h" #include "llfloaterinspect.h" #include "llfloatermap.h" -#include "llfloatermute.h" #include "llfloaternamedesc.h" #include "llfloaterpreference.h" #include "llfloatersnapshot.h" @@ -155,10 +154,9 @@ #include "lltoolmorph.h" #include "lltoolpie.h" #include "lltoolplacer.h" -#include "lltoolselect.h" #include "lltoolselectland.h" #include "lltoolview.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "lluploaddialog.h" #include "llurldispatcher.h" // SLURL from other app instance #include "llvieweraudio.h" @@ -262,7 +260,6 @@ const S32 PICK_DIAMETER = 2 * PICK_HALF_WIDTH+1; const F32 MIN_DISPLAY_SCALE = 0.85f; const S32 CONSOLE_BOTTOM_PAD = 40; - #ifdef SABINRIG /// ALL RIG STUFF bool rigControl = false; @@ -480,7 +477,7 @@ public: camera_center_text = llformat("CameraCenter %f %f %f", (F32)(tvector.mdV[VX]), (F32)(tvector.mdV[VY]), (F32)(tvector.mdV[VZ])); - tvector = LLVector4(gCamera->getAtAxis()); + tvector = LLVector4(LLViewerCamera::getInstance()->getAtAxis()); camera_view_text = llformat("CameraAtAxis %f %f %f", (F32)(tvector.mdV[VX]), (F32)(tvector.mdV[VY]), (F32)(tvector.mdV[VZ])); @@ -514,7 +511,7 @@ public: } if (gDisplayFOV) { - addText(xpos, ypos, llformat("FOV: %2.1f deg", RAD_TO_DEG * gCamera->getView())); + addText(xpos, ypos, llformat("FOV: %2.1f deg", RAD_TO_DEG * LLViewerCamera::getInstance()->getView())); ypos += y_inc; } if (gSavedSettings.getBOOL("DebugShowRenderInfo")) @@ -692,13 +689,10 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask gHoverView->cancelHover(); } - if (gToolMgr) + // Don't let the user move the mouse out of the window until mouse up. + if( LLToolMgr::getInstance()->getCurrentTool()->clipMouseWhenDown() ) { - // Don't let the user move the mouse out of the window until mouse up. - if( gToolMgr->getCurrentTool()->clipMouseWhenDown() ) - { - mWindow->setMouseClipping(TRUE); - } + mWindow->setMouseClipping(TRUE); } LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture(); @@ -750,16 +744,13 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask return FALSE; } - if (gToolMgr) + if(LLToolMgr::getInstance()->getCurrentTool()->handleMouseDown( x, y, mask ) ) { - if(gToolMgr->getCurrentTool()->handleMouseDown( x, y, mask ) ) - { - // This is necessary to force clicks in the world to cause edit - // boxes that might have keyboard focus to relinquish it, and hence - // cause a commit to update their value. JC - gFocusMgr.setKeyboardFocus(NULL); - return TRUE; - } + // This is necessary to force clicks in the world to cause edit + // boxes that might have keyboard focus to relinquish it, and hence + // cause a commit to update their value. JC + gFocusMgr.setKeyboardFocus(NULL); + return TRUE; } return FALSE; @@ -836,12 +827,9 @@ BOOL LLViewerWindow::handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK ma return TRUE; } - if (gToolMgr) + if(LLToolMgr::getInstance()->getCurrentTool()->handleDoubleClick( x, y, mask ) ) { - if(gToolMgr->getCurrentTool()->handleDoubleClick( x, y, mask ) ) - { - return TRUE; - } + return TRUE; } // if we got this far and nothing handled a double click, pass a normal mouse down @@ -880,15 +868,11 @@ BOOL LLViewerWindow::handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask) mWindow->releaseMouse(); - LLTool *tool = NULL; - if (gToolMgr) - { - tool = gToolMgr->getCurrentTool(); + LLTool *tool = LLToolMgr::getInstance()->getCurrentTool(); - if( tool->clipMouseWhenDown() ) - { - mWindow->setMouseClipping(FALSE); - } + if( tool->clipMouseWhenDown() ) + { + mWindow->setMouseClipping(FALSE); } LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture(); @@ -980,13 +964,10 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK gHoverView->cancelHover(); } - if (gToolMgr) + // Don't let the user move the mouse out of the window until mouse up. + if( LLToolMgr::getInstance()->getCurrentTool()->clipMouseWhenDown() ) { - // Don't let the user move the mouse out of the window until mouse up. - if( gToolMgr->getCurrentTool()->clipMouseWhenDown() ) - { - mWindow->setMouseClipping(TRUE); - } + mWindow->setMouseClipping(TRUE); } LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture(); @@ -1030,26 +1011,23 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK llinfos << "Right Mouse Down not handled by view" << llendl; } - if (gToolMgr) + if(LLToolMgr::getInstance()->getCurrentTool()->handleRightMouseDown( x, y, mask ) ) { - if(gToolMgr->getCurrentTool()->handleRightMouseDown( x, y, mask ) ) - { - // This is necessary to force clicks in the world to cause edit - // boxes that might have keyboard focus to relinquish it, and hence - // cause a commit to update their value. JC - gFocusMgr.setKeyboardFocus(NULL); - return TRUE; - } + // This is necessary to force clicks in the world to cause edit + // boxes that might have keyboard focus to relinquish it, and hence + // cause a commit to update their value. JC + gFocusMgr.setKeyboardFocus(NULL); + return TRUE; } // *HACK: this should be rolled into the composite tool logic, not // hardcoded at the top level. - if (gToolPie && (CAMERA_MODE_CUSTOMIZE_AVATAR != gAgent.getCameraMode()) ) + if (CAMERA_MODE_CUSTOMIZE_AVATAR != gAgent.getCameraMode()) { // If the current tool didn't process the click, we should show // the pie menu. This can be done by passing the event to the pie // menu tool. - gToolPie->handleRightMouseDown(x, y, mask); + LLToolPie::getInstance()->handleRightMouseDown(x, y, mask); // show_context_menu( x, y, mask ); } @@ -1089,15 +1067,11 @@ BOOL LLViewerWindow::handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK m mWindow->releaseMouse(); - LLTool *tool = NULL; - if (gToolMgr) - { - tool = gToolMgr->getCurrentTool(); + LLTool *tool = LLToolMgr::getInstance()->getCurrentTool(); - if( tool->clipMouseWhenDown() ) - { - mWindow->setMouseClipping(FALSE); - } + if( tool->clipMouseWhenDown() ) + { + mWindow->setMouseClipping(FALSE); } LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture(); @@ -1246,10 +1220,7 @@ void LLViewerWindow::handleFocus(LLWindow *window) LLModalDialog::onAppFocusGained(); gAgent.onAppFocusGained(); - if (gToolMgr) - { - gToolMgr->onAppFocusGained(); - } + LLToolMgr::getInstance()->onAppFocusGained(); gShowTextEditCursor = TRUE; @@ -1269,10 +1240,7 @@ void LLViewerWindow::handleFocusLost(LLWindow *window) { gFocusMgr.setAppHasFocus(FALSE); //LLModalDialog::onAppFocusLost(); - if( gToolMgr ) - { - gToolMgr->onAppFocusLost(); - } + LLToolMgr::getInstance()->onAppFocusLost(); gFocusMgr.setMouseCapture( NULL ); if (gMenuBarView) @@ -1428,9 +1396,9 @@ BOOL LLViewerWindow::handlePaint(LLWindow *window, S32 x, S32 y, S32 width, S char temp_str[255]; /* Flawfinder: ignore */ snprintf(temp_str, sizeof(temp_str), "%s FPS %3.1f Phy FPS %2.1f Time Dil %1.3f", /* Flawfinder: ignore */ name_str.c_str(), - gViewerStats->mFPSStat.getMeanPerSec(), - gViewerStats->mSimPhysicsFPS.getPrev(0), - gViewerStats->mSimTimeDilation.getPrev(0)); + LLViewerStats::getInstance()->mFPSStat.getMeanPerSec(), + LLViewerStats::getInstance()->mSimPhysicsFPS.getPrev(0), + LLViewerStats::getInstance()->mSimTimeDilation.getPrev(0)); len = strlen(temp_str); /* Flawfinder: ignore */ TextOutA(hdc, 0, 0, temp_str, len); @@ -1567,21 +1535,21 @@ LLViewerWindow::LLViewerWindow( // llinfos << "Loading feature tables." << llendl; - gFeatureManagerp->init(); + LLFeatureManager::getInstance()->init(); // Initialize OpenGL Renderer - if (!gFeatureManagerp->isFeatureAvailable("RenderVBOEnable") || + if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderVBOEnable") || !gGLManager.mHasVertexBufferObject) { gSavedSettings.setBOOL("RenderVBOEnable", FALSE); } LLVertexBuffer::initClass(gSavedSettings.getBOOL("RenderVBOEnable")); - if (gFeatureManagerp->isSafe() - || (gSavedSettings.getS32("LastFeatureVersion") != gFeatureManagerp->getVersion()) + if (LLFeatureManager::getInstance()->isSafe() + || (gSavedSettings.getS32("LastFeatureVersion") != LLFeatureManager::getInstance()->getVersion()) || (gSavedSettings.getBOOL("ProbeHardwareOnStartup"))) { - gFeatureManagerp->applyRecommendedSettings(); + LLFeatureManager::getInstance()->applyRecommendedSettings(); gSavedSettings.setBOOL("ProbeHardwareOnStartup", FALSE); } @@ -1589,7 +1557,7 @@ LLViewerWindow::LLViewerWindow( if (gSavedSettings.getBOOL("RenderInitError")) { mInitAlert = "DisplaySettingsNoShaders"; - gFeatureManagerp->setGraphicsLevel(0, false); + LLFeatureManager::getInstance()->setGraphicsLevel(0, false); gSavedSettings.setU32("RenderQualityPerformance", 0); } @@ -1612,9 +1580,6 @@ LLViewerWindow::LLViewerWindow( initFonts(); } - // Init Resource Manager - gResMgr = new LLResMgr(); - // Make avatar head look forward at start mCurrentMousePoint.mX = getWindowWidth() / 2; mCurrentMousePoint.mY = getWindowHeight() / 2; @@ -1918,7 +1883,7 @@ void LLViewerWindow::initWorldUI() mRootView->addChild(gMorphView); gMorphView->setVisible(FALSE); - gFloaterMute = LLFloaterMute::getInstance(); + // *Note: this is where gFloaterMute used to be initialized. LLWorldMapView::initClass(); @@ -1985,8 +1950,6 @@ LLViewerWindow::~LLViewerWindow() gFloaterView = NULL; gMorphView = NULL; - gFloaterMute = NULL; - gFloaterMap = NULL; gHUDView = NULL; @@ -1994,9 +1957,6 @@ LLViewerWindow::~LLViewerWindow() delete mToolTip; mToolTip = NULL; - - delete gResMgr; - gResMgr = NULL; //-------------------------------------------------------- // Shutdown GL cleanly. Order is very important here. @@ -2025,11 +1985,8 @@ LLViewerWindow::~LLViewerWindow() delete[] mPickBuffer; mPickBuffer = NULL; - if (gSelectMgr) - { - llinfos << "Cleaning up select manager" << llendl; - gSelectMgr->cleanup(); - } + llinfos << "Cleaning up select manager" << llendl; + LLSelectMgr::getInstance()->cleanup(); LLVertexBuffer::cleanupClass(); @@ -2103,17 +2060,17 @@ void LLViewerWindow::reshape(S32 width, S32 height) glViewport(0, 0, width, height ); - if (height > 0 && gCamera) + if (height > 0) { - gCamera->setViewHeightInPixels( height ); + LLViewerCamera::getInstance()->setViewHeightInPixels( height ); if (mWindow->getFullscreen()) { // force to 4:3 aspect for odd resolutions - gCamera->setAspect( getDisplayAspectRatio() ); + LLViewerCamera::getInstance()->setAspect( getDisplayAspectRatio() ); } else { - gCamera->setAspect( width / (F32) height); + LLViewerCamera::getInstance()->setAspect( width / (F32) height); } } @@ -2170,8 +2127,8 @@ void LLViewerWindow::reshape(S32 width, S32 height) } } - gViewerStats->setStat(LLViewerStats::ST_WINDOW_WIDTH, (F64)width); - gViewerStats->setStat(LLViewerStats::ST_WINDOW_HEIGHT, (F64)height); + LLViewerStats::getInstance()->setStat(LLViewerStats::ST_WINDOW_WIDTH, (F64)width); + LLViewerStats::getInstance()->setStat(LLViewerStats::ST_WINDOW_HEIGHT, (F64)height); gResizeScreenTexture = TRUE; } } @@ -2282,7 +2239,7 @@ void LLViewerWindow::draw() glLoadIdentity(); microsecondsToTimecodeString(gFrameTime,text); - const LLFontGL* font = gResMgr->getRes( LLFONT_SANSSERIF ); + const LLFontGL* font = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ); font->renderUTF8(text, 0, llround((getWindowWidth()/2)-100.f), llround((getWindowHeight()-60.f)), @@ -2299,30 +2256,24 @@ void LLViewerWindow::draw() glScalef(mDisplayScale.mV[VX], mDisplayScale.mV[VY], 1.f); LLVector2 old_scale_factor = LLUI::sGLScaleFactor; - if (gCamera) + // apply camera zoom transform (for high res screenshots) + F32 zoom_factor = LLViewerCamera::getInstance()->getZoomFactor(); + S16 sub_region = LLViewerCamera::getInstance()->getZoomSubRegion(); + if (zoom_factor > 1.f) { - // apply camera zoom transform (for high res screenshots) - F32 zoom_factor = gCamera->getZoomFactor(); - S16 sub_region = gCamera->getZoomSubRegion(); - if (zoom_factor > 1.f) - { - //decompose subregion number to x and y values - int pos_y = sub_region / llceil(zoom_factor); - int pos_x = sub_region - (pos_y*llceil(zoom_factor)); - // offset for this tile - glTranslatef((F32)gViewerWindow->getWindowWidth() * -(F32)pos_x, - (F32)gViewerWindow->getWindowHeight() * -(F32)pos_y, - 0.f); - glScalef(zoom_factor, zoom_factor, 1.f); - LLUI::sGLScaleFactor *= zoom_factor; - } + //decompose subregion number to x and y values + int pos_y = sub_region / llceil(zoom_factor); + int pos_x = sub_region - (pos_y*llceil(zoom_factor)); + // offset for this tile + glTranslatef((F32)gViewerWindow->getWindowWidth() * -(F32)pos_x, + (F32)gViewerWindow->getWindowHeight() * -(F32)pos_y, + 0.f); + glScalef(zoom_factor, zoom_factor, 1.f); + LLUI::sGLScaleFactor *= zoom_factor; } - if (gToolMgr) - { - // Draw tool specific overlay on world - gToolMgr->getCurrentTool()->draw(); - } + // Draw tool specific overlay on world + LLToolMgr::getInstance()->getCurrentTool()->draw(); if( gAgent.cameraMouselook() ) { @@ -2398,7 +2349,9 @@ void LLViewerWindow::draw() // Takes a single keydown event, usually when UI is visible BOOL LLViewerWindow::handleKey(KEY key, MASK mask) { - if (gFocusMgr.getKeyboardFocus() && !(mask & (MASK_CONTROL | MASK_ALT))) + if (gFocusMgr.getKeyboardFocus() + && !(mask & (MASK_CONTROL | MASK_ALT)) + && !gFocusMgr.getKeystrokesOnly()) { // We have keyboard focus, and it's not an accelerator @@ -2412,7 +2365,7 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) // HACK look for UI editing keys if (LLView::sEditingUI) { - if (LLFloaterEditUI::handleKey(key, mask)) + if (LLFloaterEditUI::processKeystroke(key, mask)) { return TRUE; } @@ -2544,12 +2497,9 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) } } - if (gToolMgr) + if( LLToolMgr::getInstance()->getCurrentTool()->handleKey(key, mask) ) { - if( gToolMgr->getCurrentTool()->handleKey(key, mask) ) - { - return TRUE; - } + return TRUE; } // Try for a new-format gesture @@ -2567,14 +2517,14 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) // Topmost view gets a chance before the hierarchy // *FIX: get rid of this? - LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); - if (top_ctrl) - { - if( top_ctrl->handleKey( key, mask, TRUE ) ) - { - return TRUE; - } - } + //LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); + //if (top_ctrl) + //{ + // if( top_ctrl->handleKey( key, mask, TRUE ) ) + // { + // return TRUE; + // } + //} // give floaters first chance to handle TAB key // so frontmost floater gets focus @@ -2648,12 +2598,12 @@ BOOL LLViewerWindow::handleUnicodeChar(llwchar uni_char, MASK mask) return TRUE; } - // Topmost view gets a chance before the hierarchy - LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); - if (top_ctrl && top_ctrl->handleUnicodeChar( uni_char, FALSE ) ) - { - return TRUE; - } + //// Topmost view gets a chance before the hierarchy + //LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); + //if (top_ctrl && top_ctrl->handleUnicodeChar( uni_char, FALSE ) ) + //{ + // return TRUE; + //} return TRUE; } @@ -2710,11 +2660,8 @@ void LLViewerWindow::handleScrollWheel(S32 clicks) llinfos << "Scroll Wheel not handled by view" << llendl; } - if (gWorldPointer) - { - // Zoom the camera in and out behavior - gAgent.handleScrollWheel(clicks); - } + // Zoom the camera in and out behavior + gAgent.handleScrollWheel(clicks); return; } @@ -2901,9 +2848,9 @@ BOOL LLViewerWindow::handlePerFrameHover() // *NOTE: sometimes tools handle the mouse as a captor, so this // logic is a little confusing LLTool *tool = NULL; - if (gToolMgr && gHoverView && gCamera) + if (gHoverView) { - tool = gToolMgr->getCurrentTool(); + tool = LLToolMgr::getInstance()->getCurrentTool(); if(!handled && tool) { @@ -2923,8 +2870,8 @@ BOOL LLViewerWindow::handlePerFrameHover() // Suppress the toolbox view if our source tool was the pie tool, // and we've overridden to something else. mSuppressToolbox = - (gToolMgr->getBaseTool() == gToolPie) && - (gToolMgr->getCurrentTool() != gToolPie); + (LLToolMgr::getInstance()->getBaseTool() == LLToolPie::getInstance()) && + (LLToolMgr::getInstance()->getCurrentTool() != LLToolPie::getInstance()); } @@ -2975,19 +2922,19 @@ BOOL LLViewerWindow::handlePerFrameHover() } } - if (tool && tool != gToolNull && tool != gToolInspect && tool != gToolDragAndDrop && !gSavedSettings.getBOOL("FreezeTime")) + if (tool && tool != gToolNull && tool != LLToolCompInspect::getInstance() && tool != LLToolDragAndDrop::getInstance() && !gSavedSettings.getBOOL("FreezeTime")) { LLMouseHandler *captor = gFocusMgr.getMouseCapture(); // With the null, inspect, or drag and drop tool, don't muck // with visibility. if (gFloaterTools->isMinimized() || - (tool != gToolPie // not default tool - && tool != gToolGun // not coming out of mouselook - && !mSuppressToolbox // not override in third person - && gToolMgr->getCurrentToolset() != gFaceEditToolset // not special mode - && gToolMgr->getCurrentToolset() != gMouselookToolset - && (!captor || captor->isView())) // not dragging + (tool != LLToolPie::getInstance() // not default tool + && tool != LLToolCompGun::getInstance() // not coming out of mouselook + && !mSuppressToolbox // not override in third person + && LLToolMgr::getInstance()->getCurrentToolset() != gFaceEditToolset // not special mode + && LLToolMgr::getInstance()->getCurrentToolset() != gMouselookToolset + && (!captor || captor->isView())) // not dragging ) { // Force floater tools to be visible (unless minimized) @@ -3046,7 +2993,7 @@ BOOL LLViewerWindow::handlePerFrameHover() // snap floaters to top of chat bar/button strip LLView* chatbar_and_buttons = gOverlayBar->getChild<LLView>("chatbar_and_buttons", TRUE); - // find top of chatbar and strate buttons, if either are visible + // find top of chatbar and state buttons, if either are visible if (chatbar_and_buttons && !chatbar_and_buttons->getLocalBoundingRect().isNull()) { // convert top/left corner of chatbar/buttons container to gFloaterView-relative coordinates @@ -3085,9 +3032,9 @@ BOOL LLViewerWindow::handlePerFrameHover() mLastMousePoint = mCurrentMousePoint; // last ditch force of edit menu to selection manager - if (LLEditMenuHandler::gEditMenuHandler == NULL && gSelectMgr && gSelectMgr->getSelection()->getObjectCount()) + if (LLEditMenuHandler::gEditMenuHandler == NULL && LLSelectMgr::getInstance()->getSelection()->getObjectCount()) { - LLEditMenuHandler::gEditMenuHandler = gSelectMgr; + LLEditMenuHandler::gEditMenuHandler = LLSelectMgr::getInstance(); } if (gFloaterView->getCycleMode()) @@ -3116,20 +3063,23 @@ BOOL LLViewerWindow::handlePerFrameHover() gFloaterView->syncFloaterTabOrder(); } - if (gSavedSettings.getBOOL("ChatBarStealsFocus") && gChatBar && gFocusMgr.getKeyboardFocus() == NULL && gChatBar->getVisible()) + if (gSavedSettings.getBOOL("ChatBarStealsFocus") + && gChatBar + && gFocusMgr.getKeyboardFocus() == NULL + && gChatBar->isInVisibleChain()) { gChatBar->startChat(NULL); } // cleanup unused selections when no modal dialogs are open - if (gParcelMgr && LLModalDialog::activeCount() == 0) + if (LLModalDialog::activeCount() == 0) { - gParcelMgr->deselectUnused(); + LLViewerParcelMgr::getInstance()->deselectUnused(); } - if (gSelectMgr && LLModalDialog::activeCount() == 0) + if (LLModalDialog::activeCount() == 0) { - gSelectMgr->deselectUnused(); + LLSelectMgr::getInstance()->deselectUnused(); } return handled; @@ -3176,12 +3126,12 @@ void LLViewerWindow::saveLastMouse(const LLCoordGL &point) // render_hud_elements: FALSE, FALSE, FALSE void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls, BOOL for_hud ) { - LLObjectSelectionHandle selection = gSelectMgr->getSelection(); + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); if (!for_hud && !for_gl_pick) { // Call this once and only once - gSelectMgr->updateSilhouettes(); + LLSelectMgr::getInstance()->updateSilhouettes(); } // Draw fence around land selections @@ -3189,18 +3139,18 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls, { if (pick_parcel_walls) { - gParcelMgr->renderParcelCollision(); + LLViewerParcelMgr::getInstance()->renderParcelCollision(); } } else if (( for_hud && selection->getSelectType() == SELECT_TYPE_HUD) || (!for_hud && selection->getSelectType() != SELECT_TYPE_HUD)) { - gSelectMgr->renderSilhouettes(for_hud); + LLSelectMgr::getInstance()->renderSilhouettes(for_hud); stop_glerror(); // setup HUD render - if (selection->getSelectType() == SELECT_TYPE_HUD && gSelectMgr->getSelection()->getObjectCount()) + if (selection->getSelectType() == SELECT_TYPE_HUD && LLSelectMgr::getInstance()->getSelection()->getObjectCount()) { LLBBox hud_bbox = gAgent.getAvatarObject()->getHUDBBox(); @@ -3209,7 +3159,7 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls, glPushMatrix(); glLoadIdentity(); F32 depth = llmax(1.f, hud_bbox.getExtentLocal().mV[VX] * 1.1f); - glOrtho(-0.5f * gCamera->getAspect(), 0.5f * gCamera->getAspect(), -0.5f, 0.5f, 0.f, depth); + glOrtho(-0.5f * LLViewerCamera::getInstance()->getAspect(), 0.5f * LLViewerCamera::getInstance()->getAspect(), -0.5f, 0.5f, 0.f, depth); glMatrixMode(GL_MODELVIEW); glPushMatrix(); @@ -3219,7 +3169,7 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls, } // Render light for editing - if (LLSelectMgr::sRenderLightRadius && gToolMgr->inEdit()) + if (LLSelectMgr::sRenderLightRadius && LLToolMgr::getInstance()->inEdit()) { LLImageGL::unbindTexture(0); LLGLEnable gls_blend(GL_BLEND); @@ -3265,7 +3215,7 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls, return true; } } func; - gSelectMgr->getSelection()->applyToObjects(&func); + LLSelectMgr::getInstance()->getSelection()->applyToObjects(&func); glPopMatrix(); } @@ -3274,7 +3224,7 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls, // not be recalculated at this time. If they are, then group rotations will break. // Draw arrows at average center of all selected objects - LLTool* tool = gToolMgr->getCurrentTool(); + LLTool* tool = LLToolMgr::getInstance()->getCurrentTool(); if (tool) { if(tool->isAlwaysRendered()) @@ -3283,15 +3233,15 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls, } else { - if( !gSelectMgr->getSelection()->isEmpty() ) + if( !LLSelectMgr::getInstance()->getSelection()->isEmpty() ) { BOOL moveable_object_selected = FALSE; BOOL all_selected_objects_move = TRUE; BOOL all_selected_objects_modify = TRUE; BOOL selecting_linked_set = !gSavedSettings.getBOOL("EditLinkedParts"); - for (LLObjectSelection::iterator iter = gSelectMgr->getSelection()->begin(); - iter != gSelectMgr->getSelection()->end(); iter++) + for (LLObjectSelection::iterator iter = LLSelectMgr::getInstance()->getSelection()->begin(); + iter != LLSelectMgr::getInstance()->getSelection()->end(); iter++) { LLSelectNode* nodep = *iter; LLViewerObject* object = nodep->getObject(); @@ -3307,17 +3257,17 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls, BOOL draw_handles = TRUE; - if (tool == gToolTranslate && (!moveable_object_selected || !all_selected_objects_move)) + if (tool == LLToolCompTranslate::getInstance() && (!moveable_object_selected || !all_selected_objects_move)) { draw_handles = FALSE; } - if (tool == gToolRotate && (!moveable_object_selected || !all_selected_objects_move)) + if (tool == LLToolCompRotate::getInstance() && (!moveable_object_selected || !all_selected_objects_move)) { draw_handles = FALSE; } - if ( !all_selected_objects_modify && tool == gToolStretch ) + if ( !all_selected_objects_modify && tool == LLToolCompScale::getInstance() ) { draw_handles = FALSE; } @@ -3421,13 +3371,13 @@ void LLViewerWindow::hitObjectOrLandGlobalAsync(S32 x, S32 y_from_bot, MASK mask gLastHitParcelWall = FALSE; LLCamera pick_camera; - pick_camera.setOrigin(gCamera->getOrigin()); - pick_camera.setOriginAndLookAt(gCamera->getOrigin(), - gCamera->getUpAxis(), - gCamera->getOrigin() + mouseDirectionGlobal(x, y_from_bot)); + pick_camera.setOrigin(LLViewerCamera::getInstance()->getOrigin()); + pick_camera.setOriginAndLookAt(LLViewerCamera::getInstance()->getOrigin(), + LLViewerCamera::getInstance()->getUpAxis(), + LLViewerCamera::getInstance()->getOrigin() + mouseDirectionGlobal(x, y_from_bot)); pick_camera.setView(0.5f*DEG_TO_RAD); - pick_camera.setNear(gCamera->getNear()); - pick_camera.setFar(gCamera->getFar()); + pick_camera.setNear(LLViewerCamera::getInstance()->getNear()); + pick_camera.setFar(LLViewerCamera::getInstance()->getFar()); pick_camera.setAspect(1.f); // save our drawing state @@ -3444,8 +3394,7 @@ void LLViewerWindow::hitObjectOrLandGlobalAsync(S32 x, S32 y_from_bot, MASK mask // build perspective transform and picking viewport // Perform pick on a PICK_DIAMETER x PICK_DIAMETER pixel region around cursor point. // Don't limit the select distance for this pick. - // make viewport big enough to handle antialiased frame buffers - gCamera->setPerspective(FOR_SELECTION, scaled_x - (PICK_HALF_WIDTH + 2), scaled_y - (PICK_HALF_WIDTH + 2), PICK_DIAMETER + 4, PICK_DIAMETER + 4, FALSE); + LLViewerCamera::getInstance()->setPerspective(FOR_SELECTION, scaled_x - (PICK_HALF_WIDTH + 2), scaled_y - (PICK_HALF_WIDTH + 2), PICK_DIAMETER + 4, PICK_DIAMETER + 4, FALSE); // make viewport big enough to handle antialiased frame buffers gGLViewport[0] = scaled_x - (PICK_HALF_WIDTH + 2); gGLViewport[1] = scaled_y - (PICK_HALF_WIDTH + 2); @@ -3516,13 +3465,13 @@ void LLViewerWindow::hitUIElementAsync(S32 x, S32 y_from_bot, MASK mask, void (* gLastHitUIElement = 0; LLCamera pick_camera; - pick_camera.setOrigin(gCamera->getOrigin()); - pick_camera.setOriginAndLookAt(gCamera->getOrigin(), - gCamera->getUpAxis(), - gCamera->getOrigin() + mouseDirectionGlobal(x, y_from_bot)); + pick_camera.setOrigin(LLViewerCamera::getInstance()->getOrigin()); + pick_camera.setOriginAndLookAt(LLViewerCamera::getInstance()->getOrigin(), + LLViewerCamera::getInstance()->getUpAxis(), + LLViewerCamera::getInstance()->getOrigin() + mouseDirectionGlobal(x, y_from_bot)); pick_camera.setView(0.5f*DEG_TO_RAD); - pick_camera.setNear(gCamera->getNear()); - pick_camera.setFar(gCamera->getFar()); + pick_camera.setNear(LLViewerCamera::getInstance()->getNear()); + pick_camera.setFar(LLViewerCamera::getInstance()->getFar()); pick_camera.setAspect(1.f); // save our drawing state @@ -3752,7 +3701,7 @@ LLViewerObject* LLViewerWindow::getObjectUnderCursor(const F32 depth) S32 y = getCurrentMouseY(); LLVector3 mouse_direction_global = mouseDirectionGlobal(x,y); - LLVector3 camera_pos_global = gCamera->getOrigin(); + LLVector3 camera_pos_global = LLViewerCamera::getInstance()->getOrigin(); LLVector3 pick_end = camera_pos_global + mouse_direction_global * depth; LLVector3 collision_point; return gPipeline.pickObject(camera_pos_global, pick_end, collision_point); @@ -3838,7 +3787,7 @@ void LLViewerWindow::analyzeHit( U8 uv_pick_buffer[UV_PICK_WIDTH * UV_PICK_WIDTH * 4]; S32 pick_face = face; LLFace* facep = objectp->mDrawable->getFace(pick_face); - gCamera->setPerspective(FOR_SELECTION, scaled_x - UV_PICK_HALF_WIDTH, scaled_y - UV_PICK_HALF_WIDTH, UV_PICK_WIDTH, UV_PICK_WIDTH, FALSE); + LLViewerCamera::getInstance()->setPerspective(FOR_SELECTION, scaled_x - UV_PICK_HALF_WIDTH, scaled_y - UV_PICK_HALF_WIDTH, UV_PICK_WIDTH, UV_PICK_WIDTH, FALSE); glViewport(scaled_x - UV_PICK_HALF_WIDTH, scaled_y - UV_PICK_HALF_WIDTH, UV_PICK_WIDTH, UV_PICK_WIDTH); gPipeline.renderFaceForUVSelect(facep); @@ -3872,7 +3821,7 @@ void LLViewerWindow::analyzeHit( LLVector3 LLViewerWindow::mouseDirectionGlobal(const S32 x, const S32 y) const { // find vertical field of view - F32 fov = gCamera->getView(); + F32 fov = LLViewerCamera::getInstance()->getView(); // find screen resolution S32 height = getWindowHeight(); @@ -3886,9 +3835,9 @@ LLVector3 LLViewerWindow::mouseDirectionGlobal(const S32 x, const S32 y) const F32 click_y = y - height / 2.f; // compute mouse vector - LLVector3 mouse_vector = distance * gCamera->getAtAxis() - - click_x * gCamera->getLeftAxis() - + click_y * gCamera->getUpAxis(); + LLVector3 mouse_vector = distance * LLViewerCamera::getInstance()->getAtAxis() + - click_x * LLViewerCamera::getInstance()->getLeftAxis() + + click_y * LLViewerCamera::getInstance()->getUpAxis(); mouse_vector.normVec(); @@ -3901,8 +3850,8 @@ LLVector3 LLViewerWindow::mouseDirectionGlobal(const S32 x, const S32 y) const LLVector3 LLViewerWindow::mouseDirectionCamera(const S32 x, const S32 y) const { // find vertical field of view - F32 fov_height = gCamera->getView(); - F32 fov_width = fov_height * gCamera->getAspect(); + F32 fov_height = LLViewerCamera::getInstance()->getView(); + F32 fov_width = fov_height * LLViewerCamera::getInstance()->getAspect(); // find screen resolution S32 height = getWindowHeight(); @@ -3979,7 +3928,7 @@ BOOL LLViewerWindow::mousePointOnLandGlobal(const S32 x, const S32 y, LLVector3d mouse_direction_global_d.setVec(mouse_direction_global * mouse_dir_scale); probe_point_global = camera_pos_global + mouse_direction_global_d; - regionp = gWorldPointer->resolveRegionGlobal(probe_point_region, probe_point_global); + regionp = LLWorld::getInstance()->resolveRegionGlobal(probe_point_region, probe_point_global); if (!regionp) { @@ -4026,7 +3975,7 @@ BOOL LLViewerWindow::mousePointOnLandGlobal(const S32 x, const S32 y, LLVector3d mouse_direction_global_d.setVec(mouse_direction_global * mouse_dir_scale); probe_point_global = camera_pos_global + mouse_direction_global_d; - regionp = gWorldPointer->resolveRegionGlobal(probe_point_region, probe_point_global); + regionp = LLWorld::getInstance()->resolveRegionGlobal(probe_point_region, probe_point_global); if (!regionp) { @@ -4245,7 +4194,7 @@ void LLViewerWindow::playSnapshotAnimAndSound() BOOL LLViewerWindow::thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 preview_height, BOOL show_ui, BOOL do_rebuild, ESnapshotType type) { - if ((!gWorldPointer) || (!raw) || preview_width < 10 || preview_height < 10) + if ((!raw) || preview_width < 10 || preview_height < 10) { return FALSE; } @@ -4293,7 +4242,7 @@ BOOL LLViewerWindow::thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 p if (type == SNAPSHOT_TYPE_OBJECT_ID) { gPickTransparent = FALSE; - gObjectList.renderObjectsForSelect(*gCamera, FALSE, FALSE); + gObjectList.renderObjectsForSelect(*LLViewerCamera::getInstance(), FALSE, FALSE); } else { @@ -4320,8 +4269,9 @@ BOOL LLViewerWindow::thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 p if(SNAPSHOT_TYPE_DEPTH == type) { - F32 depth_conversion_factor_1 = (gCamera->getFar() + gCamera->getNear()) / (2.f * gCamera->getFar() * gCamera->getNear()); - F32 depth_conversion_factor_2 = (gCamera->getFar() - gCamera->getNear()) / (2.f * gCamera->getFar() * gCamera->getNear()); + LLViewerCamera* camerap = LLViewerCamera::getInstance(); + F32 depth_conversion_factor_1 = (camerap->getFar() + camerap->getNear()) / (2.f * camerap->getFar() * camerap->getNear()); + F32 depth_conversion_factor_2 = (camerap->getFar() - camerap->getNear()) / (2.f * camerap->getFar() * camerap->getNear()); //calculate the depth for (S32 y = 0 ; y < h ; y++) @@ -4333,7 +4283,7 @@ BOOL LLViewerWindow::thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 p F32 depth_float_i = *(F32*)(raw->getData() + i); F32 linear_depth_float = 1.f / (depth_conversion_factor_1 - (depth_float_i * depth_conversion_factor_2)); - U8 depth_byte = F32_to_U8(linear_depth_float, gCamera->getNear(), gCamera->getFar()); + U8 depth_byte = F32_to_U8(linear_depth_float, camerap->getNear(), camerap->getFar()); *(raw->getData() + i + 0) = depth_byte; *(raw->getData() + i + 1) = depth_byte; *(raw->getData() + i + 2) = depth_byte; @@ -4382,8 +4332,7 @@ BOOL LLViewerWindow::thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 p BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_height, BOOL keep_window_aspect, BOOL is_texture, BOOL show_ui, BOOL do_rebuild, ESnapshotType type, S32 max_size) { - if ((!gWorldPointer) || - (!raw)) + if (!raw) { return FALSE; } @@ -4486,8 +4435,8 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei S32 output_buffer_offset_y = 0; - F32 depth_conversion_factor_1 = (gCamera->getFar() + gCamera->getNear()) / (2.f * gCamera->getFar() * gCamera->getNear()); - F32 depth_conversion_factor_2 = (gCamera->getFar() - gCamera->getNear()) / (2.f * gCamera->getFar() * gCamera->getNear()); + F32 depth_conversion_factor_1 = (LLViewerCamera::getInstance()->getFar() + LLViewerCamera::getInstance()->getNear()) / (2.f * LLViewerCamera::getInstance()->getFar() * LLViewerCamera::getInstance()->getNear()); + F32 depth_conversion_factor_2 = (LLViewerCamera::getInstance()->getFar() - LLViewerCamera::getInstance()->getNear()) / (2.f * LLViewerCamera::getInstance()->getFar() * LLViewerCamera::getInstance()->getNear()); for (int subimage_y = 0; subimage_y < scale_factor; ++subimage_y) { @@ -4505,12 +4454,12 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei glClearColor(0.f, 0.f, 0.f, 0.f); glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); - gCamera->setZoomParameters(scale_factor, subimage_x+(subimage_y*llceil(scale_factor))); + LLViewerCamera::getInstance()->setZoomParameters(scale_factor, subimage_x+(subimage_y*llceil(scale_factor))); setup3DRender(); setupViewport(); BOOL first_time_through = (subimage_x + subimage_y == 0); gPickTransparent = FALSE; - gObjectList.renderObjectsForSelect(*gCamera, FALSE, !first_time_through); + gObjectList.renderObjectsForSelect(*LLViewerCamera::getInstance(), FALSE, !first_time_through); } else { @@ -4562,7 +4511,7 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei F32 depth_float = *(F32*)(raw->getData() + i); F32 linear_depth_float = 1.f / (depth_conversion_factor_1 - (depth_float * depth_conversion_factor_2)); - U8 depth_byte = F32_to_U8(linear_depth_float, gCamera->getNear(), gCamera->getFar()); + U8 depth_byte = F32_to_U8(linear_depth_float, LLViewerCamera::getInstance()->getNear(), LLViewerCamera::getInstance()->getFar()); *(raw->getData() + i + 0) = depth_byte; *(raw->getData() + i + 1) = depth_byte; *(raw->getData() + i + 2) = depth_byte; @@ -4650,7 +4599,7 @@ void LLViewerWindow::drawMouselookInstructions() { // Draw instructions for mouselook ("Press ESC to leave Mouselook" in a box at the top of the screen.) const char* instructions = "Press ESC to leave Mouselook."; - const LLFontGL* font = gResMgr->getRes( LLFONT_SANSSERIF ); + const LLFontGL* font = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ); const S32 INSTRUCTIONS_PAD = 5; LLRect instructions_rect; @@ -4754,7 +4703,7 @@ void LLViewerWindow::setupViewport(S32 x_offset, S32 y_offset) void LLViewerWindow::setup3DRender() { - gCamera->setPerspective(NOT_FOR_SELECTION, 0, 0, mWindowRect.getWidth(), mWindowRect.getHeight(), FALSE, gCamera->getNear(), MAX_FAR_CLIP*2.f); + LLViewerCamera::getInstance()->setPerspective(NOT_FOR_SELECTION, 0, 0, mWindowRect.getWidth(), mWindowRect.getHeight(), FALSE, LLViewerCamera::getInstance()->getNear(), MAX_FAR_CLIP*2.f); } void LLViewerWindow::setup2DRender() @@ -5394,7 +5343,7 @@ LLBottomPanel::LLBottomPanel(const LLRect &rect) : mFactoryMap["toolbar"] = LLCallbackMap(createToolBar, NULL); mFactoryMap["overlay"] = LLCallbackMap(createOverlayBar, NULL); mFactoryMap["hud"] = LLCallbackMap(createHUD, NULL); - gUICtrlFactory->buildPanel(this, "panel_bars.xml", &getFactoryMap()); + LLUICtrlFactory::getInstance()->buildPanel(this, "panel_bars.xml", &getFactoryMap()); setOrigin(rect.mLeft, rect.mBottom); reshape(rect.getWidth(), rect.getHeight()); diff --git a/indra/newview/llvlcomposition.cpp b/indra/newview/llvlcomposition.cpp index 46085895f6..2ab2db625d 100644 --- a/indra/newview/llvlcomposition.cpp +++ b/indra/newview/llvlcomposition.cpp @@ -32,6 +32,8 @@ #include "llviewerprecompiledheaders.h" #include "llvlcomposition.h" + +#include "imageids.h" #include "llerror.h" #include "v3math.h" #include "llsurface.h" @@ -69,22 +71,10 @@ LLVLComposition::LLVLComposition(LLSurface *surfacep, const U32 width, const F32 mSurfacep = surfacep; // Load Terrain Textures - Original ones - LLUUID id; - // Dirt - id.set( gViewerArt.getString("terrain_dirt_detail.tga") ); - setDetailTextureID(0, id); - - // Grass - id.set( gViewerArt.getString("terrain_grass_detail.tga") ); - setDetailTextureID(1, id); - - // Rock mountain - id.set( gViewerArt.getString("terrain_mountain_detail.tga") ); - setDetailTextureID(2, id); - - // Rock face - id.set( gViewerArt.getString("terrain_rock_detail.tga") ); - setDetailTextureID(3, id); + setDetailTextureID(0, TERRAIN_DIRT_DETAIL); + setDetailTextureID(1, TERRAIN_GRASS_DETAIL); + setDetailTextureID(2, TERRAIN_MOUNTAIN_DETAIL); + setDetailTextureID(3, TERRAIN_ROCK_DETAIL); // Initialize the texture matrix to defaults. for (S32 i = 0; i < CORNER_COUNT; ++i) diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 68c5eec9a4..0add3bd9a9 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -694,7 +694,7 @@ LLVOAvatar::LLVOAvatar( // mVoiceVisualizer is created by the hud effects manager and uses the HUD Effects pipeline bool needsSendToSim = false; // currently, this HUD effect doesn't need to pack and unpack data to do its job - mVoiceVisualizer = ( LLVoiceVisualizer *)gHUDManager->createViewerEffect( LLHUDObject::LL_HUD_EFFECT_VOICE_VISUALIZER, needsSendToSim ); + mVoiceVisualizer = ( LLVoiceVisualizer *)LLHUDManager::getInstance()->createViewerEffect( LLHUDObject::LL_HUD_EFFECT_VOICE_VISUALIZER, needsSendToSim ); lldebugs << "LLVOAvatar Constructor (0x" << this << ") id:" << mID << llendl; @@ -757,8 +757,7 @@ LLVOAvatar::LLVOAvatar( mRippleTimeLast = 0.f; - mShadowImageID = LLUUID( gViewerArt.getString("foot_shadow.tga")); - mShadowImagep = gImageList.getImage(mShadowImageID); + mShadowImagep = gImageList.getImageFromFile("foot_shadow.j2c"); mShadowImagep->bind(); mShadowImagep->setClamp(TRUE, TRUE); @@ -1728,7 +1727,7 @@ BOOL LLVOAvatar::buildSkeleton(LLVOAvatarSkeletonInfo *info) mScreenp = new LLViewerJoint("mScreen", NULL); // for now, put screen at origin, as it is only used during special // HUD rendering mode - F32 aspect = gCamera->getAspect(); + F32 aspect = LLViewerCamera::getInstance()->getAspect(); LLVector3 scale(1.f, aspect, 1.f); mScreenp->setScale(scale); mScreenp->setWorldPosition(LLVector3::zero); @@ -2572,7 +2571,7 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) if (visibleAttachment && attached_object && !attached_object->isDead() && attachment->getValid()) { // if selecting any attachments, update all of them as non-damped - if (gSelectMgr->getSelection()->getObjectCount() && gSelectMgr->getSelection()->isAttachment()) + if (LLSelectMgr::getInstance()->getSelection()->getObjectCount() && LLSelectMgr::getInstance()->getSelection()->isAttachment()) { gPipeline.updateMoveNormalAsync(attached_object->mDrawable); } @@ -2848,11 +2847,11 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) mNameText->setUsePixelSize(TRUE); LLVector3 pixel_right_vec; LLVector3 pixel_up_vec; - gCamera->getPixelVectors(root_pos_last, pixel_up_vec, pixel_right_vec); - LLVector3 camera_to_av = root_pos_last - gCamera->getOrigin(); + LLViewerCamera::getInstance()->getPixelVectors(root_pos_last, pixel_up_vec, pixel_right_vec); + LLVector3 camera_to_av = root_pos_last - LLViewerCamera::getInstance()->getOrigin(); camera_to_av.normVec(); LLVector3 local_camera_at = camera_to_av * ~root_rot; - LLVector3 local_camera_up = camera_to_av % gCamera->getLeftAxis(); + LLVector3 local_camera_up = camera_to_av % LLViewerCamera::getInstance()->getLeftAxis(); local_camera_up.normVec(); local_camera_up = local_camera_up * ~root_rot; @@ -2889,7 +2888,7 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) } else { - is_muted = gMuteListp->isMuted(getID()); + is_muted = LLMuteList::getInstance()->isMuted(getID()); } if (mNameString.empty() || @@ -3088,7 +3087,7 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) else if (!mBeam || mBeam->isDead()) { // VEFFECT: Tractor Beam - mBeam = (LLHUDEffectSpiral *)gHUDManager->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM); + mBeam = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM); mBeam->setColor(LLColor4U(gAgent.getEffectColor())); mBeam->setSourceObject(this); mBeamTimer.reset(); @@ -3096,7 +3095,7 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) if (!mBeam.isNull()) { - LLObjectSelectionHandle selection = gSelectMgr->getSelection(); + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); if (gAgent.mPointAt.notNull()) { @@ -3113,7 +3112,7 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) else { mBeam->setTargetObject(NULL); - LLTool *tool = gToolMgr->getCurrentTool(); + LLTool *tool = LLToolMgr::getInstance()->getCurrentTool(); if (tool->isEditing()) { if (tool->getEditingObject()) @@ -3172,7 +3171,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) if (mScreenp) { - F32 aspect = gCamera->getAspect(); + F32 aspect = LLViewerCamera::getInstance()->getAspect(); LLVector3 scale(1.f, aspect, 1.f); mScreenp->setScale(scale); mScreenp->updateWorldMatrixChildren(); @@ -3242,7 +3241,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) if (!mIsSelf && sUseImpostors && !mNeedsAnimUpdate && !sFreezeCounter) { F32 impostor_area = 256.f*512.f*(8.125f - LLVOAvatar::sLODFactor*8.f); - if (gMuteListp && gMuteListp->isMuted(getID())) + if (LLMuteList::getInstance()->isMuted(getID())) { mUpdatePeriod = 16; visible = (LLDrawable::getCurrentFrame()+mID.mData[0])%mUpdatePeriod == 0 ? TRUE : FALSE; @@ -3353,7 +3352,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) resolveHeightGlobal(root_pos, ground_under_pelvis, normal); F32 foot_to_ground = (F32) (root_pos.mdV[VZ] - mPelvisToFoot - ground_under_pelvis.mdV[VZ]); - BOOL in_air = ( (!gWorldPointer->getRegionFromPosGlobal(ground_under_pelvis)) || + BOOL in_air = ( (!LLWorld::getInstance()->getRegionFromPosGlobal(ground_under_pelvis)) || foot_to_ground > FOOT_GROUND_COLLISION_TOLERANCE); if (in_air && !mInAir) @@ -3414,11 +3413,11 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) // make sure fwdDir stays in same general direction as primdir if (gAgent.getFlying()) { - fwdDir = gCamera->getAtAxis(); + fwdDir = LLViewerCamera::getInstance()->getAtAxis(); } else { - LLVector3 at_axis = gCamera->getAtAxis(); + LLVector3 at_axis = LLViewerCamera::getInstance()->getAtAxis(); LLVector3 up_vector = gAgent.getReferenceUpVector(); at_axis -= up_vector * (at_axis * up_vector); at_axis.normVec(); @@ -3634,8 +3633,8 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) LLVector3d foot_pos_global = gAgent.getPosGlobalFromAgent(foot_pos_agent); - if (gParcelMgr && gParcelMgr->canHearSound(foot_pos_global) - && gMuteListp && !gMuteListp->isMuted(getID(), LLMute::flagObjectSounds)) + if (LLViewerParcelMgr::getInstance()->canHearSound(foot_pos_global) + && !LLMuteList::getInstance()->isMuted(getID(), LLMute::flagObjectSounds)) { gAudiop->triggerSound(step_sound_id, getID(), gain, foot_pos_global); } @@ -3694,7 +3693,7 @@ void LLVOAvatar::updateHeadOffset() // since we only care about Z, just grab one of the eyes LLVector3 midEyePt = mEyeLeftp->getWorldPosition(); midEyePt -= mDrawable.notNull() ? mDrawable->getWorldPosition() : mRoot.getWorldPosition(); - midEyePt.mV[VZ] = llmax(-mPelvisToFoot + gCamera->getNear(), midEyePt.mV[VZ]); + midEyePt.mV[VZ] = llmax(-mPelvisToFoot + LLViewerCamera::getInstance()->getNear(), midEyePt.mV[VZ]); if (mDrawable.notNull()) { @@ -3729,7 +3728,7 @@ void LLVOAvatar::updateVisibility() else { // calculate avatar distance wrt head - mDrawable->updateDistance(*gCamera); + mDrawable->updateDistance(*LLViewerCamera::getInstance()); if (!mDrawable->getSpatialGroup() || mDrawable->getSpatialGroup()->isVisible()) { @@ -3783,15 +3782,15 @@ void LLVOAvatar::updateVisibility() llinfos << "Avatar not in frustum" << llendl; }*/ - /*if (gCamera->sphereInFrustum(sel_pos_agent, 2.0f)) + /*if (LLViewerCamera::getInstance()->sphereInFrustum(sel_pos_agent, 2.0f)) { llinfos << "Sel pos visible" << llendl; } - if (gCamera->sphereInFrustum(wrist_right_pos_agent, 0.2f)) + if (LLViewerCamera::getInstance()->sphereInFrustum(wrist_right_pos_agent, 0.2f)) { llinfos << "Wrist pos visible" << llendl; } - if (gCamera->sphereInFrustum(getPositionAgent(), getMaxScale()*2.f)) + if (LLViewerCamera::getInstance()->sphereInFrustum(getPositionAgent(), getMaxScale()*2.f)) { llinfos << "Agent visible" << llendl; }*/ @@ -3857,16 +3856,16 @@ BOOL LLVOAvatar::needsRenderBeam() { return FALSE; } - LLTool *tool = gToolMgr->getCurrentTool(); + LLTool *tool = LLToolMgr::getInstance()->getCurrentTool(); - BOOL is_touching_or_grabbing = (tool == gToolGrab && gToolGrab->isEditing()); - if (gToolGrab->getEditingObject() && - gToolGrab->getEditingObject()->isAttachment()) + BOOL is_touching_or_grabbing = (tool == LLToolGrab::getInstance() && LLToolGrab::getInstance()->isEditing()); + if (LLToolGrab::getInstance()->getEditingObject() && + LLToolGrab::getInstance()->getEditingObject()->isAttachment()) { // don't render selection beam on hud objects is_touching_or_grabbing = FALSE; } - return is_touching_or_grabbing || (mState & AGENT_STATE_EDITING && gSelectMgr->shouldShowSelection()); + return is_touching_or_grabbing || (mState & AGENT_STATE_EDITING && LLSelectMgr::getInstance()->shouldShowSelection()); } //----------------------------------------------------------------------------- @@ -4128,9 +4127,9 @@ U32 LLVOAvatar::renderImpostor(LLColor4U color) } LLVector3 pos(getRenderPosition()+mImpostorOffset); - LLVector3 at = (pos-gCamera->getOrigin()); + LLVector3 at = (pos - LLViewerCamera::getInstance()->getOrigin()); at.normVec(); - LLVector3 left = gCamera->getUpAxis() % at; + LLVector3 left = LLViewerCamera::getInstance()->getUpAxis() % at; LLVector3 up = at%left; left *= mImpostorDim.mV[0]; @@ -4453,7 +4452,7 @@ void LLVOAvatar::resolveHeightAgent(const LLVector3 &in_pos_agent, LLVector3 &ou void LLVOAvatar::resolveRayCollisionAgent(const LLVector3d start_pt, const LLVector3d end_pt, LLVector3d &out_pos, LLVector3 &out_norm) { LLViewerObject *obj; - gWorldPointer->resolveStepHeightGlobal(this, start_pt, end_pt, out_pos, out_norm, &obj); + LLWorld::getInstance()->resolveStepHeightGlobal(this, start_pt, end_pt, out_pos, out_norm, &obj); } @@ -4463,7 +4462,7 @@ void LLVOAvatar::resolveHeightGlobal(const LLVector3d &inPos, LLVector3d &outPos LLVector3d p0 = inPos + zVec; LLVector3d p1 = inPos - zVec; LLViewerObject *obj; - gWorldPointer->resolveStepHeightGlobal(this, p0, p1, outPos, outNorm, &obj); + LLWorld::getInstance()->resolveStepHeightGlobal(this, p0, p1, outPos, outNorm, &obj); if (!obj) { mStepOnLand = TRUE; @@ -4614,8 +4613,8 @@ BOOL LLVOAvatar::processSingleAnimationStateChange( const LLUUID& anim_id, BOOL if (gAudiop) { LLVector3d char_pos_global = gAgent.getPosGlobalFromAgent(getCharacterPosition()); - if (gParcelMgr && gParcelMgr->canHearSound(char_pos_global) - && gMuteListp && !gMuteListp->isMuted(getID(), LLMute::flagObjectSounds)) + if (LLViewerParcelMgr::getInstance()->canHearSound(char_pos_global) + && !LLMuteList::getInstance()->isMuted(getID(), LLMute::flagObjectSounds)) { // RN: uncomment this to play on typing sound at fixed volume once sound engine is fixed // to support both spatialized and non-spatialized instances of the same sound @@ -4899,7 +4898,7 @@ void LLVOAvatar::getGround(const LLVector3 &in_pos_agent, LLVector3 &out_pos_age p1_global = gAgent.getPosGlobalFromAgent(in_pos_agent) - z_vec; LLViewerObject *obj; LLVector3d out_pos_global; - gWorldPointer->resolveStepHeightGlobal(this, p0_global, p1_global, out_pos_global, outNorm, &obj); + LLWorld::getInstance()->resolveStepHeightGlobal(this, p0_global, p1_global, out_pos_global, outNorm, &obj); out_pos_agent = gAgent.getPosAgentFromGlobal(out_pos_global); } @@ -5635,7 +5634,7 @@ void LLVOAvatar::setPixelAreaAndAngle(LLAgent &agent) LLVector3 center = (ext[1] + ext[0]) * 0.5f; LLVector3 size = (ext[1]-ext[0])*0.5f; - mPixelArea = LLPipeline::calcPixelArea(center, size, *gCamera); + mPixelArea = LLPipeline::calcPixelArea(center, size, *LLViewerCamera::getInstance()); F32 range = mDrawable->mDistanceWRTCamera; @@ -5772,7 +5771,7 @@ void LLVOAvatar::updateShadowFaces() return; } - LLSprite sprite(mShadowImageID); + LLSprite sprite(mShadowImagep.notNull() ? mShadowImagep->getID() : LLUUID::null); sprite.setFollow(FALSE); const F32 cos_angle = gSky.getSunDirection().mV[2]; F32 cos_elev = sqrt(1 - cos_angle * cos_angle); @@ -6010,8 +6009,8 @@ BOOL LLVOAvatar::attachObject(LLViewerObject *viewer_object) if (viewer_object->isSelected()) { - gSelectMgr->updateSelectionCenter(); - gSelectMgr->updatePointAt(); + LLSelectMgr::getInstance()->updateSelectionCenter(); + LLSelectMgr::getInstance()->updatePointAt(); } if (mIsSelf) @@ -6318,6 +6317,22 @@ void LLVOAvatar::onLocalTextureLoaded( BOOL success, LLViewerImage *src_vi, LLIm self->updateMeshTextures(); } } + else if (final) + { + LLVOAvatar *self = (LLVOAvatar *)gObjectList.findObject(data->mAvatarID); + LLVOAvatar::ELocTexIndex idx = data->mIndex; + // Failed: asset is missing + if( self && + (!self->mLocalTextureBaked[ idx ]) && + (self->mLocalTexture[ idx ].notNull()) && + (self->mLocalTexture[ idx ]->getID() == src_id)) + { + self->mLocalTextureDiscard[idx] = 0; // we check that it's missing later + self->requestLayerSetUpdate( idx ); + self->updateMeshTextures(); + } + + } if( final || !success ) { @@ -6482,7 +6497,7 @@ void LLVOAvatar::forceBakeAllTextures(bool slam_for_debug) BOOL set_by_user = TRUE; invalidateComposite(layer_set, set_by_user); - gViewerStats->incStat(LLViewerStats::ST_TEX_REBAKES); + LLViewerStats::getInstance()->incStat(LLViewerStats::ST_TEX_REBAKES); } else { @@ -6520,7 +6535,7 @@ void LLVOAvatar::processRebakeAvatarTextures(LLMessageSystem* msg, void**) BOOL set_by_user = TRUE; self->invalidateComposite(layer_set, set_by_user); found = TRUE; - gViewerStats->incStat(LLViewerStats::ST_TEX_REBAKES); + LLViewerStats::getInstance()->incStat(LLViewerStats::ST_TEX_REBAKES); } } } @@ -7369,7 +7384,10 @@ void LLVOAvatar::clearChat() S32 LLVOAvatar::getLocalDiscardLevel( S32 index ) { - if (index >= 0 && mLocalTexture[index].notNull() && mLocalTexture[index]->getID() != IMG_DEFAULT_AVATAR) + if (index >= 0 + && mLocalTexture[index].notNull() + && (mLocalTexture[index]->getID() != IMG_DEFAULT_AVATAR) + && !mLocalTexture[index]->isMissingAsset()) { return mLocalTexture[index]->getDiscardLevel(); } @@ -9374,13 +9392,13 @@ void LLVOAvatar::updateRegion(LLViewerRegion *regionp) { ++mRegionCrossingCount; F64 delta = (F64)mRegionCrossingTimer.getElapsedTimeF32(); - F64 avg = (mRegionCrossingCount == 1) ? 0 : gViewerStats->getStat(LLViewerStats::ST_CROSSING_AVG); + F64 avg = (mRegionCrossingCount == 1) ? 0 : LLViewerStats::getInstance()->getStat(LLViewerStats::ST_CROSSING_AVG); F64 delta_avg = (delta + avg*(mRegionCrossingCount-1)) / mRegionCrossingCount; - gViewerStats->setStat(LLViewerStats::ST_CROSSING_AVG, delta_avg); + LLViewerStats::getInstance()->setStat(LLViewerStats::ST_CROSSING_AVG, delta_avg); - F64 max = (mRegionCrossingCount == 1) ? 0 : gViewerStats->getStat(LLViewerStats::ST_CROSSING_MAX); + F64 max = (mRegionCrossingCount == 1) ? 0 : LLViewerStats::getInstance()->getStat(LLViewerStats::ST_CROSSING_MAX); max = llmax(delta, max); - gViewerStats->setStat(LLViewerStats::ST_CROSSING_MAX, max); + LLViewerStats::getInstance()->setStat(LLViewerStats::ST_CROSSING_MAX, max); } mLastRegionHandle = regionp->getHandle(); } @@ -9555,11 +9573,11 @@ void LLVOAvatar::getImpostorValues(LLVector3* extents, LLVector3& angle, F32& di extents[0] = ext[0]; extents[1] = ext[1]; - LLVector3 at = gCamera->getOrigin()-(getRenderPosition()+mImpostorOffset); + LLVector3 at = LLViewerCamera::getInstance()->getOrigin()-(getRenderPosition()+mImpostorOffset); distance = at.normVec(); - F32 da = 1.f - (at*gCamera->getAtAxis()); - angle.mV[0] = gCamera->getYaw()*da; - angle.mV[1] = gCamera->getPitch()*da; + F32 da = 1.f - (at*LLViewerCamera::getInstance()->getAtAxis()); + angle.mV[0] = LLViewerCamera::getInstance()->getYaw()*da; + angle.mV[1] = LLViewerCamera::getInstance()->getPitch()*da; angle.mV[2] = da; } @@ -9694,4 +9712,3 @@ void LLVOAvatar::shame() mText->setColor(LLColor4(red,green,0,1)); } - diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index a6731c3e31..b4a35d8e7e 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -694,7 +694,6 @@ public: //-------------------------------------------------------------------- // texture ids and pointers //-------------------------------------------------------------------- - LLUUID mShadowImageID; LLPointer<LLViewerImage> mShadowImagep; LLUUID mLastHeadBakedID; diff --git a/indra/newview/llvoclouds.cpp b/indra/newview/llvoclouds.cpp index 2e0da4727c..e255293617 100644 --- a/indra/newview/llvoclouds.cpp +++ b/indra/newview/llvoclouds.cpp @@ -133,7 +133,7 @@ BOOL LLVOClouds::updateGeometry(LLDrawable *drawable) drawable->setNumFacesFast(num_faces, NULL, getTEImage(0)); } - mDepth = (getPositionAgent()-gCamera->getOrigin())*gCamera->getAtAxis(); + mDepth = (getPositionAgent()-LLViewerCamera::getInstance()->getOrigin())*LLViewerCamera::getInstance()->getAtAxis(); S32 face_indx = 0; for ( ; face_indx < num_faces; face_indx++) @@ -224,7 +224,7 @@ void LLVOClouds::getGeometry(S32 te, LLVector3 vtx[4]; - at = gCamera->getAtAxis(); + at = LLViewerCamera::getInstance()->getAtAxis(); right = at % LLVector3(0.f, 0.f, 1.f); right.normVec(); up = right % at; diff --git a/indra/newview/llvograss.cpp b/indra/newview/llvograss.cpp index 833fe4b464..54dabe5615 100644 --- a/indra/newview/llvograss.cpp +++ b/indra/newview/llvograss.cpp @@ -176,7 +176,8 @@ void LLVOGrass::initClass() static LLStdStringHandle texture_name_string = LLXmlTree::addAttributeString("texture_name"); success &= grass_def->getFastAttributeString(texture_name_string, textureName); - newGrass->mTextureID.set( gViewerArt.getString(textureName) ); + LLViewerImage* grass_image = gImageList.getImageFromFile(textureName); + newGrass->mTextureID = grass_image->getID(); } static LLStdStringHandle blade_sizex_string = LLXmlTree::addAttributeString("blade_size_x"); @@ -330,7 +331,7 @@ void LLVOGrass::setPixelAreaAndAngle(LLAgent &agent) mAppAngle = (F32) atan2( max_scale, range) * RAD_TO_DEG; // Compute pixels per meter at the given range - F32 pixels_per_meter = gCamera->getViewHeightInPixels() / (tan(gCamera->getView()) * range); + F32 pixels_per_meter = LLViewerCamera::getInstance()->getViewHeightInPixels() / (tan(LLViewerCamera::getInstance()->getView()) * range); // Assume grass texture is a 5 meter by 5 meter sprite at the grass object's center mPixelArea = (pixels_per_meter) * (pixels_per_meter) * 25.f; @@ -430,7 +431,7 @@ void LLVOGrass::plantBlades() face->setTEOffset(0); face->mCenterLocal = mPosition + mRegionp->getOriginAgent(); - mDepth = (face->mCenterLocal - gCamera->getOrigin())*gCamera->getAtAxis(); + mDepth = (face->mCenterLocal - LLViewerCamera::getInstance()->getOrigin())*LLViewerCamera::getInstance()->getAtAxis(); mDrawable->setPosition(face->mCenterLocal); mDrawable->movePartition(); LLPipeline::sCompiles++; diff --git a/indra/newview/llvoground.cpp b/indra/newview/llvoground.cpp index fd4956113d..361f2ebf50 100644 --- a/indra/newview/llvoground.cpp +++ b/indra/newview/llvoground.cpp @@ -122,13 +122,13 @@ BOOL LLVOGround::updateGeometry(LLDrawable *drawable) // // // - LLVector3 at_dir = gCamera->getAtAxis(); + LLVector3 at_dir = LLViewerCamera::getInstance()->getAtAxis(); at_dir.mV[VZ] = 0.f; if (at_dir.normVec() < 0.01) { // We really don't care, as we're not looking anywhere near the horizon. } - LLVector3 left_dir = gCamera->getLeftAxis(); + LLVector3 left_dir = LLViewerCamera::getInstance()->getLeftAxis(); left_dir.mV[VZ] = 0.f; left_dir.normVec(); diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index e2ea6e6ecf..56e5062820 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -1204,12 +1204,7 @@ void LLVoiceClient::stateMachine() // Check for parcel boundary crossing { LLViewerRegion *region = gAgent.getRegion(); - LLParcel *parcel = NULL; - - if(gParcelMgr) - { - parcel = gParcelMgr->getAgentParcel(); - } + LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if(region && parcel) { @@ -1626,9 +1621,9 @@ void LLVoiceClient::stateMachine() notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LOGGED_IN); // Set up the mute list observer if it hasn't been set up already. - if((!sMuteListListener_listening) && (gMuteListp)) + if((!sMuteListListener_listening)) { - gMuteListp->addObserver(&mutelist_listener); + LLMuteList::getInstance()->addObserver(&mutelist_listener); sMuteListListener_listening = true; } @@ -3068,7 +3063,7 @@ void LLVoiceClient::updateMuteState(participantState *p) { if(p->mAvatarIDValid) { - bool isMuted = gMuteListp->isMuted(p->mAvatarID, LLMute::flagVoiceChat); + bool isMuted = LLMuteList::getInstance()->isMuted(p->mAvatarID, LLMute::flagVoiceChat); if(p->mOnMuteList != isMuted) { p->mOnMuteList = isMuted; diff --git a/indra/newview/llvoicevisualizer.cpp b/indra/newview/llvoicevisualizer.cpp index 8d813f47aa..a7e1915171 100644 --- a/indra/newview/llvoicevisualizer.cpp +++ b/indra/newview/llvoicevisualizer.cpp @@ -98,21 +98,21 @@ LLVoiceVisualizer::LLVoiceVisualizer( const U8 type ) mTimer.reset(); - LLUUID sound_level_img[] = + const char* sound_level_img[] = { - LLUUID(gSavedSettings.getString("VoiceImageLevel0")), - LLUUID(gSavedSettings.getString("VoiceImageLevel1")), - LLUUID(gSavedSettings.getString("VoiceImageLevel2")), - LLUUID(gSavedSettings.getString("VoiceImageLevel3")), - LLUUID(gSavedSettings.getString("VoiceImageLevel4")), - LLUUID(gSavedSettings.getString("VoiceImageLevel5")), - LLUUID(gSavedSettings.getString("VoiceImageLevel6")) + "041ee5a0-cb6a-9ac5-6e49-41e9320507d5.j2c", + "29de489d-0491-fb00-7dab-f9e686d31e83.j2c", + "29de489d-0491-fb00-7dab-f9e686d31e83.j2c", + "29de489d-0491-fb00-7dab-f9e686d31e83.j2c", + "29de489d-0491-fb00-7dab-f9e686d31e83.j2c", + "29de489d-0491-fb00-7dab-f9e686d31e83.j2c", + "29de489d-0491-fb00-7dab-f9e686d31e83.j2c" }; for (int i=0; i<NUM_VOICE_SYMBOL_WAVES; i++) { mSoundSymbol.mWaveFadeOutStartTime [i] = mCurrentTime; - mSoundSymbol.mTexture [i] = gImageList.getImageByID(sound_level_img[i]); + mSoundSymbol.mTexture [i] = gImageList.getImageFromFile(sound_level_img[i], FALSE, TRUE); mSoundSymbol.mWaveActive [i] = false; mSoundSymbol.mWaveOpacity [i] = 1.0f; mSoundSymbol.mWaveExpansion [i] = 1.0f; @@ -203,8 +203,8 @@ void LLVoiceVisualizer::render() //------------------------------------------------------------- // create coordinates of the geometry for the dot //------------------------------------------------------------- - LLVector3 l = gCamera->getLeftAxis() * DOT_SIZE; - LLVector3 u = gCamera->getUpAxis() * DOT_SIZE; + LLVector3 l = LLViewerCamera::getInstance()->getLeftAxis() * DOT_SIZE; + LLVector3 u = LLViewerCamera::getInstance()->getUpAxis() * DOT_SIZE; LLVector3 bottomLeft = mSoundSymbol.mPosition + l - u; LLVector3 bottomRight = mSoundSymbol.mPosition - l - u; @@ -330,8 +330,8 @@ void LLVoiceVisualizer::render() F32 width = i * WAVE_WIDTH_SCALE * mSoundSymbol.mWaveExpansion[i]; F32 height = i * WAVE_HEIGHT_SCALE * mSoundSymbol.mWaveExpansion[i]; - LLVector3 l = gCamera->getLeftAxis() * width; - LLVector3 u = gCamera->getUpAxis() * height; + LLVector3 l = LLViewerCamera::getInstance()->getLeftAxis() * width; + LLVector3 u = LLViewerCamera::getInstance()->getUpAxis() * height; LLVector3 bottomLeft = mSoundSymbol.mPosition + l - u; LLVector3 bottomRight = mSoundSymbol.mPosition - l - u; diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp index 14e503d2d1..412e4660c8 100644 --- a/indra/newview/llvopartgroup.cpp +++ b/indra/newview/llvopartgroup.cpp @@ -95,7 +95,7 @@ void LLVOPartGroup::setPixelAreaAndAngle(LLAgent &agent) { // mPixelArea is calculated during render F32 mid_scale = getMidScale(); - F32 range = (getRenderPosition()-gCamera->getOrigin()).magVec(); + F32 range = (getRenderPosition()-LLViewerCamera::getInstance()->getOrigin()).magVec(); if (range < 0.001f || isHUDAttachment()) // range == zero { @@ -141,7 +141,7 @@ BOOL LLVOPartGroup::updateGeometry(LLDrawable *drawable) LLVector3 at; LLVector3 position_agent; - LLVector3 camera_agent = gCamera->getOrigin(); + LLVector3 camera_agent = LLViewerCamera::getInstance()->getOrigin(); S32 num_parts = mViewerPartGroupp->getCount(); LLFace *facep; @@ -176,7 +176,7 @@ BOOL LLVOPartGroup::updateGeometry(LLDrawable *drawable) F32 tot_area = 0; F32 max_area = LLViewerPartSim::getMaxPartCount() * MAX_PARTICLE_AREA_SCALE; - F32 pixel_meter_ratio = gCamera->getPixelMeterRatio(); + F32 pixel_meter_ratio = LLViewerCamera::getInstance()->getPixelMeterRatio(); pixel_meter_ratio *= pixel_meter_ratio; S32 count=0; @@ -309,7 +309,7 @@ void LLVOPartGroup::getGeometry(S32 idx, right *= 0.5f*part.mScale.mV[0]; up *= 0.5f*part.mScale.mV[1]; - const LLVector3& normal = -gCamera->getXAxis(); + const LLVector3& normal = -LLViewerCamera::getInstance()->getXAxis(); *verticesp++ = part_pos_agent + up - right; *verticesp++ = part_pos_agent - up - right; @@ -391,7 +391,7 @@ void LLParticlePartition::addGeometryCount(LLSpatialGroup* group, U32& vertex_co } count++; - facep->mDistance = (facep->mCenterLocal - gCamera->getOrigin()) * gCamera->getAtAxis(); + facep->mDistance = (facep->mCenterLocal - LLViewerCamera::getInstance()->getOrigin()) * LLViewerCamera::getInstance()->getAtAxis(); obj->mDepth += facep->mDistance; mFaceList.push_back(facep); diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index ba06083fd3..07fc1ece73 100644 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -439,7 +439,7 @@ void LLVOSky::initCubeMap() { mCubeMap->init(images); } - else if (gSavedSettings.getBOOL("RenderWater") && gGLManager.mHasCubeMap && gFeatureManagerp->isFeatureAvailable("RenderCubeMap")) + else if (gSavedSettings.getBOOL("RenderWater") && gGLManager.mHasCubeMap && LLFeatureManager::getInstance()->isFeatureAvailable("RenderCubeMap")) { mCubeMap = new LLCubeMap(); mCubeMap->init(images); @@ -477,7 +477,7 @@ void LLVOSky::restoreGL() calcAtmospherics(); if (gSavedSettings.getBOOL("RenderWater") && gGLManager.mHasCubeMap - && gFeatureManagerp->isFeatureAvailable("RenderCubeMap")) + && LLFeatureManager::getInstance()->isFeatureAvailable("RenderCubeMap")) { LLCubeMap* cube_map = getCubeMap(); @@ -1102,7 +1102,7 @@ BOOL LLVOSky::updateSky() { if (mForceUpdate) { - updateFog(gCamera->getFar()); + updateFog(LLViewerCamera::getInstance()->getFar()); for (int side = 0; side < 6; side++) { for (int tile = 0; tile < NUM_TILES; tile++) @@ -1331,7 +1331,7 @@ BOOL LLVOSky::updateGeometry(LLDrawable *drawable) } } - const LLVector3 &look_at = gCamera->getAtAxis(); + const LLVector3 &look_at = LLViewerCamera::getInstance()->getAtAxis(); LLVector3 right = look_at % LLVector3::z_axis; LLVector3 up = right % look_at; right.normVec(); @@ -1343,7 +1343,7 @@ BOOL LLVOSky::updateGeometry(LLDrawable *drawable) mMoon.setDraw(updateHeavenlyBodyGeometry(drawable, FACE_MOON, FALSE, mMoon, cos_max_angle, up, right)); const F32 water_height = gAgent.getRegion()->getWaterHeight() + 0.01f; - // gWorldPointer->getWaterHeight() + 0.01f; + // LLWorld::getInstance()->getWaterHeight() + 0.01f; const F32 camera_height = mCameraPosAgent.mV[2]; const F32 height_above_water = camera_height - water_height; @@ -1691,9 +1691,9 @@ F32 dtClip(const LLVector3& v0, const LLVector3& v1, F32 far_clip2) void LLVOSky::updateReflectionGeometry(LLDrawable *drawable, F32 H, const LLHeavenBody& HB) { - const LLVector3 &look_at = gCamera->getAtAxis(); + const LLVector3 &look_at = LLViewerCamera::getInstance()->getAtAxis(); // const F32 water_height = gAgent.getRegion()->getWaterHeight() + 0.001f; - // gWorldPointer->getWaterHeight() + 0.001f; + // LLWorld::getInstance()->getWaterHeight() + 0.001f; LLVector3 to_dir = HB.getDirection(); LLVector3 hb_pos = to_dir * (HORIZON_DIST - 10); @@ -1824,7 +1824,7 @@ void LLVOSky::updateReflectionGeometry(LLDrawable *drawable, F32 H, side = 2; } - //const F32 far_clip = (gCamera->getFar() - 0.01) / far_clip_factor; + //const F32 far_clip = (LLViewerCamera::getInstance()->getFar() - 0.01) / far_clip_factor; const F32 far_clip = 512; const F32 far_clip2 = far_clip*far_clip; @@ -2022,10 +2022,10 @@ void LLVOSky::updateFog(const F32 distance) LLColor4 target_fog(0.f, 0.2f, 0.5f, 0.f); const F32 water_height = gAgent.getRegion()->getWaterHeight(); - // gWorldPointer->getWaterHeight(); + // LLWorld::getInstance()->getWaterHeight(); F32 camera_height = gAgent.getCameraPositionAgent().mV[2]; - F32 near_clip_height = gCamera->getAtAxis().mV[VZ] * gCamera->getNear(); + F32 near_clip_height = LLViewerCamera::getInstance()->getAtAxis().mV[VZ] * LLViewerCamera::getInstance()->getNear(); camera_height += near_clip_height; F32 fog_distance = 0.f; diff --git a/indra/newview/llvotree.cpp b/indra/newview/llvotree.cpp index 2f81ae84ba..16555fdc9a 100644 --- a/indra/newview/llvotree.cpp +++ b/indra/newview/llvotree.cpp @@ -399,8 +399,8 @@ void LLVOTree::setPixelAreaAndAngle(LLAgent &agent) F32 area = max_scale * (max_scale*mBillboardRatio); // Compute pixels per meter at the given range - F32 pixels_per_meter = gCamera->getViewHeightInPixels() / - (tan(gCamera->getView()) * range); + F32 pixels_per_meter = LLViewerCamera::getInstance()->getViewHeightInPixels() / + (tan(LLViewerCamera::getInstance()->getView()) * range); mPixelArea = (pixels_per_meter) * (pixels_per_meter) * area; #if 0 diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 58f94120d0..37353cf7ec 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -452,7 +452,7 @@ void LLVOVolume::updateTextures() if (isHUDAttachment()) { - F32 area = (F32) gCamera->getScreenPixelArea(); + F32 area = (F32) LLViewerCamera::getInstance()->getScreenPixelArea(); vsize = area; imagep->setBoostLevel(LLViewerImage::BOOST_HUD); face->setPixelArea(area); // treat as full screen @@ -557,7 +557,7 @@ F32 LLVOVolume::getTextureVirtualSize(LLFace* face) LLVector3 center = face->getPositionAgent(); LLVector3 size = (face->mExtents[1] - face->mExtents[0]) * 0.5f; - F32 face_area = LLPipeline::calcPixelArea(center, size, *gCamera); + F32 face_area = LLPipeline::calcPixelArea(center, size, *LLViewerCamera::getInstance()); face->setPixelArea(face_area); @@ -651,7 +651,7 @@ LLDrawable *LLVOVolume::createDrawable(LLPipeline *pipeline) } updateRadius(); - mDrawable->updateDistance(*gCamera); + mDrawable->updateDistance(*LLViewerCamera::getInstance()); return mDrawable; } diff --git a/indra/newview/llvowater.cpp b/indra/newview/llvowater.cpp index 901dc6de21..8755a5ae4a 100644 --- a/indra/newview/llvowater.cpp +++ b/indra/newview/llvowater.cpp @@ -133,7 +133,7 @@ LLDrawable *LLVOWater::createDrawable(LLPipeline *pipeline) } else { - mDrawable->setNumFaces(1, pool, gWorldp->getDefaultWaterTexture()); + mDrawable->setNumFaces(1, pool, LLWorld::getInstance()->getDefaultWaterTexture()); } return mDrawable; diff --git a/indra/newview/llwaterparammanager.cpp b/indra/newview/llwaterparammanager.cpp index d81cbf832f..1697717609 100644 --- a/indra/newview/llwaterparammanager.cpp +++ b/indra/newview/llwaterparammanager.cpp @@ -39,7 +39,7 @@ #include "llsliderctrl.h" #include "llspinctrl.h" #include "llcheckboxctrl.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llviewercontrol.h" #include "llviewercamera.h" #include "llcombobox.h" @@ -227,7 +227,7 @@ void LLWaterParamManager::updateShaderUniforms(LLGLSLShader * shader) if (shader->mShaderGroup == LLGLSLShader::SG_WATER) { shader->uniform4fv(LLShaderMgr::LIGHTNORM, 1, LLWLParamManager::instance()->getRotatedLightDir().mV); - shader->uniform3fv("camPosLocal", 1, gCamera->getOrigin().mV); + shader->uniform3fv("camPosLocal", 1, LLViewerCamera::getInstance()->getOrigin().mV); shader->uniform4fv("waterFogColor", 1, LLDrawPoolWater::sWaterFogColor.mV); shader->uniform4fv("waterPlane", 1, mWaterPlane.mV); shader->uniform1f("waterFogDensity", getFogDensity()); diff --git a/indra/newview/llwaterparamset.cpp b/indra/newview/llwaterparamset.cpp index 78baae8db6..78797eecce 100644 --- a/indra/newview/llwaterparamset.cpp +++ b/indra/newview/llwaterparamset.cpp @@ -72,8 +72,6 @@ LLWaterParamSet::LLWaterParamSet(void) : wave2.append(0.58f); wave2.append(-.67f); - LLUUID normalMap = LLUUID(gViewerArt.getString("water_normal.tga")); - mParamValues.insert("waterFogColor", vec4); mParamValues.insert("waterFogDensity", 16.0f); mParamValues.insert("underWaterFogMod", 0.25f); @@ -85,7 +83,7 @@ LLWaterParamSet::LLWaterParamSet(void) : mParamValues.insert("blurMultiplier", 0.01f); mParamValues.insert("wave1Dir", wave1); mParamValues.insert("wave2Dir", wave2); - mParamValues.insert("normalMap", normalMap); + mParamValues.insert("normalMap", DEFAULT_WATER_NORMAL); } diff --git a/indra/newview/llwearablelist.cpp b/indra/newview/llwearablelist.cpp index 4e030c7abc..29021aa54c 100644 --- a/indra/newview/llwearablelist.cpp +++ b/indra/newview/llwearablelist.cpp @@ -160,10 +160,7 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID { LLFile::remove(filename); } - if( gViewerStats ) - { - gViewerStats->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); - } + LLViewerStats::getInstance()->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); llwarns << "Wearable download failed: " << LLAssetStorage::getErrorString( status ) << " " << uuid << llendl; switch( status ) diff --git a/indra/newview/llwind.cpp b/indra/newview/llwind.cpp index 96a985f694..a362f76a2c 100644 --- a/indra/newview/llwind.cpp +++ b/indra/newview/llwind.cpp @@ -237,7 +237,7 @@ LLVector3 LLWind::getVelocity(const LLVector3 &pos_region) LLVector3 pos_clamped_region(pos_region); - F32 region_width_meters = gWorldPointer->getRegionWidthInMeters(); + F32 region_width_meters = LLWorld::getInstance()->getRegionWidthInMeters(); if (pos_clamped_region.mV[VX] < 0.f) { @@ -299,7 +299,7 @@ LLVector3 LLWind::getCloudVelocity(const LLVector3 &pos_region) LLVector3 pos_clamped_region(pos_region); - F32 region_width_meters = gWorldPointer->getRegionWidthInMeters(); + F32 region_width_meters = LLWorld::getInstance()->getRegionWidthInMeters(); if (pos_clamped_region.mV[VX] < 0.f) { diff --git a/indra/newview/llwlparammanager.cpp b/indra/newview/llwlparammanager.cpp index b1c1f5e2d0..68e402abdb 100644 --- a/indra/newview/llwlparammanager.cpp +++ b/indra/newview/llwlparammanager.cpp @@ -39,7 +39,7 @@ #include "llsliderctrl.h" #include "llspinctrl.h" #include "llcheckboxctrl.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llviewercamera.h" #include "llcombobox.h" #include "lllineeditor.h" @@ -280,7 +280,7 @@ void LLWLParamManager::updateShaderUniforms(LLGLSLShader * shader) if (shader->mShaderGroup == LLGLSLShader::SG_DEFAULT) { shader->uniform4fv(LLShaderMgr::LIGHTNORM, 1, mRotatedLightDir.mV); - shader->uniform3fv("camPosLocal", 1, gCamera->getOrigin().mV); + shader->uniform3fv("camPosLocal", 1, LLViewerCamera::getInstance()->getOrigin().mV); } else if (shader->mShaderGroup == LLGLSLShader::SG_SKY) diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index 6551361739..923b45fc5a 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -61,7 +61,6 @@ // // Globals // -LLWorld* gWorldp = NULL; U32 gAgentPauseSerialNum = 0; // @@ -72,15 +71,19 @@ const S32 WORLD_PATCH_SIZE = 16; extern LLColor4U MAX_WATER_COLOR; +const U32 LLWorld::mWidth = 256; + +// meters/point, therefore mWidth * mScale = meters per edge +const F32 LLWorld::mScale = 1.f; + +const F32 LLWorld::mWidthInMeters = mWidth * mScale; + // // Functions // // allocate the stack -LLWorld::LLWorld(const U32 grids_per_region, const F32 meters_per_grid) -: mWidth(grids_per_region), - mScale(meters_per_grid), - mWidthInMeters( grids_per_region * meters_per_grid ) +LLWorld::LLWorld() { mSpaceTimeUSec = 0; mLastPacketsIn = 0; @@ -112,10 +115,11 @@ LLWorld::LLWorld(const U32 grids_per_region, const F32 meters_per_grid) } -LLWorld::~LLWorld() +void LLWorld::destroyClass() { - gObjectList.killAllObjects(); + gObjectList.destroy(); for_each(mRegionList.begin(), mRegionList.end(), DeletePointer()); + LLViewerPartSim::getInstance()->destroyClass(); } @@ -556,9 +560,9 @@ LLVector3 LLWorld::resolveLandNormalGlobal(const LLVector3d &pos_global) void LLWorld::updateVisibilities() { - F32 cur_far_clip = gCamera->getFar(); + F32 cur_far_clip = LLViewerCamera::getInstance()->getFar(); - gCamera->setFar(mLandFarClip); + LLViewerCamera::getInstance()->setFar(mLandFarClip); F32 diagonal_squared = F_SQRT2 * F_SQRT2 * mWidth * mWidth; // Go through the culled list and check for visible regions @@ -570,7 +574,7 @@ void LLWorld::updateVisibilities() F32 height = regionp->getLand().getMaxZ() - regionp->getLand().getMinZ(); F32 radius = 0.5f*fsqrtf(height * height + diagonal_squared); if (!regionp->getLand().hasZData() - || gCamera->sphereInFrustum(regionp->getCenterAgent(), radius)) + || LLViewerCamera::getInstance()->sphereInFrustum(regionp->getCenterAgent(), radius)) { mCulledRegionList.erase(curiter); mVisibleRegionList.push_back(regionp); @@ -590,7 +594,7 @@ void LLWorld::updateVisibilities() F32 height = regionp->getLand().getMaxZ() - regionp->getLand().getMinZ(); F32 radius = 0.5f*fsqrtf(height * height + diagonal_squared); - if (gCamera->sphereInFrustum(regionp->getCenterAgent(), radius)) + if (LLViewerCamera::getInstance()->sphereInFrustum(regionp->getCenterAgent(), radius)) { regionp->calculateCameraDistance(); if (!gNoRender) @@ -608,7 +612,7 @@ void LLWorld::updateVisibilities() // Sort visible regions mVisibleRegionList.sort(LLViewerRegion::CompareDistance()); - gCamera->setFar(cur_far_clip); + LLViewerCamera::getInstance()->setFar(cur_far_clip); } void LLWorld::updateRegions(F32 max_update_time) @@ -631,7 +635,7 @@ void LLWorld::updateRegions(F32 max_update_time) void LLWorld::updateParticles() { - mPartSim.updateSimulation(); + LLViewerPartSim::getInstance()->updateSimulation(); } void LLWorld::updateClouds(const F32 dt) @@ -727,19 +731,19 @@ void LLWorld::updateNetStats() S32 actual_in_bits = gMessageSystem->mPacketRing.getAndResetActualInBits(); S32 actual_out_bits = gMessageSystem->mPacketRing.getAndResetActualOutBits(); - gViewerStats->mActualInKBitStat.addValue(actual_in_bits/1024.f); - gViewerStats->mActualOutKBitStat.addValue(actual_out_bits/1024.f); - gViewerStats->mKBitStat.addValue(bits/1024.f); - gViewerStats->mPacketsInStat.addValue(packets_in); - gViewerStats->mPacketsOutStat.addValue(packets_out); - gViewerStats->mPacketsLostStat.addValue(gMessageSystem->mDroppedPackets); + LLViewerStats::getInstance()->mActualInKBitStat.addValue(actual_in_bits/1024.f); + LLViewerStats::getInstance()->mActualOutKBitStat.addValue(actual_out_bits/1024.f); + LLViewerStats::getInstance()->mKBitStat.addValue(bits/1024.f); + LLViewerStats::getInstance()->mPacketsInStat.addValue(packets_in); + LLViewerStats::getInstance()->mPacketsOutStat.addValue(packets_out); + LLViewerStats::getInstance()->mPacketsLostStat.addValue(gMessageSystem->mDroppedPackets); if (packets_in) { - gViewerStats->mPacketsLostPercentStat.addValue(100.f*((F32)packets_lost/(F32)packets_in)); + LLViewerStats::getInstance()->mPacketsLostPercentStat.addValue(100.f*((F32)packets_lost/(F32)packets_in)); } else { - gViewerStats->mPacketsLostPercentStat.addValue(0.f); + LLViewerStats::getInstance()->mPacketsLostPercentStat.addValue(0.f); } mLastPacketsIn = gMessageSystem->mPacketsIn; @@ -771,8 +775,7 @@ void LLWorld::printPacketsLost() void LLWorld::processCoarseUpdate(LLMessageSystem* msg, void** user_data) { - if(!gWorldp) return; - LLViewerRegion* region = gWorldp->getRegion(msg->getSender()); + LLViewerRegion* region = LLWorld::getInstance()->getRegion(msg->getSender()); if( region ) { region->updateCoarseLocations(msg); @@ -812,7 +815,7 @@ void LLWorld::updateWaterObjects() S32 rwidth = 256; // We only want to fill in water for stuff that's near us, say, within 256 or 512m - S32 range = gCamera->getFar() > 256.f ? 512 : 256; + S32 range = LLViewerCamera::getInstance()->getFar() > 256.f ? 512 : 256; LLViewerRegion* regionp = gAgent.getRegion(); from_region_handle(regionp->getHandle(), ®ion_x, ®ion_y); @@ -940,7 +943,7 @@ void LLWorld::shiftRegions(const LLVector3& offset) region->updateRenderMatrix(); } - mPartSim.shift(offset); + LLViewerPartSim::getInstance()->shift(offset); } LLViewerImage* LLWorld::getDefaultWaterTexture() @@ -1022,8 +1025,7 @@ void process_enable_simulator(LLMessageSystem *msg, void **user_data) // Viewer trusts the simulator. msg->enableCircuit(sim, TRUE); - if(!gWorldp) return; - gWorldp->addRegion(handle, sim); + LLWorld::getInstance()->addRegion(handle, sim); // give the simulator a message it can use to get ip and port llinfos << "simulator_enable() Enabling " << sim << " with code " << msg->getOurCircuitCode() << llendl; @@ -1060,8 +1062,7 @@ public: LLHost sim(input["body"]["sim-ip-and-port"].asString()); - if(!gWorldp) return; - LLViewerRegion* regionp = gWorldp->getRegion(sim); + LLViewerRegion* regionp = LLWorld::getInstance()->getRegion(sim); if (!regionp) { llwarns << "Got EstablishAgentCommunication for unknown region " @@ -1079,8 +1080,7 @@ void process_disable_simulator(LLMessageSystem *mesgsys, void **user_data) LLHost host = mesgsys->getSender(); //llinfos << "Disabling simulator with message from " << host << llendl; - if(!gWorldp) return; - gWorldp->removeRegion(host); + LLWorld::getInstance()->removeRegion(host); mesgsys->disableCircuit(host); } @@ -1089,8 +1089,7 @@ void process_disable_simulator(LLMessageSystem *mesgsys, void **user_data) void process_region_handshake(LLMessageSystem* msg, void** user_data) { LLHost host = msg->getSender(); - if(!gWorldp) return; - LLViewerRegion* regionp = gWorldp->getRegion(host); + LLViewerRegion* regionp = LLWorld::getInstance()->getRegion(host); if (!regionp) { llwarns << "Got region handshake for unknown region " @@ -1104,8 +1103,10 @@ void process_region_handshake(LLMessageSystem* msg, void** user_data) void send_agent_pause() { - // world not initialized yet - if (!gWorldp) + // Note: used to check for LLWorld initialization before it became a singleton. + // Rather than just remove this check I'm changing it to assure that the message + // system has been initialized. -MG + if (!gMessageSystem) { return; } @@ -1118,8 +1119,8 @@ void send_agent_pause() gAgentPauseSerialNum++; gMessageSystem->addU32Fast(_PREHASH_SerialNum, gAgentPauseSerialNum); - for (LLWorld::region_list_t::iterator iter = gWorldp->mActiveRegionList.begin(); - iter != gWorldp->mActiveRegionList.end(); ++iter) + for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->mActiveRegionList.begin(); + iter != LLWorld::getInstance()->mActiveRegionList.end(); ++iter) { LLViewerRegion* regionp = *iter; gMessageSystem->sendReliable(regionp->getHost()); @@ -1131,8 +1132,13 @@ void send_agent_pause() void send_agent_resume() { - // world not initialized yet - if (!gWorldp) return; + // Note: used to check for LLWorld initialization before it became a singleton. + // Rather than just remove this check I'm changing it to assure that the message + // system has been initialized. -MG + if (!gMessageSystem) + { + return; + } gMessageSystem->newMessageFast(_PREHASH_AgentResume); gMessageSystem->nextBlockFast(_PREHASH_AgentData); @@ -1143,15 +1149,15 @@ void send_agent_resume() gMessageSystem->addU32Fast(_PREHASH_SerialNum, gAgentPauseSerialNum); - for (LLWorld::region_list_t::iterator iter = gWorldp->mActiveRegionList.begin(); - iter != gWorldp->mActiveRegionList.end(); ++iter) + for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->mActiveRegionList.begin(); + iter != LLWorld::getInstance()->mActiveRegionList.end(); ++iter) { LLViewerRegion* regionp = *iter; gMessageSystem->sendReliable(regionp->getHost()); } // Reset the FPS counter to avoid an invalid fps - gViewerStats->mFPSStat.start(); + LLViewerStats::getInstance()->mFPSStat.start(); } diff --git a/indra/newview/llworld.h b/indra/newview/llworld.h index a3cf874cfa..cb6102268e 100644 --- a/indra/newview/llworld.h +++ b/indra/newview/llworld.h @@ -35,12 +35,12 @@ #include "llpatchvertexarray.h" #include "llmath.h" -//#include "vmath.h" #include "v3math.h" #include "llmemory.h" #include "llstring.h" #include "llviewerpartsim.h" #include "llviewerimage.h" +#include "llvowater.h" class LLViewerRegion; class LLVector3d; @@ -49,7 +49,6 @@ class LLNetMap; class LLHost; class LLViewerObject; -class LLVOWater; class LLSurfacePatch; class LLCloudPuff; @@ -60,11 +59,11 @@ class LLVOAvatar; // as simulators are connected to, viewer_regions are popped off the stack and connected as required // as simulators are removed, they are pushed back onto the stack -class LLWorld +class LLWorld : public LLSingleton<LLWorld> { public: - LLWorld(const U32 grids_per_region, const F32 meters_per_grid); - ~LLWorld(); + LLWorld(); + void destroyClass(); LLViewerRegion* addRegion(const U64 ®ion_handle, const LLHost &host); // safe to call if already present, does the "right thing" if @@ -149,7 +148,6 @@ public: typedef std::list<LLViewerRegion*> region_list_t; region_list_t mActiveRegionList; - LLViewerPartSim mPartSim; region_list_t& getRegionList() { return mActiveRegionList; } @@ -159,12 +157,12 @@ private: region_list_t mCulledRegionList; // Number of points on edge - const U32 mWidth; + static const U32 mWidth; // meters/point, therefore mWidth * mScale = meters per edge - const F32 mScale; + static const F32 mScale; - const F32 mWidthInMeters; + static const F32 mWidthInMeters; F32 mLandFarClip; // Far clip distance for land. LLPatchVertexArray mLandPatch; @@ -190,8 +188,6 @@ private: U64 mSpaceTimeUSec; }; -extern LLWorld *gWorldp; -#define gWorldPointer gWorldp void process_enable_simulator(LLMessageSystem *mesgsys, void **user_data); void process_disable_simulator(LLMessageSystem *mesgsys, void **user_data); diff --git a/indra/newview/llworldmap.cpp b/indra/newview/llworldmap.cpp index 6d0853a6dc..6c5118ed9d 100644 --- a/indra/newview/llworldmap.cpp +++ b/indra/newview/llworldmap.cpp @@ -46,8 +46,6 @@ #include "llviewerregion.h" #include "llregionflags.h" -LLWorldMap* gWorldMap = NULL; - const F32 REQUEST_ITEMS_TIMER = 10.f * 60.f; // 10 minutes LLItemInfo::LLItemInfo(F32 global_x, F32 global_y, @@ -485,7 +483,7 @@ void LLWorldMap::processMapLayerReply(LLMessageSystem* msg, void**) U32 agent_flags; msg->getU32Fast(_PREHASH_AgentData, _PREHASH_Flags, agent_flags); - if (agent_flags != (U32)gWorldMap->mCurrentMap) + if (agent_flags != (U32)LLWorldMap::getInstance()->mCurrentMap) { llwarns << "Invalid or out of date map image type returned!" << llendl; return; @@ -496,7 +494,7 @@ void LLWorldMap::processMapLayerReply(LLMessageSystem* msg, void**) S32 num_blocks = msg->getNumberOfBlocksFast(_PREHASH_LayerData); - gWorldMap->mMapLayers[agent_flags].clear(); + LLWorldMap::getInstance()->mMapLayers[agent_flags].clear(); BOOL adjust = FALSE; for (S32 block=0; block<num_blocks; ++block) @@ -521,14 +519,14 @@ void LLWorldMap::processMapLayerReply(LLMessageSystem* msg, void**) F32 x_meters = F32(left*REGION_WIDTH_UNITS); F32 y_meters = F32(bottom*REGION_WIDTH_UNITS); - adjust = gWorldMap->extendAABB(U32(x_meters), U32(y_meters), + adjust = LLWorldMap::getInstance()->extendAABB(U32(x_meters), U32(y_meters), U32(x_meters+REGION_WIDTH_UNITS*new_layer.LayerExtents.getWidth()), U32(y_meters+REGION_WIDTH_UNITS*new_layer.LayerExtents.getHeight())) || adjust; - gWorldMap->mMapLayers[agent_flags].push_back(new_layer); + LLWorldMap::getInstance()->mMapLayers[agent_flags].push_back(new_layer); } - gWorldMap->mMapLoaded[agent_flags] = TRUE; + LLWorldMap::getInstance()->mMapLoaded[agent_flags] = TRUE; if(adjust) gFloaterWorldMap->adjustZoomSliderBounds(); } @@ -576,21 +574,21 @@ void LLWorldMap::processMapBlockReply(LLMessageSystem* msg, void**) if (access == 255) { // This region doesn't exist - if (gWorldMap->mIsTrackingUnknownLocation && - gWorldMap->mUnknownLocation.mdV[0] >= x_meters && - gWorldMap->mUnknownLocation.mdV[0] < x_meters + 256 && - gWorldMap->mUnknownLocation.mdV[1] >= y_meters && - gWorldMap->mUnknownLocation.mdV[1] < y_meters + 256) + if (LLWorldMap::getInstance()->mIsTrackingUnknownLocation && + LLWorldMap::getInstance()->mUnknownLocation.mdV[0] >= x_meters && + LLWorldMap::getInstance()->mUnknownLocation.mdV[0] < x_meters + 256 && + LLWorldMap::getInstance()->mUnknownLocation.mdV[1] >= y_meters && + LLWorldMap::getInstance()->mUnknownLocation.mdV[1] < y_meters + 256) { // We were tracking this location, but it doesn't exist - gWorldMap->mInvalidLocation = TRUE; + LLWorldMap::getInstance()->mInvalidLocation = TRUE; } found_null_sim = true; } else { - adjust = gWorldMap->extendAABB(x_meters, + adjust = LLWorldMap::getInstance()->extendAABB(x_meters, y_meters, x_meters+REGION_WIDTH_UNITS, y_meters+REGION_WIDTH_UNITS) || adjust; @@ -598,8 +596,8 @@ void LLWorldMap::processMapBlockReply(LLMessageSystem* msg, void**) // llinfos << "Map sim " << name << " image layer " << agent_flags << " ID " << image_id.getString() << llendl; LLSimInfo* siminfo = new LLSimInfo(); - sim_info_map_t::iterator iter = gWorldMap->mSimInfoMap.find(handle); - if (iter != gWorldMap->mSimInfoMap.end()) + sim_info_map_t::iterator iter = LLWorldMap::getInstance()->mSimInfoMap.find(handle); + if (iter != LLWorldMap::getInstance()->mSimInfoMap.end()) { LLSimInfo* oldinfo = iter->second; for (S32 image=0; image<MAP_SIM_IMAGE_TYPES; ++image) @@ -608,7 +606,7 @@ void LLWorldMap::processMapBlockReply(LLMessageSystem* msg, void**) } delete oldinfo; } - gWorldMap->mSimInfoMap[handle] = siminfo; + LLWorldMap::getInstance()->mSimInfoMap[handle] = siminfo; siminfo->mHandle = handle; siminfo->mName.assign( name ); @@ -616,7 +614,7 @@ void LLWorldMap::processMapBlockReply(LLMessageSystem* msg, void**) siminfo->mRegionFlags = region_flags; siminfo->mWaterHeight = (F32) water_height; siminfo->mMapImageID[agent_flags] = image_id; - siminfo->mCurrentImage = gImageList.getImage(siminfo->mMapImageID[gWorldMap->mCurrentMap], MIPMAP_TRUE, FALSE); + siminfo->mCurrentImage = gImageList.getImage(siminfo->mMapImageID[LLWorldMap::getInstance()->mCurrentMap], MIPMAP_TRUE, FALSE); siminfo->mCurrentImage->bindTexture(0); siminfo->mCurrentImage->setClamp(TRUE, TRUE); @@ -629,22 +627,22 @@ void LLWorldMap::processMapBlockReply(LLMessageSystem* msg, void**) siminfo->mOverlayImage = NULL; } - if (gWorldMap->mIsTrackingUnknownLocation && - gWorldMap->mUnknownLocation.mdV[0] >= x_meters && - gWorldMap->mUnknownLocation.mdV[0] < x_meters + 256 && - gWorldMap->mUnknownLocation.mdV[1] >= y_meters && - gWorldMap->mUnknownLocation.mdV[1] < y_meters + 256) + if (LLWorldMap::getInstance()->mIsTrackingUnknownLocation && + LLWorldMap::getInstance()->mUnknownLocation.mdV[0] >= x_meters && + LLWorldMap::getInstance()->mUnknownLocation.mdV[0] < x_meters + 256 && + LLWorldMap::getInstance()->mUnknownLocation.mdV[1] >= y_meters && + LLWorldMap::getInstance()->mUnknownLocation.mdV[1] < y_meters + 256) { if (siminfo->mAccess == SIM_ACCESS_DOWN) { // We were tracking this location, but it doesn't exist - gWorldMap->mInvalidLocation = true; + LLWorldMap::getInstance()->mInvalidLocation = true; } else { // We were tracking this location, and it does exist - bool is_tracking_dbl = gWorldMap->mIsTrackingDoubleClick == TRUE; - gFloaterWorldMap->trackLocation(gWorldMap->mUnknownLocation); + bool is_tracking_dbl = LLWorldMap::getInstance()->mIsTrackingDoubleClick == TRUE; + gFloaterWorldMap->trackLocation(LLWorldMap::getInstance()->mUnknownLocation); if (is_tracking_dbl) { LLVector3d pos_global = LLTracker::getTrackedPositionGlobal(); @@ -654,19 +652,19 @@ void LLWorldMap::processMapBlockReply(LLMessageSystem* msg, void**) } } - if(gWorldMap->mSLURLCallback != NULL) + if(LLWorldMap::getInstance()->mSLURLCallback != NULL) { // Server returns definitive capitalization, SLURL might // not have that. - if (!stricmp(gWorldMap->mSLURLRegionName.c_str(), name) || (gWorldMap->mSLURLRegionHandle == handle)) + if (!stricmp(LLWorldMap::getInstance()->mSLURLRegionName.c_str(), name) || (LLWorldMap::getInstance()->mSLURLRegionHandle == handle)) { - url_callback_t callback = gWorldMap->mSLURLCallback; + url_callback_t callback = LLWorldMap::getInstance()->mSLURLCallback; - gWorldMap->mSLURLCallback = NULL; - gWorldMap->mSLURLRegionName.clear(); - gWorldMap->mSLURLRegionHandle = 0; + LLWorldMap::getInstance()->mSLURLCallback = NULL; + LLWorldMap::getInstance()->mSLURLRegionName.clear(); + LLWorldMap::getInstance()->mSLURLRegionHandle = 0; - callback(handle, gWorldMap->mSLURL, image_id, gWorldMap->mSLURLTeleport); + callback(handle, LLWorldMap::getInstance()->mSLURL, image_id, LLWorldMap::getInstance()->mSLURLTeleport); } } } @@ -702,7 +700,7 @@ void LLWorldMap::processMapItemReply(LLMessageSystem* msg, void**) Y /= REGION_WIDTH_UNITS; LLItemInfo new_item(world_x, world_y, name, uuid, extra, extra2); - LLSimInfo* siminfo = gWorldMap->simInfoFromHandle(new_item.mRegionHandle); + LLSimInfo* siminfo = LLWorldMap::getInstance()->simInfoFromHandle(new_item.mRegionHandle); switch (type) { @@ -724,11 +722,11 @@ void LLWorldMap::processMapItemReply(LLMessageSystem* msg, void**) // extra2 specifies whether this is an infohub or a telehub. if (extra2) { - gWorldMap->mInfohubs.push_back(new_item); + LLWorldMap::getInstance()->mInfohubs.push_back(new_item); } else { - gWorldMap->mTelehubs.push_back(new_item); + LLWorldMap::getInstance()->mTelehubs.push_back(new_item); } break; @@ -755,31 +753,31 @@ void LLWorldMap::processMapItemReply(LLMessageSystem* msg, void**) new_item.mPosGlobal.mdV[VZ] = (F64)extra2; if (type == MAP_ITEM_PG_EVENT) { - gWorldMap->mPGEvents.push_back(new_item); + LLWorldMap::getInstance()->mPGEvents.push_back(new_item); } else { - gWorldMap->mMatureEvents.push_back(new_item); + LLWorldMap::getInstance()->mMatureEvents.push_back(new_item); } break; } case MAP_ITEM_POPULAR: // popular { new_item.mPosGlobal.mdV[VZ] = (F64)extra2; - gWorldMap->mPopular.push_back(new_item); + LLWorldMap::getInstance()->mPopular.push_back(new_item); break; } case MAP_ITEM_LAND_FOR_SALE: // land for sale { new_item.mToolTip = llformat("%d sq. m. L$%d", new_item.mExtra, new_item.mExtra2); - gWorldMap->mLandForSale.push_back(new_item); + LLWorldMap::getInstance()->mLandForSale.push_back(new_item); break; } case MAP_ITEM_CLASSIFIED: // classifieds { // HACK: Z-height is in Extra2 field. new_item.mPosGlobal.mdV[VZ] = (F64)extra2; - gWorldMap->mClassifieds.push_back(new_item); + LLWorldMap::getInstance()->mClassifieds.push_back(new_item); break; } case MAP_ITEM_AGENT_LOCATIONS: // agent locations @@ -791,7 +789,7 @@ void LLWorldMap::processMapItemReply(LLMessageSystem* msg, void**) } // llinfos << "New Location " << new_item.mName << llendl; - item_info_list_t& agentcounts = gWorldMap->mAgentLocationsMap[new_item.mRegionHandle]; + item_info_list_t& agentcounts = LLWorldMap::getInstance()->mAgentLocationsMap[new_item.mRegionHandle]; // Find the last item in the list with a different name and erase them item_info_list_t::iterator lastiter; diff --git a/indra/newview/llworldmap.h b/indra/newview/llworldmap.h index 3c9dc781fa..6b01946bdb 100644 --- a/indra/newview/llworldmap.h +++ b/indra/newview/llworldmap.h @@ -110,7 +110,7 @@ struct LLWorldMapLayer }; -class LLWorldMap +class LLWorldMap : public LLSingleton<LLWorldMap> { public: typedef void(*url_callback_t)(U64 region_handle, const std::string& url, const LLUUID& snapshot_id, bool teleport); @@ -227,6 +227,4 @@ private: bool mSLURLTeleport; }; -extern LLWorldMap* gWorldMap; - #endif diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp index 1664515f58..124e865637 100644 --- a/indra/newview/llworldmapview.cpp +++ b/indra/newview/llworldmapview.cpp @@ -59,7 +59,6 @@ #include "llviewerparceloverlay.h" #include "llviewerregion.h" #include "llviewerwindow.h" -#include "llworld.h" #include "llworldmap.h" #include "llappviewer.h" // Only for constants! @@ -70,24 +69,24 @@ const S32 SCROLL_HINT_WIDTH = 65; const F32 BIG_DOT_RADIUS = 5.f; BOOL LLWorldMapView::sHandledLastClick = FALSE; -LLPointer<LLViewerImage> LLWorldMapView::sAvatarYouSmallImage = NULL; -LLPointer<LLViewerImage> LLWorldMapView::sAvatarSmallImage = NULL; -LLPointer<LLViewerImage> LLWorldMapView::sAvatarLargeImage = NULL; -LLPointer<LLViewerImage> LLWorldMapView::sAvatarAboveImage = NULL; -LLPointer<LLViewerImage> LLWorldMapView::sAvatarBelowImage = NULL; +LLUIImagePtr LLWorldMapView::sAvatarYouSmallImage = NULL; +LLUIImagePtr LLWorldMapView::sAvatarSmallImage = NULL; +LLUIImagePtr LLWorldMapView::sAvatarLargeImage = NULL; +LLUIImagePtr LLWorldMapView::sAvatarAboveImage = NULL; +LLUIImagePtr LLWorldMapView::sAvatarBelowImage = NULL; -LLPointer<LLViewerImage> LLWorldMapView::sTelehubImage = NULL; -LLPointer<LLViewerImage> LLWorldMapView::sInfohubImage = NULL; -LLPointer<LLViewerImage> LLWorldMapView::sHomeImage = NULL; -LLPointer<LLViewerImage> LLWorldMapView::sEventImage = NULL; -LLPointer<LLViewerImage> LLWorldMapView::sEventMatureImage = NULL; +LLUIImagePtr LLWorldMapView::sTelehubImage = NULL; +LLUIImagePtr LLWorldMapView::sInfohubImage = NULL; +LLUIImagePtr LLWorldMapView::sHomeImage = NULL; +LLUIImagePtr LLWorldMapView::sEventImage = NULL; +LLUIImagePtr LLWorldMapView::sEventMatureImage = NULL; -LLPointer<LLViewerImage> LLWorldMapView::sTrackCircleImage = NULL; -LLPointer<LLViewerImage> LLWorldMapView::sTrackArrowImage = NULL; +LLUIImagePtr LLWorldMapView::sTrackCircleImage = NULL; +LLUIImagePtr LLWorldMapView::sTrackArrowImage = NULL; -LLPointer<LLViewerImage> LLWorldMapView::sClassifiedsImage = NULL; -LLPointer<LLViewerImage> LLWorldMapView::sPopularImage = NULL; -LLPointer<LLViewerImage> LLWorldMapView::sForSaleImage = NULL; +LLUIImagePtr LLWorldMapView::sClassifiedsImage = NULL; +LLUIImagePtr LLWorldMapView::sPopularImage = NULL; +LLUIImagePtr LLWorldMapView::sForSaleImage = NULL; F32 LLWorldMapView::sThresholdA = 48.f; F32 LLWorldMapView::sThresholdB = 96.f; @@ -114,53 +113,21 @@ void LLWorldMapView::initClass() { LLUUID image_id; - image_id.set( gViewerArt.getString("map_avatar_you_8.tga") ); - sAvatarYouSmallImage = gImageList.getImage( image_id, MIPMAP_FALSE, TRUE); - - image_id.set( gViewerArt.getString("map_avatar_8.tga") ); - sAvatarSmallImage = gImageList.getImage( image_id, MIPMAP_FALSE, TRUE); - - image_id.set( gViewerArt.getString("map_avatar_16.tga") ); - sAvatarLargeImage = gImageList.getImage( image_id, MIPMAP_FALSE, TRUE); - - image_id.set( gViewerArt.getString("map_avatar_above_8.tga") ); - sAvatarAboveImage = gImageList.getImage( image_id, MIPMAP_FALSE, TRUE); - - image_id.set( gViewerArt.getString("map_avatar_below_8.tga") ); - sAvatarBelowImage = gImageList.getImage( image_id, MIPMAP_FALSE, TRUE); - - image_id.set( gViewerArt.getString("map_home.tga") ); - sHomeImage = gImageList.getImage(image_id, MIPMAP_FALSE, TRUE); - - image_id.set( gViewerArt.getString("map_telehub.tga") ); - sTelehubImage = gImageList.getImage(image_id, MIPMAP_FALSE, TRUE); - - image_id.set( gViewerArt.getString("map_infohub.tga") ); - sInfohubImage = gImageList.getImage(image_id, MIPMAP_FALSE, TRUE); - - image_id.set( gViewerArt.getString("map_event.tga") ); - sEventImage = gImageList.getImage(image_id, MIPMAP_FALSE, TRUE); - - image_id.set( gViewerArt.getString("map_event_mature.tga") ); - sEventMatureImage = gImageList.getImage(image_id, MIPMAP_FALSE, TRUE); - - image_id.set( gViewerArt.getString("map_track_16.tga") ); - sTrackCircleImage = gImageList.getImage(image_id, MIPMAP_FALSE, TRUE); - - image_id.set( gViewerArt.getString("direction_arrow.tga") ); - sTrackArrowImage = gImageList.getImage(image_id, MIPMAP_FALSE, TRUE); - // Make sure tracker arrow doesn't wrap - sTrackArrowImage->bindTexture(0); - sTrackArrowImage->setClamp(TRUE, TRUE); - - image_id.set( gViewerArt.getString("icon_top_pick.tga") ); - sClassifiedsImage = gImageList.getImage(image_id, MIPMAP_FALSE, TRUE); - - image_id.set( gViewerArt.getString("icon_popular.tga") ); - sPopularImage = gImageList.getImage(image_id, MIPMAP_FALSE, TRUE); - - image_id.set( gViewerArt.getString("icon_for_sale.tga") ); - sForSaleImage = gImageList.getImage(image_id, MIPMAP_FALSE, TRUE); + sAvatarYouSmallImage = LLUI::getUIImage("map_avatar_you_8.tga"); + sAvatarSmallImage = LLUI::getUIImage("map_avatar_8.tga"); + sAvatarLargeImage = LLUI::getUIImage("map_avatar_16.tga"); + sAvatarAboveImage = LLUI::getUIImage("map_avatar_above_8.tga"); + sAvatarBelowImage = LLUI::getUIImage("map_avatar_below_8.tga"); + sHomeImage = LLUI::getUIImage("map_home.tga"); + sTelehubImage = LLUI::getUIImage("map_telehub.tga"); + sInfohubImage = LLUI::getUIImage("map_infohub.tga"); + sEventImage = LLUI::getUIImage("map_event.tga"); + sEventMatureImage = LLUI::getUIImage("map_event_mature.tga"); + sTrackCircleImage = LLUI::getUIImage("map_track_16.tga"); + sTrackArrowImage = LLUI::getUIImage("direction_arrow.tga"); + sClassifiedsImage = LLUI::getUIImage("icon_top_pick.tga"); + sPopularImage = LLUI::getUIImage("icon_popular.tga"); + sForSaleImage = LLUI::getUIImage("icon_for_sale.tga"); } // static @@ -312,11 +279,6 @@ BOOL is_agent_in_region(LLViewerRegion* region, LLSimInfo* info) void LLWorldMapView::draw() { - if (!getVisible() || !gWorldPointer) - { - return; - } - LLTextureView::clearDebugImages(); F64 current_time = LLTimer::getElapsedSeconds(); @@ -356,13 +318,13 @@ void LLWorldMapView::draw() F32 layer_alpha = 1.f; // Draw one image per layer - for (U32 layer_idx=0; layer_idx<gWorldMap->mMapLayers[gWorldMap->mCurrentMap].size(); ++layer_idx) + for (U32 layer_idx=0; layer_idx<LLWorldMap::getInstance()->mMapLayers[LLWorldMap::getInstance()->mCurrentMap].size(); ++layer_idx) { - if (!gWorldMap->mMapLayers[gWorldMap->mCurrentMap][layer_idx].LayerDefined) + if (!LLWorldMap::getInstance()->mMapLayers[LLWorldMap::getInstance()->mCurrentMap][layer_idx].LayerDefined) { continue; } - LLWorldMapLayer *layer = &gWorldMap->mMapLayers[gWorldMap->mCurrentMap][layer_idx]; + LLWorldMapLayer *layer = &LLWorldMap::getInstance()->mMapLayers[LLWorldMap::getInstance()->mCurrentMap][layer_idx]; LLViewerImage *current_image = layer->LayerImage; #if 1 || LL_RELEASE_FOR_DOWNLOAD if (current_image->isMissingAsset()) @@ -400,7 +362,7 @@ void LLWorldMapView::draw() } current_image->setBoostLevel(LLViewerImage::BOOST_MAP_LAYER); - current_image->setKnownDrawSize(llround(pix_width), llround(pix_height)); + current_image->setKnownDrawSize(llround(pix_width * LLUI::sGLScaleFactor.mV[VX]), llround(pix_height * LLUI::sGLScaleFactor.mV[VY])); if (!current_image->getHasGLTexture()) { @@ -455,15 +417,15 @@ void LLWorldMapView::draw() F32 sim_alpha = 1.f; // Draw one image per region, centered on the camera position. - for (LLWorldMap::sim_info_map_t::iterator it = gWorldMap->mSimInfoMap.begin(); - it != gWorldMap->mSimInfoMap.end(); ++it) + for (LLWorldMap::sim_info_map_t::iterator it = LLWorldMap::getInstance()->mSimInfoMap.begin(); + it != LLWorldMap::getInstance()->mSimInfoMap.end(); ++it) { U64 handle = (*it).first; LLSimInfo* info = (*it).second; if (info->mCurrentImage.isNull()) { - info->mCurrentImage = gImageList.getImage(info->mMapImageID[gWorldMap->mCurrentMap], MIPMAP_TRUE, FALSE); + info->mCurrentImage = gImageList.getImage(info->mMapImageID[LLWorldMap::getInstance()->mCurrentMap], MIPMAP_TRUE, FALSE); } if (info->mOverlayImage.isNull() && info->mMapImageID[2].notNull()) { @@ -544,7 +506,7 @@ void LLWorldMapView::draw() // See if the agents need updating if (current_time - info->mAgentsUpdateTime > AGENTS_UPDATE_TIME) { - gWorldMap->sendItemRequest(MAP_ITEM_AGENT_LOCATIONS, info->mHandle); + LLWorldMap::getInstance()->sendItemRequest(MAP_ITEM_AGENT_LOCATIONS, info->mHandle); info->mAgentsUpdateTime = current_time; } @@ -555,12 +517,12 @@ void LLWorldMapView::draw() S32 draw_size = llround(gMapScale); simimage->setBoostLevel(LLViewerImage::BOOST_MAP); - simimage->setKnownDrawSize(draw_size, draw_size); + simimage->setKnownDrawSize(llround(draw_size * LLUI::sGLScaleFactor.mV[VX]), llround(draw_size * LLUI::sGLScaleFactor.mV[VY])); if (overlayimage) { overlayimage->setBoostLevel(LLViewerImage::BOOST_MAP); - overlayimage->setKnownDrawSize(draw_size, draw_size); + overlayimage->setKnownDrawSize(llround(draw_size * LLUI::sGLScaleFactor.mV[VX]), llround(draw_size * LLUI::sGLScaleFactor.mV[VY])); } // LLTextureView::addDebugImage(simimage); @@ -717,13 +679,13 @@ void LLWorldMapView::draw() // Infohubs if (gSavedSettings.getBOOL("MapShowInfohubs")) //(gMapScale >= sThresholdB) { - drawGenericItems(gWorldMap->mInfohubs, sInfohubImage); + drawGenericItems(LLWorldMap::getInstance()->mInfohubs, sInfohubImage); } // Telehubs if (gSavedSettings.getBOOL("MapShowTelehubs")) //(gMapScale >= sThresholdB) { - drawGenericItems(gWorldMap->mTelehubs, sTelehubImage); + drawGenericItems(LLWorldMap::getInstance()->mTelehubs, sTelehubImage); } // Home Sweet Home @@ -735,17 +697,17 @@ void LLWorldMapView::draw() if (gSavedSettings.getBOOL("MapShowLandForSale")) { - drawGenericItems(gWorldMap->mLandForSale, sForSaleImage); + drawGenericItems(LLWorldMap::getInstance()->mLandForSale, sForSaleImage); } if (gSavedSettings.getBOOL("MapShowClassifieds")) { - drawGenericItems(gWorldMap->mClassifieds, sClassifiedsImage); + drawGenericItems(LLWorldMap::getInstance()->mClassifieds, sClassifiedsImage); } if (gSavedSettings.getBOOL("MapShowPopular")) { - drawGenericItems(gWorldMap->mPopular, sPopularImage); + drawGenericItems(LLWorldMap::getInstance()->mPopular, sPopularImage); } if (gSavedSettings.getBOOL("MapShowEvents")) @@ -795,20 +757,20 @@ void LLWorldMapView::draw() drawTracking( pos_global, gTrackColor, TRUE, LLTracker::getLabel(), LLTracker::getToolTip() ); } } - else if (gWorldMap->mIsTrackingUnknownLocation) + else if (LLWorldMap::getInstance()->mIsTrackingUnknownLocation) { - if (gWorldMap->mInvalidLocation) + if (LLWorldMap::getInstance()->mInvalidLocation) { // We know this location to be invalid LLColor4 loading_color(0.0, 0.5, 1.0, 1.0); - drawTracking( gWorldMap->mUnknownLocation, loading_color, TRUE, "Invalid Location", ""); + drawTracking( LLWorldMap::getInstance()->mUnknownLocation, loading_color, TRUE, "Invalid Location", ""); } else { double value = fmod(current_time, 2); value = 0.5 + 0.5*cos(value * 3.14159f); LLColor4 loading_color(0.0, F32(value/2), F32(value), 1.0); - drawTracking( gWorldMap->mUnknownLocation, loading_color, TRUE, "Loading...", ""); + drawTracking( LLWorldMap::getInstance()->mUnknownLocation, loading_color, TRUE, "Loading...", ""); } } #endif @@ -828,21 +790,21 @@ void LLWorldMapView::draw() void LLWorldMapView::setVisible(BOOL visible) { LLPanel::setVisible(visible); - if (!visible && gWorldMap) + if (!visible) { for (S32 map = 0; map < MAP_SIM_IMAGE_TYPES; map++) { - for (U32 layer_idx=0; layer_idx<gWorldMap->mMapLayers[map].size(); ++layer_idx) + for (U32 layer_idx=0; layer_idx<LLWorldMap::getInstance()->mMapLayers[map].size(); ++layer_idx) { - if (gWorldMap->mMapLayers[map][layer_idx].LayerDefined) + if (LLWorldMap::getInstance()->mMapLayers[map][layer_idx].LayerDefined) { - LLWorldMapLayer *layer = &gWorldMap->mMapLayers[map][layer_idx]; + LLWorldMapLayer *layer = &LLWorldMap::getInstance()->mMapLayers[map][layer_idx]; layer->LayerImage->setBoostLevel(0); } } } - for (LLWorldMap::sim_info_map_t::iterator it = gWorldMap->mSimInfoMap.begin(); - it != gWorldMap->mSimInfoMap.end(); ++it) + for (LLWorldMap::sim_info_map_t::iterator it = LLWorldMap::getInstance()->mSimInfoMap.begin(); + it != LLWorldMap::getInstance()->mSimInfoMap.end(); ++it) { LLSimInfo* info = (*it).second; if (info->mCurrentImage.notNull()) @@ -857,7 +819,7 @@ void LLWorldMapView::setVisible(BOOL visible) } } -void LLWorldMapView::drawGenericItems(const LLWorldMap::item_info_list_t& items, LLPointer<LLViewerImage> image) +void LLWorldMapView::drawGenericItems(const LLWorldMap::item_info_list_t& items, LLUIImagePtr image) { LLWorldMap::item_info_list_t::const_iterator e; for (e = items.begin(); e != items.end(); ++e) @@ -866,30 +828,28 @@ void LLWorldMapView::drawGenericItems(const LLWorldMap::item_info_list_t& items, } } -void LLWorldMapView::drawGenericItem(const LLItemInfo& item, LLPointer<LLViewerImage> image) +void LLWorldMapView::drawGenericItem(const LLItemInfo& item, LLUIImagePtr image) { drawImage(item.mPosGlobal, image); } -void LLWorldMapView::drawImage(const LLVector3d& global_pos, LLPointer<LLViewerImage> image, const LLColor4& color) +void LLWorldMapView::drawImage(const LLVector3d& global_pos, LLUIImagePtr image, const LLColor4& color) { LLVector3 pos_map = globalPosToView( global_pos ); - gl_draw_image(llround(pos_map.mV[VX] - image->getWidth() /2.f), - llround(pos_map.mV[VY] - image->getHeight()/2.f), - image, - color); + image->draw(llround(pos_map.mV[VX] - image->getWidth() /2.f), + llround(pos_map.mV[VY] - image->getHeight()/2.f), + color); } -void LLWorldMapView::drawImageStack(const LLVector3d& global_pos, LLPointer<LLViewerImage> image, U32 count, F32 offset, const LLColor4& color) +void LLWorldMapView::drawImageStack(const LLVector3d& global_pos, LLUIImagePtr image, U32 count, F32 offset, const LLColor4& color) { LLVector3 pos_map = globalPosToView( global_pos ); for(U32 i=0; i<count; i++) { - gl_draw_image(llround(pos_map.mV[VX] - image->getWidth() /2.f), - llround(pos_map.mV[VY] - image->getHeight()/2.f + i*offset), - image, - color); + image->draw(llround(pos_map.mV[VX] - image->getWidth() /2.f), + llround(pos_map.mV[VY] - image->getHeight()/2.f + i*offset), + color); } } @@ -901,13 +861,13 @@ void LLWorldMapView::drawAgents() for (handle_list_t::iterator iter = mVisibleRegions.begin(); iter != mVisibleRegions.end(); ++iter) { U64 handle = *iter; - LLSimInfo* siminfo = gWorldMap->simInfoFromHandle(handle); + LLSimInfo* siminfo = LLWorldMap::getInstance()->simInfoFromHandle(handle); if (siminfo && (siminfo->mAccess == SIM_ACCESS_DOWN)) { continue; } - LLWorldMap::agent_list_map_t::iterator counts_iter = gWorldMap->mAgentLocationsMap.find(handle); - if (siminfo && siminfo->mShowAgentLocations && counts_iter != gWorldMap->mAgentLocationsMap.end()) + LLWorldMap::agent_list_map_t::iterator counts_iter = LLWorldMap::getInstance()->mAgentLocationsMap.find(handle); + if (siminfo && siminfo->mShowAgentLocations && counts_iter != LLWorldMap::getInstance()->mAgentLocationsMap.end()) { // Show Individual agents (or little stacks where real agents are) LLWorldMap::item_info_list_t& agentcounts = counts_iter->second; @@ -922,12 +882,12 @@ void LLWorldMapView::drawAgents() //LLColor4 color = (agent_count == 1 && is_agent_friend(info.mID)) ? gFriendMapColor : gAvatarMapColor; drawImageStack(info.mPosGlobal, sAvatarSmallImage, agent_count, 3.f, gAvatarMapColor); } - gWorldMap->mNumAgents[handle] = sim_agent_count; // override mNumAgents for this sim + LLWorldMap::getInstance()->mNumAgents[handle] = sim_agent_count; // override mNumAgents for this sim } else { // Show agent 'stack' at center of sim - S32 num_agents = gWorldMap->mNumAgents[handle]; + S32 num_agents = LLWorldMap::getInstance()->mNumAgents[handle]; if (num_agents > 0) { LLVector3d region_center = from_region_handle(handle); @@ -948,7 +908,7 @@ void LLWorldMapView::drawEvents() // First the non-selected events LLWorldMap::item_info_list_t::const_iterator e; - for (e = gWorldMap->mPGEvents.begin(); e != gWorldMap->mPGEvents.end(); ++e) + for (e = LLWorldMap::getInstance()->mPGEvents.begin(); e != LLWorldMap::getInstance()->mPGEvents.end(); ++e) { if (!e->mSelected) { @@ -957,7 +917,7 @@ void LLWorldMapView::drawEvents() } if (show_mature) { - for (e = gWorldMap->mMatureEvents.begin(); e != gWorldMap->mMatureEvents.end(); ++e) + for (e = LLWorldMap::getInstance()->mMatureEvents.begin(); e != LLWorldMap::getInstance()->mMatureEvents.end(); ++e) { if (!e->mSelected) { @@ -967,7 +927,7 @@ void LLWorldMapView::drawEvents() } // Then the selected events - for (e = gWorldMap->mPGEvents.begin(); e != gWorldMap->mPGEvents.end(); ++e) + for (e = LLWorldMap::getInstance()->mPGEvents.begin(); e != LLWorldMap::getInstance()->mPGEvents.end(); ++e) { if (e->mSelected) { @@ -976,7 +936,7 @@ void LLWorldMapView::drawEvents() } if (show_mature) { - for (e = gWorldMap->mMatureEvents.begin(); e != gWorldMap->mMatureEvents.end(); ++e) + for (e = LLWorldMap::getInstance()->mMatureEvents.begin(); e != LLWorldMap::getInstance()->mMatureEvents.end(); ++e) { if (e->mSelected) { @@ -992,8 +952,8 @@ void LLWorldMapView::drawFrustum() // Draw frustum F32 meters_to_pixels = gMapScale/ REGION_WIDTH_METERS; - F32 horiz_fov = gCamera->getView() * gCamera->getAspect(); - F32 far_clip_meters = gCamera->getFar(); + F32 horiz_fov = LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect(); + F32 far_clip_meters = LLViewerCamera::getInstance()->getFar(); F32 far_clip_pixels = far_clip_meters * meters_to_pixels; F32 half_width_meters = far_clip_meters * tan( horiz_fov / 2 ); @@ -1007,7 +967,7 @@ void LLWorldMapView::drawFrustum() // Since we don't rotate the map, we have to rotate the frustum. gGL.pushMatrix(); gGL.translatef( ctr_x, ctr_y, 0 ); - glRotatef( atan2( gCamera->getAtAxis().mV[VX], gCamera->getAtAxis().mV[VY] ) * RAD_TO_DEG, 0.f, 0.f, -1.f); + glRotatef( atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] ) * RAD_TO_DEG, 0.f, 0.f, -1.f); // Draw triangle with more alpha in far pixels to make it // fade out in distance. @@ -1138,7 +1098,7 @@ BOOL LLWorldMapView::handleToolTip( S32 x, S32 y, LLString& msg, LLRect* sticky_ { LLVector3d pos_global = viewPosToGlobal(x, y); - LLSimInfo* info = gWorldMap->simInfoFromPosGlobal(pos_global); + LLSimInfo* info = LLWorldMap::getInstance()->simInfoFromPosGlobal(pos_global); if (info) { LLViewerRegion *region = gAgent.getRegion(); @@ -1150,7 +1110,7 @@ BOOL LLWorldMapView::handleToolTip( S32 x, S32 y, LLString& msg, LLRect* sticky_ if (info->mAccess != SIM_ACCESS_DOWN) { - S32 agent_count = gWorldMap->mNumAgents[info->mHandle]; + S32 agent_count = LLWorldMap::getInstance()->mNumAgents[info->mHandle]; if (region && region->getHandle() == info->mHandle) { ++agent_count; // Bump by 1 if we're here @@ -1199,15 +1159,14 @@ static void drawDot(F32 x_pixels, F32 y_pixels, const LLColor4& color, F32 relative_z, F32 dot_radius, - LLPointer<LLViewerImage> dot_image) + LLUIImagePtr dot_image) { const F32 HEIGHT_THRESHOLD = 7.f; if(-HEIGHT_THRESHOLD <= relative_z && relative_z <= HEIGHT_THRESHOLD) { - gl_draw_image( llround(x_pixels) - dot_image->getWidth()/2, + dot_image->draw(llround(x_pixels) - dot_image->getWidth()/2, llround(y_pixels) - dot_image->getHeight()/2, - dot_image, color); } else @@ -1241,7 +1200,7 @@ void LLWorldMapView::drawAvatar(F32 x_pixels, F32 dot_radius) { const F32 HEIGHT_THRESHOLD = 7.f; - LLViewerImage* dot_image = sAvatarSmallImage; + LLUIImagePtr dot_image = sAvatarSmallImage; if(relative_z < -HEIGHT_THRESHOLD) { dot_image = sAvatarBelowImage; @@ -1250,10 +1209,10 @@ void LLWorldMapView::drawAvatar(F32 x_pixels, { dot_image = sAvatarAboveImage; } - gl_draw_image( + dot_image->draw( llround(x_pixels) - dot_image->getWidth()/2, llround(y_pixels) - dot_image->getHeight()/2, - dot_image, color); + color); } // Pass relative Z of 0 to draw at same level. @@ -1447,7 +1406,7 @@ void LLWorldMapView::drawTrackingArrow(const LLRect& rect, S32 x, S32 y, sTrackingArrowY, arrow_size, arrow_size, RAD_TO_DEG * angle, - sTrackArrowImage, + sTrackArrowImage->getImage(), color); } @@ -1521,7 +1480,7 @@ bool LLWorldMapView::checkItemHit(S32 x, S32 y, LLItemInfo& item, LLUUID* id, bo if (y < item_y - BIG_DOT_RADIUS) return false; if (y > item_y + BIG_DOT_RADIUS) return false; - LLSimInfo* sim_info = gWorldMap->simInfoFromHandle(item.mRegionHandle); + LLSimInfo* sim_info = LLWorldMap::getInstance()->simInfoFromHandle(item.mRegionHandle); if (sim_info) { if (track) @@ -1551,7 +1510,7 @@ void LLWorldMapView::handleClick(S32 x, S32 y, MASK mask, // *HACK: Adjust Z values automatically for liaisons & gods so // we swoop down when they click on the map. Sadly, the P2P // branch does not pay attention to this value; however, the - // Distributed Messaging branch honors kt. + // Distributed Messaging branch honors it. if(gAgent.isGodlike()) { pos_global.mdV[VZ] = 200.0; @@ -1559,30 +1518,30 @@ void LLWorldMapView::handleClick(S32 x, S32 y, MASK mask, *hit_type = 0; // hit nothing - gWorldMap->mIsTrackingUnknownLocation = FALSE; - gWorldMap->mIsTrackingDoubleClick = FALSE; - gWorldMap->mIsTrackingCommit = FALSE; + LLWorldMap::getInstance()->mIsTrackingUnknownLocation = FALSE; + LLWorldMap::getInstance()->mIsTrackingDoubleClick = FALSE; + LLWorldMap::getInstance()->mIsTrackingCommit = FALSE; LLWorldMap::item_info_list_t::iterator it; // clear old selected stuff - for (it = gWorldMap->mPGEvents.begin(); it != gWorldMap->mPGEvents.end(); ++it) + for (it = LLWorldMap::getInstance()->mPGEvents.begin(); it != LLWorldMap::getInstance()->mPGEvents.end(); ++it) { (*it).mSelected = FALSE; } - for (it = gWorldMap->mMatureEvents.begin(); it != gWorldMap->mMatureEvents.end(); ++it) + for (it = LLWorldMap::getInstance()->mMatureEvents.begin(); it != LLWorldMap::getInstance()->mMatureEvents.end(); ++it) { (*it).mSelected = FALSE; } - for (it = gWorldMap->mPopular.begin(); it != gWorldMap->mPopular.end(); ++it) + for (it = LLWorldMap::getInstance()->mPopular.begin(); it != LLWorldMap::getInstance()->mPopular.end(); ++it) { (*it).mSelected = FALSE; } - for (it = gWorldMap->mLandForSale.begin(); it != gWorldMap->mLandForSale.end(); ++it) + for (it = LLWorldMap::getInstance()->mLandForSale.begin(); it != LLWorldMap::getInstance()->mLandForSale.end(); ++it) { (*it).mSelected = FALSE; } - for (it = gWorldMap->mClassifieds.begin(); it != gWorldMap->mClassifieds.end(); ++it) + for (it = LLWorldMap::getInstance()->mClassifieds.begin(); it != LLWorldMap::getInstance()->mClassifieds.end(); ++it) { (*it).mSelected = FALSE; } @@ -1590,7 +1549,7 @@ void LLWorldMapView::handleClick(S32 x, S32 y, MASK mask, // Select event you clicked on if (gSavedSettings.getBOOL("MapShowEvents")) { - for (it = gWorldMap->mPGEvents.begin(); it != gWorldMap->mPGEvents.end(); ++it) + for (it = LLWorldMap::getInstance()->mPGEvents.begin(); it != LLWorldMap::getInstance()->mPGEvents.end(); ++it) { LLItemInfo& event = *it; @@ -1604,7 +1563,7 @@ void LLWorldMapView::handleClick(S32 x, S32 y, MASK mask, } if (gSavedSettings.getBOOL("ShowMatureEvents")) { - for (it = gWorldMap->mMatureEvents.begin(); it != gWorldMap->mMatureEvents.end(); ++it) + for (it = LLWorldMap::getInstance()->mMatureEvents.begin(); it != LLWorldMap::getInstance()->mMatureEvents.end(); ++it) { LLItemInfo& event = *it; @@ -1621,7 +1580,7 @@ void LLWorldMapView::handleClick(S32 x, S32 y, MASK mask, if (gSavedSettings.getBOOL("MapShowPopular")) { - for (it = gWorldMap->mPopular.begin(); it != gWorldMap->mPopular.end(); ++it) + for (it = LLWorldMap::getInstance()->mPopular.begin(); it != LLWorldMap::getInstance()->mPopular.end(); ++it) { LLItemInfo& popular = *it; @@ -1636,7 +1595,7 @@ void LLWorldMapView::handleClick(S32 x, S32 y, MASK mask, if (gSavedSettings.getBOOL("MapShowLandForSale")) { - for (it = gWorldMap->mLandForSale.begin(); it != gWorldMap->mLandForSale.end(); ++it) + for (it = LLWorldMap::getInstance()->mLandForSale.begin(); it != LLWorldMap::getInstance()->mLandForSale.end(); ++it) { LLItemInfo& land = *it; @@ -1651,7 +1610,7 @@ void LLWorldMapView::handleClick(S32 x, S32 y, MASK mask, if (gSavedSettings.getBOOL("MapShowClassifieds")) { - for (it = gWorldMap->mClassifieds.begin(); it != gWorldMap->mClassifieds.end(); ++it) + for (it = LLWorldMap::getInstance()->mClassifieds.begin(); it != LLWorldMap::getInstance()->mClassifieds.end(); ++it) { LLItemInfo& classified = *it; @@ -1732,11 +1691,11 @@ BOOL LLWorldMapView::handleMouseUp( S32 x, S32 y, MASK mask ) void LLWorldMapView::updateBlock(S32 block_x, S32 block_y) { S32 offset = block_x | (block_y * MAP_BLOCK_RES); - if (!gWorldMap->mMapBlockLoaded[gWorldMap->mCurrentMap][offset]) + if (!LLWorldMap::getInstance()->mMapBlockLoaded[LLWorldMap::getInstance()->mCurrentMap][offset]) { // llinfos << "Loading Block (" << block_x << "," << block_y << ")" << llendl; - gWorldMap->sendMapBlockRequest(block_x << 3, block_y << 3, (block_x << 3) + 7, (block_y << 3) + 7); - gWorldMap->mMapBlockLoaded[gWorldMap->mCurrentMap][offset] = TRUE; + LLWorldMap::getInstance()->sendMapBlockRequest(block_x << 3, block_y << 3, (block_x << 3) + 7, (block_y << 3) + 7); + LLWorldMap::getInstance()->mMapBlockLoaded[LLWorldMap::getInstance()->mCurrentMap][offset] = TRUE; } } @@ -1857,15 +1816,15 @@ BOOL LLWorldMapView::handleDoubleClick( S32 x, S32 y, MASK mask ) } default: { - if (gWorldMap->mIsTrackingUnknownLocation) + if (LLWorldMap::getInstance()->mIsTrackingUnknownLocation) { - gWorldMap->mIsTrackingDoubleClick = TRUE; + LLWorldMap::getInstance()->mIsTrackingDoubleClick = TRUE; } else { // Teleport if we got a valid location LLVector3d pos_global = viewPosToGlobal(x,y); - LLSimInfo* sim_info = gWorldMap->simInfoFromPosGlobal(pos_global); + LLSimInfo* sim_info = LLWorldMap::getInstance()->simInfoFromPosGlobal(pos_global); if (sim_info && sim_info->mAccess != SIM_ACCESS_DOWN) { gAgent.teleportViaLocation( pos_global ); diff --git a/indra/newview/llworldmapview.h b/indra/newview/llworldmapview.h index f3c5d654b6..02fc7b7e33 100644 --- a/indra/newview/llworldmapview.h +++ b/indra/newview/llworldmapview.h @@ -83,10 +83,10 @@ public: LLVector3d viewPosToGlobal(S32 x,S32 y); virtual void draw(); - void drawGenericItems(const LLWorldMap::item_info_list_t& items, LLPointer<LLViewerImage> image); - void drawGenericItem(const LLItemInfo& item, LLPointer<LLViewerImage> image); - void drawImage(const LLVector3d& global_pos, LLPointer<LLViewerImage> image, const LLColor4& color = LLColor4::white); - void drawImageStack(const LLVector3d& global_pos, LLPointer<LLViewerImage> image, U32 count, F32 offset, const LLColor4& color); + void drawGenericItems(const LLWorldMap::item_info_list_t& items, LLUIImagePtr image); + void drawGenericItem(const LLItemInfo& item, LLUIImagePtr image); + void drawImage(const LLVector3d& global_pos, LLUIImagePtr image, const LLColor4& color = LLColor4::white); + void drawImageStack(const LLVector3d& global_pos, LLUIImagePtr image, U32 count, F32 offset, const LLColor4& color); void drawAgents(); void drawEvents(); void drawFrustum(); @@ -136,21 +136,21 @@ protected: public: LLColor4 mBackgroundColor; - static LLPointer<LLViewerImage> sAvatarYouSmallImage; - static LLPointer<LLViewerImage> sAvatarSmallImage; - static LLPointer<LLViewerImage> sAvatarLargeImage; - static LLPointer<LLViewerImage> sAvatarAboveImage; - static LLPointer<LLViewerImage> sAvatarBelowImage; - static LLPointer<LLViewerImage> sTelehubImage; - static LLPointer<LLViewerImage> sInfohubImage; - static LLPointer<LLViewerImage> sHomeImage; - static LLPointer<LLViewerImage> sEventImage; - static LLPointer<LLViewerImage> sEventMatureImage; - static LLPointer<LLViewerImage> sTrackCircleImage; - static LLPointer<LLViewerImage> sTrackArrowImage; - static LLPointer<LLViewerImage> sClassifiedsImage; - static LLPointer<LLViewerImage> sPopularImage; - static LLPointer<LLViewerImage> sForSaleImage; + static LLUIImagePtr sAvatarYouSmallImage; + static LLUIImagePtr sAvatarSmallImage; + static LLUIImagePtr sAvatarLargeImage; + static LLUIImagePtr sAvatarAboveImage; + static LLUIImagePtr sAvatarBelowImage; + static LLUIImagePtr sTelehubImage; + static LLUIImagePtr sInfohubImage; + static LLUIImagePtr sHomeImage; + static LLUIImagePtr sEventImage; + static LLUIImagePtr sEventMatureImage; + static LLUIImagePtr sTrackCircleImage; + static LLUIImagePtr sTrackArrowImage; + static LLUIImagePtr sClassifiedsImage; + static LLUIImagePtr sPopularImage; + static LLUIImagePtr sForSaleImage; static F32 sThresholdA; static F32 sThresholdB; diff --git a/indra/newview/macview_Prefix.h b/indra/newview/macview_Prefix.h index 08c59bcedd..eb394dc557 100644 --- a/indra/newview/macview_Prefix.h +++ b/indra/newview/macview_Prefix.h @@ -117,7 +117,7 @@ #include "llresmgr.h" #include "llui.h" #include "llviewborder.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" /////////////////// From lldrawpool.cpp @@ -172,7 +172,7 @@ #include "llviewerwindow.h" #include "llcontrol.h" #include "lluictrl.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" #include "llviewborder.h" #include "llviewerimagelist.h" #include "llbutton.h" diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 448bda1857..74576492a2 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -374,7 +374,6 @@ void LLPipeline::cleanup() mBloomImagep = NULL; mBloomImage2p = NULL; mFaceSelectImagep = NULL; - mAlphaSizzleImagep = NULL; mMovedBridge.clear(); @@ -573,19 +572,16 @@ void LLPipeline::restoreGL() LLShaderMgr::setShaders(); } - if (gWorldp) + for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->getRegionList().begin(); + iter != LLWorld::getInstance()->getRegionList().end(); ++iter) { - for (LLWorld::region_list_t::iterator iter = gWorldp->getRegionList().begin(); - iter != gWorldp->getRegionList().end(); ++iter) + LLViewerRegion* region = *iter; + for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++) { - LLViewerRegion* region = *iter; - for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++) + LLSpatialPartition* part = region->getSpatialPartition(i); + if (part) { - LLSpatialPartition* part = region->getSpatialPartition(i); - if (part) - { - part->restoreGL(); - } + part->restoreGL(); } } } @@ -596,7 +592,7 @@ BOOL LLPipeline::canUseVertexShaders() { if (!gGLManager.mHasVertexShader || !gGLManager.mHasFragmentShader || - !gFeatureManagerp->isFeatureAvailable("VertexShaderEnable") || + !LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable") || (assertInitialized() && mVertexShadersLoaded != 1) ) { return FALSE; @@ -725,20 +721,17 @@ void LLPipeline::dirtyPoolObjectTextures(const std::set<LLViewerImage*>& texture } } - if (gWorldp) + LLOctreeDirtyTexture dirty(textures); + for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->getRegionList().begin(); + iter != LLWorld::getInstance()->getRegionList().end(); ++iter) { - LLOctreeDirtyTexture dirty(textures); - for (LLWorld::region_list_t::iterator iter = gWorldp->getRegionList().begin(); - iter != gWorldp->getRegionList().end(); ++iter) + LLViewerRegion* region = *iter; + for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++) { - LLViewerRegion* region = *iter; - for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++) + LLSpatialPartition* part = region->getSpatialPartition(i); + if (part) { - LLSpatialPartition* part = region->getSpatialPartition(i); - if (part) - { - dirty.traverse(part->mOctree); - } + dirty.traverse(part->mOctree); } } } @@ -1111,8 +1104,8 @@ void LLPipeline::updateMove() { LLFastTimer ot(LLFastTimer::FTM_OCTREE_BALANCE); - for (LLWorld::region_list_t::iterator iter = gWorldp->getRegionList().begin(); - iter != gWorldp->getRegionList().end(); ++iter) + for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->getRegionList().begin(); + iter != LLWorld::getInstance()->getRegionList().end(); ++iter) { LLViewerRegion* region = *iter; for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++) @@ -1189,8 +1182,8 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); LLGLDepthTest depth(GL_TRUE, GL_FALSE); - for (LLWorld::region_list_t::iterator iter = gWorldp->getRegionList().begin(); - iter != gWorldp->getRegionList().end(); ++iter) + for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->getRegionList().begin(); + iter != LLWorld::getInstance()->getRegionList().end(); ++iter) { LLViewerRegion* region = *iter; if (water_clip != 0) @@ -1574,8 +1567,8 @@ void LLPipeline::shiftObjects(const LLVector3 &offset) } mShiftList.resize(0); - for (LLWorld::region_list_t::iterator iter = gWorldp->getRegionList().begin(); - iter != gWorldp->getRegionList().end(); ++iter) + for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->getRegionList().begin(); + iter != LLWorld::getInstance()->getRegionList().end(); ++iter) { LLViewerRegion* region = *iter; for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++) @@ -2106,7 +2099,7 @@ void LLPipeline::postSort(LLCamera& camera) mSelectedFaces.clear(); // Draw face highlights for selected faces. - if (gSelectMgr->getTEMode()) + if (LLSelectMgr::getInstance()->getTEMode()) { struct f : public LLSelectedTEFunctor { @@ -2119,7 +2112,7 @@ void LLPipeline::postSort(LLCamera& camera) return true; } } func; - gSelectMgr->getSelection()->applyToTEs(&func); + LLSelectMgr::getInstance()->getSelection()->applyToTEs(&func); } } @@ -2146,15 +2139,9 @@ void render_hud_elements() LLTracker::render3D(); // Show the property lines - if (gWorldp) - { - gWorldp->renderPropertyLines(); - } - if (gParcelMgr) - { - gParcelMgr->render(); - gParcelMgr->renderParcelCollision(); - } + LLWorld::getInstance()->renderPropertyLines(); + LLViewerParcelMgr::getInstance()->render(); + LLViewerParcelMgr::getInstance()->renderParcelCollision(); // Render debugging beacons. gObjectList.renderObjectBeacons(); @@ -2164,7 +2151,7 @@ void render_hud_elements() else if (gForceRenderLandFence) { // This is only set when not rendering the UI, for parcel snapshots - gParcelMgr->render(); + LLViewerParcelMgr::getInstance()->render(); } else if (gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_HUD)) { @@ -2260,11 +2247,6 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) } } - if (!mAlphaSizzleImagep) - { - mAlphaSizzleImagep = gImageList.getImage(LLUUID(gViewerArt.getString("alpha_sizzle.tga")), MIPMAP_TRUE, TRUE); - } - /////////////////////////////////////////// // // Sync and verify GL state @@ -2534,8 +2516,8 @@ void LLPipeline::renderDebug() glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE); // Debug stuff. - for (LLWorld::region_list_t::iterator iter = gWorldp->getRegionList().begin(); - iter != gWorldp->getRegionList().end(); ++iter) + for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->getRegionList().begin(); + iter != LLWorld::getInstance()->getRegionList().end(); ++iter) { LLViewerRegion* region = *iter; for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++) @@ -2607,7 +2589,7 @@ void LLPipeline::renderForSelect(std::set<LLViewerObject*>& objects) for (std::set<LLViewerObject*>::iterator iter = objects.begin(); iter != objects.end(); ++iter) { - stateSort((*iter)->mDrawable, *gCamera); + stateSort((*iter)->mDrawable, *LLViewerCamera::getInstance()); } LLMemType mt(LLMemType::MTYPE_PIPELINE); @@ -3077,7 +3059,7 @@ void LLPipeline::setupAvatarLights(BOOL for_edit) { LLColor4 diffuse(0.8f, 0.8f, 0.8f, 0.f); LLVector4 light_pos_cam(-8.f, 0.25f, 10.f, 0.f); // w==0 => directional light - LLMatrix4 camera_mat = gCamera->getModelview(); + LLMatrix4 camera_mat = LLViewerCamera::getInstance()->getModelview(); LLMatrix4 camera_rot(camera_mat.getMat3()); camera_rot.invert(); LLVector4 light_pos = light_pos_cam * camera_rot; @@ -3419,7 +3401,7 @@ void LLPipeline::setupHWLights(LLDrawPool* pool) LLColor4 light_color = LLColor4::white; light_color.mV[3] = 0.0f; - LLVector3 light_pos(gCamera->getOrigin()); + LLVector3 light_pos(LLViewerCamera::getInstance()->getOrigin()); LLVector4 light_pos_gl(light_pos, 1.0f); F32 light_radius = 16.f; @@ -3980,8 +3962,8 @@ LLViewerObject* LLPipeline::pickObject(const LLVector3 &start, const LLVector3 & { LLDrawable* drawable = NULL; - for (LLWorld::region_list_t::iterator iter = gWorldp->getRegionList().begin(); - iter != gWorldp->getRegionList().end(); ++iter) + for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->getRegionList().begin(); + iter != LLWorld::getInstance()->getRegionList().end(); ++iter) { LLViewerRegion* region = *iter; LLSpatialPartition* part = region->getSpatialPartition(LLViewerRegion::PARTITION_VOLUME); @@ -4035,19 +4017,16 @@ void LLPipeline::resetVertexBuffers() { sRenderBump = gSavedSettings.getBOOL("RenderObjectBump"); - if (gWorldp) + for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->getRegionList().begin(); + iter != LLWorld::getInstance()->getRegionList().end(); ++iter) { - for (LLWorld::region_list_t::iterator iter = gWorldp->getRegionList().begin(); - iter != gWorldp->getRegionList().end(); ++iter) + LLViewerRegion* region = *iter; + for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++) { - LLViewerRegion* region = *iter; - for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++) + LLSpatialPartition* part = region->getSpatialPartition(i); + if (part) { - LLSpatialPartition* part = region->getSpatialPartition(i); - if (part) - { - part->resetVertexBuffers(); - } + part->resetVertexBuffers(); } } } @@ -4239,7 +4218,7 @@ void LLPipeline::generateReflectionMap(LLCubeMap* cube_map, LLCamera& cube_cam) glTranslatef(-origin.mV[0], -origin.mV[1], -origin.mV[2]); cube_cam.setOrigin(origin); LLViewerCamera::updateFrustumPlanes(cube_cam); - cube_cam.setOrigin(gCamera->getOrigin()); + cube_cam.setOrigin(LLViewerCamera::getInstance()->getOrigin()); static LLCullResult result; gPipeline.updateCull(cube_cam, result); gPipeline.stateSort(cube_cam, result); @@ -4863,8 +4842,8 @@ void LLPipeline::renderBloom(BOOL for_snapshot) void LLPipeline::processImagery(LLCamera& camera) { - for (LLWorld::region_list_t::iterator iter = gWorldp->getRegionList().begin(); - iter != gWorldp->getRegionList().end(); ++iter) + for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->getRegionList().begin(); + iter != LLWorld::getInstance()->getRegionList().end(); ++iter) { LLViewerRegion* region = *iter; LLSpatialPartition* part = region->getSpatialPartition(LLViewerRegion::PARTITION_VOLUME); @@ -4909,7 +4888,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) F32 pd; S32 water_clip = 0; - if (!gCamera->cameraUnderWater()) + if (!LLViewerCamera::getInstance()->cameraUnderWater()) { //camera is above water, clip plane points up pnorm.setVec(0,0,1); pd = -height; @@ -4926,7 +4905,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) - if (!gCamera->cameraUnderWater()) + if (!LLViewerCamera::getInstance()->cameraUnderWater()) { //generate planar reflection map LLViewerImage::unbindTexture(0, GL_TEXTURE_2D); glClearColor(0,0,0,0); @@ -5022,7 +5001,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) (1<<LLPipeline::RENDER_TYPE_GROUND)); stop_glerror(); - LLPipeline::sUnderWaterRender = gCamera->cameraUnderWater() ? FALSE : TRUE; + LLPipeline::sUnderWaterRender = LLViewerCamera::getInstance()->cameraUnderWater() ? FALSE : TRUE; if (LLPipeline::sUnderWaterRender) { @@ -5071,14 +5050,14 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) mRenderTypeMask = type_mask; LLDrawPoolWater::sNeedsReflectionUpdate = FALSE; LLDrawPoolWater::sNeedsDistortionUpdate = FALSE; - gCamera->setUserClipPlane(LLPlane(-pnorm, -pd)); + LLViewerCamera::getInstance()->setUserClipPlane(LLPlane(-pnorm, -pd)); LLPipeline::sUseOcclusion = occlusion; } } LLCubeMap* LLPipeline::findReflectionMap(const LLVector3& location) { - LLViewerRegion* region = gWorldp->getRegionFromPosAgent(location); + LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosAgent(location); if (region) { LLSpatialPartition* part = region->getSpatialPartition(LLViewerRegion::PARTITION_VOLUME); @@ -5125,7 +5104,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar) assertInitialized(); U32 mask; - BOOL muted = gMuteListp && gMuteListp->isMuted(avatar->getID()); + BOOL muted = LLMuteList::getInstance()->isMuted(avatar->getID()); if (muted) { @@ -5151,7 +5130,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar) sReflectionRender = TRUE; sImpostorRender = TRUE; - markVisible(avatar->mDrawable, *gCamera); + markVisible(avatar->mDrawable, *LLViewerCamera::getInstance()); LLVOAvatar::sUseImpostors = FALSE; LLVOAvatar::attachment_map_t::iterator iter; @@ -5162,18 +5141,18 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar) LLViewerObject* object = iter->second->getObject(); if (object) { - markVisible(object->mDrawable->getSpatialBridge(), *gCamera); + markVisible(object->mDrawable->getSpatialBridge(), *LLViewerCamera::getInstance()); } } - stateSort(*gCamera, result); + stateSort(*LLViewerCamera::getInstance(), result); const LLVector3* ext = avatar->mDrawable->getSpatialExtents(); LLVector3 pos(avatar->getRenderPosition()+avatar->getImpostorOffset()); - LLCamera camera = *gCamera; + LLCamera camera = *LLViewerCamera::getInstance(); - camera.lookAt(gCamera->getOrigin(), pos, gCamera->getUpAxis()); + camera.lookAt(LLViewerCamera::getInstance()->getOrigin(), pos, LLViewerCamera::getInstance()->getUpAxis()); LLVector2 tdim; @@ -5216,7 +5195,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar) glClearStencil(0); // get the number of pixels per angle - F32 pa = gViewerWindow->getWindowDisplayHeight()/(RAD_TO_DEG*gCamera->getView()); + F32 pa = gViewerWindow->getWindowDisplayHeight() / (RAD_TO_DEG * LLViewerCamera::getInstance()->getView()); //get resolution based on angle width and height of impostor (double desired resolution to prevent aliasing) U32 resY = llmin(nhpo2((U32) (fov*pa)), (U32) 512); diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 9c64ccdbe3..6e02b55daf 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -334,8 +334,6 @@ public: RENDER_DEBUG_SHAME = 0x400000, }; - LLPointer<LLViewerImage> mAlphaSizzleImagep; - public: LLSpatialPartition* getSpatialPartition(LLViewerObject* vobj); |