This commit is contained in:
Jeff Young 2024-04-28 13:51:35 +01:00
parent 1db8b322da
commit a24eada8b1
2 changed files with 19 additions and 25 deletions

View File

@ -45,13 +45,13 @@ KIGFX::VIEW_CONTROLS* TOOL_BASE::getViewControls() const
}
TOOLS_HOLDER* TOOL_BASE::getToolHolderInt() const
TOOLS_HOLDER* TOOL_BASE::getToolHolderInternal() const
{
return m_toolMgr->GetToolHolder();
}
EDA_ITEM* TOOL_BASE::getModelInt() const
EDA_ITEM* TOOL_BASE::getModelInternal() const
{
return m_toolMgr->GetModel();
}

View File

@ -24,8 +24,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __TOOL_BASE_H
#define __TOOL_BASE_H
#ifndef TOOL_BASE_H
#define TOOL_BASE_H
#include <cassert>
#include <functional>
@ -153,7 +153,6 @@ public:
protected:
friend class TOOL_MANAGER;
friend class TOOL_SETTINGS;
/**
* Set the #TOOL_MANAGER the tool will belong to.
@ -186,9 +185,9 @@ protected:
T* getEditFrame() const
{
#if !defined( QA_TEST ) // Dynamic casts give the linker a seizure in the test framework
wxASSERT( dynamic_cast<T*>( getToolHolderInt() ) );
wxASSERT( dynamic_cast<T*>( getToolHolderInternal() ) );
#endif
return static_cast<T*>( getToolHolderInt() );
return static_cast<T*>( getToolHolderInternal() );
}
/**
@ -197,30 +196,25 @@ protected:
template <typename T>
T* getModel() const
{
EDA_ITEM* m = getModelInt();
EDA_ITEM* m = getModelInternal();
#if !defined( QA_TEST ) // Dynamic casts give the linker a seizure in the test framework
wxASSERT( dynamic_cast<T*>( m ) );
#endif
return static_cast<T*>( m );
}
///< Store the type of the tool.
TOOL_TYPE m_type;
///< Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
TOOL_ID m_toolId;
///< Name of the tool. Names are expected to obey the format application.ToolName
///< (eg. pcbnew.InteractiveSelection).
std::string m_toolName;
TOOL_MANAGER* m_toolMgr;
//TOOL_SETTINGS m_toolSettings;
private:
// hide the implementation to avoid spreading half of
// kicad and wxWidgets headers to the tools that may not need them at all!
EDA_ITEM* getModelInt() const;
TOOLS_HOLDER* getToolHolderInt() const;
// hide the implementation to avoid spreading half of kicad and wxWidgets headers to the tools
// that may not need them at all!
EDA_ITEM* getModelInternal() const;
TOOLS_HOLDER* getToolHolderInternal() const;
protected:
TOOL_TYPE m_type;
TOOL_ID m_toolId; ///< Unique id, assigned by a TOOL_MANAGER instance.
std::string m_toolName; ///< Names are expected to obey the format application.ToolName
///< (eg. pcbnew.InteractiveSelection).
TOOL_MANAGER* m_toolMgr;
};
#endif
#endif // TOOL_BASE_H