Commit a55d2580 authored by Maciej Suminski's avatar Maciej Suminski

Activation of any drawing/placement tool clears current selection.

parent 1fa49ce7
...@@ -71,7 +71,7 @@ TOOL_ACTION COMMON_ACTIONS::drawArc( "pcbnew.InteractiveDrawing.arc", ...@@ -71,7 +71,7 @@ TOOL_ACTION COMMON_ACTIONS::drawArc( "pcbnew.InteractiveDrawing.arc",
AS_GLOBAL, 0, AS_GLOBAL, 0,
"Draw an arc", "Draw an arc" ); "Draw an arc", "Draw an arc" );
TOOL_ACTION COMMON_ACTIONS::drawText( "pcbnew.InteractiveDrawing.text", TOOL_ACTION COMMON_ACTIONS::placeText( "pcbnew.InteractiveDrawing.text",
AS_GLOBAL, 0, AS_GLOBAL, 0,
"Add a text", "Add a text" ); "Add a text", "Add a text" );
...@@ -281,7 +281,7 @@ std::string COMMON_ACTIONS::TranslateLegacyId( int aId ) ...@@ -281,7 +281,7 @@ std::string COMMON_ACTIONS::TranslateLegacyId( int aId )
return COMMON_ACTIONS::drawArc.GetName(); return COMMON_ACTIONS::drawArc.GetName();
case ID_PCB_ADD_TEXT_BUTT: case ID_PCB_ADD_TEXT_BUTT:
return COMMON_ACTIONS::drawText.GetName(); return COMMON_ACTIONS::placeText.GetName();
case ID_PCB_DIMENSION_BUTT: case ID_PCB_DIMENSION_BUTT:
return COMMON_ACTIONS::drawDimension.GetName(); return COMMON_ACTIONS::drawDimension.GetName();
......
...@@ -70,7 +70,7 @@ public: ...@@ -70,7 +70,7 @@ public:
static TOOL_ACTION drawArc; static TOOL_ACTION drawArc;
/// Activation of the drawing tool (text) /// Activation of the drawing tool (text)
static TOOL_ACTION drawText; static TOOL_ACTION placeText;
/// Activation of the drawing tool (dimension) /// Activation of the drawing tool (dimension)
static TOOL_ACTION drawDimension; static TOOL_ACTION drawDimension;
......
...@@ -94,6 +94,7 @@ int DRAWING_TOOL::DrawArc( TOOL_EVENT& aEvent ) ...@@ -94,6 +94,7 @@ int DRAWING_TOOL::DrawArc( TOOL_EVENT& aEvent )
KIGFX::VIEW_GROUP preview( m_view ); KIGFX::VIEW_GROUP preview( m_view );
m_view->Add( &preview ); m_view->Add( &preview );
m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear );
m_controls->ShowCursor( true ); m_controls->ShowCursor( true );
m_controls->SetSnapping( true ); m_controls->SetSnapping( true );
...@@ -270,7 +271,7 @@ int DRAWING_TOOL::DrawArc( TOOL_EVENT& aEvent ) ...@@ -270,7 +271,7 @@ int DRAWING_TOOL::DrawArc( TOOL_EVENT& aEvent )
} }
int DRAWING_TOOL::DrawText( TOOL_EVENT& aEvent ) int DRAWING_TOOL::PlaceText( TOOL_EVENT& aEvent )
{ {
TEXTE_PCB* text = NULL; TEXTE_PCB* text = NULL;
...@@ -278,6 +279,7 @@ int DRAWING_TOOL::DrawText( TOOL_EVENT& aEvent ) ...@@ -278,6 +279,7 @@ int DRAWING_TOOL::DrawText( TOOL_EVENT& aEvent )
KIGFX::VIEW_GROUP preview( m_view ); KIGFX::VIEW_GROUP preview( m_view );
m_view->Add( &preview ); m_view->Add( &preview );
m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear );
m_controls->ShowCursor( true ); m_controls->ShowCursor( true );
m_controls->SetSnapping( true ); m_controls->SetSnapping( true );
m_controls->SetAutoPan( true ); m_controls->SetAutoPan( true );
...@@ -325,6 +327,7 @@ int DRAWING_TOOL::DrawText( TOOL_EVENT& aEvent ) ...@@ -325,6 +327,7 @@ int DRAWING_TOOL::DrawText( TOOL_EVENT& aEvent )
{ {
// Init the new item attributes // Init the new item attributes
text = m_frame->CreateTextePcb( NULL ); text = m_frame->CreateTextePcb( NULL );
if( text == NULL ) if( text == NULL )
continue; continue;
...@@ -381,6 +384,7 @@ int DRAWING_TOOL::DrawDimension( TOOL_EVENT& aEvent ) ...@@ -381,6 +384,7 @@ int DRAWING_TOOL::DrawDimension( TOOL_EVENT& aEvent )
KIGFX::VIEW_GROUP preview( m_view ); KIGFX::VIEW_GROUP preview( m_view );
m_view->Add( &preview ); m_view->Add( &preview );
m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear );
m_controls->ShowCursor( true ); m_controls->ShowCursor( true );
m_controls->SetSnapping( true ); m_controls->SetSnapping( true );
...@@ -571,6 +575,7 @@ int DRAWING_TOOL::PlaceTarget( TOOL_EVENT& aEvent ) ...@@ -571,6 +575,7 @@ int DRAWING_TOOL::PlaceTarget( TOOL_EVENT& aEvent )
m_view->Add( &preview ); m_view->Add( &preview );
preview.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY ); preview.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear );
m_controls->SetSnapping( true ); m_controls->SetSnapping( true );
m_controls->SetAutoPan( true ); m_controls->SetAutoPan( true );
...@@ -644,6 +649,7 @@ int DRAWING_TOOL::PlaceModule( TOOL_EVENT& aEvent ) ...@@ -644,6 +649,7 @@ int DRAWING_TOOL::PlaceModule( TOOL_EVENT& aEvent )
KIGFX::VIEW_GROUP preview( m_view ); KIGFX::VIEW_GROUP preview( m_view );
m_view->Add( &preview ); m_view->Add( &preview );
m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear );
m_controls->ShowCursor( true ); m_controls->ShowCursor( true );
m_controls->SetSnapping( true ); m_controls->SetSnapping( true );
m_controls->SetAutoPan( true ); m_controls->SetAutoPan( true );
...@@ -659,7 +665,7 @@ int DRAWING_TOOL::PlaceModule( TOOL_EVENT& aEvent ) ...@@ -659,7 +665,7 @@ int DRAWING_TOOL::PlaceModule( TOOL_EVENT& aEvent )
{ {
if( module ) if( module )
{ {
m_board->Delete( module ); // it was added by LoadModuleFromLibrary m_board->Delete( module ); // it was added by LoadModuleFromLibrary()
module = NULL; module = NULL;
preview.Clear(); preview.Clear();
...@@ -755,6 +761,7 @@ int DRAWING_TOOL::drawSegment( int aShape, bool aContinous ) ...@@ -755,6 +761,7 @@ int DRAWING_TOOL::drawSegment( int aShape, bool aContinous )
KIGFX::VIEW_GROUP preview( m_view ); KIGFX::VIEW_GROUP preview( m_view );
m_view->Add( &preview ); m_view->Add( &preview );
m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear );
m_controls->ShowCursor( true ); m_controls->ShowCursor( true );
m_controls->SetSnapping( true ); m_controls->SetSnapping( true );
...@@ -930,6 +937,7 @@ int DRAWING_TOOL::drawZone( bool aKeepout ) ...@@ -930,6 +937,7 @@ int DRAWING_TOOL::drawZone( bool aKeepout )
KIGFX::VIEW_GROUP preview( m_view ); KIGFX::VIEW_GROUP preview( m_view );
m_view->Add( &preview ); m_view->Add( &preview );
m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear );
m_controls->ShowCursor( true ); m_controls->ShowCursor( true );
m_controls->SetSnapping( true ); m_controls->SetSnapping( true );
...@@ -1149,13 +1157,13 @@ void DRAWING_TOOL::make45DegLine( DRAWSEGMENT* aSegment, DRAWSEGMENT* aHelper ) ...@@ -1149,13 +1157,13 @@ void DRAWING_TOOL::make45DegLine( DRAWSEGMENT* aSegment, DRAWSEGMENT* aHelper )
void DRAWING_TOOL::setTransitions() void DRAWING_TOOL::setTransitions()
{ {
Go( &DRAWING_TOOL::DrawLine, COMMON_ACTIONS::drawLine.MakeEvent() ); Go( &DRAWING_TOOL::DrawLine, COMMON_ACTIONS::drawLine.MakeEvent() );
Go( &DRAWING_TOOL::DrawCircle, COMMON_ACTIONS::drawCircle.MakeEvent() ); Go( &DRAWING_TOOL::DrawCircle, COMMON_ACTIONS::drawCircle.MakeEvent() );
Go( &DRAWING_TOOL::DrawArc, COMMON_ACTIONS::drawArc.MakeEvent() ); Go( &DRAWING_TOOL::DrawArc, COMMON_ACTIONS::drawArc.MakeEvent() );
Go( &DRAWING_TOOL::DrawText, COMMON_ACTIONS::drawText.MakeEvent() ); Go( &DRAWING_TOOL::DrawDimension, COMMON_ACTIONS::drawDimension.MakeEvent() );
Go( &DRAWING_TOOL::DrawDimension, COMMON_ACTIONS::drawDimension.MakeEvent() ); Go( &DRAWING_TOOL::DrawZone, COMMON_ACTIONS::drawZone.MakeEvent() );
Go( &DRAWING_TOOL::DrawZone, COMMON_ACTIONS::drawZone.MakeEvent() ); Go( &DRAWING_TOOL::DrawKeepout, COMMON_ACTIONS::drawKeepout.MakeEvent() );
Go( &DRAWING_TOOL::DrawKeepout, COMMON_ACTIONS::drawKeepout.MakeEvent() ); Go( &DRAWING_TOOL::PlaceText, COMMON_ACTIONS::placeText.MakeEvent() );
Go( &DRAWING_TOOL::PlaceTarget, COMMON_ACTIONS::placeTarget.MakeEvent() ); Go( &DRAWING_TOOL::PlaceTarget, COMMON_ACTIONS::placeTarget.MakeEvent() );
Go( &DRAWING_TOOL::PlaceModule, COMMON_ACTIONS::placeModule.MakeEvent() ); Go( &DRAWING_TOOL::PlaceModule, COMMON_ACTIONS::placeModule.MakeEvent() );
} }
...@@ -80,7 +80,7 @@ public: ...@@ -80,7 +80,7 @@ public:
* Displays a dialog that allows to input text and its settings and then lets the user decide * Displays a dialog that allows to input text and its settings and then lets the user decide
* where to place the text. * where to place the text.
*/ */
int DrawText( TOOL_EVENT& aEvent ); int PlaceText( TOOL_EVENT& aEvent );
/** /**
* Function DrawDimension() * Function DrawDimension()
......
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