Remove some more legacy drawing stuff.
This commit is contained in:
parent
0a01277808
commit
03bab2f4a9
|
@ -269,13 +269,6 @@ void EDA_DRAW_FRAME::EraseMsgBox()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_FRAME::OnActivate( wxActivateEvent& event )
|
|
||||||
{
|
|
||||||
// TODO Obsolete!
|
|
||||||
event.Skip(); // required under wxMAC
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_FRAME::OnMenuOpen( wxMenuEvent& event )
|
void EDA_DRAW_FRAME::OnMenuOpen( wxMenuEvent& event )
|
||||||
{
|
{
|
||||||
// On wxWidgets 3.0.x Windows, EVT_MENU_OPEN and EVT_MENU_HIGHLIGHT events are not
|
// On wxWidgets 3.0.x Windows, EVT_MENU_OPEN and EVT_MENU_HIGHLIGHT events are not
|
||||||
|
@ -314,12 +307,6 @@ void EDA_DRAW_FRAME::OnMenuOpen( wxMenuEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_FRAME::SkipNextLeftButtonReleaseEvent()
|
|
||||||
{
|
|
||||||
m_canvas->SetIgnoreLeftButtonReleaseEvent( true );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool EDA_DRAW_FRAME::GetToolToggled( int aToolId )
|
bool EDA_DRAW_FRAME::GetToolToggled( int aToolId )
|
||||||
{
|
{
|
||||||
// Checks all the toolbars and returns true if the given tool id is toggled.
|
// Checks all the toolbars and returns true if the given tool id is toggled.
|
||||||
|
|
|
@ -99,7 +99,6 @@ BEGIN_EVENT_TABLE( EDA_DRAW_FRAME, KIWAY_PLAYER )
|
||||||
EVT_MENU_OPEN( EDA_DRAW_FRAME::OnMenuOpen )
|
EVT_MENU_OPEN( EDA_DRAW_FRAME::OnMenuOpen )
|
||||||
EVT_MENU_CLOSE( EDA_DRAW_FRAME::OnMenuOpen )
|
EVT_MENU_CLOSE( EDA_DRAW_FRAME::OnMenuOpen )
|
||||||
EVT_MENU_HIGHLIGHT_ALL( EDA_DRAW_FRAME::OnMenuOpen )
|
EVT_MENU_HIGHLIGHT_ALL( EDA_DRAW_FRAME::OnMenuOpen )
|
||||||
EVT_ACTIVATE( EDA_DRAW_FRAME::OnActivate )
|
|
||||||
|
|
||||||
EVT_MENU_RANGE( ID_POPUP_GRID_LEVEL_1000, ID_POPUP_GRID_USER,
|
EVT_MENU_RANGE( ID_POPUP_GRID_LEVEL_1000, ID_POPUP_GRID_USER,
|
||||||
EDA_DRAW_FRAME::OnSelectGrid )
|
EDA_DRAW_FRAME::OnSelectGrid )
|
||||||
|
@ -285,12 +284,6 @@ void EDA_DRAW_FRAME::EraseMsgBox()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_FRAME::OnActivate( wxActivateEvent& event )
|
|
||||||
{
|
|
||||||
event.Skip(); // required under wxMAC
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_FRAME::OnMenuOpen( wxMenuEvent& event )
|
void EDA_DRAW_FRAME::OnMenuOpen( wxMenuEvent& event )
|
||||||
{
|
{
|
||||||
// On wxWidgets 3.0.x Windows, EVT_MENU_OPEN ( and other EVT_MENU_xx) events are not
|
// On wxWidgets 3.0.x Windows, EVT_MENU_OPEN ( and other EVT_MENU_xx) events are not
|
||||||
|
@ -329,12 +322,6 @@ void EDA_DRAW_FRAME::OnMenuOpen( wxMenuEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_FRAME::SkipNextLeftButtonReleaseEvent()
|
|
||||||
{
|
|
||||||
m_canvas->SetIgnoreLeftButtonReleaseEvent( true );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool EDA_DRAW_FRAME::GetToolToggled( int aToolId )
|
bool EDA_DRAW_FRAME::GetToolToggled( int aToolId )
|
||||||
{
|
{
|
||||||
// Checks all the toolbars and returns true if the given tool id is toggled.
|
// Checks all the toolbars and returns true if the given tool id is toggled.
|
||||||
|
@ -872,6 +859,7 @@ double EDA_DRAW_FRAME::bestZoom( double sizeX, double sizeY, double scaleFactor,
|
||||||
|
|
||||||
|
|
||||||
// JEY TODO: Obsolete; replace with ACTIONS::zoomFitScreen
|
// JEY TODO: Obsolete; replace with ACTIONS::zoomFitScreen
|
||||||
|
// JEY TODO: This is the last caller of BestZoom() too....
|
||||||
void EDA_DRAW_FRAME::Zoom_Automatique( bool aWarpPointer )
|
void EDA_DRAW_FRAME::Zoom_Automatique( bool aWarpPointer )
|
||||||
{
|
{
|
||||||
BASE_SCREEN* screen = GetScreen();
|
BASE_SCREEN* screen = GetScreen();
|
||||||
|
|
|
@ -23,56 +23,19 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* @file draw_panel.cpp
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <wx/timer.h>
|
|
||||||
#include <pgm_base.h>
|
|
||||||
#include <kiface_i.h>
|
#include <kiface_i.h>
|
||||||
#include <gr_basic.h>
|
#include <gr_basic.h>
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <macros.h>
|
#include <macros.h>
|
||||||
#include <id.h>
|
#include <id.h>
|
||||||
#include <class_drawpanel.h>
|
#include <class_drawpanel.h>
|
||||||
#include <class_draw_panel_gal.h>
|
|
||||||
#include <base_screen.h>
|
#include <base_screen.h>
|
||||||
#include <draw_frame.h>
|
|
||||||
#include <view/view_controls.h>
|
|
||||||
#include <gal/gal_display_options.h>
|
|
||||||
#include <trace_helpers.h>
|
#include <trace_helpers.h>
|
||||||
|
|
||||||
#include <kicad_device_context.h>
|
#include <kicad_device_context.h>
|
||||||
|
|
||||||
static const int CURSOR_SIZE = 12; ///< Cursor size in pixels
|
|
||||||
|
|
||||||
#define CLIP_BOX_PADDING 2
|
#define CLIP_BOX_PADDING 2
|
||||||
|
|
||||||
// Definitions for enabling and disabling debugging features in drawpanel.cpp.
|
|
||||||
// Please don't forget to turn these off before making any commits to Launchpad.
|
|
||||||
#define DEBUG_SHOW_CLIP_RECT 0 // Set to 1 to draw clipping rectangle.
|
|
||||||
|
|
||||||
|
|
||||||
// Events used by EDA_DRAW_PANEL
|
|
||||||
BEGIN_EVENT_TABLE( EDA_DRAW_PANEL, wxScrolledWindow )
|
|
||||||
EVT_LEAVE_WINDOW( EDA_DRAW_PANEL::OnMouseLeaving )
|
|
||||||
EVT_ENTER_WINDOW( EDA_DRAW_PANEL::OnMouseEntering )
|
|
||||||
EVT_MOUSEWHEEL( EDA_DRAW_PANEL::OnMouseWheel )
|
|
||||||
#if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT )
|
|
||||||
EVT_MAGNIFY( EDA_DRAW_PANEL::OnMagnify )
|
|
||||||
#endif
|
|
||||||
EVT_PAINT( EDA_DRAW_PANEL::OnPaint )
|
|
||||||
EVT_ERASE_BACKGROUND( EDA_DRAW_PANEL::OnEraseBackground )
|
|
||||||
EVT_SCROLLWIN( EDA_DRAW_PANEL::OnScroll )
|
|
||||||
EVT_ACTIVATE( EDA_DRAW_PANEL::OnActivate )
|
|
||||||
EVT_MENU_RANGE( ID_PAN_UP, ID_PAN_RIGHT, EDA_DRAW_PANEL::OnPan )
|
|
||||||
END_EVENT_TABLE()
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************/
|
|
||||||
/* EDA_DRAW_PANEL base functions (EDA_DRAW_PANEL is the main panel)*/
|
|
||||||
/***********************************************************************/
|
|
||||||
|
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
const int drawPanelStyle = wxHSCROLL | wxVSCROLL | wxALWAYS_SHOW_SB;
|
const int drawPanelStyle = wxHSCROLL | wxVSCROLL | wxALWAYS_SHOW_SB;
|
||||||
|
@ -80,8 +43,8 @@ const int drawPanelStyle = wxHSCROLL | wxVSCROLL | wxALWAYS_SHOW_SB;
|
||||||
const int drawPanelStyle = wxHSCROLL | wxVSCROLL;
|
const int drawPanelStyle = wxHSCROLL | wxVSCROLL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
|
EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id, const wxPoint& pos,
|
||||||
const wxPoint& pos, const wxSize& size ) :
|
const wxSize& size ) :
|
||||||
wxScrolledWindow( parent, id, pos, size, drawPanelStyle )
|
wxScrolledWindow( parent, id, pos, size, drawPanelStyle )
|
||||||
{
|
{
|
||||||
wxASSERT( parent );
|
wxASSERT( parent );
|
||||||
|
@ -103,13 +66,6 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
|
||||||
m_ClipBox.SetSize( size );
|
m_ClipBox.SetSize( size );
|
||||||
m_ClipBox.SetX( 0 );
|
m_ClipBox.SetX( 0 );
|
||||||
m_ClipBox.SetY( 0 );
|
m_ClipBox.SetY( 0 );
|
||||||
m_canStartBlock = -1; // Command block can start if >= 0
|
|
||||||
// Be sure a mouse release button event will be ignored when creating the canvas
|
|
||||||
// if the mouse click was not made inside the canvas (can happen sometimes, when
|
|
||||||
// launching a editor from a double click made in another frame)
|
|
||||||
m_ignoreNextLeftButtonRelease = true;
|
|
||||||
|
|
||||||
m_minDragEventCount = 0;
|
|
||||||
|
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
m_defaultCursor = m_currentCursor = wxCURSOR_CROSS;
|
m_defaultCursor = m_currentCursor = wxCURSOR_CROSS;
|
||||||
|
@ -121,15 +77,11 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
|
||||||
|
|
||||||
m_cursorLevel = 0;
|
m_cursorLevel = 0;
|
||||||
m_PrintIsMirrored = false;
|
m_PrintIsMirrored = false;
|
||||||
|
|
||||||
m_ClickTimer = (wxTimer*) NULL;
|
|
||||||
m_doubleClickInterval = 250;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EDA_DRAW_PANEL::~EDA_DRAW_PANEL()
|
EDA_DRAW_PANEL::~EDA_DRAW_PANEL()
|
||||||
{
|
{
|
||||||
wxDELETE( m_ClickTimer );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -154,113 +106,6 @@ BASE_SCREEN* EDA_DRAW_PANEL::GetScreen()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxPoint EDA_DRAW_PANEL::ToDeviceXY( const wxPoint& pos )
|
|
||||||
{
|
|
||||||
wxPoint ret;
|
|
||||||
INSTALL_UNBUFFERED_DC( dc, this );
|
|
||||||
ret.x = dc.LogicalToDeviceX( pos.x );
|
|
||||||
ret.y = dc.LogicalToDeviceY( pos.y );
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
wxPoint EDA_DRAW_PANEL::ToLogicalXY( const wxPoint& pos )
|
|
||||||
{
|
|
||||||
wxPoint ret;
|
|
||||||
INSTALL_UNBUFFERED_DC( dc, this );
|
|
||||||
ret.x = dc.DeviceToLogicalX( pos.x );
|
|
||||||
ret.y = dc.DeviceToLogicalY( pos.y );
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_PANEL::DrawCrossHair( wxDC* aDC, COLOR4D aColor )
|
|
||||||
{
|
|
||||||
if( m_cursorLevel != 0 || aDC == NULL || !m_showCrossHair )
|
|
||||||
return;
|
|
||||||
|
|
||||||
wxPoint cursor = GetParent()->GetCrossHairPosition();
|
|
||||||
|
|
||||||
#ifdef USE_WX_GRAPHICS_CONTEXT
|
|
||||||
// Normally cursor color is set to white, so when it is xored with white
|
|
||||||
// background, it is painted black effectively. wxGraphicsContext does not have
|
|
||||||
// xor operation, so we need to invert the color manually.
|
|
||||||
aColor.Invert();
|
|
||||||
#else
|
|
||||||
GRSetDrawMode( aDC, GR_XOR );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if( GetParent()->GetGalDisplayOptions().m_fullscreenCursor )
|
|
||||||
{
|
|
||||||
wxSize clientSize = GetClientSize();
|
|
||||||
|
|
||||||
// Y axis
|
|
||||||
wxPoint lineStart( cursor.x, aDC->DeviceToLogicalY( 0 ) );
|
|
||||||
wxPoint lineEnd( cursor.x, aDC->DeviceToLogicalY( clientSize.y ) );
|
|
||||||
|
|
||||||
GRLine( &m_ClipBox, aDC, lineStart, lineEnd, 0, aColor );
|
|
||||||
|
|
||||||
// X axis
|
|
||||||
lineStart = wxPoint( aDC->DeviceToLogicalX( 0 ), cursor.y );
|
|
||||||
lineEnd = wxPoint( aDC->DeviceToLogicalX( clientSize.x ), cursor.y );
|
|
||||||
|
|
||||||
GRLine( &m_ClipBox, aDC, lineStart, lineEnd, 0, aColor );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int len = aDC->DeviceToLogicalXRel( CURSOR_SIZE );
|
|
||||||
|
|
||||||
GRLine( &m_ClipBox, aDC, cursor.x - len, cursor.y,
|
|
||||||
cursor.x + len, cursor.y, 0, aColor );
|
|
||||||
GRLine( &m_ClipBox, aDC, cursor.x, cursor.y - len,
|
|
||||||
cursor.x, cursor.y + len, 0, aColor );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_PANEL::CrossHairOff( wxDC* DC )
|
|
||||||
{
|
|
||||||
DrawCrossHair( DC );
|
|
||||||
--m_cursorLevel;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_PANEL::CrossHairOn( wxDC* DC )
|
|
||||||
{
|
|
||||||
++m_cursorLevel;
|
|
||||||
DrawCrossHair( DC );
|
|
||||||
|
|
||||||
if( m_cursorLevel > 0 ) // Shouldn't happen, but just in case ..
|
|
||||||
m_cursorLevel = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
wxRealPoint EDA_DRAW_PANEL::GetGrid()
|
|
||||||
{
|
|
||||||
return GetScreen()->GetGridSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_PANEL::RefreshDrawingRect( const EDA_RECT& aRect, bool aEraseBackground )
|
|
||||||
{
|
|
||||||
INSTALL_UNBUFFERED_DC( dc, this );
|
|
||||||
|
|
||||||
wxRect rect = aRect;
|
|
||||||
|
|
||||||
rect.x = dc.LogicalToDeviceX( rect.x );
|
|
||||||
rect.y = dc.LogicalToDeviceY( rect.y );
|
|
||||||
rect.width = dc.LogicalToDeviceXRel( rect.width );
|
|
||||||
rect.height = dc.LogicalToDeviceYRel( rect.height );
|
|
||||||
|
|
||||||
wxLogTrace( kicadTraceCoords,
|
|
||||||
wxT( "Refresh area: drawing (%d, %d, %d, %d), device (%d, %d, %d, %d)" ),
|
|
||||||
aRect.GetX(), aRect.GetY(), aRect.GetWidth(), aRect.GetHeight(),
|
|
||||||
rect.x, rect.y, rect.width, rect.height );
|
|
||||||
|
|
||||||
RefreshRect( rect, aEraseBackground );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_PANEL::Refresh( bool eraseBackground, const wxRect* rect )
|
void EDA_DRAW_PANEL::Refresh( bool eraseBackground, const wxRect* rect )
|
||||||
{
|
{
|
||||||
GetParent()->GetGalCanvas()->Refresh();
|
GetParent()->GetGalCanvas()->Refresh();
|
||||||
|
@ -276,112 +121,6 @@ wxPoint EDA_DRAW_PANEL::GetScreenCenterLogicalPosition()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_PANEL::OnActivate( wxActivateEvent& event )
|
|
||||||
{
|
|
||||||
m_canStartBlock = -1; // Block Command can't start
|
|
||||||
event.Skip();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_PANEL::OnScroll( wxScrollWinEvent& event )
|
|
||||||
{
|
|
||||||
int id = event.GetEventType();
|
|
||||||
int x, y;
|
|
||||||
int ppux, ppuy;
|
|
||||||
int csizeX, csizeY;
|
|
||||||
int unitsX, unitsY;
|
|
||||||
|
|
||||||
GetViewStart( &x, &y );
|
|
||||||
GetScrollPixelsPerUnit( &ppux, &ppuy );
|
|
||||||
GetClientSize( &csizeX, &csizeY );
|
|
||||||
GetVirtualSize( &unitsX, &unitsY );
|
|
||||||
|
|
||||||
int tmpX = x;
|
|
||||||
int tmpY = y;
|
|
||||||
|
|
||||||
csizeX /= ppux;
|
|
||||||
csizeY /= ppuy;
|
|
||||||
|
|
||||||
unitsX /= ppux;
|
|
||||||
unitsY /= ppuy;
|
|
||||||
|
|
||||||
int dir = event.GetOrientation(); // wxHORIZONTAL or wxVERTICAL
|
|
||||||
|
|
||||||
// On windows and on wxWidgets >= 2.9.5 and < 3.1,
|
|
||||||
// there is a bug in mousewheel event which always generates 2 scroll events
|
|
||||||
// (should be the case only for the default mousewheel event)
|
|
||||||
// with id = wxEVT_SCROLLWIN_LINEUP or wxEVT_SCROLLWIN_LINEDOWN
|
|
||||||
// so we skip these events.
|
|
||||||
// Note they are here just in case, because they are not actually used
|
|
||||||
// in Kicad
|
|
||||||
#if wxCHECK_VERSION( 3, 1, 0 ) || !wxCHECK_VERSION( 2, 9, 5 ) || ( !defined (__WINDOWS__) && !defined (__WXMAC__) )
|
|
||||||
int maxX = unitsX - csizeX;
|
|
||||||
int maxY = unitsY - csizeY;
|
|
||||||
|
|
||||||
if( id == wxEVT_SCROLLWIN_LINEUP )
|
|
||||||
{
|
|
||||||
if( dir == wxHORIZONTAL )
|
|
||||||
{
|
|
||||||
x -= m_scrollIncrementX;
|
|
||||||
|
|
||||||
if( x < 0 )
|
|
||||||
x = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
y -= m_scrollIncrementY;
|
|
||||||
|
|
||||||
if( y < 0 )
|
|
||||||
y = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if( id == wxEVT_SCROLLWIN_LINEDOWN )
|
|
||||||
{
|
|
||||||
if( dir == wxHORIZONTAL )
|
|
||||||
{
|
|
||||||
x += m_scrollIncrementX;
|
|
||||||
if( x > maxX )
|
|
||||||
x = maxX;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
y += m_scrollIncrementY;
|
|
||||||
|
|
||||||
if( y > maxY )
|
|
||||||
y = maxY;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
if( id == wxEVT_SCROLLWIN_THUMBTRACK )
|
|
||||||
{
|
|
||||||
if( dir == wxHORIZONTAL )
|
|
||||||
x = event.GetPosition();
|
|
||||||
else
|
|
||||||
y = event.GetPosition();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
event.Skip();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxLogTrace( kicadTraceCoords,
|
|
||||||
wxT( "Setting scroll bars ppuX=%d, ppuY=%d, unitsX=%d, unitsY=%d, posX=%d, posY=%d" ),
|
|
||||||
ppux, ppuy, unitsX, unitsY, x, y );
|
|
||||||
|
|
||||||
double scale = GetParent()->GetScreen()->GetScalingFactor();
|
|
||||||
|
|
||||||
wxPoint center = GetParent()->GetScrollCenterPosition();
|
|
||||||
center.x += KiROUND( (double) ( x - tmpX ) / scale );
|
|
||||||
center.y += KiROUND( (double) ( y - tmpY ) / scale );
|
|
||||||
GetParent()->SetScrollCenterPosition( center );
|
|
||||||
|
|
||||||
Scroll( x, y );
|
|
||||||
event.Skip();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_PANEL::SetClipBox( wxDC& aDC, const wxRect* aRect )
|
void EDA_DRAW_PANEL::SetClipBox( wxDC& aDC, const wxRect* aRect )
|
||||||
{
|
{
|
||||||
wxRect clipBox;
|
wxRect clipBox;
|
||||||
|
@ -448,138 +187,8 @@ void EDA_DRAW_PANEL::DoPrepareDC( wxDC& dc )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_PANEL::OnPaint( wxPaintEvent& event )
|
|
||||||
{
|
|
||||||
// OBSOLETE
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Set to 1 to draw auxirilary axis as lines, 0 to draw as target (circle with cross)
|
|
||||||
#define DRAW_AXIS_AS_LINES 0
|
|
||||||
// Size in pixels of the target shape
|
|
||||||
#define AXIS_SIZE_IN_PIXELS 15
|
|
||||||
|
|
||||||
void EDA_DRAW_PANEL::OnMouseEntering( wxMouseEvent& aEvent )
|
|
||||||
{
|
|
||||||
// OBSOLETE
|
|
||||||
aEvent.Skip();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_PANEL::OnMouseLeaving( wxMouseEvent& event )
|
|
||||||
{
|
|
||||||
// OBSOLETE
|
|
||||||
event.Skip();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event )
|
|
||||||
{
|
|
||||||
// OBSOLETE
|
|
||||||
event.Skip();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT )
|
|
||||||
void EDA_DRAW_PANEL::OnMagnify( wxMouseEvent& event )
|
|
||||||
{
|
|
||||||
// OBSOLETE
|
|
||||||
event.Skip();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_PANEL::OnCharHook( wxKeyEvent& event )
|
void EDA_DRAW_PANEL::OnCharHook( wxKeyEvent& event )
|
||||||
{
|
{
|
||||||
wxLogTrace( kicadTraceKeyEvent, "EDA_DRAW_PANEL::OnCharHook %s", dump( event ) );
|
wxLogTrace( kicadTraceKeyEvent, "EDA_DRAW_PANEL::OnCharHook %s", dump( event ) );
|
||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_PANEL::OnPan( wxCommandEvent& event )
|
|
||||||
{
|
|
||||||
int x, y;
|
|
||||||
int ppux, ppuy;
|
|
||||||
int unitsX, unitsY;
|
|
||||||
int maxX, maxY;
|
|
||||||
int tmpX, tmpY;
|
|
||||||
|
|
||||||
GetViewStart( &x, &y );
|
|
||||||
GetScrollPixelsPerUnit( &ppux, &ppuy );
|
|
||||||
GetVirtualSize( &unitsX, &unitsY );
|
|
||||||
tmpX = x;
|
|
||||||
tmpY = y;
|
|
||||||
maxX = unitsX;
|
|
||||||
maxY = unitsY;
|
|
||||||
unitsX /= ppux;
|
|
||||||
unitsY /= ppuy;
|
|
||||||
|
|
||||||
wxLogTrace( kicadTraceCoords,
|
|
||||||
wxT( "Scroll center position before pan: (%d, %d)" ), tmpX, tmpY );
|
|
||||||
|
|
||||||
switch( event.GetId() )
|
|
||||||
{
|
|
||||||
case ID_PAN_UP:
|
|
||||||
y -= m_scrollIncrementY;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ID_PAN_DOWN:
|
|
||||||
y += m_scrollIncrementY;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ID_PAN_LEFT:
|
|
||||||
x -= m_scrollIncrementX;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ID_PAN_RIGHT:
|
|
||||||
x += m_scrollIncrementX;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
wxLogDebug( wxT( "Unknown ID %d in EDA_DRAW_PANEL::OnPan()." ), event.GetId() );
|
|
||||||
}
|
|
||||||
|
|
||||||
bool updateCenterScrollPos = true;
|
|
||||||
|
|
||||||
if( x < 0 )
|
|
||||||
{
|
|
||||||
x = 0;
|
|
||||||
updateCenterScrollPos = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( y < 0 )
|
|
||||||
{
|
|
||||||
y = 0;
|
|
||||||
updateCenterScrollPos = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( x > maxX )
|
|
||||||
{
|
|
||||||
x = maxX;
|
|
||||||
updateCenterScrollPos = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( y > maxY )
|
|
||||||
{
|
|
||||||
y = maxY;
|
|
||||||
updateCenterScrollPos = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Don't update the scroll position beyond the scroll limits.
|
|
||||||
if( updateCenterScrollPos )
|
|
||||||
{
|
|
||||||
double scale = GetParent()->GetScreen()->GetScalingFactor();
|
|
||||||
|
|
||||||
wxPoint center = GetParent()->GetScrollCenterPosition();
|
|
||||||
center.x += KiROUND( (double) ( x - tmpX ) / scale );
|
|
||||||
center.y += KiROUND( (double) ( y - tmpY ) / scale );
|
|
||||||
GetParent()->SetScrollCenterPosition( center );
|
|
||||||
|
|
||||||
wxLogTrace( kicadTraceCoords,
|
|
||||||
wxT( "Scroll center position after pan: (%d, %d)" ), center.x, center.y );
|
|
||||||
}
|
|
||||||
|
|
||||||
Scroll( x/ppux, y/ppuy );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -304,11 +304,6 @@ void DIALOG_ERC::OnLeftDblClickMarkersList( wxMouseEvent& event )
|
||||||
m_parent->FocusOnLocation( m_lastMarkerFound->m_Pos, false, true );
|
m_parent->FocusOnLocation( m_lastMarkerFound->m_Pos, false, true );
|
||||||
m_parent->SetCrossHairPosition( m_lastMarkerFound->m_Pos );
|
m_parent->SetCrossHairPosition( m_lastMarkerFound->m_Pos );
|
||||||
RedrawDrawPanel();
|
RedrawDrawPanel();
|
||||||
// prevent a mouse left button release event in
|
|
||||||
// coming from the ERC dialog double click
|
|
||||||
// ( the button is released after closing this dialog and will generate
|
|
||||||
// an unwanted event in parent frame)
|
|
||||||
m_parent->SkipNextLeftButtonReleaseEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Close();
|
Close();
|
||||||
|
|
|
@ -85,7 +85,6 @@ FILL_T LIB_EDIT_FRAME:: g_LastFillStyle = NO_FILL;
|
||||||
BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
|
BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
|
||||||
EVT_CLOSE( LIB_EDIT_FRAME::OnCloseWindow )
|
EVT_CLOSE( LIB_EDIT_FRAME::OnCloseWindow )
|
||||||
EVT_SIZE( LIB_EDIT_FRAME::OnSize )
|
EVT_SIZE( LIB_EDIT_FRAME::OnSize )
|
||||||
EVT_ACTIVATE( LIB_EDIT_FRAME::OnActivate )
|
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
EVT_TOOL( ID_LIBEDIT_NEW_LIBRARY, LIB_EDIT_FRAME::OnCreateNewLibrary )
|
EVT_TOOL( ID_LIBEDIT_NEW_LIBRARY, LIB_EDIT_FRAME::OnCreateNewLibrary )
|
||||||
|
@ -530,12 +529,6 @@ void LIB_EDIT_FRAME::OnSyncPinEditClick( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_EDIT_FRAME::OnActivate( wxActivateEvent& event )
|
|
||||||
{
|
|
||||||
EDA_DRAW_FRAME::OnActivate( event );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
wxString LIB_EDIT_FRAME::GetCurLib() const
|
wxString LIB_EDIT_FRAME::GetCurLib() const
|
||||||
{
|
{
|
||||||
wxString libNickname = Prj().GetRString( PROJECT::SCH_LIBEDIT_CUR_LIB );
|
wxString libNickname = Prj().GetRString( PROJECT::SCH_LIBEDIT_CUR_LIB );
|
||||||
|
|
|
@ -376,13 +376,6 @@ private:
|
||||||
*/
|
*/
|
||||||
void updateTitle();
|
void updateTitle();
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when the frame is activated. Tests if the current library exists.
|
|
||||||
* The library list can be changed by the schematic editor after reloading a new schematic
|
|
||||||
* and the current library can point a non existent lib.
|
|
||||||
*/
|
|
||||||
virtual void OnActivate( wxActivateEvent& event ) override;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the current active library to \a aLibrary.
|
* Set the current active library to \a aLibrary.
|
||||||
*
|
*
|
||||||
|
|
|
@ -85,16 +85,9 @@ SCH_DRAW_PANEL::SCH_DRAW_PANEL( wxWindow* aParentWindow, wxWindowID aWindowId,
|
||||||
|
|
||||||
Connect( wxEVT_CHAR_HOOK, wxKeyEventHandler( SCH_DRAW_PANEL::OnCharHook ), NULL, this );
|
Connect( wxEVT_CHAR_HOOK, wxKeyEventHandler( SCH_DRAW_PANEL::OnCharHook ), NULL, this );
|
||||||
|
|
||||||
// Be sure a mouse release button event will be ignored when creating the canvas
|
|
||||||
// if the mouse click was not made inside the canvas (can happen sometimes, when
|
|
||||||
// launching a editor from a double click made in another frame)
|
|
||||||
m_ignoreNextLeftButtonRelease = true;
|
|
||||||
|
|
||||||
m_cursorLevel = 0;
|
m_cursorLevel = 0;
|
||||||
m_PrintIsMirrored = false;
|
m_PrintIsMirrored = false;
|
||||||
|
|
||||||
m_doubleClickInterval = 250;
|
|
||||||
|
|
||||||
m_viewControls->SetSnapping( true );
|
m_viewControls->SetSnapping( true );
|
||||||
|
|
||||||
SetEvtHandlerEnabled( true );
|
SetEvtHandlerEnabled( true );
|
||||||
|
|
|
@ -329,7 +329,7 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ):
|
||||||
m_auimgr.Update();
|
m_auimgr.Update();
|
||||||
|
|
||||||
GetToolManager()->RunAction( ACTIONS::gridPreset, true, m_LastGridSizeId );
|
GetToolManager()->RunAction( ACTIONS::gridPreset, true, m_LastGridSizeId );
|
||||||
GetToolManager()->RunAction( ACTIONS::zoomFitScreen, true );
|
GetToolManager()->RunAction( ACTIONS::zoomFitScreen );
|
||||||
|
|
||||||
if( GetGalCanvas() )
|
if( GetGalCanvas() )
|
||||||
GetGalCanvas()->GetGAL()->SetGridVisibility( IsGridVisible() );
|
GetGalCanvas()->GetGAL()->SetGridVisibility( IsGridVisible() );
|
||||||
|
|
|
@ -682,18 +682,6 @@ void LIB_VIEW_FRAME::SetSelectedComponent( const wxString& aComponentName )
|
||||||
void LIB_VIEW_FRAME::DClickOnCmpList( wxCommandEvent& event )
|
void LIB_VIEW_FRAME::DClickOnCmpList( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
OnAddPartToSchematic( event );
|
OnAddPartToSchematic( event );
|
||||||
|
|
||||||
// The schematic editor might not be the parent of the library viewer.
|
|
||||||
// It could be a python window.
|
|
||||||
SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( GetParent() );
|
|
||||||
|
|
||||||
if( schframe )
|
|
||||||
{
|
|
||||||
// Prevent the double click from being as a single click in the parent
|
|
||||||
// window which would cause the part to be parked rather than staying
|
|
||||||
// in drag mode.
|
|
||||||
schframe->SkipNextLeftButtonReleaseEvent();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -753,8 +741,6 @@ void LIB_VIEW_FRAME::SaveSettings( wxConfigBase* aCfg )
|
||||||
|
|
||||||
void LIB_VIEW_FRAME::OnActivate( wxActivateEvent& event )
|
void LIB_VIEW_FRAME::OnActivate( wxActivateEvent& event )
|
||||||
{
|
{
|
||||||
EDA_DRAW_FRAME::OnActivate( event );
|
|
||||||
|
|
||||||
bool changed = m_libList ? ReCreateListLib() : false;
|
bool changed = m_libList ? ReCreateListLib() : false;
|
||||||
|
|
||||||
if (changed)
|
if (changed)
|
||||||
|
|
|
@ -151,7 +151,7 @@ private:
|
||||||
* Called when the frame is activated to reload the libraries and component lists
|
* Called when the frame is activated to reload the libraries and component lists
|
||||||
* that can be changed by the schematic editor or the library editor.
|
* that can be changed by the schematic editor or the library editor.
|
||||||
*/
|
*/
|
||||||
virtual void OnActivate( wxActivateEvent& event ) override;
|
void OnActivate( wxActivateEvent& event );
|
||||||
|
|
||||||
void DClickOnCmpList( wxCommandEvent& event );
|
void DClickOnCmpList( wxCommandEvent& event );
|
||||||
|
|
||||||
|
|
|
@ -163,7 +163,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
|
||||||
m_auimgr.Update();
|
m_auimgr.Update();
|
||||||
|
|
||||||
SetActiveLayer( 0, true );
|
SetActiveLayer( 0, true );
|
||||||
Zoom_Automatique( false ); // Gives a default zoom value
|
GetToolManager()->RunAction( ACTIONS::zoomFitScreen );
|
||||||
|
|
||||||
EDA_DRAW_PANEL_GAL::GAL_TYPE canvasType = LoadCanvasTypeSetting();
|
EDA_DRAW_PANEL_GAL::GAL_TYPE canvasType = LoadCanvasTypeSetting();
|
||||||
|
|
||||||
|
|
|
@ -218,12 +218,6 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual int GetDefaultCursor() const { return m_defaultCursor; }
|
virtual int GetDefaultCursor() const { return m_defaultCursor; }
|
||||||
|
|
||||||
/**
|
|
||||||
* Function GetCurrentCursor
|
|
||||||
* @return the current cursor shape, depending on the current selected tool
|
|
||||||
*/
|
|
||||||
int GetCurrentCursor() const { return m_currentCursor; }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the bounding box of the view that should be used if model is not valid
|
* Returns the bounding box of the view that should be used if model is not valid
|
||||||
* For example, the worksheet bounding box for an empty PCB
|
* For example, the worksheet bounding box for an empty PCB
|
||||||
|
|
|
@ -403,18 +403,6 @@ public:
|
||||||
|
|
||||||
void OnMenuOpen( wxMenuEvent& event );
|
void OnMenuOpen( wxMenuEvent& event );
|
||||||
|
|
||||||
/**
|
|
||||||
* After calling this function, if the left mouse button
|
|
||||||
* is down, the next left mouse button release event will be ignored.
|
|
||||||
* It is is usefull for instance when closing a dialog on a mouse click,
|
|
||||||
* to skip the next mouse left button release event
|
|
||||||
* by the parent window, because the mouse button
|
|
||||||
* clicked on the dialog is often released in the parent frame,
|
|
||||||
* and therefore creates a left button released mouse event
|
|
||||||
* which can be unwanted in some cases
|
|
||||||
*/
|
|
||||||
void SkipNextLeftButtonReleaseEvent();
|
|
||||||
|
|
||||||
///> @copydoc EDA_BASE_FRAME::WriteHotkeyConfig
|
///> @copydoc EDA_BASE_FRAME::WriteHotkeyConfig
|
||||||
int WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList, wxString* aFullFileName = NULL ) override;
|
int WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList, wxString* aFullFileName = NULL ) override;
|
||||||
|
|
||||||
|
@ -637,14 +625,6 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual void OnPageSettingsChange() {}
|
virtual void OnPageSettingsChange() {}
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when activating the frame.
|
|
||||||
*
|
|
||||||
* In derived classes with a overriding OnActivate function,
|
|
||||||
* do not forget to call this EDA_DRAW_FRAME::OnActivate( event ) basic function.
|
|
||||||
*/
|
|
||||||
virtual void OnActivate( wxActivateEvent& event );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the status bar information.
|
* Update the status bar information.
|
||||||
*
|
*
|
||||||
|
|
|
@ -21,19 +21,10 @@ protected:
|
||||||
/// of the drawing in internal units.
|
/// of the drawing in internal units.
|
||||||
EDA_RECT m_ClipBox;
|
EDA_RECT m_ClipBox;
|
||||||
|
|
||||||
/* 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.
|
|
||||||
|
|
||||||
/// True when drawing in mirror mode. Used by the draw arc function, because arcs
|
/// True when drawing in mirror mode. Used by the draw arc function, because arcs
|
||||||
/// are oriented, and in mirror mode, orientations are reversed.
|
/// are oriented, and in mirror mode, orientations are reversed.
|
||||||
bool m_PrintIsMirrored;
|
bool m_PrintIsMirrored;
|
||||||
|
|
||||||
int m_doubleClickInterval;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
EDA_DRAW_PANEL() :
|
EDA_DRAW_PANEL() :
|
||||||
|
@ -41,9 +32,7 @@ public:
|
||||||
m_cursorLevel( 0 ),
|
m_cursorLevel( 0 ),
|
||||||
m_scrollIncrementX( 1 ),
|
m_scrollIncrementX( 1 ),
|
||||||
m_scrollIncrementY( 1 ),
|
m_scrollIncrementY( 1 ),
|
||||||
m_ignoreNextLeftButtonRelease( false ),
|
m_PrintIsMirrored( false )
|
||||||
m_PrintIsMirrored( false ),
|
|
||||||
m_doubleClickInterval( 0 )
|
|
||||||
{};
|
{};
|
||||||
|
|
||||||
virtual ~EDA_DRAW_PANEL(){};
|
virtual ~EDA_DRAW_PANEL(){};
|
||||||
|
@ -65,8 +54,6 @@ public:
|
||||||
|
|
||||||
void SetClipBox( const EDA_RECT& aRect ) { m_ClipBox = aRect; }
|
void SetClipBox( const EDA_RECT& aRect ) { m_ClipBox = aRect; }
|
||||||
|
|
||||||
void SetIgnoreLeftButtonReleaseEvent( bool aIgnore ) { m_ignoreNextLeftButtonRelease = aIgnore; }
|
|
||||||
|
|
||||||
bool GetPrintMirrored() const { return m_PrintIsMirrored; }
|
bool GetPrintMirrored() const { return m_PrintIsMirrored; }
|
||||||
void SetPrintMirrored( bool aMirror ) { m_PrintIsMirrored = aMirror; }
|
void SetPrintMirrored( bool aMirror ) { m_PrintIsMirrored = aMirror; }
|
||||||
|
|
||||||
|
@ -125,18 +112,6 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual wxPoint GetScreenCenterLogicalPosition() { return wxPoint(0, 0); };;
|
virtual wxPoint GetScreenCenterLogicalPosition() { return wxPoint(0, 0); };;
|
||||||
|
|
||||||
/**
|
|
||||||
* Function ToDeviceXY
|
|
||||||
* transforms logical to device coordinates
|
|
||||||
*/
|
|
||||||
virtual wxPoint ToDeviceXY( const wxPoint& pos ) { printf("EDA_DRAW_PANEL:Unimplemented15\n"); return wxPoint(0, 0); };;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function ToLogicalXY
|
|
||||||
* transforms device to logical coordinates
|
|
||||||
*/
|
|
||||||
virtual wxPoint ToLogicalXY( const wxPoint& pos ) { printf("EDA_DRAW_PANEL:Unimplemented16\n"); return wxPoint(0, 0); };;
|
|
||||||
|
|
||||||
virtual void Refresh( bool eraseBackground = true, const wxRect* rect = NULL ) {}
|
virtual void Refresh( bool eraseBackground = true, const wxRect* rect = NULL ) {}
|
||||||
|
|
||||||
virtual wxWindow* GetWindow() = 0;
|
virtual wxWindow* GetWindow() = 0;
|
||||||
|
|
|
@ -23,11 +23,6 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* @file class_drawpanel.h:
|
|
||||||
* @brief EDA_DRAW_PANEL class definition.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef PANEL_WXSTRUCT_H
|
#ifndef PANEL_WXSTRUCT_H
|
||||||
#define PANEL_WXSTRUCT_H
|
#define PANEL_WXSTRUCT_H
|
||||||
|
|
||||||
|
@ -40,18 +35,6 @@ class BASE_SCREEN;
|
||||||
class PCB_SCREEN;
|
class PCB_SCREEN;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Mouse capture callback function prototype.
|
|
||||||
*/
|
|
||||||
typedef void ( *MOUSE_CAPTURE_CALLBACK )( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
|
|
||||||
const wxPoint& aPosition, bool aErase );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* End mouse capture callback function prototype.
|
|
||||||
*/
|
|
||||||
typedef void ( *END_MOUSE_CAPTURE_CALLBACK )( EDA_DRAW_PANEL* aPanel, wxDC* aDC );
|
|
||||||
|
|
||||||
|
|
||||||
class EDA_DRAW_PANEL : public wxScrolledWindow
|
class EDA_DRAW_PANEL : public wxScrolledWindow
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
@ -67,7 +50,6 @@ private:
|
||||||
wxPoint m_PanStartEventPosition; ///< Initial position of mouse event when pan started
|
wxPoint m_PanStartEventPosition; ///< Initial position of mouse event when pan started
|
||||||
|
|
||||||
wxPoint m_CursorClickPos; ///< Used for maintaining click position
|
wxPoint m_CursorClickPos; ///< Used for maintaining click position
|
||||||
wxTimer *m_ClickTimer;
|
|
||||||
|
|
||||||
/// The drawing area used to redraw the screen which is usually the visible area
|
/// The drawing area used to redraw the screen which is usually the visible area
|
||||||
/// of the drawing in internal units.
|
/// of the drawing in internal units.
|
||||||
|
@ -80,25 +62,10 @@ private:
|
||||||
*/
|
*/
|
||||||
bool m_ignoreNextLeftButtonRelease; ///< Ignore the next mouse left button release when true.
|
bool m_ignoreNextLeftButtonRelease; ///< Ignore the next mouse left button release when true.
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
/// True when drawing in mirror mode. Used by the draw arc function, because arcs
|
||||||
/// are oriented, and in mirror mode, orientations are reversed.
|
/// are oriented, and in mirror mode, orientations are reversed.
|
||||||
bool m_PrintIsMirrored;
|
bool m_PrintIsMirrored;
|
||||||
|
|
||||||
/// useful to avoid false start block in certain cases
|
|
||||||
/// (like switch from a sheet to another sheet
|
|
||||||
/// >= 0 (or >= n) if a block can start
|
|
||||||
int m_canStartBlock;
|
|
||||||
|
|
||||||
int m_doubleClickInterval;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id, const wxPoint& pos, const wxSize& size );
|
EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id, const wxPoint& pos, const wxSize& size );
|
||||||
|
@ -115,30 +82,15 @@ public:
|
||||||
|
|
||||||
EDA_DRAW_FRAME* GetParent() const;
|
EDA_DRAW_FRAME* GetParent() const;
|
||||||
|
|
||||||
void OnPaint( wxPaintEvent& event );
|
|
||||||
|
|
||||||
EDA_RECT* GetClipBox() { return &m_ClipBox; }
|
EDA_RECT* GetClipBox() { return &m_ClipBox; }
|
||||||
|
|
||||||
void SetClipBox( const EDA_RECT& aRect ) { m_ClipBox = aRect; }
|
void SetClipBox( const EDA_RECT& aRect ) { m_ClipBox = aRect; }
|
||||||
|
|
||||||
void SetIgnoreLeftButtonReleaseEvent( bool aIgnore ) { m_ignoreNextLeftButtonRelease = aIgnore; }
|
|
||||||
|
|
||||||
bool GetPrintMirrored() const { return m_PrintIsMirrored; }
|
bool GetPrintMirrored() const { return m_PrintIsMirrored; }
|
||||||
void SetPrintMirrored( bool aMirror ) { m_PrintIsMirrored = aMirror; }
|
void SetPrintMirrored( bool aMirror ) { m_PrintIsMirrored = aMirror; }
|
||||||
|
|
||||||
void OnEraseBackground( wxEraseEvent& event ) { }
|
void OnEraseBackground( wxEraseEvent& event ) { }
|
||||||
|
|
||||||
/**
|
|
||||||
* Function OnActivate
|
|
||||||
* handles window activation events.
|
|
||||||
* <p>
|
|
||||||
* The member m_canStartBlock is initialize to avoid a block start command on activation
|
|
||||||
* (because a left mouse button can be pressed and no block command wanted. This happens
|
|
||||||
* when enter on a hierarchy sheet on double click.
|
|
||||||
*</p>
|
|
||||||
*/
|
|
||||||
void OnActivate( wxActivateEvent& event );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function DoPrepareDC
|
* Function DoPrepareDC
|
||||||
* sets up the device context \a aDC for drawing.
|
* sets up the device context \a aDC for drawing.
|
||||||
|
@ -155,45 +107,10 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual void DoPrepareDC( wxDC& aDC ) override;
|
virtual void DoPrepareDC( wxDC& aDC ) override;
|
||||||
|
|
||||||
/**
|
|
||||||
* Function DeviceToLogical
|
|
||||||
* converts \a aRect from device to drawing (logical) coordinates.
|
|
||||||
* <p>
|
|
||||||
* \a aRect must be in scrolled device units.
|
|
||||||
* </p>
|
|
||||||
* @param aRect The rectangle to convert.
|
|
||||||
* @param aDC The device context used for the conversion.
|
|
||||||
* @return A rectangle converted to drawing units.
|
|
||||||
*/
|
|
||||||
wxRect DeviceToLogical( const wxRect& aRect, wxDC& aDC );
|
|
||||||
|
|
||||||
/* Mouse and keys events */
|
/* Mouse and keys events */
|
||||||
|
|
||||||
/**
|
|
||||||
* Function OnMouseWheel
|
|
||||||
* handles mouse wheel events.
|
|
||||||
* <p>
|
|
||||||
* The mouse wheel is used to provide support for zooming and panning. This
|
|
||||||
* is accomplished by converting mouse wheel events in pseudo menu command
|
|
||||||
* events and sending them to the appropriate parent window event handler.
|
|
||||||
*</p>
|
|
||||||
*/
|
|
||||||
void OnMouseWheel( wxMouseEvent& event );
|
|
||||||
#if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT )
|
|
||||||
void OnMagnify( wxMouseEvent& event );
|
|
||||||
#endif
|
|
||||||
void OnMouseEntering( wxMouseEvent& aEvent );
|
|
||||||
void OnMouseLeaving( wxMouseEvent& event );
|
|
||||||
void OnCharHook( wxKeyEvent& event );
|
void OnCharHook( wxKeyEvent& event );
|
||||||
|
|
||||||
void OnPan( wxCommandEvent& event );
|
|
||||||
|
|
||||||
void OnScrollWin( wxCommandEvent& event );
|
|
||||||
void OnScroll( wxScrollWinEvent& event );
|
|
||||||
|
|
||||||
void SetGrid( const wxRealPoint& size );
|
|
||||||
wxRealPoint GetGrid();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SetClipBox
|
* Function SetClipBox
|
||||||
* sets the clip box in drawing (logical) units from \a aRect in device units.
|
* sets the clip box in drawing (logical) units from \a aRect in device units.
|
||||||
|
@ -212,15 +129,6 @@ public:
|
||||||
*/
|
*/
|
||||||
void SetClipBox( wxDC& aDC, const wxRect* aRect = NULL );
|
void SetClipBox( wxDC& aDC, const wxRect* aRect = NULL );
|
||||||
|
|
||||||
/**
|
|
||||||
* Function RefreshDrawingRect
|
|
||||||
* redraws the contents of \a aRect in drawing units. \a aRect is converted to
|
|
||||||
* screen coordinates and wxWindow::RefreshRect() is called to repaint the region.
|
|
||||||
* @param aRect The rectangle to repaint.
|
|
||||||
* @param aEraseBackground Erases the background if true.
|
|
||||||
*/
|
|
||||||
void RefreshDrawingRect( const EDA_RECT& aRect, bool aEraseBackground = true );
|
|
||||||
|
|
||||||
/// @copydoc wxWindow::Refresh()
|
/// @copydoc wxWindow::Refresh()
|
||||||
virtual void Refresh( bool eraseBackground = true, const wxRect* rect = NULL ) override;
|
virtual void Refresh( bool eraseBackground = true, const wxRect* rect = NULL ) override;
|
||||||
|
|
||||||
|
@ -230,38 +138,7 @@ public:
|
||||||
*/
|
*/
|
||||||
wxPoint GetScreenCenterLogicalPosition();
|
wxPoint GetScreenCenterLogicalPosition();
|
||||||
|
|
||||||
/**
|
|
||||||
* Function ToDeviceXY
|
|
||||||
* transforms logical to device coordinates
|
|
||||||
*/
|
|
||||||
wxPoint ToDeviceXY( const wxPoint& pos );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function ToLogicalXY
|
|
||||||
* transforms device to logical coordinates
|
|
||||||
*/
|
|
||||||
wxPoint ToLogicalXY( const wxPoint& pos );
|
|
||||||
|
|
||||||
/* Cursor functions */
|
/* Cursor functions */
|
||||||
/**
|
|
||||||
* Function DrawCrossHair
|
|
||||||
* draws the user cross hair.
|
|
||||||
* <p>
|
|
||||||
* The user cross hair is not the mouse cursor although they may be at the same screen
|
|
||||||
* position. The mouse cursor is still render by the OS. This is a drawn cross hair
|
|
||||||
* that is used to snap to grid when grid snapping is enabled. This is as an indicator
|
|
||||||
* to where the next user action will take place.
|
|
||||||
* </p>
|
|
||||||
* @param aDC - the device context to draw the cursor
|
|
||||||
* @param aColor - the color to draw the cursor
|
|
||||||
*/
|
|
||||||
void DrawCrossHair( wxDC* aDC, COLOR4D aColor = COLOR4D::WHITE );
|
|
||||||
|
|
||||||
// Hide the cross hair.
|
|
||||||
void CrossHairOff( wxDC* DC );
|
|
||||||
|
|
||||||
// Show the cross hair.
|
|
||||||
void CrossHairOn( wxDC* DC );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SetCurrentCursor
|
* Function SetCurrentCursor
|
||||||
|
@ -278,15 +155,6 @@ public:
|
||||||
* @return the default cursor shape
|
* @return the default cursor shape
|
||||||
*/
|
*/
|
||||||
int GetDefaultCursor() const { return m_defaultCursor; }
|
int GetDefaultCursor() const { return m_defaultCursor; }
|
||||||
|
|
||||||
/**
|
|
||||||
* Function GetCurrentCursor
|
|
||||||
* @return the current cursor shape, depending on the current selected tool
|
|
||||||
*/
|
|
||||||
int GetCurrentCursor() const { return m_currentCursor; }
|
|
||||||
|
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -353,7 +353,7 @@ public:
|
||||||
* @param aDC = the current device context (can be NULL)
|
* @param aDC = the current device context (can be NULL)
|
||||||
* @param aDisplayStatus : if true, display the computation results
|
* @param aDisplayStatus : if true, display the computation results
|
||||||
*/
|
*/
|
||||||
void Compile_Ratsnest( wxDC* aDC, bool aDisplayStatus );
|
void Compile_Ratsnest( bool aDisplayStatus );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* function Displays the general ratsnest
|
* function Displays the general ratsnest
|
||||||
|
@ -364,17 +364,7 @@ public:
|
||||||
*/
|
*/
|
||||||
void DrawGeneralRatsnest( wxDC* aDC, int aNetcode = 0 );
|
void DrawGeneralRatsnest( wxDC* aDC, int aNetcode = 0 );
|
||||||
|
|
||||||
/**
|
/* Functions relative to Undo/redo commands: */
|
||||||
* Function TestNetConnection
|
|
||||||
* tests the connections relative to \a aNetCode. Track segments are assumed to be
|
|
||||||
* sorted by net codes.
|
|
||||||
* @param aDC Current Device Context
|
|
||||||
* @param aNetCode The net code to test
|
|
||||||
*/
|
|
||||||
void TestNetConnection( wxDC* aDC, int aNetCode );
|
|
||||||
|
|
||||||
/* Functions relative to Undo/redo commands:
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SaveCopyInUndoList (virtual pure)
|
* Function SaveCopyInUndoList (virtual pure)
|
||||||
|
|
|
@ -235,7 +235,6 @@ set( PCBNEW_CLASS_SRCS
|
||||||
array_pad_name_provider.cpp
|
array_pad_name_provider.cpp
|
||||||
board_netlist_updater.cpp
|
board_netlist_updater.cpp
|
||||||
build_BOM_from_board.cpp
|
build_BOM_from_board.cpp
|
||||||
connect.cpp
|
|
||||||
cross-probing.cpp
|
cross-probing.cpp
|
||||||
drc.cpp
|
drc.cpp
|
||||||
drc_clearance_test_functions.cpp
|
drc_clearance_test_functions.cpp
|
||||||
|
|
|
@ -164,8 +164,7 @@ EDA_ITEM* ZONE_CONTAINER::Clone() const
|
||||||
|
|
||||||
bool ZONE_CONTAINER::UnFill()
|
bool ZONE_CONTAINER::UnFill()
|
||||||
{
|
{
|
||||||
bool change = ( !m_FilledPolysList.IsEmpty() ) ||
|
bool change = ( !m_FilledPolysList.IsEmpty() || m_FillSegmList.size() > 0 );
|
||||||
( m_FillSegmList.size() > 0 );
|
|
||||||
|
|
||||||
m_FilledPolysList.RemoveAllContours();
|
m_FilledPolysList.RemoveAllContours();
|
||||||
m_FillSegmList.clear();
|
m_FillSegmList.clear();
|
||||||
|
@ -225,9 +224,7 @@ void ZONE_CONTAINER::SetLayerSet( LSET aLayerSet )
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aLayerSet.count() == 0 )
|
if( aLayerSet.count() == 0 )
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if( m_layerSet != aLayerSet )
|
if( m_layerSet != aLayerSet )
|
||||||
SetNeedRefill( true );
|
SetNeedRefill( true );
|
||||||
|
@ -260,9 +257,7 @@ void ZONE_CONTAINER::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||||
LSEQ layers = m_layerSet.Seq();
|
LSEQ layers = m_layerSet.Seq();
|
||||||
|
|
||||||
for( unsigned int idx = 0; idx < layers.size(); idx++ )
|
for( unsigned int idx = 0; idx < layers.size(); idx++ )
|
||||||
{
|
|
||||||
aLayers[idx] = layers[idx];
|
aLayers[idx] = layers[idx];
|
||||||
}
|
|
||||||
|
|
||||||
aCount = layers.size();
|
aCount = layers.size();
|
||||||
}
|
}
|
||||||
|
@ -277,9 +272,7 @@ void ZONE_CONTAINER::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||||
bool ZONE_CONTAINER::IsOnLayer( PCB_LAYER_ID aLayer ) const
|
bool ZONE_CONTAINER::IsOnLayer( PCB_LAYER_ID aLayer ) const
|
||||||
{
|
{
|
||||||
if( GetIsKeepout() )
|
if( GetIsKeepout() )
|
||||||
{
|
|
||||||
return m_layerSet.test( aLayer );
|
return m_layerSet.test( aLayer );
|
||||||
}
|
|
||||||
|
|
||||||
return BOARD_ITEM::IsOnLayer( aLayer );
|
return BOARD_ITEM::IsOnLayer( aLayer );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,44 +0,0 @@
|
||||||
/**
|
|
||||||
* @file connect.cpp
|
|
||||||
* @brief Functions to handle existing tracks in ratsnest calculations.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
|
||||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
|
||||||
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation; either version 2
|
|
||||||
* of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, you may find one here:
|
|
||||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
||||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
||||||
* or you may write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <fctsys.h>
|
|
||||||
#include <common.h>
|
|
||||||
#include <macros.h>
|
|
||||||
#include <pcb_base_frame.h>
|
|
||||||
#include <view/view.h>
|
|
||||||
|
|
||||||
#include <pcbnew.h>
|
|
||||||
#include <class_board.h>
|
|
||||||
|
|
||||||
void PCB_BASE_FRAME::TestNetConnection( wxDC* aDC, int aNetCode )
|
|
||||||
{
|
|
||||||
// Build and display new ratsnest
|
|
||||||
Compile_Ratsnest( aDC, false );
|
|
||||||
}
|
|
|
@ -116,7 +116,7 @@ void DIALOG_CLEANUP_TRACKS_AND_VIAS::doCleanup( bool aDryRun )
|
||||||
}
|
}
|
||||||
|
|
||||||
// Old model has to be refreshed, GAL normally does not keep updating it
|
// Old model has to be refreshed, GAL normally does not keep updating it
|
||||||
m_parentFrame->Compile_Ratsnest( NULL, false );
|
m_parentFrame->Compile_Ratsnest( false );
|
||||||
|
|
||||||
bool modified = cleaner.CleanupBoard( aDryRun, &m_items,
|
bool modified = cleaner.CleanupBoard( aDryRun, &m_items,
|
||||||
m_cleanShortCircuitOpt->GetValue(),
|
m_cleanShortCircuitOpt->GetValue(),
|
||||||
|
@ -176,13 +176,7 @@ void DIALOG_CLEANUP_TRACKS_AND_VIAS::OnLeftDClickItem( wxMouseEvent& event )
|
||||||
m_parentFrame->FocusOnLocation( item->GetPointA(), true, true );
|
m_parentFrame->FocusOnLocation( item->GetPointA(), true, true );
|
||||||
|
|
||||||
if( !IsModal() )
|
if( !IsModal() )
|
||||||
{
|
|
||||||
Show( false );
|
Show( false );
|
||||||
|
|
||||||
// We do not want the clarify selection popup when releasing the
|
|
||||||
// left button in the main window
|
|
||||||
m_parentFrame->SkipNextLeftButtonReleaseEvent();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -335,16 +335,10 @@ void DIALOG_DRC_CONTROL::OnLeftDClickClearance( wxMouseEvent& event )
|
||||||
{
|
{
|
||||||
if( focusOnItem( m_ClearanceListBox->GetItem( selection ) ) )
|
if( focusOnItem( m_ClearanceListBox->GetItem( selection ) ) )
|
||||||
{
|
{
|
||||||
|
// turn control over to m_brdEditor, hide this DIALOG_DRC_CONTROL window,
|
||||||
|
// no destruction so we can preserve listbox cursor
|
||||||
if( !IsModal() )
|
if( !IsModal() )
|
||||||
{
|
|
||||||
// turn control over to m_brdEditor, hide this DIALOG_DRC_CONTROL window,
|
|
||||||
// no destruction so we can preserve listbox cursor
|
|
||||||
Show( false );
|
Show( false );
|
||||||
|
|
||||||
// We do not want the clarify selection popup when releasing the
|
|
||||||
// left button in the main window
|
|
||||||
m_brdEditor->SkipNextLeftButtonReleaseEvent();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -475,13 +469,7 @@ void DIALOG_DRC_CONTROL::OnLeftDClickFootprints( wxMouseEvent& event )
|
||||||
if( focusOnItem( m_FootprintsListBox->GetItem( selection ) ) )
|
if( focusOnItem( m_FootprintsListBox->GetItem( selection ) ) )
|
||||||
{
|
{
|
||||||
if( !IsModal() )
|
if( !IsModal() )
|
||||||
{
|
|
||||||
Show( false );
|
Show( false );
|
||||||
|
|
||||||
// We do not want the clarify selection popup when releasing the
|
|
||||||
// left button in the main window
|
|
||||||
m_brdEditor->SkipNextLeftButtonReleaseEvent();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -497,16 +485,10 @@ void DIALOG_DRC_CONTROL::OnLeftDClickUnconnected( wxMouseEvent& event )
|
||||||
{
|
{
|
||||||
if( focusOnItem( m_UnconnectedListBox->GetItem( selection ) ) )
|
if( focusOnItem( m_UnconnectedListBox->GetItem( selection ) ) )
|
||||||
{
|
{
|
||||||
|
// turn control over to m_brdEditor, hide this DIALOG_DRC_CONTROL window,
|
||||||
|
// no destruction so we can preserve listbox cursor
|
||||||
if( !IsModal() )
|
if( !IsModal() )
|
||||||
{
|
|
||||||
// turn control over to m_brdEditor, hide this DIALOG_DRC_CONTROL window,
|
|
||||||
// no destruction so we can preserve listbox cursor
|
|
||||||
Show( false );
|
Show( false );
|
||||||
|
|
||||||
// We do not want the clarify selection popup when releasing the
|
|
||||||
// left button in the main window
|
|
||||||
m_brdEditor->SkipNextLeftButtonReleaseEvent();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -275,7 +275,7 @@ void DIALOG_EXCHANGE_FOOTPRINTS::OnApplyClicked( wxCommandEvent& event )
|
||||||
if( processMatchingModules() )
|
if( processMatchingModules() )
|
||||||
{
|
{
|
||||||
if( m_parent->GetBoard()->IsElementVisible( LAYER_RATSNEST ) )
|
if( m_parent->GetBoard()->IsElementVisible( LAYER_RATSNEST ) )
|
||||||
m_parent->Compile_Ratsnest( NULL, true );
|
m_parent->Compile_Ratsnest( true );
|
||||||
|
|
||||||
m_parent->GetCanvas()->Refresh();
|
m_parent->GetCanvas()->Refresh();
|
||||||
}
|
}
|
||||||
|
|
|
@ -234,7 +234,7 @@ void DIALOG_GLOBAL_DELETION::AcceptPcbDelete()
|
||||||
pcb->DeleteMARKERs();
|
pcb->DeleteMARKERs();
|
||||||
|
|
||||||
if( gen_rastnest )
|
if( gen_rastnest )
|
||||||
m_Parent->Compile_Ratsnest( NULL, true );
|
m_Parent->Compile_Ratsnest( true );
|
||||||
|
|
||||||
// There is a chance that some of tracks have changed their nets, so rebuild ratsnest from scratch
|
// There is a chance that some of tracks have changed their nets, so rebuild ratsnest from scratch
|
||||||
m_Parent->GetCanvas()->Refresh();
|
m_Parent->GetCanvas()->Refresh();
|
||||||
|
|
|
@ -1453,7 +1453,7 @@ bool DIALOG_PAD_PROPERTIES::TransferDataFromWindow()
|
||||||
|
|
||||||
// redraw the area where the pad was, without pad (delete pad on screen)
|
// redraw the area where the pad was, without pad (delete pad on screen)
|
||||||
m_currentPad->SetFlags( DO_NOT_DRAW );
|
m_currentPad->SetFlags( DO_NOT_DRAW );
|
||||||
m_parent->GetCanvas()->RefreshDrawingRect( m_currentPad->GetBoundingBox() );
|
m_parent->GetCanvas()->Refresh();
|
||||||
m_currentPad->ClearFlags( DO_NOT_DRAW );
|
m_currentPad->ClearFlags( DO_NOT_DRAW );
|
||||||
|
|
||||||
// Update values
|
// Update values
|
||||||
|
@ -1573,7 +1573,7 @@ bool DIALOG_PAD_PROPERTIES::TransferDataFromWindow()
|
||||||
m_parent->SetMsgPanel( m_currentPad );
|
m_parent->SetMsgPanel( m_currentPad );
|
||||||
|
|
||||||
// redraw the area where the pad was
|
// redraw the area where the pad was
|
||||||
m_parent->GetCanvas()->RefreshDrawingRect( m_currentPad->GetBoundingBox() );
|
m_parent->GetCanvas()->Refresh();
|
||||||
|
|
||||||
commit.Push( _( "Modify pad" ) );
|
commit.Push( _( "Modify pad" ) );
|
||||||
|
|
||||||
|
|
|
@ -577,7 +577,7 @@ bool PANEL_SETUP_LAYERS::TransferDataFromWindow()
|
||||||
if( hasRemovedBoardItems )
|
if( hasRemovedBoardItems )
|
||||||
{
|
{
|
||||||
// Rebuild list of nets (full ratsnest rebuild)
|
// Rebuild list of nets (full ratsnest rebuild)
|
||||||
m_frame->Compile_Ratsnest( NULL, true );
|
m_frame->Compile_Ratsnest( true );
|
||||||
m_pcb->BuildConnectivity();
|
m_pcb->BuildConnectivity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -274,7 +274,7 @@ void PCB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
|
||||||
else
|
else
|
||||||
SetToolID( id, wxCURSOR_QUESTION_ARROW, _( "Add tracks" ) );
|
SetToolID( id, wxCURSOR_QUESTION_ARROW, _( "Add tracks" ) );
|
||||||
|
|
||||||
Compile_Ratsnest( nullptr, true );
|
Compile_Ratsnest( true );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_PCB_ZONES_BUTT:
|
case ID_PCB_ZONES_BUTT:
|
||||||
|
@ -335,7 +335,7 @@ void PCB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
|
||||||
case ID_LOCAL_RATSNEST_BUTT:
|
case ID_LOCAL_RATSNEST_BUTT:
|
||||||
SetToolID( id, wxCURSOR_HAND, _( "Select rats nest" ) );
|
SetToolID( id, wxCURSOR_HAND, _( "Select rats nest" ) );
|
||||||
|
|
||||||
Compile_Ratsnest( nullptr, true );
|
Compile_Ratsnest( true );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -306,7 +306,7 @@ void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& aEvent )
|
||||||
GencadOffsetY = optionsDialog.GetOption( USE_AUX_ORIGIN ) ? GetAuxOrigin().y : 0;
|
GencadOffsetY = optionsDialog.GetOption( USE_AUX_ORIGIN ) ? GetAuxOrigin().y : 0;
|
||||||
|
|
||||||
// No idea on *why* this should be needed... maybe to fix net names?
|
// No idea on *why* this should be needed... maybe to fix net names?
|
||||||
Compile_Ratsnest( NULL, true );
|
Compile_Ratsnest( true );
|
||||||
|
|
||||||
/* Temporary modification of footprints that are flipped (i.e. on bottom
|
/* Temporary modification of footprints that are flipped (i.e. on bottom
|
||||||
* layer) to convert them to non flipped footprints.
|
* layer) to convert them to non flipped footprints.
|
||||||
|
|
|
@ -593,7 +593,7 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
||||||
SetCurrentNetClass( NETCLASS::Default );
|
SetCurrentNetClass( NETCLASS::Default );
|
||||||
|
|
||||||
// Rebuild list of nets (full ratsnest rebuild)
|
// Rebuild list of nets (full ratsnest rebuild)
|
||||||
Compile_Ratsnest( NULL, true );
|
Compile_Ratsnest( true );
|
||||||
GetBoard()->BuildConnectivity();
|
GetBoard()->BuildConnectivity();
|
||||||
|
|
||||||
onBoardLoaded();
|
onBoardLoaded();
|
||||||
|
|
|
@ -282,12 +282,11 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent,
|
||||||
ActivateGalCanvas();
|
ActivateGalCanvas();
|
||||||
|
|
||||||
m_auimgr.Update();
|
m_auimgr.Update();
|
||||||
|
GetToolManager()->RunAction( ACTIONS::zoomFitScreen );
|
||||||
updateTitle();
|
updateTitle();
|
||||||
|
|
||||||
Raise(); // On some window managers, this is needed
|
Raise(); // On some window managers, this is needed
|
||||||
Show( true );
|
Show( true );
|
||||||
|
|
||||||
Zoom_Automatique( false );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -445,17 +445,6 @@ void FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList( wxCommandEvent& event )
|
||||||
void FOOTPRINT_VIEWER_FRAME::DClickOnFootprintList( wxCommandEvent& event )
|
void FOOTPRINT_VIEWER_FRAME::DClickOnFootprintList( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
AddFootprintToPCB( event );
|
AddFootprintToPCB( event );
|
||||||
|
|
||||||
// Prevent the double click from being as a single mouse button release
|
|
||||||
// event in the parent window which would cause the part to be parked
|
|
||||||
// rather than staying in move mode.
|
|
||||||
// Remember the mouse button will be released in the parent window
|
|
||||||
// thus creating a mouse button release event which should be ignored
|
|
||||||
PCB_EDIT_FRAME* pcbframe = dynamic_cast<PCB_EDIT_FRAME*>( GetParent() );
|
|
||||||
|
|
||||||
// The parent may not be the board editor:
|
|
||||||
if( pcbframe )
|
|
||||||
pcbframe->SkipNextLeftButtonReleaseEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -571,8 +560,6 @@ void FOOTPRINT_VIEWER_FRAME::setCurFootprintName( const wxString& aName )
|
||||||
|
|
||||||
void FOOTPRINT_VIEWER_FRAME::OnActivate( wxActivateEvent& event )
|
void FOOTPRINT_VIEWER_FRAME::OnActivate( wxActivateEvent& event )
|
||||||
{
|
{
|
||||||
EDA_DRAW_FRAME::OnActivate( event );
|
|
||||||
|
|
||||||
// Ensure we do not have old selection:
|
// Ensure we do not have old selection:
|
||||||
if( !event.GetActive() )
|
if( !event.GetActive() )
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -132,7 +132,7 @@ private:
|
||||||
* is called when the frame frame is activate to reload the libraries and component lists
|
* is called when the frame frame is activate to reload the libraries and component lists
|
||||||
* that can be changed by the schematic editor or the library editor.
|
* that can be changed by the schematic editor or the library editor.
|
||||||
*/
|
*/
|
||||||
virtual void OnActivate( wxActivateEvent& event ) override;
|
void OnActivate( wxActivateEvent& event );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SelectCurrentFootprint
|
* Function SelectCurrentFootprint
|
||||||
|
|
|
@ -237,12 +237,7 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway, wxWindow* aParent
|
||||||
updateView();
|
updateView();
|
||||||
|
|
||||||
SetActiveLayer( F_Cu );
|
SetActiveLayer( F_Cu );
|
||||||
// Now Drawpanel is sized, we can use BestZoom to show the component (if any)
|
GetToolManager()->RunAction( ACTIONS::zoomFitScreen );
|
||||||
#ifdef USE_WX_GRAPHICS_CONTEXT
|
|
||||||
GetScreen()->SetScalingFactor( BestZoom() );
|
|
||||||
#else
|
|
||||||
Zoom_Automatique( false );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Do not Run a dialog here: on some Window Managers, it creates issues.
|
// Do not Run a dialog here: on some Window Managers, it creates issues.
|
||||||
// Reason: the FOOTPRINT_WIZARD_FRAME is run as modal;
|
// Reason: the FOOTPRINT_WIZARD_FRAME is run as modal;
|
||||||
|
@ -560,8 +555,6 @@ void FOOTPRINT_WIZARD_FRAME::SaveSettings( wxConfigBase* aCfg )
|
||||||
|
|
||||||
void FOOTPRINT_WIZARD_FRAME::OnActivate( wxActivateEvent& event )
|
void FOOTPRINT_WIZARD_FRAME::OnActivate( wxActivateEvent& event )
|
||||||
{
|
{
|
||||||
EDA_DRAW_FRAME::OnActivate( event );
|
|
||||||
|
|
||||||
// Ensure we do not have old selection:
|
// Ensure we do not have old selection:
|
||||||
if( !event.GetActive() )
|
if( !event.GetActive() )
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -192,7 +192,7 @@ private:
|
||||||
* is called when the frame frame is activate to reload the libraries and component lists
|
* is called when the frame frame is activate to reload the libraries and component lists
|
||||||
* that can be changed by the schematic editor or the library editor.
|
* that can be changed by the schematic editor or the library editor.
|
||||||
*/
|
*/
|
||||||
virtual void OnActivate( wxActivateEvent& event ) override;
|
void OnActivate( wxActivateEvent& event );
|
||||||
|
|
||||||
void SelectCurrentWizard( wxCommandEvent& event );
|
void SelectCurrentWizard( wxCommandEvent& event );
|
||||||
|
|
||||||
|
|
|
@ -518,7 +518,7 @@ void PCB_BASE_FRAME::PlaceModule( MODULE* aModule, bool aRecreateRatsnest )
|
||||||
|
|
||||||
if( ( GetBoard()->IsElementVisible( LAYER_RATSNEST ) || displ_opts->m_Show_Module_Ratsnest )
|
if( ( GetBoard()->IsElementVisible( LAYER_RATSNEST ) || displ_opts->m_Show_Module_Ratsnest )
|
||||||
&& aRecreateRatsnest )
|
&& aRecreateRatsnest )
|
||||||
Compile_Ratsnest( nullptr, true );
|
Compile_Ratsnest( true );
|
||||||
|
|
||||||
SetMsgPanel( aModule );
|
SetMsgPanel( aModule );
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ void PCB_BASE_FRAME::Import_Pad_Settings( D_PAD* aPad, bool aDraw )
|
||||||
if( aDraw )
|
if( aDraw )
|
||||||
{
|
{
|
||||||
aPad->SetFlags( DO_NOT_DRAW );
|
aPad->SetFlags( DO_NOT_DRAW );
|
||||||
m_canvas->RefreshDrawingRect( aPad->GetBoundingBox() );
|
m_canvas->Refresh();
|
||||||
aPad->ClearFlags( DO_NOT_DRAW );
|
aPad->ClearFlags( DO_NOT_DRAW );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ void PCB_BASE_FRAME::Import_Pad_Settings( D_PAD* aPad, bool aDraw )
|
||||||
aPad->ImportSettingsFromMaster( mp );
|
aPad->ImportSettingsFromMaster( mp );
|
||||||
|
|
||||||
if( aDraw )
|
if( aDraw )
|
||||||
m_canvas->RefreshDrawingRect( aPad->GetBoundingBox() );
|
m_canvas->Refresh();
|
||||||
|
|
||||||
aPad->GetParent()->SetLastEditTime();
|
aPad->GetParent()->SetLastEditTime();
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ void PCB_BASE_FRAME::AddPad( MODULE* aModule, bool draw )
|
||||||
SetMsgPanel( pad );
|
SetMsgPanel( pad );
|
||||||
|
|
||||||
if( draw )
|
if( draw )
|
||||||
m_canvas->RefreshDrawingRect( aModule->GetBoundingBox() );
|
m_canvas->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -169,9 +169,6 @@ void PCB_BASE_FRAME::DeletePad( D_PAD* aPad, bool aQuery )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stores the initial bounding box to refresh the old area
|
|
||||||
EDA_RECT bbox = module->GetBoundingBox();
|
|
||||||
|
|
||||||
m_Pcb->m_Status_Pcb = 0;
|
m_Pcb->m_Status_Pcb = 0;
|
||||||
|
|
||||||
GetBoard()->PadDelete( aPad );
|
GetBoard()->PadDelete( aPad );
|
||||||
|
@ -179,9 +176,6 @@ void PCB_BASE_FRAME::DeletePad( D_PAD* aPad, bool aQuery )
|
||||||
// Update the bounding box
|
// Update the bounding box
|
||||||
module->CalculateBoundingBox();
|
module->CalculateBoundingBox();
|
||||||
|
|
||||||
// Refresh the modified screen area, using the initial bounding box
|
GetGalCanvas()->Refresh();
|
||||||
// which is perhaps larger than the new bounding box
|
|
||||||
m_canvas->RefreshDrawingRect( bbox );
|
|
||||||
|
|
||||||
OnModify();
|
OnModify();
|
||||||
}
|
}
|
||||||
|
|
|
@ -350,8 +350,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||||
syncLayerWidgetLayer();
|
syncLayerWidgetLayer();
|
||||||
|
|
||||||
m_auimgr.Update();
|
m_auimgr.Update();
|
||||||
|
GetToolManager()->RunAction( ACTIONS::zoomFitScreen );
|
||||||
Zoom_Automatique( false );
|
|
||||||
|
|
||||||
m_canvasType = LoadCanvasTypeSetting();
|
m_canvasType = LoadCanvasTypeSetting();
|
||||||
|
|
||||||
|
@ -939,7 +938,7 @@ void PCB_EDIT_FRAME::UpdateUserInterface()
|
||||||
// (layer and items visibility, colors ...)
|
// (layer and items visibility, colors ...)
|
||||||
|
|
||||||
// Rebuild list of nets (full ratsnest rebuild)
|
// Rebuild list of nets (full ratsnest rebuild)
|
||||||
Compile_Ratsnest( NULL, true );
|
Compile_Ratsnest( true );
|
||||||
GetBoard()->BuildConnectivity();
|
GetBoard()->BuildConnectivity();
|
||||||
|
|
||||||
// Update info shown by the horizontal toolbars
|
// Update info shown by the horizontal toolbars
|
||||||
|
|
|
@ -50,23 +50,17 @@
|
||||||
* @param aDC = the current device context (can be NULL)
|
* @param aDC = the current device context (can be NULL)
|
||||||
* @param aDisplayStatus : if true, display the computation results
|
* @param aDisplayStatus : if true, display the computation results
|
||||||
*/
|
*/
|
||||||
void PCB_BASE_FRAME::Compile_Ratsnest( wxDC* aDC, bool aDisplayStatus )
|
void PCB_BASE_FRAME::Compile_Ratsnest( bool aDisplayStatus )
|
||||||
{
|
{
|
||||||
// JEY TODO: does this ever get called with a real DC?
|
|
||||||
GetBoard()->GetConnectivity()->RecalculateRatsnest();
|
GetBoard()->GetConnectivity()->RecalculateRatsnest();
|
||||||
|
|
||||||
GetBoard()->m_Status_Pcb = 0; // we want a full ratsnest computation, from the scratch
|
GetBoard()->m_Status_Pcb = 0; // we want a full ratsnest computation, from the scratch
|
||||||
|
|
||||||
if( GetBoard()->IsElementVisible( LAYER_RATSNEST ) && aDC )
|
|
||||||
DrawGeneralRatsnest( aDC, 0 );
|
|
||||||
|
|
||||||
wxString msg;
|
|
||||||
|
|
||||||
ClearMsgPanel();
|
ClearMsgPanel();
|
||||||
|
|
||||||
if( aDisplayStatus )
|
if( aDisplayStatus )
|
||||||
{
|
{
|
||||||
std::shared_ptr<CONNECTIVITY_DATA> conn = m_Pcb->GetConnectivity();
|
std::shared_ptr<CONNECTIVITY_DATA> conn = m_Pcb->GetConnectivity();
|
||||||
|
wxString msg;
|
||||||
|
|
||||||
msg.Printf( wxT( " %d" ), conn->GetPadCount() );
|
msg.Printf( wxT( " %d" ), conn->GetPadCount() );
|
||||||
AppendMsgPanel( _( "Pads" ), msg, RED );
|
AppendMsgPanel( _( "Pads" ), msg, RED );
|
||||||
|
|
|
@ -679,7 +679,7 @@ bool TRACKS_CLEANER::removeItems( std::set<BOARD_ITEM*>& aItems )
|
||||||
bool PCB_EDIT_FRAME::RemoveMisConnectedTracks()
|
bool PCB_EDIT_FRAME::RemoveMisConnectedTracks()
|
||||||
{
|
{
|
||||||
// Old model has to be refreshed, GAL normally does not keep updating it
|
// Old model has to be refreshed, GAL normally does not keep updating it
|
||||||
Compile_Ratsnest( NULL, false );
|
Compile_Ratsnest( false );
|
||||||
BOARD_COMMIT commit( this );
|
BOARD_COMMIT commit( this );
|
||||||
|
|
||||||
TRACKS_CLEANER cleaner( m_UserUnits, GetBoard(), commit );
|
TRACKS_CLEANER cleaner( m_UserUnits, GetBoard(), commit );
|
||||||
|
@ -689,7 +689,7 @@ bool PCB_EDIT_FRAME::RemoveMisConnectedTracks()
|
||||||
{
|
{
|
||||||
// Clear undo and redo lists to avoid inconsistencies between lists
|
// Clear undo and redo lists to avoid inconsistencies between lists
|
||||||
commit.Push( _( "Board cleanup" ) );
|
commit.Push( _( "Board cleanup" ) );
|
||||||
Compile_Ratsnest( NULL, true );
|
Compile_Ratsnest( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_canvas->Refresh( true );
|
m_canvas->Refresh( true );
|
||||||
|
|
|
@ -582,7 +582,7 @@ void PCB_BASE_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool
|
||||||
// connectivity can be rebuilt only in the board editor frame
|
// connectivity can be rebuilt only in the board editor frame
|
||||||
if( IsType( FRAME_PCB ) && ( reBuild_ratsnest || deep_reBuild_ratsnest ) )
|
if( IsType( FRAME_PCB ) && ( reBuild_ratsnest || deep_reBuild_ratsnest ) )
|
||||||
{
|
{
|
||||||
Compile_Ratsnest( NULL, false );
|
Compile_Ratsnest( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
SELECTION_TOOL* selTool = m_toolManager->GetTool<SELECTION_TOOL>();
|
SELECTION_TOOL* selTool = m_toolManager->GetTool<SELECTION_TOOL>();
|
||||||
|
|
Loading…
Reference in New Issue