Browse Source

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

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16942
newinvert
Jon Evans 2 years ago
parent
commit
ec2cd99405
  1. 8
      eeschema/sch_edit_frame.cpp
  2. 14
      pcbnew/files.cpp

8
eeschema/sch_edit_frame.cpp

@ -1260,6 +1260,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,
@ -1290,6 +1294,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 = FILEEXT::AllSchematicFilesWildcard()
+ wxS( "|" ) + FILEEXT::KiCadSchematicFileWildcard()

14
pcbnew/files.cpp

@ -265,6 +265,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 = KICTL_KICAD_ONLY;
wxString fileName = Prj().AbsolutePath( GetBoard()->GetFileName() );
@ -274,6 +278,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 = KICTL_NONKICAD_ONLY;
wxString fileName; // = Prj().AbsolutePath( GetBoard()->GetFileName() );
@ -332,6 +340,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();
@ -1353,4 +1365,4 @@ void PCB_EDIT_FRAME::GenIPC2581File( wxCommandEvent& event )
}
GetScreen()->SetContentModified( false );
}
}
Loading…
Cancel
Save