KiCad PCB EDA Suite
tool_base.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2013 CERN
5  * @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
25 #include <tool/tool_event.h>
26 #include <tool/tool_manager.h>
27 
28 #include <wxPcbStruct.h> // LAME!
29 
31 {
32  return m_toolMgr->IsToolActive( m_toolId );
33 }
34 
36 {
37  return m_toolMgr->GetView();
38 }
39 
40 
42 {
43  return m_toolMgr->GetViewControls();
44 }
45 
46 
47 wxWindow* TOOL_BASE::getEditFrameInt() const
48 {
49  return m_toolMgr->GetEditFrame();
50 }
51 
52 
54 {
55  return m_toolMgr->GetModel();
56 }
57 
58 
60 {
61  m_toolMgr = aManager;
62  m_toolSettings = TOOL_SETTINGS( this );
63 }
64 
65 
67  m_tool( aTool )
68 {
69 }
70 
71 
73 {
74 }
75 
76 
78 {
79  return m_toolSettings;
80 }
81 
82 
83 wxString TOOL_SETTINGS::getKeyName( const wxString& aEntryName ) const
84 {
85  wxString key( m_tool->GetName() );
86  key += wxT( "." );
87  key += aEntryName;
88  return key;
89 }
90 
91 
92 wxConfigBase* TOOL_SETTINGS::getConfigBase() const
93 {
94  if( !m_tool )
95  return NULL;
96 
97  // fixme: make independent of pcbnew (post-stable)
99  return frame->GetSettings();
100 
101  return NULL;
102 }
bool IsToolActive(TOOL_ID aId) const
Function IsToolActive() Returns true if a tool with given id is active (executing) ...
wxWindow * GetEditFrame() const
Definition: tool_manager.h:267
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:210
void attachManager(TOOL_MANAGER *aManager)
Function attachManager()
Definition: tool_base.cpp:59
wxWindow * getEditFrameInt() const
Definition: tool_base.cpp:47
wxConfigBase * getConfigBase() const
Returns pointer to currently used wxConfigBase.
Definition: tool_base.cpp:92
TOOL_SETTINGS m_toolSettings
Definition: tool_base.h:216
KIGFX::VIEW_CONTROLS * GetViewControls() const
Definition: tool_manager.h:257
Class TOOL_MANAGER.
Definition: tool_manager.h:49
TOOL_BASE * m_tool
Definition: tool_settings.h:76
bool IsToolActive() const
Definition: tool_base.cpp:30
friend class TOOL_SETTINGS
Definition: tool_base.h:155
Class VIEW_CONTROLS is an interface for classes handling user events controlling the view behaviour (...
TOOL_SETTINGS & GetSettings()
Definition: tool_base.cpp:77
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:41
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
EDA_ITEM * GetModel() const
Definition: tool_manager.h:262
Class TOOL_BASE.
Definition: tool_base.h:68
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:165
Class VIEW.
Definition: view.h:58
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:252
const std::string & GetName() const
Function GetName() Returns the name of the tool.
Definition: tool_base.h:133
TOOL_SETTINGS(TOOL_BASE *aTool=NULL)
Definition: tool_base.cpp:66
wxString getKeyName(const wxString &aEntryName) const override
Definition: tool_base.cpp:83
T * getEditFrame() const
Function getEditFrame()
Definition: tool_base.h:188
EDA_ITEM * getModelInt() const
Definition: tool_base.cpp:53