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 
36 {
37 public:
38  PCB_BASE_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
39  const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
40  long aStyle, const wxString& aFrameName );
41 
42  virtual ~PCB_BASE_EDIT_FRAME();
43 
48  virtual BOARD_ITEM_CONTAINER* GetModel() const = 0;
49 
61  wxString CreateNewLibrary(const wxString& aLibName = wxEmptyString);
62 
69  bool AddLibrary(const wxString& aLibName = wxEmptyString);
70 
77  virtual void OnEditItemRequest( wxDC* aDC, BOARD_ITEM* aItem ) = 0;
78 
79  // Undo buffer handling
80 
90  void SaveCopyInUndoList( BOARD_ITEM* aItemToCopy, UNDO_REDO_T aTypeCommand,
91  const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) override;
92 
102  void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList, UNDO_REDO_T aTypeCommand,
103  const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) override;
104 
112  void RestoreCopyFromRedoList( wxCommandEvent& aEvent );
113 
121  void RestoreCopyFromUndoList( wxCommandEvent& aEvent );
122 
134  bool aRedoCommand,
135  bool aRebuildRatsnet = true );
136 
141  bool UndoRedoBlocked() const
142  {
143  return m_undoRedoBlocked;
144  }
145 
150  void UndoRedoBlock( bool aBlock = true )
151  {
152  m_undoRedoBlocked = aBlock;
153  }
154 
159  int GetRotationAngle() const { return m_rotationAngle; }
160 
165  void SetRotationAngle( int aRotationAngle );
166 
167  void InstallTextOptionsFrame( BOARD_ITEM* aText, wxDC* aDC );
169 
171  void UseGalCanvas( bool aEnable ) override;
172 
174  virtual void SetBoard( BOARD* aBoard ) override;
175 
176  void OnGridSettings( wxCommandEvent& aEvent ) override;
177  bool InvokeDialogGrid();
178 
179 protected:
182 
185 
192  void createArray();
193 
203  void duplicateItem( BOARD_ITEM* aItem, bool aIncrement );
204 
215  virtual void duplicateItems( bool aIncrement ) = 0;
216 
217  void unitsChangeRefresh() override;
218 };
219 
220 #endif
void RestoreCopyFromUndoList(wxCommandEvent &aEvent)
Function RestoreCopyFromUndoList Undo the last edit:
Definition: undo_redo.cpp:346
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)
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
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(wxDC *aDC, BOARD_ITEM *aItem)=0
Function OnEditItemRequest Install the corresponding dialog editor for the given item.
UNDO_REDO_T
Undo Redo considerations: Basically we have 3 cases New item Deleted item Modified item there is also...
void InstallGraphicItemPropertiesDialog(BOARD_ITEM *aItem)
void duplicateItem(BOARD_ITEM *aItem, bool aIncrement)
Function duplicateItem Duplicate the specified item This function is shared between pcbnew and modedi...
Definition: edit.cpp:1560
void UndoRedoBlock(bool aBlock=true)
Function UndoRedoBlock Enables/disable undo and redo operations.
bool m_undoRedoBlocked
Is undo/redo operation currently blocked?
void InstallTextOptionsFrame(BOARD_ITEM *aText, wxDC *aDC)
Routine for main window class to launch text properties dialog.
void unitsChangeRefresh() override
Called when when the units setting has changed to allow for any derived classes to handle refreshing ...
void UseGalCanvas(bool aEnable) override
Classes used in Pcbnew, CvPcb and GerbView.
virtual void duplicateItems(bool aIncrement)=0
Function duplicateItems Find and duplicate the currently selected items.
void PutDataInPreviousState(PICKED_ITEMS_LIST *aList, bool aRedoCommand, bool aRebuildRatsnet=true)
Function PutDataInPreviousState Used in undo or redo command.
Definition: undo_redo.cpp:404
bool AddLibrary(const wxString &aLibName=wxEmptyString)
Function AddLibrary Add an existing library to either the global or project library table.
Class KIWAY is a minimalistic software bus for communications between various DLLs/DSOs (DSOs) within...
Definition: kiway.h:258
void createArray()
Function createArray Create an array of the selected item (invokes the dialogue) This function is sha...
Definition: edit.cpp:1644
Class 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:198
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).
wxString CreateNewLibrary(const wxString &aLibName=wxEmptyString)
Function CreateNewLibrary If a library name is given, creates a new footprint library in the project ...
int GetRotationAngle() const
Function GetRotationAngle() Returns the angle used for rotate operations.
Common, abstract interface for edit frames.
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:170
virtual void SetBoard(BOARD *aBoard) override
void RestoreCopyFromRedoList(wxCommandEvent &aEvent)
Function RestoreCopyFromRedoList Redo the last edit:
Definition: undo_redo.cpp:375
virtual BOARD_ITEM_CONTAINER * GetModel() const =0
Function GetModel()
void OnGridSettings(wxCommandEvent &aEvent) override
Abstract interface for BOARD_ITEMs capable of storing other items inside.
void SetRotationAngle(int aRotationAngle)
Function SetRotationAngle() Sets the angle used for rotate operations.
class PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.