kicad/gerbview/controle.cpp

103 lines
2.3 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
GERBER_DRAW_ITEM* WinEDA_GerberFrame::GerberGeneralLocateAndDisplay()
{
2007-10-10 04:45:26 +00:00
return Locate( CURSEUR_OFF_GRILLE );
2007-05-06 16:03:28 +00:00
}
void WinEDA_GerberFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
2007-05-06 16:03:28 +00:00
{
wxRealPoint gridSize;
wxPoint oldpos;
int hotkey = 0;
wxPoint pos = aPosition;
PutOnGrid( &pos );
if( GetScreen()->IsRefreshReq() )
{
DrawPanel->Refresh( );
wxSafeYield();
2007-10-10 04:45:26 +00:00
// We must return here, instead of proceeding.
// If we let the cursor move during a refresh request,
// the cursor be displayed in the wrong place
// during delayed repaint events that occur when
// you move the mouse when a message dialog is on
// the screen, and then you dismiss the dialog by
// typing the Enter key.
return;
}
2007-10-10 04:45:26 +00:00
oldpos = GetScreen()->m_Curseur;
gridSize = GetScreen()->GetGridSize();
2007-10-10 04:45:26 +00:00
switch( g_KeyPressed )
{
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:
hotkey = g_KeyPressed;
break;
}
GetScreen()->m_Curseur = pos;
2007-10-10 04:45:26 +00:00
if( oldpos != GetScreen()->m_Curseur )
2007-10-10 04:45:26 +00:00
{
pos = GetScreen()->m_Curseur;
2007-10-10 04:45:26 +00:00
GetScreen()->m_Curseur = oldpos;
DrawPanel->CursorOff( aDC );
GetScreen()->m_Curseur = pos;
DrawPanel->CursorOn( aDC );
2007-05-06 16:03:28 +00:00
2007-10-10 04:45:26 +00:00
if( DrawPanel->ManageCurseur )
{
DrawPanel->ManageCurseur( DrawPanel, aDC, aPosition, true );
2007-10-10 04:45:26 +00:00
}
}
if( hotkey )
{
OnHotKey( aDC, hotkey, NULL );
2007-10-10 04:45:26 +00:00
}
if( GetScreen()->IsRefreshReq() )
{
DrawPanel->Refresh( );
wxSafeYield();
2007-10-10 04:45:26 +00:00
}
UpdateStatusBar();
2007-10-10 04:45:26 +00:00
}