Upgrade more dialogs to SCHEMATIC_COMMIT.

This commit is contained in:
Jeff Young 2023-06-08 01:04:11 +01:00
parent dcfd426333
commit 73b653c276
1 changed files with 8 additions and 6 deletions

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2004-2022 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2004-2023 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -32,7 +32,6 @@
#include <kiface_base.h> #include <kiface_base.h>
#include <pin_numbers.h> #include <pin_numbers.h>
#include <string_utils.h> #include <string_utils.h>
#include <menus_helpers.h>
#include <kiplatform/ui.h> #include <kiplatform/ui.h>
#include <widgets/grid_icon_text_helpers.h> #include <widgets/grid_icon_text_helpers.h>
#include <widgets/grid_combobox.h> #include <widgets/grid_combobox.h>
@ -44,9 +43,9 @@
#include <sch_edit_frame.h> #include <sch_edit_frame.h>
#include <sch_reference_list.h> #include <sch_reference_list.h>
#include <schematic.h> #include <schematic.h>
#include <schematic_commit.h>
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <tool/actions.h> #include <tool/actions.h>
#include <math/vector2d.h>
#include <dialog_sim_model.h> #include <dialog_sim_model.h>
@ -697,7 +696,8 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow()
if( !m_pinGrid->CommitPendingChanges() ) if( !m_pinGrid->CommitPendingChanges() )
return false; return false;
SCH_SCREEN* currentScreen = GetParent()->GetScreen(); SCHEMATIC_COMMIT commit( GetParent() );
SCH_SCREEN* currentScreen = GetParent()->GetScreen();
wxCHECK( currentScreen, false ); wxCHECK( currentScreen, false );
// This needs to be done before the LIB_ID is changed to prevent stale library symbols in // This needs to be done before the LIB_ID is changed to prevent stale library symbols in
@ -706,7 +706,7 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow()
// save old cmp in undo list if not already in edit, or moving ... // save old cmp in undo list if not already in edit, or moving ...
if( m_symbol->GetEditFlags() == 0 ) if( m_symbol->GetEditFlags() == 0 )
GetParent()->SaveCopyInUndoList( currentScreen, m_symbol, UNDO_REDO::CHANGED, false ); commit.Modify( m_symbol, currentScreen );
// Save current flags which could be modified by next change settings // Save current flags which could be modified by next change settings
EDA_ITEM_FLAGS flags = m_symbol->GetFlags(); EDA_ITEM_FLAGS flags = m_symbol->GetFlags();
@ -870,7 +870,9 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow()
currentScreen->Append( m_symbol ); currentScreen->Append( m_symbol );
GetParent()->TestDanglingEnds(); GetParent()->TestDanglingEnds();
GetParent()->UpdateItem( m_symbol, false, true ); GetParent()->UpdateItem( m_symbol, false, true );
GetParent()->OnModify();
if( !commit.Empty() )
commit.Push( _( "Edit Symbol Properties" ) );
// This must go after OnModify() so that the connectivity graph will have been updated. // This must go after OnModify() so that the connectivity graph will have been updated.
GetParent()->GetToolManager()->PostEvent( EVENTS::SelectedItemsModified ); GetParent()->GetToolManager()->PostEvent( EVENTS::SelectedItemsModified );