*) 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.
This commit is contained in:
Dick Hollenbeck 2013-08-03 00:15:23 -05:00
parent 744dd80eaf
commit efb34166ea
100 changed files with 1373 additions and 1181 deletions

View File

@ -288,10 +288,10 @@ GRID_TYPE& BASE_SCREEN::GetGrid( size_t aIndex )
}
wxPoint BASE_SCREEN::GetNearestGridPosition( const wxPoint& aPosition,
wxRealPoint* aGridSize ) const
wxPoint BASE_SCREEN::getNearestGridPosition( const wxPoint& aPosition,
const wxPoint& aGridOrigin, wxRealPoint* aGridSize ) const
{
wxPoint pt;
wxPoint pt;
wxRealPoint gridSize;
if( aGridSize )
@ -299,13 +299,13 @@ wxPoint BASE_SCREEN::GetNearestGridPosition( const wxPoint& aPosition,
else
gridSize = GetGridSize();
wxPoint gridOrigin = m_GridOrigin;
double offset = fmod( gridOrigin.x, gridSize.x );
double offset = fmod( aGridOrigin.x, gridSize.x );
int x = KiROUND( (aPosition.x - offset) / gridSize.x );
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 );
pt.y = KiROUND ( y * gridSize.y + offset );
@ -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 )
return GetNearestGridPosition( m_crossHairPosition, aGridSize );
return getNearestGridPosition( m_crossHairPosition, aGridOrigin, aGridSize );
return m_crossHairPosition;
}
wxPoint BASE_SCREEN::GetCrossHairScreenPosition() const
wxPoint BASE_SCREEN::getCrossHairScreenPosition() const
{
wxPoint pos = m_crossHairPosition - m_DrawOrg;
double scalar = GetScalingFactor();
double scalar = GetScalingFactor();
pos.x = KiROUND( (double) pos.x * scalar );
pos.y = KiROUND( (double) pos.y * scalar );
@ -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 )
m_crossHairPosition = GetNearestGridPosition( aPosition );
m_crossHairPosition = getNearestGridPosition( aPosition, aGridOrigin );
else
m_crossHairPosition = aPosition;
}

View File

@ -34,6 +34,7 @@
* depending on the application.
*/
#include <macros.h>
#include <base_struct.h>
#include <class_title_block.h>
#include <common.h>
@ -187,7 +188,7 @@ void StripTrailingZeros( wxString& aStringValue, unsigned aTrailingZeroAllowed )
/* 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
* and some trailing 0
* This function should be used to display values in dialogs because a value
@ -198,23 +199,19 @@ void StripTrailingZeros( wxString& aStringValue, unsigned aTrailingZeroAllowed )
*/
wxString ReturnStringFromValue( EDA_UNITS_T aUnit, int aValue, bool aAddUnitSymbol )
{
wxString stringValue;
double value_to_print;
value_to_print = To_User_Unit( aUnit, aValue );
double value_to_print = To_User_Unit( aUnit, aValue );
#if defined( EESCHEMA )
stringValue.Printf( 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
wxString stringValue = wxString::Format( wxT( "%.3f" ), value_to_print );
// Strip trailing zeros. However, keep at least 3 digits in mantissa
// For readability
StripTrailingZeros( stringValue, 3 );
#else
std::string s = Double2Str( value_to_print );
wxString stringValue = FROM_UTF8( s.c_str() );
#endif
if( aAddUnitSymbol )
@ -269,8 +266,6 @@ double From_User_Unit( EDA_UNITS_T aUnit, double aValue )
}
int ReturnValueFromString( EDA_UNITS_T aUnits, const wxString& aTextValue )
{
double value;

View File

@ -42,8 +42,8 @@
BLOCK_SELECTOR::BLOCK_SELECTOR() :
EDA_RECT()
{
m_state = STATE_NO_BLOCK; /* State (enum BLOCK_STATE_T) of block. */
m_command = BLOCK_IDLE; /* Type (enum BLOCK_COMMAND_T) of operation. */
m_state = STATE_NO_BLOCK; // State (enum BLOCK_STATE_T) of block.
m_command = BLOCK_IDLE; // Type (enum BLOCK_COMMAND_T) of operation.
m_color = BROWN;
}
@ -62,24 +62,24 @@ void BLOCK_SELECTOR::SetMessageBlock( EDA_DRAW_FRAME* frame )
case BLOCK_IDLE:
break;
case BLOCK_MOVE: /* Move */
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
case BLOCK_MOVE: // Move
case BLOCK_PRESELECT_MOVE: // Move with preselection list
msg = _( "Block Move" );
break;
case BLOCK_DRAG: /* Drag */
case BLOCK_DRAG: // Drag
msg = _( "Block Drag" );
break;
case BLOCK_COPY: /* Copy */
case BLOCK_COPY: // Copy
msg = _( "Block Copy" );
break;
case BLOCK_DELETE: /* Delete */
case BLOCK_DELETE: // Delete
msg = _( "Block Delete" );
break;
case BLOCK_SAVE: /* Save */
case BLOCK_SAVE: // Save
msg = _( "Block Save" );
break;
@ -87,20 +87,20 @@ void BLOCK_SELECTOR::SetMessageBlock( EDA_DRAW_FRAME* frame )
msg = _( "Block Paste" );
break;
case BLOCK_ZOOM: /* Window Zoom */
case BLOCK_ZOOM: // Window Zoom
msg = _( "Win Zoom" );
break;
case BLOCK_ROTATE: /* Rotate 90 deg */
case BLOCK_ROTATE: // Rotate 90 deg
msg = _( "Block Rotate" );
break;
case BLOCK_FLIP: /* Flip */
case BLOCK_FLIP: // Flip
msg = _( "Block Flip" );
break;
case BLOCK_MIRROR_X:
case BLOCK_MIRROR_Y: /* mirror */
case BLOCK_MIRROR_Y: // mirror
msg = _( "Block Mirror" );
break;
@ -185,15 +185,15 @@ void DrawAndSizingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoin
if( aErase )
block->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, block->GetColor() );
block->SetLastCursorPosition( aPanel->GetScreen()->GetCrossHairPosition() );
block->SetEnd( aPanel->GetScreen()->GetCrossHairPosition() );
block->SetLastCursorPosition( aPanel->GetParent()->GetCrossHairPosition() );
block->SetEnd( aPanel->GetParent()->GetCrossHairPosition() );
block->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, block->GetColor() );
if( block->GetState() == STATE_BLOCK_INIT )
{
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 );
}
}
@ -203,14 +203,14 @@ void AbortBlockCurrentCommand( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
{
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->SetMouseCapture( NULL, 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 )
screen->m_BlockLocate.ClearItemsList();
}

View File

@ -114,26 +114,18 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* aParent,
m_snapToGrid = true;
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 );
// set the size of the status bar subwindows:
wxWindow* stsbar = GetStatusBar();
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,
// 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.
// zoom:
@ -148,7 +140,9 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* aParent,
// units display, Inches is bigger than mm
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 );
@ -381,7 +375,7 @@ void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event )
*/
m_LastGridSizeId = id - ID_POPUP_GRID_LEVEL_1000;
screen->SetGrid( id );
screen->SetCrossHairPosition( screen->RefPos( true ) );
SetCrossHairPosition( RefPos( true ) );
Refresh();
}
@ -409,7 +403,7 @@ void EDA_DRAW_FRAME::OnSelectZoom( wxCommandEvent& event )
return;
GetScreen()->SetZoom( selectedZoom );
RedrawScreen( GetScreen()->GetScrollCenterPosition(), false );
RedrawScreen( GetScrollCenterPosition(), false );
}
}
@ -495,7 +489,7 @@ wxPoint EDA_DRAW_FRAME::GetGridPosition( const wxPoint& aPosition ) const
wxPoint pos = aPosition;
if( m_currentScreen != NULL && m_snapToGrid )
pos = m_currentScreen->GetNearestGridPosition( aPosition );
pos = GetNearestGridPosition( aPosition );
return pos;
}
@ -878,7 +872,7 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPositionIU )
// Calculate the scroll bar position in internal units to place the
// 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 posY = centerPositionIU.y - clientRectIU.height/2.0 - screen->m_DrawOrg.y;
@ -931,3 +925,61 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPositionIU )
screen->m_ScrollbarPos.x,
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 >--------------------------------------------

View File

@ -181,7 +181,7 @@ void EDA_DRAW_PANEL::DrawCrossHair( wxDC* aDC, EDA_COLOR_T aColor )
if( m_cursorLevel != 0 || aDC == NULL || !m_showCrossHair )
return;
wxPoint cursor = GetScreen()->GetCrossHairPosition();
wxPoint cursor = GetParent()->GetCrossHairPosition();
GRSetDrawMode( aDC, GR_XOR );
@ -297,7 +297,7 @@ wxPoint EDA_DRAW_PANEL::GetScreenCenterLogicalPosition()
void EDA_DRAW_PANEL::MoveCursorToCrossHair()
{
MoveCursor( GetScreen()->GetCrossHairPosition() );
MoveCursor( GetParent()->GetCrossHairPosition() );
}
@ -433,10 +433,10 @@ void EDA_DRAW_PANEL::OnScroll( wxScrollWinEvent& event )
double scale = GetParent()->GetScreen()->GetScalingFactor();
wxPoint center = GetParent()->GetScreen()->GetScrollCenterPosition();
wxPoint center = GetParent()->GetScrollCenterPosition();
center.x += KiROUND( (double) ( x - tmpX ) / scale );
center.y += KiROUND( (double) ( y - tmpY ) / scale );
GetParent()->GetScreen()->SetScrollCenterPosition( center );
GetParent()->SetScrollCenterPosition( center );
Scroll( x, y );
event.Skip();
@ -609,7 +609,7 @@ void EDA_DRAW_PANEL::DrawBackGround( wxDC* DC )
DrawAuxiliaryAxis( DC, GR_COPY );
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 )
if( screenGridSize.x < MIN_GRID_SIZE || screenGridSize.y < MIN_GRID_SIZE )
return;
org = screen->GetNearestGridPosition( org, &gridSize );
org = GetParent()->GetNearestGridPosition( org, &gridSize );
// 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
@ -740,7 +740,7 @@ void EDA_DRAW_PANEL::DrawGrid( wxDC* aDC )
void EDA_DRAW_PANEL::DrawAuxiliaryAxis( wxDC* aDC, GR_DRAWMODE aDrawMode )
{
wxPoint origin = GetParent()->GetOriginAxisPosition();
wxPoint origin = GetParent()->GetAuxOrigin();
if( origin == wxPoint( 0, 0 ) )
return;
@ -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
|| ( screen->m_GridOrigin.x == 0 && screen->m_GridOrigin.y == 0 ) )
if( !GetParent()->m_showGridAxis || ( !aGridOrigin.x && !aGridOrigin.y ) )
return;
EDA_COLOR_T color = GetParent()->GetGridColor();
wxSize pageSize = GetParent()->GetPageSizeIU();
EDA_COLOR_T color = GetParent()->GetGridColor();
wxSize pageSize = GetParent()->GetPageSizeIU();
GRSetDrawMode( aDC, aDrawMode );
// Draw the Y axis
GRDashedLine( &m_ClipBox, aDC,
screen->m_GridOrigin.x,
aGridOrigin.x,
-pageSize.y,
screen->m_GridOrigin.x,
aGridOrigin.x,
pageSize.y,
0, color );
// Draw the X axis
GRDashedLine( &m_ClipBox, aDC,
-pageSize.x,
screen->m_GridOrigin.y,
aGridOrigin.y,
pageSize.x,
screen->m_GridOrigin.y,
aGridOrigin.y,
0, color );
}
@ -846,7 +843,7 @@ void EDA_DRAW_PANEL::OnMouseLeaving( wxMouseEvent& event )
cross_hair_pos.x = dc.DeviceToLogicalX( cross_hair_pos.x );
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 );
cmd.SetEventObject( this );
@ -876,7 +873,7 @@ void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event )
}
INSTALL_UNBUFFERED_DC( dc, this );
GetScreen()->SetCrossHairPosition( event.GetLogicalPosition( dc ) );
GetParent()->SetCrossHairPosition( event.GetLogicalPosition( dc ) );
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this );
@ -970,7 +967,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
DC.SetBackground( *wxBLACK_BRUSH );
// Compute the cursor position in drawing (logical) units.
screen->SetMousePosition( event.GetLogicalPosition( DC ) );
GetParent()->SetMousePosition( event.GetLogicalPosition( DC ) );
int kbstat = 0;
@ -986,7 +983,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
// Calling Double Click and Click functions :
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,
// because we have a double click, and we do not want a new
@ -1003,7 +1000,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
m_ignoreNextLeftButtonRelease = false;
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() )
@ -1027,7 +1024,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
m_PanStartCenter.y *= ppuy;
}
else
m_PanStartCenter = GetParent()->GetScreen()->GetScrollCenterPosition();
m_PanStartCenter = GetParent()->GetScrollCenterPosition();
m_PanStartEventPosition = event.GetPosition();
@ -1101,10 +1098,10 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
double scale = GetParent()->GetScreen()->GetScalingFactor();
wxPoint center = GetParent()->GetScreen()->GetScrollCenterPosition();
wxPoint center = GetParent()->GetScrollCenterPosition();
center.x += KiROUND( (double) ( x - tmpX ) / scale ) / ppux;
center.y += KiROUND( (double) ( y - tmpY ) / scale ) / ppuy;
GetParent()->GetScreen()->SetScrollCenterPosition( center );
GetParent()->SetScrollCenterPosition( center );
Refresh();
Update();
@ -1164,7 +1161,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
* (a filter creates a delay for the real block command start, and
* we must remember this point)
*/
m_CursorStartPos = screen->GetCrossHairPosition();
m_CursorStartPos = GetParent()->GetCrossHairPosition();
}
if( m_enableBlockCommands && !(localbutt & GR_M_DCLICK) )
@ -1323,17 +1320,14 @@ void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
INSTALL_UNBUFFERED_DC( DC, this );
BASE_SCREEN* Screen = GetScreen();
// Some key commands use the current mouse position: refresh it.
pos = wxGetMousePosition() - GetScreenPosition();
// Compute the cursor position in drawing units. Also known as logical units to wxDC.
pos = wxPoint( DC.DeviceToLogicalX( pos.x ), DC.DeviceToLogicalY( pos.y ) );
Screen->SetMousePosition( pos );
GetParent()->SetMousePosition( pos );
GetParent()->GeneralControl( &DC, pos, localkey );
}

View File

@ -76,6 +76,7 @@ fp_poly
fp_text
full
general
grid_origin
gr_arc
gr_circle
gr_curve

View File

@ -57,7 +57,7 @@ void EDA_DRAW_FRAME::RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointe
void EDA_DRAW_FRAME::RedrawScreen2( const wxPoint& posBefore )
{
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 );
AdjustScrollBars( newCenter );
@ -80,9 +80,9 @@ void EDA_DRAW_FRAME::Zoom_Automatique( bool aWarpPointer )
screen->SetScalingFactor( bestzoom );
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 )
int id = event.GetId();
bool zoom_at_cursor = false;
BASE_SCREEN* screen = GetScreen();
wxPoint center = screen->GetScrollCenterPosition();
wxPoint center = GetScrollCenterPosition();
switch( id )
{
case ID_OFFCENTER_ZOOM_IN:
center = m_canvas->ToDeviceXY( screen->GetCrossHairPosition() );
center = m_canvas->ToDeviceXY( GetCrossHairPosition() );
if( screen->SetPreviousZoom() )
RedrawScreen2( center );
break;
case ID_POPUP_ZOOM_IN:
zoom_at_cursor = true;
center = screen->GetCrossHairPosition();
center = GetCrossHairPosition();
// fall thru
case ID_ZOOM_IN:
@ -141,14 +141,14 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event )
break;
case ID_OFFCENTER_ZOOM_OUT:
center = m_canvas->ToDeviceXY( screen->GetCrossHairPosition() );
center = m_canvas->ToDeviceXY( GetCrossHairPosition() );
if( screen->SetNextZoom() )
RedrawScreen2( center );
break;
case ID_POPUP_ZOOM_OUT:
zoom_at_cursor = true;
center = screen->GetCrossHairPosition();
center = GetCrossHairPosition();
// fall thru
case ID_ZOOM_OUT:
@ -161,7 +161,7 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event )
break;
case ID_POPUP_ZOOM_CENTER:
center = screen->GetCrossHairPosition();
center = GetCrossHairPosition();
RedrawScreen( center, true );
break;

View File

@ -339,8 +339,8 @@ void DISPLAY_FOOTPRINTS_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPositi
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this );
pos = screen->GetNearestGridPosition( pos );
oldpos = screen->GetCrossHairPosition();
pos = GetNearestGridPosition( pos );
oldpos = GetCrossHairPosition();
gridSize = screen->GetGridSize();
switch( aHotKey )
@ -371,7 +371,7 @@ void DISPLAY_FOOTPRINTS_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPositi
break;
case ' ':
screen->m_O_Curseur = screen->GetCrossHairPosition();
screen->m_O_Curseur = GetCrossHairPosition();
break;
case WXK_NUMPAD8: /* cursor moved up */
@ -399,14 +399,14 @@ void DISPLAY_FOOTPRINTS_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPositi
break;
}
screen->SetCrossHairPosition( pos );
SetCrossHairPosition( pos );
if( oldpos != screen->GetCrossHairPosition() )
if( oldpos != GetCrossHairPosition() )
{
pos = screen->GetCrossHairPosition();
screen->SetCrossHairPosition( oldpos );
pos = GetCrossHairPosition();
SetCrossHairPosition( oldpos );
m_canvas->CrossHairOff( aDC );
screen->SetCrossHairPosition( pos );
SetCrossHairPosition( pos );
m_canvas->CrossHairOn( aDC );
if( m_canvas->IsMouseCaptured() )

View File

@ -215,7 +215,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
block->SetState( state );
block->SetCommand( command );
m_canvas->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand );
GetScreen()->SetCrossHairPosition( block->GetEnd() );
SetCrossHairPosition( block->GetEnd() );
if( block->GetCommand() != BLOCK_ABORT )
m_canvas->MoveCursorToCrossHair();
@ -237,8 +237,8 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
{
// Compute the rotation center and put it on grid:
wxPoint rotationPoint = block->Centre();
rotationPoint = GetScreen()->GetNearestGridPosition( rotationPoint );
GetScreen()->SetCrossHairPosition( rotationPoint );
rotationPoint = GetNearestGridPosition( rotationPoint );
SetCrossHairPosition( rotationPoint );
SaveCopyInUndoList( block->GetItems(), UR_ROTATED, rotationPoint );
RotateListOfItems( block->GetItems(), rotationPoint );
OnModify();
@ -433,8 +433,8 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
{
/* Compute the rotation center and put it on grid */
wxPoint rotationPoint = block->Centre();
rotationPoint = GetScreen()->GetNearestGridPosition( rotationPoint );
GetScreen()->SetCrossHairPosition( rotationPoint );
rotationPoint = GetNearestGridPosition( rotationPoint );
SetCrossHairPosition( rotationPoint );
SaveCopyInUndoList( block->GetItems(), UR_ROTATED, rotationPoint );
RotateListOfItems( block->GetItems(), rotationPoint );
OnModify();
@ -452,8 +452,8 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
{
/* Compute the mirror center and put it on grid */
wxPoint mirrorPoint = block->Centre();
mirrorPoint = GetScreen()->GetNearestGridPosition( mirrorPoint );
GetScreen()->SetCrossHairPosition( mirrorPoint );
mirrorPoint = GetNearestGridPosition( mirrorPoint );
SetCrossHairPosition( mirrorPoint );
SaveCopyInUndoList( block->GetItems(), UR_MIRRORED_X, mirrorPoint );
MirrorX( block->GetItems(), mirrorPoint );
OnModify();
@ -471,8 +471,8 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
{
/* Compute the mirror center and put it on grid */
wxPoint mirrorPoint = block->Centre();
mirrorPoint = GetScreen()->GetNearestGridPosition( mirrorPoint );
GetScreen()->SetCrossHairPosition( mirrorPoint );
mirrorPoint = GetNearestGridPosition( mirrorPoint );
SetCrossHairPosition( mirrorPoint );
SaveCopyInUndoList( block->GetItems(), UR_MIRRORED_Y, mirrorPoint );
MirrorY( block->GetItems(), mirrorPoint );
OnModify();
@ -519,7 +519,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
}
/* 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() );
for( unsigned ii = 0; ii < block->GetCount(); ii++ )

View File

@ -99,8 +99,8 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
GetScreen()->m_BlockLocate.SetState( state );
GetScreen()->m_BlockLocate.SetCommand( command );
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();
}
@ -171,7 +171,7 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
SaveCopyInUndoList( m_component );
pt = GetScreen()->m_BlockLocate.Centre();
pt = GetScreen()->GetNearestGridPosition( pt );
pt = GetNearestGridPosition( pt );
NEGATE( pt.y );
if ( m_component )
@ -183,7 +183,7 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
m_component->MirrorSelectedItemsH( pt );
else if( block_cmd == BLOCK_MIRROR_X)
m_component->MirrorSelectedItemsV( pt );
else if( block_cmd == BLOCK_ROTATE)
else if( block_cmd == BLOCK_ROTATE )
m_component->RotateSelectedItems( pt );
}
@ -275,7 +275,7 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
SaveCopyInUndoList( m_component );
pt = GetScreen()->m_BlockLocate.Centre();
pt = GetScreen()->GetNearestGridPosition( pt );
pt = GetNearestGridPosition( pt );
NEGATE( pt.y );
if ( m_component )
@ -342,7 +342,7 @@ void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
}
// Repaint new view
block->SetMoveVector( screen->GetCrossHairPosition() - block->GetLastCursorPosition() );
block->SetMoveVector( parent->GetCrossHairPosition() - block->GetLastCursorPosition() );
GRSetDrawMode( aDC, g_XorMode );
block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );

View File

@ -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: */
ComputeBreakPoint( (SCH_LINE*) s_wires.GetLast()->Back(), endpos );
@ -105,7 +106,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
{
SCH_LINE* segment;
SCH_LINE* nextSegment;
wxPoint cursorpos = GetScreen()->GetCrossHairPosition();
wxPoint cursorpos = GetCrossHairPosition();
// We should know if a segment is currently in progress
segment = (SCH_LINE*) GetScreen()->GetCurItem();
@ -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
{
wxPoint pos = GetScreen()->GetCrossHairPosition() -
wxPoint pos = GetCrossHairPosition() -
( (SCH_COMPONENT*) m_itemToRepeat )->GetPosition();
m_itemToRepeat->SetFlags( IS_NEW );
( (SCH_COMPONENT*) m_itemToRepeat )->SetTimeStamp( GetNewTimeStamp() );
m_itemToRepeat->Move( pos );

View File

@ -45,10 +45,9 @@ static int s_LastShape = '\\';
SCH_BUS_BUS_ENTRY* SCH_EDIT_FRAME::CreateBusBusEntry( wxDC* aDC )
{
SCH_SCREEN* screen = GetScreen();
// 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 );
GetScreen()->SetCurItem( busEntry );
addCurrentItemToList( 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_SCREEN* screen = GetScreen();
// 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 );
GetScreen()->SetCurItem( busEntry );
addCurrentItemToList( aDC );

View File

@ -56,7 +56,7 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateAndShowItem( const wxPoint& aPosition, const KIC
wxString msg;
LIB_PIN* Pin = 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
// grid than off grid.
@ -222,9 +222,9 @@ void SCH_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
snapToGrid = true;
if( snapToGrid )
pos = screen->GetNearestGridPosition( pos );
pos = GetNearestGridPosition( pos );
oldpos = screen->GetCrossHairPosition();
oldpos = GetCrossHairPosition();
gridSize = screen->GetGridSize();
switch( aHotKey )
@ -261,14 +261,14 @@ void SCH_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
}
// Update cursor position.
screen->SetCrossHairPosition( pos, snapToGrid );
SetCrossHairPosition( pos, snapToGrid );
if( oldpos != screen->GetCrossHairPosition() )
if( oldpos != GetCrossHairPosition() )
{
pos = screen->GetCrossHairPosition();
screen->SetCrossHairPosition( oldpos, false);
pos = GetCrossHairPosition();
SetCrossHairPosition( oldpos, false);
m_canvas->CrossHairOff( aDC );
screen->SetCrossHairPosition( pos, snapToGrid );
SetCrossHairPosition( pos, snapToGrid );
m_canvas->CrossHairOn( aDC );
if( m_canvas->IsMouseCaptured() )
@ -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 )
{
wxRealPoint gridSize;
SCH_SCREEN* screen = GetScreen();
wxPoint oldpos;
wxPoint pos = aPosition;
@ -320,10 +319,10 @@ void LIB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
snapToGrid = true;
if( snapToGrid )
pos = screen->GetNearestGridPosition( pos );
pos = GetNearestGridPosition( pos );
oldpos = screen->GetCrossHairPosition();
gridSize = screen->GetGridSize();
oldpos = GetCrossHairPosition();
gridSize = GetScreen()->GetGridSize();
switch( aHotKey )
{
@ -359,14 +358,14 @@ void LIB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
}
// Update the cursor position.
screen->SetCrossHairPosition( pos, snapToGrid );
SetCrossHairPosition( pos, snapToGrid );
if( oldpos != screen->GetCrossHairPosition() )
if( oldpos != GetCrossHairPosition() )
{
pos = screen->GetCrossHairPosition();
screen->SetCrossHairPosition( oldpos, false );
pos = GetCrossHairPosition();
SetCrossHairPosition( oldpos, false );
m_canvas->CrossHairOff( aDC );
screen->SetCrossHairPosition( pos, snapToGrid );
SetCrossHairPosition( pos, snapToGrid );
m_canvas->CrossHairOn( aDC );
if( m_canvas->IsMouseCaptured() )
@ -403,8 +402,8 @@ void LIB_VIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
wxPoint oldpos;
wxPoint pos = aPosition;
pos = screen->GetNearestGridPosition( pos );
oldpos = screen->GetCrossHairPosition();
pos = GetNearestGridPosition( pos );
oldpos = GetCrossHairPosition();
gridSize = screen->GetGridSize();
switch( aHotKey )
@ -441,14 +440,14 @@ void LIB_VIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
}
// Update cursor position.
screen->SetCrossHairPosition( pos );
SetCrossHairPosition( pos );
if( oldpos != screen->GetCrossHairPosition() )
if( oldpos != GetCrossHairPosition() )
{
pos = screen->GetCrossHairPosition();
screen->SetCrossHairPosition( oldpos );
pos = GetCrossHairPosition();
SetCrossHairPosition( oldpos );
m_canvas->CrossHairOff( aDC );
screen->SetCrossHairPosition( pos );
SetCrossHairPosition( pos );
m_canvas->CrossHairOn( aDC );
if( m_canvas->IsMouseCaptured() )

View File

@ -205,7 +205,7 @@ void DIALOG_ERC::OnLeftClickMarkersList( wxCommandEvent& event )
}
m_lastMarkerFound = marker;
m_parent->GetScreen()->SetCrossHairPosition( marker->m_Pos );
m_parent->SetCrossHairPosition( marker->m_Pos );
m_parent->RedrawScreen( marker->m_Pos, false);
}
@ -218,7 +218,7 @@ void DIALOG_ERC::OnLeftDblClickMarkersList( wxCommandEvent& event )
// (NULL if not found)
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);
// prevent a mouse left button release event in
// coming from the ERC dialog double click

View File

@ -93,7 +93,7 @@ static void moveBitmap( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosit
}
// 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 );
}
@ -116,7 +116,7 @@ SCH_BITMAP* SCH_EDIT_FRAME::CreateNewImage( wxDC* aDC )
return NULL;
}
wxPoint pos = GetScreen()->GetCrossHairPosition();
wxPoint pos = GetCrossHairPosition();
SCH_BITMAP* image = new SCH_BITMAP( pos );
@ -149,7 +149,7 @@ void SCH_EDIT_FRAME::MoveImage( SCH_BITMAP* aImageItem, wxDC* aDC )
SetUndoItem( aImageItem );
m_canvas->CrossHairOff( aDC );
GetScreen()->SetCrossHairPosition( aImageItem->GetPosition() );
SetCrossHairPosition( aImageItem->GetPosition() );
m_canvas->MoveCursorToCrossHair();
m_canvas->CrossHairOn( aDC );

View File

@ -77,20 +77,20 @@ SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* aDC, int aType )
switch( aType )
{
case LAYER_NOTES:
textItem = new SCH_TEXT( GetScreen()->GetCrossHairPosition() );
textItem = new SCH_TEXT( GetCrossHairPosition() );
break;
case LAYER_LOCLABEL:
textItem = new SCH_LABEL( GetScreen()->GetCrossHairPosition() );
textItem = new SCH_LABEL( GetCrossHairPosition() );
break;
case LAYER_HIERLABEL:
textItem = new SCH_HIERLABEL( GetScreen()->GetCrossHairPosition() );
textItem = new SCH_HIERLABEL( GetCrossHairPosition() );
textItem->SetShape( lastGlobalLabelShape );
break;
case LAYER_GLOBLABEL:
textItem = new SCH_GLOBALLABEL( GetScreen()->GetCrossHairPosition() );
textItem = new SCH_GLOBALLABEL( GetCrossHairPosition() );
textItem->SetShape( lastGlobalLabelShape );
break;

View File

@ -90,7 +90,7 @@ void SCH_EDIT_FRAME::OnFindDrcMarker( wxFindDialogEvent& event )
m_CurrentSheet->UpdateAllScreenReferences();
}
sheetFoundIn->LastScreen()->SetCrossHairPosition( lastMarker->GetPosition() );
SetCrossHairPosition( lastMarker->GetPosition() );
RedrawScreen( lastMarker->GetPosition(), warpCursor );
@ -213,7 +213,7 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& aReference,
if( centerAndRedraw )
{
GetScreen()->SetCrossHairPosition(pos);
SetCrossHairPosition( pos );
RedrawScreen( pos, aWarpMouse );
}
@ -226,7 +226,7 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& aReference,
if( aWarpMouse )
m_canvas->MoveCursor( pos );
GetScreen()->SetCrossHairPosition(pos);
SetCrossHairPosition( pos );
m_canvas->CrossHairOn( &dc );
}
@ -351,7 +351,8 @@ void SCH_EDIT_FRAME::OnFindSchematicItem( wxFindDialogEvent& aEvent )
SetScreen( sheet->LastScreen() );
}
sheet->LastScreen()->SetCrossHairPosition( data.GetPosition() );
// careful here
SetCrossHairPosition( data.GetPosition() );
RedrawScreen( data.GetPosition(), warpCursor );

View File

@ -231,7 +231,7 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* aDC,
SCH_COMPONENT* component;
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
// Note if Entry is found, and if Name is an alias of a component,

View File

@ -284,12 +284,12 @@ void SCH_EDIT_FRAME::DisplayCurrentSheet()
{
Zoom_Automatique( false );
screen->m_FirstRedraw = false;
screen->SetCrossHairPosition( screen->GetScrollCenterPosition() );
SetCrossHairPosition( GetScrollCenterPosition() );
m_canvas->MoveCursorToCrossHair();
}
else
{
RedrawScreen( screen->GetScrollCenterPosition(), true );
RedrawScreen( GetScrollCenterPosition(), true );
}
// Now refresh m_canvas. Should be not necessary, but because screen has changed

View File

@ -74,14 +74,14 @@
*/
/* local variables */
/* Hotkey list: */
// local variables
// Hotkey list:
/**
* Common commands
*/
/* Fit on Screen */
// Fit on Screen
#if !defined( __WXMAC__ )
static EDA_HOTKEY HkZoomAuto( wxT( "Fit on Screen" ), HK_ZOOM_AUTO, WXK_HOME, ID_ZOOM_PAGE );
#else
@ -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,
ID_POPUP_ZOOM_CENTER );
/* Refresh Screen */
// Refresh Screen
#if !defined( __WXMAC__ )
static EDA_HOTKEY HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3, ID_ZOOM_REDRAW );
#else
@ -100,14 +100,14 @@ static EDA_HOTKEY HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, GR_KB_CTRL
ID_ZOOM_REDRAW );
#endif
/* Zoom In */
// Zoom In
#if !defined( __WXMAC__ )
static EDA_HOTKEY HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, WXK_F1, ID_POPUP_ZOOM_IN );
#else
static EDA_HOTKEY HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, GR_KB_CTRL + '+', ID_POPUP_ZOOM_IN );
#endif
/* Zoom Out */
// Zoom Out
#if !defined( __WXMAC__ )
static EDA_HOTKEY HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2, ID_POPUP_ZOOM_OUT );
#else
@ -115,13 +115,13 @@ static EDA_HOTKEY HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, GR_KB_CTRL + '-', I
#endif
static EDA_HOTKEY HkHelp( wxT( "Help (this window)" ), HK_HELP, '?' );
static EDA_HOTKEY HkResetLocalCoord( wxT( "Reset Local Coordinates" ),
HK_RESET_LOCAL_COORD, ' ' );
static EDA_HOTKEY HkResetLocalCoord( wxT( "Reset Local Coordinates" ), HK_RESET_LOCAL_COORD, ' ' );
/* Undo */
// Undo
static EDA_HOTKEY HkUndo( wxT( "Undo" ), HK_UNDO, GR_KB_CTRL + 'Z', (int) wxID_UNDO );
/* Redo */
// Redo
#if !defined( __WXMAC__ )
static EDA_HOTKEY HkRedo( wxT( "Redo" ), HK_REDO, GR_KB_CTRL + 'Y', (int) wxID_REDO );
#else
@ -358,8 +358,8 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
DisplayHotkeyList( this, s_Schematic_Hokeys_Descr );
break;
case HK_RESET_LOCAL_COORD: /* Reset the relative coord */
GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition();
case HK_RESET_LOCAL_COORD: // Reset the relative coord
GetScreen()->m_O_Curseur = GetCrossHairPosition();
break;
case HK_ZOOM_IN:
@ -561,8 +561,8 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
DisplayHotkeyList( this, s_Libedit_Hokeys_Descr );
break;
case HK_RESET_LOCAL_COORD: /* Reset the relative coord */
GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition();
case HK_RESET_LOCAL_COORD: // Reset the relative coord
GetScreen()->m_O_Curseur = GetCrossHairPosition();
break;
case HK_ZOOM_IN:

