Remove global units usage from GetSelectionText...

... and GetMsgPanelInfo.

Step 4 in the g_UserUnit eradication effort.

Also removes a couple of conversion routines that were close
enough to extinction.

(cherry picked from commit c75da51)
This commit is contained in:
Jeff Young 2018-04-10 11:52:12 +01:00
parent 1569842927
commit eacaa39aa2
108 changed files with 539 additions and 687 deletions

View File

@ -171,7 +171,7 @@ SEARCH_RESULT EDA_ITEM::Visit( INSPECTOR inspector, void* testData, const KICAD_
}
wxString EDA_ITEM::GetSelectMenuText() const
wxString EDA_ITEM::GetSelectMenuText( EDA_UNITS_T aUnits ) const
{
wxFAIL_MSG( wxT( "GetSelectMenuText() was not overridden for schematic item type " ) +
GetClass() );

View File

@ -121,12 +121,6 @@ double To_User_Unit( EDA_UNITS_T aUnit, double aValue, bool aUseMils )
* could truncate the actual value
*/
// JEY TODO: retire this in favour of MessageTextFromValue()....
wxString CoordinateToString( int aValue, bool aUseMils )
{
return MessageTextFromValue( g_UserUnit, aValue, aUseMils );
}
// A lower-precision (for readability) version of StringFromValue()
wxString MessageTextFromValue( EDA_UNITS_T aUnits, int aValue, bool aUseMils )
@ -390,16 +384,6 @@ int ValueFromString( EDA_UNITS_T aUnits, const wxString& aTextValue, bool aUseMi
}
// JEY TODO: remove
int ValueFromString( const wxString& aTextValue )
{
int value;
value = ValueFromString( g_UserUnit, aTextValue);
return value;
}
// JEY TODO: remove; use a UNIT_BINDER instead
int ValueFromTextCtrl( const wxTextCtrl& aTextCtr )
{
@ -415,16 +399,6 @@ int ValueFromTextCtrl( const wxTextCtrl& aTextCtr )
return value;
}
wxString& operator <<( wxString& aString, const wxPoint& aPos )
{
aString << wxT( "@ (" ) << CoordinateToString( aPos.x );
aString << wxT( "," ) << CoordinateToString( aPos.y );
aString << wxT( ")" );
return aString;
}
/**
* Function AngleToStringDegrees
* is a helper to convert the \a double \a aAngle (in internal unit)

View File

@ -862,7 +862,7 @@ void EDA_DRAW_FRAME::SetMsgPanel( EDA_ITEM* aItem )
wxCHECK_RET( aItem != NULL, wxT( "Invalid EDA_ITEM pointer. Bad programmer." ) );
MSG_PANEL_ITEMS items;
aItem->GetMsgPanelInfo( items );
aItem->GetMsgPanelInfo( m_UserUnits, items );
SetMsgPanel( items );
}

View File

@ -537,7 +537,7 @@ void DISPLAY_FOOTPRINTS_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
if ( Module )
{
MSG_PANEL_ITEMS items;
Module->GetMsgPanelInfo( items );
Module->GetMsgPanelInfo( m_UserUnits, items );
SetMsgPanel( items );
}

View File

@ -118,7 +118,7 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateAndShowItem( const wxPoint& aPosition, const KIC
// Force display pin information (the previous display could be a component info)
MSG_PANEL_ITEMS items;
Pin->GetMsgPanelInfo( items, component );
Pin->GetMsgPanelInfo( m_UserUnits, items, component );
SetMsgPanel( items );
@ -188,7 +188,7 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateItem( const wxPoint& aPosition, const KICAD_T aF
for( int i = 0; i < m_collectedItems.GetCount() && i < MAX_SELECT_ITEM_IDS; i++ )
{
wxString text = m_collectedItems[i]->GetSelectMenuText();
wxString text = m_collectedItems[i]->GetSelectMenuText( m_UserUnits );
BITMAP_DEF xpm = m_collectedItems[i]->GetMenuImage();
AddMenuItem( &selectMenu, ID_SELECT_ITEM_START + i, text, KiBitmap( xpm ) );
}
@ -214,7 +214,7 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateItem( const wxPoint& aPosition, const KICAD_T aF
( (SCH_COMPONENT*) item )->SetCurrentSheetPath( &GetCurrentSheet() );
MSG_PANEL_ITEMS items;
item->GetMsgPanelInfo( items );
item->GetMsgPanelInfo( m_UserUnits, items );
SetMsgPanel( items );
}
else

View File

@ -69,17 +69,16 @@ wxString DRC_ITEM::GetErrorText() const
}
}
wxString DRC_ITEM::ShowCoord( const wxPoint& aPos )
wxString DRC_ITEM::ShowCoord( EDA_UNITS_T aUnits, const wxPoint& aPos )
{
return wxString::Format( _( "@(%s, %s)" ),
GetChars( CoordinateToString( aPos.x ) ),
GetChars( CoordinateToString( aPos.y ) ) );
MessageTextFromValue( aUnits, aPos.x ),
MessageTextFromValue( aUnits, aPos.y ) );
}
wxString DRC_ITEM::ShowHtml() const
{
wxString ret;
wxString mainText = m_MainText;
// a wxHtmlWindows does not like < and > in the text to display
// because these chars have a special meaning in html
@ -95,9 +94,7 @@ wxString DRC_ITEM::ShowHtml() const
if( m_noCoordinate )
{
// omit the coordinate, a NETCLASS has no location
ret.Printf( _( "<p><b>%s</b><br>&nbsp;&nbsp; %s" ),
GetChars( errText ),
GetChars( mainText ) );
return wxString::Format( _( "<p><b>%s</b><br>&nbsp;&nbsp; %s" ), errText, mainText );
}
else if( m_hasSecondItem )
{
@ -107,48 +104,45 @@ wxString DRC_ITEM::ShowHtml() const
// an html fragment for the entire message in the listbox. feel free
// to add color if you want:
ret.Printf( _( "<p><b>%s</b><br>&nbsp;&nbsp; <font color='%s'><a href=''>%s</a></font>: %s<br>&nbsp;&nbsp; %s: %s" ),
GetChars( errText ),
hrefColour.GetAsString( wxC2S_HTML_SYNTAX ),
GetChars( ShowCoord( m_MainPosition )),
GetChars( mainText ),
GetChars( ShowCoord( m_AuxiliaryPosition )),
GetChars( auxText ) );
return wxString::Format( _( "<p><b>%s</b><br>&nbsp;&nbsp; <font color='%s'><a href=''>%s</a></font>: %s<br>&nbsp;&nbsp; %s: %s" ),
errText,
hrefColour.GetAsString( wxC2S_HTML_SYNTAX ),
ShowCoord( g_UserUnit, m_MainPosition ),
mainText,
ShowCoord( g_UserUnit, m_AuxiliaryPosition ),
auxText );
}
else
{
ret.Printf( _( "<p><b>%s</b><br>&nbsp;&nbsp; <font color='%s'><a href=''>%s</a></font>: %s" ),
GetChars( errText ),
hrefColour.GetAsString( wxC2S_HTML_SYNTAX ),
GetChars( ShowCoord( m_MainPosition ) ),
GetChars( mainText ) );
return wxString::Format( _( "<p><b>%s</b><br>&nbsp;&nbsp; <font color='%s'><a href=''>%s</a></font>: %s" ),
errText,
hrefColour.GetAsString( wxC2S_HTML_SYNTAX ),
ShowCoord( g_UserUnit, m_MainPosition ),
mainText );
}
return ret;
}
wxString DRC_ITEM::ShowReport() const
{
wxString ret;
if( m_hasSecondItem )
{
ret.Printf( wxT( "ErrType(%d): %s\n %s: %s\n %s: %s\n" ),
m_ErrorCode,
GetChars( GetErrorText() ),
GetChars( ShowCoord( m_MainPosition ) ), GetChars( m_MainText ),
GetChars( ShowCoord( m_AuxiliaryPosition ) ), GetChars( m_AuxiliaryText ) );
return wxString::Format( wxT( "ErrType(%d): %s\n %s: %s\n %s: %s\n" ),
m_ErrorCode,
GetErrorText(),
ShowCoord( g_UserUnit, m_MainPosition ),
m_MainText,
ShowCoord( g_UserUnit, m_AuxiliaryPosition ),
m_AuxiliaryText );
}
else
{
ret.Printf( wxT( "ErrType(%d): %s\n %s: %s\n" ),
m_ErrorCode,
GetChars( GetErrorText() ),
GetChars( ShowCoord( m_MainPosition ) ), GetChars( m_MainText ) );
return wxString::Format( wxT( "ErrType(%d): %s\n %s: %s\n" ),
m_ErrorCode,
GetErrorText(),
ShowCoord( g_UserUnit, m_MainPosition ),
m_MainText );
}
return ret;
}

View File

@ -87,7 +87,7 @@ void SCH_EDIT_FRAME::EditComponentFieldText( SCH_FIELD* aField )
MSG_PANEL_ITEMS items;
component->SetCurrentSheetPath( &GetCurrentSheet() );
component->GetMsgPanelInfo( items );
component->GetMsgPanelInfo( m_UserUnits, items );
SetMsgPanel( items );
}

View File

@ -92,12 +92,10 @@ void SCH_EDIT_FRAME::OnFindDrcMarker( wxFindDialogEvent& event )
RedrawScreen( lastMarker->GetPosition(), warpCursor );
wxString path = sheetFoundIn->Path();
wxString units = GetAbbreviatedUnitsLabel();
double x = To_User_Unit( g_UserUnit, (double) lastMarker->GetPosition().x );
double y = To_User_Unit( g_UserUnit, (double) lastMarker->GetPosition().y );
msg.Printf( _( "Design rule check marker found in sheet %s at %0.3f%s, %0.3f%s" ),
GetChars( path ), x, GetChars( units ), y, GetChars( units) );
msg.Printf( _( "Design rule check marker found in sheet %s at %s, %s" ),
sheetFoundIn->Path(),
MessageTextFromValue( m_UserUnits, lastMarker->GetPosition().x ),
MessageTextFromValue( m_UserUnits, lastMarker->GetPosition().y ) );
SetStatusText( msg );
}
else
@ -449,7 +447,7 @@ void SCH_EDIT_FRAME::updateFindReplaceView( wxFindDialogEvent& aEvent )
if( m_foundItems.GetItem( data ) != NULL )
{
wxLogTrace( traceFindReplace, wxT( "Found " ) + m_foundItems.GetText() );
wxLogTrace( traceFindReplace, wxT( "Found " ) + m_foundItems.GetText( MILLIMETRES ) );
SCH_SHEET_PATH* sheet = schematic.GetSheetByPath( data.GetSheetPath() );
@ -483,7 +481,7 @@ void SCH_EDIT_FRAME::updateFindReplaceView( wxFindDialogEvent& aEvent )
RedrawScreen( data.GetPosition(), warpCursor );
msg = m_foundItems.GetText();
msg = m_foundItems.GetText( m_UserUnits );
if( aEvent.GetFlags() & FR_SEARCH_REPLACE )
aEvent.SetFlags( aEvent.GetFlags() | FR_REPLACE_ITEM_FOUND );

View File

@ -283,7 +283,7 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* aD
MSG_PANEL_ITEMS items;
component->SetCurrentSheetPath( &GetCurrentSheet() );
component->GetMsgPanelInfo( items );
component->GetMsgPanelInfo( m_UserUnits, items );
SetMsgPanel( items );
component->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode );

View File

@ -478,14 +478,14 @@ start(%d, %d), end(%d, %d), radius %d" ),
}
void LIB_ARC::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
void LIB_ARC::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList )
{
wxString msg;
EDA_RECT bBox = GetBoundingBox();
LIB_ITEM::GetMsgPanelInfo( aList );
LIB_ITEM::GetMsgPanelInfo( aUnits, aList );
msg = StringFromValue( g_UserUnit, m_Width, true );
msg = MessageTextFromValue( aUnits, m_Width, true );
aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg, BLUE ) );
@ -496,12 +496,12 @@ void LIB_ARC::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
}
wxString LIB_ARC::GetSelectMenuText() const
wxString LIB_ARC::GetSelectMenuText( EDA_UNITS_T aUnits ) const
{
return wxString::Format( _( "Arc center (%s, %s), radius %s" ),
GetChars( CoordinateToString( m_Pos.x ) ),
GetChars( CoordinateToString( m_Pos.y ) ),
GetChars( CoordinateToString( m_Radius ) ) );
MessageTextFromValue( aUnits, m_Pos.x ),
MessageTextFromValue( aUnits, m_Pos.y ),
MessageTextFromValue( aUnits, m_Radius ) );
}

View File

@ -102,7 +102,7 @@ public:
const EDA_RECT GetBoundingBox() const override;
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) override;
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override;
int GetPenSize() const override;
@ -159,7 +159,7 @@ public:
void CalcRadiusAngles();
wxString GetSelectMenuText() const override;
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
BITMAP_DEF GetMenuImage() const override;

View File

@ -319,14 +319,14 @@ const EDA_RECT LIB_BEZIER::GetBoundingBox() const
}
void LIB_BEZIER::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
void LIB_BEZIER::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList )
{
wxString msg;
EDA_RECT bBox = GetBoundingBox();
LIB_ITEM::GetMsgPanelInfo( aList );
LIB_ITEM::GetMsgPanelInfo( aUnits, aList );
msg = StringFromValue( g_UserUnit, m_Width, true );
msg = MessageTextFromValue( aUnits, m_Width, true );
aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg, BLUE ) );

View File

@ -104,7 +104,7 @@ public:
int GetPenSize( ) const override;
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) override;
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override;
EDA_ITEM* Clone() const override;

View File

@ -229,18 +229,18 @@ const EDA_RECT LIB_CIRCLE::GetBoundingBox() const
}
void LIB_CIRCLE::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
void LIB_CIRCLE::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList )
{
wxString msg;
EDA_RECT bBox = GetBoundingBox();
LIB_ITEM::GetMsgPanelInfo( aList );
LIB_ITEM::GetMsgPanelInfo( aUnits, aList );
msg = StringFromValue( g_UserUnit, m_Width, true );
msg = MessageTextFromValue( aUnits, m_Width, true );
aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg, BLUE ) );
msg = StringFromValue( g_UserUnit, m_Radius, true );
msg = MessageTextFromValue( aUnits, m_Radius, true );
aList.push_back( MSG_PANEL_ITEM( _( "Radius" ), msg, RED ) );
msg.Printf( wxT( "(%d, %d, %d, %d)" ), bBox.GetOrigin().x,
@ -250,12 +250,12 @@ void LIB_CIRCLE::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
}
wxString LIB_CIRCLE::GetSelectMenuText() const
wxString LIB_CIRCLE::GetSelectMenuText( EDA_UNITS_T aUnits ) const
{
return wxString::Format( _( "Circle center (%s, %s), radius %s" ),
GetChars( CoordinateToString( m_Pos.x ) ),
GetChars( CoordinateToString( m_Pos.y ) ),
GetChars( CoordinateToString( m_Radius ) ) );
MessageTextFromValue( aUnits, m_Pos.x ),
MessageTextFromValue( aUnits, m_Pos.y ),
MessageTextFromValue( aUnits, m_Radius ) );
}

View File

@ -69,7 +69,7 @@ public:
const EDA_RECT GetBoundingBox() const override;
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) override;
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override;
void BeginEdit( STATUS_FLAGS aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) ) override;
@ -102,7 +102,7 @@ public:
int GetRadius() const { return m_Radius; }
wxString GetSelectMenuText() const override;
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
BITMAP_DEF GetMenuImage() const override;

View File

@ -56,7 +56,7 @@ LIB_ITEM::LIB_ITEM( KICAD_T aType,
}
void LIB_ITEM::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
void LIB_ITEM::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList )
{
wxString msg;

View File

@ -248,7 +248,8 @@ public:
* </p>
* @param aList is the list to populate.
*/
virtual void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) override;
virtual void GetMsgPanelInfo( EDA_UNITS_T aUnits,
std::vector< MSG_PANEL_ITEM >& aList ) override;
/**
* Test LIB_ITEM objects for equivalence.

View File

@ -1401,7 +1401,7 @@ LIB_ITEM* LIB_EDIT_FRAME::locateItem( const wxPoint& aPosition, const KICAD_T aF
for( int i = 0; i < m_collectedItems.GetCount() && i < MAX_SELECT_ITEM_IDS; i++ )
{
wxString text = m_collectedItems[i]->GetSelectMenuText();
wxString text = m_collectedItems[i]->GetSelectMenuText( m_UserUnits );
BITMAP_DEF xpm = m_collectedItems[i]->GetMenuImage();
AddMenuItem( &selectMenu, ID_SELECT_ITEM_START + i, text, KiBitmap( xpm ) );
@ -1419,7 +1419,7 @@ LIB_ITEM* LIB_EDIT_FRAME::locateItem( const wxPoint& aPosition, const KICAD_T aF
if( item )
{
MSG_PANEL_ITEMS items;
item->GetMsgPanelInfo( items );
item->GetMsgPanelInfo( m_UserUnits, items );
SetMsgPanel( items );
}
else

View File

@ -532,11 +532,9 @@ void LIB_FIELD::SetText( const wxString& aText )
}
wxString LIB_FIELD::GetSelectMenuText() const
wxString LIB_FIELD::GetSelectMenuText( EDA_UNITS_T aUnits ) const
{
return wxString::Format( _( "Field %s \"%s\"" ),
GetChars( GetName() ),
GetChars( ShortenedShownText() ) );
return wxString::Format( _( "Field %s \"%s\"" ), GetName(), ShortenedShownText() );
}
@ -606,25 +604,24 @@ void LIB_FIELD::calcEdit( const wxPoint& aPosition )
}
void LIB_FIELD::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
void LIB_FIELD::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList )
{
wxString msg;
LIB_ITEM::GetMsgPanelInfo( aList );
LIB_ITEM::GetMsgPanelInfo( aUnits, aList );
// Display style:
msg = GetTextStyleName();
aList.push_back( MSG_PANEL_ITEM( _( "Style" ), msg, MAGENTA ) );
msg = StringFromValue( g_UserUnit, GetTextWidth(), true );
msg = MessageTextFromValue( aUnits, GetTextWidth(), true );
aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, BLUE ) );
msg = StringFromValue( g_UserUnit, GetTextHeight(), true );
msg = MessageTextFromValue( aUnits, GetTextHeight(), true );
aList.push_back( MSG_PANEL_ITEM( _( "Height" ), msg, BLUE ) );
// Display field name (ref, value ...)
msg = GetName();
aList.push_back( MSG_PANEL_ITEM( _( "Field" ), msg, BROWN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Field" ), GetName(), BROWN ) );
// Display field text:
aList.push_back( MSG_PANEL_ITEM( _( "Value" ), GetShownText(), BROWN ) );

View File

@ -165,7 +165,7 @@ public:
const EDA_RECT GetBoundingBox() const override;
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) override;
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override;
bool HitTest( const wxPoint& aPosition ) const override;
@ -231,7 +231,7 @@ public:
void SetWidth( int aWidth ) override { SetThickness( aWidth ); }
wxString GetSelectMenuText() const override;
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
BITMAP_DEF GetMenuImage() const override;

View File

@ -1698,19 +1698,17 @@ void LIB_PIN::SetWidth( int aWidth )
}
void LIB_PIN::getMsgPanelInfoBase( MSG_PANEL_ITEMS& aList )
void LIB_PIN::getMsgPanelInfoBase( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList )
{
wxString text = m_number.IsEmpty() ? wxT( "?" ) : m_number;
LIB_ITEM::GetMsgPanelInfo( aList );
LIB_ITEM::GetMsgPanelInfo( aUnits, aList );
aList.push_back( MSG_PANEL_ITEM( _( "Name" ), m_name, DARKCYAN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Number" ), text, DARKCYAN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Type" ),
GetText( m_type ),
RED ) );
aList.push_back( MSG_PANEL_ITEM( _( "Type" ), GetText( m_type ), RED ) );
text = GetText( m_shape );
@ -1724,33 +1722,33 @@ void LIB_PIN::getMsgPanelInfoBase( MSG_PANEL_ITEMS& aList )
aList.push_back( MSG_PANEL_ITEM( _( "Visible" ), text, DARKGREEN ) );
// Display pin length
text = StringFromValue( g_UserUnit, m_length, true );
text = StringFromValue( aUnits, m_length, true );
aList.push_back( MSG_PANEL_ITEM( _( "Length" ), text, MAGENTA ) );
text = getPinOrientationName( (unsigned) GetOrientationIndex( m_orientation ) );
aList.push_back( MSG_PANEL_ITEM( _( "Orientation" ), text, DARKMAGENTA ) );
}
void LIB_PIN::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
void LIB_PIN::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList )
{
getMsgPanelInfoBase( aList );
getMsgPanelInfoBase( aUnits, aList );
wxString text;
wxPoint pinpos = GetPosition();
pinpos.y = -pinpos.y; // Display coord are top to bottom
// lib items coord are bottom to top
text = StringFromValue( g_UserUnit, pinpos.x, true );
text = MessageTextFromValue( aUnits, pinpos.x, true );
aList.push_back( MSG_PANEL_ITEM( _( "Pos X" ), text, DARKMAGENTA ) );
text = StringFromValue( g_UserUnit, pinpos.y, true );
text = MessageTextFromValue( aUnits, pinpos.y, true );
aList.push_back( MSG_PANEL_ITEM( _( "Pos Y" ), text, DARKMAGENTA ) );
}
void LIB_PIN::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList,
void LIB_PIN::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList,
SCH_COMPONENT* aComponent )
{
getMsgPanelInfoBase( aList );
getMsgPanelInfoBase( aUnits, aList );
if( !aComponent )
return;
@ -1759,10 +1757,10 @@ void LIB_PIN::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList,
wxPoint pinpos = aComponent->GetTransform().TransformCoordinate( GetPosition() )
+ aComponent->GetPosition();
text = StringFromValue( g_UserUnit, pinpos.x, true );
text = MessageTextFromValue( aUnits, pinpos.x, true );
aList.push_back( MSG_PANEL_ITEM( _( "Pos X" ), text, DARKMAGENTA ) );
text = StringFromValue( g_UserUnit, pinpos.y, true );
text = MessageTextFromValue( aUnits, pinpos.y, true );
aList.push_back( MSG_PANEL_ITEM( _( "Pos Y" ), text, DARKMAGENTA ) );
aList.push_back( MSG_PANEL_ITEM( aComponent->GetField( REFERENCE )->GetShownText(),
@ -1957,23 +1955,18 @@ BITMAP_DEF LIB_PIN::GetMenuImage() const
}
wxString LIB_PIN::GetSelectMenuText() const
wxString LIB_PIN::GetSelectMenuText( EDA_UNITS_T aUnits ) const
{
wxString tmp;
wxString style;
style = GetText( m_shape );
tmp.Printf( _( "Pin %s, %s, %s" ),
GetChars( m_number ), GetChars( GetElectricalTypeName() ), GetChars( style ));
return tmp;
return wxString::Format( _( "Pin %s, %s, %s" ),
m_number,
GetElectricalTypeName(),
GetText( m_shape ));
}
bool LIB_PIN::Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation )
{
wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText() );
wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText( MILLIMETRES ) );
// Note: this will have to be modified if we add find and replace capability to the
// compoment library editor. Otherwise, you wont be able to replace pin text.
@ -1981,7 +1974,7 @@ bool LIB_PIN::Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint*
|| ( aSearchData.GetFlags() & FR_SEARCH_REPLACE ) )
return false;
wxLogTrace( traceFindItem, wxT( " child item " ) + GetSelectMenuText() );
wxLogTrace( traceFindItem, wxT( " child item " ) + GetSelectMenuText( MILLIMETRES ) );
if( EDA_ITEM::Matches( GetName(), aSearchData ) || EDA_ITEM::Matches( m_number, aSearchData ) )
{

View File

@ -128,7 +128,7 @@ public:
bool HitTest( const wxPoint &aPosRef, int aThreshold, const TRANSFORM& aTransform ) const override;
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) override;
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override;
/**
* Display pin info (given by GetMsgPanelInfo) and add some info related to aComponent
@ -136,7 +136,8 @@ public:
* @param aList is the message list to fill
* @param aComponent is the component which "owns" the pin
*/
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList, SCH_COMPONENT* aComponent );
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList,
SCH_COMPONENT* aComponent );
bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation ) override;
@ -484,7 +485,7 @@ public:
BITMAP_DEF GetMenuImage() const override;
wxString GetSelectMenuText() const override;
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
EDA_ITEM* Clone() const override;
@ -494,7 +495,7 @@ private:
* they are pin info without the actual pin position, which
* is not known in schematic without knowing the parent component
*/
void getMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList );
void getMsgPanelInfoBase( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList );
/**

View File

@ -312,14 +312,14 @@ void LIB_POLYLINE::DeleteSegment( const wxPoint aPosition )
}
void LIB_POLYLINE::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
void LIB_POLYLINE::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList )
{
wxString msg;
EDA_RECT bBox = GetBoundingBox();
LIB_ITEM::GetMsgPanelInfo( aList );
LIB_ITEM::GetMsgPanelInfo( aUnits, aList );
msg = StringFromValue( g_UserUnit, m_Width, true );
msg = MessageTextFromValue( aUnits, m_Width, true );
aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg, BLUE ) );
@ -330,11 +330,11 @@ void LIB_POLYLINE::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
}
wxString LIB_POLYLINE::GetSelectMenuText() const
wxString LIB_POLYLINE::GetSelectMenuText( EDA_UNITS_T aUnits ) const
{
return wxString::Format( _( "Polyline at (%s, %s) with %d points" ),
GetChars( CoordinateToString( m_PolyPoints[0].x ) ),
GetChars( CoordinateToString( m_PolyPoints[0].y ) ),
MessageTextFromValue( aUnits, m_PolyPoints[0].x ),
MessageTextFromValue( aUnits, m_PolyPoints[0].y ),
int( m_PolyPoints.size() ) );
}

View File

@ -84,7 +84,7 @@ public:
int GetPenSize( ) const override;
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) override;
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override;
void BeginEdit( STATUS_FLAGS aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) ) override;
@ -113,7 +113,7 @@ public:
void SetWidth( int aWidth ) override { m_Width = aWidth; }
wxString GetSelectMenuText() const override;
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
BITMAP_DEF GetMenuImage() const override;

View File

@ -209,13 +209,13 @@ void LIB_RECTANGLE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
}
void LIB_RECTANGLE::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
void LIB_RECTANGLE::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList )
{
wxString msg;
LIB_ITEM::GetMsgPanelInfo( aList );
LIB_ITEM::GetMsgPanelInfo( aUnits, aList );
msg = StringFromValue( g_UserUnit, m_Width, true );
msg = MessageTextFromValue( aUnits, m_Width, true );
aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg, BLUE ) );
}
@ -291,13 +291,13 @@ bool LIB_RECTANGLE::HitTest( const wxPoint &aPosition, int aThreshold, const TRA
}
wxString LIB_RECTANGLE::GetSelectMenuText() const
wxString LIB_RECTANGLE::GetSelectMenuText( EDA_UNITS_T aUnits ) const
{
return wxString::Format( _( "Rectangle from (%s, %s) to (%s, %s)" ),
GetChars( CoordinateToString( m_Pos.x ) ),
GetChars( CoordinateToString( m_Pos.y ) ),
GetChars( CoordinateToString( m_End.x ) ),
GetChars( CoordinateToString( m_End.y ) ) );
MessageTextFromValue( aUnits, m_Pos.x ),
MessageTextFromValue( aUnits, m_Pos.y ),
MessageTextFromValue( aUnits, m_End.x ),
MessageTextFromValue( aUnits, m_End.y ) );
}

View File

@ -74,7 +74,7 @@ public:
const EDA_RECT GetBoundingBox() const override;
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) override;
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override;
void BeginEdit( STATUS_FLAGS aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) ) override;
@ -107,7 +107,7 @@ public:
wxPoint GetEnd() const { return m_End; }
wxString GetSelectMenuText() const override;
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
BITMAP_DEF GetMenuImage() const override;

View File

@ -290,13 +290,13 @@ void LIB_TEXT::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aO
}
void LIB_TEXT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
void LIB_TEXT::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList )
{
wxString msg;
LIB_ITEM::GetMsgPanelInfo( aList );
LIB_ITEM::GetMsgPanelInfo( aUnits, aList );
msg = StringFromValue( g_UserUnit, GetThickness(), true );
msg = MessageTextFromValue( aUnits, GetThickness(), true );
aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg, BLUE ) );
}
@ -357,11 +357,9 @@ void LIB_TEXT::SetText( const wxString& aText )
}
wxString LIB_TEXT::GetSelectMenuText() const
wxString LIB_TEXT::GetSelectMenuText( EDA_UNITS_T aUnits ) const
{
wxString msg;
msg.Printf( _( "Graphic Text \"%s\"" ), GetChars( ShortenedShownText() ) );
return msg;
return wxString::Format( _( "Graphic Text \"%s\"" ), ShortenedShownText() );
}

View File

@ -94,7 +94,7 @@ public:
int GetPenSize( ) const override;
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) override;
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override;
const EDA_RECT GetBoundingBox() const override;
@ -127,7 +127,7 @@ public:
void SetWidth( int aWidth ) override { SetThickness( aWidth ); }
wxString GetSelectMenuText() const override;
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
BITMAP_DEF GetMenuImage() const override;

View File

@ -56,7 +56,7 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
if( item )
{
MSG_PANEL_ITEMS items;
item->GetMsgPanelInfo( items );
item->GetMsgPanelInfo( m_UserUnits, items );
SetMsgPanel( items );
}

View File

@ -95,7 +95,7 @@ bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
if( item )
{
MSG_PANEL_ITEMS items;
item->GetMsgPanelInfo( items );
item->GetMsgPanelInfo( m_UserUnits, items );
SetMsgPanel( items );
}
else

View File

@ -193,7 +193,7 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event )
OnModify( );
MSG_PANEL_ITEMS items;
pin->GetMsgPanelInfo( items );
pin->GetMsgPanelInfo( m_UserUnits, items );
SetMsgPanel( items );
m_canvas->Refresh();
}
@ -365,7 +365,7 @@ void LIB_EDIT_FRAME::StartMovePin( LIB_ITEM* aItem )
MSG_PANEL_ITEMS items;
cur_pin->GetMsgPanelInfo( items );
cur_pin->GetMsgPanelInfo( m_UserUnits, items );
SetMsgPanel( items );
m_canvas->SetMouseCapture( DrawMovePin, AbortPinMove );
@ -654,7 +654,7 @@ void LIB_EDIT_FRAME::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin )
m_canvas->CrossHairOn( DC );
MSG_PANEL_ITEMS items;
pin->GetMsgPanelInfo( items );
pin->GetMsgPanelInfo( m_UserUnits, items );
SetMsgPanel( items );
OnModify( );
}

View File

@ -126,7 +126,10 @@ public:
bool IsSelectStateChanged( const wxRect& aRect ) override;
wxString GetSelectMenuText() const override { return wxString( _( "Image" ) ); }
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override
{
return wxString( _( "Image" ) );
}
BITMAP_DEF GetMenuImage() const override;

View File

@ -332,13 +332,13 @@ void SCH_BUS_ENTRY_BASE::GetConnectionPoints( std::vector< wxPoint >& aPoints )
}
wxString SCH_BUS_WIRE_ENTRY::GetSelectMenuText() const
wxString SCH_BUS_WIRE_ENTRY::GetSelectMenuText( EDA_UNITS_T aUnits ) const
{
return wxString( _( "Bus to Wire Entry" ) );
}
wxString SCH_BUS_BUS_ENTRY::GetSelectMenuText() const
wxString SCH_BUS_BUS_ENTRY::GetSelectMenuText( EDA_UNITS_T aUnits ) const
{
return wxString( _( "Bus to Bus Entry" ) );
}

View File

@ -148,7 +148,7 @@ public:
( aItem->GetLayer() == LAYER_WIRE || aItem->GetLayer() == LAYER_BUS );
}
wxString GetSelectMenuText() const override;
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
EDA_ITEM* Clone() const override;
@ -181,7 +181,7 @@ public:
return aItem->Type() == SCH_LINE_T && aItem->GetLayer() == LAYER_BUS;
}
wxString GetSelectMenuText() const override;
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
EDA_ITEM* Clone() const override;

View File

@ -345,8 +345,14 @@ public:
SCH_ITEM( nullptr, NOT_USED )
{}
wxString GetSelectMenuText() const override { return _( "(Deleted Item)" ); }
wxString GetClass() const override { return wxT( "DELETED_SCH_ITEM" ); }
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override
{
return _( "(Deleted Item)" );
}
wxString GetClass() const override
{
return wxT( "DELETED_SCH_ITEM" );
}
// define pure virtuals:
wxPoint GetPosition() const override { return wxPoint(); }
@ -444,7 +450,7 @@ void SCH_FIND_COLLECTOR::dump()
GetChars( m_findReplaceData.GetReplaceString() ) );
for( m_foundIndex = 0; m_foundIndex < GetCount(); m_foundIndex++ )
wxLogTrace( traceFindReplace, wxT( " " ) + GetText() );
wxLogTrace( traceFindReplace, wxT( " " ) + GetText( MILLIMETRES ) );
m_foundIndex = tmp;
}
@ -482,7 +488,7 @@ SCH_FIND_COLLECTOR_DATA SCH_FIND_COLLECTOR::GetFindData( int aIndex )
}
wxString SCH_FIND_COLLECTOR::GetText()
wxString SCH_FIND_COLLECTOR::GetText( EDA_UNITS_T aUnits )
{
wxCHECK_MSG( (GetCount() != 0) && IsValidIndex( m_foundIndex ), wxEmptyString,
wxT( "Cannot get found item at invalid index." ) );
@ -490,23 +496,19 @@ wxString SCH_FIND_COLLECTOR::GetText()
SCH_FIND_COLLECTOR_DATA data = m_data[ m_foundIndex ];
EDA_ITEM* foundItem = GetItem( m_foundIndex );
wxString msg;
if( data.GetParent() )
{
msg.Printf( _( "Child item %s of parent item %s found in sheet %s" ),
GetChars( foundItem->GetSelectMenuText() ),
GetChars( data.GetParent()->GetSelectMenuText() ),
GetChars( data.GetSheetPath() ) );
return wxString::Format( _( "Child item %s of parent item %s found in sheet %s" ),
foundItem->GetSelectMenuText( aUnits ),
data.GetParent()->GetSelectMenuText( aUnits ),
data.GetSheetPath() );
}
else
{
msg.Printf( _( "Item %s found in sheet %s" ),
GetChars( foundItem->GetSelectMenuText() ),
GetChars( data.GetSheetPath() ) );
return wxString::Format( _( "Item %s found in sheet %s" ),
foundItem->GetSelectMenuText( aUnits ),
data.GetSheetPath() );
}
return msg;
}

View File

@ -344,7 +344,7 @@ public:
* current index or a wxEmptyString if the list is empty or the index is
* invalid.
*/
wxString GetText();
wxString GetText( EDA_UNITS_T aUnits );
/**
* Function GetItem

View File

@ -1373,7 +1373,7 @@ const EDA_RECT SCH_COMPONENT::GetBoundingBox() const
}
void SCH_COMPONENT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
void SCH_COMPONENT::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList )
{
wxString msg;
@ -1520,7 +1520,7 @@ void SCH_COMPONENT::Rotate( wxPoint aPosition )
bool SCH_COMPONENT::Matches( wxFindReplaceData& aSearchData, void* aAuxData,
wxPoint* aFindLocation )
{
wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText() );
wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText( MILLIMETRES ) );
// Components are searchable via the child field and pin item text.
return false;
@ -1682,13 +1682,11 @@ LIB_ITEM* SCH_COMPONENT::GetDrawItem( const wxPoint& aPosition, KICAD_T aType )
}
wxString SCH_COMPONENT::GetSelectMenuText() const
wxString SCH_COMPONENT::GetSelectMenuText( EDA_UNITS_T aUnits ) const
{
wxString tmp;
tmp.Printf( _( "Symbol %s, %s" ),
GetChars( GetLibId().GetLibItemName() ),
GetChars( GetField( REFERENCE )->GetShownText() ) );
return tmp;
return wxString::Format( _( "Symbol %s, %s" ),
GetLibId().GetLibItemName().wx_str(),
GetField( REFERENCE )->GetShownText() );
}

View File

@ -285,7 +285,7 @@ public:
*/
wxPoint GetScreenCoord( const wxPoint& aPoint );
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) override;
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override;
/**
* Clear exiting component annotation.
@ -594,7 +594,7 @@ public:
*/
LIB_ITEM* GetDrawItem( const wxPoint& aPosition, KICAD_T aType = TYPE_NOT_INIT );
wxString GetSelectMenuText() const override;
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
BITMAP_DEF GetMenuImage() const override;

View File

@ -338,7 +338,7 @@ bool SCH_FIELD::Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint
|| ((m_id == REFERENCE) && !(aSearchData.GetFlags() & FR_REPLACE_REFERENCES)) )
return false;
wxLogTrace( traceFindItem, wxT( " child item " ) + GetSelectMenuText() );
wxLogTrace( traceFindItem, wxT( " child item " ) + GetSelectMenuText( MILLIMETRES ) );
// Take sheet path into account which effects the reference field and the unit for
// components with multiple parts.
@ -426,12 +426,9 @@ void SCH_FIELD::Rotate( wxPoint aPosition )
}
wxString SCH_FIELD::GetSelectMenuText() const
wxString SCH_FIELD::GetSelectMenuText( EDA_UNITS_T aUnits ) const
{
wxString tmp;
tmp.Printf( _( "Field %s" ), GetChars( GetName() ) );
return tmp;
return wxString::Format( _( "Field %s" ), GetName() );
}

View File

@ -178,7 +178,7 @@ public:
bool Replace( wxFindReplaceData& aSearchData, void* aAuxData = NULL ) override;
wxString GetSelectMenuText() const override;
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
BITMAP_DEF GetMenuImage() const override;

View File

@ -85,7 +85,10 @@ public:
( aItem->GetLayer() == LAYER_WIRE || aItem->GetLayer() == LAYER_BUS );
}
wxString GetSelectMenuText() const override { return wxString( _( "Junction" ) ); }
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override
{
return wxString( _( "Junction" ) );
}
BITMAP_DEF GetMenuImage() const override;

