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>
36#include <eda_dde.h>
37#include <file_history.h>
38#include <id.h>
39#include <kiface_base.h>
40#include <hotkeys_basic.h>
42#include <paths.h>
43#include <confirm.h>
45#include <pgm_base.h>
50#include <tool/action_manager.h>
51#include <tool/action_menu.h>
52#include <tool/action_toolbar.h>
53#include <tool/actions.h>
54#include <tool/common_control.h>
55#include <tool/tool_manager.h>
57#include <trace_helpers.h>
60#include <widgets/wx_infobar.h>
62#include <widgets/wx_grid.h>
63#include <widgets/wx_treebook.h>
64#include <wx/app.h>
65#include <wx/config.h>
66#include <wx/display.h>
67#include <wx/stdpaths.h>
68#include <wx/string.h>
69#include <kiplatform/app.h>
70#include <kiplatform/io.h>
71#include <kiplatform/ui.h>
72
73#include <functional>
74#include <kiface_ids.h>
75
76#ifdef KICAD_IPC_API
77#include <api/api_server.h>
78#endif
79
80
81// Minimum window size
82static const wxSize minSizeLookup( FRAME_T aFrameType, wxWindow* aWindow )
83{
84 switch( aFrameType )
85 {
87 return wxWindow::FromDIP( wxSize( 406, 354 ), aWindow );
88
89 default:
90 return wxWindow::FromDIP( wxSize( 500, 400 ), aWindow );
91 }
92}
93
94
95static const wxSize defaultSize( FRAME_T aFrameType, wxWindow* aWindow )
96{
97 switch( aFrameType )
98 {
100 return wxWindow::FromDIP( wxSize( 850, 540 ), aWindow );
101
102 default:
103 return wxWindow::FromDIP( wxSize( 1280, 720 ), aWindow );
104 }
105}
106
107
108BEGIN_EVENT_TABLE( EDA_BASE_FRAME, wxFrame )
109 // These event table entries are needed to handle events from the mac application menu
110 EVT_MENU( wxID_ABOUT, EDA_BASE_FRAME::OnKicadAbout )
111 EVT_MENU( wxID_PREFERENCES, EDA_BASE_FRAME::OnPreferences )
112
113 EVT_CHAR_HOOK( EDA_BASE_FRAME::OnCharHook )
114 EVT_MENU_OPEN( EDA_BASE_FRAME::OnMenuEvent )
115 EVT_MENU_CLOSE( EDA_BASE_FRAME::OnMenuEvent )
116 EVT_MENU_HIGHLIGHT_ALL( EDA_BASE_FRAME::OnMenuEvent )
117 EVT_MOVE( EDA_BASE_FRAME::OnMove )
118 EVT_SIZE( EDA_BASE_FRAME::OnSize )
119 EVT_MAXIMIZE( EDA_BASE_FRAME::OnMaximize )
120
121 EVT_SYS_COLOUR_CHANGED( EDA_BASE_FRAME::onSystemColorChange )
122 EVT_ICONIZE( EDA_BASE_FRAME::onIconize )
123END_EVENT_TABLE()
124
125
126void EDA_BASE_FRAME::commonInit( FRAME_T aFrameType )
127{
128 m_ident = aFrameType;
129 m_maximizeByDefault = false;
130 m_infoBar = nullptr;
131 m_settingsManager = nullptr;
132 m_fileHistory = nullptr;
133 m_supportsAutoSave = false;
134 m_autoSavePending = false;
135 m_undoRedoCountMax = DEFAULT_MAX_UNDO_ITEMS;
136 m_isClosing = false;
137 m_isNonUserClose = false;
138 m_autoSaveTimer = new wxTimer( this, ID_AUTO_SAVE_TIMER );
139 m_autoSaveRequired = false;
141 m_frameSize = defaultSize( aFrameType, this );
142 m_displayIndex = -1;
143
144 m_auimgr.SetArtProvider( new WX_AUI_DOCK_ART() );
145
146 m_settingsManager = &Pgm().GetSettingsManager();
147
148 // Set a reasonable minimal size for the frame
149 wxSize minSize = minSizeLookup( aFrameType, this );
150 SetSizeHints( minSize.x, minSize.y, -1, -1, -1, -1 );
151
152 // Store dimensions of the user area of the main window.
153 GetClientSize( &m_frameSize.x, &m_frameSize.y );
154
155 Connect( ID_AUTO_SAVE_TIMER, wxEVT_TIMER,
156 wxTimerEventHandler( EDA_BASE_FRAME::onAutoSaveTimer ) );
157
158 // hook wxEVT_CLOSE_WINDOW so we can call SaveSettings(). This function seems
159 // to be called before any other hook for wxCloseEvent, which is necessary.
160 Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( EDA_BASE_FRAME::windowClosing ) );
161
162 initExitKey();
163}
164
165
166EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent, FRAME_T aFrameType, const wxString& aTitle,
167 const wxPoint& aPos, const wxSize& aSize, long aStyle,
168 const wxString& aFrameName, KIWAY* aKiway,
169 const EDA_IU_SCALE& aIuScale ) :
170 wxFrame( aParent, wxID_ANY, aTitle, aPos, aSize, aStyle, aFrameName ),
171 TOOLS_HOLDER(),
172 KIWAY_HOLDER( aKiway, KIWAY_HOLDER::FRAME ),
174{
175 commonInit( aFrameType );
176}
177
178
179wxWindow* findQuasiModalDialog( wxWindow* aParent )
180{
181 for( wxWindow* child : aParent->GetChildren() )
182 {
183 if( DIALOG_SHIM* dlg = dynamic_cast<DIALOG_SHIM*>( child ) )
184 {
185 if( dlg->IsQuasiModal() )
186 return dlg;
187
188 if( wxWindow* nestedDlg = findQuasiModalDialog( child ) )
189 return nestedDlg;
190 }
191 }
192
193 return nullptr;
194}
195
196
198{
199 if( wxWindow* dlg = ::findQuasiModalDialog( this ) )
200 return dlg;
201
202 // FIXME: CvPcb is currently implemented on top of KIWAY_PLAYER rather than DIALOG_SHIM,
203 // so we have to look for it separately.
204 if( m_ident == FRAME_SCH )
205 {
206 wxWindow* cvpcb = wxWindow::FindWindowByName( wxS( "CvpcbFrame" ) );
207
208 if( cvpcb )
209 return cvpcb;
210 }
211
212 return nullptr;
213}
214
215
216void EDA_BASE_FRAME::windowClosing( wxCloseEvent& event )
217{
218 // Don't allow closing when a quasi-modal is open.
219 wxWindow* quasiModal = findQuasiModalDialog();
220
221 if( quasiModal )
222 {
223 // Raise and notify; don't give the user a warning regarding "quasi-modal dialogs"
224 // when they have no idea what those are.
225 quasiModal->Raise();
226 wxBell();
227
228 if( event.CanVeto() )
229 event.Veto();
230
231 return;
232 }
233
234
235 if( event.GetId() == wxEVT_QUERY_END_SESSION
236 || event.GetId() == wxEVT_END_SESSION )
237 {
238 // End session means the OS is going to terminate us
239 m_isNonUserClose = true;
240 }
241
242 if( canCloseWindow( event ) )
243 {
244 m_isClosing = true;
245
246 if( m_infoBar )
248
249 APP_SETTINGS_BASE* cfg = config();
250
251 if( cfg )
252 SaveSettings( cfg ); // virtual, wxFrame specific
253
255
256 // Destroy (safe delete frame) this frame only in non modal mode.
257 // In modal mode, the caller will call Destroy().
258 if( !IsModal() )
259 Destroy();
260 }
261 else
262 {
263 if( event.CanVeto() )
264 event.Veto();
265 }
266}
267
268
270{
271 delete m_autoSaveTimer;
272 delete m_fileHistory;
273
275
277
279}
280
281
282bool EDA_BASE_FRAME::ProcessEvent( wxEvent& aEvent )
283{
284#ifdef __WXMAC__
285 // Apple in its infinite wisdom will raise a disabled window before even passing
286 // us the event, so we have no way to stop it. Instead, we have to catch an
287 // improperly ordered disabled window and quasi-modal dialog here and reorder
288 // them.
289 if( !IsEnabled() && IsActive() )
290 {
291 wxWindow* dlg = findQuasiModalDialog();
292 if( dlg )
293 dlg->Raise();
294 }
295#endif
296
297 if( !wxFrame::ProcessEvent( aEvent ) )
298 return false;
299
300 if( Pgm().m_Quitting )
301 return true;
302
303 if( !m_isClosing && m_supportsAutoSave && IsShownOnScreen() && IsActive()
305 && GetAutoSaveInterval() > 0 )
306 {
307 if( !m_autoSavePending )
308 {
309 wxLogTrace( traceAutoSave, wxT( "Starting auto save timer." ) );
310 m_autoSaveTimer->Start( GetAutoSaveInterval() * 1000, wxTIMER_ONE_SHOT );
311 m_autoSavePending = true;
312 }
313 else if( m_autoSaveTimer->IsRunning() )
314 {
315 wxLogTrace( traceAutoSave, wxT( "Stopping auto save timer." ) );
316 m_autoSaveTimer->Stop();
317 m_autoSavePending = false;
318 }
319 }
320
321 return true;
322}
323
324
326{
328}
329
330
331void EDA_BASE_FRAME::onAutoSaveTimer( wxTimerEvent& aEvent )
332{
333 // Don't stomp on someone else's timer event.
334 if( aEvent.GetId() != ID_AUTO_SAVE_TIMER )
335 {
336 aEvent.Skip();
337 return;
338 }
339
340 if( !doAutoSave() )
341 m_autoSaveTimer->Start( GetAutoSaveInterval() * 1000, wxTIMER_ONE_SHOT );
342}
343
344
346{
347 wxCHECK_MSG( false, true, wxT( "Auto save timer function not overridden. Bad programmer!" ) );
348}
349
350
351void EDA_BASE_FRAME::OnCharHook( wxKeyEvent& aKeyEvent )
352{
353 wxLogTrace( kicadTraceKeyEvent, wxS( "EDA_BASE_FRAME::OnCharHook %s" ), dump( aKeyEvent ) );
354
355 // Key events can be filtered here.
356 // Currently no filtering is made.
357 aKeyEvent.Skip();
358}
359
360
361void EDA_BASE_FRAME::OnMenuEvent( wxMenuEvent& aEvent )
362{
363 if( !m_toolDispatcher )
364 aEvent.Skip();
365 else
367}
368
369
371{
373 std::placeholders::_1,
374 this,
375 aConditions );
376
377 m_uiUpdateMap[aID] = evtFunc;
378
379 Bind( wxEVT_UPDATE_UI, evtFunc, aID );
380}
381
382
384{
385 const auto it = m_uiUpdateMap.find( aID );
386
387 if( it == m_uiUpdateMap.end() )
388 return;
389
390 Unbind( wxEVT_UPDATE_UI, it->second, aID );
391}
392
393
394void EDA_BASE_FRAME::HandleUpdateUIEvent( wxUpdateUIEvent& aEvent, EDA_BASE_FRAME* aFrame,
395 ACTION_CONDITIONS aCond )
396{
397 bool checkRes = false;
398 bool enableRes = true;
399 bool showRes = true;
400 bool isCut = aEvent.GetId() == ACTIONS::cut.GetUIId();
401 bool isCopy = aEvent.GetId() == ACTIONS::copy.GetUIId();
402 bool isPaste = aEvent.GetId() == ACTIONS::paste.GetUIId();
403 SELECTION& selection = aFrame->GetCurrentSelection();
404
405 try
406 {
407 checkRes = aCond.checkCondition( selection );
408 enableRes = aCond.enableCondition( selection );
409 showRes = aCond.showCondition( selection );
410 }
411 catch( std::exception& )
412 {
413 // Something broke with the conditions, just skip the event.
414 aEvent.Skip();
415 return;
416 }
417
418 if( showRes && aEvent.GetId() == ACTIONS::undo.GetUIId() )
419 {
420 wxString msg = _( "Undo" );
421
422 if( enableRes )
423 msg += wxS( " " ) + aFrame->GetUndoActionDescription();
424
425 aEvent.SetText( msg );
426 }
427 else if( showRes && aEvent.GetId() == ACTIONS::redo.GetUIId() )
428 {
429 wxString msg = _( "Redo" );
430
431 if( enableRes )
432 msg += wxS( " " ) + aFrame->GetRedoActionDescription();
433
434 aEvent.SetText( msg );
435 }
436
437 if( isCut || isCopy || isPaste )
438 {
439 wxWindow* focus = wxWindow::FindFocus();
440 wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( focus );
441
442 if( textEntry && isCut && textEntry->CanCut() )
443 enableRes = true;
444 else if( textEntry && isCopy && textEntry->CanCopy() )
445 enableRes = true;
446 else if( textEntry && isPaste && textEntry->CanPaste() )
447 enableRes = true;
448 else if( dynamic_cast<WX_GRID*>( focus ) )
449 enableRes = false; // Must disable menu in order to get command as CharHook event
450 }
451
452 aEvent.Enable( enableRes );
453 aEvent.Show( showRes );
454
455 if( aEvent.IsCheckable() )
456 aEvent.Check( checkRes );
457}
458
459
461{
462 // Setup the conditions to check a language menu item
463 auto isCurrentLang =
464 [] ( const SELECTION& aSel, int aLangIdentifier )
465 {
466 return Pgm().GetSelectedLanguageIdentifier() == aLangIdentifier;
467 };
468
469 for( unsigned ii = 0; LanguagesList[ii].m_KI_Lang_Identifier != 0; ii++ )
470 {
472 cond.Check( std::bind( isCurrentLang, std::placeholders::_1,
473 LanguagesList[ii].m_WX_Lang_Identifier ) );
474
475 RegisterUIUpdateHandler( LanguagesList[ii].m_KI_Lang_Identifier, cond );
476 }
477}
478
479
481{
489 CallAfter( [this]()
490 {
491 if( !m_isClosing )
493 } );
494}
495
496
497void EDA_BASE_FRAME::SetMenuBar( wxMenuBar* menu_bar )
498{
499 wxFrame::SetMenuBar( menu_bar );
500
501 // Move Help menu back to end of menubar
502
503 int pos = GetMenuBar()->FindMenu( _( "&Help" ) + wxS( " " ) );
504
505 if( pos != wxNOT_FOUND )
506 {
507 wxMenu* helpMenu = GetMenuBar()->Remove( pos );
508 GetMenuBar()->Append( helpMenu, _( "&Help" ) + wxS( " " ) );
509 }
510}
511
512
513void EDA_BASE_FRAME::AddStandardHelpMenu( wxMenuBar* aMenuBar )
514{
516 ACTION_MENU* helpMenu = new ACTION_MENU( false, commonControl );
517
518 helpMenu->Add( ACTIONS::help );
519 helpMenu->Add( ACTIONS::gettingStarted );
520 helpMenu->Add( ACTIONS::listHotKeys );
521 helpMenu->Add( ACTIONS::getInvolved );
522 helpMenu->Add( ACTIONS::donate );
523 helpMenu->Add( ACTIONS::reportBug );
524
525 helpMenu->AppendSeparator();
526 helpMenu->Add( ACTIONS::about );
527
528 // Trailing space keeps OSX from hijacking our menu (and disabling everything in it).
529 aMenuBar->Append( helpMenu, _( "&Help" ) + wxS( " " ) );
530
531 // This change is only needed on macOS, and creates a bug on Windows
532 #ifdef __WXMAC__
533 helpMenu->wxMenu::SetTitle( _( "&Help" ) + wxS( " " ) );
534 #endif
535}
536
537
539{
541
542 if( GetMenuBar() )
543 {
545 GetMenuBar()->Refresh();
546 }
547}
548
549
550void EDA_BASE_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged )
551{
552 TOOLS_HOLDER::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
553
554 COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
555
556#ifdef KICAD_IPC_API
557 bool running = Pgm().GetApiServer().Running();
558
559 if( running && !settings->m_Api.enable_server )
560 Pgm().GetApiServer().Stop();
561 else if( !running && settings->m_Api.enable_server )
562 Pgm().GetApiServer().Start();
563#endif
564
565 if( m_fileHistory )
566 {
567 int historySize = settings->m_System.file_history_size;
568 m_fileHistory->SetMaxFiles( (unsigned) std::max( 0, historySize ) );
569 }
570
572 ThemeChanged();
573
574 if( GetMenuBar() )
575 {
576 // For icons in menus, icon scaling & hotkeys
578 GetMenuBar()->Refresh();
579 }
580}
581
582
584{
586
587 // Update all the toolbars to have new icons
588 wxAuiPaneInfoArray panes = m_auimgr.GetAllPanes();
589
590 for( size_t i = 0; i < panes.GetCount(); ++i )
591 {
592 if( ACTION_TOOLBAR* toolbar = dynamic_cast<ACTION_TOOLBAR*>( panes[i].window ) )
593 toolbar->RefreshBitmaps();
594 }
595}
596
597
598void EDA_BASE_FRAME::OnSize( wxSizeEvent& aEvent )
599{
600#ifdef __WXMAC__
601 int currentDisplay = wxDisplay::GetFromWindow( this );
602
603 if( m_displayIndex >= 0 && currentDisplay >= 0 && currentDisplay != m_displayIndex )
604 {
605 wxLogTrace( traceDisplayLocation, wxS( "OnSize: current display changed %d to %d" ),
606 m_displayIndex, currentDisplay );
607 m_displayIndex = currentDisplay;
609 }
610#endif
611
612 aEvent.Skip();
613}
614
615
616void EDA_BASE_FRAME::LoadWindowState( const wxString& aFileName )
617{
618 if( !Pgm().GetCommonSettings()->m_Session.remember_open_files )
619 return;
620
621 const PROJECT_FILE_STATE* state = Prj().GetLocalSettings().GetFileState( aFileName );
622
623 if( state != nullptr )
624 {
625 LoadWindowState( state->window );
626 }
627}
628
629
631{
632 bool wasDefault = false;
633
634 m_framePos.x = aState.pos_x;
635 m_framePos.y = aState.pos_y;
636 m_frameSize.x = aState.size_x;
637 m_frameSize.y = aState.size_y;
638
639 wxLogTrace( traceDisplayLocation, wxS( "Config position (%d, %d) with size (%d, %d)" ),
641
642 // Ensure minimum size is set if the stored config was zero-initialized
643 wxSize minSize = minSizeLookup( m_ident, this );
644 if( m_frameSize.x < minSize.x || m_frameSize.y < minSize.y )
645 {
647 wasDefault = true;
648
649 wxLogTrace( traceDisplayLocation, wxS( "Using minimum size (%d, %d)" ),
651 }
652
653 wxLogTrace( traceDisplayLocation, wxS( "Number of displays: %d" ), wxDisplay::GetCount() );
654
655 if( aState.display >= wxDisplay::GetCount() )
656 {
657 wxLogTrace( traceDisplayLocation, wxS( "Previous display not found" ) );
658
659 // If it isn't attached, use the first display
660 // Warning wxDisplay has 2 ctor variants. the parameter needs a type:
661 const unsigned int index = 0;
662 wxDisplay display( index );
663 wxRect clientSize = display.GetGeometry();
664
665 m_framePos = wxDefaultPosition;
666
667 // Ensure the window fits on the display, since the other one could have been larger
668 if( m_frameSize.x > clientSize.width )
669 m_frameSize.x = clientSize.width;
670
671 if( m_frameSize.y > clientSize.height )
672 m_frameSize.y = clientSize.height;
673 }
674 else
675 {
676 wxPoint upperRight( m_framePos.x + m_frameSize.x, m_framePos.y );
677 wxPoint upperLeft( m_framePos.x, m_framePos.y );
678
679 wxDisplay display( aState.display );
680 wxRect clientSize = display.GetClientArea();
681
682 int yLimTop = clientSize.y;
683 int yLimBottom = clientSize.y + clientSize.height;
684 int xLimLeft = clientSize.x;
685 int xLimRight = clientSize.x + clientSize.width;
686
687 if( upperLeft.x > xLimRight || // Upper left corner too close to right edge of screen
688 upperRight.x < xLimLeft || // Upper right corner too close to left edge of screen
689 upperLeft.y < yLimTop || // Upper corner too close to the bottom of the screen
690 upperLeft.y > yLimBottom )
691 {
692 m_framePos = wxDefaultPosition;
693 wxLogTrace( traceDisplayLocation, wxS( "Resetting to default position" ) );
694 }
695 }
696
697 wxLogTrace( traceDisplayLocation, wxS( "Final window position (%d, %d) with size (%d, %d)" ),
699
700 SetSize( m_framePos.x, m_framePos.y, m_frameSize.x, m_frameSize.y );
701
702 // Center the window if we reset to default
703 if( m_framePos.x == -1 )
704 {
705 wxLogTrace( traceDisplayLocation, wxS( "Centering window" ) );
706 Center();
707 m_framePos = GetPosition();
708 }
709
710 // Record the frame sizes in an un-maximized state
713
714 // Maximize if we were maximized before
715 if( aState.maximized || ( wasDefault && m_maximizeByDefault ) )
716 {
717 wxLogTrace( traceDisplayLocation, wxS( "Maximizing window" ) );
718 Maximize();
719 }
720
721 m_displayIndex = wxDisplay::GetFromWindow( this );
722}
723
724
726{
727 wxDisplay display( wxDisplay::GetFromWindow( this ) );
728 wxRect clientSize = display.GetClientArea();
729 wxPoint pos = GetPosition();
730 wxSize size = GetWindowSize();
731
732 wxLogTrace( traceDisplayLocation,
733 wxS( "ensureWindowIsOnScreen: clientArea (%d, %d) w %d h %d" ),
734 clientSize.x, clientSize.y,
735 clientSize.width, clientSize.height );
736
737 if( pos.y < clientSize.y )
738 {
739 wxLogTrace( traceDisplayLocation,
740 wxS( "ensureWindowIsOnScreen: y pos %d below minimum, setting to %d" ), pos.y,
741 clientSize.y );
742 pos.y = clientSize.y;
743 }
744
745 if( pos.x < clientSize.x )
746 {
747 wxLogTrace( traceDisplayLocation,
748 wxS( "ensureWindowIsOnScreen: x pos %d is off the client rect, setting to %d" ),
749 pos.x, clientSize.x );
750 pos.x = clientSize.x;
751 }
752
753 if( pos.x + size.x - clientSize.x > clientSize.width )
754 {
755 int newWidth = clientSize.width - ( pos.x - clientSize.x );
756 wxLogTrace( traceDisplayLocation,
757 wxS( "ensureWindowIsOnScreen: effective width %d above available %d, setting "
758 "to %d" ), pos.x + size.x, clientSize.width, newWidth );
759 size.x = newWidth;
760 }
761
762 if( pos.y + size.y - clientSize.y > clientSize.height )
763 {
764 int newHeight = clientSize.height - ( pos.y - clientSize.y );
765 wxLogTrace( traceDisplayLocation,
766 wxS( "ensureWindowIsOnScreen: effective height %d above available %d, setting "
767 "to %d" ), pos.y + size.y, clientSize.height, newHeight );
768 size.y = newHeight;
769 }
770
771 wxLogTrace( traceDisplayLocation, wxS( "Updating window position (%d, %d) with size (%d, %d)" ),
772 pos.x, pos.y, size.x, size.y );
773
774 SetSize( pos.x, pos.y, size.x, size.y );
775}
776
777
779{
780 LoadWindowState( aCfg->state );
781
783 m_mruPath = aCfg->mru_path;
784
786}
787
788
790{
791 if( IsIconized() )
792 return;
793
794 // If the window is maximized, we use the saved window size from before it was maximized
795 if( IsMaximized() )
796 {
799 }
800 else
801 {
803 m_framePos = GetPosition();
804 }
805
806 aCfg->state.pos_x = m_framePos.x;
807 aCfg->state.pos_y = m_framePos.y;
808 aCfg->state.size_x = m_frameSize.x;
809 aCfg->state.size_y = m_frameSize.y;
810 aCfg->state.maximized = IsMaximized();
811 aCfg->state.display = wxDisplay::GetFromWindow( this );
812
813 wxLogTrace( traceDisplayLocation, wxS( "Saving window maximized: %s" ),
814 IsMaximized() ? wxS( "true" ) : wxS( "false" ) );
815 wxLogTrace( traceDisplayLocation, wxS( "Saving config position (%d, %d) with size (%d, %d)" ),
817
818 // Once this is fully implemented, wxAuiManager will be used to maintain
819 // the persistence of the main frame and all it's managed windows and
820 // all of the legacy frame persistence position code can be removed.
821 aCfg->perspective = m_auimgr.SavePerspective().ToStdString();
822
823 aCfg->mru_path = m_mruPath;
824}
825
826
828{
830
831 // Get file history size from common settings
832 int fileHistorySize = Pgm().GetCommonSettings()->m_System.file_history_size;
833
834 // Load the recently used files into the history menu
835 m_fileHistory = new FILE_HISTORY( (unsigned) std::max( 1, fileHistorySize ),
837 m_fileHistory->Load( *aCfg );
838}
839
840
842{
843 wxCHECK( config(), /* void */ );
844
846
847 bool fileOpen = m_isClosing && m_isNonUserClose;
848
849 wxString currentlyOpenedFile = GetCurrentFileName();
850
851 if( Pgm().GetCommonSettings()->m_Session.remember_open_files && !currentlyOpenedFile.IsEmpty() )
852 {
853 wxFileName rfn( currentlyOpenedFile );
854 rfn.MakeRelativeTo( Prj().GetProjectPath() );
855 Prj().GetLocalSettings().SaveFileState( rfn.GetFullPath(), &aCfg->m_Window, fileOpen );
856 }
857
858 // Save the recently used files list
859 if( m_fileHistory )
860 {
861 // Save the currently opened file in the file history
862 if( !currentlyOpenedFile.IsEmpty() )
863 UpdateFileHistory( currentlyOpenedFile );
864
865 m_fileHistory->Save( *aCfg );
866 }
867}
868
869
871{
872 return &aCfg->m_Window;
873}
874
875
877{
878 // KICAD_MANAGER_FRAME overrides this
879 return Kiface().KifaceSettings();
880}
881
882
884{
885 return Kiface().KifaceSearch();
886}
887
888
890{
891 return Kiface().GetHelpFileName();
892}
893
894
895void EDA_BASE_FRAME::PrintMsg( const wxString& text )
896{
897 SetStatusText( text );
898}
899
900
902{
903#if defined( __WXOSX_MAC__ )
905#else
906 m_infoBar = new WX_INFOBAR( this, &m_auimgr );
907
908 m_auimgr.AddPane( m_infoBar, EDA_PANE().InfoBar().Name( wxS( "InfoBar" ) ).Top().Layer(1) );
909#endif
910}
911
912
914{
915#if defined( __WXOSX_MAC__ )
916 m_auimgr.Update();
917#else
918 // Call Update() to fix all pane default sizes, especially the "InfoBar" pane before
919 // hiding it.
920 m_auimgr.Update();
921
922 // We don't want the infobar displayed right away
923 m_auimgr.GetPane( wxS( "InfoBar" ) ).Hide();
924 m_auimgr.Update();
925#endif
926}
927
928
929void EDA_BASE_FRAME::ShowInfoBarError( const wxString& aErrorMsg, bool aShowCloseButton,
931{
933
934 if( aShowCloseButton )
936
937 GetInfoBar()->ShowMessageFor( aErrorMsg, 8000, wxICON_ERROR, aType );
938}
939
940
941void EDA_BASE_FRAME::ShowInfoBarError( const wxString& aErrorMsg, bool aShowCloseButton,
942 std::function<void(void)> aCallback )
943{
945
946 if( aShowCloseButton )
948
949 if( aCallback )
950 m_infoBar->SetCallback( aCallback );
951
952 GetInfoBar()->ShowMessageFor( aErrorMsg, 6000, wxICON_ERROR );
953}
954
955
956void EDA_BASE_FRAME::ShowInfoBarWarning( const wxString& aWarningMsg, bool aShowCloseButton )
957{
959
960 if( aShowCloseButton )
962
963 GetInfoBar()->ShowMessageFor( aWarningMsg, 6000, wxICON_WARNING );
964}
965
966
967void EDA_BASE_FRAME::ShowInfoBarMsg( const wxString& aMsg, bool aShowCloseButton )
968{
970
971 if( aShowCloseButton )
973
974 GetInfoBar()->ShowMessageFor( aMsg, 8000, wxICON_INFORMATION );
975}
976
977
978void EDA_BASE_FRAME::UpdateFileHistory( const wxString& FullFileName, FILE_HISTORY* aFileHistory )
979{
980 if( !aFileHistory )
981 aFileHistory = m_fileHistory;
982
983 wxASSERT( aFileHistory );
984
985 aFileHistory->AddFileToHistory( FullFileName );
986
987 // Update the menubar to update the file history menu
988 if( !m_isClosing && GetMenuBar() )
989 {
991 GetMenuBar()->Refresh();
992 }
993}
994
995
996wxString EDA_BASE_FRAME::GetFileFromHistory( int cmdId, const wxString& type,
997 FILE_HISTORY* aFileHistory )
998{
999 if( !aFileHistory )
1000 aFileHistory = m_fileHistory;
1001
1002 wxASSERT( aFileHistory );
1003
1004 int baseId = aFileHistory->GetBaseId();
1005
1006 wxASSERT( cmdId >= baseId && cmdId < baseId + (int) aFileHistory->GetCount() );
1007
1008 unsigned i = cmdId - baseId;
1009
1010 if( i < aFileHistory->GetCount() )
1011 {
1012 wxString fn = aFileHistory->GetHistoryFile( i );
1013
1014 if( wxFileName::FileExists( fn ) )
1015 {
1016 return fn;
1017 }
1018 else
1019 {
1020 DisplayErrorMessage( this, wxString::Format( _( "File '%s' was not found." ), fn ) );
1021 aFileHistory->RemoveFileFromHistory( i );
1022 }
1023 }
1024
1025 // Update the menubar to update the file history menu
1026 if( GetMenuBar() )
1027 {
1029 GetMenuBar()->Refresh();
1030 }
1031
1032 return wxEmptyString;
1033}
1034
1035
1037{
1038 if( !aFileHistory )
1039 aFileHistory = m_fileHistory;
1040
1041 wxASSERT( aFileHistory );
1042
1043 aFileHistory->ClearFileHistory();
1044
1045 // Update the menubar to update the file history menu
1046 if( GetMenuBar() )
1047 {
1049 GetMenuBar()->Refresh();
1050 }
1051}
1052
1053
1054void EDA_BASE_FRAME::OnKicadAbout( wxCommandEvent& event )
1055{
1056 void ShowAboutDialog( EDA_BASE_FRAME * aParent ); // See AboutDialog_main.cpp
1057 ShowAboutDialog( this );
1058}
1059
1060
1061void EDA_BASE_FRAME::OnPreferences( wxCommandEvent& event )
1062{
1063 ShowPreferences( wxEmptyString, wxEmptyString );
1064}
1065
1066
1067void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParentPage )
1068{
1069 PAGED_DIALOG dlg( this, _( "Preferences" ), true, true, wxEmptyString,
1070 wxWindow::FromDIP( wxSize( 980, 560 ), NULL ) );
1071
1072 dlg.SetEvtHandlerEnabled( false );
1073
1074 {
1075 WX_BUSY_INDICATOR busy_cursor;
1076
1077 WX_TREEBOOK* book = dlg.GetTreebook();
1078 PANEL_HOTKEYS_EDITOR* hotkeysPanel = new PANEL_HOTKEYS_EDITOR( this, book, false );
1079 KIFACE* kiface = nullptr;
1080 std::vector<int> expand;
1081
1082 Kiway().GetActions( hotkeysPanel->ActionsList() );
1083
1084 book->AddLazyPage(
1085 []( wxWindow* aParent ) -> wxWindow*
1086 {
1087 return new PANEL_COMMON_SETTINGS( aParent );
1088 },
1089 _( "Common" ) );
1090
1091 book->AddLazyPage(
1092 []( wxWindow* aParent ) -> wxWindow*
1093 {
1094 return new PANEL_MOUSE_SETTINGS( aParent );
1095 }, _( "Mouse and Touchpad" ) );
1096
1097 book->AddPage( hotkeysPanel, _( "Hotkeys" ) );
1098
1099 // This currently allows pre-defined repositories that we
1100 // don't use, so keep it disabled at the moment
1101 if( ADVANCED_CFG::GetCfg().m_EnableGit && false )
1102 {
1103 book->AddLazyPage(
1104 []( wxWindow* aParent ) -> wxWindow*
1105 {
1106 return new PANEL_GIT_REPOS( aParent );
1107 }, _( "Version Control" ) );
1108 }
1109
1110 #ifdef KICAD_USE_SENTRY
1111 book->AddLazyPage(
1112 []( wxWindow* aParent ) -> wxWindow*
1113 {
1114 return new PANEL_DATA_COLLECTION( aParent );
1115 }, _( "Data Collection" ) );
1116 #endif
1117
1118 #define LAZY_CTOR( key ) \
1119 [this, kiface]( wxWindow* aParent ) \
1120 { \
1121 return kiface->CreateKiWindow( aParent, key, &Kiway() ); \
1122 }
1123
1124 // If a dll is not loaded, the loader will show an error message.
1125
1126 try
1127 {
1129
1130 if( !kiface )
1131 return;
1132
1133 kiface->GetActions( hotkeysPanel->ActionsList() );
1134
1136 expand.push_back( (int) book->GetPageCount() );
1137
1138 book->AddPage( new wxPanel( book ), _( "Symbol Editor" ) );
1139 book->AddLazySubPage( LAZY_CTOR( PANEL_SYM_DISP_OPTIONS ), _( "Display Options" ) );
1140 book->AddLazySubPage( LAZY_CTOR( PANEL_SYM_EDIT_GRIDS ), _( "Grids" ) );
1141 book->AddLazySubPage( LAZY_CTOR( PANEL_SYM_EDIT_OPTIONS ), _( "Editing Options" ) );
1142 book->AddLazySubPage( LAZY_CTOR( PANEL_SYM_COLORS ), _( "Colors" ) );
1143
1144 if( GetFrameType() == FRAME_SCH )
1145 expand.push_back( (int) book->GetPageCount() );
1146
1147 book->AddPage( new wxPanel( book ), _( "Schematic Editor" ) );
1148 book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_DISP_OPTIONS ), _( "Display Options" ) );
1149 book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_GRIDS ), _( "Grids" ) );
1150 book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_EDIT_OPTIONS ), _( "Editing Options" ) );
1151 book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_ANNO_OPTIONS ), _( "Annotation Options" ) );
1152 book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_COLORS ), _( "Colors" ) );
1153 book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_FIELD_NAME_TEMPLATES ), _( "Field Name Templates" ) );
1154 book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_SIMULATOR ), _( "Simulator" ) );
1155 }
1156 catch( ... )
1157 {
1158 }
1159
1160 try
1161 {
1163
1164 if( !kiface )
1165 return;
1166
1167 kiface->GetActions( hotkeysPanel->ActionsList() );
1168
1170 expand.push_back( (int) book->GetPageCount() );
1171
1172 book->AddPage( new wxPanel( book ), _( "Footprint Editor" ) );
1173 book->AddLazySubPage( LAZY_CTOR( PANEL_FP_DISPLAY_OPTIONS ), _( "Display Options" ) );
1174 book->AddLazySubPage( LAZY_CTOR( PANEL_FP_GRIDS ), _( "Grids" ) );
1175 book->AddLazySubPage( LAZY_CTOR( PANEL_FP_ORIGINS_AXES ), _( "Origins & Axes" ) );
1176 book->AddLazySubPage( LAZY_CTOR( PANEL_FP_EDIT_OPTIONS ), _( "Editing Options" ) );
1177 book->AddLazySubPage( LAZY_CTOR( PANEL_FP_COLORS ), _( "Colors" ) );
1178 book->AddLazySubPage( LAZY_CTOR( PANEL_FP_DEFAULT_VALUES ), _( "Default Values" ) );
1179
1181 expand.push_back( (int) book->GetPageCount() );
1182
1183 book->AddPage( new wxPanel( book ), _( "PCB Editor" ) );
1184 book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_DISPLAY_OPTS ), _( "Display Options" ) );
1185 book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_GRIDS ), _( "Grids" ) );
1186 book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_ORIGINS_AXES ), _( "Origins & Axes" ) );
1187 book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_EDIT_OPTIONS ), _( "Editing Options" ) );
1188 book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_COLORS ), _( "Colors" ) );
1189 book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_ACTION_PLUGINS ), _( "Action Plugins" ) );
1190
1192 expand.push_back( (int) book->GetPageCount() );
1193
1194 book->AddPage( new wxPanel( book ), _( "3D Viewer" ) );
1195 book->AddLazySubPage( LAZY_CTOR( PANEL_3DV_DISPLAY_OPTIONS ), _( "General" ) );
1196 book->AddLazySubPage( LAZY_CTOR( PANEL_3DV_OPENGL ), _( "Realtime Renderer" ) );
1197 book->AddLazySubPage( LAZY_CTOR( PANEL_3DV_RAYTRACING ), _( "Raytracing Renderer" ) );
1198 }
1199 catch( ... )
1200 {
1201 }
1202
1203 try
1204 {
1206
1207 if( !kiface )
1208 return;
1209
1210 kiface->GetActions( hotkeysPanel->ActionsList() );
1211
1212 if( GetFrameType() == FRAME_GERBER )
1213 expand.push_back( (int) book->GetPageCount() );
1214
1215 book->AddPage( new wxPanel( book ), _( "Gerber Viewer" ) );
1216 book->AddLazySubPage( LAZY_CTOR( PANEL_GBR_DISPLAY_OPTIONS ), _( "Display Options" ) );
1217 book->AddLazySubPage( LAZY_CTOR( PANEL_GBR_COLORS ), _( "Colors" ) );
1218 book->AddLazySubPage( LAZY_CTOR( PANEL_GBR_GRIDS ), _( "Grids" ) );
1219 book->AddLazySubPage( LAZY_CTOR( PANEL_GBR_EXCELLON_OPTIONS ), _( "Excellon Options" ) );
1220 }
1221 catch( ... )
1222 {
1223 }
1224
1225 try
1226 {
1228
1229 if( !kiface )
1230 return;
1231
1232 kiface->GetActions( hotkeysPanel->ActionsList() );
1233
1234 if( GetFrameType() == FRAME_PL_EDITOR )
1235 expand.push_back( (int) book->GetPageCount() );
1236
1237 book->AddPage( new wxPanel( book ), _( "Drawing Sheet Editor" ) );
1238 book->AddLazySubPage( LAZY_CTOR( PANEL_DS_DISPLAY_OPTIONS ), _( "Display Options" ) );
1239 book->AddLazySubPage( LAZY_CTOR( PANEL_DS_GRIDS ), _( "Grids" ) );
1240 book->AddLazySubPage( LAZY_CTOR( PANEL_DS_COLORS ), _( "Colors" ) );
1241
1242 book->AddLazyPage(
1243 []( wxWindow* aParent ) -> wxWindow*
1244 {
1245 return new PANEL_PACKAGES_AND_UPDATES( aParent );
1246 }, _( "Packages and Updates" ) );
1247 }
1248 catch( ... )
1249 {
1250 }
1251
1252#ifdef KICAD_IPC_API
1253 book->AddPage( new PANEL_PLUGIN_SETTINGS( book ), _( "Plugins" ) );
1254#endif
1255
1256 // Update all of the action hotkeys. The process of loading the actions through
1257 // the KiFACE will only get us the default hotkeys
1258 ReadHotKeyConfigIntoActions( wxEmptyString, hotkeysPanel->ActionsList() );
1259
1260 for( size_t i = 0; i < book->GetPageCount(); ++i )
1261 book->GetPage( i )->Layout();
1262
1263 for( int page : expand )
1264 book->ExpandNode( page );
1265
1266 if( !aStartPage.IsEmpty() )
1267 dlg.SetInitialPage( aStartPage, aStartParentPage );
1268
1269 dlg.SetEvtHandlerEnabled( true );
1270#undef LAZY_CTOR
1271 }
1272
1273 if( dlg.ShowModal() == wxID_OK )
1274 {
1275 // Update our grids that are cached in the tool
1278 dlg.Kiway().CommonSettingsChanged( false, false );
1279 }
1280
1281}
1282
1283
1284void EDA_BASE_FRAME::OnDropFiles( wxDropFilesEvent& aEvent )
1285{
1286 wxString* files = aEvent.GetFiles();
1287
1288 for( int nb = 0; nb < aEvent.GetNumberOfFiles(); nb++ )
1289 {
1290 const wxFileName fn = wxFileName( files[nb] );
1291 wxString ext = fn.GetExt();
1292
1293 // Alias all gerber files as GerberFileExtension
1296
1297 if( m_acceptedExts.find( ext.ToStdString() ) != m_acceptedExts.end() )
1298 m_AcceptedFiles.emplace_back( fn );
1299 }
1300
1302 m_AcceptedFiles.clear();
1303}
1304
1305
1307{
1308 for( const wxFileName& file : m_AcceptedFiles )
1309 {
1310 wxString fn = file.GetFullPath();
1311 m_toolManager->RunAction<wxString*>( *m_acceptedExts.at( file.GetExt() ), &fn );
1312 }
1313}
1314
1315
1316bool EDA_BASE_FRAME::IsWritable( const wxFileName& aFileName, bool aVerbose )
1317{
1318 wxString msg;
1319 wxFileName fn = aFileName;
1320
1321 // Check for absence of a file path with a file name. Unfortunately KiCad
1322 // uses paths relative to the current project path without the ./ part which
1323 // confuses wxFileName. Making the file name path absolute may be less than
1324 // elegant but it solves the problem.
1325 if( fn.GetPath().IsEmpty() && fn.HasName() )
1326 fn.MakeAbsolute();
1327
1328 wxCHECK_MSG( fn.IsOk(), false,
1329 wxT( "File name object is invalid. Bad programmer!" ) );
1330 wxCHECK_MSG( !fn.GetPath().IsEmpty(), false,
1331 wxT( "File name object path <" ) + fn.GetFullPath() +
1332 wxT( "> is not set. Bad programmer!" ) );
1333
1334 if( fn.IsDir() && !fn.IsDirWritable() )
1335 {
1336 msg.Printf( _( "Insufficient permissions to folder '%s'." ), fn.GetPath() );
1337 }
1338 else if( !fn.FileExists() && !fn.IsDirWritable() )
1339 {
1340 msg.Printf( _( "Insufficient permissions to save file '%s'." ), fn.GetFullPath() );
1341 }
1342 else if( fn.FileExists() && !fn.IsFileWritable() )
1343 {
1344 msg.Printf( _( "Insufficient permissions to save file '%s'." ), fn.GetFullPath() );
1345 }
1346
1347 if( !msg.IsEmpty() )
1348 {
1349 if( aVerbose )
1350 DisplayErrorMessage( this, msg );
1351
1352 return false;
1353 }
1354
1355 return true;
1356}
1357
1358
1359void EDA_BASE_FRAME::CheckForAutoSaveFile( const wxFileName& aFileName )
1360{
1361 if( !Pgm().IsGUI() )
1362 return;
1363
1364 wxCHECK_RET( aFileName.IsOk(), wxT( "Invalid file name!" ) );
1365
1366 wxFileName autoSaveFileName = aFileName;
1367
1368 // Check for auto save file.
1369 autoSaveFileName.SetName( FILEEXT::AutoSaveFilePrefix + aFileName.GetName() );
1370
1371 wxLogTrace( traceAutoSave,
1372 wxT( "Checking for auto save file " ) + autoSaveFileName.GetFullPath() );
1373
1374 if( !autoSaveFileName.FileExists() )
1375 return;
1376
1377 wxString msg = wxString::Format( _( "Well this is potentially embarrassing!\n"
1378 "It appears that the last time you were editing\n"
1379 "%s\n"
1380 "KiCad exited before saving.\n"
1381 "\n"
1382 "Do you wish to open the auto-saved file instead?" ),
1383 aFileName.GetFullName() );
1384
1385 int response = wxMessageBox( msg, Pgm().App().GetAppDisplayName(), wxYES_NO | wxICON_QUESTION,
1386 this );
1387
1388 // Make a backup of the current file, delete the file, and rename the auto save file to
1389 // the file name.
1390 if( response == wxYES )
1391 {
1392 // Preserve the permissions of the current file
1393 KIPLATFORM::IO::DuplicatePermissions( aFileName.GetFullPath(), autoSaveFileName.GetFullPath() );
1394
1395 if( !wxRenameFile( autoSaveFileName.GetFullPath(), aFileName.GetFullPath() ) )
1396 {
1397 wxMessageBox( _( "The auto save file could not be renamed to the board file name." ),
1398 Pgm().App().GetAppDisplayName(), wxOK | wxICON_EXCLAMATION, this );
1399 }
1400 }
1401 else
1402 {
1403 DeleteAutoSaveFile( aFileName );
1404 }
1405}
1406
1407
1408void EDA_BASE_FRAME::DeleteAutoSaveFile( const wxFileName& aFileName )
1409{
1410 if( !Pgm().IsGUI() )
1411 return;
1412
1413 wxCHECK_RET( aFileName.IsOk(), wxT( "Invalid file name!" ) );
1414
1415 wxFileName autoSaveFn = aFileName;
1416 autoSaveFn.SetName( FILEEXT::AutoSaveFilePrefix + aFileName.GetName() );
1417
1418 if( autoSaveFn.FileExists() )
1419 {
1420 wxLogTrace( traceAutoSave, wxT( "Removing auto save file " ) + autoSaveFn.GetFullPath() );
1421 wxRemoveFile( autoSaveFn.GetFullPath() );
1422 }
1423}
1424
1425
1427{
1428 // This function should be overridden in child classes
1429 return false;
1430}
1431
1432
1434{
1435 wxAcceleratorEntry entries[1];
1436 entries[0].Set( wxACCEL_CTRL, int( 'Q' ), wxID_EXIT );
1437 wxAcceleratorTable accel( 1, entries );
1438 SetAcceleratorTable( accel );
1439}
1440
1441
1443{
1446}
1447
1448
1450{
1451 m_undoList.PushCommand( aNewitem );
1452
1453 // Delete the extra items, if count max reached
1454 if( m_undoRedoCountMax > 0 )
1455 {
1456 int extraitems = GetUndoCommandCount() - m_undoRedoCountMax;
1457
1458 if( extraitems > 0 )
1459 ClearUndoORRedoList( UNDO_LIST, extraitems );
1460 }
1461}
1462
1463
1465{
1466 m_redoList.PushCommand( aNewitem );
1467
1468 // Delete the extra items, if count max reached
1469 if( m_undoRedoCountMax > 0 )
1470 {
1471 int extraitems = GetRedoCommandCount() - m_undoRedoCountMax;
1472
1473 if( extraitems > 0 )
1474 ClearUndoORRedoList( REDO_LIST, extraitems );
1475 }
1476}
1477
1478
1480{
1481 return m_undoList.PopCommand();
1482}
1483
1484
1486{
1487 return m_redoList.PopCommand();
1488}
1489
1490
1492{
1493 if( GetUndoCommandCount() > 0 )
1494 return m_undoList.m_CommandsList.back()->GetDescription();
1495
1496 return wxEmptyString;
1497}
1498
1499
1501{
1502 if( GetRedoCommandCount() > 0 )
1503 return m_redoList.m_CommandsList.back()->GetDescription();
1504
1505 return wxEmptyString;
1506}
1507
1508
1510{
1511 m_autoSaveRequired = true;
1512}
1513
1514
1516{
1517 SetUserUnits( aUnits );
1519
1520 wxCommandEvent e( EDA_EVT_UNITS_CHANGED );
1521 e.SetInt( static_cast<int>( aUnits ) );
1522 e.SetClientData( this );
1523 ProcessEventLocally( e );
1524}
1525
1526
1527void EDA_BASE_FRAME::OnMaximize( wxMaximizeEvent& aEvent )
1528{
1529 // When we maximize the window, we want to save the old information
1530 // so that we can add it to the settings on next window load.
1531 // Contrary to the documentation, this event seems to be generated
1532 // when the window is also being unmaximized on OSX, so we only
1533 // capture the size information when we maximize the window when on OSX.
1534#ifdef __WXOSX__
1535 if( !IsMaximized() )
1536#endif
1537 {
1539 m_normalFramePos = GetPosition();
1540 wxLogTrace( traceDisplayLocation,
1541 "Maximizing window - Saving position (%d, %d) with size (%d, %d)",
1544 }
1545
1546 // Skip event to actually maximize the window
1547 aEvent.Skip();
1548}
1549
1550
1552{
1553#ifdef __WXGTK__
1554 wxSize winSize = GetSize();
1555
1556 // GTK includes the window decorations in the normal GetSize call,
1557 // so we have to use a GTK-specific sizing call that returns the
1558 // non-decorated window size.
1560 {
1561 int width = 0;
1562 int height = 0;
1563 GTKDoGetSize( &width, &height );
1564
1565 winSize.Set( width, height );
1566 }
1567#else
1568 wxSize winSize = GetSize();
1569#endif
1570
1571 return winSize;
1572}
1573
1574
1576{
1577 // Update the icon theme when the system theme changes and update the toolbars
1579 ThemeChanged();
1580
1581 // This isn't handled by ThemeChanged()
1582 if( GetMenuBar() )
1583 {
1584 // For icons in menus, icon scaling & hotkeys
1586 GetMenuBar()->Refresh();
1587 }
1588}
1589
1590
1591void EDA_BASE_FRAME::onSystemColorChange( wxSysColourChangedEvent& aEvent )
1592{
1593 // Call the handler to update the colors used in the frame
1595
1596 // Skip the change event to ensure the rest of the window controls get it
1597 aEvent.Skip();
1598}
1599
1600
1601void EDA_BASE_FRAME::onIconize( wxIconizeEvent& aEvent )
1602{
1603 // Call the handler
1604 handleIconizeEvent( aEvent );
1605
1606 // Skip the event.
1607 aEvent.Skip();
1608}
1609
1610
1611#ifdef _WIN32
1612WXLRESULT EDA_BASE_FRAME::MSWWindowProc( WXUINT message, WXWPARAM wParam, WXLPARAM lParam )
1613{
1614 // This will help avoid the menu keeping focus when the alt key is released
1615 // You can still trigger accelerators as long as you hold down alt
1616 if( message == WM_SYSCOMMAND )
1617 {
1618 if( wParam == SC_KEYMENU && ( lParam >> 16 ) <= 0 )
1619 return 0;
1620 }
1621
1622 return wxFrame::MSWWindowProc( message, wParam, lParam );
1623}
1624#endif
1625
1626
1635{
1636 ACTION_MENU* langsMenu = new ACTION_MENU( false, aControlTool );
1637 langsMenu->SetTitle( _( "Set Language" ) );
1638 langsMenu->SetIcon( BITMAPS::language );
1639
1640 wxString tooltip;
1641
1642 for( unsigned ii = 0; LanguagesList[ii].m_KI_Lang_Identifier != 0; ii++ )
1643 {
1644 wxString label;
1645
1646 if( LanguagesList[ii].m_DoNotTranslate )
1647 label = LanguagesList[ii].m_Lang_Label;
1648 else
1649 label = wxGetTranslation( LanguagesList[ii].m_Lang_Label );
1650
1651 wxMenuItem* item =
1652 new wxMenuItem( langsMenu,
1653 LanguagesList[ii].m_KI_Lang_Identifier, // wxMenuItem wxID
1654 label, tooltip, wxITEM_CHECK );
1655
1656 langsMenu->Append( item );
1657 }
1658
1659 // This must be done after the items are added
1660 aMasterMenu->Add( langsMenu );
1661}
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
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:84
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.
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:39
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:55
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:617
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:536
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:129
virtual COMMON_SETTINGS * GetCommonSettings() const
Definition: pgm_base.cpp:678
virtual int GetSelectedLanguageIdentifier() const
Definition: pgm_base.h:238
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition: pgm_base.h:142
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:43
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 const std::string AutoSaveFilePrefix
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
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: pgm_base.cpp:1059
LANGUAGE_DESCR LanguagesList[]
An array containing all the languages that KiCad supports.
Definition: pgm_base.cpp:94
see class PGM_BASE
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:73
wxString m_Lang_Label
Labels used in menus.
Definition: pgm_base.h:76
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.