View File

@ -218,7 +218,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent,
GetScreen()->m_Center = true;
GetScreen()->SetCrossHairPosition( wxPoint( 0, 0 ) );
SetCrossHairPosition( wxPoint( 0, 0 ) );
LoadSettings();
@ -402,7 +402,7 @@ double LIB_EDIT_FRAME::BestZoom()
BoundaryBox = m_component->GetBoundingBox( m_unit, m_convert );
dx = BoundaryBox.GetWidth();
dy = BoundaryBox.GetHeight();
GetScreen()->SetScrollCenterPosition( wxPoint( 0, 0 ) );
SetScrollCenterPosition( wxPoint( 0, 0 ) );
}
else
{
@ -411,7 +411,7 @@ double LIB_EDIT_FRAME::BestZoom()
dx = pageInfo.GetSizeIU().x;
dy = pageInfo.GetSizeIU().y;
GetScreen()->SetScrollCenterPosition( wxPoint( 0, 0 ) );
SetScrollCenterPosition( wxPoint( 0, 0 ) );
}
size = m_canvas->GetClientSize();
@ -753,7 +753,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
STATUS_FLAGS oldFlags = m_drawItem->GetFlags();
m_drawItem->ClearFlags();
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->SetFlags( oldFlags );
m_lastDrawItem = NULL;
@ -1139,7 +1139,7 @@ LIB_ITEM* LIB_EDIT_FRAME::LocateItemUsingCursor( const wxPoint& aPosition,
if( item == NULL )
return NULL;
wxPoint pos = GetScreen()->GetNearestGridPosition( aPosition );
wxPoint pos = GetNearestGridPosition( aPosition );
if( item == NULL && aPosition != pos )
item = locateItem( pos, aFilterList );

View File

@ -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 )
{
SCH_SCREEN* screen = frame->GetScreen();
wxPoint pos = screen->GetCrossHairPosition();
wxString msg;
wxPoint pos = frame->GetCrossHairPosition();
wxString msg;
if( Wire == NULL )
{
@ -691,9 +691,9 @@ void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame )
AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_CONNECTION, _( "Delete Connection" ),
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" ),
KiBitmap( break_line_xpm ) );
@ -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 )
{
wxPoint pos = frame->GetScreen()->GetCrossHairPosition();
wxString msg;
wxPoint pos = frame->GetCrossHairPosition();
wxString msg;
if( Bus == NULL )
{

View File

@ -210,7 +210,7 @@ void LIB_EDIT_FRAME::PlacePin()
return;
}
newpos = GetScreen()->GetCrossHairPosition( true );
newpos = GetCrossHairPosition( true );
// Test for an other pin in same new position:
for( Pin = m_component->GetNextPin(); Pin != NULL; Pin = m_component->GetNextPin( Pin ) )
@ -308,7 +308,7 @@ void LIB_EDIT_FRAME::StartMovePin( wxDC* DC )
startPos.x = OldPos.x;
startPos.y = -OldPos.y;
// m_canvas->CrossHairOff( DC );
GetScreen()->SetCrossHairPosition( startPos );
SetCrossHairPosition( startPos );
m_canvas->MoveCursorToCrossHair();
MSG_PANEL_ITEMS items;
@ -350,7 +350,7 @@ static void DrawMovePin( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi
}
// 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,
&showPinText, DefaultTransform );
@ -388,7 +388,7 @@ void LIB_EDIT_FRAME::CreatePin( wxDC* DC )
if( SynchronizePins() )
pin->SetFlags( IS_LINKED );
pin->Move( GetScreen()->GetCrossHairPosition( true ) );
pin->Move( GetCrossHairPosition( true ) );
pin->SetLength( LastPinLength );
pin->SetOrientation( LastPinOrient );
pin->SetType( LastPinType );
@ -555,10 +555,10 @@ void LIB_EDIT_FRAME::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin )
if( SynchronizePins() )
Pin->SetFlags( IS_LINKED );
wxPoint savepos = GetScreen()->GetCrossHairPosition();
wxPoint savepos = GetCrossHairPosition();
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
m_drawItem = Pin;
@ -566,7 +566,7 @@ void LIB_EDIT_FRAME::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin )
PlacePin();
m_lastDrawItem = Pin;
GetScreen()->SetCrossHairPosition( savepos );
SetCrossHairPosition( savepos );
m_canvas->CrossHairOn( DC );
MSG_PANEL_ITEMS items;

View File

@ -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() );
return GetScreen()->GetOriginAxisPosition();
return GetScreen()->GetAuxOrigin();
}
void SCH_BASE_FRAME::SetOriginAxisPosition( const wxPoint& aPosition )
void SCH_BASE_FRAME::SetAuxOrigin( const wxPoint& aPosition )
{
wxASSERT( GetScreen() );
GetScreen()->SetOriginAxisPosition( aPosition );
GetScreen()->SetAuxOrigin( aPosition );
}
@ -113,8 +113,8 @@ void SCH_BASE_FRAME::UpdateStatusBar()
EDA_DRAW_FRAME::UpdateStatusBar();
// Display absolute coordinates:
double dXpos = To_User_Unit( g_UserUnit, screen->GetCrossHairPosition().x );
double dYpos = To_User_Unit( g_UserUnit, screen->GetCrossHairPosition().y );
double dXpos = To_User_Unit( g_UserUnit, GetCrossHairPosition().x );
double dYpos = To_User_Unit( g_UserUnit, GetCrossHairPosition().y );
if ( g_UserUnit == MILLIMETRES )
{
@ -147,8 +147,9 @@ void SCH_BASE_FRAME::UpdateStatusBar()
SetStatusText( line, 2 );
// Display relative coordinates:
dx = screen->GetCrossHairPosition().x - screen->m_O_Curseur.x;
dy = screen->GetCrossHairPosition().y - screen->m_O_Curseur.y;
dx = GetCrossHairPosition().x - screen->m_O_Curseur.x;
dy = GetCrossHairPosition().y - screen->m_O_Curseur.y;
dXpos = To_User_Unit( g_UserUnit, dx );
dYpos = To_User_Unit( g_UserUnit, dy );

View File

@ -132,7 +132,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break;
case wxID_PASTE:
HandleBlockBegin( &dc, BLOCK_PASTE, screen->GetCrossHairPosition() );
HandleBlockBegin( &dc, BLOCK_PASTE, GetCrossHairPosition() );
break;
case ID_POPUP_SCH_ENTRY_SELECT_SLASH:
@ -165,12 +165,12 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_BEGIN_WIRE:
m_canvas->MoveCursorToCrossHair();
OnLeftClick( &dc, screen->GetCrossHairPosition() );
OnLeftClick( &dc, GetCrossHairPosition() );
break;
case ID_POPUP_SCH_BEGIN_BUS:
m_canvas->MoveCursorToCrossHair();
OnLeftClick( &dc, screen->GetCrossHairPosition() );
OnLeftClick( &dc, GetCrossHairPosition() );
break;
case ID_POPUP_SCH_SET_SHAPE_TEXT:
@ -194,7 +194,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
oldWires.SetOwnership( false ); // Prevent DLIST for deleting items in destructor.
m_canvas->MoveCursorToCrossHair();
screen->ExtractWires( oldWires, true );
screen->BreakSegment( screen->GetCrossHairPosition() );
screen->BreakSegment( GetCrossHairPosition() );
if( oldWires.GetCount() != 0 )
{
@ -344,7 +344,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_ADD_JUNCTION:
m_canvas->MoveCursorToCrossHair();
screen->SetCurItem( AddJunction( &dc, screen->GetCrossHairPosition(), true ) );
screen->SetCurItem( AddJunction( &dc, GetCrossHairPosition(), true ) );
screen->TestDanglingEnds( m_canvas, &dc );
screen->SetCurItem( NULL );
break;
@ -588,7 +588,7 @@ void SCH_EDIT_FRAME::DeleteConnection( bool aFullConnection )
{
PICKED_ITEMS_LIST pickList;
SCH_SCREEN* screen = GetScreen();
wxPoint pos = screen->GetCrossHairPosition();
wxPoint pos = GetCrossHairPosition();
if( screen->GetConnection( pos, pickList, aFullConnection ) != 0 )
{
@ -603,7 +603,7 @@ bool SCH_EDIT_FRAME::DeleteItemAtCrossHair( wxDC* DC )
SCH_ITEM* item;
SCH_SCREEN* screen = GetScreen();
item = LocateItem( screen->GetCrossHairPosition(), SCH_COLLECTOR::ParentItems );
item = LocateItem( GetCrossHairPosition(), SCH_COLLECTOR::ParentItems );
if( item )
{
@ -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 );
#endif
item->SetPosition( screen->GetCrossHairPosition() );
item->SetPosition( aPanel->GetParent()->GetCrossHairPosition() );
// Draw the item item at it's new position.
item->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
@ -713,7 +713,7 @@ void SCH_EDIT_FRAME::MoveItem( SCH_ITEM* aItem, wxDC* aDC )
m_canvas->CrossHairOff( aDC );
if( aItem->Type() != SCH_SHEET_PIN_T )
GetScreen()->SetCrossHairPosition( aItem->GetPosition() );
SetCrossHairPosition( aItem->GetPosition() );
m_canvas->MoveCursorToCrossHair();
@ -959,7 +959,7 @@ void SCH_EDIT_FRAME::OnDragItem( wxCommandEvent& aEvent )
// is to simulate a block drag command
if( screen->m_BlockLocate.GetState() == STATE_NO_BLOCK )
{
if( !HandleBlockBegin( &dc, BLOCK_DRAG, screen->GetCrossHairPosition() ) )
if( !HandleBlockBegin( &dc, BLOCK_DRAG, GetCrossHairPosition() ) )
break;
// Give a non null size to the search block:

View File

@ -501,7 +501,7 @@ double SCH_EDIT_FRAME::BestZoom()
double bestzoom = std::max( zx, zy );
GetScreen()->SetScrollCenterPosition( wxPoint( dx / 2, dy / 2 ) );
SetScrollCenterPosition( wxPoint( dx / 2, dy / 2 ) );
return bestzoom;
}

View File

@ -244,8 +244,8 @@ static void MoveOrResizeSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
if( sheet->IsResized() )
{
int width = screen->GetCrossHairPosition().x - sheet->GetPosition().x;
int height = screen->GetCrossHairPosition().y - sheet->GetPosition().y;
int width = aPanel->GetParent()->GetCrossHairPosition().x - sheet->GetPosition().x;
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.
width = ( width < MIN_SHEET_WIDTH ) ? MIN_SHEET_WIDTH : width;
@ -263,12 +263,13 @@ static void MoveOrResizeSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
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 ) );
}
else if( sheet->IsMoving() )
{
moveVector = screen->GetCrossHairPosition() - pos;
moveVector = aPanel->GetParent()->GetCrossHairPosition() - pos;
sheet->Move( moveVector );
}
@ -324,7 +325,7 @@ SCH_SHEET* SCH_EDIT_FRAME::CreateSheet( wxDC* aDC )
{
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->SetTimeStamp( GetNewTimeStamp() );
@ -338,7 +339,9 @@ SCH_SHEET* SCH_EDIT_FRAME::CreateSheet( wxDC* aDC )
m_canvas->SetMouseCapture( MoveOrResizeSheet, ExitSheet );
m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false );
m_canvas->CrossHairOff( aDC );
GetScreen()->SetCrossHairPosition( sheet->GetResizePosition() );
SetCrossHairPosition( sheet->GetResizePosition() );
m_canvas->MoveCursorToCrossHair();
m_canvas->CrossHairOn( aDC );
@ -356,7 +359,7 @@ void SCH_EDIT_FRAME::ReSizeSheet( SCH_SHEET* aSheet, wxDC* aDC )
GetChars( aSheet->GetClass() ) ) );
m_canvas->CrossHairOff( aDC );
GetScreen()->SetCrossHairPosition( aSheet->GetResizePosition() );
SetCrossHairPosition( aSheet->GetResizePosition() );
m_canvas->MoveCursorToCrossHair();
m_canvas->CrossHairOn( aDC );
@ -377,7 +380,7 @@ void SCH_EDIT_FRAME::StartMoveSheet( SCH_SHEET* aSheet, wxDC* aDC )
return;
m_canvas->CrossHairOff( aDC );
GetScreen()->SetCrossHairPosition( aSheet->GetPosition() );
SetCrossHairPosition( aSheet->GetPosition() );
m_canvas->MoveCursorToCrossHair();
if( !aSheet->IsNew() )

View File

@ -136,7 +136,7 @@ static void AbortSymbolTraceOn( EDA_DRAW_PANEL* Panel, wxDC* DC )
return;
bool newItem = item->IsNew();
item->EndEdit( parent->GetScreen()->GetCrossHairPosition( true ), true );
item->EndEdit( parent->GetCrossHairPosition( true ), true );
if( newItem )
{
@ -153,7 +153,7 @@ static void AbortSymbolTraceOn( EDA_DRAW_PANEL* Panel, wxDC* DC )
LIB_ITEM* LIB_EDIT_FRAME::CreateGraphicItem( LIB_COMPONENT* LibEntry, wxDC* DC )
{
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
// This is normal when adding new items to the current component
@ -239,7 +239,7 @@ void LIB_EDIT_FRAME::GraphicItemBeginDraw( wxDC* DC )
if( m_drawItem == NULL )
return;
wxPoint pos = GetScreen()->GetCrossHairPosition( true );
wxPoint pos = GetCrossHairPosition( true );
if( m_drawItem->ContinueEdit( pos ) )
{
@ -264,21 +264,20 @@ static void RedrawWhileMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
if( item == NULL )
return;
BASE_SCREEN* Screen = aPanel->GetScreen();
item->SetEraseLastDrawItem( aErase );
// if item is the reference field, we must add the current unit id
if( item->Type() == LIB_FIELD_T )
{
int unit = ((LIB_EDIT_FRAME*)aPanel->GetParent())->GetUnit();
wxString text = ((LIB_FIELD*)item)->GetFullText( unit );
item->Draw( aPanel, aDC, Screen->GetCrossHairPosition( true ),
int unit = ((LIB_EDIT_FRAME*)aPanel->GetParent())->GetUnit();
wxString text = ((LIB_FIELD*)item)->GetFullText( unit );
item->Draw( aPanel, aDC, aPanel->GetParent()->GetCrossHairPosition( true ),
UNSPECIFIED_COLOR, g_XorMode, &text,
DefaultTransform );
}
else
item->Draw( aPanel, aDC, Screen->GetCrossHairPosition( true ),
item->Draw( aPanel, aDC, aPanel->GetParent()->GetCrossHairPosition( true ),
UNSPECIFIED_COLOR, g_XorMode, NULL,
DefaultTransform );
}
@ -298,7 +297,7 @@ void LIB_EDIT_FRAME::StartMoveDrawSymbol( wxDC* DC )
if( m_drawItem->Type() == LIB_FIELD_T )
m_drawItem->BeginEdit( IS_MOVED, m_drawItem->GetPosition() );
else
m_drawItem->BeginEdit( IS_MOVED, GetScreen()->GetCrossHairPosition( true ) );
m_drawItem->BeginEdit( IS_MOVED, GetCrossHairPosition( true ) );
m_canvas->SetMouseCapture( RedrawWhileMovingCursor, AbortSymbolTraceOn );
m_canvas->CallMouseCapture( DC, wxDefaultPosition, true );
@ -312,7 +311,7 @@ void LIB_EDIT_FRAME::StartModifyDrawSymbol( wxDC* DC )
return;
TempCopyComponent();
m_drawItem->BeginEdit( IS_RESIZED, GetScreen()->GetCrossHairPosition( true ) );
m_drawItem->BeginEdit( IS_RESIZED, GetCrossHairPosition( true ) );
m_canvas->SetMouseCapture( SymbolDisplayDraw, AbortSymbolTraceOn );
m_canvas->CallMouseCapture( DC, wxDefaultPosition, true );
}
@ -322,14 +321,13 @@ void LIB_EDIT_FRAME::StartModifyDrawSymbol( wxDC* DC )
static void SymbolDisplayDraw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase )
{
BASE_SCREEN* Screen = aPanel->GetScreen();
LIB_ITEM* item = ( (LIB_EDIT_FRAME*) aPanel->GetParent() )->GetDrawItem();
if( item == NULL )
return;
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 );
}
@ -357,7 +355,7 @@ void LIB_EDIT_FRAME::EndDrawGraphicItem( wxDC* DC )
if( m_drawItem->IsNew() )
m_component->AddDrawItem( m_drawItem );
m_drawItem->EndEdit( GetScreen()->GetCrossHairPosition( true ) );
m_drawItem->EndEdit( GetCrossHairPosition( true ) );
m_drawItem = NULL;

View File

@ -65,7 +65,7 @@ void LIB_EDIT_FRAME::LoadOneSymbol()
if( dlg.ShowModal() == wxID_CANCEL )
return;
GetScreen()->SetCrossHairPosition( wxPoint( 0, 0 ) );
SetCrossHairPosition( wxPoint( 0, 0 ) );
m_canvas->MoveCursorToCrossHair();
m_canvas->SetIgnoreMouseEvents( false );
@ -238,7 +238,9 @@ void LIB_EDIT_FRAME::PlaceAnchor()
if( m_component == NULL )
return;
wxPoint offset( -GetScreen()->GetCrossHairPosition().x, GetScreen()->GetCrossHairPosition().y );
const wxPoint& cross_hair = GetCrossHairPosition();
wxPoint offset( -cross_hair.x, cross_hair.y );
OnModify( );

View File

@ -335,7 +335,7 @@ void LIB_VIEW_FRAME::OnSize( wxSizeEvent& SizeEv )
void LIB_VIEW_FRAME::OnSetRelativeOffset( wxCommandEvent& event )
{
GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition();
GetScreen()->m_O_Curseur = GetCrossHairPosition();
UpdateStatusBar();
}
@ -348,18 +348,16 @@ double LIB_VIEW_FRAME::BestZoom()
* search for line static const int VIEWPORT_EXTENT = 1000;
* and replace by static const int VIEWPORT_EXTENT = 10000;
*/
LIB_COMPONENT* component = NULL;
CMP_LIBRARY* lib;
double bestzoom = 16.0; // default value for bestzoom
lib = CMP_LIBRARY::FindLibrary( m_libraryName );
LIB_COMPONENT* component = NULL;
double bestzoom = 16.0; // default value for bestzoom
CMP_LIBRARY* lib = CMP_LIBRARY::FindLibrary( m_libraryName );
if( lib )
component = lib->FindComponent( m_entryName );
if( component == NULL )
{
GetScreen()->SetScrollCenterPosition( wxPoint( 0, 0 ) );
SetScrollCenterPosition( wxPoint( 0, 0 ) );
return bestzoom;
}
@ -382,7 +380,7 @@ double LIB_VIEW_FRAME::BestZoom()
if( bestzoom < GetScreen()->m_ZoomList[0] )
bestzoom = GetScreen()->m_ZoomList[0];
GetScreen()->SetScrollCenterPosition( BoundaryBox.Centre() );
SetScrollCenterPosition( BoundaryBox.Centre() );
return bestzoom;
}

