Disable Board & Schematic Setup controls when project is locked.

(or missing).

Fixes https://gitlab.com/kicad/code/kicad/issues/9302
This commit is contained in:
Jeff Young 2021-10-04 16:46:32 +01:00
parent 3ac0b46798
commit 92008a089a
2 changed files with 27 additions and 16 deletions

View File

@ -31,7 +31,6 @@
#include <project/project_file.h>
#include <project/net_settings.h>
#include <settings/settings_manager.h>
#include <widgets/infobar.h>
#include "dialog_schematic_setup.h"
#include "panel_eeschema_template_fieldnames.h"
#include <wx/treebook.h>
@ -84,13 +83,21 @@ DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP( SCH_EDIT_FRAME* aFrame ) :
wxBookCtrlEventHandler( DIALOG_SCHEMATIC_SETUP::OnPageChange ), nullptr,
this );
finishDialogSettings();
if( Prj().IsReadOnly() )
{
m_infoBar->ShowMessage( _( "Project is missing or read-only. Changes will not be saved." ),
m_infoBar->ShowMessage( _( "Project is missing or read-only. "
"Settings will not be editable." ),
wxICON_WARNING );
}
finishDialogSettings();
m_formatting->Disable();
m_fieldNameTemplates->Disable();
m_severities->Disable();
m_pinMap->Disable();
m_netclasses->Disable();
m_textVars->Disable();
}
}

View File

@ -36,7 +36,6 @@
#include <project.h>
#include <project/project_file.h>
#include <settings/settings_manager.h>
#include <widgets/infobar.h>
#include <widgets/resettable_panel.h>
#include <widgets/wx_progress_reporters.h>
#include <wildcards_and_files_ext.h>
@ -118,6 +117,22 @@ DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP( PCB_EDIT_FRAME* aFrame ) :
nullptr, this );
finishDialogSettings();
if( Prj().IsReadOnly() )
{
m_infoBar->ShowMessage( _( "Project is missing or read-only. "
"Some settings will not be editable." ),
wxICON_WARNING );
m_boardFinish->Disable();
m_maskAndPaste->Disable();
m_textAndGraphics->Disable();
m_textVars->Disable();
m_constraints->Disable();
m_tracksAndVias->Disable();
m_netclasses->Disable();
m_severities->Disable();
}
}
@ -132,20 +147,9 @@ DIALOG_BOARD_SETUP::~DIALOG_BOARD_SETUP()
void DIALOG_BOARD_SETUP::OnPageChange( wxBookCtrlEvent& event )
{
if( event.GetSelection() == m_physicalStackupPage )
{
m_physicalStackup->OnLayersOptionsChanged( m_layers->GetUILayerMask() );
m_infoBar->Dismiss();
}
else if( event.GetSelection() == m_layerSetupPage )
{
m_layers->SyncCopperLayers( m_physicalStackup->GetCopperLayerCount() );
m_infoBar->Dismiss();
}
else if( Prj().IsReadOnly() )
{
m_infoBar->ShowMessage(
_( "Project is missing or read-only. Changes will not be saved." ) );
}
#ifdef __WXMAC__
// Work around an OSX bug where the wxGrid children don't get placed correctly until