コード例 #1
0
void PlotWindow::endSelection(const QPointF& point)
{
	if (_x_axis_measurement->currentIndex() == 0) // time
		emit endSelection(_data_log->indexFromTime(point.x()));
	else // distance
		emit endSelection(_data_log->indexFromDist(point.x()));
}
コード例 #2
0
ファイル: graphwidget.cpp プロジェクト: johnmave126/Animator
void GraphWidget::endCtrlPtSelection(const int iMouseX, const int iMouseY)
{
	endSelection(iMouseX, iMouseY);

	m_bHasCtrlPtSelection = false;

	deselectCtrlPts();

	if (m_rectSelectionRect.width() > 0.0f && m_rectSelectionRect.height() > 0.0f) {
		if (m_ivActiveCurves.size() > 0) {
			for (int i = 0; i < m_ivActiveCurves.size(); ++i) {
				int iCurve = m_ivActiveCurves[i];

				for (int iCtrlPt = 0; iCtrlPt < m_pcrvvCurves[iCurve]->controlPointCount(); ++iCtrlPt) {
					Point ptCtrlPtWndCoord, ptCtrlPt;
					m_pcrvvCurves[iCurve]->getControlPoint(iCtrlPt, ptCtrlPt);
					ptCtrlPtWndCoord = curveToWindow(iCurve, ptCtrlPt);

					if (ptCtrlPtWndCoord.x >= m_rectSelectionRect.left() && 
						ptCtrlPtWndCoord.x <= m_rectSelectionRect.right() &&
						ptCtrlPtWndCoord.y <= m_rectSelectionRect.top() &&
						ptCtrlPtWndCoord.y >= m_rectSelectionRect.bottom()) {
						m_ivvCurrCtrlPts[iCurve].push_back(iCtrlPt);
					}
				}
			}
		}
	}
}
コード例 #3
0
ファイル: graphwidget.cpp プロジェクト: johnmave126/Animator
void GraphWidget::endZoomSelection(const int iMouseX, const int iMouseY)
{
	endSelection(iMouseX, iMouseY);

	m_bHasZoomSelection = false;

	if (m_rectSelectionRect.width() > 0.0f && m_rectSelectionRect.height() > 0.0f) {
		Rect rectOldViewport = m_rectCurrViewport;

		m_rectCurrViewport.left(
			rectOldViewport.width() * m_rectSelectionRect.left() / (float)w() + rectOldViewport.left());
		m_rectCurrViewport.right(
			rectOldViewport.width() * m_rectSelectionRect.right() / (float)w() + rectOldViewport.left());
		m_rectCurrViewport.bottom(
			rectOldViewport.height() * ((float)h() - m_rectSelectionRect.top()) / (float)h() + rectOldViewport.bottom());
		m_rectCurrViewport.top(
			rectOldViewport.height() * ((float)h() - m_rectSelectionRect.bottom()) / (float)h() + rectOldViewport.bottom());
	}
}
コード例 #4
0
BOOL LLViewerTextEditor::handleMouseUp(S32 x, S32 y, MASK mask)
{
	BOOL	handled = FALSE;

	// let scrollbar have first dibs
	handled = LLView::childrenHandleMouseUp(x, y, mask) != NULL;

	// Used to enable I Agree checkbox if the user scrolled through entire text
	BOOL was_scrolled_to_bottom = (mScrollbar->getDocPos() == mScrollbar->getDocPosMax());
	if (mOnScrollEndCallback && was_scrolled_to_bottom)
	{
		mOnScrollEndCallback(mOnScrollEndData);
	}

	if( !handled && mTakesNonScrollClicks)
	{
		if( mIsSelecting )
		{
			// Finish selection
			if( y > getTextRect().mTop )
			{
				mScrollbar->setDocPos( mScrollbar->getDocPos() - 1 );
			}
			else
			if( y < getTextRect().mBottom )
			{
				mScrollbar->setDocPos( mScrollbar->getDocPos() + 1 );
			}
			
			setCursorAtLocalPos( x, y, TRUE );
			endSelection();

			updateScrollFromCursor();
		}
		
		if( !hasSelection() )
		{
			handleMouseUpOverSegment( x, y, mask );
		}

		handled = TRUE;
	}

	// Delay cursor flashing
	resetKeystrokeTimer();

	if( hasMouseCapture()  )
	{
		if (mDragItem)
		{
			// mouse down was on an item
			S32 dx = x - mMouseDownX;
			S32 dy = y - mMouseDownY;
			if (-2 < dx && dx < 2 && -2 < dy && dy < 2)
			{
				if(mDragItemSaved)
				{
					openEmbeddedItem(mDragItem);
				}else
				{
					showUnsavedAlertDialog(mDragItem);
				}
			}
		}
		mDragItem = NULL;
		gFocusMgr.setMouseCapture( NULL );
		handled = TRUE;
	}

	return handled;
}