EE/PCB_Actions: convert to generic Finish
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/16079
This commit is contained in:
parent
16eb31a6e8
commit
2795fa9ca3
|
@ -147,6 +147,15 @@ TOOL_ACTION ACTIONS::cancelInteractive( TOOL_ACTION_ARGS()
|
|||
.Icon( BITMAPS::cancel )
|
||||
.Flags( AF_NONE ) );
|
||||
|
||||
TOOL_ACTION ACTIONS::finishInteractive( TOOL_ACTION_ARGS()
|
||||
.Name( "common.Interactive.finish" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.DefaultHotkey( WXK_END )
|
||||
.FriendlyName( _( "Finish" ) )
|
||||
.Tooltip( _( "Finish current tool" ) )
|
||||
.Icon( BITMAPS::checked_ok )
|
||||
.Flags( AF_NONE ) );
|
||||
|
||||
TOOL_ACTION ACTIONS::showContextMenu( TOOL_ACTION_ARGS()
|
||||
.Name( "common.Control.showContextMenu" )
|
||||
.Scope( AS_GLOBAL )
|
||||
|
|
|
@ -379,13 +379,6 @@ TOOL_ACTION EE_ACTIONS::symbolImportGraphics( TOOL_ACTION_ARGS()
|
|||
.Icon( BITMAPS::import_vector )
|
||||
.Flags( AF_ACTIVATE ) );
|
||||
|
||||
TOOL_ACTION EE_ACTIONS::finishDrawing( TOOL_ACTION_ARGS()
|
||||
.Name( "eeschema.SymbolDrawing.finishDrawing" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "Finish Drawing" ) )
|
||||
.Tooltip( _( "Finish drawing shape" ) )
|
||||
.Icon( BITMAPS::checked_ok ) );
|
||||
|
||||
// SYMBOL_EDITOR_PIN_TOOL
|
||||
//
|
||||
TOOL_ACTION EE_ACTIONS::pushPinLength( TOOL_ACTION_ARGS()
|
||||
|
@ -589,14 +582,6 @@ TOOL_ACTION EE_ACTIONS::schImportGraphics( TOOL_ACTION_ARGS()
|
|||
.Icon( BITMAPS::import_vector )
|
||||
.Flags( AF_ACTIVATE ) );
|
||||
|
||||
TOOL_ACTION EE_ACTIONS::finishSheet( TOOL_ACTION_ARGS()
|
||||
.Name( "eeschema.InteractiveDrawing.finishSheet" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "Finish Sheet" ) )
|
||||
.Tooltip( _( "Finish drawing sheet" ) )
|
||||
.Icon( BITMAPS::checked_ok ) );
|
||||
|
||||
|
||||
// SCH_EDIT_TOOL
|
||||
//
|
||||
TOOL_ACTION EE_ACTIONS::repeatDrawItem( TOOL_ACTION_ARGS()
|
||||
|
@ -1342,41 +1327,6 @@ TOOL_ACTION EE_ACTIONS::switchSegmentPosture( TOOL_ACTION_ARGS()
|
|||
.Icon( BITMAPS::change_entry_orient )
|
||||
.Flags( AF_NONE ) );
|
||||
|
||||
TOOL_ACTION EE_ACTIONS::finishLineWireOrBus( TOOL_ACTION_ARGS()
|
||||
.Name( "eeschema.InteractiveDrawingLineWireBus.finish" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.DefaultHotkey( 'K' )
|
||||
.LegacyHotkeyName( "End Line Wire Bus" )
|
||||
.FriendlyName( _( "Finish Wire or Bus" ) )
|
||||
.Tooltip( _( "Complete drawing at current segment" ) )
|
||||
.Icon( BITMAPS::checked_ok )
|
||||
.Flags( AF_NONE ) );
|
||||
|
||||
TOOL_ACTION EE_ACTIONS::finishWire( TOOL_ACTION_ARGS()
|
||||
.Name( "eeschema.InteractiveDrawingLineWireBus.finishWire" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "Finish Wire" ) )
|
||||
.Tooltip( _( "Complete wire with current segment" ) )
|
||||
.Icon( BITMAPS::checked_ok )
|
||||
.Flags( AF_NONE ) );
|
||||
|
||||
TOOL_ACTION EE_ACTIONS::finishBus( TOOL_ACTION_ARGS()
|
||||
.Name( "eeschema.InteractiveDrawingLineWireBus.finishBus" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "Finish Bus" ) )
|
||||
.Tooltip( _( "Complete bus with current segment" ) )
|
||||
.Icon( BITMAPS::checked_ok )
|
||||
.Flags( AF_NONE ) );
|
||||
|
||||
TOOL_ACTION EE_ACTIONS::finishLine( TOOL_ACTION_ARGS()
|
||||
.Name( "eeschema.InteractiveDrawingLineWireBus.finishLine" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "Finish Lines" ) )
|
||||
.Tooltip( _( "Complete connected lines with current segment" ) )
|
||||
.Icon( BITMAPS::checked_ok )
|
||||
.Flags( AF_NONE ) );
|
||||
|
||||
|
||||
// SCH_MOVE_TOOL
|
||||
//
|
||||
TOOL_ACTION EE_ACTIONS::move( TOOL_ACTION_ARGS()
|
||||
|
|
|
@ -100,11 +100,6 @@ public:
|
|||
static TOOL_ACTION schImportGraphics;
|
||||
static TOOL_ACTION undoLastSegment;
|
||||
static TOOL_ACTION switchSegmentPosture;
|
||||
static TOOL_ACTION finishLineWireOrBus;
|
||||
static TOOL_ACTION finishWire;
|
||||
static TOOL_ACTION finishBus;
|
||||
static TOOL_ACTION finishLine;
|
||||
static TOOL_ACTION finishSheet;
|
||||
|
||||
// Symbol Tools
|
||||
static TOOL_ACTION placeSymbolPin;
|
||||
|
@ -114,7 +109,6 @@ public:
|
|||
static TOOL_ACTION drawSymbolPolygon;
|
||||
static TOOL_ACTION placeSymbolAnchor;
|
||||
static TOOL_ACTION symbolImportGraphics;
|
||||
static TOOL_ACTION finishDrawing;
|
||||
|
||||
// Interactive Editing
|
||||
static TOOL_ACTION alignToGrid;
|
||||
|
|
|
@ -283,10 +283,7 @@ bool EE_SELECTION_TOOL::Init()
|
|||
menu.AddItem( EE_ACTIONS::drawBus, schEditCondition && EE_CONDITIONS::Empty, 100 );
|
||||
|
||||
menu.AddSeparator( 100 );
|
||||
menu.AddItem( EE_ACTIONS::finishWire, SCH_LINE_WIRE_BUS_TOOL::IsDrawingWire, 100 );
|
||||
|
||||
menu.AddSeparator( 100 );
|
||||
menu.AddItem( EE_ACTIONS::finishBus, SCH_LINE_WIRE_BUS_TOOL::IsDrawingBus, 100 );
|
||||
menu.AddItem( ACTIONS::finishInteractive, SCH_LINE_WIRE_BUS_TOOL::IsDrawingWire, 100 );
|
||||
|
||||
menu.AddSeparator( 200 );
|
||||
menu.AddItem( EE_ACTIONS::selectConnection, connectedSelection && EE_CONDITIONS::Idle, 250 );
|
||||
|
|
|
@ -1864,10 +1864,10 @@ int SCH_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
|||
else if( item && ( evt->IsClick( BUT_LEFT )
|
||||
|| evt->IsDblClick( BUT_LEFT )
|
||||
|| isSyntheticClick
|
||||
|| evt->IsAction( &EE_ACTIONS::finishDrawing ) ) )
|
||||
|| evt->IsAction( &ACTIONS::finishInteractive ) ) )
|
||||
{
|
||||
if( evt->IsDblClick( BUT_LEFT )
|
||||
|| evt->IsAction( &EE_ACTIONS::finishDrawing )
|
||||
|| evt->IsAction( &ACTIONS::finishInteractive )
|
||||
|| !item->ContinueEdit( cursorPos ) )
|
||||
{
|
||||
item->EndEdit();
|
||||
|
@ -2097,7 +2097,7 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
|
|||
else if( sheet && ( evt->IsClick( BUT_LEFT )
|
||||
|| evt->IsDblClick( BUT_LEFT )
|
||||
|| isSyntheticClick
|
||||
|| evt->IsAction( &EE_ACTIONS::finishSheet ) ) )
|
||||
|| evt->IsAction( &ACTIONS::finishInteractive ) ) )
|
||||
{
|
||||
getViewControls()->SetAutoPan( false );
|
||||
getViewControls()->CaptureCursor( false );
|
||||
|
|
|
@ -221,10 +221,7 @@ bool SCH_LINE_WIRE_BUS_TOOL::Init()
|
|||
|
||||
ctxMenu.AddItem( EE_ACTIONS::undoLastSegment, EE_CONDITIONS::ShowAlways, 10 );
|
||||
ctxMenu.AddItem( EE_ACTIONS::switchSegmentPosture, EE_CONDITIONS::ShowAlways, 10 );
|
||||
|
||||
ctxMenu.AddItem( EE_ACTIONS::finishWire, IsDrawingWire, 10 );
|
||||
ctxMenu.AddItem( EE_ACTIONS::finishBus, IsDrawingBus, 10 );
|
||||
ctxMenu.AddItem( EE_ACTIONS::finishLine, IsDrawingLine, 10 );
|
||||
ctxMenu.AddItem( ACTIONS::finishInteractive, IsDrawingLineWireOrBus, 10 );
|
||||
|
||||
ctxMenu.AddMenu( busUnfoldMenu.get(), EE_CONDITIONS::Idle, 10 );
|
||||
|
||||
|
@ -742,10 +739,7 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const TOOL_EVENT& aTool, int aType,
|
|||
//------------------------------------------------------------------------
|
||||
// Handle finish:
|
||||
//
|
||||
else if( evt->IsAction( &EE_ACTIONS::finishLineWireOrBus )
|
||||
|| evt->IsAction( &EE_ACTIONS::finishWire )
|
||||
|| evt->IsAction( &EE_ACTIONS::finishBus )
|
||||
|| evt->IsAction( &EE_ACTIONS::finishLine ) )
|
||||
else if( evt->IsAction( &ACTIONS::finishInteractive ) )
|
||||
{
|
||||
if( segment || m_busUnfold.in_progress )
|
||||
{
|
||||
|
|
|
@ -74,7 +74,7 @@ bool SYMBOL_EDITOR_DRAWING_TOOLS::Init()
|
|||
return item && item->IsNew();
|
||||
};
|
||||
|
||||
m_menu.GetMenu().AddItem( EE_ACTIONS::finishDrawing, isDrawingCondition, 2 );
|
||||
m_menu.GetMenu().AddItem( ACTIONS::finishInteractive, isDrawingCondition, 2 );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -496,7 +496,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::doDrawShape( const TOOL_EVENT& aEvent, std::opt
|
|||
else if( item && ( evt->IsClick( BUT_LEFT )
|
||||
|| evt->IsDblClick( BUT_LEFT )
|
||||
|| isSyntheticClick
|
||||
|| evt->IsAction( &EE_ACTIONS::finishDrawing ) ) )
|
||||
|| evt->IsAction( &ACTIONS::finishInteractive ) ) )
|
||||
{
|
||||
if( symbol != m_frame->GetCurSymbol() )
|
||||
{
|
||||
|
@ -504,7 +504,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::doDrawShape( const TOOL_EVENT& aEvent, std::opt
|
|||
item->SetParent( symbol );
|
||||
}
|
||||
|
||||
if( evt->IsDblClick( BUT_LEFT ) || evt->IsAction( &EE_ACTIONS::finishDrawing )
|
||||
if( evt->IsDblClick( BUT_LEFT ) || evt->IsAction( &ACTIONS::finishInteractive )
|
||||
|| !item->ContinueEdit( VECTOR2I( cursorPos.x, -cursorPos.y ) ) )
|
||||
{
|
||||
if( toolType == SHAPE_T::POLY )
|
||||
|
|
|
@ -61,6 +61,7 @@ public:
|
|||
|
||||
// Generic edit actions
|
||||
static TOOL_ACTION cancelInteractive;
|
||||
static TOOL_ACTION finishInteractive;
|
||||
static TOOL_ACTION showContextMenu;
|
||||
static TOOL_ACTION undo;
|
||||
static TOOL_ACTION redo;
|
||||
|
|
|
@ -105,14 +105,6 @@ enum VIA_ACTION_FLAGS
|
|||
#undef _
|
||||
#define _(s) s
|
||||
|
||||
static const TOOL_ACTION ACT_EndTrack( TOOL_ACTION_ARGS()
|
||||
.Name( "pcbnew.InteractiveRouter.EndTrack" )
|
||||
.Scope( AS_CONTEXT )
|
||||
.DefaultHotkey( WXK_END )
|
||||
.FriendlyName( _( "Finish Track" ) )
|
||||
.Tooltip( _( "Stops laying the current track." ) )
|
||||
.Icon( BITMAPS::checked_ok ) );
|
||||
|
||||
// Pass all the parameters as int to allow combining flags
|
||||
static const TOOL_ACTION ACT_PlaceThroughVia( TOOL_ACTION_ARGS()
|
||||
.Name( "pcbnew.InteractiveRouter.PlaceVia" )
|
||||
|
@ -527,7 +519,7 @@ bool ROUTER_TOOL::Init()
|
|||
|
||||
menu.AddItem( PCB_ACTIONS::routeSingleTrack, notRoutingCond );
|
||||
menu.AddItem( PCB_ACTIONS::routeDiffPair, notRoutingCond );
|
||||
menu.AddItem( ACT_EndTrack, SELECTION_CONDITIONS::ShowAlways );
|
||||
menu.AddItem( ACTIONS::finishInteractive, SELECTION_CONDITIONS::ShowAlways );
|
||||
menu.AddItem( PCB_ACTIONS::routerUndoLastSegment, SELECTION_CONDITIONS::ShowAlways );
|
||||
menu.AddItem( PCB_ACTIONS::routerContinueFromEnd, hasOtherEnd );
|
||||
menu.AddItem( PCB_ACTIONS::routerAttemptFinish, hasOtherEnd );
|
||||
|
@ -1442,7 +1434,7 @@ void ROUTER_TOOL::performRouting()
|
|||
setCursor();
|
||||
UpdateMessagePanel();
|
||||
}
|
||||
else if( evt->IsAction( &ACT_EndTrack ) || evt->IsDblClick( BUT_LEFT ) )
|
||||
else if( evt->IsAction( &ACTIONS::finishInteractive ) || evt->IsDblClick( BUT_LEFT ) )
|
||||
{
|
||||
// Stop current routing:
|
||||
m_router->FixRoute( m_endSnapPoint, m_endItem, true );
|
||||
|
|
Loading…
Reference in New Issue