View File

@ -607,40 +607,39 @@ void SCH_LINE::GetConnectionPoints( std::vector< wxPoint >& aPoints ) const
}
wxString SCH_LINE::GetSelectMenuText() const
wxString SCH_LINE::GetSelectMenuText( EDA_UNITS_T aUnits ) const
{
wxString menuText, txtfmt, orient;
wxString txtfmt, orient;
if( m_start.x == m_end.x )
orient = _( "Vert." );
orient = _( "Vertical " );
else if( m_start.y == m_end.y )
orient = _( "Horiz." );
orient = _( "Horizontal " );
switch( m_Layer )
{
case LAYER_NOTES:
txtfmt = _( "%s Graphic Line from (%s, %s) to (%s, %s)" );
txtfmt = _( "%sGraphic Line from (%s, %s) to (%s, %s)" );
break;
case LAYER_WIRE:
txtfmt = _( "%s Wire from (%s, %s) to (%s, %s)" );
txtfmt = _( "%sWire from (%s, %s) to (%s, %s)" );
break;
case LAYER_BUS:
txtfmt = _( "%s Bus from (%s, %s) to (%s, %s)" );
txtfmt = _( "%sBus from (%s, %s) to (%s, %s)" );
break;
default:
txtfmt += _( "%s Line on Unknown Layer from (%s, %s) to (%s, %s)" );
txtfmt = _( "%sLine on Unknown Layer from (%s, %s) to (%s, %s)" );
}
menuText.Printf( txtfmt, GetChars( orient ),
GetChars( CoordinateToString( m_start.x ) ),
GetChars( CoordinateToString( m_start.y ) ),
GetChars( CoordinateToString( m_end.x ) ),
GetChars( CoordinateToString( m_end.y ) ) );
return menuText;
return wxString::Format( txtfmt,
orient,
MessageTextFromValue( aUnits, m_start.x ),
MessageTextFromValue( aUnits, m_start.y ),
MessageTextFromValue( aUnits, m_end.x ),
MessageTextFromValue( aUnits, m_end.y ) );
}
@ -811,7 +810,7 @@ int SCH_EDIT_FRAME::EditLine( SCH_LINE* aLine, bool aRedraw )
if( dlg.ShowModal() == wxID_CANCEL )
return wxID_CANCEL;
int new_width = std::max( 1, ValueFromString( dlg.GetWidth() ) );
int new_width = std::max( 1, ValueFromString( m_UserUnits, dlg.GetWidth() ) );
int new_style = dlg.GetStyle();
COLOR4D new_color = dlg.GetColor();