View File

@ -171,10 +171,11 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
if( screen->m_BlockLocate.GetState() != STATE_BLOCK_STOP )
{
screen->m_BlockLocate.SetMoveVector( wxPoint( screen->GetCrossHairPosition().x -
screen->m_BlockLocate.GetRight(),
screen->GetCrossHairPosition().y -
screen->m_BlockLocate.GetBottom() ) );
const wxPoint& cross_hair = aPanel->GetParent()->GetCrossHairPosition();
screen->m_BlockLocate.SetMoveVector(
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 );
@ -195,10 +196,10 @@ void GERBVIEW_FRAME::Block_Move( wxDC* DC )
wxPoint delta;
wxPoint oldpos;
oldpos = GetScreen()->GetCrossHairPosition();
oldpos = GetCrossHairPosition();
m_canvas->SetMouseCaptureCallback( NULL );
GetScreen()->SetCrossHairPosition( oldpos );
SetCrossHairPosition( oldpos );
m_canvas->MoveCursorToCrossHair();
GetScreen()->SetModify();
GetScreen()->m_BlockLocate.Normalize();

View File

@ -38,12 +38,12 @@ public:
const PAGE_INFO& GetPageSettings() const { return m_paper; }
void SetPageSettings( const PAGE_INFO& aPageSettings ) { m_paper = aPageSettings; }
const wxPoint& GetOriginAxisPosition() const
const wxPoint& GetAuxOrigin() const
{
return m_originAxisPosition;
}
void SetOriginAxisPosition( const wxPoint& aPosition )
void SetAuxOrigin( const wxPoint& aPosition )
{
m_originAxisPosition = aPosition;
}

View File

@ -38,9 +38,9 @@ void GERBVIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
wxPoint oldpos;
wxPoint pos = aPosition;
pos = GetScreen()->GetNearestGridPosition( pos );
pos = GetNearestGridPosition( pos );
oldpos = GetScreen()->GetCrossHairPosition();
oldpos = GetCrossHairPosition();
gridSize = GetScreen()->GetGridSize();
switch( aHotKey )
@ -73,14 +73,14 @@ void GERBVIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
break;
}
GetScreen()->SetCrossHairPosition( pos );
SetCrossHairPosition( pos );
if( oldpos != GetScreen()->GetCrossHairPosition() )
if( oldpos != GetCrossHairPosition() )
{
pos = GetScreen()->GetCrossHairPosition();
GetScreen()->SetCrossHairPosition( oldpos );
pos = GetCrossHairPosition();
SetCrossHairPosition( oldpos );
m_canvas->CrossHairOff( aDC );
GetScreen()->SetCrossHairPosition( pos );
SetCrossHairPosition( pos );
m_canvas->CrossHairOn( aDC );
if( m_canvas->IsMouseCaptured() )

View File

@ -196,7 +196,7 @@ double GERBVIEW_FRAME::BestZoom()
double x = (double) bbox.GetWidth() / (double) size.x;
double y = (double) bbox.GetHeight() / (double) size.y;
GetScreen()->SetScrollCenterPosition( bbox.Centre() );
SetScrollCenterPosition( bbox.Centre() );
double best_zoom = std::max( x, y );
return best_zoom;
@ -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 );
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 );
m_gerberLayout->SetOriginAxisPosition( aPosition );
m_gerberLayout->SetAuxOrigin( aPosition );
}
@ -800,8 +800,8 @@ void GERBVIEW_FRAME::UpdateStatusBar()
{
double theta, ro;
dx = screen->GetCrossHairPosition().x - screen->m_O_Curseur.x;
dy = screen->GetCrossHairPosition().y - screen->m_O_Curseur.y;
dx = GetCrossHairPosition().x - screen->m_O_Curseur.x;
dy = GetCrossHairPosition().y - screen->m_O_Curseur.y;
// atan2 in the 0,0 case returns 0
theta = RAD2DEG( atan2( -dy, dx ) );
@ -829,9 +829,8 @@ void GERBVIEW_FRAME::UpdateStatusBar()
}
// Display absolute coordinates:
dXpos = To_User_Unit( g_UserUnit, screen->GetCrossHairPosition().x );
dYpos = To_User_Unit( g_UserUnit, screen->GetCrossHairPosition().y );
dXpos = To_User_Unit( g_UserUnit, GetCrossHairPosition().x );
dYpos = To_User_Unit( g_UserUnit, GetCrossHairPosition().y );
wxString absformatter;
@ -859,8 +858,8 @@ void GERBVIEW_FRAME::UpdateStatusBar()
if( !m_DisplayOptions.m_DisplayPolarCood ) // display relative cartesian coordinates
{
// Display relative coordinates:
dx = screen->GetCrossHairPosition().x - screen->m_O_Curseur.x;
dy = screen->GetCrossHairPosition().y - screen->m_O_Curseur.y;
dx = GetCrossHairPosition().x - screen->m_O_Curseur.x;
dy = GetCrossHairPosition().y - screen->m_O_Curseur.y;
dXpos = To_User_Unit( g_UserUnit, dx );
dYpos = To_User_Unit( g_UserUnit, dy );

View File

@ -82,7 +82,9 @@ public:
class GERBVIEW_FRAME : public EDA_DRAW_FRAME // PCB_BASE_FRAME
{
GBR_LAYOUT* m_gerberLayout;
GBR_LAYOUT* m_gerberLayout;
wxPoint m_grid_origin;
public:
GBR_DISPLAY_OPTIONS m_DisplayOptions;
@ -126,8 +128,14 @@ public:
const PAGE_INFO& GetPageSettings() const; // overload
const wxSize GetPageSizeIU() const; // overload
const wxPoint& GetOriginAxisPosition() const; // overload
void SetOriginAxisPosition( const wxPoint& aPosition ); // overload
const wxPoint& GetAuxOrigin() const; // 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
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ); // overload

View File

@ -31,30 +31,28 @@
* and see this list for some ascii keys (space ...)
*/
/* local variables */
/* Hotkey list: */
static EDA_HOTKEY HkResetLocalCoord( wxT( "Reset Local Coordinates" ),
HK_RESET_LOCAL_COORD, ' ' );
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 HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3 );
static EDA_HOTKEY HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2 );
static EDA_HOTKEY HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, WXK_F1 );
static EDA_HOTKEY HkHelp( wxT( "Help (this window)" ), HK_HELP, '?' );
static EDA_HOTKEY HkSwitchUnits( wxT( "Switch Units" ), HK_SWITCH_UNITS, 'U' );
static EDA_HOTKEY HkTrackDisplayMode( wxT( "Track Display Mode" ),
HK_SWITCH_GBR_ITEMS_DISPLAY_MODE, 'F' );
// local variables
// Hotkey list:
static EDA_HOTKEY HkResetLocalCoord( wxT( "Reset Local Coordinates" ), HK_RESET_LOCAL_COORD, ' ' );
static EDA_HOTKEY HkSetGridOrigin( wxT("Set Grid Origin"), HK_SET_GRID_ORIGIN, 'S' );
static EDA_HOTKEY HkSwitch2NextCopperLayer( wxT( "Switch to Next Layer" ),
HK_SWITCH_LAYER_TO_NEXT, '+' );
static EDA_HOTKEY HkSwitch2PreviousCopperLayer( wxT( "Switch to Previous Layer" ),
HK_SWITCH_LAYER_TO_PREVIOUS, '-' );
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 HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3 );
static EDA_HOTKEY HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2 );
static EDA_HOTKEY HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, WXK_F1 );
static EDA_HOTKEY HkHelp( wxT( "Help (this window)" ), HK_HELP, '?' );
static EDA_HOTKEY HkSwitchUnits( wxT( "Switch Units" ), HK_SWITCH_UNITS, 'U' );
static EDA_HOTKEY HkTrackDisplayMode( wxT( "Track Display Mode" ), HK_SWITCH_GBR_ITEMS_DISPLAY_MODE, 'F' );
static EDA_HOTKEY HkSwitch2NextCopperLayer( wxT( "Switch to Next Layer" ), HK_SWITCH_LAYER_TO_NEXT, '+' );
static EDA_HOTKEY HkSwitch2PreviousCopperLayer( wxT( "Switch to Previous Layer" ), HK_SWITCH_LAYER_TO_PREVIOUS, '-' );
// List of common hotkey descriptors
EDA_HOTKEY* s_Gerbview_Hotkey_List[] = {
&HkHelp,
&HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter,
&HkZoomAuto, &HkSwitchUnits, &HkResetLocalCoord,
&HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter,
&HkZoomAuto, &HkSwitchUnits, &HkResetLocalCoord, &HkSetGridOrigin,
&HkTrackDisplayMode,
&HkSwitch2NextCopperLayer,
&HkSwitch2PreviousCopperLayer,
@ -130,8 +128,12 @@ void GERBVIEW_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_RESET_LOCAL_COORD: /*Reset the relative coord */
GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition();
case HK_RESET_LOCAL_COORD: // Reset the relative coord
GetScreen()->m_O_Curseur = GetCrossHairPosition();
break;
case HK_SET_GRID_ORIGIN:
SetGridOrigin( GetCrossHairPosition() );
break;
case HK_SWITCH_UNITS:

View File

@ -44,7 +44,7 @@ GERBER_DRAW_ITEM* GERBVIEW_FRAME::Locate( const wxPoint& aPosition, int aTypeloc
bool found = false;
if( aTypeloc == CURSEUR_ON_GRILLE )
ref = GetScreen()->GetNearestGridPosition( ref );
ref = GetNearestGridPosition( ref );
LAYER_NUM layer = getActiveLayer();

View File

@ -75,53 +75,134 @@ typedef std::vector< GRID_TYPE > GRIDS;
class BASE_SCREEN : public EDA_ITEM
{
private:
GRIDS m_grids; ///< List of valid grid sizes.
bool m_FlagModified; ///< Indicates current drawing has been modified.
bool m_FlagSave; ///< Indicates automatic file save.
EDA_ITEM* m_CurrentItem; ///< Currently selected object
GRID_TYPE m_Grid; ///< Current grid selection.
wxPoint m_scrollCenter; ///< Current scroll center point in logical units.
wxPoint m_MousePosition; ///< Mouse cursor coordinate in logical units.
GRIDS m_grids; ///< List of valid grid sizes.
bool m_FlagModified; ///< Indicates current drawing has been modified.
bool m_FlagSave; ///< Indicates automatic file save.
EDA_ITEM* m_CurrentItem; ///< Currently selected object
GRID_TYPE m_Grid; ///< Current grid selection.
wxPoint m_scrollCenter; ///< Current scroll center point in logical units.
wxPoint m_MousePosition; ///< Mouse cursor coordinate in logical units.
/**
* The cross hair position in logical (drawing) units. The cross hair is not the cursor
* position. It is an addition indicator typically drawn on grid to indicate to the
* user where the current action will be performed.
*/
wxPoint m_crossHairPosition;
wxPoint m_crossHairPosition;
double m_Zoom; ///< Current zoom coefficient.
double m_Zoom; ///< Current zoom coefficient.
//----< Old public API now is private, and migratory>------------------------
// called only from EDA_DRAW_FRAME
friend class EDA_DRAW_FRAME;
/**
* 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
{
if( aInvertY )
return wxPoint( m_crossHairPosition.x, -m_crossHairPosition.y );
return wxPoint( m_crossHairPosition.x, m_crossHairPosition.y );
}
/**
* 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, const wxPoint& aGridOrigin, bool aSnapToGrid = true );
/**
* Function getCursorScreenPosition
* returns the cross hair position in device (display) units.b
* @return The current cross hair position.
*/
wxPoint getCrossHairScreenPosition() const;
/**
* Function getNearestGridPosition
* returns the nearest \a aGridSize location to \a aPosition.
* @param aPosition The position to check.
* @param aGridOrigin The origin point of the snap grid.
* @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, const wxPoint& aGridOrigin,
wxRealPoint* aGridSize = NULL ) const;
/**
* 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, const wxPoint& aGridOrigin, wxRealPoint* aGridSize = NULL ) const;
void setMousePosition( const wxPoint& aPosition ) { m_MousePosition = 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
{
return useMouse ? m_MousePosition : m_crossHairPosition;
}
const wxPoint& getScrollCenterPosition() const { return m_scrollCenter; }
void setScrollCenterPosition( const wxPoint& aPoint ) { m_scrollCenter = aPoint; }
//----</Old public API now is private, and migratory>------------------------
public:
static wxString m_PageLayoutDescrFileName; ///< the name of the page layout descr file,
///< or emty to used the default pagelayout
wxPoint m_DrawOrg; ///< offsets for drawing the circuit on the screen
wxPoint m_O_Curseur; ///< Relative Screen cursor coordinate (on grid)
///< in user units. (coordinates from last reset position)
wxPoint m_DrawOrg; ///< offsets for drawing the circuit on the screen
wxPoint m_O_Curseur; ///< Relative Screen cursor coordinate (on grid)
///< in user units. (coordinates from last reset position)
// Scrollbars management:
int m_ScrollPixelsPerUnitX; ///< Pixels per scroll unit in the horizontal direction.
int m_ScrollPixelsPerUnitY; ///< Pixels per scroll unit in the vertical direction.
int m_ScrollPixelsPerUnitX; ///< Pixels per scroll unit in the horizontal direction.
int m_ScrollPixelsPerUnitY; ///< Pixels per scroll unit in the vertical direction.
wxSize m_ScrollbarNumber; /* Current virtual draw area size in scroll units.
wxSize m_ScrollbarNumber; /**< Current virtual draw area size in scroll units.
* m_ScrollbarNumber * m_ScrollPixelsPerUnit =
* virtual draw area size in pixels */
wxPoint m_ScrollbarPos; ///< Current scroll bar position in scroll units.
wxPoint m_ScrollbarPos; ///< Current scroll bar position in scroll units.
wxPoint m_StartVisu; /* Coordinates in drawing units of the current
* view position (upper left corner of device)
*/
wxPoint m_StartVisu; /**< Coordinates in drawing units of the current
* view position (upper left corner of device)
*/
bool m_Center; /* Center on screen. If true (0.0) is centered
* on screen coordinates can be < 0 and
* > 0 except for schematics.
* false: when coordinates can only be >= 0
* Schematic */
bool m_FirstRedraw;
bool m_Center; /**< Center on screen. If true (0.0) is centered
* on screen coordinates can be < 0 and
* > 0 except for schematics.
* false: when coordinates can only be >= 0
* Schematic */
bool m_FirstRedraw;
// Undo/redo list of commands
UNDO_REDO_CONTAINER m_UndoList; ///< Objects list for the undo command (old data)
@ -134,8 +215,6 @@ public:
int m_ScreenNumber;
int m_NumberOfScreens;
wxPoint m_GridOrigin;
std::vector<double> m_ZoomList; ///< standard zoom (i.e. scale) coefficients.
bool m_IsPrinting;
@ -164,30 +243,6 @@ public:
*/
virtual int MilsToIuScalar() { return 1; }
/**
* 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
{
if( aInvertY )
return wxPoint( m_crossHairPosition.x, -m_crossHairPosition.y );
return wxPoint( m_crossHairPosition.x, m_crossHairPosition.y );
}
/**
* Function SetCrossHairPosition
* sets the screen cross hair position to \a aPosition in logical (drawing) units.
* @param aPosition The new cross hair position.
* @param aSnapToGrid Sets the cross hair position to the nearest grid position to
* \a aPosition.
*
*/
void SetCrossHairPosition( const wxPoint& aPosition, bool aSnapToGrid = true );
/* general Undo/Redo command control */
/**
@ -247,19 +302,17 @@ public:
return m_UndoList.m_CommandsList.size();
}
int GetRedoCommandCount() const
{
return m_RedoList.m_CommandsList.size();
}
void SetModify() { m_FlagModified = true; }
void ClrModify() { m_FlagModified = false;; }
void SetSave() { m_FlagSave = true; }
void ClrSave() { m_FlagSave = false; }
bool IsModify() const { return m_FlagModified; }
bool IsSave() const { return m_FlagSave; }
void SetModify() { m_FlagModified = true; }
void ClrModify() { m_FlagModified = false; }
void SetSave() { m_FlagSave = true; }
void ClrSave() { m_FlagSave = false; }
bool IsModify() const { return m_FlagModified; }
bool IsSave() const { return m_FlagSave; }
//----<zoom stuff>---------------------------------------------------------
@ -349,8 +402,6 @@ public:
*/
const GRID_TYPE& GetGrid() const { return m_Grid; }
const wxPoint& GetGridOrigin() const { return m_GridOrigin; }
void SetGrid( const wxRealPoint& size );
/**
@ -388,51 +439,6 @@ public:
*/
void GetGrids( GRIDS& aList );
void SetMousePosition( const wxPoint& aPosition ) { m_MousePosition = 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
{
return useMouse ? m_MousePosition : m_crossHairPosition;
}
/**
* Function GetCursorPosition
* returns the current cursor position in logical (drawing) units.
* @param aOnGrid Returns the nearest grid position at the current cursor position.
* @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 GetCursorScreenPosition
* returns the cross hair position in device (display) units.b
* @return The current cross hair position.
*/
wxPoint GetCrossHairScreenPosition() 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 GetClass
* returns the class name.
@ -447,12 +453,6 @@ public:
void ClearBlockCommand() { m_BlockLocate.Clear(); }
const wxPoint& GetScrollCenterPosition() const { return m_scrollCenter; }
void SetScrollCenterPosition( const wxPoint& aCenterPosition )
{
m_scrollCenter = aCenterPosition;
}
#if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const; // overload
#endif

View File

@ -45,6 +45,8 @@ public:
wxSize m_ModuleTextSize; ///< Default footprint texts size
int m_ModuleTextWidth;
int m_ModuleSegmentWidth;
wxPoint m_AuxOrigin; ///< origin for plot exports
wxPoint m_GridOrigin; ///< origin for grid offsets
D_PAD m_Pad_Master;

View File

@ -55,52 +55,55 @@ typedef void ( *END_MOUSE_CAPTURE_CALLBACK )( EDA_DRAW_PANEL* aPanel, wxDC* aDC
class EDA_DRAW_PANEL : public wxScrolledWindow
{
private:
int m_currentCursor; ///< Current mouse cursor shape id.
int m_defaultCursor; ///< The default mouse cursor shape id.
bool m_showCrossHair; ///< Indicate if cross hair is to be shown.
int m_cursorLevel; ///< Index for cursor redraw in XOR mode.
int m_scrollIncrementX; ///< X 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_PanStartEventPosition; ///< Initial position of mouse event when pan started
int m_currentCursor; ///< Current mouse cursor shape id.
int m_defaultCursor; ///< The default mouse cursor shape id.
bool m_showCrossHair; ///< Indicate if cross hair is to be shown.
int m_cursorLevel; ///< Index for cursor redraw in XOR mode.
int m_scrollIncrementX; ///< X 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_PanStartEventPosition; ///< Initial position of mouse event when pan started
/// The drawing area used to redraw the screen which is usually the visible area
/// 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_enableMiddleButtonPan; ///< True to enable middle mouse button panning.
bool m_panScrollbarLimits; ///< has meaning only if m_enableMiddleButtonPan = true
///< true to limit panning to scrollbar current limits
///< false to used unlimited pan
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_panScrollbarLimits; ///< has meaning only if m_enableMiddleButtonPan = true
///< true to limit panning to scrollbar current limits
///< 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;
bool m_requestAutoPan; ///< true to request an auto pan. Valid only when m_enableAutoPan = true.
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
* (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
* 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
* MinDragEventCount > MIN_DRAG_COUNT_FOR_START_BLOCK_COMMAND
* in order to avoid spurious block commands. */
/**
* Count the drag events. Used to filter mouse moves before starting a
* block command. A block command can be started only if
* 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
/// are oriented, and in mirror mode, orientations are reversed.
bool m_PrintIsMirrored;
bool m_PrintIsMirrored;
/// Mouse capture move callback function.
MOUSE_CAPTURE_CALLBACK m_mouseCaptureCallback;
@ -108,9 +111,10 @@ private:
/// Abort mouse capture callback function.
END_MOUSE_CAPTURE_CALLBACK m_endMouseCaptureCallback;
// useful to avoid false start block in certain cases
// (like switch from a sheet to an other sheet
int m_canStartBlock; // >= 0 (or >= n) if a block can start
/// useful to avoid false start block in certain cases
/// (like switch from a sheet to an other sheet
/// >= 0 (or >= n) if a block can start
int m_canStartBlock;
public:
@ -155,9 +159,8 @@ public:
void SetEnableBlockCommands( bool aEnable ) { m_enableBlockCommands = aEnable; }
bool GetPrintMirrored() const { return m_PrintIsMirrored; }
void SetPrintMirrored( bool aMirror ) { m_PrintIsMirrored = aMirror; }
bool GetPrintMirrored() const { return m_PrintIsMirrored; }
void SetPrintMirrored( bool aMirror ) { m_PrintIsMirrored = aMirror; }
void SetCanStartBlock( int aStartBlock ) { m_canStartBlock = aStartBlock; }
@ -196,8 +199,9 @@ public:
* the grid origin is set by user, and is not (0,0)
* @param aDC = current Device Context
* @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 ) { }
@ -324,7 +328,7 @@ public:
* warps the cursor to the current cross hair position.
*/
void MoveCursorToCrossHair();
/**
* Function ToDeviceXY
* transforms logical to device coordinates

View File

@ -73,8 +73,8 @@ private:
TITLE_BLOCK m_titles;
/// Position of the origin axis, which is used in exports mostly, but not yet in EESCHEMA
wxPoint m_originAxisPosition;
/// Origin of the auxilliary axis, which is used in exports mostly, but not yet in EESCHEMA
wxPoint m_aux_origin;
DLIST< SCH_ITEM > m_drawList; ///< Object list for the screen.
/// @todo use DLIST<SCH_ITEM> or superior container
@ -108,12 +108,12 @@ public:
const PAGE_INFO& GetPageSettings() const { return m_paper; }
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; }
void SetOriginAxisPosition( const wxPoint& aPosition ) { m_originAxisPosition = aPosition; }
const wxPoint& GetAuxOrigin() const { return m_aux_origin; }
void SetAuxOrigin( const wxPoint& aPosition ) { m_aux_origin = aPosition; }
const TITLE_BLOCK& GetTitleBlock() const { return m_titles; }
//TITLE_BLOCK& GetTitleBlock() const { return (TITLE_BLOCK&) m_titles; }

View File

@ -217,6 +217,7 @@ void ParseHotkeyConfig( const wxString& data, struct EDA_HOTKEY_CONFIG* aDescLis
enum common_hotkey_id_commnand {
HK_NOT_FOUND = 0,
HK_RESET_LOCAL_COORD,
HK_SET_GRID_ORIGIN,
HK_HELP,
HK_ZOOM_IN,
HK_ZOOM_OUT,

View File

@ -58,8 +58,15 @@ public:
const PAGE_INFO& GetPageSettings () const; // overload EDA_DRAW_FRAME
const wxSize GetPageSizeIU() const; // overload EDA_DRAW_FRAME
const wxPoint& GetOriginAxisPosition() const; // overload EDA_DRAW_FRAME
void SetOriginAxisPosition( const wxPoint& aPosition ); // overload EDA_DRAW_FRAME
const wxPoint& GetAuxOrigin() const; // 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
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ); // overload EDA_DRAW_FRAME

View File

@ -131,8 +131,11 @@ public:
const PAGE_INFO& GetPageSettings() const; // overload
const wxSize GetPageSizeIU() const; // overload
const wxPoint& GetOriginAxisPosition() const; // overload
void SetOriginAxisPosition( const wxPoint& aPosition ); // overload
const wxPoint& GetAuxOrigin() const; // overload
void SetAuxOrigin( const wxPoint& aPoint ); // overload
const wxPoint& GetGridOrigin() const; // overload
void SetGridOrigin( const wxPoint& aPoint ); // overload
const TITLE_BLOCK& GetTitleBlock() const; // overload
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ); // overload

View File

@ -113,15 +113,15 @@ extern const wxChar* traceAutoSave;
class EDA_BASE_FRAME : public wxFrame
{
protected:
ID_DRAWFRAME_TYPE m_Ident; // Id Type (pcb, schematic, library..)
ID_DRAWFRAME_TYPE m_Ident; ///< Id Type (pcb, schematic, library..)
wxPoint m_FramePos;
wxSize m_FrameSize;
wxAuiToolBar* m_mainToolBar; // Standard horizontal Toolbar
wxAuiToolBar* m_mainToolBar; ///< Standard horizontal Toolbar
bool m_FrameIsActive;
wxString m_FrameName; // name used for writing and reading setup
// It is "SchematicFrame", "PcbFrame" ....
wxString m_AboutTitle; // Name of program displayed in About.
wxString m_FrameName; ///< name used for writing and reading setup
///< It is "SchematicFrame", "PcbFrame" ....
wxString m_AboutTitle; ///< Name of program displayed in About.
wxAuiManager m_auimgr;
@ -404,47 +404,47 @@ protected:
EDA_DRAW_PANEL* m_canvas;
/// 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
/// hair cursor. Set to non-zero value to draw the full screen cursor.
/// @note This is not the system mouse cursor.
int m_cursorShape;
int m_cursorShape;
/// True shows the X and Y axis indicators.
bool m_showAxis;
bool m_showAxis;
/// True shows the grid axis indicators.
bool m_showGridAxis;
bool m_showGridAxis;
/// True shows the origin axis used to indicate the coordinate offset for
/// drill, gerber, and component position files.
bool m_showOriginAxis;
bool m_showOriginAxis;
/// True shows the drawing border and title block.
bool m_showBorderAndTitleBlock;
bool m_showBorderAndTitleBlock;
/// Choice box to choose the grid size.
wxComboBox* m_gridSelectBox;
wxComboBox* m_gridSelectBox;
/// 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
/// 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.
wxAuiToolBar* m_optionsToolBar;
wxAuiToolBar* m_optionsToolBar;
/// 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
// MAC Uses overlay to workaround the wxINVERT and wxXOR miss
wxOverlay m_overlay;
wxOverlay m_overlay;
#endif
protected:
@ -480,8 +480,89 @@ public:
*/
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 void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) = 0;
@ -718,13 +799,13 @@ public:
void DrawWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWidth,
double aScale, const wxString &aFilename );
void DisplayToolMsg( const wxString& msg );
virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) = 0;
virtual void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) = 0;
virtual void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
virtual bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0;
virtual void ToolOnRightClick( wxCommandEvent& event );
void AdjustScrollBars( const wxPoint& aCenterPosition );
void DisplayToolMsg( const wxString& msg );
virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) = 0;
virtual void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) = 0;
virtual void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
virtual bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0;
virtual void ToolOnRightClick( wxCommandEvent& event );
void AdjustScrollBars( const wxPoint& aCenterPosition );
/**
* Function OnActivate (virtual)

View File

@ -33,7 +33,7 @@ public:
m_paper = aPageSettings;
}
const wxPoint& GetOriginAxisPosition() const
const wxPoint& GetAuxOrigin() const
{
static wxPoint zero( 0, 0 );
return zero;

View File

@ -35,14 +35,9 @@
void PL_EDITOR_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition,
int aHotKey )
{
wxRealPoint gridSize;
wxPoint oldpos;
wxPoint pos = aPosition;
pos = GetScreen()->GetNearestGridPosition( pos );
oldpos = GetScreen()->GetCrossHairPosition();
gridSize = GetScreen()->GetGridSize();
wxPoint pos = GetNearestGridPosition( aPosition );
wxPoint oldpos = GetCrossHairPosition();
wxRealPoint gridSize = GetScreen()->GetGridSize();
switch( aHotKey )
{
@ -74,14 +69,14 @@ void PL_EDITOR_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition,
break;
}
GetScreen()->SetCrossHairPosition( pos );
SetCrossHairPosition( pos );
if( oldpos != GetScreen()->GetCrossHairPosition() )
if( oldpos != GetCrossHairPosition() )
{
pos = GetScreen()->GetCrossHairPosition();
GetScreen()->SetCrossHairPosition( oldpos );
pos = GetCrossHairPosition();
SetCrossHairPosition( oldpos );
m_canvas->CrossHairOff( aDC );
GetScreen()->SetCrossHairPosition( pos );
SetCrossHairPosition( pos );
m_canvas->CrossHairOn( aDC );
if( m_canvas->IsMouseCaptured() )

View File

@ -250,7 +250,7 @@ static void moveItem( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPositio
WORKSHEET_DATAITEM *item = screen->GetCurItem();
wxCHECK_RET( (item != NULL), wxT( "Cannot move NULL item." ) );
wxPoint position = screen->GetCrossHairPosition()
wxPoint position = aPanel->GetParent()->GetCrossHairPosition()
- ( initialCursorPosition - initialPositionUi );
if( (item->GetFlags() & LOCATE_STARTPOINT) )
@ -285,12 +285,13 @@ static void abortMoveItem( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
aPanel->Refresh();
}
void PL_EDITOR_FRAME::MoveItem( WORKSHEET_DATAITEM* aItem )
{
wxCHECK_RET( aItem != NULL, wxT( "Cannot move NULL item" ) );
initialPosition = aItem->GetStartPos();
initialPositionUi = aItem->GetStartPosUi();
initialCursorPosition = GetScreen()->GetCrossHairPosition();
initialCursorPosition = GetCrossHairPosition();
if( (aItem->GetFlags() & LOCATE_ENDPOINT) )
{
@ -300,8 +301,8 @@ void PL_EDITOR_FRAME::MoveItem( WORKSHEET_DATAITEM* aItem )
if( aItem->GetFlags() & (LOCATE_STARTPOINT|LOCATE_ENDPOINT) )
{
GetScreen()->SetCrossHairPosition( initialPositionUi, false );
initialCursorPosition = GetScreen()->GetCrossHairPosition();
SetCrossHairPosition( initialPositionUi, false );
initialCursorPosition = GetCrossHairPosition();
if( m_canvas->IsPointOnDisplay( initialCursorPosition ) )
{
m_canvas->MoveCursorToCrossHair();
@ -317,6 +318,7 @@ void PL_EDITOR_FRAME::MoveItem( WORKSHEET_DATAITEM* aItem )
GetScreen()->SetCurItem( aItem );
}
/**
* Save in Undo list the layout, and place an item being moved.
* @param aItem is the item moved

View File

@ -180,7 +180,11 @@ void PL_EDITOR_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode,
break;
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;
case HK_MOVE_ITEM:

View File

@ -254,7 +254,7 @@ double PL_EDITOR_FRAME::BestZoom()
double bestzoom = std::max( zx, zy );
GetScreen()->SetScrollCenterPosition( wxPoint( dx / 2, dy / 2 ) );
SetScrollCenterPosition( wxPoint( dx / 2, dy / 2 ) );
return bestzoom;
}
@ -369,42 +369,44 @@ void PL_EDITOR_FRAME::UpdateStatusBar()
wxPoint originCoord;
int Xsign = 1;
int Ysign = 1;
WORKSHEET_DATAITEM dummy( WORKSHEET_DATAITEM::WS_SEGMENT );
switch( m_originSelectChoice )
{
default:
case 0: // Origin = paper Left Top corner
break;
default:
case 0: // Origin = paper Left Top corner
break;
case 1: // Origin = page Right Bottom corner
Xsign = -1;
Ysign = -1;
dummy.SetStart( 0, 0, RB_CORNER );
originCoord = dummy.GetStartPosUi();
break;
case 1: // Origin = page Right Bottom corner
Xsign = -1;
Ysign = -1;
dummy.SetStart( 0, 0, RB_CORNER );
originCoord = dummy.GetStartPosUi();
break;
case 2: // Origin = page Left Bottom corner
Ysign = -1;
dummy.SetStart( 0, 0, LB_CORNER );
originCoord = dummy.GetStartPosUi();
break;
case 2: // Origin = page Left Bottom corner
Ysign = -1;
dummy.SetStart( 0, 0, LB_CORNER );
originCoord = dummy.GetStartPosUi();
break;
case 3: // Origin = page Right Top corner
Xsign = -1;
dummy.SetStart( 0, 0, RT_CORNER );
originCoord = dummy.GetStartPosUi();
break;
case 3: // Origin = page Right Top corner
Xsign = -1;
dummy.SetStart( 0, 0, RT_CORNER );
originCoord = dummy.GetStartPosUi();
break;
case 4: // Origin = page Left Top corner
dummy.SetStart( 0, 0, LT_CORNER );
originCoord = dummy.GetStartPosUi();
break;
case 4: // Origin = page Left Top corner
dummy.SetStart( 0, 0, LT_CORNER );
originCoord = dummy.GetStartPosUi();
break;
}
screen->m_GridOrigin = originCoord;
SetGridOrigin( originCoord );
// Display absolute coordinates:
wxPoint coord = screen->GetCrossHairPosition() - originCoord;
wxPoint coord = GetCrossHairPosition() - originCoord;
double dXpos = To_User_Unit( g_UserUnit, coord.x*Xsign );
double dYpos = To_User_Unit( g_UserUnit, coord.y*Ysign );
@ -441,8 +443,8 @@ void PL_EDITOR_FRAME::UpdateStatusBar()
SetStatusText( line, 2 );
// Display relative coordinates:
int dx = screen->GetCrossHairPosition().x - screen->m_O_Curseur.x;
int dy = screen->GetCrossHairPosition().y - screen->m_O_Curseur.y;
int dx = GetCrossHairPosition().x - screen->m_O_Curseur.x;
int dy = GetCrossHairPosition().y - screen->m_O_Curseur.y;
dXpos = To_User_Unit( g_UserUnit, dx * Xsign );
dYpos = To_User_Unit( g_UserUnit, dy * Ysign );
line.Printf( locformatter, dXpos, dYpos );
@ -594,10 +596,11 @@ WORKSHEET_DATAITEM * PL_EDITOR_FRAME::GetSelectedItem()
*/
WORKSHEET_DATAITEM* PL_EDITOR_FRAME::Locate( const wxPoint& aPosition )
{
const PAGE_INFO& pageInfo = GetPageSettings();
TITLE_BLOCK t_block = GetTitleBlock();
EDA_COLOR_T color = RED; // Needed, not used
PL_EDITOR_SCREEN* screen = (PL_EDITOR_SCREEN*) GetScreen();
const PAGE_INFO& pageInfo = GetPageSettings();
TITLE_BLOCK t_block = GetTitleBlock();
EDA_COLOR_T color = RED; // Needed, not used
PL_EDITOR_SCREEN* screen = (PL_EDITOR_SCREEN*) GetScreen();
screen-> m_ScreenNumber = GetPageNumberOption() ? 1 : 2;
WS_DRAW_ITEM_LIST drawList;
@ -623,9 +626,9 @@ WORKSHEET_DATAITEM* PL_EDITOR_FRAME::Locate( const wxPoint& aPosition )
// Choose item in list if more than 1 item
if( list.size() > 1 )
{
wxArrayString choices;
wxArrayString choices;
wxString text;
wxPoint cursPos = screen->GetCrossHairPosition();
wxPoint cursPos = GetCrossHairPosition();
for( unsigned ii = 0; ii < list.size(); ++ii )
{
@ -656,7 +659,7 @@ WORKSHEET_DATAITEM* PL_EDITOR_FRAME::Locate( const wxPoint& aPosition )
if( selection < 0 )
return NULL;
screen->SetCrossHairPosition( cursPos );
SetCrossHairPosition( cursPos );
m_canvas->MoveCursorToCrossHair();
drawitem = list[selection];
}

View File

@ -58,6 +58,8 @@ class PL_EDITOR_FRAME : public EDA_DRAW_FRAME
// usefull when there are some items which are
// only on page 1, not on page 1
wxPoint m_grid_origin;
protected:
/// The last filename chosen to be proposed to the user
wxString m_lastFileName;
@ -90,12 +92,21 @@ public:
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;
}
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
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ); // overload EDA_DRAW_FRAME

View File

@ -106,7 +106,7 @@ void PCB_EDIT_FRAME::AutoPlace( wxCommandEvent& event )
break;
}
/* Erase ratsnest if needed */
// Erase ratsnest if needed
if( GetBoard()->IsElementVisible(RATSNEST_VISIBLE) )
DrawGeneralRatsnest( &dc );
@ -191,7 +191,7 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
return;
}
/* Confirmation */
// Confirmation
if( !IsOK( this, _( "Move modules?" ) ) )
return;
@ -223,15 +223,15 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
*/
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;
GetScreen()->SetCrossHairPosition( pos );
SetCrossHairPosition( pos );
}
}
/* calculate the area needed by footprints */
// calculate the area needed by footprints
surface = 0.0;
for( unsigned ii = 0; ii < moduleList.size(); ii++ )
@ -249,7 +249,7 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
Xsize_allowed = (int) ( sqrt( surface ) * 4.0 / 3.0 );
start = current = GetScreen()->GetCrossHairPosition();
start = current = GetCrossHairPosition();
Ymax_size = 0;
for( unsigned ii = 0; ii < moduleList.size(); ii++ )
@ -276,8 +276,8 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
Ymax_size = 0;
}
GetScreen()->SetCrossHairPosition( current + Module->GetPosition() -
Module->GetBoundingBox().GetPosition() );
SetCrossHairPosition( current + Module->GetPosition() -
Module->GetBoundingBox().GetPosition() );
Ymax_size = std::max( Ymax_size, Module->GetBoundingBox().GetHeight() );

