KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcb_base_edit_frame.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 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 BASE_EDIT_FRAME_H
24#define BASE_EDIT_FRAME_H
25
26#include <pcb_base_frame.h>
28
33class PCB_TEXTBOX;
34class PCB_TABLE;
35class PCB_TEXT;
36class PCB_SHAPE;
39class PCB_BARCODE;
40class PCB_GRID_ITEM;
42
47{
48public:
49 PCB_BASE_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
50 const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
51 long aStyle, const wxString& aFrameName );
52
53 virtual ~PCB_BASE_EDIT_FRAME();
54
55 bool TryBefore( wxEvent& aEvent ) override;
56
57 void doCloseWindow() override;
58
71 wxString CreateNewLibrary( const wxString& aDialogTitle, const wxString& aInitialPath = wxEmptyString );
72
73 wxString CreateNewProjectLibrary( const wxString& aDialogTitle, const wxString& aLibName );
74
85 wxString SelectLibrary( const wxString& aDialogTitle, const wxString& aListLabel,
86 const std::vector<std::pair<wxString, bool*>>& aExtraCheckboxes = {} );
87
94 bool AddLibrary( const wxString& aDialogTitle, const wxString& aLibName = wxEmptyString,
95 std::optional<LIBRARY_TABLE_SCOPE> aScope = std::nullopt );
96
103 virtual void OnEditItemRequest( BOARD_ITEM* aItem ) {};
104
113 void SaveCopyInUndoList( EDA_ITEM* aItemToCopy, UNDO_REDO aTypeCommand ) override;
114
123 void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList, UNDO_REDO aCommandType ) override;
124
128 void AppendCopyToUndoList( const PICKED_ITEMS_LIST& aItemsList,
129 UNDO_REDO aCommandType ) override;
130
136 void RestoreCopyFromRedoList( wxCommandEvent& aEvent );
137
143 void RestoreCopyFromUndoList( wxCommandEvent& aEvent );
144
149 void RollbackFromUndo();
150
158 void PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRehatchShapes = true );
159
163 bool UndoRedoBlocked() const
164 {
165 return m_undoRedoBlocked;
166 }
167
171 void UndoRedoBlock( bool aBlock = true )
172 {
173 m_undoRedoBlocked = aBlock;
174 }
175
181 void SetGridVisibility( bool aVisible ) override;
182
183 void SetObjectVisible( GAL_LAYER_ID aLayer, bool aVisible = true );
184
188 virtual EDA_ANGLE GetRotationAngle() const;
189
192 void ShowTextPropertiesDialog( PCB_TEXT* aText );
196
197 void OpenVertexEditor( BOARD_ITEM* aItem );
198 void CloseVertexEditor();
201 static wxString VertexEditorPaneName();
202
203 wxAuiManager& GetAuiManager() { return m_auimgr; }
204
206 void ActivateGalCanvas() override;
207
209 virtual void SetBoard( BOARD* aBoard, PROGRESS_REPORTER* aReporter = nullptr ) override;
210
211 COLOR_SETTINGS* GetColorSettings( bool aForceRefresh = false ) const override;
212
213 /* full undo redo management : */
214
215 // use EDA_BASE_FRAME::ClearUndoRedoList()
216 // use EDA_BASE_FRAME::PushCommandToUndoList( PICKED_ITEMS_LIST* aItem )
217 // use EDA_BASE_FRAME::PushCommandToRedoList( PICKED_ITEMS_LIST* aItem )
218
230 void ClearUndoORRedoList( UNDO_REDO_LIST whichList, int aItemCount = -1 ) override;
231
233
235
240
241 void ToggleProperties() override;
242
243 void GetContextualTextVars( BOARD_ITEM* aSourceItem, const wxString& aCrossRef,
244 wxArrayString* aTokens );
245
247
248 void ClearToolbarControl( int aId ) override;
249
250protected:
251 void configureToolbars() override;
252
256 wxString createNewLibrary( const wxString& aDialogTitle, const wxString& aLibName,
257 const wxString& aInitialPath, std::optional<LIBRARY_TABLE_SCOPE> aScope = std::nullopt );
258
259 void handleActivateEvent( wxActivateEvent& aEvent ) override;
260
261 void saveCopyInUndoList( PICKED_ITEMS_LIST* commandToUndo, const PICKED_ITEMS_LIST& aItemsList,
262 UNDO_REDO aCommandType );
263
264 void unitsChangeRefresh() override;
265
266 void onDarkModeToggle( wxSysColourChangedEvent& aEvent );
267
268protected:
270
273 std::unique_ptr<LAYER_PAIR_SETTINGS> m_layerPairSettings;
274
276
277 PCB_LAYER_BOX_SELECTOR* m_SelLayerBox; // a combo box to display and select active layer
278
279 wxAuiNotebook* m_tabbedPanel;
280};
281
282#endif
Abstract interface for BOARD_ITEMs capable of storing other items inside.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition board_item.h:84
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:409
Color settings are a bit different than most of the settings objects in that there can be more than o...
UNDO_REDO_LIST
Specify whether we are interacting with the undo or redo stacks.
wxAuiManager m_auimgr
A base class for most all the KiCad significant classes used in schematics and boards.
Definition eda_item.h:98
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition kiway.h:340
Management class for layer pairs in a PCB.
Definition layer_pairs.h:43
LAYER_PAIR_SETTINGS * GetLayerPairSettings()
Acess to the layer pair settings controller of the board, if available.
void ClearUndoORRedoList(UNDO_REDO_LIST whichList, int aItemCount=-1) override
Free the undo or redo list from List element.
wxString CreateNewLibrary(const wxString &aDialogTitle, const wxString &aInitialPath=wxEmptyString)
If a library name is given, creates a new footprint library in the project folder with the given name...
COLOR_SETTINGS * GetColorSettings(bool aForceRefresh=false) const override
Helper to retrieve the current color settings.
void RestoreCopyFromUndoList(wxCommandEvent &aEvent)
Undo the last edit:
void saveCopyInUndoList(PICKED_ITEMS_LIST *commandToUndo, const PICKED_ITEMS_LIST &aItemsList, UNDO_REDO aCommandType)
void AppendCopyToUndoList(const PICKED_ITEMS_LIST &aItemsList, UNDO_REDO aCommandType) override
As SaveCopyInUndoList, but appends the changes to the last undo item on the stack.
virtual void OnEditItemRequest(BOARD_ITEM *aItem)
Install the corresponding dialog editor for the given item.
void SaveCopyInUndoList(EDA_ITEM *aItemToCopy, UNDO_REDO aTypeCommand) override
Create a new entry in undo list of commands.
void ClearListAndDeleteItems(PICKED_ITEMS_LIST *aList)
void SetGridVisibility(bool aVisible) override
Override this function in the PCB_BASE_EDIT_FRAME to refill the layer widget.
virtual EDA_ANGLE GetRotationAngle() const
Return the angle used for rotate operations.
int ShowTextBoxPropertiesDialog(PCB_TEXTBOX *aTextBox)
void unitsChangeRefresh() override
Called when when the units setting has changed to allow for any derived classes to handle refreshing ...
void RollbackFromUndo()
Perform an undo of the last edit without logging a corresponding redo.
void OpenVertexEditor(BOARD_ITEM *aItem)
bool TryBefore(wxEvent &aEvent) override
wxString SelectLibrary(const wxString &aDialogTitle, const wxString &aListLabel, const std::vector< std::pair< wxString, bool * > > &aExtraCheckboxes={})
Put up a dialog and allows the user to pick a library, for unspecified use.
bool UndoRedoBlocked() const
Check if the undo and redo operations are currently blocked.
static wxString VertexEditorPaneName()
PCB_LAYER_BOX_SELECTOR * m_SelLayerBox
virtual void SetBoard(BOARD *aBoard, PROGRESS_REPORTER *aReporter=nullptr) override
Set the #m_Pcb member in such as way as to ensure deleting any previous BOARD.
std::unique_ptr< LAYER_PAIR_SETTINGS > m_layerPairSettings
void ToggleProperties() override
APPEARANCE_CONTROLS * GetAppearancePanel()
void configureToolbars() override
void ClearToolbarControl(int aId) override
void RestoreCopyFromRedoList(wxCommandEvent &aEvent)
Redo the last edit:
wxAuiManager & GetAuiManager()
PCB_BASE_EDIT_FRAME(KIWAY *aKiway, wxWindow *aParent, FRAME_T aFrameType, const wxString &aTitle, const wxPoint &aPos, const wxSize &aSize, long aStyle, const wxString &aFrameName)
wxString createNewLibrary(const wxString &aDialogTitle, const wxString &aLibName, const wxString &aInitialPath, std::optional< LIBRARY_TABLE_SCOPE > aScope=std::nullopt)
Create a new library in the given table.
wxString CreateNewProjectLibrary(const wxString &aDialogTitle, const wxString &aLibName)
void HighlightSelectionFilter(const PCB_SELECTION_FILTER_OPTIONS &aOptions)
APPEARANCE_CONTROLS * m_appearancePanel
wxAuiNotebook * m_tabbedPanel
void SetObjectVisible(GAL_LAYER_ID aLayer, bool aVisible=true)
bool AddLibrary(const wxString &aDialogTitle, const wxString &aLibName=wxEmptyString, std::optional< LIBRARY_TABLE_SCOPE > aScope=std::nullopt)
Add an existing library to either the global or project library table.
void ShowReferenceImagePropertiesDialog(BOARD_ITEM *aBitmap)
PANEL_SELECTION_FILTER * m_selectionFilterPanel
void GetContextualTextVars(BOARD_ITEM *aSourceItem, const wxString &aCrossRef, wxArrayString *aTokens)
void ShowBarcodePropertiesDialog(PCB_BARCODE *aText)
void handleActivateEvent(wxActivateEvent &aEvent) override
Handle a window activation event.
PCB_VERTEX_EDITOR_PANE * m_vertexEditorPane
void ShowGridItemPropertiesDialog(PCB_GRID_ITEM *aGridItem)
void UpdateVertexEditorSelection(BOARD_ITEM *aItem)
void UndoRedoBlock(bool aBlock=true)
Enable/disable undo and redo operations.
void onDarkModeToggle(wxSysColourChangedEvent &aEvent)
void PutDataInPreviousState(PICKED_ITEMS_LIST *aList, bool aRehatchShapes=true)
Used in undo or redo command.
void ShowGraphicItemPropertiesDialog(PCB_SHAPE *aShape)
void ActivateGalCanvas() override
Set the #m_Pcb member in such as way as to ensure deleting any previous BOARD.
void OnVertexEditorPaneClosed(PCB_VERTEX_EDITOR_PANE *aPane)
PCB_BASE_FRAME(KIWAY *aKiway, wxWindow *aParent, FRAME_T aFrameType, const wxString &aTitle, const wxPoint &aPos, const wxSize &aSize, long aStyle, const wxString &aFrameName)
Class to display a pcb layer list in a wxBitmapComboBox.
A holder to handle information on schematic or board items.
A progress reporter interface for use in multi-threaded environments.
FRAME_T
The set of EDA_BASE_FRAME derivatives, typically stored in EDA_BASE_FRAME::m_Ident.
Definition frame_type.h:29
GAL_LAYER_ID
GAL layers are "virtual" layers, i.e.
Definition layer_ids.h:224
This file contains data structures that are saved in the project file or project local settings file ...
UNDO_REDO
Undo Redo considerations: Basically we have 3 cases New item Deleted item Modified item there is also...