From adb107459703a78d7c8fa34444a6a5743e87f843 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 31 May 2020 00:01:24 +0100 Subject: [PATCH] Add undo for Edit Text & Graphics Properties. --- eeschema/dialogs/dialog_global_edit_text_and_graphics.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/eeschema/dialogs/dialog_global_edit_text_and_graphics.cpp b/eeschema/dialogs/dialog_global_edit_text_and_graphics.cpp index 5ec6ec5b83..58fdee3ef8 100644 --- a/eeschema/dialogs/dialog_global_edit_text_and_graphics.cpp +++ b/eeschema/dialogs/dialog_global_edit_text_and_graphics.cpp @@ -216,6 +216,8 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem( const SCH_SHEET_PATH& aS auto sch_text = dynamic_cast( aItem ); auto lineItem = dynamic_cast( aItem ); + m_parent->SaveCopyInUndoList( aItem, UR_CHANGED, m_hasChange ); + if( eda_text ) { if( !m_textSize.IsIndeterminate() ) @@ -428,6 +430,8 @@ bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataFromWindow() if( !m_textSize.Validate( Mils2iu( 1 ), Mils2iu( 10000 ) ) ) // 1 mil .. 10 inches return false; + SCH_SHEET_PATH currentSheet = m_parent->GetCurrentSheet(); + // Go through sheets for( const SCH_SHEET_PATH& sheetPath : m_parent->Schematic().GetSheets() ) { @@ -435,6 +439,7 @@ bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataFromWindow() if( screen ) { + m_parent->SetCurrentSheet( sheetPath ); m_hasChange = false; for( auto item : screen->Items() ) @@ -448,6 +453,9 @@ bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataFromWindow() } } + // Reset the view to where we left the user + m_parent->SetCurrentSheet( currentSheet ); + return true; }