void QmitkNavigationToolCreationWidget::CreateConnections()
{
  if (m_Controls)
  {
    connect((QObject*)(m_Controls->m_TrackingDeviceTypeChooser), SIGNAL(currentIndexChanged(int)), this, SLOT(GetValuesFromGuiElements()));
    connect((QObject*)(m_Controls->m_ToolNameEdit), SIGNAL(textChanged(const QString)), this, SLOT(GetValuesFromGuiElements()));
    connect((QObject*)(m_Controls->m_ToolTypeChooser), SIGNAL(currentIndexChanged(int)), this, SLOT(GetValuesFromGuiElements()));
    connect((QObject*)(m_Controls->m_IdentifierEdit), SIGNAL(textChanged(const QString)), this, SLOT(GetValuesFromGuiElements()));
    connect((QObject*)(m_Controls->m_SerialNumberEdit), SIGNAL(textChanged(const QString)), this, SLOT(GetValuesFromGuiElements()));
    connect((QObject*)(m_Controls->m_ToolAxisX), SIGNAL(valueChanged(int)), this, SLOT(GetValuesFromGuiElements()));
    connect((QObject*)(m_Controls->m_ToolAxisY), SIGNAL(valueChanged(int)), this, SLOT(GetValuesFromGuiElements()));
    connect((QObject*)(m_Controls->m_ToolAxisZ), SIGNAL(valueChanged(int)), this, SLOT(GetValuesFromGuiElements()));

    //Buttons
    connect((QObject*)(m_Controls->m_LoadCalibrationFile), SIGNAL(clicked()), this, SLOT(OnLoadCalibrationFile()));
    connect(m_Controls->m_Surface_Use_Other, SIGNAL(toggled(bool)), this, SLOT(OnSurfaceUseToggled()));
    connect(m_Controls->m_Surface_Load_File, SIGNAL(toggled(bool)), this, SLOT(OnSurfaceUseToggled()));
    connect((QObject*)(m_Controls->m_LoadSurface), SIGNAL(clicked()), this, SLOT(OnLoadSurface()));
    connect((QObject*)(m_Controls->m_EditToolTip), SIGNAL(clicked()), this, SLOT(OnEditToolTip()));

    connect((QObject*)(m_ToolTransformationWidget), SIGNAL(EditToolTipFinished(mitk::AffineTransform3D::Pointer)), this,
      SLOT(OnEditToolTipFinished(mitk::AffineTransform3D::Pointer)));

    connect((QObject*)(m_Controls->m_cancel), SIGNAL(clicked()), this, SLOT(OnCancel()));
    connect((QObject*)(m_Controls->m_finished), SIGNAL(clicked()), this, SLOT(OnFinished()));
  }
}
예제 #2
0
void UPawnAction::OnPopped()
{
	// not calling OnFinish if action haven't actually started
	if (bFailedToStart == false)
	{
		OnFinished(FinishResult);
	}
}
void QmitkNavigationToolCreationWidget::CreateConnections()
  {
    if ( m_Controls )
    {
      connect( (QObject*)(m_Controls->m_cancel), SIGNAL(clicked()), this, SLOT(OnCancel()) );
      connect( (QObject*)(m_Controls->m_finished), SIGNAL(clicked()), this, SLOT(OnFinished()) );
      connect( (QObject*)(m_Controls->m_LoadSurface), SIGNAL(clicked()), this, SLOT(OnLoadSurface()) );
      connect( (QObject*)(m_Controls->m_LoadCalibrationFile), SIGNAL(clicked()), this, SLOT(OnLoadCalibrationFile()) );
    }
  }
