void tui::LayoutCanvas::OnMouseWheel(wxMouseEvent& event)
{
   int delta    = event.GetWheelDelta();
   int fulldist = event.GetWheelRotation();
   double scroll = fulldist / delta;
   wxCommandEvent eventZOOM(wxEVT_CANVAS_ZOOM);
   if (event.ShiftDown())
   {
      if      ( 1 <= scroll) eventZOOM.SetInt(ZOOM_UP);
      else if (-1 >= scroll) eventZOOM.SetInt(ZOOM_DOWN);
   }
   else if (event.ControlDown())
   {
      if      ( 1 <= scroll) eventZOOM.SetInt(ZOOM_RIGHT);
      else if (-1 >= scroll) eventZOOM.SetInt(ZOOM_LEFT);
   }
   else
   {
      const double scalefactor = event.AltDown() ? 0.8 : 0.5;
      CTM tmpmtrx;
      TP markerpos(event.GetX(), event.GetY());
      if      ( 1 <= scroll)
         tmpmtrx.Scale(scalefactor,scalefactor);
      else if (-1 >= scroll)
         tmpmtrx.Scale(1/scalefactor,1/scalefactor);
      tmpmtrx.Translate(markerpos * _LayCTM - markerpos * _LayCTM * tmpmtrx);
      DBbox* box = DEBUG_NEW DBbox( lp_BL, lp_TR );
      (*box) = (*box) * tmpmtrx;
      eventZOOM.SetInt(tui::ZOOM_WINDOW);
      eventZOOM.SetClientData(static_cast<void*>(box));
   }
   OnZoom(eventZOOM);
   PointUpdate(event.GetX(), event.GetY());
}
Example #2
0
void tcOOBView::OnLButtonDClick(wxMouseEvent& event)
{
    wxPoint point = event.GetPosition();

    if (tsOOBInfo* info = 
        ButtonContainingPoint(wxRealPoint((float)point.x,(float)point.y)))
    {
        long new_key = info->mnID;
        if (new_key != -1)
        {
            long flags = 0;
            if (event.ShiftDown()) flags += 1;
            if (event.ControlDown()) flags += 2;
            if (event.AltDown()) flags += 4;

            wxCommandEvent command(wxEVT_COMMAND_BUTTON_CLICKED, ID_DCLICKHOOK) ;    
            command.SetEventObject(this);
            command.SetExtraLong(flags);
            AddPendingEvent(command);
        }
        mnSelectedKey = new_key;

        tcSound::Get()->PlayEffect("ShortBeep");
    }
}
Example #3
0
/// Left-double-click
void InstanceCtrl::OnLeftDClick(wxMouseEvent& event)
{
	VisualCoord clickedIndex;
	HitTest(event.GetPosition(), clickedIndex);
	if (clickedIndex.isItem())
	{
		int flags = 0;
		if (event.ControlDown())
			flags |= wxINST_CTRL_DOWN;
		if (event.ShiftDown())
			flags |= wxINST_SHIFT_DOWN;
		if (event.AltDown())
			flags |= wxINST_ALT_DOWN;
			
		InstanceCtrlEvent cmdEvent(
		    wxEVT_COMMAND_INST_ACTIVATE,
		    GetId());
		cmdEvent.SetEventObject(this);
		cmdEvent.SetItemIndex(clickedIndex);
		int clickedID = IDFromIndex(clickedIndex);
		cmdEvent.SetItemID(clickedID);
		cmdEvent.SetFlags(flags);
		cmdEvent.SetPosition(event.GetPosition());
		GetEventHandler()->ProcessEvent(cmdEvent);
	}
	else if(clickedIndex.isHeader())
	{
		ToggleGroup(clickedIndex.groupIndex);
	}
}
Example #4
0
void EEViewPort::OnMouseRightDown(wxMouseEvent& event)
{
	if (event.AltDown())
		m_bZoomingStarted = true;
	else
		m_bStrafingStarted = true;	
}
Example #5
0
void InstanceCtrl::OnMouseMotion(wxMouseEvent& event)
{
	// Only start DnD if the mouse is over the selected instance.
	VisualCoord coord;
	HitTest(event.GetPosition(), coord);
	InstanceVisual *instVisual = GetItem(coord);

	if (event.Dragging() && instVisual && m_instList->GetSelectedInstance() == instVisual->GetInstance())
	{
		int flags = 0;
		if (event.ControlDown())
			flags |= wxINST_CTRL_DOWN;
		if (event.ShiftDown())
			flags |= wxINST_SHIFT_DOWN;
		if (event.AltDown())
			flags |= wxINST_ALT_DOWN;

		InstanceCtrlEvent cmdEvent(
			wxEVT_COMMAND_INST_DRAG,
			GetId());
		cmdEvent.SetEventObject(this);
		cmdEvent.SetFlags(flags);
		GetEventHandler()->ProcessEvent(cmdEvent);
	}
	else
	{
		event.Skip();
	}
}
Example #6
0
/// Left-click
void InstanceCtrl::OnLeftClick(wxMouseEvent& event)
{
	SetFocus();
	VisualCoord clickedIndex;
	HitTest(event.GetPosition(), clickedIndex);
	if(clickedIndex.isItem())
	{
		int flags = 0;
		if (event.ControlDown())
			flags |= wxINST_CTRL_DOWN;
		if (event.ShiftDown())
			flags |= wxINST_SHIFT_DOWN;
		if (event.AltDown())
			flags |= wxINST_ALT_DOWN;
			
		EnsureVisible(clickedIndex);
		DoSelection(clickedIndex);
		SetIntendedColumn(clickedIndex);
	}
	else if(clickedIndex.isHeaderTicker())
	{
		ToggleGroup(clickedIndex.groupIndex);
	}
	else ClearSelections();
}
Example #7
0
/* InputKeyCtrl::onMouseDown
 * Called when a mouse button is clicked in the control
 *******************************************************************/
