*) 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:
+67
-15
@@ -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 >--------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user