diff --git a/common/legacy_gal/eda_draw_frame.cpp b/common/legacy_gal/eda_draw_frame.cpp index 0a9895c056..7bbd114fc0 100644 --- a/common/legacy_gal/eda_draw_frame.cpp +++ b/common/legacy_gal/eda_draw_frame.cpp @@ -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 ) { // 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 ) { // Checks all the toolbars and returns true if the given tool id is toggled. diff --git a/common/legacy_wx/eda_draw_frame.cpp b/common/legacy_wx/eda_draw_frame.cpp index 1ee837379b..0899ce77a8 100644 --- a/common/legacy_wx/eda_draw_frame.cpp +++ b/common/legacy_wx/eda_draw_frame.cpp @@ -99,7 +99,6 @@ BEGIN_EVENT_TABLE( EDA_DRAW_FRAME, KIWAY_PLAYER ) EVT_MENU_OPEN( EDA_DRAW_FRAME::OnMenuOpen ) EVT_MENU_CLOSE( 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, 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 ) { // 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 ) { // 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: This is the last caller of BestZoom() too.... void EDA_DRAW_FRAME::Zoom_Automatique( bool aWarpPointer ) { BASE_SCREEN* screen = GetScreen(); diff --git a/common/legacy_wx/eda_draw_panel.cpp b/common/legacy_wx/eda_draw_panel.cpp index 206b0218db..b057ef69e7 100644 --- a/common/legacy_wx/eda_draw_panel.cpp +++ b/common/legacy_wx/eda_draw_panel.cpp @@ -23,56 +23,19 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -/** - * @file draw_panel.cpp - */ - #include -#include -#include #include #include #include #include #include #include -#include #include -#include -#include -#include #include - #include -static const int CURSOR_SIZE = 12; ///< Cursor size in pixels - #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__ 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; #endif -EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id, - const wxPoint& pos, const wxSize& size ) : +EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id, const wxPoint& pos, + const wxSize& size ) : wxScrolledWindow( parent, id, pos, size, drawPanelStyle ) { wxASSERT( parent ); @@ -103,13 +66,6 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id, m_ClipBox.SetSize( size ); m_ClipBox.SetX( 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__ 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_PrintIsMirrored = false; - - m_ClickTimer = (wxTimer*) NULL; - m_doubleClickInterval = 250; } 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 ) { 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 ) { 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 ) { wxLogTrace( kicadTraceKeyEvent, "EDA_DRAW_PANEL::OnCharHook %s", dump( event ) ); 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 ); -} - - diff --git a/eeschema/dialogs/dialog_erc.cpp b/eeschema/dialogs/dialog_erc.cpp index 0bec5a8d87..11cd3ef31a 100644 --- a/eeschema/dialogs/dialog_erc.cpp +++ b/eeschema/dialogs/dialog_erc.cpp @@ -304,11 +304,6 @@ void DIALOG_ERC::OnLeftDblClickMarkersList( wxMouseEvent& event ) m_parent->FocusOnLocation( m_lastMarkerFound->m_Pos, false, true ); m_parent->SetCrossHairPosition( m_lastMarkerFound->m_Pos ); 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(); diff --git a/eeschema/libedit/lib_edit_frame.cpp b/eeschema/libedit/lib_edit_frame.cpp index a381577b4b..6dbb26e33c 100644 --- a/eeschema/libedit/lib_edit_frame.cpp +++ b/eeschema/libedit/lib_edit_frame.cpp @@ -85,7 +85,6 @@ FILL_T LIB_EDIT_FRAME:: g_LastFillStyle = NO_FILL; BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME ) EVT_CLOSE( LIB_EDIT_FRAME::OnCloseWindow ) EVT_SIZE( LIB_EDIT_FRAME::OnSize ) - EVT_ACTIVATE( LIB_EDIT_FRAME::OnActivate ) // Actions 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 libNickname = Prj().GetRString( PROJECT::SCH_LIBEDIT_CUR_LIB ); diff --git a/eeschema/libedit/lib_edit_frame.h b/eeschema/libedit/lib_edit_frame.h index c743fddc47..1f21a22fef 100644 --- a/eeschema/libedit/lib_edit_frame.h +++ b/eeschema/libedit/lib_edit_frame.h @@ -376,13 +376,6 @@ private: */ 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. * diff --git a/eeschema/sch_draw_panel.cpp b/eeschema/sch_draw_panel.cpp index 899eda06e7..f38d6b42d3 100644 --- a/eeschema/sch_draw_panel.cpp +++ b/eeschema/sch_draw_panel.cpp @@ -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 ); - // 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_PrintIsMirrored = false; - m_doubleClickInterval = 250; - m_viewControls->SetSnapping( true ); SetEvtHandlerEnabled( true ); diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index 7e8410907d..60e446a8a8 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -329,7 +329,7 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ): m_auimgr.Update(); GetToolManager()->RunAction( ACTIONS::gridPreset, true, m_LastGridSizeId ); - GetToolManager()->RunAction( ACTIONS::zoomFitScreen, true ); + GetToolManager()->RunAction( ACTIONS::zoomFitScreen ); if( GetGalCanvas() ) GetGalCanvas()->GetGAL()->SetGridVisibility( IsGridVisible() ); diff --git a/eeschema/viewlib_frame.cpp b/eeschema/viewlib_frame.cpp index f0f91dcc9b..00f7d1d460 100644 --- a/eeschema/viewlib_frame.cpp +++ b/eeschema/viewlib_frame.cpp @@ -682,18 +682,6 @@ void LIB_VIEW_FRAME::SetSelectedComponent( const wxString& aComponentName ) void LIB_VIEW_FRAME::DClickOnCmpList( wxCommandEvent& 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( 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 ) { - EDA_DRAW_FRAME::OnActivate( event ); - bool changed = m_libList ? ReCreateListLib() : false; if (changed) diff --git a/eeschema/viewlib_frame.h b/eeschema/viewlib_frame.h index 4416ae13ca..280684ffd4 100644 --- a/eeschema/viewlib_frame.h +++ b/eeschema/viewlib_frame.h @@ -151,7 +151,7 @@ private: * 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. */ - virtual void OnActivate( wxActivateEvent& event ) override; + void OnActivate( wxActivateEvent& event ); void DClickOnCmpList( wxCommandEvent& event ); diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index fe5390dd8d..b4ae294513 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -163,7 +163,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ): m_auimgr.Update(); SetActiveLayer( 0, true ); - Zoom_Automatique( false ); // Gives a default zoom value + GetToolManager()->RunAction( ACTIONS::zoomFitScreen ); EDA_DRAW_PANEL_GAL::GAL_TYPE canvasType = LoadCanvasTypeSetting(); diff --git a/include/class_draw_panel_gal.h b/include/class_draw_panel_gal.h index 482a956010..4c3bd97cf4 100644 --- a/include/class_draw_panel_gal.h +++ b/include/class_draw_panel_gal.h @@ -218,12 +218,6 @@ public: */ 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 * For example, the worksheet bounding box for an empty PCB diff --git a/include/draw_frame.h b/include/draw_frame.h index baabcb7449..2bc948107a 100644 --- a/include/draw_frame.h +++ b/include/draw_frame.h @@ -403,18 +403,6 @@ public: 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 int WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList, wxString* aFullFileName = NULL ) override; @@ -637,14 +625,6 @@ public: */ 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. * diff --git a/include/legacy_gal/class_drawpanel.h b/include/legacy_gal/class_drawpanel.h index 97105d64e8..73d6291fff 100644 --- a/include/legacy_gal/class_drawpanel.h +++ b/include/legacy_gal/class_drawpanel.h @@ -21,19 +21,10 @@ protected: /// of the drawing in internal units. 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 /// are oriented, and in mirror mode, orientations are reversed. bool m_PrintIsMirrored; - int m_doubleClickInterval; - public: EDA_DRAW_PANEL() : @@ -41,9 +32,7 @@ public: m_cursorLevel( 0 ), m_scrollIncrementX( 1 ), m_scrollIncrementY( 1 ), - m_ignoreNextLeftButtonRelease( false ), - m_PrintIsMirrored( false ), - m_doubleClickInterval( 0 ) + m_PrintIsMirrored( false ) {}; virtual ~EDA_DRAW_PANEL(){}; @@ -65,8 +54,6 @@ public: void SetClipBox( const EDA_RECT& aRect ) { m_ClipBox = aRect; } - void SetIgnoreLeftButtonReleaseEvent( bool aIgnore ) { m_ignoreNextLeftButtonRelease = aIgnore; } - bool GetPrintMirrored() const { return m_PrintIsMirrored; } void SetPrintMirrored( bool aMirror ) { m_PrintIsMirrored = aMirror; } @@ -125,18 +112,6 @@ public: */ 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 wxWindow* GetWindow() = 0; diff --git a/include/legacy_wx/class_drawpanel.h b/include/legacy_wx/class_drawpanel.h index 6ebe5efaac..c6fbaaa2af 100644 --- a/include/legacy_wx/class_drawpanel.h +++ b/include/legacy_wx/class_drawpanel.h @@ -23,11 +23,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -/** - * @file class_drawpanel.h: - * @brief EDA_DRAW_PANEL class definition. - */ - #ifndef PANEL_WXSTRUCT_H #define PANEL_WXSTRUCT_H @@ -40,18 +35,6 @@ class BASE_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 { private: @@ -67,7 +50,6 @@ private: wxPoint m_PanStartEventPosition; ///< Initial position of mouse event when pan started 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 /// of the drawing in internal units. @@ -80,25 +62,10 @@ private: */ 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 /// are oriented, and in mirror mode, orientations are reversed. 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: 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; - void OnPaint( wxPaintEvent& event ); - EDA_RECT* GetClipBox() { return &m_ClipBox; } void SetClipBox( const EDA_RECT& aRect ) { m_ClipBox = aRect; } - void SetIgnoreLeftButtonReleaseEvent( bool aIgnore ) { m_ignoreNextLeftButtonRelease = aIgnore; } - bool GetPrintMirrored() const { return m_PrintIsMirrored; } void SetPrintMirrored( bool aMirror ) { m_PrintIsMirrored = aMirror; } void OnEraseBackground( wxEraseEvent& event ) { } - /** - * Function OnActivate - * handles window activation events. - *

- * 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. - *

- */ - void OnActivate( wxActivateEvent& event ); - /** * Function DoPrepareDC * sets up the device context \a aDC for drawing. @@ -155,45 +107,10 @@ public: */ virtual void DoPrepareDC( wxDC& aDC ) override; - /** - * Function DeviceToLogical - * converts \a aRect from device to drawing (logical) coordinates. - *

- * \a aRect must be in scrolled device units. - *

- * @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 */ - /** - * Function OnMouseWheel - * handles mouse wheel events. - *

- * 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. - *

- */ - 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 OnPan( wxCommandEvent& event ); - - void OnScrollWin( wxCommandEvent& event ); - void OnScroll( wxScrollWinEvent& event ); - - void SetGrid( const wxRealPoint& size ); - wxRealPoint GetGrid(); - /** * Function SetClipBox * 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 ); - /** - * 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() virtual void Refresh( bool eraseBackground = true, const wxRect* rect = NULL ) override; @@ -230,38 +138,7 @@ public: */ 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 */ - /** - * Function DrawCrossHair - * draws the user cross hair. - *

- * 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. - *

- * @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 @@ -278,15 +155,6 @@ public: * @return the default cursor shape */ 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() }; diff --git a/include/pcb_base_frame.h b/include/pcb_base_frame.h index 48ccfd0343..6f84f2f85b 100644 --- a/include/pcb_base_frame.h +++ b/include/pcb_base_frame.h @@ -353,7 +353,7 @@ public: * @param aDC = the current device context (can be NULL) * @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 @@ -364,17 +364,7 @@ public: */ void DrawGeneralRatsnest( wxDC* aDC, int aNetcode = 0 ); - /** - * 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: - */ + /* Functions relative to Undo/redo commands: */ /** * Function SaveCopyInUndoList (virtual pure) diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index 999b4b2fc9..92e1b67fba 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -235,7 +235,6 @@ set( PCBNEW_CLASS_SRCS array_pad_name_provider.cpp board_netlist_updater.cpp build_BOM_from_board.cpp - connect.cpp cross-probing.cpp drc.cpp drc_clearance_test_functions.cpp diff --git a/pcbnew/class_zone.cpp b/pcbnew/class_zone.cpp index 822678b3b8..d0743fa392 100644 --- a/pcbnew/class_zone.cpp +++ b/pcbnew/class_zone.cpp @@ -164,8 +164,7 @@ EDA_ITEM* ZONE_CONTAINER::Clone() const bool ZONE_CONTAINER::UnFill() { - bool change = ( !m_FilledPolysList.IsEmpty() ) || - ( m_FillSegmList.size() > 0 ); + bool change = ( !m_FilledPolysList.IsEmpty() || m_FillSegmList.size() > 0 ); m_FilledPolysList.RemoveAllContours(); m_FillSegmList.clear(); @@ -225,9 +224,7 @@ void ZONE_CONTAINER::SetLayerSet( LSET aLayerSet ) } if( aLayerSet.count() == 0 ) - { return; - } if( m_layerSet != aLayerSet ) SetNeedRefill( true ); @@ -260,9 +257,7 @@ void ZONE_CONTAINER::ViewGetLayers( int aLayers[], int& aCount ) const LSEQ layers = m_layerSet.Seq(); for( unsigned int idx = 0; idx < layers.size(); idx++ ) - { aLayers[idx] = layers[idx]; - } 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 { if( GetIsKeepout() ) - { return m_layerSet.test( aLayer ); - } return BOARD_ITEM::IsOnLayer( aLayer ); } diff --git a/pcbnew/connect.cpp b/pcbnew/connect.cpp deleted file mode 100644 index a75b5d522c..0000000000 --- a/pcbnew/connect.cpp +++ /dev/null @@ -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 - * 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 -#include -#include -#include -#include - -#include -#include - -void PCB_BASE_FRAME::TestNetConnection( wxDC* aDC, int aNetCode ) -{ - // Build and display new ratsnest - Compile_Ratsnest( aDC, false ); -} diff --git a/pcbnew/dialogs/dialog_cleanup_tracks_and_vias.cpp b/pcbnew/dialogs/dialog_cleanup_tracks_and_vias.cpp index 0c364e47aa..458f3b0f59 100644 --- a/pcbnew/dialogs/dialog_cleanup_tracks_and_vias.cpp +++ b/pcbnew/dialogs/dialog_cleanup_tracks_and_vias.cpp @@ -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 - m_parentFrame->Compile_Ratsnest( NULL, false ); + m_parentFrame->Compile_Ratsnest( false ); bool modified = cleaner.CleanupBoard( aDryRun, &m_items, m_cleanShortCircuitOpt->GetValue(), @@ -176,13 +176,7 @@ void DIALOG_CLEANUP_TRACKS_AND_VIAS::OnLeftDClickItem( wxMouseEvent& event ) m_parentFrame->FocusOnLocation( item->GetPointA(), true, true ); if( !IsModal() ) - { Show( false ); - - // We do not want the clarify selection popup when releasing the - // left button in the main window - m_parentFrame->SkipNextLeftButtonReleaseEvent(); - } } } } diff --git a/pcbnew/dialogs/dialog_drc.cpp b/pcbnew/dialogs/dialog_drc.cpp index 64ed5189c0..01e604a7ea 100644 --- a/pcbnew/dialogs/dialog_drc.cpp +++ b/pcbnew/dialogs/dialog_drc.cpp @@ -335,16 +335,10 @@ void DIALOG_DRC_CONTROL::OnLeftDClickClearance( wxMouseEvent& event ) { 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() ) - { - // turn control over to m_brdEditor, hide this DIALOG_DRC_CONTROL window, - // no destruction so we can preserve listbox cursor 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( !IsModal() ) - { 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 ) ) ) { + // turn control over to m_brdEditor, hide this DIALOG_DRC_CONTROL window, + // no destruction so we can preserve listbox cursor if( !IsModal() ) - { - // turn control over to m_brdEditor, hide this DIALOG_DRC_CONTROL window, - // no destruction so we can preserve listbox cursor Show( false ); - - // We do not want the clarify selection popup when releasing the - // left button in the main window - m_brdEditor->SkipNextLeftButtonReleaseEvent(); - } } } } diff --git a/pcbnew/dialogs/dialog_exchange_footprints.cpp b/pcbnew/dialogs/dialog_exchange_footprints.cpp index 9b86d25fae..ea48e22d27 100644 --- a/pcbnew/dialogs/dialog_exchange_footprints.cpp +++ b/pcbnew/dialogs/dialog_exchange_footprints.cpp @@ -275,7 +275,7 @@ void DIALOG_EXCHANGE_FOOTPRINTS::OnApplyClicked( wxCommandEvent& event ) if( processMatchingModules() ) { if( m_parent->GetBoard()->IsElementVisible( LAYER_RATSNEST ) ) - m_parent->Compile_Ratsnest( NULL, true ); + m_parent->Compile_Ratsnest( true ); m_parent->GetCanvas()->Refresh(); } diff --git a/pcbnew/dialogs/dialog_global_deletion.cpp b/pcbnew/dialogs/dialog_global_deletion.cpp index 327cc15c4f..cf72d43a94 100644 --- a/pcbnew/dialogs/dialog_global_deletion.cpp +++ b/pcbnew/dialogs/dialog_global_deletion.cpp @@ -234,7 +234,7 @@ void DIALOG_GLOBAL_DELETION::AcceptPcbDelete() pcb->DeleteMARKERs(); 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 m_Parent->GetCanvas()->Refresh(); diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp index dc1064ab91..34303e5dd3 100644 --- a/pcbnew/dialogs/dialog_pad_properties.cpp +++ b/pcbnew/dialogs/dialog_pad_properties.cpp @@ -1453,7 +1453,7 @@ bool DIALOG_PAD_PROPERTIES::TransferDataFromWindow() // redraw the area where the pad was, without pad (delete pad on screen) m_currentPad->SetFlags( DO_NOT_DRAW ); - m_parent->GetCanvas()->RefreshDrawingRect( m_currentPad->GetBoundingBox() ); + m_parent->GetCanvas()->Refresh(); m_currentPad->ClearFlags( DO_NOT_DRAW ); // Update values @@ -1573,7 +1573,7 @@ bool DIALOG_PAD_PROPERTIES::TransferDataFromWindow() m_parent->SetMsgPanel( m_currentPad ); // redraw the area where the pad was - m_parent->GetCanvas()->RefreshDrawingRect( m_currentPad->GetBoundingBox() ); + m_parent->GetCanvas()->Refresh(); commit.Push( _( "Modify pad" ) ); diff --git a/pcbnew/dialogs/panel_setup_layers.cpp b/pcbnew/dialogs/panel_setup_layers.cpp index 2f67dd1b48..78f21cc4ae 100644 --- a/pcbnew/dialogs/panel_setup_layers.cpp +++ b/pcbnew/dialogs/panel_setup_layers.cpp @@ -577,7 +577,7 @@ bool PANEL_SETUP_LAYERS::TransferDataFromWindow() if( hasRemovedBoardItems ) { // Rebuild list of nets (full ratsnest rebuild) - m_frame->Compile_Ratsnest( NULL, true ); + m_frame->Compile_Ratsnest( true ); m_pcb->BuildConnectivity(); } diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index 0078a011dc..008f4c98c2 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -274,7 +274,7 @@ void PCB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent ) else SetToolID( id, wxCURSOR_QUESTION_ARROW, _( "Add tracks" ) ); - Compile_Ratsnest( nullptr, true ); + Compile_Ratsnest( true ); break; case ID_PCB_ZONES_BUTT: @@ -335,7 +335,7 @@ void PCB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent ) case ID_LOCAL_RATSNEST_BUTT: SetToolID( id, wxCURSOR_HAND, _( "Select rats nest" ) ); - Compile_Ratsnest( nullptr, true ); + Compile_Ratsnest( true ); break; diff --git a/pcbnew/exporters/export_gencad.cpp b/pcbnew/exporters/export_gencad.cpp index be94fb19fa..7ddbd83441 100644 --- a/pcbnew/exporters/export_gencad.cpp +++ b/pcbnew/exporters/export_gencad.cpp @@ -306,7 +306,7 @@ void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& aEvent ) GencadOffsetY = optionsDialog.GetOption( USE_AUX_ORIGIN ) ? GetAuxOrigin().y : 0; // 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 * layer) to convert them to non flipped footprints. diff --git a/pcbnew/files.cpp b/pcbnew/files.cpp index f3341b7c26..6689751c80 100644 --- a/pcbnew/files.cpp +++ b/pcbnew/files.cpp @@ -593,7 +593,7 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector& aFileSet, in SetCurrentNetClass( NETCLASS::Default ); // Rebuild list of nets (full ratsnest rebuild) - Compile_Ratsnest( NULL, true ); + Compile_Ratsnest( true ); GetBoard()->BuildConnectivity(); onBoardLoaded(); diff --git a/pcbnew/footprint_edit_frame.cpp b/pcbnew/footprint_edit_frame.cpp index a677706867..e9c26cae53 100644 --- a/pcbnew/footprint_edit_frame.cpp +++ b/pcbnew/footprint_edit_frame.cpp @@ -282,12 +282,11 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent, ActivateGalCanvas(); m_auimgr.Update(); + GetToolManager()->RunAction( ACTIONS::zoomFitScreen ); updateTitle(); Raise(); // On some window managers, this is needed Show( true ); - - Zoom_Automatique( false ); } diff --git a/pcbnew/footprint_viewer_frame.cpp b/pcbnew/footprint_viewer_frame.cpp index a4e90d8100..15190a3911 100644 --- a/pcbnew/footprint_viewer_frame.cpp +++ b/pcbnew/footprint_viewer_frame.cpp @@ -445,17 +445,6 @@ void FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList( wxCommandEvent& event ) void FOOTPRINT_VIEWER_FRAME::DClickOnFootprintList( wxCommandEvent& 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( 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 ) { - EDA_DRAW_FRAME::OnActivate( event ); - // Ensure we do not have old selection: if( !event.GetActive() ) return; diff --git a/pcbnew/footprint_viewer_frame.h b/pcbnew/footprint_viewer_frame.h index e498342031..30e562cdd1 100644 --- a/pcbnew/footprint_viewer_frame.h +++ b/pcbnew/footprint_viewer_frame.h @@ -132,7 +132,7 @@ private: * 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. */ - virtual void OnActivate( wxActivateEvent& event ) override; + void OnActivate( wxActivateEvent& event ); /** * Function SelectCurrentFootprint diff --git a/pcbnew/footprint_wizard_frame.cpp b/pcbnew/footprint_wizard_frame.cpp index 28679f8b13..d2041ffc9c 100644 --- a/pcbnew/footprint_wizard_frame.cpp +++ b/pcbnew/footprint_wizard_frame.cpp @@ -237,12 +237,7 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway, wxWindow* aParent updateView(); SetActiveLayer( F_Cu ); - // Now Drawpanel is sized, we can use BestZoom to show the component (if any) -#ifdef USE_WX_GRAPHICS_CONTEXT - GetScreen()->SetScalingFactor( BestZoom() ); -#else - Zoom_Automatique( false ); -#endif + GetToolManager()->RunAction( ACTIONS::zoomFitScreen ); // Do not Run a dialog here: on some Window Managers, it creates issues. // 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 ) { - EDA_DRAW_FRAME::OnActivate( event ); - // Ensure we do not have old selection: if( !event.GetActive() ) return; diff --git a/pcbnew/footprint_wizard_frame.h b/pcbnew/footprint_wizard_frame.h index bd776ffc30..fdc76ed409 100644 --- a/pcbnew/footprint_wizard_frame.h +++ b/pcbnew/footprint_wizard_frame.h @@ -192,7 +192,7 @@ private: * 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. */ - virtual void OnActivate( wxActivateEvent& event ) override; + void OnActivate( wxActivateEvent& event ); void SelectCurrentWizard( wxCommandEvent& event ); diff --git a/pcbnew/load_select_footprint.cpp b/pcbnew/load_select_footprint.cpp index f552a07e09..2fdf53ab92 100644 --- a/pcbnew/load_select_footprint.cpp +++ b/pcbnew/load_select_footprint.cpp @@ -518,7 +518,7 @@ void PCB_BASE_FRAME::PlaceModule( MODULE* aModule, bool aRecreateRatsnest ) if( ( GetBoard()->IsElementVisible( LAYER_RATSNEST ) || displ_opts->m_Show_Module_Ratsnest ) && aRecreateRatsnest ) - Compile_Ratsnest( nullptr, true ); + Compile_Ratsnest( true ); SetMsgPanel( aModule ); } diff --git a/pcbnew/pad_edit_functions.cpp b/pcbnew/pad_edit_functions.cpp index f88c847c65..d62418259f 100644 --- a/pcbnew/pad_edit_functions.cpp +++ b/pcbnew/pad_edit_functions.cpp @@ -65,7 +65,7 @@ void PCB_BASE_FRAME::Import_Pad_Settings( D_PAD* aPad, bool aDraw ) if( aDraw ) { aPad->SetFlags( DO_NOT_DRAW ); - m_canvas->RefreshDrawingRect( aPad->GetBoundingBox() ); + m_canvas->Refresh(); aPad->ClearFlags( DO_NOT_DRAW ); } @@ -74,7 +74,7 @@ void PCB_BASE_FRAME::Import_Pad_Settings( D_PAD* aPad, bool aDraw ) aPad->ImportSettingsFromMaster( mp ); if( aDraw ) - m_canvas->RefreshDrawingRect( aPad->GetBoundingBox() ); + m_canvas->Refresh(); aPad->GetParent()->SetLastEditTime(); @@ -146,7 +146,7 @@ void PCB_BASE_FRAME::AddPad( MODULE* aModule, bool draw ) SetMsgPanel( pad ); 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; } - // Stores the initial bounding box to refresh the old area - EDA_RECT bbox = module->GetBoundingBox(); - m_Pcb->m_Status_Pcb = 0; GetBoard()->PadDelete( aPad ); @@ -179,9 +176,6 @@ void PCB_BASE_FRAME::DeletePad( D_PAD* aPad, bool aQuery ) // Update the bounding box module->CalculateBoundingBox(); - // Refresh the modified screen area, using the initial bounding box - // which is perhaps larger than the new bounding box - m_canvas->RefreshDrawingRect( bbox ); - + GetGalCanvas()->Refresh(); OnModify(); } diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index dce3629de9..e431b64e1e 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -350,8 +350,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : syncLayerWidgetLayer(); m_auimgr.Update(); - - Zoom_Automatique( false ); + GetToolManager()->RunAction( ACTIONS::zoomFitScreen ); m_canvasType = LoadCanvasTypeSetting(); @@ -939,7 +938,7 @@ void PCB_EDIT_FRAME::UpdateUserInterface() // (layer and items visibility, colors ...) // Rebuild list of nets (full ratsnest rebuild) - Compile_Ratsnest( NULL, true ); + Compile_Ratsnest( true ); GetBoard()->BuildConnectivity(); // Update info shown by the horizontal toolbars diff --git a/pcbnew/ratsnest.cpp b/pcbnew/ratsnest.cpp index 5ebf02ec84..5671f29826 100644 --- a/pcbnew/ratsnest.cpp +++ b/pcbnew/ratsnest.cpp @@ -50,23 +50,17 @@ * @param aDC = the current device context (can be NULL) * @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()->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(); if( aDisplayStatus ) { std::shared_ptr conn = m_Pcb->GetConnectivity(); + wxString msg; msg.Printf( wxT( " %d" ), conn->GetPadCount() ); AppendMsgPanel( _( "Pads" ), msg, RED ); diff --git a/pcbnew/tracks_cleaner.cpp b/pcbnew/tracks_cleaner.cpp index 648eb14a1e..9cc7529dde 100644 --- a/pcbnew/tracks_cleaner.cpp +++ b/pcbnew/tracks_cleaner.cpp @@ -679,7 +679,7 @@ bool TRACKS_CLEANER::removeItems( std::set& aItems ) bool PCB_EDIT_FRAME::RemoveMisConnectedTracks() { // Old model has to be refreshed, GAL normally does not keep updating it - Compile_Ratsnest( NULL, false ); + Compile_Ratsnest( false ); BOARD_COMMIT commit( this ); 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 commit.Push( _( "Board cleanup" ) ); - Compile_Ratsnest( NULL, true ); + Compile_Ratsnest( true ); } m_canvas->Refresh( true ); diff --git a/pcbnew/undo_redo.cpp b/pcbnew/undo_redo.cpp index 5eab239fe1..5aaaf0ebbb 100644 --- a/pcbnew/undo_redo.cpp +++ b/pcbnew/undo_redo.cpp @@ -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 if( IsType( FRAME_PCB ) && ( reBuild_ratsnest || deep_reBuild_ratsnest ) ) { - Compile_Ratsnest( NULL, false ); + Compile_Ratsnest( false ); } SELECTION_TOOL* selTool = m_toolManager->GetTool();