KiCad PCB EDA Suite
Loading...
Searching...
No Matches
board_editor_control.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-2020 CERN
5 * Copyright (C) 2021-2022 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * @author Maciej Suminski <[email protected]>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, you may find one here:
21 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22 * or you may search the http://www.gnu.org website for the version 2 license,
23 * or you may write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25 */
26
27#ifndef BOARD_EDITOR_CONTROL_H
28#define BOARD_EDITOR_CONTROL_H
29
30#include <tools/pcb_tool_base.h>
31#include <tool/tool_menu.h>
32
33namespace KIGFX {
34 class ORIGIN_VIEWITEM;
35}
36
37class PCB_EDIT_FRAME;
38
43{
44public:
47
49 void Reset( RESET_REASON aReason ) override;
50
52 bool Init() override;
53
54 int New( const TOOL_EVENT& aEvent );
55 int Open( const TOOL_EVENT& aEvent );
56 int Save( const TOOL_EVENT& aEvent );
57 int SaveAs( const TOOL_EVENT& aEvent );
58 int SaveCopy( const TOOL_EVENT& aEvent );
59 int Revert( const TOOL_EVENT& aEvent );
60 int PageSettings( const TOOL_EVENT& aEvent );
61 int Plot( const TOOL_EVENT& aEvent );
62
63 int Search( const TOOL_EVENT& aEvent );
64 int Find( const TOOL_EVENT& aEvent );
65 int FindNext( const TOOL_EVENT& aEvent );
66
67 int BoardSetup( const TOOL_EVENT& aEvent );
68 int ImportNetlist( const TOOL_EVENT& aEvent );
69 int ImportSpecctraSession( const TOOL_EVENT& aEvent );
70 int ExportSpecctraDSN( const TOOL_EVENT& aEvent );
71 int ExportNetlist( const TOOL_EVENT& aEvent );
72 int GenerateDrillFiles( const TOOL_EVENT& aEvent );
73 int GeneratePosFile( const TOOL_EVENT& aEvent );
74 int GenerateFabFiles( const TOOL_EVENT& aEvent );
75 int RepairBoard( const TOOL_EVENT& aEvent );
76
77 int UpdatePCBFromSchematic( const TOOL_EVENT& aEvent );
78 int UpdateSchematicFromPCB( const TOOL_EVENT& aEvent );
79 int ShowEeschema( const TOOL_EVENT& aEvent );
80 int ToggleLayersManager( const TOOL_EVENT& aEvent );
81 int ToggleProperties( const TOOL_EVENT& aEvent );
82 int ToggleNetInspector( const TOOL_EVENT& aEvent );
83 int ToggleSearch( const TOOL_EVENT& aEvent );
84 int TogglePythonConsole( const TOOL_EVENT& aEvent );
85
86 // Track & via size control
87 int TrackWidthInc( const TOOL_EVENT& aEvent );
88 int TrackWidthDec( const TOOL_EVENT& aEvent );
89 int ViaSizeInc( const TOOL_EVENT& aEvent );
90 int ViaSizeDec( const TOOL_EVENT& aEvent );
91
92 // Zone actions
93 int ZoneMerge( const TOOL_EVENT& aEvent );
94
96 int ZoneDuplicate( const TOOL_EVENT& aEvent );
97
98 int EditFpInFpEditor( const TOOL_EVENT& aEvent );
99
101 int CrossProbeToSch( const TOOL_EVENT& aEvent );
102
104 int ExplicitCrossProbeToSch( const TOOL_EVENT& aEvent );
105
107 int AssignNetclass( const TOOL_EVENT& aEvent );
108
112 int PlaceFootprint( const TOOL_EVENT& aEvent );
113
117 bool PlacingFootprint() const { return m_placingFootprint; }
118
120 int ToggleLockSelected( const TOOL_EVENT& aEvent );
121
123 int LockSelected( const TOOL_EVENT& aEvent );
124
126 int UnlockSelected( const TOOL_EVENT& aEvent );
127
129 int DrillOrigin( const TOOL_EVENT& aEvent );
130
132 static void DoSetDrillOrigin( KIGFX::VIEW* aView, PCB_BASE_FRAME* aFrame,
133 EDA_ITEM* aItem, const VECTOR2D& aPoint );
134
135private:
138
139 int modifyLockSelected( MODIFY_MODE aMode );
140
142 void setTransitions() override;
143
144 void doCrossProbePcbToSch( const TOOL_EVENT& aEvent, bool aForce );
145
146private:
148 bool m_inPlaceFootprint; // Re-entrancy guard for tool.
149 bool m_placingFootprint; // Re-entrancy guard for placement loop.
150 bool m_inPlaceTarget; // Re-entrancy guard.
151
152 std::unique_ptr<KIGFX::ORIGIN_VIEWITEM> m_placeOrigin;
153
154 static const int WIDTH_STEP;
155};
156
157#endif
Handle actions specific to the board editor in PcbNew.
int ExportNetlist(const TOOL_EVENT &aEvent)
int UnlockSelected(const TOOL_EVENT &aEvent)
Run the drill origin tool for setting the origin for drill and pick-and-place files.
int Save(const TOOL_EVENT &aEvent)
int ImportNetlist(const TOOL_EVENT &aEvent)
int GenerateDrillFiles(const TOOL_EVENT &aEvent)
int ZoneMerge(const TOOL_EVENT &aEvent)
Duplicate a zone onto a layer (prompts for new layer)
int CrossProbeToSch(const TOOL_EVENT &aEvent)
Equivalent to the above, but initiated by the user.
int TogglePythonConsole(const TOOL_EVENT &aEvent)
static void DoSetDrillOrigin(KIGFX::VIEW *aView, PCB_BASE_FRAME *aFrame, EDA_ITEM *aItem, const VECTOR2D &aPoint)
int UpdatePCBFromSchematic(const TOOL_EVENT &aEvent)
std::unique_ptr< KIGFX::ORIGIN_VIEWITEM > m_placeOrigin
int ShowEeschema(const TOOL_EVENT &aEvent)
int SaveAs(const TOOL_EVENT &aEvent)
int AssignNetclass(const TOOL_EVENT &aEvent)
int ToggleNetInspector(const TOOL_EVENT &aEvent)
int UpdateSchematicFromPCB(const TOOL_EVENT &aEvent)
int ExplicitCrossProbeToSch(const TOOL_EVENT &aEvent)
Assign a netclass to a labelled net.
bool PlacingFootprint() const
Re-entrancy checker for above.
int ToggleSearch(const TOOL_EVENT &aEvent)
int DrillOrigin(const TOOL_EVENT &aEvent)
Low-level access (below undo) to setting the drill origin.
MODIFY_MODE
< How to modify a property for selected items.
int GenerateFabFiles(const TOOL_EVENT &aEvent)
int ViaSizeDec(const TOOL_EVENT &aEvent)
int RepairBoard(const TOOL_EVENT &aEvent)
int ZoneDuplicate(const TOOL_EVENT &aEvent)
int ToggleLayersManager(const TOOL_EVENT &aEvent)
int ImportSpecctraSession(const TOOL_EVENT &aEvent)
bool Init() override
Init() is called once upon a registration of the tool.
int PlaceFootprint(const TOOL_EVENT &aEvent)
Display a dialog to select a footprint to be added and allows the user to set its position.
int BoardSetup(const TOOL_EVENT &aEvent)
int modifyLockSelected(MODIFY_MODE aMode)
Set up handlers for various events.
void setTransitions() override
This method is meant to be overridden in order to specify handlers for events.
int TrackWidthInc(const TOOL_EVENT &aEvent)
static const int WIDTH_STEP
How does line width change after one -/+ key press.
int ToggleLockSelected(const TOOL_EVENT &aEvent)
Lock selected items.
int LockSelected(const TOOL_EVENT &aEvent)
Unlock selected items.
int PageSettings(const TOOL_EVENT &aEvent)
int ExportSpecctraDSN(const TOOL_EVENT &aEvent)
int FindNext(const TOOL_EVENT &aEvent)
int ViaSizeInc(const TOOL_EVENT &aEvent)
int New(const TOOL_EVENT &aEvent)
int Find(const TOOL_EVENT &aEvent)
void doCrossProbePcbToSch(const TOOL_EVENT &aEvent, bool aForce)
int Plot(const TOOL_EVENT &aEvent)
int TrackWidthDec(const TOOL_EVENT &aEvent)
int Revert(const TOOL_EVENT &aEvent)
int Search(const TOOL_EVENT &aEvent)
int Open(const TOOL_EVENT &aEvent)
int SaveCopy(const TOOL_EVENT &aEvent)
int GeneratePosFile(const TOOL_EVENT &aEvent)
int EditFpInFpEditor(const TOOL_EVENT &aEvent)
Notify Eeschema about selected items.
int ToggleProperties(const TOOL_EVENT &aEvent)
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:88
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:68
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
The main frame for Pcbnew.
RESET_REASON
Determine the reason of reset for a tool.
Definition: tool_base.h:78
Generic, UI-independent tool event.
Definition: tool_event.h:167
void Reset() override
The Cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:247