Show the current grid setting.

This commit is contained in:
Steven A. Falco 2019-06-10 10:16:14 -04:00 committed by Wayne Stambaugh
parent 1ed411e431
commit cfa187f477
10 changed files with 213 additions and 9 deletions

View File

@ -169,7 +169,7 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
m_auimgr.SetFlags(wxAUI_MGR_DEFAULT);
CreateStatusBar( 6 );
CreateStatusBar( 7 );
// set the size of the status bar subwindows:
@ -192,6 +192,9 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
// delta distances
GetTextSize( wxT( "dx 0234.567890 dx 0234.567890 d 0234.567890" ), stsbar ).x + 10,
// grid size
GetTextSize( wxT( "grid X 0234.567890 Y 0234.567890" ), stsbar ).x + 10,
// units display, Inches is bigger than mm
GetTextSize( _( "Inches" ), stsbar ).x + 10,
@ -614,6 +617,37 @@ void EDA_DRAW_FRAME::DisplayToolMsg( const wxString& msg )
}
/*
* Display the grid status.
*/
void EDA_DRAW_FRAME::DisplayGridMsg()
{
wxString line;
wxString gridformatter;
switch( m_UserUnits )
{
case INCHES:
gridformatter = "grid %.3f";
break;
case MILLIMETRES:
gridformatter = "grid %.4f";
break;
default:
gridformatter = "grid %f";
break;
}
wxRealPoint curr_grid_size = GetScreen()->GetGridSize();
double grid = To_User_Unit( m_UserUnits, curr_grid_size.x );
line.Printf( gridformatter, grid );
SetStatusText( line, 4 );
}
void EDA_DRAW_FRAME::DisplayUnitsMsg()
{
wxString msg;
@ -625,7 +659,7 @@ void EDA_DRAW_FRAME::DisplayUnitsMsg()
default: msg = _( "Units" ); break;
}
SetStatusText( msg, 4 );
SetStatusText( msg, 5 );
}

View File

@ -172,7 +172,7 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
m_auimgr.SetFlags(wxAUI_MGR_DEFAULT);
CreateStatusBar( 6 );
CreateStatusBar( 7 );
// set the size of the status bar subwindows:
@ -195,6 +195,9 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
// delta distances
GetTextSize( wxT( "dx 0234.567890 dx 0234.567890 d 0234.567890" ), stsbar ).x + 10,
// grid size
GetTextSize( wxT( "grid X 0234.567890 Y 0234.567890" ), stsbar ).x + 10,
// units display, Inches is bigger than mm
GetTextSize( _( "Inches" ), stsbar ).x + 10,
@ -622,6 +625,37 @@ void EDA_DRAW_FRAME::DisplayToolMsg( const wxString& msg )
}
/*
* Display the grid status.
*/
void EDA_DRAW_FRAME::DisplayGridMsg()
{
wxString line;
wxString gridformatter;
switch( m_UserUnits )
{
case INCHES:
gridformatter = "grid %.3f";
break;
case MILLIMETRES:
gridformatter = "grid %.4f";
break;
default:
gridformatter = "grid %f";
break;
}
wxRealPoint curr_grid_size = GetScreen()->GetGridSize();
double grid = To_User_Unit( m_UserUnits, curr_grid_size.x );
line.Printf( gridformatter, grid );
SetStatusText( line, 4 );
}
void EDA_DRAW_FRAME::DisplayUnitsMsg()
{
wxString msg;
@ -641,7 +675,7 @@ void EDA_DRAW_FRAME::DisplayUnitsMsg()
break;
}
SetStatusText( msg, 4 );
SetStatusText( msg, 5 );
}

View File

@ -284,6 +284,9 @@ void SCH_BASE_FRAME::UpdateStatusBar()
line.Printf( locformatter, dXpos, dYpos, hypot( dXpos, dYpos ) );
SetStatusText( line, 3 );
// refresh grid display
DisplayGridMsg();
// refresh units display
DisplayUnitsMsg();
}

View File

@ -1043,6 +1043,42 @@ void GERBVIEW_FRAME::SetGridColor( COLOR4D aColor )
}
/*
* Display the grid status.
*/
void GERBVIEW_FRAME::DisplayGridMsg()
{
wxString line;
wxString gridformatter;
switch( m_UserUnits )
{
case INCHES:
gridformatter = "grid X %.6f Y %.6f";
break;
case MILLIMETRES:
gridformatter = "grid X %.6f Y %.6f";
break;
default:
gridformatter = "grid X %f Y %f";
break;
}
BASE_SCREEN* screen = GetScreen();
wxArrayString gridsList;
int icurr = screen->BuildGridsChoiceList( gridsList, m_UserUnits != INCHES );
GRID_TYPE& grid = screen->GetGrid( icurr );
double grid_x = To_User_Unit( m_UserUnits, grid.m_Size.x );
double grid_y = To_User_Unit( m_UserUnits, grid.m_Size.y );
line.Printf( gridformatter, grid_x, grid_y );
SetStatusText( line, 4 );
}
void GERBVIEW_FRAME::UpdateStatusBar()
{
EDA_DRAW_FRAME::UpdateStatusBar();
@ -1127,6 +1163,8 @@ void GERBVIEW_FRAME::UpdateStatusBar()
line.Printf( relformatter, dXpos, dYpos, hypot( dXpos, dYpos ) );
SetStatusText( line, 3 );
}
DisplayGridMsg();
}

