diff --git a/common/base_struct.cpp b/common/base_struct.cpp
index ca8876a96e..ffa0e44a24 100644
--- a/common/base_struct.cpp
+++ b/common/base_struct.cpp
@@ -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() );
diff --git a/common/base_units.cpp b/common/base_units.cpp
index aab16fff1a..78a3f274e3 100644
--- a/common/base_units.cpp
+++ b/common/base_units.cpp
@@ -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)
diff --git a/common/draw_frame.cpp b/common/draw_frame.cpp
index d401803cd2..29d308348d 100644
--- a/common/draw_frame.cpp
+++ b/common/draw_frame.cpp
@@ -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 );
}
diff --git a/cvpcb/display_footprints_frame.cpp b/cvpcb/display_footprints_frame.cpp
index e81ef62faf..beea4f36e4 100644
--- a/cvpcb/display_footprints_frame.cpp
+++ b/cvpcb/display_footprints_frame.cpp
@@ -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 );
}
diff --git a/eeschema/controle.cpp b/eeschema/controle.cpp
index 95bd3fa712..e62cd8daa3 100644
--- a/eeschema/controle.cpp
+++ b/eeschema/controle.cpp
@@ -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
diff --git a/eeschema/drc_erc_item.cpp b/eeschema/drc_erc_item.cpp
index a97fa8a830..282ebfe417 100644
--- a/eeschema/drc_erc_item.cpp
+++ b/eeschema/drc_erc_item.cpp
@@ -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( _( "
%s
%s" ),
- GetChars( errText ),
- GetChars( mainText ) );
+ return wxString::Format( _( "
%s
%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( _( "
%s
%s: %s
%s: %s" ),
- GetChars( errText ),
- hrefColour.GetAsString( wxC2S_HTML_SYNTAX ),
- GetChars( ShowCoord( m_MainPosition )),
- GetChars( mainText ),
- GetChars( ShowCoord( m_AuxiliaryPosition )),
- GetChars( auxText ) );
+ return wxString::Format( _( "
%s
%s: %s
%s: %s" ),
+ errText,
+ hrefColour.GetAsString( wxC2S_HTML_SYNTAX ),
+ ShowCoord( g_UserUnit, m_MainPosition ),
+ mainText,
+ ShowCoord( g_UserUnit, m_AuxiliaryPosition ),
+ auxText );
}
else
{
- ret.Printf( _( "
%s
%s: %s" ),
- GetChars( errText ),
- hrefColour.GetAsString( wxC2S_HTML_SYNTAX ),
- GetChars( ShowCoord( m_MainPosition ) ),
- GetChars( mainText ) );
+ return wxString::Format( _( "
%s
%s: %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;
}
diff --git a/eeschema/edit_component_in_schematic.cpp b/eeschema/edit_component_in_schematic.cpp
index 0ea4585fad..385afe745c 100644
--- a/eeschema/edit_component_in_schematic.cpp
+++ b/eeschema/edit_component_in_schematic.cpp
@@ -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 );
}
diff --git a/eeschema/find.cpp b/eeschema/find.cpp
index 3c97b31b19..65569b2c20 100644
--- a/eeschema/find.cpp
+++ b/eeschema/find.cpp
@@ -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 );
diff --git a/eeschema/getpart.cpp b/eeschema/getpart.cpp
index 49e803dd8a..9f539be385 100644
--- a/eeschema/getpart.cpp
+++ b/eeschema/getpart.cpp
@@ -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 );
diff --git a/eeschema/lib_arc.cpp b/eeschema/lib_arc.cpp
index c55b7cc6f2..a63c0bf658 100644
--- a/eeschema/lib_arc.cpp
+++ b/eeschema/lib_arc.cpp
@@ -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 ) );
}
diff --git a/eeschema/lib_arc.h b/eeschema/lib_arc.h
index 886d464d15..dce73b89cc 100644
--- a/eeschema/lib_arc.h
+++ b/eeschema/lib_arc.h
@@ -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;
diff --git a/eeschema/lib_bezier.cpp b/eeschema/lib_bezier.cpp
index c727e2f45a..cd948186cc 100644
--- a/eeschema/lib_bezier.cpp
+++ b/eeschema/lib_bezier.cpp
@@ -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 ) );
diff --git a/eeschema/lib_bezier.h b/eeschema/lib_bezier.h
index 919a7f37f1..a1d5122224 100644
--- a/eeschema/lib_bezier.h
+++ b/eeschema/lib_bezier.h
@@ -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;
diff --git a/eeschema/lib_circle.cpp b/eeschema/lib_circle.cpp
index d513360364..85ecb0cce2 100644
--- a/eeschema/lib_circle.cpp
+++ b/eeschema/lib_circle.cpp
@@ -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 ) );
}
diff --git a/eeschema/lib_circle.h b/eeschema/lib_circle.h
index 1a2740285d..08c8cec5e8 100644
--- a/eeschema/lib_circle.h
+++ b/eeschema/lib_circle.h
@@ -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;
diff --git a/eeschema/lib_draw_item.cpp b/eeschema/lib_draw_item.cpp
index 7acacd235a..74defe902f 100644
--- a/eeschema/lib_draw_item.cpp
+++ b/eeschema/lib_draw_item.cpp
@@ -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;
diff --git a/eeschema/lib_draw_item.h b/eeschema/lib_draw_item.h
index af0d333088..8f83d1f422 100644
--- a/eeschema/lib_draw_item.h
+++ b/eeschema/lib_draw_item.h
@@ -248,7 +248,8 @@ public:
*
* @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.
diff --git a/eeschema/lib_edit_frame.cpp b/eeschema/lib_edit_frame.cpp
index dee0134669..41c9af3b8a 100644
--- a/eeschema/lib_edit_frame.cpp
+++ b/eeschema/lib_edit_frame.cpp
@@ -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
diff --git a/eeschema/lib_field.cpp b/eeschema/lib_field.cpp
index 974411eb7e..5b1f62a0b1 100644
--- a/eeschema/lib_field.cpp
+++ b/eeschema/lib_field.cpp
@@ -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 ) );
diff --git a/eeschema/lib_field.h b/eeschema/lib_field.h
index f622729ed1..c00cd95073 100644
--- a/eeschema/lib_field.h
+++ b/eeschema/lib_field.h
@@ -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;
diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp
index c530c98174..9a38e51514 100644
--- a/eeschema/lib_pin.cpp
+++ b/eeschema/lib_pin.cpp
@@ -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 ) )
{
diff --git a/eeschema/lib_pin.h b/eeschema/lib_pin.h
index 870e2fa0f2..6fe9f79a20 100644
--- a/eeschema/lib_pin.h
+++ b/eeschema/lib_pin.h
@@ -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 );
/**
diff --git a/eeschema/lib_polyline.cpp b/eeschema/lib_polyline.cpp
index 9113d1f928..3e31b2014c 100644
--- a/eeschema/lib_polyline.cpp
+++ b/eeschema/lib_polyline.cpp
@@ -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() ) );
}
diff --git a/eeschema/lib_polyline.h b/eeschema/lib_polyline.h
index 2a6bba10be..6426ae81a9 100644
--- a/eeschema/lib_polyline.h
+++ b/eeschema/lib_polyline.h
@@ -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;
diff --git a/eeschema/lib_rectangle.cpp b/eeschema/lib_rectangle.cpp
index 187c2d5e6e..83d53be62f 100644
--- a/eeschema/lib_rectangle.cpp
+++ b/eeschema/lib_rectangle.cpp
@@ -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 ) );
}
diff --git a/eeschema/lib_rectangle.h b/eeschema/lib_rectangle.h
index 5c85b7931b..e4d29d757b 100644
--- a/eeschema/lib_rectangle.h
+++ b/eeschema/lib_rectangle.h
@@ -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;
diff --git a/eeschema/lib_text.cpp b/eeschema/lib_text.cpp
index 9440a93eed..00e1f72b35 100644
--- a/eeschema/lib_text.cpp
+++ b/eeschema/lib_text.cpp
@@ -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() );
}
diff --git a/eeschema/lib_text.h b/eeschema/lib_text.h
index bad432168d..98e19abe25 100644
--- a/eeschema/lib_text.h
+++ b/eeschema/lib_text.h
@@ -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;
diff --git a/eeschema/libedit_onleftclick.cpp b/eeschema/libedit_onleftclick.cpp
index 14520f620a..6e153c2e48 100644
--- a/eeschema/libedit_onleftclick.cpp
+++ b/eeschema/libedit_onleftclick.cpp
@@ -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 );
}
diff --git a/eeschema/libedit_onrightclick.cpp b/eeschema/libedit_onrightclick.cpp
index fd94f07aa3..9056b4d43d 100644
--- a/eeschema/libedit_onrightclick.cpp
+++ b/eeschema/libedit_onrightclick.cpp
@@ -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
diff --git a/eeschema/pinedit.cpp b/eeschema/pinedit.cpp
index 2be5c2bea1..c79eeeeda3 100644
--- a/eeschema/pinedit.cpp
+++ b/eeschema/pinedit.cpp
@@ -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( );
}
diff --git a/eeschema/sch_bitmap.h b/eeschema/sch_bitmap.h
index ed0bfb503c..b318b8be45 100644
--- a/eeschema/sch_bitmap.h
+++ b/eeschema/sch_bitmap.h
@@ -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;
diff --git a/eeschema/sch_bus_entry.cpp b/eeschema/sch_bus_entry.cpp
index 68a64792e4..fa6a362fc6 100644
--- a/eeschema/sch_bus_entry.cpp
+++ b/eeschema/sch_bus_entry.cpp
@@ -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" ) );
}
diff --git a/eeschema/sch_bus_entry.h b/eeschema/sch_bus_entry.h
index 8c958828cd..69ed4711a0 100644
--- a/eeschema/sch_bus_entry.h
+++ b/eeschema/sch_bus_entry.h
@@ -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;
diff --git a/eeschema/sch_collectors.cpp b/eeschema/sch_collectors.cpp
index a1db6b8f0a..b6dfc2cdc1 100644
--- a/eeschema/sch_collectors.cpp
+++ b/eeschema/sch_collectors.cpp
@@ -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;
}
diff --git a/eeschema/sch_collectors.h b/eeschema/sch_collectors.h
index 48bca22ec6..df4accddb0 100644
--- a/eeschema/sch_collectors.h
+++ b/eeschema/sch_collectors.h
@@ -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
diff --git a/eeschema/sch_component.cpp b/eeschema/sch_component.cpp
index 018d34545e..e326faa7ee 100644
--- a/eeschema/sch_component.cpp
+++ b/eeschema/sch_component.cpp
@@ -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() );
}
diff --git a/eeschema/sch_component.h b/eeschema/sch_component.h
index cafba15e1c..bd72868e89 100644
--- a/eeschema/sch_component.h
+++ b/eeschema/sch_component.h
@@ -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;
diff --git a/eeschema/sch_field.cpp b/eeschema/sch_field.cpp
index 4db543e60a..c63810632c 100644
--- a/eeschema/sch_field.cpp
+++ b/eeschema/sch_field.cpp
@@ -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() );
}
diff --git a/eeschema/sch_field.h b/eeschema/sch_field.h
index 9d8285bb27..dcccc910e6 100644
--- a/eeschema/sch_field.h
+++ b/eeschema/sch_field.h
@@ -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;
diff --git a/eeschema/sch_junction.h b/eeschema/sch_junction.h
index 72b67c47d0..4fcc9ffd58 100644
--- a/eeschema/sch_junction.h
+++ b/eeschema/sch_junction.h
@@ -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;
diff --git a/eeschema/sch_line.cpp b/eeschema/sch_line.cpp
index 05fb9df3a5..8469c28494 100644
--- a/eeschema/sch_line.cpp
+++ b/eeschema/sch_line.cpp
@@ -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();
diff --git a/eeschema/sch_line.h b/eeschema/sch_line.h
index bae4549ead..d129c4b985 100644
--- a/eeschema/sch_line.h
+++ b/eeschema/sch_line.h
@@ -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;
diff --git a/eeschema/sch_marker.cpp b/eeschema/sch_marker.cpp
index 3b04455b0d..48ff000131 100644
--- a/eeschema/sch_marker.cpp
+++ b/eeschema/sch_marker.cpp
@@ -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 ) );
}
diff --git a/eeschema/sch_marker.h b/eeschema/sch_marker.h
index 3f3cf61a11..c364f28448 100644
--- a/eeschema/sch_marker.h
+++ b/eeschema/sch_marker.h
@@ -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;
diff --git a/eeschema/sch_no_connect.h b/eeschema/sch_no_connect.h
index ae72209557..9ee4c68d4d 100644
--- a/eeschema/sch_no_connect.h
+++ b/eeschema/sch_no_connect.h
@@ -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;
diff --git a/eeschema/sch_sheet.cpp b/eeschema/sch_sheet.cpp
index 74b9f76d37..ac12e92f34 100644
--- a/eeschema/sch_sheet.cpp
+++ b/eeschema/sch_sheet.cpp
@@ -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 );
}
diff --git a/eeschema/sch_sheet.h b/eeschema/sch_sheet.h
index 2ed299dfb9..0db142b65c 100644
--- a/eeschema/sch_sheet.h
+++ b/eeschema/sch_sheet.h
@@ -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;
diff --git a/eeschema/sch_sheet_pin.cpp b/eeschema/sch_sheet_pin.cpp
index 2fa1787540..8c73b21040 100644
--- a/eeschema/sch_sheet_pin.cpp
+++ b/eeschema/sch_sheet_pin.cpp
@@ -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 & 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
diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp
index df3c23968c..4eb5b50d11 100644
--- a/eeschema/sch_text.cpp
+++ b/eeschema/sch_text.cpp
@@ -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() ) );
}
diff --git a/eeschema/sch_text.h b/eeschema/sch_text.h
index d11d1c4120..19c649f7c0 100644
--- a/eeschema/sch_text.h
+++ b/eeschema/sch_text.h
@@ -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;
diff --git a/eeschema/symbdraw.cpp b/eeschema/symbdraw.cpp
index b30a856182..1e86ba3de4 100644
--- a/eeschema/symbdraw.cpp
+++ b/eeschema/symbdraw.cpp
@@ -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();
}
diff --git a/gerbview/gerber_draw_item.cpp b/gerbview/gerber_draw_item.cpp
index 27c324127e..b110b0943f 100644
--- a/gerbview/gerber_draw_item.cpp
+++ b/gerbview/gerber_draw_item.cpp
@@ -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 );
}
diff --git a/gerbview/gerber_draw_item.h b/gerbview/gerber_draw_item.h
index 9c35315643..77e26fe6e7 100644
--- a/gerbview/gerber_draw_item.h
+++ b/gerbview/gerber_draw_item.h
@@ -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;
diff --git a/gerbview/gerbview_draw_panel_gal.cpp b/gerbview/gerbview_draw_panel_gal.cpp
index 19e83a935e..b7399fedea 100644
--- a/gerbview/gerbview_draw_panel_gal.cpp
+++ b/gerbview/gerbview_draw_panel_gal.cpp
@@ -89,7 +89,8 @@ void GERBVIEW_DRAW_PANEL_GAL::SetHighContrastLayer( int aLayer )
}
-void GERBVIEW_DRAW_PANEL_GAL::GetMsgPanelInfo( std::vector& aList )
+void GERBVIEW_DRAW_PANEL_GAL::GetMsgPanelInfo( EDA_UNITS_T aUnits,
+ std::vector& aList )
{
}
diff --git a/gerbview/gerbview_draw_panel_gal.h b/gerbview/gerbview_draw_panel_gal.h
index 5b05a65afb..26d1b9ba0e 100644
--- a/gerbview/gerbview_draw_panel_gal.h
+++ b/gerbview/gerbview_draw_panel_gal.h
@@ -51,7 +51,7 @@ public:
virtual void SetHighContrastLayer( int aLayer ) override;
///> @copydoc EDA_DRAW_PANEL_GAL::GetMsgPanelInfo()
- void GetMsgPanelInfo( std::vector& aList ) override;
+ void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector& aList ) override;
///> @copydoc EDA_DRAW_PANEL_GAL::OnShow()
void OnShow() override;
diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp
index b698430d55..ccd60dd26b 100644
--- a/gerbview/gerbview_frame.cpp
+++ b/gerbview/gerbview_frame.cpp
@@ -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 );
}
}
diff --git a/gerbview/locate.cpp b/gerbview/locate.cpp
index 99fe3e3f57..b2186ab756 100644
--- a/gerbview/locate.cpp
+++ b/gerbview/locate.cpp
@@ -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 );
}
diff --git a/gerbview/tools/selection_tool.cpp b/gerbview/tools/selection_tool.cpp
index 294f87d032..f49f8062f8 100644
--- a/gerbview/tools/selection_tool.cpp
+++ b/gerbview/tools/selection_tool.cpp
@@ -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() );
}
diff --git a/include/base_struct.h b/include/base_struct.h
index 0de994f2c0..1176b2e639 100644
--- a/include/base_struct.h
+++ b/include/base_struct.h
@@ -33,12 +33,14 @@
#define BASE_STRUCT_H_
#include
+#include "common.h"
#include
#include
#if defined(DEBUG)
#include // 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
diff --git a/include/base_units.h b/include/base_units.h
index 894a8c694c..6bd913c707 100644
--- a/include/base_units.h
+++ b/include/base_units.h
@@ -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
diff --git a/include/class_draw_panel_gal.h b/include/class_draw_panel_gal.h
index 4ef3a4ad06..e50d41816d 100644
--- a/include/class_draw_panel_gal.h
+++ b/include/class_draw_panel_gal.h
@@ -37,6 +37,7 @@
#include