diff --git a/common/painter.cpp b/common/painter.cpp index 785d479a1f..0d6b1f0399 100644 --- a/common/painter.cpp +++ b/common/painter.cpp @@ -38,6 +38,7 @@ RENDER_SETTINGS::RENDER_SETTINGS() m_highlightEnabled = false; m_hiContrastEnabled = false; m_hiContrastFactor = 0.2; + m_highlightNetcode = -1; m_outlineWidth = 1; m_worksheetLineWidth = 100000; diff --git a/include/tool/context_menu.h b/include/tool/context_menu.h index e50ef207c2..0b5f28c41b 100644 --- a/include/tool/context_menu.h +++ b/include/tool/context_menu.h @@ -47,6 +47,8 @@ public: ///> Copy constructor CONTEXT_MENU( const CONTEXT_MENU& aMenu ); + virtual ~CONTEXT_MENU() {}; + /** * Function SetTitle() * Sets title for the context menu. The title is shown as a text label shown on the top of diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index fa7d78323e..cc2650fcde 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -117,9 +117,8 @@ protected: bool m_useCmpFileForFpNames; ///< is true, use the .cmp file from CvPcb, else use the netlist // to know the footprint name of components. - // Functions that handle the Tool Framework (de)initalization + // The Tool Framework initalization void setupTools(); - void destroyTools(); // we'll use lower case function names for private member functions. void createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu* aPopMenu ); diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index bab69a7b37..624418055a 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -264,7 +264,6 @@ set( PCBNEW_CLASS_SRCS tools/edit_tool.cpp tools/pcbnew_control.cpp tools/pcb_editor_control.cpp - tools/pcb_tools.cpp tools/placement_tool.cpp tools/common_actions.cpp ) diff --git a/pcbnew/basepcbframe.cpp b/pcbnew/basepcbframe.cpp index 3ff1a97f51..8369cb0a65 100644 --- a/pcbnew/basepcbframe.cpp +++ b/pcbnew/basepcbframe.cpp @@ -125,6 +125,9 @@ PCB_BASE_FRAME::~PCB_BASE_FRAME() { delete m_Collector; + delete m_toolManager; + delete m_toolDispatcher; + delete m_Pcb; delete GetGalCanvas(); } diff --git a/pcbnew/dialogs/dialog_track_via_size.cpp b/pcbnew/dialogs/dialog_track_via_size.cpp index 8a51cafdb4..07b681ad43 100644 --- a/pcbnew/dialogs/dialog_track_via_size.cpp +++ b/pcbnew/dialogs/dialog_track_via_size.cpp @@ -26,6 +26,7 @@ #include #include #include +#include DIALOG_TRACK_VIA_SIZE::DIALOG_TRACK_VIA_SIZE( wxWindow* aParent, PNS_ROUTING_SETTINGS& aSettings ) : DIALOG_TRACK_VIA_SIZE_BASE( aParent ), diff --git a/pcbnew/layer_widget.cpp b/pcbnew/layer_widget.cpp index df23c188e3..84cad5da02 100644 --- a/pcbnew/layer_widget.cpp +++ b/pcbnew/layer_widget.cpp @@ -587,6 +587,15 @@ LAYER_WIDGET::LAYER_WIDGET( wxWindow* aParent, wxWindow* aFocusOwner, int aPoint } +LAYER_WIDGET::~LAYER_WIDGET() +{ + delete m_BlankBitmap; + delete m_BlankAlternateBitmap; + delete m_RightArrowBitmap; + delete m_RightArrowAlternateBitmap; +} + + wxSize LAYER_WIDGET::GetBestSize() const { // size of m_LayerScrolledWindow -------------- diff --git a/pcbnew/layer_widget.h b/pcbnew/layer_widget.h index cfb6bc384f..e788cc4608 100644 --- a/pcbnew/layer_widget.h +++ b/pcbnew/layer_widget.h @@ -227,6 +227,8 @@ public: wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL ); + virtual ~LAYER_WIDGET(); + /** * Function GetBestSize * returns the preferred minimum size, taking into consideration the diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index 45267d2e0a..e9c082533b 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -70,6 +70,17 @@ #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + #if defined(KICAD_SCRIPTING) || defined(KICAD_SCRIPTING_WXPYTHON) #include // The name of the pane info handling the python console: @@ -469,7 +480,6 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : PCB_EDIT_FRAME::~PCB_EDIT_FRAME() { - destroyTools(); m_RecordingMacros = -1; for( int i = 0; i < 10; i++ ) @@ -524,6 +534,30 @@ bool PCB_EDIT_FRAME::isAutoSaveRequired() const } +void PCB_EDIT_FRAME::setupTools() +{ + // Create the manager and dispatcher & route draw panel events to the dispatcher + m_toolManager = new TOOL_MANAGER; + m_toolManager->SetEnvironment( NULL, GetGalCanvas()->GetView(), + GetGalCanvas()->GetViewControls(), this ); + m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager ); + + // Register tools + m_toolManager->RegisterTool( new SELECTION_TOOL ); + m_toolManager->RegisterTool( new ROUTER_TOOL ); + m_toolManager->RegisterTool( new EDIT_TOOL ); + m_toolManager->RegisterTool( new DRAWING_TOOL ); + m_toolManager->RegisterTool( new POINT_EDITOR ); + m_toolManager->RegisterTool( new PCBNEW_CONTROL ); + m_toolManager->RegisterTool( new PCB_EDITOR_CONTROL ); + m_toolManager->RegisterTool( new PLACEMENT_TOOL ); + m_toolManager->ResetTools( TOOL_BASE::RUN ); + + // Run the selection tool, it is supposed to be always active + m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" ); +} + + void PCB_EDIT_FRAME::ReFillLayerWidget() { m_Layers->ReFill(); diff --git a/pcbnew/router/pns_routing_settings.cpp b/pcbnew/router/pns_routing_settings.cpp index cf87359674..bb67840fbe 100644 --- a/pcbnew/router/pns_routing_settings.cpp +++ b/pcbnew/router/pns_routing_settings.cpp @@ -19,6 +19,7 @@ */ #include "pns_routing_settings.h" +#include "direction.h" PNS_ROUTING_SETTINGS::PNS_ROUTING_SETTINGS() { @@ -39,6 +40,15 @@ PNS_ROUTING_SETTINGS::PNS_ROUTING_SETTINGS() } +const DIRECTION_45 PNS_ROUTING_SETTINGS::InitialDirection() const +{ + if( m_startDiagonal ) + return DIRECTION_45( DIRECTION_45::NE ); + else + return DIRECTION_45( DIRECTION_45::N ); +} + + TIME_LIMIT PNS_ROUTING_SETTINGS::ShoveTimeLimit() const { return TIME_LIMIT ( m_shoveTimeLimit ); diff --git a/pcbnew/router/pns_routing_settings.h b/pcbnew/router/pns_routing_settings.h index 5f6de3fa92..84cfb5bf7e 100644 --- a/pcbnew/router/pns_routing_settings.h +++ b/pcbnew/router/pns_routing_settings.h @@ -21,8 +21,9 @@ #ifndef __PNS_ROUTING_SETTINGS #define __PNS_ROUTING_SETTINGS -#include "direction.h" #include "time_limit.h" + +class DIRECTION_45; ///> Routing modes enum PNS_MODE @@ -118,13 +119,7 @@ public: void SetViaDrill( int aDrill ) { m_viaDrill = aDrill; } int GetViaDrill() const { return m_viaDrill; } - const DIRECTION_45 InitialDirection() const - { - if( m_startDiagonal ) - return DIRECTION_45( DIRECTION_45::NE ); - else - return DIRECTION_45( DIRECTION_45::N ); - } + const DIRECTION_45 InitialDirection() const; int ShoveIterationLimit() const; TIME_LIMIT ShoveTimeLimit() const; diff --git a/pcbnew/router/router_tool.h b/pcbnew/router/router_tool.h index 4ad339f3a5..06dc75b7fe 100644 --- a/pcbnew/router/router_tool.h +++ b/pcbnew/router/router_tool.h @@ -22,18 +22,13 @@ #ifndef __ROUTER_TOOL_H #define __ROUTER_TOOL_H -#include -#include - #include #include #include -#include #include -#include "pns_layerset.h" #include "pns_routing_settings.h" class PNS_ROUTER; diff --git a/pcbnew/tools/pcb_tools.cpp b/pcbnew/tools/pcb_tools.cpp deleted file mode 100644 index 9e604a0b04..0000000000 --- a/pcbnew/tools/pcb_tools.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * This program source code file is part of KiCad, a free EDA CAD application. - * - * Copyright (C) 2013 CERN - * @author Tomasz Wlostowski - * - * 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 "selection_tool.h" -#include "edit_tool.h" -#include "drawing_tool.h" -#include "point_editor.h" -#include "pcbnew_control.h" -#include "pcb_editor_control.h" -#include "placement_tool.h" -#include "common_actions.h" -#include - -void PCB_EDIT_FRAME::setupTools() -{ - // Create the manager and dispatcher & route draw panel events to the dispatcher - m_toolManager = new TOOL_MANAGER; - m_toolManager->SetEnvironment( NULL, GetGalCanvas()->GetView(), - GetGalCanvas()->GetViewControls(), this ); - m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager ); - - // Register tools - m_toolManager->RegisterTool( new SELECTION_TOOL ); - m_toolManager->RegisterTool( new ROUTER_TOOL ); - m_toolManager->RegisterTool( new EDIT_TOOL ); - m_toolManager->RegisterTool( new DRAWING_TOOL ); - m_toolManager->RegisterTool( new POINT_EDITOR ); - m_toolManager->RegisterTool( new PCBNEW_CONTROL ); - m_toolManager->RegisterTool( new PCB_EDITOR_CONTROL ); - m_toolManager->RegisterTool( new PLACEMENT_TOOL ); - m_toolManager->ResetTools( TOOL_BASE::RUN ); - - // Run the selection tool, it is supposed to be always active - m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" ); -} - - -void PCB_EDIT_FRAME::destroyTools() -{ - delete m_toolManager; - delete m_toolDispatcher; -} diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp index d0abb1d60a..3ae883ed89 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -54,7 +54,7 @@ SELECTION_TOOL::SELECTION_TOOL() : SelectedEvent( TC_MESSAGE, TA_ACTION, "pcbnew.InteractiveSelection.selected" ), DeselectedEvent( TC_MESSAGE, TA_ACTION, "pcbnew.InteractiveSelection.deselected" ), ClearedEvent( TC_MESSAGE, TA_ACTION, "pcbnew.InteractiveSelection.cleared" ), - m_additive( false ), m_multiple( false ), m_editModules( false ) + m_frame( NULL ), m_additive( false ), m_multiple( false ), m_editModules( false ) { m_selArea = new SELECTION_AREA; m_selection.group = new KIGFX::VIEW_GROUP;