void InputKeyCtrl::onMouseDown(wxMouseEvent& e)
{
	// Middle button
	if (e.GetEventType() == wxEVT_MIDDLE_DOWN)
		key.key = "mouse3";

	// Button 4
	else if (e.GetEventType() == wxEVT_AUX1_DOWN)
		key.key = "mouse4";

	// Button 5
	else if (e.GetEventType() == wxEVT_AUX2_DOWN)
		key.key = "mouse5";

	// Mouse wheel
	else if (e.GetEventType() == wxEVT_MOUSEWHEEL)
	{
		if (e.GetWheelRotation() > 0)
			key.key = "mwheelup";
		else if (e.GetWheelRotation() < 0)
			key.key = "mwheeldown";
	}

	key.alt = e.AltDown();
	key.ctrl = e.CmdDown();
	key.shift = e.ShiftDown();
	SetValue(key.as_string());
}
Example #8
0
void wxWebView::OnMouseEvents(wxMouseEvent& event)
{
    event.Skip();
    
    if (!m_impl->page)
        return; 
        
    WebCore::Frame* frame = m_mainFrame->GetFrame();  
    if (!frame || !frame->view())
        return;
    
    wxPoint globalPoint = ClientToScreen(event.GetPosition());

    wxEventType type = event.GetEventType();
    
    if (type == wxEVT_MOUSEWHEEL) {
        if (m_mouseWheelZooms && event.ControlDown() && !event.AltDown() && !event.ShiftDown()) {
            if (event.GetWheelRotation() < 0)
                DecreaseTextSize();
            else if (event.GetWheelRotation() > 0)
                IncreaseTextSize();
        } else {
            WebCore::PlatformWheelEvent wkEvent(event, globalPoint);
            frame->eventHandler()->handleWheelEvent(wkEvent);
        }

        return;
    }
    
    int clickCount = event.ButtonDClick() ? 2 : 1;

    if (clickCount == 1 && m_impl->tripleClickTimer.IsRunning()) {
        wxPoint diff(event.GetPosition() - m_impl->tripleClickPos);
        if (abs(diff.x) <= wxSystemSettings::GetMetric(wxSYS_DCLICK_X) &&
            abs(diff.y) <= wxSystemSettings::GetMetric(wxSYS_DCLICK_Y)) {
            clickCount = 3;
        }
    } else if (clickCount == 2) {
        m_impl->tripleClickTimer.Start(getDoubleClickTime(), false);
        m_impl->tripleClickPos = event.GetPosition();
    }
    
    WebCore::PlatformMouseEvent wkEvent(event, globalPoint, clickCount);

    if (type == wxEVT_LEFT_DOWN || type == wxEVT_MIDDLE_DOWN || type == wxEVT_RIGHT_DOWN || 
                type == wxEVT_LEFT_DCLICK || type == wxEVT_MIDDLE_DCLICK || type == wxEVT_RIGHT_DCLICK) {
        frame->eventHandler()->handleMousePressEvent(wkEvent);
        if (!HasCapture())
            CaptureMouse();
    } else if (type == wxEVT_LEFT_UP || type == wxEVT_MIDDLE_UP || type == wxEVT_RIGHT_UP) {
        frame->eventHandler()->handleMouseReleaseEvent(wkEvent);
        while (HasCapture())
            ReleaseMouse();
    } else if (type == wxEVT_MOTION || type == wxEVT_ENTER_WINDOW || type == wxEVT_LEAVE_WINDOW)
        frame->eventHandler()->mouseMoved(wkEvent);
}
Example #9
0
void               P3DCanvas3D::OnMouseMotion   (wxMouseEvent       &event)
 {
  long             dx,dy;

  if ((m_x < 0) || (m_y < 0))
   {
    m_x = event.GetX(); m_y = event.GetY();

    return;
   }

  dx = event.GetX() - m_x;
  dy = event.GetY() - m_y;

  if ((dx != 0) || (dy != 0))
   {
    if (event.MiddleIsDown() || event.AltDown())
     {
      if (event.ShiftDown())
       {
        camera.CenterMoveCS(dx * BaseNearHalfWidth * ZoomFactor * 2.0f / viewport.getWidth(),
                            -dy * BaseNearHalfWidth * ZoomFactor * 2.0f / viewport.getAspect() / viewport.getHeight(),
                            0.0f);
       }
      else
       {
        const P3DCameraControlPrefs   *CameraControlPrefs;

        CameraControlPrefs = P3DApp::GetApp()->GetCameraControlPrefs();

        if (dy != 0)
         {
          camera.RotateCS(dy * CameraControlPrefs->MouseRotYSens,1.0f,0.0f,0.0f);
         }

        if (dx != 0)
         {
          if (CameraControlPrefs->MouseRotYCS)
           {
            camera.RotateCS(dx * CameraControlPrefs->MouseRotXSens,0.0f,1.0f,0.0f);
           }
          else
           {
            camera.RotateWS(dx * CameraControlPrefs->MouseRotXSens,0.0f,1.0f,0.0f);
           }
         }
       }
     }

    m_x += dx; m_y += dy;
   }

  P3DApp::GetApp()->InvalidateCamera();
  Refresh();
 }
