Commit 05de84d5 authored by Maciej Suminski's avatar Maciej Suminski

Undo/redo support.

parent 6e52e193
...@@ -197,6 +197,9 @@ int DRAWING_TOOL::DrawArc( TOOL_EVENT& aEvent ) ...@@ -197,6 +197,9 @@ int DRAWING_TOOL::DrawArc( TOOL_EVENT& aEvent )
m_view->Add( arc ); m_view->Add( arc );
m_board->Add( arc ); m_board->Add( arc );
arc->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY ); arc->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
m_frame->OnModify();
m_frame->SaveCopyInUndoList( arc, UR_NEW );
} }
else else
--step; // one another chance to draw a proper arc --step; // one another chance to draw a proper arc
...@@ -309,6 +312,10 @@ int DRAWING_TOOL::DrawText( TOOL_EVENT& aEvent ) ...@@ -309,6 +312,10 @@ int DRAWING_TOOL::DrawText( TOOL_EVENT& aEvent )
m_view->Add( text ); m_view->Add( text );
// m_board->Add( text ); // it is already added by CreateTextePcb() // m_board->Add( text ); // it is already added by CreateTextePcb()
text->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY ); text->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
m_frame->OnModify();
m_frame->SaveCopyInUndoList( text, UR_NEW );
break; break;
} }
...@@ -431,6 +438,9 @@ int DRAWING_TOOL::DrawDimension( TOOL_EVENT& aEvent ) ...@@ -431,6 +438,9 @@ int DRAWING_TOOL::DrawDimension( TOOL_EVENT& aEvent )
m_view->Add( dimension ); m_view->Add( dimension );
m_board->Add( dimension ); m_board->Add( dimension );
dimension->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY ); dimension->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
m_frame->OnModify();
m_frame->SaveCopyInUndoList( dimension, UR_NEW );
} }
} }
break; break;
...@@ -507,6 +517,7 @@ int DRAWING_TOOL::PlaceTarget( TOOL_EVENT& aEvent ) ...@@ -507,6 +517,7 @@ int DRAWING_TOOL::PlaceTarget( TOOL_EVENT& aEvent )
preview.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY ); preview.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
m_controls->SetSnapping( true ); m_controls->SetSnapping( true );
m_controls->SetAutoPan( true );
Activate(); Activate();
...@@ -542,6 +553,10 @@ int DRAWING_TOOL::PlaceTarget( TOOL_EVENT& aEvent ) ...@@ -542,6 +553,10 @@ int DRAWING_TOOL::PlaceTarget( TOOL_EVENT& aEvent )
m_view->Add( target ); m_view->Add( target );
m_board->Add( target ); m_board->Add( target );
target->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY ); target->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
m_frame->OnModify();
m_frame->SaveCopyInUndoList( target, UR_NEW );
break; break;
} }
...@@ -584,6 +599,7 @@ int DRAWING_TOOL::PlaceModule( TOOL_EVENT& aEvent ) ...@@ -584,6 +599,7 @@ int DRAWING_TOOL::PlaceModule( TOOL_EVENT& aEvent )
preview.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY ); preview.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
m_controls->SetSnapping( true ); m_controls->SetSnapping( true );
m_controls->SetAutoPan( true );
Activate(); Activate();
...@@ -617,6 +633,10 @@ int DRAWING_TOOL::PlaceModule( TOOL_EVENT& aEvent ) ...@@ -617,6 +633,10 @@ int DRAWING_TOOL::PlaceModule( TOOL_EVENT& aEvent )
module->RunOnChildren( std::bind1st( std::mem_fun( &KIGFX::VIEW::Add ), m_view ) ); module->RunOnChildren( std::bind1st( std::mem_fun( &KIGFX::VIEW::Add ), m_view ) );
m_view->Add( module ); m_view->Add( module );
module->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY ); module->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
m_frame->OnModify();
m_frame->SaveCopyInUndoList( module, UR_NEW );
break; break;
} }
...@@ -748,6 +768,9 @@ int DRAWING_TOOL::drawSegment( int aShape, bool aContinous ) ...@@ -748,6 +768,9 @@ int DRAWING_TOOL::drawSegment( int aShape, bool aContinous )
preview.Remove( graphic ); preview.Remove( graphic );
++addedSegments; ++addedSegments;
m_frame->OnModify();
m_frame->SaveCopyInUndoList( graphic, UR_NEW );
if( aContinous ) if( aContinous )
{ {
graphic = new DRAWSEGMENT( *graphic ); graphic = new DRAWSEGMENT( *graphic );
...@@ -902,6 +925,9 @@ int DRAWING_TOOL::drawZone( bool aKeepout ) ...@@ -902,6 +925,9 @@ int DRAWING_TOOL::drawZone( bool aKeepout )
m_frame->Fill_Zone( zone ); m_frame->Fill_Zone( zone );
zone->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY ); zone->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
m_frame->OnModify();
m_frame->SaveCopyInUndoList( zone, UR_NEW );
} }
else else
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment