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 The 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, see <https://www.gnu.org/licenses/>.
21 */
22
23#ifndef BOARD_EDITOR_CONTROL_H
24#define BOARD_EDITOR_CONTROL_H
25
26#include <tools/pcb_tool_base.h>
27#include <tool/tool_menu.h>
28
29namespace KIGFX {
30 class ORIGIN_VIEWITEM;
31}
32
33class PCB_EDIT_FRAME;
34
39{
40public:
43
45 void Reset( RESET_REASON aReason ) override;
46
48 bool Init() override;
49
50 int New( const TOOL_EVENT& aEvent );
51 int Open( const TOOL_EVENT& aEvent );
52 int Save( const TOOL_EVENT& aEvent );
53 int SaveAs( const TOOL_EVENT& aEvent );
54 int SaveCopy( const TOOL_EVENT& aEvent );
55 int Revert( const TOOL_EVENT& aEvent );
56 int RescueAutosave( const TOOL_EVENT& aEvent );
57 int OpenNonKicadBoard( const TOOL_EVENT& aEvent );
58 int ExportFootprints( const TOOL_EVENT& aEvent );
59 int PageSettings( const TOOL_EVENT& aEvent );
60 int Plot( const TOOL_EVENT& aEvent );
61
62 int Search( const TOOL_EVENT& aEvent );
63 int Find( const TOOL_EVENT& aEvent );
64 int FindNext( const TOOL_EVENT& aEvent );
65 int FindByProperties( 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 GenerateGerbers( const TOOL_EVENT& aEvent );
75 int ExportGenCAD( const TOOL_EVENT& aEvent );
76 int ExportVRML( const TOOL_EVENT& aEvent );
77 int ExportIDF( const TOOL_EVENT& aEvent );
78 int ExportSTEP( const TOOL_EVENT& aEvent );
79 int ExportCmpFile( const TOOL_EVENT& aEvent );
80 int ExportHyperlynx( const TOOL_EVENT& aEvent );
81 int GenBOMFileFromBoard( const TOOL_EVENT& aEvent );
82 int GenFootprintsReport( const TOOL_EVENT& aEvent );
83 int GenD356File( const TOOL_EVENT& aEvent );
84 int GenIPC2581File( const TOOL_EVENT& aEvent );
85 int GenerateODBPPFiles( const TOOL_EVENT& aEvent );
86 int RepairBoard( const TOOL_EVENT& aEvent );
87
88 int UpdatePCBFromSchematic( const TOOL_EVENT& aEvent );
89 int UpdateSchematicFromPCB( const TOOL_EVENT& aEvent );
90 int ShowEeschema( const TOOL_EVENT& aEvent );
91 int ToggleLayersManager( const TOOL_EVENT& aEvent );
92 int ToggleProperties( const TOOL_EVENT& aEvent );
93 int ToggleNetInspector( const TOOL_EVENT& aEvent );
94 int ToggleSearch( const TOOL_EVENT& aEvent );
95 int ToggleLibraryTree( const TOOL_EVENT& aEvent );
96
97 // Track & via size control
98 int TrackWidthInc( const TOOL_EVENT& aEvent );
99 int TrackWidthDec( const TOOL_EVENT& aEvent );
100 int ViaSizeInc( const TOOL_EVENT& aEvent );
101 int ViaSizeDec( const TOOL_EVENT& aEvent );
102 int AutoTrackWidth( const TOOL_EVENT& aEvent );
103
104 // Zone actions
105 int ZoneMerge( const TOOL_EVENT& aEvent );
106
108 int ZoneDuplicate( const TOOL_EVENT& aEvent );
109
110 // Zone priority manipulation
111 int ZonePriorityMoveToTop( const TOOL_EVENT& aEvent );
112 int ZonePriorityRaise( const TOOL_EVENT& aEvent );
113 int ZonePriorityLower( const TOOL_EVENT& aEvent );
114 int ZonePriorityMoveToBottom( const TOOL_EVENT& aEvent );
115
116 int EditFpInFpEditor( const TOOL_EVENT& aEvent );
117
119 int CrossProbeToSch( const TOOL_EVENT& aEvent );
120
122 int ExplicitCrossProbeToSch( const TOOL_EVENT& aEvent );
123
125 int AssignNetclass( const TOOL_EVENT& aEvent );
126
130 int PlaceFootprint( const TOOL_EVENT& aEvent );
131
135 bool PlacingFootprint() const { return m_placingFootprint; }
136
138 int ToggleLockSelected( const TOOL_EVENT& aEvent );
139
141 int LockSelected( const TOOL_EVENT& aEvent );
142
144 int UnlockSelected( const TOOL_EVENT& aEvent );
145
147 int DrillOrigin( const TOOL_EVENT& aEvent );
148
150 static void DoSetDrillOrigin( KIGFX::VIEW* aView, PCB_BASE_FRAME* aFrame,
151 EDA_ITEM* aItem, const VECTOR2D& aPoint );
152
153 // Line-mode handlers
154 int ChangeLineMode( const TOOL_EVENT& aEvent );
155 int OnAngleSnapModeChanged( const TOOL_EVENT& aEvent );
156
157private:
160
161 int modifyLockSelected( MODIFY_MODE aMode );
162
164 void setTransitions() override;
165
166 void doCrossProbePcbToSch( const TOOL_EVENT& aEvent, bool aForce );
167
168private:
170 bool m_inPlaceFootprint; // Re-entrancy guard for tool.
171 bool m_placingFootprint; // Re-entrancy guard for placement loop.
172
173 std::unique_ptr<KIGFX::ORIGIN_VIEWITEM> m_placeOrigin;
174};
175
176#endif
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 ZonePriorityMoveToTop(const TOOL_EVENT &aEvent)
int GenBOMFileFromBoard(const TOOL_EVENT &aEvent)
int RescueAutosave(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 ExportFootprints(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 ZonePriorityRaise(const TOOL_EVENT &aEvent)
int ExplicitCrossProbeToSch(const TOOL_EVENT &aEvent)
Assign a netclass to a labelled net.
int ExportHyperlynx(const TOOL_EVENT &aEvent)
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 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 ZonePriorityLower(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)
int GenerateODBPPFiles(const TOOL_EVENT &aEvent)
int ToggleLockSelected(const TOOL_EVENT &aEvent)
Lock selected items.
int AutoTrackWidth(const TOOL_EVENT &aEvent)
int LockSelected(const TOOL_EVENT &aEvent)
Unlock selected items.
int PageSettings(const TOOL_EVENT &aEvent)
int ExportSpecctraDSN(const TOOL_EVENT &aEvent)
int FindByProperties(const TOOL_EVENT &aEvent)
int FindNext(const TOOL_EVENT &aEvent)
int ToggleLibraryTree(const TOOL_EVENT &aEvent)
int ExportGenCAD(const TOOL_EVENT &aEvent)
Export GenCAD 1.4 format.
int ViaSizeInc(const TOOL_EVENT &aEvent)
int New(const TOOL_EVENT &aEvent)
int OnAngleSnapModeChanged(const TOOL_EVENT &aEvent)
int ExportCmpFile(const TOOL_EVENT &aEvent)
int Find(const TOOL_EVENT &aEvent)
int GenFootprintsReport(const TOOL_EVENT &aEvent)
void doCrossProbePcbToSch(const TOOL_EVENT &aEvent, bool aForce)
int GenD356File(const TOOL_EVENT &aEvent)
int Plot(const TOOL_EVENT &aEvent)
int ExportIDF(const TOOL_EVENT &aEvent)
int TrackWidthDec(const TOOL_EVENT &aEvent)
int Revert(const TOOL_EVENT &aEvent)
int Search(const TOOL_EVENT &aEvent)
int GenIPC2581File(const TOOL_EVENT &aEvent)
int ExportVRML(const TOOL_EVENT &aEvent)
int Open(const TOOL_EVENT &aEvent)
int SaveCopy(const TOOL_EVENT &aEvent)
int ChangeLineMode(const TOOL_EVENT &aEvent)
int GeneratePosFile(const TOOL_EVENT &aEvent)
int EditFpInFpEditor(const TOOL_EVENT &aEvent)
Notify Eeschema about selected items.
int ZonePriorityMoveToBottom(const TOOL_EVENT &aEvent)
int GenerateGerbers(const TOOL_EVENT &aEvent)
int ToggleProperties(const TOOL_EVENT &aEvent)
int OpenNonKicadBoard(const TOOL_EVENT &aEvent)
int ExportSTEP(const TOOL_EVENT &aEvent)
A base class for most all the KiCad significant classes used in schematics and boards.
Definition eda_item.h:96
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition view.h:63
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
The main frame for Pcbnew.
PCB_TOOL_BASE(TOOL_ID aId, const std::string &aName)
Constructor.
RESET_REASON
Determine the reason of reset for a tool.
Definition tool_base.h:74
Generic, UI-independent tool event.
Definition tool_event.h:167
void Reset() override
The Cairo implementation of the graphics abstraction layer.
Definition eda_group.h:29
VECTOR2< double > VECTOR2D
Definition vector2d.h:682