View File

@ -62,20 +62,20 @@
*/
static const double OrientPenality[11] =
{
2.0f, /* CntRot = 0 rotation prohibited */
1.9f, /* CntRot = 1 */
1.8f, /* CntRot = 2 */
1.7f, /* CntRot = 3 */
1.6f, /* CntRot = 4 */
1.5f, /* CntRot = 5 */
1.4f, /* CntRot = 5 */
1.3f, /* CntRot = 7 */
1.2f, /* CntRot = 8 */
1.1f, /* CntRot = 9 */
1.0f /* CntRot = 10 rotation authorized, no penalty */
2.0f, // CntRot = 0 rotation prohibited
1.9f, // CntRot = 1
1.8f, // CntRot = 2
1.7f, // CntRot = 3
1.6f, // CntRot = 4
1.5f, // CntRot = 5
1.4f, // CntRot = 5
1.3f, // CntRot = 7
1.2f, // CntRot = 8
1.1f, // CntRot = 9
1.0f // CntRot = 10 rotation authorized, no penalty
};
/* Cell states. */
// Cell states.
#define OUT_OF_BOARD -2
#define OCCUPED_By_MODULE -1
@ -149,7 +149,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
if( RoutingMatrix.m_GridRouting < 10*IU_PER_MILS )
RoutingMatrix.m_GridRouting = 10*IU_PER_MILS; // Min value = 1/1000 inch
/* Compute module parameters used in auto place */
// Compute module parameters used in auto place
if( GenPlaceBoard() == 0 )
return;
@ -245,7 +245,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
msg.Printf( _("Place module %d of %d"), cnt, moduleCount );
SetStatusText( msg );
/* Display fill area of interest, barriers, penalties. */
// Display fill area of interest, barriers, penalties.
DrawInfoPlace( DC );
error = GetOptimalModulePlacement( Module, DC );
@ -255,7 +255,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
if( error == ESC )
goto end_of_tst;
/* Determine if the best orientation of a module is 180. */
// Determine if the best orientation of a module is 180.
ii = Module->GetPlacementCost180() & 0x0F;
if( ii != 0 )
@ -266,7 +266,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
error = GetOptimalModulePlacement( Module, DC );
MinCout *= OrientPenality[ii];
if( BestScore > MinCout ) /* This orientation is best. */
if( BestScore > MinCout ) // This orientation is best.
{
PosOK = CurrPosition;
BestScore = MinCout;
@ -281,7 +281,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
goto end_of_tst;
}
/* Determine if the best orientation of a module is 90. */
// Determine if the best orientation of a module is 90.
ii = Module->GetPlacementCost90() & 0x0F;
if( ii != 0 )
@ -291,7 +291,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
error = GetOptimalModulePlacement( Module, DC );
MinCout *= OrientPenality[ii];
if( BestScore > MinCout ) /* This orientation is best. */
if( BestScore > MinCout ) // This orientation is best.
{
PosOK = CurrPosition;
BestScore = MinCout;
@ -306,7 +306,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
goto end_of_tst;
}
/* Determine if the best orientation of a module is 270. */
// Determine if the best orientation of a module is 270.
ii = (Module->GetPlacementCost90() >> 4 ) & 0x0F;
if( ii != 0 )
@ -316,7 +316,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
error = GetOptimalModulePlacement( Module, DC );
MinCout *= OrientPenality[ii];
if( BestScore > MinCout ) /* This orientation is best. */
if( BestScore > MinCout ) // This orientation is best.
{
PosOK = CurrPosition;
BestScore = MinCout;
@ -336,11 +336,11 @@ end_of_tst:
if( error == ESC )
break;
/* Place module. */
CurrPosition = GetScreen()->GetCrossHairPosition();
GetScreen()->SetCrossHairPosition( PosOK );
// Place module.
CurrPosition = GetCrossHairPosition();
SetCrossHairPosition( PosOK );
PlaceModule( Module, DC );
GetScreen()->SetCrossHairPosition( CurrPosition );
SetCrossHairPosition( CurrPosition );
Module->CalculateBoundingBox();
@ -393,14 +393,14 @@ void PCB_EDIT_FRAME::DrawInfoPlace( wxDC* DC )
if( top_state & CELL_is_ZONE )
color = BLUE;
/* obstacles */
// obstacles
if( ( top_state & CELL_is_EDGE ) || ( bottom_state & CELL_is_EDGE ) )
color = WHITE;
else if( top_state & ( HOLE | CELL_is_MODULE ) )
color = LIGHTRED;
else if( bottom_state & (HOLE | CELL_is_MODULE) )
color = LIGHTGREEN;
else /* Display the filling and keep out regions. */
else // Display the filling and keep out regions.
{
if( RoutingMatrix.GetDist( ii, jj, TOP ) ||
RoutingMatrix.GetDist( ii, jj, BOTTOM ) )
@ -438,12 +438,12 @@ int PCB_EDIT_FRAME::GenPlaceBoard()
msg.Printf( wxT( "%d" ), nbCells );
m_messagePanel->SetMessage( 14, _( "Cells." ), msg, YELLOW );
/* Choose the number of board sides. */
// Choose the number of board sides.
RoutingMatrix.m_RoutingLayersCount = 2;
RoutingMatrix.InitRoutingMatrix();
/* Display memory usage. */
// Display memory usage.
msg.Printf( wxT( "%d" ), RoutingMatrix.m_MemSize / 1024 );
m_messagePanel->SetMessage( 24, wxT( "Mem(Kb)" ), msg, CYAN );
@ -454,7 +454,7 @@ int PCB_EDIT_FRAME::GenPlaceBoard()
g_Route_Layer_TOP = LAYER_N_FRONT;
/* Place the edge layer segments */
// Place the edge layer segments
TRACK TmpSegm( NULL );
TmpSegm.SetLayer( UNDEFINED_LAYER );
@ -561,7 +561,7 @@ void PCB_EDIT_FRAME::GenModuleOnBoard( MODULE* Module )
int trackWidth = GetBoard()->m_NetClasses.GetDefault()->GetTrackWidth();
int clearance = GetBoard()->m_NetClasses.GetDefault()->GetClearance();
/* Trace pads and surface safely. */
// Trace pads and surface safely.
marge = trackWidth + clearance;
for( Pad = Module->Pads(); Pad != NULL; Pad = Pad->Next() )
@ -569,7 +569,7 @@ void PCB_EDIT_FRAME::GenModuleOnBoard( MODULE* Module )
::PlacePad( Pad, CELL_is_MODULE, marge, WRITE_OR_CELL );
}
/* Trace clearance. */
// Trace clearance.
marge = ( RoutingMatrix.m_GridRouting * Module->GetPadCount() ) / GAIN;
CreateKeepOutRectangle( ox, oy, fx, fy, marge, KEEP_OUT_MARGIN, layerMask );
}
@ -578,7 +578,7 @@ void PCB_EDIT_FRAME::GenModuleOnBoard( MODULE* Module )
int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC )
{
int cx, cy;
int ox, oy, fx, fy; /* occupying part of the module focuses on the cursor */
int ox, oy, fx, fy; // occupying part of the module focuses on the cursor
int error = 1;
int showRat = 0;
wxPoint LastPosOK;
@ -604,7 +604,7 @@ int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC )
CurrPosition.x = RoutingMatrix.m_BrdBox.GetX() - ox;
CurrPosition.y = RoutingMatrix.m_BrdBox.GetY() - oy;
/* Module placement on grid. */
// Module placement on grid.
CurrPosition.x -= CurrPosition.x % RoutingMatrix.m_GridRouting;
CurrPosition.y -= CurrPosition.y % RoutingMatrix.m_GridRouting;
@ -664,7 +664,7 @@ int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC )
g_Offset_Module.x = cx - CurrPosition.x;
CurrPosition.y = RoutingMatrix.m_BrdBox.GetY() - oy;
/* Placement on grid. */
// Placement on grid.
CurrPosition.y -= CurrPosition.y % RoutingMatrix.m_GridRouting;
DrawModuleOutlines( m_canvas, aDC, aModule );
@ -673,7 +673,7 @@ int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC )
CurrPosition.y += RoutingMatrix.m_GridRouting )
{
#ifndef USE_WX_OVERLAY
/* Erase traces. */
// Erase traces.
DrawModuleOutlines( m_canvas, aDC, aModule );
if( showRat )
@ -717,14 +717,14 @@ int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC )
}
}
DrawModuleOutlines( m_canvas, aDC, aModule ); /* erasing the last traces */
DrawModuleOutlines( m_canvas, aDC, aModule ); // erasing the last traces
g_Show_Module_Ratsnest = showRats;
if( showRat )
Compute_Ratsnest_PlaceModule( aDC );
/* Regeneration of the modified variable. */
// Regeneration of the modified variable.
aModule->GetBoundingBox().SetX( ox + cx );
aModule->GetBoundingBox().SetY( oy + cy );
CurrPosition = LastPosOK;
@ -926,7 +926,7 @@ double PCB_EDIT_FRAME::Compute_Ratsnest_PlaceModule( wxDC* DC )
GRLine( m_canvas->GetClipBox(), DC, start, end, 0, color );
}
#endif
/* Cost of the ratsnest. */
// Cost of the ratsnest.
dx = end.x - start.x;
dy = end.y - start.y;
@ -970,10 +970,10 @@ void CreateKeepOutRectangle( int ux0, int uy0, int ux1, int uy1,
int lgain, cgain;
if( aLayerMask & GetLayerMask( g_Route_Layer_BOTTOM ) )
trace = 1; /* Trace on bottom layer. */
trace = 1; // Trace on bottom layer.
if( ( aLayerMask & GetLayerMask( g_Route_Layer_TOP ) ) && RoutingMatrix.m_RoutingLayersCount )
trace |= 2; /* Trace on top layer. */
trace |= 2; // Trace on top layer.
if( trace == 0 )
return;
@ -991,7 +991,7 @@ void CreateKeepOutRectangle( int ux0, int uy0, int ux1, int uy1,
if( pmarge < 1 )
pmarge = 1;
/* Calculate the coordinate limits of the rectangle. */
// Calculate the coordinate limits of the rectangle.
row_max = uy1 / RoutingMatrix.m_GridRouting;
col_max = ux1 / RoutingMatrix.m_GridRouting;
row_min = uy0 / RoutingMatrix.m_GridRouting;
@ -1057,7 +1057,7 @@ void CreateKeepOutRectangle( int ux0, int uy0, int ux1, int uy1,
}
/* Sort routines */
// Sort routines
static bool Tri_PlaceModules( MODULE* ref, MODULE* compare )
{
double ff1, ff2;
@ -1114,7 +1114,7 @@ static MODULE* PickModule( PCB_EDIT_FRAME* pcbframe, wxDC* DC )
pcbframe->SetMsgPanel( Module );
pcbframe->build_ratsnest_module( Module );
/* Calculate external ratsnest. */
// Calculate external ratsnest.
for( unsigned ii = 0; ii < pcbframe->GetBoard()->m_LocalRatsnest.size(); ii++ )
{
if( ( pcbframe->GetBoard()->m_LocalRatsnest[ii].m_Status &
@ -1127,7 +1127,7 @@ static MODULE* PickModule( PCB_EDIT_FRAME* pcbframe, wxDC* DC )
sort( moduleList.begin(), moduleList.end(), Tri_RatsModules );
/* Search for "best" module. */
// Search for "best" module.
MODULE* bestModule = NULL;
MODULE* altModule = NULL;
@ -1199,7 +1199,7 @@ int propagate()
{
current_cell = RoutingMatrix.GetCell( row, col, BOTTOM ) & NO_CELL_ZONE;
if( current_cell == 0 ) /* a free cell is found */
if( current_cell == 0 ) // a free cell is found
{
if( (old_cell_H & CELL_is_ZONE) || (pt_cell_V[col] & CELL_is_ZONE) )
{
@ -1224,7 +1224,7 @@ int propagate()
{
current_cell = RoutingMatrix.GetCell( row, col, BOTTOM ) & NO_CELL_ZONE;
if( current_cell == 0 ) /* a free cell is found */
if( current_cell == 0 ) // a free cell is found
{
if( (old_cell_H & CELL_is_ZONE) || (pt_cell_V[col] & CELL_is_ZONE) )
{
@ -1249,7 +1249,7 @@ int propagate()
{
current_cell = RoutingMatrix.GetCell( row, col, BOTTOM ) & NO_CELL_ZONE;
if( current_cell == 0 ) /* a free cell is found */
if( current_cell == 0 ) // a free cell is found
{
if( (old_cell_H & CELL_is_ZONE) || (pt_cell_V[row] & CELL_is_ZONE) )
{
@ -1274,7 +1274,7 @@ int propagate()
{
current_cell = RoutingMatrix.GetCell( row, col, BOTTOM ) & NO_CELL_ZONE;
if( current_cell == 0 ) /* a free cell is found */
if( current_cell == 0 ) // a free cell is found
{
if( (old_cell_H & CELL_is_ZONE) || (pt_cell_V[row] & CELL_is_ZONE) )
{

View File

@ -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 );
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 );
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()
double bestzoom = std::max( iu_per_du_X, iu_per_du_Y );
GetScreen()->SetScrollCenterPosition( ibbbox.Centre() );
SetScrollCenterPosition( ibbbox.Centre() );
return bestzoom;
}
@ -268,21 +282,19 @@ void PCB_BASE_FRAME::CursorGoto( const wxPoint& aPos, bool aWarp )
{
// factored out of pcbnew/find.cpp
PCB_SCREEN* screen = (PCB_SCREEN*)GetScreen();
INSTALL_UNBUFFERED_DC( dc, m_canvas );
// There may be need to reframe the drawing.
if( !m_canvas->IsPointOnDisplay( aPos ) )
{
screen->SetCrossHairPosition( aPos );
SetCrossHairPosition( aPos );
RedrawScreen( aPos, aWarp );
}
else
{
// Put cursor on item position
m_canvas->CrossHairOff( &dc );
screen->SetCrossHairPosition( aPos );
SetCrossHairPosition( aPos );
if( aWarp )
m_canvas->MoveCursorToCrossHair();
@ -560,8 +572,8 @@ void PCB_BASE_FRAME::UpdateStatusBar()
{
double theta, ro;
dx = screen->GetCrossHairPosition().x - screen->m_O_Curseur.x;
dy = screen->GetCrossHairPosition().y - screen->m_O_Curseur.y;
dx = GetCrossHairPosition().x - screen->m_O_Curseur.x;
dy = GetCrossHairPosition().y - screen->m_O_Curseur.y;
theta = ArcTangente( -dy, dx ) / 10;
@ -598,8 +610,8 @@ void PCB_BASE_FRAME::UpdateStatusBar()
}
// Display absolute coordinates:
dXpos = To_User_Unit( g_UserUnit, screen->GetCrossHairPosition().x );
dYpos = To_User_Unit( g_UserUnit, screen->GetCrossHairPosition().y );
dXpos = To_User_Unit( g_UserUnit, GetCrossHairPosition().x );
dYpos = To_User_Unit( g_UserUnit, GetCrossHairPosition().y );
// The following sadly is an if Eeschema/if Pcbnew
wxString absformatter;
@ -642,8 +654,8 @@ void PCB_BASE_FRAME::UpdateStatusBar()
if( !DisplayOpt.DisplayPolarCood ) // display relative cartesian coordinates
{
// Display relative coordinates:
dx = screen->GetCrossHairPosition().x - screen->m_O_Curseur.x;
dy = screen->GetCrossHairPosition().y - screen->m_O_Curseur.y;
dx = GetCrossHairPosition().x - screen->m_O_Curseur.x;
dy = GetCrossHairPosition().y - screen->m_O_Curseur.y;
dXpos = To_User_Unit( g_UserUnit, dx );
dYpos = To_User_Unit( g_UserUnit, dy );

View File

@ -120,7 +120,7 @@ private:
static bool InstallBlockCmdFrame( PCB_BASE_FRAME* parent, const wxString& title )
{
wxPoint oldpos = parent->GetScreen()->GetCrossHairPosition();
wxPoint oldpos = parent->GetCrossHairPosition();
parent->GetCanvas()->SetIgnoreMouseEvents( true );
DIALOG_BLOCK_OPTIONS * dlg = new DIALOG_BLOCK_OPTIONS( parent, title );
@ -128,7 +128,7 @@ static bool InstallBlockCmdFrame( PCB_BASE_FRAME* parent, const wxString& title
int cmd = dlg->ShowModal();
dlg->Destroy();
parent->GetScreen()->SetCrossHairPosition( oldpos );
parent->SetCrossHairPosition( oldpos );
parent->GetCanvas()->MoveCursorToCrossHair();
parent->GetCanvas()->SetIgnoreMouseEvents( false );
@ -232,9 +232,9 @@ void PCB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
case BLOCK_IDLE:
break;
case BLOCK_DRAG: /* Drag */
case BLOCK_MOVE: /* Move */
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
case BLOCK_DRAG: // Drag
case BLOCK_MOVE: // Move
case BLOCK_PRESELECT_MOVE: // Move with preselection list
if( m_canvas->IsMouseCaptured() )
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
@ -242,7 +242,7 @@ void PCB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
GetScreen()->m_BlockLocate.ClearItemsList();
break;
case BLOCK_COPY: /* Copy */
case BLOCK_COPY: // Copy
if( m_canvas->IsMouseCaptured() )
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
@ -315,35 +315,35 @@ bool PCB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
DisplayError( this, wxT( "Error in HandleBlockPLace" ) );
break;
case BLOCK_DRAG: /* Drag (not used, for future enhancements)*/
case BLOCK_MOVE: /* Move */
case BLOCK_COPY: /* Copy */
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
case BLOCK_DRAG: // Drag (not used, for future enhancements)
case BLOCK_MOVE: // Move
case BLOCK_COPY: // Copy
case BLOCK_PRESELECT_MOVE: // Move with preselection list
GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_MOVE );
nextcmd = true;
m_canvas->SetMouseCaptureCallback( drawMovingBlock );
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
break;
case BLOCK_DELETE: /* Delete */
case BLOCK_DELETE: // Delete
m_canvas->SetMouseCaptureCallback( NULL );
GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_STOP );
Block_Delete();
break;
case BLOCK_ROTATE: /* Rotation */
case BLOCK_ROTATE: // Rotation
m_canvas->SetMouseCaptureCallback( NULL );
GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_STOP );
Block_Rotate();
break;
case BLOCK_FLIP: /* Flip */
case BLOCK_FLIP: // Flip
m_canvas->SetMouseCaptureCallback( NULL );
GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_STOP );
Block_Flip();
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 );
if( GetScreen()->m_BlockLocate.GetCount() )
@ -355,7 +355,7 @@ bool PCB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
case BLOCK_PASTE:
break;
case BLOCK_ZOOM: /* Window Zoom */
case BLOCK_ZOOM: // Window Zoom
// Turn off the redraw block routine now so it is not displayed
// 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
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() );
}
@ -600,7 +600,7 @@ void PCB_EDIT_FRAME::Block_Delete()
PICKED_ITEMS_LIST* itemsList = &GetScreen()->m_BlockLocate.GetItems();
itemsList->m_Status = UR_DELETED;
/* unlink items and clear flags */
// unlink items and clear flags
for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ )
{
BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( ii );
@ -658,7 +658,7 @@ void PCB_EDIT_FRAME::Block_Rotate()
wxPoint centre; // rotation cent-re for the rotation transform
int rotAngle = 900; // rotation angle in 0.1 deg.
oldpos = GetScreen()->GetCrossHairPosition();
oldpos = GetCrossHairPosition();
centre = GetScreen()->m_BlockLocate.Centre();
OnModify();
@ -680,7 +680,7 @@ void PCB_EDIT_FRAME::Block_Rotate()
m_Pcb->m_Status_Pcb = 0;
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_VIA_T: // a via (like track segment on a copper layer)
m_Pcb->m_Status_Pcb = 0;
@ -716,14 +716,14 @@ void PCB_EDIT_FRAME::Block_Flip()
{
#define INVERT( pos ) (pos) = center.y - ( (pos) - center.y )
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();
PICKED_ITEMS_LIST* itemsList = &GetScreen()->m_BlockLocate.GetItems();
itemsList->m_Status = UR_FLIPPED;
memo = GetScreen()->GetCrossHairPosition();
memo = GetCrossHairPosition();
center = GetScreen()->m_BlockLocate.Centre();
@ -741,7 +741,7 @@ void PCB_EDIT_FRAME::Block_Flip()
m_Pcb->m_Status_Pcb = 0;
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_VIA_T: // a via (like track segment on a copper layer)
m_Pcb->m_Status_Pcb = 0;
@ -795,7 +795,7 @@ void PCB_EDIT_FRAME::Block_Move()
item->ClearFlags();
break;
/* Move track segments */
// Move track segments
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)
m_Pcb->m_Status_Pcb = 0;

View File

@ -127,12 +127,14 @@ bool FOOTPRINT_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
{
BLOCK_STATE_T state = GetScreen()->m_BlockLocate.GetState();
BLOCK_COMMAND_T command = GetScreen()->m_BlockLocate.GetCommand();
m_canvas->CallEndMouseCapture( DC );
GetScreen()->m_BlockLocate.SetState( state );
GetScreen()->m_BlockLocate.SetCommand( command );
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();
}
@ -142,9 +144,9 @@ bool FOOTPRINT_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
DisplayError( this, wxT( "Error in HandleBlockPLace" ) );
break;
case BLOCK_DRAG: /* Drag */
case BLOCK_MOVE: /* Move */
case BLOCK_COPY: /* Copy */
case BLOCK_DRAG: // Drag
case BLOCK_MOVE: // Move
case BLOCK_COPY: // Copy
itemsCount = MarkItemsInBloc( currentModule, GetScreen()->m_BlockLocate );
if( itemsCount )
@ -164,13 +166,13 @@ bool FOOTPRINT_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
break;
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
case BLOCK_PRESELECT_MOVE: // Move with preselection list
nextcmd = true;
m_canvas->SetMouseCaptureCallback( DrawMovingBlockOutlines );
GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_MOVE );
break;
case BLOCK_DELETE: /* Delete */
case BLOCK_DELETE: // Delete
itemsCount = MarkItemsInBloc( currentModule, GetScreen()->m_BlockLocate );
if( itemsCount )
@ -179,7 +181,7 @@ bool FOOTPRINT_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
DeleteMarkedItems( currentModule );
break;
case BLOCK_SAVE: /* Save */
case BLOCK_SAVE: // Save
case BLOCK_PASTE:
break;
@ -195,7 +197,7 @@ bool FOOTPRINT_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
case BLOCK_MIRROR_X:
case BLOCK_MIRROR_Y:
case BLOCK_FLIP: /* mirror */
case BLOCK_FLIP: // mirror
itemsCount = MarkItemsInBloc( currentModule, GetScreen()->m_BlockLocate );
if( itemsCount )
@ -204,7 +206,7 @@ bool FOOTPRINT_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
MirrorMarkedItems( currentModule, GetScreen()->m_BlockLocate.Centre() );
break;
case BLOCK_ZOOM: /* Window Zoom */
case BLOCK_ZOOM: // Window Zoom
Window_Zoom( GetScreen()->m_BlockLocate );
break;
@ -249,28 +251,28 @@ void FOOTPRINT_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
case BLOCK_IDLE:
break;
case BLOCK_DRAG: /* Drag */
case BLOCK_MOVE: /* Move */
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
case BLOCK_DRAG: // Drag
case BLOCK_MOVE: // Move
case BLOCK_PRESELECT_MOVE: // Move with preselection list
GetScreen()->m_BlockLocate.ClearItemsList();
SaveCopyInUndoList( currentModule, UR_MODEDIT );
MoveMarkedItems( currentModule, GetScreen()->m_BlockLocate.GetMoveVector() );
m_canvas->Refresh( true );
break;
case BLOCK_COPY: /* Copy */
case BLOCK_COPY: // Copy
GetScreen()->m_BlockLocate.ClearItemsList();
SaveCopyInUndoList( currentModule, UR_MODEDIT );
CopyMarkedItems( currentModule, GetScreen()->m_BlockLocate.GetMoveVector() );
break;
case BLOCK_PASTE: /* Paste */
case BLOCK_PASTE: // Paste
GetScreen()->m_BlockLocate.ClearItemsList();
break;
case BLOCK_MIRROR_X:
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 );
MirrorMarkedItems( currentModule, GetScreen()->m_BlockLocate.Centre() );
break;
@ -304,8 +306,8 @@ void FOOTPRINT_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase )
{
BASE_SCREEN* screen = aPanel->GetScreen();
FOOTPRINT_EDIT_FRAME * moduleEditFrame = FOOTPRINT_EDIT_FRAME::GetActiveFootprintEditor();
BASE_SCREEN* screen = aPanel->GetScreen();
FOOTPRINT_EDIT_FRAME* moduleEditFrame = FOOTPRINT_EDIT_FRAME::GetActiveFootprintEditor();
wxASSERT( moduleEditFrame );
MODULE* currentModule = moduleEditFrame->GetBoard()->m_Modules;
@ -319,7 +321,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
if( currentModule )
{
wxPoint move_offset = -block->GetMoveVector();
wxPoint move_offset = -block->GetMoveVector();
BOARD_ITEM* item = currentModule->GraphicalItems();
for( ; item != NULL; item = item->Next() )
@ -351,15 +353,15 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
}
}
/* Repaint new view. */
block->SetMoveVector( screen->GetCrossHairPosition() - block->GetLastCursorPosition() );
// Repaint new view.
block->SetMoveVector( moduleEditFrame->GetCrossHairPosition() - block->GetLastCursorPosition() );
block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );
if( currentModule )
{
BOARD_ITEM* item = currentModule->GraphicalItems();
wxPoint move_offset = - block->GetMoveVector();
wxPoint move_offset = - block->GetMoveVector();
for( ; item != NULL; item = item->Next() )
{

View File

@ -215,6 +215,8 @@ private:
ZONE_CONTAINERS m_ZoneDescriptorList;
LAYER m_Layer[NB_LAYERS];
wxPoint m_grid_origin;
// if true m_highLight_NetCode is used
HIGH_LIGHT_INFO m_highLight; // current high light data
HIGH_LIGHT_INFO m_highLightPrevious; // a previously stored high light data
@ -231,9 +233,6 @@ private:
TITLE_BLOCK m_titles; ///< text in lower right of screen and plots
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.
int m_nodeCount;
@ -387,6 +386,20 @@ public:
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
* Reset all high light data to the init state
@ -594,9 +607,6 @@ public:
const PCB_PLOT_PARAMS& GetPlotOptions() const { return m_plotOptions; }
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; }
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) { m_titles = aTitleBlock; }

View File

@ -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
// debugging: print out the collected items, showing their priority order too.
@ -161,7 +161,7 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode )
if( item->Type() != PCB_ZONE_T )
continue;
/* Found a TYPE ZONE */
// Found a TYPE ZONE
if( item->GetTimeStamp() == timestampzone ) // Remove it, redundant, zone already found
{
m_Collector->Remove( ii );
@ -200,7 +200,7 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode )
{
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" ) );
#ifdef __WINDOWS__
@ -269,9 +269,9 @@ void PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
snapToGrid = false;
if( snapToGrid )
pos = GetScreen()->GetNearestGridPosition( pos );
pos = GetNearestGridPosition( pos );
oldpos = GetScreen()->GetCrossHairPosition();
oldpos = GetCrossHairPosition();
gridSize = GetScreen()->GetGridSize();
@ -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).
GetScreen()->SetCrossHairPosition( pos, snapToGrid );
SetCrossHairPosition( pos, snapToGrid );
/* 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,
@ -326,7 +326,7 @@ void PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
if( Magnetize( this, GetToolId(), igridsize, curs_pos, &pos ) )
{
GetScreen()->SetCrossHairPosition( pos, false );
SetCrossHairPosition( pos, false );
}
else
{
@ -335,19 +335,19 @@ void PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
if( !g_Drc_On || !g_CurrentTrackSegment ||
(BOARD_ITEM*)g_CurrentTrackSegment != this->GetCurItem() ||
!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();
GetScreen()->SetCrossHairPosition( oldpos, false );
pos = GetCrossHairPosition();
SetCrossHairPosition( oldpos, false );
m_canvas->CrossHairOff( aDC );
GetScreen()->SetCrossHairPosition( pos, false );
SetCrossHairPosition( pos, false );
m_canvas->CrossHairOn( aDC );
if( m_canvas->IsMouseCaptured() )
@ -373,5 +373,5 @@ void PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
OnHotKey( aDC, aHotKey, aPosition );
}
UpdateStatusBar(); /* Display new cursor coordinates */
UpdateStatusBar(); // Display new cursor coordinates
}

View File

@ -96,7 +96,7 @@ void RemoteCommand( const char* cmdline )
pos = pad->GetPosition();
}
if( netcode > 0 ) /* highlight the pad net*/
if( netcode > 0 ) // highlight the pad net
{
pcb->HighLightON();
pcb->SetHighLightNet( netcode );
@ -127,7 +127,7 @@ void RemoteCommand( const char* cmdline )
if( module ) // if found, center the module on screen, and redraw the screen.
{
frame->GetScreen()->SetCrossHairPosition(pos);
frame->SetCrossHairPosition( pos );
frame->RedrawScreen( pos, false );
}
}

View File

@ -317,7 +317,7 @@ bool DIALOG_SVG_PRINT::CreateSVGFile( const wxString& aFullFileName )
m_plotOpts.SetValueColor( color );
PAGE_INFO pageInfo = m_board->GetPageSettings();
wxPoint axisorigin = m_board->GetOriginAxisPosition();
wxPoint axisorigin = m_board->GetAuxOrigin();
if( PageIsBoardBoundarySize() )
{
@ -328,7 +328,7 @@ bool DIALOG_SVG_PRINT::CreateSVGFile( const wxString& aFullFileName )
m_board->SetPageSettings( currpageInfo );
m_plotOpts.SetUseAuxOrigin( true );
wxPoint origin = bbox.GetOrigin();
m_board->SetOriginAxisPosition( origin );
m_board->SetAuxOrigin( origin );
}
LOCALE_IO toggle;
@ -344,7 +344,7 @@ bool DIALOG_SVG_PRINT::CreateSVGFile( const wxString& aFullFileName )
}
delete plotter;
m_board->SetOriginAxisPosition( axisorigin );
m_board->SetAuxOrigin( axisorigin );
m_board->SetPageSettings( pageInfo );
return true;

View File

@ -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()
{
PutValueInLocalUnits( *m_ModPositionX, m_CurrentModule->GetPosition().x );
@ -244,7 +244,7 @@ void DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties()
m_LastSelected3DShapeIndex = -1;
/* Init 3D shape list */
// Init 3D shape list
S3D_MASTER* draw3D = m_CurrentModule->Models();
while( draw3D )
@ -276,7 +276,7 @@ void DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties()
_( "Use this attribute for \"virtual\" components drawn on board\n"
"(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 )
{
case 0:
@ -601,7 +601,7 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event )
if( change_layer )
m_CurrentModule->Flip( m_CurrentModule->GetPosition() );
/* Update 3D shape list */
// Update 3D shape list
int ii = m_3D_ShapeNameListBox->GetSelection();
if( ii >= 0 )
@ -660,23 +660,23 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( 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_Parent->InstallTextModOptionsFrame( m_ReferenceCopy, NULL );
m_Parent->GetScreen()->SetCrossHairPosition( tmp );
m_Parent->SetCrossHairPosition( tmp );
m_ReferenceCtrl->SetValue( m_ReferenceCopy->GetText() );
}
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_Parent->InstallTextModOptionsFrame( m_ValueCopy, NULL );
m_Parent->GetScreen()->SetCrossHairPosition( tmp );
m_Parent->SetCrossHairPosition( tmp );
m_ValueCtrl->SetValue( m_ValueCopy->GetText() );
}

View File

@ -84,9 +84,7 @@ DIALOG_MODULE_MODULE_EDITOR::~DIALOG_MODULE_MODULE_EDITOR()
}
/********************************************************/
void DIALOG_MODULE_MODULE_EDITOR::initModeditProperties()
/********************************************************/
{
SetFocus();
@ -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 )
{
if( aStruct3DSource )
@ -247,9 +244,8 @@ void DIALOG_MODULE_MODULE_EDITOR::TransfertDisplayTo3DValues( int aIndexSelectio
struct3DDest->m_MatPosition = m_3D_Offset->GetValue();
}
/***********************************************************/
void DIALOG_MODULE_MODULE_EDITOR::On3DShapeNameSelected(wxCommandEvent& event)
/***********************************************************/
{
if( m_lastSelected3DShapeIndex >= 0 )
TransfertDisplayTo3DValues( m_lastSelected3DShapeIndex );
@ -268,9 +264,7 @@ void DIALOG_MODULE_MODULE_EDITOR::On3DShapeNameSelected(wxCommandEvent& event)
}
/***********************************************************/
void DIALOG_MODULE_MODULE_EDITOR::Remove3DShape(wxCommandEvent& event)
/***********************************************************/
{
if( m_lastSelected3DShapeIndex >= 0 )
TransfertDisplayTo3DValues( m_lastSelected3DShapeIndex );
@ -293,9 +287,7 @@ void DIALOG_MODULE_MODULE_EDITOR::Remove3DShape(wxCommandEvent& event)
}
/*********************************************************************/
void DIALOG_MODULE_MODULE_EDITOR::BrowseAndAdd3DLib( wxCommandEvent& event )
/*********************************************************************/
{
wxString fullfilename, shortfilename;
wxString fullpath;
@ -364,16 +356,13 @@ void DIALOG_MODULE_MODULE_EDITOR::BrowseAndAdd3DLib( wxCommandEvent& event )
}
/**********************************************************************/
void DIALOG_MODULE_MODULE_EDITOR::OnCancelClick( wxCommandEvent& event )
/**********************************************************************/
{
EndModal( -1 );
}
/******************************************************************************/
void DIALOG_MODULE_MODULE_EDITOR::OnOkClick( wxCommandEvent& event )
/******************************************************************************/
{
// First, test for invalid chars in module name
wxString footprintName = m_FootprintNameCtrl->GetValue();
@ -486,25 +475,22 @@ void DIALOG_MODULE_MODULE_EDITOR::OnOkClick( wxCommandEvent& event )
}
/***********************************************************************/
void DIALOG_MODULE_MODULE_EDITOR::OnEditReference(wxCommandEvent& event)
/***********************************************************************/
{
wxPoint tmp = m_parent->GetScreen()->GetCrossHairPosition();
m_parent->GetScreen()->SetCrossHairPosition( m_referenceCopy->GetTextPosition() );
wxPoint tmp = m_parent->GetCrossHairPosition();
m_parent->SetCrossHairPosition( m_referenceCopy->GetTextPosition() );
m_parent->InstallTextModOptionsFrame( m_referenceCopy, NULL );
m_parent->GetScreen()->SetCrossHairPosition( tmp );
m_parent->SetCrossHairPosition( tmp );
m_ReferenceCtrl->SetValue( m_referenceCopy->GetText() );
}
/***********************************************************/
void DIALOG_MODULE_MODULE_EDITOR::OnEditValue(wxCommandEvent& event)
/***********************************************************/
{
wxPoint tmp = m_parent->GetScreen()->GetCrossHairPosition();
m_parent->GetScreen()->SetCrossHairPosition( m_valueCopy->GetTextPosition() );
wxPoint tmp = m_parent->GetCrossHairPosition();
m_parent->SetCrossHairPosition( m_valueCopy->GetTextPosition() );
m_parent->InstallTextModOptionsFrame( m_valueCopy, NULL );
m_parent->GetScreen()->SetCrossHairPosition( tmp );
m_parent->SetCrossHairPosition( tmp );
m_ValueCtrl->SetValue( m_valueCopy->GetText() );
}

View File

@ -321,7 +321,7 @@ void DIALOG_GENDRILL::SetParams()
if( m_Choice_Drill_Offset->GetSelection() == 0 )
m_FileDrillOffset = wxPoint( 0, 0 );
else
m_FileDrillOffset = m_parent->GetOriginAxisPosition();
m_FileDrillOffset = m_parent->GetAuxOrigin();
if( m_UnitDrillIsInch )
m_Precision = precisionListForInches;

View File

@ -201,14 +201,18 @@ void DIALOG_SET_GRID::OnOkClick( wxCommandEvent& event )
bool PCB_BASE_FRAME::InvokeDialogGrid()
{
wxPoint grid_origin = GetGridOrigin();
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() );
int ret = dlg.ShowModal();
if( ret == wxID_OK )
{
SetGridOrigin( grid_origin );
GetScreen()->AddGrid( m_UserGridSize, m_UserGridUnit, ID_POPUP_GRID_USER );
// If the user grid is the current option, recall SetGrid()

View File

@ -240,7 +240,7 @@ DIMENSION* PCB_EDIT_FRAME::EditDimension( DIMENSION* aDimension, wxDC* aDC )
if( aDimension == NULL )
{
status_dimension = 1;
pos = GetScreen()->GetCrossHairPosition();
pos = GetCrossHairPosition();
aDimension = new DIMENSION( GetBoard() );
aDimension->SetFlags( IS_NEW );
@ -302,7 +302,7 @@ static void BuildDimension( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
{
PCB_SCREEN* screen = (PCB_SCREEN*) aPanel->GetScreen();
DIMENSION* Dimension = (DIMENSION*) screen->GetCurItem();
wxPoint pos = screen->GetCrossHairPosition();
wxPoint pos = aPanel->GetParent()->GetCrossHairPosition();
if( Dimension == NULL )
return;
@ -386,7 +386,7 @@ void PCB_EDIT_FRAME::BeginMoveDimensionText( DIMENSION* aItem, wxDC* DC )
aItem->SetFlags( IS_MOVED );
SetMsgPanel( aItem );
GetScreen()->SetCrossHairPosition( aItem->Text().GetTextPosition() );
SetCrossHairPosition( aItem->Text().GetTextPosition() );
m_canvas->MoveCursorToCrossHair();
m_canvas->SetMouseCapture( MoveDimensionText, AbortMoveDimensionText );
@ -407,7 +407,7 @@ static void MoveDimensionText( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
if( aErase )
dimension->Draw( aPanel, aDC, GR_XOR );
dimension->Text().SetTextPosition( aPanel->GetScreen()->GetCrossHairPosition() );
dimension->Text().SetTextPosition( aPanel->GetParent()->GetCrossHairPosition() );
dimension->Draw( aPanel, aDC, GR_XOR );
}

View File

@ -66,7 +66,7 @@ void FOOTPRINT_EDIT_FRAME::Start_Move_EdgeMod( EDGE_MODULE* aEdge, wxDC* DC )
aEdge->Draw( m_canvas, DC, GR_XOR );
aEdge->SetFlags( IS_MOVED );
MoveVector.x = MoveVector.y = 0;
CursorInitialPosition = GetScreen()->GetCrossHairPosition();
CursorInitialPosition = GetCrossHairPosition();
m_canvas->SetMouseCapture( ShowCurrentOutlineWhileMoving, Abort_Move_ModuleOutline );
SetCurItem( aEdge );
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
@ -115,7 +115,7 @@ static void ShowCurrentOutlineWhileMoving( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
edge->Draw( aPanel, aDC, GR_XOR, MoveVector );
}
MoveVector = -(screen->GetCrossHairPosition() - CursorInitialPosition);
MoveVector = -(aPanel->GetParent()->GetCrossHairPosition() - CursorInitialPosition);
edge->Draw( aPanel, aDC, GR_XOR, MoveVector );
@ -142,7 +142,7 @@ static void ShowNewEdgeModule( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
edge->Draw( aPanel, aDC, GR_XOR );
}
edge->SetEnd( screen->GetCrossHairPosition() );
edge->SetEnd( aPanel->GetParent()->GetCrossHairPosition() );
// Update relative coordinate.
edge->SetEnd0( edge->GetEnd() - module->GetPosition() );
@ -346,7 +346,7 @@ EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* aEdge,
aEdge->SetLayer( SILKSCREEN_N_FRONT );
// 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
aEdge->SetEnd( aEdge->GetStart() );
@ -383,7 +383,7 @@ EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* aEdge,
aEdge->SetFlags( IS_NEW );
aEdge->SetWidth( GetDesignSettings().m_ModuleSegmentWidth );
aEdge->SetStart( GetScreen()->GetCrossHairPosition() );
aEdge->SetStart( GetCrossHairPosition() );
aEdge->SetEnd( aEdge->GetStart() );
// Update relative coordinate.

View File

@ -56,7 +56,7 @@
#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 )
{
int id = event.GetId();
@ -153,7 +153,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
m_canvas->EndMouseCapture();
}
/* Should not be executed, just in case */
// Should not be executed, just in case
if( GetScreen()->m_BlockLocate.GetCommand() != BLOCK_IDLE )
{
GetScreen()->m_BlockLocate.SetCommand( BLOCK_IDLE );
@ -544,7 +544,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
{
m_canvas->MoveCursorToCrossHair();
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
wxPoint pos = GetScreen()->GetCrossHairPosition();
wxPoint pos = GetCrossHairPosition();
/* add corner between zone_cont->m_CornerSelection
* and zone_cont->m_CornerSelection+1
@ -644,12 +644,12 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
}
SendMessageToEESCHEMA( module );
GetScreen()->SetCrossHairPosition( module->GetPosition() );
SetCrossHairPosition( module->GetPosition() );
m_canvas->MoveCursorToCrossHair();
StartMoveModule( module, &dc, id == ID_POPUP_PCB_DRAG_MODULE_REQUEST );
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() );
module = (MODULE*) GetCurItem();
@ -658,9 +658,9 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
if( module->IsLocked() )
{
wxString msg;
msg.Printf( _( "Footprint %s found, but it is locked" ),
module->GetReference().GetData() );
wxString msg = wxString::Format(
_( "Footprint %s found, but it is locked" ),
module->GetReference().GetData() );
DisplayInfoMessage( this, msg );
break;
}
@ -719,7 +719,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break;
}
/* This is a simple rotation, no other editing in progress */
// This is a simple rotation, no other editing in progress
if( !GetCurItem()->IsMoving() )
SaveCopyInUndoList( GetCurItem(), UR_ROTATED, ((MODULE*)GetCurItem())->GetPosition() );
@ -747,7 +747,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break;
}
/* This is a simple rotation, no other editing in progress */
// This is a simple rotation, no other editing in progress
if( !GetCurItem()->IsMoving() )
SaveCopyInUndoList( GetCurItem(), UR_ROTATED_CLOCKWISE,
((MODULE*)GetCurItem())->GetPosition() );
@ -776,7 +776,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break;
}
/* This is a simple flip, no other editing in progress */
// This is a simple flip, no other editing in progress
if( !GetCurItem()->IsMoving() )
SaveCopyInUndoList( GetCurItem(), UR_FLIPPED, ((MODULE*)GetCurItem())->GetPosition() );
@ -1108,14 +1108,18 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
m_canvas->MoveCursorToCrossHair();
{
TRACK* track = (TRACK*) GetScreen()->GetCurItem();
wxPoint pos = GetScreen()->GetCrossHairPosition();
wxPoint pos = GetCrossHairPosition();
track->Draw( m_canvas, &dc, GR_XOR );
PICKED_ITEMS_LIST itemsListPicker;
TRACK* newtrack = GetBoard()->CreateLockPoint( pos, track, &itemsListPicker );
SaveCopyInUndoList( itemsListPicker, UR_UNSPECIFIED );
track->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() );
}
break;

View File

@ -147,7 +147,7 @@ void PCB_EDIT_FRAME::StartMoveTextePcb( TEXTE_PCB* aTextePcb, wxDC* aDC, bool aE
m_canvas->Refresh();
#endif
GetScreen()->SetCrossHairPosition( aTextePcb->GetTextPosition() );
SetCrossHairPosition( aTextePcb->GetTextPosition() );
m_canvas->MoveCursorToCrossHair();
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
}
/* 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,
bool aErase )
{
@ -168,7 +168,7 @@ static void Move_Texte_Pcb( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aP
if( aErase )
TextePcb->Draw( aPanel, aDC, GR_XOR );
TextePcb->SetTextPosition( aPanel->GetScreen()->GetCrossHairPosition() );
TextePcb->SetTextPosition( aPanel->GetParent()->GetCrossHairPosition() );
TextePcb->Draw( aPanel, aDC, GR_XOR );
}
@ -214,7 +214,7 @@ TEXTE_PCB* PCB_EDIT_FRAME::CreateTextePcb( wxDC* aDC, TEXTE_PCB* aText )
textePcb->SetMirrored( true );
textePcb->SetSize( GetBoard()->GetDesignSettings().m_PcbTextSize );
textePcb->SetTextPosition( GetScreen()->GetCrossHairPosition() );
textePcb->SetTextPosition( GetCrossHairPosition() );
textePcb->SetThickness( GetBoard()->GetDesignSettings().m_PcbTextWidth );
InstallTextPCBOptionsFrame( textePcb, aDC );

View File

@ -43,7 +43,7 @@
#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 Move_Segment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase );
@ -61,7 +61,7 @@ void PCB_EDIT_FRAME::Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC )
drawitem->Draw( m_canvas, DC, GR_XOR );
drawitem->SetFlags( IS_MOVED );
s_InitialPosition = s_LastPosition = GetScreen()->GetCrossHairPosition();
s_InitialPosition = s_LastPosition = GetCrossHairPosition();
SetMsgPanel( drawitem );
m_canvas->SetMouseCapture( Move_Segment, Abort_EditEdge );
SetCurItem( drawitem );
@ -100,12 +100,12 @@ static void Move_Segment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPos
segment->Draw( aPanel, aDC, GR_XOR );
wxPoint delta;
delta = aPanel->GetScreen()->GetCrossHairPosition() - s_LastPosition;
delta = aPanel->GetParent()->GetCrossHairPosition() - s_LastPosition;
segment->SetStart( segment->GetStart() + delta );
segment->SetEnd( segment->GetEnd() + delta );
s_LastPosition = aPanel->GetScreen()->GetCrossHairPosition();
s_LastPosition = aPanel->GetParent()->GetCrossHairPosition();
segment->Draw( aPanel, aDC, GR_XOR );
}
@ -153,17 +153,17 @@ void PCB_EDIT_FRAME::Delete_Drawings_All_Layer( LAYER_NUM aLayer )
return;
}
wxString msg;
msg.Printf( _( "Delete everything on layer %s?" ),
GetChars( GetBoard()->GetLayerName( aLayer ) ) );
wxString msg = wxString::Format(
_( "Delete everything on layer %s?" ),
GetChars( GetBoard()->GetLayerName( aLayer ) ) );
if( !IsOK( this, msg ) )
return;
PICKED_ITEMS_LIST pickList;
ITEM_PICKER picker(NULL, UR_DELETED);
PICKED_ITEMS_LIST pickList;
ITEM_PICKER picker( NULL, UR_DELETED );
BOARD_ITEM* PtNext;
BOARD_ITEM* PtNext;
for( BOARD_ITEM* item = GetBoard()->m_Drawings; item; item = PtNext )
{
PtNext = item->Next();
@ -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 )
{
Panel->SetMouseCapture( NULL, NULL );
aPanel->SetMouseCapture( NULL, NULL );
return;
}
if( Segment->IsNew() )
{
Panel->CallMouseCapture( DC, wxDefaultPosition, false );
aPanel->CallMouseCapture( DC, wxDefaultPosition, false );
Segment ->DeleteStructure();
Segment = NULL;
}
else
{
wxPoint pos = Panel->GetScreen()->GetCrossHairPosition();
Panel->GetScreen()->SetCrossHairPosition( s_InitialPosition );
Panel->CallMouseCapture( DC, wxDefaultPosition, true );
Panel->GetScreen()->SetCrossHairPosition( pos );
wxPoint pos = aPanel->GetParent()->GetCrossHairPosition();
aPanel->GetParent()->SetCrossHairPosition( s_InitialPosition );
aPanel->CallMouseCapture( DC, wxDefaultPosition, true );
aPanel->GetParent()->SetCrossHairPosition( pos );
Segment->ClearFlags();
Segment->Draw( Panel, DC, GR_OR );
Segment->Draw( aPanel, DC, GR_OR );
}
#ifdef USE_WX_OVERLAY
Panel->Refresh();
aPanel->Refresh();
#endif
Panel->SetMouseCapture( NULL, NULL );
( (PCB_EDIT_FRAME*) Panel->GetParent() )->SetCurItem( NULL );
aPanel->SetMouseCapture( NULL, NULL );
( (PCB_EDIT_FRAME*) aPanel->GetParent() )->SetCurItem( NULL );
}
@ -259,8 +259,8 @@ DRAWSEGMENT* PCB_EDIT_FRAME::Begin_DrawSegment( DRAWSEGMENT* Segment, STROKE_T s
Segment->SetWidth( s_large );
Segment->SetShape( shape );
Segment->SetAngle( 900 );
Segment->SetStart( GetScreen()->GetCrossHairPosition() );
Segment->SetEnd( GetScreen()->GetCrossHairPosition() );
Segment->SetStart( GetCrossHairPosition() );
Segment->SetEnd( GetCrossHairPosition() );
m_canvas->SetMouseCapture( DrawSegment, Abort_EditEdge );
}
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
{
wxPoint pt;
CalculateSegmentEndPoint( aPanel->GetScreen()->GetCrossHairPosition(),
CalculateSegmentEndPoint( aPanel->GetParent()->GetCrossHairPosition(),
Segment->GetStart().x, Segment->GetStart().y,
&pt.x, &pt.y );
Segment->SetEnd( pt );
}
else // here the angle is arbitrary
{
Segment->SetEnd( aPanel->GetScreen()->GetCrossHairPosition() );
Segment->SetEnd( aPanel->GetParent()->GetCrossHairPosition() );
}
Segment->Draw( aPanel, aDC, GR_XOR );

View File

@ -101,7 +101,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC )
TRACK* TrackOnStartPoint = NULL;
LAYER_MSK layerMask = GetLayerMask( GetScreen()->m_Active_Layer );
BOARD_CONNECTED_ITEM* LockPoint;
wxPoint pos = GetScreen()->GetCrossHairPosition();
wxPoint pos = GetCrossHairPosition();
if( aTrack == NULL ) // Starting a new track segment
{
@ -595,17 +595,17 @@ TRACK* LocateIntrusion( TRACK* listStart, TRACK* aTrack, LAYER_NUM aLayer, const
*/
static void PushTrack( EDA_DRAW_PANEL* panel )
{
PCB_SCREEN* screen = ( (PCB_BASE_FRAME*) (panel->GetParent()) )->GetScreen();
BOARD* pcb = ( (PCB_BASE_FRAME*) (panel->GetParent()) )->GetBoard();
wxPoint cursor = screen->GetCrossHairPosition();
wxPoint cv, vec, n;
TRACK* track = g_CurrentTrackSegment;
TRACK* other;
double det;
int dist;
double f;
PCB_SCREEN* screen = (PCB_SCREEN*) panel->GetParent()->GetScreen();
BOARD* pcb = ( (PCB_BASE_FRAME*) (panel->GetParent()) )->GetBoard();
wxPoint cursor = panel->GetParent()->GetCrossHairPosition();
wxPoint cv, vec, n;
TRACK* track = g_CurrentTrackSegment;
TRACK* other;
double det;
int dist;
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 ?
if( !other )
@ -735,7 +735,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
{
if( g_TwoSegmentTrackBuild )
{
g_CurrentTrackSegment->SetEnd( screen->GetCrossHairPosition() );
g_CurrentTrackSegment->SetEnd( frame->GetCrossHairPosition() );
if( g_Drc_On )
PushTrack( aPanel );
@ -750,7 +750,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
* horizontal, vertical or 45 degrees.
*/
wxPoint hp = g_CurrentTrackSegment->GetEnd();
CalculateSegmentEndPoint( screen->GetCrossHairPosition(),
CalculateSegmentEndPoint( frame->GetCrossHairPosition(),
g_CurrentTrackSegment->GetStart().x,
g_CurrentTrackSegment->GetStart().y,
&hp.x,
@ -760,7 +760,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
}
else // Here the angle is arbitrary
{
g_CurrentTrackSegment->SetEnd( screen->GetCrossHairPosition() );
g_CurrentTrackSegment->SetEnd( frame->GetCrossHairPosition() );
}
// Redraw the new track

View File

@ -68,7 +68,7 @@ TEXTE_MODULE* PCB_BASE_FRAME::CreateTextModule( MODULE* Module, wxDC* DC )
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 )
Module->GraphicalItems().PushFront( Text );
@ -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 );
Text->SetSize( GetDesignSettings().m_ModuleTextSize );
Text->SetThickness( GetDesignSettings().m_ModuleTextWidth );
Text->SetTextPosition( GetScreen()->GetCrossHairPosition() );
Text->SetTextPosition( GetCrossHairPosition() );
Text->SetLocalCoord();
InstallTextModOptionsFrame( Text, NULL );
@ -175,7 +175,7 @@ static void AbortMoveTextModule( EDA_DRAW_PANEL* Panel, wxDC* DC )
if( Text->IsMoving() )
Text->SetOrientation( TextInitialOrientation );
/* Redraw the text */
// Redraw the text
Panel->RefreshDrawingRect( Text->GetBoundingBox() );
// 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 )
TextInitialOrientation = Text->GetOrientation();
// Center cursor on initial position of text
GetScreen()->SetCrossHairPosition( TextInitialPosition );
SetCrossHairPosition( TextInitialPosition );
m_canvas->MoveCursorToCrossHair();
SetMsgPanel( Text );
@ -227,7 +227,7 @@ void PCB_BASE_FRAME::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC )
m_canvas->RefreshDrawingRect( Text->GetBoundingBox() );
Text->DrawUmbilical( m_canvas, DC, GR_XOR, -MoveVector );
/* Update the coordinates for anchor. */
// Update the coordinates for anchor.
MODULE* Module = (MODULE*) Text->GetParent();
if( Module )
@ -244,7 +244,7 @@ void PCB_BASE_FRAME::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC )
Text->SetOrientation( tmp );
// Set the new position for text.
Text->SetTextPosition( GetScreen()->GetCrossHairPosition() );
Text->SetTextPosition( GetCrossHairPosition() );
wxPoint textRelPos = Text->GetTextPosition() - Module->GetPosition();
RotatePoint( &textRelPos, -Module->GetOrientation() );
Text->SetPos0( textRelPos );
@ -253,12 +253,12 @@ void PCB_BASE_FRAME::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC )
Module->SetLastEditTime();
OnModify();
/* Redraw text. */
// Redraw text.
m_canvas->RefreshDrawingRect( Text->GetBoundingBox() );
}
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
Text->Draw( aPanel, aDC, GR_XOR, MoveVector );
}
MoveVector = TextInitialPosition - screen->GetCrossHairPosition();
MoveVector = TextInitialPosition - aPanel->GetParent()->GetCrossHairPosition();
// Draw umbilical if text moved
if( MoveVector.x || MoveVector.y )

View File

@ -146,8 +146,8 @@ void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& aEvent )
GetBoard()->ComputeBoundingBox();
// Save the auxiliary origin for the rest of the module
GencadOffsetX = GetOriginAxisPosition().x;
GencadOffsetY = GetOriginAxisPosition().y;
GencadOffsetX = GetAuxOrigin().x;
GencadOffsetY = GetAuxOrigin().y;
// No idea on *why* this should be needed... maybe to fix net names?
Compile_Ratsnest( NULL, true );
@ -708,8 +708,8 @@ static bool CreateHeaderInfoData( FILE* aFile, PCB_EDIT_FRAME* aFrame )
fputs( "UNITS INCH\n", aFile );
msg.Printf( wxT( "ORIGIN %g %g\n" ),
MapXTo( aFrame->GetOriginAxisPosition().x ),
MapYTo( aFrame->GetOriginAxisPosition().y ) );
MapXTo( aFrame->GetAuxOrigin().x ),
MapYTo( aFrame->GetAuxOrigin().y ) );
fputs( TO_UTF8( msg ), aFile );
fputs( "INTERTRACK 0\n", aFile );

View File

@ -53,16 +53,16 @@
BEGIN_EVENT_TABLE( FOOTPRINT_WIZARD_FRAME, EDA_DRAW_FRAME )
/* Window events */
// Window events
EVT_CLOSE( FOOTPRINT_WIZARD_FRAME::OnCloseWindow )
EVT_SIZE( FOOTPRINT_WIZARD_FRAME::OnSize )
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_PARAMETERS, FOOTPRINT_WIZARD_FRAME::OnSashDrag )
/* Toolbar events */
// Toolbar events
EVT_TOOL( ID_FOOTPRINT_WIZARD_SELECT_WIZARD,
FOOTPRINT_WIZARD_FRAME::SelectCurrentWizard )
@ -78,7 +78,7 @@ EVT_TOOL( ID_FOOTPRINT_WIZARD_DONE,
EVT_TOOL( ID_FOOTPRINT_WIZARD_SHOW_3D_VIEW,
FOOTPRINT_WIZARD_FRAME::Show3D_Frame )
/* listbox events */
// listbox events
EVT_LISTBOX( ID_FOOTPRINT_WIZARD_PAGE_LIST, FOOTPRINT_WIZARD_FRAME::ClickOnPageList )
EVT_GRID_CMD_CELL_CHANGE( ID_FOOTPRINT_WIZARD_PARAMETER_LIST,
FOOTPRINT_WIZARD_FRAME::ParametersUpdated )
@ -374,7 +374,7 @@ void FOOTPRINT_WIZARD_FRAME::OnSize( wxSizeEvent& SizeEv )
*/
void FOOTPRINT_WIZARD_FRAME::OnSetRelativeOffset( wxCommandEvent& event )
{
GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition();
GetScreen()->m_O_Curseur = GetCrossHairPosition();
UpdateStatusBar();
}
@ -587,8 +587,8 @@ void FOOTPRINT_WIZARD_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition
cmd.SetEventObject( this );
pos = screen->GetNearestGridPosition( pos );
oldpos = screen->GetCrossHairPosition();
pos = GetNearestGridPosition( pos );
oldpos = GetCrossHairPosition();
gridSize = screen->GetGridSize();
switch( aHotKey )
@ -619,42 +619,42 @@ void FOOTPRINT_WIZARD_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition
break;
case ' ':
screen->m_O_Curseur = screen->GetCrossHairPosition();
screen->m_O_Curseur = GetCrossHairPosition();
break;
case WXK_NUMPAD8: /* cursor moved up */
case WXK_NUMPAD8: // cursor moved up
case WXK_UP:
pos.y -= KiROUND( gridSize.y );
m_canvas->MoveCursor( pos );
break;
case WXK_NUMPAD2: /* cursor moved down */
case WXK_NUMPAD2: // cursor moved down
case WXK_DOWN:
pos.y += KiROUND( gridSize.y );
m_canvas->MoveCursor( pos );
break;
case WXK_NUMPAD4: /* cursor moved left */
case WXK_NUMPAD4: // cursor moved left
case WXK_LEFT:
pos.x -= KiROUND( gridSize.x );
m_canvas->MoveCursor( pos );
break;
case WXK_NUMPAD6: /* cursor moved right */
case WXK_NUMPAD6: // cursor moved right
case WXK_RIGHT:
pos.x += KiROUND( gridSize.x );
m_canvas->MoveCursor( pos );
break;
}
screen->SetCrossHairPosition( pos );
SetCrossHairPosition( pos );
if( oldpos != screen->GetCrossHairPosition() )
if( oldpos != GetCrossHairPosition() )
{
pos = screen->GetCrossHairPosition();
screen->SetCrossHairPosition( oldpos );
pos = GetCrossHairPosition();
SetCrossHairPosition( oldpos );
m_canvas->CrossHairOff( aDC );
screen->SetCrossHairPosition( pos );
SetCrossHairPosition( pos );
m_canvas->CrossHairOn( aDC );
if( m_canvas->IsMouseCaptured() )
@ -663,7 +663,7 @@ void FOOTPRINT_WIZARD_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition
}
}
UpdateStatusBar(); /* Display new cursor coordinates */
UpdateStatusBar(); // Display new cursor coordinates
}

View File

@ -359,7 +359,7 @@ int PCB_EDIT_FRAME::DoGenFootprintsPositionFile( const wxString& aFullFileName,
MODULE* module;
char line[1024];
File_Place_Offset = GetOriginAxisPosition();
File_Place_Offset = GetAuxOrigin();
// Calculating the number of useful modules (CMS attribute, not VIRTUAL)
int moduleCount = 0;

View File

@ -133,7 +133,7 @@ int PCB_EDIT_FRAME::SelectHighLight( wxDC* DC )
// optionally, modify the "guide" here as needed using its member functions
m_Collector->Collect( GetBoard(), GENERAL_COLLECTOR::PadsTracksOrZones,
GetScreen()->RefPos( true ), guide );
RefPos( true ), guide );
BOARD_ITEM* item = (*m_Collector)[0];

View File

@ -24,7 +24,7 @@
* 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.)
*
* 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)
* 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
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 HkAddVia( wxT( "Add Via" ), HK_ADD_VIA, 'V' );
static EDA_HOTKEY HkSwitchTrackPosture( wxT( "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 HkSwitchTrackPosture( wxT( "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 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 HkEndTrack( wxT( "End Track" ), HK_END_TRACK, WXK_END );
@ -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 HkCopyItem( wxT( "Copy Item" ), HK_COPY_ITEM, 'C' );
static EDA_HOTKEY HkDragFootprint( wxT( "Drag Footprint" ), HK_DRAG_ITEM, 'G' );
static EDA_HOTKEY HkGetAndMoveFootprint( wxT( "Get and Move Footprint" ),
HK_GET_AND_MOVE_FOOTPRINT, 'T' );
static EDA_HOTKEY HkLock_Unlock_Footprint( wxT( "Lock/Unlock Footprint" ),
HK_LOCK_UNLOCK_FOOTPRINT, 'L' );
static EDA_HOTKEY HkGetAndMoveFootprint( wxT( "Get and Move Footprint" ), HK_GET_AND_MOVE_FOOTPRINT, 'T' );
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 HkResetLocalCoord( wxT( "Reset Local Coordinates" ),
HK_RESET_LOCAL_COORD, ' ' );
static EDA_HOTKEY HkSwitchHighContrastMode( wxT("Switch Highcontrast mode"),
HK_SWITCH_HIGHCONTRAST_MODE,'H');
static EDA_HOTKEY HkResetLocalCoord( wxT( "Reset Local Coordinates" ), HK_RESET_LOCAL_COORD, ' ' );
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 */
#if !defined( __WXMAC__ )
static EDA_HOTKEY HkZoomAuto( wxT( "Zoom Auto" ), HK_ZOOM_AUTO, WXK_HOME );
@ -198,7 +195,7 @@ EDA_HOTKEY* common_Hotkey_List[] =
{
&HkHelp, &HkZoomIn, &HkZoomOut,
&HkZoomRedraw, &HkZoomCenter, &HkZoomAuto,
&HkSwitchUnits, &HkResetLocalCoord,
&HkSwitchUnits, &HkResetLocalCoord, &HkSetGridOrigin,
&HkUndo, &HkRedo,
NULL
};

View File

@ -30,7 +30,7 @@ void PCB_EDIT_FRAME::RecordMacros(wxDC* aDC, int aNumber)
if( m_RecordingMacros < 0 )
{
m_RecordingMacros = aNumber;
m_Macros[aNumber].m_StartPosition = GetScreen()->GetCrossHairPosition( false );
m_Macros[aNumber].m_StartPosition = GetCrossHairPosition( false );
m_Macros[aNumber].m_Record.clear();
msg.Printf( _( "Recording macro %d" ), 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 )
{
PCB_SCREEN* screen = GetScreen();
wxPoint tPosition;
wxString msg;
@ -59,19 +58,19 @@ void PCB_EDIT_FRAME::CallMacros( wxDC* aDC, const wxPoint& aPosition, int aNumbe
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this );
tPosition = screen->GetNearestGridPosition( aPosition );
tPosition = GetNearestGridPosition( aPosition );
m_canvas->CrossHairOff( aDC );
screen->SetMousePosition( tPosition );
SetMousePosition( tPosition );
GeneralControl( aDC, tPosition );
for( std::list<MACROS_RECORD>::iterator i = m_Macros[aNumber].m_Record.begin();
i != m_Macros[aNumber].m_Record.end();
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 );
}
@ -117,8 +116,8 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
MACROS_RECORD macros_record;
macros_record.m_HotkeyCode = aHotkeyCode;
macros_record.m_Idcommand = HK_Descr->m_Idcommand;
macros_record.m_Position = screen->GetNearestGridPosition( aPosition ) -
m_Macros[m_RecordingMacros].m_StartPosition;
macros_record.m_Position = GetNearestGridPosition( aPosition ) -
m_Macros[m_RecordingMacros].m_StartPosition;
m_Macros[m_RecordingMacros].m_Record.push_back( macros_record );
wxString msg;
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
case HK_CALL_MACROS_7:
case HK_CALL_MACROS_8:
case HK_CALL_MACROS_9:
CallMacros( aDC, screen->GetCrossHairPosition( false ),
hk_id - HK_CALL_MACROS_0 );
CallMacros( aDC, GetCrossHairPosition( false ), hk_id - HK_CALL_MACROS_0 );
break;
case HK_SWITCH_TRACK_WIDTH_TO_NEXT:
@ -222,7 +220,6 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
cmd.SetEventType( wxEVT_COMMAND_COMBOBOX_SELECTED );
OnSelectGrid( cmd );
}
break;
case HK_SWITCH_GRID_TO_PREVIOUS:
@ -344,8 +341,14 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
break;
case HK_RESET_LOCAL_COORD: /*Reset the relative coord */
GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition();
case HK_RESET_LOCAL_COORD: // Set the relative coord
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;
case HK_SWITCH_UNITS:
@ -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
if( !itemCurrentlyEdited )
{
wxPoint pos = screen->RefPos( true );
wxPoint pos = RefPos( true );
module = GetBoard()->GetFootprint( pos, screen->m_Active_Layer, true );
}
else if( GetCurItem()->Type() == PCB_MODULE_T )
@ -513,7 +516,6 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
OnModify();
SetMsgPanel( module );
}
break;
case HK_DRAG_ITEM: // Start drag module or track segment
@ -586,7 +588,7 @@ bool PCB_EDIT_FRAME::OnHotkeyDeleteItem( wxDC* aDC )
case ID_PCB_MODULE_BUTT:
if( ItemFree )
{
wxPoint pos = GetScreen()->RefPos( false );
wxPoint pos = RefPos( false );
MODULE* module = GetBoard()->GetFootprint( pos, UNDEFINED_LAYER, false );
if( module == NULL )

View File

@ -51,12 +51,17 @@ void FOOTPRINT_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPos
return;
break;
case HK_HELP: // Display Current hotkey list
case HK_HELP: // Display Current hotkey list
DisplayHotkeyList( this, g_Module_Editor_Hokeys_Descr );
break;
case HK_RESET_LOCAL_COORD: /*Reset the relative coord */
GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition();
case HK_RESET_LOCAL_COORD: // set local (relative) coordinate origin
GetScreen()->m_O_Curseur = GetCrossHairPosition();
break;
case HK_SET_GRID_ORIGIN:
SetGridOrigin( GetCrossHairPosition() );
m_canvas->Refresh();
break;
case HK_SWITCH_UNITS:

View File

@ -557,8 +557,12 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const
Double2Str( aBoard->GetDesignSettings().m_SolderPasteMarginRatio ).c_str() );
m_out->Print( aNestLevel+1, "(aux_axis_origin %s %s)\n",
FMTIU( aBoard->GetOriginAxisPosition().x ).c_str(),
FMTIU( aBoard->GetOriginAxisPosition().y ).c_str() );
FMTIU( aBoard->GetAuxOrigin().x ).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",
aBoard->GetDesignSettings().GetVisibleElements() );

