From 9e1ceba5d8ebde7dceb6ae060474d49a53c72a4b Mon Sep 17 00:00:00 2001 From: Mike Williams Date: Mon, 18 Dec 2023 09:28:16 -0500 Subject: [PATCH] Symbol Fields Table: save modified presets without changes to schematic Fixes: https://gitlab.com/kicad/code/kicad/-/issues/16381 --- .../dialogs/dialog_symbol_fields_table.cpp | 32 ++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/eeschema/dialogs/dialog_symbol_fields_table.cpp b/eeschema/dialogs/dialog_symbol_fields_table.cpp index d8eb48e4c5..6329b23bb1 100644 --- a/eeschema/dialogs/dialog_symbol_fields_table.cpp +++ b/eeschema/dialogs/dialog_symbol_fields_table.cpp @@ -2118,6 +2118,8 @@ void DIALOG_SYMBOL_FIELDS_TABLE::doApplyBomFmtPreset( const BOM_FMT_PRESET& aPre void DIALOG_SYMBOL_FIELDS_TABLE::savePresetsToSchematic() { + bool modified = false; + // Save our BOM presets std::vector presets; @@ -2127,8 +2129,18 @@ void DIALOG_SYMBOL_FIELDS_TABLE::savePresetsToSchematic() presets.emplace_back( pair.second ); } - m_schSettings.m_BomPresets = presets; - m_schSettings.m_BomSettings = m_dataModel->GetBomSettings(); + if( m_schSettings.m_BomPresets != presets ) + { + modified = true; + m_schSettings.m_BomPresets = presets; + } + + if( m_schSettings.m_BomSettings != m_dataModel->GetBomSettings() ) + { + modified = true; + m_schSettings.m_BomSettings = m_dataModel->GetBomSettings(); + } + // Save our BOM Format presets std::vector fmts; @@ -2139,8 +2151,20 @@ void DIALOG_SYMBOL_FIELDS_TABLE::savePresetsToSchematic() fmts.emplace_back( pair.second ); } - m_schSettings.m_BomFmtPresets = fmts; - m_schSettings.m_BomFmtSettings = GetCurrentBomFmtSettings(); + if( m_schSettings.m_BomFmtPresets != fmts ) + { + modified = true; + m_schSettings.m_BomFmtPresets = fmts; + } + + if( m_schSettings.m_BomFmtSettings != GetCurrentBomFmtSettings() ) + { + modified = true; + m_schSettings.m_BomFmtSettings = GetCurrentBomFmtSettings(); + } + + if( modified ) + m_parent->OnModify(); }