KiCad PCB EDA Suite
Loading...
Searching...
No Matches
eda_base_frame.cpp
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) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright (C) 2013 Wayne Stambaugh <[email protected]>
6 * Copyright (C) 2023 CERN (www.cern.ch)
7 * Copyright (C) 1992-2024 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, you may find one here:
21 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22 * or you may search the http://www.gnu.org website for the version 2 license,
23 * or you may write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25 */
26
27#include <advanced_config.h>
28#include <bitmaps.h>
29#include <bitmap_store.h>
30#include <dialog_shim.h>
35#include <eda_dde.h>
36#include <file_history.h>
37#include <id.h>
38#include <kiface_base.h>
39#include <hotkeys_basic.h>
41#include <paths.h>
42#include <confirm.h>
44#include <pgm_base.h>
49#include <tool/action_manager.h>
50#include <tool/action_menu.h>
51#include <tool/action_toolbar.h>
52#include <tool/actions.h>
53#include <tool/common_control.h>
54#include <tool/tool_manager.h>
56#include <trace_helpers.h>
59#include <widgets/wx_infobar.h>
61#include <widgets/wx_grid.h>
62#include <widgets/wx_treebook.h>
63#include <wx/app.h>
64#include <wx/config.h>
65#include <wx/display.h>
66#include <wx/stdpaths.h>
67#include <wx/string.h>
68#include <kiplatform/app.h>
69#include <kiplatform/io.h>
70#include <kiplatform/ui.h>
71
72#include <functional>
73#include <kiface_ids.h>
74
75
76// Minimum window size
77static const wxSize minSizeLookup( FRAME_T aFrameType, wxWindow* aWindow )
78{
79 switch( aFrameType )
80 {
82 return wxWindow::FromDIP( wxSize( 406, 354 ), aWindow );
83
84 default:
85 return wxWindow::FromDIP( wxSize( 500, 400 ), aWindow );
86 }
87}
88
89
90static const wxSize defaultSize( FRAME_T aFrameType, wxWindow* aWindow )
91{
92 switch( aFrameType )
93 {
95 return wxWindow::FromDIP( wxSize( 850, 540 ), aWindow );
96
97 default:
98 return wxWindow::FromDIP( wxSize( 1280, 720 ), aWindow );
99 }
100}
101
102
103BEGIN_EVENT_TABLE( EDA_BASE_FRAME, wxFrame )
104 // These event table entries are needed to handle events from the mac application menu
105 EVT_MENU( wxID_ABOUT, EDA_BASE_FRAME::OnKicadAbout )
106 EVT_MENU( wxID_PREFERENCES, EDA_BASE_FRAME::OnPreferences )
107
108 EVT_CHAR_HOOK( EDA_BASE_FRAME::OnCharHook )
109 EVT_MENU_OPEN( EDA_BASE_FRAME::OnMenuEvent )
110 EVT_MENU_CLOSE( EDA_BASE_FRAME::OnMenuEvent )
111 EVT_MENU_HIGHLIGHT_ALL( EDA_BASE_FRAME::OnMenuEvent )
112 EVT_MOVE( EDA_BASE_FRAME::OnMove )
113 EVT_SIZE( EDA_BASE_FRAME::OnSize )
114 EVT_MAXIMIZE( EDA_BASE_FRAME::OnMaximize )
115
116 EVT_SYS_COLOUR_CHANGED( EDA_BASE_FRAME::onSystemColorChange )
117 EVT_ICONIZE( EDA_BASE_FRAME::onIconize )
118END_EVENT_TABLE()
119
120
121void EDA_BASE_FRAME::commonInit( FRAME_T aFrameType )
122{
123 m_ident = aFrameType;
124 m_maximizeByDefault = false;
125 m_infoBar = nullptr;
126 m_settingsManager = nullptr;
127 m_fileHistory = nullptr;
128 m_supportsAutoSave = false;
129 m_autoSavePending = false;
130 m_undoRedoCountMax = DEFAULT_MAX_UNDO_ITEMS;
131 m_isClosing = false;
132 m_isNonUserClose = false;
133 m_autoSaveTimer = new wxTimer( this, ID_AUTO_SAVE_TIMER );
134 m_autoSaveRequired = false;
136 m_frameSize = defaultSize( aFrameType, this );
137 m_displayIndex = -1;
138
139 m_auimgr.SetArtProvider( new WX_AUI_DOCK_ART() );
140
141 m_settingsManager = &Pgm().GetSettingsManager();
142
143 // Set a reasonable minimal size for the frame
144 wxSize minSize = minSizeLookup( aFrameType, this );
145 SetSizeHints( minSize.x, minSize.y, -1, -1, -1, -1 );
146
147 // Store dimensions of the user area of the main window.
148 GetClientSize( &m_frameSize.x, &m_frameSize.y );
149
150 Connect( ID_AUTO_SAVE_TIMER, wxEVT_TIMER,
151 wxTimerEventHandler( EDA_BASE_FRAME::onAutoSaveTimer ) );
152
153 // hook wxEVT_CLOSE_WINDOW so we can call SaveSettings(). This function seems
154 // to be called before any other hook for wxCloseEvent, which is necessary.
155 Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( EDA_BASE_FRAME::windowClosing ) );
156
157 initExitKey();
158}
159
160
161EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent, FRAME_T aFrameType, const wxString& aTitle,
162 const wxPoint& aPos, const wxSize& aSize, long aStyle,
163 const wxString& aFrameName, KIWAY* aKiway,
164 const EDA_IU_SCALE& aIuScale ) :
165 wxFrame( aParent, wxID_ANY, aTitle, aPos, aSize, aStyle, aFrameName ),
166 TOOLS_HOLDER(),
167 KIWAY_HOLDER( aKiway, KIWAY_HOLDER::FRAME ),
169{
170 commonInit( aFrameType );
171}
172
173
174wxWindow* findQuasiModalDialog( wxWindow* aParent )
175{
176 for( wxWindow* child : aParent->GetChildren() )
177 {
178 if( DIALOG_SHIM* dlg = dynamic_cast<DIALOG_SHIM*>( child ) )
179 {
180 if( dlg->IsQuasiModal() )
181 return dlg;
182
183 if( wxWindow* nestedDlg = findQuasiModalDialog( child ) )
184 return nestedDlg;
185 }
186 }
187
188 return nullptr;
189}
190
191
193{
194 if( wxWindow* dlg = ::findQuasiModalDialog( this ) )
195 return dlg;
196
197 // FIXME: CvPcb is currently implemented on top of KIWAY_PLAYER rather than DIALOG_SHIM,
198 // so we have to look for it separately.
199 if( m_ident == FRAME_SCH )
200 {
201 wxWindow* cvpcb = wxWindow::FindWindowByName( wxS( "CvpcbFrame" ) );
202
203 if( cvpcb )
204 return cvpcb;
205 }
206
207 return nullptr;
208}
209
210
211void EDA_BASE_FRAME::windowClosing( wxCloseEvent& event )
212{
213 // Don't allow closing when a quasi-modal is open.
214 wxWindow* quasiModal = findQuasiModalDialog();
215
216 if( quasiModal )
217 {
218 // Raise and notify; don't give the user a warning regarding "quasi-modal dialogs"
219 // when they have no idea what those are.
220 quasiModal->Raise();
221 wxBell();
222
223 if( event.CanVeto() )
224 event.Veto();
225
226 return;
227 }
228
229
230 if( event.GetId() == wxEVT_QUERY_END_SESSION
231 || event.GetId() == wxEVT_END_SESSION )
232 {
233 // End session means the OS is going to terminate us
234 m_isNonUserClose = true;
235 }
236
237 if( canCloseWindow( event ) )
238 {
239 m_isClosing = true;
240
241 if( m_infoBar )
243
244 APP_SETTINGS_BASE* cfg = config();
245
246 if( cfg )
247 SaveSettings( cfg ); // virtual, wxFrame specific
248
250
251 // Destroy (safe delete frame) this frame only in non modal mode.
252 // In modal mode, the caller will call Destroy().
253 if( !IsModal() )
254 Destroy();
255 }
256 else
257 {
258 if( event.CanVeto() )
259 event.Veto();
260 }
261}
262
263
265{
266 delete m_autoSaveTimer;
267 delete m_fileHistory;
268
270
272
274}
275
276
277bool EDA_BASE_FRAME::ProcessEvent( wxEvent& aEvent )
278{
279#ifdef __WXMAC__
280 // Apple in its infinite wisdom will raise a disabled window before even passing
281 // us the event, so we have no way to stop it. Instead, we have to catch an
282 // improperly ordered disabled window and quasi-modal dialog here and reorder
283 // them.
284 if( !IsEnabled() && IsActive() )
285 {
286 wxWindow* dlg = findQuasiModalDialog();
287 if( dlg )
288 dlg->Raise();
289 }
290#endif
291
292 if( !wxFrame::ProcessEvent( aEvent ) )
293 return false;
294
295 if( Pgm().m_Quitting )
296 return true;
297
298 if( !m_isClosing && m_supportsAutoSave && IsShownOnScreen() && IsActive()
300 && GetAutoSaveInterval() > 0 )
301 {
302 if( !m_autoSavePending )
303 {
304 wxLogTrace( traceAutoSave, wxT( "Starting auto save timer." ) );
305 m_autoSaveTimer->Start( GetAutoSaveInterval() * 1000, wxTIMER_ONE_SHOT );
306 m_autoSavePending = true;
307 }
308 else if( m_autoSaveTimer->IsRunning() )
309 {
310 wxLogTrace( traceAutoSave, wxT( "Stopping auto save timer." ) );
311 m_autoSaveTimer->Stop();
312 m_autoSavePending = false;
313 }
314 }
315
316 return true;
317}
318
319
321{
322 return Pgm().GetCommonSettings()->m_System.autosave_interval;
323}
324
325
326void EDA_BASE_FRAME::onAutoSaveTimer( wxTimerEvent& aEvent )
327{
328 // Don't stomp on someone else's timer event.
329 if( aEvent.GetId() != ID_AUTO_SAVE_TIMER )
330 {
331 aEvent.Skip();
332 return;
333 }
334
335 if( !doAutoSave() )
336 m_autoSaveTimer->Start( GetAutoSaveInterval() * 1000, wxTIMER_ONE_SHOT );
337}
338
339
341{
342 wxCHECK_MSG( false, true, wxT( "Auto save timer function not overridden. Bad programmer!" ) );
343}
344
345
346void EDA_BASE_FRAME::OnCharHook( wxKeyEvent& aKeyEvent )
347{
348 wxLogTrace( kicadTraceKeyEvent, wxS( "EDA_BASE_FRAME::OnCharHook %s" ), dump( aKeyEvent ) );
349
350 // Key events can be filtered here.
351 // Currently no filtering is made.
352 aKeyEvent.Skip();
353}
354
355
356void EDA_BASE_FRAME::OnMenuEvent( wxMenuEvent& aEvent )
357{
358 if( !m_toolDispatcher )
359 aEvent.Skip();
360 else
362}
363
364
366{
368 std::placeholders::_1,
369 this,
370 aConditions );
371
372 m_uiUpdateMap[aID] = evtFunc;
373
374 Bind( wxEVT_UPDATE_UI, evtFunc, aID );
375}
376
377
379{
380 const auto it = m_uiUpdateMap.find( aID );
381
382 if( it == m_uiUpdateMap.end() )
383 return;
384
385 Unbind( wxEVT_UPDATE_UI, it->second, aID );
386}
387
388
389void EDA_BASE_FRAME::HandleUpdateUIEvent( wxUpdateUIEvent& aEvent, EDA_BASE_FRAME* aFrame,
390 ACTION_CONDITIONS aCond )
391{
392 bool checkRes = false;
393 bool enableRes = true;
394 bool showRes = true;
395 bool isCut = aEvent.GetId() == ACTIONS::cut.GetUIId();
396 bool isCopy = aEvent.GetId() == ACTIONS::copy.GetUIId();
397 bool isPaste = aEvent.GetId() == ACTIONS::paste.GetUIId();
398 SELECTION& selection = aFrame->GetCurrentSelection();
399
400 try
401 {
402 checkRes = aCond.checkCondition( selection );
403 enableRes = aCond.enableCondition( selection );
404 showRes = aCond.showCondition( selection );
405 }
406 catch( std::exception& )
407 {
408 // Something broke with the conditions, just skip the event.
409 aEvent.Skip();
410 return;
411 }
412
413 if( showRes && aEvent.GetId() == ACTIONS::undo.GetUIId() )
414 {
415 wxString msg = _( "Undo" );
416
417 if( enableRes )
418 msg += wxS( " " ) + aFrame->GetUndoActionDescription();
419
420 aEvent.SetText( msg );
421 }
422 else if( showRes && aEvent.GetId() == ACTIONS::redo.GetUIId() )
423 {
424 wxString msg = _( "Redo" );
425
426 if( enableRes )
427 msg += wxS( " " ) + aFrame->GetRedoActionDescription();
428
429 aEvent.SetText( msg );
430 }
431
432 if( isCut || isCopy || isPaste )
433 {
434 wxWindow* focus = wxWindow::FindFocus();
435 wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( focus );
436
437 if( textEntry && isCut && textEntry->CanCut() )
438 enableRes = true;
439 else if( textEntry && isCopy && textEntry->CanCopy() )
440 enableRes = true;
441 else if( textEntry && isPaste && textEntry->CanPaste() )
442 enableRes = true;
443 else if( dynamic_cast<WX_GRID*>( focus ) )
444 enableRes = false; // Must disable menu in order to get command as CharHook event
445 }
446
447 aEvent.Enable( enableRes );
448 aEvent.Show( showRes );
449
450 if( aEvent.IsCheckable() )
451 aEvent.Check( checkRes );
452}
453
454
456{
457 // Setup the conditions to check a language menu item
458 auto isCurrentLang =
459 [] ( const SELECTION& aSel, int aLangIdentifier )
460 {
461 return Pgm().GetSelectedLanguageIdentifier() == aLangIdentifier;
462 };
463
464 for( unsigned ii = 0; LanguagesList[ii].m_KI_Lang_Identifier != 0; ii++ )
465 {
467 cond.Check( std::bind( isCurrentLang, std::placeholders::_1,
468 LanguagesList[ii].m_WX_Lang_Identifier ) );
469
470 RegisterUIUpdateHandler( LanguagesList[ii].m_KI_Lang_Identifier, cond );
471 }
472}
473
474
476{
484 CallAfter( [this]()
485 {
486 if( !m_isClosing )
488 } );
489}
490
491
492void EDA_BASE_FRAME::SetMenuBar( wxMenuBar* menu_bar )
493{
494 wxFrame::SetMenuBar( menu_bar );
495
496 // Move Help menu back to end of menubar
497
498 int pos = GetMenuBar()->FindMenu( _( "&Help" ) + wxS( " " ) );
499
500 if( pos != wxNOT_FOUND )
501 {
502 wxMenu* helpMenu = GetMenuBar()->Remove( pos );
503 GetMenuBar()->Append( helpMenu, _( "&Help" ) + wxS( " " ) );
504 }
505}
506
507
508void EDA_BASE_FRAME::AddStandardHelpMenu( wxMenuBar* aMenuBar )
509{
511 ACTION_MENU* helpMenu = new ACTION_MENU( false, commonControl );
512
513 helpMenu->Add( ACTIONS::help );
514 helpMenu->Add( ACTIONS::gettingStarted );
515 helpMenu->Add( ACTIONS::listHotKeys );
516 helpMenu->Add( ACTIONS::getInvolved );
517 helpMenu->Add( ACTIONS::donate );
518 helpMenu->Add( ACTIONS::reportBug );
519
520 helpMenu->AppendSeparator();
521 helpMenu->Add( ACTIONS::about );
522
523 // Trailing space keeps OSX from hijacking our menu (and disabling everything in it).
524 aMenuBar->Append( helpMenu, _( "&Help" ) + wxS( " " ) );
525
526 // This change is only needed on macOS, and creates a bug on Windows
527 #ifdef __WXMAC__
528 helpMenu->wxMenu::SetTitle( _( "&Help" ) + wxS( " " ) );
529 #endif
530}
531
532
534{
536
537 if( GetMenuBar() )
538 {
540 GetMenuBar()->Refresh();
541 }
542}
543
544
545void EDA_BASE_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged )
546{
547 TOOLS_HOLDER::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
548
549 COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
550
551 if( m_fileHistory )
552 {
553 int historySize = settings->m_System.file_history_size;
554 m_fileHistory->SetMaxFiles( (unsigned) std::max( 0, historySize ) );
555 }
556
558 ThemeChanged();
559
560 if( GetMenuBar() )
561 {
562 // For icons in menus, icon scaling & hotkeys
564 GetMenuBar()->Refresh();
565 }
566}
567
568
570{
572
573 // Update all the toolbars to have new icons
574 wxAuiPaneInfoArray panes = m_auimgr.GetAllPanes();
575
576 for( size_t i = 0; i < panes.GetCount(); ++i )
577 {
578 if( ACTION_TOOLBAR* toolbar = dynamic_cast<ACTION_TOOLBAR*>( panes[i].window ) )
579 toolbar->RefreshBitmaps();
580 }
581}
582
583
584void EDA_BASE_FRAME::OnSize( wxSizeEvent& aEvent )
585{
586#ifdef __WXMAC__
587 int currentDisplay = wxDisplay::GetFromWindow( this );
588
589 if( m_displayIndex >= 0 && currentDisplay >= 0 && currentDisplay != m_displayIndex )
590 {
591 wxLogTrace( traceDisplayLocation, wxS( "OnSize: current display changed %d to %d" ),
592 m_displayIndex, currentDisplay );
593 m_displayIndex = currentDisplay;
595 }
596#endif
597
598 aEvent.Skip();
599}
600
601
602void EDA_BASE_FRAME::LoadWindowState( const wxString& aFileName )
603{
604 if( !Pgm().GetCommonSettings()->m_Session.remember_open_files )
605 return;
606
607 const PROJECT_FILE_STATE* state = Prj().GetLocalSettings().GetFileState( aFileName );
608
609 if( state != nullptr )
610 {
611 LoadWindowState( state->window );
612 }
613}
614
615
617{
618 bool wasDefault = false;
619
620 m_framePos.x = aState.pos_x;
621 m_framePos.y = aState.pos_y;
622 m_frameSize.x = aState.size_x;
623 m_frameSize.y = aState.size_y;
624
625 wxLogTrace( traceDisplayLocation, wxS( "Config position (%d, %d) with size (%d, %d)" ),
627
628 // Ensure minimum size is set if the stored config was zero-initialized
629 wxSize minSize = minSizeLookup( m_ident, this );
630 if( m_frameSize.x < minSize.x || m_frameSize.y < minSize.y )
631 {
633 wasDefault = true;
634
635 wxLogTrace( traceDisplayLocation, wxS( "Using minimum size (%d, %d)" ),
637 }
638
639 wxLogTrace( traceDisplayLocation, wxS( "Number of displays: %d" ), wxDisplay::GetCount() );
640
641 if( aState.display >= wxDisplay::GetCount() )
642 {
643 wxLogTrace( traceDisplayLocation, wxS( "Previous display not found" ) );
644
645 // If it isn't attached, use the first display
646 // Warning wxDisplay has 2 ctor variants. the parameter needs a type:
647 const unsigned int index = 0;
648 wxDisplay display( index );
649 wxRect clientSize = display.GetGeometry();
650
651 m_framePos = wxDefaultPosition;
652
653 // Ensure the window fits on the display, since the other one could have been larger
654 if( m_frameSize.x > clientSize.width )
655 m_frameSize.x = clientSize.width;
656
657 if( m_frameSize.y > clientSize.height )
658 m_frameSize.y = clientSize.height;
659 }
660 else
661 {
662 wxPoint upperRight( m_framePos.x + m_frameSize.x, m_framePos.y );
663 wxPoint upperLeft( m_framePos.x, m_framePos.y );
664
665 wxDisplay display( aState.display );
666 wxRect clientSize = display.GetClientArea();
667
668 int yLimTop = clientSize.y;
669 int yLimBottom = clientSize.y + clientSize.height;
670 int xLimLeft = clientSize.x;
671 int xLimRight = clientSize.x + clientSize.width;
672
673 if( upperLeft.x > xLimRight || // Upper left corner too close to right edge of screen
674 upperRight.x < xLimLeft || // Upper right corner too close to left edge of screen
675 upperLeft.y < yLimTop || // Upper corner too close to the bottom of the screen
676 upperLeft.y > yLimBottom )
677 {
678 m_framePos = wxDefaultPosition;
679 wxLogTrace( traceDisplayLocation, wxS( "Resetting to default position" ) );
680 }
681 }
682
683 wxLogTrace( traceDisplayLocation, wxS( "Final window position (%d, %d) with size (%d, %d)" ),
685
686 SetSize( m_framePos.x, m_framePos.y, m_frameSize.x, m_frameSize.y );
687
688 // Center the window if we reset to default
689 if( m_framePos.x == -1 )
690 {
691 wxLogTrace( traceDisplayLocation, wxS( "Centering window" ) );
692 Center();
693 m_framePos = GetPosition();
694 }
695
696 // Record the frame sizes in an un-maximized state
699
700 // Maximize if we were maximized before
701 if( aState.maximized || ( wasDefault && m_maximizeByDefault ) )
702 {
703 wxLogTrace( traceDisplayLocation, wxS( "Maximizing window" ) );
704 Maximize();
705 }
706
707 m_displayIndex = wxDisplay::GetFromWindow( this );
708}
709
710
712{
713 wxDisplay display( wxDisplay::GetFromWindow( this ) );
714 wxRect clientSize = display.GetClientArea();
715 wxPoint pos = GetPosition();
716 wxSize size = GetWindowSize();
717
718 wxLogTrace( traceDisplayLocation,
719 wxS( "ensureWindowIsOnScreen: clientArea (%d, %d) w %d h %d" ),
720 clientSize.x, clientSize.y,
721 clientSize.width, clientSize.height );
722
723 if( pos.y < clientSize.y )
724 {
725 wxLogTrace( traceDisplayLocation,
726 wxS( "ensureWindowIsOnScreen: y pos %d below minimum, setting to %d" ), pos.y,
727 clientSize.y );
728 pos.y = clientSize.y;
729 }
730
731 if( pos.x < clientSize.x )
732 {
733 wxLogTrace( traceDisplayLocation,
734 wxS( "ensureWindowIsOnScreen: x pos %d is off the client rect, setting to %d" ),
735 pos.x, clientSize.x );
736 pos.x = clientSize.x;
737 }
738
739 if( pos.x + size.x - clientSize.x > clientSize.width )
740 {
741 int newWidth = clientSize.width - ( pos.x - clientSize.x );
742 wxLogTrace( traceDisplayLocation,
743 wxS( "ensureWindowIsOnScreen: effective width %d above available %d, setting "
744 "to %d" ), pos.x + size.x, clientSize.width, newWidth );
745 size.x = newWidth;
746 }
747
748 if( pos.y + size.y - clientSize.y > clientSize.height )
749 {
750 int newHeight = clientSize.height - ( pos.y - clientSize.y );
751 wxLogTrace( traceDisplayLocation,
752 wxS( "ensureWindowIsOnScreen: effective height %d above available %d, setting "
753 "to %d" ), pos.y + size.y, clientSize.height, newHeight );
754 size.y = newHeight;
755 }
756
757 wxLogTrace( traceDisplayLocation, wxS( "Updating window position (%d, %d) with size (%d, %d)" ),
758 pos.x, pos.y, size.x, size.y );
759
760 SetSize( pos.x, pos.y, size.x, size.y );
761}
762
763
765{
766 LoadWindowState( aCfg->state );
767
769 m_mruPath = aCfg->mru_path;
770
772}
773
774
776{
777 if( IsIconized() )
778 return;
779
780 // If the window is maximized, we use the saved window size from before it was maximized
781 if( IsMaximized() )
782 {
785 }
786 else
787 {
789 m_framePos = GetPosition();
790 }
791
792 aCfg->state.pos_x = m_framePos.x;
793 aCfg->state.pos_y = m_framePos.y;
794 aCfg->state.size_x = m_frameSize.x;
795 aCfg->state.size_y = m_frameSize.y;
796 aCfg->state.maximized = IsMaximized();
797 aCfg->state.display = wxDisplay::GetFromWindow( this );
798
799 wxLogTrace( traceDisplayLocation, wxS( "Saving window maximized: %s" ),
800 IsMaximized() ? wxS( "true" ) : wxS( "false" ) );
801 wxLogTrace( traceDisplayLocation, wxS( "Saving config position (%d, %d) with size (%d, %d)" ),
803
804 // Once this is fully implemented, wxAuiManager will be used to maintain
805 // the persistence of the main frame and all it's managed windows and
806 // all of the legacy frame persistence position code can be removed.
807 aCfg->perspective = m_auimgr.SavePerspective().ToStdString();
808
809 aCfg->mru_path = m_mruPath;
810}
811
812
814{
816
817 // Get file history size from common settings
818 int fileHistorySize = Pgm().GetCommonSettings()->m_System.file_history_size;
819
820 // Load the recently used files into the history menu
821 m_fileHistory = new FILE_HISTORY( (unsigned) std::max( 1, fileHistorySize ),
823 m_fileHistory->Load( *aCfg );
824}
825
826
828{
829 wxCHECK( config(), /* void */ );
830
832
833 bool fileOpen = m_isClosing && m_isNonUserClose;
834
835 wxString currentlyOpenedFile = GetCurrentFileName();
836
837 if( Pgm().GetCommonSettings()->m_Session.remember_open_files && !currentlyOpenedFile.IsEmpty() )
838 {
839 wxFileName rfn( currentlyOpenedFile );
840 rfn.MakeRelativeTo( Prj().GetProjectPath() );
841 Prj().GetLocalSettings().SaveFileState( rfn.GetFullPath(), &aCfg->m_Window, fileOpen );
842 }
843
844 // Save the recently used files list
845 if( m_fileHistory )
846 {
847 // Save the currently opened file in the file history
848 if( !currentlyOpenedFile.IsEmpty() )
849 UpdateFileHistory( currentlyOpenedFile );
850
851 m_fileHistory->Save( *aCfg );
852 }
853}
854
855
857{
858 return &aCfg->m_Window;
859}
860
861
863{
864 // KICAD_MANAGER_FRAME overrides this
865 return Kiface().KifaceSettings();
866}
867
868
870{
871 return Kiface().KifaceSearch();
872}
873
874
876{
877 return Kiface().GetHelpFileName();
878}
879
880
881void EDA_BASE_FRAME::PrintMsg( const wxString& text )
882{
883 SetStatusText( text );
884}
885
886
888{
889#if defined( __WXOSX_MAC__ )
891#else
892 m_infoBar = new WX_INFOBAR( this, &m_auimgr );
893
894 m_auimgr.AddPane( m_infoBar, EDA_PANE().InfoBar().Name( wxS( "InfoBar" ) ).Top().Layer(1) );
895#endif
896}
897
898
900{
901#if defined( __WXOSX_MAC__ )
902 m_auimgr.Update();
903#else
904 // Call Update() to fix all pane default sizes, especially the "InfoBar" pane before
905 // hiding it.
906 m_auimgr.Update();
907
908 // We don't want the infobar displayed right away
909 m_auimgr.GetPane( wxS( "InfoBar" ) ).Hide();
910 m_auimgr.Update();
911#endif
912}
913
914
915void EDA_BASE_FRAME::ShowInfoBarError( const wxString& aErrorMsg, bool aShowCloseButton,
917{
919
920 if( aShowCloseButton )
922
923 GetInfoBar()->ShowMessageFor( aErrorMsg, 8000, wxICON_ERROR, aType );
924}
925
926
927void EDA_BASE_FRAME::ShowInfoBarError( const wxString& aErrorMsg, bool aShowCloseButton,
928 std::function<void(void)> aCallback )
929{
931
932 if( aShowCloseButton )
934
935 if( aCallback )
936 m_infoBar->SetCallback( aCallback );
937
938 GetInfoBar()->ShowMessageFor( aErrorMsg, 6000, wxICON_ERROR );
939}
940
941
942void EDA_BASE_FRAME::ShowInfoBarWarning( const wxString& aWarningMsg, bool aShowCloseButton )
943{
945
946 if( aShowCloseButton )
948
949 GetInfoBar()->ShowMessageFor( aWarningMsg, 6000, wxICON_WARNING );
950}
951
952
953void EDA_BASE_FRAME::ShowInfoBarMsg( const wxString& aMsg, bool aShowCloseButton )
954{
956
957 if( aShowCloseButton )
959
960 GetInfoBar()->ShowMessageFor( aMsg, 8000, wxICON_INFORMATION );
961}
962
963
964void EDA_BASE_FRAME::UpdateFileHistory( const wxString& FullFileName, FILE_HISTORY* aFileHistory )
965{
966 if( !aFileHistory )
967 aFileHistory = m_fileHistory;
968
969 wxASSERT( aFileHistory );
970
971 aFileHistory->AddFileToHistory( FullFileName );
972
973 // Update the menubar to update the file history menu
974 if( !m_isClosing && GetMenuBar() )
975 {
977 GetMenuBar()->Refresh();
978 }
979}
980
981
982wxString EDA_BASE_FRAME::GetFileFromHistory( int cmdId, const wxString& type,
983 FILE_HISTORY* aFileHistory )
984{
985 if( !aFileHistory )
986 aFileHistory = m_fileHistory;
987
988 wxASSERT( aFileHistory );
989
990 int baseId = aFileHistory->GetBaseId();
991
992 wxASSERT( cmdId >= baseId && cmdId < baseId + (int) aFileHistory->GetCount() );
993
994 unsigned i = cmdId - baseId;
995
996 if( i < aFileHistory->GetCount() )
997 {
998 wxString fn = aFileHistory->GetHistoryFile( i );
999
1000 if( wxFileName::FileExists( fn ) )
1001 {
1002 return fn;
1003 }
1004 else
1005 {
1006 DisplayErrorMessage( this, wxString::Format( _( "File '%s' was not found." ), fn ) );
1007 aFileHistory->RemoveFileFromHistory( i );
1008 }
1009 }
1010
1011 // Update the menubar to update the file history menu
1012 if( GetMenuBar() )
1013 {
1015 GetMenuBar()->Refresh();
1016 }
1017
1018 return wxEmptyString;
1019}
1020
1021
1023{
1024 if( !aFileHistory )
1025 aFileHistory = m_fileHistory;
1026
1027 wxASSERT( aFileHistory );
1028
1029 aFileHistory->ClearFileHistory();
1030
1031 // Update the menubar to update the file history menu
1032 if( GetMenuBar() )
1033 {
1035 GetMenuBar()->Refresh();
1036 }
1037}
1038
1039
1040void EDA_BASE_FRAME::OnKicadAbout( wxCommandEvent& event )
1041{
1042 void ShowAboutDialog( EDA_BASE_FRAME * aParent ); // See AboutDialog_main.cpp
1043 ShowAboutDialog( this );
1044}
1045
1046
1047void EDA_BASE_FRAME::OnPreferences( wxCommandEvent& event )
1048{
1049 ShowPreferences( wxEmptyString, wxEmptyString );
1050}
1051
1052
1053void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParentPage )
1054{
1055 PAGED_DIALOG dlg( this, _( "Preferences" ), true, true, wxEmptyString,
1056 wxWindow::FromDIP( wxSize( 980, 560 ), NULL ) );
1057
1058 dlg.SetEvtHandlerEnabled( false );
1059
1060 {
1061 WX_BUSY_INDICATOR busy_cursor;
1062
1063 WX_TREEBOOK* book = dlg.GetTreebook();
1064 PANEL_HOTKEYS_EDITOR* hotkeysPanel = new PANEL_HOTKEYS_EDITOR( this, book, false );
1065 KIFACE* kiface = nullptr;
1066 std::vector<int> expand;
1067
1068 Kiway().GetActions( hotkeysPanel->ActionsList() );
1069
1070 book->AddLazyPage(
1071 []( wxWindow* aParent ) -> wxWindow*
1072 {
1073 return new PANEL_COMMON_SETTINGS( aParent );
1074 },
1075 _( "Common" ) );
1076
1077 book->AddLazyPage(
1078 []( wxWindow* aParent ) -> wxWindow*
1079 {
1080 return new PANEL_MOUSE_SETTINGS( aParent );
1081 }, _( "Mouse and Touchpad" ) );
1082
1083 book->AddPage( hotkeysPanel, _( "Hotkeys" ) );
1084
1085 // This currently allows pre-defined repositories that we
1086 // don't use, so keep it disabled at the moment
1087 if( ADVANCED_CFG::GetCfg().m_EnableGit && false )
1088 {
1089 book->AddLazyPage(
1090 []( wxWindow* aParent ) -> wxWindow*
1091 {
1092 return new PANEL_GIT_REPOS( aParent );
1093 }, _( "Version Control" ) );
1094 }
1095
1096 #ifdef KICAD_USE_SENTRY
1097 book->AddLazyPage(
1098 []( wxWindow* aParent ) -> wxWindow*
1099 {
1100 return new PANEL_DATA_COLLECTION( aParent );
1101 }, _( "Data Collection" ) );
1102 #endif
1103
1104 #define LAZY_CTOR( key ) \
1105 [=]( wxWindow* aParent ) \
1106 { \
1107 return kiface->CreateKiWindow( aParent, key, &Kiway() ); \
1108 }
1109
1110 // If a dll is not loaded, the loader will show an error message.
1111
1112 try
1113 {
1115
1116 if( !kiface )
1117 return;
1118
1119 kiface->GetActions( hotkeysPanel->ActionsList() );
1120
1122 expand.push_back( (int) book->GetPageCount() );
1123
1124 book->AddPage( new wxPanel( book ), _( "Symbol Editor" ) );
1125 book->AddLazySubPage( LAZY_CTOR( PANEL_SYM_DISP_OPTIONS ), _( "Display Options" ) );
1126 book->AddLazySubPage( LAZY_CTOR( PANEL_SYM_EDIT_GRIDS ), _( "Grids" ) );
1127 book->AddLazySubPage( LAZY_CTOR( PANEL_SYM_EDIT_OPTIONS ), _( "Editing Options" ) );
1128 book->AddLazySubPage( LAZY_CTOR( PANEL_SYM_COLORS ), _( "Colors" ) );
1129
1130 if( GetFrameType() == FRAME_SCH )
1131 expand.push_back( (int) book->GetPageCount() );
1132
1133 book->AddPage( new wxPanel( book ), _( "Schematic Editor" ) );
1134 book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_DISP_OPTIONS ), _( "Display Options" ) );
1135 book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_GRIDS ), _( "Grids" ) );
1136 book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_EDIT_OPTIONS ), _( "Editing Options" ) );
1137 book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_ANNO_OPTIONS ), _( "Annotation Options" ) );
1138 book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_COLORS ), _( "Colors" ) );
1139 book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_FIELD_NAME_TEMPLATES ), _( "Field Name Templates" ) );
1140 book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_SIMULATOR ), _( "Simulator" ) );
1141 }
1142 catch( ... )
1143 {
1144 }
1145
1146 try
1147 {
1149
1150 if( !kiface )
1151 return;
1152
1153 kiface->GetActions( hotkeysPanel->ActionsList() );
1154
1156 expand.push_back( (int) book->GetPageCount() );
1157
1158 book->AddPage( new wxPanel( book ), _( "Footprint Editor" ) );
1159 book->AddLazySubPage( LAZY_CTOR( PANEL_FP_DISPLAY_OPTIONS ), _( "Display Options" ) );
1160 book->AddLazySubPage( LAZY_CTOR( PANEL_FP_GRIDS ), _( "Grids" ) );
1161 book->AddLazySubPage( LAZY_CTOR( PANEL_FP_ORIGINS_AXES ), _( "Origins & Axes" ) );
1162 book->AddLazySubPage( LAZY_CTOR( PANEL_FP_EDIT_OPTIONS ), _( "Editing Options" ) );
1163 book->AddLazySubPage( LAZY_CTOR( PANEL_FP_COLORS ), _( "Colors" ) );
1164 book->AddLazySubPage( LAZY_CTOR( PANEL_FP_DEFAULT_VALUES ), _( "Default Values" ) );
1165
1167 expand.push_back( (int) book->GetPageCount() );
1168
1169 book->AddPage( new wxPanel( book ), _( "PCB Editor" ) );
1170 book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_DISPLAY_OPTS ), _( "Display Options" ) );
1171 book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_GRIDS ), _( "Grids" ) );
1172 book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_ORIGINS_AXES ), _( "Origins & Axes" ) );
1173 book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_EDIT_OPTIONS ), _( "Editing Options" ) );
1174 book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_COLORS ), _( "Colors" ) );
1175 book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_ACTION_PLUGINS ), _( "Action Plugins" ) );
1176
1178 expand.push_back( (int) book->GetPageCount() );
1179
1180 book->AddPage( new wxPanel( book ), _( "3D Viewer" ) );
1181 book->AddLazySubPage( LAZY_CTOR( PANEL_3DV_DISPLAY_OPTIONS ), _( "General" ) );
1182 book->AddLazySubPage( LAZY_CTOR( PANEL_3DV_OPENGL ), _( "Realtime Renderer" ) );
1183 book->AddLazySubPage( LAZY_CTOR( PANEL_3DV_RAYTRACING ), _( "Raytracing Renderer" ) );
1184 }
1185 catch( ... )
1186 {
1187 }
1188
1189 try
1190 {
1192
1193 if( !kiface )
1194 return;
1195
1196 kiface->GetActions( hotkeysPanel->ActionsList() );
1197
1198 if( GetFrameType() == FRAME_GERBER )
1199 expand.push_back( (int) book->GetPageCount() );
1200
1201 book->AddPage( new wxPanel( book ), _( "Gerber Viewer" ) );
1202 book->AddLazySubPage( LAZY_CTOR( PANEL_GBR_DISPLAY_OPTIONS ), _( "Display Options" ) );
1203 book->AddLazySubPage( LAZY_CTOR( PANEL_GBR_COLORS ), _( "Colors" ) );
1204 book->AddLazySubPage( LAZY_CTOR( PANEL_GBR_GRIDS ), _( "Grids" ) );
1205 book->AddLazySubPage( LAZY_CTOR( PANEL_GBR_EXCELLON_OPTIONS ), _( "Excellon Options" ) );
1206 }
1207 catch( ... )
1208 {
1209 }
1210
1211 try
1212 {
1214
1215 if( !kiface )
1216 return;
1217
1218 kiface->GetActions( hotkeysPanel->ActionsList() );
1219
1220 if( GetFrameType() == FRAME_PL_EDITOR )
1221 expand.push_back( (int) book->GetPageCount() );
1222
1223 book->AddPage( new wxPanel( book ), _( "Drawing Sheet Editor" ) );
1224 book->AddLazySubPage( LAZY_CTOR( PANEL_DS_DISPLAY_OPTIONS ), _( "Display Options" ) );
1225 book->AddLazySubPage( LAZY_CTOR( PANEL_DS_GRIDS ), _( "Grids" ) );
1226 book->AddLazySubPage( LAZY_CTOR( PANEL_DS_COLORS ), _( "Colors" ) );
1227
1228 book->AddLazyPage(
1229 []( wxWindow* aParent ) -> wxWindow*
1230 {
1231 return new PANEL_PACKAGES_AND_UPDATES( aParent );
1232 }, _( "Packages and Updates" ) );
1233 }
1234 catch( ... )
1235 {
1236 }
1237
1238 // Update all of the action hotkeys. The process of loading the actions through
1239 // the KiFACE will only get us the default hotkeys
1240 ReadHotKeyConfigIntoActions( wxEmptyString, hotkeysPanel->ActionsList() );
1241
1242 for( size_t i = 0; i < book->GetPageCount(); ++i )
1243 book->GetPage( i )->Layout();
1244
1245 for( int page : expand )
1246 book->ExpandNode( page );
1247
1248 if( !aStartPage.IsEmpty() )
1249 dlg.SetInitialPage( aStartPage, aStartParentPage );
1250
1251 dlg.SetEvtHandlerEnabled( true );
1252#undef LAZY_CTOR
1253 }
1254
1255 if( dlg.ShowModal() == wxID_OK )
1256 {
1257 // Update our grids that are cached in the tool
1259 Pgm().GetSettingsManager().Save();
1260 dlg.Kiway().CommonSettingsChanged( false, false );
1261 }
1262
1263}
1264
1265
1266void EDA_BASE_FRAME::OnDropFiles( wxDropFilesEvent& aEvent )
1267{
1268 wxString* files = aEvent.GetFiles();
1269
1270 for( int nb = 0; nb < aEvent.GetNumberOfFiles(); nb++ )
1271 {
1272 const wxFileName fn = wxFileName( files[nb] );
1273 wxString ext = fn.GetExt();
1274
1275 // Alias all gerber files as GerberFileExtension
1278
1279 if( m_acceptedExts.find( ext.ToStdString() ) != m_acceptedExts.end() )
1280 m_AcceptedFiles.emplace_back( fn );
1281 }
1282
1284 m_AcceptedFiles.clear();
1285}
1286
1287
1289{
1290 for( const wxFileName& file : m_AcceptedFiles )
1291 {
1292 wxString fn = file.GetFullPath();
1293 m_toolManager->RunAction<wxString*>( *m_acceptedExts.at( file.GetExt() ), &fn );
1294 }
1295}
1296
1297
1298bool EDA_BASE_FRAME::IsWritable( const wxFileName& aFileName, bool aVerbose )
1299{
1300 wxString msg;
1301 wxFileName fn = aFileName;
1302
1303 // Check for absence of a file path with a file name. Unfortunately KiCad
1304 // uses paths relative to the current project path without the ./ part which
1305 // confuses wxFileName. Making the file name path absolute may be less than
1306 // elegant but it solves the problem.
1307 if( fn.GetPath().IsEmpty() && fn.HasName() )
1308 fn.MakeAbsolute();
1309
1310 wxCHECK_MSG( fn.IsOk(), false,
1311 wxT( "File name object is invalid. Bad programmer!" ) );
1312 wxCHECK_MSG( !fn.GetPath().IsEmpty(), false,
1313 wxT( "File name object path <" ) + fn.GetFullPath() +
1314 wxT( "> is not set. Bad programmer!" ) );
1315
1316 if( fn.IsDir() && !fn.IsDirWritable() )
1317 {
1318 msg.Printf( _( "Insufficient permissions to folder '%s'." ), fn.GetPath() );
1319 }
1320 else if( !fn.FileExists() && !fn.IsDirWritable() )
1321 {
1322 msg.Printf( _( "Insufficient permissions to save file '%s'." ), fn.GetFullPath() );
1323 }
1324 else if( fn.FileExists() && !fn.IsFileWritable() )
1325 {
1326 msg.Printf( _( "Insufficient permissions to save file '%s'." ), fn.GetFullPath() );
1327 }
1328
1329 if( !msg.IsEmpty() )
1330 {
1331 if( aVerbose )
1332 DisplayErrorMessage( this, msg );
1333
1334 return false;
1335 }
1336
1337 return true;
1338}
1339
1340
1341void EDA_BASE_FRAME::CheckForAutoSaveFile( const wxFileName& aFileName )
1342{
1343 if( !Pgm().IsGUI() )
1344 return;
1345
1346 wxCHECK_RET( aFileName.IsOk(), wxT( "Invalid file name!" ) );
1347
1348 wxFileName autoSaveFileName = aFileName;
1349
1350 // Check for auto save file.
1351 autoSaveFileName.SetName( GetAutoSaveFilePrefix() + aFileName.GetName() );
1352
1353 wxLogTrace( traceAutoSave,
1354 wxT( "Checking for auto save file " ) + autoSaveFileName.GetFullPath() );
1355
1356 if( !autoSaveFileName.FileExists() )
1357 return;
1358
1359 wxString msg = wxString::Format( _( "Well this is potentially embarrassing!\n"
1360 "It appears that the last time you were editing\n"
1361 "%s\n"
1362 "KiCad exited before saving.\n"
1363 "\n"
1364 "Do you wish to open the auto-saved file instead?" ),
1365 aFileName.GetFullName() );
1366
1367 int response = wxMessageBox( msg, Pgm().App().GetAppDisplayName(), wxYES_NO | wxICON_QUESTION,
1368 this );
1369
1370 // Make a backup of the current file, delete the file, and rename the auto save file to
1371 // the file name.
1372 if( response == wxYES )
1373 {
1374 // Preserve the permissions of the current file
1375 KIPLATFORM::IO::DuplicatePermissions( aFileName.GetFullPath(), autoSaveFileName.GetFullPath() );
1376
1377 if( !wxRenameFile( autoSaveFileName.GetFullPath(), aFileName.GetFullPath() ) )
1378 {
1379 wxMessageBox( _( "The auto save file could not be renamed to the board file name." ),
1380 Pgm().App().GetAppDisplayName(), wxOK | wxICON_EXCLAMATION, this );
1381 }
1382 }
1383 else
1384 {
1385 DeleteAutoSaveFile( aFileName );
1386 }
1387}
1388
1389
1390void EDA_BASE_FRAME::DeleteAutoSaveFile( const wxFileName& aFileName )
1391{
1392 if( !Pgm().IsGUI() )
1393 return;
1394
1395 wxCHECK_RET( aFileName.IsOk(), wxT( "Invalid file name!" ) );
1396
1397 wxFileName autoSaveFn = aFileName;
1398 autoSaveFn.SetName( GetAutoSaveFilePrefix() + aFileName.GetName() );
1399
1400 if( autoSaveFn.FileExists() )
1401 {
1402 wxLogTrace( traceAutoSave, wxT( "Removing auto save file " ) + autoSaveFn.GetFullPath() );
1403 wxRemoveFile( autoSaveFn.GetFullPath() );
1404 }
1405}
1406
1407
1409{
1410 // This function should be overridden in child classes
1411 return false;
1412}
1413
1414
1416{
1417 wxAcceleratorEntry entries[1];
1418 entries[0].Set( wxACCEL_CTRL, int( 'Q' ), wxID_EXIT );
1419 wxAcceleratorTable accel( 1, entries );
1420 SetAcceleratorTable( accel );
1421}
1422
1423
1425{
1428}
1429
1430
1432{
1433 m_undoList.PushCommand( aNewitem );
1434
1435 // Delete the extra items, if count max reached
1436 if( m_undoRedoCountMax > 0 )
1437 {
1438 int extraitems = GetUndoCommandCount() - m_undoRedoCountMax;
1439
1440 if( extraitems > 0 )
1441 ClearUndoORRedoList( UNDO_LIST, extraitems );
1442 }
1443}
1444
1445
1447{
1448 m_redoList.PushCommand( aNewitem );
1449
1450 // Delete the extra items, if count max reached
1451 if( m_undoRedoCountMax > 0 )
1452 {
1453 int extraitems = GetRedoCommandCount() - m_undoRedoCountMax;
1454
1455 if( extraitems > 0 )
1456 ClearUndoORRedoList( REDO_LIST, extraitems );
1457 }
1458}
1459
1460
1462{
1463 return m_undoList.PopCommand();
1464}
1465
1466
1468{
1469 return m_redoList.PopCommand();
1470}
1471
1472
1474{
1475 if( GetUndoCommandCount() > 0 )
1476 return m_undoList.m_CommandsList.back()->GetDescription();
1477
1478 return wxEmptyString;
1479}
1480
1481
1483{
1484 if( GetRedoCommandCount() > 0 )
1485 return m_redoList.m_CommandsList.back()->GetDescription();
1486
1487 return wxEmptyString;
1488}
1489
1490
1492{
1493 m_autoSaveRequired = true;
1494}
1495
1496
1498{
1499 SetUserUnits( aUnits );
1501
1502 wxCommandEvent e( EDA_EVT_UNITS_CHANGED );
1503 e.SetInt( static_cast<int>( aUnits ) );
1504 e.SetClientData( this );
1505 ProcessEventLocally( e );
1506}
1507
1508
1509void EDA_BASE_FRAME::OnMaximize( wxMaximizeEvent& aEvent )
1510{
1511 // When we maximize the window, we want to save the old information
1512 // so that we can add it to the settings on next window load.
1513 // Contrary to the documentation, this event seems to be generated
1514 // when the window is also being unmaximized on OSX, so we only
1515 // capture the size information when we maximize the window when on OSX.
1516#ifdef __WXOSX__
1517 if( !IsMaximized() )
1518#endif
1519 {
1521 m_normalFramePos = GetPosition();
1522 wxLogTrace( traceDisplayLocation,
1523 "Maximizing window - Saving position (%d, %d) with size (%d, %d)",
1526 }
1527
1528 // Skip event to actually maximize the window
1529 aEvent.Skip();
1530}
1531
1532
1534{
1535#ifdef __WXGTK__
1536 wxSize winSize = GetSize();
1537
1538 // GTK includes the window decorations in the normal GetSize call,
1539 // so we have to use a GTK-specific sizing call that returns the
1540 // non-decorated window size.
1542 {
1543 int width = 0;
1544 int height = 0;
1545 GTKDoGetSize( &width, &height );
1546
1547 winSize.Set( width, height );
1548 }
1549#else
1550 wxSize winSize = GetSize();
1551#endif
1552
1553 return winSize;
1554}
1555
1556
1558{
1559 // Update the icon theme when the system theme changes and update the toolbars
1561 ThemeChanged();
1562
1563 // This isn't handled by ThemeChanged()
1564 if( GetMenuBar() )
1565 {
1566 // For icons in menus, icon scaling & hotkeys
1568 GetMenuBar()->Refresh();
1569 }
1570}
1571
1572
1573void EDA_BASE_FRAME::onSystemColorChange( wxSysColourChangedEvent& aEvent )
1574{
1575 // Call the handler to update the colors used in the frame
1577
1578 // Skip the change event to ensure the rest of the window controls get it
1579 aEvent.Skip();
1580}
1581
1582
1583void EDA_BASE_FRAME::onIconize( wxIconizeEvent& aEvent )
1584{
1585 // Call the handler
1586 handleIconizeEvent( aEvent );
1587
1588 // Skip the event.
1589 aEvent.Skip();
1590}
1591
1592
1593#ifdef _WIN32
1594WXLRESULT EDA_BASE_FRAME::MSWWindowProc( WXUINT message, WXWPARAM wParam, WXLPARAM lParam )
1595{
1596 // This will help avoid the menu keeping focus when the alt key is released
1597 // You can still trigger accelerators as long as you hold down alt
1598 if( message == WM_SYSCOMMAND )
1599 {
1600 if( wParam == SC_KEYMENU && ( lParam >> 16 ) <= 0 )
1601 return 0;
1602 }
1603
1604 return wxFrame::MSWWindowProc( message, wParam, lParam );
1605}
1606#endif
1607
1608
1617{
1618 ACTION_MENU* langsMenu = new ACTION_MENU( false, aControlTool );
1619 langsMenu->SetTitle( _( "Set Language" ) );
1620 langsMenu->SetIcon( BITMAPS::language );
1621
1622 wxString tooltip;
1623
1624 for( unsigned ii = 0; LanguagesList[ii].m_KI_Lang_Identifier != 0; ii++ )
1625 {
1626 wxString label;
1627
1628 if( LanguagesList[ii].m_DoNotTranslate )
1629 label = LanguagesList[ii].m_Lang_Label;
1630 else
1631 label = wxGetTranslation( LanguagesList[ii].m_Lang_Label );
1632
1633 wxMenuItem* item =
1634 new wxMenuItem( langsMenu,
1635 LanguagesList[ii].m_KI_Lang_Identifier, // wxMenuItem wxID
1636 label, tooltip, wxITEM_CHECK );
1637
1638 langsMenu->Append( item );
1639 }
1640
1641 // This must be done after the items are added
1642 aMasterMenu->Add( langsMenu );
1643}
void ShowAboutDialog(EDA_BASE_FRAME *aParent)
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
void ClearScaledBitmapCache()
Wipes out the scaled bitmap cache so that the icon theme can be changed.
Definition: bitmap.cpp:172
BITMAP_STORE * GetBitmapStore()
Definition: bitmap.cpp:92
static TOOL_ACTION paste
Definition: actions.h:70
static TOOL_ACTION about
Definition: actions.h:217
static TOOL_ACTION reportBug
Cursor control event types.
Definition: actions.h:221
static TOOL_ACTION copy
Definition: actions.h:69
static TOOL_ACTION donate
Definition: actions.h:219
static TOOL_ACTION listHotKeys
Definition: actions.h:218
static TOOL_ACTION getInvolved
Definition: actions.h:220
static TOOL_ACTION undo
Definition: actions.h:66
static TOOL_ACTION redo
Definition: actions.h:67
static TOOL_ACTION cut
Definition: actions.h:68
static TOOL_ACTION gettingStarted
Definition: actions.h:215
static TOOL_ACTION help
Definition: actions.h:216
Defines the structure of a menu based on ACTIONs.
Definition: action_menu.h:49
void SetTitle(const wxString &aTitle) override
Set title for the menu.
Definition: action_menu.cpp:92
void SetIcon(BITMAPS aIcon)
Assign an icon for the entry.
Definition: action_menu.cpp:78
wxMenuItem * Add(const wxString &aLabel, int aId, BITMAPS aIcon)
Add a wxWidgets-style entry to the menu.
Define the structure of a toolbar with buttons that invoke ACTIONs.
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:92
WINDOW_SETTINGS m_Window
Definition: app_settings.h:170
void ThemeChanged()
Notifies the store that the icon theme has been changed by the user, so caches must be invalidated.
Handle actions that are shared between different applications.
Dialog helper object to sit in the inheritance tree between wxDialog and any class written by wxFormB...
Definition: dialog_shim.h:83
The base frame for deriving all KiCad main window classes.
virtual wxString help_name()
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
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
Returns 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 windowClosing(wxCloseEvent &event)
(with its unexpected name so it does not collide with the real OnWindowClose() function provided in d...
virtual void OnCharHook(wxKeyEvent &aKeyEvent)
Capture the key event before it is sent to the GUI.
virtual int GetRedoCommandCount() const
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()
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 setupUIConditions()
Setup the UI conditions for the various actions and their controls in this frame.
void ensureWindowIsOnScreen()
void LoadWindowSettings(const WINDOW_SETTINGS *aCfg)
Load window settings from the given settings object.
std::vector< wxFileName > m_AcceptedFiles
virtual void CheckForAutoSaveFile(const wxFileName &aFileName)
Check if an auto save file exists for aFileName and takes the appropriate action depending on the use...
void OnKicadAbout(wxCommandEvent &event)
virtual void ClearUndoRedoList()
Clear the undo and redo list using ClearUndoORRedoList()
virtual void DoWithAcceptedFiles()
Execute action on accepted dropped file.
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()
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...
wxString m_perspective
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.
wxSize m_normalFrameSize
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)
void ShowPreferences(wxString aStartPage, wxString aStartParentPage)
Displays the preferences and settings of all opened editors paged dialog, starting with a particular ...
void initExitKey()
Sets 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 wxString GetRedoActionDescription() const
void FinishAUIInitialization()
virtual wxString GetCurrentFileName() const
Get the full filename + path of the currently opened file in the frame.
void ChangeUserUnits(EDA_UNITS aUnits)
void AddMenuLanguageList(ACTION_MENU *aMasterMenu, TOOL_INTERACTIVE *aControlTool)
Function AddMenuLanguageList creates a menu list for language choice, and add it as submenu to Master...
void SetMenuBar(wxMenuBar *menu_bar) override
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...
wxTimer * m_autoSaveTimer
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 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 ...
virtual PICKED_ITEMS_LIST * PopCommandFromRedoList()
Return the last command to undo and remove it from list, nothing is deleted.
void ClearFileHistory(FILE_HISTORY *aFileHistory=nullptr)
Removes all files from the file history.
std::map< int, UIUpdateHandler > m_uiUpdateMap
< Map containing the UI update handlers registered with wx for each action.
UNDO_REDO_CONTAINER m_redoList
virtual void LoadSettings(APP_SETTINGS_BASE *aCfg)
Load common frame parameters from a configuration file.
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Notification event that some of the common (suite-wide) settings have changed.
FILE_HISTORY * m_fileHistory
virtual void DeleteAutoSaveFile(const wxFileName &aFileName)
virtual void OnSize(wxSizeEvent &aEvent)
virtual wxString GetUndoActionDescription() const
virtual PICKED_ITEMS_LIST * PopCommandFromUndoList()
Return the last command to undo and remove it from list, nothing is deleted.
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)
Checks if aFileName can be written.
wxPoint m_normalFramePos
void OnMaximize(wxMaximizeEvent &aEvent)
virtual void OnDropFiles(wxDropFilesEvent &aEvent)
Handles event fired when a file is dropped to the window.
std::map< const wxString, TOOL_ACTION * > m_acceptedExts
Associates files 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)
Fetches the file name from the file history list.
static wxString GetAutoSaveFilePrefix()
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 onSystemColorChange(wxSysColourChangedEvent &aEvent)
virtual int GetUndoCommandCount() const
virtual void RegisterUIUpdateHandler(int aID, const ACTION_CONDITIONS &aConditions) override
Register a UI update handler for the control with ID aID.
virtual void PushCommandToRedoList(PICKED_ITEMS_LIST *aItem)
Add a command to redo in the redo list.
void ShowInfoBarError(const wxString &aErrorMsg, bool aShowCloseButton=false, WX_INFOBAR::MESSAGE_TYPE aType=WX_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...
bool m_isClosing
Set by NonUserClose() to indicate that the user did not request the current close.
void AddStandardHelpMenu(wxMenuBar *aMenuBar)
Adds the standard KiCad help menu to the menubar.
wxString m_mruPath
void ReCreateMenuBar()
Recreates the menu bar.
virtual void doReCreateMenuBar()
WX_INFOBAR * GetInfoBar()
Specialization of the wxAuiPaneInfo class for KiCad panels.
This class implements a file history object to store a list of files, that can then be added to a men...
Definition: file_history.h:43
void AddFileToHistory(const wxString &aFile) override
Adds a file to the history.
void ClearFileHistory()
Clear all entries from the file history.
void Save(APP_SETTINGS_BASE &aSettings)
Saves history into a JSON settings object.
void SetMaxFiles(size_t aMaxFiles)
Update the number of files that will be contained inside the file history.
void Load(const APP_SETTINGS_BASE &aSettings)
Loads history from a JSON settings object.
SEARCH_STACK & KifaceSearch()
Only for DSO specific 'non-library' files.
Definition: kiface_base.h:116
APP_SETTINGS_BASE * KifaceSettings() const
Definition: kiface_base.h:95
void GetActions(std::vector< TOOL_ACTION * > &aActions) const override
Append this Kiface's registered actions to the given list.
Definition: kiface_base.h:118
const wxString & GetHelpFileName() const
Return just the basename portion of the current help file.
Definition: kiface_base.h:112
A mix in class which holds the location of a wxWindow's KIWAY.
Definition: kiway_holder.h:37
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:53
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition: kiway.h:279
virtual void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged)
Call CommonSettingsChanged() on all KIWAY_PLAYERs.
Definition: kiway.cpp:643
virtual KIFACE * KiFACE(FACE_T aFaceId, bool doLoad=true)
Return the KIFACE* given a FACE_T.
Definition: kiway.cpp:202
@ FACE_SCH
eeschema DSO
Definition: kiway.h:286
@ FACE_PL_EDITOR
Definition: kiway.h:290
@ FACE_PCB
pcbnew DSO
Definition: kiway.h:287
@ FACE_GERBVIEW
Definition: kiway.h:289
virtual void GetActions(std::vector< TOOL_ACTION * > &aActions) const
Append all registered actions to the given list.
Definition: kiway.cpp:562
WX_TREEBOOK * GetTreebook()
Definition: paged_dialog.h:39
void SetInitialPage(const wxString &aPage, const wxString &aParentPage=wxEmptyString)
std::vector< TOOL_ACTION * > & ActionsList()
static wxString GetDefaultUserProjectsPath()
Gets the default path we point users to create projects.
Definition: paths.cpp:140
A holder to handle information on schematic or board items.
void SaveFileState(const wxString &aFileName, const WINDOW_SETTINGS *aWindowCfg, bool aOpen)
const PROJECT_FILE_STATE * GetFileState(const wxString &aFileName)
virtual PROJECT_LOCAL_SETTINGS & GetLocalSettings() const
Definition: project.h:172
Look for files in a number of paths.
Definition: search_stack.h:42
virtual wxWindow * GetToolCanvas() const =0
Canvas access.
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:167
virtual void ShowChangedLanguage()
TOOL_DISPATCHER * m_toolDispatcher
Definition: tools_holder.h:169
virtual SELECTION & GetCurrentSelection()
Get the current selection from the canvas area.
Definition: tools_holder.h:98
virtual void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged)
Notification event that some of the common (suite-wide) settings have changed.
int GetUIId() const
Definition: tool_action.h:339
@ REDRAW
Full drawing refresh.
Definition: tool_base.h:83
virtual void DispatchWxEvent(wxEvent &aEvent)
Process wxEvents (mostly UI events), translate them to TOOL_EVENTs, and make tools handle those.
bool RunAction(const std::string &aActionName, T aParam)
Run the specified action immediately, pausing the current action to run the new one.
Definition: tool_manager.h:145
void ResetTools(TOOL_BASE::RESET_REASON aReason)
Reset all tools (i.e.
void PushCommand(PICKED_ITEMS_LIST *aCommand)
PICKED_ITEMS_LIST * PopCommand()
std::vector< PICKED_ITEMS_LIST * > m_CommandsList
void SetUserUnits(EDA_UNITS aUnits)
Simple wrapper around wxBusyCursor for used with the generic BUSY_INDICATOR interface.
A modified version of the wxInfoBar class that allows us to:
Definition: wx_infobar.h:75
void RemoveAllButtons()
Remove all the buttons that have been added by the user.
Definition: wx_infobar.cpp:301
void ShowMessageFor(const wxString &aMessage, int aTime, int aFlags=wxICON_INFORMATION, MESSAGE_TYPE aType=WX_INFOBAR::MESSAGE_TYPE::GENERIC)
Show the infobar with the provided message and icon for a specific period of time.
Definition: wx_infobar.cpp:140
MESSAGE_TYPE
Sets the type of message for special handling if needed.
Definition: wx_infobar.h:93
void Dismiss() override
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).
Definition: wx_infobar.cpp:187
void AddCloseButton(const wxString &aTooltip=_("Hide this message."))
Add the default close button to the infobar on the right side.
Definition: wx_infobar.cpp:291
void SetCallback(std::function< void(void)> aCallback)
Provide a callback to be called when the infobar is dismissed (either by user action or timer).
Definition: wx_infobar.h:157
bool AddLazyPage(std::function< wxWindow *(wxWindow *aParent)> aLazyCtor, const wxString &text, bool bSelect=false, int imageId=NO_IMAGE)
Definition: wx_treebook.cpp:89
bool AddLazySubPage(std::function< wxWindow *(wxWindow *aParent)> aLazyCtor, const wxString &text, bool bSelect=false, int imageId=NO_IMAGE)
Definition: wx_treebook.cpp:96
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:305
This file is part of the common library.
const int minSize
Push and Shove router track width and via size dialog.
#define _(s)
static const wxSize minSizeLookup(FRAME_T aFrameType, wxWindow *aWindow)
#define LAZY_CTOR(key)
static const wxSize defaultSize(FRAME_T aFrameType, wxWindow *aWindow)
wxWindow * findQuasiModalDialog(wxWindow *aParent)
#define DEFAULT_MAX_UNDO_ITEMS
std::function< void(wxUpdateUIEvent &) > UIUpdateHandler
This is the handler functor for the update UI events.
void SocketCleanup()
Definition: eda_dde.cpp:319
DDE server & client.
EDA_UNITS
Definition: eda_units.h:46
FRAME_T
The set of EDA_BASE_FRAME derivatives, typically stored in EDA_BASE_FRAME::m_Ident.
Definition: frame_type.h:33
@ PANEL_PCB_GRIDS
Definition: frame_type.h:93
@ FRAME_PCB_EDITOR
Definition: frame_type.h:42
@ PANEL_SYM_EDIT_GRIDS
Definition: frame_type.h:73
@ FRAME_SCH_SYMBOL_EDITOR
Definition: frame_type.h:35
@ PANEL_SCH_FIELD_NAME_TEMPLATES
Definition: frame_type.h:82
@ PANEL_GBR_DISPLAY_OPTIONS
Definition: frame_type.h:103
@ PANEL_3DV_OPENGL
Definition: frame_type.h:100
@ PANEL_PCB_ORIGINS_AXES
Definition: frame_type.h:97
@ PANEL_PCB_EDIT_OPTIONS
Definition: frame_type.h:94
@ PANEL_SCH_DISP_OPTIONS
Definition: frame_type.h:77
@ PANEL_FP_DISPLAY_OPTIONS
Definition: frame_type.h:85
@ PANEL_SCH_SIMULATOR
Definition: frame_type.h:83
@ FRAME_SCH
Definition: frame_type.h:34
@ PANEL_DS_COLORS
Definition: frame_type.h:111
@ PANEL_PCB_COLORS
Definition: frame_type.h:95
@ PANEL_3DV_RAYTRACING
Definition: frame_type.h:101
@ PANEL_SYM_EDIT_OPTIONS
Definition: frame_type.h:74
@ PANEL_FP_GRIDS
Definition: frame_type.h:86
@ PANEL_SCH_EDIT_OPTIONS
Definition: frame_type.h:79
@ PANEL_FP_ORIGINS_AXES
Definition: frame_type.h:90
@ PANEL_SYM_DISP_OPTIONS
Definition: frame_type.h:72
@ PANEL_PCB_DISPLAY_OPTS
Definition: frame_type.h:92
@ PANEL_FP_COLORS
Definition: frame_type.h:88
@ PANEL_SYM_COLORS
Definition: frame_type.h:75
@ FRAME_PL_EDITOR
Definition: frame_type.h:59
@ PANEL_GBR_GRIDS
Definition: frame_type.h:106
@ FRAME_FOOTPRINT_EDITOR
Definition: frame_type.h:43
@ FRAME_GERBER
Definition: frame_type.h:57
@ PANEL_DS_GRIDS
Definition: frame_type.h:110
@ FRAME_PCB_DISPLAY3D
Definition: frame_type.h:47
@ PANEL_FP_EDIT_OPTIONS
Definition: frame_type.h:87
@ PANEL_SCH_ANNO_OPTIONS
Definition: frame_type.h:80
@ PANEL_SCH_GRIDS
Definition: frame_type.h:78
@ PANEL_PCB_ACTION_PLUGINS
Definition: frame_type.h:96
@ PANEL_FP_DEFAULT_VALUES
Definition: frame_type.h:89
@ PANEL_3DV_DISPLAY_OPTIONS
Definition: frame_type.h:99
@ PANEL_DS_DISPLAY_OPTIONS
Definition: frame_type.h:109
@ PANEL_SCH_COLORS
Definition: frame_type.h:81
@ PANEL_GBR_COLORS
Definition: frame_type.h:107
@ PANEL_GBR_EXCELLON_OPTIONS
Definition: frame_type.h:105
@ KICAD_MAIN_FRAME_T
Definition: frame_type.h:68
bool m_EnableGit
Enable git integration.
static const std::string GerberFileExtension
static bool IsGerberFileExtension(const wxString &ext)
const wxChar *const traceAutoSave
Flag to enable auto save feature debug tracing.
const wxChar *const kicadTraceKeyEvent
Flag to enable wxKeyEvent debug tracing.
const wxChar *const traceDisplayLocation
Flag to enable debug output of display positioning logic.
void ReadHotKeyConfigIntoActions(const wxString &aFileName, std::vector< TOOL_ACTION * > &aActions)
Reads a hotkey config file into a list of actions.
@ ID_FILE_LIST_CLEAR
Definition: id.h:87
@ ID_FILE1
Definition: id.h:84
@ ID_AUTO_SAVE_TIMER
Definition: id.h:79
void RemoveShutdownBlockReason(wxWindow *aWindow)
Removes any shutdown block reason set.
Definition: gtk/app.cpp:85
bool DuplicatePermissions(const wxString &aSrc, const wxString &aDest)
Duplicates the file security data from one file to another ensuring that they are the same between bo...
Definition: gtk/io.cpp:40
LANGUAGE_DESCR LanguagesList[]
An array containing all the languages that KiCad supports.
Definition: pgm_base.cpp:88
see class PGM_BASE
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:119
Functors that can be used to figure out how the action controls should be displayed in the UI and if ...
SELECTION_CONDITION enableCondition
Returns true if the UI control should be enabled.
SELECTION_CONDITION checkCondition
Returns true if the UI control should be checked.
SELECTION_CONDITION showCondition
Returns true if the UI control should be shown.
ACTION_CONDITIONS & Check(const SELECTION_CONDITION &aCondition)
Implement a participant in the KIWAY alchemy.
Definition: kiway.h:151
int m_KI_Lang_Identifier
KiCad identifier used in menu selection (See id.h)
Definition: pgm_base.h:67
wxString m_Lang_Label
Labels used in menus.
Definition: pgm_base.h:70
struct WINDOW_STATE window
Stores the common settings that are saved and loaded for each window / frame.
Definition: app_settings.h:74
WINDOW_STATE state
Definition: app_settings.h:75
wxString mru_path
Definition: app_settings.h:76
wxString perspective
Definition: app_settings.h:77
Stores the window positioning/state.
Definition: app_settings.h:61
unsigned int display
Definition: app_settings.h:67
IFACE KIFACE_BASE kiface("pcb_test_frame", KIWAY::FACE_PCB)
wxString dump(const wxArrayString &aArray)
Debug helper for printing wxArrayString contents.
wxLogTrace helper definitions.