From 92008a089a1f15f8aefe92fcc23c169f614fb758 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 4 Oct 2021 16:46:32 +0100 Subject: [PATCH] Disable Board & Schematic Setup controls when project is locked. (or missing). Fixes https://gitlab.com/kicad/code/kicad/issues/9302 --- eeschema/dialogs/dialog_schematic_setup.cpp | 15 ++++++++--- pcbnew/dialogs/dialog_board_setup.cpp | 28 ++++++++++++--------- 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/eeschema/dialogs/dialog_schematic_setup.cpp b/eeschema/dialogs/dialog_schematic_setup.cpp index 6d121a6e17..512dcd2793 100644 --- a/eeschema/dialogs/dialog_schematic_setup.cpp +++ b/eeschema/dialogs/dialog_schematic_setup.cpp @@ -31,7 +31,6 @@ #include #include #include -#include #include "dialog_schematic_setup.h" #include "panel_eeschema_template_fieldnames.h" #include @@ -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(); + } } diff --git a/pcbnew/dialogs/dialog_board_setup.cpp b/pcbnew/dialogs/dialog_board_setup.cpp index 36e705f347..2e52a79c30 100644 --- a/pcbnew/dialogs/dialog_board_setup.cpp +++ b/pcbnew/dialogs/dialog_board_setup.cpp @@ -36,7 +36,6 @@ #include #include #include -#include #include #include #include @@ -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