View File

@ -168,7 +168,7 @@ public:
bool CanConnect( const SCH_ITEM* aItem ) const override;
wxString GetSelectMenuText() const override;
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
BITMAP_DEF GetMenuImage() const override;

View File

@ -112,10 +112,8 @@ const EDA_RECT SCH_MARKER::GetBoundingBox() const
}
void SCH_MARKER::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
void SCH_MARKER::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList )
{
wxString msg;
aList.push_back( MSG_PANEL_ITEM( _( "Electronics Rule Check Error" ),
GetReporter().GetErrorText(), DARKRED ) );
}

View File

@ -90,11 +90,14 @@ public:
*/
bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation ) override;
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) override;
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override;
bool IsSelectStateChanged( const wxRect& aRect ) override;
wxString GetSelectMenuText() const override { return wxString( _( "ERC Marker" ) ); }
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override
{
return wxString( _( "ERC Marker" ) );
}
BITMAP_DEF GetMenuImage() const override;

View File

@ -87,7 +87,10 @@ public:
void GetConnectionPoints( std::vector< wxPoint >& aPoints ) const override;
wxString GetSelectMenuText() const override { return wxString( _( "No Connect" ) ); }
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override
{
return wxString( _( "No Connect" ) );
}
BITMAP_DEF GetMenuImage() const override;

View File

@ -649,7 +649,7 @@ wxString SCH_SHEET::GetFileName( void ) const
}
void SCH_SHEET::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
void SCH_SHEET::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList )
{
aList.push_back( MSG_PANEL_ITEM( _( "Sheet Name" ), m_name, CYAN ) );
aList.push_back( MSG_PANEL_ITEM( _( "File Name" ), m_fileName, BROWN ) );
@ -735,7 +735,7 @@ void SCH_SHEET::Resize( const wxSize& aSize )
bool SCH_SHEET::Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation )
{
wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText() );
wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText( MILLIMETRES ) );
// Ignore the sheet file name if searching to replace.
if( !(aSearchData.GetFlags() & FR_SEARCH_REPLACE)
@ -866,11 +866,9 @@ SEARCH_RESULT SCH_SHEET::Visit( INSPECTOR aInspector, void* testData, const KICA
}
wxString SCH_SHEET::GetSelectMenuText() const
wxString SCH_SHEET::GetSelectMenuText( EDA_UNITS_T aUnits ) const
{
wxString tmp;
tmp.Printf( _( "Hierarchical Sheet %s" ), GetChars( m_name ) );
return tmp;
return wxString::Format( _( "Hierarchical Sheet %s" ), m_name );
}

View File

@ -188,7 +188,7 @@ public:
bool IsConnectable() const override { return true; }
wxString GetSelectMenuText() const override;
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
BITMAP_DEF GetMenuImage() const override;
@ -313,7 +313,7 @@ public:
*/
int GetScreenCount() const;
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) override;
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override;
/* there is no member for orientation in sch_sheet, to preserve file
* format, we detect orientation based on pin edges
@ -535,7 +535,7 @@ public:
SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override;
wxString GetSelectMenuText() const override;
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
BITMAP_DEF GetMenuImage() const override;

View File

@ -218,7 +218,7 @@ bool SCH_SHEET_PIN::Matches( wxFindReplaceData& aSearchData,
wxCHECK_MSG( GetParent() != NULL, false,
wxT( "Sheet pin " ) + m_Text + wxT( " does not have a parent sheet!" ) );
wxLogTrace( traceFindItem, wxT( " child item " ) + GetSelectMenuText() );
wxLogTrace( traceFindItem, wxT( " child item " ) + GetSelectMenuText( MILLIMETRES ) );
if( SCH_ITEM::Matches( m_Text, aSearchData ) )
{
@ -341,11 +341,9 @@ void SCH_SHEET_PIN::GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList )
}
wxString SCH_SHEET_PIN::GetSelectMenuText() const
wxString SCH_SHEET_PIN::GetSelectMenuText( EDA_UNITS_T aUnits ) const
{
wxString tmp;
tmp.Printf( _( "Hierarchical Sheet Pin %s" ), GetChars( ShortenedShownText() ) );
return tmp;
return wxString::Format( _( "Hierarchical Sheet Pin %s" ), ShortenedShownText() );
}
BITMAP_DEF SCH_SHEET_PIN::GetMenuImage() const

View File

@ -176,7 +176,7 @@ wxPoint SCH_TEXT::GetSchematicTextOffset() const
bool SCH_TEXT::Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint * aFindLocation )
{
wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText() );
wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText( MILLIMETRES ) );
if( SCH_ITEM::Matches( m_Text, aSearchData ) )
{
@ -494,11 +494,9 @@ const EDA_RECT SCH_TEXT::GetBoundingBox() const
}
wxString SCH_TEXT::GetSelectMenuText() const
wxString SCH_TEXT::GetSelectMenuText( EDA_UNITS_T aUnits ) const
{
wxString msg;
msg.Printf( _( "Graphic Text \"%s\"" ), GetChars( ShortenedShownText() ) );
return msg;
return wxString::Format( _( "Graphic Text \"%s\"" ), GetChars( ShortenedShownText() ) );
}
@ -604,7 +602,7 @@ void SCH_TEXT::Plot( PLOTTER* aPlotter )
/*
* Display the type, shape, size and some other props to the Message panel
*/
void SCH_TEXT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
void SCH_TEXT::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList )
{
wxString msg;
@ -692,7 +690,7 @@ void SCH_TEXT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
}
// Display text size (X or Y value, with are the same value in Eeschema)
msg = StringFromValue( g_UserUnit, GetTextWidth(), true );
msg = MessageTextFromValue( aUnits, GetTextWidth(), true );
aList.push_back( MSG_PANEL_ITEM( _( "Size" ), msg, RED ) );
}
@ -807,11 +805,9 @@ const EDA_RECT SCH_LABEL::GetBoundingBox() const
}
wxString SCH_LABEL::GetSelectMenuText() const
wxString SCH_LABEL::GetSelectMenuText( EDA_UNITS_T aUnits ) const
{
wxString msg;
msg.Printf( _( "Label %s" ), GetChars( ShortenedShownText() ) );
return msg;
return wxString::Format( _( "Label %s" ), ShortenedShownText() );
}
@ -1176,11 +1172,9 @@ const EDA_RECT SCH_GLOBALLABEL::GetBoundingBox() const
}
wxString SCH_GLOBALLABEL::GetSelectMenuText() const
wxString SCH_GLOBALLABEL::GetSelectMenuText( EDA_UNITS_T aUnits ) const
{
wxString msg;
msg.Printf( _( "Global Label %s" ), GetChars( ShortenedShownText() ) );
return msg;
return wxString::Format( _( "Global Label %s" ), GetChars( ShortenedShownText() ) );
}
@ -1439,11 +1433,9 @@ void SCH_HIERLABEL::Rotate( wxPoint aPosition )
}
wxString SCH_HIERLABEL::GetSelectMenuText() const
wxString SCH_HIERLABEL::GetSelectMenuText( EDA_UNITS_T aUnits ) const
{
wxString msg;
msg.Printf( _( "Hierarchical Label %s" ), GetChars( ShortenedShownText() ) );
return msg;
return wxString::Format( _( "Hierarchical Label %s" ), GetChars( ShortenedShownText() ) );
}

View File

@ -182,7 +182,7 @@ public:
virtual bool CanIncrementLabel() const override { return true; }
virtual wxString GetSelectMenuText() const override;
virtual wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
virtual BITMAP_DEF GetMenuImage() const override;
@ -202,7 +202,7 @@ public:
virtual EDA_ITEM* Clone() const override;
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) override;
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override;
#if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const override;
@ -245,7 +245,7 @@ public:
( aItem->GetLayer() == LAYER_WIRE || aItem->GetLayer() == LAYER_BUS );
}
wxString GetSelectMenuText() const override;
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
BITMAP_DEF GetMenuImage() const override;
@ -297,7 +297,7 @@ public:
( aItem->GetLayer() == LAYER_WIRE || aItem->GetLayer() == LAYER_BUS );
}
wxString GetSelectMenuText() const override;
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
BITMAP_DEF GetMenuImage() const override;
@ -349,7 +349,7 @@ public:
( aItem->GetLayer() == LAYER_WIRE || aItem->GetLayer() == LAYER_BUS );
}
wxString GetSelectMenuText() const override;
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
BITMAP_DEF GetMenuImage() const override;

View File

@ -121,7 +121,7 @@ void LIB_EDIT_FRAME::EditGraphicSymbol( wxDC* DC, LIB_ITEM* DrawItem )
OnModify( );
MSG_PANEL_ITEMS items;
DrawItem->GetMsgPanelInfo( items );
DrawItem->GetMsgPanelInfo( m_UserUnits, items );
SetMsgPanel( items );
m_canvas->Refresh();
}

View File

@ -683,7 +683,7 @@ void GERBER_DRAW_ITEM::DrawGbrPoly( EDA_RECT* aClipBox,
}
void GERBER_DRAW_ITEM::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
void GERBER_DRAW_ITEM::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList )
{
wxString msg;
wxString text;
@ -982,17 +982,15 @@ SEARCH_RESULT GERBER_DRAW_ITEM::Visit( INSPECTOR inspector, void* testData, cons
}
wxString GERBER_DRAW_ITEM::GetSelectMenuText() const
wxString GERBER_DRAW_ITEM::GetSelectMenuText( EDA_UNITS_T aUnits ) const
{
wxString text, layerName;
wxString layerName;
layerName = GERBER_FILE_IMAGE_LIST::GetImagesList().GetDisplayName( GetLayer(), true );
text.Printf( _( "%s (D%d) on layer %d: %s" ),
ShowGBRShape(),
m_DCode,
GetLayer() + 1,
layerName );
return text;
return wxString::Format( _( "%s (D%d) on layer %d: %s" ),
ShowGBRShape(),
m_DCode,
GetLayer() + 1,
layerName );
}

View File

@ -253,7 +253,7 @@ public:
/* divers */
int Shape() const { return m_Shape; }
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) override;
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override;
wxString ShowGBRShape() const;
@ -323,7 +323,7 @@ public:
SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override;
///> @copydoc EDA_ITEM::GetSelectMenuText()
virtual wxString GetSelectMenuText() const override;
virtual wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
///> @copydoc EDA_ITEM::GetMenuImage()
BITMAP_DEF GetMenuImage() const override;

View File

@ -89,7 +89,8 @@ void GERBVIEW_DRAW_PANEL_GAL::SetHighContrastLayer( int aLayer )
}
void GERBVIEW_DRAW_PANEL_GAL::GetMsgPanelInfo( std::vector<MSG_PANEL_ITEM>& aList )
void GERBVIEW_DRAW_PANEL_GAL::GetMsgPanelInfo( EDA_UNITS_T aUnits,
std::vector<MSG_PANEL_ITEM>& aList )
{
}

View File

@ -51,7 +51,7 @@ public:
virtual void SetHighContrastLayer( int aLayer ) override;
///> @copydoc EDA_DRAW_PANEL_GAL::GetMsgPanelInfo()
void GetMsgPanelInfo( std::vector<MSG_PANEL_ITEM>& aList ) override;
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
///> @copydoc EDA_DRAW_PANEL_GAL::OnShow()
void OnShow() override;

View File

@ -1062,7 +1062,7 @@ void GERBVIEW_FRAME::SetCurItem( GERBER_DRAW_ITEM* aItem, bool aDisplayInfo )
if( aDisplayInfo )
{
MSG_PANEL_ITEMS items;
aItem->GetMsgPanelInfo( items );
aItem->GetMsgPanelInfo( m_UserUnits, items );
SetMsgPanel( items );
}
}

View File

