Browse Source

Better interactive feedback.

Don't wait for mouse to move before refreshing after a command.

Also fixes a crash bug deleting an item after an
Unstage() (the Unstage() has already deleted the item).

Also fixes a crash when changing label type during
creation of a label produces a mess.

Also Keep cursor aligned to grid when not warping
back to original point.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16828

(cherry picked from commit 9d7db3d135)
9.0
Jeff Young 2 months ago
parent
commit
2bf9a6f5d1
  1. 6
      eeschema/tools/sch_actions.cpp
  2. 2
      eeschema/tools/sch_actions.h
  3. 67
      eeschema/tools/sch_drawing_tools.cpp
  4. 4
      eeschema/tools/sch_edit_tool.cpp
  5. 14
      eeschema/tools/sch_move_tool.cpp
  6. 7
      eeschema/tools/symbol_editor_drawing_tools.cpp

6
eeschema/tools/sch_actions.cpp

@ -834,8 +834,10 @@ TOOL_ACTION SCH_ACTIONS::toLabel( TOOL_ACTION_ARGS()
.Flags( AF_NONE )
.Parameter( SCH_LABEL_T ) );
TOOL_ACTION SCH_ACTIONS::toCLabel( TOOL_ACTION_ARGS()
.Name( "eeschema.InteractiveEdit.toCLabel" )
TOOL_ACTION SCH_ACTIONS::toDLabel(TOOL_ACTION_ARGS()
.Name( "eeschema.InteractiveEdit.toCLabel" ) // Old name based on netClass label.
// There's no sense losing hotkey assignments, so we
// leave it as-is)
.Scope( AS_GLOBAL )
.FriendlyName( _( "Change to Directive Label" ) )
.Tooltip( _( "Change existing item to a directive label" ) )

2
eeschema/tools/sch_actions.h

@ -142,7 +142,7 @@ public:
static TOOL_ACTION showDeMorganAlternate;
static TOOL_ACTION editSymbolUnit;
static TOOL_ACTION toLabel;
static TOOL_ACTION toCLabel;
static TOOL_ACTION toDLabel;
static TOOL_ACTION toHLabel;
static TOOL_ACTION toGLabel;
static TOOL_ACTION toText;

67
eeschema/tools/sch_drawing_tools.cpp

@ -538,10 +538,32 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
{
cleanup();
}
else if( symbol && evt->IsAction( &ACTIONS::redo ) )
else if( symbol && ( evt->IsAction( &ACTIONS::redo )
|| evt->IsAction( &SCH_ACTIONS::editWithLibEdit )
|| evt->IsAction( &SCH_ACTIONS::changeSymbol ) ) )
{
wxBell();
}
else if( symbol && ( evt->IsAction( &SCH_ACTIONS::properties )
|| evt->IsAction( &SCH_ACTIONS::editReference )
|| evt->IsAction( &SCH_ACTIONS::editValue )
|| evt->IsAction( &SCH_ACTIONS::editFootprint )
|| evt->IsAction( &SCH_ACTIONS::autoplaceFields )
|| evt->IsAction( &SCH_ACTIONS::showDeMorganStandard )
|| evt->IsAction( &SCH_ACTIONS::showDeMorganAlternate )
|| evt->IsAction( &SCH_ACTIONS::toggleDeMorgan )
|| evt->IsAction( &SCH_ACTIONS::setExcludeFromBOM )
|| evt->IsAction( &SCH_ACTIONS::setExcludeFromBoard )
|| evt->IsAction( &SCH_ACTIONS::setExcludeFromSimulation )
|| evt->IsAction( &SCH_ACTIONS::setDNP )
|| evt->IsAction( &SCH_ACTIONS::rotateCW )
|| evt->IsAction( &SCH_ACTIONS::rotateCCW )
|| evt->IsAction( &SCH_ACTIONS::mirrorV )
|| evt->IsAction( &SCH_ACTIONS::mirrorH ) ) )
{
m_toolMgr->PostAction( ACTIONS::refreshPreview );
evt->SetPassEvent();
}
else
{
evt->SetPassEvent();
@ -1869,7 +1891,6 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
setCursor();
};
Activate();
// Must be done after Activate() so that it gets set into the correct context
@ -2080,7 +2101,10 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
if( item )
prepItemForPlacement( item, cursorPos );
controls->SetCursorPosition( cursorPos, false );
if( m_frame->GetMoveWarpsCursor() )
controls->SetCursorPosition( cursorPos, false );
m_toolMgr->PostAction( ACTIONS::refreshPreview );
}
else // ... and second click places:
{
@ -2213,6 +2237,25 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
{
wxBell();
}
else if( item && ( evt->IsAction( &SCH_ACTIONS::toDLabel )
|| evt->IsAction( &SCH_ACTIONS::toGLabel )
|| evt->IsAction( &SCH_ACTIONS::toHLabel )
|| evt->IsAction( &SCH_ACTIONS::toLabel )
|| evt->IsAction( &SCH_ACTIONS::toText )
|| evt->IsAction( &SCH_ACTIONS::toTextBox ) ) )
{
wxBell();
}
else if( item && ( evt->IsAction( &SCH_ACTIONS::properties )
|| evt->IsAction( &SCH_ACTIONS::autoplaceFields )
|| evt->IsAction( &SCH_ACTIONS::rotateCW )
|| evt->IsAction( &SCH_ACTIONS::rotateCCW )
|| evt->IsAction( &SCH_ACTIONS::mirrorV )
|| evt->IsAction( &SCH_ACTIONS::mirrorH ) ) )
{
m_toolMgr->PostAction( ACTIONS::refreshPreview );
evt->SetPassEvent();
}
else
{
evt->SetPassEvent();
@ -2389,9 +2432,18 @@ int SCH_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|| isSyntheticClick
|| evt->IsAction( &ACTIONS::finishInteractive ) ) )
{
if( evt->IsDblClick( BUT_LEFT )
|| evt->IsAction( &ACTIONS::finishInteractive )
|| !item->ContinueEdit( cursorPos ) )
bool finished = false;
if( evt->IsDblClick( BUT_LEFT ) || evt->IsAction( &ACTIONS::finishInteractive ) )
{
finished = true;
}
else
{
finished = !item->ContinueEdit( cursorPos );
}
if( finished )
{
item->EndEdit();
item->ClearEditFlags();
@ -2439,8 +2491,7 @@ int SCH_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
m_toolMgr->PostAction( ACTIONS::activatePointEditor );
}
}
else if( evt->IsAction( &ACTIONS::duplicate )
|| evt->IsAction( &SCH_ACTIONS::repeatDrawItem ) )
else if( evt->IsAction( &ACTIONS::duplicate ) || evt->IsAction( &SCH_ACTIONS::repeatDrawItem ) )
{
if( item )
{

4
eeschema/tools/sch_edit_tool.cpp

@ -629,7 +629,7 @@ bool SCH_EDIT_TOOL::Init()
menu->SetIcon( BITMAPS::right );
menu->AddItem( SCH_ACTIONS::toLabel, toLabelCondition );
menu->AddItem( SCH_ACTIONS::toCLabel, toCLabelCondition );
menu->AddItem(SCH_ACTIONS::toDLabel, toCLabelCondition );
menu->AddItem( SCH_ACTIONS::toHLabel, toHLabelCondition );
menu->AddItem( SCH_ACTIONS::toGLabel, toGLabelCondition );
menu->AddItem( SCH_ACTIONS::toText, toTextCondition );
@ -3278,7 +3278,7 @@ void SCH_EDIT_TOOL::setTransitions()
Go( &SCH_EDIT_TOOL::ChangeTextType, SCH_ACTIONS::toLabel.MakeEvent() );
Go( &SCH_EDIT_TOOL::ChangeTextType, SCH_ACTIONS::toHLabel.MakeEvent() );
Go( &SCH_EDIT_TOOL::ChangeTextType, SCH_ACTIONS::toGLabel.MakeEvent() );
Go( &SCH_EDIT_TOOL::ChangeTextType, SCH_ACTIONS::toCLabel.MakeEvent() );
Go( &SCH_EDIT_TOOL::ChangeTextType, SCH_ACTIONS::toDLabel.MakeEvent() );
Go( &SCH_EDIT_TOOL::ChangeTextType, SCH_ACTIONS::toText.MakeEvent() );
Go( &SCH_EDIT_TOOL::ChangeTextType, SCH_ACTIONS::toTextBox.MakeEvent() );
Go( &SCH_EDIT_TOOL::JustifyText, ACTIONS::leftJustify.MakeEvent() );

14
eeschema/tools/sch_move_tool.cpp

@ -860,38 +860,48 @@ bool SCH_MOVE_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, SCH_COMMIT* aComm
else if( evt->IsAction( &SCH_ACTIONS::rotateCW ) )
{
m_toolMgr->RunSynchronousAction( SCH_ACTIONS::rotateCW, aCommit );
m_toolMgr->PostAction( ACTIONS::refreshPreview );
}
else if( evt->IsAction( &SCH_ACTIONS::rotateCCW ) )
{
m_toolMgr->RunSynchronousAction( SCH_ACTIONS::rotateCCW, aCommit );
m_toolMgr->PostAction( ACTIONS::refreshPreview );
}
else if( evt->IsAction( &ACTIONS::increment ) )
{
m_toolMgr->RunSynchronousAction( ACTIONS::increment, aCommit, evt->Parameter<ACTIONS::INCREMENT>() );
m_toolMgr->PostAction( ACTIONS::refreshPreview );
}
else if( evt->IsAction( &SCH_ACTIONS::toCLabel ) )
else if( evt->IsAction( &SCH_ACTIONS::toDLabel ) )
{
m_toolMgr->RunSynchronousAction( SCH_ACTIONS::toCLabel, aCommit );
m_toolMgr->RunSynchronousAction(SCH_ACTIONS::toDLabel, aCommit );
m_toolMgr->PostAction( ACTIONS::refreshPreview );
}
else if( evt->IsAction( &SCH_ACTIONS::toGLabel ) )
{
m_toolMgr->RunSynchronousAction( SCH_ACTIONS::toGLabel, aCommit );
m_toolMgr->PostAction( ACTIONS::refreshPreview );
}
else if( evt->IsAction( &SCH_ACTIONS::toHLabel ) )
{
m_toolMgr->RunSynchronousAction( SCH_ACTIONS::toHLabel, aCommit );
m_toolMgr->PostAction( ACTIONS::refreshPreview );
}
else if( evt->IsAction( &SCH_ACTIONS::toLabel ) )
{
m_toolMgr->RunSynchronousAction( SCH_ACTIONS::toLabel, aCommit );
m_toolMgr->PostAction( ACTIONS::refreshPreview );
}
else if( evt->IsAction( &SCH_ACTIONS::toText ) )
{
m_toolMgr->RunSynchronousAction( SCH_ACTIONS::toText, aCommit );
m_toolMgr->PostAction( ACTIONS::refreshPreview );
}
else if( evt->IsAction( &SCH_ACTIONS::toTextBox ) )
{
m_toolMgr->RunSynchronousAction( SCH_ACTIONS::toTextBox, aCommit );
m_toolMgr->PostAction( ACTIONS::refreshPreview );
}
else if( evt->Action() == TA_CHOICE_MENU_CHOICE )
{

7
eeschema/tools/symbol_editor_drawing_tools.cpp

@ -265,7 +265,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
else
{
getViewControls()->PinCursorInsideNonAutoscrollArea( true );
cursorPos = getViewControls()->GetMousePosition();
cursorPos = grid.Align( getViewControls()->GetMousePosition(), grid.GetItemGrid( item ) );
}
if( item )
@ -281,7 +281,10 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
setCursor();
}
controls->SetCursorPosition( cursorPos, false );
if( m_frame->GetMoveWarpsCursor() )
controls->SetCursorPosition( cursorPos, false );
m_toolMgr->PostAction( ACTIONS::refreshPreview );
}
// ... and second click places:
else

Loading…
Cancel
Save