Пример #1
0
BOOL LLTextBox::handleMouseUp(S32 x, S32 y, MASK mask)
{
    BOOL	handled = FALSE;

    // We only handle the click if the click both started and ended within us

    // HACK: Only do this if there actually is a click callback, so that
    // overly large text boxes in the older UI won't start eating clicks.
    if (mClickedCallback
            && hasMouseCapture())
    {
        handled = TRUE;

        // Release the mouse
        gFocusMgr.setMouseCapture( NULL );

        if (getSoundFlags() & MOUSE_UP)
        {
            make_ui_sound("UISndClickRelease");
        }

        // DO THIS AT THE VERY END to allow the button to be destroyed as a result of being clicked.
        // If mouseup in the widget, it's been clicked
        if (mClickedCallback)
        {
            (*mClickedCallback)( mCallbackUserData );
        }
    }

    return handled;
}
Пример #2
0
BOOL LLToolSelectLand::handleMouseUp(S32 x, S32 y, MASK mask)
{
	if(	hasMouseCapture() )
	{
		setMouseCapture( FALSE );

		if (mMouseOutsideSlop && mDragEndValid)
		{
			// Take the drag start and end locations, then map the southwest
			// point down to the next grid location, and the northeast point up
			// to the next grid location.

			sanitize_corners(mDragStartGlobal, mDragEndGlobal, mWestSouthBottom, mEastNorthTop);

			mWestSouthBottom -= LLVector3d( PARCEL_GRID_STEP_METERS/2, PARCEL_GRID_STEP_METERS/2, 0 );
			mEastNorthTop += LLVector3d( PARCEL_GRID_STEP_METERS/2, PARCEL_GRID_STEP_METERS/2, 0 );

			roundXY(mWestSouthBottom);
			roundXY(mEastNorthTop);

			// Don't auto-select entire parcel.
			mSelection = LLViewerParcelMgr::getInstance()->selectLand( mWestSouthBottom, mEastNorthTop, FALSE );
		}

		mMouseOutsideSlop = FALSE;
		mDragEndValid = FALSE;
		
		return TRUE;
	}
	return FALSE;
}
Пример #3
0
void LLToolPie::stopEditing()
{
	if(	hasMouseCapture() )
	{
		setMouseCapture( FALSE );  // Calls onMouseCaptureLost() indirectly
	}
}
Пример #4
0
void LLToolSelectLand::render()
{
	if(	hasMouseCapture() && /*mMouseOutsideSlop &&*/ mDragEndValid)
	{
		LLViewerParcelMgr::getInstance()->renderRect( mWestSouthBottom, mEastNorthTop );
	}
}
Пример #5
0
BOOL LLPreview::handleHover(S32 x, S32 y, MASK mask)
{
	if(hasMouseCapture())
	{
		S32 screen_x;
		S32 screen_y;
		const LLViewerInventoryItem *item = getItem();

		localPointToScreen(x, y, &screen_x, &screen_y );
		if(item
		   && item->getPermissions().allowCopyBy(gAgent.getID(),
												 gAgent.getGroupID())
		   && LLToolDragAndDrop::getInstance()->isOverThreshold(screen_x, screen_y))
		{
			EDragAndDropType type;
			type = LLViewerAssetType::lookupDragAndDropType(item->getType());
			LLToolDragAndDrop::ESource src = LLToolDragAndDrop::SOURCE_LIBRARY;
			if(!mObjectUUID.isNull())
			{
				src = LLToolDragAndDrop::SOURCE_WORLD;
			}
			else if(item->getPermissions().getOwner() == gAgent.getID())
			{
				src = LLToolDragAndDrop::SOURCE_AGENT;
			}
			LLToolDragAndDrop::getInstance()->beginDrag(type,
										item->getUUID(),
										src,
										mObjectUUID);
			return LLToolDragAndDrop::getInstance()->handleHover(x, y, mask );
		}
	}
	return LLFloater::handleHover(x,y,mask);
}
Пример #6
0
BOOL DOHexEditor::handleHover(S32 x, S32 y, MASK mask)
{
	BOOL handled = FALSE;
	if(!hasMouseCapture())
	{
		handled = childrenHandleHover(x, y, mask) != NULL;
	}
	if(!handled && mSelecting && hasMouseCapture())
	{
		// continuation of selecting
		getPosAndContext(x, y, TRUE, mCursorPos, mInData, mSecondNibble);
		mSelectionEnd = mCursorPos;
		mHasSelection = (mSelectionStart != mSelectionEnd);
		handled = TRUE;
	}
	return handled;
}
Пример #7
0
// virtual
void LLToolObjPicker::handleDeselect()
{
	if (hasMouseCapture())
	{
		LLTool::handleDeselect();
		setMouseCapture(FALSE);
	}
}
Пример #8
0
void LLToolGrab::handleDeselect()
{
	if( hasMouseCapture() )
	{
		setMouseCapture( FALSE );
	}

}
Пример #9
0
LLTool::~LLTool()
{
    if( hasMouseCapture() )
    {
        llwarns << "Tool deleted holding mouse capture.  Mouse capture removed." << llendl;
        gFocusMgr.removeMouseCaptureWithoutCallback( this );
    }
}
BOOL LLPreview::handleMouseUp(S32 x, S32 y, MASK mask)
{
	if(hasMouseCapture())
	{
		gFocusMgr.setMouseCapture(NULL);
		return TRUE;
	}
	return LLFloater::handleMouseUp(x, y, mask);
}
Пример #11
0
void LLToolPie::handleDeselect()
{
	if(	hasMouseCapture() )
	{
		setMouseCapture( FALSE );  // Calls onMouseCaptureLost() indirectly
	}
	// remove temporary selection for pie menu
	LLSelectMgr::getInstance()->validateSelection();
}
BOOL LLJoystick::handleHover(S32 x, S32 y, MASK mask)
{
	if( hasMouseCapture() )
	{
		mLastMouse.set(x, y);
	}

	return LLButton::handleHover(x, y, mask);
}
//-----------------------------------------------------------------------------
// handleHover()
//-----------------------------------------------------------------------------
BOOL LLFloaterAnimPreview::handleHover(S32 x, S32 y, MASK mask)
{
	if (mInWorld)
	{
		return TRUE;
	}

	MASK local_mask = mask & ~MASK_ALT;

	if (mAnimPreview && hasMouseCapture())
	{
		if (local_mask == MASK_PAN)
		{
			// pan here
			mAnimPreview->pan((F32)(x - mLastMouseX) * -0.005f, (F32)(y - mLastMouseY) * -0.005f);
		}
		else if (local_mask == MASK_ORBIT)
		{
			F32 yaw_radians = (F32)(x - mLastMouseX) * -0.01f;
			F32 pitch_radians = (F32)(y - mLastMouseY) * 0.02f;
			
			mAnimPreview->rotate(yaw_radians, pitch_radians);
		}
		else 
		{
			F32 yaw_radians = (F32)(x - mLastMouseX) * -0.01f;
			F32 zoom_amt = (F32)(y - mLastMouseY) * 0.02f;
			
			mAnimPreview->rotate(yaw_radians, 0.f);
			mAnimPreview->zoom(zoom_amt);
		}

		mAnimPreview->requestUpdate();

		LLUI::setCursorPositionLocal(this, mLastMouseX, mLastMouseY);
	}

	if (!mPreviewRect.pointInRect(x, y) || !mAnimPreview)
	{
		return LLFloater::handleHover(x, y, mask);
	}
	else if (local_mask == MASK_ORBIT)
	{
		gViewerWindow->setCursor(UI_CURSOR_TOOLCAMERA);
	}
	else if (local_mask == MASK_PAN)
	{
		gViewerWindow->setCursor(UI_CURSOR_TOOLPAN);
	}
	else
	{
		gViewerWindow->setCursor(UI_CURSOR_TOOLZOOMIN);
	}

	return TRUE;
}
Пример #14
0
void LLSlider::draw()
{
	F32 alpha = getDrawContext().mAlpha;

	// since thumb image might still be decoding, need thumb to accomodate image size
	updateThumbRect();

	// Draw background and thumb.

	// drawing solids requires texturing be disabled
	gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);

	// Track
	LLRect track_rect(mThumbImage->getWidth() / 2, 
						getLocalRect().getCenterY() + (mTrackImage->getHeight() / 2), 
						getRect().getWidth() - mThumbImage->getWidth() / 2, 
						getLocalRect().getCenterY() - (mTrackImage->getHeight() / 2) );
	LLRect highlight_rect(track_rect.mLeft, track_rect.mTop, mThumbRect.getCenterX(), track_rect.mBottom);
	mTrackImage->draw(track_rect, LLColor4::white % alpha);
	mTrackHighlightImage->draw(highlight_rect, LLColor4::white % alpha);

	// Thumb
	if (hasFocus())
	{
		// Draw focus highlighting.
		mThumbImage->drawBorder(mThumbRect, gFocusMgr.getFocusColor() % alpha, gFocusMgr.getFocusFlashWidth());
	}

	if( hasMouseCapture() )
	{
		// Show ghost where thumb was before dragging began.
		if (mThumbImage.notNull())
		{
			mThumbImage->draw(mDragStartThumbRect, mThumbCenterColor % (0.3f * alpha));
			mThumbImage->draw(mThumbRect, mThumbOutlineColor % alpha);
		}
	}
	else if(!getEnabled())
	{
		if (mThumbImage.notNull())
		{
			mThumbImage->draw(mThumbRect, mThumbCenterColor % (0.3f * alpha));
		}
	}
	else
	{
		if (mThumbImage.notNull())
		{
			mThumbImage->draw(mThumbRect, mThumbCenterColor % alpha);
		}
	}
	// Fill in the thumb.
	

	LLUICtrl::draw();
}
Пример #15
0
BOOL LLManip::handleMouseUp(S32 x, S32 y, MASK mask)
{
	BOOL	handled = FALSE;
	if( hasMouseCapture() )
	{
		handled = TRUE;
		setMouseCapture( FALSE );
	}
	return handled;
}
Пример #16
0
BOOL LLToolPipette::handleHover(S32 x, S32 y, MASK mask)
{
	gViewerWindow->setCursor(mSuccess ? UI_CURSOR_PIPETTE : UI_CURSOR_NO);
	if (hasMouseCapture()) // mouse button is down
	{
		gViewerWindow->pickAsync(x, y, mask, pickCallback);
		return TRUE;
	}
	return FALSE;
}
Пример #17
0
BOOL LLToolBrushLand::handleHover( S32 x, S32 y, MASK mask )
{
	lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolBrushLand ("
								<< (hasMouseCapture() ? "active":"inactive")
								<< ")" << llendl;
	mMouseX = x;
	mMouseY = y;
	mGotHover = TRUE;
	gViewerWindow->setCursor(UI_CURSOR_TOOLLAND);
	return TRUE;
}
Пример #18
0
BOOL LLDragHandle::handleMouseUp(S32 x, S32 y, MASK mask)
{
	if( hasMouseCapture() )
	{
		// Release the mouse
		gFocusMgr.setMouseCapture( NULL );
	}

	// Note: don't pass on to children
	return TRUE;
}
Пример #19
0
// virtual
BOOL LLTabContainer::handleMouseUp( S32 x, S32 y, MASK mask )
{
	BOOL handled = FALSE;
	BOOL has_scroll_arrows = (getMaxScrollPos() > 0);

	if (has_scroll_arrows)
	{
		if (mJumpPrevArrowBtn && mJumpPrevArrowBtn->getRect().pointInRect(x, y))
		{
			S32 local_x = x - mJumpPrevArrowBtn->getRect().mLeft;
			S32 local_y = y - mJumpPrevArrowBtn->getRect().mBottom;
			handled = mJumpPrevArrowBtn->handleMouseUp(local_x, local_y, mask);
		}
		else if (mJumpNextArrowBtn && mJumpNextArrowBtn->getRect().pointInRect(x,	y))
		{
			S32	local_x	= x	- mJumpNextArrowBtn->getRect().mLeft;
			S32	local_y	= y	- mJumpNextArrowBtn->getRect().mBottom;
			handled = mJumpNextArrowBtn->handleMouseUp(local_x,	local_y, mask);
		}
		else if (mPrevArrowBtn && mPrevArrowBtn->getRect().pointInRect(x, y))
		{
			S32 local_x = x - mPrevArrowBtn->getRect().mLeft;
			S32 local_y = y - mPrevArrowBtn->getRect().mBottom;
			handled = mPrevArrowBtn->handleMouseUp(local_x, local_y, mask);
		}
		else if (mNextArrowBtn && mNextArrowBtn->getRect().pointInRect(x, y))
		{
			S32 local_x = x - mNextArrowBtn->getRect().mLeft;
			S32 local_y = y - mNextArrowBtn->getRect().mBottom;
			handled = mNextArrowBtn->handleMouseUp(local_x, local_y, mask);
		}
	}
	if (!handled)
	{
		handled = LLPanel::handleMouseUp( x, y, mask );
	}

	commitHoveredButton(x, y);
	LLPanel* cur_panel = getCurrentPanel();
	if (hasMouseCapture())
	{
		if (cur_panel)
		{
			if (!cur_panel->focusFirstItem(FALSE))
			{
				// if nothing in the panel gets focus, make sure the new tab does
				// otherwise the last tab might keep focus
				getTab(getCurrentPanelIndex())->mButton->setFocus(TRUE);
			}
		}
		gFocusMgr.setMouseCapture(NULL);
	}
	return handled;
}
Пример #20
0
BOOL DOHexEditor::handleMouseUp(S32 x, S32 y, MASK mask)
{
	BOOL handled = FALSE;
	handled = LLView::childrenHandleMouseUp(x, y, mask) != NULL;
	if(!handled && mSelecting && hasMouseCapture())
	{
		gFocusMgr.setMouseCapture(NULL);
		mSelecting = FALSE;
	}
	return handled;
}
Пример #21
0
void LLTool::setMouseCapture( BOOL b )
{
    if( b )
    {
        gFocusMgr.setMouseCapture(mComposite ? mComposite : this );
    }
    else if( hasMouseCapture() )
    {
        gFocusMgr.setMouseCapture( NULL );
    }
}
Пример #22
0
// left and right mouse buttons both do the same thing currently
BOOL PieMenu::handleMouseButtonUp(S32 x,S32 y,MASK mask)
{
	// if this was the first click and no slice is highlighted (no borderless click), start the popup timer
	if(mFirstClick && !mSlice)
	{
		mFirstClick=FALSE;
#if PIE_POPUP_EFFECT
		mPopupTimer.start();
#endif
	}
	else
	{
		// default to invisible
		BOOL visible=FALSE;

		// get the current selected slice and check if this is a regular click slice
		PieSlice* currentSlice=dynamic_cast<PieSlice*>(mSlice);
		if(currentSlice)
		{
			// if so, click it and make a sound
			make_ui_sound("UISndClickRelease");
			currentSlice->onCommit();
		}
		else
		{
			// check if this was a submenu
			PieMenu* currentSubmenu=dynamic_cast<PieMenu*>(mSlice);
			if(currentSubmenu)
			{
				// if so, remember we clicked the menu already at least once
				mFirstClick=FALSE;
				// swap out the list of items for the ones in the submenu
				mSlices=&currentSubmenu->mMySlices;
				// the menu stays visible
				visible=TRUE;
#if PIE_POPUP_EFFECT
				// restart the popup timer
				mPopupTimer.reset();
				mPopupTimer.start();
#endif
				// make a sound
				make_ui_sound("UISndPieMenuAppear");
			}
		}
		// show or hide the menu, as needed
		setVisible(visible);
	}
	// release mouse capture after the first click if we still have it grabbed
	if(hasMouseCapture())
		gFocusMgr.setMouseCapture(NULL);

	// give control back to the system
	return LLView::handleMouseUp(x,y,mask);
}
Пример #23
0
BOOL LLToolSelectLand::handleHover(S32 x, S32 y, MASK mask)
{
	if(	hasMouseCapture() )
	{
		if (mMouseOutsideSlop || outsideSlop(x, y, mDragStartX, mDragStartY))
		{
			mMouseOutsideSlop = TRUE;

			// Must do this every frame, in case the camera moved or the land moved
			// since last frame.

			// If doesn't hit land, doesn't change old value
			LLVector3d land_global;
			BOOL hit_land = gViewerWindow->mousePointOnLandGlobal(x, y, &land_global);
			if (hit_land)
			{
				mDragEndValid = TRUE;
				mDragEndGlobal = land_global;

				sanitize_corners(mDragStartGlobal, mDragEndGlobal, mWestSouthBottom, mEastNorthTop);

				mWestSouthBottom -= LLVector3d( PARCEL_GRID_STEP_METERS/2, PARCEL_GRID_STEP_METERS/2, 0 );
				mEastNorthTop += LLVector3d( PARCEL_GRID_STEP_METERS/2, PARCEL_GRID_STEP_METERS/2, 0 );

				roundXY(mWestSouthBottom);
				roundXY(mEastNorthTop);

				lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolSelectLand (active, land)" << llendl;
				gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROW);
			}
			else
			{
				mDragEndValid = FALSE;
				lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolSelectLand (active, no land)" << llendl;
				gViewerWindow->getWindow()->setCursor(UI_CURSOR_NO);
			}

			mDragEndX = x;
			mDragEndY = y;
		}
		else
		{
			lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolSelectLand (active, in slop)" << llendl;
			gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROW);
		}
	}
	else
	{
		lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolSelectLand (inactive)" << llendl;		
		gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROW);
	}

	return TRUE;
}
Пример #24
0
BOOL LLToolGrab::handleHover(S32 x, S32 y, MASK mask)
{
	if (!gViewerWindow->getLeftMouseDown())
	{
		gViewerWindow->setCursor(UI_CURSOR_TOOLGRAB);
		setMouseCapture(FALSE);
		return TRUE;
	}

// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Added: RLVa-0.2.0f
	// Don't allow dragging beyond 1.5m under @fartouch=n
	LLViewerObject* pObj;
	if ( (gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH)) && (GRAB_INACTIVE != mMode) && (hasMouseCapture()) &&
		 ((pObj = mGrabPick.getObject()) != NULL) && (!pObj->isDead()) && (!pObj->isHUDAttachment()) && 
		 (dist_vec_squared(gAgent.getPositionAgent(), pObj->getPositionRegion() + mGrabPick.mObjectOffset) > 1.5f * 1.5f) )
	{
		if (gGrabTransientTool)
		{
			// Prevent the grab tool from popping up as soon as we kill the drag operation
			gBasicToolset->selectTool(gGrabTransientTool);
			gGrabTransientTool = NULL;
		}
		setMouseCapture(FALSE);
	}