@ -99,7 +99,7 @@ GERBER_DRAW_ITEM* GERBVIEW_FRAME::Locate( const wxPoint& aPosition, int aTypeloc
if( gerb_item )
{
MSG_PANEL_ITEMS items;
gerb_item->GetMsgPanelInfo( items );
gerb_item->GetMsgPanelInfo( m_UserUnits, items );
SetMsgPanel( items );
}

View File

@ -632,7 +632,7 @@ EDA_ITEM* GERBVIEW_SELECTION_TOOL::disambiguationMenu( GERBER_COLLECTOR* aCollec
{
wxString text;
EDA_ITEM* item = ( *aCollector )[i];
text = item->GetSelectMenuText();
text = item->GetSelectMenuText( m_frame->GetUserUnits() );
menu.Add( text, i + 1, item->GetMenuImage() );
}

View File

@ -33,12 +33,14 @@
#define BASE_STRUCT_H_
#include <core/typeinfo.h>
#include "common.h"
#include <bitmap_types.h>
#include <view/view_item.h>
#if defined(DEBUG)
#include <iostream> // needed for Show()
extern std::ostream& operator <<( std::ostream& out, const wxSize& size );
extern std::ostream& operator <<( std::ostream& out, const wxPoint& pt );
@ -141,19 +143,6 @@ typedef const INSPECTOR_FUNC& INSPECTOR; /// std::function passed to nested u
typedef unsigned STATUS_FLAGS;
/**
* timestamp_t is our type to represent unique IDs for all kinds of elements;
* historically simply the timestamp when they were created.
*
* Long term, this type might be renamed to something like unique_id_t
* (and then rename all the methods from {Get,Set}TimeStamp()
* to {Get,Set}Id()) ?
*
* The type should be at least 32 bit and simple to map via swig; swig does
* have issues with types such as 'int32_t', so we choose 'long'.
*/
typedef long timestamp_t;
/**
* Class EDA_ITEM
* is a base class for most all the KiCad significant classes, used in
@ -285,7 +274,7 @@ public:
*
* @param aList is the list to populate.
*/
virtual void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
virtual void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList )
{
}
@ -382,7 +371,7 @@ public:
*
* @return The menu text string.
*/
virtual wxString GetSelectMenuText() const;
virtual wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const;
/**
* Function GetMenuImage

View File

@ -81,22 +81,6 @@ void StripTrailingZeros( wxString& aStringValue, unsigned aTrailingZeroAllowed =
*/
double To_User_Unit( EDA_UNITS_T aUnit, double aValue, bool aUseMils = false );
/**
* Function CoordinateToString
* is a helper to convert the \a integer coordinate \a aValue to a string in inches,
* millimeters, or unscaled units according to the current user units setting.
*
* Should be used only to display a coordinate in status, but not in dialogs,
* because the mantissa of the number displayed has 4 digits max for readability.
* (i.e. the value shows the decimils or the microns )
* However the actual internal value could need up to 8 digits to be printed
*
* @param aValue The integer coordinate to convert.
* @param aUseMils Convert inch values to mils if true.
* @return The converted string for display in user interface elements.
*/
wxString CoordinateToString( int aValue, bool aUseMils = false );
/**
* Function AngleToStringDegrees
* is a helper to convert the \a double \a aAngle (in internal unit)
@ -149,16 +133,6 @@ wxString MessageTextFromValue( EDA_UNITS_T aUnits, int aValue, bool aUseMils = f
wxString StringFromValue( EDA_UNITS_T aUnit, int aValue, bool aAddUnitSymbol = false,
bool aUseMils = false );
/**
* Operator << overload
* outputs a point to the argument string in a format resembling
* "@ (x,y)
* @param aString Where to put the text describing the point value
* @param aPoint The point to output.
* @return wxString& - the input string
*/
wxString& operator <<( wxString& aString, const wxPoint& aPoint );
/**
* Function PutValueInLocalUnits
* converts \a aValue from internal units to user units and append the units notation
@ -197,18 +171,6 @@ double DoubleValueFromString( EDA_UNITS_T aUnits, const wxString& aTextValue,
*/
int ValueFromString( EDA_UNITS_T aUnits, const wxString& aTextValue, bool aUseMils = false );
/**
* Function ValueFromString
* converts \a aTextValue in \a aUnits to internal units used by the application,
* unit type will be obtained from g_UserUnit.
*
* @param aTextValue A reference to a wxString object containing the string to convert.
* @return The string from Value, according to units (inch, mm ...) for display,
*/
int ValueFromString( const wxString& aTextValue );
/**
* Convert the number Value in a string according to the internal units
* and the selected unit (g_UserUnit) and put it in the wxTextCtrl TextCtrl

View File

@ -37,6 +37,7 @@
#include <math/vector2d.h>
#include <msgpanel.h>
#include <memory>
#include <common.h>
class BOARD;
class EDA_DRAW_FRAME;
@ -159,7 +160,7 @@ public:
*/
virtual void SetTopLayer( int aLayer );
virtual void GetMsgPanelInfo( std::vector<MSG_PANEL_ITEM>& aList )
virtual void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector<MSG_PANEL_ITEM>& aList )
{
assert( false );
}

View File

@ -38,7 +38,6 @@
#include <wx/confbase.h>
#include <wx/fileconf.h>
#include <base_struct.h> // For timestamp_t definition
#include <richio.h>
#include <gal/color4d.h>
@ -52,6 +51,20 @@ class SEARCH_STACK;
class REPORTER;
/**
* timestamp_t is our type to represent unique IDs for all kinds of elements;
* historically simply the timestamp when they were created.
*
* Long term, this type might be renamed to something like unique_id_t
* (and then rename all the methods from {Get,Set}TimeStamp()
* to {Get,Set}Id()) ?
*
* The type should be at least 32 bit and simple to map via swig; swig does
* have issues with types such as 'int32_t', so we choose 'long'.
*/
typedef long timestamp_t;
// Flag for special keys
// This type could be extended to 64 bits to add room for more flags.
// For compatibility with old code, keep flag bits out of the least

View File

@ -26,6 +26,7 @@
#define DRC_ITEM_H
#include <macros.h>
#include <base_struct.h>
class MARKER_BASE;
class BOARD;
@ -91,14 +92,17 @@ public:
EDA_ITEM* bAuxiliaryItem = nullptr, const wxPoint& bAuxiliaryPos = wxPoint() )
{
m_ErrorCode = aErrorCode;
m_MainText = aMainItem->GetSelectMenuText();
m_AuxiliaryText = bAuxiliaryItem ? bAuxiliaryItem->GetSelectMenuText() : wxString( wxEmptyString );
m_MainText = aMainItem->GetSelectMenuText( g_UserUnit );
m_AuxiliaryText = wxEmptyString;
m_MainPosition = aMainPos;
m_AuxiliaryPosition = bAuxiliaryPos;
m_hasSecondItem = bAuxiliaryItem != nullptr;
m_noCoordinate = false;
m_parent = nullptr;
if( m_hasSecondItem )
m_AuxiliaryText = bAuxiliaryItem->GetSelectMenuText( g_UserUnit );
// Weak references (void*). One must search the BOARD_ITEMS or SCH_ITEMS for a match.
m_mainItemWeakRef = aMainItem;
m_auxItemWeakRef = bAuxiliaryItem;
@ -125,8 +129,8 @@ public:
m_noCoordinate = false;
m_parent = nullptr;
m_mainItemWeakRef = nullptr;
m_auxItemWeakRef = nullptr;
m_mainItemWeakRef = nullptr;
m_auxItemWeakRef = nullptr;
}
/**
@ -225,7 +229,7 @@ public:
* @param aPos The position to format
* @return wxString - The formated string
*/
static wxString ShowCoord( const wxPoint& aPos );
static wxString ShowCoord( EDA_UNITS_T aUnits, const wxPoint& aPos );
};

View File

@ -27,6 +27,7 @@
#include <common.h>
#include <base_units.h>
#include <base_struct.h>
#include <libeval/numeric_evaluator.h>

View File

@ -59,7 +59,7 @@ void PCB_EDIT_FRAME::Attribut_Segment( TRACK* track, wxDC* DC, bool Flag_On )
m_canvas->CrossHairOn( DC ); // Display cursor shape
MSG_PANEL_ITEMS items;
track->GetMsgPanelInfo( items );
track->GetMsgPanelInfo( m_UserUnits, items );
SetMsgPanel( items );
}

View File

@ -72,8 +72,15 @@ public:
BOARD_ITEM( nullptr, NOT_USED )
{}
wxString GetSelectMenuText() const override { return _( "(Deleted Item)" ); }
wxString GetClass() const override { return wxT( "DELETED_BOARD_ITEM" ); }
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override
{
return _( "(Deleted Item)" );
}
wxString GetClass() const override
{
return wxT( "DELETED_BOARD_ITEM" );
}
// pure virtuals:
const wxPoint GetPosition() const override { return wxPoint(); }
@ -1181,7 +1188,7 @@ EDA_RECT BOARD::ComputeBoundingBox( bool aBoardEdgesOnly ) const
}
void BOARD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
void BOARD::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList )
{
wxString txt;
int viasCount = 0;

View File

@ -805,7 +805,7 @@ public:
return ComputeBoundingBox( true );
}
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) override;
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override;
/**
* Function Draw.

View File

@ -215,7 +215,6 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText )
int arrow_dw_X = 0, arrow_dw_Y = 0; // coordinates of arrow line '\'
int hx, hy; // dimension line interval
double angle, angle_f;
wxString msg;
// Init layer :
m_Text.SetLayer( GetLayer() );
@ -317,8 +316,7 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText )
if( !aDoNotChangeText )
{
m_Value = measure;
msg = ::CoordinateToString( m_Value );
SetText( msg );
SetText( MessageTextFromValue( g_UserUnit, m_Value ) );
}
}
@ -379,10 +377,10 @@ void DIMENSION::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE mode_color,
// see class_cotation.h
void DIMENSION::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
void DIMENSION::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList )
{
// for now, display only the text within the DIMENSION using class TEXTE_PCB.
m_Text.GetMsgPanelInfo( aList );
m_Text.GetMsgPanelInfo( aUnits, aList );
}
@ -485,14 +483,9 @@ const EDA_RECT DIMENSION::GetBoundingBox() const
}
wxString DIMENSION::GetSelectMenuText() const
wxString DIMENSION::GetSelectMenuText( EDA_UNITS_T aUnits ) const
{
wxString text;
text.Printf( _( "Dimension \"%s\" on %s" ),
GetChars( GetText() ),
GetChars( GetLayerName() ) );
return text;
return wxString::Format( _( "Dimension \"%s\" on %s" ), GetText(), GetLayerName() );
}

View File

@ -205,7 +205,7 @@ public:
*/
void Mirror( const wxPoint& axis_pos );
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) override;
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override;
bool HitTest( const wxPoint& aPosition ) const override;
@ -219,7 +219,7 @@ public:
// Virtual function
const EDA_RECT GetBoundingBox() const override;
wxString GetSelectMenuText() const override;
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
BITMAP_DEF GetMenuImage() const override;

View File

@ -396,7 +396,7 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
}
}
void DRAWSEGMENT::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
void DRAWSEGMENT::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList )
{
wxString msg;
@ -411,7 +411,7 @@ void DRAWSEGMENT::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
case S_CIRCLE:
aList.push_back( MSG_PANEL_ITEM( shape, _( "Circle" ), RED ) );
msg = ::CoordinateToString( GetLineLength( m_Start, m_End ) );
msg = MessageTextFromValue( aUnits, GetLineLength( m_Start, m_End ) );
aList.push_back( MSG_PANEL_ITEM( _( "Radius" ), msg, RED ) );
break;
@ -420,7 +420,7 @@ void DRAWSEGMENT::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
msg.Printf( wxT( "%.1f" ), m_Angle / 10.0 );
aList.push_back( MSG_PANEL_ITEM( _( "Angle" ), msg, RED ) );
msg = ::CoordinateToString( GetLineLength( m_Start, m_End ) );
msg = MessageTextFromValue( aUnits, GetLineLength( m_Start, m_End ) );
aList.push_back( MSG_PANEL_ITEM( _( "Radius" ), msg, RED ) );
break;
@ -432,7 +432,7 @@ void DRAWSEGMENT::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
{
aList.push_back( MSG_PANEL_ITEM( shape, _( "Segment" ), RED ) );
msg = ::CoordinateToString( GetLineLength( m_Start, m_End ) );
msg = MessageTextFromValue( aUnits, GetLineLength( m_Start, m_End ) );
aList.push_back( MSG_PANEL_ITEM( _( "Length" ), msg, DARKGREEN ) );
// angle counter-clockwise from 3'o-clock
@ -443,15 +443,17 @@ void DRAWSEGMENT::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
}
}
wxString start;
start << GetStart();
wxString end;
end << GetEnd();
wxString start = wxString::Format( _( "@(%s, %s)" ),
MessageTextFromValue( aUnits, GetStart().x ),
MessageTextFromValue( aUnits, GetStart().y ) );
wxString end = wxString::Format( _( "@(%s, %s)" ),
MessageTextFromValue( aUnits, GetEnd().x ),
MessageTextFromValue( aUnits, GetEnd().y ) );
aList.push_back( MSG_PANEL_ITEM( start, end, DARKGREEN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), GetLayerName(), DARKBROWN ) );
msg = ::CoordinateToString( m_Width );
msg = MessageTextFromValue( aUnits, m_Width, true );
aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, DARKCYAN ) );
}
@ -721,16 +723,12 @@ bool DRAWSEGMENT::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy
}
wxString DRAWSEGMENT::GetSelectMenuText() const
wxString DRAWSEGMENT::GetSelectMenuText( EDA_UNITS_T aUnits ) const
{
wxString text;
text.Printf( _( "Pcb Graphic %s, length %s on %s" ),
GetChars( ShowShape( m_Shape ) ),
GetChars( ::MessageTextFromValue( g_UserUnit, GetLength() ) ),
GetChars( GetLayerName() ) );
return text;
return wxString::Format( _( "Pcb Graphic %s, length %s on %s" ),
ShowShape( m_Shape ),
MessageTextFromValue( aUnits, GetLength() ),
GetLayerName() );
}

View File

@ -199,13 +199,15 @@ public:
void Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
GR_DRAWMODE aDrawMode, const wxPoint& aOffset = ZeroOffset ) override;
virtual void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) override;
virtual void GetMsgPanelInfo( EDA_UNITS_T aUnits,
std::vector< MSG_PANEL_ITEM >& aList ) override;
virtual const EDA_RECT GetBoundingBox() const override;
virtual bool HitTest( const wxPoint& aPosition ) const override;
bool HitTest( const EDA_RECT& aRect, bool aContained = true, int aAccuracy = 0 ) const override;
bool HitTest( const EDA_RECT& aRect, bool aContained = true,
int aAccuracy = 0 ) const override;
wxString GetClass() const override
{
@ -245,7 +247,7 @@ public:
int aCircleToSegmentsCount,
double aCorrectionFactor ) const override;
virtual wxString GetSelectMenuText() const override;
virtual wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
virtual BITMAP_DEF GetMenuImage() const override;

View File