View File

@ -649,7 +649,8 @@ void LEGACY_PLUGIN::loadSETUP()
BIU gx = biuParse( line + SZ( "AuxiliaryAxisOrg" ), &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" ) )
@ -851,13 +852,11 @@ void LEGACY_PLUGIN::loadSETUP()
else if( TESTLINE( "GridOrigin" ) )
{
/* @todo
BIU gx = biuParse( line + SZ( "GridOrigin" ), &data );
BIU gy = biuParse( data );
BIU x = biuParse( line + SZ( "GridOrigin" ), &data );
BIU y = biuParse( data );
GetScreen()->m_GridOrigin.x = Ox;
GetScreen()->m_GridOrigin.y = Oy;
*/
// m_board->SetGridOrigin( wxPoint( x, y ) ); gets overwritten by SetDesignSettings() below
bds.m_GridOrigin = wxPoint( x, y );
}
else if( TESTLINE( "VisibleElements" ) )
@ -3071,14 +3070,8 @@ void LEGACY_PLUGIN::saveSETUP( const BOARD* aBoard ) const
if( bds.m_SolderPasteMarginRatio != 0 )
fprintf( m_fp, "Pad2PasteClearanceRatio %g\n", bds.m_SolderPasteMarginRatio );
/* @todo no aFrame
if ( aFrame->GetScreen()->m_GridOrigin != wxPoint( 0, 0 ) )
{
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, "GridOrigin %s\n", fmtBIUPoint( aBoard->GetGridOrigin() ).c_str() );
fprintf( m_fp, "AuxiliaryAxisOrg %s\n", fmtBIUPoint( aBoard->GetAuxOrigin() ).c_str() );
fprintf( m_fp, "VisibleElements %X\n", bds.GetVisibleElements() );

View File

@ -725,7 +725,7 @@ MODULE* PCB_BASE_FRAME::Create_1_Module( const wxString& aModuleName )
GetBoard()->Add( module );
// Update parameters: position, timestamp ...
newpos = GetScreen()->GetCrossHairPosition();
newpos = GetCrossHairPosition();
module->SetPosition( newpos );
module->SetLastEditTime();

View File

@ -93,7 +93,7 @@ bool FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD( MODULE* aModule )
GetBoard()->BuildListOfNets();
GetScreen()->SetCrossHairPosition( wxPoint( 0, 0 ) );
SetCrossHairPosition( wxPoint( 0, 0 ) );
PlaceModule( aModule, NULL );
// Put it on FRONT layer,
@ -155,7 +155,7 @@ MODULE* PCB_BASE_FRAME::LoadModuleFromLibrary( const wxString& aLibrary,
wxDC* aDC )
{
MODULE* module;
wxPoint curspos = GetScreen()->GetCrossHairPosition();
wxPoint curspos = GetCrossHairPosition();
wxString moduleName, keys;
wxString libName = aLibrary;
bool allowWildSeach = true;
@ -277,7 +277,7 @@ MODULE* PCB_BASE_FRAME::LoadModuleFromLibrary( const wxString& aLibrary,
}
}
GetScreen()->SetCrossHairPosition( curspos );
SetCrossHairPosition( curspos );
m_canvas->MoveCursorToCrossHair();
if( module )

View File

@ -116,7 +116,7 @@ bool Magnetize( PCB_EDIT_FRAME* frame, int aCurrentTool, wxSize aGridSize,
TRACK* currTrack = g_CurrentTrackSegment;
BOARD_ITEM* currItem = frame->GetCurItem();
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 ); )
@ -133,7 +133,6 @@ bool Magnetize( PCB_EDIT_FRAME* frame, int aCurrentTool, wxSize aGridSize,
currTrack = NULL;
}
if( g_MagneticPadOption == capture_always )
doPad = true;

View File

@ -16,14 +16,14 @@
#include <protos.h>
/* Routines Locales */
// Routines Locales
static void AbortMoveAndEditTarget( EDA_DRAW_PANEL* Panel, wxDC* DC );
static void ShowTargetShapeWhileMovingMouse( EDA_DRAW_PANEL* aPanel,
wxDC* aDC,
const wxPoint& aPosition,
bool aErase );
/* Local variables : */
// Local variables :
static int MireDefaultSize = 5000;
static PCB_TARGET s_TargetCopy( NULL ); /* Used to store "old" values of the
* current item parameters before
@ -93,7 +93,7 @@ TARGET_PROPERTIES_DIALOG_EDITOR::TARGET_PROPERTIES_DIALOG_EDITOR( PCB_EDIT_FRAME
MainBoxSizer->Add( LeftBoxSizer, 0, wxGROW | 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" ) );
RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
@ -215,7 +215,7 @@ PCB_TARGET* PCB_EDIT_FRAME::CreateTarget( wxDC* DC )
target->SetLayer( EDGE_N );
target->SetWidth( GetDesignSettings().m_EdgeSegmentWidth );
target->SetSize( MireDefaultSize );
target->SetPosition( m_canvas->GetScreen()->GetCrossHairPosition() );
target->SetPosition( GetCrossHairPosition() );
PlaceTarget( target, 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,
const wxPoint& aPosition, bool aErase )
{
@ -286,7 +286,7 @@ static void ShowTargetShapeWhileMovingMouse( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
if( aErase )
target->Draw( aPanel, aDC, GR_XOR );
target->SetPosition( screen->GetCrossHairPosition() );
target->SetPosition( aPanel->GetParent()->GetCrossHairPosition() );
target->Draw( aPanel, aDC, GR_XOR );
}

View File

@ -87,9 +87,9 @@ BOARD_ITEM* FOOTPRINT_EDIT_FRAME::ModeditLocateAndDisplay( int aHotKeyCode )
scanList = GENERAL_COLLECTOR::ModulesAndTheirItems;
}
m_Collector->Collect( GetBoard(), scanList, GetScreen()->RefPos( true ), guide );
m_Collector->Collect( GetBoard(), scanList, RefPos( true ), guide );
/* Remove redundancies: when an item is found, we can remove the module from list */
// Remove redundancies: when an item is found, we can remove the module from list
if( m_Collector->GetCount() > 1 )
{
for( int ii = 0; ii < m_Collector->GetCount(); ii++ )
@ -113,7 +113,7 @@ BOARD_ITEM* FOOTPRINT_EDIT_FRAME::ModeditLocateAndDisplay( int aHotKeyCode )
{
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" ) );
#ifdef __WINDOWS__
@ -255,100 +255,100 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_OPEN_MODULE_VIEWER:
{
FOOTPRINT_VIEWER_FRAME * viewer = FOOTPRINT_VIEWER_FRAME::GetActiveFootprintViewer();
if( viewer == NULL )
{
viewer = new FOOTPRINT_VIEWER_FRAME( this, m_footprintLibTable, NULL );
viewer->Show( true );
viewer->Zoom_Automatique( false );
}
else
{
if( viewer->IsIconized() )
viewer->Iconize( false );
FOOTPRINT_VIEWER_FRAME * viewer = FOOTPRINT_VIEWER_FRAME::GetActiveFootprintViewer();
viewer->Raise();
if( viewer == NULL )
{
viewer = new FOOTPRINT_VIEWER_FRAME( this, m_footprintLibTable, NULL );
viewer->Show( true );
viewer->Zoom_Automatique( false );
}
else
{
if( viewer->IsIconized() )
viewer->Iconize( false );
// Raising the window does not set the focus on Linux. This should work on
// any platform.
if( wxWindow::FindFocus() != viewer )
viewer->SetFocus();
viewer->Raise();
// Raising the window does not set the focus on Linux. This should work on
// any platform.
if( wxWindow::FindFocus() != viewer )
viewer->SetFocus();
}
}
}
break;
break;
case ID_MODEDIT_DELETE_PART:
DeleteModuleFromCurrentLibrary();
break;
case ID_MODEDIT_NEW_MODULE:
{
Clear_Pcb( true );
GetScreen()->ClearUndoRedoList();
SetCurItem( NULL );
GetScreen()->SetCrossHairPosition( wxPoint( 0, 0 ) );
MODULE* module = Create_1_Module( wxEmptyString );
if( module ) // i.e. if create module command not aborted
{
// Initialize data relative to nets and netclasses (for a new
// module the defaults are used)
// This is mandatory to handle and draw pads
GetBoard()->BuildListOfNets();
redraw = true;
module->SetPosition( wxPoint( 0, 0 ) );
Clear_Pcb( true );
GetScreen()->ClearUndoRedoList();
SetCurItem( NULL );
SetCrossHairPosition( wxPoint( 0, 0 ) );
if( GetBoard()->m_Modules )
GetBoard()->m_Modules->ClearFlags();
MODULE* module = Create_1_Module( wxEmptyString );
Zoom_Automatique( false );
if( module ) // i.e. if create module command not aborted
{
// Initialize data relative to nets and netclasses (for a new
// module the defaults are used)
// This is mandatory to handle and draw pads
GetBoard()->BuildListOfNets();
redraw = true;
module->SetPosition( wxPoint( 0, 0 ) );
if( GetBoard()->m_Modules )
GetBoard()->m_Modules->ClearFlags();
Zoom_Automatique( false );
}
}
}
break;
break;
case ID_MODEDIT_NEW_MODULE_FROM_WIZARD:
{
Clear_Pcb( true );
GetScreen()->ClearUndoRedoList();
SetCurItem( NULL );
GetScreen()->SetCrossHairPosition( wxPoint( 0, 0 ) );
wxSemaphore semaphore( 0, 1 );
FOOTPRINT_WIZARD_FRAME *wizard = new FOOTPRINT_WIZARD_FRAME( this, &semaphore,
KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT );
wizard->Show( true );
wizard->Zoom_Automatique( false );
while( semaphore.TryWait() == wxSEMA_BUSY ) // Wait for viewer closing event
{
wxYield();
wxMilliSleep( 50 );
Clear_Pcb( true );
GetScreen()->ClearUndoRedoList();
SetCurItem( NULL );
SetCrossHairPosition( wxPoint( 0, 0 ) );
wxSemaphore semaphore( 0, 1 );
FOOTPRINT_WIZARD_FRAME *wizard = new FOOTPRINT_WIZARD_FRAME( this, &semaphore,
KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT );
wizard->Show( true );
wizard->Zoom_Automatique( false );
while( semaphore.TryWait() == wxSEMA_BUSY ) // Wait for viewer closing event
{
wxYield();
wxMilliSleep( 50 );
}
MODULE* module = wizard->GetBuiltFootprint();
if( module ) // i.e. if create module command not aborted
{
// Here we should make a copy of the object before adding to board
module->SetParent( (EDA_ITEM*)GetBoard() );
GetBoard()->m_Modules.Append( module );
// Initialize data relative to nets and netclasses (for a new
// module the defaults are used)
// This is mandatory to handle and draw pads
GetBoard()->BuildListOfNets();
redraw = true;
module->SetPosition( wxPoint( 0, 0 ) );
if( GetBoard()->m_Modules )
GetBoard()->m_Modules->ClearFlags();
}
wizard->Destroy();
}
MODULE* module = wizard->GetBuiltFootprint();
if( module ) // i.e. if create module command not aborted
{
/* Here we should make a copy of the object before adding to board*/
module->SetParent( (EDA_ITEM*)GetBoard() );
GetBoard()->m_Modules.Append( module );
// Initialize data relative to nets and netclasses (for a new
// module the defaults are used)
// This is mandatory to handle and draw pads
GetBoard()->BuildListOfNets();
redraw = true;
module->SetPosition( wxPoint( 0, 0 ) );
if( GetBoard()->m_Modules )
GetBoard()->m_Modules->ClearFlags();
}
wizard->Destroy();
}
break;
case ID_MODEDIT_SAVE_LIBMODULE:
@ -361,84 +361,84 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_MODEDIT_INSERT_MODULE_IN_BOARD:
case ID_MODEDIT_UPDATE_MODULE_IN_BOARD:
{
// update module in the current board,
// not just add it to the board with total disregard for the netlist...
PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) GetParent();
BOARD* mainpcb = pcbframe->GetBoard();
MODULE* source_module = NULL;
MODULE* module_in_edit = GetBoard()->m_Modules;
// Search the old module (source) if exists
// Because this source could be deleted when editing the main board...
if( module_in_edit->GetLink() ) // this is not a new module ...
{
source_module = mainpcb->m_Modules;
// update module in the current board,
// not just add it to the board with total disregard for the netlist...
PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) GetParent();
BOARD* mainpcb = pcbframe->GetBoard();
MODULE* source_module = NULL;
MODULE* module_in_edit = GetBoard()->m_Modules;
for( ; source_module != NULL; source_module = (MODULE*) source_module->Next() )
// Search the old module (source) if exists
// Because this source could be deleted when editing the main board...
if( module_in_edit->GetLink() ) // this is not a new module ...
{
if( module_in_edit->GetLink() == source_module->GetTimeStamp() )
break;
source_module = mainpcb->m_Modules;
for( ; source_module != NULL; source_module = (MODULE*) source_module->Next() )
{
if( module_in_edit->GetLink() == source_module->GetTimeStamp() )
break;
}
}
if( ( source_module == NULL )
&& ( id == ID_MODEDIT_UPDATE_MODULE_IN_BOARD ) ) // source not found
{
wxString msg;
msg.Printf( _( "Unable to find the footprint source on the main board" ) );
msg << _( "\nCannot update the footprint" );
DisplayError( this, msg );
break;
}
if( ( source_module != NULL )
&& ( id == ID_MODEDIT_INSERT_MODULE_IN_BOARD ) ) // source not found
{
wxString msg;
msg.Printf( _( "A footprint source was found on the main board" ) );
msg << _( "\nCannot insert this footprint" );
DisplayError( this, msg );
break;
}
// Create the "new" module
MODULE* newmodule = new MODULE( *module_in_edit );
newmodule->SetParent( mainpcb );
newmodule->SetLink( 0 );
// Put the footprint in the main pcb linked list.
mainpcb->Add( newmodule );
if( source_module ) // this is an update command
{
// In the main board,
// the new module replace the old module (pos, orient, ref, value
// and connexions are kept)
// and the source_module (old module) is deleted
PICKED_ITEMS_LIST pickList;
pcbframe->Exchange_Module( source_module, newmodule, &pickList );
newmodule->SetTimeStamp( module_in_edit->GetLink() );
if( pickList.GetCount() )
pcbframe->SaveCopyInUndoList( pickList, UR_UNSPECIFIED );
}
else // This is an insert command
{
wxPoint cursor_pos = pcbframe->GetCrossHairPosition();
pcbframe->SetCrossHairPosition( wxPoint( 0, 0 ) );
pcbframe->PlaceModule( newmodule, NULL );
pcbframe->SetCrossHairPosition( cursor_pos );
newmodule->SetTimeStamp( GetNewTimeStamp() );
pcbframe->SaveCopyInUndoList( newmodule, UR_NEW );
}
newmodule->ClearFlags();
GetScreen()->ClrModify();
pcbframe->SetCurItem( NULL );
mainpcb->m_Status_Pcb = 0;
}
if( ( source_module == NULL )
&& ( id == ID_MODEDIT_UPDATE_MODULE_IN_BOARD ) ) // source not found
{
wxString msg;
msg.Printf( _( "Unable to find the footprint source on the main board" ) );
msg << _( "\nCannot update the footprint" );
DisplayError( this, msg );
break;
}
if( ( source_module != NULL )
&& ( id == ID_MODEDIT_INSERT_MODULE_IN_BOARD ) ) // source not found
{
wxString msg;
msg.Printf( _( "A footprint source was found on the main board" ) );
msg << _( "\nCannot insert this footprint" );
DisplayError( this, msg );
break;
}
// Create the "new" module
MODULE* newmodule = new MODULE( *module_in_edit );
newmodule->SetParent( mainpcb );
newmodule->SetLink( 0 );
// Put the footprint in the main pcb linked list.
mainpcb->Add( newmodule );
if( source_module ) // this is an update command
{
// In the main board,
// the new module replace the old module (pos, orient, ref, value
// and connexions are kept)
// and the source_module (old module) is deleted
PICKED_ITEMS_LIST pickList;
pcbframe->Exchange_Module( source_module, newmodule, &pickList );
newmodule->SetTimeStamp( module_in_edit->GetLink() );
if( pickList.GetCount() )
pcbframe->SaveCopyInUndoList( pickList, UR_UNSPECIFIED );
}
else // This is an insert command
{
wxPoint cursor_pos = pcbframe->GetScreen()->GetCrossHairPosition();
pcbframe->GetScreen()->SetCrossHairPosition( wxPoint( 0, 0 ) );
pcbframe->PlaceModule( newmodule, NULL );
pcbframe->GetScreen()->SetCrossHairPosition( cursor_pos );
newmodule->SetTimeStamp( GetNewTimeStamp() );
pcbframe->SaveCopyInUndoList( newmodule, UR_NEW );
}
newmodule->ClearFlags();
GetScreen()->ClrModify();
pcbframe->SetCurItem( NULL );
mainpcb->m_Status_Pcb = 0;
}
break;
break;
case ID_MODEDIT_IMPORT_PART:
if( ! Clear_Pcb( true ) )
@ -446,7 +446,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
GetScreen()->ClearUndoRedoList();
SetCurItem( NULL );
GetScreen()->SetCrossHairPosition( wxPoint( 0, 0 ) );
SetCrossHairPosition( wxPoint( 0, 0 ) );
Import_Module();
redraw = true;
@ -485,7 +485,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
GetScreen()->ClearUndoRedoList();
SetCurItem( NULL );
Clear_Pcb( true );
GetScreen()->SetCrossHairPosition( wxPoint( 0, 0 ) );
SetCrossHairPosition( wxPoint( 0, 0 ) );
#if !defined( USE_FP_LIB_TABLE )
LoadModuleFromLibrary( getLibPath(), m_footprintLibTable, true );

View File

@ -132,32 +132,31 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
break;
case ID_MODEDIT_ANCHOR_TOOL:
{
MODULE* module = GetBoard()->m_Modules;
{
MODULE* module = GetBoard()->m_Modules;
if( module == NULL // No module loaded
|| (module->GetFlags() != 0) )
break;
if( module == NULL // No module loaded
|| (module->GetFlags() != 0) )
break;
SaveCopyInUndoList( module, UR_MODEDIT );
SaveCopyInUndoList( module, UR_MODEDIT );
// set the new relative internal local coordinates of footprint items
wxPoint moveVector = module->GetPosition() -
GetScreen()->GetCrossHairPosition();
module->MoveAnchorPosition( moveVector );
// set the new relative internal local coordinates of footprint items
wxPoint moveVector = module->GetPosition() - GetCrossHairPosition();
module->MoveAnchorPosition( moveVector );
// Usually, we do not need to change twice the anchor position,
// so deselect the active tool
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
SetCurItem( NULL );
m_canvas->Refresh();
}
break;
// Usually, we do not need to change twice the anchor position,
// so deselect the active tool
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
SetCurItem( NULL );
m_canvas->Refresh();
}
break;
case ID_MODEDIT_PLACE_GRID_COORD:
m_canvas->DrawGridAxis( DC, GR_XOR );
GetScreen()->m_GridOrigin = GetScreen()->GetCrossHairPosition();
m_canvas->DrawGridAxis( DC, GR_COPY );
m_canvas->DrawGridAxis( DC, GR_XOR, GetBoard()->GetGridOrigin() );
SetGridOrigin( GetCrossHairPosition() );
m_canvas->DrawGridAxis( DC, GR_COPY, GetBoard()->GetGridOrigin() );
GetScreen()->SetModify();
break;

View File

@ -497,9 +497,9 @@ void FOOTPRINT_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition,
snapToGrid = false;
if( snapToGrid )
pos = GetScreen()->GetNearestGridPosition( pos );
pos = GetNearestGridPosition( pos );
oldpos = GetScreen()->GetCrossHairPosition();
oldpos = GetCrossHairPosition();
gridSize = GetScreen()->GetGridSize();
switch( aHotKey )
@ -532,14 +532,14 @@ void FOOTPRINT_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition,
break;
}
GetScreen()->SetCrossHairPosition( pos, snapToGrid );
SetCrossHairPosition( pos, snapToGrid );
if( oldpos != GetScreen()->GetCrossHairPosition() )
if( oldpos != GetCrossHairPosition() )
{
pos = GetScreen()->GetCrossHairPosition();
GetScreen()->SetCrossHairPosition( oldpos, false );
pos = GetCrossHairPosition();
SetCrossHairPosition( oldpos, false );
m_canvas->CrossHairOff( aDC );
GetScreen()->SetCrossHairPosition( pos, snapToGrid );
SetCrossHairPosition( pos, snapToGrid );
m_canvas->CrossHairOn( aDC );
if( m_canvas->IsMouseCaptured() )

View File

@ -244,7 +244,7 @@ void MoveFootprint( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
}
/* 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 );
DrawSegmentWhileMovingFootprint( aPanel, aDC );
@ -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 )
TraceModuleRatsNest( aDC );
newpos = GetScreen()->GetCrossHairPosition();
newpos = GetCrossHairPosition();
aModule->SetPosition( newpos );
aModule->ClearFlags();

View File

@ -369,7 +369,7 @@ void FOOTPRINT_VIEWER_FRAME::OnSize( wxSizeEvent& SizeEv )
void FOOTPRINT_VIEWER_FRAME::OnSetRelativeOffset( wxCommandEvent& event )
{
GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition();
GetScreen()->m_O_Curseur = GetCrossHairPosition();
UpdateStatusBar();
}
@ -644,8 +644,8 @@ void FOOTPRINT_VIEWER_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this );
pos = screen->GetNearestGridPosition( pos );
oldpos = screen->GetCrossHairPosition();
pos = GetNearestGridPosition( pos );
oldpos = GetCrossHairPosition();
gridSize = screen->GetGridSize();
switch( aHotKey )
@ -676,7 +676,7 @@ void FOOTPRINT_VIEWER_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition
break;
case ' ':
screen->m_O_Curseur = screen->GetCrossHairPosition();
screen->m_O_Curseur = GetCrossHairPosition();
break;
case WXK_NUMPAD8: /* cursor moved up */
@ -704,14 +704,14 @@ void FOOTPRINT_VIEWER_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition
break;
}
screen->SetCrossHairPosition( pos );
SetCrossHairPosition( pos );
if( oldpos != screen->GetCrossHairPosition() )
if( oldpos != GetCrossHairPosition() )
{
pos = screen->GetCrossHairPosition();
screen->SetCrossHairPosition( oldpos );
pos = GetCrossHairPosition();
SetCrossHairPosition( oldpos );
m_canvas->CrossHairOff( aDC );
screen->SetCrossHairPosition( pos );
SetCrossHairPosition( pos );
m_canvas->CrossHairOn( aDC );
if( m_canvas->IsMouseCaptured() )

View File

@ -63,7 +63,6 @@ static void Show_Pad_Move( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPo
bool aErase )
{
TRACK* Track;
BASE_SCREEN* screen = aPanel->GetScreen();
D_PAD* pad = s_CurrentSelectedPad;
if( pad == NULL ) // Should not occur
@ -72,7 +71,7 @@ static void Show_Pad_Move( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPo
if( aErase )
pad->Draw( aPanel, aDC, GR_XOR );
pad->SetPosition( screen->GetCrossHairPosition() );
pad->SetPosition( aPanel->GetParent()->GetCrossHairPosition() );
pad->Draw( aPanel, aDC, GR_XOR );
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )

View File

@ -85,7 +85,7 @@ static void Abort_MoveTrack( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
frame->SetCurItem( 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++ )
{
TRACK* track = g_DragSegmentList[jj].m_Track;
@ -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,
bool aErase )
{
wxPoint moveVector;
BASE_SCREEN* screen = aPanel->GetScreen();
int tmp = DisplayOpt.DisplayPcbTrackFill;
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
aErase = false;
#endif
/* set the new track coordinates */
wxPoint Pos = screen->GetCrossHairPosition();
// set the new track coordinates
wxPoint Pos = aPanel->GetParent()->GetCrossHairPosition();
moveVector = Pos - s_LastPos;
s_LastPos = Pos;
@ -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 tx1, tx2, ty1, ty2; // temporary storage of points
int dx, dy;
BASE_SCREEN* screen = aPanel->GetScreen();
bool update = true;
TRACK* Track;
TRACK* tSegmentToStart = NULL, * tSegmentToEnd = NULL;
@ -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;
/* Undraw the current moved track segments before modification*/
// Undraw the current moved track segments before modification
#ifndef USE_WX_OVERLAY
// if( erase )
@ -258,13 +256,13 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* aPanel, wxDC
}
#endif
/* Compute the new track segment position */
wxPoint Pos = screen->GetCrossHairPosition();
// Compute the new track segment position
wxPoint Pos = aPanel->GetParent()->GetCrossHairPosition();
dx = Pos.x - s_LastPos.x;
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 );
ty1 = (double) ( Track->GetStart().y + dy );
tx2 = (double) ( Track->GetEnd().x + dx );
@ -613,13 +611,13 @@ void PCB_EDIT_FRAME::StartMoveOneNodeOrSegment( TRACK* aTrack, wxDC* aDC, int aC
EraseDragList();
/* Change highlighted net: the new one will be highlighted */
// Change highlighted net: the new one will be highlighted
GetBoard()->PushHighLight();
if( GetBoard()->IsHighLightNetON() )
HighLight( aDC );
PosInit = GetScreen()->GetCrossHairPosition();
PosInit = GetCrossHairPosition();
if( aTrack->Type() == PCB_VIA_T )
{
@ -637,7 +635,7 @@ void PCB_EDIT_FRAME::StartMoveOneNodeOrSegment( TRACK* aTrack, wxDC* aDC, int aC
}
else
{
STATUS_FLAGS diag = aTrack->IsPointOnEnds( GetScreen()->GetCrossHairPosition(), -1 );
STATUS_FLAGS diag = aTrack->IsPointOnEnds( GetCrossHairPosition(), -1 );
wxPoint pos;
switch( aCommand )
@ -754,7 +752,7 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
if( !TrackToEndPoint || ( TrackToEndPoint->Type() != PCB_TRACE_T ) )
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();
if( GetBoard()->IsHighLightNetON() )
@ -791,8 +789,8 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
UndrawAndMarkSegmentsToDrag( m_canvas, DC );
PosInit = GetScreen()->GetCrossHairPosition();
s_LastPos = GetScreen()->GetCrossHairPosition();
PosInit = GetCrossHairPosition();
s_LastPos = GetCrossHairPosition();
m_canvas->SetMouseCapture( Show_Drag_Track_Segment_With_Cte_Slope, Abort_MoveTrack );
GetBoard()->SetHighLightNet( track->GetNet() );
@ -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 )
{
int errdrc;
@ -841,7 +839,7 @@ bool PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC )
if( errdrc == BAD_DRC )
return false;
/* Redraw the dragged segments */
// Redraw the dragged segments
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
{
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 )
Track->ClearFlags();
Track->SetState( IN_EDIT, false );
/* Draw dragged tracks */
// Draw dragged tracks
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
{
Track = g_DragSegmentList[ii].m_Track;

View File

@ -123,7 +123,7 @@ static void ShowBoundingBoxMicroWaveInductor( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
GRPoly( aPanel->GetClipBox(), aDC, 5, poly, false, 0, YELLOW, YELLOW );
}
Mself.m_End = aPanel->GetScreen()->GetCrossHairPosition();
Mself.m_End = aPanel->GetParent()->GetCrossHairPosition();
pt = Mself.m_End - Mself.m_Start;
angle = -ArcTangente( pt.y, pt.x );
len = KiROUND( EuclideanNorm( pt ) );
@ -161,13 +161,13 @@ void PCB_EDIT_FRAME::Begin_Self( wxDC* DC )
return;
}
Mself.m_Start = GetScreen()->GetCrossHairPosition();
Mself.m_Start = GetCrossHairPosition();
Mself.m_End = Mself.m_Start;
Self_On = 1;
// Update the initial coordinates.
GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition();
GetScreen()->m_O_Curseur = GetCrossHairPosition();
UpdateStatusBar();
m_canvas->SetMouseCapture( ShowBoundingBoxMicroWaveInductor, Exit_Self );
@ -192,7 +192,7 @@ MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC )
Self_On = 0;
Mself.m_End = GetScreen()->GetCrossHairPosition();
Mself.m_End = GetCrossHairPosition();
wxPoint pt = Mself.m_End - Mself.m_Start;
int min_len = KiROUND( EuclideanNorm( pt ) );
@ -751,7 +751,8 @@ private:
wxRadioBox* m_ShapeOptionCtrl;
EDA_SIZE_CTRL* m_SizeCtrl;
public: WinEDA_SetParamShapeFrame( PCB_EDIT_FRAME* parent, const wxPoint& pos );
public:
WinEDA_SetParamShapeFrame( PCB_EDIT_FRAME* parent, const wxPoint& pos );
~WinEDA_SetParamShapeFrame() { };
private:

View File

@ -394,7 +394,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
break;
case ID_PCB_DELETE_ITEM_BUTT:
if( !DrawStruct || (DrawStruct->GetFlags() == 0) )
if( !DrawStruct || !DrawStruct->GetFlags() )
{
DrawStruct = PcbGeneralLocateAndDisplay();
@ -409,15 +409,15 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
case ID_PCB_PLACE_OFFSET_COORD_BUTT:
m_canvas->DrawAuxiliaryAxis( aDC, GR_XOR );
SetOriginAxisPosition( GetScreen()->GetCrossHairPosition() );
SetAuxOrigin( GetCrossHairPosition() );
m_canvas->DrawAuxiliaryAxis( aDC, GR_COPY );
OnModify();
break;
case ID_PCB_PLACE_GRID_COORD_BUTT:
m_canvas->DrawGridAxis( aDC, GR_XOR );
GetScreen()->m_GridOrigin = GetScreen()->GetCrossHairPosition();
m_canvas->DrawGridAxis( aDC, GR_COPY );
m_canvas->DrawGridAxis( aDC, GR_XOR, GetBoard()->GetGridOrigin() );
SetGridOrigin( GetCrossHairPosition() );
m_canvas->DrawGridAxis( aDC, GR_COPY, GetBoard()->GetGridOrigin() );
break;
default:

View File

@ -101,12 +101,12 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
}
}
/* Select a proper item */
// Select a proper item
wxPoint cursorPos = GetScreen()->GetCrossHairPosition();
wxPoint cursorPos = GetCrossHairPosition();
wxPoint selectPos = m_Collector->GetRefPos();
selectPos = GetScreen()->GetNearestGridPosition( selectPos );
selectPos = GetNearestGridPosition( selectPos );
/* We can reselect another item only if there are no item being edited
* because ALL moving functions use GetCurItem(), therefore GetCurItem()
@ -312,7 +312,7 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
msg, KiBitmap( move_module_xpm ) );
}
/* Display context sensitive commands: */
// Display context sensitive commands:
switch( GetToolId() )
{
case ID_PCB_ZONES_BUTT:
@ -455,7 +455,7 @@ void PCB_EDIT_FRAME::createPopUpBlockMenu( wxMenu* menu )
*/
void PCB_EDIT_FRAME::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
{
wxPoint cursorPosition = GetScreen()->GetCrossHairPosition();
wxPoint cursorPosition = GetCrossHairPosition();
wxString msg;
GetBoard()->SetCurrentNetClass( Track->GetNetClassName() );
@ -635,14 +635,14 @@ void PCB_EDIT_FRAME::createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu*
edge_zone->GetIsKeepout() ? _("Keepout Area") : _( "Zones" ),
KiBitmap( add_zone_xpm ) );
if( edge_zone->HitTestForCorner( GetScreen()->RefPos( true ) ) )
if( edge_zone->HitTestForCorner( RefPos( true ) ) )
{
AddMenuItem( zones_menu, ID_POPUP_PCB_MOVE_ZONE_CORNER,
_( "Move Corner" ), KiBitmap( move_xpm ) );
AddMenuItem( zones_menu, ID_POPUP_PCB_DELETE_ZONE_CORNER,
_( "Delete Corner" ), KiBitmap( delete_xpm ) );
}
else if( edge_zone->HitTestForEdge( GetScreen()->RefPos( true ) ) )
else if( edge_zone->HitTestForEdge( RefPos( true ) ) )
{
AddMenuItem( zones_menu, ID_POPUP_PCB_ADD_ZONE_CORNER,
_( "Create Corner" ), KiBitmap( add_corner_xpm ) );
@ -862,7 +862,7 @@ void PCB_EDIT_FRAME::createPopUpMenuForFpPads( D_PAD* Pad, wxMenu* menu )
}
/* Create pop menu for pcb texts */
// Create pop menu for pcb texts
void PCB_EDIT_FRAME::createPopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu )
{
wxMenu* sub_menu_Text;

View File

@ -143,7 +143,7 @@ void PCB_BASE_FRAME::AddPad( MODULE* aModule, bool draw )
Import_Pad_Settings( pad, false );
pad->SetNetname( wxEmptyString );
pad->SetPosition( GetScreen()->GetCrossHairPosition() );
pad->SetPosition( GetCrossHairPosition() );
// Set the relative pad position
// ( pad position for module orient, 0, and relative to the module position)

View File

@ -883,12 +883,12 @@ void PCB_PARSER::parseSetup() throw( IO_ERROR, PARSE_ERROR )
break;
case T_user_via:
{
int viaSize = parseBoardUnits( "user via size" );
int viaDrill = parseBoardUnits( "user via drill" );
m_board->m_ViasDimensionsList.push_back( VIA_DIMENSION( viaSize, viaDrill ) );
NeedRIGHT();
}
{
int viaSize = parseBoardUnits( "user via size" );
int viaDrill = parseBoardUnits( "user via drill" );
m_board->m_ViasDimensionsList.push_back( VIA_DIMENSION( viaSize, viaDrill ) );
NeedRIGHT();
}
break;
case T_uvia_size:
@ -944,21 +944,21 @@ void PCB_PARSER::parseSetup() throw( IO_ERROR, PARSE_ERROR )
break;
case T_pad_size:
{
wxSize sz;
sz.SetWidth( parseBoardUnits( "master pad width" ) );
sz.SetHeight( parseBoardUnits( "master pad height" ) );
designSettings.m_Pad_Master.SetSize( sz );
NeedRIGHT();
{
wxSize sz;
sz.SetWidth( parseBoardUnits( "master pad width" ) );
sz.SetHeight( parseBoardUnits( "master pad height" ) );
designSettings.m_Pad_Master.SetSize( sz );
NeedRIGHT();
}
break;
}
case T_pad_drill:
{
int drillSize = parseBoardUnits( T_pad_drill );
designSettings.m_Pad_Master.SetDrillSize( wxSize( drillSize, drillSize ) );
NeedRIGHT();
}
{
int drillSize = parseBoardUnits( T_pad_drill );
designSettings.m_Pad_Master.SetDrillSize( wxSize( drillSize, drillSize ) );
NeedRIGHT();
}
break;
case T_pad_to_mask_clearance:
@ -982,14 +982,24 @@ void PCB_PARSER::parseSetup() throw( IO_ERROR, PARSE_ERROR )
break;
case T_aux_axis_origin:
{
int x = parseBoardUnits( "auxiliary origin X" );
int y = parseBoardUnits( "auxiliary origin Y" );
// x, y are not evaluated left to right, since they are push on stack right to left
m_board->SetOriginAxisPosition( wxPoint( x, y ) );
NeedRIGHT();
{
int x = parseBoardUnits( "auxiliary origin X" );
int y = parseBoardUnits( "auxiliary origin Y" );
// m_board->SetAuxOrigin( wxPoint( x, y ) ); gets overwritten via SetDesignSettings below
designSettings.m_AuxOrigin = wxPoint( x, y );
NeedRIGHT();
}
break;
case T_grid_origin:
{
int x = parseBoardUnits( "grid origin X" );
int y = parseBoardUnits( "grid origin Y" );
// m_board->SetGridOrigin( wxPoint( x, y ) ); gets overwritten SetDesignSettings below
designSettings.m_GridOrigin = wxPoint( x, y );
NeedRIGHT();
}
break;
}
case T_visible_elements:
designSettings.SetVisibleElements( parseHex() );
@ -997,17 +1007,17 @@ void PCB_PARSER::parseSetup() throw( IO_ERROR, PARSE_ERROR )
break;
case T_pcbplotparams:
{
PCB_PLOT_PARAMS plotParams;
PCB_PLOT_PARAMS_PARSER parser( reader );
{
PCB_PLOT_PARAMS plotParams;
PCB_PLOT_PARAMS_PARSER parser( reader );
plotParams.Parse( &parser );
m_board->SetPlotOptions( plotParams );
plotParams.Parse( &parser );
m_board->SetPlotOptions( plotParams );
// I don't know why but this seems to fix a problem in PCB_PLOT_PARAMS::Parse().
NextTok();
// I don't know why but this seems to fix a problem in PCB_PLOT_PARAMS::Parse().
NextTok();
}
break;
}
default:
Unexpected( CurText() );

View File

@ -683,7 +683,7 @@ static void initializePlotter( PLOTTER *aPlotter, BOARD * aBoard,
else
{
if( aPlotOpts->GetUseAuxOrigin() )
offset = aBoard->GetOriginAxisPosition();
offset = aBoard->GetAuxOrigin();
}
/* Configure the plotter object with all the stuff computed and

View File

@ -181,7 +181,7 @@ int DIALOG_EXCHANGE_MODULE::Maj_ListeCmp( const wxString& reference,
if( old_name == new_name )
return 0;
/* Build CMP file name by changing the extension of NetList filename */
// Build CMP file name by changing the extension of NetList filename
fn = m_Parent->GetBoard()->GetFileName();
fn.SetExt( ComponentFileExtension );
@ -456,11 +456,11 @@ bool DIALOG_EXCHANGE_MODULE::Change_1_Module( MODULE* Module,
wxBusyCursor dummy;
/* Copy parameters from the old module. */
// Copy parameters from the old module.
oldnamecmp = Module->GetLibRef();
namecmp = new_module;
/* Load module. */
// Load module.
line.Printf( _( "Change module %s (from %s) " ),
GetChars( Module->GetReference() ),
GetChars( oldnamecmp ) );
@ -470,7 +470,7 @@ bool DIALOG_EXCHANGE_MODULE::Change_1_Module( MODULE* Module,
namecmp.Trim( false );
NewModule = m_Parent->GetModuleLibrary( wxEmptyString, namecmp, ShowError );
if( NewModule == NULL ) /* New module not found, redraw the old one. */
if( NewModule == NULL ) // New module not found, redraw the old one.
{
m_WinMessages->AppendText( wxT( "No\n" ) );
return false;
@ -507,36 +507,36 @@ void PCB_EDIT_FRAME::Exchange_Module( MODULE* aOldModule,
aNewModule->SetParent( GetBoard() );
GetBoard()->m_Status_Pcb = 0;
oldpos = GetScreen()->GetCrossHairPosition();
GetScreen()->SetCrossHairPosition( aOldModule->GetPosition(), false );
oldpos = GetCrossHairPosition();
SetCrossHairPosition( aOldModule->GetPosition(), false );
/* place module without ratsnest refresh: this will be made later
* when all modules are on board
*/
PlaceModule( aNewModule, NULL, true );
GetScreen()->SetCrossHairPosition( oldpos, false );
SetCrossHairPosition( oldpos, false );
/* Flip footprint if needed */
// Flip footprint if needed
if( aOldModule->GetLayer() != aNewModule->GetLayer() )
{
aNewModule->Flip( aNewModule->GetPosition() );
}
/* Rotate footprint if needed */
// Rotate footprint if needed
if( aOldModule->GetOrientation() != aNewModule->GetOrientation() )
{
Rotate_Module( NULL, aNewModule, aOldModule->GetOrientation(), false );
}
/* Update reference and value */
// Update reference and value
aNewModule->SetReference( aOldModule->GetReference() );
aNewModule->SetValue( aOldModule->GetValue() );
/* Updating other parameters */
// Updating other parameters
aNewModule->SetTimeStamp( aOldModule->GetTimeStamp() );
aNewModule->SetPath( aOldModule->GetPath() );
/* Update pad netnames ( when possible) */
// Update pad netnames ( when possible)
pad = aNewModule->Pads();
for( ; pad != NULL; pad = pad->Next() )
@ -604,7 +604,7 @@ void PCB_EDIT_FRAME::RecreateCmpFileFromBoard( wxCommandEvent& aEvent )
return;
}
/* Calculation file name by changing the extension name to NetList */
// Calculation file name by changing the extension name to NetList
fn = GetBoard()->GetFileName();
fn.SetExt( ComponentFileExtension );
wildcard = wxGetTranslation( ComponentFileWildcard );

View File

@ -272,7 +272,7 @@ void PCB_EDIT_FRAME::Start_Move_Zone_Drag_Outline_Edge( wxDC* DC,
aZone->SetSelectedCorner( corner_id );
m_canvas->SetMouseCapture( Show_Zone_Corner_Or_Outline_While_Move_Mouse,
Abort_Zone_Move_Corner_Or_Outlines );
s_CursorLastPosition = s_CornerInitialPosition = GetScreen()->GetCrossHairPosition();
s_CursorLastPosition = s_CornerInitialPosition = GetCrossHairPosition();
s_AddCutoutToCurrentZone = false;
s_CurrentZone = NULL;
@ -309,7 +309,7 @@ void PCB_EDIT_FRAME::Start_Move_Zone_Outlines( wxDC* DC, ZONE_CONTAINER* aZone )
aZone->SetFlags( IS_MOVED );
m_canvas->SetMouseCapture( Show_Zone_Corner_Or_Outline_While_Move_Mouse,
Abort_Zone_Move_Corner_Or_Outlines );
s_CursorLastPosition = s_CornerInitialPosition = GetScreen()->GetCrossHairPosition();
s_CursorLastPosition = s_CornerInitialPosition = GetCrossHairPosition();
s_CornerIsNew = false;
s_AddCutoutToCurrentZone = false;
s_CurrentZone = NULL;
@ -470,7 +470,7 @@ void Show_Zone_Corner_Or_Outline_While_Move_Mouse( EDA_DRAW_PANEL* aPanel, wxDC*
zone->Draw( aPanel, aDC, GR_XOR );
}
wxPoint pos = pcbframe->GetScreen()->GetCrossHairPosition();
wxPoint pos = pcbframe->GetCrossHairPosition();
if( zone->IsMoving() )
{
@ -651,11 +651,11 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
zoneInfo.ExportSetting( *zone );
zone->Outline()->Start( zoneInfo.m_CurrentZone_Layer,
GetScreen()->GetCrossHairPosition().x,
GetScreen()->GetCrossHairPosition().y,
GetCrossHairPosition().x,
GetCrossHairPosition().y,
zone->GetHatchStyle() );
zone->AppendCorner( GetScreen()->GetCrossHairPosition() );
zone->AppendCorner( GetCrossHairPosition() );
if( g_Drc_On && (m_drc->Drc( zone, 0 ) == BAD_DRC) && zone->IsOnCopperLayer() )
{
@ -687,7 +687,7 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
// Ok, we can add a new corner
if( m_canvas->IsMouseCaptured() )
m_canvas->CallMouseCapture( DC, wxPoint(0,0), false );
zone->AppendCorner( GetScreen()->GetCrossHairPosition() );
zone->AppendCorner( GetCrossHairPosition() );
SetCurItem( zone ); // calls DisplayInfo().
if( m_canvas->IsMouseCaptured() )
m_canvas->CallMouseCapture( DC, wxPoint(0,0), false );
@ -810,7 +810,7 @@ static void Show_New_Edge_While_Move_Mouse( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aPosition, bool aErase )
{
PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) aPanel->GetParent();
wxPoint c_pos = pcbframe->GetScreen()->GetCrossHairPosition();
wxPoint c_pos = pcbframe->GetCrossHairPosition();
ZONE_CONTAINER* zone = pcbframe->GetBoard()->m_CurrentZoneContour;
if( !zone )

View File

@ -13,8 +13,8 @@
# 3) Entered following command line, script takes to arguments: oldLibPath & newLibPath
# $ PYTHONPATH=. <path_to>/lib_convert.py /usr/local/share/kicad/modules/smd_dil.mod /tmp/smd_dil.pretty
# 4) inspect one footprint found in new librarypath /tmp/smd_dil
# $ less /tmp/smd_dil/msoic-10.kicad_mod
# 4) inspect one footprint found in new librarypath /tmp/smd_dil.pretty
# $ less /tmp/smd_dil.pretty/msoic-10.kicad_mod
from __future__ import print_function