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,
214 EDA_PANE().VToolbar().Name( "MainToolbar" ).Left().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,
244 EDA_PANE().Canvas().Name( "Editors" ).Center().Caption( EDITORS_CAPTION )
245 .PaneBorder( false ).MinSize( m_notebook->GetBestSize() ) );
246
247 m_auimgr.Update();
248
249 // Now the actual m_leftWin size is set, give it a reasonable min width
250 m_auimgr.GetPane( m_leftWin ).MinSize( defaultLeftWinWidth, -1 );
251
252
253 wxSizer* mainSizer = GetSizer();
254
255 // Only fit the initial window size the first time KiCad is run.
256 if( mainSizer && config()->m_Window.state.size_x == 0 && config()->m_Window.state.size_y == 0 )
257 {
258 Layout();
259 mainSizer->Fit( this );
260 Center();
261 }
262
263 if( ADVANCED_CFG::GetCfg().m_HideVersionFromTitle )
264 SetTitle( wxT( "KiCad" ) );
265 else
266 SetTitle( wxString( "KiCad " ) + GetMajorMinorVersion() );
267
268 // Do not let the messages window have initial focus
269 m_leftWin->SetFocus();
270
271 // Init for dropping files
274
275 // Gerber files
276 // Note that all gerber files are aliased as GerberFileExtension
280
281 DragAcceptFiles( true );
282
283 // Ensure the window is on top
284 Raise();
285}
286
287
289{
291 Unbind( wxEVT_CHAR_HOOK, &TOOL_DISPATCHER::DispatchWxEvent, m_toolDispatcher );
292
293 m_notebook->Unbind( wxEVT_AUINOTEBOOK_PAGE_CLOSE,
295 m_notebook->Unbind( wxEVT_AUINOTEBOOK_PAGE_CLOSED,
297
300
301 // Shutdown all running tools
302 if( m_toolManager )
304
305 if( m_pcm )
306 m_pcm->StopBackgroundUpdate();
307
308 delete m_actions;
309 delete m_toolManager;
310 delete m_toolDispatcher;
311
312 m_auimgr.UnInit();
313}
314
316{
317 if( m_notebook->GetPageCount() == 1 )
318 m_notebook->SetTabCtrlHeight( 0 );
319 else
320 m_notebook->SetTabCtrlHeight( -1 );
321}
322
323
325{
327}
328
329
331{
332 wxAuiNotebook* notebook = (wxAuiNotebook*) evt.GetEventObject();
333 wxWindow* page = notebook->GetPage( evt.GetSelection() );
334
335 if( PANEL_NOTEBOOK_BASE* panel = dynamic_cast<PANEL_NOTEBOOK_BASE*>( page ) )
336 {
337 if( panel->GetClosable() )
338 {
339 if( !panel->GetCanClose() )
340 evt.Veto();
341
342 CallAfter(
343 [this]()
344 {
346 } );
347 }
348 else
349 {
350 evt.Veto();
351 }
352 }
353}
354
355
356wxStatusBar* KICAD_MANAGER_FRAME::OnCreateStatusBar( int number, long style, wxWindowID id,
357 const wxString& name )
358{
359 return new KISTATUSBAR( number, this, id );
360}
361
362
364{
365 // creates the PLUGIN_CONTENT_MANAGER, if not exists
366 if( m_pcm )
367 return;
368
369 m_pcm = std::make_shared<PLUGIN_CONTENT_MANAGER>(
370 [this]( int aUpdateCount )
371 {
372 m_pcmUpdateCount = aUpdateCount;
373
374 if( aUpdateCount > 0 )
375 {
377 wxS( "pcm" ),
378 _( "PCM Updates Available" ),
379 wxString::Format( _( "%d package update(s) avaliable" ), aUpdateCount ),
380 wxT( "" ) );
381 }
382 else
383 {
384 Pgm().GetNotificationsManager().Remove( wxS( "pcm" ) );
385 }
386
387 CallAfter(
388 [this]()
389 {
391 } );
392 });
393
394 m_pcm->SetRepositoryList( kicadSettings()->m_PcmRepositories );
395}
396
397
399{
400 // Create the manager
402 m_toolManager->SetEnvironment( nullptr, nullptr, nullptr, config(), this );
404
406
407 // Attach the events to the tool dispatcher
409 Bind( wxEVT_CHAR_HOOK, &TOOL_DISPATCHER::DispatchWxEvent, m_toolDispatcher );
410
411 // Register tools
415}
416
417
419{
421
423
424 wxASSERT( manager );
425
426 auto activeProject =
427 [this] ( const SELECTION& )
428 {
429 return m_active_project;
430 };
431
432#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
433
434 ACTION_CONDITIONS activeProjectCond;
435 activeProjectCond.Enable( activeProject );
436
437 manager->SetConditions( ACTIONS::saveAs, activeProjectCond );
438 manager->SetConditions( KICAD_MANAGER_ACTIONS::closeProject, activeProjectCond );
439 manager->SetConditions( KICAD_MANAGER_ACTIONS::newJobsetFile, activeProjectCond );
440 manager->SetConditions( KICAD_MANAGER_ACTIONS::openJobsetFile, activeProjectCond );
441
442 // These are just here for text boxes, search boxes, etc. in places such as the standard
443 // file dialogs.
447
448 // TODO: Switch this to an action
450
451#undef ENABLE
452}
453
454
456{
457 return m_leftWin;
458}
459
460
462{
464 wxASSERT( ret );
465 return ret;
466}
467
468
470{
471 KICAD_SETTINGS* ret = dynamic_cast<KICAD_SETTINGS*>( config() );
472 wxASSERT( ret );
473 return ret;
474}
475
476
478{
480 wxString( wxEmptyString );
481}
482
483
485{
486 wxFileName fn( GetProjectFileName() );
487
489 return fn.GetFullPath();
490}
491
492
494{
495 wxFileName fn( GetProjectFileName() );
496
498 return fn.GetFullPath();
499}
500
501
503{
504 wxFileName fn( GetProjectFileName() );
505
506 fn.SetExt( FILEEXT::PcbFileExtension );
507 return fn.GetFullPath();
508}
509
510
512{
513 wxFileName fn( GetProjectFileName() );
514
516 return fn.GetFullPath();
517}
518
519
521{
523}
524
525
527{
528 return PgmTop().SysSearch();
529}
530
531
533{
534 return PgmTop().GetHelpFileName();
535}
536
537
538void KICAD_MANAGER_FRAME::OnSize( wxSizeEvent& event )
539{
540 if( m_auimgr.GetManagedWindow() )
541 m_auimgr.Update();
542
543 PrintPrjInfo();
544
545#if defined( _WIN32 )
546 KISTATUSBAR* statusBar = static_cast<KISTATUSBAR*>( GetStatusBar() );
548#endif
549
550 event.Skip();
551}
552
553
555{
556 // All fileNames are now in m_AcceptedFiles vector.
557 // Check if contains a project file name and load project.
558 // If not, open files in dedicated app.
559 for( const wxFileName& fileName : m_AcceptedFiles )
560 {
561 wxString ext = fileName.GetExt();
562
564 {
565 wxString fn = fileName.GetFullPath();
566 m_toolManager->RunAction<wxString*>( *m_acceptedExts.at( fileName.GetExt() ), &fn );
567
568 return;
569 }
570 }
571
572 // Then stock gerber files in gerberFiles and run action for other files.
573 wxString gerberFiles;
574
575 // Gerbview editor should be able to open Gerber and drill files
576 for( const wxFileName& fileName : m_AcceptedFiles )
577 {
578 wxString ext = fileName.GetExt();
579
582 {
583 gerberFiles += wxT( '\"' );
584 gerberFiles += fileName.GetFullPath() + wxT( '\"' );
585 gerberFiles = gerberFiles.Pad( 1 );
586 }
587 else
588 {
589 wxString fn = fileName.GetFullPath();
590 m_toolManager->RunAction<wxString*>( *m_acceptedExts.at( fileName.GetExt() ), &fn );
591 }
592 }
593
594 // Execute Gerbviewer
595 if( !gerberFiles.IsEmpty() )
596 {
597 wxString fullEditorName = FindKicadFile( GERBVIEW_EXE );
598
599 if( wxFileExists( fullEditorName ) )
600 {
601 wxString command = fullEditorName + " " + gerberFiles;
603 &command );
604 }
605 }
606}
607
608
609bool KICAD_MANAGER_FRAME::canCloseWindow( wxCloseEvent& aEvent )
610{
611 KICAD_SETTINGS* settings = kicadSettings();
613
614 for( size_t i = 0; i < m_notebook->GetPageCount(); i++ )
615 {
616 wxWindow* page = m_notebook->GetPage( i );
617
618 if( PANEL_NOTEBOOK_BASE* panel = dynamic_cast<PANEL_NOTEBOOK_BASE*>( page ) )
619 {
620 if( !panel->GetCanClose() )
621 return false;
622 }
623 }
624
625 // CloseProject will recursively ask all the open editors if they need to save changes.
626 // If any of them cancel then we need to cancel closing the KICAD_MANAGER_FRAME.
627 if( CloseProject( true ) )
628 {
629 // Don't propagate event to frames which have already been closed
630 aEvent.StopPropagation();
631
632 return true;
633 }
634 else
635 {
636 if( aEvent.CanVeto() )
637 aEvent.Veto();
638
639 return false;
640 }
641}
642
643
645{
646#ifdef _WINDOWS_
647 // For some obscure reason, on Windows, when killing Kicad from the Windows task manager
648 // if a editor frame (schematic, library, board editor or fp editor) is open and has
649 // some edition to save, OnCloseWindow is run twice *at the same time*, creating race
650 // conditions between OnCloseWindow() code.
651 // Therefore I added (JPC) a ugly hack to discard the second call (unwanted) during
652 // execution of the first call (only one call is right).
653 // Note also if there is no change made in editors, this behavior does not happen.
654 static std::atomic<unsigned int> lock_close_event( 0 );
655
656 if( ++lock_close_event > 1 ) // Skip extra calls
657 {
658 return;
659 }
660#endif
661
662 for( size_t i = 0; i < m_notebook->GetPageCount(); i++ )
663 {
664 wxWindow* page = m_notebook->GetPage( i );
665
666 if( dynamic_cast<PANEL_NOTEBOOK_BASE*>( page ) )
667 m_notebook->DeletePage( i );
668 }
669
670 m_leftWin->Show( false );
671 Pgm().m_Quitting = true;
672
673 Destroy();
674
675#ifdef _WINDOWS_
676 lock_close_event = 0; // Reenable event management
677#endif
678}
679
680
682{
684
685 if( !aIsExplicitUserSave && !cfg.ShouldAutoSave() )
686 return;
687
688 cfg.m_OpenJobSets.clear();
689
690 for( size_t i = 0; i < m_notebook->GetPageCount(); i++ )
691 {
692 if( PANEL_JOBSET* jobset = dynamic_cast<PANEL_JOBSET*>( m_notebook->GetPage( i ) ) )
693 {
694 wxFileName jobsetFn( jobset->GetFilePath() );
695 jobsetFn.MakeRelativeTo( Prj().GetProjectPath() );
696 cfg.m_OpenJobSets.emplace_back( jobsetFn.GetFullPath() );
697 }
698 }
699
700 cfg.SaveToFile( Prj().GetProjectPath() );
701}
702
703
704void KICAD_MANAGER_FRAME::OnExit( wxCommandEvent& event )
705{
706 Close( true );
707}
708
709
711{
712 if( !Kiway().PlayersClose( false ) )
713 return false;
714
715 bool shouldSaveProject = Prj().GetLocalSettings().ShouldAutoSave()
717
718 // Save the project file for the currently loaded project.
719 if( m_active_project )
720 {
722
723 if( shouldSaveProject )
724 {
726
727 if( aSave )
728 mgr.SaveProject();
729 }
730
731 m_active_project = false;
732 mgr.UnloadProject( &Prj() );
733 }
734
735 SetStatusText( "" );
736
737 // Traverse pages in reverse order so deleting them doesn't mess up our iterator.
738 for( int i = (int) m_notebook->GetPageCount() - 1; i >= 0; i-- )
739 {
740 wxWindow* page = m_notebook->GetPage( i );
741
742 if( PANEL_NOTEBOOK_BASE* panel = dynamic_cast<PANEL_NOTEBOOK_BASE*>( page ) )
743 {
744 if( panel->GetProjectTied() )
745 m_notebook->DeletePage( i );
746 }
747 }
748
751
752 return true;
753}
754
755
756void KICAD_MANAGER_FRAME::OpenJobsFile( const wxFileName& aFileName, bool aCreate,
757 bool aResaveProjectPreferences )
758{
759 for( size_t i = 0; i < m_notebook->GetPageCount(); i++ )
760 {
761 if( PANEL_JOBSET* panel = dynamic_cast<PANEL_JOBSET*>( m_notebook->GetPage( i ) ) )
762 {
763 if( aFileName.GetFullPath() == panel->GetFilePath() )
764 {
765 m_notebook->SetSelection( i );
766 return;
767 }
768 }
769 }
770
771 try
772 {
773 std::unique_ptr<JOBSET> jobsFile =
774 std::make_unique<JOBSET>( aFileName.GetFullPath().ToStdString() );
775
776 jobsFile->LoadFromFile();
777
778 PANEL_JOBSET* jobPanel = new PANEL_JOBSET( m_notebook, this, std::move( jobsFile ) );
779 jobPanel->SetProjectTied( true );
780 jobPanel->SetClosable( true );
781 m_notebook->AddPage( jobPanel, aFileName.GetFullName(), true );
783
784 if( aResaveProjectPreferences )
786 }
787 catch( ... )
788 {
789 DisplayErrorMessage( this, _( "Error opening jobs file" ) );
790 }
791}
792
793
794void KICAD_MANAGER_FRAME::LoadProject( const wxFileName& aProjectFileName )
795{
796 // The project file should be valid by the time we get here or something has gone wrong.
797 if( !aProjectFileName.Exists() )
798 return;
799
800 // Any open KIFACE's must be closed if they are not part of the new project.
801 // (We never want a KIWAY_PLAYER open on a KIWAY that isn't in the same project.)
802 // User is prompted here to close those KIWAY_PLAYERs:
803 if( !CloseProject( true ) )
804 return;
805
806 m_active_project = true;
807
808 Pgm().GetSettingsManager().LoadProject( aProjectFileName.GetFullPath() );
809
810 LoadWindowState( aProjectFileName.GetFullName() );
811
812 if( aProjectFileName.IsDirWritable() )
813 SetMruPath( Prj().GetProjectPath() ); // Only set MRU path if we have write access. Why?
814
815 // Save history & window state to disk now. Don't wait around for a crash.
816 KICAD_SETTINGS* settings = kicadSettings();
817 SaveSettings( settings );
818 settings->SaveToFile( Pgm().GetSettingsManager().GetPathForSettingsFile( settings ) );
819
821
822 for( const wxString& jobset : Prj().GetLocalSettings().m_OpenJobSets )
823 {
824 wxFileName jobsetFn( jobset );
825 jobsetFn.MakeAbsolute( Prj().GetProjectPath() );
826
827 if( jobsetFn.Exists() )
828 OpenJobsFile( jobsetFn.GetFullPath(), false, false );
829 }
830
831 // Always start with the apps page
832 m_notebook->SetSelection( 0 );
833
834 // Rebuild the list of watched paths.
835 // however this is possible only when the main loop event handler is running,
836 // so we use it to run the rebuild function.
837 wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED, ID_INIT_WATCHED_PATHS );
838
839 wxPostEvent( this, cmd );
840
841 PrintPrjInfo();
842
843 KIPLATFORM::APP::RegisterApplicationRestart( aProjectFileName.GetFullPath() );
844 m_openSavedWindows = true;
845}
846
847
848void KICAD_MANAGER_FRAME::CreateNewProject( const wxFileName& aProjectFileName,
849 bool aCreateStubFiles )
850{
851 wxCHECK_RET( aProjectFileName.DirExists() && aProjectFileName.IsDirWritable(),
852 "Project folder must exist and be writable to create a new project." );
853
854 // If the project is legacy, convert it
855 if( !aProjectFileName.FileExists() )
856 {
857 wxFileName legacyPro( aProjectFileName );
858 legacyPro.SetExt( FILEEXT::LegacyProjectFileExtension );
859
860 if( legacyPro.FileExists() )
861 {
862 GetSettingsManager()->LoadProject( legacyPro.GetFullPath() );
864
865 wxRemoveFile( legacyPro.GetFullPath() );
866 }
867 else
868 {
869 // Copy template project file from template folder.
870 wxString srcFileName = sys_search().FindValidPath( "kicad.kicad_pro" );
871
872 wxFileName destFileName( aProjectFileName );
873 destFileName.SetExt( FILEEXT::ProjectFileExtension );
874
875 // Create a minimal project file if the template project file could not be copied
876 if( !wxFileName::FileExists( srcFileName )
877 || !wxCopyFile( srcFileName, destFileName.GetFullPath() ) )
878 {
879 wxFFile file( destFileName.GetFullPath(), "wb" );
880
881 if( file.IsOpened() )
882 file.Write( wxT( "{\n}\n") );
883
884 // wxFFile dtor will close the file
885 }
886 }
887 }
888
889 // Create a "stub" for a schematic root sheet and a board if requested.
890 // It will avoid messages from the schematic editor or the board editor to create a new file
891 // And forces the user to create main files under the right name for the project manager
892 if( aCreateStubFiles )
893 {
894 wxFileName fn( aProjectFileName.GetFullPath() );
896
897 // If a <project>.kicad_sch file does not exist, create a "stub" file ( minimal schematic
898 // file ).
899 if( !fn.FileExists() )
900 {
901 wxFFile file( fn.GetFullPath(), "wb" );
902
903 if( file.IsOpened() )
904 file.Write( wxString::Format( "(kicad_sch (version %d) (generator \"eeschema\") (generator_version \"%s\")\n"
905 " (paper \"A4\")\n (lib_symbols)\n"
906 " (symbol_instances)\n)\n",
908
909 // wxFFile dtor will close the file
910 }
911
912 // If a <project>.kicad_pcb or <project>.brd file does not exist,
913 // create a .kicad_pcb "stub" file
915 wxFileName leg_fn( fn );
916 leg_fn.SetExt( FILEEXT::LegacyPcbFileExtension );
917
918 if( !fn.FileExists() && !leg_fn.FileExists() )
919 {
920 wxFFile file( fn.GetFullPath(), "wb" );
921
922 if( file.IsOpened() )
923 // Create a small dummy file as a stub for pcbnew:
924 file.Write( wxString::Format( "(kicad_pcb (version %d) (generator \"pcbnew\") (generator_version \"%s\")\n)",
926
927 // wxFFile dtor will close the file
928 }
929 }
930
931 // Save history & window state to disk now. Don't wait around for a crash.
932 KICAD_SETTINGS* settings = kicadSettings();
933 SaveSettings( settings );
934 settings->SaveToFile( Pgm().GetSettingsManager().GetPathForSettingsFile( settings ) );
935
936 m_openSavedWindows = true;
937}
938
939
941{
942 // show all files in file dialog (in Kicad all files are editable texts):
943 wxString wildcard = FILEEXT::AllFilesWildcard();
944
945 wxString default_dir = Prj().GetProjectPath();
946
947 wxFileDialog dlg( this, _( "Edit File in Text Editor" ), default_dir, wxEmptyString, wildcard,
948 wxFD_OPEN );
949
950 if( dlg.ShowModal() == wxID_CANCEL )
951 return;
952
953 wxString filename = dlg.GetPath();
954
955 if( !dlg.GetPath().IsEmpty() && !Pgm().GetTextEditor().IsEmpty() )
957}
958
959
961{
962 // open project directory in host OS's file explorer
963 LaunchExternal( Prj().GetProjectPath() );
964}
965
966
968{
970}
971
972
973void KICAD_MANAGER_FRAME::language_change( wxCommandEvent& event )
974{
975 int id = event.GetId();
976 Kiway().SetLanguage( id );
977}
978
979
981{
982 // call my base class
984
985 // tooltips in toolbars
988
989 // update captions
990 int pageId = m_notebook->FindPage( m_launcher );
991
992 if( pageId != wxNOT_FOUND )
993 m_notebook->SetPageText( pageId, EDITORS_CAPTION );
994
995 m_auimgr.GetPane( m_leftWin ).Caption( PROJECT_FILES_CAPTION );
996 m_auimgr.Update();
997
999
1000 PrintPrjInfo();
1001}
1002
1003
1005{
1007
1008 if( m_pcm && ( aFlags & ENVVARS_CHANGED ) )
1009 m_pcm->ReadEnvVar();
1010
1011 COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
1012
1013 if( m_lastToolbarIconSize == 0
1015 {
1018 }
1019}
1020
1021
1023{
1024 wxString file = GetProjectFileName();
1025 wxString title;
1026
1027 if( !file.IsEmpty() )
1028 {
1029 wxFileName fn( file );
1030
1031 title = fn.GetName();
1032
1033 if( !fn.IsDirWritable() )
1034 title += wxS( " " ) + _( "[Read Only]" );
1035 }
1036 else
1037 {
1038 title = _( "[no project loaded]" );
1039 }
1040
1041 if( ADVANCED_CFG::GetCfg().m_HideVersionFromTitle )
1042 title += wxT( " \u2014 " ) + wxString( wxS( "KiCad" ) );
1043 else
1044 title += wxT( " \u2014 " ) + wxString( wxS( "KiCad " ) ) + GetMajorMinorVersion();
1045
1046 SetTitle( title );
1047}
1048
1049
1051{
1053
1054 auto settings = dynamic_cast<KICAD_SETTINGS*>( aCfg );
1055
1056 wxCHECK( settings, /*void*/ );
1057
1058 m_leftWinWidth = settings->m_LeftWinWidth;
1059}
1060
1061
1063{
1065
1066 auto settings = dynamic_cast<KICAD_SETTINGS*>( aCfg );
1067
1068 wxCHECK( settings, /*void*/);
1069
1070 settings->m_LeftWinWidth = m_leftWin->GetSize().x;
1071
1072 if( !m_isClosing )
1073 settings->m_OpenProjects = GetSettingsManager()->GetOpenProjects();
1074}
1075
1076
1078{
1079 // wxStatusBar's wxELLIPSIZE_MIDDLE flag doesn't work (at least on Mac).
1080
1081 wxString status = wxString::Format( _( "Project: %s" ), Prj().GetProjectFullName() );
1082 KISTATUSBAR* statusBar = static_cast<KISTATUSBAR*>( GetStatusBar() );
1083 statusBar->SetEllipsedTextField( status, 0 );
1084}
1085
1086
1088{
1089 return m_active_project;
1090}
1091
1092
1093void KICAD_MANAGER_FRAME::OnIdle( wxIdleEvent& aEvent )
1094{
1100 if( !m_openSavedWindows )
1101 return;
1102
1103 m_openSavedWindows = false;
1104
1105 if( Pgm().GetCommonSettings()->m_Session.remember_open_files )
1106 {
1107 int previousOpenCount =
1108 std::count_if( Prj().GetLocalSettings().m_files.begin(),
1109 Prj().GetLocalSettings().m_files.end(),
1110 [&]( const PROJECT_FILE_STATE& f )
1111 {
1112 return !f.fileName.EndsWith( FILEEXT::ProjectFileExtension ) && f.open;
1113 } );
1114
1115 if( previousOpenCount > 0 )
1116 {
1117 APP_PROGRESS_DIALOG progressReporter( _( "Restoring session" ), wxEmptyString,
1118 previousOpenCount, this );
1119
1120 // We don't currently support opening more than one view per file
1121 std::set<wxString> openedFiles;
1122
1123 int i = 0;
1124
1125 for( const PROJECT_FILE_STATE& file : Prj().GetLocalSettings().m_files )
1126 {
1127 if( file.open && !openedFiles.count( file.fileName ) )
1128 {
1129 progressReporter.Update( i++,
1130 wxString::Format( _( "Restoring '%s'" ), file.fileName ) );
1131
1132 openedFiles.insert( file.fileName );
1133 wxFileName fn( file.fileName );
1134
1135 if( fn.GetExt() == FILEEXT::LegacySchematicFileExtension
1136 || fn.GetExt() == FILEEXT::KiCadSchematicFileExtension )
1137 {
1139 }
1140 else if( fn.GetExt() == FILEEXT::LegacyPcbFileExtension
1141 || fn.GetExt() == FILEEXT::KiCadPcbFileExtension )
1142 {
1144 }
1145 }
1146
1147 wxYield();
1148 }
1149 }
1150 }
1151
1152 // clear file states regardless if we opened windows or not due to setting
1154
1155 KICAD_SETTINGS* settings = kicadSettings();
1156
1157 if( !Pgm().GetCommonSettings()->m_DoNotShowAgain.update_check_prompt )
1158 {
1159 auto prompt = new DIALOG_UPDATE_CHECK_PROMPT( this );
1160 prompt->ShowModal();
1161
1163 }
1164
1166 && settings->m_PcmUpdateCheck )
1167 {
1168 if( !m_pcm )
1169 CreatePCM();
1170
1171 m_pcm->RunBackgroundUpdate();
1172 }
1173
1174#ifdef KICAD_UPDATE_CHECK
1175 if( !m_updateManager && settings->m_KiCadUpdateCheck )
1176 {
1177 m_updateManager = std::make_unique<UPDATE_MANAGER>();
1178 m_updateManager->CheckForUpdate( this );
1179 }
1180#endif
1181}
1182
1183
1185{
1186 m_pcmButton = aButton;
1187
1189}
1190
1191
1193{
1194 if( m_pcmButton )
1195 {
1196 if( m_pcmUpdateCount > 0 )
1197 {
1198 m_pcmButton->SetShowBadge( true );
1199 m_pcmButton->SetBadgeText( wxString::Format( "%d", m_pcmUpdateCount ) );
1200 }
1201 else
1202 {
1203 m_pcmButton->SetShowBadge( false );
1204 }
1205
1206 m_pcmButton->Refresh();
1207 }
1208}
1209
1210
1212{
1213 // No idea why, but the same mechanism used in EDA_DRAW_FRAME doesn't work here
1214 // the only thing that seems to work is to blow it all up and start from scratch.
1215 m_auimgr.DetachPane( m_mainToolBar );
1216 delete m_mainToolBar;
1217 m_mainToolBar = nullptr;
1219 m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Left()
1220 .Layer( 2 ) );
1221
1222 m_auimgr.Update();
1223}
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 CommonSettingsChanged(int aFlags) override
Notification event that some of the common (suite-wide) settings have changed.
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.
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 CommonSettingsChanged(int aFlags) override
Notification event that some of the common (suite-wide) settings have changed.
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
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:118
void SetClosable(bool aYes)
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 ShouldAutoSave() 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:171
TOOL_DISPATCHER * m_toolDispatcher
Definition: tools_holder.h:173
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:55
ACTIONS * m_actions
Definition: tools_holder.h:172
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)
#define ENVVARS_CHANGED
Definition: tools_holder.h:152
Definition of file extensions used in Kicad.