Allow opening arbitrary jobset files

This commit is contained in:
Marek Roszko 2024-12-30 21:28:04 -05:00
parent f7b01d8eb9
commit 012867faf8
4 changed files with 27 additions and 0 deletions

View File

@ -82,6 +82,13 @@ TOOL_ACTION KICAD_MANAGER_ACTIONS::openProject( TOOL_ACTION_ARGS()
.FriendlyName( _( "Open Project..." ) )
.Icon( BITMAPS::open_project ) );
TOOL_ACTION KICAD_MANAGER_ACTIONS::openJobsetFile( TOOL_ACTION_ARGS()
.Name( "kicad.Control.openJobset" )
.Scope( AS_GLOBAL )
.LegacyHotkeyName( "Open Jobset File" )
.FriendlyName( _( "Open Jobset File..." ) )
.Icon( BITMAPS::open_project ) );
TOOL_ACTION KICAD_MANAGER_ACTIONS::closeProject( TOOL_ACTION_ARGS()
.Name( "kicad.Control.closeProject" )
.Scope( AS_GLOBAL )

View File

@ -37,6 +37,7 @@ public:
static TOOL_ACTION newJobsetFile;
static TOOL_ACTION openDemoProject;
static TOOL_ACTION openProject;
static TOOL_ACTION openJobsetFile;
static TOOL_ACTION closeProject;
static TOOL_ACTION loadProject;
static TOOL_ACTION viewDroppedGerbers;

View File

@ -420,6 +420,23 @@ int KICAD_MANAGER_CONTROL::OpenProject( const TOOL_EVENT& aEvent )
}
int KICAD_MANAGER_CONTROL::OpenJobsetFile( const TOOL_EVENT& aEvent )
{
wxString default_dir = wxFileName( Prj().GetProjectFullName() ).GetPathWithSep();
wxFileDialog dlg( m_frame, _( "Create New Jobset" ), default_dir, wxEmptyString,
FILEEXT::JobsetFileWildcard(), wxFD_OPEN | wxFD_FILE_MUST_EXIST );
if( dlg.ShowModal() == wxID_CANCEL )
return -1;
wxFileName jobsetFn( dlg.GetPath() );
m_frame->OpenJobsFile( jobsetFn.GetFullPath(), true );
return 0;
}
int KICAD_MANAGER_CONTROL::CloseProject( const TOOL_EVENT& aEvent )
{
m_frame->CloseProject( true );
@ -990,6 +1007,7 @@ void KICAD_MANAGER_CONTROL::setTransitions()
Go( &KICAD_MANAGER_CONTROL::NewJobsetFile, KICAD_MANAGER_ACTIONS::newJobsetFile.MakeEvent() );
Go( &KICAD_MANAGER_CONTROL::OpenDemoProject, KICAD_MANAGER_ACTIONS::openDemoProject.MakeEvent() );
Go( &KICAD_MANAGER_CONTROL::OpenProject, KICAD_MANAGER_ACTIONS::openProject.MakeEvent() );
Go( &KICAD_MANAGER_CONTROL::OpenJobsetFile, KICAD_MANAGER_ACTIONS::openJobsetFile.MakeEvent() );
Go( &KICAD_MANAGER_CONTROL::CloseProject, KICAD_MANAGER_ACTIONS::closeProject.MakeEvent() );
Go( &KICAD_MANAGER_CONTROL::SaveProjectAs, ACTIONS::saveAs.MakeEvent() );
Go( &KICAD_MANAGER_CONTROL::LoadProject, KICAD_MANAGER_ACTIONS::loadProject.MakeEvent() );

View File

@ -50,6 +50,7 @@ public:
int NewJobsetFile( const TOOL_EVENT& aEvent );
int OpenProject( const TOOL_EVENT& aEvent );
int OpenDemoProject( const TOOL_EVENT& aEvent );
int OpenJobsetFile( const TOOL_EVENT& aEvent );
int CloseProject( const TOOL_EVENT& aEvent );
int SaveProjectAs( const TOOL_EVENT& aEvent );
int LoadProject( const TOOL_EVENT& aEvent );