diff options
| -rw-r--r-- | indra/newview/llnetmap.cpp | 167 | ||||
| -rw-r--r-- | indra/newview/llnetmap.h | 13 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/menu_mini_map.xml | 11 | ||||
| -rwxr-xr-x | indra/newview/viewer_manifest.py | 7 | 
4 files changed, 108 insertions, 90 deletions
diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index 29623ccd53..66cf6272fd 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -87,7 +87,6 @@ LLNetMap::LLNetMap (const Params & p)  	mPixelsPerMeter( MAP_SCALE_MID / REGION_WIDTH_METERS ),  	mObjectMapTPM(0.f),  	mObjectMapPixels(0.f), -	mTargetPan(0.f, 0.f),  	mCurPan(0.f, 0.f),  	mStartPan(0.f, 0.f),  	mMouseDown(0, 0), @@ -112,13 +111,17 @@ LLNetMap::~LLNetMap()  BOOL LLNetMap::postBuild()  { -	LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; -	 -	registrar.add("Minimap.Zoom", boost::bind(&LLNetMap::handleZoom, this, _2)); -	registrar.add("Minimap.Tracker", boost::bind(&LLNetMap::handleStopTracking, this, _2)); +    LLUICtrl::CommitCallbackRegistry::ScopedRegistrar commitRegistrar; -	mPopupMenu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_mini_map.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); -	return TRUE; +    commitRegistrar.add("Minimap.Zoom", boost::bind(&LLNetMap::handleZoom, this, _2)); +    commitRegistrar.add("Minimap.Tracker", boost::bind(&LLNetMap::handleStopTracking, this, _2)); +    commitRegistrar.add("Minimap.Center.Activate", boost::bind(&LLNetMap::activateCenterMap, this, _2)); + +    mPopupMenu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_mini_map.xml", gMenuHolder, +                                                                          LLViewerMenuHolderGL::child_registry_t::instance()); +    mPopupMenu->setItemEnabled("Re-Center Map", false); + +    return true;  }  void LLNetMap::setScale( F32 scale ) @@ -166,11 +169,24 @@ void LLNetMap::draw()  		createObjectImage();  	} -	static LLUICachedControl<bool> auto_center("MiniMapAutoCenter", true); -	if (auto_center) +    static LLUICachedControl<bool> auto_center("MiniMapAutoCenter", true); +    bool auto_centering = auto_center && !mPanning; +    mCentering = mCentering && !mPanning; + +    if (auto_centering || mCentering)  	{ -		mCurPan = lerp(mCurPan, mTargetPan, LLSmoothInterpolation::getInterpolant(0.1f)); +        mCurPan = lerp(mCurPan, LLVector2(0.0f, 0.0f) , LLSmoothInterpolation::getInterpolant(0.1f));  	} +    bool centered = abs(mCurPan.mV[VX]) < 0.5f && abs(mCurPan.mV[VY]) < 0.5f; +    if (centered) +    { +        mCurPan.mV[0] = 0.0f; +        mCurPan.mV[1] = 0.0f; +        mCentering = false; +    } + +    bool can_recenter_map = !(centered || mCentering || auto_centering); +    mPopupMenu->setItemEnabled("Re-Center Map", can_recenter_map);  	// Prepare a scissor region  	F32 rotation = 0; @@ -589,23 +605,23 @@ LLVector3d LLNetMap::viewPosToGlobal( S32 x, S32 y )  BOOL LLNetMap::handleScrollWheel(S32 x, S32 y, S32 clicks)  { -	// note that clicks are reversed from what you'd think: i.e. > 0  means zoom out, < 0 means zoom in -	F32 new_scale = mScale * pow(MAP_SCALE_ZOOM_FACTOR, -clicks); +    // note that clicks are reversed from what you'd think: i.e. > 0  means zoom out, < 0 means zoom in +    F32 new_scale = mScale * pow(MAP_SCALE_ZOOM_FACTOR, -clicks);  	F32 old_scale = mScale; -	setScale(new_scale); +    setScale(new_scale); -	static LLUICachedControl<bool> auto_center("MiniMapAutoCenter", true); -	if (!auto_center) -	{ -		// Adjust pan to center the zoom on the mouse pointer -		LLVector2 zoom_offset; -		zoom_offset.mV[VX] = x - getRect().getWidth() / 2; -		zoom_offset.mV[VY] = y - getRect().getHeight() / 2; -		mCurPan -= zoom_offset * mScale / old_scale - zoom_offset; -	} +    static LLUICachedControl<bool> auto_center("MiniMapAutoCenter", true); +    if (!auto_center) +    { +        // Adjust pan to center the zoom on the mouse pointer +        LLVector2 zoom_offset; +        zoom_offset.mV[VX] = x - getRect().getWidth() / 2; +        zoom_offset.mV[VY] = y - getRect().getHeight() / 2; +        mCurPan -= zoom_offset * mScale / old_scale - zoom_offset; +    } -	return TRUE; +    return true;  }  BOOL LLNetMap::handleToolTip(S32 x, S32 y, MASK mask) @@ -898,50 +914,48 @@ void LLNetMap::createObjectImage()  	mUpdateNow = true;  } -BOOL LLNetMap::handleMouseDown( S32 x, S32 y, MASK mask ) +BOOL LLNetMap::handleMouseDown(S32 x, S32 y, MASK mask)  { -	if (!(mask & MASK_SHIFT)) return FALSE; +    // Start panning +    gFocusMgr.setMouseCapture(this); -	// Start panning -	gFocusMgr.setMouseCapture(this); - -	mStartPan = mCurPan; -	mMouseDown.mX = x; -	mMouseDown.mY = y; -	return TRUE; +    mStartPan     = mCurPan; +    mMouseDown.mX = x; +    mMouseDown.mY = y; +    return true;  } -BOOL LLNetMap::handleMouseUp( S32 x, S32 y, MASK mask ) +BOOL LLNetMap::handleMouseUp(S32 x, S32 y, MASK mask)  { -	if(abs(mMouseDown.mX-x)<3 && abs(mMouseDown.mY-y)<3) -		handleClick(x,y,mask); +    if (abs(mMouseDown.mX - x) < 3 && abs(mMouseDown.mY - y) < 3) +    { +        handleClick(x, y, mask); +    } -	if (hasMouseCapture()) -	{ -		if (mPanning) -		{ -			// restore mouse cursor -			S32 local_x, local_y; -			local_x = mMouseDown.mX + llfloor(mCurPan.mV[VX] - mStartPan.mV[VX]); -			local_y = mMouseDown.mY + llfloor(mCurPan.mV[VY] - mStartPan.mV[VY]); -			LLRect clip_rect = getRect(); -			clip_rect.stretch(-8); -			clip_rect.clipPointToRect(mMouseDown.mX, mMouseDown.mY, local_x, local_y); -			LLUI::getInstance()->setMousePositionLocal(this, local_x, local_y); - -			// finish the pan -			mPanning = false; - -			mMouseDown.set(0, 0); - -			// auto centre -			mTargetPan.setZero(); -		} -		gViewerWindow->showCursor(); -		gFocusMgr.setMouseCapture(NULL); -		return TRUE; -	} -	return FALSE; +    if (hasMouseCapture()) +    { +        if (mPanning) +        { +            // restore mouse cursor +            S32 local_x, local_y; +            local_x          = mMouseDown.mX + llfloor(mCurPan.mV[VX] - mStartPan.mV[VX]); +            local_y          = mMouseDown.mY + llfloor(mCurPan.mV[VY] - mStartPan.mV[VY]); +            LLRect clip_rect = getRect(); +            clip_rect.stretch(-8); +            clip_rect.clipPointToRect(mMouseDown.mX, mMouseDown.mY, local_x, local_y); +            LLUI::getInstance()->setMousePositionLocal(this, local_x, local_y); + +            // finish the pan +            mPanning = false; + +            mMouseDown.set(0, 0); +        } +        gViewerWindow->showCursor(); +        gFocusMgr.setMouseCapture(NULL); +        return true; +    } + +    return false;  }  BOOL LLNetMap::handleRightMouseDown(S32 x, S32 y, MASK mask) @@ -1015,7 +1029,7 @@ BOOL LLNetMap::handleHover( S32 x, S32 y, MASK mask )  		{  			if (!mPanning)  			{ -				// just started panning, so hide cursor +                // Just started panning. Hide cursor.  				mPanning = true;  				gViewerWindow->hideCursor();  			} @@ -1025,27 +1039,22 @@ BOOL LLNetMap::handleHover( S32 x, S32 y, MASK mask )  			// Set pan to value at start of drag + offset  			mCurPan += delta; -			mTargetPan = mCurPan;  			gViewerWindow->moveCursorToCenter();  		} - -		// Doesn't really matter, cursor should be hidden -		gViewerWindow->setCursor( UI_CURSOR_TOOLPAN ); -	} -	else -	{ -		if (mask & MASK_SHIFT) -		{ -			// If shift is held, change the cursor to hint that the map can be dragged -			gViewerWindow->setCursor( UI_CURSOR_TOOLPAN ); -		} -		else -		{ -			gViewerWindow->setCursor( UI_CURSOR_CROSS ); -		}  	} +    if (mask & MASK_SHIFT) +    { +        // If shift is held, change the cursor to hint that the map can be +        // dragged. However, holding shift is not required to drag the map. +        gViewerWindow->setCursor( UI_CURSOR_TOOLPAN ); +    } +    else +    { +        gViewerWindow->setCursor( UI_CURSOR_CROSS ); +    } +  	return TRUE;  } @@ -1083,3 +1092,5 @@ void LLNetMap::handleStopTracking (const LLSD& userdata)  		LLTracker::stopTracking (LLTracker::isTracking(NULL));  	}  } + +void LLNetMap::activateCenterMap(const LLSD &userdata) { mCentering = true; } diff --git a/indra/newview/llnetmap.h b/indra/newview/llnetmap.h index b82b3d4105..0f2eee171d 100644 --- a/indra/newview/llnetmap.h +++ b/indra/newview/llnetmap.h @@ -121,11 +121,11 @@ private:  	F32				mObjectMapPixels;		// Width of object map in pixels  	F32				mDotRadius;				// Size of avatar markers -	bool			mPanning;			// map is being dragged -	LLVector2		mTargetPan; -	LLVector2		mCurPan; -	LLVector2		mStartPan;		// pan offset at start of drag -	LLCoordGL		mMouseDown;			// pointer position at start of drag +    bool            mPanning; // map is being dragged +    bool            mCentering; // map is being re-centered around the agent +    LLVector2       mCurPan; +    LLVector2       mStartPan; // pan offset at start of drag +    LLCoordGL       mMouseDown; // pointer position at start of drag  	LLVector3d		mObjectImageCenterGlobal;  	LLPointer<LLImageRaw> mObjectRawImagep; @@ -148,7 +148,8 @@ public:  private:  	void handleZoom(const LLSD& userdata); -	void handleStopTracking (const LLSD& userdata); +    void handleStopTracking(const LLSD& userdata); +    void activateCenterMap(const LLSD& userdata);  	LLMenuGL*		mPopupMenu;  	uuid_vec_t		gmSelected; diff --git a/indra/newview/skins/default/xui/en/menu_mini_map.xml b/indra/newview/skins/default/xui/en/menu_mini_map.xml index c3899b35cd..402e1b34d0 100644 --- a/indra/newview/skins/default/xui/en/menu_mini_map.xml +++ b/indra/newview/skins/default/xui/en/menu_mini_map.xml @@ -46,9 +46,10 @@               function="ToggleControl"               parameter="MiniMapRotate" />      </menu_item_check> +    <menu_item_separator />      <menu_item_check -       label="Auto Center" -       name="Auto Center"> +       label="Auto-center map" +       name="Auto-center map">            <menu_item_check.on_check               control="MiniMapAutoCenter" />            <menu_item_check.on_click @@ -57,6 +58,12 @@      </menu_item_check>      <menu_item_separator />      <menu_item_call +     label="Re-Center Map" +     name="Re-Center Map"> +        <menu_item_call.on_click +         function="Minimap.Center.Activate" /> +    </menu_item_call> +    <menu_item_call       label="Stop Tracking"       name="Stop Tracking">          <menu_item_call.on_click diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 371ea88542..73634a52c9 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -1315,9 +1315,8 @@ class DarwinManifest(ViewerManifest):                          ]                      for attempt in range(3):                          if attempt: # second or subsequent iteration -                            print >> sys.stderr, \ -                                ("codesign failed, waiting %d seconds before retrying" % -                                 sign_retry_wait) +                            print("codesign failed, waiting {:d} seconds before retrying".format(sign_retry_wait), +                                  file=sys.stderr)                              time.sleep(sign_retry_wait)                              sign_retry_wait*=2 @@ -1347,7 +1346,7 @@ class DarwinManifest(ViewerManifest):                              # 'err' goes out of scope                              sign_failed = err                      else: -                        print >> sys.stderr, "Maximum codesign attempts exceeded; giving up" +                        print("Maximum codesign attempts exceeded; giving up", file=sys.stderr)                          raise sign_failed                      self.run_command(['spctl', '-a', '-texec', '-vvvv', app_in_dmg])                      self.run_command([self.src_path_of("installers/darwin/apple-notarize.sh"), app_in_dmg])  | 
