Guard actions that change project against running in non-standalone mode

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16942

(cherry picked from commit ec2cd99405)
This commit is contained in:
Jon Evans 2024-02-11 09:36:17 -05:00
parent 42397a6ce1
commit 37ac2ee0a3
2 changed files with 20 additions and 0 deletions

View File

@ -1117,6 +1117,10 @@ void SCH_EDIT_FRAME::OnClearFileHistory( wxCommandEvent& aEvent )
void SCH_EDIT_FRAME::NewProject()
{
// Only standalone mode can directly load a new document
if( !Kiface().IsSingle() )
return;
wxString pro_dir = m_mruPath;
wxFileDialog dlg( this, _( "New Schematic" ), pro_dir, wxEmptyString,
@ -1147,6 +1151,10 @@ void SCH_EDIT_FRAME::NewProject()
void SCH_EDIT_FRAME::LoadProject()
{
// Only standalone mode can directly load a new document
if( !Kiface().IsSingle() )
return;
wxString pro_dir = m_mruPath;
wxString wildcards = AllSchematicFilesWildcard()
+ wxS( "|" ) + KiCadSchematicFileWildcard()

View File

@ -315,6 +315,10 @@ bool PCB_EDIT_FRAME::Files_io_from_id( int id )
{
case ID_LOAD_FILE:
{
// Only standalone mode can directly load a new document
if( !Kiface().IsSingle() )
return false;
int open_ctl = 0;
wxString fileName = Prj().AbsolutePath( GetBoard()->GetFileName() );
@ -324,6 +328,10 @@ bool PCB_EDIT_FRAME::Files_io_from_id( int id )
case ID_IMPORT_NON_KICAD_BOARD:
{
// Only standalone mode can directly load a new document
if( !Kiface().IsSingle() )
return false;
int open_ctl = 1;
wxString fileName; // = Prj().AbsolutePath( GetBoard()->GetFileName() );
@ -382,6 +390,10 @@ bool PCB_EDIT_FRAME::Files_io_from_id( int id )
case ID_NEW_BOARD:
{
// Only standalone mode can directly load a new document
if( !Kiface().IsSingle() )
return false;
if( IsContentModified() )
{
wxFileName fileName = GetBoard()->GetFileName();