KiCad PCB EDA Suite
cvpcb_actions.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-2016 CERN
5  * Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors.
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_manager.h>
26 #include <tool/common_tools.h>
27 #include <tool/zoom_tool.h>
28 
29 #include "cvpcb_actions.h"
30 #include "cvpcb_control.h"
31 #include "cvpcb_selection_tool.h"
32 #include <cvpcb_id.h>
33 
34 
36 {
37  aToolManager->RegisterTool( new COMMON_TOOLS );
38  aToolManager->RegisterTool( new ZOOM_TOOL );
39  aToolManager->RegisterTool( new CVPCB_SELECTION_TOOL );
40  aToolManager->RegisterTool( new CVPCB_CONTROL );
41 }
42 
43 
45 {
46  switch( aId )
47  {
48  case ID_ZOOM_IN: // toolbar button "Zoom In"
49  case ID_VIEWER_ZOOM_IN:
51 
52  case ID_ZOOM_OUT: // toolbar button "Zoom In"
53  case ID_VIEWER_ZOOM_OUT:
55 
56  case ID_ZOOM_PAGE: // toolbar button "Fit on Screen"
59 
60  case ID_ZOOM_SELECTION:
62 
65 
68  }
69 
70  return OPT<TOOL_EVENT>();
71 }
Class CVPCB_SELECTION_TOOL.
static TOOL_ACTION zoomInCenter
Definition: actions.h:53
static TOOL_ACTION zoomTool
Definition: actions.h:58
static TOOL_ACTION no_selectionTool
Tool selection.
Definition: cvpcb_actions.h:50
Definition: id.h:241
static TOOL_ACTION zoomFitScreen
Definition: actions.h:56
virtual void RegisterAllTools(TOOL_MANAGER *aToolManager) override
>
static TOOL_ACTION zoomOutCenter
Definition: actions.h:54
Class TOOL_MANAGER.
Definition: tool_manager.h:49
Class COMMON_TOOLS.
Definition: common_tools.h:38
TOOL_EVENT MakeEvent() const
Function HasHotKey() Checks if the action has a hot key assigned.
Definition: tool_action.h:104
boost::optional< T > OPT
Definition: optional.h:7
virtual OPT< TOOL_EVENT > TranslateLegacyId(int aId) override
>
static TOOL_ACTION measureTool
Definition: cvpcb_actions.h:51
Class CVPCB_CONTROL.
Definition: cvpcb_control.h:42
void RegisterTool(TOOL_BASE *aTool)
Function RegisterTool() Adds a tool to the manager set and sets it up.