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  * @author Maciej Suminski <maciej.suminski@cern.ch>
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
25 #ifndef BASE_EDIT_FRAME_H
26 #define BASE_EDIT_FRAME_H
27 
28 #include <pcb_base_frame.h>
29 
31 class PCB_LAYER_WIDGET;
33 
38 {
39 public:
40  PCB_BASE_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
41  const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
42  long aStyle, const wxString& aFrameName );
43 
44  virtual ~PCB_BASE_EDIT_FRAME();
45 
46  void OnCloseWindow( wxCloseEvent& aEvent ) override;
47 
59  wxString CreateNewLibrary( const wxString& aLibName = wxEmptyString,
60  const wxString& aProposedName = wxEmptyString );
61 
68  bool AddLibrary(const wxString& aLibName = wxEmptyString);
69 
76  virtual void OnEditItemRequest( BOARD_ITEM* aItem ) = 0;
77 
78  // Undo buffer handling
79 
89  void SaveCopyInUndoList( BOARD_ITEM* aItemToCopy, UNDO_REDO_T aTypeCommand,
90  const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) override;
91 
101  void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList, UNDO_REDO_T aTypeCommand,
102  const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) override;
103 
111  void RestoreCopyFromRedoList( wxCommandEvent& aEvent );
112 
120  void RestoreCopyFromUndoList( wxCommandEvent& aEvent );
121 
126  void RollbackFromUndo();
127 
138  bool aRedoCommand,
139  bool aRebuildRatsnet = true );
140 
145  bool UndoRedoBlocked() const
146  {
147  return m_undoRedoBlocked;
148  }
149 
154  void UndoRedoBlock( bool aBlock = true )
155  {
156  m_undoRedoBlocked = aBlock;
157  }
158 
166  void SetGridVisibility( bool aVisible ) override;
167 
172  int GetRotationAngle() const { return m_rotationAngle; }
173 
178  void SetRotationAngle( int aRotationAngle );
179 
180  void InstallTextOptionsFrame( BOARD_ITEM* aText );
182 
184  void ActivateGalCanvas() override;
185 
187  virtual void SetBoard( BOARD* aBoard ) override;
188 
189  COLOR_SETTINGS* GetColorSettings() override;
190 
191  /* full undo redo management : */
192 
193  // use EDA_BASE_FRAME::ClearUndoRedoList()
194  // use EDA_BASE_FRAME::PushCommandToUndoList( PICKED_ITEMS_LIST* aItem )
195  // use EDA_BASE_FRAME::PushCommandToRedoList( PICKED_ITEMS_LIST* aItem )
196 
209  void ClearUndoORRedoList( UNDO_REDO_LIST whichList, int aItemCount = -1 ) override;
210 
211 protected:
214 
217 
218  void unitsChangeRefresh() override;
219 
222 
225 };
226 
227 #endif
void RollbackFromUndo()
Performs an undo of the last edit WITHOUT logging a corresponding redo.
Definition: undo_redo.cpp:622
void RestoreCopyFromUndoList(wxCommandEvent &aEvent)
Function RestoreCopyFromUndoList Undo the last edit:
Definition: undo_redo.cpp:334
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 ActivateGalCanvas() override
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
PCB_LAYER_WIDGET is here to implement the abstract functions of LAYER_WIDGET so they may be tied into...
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
UNDO_REDO_T
Undo Redo considerations: Basically we have 3 cases New item Deleted item Modified item there is also...
virtual void OnEditItemRequest(BOARD_ITEM *aItem)=0
Function OnEditItemRequest Install the corresponding dialog editor for the given item.
void InstallGraphicItemPropertiesDialog(BOARD_ITEM *aItem)
void UndoRedoBlock(bool aBlock=true)
Function UndoRedoBlock Enables/disable undo and redo operations.
void InstallTextOptionsFrame(BOARD_ITEM *aText)
Routine for main window class to launch text properties dialog.
bool m_undoRedoBlocked
Is undo/redo operation currently blocked?
void unitsChangeRefresh() override
Called when when the units setting has changed to allow for any derived classes to handle refreshing ...
Classes used in Pcbnew, CvPcb and GerbView.
void OnCloseWindow(wxCloseEvent &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:392
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:597
bool AddLibrary(const wxString &aLibName=wxEmptyString)
Function AddLibrary Add an existing library to either the global or project library table.
PCB_LAYER_WIDGET * m_Layers
Layer manager. It is the responsibility of the child frames to instantiate this.
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.
void SaveCopyInUndoList(BOARD_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, const wxPoint &aTransformPoint=wxPoint(0, 0)) override
Function SaveCopyInUndoList Creates a new entry in undo list of commands.
Definition: undo_redo.cpp:184
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).
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.
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:184
virtual void SetBoard(BOARD *aBoard) override
void RestoreCopyFromRedoList(wxCommandEvent &aEvent)
Function RestoreCopyFromRedoList Redo the last edit:
Definition: undo_redo.cpp:363
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.