void QmitkNavigationToolCreationWidget::CreateConnections()
{
  if ( m_Controls )
  {
    connect( (QObject*)(m_Controls->m_cancel), SIGNAL(clicked()), this, SLOT(OnCancel()) );
    connect( (QObject*)(m_Controls->m_finished), SIGNAL(clicked()), this, SLOT(OnFinished()) );
    connect( (QObject*)(m_Controls->m_LoadSurface), SIGNAL(clicked()), this, SLOT(OnLoadSurface()) );
    connect( (QObject*)(m_Controls->m_LoadCalibrationFile), SIGNAL(clicked()), this, SLOT(OnLoadCalibrationFile()) );
    connect( (QObject*)(m_Controls->m_ShowAdvancedOptionsPB), SIGNAL(toggled(bool)), this, SLOT(OnShowAdvancedOptions(bool)) );
    connect( (QObject*)(m_AdvancedWidget), SIGNAL(DialogCloseRequested()), this, SLOT(OnProcessDialogCloseRequest()) );
    connect( (QObject*)(m_AdvancedWidget), SIGNAL(RetrieveDataForManualToolTipManipulation()), this, SLOT(OnRetrieveDataForManualTooltipManipulation()) );

    connect( m_Controls->m_Surface_Use_Other, SIGNAL(toggled(bool)), this, SLOT(OnSurfaceUseOtherToggled(bool)));
  }
}
예제 #5
0
// Track mouse
bool CMouseTracker::Track(HWND hWnd, POINT& pt)
{
	// Capture mouse
	SetCapture(hWnd);

	// Constrain to bounds
	SnapMouse(pt);
	ConstrainMouse(pt);

	// Store attributes
	m_hWnd=hWnd;
	m_ptStart=pt;

	if (m_bLockWindowUpdate)
		{
		// Update the window
		RedrawWindow(hWnd, NULL, NULL, RDW_UPDATENOW|RDW_ALLCHILDREN);
		LockWindowUpdate(m_hWnd);
		}

	// Call start handler
	OnStarting(m_ptStart);

	if (m_bAutoScroll)
		{
		m_dwLastScrollAt=GetTickCount();
		SetTimer(m_hWnd, AUTOSCROLL_TIMER_ID, AUTOSCROLL_TIMER_PERIOD, NULL);
		}

	if (m_bHoverDetect)
		{
		m_dwHoverStart=GetTickCount();
		SetTimer(m_hWnd, HOVER_TIMER_ID, HOVER_TIMER_PERIOD, NULL);
		}


	// Spin message loop
	bool bCancelled=true;
	bool bMoved=false;
	while (true)
		{
		// Get a message
		MSG msg;
		if (!GetMessage(&msg, NULL, 0, 0))
			break;

		// Dispatch all non-input messages
		if (!IsInputMessage(msg.message) && 
				!(msg.message==WM_TIMER && (msg.wParam==AUTOSCROLL_TIMER_ID || msg.wParam==HOVER_TIMER_ID)))
			{
			DispatchMessage(&msg);
			continue;
			}

		// Quit if lost capture
		if (GetCapture()!=m_hWnd)
			break;

		// Handle message
		switch (msg.message)
			{
			case WM_TIMER:
				if (m_bHoverDetect && m_dwHoverStart && msg.wParam==HOVER_TIMER_ID)
					{
					if (GetTickCount() > m_dwHoverStart+HOVER_TIMEOUT)
						{
						POINT pt;
						GetCursorPos(&pt);
						ScreenToClient(m_hWnd, &pt);
						m_dwHoverStart=0;
						OnHover(pt);
						}

					break;
					}


				if (msg.wParam!=AUTOSCROLL_TIMER_ID)
					break;
				{
				POINT pt;
				GetCursorPos(&pt);
				ScreenToClient(m_hWnd, &pt);
				msg.lParam=MAKELPARAM(pt.x, pt.y);
				// Fall throught to fake a WM_MOUSEMOVE
				}

			case WM_MOUSEMOVE:
				{
				// Get new point
				POINT ptNew;
				ptNew.x=(int)(short)LOWORD(msg.lParam);
				ptNew.y=(int)(short)HIWORD(msg.lParam);

				if (ptNew.x!=m_ptStart.x || ptNew.y!=m_ptStart.y)
					bMoved=true;

				// Get client rectangle
				if (m_bAutoScroll)
					{
					// Outside client area?
					RECT rcClient;
					GetClientRect(m_hWnd, &rcClient);
					if (!PtInRect(&rcClient, ptNew) && GetTickCount()>m_dwLastScrollAt + AUTOSCROLL_FREQUENCY)
						{
						// Kill old feedback 
						DrawFeedback();

						// Release DC
						if (m_bLockWindowUpdate)	
							{
							LockWindowUpdate(NULL);
							}

						// Do scrolling
						if (ptNew.x<rcClient.left)
							SendMessage(m_hWnd, WM_HSCROLL, SB_LINEUP, 0);
						if (ptNew.x>rcClient.right)
							SendMessage(m_hWnd, WM_HSCROLL, SB_LINEDOWN, 0);
						if (ptNew.y<rcClient.top)
							SendMessage(m_hWnd, WM_VSCROLL, SB_LINEUP, 0);
						if (ptNew.y>rcClient.bottom)
							SendMessage(m_hWnd, WM_VSCROLL, SB_LINEDOWN, 0);
						UpdateWindow(m_hWnd);

						// Get a newly clipped DC
						if (m_bLockWindowUpdate)
							{
							RedrawWindow(hWnd, NULL, NULL, RDW_UPDATENOW|RDW_ALLCHILDREN);
							LockWindowUpdate(m_hWnd);
							}

						// Redraw feedback
						DrawFeedback();

						m_dwLastScrollAt=GetTickCount();
						}
					}

				// Adjust for scrolling
				POINT ptScrollOffset=GetScrollOffset();
				ptNew.x+=ptScrollOffset.x;
				ptNew.y+=ptScrollOffset.y;

				// Constrain to bounds
				SnapMouse(ptNew);
				ConstrainMouse(ptNew);

				// Only handle if still moved after constraining
				if (ptNew.x!=pt.x || ptNew.y!=pt.y || msg.message==WM_TIMER)
					{
					if (msg.message!=WM_TIMER)	
						{
						m_dwHoverStart=GetTickCount();
						}
			
					// Call handler
					OnMove(pt, ptNew);

					// Store new point
					pt=ptNew;
					}
				}
				break;

			case WM_LBUTTONUP:
			case WM_RBUTTONUP:
				bCancelled=false;
				ReleaseCapture();
				break;
			
			case WM_RBUTTONDOWN:
				ReleaseCapture();
				break;

			case WM_KEYDOWN:
				if (msg.wParam==VK_ESCAPE)
					{
					ReleaseCapture();
					break;
					}
				// Fall through

			case WM_KEYUP:
			case WM_SYSKEYDOWN:
			case WM_SYSKEYUP:
				// Call handler
				OnMove(pt, pt);
				break;
			}

		// Quit if lost capture
		if (GetCapture()!=m_hWnd)
			break;
		}

	if (m_bAutoScroll)
		{
		KillTimer(m_hWnd, AUTOSCROLL_TIMER_ID);
		}

	if (m_bHoverDetect)
		{
		KillTimer(m_hWnd, HOVER_TIMER_ID);
		}

	// Finished
	OnFinished(pt, bCancelled);

	// Clean up
	if (m_bLockWindowUpdate)
		{
		LockWindowUpdate(NULL);
		}

	return bMoved && !bCancelled;


}
VolumeFilterWorkerThread::VolumeFilterWorkerThread(QObject *parent) :
    QThread(parent), m_filter(NULL)
{
  connect(this, SIGNAL(finished()), this, SLOT(OnFinished()));
}