diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index 732ac89d36..b7c06a7d40 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -60,7 +60,7 @@ using namespace std::placeholders; EDIT_TOOL::EDIT_TOOL() : PCB_TOOL( "pcbnew.InteractiveEdit" ), m_selectionTool( NULL ), - m_dragging( false ), m_undoInhibit( 0 ), m_updateFlag( KIGFX::VIEW_ITEM::NONE ) + m_dragging( false ), m_updateFlag( KIGFX::VIEW_ITEM::NONE ) { } @@ -115,9 +115,6 @@ bool EDIT_TOOL::invokeInlineRouter() TRACK* track = uniqueSelected(); VIA* via = uniqueSelected(); - if( isUndoInhibited() ) - return false; - if( track || via ) { ROUTER_TOOL* theRouter = static_cast( m_toolMgr->FindTool( "pcbnew.InteractiveRouter" ) ); @@ -247,9 +244,6 @@ int EDIT_TOOL::Main( const TOOL_EVENT& aEvent ) controls->SetAutoPan( true ); m_dragging = true; - - // Do not save intermediate modifications when an item is dragged - incUndoInhibit(); } } @@ -328,9 +322,6 @@ int EDIT_TOOL::Main( const TOOL_EVENT& aEvent ) } } while( ( evt = Wait() ) ); //Should be assignment not equality test - if( m_dragging ) - decUndoInhibit(); - m_dragging = false; m_offset.x = 0; m_offset.y = 0; @@ -419,7 +410,7 @@ int EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent ) item->Rotate( rotatePoint, editFrame->GetRotationAngle() ); } - if( !isUndoInhibited() ) + if( !m_dragging ) m_commit->Push( _( "Rotate" ) ); if( unselect ) @@ -451,7 +442,7 @@ int EDIT_TOOL::Flip( const TOOL_EVENT& aEvent ) item->Flip( flipPoint ); } - if( !isUndoInhibited() ) + if( !m_dragging ) m_commit->Push( _( "Flip" ) ); if( unselect ) @@ -521,8 +512,7 @@ int EDIT_TOOL::MoveExact( const TOOL_EVENT& aEvent ) item->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY ); } - if( !isUndoInhibited() ) - m_commit->Push( _( "Move exact" ) ); + m_commit->Push( _( "Move exact" ) ); if( unselect ) m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear, true ); @@ -551,11 +541,6 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent ) // we have a selection to work on now, so start the tool process PCB_BASE_EDIT_FRAME* editFrame = getEditFrame(); - // prevent other tools making undo points while the duplicate is going on - // so that if you cancel, you don't get a duplicate object hiding over - // the original - incUndoInhibit(); - std::vector old_items; for( int i = 0; i < selection.Size(); ++i ) @@ -611,9 +596,6 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent ) Main( evt ); } - // and re-enable undos - decUndoInhibit(); - return 0; }; diff --git a/pcbnew/tools/edit_tool.h b/pcbnew/tools/edit_tool.h index eb293af58f..640caf569b 100644 --- a/pcbnew/tools/edit_tool.h +++ b/pcbnew/tools/edit_tool.h @@ -133,9 +133,6 @@ private: ///> of edit reference point). VECTOR2I m_cursor; - /// Counter of undo inhibitions. When zero, undo is not inhibited. - int m_undoInhibit; - ///> The required update flag for modified items KIGFX::VIEW_ITEM::VIEW_UPDATE_FLAGS m_updateFlag; @@ -159,47 +156,6 @@ private: ///> the cursor or displays a disambiguation menu if there are multiple items. bool hoverSelection( bool aSanitize = true ); - ///> Processes the current undo buffer since the last change. If the last change does not occur - ///> in the current buffer, then the whole list is processed. - void processUndoBuffer( const PICKED_ITEMS_LIST* aLastChange ); - - ///> Updates items stored in the list. - void processPickedList( const PICKED_ITEMS_LIST* aList ); - - /** - * Increments the undo inhibit counter. This will indicate that tools - * should not create an undo point, as another tool is doing it already, - * and considers that its operation is atomic, even if it calls another one - * (for example a duplicate calls a move). - */ - inline void incUndoInhibit() - { - m_undoInhibit++; - } - - /** - * Decrements the inhibit counter. An assert is raised if the counter drops - * below zero. - */ - inline void decUndoInhibit() - { - m_undoInhibit--; - - wxASSERT_MSG( m_undoInhibit >= 0, wxT( "Undo inhibit count decremented past zero" ) ); - } - - /** - * Report if the tool manager has been told at least once that undo - * points should not be created. This can be ignored if the undo point - * is still required. - * - * @return true if undo are inhibited - */ - inline bool isUndoInhibited() const - { - return m_undoInhibit > 0; - } - int editFootprintInFpEditor( const TOOL_EVENT& aEvent ); bool invokeInlineRouter();