From 557bb43dd2e7ee1c08d99a2f06bd0a094d4a61ea Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Thu, 30 Apr 2015 10:46:02 +0200 Subject: [PATCH] Moved TOOL_MANAGER & TOOL_DISPATCHER to EDA_DRAW_FRAME. --- common/draw_frame.cpp | 8 ++++++++ include/draw_frame.h | 9 +++++++++ include/wxBasePcbFrame.h | 3 --- include/wxstruct.h | 2 ++ pcbnew/basepcbframe.cpp | 7 ------- 5 files changed, 19 insertions(+), 10 deletions(-) diff --git a/common/draw_frame.cpp b/common/draw_frame.cpp index 0bdd8ff0b6..a190f57ec6 100644 --- a/common/draw_frame.cpp +++ b/common/draw_frame.cpp @@ -51,6 +51,8 @@ #include #include #include +#include +#include /** * Definition for enabling and disabling scroll bar setting trace output. See the @@ -110,6 +112,8 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, m_canvas = NULL; m_galCanvas = NULL; m_galCanvasActive = false; + m_toolManager = NULL; + m_toolDispatcher = NULL; m_messagePanel = NULL; m_currentScreen = NULL; m_toolId = ID_NO_TOOL_SELECTED; @@ -180,6 +184,10 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, EDA_DRAW_FRAME::~EDA_DRAW_FRAME() { + delete m_toolManager; + delete m_toolDispatcher; + delete m_galCanvas; + delete m_currentScreen; m_currentScreen = NULL; diff --git a/include/draw_frame.h b/include/draw_frame.h index a8ea81e3a9..38613bb0ad 100644 --- a/include/draw_frame.h +++ b/include/draw_frame.h @@ -72,6 +72,9 @@ protected: /// The area to draw on. EDA_DRAW_PANEL* m_canvas; + TOOL_MANAGER* m_toolManager; + TOOL_DISPATCHER* m_toolDispatcher; + /// Tool ID of previously active draw tool bar button. int m_lastDrawToolId; @@ -730,6 +733,12 @@ public: EDA_DRAW_PANEL_GAL* GetGalCanvas() const { return m_galCanvas; } void SetGalCanvas( EDA_DRAW_PANEL_GAL* aPanel ) { m_galCanvas = aPanel; } + /** + * Function GetToolManager + * returns the tool manager instance, if any. + */ + TOOL_MANAGER* GetToolManager() const { return m_toolManager; } + /** * Function GetDisplayOptions * A way to pass info to draw functions. the base class has no knowledge about diff --git a/include/wxBasePcbFrame.h b/include/wxBasePcbFrame.h index 793496888a..cd87d1bb21 100644 --- a/include/wxBasePcbFrame.h +++ b/include/wxBasePcbFrame.h @@ -86,9 +86,6 @@ protected: /// main window. wxAuiToolBar* m_auxiliaryToolBar; - TOOL_MANAGER* m_toolManager; - TOOL_DISPATCHER* m_toolDispatcher; - void updateGridSelectBox(); void updateZoomSelectBox(); virtual void unitsChangeRefresh(); diff --git a/include/wxstruct.h b/include/wxstruct.h index 6ce0a79265..19a9fb6cd4 100644 --- a/include/wxstruct.h +++ b/include/wxstruct.h @@ -72,6 +72,8 @@ class PAGE_INFO; class PLOTTER; class TITLE_BLOCK; class MSG_PANEL_ITEM; +class TOOL_MANAGER; +class TOOL_DISPATCHER; enum id_librarytype { diff --git a/pcbnew/basepcbframe.cpp b/pcbnew/basepcbframe.cpp index 2721c78285..864a5545b9 100644 --- a/pcbnew/basepcbframe.cpp +++ b/pcbnew/basepcbframe.cpp @@ -96,8 +96,6 @@ PCB_BASE_FRAME::PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame EDA_DRAW_FRAME( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName ) { m_Pcb = NULL; - m_toolManager = NULL; - m_toolDispatcher = NULL; m_Draw3DFrame = NULL; // Display Window in 3D mode (OpenGL) m_UserGridSize = wxRealPoint( 100.0, 100.0 ); @@ -119,12 +117,7 @@ PCB_BASE_FRAME::PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame PCB_BASE_FRAME::~PCB_BASE_FRAME() { delete m_Collector; - - delete m_toolManager; - delete m_toolDispatcher; - delete m_Pcb; - delete GetGalCanvas(); }