Cherry-pick of 2bf33321d1.

This commit is contained in:
Jeff Young 2022-08-04 09:29:45 +01:00
parent 3bca4f8835
commit 4ac48ad829
3 changed files with 18 additions and 5 deletions

View File

@ -241,7 +241,7 @@ void DRAWING_TOOL::Reset( RESET_REASON aReason )
m_board = getModel<BOARD>();
m_frame = getEditFrame<PCB_BASE_EDIT_FRAME>();
updateStatusBar();
UpdateStatusBar();
}
@ -251,7 +251,7 @@ DRAWING_TOOL::MODE DRAWING_TOOL::GetDrawingMode() const
}
void DRAWING_TOOL::updateStatusBar() const
void DRAWING_TOOL::UpdateStatusBar() const
{
if( m_frame )
{
@ -1419,7 +1419,7 @@ int DRAWING_TOOL::ToggleLine45degMode( const TOOL_EVENT& toolEvent )
else
m_frame->Settings().m_FpeditUse45DegreeLimit = !m_frame->Settings().m_FpeditUse45DegreeLimit;
updateStatusBar();
UpdateStatusBar();
return 0;
}

View File

@ -202,6 +202,8 @@ public:
///< Set up handlers for various events.
void setTransitions() override;
void UpdateStatusBar() const;
private:
/**
* Start drawing a selected shape (i.e. PCB_SHAPE).
@ -261,8 +263,6 @@ private:
///< Return the appropriate width for a segment depending on the settings.
int getSegmentWidth( PCB_LAYER_ID aLayer ) const;
void updateStatusBar() const;
KIGFX::VIEW* m_view;
KIGFX::VIEW_CONTROLS* m_controls;
BOARD* m_board;

View File

@ -46,6 +46,7 @@
#include <tools/tool_event_utils.h>
#include <tools/pcb_grid_helper.h>
#include <tools/pad_tool.h>
#include <tools/drawing_tool.h>
#include <view/view_controls.h>
#include <connectivity/connectivity_algo.h>
#include <connectivity/connectivity_items.h>
@ -764,6 +765,13 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
return 0;
}
auto displayConstraintsMessage =
[editFrame]( bool constrained )
{
editFrame->DisplayConstraintsMsg( constrained ? _( "Constrain to H, V, 45" )
: wxT( "" ) );
};
std::vector<BOARD_ITEM*> sel_items; // All the items operated on by the move below
std::vector<BOARD_ITEM*> orig_items; // All the original items in the selection
@ -803,6 +811,8 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
bool hasRedrawn3D = false;
bool allowRedraw3D = editFrame->GetDisplayOptions().m_Live3DRefresh;
displayConstraintsMessage( lock45 );
// Prime the pump
m_toolMgr->RunAction( ACTIONS::refreshPreview );
@ -1048,6 +1058,7 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
else if( evt->IsAction( &PCB_ACTIONS::toggle45 ) )
{
lock45 = !lock45;
displayConstraintsMessage( lock45 );
evt->SetPassEvent( false );
}
else
@ -1064,6 +1075,8 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
m_dragging = false;
editFrame->UndoRedoBlock( false );
m_toolMgr->GetTool<DRAWING_TOOL>()->UpdateStatusBar();
if( hasRedrawn3D && restore_state )
editFrame->Update3DView( false, true );