Add status bar message for constraint mode.
Fixes https://gitlab.com/kicad/code/kicad/issues/9282
This commit is contained in:
parent
328d3d0d77
commit
c9d858eaf5
|
@ -111,11 +111,12 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
|
|||
|
||||
m_auimgr.SetFlags( wxAUI_MGR_DEFAULT );
|
||||
|
||||
CreateStatusBar( 7 );
|
||||
CreateStatusBar( 8 );
|
||||
|
||||
// set the size of the status bar subwindows:
|
||||
|
||||
wxWindow* stsbar = GetStatusBar();
|
||||
int spacer = KIUI::GetTextSize( wxT( "M" ), stsbar ).x * 2;
|
||||
|
||||
int dims[] = {
|
||||
|
||||
|
@ -126,22 +127,25 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
|
|||
// as the width of '0' unless the font is fixed width, and it usually won't be.
|
||||
|
||||
// zoom:
|
||||
KIUI::GetTextSize( wxT( "Z 762000" ), stsbar ).x + 10,
|
||||
KIUI::GetTextSize( wxT( "Z 762000" ), stsbar ).x + spacer,
|
||||
|
||||
// cursor coords
|
||||
KIUI::GetTextSize( wxT( "X 0234.567890 Y 0234.567890" ), stsbar ).x + 10,
|
||||
KIUI::GetTextSize( wxT( "X 1234.1234 Y 1234.1234" ), stsbar ).x + spacer,
|
||||
|
||||
// delta distances
|
||||
KIUI::GetTextSize( wxT( "dx 0234.567890 dx 0234.567890 d 0234.567890" ), stsbar ).x + 10,
|
||||
KIUI::GetTextSize( wxT( "dx 1234.1234 dy 1234.1234 dist 1234.1234" ), stsbar ).x + spacer,
|
||||
|
||||
// grid size
|
||||
KIUI::GetTextSize( wxT( "grid X 0234.567890 Y 0234.567890" ), stsbar ).x + 10,
|
||||
KIUI::GetTextSize( wxT( "grid X 1234.1234 Y 1234.1234" ), stsbar ).x + spacer,
|
||||
|
||||
// units display, Inches is bigger than mm
|
||||
KIUI::GetTextSize( _( "Inches" ), stsbar ).x + 10,
|
||||
KIUI::GetTextSize( _( "Inches" ), stsbar ).x + spacer,
|
||||
|
||||
// Size for the "Current Tool" panel; longest string from SetTool()
|
||||
KIUI::GetTextSize( wxT( "Add layer alignment target" ), stsbar ).x + 10,
|
||||
KIUI::GetTextSize( wxT( "Add layer alignment target" ), stsbar ).x + spacer,
|
||||
|
||||
// constraint mode
|
||||
KIUI::GetTextSize( _( "Constrain to H, V, 45" ), stsbar ).x + spacer
|
||||
};
|
||||
|
||||
SetStatusWidths( arrayDim( dims ), dims );
|
||||
|
@ -517,6 +521,12 @@ void EDA_DRAW_FRAME::DisplayToolMsg( const wxString& msg )
|
|||
}
|
||||
|
||||
|
||||
void EDA_DRAW_FRAME::DisplayConstraintsMsg( const wxString& msg )
|
||||
{
|
||||
SetStatusText( msg, 7 );
|
||||
}
|
||||
|
||||
|
||||
void EDA_DRAW_FRAME::DisplayGridMsg()
|
||||
{
|
||||
wxString line;
|
||||
|
|
|
@ -942,13 +942,15 @@ void GERBVIEW_FRAME::SetGridColor( const COLOR4D& aColor )
|
|||
|
||||
void GERBVIEW_FRAME::DisplayGridMsg()
|
||||
{
|
||||
VECTOR2D gridSize = GetCanvas()->GetGAL()->GetGridSize();
|
||||
wxString line;
|
||||
|
||||
line.Printf( "grid X %s Y %s",
|
||||
MessageTextFromValue( m_userUnits, GetCanvas()->GetGAL()->GetGridSize().x ),
|
||||
MessageTextFromValue( m_userUnits, GetCanvas()->GetGAL()->GetGridSize().y ) );
|
||||
MessageTextFromValue( m_userUnits, gridSize.x, false ),
|
||||
MessageTextFromValue( m_userUnits, gridSize.y, false ) );
|
||||
|
||||
SetStatusText( line, 4 );
|
||||
SetStatusText( line, 4 );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -324,6 +324,8 @@ public:
|
|||
|
||||
void DisplayToolMsg( const wxString& msg ) override;
|
||||
|
||||
void DisplayConstraintsMsg( const wxString& msg );
|
||||
|
||||
/**
|
||||
* Called when modifying the page settings.
|
||||
* In derived classes it can be used to modify parameters like draw area size,
|
||||
|
|
|
@ -611,11 +611,12 @@ GENERAL_COLLECTORS_GUIDE PCB_BASE_FRAME::GetCollectorsGuide()
|
|||
|
||||
void PCB_BASE_FRAME::DisplayGridMsg()
|
||||
{
|
||||
VECTOR2D gridSize = GetCanvas()->GetGAL()->GetGridSize();
|
||||
wxString line;
|
||||
|
||||
line.Printf( "grid X %s Y %s",
|
||||
MessageTextFromValue( m_userUnits, GetCanvas()->GetGAL()->GetGridSize().x ),
|
||||
MessageTextFromValue( m_userUnits, GetCanvas()->GetGAL()->GetGridSize().y ) );
|
||||
MessageTextFromValue( m_userUnits, gridSize.x, false ),
|
||||
MessageTextFromValue( m_userUnits, gridSize.y, false ) );
|
||||
|
||||
SetStatusText( line, 4 );
|
||||
}
|
||||
|
|
|
@ -25,7 +25,8 @@
|
|||
|
||||
#include "drawing_tool.h"
|
||||
|
||||
|
||||
#include <pgm_base.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <dialogs/dialog_text_properties.h>
|
||||
#include <dialogs/dialog_track_via_size.h>
|
||||
#include <geometry/geometry_utils.h>
|
||||
|
@ -239,6 +240,8 @@ void DRAWING_TOOL::Reset( RESET_REASON aReason )
|
|||
m_controls = getViewControls();
|
||||
m_board = getModel<BOARD>();
|
||||
m_frame = getEditFrame<PCB_BASE_EDIT_FRAME>();
|
||||
|
||||
updateStatusBar();
|
||||
}
|
||||
|
||||
|
||||
|
@ -248,6 +251,22 @@ DRAWING_TOOL::MODE DRAWING_TOOL::GetDrawingMode() const
|
|||
}
|
||||
|
||||
|
||||
void DRAWING_TOOL::updateStatusBar() const
|
||||
{
|
||||
if( m_frame )
|
||||
{
|
||||
bool constrained;
|
||||
|
||||
if( m_frame->IsType( FRAME_PCB_EDITOR ) )
|
||||
constrained = m_frame->Settings().m_PcbUse45DegreeLimit;
|
||||
else
|
||||
constrained = m_frame->Settings().m_FpeditUse45DegreeLimit;
|
||||
|
||||
m_frame->DisplayConstraintsMsg( constrained ? _( "Constrain to H, V, 45" ) : _( "" ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int DRAWING_TOOL::DrawLine( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
if( m_isFootprintEditor && !m_frame->GetModel() )
|
||||
|
@ -1381,6 +1400,8 @@ int DRAWING_TOOL::ToggleLine45degMode( const TOOL_EVENT& toolEvent )
|
|||
else
|
||||
m_frame->Settings().m_FpeditUse45DegreeLimit = !m_frame->Settings().m_FpeditUse45DegreeLimit;
|
||||
|
||||
updateStatusBar();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -261,6 +261,8 @@ 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;
|
||||
|
|
Loading…
Reference in New Issue