//----------------------------------------------------------------------------- // Purpose: Handles left mouse button down events in the 2D view. // Input : Per CWnd::OnLButtonDown. // Output : Returns true if the message was handled, false if not. //----------------------------------------------------------------------------- bool Cordon3D::OnLMouseDown2D(CMapView2D *pView, UINT nFlags, const Vector2D &vPoint) { Tool3D::OnLMouseDown2D(pView, nFlags, vPoint); Vector vecWorld; pView->ClientToWorld(vecWorld, vPoint); unsigned int uConstraints = GetConstraints( nFlags ); if ( HitTest(pView, vPoint, true) ) { StartTranslation( pView, vPoint, m_LastHitTestHandle ); } else { // getvisiblepoint fills in any coord that's still set to COORD_NOTINIT: vecWorld[pView->axThird] = COORD_NOTINIT; m_pDocument->GetBestVisiblePoint(vecWorld); // snap starting position to grid if ( uConstraints & constrainSnap ) m_pDocument->Snap(vecWorld,uConstraints); StartNew( pView, vPoint, vecWorld, Vector(0,0,0) ); } return true; }
//----------------------------------------------------------------------------- // Purpose: // Input : pView - // nFlags - // point - // Output : Returns true on success, false on failure. //----------------------------------------------------------------------------- bool Marker3D::OnLMouseDown2D(CMapView2D *pView, UINT nFlags, CPoint point) { CMapDoc *pDoc = pView->GetDocument(); if (pDoc == NULL) { return true; } CMapWorld *pWorld = pDoc->GetMapWorld(); m_bLButtonDown = true; pView->SetCapture(); // // Convert to some odd coordinate space that the base tools code uses. // CPoint ptScreen = point; ptScreen.x += pView->GetScrollPos(SB_HORZ); ptScreen.y += pView->GetScrollPos(SB_VERT); // // Convert point to world coords. // pView->ClientToWorld(point); Vector ptOrg = vec3_origin; ptOrg[axHorz] = point.x; ptOrg[axVert] = point.y; // // Snap starting position to grid. // if (!(GetAsyncKeyState(VK_MENU) & 0x8000)) { pDoc->Snap(ptOrg); } StartNew(ptOrg); pView->SetUpdateFlag(CMapView2D::updTool); return true; }
void *MusikFaderThread::Entry() { wxCommandEvent NextSongEvt( wxEVT_COMMAND_MENU_SELECTED, MUSIK_PLAYER_NEXT_SONG ); while ( !TestDestroy() ) { if ( wxGetApp().Player.IsPlaying() ) { //-----------------------------------------------------// //--- check the player flag to see if we need ---// //--- to trigger the crossfade begin thread ---// //-----------------------------------------------------// if ( wxGetApp().Player.BeginFade() ) { //-------------------------------------------------// //--- kill the existing crossfade thread (if ---// //--- it exists still) ---// //-------------------------------------------------// if ( IsCrossfaderActive() ) { CrossfaderAbort(); CrossfaderStop(); } else { //-------------------------------------------------// //--- let the player know we got the message ---// //-------------------------------------------------// wxGetApp().Player.CaughtBeginFade(); //-------------------------------------------------// //--- if no old crossfader is active, fire up a ---// //--- new one. if there was one active, once it ---// //--- cleans up, an event will be posted to ---// //--- start a new one. ---// //-------------------------------------------------// StartNew(); } } if ( ( !wxGetApp().Player.IsStartingNext() ) && ( !wxGetApp().Player.IsFading() ) && ( wxGetApp().Player.GetTimeLeft( FMOD_MSEC ) <= ( wxGetApp().Prefs.nFadeDuration + 1000 ) ) ) { //-------------------------------------------------// //--- if there is no fading at all going on, ---// //--- and there is 10 mseconds or less playback ---// //--- time left, go ahead and start up the next ---// //--- track ---// //-------------------------------------------------// if ( (( wxGetApp().Prefs.bGlobalFadeEnable == 0 ) || ( wxGetApp().Prefs.bFadeEnable == 0 )) && ( wxGetApp().Player.GetTimeLeft( FMOD_MSEC ) <= 10 ) ) { if(wxGetApp().Player.IsPlaying()) { wxGetApp().Player.SetStartingNext( true ); wxPostEvent( &wxGetApp().Player, NextSongEvt ); } } //-------------------------------------------------// //--- if currently we are not fading, but the ---// //--- crossfader is enabled, check to see if ---// //--- the duration is such that we should ---// //--- queue up the next song and start the fade ---// //-------------------------------------------------// else if ( ( wxGetApp().Prefs.bGlobalFadeEnable == 1 ) && ( wxGetApp().Prefs.bFadeEnable == 1 ) && ( wxGetApp().Player.GetTimeLeft( FMOD_MSEC ) <= wxGetApp().Prefs.nFadeDuration ) ) { wxGetApp().Player.SetStartingNext( true ); wxPostEvent( &wxGetApp().Player, NextSongEvt ); Yield(); } } } Sleep( 10 ); } return NULL; }
//----------------------------------------------------------------------------- // Purpose: Handles left mouse button down events in the 2D view. // Input : Per CWnd::OnLButtonDown. // Output : Returns true if the message was handled, false if not. //----------------------------------------------------------------------------- bool Clipper3D::OnLMouseDown2D(CMapView2D *pView, UINT nFlags, CPoint point) { CMapDoc *pDoc = pView->GetDocument(); CMapWorld *pWorld = pDoc->GetMapWorld(); m_ptLDownClient = point; m_bLButtonDown = true; pView->SetCapture(); // // Convert to some odd coordinate space that the base tools code uses. // CPoint ptScreen = point; ptScreen.x += pView->GetScrollPos(SB_HORZ); ptScreen.y += pView->GetScrollPos(SB_VERT); // // Convert point to world coords. // pView->ClientToWorld(point); Vector ptOrg( COORD_NOTINIT, COORD_NOTINIT, COORD_NOTINIT ); ptOrg[axHorz] = point.x; ptOrg[axVert] = point.y; // getvisiblepoint fills in any coord that's still set to COORD_NOTINIT: pDoc->GetBestVisiblePoint(ptOrg); // snap starting position to grid if (!(GetAsyncKeyState(VK_MENU) & 0x8000)) { pDoc->Snap(ptOrg); } BOOL bStarting = FALSE; // if the tool is not empty, and shift is not held down (to // start a new camera), don't do anything. if(!IsEmpty()) { if(!StartTranslation(ptScreen)) { if (nFlags & MK_SHIFT) { SetEmpty(); bStarting = TRUE; } else { goto _DoNothing; } } } else { bStarting = TRUE; } SetClipObjects(pDoc->Selection_GetList()); if (bStarting) { StartNew(ptOrg); pView->SetUpdateFlag(CMapView2D::updTool); } _DoNothing: return true; }