@ -232,7 +232,7 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
// see class_edge_mod.h
void EDGE_MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
void EDGE_MODULE::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList )
{
wxString msg;
@ -250,24 +250,20 @@ void EDGE_MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
aList.push_back( MSG_PANEL_ITEM( _( "Value" ), module->GetValue(), BLUE ) );
msg.Printf( wxT( "%8.8lX" ), module->GetTimeStamp() );
aList.push_back( MSG_PANEL_ITEM( _( "TimeStamp" ), msg, BROWN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Footprint Layer" ),
module->GetLayerName(), RED ) );
aList.push_back( MSG_PANEL_ITEM( _( "Footprint Layer" ), module->GetLayerName(), RED ) );
// append the features shared with the base class
DRAWSEGMENT::GetMsgPanelInfo( aList );
DRAWSEGMENT::GetMsgPanelInfo( aUnits, aList );
}
wxString EDGE_MODULE::GetSelectMenuText() const
wxString EDGE_MODULE::GetSelectMenuText( EDA_UNITS_T aUnits ) const
{
wxString text;
text.Printf( _( "Graphic %s of %s on %s" ),
GetChars( ShowShape( m_Shape ) ),
GetChars( ((MODULE*) GetParent())->GetReference() ),
GetChars( GetLayerName() ) );
return text;
return wxString::Format( _( "Graphic %s of %s on %s" ),
ShowShape( m_Shape ),
((MODULE*) GetParent())->GetReference(),
GetLayerName() );
}

View File

@ -115,14 +115,14 @@ public:
void Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
GR_DRAWMODE aDrawMode, const wxPoint& offset = ZeroOffset ) override;
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) override;
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override;
wxString GetClass() const override
{
return wxT( "MGRAPHIC" );
}
wxString GetSelectMenuText() const override;
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
BITMAP_DEF GetMenuImage() const override;

View File

@ -93,7 +93,7 @@ bool MARKER_PCB::IsOnLayer( PCB_LAYER_ID aLayer ) const
return IsCopperLayer( aLayer );
}
void MARKER_PCB::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
void MARKER_PCB::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList )
{
const DRC_ITEM& rpt = m_drc;
@ -107,13 +107,16 @@ void MARKER_PCB::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
aList.push_back( MSG_PANEL_ITEM( errorTxt, wxEmptyString, RED ) );
wxString txtA;
txtA << DRC_ITEM::ShowCoord( rpt.GetPointA() ) << wxT( ": " ) << rpt.GetTextA();
wxString txtA = wxString::Format( wxT( "%s: %s" ),
DRC_ITEM::ShowCoord( aUnits, rpt.GetPointA() ),
rpt.GetTextA() );
wxString txtB;
if ( rpt.HasSecondItem() )
txtB << DRC_ITEM::ShowCoord( rpt.GetPointB() ) << wxT( ": " ) << rpt.GetTextB();
if( rpt.HasSecondItem() )
{
txtB = wxString::Format( wxT( "%s: %s" ),
DRC_ITEM::ShowCoord( aUnits, rpt.GetPointB() ),
rpt.GetTextB() );
}
aList.push_back( MSG_PANEL_ITEM( txtA, txtB, DARKBROWN ) );
}
@ -131,11 +134,11 @@ void MARKER_PCB::Flip(const wxPoint& aCentre )
}
wxString MARKER_PCB::GetSelectMenuText() const
wxString MARKER_PCB::GetSelectMenuText( EDA_UNITS_T aUnits ) const
{
return wxString::Format( _( "Marker @(%s, %s)" ),
GetChars( CoordinateToString( m_Pos.x ) ),
GetChars( CoordinateToString( m_Pos.y ) ) );
MessageTextFromValue( aUnits, m_Pos.x ),
MessageTextFromValue( aUnits, m_Pos.y ) );
}

View File

@ -98,9 +98,9 @@ public:
bool IsOnLayer( PCB_LAYER_ID aLayer ) const override;
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) override;
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override;
wxString GetSelectMenuText() const override;
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
BITMAP_DEF GetMenuImage() const override;

View File

@ -546,7 +546,7 @@ SHAPE_POLY_SET MODULE::GetBoundingPoly() const
}
void MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
void MODULE::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList )
{
int nbpad;
wxString msg;
@ -867,20 +867,14 @@ SEARCH_RESULT MODULE::Visit( INSPECTOR inspector, void* testData, const KICAD_T
}
wxString MODULE::GetSelectMenuText() const
wxString MODULE::GetSelectMenuText( EDA_UNITS_T aUnits ) const
{
wxString reference = GetReference();
if( reference.IsEmpty() )
reference = _( "<no reference>" );
wxString text;
text.Printf( _( "Footprint %s on %s" ),
GetChars ( reference ),
GetChars ( GetLayerName() ) );
return text;
return wxString::Format( _( "Footprint %s on %s" ), reference, GetLayerName() );
}

View File

@ -436,7 +436,7 @@ public:
const wxPoint& offset, int dim_ancre, GR_DRAWMODE draw_mode );
///> @copydoc EDA_ITEM::GetMsgPanelInfo
void GetMsgPanelInfo( std::vector<MSG_PANEL_ITEM>& aList ) override;
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
bool HitTest( const wxPoint& aPosition ) const override;
@ -598,7 +598,7 @@ public:
return wxT( "MODULE" );
}
wxString GetSelectMenuText() const override;
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
BITMAP_DEF GetMenuImage() const override;

View File

@ -700,10 +700,10 @@ int D_PAD::GetThermalGap() const
}
void D_PAD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM>& aList )
void D_PAD::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM>& aList )
{
MODULE* module;
wxString Line;
wxString msg;
BOARD* board;
module = (MODULE*) m_Parent;
@ -723,45 +723,46 @@ void D_PAD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM>& aList )
aList.push_back( MSG_PANEL_ITEM( ShowPadShape(), ShowPadAttr(), DARKGREEN ) );
Line = ::CoordinateToString( m_Size.x );
aList.push_back( MSG_PANEL_ITEM( _( "Width" ), Line, RED ) );
msg = MessageTextFromValue( aUnits, m_Size.x, true );
aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, RED ) );
Line = ::CoordinateToString( m_Size.y );
aList.push_back( MSG_PANEL_ITEM( _( "Height" ), Line, RED ) );
msg = MessageTextFromValue( aUnits, m_Size.y, true );
aList.push_back( MSG_PANEL_ITEM( _( "Height" ), msg, RED ) );
Line = ::CoordinateToString( (unsigned) m_Drill.x );
msg = MessageTextFromValue( aUnits, m_Drill.x, true );
if( GetDrillShape() == PAD_DRILL_SHAPE_CIRCLE )
{
aList.push_back( MSG_PANEL_ITEM( _( "Drill" ), Line, RED ) );
aList.push_back( MSG_PANEL_ITEM( _( "Drill" ), msg, RED ) );
}
else
{
Line = ::CoordinateToString( (unsigned) m_Drill.x );
wxString msg;
msg = ::CoordinateToString( (unsigned) m_Drill.y );
Line += wxT( "/" ) + msg;
aList.push_back( MSG_PANEL_ITEM( _( "Drill X / Y" ), Line, RED ) );
msg = MessageTextFromValue( aUnits, m_Drill.x, true )
+ wxT( "/" )
+ MessageTextFromValue( aUnits, m_Drill.y, true );
aList.push_back( MSG_PANEL_ITEM( _( "Drill X / Y" ), msg, RED ) );
}
double module_orient_degrees = module ? module->GetOrientationDegrees() : 0;
if( module_orient_degrees != 0.0 )
Line.Printf( wxT( "%3.1f(+%3.1f)" ),
GetOrientationDegrees() - module_orient_degrees,
module_orient_degrees );
msg.Printf( wxT( "%3.1f(+%3.1f)" ),
GetOrientationDegrees() - module_orient_degrees,
module_orient_degrees );
else
Line.Printf( wxT( "%3.1f" ), GetOrientationDegrees() );
msg.Printf( wxT( "%3.1f" ), GetOrientationDegrees() );
aList.push_back( MSG_PANEL_ITEM( _( "Angle" ), Line, LIGHTBLUE ) );
aList.push_back( MSG_PANEL_ITEM( _( "Angle" ), msg, LIGHTBLUE ) );
Line = ::CoordinateToString( m_Pos.x ) + wxT( ", " ) + ::CoordinateToString( m_Pos.y );
aList.push_back( MSG_PANEL_ITEM( _( "Position" ), Line, LIGHTBLUE ) );
msg = MessageTextFromValue( aUnits, m_Pos.x )
+ wxT( ", " )
+ MessageTextFromValue( aUnits, m_Pos.y );
aList.push_back( MSG_PANEL_ITEM( _( "Position" ), msg, LIGHTBLUE ) );
if( GetPadToDieLength() )
{
Line = ::CoordinateToString( GetPadToDieLength() );
aList.push_back( MSG_PANEL_ITEM( _( "Length in package" ), Line, CYAN ) );
msg = MessageTextFromValue( aUnits, GetPadToDieLength(), true );
aList.push_back( MSG_PANEL_ITEM( _( "Length in package" ), msg, CYAN ) );
}
}
@ -1199,27 +1200,21 @@ wxString D_PAD::ShowPadAttr() const
}
wxString D_PAD::GetSelectMenuText() const
wxString D_PAD::GetSelectMenuText( EDA_UNITS_T aUnits ) const
{
wxString text;
wxString padlayers( LayerMaskDescribe( GetBoard(), m_layerMask ) );
wxString padname( GetName() );
if( padname.IsEmpty() )
if( GetName().IsEmpty() )
{
text.Printf( _( "Pad of %s on %s" ),
GetChars( GetParent()->GetReference() ),
GetChars( padlayers ) );
return wxString::Format( _( "Pad of %s on %s" ),
GetParent()->GetReference(),
LayerMaskDescribe( GetBoard(), m_layerMask ) );
}
else
{
text.Printf( _( "Pad %s of %s on %s" ),
GetChars( GetName() ),
GetChars( GetParent()->GetReference() ),
GetChars( padlayers ) );
return wxString::Format( _( "Pad %s of %s on %s" ),
GetName(),
GetParent()->GetReference(),
LayerMaskDescribe( GetBoard(), m_layerMask ) );
}
return text;
}

View File

@ -645,7 +645,7 @@ public:
int GetSubRatsnest() const { return m_SubRatsnest; }
void SetSubRatsnest( int aSubRatsnest ) { m_SubRatsnest = aSubRatsnest; }
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) override;
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override;
bool IsOnLayer( PCB_LAYER_ID aLayer ) const override
{
@ -685,7 +685,7 @@ public:
void Rotate( const wxPoint& aRotCentre, double aAngle ) override;
wxString GetSelectMenuText() const override;
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
BITMAP_DEF GetMenuImage() const override;

View File

@ -183,17 +183,10 @@ const EDA_RECT PCB_TARGET::GetBoundingBox() const
}
wxString PCB_TARGET::GetSelectMenuText() const
wxString PCB_TARGET::GetSelectMenuText( EDA_UNITS_T aUnits ) const
{
wxString text;
wxString msg;
msg = ::CoordinateToString( m_Size );
// Targets are on *every* layer by definition
text.Printf( _( "Target size %s" ), GetChars( msg ) );
return text;
return wxString::Format( _( "Target size %s" ), MessageTextFromValue( aUnits, m_Size ) );
}

View File

@ -97,7 +97,7 @@ public:
// Virtual function
const EDA_RECT GetBoundingBox() const override;
wxString GetSelectMenuText() const override;
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
BITMAP_DEF GetMenuImage() const override;

View File

@ -114,7 +114,7 @@ void TEXTE_PCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
}
void TEXTE_PCB::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
void TEXTE_PCB::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList )
{
wxString msg;
@ -135,13 +135,13 @@ void TEXTE_PCB::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
msg.Printf( wxT( "%.1f" ), GetTextAngle() / 10.0 );
aList.push_back( MSG_PANEL_ITEM( _( "Angle" ), msg, DARKGREEN ) );
msg = ::CoordinateToString( GetThickness() );
msg = MessageTextFromValue( aUnits, GetThickness() );
aList.push_back( MSG_PANEL_ITEM( _( "Thickness" ), msg, MAGENTA ) );
msg = ::CoordinateToString( GetTextWidth() );
msg = MessageTextFromValue( aUnits, GetTextWidth() );
aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, RED ) );
msg = ::CoordinateToString( GetTextHeight() );
msg = MessageTextFromValue( aUnits, GetTextHeight() );
aList.push_back( MSG_PANEL_ITEM( _( "Height" ), msg, RED ) );
}
@ -178,15 +178,9 @@ void TEXTE_PCB::Flip( const wxPoint& aCentre )
}
wxString TEXTE_PCB::GetSelectMenuText() const
wxString TEXTE_PCB::GetSelectMenuText( EDA_UNITS_T aUnits ) const
{
wxString text;
text.Printf( _( "Pcb Text \"%s\" on %s"),
GetChars ( ShortenedShownText() ),
GetChars( GetLayerName() ) );
return text;
return wxString::Format( _( "Pcb Text \"%s\" on %s"), ShortenedShownText(), GetLayerName() );
}

View File

@ -91,7 +91,7 @@ public:
void Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
GR_DRAWMODE aDrawMode, const wxPoint& offset = ZeroOffset ) override;
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) override;
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override;
virtual bool HitTest( const wxPoint& aPosition ) const override
{
@ -143,7 +143,7 @@ public:
int aCircleToSegmentsCount,
double aCorrectionFactor ) const;
wxString GetSelectMenuText() const override;
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
BITMAP_DEF GetMenuImage() const override;

View File

