From c96db4f5c49cc0bfa68b766664fbf565957a719a Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Fri, 9 Dec 2016 14:08:51 +0100 Subject: [PATCH] Removed aCreateUndoEntry flag from COMMIT::Push() It was not used anywhere and COMMIT should handle creating undo buffer entries. --- include/commit.h | 2 +- pcbnew/board_commit.cpp | 22 +++++++++------------- pcbnew/board_commit.h | 2 +- pcbnew/ratsnest_viewitem.h | 2 +- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/include/commit.h b/include/commit.h index 62fbf7d98c..243f2e360b 100644 --- a/include/commit.h +++ b/include/commit.h @@ -127,7 +127,7 @@ public: COMMIT& Stage( const PICKED_ITEMS_LIST& aItems, UNDO_REDO_T aModFlag = UR_UNSPECIFIED ); ///> Executes the changes. - virtual void Push( const wxString& aMessage = wxT( "A commit" ), bool aCreateUndoEntry = true ) = 0; + virtual void Push( const wxString& aMessage = wxT( "A commit" ) ) = 0; ///> Revertes the commit by restoring the modifed items state. virtual void Revert() = 0; diff --git a/pcbnew/board_commit.cpp b/pcbnew/board_commit.cpp index eded7d2081..2b39111d17 100644 --- a/pcbnew/board_commit.cpp +++ b/pcbnew/board_commit.cpp @@ -53,7 +53,7 @@ BOARD_COMMIT::~BOARD_COMMIT() } -void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry ) +void BOARD_COMMIT::Push( const wxString& aMessage ) { // Objects potentially interested in changes: PICKED_ITEMS_LIST undoList; @@ -91,13 +91,10 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry ) assert( ent.m_item->Type() == PCB_MODULE_T ); assert( ent.m_copy->Type() == PCB_MODULE_T ); - if ( aCreateUndoEntry ) - { - ITEM_PICKER itemWrapper( ent.m_item, UR_CHANGED ); - itemWrapper.SetLink( ent.m_copy ); - undoList.PushItem( itemWrapper ); - frame->SaveCopyInUndoList( undoList, UR_CHANGED ); - } + ITEM_PICKER itemWrapper( ent.m_item, UR_CHANGED ); + itemWrapper.SetLink( ent.m_copy ); + undoList.PushItem( itemWrapper ); + frame->SaveCopyInUndoList( undoList, UR_CHANGED ); savedModules.insert( ent.m_item ); static_cast( ent.m_item )->SetLastEditTime(); @@ -110,8 +107,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry ) { if( !m_editModules ) { - if( aCreateUndoEntry ) - undoList.PushItem( ITEM_PICKER( boardItem, UR_NEW ) ); + undoList.PushItem( ITEM_PICKER( boardItem, UR_NEW ) ); if( !( changeFlags & CHT_DONE ) ) board->Add( boardItem ); @@ -139,7 +135,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry ) case CHT_REMOVE: { - if( !m_editModules && aCreateUndoEntry ) + if( !m_editModules ) { undoList.PushItem( ITEM_PICKER( boardItem, UR_DELETED ) ); } @@ -245,7 +241,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry ) case CHT_MODIFY: { - if( !m_editModules && aCreateUndoEntry ) + if( !m_editModules ) { ITEM_PICKER itemWrapper( boardItem, UR_CHANGED ); assert( ent.m_copy ); @@ -270,7 +266,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry ) } } - if( !m_editModules && aCreateUndoEntry ) + if( !m_editModules ) frame->SaveCopyInUndoList( undoList, UR_UNSPECIFIED ); if( TOOL_MANAGER* toolMgr = frame->GetToolManager() ) diff --git a/pcbnew/board_commit.h b/pcbnew/board_commit.h index 197bbfbbea..c1c3e38b5b 100644 --- a/pcbnew/board_commit.h +++ b/pcbnew/board_commit.h @@ -40,7 +40,7 @@ public: BOARD_COMMIT( PCB_BASE_FRAME* aFrame ); virtual ~BOARD_COMMIT(); - virtual void Push( const wxString& aMessage = wxT( "A commit" ), bool aCreateUndoEntry = true ) override; + virtual void Push( const wxString& aMessage = wxT( "A commit" ) ) override; virtual void Revert() override; private: diff --git a/pcbnew/ratsnest_viewitem.h b/pcbnew/ratsnest_viewitem.h index 7109697578..7573e59ce4 100644 --- a/pcbnew/ratsnest_viewitem.h +++ b/pcbnew/ratsnest_viewitem.h @@ -47,7 +47,7 @@ public: const BOX2I ViewBBox() const override; /// @copydoc VIEW_ITEM::ViewDraw() - void ViewDraw( int aLayer, KIGFX::VIEW* aView ) const; + void ViewDraw( int aLayer, KIGFX::VIEW* aView ) const override; /// @copydoc VIEW_ITEM::ViewGetLayers() void ViewGetLayers( int aLayers[], int& aCount ) const override;