Example #10
0
void ActorSceneCanvas::OnMiddleDown(wxMouseEvent& e)
{
    SetFocus();

    if (!GetSceneManipulator())
        return;

    if (HasCapture())
        return;

    wxASSERT(!m_pCameraManip);
    wxASSERT(mDragButton == wxMOUSE_BTN_NONE);

    if (!e.ControlDown() && !e.AltDown() && !e.ShiftDown() && !e.MetaDown())
    {
        // (None)
        m_pCameraManip = GetSceneManipulator()->getManip("CameraDragMove");
    }
    else if (!e.ControlDown() && !e.AltDown() && e.ShiftDown() && !e.MetaDown())
    {
        // Shift
        m_pCameraManip = GetSceneManipulator()->getManip("CameraDragRotate");
    }
    else if (e.ControlDown() && !e.AltDown() && !e.ShiftDown() && !e.MetaDown())
    {
        // Ctrl
        m_pCameraManip = GetSceneManipulator()->getManip("CameraPan");
    }
    else if (!e.ControlDown() && e.AltDown() && !e.ShiftDown() && !e.MetaDown())
    {
        // Alt
        m_pCameraManip = GetSceneManipulator()->getManip("CameraRotate");
    }

    if (m_pCameraManip)
    {
        mDragButton = e.GetButton();
        m_pCameraManip->onBegin(e.GetX(), e.GetY());
        CaptureMouse();
    }

}
PlatformWheelEvent::PlatformWheelEvent(const wxMouseEvent& event, const wxPoint& globalPoint)
    : m_position(event.GetPosition())
    , m_globalPosition(globalPoint)
    , m_shiftKey(event.ShiftDown())
    , m_ctrlKey(event.ControlDown())
    , m_altKey(event.AltDown())
    , m_metaKey(event.MetaDown()) // FIXME: We'll have to test other browsers
    , m_deltaX(0) // wx doesn't support horizontal mouse wheel scrolling
    , m_deltaY(event.GetWheelRotation())
{

}
//---------------------------------------------------------
void CVIEW_Map_Control::On_Mouse_LUp(wxMouseEvent &event)
{
	if( HasCapture() )
	{
		ReleaseMouse();
	}

	//-----------------------------------------------------
	if( m_Mode != MAP_MODE_SELECT && (event.ControlDown() || event.AltDown()) )	// clipboard copy ?
	{
		return;
	}

	//-----------------------------------------------------
	_Draw_Inverse(m_Mouse_Down, event.GetPosition());
	m_Drag_Mode	= TOOL_INTERACTIVE_DRAG_NONE;

	switch( m_Mode )
	{
	//-----------------------------------------------------
	case MAP_MODE_SELECT:
		if( g_pTool )
		{
			g_pTool->Execute(_Get_Client2World(event.GetPosition()), TOOL_INTERACTIVE_LUP, GET_KEYS(event));
		}
		else if( m_pMap->Find_Layer(Get_Active_Layer()) )
		{
			Get_Active_Layer()->Edit_On_Mouse_Up(_Get_Client2World(event.GetPosition()), _Get_Client2World(1.0), GET_KEYS(event)|TOOL_INTERACTIVE_KEY_LEFT);
		}
		break;

	//-----------------------------------------------------
	case MAP_MODE_DISTANCE:
		_Distance_Add(event.GetPosition());
		break;

	//-----------------------------------------------------
	case MAP_MODE_ZOOM:
		_Zoom(m_Mouse_Down, event.GetPosition());
		break;

	//-----------------------------------------------------
	case MAP_MODE_PAN:
		break;

	//-----------------------------------------------------
	case MAP_MODE_PAN_DOWN:
		Set_Mode(MAP_MODE_PAN);
		_Move(m_Mouse_Down, event.GetPosition());
		break;
	}
}
Example #13
0
void ParameterPanel::OnMouseWheel(wxMouseEvent &event)
{
    double change = 1e-5 * event.GetWheelRotation();
    if (event.ShiftDown())
        change *= 10;
    if (event.CmdDown())
        change *= 100;
    if (event.AltDown())
        change /= 20;
    int n = find_in_rows(event.GetEventObject());
    double new_value = values_[n] + fabs(values_[n]) * change;
    set_value(n, new_value);
    observer_->on_parameter_changed(n);
}
PlatformWheelEvent::PlatformWheelEvent(const wxMouseEvent& event, const wxPoint& globalPoint)
    : m_position(event.GetPosition())
    , m_globalPosition(globalPoint)
    , m_granularity(ScrollByPixelWheelEvent)
    , m_shiftKey(event.ShiftDown())
    , m_ctrlKey(event.ControlDown())
    , m_altKey(event.AltDown())
    , m_metaKey(event.MetaDown()) // FIXME: We'll have to test other browsers
    , m_deltaX(0) // wx doesn't support horizontal mouse wheel scrolling
    , m_deltaY(event.GetWheelRotation() / event.GetWheelDelta())
    , m_wheelTicksX(m_deltaX)
    , m_wheelTicksY(m_deltaY)
    , m_isAccepted(false)
{
    // FIXME: retrieve the user setting for the number of lines to scroll on each wheel event
    m_deltaY *= static_cast<float>(Scrollbar::pixelsPerLineStep());
}
void PlaneOverviewCameraTool::MouseButtonEvent(wxMouseEvent &e)
{
    PlaneOverviewToolHelper * thelper = (PlaneOverviewToolHelper*) helper;
    PlaneOverviewVisualizationState*  state = (PlaneOverviewVisualizationState*) helper->GetVisualizationStatePtr();
//    DEBUG_DEBUG("mouse ov drag button");
    if (((e.CmdDown() || e.AltDown()) && e.LeftDown()) || e.MiddleDown()) {
        down = true;
        start_x = thelper->getPlaneX();
        start_y = thelper->getPlaneY();
        start_pos_x = state->getX();
        start_pos_y = state->getY();
    }
    if (e.LeftUp() || e.MiddleUp()) {
        if (down) {
            down = false;
        }
    }
}
Example #16
0
static void ConvertMouseEvent( wxMouseEvent& event, MouseInputEvent& input )
{
	uint32_t buttons = 0x0;

	buttons |= event.LeftIsDown() ? MouseButtons::Left : 0x0;
	buttons |= event.MiddleIsDown() ? MouseButtons::Middle : 0x0;
	buttons |= event.RightIsDown() ? MouseButtons::Right : 0x0;
	buttons |= event.Aux1IsDown() ? MouseButtons::Backward : 0x0;
	buttons |= event.Aux2IsDown() ? MouseButtons::Forward : 0x0;

	buttons |= event.AltDown() ? AcceleratorButtons::Alt : 0x0;
	buttons |= event.ControlDown() ? AcceleratorButtons::Ctrl : 0x0;
	buttons |= event.ShiftDown() ? AcceleratorButtons::Shift : 0x0;

	input.SetButtons( buttons );

	input.SetPosition( Point( event.GetX(), event.GetY() ) );
}
void PanosphereOverviewCameraTool::MouseButtonEvent(wxMouseEvent &e)
{
//    DEBUG_DEBUG("mouse ov drag button");
    if ((e.ButtonDown() && (!helper->IsMouseOverPano() || e.CmdDown() || e.AltDown())) || e.MiddleDown()) {
        down = true;
        hugin_utils::FDiff2D pos = helper->GetMouseScreenPosition();
        start_x = pos.x;
        start_y = pos.y;
        PanosphereOverviewVisualizationState*  state = (PanosphereOverviewVisualizationState*) helper->GetVisualizationStatePtr();
        start_angx = state->getAngX();
        start_angy = state->getAngY();
    }
    if (e.ButtonUp()) {
        if (down) {
            down = false;
        }
    }
}
Example #18
0
/**
 * Évènement Souris -
 */
void PlayList::MouseEvents(wxMouseEvent &event)
{
    if (event.ControlDown() && event.GetWheelRotation() != 0)
    {
        if (event.GetWheelRotation() < 0)
            MusicManagerSwitcher::getSearch().playNextMusic();
        else
            MusicManagerSwitcher::getSearch().playPreviousMusic();
    }
    else if (event.AltDown() && event.GetWheelRotation() != 0)
    {
        if (event.GetWheelRotation() < 0)
            SliderSon::Get()->SonUp();
        else
            SliderSon::Get()->SonDown();
    }
    else
        event.Skip();
}
Example #19
0
PlatformWheelEvent::PlatformWheelEvent(const wxMouseEvent& event, const wxPoint& globalPoint)
    : m_position(event.GetPosition())
    , m_globalPosition(globalPoint)
    , m_shiftKey(event.ShiftDown())
    , m_ctrlKey(event.ControlDown())
    , m_altKey(event.AltDown())
    , m_metaKey(event.MetaDown()) // FIXME: We'll have to test other browsers
    , m_deltaX(0) // wx doesn't support horizontal mouse wheel scrolling
    , m_deltaY(event.GetWheelRotation() / event.GetWheelDelta())
    , m_isAccepted(false)
    , m_isContinuous(false)
    , m_continuousDeltaX(0)
    , m_continuousDeltaY(0)
{
    // FIXME: retrieve the user setting for the number of lines to scroll on each wheel event
    m_charsToScrollPerDelta = 1;
    m_linesToScrollPerDelta = 1;
    m_pageXScrollMode = false;
    m_pageYScrollMode = false;
}
Example #20
0
///////////////////////////////////////////////////////////////////////////////
// Start tracking mouse movement for moving the camera.
// 
void RenderWindow::OnMouseDown( wxMouseEvent& args )
{
    args.Skip();

    bool modifier = args.ControlDown() || args.MetaDown() || args.ShiftDown() || args.AltDown();
    // Right-click with no modifier keys means to show a context menu
    if ( args.RightDown() && !modifier )
    {
        ShowContextMenu( args.GetPosition() );
    }
    else
    {
        CaptureMouse();

        Helium::MouseButtonInput input;
        Helium::ConvertEvent( args, input );
        m_Camera.MouseDown( input );
        args.Skip( input.GetSkipped() );
    }
}
Example #21
0
UINT32 ClickModifiers::SynthesizeMouseEventFlags(wxMouseEvent &event)
{
	UINT32 nFlags = 0;

	// The OS swaps the mouse buttons over before putting them in the nFlags
	// bitfield if a user pref is set so we must do the same...
PORTNOTE("other", "Check use of wxSYS_SWAP_BUTTONS")
//	BOOL swapped = wxSystemSettings::GetMetric( wxSYS_SWAP_BUTTONS );
	BOOL swapped = FALSE;

	nFlags |= (event.ControlDown() 		? MK_CONTROL : 0);
	nFlags |= (event.ShiftDown()		? MK_SHIFT : 0);
	nFlags |= (event.AltDown()			? MK_ALT : 0);

	// Note: wxMouseState.LeftDown is equivalent to wxMouseEvent.LeftIsDown
	nFlags |= (event.LeftIsDown()		? (swapped ? MK_RBUTTON : MK_LBUTTON) : 0);
	nFlags |= (event.MiddleIsDown()		? MK_MBUTTON : 0);
	nFlags |= (event.RightIsDown()		? (swapped ? MK_LBUTTON : MK_RBUTTON) : 0);

	return nFlags;
}
Example #22
0
//=========================================================================================
void GAVisToolCanvas::OnMouseMove( wxMouseEvent& event )
{
	if( event.LeftIsDown() )
	{
		wxPoint curMousePos = event.GetPosition();
		wxPoint mouseMoveDelta = curMousePos - this->mousePos;
		this->mousePos = curMousePos;

		VectorMath::Vector delta;
		VectorMath::Set( delta, mouseMoveDelta.x, -mouseMoveDelta.y, 0.f );
		float sensativityFactor = 0.1f;
		VectorMath::Scale( delta, delta, sensativityFactor );

		VectorMath::CoordFrame cameraFrame;
		camera.CameraFrame( cameraFrame );
		VectorMath::Transform( delta, cameraFrame, delta );

		if( event.ControlDown() )
		{
			GAVisToolGeometry* geometry = wxGetApp().environment->LookupGeometryByName( selectedGeometry );
			if( geometry )
			{
				geometry->Translate( delta );
				geometry->HasChanged( true );
			}
		}
		else
		{
			// Notice that with just camera movements, we do
			// not need to invalidate the primitive cache!
			VectorMath::Scale( delta, delta, -1.f );
			bool strafe = event.AltDown();
			if( strafe )
				camera.MoveEyeAndFocus( delta );
			else
				camera.MoveEye( delta, true );
			RedrawNeeded( false );
		}
	}
}
Example #23
0
PlatformMouseEvent::PlatformMouseEvent(const wxMouseEvent& event, const wxPoint& globalPoint)
    : m_position(event.GetPosition())
    , m_globalPosition(globalPoint)
    , m_shiftKey(event.ShiftDown())
    , m_ctrlKey(event.CmdDown())
    , m_altKey(event.AltDown())
    , m_metaKey(event.MetaDown()) // FIXME: We'll have to test other browsers
{
    wxEventType type = event.GetEventType();
    m_eventType = MouseEventMoved;
    
    if (type == wxEVT_LEFT_DOWN || type == wxEVT_MIDDLE_DOWN || type == wxEVT_RIGHT_DOWN)
        m_eventType = MouseEventPressed;
    
    else if (type == wxEVT_LEFT_UP || type == wxEVT_MIDDLE_UP || type == wxEVT_RIGHT_UP || 
                type == wxEVT_LEFT_DCLICK || type == wxEVT_MIDDLE_DCLICK || type == wxEVT_RIGHT_DCLICK)
        m_eventType = MouseEventReleased;

    else if (type == wxEVT_MOTION)
        m_eventType = MouseEventMoved;

    if (event.Button(wxMOUSE_BTN_LEFT))
        m_button = LeftButton;
    else if (event.Button(wxMOUSE_BTN_RIGHT))
        m_button = RightButton;
    else if (event.Button(wxMOUSE_BTN_MIDDLE))
        m_button = MiddleButton;
    else if (!m_eventType == MouseEventMoved)
        ASSERT_NOT_REACHED();


    if (m_eventType == MouseEventMoved)
        m_clickCount = 0;
    else
        m_clickCount = event.ButtonDClick() ? 2 : 1;

    m_timestamp = WebCore::currentTime();
}
Example #24
0
/// Right-click
void InstanceCtrl::OnRightClick(wxMouseEvent& event)
{
	SetFocus();
	VisualCoord clickedIndex;
	int flags = 0;
	if (event.ControlDown())
		flags |= wxINST_CTRL_DOWN;
	if (event.ShiftDown())
		flags |= wxINST_SHIFT_DOWN;
	if (event.AltDown())
		flags |= wxINST_ALT_DOWN;
	HitTest(event.GetPosition(), clickedIndex);
	if (clickedIndex.isItem())
	{
		EnsureVisible(clickedIndex);
		DoSelection(clickedIndex);
		SetIntendedColumn(clickedIndex);
	}
	else
	{
		ClearSelections();
	}
	
	InstanceCtrlEvent cmdEvent(wxEVT_COMMAND_INST_MENU, GetId());
	cmdEvent.SetEventObject(this);
	cmdEvent.SetItemIndex(clickedIndex);
	int clickedID = IDFromIndex(clickedIndex);
	cmdEvent.SetItemID(clickedID);
	cmdEvent.SetFlags(flags);
	cmdEvent.SetPosition(event.GetPosition());
	if (clickedIndex.isGroup())
	{
		cmdEvent.SetGroup(m_groups[clickedIndex.groupIndex].m_group);
	}
	GetEventHandler()->ProcessEvent(cmdEvent);
}
Example #25
0
void VisualTool<FeatureType>::OnMouseEvent(wxMouseEvent &event) {
	bool left_click = event.LeftDown();
	bool left_double = event.LeftDClick();
	shift_down = event.ShiftDown();
	ctrl_down = event.CmdDown();
	alt_down = event.AltDown();

	mouse_pos = event.GetPosition();

	if (event.Leaving()) {
		mouse_pos = Vector2D();
		parent->Render();
		return;
	}

	if (!dragging) {
		int max_layer = INT_MIN;
		active_feature = nullptr;
		for (auto& feature : features) {
			if (feature.IsMouseOver(mouse_pos) && feature.layer >= max_layer) {
				active_feature = &feature;
				max_layer = feature.layer;
			}
		}
	}

	if (dragging) {
		// continue drag
		if (event.LeftIsDown()) {
			for (auto sel : sel_features)
				sel->UpdateDrag(mouse_pos - drag_start, shift_down);
			for (auto sel : sel_features)
				UpdateDrag(sel);
			Commit();
		}
		// end drag
		else {
			dragging = false;

			// mouse didn't move, fiddle with selection
			if (active_feature && !active_feature->HasMoved()) {
				// Don't deselect stuff that was selected in this click's mousedown event
				if (!sel_changed) {
					if (ctrl_down)
						RemoveSelection(active_feature);
					else
						SetSelection(active_feature, true);
				}
			}

			active_feature = nullptr;
			parent->ReleaseMouse();
			parent->SetFocus();
		}
	}
	else if (holding) {
		if (!event.LeftIsDown()) {
			holding = false;

			parent->ReleaseMouse();
			parent->SetFocus();
		}

		UpdateHold();
		Commit();

	}
	else if (left_click) {
		drag_start = mouse_pos;

		// start drag
		if (active_feature) {
			if (!sel_features.count(active_feature)) {
				sel_changed = true;
				SetSelection(active_feature, !ctrl_down);
			}
			else
				sel_changed = false;

			if (active_feature->line)
				c->selectionController->SetActiveLine(active_feature->line);

			if (InitializeDrag(active_feature)) {
				for (auto sel : sel_features) sel->StartDrag();
				dragging = true;
				parent->CaptureMouse();
			}
		}
		// start hold
		else {
			if (!alt_down && features.size() > 1) {
				sel_features.clear();
				c->selectionController->SetSelectedSet({ c->selectionController->GetActiveLine() });
			}
			if (active_line && InitializeHold()) {
				holding = true;
				parent->CaptureMouse();
			}
		}
	}

	if (active_line && left_double)
		OnDoubleClick();

	parent->Render();

	// Only coalesce the changes made in a single drag
	if (!event.LeftIsDown())
		commit_id = -1;
}
Example #26
0
void wxWebView::OnMouseEvents(wxMouseEvent& event)
{
    event.Skip();
    
    if (!m_impl->page)
        return; 
        
    WebCore::Frame* frame = m_mainFrame->GetFrame();  
    if (!frame || !frame->view())
        return;
    
    wxPoint globalPoint = ClientToScreen(event.GetPosition());

    wxEventType type = event.GetEventType();
    
    if (type == wxEVT_MOUSEWHEEL) {
        if (m_mouseWheelZooms && event.ControlDown() && !event.AltDown() && !event.ShiftDown()) {
            if (event.GetWheelRotation() < 0)
                DecreaseTextSize();
            else if (event.GetWheelRotation() > 0)
                IncreaseTextSize();
        } else {
            WebCore::PlatformWheelEvent wkEvent(event, globalPoint);
            frame->eventHandler()->handleWheelEvent(wkEvent);
        }

        return;
    }
    
    // If an event, such as a right-click event, leads to a focus change (e.g. it 
    // raises a dialog), WebKit never gets the mouse up event and never relinquishes 
    // mouse capture. This leads to WebKit handling mouse events, such as modifying
    // the selection, while other controls or top level windows have the focus.
    // I'm not sure if this is the right place to handle this, but I can't seem to
    // find a precedent on how to handle this in other ports.
    if (wxWindow::FindFocus() != this) {
        while (HasCapture())
            ReleaseMouse();

        frame->eventHandler()->setMousePressed(false);

        return;
    }
        
    int clickCount = event.ButtonDClick() ? 2 : 1;

    if (clickCount == 1 && m_impl->tripleClickTimer.IsRunning()) {
        wxPoint diff(event.GetPosition() - m_impl->tripleClickPos);
        if (abs(diff.x) <= wxSystemSettings::GetMetric(wxSYS_DCLICK_X) &&
            abs(diff.y) <= wxSystemSettings::GetMetric(wxSYS_DCLICK_Y)) {
            clickCount = 3;
        }
    } else if (clickCount == 2) {
        m_impl->tripleClickTimer.Start(getDoubleClickTime(), false);
        m_impl->tripleClickPos = event.GetPosition();
    }
    
    WebCore::PlatformMouseEvent wkEvent(event, globalPoint, clickCount);

    if (type == wxEVT_LEFT_DOWN || type == wxEVT_MIDDLE_DOWN || type == wxEVT_RIGHT_DOWN || 
                type == wxEVT_LEFT_DCLICK || type == wxEVT_MIDDLE_DCLICK || type == wxEVT_RIGHT_DCLICK) {
        frame->eventHandler()->handleMousePressEvent(wkEvent);
        if (!HasCapture())
            CaptureMouse();
    } else if (type == wxEVT_LEFT_UP || type == wxEVT_MIDDLE_UP || type == wxEVT_RIGHT_UP) {
        frame->eventHandler()->handleMouseReleaseEvent(wkEvent);
        while (HasCapture())
            ReleaseMouse();
    } else if (type == wxEVT_MOTION || type == wxEVT_ENTER_WINDOW || type == wxEVT_LEAVE_WINDOW)
        frame->eventHandler()->mouseMoved(wkEvent);
}
Example #27
0
void ActorSceneCanvas::OnMouseMove(wxMouseEvent& e)
{

	ShowPos(e.GetX(), e.GetY());

    if (!GetSceneManipulator())
        return;

    if (m_pCameraManip)
    {
        wxASSERT(mDragButton != wxMOUSE_BTN_NONE);
        m_pCameraManip->onMotion(e.GetX(), e.GetY());
    }

	if (mDragStarted  && e.LeftIsDown())
	{
		mDragCurrent =Ogre::Vector2(e.GetX(), e.GetY()) ;
		mDragDelta = mDragCurrent - mDragOrigin;
		mDragOrigin = mDragCurrent;

		if (Fairy::CDataManipulator::GetDataManipulator() && mCanManipulateAxis)
		{	
			Ogre::Camera* camera = GetSceneManipulator()->getCamera();
			assert (camera);
			Ogre::Vector3 oldPos = camera->getPosition();
			Fairy::LogicModel* pModel = GetDataManipulator()->m_pObjTemplate;
			if (pModel)
			{
				Ogre::Vector3 objPos = pModel->getPosition();
				Ogre::Real distance = oldPos.distance(objPos);
				Ogre::Real factor = distance*0.1/150.0;

				Ogre::Vector3 pos=Fairy::CDataManipulator::m_baseNode->getPosition();
				Ogre::Vector3 fdeltaxi = Ogre::Vector3::ZERO;
				Ogre::Quaternion qRot = Fairy::CDataManipulator::m_baseNode->getOrientation();
				//david-<<
				 if(mXax)
					 fdeltaxi = /*qRot**/(mDragDelta.x*0.1*Ogre::Vector3::UNIT_X);
				 if(mYax)
					 fdeltaxi = /*qRot**/(mDragDelta.x*0.1*Ogre::Vector3::UNIT_Y);
				 if(mZax)
					 fdeltaxi = /*qRot**/(mDragDelta.x*0.1*Ogre::Vector3::UNIT_Z);
				 //david->>

				Fairy::CDataManipulator::GetDataManipulator()->_updateCurLocatorTrans(fdeltaxi,Ogre::Quaternion::IDENTITY,true);
			}			
		}	
	}

	if(mDragRightStarted &&  e.RightIsDown())
	{
	
		mDragCurrent =Ogre::Vector2(e.GetX(), e.GetY()) ;
		mDragDelta = mDragCurrent - mDragOrigin;
		mDragOrigin = mDragCurrent;

// 		Ogre::Radian x = Ogre::Degree(mDragDelta.val[0]);
// 		Ogre::Radian y = Ogre::Degree(mDragDelta.val[1]);
// 		Fairy::CDataManipulator::m_axex->yaw(y);
// 		Fairy::CDataManipulator::m_axex->pitch(x);

		if ( Fairy::CDataManipulator::GetDataManipulator() &&(mXax || mYax || mZax) && mCanManipulateAxis)
		{			
			Ogre::Vector3 fBaseAxis = Ogre::Vector3::ZERO;
			Ogre::Quaternion fBaseRot = Fairy::CDataManipulator::m_baseNode->getOrientation();

			if(mXax)
				fBaseAxis =/* fBaseRot**/Ogre::Vector3::UNIT_X;
			if(mYax)
				fBaseAxis =/* fBaseRot**/Ogre::Vector3::UNIT_Y;
			if(mZax)
				fBaseAxis =/* fBaseRot**/Ogre::Vector3::UNIT_Z;

			//david-<<
			Ogre::Radian angle = Ogre::Degree(mDragDelta.y);
			//david->>

			Ogre::Quaternion rot(angle, fBaseAxis);			

			if(mRotFirst)
			{
				Fairy::CDataManipulator::GetDataManipulator()->_updateCurLocatorTrans(Ogre::Vector3::ZERO, rot, false);	
			}
			else
			{
				Fairy::CDataManipulator::GetDataManipulator()->_updateCurLocatorRot(rot);	
			}				
		}
	}



    if (GetActiveAction())
    {
        //GetActiveAction()->onMotion(e.GetX(), e.GetY());
		if (e.ControlDown())
		{
			GetActiveAction()->setParameter("FUNC_KEY", "CTRL");
		}
		
		if(e.AltDown())
		{
			GetActiveAction()->setParameter("FUNC_KEY", "ATL");
		}
		
		if(e.ShiftDown())
		{
			GetActiveAction()->setParameter("FUNC_KEY", "SHIFT");
		}

	}
	else
	{
        //GetSceneManipulator()->getHitIndicator("IntersectPoint")->setHitPoint(e.GetX(), e.GetY());
	}
    // 显示标准模型
    //if ( GetSceneManipulator()->getShowStandardModel() )
    //    GetSceneManipulator()->getHitIndicator("StandardModelIndicator")->setHitPoint(0.5,0.5);
    //else
    //    GetSceneManipulator()->getHitIndicator("StandardModelIndicator")->hide();

    m_CurrentMousePos.x = e.GetX();
    m_CurrentMousePos.y = e.GetY();

	Ogre::Vector3 position;
	bool hit = GetSceneManipulator()->getTerrainIntersects(m_CurrentMousePos.x, m_CurrentMousePos.y, position);

	std::pair<int, int> gridCoord = GetSceneManipulator()->getTerrainData()->getGrid(position.x, position.z);

	if (hit)
	{
		mParentFrame->SetStatusText("World Coordinate : " + Ogre::StringConverter::toString((int)(position.x)) +
			"  " + Ogre::StringConverter::toString((int)(position.y)) + "  "
			 + Ogre::StringConverter::toString((int)(position.z)), 0);
		mParentFrame->SetStatusText("Grid Coordinate : " + Ogre::StringConverter::toString(gridCoord.first) + " " +
			Ogre::StringConverter::toString(gridCoord.second), 1);
	}

}
void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
{
    int          localbutt = 0;
    BASE_SCREEN* screen = GetScreen();

    if( !screen )
        return;

    /* Adjust value to filter mouse displacement before consider the drag
     * mouse is really a drag command, not just a movement while click
     */
#define MIN_DRAG_COUNT_FOR_START_BLOCK_COMMAND 5

    if( event.Leaving() )
        m_canStartBlock = -1;

    if( !IsMouseCaptured() )          // No mouse capture in progress.
        SetAutoPanRequest( false );

    if( GetParent()->IsActive() )
        SetFocus();
    else
        return;

    if( !event.IsButton() && !event.Moving() && !event.Dragging() )
        return;

    if( event.RightDown() )
    {
        OnRightClick( event );
        return;
    }

    if( m_ignoreMouseEvents )
        return;

    if( event.LeftDown() )
        localbutt = GR_M_LEFT_DOWN;

    if( event.ButtonDClick( 1 ) )
        localbutt = GR_M_LEFT_DOWN | GR_M_DCLICK;

    if( event.MiddleDown() )
        localbutt = GR_M_MIDDLE_DOWN;

    INSTALL_UNBUFFERED_DC( DC, this );
    DC.SetBackground( *wxBLACK_BRUSH );

    // Compute the cursor position in drawing (logical) units.
    GetParent()->SetMousePosition( event.GetLogicalPosition( DC ) );

    int kbstat = 0;

    if( event.ShiftDown() )
        kbstat |= GR_KB_SHIFT;

    if( event.ControlDown() )
        kbstat |= GR_KB_CTRL;

    if( event.AltDown() )
        kbstat |= GR_KB_ALT;

    // Calling Double Click and Click functions :
    if( localbutt == (int) ( GR_M_LEFT_DOWN | GR_M_DCLICK ) )
    {
        if( m_ClickTimer )
        {
            m_ClickTimer->Stop();
            wxDELETE( m_ClickTimer );
        }
        GetParent()->OnLeftDClick( &DC, GetParent()->RefPos( true ) );

        // inhibit a response to the mouse left button release,
        // because we have a double click, and we do not want a new
        // OnLeftClick command at end of this Double Click
        m_ignoreNextLeftButtonRelease = true;
    }
    else if( event.LeftUp() )
    {
        // A block command is in progress: a left up is the end of block
        // or this is the end of a double click, already seen
        // Note also m_ignoreNextLeftButtonRelease can be set by
        // the call to OnLeftClick(), so do not change it after calling OnLeftClick
        bool ignoreEvt = m_ignoreNextLeftButtonRelease;
        m_ignoreNextLeftButtonRelease = false;

        if( screen->m_BlockLocate.GetState() == STATE_NO_BLOCK && !ignoreEvt )
        {
            EDA_ITEM* item = screen->GetCurItem();
            m_CursorClickPos = GetParent()->RefPos( true );

            // If we have an item already selected, or we are using a tool,
            // we won't use the disambiguation menu so process the click immediately
            if( ( item && item->GetFlags() ) || GetParent()->GetToolId() != ID_NO_TOOL_SELECTED )
                GetParent()->OnLeftClick( &DC, m_CursorClickPos );
            else
            {
                wxDELETE( m_ClickTimer );
                m_ClickTimer = new wxTimer(this, ID_MOUSE_DOUBLECLICK);
                m_ClickTimer->StartOnce( m_doubleClickInterval );
            }
        }

    }
    else if( !event.LeftIsDown() )
    {
        /* be sure there is a response to a left button release command
         * even when a LeftUp event is not seen.  This happens when a
         * double click opens a dialog box, and the release mouse button
         * is made when the dialog box is opened.
         */
        m_ignoreNextLeftButtonRelease = false;
    }

    if( event.ButtonDown( wxMOUSE_BTN_MIDDLE ) )
    {
        m_PanStartCenter = GetParent()->GetScrollCenterPosition();
        m_PanStartEventPosition = event.GetPosition();

        INSTALL_UNBUFFERED_DC( dc, this );
        CrossHairOff( &dc );
        SetCursor( wxCURSOR_SIZING );
    }

    if( event.ButtonUp( wxMOUSE_BTN_MIDDLE ) )
    {
        INSTALL_UNBUFFERED_DC( dc, this );
        CrossHairOn( &dc );
        SetCursor( (wxStockCursor) m_currentCursor );
    }

    if( event.MiddleIsDown() )
    {
        wxPoint currentPosition = event.GetPosition();

        double scale = GetParent()->GetScreen()->GetScalingFactor();
        int x = m_PanStartCenter.x +
                KiROUND( (double) ( m_PanStartEventPosition.x - currentPosition.x ) / scale );
        int y = m_PanStartCenter.y +
                KiROUND( (double) ( m_PanStartEventPosition.y - currentPosition.y ) / scale );

        GetParent()->RedrawScreen( wxPoint( x, y ), false );
    }

    // Calling the general function on mouse changes (and pseudo key commands)
    GetParent()->GeneralControl( &DC, event.GetLogicalPosition( DC ), 0 );

    /*******************************/
    /* Control of block commands : */
    /*******************************/

    // Command block can't start if mouse is dragging a new panel
    static EDA_DRAW_PANEL* lastPanel;
    if( lastPanel != this )
    {
        m_minDragEventCount = 0;
        m_canStartBlock   = -1;
    }

    /* A new command block can start after a release buttons
     * and if the drag is enough
     * This is to avoid a false start block when a dialog box is dismissed,
     * or when changing panels in hierarchy navigation
     * or when clicking while and moving mouse
     */
    if( !event.LeftIsDown() && !event.MiddleIsDown() )
    {
        m_minDragEventCount = 0;
        m_canStartBlock   = 0;

        /* Remember the last cursor position when a drag mouse starts
         * this is the last position ** before ** clicking a button
         * this is useful to start a block command from the point where the
         * mouse was clicked first
         * (a filter creates a delay for the real block command start, and
         * we must remember this point)
         */
        m_CursorStartPos = GetParent()->GetCrossHairPosition();
    }

    if( m_enableBlockCommands && !(localbutt & GR_M_DCLICK) )
    {
        if( !screen->IsBlockActive() )
        {
            screen->m_BlockLocate.SetOrigin( m_CursorStartPos );
        }

        if( event.LeftDown() )
        {
            if( screen->m_BlockLocate.GetState() == STATE_BLOCK_MOVE )
            {
                SetAutoPanRequest( false );
                GetParent()->HandleBlockPlace( &DC );
                m_ignoreNextLeftButtonRelease = true;
            }
        }
        else if( ( m_canStartBlock >= 0 ) && event.LeftIsDown() && !IsMouseCaptured() )
        {
            // Mouse is dragging: if no block in progress,  start a block command.
            if( screen->m_BlockLocate.GetState() == STATE_NO_BLOCK )
            {
                //  Start a block command
                int cmd_type = kbstat;

                // A block command is started if the drag is enough.  A small
                // drag is ignored (it is certainly a little mouse move when
                // clicking) not really a drag mouse
                if( m_minDragEventCount < MIN_DRAG_COUNT_FOR_START_BLOCK_COMMAND )
                    m_minDragEventCount++;
                else
                {
                    auto cmd = (GetParent()->GetToolId() == ID_ZOOM_SELECTION) ? BLOCK_ZOOM : 0;

                    if( !GetParent()->HandleBlockBegin( &DC, cmd_type, m_CursorStartPos, cmd ) )
                    {
                        // should not occur: error
                        GetParent()->DisplayToolMsg(
                            wxT( "EDA_DRAW_PANEL::OnMouseEvent() Block Error" ) );
                    }
                    else
                    {
                        SetAutoPanRequest( true );
                        SetCursor( wxCURSOR_SIZING );
                    }
                }
            }
        }

        if( event.ButtonUp( wxMOUSE_BTN_LEFT ) )
        {
            /* Release the mouse button: end of block.
             * The command can finish (DELETE) or have a next command (MOVE,
             * COPY).  However the block command is canceled if the block
             * size is small because a block command filtering is already
             * made, this case happens, but only when the on grid cursor has
             * not moved.
             */
            #define BLOCK_MINSIZE_LIMIT 1
            bool BlockIsSmall =
                ( std::abs( screen->m_BlockLocate.GetWidth() ) < BLOCK_MINSIZE_LIMIT )
                && ( std::abs( screen->m_BlockLocate.GetHeight() ) < BLOCK_MINSIZE_LIMIT );

            if( (screen->m_BlockLocate.GetState() != STATE_NO_BLOCK) && BlockIsSmall )
            {
                if( m_endMouseCaptureCallback )
                {
                    m_endMouseCaptureCallback( this, &DC );
                    SetAutoPanRequest( false );
                }

                SetCursor( (wxStockCursor) m_currentCursor );
           }
            else if( screen->m_BlockLocate.GetState() == STATE_BLOCK_END )
            {
                SetAutoPanRequest( false );
                GetParent()->HandleBlockEnd( &DC );
                SetCursor( (wxStockCursor) m_currentCursor );
                if( screen->m_BlockLocate.GetState() == STATE_BLOCK_MOVE )
                {
                    SetAutoPanRequest( true );
                    SetCursor( wxCURSOR_HAND );
                }
           }
        }
    }

    // End of block command on a double click
    // To avoid an unwanted block move command if the mouse is moved while double clicking
    if( localbutt == (int) ( GR_M_LEFT_DOWN | GR_M_DCLICK ) )
    {
        if( !screen->IsBlockActive() && IsMouseCaptured() )
        {
            m_endMouseCaptureCallback( this, &DC );
        }
    }

    lastPanel = this;

#ifdef __WXGTK3__
    // Screen has to be updated on every operation, otherwise the cursor leaves a trail (when xor
    // operation is changed to copy) or is not updated at all.
    Refresh();
#endif
}
Example #29
0
void SpectraDocumentFrame::HandleMouseMotion(const wxMouseEvent& event)
{
	wxSize size = gl_canvas->GetSize();
	wxPoint new_mouse_position = event.GetPosition();

	int new_x = ClampMouseCoord(new_mouse_position.x, size.GetWidth());
	int new_y = ClampMouseCoord(new_mouse_position.y, size.GetHeight());
	if(event.Dragging())
	{
		int old_x = ClampMouseCoord(old_mouse_position.x, size.GetWidth());
		int old_y = ClampMouseCoord(old_mouse_position.y, size.GetHeight());

		if(event.CmdDown())
		{
			if(event.LeftIsDown())
			{
				if(event.AltDown())
				{
					document_view.StretchRange(new_x, new_y, old_x, old_y);
				}
				else
				{
					document_view.StretchDomain(new_x, new_y, old_x, old_y);
				}
			}
		}
		else
		{
			if(event.LeftIsDown())
			{
				if(event.AltDown())
				{
					document_view.Elevate(new_x, new_y, old_x, old_y);
				}
				else
				{
					document_view.Slide(new_x, new_y, old_x, old_y);
				}
			}
			else if(event.MiddleIsDown())
			{
				document_view.Scale(new_x, new_y, old_x, old_y);
			}
			else if(event.RightIsDown())
			{
				document_view.Orbit(new_x, new_y, old_x, old_y);
			}
		}
	}
	else
	{
		float t = 0.0f;
		if(event.AltDown())
		{
			t = document_view.PickOnWall(new_x, new_y).x();
		}
		else
		{
			t = document_view.PickOnGround(new_x, new_y).x();
		}
		t /= document_view.TimeStretch();
		SetStatus(wxString::Format(wxGetTranslation(wxT("Time: %f [s]")), t));
		document_vis->SelectedTime(t);
	}
}
//---------------------------------------------------------
void CVIEW_Map_Control::On_Mouse_LDown(wxMouseEvent &event)
{
	m_Mouse_Down	= m_Mouse_Move	= event.GetPosition();

	//-----------------------------------------------------
	if( m_Mode != MAP_MODE_SELECT )	// clipboard copy ?
	{
		if( event.ControlDown() )
		{
			m_pMap->SaveAs_Image_Clipboard(false);

			return;
		}

		if( event.AltDown() )
		{
			m_pMap->SaveAs_Image_Clipboard(GetClientSize().x, GetClientSize().y, -1);

			return;
		}
	}

	//-----------------------------------------------------
	bool	bCaptureMouse	= true;

	switch( m_Mode )
	{
	//-----------------------------------------------------
	case MAP_MODE_SELECT:
		if( g_pTool && g_pTool->is_Interactive() )
		{
			m_Drag_Mode		= ((CSG_Tool_Interactive *)g_pTool->Get_Tool())->Get_Drag_Mode();
			bCaptureMouse	= !g_pTool->Execute(_Get_Client2World(event.GetPosition()), TOOL_INTERACTIVE_LDOWN, GET_KEYS(event));
		}
		else if( m_pMap->Find_Layer(Get_Active_Layer()) )
		{
			switch(	Get_Active_Layer()->Get_Type() )
			{
			default:
				m_Drag_Mode		= TOOL_INTERACTIVE_DRAG_NONE;
				break;

			case WKSP_ITEM_Grid:
			case WKSP_ITEM_PointCloud:
				m_Drag_Mode		= TOOL_INTERACTIVE_DRAG_BOX;
				break;

			case WKSP_ITEM_Shapes:
				m_Drag_Mode		= ((CWKSP_Shapes *)Get_Active_Layer())->is_Editing()
								? TOOL_INTERACTIVE_DRAG_NONE
								: TOOL_INTERACTIVE_DRAG_BOX;
				break;
			}

			Get_Active_Layer()->Edit_On_Mouse_Down(_Get_Client2World(event.GetPosition()), _Get_Client2World(1.0), GET_KEYS(event));
		}
		break;

	//-----------------------------------------------------
	case MAP_MODE_DISTANCE:
		m_Drag_Mode		= TOOL_INTERACTIVE_DRAG_NONE;
		break;

	//-----------------------------------------------------
	case MAP_MODE_ZOOM:
		m_Drag_Mode		= TOOL_INTERACTIVE_DRAG_BOX;
		break;

	//-----------------------------------------------------
	case MAP_MODE_PAN:
		m_Drag_Mode		= TOOL_INTERACTIVE_DRAG_NONE;
		Set_Mode(MAP_MODE_PAN_DOWN);
		break;

	//-----------------------------------------------------
	case MAP_MODE_PAN_DOWN:
		m_Drag_Mode		= TOOL_INTERACTIVE_DRAG_NONE;
		break;
	}

	//-----------------------------------------------------
	if( bCaptureMouse && !HasCapture() )
	{
		CaptureMouse();
	}

	event.Skip();
}