View File

@ -402,6 +402,13 @@ public:
*/
void UpdateTitleAndInfo();
/**
* Function DisplayGridMsg()
*
* Display the current grid pane on the status bar.
*/
void DisplayGridMsg();
/**
* Function GetConfigurationSettings
* Populates the GerbView applications settings list.

View File

@ -840,6 +840,11 @@ public:
*/
void CopyToClipboard( wxCommandEvent& event );
/**
* Display current grid pane on the status bar.
*/
void DisplayGridMsg();
/* interprocess communication */
void CreateServer( int service, bool local = true );
void OnSockRequest( wxSocketEvent& evt );

View File

@ -611,6 +611,13 @@ public:
*/
void SetPrevGrid() override;
/**
* Function DisplayGridMsg()
*
* Display the current grid pane on the status bar.
*/
void DisplayGridMsg();
///> @copydoc EDA_DRAW_FRAME::UseGalCanvas
virtual void UseGalCanvas( bool aEnable ) override;

View File

@ -111,11 +111,14 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
// delta distances
GetTextSize( wxT( "dx 0234.567 dx 0234.567" ), stsbar ).x + 10,
// grid size
GetTextSize( wxT( "grid 0234.567" ), stsbar ).x + 10,
// Coord origin (use the bigger message)
GetTextSize( _( "coord origin: Right Bottom page corner" ), stsbar ).x + 10,
// units display, Inches is bigger than mm
GetTextSize( _( "Inches" ), stsbar ).x + 10
GetTextSize( _( "Inches" ), stsbar ).x + 20
};
SetStatusWidths( arrayDim( dims ), dims );
@ -314,6 +317,37 @@ void PL_EDITOR_FRAME::SetTitleBlock( const TITLE_BLOCK& aTitleBlock )
}
/*
* Display the grid status.
*/
void PL_EDITOR_FRAME::DisplayGridMsg()
{
wxString line;
wxString gridformatter;
switch( m_UserUnits )
{
case INCHES:
gridformatter = "grid %.3f";
break;
case MILLIMETRES:
gridformatter = "grid %.4f";
break;
default:
gridformatter = "grid %f";
break;
}
wxRealPoint curr_grid_size = GetScreen()->GetGridSize();
double grid = To_User_Unit( m_UserUnits, curr_grid_size.x );
line.Printf( gridformatter, grid );
SetStatusText( line, 4 );
}
void PL_EDITOR_FRAME::UpdateStatusBar()
{
PL_EDITOR_SCREEN* screen = (PL_EDITOR_SCREEN*) GetScreen();
@ -378,15 +412,15 @@ void PL_EDITOR_FRAME::UpdateStatusBar()
switch( GetUserUnits() )
{
case INCHES: // Should not be used in page layout editor
SetStatusText( _("inches"), 5 );
SetStatusText( _("inches"), 6 );
break;
case MILLIMETRES:
SetStatusText( _("mm"), 5 );
SetStatusText( _("mm"), 6 );
break;
case UNSCALED_UNITS:
SetStatusText( wxEmptyString, 5 );
SetStatusText( wxEmptyString, 6 );
break;
case DEGREES:
@ -415,10 +449,12 @@ void PL_EDITOR_FRAME::UpdateStatusBar()
line.Printf( locformatter, dXpos, dYpos );
SetStatusText( line, 3 );
DisplayGridMsg();
// Display corner reference for coord origin
line.Printf( _("coord origin: %s"),
m_originSelectBox->GetString( m_originSelectChoice ). GetData() );
SetStatusText( line, 4 );
SetStatusText( line, 5 );
// Display units
}

View File

@ -142,6 +142,8 @@ public:
const TITLE_BLOCK& GetTitleBlock() const override;
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) override;
void DisplayGridMsg();
void UpdateStatusBar() override;
/**

View File

@ -820,6 +820,42 @@ void PCB_BASE_FRAME::SetToolID( int aId, int aCursor, const wxString& aToolMsg )
}
/*
* Display the grid status.
*/
void PCB_BASE_FRAME::DisplayGridMsg()
{
wxString line;
wxString gridformatter;
switch( m_UserUnits )
{
case INCHES:
gridformatter = "grid X %.6f Y %.6f";
break;
case MILLIMETRES:
gridformatter = "grid X %.6f Y %.6f";
break;
default:
gridformatter = "grid X %f Y %f";
break;
}
BASE_SCREEN* screen = GetScreen();
wxArrayString gridsList;
int icurr = screen->BuildGridsChoiceList( gridsList, m_UserUnits != INCHES );
GRID_TYPE& grid = screen->GetGrid( icurr );
double grid_x = To_User_Unit( m_UserUnits, grid.m_Size.x );
double grid_y = To_User_Unit( m_UserUnits, grid.m_Size.y );
line.Printf( gridformatter, grid_x, grid_y );
SetStatusText( line, 4 );
}
/*
* Update the status bar information.
*/
@ -913,6 +949,8 @@ void PCB_BASE_FRAME::UpdateStatusBar()
line.Printf( locformatter, dXpos, dYpos, hypot( dXpos, dYpos ) );
SetStatusText( line, 3 );
}
DisplayGridMsg();
}