Save context menu position for bus unfold
Fixes https://gitlab.com/kicad/code/kicad/-/issues/6378
This commit is contained in:
parent
1c79e3174c
commit
ac1f7f93a2
|
@ -359,14 +359,16 @@ int SCH_LINE_WIRE_BUS_TOOL::UnfoldBus( const TOOL_EVENT& aEvent )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SCH_LINE* SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus( const wxString& aNet )
|
SCH_LINE* SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus( const wxString& aNet, wxPoint aPos )
|
||||||
{
|
{
|
||||||
SCHEMATIC_SETTINGS& cfg = getModel<SCHEMATIC>()->Settings();
|
SCHEMATIC_SETTINGS& cfg = getModel<SCHEMATIC>()->Settings();
|
||||||
wxPoint pos = (wxPoint) getViewControls()->GetCursorPosition();
|
|
||||||
|
if( aPos == wxDefaultPosition )
|
||||||
|
aPos = static_cast<wxPoint>( getViewControls()->GetCursorPosition() );
|
||||||
|
|
||||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||||
|
|
||||||
m_busUnfold.entry = new SCH_BUS_WIRE_ENTRY( pos );
|
m_busUnfold.entry = new SCH_BUS_WIRE_ENTRY( aPos );
|
||||||
m_busUnfold.entry->SetParent( m_frame->GetScreen() );
|
m_busUnfold.entry->SetParent( m_frame->GetScreen() );
|
||||||
m_frame->AddToScreen( m_busUnfold.entry, m_frame->GetScreen() );
|
m_frame->AddToScreen( m_busUnfold.entry, m_frame->GetScreen() );
|
||||||
|
|
||||||
|
@ -377,7 +379,7 @@ SCH_LINE* SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus( const wxString& aNet )
|
||||||
m_busUnfold.label->SetFlags( IS_NEW | IS_MOVED );
|
m_busUnfold.label->SetFlags( IS_NEW | IS_MOVED );
|
||||||
|
|
||||||
m_busUnfold.in_progress = true;
|
m_busUnfold.in_progress = true;
|
||||||
m_busUnfold.origin = pos;
|
m_busUnfold.origin = aPos;
|
||||||
m_busUnfold.net_name = aNet;
|
m_busUnfold.net_name = aNet;
|
||||||
|
|
||||||
getViewControls()->SetCrossHairCursorPosition( m_busUnfold.entry->GetEnd(), false );
|
getViewControls()->SetCrossHairCursorPosition( m_busUnfold.entry->GetEnd(), false );
|
||||||
|
@ -499,6 +501,8 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType,
|
||||||
// Set initial cursor
|
// Set initial cursor
|
||||||
setCursor();
|
setCursor();
|
||||||
|
|
||||||
|
wxPoint contextMenuPos;
|
||||||
|
|
||||||
// Main loop: keep receiving events
|
// Main loop: keep receiving events
|
||||||
while( TOOL_EVENT* evt = Wait() )
|
while( TOOL_EVENT* evt = Wait() )
|
||||||
{
|
{
|
||||||
|
@ -723,6 +727,7 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType,
|
||||||
if( !segment )
|
if( !segment )
|
||||||
m_toolMgr->VetoContextMenuMouseWarp();
|
m_toolMgr->VetoContextMenuMouseWarp();
|
||||||
|
|
||||||
|
contextMenuPos = cursorPos;
|
||||||
m_menu.ShowContextMenu( m_selectionTool->GetSelection() );
|
m_menu.ShowContextMenu( m_selectionTool->GetSelection() );
|
||||||
}
|
}
|
||||||
else if( evt->Category() == TC_COMMAND && evt->Action() == TA_CHOICE_MENU_CHOICE )
|
else if( evt->Category() == TC_COMMAND && evt->Action() == TA_CHOICE_MENU_CHOICE )
|
||||||
|
@ -734,7 +739,7 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType,
|
||||||
|
|
||||||
aType = LAYER_WIRE;
|
aType = LAYER_WIRE;
|
||||||
wxString net = *evt->Parameter<wxString*>();
|
wxString net = *evt->Parameter<wxString*>();
|
||||||
segment = doUnfoldBus( net );
|
segment = doUnfoldBus( net, contextMenuPos );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -98,7 +98,7 @@ public:
|
||||||
private:
|
private:
|
||||||
int doDrawSegments( const std::string& aTool, int aType, bool aQuitOnDraw );
|
int doDrawSegments( const std::string& aTool, int aType, bool aQuitOnDraw );
|
||||||
SCH_LINE* startSegments( int aType, const VECTOR2D& aPos );
|
SCH_LINE* startSegments( int aType, const VECTOR2D& aPos );
|
||||||
SCH_LINE* doUnfoldBus( const wxString& aNet );
|
SCH_LINE* doUnfoldBus( const wxString& aNet, wxPoint aPos = wxDefaultPosition );
|
||||||
void finishSegments();
|
void finishSegments();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue