KiCad PCB EDA Suite
common_tools.h
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) 2014-2016 CERN
5  * @author Maciej Suminski <maciej.suminski@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 #ifndef _COMMON_TOOLS_H
26 #define _COMMON_TOOLS_H
27 
28 #include <tool/tool_interactive.h>
29 
30 class EDA_DRAW_FRAME;
31 
39 {
40 public:
41  COMMON_TOOLS();
42  ~COMMON_TOOLS();
43 
45  void Reset( RESET_REASON aReason ) override;
46 
47  // View controls
48  int ZoomInOut( const TOOL_EVENT& aEvent );
49  int ZoomInOutCenter( const TOOL_EVENT& aEvent );
50  int ZoomCenter( const TOOL_EVENT& aEvent );
51  int ZoomFitScreen( const TOOL_EVENT& aEvent );
52  int ZoomPreset( const TOOL_EVENT& aEvent );
53 
54  // Cursor control
55  int ToggleCursor( const TOOL_EVENT& aEvent );
56 
57  // Grid control
58  int GridNext( const TOOL_EVENT& aEvent );
59  int GridPrev( const TOOL_EVENT& aEvent );
60  int GridPreset( const TOOL_EVENT& aEvent );
61 
63  void SetTransitions() override;
64 
65 private:
68 
70  void updateGrid();
71 };
72 
73 #endif
EDA_DRAW_FRAME * m_frame
Pointer to the currently used edit frame.
Definition: common_tools.h:67
int ZoomFitScreen(const TOOL_EVENT &aEvent)
int GridPreset(const TOOL_EVENT &aEvent)
void updateGrid()
Applies the legacy canvas grid settings for GAL.
Class EDA_DRAW_FRAME is the base class for create windows for drawing purpose.
Definition: draw_frame.h:53
int GridNext(const TOOL_EVENT &aEvent)
int ZoomInOutCenter(const TOOL_EVENT &aEvent)
int GridPrev(const TOOL_EVENT &aEvent)
Class TOOL_EVENT.
Definition: tool_event.h:162
int ZoomCenter(const TOOL_EVENT &aEvent)
int ZoomInOut(const TOOL_EVENT &aEvent)
int ToggleCursor(const TOOL_EVENT &aEvent)
Class COMMON_TOOLS.
Definition: common_tools.h:38
int ZoomPreset(const TOOL_EVENT &aEvent)
RESET_REASON
Determines the reason of reset for a tool
Definition: tool_base.h:80
void Reset(RESET_REASON aReason) override
Function Reset() Brings the tool to a known, initial state.
void SetTransitions() override
Sets up handlers for various events.