// [/RLVa:KB]

	// Do the right hover based on mode
	switch( mMode )
	{
	case GRAB_ACTIVE_CENTER:
		handleHoverActive( x, y, mask );	// cursor hidden
		break;
		
	case GRAB_NONPHYSICAL:
		handleHoverNonPhysical(x, y, mask);
		break;

	case GRAB_INACTIVE:
		handleHoverInactive( x, y, mask );  // cursor set here
		break;

	case GRAB_NOOBJECT:
	case GRAB_LOCKED:
		handleHoverFailed( x, y, mask );
		break;

	}

	mLastMouseX = x;
	mLastMouseY = y;
	
	return TRUE;
}
Пример #25
0
BOOL LLViewerMediaImpl::handleMouseUp(S32 x, S32 y, MASK mask) 
{ 
	// NOTE: this is called when the mouse is released when we have capture.
	// Due to the way mouse coordinates are mapped to the object, we can't use the x and y coordinates that come in with the event.
	
	if(hasMouseCapture())
	{
		// Release the mouse -- this will also send a mouseup to the media
		gFocusMgr.setMouseCapture( FALSE );
	}

	return TRUE; 
}
Пример #26
0
void LLSlider::draw()
{
	// since thumb image might still be decoding, need thumb to accomodate image size
	updateThumbRect();

	// Draw background and thumb.

	// drawing solids requires texturing be disabled
	gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);

	F32 opacity = getEnabled() ? 1.f : 0.3f;
	LLColor4 center_color = (mThumbCenterColor % opacity);
	LLColor4 track_color = (mTrackColor % opacity);

	// Track
	LLRect track_rect(mThumbImage->getWidth() / 2, 
						getLocalRect().getCenterY() + (mTrackImage->getHeight() / 2), 
						getRect().getWidth() - mThumbImage->getWidth() / 2, 
						getLocalRect().getCenterY() - (mTrackImage->getHeight() / 2) );
	LLRect highlight_rect(track_rect.mLeft, track_rect.mTop, mThumbRect.getCenterX(), track_rect.mBottom);
	mTrackImage->draw(track_rect);
	mTrackHighlightImage->draw(highlight_rect);

	// Thumb
	if( hasMouseCapture() )
	{
		// Show ghost where thumb was before dragging began.
		mThumbImage->draw(mDragStartThumbRect, mThumbCenterColor % 0.3f);
	}
	if (hasFocus())
	{
		// Draw focus highlighting.
		mThumbImage->drawBorder(mThumbRect, gFocusMgr.getFocusColor(), gFocusMgr.getFocusFlashWidth());
	}
	// Fill in the thumb.
	mThumbImage->draw(mThumbRect, hasMouseCapture() ? mThumbOutlineColor : center_color);

	LLUICtrl::draw();
}
BOOL LLJoystick::handleMouseUp(S32 x, S32 y, MASK mask)
{
	// llinfos << "joystick mouse up " << x << ", " << y << llendl;

	if( hasMouseCapture() )
	{
		mLastMouse.set(x, y);
		mHeldDown = FALSE;
		onMouseUp();
	}

	return LLButton::handleMouseUp(x, y, mask);
}
Пример #28
0
BOOL LLScrollbar::handleMouseUp(S32 x, S32 y, MASK mask)
{
    BOOL handled = FALSE;
    if( hasMouseCapture() )
    {
        gFocusMgr.setMouseCapture( NULL );
        handled = TRUE;
    }
    else
    {
        // Opaque, so don't just check children
        handled = LLView::handleMouseUp( x, y, mask );
    }

    return handled;
}
Пример #29
0
BOOL LLResizeBar::handleMouseUp(S32 x, S32 y, MASK mask)
{
	BOOL	handled = FALSE;

	if( hasMouseCapture() )
	{
		// Release the mouse
		gFocusMgr.setMouseCapture( NULL );
		handled = TRUE;
	}
	else
	{
		handled = TRUE;
	}
	return handled;
}
Пример #30
0
BOOL LLToolBrushLand::handleMouseUp(S32 x, S32 y, MASK mask)
{
	BOOL handled = FALSE;
	mLastAffectedRegions.clear();
	if( hasMouseCapture() )
	{
		// Release the mouse
		setMouseCapture( FALSE );

		LLViewerParcelMgr::getInstance()->setSelectionVisible(TRUE);

		gIdleCallbacks.deleteFunction( &LLToolBrushLand::onIdle, (void*)this );
		handled = TRUE;
	}

	return handled;
}