@ -360,7 +360,7 @@ double TEXTE_MODULE::GetDrawRotation() const
// see class_text_mod.h
void TEXTE_MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
void TEXTE_MODULE::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList )
{
MODULE* module = (MODULE*) m_Parent;
@ -403,43 +403,36 @@ void TEXTE_MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
msg.Printf( wxT( "%.1f" ), GetTextAngleDegrees() );
aList.push_back( MSG_PANEL_ITEM( _( "Angle" ), msg, DARKGREEN ) );
msg = ::CoordinateToString( GetThickness() );
msg = MessageTextFromValue( aUnits, GetThickness(), true );
aList.push_back( MSG_PANEL_ITEM( _( "Thickness" ), msg, DARKGREEN ) );
msg = ::CoordinateToString( GetTextWidth() );
msg = MessageTextFromValue( aUnits, GetTextWidth(), true );
aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, RED ) );
msg = ::CoordinateToString( GetTextHeight() );
msg = MessageTextFromValue( aUnits, GetTextHeight(), true );
aList.push_back( MSG_PANEL_ITEM( _( "Height" ), msg, RED ) );
}
wxString TEXTE_MODULE::GetSelectMenuText() const
wxString TEXTE_MODULE::GetSelectMenuText( EDA_UNITS_T aUnits ) const
{
wxString text;
const wxChar *reference = GetChars( static_cast<MODULE*>( GetParent() )->GetReference() );
switch( m_Type )
{
case TEXT_is_REFERENCE:
text.Printf( _( "Reference %s" ), reference );
break;
return wxString::Format( _( "Reference %s" ),
static_cast<MODULE*>( GetParent() )->GetReference() );
case TEXT_is_VALUE:
text.Printf( _( "Value %s of %s" ),
GetChars( GetShownText() ),
reference );
break;
return wxString::Format( _( "Value %s of %s" ),
GetShownText(),
static_cast<MODULE*>( GetParent() )->GetReference() );
default: // wrap this one in quotes:
text.Printf( _( "Text \"%s\" of %s on %s" ),
GetChars( ShortenedShownText() ),
reference,
GetChars( GetLayerName() ) );
break;
return wxString::Format( _( "Text \"%s\" of %s on %s" ),
ShortenedShownText(),
static_cast<MODULE*>( GetParent() )->GetReference(),
GetLayerName() );
}
return text;
}

View File

@ -194,7 +194,7 @@ public:
GR_DRAWMODE aDrawMode,
const wxPoint& aOffset = ZeroOffset );
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) override;
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override;
virtual bool TextHitTest( const wxPoint& aPoint, int aAccuracy = 0 ) const override;
@ -215,7 +215,7 @@ public:
return wxT( "MTEXT" );
}
wxString GetSelectMenuText() const override;
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
BITMAP_DEF GetMenuImage() const override;

View File

@ -108,13 +108,6 @@ EDA_ITEM* TRACK::Clone() const
}
wxString TRACK::ShowWidth() const
{
wxString msg = ::CoordinateToString( m_Width );
return msg;
}
SEGZONE::SEGZONE( BOARD_ITEM* aParent ) :
TRACK( aParent, PCB_ZONE_T )
{
@ -127,15 +120,9 @@ EDA_ITEM* SEGZONE::Clone() const
}
wxString SEGZONE::GetSelectMenuText() const
wxString SEGZONE::GetSelectMenuText( EDA_UNITS_T aUnits ) const
{
wxString text;
text.Printf( _( "Zone [%s] on %s" ),
GetChars( GetNetnameMsg() ),
GetChars( GetLayerName() ) );
return text;
return wxString::Format( _( "Zone [%s] on %s" ), GetNetnameMsg(), GetLayerName() );
}
@ -160,9 +147,8 @@ EDA_ITEM* VIA::Clone() const
}
wxString VIA::GetSelectMenuText() const
wxString VIA::GetSelectMenuText( EDA_UNITS_T aUnits ) const
{
wxString text;
wxString format;
BOARD* board = GetBoard();
@ -186,23 +172,21 @@ wxString VIA::GetSelectMenuText() const
PCB_LAYER_ID topLayer;
PCB_LAYER_ID botLayer;
LayerPair( &topLayer, &botLayer );
text.Printf( format.GetData(),
GetChars( ShowWidth() ),
GetChars( GetNetnameMsg() ),
GetChars( board->GetLayerName( topLayer ) ),
GetChars( board->GetLayerName( botLayer ) ) );
return wxString::Format( format.GetData(),
MessageTextFromValue( aUnits, m_Width ),
GetNetnameMsg(),
board->GetLayerName( topLayer ),
board->GetLayerName( botLayer ) );
}
else
{
text.Printf( format.GetData(),
GetChars( ShowWidth() ),
GetChars( GetNetnameMsg() ),
wxT( "??" ),
wxT( "??" ) );
return wxString::Format( format.GetData(),
MessageTextFromValue( aUnits, m_Width ),
GetNetnameMsg(),
wxT( "??" ),
wxT( "??" ) );
}
return text;
}
@ -1058,13 +1042,13 @@ unsigned int VIA::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
// see class_track.h
void TRACK::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
void TRACK::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList )
{
wxString msg;
BOARD* board = GetBoard();
// Display basic infos
GetMsgPanelInfoBase( aList );
GetMsgPanelInfoBase( aUnits, aList );
// Display full track length (in Pcbnew)
if( board )
@ -1080,15 +1064,15 @@ void TRACK::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
track_buffer_start = track_buffer_start->Back();
board->MarkTrace( track_buffer_start, this, NULL, &trackLen, &lenPadToDie, false );
msg = ::MessageTextFromValue( g_UserUnit, trackLen );
msg = MessageTextFromValue( aUnits, trackLen );
aList.push_back( MSG_PANEL_ITEM( _( "Length" ), msg, DARKCYAN ) );
if( lenPadToDie != 0 )
{
msg = ::MessageTextFromValue( g_UserUnit, trackLen + lenPadToDie );
msg = MessageTextFromValue( aUnits, trackLen + lenPadToDie );
aList.push_back( MSG_PANEL_ITEM( _( "Full Length" ), msg, DARKCYAN ) );
msg = ::MessageTextFromValue( g_UserUnit, lenPadToDie );
msg = MessageTextFromValue( aUnits, lenPadToDie, true );
aList.push_back( MSG_PANEL_ITEM( _( "Pad To Die Length" ), msg, DARKCYAN ) );
}
}
@ -1098,22 +1082,22 @@ void TRACK::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
if( netclass )
{
aList.push_back( MSG_PANEL_ITEM( _( "NC Name" ), netclass->GetName(), DARKMAGENTA ) );
aList.push_back( MSG_PANEL_ITEM( _( "NC Clearance" ),
::CoordinateToString( netclass->GetClearance(), true ),
DARKMAGENTA ) );
aList.push_back( MSG_PANEL_ITEM( _( "NC Width" ),
::CoordinateToString( netclass->GetTrackWidth(), true ),
DARKMAGENTA ) );
aList.push_back( MSG_PANEL_ITEM( _( "NC Via Size" ),
::CoordinateToString( netclass->GetViaDiameter(), true ),
DARKMAGENTA ) );
aList.push_back( MSG_PANEL_ITEM( _( "NC Via Drill"),
::CoordinateToString( netclass->GetViaDrill(), true ),
DARKMAGENTA ) );
msg = MessageTextFromValue( aUnits, netclass->GetClearance(), true );
aList.push_back( MSG_PANEL_ITEM( _( "NC Clearance" ), msg, DARKMAGENTA ) );
msg = MessageTextFromValue( aUnits, netclass->GetTrackWidth(), true );
aList.push_back( MSG_PANEL_ITEM( _( "NC Width" ), msg, DARKMAGENTA ) );
msg = MessageTextFromValue( aUnits, netclass->GetViaDiameter(), true );
aList.push_back( MSG_PANEL_ITEM( _( "NC Via Size" ), msg, DARKMAGENTA ) );
msg = MessageTextFromValue( aUnits, netclass->GetViaDrill(), true );
aList.push_back( MSG_PANEL_ITEM( _( "NC Via Drill"), msg, DARKMAGENTA ) );
}
}
void TRACK::GetMsgPanelInfoBase_Common( std::vector< MSG_PANEL_ITEM >& aList )
void TRACK::GetMsgPanelInfoBase_Common( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList )
{
wxString msg;
@ -1173,14 +1157,14 @@ void TRACK::GetMsgPanelInfoBase_Common( std::vector< MSG_PANEL_ITEM >& aList )
aList.push_back( MSG_PANEL_ITEM( _( "Status" ), msg, MAGENTA ) );
}
void TRACK::GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList )
void TRACK::GetMsgPanelInfoBase( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList )
{
wxString msg;
BOARD* board = GetBoard();
aList.push_back( MSG_PANEL_ITEM( _( "Type" ), _( "Track" ), DARKCYAN ) );
GetMsgPanelInfoBase_Common( aList );
GetMsgPanelInfoBase_Common( aUnits, aList );
// Display layer
if( board )
@ -1191,23 +1175,23 @@ void TRACK::GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList )
aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), msg, BROWN ) );
// Display width
msg = ::CoordinateToString( (unsigned) m_Width );
msg = MessageTextFromValue( aUnits, m_Width, true );
aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, DARKCYAN ) );
// Display segment length
msg = ::MessageTextFromValue( g_UserUnit, GetLength() );
msg = ::MessageTextFromValue( aUnits, GetLength() );
aList.push_back( MSG_PANEL_ITEM( _( "Segment Length" ), msg, DARKCYAN ) );
}
void SEGZONE::GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList )
void SEGZONE::GetMsgPanelInfoBase( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList )
{
wxString msg;
BOARD* board = GetBoard();
aList.push_back( MSG_PANEL_ITEM( _( "Type" ), _( "Zone " ), DARKCYAN ) );
GetMsgPanelInfoBase_Common( aList );
GetMsgPanelInfoBase_Common( aUnits, aList );
// Display layer
if( board )
@ -1218,16 +1202,16 @@ void SEGZONE::GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList )
aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), msg, BROWN ) );
// Display width
msg = ::CoordinateToString( (unsigned) m_Width );
msg = MessageTextFromValue( aUnits, m_Width );
aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, DARKCYAN ) );
// Display segment length
msg = ::MessageTextFromValue( g_UserUnit, GetLength() );
msg = MessageTextFromValue( aUnits, GetLength() );
aList.push_back( MSG_PANEL_ITEM( _( "Segment Length" ), msg, DARKCYAN ) );
}
void VIA::GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList )
void VIA::GetMsgPanelInfoBase( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList )
{
wxString msg;
BOARD* board = GetBoard();
@ -1256,7 +1240,7 @@ void VIA::GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList )
aList.push_back( MSG_PANEL_ITEM( _( "Type" ), msg, DARKCYAN ) );
GetMsgPanelInfoBase_Common( aList );
GetMsgPanelInfoBase_Common( aUnits, aList );
// Display layer pair
@ -1273,15 +1257,13 @@ void VIA::GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList )
aList.push_back( MSG_PANEL_ITEM( _( "Layers" ), msg, BROWN ) );
// Display width
msg = ::CoordinateToString( (unsigned) m_Width );
msg = MessageTextFromValue( aUnits, m_Width, true );
// Display diameter value:
aList.push_back( MSG_PANEL_ITEM( _( "Diameter" ), msg, DARKCYAN ) );
// Display drill value
int drill_value = GetDrillValue();
msg = ::CoordinateToString( drill_value );
msg = MessageTextFromValue( aUnits, GetDrillValue() );
wxString title = _( "Drill" );
title += wxT( " " );
@ -1301,7 +1283,7 @@ void VIA::GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList )
drill_class_value = net->GetViaDrillSize();
}
drl_specific = drill_value != drill_class_value;
drl_specific = GetDrillValue() != drill_class_value;
}
@ -1605,17 +1587,13 @@ int TRACK::GetEndSegments( int aCount, TRACK** aStartTrace, TRACK** aEndTrace )
}
wxString TRACK::GetSelectMenuText() const
wxString TRACK::GetSelectMenuText( EDA_UNITS_T aUnits ) const
{
wxString text;
text.Printf( _("Track %s %s on %s, length: %s" ),
GetChars( ShowWidth() ),
GetChars( GetNetnameMsg() ),
GetChars( GetLayerName() ),
GetChars( ::MessageTextFromValue( g_UserUnit, GetLength() ) ) );
return text;
return wxString::Format( _("Track %s %s on %s, length: %s" ),
MessageTextFromValue( aUnits, m_Width ),
GetNetnameMsg(),
GetLayerName(),
MessageTextFromValue( aUnits, GetLength() ) );
}

View File

