Show the current grid setting.

This commit is contained in:
Steven A. Falco 2019-05-24 09:55:33 -04:00 committed by Wayne Stambaugh
parent 517c79c9cd
commit 1edeba7fb4
9 changed files with 177 additions and 7 deletions

View File

@ -113,7 +113,7 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
m_auimgr.SetFlags(wxAUI_MGR_DEFAULT); m_auimgr.SetFlags(wxAUI_MGR_DEFAULT);
CreateStatusBar( 6 ); CreateStatusBar( 7 );
// set the size of the status bar subwindows: // set the size of the status bar subwindows:
@ -136,6 +136,9 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
// delta distances // delta distances
GetTextSize( wxT( "dx 0234.567890 dx 0234.567890 d 0234.567890" ), stsbar ).x + 10, 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 // units display, Inches is bigger than mm
GetTextSize( _( "Inches" ), stsbar ).x + 10, GetTextSize( _( "Inches" ), stsbar ).x + 10,
@ -361,6 +364,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() void EDA_DRAW_FRAME::DisplayUnitsMsg()
{ {
wxString msg; wxString msg;
@ -372,7 +406,7 @@ void EDA_DRAW_FRAME::DisplayUnitsMsg()
default: msg = _( "Units" ); break; default: msg = _( "Units" ); break;
} }
SetStatusText( msg, 4 ); SetStatusText( msg, 5 );
} }

View File

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

View File

@ -983,6 +983,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() void GERBVIEW_FRAME::UpdateStatusBar()
{ {
EDA_DRAW_FRAME::UpdateStatusBar(); EDA_DRAW_FRAME::UpdateStatusBar();
@ -1058,6 +1094,8 @@ void GERBVIEW_FRAME::UpdateStatusBar()
line.Printf( relformatter, dXpos, dYpos, hypot( dXpos, dYpos ) ); line.Printf( relformatter, dXpos, dYpos, hypot( dXpos, dYpos ) );
SetStatusText( line, 3 ); SetStatusText( line, 3 );
} }
DisplayGridMsg();
} }

View File

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

View File

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

View File

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

View File

@ -141,11 +141,14 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
// delta distances // delta distances
GetTextSize( wxT( "dx 0234.567 dx 0234.567" ), stsbar ).x + 10, 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) // Coord origin (use the bigger message)
GetTextSize( _( "coord origin: Right Bottom page corner" ), stsbar ).x + 10, GetTextSize( _( "coord origin: Right Bottom page corner" ), stsbar ).x + 10,
// units display, Inches is bigger than mm // units display, Inches is bigger than mm
GetTextSize( _( "Inches" ), stsbar ).x + 10 GetTextSize( _( "Inches" ), stsbar ).x + 20
}; };
SetStatusWidths( arrayDim( dims ), dims ); SetStatusWidths( arrayDim( dims ), dims );
@ -498,6 +501,37 @@ wxPoint PL_EDITOR_FRAME::ReturnCoordOriginCorner() const
} }
/*
* 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() void PL_EDITOR_FRAME::UpdateStatusBar()
{ {
PL_EDITOR_SCREEN* screen = (PL_EDITOR_SCREEN*) GetScreen(); PL_EDITOR_SCREEN* screen = (PL_EDITOR_SCREEN*) GetScreen();
@ -551,9 +585,9 @@ void PL_EDITOR_FRAME::UpdateStatusBar()
switch( GetUserUnits() ) switch( GetUserUnits() )
{ {
case INCHES: SetStatusText( _("inches"), 5 ); break; case INCHES: SetStatusText( _("inches"), 6 ); break;
case MILLIMETRES: SetStatusText( _("mm"), 5 ); break; case MILLIMETRES: SetStatusText( _("mm"), 6 ); break;
case UNSCALED_UNITS: SetStatusText( wxEmptyString, 5 ); break; case UNSCALED_UNITS: SetStatusText( wxEmptyString, 6 ); break;
case DEGREES: wxASSERT( false ); break; case DEGREES: wxASSERT( false ); break;
} }
@ -578,10 +612,12 @@ void PL_EDITOR_FRAME::UpdateStatusBar()
line.Printf( locformatter, dXpos, dYpos ); line.Printf( locformatter, dXpos, dYpos );
SetStatusText( line, 3 ); SetStatusText( line, 3 );
DisplayGridMsg();
// Display corner reference for coord origin // Display corner reference for coord origin
line.Printf( _("coord origin: %s"), line.Printf( _("coord origin: %s"),
m_originSelectBox->GetString( m_originSelectChoice ).GetData() ); m_originSelectBox->GetString( m_originSelectChoice ).GetData() );
SetStatusText( line, 4 ); SetStatusText( line, 5 );
// Display units // Display units
} }

View File

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

View File

@ -596,6 +596,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. * Update the status bar information.
*/ */
@ -675,6 +711,8 @@ void PCB_BASE_FRAME::UpdateStatusBar()
line.Printf( locformatter, dXpos, dYpos, hypot( dXpos, dYpos ) ); line.Printf( locformatter, dXpos, dYpos, hypot( dXpos, dYpos ) );
SetStatusText( line, 3 ); SetStatusText( line, 3 );
} }
DisplayGridMsg();
} }