KiCad PCB EDA Suite
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 (C) 2020-2021 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 BASE_EDIT_FRAME_H
28#define BASE_EDIT_FRAME_H
29
30#include <pcb_base_frame.h>
31
36
41{
42public:
43 PCB_BASE_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
44 const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
45 long aStyle, const wxString& aFrameName );
46
47 virtual ~PCB_BASE_EDIT_FRAME();
48
49 bool TryBefore( wxEvent& aEvent ) override;
50
51 void doCloseWindow() override;
52
64 wxString CreateNewLibrary( const wxString& aLibName = wxEmptyString,
65 const wxString& aProposedName = wxEmptyString );
66
67 wxString CreateNewProjectLibrary( const wxString& aLibName = wxEmptyString,
68 const wxString& aProposedName = wxEmptyString );
69
76 bool AddLibrary( const wxString& aLibName = wxEmptyString, FP_LIB_TABLE* aTable = nullptr );
77
84 virtual void OnEditItemRequest( BOARD_ITEM* aItem ) = 0;
85
94 void SaveCopyInUndoList( EDA_ITEM* aItemToCopy, UNDO_REDO aTypeCommand ) override;
95
104 void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList, UNDO_REDO aCommandType ) override;
105
109 void AppendCopyToUndoList( const PICKED_ITEMS_LIST& aItemsList,
110 UNDO_REDO aCommandType ) override;
111
117 void RestoreCopyFromRedoList( wxCommandEvent& aEvent );
118
124 void RestoreCopyFromUndoList( wxCommandEvent& aEvent );
125
130 void RollbackFromUndo();
131
140
144 bool UndoRedoBlocked() const
145 {
146 return m_undoRedoBlocked;
147 }
148
152 void UndoRedoBlock( bool aBlock = true )
153 {
154 m_undoRedoBlocked = aBlock;
155 }
156
162 void SetGridVisibility( bool aVisible ) override;
163
164 void SetObjectVisible( GAL_LAYER_ID aLayer, bool aVisible = true );
165
169 virtual EDA_ANGLE GetRotationAngle() const;
170
174 //void SetRotationAngle( EDA_ANGLE aRotationAngle );
175
176 void ShowBitmapPropertiesDialog( BOARD_ITEM* aBitmap );
180
182 void ActivateGalCanvas() override;
183
185 virtual void SetBoard( BOARD* aBoard, PROGRESS_REPORTER* aReporter = nullptr ) override;
186
187 COLOR_SETTINGS* GetColorSettings( bool aForceRefresh = false ) const override;
188
189 /* full undo redo management : */
190
191 // use EDA_BASE_FRAME::ClearUndoRedoList()
192 // use EDA_BASE_FRAME::PushCommandToUndoList( PICKED_ITEMS_LIST* aItem )
193 // use EDA_BASE_FRAME::PushCommandToRedoList( PICKED_ITEMS_LIST* aItem )
194
206 void ClearUndoORRedoList( UNDO_REDO_LIST whichList, int aItemCount = -1 ) override;
207
209
216 wxString GetDesignRulesPath();
217
219
221
222 void UpdateProperties();
223
224protected:
230 FP_LIB_TABLE* selectLibTable( bool aOptional = false );
231
236 wxString createNewLibrary( const wxString& aLibName, const wxString& aProposedName,
237 FP_LIB_TABLE* aTable );
238
239 void handleActivateEvent( wxActivateEvent& aEvent ) override;
240
241 void saveCopyInUndoList( PICKED_ITEMS_LIST* commandToUndo, const PICKED_ITEMS_LIST& aItemsList,
242 UNDO_REDO aCommandType );
243
244 void unitsChangeRefresh() override;
245
246 virtual void onDarkModeToggle();
247
248protected:
250
254
255 wxAuiNotebook* m_tabbedPanel;
256
258};
259
260#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:58
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:265
Color settings are a bit different than most of the settings objects in that there can be more than o...
UNDO_REDO_LIST
Specifies whether we are interacting with the undo or redo stacks.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition: kiway.h:273
Common, abstract interface for edit frames.
int ShowTextBoxPropertiesDialog(BOARD_ITEM *aText)
bool AddLibrary(const wxString &aLibName=wxEmptyString, FP_LIB_TABLE *aTable=nullptr)
Add an existing library to either the global or project library table.
void ClearUndoORRedoList(UNDO_REDO_LIST whichList, int aItemCount=-1) override
Free the undo or redo list from List element.
Definition: undo_redo.cpp:563
COLOR_SETTINGS * GetColorSettings(bool aForceRefresh=false) const override
Helper to retrieve the current color settings.
void RestoreCopyFromUndoList(wxCommandEvent &aEvent)
Undo the last edit:
Definition: undo_redo.cpp:313
wxString GetDesignRulesPath()
Return the absolute path to the design rules file for the currently-loaded board.
void saveCopyInUndoList(PICKED_ITEMS_LIST *commandToUndo, const PICKED_ITEMS_LIST &aItemsList, UNDO_REDO aCommandType)
Definition: undo_redo.cpp:155
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.
Definition: undo_redo.cpp:301
bool m_darkMode
Panel with Layers and Object Inspector tabs.
wxString CreateNewLibrary(const wxString &aLibName=wxEmptyString, const wxString &aProposedName=wxEmptyString)
If a library name is given, creates a new footprint library in the project folder with the given name...
void doCloseWindow() override
void SaveCopyInUndoList(EDA_ITEM *aItemToCopy, UNDO_REDO aTypeCommand) override
Create a new entry in undo list of commands.
Definition: undo_redo.cpp:282
void ClearListAndDeleteItems(PICKED_ITEMS_LIST *aList)
Definition: undo_redo.cpp:587
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.
virtual void OnEditItemRequest(BOARD_ITEM *aItem)=0
Install the corresponding dialog editor for the given item.
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.
Definition: undo_redo.cpp:597
bool TryBefore(wxEvent &aEvent) override
bool UndoRedoBlocked() const
Check if the undo and redo operations are currently blocked.
void ShowGraphicItemPropertiesDialog(BOARD_ITEM *aItem)
PROPERTIES_PANEL * GetPropertiesPanel()
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.
APPEARANCE_CONTROLS * GetAppearancePanel()
void PutDataInPreviousState(PICKED_ITEMS_LIST *aList)
Used in undo or redo command.
Definition: undo_redo.cpp:373
wxString createNewLibrary(const wxString &aLibName, const wxString &aProposedName, FP_LIB_TABLE *aTable)
Create a new library in the given table (presumed to be either the global or project library table).
void RestoreCopyFromRedoList(wxCommandEvent &aEvent)
Redo the last edit:
Definition: undo_redo.cpp:343
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)
APPEARANCE_CONTROLS * m_appearancePanel
wxAuiNotebook * m_tabbedPanel
void SetObjectVisible(GAL_LAYER_ID aLayer, bool aVisible=true)
PANEL_SELECTION_FILTER * m_selectionFilterPanel
wxString CreateNewProjectLibrary(const wxString &aLibName=wxEmptyString, const wxString &aProposedName=wxEmptyString)
FP_LIB_TABLE * selectLibTable(bool aOptional=false)
Prompts a user to select global or project library tables.
void handleActivateEvent(wxActivateEvent &aEvent) override
Handle a window activation event.
void ShowBitmapPropertiesDialog(BOARD_ITEM *aBitmap)
Set the angle used for rotate operations.
PROPERTIES_PANEL * m_propertiesPanel
void UndoRedoBlock(bool aBlock=true)
Enable/disable undo and redo operations.
void ShowTextPropertiesDialog(BOARD_ITEM *aText)
virtual void onDarkModeToggle()
void ActivateGalCanvas() override
Set the #m_Pcb member in such as way as to ensure deleting any previous BOARD.
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
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:33
GAL_LAYER_ID
GAL layers are "virtual" layers, i.e.
Definition: layer_ids.h:190
UNDO_REDO
Undo Redo considerations: Basically we have 3 cases New item Deleted item Modified item there is also...