kicad: Open project folder in host OS

NEW: Adds support to browse project directory in default file manager in the host OS
CHANGED: Main frame's Browse menu now contains third option to Browse Project Files

Fixes: lp:1584977
https://bugs.launchpad.net/kicad/+bug/1584977
This commit is contained in:
Ashutosh Gangwar 2018-06-11 12:10:00 +02:00 committed by jean-pierre charras
parent 8be3471ba2
commit efe6b04ca2
3 changed files with 21 additions and 0 deletions

View File

@ -117,6 +117,7 @@ enum id_kicad_frm {
ID_TO_TEXT_EDITOR,
ID_BROWSE_AN_SELECT_FILE,
ID_BROWSE_IN_FILE_EXPLORER,
ID_SAVE_AND_ZIP_FILES,
ID_READ_ZIP_ARCHIVE,
ID_INIT_WATCHED_PATHS,
@ -178,6 +179,7 @@ public:
void OnPreferences( wxCommandEvent& aEvent );
void OnOpenTextEditor( wxCommandEvent& event );
void OnOpenFileInTextEditor( wxCommandEvent& event );
void OnBrowseInFileExplorer( wxCommandEvent& event );
void OnShowHotkeys( wxCommandEvent& event );
void OnFileHistory( wxCommandEvent& event );

View File

@ -474,6 +474,17 @@ void KICAD_MANAGER_FRAME::OnOpenFileInTextEditor( wxCommandEvent& event )
Execute( this, Pgm().GetEditorName(), filename );
}
void KICAD_MANAGER_FRAME::OnBrowseInFileExplorer( wxCommandEvent& event )
{
// open project directory in host OS's file explorer
wxString project_dir = Prj().GetProjectPath();
// Quote in case there are spaces in the path.
AddDelimiterString( project_dir );
wxLaunchDefaultApplication( project_dir );
}
void KICAD_MANAGER_FRAME::OnRefresh( wxCommandEvent& event )
{

View File

@ -53,6 +53,7 @@ BEGIN_EVENT_TABLE( KICAD_MANAGER_FRAME, EDA_BASE_FRAME )
EVT_MENU( wxID_EXIT, KICAD_MANAGER_FRAME::OnExit )
EVT_MENU( ID_TO_TEXT_EDITOR, KICAD_MANAGER_FRAME::OnOpenTextEditor )
EVT_MENU( ID_BROWSE_AN_SELECT_FILE, KICAD_MANAGER_FRAME::OnOpenFileInTextEditor )
EVT_MENU( ID_BROWSE_IN_FILE_EXPLORER, KICAD_MANAGER_FRAME::OnBrowseInFileExplorer )
EVT_MENU( ID_PREFERENCES_CONFIGURE_PATHS, KICAD_MANAGER_FRAME::OnConfigurePaths )
EVT_MENU( ID_EDIT_SYMBOL_LIBRARY_TABLE, KICAD_MANAGER_FRAME::OnEditSymLibTable )
EVT_MENU( ID_EDIT_FOOTPRINT_LIBRARY_TABLE, KICAD_MANAGER_FRAME::OnEditFpLibTable )
@ -319,6 +320,13 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar()
_( "Edit local file" ),
KiBitmap( browse_files_xpm ) );
// Browse in file explorer
AddMenuItem( browseMenu,
ID_BROWSE_IN_FILE_EXPLORER,
_( "&Browse Project Files..." ),
_( "Open project directory in file explorer" ),
KiBitmap( open_project_xpm ) );
// Menu Preferences:
wxMenu* preferencesMenu = new wxMenu;