Commit efb34166 authored by Dick Hollenbeck's avatar Dick Hollenbeck

*) retain grid origin in the BOARD and save it in legacy and kicad board files.

*) add hotkey for setting the grid origin as 'S', in board editor, module editor.
*) re-position the function interface for cursor movement from BASE_SCREEN into
   class EDA_DRAW_FRAME.  This is a prelude to getting rid of BASE_SCREEN or
   splitting it up.
parent 744dd80e
...@@ -288,10 +288,10 @@ GRID_TYPE& BASE_SCREEN::GetGrid( size_t aIndex ) ...@@ -288,10 +288,10 @@ GRID_TYPE& BASE_SCREEN::GetGrid( size_t aIndex )
} }
wxPoint BASE_SCREEN::GetNearestGridPosition( const wxPoint& aPosition, wxPoint BASE_SCREEN::getNearestGridPosition( const wxPoint& aPosition,
wxRealPoint* aGridSize ) const const wxPoint& aGridOrigin, wxRealPoint* aGridSize ) const
{ {
wxPoint pt; wxPoint pt;
wxRealPoint gridSize; wxRealPoint gridSize;
if( aGridSize ) if( aGridSize )
...@@ -299,13 +299,13 @@ wxPoint BASE_SCREEN::GetNearestGridPosition( const wxPoint& aPosition, ...@@ -299,13 +299,13 @@ wxPoint BASE_SCREEN::GetNearestGridPosition( const wxPoint& aPosition,
else else
gridSize = GetGridSize(); gridSize = GetGridSize();
wxPoint gridOrigin = m_GridOrigin; double offset = fmod( aGridOrigin.x, gridSize.x );
double offset = fmod( gridOrigin.x, gridSize.x );
int x = KiROUND( (aPosition.x - offset) / gridSize.x ); int x = KiROUND( (aPosition.x - offset) / gridSize.x );
pt.x = KiROUND( x * gridSize.x + offset ); pt.x = KiROUND( x * gridSize.x + offset );
offset = fmod( gridOrigin.y, gridSize.y ); offset = fmod( aGridOrigin.y, gridSize.y );
int y = KiROUND( (aPosition.y - offset) / gridSize.y ); int y = KiROUND( (aPosition.y - offset) / gridSize.y );
pt.y = KiROUND ( y * gridSize.y + offset ); pt.y = KiROUND ( y * gridSize.y + offset );
...@@ -313,19 +313,19 @@ wxPoint BASE_SCREEN::GetNearestGridPosition( const wxPoint& aPosition, ...@@ -313,19 +313,19 @@ wxPoint BASE_SCREEN::GetNearestGridPosition( const wxPoint& aPosition,
} }
wxPoint BASE_SCREEN::GetCursorPosition( bool aOnGrid, wxRealPoint* aGridSize ) const wxPoint BASE_SCREEN::getCursorPosition( bool aOnGrid, const wxPoint& aGridOrigin, wxRealPoint* aGridSize ) const
{ {
if( aOnGrid ) if( aOnGrid )
return GetNearestGridPosition( m_crossHairPosition, aGridSize ); return getNearestGridPosition( m_crossHairPosition, aGridOrigin, aGridSize );
return m_crossHairPosition; return m_crossHairPosition;
} }
wxPoint BASE_SCREEN::GetCrossHairScreenPosition() const wxPoint BASE_SCREEN::getCrossHairScreenPosition() const
{ {
wxPoint pos = m_crossHairPosition - m_DrawOrg; wxPoint pos = m_crossHairPosition - m_DrawOrg;
double scalar = GetScalingFactor(); double scalar = GetScalingFactor();
pos.x = KiROUND( (double) pos.x * scalar ); pos.x = KiROUND( (double) pos.x * scalar );
pos.y = KiROUND( (double) pos.y * scalar ); pos.y = KiROUND( (double) pos.y * scalar );
...@@ -334,10 +334,10 @@ wxPoint BASE_SCREEN::GetCrossHairScreenPosition() const ...@@ -334,10 +334,10 @@ wxPoint BASE_SCREEN::GetCrossHairScreenPosition() const
} }
void BASE_SCREEN::SetCrossHairPosition( const wxPoint& aPosition, bool aSnapToGrid ) void BASE_SCREEN::setCrossHairPosition( const wxPoint& aPosition, const wxPoint& aGridOrigin, bool aSnapToGrid )
{ {
if( aSnapToGrid ) if( aSnapToGrid )
m_crossHairPosition = GetNearestGridPosition( aPosition ); m_crossHairPosition = getNearestGridPosition( aPosition, aGridOrigin );
else else
m_crossHairPosition = aPosition; m_crossHairPosition = aPosition;
} }
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
* depending on the application. * depending on the application.
*/ */
#include <macros.h>
#include <base_struct.h> #include <base_struct.h>
#include <class_title_block.h> #include <class_title_block.h>
#include <common.h> #include <common.h>
...@@ -187,7 +188,7 @@ void StripTrailingZeros( wxString& aStringValue, unsigned aTrailingZeroAllowed ) ...@@ -187,7 +188,7 @@ void StripTrailingZeros( wxString& aStringValue, unsigned aTrailingZeroAllowed )
/* Convert a value to a string using double notation. /* Convert a value to a string using double notation.
* For readability, the mantissa has 3 or more digits (max 8 digits), * For readability, the mantissa has 3 or more digits,
* the trailing 0 are removed if the mantissa has more than 3 digits * the trailing 0 are removed if the mantissa has more than 3 digits
* and some trailing 0 * and some trailing 0
* This function should be used to display values in dialogs because a value * This function should be used to display values in dialogs because a value
...@@ -198,23 +199,19 @@ void StripTrailingZeros( wxString& aStringValue, unsigned aTrailingZeroAllowed ) ...@@ -198,23 +199,19 @@ void StripTrailingZeros( wxString& aStringValue, unsigned aTrailingZeroAllowed )
*/ */
wxString ReturnStringFromValue( EDA_UNITS_T aUnit, int aValue, bool aAddUnitSymbol ) wxString ReturnStringFromValue( EDA_UNITS_T aUnit, int aValue, bool aAddUnitSymbol )
{ {
wxString stringValue; double value_to_print = To_User_Unit( aUnit, aValue );
double value_to_print;
value_to_print = To_User_Unit( aUnit, aValue );
#if defined( EESCHEMA ) #if defined( EESCHEMA )
stringValue.Printf( wxT( "%.3f" ), value_to_print ); wxString stringValue = wxString::Format( wxT( "%.3f" ), value_to_print );
#else
#if defined( USE_PCBNEW_NANOMETRES )
stringValue.Printf( wxT( "%.8f" ), value_to_print );
#else
stringValue.Printf( wxT( "%.4f" ), value_to_print );
#endif
// Strip trailing zeros. However, keep at least 3 digits in mantissa // Strip trailing zeros. However, keep at least 3 digits in mantissa
// For readability // For readability
StripTrailingZeros( stringValue, 3 ); StripTrailingZeros( stringValue, 3 );
#else
std::string s = Double2Str( value_to_print );
wxString stringValue = FROM_UTF8( s.c_str() );
#endif #endif
if( aAddUnitSymbol ) if( aAddUnitSymbol )
...@@ -269,8 +266,6 @@ double From_User_Unit( EDA_UNITS_T aUnit, double aValue ) ...@@ -269,8 +266,6 @@ double From_User_Unit( EDA_UNITS_T aUnit, double aValue )
} }
int ReturnValueFromString( EDA_UNITS_T aUnits, const wxString& aTextValue ) int ReturnValueFromString( EDA_UNITS_T aUnits, const wxString& aTextValue )
{ {
double value; double value;
......
...@@ -42,8 +42,8 @@ ...@@ -42,8 +42,8 @@
BLOCK_SELECTOR::BLOCK_SELECTOR() : BLOCK_SELECTOR::BLOCK_SELECTOR() :
EDA_RECT() EDA_RECT()
{ {
m_state = STATE_NO_BLOCK; /* State (enum BLOCK_STATE_T) of block. */ m_state = STATE_NO_BLOCK; // State (enum BLOCK_STATE_T) of block.
m_command = BLOCK_IDLE; /* Type (enum BLOCK_COMMAND_T) of operation. */ m_command = BLOCK_IDLE; // Type (enum BLOCK_COMMAND_T) of operation.
m_color = BROWN; m_color = BROWN;
} }
...@@ -62,24 +62,24 @@ void BLOCK_SELECTOR::SetMessageBlock( EDA_DRAW_FRAME* frame ) ...@@ -62,24 +62,24 @@ void BLOCK_SELECTOR::SetMessageBlock( EDA_DRAW_FRAME* frame )
case BLOCK_IDLE: case BLOCK_IDLE:
break; break;
case BLOCK_MOVE: /* Move */ case BLOCK_MOVE: // Move
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/ case BLOCK_PRESELECT_MOVE: // Move with preselection list
msg = _( "Block Move" ); msg = _( "Block Move" );
break; break;
case BLOCK_DRAG: /* Drag */ case BLOCK_DRAG: // Drag
msg = _( "Block Drag" ); msg = _( "Block Drag" );
break; break;
case BLOCK_COPY: /* Copy */ case BLOCK_COPY: // Copy
msg = _( "Block Copy" ); msg = _( "Block Copy" );
break; break;
case BLOCK_DELETE: /* Delete */ case BLOCK_DELETE: // Delete
msg = _( "Block Delete" ); msg = _( "Block Delete" );
break; break;
case BLOCK_SAVE: /* Save */ case BLOCK_SAVE: // Save
msg = _( "Block Save" ); msg = _( "Block Save" );
break; break;
...@@ -87,20 +87,20 @@ void BLOCK_SELECTOR::SetMessageBlock( EDA_DRAW_FRAME* frame ) ...@@ -87,20 +87,20 @@ void BLOCK_SELECTOR::SetMessageBlock( EDA_DRAW_FRAME* frame )
msg = _( "Block Paste" ); msg = _( "Block Paste" );
break; break;
case BLOCK_ZOOM: /* Window Zoom */ case BLOCK_ZOOM: // Window Zoom
msg = _( "Win Zoom" ); msg = _( "Win Zoom" );
break; break;
case BLOCK_ROTATE: /* Rotate 90 deg */ case BLOCK_ROTATE: // Rotate 90 deg
msg = _( "Block Rotate" ); msg = _( "Block Rotate" );
break; break;
case BLOCK_FLIP: /* Flip */ case BLOCK_FLIP: // Flip
msg = _( "Block Flip" ); msg = _( "Block Flip" );
break; break;
case BLOCK_MIRROR_X: case BLOCK_MIRROR_X:
case BLOCK_MIRROR_Y: /* mirror */ case BLOCK_MIRROR_Y: // mirror
msg = _( "Block Mirror" ); msg = _( "Block Mirror" );
break; break;
...@@ -185,15 +185,15 @@ void DrawAndSizingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoin ...@@ -185,15 +185,15 @@ void DrawAndSizingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoin
if( aErase ) if( aErase )
block->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, block->GetColor() ); block->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, block->GetColor() );
block->SetLastCursorPosition( aPanel->GetScreen()->GetCrossHairPosition() ); block->SetLastCursorPosition( aPanel->GetParent()->GetCrossHairPosition() );
block->SetEnd( aPanel->GetScreen()->GetCrossHairPosition() ); block->SetEnd( aPanel->GetParent()->GetCrossHairPosition() );
block->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, block->GetColor() ); block->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, block->GetColor() );
if( block->GetState() == STATE_BLOCK_INIT ) if( block->GetState() == STATE_BLOCK_INIT )
{ {
if( block->GetWidth() || block->GetHeight() ) if( block->GetWidth() || block->GetHeight() )
/* 2nd point exists: the rectangle is not surface anywhere */ // 2nd point exists: the rectangle is not surface anywhere
block->SetState( STATE_BLOCK_END ); block->SetState( STATE_BLOCK_END );
} }
} }
...@@ -203,14 +203,14 @@ void AbortBlockCurrentCommand( EDA_DRAW_PANEL* aPanel, wxDC* aDC ) ...@@ -203,14 +203,14 @@ void AbortBlockCurrentCommand( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
{ {
BASE_SCREEN* screen = aPanel->GetScreen(); BASE_SCREEN* screen = aPanel->GetScreen();
if( aPanel->IsMouseCaptured() ) /* Erase current drawing on screen */ if( aPanel->IsMouseCaptured() ) // Erase current drawing on screen
{ {
/* Clear block outline. */ // Clear block outline.
aPanel->CallMouseCapture( aDC, wxDefaultPosition, false ); aPanel->CallMouseCapture( aDC, wxDefaultPosition, false );
aPanel->SetMouseCapture( NULL, NULL ); aPanel->SetMouseCapture( NULL, NULL );
screen->SetCurItem( NULL ); screen->SetCurItem( NULL );
/* Delete the picked wrapper if this is a picked list. */ // Delete the picked wrapper if this is a picked list.
if( screen->m_BlockLocate.GetCommand() != BLOCK_PASTE ) if( screen->m_BlockLocate.GetCommand() != BLOCK_PASTE )
screen->m_BlockLocate.ClearItemsList(); screen->m_BlockLocate.ClearItemsList();
} }
......
...@@ -114,26 +114,18 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* aParent, ...@@ -114,26 +114,18 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* aParent,
m_snapToGrid = true; m_snapToGrid = true;
m_MsgFrameHeight = EDA_MSG_PANEL::GetRequiredHeight(); m_MsgFrameHeight = EDA_MSG_PANEL::GetRequiredHeight();
//#define ZOOM_DISPLAY_SIZE 60
//#define COORD_DISPLAY_SIZE 165
//#define DELTA_DISPLAY_SIZE 245
//#define UNITS_DISPLAY_SIZE 65
#define FUNCTION_DISPLAY_SIZE 110
CreateStatusBar( 6 ); CreateStatusBar( 6 );
// set the size of the status bar subwindows: // set the size of the status bar subwindows:
wxWindow* stsbar = GetStatusBar(); wxWindow* stsbar = GetStatusBar();
int dims[] = { int dims[] = {
// balance of status bar on far left is set to a default or whatever is left over. // remainder of status bar on far left is set to a default or whatever is left over.
-1, -1,
// When using GetTextSize() remember the width of '1' is not the same // When using GetTextSize() remember the width of character '1' is not the same
// as the width of '0' unless the font is fixed width, and it usually won't be. // as the width of '0' unless the font is fixed width, and it usually won't be.
// zoom: // zoom:
...@@ -148,7 +140,9 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* aParent, ...@@ -148,7 +140,9 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* aParent,
// units display, Inches is bigger than mm // units display, Inches is bigger than mm
GetTextSize( _( "Inches" ), stsbar ).x + 10, GetTextSize( _( "Inches" ), stsbar ).x + 10,
FUNCTION_DISPLAY_SIZE, // Size for the panel used as "Current tool in play": will take longest string from
// void PCB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent ) in pcbnew/edit.cpp
GetTextSize( wxT( "Add layer alignment target" ), stsbar ).x + 10,
}; };
SetStatusWidths( DIM( dims ), dims ); SetStatusWidths( DIM( dims ), dims );
...@@ -381,7 +375,7 @@ void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event ) ...@@ -381,7 +375,7 @@ void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event )
*/ */
m_LastGridSizeId = id - ID_POPUP_GRID_LEVEL_1000; m_LastGridSizeId = id - ID_POPUP_GRID_LEVEL_1000;
screen->SetGrid( id ); screen->SetGrid( id );
screen->SetCrossHairPosition( screen->RefPos( true ) ); SetCrossHairPosition( RefPos( true ) );
Refresh(); Refresh();
} }
...@@ -409,7 +403,7 @@ void EDA_DRAW_FRAME::OnSelectZoom( wxCommandEvent& event ) ...@@ -409,7 +403,7 @@ void EDA_DRAW_FRAME::OnSelectZoom( wxCommandEvent& event )
return; return;
GetScreen()->SetZoom( selectedZoom ); GetScreen()->SetZoom( selectedZoom );
RedrawScreen( GetScreen()->GetScrollCenterPosition(), false ); RedrawScreen( GetScrollCenterPosition(), false );
} }
} }
...@@ -495,7 +489,7 @@ wxPoint EDA_DRAW_FRAME::GetGridPosition( const wxPoint& aPosition ) const ...@@ -495,7 +489,7 @@ wxPoint EDA_DRAW_FRAME::GetGridPosition( const wxPoint& aPosition ) const
wxPoint pos = aPosition; wxPoint pos = aPosition;
if( m_currentScreen != NULL && m_snapToGrid ) if( m_currentScreen != NULL && m_snapToGrid )
pos = m_currentScreen->GetNearestGridPosition( aPosition ); pos = GetNearestGridPosition( aPosition );
return pos; return pos;
} }
...@@ -878,7 +872,7 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPositionIU ) ...@@ -878,7 +872,7 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPositionIU )
// Calculate the scroll bar position in internal units to place the // Calculate the scroll bar position in internal units to place the
// center position at the center of client rectangle. // center position at the center of client rectangle.
screen->SetScrollCenterPosition( centerPositionIU ); SetScrollCenterPosition( centerPositionIU );
double posX = centerPositionIU.x - clientRectIU.width /2.0 - screen->m_DrawOrg.x; double posX = centerPositionIU.x - clientRectIU.width /2.0 - screen->m_DrawOrg.x;
double posY = centerPositionIU.y - clientRectIU.height/2.0 - screen->m_DrawOrg.y; double posY = centerPositionIU.y - clientRectIU.height/2.0 - screen->m_DrawOrg.y;
...@@ -931,3 +925,61 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPositionIU ) ...@@ -931,3 +925,61 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPositionIU )
screen->m_ScrollbarPos.x, screen->m_ScrollbarPos.x,
screen->m_ScrollbarPos.y, noRefresh ); screen->m_ScrollbarPos.y, noRefresh );
} }
//-----< BASE_SCREEN API moved here >--------------------------------------------
wxPoint EDA_DRAW_FRAME::GetCrossHairPosition( bool aInvertY ) const
{
return GetScreen()->getCrossHairPosition();
}
void EDA_DRAW_FRAME::SetCrossHairPosition( const wxPoint& aPosition, bool aSnapToGrid )
{
GetScreen()->setCrossHairPosition( aPosition, GetGridOrigin(), aSnapToGrid );
}
wxPoint EDA_DRAW_FRAME::GetCursorPosition( bool aOnGrid, wxRealPoint* aGridSize ) const
{
return GetScreen()->getCursorPosition( aOnGrid, GetGridOrigin(), aGridSize );
}
wxPoint EDA_DRAW_FRAME::GetNearestGridPosition( const wxPoint& aPosition, wxRealPoint* aGridSize ) const
{
return GetScreen()->getNearestGridPosition( aPosition, GetGridOrigin(), aGridSize );
}
wxPoint EDA_DRAW_FRAME::GetCrossHairScreenPosition() const
{
return GetScreen()->getCrossHairScreenPosition();
}
void EDA_DRAW_FRAME::SetMousePosition( const wxPoint& aPosition )
{
GetScreen()->setMousePosition( aPosition );
}
wxPoint EDA_DRAW_FRAME::RefPos( bool useMouse ) const
{
return GetScreen()->refPos( useMouse );
}
const wxPoint& EDA_DRAW_FRAME::GetScrollCenterPosition() const
{
return GetScreen()->getScrollCenterPosition();
}
void EDA_DRAW_FRAME::SetScrollCenterPosition( const wxPoint& aPoint )
{
GetScreen()->setScrollCenterPosition( aPoint );
}
//-----</BASE_SCREEN API moved here >--------------------------------------------
...@@ -181,7 +181,7 @@ void EDA_DRAW_PANEL::DrawCrossHair( wxDC* aDC, EDA_COLOR_T aColor ) ...@@ -181,7 +181,7 @@ void EDA_DRAW_PANEL::DrawCrossHair( wxDC* aDC, EDA_COLOR_T aColor )
if( m_cursorLevel != 0 || aDC == NULL || !m_showCrossHair ) if( m_cursorLevel != 0 || aDC == NULL || !m_showCrossHair )
return; return;
wxPoint cursor = GetScreen()->GetCrossHairPosition(); wxPoint cursor = GetParent()->GetCrossHairPosition();
GRSetDrawMode( aDC, GR_XOR ); GRSetDrawMode( aDC, GR_XOR );
...@@ -297,7 +297,7 @@ wxPoint EDA_DRAW_PANEL::GetScreenCenterLogicalPosition() ...@@ -297,7 +297,7 @@ wxPoint EDA_DRAW_PANEL::GetScreenCenterLogicalPosition()
void EDA_DRAW_PANEL::MoveCursorToCrossHair() void EDA_DRAW_PANEL::MoveCursorToCrossHair()
{ {
MoveCursor( GetScreen()->GetCrossHairPosition() ); MoveCursor( GetParent()->GetCrossHairPosition() );
} }
...@@ -433,10 +433,10 @@ void EDA_DRAW_PANEL::OnScroll( wxScrollWinEvent& event ) ...@@ -433,10 +433,10 @@ void EDA_DRAW_PANEL::OnScroll( wxScrollWinEvent& event )
double scale = GetParent()->GetScreen()->GetScalingFactor(); double scale = GetParent()->GetScreen()->GetScalingFactor();
wxPoint center = GetParent()->GetScreen()->GetScrollCenterPosition(); wxPoint center = GetParent()->GetScrollCenterPosition();
center.x += KiROUND( (double) ( x - tmpX ) / scale ); center.x += KiROUND( (double) ( x - tmpX ) / scale );
center.y += KiROUND( (double) ( y - tmpY ) / scale ); center.y += KiROUND( (double) ( y - tmpY ) / scale );
GetParent()->GetScreen()->SetScrollCenterPosition( center ); GetParent()->SetScrollCenterPosition( center );
Scroll( x, y ); Scroll( x, y );
event.Skip(); event.Skip();
...@@ -609,7 +609,7 @@ void EDA_DRAW_PANEL::DrawBackGround( wxDC* DC ) ...@@ -609,7 +609,7 @@ void EDA_DRAW_PANEL::DrawBackGround( wxDC* DC )
DrawAuxiliaryAxis( DC, GR_COPY ); DrawAuxiliaryAxis( DC, GR_COPY );
if( GetParent()->m_showGridAxis ) if( GetParent()->m_showGridAxis )
DrawGridAxis( DC, GR_COPY ); DrawGridAxis( DC, GR_COPY, GetParent()->GetGridOrigin() );
} }
...@@ -645,7 +645,7 @@ void EDA_DRAW_PANEL::DrawGrid( wxDC* aDC ) ...@@ -645,7 +645,7 @@ void EDA_DRAW_PANEL::DrawGrid( wxDC* aDC )
if( screenGridSize.x < MIN_GRID_SIZE || screenGridSize.y < MIN_GRID_SIZE ) if( screenGridSize.x < MIN_GRID_SIZE || screenGridSize.y < MIN_GRID_SIZE )
return; return;
org = screen->GetNearestGridPosition( org, &gridSize ); org = GetParent()->GetNearestGridPosition( org, &gridSize );
// Setting the nearest grid position can select grid points outside the clip box. // Setting the nearest grid position can select grid points outside the clip box.
// Incrementing the start point by one grid step should prevent drawing grid points // Incrementing the start point by one grid step should prevent drawing grid points
...@@ -740,7 +740,7 @@ void EDA_DRAW_PANEL::DrawGrid( wxDC* aDC ) ...@@ -740,7 +740,7 @@ void EDA_DRAW_PANEL::DrawGrid( wxDC* aDC )
void EDA_DRAW_PANEL::DrawAuxiliaryAxis( wxDC* aDC, GR_DRAWMODE aDrawMode ) void EDA_DRAW_PANEL::DrawAuxiliaryAxis( wxDC* aDC, GR_DRAWMODE aDrawMode )
{ {
wxPoint origin = GetParent()->GetOriginAxisPosition(); wxPoint origin = GetParent()->GetAuxOrigin();
if( origin == wxPoint( 0, 0 ) ) if( origin == wxPoint( 0, 0 ) )
return; return;
...@@ -768,33 +768,30 @@ void EDA_DRAW_PANEL::DrawAuxiliaryAxis( wxDC* aDC, GR_DRAWMODE aDrawMode ) ...@@ -768,33 +768,30 @@ void EDA_DRAW_PANEL::DrawAuxiliaryAxis( wxDC* aDC, GR_DRAWMODE aDrawMode )
} }
void EDA_DRAW_PANEL::DrawGridAxis( wxDC* aDC, GR_DRAWMODE aDrawMode ) void EDA_DRAW_PANEL::DrawGridAxis( wxDC* aDC, GR_DRAWMODE aDrawMode, const wxPoint& aGridOrigin )
{ {
BASE_SCREEN* screen = GetScreen(); if( !GetParent()->m_showGridAxis || ( !aGridOrigin.x && !aGridOrigin.y ) )
if( !GetParent()->m_showGridAxis
|| ( screen->m_GridOrigin.x == 0 && screen->m_GridOrigin.y == 0 ) )
return; return;
EDA_COLOR_T color = GetParent()->GetGridColor(); EDA_COLOR_T color = GetParent()->GetGridColor();
wxSize pageSize = GetParent()->GetPageSizeIU(); wxSize pageSize = GetParent()->GetPageSizeIU();
GRSetDrawMode( aDC, aDrawMode ); GRSetDrawMode( aDC, aDrawMode );
// Draw the Y axis // Draw the Y axis
GRDashedLine( &m_ClipBox, aDC, GRDashedLine( &m_ClipBox, aDC,
screen->m_GridOrigin.x, aGridOrigin.x,
-pageSize.y, -pageSize.y,
screen->m_GridOrigin.x, aGridOrigin.x,
pageSize.y, pageSize.y,
0, color ); 0, color );
// Draw the X axis // Draw the X axis
GRDashedLine( &m_ClipBox, aDC, GRDashedLine( &m_ClipBox, aDC,
-pageSize.x, -pageSize.x,
screen->m_GridOrigin.y, aGridOrigin.y,
pageSize.x, pageSize.x,
screen->m_GridOrigin.y, aGridOrigin.y,
0, color ); 0, color );
} }
...@@ -846,7 +843,7 @@ void EDA_DRAW_PANEL::OnMouseLeaving( wxMouseEvent& event ) ...@@ -846,7 +843,7 @@ void EDA_DRAW_PANEL::OnMouseLeaving( wxMouseEvent& event )
cross_hair_pos.x = dc.DeviceToLogicalX( cross_hair_pos.x ); cross_hair_pos.x = dc.DeviceToLogicalX( cross_hair_pos.x );
cross_hair_pos.y = dc.DeviceToLogicalY( cross_hair_pos.y ); cross_hair_pos.y = dc.DeviceToLogicalY( cross_hair_pos.y );
GetScreen()->SetCrossHairPosition( cross_hair_pos ); GetParent()->SetCrossHairPosition( cross_hair_pos );
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED, ID_POPUP_ZOOM_CENTER ); wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED, ID_POPUP_ZOOM_CENTER );
cmd.SetEventObject( this ); cmd.SetEventObject( this );
...@@ -876,7 +873,7 @@ void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event ) ...@@ -876,7 +873,7 @@ void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event )
} }
INSTALL_UNBUFFERED_DC( dc, this ); INSTALL_UNBUFFERED_DC( dc, this );
GetScreen()->SetCrossHairPosition( event.GetLogicalPosition( dc ) ); GetParent()->SetCrossHairPosition( event.GetLogicalPosition( dc ) );
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this ); cmd.SetEventObject( this );
...@@ -970,7 +967,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event ) ...@@ -970,7 +967,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
DC.SetBackground( *wxBLACK_BRUSH ); DC.SetBackground( *wxBLACK_BRUSH );
// Compute the cursor position in drawing (logical) units. // Compute the cursor position in drawing (logical) units.
screen->SetMousePosition( event.GetLogicalPosition( DC ) ); GetParent()->SetMousePosition( event.GetLogicalPosition( DC ) );
int kbstat = 0; int kbstat = 0;
...@@ -986,7 +983,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event ) ...@@ -986,7 +983,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
// Calling Double Click and Click functions : // Calling Double Click and Click functions :
if( localbutt == (int) ( GR_M_LEFT_DOWN | GR_M_DCLICK ) ) if( localbutt == (int) ( GR_M_LEFT_DOWN | GR_M_DCLICK ) )
{ {
GetParent()->OnLeftDClick( &DC, screen->RefPos( true ) ); GetParent()->OnLeftDClick( &DC, GetParent()->RefPos( true ) );
// inhibit a response to the mouse left button release, // inhibit a response to the mouse left button release,
// because we have a double click, and we do not want a new // because we have a double click, and we do not want a new
...@@ -1003,7 +1000,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event ) ...@@ -1003,7 +1000,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
m_ignoreNextLeftButtonRelease = false; m_ignoreNextLeftButtonRelease = false;
if( screen->m_BlockLocate.GetState() == STATE_NO_BLOCK && !ignoreEvt ) if( screen->m_BlockLocate.GetState() == STATE_NO_BLOCK && !ignoreEvt )
GetParent()->OnLeftClick( &DC, screen->RefPos( true ) ); GetParent()->OnLeftClick( &DC, GetParent()->RefPos( true ) );
} }
else if( !event.LeftIsDown() ) else if( !event.LeftIsDown() )
...@@ -1027,7 +1024,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event ) ...@@ -1027,7 +1024,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
m_PanStartCenter.y *= ppuy; m_PanStartCenter.y *= ppuy;
} }
else else
m_PanStartCenter = GetParent()->GetScreen()->GetScrollCenterPosition(); m_PanStartCenter = GetParent()->GetScrollCenterPosition();
m_PanStartEventPosition = event.GetPosition(); m_PanStartEventPosition = event.GetPosition();
...@@ -1101,10 +1098,10 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event ) ...@@ -1101,10 +1098,10 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
double scale = GetParent()->GetScreen()->GetScalingFactor(); double scale = GetParent()->GetScreen()->GetScalingFactor();
wxPoint center = GetParent()->GetScreen()->GetScrollCenterPosition(); wxPoint center = GetParent()->GetScrollCenterPosition();
center.x += KiROUND( (double) ( x - tmpX ) / scale ) / ppux; center.x += KiROUND( (double) ( x - tmpX ) / scale ) / ppux;
center.y += KiROUND( (double) ( y - tmpY ) / scale ) / ppuy; center.y += KiROUND( (double) ( y - tmpY ) / scale ) / ppuy;
GetParent()->GetScreen()->SetScrollCenterPosition( center ); GetParent()->SetScrollCenterPosition( center );
Refresh(); Refresh();
Update(); Update();
...@@ -1164,7 +1161,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event ) ...@@ -1164,7 +1161,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
* (a filter creates a delay for the real block command start, and * (a filter creates a delay for the real block command start, and
* we must remember this point) * we must remember this point)
*/ */
m_CursorStartPos = screen->GetCrossHairPosition(); m_CursorStartPos = GetParent()->GetCrossHairPosition();
} }
if( m_enableBlockCommands && !(localbutt & GR_M_DCLICK) ) if( m_enableBlockCommands && !(localbutt & GR_M_DCLICK) )
...@@ -1323,17 +1320,14 @@ void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event ) ...@@ -1323,17 +1320,14 @@ void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
INSTALL_UNBUFFERED_DC( DC, this ); INSTALL_UNBUFFERED_DC( DC, this );
BASE_SCREEN* Screen = GetScreen();
// Some key commands use the current mouse position: refresh it. // Some key commands use the current mouse position: refresh it.
pos = wxGetMousePosition() - GetScreenPosition(); pos = wxGetMousePosition() - GetScreenPosition();
// Compute the cursor position in drawing units. Also known as logical units to wxDC. // Compute the cursor position in drawing units. Also known as logical units to wxDC.
pos = wxPoint( DC.DeviceToLogicalX( pos.x ), DC.DeviceToLogicalY( pos.y ) ); pos = wxPoint( DC.DeviceToLogicalX( pos.x ), DC.DeviceToLogicalY( pos.y ) );
Screen->SetMousePosition( pos );
GetParent()->SetMousePosition( pos );
GetParent()->GeneralControl( &DC, pos, localkey ); GetParent()->GeneralControl( &DC, pos, localkey );
} }
......
...@@ -76,6 +76,7 @@ fp_poly ...@@ -76,6 +76,7 @@ fp_poly
fp_text fp_text
full full
general general
grid_origin
gr_arc gr_arc
gr_circle gr_circle
gr_curve gr_curve
......
...@@ -57,7 +57,7 @@ void EDA_DRAW_FRAME::RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointe ...@@ -57,7 +57,7 @@ void EDA_DRAW_FRAME::RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointe
void EDA_DRAW_FRAME::RedrawScreen2( const wxPoint& posBefore ) void EDA_DRAW_FRAME::RedrawScreen2( const wxPoint& posBefore )
{ {
wxPoint dPos = posBefore - m_canvas->GetClientSize() / 2; // relative screen position to center before zoom wxPoint dPos = posBefore - m_canvas->GetClientSize() / 2; // relative screen position to center before zoom
wxPoint newScreenPos = m_canvas->ToDeviceXY( GetScreen()->GetCrossHairPosition() ); // screen position of crosshair after zoom wxPoint newScreenPos = m_canvas->ToDeviceXY( GetCrossHairPosition() ); // screen position of crosshair after zoom
wxPoint newCenter = m_canvas->ToLogicalXY( newScreenPos - dPos ); wxPoint newCenter = m_canvas->ToLogicalXY( newScreenPos - dPos );
AdjustScrollBars( newCenter ); AdjustScrollBars( newCenter );
...@@ -80,9 +80,9 @@ void EDA_DRAW_FRAME::Zoom_Automatique( bool aWarpPointer ) ...@@ -80,9 +80,9 @@ void EDA_DRAW_FRAME::Zoom_Automatique( bool aWarpPointer )
screen->SetScalingFactor( bestzoom ); screen->SetScalingFactor( bestzoom );
if( screen->m_FirstRedraw ) if( screen->m_FirstRedraw )
screen->SetCrossHairPosition( screen->GetScrollCenterPosition() ); SetCrossHairPosition( GetScrollCenterPosition() );
RedrawScreen( screen->GetScrollCenterPosition(), aWarpPointer ); RedrawScreen( GetScrollCenterPosition(), aWarpPointer );
} }
...@@ -120,19 +120,19 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event ) ...@@ -120,19 +120,19 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event )
int id = event.GetId(); int id = event.GetId();
bool zoom_at_cursor = false; bool zoom_at_cursor = false;
BASE_SCREEN* screen = GetScreen(); BASE_SCREEN* screen = GetScreen();
wxPoint center = screen->GetScrollCenterPosition(); wxPoint center = GetScrollCenterPosition();
switch( id ) switch( id )
{ {
case ID_OFFCENTER_ZOOM_IN: case ID_OFFCENTER_ZOOM_IN:
center = m_canvas->ToDeviceXY( screen->GetCrossHairPosition() ); center = m_canvas->ToDeviceXY( GetCrossHairPosition() );
if( screen->SetPreviousZoom() ) if( screen->SetPreviousZoom() )
RedrawScreen2( center ); RedrawScreen2( center );
break; break;
case ID_POPUP_ZOOM_IN: case ID_POPUP_ZOOM_IN:
zoom_at_cursor = true; zoom_at_cursor = true;
center = screen->GetCrossHairPosition(); center = GetCrossHairPosition();
// fall thru // fall thru
case ID_ZOOM_IN: case ID_ZOOM_IN:
...@@ -141,14 +141,14 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event ) ...@@ -141,14 +141,14 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event )
break; break;
case ID_OFFCENTER_ZOOM_OUT: case ID_OFFCENTER_ZOOM_OUT:
center = m_canvas->ToDeviceXY( screen->GetCrossHairPosition() ); center = m_canvas->ToDeviceXY( GetCrossHairPosition() );
if( screen->SetNextZoom() ) if( screen->SetNextZoom() )
RedrawScreen2( center ); RedrawScreen2( center );
break; break;
case ID_POPUP_ZOOM_OUT: case ID_POPUP_ZOOM_OUT:
zoom_at_cursor = true; zoom_at_cursor = true;
center = screen->GetCrossHairPosition(); center = GetCrossHairPosition();
// fall thru // fall thru
case ID_ZOOM_OUT: case ID_ZOOM_OUT:
...@@ -161,7 +161,7 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event ) ...@@ -161,7 +161,7 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event )
break; break;
case ID_POPUP_ZOOM_CENTER: case ID_POPUP_ZOOM_CENTER:
center = screen->GetCrossHairPosition(); center = GetCrossHairPosition();
RedrawScreen( center, true ); RedrawScreen( center, true );
break; break;
......
...@@ -339,8 +339,8 @@ void DISPLAY_FOOTPRINTS_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPositi ...@@ -339,8 +339,8 @@ void DISPLAY_FOOTPRINTS_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPositi
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this ); cmd.SetEventObject( this );
pos = screen->GetNearestGridPosition( pos ); pos = GetNearestGridPosition( pos );
oldpos = screen->GetCrossHairPosition(); oldpos = GetCrossHairPosition();
gridSize = screen->GetGridSize(); gridSize = screen->GetGridSize();
switch( aHotKey ) switch( aHotKey )
...@@ -371,7 +371,7 @@ void DISPLAY_FOOTPRINTS_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPositi ...@@ -371,7 +371,7 @@ void DISPLAY_FOOTPRINTS_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPositi
break; break;
case ' ': case ' ':
screen->m_O_Curseur = screen->GetCrossHairPosition(); screen->m_O_Curseur = GetCrossHairPosition();
break; break;
case WXK_NUMPAD8: /* cursor moved up */ case WXK_NUMPAD8: /* cursor moved up */
...@@ -399,14 +399,14 @@ void DISPLAY_FOOTPRINTS_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPositi ...@@ -399,14 +399,14 @@ void DISPLAY_FOOTPRINTS_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPositi
break; break;
} }
screen->SetCrossHairPosition( pos ); SetCrossHairPosition( pos );
if( oldpos != screen->GetCrossHairPosition() ) if( oldpos != GetCrossHairPosition() )
{ {
pos = screen->GetCrossHairPosition(); pos = GetCrossHairPosition();
screen->SetCrossHairPosition( oldpos ); SetCrossHairPosition( oldpos );
m_canvas->CrossHairOff( aDC ); m_canvas->CrossHairOff( aDC );
screen->SetCrossHairPosition( pos ); SetCrossHairPosition( pos );
m_canvas->CrossHairOn( aDC ); m_canvas->CrossHairOn( aDC );
if( m_canvas->IsMouseCaptured() ) if( m_canvas->IsMouseCaptured() )
......
...@@ -215,7 +215,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -215,7 +215,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
block->SetState( state ); block->SetState( state );
block->SetCommand( command ); block->SetCommand( command );
m_canvas->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand ); m_canvas->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand );
GetScreen()->SetCrossHairPosition( block->GetEnd() ); SetCrossHairPosition( block->GetEnd() );
if( block->GetCommand() != BLOCK_ABORT ) if( block->GetCommand() != BLOCK_ABORT )
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
...@@ -237,8 +237,8 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -237,8 +237,8 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
{ {
// Compute the rotation center and put it on grid: // Compute the rotation center and put it on grid:
wxPoint rotationPoint = block->Centre(); wxPoint rotationPoint = block->Centre();
rotationPoint = GetScreen()->GetNearestGridPosition( rotationPoint ); rotationPoint = GetNearestGridPosition( rotationPoint );
GetScreen()->SetCrossHairPosition( rotationPoint ); SetCrossHairPosition( rotationPoint );
SaveCopyInUndoList( block->GetItems(), UR_ROTATED, rotationPoint ); SaveCopyInUndoList( block->GetItems(), UR_ROTATED, rotationPoint );
RotateListOfItems( block->GetItems(), rotationPoint ); RotateListOfItems( block->GetItems(), rotationPoint );
OnModify(); OnModify();
...@@ -433,8 +433,8 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -433,8 +433,8 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
{ {
/* Compute the rotation center and put it on grid */ /* Compute the rotation center and put it on grid */
wxPoint rotationPoint = block->Centre(); wxPoint rotationPoint = block->Centre();
rotationPoint = GetScreen()->GetNearestGridPosition( rotationPoint ); rotationPoint = GetNearestGridPosition( rotationPoint );
GetScreen()->SetCrossHairPosition( rotationPoint ); SetCrossHairPosition( rotationPoint );
SaveCopyInUndoList( block->GetItems(), UR_ROTATED, rotationPoint ); SaveCopyInUndoList( block->GetItems(), UR_ROTATED, rotationPoint );
RotateListOfItems( block->GetItems(), rotationPoint ); RotateListOfItems( block->GetItems(), rotationPoint );
OnModify(); OnModify();
...@@ -452,8 +452,8 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -452,8 +452,8 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
{ {
/* Compute the mirror center and put it on grid */ /* Compute the mirror center and put it on grid */
wxPoint mirrorPoint = block->Centre(); wxPoint mirrorPoint = block->Centre();
mirrorPoint = GetScreen()->GetNearestGridPosition( mirrorPoint ); mirrorPoint = GetNearestGridPosition( mirrorPoint );
GetScreen()->SetCrossHairPosition( mirrorPoint ); SetCrossHairPosition( mirrorPoint );
SaveCopyInUndoList( block->GetItems(), UR_MIRRORED_X, mirrorPoint ); SaveCopyInUndoList( block->GetItems(), UR_MIRRORED_X, mirrorPoint );
MirrorX( block->GetItems(), mirrorPoint ); MirrorX( block->GetItems(), mirrorPoint );
OnModify(); OnModify();
...@@ -471,8 +471,8 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -471,8 +471,8 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
{ {
/* Compute the mirror center and put it on grid */ /* Compute the mirror center and put it on grid */
wxPoint mirrorPoint = block->Centre(); wxPoint mirrorPoint = block->Centre();
mirrorPoint = GetScreen()->GetNearestGridPosition( mirrorPoint ); mirrorPoint = GetNearestGridPosition( mirrorPoint );
GetScreen()->SetCrossHairPosition( mirrorPoint ); SetCrossHairPosition( mirrorPoint );
SaveCopyInUndoList( block->GetItems(), UR_MIRRORED_Y, mirrorPoint ); SaveCopyInUndoList( block->GetItems(), UR_MIRRORED_Y, mirrorPoint );
MirrorY( block->GetItems(), mirrorPoint ); MirrorY( block->GetItems(), mirrorPoint );
OnModify(); OnModify();
...@@ -519,7 +519,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx ...@@ -519,7 +519,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
} }
/* Repaint new view. */ /* Repaint new view. */
block->SetMoveVector( screen->GetCrossHairPosition() - block->GetLastCursorPosition() ); block->SetMoveVector( aPanel->GetParent()->GetCrossHairPosition() - block->GetLastCursorPosition() );
block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() ); block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );
for( unsigned ii = 0; ii < block->GetCount(); ii++ ) for( unsigned ii = 0; ii < block->GetCount(); ii++ )
......
...@@ -99,8 +99,8 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -99,8 +99,8 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
GetScreen()->m_BlockLocate.SetState( state ); GetScreen()->m_BlockLocate.SetState( state );
GetScreen()->m_BlockLocate.SetCommand( command ); GetScreen()->m_BlockLocate.SetCommand( command );
m_canvas->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand ); m_canvas->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand );
GetScreen()->SetCrossHairPosition( wxPoint( GetScreen()->m_BlockLocate.GetRight(), SetCrossHairPosition( wxPoint( GetScreen()->m_BlockLocate.GetRight(),
GetScreen()->m_BlockLocate.GetBottom() ) ); GetScreen()->m_BlockLocate.GetBottom() ) );
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
} }
...@@ -171,7 +171,7 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -171,7 +171,7 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
SaveCopyInUndoList( m_component ); SaveCopyInUndoList( m_component );
pt = GetScreen()->m_BlockLocate.Centre(); pt = GetScreen()->m_BlockLocate.Centre();
pt = GetScreen()->GetNearestGridPosition( pt ); pt = GetNearestGridPosition( pt );
NEGATE( pt.y ); NEGATE( pt.y );
if ( m_component ) if ( m_component )
...@@ -183,7 +183,7 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -183,7 +183,7 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
m_component->MirrorSelectedItemsH( pt ); m_component->MirrorSelectedItemsH( pt );
else if( block_cmd == BLOCK_MIRROR_X) else if( block_cmd == BLOCK_MIRROR_X)
m_component->MirrorSelectedItemsV( pt ); m_component->MirrorSelectedItemsV( pt );
else if( block_cmd == BLOCK_ROTATE) else if( block_cmd == BLOCK_ROTATE )
m_component->RotateSelectedItems( pt ); m_component->RotateSelectedItems( pt );
} }
...@@ -275,7 +275,7 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) ...@@ -275,7 +275,7 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
SaveCopyInUndoList( m_component ); SaveCopyInUndoList( m_component );
pt = GetScreen()->m_BlockLocate.Centre(); pt = GetScreen()->m_BlockLocate.Centre();
pt = GetScreen()->GetNearestGridPosition( pt ); pt = GetNearestGridPosition( pt );
NEGATE( pt.y ); NEGATE( pt.y );
if ( m_component ) if ( m_component )
...@@ -342,7 +342,7 @@ void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& ...@@ -342,7 +342,7 @@ void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
} }
// Repaint new view // Repaint new view
block->SetMoveVector( screen->GetCrossHairPosition() - block->GetLastCursorPosition() ); block->SetMoveVector( parent->GetCrossHairPosition() - block->GetLastCursorPosition() );
GRSetDrawMode( aDC, g_XorMode ); GRSetDrawMode( aDC, g_XorMode );
block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() ); block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );
......
...@@ -81,8 +81,9 @@ static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi ...@@ -81,8 +81,9 @@ static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi
} }
} }
wxPoint endpos = aPanel->GetScreen()->GetCrossHairPosition(); SCH_EDIT_FRAME* frame = (SCH_EDIT_FRAME*) aPanel->GetParent();
SCH_EDIT_FRAME * frame = ( SCH_EDIT_FRAME * ) aPanel->GetParent();
wxPoint endpos = frame->GetCrossHairPosition();
if( frame->GetForceHVLines() ) /* Coerce the line to vertical or horizontal one: */ if( frame->GetForceHVLines() ) /* Coerce the line to vertical or horizontal one: */
ComputeBreakPoint( (SCH_LINE*) s_wires.GetLast()->Back(), endpos ); ComputeBreakPoint( (SCH_LINE*) s_wires.GetLast()->Back(), endpos );
...@@ -105,7 +106,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type ) ...@@ -105,7 +106,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
{ {
SCH_LINE* segment; SCH_LINE* segment;
SCH_LINE* nextSegment; SCH_LINE* nextSegment;
wxPoint cursorpos = GetScreen()->GetCrossHairPosition(); wxPoint cursorpos = GetCrossHairPosition();
// We should know if a segment is currently in progress // We should know if a segment is currently in progress
segment = (SCH_LINE*) GetScreen()->GetCurItem(); segment = (SCH_LINE*) GetScreen()->GetCurItem();
...@@ -426,8 +427,9 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC ) ...@@ -426,8 +427,9 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC )
if( m_itemToRepeat->Type() == SCH_COMPONENT_T ) // If repeat component then put in move mode if( m_itemToRepeat->Type() == SCH_COMPONENT_T ) // If repeat component then put in move mode
{ {
wxPoint pos = GetScreen()->GetCrossHairPosition() - wxPoint pos = GetCrossHairPosition() -
( (SCH_COMPONENT*) m_itemToRepeat )->GetPosition(); ( (SCH_COMPONENT*) m_itemToRepeat )->GetPosition();
m_itemToRepeat->SetFlags( IS_NEW ); m_itemToRepeat->SetFlags( IS_NEW );
( (SCH_COMPONENT*) m_itemToRepeat )->SetTimeStamp( GetNewTimeStamp() ); ( (SCH_COMPONENT*) m_itemToRepeat )->SetTimeStamp( GetNewTimeStamp() );
m_itemToRepeat->Move( pos ); m_itemToRepeat->Move( pos );
......
...@@ -45,10 +45,9 @@ static int s_LastShape = '\\'; ...@@ -45,10 +45,9 @@ static int s_LastShape = '\\';
SCH_BUS_BUS_ENTRY* SCH_EDIT_FRAME::CreateBusBusEntry( wxDC* aDC ) SCH_BUS_BUS_ENTRY* SCH_EDIT_FRAME::CreateBusBusEntry( wxDC* aDC )
{ {
SCH_SCREEN* screen = GetScreen();
// Create and place a new bus entry at cursor position // Create and place a new bus entry at cursor position
SCH_BUS_BUS_ENTRY* busEntry = new SCH_BUS_BUS_ENTRY( screen->GetCrossHairPosition(), s_LastShape ); SCH_BUS_BUS_ENTRY* busEntry = new SCH_BUS_BUS_ENTRY( GetCrossHairPosition(), s_LastShape );
busEntry->SetFlags( IS_NEW ); busEntry->SetFlags( IS_NEW );
GetScreen()->SetCurItem( busEntry ); GetScreen()->SetCurItem( busEntry );
addCurrentItemToList( aDC ); addCurrentItemToList( aDC );
...@@ -57,10 +56,9 @@ SCH_BUS_BUS_ENTRY* SCH_EDIT_FRAME::CreateBusBusEntry( wxDC* aDC ) ...@@ -57,10 +56,9 @@ SCH_BUS_BUS_ENTRY* SCH_EDIT_FRAME::CreateBusBusEntry( wxDC* aDC )
SCH_BUS_WIRE_ENTRY* SCH_EDIT_FRAME::CreateBusWireEntry( wxDC* aDC ) SCH_BUS_WIRE_ENTRY* SCH_EDIT_FRAME::CreateBusWireEntry( wxDC* aDC )
{ {
SCH_SCREEN* screen = GetScreen();
// Create and place a new bus entry at cursor position // Create and place a new bus entry at cursor position
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( screen->GetCrossHairPosition(), s_LastShape ); SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( GetCrossHairPosition(), s_LastShape );
busEntry->SetFlags( IS_NEW ); busEntry->SetFlags( IS_NEW );
GetScreen()->SetCurItem( busEntry ); GetScreen()->SetCurItem( busEntry );
addCurrentItemToList( aDC ); addCurrentItemToList( aDC );
......
...@@ -56,7 +56,7 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateAndShowItem( const wxPoint& aPosition, const KIC ...@@ -56,7 +56,7 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateAndShowItem( const wxPoint& aPosition, const KIC
wxString msg; wxString msg;
LIB_PIN* Pin = NULL; LIB_PIN* Pin = NULL;
SCH_COMPONENT* LibItem = NULL; SCH_COMPONENT* LibItem = NULL;
wxPoint gridPosition = GetScreen()->GetNearestGridPosition( aPosition ); wxPoint gridPosition = GetNearestGridPosition( aPosition );
// Check the on grid position first. There is more likely to be multiple items on // Check the on grid position first. There is more likely to be multiple items on
// grid than off grid. // grid than off grid.
...@@ -222,9 +222,9 @@ void SCH_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH ...@@ -222,9 +222,9 @@ void SCH_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
snapToGrid = true; snapToGrid = true;
if( snapToGrid ) if( snapToGrid )
pos = screen->GetNearestGridPosition( pos ); pos = GetNearestGridPosition( pos );
oldpos = screen->GetCrossHairPosition(); oldpos = GetCrossHairPosition();
gridSize = screen->GetGridSize(); gridSize = screen->GetGridSize();
switch( aHotKey ) switch( aHotKey )
...@@ -261,14 +261,14 @@ void SCH_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH ...@@ -261,14 +261,14 @@ void SCH_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
} }
// Update cursor position. // Update cursor position.
screen->SetCrossHairPosition( pos, snapToGrid ); SetCrossHairPosition( pos, snapToGrid );
if( oldpos != screen->GetCrossHairPosition() ) if( oldpos != GetCrossHairPosition() )
{ {
pos = screen->GetCrossHairPosition(); pos = GetCrossHairPosition();
screen->SetCrossHairPosition( oldpos, false); SetCrossHairPosition( oldpos, false);
m_canvas->CrossHairOff( aDC ); m_canvas->CrossHairOff( aDC );
screen->SetCrossHairPosition( pos, snapToGrid ); SetCrossHairPosition( pos, snapToGrid );
m_canvas->CrossHairOn( aDC ); m_canvas->CrossHairOn( aDC );
if( m_canvas->IsMouseCaptured() ) if( m_canvas->IsMouseCaptured() )
...@@ -304,7 +304,6 @@ void SCH_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH ...@@ -304,7 +304,6 @@ void SCH_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
void LIB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey ) void LIB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
{ {
wxRealPoint gridSize; wxRealPoint gridSize;
SCH_SCREEN* screen = GetScreen();
wxPoint oldpos; wxPoint oldpos;
wxPoint pos = aPosition; wxPoint pos = aPosition;
...@@ -320,10 +319,10 @@ void LIB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH ...@@ -320,10 +319,10 @@ void LIB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
snapToGrid = true; snapToGrid = true;
if( snapToGrid ) if( snapToGrid )
pos = screen->GetNearestGridPosition( pos ); pos = GetNearestGridPosition( pos );
oldpos = screen->GetCrossHairPosition(); oldpos = GetCrossHairPosition();
gridSize = screen->GetGridSize(); gridSize = GetScreen()->GetGridSize();
switch( aHotKey ) switch( aHotKey )
{ {
...@@ -359,14 +358,14 @@ void LIB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH ...@@ -359,14 +358,14 @@ void LIB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
} }
// Update the cursor position. // Update the cursor position.
screen->SetCrossHairPosition( pos, snapToGrid ); SetCrossHairPosition( pos, snapToGrid );
if( oldpos != screen->GetCrossHairPosition() ) if( oldpos != GetCrossHairPosition() )
{ {
pos = screen->GetCrossHairPosition(); pos = GetCrossHairPosition();
screen->SetCrossHairPosition( oldpos, false ); SetCrossHairPosition( oldpos, false );
m_canvas->CrossHairOff( aDC ); m_canvas->CrossHairOff( aDC );
screen->SetCrossHairPosition( pos, snapToGrid ); SetCrossHairPosition( pos, snapToGrid );
m_canvas->CrossHairOn( aDC ); m_canvas->CrossHairOn( aDC );
if( m_canvas->IsMouseCaptured() ) if( m_canvas->IsMouseCaptured() )
...@@ -403,8 +402,8 @@ void LIB_VIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH ...@@ -403,8 +402,8 @@ void LIB_VIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
wxPoint oldpos; wxPoint oldpos;
wxPoint pos = aPosition; wxPoint pos = aPosition;
pos = screen->GetNearestGridPosition( pos ); pos = GetNearestGridPosition( pos );
oldpos = screen->GetCrossHairPosition(); oldpos = GetCrossHairPosition();
gridSize = screen->GetGridSize(); gridSize = screen->GetGridSize();
switch( aHotKey ) switch( aHotKey )
...@@ -441,14 +440,14 @@ void LIB_VIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH ...@@ -441,14 +440,14 @@ void LIB_VIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
} }
// Update cursor position. // Update cursor position.
screen->SetCrossHairPosition( pos ); SetCrossHairPosition( pos );
if( oldpos != screen->GetCrossHairPosition() ) if( oldpos != GetCrossHairPosition() )
{ {
pos = screen->GetCrossHairPosition(); pos = GetCrossHairPosition();
screen->SetCrossHairPosition( oldpos ); SetCrossHairPosition( oldpos );
m_canvas->CrossHairOff( aDC ); m_canvas->CrossHairOff( aDC );
screen->SetCrossHairPosition( pos ); SetCrossHairPosition( pos );
m_canvas->CrossHairOn( aDC ); m_canvas->CrossHairOn( aDC );
if( m_canvas->IsMouseCaptured() ) if( m_canvas->IsMouseCaptured() )
......
...@@ -205,7 +205,7 @@ void DIALOG_ERC::OnLeftClickMarkersList( wxCommandEvent& event ) ...@@ -205,7 +205,7 @@ void DIALOG_ERC::OnLeftClickMarkersList( wxCommandEvent& event )
} }
m_lastMarkerFound = marker; m_lastMarkerFound = marker;
m_parent->GetScreen()->SetCrossHairPosition( marker->m_Pos ); m_parent->SetCrossHairPosition( marker->m_Pos );
m_parent->RedrawScreen( marker->m_Pos, false); m_parent->RedrawScreen( marker->m_Pos, false);
} }
...@@ -218,7 +218,7 @@ void DIALOG_ERC::OnLeftDblClickMarkersList( wxCommandEvent& event ) ...@@ -218,7 +218,7 @@ void DIALOG_ERC::OnLeftDblClickMarkersList( wxCommandEvent& event )
// (NULL if not found) // (NULL if not found)
if( m_lastMarkerFound ) if( m_lastMarkerFound )
{ {
m_parent->GetScreen()->SetCrossHairPosition( m_lastMarkerFound->m_Pos ); m_parent->SetCrossHairPosition( m_lastMarkerFound->m_Pos );
m_parent->RedrawScreen( m_lastMarkerFound->m_Pos, true); m_parent->RedrawScreen( m_lastMarkerFound->m_Pos, true);
// prevent a mouse left button release event in // prevent a mouse left button release event in
// coming from the ERC dialog double click // coming from the ERC dialog double click
......
...@@ -93,7 +93,7 @@ static void moveBitmap( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosit ...@@ -93,7 +93,7 @@ static void moveBitmap( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosit
} }
// Draw the bitmap at it's new position. // Draw the bitmap at it's new position.
image->SetPosition( screen->GetCrossHairPosition() ); image->SetPosition( aPanel->GetParent()->GetCrossHairPosition() );
image->Draw( aPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); image->Draw( aPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
} }
...@@ -116,7 +116,7 @@ SCH_BITMAP* SCH_EDIT_FRAME::CreateNewImage( wxDC* aDC ) ...@@ -116,7 +116,7 @@ SCH_BITMAP* SCH_EDIT_FRAME::CreateNewImage( wxDC* aDC )
return NULL; return NULL;
} }
wxPoint pos = GetScreen()->GetCrossHairPosition(); wxPoint pos = GetCrossHairPosition();
SCH_BITMAP* image = new SCH_BITMAP( pos ); SCH_BITMAP* image = new SCH_BITMAP( pos );
...@@ -149,7 +149,7 @@ void SCH_EDIT_FRAME::MoveImage( SCH_BITMAP* aImageItem, wxDC* aDC ) ...@@ -149,7 +149,7 @@ void SCH_EDIT_FRAME::MoveImage( SCH_BITMAP* aImageItem, wxDC* aDC )
SetUndoItem( aImageItem ); SetUndoItem( aImageItem );
m_canvas->CrossHairOff( aDC ); m_canvas->CrossHairOff( aDC );
GetScreen()->SetCrossHairPosition( aImageItem->GetPosition() ); SetCrossHairPosition( aImageItem->GetPosition() );
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
m_canvas->CrossHairOn( aDC ); m_canvas->CrossHairOn( aDC );
......
...@@ -77,20 +77,20 @@ SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* aDC, int aType ) ...@@ -77,20 +77,20 @@ SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* aDC, int aType )
switch( aType ) switch( aType )
{ {
case LAYER_NOTES: case LAYER_NOTES:
textItem = new SCH_TEXT( GetScreen()->GetCrossHairPosition() ); textItem = new SCH_TEXT( GetCrossHairPosition() );
break; break;
case LAYER_LOCLABEL: case LAYER_LOCLABEL:
textItem = new SCH_LABEL( GetScreen()->GetCrossHairPosition() ); textItem = new SCH_LABEL( GetCrossHairPosition() );
break; break;
case LAYER_HIERLABEL: case LAYER_HIERLABEL:
textItem = new SCH_HIERLABEL( GetScreen()->GetCrossHairPosition() ); textItem = new SCH_HIERLABEL( GetCrossHairPosition() );
textItem->SetShape( lastGlobalLabelShape ); textItem->SetShape( lastGlobalLabelShape );
break; break;
case LAYER_GLOBLABEL: case LAYER_GLOBLABEL:
textItem = new SCH_GLOBALLABEL( GetScreen()->GetCrossHairPosition() ); textItem = new SCH_GLOBALLABEL( GetCrossHairPosition() );
textItem->SetShape( lastGlobalLabelShape ); textItem->SetShape( lastGlobalLabelShape );
break; break;
......
...@@ -90,7 +90,7 @@ void SCH_EDIT_FRAME::OnFindDrcMarker( wxFindDialogEvent& event ) ...@@ -90,7 +90,7 @@ void SCH_EDIT_FRAME::OnFindDrcMarker( wxFindDialogEvent& event )
m_CurrentSheet->UpdateAllScreenReferences(); m_CurrentSheet->UpdateAllScreenReferences();
} }
sheetFoundIn->LastScreen()->SetCrossHairPosition( lastMarker->GetPosition() ); SetCrossHairPosition( lastMarker->GetPosition() );
RedrawScreen( lastMarker->GetPosition(), warpCursor ); RedrawScreen( lastMarker->GetPosition(), warpCursor );
...@@ -213,7 +213,7 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& aReference, ...@@ -213,7 +213,7 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& aReference,
if( centerAndRedraw ) if( centerAndRedraw )
{ {
GetScreen()->SetCrossHairPosition(pos); SetCrossHairPosition( pos );
RedrawScreen( pos, aWarpMouse ); RedrawScreen( pos, aWarpMouse );
} }
...@@ -226,7 +226,7 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& aReference, ...@@ -226,7 +226,7 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& aReference,
if( aWarpMouse ) if( aWarpMouse )
m_canvas->MoveCursor( pos ); m_canvas->MoveCursor( pos );
GetScreen()->SetCrossHairPosition(pos); SetCrossHairPosition( pos );
m_canvas->CrossHairOn( &dc ); m_canvas->CrossHairOn( &dc );
} }
...@@ -351,7 +351,8 @@ void SCH_EDIT_FRAME::OnFindSchematicItem( wxFindDialogEvent& aEvent ) ...@@ -351,7 +351,8 @@ void SCH_EDIT_FRAME::OnFindSchematicItem( wxFindDialogEvent& aEvent )
SetScreen( sheet->LastScreen() ); SetScreen( sheet->LastScreen() );
} }
sheet->LastScreen()->SetCrossHairPosition( data.GetPosition() ); // careful here
SetCrossHairPosition( data.GetPosition() );
RedrawScreen( data.GetPosition(), warpCursor ); RedrawScreen( data.GetPosition(), warpCursor );
......
...@@ -231,7 +231,7 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* aDC, ...@@ -231,7 +231,7 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* aDC,
SCH_COMPONENT* component; SCH_COMPONENT* component;
component = new SCH_COMPONENT( *Entry, m_CurrentSheet, unit, convert, component = new SCH_COMPONENT( *Entry, m_CurrentSheet, unit, convert,
GetScreen()->GetCrossHairPosition(), true ); GetCrossHairPosition(), true );
// Set the m_ChipName value, from component name in lib, for aliases // Set the m_ChipName value, from component name in lib, for aliases
// Note if Entry is found, and if Name is an alias of a component, // Note if Entry is found, and if Name is an alias of a component,
......
...@@ -284,12 +284,12 @@ void SCH_EDIT_FRAME::DisplayCurrentSheet() ...@@ -284,12 +284,12 @@ void SCH_EDIT_FRAME::DisplayCurrentSheet()
{ {
Zoom_Automatique( false ); Zoom_Automatique( false );
screen->m_FirstRedraw = false; screen->m_FirstRedraw = false;
screen->SetCrossHairPosition( screen->GetScrollCenterPosition() ); SetCrossHairPosition( GetScrollCenterPosition() );
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
} }
else else
{ {
RedrawScreen( screen->GetScrollCenterPosition(), true ); RedrawScreen( GetScrollCenterPosition(), true );
} }
// Now refresh m_canvas. Should be not necessary, but because screen has changed // Now refresh m_canvas. Should be not necessary, but because screen has changed
......
...@@ -74,14 +74,14 @@ ...@@ -74,14 +74,14 @@
*/ */
/* local variables */ // local variables
/* Hotkey list: */ // Hotkey list:
/** /**
* Common commands * Common commands
*/ */
/* Fit on Screen */ // Fit on Screen
#if !defined( __WXMAC__ ) #if !defined( __WXMAC__ )
static EDA_HOTKEY HkZoomAuto( wxT( "Fit on Screen" ), HK_ZOOM_AUTO, WXK_HOME, ID_ZOOM_PAGE ); static EDA_HOTKEY HkZoomAuto( wxT( "Fit on Screen" ), HK_ZOOM_AUTO, WXK_HOME, ID_ZOOM_PAGE );
#else #else
...@@ -92,7 +92,7 @@ static EDA_HOTKEY HkZoomAuto( wxT( "Zoom Auto" ), HK_ZOOM_AUTO, GR_KB_CTRL + '0' ...@@ -92,7 +92,7 @@ static EDA_HOTKEY HkZoomAuto( wxT( "Zoom Auto" ), HK_ZOOM_AUTO, GR_KB_CTRL + '0'
static EDA_HOTKEY HkZoomCenter( wxT( "Zoom Center" ), HK_ZOOM_CENTER, WXK_F4, static EDA_HOTKEY HkZoomCenter( wxT( "Zoom Center" ), HK_ZOOM_CENTER, WXK_F4,
ID_POPUP_ZOOM_CENTER ); ID_POPUP_ZOOM_CENTER );
/* Refresh Screen */ // Refresh Screen
#if !defined( __WXMAC__ ) #if !defined( __WXMAC__ )
static EDA_HOTKEY HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3, ID_ZOOM_REDRAW ); static EDA_HOTKEY HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3, ID_ZOOM_REDRAW );
#else #else
...@@ -100,14 +100,14 @@ static EDA_HOTKEY HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, GR_KB_CTRL ...@@ -100,14 +100,14 @@ static EDA_HOTKEY HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, GR_KB_CTRL
ID_ZOOM_REDRAW ); ID_ZOOM_REDRAW );
#endif #endif
/* Zoom In */ // Zoom In
#if !defined( __WXMAC__ ) #if !defined( __WXMAC__ )
static EDA_HOTKEY HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, WXK_F1, ID_POPUP_ZOOM_IN ); static EDA_HOTKEY HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, WXK_F1, ID_POPUP_ZOOM_IN );
#else #else
static EDA_HOTKEY HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, GR_KB_CTRL + '+', ID_POPUP_ZOOM_IN ); static EDA_HOTKEY HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, GR_KB_CTRL + '+', ID_POPUP_ZOOM_IN );
#endif #endif
/* Zoom Out */ // Zoom Out
#if !defined( __WXMAC__ ) #if !defined( __WXMAC__ )
static EDA_HOTKEY HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2, ID_POPUP_ZOOM_OUT ); static EDA_HOTKEY HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2, ID_POPUP_ZOOM_OUT );
#else #else
...@@ -115,13 +115,13 @@ static EDA_HOTKEY HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, GR_KB_CTRL + '-', I ...@@ -115,13 +115,13 @@ static EDA_HOTKEY HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, GR_KB_CTRL + '-', I
#endif #endif
static EDA_HOTKEY HkHelp( wxT( "Help (this window)" ), HK_HELP, '?' ); static EDA_HOTKEY HkHelp( wxT( "Help (this window)" ), HK_HELP, '?' );
static EDA_HOTKEY HkResetLocalCoord( wxT( "Reset Local Coordinates" ), static EDA_HOTKEY HkResetLocalCoord( wxT( "Reset Local Coordinates" ), HK_RESET_LOCAL_COORD, ' ' );
HK_RESET_LOCAL_COORD, ' ' );
/* Undo */
// Undo
static EDA_HOTKEY HkUndo( wxT( "Undo" ), HK_UNDO, GR_KB_CTRL + 'Z', (int) wxID_UNDO ); static EDA_HOTKEY HkUndo( wxT( "Undo" ), HK_UNDO, GR_KB_CTRL + 'Z', (int) wxID_UNDO );
/* Redo */ // Redo
#if !defined( __WXMAC__ ) #if !defined( __WXMAC__ )
static EDA_HOTKEY HkRedo( wxT( "Redo" ), HK_REDO, GR_KB_CTRL + 'Y', (int) wxID_REDO ); static EDA_HOTKEY HkRedo( wxT( "Redo" ), HK_REDO, GR_KB_CTRL + 'Y', (int) wxID_REDO );
#else #else
...@@ -358,8 +358,8 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, ...@@ -358,8 +358,8 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
DisplayHotkeyList( this, s_Schematic_Hokeys_Descr ); DisplayHotkeyList( this, s_Schematic_Hokeys_Descr );
break; break;
case HK_RESET_LOCAL_COORD: /* Reset the relative coord */ case HK_RESET_LOCAL_COORD: // Reset the relative coord
GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition(); GetScreen()->m_O_Curseur = GetCrossHairPosition();
break; break;
case HK_ZOOM_IN: case HK_ZOOM_IN:
...@@ -561,8 +561,8 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, ...@@ -561,8 +561,8 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
DisplayHotkeyList( this, s_Libedit_Hokeys_Descr ); DisplayHotkeyList( this, s_Libedit_Hokeys_Descr );
break; break;
case HK_RESET_LOCAL_COORD: /* Reset the relative coord */ case HK_RESET_LOCAL_COORD: // Reset the relative coord
GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition(); GetScreen()->m_O_Curseur = GetCrossHairPosition();
break; break;
case HK_ZOOM_IN: case HK_ZOOM_IN:
......
...@@ -218,7 +218,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent, ...@@ -218,7 +218,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent,
GetScreen()->m_Center = true; GetScreen()->m_Center = true;
GetScreen()->SetCrossHairPosition( wxPoint( 0, 0 ) ); SetCrossHairPosition( wxPoint( 0, 0 ) );
LoadSettings(); LoadSettings();
...@@ -402,7 +402,7 @@ double LIB_EDIT_FRAME::BestZoom() ...@@ -402,7 +402,7 @@ double LIB_EDIT_FRAME::BestZoom()
BoundaryBox = m_component->GetBoundingBox( m_unit, m_convert ); BoundaryBox = m_component->GetBoundingBox( m_unit, m_convert );
dx = BoundaryBox.GetWidth(); dx = BoundaryBox.GetWidth();
dy = BoundaryBox.GetHeight(); dy = BoundaryBox.GetHeight();
GetScreen()->SetScrollCenterPosition( wxPoint( 0, 0 ) ); SetScrollCenterPosition( wxPoint( 0, 0 ) );
} }
else else
{ {
...@@ -411,7 +411,7 @@ double LIB_EDIT_FRAME::BestZoom() ...@@ -411,7 +411,7 @@ double LIB_EDIT_FRAME::BestZoom()
dx = pageInfo.GetSizeIU().x; dx = pageInfo.GetSizeIU().x;
dy = pageInfo.GetSizeIU().y; dy = pageInfo.GetSizeIU().y;
GetScreen()->SetScrollCenterPosition( wxPoint( 0, 0 ) ); SetScrollCenterPosition( wxPoint( 0, 0 ) );
} }
size = m_canvas->GetClientSize(); size = m_canvas->GetClientSize();
...@@ -753,7 +753,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -753,7 +753,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
STATUS_FLAGS oldFlags = m_drawItem->GetFlags(); STATUS_FLAGS oldFlags = m_drawItem->GetFlags();
m_drawItem->ClearFlags(); m_drawItem->ClearFlags();
m_drawItem->Draw( m_canvas, &dc, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, g_XorMode, NULL, DefaultTransform ); m_drawItem->Draw( m_canvas, &dc, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, g_XorMode, NULL, DefaultTransform );
( (LIB_POLYLINE*) m_drawItem )->DeleteSegment( GetScreen()->GetCrossHairPosition( true ) ); ( (LIB_POLYLINE*) m_drawItem )->DeleteSegment( GetCrossHairPosition( true ) );
m_drawItem->Draw( m_canvas, &dc, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, g_XorMode, NULL, DefaultTransform ); m_drawItem->Draw( m_canvas, &dc, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, g_XorMode, NULL, DefaultTransform );
m_drawItem->SetFlags( oldFlags ); m_drawItem->SetFlags( oldFlags );
m_lastDrawItem = NULL; m_lastDrawItem = NULL;
...@@ -1139,7 +1139,7 @@ LIB_ITEM* LIB_EDIT_FRAME::LocateItemUsingCursor( const wxPoint& aPosition, ...@@ -1139,7 +1139,7 @@ LIB_ITEM* LIB_EDIT_FRAME::LocateItemUsingCursor( const wxPoint& aPosition,
if( item == NULL ) if( item == NULL )
return NULL; return NULL;
wxPoint pos = GetScreen()->GetNearestGridPosition( aPosition ); wxPoint pos = GetNearestGridPosition( aPosition );
if( item == NULL && aPosition != pos ) if( item == NULL && aPosition != pos )
item = locateItem( pos, aFilterList ); item = locateItem( pos, aFilterList );
......
...@@ -663,8 +663,8 @@ void SCH_EDIT_FRAME::addJunctionMenuEntries( wxMenu* aMenu, SCH_JUNCTION* aJunct ...@@ -663,8 +663,8 @@ void SCH_EDIT_FRAME::addJunctionMenuEntries( wxMenu* aMenu, SCH_JUNCTION* aJunct
void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame ) void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame )
{ {
SCH_SCREEN* screen = frame->GetScreen(); SCH_SCREEN* screen = frame->GetScreen();
wxPoint pos = screen->GetCrossHairPosition(); wxPoint pos = frame->GetCrossHairPosition();
wxString msg; wxString msg;
if( Wire == NULL ) if( Wire == NULL )
{ {
...@@ -691,9 +691,9 @@ void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame ) ...@@ -691,9 +691,9 @@ void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame )
AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_CONNECTION, _( "Delete Connection" ), AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_CONNECTION, _( "Delete Connection" ),
KiBitmap( delete_connection_xpm ) ); KiBitmap( delete_connection_xpm ) );
SCH_LINE* line = screen->GetWireOrBus( screen->GetCrossHairPosition() ); SCH_LINE* line = screen->GetWireOrBus( frame->GetCrossHairPosition() );
if( line && !line->IsEndPoint( screen->GetCrossHairPosition() ) ) if( line && !line->IsEndPoint( frame->GetCrossHairPosition() ) )
AddMenuItem( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ), AddMenuItem( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ),
KiBitmap( break_line_xpm ) ); KiBitmap( break_line_xpm ) );
...@@ -713,8 +713,8 @@ void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame ) ...@@ -713,8 +713,8 @@ void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame )
void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus, SCH_EDIT_FRAME* frame ) void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus, SCH_EDIT_FRAME* frame )
{ {
wxPoint pos = frame->GetScreen()->GetCrossHairPosition(); wxPoint pos = frame->GetCrossHairPosition();
wxString msg; wxString msg;
if( Bus == NULL ) if( Bus == NULL )
{ {
......
...@@ -210,7 +210,7 @@ void LIB_EDIT_FRAME::PlacePin() ...@@ -210,7 +210,7 @@ void LIB_EDIT_FRAME::PlacePin()
return; return;
} }
newpos = GetScreen()->GetCrossHairPosition( true ); newpos = GetCrossHairPosition( true );
// Test for an other pin in same new position: // Test for an other pin in same new position:
for( Pin = m_component->GetNextPin(); Pin != NULL; Pin = m_component->GetNextPin( Pin ) ) for( Pin = m_component->GetNextPin(); Pin != NULL; Pin = m_component->GetNextPin( Pin ) )
...@@ -308,7 +308,7 @@ void LIB_EDIT_FRAME::StartMovePin( wxDC* DC ) ...@@ -308,7 +308,7 @@ void LIB_EDIT_FRAME::StartMovePin( wxDC* DC )
startPos.x = OldPos.x; startPos.x = OldPos.x;
startPos.y = -OldPos.y; startPos.y = -OldPos.y;
// m_canvas->CrossHairOff( DC ); // m_canvas->CrossHairOff( DC );
GetScreen()->SetCrossHairPosition( startPos ); SetCrossHairPosition( startPos );
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
MSG_PANEL_ITEMS items; MSG_PANEL_ITEMS items;
...@@ -350,7 +350,7 @@ static void DrawMovePin( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi ...@@ -350,7 +350,7 @@ static void DrawMovePin( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi
} }
// Redraw pin in new position // Redraw pin in new position
CurrentPin->Move( aPanel->GetScreen()->GetCrossHairPosition( true ) ); CurrentPin->Move( aPanel->GetParent()->GetCrossHairPosition( true ) );
CurrentPin->Draw( aPanel, aDC, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, g_XorMode, CurrentPin->Draw( aPanel, aDC, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, g_XorMode,
&showPinText, DefaultTransform ); &showPinText, DefaultTransform );
...@@ -388,7 +388,7 @@ void LIB_EDIT_FRAME::CreatePin( wxDC* DC ) ...@@ -388,7 +388,7 @@ void LIB_EDIT_FRAME::CreatePin( wxDC* DC )
if( SynchronizePins() ) if( SynchronizePins() )
pin->SetFlags( IS_LINKED ); pin->SetFlags( IS_LINKED );
pin->Move( GetScreen()->GetCrossHairPosition( true ) ); pin->Move( GetCrossHairPosition( true ) );
pin->SetLength( LastPinLength ); pin->SetLength( LastPinLength );
pin->SetOrientation( LastPinOrient ); pin->SetOrientation( LastPinOrient );
pin->SetType( LastPinType ); pin->SetType( LastPinType );
...@@ -555,10 +555,10 @@ void LIB_EDIT_FRAME::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin ) ...@@ -555,10 +555,10 @@ void LIB_EDIT_FRAME::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin )
if( SynchronizePins() ) if( SynchronizePins() )
Pin->SetFlags( IS_LINKED ); Pin->SetFlags( IS_LINKED );
wxPoint savepos = GetScreen()->GetCrossHairPosition(); wxPoint savepos = GetCrossHairPosition();
m_canvas->CrossHairOff( DC ); m_canvas->CrossHairOff( DC );
GetScreen()->SetCrossHairPosition( wxPoint( Pin->GetPosition().x,
-Pin->GetPosition().y ) ); SetCrossHairPosition( wxPoint( Pin->GetPosition().x, -Pin->GetPosition().y ) );
// Add this new pin in list, and creates pins for others parts if needed // Add this new pin in list, and creates pins for others parts if needed
m_drawItem = Pin; m_drawItem = Pin;
...@@ -566,7 +566,7 @@ void LIB_EDIT_FRAME::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin ) ...@@ -566,7 +566,7 @@ void LIB_EDIT_FRAME::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin )
PlacePin(); PlacePin();
m_lastDrawItem = Pin; m_lastDrawItem = Pin;
GetScreen()->SetCrossHairPosition( savepos ); SetCrossHairPosition( savepos );
m_canvas->CrossHairOn( DC ); m_canvas->CrossHairOn( DC );
MSG_PANEL_ITEMS items; MSG_PANEL_ITEMS items;
......
...@@ -73,17 +73,17 @@ const wxSize SCH_BASE_FRAME::GetPageSizeIU() const ...@@ -73,17 +73,17 @@ const wxSize SCH_BASE_FRAME::GetPageSizeIU() const
} }
const wxPoint& SCH_BASE_FRAME::GetOriginAxisPosition() const const wxPoint& SCH_BASE_FRAME::GetAuxOrigin() const
{ {
wxASSERT( GetScreen() ); wxASSERT( GetScreen() );
return GetScreen()->GetOriginAxisPosition(); return GetScreen()->GetAuxOrigin();
} }
void SCH_BASE_FRAME::SetOriginAxisPosition( const wxPoint& aPosition ) void SCH_BASE_FRAME::SetAuxOrigin( const wxPoint& aPosition )
{ {
wxASSERT( GetScreen() ); wxASSERT( GetScreen() );
GetScreen()->SetOriginAxisPosition( aPosition ); GetScreen()->SetAuxOrigin( aPosition );
} }
...@@ -113,8 +113,8 @@ void SCH_BASE_FRAME::UpdateStatusBar() ...@@ -113,8 +113,8 @@ void SCH_BASE_FRAME::UpdateStatusBar()
EDA_DRAW_FRAME::UpdateStatusBar(); EDA_DRAW_FRAME::UpdateStatusBar();
// Display absolute coordinates: // Display absolute coordinates:
double dXpos = To_User_Unit( g_UserUnit, screen->GetCrossHairPosition().x ); double dXpos = To_User_Unit( g_UserUnit, GetCrossHairPosition().x );
double dYpos = To_User_Unit( g_UserUnit, screen->GetCrossHairPosition().y ); double dYpos = To_User_Unit( g_UserUnit, GetCrossHairPosition().y );
if ( g_UserUnit == MILLIMETRES ) if ( g_UserUnit == MILLIMETRES )
{ {
...@@ -147,8 +147,9 @@ void SCH_BASE_FRAME::UpdateStatusBar() ...@@ -147,8 +147,9 @@ void SCH_BASE_FRAME::UpdateStatusBar()
SetStatusText( line, 2 ); SetStatusText( line, 2 );
// Display relative coordinates: // Display relative coordinates:
dx = screen->GetCrossHairPosition().x - screen->m_O_Curseur.x; dx = GetCrossHairPosition().x - screen->m_O_Curseur.x;
dy = screen->GetCrossHairPosition().y - screen->m_O_Curseur.y; dy = GetCrossHairPosition().y - screen->m_O_Curseur.y;
dXpos = To_User_Unit( g_UserUnit, dx ); dXpos = To_User_Unit( g_UserUnit, dx );
dYpos = To_User_Unit( g_UserUnit, dy ); dYpos = To_User_Unit( g_UserUnit, dy );
......
...@@ -132,7 +132,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -132,7 +132,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
case wxID_PASTE: case wxID_PASTE:
HandleBlockBegin( &dc, BLOCK_PASTE, screen->GetCrossHairPosition() ); HandleBlockBegin( &dc, BLOCK_PASTE, GetCrossHairPosition() );
break; break;
case ID_POPUP_SCH_ENTRY_SELECT_SLASH: case ID_POPUP_SCH_ENTRY_SELECT_SLASH:
...@@ -165,12 +165,12 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -165,12 +165,12 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_BEGIN_WIRE: case ID_POPUP_SCH_BEGIN_WIRE:
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
OnLeftClick( &dc, screen->GetCrossHairPosition() ); OnLeftClick( &dc, GetCrossHairPosition() );
break; break;
case ID_POPUP_SCH_BEGIN_BUS: case ID_POPUP_SCH_BEGIN_BUS:
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
OnLeftClick( &dc, screen->GetCrossHairPosition() ); OnLeftClick( &dc, GetCrossHairPosition() );
break; break;
case ID_POPUP_SCH_SET_SHAPE_TEXT: case ID_POPUP_SCH_SET_SHAPE_TEXT:
...@@ -194,7 +194,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -194,7 +194,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
oldWires.SetOwnership( false ); // Prevent DLIST for deleting items in destructor. oldWires.SetOwnership( false ); // Prevent DLIST for deleting items in destructor.
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
screen->ExtractWires( oldWires, true ); screen->ExtractWires( oldWires, true );
screen->BreakSegment( screen->GetCrossHairPosition() ); screen->BreakSegment( GetCrossHairPosition() );
if( oldWires.GetCount() != 0 ) if( oldWires.GetCount() != 0 )
{ {
...@@ -344,7 +344,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -344,7 +344,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_ADD_JUNCTION: case ID_POPUP_SCH_ADD_JUNCTION:
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
screen->SetCurItem( AddJunction( &dc, screen->GetCrossHairPosition(), true ) ); screen->SetCurItem( AddJunction( &dc, GetCrossHairPosition(), true ) );
screen->TestDanglingEnds( m_canvas, &dc ); screen->TestDanglingEnds( m_canvas, &dc );
screen->SetCurItem( NULL ); screen->SetCurItem( NULL );
break; break;
...@@ -588,7 +588,7 @@ void SCH_EDIT_FRAME::DeleteConnection( bool aFullConnection ) ...@@ -588,7 +588,7 @@ void SCH_EDIT_FRAME::DeleteConnection( bool aFullConnection )
{ {
PICKED_ITEMS_LIST pickList; PICKED_ITEMS_LIST pickList;
SCH_SCREEN* screen = GetScreen(); SCH_SCREEN* screen = GetScreen();
wxPoint pos = screen->GetCrossHairPosition(); wxPoint pos = GetCrossHairPosition();
if( screen->GetConnection( pos, pickList, aFullConnection ) != 0 ) if( screen->GetConnection( pos, pickList, aFullConnection ) != 0 )
{ {
...@@ -603,7 +603,7 @@ bool SCH_EDIT_FRAME::DeleteItemAtCrossHair( wxDC* DC ) ...@@ -603,7 +603,7 @@ bool SCH_EDIT_FRAME::DeleteItemAtCrossHair( wxDC* DC )
SCH_ITEM* item; SCH_ITEM* item;
SCH_SCREEN* screen = GetScreen(); SCH_SCREEN* screen = GetScreen();
item = LocateItem( screen->GetCrossHairPosition(), SCH_COLLECTOR::ParentItems ); item = LocateItem( GetCrossHairPosition(), SCH_COLLECTOR::ParentItems );
if( item ) if( item )
{ {
...@@ -637,7 +637,7 @@ static void moveItem( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPositio ...@@ -637,7 +637,7 @@ static void moveItem( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPositio
item->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode ); item->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
#endif #endif
item->SetPosition( screen->GetCrossHairPosition() ); item->SetPosition( aPanel->GetParent()->GetCrossHairPosition() );
// Draw the item item at it's new position. // Draw the item item at it's new position.
item->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode ); item->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
...@@ -713,7 +713,7 @@ void SCH_EDIT_FRAME::MoveItem( SCH_ITEM* aItem, wxDC* aDC ) ...@@ -713,7 +713,7 @@ void SCH_EDIT_FRAME::MoveItem( SCH_ITEM* aItem, wxDC* aDC )
m_canvas->CrossHairOff( aDC ); m_canvas->CrossHairOff( aDC );
if( aItem->Type() != SCH_SHEET_PIN_T ) if( aItem->Type() != SCH_SHEET_PIN_T )
GetScreen()->SetCrossHairPosition( aItem->GetPosition() ); SetCrossHairPosition( aItem->GetPosition() );
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
...@@ -959,7 +959,7 @@ void SCH_EDIT_FRAME::OnDragItem( wxCommandEvent& aEvent ) ...@@ -959,7 +959,7 @@ void SCH_EDIT_FRAME::OnDragItem( wxCommandEvent& aEvent )
// is to simulate a block drag command // is to simulate a block drag command
if( screen->m_BlockLocate.GetState() == STATE_NO_BLOCK ) if( screen->m_BlockLocate.GetState() == STATE_NO_BLOCK )
{ {
if( !HandleBlockBegin( &dc, BLOCK_DRAG, screen->GetCrossHairPosition() ) ) if( !HandleBlockBegin( &dc, BLOCK_DRAG, GetCrossHairPosition() ) )
break; break;
// Give a non null size to the search block: // Give a non null size to the search block:
......
...@@ -501,7 +501,7 @@ double SCH_EDIT_FRAME::BestZoom() ...@@ -501,7 +501,7 @@ double SCH_EDIT_FRAME::BestZoom()
double bestzoom = std::max( zx, zy ); double bestzoom = std::max( zx, zy );
GetScreen()->SetScrollCenterPosition( wxPoint( dx / 2, dy / 2 ) ); SetScrollCenterPosition( wxPoint( dx / 2, dy / 2 ) );
return bestzoom; return bestzoom;
} }
......
...@@ -244,8 +244,8 @@ static void MoveOrResizeSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& ...@@ -244,8 +244,8 @@ static void MoveOrResizeSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
if( sheet->IsResized() ) if( sheet->IsResized() )
{ {
int width = screen->GetCrossHairPosition().x - sheet->GetPosition().x; int width = aPanel->GetParent()->GetCrossHairPosition().x - sheet->GetPosition().x;
int height = screen->GetCrossHairPosition().y - sheet->GetPosition().y; int height = aPanel->GetParent()->GetCrossHairPosition().y - sheet->GetPosition().y;
// If the sheet doesn't have any pins, clamp the minimum size to the default values. // If the sheet doesn't have any pins, clamp the minimum size to the default values.
width = ( width < MIN_SHEET_WIDTH ) ? MIN_SHEET_WIDTH : width; width = ( width < MIN_SHEET_WIDTH ) ? MIN_SHEET_WIDTH : width;
...@@ -263,12 +263,13 @@ static void MoveOrResizeSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& ...@@ -263,12 +263,13 @@ static void MoveOrResizeSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
sheet->GetMinWidth() + gridSizeX : width; sheet->GetMinWidth() + gridSizeX : width;
} }
wxPoint grid = screen->GetNearestGridPosition( wxPoint( pos.x + width, pos.y + height ) ); wxPoint grid = aPanel->GetParent()->GetNearestGridPosition(
wxPoint( pos.x + width, pos.y + height ) );
sheet->Resize( wxSize( grid.x - pos.x, grid.y - pos.y ) ); sheet->Resize( wxSize( grid.x - pos.x, grid.y - pos.y ) );
} }
else if( sheet->IsMoving() ) else if( sheet->IsMoving() )
{ {
moveVector = screen->GetCrossHairPosition() - pos; moveVector = aPanel->GetParent()->GetCrossHairPosition() - pos;
sheet->Move( moveVector ); sheet->Move( moveVector );
} }
...@@ -324,7 +325,7 @@ SCH_SHEET* SCH_EDIT_FRAME::CreateSheet( wxDC* aDC ) ...@@ -324,7 +325,7 @@ SCH_SHEET* SCH_EDIT_FRAME::CreateSheet( wxDC* aDC )
{ {
m_itemToRepeat = NULL; m_itemToRepeat = NULL;
SCH_SHEET* sheet = new SCH_SHEET( GetScreen()->GetCrossHairPosition() ); SCH_SHEET* sheet = new SCH_SHEET( GetCrossHairPosition() );
sheet->SetFlags( IS_NEW | IS_RESIZED ); sheet->SetFlags( IS_NEW | IS_RESIZED );
sheet->SetTimeStamp( GetNewTimeStamp() ); sheet->SetTimeStamp( GetNewTimeStamp() );
...@@ -338,7 +339,9 @@ SCH_SHEET* SCH_EDIT_FRAME::CreateSheet( wxDC* aDC ) ...@@ -338,7 +339,9 @@ SCH_SHEET* SCH_EDIT_FRAME::CreateSheet( wxDC* aDC )
m_canvas->SetMouseCapture( MoveOrResizeSheet, ExitSheet ); m_canvas->SetMouseCapture( MoveOrResizeSheet, ExitSheet );
m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false ); m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false );
m_canvas->CrossHairOff( aDC ); m_canvas->CrossHairOff( aDC );
GetScreen()->SetCrossHairPosition( sheet->GetResizePosition() );
SetCrossHairPosition( sheet->GetResizePosition() );
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
m_canvas->CrossHairOn( aDC ); m_canvas->CrossHairOn( aDC );
...@@ -356,7 +359,7 @@ void SCH_EDIT_FRAME::ReSizeSheet( SCH_SHEET* aSheet, wxDC* aDC ) ...@@ -356,7 +359,7 @@ void SCH_EDIT_FRAME::ReSizeSheet( SCH_SHEET* aSheet, wxDC* aDC )
GetChars( aSheet->GetClass() ) ) ); GetChars( aSheet->GetClass() ) ) );
m_canvas->CrossHairOff( aDC ); m_canvas->CrossHairOff( aDC );
GetScreen()->SetCrossHairPosition( aSheet->GetResizePosition() ); SetCrossHairPosition( aSheet->GetResizePosition() );
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
m_canvas->CrossHairOn( aDC ); m_canvas->CrossHairOn( aDC );
...@@ -377,7 +380,7 @@ void SCH_EDIT_FRAME::StartMoveSheet( SCH_SHEET* aSheet, wxDC* aDC ) ...@@ -377,7 +380,7 @@ void SCH_EDIT_FRAME::StartMoveSheet( SCH_SHEET* aSheet, wxDC* aDC )
return; return;
m_canvas->CrossHairOff( aDC ); m_canvas->CrossHairOff( aDC );
GetScreen()->SetCrossHairPosition( aSheet->GetPosition() ); SetCrossHairPosition( aSheet->GetPosition() );
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
if( !aSheet->IsNew() ) if( !aSheet->IsNew() )
......
...@@ -136,7 +136,7 @@ static void AbortSymbolTraceOn( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -136,7 +136,7 @@ static void AbortSymbolTraceOn( EDA_DRAW_PANEL* Panel, wxDC* DC )
return; return;
bool newItem = item->IsNew(); bool newItem = item->IsNew();
item->EndEdit( parent->GetScreen()->GetCrossHairPosition( true ), true ); item->EndEdit( parent->GetCrossHairPosition( true ), true );
if( newItem ) if( newItem )
{ {
...@@ -153,7 +153,7 @@ static void AbortSymbolTraceOn( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -153,7 +153,7 @@ static void AbortSymbolTraceOn( EDA_DRAW_PANEL* Panel, wxDC* DC )
LIB_ITEM* LIB_EDIT_FRAME::CreateGraphicItem( LIB_COMPONENT* LibEntry, wxDC* DC ) LIB_ITEM* LIB_EDIT_FRAME::CreateGraphicItem( LIB_COMPONENT* LibEntry, wxDC* DC )
{ {
m_canvas->SetMouseCapture( SymbolDisplayDraw, AbortSymbolTraceOn ); m_canvas->SetMouseCapture( SymbolDisplayDraw, AbortSymbolTraceOn );
wxPoint drawPos = GetScreen()->GetCrossHairPosition( true ); wxPoint drawPos = GetCrossHairPosition( true );
// no temp copy -> the current version of component will be used for Undo // no temp copy -> the current version of component will be used for Undo
// This is normal when adding new items to the current component // This is normal when adding new items to the current component
...@@ -239,7 +239,7 @@ void LIB_EDIT_FRAME::GraphicItemBeginDraw( wxDC* DC ) ...@@ -239,7 +239,7 @@ void LIB_EDIT_FRAME::GraphicItemBeginDraw( wxDC* DC )
if( m_drawItem == NULL ) if( m_drawItem == NULL )
return; return;
wxPoint pos = GetScreen()->GetCrossHairPosition( true ); wxPoint pos = GetCrossHairPosition( true );
if( m_drawItem->ContinueEdit( pos ) ) if( m_drawItem->ContinueEdit( pos ) )
{ {
...@@ -264,21 +264,20 @@ static void RedrawWhileMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx ...@@ -264,21 +264,20 @@ static void RedrawWhileMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
if( item == NULL ) if( item == NULL )
return; return;
BASE_SCREEN* Screen = aPanel->GetScreen();
item->SetEraseLastDrawItem( aErase ); item->SetEraseLastDrawItem( aErase );
// if item is the reference field, we must add the current unit id // if item is the reference field, we must add the current unit id
if( item->Type() == LIB_FIELD_T ) if( item->Type() == LIB_FIELD_T )
{ {
int unit = ((LIB_EDIT_FRAME*)aPanel->GetParent())->GetUnit(); int unit = ((LIB_EDIT_FRAME*)aPanel->GetParent())->GetUnit();
wxString text = ((LIB_FIELD*)item)->GetFullText( unit ); wxString text = ((LIB_FIELD*)item)->GetFullText( unit );
item->Draw( aPanel, aDC, Screen->GetCrossHairPosition( true ),
item->Draw( aPanel, aDC, aPanel->GetParent()->GetCrossHairPosition( true ),
UNSPECIFIED_COLOR, g_XorMode, &text, UNSPECIFIED_COLOR, g_XorMode, &text,
DefaultTransform ); DefaultTransform );
} }
else else
item->Draw( aPanel, aDC, Screen->GetCrossHairPosition( true ), item->Draw( aPanel, aDC, aPanel->GetParent()->GetCrossHairPosition( true ),
UNSPECIFIED_COLOR, g_XorMode, NULL, UNSPECIFIED_COLOR, g_XorMode, NULL,
DefaultTransform ); DefaultTransform );
} }
...@@ -298,7 +297,7 @@ void LIB_EDIT_FRAME::StartMoveDrawSymbol( wxDC* DC ) ...@@ -298,7 +297,7 @@ void LIB_EDIT_FRAME::StartMoveDrawSymbol( wxDC* DC )
if( m_drawItem->Type() == LIB_FIELD_T ) if( m_drawItem->Type() == LIB_FIELD_T )
m_drawItem->BeginEdit( IS_MOVED, m_drawItem->GetPosition() ); m_drawItem->BeginEdit( IS_MOVED, m_drawItem->GetPosition() );
else else
m_drawItem->BeginEdit( IS_MOVED, GetScreen()->GetCrossHairPosition( true ) ); m_drawItem->BeginEdit( IS_MOVED, GetCrossHairPosition( true ) );
m_canvas->SetMouseCapture( RedrawWhileMovingCursor, AbortSymbolTraceOn ); m_canvas->SetMouseCapture( RedrawWhileMovingCursor, AbortSymbolTraceOn );
m_canvas->CallMouseCapture( DC, wxDefaultPosition, true ); m_canvas->CallMouseCapture( DC, wxDefaultPosition, true );
...@@ -312,7 +311,7 @@ void LIB_EDIT_FRAME::StartModifyDrawSymbol( wxDC* DC ) ...@@ -312,7 +311,7 @@ void LIB_EDIT_FRAME::StartModifyDrawSymbol( wxDC* DC )
return; return;
TempCopyComponent(); TempCopyComponent();
m_drawItem->BeginEdit( IS_RESIZED, GetScreen()->GetCrossHairPosition( true ) ); m_drawItem->BeginEdit( IS_RESIZED, GetCrossHairPosition( true ) );
m_canvas->SetMouseCapture( SymbolDisplayDraw, AbortSymbolTraceOn ); m_canvas->SetMouseCapture( SymbolDisplayDraw, AbortSymbolTraceOn );
m_canvas->CallMouseCapture( DC, wxDefaultPosition, true ); m_canvas->CallMouseCapture( DC, wxDefaultPosition, true );
} }
...@@ -322,14 +321,13 @@ void LIB_EDIT_FRAME::StartModifyDrawSymbol( wxDC* DC ) ...@@ -322,14 +321,13 @@ void LIB_EDIT_FRAME::StartModifyDrawSymbol( wxDC* DC )
static void SymbolDisplayDraw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, static void SymbolDisplayDraw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase ) bool aErase )
{ {
BASE_SCREEN* Screen = aPanel->GetScreen();
LIB_ITEM* item = ( (LIB_EDIT_FRAME*) aPanel->GetParent() )->GetDrawItem(); LIB_ITEM* item = ( (LIB_EDIT_FRAME*) aPanel->GetParent() )->GetDrawItem();
if( item == NULL ) if( item == NULL )
return; return;
item->SetEraseLastDrawItem( aErase ); item->SetEraseLastDrawItem( aErase );
item->Draw( aPanel, aDC, Screen->GetCrossHairPosition( true ), UNSPECIFIED_COLOR, g_XorMode, NULL, item->Draw( aPanel, aDC, aPanel->GetParent()->GetCrossHairPosition( true ), UNSPECIFIED_COLOR, g_XorMode, NULL,
DefaultTransform ); DefaultTransform );
} }
...@@ -357,7 +355,7 @@ void LIB_EDIT_FRAME::EndDrawGraphicItem( wxDC* DC ) ...@@ -357,7 +355,7 @@ void LIB_EDIT_FRAME::EndDrawGraphicItem( wxDC* DC )
if( m_drawItem->IsNew() ) if( m_drawItem->IsNew() )
m_component->AddDrawItem( m_drawItem ); m_component->AddDrawItem( m_drawItem );
m_drawItem->EndEdit( GetScreen()->GetCrossHairPosition( true ) ); m_drawItem->EndEdit( GetCrossHairPosition( true ) );
m_drawItem = NULL; m_drawItem = NULL;
......
...@@ -65,7 +65,7 @@ void LIB_EDIT_FRAME::LoadOneSymbol() ...@@ -65,7 +65,7 @@ void LIB_EDIT_FRAME::LoadOneSymbol()
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
return; return;
GetScreen()->SetCrossHairPosition( wxPoint( 0, 0 ) ); SetCrossHairPosition( wxPoint( 0, 0 ) );
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
m_canvas->SetIgnoreMouseEvents( false ); m_canvas->SetIgnoreMouseEvents( false );
...@@ -238,7 +238,9 @@ void LIB_EDIT_FRAME::PlaceAnchor() ...@@ -238,7 +238,9 @@ void LIB_EDIT_FRAME::PlaceAnchor()
if( m_component == NULL ) if( m_component == NULL )
return; return;
wxPoint offset( -GetScreen()->GetCrossHairPosition().x, GetScreen()->GetCrossHairPosition().y ); const wxPoint& cross_hair = GetCrossHairPosition();
wxPoint offset( -cross_hair.x, cross_hair.y );
OnModify( ); OnModify( );
......
...@@ -335,7 +335,7 @@ void LIB_VIEW_FRAME::OnSize( wxSizeEvent& SizeEv ) ...@@ -335,7 +335,7 @@ void LIB_VIEW_FRAME::OnSize( wxSizeEvent& SizeEv )
void LIB_VIEW_FRAME::OnSetRelativeOffset( wxCommandEvent& event ) void LIB_VIEW_FRAME::OnSetRelativeOffset( wxCommandEvent& event )
{ {
GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition(); GetScreen()->m_O_Curseur = GetCrossHairPosition();
UpdateStatusBar(); UpdateStatusBar();
} }
...@@ -348,18 +348,16 @@ double LIB_VIEW_FRAME::BestZoom() ...@@ -348,18 +348,16 @@ double LIB_VIEW_FRAME::BestZoom()
* search for line static const int VIEWPORT_EXTENT = 1000; * search for line static const int VIEWPORT_EXTENT = 1000;
* and replace by static const int VIEWPORT_EXTENT = 10000; * and replace by static const int VIEWPORT_EXTENT = 10000;
*/ */
LIB_COMPONENT* component = NULL; LIB_COMPONENT* component = NULL;
CMP_LIBRARY* lib; double bestzoom = 16.0; // default value for bestzoom
double bestzoom = 16.0; // default value for bestzoom CMP_LIBRARY* lib = CMP_LIBRARY::FindLibrary( m_libraryName );
lib = CMP_LIBRARY::FindLibrary( m_libraryName );
if( lib ) if( lib )
component = lib->FindComponent( m_entryName ); component = lib->FindComponent( m_entryName );
if( component == NULL ) if( component == NULL )
{ {
GetScreen()->SetScrollCenterPosition( wxPoint( 0, 0 ) ); SetScrollCenterPosition( wxPoint( 0, 0 ) );
return bestzoom; return bestzoom;
} }
...@@ -382,7 +380,7 @@ double LIB_VIEW_FRAME::BestZoom() ...@@ -382,7 +380,7 @@ double LIB_VIEW_FRAME::BestZoom()
if( bestzoom < GetScreen()->m_ZoomList[0] ) if( bestzoom < GetScreen()->m_ZoomList[0] )
bestzoom = GetScreen()->m_ZoomList[0]; bestzoom = GetScreen()->m_ZoomList[0];
GetScreen()->SetScrollCenterPosition( BoundaryBox.Centre() ); SetScrollCenterPosition( BoundaryBox.Centre() );
return bestzoom; return bestzoom;
} }
......
...@@ -171,10 +171,11 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx ...@@ -171,10 +171,11 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
if( screen->m_BlockLocate.GetState() != STATE_BLOCK_STOP ) if( screen->m_BlockLocate.GetState() != STATE_BLOCK_STOP )
{ {
screen->m_BlockLocate.SetMoveVector( wxPoint( screen->GetCrossHairPosition().x - const wxPoint& cross_hair = aPanel->GetParent()->GetCrossHairPosition();
screen->m_BlockLocate.GetRight(),
screen->GetCrossHairPosition().y - screen->m_BlockLocate.SetMoveVector(
screen->m_BlockLocate.GetBottom() ) ); wxPoint( cross_hair.x - screen->m_BlockLocate.GetRight(),
cross_hair.y - screen->m_BlockLocate.GetBottom() ) );
} }
screen->m_BlockLocate.Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, Color ); screen->m_BlockLocate.Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, Color );
...@@ -195,10 +196,10 @@ void GERBVIEW_FRAME::Block_Move( wxDC* DC ) ...@@ -195,10 +196,10 @@ void GERBVIEW_FRAME::Block_Move( wxDC* DC )
wxPoint delta; wxPoint delta;
wxPoint oldpos; wxPoint oldpos;
oldpos = GetScreen()->GetCrossHairPosition(); oldpos = GetCrossHairPosition();
m_canvas->SetMouseCaptureCallback( NULL ); m_canvas->SetMouseCaptureCallback( NULL );
GetScreen()->SetCrossHairPosition( oldpos ); SetCrossHairPosition( oldpos );
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
GetScreen()->SetModify(); GetScreen()->SetModify();
GetScreen()->m_BlockLocate.Normalize(); GetScreen()->m_BlockLocate.Normalize();
......
...@@ -38,12 +38,12 @@ public: ...@@ -38,12 +38,12 @@ public:
const PAGE_INFO& GetPageSettings() const { return m_paper; } const PAGE_INFO& GetPageSettings() const { return m_paper; }
void SetPageSettings( const PAGE_INFO& aPageSettings ) { m_paper = aPageSettings; } void SetPageSettings( const PAGE_INFO& aPageSettings ) { m_paper = aPageSettings; }
const wxPoint& GetOriginAxisPosition() const const wxPoint& GetAuxOrigin() const
{ {
return m_originAxisPosition; return m_originAxisPosition;
} }
void SetOriginAxisPosition( const wxPoint& aPosition ) void SetAuxOrigin( const wxPoint& aPosition )
{ {
m_originAxisPosition = aPosition; m_originAxisPosition = aPosition;
} }
......
...@@ -38,9 +38,9 @@ void GERBVIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH ...@@ -38,9 +38,9 @@ void GERBVIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
wxPoint oldpos; wxPoint oldpos;
wxPoint pos = aPosition; wxPoint pos = aPosition;
pos = GetScreen()->GetNearestGridPosition( pos ); pos = GetNearestGridPosition( pos );
oldpos = GetScreen()->GetCrossHairPosition(); oldpos = GetCrossHairPosition();
gridSize = GetScreen()->GetGridSize(); gridSize = GetScreen()->GetGridSize();
switch( aHotKey ) switch( aHotKey )
...@@ -73,14 +73,14 @@ void GERBVIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH ...@@ -73,14 +73,14 @@ void GERBVIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
break; break;
} }
GetScreen()->SetCrossHairPosition( pos ); SetCrossHairPosition( pos );
if( oldpos != GetScreen()->GetCrossHairPosition() ) if( oldpos != GetCrossHairPosition() )
{ {
pos = GetScreen()->GetCrossHairPosition(); pos = GetCrossHairPosition();
GetScreen()->SetCrossHairPosition( oldpos ); SetCrossHairPosition( oldpos );
m_canvas->CrossHairOff( aDC ); m_canvas->CrossHairOff( aDC );
GetScreen()->SetCrossHairPosition( pos ); SetCrossHairPosition( pos );
m_canvas->CrossHairOn( aDC ); m_canvas->CrossHairOn( aDC );
if( m_canvas->IsMouseCaptured() ) if( m_canvas->IsMouseCaptured() )
......
...@@ -196,7 +196,7 @@ double GERBVIEW_FRAME::BestZoom() ...@@ -196,7 +196,7 @@ double GERBVIEW_FRAME::BestZoom()
double x = (double) bbox.GetWidth() / (double) size.x; double x = (double) bbox.GetWidth() / (double) size.x;
double y = (double) bbox.GetHeight() / (double) size.y; double y = (double) bbox.GetHeight() / (double) size.y;
GetScreen()->SetScrollCenterPosition( bbox.Centre() ); SetScrollCenterPosition( bbox.Centre() );
double best_zoom = std::max( x, y ); double best_zoom = std::max( x, y );
return best_zoom; return best_zoom;
...@@ -733,17 +733,17 @@ void GERBVIEW_FRAME::SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) ...@@ -733,17 +733,17 @@ void GERBVIEW_FRAME::SetTitleBlock( const TITLE_BLOCK& aTitleBlock )
} }
const wxPoint& GERBVIEW_FRAME::GetOriginAxisPosition() const const wxPoint& GERBVIEW_FRAME::GetAuxOrigin() const
{ {
wxASSERT( m_gerberLayout ); wxASSERT( m_gerberLayout );
return m_gerberLayout->GetOriginAxisPosition(); return m_gerberLayout->GetAuxOrigin();
} }
void GERBVIEW_FRAME::SetOriginAxisPosition( const wxPoint& aPosition ) void GERBVIEW_FRAME::SetAuxOrigin( const wxPoint& aPosition )
{ {
wxASSERT( m_gerberLayout ); wxASSERT( m_gerberLayout );
m_gerberLayout->SetOriginAxisPosition( aPosition ); m_gerberLayout->SetAuxOrigin( aPosition );
} }
...@@ -800,8 +800,8 @@ void GERBVIEW_FRAME::UpdateStatusBar() ...@@ -800,8 +800,8 @@ void GERBVIEW_FRAME::UpdateStatusBar()
{ {
double theta, ro; double theta, ro;
dx = screen->GetCrossHairPosition().x - screen->m_O_Curseur.x; dx = GetCrossHairPosition().x - screen->m_O_Curseur.x;
dy = screen->GetCrossHairPosition().y - screen->m_O_Curseur.y; dy = GetCrossHairPosition().y - screen->m_O_Curseur.y;
// atan2 in the 0,0 case returns 0 // atan2 in the 0,0 case returns 0
theta = RAD2DEG( atan2( -dy, dx ) ); theta = RAD2DEG( atan2( -dy, dx ) );
...@@ -829,9 +829,8 @@ void GERBVIEW_FRAME::UpdateStatusBar() ...@@ -829,9 +829,8 @@ void GERBVIEW_FRAME::UpdateStatusBar()
} }
// Display absolute coordinates: // Display absolute coordinates:
dXpos = To_User_Unit( g_UserUnit, screen->GetCrossHairPosition().x ); dXpos = To_User_Unit( g_UserUnit, GetCrossHairPosition().x );
dYpos = To_User_Unit( g_UserUnit, screen->GetCrossHairPosition().y ); dYpos = To_User_Unit( g_UserUnit, GetCrossHairPosition().y );
wxString absformatter; wxString absformatter;
...@@ -859,8 +858,8 @@ void GERBVIEW_FRAME::UpdateStatusBar() ...@@ -859,8 +858,8 @@ void GERBVIEW_FRAME::UpdateStatusBar()
if( !m_DisplayOptions.m_DisplayPolarCood ) // display relative cartesian coordinates if( !m_DisplayOptions.m_DisplayPolarCood ) // display relative cartesian coordinates
{ {
// Display relative coordinates: // Display relative coordinates:
dx = screen->GetCrossHairPosition().x - screen->m_O_Curseur.x; dx = GetCrossHairPosition().x - screen->m_O_Curseur.x;
dy = screen->GetCrossHairPosition().y - screen->m_O_Curseur.y; dy = GetCrossHairPosition().y - screen->m_O_Curseur.y;
dXpos = To_User_Unit( g_UserUnit, dx ); dXpos = To_User_Unit( g_UserUnit, dx );
dYpos = To_User_Unit( g_UserUnit, dy ); dYpos = To_User_Unit( g_UserUnit, dy );
......
...@@ -82,7 +82,9 @@ public: ...@@ -82,7 +82,9 @@ public:
class GERBVIEW_FRAME : public EDA_DRAW_FRAME // PCB_BASE_FRAME class GERBVIEW_FRAME : public EDA_DRAW_FRAME // PCB_BASE_FRAME
{ {
GBR_LAYOUT* m_gerberLayout; GBR_LAYOUT* m_gerberLayout;
wxPoint m_grid_origin;
public: public:
GBR_DISPLAY_OPTIONS m_DisplayOptions; GBR_DISPLAY_OPTIONS m_DisplayOptions;
...@@ -126,8 +128,14 @@ public: ...@@ -126,8 +128,14 @@ public:
const PAGE_INFO& GetPageSettings() const; // overload const PAGE_INFO& GetPageSettings() const; // overload
const wxSize GetPageSizeIU() const; // overload const wxSize GetPageSizeIU() const; // overload
const wxPoint& GetOriginAxisPosition() const; // overload const wxPoint& GetAuxOrigin() const; // overload
void SetOriginAxisPosition( const wxPoint& aPosition ); // overload void SetAuxOrigin( const wxPoint& aPoint ); // overload
const wxPoint& GetGridOrigin() const { return m_grid_origin; } // overload
void SetGridOrigin( const wxPoint& aPoint ) // overload
{
m_grid_origin = aPoint;
}
const TITLE_BLOCK& GetTitleBlock() const; // overload const TITLE_BLOCK& GetTitleBlock() const; // overload
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ); // overload void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ); // overload
......
...@@ -31,30 +31,28 @@ ...@@ -31,30 +31,28 @@
* and see this list for some ascii keys (space ...) * and see this list for some ascii keys (space ...)
*/ */
/* local variables */ // local variables
/* Hotkey list: */ // Hotkey list:
static EDA_HOTKEY HkResetLocalCoord( wxT( "Reset Local Coordinates" ), static EDA_HOTKEY HkResetLocalCoord( wxT( "Reset Local Coordinates" ), HK_RESET_LOCAL_COORD, ' ' );
HK_RESET_LOCAL_COORD, ' ' ); static EDA_HOTKEY HkSetGridOrigin( wxT("Set Grid Origin"), HK_SET_GRID_ORIGIN, 'S' );
static EDA_HOTKEY HkZoomAuto( wxT( "Zoom Auto" ), HK_ZOOM_AUTO, WXK_HOME );
static EDA_HOTKEY HkZoomCenter( wxT( "Zoom Center" ), HK_ZOOM_CENTER, WXK_F4 ); static EDA_HOTKEY HkZoomAuto( wxT( "Zoom Auto" ), HK_ZOOM_AUTO, WXK_HOME );
static EDA_HOTKEY HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3 ); static EDA_HOTKEY HkZoomCenter( wxT( "Zoom Center" ), HK_ZOOM_CENTER, WXK_F4 );
static EDA_HOTKEY HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2 ); static EDA_HOTKEY HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3 );
static EDA_HOTKEY HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, WXK_F1 ); static EDA_HOTKEY HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2 );
static EDA_HOTKEY HkHelp( wxT( "Help (this window)" ), HK_HELP, '?' ); static EDA_HOTKEY HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, WXK_F1 );
static EDA_HOTKEY HkSwitchUnits( wxT( "Switch Units" ), HK_SWITCH_UNITS, 'U' ); static EDA_HOTKEY HkHelp( wxT( "Help (this window)" ), HK_HELP, '?' );
static EDA_HOTKEY HkTrackDisplayMode( wxT( "Track Display Mode" ), static EDA_HOTKEY HkSwitchUnits( wxT( "Switch Units" ), HK_SWITCH_UNITS, 'U' );
HK_SWITCH_GBR_ITEMS_DISPLAY_MODE, 'F' ); static EDA_HOTKEY HkTrackDisplayMode( wxT( "Track Display Mode" ), HK_SWITCH_GBR_ITEMS_DISPLAY_MODE, 'F' );
static EDA_HOTKEY HkSwitch2NextCopperLayer( wxT( "Switch to Next Layer" ), static EDA_HOTKEY HkSwitch2NextCopperLayer( wxT( "Switch to Next Layer" ), HK_SWITCH_LAYER_TO_NEXT, '+' );
HK_SWITCH_LAYER_TO_NEXT, '+' ); static EDA_HOTKEY HkSwitch2PreviousCopperLayer( wxT( "Switch to Previous Layer" ), HK_SWITCH_LAYER_TO_PREVIOUS, '-' );
static EDA_HOTKEY HkSwitch2PreviousCopperLayer( wxT( "Switch to Previous Layer" ),
HK_SWITCH_LAYER_TO_PREVIOUS, '-' );
// List of common hotkey descriptors // List of common hotkey descriptors
EDA_HOTKEY* s_Gerbview_Hotkey_List[] = { EDA_HOTKEY* s_Gerbview_Hotkey_List[] = {
&HkHelp, &HkHelp,
&HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter, &HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter,
&HkZoomAuto, &HkSwitchUnits, &HkResetLocalCoord, &HkZoomAuto, &HkSwitchUnits, &HkResetLocalCoord, &HkSetGridOrigin,
&HkTrackDisplayMode, &HkTrackDisplayMode,
&HkSwitch2NextCopperLayer, &HkSwitch2NextCopperLayer,
&HkSwitch2PreviousCopperLayer, &HkSwitch2PreviousCopperLayer,
...@@ -130,8 +128,12 @@ void GERBVIEW_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit ...@@ -130,8 +128,12 @@ void GERBVIEW_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
GetEventHandler()->ProcessEvent( cmd ); GetEventHandler()->ProcessEvent( cmd );
break; break;
case HK_RESET_LOCAL_COORD: /*Reset the relative coord */ case HK_RESET_LOCAL_COORD: // Reset the relative coord
GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition(); GetScreen()->m_O_Curseur = GetCrossHairPosition();
break;
case HK_SET_GRID_ORIGIN:
SetGridOrigin( GetCrossHairPosition() );
break; break;
case HK_SWITCH_UNITS: case HK_SWITCH_UNITS:
......
...@@ -44,7 +44,7 @@ GERBER_DRAW_ITEM* GERBVIEW_FRAME::Locate( const wxPoint& aPosition, int aTypeloc ...@@ -44,7 +44,7 @@ GERBER_DRAW_ITEM* GERBVIEW_FRAME::Locate( const wxPoint& aPosition, int aTypeloc
bool found = false; bool found = false;
if( aTypeloc == CURSEUR_ON_GRILLE ) if( aTypeloc == CURSEUR_ON_GRILLE )
ref = GetScreen()->GetNearestGridPosition( ref ); ref = GetNearestGridPosition( ref );
LAYER_NUM layer = getActiveLayer(); LAYER_NUM layer = getActiveLayer();
......
This diff is collapsed.
...@@ -45,6 +45,8 @@ public: ...@@ -45,6 +45,8 @@ public:
wxSize m_ModuleTextSize; ///< Default footprint texts size wxSize m_ModuleTextSize; ///< Default footprint texts size
int m_ModuleTextWidth; int m_ModuleTextWidth;
int m_ModuleSegmentWidth; int m_ModuleSegmentWidth;
wxPoint m_AuxOrigin; ///< origin for plot exports
wxPoint m_GridOrigin; ///< origin for grid offsets
D_PAD m_Pad_Master; D_PAD m_Pad_Master;
......
...@@ -55,52 +55,55 @@ typedef void ( *END_MOUSE_CAPTURE_CALLBACK )( EDA_DRAW_PANEL* aPanel, wxDC* aDC ...@@ -55,52 +55,55 @@ typedef void ( *END_MOUSE_CAPTURE_CALLBACK )( EDA_DRAW_PANEL* aPanel, wxDC* aDC
class EDA_DRAW_PANEL : public wxScrolledWindow class EDA_DRAW_PANEL : public wxScrolledWindow
{ {
private: private:
int m_currentCursor; ///< Current mouse cursor shape id. int m_currentCursor; ///< Current mouse cursor shape id.
int m_defaultCursor; ///< The default mouse cursor shape id. int m_defaultCursor; ///< The default mouse cursor shape id.
bool m_showCrossHair; ///< Indicate if cross hair is to be shown. bool m_showCrossHair; ///< Indicate if cross hair is to be shown.
int m_cursorLevel; ///< Index for cursor redraw in XOR mode. int m_cursorLevel; ///< Index for cursor redraw in XOR mode.
int m_scrollIncrementX; ///< X axis scroll increment in pixels per unit. int m_scrollIncrementX; ///< X axis scroll increment in pixels per unit.
int m_scrollIncrementY; ///< Y axis scroll increment in pixels per unit. int m_scrollIncrementY; ///< Y axis scroll increment in pixels per unit.
wxPoint m_CursorStartPos; ///< Used for testing the cursor movement.
wxPoint m_PanStartCenter; ///< Initial scroll center position when pan started wxPoint m_CursorStartPos; ///< Used for testing the cursor movement.
wxPoint m_PanStartEventPosition; ///< Initial position of mouse event when pan started wxPoint m_PanStartCenter; ///< Initial scroll center position when pan started
wxPoint m_PanStartEventPosition; ///< Initial position of mouse event when pan started
/// The drawing area used to redraw the screen which is usually the visible area /// The drawing area used to redraw the screen which is usually the visible area
/// of the drawing in internal units. /// of the drawing in internal units.
EDA_RECT m_ClipBox; EDA_RECT m_ClipBox;
bool m_abortRequest; ///< Flag used to abort long commands. bool m_abortRequest; ///< Flag used to abort long commands.
bool m_enableZoomNoCenter; ///< True to enable zooming around the crosshair instead of the center bool m_enableZoomNoCenter; ///< True to enable zooming around the crosshair instead of the center
bool m_enableMiddleButtonPan; ///< True to enable middle mouse button panning. bool m_enableMiddleButtonPan; ///< True to enable middle mouse button panning.
bool m_panScrollbarLimits; ///< has meaning only if m_enableMiddleButtonPan = true bool m_panScrollbarLimits; ///< has meaning only if m_enableMiddleButtonPan = true
///< true to limit panning to scrollbar current limits ///< true to limit panning to scrollbar current limits
///< false to used unlimited pan ///< false to used unlimited pan
bool m_enableAutoPan; ///< True to enable automatic panning. bool m_enableAutoPan; ///< True to enable automatic panning.
/// true to request an auto pan. Valid only when m_enableAutoPan = true. bool m_requestAutoPan; ///< true to request an auto pan. Valid only when m_enableAutoPan = true.
bool m_requestAutoPan;
bool m_ignoreMouseEvents; ///< Ignore mouse events when true. bool m_ignoreMouseEvents; ///< Ignore mouse events when true.
/* Used to inhibit a response to a mouse left button release, after a double click /* Used to inhibit a response to a mouse left button release, after a double click
* (when releasing the left button at the end of the second click. Used in Eeschema * (when releasing the left button at the end of the second click. Used in Eeschema
* to inhibit a mouse left release command when switching between hierarchical sheets * to inhibit a mouse left release command when switching between hierarchical sheets
* on a double click. * on a double click.
*/ */
bool m_ignoreNextLeftButtonRelease; ///< Ignore the next mouse left button release when true. bool m_ignoreNextLeftButtonRelease; ///< Ignore the next mouse left button release when true.
bool m_enableBlockCommands; ///< True enables block commands. bool m_enableBlockCommands; ///< True enables block commands.
int m_minDragEventCount; /* Count the drag events. Used to filter mouse moves before starting a /**
* block command. A block command can be started only if * Count the drag events. Used to filter mouse moves before starting a
* MinDragEventCount > MIN_DRAG_COUNT_FOR_START_BLOCK_COMMAND * block command. A block command can be started only if
* in order to avoid spurious block commands. */ * MinDragEventCount > MIN_DRAG_COUNT_FOR_START_BLOCK_COMMAND in order to avoid
* spurious block commands.
*/
int m_minDragEventCount;
/// True when drawing in mirror mode. Used by the draw arc function, because arcs /// True when drawing in mirror mode. Used by the draw arc function, because arcs
/// are oriented, and in mirror mode, orientations are reversed. /// are oriented, and in mirror mode, orientations are reversed.
bool m_PrintIsMirrored; bool m_PrintIsMirrored;
/// Mouse capture move callback function. /// Mouse capture move callback function.
MOUSE_CAPTURE_CALLBACK m_mouseCaptureCallback; MOUSE_CAPTURE_CALLBACK m_mouseCaptureCallback;
...@@ -108,9 +111,10 @@ private: ...@@ -108,9 +111,10 @@ private:
/// Abort mouse capture callback function. /// Abort mouse capture callback function.
END_MOUSE_CAPTURE_CALLBACK m_endMouseCaptureCallback; END_MOUSE_CAPTURE_CALLBACK m_endMouseCaptureCallback;
// useful to avoid false start block in certain cases /// useful to avoid false start block in certain cases
// (like switch from a sheet to an other sheet /// (like switch from a sheet to an other sheet
int m_canStartBlock; // >= 0 (or >= n) if a block can start /// >= 0 (or >= n) if a block can start
int m_canStartBlock;
public: public:
...@@ -155,9 +159,8 @@ public: ...@@ -155,9 +159,8 @@ public:
void SetEnableBlockCommands( bool aEnable ) { m_enableBlockCommands = aEnable; } void SetEnableBlockCommands( bool aEnable ) { m_enableBlockCommands = aEnable; }
bool GetPrintMirrored() const { return m_PrintIsMirrored; } bool GetPrintMirrored() const { return m_PrintIsMirrored; }
void SetPrintMirrored( bool aMirror ) { m_PrintIsMirrored = aMirror; }
void SetPrintMirrored( bool aMirror ) { m_PrintIsMirrored = aMirror; }
void SetCanStartBlock( int aStartBlock ) { m_canStartBlock = aStartBlock; } void SetCanStartBlock( int aStartBlock ) { m_canStartBlock = aStartBlock; }
...@@ -196,8 +199,9 @@ public: ...@@ -196,8 +199,9 @@ public:
* the grid origin is set by user, and is not (0,0) * the grid origin is set by user, and is not (0,0)
* @param aDC = current Device Context * @param aDC = current Device Context
* @param aDrawMode = draw mode (GR_COPY, GR_OR ..) * @param aDrawMode = draw mode (GR_COPY, GR_OR ..)
* @param aGridOrigin = the absolute coordinate of grid origin for snap.
*/ */
void DrawGridAxis( wxDC* aDC, GR_DRAWMODE aDrawMode ); void DrawGridAxis( wxDC* aDC, GR_DRAWMODE aDrawMode, const wxPoint& aGridOrigin );
void OnEraseBackground( wxEraseEvent& event ) { } void OnEraseBackground( wxEraseEvent& event ) { }
...@@ -324,7 +328,7 @@ public: ...@@ -324,7 +328,7 @@ public:
* warps the cursor to the current cross hair position. * warps the cursor to the current cross hair position.
*/ */
void MoveCursorToCrossHair(); void MoveCursorToCrossHair();
/** /**
* Function ToDeviceXY * Function ToDeviceXY
* transforms logical to device coordinates * transforms logical to device coordinates
......
...@@ -73,8 +73,8 @@ private: ...@@ -73,8 +73,8 @@ private:
TITLE_BLOCK m_titles; TITLE_BLOCK m_titles;
/// Position of the origin axis, which is used in exports mostly, but not yet in EESCHEMA /// Origin of the auxilliary axis, which is used in exports mostly, but not yet in EESCHEMA
wxPoint m_originAxisPosition; wxPoint m_aux_origin;
DLIST< SCH_ITEM > m_drawList; ///< Object list for the screen. DLIST< SCH_ITEM > m_drawList; ///< Object list for the screen.
/// @todo use DLIST<SCH_ITEM> or superior container /// @todo use DLIST<SCH_ITEM> or superior container
...@@ -108,12 +108,12 @@ public: ...@@ -108,12 +108,12 @@ public:
const PAGE_INFO& GetPageSettings() const { return m_paper; } const PAGE_INFO& GetPageSettings() const { return m_paper; }
void SetPageSettings( const PAGE_INFO& aPageSettings ) { m_paper = aPageSettings; } void SetPageSettings( const PAGE_INFO& aPageSettings ) { m_paper = aPageSettings; }
void SetFileName( const wxString& aFileName ) { m_fileName = aFileName; } void SetFileName( const wxString& aFileName ) { m_fileName = aFileName; }
const wxString& GetFileName() const { return m_fileName; } const wxString& GetFileName() const { return m_fileName; }
const wxPoint& GetOriginAxisPosition() const { return m_originAxisPosition; } const wxPoint& GetAuxOrigin() const { return m_aux_origin; }
void SetOriginAxisPosition( const wxPoint& aPosition ) { m_originAxisPosition = aPosition; } void SetAuxOrigin( const wxPoint& aPosition ) { m_aux_origin = aPosition; }
const TITLE_BLOCK& GetTitleBlock() const { return m_titles; } const TITLE_BLOCK& GetTitleBlock() const { return m_titles; }
//TITLE_BLOCK& GetTitleBlock() const { return (TITLE_BLOCK&) m_titles; } //TITLE_BLOCK& GetTitleBlock() const { return (TITLE_BLOCK&) m_titles; }
......
...@@ -217,6 +217,7 @@ void ParseHotkeyConfig( const wxString& data, struct EDA_HOTKEY_CONFIG* aDescLis ...@@ -217,6 +217,7 @@ void ParseHotkeyConfig( const wxString& data, struct EDA_HOTKEY_CONFIG* aDescLis
enum common_hotkey_id_commnand { enum common_hotkey_id_commnand {
HK_NOT_FOUND = 0, HK_NOT_FOUND = 0,
HK_RESET_LOCAL_COORD, HK_RESET_LOCAL_COORD,
HK_SET_GRID_ORIGIN,
HK_HELP, HK_HELP,
HK_ZOOM_IN, HK_ZOOM_IN,
HK_ZOOM_OUT, HK_ZOOM_OUT,
......
...@@ -58,8 +58,15 @@ public: ...@@ -58,8 +58,15 @@ public:
const PAGE_INFO& GetPageSettings () const; // overload EDA_DRAW_FRAME const PAGE_INFO& GetPageSettings () const; // overload EDA_DRAW_FRAME
const wxSize GetPageSizeIU() const; // overload EDA_DRAW_FRAME const wxSize GetPageSizeIU() const; // overload EDA_DRAW_FRAME
const wxPoint& GetOriginAxisPosition() const; // overload EDA_DRAW_FRAME const wxPoint& GetAuxOrigin() const; // overload EDA_DRAW_FRAME
void SetOriginAxisPosition( const wxPoint& aPosition ); // overload EDA_DRAW_FRAME void SetAuxOrigin( const wxPoint& aPosition ); // overload EDA_DRAW_FRAME
const wxPoint& GetGridOrigin() const // overload EDA_DRAW_FRAME
{
static wxPoint zero;
return zero;
}
void SetGridOrigin( const wxPoint& aPoint ) {} // overload EDA_DRAW_FRAME
const TITLE_BLOCK& GetTitleBlock() const; // overload EDA_DRAW_FRAME const TITLE_BLOCK& GetTitleBlock() const; // overload EDA_DRAW_FRAME
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ); // overload EDA_DRAW_FRAME void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ); // overload EDA_DRAW_FRAME
......
...@@ -131,8 +131,11 @@ public: ...@@ -131,8 +131,11 @@ public:
const PAGE_INFO& GetPageSettings() const; // overload const PAGE_INFO& GetPageSettings() const; // overload
const wxSize GetPageSizeIU() const; // overload const wxSize GetPageSizeIU() const; // overload
const wxPoint& GetOriginAxisPosition() const; // overload const wxPoint& GetAuxOrigin() const; // overload
void SetOriginAxisPosition( const wxPoint& aPosition ); // overload void SetAuxOrigin( const wxPoint& aPoint ); // overload
const wxPoint& GetGridOrigin() const; // overload
void SetGridOrigin( const wxPoint& aPoint ); // overload
const TITLE_BLOCK& GetTitleBlock() const; // overload const TITLE_BLOCK& GetTitleBlock() const; // overload
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ); // overload void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ); // overload
......
...@@ -113,15 +113,15 @@ extern const wxChar* traceAutoSave; ...@@ -113,15 +113,15 @@ extern const wxChar* traceAutoSave;
class EDA_BASE_FRAME : public wxFrame class EDA_BASE_FRAME : public wxFrame
{ {
protected: protected:
ID_DRAWFRAME_TYPE m_Ident; // Id Type (pcb, schematic, library..) ID_DRAWFRAME_TYPE m_Ident; ///< Id Type (pcb, schematic, library..)
wxPoint m_FramePos; wxPoint m_FramePos;
wxSize m_FrameSize; wxSize m_FrameSize;
wxAuiToolBar* m_mainToolBar; // Standard horizontal Toolbar wxAuiToolBar* m_mainToolBar; ///< Standard horizontal Toolbar
bool m_FrameIsActive; bool m_FrameIsActive;
wxString m_FrameName; // name used for writing and reading setup wxString m_FrameName; ///< name used for writing and reading setup
// It is "SchematicFrame", "PcbFrame" .... ///< It is "SchematicFrame", "PcbFrame" ....
wxString m_AboutTitle; // Name of program displayed in About. wxString m_AboutTitle; ///< Name of program displayed in About.
wxAuiManager m_auimgr; wxAuiManager m_auimgr;
...@@ -404,47 +404,47 @@ protected: ...@@ -404,47 +404,47 @@ protected:
EDA_DRAW_PANEL* m_canvas; EDA_DRAW_PANEL* m_canvas;
/// Tool ID of previously active draw tool bar button. /// Tool ID of previously active draw tool bar button.
int m_lastDrawToolId; int m_lastDrawToolId;
/// The shape of the KiCad cursor. The default value (0) is the normal cross /// The shape of the KiCad cursor. The default value (0) is the normal cross
/// hair cursor. Set to non-zero value to draw the full screen cursor. /// hair cursor. Set to non-zero value to draw the full screen cursor.
/// @note This is not the system mouse cursor. /// @note This is not the system mouse cursor.
int m_cursorShape; int m_cursorShape;
/// True shows the X and Y axis indicators. /// True shows the X and Y axis indicators.
bool m_showAxis; bool m_showAxis;
/// True shows the grid axis indicators. /// True shows the grid axis indicators.
bool m_showGridAxis; bool m_showGridAxis;
/// True shows the origin axis used to indicate the coordinate offset for /// True shows the origin axis used to indicate the coordinate offset for
/// drill, gerber, and component position files. /// drill, gerber, and component position files.
bool m_showOriginAxis; bool m_showOriginAxis;
/// True shows the drawing border and title block. /// True shows the drawing border and title block.
bool m_showBorderAndTitleBlock; bool m_showBorderAndTitleBlock;
/// Choice box to choose the grid size. /// Choice box to choose the grid size.
wxComboBox* m_gridSelectBox; wxComboBox* m_gridSelectBox;
/// Choice box to choose the zoom value. /// Choice box to choose the zoom value.
wxComboBox* m_zoomSelectBox; wxComboBox* m_zoomSelectBox;
/// The tool bar that contains the buttons for quick access to the application draw /// The tool bar that contains the buttons for quick access to the application draw
/// tools. It typically is located on the right side of the main window. /// tools. It typically is located on the right side of the main window.
wxAuiToolBar* m_drawToolBar; wxAuiToolBar* m_drawToolBar;
/// The options tool bar typcially located on the left edge of the main window. /// The options tool bar typcially located on the left edge of the main window.
wxAuiToolBar* m_optionsToolBar; wxAuiToolBar* m_optionsToolBar;
/// Panel used to display information at the bottom of the main window. /// Panel used to display information at the bottom of the main window.
EDA_MSG_PANEL* m_messagePanel; EDA_MSG_PANEL* m_messagePanel;
int m_MsgFrameHeight; int m_MsgFrameHeight;
#ifdef USE_WX_OVERLAY #ifdef USE_WX_OVERLAY
// MAC Uses overlay to workaround the wxINVERT and wxXOR miss // MAC Uses overlay to workaround the wxINVERT and wxXOR miss
wxOverlay m_overlay; wxOverlay m_overlay;
#endif #endif
protected: protected:
...@@ -480,8 +480,89 @@ public: ...@@ -480,8 +480,89 @@ public:
*/ */
virtual const wxSize GetPageSizeIU() const = 0; virtual const wxSize GetPageSizeIU() const = 0;
virtual const wxPoint& GetOriginAxisPosition() const = 0; /**
virtual void SetOriginAxisPosition( const wxPoint& aPosition ) = 0; * Function GetAuxOrigin
* returns the origin of the axis used for plotting and various exports.
*/
virtual const wxPoint& GetAuxOrigin() const = 0;
virtual void SetAuxOrigin( const wxPoint& aPosition ) = 0;
/**
* Function GetGridOrigin
* returns the absolute coordinates of the origin of the snap grid. This is
* treated as a relative offset, and snapping will occur at multiples of the grid
* size relative to this point.
*/
virtual const wxPoint& GetGridOrigin() const = 0;
virtual void SetGridOrigin( const wxPoint& aPosition ) = 0;
//-----<BASE_SCREEN API moved here>------------------------------------------
/**
* Function GetCrossHairPosition
* return the current cross hair position in logical (drawing) coordinates.
* @param aInvertY Inverts the Y axis position.
* @return The cross hair position in drawing coordinates.
*/
wxPoint GetCrossHairPosition( bool aInvertY = false ) const;
/**
* Function SetCrossHairPosition
* sets the screen cross hair position to \a aPosition in logical (drawing) units.
* @param aPosition The new cross hair position.
* @param aGridOrigin Origin point of the snap grid.
* @param aSnapToGrid Sets the cross hair position to the nearest grid position to
* \a aPosition.
*
*/
void SetCrossHairPosition( const wxPoint& aPosition, bool aSnapToGrid = true );
/**
* Function GetCursorPosition
* returns the current cursor position in logical (drawing) units.
* @param aOnGrid Returns the nearest grid position at the current cursor position.
* @param aGridOrigin Origin point of the snap grid.
* @param aGridSize Custom grid size instead of the current grid size. Only valid
* if \a aOnGrid is true.
* @return The current cursor position.
*/
wxPoint GetCursorPosition( bool aOnGrid, wxRealPoint* aGridSize = NULL ) const;
/**
* Function GetNearestGridPosition
* returns the nearest \a aGridSize location to \a aPosition.
* @param aPosition The position to check.
* @param aGridSize The grid size to locate to if provided. If NULL then the current
* grid size is used.
* @return The nearst grid position.
*/
wxPoint GetNearestGridPosition( const wxPoint& aPosition, wxRealPoint* aGridSize = NULL ) const;
/**
* Function GetCursorScreenPosition
* returns the cross hair position in device (display) units.b
* @return The current cross hair position.
*/
wxPoint GetCrossHairScreenPosition() const;
void SetMousePosition( const wxPoint& aPosition );
/**
* Function RefPos
* Return the reference position, coming from either the mouse position
* or the cursor position.
*
* @param useMouse If true, return mouse position, else cursor's.
*
* @return wxPoint - The reference point, either the mouse position or
* the cursor position.
*/
wxPoint RefPos( bool useMouse ) const;
const wxPoint& GetScrollCenterPosition() const;
void SetScrollCenterPosition( const wxPoint& aPoint );
//-----</BASE_SCREEN API moved here>-----------------------------------------
virtual const TITLE_BLOCK& GetTitleBlock() const = 0; virtual const TITLE_BLOCK& GetTitleBlock() const = 0;
virtual void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) = 0; virtual void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) = 0;
...@@ -718,13 +799,13 @@ public: ...@@ -718,13 +799,13 @@ public:
void DrawWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWidth, void DrawWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWidth,
double aScale, const wxString &aFilename ); double aScale, const wxString &aFilename );
void DisplayToolMsg( const wxString& msg ); void DisplayToolMsg( const wxString& msg );
virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) = 0; virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) = 0;
virtual void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) = 0; virtual void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) = 0;
virtual void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); virtual void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
virtual bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0; virtual bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0;
virtual void ToolOnRightClick( wxCommandEvent& event ); virtual void ToolOnRightClick( wxCommandEvent& event );
void AdjustScrollBars( const wxPoint& aCenterPosition ); void AdjustScrollBars( const wxPoint& aCenterPosition );
/** /**
* Function OnActivate (virtual) * Function OnActivate (virtual)
......
...@@ -33,7 +33,7 @@ public: ...@@ -33,7 +33,7 @@ public:
m_paper = aPageSettings; m_paper = aPageSettings;
} }
const wxPoint& GetOriginAxisPosition() const const wxPoint& GetAuxOrigin() const
{ {
static wxPoint zero( 0, 0 ); static wxPoint zero( 0, 0 );
return zero; return zero;
......
...@@ -35,14 +35,9 @@ ...@@ -35,14 +35,9 @@
void PL_EDITOR_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, void PL_EDITOR_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition,
int aHotKey ) int aHotKey )
{ {
wxRealPoint gridSize; wxPoint pos = GetNearestGridPosition( aPosition );
wxPoint oldpos; wxPoint oldpos = GetCrossHairPosition();
wxPoint pos = aPosition; wxRealPoint gridSize = GetScreen()->GetGridSize();
pos = GetScreen()->GetNearestGridPosition( pos );
oldpos = GetScreen()->GetCrossHairPosition();
gridSize = GetScreen()->GetGridSize();
switch( aHotKey ) switch( aHotKey )
{ {
...@@ -74,14 +69,14 @@ void PL_EDITOR_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, ...@@ -74,14 +69,14 @@ void PL_EDITOR_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition,
break; break;
} }
GetScreen()->SetCrossHairPosition( pos ); SetCrossHairPosition( pos );
if( oldpos != GetScreen()->GetCrossHairPosition() ) if( oldpos != GetCrossHairPosition() )
{ {
pos = GetScreen()->GetCrossHairPosition(); pos = GetCrossHairPosition();
GetScreen()->SetCrossHairPosition( oldpos ); SetCrossHairPosition( oldpos );
m_canvas->CrossHairOff( aDC ); m_canvas->CrossHairOff( aDC );
GetScreen()->SetCrossHairPosition( pos ); SetCrossHairPosition( pos );
m_canvas->CrossHairOn( aDC ); m_canvas->CrossHairOn( aDC );
if( m_canvas->IsMouseCaptured() ) if( m_canvas->IsMouseCaptured() )
......
...@@ -250,7 +250,7 @@ static void moveItem( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPositio ...@@ -250,7 +250,7 @@ static void moveItem( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPositio
WORKSHEET_DATAITEM *item = screen->GetCurItem(); WORKSHEET_DATAITEM *item = screen->GetCurItem();
wxCHECK_RET( (item != NULL), wxT( "Cannot move NULL item." ) ); wxCHECK_RET( (item != NULL), wxT( "Cannot move NULL item." ) );
wxPoint position = screen->GetCrossHairPosition() wxPoint position = aPanel->GetParent()->GetCrossHairPosition()
- ( initialCursorPosition - initialPositionUi ); - ( initialCursorPosition - initialPositionUi );
if( (item->GetFlags() & LOCATE_STARTPOINT) ) if( (item->GetFlags() & LOCATE_STARTPOINT) )
...@@ -285,12 +285,13 @@ static void abortMoveItem( EDA_DRAW_PANEL* aPanel, wxDC* aDC ) ...@@ -285,12 +285,13 @@ static void abortMoveItem( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
aPanel->Refresh(); aPanel->Refresh();
} }
void PL_EDITOR_FRAME::MoveItem( WORKSHEET_DATAITEM* aItem ) void PL_EDITOR_FRAME::MoveItem( WORKSHEET_DATAITEM* aItem )
{ {
wxCHECK_RET( aItem != NULL, wxT( "Cannot move NULL item" ) ); wxCHECK_RET( aItem != NULL, wxT( "Cannot move NULL item" ) );
initialPosition = aItem->GetStartPos(); initialPosition = aItem->GetStartPos();
initialPositionUi = aItem->GetStartPosUi(); initialPositionUi = aItem->GetStartPosUi();
initialCursorPosition = GetScreen()->GetCrossHairPosition(); initialCursorPosition = GetCrossHairPosition();
if( (aItem->GetFlags() & LOCATE_ENDPOINT) ) if( (aItem->GetFlags() & LOCATE_ENDPOINT) )
{ {
...@@ -300,8 +301,8 @@ void PL_EDITOR_FRAME::MoveItem( WORKSHEET_DATAITEM* aItem ) ...@@ -300,8 +301,8 @@ void PL_EDITOR_FRAME::MoveItem( WORKSHEET_DATAITEM* aItem )
if( aItem->GetFlags() & (LOCATE_STARTPOINT|LOCATE_ENDPOINT) ) if( aItem->GetFlags() & (LOCATE_STARTPOINT|LOCATE_ENDPOINT) )
{ {
GetScreen()->SetCrossHairPosition( initialPositionUi, false ); SetCrossHairPosition( initialPositionUi, false );
initialCursorPosition = GetScreen()->GetCrossHairPosition(); initialCursorPosition = GetCrossHairPosition();
if( m_canvas->IsPointOnDisplay( initialCursorPosition ) ) if( m_canvas->IsPointOnDisplay( initialCursorPosition ) )
{ {
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
...@@ -317,6 +318,7 @@ void PL_EDITOR_FRAME::MoveItem( WORKSHEET_DATAITEM* aItem ) ...@@ -317,6 +318,7 @@ void PL_EDITOR_FRAME::MoveItem( WORKSHEET_DATAITEM* aItem )
GetScreen()->SetCurItem( aItem ); GetScreen()->SetCurItem( aItem );
} }
/** /**
* Save in Undo list the layout, and place an item being moved. * Save in Undo list the layout, and place an item being moved.
* @param aItem is the item moved * @param aItem is the item moved
......
...@@ -180,7 +180,11 @@ void PL_EDITOR_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, ...@@ -180,7 +180,11 @@ void PL_EDITOR_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode,
break; break;
case HK_RESET_LOCAL_COORD: // Reset the relative coord case HK_RESET_LOCAL_COORD: // Reset the relative coord
GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition(); GetScreen()->m_O_Curseur = GetCrossHairPosition();
break;
case HK_SET_GRID_ORIGIN:
SetGridOrigin( GetCrossHairPosition() );
break; break;
case HK_MOVE_ITEM: case HK_MOVE_ITEM:
......
...@@ -254,7 +254,7 @@ double PL_EDITOR_FRAME::BestZoom() ...@@ -254,7 +254,7 @@ double PL_EDITOR_FRAME::BestZoom()
double bestzoom = std::max( zx, zy ); double bestzoom = std::max( zx, zy );
GetScreen()->SetScrollCenterPosition( wxPoint( dx / 2, dy / 2 ) ); SetScrollCenterPosition( wxPoint( dx / 2, dy / 2 ) );
return bestzoom; return bestzoom;
} }
...@@ -369,42 +369,44 @@ void PL_EDITOR_FRAME::UpdateStatusBar() ...@@ -369,42 +369,44 @@ void PL_EDITOR_FRAME::UpdateStatusBar()
wxPoint originCoord; wxPoint originCoord;
int Xsign = 1; int Xsign = 1;
int Ysign = 1; int Ysign = 1;
WORKSHEET_DATAITEM dummy( WORKSHEET_DATAITEM::WS_SEGMENT ); WORKSHEET_DATAITEM dummy( WORKSHEET_DATAITEM::WS_SEGMENT );
switch( m_originSelectChoice ) switch( m_originSelectChoice )
{ {
default: default:
case 0: // Origin = paper Left Top corner case 0: // Origin = paper Left Top corner
break; break;
case 1: // Origin = page Right Bottom corner case 1: // Origin = page Right Bottom corner
Xsign = -1; Xsign = -1;
Ysign = -1; Ysign = -1;
dummy.SetStart( 0, 0, RB_CORNER ); dummy.SetStart( 0, 0, RB_CORNER );
originCoord = dummy.GetStartPosUi(); originCoord = dummy.GetStartPosUi();
break; break;
case 2: // Origin = page Left Bottom corner case 2: // Origin = page Left Bottom corner
Ysign = -1; Ysign = -1;
dummy.SetStart( 0, 0, LB_CORNER ); dummy.SetStart( 0, 0, LB_CORNER );
originCoord = dummy.GetStartPosUi(); originCoord = dummy.GetStartPosUi();
break; break;
case 3: // Origin = page Right Top corner case 3: // Origin = page Right Top corner
Xsign = -1; Xsign = -1;
dummy.SetStart( 0, 0, RT_CORNER ); dummy.SetStart( 0, 0, RT_CORNER );
originCoord = dummy.GetStartPosUi(); originCoord = dummy.GetStartPosUi();
break; break;
case 4: // Origin = page Left Top corner case 4: // Origin = page Left Top corner
dummy.SetStart( 0, 0, LT_CORNER ); dummy.SetStart( 0, 0, LT_CORNER );
originCoord = dummy.GetStartPosUi(); originCoord = dummy.GetStartPosUi();
break; break;
} }
screen->m_GridOrigin = originCoord; SetGridOrigin( originCoord );
// Display absolute coordinates: // Display absolute coordinates:
wxPoint coord = screen->GetCrossHairPosition() - originCoord; wxPoint coord = GetCrossHairPosition() - originCoord;
double dXpos = To_User_Unit( g_UserUnit, coord.x*Xsign ); double dXpos = To_User_Unit( g_UserUnit, coord.x*Xsign );
double dYpos = To_User_Unit( g_UserUnit, coord.y*Ysign ); double dYpos = To_User_Unit( g_UserUnit, coord.y*Ysign );
...@@ -441,8 +443,8 @@ void PL_EDITOR_FRAME::UpdateStatusBar() ...@@ -441,8 +443,8 @@ void PL_EDITOR_FRAME::UpdateStatusBar()
SetStatusText( line, 2 ); SetStatusText( line, 2 );
// Display relative coordinates: // Display relative coordinates:
int dx = screen->GetCrossHairPosition().x - screen->m_O_Curseur.x; int dx = GetCrossHairPosition().x - screen->m_O_Curseur.x;
int dy = screen->GetCrossHairPosition().y - screen->m_O_Curseur.y; int dy = GetCrossHairPosition().y - screen->m_O_Curseur.y;
dXpos = To_User_Unit( g_UserUnit, dx * Xsign ); dXpos = To_User_Unit( g_UserUnit, dx * Xsign );
dYpos = To_User_Unit( g_UserUnit, dy * Ysign ); dYpos = To_User_Unit( g_UserUnit, dy * Ysign );
line.Printf( locformatter, dXpos, dYpos ); line.Printf( locformatter, dXpos, dYpos );
...@@ -594,10 +596,11 @@ WORKSHEET_DATAITEM * PL_EDITOR_FRAME::GetSelectedItem() ...@@ -594,10 +596,11 @@ WORKSHEET_DATAITEM * PL_EDITOR_FRAME::GetSelectedItem()
*/ */
WORKSHEET_DATAITEM* PL_EDITOR_FRAME::Locate( const wxPoint& aPosition ) WORKSHEET_DATAITEM* PL_EDITOR_FRAME::Locate( const wxPoint& aPosition )
{ {
const PAGE_INFO& pageInfo = GetPageSettings(); const PAGE_INFO& pageInfo = GetPageSettings();
TITLE_BLOCK t_block = GetTitleBlock(); TITLE_BLOCK t_block = GetTitleBlock();
EDA_COLOR_T color = RED; // Needed, not used EDA_COLOR_T color = RED; // Needed, not used
PL_EDITOR_SCREEN* screen = (PL_EDITOR_SCREEN*) GetScreen(); PL_EDITOR_SCREEN* screen = (PL_EDITOR_SCREEN*) GetScreen();
screen-> m_ScreenNumber = GetPageNumberOption() ? 1 : 2; screen-> m_ScreenNumber = GetPageNumberOption() ? 1 : 2;
WS_DRAW_ITEM_LIST drawList; WS_DRAW_ITEM_LIST drawList;
...@@ -623,9 +626,9 @@ WORKSHEET_DATAITEM* PL_EDITOR_FRAME::Locate( const wxPoint& aPosition ) ...@@ -623,9 +626,9 @@ WORKSHEET_DATAITEM* PL_EDITOR_FRAME::Locate( const wxPoint& aPosition )
// Choose item in list if more than 1 item // Choose item in list if more than 1 item
if( list.size() > 1 ) if( list.size() > 1 )
{ {
wxArrayString choices; wxArrayString choices;
wxString text; wxString text;
wxPoint cursPos = screen->GetCrossHairPosition(); wxPoint cursPos = GetCrossHairPosition();
for( unsigned ii = 0; ii < list.size(); ++ii ) for( unsigned ii = 0; ii < list.size(); ++ii )
{ {
...@@ -656,7 +659,7 @@ WORKSHEET_DATAITEM* PL_EDITOR_FRAME::Locate( const wxPoint& aPosition ) ...@@ -656,7 +659,7 @@ WORKSHEET_DATAITEM* PL_EDITOR_FRAME::Locate( const wxPoint& aPosition )
if( selection < 0 ) if( selection < 0 )
return NULL; return NULL;
screen->SetCrossHairPosition( cursPos ); SetCrossHairPosition( cursPos );
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
drawitem = list[selection]; drawitem = list[selection];
} }
......
...@@ -58,6 +58,8 @@ class PL_EDITOR_FRAME : public EDA_DRAW_FRAME ...@@ -58,6 +58,8 @@ class PL_EDITOR_FRAME : public EDA_DRAW_FRAME
// usefull when there are some items which are // usefull when there are some items which are
// only on page 1, not on page 1 // only on page 1, not on page 1
wxPoint m_grid_origin;
protected: protected:
/// The last filename chosen to be proposed to the user /// The last filename chosen to be proposed to the user
wxString m_lastFileName; wxString m_lastFileName;
...@@ -90,12 +92,21 @@ public: ...@@ -90,12 +92,21 @@ public:
return (PL_EDITOR_SCREEN*) m_canvas->GetScreen(); return (PL_EDITOR_SCREEN*) m_canvas->GetScreen();
} }
const wxPoint& GetOriginAxisPosition() const // overload EDA_DRAW_FRAME const wxPoint& GetAuxOrigin() const // overload EDA_DRAW_FRAME
{ {
static wxPoint dummy( 0,0 ); static wxPoint dummy; // ( 0,0 );
return dummy; return dummy;
} }
void SetOriginAxisPosition( const wxPoint& aPosition ) {} // overload EDA_DRAW_FRAME void SetAuxOrigin( const wxPoint& aPosition ) {} // overload EDA_DRAW_FRAME
const wxPoint& GetGridOrigin() const // overload EDA_DRAW_FRAME
{
return m_grid_origin;
}
void SetGridOrigin( const wxPoint& aPoint ) // overload EDA_DRAW_FRAME
{
m_grid_origin = aPoint;
}
const TITLE_BLOCK& GetTitleBlock() const; // overload EDA_DRAW_FRAME const TITLE_BLOCK& GetTitleBlock() const; // overload EDA_DRAW_FRAME
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ); // overload EDA_DRAW_FRAME void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ); // overload EDA_DRAW_FRAME
......
...@@ -106,7 +106,7 @@ void PCB_EDIT_FRAME::AutoPlace( wxCommandEvent& event ) ...@@ -106,7 +106,7 @@ void PCB_EDIT_FRAME::AutoPlace( wxCommandEvent& event )
break; break;
} }
/* Erase ratsnest if needed */ // Erase ratsnest if needed
if( GetBoard()->IsElementVisible(RATSNEST_VISIBLE) ) if( GetBoard()->IsElementVisible(RATSNEST_VISIBLE) )
DrawGeneralRatsnest( &dc ); DrawGeneralRatsnest( &dc );
...@@ -191,7 +191,7 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb ) ...@@ -191,7 +191,7 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
return; return;
} }
/* Confirmation */ // Confirmation
if( !IsOK( this, _( "Move modules?" ) ) ) if( !IsOK( this, _( "Move modules?" ) ) )
return; return;
...@@ -223,15 +223,15 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb ) ...@@ -223,15 +223,15 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
*/ */
if( PlaceModulesHorsPcb && edgesExist ) if( PlaceModulesHorsPcb && edgesExist )
{ {
if( GetScreen()->GetCrossHairPosition().y < (bbbox.GetBottom() + 2000) ) if( GetCrossHairPosition().y < (bbbox.GetBottom() + 2000) )
{ {
wxPoint pos = GetScreen()->GetCrossHairPosition(); wxPoint pos = GetCrossHairPosition();
pos.y = bbbox.GetBottom() + 2000; pos.y = bbbox.GetBottom() + 2000;
GetScreen()->SetCrossHairPosition( pos ); SetCrossHairPosition( pos );
} }
} }
/* calculate the area needed by footprints */ // calculate the area needed by footprints
surface = 0.0; surface = 0.0;
for( unsigned ii = 0; ii < moduleList.size(); ii++ ) for( unsigned ii = 0; ii < moduleList.size(); ii++ )
...@@ -249,7 +249,7 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb ) ...@@ -249,7 +249,7 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
Xsize_allowed = (int) ( sqrt( surface ) * 4.0 / 3.0 ); Xsize_allowed = (int) ( sqrt( surface ) * 4.0 / 3.0 );
start = current = GetScreen()->GetCrossHairPosition(); start = current = GetCrossHairPosition();
Ymax_size = 0; Ymax_size = 0;
for( unsigned ii = 0; ii < moduleList.size(); ii++ ) for( unsigned ii = 0; ii < moduleList.size(); ii++ )
...@@ -276,8 +276,8 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb ) ...@@ -276,8 +276,8 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
Ymax_size = 0; Ymax_size = 0;
} }
GetScreen()->SetCrossHairPosition( current + Module->GetPosition() - SetCrossHairPosition( current + Module->GetPosition() -
Module->GetBoundingBox().GetPosition() ); Module->GetBoundingBox().GetPosition() );
Ymax_size = std::max( Ymax_size, Module->GetBoundingBox().GetHeight() ); Ymax_size = std::max( Ymax_size, Module->GetBoundingBox().GetHeight() );
......
This diff is collapsed.
...@@ -148,17 +148,31 @@ const wxSize PCB_BASE_FRAME::GetPageSizeIU() const ...@@ -148,17 +148,31 @@ const wxSize PCB_BASE_FRAME::GetPageSizeIU() const
} }
const wxPoint& PCB_BASE_FRAME::GetOriginAxisPosition() const const wxPoint& PCB_BASE_FRAME::GetAuxOrigin() const
{ {
wxASSERT( m_Pcb ); wxASSERT( m_Pcb );
return m_Pcb->GetOriginAxisPosition(); return m_Pcb->GetAuxOrigin();
} }
void PCB_BASE_FRAME::SetOriginAxisPosition( const wxPoint& aPosition ) void PCB_BASE_FRAME::SetAuxOrigin( const wxPoint& aPoint )
{ {
wxASSERT( m_Pcb ); wxASSERT( m_Pcb );
m_Pcb->SetOriginAxisPosition( aPosition ); m_Pcb->SetAuxOrigin( aPoint );
}
const wxPoint& PCB_BASE_FRAME::GetGridOrigin() const
{
wxASSERT( m_Pcb );
return m_Pcb->GetGridOrigin();
}
void PCB_BASE_FRAME::SetGridOrigin( const wxPoint& aPoint )
{
wxASSERT( m_Pcb );
m_Pcb->SetGridOrigin( aPoint );
} }
...@@ -258,7 +272,7 @@ double PCB_BASE_FRAME::BestZoom() ...@@ -258,7 +272,7 @@ double PCB_BASE_FRAME::BestZoom()
double bestzoom = std::max( iu_per_du_X, iu_per_du_Y ); double bestzoom = std::max( iu_per_du_X, iu_per_du_Y );
GetScreen()->SetScrollCenterPosition( ibbbox.Centre() ); SetScrollCenterPosition( ibbbox.Centre() );
return bestzoom; return bestzoom;
} }
...@@ -268,21 +282,19 @@ void PCB_BASE_FRAME::CursorGoto( const wxPoint& aPos, bool aWarp ) ...@@ -268,21 +282,19 @@ void PCB_BASE_FRAME::CursorGoto( const wxPoint& aPos, bool aWarp )
{ {
// factored out of pcbnew/find.cpp // factored out of pcbnew/find.cpp
PCB_SCREEN* screen = (PCB_SCREEN*)GetScreen();
INSTALL_UNBUFFERED_DC( dc, m_canvas ); INSTALL_UNBUFFERED_DC( dc, m_canvas );
// There may be need to reframe the drawing. // There may be need to reframe the drawing.
if( !m_canvas->IsPointOnDisplay( aPos ) ) if( !m_canvas->IsPointOnDisplay( aPos ) )
{ {
screen->SetCrossHairPosition( aPos ); SetCrossHairPosition( aPos );
RedrawScreen( aPos, aWarp ); RedrawScreen( aPos, aWarp );
} }
else else
{ {
// Put cursor on item position // Put cursor on item position
m_canvas->CrossHairOff( &dc ); m_canvas->CrossHairOff( &dc );
screen->SetCrossHairPosition( aPos ); SetCrossHairPosition( aPos );
if( aWarp ) if( aWarp )
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
...@@ -560,8 +572,8 @@ void PCB_BASE_FRAME::UpdateStatusBar() ...@@ -560,8 +572,8 @@ void PCB_BASE_FRAME::UpdateStatusBar()
{ {
double theta, ro; double theta, ro;
dx = screen->GetCrossHairPosition().x - screen->m_O_Curseur.x; dx = GetCrossHairPosition().x - screen->m_O_Curseur.x;
dy = screen->GetCrossHairPosition().y - screen->m_O_Curseur.y; dy = GetCrossHairPosition().y - screen->m_O_Curseur.y;
theta = ArcTangente( -dy, dx ) / 10; theta = ArcTangente( -dy, dx ) / 10;
...@@ -598,8 +610,8 @@ void PCB_BASE_FRAME::UpdateStatusBar() ...@@ -598,8 +610,8 @@ void PCB_BASE_FRAME::UpdateStatusBar()
} }
// Display absolute coordinates: // Display absolute coordinates:
dXpos = To_User_Unit( g_UserUnit, screen->GetCrossHairPosition().x ); dXpos = To_User_Unit( g_UserUnit, GetCrossHairPosition().x );
dYpos = To_User_Unit( g_UserUnit, screen->GetCrossHairPosition().y ); dYpos = To_User_Unit( g_UserUnit, GetCrossHairPosition().y );
// The following sadly is an if Eeschema/if Pcbnew // The following sadly is an if Eeschema/if Pcbnew
wxString absformatter; wxString absformatter;
...@@ -642,8 +654,8 @@ void PCB_BASE_FRAME::UpdateStatusBar() ...@@ -642,8 +654,8 @@ void PCB_BASE_FRAME::UpdateStatusBar()
if( !DisplayOpt.DisplayPolarCood ) // display relative cartesian coordinates if( !DisplayOpt.DisplayPolarCood ) // display relative cartesian coordinates
{ {
// Display relative coordinates: // Display relative coordinates:
dx = screen->GetCrossHairPosition().x - screen->m_O_Curseur.x; dx = GetCrossHairPosition().x - screen->m_O_Curseur.x;
dy = screen->GetCrossHairPosition().y - screen->m_O_Curseur.y; dy = GetCrossHairPosition().y - screen->m_O_Curseur.y;
dXpos = To_User_Unit( g_UserUnit, dx ); dXpos = To_User_Unit( g_UserUnit, dx );
dYpos = To_User_Unit( g_UserUnit, dy ); dYpos = To_User_Unit( g_UserUnit, dy );
......
...@@ -120,7 +120,7 @@ private: ...@@ -120,7 +120,7 @@ private:
static bool InstallBlockCmdFrame( PCB_BASE_FRAME* parent, const wxString& title ) static bool InstallBlockCmdFrame( PCB_BASE_FRAME* parent, const wxString& title )
{ {
wxPoint oldpos = parent->GetScreen()->GetCrossHairPosition(); wxPoint oldpos = parent->GetCrossHairPosition();
parent->GetCanvas()->SetIgnoreMouseEvents( true ); parent->GetCanvas()->SetIgnoreMouseEvents( true );
DIALOG_BLOCK_OPTIONS * dlg = new DIALOG_BLOCK_OPTIONS( parent, title ); DIALOG_BLOCK_OPTIONS * dlg = new DIALOG_BLOCK_OPTIONS( parent, title );
...@@ -128,7 +128,7 @@ static bool InstallBlockCmdFrame( PCB_BASE_FRAME* parent, const wxString& title ...@@ -128,7 +128,7 @@ static bool InstallBlockCmdFrame( PCB_BASE_FRAME* parent, const wxString& title
int cmd = dlg->ShowModal(); int cmd = dlg->ShowModal();
dlg->Destroy(); dlg->Destroy();
parent->GetScreen()->SetCrossHairPosition( oldpos ); parent->SetCrossHairPosition( oldpos );
parent->GetCanvas()->MoveCursorToCrossHair(); parent->GetCanvas()->MoveCursorToCrossHair();
parent->GetCanvas()->SetIgnoreMouseEvents( false ); parent->GetCanvas()->SetIgnoreMouseEvents( false );
...@@ -232,9 +232,9 @@ void PCB_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) ...@@ -232,9 +232,9 @@ void PCB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
case BLOCK_IDLE: case BLOCK_IDLE:
break; break;
case BLOCK_DRAG: /* Drag */ case BLOCK_DRAG: // Drag
case BLOCK_MOVE: /* Move */ case BLOCK_MOVE: // Move
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/ case BLOCK_PRESELECT_MOVE: // Move with preselection list
if( m_canvas->IsMouseCaptured() ) if( m_canvas->IsMouseCaptured() )
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
...@@ -242,7 +242,7 @@ void PCB_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) ...@@ -242,7 +242,7 @@ void PCB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
GetScreen()->m_BlockLocate.ClearItemsList(); GetScreen()->m_BlockLocate.ClearItemsList();
break; break;
case BLOCK_COPY: /* Copy */ case BLOCK_COPY: // Copy
if( m_canvas->IsMouseCaptured() ) if( m_canvas->IsMouseCaptured() )
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
...@@ -315,35 +315,35 @@ bool PCB_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -315,35 +315,35 @@ bool PCB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
DisplayError( this, wxT( "Error in HandleBlockPLace" ) ); DisplayError( this, wxT( "Error in HandleBlockPLace" ) );
break; break;
case BLOCK_DRAG: /* Drag (not used, for future enhancements)*/ case BLOCK_DRAG: // Drag (not used, for future enhancements)
case BLOCK_MOVE: /* Move */ case BLOCK_MOVE: // Move
case BLOCK_COPY: /* Copy */ case BLOCK_COPY: // Copy
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/ case BLOCK_PRESELECT_MOVE: // Move with preselection list
GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_MOVE ); GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_MOVE );
nextcmd = true; nextcmd = true;
m_canvas->SetMouseCaptureCallback( drawMovingBlock ); m_canvas->SetMouseCaptureCallback( drawMovingBlock );
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
break; break;
case BLOCK_DELETE: /* Delete */ case BLOCK_DELETE: // Delete
m_canvas->SetMouseCaptureCallback( NULL ); m_canvas->SetMouseCaptureCallback( NULL );
GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_STOP ); GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_STOP );
Block_Delete(); Block_Delete();
break; break;
case BLOCK_ROTATE: /* Rotation */ case BLOCK_ROTATE: // Rotation
m_canvas->SetMouseCaptureCallback( NULL ); m_canvas->SetMouseCaptureCallback( NULL );
GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_STOP ); GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_STOP );
Block_Rotate(); Block_Rotate();
break; break;
case BLOCK_FLIP: /* Flip */ case BLOCK_FLIP: // Flip
m_canvas->SetMouseCaptureCallback( NULL ); m_canvas->SetMouseCaptureCallback( NULL );
GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_STOP ); GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_STOP );
Block_Flip(); Block_Flip();
break; break;
case BLOCK_SAVE: /* Save (not used, for future enhancements)*/ case BLOCK_SAVE: // Save (not used, for future enhancements)
GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_STOP ); GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_STOP );
if( GetScreen()->m_BlockLocate.GetCount() ) if( GetScreen()->m_BlockLocate.GetCount() )
...@@ -355,7 +355,7 @@ bool PCB_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -355,7 +355,7 @@ bool PCB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
case BLOCK_PASTE: case BLOCK_PASTE:
break; break;
case BLOCK_ZOOM: /* Window Zoom */ case BLOCK_ZOOM: // Window Zoom
// Turn off the redraw block routine now so it is not displayed // Turn off the redraw block routine now so it is not displayed
// with one corner at the new center of the screen // with one corner at the new center of the screen
...@@ -577,7 +577,7 @@ static void drawMovingBlock( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a ...@@ -577,7 +577,7 @@ static void drawMovingBlock( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a
if( screen->m_BlockLocate.GetState() != STATE_BLOCK_STOP ) if( screen->m_BlockLocate.GetState() != STATE_BLOCK_STOP )
{ {
screen->m_BlockLocate.SetMoveVector( screen->GetCrossHairPosition() - screen->m_BlockLocate.SetMoveVector( aPanel->GetParent()->GetCrossHairPosition() -
screen->m_BlockLocate.GetLastCursorPosition() ); screen->m_BlockLocate.GetLastCursorPosition() );
} }
...@@ -600,7 +600,7 @@ void PCB_EDIT_FRAME::Block_Delete() ...@@ -600,7 +600,7 @@ void PCB_EDIT_FRAME::Block_Delete()
PICKED_ITEMS_LIST* itemsList = &GetScreen()->m_BlockLocate.GetItems(); PICKED_ITEMS_LIST* itemsList = &GetScreen()->m_BlockLocate.GetItems();
itemsList->m_Status = UR_DELETED; itemsList->m_Status = UR_DELETED;
/* unlink items and clear flags */ // unlink items and clear flags
for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ ) for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ )
{ {
BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( ii ); BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( ii );
...@@ -658,7 +658,7 @@ void PCB_EDIT_FRAME::Block_Rotate() ...@@ -658,7 +658,7 @@ void PCB_EDIT_FRAME::Block_Rotate()
wxPoint centre; // rotation cent-re for the rotation transform wxPoint centre; // rotation cent-re for the rotation transform
int rotAngle = 900; // rotation angle in 0.1 deg. int rotAngle = 900; // rotation angle in 0.1 deg.
oldpos = GetScreen()->GetCrossHairPosition(); oldpos = GetCrossHairPosition();
centre = GetScreen()->m_BlockLocate.Centre(); centre = GetScreen()->m_BlockLocate.Centre();
OnModify(); OnModify();
...@@ -680,7 +680,7 @@ void PCB_EDIT_FRAME::Block_Rotate() ...@@ -680,7 +680,7 @@ void PCB_EDIT_FRAME::Block_Rotate()
m_Pcb->m_Status_Pcb = 0; m_Pcb->m_Status_Pcb = 0;
break; break;
/* Move and rotate the track segments */ // Move and rotate the track segments
case PCB_TRACE_T: // a track segment (segment on a copper layer) case PCB_TRACE_T: // a track segment (segment on a copper layer)
case PCB_VIA_T: // a via (like track segment on a copper layer) case PCB_VIA_T: // a via (like track segment on a copper layer)
m_Pcb->m_Status_Pcb = 0; m_Pcb->m_Status_Pcb = 0;
...@@ -716,14 +716,14 @@ void PCB_EDIT_FRAME::Block_Flip() ...@@ -716,14 +716,14 @@ void PCB_EDIT_FRAME::Block_Flip()
{ {
#define INVERT( pos ) (pos) = center.y - ( (pos) - center.y ) #define INVERT( pos ) (pos) = center.y - ( (pos) - center.y )
wxPoint memo; wxPoint memo;
wxPoint center; /* Position of the axis for inversion of all elements */ wxPoint center; // Position of the axis for inversion of all elements
OnModify(); OnModify();
PICKED_ITEMS_LIST* itemsList = &GetScreen()->m_BlockLocate.GetItems(); PICKED_ITEMS_LIST* itemsList = &GetScreen()->m_BlockLocate.GetItems();
itemsList->m_Status = UR_FLIPPED; itemsList->m_Status = UR_FLIPPED;
memo = GetScreen()->GetCrossHairPosition(); memo = GetCrossHairPosition();
center = GetScreen()->m_BlockLocate.Centre(); center = GetScreen()->m_BlockLocate.Centre();
...@@ -741,7 +741,7 @@ void PCB_EDIT_FRAME::Block_Flip() ...@@ -741,7 +741,7 @@ void PCB_EDIT_FRAME::Block_Flip()
m_Pcb->m_Status_Pcb = 0; m_Pcb->m_Status_Pcb = 0;
break; break;
/* Move and rotate the track segments */ // Move and rotate the track segments
case PCB_TRACE_T: // a track segment (segment on a copper layer) case PCB_TRACE_T: // a track segment (segment on a copper layer)
case PCB_VIA_T: // a via (like track segment on a copper layer) case PCB_VIA_T: // a via (like track segment on a copper layer)
m_Pcb->m_Status_Pcb = 0; m_Pcb->m_Status_Pcb = 0;
...@@ -795,7 +795,7 @@ void PCB_EDIT_FRAME::Block_Move() ...@@ -795,7 +795,7 @@ void PCB_EDIT_FRAME::Block_Move()
item->ClearFlags(); item->ClearFlags();
break; break;
/* Move track segments */ // Move track segments
case PCB_TRACE_T: // a track segment (segment on a copper layer) case PCB_TRACE_T: // a track segment (segment on a copper layer)
case PCB_VIA_T: // a via (like a track segment on a copper layer) case PCB_VIA_T: // a via (like a track segment on a copper layer)
m_Pcb->m_Status_Pcb = 0; m_Pcb->m_Status_Pcb = 0;
......
...@@ -127,12 +127,14 @@ bool FOOTPRINT_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -127,12 +127,14 @@ bool FOOTPRINT_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
{ {
BLOCK_STATE_T state = GetScreen()->m_BlockLocate.GetState(); BLOCK_STATE_T state = GetScreen()->m_BlockLocate.GetState();
BLOCK_COMMAND_T command = GetScreen()->m_BlockLocate.GetCommand(); BLOCK_COMMAND_T command = GetScreen()->m_BlockLocate.GetCommand();
m_canvas->CallEndMouseCapture( DC ); m_canvas->CallEndMouseCapture( DC );
GetScreen()->m_BlockLocate.SetState( state ); GetScreen()->m_BlockLocate.SetState( state );
GetScreen()->m_BlockLocate.SetCommand( command ); GetScreen()->m_BlockLocate.SetCommand( command );
m_canvas->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand ); m_canvas->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand );
GetScreen()->SetCrossHairPosition( wxPoint( GetScreen()->m_BlockLocate.GetRight(),
GetScreen()->m_BlockLocate.GetBottom() ) ); SetCrossHairPosition( wxPoint( GetScreen()->m_BlockLocate.GetRight(),
GetScreen()->m_BlockLocate.GetBottom() ) );
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
} }
...@@ -142,9 +144,9 @@ bool FOOTPRINT_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -142,9 +144,9 @@ bool FOOTPRINT_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
DisplayError( this, wxT( "Error in HandleBlockPLace" ) ); DisplayError( this, wxT( "Error in HandleBlockPLace" ) );
break; break;
case BLOCK_DRAG: /* Drag */ case BLOCK_DRAG: // Drag
case BLOCK_MOVE: /* Move */ case BLOCK_MOVE: // Move
case BLOCK_COPY: /* Copy */ case BLOCK_COPY: // Copy
itemsCount = MarkItemsInBloc( currentModule, GetScreen()->m_BlockLocate ); itemsCount = MarkItemsInBloc( currentModule, GetScreen()->m_BlockLocate );
if( itemsCount ) if( itemsCount )
...@@ -164,13 +166,13 @@ bool FOOTPRINT_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -164,13 +166,13 @@ bool FOOTPRINT_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
break; break;
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/ case BLOCK_PRESELECT_MOVE: // Move with preselection list
nextcmd = true; nextcmd = true;
m_canvas->SetMouseCaptureCallback( DrawMovingBlockOutlines ); m_canvas->SetMouseCaptureCallback( DrawMovingBlockOutlines );
GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_MOVE ); GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_MOVE );
break; break;
case BLOCK_DELETE: /* Delete */ case BLOCK_DELETE: // Delete
itemsCount = MarkItemsInBloc( currentModule, GetScreen()->m_BlockLocate ); itemsCount = MarkItemsInBloc( currentModule, GetScreen()->m_BlockLocate );
if( itemsCount ) if( itemsCount )
...@@ -179,7 +181,7 @@ bool FOOTPRINT_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -179,7 +181,7 @@ bool FOOTPRINT_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
DeleteMarkedItems( currentModule ); DeleteMarkedItems( currentModule );
break; break;
case BLOCK_SAVE: /* Save */ case BLOCK_SAVE: // Save
case BLOCK_PASTE: case BLOCK_PASTE:
break; break;
...@@ -195,7 +197,7 @@ bool FOOTPRINT_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -195,7 +197,7 @@ bool FOOTPRINT_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
case BLOCK_MIRROR_X: case BLOCK_MIRROR_X:
case BLOCK_MIRROR_Y: case BLOCK_MIRROR_Y:
case BLOCK_FLIP: /* mirror */ case BLOCK_FLIP: // mirror
itemsCount = MarkItemsInBloc( currentModule, GetScreen()->m_BlockLocate ); itemsCount = MarkItemsInBloc( currentModule, GetScreen()->m_BlockLocate );
if( itemsCount ) if( itemsCount )
...@@ -204,7 +206,7 @@ bool FOOTPRINT_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -204,7 +206,7 @@ bool FOOTPRINT_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
MirrorMarkedItems( currentModule, GetScreen()->m_BlockLocate.Centre() ); MirrorMarkedItems( currentModule, GetScreen()->m_BlockLocate.Centre() );
break; break;
case BLOCK_ZOOM: /* Window Zoom */ case BLOCK_ZOOM: // Window Zoom
Window_Zoom( GetScreen()->m_BlockLocate ); Window_Zoom( GetScreen()->m_BlockLocate );
break; break;
...@@ -249,28 +251,28 @@ void FOOTPRINT_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) ...@@ -249,28 +251,28 @@ void FOOTPRINT_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
case BLOCK_IDLE: case BLOCK_IDLE:
break; break;
case BLOCK_DRAG: /* Drag */ case BLOCK_DRAG: // Drag
case BLOCK_MOVE: /* Move */ case BLOCK_MOVE: // Move
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/ case BLOCK_PRESELECT_MOVE: // Move with preselection list
GetScreen()->m_BlockLocate.ClearItemsList(); GetScreen()->m_BlockLocate.ClearItemsList();
SaveCopyInUndoList( currentModule, UR_MODEDIT ); SaveCopyInUndoList( currentModule, UR_MODEDIT );
MoveMarkedItems( currentModule, GetScreen()->m_BlockLocate.GetMoveVector() ); MoveMarkedItems( currentModule, GetScreen()->m_BlockLocate.GetMoveVector() );
m_canvas->Refresh( true ); m_canvas->Refresh( true );
break; break;
case BLOCK_COPY: /* Copy */ case BLOCK_COPY: // Copy
GetScreen()->m_BlockLocate.ClearItemsList(); GetScreen()->m_BlockLocate.ClearItemsList();
SaveCopyInUndoList( currentModule, UR_MODEDIT ); SaveCopyInUndoList( currentModule, UR_MODEDIT );
CopyMarkedItems( currentModule, GetScreen()->m_BlockLocate.GetMoveVector() ); CopyMarkedItems( currentModule, GetScreen()->m_BlockLocate.GetMoveVector() );
break; break;
case BLOCK_PASTE: /* Paste */ case BLOCK_PASTE: // Paste
GetScreen()->m_BlockLocate.ClearItemsList(); GetScreen()->m_BlockLocate.ClearItemsList();
break; break;
case BLOCK_MIRROR_X: case BLOCK_MIRROR_X:
case BLOCK_MIRROR_Y: case BLOCK_MIRROR_Y:
case BLOCK_FLIP: /* Mirror by popup menu, from block move */ case BLOCK_FLIP: // Mirror by popup menu, from block move
SaveCopyInUndoList( currentModule, UR_MODEDIT ); SaveCopyInUndoList( currentModule, UR_MODEDIT );
MirrorMarkedItems( currentModule, GetScreen()->m_BlockLocate.Centre() ); MirrorMarkedItems( currentModule, GetScreen()->m_BlockLocate.Centre() );
break; break;
...@@ -304,8 +306,8 @@ void FOOTPRINT_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) ...@@ -304,8 +306,8 @@ void FOOTPRINT_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase ) bool aErase )
{ {
BASE_SCREEN* screen = aPanel->GetScreen(); BASE_SCREEN* screen = aPanel->GetScreen();
FOOTPRINT_EDIT_FRAME * moduleEditFrame = FOOTPRINT_EDIT_FRAME::GetActiveFootprintEditor(); FOOTPRINT_EDIT_FRAME* moduleEditFrame = FOOTPRINT_EDIT_FRAME::GetActiveFootprintEditor();
wxASSERT( moduleEditFrame ); wxASSERT( moduleEditFrame );
MODULE* currentModule = moduleEditFrame->GetBoard()->m_Modules; MODULE* currentModule = moduleEditFrame->GetBoard()->m_Modules;
...@@ -319,7 +321,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx ...@@ -319,7 +321,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
if( currentModule ) if( currentModule )
{ {
wxPoint move_offset = -block->GetMoveVector(); wxPoint move_offset = -block->GetMoveVector();
BOARD_ITEM* item = currentModule->GraphicalItems(); BOARD_ITEM* item = currentModule->GraphicalItems();
for( ; item != NULL; item = item->Next() ) for( ; item != NULL; item = item->Next() )
...@@ -351,15 +353,15 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx ...@@ -351,15 +353,15 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
} }
} }
/* Repaint new view. */ // Repaint new view.
block->SetMoveVector( screen->GetCrossHairPosition() - block->GetLastCursorPosition() ); block->SetMoveVector( moduleEditFrame->GetCrossHairPosition() - block->GetLastCursorPosition() );
block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() ); block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );
if( currentModule ) if( currentModule )
{ {
BOARD_ITEM* item = currentModule->GraphicalItems(); BOARD_ITEM* item = currentModule->GraphicalItems();
wxPoint move_offset = - block->GetMoveVector(); wxPoint move_offset = - block->GetMoveVector();
for( ; item != NULL; item = item->Next() ) for( ; item != NULL; item = item->Next() )
{ {
......
...@@ -215,6 +215,8 @@ private: ...@@ -215,6 +215,8 @@ private:
ZONE_CONTAINERS m_ZoneDescriptorList; ZONE_CONTAINERS m_ZoneDescriptorList;
LAYER m_Layer[NB_LAYERS]; LAYER m_Layer[NB_LAYERS];
wxPoint m_grid_origin;
// if true m_highLight_NetCode is used // if true m_highLight_NetCode is used
HIGH_LIGHT_INFO m_highLight; // current high light data HIGH_LIGHT_INFO m_highLight; // current high light data
HIGH_LIGHT_INFO m_highLightPrevious; // a previously stored high light data HIGH_LIGHT_INFO m_highLightPrevious; // a previously stored high light data
...@@ -231,9 +233,6 @@ private: ...@@ -231,9 +233,6 @@ private:
TITLE_BLOCK m_titles; ///< text in lower right of screen and plots TITLE_BLOCK m_titles; ///< text in lower right of screen and plots
PCB_PLOT_PARAMS m_plotOptions; PCB_PLOT_PARAMS m_plotOptions;
/// Position of the origin axis, which is used in exports mostly
wxPoint m_originAxisPosition;
/// Number of pads connected to the current net. /// Number of pads connected to the current net.
int m_nodeCount; int m_nodeCount;
...@@ -387,6 +386,20 @@ public: ...@@ -387,6 +386,20 @@ public:
return (int) m_markers.size(); return (int) m_markers.size();
} }
/**
* Function SetAuxOrigin
* sets the origin point used for plotting.
*/
void SetAuxOrigin( const wxPoint& aPoint ) { m_designSettings.m_AuxOrigin = aPoint; }
const wxPoint& GetAuxOrigin() const { return m_designSettings.m_AuxOrigin; }
/**
* Function SetGridOrigin
* sets the origin point of the grid.
*/
void SetGridOrigin( const wxPoint& aPoint ) { m_designSettings.m_GridOrigin = aPoint; }
const wxPoint& GetGridOrigin() const { return m_designSettings.m_GridOrigin; }
/** /**
* Function ResetHighLight * Function ResetHighLight
* Reset all high light data to the init state * Reset all high light data to the init state
...@@ -594,9 +607,6 @@ public: ...@@ -594,9 +607,6 @@ public:
const PCB_PLOT_PARAMS& GetPlotOptions() const { return m_plotOptions; } const PCB_PLOT_PARAMS& GetPlotOptions() const { return m_plotOptions; }
void SetPlotOptions( const PCB_PLOT_PARAMS& aOptions ) { m_plotOptions = aOptions; } void SetPlotOptions( const PCB_PLOT_PARAMS& aOptions ) { m_plotOptions = aOptions; }
const wxPoint& GetOriginAxisPosition() const { return m_originAxisPosition; }
void SetOriginAxisPosition( const wxPoint& aPosition ) { m_originAxisPosition = aPosition; }
TITLE_BLOCK& GetTitleBlock() { return m_titles; } TITLE_BLOCK& GetTitleBlock() { return m_titles; }
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) { m_titles = aTitleBlock; } void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) { m_titles = aTitleBlock; }
......
...@@ -141,7 +141,7 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode ) ...@@ -141,7 +141,7 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode )
} }
} }
m_Collector->Collect( m_Pcb, scanList, GetScreen()->RefPos( true ), guide ); m_Collector->Collect( m_Pcb, scanList, RefPos( true ), guide );
#if 0 #if 0
// debugging: print out the collected items, showing their priority order too. // debugging: print out the collected items, showing their priority order too.
...@@ -161,7 +161,7 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode ) ...@@ -161,7 +161,7 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode )
if( item->Type() != PCB_ZONE_T ) if( item->Type() != PCB_ZONE_T )
continue; continue;
/* Found a TYPE ZONE */ // Found a TYPE ZONE
if( item->GetTimeStamp() == timestampzone ) // Remove it, redundant, zone already found if( item->GetTimeStamp() == timestampzone ) // Remove it, redundant, zone already found
{ {
m_Collector->Remove( ii ); m_Collector->Remove( ii );
...@@ -200,7 +200,7 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode ) ...@@ -200,7 +200,7 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode )
{ {
wxMenu itemMenu; wxMenu itemMenu;
/* Give a title to the selection menu. This is also a cancel menu item */ // Give a title to the selection menu. This is also a cancel menu item
wxMenuItem * item_title = new wxMenuItem( &itemMenu, -1, _( "Selection Clarification" ) ); wxMenuItem * item_title = new wxMenuItem( &itemMenu, -1, _( "Selection Clarification" ) );
#ifdef __WINDOWS__ #ifdef __WINDOWS__
...@@ -269,9 +269,9 @@ void PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH ...@@ -269,9 +269,9 @@ void PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
snapToGrid = false; snapToGrid = false;
if( snapToGrid ) if( snapToGrid )
pos = GetScreen()->GetNearestGridPosition( pos ); pos = GetNearestGridPosition( pos );
oldpos = GetScreen()->GetCrossHairPosition(); oldpos = GetCrossHairPosition();
gridSize = GetScreen()->GetGridSize(); gridSize = GetScreen()->GetGridSize();
...@@ -306,7 +306,7 @@ void PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH ...@@ -306,7 +306,7 @@ void PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
} }
// Put cursor in new position, according to the zoom keys (if any). // Put cursor in new position, according to the zoom keys (if any).
GetScreen()->SetCrossHairPosition( pos, snapToGrid ); SetCrossHairPosition( pos, snapToGrid );
/* Put cursor on grid or a pad centre if requested. If the tool DELETE is active the /* Put cursor on grid or a pad centre if requested. If the tool DELETE is active the
* cursor is left off grid this is better to reach items to delete off grid, * cursor is left off grid this is better to reach items to delete off grid,
...@@ -326,7 +326,7 @@ void PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH ...@@ -326,7 +326,7 @@ void PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
if( Magnetize( this, GetToolId(), igridsize, curs_pos, &pos ) ) if( Magnetize( this, GetToolId(), igridsize, curs_pos, &pos ) )
{ {
GetScreen()->SetCrossHairPosition( pos, false ); SetCrossHairPosition( pos, false );
} }
else else
{ {
...@@ -335,19 +335,19 @@ void PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH ...@@ -335,19 +335,19 @@ void PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
if( !g_Drc_On || !g_CurrentTrackSegment || if( !g_Drc_On || !g_CurrentTrackSegment ||
(BOARD_ITEM*)g_CurrentTrackSegment != this->GetCurItem() || (BOARD_ITEM*)g_CurrentTrackSegment != this->GetCurItem() ||
!LocateIntrusion( m_Pcb->m_Track, g_CurrentTrackSegment, !LocateIntrusion( m_Pcb->m_Track, g_CurrentTrackSegment,
GetScreen()->m_Active_Layer, GetScreen()->RefPos( true ) ) ) GetScreen()->m_Active_Layer, RefPos( true ) ) )
{ {
GetScreen()->SetCrossHairPosition( curs_pos, snapToGrid ); SetCrossHairPosition( curs_pos, snapToGrid );
} }
} }
if( oldpos != GetScreen()->GetCrossHairPosition() ) if( oldpos != GetCrossHairPosition() )
{ {
pos = GetScreen()->GetCrossHairPosition(); pos = GetCrossHairPosition();
GetScreen()->SetCrossHairPosition( oldpos, false ); SetCrossHairPosition( oldpos, false );
m_canvas->CrossHairOff( aDC ); m_canvas->CrossHairOff( aDC );
GetScreen()->SetCrossHairPosition( pos, false ); SetCrossHairPosition( pos, false );
m_canvas->CrossHairOn( aDC ); m_canvas->CrossHairOn( aDC );
if( m_canvas->IsMouseCaptured() ) if( m_canvas->IsMouseCaptured() )
...@@ -373,5 +373,5 @@ void PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH ...@@ -373,5 +373,5 @@ void PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
OnHotKey( aDC, aHotKey, aPosition ); OnHotKey( aDC, aHotKey, aPosition );
} }
UpdateStatusBar(); /* Display new cursor coordinates */ UpdateStatusBar(); // Display new cursor coordinates
} }
...@@ -96,7 +96,7 @@ void RemoteCommand( const char* cmdline ) ...@@ -96,7 +96,7 @@ void RemoteCommand( const char* cmdline )
pos = pad->GetPosition(); pos = pad->GetPosition();
} }
if( netcode > 0 ) /* highlight the pad net*/ if( netcode > 0 ) // highlight the pad net
{ {
pcb->HighLightON(); pcb->HighLightON();
pcb->SetHighLightNet( netcode ); pcb->SetHighLightNet( netcode );
...@@ -127,7 +127,7 @@ void RemoteCommand( const char* cmdline ) ...@@ -127,7 +127,7 @@ void RemoteCommand( const char* cmdline )
if( module ) // if found, center the module on screen, and redraw the screen. if( module ) // if found, center the module on screen, and redraw the screen.
{ {
frame->GetScreen()->SetCrossHairPosition(pos); frame->SetCrossHairPosition( pos );
frame->RedrawScreen( pos, false ); frame->RedrawScreen( pos, false );
} }
} }
......
...@@ -317,7 +317,7 @@ bool DIALOG_SVG_PRINT::CreateSVGFile( const wxString& aFullFileName ) ...@@ -317,7 +317,7 @@ bool DIALOG_SVG_PRINT::CreateSVGFile( const wxString& aFullFileName )
m_plotOpts.SetValueColor( color ); m_plotOpts.SetValueColor( color );
PAGE_INFO pageInfo = m_board->GetPageSettings(); PAGE_INFO pageInfo = m_board->GetPageSettings();
wxPoint axisorigin = m_board->GetOriginAxisPosition(); wxPoint axisorigin = m_board->GetAuxOrigin();
if( PageIsBoardBoundarySize() ) if( PageIsBoardBoundarySize() )
{ {
...@@ -328,7 +328,7 @@ bool DIALOG_SVG_PRINT::CreateSVGFile( const wxString& aFullFileName ) ...@@ -328,7 +328,7 @@ bool DIALOG_SVG_PRINT::CreateSVGFile( const wxString& aFullFileName )
m_board->SetPageSettings( currpageInfo ); m_board->SetPageSettings( currpageInfo );
m_plotOpts.SetUseAuxOrigin( true ); m_plotOpts.SetUseAuxOrigin( true );
wxPoint origin = bbox.GetOrigin(); wxPoint origin = bbox.GetOrigin();
m_board->SetOriginAxisPosition( origin ); m_board->SetAuxOrigin( origin );
} }
LOCALE_IO toggle; LOCALE_IO toggle;
...@@ -344,7 +344,7 @@ bool DIALOG_SVG_PRINT::CreateSVGFile( const wxString& aFullFileName ) ...@@ -344,7 +344,7 @@ bool DIALOG_SVG_PRINT::CreateSVGFile( const wxString& aFullFileName )
} }
delete plotter; delete plotter;
m_board->SetOriginAxisPosition( axisorigin ); m_board->SetAuxOrigin( axisorigin );
m_board->SetPageSettings( pageInfo ); m_board->SetPageSettings( pageInfo );
return true; return true;
......
...@@ -85,7 +85,7 @@ DIALOG_MODULE_BOARD_EDITOR::~DIALOG_MODULE_BOARD_EDITOR() ...@@ -85,7 +85,7 @@ DIALOG_MODULE_BOARD_EDITOR::~DIALOG_MODULE_BOARD_EDITOR()
} }
/* Creation of the panel properties of the module editor. */ // Creation of the panel properties of the module editor.
void DIALOG_MODULE_BOARD_EDITOR::InitBoardProperties() void DIALOG_MODULE_BOARD_EDITOR::InitBoardProperties()
{ {
PutValueInLocalUnits( *m_ModPositionX, m_CurrentModule->GetPosition().x ); PutValueInLocalUnits( *m_ModPositionX, m_CurrentModule->GetPosition().x );
...@@ -244,7 +244,7 @@ void DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties() ...@@ -244,7 +244,7 @@ void DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties()
m_LastSelected3DShapeIndex = -1; m_LastSelected3DShapeIndex = -1;
/* Init 3D shape list */ // Init 3D shape list
S3D_MASTER* draw3D = m_CurrentModule->Models(); S3D_MASTER* draw3D = m_CurrentModule->Models();
while( draw3D ) while( draw3D )
...@@ -276,7 +276,7 @@ void DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties() ...@@ -276,7 +276,7 @@ void DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties()
_( "Use this attribute for \"virtual\" components drawn on board\n" _( "Use this attribute for \"virtual\" components drawn on board\n"
"(like a old ISA PC bus connector)" ) ); "(like a old ISA PC bus connector)" ) );
/* Controls on right side of the dialog */ // Controls on right side of the dialog
switch( m_CurrentModule->GetAttributes() & 255 ) switch( m_CurrentModule->GetAttributes() & 255 )
{ {
case 0: case 0:
...@@ -601,7 +601,7 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event ) ...@@ -601,7 +601,7 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event )
if( change_layer ) if( change_layer )
m_CurrentModule->Flip( m_CurrentModule->GetPosition() ); m_CurrentModule->Flip( m_CurrentModule->GetPosition() );
/* Update 3D shape list */ // Update 3D shape list
int ii = m_3D_ShapeNameListBox->GetSelection(); int ii = m_3D_ShapeNameListBox->GetSelection();
if( ii >= 0 ) if( ii >= 0 )
...@@ -660,23 +660,23 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event ) ...@@ -660,23 +660,23 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event )
void DIALOG_MODULE_BOARD_EDITOR::OnEditReference( wxCommandEvent& event ) void DIALOG_MODULE_BOARD_EDITOR::OnEditReference( wxCommandEvent& event )
{ {
wxPoint tmp = m_Parent->GetScreen()->GetCrossHairPosition(); wxPoint tmp = m_Parent->GetCrossHairPosition();
m_Parent->GetScreen()->SetCrossHairPosition( m_ReferenceCopy->GetTextPosition() ); m_Parent->SetCrossHairPosition( m_ReferenceCopy->GetTextPosition() );
m_ReferenceCopy->SetParent( m_CurrentModule ); m_ReferenceCopy->SetParent( m_CurrentModule );
m_Parent->InstallTextModOptionsFrame( m_ReferenceCopy, NULL ); m_Parent->InstallTextModOptionsFrame( m_ReferenceCopy, NULL );
m_Parent->GetScreen()->SetCrossHairPosition( tmp ); m_Parent->SetCrossHairPosition( tmp );
m_ReferenceCtrl->SetValue( m_ReferenceCopy->GetText() ); m_ReferenceCtrl->SetValue( m_ReferenceCopy->GetText() );
} }
void DIALOG_MODULE_BOARD_EDITOR::OnEditValue( wxCommandEvent& event ) void DIALOG_MODULE_BOARD_EDITOR::OnEditValue( wxCommandEvent& event )
{ {
wxPoint tmp = m_Parent->GetScreen()->GetCrossHairPosition(); wxPoint tmp = m_Parent->GetCrossHairPosition();
m_Parent->GetScreen()->SetCrossHairPosition( m_ValueCopy->GetTextPosition() ); m_Parent->SetCrossHairPosition( m_ValueCopy->GetTextPosition() );
m_ValueCopy->SetParent( m_CurrentModule ); m_ValueCopy->SetParent( m_CurrentModule );
m_Parent->InstallTextModOptionsFrame( m_ValueCopy, NULL ); m_Parent->InstallTextModOptionsFrame( m_ValueCopy, NULL );
m_Parent->GetScreen()->SetCrossHairPosition( tmp ); m_Parent->SetCrossHairPosition( tmp );
m_ValueCtrl->SetValue( m_ValueCopy->GetText() ); m_ValueCtrl->SetValue( m_ValueCopy->GetText() );
} }
...@@ -84,9 +84,7 @@ DIALOG_MODULE_MODULE_EDITOR::~DIALOG_MODULE_MODULE_EDITOR() ...@@ -84,9 +84,7 @@ DIALOG_MODULE_MODULE_EDITOR::~DIALOG_MODULE_MODULE_EDITOR()
} }
/********************************************************/
void DIALOG_MODULE_MODULE_EDITOR::initModeditProperties() void DIALOG_MODULE_MODULE_EDITOR::initModeditProperties()
/********************************************************/
{ {
SetFocus(); SetFocus();
...@@ -213,8 +211,7 @@ void DIALOG_MODULE_MODULE_EDITOR::initModeditProperties() ...@@ -213,8 +211,7 @@ void DIALOG_MODULE_MODULE_EDITOR::initModeditProperties()
} }
/* Initialize 3D info displayed in dialog box from values in aStruct3DSource // Initialize 3D info displayed in dialog box from values in aStruct3DSource
*/
void DIALOG_MODULE_MODULE_EDITOR::Transfert3DValuesToDisplay( S3D_MASTER * aStruct3DSource ) void DIALOG_MODULE_MODULE_EDITOR::Transfert3DValuesToDisplay( S3D_MASTER * aStruct3DSource )
{ {
if( aStruct3DSource ) if( aStruct3DSource )
...@@ -247,9 +244,8 @@ void DIALOG_MODULE_MODULE_EDITOR::TransfertDisplayTo3DValues( int aIndexSelectio ...@@ -247,9 +244,8 @@ void DIALOG_MODULE_MODULE_EDITOR::TransfertDisplayTo3DValues( int aIndexSelectio
struct3DDest->m_MatPosition = m_3D_Offset->GetValue(); struct3DDest->m_MatPosition = m_3D_Offset->GetValue();
} }
/***********************************************************/
void DIALOG_MODULE_MODULE_EDITOR::On3DShapeNameSelected(wxCommandEvent& event) void DIALOG_MODULE_MODULE_EDITOR::On3DShapeNameSelected(wxCommandEvent& event)
/***********************************************************/
{ {
if( m_lastSelected3DShapeIndex >= 0 ) if( m_lastSelected3DShapeIndex >= 0 )
TransfertDisplayTo3DValues( m_lastSelected3DShapeIndex ); TransfertDisplayTo3DValues( m_lastSelected3DShapeIndex );
...@@ -268,9 +264,7 @@ void DIALOG_MODULE_MODULE_EDITOR::On3DShapeNameSelected(wxCommandEvent& event) ...@@ -268,9 +264,7 @@ void DIALOG_MODULE_MODULE_EDITOR::On3DShapeNameSelected(wxCommandEvent& event)
} }
/***********************************************************/
void DIALOG_MODULE_MODULE_EDITOR::Remove3DShape(wxCommandEvent& event) void DIALOG_MODULE_MODULE_EDITOR::Remove3DShape(wxCommandEvent& event)
/***********************************************************/
{ {
if( m_lastSelected3DShapeIndex >= 0 ) if( m_lastSelected3DShapeIndex >= 0 )
TransfertDisplayTo3DValues( m_lastSelected3DShapeIndex ); TransfertDisplayTo3DValues( m_lastSelected3DShapeIndex );
...@@ -293,9 +287,7 @@ void DIALOG_MODULE_MODULE_EDITOR::Remove3DShape(wxCommandEvent& event) ...@@ -293,9 +287,7 @@ void DIALOG_MODULE_MODULE_EDITOR::Remove3DShape(wxCommandEvent& event)
} }
/*********************************************************************/
void DIALOG_MODULE_MODULE_EDITOR::BrowseAndAdd3DLib( wxCommandEvent& event ) void DIALOG_MODULE_MODULE_EDITOR::BrowseAndAdd3DLib( wxCommandEvent& event )
/*********************************************************************/
{ {
wxString fullfilename, shortfilename; wxString fullfilename, shortfilename;
wxString fullpath; wxString fullpath;
...@@ -364,16 +356,13 @@ void DIALOG_MODULE_MODULE_EDITOR::BrowseAndAdd3DLib( wxCommandEvent& event ) ...@@ -364,16 +356,13 @@ void DIALOG_MODULE_MODULE_EDITOR::BrowseAndAdd3DLib( wxCommandEvent& event )
} }
/**********************************************************************/
void DIALOG_MODULE_MODULE_EDITOR::OnCancelClick( wxCommandEvent& event ) void DIALOG_MODULE_MODULE_EDITOR::OnCancelClick( wxCommandEvent& event )
/**********************************************************************/
{ {
EndModal( -1 ); EndModal( -1 );
} }
/******************************************************************************/
void DIALOG_MODULE_MODULE_EDITOR::OnOkClick( wxCommandEvent& event ) void DIALOG_MODULE_MODULE_EDITOR::OnOkClick( wxCommandEvent& event )
/******************************************************************************/
{ {
// First, test for invalid chars in module name // First, test for invalid chars in module name
wxString footprintName = m_FootprintNameCtrl->GetValue(); wxString footprintName = m_FootprintNameCtrl->GetValue();
...@@ -486,25 +475,22 @@ void DIALOG_MODULE_MODULE_EDITOR::OnOkClick( wxCommandEvent& event ) ...@@ -486,25 +475,22 @@ void DIALOG_MODULE_MODULE_EDITOR::OnOkClick( wxCommandEvent& event )
} }
/***********************************************************************/
void DIALOG_MODULE_MODULE_EDITOR::OnEditReference(wxCommandEvent& event) void DIALOG_MODULE_MODULE_EDITOR::OnEditReference(wxCommandEvent& event)
/***********************************************************************/
{ {
wxPoint tmp = m_parent->GetScreen()->GetCrossHairPosition(); wxPoint tmp = m_parent->GetCrossHairPosition();
m_parent->GetScreen()->SetCrossHairPosition( m_referenceCopy->GetTextPosition() ); m_parent->SetCrossHairPosition( m_referenceCopy->GetTextPosition() );
m_parent->InstallTextModOptionsFrame( m_referenceCopy, NULL ); m_parent->InstallTextModOptionsFrame( m_referenceCopy, NULL );
m_parent->GetScreen()->SetCrossHairPosition( tmp ); m_parent->SetCrossHairPosition( tmp );
m_ReferenceCtrl->SetValue( m_referenceCopy->GetText() ); m_ReferenceCtrl->SetValue( m_referenceCopy->GetText() );
} }
/***********************************************************/
void DIALOG_MODULE_MODULE_EDITOR::OnEditValue(wxCommandEvent& event) void DIALOG_MODULE_MODULE_EDITOR::OnEditValue(wxCommandEvent& event)
/***********************************************************/
{ {
wxPoint tmp = m_parent->GetScreen()->GetCrossHairPosition(); wxPoint tmp = m_parent->GetCrossHairPosition();
m_parent->GetScreen()->SetCrossHairPosition( m_valueCopy->GetTextPosition() ); m_parent->SetCrossHairPosition( m_valueCopy->GetTextPosition() );
m_parent->InstallTextModOptionsFrame( m_valueCopy, NULL ); m_parent->InstallTextModOptionsFrame( m_valueCopy, NULL );
m_parent->GetScreen()->SetCrossHairPosition( tmp ); m_parent->SetCrossHairPosition( tmp );
m_ValueCtrl->SetValue( m_valueCopy->GetText() ); m_ValueCtrl->SetValue( m_valueCopy->GetText() );
} }
...@@ -321,7 +321,7 @@ void DIALOG_GENDRILL::SetParams() ...@@ -321,7 +321,7 @@ void DIALOG_GENDRILL::SetParams()
if( m_Choice_Drill_Offset->GetSelection() == 0 ) if( m_Choice_Drill_Offset->GetSelection() == 0 )
m_FileDrillOffset = wxPoint( 0, 0 ); m_FileDrillOffset = wxPoint( 0, 0 );
else else
m_FileDrillOffset = m_parent->GetOriginAxisPosition(); m_FileDrillOffset = m_parent->GetAuxOrigin();
if( m_UnitDrillIsInch ) if( m_UnitDrillIsInch )
m_Precision = precisionListForInches; m_Precision = precisionListForInches;
......
...@@ -201,14 +201,18 @@ void DIALOG_SET_GRID::OnOkClick( wxCommandEvent& event ) ...@@ -201,14 +201,18 @@ void DIALOG_SET_GRID::OnOkClick( wxCommandEvent& event )
bool PCB_BASE_FRAME::InvokeDialogGrid() bool PCB_BASE_FRAME::InvokeDialogGrid()
{ {
wxPoint grid_origin = GetGridOrigin();
DIALOG_SET_GRID dlg( this, &m_UserGridUnit, g_UserUnit, &m_UserGridSize, DIALOG_SET_GRID dlg( this, &m_UserGridUnit, g_UserUnit, &m_UserGridSize,
&GetScreen()->m_GridOrigin, &m_FastGrid1, &m_FastGrid2, &grid_origin, &m_FastGrid1, &m_FastGrid2,
m_gridSelectBox->GetStrings() ); m_gridSelectBox->GetStrings() );
int ret = dlg.ShowModal(); int ret = dlg.ShowModal();
if( ret == wxID_OK ) if( ret == wxID_OK )
{ {
SetGridOrigin( grid_origin );
GetScreen()->AddGrid( m_UserGridSize, m_UserGridUnit, ID_POPUP_GRID_USER ); GetScreen()->AddGrid( m_UserGridSize, m_UserGridUnit, ID_POPUP_GRID_USER );
// If the user grid is the current option, recall SetGrid() // If the user grid is the current option, recall SetGrid()
......
...@@ -240,7 +240,7 @@ DIMENSION* PCB_EDIT_FRAME::EditDimension( DIMENSION* aDimension, wxDC* aDC ) ...@@ -240,7 +240,7 @@ DIMENSION* PCB_EDIT_FRAME::EditDimension( DIMENSION* aDimension, wxDC* aDC )
if( aDimension == NULL ) if( aDimension == NULL )
{ {
status_dimension = 1; status_dimension = 1;
pos = GetScreen()->GetCrossHairPosition(); pos = GetCrossHairPosition();
aDimension = new DIMENSION( GetBoard() ); aDimension = new DIMENSION( GetBoard() );
aDimension->SetFlags( IS_NEW ); aDimension->SetFlags( IS_NEW );
...@@ -302,7 +302,7 @@ static void BuildDimension( EDA_DRAW_PANEL* aPanel, wxDC* aDC, ...@@ -302,7 +302,7 @@ static void BuildDimension( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
{ {
PCB_SCREEN* screen = (PCB_SCREEN*) aPanel->GetScreen(); PCB_SCREEN* screen = (PCB_SCREEN*) aPanel->GetScreen();
DIMENSION* Dimension = (DIMENSION*) screen->GetCurItem(); DIMENSION* Dimension = (DIMENSION*) screen->GetCurItem();
wxPoint pos = screen->GetCrossHairPosition(); wxPoint pos = aPanel->GetParent()->GetCrossHairPosition();
if( Dimension == NULL ) if( Dimension == NULL )
return; return;
...@@ -386,7 +386,7 @@ void PCB_EDIT_FRAME::BeginMoveDimensionText( DIMENSION* aItem, wxDC* DC ) ...@@ -386,7 +386,7 @@ void PCB_EDIT_FRAME::BeginMoveDimensionText( DIMENSION* aItem, wxDC* DC )
aItem->SetFlags( IS_MOVED ); aItem->SetFlags( IS_MOVED );
SetMsgPanel( aItem ); SetMsgPanel( aItem );
GetScreen()->SetCrossHairPosition( aItem->Text().GetTextPosition() ); SetCrossHairPosition( aItem->Text().GetTextPosition() );
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
m_canvas->SetMouseCapture( MoveDimensionText, AbortMoveDimensionText ); m_canvas->SetMouseCapture( MoveDimensionText, AbortMoveDimensionText );
...@@ -407,7 +407,7 @@ static void MoveDimensionText( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& ...@@ -407,7 +407,7 @@ static void MoveDimensionText( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
if( aErase ) if( aErase )
dimension->Draw( aPanel, aDC, GR_XOR ); dimension->Draw( aPanel, aDC, GR_XOR );
dimension->Text().SetTextPosition( aPanel->GetScreen()->GetCrossHairPosition() ); dimension->Text().SetTextPosition( aPanel->GetParent()->GetCrossHairPosition() );
dimension->Draw( aPanel, aDC, GR_XOR ); dimension->Draw( aPanel, aDC, GR_XOR );
} }
......
...@@ -66,7 +66,7 @@ void FOOTPRINT_EDIT_FRAME::Start_Move_EdgeMod( EDGE_MODULE* aEdge, wxDC* DC ) ...@@ -66,7 +66,7 @@ void FOOTPRINT_EDIT_FRAME::Start_Move_EdgeMod( EDGE_MODULE* aEdge, wxDC* DC )
aEdge->Draw( m_canvas, DC, GR_XOR ); aEdge->Draw( m_canvas, DC, GR_XOR );
aEdge->SetFlags( IS_MOVED ); aEdge->SetFlags( IS_MOVED );
MoveVector.x = MoveVector.y = 0; MoveVector.x = MoveVector.y = 0;
CursorInitialPosition = GetScreen()->GetCrossHairPosition(); CursorInitialPosition = GetCrossHairPosition();
m_canvas->SetMouseCapture( ShowCurrentOutlineWhileMoving, Abort_Move_ModuleOutline ); m_canvas->SetMouseCapture( ShowCurrentOutlineWhileMoving, Abort_Move_ModuleOutline );
SetCurItem( aEdge ); SetCurItem( aEdge );
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
...@@ -115,7 +115,7 @@ static void ShowCurrentOutlineWhileMoving( EDA_DRAW_PANEL* aPanel, wxDC* aDC, ...@@ -115,7 +115,7 @@ static void ShowCurrentOutlineWhileMoving( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
edge->Draw( aPanel, aDC, GR_XOR, MoveVector ); edge->Draw( aPanel, aDC, GR_XOR, MoveVector );
} }
MoveVector = -(screen->GetCrossHairPosition() - CursorInitialPosition); MoveVector = -(aPanel->GetParent()->GetCrossHairPosition() - CursorInitialPosition);
edge->Draw( aPanel, aDC, GR_XOR, MoveVector ); edge->Draw( aPanel, aDC, GR_XOR, MoveVector );
...@@ -142,7 +142,7 @@ static void ShowNewEdgeModule( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& ...@@ -142,7 +142,7 @@ static void ShowNewEdgeModule( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
edge->Draw( aPanel, aDC, GR_XOR ); edge->Draw( aPanel, aDC, GR_XOR );
} }
edge->SetEnd( screen->GetCrossHairPosition() ); edge->SetEnd( aPanel->GetParent()->GetCrossHairPosition() );
// Update relative coordinate. // Update relative coordinate.
edge->SetEnd0( edge->GetEnd() - module->GetPosition() ); edge->SetEnd0( edge->GetEnd() - module->GetPosition() );
...@@ -346,7 +346,7 @@ EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* aEdge, ...@@ -346,7 +346,7 @@ EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* aEdge,
aEdge->SetLayer( SILKSCREEN_N_FRONT ); aEdge->SetLayer( SILKSCREEN_N_FRONT );
// Initialize the starting point of the new segment or arc // Initialize the starting point of the new segment or arc
aEdge->SetStart( GetScreen()->GetCrossHairPosition() ); aEdge->SetStart( GetCrossHairPosition() );
// Initialize the ending point of the new segment or arc // Initialize the ending point of the new segment or arc
aEdge->SetEnd( aEdge->GetStart() ); aEdge->SetEnd( aEdge->GetStart() );
...@@ -383,7 +383,7 @@ EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* aEdge, ...@@ -383,7 +383,7 @@ EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* aEdge,
aEdge->SetFlags( IS_NEW ); aEdge->SetFlags( IS_NEW );
aEdge->SetWidth( GetDesignSettings().m_ModuleSegmentWidth ); aEdge->SetWidth( GetDesignSettings().m_ModuleSegmentWidth );
aEdge->SetStart( GetScreen()->GetCrossHairPosition() ); aEdge->SetStart( GetCrossHairPosition() );
aEdge->SetEnd( aEdge->GetStart() ); aEdge->SetEnd( aEdge->GetStart() );
// Update relative coordinate. // Update relative coordinate.
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
#include <dialog_global_edit_tracks_and_vias.h> #include <dialog_global_edit_tracks_and_vias.h>
/* Handles the selection of command events. */ // Handles the selection of command events.
void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
{ {
int id = event.GetId(); int id = event.GetId();
...@@ -153,7 +153,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -153,7 +153,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
m_canvas->EndMouseCapture(); m_canvas->EndMouseCapture();
} }
/* Should not be executed, just in case */ // Should not be executed, just in case
if( GetScreen()->m_BlockLocate.GetCommand() != BLOCK_IDLE ) if( GetScreen()->m_BlockLocate.GetCommand() != BLOCK_IDLE )
{ {
GetScreen()->m_BlockLocate.SetCommand( BLOCK_IDLE ); GetScreen()->m_BlockLocate.SetCommand( BLOCK_IDLE );
...@@ -544,7 +544,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -544,7 +544,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
{ {
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem(); ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
wxPoint pos = GetScreen()->GetCrossHairPosition(); wxPoint pos = GetCrossHairPosition();
/* add corner between zone_cont->m_CornerSelection /* add corner between zone_cont->m_CornerSelection
* and zone_cont->m_CornerSelection+1 * and zone_cont->m_CornerSelection+1
...@@ -644,12 +644,12 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -644,12 +644,12 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
} }
SendMessageToEESCHEMA( module ); SendMessageToEESCHEMA( module );
GetScreen()->SetCrossHairPosition( module->GetPosition() ); SetCrossHairPosition( module->GetPosition() );
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
StartMoveModule( module, &dc, id == ID_POPUP_PCB_DRAG_MODULE_REQUEST ); StartMoveModule( module, &dc, id == ID_POPUP_PCB_DRAG_MODULE_REQUEST );
break; break;
case ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST: /* get module by name and move it */ case ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST: // get module by name and move it
SetCurItem( GetModuleByName() ); SetCurItem( GetModuleByName() );
module = (MODULE*) GetCurItem(); module = (MODULE*) GetCurItem();
...@@ -658,9 +658,9 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -658,9 +658,9 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
if( module->IsLocked() ) if( module->IsLocked() )
{ {
wxString msg; wxString msg = wxString::Format(
msg.Printf( _( "Footprint %s found, but it is locked" ), _( "Footprint %s found, but it is locked" ),
module->GetReference().GetData() ); module->GetReference().GetData() );
DisplayInfoMessage( this, msg ); DisplayInfoMessage( this, msg );
break; break;
} }
...@@ -719,7 +719,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -719,7 +719,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
} }
/* This is a simple rotation, no other editing in progress */ // This is a simple rotation, no other editing in progress
if( !GetCurItem()->IsMoving() ) if( !GetCurItem()->IsMoving() )
SaveCopyInUndoList( GetCurItem(), UR_ROTATED, ((MODULE*)GetCurItem())->GetPosition() ); SaveCopyInUndoList( GetCurItem(), UR_ROTATED, ((MODULE*)GetCurItem())->GetPosition() );
...@@ -747,7 +747,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -747,7 +747,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
} }
/* This is a simple rotation, no other editing in progress */ // This is a simple rotation, no other editing in progress
if( !GetCurItem()->IsMoving() ) if( !GetCurItem()->IsMoving() )
SaveCopyInUndoList( GetCurItem(), UR_ROTATED_CLOCKWISE, SaveCopyInUndoList( GetCurItem(), UR_ROTATED_CLOCKWISE,
((MODULE*)GetCurItem())->GetPosition() ); ((MODULE*)GetCurItem())->GetPosition() );
...@@ -776,7 +776,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -776,7 +776,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
} }
/* This is a simple flip, no other editing in progress */ // This is a simple flip, no other editing in progress
if( !GetCurItem()->IsMoving() ) if( !GetCurItem()->IsMoving() )
SaveCopyInUndoList( GetCurItem(), UR_FLIPPED, ((MODULE*)GetCurItem())->GetPosition() ); SaveCopyInUndoList( GetCurItem(), UR_FLIPPED, ((MODULE*)GetCurItem())->GetPosition() );
...@@ -1108,14 +1108,18 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -1108,14 +1108,18 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
{ {
TRACK* track = (TRACK*) GetScreen()->GetCurItem(); TRACK* track = (TRACK*) GetScreen()->GetCurItem();
wxPoint pos = GetScreen()->GetCrossHairPosition(); wxPoint pos = GetCrossHairPosition();
track->Draw( m_canvas, &dc, GR_XOR ); track->Draw( m_canvas, &dc, GR_XOR );
PICKED_ITEMS_LIST itemsListPicker; PICKED_ITEMS_LIST itemsListPicker;
TRACK* newtrack = GetBoard()->CreateLockPoint( pos, track, &itemsListPicker ); TRACK* newtrack = GetBoard()->CreateLockPoint( pos, track, &itemsListPicker );
SaveCopyInUndoList( itemsListPicker, UR_UNSPECIFIED ); SaveCopyInUndoList( itemsListPicker, UR_UNSPECIFIED );
track->Draw( m_canvas, &dc, GR_XOR ); track->Draw( m_canvas, &dc, GR_XOR );
newtrack->Draw( m_canvas, &dc, GR_XOR ); newtrack->Draw( m_canvas, &dc, GR_XOR );
/* compute the new ratsnest, because connectivity could change */
// compute the new ratsnest, because connectivity could change
TestNetConnection( &dc, track->GetNet() ); TestNetConnection( &dc, track->GetNet() );
} }
break; break;
......
...@@ -147,7 +147,7 @@ void PCB_EDIT_FRAME::StartMoveTextePcb( TEXTE_PCB* aTextePcb, wxDC* aDC, bool aE ...@@ -147,7 +147,7 @@ void PCB_EDIT_FRAME::StartMoveTextePcb( TEXTE_PCB* aTextePcb, wxDC* aDC, bool aE
m_canvas->Refresh(); m_canvas->Refresh();
#endif #endif
GetScreen()->SetCrossHairPosition( aTextePcb->GetTextPosition() ); SetCrossHairPosition( aTextePcb->GetTextPosition() );
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
m_canvas->SetMouseCapture( Move_Texte_Pcb, Abort_Edit_Pcb_Text ); m_canvas->SetMouseCapture( Move_Texte_Pcb, Abort_Edit_Pcb_Text );
...@@ -156,7 +156,7 @@ void PCB_EDIT_FRAME::StartMoveTextePcb( TEXTE_PCB* aTextePcb, wxDC* aDC, bool aE ...@@ -156,7 +156,7 @@ void PCB_EDIT_FRAME::StartMoveTextePcb( TEXTE_PCB* aTextePcb, wxDC* aDC, bool aE
} }
/* Move PCB text following the cursor. */ // Move PCB text following the cursor.
static void Move_Texte_Pcb( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, static void Move_Texte_Pcb( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase ) bool aErase )
{ {
...@@ -168,7 +168,7 @@ static void Move_Texte_Pcb( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aP ...@@ -168,7 +168,7 @@ static void Move_Texte_Pcb( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aP
if( aErase ) if( aErase )
TextePcb->Draw( aPanel, aDC, GR_XOR ); TextePcb->Draw( aPanel, aDC, GR_XOR );
TextePcb->SetTextPosition( aPanel->GetScreen()->GetCrossHairPosition() ); TextePcb->SetTextPosition( aPanel->GetParent()->GetCrossHairPosition() );
TextePcb->Draw( aPanel, aDC, GR_XOR ); TextePcb->Draw( aPanel, aDC, GR_XOR );
} }
...@@ -214,7 +214,7 @@ TEXTE_PCB* PCB_EDIT_FRAME::CreateTextePcb( wxDC* aDC, TEXTE_PCB* aText ) ...@@ -214,7 +214,7 @@ TEXTE_PCB* PCB_EDIT_FRAME::CreateTextePcb( wxDC* aDC, TEXTE_PCB* aText )
textePcb->SetMirrored( true ); textePcb->SetMirrored( true );
textePcb->SetSize( GetBoard()->GetDesignSettings().m_PcbTextSize ); textePcb->SetSize( GetBoard()->GetDesignSettings().m_PcbTextSize );
textePcb->SetTextPosition( GetScreen()->GetCrossHairPosition() ); textePcb->SetTextPosition( GetCrossHairPosition() );
textePcb->SetThickness( GetBoard()->GetDesignSettings().m_PcbTextWidth ); textePcb->SetThickness( GetBoard()->GetDesignSettings().m_PcbTextWidth );
InstallTextPCBOptionsFrame( textePcb, aDC ); InstallTextPCBOptionsFrame( textePcb, aDC );
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
#include <class_drawsegment.h> #include <class_drawsegment.h>
static void Abort_EditEdge( EDA_DRAW_PANEL* Panel, wxDC* DC ); static void Abort_EditEdge( EDA_DRAW_PANEL* aPanel, wxDC* DC );
static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase ); static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase );
static void Move_Segment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, static void Move_Segment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase ); bool aErase );
...@@ -61,7 +61,7 @@ void PCB_EDIT_FRAME::Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC ) ...@@ -61,7 +61,7 @@ void PCB_EDIT_FRAME::Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC )
drawitem->Draw( m_canvas, DC, GR_XOR ); drawitem->Draw( m_canvas, DC, GR_XOR );
drawitem->SetFlags( IS_MOVED ); drawitem->SetFlags( IS_MOVED );
s_InitialPosition = s_LastPosition = GetScreen()->GetCrossHairPosition(); s_InitialPosition = s_LastPosition = GetCrossHairPosition();
SetMsgPanel( drawitem ); SetMsgPanel( drawitem );
m_canvas->SetMouseCapture( Move_Segment, Abort_EditEdge ); m_canvas->SetMouseCapture( Move_Segment, Abort_EditEdge );
SetCurItem( drawitem ); SetCurItem( drawitem );
...@@ -100,12 +100,12 @@ static void Move_Segment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPos ...@@ -100,12 +100,12 @@ static void Move_Segment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPos
segment->Draw( aPanel, aDC, GR_XOR ); segment->Draw( aPanel, aDC, GR_XOR );
wxPoint delta; wxPoint delta;
delta = aPanel->GetScreen()->GetCrossHairPosition() - s_LastPosition; delta = aPanel->GetParent()->GetCrossHairPosition() - s_LastPosition;
segment->SetStart( segment->GetStart() + delta ); segment->SetStart( segment->GetStart() + delta );
segment->SetEnd( segment->GetEnd() + delta ); segment->SetEnd( segment->GetEnd() + delta );
s_LastPosition = aPanel->GetScreen()->GetCrossHairPosition(); s_LastPosition = aPanel->GetParent()->GetCrossHairPosition();
segment->Draw( aPanel, aDC, GR_XOR ); segment->Draw( aPanel, aDC, GR_XOR );
} }
...@@ -153,17 +153,17 @@ void PCB_EDIT_FRAME::Delete_Drawings_All_Layer( LAYER_NUM aLayer ) ...@@ -153,17 +153,17 @@ void PCB_EDIT_FRAME::Delete_Drawings_All_Layer( LAYER_NUM aLayer )
return; return;
} }
wxString msg; wxString msg = wxString::Format(
msg.Printf( _( "Delete everything on layer %s?" ), _( "Delete everything on layer %s?" ),
GetChars( GetBoard()->GetLayerName( aLayer ) ) ); GetChars( GetBoard()->GetLayerName( aLayer ) ) );
if( !IsOK( this, msg ) ) if( !IsOK( this, msg ) )
return; return;
PICKED_ITEMS_LIST pickList; PICKED_ITEMS_LIST pickList;
ITEM_PICKER picker(NULL, UR_DELETED); ITEM_PICKER picker( NULL, UR_DELETED );
BOARD_ITEM* PtNext;
BOARD_ITEM* PtNext;
for( BOARD_ITEM* item = GetBoard()->m_Drawings; item; item = PtNext ) for( BOARD_ITEM* item = GetBoard()->m_Drawings; item; item = PtNext )
{ {
PtNext = item->Next(); PtNext = item->Next();
...@@ -202,38 +202,38 @@ void PCB_EDIT_FRAME::Delete_Drawings_All_Layer( LAYER_NUM aLayer ) ...@@ -202,38 +202,38 @@ void PCB_EDIT_FRAME::Delete_Drawings_All_Layer( LAYER_NUM aLayer )
} }
static void Abort_EditEdge( EDA_DRAW_PANEL* Panel, wxDC* DC ) static void Abort_EditEdge( EDA_DRAW_PANEL* aPanel, wxDC* DC )
{ {
DRAWSEGMENT* Segment = (DRAWSEGMENT*) Panel->GetScreen()->GetCurItem(); DRAWSEGMENT* Segment = (DRAWSEGMENT*) aPanel->GetScreen()->GetCurItem();
if( Segment == NULL ) if( Segment == NULL )
{ {
Panel->SetMouseCapture( NULL, NULL ); aPanel->SetMouseCapture( NULL, NULL );
return; return;
} }
if( Segment->IsNew() ) if( Segment->IsNew() )
{ {
Panel->CallMouseCapture( DC, wxDefaultPosition, false ); aPanel->CallMouseCapture( DC, wxDefaultPosition, false );
Segment ->DeleteStructure(); Segment ->DeleteStructure();
Segment = NULL; Segment = NULL;
} }
else else
{ {
wxPoint pos = Panel->GetScreen()->GetCrossHairPosition(); wxPoint pos = aPanel->GetParent()->GetCrossHairPosition();
Panel->GetScreen()->SetCrossHairPosition( s_InitialPosition ); aPanel->GetParent()->SetCrossHairPosition( s_InitialPosition );
Panel->CallMouseCapture( DC, wxDefaultPosition, true ); aPanel->CallMouseCapture( DC, wxDefaultPosition, true );
Panel->GetScreen()->SetCrossHairPosition( pos ); aPanel->GetParent()->SetCrossHairPosition( pos );
Segment->ClearFlags(); Segment->ClearFlags();
Segment->Draw( Panel, DC, GR_OR ); Segment->Draw( aPanel, DC, GR_OR );
} }
#ifdef USE_WX_OVERLAY #ifdef USE_WX_OVERLAY
Panel->Refresh(); aPanel->Refresh();
#endif #endif
Panel->SetMouseCapture( NULL, NULL ); aPanel->SetMouseCapture( NULL, NULL );
( (PCB_EDIT_FRAME*) Panel->GetParent() )->SetCurItem( NULL ); ( (PCB_EDIT_FRAME*) aPanel->GetParent() )->SetCurItem( NULL );
} }
...@@ -259,8 +259,8 @@ DRAWSEGMENT* PCB_EDIT_FRAME::Begin_DrawSegment( DRAWSEGMENT* Segment, STROKE_T s ...@@ -259,8 +259,8 @@ DRAWSEGMENT* PCB_EDIT_FRAME::Begin_DrawSegment( DRAWSEGMENT* Segment, STROKE_T s
Segment->SetWidth( s_large ); Segment->SetWidth( s_large );
Segment->SetShape( shape ); Segment->SetShape( shape );
Segment->SetAngle( 900 ); Segment->SetAngle( 900 );
Segment->SetStart( GetScreen()->GetCrossHairPosition() ); Segment->SetStart( GetCrossHairPosition() );
Segment->SetEnd( GetScreen()->GetCrossHairPosition() ); Segment->SetEnd( GetCrossHairPosition() );
m_canvas->SetMouseCapture( DrawSegment, Abort_EditEdge ); m_canvas->SetMouseCapture( DrawSegment, Abort_EditEdge );
} }
else /* The ending point ccordinate Segment->m_End was updated by he function else /* The ending point ccordinate Segment->m_End was updated by he function
...@@ -350,14 +350,14 @@ static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi ...@@ -350,14 +350,14 @@ static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi
{ {
wxPoint pt; wxPoint pt;
CalculateSegmentEndPoint( aPanel->GetScreen()->GetCrossHairPosition(), CalculateSegmentEndPoint( aPanel->GetParent()->GetCrossHairPosition(),
Segment->GetStart().x, Segment->GetStart().y, Segment->GetStart().x, Segment->GetStart().y,
&pt.x, &pt.y ); &pt.x, &pt.y );
Segment->SetEnd( pt ); Segment->SetEnd( pt );
} }
else // here the angle is arbitrary else // here the angle is arbitrary
{ {
Segment->SetEnd( aPanel->GetScreen()->GetCrossHairPosition() ); Segment->SetEnd( aPanel->GetParent()->GetCrossHairPosition() );
} }
Segment->Draw( aPanel, aDC, GR_XOR ); Segment->Draw( aPanel, aDC, GR_XOR );
......
...@@ -101,7 +101,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC ) ...@@ -101,7 +101,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC )
TRACK* TrackOnStartPoint = NULL; TRACK* TrackOnStartPoint = NULL;
LAYER_MSK layerMask = GetLayerMask( GetScreen()->m_Active_Layer ); LAYER_MSK layerMask = GetLayerMask( GetScreen()->m_Active_Layer );
BOARD_CONNECTED_ITEM* LockPoint; BOARD_CONNECTED_ITEM* LockPoint;
wxPoint pos = GetScreen()->GetCrossHairPosition(); wxPoint pos = GetCrossHairPosition();
if( aTrack == NULL ) // Starting a new track segment if( aTrack == NULL ) // Starting a new track segment
{ {
...@@ -595,17 +595,17 @@ TRACK* LocateIntrusion( TRACK* listStart, TRACK* aTrack, LAYER_NUM aLayer, const ...@@ -595,17 +595,17 @@ TRACK* LocateIntrusion( TRACK* listStart, TRACK* aTrack, LAYER_NUM aLayer, const
*/ */
static void PushTrack( EDA_DRAW_PANEL* panel ) static void PushTrack( EDA_DRAW_PANEL* panel )
{ {
PCB_SCREEN* screen = ( (PCB_BASE_FRAME*) (panel->GetParent()) )->GetScreen(); PCB_SCREEN* screen = (PCB_SCREEN*) panel->GetParent()->GetScreen();
BOARD* pcb = ( (PCB_BASE_FRAME*) (panel->GetParent()) )->GetBoard(); BOARD* pcb = ( (PCB_BASE_FRAME*) (panel->GetParent()) )->GetBoard();
wxPoint cursor = screen->GetCrossHairPosition(); wxPoint cursor = panel->GetParent()->GetCrossHairPosition();
wxPoint cv, vec, n; wxPoint cv, vec, n;
TRACK* track = g_CurrentTrackSegment; TRACK* track = g_CurrentTrackSegment;
TRACK* other; TRACK* other;
double det; double det;
int dist; int dist;
double f; double f;
other = LocateIntrusion( pcb->m_Track, track, screen->m_Active_Layer, screen->RefPos( true ) ); other = LocateIntrusion( pcb->m_Track, track, screen->m_Active_Layer, panel->GetParent()->RefPos( true ) );
// are we currently pointing into a conflicting trace ? // are we currently pointing into a conflicting trace ?
if( !other ) if( !other )
...@@ -735,7 +735,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo ...@@ -735,7 +735,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
{ {
if( g_TwoSegmentTrackBuild ) if( g_TwoSegmentTrackBuild )
{ {
g_CurrentTrackSegment->SetEnd( screen->GetCrossHairPosition() ); g_CurrentTrackSegment->SetEnd( frame->GetCrossHairPosition() );
if( g_Drc_On ) if( g_Drc_On )
PushTrack( aPanel ); PushTrack( aPanel );
...@@ -750,7 +750,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo ...@@ -750,7 +750,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
* horizontal, vertical or 45 degrees. * horizontal, vertical or 45 degrees.
*/ */
wxPoint hp = g_CurrentTrackSegment->GetEnd(); wxPoint hp = g_CurrentTrackSegment->GetEnd();
CalculateSegmentEndPoint( screen->GetCrossHairPosition(), CalculateSegmentEndPoint( frame->GetCrossHairPosition(),
g_CurrentTrackSegment->GetStart().x, g_CurrentTrackSegment->GetStart().x,
g_CurrentTrackSegment->GetStart().y, g_CurrentTrackSegment->GetStart().y,
&hp.x, &hp.x,
...@@ -760,7 +760,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo ...@@ -760,7 +760,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
} }
else // Here the angle is arbitrary else // Here the angle is arbitrary
{ {
g_CurrentTrackSegment->SetEnd( screen->GetCrossHairPosition() ); g_CurrentTrackSegment->SetEnd( frame->GetCrossHairPosition() );
} }
// Redraw the new track // Redraw the new track
......
...@@ -68,7 +68,7 @@ TEXTE_MODULE* PCB_BASE_FRAME::CreateTextModule( MODULE* Module, wxDC* DC ) ...@@ -68,7 +68,7 @@ TEXTE_MODULE* PCB_BASE_FRAME::CreateTextModule( MODULE* Module, wxDC* DC )
Text = new TEXTE_MODULE( Module ); Text = new TEXTE_MODULE( Module );
/* Add the new text object to the beginning of the draw item list. */ // Add the new text object to the beginning of the draw item list.
if( Module ) if( Module )
Module->GraphicalItems().PushFront( Text ); Module->GraphicalItems().PushFront( Text );
...@@ -80,7 +80,7 @@ TEXTE_MODULE* PCB_BASE_FRAME::CreateTextModule( MODULE* Module, wxDC* DC ) ...@@ -80,7 +80,7 @@ TEXTE_MODULE* PCB_BASE_FRAME::CreateTextModule( MODULE* Module, wxDC* DC )
std::min( GetDesignSettings().m_ModuleTextSize.x, GetDesignSettings().m_ModuleTextSize.y ), true ); std::min( GetDesignSettings().m_ModuleTextSize.x, GetDesignSettings().m_ModuleTextSize.y ), true );
Text->SetSize( GetDesignSettings().m_ModuleTextSize ); Text->SetSize( GetDesignSettings().m_ModuleTextSize );
Text->SetThickness( GetDesignSettings().m_ModuleTextWidth ); Text->SetThickness( GetDesignSettings().m_ModuleTextWidth );
Text->SetTextPosition( GetScreen()->GetCrossHairPosition() ); Text->SetTextPosition( GetCrossHairPosition() );
Text->SetLocalCoord(); Text->SetLocalCoord();
InstallTextModOptionsFrame( Text, NULL ); InstallTextModOptionsFrame( Text, NULL );
...@@ -175,7 +175,7 @@ static void AbortMoveTextModule( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -175,7 +175,7 @@ static void AbortMoveTextModule( EDA_DRAW_PANEL* Panel, wxDC* DC )
if( Text->IsMoving() ) if( Text->IsMoving() )
Text->SetOrientation( TextInitialOrientation ); Text->SetOrientation( TextInitialOrientation );
/* Redraw the text */ // Redraw the text
Panel->RefreshDrawingRect( Text->GetBoundingBox() ); Panel->RefreshDrawingRect( Text->GetBoundingBox() );
// leave it at (0,0) so we can use it Rotate when not moving. // leave it at (0,0) so we can use it Rotate when not moving.
...@@ -208,7 +208,7 @@ void PCB_BASE_FRAME::StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC ) ...@@ -208,7 +208,7 @@ void PCB_BASE_FRAME::StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC )
TextInitialOrientation = Text->GetOrientation(); TextInitialOrientation = Text->GetOrientation();
// Center cursor on initial position of text // Center cursor on initial position of text
GetScreen()->SetCrossHairPosition( TextInitialPosition ); SetCrossHairPosition( TextInitialPosition );
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
SetMsgPanel( Text ); SetMsgPanel( Text );
...@@ -227,7 +227,7 @@ void PCB_BASE_FRAME::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC ) ...@@ -227,7 +227,7 @@ void PCB_BASE_FRAME::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC )
m_canvas->RefreshDrawingRect( Text->GetBoundingBox() ); m_canvas->RefreshDrawingRect( Text->GetBoundingBox() );
Text->DrawUmbilical( m_canvas, DC, GR_XOR, -MoveVector ); Text->DrawUmbilical( m_canvas, DC, GR_XOR, -MoveVector );
/* Update the coordinates for anchor. */ // Update the coordinates for anchor.
MODULE* Module = (MODULE*) Text->GetParent(); MODULE* Module = (MODULE*) Text->GetParent();
if( Module ) if( Module )
...@@ -244,7 +244,7 @@ void PCB_BASE_FRAME::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC ) ...@@ -244,7 +244,7 @@ void PCB_BASE_FRAME::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC )
Text->SetOrientation( tmp ); Text->SetOrientation( tmp );
// Set the new position for text. // Set the new position for text.
Text->SetTextPosition( GetScreen()->GetCrossHairPosition() ); Text->SetTextPosition( GetCrossHairPosition() );
wxPoint textRelPos = Text->GetTextPosition() - Module->GetPosition(); wxPoint textRelPos = Text->GetTextPosition() - Module->GetPosition();
RotatePoint( &textRelPos, -Module->GetOrientation() ); RotatePoint( &textRelPos, -Module->GetOrientation() );
Text->SetPos0( textRelPos ); Text->SetPos0( textRelPos );
...@@ -253,12 +253,12 @@ void PCB_BASE_FRAME::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC ) ...@@ -253,12 +253,12 @@ void PCB_BASE_FRAME::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC )
Module->SetLastEditTime(); Module->SetLastEditTime();
OnModify(); OnModify();
/* Redraw text. */ // Redraw text.
m_canvas->RefreshDrawingRect( Text->GetBoundingBox() ); m_canvas->RefreshDrawingRect( Text->GetBoundingBox() );
} }
else else
{ {
Text->SetTextPosition( GetScreen()->GetCrossHairPosition() ); Text->SetTextPosition( GetCrossHairPosition() );
} }
} }
...@@ -285,7 +285,7 @@ static void Show_MoveTexte_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo ...@@ -285,7 +285,7 @@ static void Show_MoveTexte_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
Text->Draw( aPanel, aDC, GR_XOR, MoveVector ); Text->Draw( aPanel, aDC, GR_XOR, MoveVector );
} }
MoveVector = TextInitialPosition - screen->GetCrossHairPosition(); MoveVector = TextInitialPosition - aPanel->GetParent()->GetCrossHairPosition();
// Draw umbilical if text moved // Draw umbilical if text moved
if( MoveVector.x || MoveVector.y ) if( MoveVector.x || MoveVector.y )
......
...@@ -146,8 +146,8 @@ void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& aEvent ) ...@@ -146,8 +146,8 @@ void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& aEvent )
GetBoard()->ComputeBoundingBox(); GetBoard()->ComputeBoundingBox();
// Save the auxiliary origin for the rest of the module // Save the auxiliary origin for the rest of the module
GencadOffsetX = GetOriginAxisPosition().x; GencadOffsetX = GetAuxOrigin().x;
GencadOffsetY = GetOriginAxisPosition().y; GencadOffsetY = GetAuxOrigin().y;
// No idea on *why* this should be needed... maybe to fix net names? // No idea on *why* this should be needed... maybe to fix net names?
Compile_Ratsnest( NULL, true ); Compile_Ratsnest( NULL, true );
...@@ -708,8 +708,8 @@ static bool CreateHeaderInfoData( FILE* aFile, PCB_EDIT_FRAME* aFrame ) ...@@ -708,8 +708,8 @@ static bool CreateHeaderInfoData( FILE* aFile, PCB_EDIT_FRAME* aFrame )
fputs( "UNITS INCH\n", aFile ); fputs( "UNITS INCH\n", aFile );
msg.Printf( wxT( "ORIGIN %g %g\n" ), msg.Printf( wxT( "ORIGIN %g %g\n" ),
MapXTo( aFrame->GetOriginAxisPosition().x ), MapXTo( aFrame->GetAuxOrigin().x ),
MapYTo( aFrame->GetOriginAxisPosition().y ) ); MapYTo( aFrame->GetAuxOrigin().y ) );
fputs( TO_UTF8( msg ), aFile ); fputs( TO_UTF8( msg ), aFile );
fputs( "INTERTRACK 0\n", aFile ); fputs( "INTERTRACK 0\n", aFile );
......
...@@ -53,16 +53,16 @@ ...@@ -53,16 +53,16 @@
BEGIN_EVENT_TABLE( FOOTPRINT_WIZARD_FRAME, EDA_DRAW_FRAME ) BEGIN_EVENT_TABLE( FOOTPRINT_WIZARD_FRAME, EDA_DRAW_FRAME )
/* Window events */ // Window events
EVT_CLOSE( FOOTPRINT_WIZARD_FRAME::OnCloseWindow ) EVT_CLOSE( FOOTPRINT_WIZARD_FRAME::OnCloseWindow )
EVT_SIZE( FOOTPRINT_WIZARD_FRAME::OnSize ) EVT_SIZE( FOOTPRINT_WIZARD_FRAME::OnSize )
EVT_ACTIVATE( FOOTPRINT_WIZARD_FRAME::OnActivate ) EVT_ACTIVATE( FOOTPRINT_WIZARD_FRAME::OnActivate )
/* Sash drag events */ // Sash drag events
EVT_SASH_DRAGGED( ID_FOOTPRINT_WIZARD_PAGES, FOOTPRINT_WIZARD_FRAME::OnSashDrag ) EVT_SASH_DRAGGED( ID_FOOTPRINT_WIZARD_PAGES, FOOTPRINT_WIZARD_FRAME::OnSashDrag )
EVT_SASH_DRAGGED( ID_FOOTPRINT_WIZARD_PARAMETERS, FOOTPRINT_WIZARD_FRAME::OnSashDrag ) EVT_SASH_DRAGGED( ID_FOOTPRINT_WIZARD_PARAMETERS, FOOTPRINT_WIZARD_FRAME::OnSashDrag )
/* Toolbar events */ // Toolbar events
EVT_TOOL( ID_FOOTPRINT_WIZARD_SELECT_WIZARD, EVT_TOOL( ID_FOOTPRINT_WIZARD_SELECT_WIZARD,
FOOTPRINT_WIZARD_FRAME::SelectCurrentWizard ) FOOTPRINT_WIZARD_FRAME::SelectCurrentWizard )
...@@ -78,7 +78,7 @@ EVT_TOOL( ID_FOOTPRINT_WIZARD_DONE, ...@@ -78,7 +78,7 @@ EVT_TOOL( ID_FOOTPRINT_WIZARD_DONE,
EVT_TOOL( ID_FOOTPRINT_WIZARD_SHOW_3D_VIEW, EVT_TOOL( ID_FOOTPRINT_WIZARD_SHOW_3D_VIEW,
FOOTPRINT_WIZARD_FRAME::Show3D_Frame ) FOOTPRINT_WIZARD_FRAME::Show3D_Frame )
/* listbox events */ // listbox events
EVT_LISTBOX( ID_FOOTPRINT_WIZARD_PAGE_LIST, FOOTPRINT_WIZARD_FRAME::ClickOnPageList ) EVT_LISTBOX( ID_FOOTPRINT_WIZARD_PAGE_LIST, FOOTPRINT_WIZARD_FRAME::ClickOnPageList )
EVT_GRID_CMD_CELL_CHANGE( ID_FOOTPRINT_WIZARD_PARAMETER_LIST, EVT_GRID_CMD_CELL_CHANGE( ID_FOOTPRINT_WIZARD_PARAMETER_LIST,
FOOTPRINT_WIZARD_FRAME::ParametersUpdated ) FOOTPRINT_WIZARD_FRAME::ParametersUpdated )
...@@ -374,7 +374,7 @@ void FOOTPRINT_WIZARD_FRAME::OnSize( wxSizeEvent& SizeEv ) ...@@ -374,7 +374,7 @@ void FOOTPRINT_WIZARD_FRAME::OnSize( wxSizeEvent& SizeEv )
*/ */
void FOOTPRINT_WIZARD_FRAME::OnSetRelativeOffset( wxCommandEvent& event ) void FOOTPRINT_WIZARD_FRAME::OnSetRelativeOffset( wxCommandEvent& event )
{ {
GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition(); GetScreen()->m_O_Curseur = GetCrossHairPosition();
UpdateStatusBar(); UpdateStatusBar();
} }
...@@ -587,8 +587,8 @@ void FOOTPRINT_WIZARD_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition ...@@ -587,8 +587,8 @@ void FOOTPRINT_WIZARD_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition
cmd.SetEventObject( this ); cmd.SetEventObject( this );
pos = screen->GetNearestGridPosition( pos ); pos = GetNearestGridPosition( pos );
oldpos = screen->GetCrossHairPosition(); oldpos = GetCrossHairPosition();
gridSize = screen->GetGridSize(); gridSize = screen->GetGridSize();
switch( aHotKey ) switch( aHotKey )
...@@ -619,42 +619,42 @@ void FOOTPRINT_WIZARD_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition ...@@ -619,42 +619,42 @@ void FOOTPRINT_WIZARD_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition
break; break;
case ' ': case ' ':
screen->m_O_Curseur = screen->GetCrossHairPosition(); screen->m_O_Curseur = GetCrossHairPosition();
break; break;
case WXK_NUMPAD8: /* cursor moved up */ case WXK_NUMPAD8: // cursor moved up
case WXK_UP: case WXK_UP:
pos.y -= KiROUND( gridSize.y ); pos.y -= KiROUND( gridSize.y );
m_canvas->MoveCursor( pos ); m_canvas->MoveCursor( pos );
break; break;
case WXK_NUMPAD2: /* cursor moved down */ case WXK_NUMPAD2: // cursor moved down
case WXK_DOWN: case WXK_DOWN:
pos.y += KiROUND( gridSize.y ); pos.y += KiROUND( gridSize.y );
m_canvas->MoveCursor( pos ); m_canvas->MoveCursor( pos );
break; break;
case WXK_NUMPAD4: /* cursor moved left */ case WXK_NUMPAD4: // cursor moved left
case WXK_LEFT: case WXK_LEFT:
pos.x -= KiROUND( gridSize.x ); pos.x -= KiROUND( gridSize.x );
m_canvas->MoveCursor( pos ); m_canvas->MoveCursor( pos );
break; break;
case WXK_NUMPAD6: /* cursor moved right */ case WXK_NUMPAD6: // cursor moved right
case WXK_RIGHT: case WXK_RIGHT:
pos.x += KiROUND( gridSize.x ); pos.x += KiROUND( gridSize.x );
m_canvas->MoveCursor( pos ); m_canvas->MoveCursor( pos );
break; break;
} }
screen->SetCrossHairPosition( pos ); SetCrossHairPosition( pos );
if( oldpos != screen->GetCrossHairPosition() ) if( oldpos != GetCrossHairPosition() )
{ {
pos = screen->GetCrossHairPosition(); pos = GetCrossHairPosition();
screen->SetCrossHairPosition( oldpos ); SetCrossHairPosition( oldpos );
m_canvas->CrossHairOff( aDC ); m_canvas->CrossHairOff( aDC );
screen->SetCrossHairPosition( pos ); SetCrossHairPosition( pos );
m_canvas->CrossHairOn( aDC ); m_canvas->CrossHairOn( aDC );
if( m_canvas->IsMouseCaptured() ) if( m_canvas->IsMouseCaptured() )
...@@ -663,7 +663,7 @@ void FOOTPRINT_WIZARD_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition ...@@ -663,7 +663,7 @@ void FOOTPRINT_WIZARD_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition
} }
} }
UpdateStatusBar(); /* Display new cursor coordinates */ UpdateStatusBar(); // Display new cursor coordinates
} }
......
...@@ -359,7 +359,7 @@ int PCB_EDIT_FRAME::DoGenFootprintsPositionFile( const wxString& aFullFileName, ...@@ -359,7 +359,7 @@ int PCB_EDIT_FRAME::DoGenFootprintsPositionFile( const wxString& aFullFileName,
MODULE* module; MODULE* module;
char line[1024]; char line[1024];
File_Place_Offset = GetOriginAxisPosition(); File_Place_Offset = GetAuxOrigin();
// Calculating the number of useful modules (CMS attribute, not VIRTUAL) // Calculating the number of useful modules (CMS attribute, not VIRTUAL)
int moduleCount = 0; int moduleCount = 0;
......
...@@ -133,7 +133,7 @@ int PCB_EDIT_FRAME::SelectHighLight( wxDC* DC ) ...@@ -133,7 +133,7 @@ int PCB_EDIT_FRAME::SelectHighLight( wxDC* DC )
// optionally, modify the "guide" here as needed using its member functions // optionally, modify the "guide" here as needed using its member functions
m_Collector->Collect( GetBoard(), GENERAL_COLLECTOR::PadsTracksOrZones, m_Collector->Collect( GetBoard(), GENERAL_COLLECTOR::PadsTracksOrZones,
GetScreen()->RefPos( true ), guide ); RefPos( true ), guide );
BOARD_ITEM* item = (*m_Collector)[0]; BOARD_ITEM* item = (*m_Collector)[0];
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
* This can be useful if the new function cannot be executed while an item is currently * This can be useful if the new function cannot be executed while an item is currently
* being edited ( For example, one cannot start a new wire when a component is moving.) * being edited ( For example, one cannot start a new wire when a component is moving.)
* *
* Note: If an hotkey is a special key, be sure the corresponding wxWidget keycode (WXK_XXXX) * Note: If a hotkey is a special key, be sure the corresponding wxWidget keycode (WXK_XXXX)
* is handled in the hotkey_name_descr s_Hotkey_Name_List list (see hotkeys_basic.cpp) * is handled in the hotkey_name_descr s_Hotkey_Name_List list (see hotkeys_basic.cpp)
* and see this list for some ascii keys (space ...) * and see this list for some ascii keys (space ...)
*/ */
...@@ -60,10 +60,8 @@ static EDA_HOTKEY HkFindItem( wxT( "Find Item" ), HK_FIND_ITEM, 'F' + GR_KB_CTRL ...@@ -60,10 +60,8 @@ static EDA_HOTKEY HkFindItem( wxT( "Find Item" ), HK_FIND_ITEM, 'F' + GR_KB_CTRL
static EDA_HOTKEY HkBackspace( wxT( "Delete track segment" ), HK_BACK_SPACE, WXK_BACK ); static EDA_HOTKEY HkBackspace( wxT( "Delete track segment" ), HK_BACK_SPACE, WXK_BACK );
static EDA_HOTKEY HkAddNewTrack( wxT( "Add new track" ), HK_ADD_NEW_TRACK, 'X' ); static EDA_HOTKEY HkAddNewTrack( wxT( "Add new track" ), HK_ADD_NEW_TRACK, 'X' );
static EDA_HOTKEY HkAddVia( wxT( "Add Via" ), HK_ADD_VIA, 'V' ); static EDA_HOTKEY HkAddVia( wxT( "Add Via" ), HK_ADD_VIA, 'V' );
static EDA_HOTKEY HkSwitchTrackPosture( wxT( "Switch Track Posture" ), static EDA_HOTKEY HkSwitchTrackPosture( wxT( "Switch Track Posture" ), HK_SWITCH_TRACK_POSTURE, '/' );
HK_SWITCH_TRACK_POSTURE, '/' ); static EDA_HOTKEY HkDragTrackKeepSlope( wxT( "Drag track keep slope" ), HK_DRAG_TRACK_KEEP_SLOPE, 'D' );
static EDA_HOTKEY HkDragTrackKeepSlope( wxT( "Drag track keep slope" ),
HK_DRAG_TRACK_KEEP_SLOPE, 'D' );
static EDA_HOTKEY HkPlaceItem( wxT( "Place Item" ), HK_PLACE_ITEM, 'P' ); static EDA_HOTKEY HkPlaceItem( wxT( "Place Item" ), HK_PLACE_ITEM, 'P' );
static EDA_HOTKEY HkAddMicroVia( wxT( "Add MicroVia" ), HK_ADD_MICROVIA, 'V' + GR_KB_CTRL ); static EDA_HOTKEY HkAddMicroVia( wxT( "Add MicroVia" ), HK_ADD_MICROVIA, 'V' + GR_KB_CTRL );
static EDA_HOTKEY HkEndTrack( wxT( "End Track" ), HK_END_TRACK, WXK_END ); static EDA_HOTKEY HkEndTrack( wxT( "End Track" ), HK_END_TRACK, WXK_END );
...@@ -73,15 +71,14 @@ static EDA_HOTKEY HkRotateItem( wxT( "Rotate Item" ), HK_ROTATE_ITEM, 'R' ); ...@@ -73,15 +71,14 @@ static EDA_HOTKEY HkRotateItem( wxT( "Rotate Item" ), HK_ROTATE_ITEM, 'R' );
static EDA_HOTKEY HkMoveItem( wxT( "Move Item" ), HK_MOVE_ITEM, 'M' ); static EDA_HOTKEY HkMoveItem( wxT( "Move Item" ), HK_MOVE_ITEM, 'M' );
static EDA_HOTKEY HkCopyItem( wxT( "Copy Item" ), HK_COPY_ITEM, 'C' ); static EDA_HOTKEY HkCopyItem( wxT( "Copy Item" ), HK_COPY_ITEM, 'C' );
static EDA_HOTKEY HkDragFootprint( wxT( "Drag Footprint" ), HK_DRAG_ITEM, 'G' ); static EDA_HOTKEY HkDragFootprint( wxT( "Drag Footprint" ), HK_DRAG_ITEM, 'G' );
static EDA_HOTKEY HkGetAndMoveFootprint( wxT( "Get and Move Footprint" ), static EDA_HOTKEY HkGetAndMoveFootprint( wxT( "Get and Move Footprint" ), HK_GET_AND_MOVE_FOOTPRINT, 'T' );
HK_GET_AND_MOVE_FOOTPRINT, 'T' ); static EDA_HOTKEY HkLock_Unlock_Footprint( wxT( "Lock/Unlock Footprint" ), HK_LOCK_UNLOCK_FOOTPRINT, 'L' );
static EDA_HOTKEY HkLock_Unlock_Footprint( wxT( "Lock/Unlock Footprint" ),
HK_LOCK_UNLOCK_FOOTPRINT, 'L' );
static EDA_HOTKEY HkDelete( wxT( "Delete Track or Footprint" ), HK_DELETE, WXK_DELETE ); static EDA_HOTKEY HkDelete( wxT( "Delete Track or Footprint" ), HK_DELETE, WXK_DELETE );
static EDA_HOTKEY HkResetLocalCoord( wxT( "Reset Local Coordinates" ), static EDA_HOTKEY HkResetLocalCoord( wxT( "Reset Local Coordinates" ), HK_RESET_LOCAL_COORD, ' ' );
HK_RESET_LOCAL_COORD, ' ' ); static EDA_HOTKEY HkSwitchHighContrastMode( wxT("Switch Highcontrast mode"), HK_SWITCH_HIGHCONTRAST_MODE,'H');
static EDA_HOTKEY HkSwitchHighContrastMode( wxT("Switch Highcontrast mode"),
HK_SWITCH_HIGHCONTRAST_MODE,'H'); static EDA_HOTKEY HkSetGridOrigin( wxT("Set Grid Origin"), HK_SET_GRID_ORIGIN, 'S' );
/* Fit on Screen */ /* Fit on Screen */
#if !defined( __WXMAC__ ) #if !defined( __WXMAC__ )
static EDA_HOTKEY HkZoomAuto( wxT( "Zoom Auto" ), HK_ZOOM_AUTO, WXK_HOME ); static EDA_HOTKEY HkZoomAuto( wxT( "Zoom Auto" ), HK_ZOOM_AUTO, WXK_HOME );
...@@ -198,7 +195,7 @@ EDA_HOTKEY* common_Hotkey_List[] = ...@@ -198,7 +195,7 @@ EDA_HOTKEY* common_Hotkey_List[] =
{ {
&HkHelp, &HkZoomIn, &HkZoomOut, &HkHelp, &HkZoomIn, &HkZoomOut,
&HkZoomRedraw, &HkZoomCenter, &HkZoomAuto, &HkZoomRedraw, &HkZoomCenter, &HkZoomAuto,
&HkSwitchUnits, &HkResetLocalCoord, &HkSwitchUnits, &HkResetLocalCoord, &HkSetGridOrigin,
&HkUndo, &HkRedo, &HkUndo, &HkRedo,
NULL NULL
}; };
......
...@@ -30,7 +30,7 @@ void PCB_EDIT_FRAME::RecordMacros(wxDC* aDC, int aNumber) ...@@ -30,7 +30,7 @@ void PCB_EDIT_FRAME::RecordMacros(wxDC* aDC, int aNumber)
if( m_RecordingMacros < 0 ) if( m_RecordingMacros < 0 )
{ {
m_RecordingMacros = aNumber; m_RecordingMacros = aNumber;
m_Macros[aNumber].m_StartPosition = GetScreen()->GetCrossHairPosition( false ); m_Macros[aNumber].m_StartPosition = GetCrossHairPosition( false );
m_Macros[aNumber].m_Record.clear(); m_Macros[aNumber].m_Record.clear();
msg.Printf( _( "Recording macro %d" ), aNumber ); msg.Printf( _( "Recording macro %d" ), aNumber );
...@@ -48,7 +48,6 @@ void PCB_EDIT_FRAME::RecordMacros(wxDC* aDC, int aNumber) ...@@ -48,7 +48,6 @@ void PCB_EDIT_FRAME::RecordMacros(wxDC* aDC, int aNumber)
void PCB_EDIT_FRAME::CallMacros( wxDC* aDC, const wxPoint& aPosition, int aNumber ) void PCB_EDIT_FRAME::CallMacros( wxDC* aDC, const wxPoint& aPosition, int aNumber )
{ {
PCB_SCREEN* screen = GetScreen();
wxPoint tPosition; wxPoint tPosition;
wxString msg; wxString msg;
...@@ -59,19 +58,19 @@ void PCB_EDIT_FRAME::CallMacros( wxDC* aDC, const wxPoint& aPosition, int aNumbe ...@@ -59,19 +58,19 @@ void PCB_EDIT_FRAME::CallMacros( wxDC* aDC, const wxPoint& aPosition, int aNumbe
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this ); cmd.SetEventObject( this );
tPosition = screen->GetNearestGridPosition( aPosition ); tPosition = GetNearestGridPosition( aPosition );
m_canvas->CrossHairOff( aDC ); m_canvas->CrossHairOff( aDC );
screen->SetMousePosition( tPosition ); SetMousePosition( tPosition );
GeneralControl( aDC, tPosition ); GeneralControl( aDC, tPosition );
for( std::list<MACROS_RECORD>::iterator i = m_Macros[aNumber].m_Record.begin(); for( std::list<MACROS_RECORD>::iterator i = m_Macros[aNumber].m_Record.begin();
i != m_Macros[aNumber].m_Record.end(); i != m_Macros[aNumber].m_Record.end();
i++ ) i++ )
{ {
wxPoint tmpPos = screen->GetNearestGridPosition( tPosition + i->m_Position ); wxPoint tmpPos = GetNearestGridPosition( tPosition + i->m_Position );
screen->SetMousePosition( tmpPos ); SetMousePosition( tmpPos );
GeneralControl( aDC, tmpPos, i->m_HotkeyCode ); GeneralControl( aDC, tmpPos, i->m_HotkeyCode );
} }
...@@ -117,8 +116,8 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit ...@@ -117,8 +116,8 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
MACROS_RECORD macros_record; MACROS_RECORD macros_record;
macros_record.m_HotkeyCode = aHotkeyCode; macros_record.m_HotkeyCode = aHotkeyCode;
macros_record.m_Idcommand = HK_Descr->m_Idcommand; macros_record.m_Idcommand = HK_Descr->m_Idcommand;
macros_record.m_Position = screen->GetNearestGridPosition( aPosition ) - macros_record.m_Position = GetNearestGridPosition( aPosition ) -
m_Macros[m_RecordingMacros].m_StartPosition; m_Macros[m_RecordingMacros].m_StartPosition;
m_Macros[m_RecordingMacros].m_Record.push_back( macros_record ); m_Macros[m_RecordingMacros].m_Record.push_back( macros_record );
wxString msg; wxString msg;
msg.Printf( _( "Add key [%c] in macro %d" ), aHotkeyCode, m_RecordingMacros ); msg.Printf( _( "Add key [%c] in macro %d" ), aHotkeyCode, m_RecordingMacros );
...@@ -162,8 +161,7 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit ...@@ -162,8 +161,7 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
case HK_CALL_MACROS_7: case HK_CALL_MACROS_7:
case HK_CALL_MACROS_8: case HK_CALL_MACROS_8:
case HK_CALL_MACROS_9: case HK_CALL_MACROS_9:
CallMacros( aDC, screen->GetCrossHairPosition( false ), CallMacros( aDC, GetCrossHairPosition( false ), hk_id - HK_CALL_MACROS_0 );
hk_id - HK_CALL_MACROS_0 );
break; break;
case HK_SWITCH_TRACK_WIDTH_TO_NEXT: case HK_SWITCH_TRACK_WIDTH_TO_NEXT:
...@@ -222,7 +220,6 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit ...@@ -222,7 +220,6 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
cmd.SetEventType( wxEVT_COMMAND_COMBOBOX_SELECTED ); cmd.SetEventType( wxEVT_COMMAND_COMBOBOX_SELECTED );
OnSelectGrid( cmd ); OnSelectGrid( cmd );
} }
break; break;
case HK_SWITCH_GRID_TO_PREVIOUS: case HK_SWITCH_GRID_TO_PREVIOUS:
...@@ -344,8 +341,14 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit ...@@ -344,8 +341,14 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
break; break;
case HK_RESET_LOCAL_COORD: /*Reset the relative coord */ case HK_RESET_LOCAL_COORD: // Set the relative coord
GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition(); GetScreen()->m_O_Curseur = GetCrossHairPosition();
break;
case HK_SET_GRID_ORIGIN:
SetGridOrigin( GetCrossHairPosition() );
OnModify(); // because grid origin is saved in board, show as modified
m_canvas->Refresh();
break; break;
case HK_SWITCH_UNITS: case HK_SWITCH_UNITS:
...@@ -498,7 +501,7 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit ...@@ -498,7 +501,7 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
// get any module, locked or not locked and toggle its locked status // get any module, locked or not locked and toggle its locked status
if( !itemCurrentlyEdited ) if( !itemCurrentlyEdited )
{ {
wxPoint pos = screen->RefPos( true ); wxPoint pos = RefPos( true );
module = GetBoard()->GetFootprint( pos, screen->m_Active_Layer, true ); module = GetBoard()->GetFootprint( pos, screen->m_Active_Layer, true );
} }
else if( GetCurItem()->Type() == PCB_MODULE_T ) else if( GetCurItem()->Type() == PCB_MODULE_T )
...@@ -513,7 +516,6 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit ...@@ -513,7 +516,6 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
OnModify(); OnModify();
SetMsgPanel( module ); SetMsgPanel( module );
} }
break; break;
case HK_DRAG_ITEM: // Start drag module or track segment case HK_DRAG_ITEM: // Start drag module or track segment
...@@ -586,7 +588,7 @@ bool PCB_EDIT_FRAME::OnHotkeyDeleteItem( wxDC* aDC ) ...@@ -586,7 +588,7 @@ bool PCB_EDIT_FRAME::OnHotkeyDeleteItem( wxDC* aDC )
case ID_PCB_MODULE_BUTT: case ID_PCB_MODULE_BUTT:
if( ItemFree ) if( ItemFree )
{ {
wxPoint pos = GetScreen()->RefPos( false ); wxPoint pos = RefPos( false );
MODULE* module = GetBoard()->GetFootprint( pos, UNDEFINED_LAYER, false ); MODULE* module = GetBoard()->GetFootprint( pos, UNDEFINED_LAYER, false );
if( module == NULL ) if( module == NULL )
......
...@@ -51,12 +51,17 @@ void FOOTPRINT_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPos ...@@ -51,12 +51,17 @@ void FOOTPRINT_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPos
return; return;
break; break;
case HK_HELP: // Display Current hotkey list case HK_HELP: // Display Current hotkey list
DisplayHotkeyList( this, g_Module_Editor_Hokeys_Descr ); DisplayHotkeyList( this, g_Module_Editor_Hokeys_Descr );
break; break;
case HK_RESET_LOCAL_COORD: /*Reset the relative coord */ case HK_RESET_LOCAL_COORD: // set local (relative) coordinate origin
GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition(); GetScreen()->m_O_Curseur = GetCrossHairPosition();
break;
case HK_SET_GRID_ORIGIN:
SetGridOrigin( GetCrossHairPosition() );
m_canvas->Refresh();
break; break;
case HK_SWITCH_UNITS: case HK_SWITCH_UNITS:
......
...@@ -557,8 +557,12 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const ...@@ -557,8 +557,12 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const
Double2Str( aBoard->GetDesignSettings().m_SolderPasteMarginRatio ).c_str() ); Double2Str( aBoard->GetDesignSettings().m_SolderPasteMarginRatio ).c_str() );
m_out->Print( aNestLevel+1, "(aux_axis_origin %s %s)\n", m_out->Print( aNestLevel+1, "(aux_axis_origin %s %s)\n",
FMTIU( aBoard->GetOriginAxisPosition().x ).c_str(), FMTIU( aBoard->GetAuxOrigin().x ).c_str(),
FMTIU( aBoard->GetOriginAxisPosition().y ).c_str() ); FMTIU( aBoard->GetAuxOrigin().y ).c_str() );
m_out->Print( aNestLevel+1, "(grid_origin %s %s)\n",
FMTIU( aBoard->GetGridOrigin().x ).c_str(),
FMTIU( aBoard->GetGridOrigin().y ).c_str() );
m_out->Print( aNestLevel+1, "(visible_elements %X)\n", m_out->Print( aNestLevel+1, "(visible_elements %X)\n",
aBoard->GetDesignSettings().GetVisibleElements() ); aBoard->GetDesignSettings().GetVisibleElements() );
......
...@@ -649,7 +649,8 @@ void LEGACY_PLUGIN::loadSETUP() ...@@ -649,7 +649,8 @@ void LEGACY_PLUGIN::loadSETUP()
BIU gx = biuParse( line + SZ( "AuxiliaryAxisOrg" ), &data ); BIU gx = biuParse( line + SZ( "AuxiliaryAxisOrg" ), &data );
BIU gy = biuParse( data ); BIU gy = biuParse( data );
m_board->SetOriginAxisPosition( wxPoint( gx, gy ) ); // m_board->SetAuxOrigin( wxPoint( gx, gy ) ); gets overwritten by SetDesignSettings() below
bds.m_AuxOrigin = wxPoint( gx, gy );
} }
else if( TESTLINE( "Layers" ) ) else if( TESTLINE( "Layers" ) )
...@@ -851,13 +852,11 @@ void LEGACY_PLUGIN::loadSETUP() ...@@ -851,13 +852,11 @@ void LEGACY_PLUGIN::loadSETUP()
else if( TESTLINE( "GridOrigin" ) ) else if( TESTLINE( "GridOrigin" ) )
{ {
/* @todo BIU x = biuParse( line + SZ( "GridOrigin" ), &data );
BIU gx = biuParse( line + SZ( "GridOrigin" ), &data ); BIU y = biuParse( data );
BIU gy = biuParse( data );
GetScreen()->m_GridOrigin.x = Ox; // m_board->SetGridOrigin( wxPoint( x, y ) ); gets overwritten by SetDesignSettings() below
GetScreen()->m_GridOrigin.y = Oy; bds.m_GridOrigin = wxPoint( x, y );
*/
} }
else if( TESTLINE( "VisibleElements" ) ) else if( TESTLINE( "VisibleElements" ) )
...@@ -3071,14 +3070,8 @@ void LEGACY_PLUGIN::saveSETUP( const BOARD* aBoard ) const ...@@ -3071,14 +3070,8 @@ void LEGACY_PLUGIN::saveSETUP( const BOARD* aBoard ) const
if( bds.m_SolderPasteMarginRatio != 0 ) if( bds.m_SolderPasteMarginRatio != 0 )
fprintf( m_fp, "Pad2PasteClearanceRatio %g\n", bds.m_SolderPasteMarginRatio ); fprintf( m_fp, "Pad2PasteClearanceRatio %g\n", bds.m_SolderPasteMarginRatio );
/* @todo no aFrame fprintf( m_fp, "GridOrigin %s\n", fmtBIUPoint( aBoard->GetGridOrigin() ).c_str() );
if ( aFrame->GetScreen()->m_GridOrigin != wxPoint( 0, 0 ) ) fprintf( m_fp, "AuxiliaryAxisOrg %s\n", fmtBIUPoint( aBoard->GetAuxOrigin() ).c_str() );
{
fprintf( m_fp, "GridOrigin %s\n", fmtBIUPoint( aFrame->GetScreen()->m_GridOrigin ).c_str() );
}
*/
fprintf( m_fp, "AuxiliaryAxisOrg %s\n", fmtBIUPoint( aBoard->GetOriginAxisPosition() ).c_str() );
fprintf( m_fp, "VisibleElements %X\n", bds.GetVisibleElements() ); fprintf( m_fp, "VisibleElements %X\n", bds.GetVisibleElements() );
......
...@@ -725,7 +725,7 @@ MODULE* PCB_BASE_FRAME::Create_1_Module( const wxString& aModuleName ) ...@@ -725,7 +725,7 @@ MODULE* PCB_BASE_FRAME::Create_1_Module( const wxString& aModuleName )
GetBoard()->Add( module ); GetBoard()->Add( module );
// Update parameters: position, timestamp ... // Update parameters: position, timestamp ...
newpos = GetScreen()->GetCrossHairPosition(); newpos = GetCrossHairPosition();
module->SetPosition( newpos ); module->SetPosition( newpos );
module->SetLastEditTime(); module->SetLastEditTime();
......
...@@ -93,7 +93,7 @@ bool FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD( MODULE* aModule ) ...@@ -93,7 +93,7 @@ bool FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD( MODULE* aModule )
GetBoard()->BuildListOfNets(); GetBoard()->BuildListOfNets();
GetScreen()->SetCrossHairPosition( wxPoint( 0, 0 ) ); SetCrossHairPosition( wxPoint( 0, 0 ) );
PlaceModule( aModule, NULL ); PlaceModule( aModule, NULL );
// Put it on FRONT layer, // Put it on FRONT layer,
...@@ -155,7 +155,7 @@ MODULE* PCB_BASE_FRAME::LoadModuleFromLibrary( const wxString& aLibrary, ...@@ -155,7 +155,7 @@ MODULE* PCB_BASE_FRAME::LoadModuleFromLibrary( const wxString& aLibrary,
wxDC* aDC ) wxDC* aDC )
{ {
MODULE* module; MODULE* module;
wxPoint curspos = GetScreen()->GetCrossHairPosition(); wxPoint curspos = GetCrossHairPosition();
wxString moduleName, keys; wxString moduleName, keys;
wxString libName = aLibrary; wxString libName = aLibrary;
bool allowWildSeach = true; bool allowWildSeach = true;
...@@ -277,7 +277,7 @@ MODULE* PCB_BASE_FRAME::LoadModuleFromLibrary( const wxString& aLibrary, ...@@ -277,7 +277,7 @@ MODULE* PCB_BASE_FRAME::LoadModuleFromLibrary( const wxString& aLibrary,
} }
} }
GetScreen()->SetCrossHairPosition( curspos ); SetCrossHairPosition( curspos );
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
if( module ) if( module )
......
...@@ -116,7 +116,7 @@ bool Magnetize( PCB_EDIT_FRAME* frame, int aCurrentTool, wxSize aGridSize, ...@@ -116,7 +116,7 @@ bool Magnetize( PCB_EDIT_FRAME* frame, int aCurrentTool, wxSize aGridSize,
TRACK* currTrack = g_CurrentTrackSegment; TRACK* currTrack = g_CurrentTrackSegment;
BOARD_ITEM* currItem = frame->GetCurItem(); BOARD_ITEM* currItem = frame->GetCurItem();
PCB_SCREEN* screen = frame->GetScreen(); PCB_SCREEN* screen = frame->GetScreen();
wxPoint pos = screen->RefPos( true ); wxPoint pos = frame->RefPos( true );
// D( printf( "currTrack=%p currItem=%p currTrack->Type()=%d currItem->Type()=%d\n", currTrack, currItem, currTrack ? currTrack->Type() : 0, currItem ? currItem->Type() : 0 ); ) // D( printf( "currTrack=%p currItem=%p currTrack->Type()=%d currItem->Type()=%d\n", currTrack, currItem, currTrack ? currTrack->Type() : 0, currItem ? currItem->Type() : 0 ); )
...@@ -133,7 +133,6 @@ bool Magnetize( PCB_EDIT_FRAME* frame, int aCurrentTool, wxSize aGridSize, ...@@ -133,7 +133,6 @@ bool Magnetize( PCB_EDIT_FRAME* frame, int aCurrentTool, wxSize aGridSize,
currTrack = NULL; currTrack = NULL;
} }
if( g_MagneticPadOption == capture_always ) if( g_MagneticPadOption == capture_always )
doPad = true; doPad = true;
......
...@@ -16,14 +16,14 @@ ...@@ -16,14 +16,14 @@
#include <protos.h> #include <protos.h>
/* Routines Locales */ // Routines Locales
static void AbortMoveAndEditTarget( EDA_DRAW_PANEL* Panel, wxDC* DC ); static void AbortMoveAndEditTarget( EDA_DRAW_PANEL* Panel, wxDC* DC );
static void ShowTargetShapeWhileMovingMouse( EDA_DRAW_PANEL* aPanel, static void ShowTargetShapeWhileMovingMouse( EDA_DRAW_PANEL* aPanel,
wxDC* aDC, wxDC* aDC,
const wxPoint& aPosition, const wxPoint& aPosition,
bool aErase ); bool aErase );
/* Local variables : */ // Local variables :
static int MireDefaultSize = 5000; static int MireDefaultSize = 5000;
static PCB_TARGET s_TargetCopy( NULL ); /* Used to store "old" values of the static PCB_TARGET s_TargetCopy( NULL ); /* Used to store "old" values of the
* current item parameters before * current item parameters before
...@@ -93,7 +93,7 @@ TARGET_PROPERTIES_DIALOG_EDITOR::TARGET_PROPERTIES_DIALOG_EDITOR( PCB_EDIT_FRAME ...@@ -93,7 +93,7 @@ TARGET_PROPERTIES_DIALOG_EDITOR::TARGET_PROPERTIES_DIALOG_EDITOR( PCB_EDIT_FRAME
MainBoxSizer->Add( LeftBoxSizer, 0, wxGROW | wxALL, 5 ); MainBoxSizer->Add( LeftBoxSizer, 0, wxGROW | wxALL, 5 );
MainBoxSizer->Add( RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); MainBoxSizer->Add( RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
/* Create of the command buttons. */ // Create of the command buttons.
Button = new wxButton( this, wxID_OK, _( "OK" ) ); Button = new wxButton( this, wxID_OK, _( "OK" ) );
RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 ); RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
...@@ -215,7 +215,7 @@ PCB_TARGET* PCB_EDIT_FRAME::CreateTarget( wxDC* DC ) ...@@ -215,7 +215,7 @@ PCB_TARGET* PCB_EDIT_FRAME::CreateTarget( wxDC* DC )
target->SetLayer( EDGE_N ); target->SetLayer( EDGE_N );
target->SetWidth( GetDesignSettings().m_EdgeSegmentWidth ); target->SetWidth( GetDesignSettings().m_EdgeSegmentWidth );
target->SetSize( MireDefaultSize ); target->SetSize( MireDefaultSize );
target->SetPosition( m_canvas->GetScreen()->GetCrossHairPosition() ); target->SetPosition( GetCrossHairPosition() );
PlaceTarget( target, DC ); PlaceTarget( target, DC );
...@@ -273,7 +273,7 @@ void PCB_EDIT_FRAME::PlaceTarget( PCB_TARGET* aTarget, wxDC* DC ) ...@@ -273,7 +273,7 @@ void PCB_EDIT_FRAME::PlaceTarget( PCB_TARGET* aTarget, wxDC* DC )
} }
/* Redraw the contour of the track while moving the mouse */ // Redraw the contour of the track while moving the mouse
static void ShowTargetShapeWhileMovingMouse( EDA_DRAW_PANEL* aPanel, wxDC* aDC, static void ShowTargetShapeWhileMovingMouse( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aPosition, bool aErase ) const wxPoint& aPosition, bool aErase )
{ {
...@@ -286,7 +286,7 @@ static void ShowTargetShapeWhileMovingMouse( EDA_DRAW_PANEL* aPanel, wxDC* aDC, ...@@ -286,7 +286,7 @@ static void ShowTargetShapeWhileMovingMouse( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
if( aErase ) if( aErase )
target->Draw( aPanel, aDC, GR_XOR ); target->Draw( aPanel, aDC, GR_XOR );
target->SetPosition( screen->GetCrossHairPosition() ); target->SetPosition( aPanel->GetParent()->GetCrossHairPosition() );
target->Draw( aPanel, aDC, GR_XOR ); target->Draw( aPanel, aDC, GR_XOR );
} }
This diff is collapsed.
...@@ -132,32 +132,31 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -132,32 +132,31 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
break; break;
case ID_MODEDIT_ANCHOR_TOOL: case ID_MODEDIT_ANCHOR_TOOL:
{ {
MODULE* module = GetBoard()->m_Modules; MODULE* module = GetBoard()->m_Modules;
if( module == NULL // No module loaded if( module == NULL // No module loaded
|| (module->GetFlags() != 0) ) || (module->GetFlags() != 0) )
break; break;
SaveCopyInUndoList( module, UR_MODEDIT ); SaveCopyInUndoList( module, UR_MODEDIT );
// set the new relative internal local coordinates of footprint items // set the new relative internal local coordinates of footprint items
wxPoint moveVector = module->GetPosition() - wxPoint moveVector = module->GetPosition() - GetCrossHairPosition();
GetScreen()->GetCrossHairPosition(); module->MoveAnchorPosition( moveVector );
module->MoveAnchorPosition( moveVector );
// Usually, we do not need to change twice the anchor position, // Usually, we do not need to change twice the anchor position,
// so deselect the active tool // so deselect the active tool
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString ); SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
SetCurItem( NULL ); SetCurItem( NULL );
m_canvas->Refresh(); m_canvas->Refresh();
} }
break; break;
case ID_MODEDIT_PLACE_GRID_COORD: case ID_MODEDIT_PLACE_GRID_COORD:
m_canvas->DrawGridAxis( DC, GR_XOR ); m_canvas->DrawGridAxis( DC, GR_XOR, GetBoard()->GetGridOrigin() );
GetScreen()->m_GridOrigin = GetScreen()->GetCrossHairPosition(); SetGridOrigin( GetCrossHairPosition() );
m_canvas->DrawGridAxis( DC, GR_COPY ); m_canvas->DrawGridAxis( DC, GR_COPY, GetBoard()->GetGridOrigin() );
GetScreen()->SetModify(); GetScreen()->SetModify();
break; break;
......
...@@ -497,9 +497,9 @@ void FOOTPRINT_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, ...@@ -497,9 +497,9 @@ void FOOTPRINT_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition,
snapToGrid = false; snapToGrid = false;
if( snapToGrid ) if( snapToGrid )
pos = GetScreen()->GetNearestGridPosition( pos ); pos = GetNearestGridPosition( pos );
oldpos = GetScreen()->GetCrossHairPosition(); oldpos = GetCrossHairPosition();
gridSize = GetScreen()->GetGridSize(); gridSize = GetScreen()->GetGridSize();
switch( aHotKey ) switch( aHotKey )
...@@ -532,14 +532,14 @@ void FOOTPRINT_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, ...@@ -532,14 +532,14 @@ void FOOTPRINT_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition,
break; break;
} }
GetScreen()->SetCrossHairPosition( pos, snapToGrid ); SetCrossHairPosition( pos, snapToGrid );
if( oldpos != GetScreen()->GetCrossHairPosition() ) if( oldpos != GetCrossHairPosition() )
{ {
pos = GetScreen()->GetCrossHairPosition(); pos = GetCrossHairPosition();
GetScreen()->SetCrossHairPosition( oldpos, false ); SetCrossHairPosition( oldpos, false );
m_canvas->CrossHairOff( aDC ); m_canvas->CrossHairOff( aDC );
GetScreen()->SetCrossHairPosition( pos, snapToGrid ); SetCrossHairPosition( pos, snapToGrid );
m_canvas->CrossHairOn( aDC ); m_canvas->CrossHairOn( aDC );
if( m_canvas->IsMouseCaptured() ) if( m_canvas->IsMouseCaptured() )
......
...@@ -244,7 +244,7 @@ void MoveFootprint( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, ...@@ -244,7 +244,7 @@ void MoveFootprint( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
} }
/* Redraw the module at the new position. */ /* Redraw the module at the new position. */
g_Offset_Module = module->GetPosition() - aPanel->GetScreen()->GetCrossHairPosition(); g_Offset_Module = module->GetPosition() - aPanel->GetParent()->GetCrossHairPosition();
DrawModuleOutlines( aPanel, aDC, module ); DrawModuleOutlines( aPanel, aDC, module );
DrawSegmentWhileMovingFootprint( aPanel, aDC ); DrawSegmentWhileMovingFootprint( aPanel, aDC );
...@@ -391,7 +391,7 @@ void PCB_BASE_FRAME::PlaceModule( MODULE* aModule, wxDC* aDC, bool aDoNotRecreat ...@@ -391,7 +391,7 @@ void PCB_BASE_FRAME::PlaceModule( MODULE* aModule, wxDC* aDC, bool aDoNotRecreat
if( g_Show_Module_Ratsnest && ( GetBoard()->m_Status_Pcb & LISTE_PAD_OK ) && aDC ) if( g_Show_Module_Ratsnest && ( GetBoard()->m_Status_Pcb & LISTE_PAD_OK ) && aDC )
TraceModuleRatsNest( aDC ); TraceModuleRatsNest( aDC );
newpos = GetScreen()->GetCrossHairPosition(); newpos = GetCrossHairPosition();
aModule->SetPosition( newpos ); aModule->SetPosition( newpos );
aModule->ClearFlags(); aModule->ClearFlags();
......
...@@ -369,7 +369,7 @@ void FOOTPRINT_VIEWER_FRAME::OnSize( wxSizeEvent& SizeEv ) ...@@ -369,7 +369,7 @@ void FOOTPRINT_VIEWER_FRAME::OnSize( wxSizeEvent& SizeEv )
void FOOTPRINT_VIEWER_FRAME::OnSetRelativeOffset( wxCommandEvent& event ) void FOOTPRINT_VIEWER_FRAME::OnSetRelativeOffset( wxCommandEvent& event )
{ {
GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition(); GetScreen()->m_O_Curseur = GetCrossHairPosition();
UpdateStatusBar(); UpdateStatusBar();
} }
...@@ -644,8 +644,8 @@ void FOOTPRINT_VIEWER_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition ...@@ -644,8 +644,8 @@ void FOOTPRINT_VIEWER_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this ); cmd.SetEventObject( this );
pos = screen->GetNearestGridPosition( pos ); pos = GetNearestGridPosition( pos );
oldpos = screen->GetCrossHairPosition(); oldpos = GetCrossHairPosition();
gridSize = screen->GetGridSize(); gridSize = screen->GetGridSize();
switch( aHotKey ) switch( aHotKey )
...@@ -676,7 +676,7 @@ void FOOTPRINT_VIEWER_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition ...@@ -676,7 +676,7 @@ void FOOTPRINT_VIEWER_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition
break; break;
case ' ': case ' ':
screen->m_O_Curseur = screen->GetCrossHairPosition(); screen->m_O_Curseur = GetCrossHairPosition();
break; break;
case WXK_NUMPAD8: /* cursor moved up */ case WXK_NUMPAD8: /* cursor moved up */
...@@ -704,14 +704,14 @@ void FOOTPRINT_VIEWER_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition ...@@ -704,14 +704,14 @@ void FOOTPRINT_VIEWER_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition
break; break;
} }
screen->SetCrossHairPosition( pos ); SetCrossHairPosition( pos );
if( oldpos != screen->GetCrossHairPosition() ) if( oldpos != GetCrossHairPosition() )
{ {
pos = screen->GetCrossHairPosition(); pos = GetCrossHairPosition();
screen->SetCrossHairPosition( oldpos ); SetCrossHairPosition( oldpos );
m_canvas->CrossHairOff( aDC ); m_canvas->CrossHairOff( aDC );
screen->SetCrossHairPosition( pos ); SetCrossHairPosition( pos );
m_canvas->CrossHairOn( aDC ); m_canvas->CrossHairOn( aDC );
if( m_canvas->IsMouseCaptured() ) if( m_canvas->IsMouseCaptured() )
......
...@@ -63,7 +63,6 @@ static void Show_Pad_Move( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPo ...@@ -63,7 +63,6 @@ static void Show_Pad_Move( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPo
bool aErase ) bool aErase )
{ {
TRACK* Track; TRACK* Track;
BASE_SCREEN* screen = aPanel->GetScreen();
D_PAD* pad = s_CurrentSelectedPad; D_PAD* pad = s_CurrentSelectedPad;
if( pad == NULL ) // Should not occur if( pad == NULL ) // Should not occur
...@@ -72,7 +71,7 @@ static void Show_Pad_Move( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPo ...@@ -72,7 +71,7 @@ static void Show_Pad_Move( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPo
if( aErase ) if( aErase )
pad->Draw( aPanel, aDC, GR_XOR ); pad->Draw( aPanel, aDC, GR_XOR );
pad->SetPosition( screen->GetCrossHairPosition() ); pad->SetPosition( aPanel->GetParent()->GetCrossHairPosition() );
pad->Draw( aPanel, aDC, GR_XOR ); pad->Draw( aPanel, aDC, GR_XOR );
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ ) for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
......
...@@ -85,7 +85,7 @@ static void Abort_MoveTrack( EDA_DRAW_PANEL* aPanel, wxDC* aDC ) ...@@ -85,7 +85,7 @@ static void Abort_MoveTrack( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
frame->SetCurItem( NULL ); frame->SetCurItem( NULL );
aPanel->SetMouseCapture( NULL, NULL ); aPanel->SetMouseCapture( NULL, NULL );
/* Undo move and redraw trace segments. */ // Undo move and redraw trace segments.
for( unsigned jj=0 ; jj < g_DragSegmentList.size(); jj++ ) for( unsigned jj=0 ; jj < g_DragSegmentList.size(); jj++ )
{ {
TRACK* track = g_DragSegmentList[jj].m_Track; TRACK* track = g_DragSegmentList[jj].m_Track;
...@@ -101,12 +101,11 @@ static void Abort_MoveTrack( EDA_DRAW_PANEL* aPanel, wxDC* aDC ) ...@@ -101,12 +101,11 @@ static void Abort_MoveTrack( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
} }
/* Redraw the moved node according to the mouse cursor position */ // Redraw the moved node according to the mouse cursor position
static void Show_MoveNode( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, static void Show_MoveNode( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase ) bool aErase )
{ {
wxPoint moveVector; wxPoint moveVector;
BASE_SCREEN* screen = aPanel->GetScreen();
int tmp = DisplayOpt.DisplayPcbTrackFill; int tmp = DisplayOpt.DisplayPcbTrackFill;
GR_DRAWMODE draw_mode = GR_XOR | GR_HIGHLIGHT; GR_DRAWMODE draw_mode = GR_XOR | GR_HIGHLIGHT;
...@@ -118,8 +117,8 @@ static void Show_MoveNode( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPo ...@@ -118,8 +117,8 @@ static void Show_MoveNode( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPo
aErase = false; aErase = false;
#endif #endif
/* set the new track coordinates */ // set the new track coordinates
wxPoint Pos = screen->GetCrossHairPosition(); wxPoint Pos = aPanel->GetParent()->GetCrossHairPosition();
moveVector = Pos - s_LastPos; moveVector = Pos - s_LastPos;
s_LastPos = Pos; s_LastPos = Pos;
...@@ -202,7 +201,6 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* aPanel, wxDC ...@@ -202,7 +201,6 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* aPanel, wxDC
double xi1 = 0, yi1 = 0, xi2 = 0, yi2 = 0; // calculated intersection points double xi1 = 0, yi1 = 0, xi2 = 0, yi2 = 0; // calculated intersection points
double tx1, tx2, ty1, ty2; // temporary storage of points double tx1, tx2, ty1, ty2; // temporary storage of points
int dx, dy; int dx, dy;
BASE_SCREEN* screen = aPanel->GetScreen();
bool update = true; bool update = true;
TRACK* Track; TRACK* Track;
TRACK* tSegmentToStart = NULL, * tSegmentToEnd = NULL; TRACK* tSegmentToStart = NULL, * tSegmentToEnd = NULL;
...@@ -243,7 +241,7 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* aPanel, wxDC ...@@ -243,7 +241,7 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* aPanel, wxDC
GR_DRAWMODE draw_mode = GR_XOR | GR_HIGHLIGHT; GR_DRAWMODE draw_mode = GR_XOR | GR_HIGHLIGHT;
/* Undraw the current moved track segments before modification*/ // Undraw the current moved track segments before modification
#ifndef USE_WX_OVERLAY #ifndef USE_WX_OVERLAY
// if( erase ) // if( erase )
...@@ -258,13 +256,13 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* aPanel, wxDC ...@@ -258,13 +256,13 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* aPanel, wxDC
} }
#endif #endif
/* Compute the new track segment position */ // Compute the new track segment position
wxPoint Pos = screen->GetCrossHairPosition(); wxPoint Pos = aPanel->GetParent()->GetCrossHairPosition();
dx = Pos.x - s_LastPos.x; dx = Pos.x - s_LastPos.x;
dy = Pos.y - s_LastPos.y; dy = Pos.y - s_LastPos.y;
//move the line by dx and dy // move the line by dx and dy
tx1 = (double) ( Track->GetStart().x + dx ); tx1 = (double) ( Track->GetStart().x + dx );
ty1 = (double) ( Track->GetStart().y + dy ); ty1 = (double) ( Track->GetStart().y + dy );
tx2 = (double) ( Track->GetEnd().x + dx ); tx2 = (double) ( Track->GetEnd().x + dx );
...@@ -613,13 +611,13 @@ void PCB_EDIT_FRAME::StartMoveOneNodeOrSegment( TRACK* aTrack, wxDC* aDC, int aC ...@@ -613,13 +611,13 @@ void PCB_EDIT_FRAME::StartMoveOneNodeOrSegment( TRACK* aTrack, wxDC* aDC, int aC
EraseDragList(); EraseDragList();
/* Change highlighted net: the new one will be highlighted */ // Change highlighted net: the new one will be highlighted
GetBoard()->PushHighLight(); GetBoard()->PushHighLight();
if( GetBoard()->IsHighLightNetON() ) if( GetBoard()->IsHighLightNetON() )
HighLight( aDC ); HighLight( aDC );
PosInit = GetScreen()->GetCrossHairPosition(); PosInit = GetCrossHairPosition();
if( aTrack->Type() == PCB_VIA_T ) if( aTrack->Type() == PCB_VIA_T )
{ {
...@@ -637,7 +635,7 @@ void PCB_EDIT_FRAME::StartMoveOneNodeOrSegment( TRACK* aTrack, wxDC* aDC, int aC ...@@ -637,7 +635,7 @@ void PCB_EDIT_FRAME::StartMoveOneNodeOrSegment( TRACK* aTrack, wxDC* aDC, int aC
} }
else else
{ {
STATUS_FLAGS diag = aTrack->IsPointOnEnds( GetScreen()->GetCrossHairPosition(), -1 ); STATUS_FLAGS diag = aTrack->IsPointOnEnds( GetCrossHairPosition(), -1 );
wxPoint pos; wxPoint pos;
switch( aCommand ) switch( aCommand )
...@@ -754,7 +752,7 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC ...@@ -754,7 +752,7 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
if( !TrackToEndPoint || ( TrackToEndPoint->Type() != PCB_TRACE_T ) ) if( !TrackToEndPoint || ( TrackToEndPoint->Type() != PCB_TRACE_T ) )
s_EndSegmentPresent = false; s_EndSegmentPresent = false;
/* Change high light net: the new one will be highlighted */ // Change high light net: the new one will be highlighted
GetBoard()->PushHighLight(); GetBoard()->PushHighLight();
if( GetBoard()->IsHighLightNetON() ) if( GetBoard()->IsHighLightNetON() )
...@@ -791,8 +789,8 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC ...@@ -791,8 +789,8 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
UndrawAndMarkSegmentsToDrag( m_canvas, DC ); UndrawAndMarkSegmentsToDrag( m_canvas, DC );
PosInit = GetScreen()->GetCrossHairPosition(); PosInit = GetCrossHairPosition();
s_LastPos = GetScreen()->GetCrossHairPosition(); s_LastPos = GetCrossHairPosition();
m_canvas->SetMouseCapture( Show_Drag_Track_Segment_With_Cte_Slope, Abort_MoveTrack ); m_canvas->SetMouseCapture( Show_Drag_Track_Segment_With_Cte_Slope, Abort_MoveTrack );
GetBoard()->SetHighLightNet( track->GetNet() ); GetBoard()->SetHighLightNet( track->GetNet() );
...@@ -823,7 +821,7 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC ...@@ -823,7 +821,7 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
} }
/* Place a dragged (or moved) track segment or via */ // Place a dragged (or moved) track segment or via
bool PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC ) bool PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC )
{ {
int errdrc; int errdrc;
...@@ -841,7 +839,7 @@ bool PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC ) ...@@ -841,7 +839,7 @@ bool PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC )
if( errdrc == BAD_DRC ) if( errdrc == BAD_DRC )
return false; return false;
/* Redraw the dragged segments */ // Redraw the dragged segments
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ ) for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
{ {
errdrc = m_drc->Drc( g_DragSegmentList[ii].m_Track, GetBoard()->m_Track ); errdrc = m_drc->Drc( g_DragSegmentList[ii].m_Track, GetBoard()->m_Track );
...@@ -855,7 +853,7 @@ bool PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC ) ...@@ -855,7 +853,7 @@ bool PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC )
Track->ClearFlags(); Track->ClearFlags();
Track->SetState( IN_EDIT, false ); Track->SetState( IN_EDIT, false );
/* Draw dragged tracks */ // Draw dragged tracks
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ ) for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
{ {
Track = g_DragSegmentList[ii].m_Track; Track = g_DragSegmentList[ii].m_Track;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment