Another round of changes for immediate actions.
This commit is contained in:
parent
3a0256aade
commit
730b89af6d
|
@ -419,6 +419,15 @@ void EDA_DRAW_FRAME::OnSize( wxSizeEvent& SizeEv )
|
|||
}
|
||||
|
||||
|
||||
void EDA_DRAW_FRAME::SetTool( const std::string& actionName )
|
||||
{
|
||||
if( !m_toolStack.empty() )
|
||||
m_toolStack.pop_back();
|
||||
|
||||
PushTool( actionName );
|
||||
}
|
||||
|
||||
|
||||
void EDA_DRAW_FRAME::PushTool( const std::string& actionName )
|
||||
{
|
||||
m_toolStack.push_back( actionName );
|
||||
|
|
|
@ -69,7 +69,6 @@ bool LIB_DRAWING_TOOLS::Init()
|
|||
int LIB_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
KICAD_T type = aEvent.Parameter<KICAD_T>();
|
||||
bool immediateMode = aEvent.HasPosition();
|
||||
LIB_PIN_TOOL* pinTool = type == LIB_PIN_T ? m_toolMgr->GetTool<LIB_PIN_TOOL>() : nullptr;
|
||||
VECTOR2I cursorPos;
|
||||
EDA_ITEM* item = nullptr;
|
||||
|
@ -77,11 +76,11 @@ int LIB_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
|||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
getViewControls()->ShowCursor( true );
|
||||
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
m_frame->SetTool( aEvent.GetCommandStr().get() );
|
||||
Activate();
|
||||
|
||||
// Prime the pump
|
||||
if( immediateMode )
|
||||
if( aEvent.HasPosition() )
|
||||
m_toolMgr->RunAction( ACTIONS::cursorClick );
|
||||
|
||||
// Main loop: keep receiving events
|
||||
|
@ -97,15 +96,12 @@ int LIB_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
|||
m_view->ClearPreview();
|
||||
delete item;
|
||||
item = nullptr;
|
||||
|
||||
if( immediateMode )
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( TOOL_EVT_UTILS::IsCancelInteractive( *evt ) )
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->ClearToolStack();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -191,9 +187,6 @@ int LIB_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
|||
|
||||
m_frame->RebuildView();
|
||||
m_frame->OnModify();
|
||||
|
||||
if( immediateMode )
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if( evt->IsClick( BUT_RIGHT ) )
|
||||
|
@ -217,9 +210,6 @@ int LIB_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
|||
getViewControls()->CaptureCursor( item != nullptr );
|
||||
}
|
||||
|
||||
if( immediateMode )
|
||||
m_frame->PopTool();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -227,7 +217,6 @@ int LIB_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
|||
int LIB_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
KICAD_T type = aEvent.Parameter<KICAD_T>();
|
||||
bool immediateMode = aEvent.HasPosition();
|
||||
|
||||
// We might be running as the same shape in another co-routine. Make sure that one
|
||||
// gets whacked.
|
||||
|
@ -236,14 +225,14 @@ int LIB_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
|||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
getViewControls()->ShowCursor( true );
|
||||
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
m_frame->SetTool( aEvent.GetCommandStr().get() );
|
||||
Activate();
|
||||
|
||||
LIB_PART* part = m_frame->GetCurPart();
|
||||
LIB_ITEM* item = nullptr;
|
||||
|
||||
// Prime the pump
|
||||
if( immediateMode )
|
||||
if( aEvent.HasPosition() )
|
||||
m_toolMgr->RunAction( ACTIONS::cursorClick );
|
||||
|
||||
// Main loop: keep receiving events
|
||||
|
@ -260,15 +249,12 @@ int LIB_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
delete item;
|
||||
item = nullptr;
|
||||
|
||||
if( immediateMode )
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( TOOL_EVT_UTILS::IsCancelInteractive( *evt ) )
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->ClearToolStack();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -325,12 +311,7 @@ int LIB_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
|||
|
||||
m_frame->RebuildView();
|
||||
m_frame->OnModify();
|
||||
|
||||
if( immediateMode )
|
||||
{
|
||||
m_toolMgr->RunAction( ACTIONS::activatePointEditor );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -360,9 +341,6 @@ int LIB_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
|||
getViewControls()->CaptureCursor( item != nullptr );
|
||||
}
|
||||
|
||||
if( immediateMode )
|
||||
m_frame->PopTool();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -372,7 +350,7 @@ int LIB_DRAWING_TOOLS::PlaceAnchor( const TOOL_EVENT& aEvent )
|
|||
getViewControls()->ShowCursor( true );
|
||||
getViewControls()->SetSnapping( true );
|
||||
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
m_frame->SetTool( aEvent.GetCommandStr().get() );
|
||||
Activate();
|
||||
|
||||
// Main loop: keep receiving events
|
||||
|
@ -408,7 +386,7 @@ int LIB_DRAWING_TOOLS::PlaceAnchor( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
}
|
||||
|
||||
m_frame->PopTool();
|
||||
m_frame->ClearToolStack();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,6 @@ static SCH_BASE_FRAME::HISTORY_LIST s_PowerHistoryList;
|
|||
int SCH_DRAWING_TOOLS::PlaceComponent( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
SCH_COMPONENT* component = aEvent.Parameter<SCH_COMPONENT*>();
|
||||
bool immediateMode = component || aEvent.HasPosition();
|
||||
SCHLIB_FILTER filter;
|
||||
SCH_BASE_FRAME::HISTORY_LIST* historyList = nullptr;
|
||||
|
||||
|
@ -110,7 +109,7 @@ int SCH_DRAWING_TOOLS::PlaceComponent( const TOOL_EVENT& aEvent )
|
|||
getViewControls()->WarpCursor( getViewControls()->GetMousePosition( false ) );
|
||||
m_toolMgr->RunAction( EE_ACTIONS::refreshPreview );
|
||||
}
|
||||
else if( immediateMode )
|
||||
else if( aEvent.HasPosition() )
|
||||
m_toolMgr->RunAction( EE_ACTIONS::cursorClick );
|
||||
|
||||
// Main loop: keep receiving events
|
||||
|
@ -126,15 +125,12 @@ int SCH_DRAWING_TOOLS::PlaceComponent( const TOOL_EVENT& aEvent )
|
|||
m_view->ClearPreview();
|
||||
delete component;
|
||||
component = nullptr;
|
||||
|
||||
if( immediateMode )
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( TOOL_EVT_UTILS::IsCancelInteractive( *evt ) )
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->ClearToolStack();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -181,9 +177,6 @@ int SCH_DRAWING_TOOLS::PlaceComponent( const TOOL_EVENT& aEvent )
|
|||
component = nullptr;
|
||||
|
||||
m_view->ClearPreview();
|
||||
|
||||
if( immediateMode )
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if( evt->IsClick( BUT_RIGHT ) )
|
||||
|
@ -220,9 +213,6 @@ int SCH_DRAWING_TOOLS::PlaceComponent( const TOOL_EVENT& aEvent )
|
|||
getViewControls()->CaptureCursor( component != nullptr );
|
||||
}
|
||||
|
||||
if( immediateMode )
|
||||
m_frame->PopTool();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -230,9 +220,12 @@ int SCH_DRAWING_TOOLS::PlaceComponent( const TOOL_EVENT& aEvent )
|
|||
int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
SCH_BITMAP* image = aEvent.Parameter<SCH_BITMAP*>();
|
||||
bool immediateMode = image || aEvent.HasPosition();
|
||||
bool immediateMode = image;
|
||||
|
||||
if( immediateMode )
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
else
|
||||
m_frame->SetTool( aEvent.GetCommandStr().get() );
|
||||
|
||||
VECTOR2I cursorPos = getViewControls()->GetCursorPosition();
|
||||
|
||||
|
@ -252,7 +245,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
|
|||
// Prime the pump
|
||||
if( image )
|
||||
m_toolMgr->RunAction( EE_ACTIONS::refreshPreview );
|
||||
else if( immediateMode )
|
||||
else if( aEvent.HasPosition() )
|
||||
m_toolMgr->RunAction( ACTIONS::cursorClick );
|
||||
|
||||
// Main loop: keep receiving events
|
||||
|
@ -276,7 +269,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
if( TOOL_EVT_UTILS::IsCancelInteractive( *evt ) )
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->ClearToolStack();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -365,13 +358,12 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
|
|||
|
||||
int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
bool immediateMode = aEvent.HasPosition();
|
||||
wxPoint cursorPos;
|
||||
KICAD_T type = aEvent.Parameter<KICAD_T>();
|
||||
|
||||
if( type == SCH_JUNCTION_T )
|
||||
{
|
||||
if( immediateMode )
|
||||
if( aEvent.HasPosition() )
|
||||
{
|
||||
EE_SELECTION& selection = m_selectionTool->GetSelection();
|
||||
SCH_LINE* wire = dynamic_cast<SCH_LINE*>( selection.Front() );
|
||||
|
@ -392,11 +384,11 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
|
|||
getViewControls()->ShowCursor( true );
|
||||
getViewControls()->SetSnapping( true );
|
||||
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
m_frame->SetTool( aEvent.GetCommandStr().get() );
|
||||
Activate();
|
||||
|
||||
// Prime the pump
|
||||
if( immediateMode )
|
||||
if( aEvent.HasPosition() )
|
||||
m_toolMgr->RunAction( ACTIONS::cursorClick );
|
||||
|
||||
// Main loop: keep receiving events
|
||||
|
@ -407,7 +399,7 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
|
|||
if( TOOL_EVT_UTILS::IsCancelInteractive( *evt ) || evt->IsActivate() )
|
||||
{
|
||||
if( TOOL_EVT_UTILS::IsCancelInteractive( *evt ) )
|
||||
m_frame->PopTool();
|
||||
m_frame->ClearToolStack();
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -447,12 +439,6 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
|
|||
m_frame->TestDanglingEnds();
|
||||
m_frame->OnModify();
|
||||
}
|
||||
|
||||
if( immediateMode )
|
||||
{
|
||||
m_frame->PopTool();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if( evt->IsClick( BUT_RIGHT ) )
|
||||
{
|
||||
|
@ -467,19 +453,18 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
|
|||
int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
EDA_ITEM* item = nullptr;
|
||||
bool immediateMode = aEvent.HasPosition();
|
||||
bool importMode = aEvent.IsAction( &EE_ACTIONS::importSheetPin );
|
||||
KICAD_T type = aEvent.Parameter<KICAD_T>();
|
||||
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
getViewControls()->ShowCursor( true );
|
||||
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
m_frame->SetTool( aEvent.GetCommandStr().get() );
|
||||
|
||||
Activate();
|
||||
|
||||
// Prime the pump
|
||||
if( immediateMode )
|
||||
if( aEvent.HasPosition() )
|
||||
m_toolMgr->RunAction( ACTIONS::cursorClick );
|
||||
|
||||
// Main loop: keep receiving events
|
||||
|
@ -495,15 +480,12 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
|||
m_view->ClearPreview();
|
||||
delete item;
|
||||
item = nullptr;
|
||||
|
||||
if( immediateMode )
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( TOOL_EVT_UTILS::IsCancelInteractive( *evt ) )
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->ClearToolStack();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -589,9 +571,6 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
|||
item = nullptr;
|
||||
|
||||
m_view->ClearPreview();
|
||||
|
||||
if( immediateMode )
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if( evt->IsClick( BUT_RIGHT ) )
|
||||
|
@ -628,9 +607,6 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
|||
getViewControls()->CaptureCursor( item != nullptr );
|
||||
}
|
||||
|
||||
if( immediateMode )
|
||||
m_frame->PopTool();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -638,17 +614,16 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
|||
int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
SCH_SHEET* sheet = nullptr;
|
||||
bool immediateMode = aEvent.HasPosition();
|
||||
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
getViewControls()->ShowCursor( true );
|
||||
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
m_frame->SetTool( aEvent.GetCommandStr().get() );
|
||||
|
||||
Activate();
|
||||
|
||||
// Prime the pump
|
||||
if( immediateMode )
|
||||
if( aEvent.HasPosition() )
|
||||
m_toolMgr->RunAction( ACTIONS::cursorClick );
|
||||
|
||||
// Main loop: keep receiving events
|
||||
|
@ -665,15 +640,12 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
delete sheet;
|
||||
sheet = nullptr;
|
||||
|
||||
if( immediateMode )
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( TOOL_EVT_UTILS::IsCancelInteractive( *evt ) )
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->ClearToolStack();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -713,9 +685,6 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
sheet = nullptr;
|
||||
|
||||
if( immediateMode )
|
||||
break;
|
||||
}
|
||||
|
||||
else if( sheet && ( evt->IsAction( &EE_ACTIONS::refreshPreview ) || evt->IsMotion() ) )
|
||||
|
@ -739,9 +708,6 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
|
|||
getViewControls()->CaptureCursor( sheet != nullptr);
|
||||
}
|
||||
|
||||
if( immediateMode )
|
||||
m_frame->PopTool();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -253,12 +253,19 @@ bool SCH_LINE_WIRE_BUS_TOOL::IsDrawingLineWireOrBus( const SELECTION& aSelection
|
|||
int SCH_LINE_WIRE_BUS_TOOL::DrawSegments( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
SCH_LAYER_ID layer = aEvent.Parameter<SCH_LAYER_ID>();
|
||||
SCH_LINE* segment = nullptr;
|
||||
|
||||
if( aEvent.HasPosition() )
|
||||
getViewControls()->WarpCursor( getViewControls()->GetCursorPosition(), true );
|
||||
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
return doDrawSegments( layer, nullptr, aEvent.HasPosition() );
|
||||
m_frame->SetTool( aEvent.GetCommandStr().get() );
|
||||
|
||||
if( aEvent.HasPosition() )
|
||||
{
|
||||
VECTOR2D cursorPos = getViewControls()->GetCursorPosition( !aEvent.Modifier( MD_ALT ) );
|
||||
segment = startSegments( layer, cursorPos );
|
||||
}
|
||||
return doDrawSegments( layer, segment );
|
||||
}
|
||||
|
||||
|
||||
|
@ -306,7 +313,7 @@ int SCH_LINE_WIRE_BUS_TOOL::UnfoldBus( const TOOL_EVENT& aEvent )
|
|||
|
||||
// If we have an unfolded wire to draw, then draw it
|
||||
if( segment )
|
||||
doDrawSegments( LAYER_WIRE, segment, true );
|
||||
doDrawSegments( LAYER_WIRE, segment );
|
||||
|
||||
m_frame->PopTool();
|
||||
return 0;
|
||||
|
@ -428,7 +435,7 @@ static void computeBreakPoint( SCH_SCREEN* aScreen, SCH_LINE* aSegment, wxPoint&
|
|||
}
|
||||
|
||||
|
||||
int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( int aType, SCH_LINE* aSegment, bool aImmediateMode )
|
||||
int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( int aType, SCH_LINE* aSegment )
|
||||
{
|
||||
bool forceHV = m_frame->GetForceHVLines();
|
||||
SCH_SCREEN* screen = m_frame->GetScreen();
|
||||
|
@ -439,10 +446,6 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( int aType, SCH_LINE* aSegment, bool
|
|||
|
||||
Activate();
|
||||
|
||||
// Prime the pump
|
||||
if( aImmediateMode && !aSegment )
|
||||
m_toolMgr->RunAction( ACTIONS::cursorClick );
|
||||
|
||||
// Main loop: keep receiving events
|
||||
while( TOOL_EVENT* evt = Wait() )
|
||||
{
|
||||
|
@ -472,15 +475,12 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( int aType, SCH_LINE* aSegment, bool
|
|||
|
||||
m_view->ClearPreview();
|
||||
m_view->ShowPreview( false );
|
||||
|
||||
if( aImmediateMode )
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( TOOL_EVT_UTILS::IsCancelInteractive( *evt ) )
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->ClearToolStack();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -501,9 +501,6 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( int aType, SCH_LINE* aSegment, bool
|
|||
finishSegments();
|
||||
aSegment = nullptr;
|
||||
}
|
||||
|
||||
if( aImmediateMode )
|
||||
break;
|
||||
}
|
||||
//------------------------------------------------------------------------
|
||||
// Handle click:
|
||||
|
@ -533,9 +530,6 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( int aType, SCH_LINE* aSegment, bool
|
|||
{
|
||||
finishSegments();
|
||||
aSegment = nullptr;
|
||||
|
||||
if( aImmediateMode )
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -558,9 +552,6 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( int aType, SCH_LINE* aSegment, bool
|
|||
|
||||
finishSegments();
|
||||
aSegment = nullptr;
|
||||
|
||||
if( aImmediateMode )
|
||||
break;
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------
|
||||
|
@ -647,9 +638,6 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( int aType, SCH_LINE* aSegment, bool
|
|||
getViewControls()->CaptureCursor( aSegment != nullptr );
|
||||
}
|
||||
|
||||
if( aImmediateMode )
|
||||
m_frame->PopTool();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ public:
|
|||
int AddJunctionsIfNeeded( const TOOL_EVENT& aEvent );
|
||||
|
||||
private:
|
||||
int doDrawSegments( int aType, SCH_LINE* aSegment, bool aImmediateMode );
|
||||
int doDrawSegments( int aType, SCH_LINE* aSegment );
|
||||
SCH_LINE* startSegments( int aType, const VECTOR2D& aPos );
|
||||
SCH_LINE* doUnfoldBus( const wxString& aNet );
|
||||
void finishSegments();
|
||||
|
|
|
@ -300,8 +300,14 @@ public:
|
|||
* a single TOOL_BASE derived class to implement several user "tools", such as rectangle
|
||||
* and circle, or wire and bus. So each user-level tool is actually a TOOL_ACTION.
|
||||
*/
|
||||
virtual void SetTool( const std::string& actionName );
|
||||
virtual void PushTool( const std::string& actionName );
|
||||
virtual void PopTool();
|
||||
|
||||
/**
|
||||
* The selection tool runs underneath the tool stack, so clearing the stack is equivalent
|
||||
* to selecting the selection tool.
|
||||
*/
|
||||
virtual void ClearToolStack();
|
||||
|
||||
/**
|
||||
|
|
|
@ -74,18 +74,17 @@ void PL_DRAWING_TOOLS::Reset( RESET_REASON aReason )
|
|||
int PL_DRAWING_TOOLS::PlaceItem( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
WS_DATA_ITEM::WS_ITEM_TYPE type = aEvent.Parameter<WS_DATA_ITEM::WS_ITEM_TYPE>();
|
||||
bool immediateMode = aEvent.HasPosition();
|
||||
VECTOR2I cursorPos;
|
||||
WS_DRAW_ITEM_BASE* item = nullptr;
|
||||
|
||||
m_toolMgr->RunAction( PL_ACTIONS::clearSelection, true );
|
||||
getViewControls()->ShowCursor( true );
|
||||
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
m_frame->SetTool( aEvent.GetCommandStr().get() );
|
||||
Activate();
|
||||
|
||||
// Prime the pump
|
||||
if( immediateMode )
|
||||
if( aEvent.HasPosition() )
|
||||
m_toolMgr->RunAction( ACTIONS::cursorClick );
|
||||
|
||||
// Main loop: keep receiving events
|
||||
|
@ -103,15 +102,12 @@ int PL_DRAWING_TOOLS::PlaceItem( const TOOL_EVENT& aEvent )
|
|||
|
||||
// There's nothing to roll-back, but we still need to pop the undo stack
|
||||
m_frame->RollbackFromUndo();
|
||||
|
||||
if( immediateMode )
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( TOOL_EVT_UTILS::IsCancelInteractive( *evt ) )
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->ClearToolStack();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -147,9 +143,6 @@ int PL_DRAWING_TOOLS::PlaceItem( const TOOL_EVENT& aEvent )
|
|||
item = nullptr;
|
||||
|
||||
m_frame->OnModify();
|
||||
|
||||
if( immediateMode )
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if( evt->IsClick( BUT_RIGHT ) )
|
||||
|
@ -173,9 +166,6 @@ int PL_DRAWING_TOOLS::PlaceItem( const TOOL_EVENT& aEvent )
|
|||
getViewControls()->CaptureCursor( item != nullptr );
|
||||
}
|
||||
|
||||
if( immediateMode )
|
||||
m_frame->PopTool();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -183,7 +173,6 @@ int PL_DRAWING_TOOLS::PlaceItem( const TOOL_EVENT& aEvent )
|
|||
int PL_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
WS_DATA_ITEM::WS_ITEM_TYPE type = aEvent.Parameter<WS_DATA_ITEM::WS_ITEM_TYPE>();
|
||||
bool immediateMode = aEvent.HasPosition();
|
||||
WS_DRAW_ITEM_BASE* item = nullptr;
|
||||
|
||||
// We might be running as the same shape in another co-routine. Make sure that one
|
||||
|
@ -193,11 +182,11 @@ int PL_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
|||
m_toolMgr->RunAction( PL_ACTIONS::clearSelection, true );
|
||||
getViewControls()->ShowCursor( true );
|
||||
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
m_frame->SetTool( aEvent.GetCommandStr().get() );
|
||||
Activate();
|
||||
|
||||
// Prime the pump
|
||||
if( immediateMode )
|
||||
if( aEvent.HasPosition() )
|
||||
m_toolMgr->RunAction( ACTIONS::cursorClick );
|
||||
|
||||
// Main loop: keep receiving events
|
||||
|
@ -213,15 +202,12 @@ int PL_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
item = nullptr;
|
||||
m_frame->RollbackFromUndo();
|
||||
|
||||
if( immediateMode )
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( TOOL_EVT_UTILS::IsCancelInteractive( *evt ) )
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->ClearToolStack();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -251,9 +237,6 @@ int PL_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
|||
m_toolMgr->RunAction( ACTIONS::activatePointEditor );
|
||||
|
||||
m_frame->OnModify();
|
||||
|
||||
if( immediateMode )
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -281,9 +264,6 @@ int PL_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
|||
getViewControls()->CaptureCursor( item != nullptr );
|
||||
}
|
||||
|
||||
if( immediateMode )
|
||||
m_frame->PopTool();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue