7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-11 09:00:13 +00:00

*) 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
common
cvpcb
eeschema
gerbview
include
pagelayout_editor
pcbnew
scripts

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:

Some files were not shown because too many files have changed in this diff Show More