Browse Source

Update constraint mode in status bar during move.

Fixes https://gitlab.com/kicad/code/kicad/issues/10465
7.0
Jeff Young 3 years ago
parent
commit
2bf33321d1
  1. 6
      pcbnew/tools/drawing_tool.cpp
  2. 4
      pcbnew/tools/drawing_tool.h
  3. 13
      pcbnew/tools/edit_tool_move_fct.cpp

6
pcbnew/tools/drawing_tool.cpp

@ -263,7 +263,7 @@ void DRAWING_TOOL::Reset( RESET_REASON aReason )
m_board = getModel<BOARD>();
m_frame = getEditFrame<PCB_BASE_EDIT_FRAME>();
updateStatusBar();
UpdateStatusBar();
}
@ -273,7 +273,7 @@ DRAWING_TOOL::MODE DRAWING_TOOL::GetDrawingMode() const
}
void DRAWING_TOOL::updateStatusBar() const
void DRAWING_TOOL::UpdateStatusBar() const
{
if( m_frame )
{
@ -1737,7 +1737,7 @@ int DRAWING_TOOL::ToggleHV45Mode( const TOOL_EVENT& toolEvent )
else
TOGGLE( mgr.GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>()->m_Use45Limit );
updateStatusBar();
UpdateStatusBar();
return 0;

4
pcbnew/tools/drawing_tool.h

@ -215,6 +215,8 @@ public:
m_stroke = aStroke;
}
void UpdateStatusBar() const;
private:
/**
* Start drawing a selected shape (i.e. PCB_SHAPE).
@ -273,8 +275,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;

13
pcbnew/tools/edit_tool_move_fct.cpp

@ -48,6 +48,7 @@
#include <tools/pcb_grid_helper.h>
#include <tools/pad_tool.h>
#include <tools/drc_tool.h>
#include <tools/drawing_tool.h>
#include <view/view_controls.h>
#include <connectivity/connectivity_algo.h>
#include <connectivity/connectivity_items.h>
@ -358,6 +359,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
std::vector<FOOTPRINT*> lastFpInConflict; // last footprints with courtyard overlapping
@ -401,6 +409,8 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
bool showCourtyardConflicts = !m_isFootprintEditor
&& board->IsElementVisible( LAYER_CONFLICTS_SHADOW );
displayConstraintsMessage( hv45Mode );
// Used to test courtyard overlaps
DRC_TEST_PROVIDER_COURTYARD_CLEARANCE_ON_MOVE drc_on_move;
@ -693,6 +703,7 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
else if( evt->IsAction( &PCB_ACTIONS::toggleHV45Mode ) )
{
hv45Mode = !hv45Mode;
displayConstraintsMessage( hv45Mode );
evt->SetPassEvent( false );
}
else
@ -716,6 +727,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 );

Loading…
Cancel
Save