2009-11-09 14:00:22 +00:00
|
|
|
/****************/
|
|
|
|
/* controle.cpp */
|
|
|
|
/****************/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "common.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "class_drawpanel.h"
|
|
|
|
#include "gerbview.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2010-10-10 17:57:54 +00:00
|
|
|
GERBER_DRAW_ITEM* WinEDA_GerberFrame::GerberGeneralLocateAndDisplay()
|
2008-04-17 16:25:29 +00:00
|
|
|
{
|
2007-10-10 04:45:26 +00:00
|
|
|
return Locate( CURSEUR_OFF_GRILLE );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-02-05 20:53:08 +00:00
|
|
|
void WinEDA_GerberFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-02-07 08:33:25 +00:00
|
|
|
wxRealPoint delta;
|
2007-10-10 04:45:26 +00:00
|
|
|
wxPoint curpos, oldpos;
|
|
|
|
int hotkey = 0;
|
2007-09-10 04:51:01 +00:00
|
|
|
|
|
|
|
if( GetScreen()->IsRefreshReq() )
|
|
|
|
{
|
2010-01-13 13:43:36 +00:00
|
|
|
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-09-10 04:51:01 +00:00
|
|
|
}
|
|
|
|
|
2010-02-22 16:45:35 +00:00
|
|
|
double scalar = GetScreen()->GetScalingFactor();
|
|
|
|
|
2007-10-10 04:45:26 +00:00
|
|
|
curpos = DrawPanel->CursorRealPosition( Mouse );
|
|
|
|
oldpos = GetScreen()->m_Curseur;
|
2007-09-10 04:51:01 +00:00
|
|
|
|
2009-10-14 19:43:31 +00:00
|
|
|
delta = GetScreen()->GetGridSize();
|
2010-02-08 18:15:42 +00:00
|
|
|
|
2010-02-22 16:45:35 +00:00
|
|
|
delta.x *= scalar;
|
|
|
|
delta.y *= scalar;
|
2009-01-29 14:26:20 +00:00
|
|
|
|
2007-10-10 04:45:26 +00:00
|
|
|
if( delta.x == 0 )
|
|
|
|
delta.x = 1;
|
|
|
|
if( delta.y == 0 )
|
|
|
|
delta.y = 1;
|
|
|
|
|
|
|
|
switch( g_KeyPressed )
|
|
|
|
{
|
2009-11-09 14:00:22 +00:00
|
|
|
case WXK_NUMPAD8:
|
2007-10-10 04:45:26 +00:00
|
|
|
case WXK_UP:
|
2009-04-05 20:49:15 +00:00
|
|
|
Mouse.y -= wxRound(delta.y);
|
2007-10-10 04:45:26 +00:00
|
|
|
DrawPanel->MouseTo( Mouse );
|
|
|
|
break;
|
|
|
|
|
2009-11-09 14:00:22 +00:00
|
|
|
case WXK_NUMPAD2:
|
2007-10-10 04:45:26 +00:00
|
|
|
case WXK_DOWN:
|
2009-04-05 20:49:15 +00:00
|
|
|
Mouse.y += wxRound(delta.y);
|
2007-10-10 04:45:26 +00:00
|
|
|
DrawPanel->MouseTo( Mouse );
|
|
|
|
break;
|
|
|
|
|
2009-11-09 14:00:22 +00:00
|
|
|
case WXK_NUMPAD4:
|
2007-10-10 04:45:26 +00:00
|
|
|
case WXK_LEFT:
|
2009-04-05 20:49:15 +00:00
|
|
|
Mouse.x -= wxRound(delta.x);
|
2007-10-10 04:45:26 +00:00
|
|
|
DrawPanel->MouseTo( Mouse );
|
|
|
|
break;
|
|
|
|
|
2009-11-09 14:00:22 +00:00
|
|
|
case WXK_NUMPAD6:
|
2007-10-10 04:45:26 +00:00
|
|
|
case WXK_RIGHT:
|
2009-04-05 20:49:15 +00:00
|
|
|
Mouse.x += wxRound(delta.x);
|
2007-10-10 04:45:26 +00:00
|
|
|
DrawPanel->MouseTo( Mouse );
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
hotkey = g_KeyPressed;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
GetScreen()->m_Curseur = curpos;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2007-10-10 04:45:26 +00:00
|
|
|
PutOnGrid( &GetScreen()->m_Curseur );
|
|
|
|
|
2009-02-05 20:53:08 +00:00
|
|
|
if( oldpos != GetScreen()->m_Curseur )
|
2007-10-10 04:45:26 +00:00
|
|
|
{
|
|
|
|
curpos = GetScreen()->m_Curseur;
|
|
|
|
GetScreen()->m_Curseur = oldpos;
|
|
|
|
DrawPanel->CursorOff( DC );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-10-10 04:45:26 +00:00
|
|
|
GetScreen()->m_Curseur = curpos;
|
|
|
|
DrawPanel->CursorOn( DC );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-10-10 04:45:26 +00:00
|
|
|
if( DrawPanel->ManageCurseur )
|
|
|
|
{
|
|
|
|
DrawPanel->ManageCurseur( DrawPanel, DC, TRUE );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( hotkey )
|
|
|
|
{
|
|
|
|
OnHotKey( DC, hotkey, NULL );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( GetScreen()->IsRefreshReq() )
|
|
|
|
{
|
2010-01-13 13:43:36 +00:00
|
|
|
DrawPanel->Refresh( );
|
|
|
|
wxSafeYield();
|
2007-10-10 04:45:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SetToolbars();
|
2009-11-09 14:00:22 +00:00
|
|
|
UpdateStatusBar();
|
2007-10-10 04:45:26 +00:00
|
|
|
}
|