3D-viewer: code cleaning. Added option in menu: show a 3D grid.

All: press ctrl+shift key when moving the mouse allows the graphic cursor to be moved outside the grid.
(useful to place graphic objects, texts in any position, regardless the current grid)
This commit is contained in:
jean-pierre charras
2012-08-11 14:52:13 +02:00
parent 7c3f47ec5a
commit abe5c08e20
21 changed files with 793 additions and 421 deletions
+13 -4
View File
@@ -429,7 +429,16 @@ void FOOTPRINT_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition,
wxPoint oldpos;
wxPoint pos = aPosition;
pos = GetScreen()->GetNearestGridPosition( aPosition );
// when moving mouse, use the "magnetic" grid, unless the shift+ctrl keys is pressed
// for next cursor position
// ( shift or ctrl key down are PAN command with mouse wheel)
bool snapToGrid = true;
if( !aHotKey && wxGetKeyState( WXK_SHIFT ) && wxGetKeyState( WXK_CONTROL ) )
snapToGrid = false;
if( snapToGrid )
pos = GetScreen()->GetNearestGridPosition( pos );
oldpos = GetScreen()->GetCrossHairPosition();
gridSize = GetScreen()->GetGridSize();
@@ -463,14 +472,14 @@ void FOOTPRINT_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition,
break;
}
GetScreen()->SetCrossHairPosition( pos );
GetScreen()->SetCrossHairPosition( pos, snapToGrid );
if( oldpos != GetScreen()->GetCrossHairPosition() )
{
pos = GetScreen()->GetCrossHairPosition();
GetScreen()->SetCrossHairPosition( oldpos );
GetScreen()->SetCrossHairPosition( oldpos, false );
m_canvas->CrossHairOff( aDC );
GetScreen()->SetCrossHairPosition( pos );
GetScreen()->SetCrossHairPosition( pos, snapToGrid );
m_canvas->CrossHairOn( aDC );
if( m_canvas->IsMouseCaptured() )