mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-21 15:43:44 +00:00
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:
parent
1569842927
commit
eacaa39aa2
common
cvpcb
eeschema
controle.cppdrc_erc_item.cppedit_component_in_schematic.cppfind.cppgetpart.cpplib_arc.cpplib_arc.hlib_bezier.cpplib_bezier.hlib_circle.cpplib_circle.hlib_draw_item.cpplib_draw_item.hlib_edit_frame.cpplib_field.cpplib_field.hlib_pin.cpplib_pin.hlib_polyline.cpplib_polyline.hlib_rectangle.cpplib_rectangle.hlib_text.cpplib_text.hlibedit_onleftclick.cpplibedit_onrightclick.cpppinedit.cppsch_bitmap.hsch_bus_entry.cppsch_bus_entry.hsch_collectors.cppsch_collectors.hsch_component.cppsch_component.hsch_field.cppsch_field.hsch_junction.hsch_line.cppsch_line.hsch_marker.cppsch_marker.hsch_no_connect.hsch_sheet.cppsch_sheet.hsch_sheet_pin.cppsch_text.cppsch_text.hsymbdraw.cpp
gerbview
gerber_draw_item.cppgerber_draw_item.hgerbview_draw_panel_gal.cppgerbview_draw_panel_gal.hgerbview_frame.cpplocate.cpp
tools
include
pcbnew
attribut.cppclass_board.cppclass_board.hclass_dimension.cppclass_dimension.hclass_drawsegment.cppclass_drawsegment.hclass_edge_mod.cppclass_edge_mod.hclass_marker_pcb.cppclass_marker_pcb.hclass_module.cppclass_module.hclass_pad.cppclass_pad.hclass_pcb_target.cppclass_pcb_target.hclass_pcb_text.cppclass_pcb_text.hclass_text_mod.cppclass_text_mod.hclass_track.cppclass_track.hclass_zone.cppclass_zone.hcontrole.cpp
dialogs
drc_item.cppfootprint_edit_frame.cppfootprint_editor_utils.cppfootprint_viewer_frame.cppkicad_plugin.cppnetinfo.hnetinfo_item.cpponleftclick.cpponrightclick.cpppcb_base_frame.cpppcb_draw_panel_gal.cpppcb_draw_panel_gal.hrouter
tools
@ -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() );
|
||||
|
@ -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)
|
||||
|
@ -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 );
|
||||
}
|
||||
|
||||
|
@ -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 );
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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> %s" ),
|
||||
GetChars( errText ),
|
||||
GetChars( mainText ) );
|
||||
return wxString::Format( _( "<p><b>%s</b><br> %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> <font color='%s'><a href=''>%s</a></font>: %s<br> %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> <font color='%s'><a href=''>%s</a></font>: %s<br> %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> <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> <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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -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 );
|
||||
}
|
||||
|
||||
|
@ -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 );
|
||||
|
@ -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 );
|
||||
|
@ -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 ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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 ) );
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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 ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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 ) );
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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 ) )
|
||||
{
|
||||
|
@ -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 );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -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() ) );
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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 ) );
|
||||
}
|
||||
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user