Guard actions that change project against running in non-standalone mode
Fixes https://gitlab.com/kicad/code/kicad/-/issues/16942
This commit is contained in:
parent
ef0204a44b
commit
ec2cd99405
|
@ -1260,6 +1260,10 @@ void SCH_EDIT_FRAME::OnClearFileHistory( wxCommandEvent& aEvent )
|
||||||
|
|
||||||
void SCH_EDIT_FRAME::NewProject()
|
void SCH_EDIT_FRAME::NewProject()
|
||||||
{
|
{
|
||||||
|
// Only standalone mode can directly load a new document
|
||||||
|
if( !Kiface().IsSingle() )
|
||||||
|
return;
|
||||||
|
|
||||||
wxString pro_dir = m_mruPath;
|
wxString pro_dir = m_mruPath;
|
||||||
|
|
||||||
wxFileDialog dlg( this, _( "New Schematic" ), pro_dir, wxEmptyString,
|
wxFileDialog dlg( this, _( "New Schematic" ), pro_dir, wxEmptyString,
|
||||||
|
@ -1290,6 +1294,10 @@ void SCH_EDIT_FRAME::NewProject()
|
||||||
|
|
||||||
void SCH_EDIT_FRAME::LoadProject()
|
void SCH_EDIT_FRAME::LoadProject()
|
||||||
{
|
{
|
||||||
|
// Only standalone mode can directly load a new document
|
||||||
|
if( !Kiface().IsSingle() )
|
||||||
|
return;
|
||||||
|
|
||||||
wxString pro_dir = m_mruPath;
|
wxString pro_dir = m_mruPath;
|
||||||
wxString wildcards = FILEEXT::AllSchematicFilesWildcard()
|
wxString wildcards = FILEEXT::AllSchematicFilesWildcard()
|
||||||
+ wxS( "|" ) + FILEEXT::KiCadSchematicFileWildcard()
|
+ wxS( "|" ) + FILEEXT::KiCadSchematicFileWildcard()
|
||||||
|
|
|
@ -265,6 +265,10 @@ bool PCB_EDIT_FRAME::Files_io_from_id( int id )
|
||||||
{
|
{
|
||||||
case ID_LOAD_FILE:
|
case ID_LOAD_FILE:
|
||||||
{
|
{
|
||||||
|
// Only standalone mode can directly load a new document
|
||||||
|
if( !Kiface().IsSingle() )
|
||||||
|
return false;
|
||||||
|
|
||||||
int open_ctl = KICTL_KICAD_ONLY;
|
int open_ctl = KICTL_KICAD_ONLY;
|
||||||
wxString fileName = Prj().AbsolutePath( GetBoard()->GetFileName() );
|
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:
|
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;
|
int open_ctl = KICTL_NONKICAD_ONLY;
|
||||||
wxString fileName; // = Prj().AbsolutePath( GetBoard()->GetFileName() );
|
wxString fileName; // = Prj().AbsolutePath( GetBoard()->GetFileName() );
|
||||||
|
|
||||||
|
@ -332,6 +340,10 @@ bool PCB_EDIT_FRAME::Files_io_from_id( int id )
|
||||||
|
|
||||||
case ID_NEW_BOARD:
|
case ID_NEW_BOARD:
|
||||||
{
|
{
|
||||||
|
// Only standalone mode can directly load a new document
|
||||||
|
if( !Kiface().IsSingle() )
|
||||||
|
return false;
|
||||||
|
|
||||||
if( IsContentModified() )
|
if( IsContentModified() )
|
||||||
{
|
{
|
||||||
wxFileName fileName = GetBoard()->GetFileName();
|
wxFileName fileName = GetBoard()->GetFileName();
|
||||||
|
@ -1353,4 +1365,4 @@ void PCB_EDIT_FRAME::GenIPC2581File( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
GetScreen()->SetContentModified( false );
|
GetScreen()->SetContentModified( false );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue