KiCad PCB EDA Suite
Loading...
Searching...
No Matches
kicad_manager_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 CERN (www.cern.ch)
6 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, you may find one here:
20 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21 * or you may search the http://www.gnu.org website for the version 2 license,
22 * or you may write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24 */
25
26#include "kicad_id.h"
27#include "pcm.h"
28#include "pgm_kicad.h"
29#include "project_tree_pane.h"
31
32#include <advanced_config.h>
34#include <bitmaps.h>
35#include <build_version.h>
36#include <confirm.h>
40#include <eda_base_frame.h>
41#include <executable_names.h>
42#include <file_history.h>
43#include <policy_keys.h>
44#include <gestfich.h>
45#include <kiplatform/app.h>
46#include <kiplatform/policy.h>
47#include <build_version.h>
48#include <kiway.h>
49#include <kiway_express.h>
50#include <launch_ext.h>
52#include <reporter.h>
54#include <sch_file_versions.h>
56#include <tool/action_manager.h>
57#include <tool/action_toolbar.h>
58#include <tool/common_control.h>
60#include <tool/tool_manager.h>
65#include <widgets/kistatusbar.h>
66#include <wx/ffile.h>
67#include <wx/filedlg.h>
68#include <wx/dnd.h>
69#include <wx/process.h>
70#include <atomic>
71#include <update_manager.h>
72#include <jobs/jobset.h>
73
74#include <../pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h> // for SEXPR_BOARD_FILE_VERSION def
75
76
77#ifdef __WXMAC__
78#include <MacTypes.h>
79#include <ApplicationServices/ApplicationServices.h>
80#endif
81
82#include "kicad_manager_frame.h"
84
86
87
88#define EDITORS_CAPTION _( "Editors" )
89#define PROJECT_FILES_CAPTION _( "Project Files" )
90
91#define SEP() wxFileName::GetPathSeparator()
92
93
94// Menubar and toolbar event table
95BEGIN_EVENT_TABLE( KICAD_MANAGER_FRAME, EDA_BASE_FRAME )
96 // Window events
99
100 // Menu events
101 EVT_MENU( wxID_EXIT, KICAD_MANAGER_FRAME::OnExit )
110
111 // Range menu events
113 KICAD_MANAGER_FRAME::language_change )
114
116 EVT_MENU( ID_FILE_LIST_CLEAR, KICAD_MANAGER_FRAME::OnClearFileHistory )
117
118 // Special functions
119 EVT_MENU( ID_INIT_WATCHED_PATHS, KICAD_MANAGER_FRAME::OnChangeWatchedPaths )
120
121 // Drop files event
122 EVT_DROP_FILES( KICAD_MANAGER_FRAME::OnDropFiles )
123
124END_EVENT_TABLE()
125
126// See below the purpose of this include
127#include <wx/xml/xml.h>
128
129KICAD_MANAGER_FRAME::KICAD_MANAGER_FRAME( wxWindow* parent, const wxString& title,
130 const wxPoint& pos, const wxSize& size ) :
133 m_leftWin( nullptr ),
134 m_launcher( nullptr ),
135 m_mainToolBar( nullptr ),
136 m_lastToolbarIconSize( 0 )
137{
138 const int defaultLeftWinWidth = FromDIP( 250 );
139
140 m_active_project = false;
141 m_leftWinWidth = defaultLeftWinWidth; // Default value
142 m_aboutTitle = "KiCad";
143
144 // JPC: A very ugly hack to fix an issue on Linux: if the wxbase315u_xml_gcc_custom.so is
145 // used **only** in PCM, it is not found in some cases at run time.
146 // So just use it in the main module to avoid a not found issue
147 // wxbase315u_xml_gcc_custom shared object when launching Kicad
148 wxXmlDocument dummy;
149
150 // Create the status line (bottom of the frame). Left half is for project name; right half
151 // is for Reporter (currently used by archiver/unarchiver and PCM).
152 // Note: this is a KISTATUSBAR status bar. Therefore the specified number of fields
153 // is the extra number of fields, not the full field count.
154 // We need here 2 fields: the extra fiels to display the project name, and another field
155 // to display a info (specific to Windows) using the FIELD_OFFSET_BGJOB_TEXT id offset (=1)
156 // So the extra field count is 1
157 CreateStatusBar( 1 );
160 GetStatusBar()->SetFont( KIUI::GetStatusFont( this ) );
161
162 // Give an icon
163 wxIcon icon;
164 wxIconBundle icon_bundle;
165
166 if( IsNightlyVersion())
167 {
168 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_kicad_nightly, 48 ) );
169 icon_bundle.AddIcon( icon );
170 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_kicad_nightly, 128 ) );
171 icon_bundle.AddIcon( icon );
172 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_kicad_nightly, 256 ) );
173 icon_bundle.AddIcon( icon );
174 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_kicad_nightly_32 ) );
175 icon_bundle.AddIcon( icon );
176 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_kicad_nightly_16 ) );
177 icon_bundle.AddIcon( icon );
178 }
179 else
180 {
181 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_kicad, 48 ) );
182 icon_bundle.AddIcon( icon );
183 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_kicad, 128 ) );
184 icon_bundle.AddIcon( icon );
185 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_kicad, 256 ) );
186 icon_bundle.AddIcon( icon );
187 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_kicad_32 ) );
188 icon_bundle.AddIcon( icon );
189 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_kicad_16 ) );
190 icon_bundle.AddIcon( icon );
191 }
192
193 SetIcons( icon_bundle );
194
195 // Load the settings
196 LoadSettings( config() );
197
198 m_pcmButton = nullptr;
199 m_pcmUpdateCount = 0;
200
201 // Left window: is the box which display tree project
202 m_leftWin = new PROJECT_TREE_PANE( this );
203
204 setupTools();
205 setupUIConditions();
206
207 RecreateBaseLeftToolbar();
208 ReCreateMenuBar();
209
210 m_auimgr.SetManagedWindow( this );
211 m_auimgr.SetFlags( wxAUI_MGR_LIVE_RESIZE );
212
213 m_auimgr.AddPane( m_mainToolBar, EDA_PANE().VToolbar().Name( "MainToolbar" ).Left()
214 .Layer( 2 ) );
215
216 // BestSize() does not always set the actual pane size of m_leftWin to the required value.
217 // It happens when m_leftWin is too large (roughly > 1/3 of the kicad manager frame width.
218 // (Well, BestSize() sets the best size... not the window size)
219 // A trick is to use MinSize() to set the required pane width,
220 // and after give a reasonable MinSize value
221 m_auimgr.AddPane( m_leftWin, EDA_PANE().Palette().Name( "ProjectTree" ).Left().Layer( 1 )
222 .Caption( PROJECT_FILES_CAPTION ).PaneBorder( false )
223 .MinSize( m_leftWinWidth, -1 ).BestSize( m_leftWinWidth, -1 ) );
224
225 wxSize client_size = GetClientSize();
226 m_notebook = new wxAuiNotebook( this, wxID_ANY, wxPoint( client_size.x, client_size.y ),
227 FromDIP( wxSize( 700, 590 ) ),
228 wxAUI_NB_TOP | wxAUI_NB_CLOSE_ON_ALL_TABS | wxAUI_NB_TAB_MOVE
229 | wxAUI_NB_SCROLL_BUTTONS | wxNO_BORDER );
230
231 m_notebook->Bind( wxEVT_AUINOTEBOOK_PAGE_CLOSE,
233 m_notebook->Bind( wxEVT_AUINOTEBOOK_PAGE_CLOSED,
235 m_launcher = new PANEL_KICAD_LAUNCHER( m_notebook );
236
237 m_notebook->Freeze();
238 m_launcher->SetClosable( false );
239 m_notebook->AddPage( m_launcher, EDITORS_CAPTION, false );
240 m_notebook->SetTabCtrlHeight( 0 );
241 m_notebook->Thaw();
242
243 m_auimgr.AddPane( m_notebook, EDA_PANE()
244 .Canvas()
245 .Name( "Editors" )
246 .Center()
247 .Caption( EDITORS_CAPTION )
248 .PaneBorder( false )
249 .MinSize( m_notebook->GetBestSize() ) );
250
251 m_auimgr.Update();
252
253 // Now the actual m_leftWin size is set, give it a reasonable min width
254 m_auimgr.GetPane( m_leftWin ).MinSize( defaultLeftWinWidth, -1 );
255
256
257 wxSizer* mainSizer = GetSizer();
258
259 // Only fit the initial window size the first time KiCad is run.
260 if( mainSizer && config()->m_Window.state.size_x == 0 && config()->m_Window.state.size_y == 0 )
261 {
262 Layout();
263 mainSizer->Fit( this );
264 Center();
265 }
266
267 if( ADVANCED_CFG::GetCfg().m_HideVersionFromTitle )
268 SetTitle( wxT( "KiCad" ) );
269 else
270 SetTitle( wxString( "KiCad " ) + GetMajorMinorVersion() );
271
272 // Do not let the messages window have initial focus
273 m_leftWin->SetFocus();
274
275 // Init for dropping files
278
279 // Gerber files
280 // Note that all gerber files are aliased as GerberFileExtension
284
285 DragAcceptFiles( true );
286
287 // Ensure the window is on top
288 Raise();
289}
290
291
293{
295 Unbind( wxEVT_CHAR_HOOK, &TOOL_DISPATCHER::DispatchWxEvent, m_toolDispatcher );
296
297 m_notebook->Unbind( wxEVT_AUINOTEBOOK_PAGE_CLOSE,
299 m_notebook->Unbind( wxEVT_AUINOTEBOOK_PAGE_CLOSED,
301
304
305 // Shutdown all running tools
306 if( m_toolManager )
308
309 if( m_pcm )
310 m_pcm->StopBackgroundUpdate();
311
312 delete m_actions;
313 delete m_toolManager;
314 delete m_toolDispatcher;
315
316 m_auimgr.UnInit();
317}
318
320{
321 if( m_notebook->GetPageCount() == 1 )
322 m_notebook->SetTabCtrlHeight( 0 );
323 else
324 m_notebook->SetTabCtrlHeight( -1 );
325}
326
327
329{
331}
332
333
335{
336 wxAuiNotebook* ctrl = (wxAuiNotebook*) evt.GetEventObject();
337
338 wxWindow* pageWindow = ctrl->GetPage( evt.GetSelection() );
339
340 PANEL_NOTEBOOK_BASE* panel = dynamic_cast<PANEL_NOTEBOOK_BASE*>( pageWindow );
341
342 if( panel )
343 {
344 if( panel->GetClosable() )
345 {
346 if( !panel->GetCanClose() )
347 {
348 evt.Veto();
349 }
350
351 CallAfter(
352 [this]()
353 {
355 } );
356 }
357 else
358 {
359 evt.Veto();
360 }
361 }
362}
363
364
365wxStatusBar* KICAD_MANAGER_FRAME::OnCreateStatusBar( int number, long style, wxWindowID id,
366 const wxString& name )
367{
368 return new KISTATUSBAR( number, this, id );
369}
370
371
373{
374 // creates the PLUGIN_CONTENT_MANAGER, if not exists
375 if( m_pcm )
376 return;
377
378 m_pcm = std::make_shared<PLUGIN_CONTENT_MANAGER>(
379 [this]( int aUpdateCount )
380 {
381 m_pcmUpdateCount = aUpdateCount;
382
383 if( aUpdateCount > 0 )
384 {
386 wxS( "pcm" ),
387 _( "PCM Updates Available" ),
388 wxString::Format( _( "%d package update(s) avaliable" ), aUpdateCount ),
389 wxT( "" ) );
390 }
391 else
392 {
393 Pgm().GetNotificationsManager().Remove( wxS( "pcm" ) );
394 }
395
396 CallAfter(
397 [this]()
398 {
400 } );
401 });
402
403 m_pcm->SetRepositoryList( kicadSettings()->m_PcmRepositories );
404}
405
406
408{
409 // Create the manager
411 m_toolManager->SetEnvironment( nullptr, nullptr, nullptr, config(), this );
413
415
416 // Attach the events to the tool dispatcher
418 Bind( wxEVT_CHAR_HOOK, &TOOL_DISPATCHER::DispatchWxEvent, m_toolDispatcher );
419
420 // Register tools
424}
425
426
428{
430
432
433 wxASSERT( manager );
434
435 auto activeProject =
436 [this] ( const SELECTION& )
437 {
438 return m_active_project;
439 };
440
441#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
442
443 ACTION_CONDITIONS activeProjectCond;
444 activeProjectCond.Enable( activeProject );
445
446 manager->SetConditions( ACTIONS::saveAs, activeProjectCond );
447 manager->SetConditions( KICAD_MANAGER_ACTIONS::closeProject, activeProjectCond );
448 manager->SetConditions( KICAD_MANAGER_ACTIONS::newJobsetFile, activeProjectCond );
449 manager->SetConditions( KICAD_MANAGER_ACTIONS::openJobsetFile, activeProjectCond );
450
451 // These are just here for text boxes, search boxes, etc. in places such as the standard
452 // file dialogs.
456
457 // TODO: Switch this to an action
459
460#undef ENABLE
461}
462
463
465{
466 return m_leftWin;
467}
468
469
471{
473 wxASSERT( ret );
474 return ret;
475}
476
477
479{
480 KICAD_SETTINGS* ret = dynamic_cast<KICAD_SETTINGS*>( config() );
481 wxASSERT( ret );
482 return ret;
483}
484
485
487{
489 wxString( wxEmptyString );
490}
491
492
494{
495 wxFileName fn( GetProjectFileName() );
496
498 return fn.GetFullPath();
499}
500
501
503{
504 wxFileName fn( GetProjectFileName() );
505
507 return fn.GetFullPath();
508}
509
510
512{
513 wxFileName fn( GetProjectFileName() );
514
515 fn.SetExt( FILEEXT::PcbFileExtension );
516 return fn.GetFullPath();
517}
518
519
521{
522 wxFileName fn( GetProjectFileName() );
523
525 return fn.GetFullPath();
526}
527
528
530{
532}
533
534
536{
537 return PgmTop().SysSearch();
538}
539
540
542{
543 return PgmTop().GetHelpFileName();
544}
545
546
547void KICAD_MANAGER_FRAME::OnSize( wxSizeEvent& event )
548{
549 if( m_auimgr.GetManagedWindow() )
550 m_auimgr.Update();
551
552 PrintPrjInfo();
553
554#if defined( _WIN32 )
555 KISTATUSBAR* statusBar = static_cast<KISTATUSBAR*>( GetStatusBar() );
557#endif
558
559 event.Skip();
560}
561
562
564{
565 // All fileNames are now in m_AcceptedFiles vector.
566 // Check if contains a project file name and load project.
567 // If not, open files in dedicated app.
568 for( const wxFileName& fileName : m_AcceptedFiles )
569 {
570 wxString ext = fileName.GetExt();
571
573 {
574 wxString fn = fileName.GetFullPath();
575 m_toolManager->RunAction<wxString*>( *m_acceptedExts.at( fileName.GetExt() ), &fn );
576
577 return;
578 }
579 }
580
581 // Then stock gerber files in gerberFiles and run action for other files.
582 wxString gerberFiles;
583
584 // Gerbview editor should be able to open Gerber and drill files
585 for( const wxFileName& fileName : m_AcceptedFiles )
586 {
587 wxString ext = fileName.GetExt();
588
591 {
592 gerberFiles += wxT( '\"' );
593 gerberFiles += fileName.GetFullPath() + wxT( '\"' );
594 gerberFiles = gerberFiles.Pad( 1 );
595 }
596 else
597 {
598 wxString fn = fileName.GetFullPath();
599 m_toolManager->RunAction<wxString*>( *m_acceptedExts.at( fileName.GetExt() ), &fn );
600 }
601 }
602
603 // Execute Gerbviewer
604 if( !gerberFiles.IsEmpty() )
605 {
606 wxString fullEditorName = FindKicadFile( GERBVIEW_EXE );
607
608 if( wxFileExists( fullEditorName ) )
609 {
610 wxString command = fullEditorName + " " + gerberFiles;
612 &command );
613 }
614 }
615}
616
617
618bool KICAD_MANAGER_FRAME::canCloseWindow( wxCloseEvent& aEvent )
619{
620 KICAD_SETTINGS* settings = kicadSettings();
622
623 for( size_t i = 0; i < m_notebook->GetPageCount(); i++ )
624 {
625 wxWindow* page = m_notebook->GetPage( i );
626
627 if( PANEL_NOTEBOOK_BASE* panel = dynamic_cast<PANEL_NOTEBOOK_BASE*>( page ) )
628 {
629 if( !panel->GetCanClose() )
630 return false;
631 }
632 }
633
634 // CloseProject will recursively ask all the open editors if they need to save changes.
635 // If any of them cancel then we need to cancel closing the KICAD_MANAGER_FRAME.
636 if( CloseProject( true ) )
637 {
638 // Don't propagate event to frames which have already been closed
639 aEvent.StopPropagation();
640
641 return true;
642 }
643 else
644 {
645 if( aEvent.CanVeto() )
646 aEvent.Veto();
647
648 return false;
649 }
650}
651
652
654{
655#ifdef _WINDOWS_
656 // For some obscure reason, on Windows, when killing Kicad from the Windows task manager
657 // if a editor frame (schematic, library, board editor or fp editor) is open and has
658 // some edition to save, OnCloseWindow is run twice *at the same time*, creating race
659 // conditions between OnCloseWindow() code.
660 // Therefore I added (JPC) a ugly hack to discard the second call (unwanted) during
661 // execution of the first call (only one call is right).
662 // Note also if there is no change made in editors, this behavior does not happen.
663 static std::atomic<unsigned int> lock_close_event( 0 );
664
665 if( ++lock_close_event > 1 ) // Skip extra calls
666 {
667 return;
668 }
669#endif
670
671 for( size_t i = 0; i < m_notebook->GetPageCount(); i++ )
672 {
673 wxWindow* page = m_notebook->GetPage( i );
674
675 if( PANEL_NOTEBOOK_BASE* panel = dynamic_cast<PANEL_NOTEBOOK_BASE*>( page ) )
676 m_notebook->DeletePage( i );
677 }
678
679 m_leftWin->Show( false );
680 Pgm().m_Quitting = true;
681
682 Destroy();
683
684#ifdef _WINDOWS_
685 lock_close_event = 0; // Reenable event management
686#endif
687}
688
689
691{
693
694 if( !aIsExplicitUserSave && cfg.WasMigrated() )
695 return;
696
697 cfg.m_OpenJobSets.clear();
698
699 for( size_t i = 0; i < m_notebook->GetPageCount(); i++ )
700 {
701 if( PANEL_JOBSET* jobset = dynamic_cast<PANEL_JOBSET*>( m_notebook->GetPage( i ) ) )
702 {
703 wxFileName jobsetFn( jobset->GetFilePath() );
704 jobsetFn.MakeRelativeTo( Prj().GetProjectPath() );
705 cfg.m_OpenJobSets.emplace_back( jobsetFn.GetFullPath() );
706 }
707 }
708
709 cfg.SaveToFile( Prj().GetProjectPath() );
710}
711
712
713void KICAD_MANAGER_FRAME::OnExit( wxCommandEvent& event )
714{
715 Close( true );
716}
717
718
720{
721 if( !Kiway().PlayersClose( false ) )
722 return false;
723
724 bool shouldSaveProject = !Prj().GetLocalSettings().WasMigrated()
726
727 // Save the project file for the currently loaded project.
728 if( m_active_project )
729 {
731
732 if( shouldSaveProject )
733 {
735
736 if( aSave )
737 mgr.SaveProject();
738 }
739
740 m_active_project = false;
741 mgr.UnloadProject( &Prj() );
742 }
743
744 SetStatusText( "" );
745
746 // Traverse pages in reverse order so deleting them doesn't mess up our iterator.
747 for( int i = (int) m_notebook->GetPageCount() - 1; i >= 0; i-- )
748 {
749 wxWindow* page = m_notebook->GetPage( i );
750
751 if( PANEL_NOTEBOOK_BASE* panel = dynamic_cast<PANEL_NOTEBOOK_BASE*>( page ) )
752 {
753 if( panel->GetProjectTied() )
754 m_notebook->DeletePage( i );
755 }
756 }
757
760
761 return true;
762}
763
764
765void KICAD_MANAGER_FRAME::OpenJobsFile( const wxFileName& aFileName, bool aCreate,
766 bool aResaveProjectPreferences )
767{
768 for( size_t i = 0; i < m_notebook->GetPageCount(); i++ )
769 {
770 if( PANEL_JOBSET* panel = dynamic_cast<PANEL_JOBSET*>( m_notebook->GetPage( i ) ) )
771 {
772 if( aFileName.GetFullPath() == panel->GetFilePath() )
773 {
774 m_notebook->SetSelection( i );
775 return;
776 }
777 }
778 }
779
780 try
781 {
782 std::unique_ptr<JOBSET> jobsFile =
783 std::make_unique<JOBSET>( aFileName.GetFullPath().ToStdString() );
784
785 jobsFile->LoadFromFile();
786
787 PANEL_JOBSET* jobPanel = new PANEL_JOBSET( m_notebook, this, std::move( jobsFile ) );
788 jobPanel->SetProjectTied( true );
789 jobPanel->SetClosable( true );
790 m_notebook->AddPage( jobPanel, aFileName.GetFullName(), true );
792
793 if( aResaveProjectPreferences )
795 }
796 catch( ... )
797 {
798 DisplayErrorMessage( this, _( "Error opening jobs file" ) );
799 }
800}
801
802
803void KICAD_MANAGER_FRAME::LoadProject( const wxFileName& aProjectFileName )
804{
805 // The project file should be valid by the time we get here or something has gone wrong.
806 if( !aProjectFileName.Exists() )
807 return;
808
809 // Any open KIFACE's must be closed if they are not part of the new project.
810 // (We never want a KIWAY_PLAYER open on a KIWAY that isn't in the same project.)
811 // User is prompted here to close those KIWAY_PLAYERs:
812 if( !CloseProject( true ) )
813 return;
814
815 m_active_project = true;
816
817 Pgm().GetSettingsManager().LoadProject( aProjectFileName.GetFullPath() );
818
819 LoadWindowState( aProjectFileName.GetFullName() );
820
821 if( aProjectFileName.IsDirWritable() )
822 SetMruPath( Prj().GetProjectPath() ); // Only set MRU path if we have write access. Why?
823
824 // Save history & window state to disk now. Don't wait around for a crash.
825 KICAD_SETTINGS* settings = kicadSettings();
826 SaveSettings( settings );
827 settings->SaveToFile( Pgm().GetSettingsManager().GetPathForSettingsFile( settings ) );
828
830
831 for( const wxString& jobset : Prj().GetLocalSettings().m_OpenJobSets )
832 {
833 wxFileName jobsetFn( jobset );
834 jobsetFn.MakeAbsolute( Prj().GetProjectPath() );
835
836 if( jobsetFn.Exists() )
837 OpenJobsFile( jobsetFn.GetFullPath(), false, false );
838 }
839
840 // Rebuild the list of watched paths.
841 // however this is possible only when the main loop event handler is running,
842 // so we use it to run the rebuild function.
843 wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED, ID_INIT_WATCHED_PATHS );
844
845 wxPostEvent( this, cmd );
846
847 PrintPrjInfo();
848
849 KIPLATFORM::APP::RegisterApplicationRestart( aProjectFileName.GetFullPath() );
850 m_openSavedWindows = true;
851}
852
853
854void KICAD_MANAGER_FRAME::CreateNewProject( const wxFileName& aProjectFileName,
855 bool aCreateStubFiles )
856{
857 wxCHECK_RET( aProjectFileName.DirExists() && aProjectFileName.IsDirWritable(),
858 "Project folder must exist and be writable to create a new project." );
859
860 // If the project is legacy, convert it
861 if( !aProjectFileName.FileExists() )
862 {
863 wxFileName legacyPro( aProjectFileName );
864 legacyPro.SetExt( FILEEXT::LegacyProjectFileExtension );
865
866 if( legacyPro.FileExists() )
867 {
868 GetSettingsManager()->LoadProject( legacyPro.GetFullPath() );
870
871 wxRemoveFile( legacyPro.GetFullPath() );
872 }
873 else
874 {
875 // Copy template project file from template folder.
876 wxString srcFileName = sys_search().FindValidPath( "kicad.kicad_pro" );
877
878 wxFileName destFileName( aProjectFileName );
879 destFileName.SetExt( FILEEXT::ProjectFileExtension );
880
881 // Create a minimal project file if the template project file could not be copied
882 if( !wxFileName::FileExists( srcFileName )
883 || !wxCopyFile( srcFileName, destFileName.GetFullPath() ) )
884 {
885 wxFFile file( destFileName.GetFullPath(), "wb" );
886
887 if( file.IsOpened() )
888 file.Write( wxT( "{\n}\n") );
889
890 // wxFFile dtor will close the file
891 }
892 }
893 }
894
895 // Create a "stub" for a schematic root sheet and a board if requested.
896 // It will avoid messages from the schematic editor or the board editor to create a new file
897 // And forces the user to create main files under the right name for the project manager
898 if( aCreateStubFiles )
899 {
900 wxFileName fn( aProjectFileName.GetFullPath() );
902
903 // If a <project>.kicad_sch file does not exist, create a "stub" file ( minimal schematic
904 // file ).
905 if( !fn.FileExists() )
906 {
907 wxFFile file( fn.GetFullPath(), "wb" );
908
909 if( file.IsOpened() )
910 file.Write( wxString::Format( "(kicad_sch (version %d) (generator \"eeschema\") (generator_version \"%s\")\n"
911 " (paper \"A4\")\n (lib_symbols)\n"
912 " (symbol_instances)\n)\n",
914
915 // wxFFile dtor will close the file
916 }
917
918 // If a <project>.kicad_pcb or <project>.brd file does not exist,
919 // create a .kicad_pcb "stub" file
921 wxFileName leg_fn( fn );
922 leg_fn.SetExt( FILEEXT::LegacyPcbFileExtension );
923
924 if( !fn.FileExists() && !leg_fn.FileExists() )
925 {
926 wxFFile file( fn.GetFullPath(), "wb" );
927
928 if( file.IsOpened() )
929 // Create a small dummy file as a stub for pcbnew:
930 file.Write( wxString::Format( "(kicad_pcb (version %d) (generator \"pcbnew\") (generator_version \"%s\")\n)",
932
933 // wxFFile dtor will close the file
934 }
935 }
936
937 // Save history & window state to disk now. Don't wait around for a crash.
938 KICAD_SETTINGS* settings = kicadSettings();
939 SaveSettings( settings );
940 settings->SaveToFile( Pgm().GetSettingsManager().GetPathForSettingsFile( settings ) );
941
942 m_openSavedWindows = true;
943}
944
945
947{
948 // show all files in file dialog (in Kicad all files are editable texts):
949 wxString wildcard = FILEEXT::AllFilesWildcard();
950
951 wxString default_dir = Prj().GetProjectPath();
952
953 wxFileDialog dlg( this, _( "Edit File in Text Editor" ), default_dir, wxEmptyString, wildcard,
954 wxFD_OPEN );
955
956 if( dlg.ShowModal() == wxID_CANCEL )
957 return;
958
959 wxString filename = dlg.GetPath();
960
961 if( !dlg.GetPath().IsEmpty() && !Pgm().GetTextEditor().IsEmpty() )
963}
964
965
967{
968 // open project directory in host OS's file explorer
969 LaunchExternal( Prj().GetProjectPath() );
970}
971
972
974{
976}
977
978
979void KICAD_MANAGER_FRAME::language_change( wxCommandEvent& event )
980{
981 int id = event.GetId();
982 Kiway().SetLanguage( id );
983}
984
985
987{
988 // call my base class
990
991 // tooltips in toolbars
994
995 // update captions
996 int pageId = m_notebook->FindPage( m_launcher );
997
998 if( pageId != wxNOT_FOUND )
999 m_notebook->SetPageText( pageId, EDITORS_CAPTION );
1000
1001 m_auimgr.GetPane( m_leftWin ).Caption( PROJECT_FILES_CAPTION );
1002 m_auimgr.Update();
1003
1005
1006 PrintPrjInfo();
1007}
1008
1009
1010void KICAD_MANAGER_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged )
1011{
1012 EDA_BASE_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
1013
1014 if( m_pcm && aEnvVarsChanged )
1015 {
1016 m_pcm->ReadEnvVar();
1017 }
1018
1019 COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
1020
1021 if( m_lastToolbarIconSize == 0
1023 {
1026 }
1027}
1028
1029
1031{
1032 wxString file = GetProjectFileName();
1033 wxString title;
1034
1035 if( !file.IsEmpty() )
1036 {
1037 wxFileName fn( file );
1038
1039 title = fn.GetName();
1040
1041 if( !fn.IsDirWritable() )
1042 title += wxS( " " ) + _( "[Read Only]" );
1043 }
1044 else
1045 {
1046 title = _( "[no project loaded]" );
1047 }
1048
1049 if( ADVANCED_CFG::GetCfg().m_HideVersionFromTitle )
1050 title += wxT( " \u2014 " ) + wxString( wxS( "KiCad" ) );
1051 else
1052 title += wxT( " \u2014 " ) + wxString( wxS( "KiCad " ) ) + GetMajorMinorVersion();
1053
1054 SetTitle( title );
1055}
1056
1057
1059{
1061
1062 auto settings = dynamic_cast<KICAD_SETTINGS*>( aCfg );
1063
1064 wxCHECK( settings, /*void*/ );
1065
1066 m_leftWinWidth = settings->m_LeftWinWidth;
1067}
1068
1069
1071{
1073
1074 auto settings = dynamic_cast<KICAD_SETTINGS*>( aCfg );
1075
1076 wxCHECK( settings, /*void*/);
1077
1078 settings->m_LeftWinWidth = m_leftWin->GetSize().x;
1079
1080 if( !m_isClosing )
1081 settings->m_OpenProjects = GetSettingsManager()->GetOpenProjects();
1082}
1083
1084
1086{
1087 // wxStatusBar's wxELLIPSIZE_MIDDLE flag doesn't work (at least on Mac).
1088
1089 wxString status = wxString::Format( _( "Project: %s" ), Prj().GetProjectFullName() );
1090 KISTATUSBAR* statusBar = static_cast<KISTATUSBAR*>( GetStatusBar() );
1091 statusBar->SetEllipsedTextField( status, 0 );
1092}
1093
1094
1096{
1097 return m_active_project;
1098}
1099
1100
1101void KICAD_MANAGER_FRAME::OnIdle( wxIdleEvent& aEvent )
1102{
1108 if( !m_openSavedWindows )
1109 return;
1110
1111 m_openSavedWindows = false;
1112
1113 if( Pgm().GetCommonSettings()->m_Session.remember_open_files )
1114 {
1115 int previousOpenCount =
1116 std::count_if( Prj().GetLocalSettings().m_files.begin(),
1117 Prj().GetLocalSettings().m_files.end(),
1118 [&]( const PROJECT_FILE_STATE& f )
1119 {
1120 return !f.fileName.EndsWith( FILEEXT::ProjectFileExtension ) && f.open;
1121 } );
1122
1123 if( previousOpenCount > 0 )
1124 {
1125 APP_PROGRESS_DIALOG progressReporter( _( "Restoring session" ), wxEmptyString,
1126 previousOpenCount, this );
1127
1128 // We don't currently support opening more than one view per file
1129 std::set<wxString> openedFiles;
1130
1131 int i = 0;
1132
1133 for( const PROJECT_FILE_STATE& file : Prj().GetLocalSettings().m_files )
1134 {
1135 if( file.open && !openedFiles.count( file.fileName ) )
1136 {
1137 progressReporter.Update( i++,
1138 wxString::Format( _( "Restoring '%s'" ), file.fileName ) );
1139
1140 openedFiles.insert( file.fileName );
1141 wxFileName fn( file.fileName );
1142
1143 if( fn.GetExt() == FILEEXT::LegacySchematicFileExtension
1144 || fn.GetExt() == FILEEXT::KiCadSchematicFileExtension )
1145 {
1147 }
1148 else if( fn.GetExt() == FILEEXT::LegacyPcbFileExtension
1149 || fn.GetExt() == FILEEXT::KiCadPcbFileExtension )
1150 {
1152 }
1153 }
1154
1155 wxYield();
1156 }
1157 }
1158 }
1159
1160 // clear file states regardless if we opened windows or not due to setting
1162
1163 KICAD_SETTINGS* settings = kicadSettings();
1164
1165 if( !Pgm().GetCommonSettings()->m_DoNotShowAgain.update_check_prompt )
1166 {
1167 auto prompt = new DIALOG_UPDATE_CHECK_PROMPT( this );
1168 prompt->ShowModal();
1169
1171 }
1172
1174 && settings->m_PcmUpdateCheck )
1175 {
1176 if( !m_pcm )
1177 CreatePCM();
1178
1179 m_pcm->RunBackgroundUpdate();
1180 }
1181
1182#ifdef KICAD_UPDATE_CHECK
1183 if( !m_updateManager && settings->m_KiCadUpdateCheck )
1184 {
1185 m_updateManager = std::make_unique<UPDATE_MANAGER>();
1186 m_updateManager->CheckForUpdate( this );
1187 }
1188#endif
1189}
1190
1191
1193{
1194 m_pcmButton = aButton;
1195
1197}
1198
1199
1201{
1202 if( m_pcmButton )
1203 {
1204 if( m_pcmUpdateCount > 0 )
1205 {
1206 m_pcmButton->SetShowBadge( true );
1207 m_pcmButton->SetBadgeText( wxString::Format( "%d", m_pcmUpdateCount ) );
1208 }
1209 else
1210 {
1211 m_pcmButton->SetShowBadge( false );
1212 }
1213
1214 m_pcmButton->Refresh();
1215 }
1216}
1217
1218
1220{
1221 // No idea why, but the same mechanism used in EDA_DRAW_FRAME doesn't work here
1222 // the only thing that seems to work is to blow it all up and start from scratch.
1223 m_auimgr.DetachPane( m_mainToolBar );
1224 delete m_mainToolBar;
1225 m_mainToolBar = nullptr;
1227 m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Left()
1228 .Layer( 2 ) );
1229
1230 m_auimgr.Update();
1231}
const char * name
Definition: DXF_plotter.cpp:59
constexpr EDA_IU_SCALE unityScale
Definition: base_units.h:111
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Definition: bitmap.cpp:104
@ icon_kicad_16
@ icon_kicad_nightly
@ icon_kicad_32
@ icon_kicad_nightly_32
@ icon_kicad_nightly_16
wxString GetMajorMinorVersion()
Get only the major and minor version in a string major.minor.
bool IsNightlyVersion()
Check if the build is meant to be nightly.
static TOOL_ACTION paste
Definition: actions.h:73
static TOOL_ACTION saveAs
Definition: actions.h:52
static TOOL_ACTION copy
Definition: actions.h:71
static TOOL_ACTION cut
Definition: actions.h:70
Manage TOOL_ACTION objects.
void SetConditions(const TOOL_ACTION &aAction, const ACTION_CONDITIONS &aConditions)
Set the conditions the UI elements for activating a specific tool action should use for determining t...
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
wxProgressDialog with the option to also update the application progress on the taskbar
virtual bool Update(int aValue, const wxString &aNewMsg=wxEmptyString, bool *aSkip=nullptr) override
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:92
void UnregisterStatusBar(KISTATUSBAR *aStatusBar)
Removes status bar from handling.
void RegisterStatusBar(KISTATUSBAR *aStatusBar)
Add a status bar for handling.
A bitmap button widget that behaves like an AUI toolbar item's button when it is drawn.
Definition: bitmap_button.h:42
void SetBadgeText(const wxString &aText)
void SetShowBadge(bool aShowBadge)
Handle actions that are shared between different applications.
APPEARANCE m_Appearance
DO_NOT_SHOW_AGAIN m_DoNotShowAgain
The base frame for deriving all KiCad main window classes.
void LoadWindowState(const wxString &aFileName)
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
virtual void setupUIConditions()
Setup the UI conditions for the various actions and their controls in this frame.
std::vector< wxFileName > m_AcceptedFiles
SETTINGS_MANAGER * GetSettingsManager() const
wxAuiManager m_auimgr
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.
std::map< const wxString, TOOL_ACTION * > m_acceptedExts
Associate file extensions with action to execute.
virtual void SaveSettings(APP_SETTINGS_BASE *aCfg)
Save common frame parameters to a configuration data file.
void SetMruPath(const wxString &aPath)
virtual void RegisterUIUpdateHandler(int aID, const ACTION_CONDITIONS &aConditions) override
Register a UI update handler for the control with ID aID.
bool m_isClosing
Set by the close window event handler after frames are asked if they can close.
Specialization of the wxAuiPaneInfo class for KiCad panels.
virtual bool SaveToFile(const wxString &aDirectory="", bool aForce=false)
Calls Store() and then writes the contents of the JSON document to a file.
static TOOL_ACTION viewDroppedGerbers
static TOOL_ACTION editPCB
static TOOL_ACTION loadProject
static TOOL_ACTION editSchematic
static TOOL_ACTION openTextEditor
static TOOL_ACTION closeProject
static TOOL_ACTION openJobsetFile
static TOOL_ACTION newJobsetFile
Handle actions in the kicad manager frame.
The main KiCad project manager frame.
std::shared_ptr< PLUGIN_CONTENT_MANAGER > m_pcm
void language_change(wxCommandEvent &event)
void SetPcmButton(BITMAP_BUTTON *aButton)
void doCloseWindow() override
void CreateNewProject(const wxFileName &aProjectFileName, bool aCreateStubFiles=true)
Creates a new project by setting up and initial project, schematic, and board files.
void OnUnarchiveFiles(wxCommandEvent &event)
const SEARCH_STACK & sys_search() override
Return a SEARCH_STACK pertaining to entire program.
void OnImportEasyEdaProFiles(wxCommandEvent &event)
Open dialog to import EasyEDA Pro schematic and board files.
void ProjectChanged() override
Notification event that the project has changed.
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
const wxString SchLegacyFileName()
void RecreateBaseLeftToolbar()
(Re)Create the left vertical toolbar
wxWindow * GetToolCanvas() const override
Canvas access.
void OnImportEasyEdaFiles(wxCommandEvent &event)
Open dialog to import EasyEDA Std schematic and board files.
PROJECT_TREE_PANE * m_leftWin
const wxString GetProjectFileName() const
void OnBrowseInFileExplorer(wxCommandEvent &event)
KICAD_SETTINGS * kicadSettings() const
const wxString SchFileName()
void OnImportEagleFiles(wxCommandEvent &event)
Open dialog to import Eagle schematic and board files.
wxStatusBar * OnCreateStatusBar(int number, long style, wxWindowID id, const wxString &name) override
Create the status line (like a wxStatusBar).
void OnExit(wxCommandEvent &event)
void OpenJobsFile(const wxFileName &aFileName, bool aCreate=false, bool aResaveProjectPreferences=true)
void LoadProject(const wxFileName &aProjectFileName)
bool canCloseWindow(wxCloseEvent &aCloseEvent) override
void OnSize(wxSizeEvent &event) override
virtual void setupUIConditions() override
Setup the UI conditions for the various actions and their controls in this frame.
void DoWithAcceptedFiles() override
Execute action on accepted dropped file.
void OnOpenFileInTextEditor(wxCommandEvent &event)
APP_SETTINGS_BASE * config() const override
Return the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
const wxString PcbLegacyFileName()
KICAD_MANAGER_FRAME(wxWindow *parent, const wxString &title, const wxPoint &pos, const wxSize &size)
bool CloseProject(bool aSave)
Closes the project, and saves it if aSave is true;.
void onNotebookPageCloseRequest(wxAuiNotebookEvent &evt)
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
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.
void OnIdle(wxIdleEvent &event)
void PrintPrjInfo()
Prints the current working directory name and the project name on the text panel.
ACTION_TOOLBAR * m_mainToolBar
void SaveOpenJobSetsToLocalSettings(bool aIsExplicitUserSave=false)
void onNotebookPageCountChanged(wxAuiNotebookEvent &evt)
void OnArchiveFiles(wxCommandEvent &event)
void OnImportCadstarArchiveFiles(wxCommandEvent &event)
Open dialog to import CADSTAR Schematic and PCB Archive files.
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
BITMAP_BUTTON * m_pcmButton
PANEL_KICAD_LAUNCHER * m_launcher
void HideTabsIfNeeded()
Hides the tabs for Editor notebook if there is only 1 page.
wxString help_name() override
const wxString PcbFileName()
std::unique_ptr< UPDATE_MANAGER > m_updateManager
wxAuiNotebook * m_notebook
std::vector< wxString > m_OpenProjects
std::vector< std::pair< wxString, wxString > > m_PcmRepositories
KISTATUSBAR is a wxStatusBar suitable for Kicad manager.
Definition: kistatusbar.h:45
void SetEllipsedTextField(const wxString &aText, int aFieldId)
Set the text in a field using wxELLIPSIZE_MIDDLE option to adjust the text size to the field size.
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
virtual void SetLanguage(int aLanguage)
Change the language and then calls ShowChangedLanguage() on all #KIWAY_PLAYERs.
Definition: kiway.cpp:543
void RegisterStatusBar(KISTATUSBAR *aStatusBar)
Add a status bar for handling.
void CreateOrUpdate(const wxString &aKey, const wxString &aTitle, const wxString &aDescription, const wxString &aHref=wxEmptyString)
Create a notification with the given parameters or updates an existing one with the same key.
void Remove(const wxString &aKey)
Remove a notification by key.
void UnregisterStatusBar(KISTATUSBAR *aStatusBar)
Remove status bar from handling.
static REPORTER & GetInstance()
Definition: reporter.cpp:115
void SetClosable(bool aYes)
virtual bool GetCanClose()
void SetProjectTied(bool aYes)
virtual COMMON_SETTINGS * GetCommonSettings() const
Definition: pgm_base.cpp:689
virtual BACKGROUND_JOBS_MONITOR & GetBackgroundJobMonitor() const
Definition: pgm_base.h:129
bool m_Quitting
Definition: pgm_base.h:382
virtual NOTIFICATIONS_MANAGER & GetNotificationsManager() const
Definition: pgm_base.h:134
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition: pgm_base.h:125
wxString GetHelpFileName()
Definition: pgm_kicad.h:63
SEARCH_STACK & SysSearch()
Definition: pgm_kicad.h:61
APP_SETTINGS_BASE * PgmSettings()
Definition: pgm_kicad.h:59
bool WasMigrated() const
Definition: project_file.h:111
The project local settings are things that are attached to a particular project, but also might be pa...
bool SaveToFile(const wxString &aDirectory="", bool aForce=false) override
Calls Store() and then writes the contents of the JSON document to a file.
std::vector< wxString > m_OpenJobSets
PROJECT_TREE_PANE Window to display the tree files.
void EmptyTreePrj()
Delete all m_TreeProject entries.
void FileWatcherReset()
Reinit the watched paths Should be called after opening a new project to rebuild the list of watched ...
void ReCreateTreePrj()
Create or modify the tree showing project file names.
virtual const wxString GetProjectFullName() const
Return the full path and name of the project.
Definition: project.cpp:140
virtual const wxString GetProjectPath() const
Return the full path of the project.
Definition: project.cpp:146
virtual PROJECT_LOCAL_SETTINGS & GetLocalSettings() const
Definition: project.h:206
virtual PROJECT_FILE & GetProjectFile() const
Definition: project.h:200
Look for files in a number of paths.
Definition: search_stack.h:43
static bool ShowNever(const SELECTION &aSelection)
Always returns false.
bool SaveProject(const wxString &aFullPath=wxEmptyString, PROJECT *aProject=nullptr)
Save a loaded project.
bool LoadProject(const wxString &aFullPath, bool aSetActive=true)
Load a project or sets up a new project with a specified path.
bool IsProjectOpen() const
Helper for checking if we have a project open.
bool UnloadProject(PROJECT *aProject, bool aSave=true)
Save, unload and unregister the given PROJECT.
std::vector< wxString > GetOpenProjects() const
bool TriggerBackupIfNeeded(REPORTER &aReporter) const
Call BackupProject() if a new backup is needed according to the current backup policy.
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:167
TOOL_DISPATCHER * m_toolDispatcher
Definition: tools_holder.h:169
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:55
ACTIONS * m_actions
Definition: tools_holder.h:168
virtual void DispatchWxEvent(wxEvent &aEvent)
Process wxEvents (mostly UI events), translate them to TOOL_EVENTs, and make tools handle those.
Master controller class:
Definition: tool_manager.h:62
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:150
ACTION_MANAGER * GetActionManager() const
Definition: tool_manager.h:302
void RegisterTool(TOOL_BASE *aTool)
Add a tool to the manager set and sets it up.
void SetEnvironment(EDA_ITEM *aModel, KIGFX::VIEW *aView, KIGFX::VIEW_CONTROLS *aViewControls, APP_SETTINGS_BASE *aSettings, TOOLS_HOLDER *aFrame)
Set the work environment (model, view, view controls and the parent window).
void InitTools()
Initialize all registered tools.
void ShutdownAllTools()
Shutdown all tools with a currently registered event loop in this tool manager by waking them up with...
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:195
This file is part of the common library.
#define ENABLE(x)
#define _(s)
Base window classes and related definitions.
#define KICAD_DEFAULT_DRAWFRAME_STYLE
#define KICAD_MANAGER_FRAME_NAME
KiCad executable names.
const wxString GERBVIEW_EXE
@ KICAD_MAIN_FRAME_T
Definition: frame_type.h:68
wxString FindKicadFile(const wxString &shortname)
Search the executable file shortname in KiCad binary path and return full file name if found or short...
Definition: gestfich.cpp:58
static const std::string LegacySchematicFileExtension
static const std::string GerberJobFileExtension
static const std::string GerberFileExtension
static const std::string ProjectFileExtension
static const std::string LegacyPcbFileExtension
static const std::string LegacyProjectFileExtension
static const std::string KiCadSchematicFileExtension
static const std::string DrillFileExtension
static const std::string KiCadPcbFileExtension
static wxString AllFilesWildcard()
static bool IsGerberFileExtension(const wxString &ext)
@ ID_FILE_LIST_CLEAR
Definition: id.h:84
@ ID_LANGUAGE_CHOICE
Definition: id.h:102
@ ID_FILEMAX
Definition: id.h:82
@ ID_LANGUAGE_CHOICE_END
Definition: id.h:139
@ ID_FILE1
Definition: id.h:81
PGM_KICAD & PgmTop()
Definition: kicad.cpp:80
IDs used in KiCad main frame foe menuitems and tools.
@ ID_IMPORT_EAGLE_PROJECT
Definition: kicad_id.h:72
@ ID_IMPORT_EASYEDAPRO_PROJECT
Definition: kicad_id.h:74
@ ID_READ_ZIP_ARCHIVE
Definition: kicad_id.h:69
@ ID_SAVE_AND_ZIP_FILES
Definition: kicad_id.h:68
@ ID_INIT_WATCHED_PATHS
Definition: kicad_id.h:70
@ ID_IMPORT_CADSTAR_ARCHIVE_PROJECT
Definition: kicad_id.h:71
@ ID_EDIT_LOCAL_FILE_IN_TEXT_EDITOR
Definition: kicad_id.h:66
@ ID_IMPORT_EASYEDA_PROJECT
Definition: kicad_id.h:73
@ ID_BROWSE_IN_FILE_EXPLORER
Definition: kicad_id.h:67
EVT_MENU_RANGE(ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, KICAD_MANAGER_FRAME::language_change) KICAD_MANAGER_FRAME
#define EDITORS_CAPTION
#define PROJECT_FILES_CAPTION
bool LaunchExternal(const wxString &aPath)
Launches the given file or folder in the host OS.
Definition: launch_ext.cpp:25
bool RegisterApplicationRestart(const wxString &aCommandLine)
Registers the application for restart with the OS with the given command line string to pass as args.
Definition: unix/app.cpp:65
PBOOL GetPolicyBool(const wxString &aKey)
Definition: unix/policy.cpp:26
KICOMMON_API wxFont GetStatusFont(wxWindow *aWindow)
Definition: ui_common.cpp:131
#define SEXPR_BOARD_FILE_VERSION
Current s-expression file format version. 2 was the last legacy format version.
PGM_BASE & Pgm()
The global program "get" accessor.
Definition: pgm_base.cpp:1073
#define POLICY_KEY_PCM
Definition: policy_keys.h:31
#define SEXPR_SCHEMATIC_FILE_VERSION
Schematic file version.
KIWAY Kiway(KFCTL_STANDALONE)
std::vector< FAB_LAYER_COLOR > dummy
Functors that can be used to figure out how the action controls should be displayed in the UI and if ...
ACTION_CONDITIONS & Enable(const SELECTION_CONDITION &aCondition)
Definition of file extensions used in Kicad.