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:
parent
42397a6ce1
commit
37ac2ee0a3
|
@ -1117,6 +1117,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,
|
||||||
|
@ -1147,6 +1151,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 = AllSchematicFilesWildcard()
|
wxString wildcards = AllSchematicFilesWildcard()
|
||||||
+ wxS( "|" ) + KiCadSchematicFileWildcard()
|
+ wxS( "|" ) + KiCadSchematicFileWildcard()
|
||||||
|
|
|
@ -315,6 +315,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 = 0;
|
int open_ctl = 0;
|
||||||
wxString fileName = Prj().AbsolutePath( GetBoard()->GetFileName() );
|
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:
|
case ID_IMPORT_NON_KICAD_BOARD:
|
||||||
{
|
{
|
||||||
|
// Only standalone mode can directly load a new document
|
||||||
|
if( !Kiface().IsSingle() )
|
||||||
|
return false;
|
||||||
|
|
||||||
int open_ctl = 1;
|
int open_ctl = 1;
|
||||||
wxString fileName; // = Prj().AbsolutePath( GetBoard()->GetFileName() );
|
wxString fileName; // = Prj().AbsolutePath( GetBoard()->GetFileName() );
|
||||||
|
|
||||||
|
@ -382,6 +390,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();
|
||||||
|
|
Loading…
Reference in New Issue