kicad/gerbview/controle.cpp

75 lines
1.6 KiB
C++
Raw Normal View History

/****************/
/* controle.cpp */
/****************/
2007-05-06 16:03:28 +00:00
#include "fctsys.h"
#include "common.h"
#include "class_drawpanel.h"
#include "gerbview.h"
2007-05-06 16:03:28 +00:00
void GERBVIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
2007-05-06 16:03:28 +00:00
{
wxRealPoint gridSize;
wxPoint oldpos;
wxPoint pos = aPosition;
pos = GetScreen()->GetNearestGridPosition( pos );
oldpos = GetScreen()->GetCrossHairPosition();
gridSize = GetScreen()->GetGridSize();
2007-10-10 04:45:26 +00:00
switch( aHotKey )
2007-10-10 04:45:26 +00:00
{
case WXK_NUMPAD8:
2007-10-10 04:45:26 +00:00
case WXK_UP:
pos.y -= wxRound( gridSize.y );
DrawPanel->MoveCursor( pos );
2007-10-10 04:45:26 +00:00
break;
case WXK_NUMPAD2:
2007-10-10 04:45:26 +00:00
case WXK_DOWN:
pos.y += wxRound( gridSize.y );
DrawPanel->MoveCursor( pos );
2007-10-10 04:45:26 +00:00
break;
case WXK_NUMPAD4:
2007-10-10 04:45:26 +00:00
case WXK_LEFT:
pos.x -= wxRound( gridSize.x );
DrawPanel->MoveCursor( pos );
2007-10-10 04:45:26 +00:00
break;
case WXK_NUMPAD6:
2007-10-10 04:45:26 +00:00
case WXK_RIGHT:
pos.x += wxRound( gridSize.x );
DrawPanel->MoveCursor( pos );
2007-10-10 04:45:26 +00:00
break;
default:
break;
}
GetScreen()->SetCrossHairPosition( pos );
2007-10-10 04:45:26 +00:00
if( oldpos != GetScreen()->GetCrossHairPosition() )
2007-10-10 04:45:26 +00:00
{
pos = GetScreen()->GetCrossHairPosition();
GetScreen()->SetCrossHairPosition( oldpos );
DrawPanel->CrossHairOff( aDC );
GetScreen()->SetCrossHairPosition( pos );
DrawPanel->CrossHairOn( aDC );
2007-05-06 16:03:28 +00:00
if( DrawPanel->IsMouseCaptured() )
2007-10-10 04:45:26 +00:00
{
DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, aPosition, true );
2007-10-10 04:45:26 +00:00
}
}
if( aHotKey )
2007-10-10 04:45:26 +00:00
{
OnHotKey( aDC, aHotKey, NULL );
2007-10-10 04:45:26 +00:00
}
UpdateStatusBar();
2007-10-10 04:45:26 +00:00
}