@ -212,13 +212,7 @@ public:
*/
bool IsNull();
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) override;
/**
* Function ShowWidth
* returns the width of the track in displayable user units.
*/
wxString ShowWidth() const;
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override;
SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override;
@ -294,7 +288,7 @@ public:
*/
virtual int GetClearance( BOARD_CONNECTED_ITEM* aItem = NULL ) const override;
virtual wxString GetSelectMenuText() const override;
virtual wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
BITMAP_DEF GetMenuImage() const override;
@ -326,12 +320,12 @@ protected:
* Display info about the track segment only, and does not calculate the full track length
* @param aList A list of #MSG_PANEL_ITEM objects to add status information.
*/
virtual void GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList );
virtual void GetMsgPanelInfoBase( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList );
/**
* Helper function for the common panel info */
void GetMsgPanelInfoBase_Common( std::vector< MSG_PANEL_ITEM >& aList );
void GetMsgPanelInfoBase_Common( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList );
/**
* Helper for drawing the short netname in tracks */
@ -365,7 +359,7 @@ public:
SEGZONE* Next() const { return static_cast<SEGZONE*>( Pnext ); }
wxString GetSelectMenuText() const override;
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
void Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
GR_DRAWMODE aDrawMode, const wxPoint& aOffset = ZeroOffset ) override;
@ -375,7 +369,7 @@ public:
EDA_ITEM* Clone() const override;
protected:
virtual void GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList ) override;
void GetMsgPanelInfoBase( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override;
};
@ -441,7 +435,7 @@ public:
return wxT( "VIA" );
}
wxString GetSelectMenuText() const override;
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
BITMAP_DEF GetMenuImage() const override;
@ -497,7 +491,7 @@ public:
virtual void SwapData( BOARD_ITEM* aImage ) override;
protected:
virtual void GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList ) override;
void GetMsgPanelInfoBase( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override;
private:
/// The bottom layer of the via (the top layer is in m_Layer)

View File

@ -810,7 +810,7 @@ bool ZONE_CONTAINER::HitTestFilledArea( const wxPoint& aRefPos ) const
}
void ZONE_CONTAINER::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
void ZONE_CONTAINER::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList )
{
wxString msg;
@ -1044,7 +1044,7 @@ bool ZONE_CONTAINER::AppendCorner( wxPoint aPosition, int aHoleIdx, bool aAllowD
}
wxString ZONE_CONTAINER::GetSelectMenuText() const
wxString ZONE_CONTAINER::GetSelectMenuText( EDA_UNITS_T aUnits ) const
{
wxString text;
@ -1057,12 +1057,7 @@ wxString ZONE_CONTAINER::GetSelectMenuText() const
else
text << GetNetnameMsg();
wxString msg;
msg.Printf( _( "Zone Outline %s on %s" ),
GetChars( text ),
GetChars( GetLayerName() ) );
return msg;
return wxString::Format( _( "Zone Outline %s on %s" ), text, GetLayerName() );
}

View File

@ -100,7 +100,7 @@ public:
*/
unsigned GetPriority() const { return m_priority; }
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) override;
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override;
void SetLayerSet( LSET aLayerSet );
@ -590,7 +590,7 @@ public:
return m_RawPolysList;
}
wxString GetSelectMenuText() const override;
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
BITMAP_DEF GetMenuImage() const override;

View File

@ -236,7 +236,7 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode )
wxString text;
item = (*m_Collector)[i];
text = item->GetSelectMenuText();
text = item->GetSelectMenuText( m_UserUnits );
BITMAP_DEF xpm = item->GetMenuImage();

View File

@ -215,8 +215,8 @@ void DIALOG_NETLIST::OnTestFootprintsClick( wxCommandEvent& event )
list << wxT(" (<i>") << module->GetValue() << wxT("</i>)");
list << wxT(" @ ");
list << CoordinateToString( module->GetPosition().x ),
list << wxT(", ") << CoordinateToString( module->GetPosition().y ),
list << MessageTextFromValue( m_units, module->GetPosition().x ),
list << wxT(", ") << MessageTextFromValue( m_units, module->GetPosition().y ),
err_cnt++;
if( ERR_CNT_MAX < err_cnt )
@ -261,8 +261,8 @@ void DIALOG_NETLIST::OnTestFootprintsClick( wxCommandEvent& event )
list << wxT( " (<i>" ) << module->GetValue() << wxT( "</i>)" );
list << wxT( " @ " );
list << CoordinateToString( module->GetPosition().x ),
list << wxT( ", " ) << CoordinateToString( module->GetPosition().y ),
list << MessageTextFromValue( m_units, module->GetPosition().x ),
list << wxT( ", " ) << MessageTextFromValue( m_units, module->GetPosition().y ),
err_cnt++;
if( ERR_CNT_MAX < err_cnt )

View File

@ -716,11 +716,11 @@ void DIALOG_PAD_PROPERTIES::initValues()
}
// A small helper function, to display coordinates:
static wxString formatCoord( wxPoint aCoord )
static wxString formatCoord( EDA_UNITS_T aUnits, wxPoint aCoord )
{
return wxString::Format( "(X:%s Y:%s)",
CoordinateToString( aCoord.x, true ),
CoordinateToString( aCoord.y, true ) );
MessageTextFromValue( aUnits, aCoord.x, true ),
MessageTextFromValue( aUnits, aCoord.y, true ) );
}
void DIALOG_PAD_PROPERTIES::displayPrimitivesList()
@ -743,20 +743,20 @@ void DIALOG_PAD_PROPERTIES::displayPrimitivesList()
bs_info[jj].Empty();
bs_info[4] = wxString::Format( _( "width %s" ),
CoordinateToString( primitive.m_Thickness, true ) );
MessageTextFromValue( m_units, primitive.m_Thickness, true ) );
switch( primitive.m_Shape )
{
case S_SEGMENT: // usual segment : line with rounded ends
bs_info[0] = _( "Segment" );
bs_info[1] = _( "from " ) + formatCoord( primitive.m_Start );
bs_info[2] = _( "to " ) + formatCoord( primitive.m_End );
bs_info[1] = _( "from " ) + formatCoord( m_units, primitive.m_Start );
bs_info[2] = _( "to " ) + formatCoord( m_units, primitive.m_End );
break;
case S_ARC: // Arc with rounded ends
bs_info[0] = _( "Arc" );
bs_info[1] = _( "center " ) + formatCoord( primitive.m_Start ); // Center
bs_info[2] = _( "start " ) + formatCoord( primitive.m_End ); // Start point
bs_info[1] = _( "center " ) + formatCoord( m_units, primitive.m_Start );// Center
bs_info[2] = _( "start " ) + formatCoord( m_units, primitive.m_End ); // Start point
bs_info[3] = wxString::Format( _( "angle %s" ), FMT_ANGLE( primitive.m_ArcAngle ) );
break;
@ -766,9 +766,9 @@ void DIALOG_PAD_PROPERTIES::displayPrimitivesList()
else
bs_info[0] = _( "circle" );
bs_info[1] = formatCoord( primitive.m_Start );
bs_info[1] = formatCoord( m_units, primitive.m_Start );
bs_info[2] = wxString::Format( _( "radius %s" ),
CoordinateToString( primitive.m_Radius, true ) );
MessageTextFromValue( m_units, primitive.m_Radius, true ) );
break;
case S_POLYGON: // polygon

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007 Dick Hollenbeck, dick@softplc.com
* Copyright (C) 2015 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2015-2018 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -23,9 +23,6 @@
*/
/*************************************************/
/* class_drc_item.cpp - DRC_ITEM class functions */
/*************************************************/
#include <fctsys.h>
#include <common.h>
@ -143,22 +140,21 @@ wxString DRC_ITEM::GetErrorText() const
return wxString( _( "Footprint has incorrect courtyard (not a closed shape)" ) );
default:
return wxString::Format( wxT( "Unknown DRC error code %d" ), m_ErrorCode );
return wxString::Format( _( "Unknown DRC error code %d" ), m_ErrorCode );
}
}
wxString DRC_ITEM::ShowCoord( const wxPoint& aPos )
wxString DRC_ITEM::ShowCoord( EDA_UNITS_T aUnits, const wxPoint& aPos )
{
return wxString::Format( _( "@(%s, %s)" ),
GetChars( CoordinateToString( aPos.x ) ),
GetChars( CoordinateToString( aPos.y ) ) );
return wxString::Format( wxT( "@(%s, %s)" ),
MessageTextFromValue( aUnits, aPos.x ),
MessageTextFromValue( aUnits, aPos.y ) );
}
wxString DRC_ITEM::ShowHtml() const
{
wxString ret;
wxString mainText = m_MainText;
// a wxHtmlWindows does not like < and > in the text to display
// because these chars have a special meaning in html
@ -173,9 +169,9 @@ wxString DRC_ITEM::ShowHtml() const
if( m_noCoordinate )
{
// omit the coordinate, a NETCLASS has no location
ret.Printf( _( "<b>%s</b><br>&nbsp;&nbsp; %s" ),
GetChars( errText ),
GetChars( mainText ) );
return wxString::Format( wxT( "<b>%s</b><br>&nbsp;&nbsp; %s" ),
errText,
mainText );
}
else if( m_hasSecondItem )
{
@ -185,43 +181,43 @@ wxString DRC_ITEM::ShowHtml() const
// an html fragment for the entire message in the listbox. feel free
// to add color if you want:
ret.Printf( _( "<b>%s</b><br>&nbsp;&nbsp; %s: %s<br>&nbsp;&nbsp; %s: %s" ),
GetChars( errText ),
GetChars( ShowCoord( m_MainPosition )), GetChars( mainText ),
GetChars( ShowCoord( m_AuxiliaryPosition )), GetChars( auxText ) );
return wxString::Format( wxT( "<b>%s</b><br>&nbsp;&nbsp; %s: %s<br>&nbsp;&nbsp; %s: %s" ),
errText,
ShowCoord( g_UserUnit, m_MainPosition ),
mainText,
ShowCoord( g_UserUnit, m_AuxiliaryPosition ),
auxText );
}
else
{
ret.Printf( _( "<b>%s</b><br>&nbsp;&nbsp; %s: %s" ),
GetChars( errText ),
GetChars( ShowCoord( m_MainPosition ) ), GetChars( mainText ) );
return wxString::Format( wxT( "<b>%s</b><br>&nbsp;&nbsp; %s: %s" ),
errText,
ShowCoord( g_UserUnit, m_MainPosition ),
mainText );
}
return ret;
}
wxString DRC_ITEM::ShowReport() const
{
wxString ret;
if( m_hasSecondItem )
{
ret.Printf( wxT( "ErrType(%d): %s\n %s: %s\n %s: %s\n" ),
m_ErrorCode,
GetChars( GetErrorText() ),
GetChars( ShowCoord( m_MainPosition ) ), GetChars( m_MainText ),
GetChars( ShowCoord( m_AuxiliaryPosition ) ), GetChars( m_AuxiliaryText ) );
return wxString::Format( wxT( "ErrType(%d): %s\n %s: %s\n %s: %s\n" ),
m_ErrorCode,
GetErrorText(),
ShowCoord( g_UserUnit, m_MainPosition ),
m_MainText,
ShowCoord( g_UserUnit, m_AuxiliaryPosition ),
m_AuxiliaryText );
}
else
{
ret.Printf( wxT( "ErrType(%d): %s\n %s: %s\n" ),
m_ErrorCode,
GetChars( GetErrorText() ),
GetChars( ShowCoord( m_MainPosition ) ), GetChars( m_MainText ) );
return wxString::Format( wxT( "ErrType(%d): %s\n %s: %s\n" ),
m_ErrorCode,
GetErrorText(),
ShowCoord( g_UserUnit, m_MainPosition ),
m_MainText );
}
return ret;
}

View File

@ -983,7 +983,7 @@ void FOOTPRINT_EDIT_FRAME::UpdateMsgPanel()
if( item )
{
item->GetMsgPanelInfo( items );
item->GetMsgPanelInfo( m_UserUnits, items );
SetMsgPanel( items );
}
else

View File

@ -139,7 +139,7 @@ BOARD_ITEM* FOOTPRINT_EDIT_FRAME::ModeditLocateAndDisplay( int aHotKeyCode )
{
item = (*m_Collector)[ii];
wxString text = item->GetSelectMenuText();
wxString text = item->GetSelectMenuText( g_UserUnit );
BITMAP_DEF xpm = item->GetMenuImage();
AddMenuItem( &itemMenu,

View File

@ -899,7 +899,7 @@ void FOOTPRINT_VIEWER_FRAME::UpdateMsgPanel()
{
MSG_PANEL_ITEMS items;
footprint->GetMsgPanelInfo( items );
footprint->GetMsgPanelInfo( m_UserUnits, items );
SetMsgPanel( items );
}
else

View File

@ -1591,7 +1591,7 @@ void PCB_IO::format( TRACK* aTrack, int aNestLevel ) const
const VIA* via = static_cast<const VIA*>( aTrack );
BOARD* board = (BOARD*) via->GetParent();
wxCHECK_RET( board != 0, wxT( "Via " ) + via->GetSelectMenuText() +
wxCHECK_RET( board != 0, wxT( "Via " ) + via->GetSelectMenuText( MILLIMETRES ) +
wxT( " has no parent." ) );
m_out->Print( aNestLevel, "(via" );

View File

@ -247,7 +247,7 @@ public:
*
* @param aList is the list in which to place the status information.
*/
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) override;
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override;
/**
* Function Clear

View File

@ -85,7 +85,7 @@ void NETINFO_ITEM::SetClass( const NETCLASSPTR& aNetClass )
}
void NETINFO_ITEM::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
void NETINFO_ITEM::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList )
{
wxString txt;
double lengthnet = 0.0; // This is the length of tracks on pcb
@ -140,14 +140,14 @@ void NETINFO_ITEM::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
aList.push_back( MSG_PANEL_ITEM( _( "Vias" ), txt, BLUE ) );
// Displays the full net length (tracks on pcb + internal ICs connections ):
txt = ::MessageTextFromValue( g_UserUnit, lengthnet + lengthPadToDie );
txt = MessageTextFromValue( aUnits, lengthnet + lengthPadToDie );
aList.push_back( MSG_PANEL_ITEM( _( "Net Length" ), txt, RED ) );
// Displays the net length of tracks only:
txt = ::MessageTextFromValue( g_UserUnit, lengthnet );
txt = MessageTextFromValue( aUnits, lengthnet );
aList.push_back( MSG_PANEL_ITEM( _( "On Board" ), txt, RED ) );
// Displays the net length of internal ICs connections (wires inside ICs):
txt = ::MessageTextFromValue( g_UserUnit, lengthPadToDie );
txt = MessageTextFromValue( aUnits, lengthPadToDie, true );
aList.push_back( MSG_PANEL_ITEM( _( "In Package" ), txt, RED ) );
}

Some files were not shown because too many files have changed in this diff Show More