TOOL_SETTINGS acquires wxConfigBase each time it is used.

This commit is contained in:
Maciej Suminski
2015-08-07 18:17:51 +02:00
parent 5cd464f244
commit 9ecc593aac
2 changed files with 31 additions and 22 deletions
+15 -13
View File
@@ -58,20 +58,9 @@ void TOOL_BASE::attachManager( TOOL_MANAGER* aManager )
}
TOOL_SETTINGS::TOOL_SETTINGS( TOOL_BASE* aTool )
TOOL_SETTINGS::TOOL_SETTINGS( TOOL_BASE* aTool ) :
m_tool( aTool )
{
m_tool = aTool;
if( !aTool )
{
m_config = NULL;
return;
}
// fixme: make independent of pcbnew (post-stable)
PCB_EDIT_FRAME* frame = aTool->getEditFrame<PCB_EDIT_FRAME>();
m_config = frame->GetSettings();
}
@@ -93,3 +82,16 @@ wxString TOOL_SETTINGS::getKeyName( const wxString& aEntryName ) const
key += aEntryName;
return key;
}
wxConfigBase* TOOL_SETTINGS::getConfigBase() const
{
if( !m_tool )
return NULL;
// fixme: make independent of pcbnew (post-stable)
if( PCB_EDIT_FRAME* frame = m_tool->getEditFrame<PCB_EDIT_FRAME>() )
return frame->GetSettings();
return NULL;
}