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 KiCad Developers, see AUTHORS.txt for contributors.
6  * @author Maciej Suminski <maciej.suminski@cern.ch>
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, you may find one here:
20  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21  * or you may search the http://www.gnu.org website for the version 2 license,
22  * or you may write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24  */
25 
26 #ifndef BASE_EDIT_FRAME_H
27 #define BASE_EDIT_FRAME_H
28 
29 #include <pcb_base_frame.h>
30 
34 
39 {
40 public:
41  PCB_BASE_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
42  const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
43  long aStyle, const wxString& aFrameName );
44 
45  virtual ~PCB_BASE_EDIT_FRAME();
46 
47  bool TryBefore( wxEvent& aEvent ) override;
48 
49  void doCloseWindow() override;
50 
62  wxString CreateNewLibrary( const wxString& aLibName = wxEmptyString,
63  const wxString& aProposedName = wxEmptyString );
64 
71  bool AddLibrary(const wxString& aLibName = wxEmptyString);
72 
79  virtual void OnEditItemRequest( BOARD_ITEM* aItem ) = 0;
80 
81  // Undo buffer handling
82 
92  void SaveCopyInUndoList( EDA_ITEM* aItemToCopy, UNDO_REDO aTypeCommand,
93  const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) override;
94 
104  void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList, UNDO_REDO aTypeCommand,
105  const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) override;
106 
114  void RestoreCopyFromRedoList( wxCommandEvent& aEvent );
115 
123  void RestoreCopyFromUndoList( wxCommandEvent& aEvent );
124 
129  void RollbackFromUndo();
130 
141  bool aRedoCommand,
142  bool aRebuildRatsnet = true );
143 
148  bool UndoRedoBlocked() const
149  {
150  return m_undoRedoBlocked;
151  }
152 
157  void UndoRedoBlock( bool aBlock = true )
158  {
159  m_undoRedoBlocked = aBlock;
160  }
161 
169  void SetGridVisibility( bool aVisible ) override;
170 
171  void SetObjectVisible( GAL_LAYER_ID aLayer, bool aVisible = true );
172 
177  int GetRotationAngle() const { return m_rotationAngle; }
178 
183  void SetRotationAngle( int aRotationAngle );
184 
185  void ShowTextPropertiesDialog( BOARD_ITEM* aText );
187 
189  void ActivateGalCanvas() override;
190 
192  virtual void SetBoard( BOARD* aBoard ) override;
193 
194  COLOR_SETTINGS* GetColorSettings() override;
195 
196  /* full undo redo management : */
197 
198  // use EDA_BASE_FRAME::ClearUndoRedoList()
199  // use EDA_BASE_FRAME::PushCommandToUndoList( PICKED_ITEMS_LIST* aItem )
200  // use EDA_BASE_FRAME::PushCommandToRedoList( PICKED_ITEMS_LIST* aItem )
201 
214  void ClearUndoORRedoList( UNDO_REDO_LIST whichList, int aItemCount = -1 ) override;
215 
221  wxString GetDesignRulesPath();
222 
223 protected:
226 
229 
230  void unitsChangeRefresh() override;
231 
234 
237 };
238 
239 #endif
void RollbackFromUndo()
Performs an undo of the last edit WITHOUT logging a corresponding redo.
Definition: undo_redo.cpp:629
void RestoreCopyFromUndoList(wxCommandEvent &aEvent)
Function RestoreCopyFromUndoList Undo the last edit:
Definition: undo_redo.cpp:325
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)
void SetObjectVisible(GAL_LAYER_ID aLayer, bool aVisible=true)
void ActivateGalCanvas() override
wxString GetDesignRulesPath()
Returns the absolute path to the design rules file for the currently-loaded board.
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
Definition: board_item.h:86
APPEARANCE_CONTROLS * m_appearancePanel
AUI panel for controlling layer and object visibility and appearance.
FRAME_T
Enum FRAME_T is the set of EDA_BASE_FRAME derivatives, typically stored in EDA_BASE_FRAME::m_Ident.
Definition: frame_type.h:34
virtual void OnEditItemRequest(BOARD_ITEM *aItem)=0
Function OnEditItemRequest Install the corresponding dialog editor for the given item.
GAL_LAYER_ID
GAL layers are "virtual" layers, i.e.
void UndoRedoBlock(bool aBlock=true)
Function UndoRedoBlock Enables/disable undo and redo operations.
bool m_undoRedoBlocked
Is undo/redo operation currently blocked?
UNDO_REDO
Undo Redo considerations: Basically we have 3 cases New item Deleted item Modified item there is also...
void unitsChangeRefresh() override
Called when when the units setting has changed to allow for any derived classes to handle refreshing ...
void ShowTextPropertiesDialog(BOARD_ITEM *aText)
Routine for main window class to launch text properties dialog.
void doCloseWindow() override
Classes used in Pcbnew, CvPcb and GerbView.
bool TryBefore(wxEvent &aEvent) override
void PutDataInPreviousState(PICKED_ITEMS_LIST *aList, bool aRedoCommand, bool aRebuildRatsnet=true)
Function PutDataInPreviousState Used in undo or redo command.
Definition: undo_redo.cpp:383
COLOR_SETTINGS * GetColorSettings() override
Helper to retrieve the current color settings.
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 ClearUndoORRedoList(UNDO_REDO_LIST whichList, int aItemCount=-1) override
Function ClearUndoORRedoList free the undo or redo list from List element Wrappers are deleted.
Definition: undo_redo.cpp:604
bool AddLibrary(const wxString &aLibName=wxEmptyString)
Function AddLibrary Add an existing library to either the global or project library table.
KIWAY is a minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the s...
Definition: kiway.h:273
PICKED_ITEMS_LIST is a holder to handle information on schematic or board items.
bool UndoRedoBlocked() const
Function UndoRedoBlocked Checks if the undo and redo operations are currently blocked.
int m_rotationAngle
User defined rotation angle (in tenths of a degree).
UNDO_REDO_LIST
Function ClearUndoORRedoList (virtual).
void ShowGraphicItemPropertiesDialog(BOARD_ITEM *aItem)
int GetRotationAngle() const
Function GetRotationAngle() Returns the angle used for rotate operations.
void SetGridVisibility(bool aVisible) override
Function SetGridVisibility()
Common, abstract interface for edit frames.
PANEL_SELECTION_FILTER * m_selectionFilterPanel
AUI panel for changing the selection tool filter controls.
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:186
virtual void SetBoard(BOARD *aBoard) override
void RestoreCopyFromRedoList(wxCommandEvent &aEvent)
Function RestoreCopyFromRedoList Redo the last edit:
Definition: undo_redo.cpp:354
void SaveCopyInUndoList(EDA_ITEM *aItemToCopy, UNDO_REDO aTypeCommand, const wxPoint &aTransformPoint=wxPoint(0, 0)) override
Function SaveCopyInUndoList Creates a new entry in undo list of commands.
Definition: undo_redo.cpp:179
EDA_ITEM is a base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:148
Color settings are a bit different than most of the settings objects in that there can be more than o...
Abstract interface for BOARD_ITEMs capable of storing other items inside.
void SetRotationAngle(int aRotationAngle)
Function SetRotationAngle() Sets the angle used for rotate operations.
PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.