KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pl_editor_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) 2013 CERN
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 * @author Jean-Pierre Charras, jp.charras at wanadoo.fr
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 _PL_EDITOR_FRAME_H
27#define _PL_EDITOR_FRAME_H
28
29
30#include <eda_draw_frame.h>
31#include <base_screen.h>
32#include "pl_editor_layout.h"
33#include "pl_draw_panel_gal.h"
34
35#include <memory>
36
39class DS_DATA_ITEM;
40class wxChoice;
41
42#ifndef __linux__
44#else
45class SPNAV_2D_PLUGIN;
46#endif
47
52{
53public:
54 PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent );
56
58
63
64 bool OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl ) override;
65
71 bool LoadDrawingSheetFile( const wxString& aFullFileName );
72
78 bool SaveDrawingSheetFile( const wxString& aFullFileName );
79
85 bool InsertDrawingSheetFile( const wxString& aFullFileName );
86
92 bool IsContentModified() const override;
93
97 void OnExit( wxCommandEvent& aEvent );
98
99 bool canCloseWindow( wxCloseEvent& aCloseEvent ) override;
100 void doCloseWindow() override;
101
102 // The Tool Framework initialization
103 void setupTools();
104
105 void UpdateToolbarControlSizes() override;
106
107 void SetPageSettings(const PAGE_INFO&) override;
108 const PAGE_INFO& GetPageSettings () const override;
109 const VECTOR2I GetPageSizeIU() const override;
110
111 PL_DRAW_PANEL_GAL* GetCanvas() const override;
112 SELECTION& GetCurrentSelection() override;
113
114 const VECTOR2I& GetGridOrigin() const override { return m_grid_origin; }
115 void SetGridOrigin( const VECTOR2I& aPoint ) override { m_grid_origin = aPoint; }
116
122
123 const TITLE_BLOCK& GetTitleBlock() const override;
124 void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) override;
125
126 void CommonSettingsChanged( int aFlags ) override;
127
128 void DisplayGridMsg() override;
129
130 void UpdateStatusBar() override;
131
135 void OnNewDrawingSheet();
136
137 const PL_EDITOR_LAYOUT& GetPageLayout() const { return m_pageLayout; }
139
140 const BOX2I GetDocumentExtents( bool aIncludeAllVisible = true ) const override;
141
150 bool GetPageNumberOption() const;
151
155 void UpdateTitleAndInfo();
156
160 void UpdateMsgPanelInfo();
161
162 void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
163
164 void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
165
166 void OnSelectPage( wxCommandEvent& event );
167
172 void OnSelectCoordOriginCorner( wxCommandEvent& event );
173
177 void ToPrinter( bool doPreview );
178
179 void Files_io( wxCommandEvent& event );
180
181 void OnFileHistory( wxCommandEvent& event );
182 void OnClearFileHistory( wxCommandEvent& aEvent );
183
189 wxString GetCurrentFileName() const override;
190
194 void SetCurrentFileName( const wxString& aName );
195
199 void HardRedraw() override;
200
209 DS_DATA_ITEM* AddDrawingSheetItem( int aType );
210
214 void OnModify() override;
215
219 void SaveCopyInUndoList();
220
227
234
239 void RollbackFromUndo();
240
241 void ClearUndoORRedoList( UNDO_REDO_LIST whichList, int aItemCount = -1 ) override;
242
243protected:
245
246 void configureToolbars() override;
247
248 void setupUIConditions() override;
249
250 void doReCreateMenuBar() override;
251
252 void DoWithAcceptedFiles() override;
253
255
256private:
257 void handleActivateEvent( wxActivateEvent& aEvent ) override;
258 void handleIconizeEvent( wxIconizeEvent& aEvent ) override;
259
260protected:
263
264private:
266
267 int m_propertiesFrameWidth; // last width (in pixels) of m_propertiesPagelayout
268
269 wxChoice* m_originSelectBox; // Corner origin choice for coordinates
270 int m_originSelectChoice; // the last choice for m_originSelectBox
271 wxChoice* m_pageSelectBox; // The page number sel'ector (page 1 or other pages
272 // useful when there are some items which are
273 wxString m_mruImagePath; // Most recently used path for placing a new image
274 // only on page 1, not on page 1
276
277#ifndef __linux__
278 std::unique_ptr<NL_PL_EDITOR_PLUGIN> m_spaceMouse;
279#else
280 std::unique_ptr<SPNAV_2D_PLUGIN> m_spaceMouse;
281#endif
282
283 wxString m_originChoiceList[5] =
284 {
285 _("Left Top paper corner"),
286 _("Right Bottom page corner"),
287 _("Left Bottom page corner"),
288 _("Right Top page corner"),
289 _("Left Top page corner")
290 };
291};
292
293#endif /* _PL_EDITOR_FRAME_H */
BASE_SCREEN class implementation.
BOX2< VECTOR2I > BOX2I
Definition box2.h:922
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Drawing sheet structure type definitions.
UNDO_REDO_LIST
Specify whether we are interacting with the undo or redo stacks.
EDA_DRAW_FRAME(KIWAY *aKiway, wxWindow *aParent, FRAME_T aFrameType, const wxString &aTitle, const wxPoint &aPos, const wxSize &aSize, long aStyle, const wxString &aFrameName, const EDA_IU_SCALE &aIuScale)
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition kiway.h:286
The class that implements the public interface to the SpaceMouse plug-in.
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition page_info.h:79
void ShowDesignInspector()
Show the dialog displaying the list of DS_DATA_ITEM items in the page layout.
bool OpenProjectFiles(const std::vector< wxString > &aFileSet, int aCtl) override
Open a project or set of files given by aFileList.
void OnNewDrawingSheet()
Must be called to initialize parameters when a new drawing sheet is loaded.
std::unique_ptr< NL_PL_EDITOR_PLUGIN > m_spaceMouse
void OnModify() override
Must be called after a change in order to set the "modify" flag.
void SetCurrentFileName(const wxString &aName)
Store the current layout description file filename.
bool IsContentModified() const override
Get if the drawing sheet has been modified but not saved.
void Files_io(wxCommandEvent &event)
void GetLayoutFromRedoList()
Redo the last edit:
PL_EDITOR_LAYOUT & GetPageLayout()
void configureToolbars() override
void ToPrinter(bool doPreview)
Open a dialog frame to print layers.
PL_EDITOR_FRAME(KIWAY *aKiway, wxWindow *aParent)
void UpdateMsgPanelInfo()
Display the size of the sheet to the message panel.
const BOX2I GetDocumentExtents(bool aIncludeAllVisible=true) const override
Return bounding box of document with option to not include some items.
void doCloseWindow() override
VECTOR2I ReturnCoordOriginCorner() const
Calculate the position (in page, in iu) of the corner used as coordinate origin of items.
void OnClearFileHistory(wxCommandEvent &aEvent)
void SetPageSettings(const PAGE_INFO &) override
DS_DATA_ITEM * AddDrawingSheetItem(int aType)
Add a new item to the drawing sheet item list.
wxString GetCurrentFileName() const override
void GetLayoutFromUndoList()
Undo the last edit:
void doReCreateMenuBar() override
bool canCloseWindow(wxCloseEvent &aCloseEvent) override
void OnFileHistory(wxCommandEvent &event)
void UpdateStatusBar() override
Update the status bar information.
void SetGridOrigin(const VECTOR2I &aPoint) override
void OnSelectPage(wxCommandEvent &event)
void RollbackFromUndo()
Apply the last command in Undo List without stacking a Redo.
const TITLE_BLOCK & GetTitleBlock() const override
void DoWithAcceptedFiles() override
Execute action on accepted dropped file.
void UpdateTitleAndInfo()
Display the short filename (if exists) loaded file on the caption of the main window.
const VECTOR2I GetPageSizeIU() const override
Works off of GetPageSettings() to return the size of the paper page in the internal units of this par...
void OnSelectCoordOriginCorner(wxCommandEvent &event)
Called when the user select one of the 4 page corner as corner reference (or the left top paper corne...
void handleActivateEvent(wxActivateEvent &aEvent) override
Handle a window activation event.
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
bool SaveDrawingSheetFile(const wxString &aFullFileName)
Save the current layout in a .kicad_wks drawing sheet file.
SELECTION & GetCurrentSelection() override
Get the current selection from the canvas area.
PL_EDITOR_LAYOUT m_pageLayout
bool InsertDrawingSheetFile(const wxString &aFullFileName)
Load a .kicad_wks drawing sheet file, and add items to the current layout list.
void SaveCopyInUndoList()
Save a copy of the description (in a S expr string) for Undo/redo commands.
bool GetPageNumberOption() const
Drawing sheet editor can show the title block using a page number 1 or another number.
void UpdateToolbarControlSizes() override
Update the sizes of any controls in the toolbars of the frame.
void CommonSettingsChanged(int aFlags) override
Notification event that some of the common (suite-wide) settings have changed.
void handleIconizeEvent(wxIconizeEvent &aEvent) override
Handle a window iconize event.
void HardRedraw() override
Refresh the library tree and redraw the window.
void DisplayGridMsg() override
Display current grid size in the status bar.
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
PROPERTIES_FRAME * GetPropertiesFrame()
wxChoice * m_originSelectBox
const PAGE_INFO & GetPageSettings() const override
const PL_EDITOR_LAYOUT & GetPageLayout() const
void setupUIConditions() override
Setup the UI conditions for the various actions and their controls in this frame.
wxString m_originChoiceList[5]
PROPERTIES_FRAME * m_propertiesPagelayout
The last filename chosen to be proposed to the user.
wxChoice * m_pageSelectBox
PL_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void ClearUndoORRedoList(UNDO_REDO_LIST whichList, int aItemCount=-1) override
Remove the aItemCount of old commands from aList and delete commands, pickers and picked items if nee...
const VECTOR2I & GetGridOrigin() const override
Return the absolute coordinates of the origin of the snap grid.
void SetTitleBlock(const TITLE_BLOCK &aTitleBlock) override
void OnExit(wxCommandEvent &aEvent)
Event handler for the wxID_EXIT and wxID_CLOSE events.
bool LoadDrawingSheetFile(const wxString &aFullFileName)
Load a .kicad_wks drawing sheet file.
PROPERTIES_FRAME display properties of the current item.
Hold the information shown in the lower right corner of a plot, printout, or editing view.
Definition title_block.h:41
#define _(s)
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:695