KiCad PCB EDA Suite
Loading...
Searching...
No Matches
eda_base_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) 2009-2015 Jean-Pierre Charras, jp.charras wanadoo.fr
5 * Copyright (C) 2011 Wayne Stambaugh <[email protected]>
6 * Copyright (C) 2023 CERN (www.cern.ch)
7 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
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, see <https://www.gnu.org/licenses/>.
21 */
22
27
28#ifndef EDA_BASE_FRAME_H_
29#define EDA_BASE_FRAME_H_
30
31
32#include <functional>
33#include <map>
34#include <optional>
35#include <string>
36#include <vector>
37
38#include <memory>
39#include <nlohmann/json_fwd.hpp>
40
41#include <wx/aui/aui.h>
42#include <wx/datetime.h>
43#include <layer_ids.h>
44#include <frame_type.h>
45#include <hotkeys_basic.h>
46#include <kiway_holder.h>
47#include <tool/tools_holder.h>
48#include <widgets/ui_common.h>
50#include <undo_redo_container.h>
51#include <units_provider.h>
52#include <origin_transforms.h>
53#include <ui_events.h>
54
55// Option for main frames
56#define KICAD_DEFAULT_DRAWFRAME_STYLE wxDEFAULT_FRAME_STYLE | wxWANTS_CHARS
57
58
59#define VIEWER3D_FRAMENAME wxT( "Viewer3DFrameName" )
60#define QUALIFIED_VIEWER3D_FRAMENAME( parent ) \
61 ( wxString( VIEWER3D_FRAMENAME ) + wxT( ":" ) + parent->GetName() )
62
63#define KICAD_MANAGER_FRAME_NAME wxT( "KicadFrame" )
64
65
66class wxChoice;
67class wxEvent;
68class wxFileName;
69class EDA_ITEM;
71class EDA_MSG_PANEL;
72class BASE_SCREEN;
73class PAGE_INFO;
74class PLOTTER;
75class TITLE_BLOCK;
76class MSG_PANEL_ITEM;
77class TOOL_MANAGER;
78class TOOL_DISPATCHER;
79class ACTIONS;
80class PAGED_DIALOG;
83class FILE_HISTORY;
85class SEARCH_STACK;
88struct WINDOW_SETTINGS;
89struct WINDOW_STATE;
90class ACTION_MENU;
91class ACTION_TOOLBAR;
95class WX_INFOBAR;
96
97using ACTION_TOOLBAR_CONTROL_FACTORY = std::function<void( ACTION_TOOLBAR* )>;
98
99#define DEFAULT_MAX_UNDO_ITEMS 0
100#define ABS_MAX_UNDO_ITEMS (INT_MAX / 2)
101
103typedef std::function< void( wxUpdateUIEvent& ) > UIUpdateHandler;
104
105
115class EDA_BASE_FRAME : public wxFrame, public TOOLS_HOLDER, public KIWAY_HOLDER,
116 public UNITS_PROVIDER
117{
118public:
127
128 EDA_BASE_FRAME( wxWindow* aParent, FRAME_T aFrameType, const wxString& aTitle,
129 const wxPoint& aPos, const wxSize& aSize, long aStyle,
130 const wxString& aFrameName, KIWAY* aKiway, const EDA_IU_SCALE& aIuScale );
131
133
136 static const wxString GitCommitPaneName() { return wxS( "GitCommitPane" ); }
137
138 void ChangeUserUnits( EDA_UNITS aUnits );
139
140 virtual void ToggleUserUnits() { }
141
146 {
147 return m_originTransforms;
148 }
149
150
152
153 virtual SEVERITY GetSeverity( int aErrorCode ) const { return RPT_SEVERITY_UNDEFINED; }
154
161 bool ProcessEvent( wxEvent& aEvent ) override;
162
170 virtual void OnCharHook( wxKeyEvent& aKeyEvent );
171
176 void OnMenuEvent( wxMenuEvent& event );
177
184 virtual void RegisterUIUpdateHandler( int aID, const ACTION_CONDITIONS& aConditions ) override;
185
191 virtual void UnregisterUIUpdateHandler( int aID ) override;
192
201 static void HandleUpdateUIEvent( wxUpdateUIEvent& aEvent, EDA_BASE_FRAME* aFrame,
202 ACTION_CONDITIONS& aCond );
203
204 virtual void OnMove( wxMoveEvent& aEvent )
205 {
206 aEvent.Skip();
207 }
208
209 virtual void OnSize( wxSizeEvent& aEvent );
210
215 void SelectToolbarAction( const TOOL_ACTION& aAction ) override;
216
217 void OnMaximize( wxMaximizeEvent& aEvent );
218
219 int GetAutoSaveInterval() const;
220
221 bool IsType( FRAME_T aType ) const { return m_ident == aType; }
222 FRAME_T GetFrameType() const { return m_ident; }
223
229 virtual const SEARCH_STACK& sys_search();
230
231 virtual wxString help_name();
232
233 // Event handlers for menu events generated by the macOS application menu
234 void OnKicadAbout( wxCommandEvent& event );
235 void OnPreferences( wxCommandEvent& event );
236
241 void ShowPreferences( const wxString& aStartPage, const wxString& aStartParentPage );
242
243 void PrintMsg( const wxString& text );
244
245 void CreateInfoBar();
246
247 void RestoreAuiLayout();
248
250
255
266 void ShowInfoBarError( const wxString& aErrorMsg, bool aShowCloseButton = false,
268
283 void ShowInfoBarError( const wxString& aErrorMsg, bool aShowCloseButton,
284 std::function<void(void)> aCallback );
285
295 void ShowInfoBarWarning( const wxString& aWarningMsg, bool aShowCloseButton = false );
296
306 void ShowInfoBarMsg( const wxString& aMsg, bool aShowCloseButton = false );
307
312 virtual APP_SETTINGS_BASE* config() const;
313
314 void LoadWindowState( const wxString& aFileName );
315
322 void LoadWindowSettings( const WINDOW_SETTINGS* aCfg );
323
331
338 virtual void LoadSettings( APP_SETTINGS_BASE* aCfg );
339
346 virtual void SaveSettings( APP_SETTINGS_BASE* aCfg );
347
356
360 virtual void LoadWindowState( const WINDOW_STATE& aState );
361
372 wxString ConfigBaseName() override
373 {
374 wxString baseCfgName = m_configName.IsEmpty() ? GetName() : m_configName;
375 return baseCfgName;
376 }
377
389 virtual void SaveProjectLocalSettings() {};
390
398 void ImportHotkeyConfigFromFile( std::map<std::string, TOOL_ACTION*> aActionMap,
399 const wxString& aDefaultShortname );
400
413 wxString GetFileFromHistory( int cmdId, const wxString& type,
414 FILE_HISTORY* aFileHistory = nullptr );
415
419 virtual void ClearFileHistory();
420
430 void UpdateFileHistory( const wxString& FullFileName, FILE_HISTORY* aFileHistory = nullptr );
431
438 {
439 return *m_fileHistory;
440 }
441
442 void SetMruPath( const wxString& aPath ) { m_mruPath = aPath; }
443
444 wxString GetMruPath() const { return m_mruPath; }
445
453 virtual wxString GetCurrentFileName() const { return wxEmptyString; }
454
455 virtual void RecreateToolbars();
456
461
465 virtual void UpdateToolbarControlSizes();
466
477 const ACTION_TOOLBAR_CONTROL_FACTORY& aControlFactory );
478
483
489 void ReCreateMenuBar();
490
494 void AddStandardHelpMenu( wxMenuBar* aMenuBar );
495
496 wxString GetRunMenuCommandDescription( const TOOL_ACTION& aAction );
497
513 bool IsWritable( const wxFileName& aFileName, bool aVerbose = true );
514
522 virtual void UpdateStatusBar() { }
523
527 void ShowChangedLanguage() override;
528
533 void CommonSettingsChanged( int aFlags ) override;
534
538 virtual void ThemeChanged();
539
543 virtual void ProjectChanged() {}
544
545 wxString GetAboutTitle() const { return wxGetTranslation( m_aboutTitle ); }
546
547 const wxString& GetUntranslatedAboutTitle() const { return m_aboutTitle; }
548
554 virtual bool IsContentModified() const;
555
564 wxSize GetWindowSize();
565
578 virtual void ClearUndoORRedoList( UNDO_REDO_LIST aList, int aItemCount = -1 )
579 { }
580
586 virtual void ClearUndoRedoList();
587
593 virtual void PushCommandToUndoList( PICKED_ITEMS_LIST* aItem );
594
600 virtual void PushCommandToRedoList( PICKED_ITEMS_LIST* aItem );
601
606
611
612 virtual int GetUndoCommandCount() const { return m_undoList.m_CommandsList.size(); }
613 virtual int GetRedoCommandCount() const { return m_redoList.m_CommandsList.size(); }
614
615 virtual wxString GetUndoActionDescription() const;
616 virtual wxString GetRedoActionDescription() const;
617
618 int GetMaxUndoItems() const { return m_undoRedoCountMax; }
619
624 virtual void OnModify();
625
626 bool IsClosing() const { return m_isClosing; }
627
628 bool NonUserClose( bool aForce )
629 {
630 m_isNonUserClose = true;
631 return Close( aForce );
632 }
633
634 virtual void ClearToolbarControl( int aId ) { }
635
639 virtual void HandleSystemColorChange();
640
647 virtual bool CanAcceptApiCommands() { return IsEnabled(); }
648
649protected:
651 static constexpr int KICAD_AUI_TB_STYLE = wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_PLAIN_BACKGROUND;
652
653 virtual void doReCreateMenuBar() {}
654
655 virtual void configureToolbars();
656
658 virtual void syncToolbarSelections() {}
659
663 void onAutoSaveTimer( wxTimerEvent& aEvent );
664
665
671 virtual void handleIconizeEvent( wxIconizeEvent& aEvent ) {}
672 void onIconize( wxIconizeEvent& aEvent );
673
679 virtual bool isAutoSaveRequired() const { return m_autoSaveRequired; }
680
686 virtual bool doAutoSave();
687
700 virtual bool canRunAutoSave() const { return true; }
701
718 void CheckForAutosaveFiles( const wxString& aProjectPath, const std::vector<wxString>& aExtensions );
719
720 virtual bool canCloseWindow( wxCloseEvent& aCloseEvent ) { return true; }
721 virtual void doCloseWindow() { }
722
723 void onSystemColorChange( wxSysColourChangedEvent& aEvent );
724
732 virtual void unitsChangeRefresh() { }
733
737 virtual void setupUIConditions();
738
745 void initExitKey();
746
748
755 virtual void saveProjectSettings() {}
756
763 virtual void OnDropFiles( wxDropFilesEvent& aEvent );
764
771 void AddMenuLanguageList( ACTION_MENU* aMasterMenu, TOOL_INTERACTIVE* aControlTool );
772
776 void OnLanguageSelectionEvent( wxCommandEvent& aEvent );
777
784 virtual void DoWithAcceptedFiles();
785 std::vector<wxFileName> m_AcceptedFiles;
786
787 DECLARE_EVENT_TABLE()
788
789private:
790 void onUpdateUI( wxUpdateUIEvent& aEvent );
791
802 void windowClosing( wxCloseEvent& event );
803
807 void commonInit( FRAME_T aFrameType );
808
809 wxWindow* findQuasiModalDialog();
810
818 virtual bool IsModal() const { return false; }
819
820#ifdef __WXMSW__
824 WXLRESULT MSWWindowProc( WXUINT message, WXWPARAM wParam, WXLPARAM lParam ) override;
825#endif
826
827 protected:
828 FRAME_T m_ident; // Id Type (pcb, schematic, library..)
829 wxPoint m_framePos;
833
834 // These contain the frame size and position for when it is not maximized
837
838 wxString m_aboutTitle; // Name of program displayed in About.
839
840 wxAuiManager m_auimgr;
841 wxString m_perspective; // wxAuiManager perspective.
842 std::unique_ptr<nlohmann::json> m_auiLayoutState;
843 WX_INFOBAR* m_infoBar; // Infobar for the frame
845 wxString m_configName; // Prefix used to identify some params (frame
846 // size) and to name some config files (legacy
847 // hotkey files)
849
850 FILE_HISTORY* m_fileHistory; // The frame's recently opened file list
856
857 // Wall-clock of the first autosave deferred by canRunAutoSave(), or an invalid time when no
858 // deferral is outstanding. Used to bound how long an interactive operation may starve the
859 // snapshot so a long routing session can't leave the document unsnapshotted forever.
861
862 int m_undoRedoCountMax; // undo/Redo command Max depth
863
864 UNDO_REDO_CONTAINER m_undoList; // Objects list for the undo command (old data)
865 UNDO_REDO_CONTAINER m_redoList; // Objects list for the redo command (old data)
866
867 wxString m_mruPath; // Most recently used path.
868
869 ORIGIN_TRANSFORMS m_originTransforms; // Default display origin transforms object.
870
872 std::map<int, UIUpdateHandler> m_uiUpdateMap;
873
876
880
885
888
892 std::map<const wxString, TOOL_ACTION*> m_acceptedExts;
893
894 // Toolbar Settings - this is not owned by the frame
896
897 // Toolbar UI elements
899 ACTION_TOOLBAR* m_tbTopAux; // Additional tools under main toolbar
900 ACTION_TOOLBAR* m_tbRight; // Drawing tools (typically on right edge of window)
901 ACTION_TOOLBAR* m_tbLeft; // Options (typically on left edge of window)
902
903 std::map<std::string, ACTION_TOOLBAR_CONTROL_FACTORY> m_toolbarControlFactories;
904};
905
906
928class EDA_PANE : public wxAuiPaneInfo
929{
930public:
932 {
933 Gripper( false );
934 CloseButton( false );
935 PaneBorder( false );
936 }
937
942 {
943 SetFlag( optionToolbar, true );
944 CaptionVisible( false );
945 TopDockable().BottomDockable();
946 DockFixed( true );
947 Movable( false );
948 Resizable( true ); // expand to fit available space
949 return *this;
950 }
951
956 {
957 SetFlag( optionToolbar, true );
958 CaptionVisible( false );
959 LeftDockable().RightDockable();
960 DockFixed( true );
961 Movable( false );
962 Resizable( true ); // expand to fit available space
963 return *this;
964 }
965
970 {
971 CaptionVisible( true );
972 PaneBorder( true );
973 return *this;
974 }
975
980 {
981 CaptionVisible( false );
982 Layer( 0 );
983 PaneBorder( true );
984 Resizable( true ); // expand to fit available space
985 return *this;
986 }
987
992 {
993 CaptionVisible( false );
994 BottomDockable( true );
995 DockFixed( true );
996 Movable( false );
997 Resizable( true ); // expand to fit available space
998 return *this;
999 }
1000};
1001
1002#endif // EDA_BASE_FRAME_H_
Gather all the actions that are shared by tools.
Definition actions.h:44
Define the structure of a menu based on ACTIONs.
Definition action_menu.h:43
Class to hold basic information about controls that can be added to the toolbars.
Define the structure of a toolbar with buttons that invoke ACTIONs.
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Handles how to draw a screen (a board, a schematic ...)
Definition base_screen.h:37
The base frame for deriving all KiCad main window classes.
void SelectToolbarAction(const TOOL_ACTION &aAction) override
Select the given action in the toolbar group which contains it, if any.
virtual wxString help_name()
virtual void saveProjectSettings()
Save any design-related project settings associated with this frame.
virtual bool doAutoSave()
This should be overridden by the derived class to handle the auto save feature.
void LoadWindowState(const wxString &aFileName)
FRAME_T GetFrameType() const
wxString ConfigBaseName() override
Get the configuration base name.
virtual void UnregisterUIUpdateHandler(int aID) override
Unregister a UI handler for a given ID that was registered using RegisterUIUpdateHandler.
virtual bool isAutoSaveRequired() const
Return the auto save status of the application.
virtual APP_SETTINGS_BASE * config() const
Return the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
virtual void handleIconizeEvent(wxIconizeEvent &aEvent)
Handle a window iconize event.
virtual void PushCommandToUndoList(PICKED_ITEMS_LIST *aItem)
Add a command to undo in the undo list.
void ShowPreferences(const wxString &aStartPage, const wxString &aStartParentPage)
Display the preferences and settings of all opened editors paged dialog, starting with a particular p...
void windowClosing(wxCloseEvent &event)
(with its unexpected name so it does not collide with the real OnWindowClose() function provided in d...
APPEARANCE_CONTROLS_3D * m_appearancePanel
virtual void OnCharHook(wxKeyEvent &aKeyEvent)
Capture the key event before it is sent to the GUI.
virtual int GetRedoCommandCount() const
bool NonUserClose(bool aForce)
virtual void ProjectChanged()
Notification event that the project has changed.
void CommonSettingsChanged(int aFlags) override
Notification event that some of the common (suite-wide) settings have changed.
UNDO_REDO_CONTAINER m_undoList
virtual void OnMove(wxMoveEvent &aEvent)
virtual WINDOW_SETTINGS * GetWindowSettings(APP_SETTINGS_BASE *aCfg)
Return a pointer to the window settings for this frame.
virtual void doCloseWindow()
const wxString & GetUntranslatedAboutTitle() const
virtual void UpdateStatusBar()
Update the status bar information.
void OnToolbarSizeChanged()
Update toolbars if desired toolbar icon changed.
void OnMenuEvent(wxMenuEvent &event)
The TOOL_DISPATCHER needs these to work around some issues in wxWidgets where the menu events aren't ...
virtual bool IsModal() const
Return true if the frame is shown in our modal mode and false if the frame is shown as an usual frame...
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
virtual void HandleSystemColorChange()
Update the UI in response to a change in the system colors.
virtual void syncToolbarSelections()
Called after the toolbars are rebuilt so a frame can select the group entries that reflect its saved ...
static const wxString GitCommitPaneName()
Named here rather than beside the editors' other panes, because the project manager docks this one to...
virtual void setupUIConditions()
Setup the UI conditions for the various actions and their controls in this frame.
bool m_isNonUserClose
Set by NonUserClose() to indicate that the user did not request the current close.
void CheckForAutosaveFiles(const wxString &aProjectPath, const std::vector< wxString > &aExtensions)
Check for autosave files newer than their source files for the given project.
virtual void ClearToolbarControl(int aId)
void LoadWindowSettings(const WINDOW_SETTINGS *aCfg)
Load window settings from the given settings object.
std::vector< wxFileName > m_AcceptedFiles
virtual SEVERITY GetSeverity(int aErrorCode) const
bool m_uiUpdateHandlerBound
True once the single wxID_ANY UPDATE_UI handler has been bound.
bool m_autoSavePermissionError
void OnKicadAbout(wxCommandEvent &event)
virtual void UpdateToolbarControlSizes()
Update the sizes of any controls in the toolbars of the frame.
virtual void ClearUndoRedoList()
Clear the undo and redo list using ClearUndoORRedoList()
SETTINGS_MANAGER * GetSettingsManager() const
virtual void DoWithAcceptedFiles()
Execute action on accepted dropped file.
UNDO_REDO_LIST
Specify whether we are interacting with the undo or redo stacks.
virtual void OnModify()
Must be called after a model change in order to set the "modify" flag and do other frame-specific pro...
wxWindow * findQuasiModalDialog()
wxString m_perspective
wxDateTime m_autoSaveDeferredSince
bool IsClosing() const
virtual void ClearUndoORRedoList(UNDO_REDO_LIST aList, int aItemCount=-1)
Remove the aItemCount of old commands from aList and delete commands, pickers and picked items if nee...
virtual void ThemeChanged()
Process light/dark theme change.
EDA_BASE_FRAME(wxWindow *aParent, FRAME_T aFrameType, const wxString &aTitle, const wxPoint &aPos, const wxSize &aSize, long aStyle, const wxString &aFrameName, KIWAY *aKiway, const EDA_IU_SCALE &aIuScale)
static constexpr int KICAD_AUI_TB_STYLE
Default style flags used for wxAUI toolbars.
bool m_closeInProgress
Set while windowClosing() is deciding whether the frame may close.
ACTION_TOOLBAR * m_tbRight
void initExitKey()
Set the common key-pair for exiting the application (Ctrl-Q) and ties it to the wxID_EXIT event id.
void OnPreferences(wxCommandEvent &event)
virtual const SEARCH_STACK & sys_search()
Return a SEARCH_STACK pertaining to entire program.
WX_INFOBAR * m_infoBar
void onAutoSaveTimer(wxTimerEvent &aEvent)
Handle the auto save timer event.
void SaveWindowSettings(WINDOW_SETTINGS *aCfg)
Save window settings to the given settings object.
virtual void ToggleUserUnits()
virtual wxString GetRedoActionDescription() const
wxString GetAboutTitle() const
TOOLBAR_SETTINGS * m_toolbarSettings
virtual wxString GetCurrentFileName() const
Get the full filename + path of the currently opened file in the frame.
void ChangeUserUnits(EDA_UNITS aUnits)
wxString m_configName
void AddMenuLanguageList(ACTION_MENU *aMasterMenu, TOOL_INTERACTIVE *aControlTool)
Create a menu list for language choice, and add it as submenu to MasterMenu.
virtual bool canRunAutoSave() const
Return true when it is safe to run an autosave snapshot right now.
void RegisterCustomToolbarControlFactory(const ACTION_TOOLBAR_CONTROL &aControlDesc, const ACTION_TOOLBAR_CONTROL_FACTORY &aControlFactory)
Register a creation factory for toolbar controls that are present in this frame.
void ShowInfoBarMsg(const wxString &aMsg, bool aShowCloseButton=false)
Show the WX_INFOBAR displayed on the top of the canvas with a message and an info icon on the left of...
virtual void configureToolbars()
wxTimer * m_autoSaveTimer
void ShowInfoBarError(const wxString &aErrorMsg, bool aShowCloseButton=false, INFOBAR_MESSAGE_TYPE aType=INFOBAR_MESSAGE_TYPE::GENERIC)
Show the WX_INFOBAR displayed on the top of the canvas with a message and an error icon on the left o...
void UpdateFileHistory(const wxString &FullFileName, FILE_HISTORY *aFileHistory=nullptr)
Update the list of recently opened files.
wxAuiManager m_auimgr
void PrintMsg(const wxString &text)
void onUpdateUI(wxUpdateUIEvent &aEvent)
void commonInit(FRAME_T aFrameType)
Collect common initialization functions used in all CTORs.
virtual bool IsContentModified() const
Get if the contents of the frame have been modified since the last save.
void ShowInfoBarWarning(const wxString &aWarningMsg, bool aShowCloseButton=false)
Show the WX_INFOBAR displayed on the top of the canvas with a message and a warning icon on the left ...
int GetMaxUndoItems() const
virtual PICKED_ITEMS_LIST * PopCommandFromRedoList()
Return the last command to undo and remove it from list, nothing is deleted.
virtual bool CanAcceptApiCommands()
Check if this frame is ready to accept API commands.
virtual void RecreateToolbars()
std::map< int, UIUpdateHandler > m_uiUpdateMap
Map containing the UI update handlers registered with wx for each action.
std::map< std::string, ACTION_TOOLBAR_CONTROL_FACTORY > m_toolbarControlFactories
ACTION_TOOLBAR_CONTROL_FACTORY * GetCustomToolbarControlFactory(const std::string &aName)
static void HandleUpdateUIEvent(wxUpdateUIEvent &aEvent, EDA_BASE_FRAME *aFrame, ACTION_CONDITIONS &aCond)
Handle events generated when the UI is trying to figure out the current state of the UI controls rela...
UNDO_REDO_CONTAINER m_redoList
virtual void LoadSettings(APP_SETTINGS_BASE *aCfg)
Load common frame parameters from a configuration file.
wxString GetMruPath() const
FILE_HISTORY * m_fileHistory
ACTION_TOOLBAR * m_tbLeft
SETTINGS_MANAGER * m_settingsManager
FILE_HISTORY & GetFileHistory()
Get the frame's main file history.
virtual void OnSize(wxSizeEvent &aEvent)
virtual wxString GetUndoActionDescription() const
void ImportHotkeyConfigFromFile(std::map< std::string, TOOL_ACTION * > aActionMap, const wxString &aDefaultShortname)
Prompt the user for a hotkey file to read, and read it.
virtual PICKED_ITEMS_LIST * PopCommandFromUndoList()
Return the last command to undo and remove it from list, nothing is deleted.
void OnLanguageSelectionEvent(wxCommandEvent &aEvent)
An event handler called on a language menu selection.
wxString GetRunMenuCommandDescription(const TOOL_ACTION &aAction)
virtual bool canCloseWindow(wxCloseEvent &aCloseEvent)
bool ProcessEvent(wxEvent &aEvent) override
Override the default process event handler to implement the auto save feature.
bool IsWritable(const wxFileName &aFileName, bool aVerbose=true)
Check if aFileName can be written.
wxPoint m_normalFramePos
void OnMaximize(wxMaximizeEvent &aEvent)
std::unique_ptr< nlohmann::json > m_auiLayoutState
virtual void ClearFileHistory()
Remove all files from the file history.
ORIGIN_TRANSFORMS & GetOriginTransforms() override
Return a reference to the default ORIGIN_TRANSFORMS object.
ACTION_TOOLBAR * m_tbTopAux
virtual void OnDropFiles(wxDropFilesEvent &aEvent)
Handle event fired when a file is dropped to the window.
std::map< const wxString, TOOL_ACTION * > m_acceptedExts
Associate file extensions with action to execute.
void onIconize(wxIconizeEvent &aEvent)
virtual void unitsChangeRefresh()
Called when when the units setting has changed to allow for any derived classes to handle refreshing ...
wxString GetFileFromHistory(int cmdId, const wxString &type, FILE_HISTORY *aFileHistory=nullptr)
Fetch the file name from the file history list.
wxSize GetWindowSize()
Get the undecorated window size that can be used for restoring the window size.
int GetAutoSaveInterval() const
virtual void SaveSettings(APP_SETTINGS_BASE *aCfg)
Save common frame parameters to a configuration data file.
void SetMruPath(const wxString &aPath)
void onSystemColorChange(wxSysColourChangedEvent &aEvent)
virtual int GetUndoCommandCount() const
ORIGIN_TRANSFORMS m_originTransforms
virtual void RegisterUIUpdateHandler(int aID, const ACTION_CONDITIONS &aConditions) override
Register a UI update handler for the control with ID aID.
ACTION_TOOLBAR * m_tbTopMain
virtual void SaveProjectLocalSettings()
Save changes to the project local settings.
wxString m_aboutTitle
virtual void PushCommandToRedoList(PICKED_ITEMS_LIST *aItem)
Add a command to redo in the redo list.
bool m_isClosing
Set by the close window event handler after frames are asked if they can close.
bool IsType(FRAME_T aType) const
void AddStandardHelpMenu(wxMenuBar *aMenuBar)
Add the standard KiCad help menu to the menubar.
void ReCreateMenuBar()
Recreate the menu bar.
virtual void doReCreateMenuBar()
WX_INFOBAR * GetInfoBar()
A base class for most all the KiCad significant classes used in schematics and boards.
Definition eda_item.h:98
A panel to display various information messages.
Definition msgpanel.h:97
EDA_PANE & Canvas()
Turn *this into an undecorated pane suitable for a drawing canvas.
EDA_PANE & Messages()
Turn *this into a messages pane for KiCad.
EDA_PANE & HToolbar()
Turn *this to a horizontal toolbar for KiCad.
EDA_PANE & VToolbar()
Turn *this into a vertical toolbar for KiCad.
EDA_PANE & Palette()
Turn *this into a captioned palette suitable for a symbol tree, layers manager, etc.
This class implements a file history object to store a list of files, that can then be added to a men...
KIWAY_HOLDER(KIWAY *aKiway, HOLDER_TYPE aType)
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition kiway.h:348
EDA_MSG_PANEL items for displaying messages.
Definition msgpanel.h:50
A class to perform either relative or absolute display origin transforms for a single axis of a point...
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition page_info.h:75
A holder to handle information on schematic or board items.
Base plotter engine class.
Definition plotter.h:138
Look for files in a number of paths.
Hold the information shown in the lower right corner of a plot, printout, or editing view.
Definition title_block.h:38
Represent a single user action.
Master controller class:
A holder to handle a list of undo (or redo) commands.
UNITS_PROVIDER(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits)
A modified version of the wxInfoBar class that allows us to:
Definition wx_infobar.h:76
std::function< void(ACTION_TOOLBAR *)> ACTION_TOOLBAR_CONTROL_FACTORY
std::function< void(wxUpdateUIEvent &) > UIUpdateHandler
This is the handler functor for the update UI events.
EDA_UNITS
Definition eda_units.h:44
FRAME_T
The set of EDA_BASE_FRAME derivatives, typically stored in EDA_BASE_FRAME::m_Ident.
Definition frame_type.h:29
std::string message
SEVERITY
@ RPT_SEVERITY_UNDEFINED
Functors that can be used to figure out how the action controls should be displayed in the UI and if ...
Store the common settings that are saved and loaded for each window / frame.
Store the window positioning/state.
Functions to provide common constants and other functions to assist in making a consistent UI.
INFOBAR_MESSAGE_TYPE
Sets the type of message for special handling if needed.
@ GENERIC
GENERIC Are messages that do not have special handling.