Push UNITS_PROVIDER down into a low-level mixin.
This allows us to also construct cheap UNIT_PROVIDERs for specific tasks when necessary.
This commit is contained in:
parent
5990595619
commit
64a6fc0fd4
|
@ -89,7 +89,7 @@ END_EVENT_TABLE()
|
|||
EDA_3D_VIEWER_FRAME::EDA_3D_VIEWER_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent,
|
||||
const wxString& aTitle, long style ) :
|
||||
KIWAY_PLAYER( aKiway, aParent, FRAME_PCB_DISPLAY3D, aTitle, wxDefaultPosition,
|
||||
wxDefaultSize, style, QUALIFIED_VIEWER3D_FRAMENAME( aParent ) ),
|
||||
wxDefaultSize, style, QUALIFIED_VIEWER3D_FRAMENAME( aParent ), unityScale ),
|
||||
m_mainToolBar( nullptr ), m_canvas( nullptr ), m_currentCamera( m_trackBallCamera ),
|
||||
m_viewportsLabel( nullptr ),
|
||||
m_cbViewports( nullptr ),
|
||||
|
|
|
@ -188,7 +188,7 @@ bool DS_DRAW_ITEM_TEXT::HitTest( const BOX2I& aRect, bool aContains, int aAccura
|
|||
}
|
||||
|
||||
|
||||
wxString DS_DRAW_ITEM_TEXT::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
wxString DS_DRAW_ITEM_TEXT::GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
return wxString::Format( _( "Text '%s'" ), GetShownText() );
|
||||
}
|
||||
|
@ -283,7 +283,7 @@ bool DS_DRAW_ITEM_POLYPOLYGONS::HitTest( const BOX2I& aRect, bool aContained, in
|
|||
}
|
||||
|
||||
|
||||
wxString DS_DRAW_ITEM_POLYPOLYGONS::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
wxString DS_DRAW_ITEM_POLYPOLYGONS::GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
return _( "Imported Shape" );
|
||||
}
|
||||
|
@ -379,13 +379,11 @@ bool DS_DRAW_ITEM_RECT::HitTest( const BOX2I& aRect, bool aContained, int aAccur
|
|||
}
|
||||
|
||||
|
||||
wxString DS_DRAW_ITEM_RECT::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
wxString DS_DRAW_ITEM_RECT::GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
return wxString::Format( _( "Rectangle, width %s height %s" ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( drawSheetIUScale, aUnits,
|
||||
std::abs( GetStart().x - GetEnd().x ) ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( drawSheetIUScale, aUnits,
|
||||
std::abs( GetStart().y - GetEnd().y ) ) );
|
||||
aUnitsProvider->MessageTextFromValue( std::abs( GetStart().x - GetEnd().x ) ),
|
||||
aUnitsProvider->MessageTextFromValue( std::abs( GetStart().y - GetEnd().y ) ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -414,10 +412,10 @@ bool DS_DRAW_ITEM_LINE::HitTest( const VECTOR2I& aPosition, int aAccuracy ) cons
|
|||
}
|
||||
|
||||
|
||||
wxString DS_DRAW_ITEM_LINE::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
wxString DS_DRAW_ITEM_LINE::GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
return wxString::Format( _( "Line, length %s" ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( drawSheetIUScale, aUnits, EuclideanNorm( GetStart() - GetEnd() ) ) );
|
||||
aUnitsProvider->MessageTextFromValue( EuclideanNorm( GetStart() - GetEnd() ) ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -462,13 +460,13 @@ bool DS_DRAW_ITEM_BITMAP::HitTest( const BOX2I& aRect, bool aContains, int aAccu
|
|||
}
|
||||
|
||||
|
||||
wxString DS_DRAW_ITEM_BITMAP::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
wxString DS_DRAW_ITEM_BITMAP::GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
return _( "Image" );
|
||||
}
|
||||
|
||||
|
||||
wxString DS_DRAW_ITEM_PAGE::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
wxString DS_DRAW_ITEM_PAGE::GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
return _( "Page Limits" );
|
||||
}
|
||||
|
|
|
@ -124,7 +124,6 @@ void EDA_BASE_FRAME::commonInit( FRAME_T aFrameType )
|
|||
m_supportsAutoSave = false;
|
||||
m_autoSaveState = false;
|
||||
m_undoRedoCountMax = DEFAULT_MAX_UNDO_ITEMS;
|
||||
m_userUnits = EDA_UNITS::MILLIMETRES;
|
||||
m_isClosing = false;
|
||||
m_isNonUserClose = false;
|
||||
m_autoSaveTimer = new wxTimer( this, ID_AUTO_SAVE_TIMER );
|
||||
|
@ -153,21 +152,14 @@ void EDA_BASE_FRAME::commonInit( FRAME_T aFrameType )
|
|||
}
|
||||
|
||||
|
||||
EDA_BASE_FRAME::EDA_BASE_FRAME( FRAME_T aFrameType, KIWAY* aKiway ) :
|
||||
wxFrame(),
|
||||
TOOLS_HOLDER(),
|
||||
KIWAY_HOLDER( aKiway, KIWAY_HOLDER::FRAME )
|
||||
{
|
||||
commonInit( aFrameType );
|
||||
}
|
||||
|
||||
|
||||
EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent, FRAME_T aFrameType,
|
||||
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
|
||||
long aStyle, const wxString& aFrameName, KIWAY* aKiway ) :
|
||||
EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent, FRAME_T aFrameType, const wxString& aTitle,
|
||||
const wxPoint& aPos, const wxSize& aSize, long aStyle,
|
||||
const wxString& aFrameName, KIWAY* aKiway,
|
||||
const EDA_IU_SCALE& aIuScale ) :
|
||||
wxFrame( aParent, wxID_ANY, aTitle, aPos, aSize, aStyle, aFrameName ),
|
||||
TOOLS_HOLDER(),
|
||||
KIWAY_HOLDER( aKiway, KIWAY_HOLDER::FRAME )
|
||||
KIWAY_HOLDER( aKiway, KIWAY_HOLDER::FRAME ),
|
||||
UNITS_PROVIDER( aIuScale, EDA_UNITS::MILLIMETRES )
|
||||
{
|
||||
commonInit( aFrameType );
|
||||
}
|
||||
|
|
|
@ -82,8 +82,7 @@ END_EVENT_TABLE()
|
|||
EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
|
||||
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
|
||||
long aStyle, const wxString& aFrameName, const EDA_IU_SCALE& aIuScale ) :
|
||||
KIWAY_PLAYER( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName ),
|
||||
m_iuScale( aIuScale )
|
||||
KIWAY_PLAYER( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName, aIuScale )
|
||||
{
|
||||
m_socketServer = nullptr;
|
||||
m_mainToolBar = nullptr;
|
||||
|
|
|
@ -105,7 +105,7 @@ INSPECT_RESULT EDA_ITEM::Visit( INSPECTOR inspector, void* testData,
|
|||
}
|
||||
|
||||
|
||||
wxString EDA_ITEM::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
wxString EDA_ITEM::GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
wxFAIL_MSG( wxT( "GetSelectMenuText() was not overridden for schematic item type " ) +
|
||||
GetClass() );
|
||||
|
|
|
@ -628,7 +628,7 @@ void EDA_SHAPE::ShapeGetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PA
|
|||
break;
|
||||
}
|
||||
|
||||
m_stroke.GetMsgPanelInfo( aFrame->GetIuScale(), aFrame->GetUserUnits(), aList );
|
||||
m_stroke.GetMsgPanelInfo( aFrame, aList );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -40,14 +40,16 @@ END_EVENT_TABLE()
|
|||
|
||||
|
||||
KIWAY_PLAYER::KIWAY_PLAYER( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
|
||||
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
|
||||
long aStyle, const wxString& aWdoName ) :
|
||||
EDA_BASE_FRAME( aParent, aFrameType, aTitle, aPos, aSize, aStyle, aWdoName, aKiway ),
|
||||
m_modal( false ),
|
||||
m_modal_loop( nullptr ),
|
||||
m_modal_resultant_parent( nullptr ),
|
||||
m_modal_ret_val( false ),
|
||||
m_socketServer( nullptr )
|
||||
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
|
||||
long aStyle, const wxString& aFrameName,
|
||||
const EDA_IU_SCALE& aIuScale ) :
|
||||
EDA_BASE_FRAME( aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName, aKiway,
|
||||
aIuScale ),
|
||||
m_modal( false ),
|
||||
m_modal_loop( nullptr ),
|
||||
m_modal_resultant_parent( nullptr ),
|
||||
m_modal_ret_val( false ),
|
||||
m_socketServer( nullptr )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -55,12 +57,13 @@ KIWAY_PLAYER::KIWAY_PLAYER( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType
|
|||
KIWAY_PLAYER::KIWAY_PLAYER( wxWindow* aParent, wxWindowID aId, const wxString& aTitle,
|
||||
const wxPoint& aPos, const wxSize& aSize, long aStyle,
|
||||
const wxString& aWdoName ) :
|
||||
EDA_BASE_FRAME( aParent, (FRAME_T) aId, aTitle, aPos, aSize, aStyle, aWdoName, nullptr ),
|
||||
m_modal( false ),
|
||||
m_modal_loop( nullptr ),
|
||||
m_modal_resultant_parent( nullptr ),
|
||||
m_modal_ret_val( false ),
|
||||
m_socketServer( nullptr )
|
||||
EDA_BASE_FRAME( aParent, (FRAME_T) aId, aTitle, aPos, aSize, aStyle, aWdoName, nullptr,
|
||||
unityScale ),
|
||||
m_modal( false ),
|
||||
m_modal_loop( nullptr ),
|
||||
m_modal_resultant_parent( nullptr ),
|
||||
m_modal_ret_val( false ),
|
||||
m_socketServer( nullptr )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -44,11 +44,11 @@ wxString RC_ITEM::GetErrorMessage() const
|
|||
}
|
||||
|
||||
|
||||
wxString RC_ITEM::ShowCoord( const EDA_IU_SCALE& aIuScale, EDA_UNITS aUnits, const VECTOR2I& aPos )
|
||||
static wxString showCoord( UNITS_PROVIDER* aUnitsProvider, const VECTOR2I& aPos )
|
||||
{
|
||||
return wxString::Format( wxT( "@(%s, %s)" ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( aIuScale, aUnits, aPos.x ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( aIuScale, aUnits, aPos.y ) );
|
||||
aUnitsProvider->MessageTextFromValue( aPos.x ),
|
||||
aUnitsProvider->MessageTextFromValue( aPos.y ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -76,7 +76,7 @@ void RC_ITEM::SetItems( const EDA_ITEM* aItem, const EDA_ITEM* bItem,
|
|||
}
|
||||
|
||||
|
||||
wxString RC_ITEM::ShowReport( const EDA_IU_SCALE& aIuScale, EDA_UNITS aUnits, SEVERITY aSeverity,
|
||||
wxString RC_ITEM::ShowReport( UNITS_PROVIDER* aUnitsProvider, SEVERITY aSeverity,
|
||||
const std::map<KIID, EDA_ITEM*>& aItemMap ) const
|
||||
{
|
||||
wxString severity;
|
||||
|
@ -120,10 +120,10 @@ wxString RC_ITEM::ShowReport( const EDA_IU_SCALE& aIuScale, EDA_UNITS aUnits, SE
|
|||
GetErrorMessage(),
|
||||
GetViolatingRuleDesc(),
|
||||
severity,
|
||||
ShowCoord( aIuScale, aUnits, mainItem->GetPosition() ),
|
||||
mainItem->GetSelectMenuText( aUnits ),
|
||||
ShowCoord( aIuScale, aUnits, auxItem->GetPosition() ),
|
||||
auxItem->GetSelectMenuText( aUnits ) );
|
||||
showCoord( aUnitsProvider, mainItem->GetPosition()),
|
||||
mainItem->GetSelectMenuText( aUnitsProvider ),
|
||||
showCoord( aUnitsProvider, auxItem->GetPosition()),
|
||||
auxItem->GetSelectMenuText( aUnitsProvider ) );
|
||||
}
|
||||
else if( mainItem )
|
||||
{
|
||||
|
@ -132,8 +132,8 @@ wxString RC_ITEM::ShowReport( const EDA_IU_SCALE& aIuScale, EDA_UNITS aUnits, SE
|
|||
GetErrorMessage(),
|
||||
GetViolatingRuleDesc(),
|
||||
severity,
|
||||
ShowCoord( aIuScale, aUnits, mainItem->GetPosition() ),
|
||||
mainItem->GetSelectMenuText( aUnits ) );
|
||||
showCoord( aUnitsProvider, mainItem->GetPosition()),
|
||||
mainItem->GetSelectMenuText( aUnitsProvider ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -374,7 +374,7 @@ void RC_TREE_MODEL::GetValue( wxVariant& aVariant,
|
|||
else
|
||||
{
|
||||
EDA_ITEM* item = m_editFrame->GetItem( rcItem->GetMainItemID() );
|
||||
aVariant = item->GetSelectMenuText( m_editFrame->GetUserUnits() );
|
||||
aVariant = item->GetSelectMenuText( m_editFrame );
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -382,21 +382,21 @@ void RC_TREE_MODEL::GetValue( wxVariant& aVariant,
|
|||
case RC_TREE_NODE::AUX_ITEM:
|
||||
{
|
||||
EDA_ITEM* item = m_editFrame->GetItem( rcItem->GetAuxItemID() );
|
||||
aVariant = item->GetSelectMenuText( m_editFrame->GetUserUnits() );
|
||||
aVariant = item->GetSelectMenuText( m_editFrame );
|
||||
}
|
||||
break;
|
||||
|
||||
case RC_TREE_NODE::AUX_ITEM2:
|
||||
{
|
||||
EDA_ITEM* item = m_editFrame->GetItem( rcItem->GetAuxItem2ID() );
|
||||
aVariant = item->GetSelectMenuText( m_editFrame->GetUserUnits() );
|
||||
aVariant = item->GetSelectMenuText( m_editFrame );
|
||||
}
|
||||
break;
|
||||
|
||||
case RC_TREE_NODE::AUX_ITEM3:
|
||||
{
|
||||
EDA_ITEM* item = m_editFrame->GetItem( rcItem->GetAuxItem3ID() );
|
||||
aVariant = item->GetSelectMenuText( m_editFrame->GetUserUnits() );
|
||||
aVariant = item->GetSelectMenuText( m_editFrame );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -190,7 +190,7 @@ wxString STROKE_PARAMS::GetLineStyleToken( PLOT_DASH_TYPE aStyle )
|
|||
}
|
||||
|
||||
|
||||
void STROKE_PARAMS::GetMsgPanelInfo( const EDA_IU_SCALE& aIuScale, EDA_UNITS aUnits,
|
||||
void STROKE_PARAMS::GetMsgPanelInfo( UNITS_PROVIDER* aUnitsProvider,
|
||||
std::vector<MSG_PANEL_ITEM>& aList,
|
||||
bool aIncludeStyle, bool aIncludeWidth )
|
||||
{
|
||||
|
@ -211,9 +211,7 @@ void STROKE_PARAMS::GetMsgPanelInfo( const EDA_IU_SCALE& aIuScale, EDA_UNITS aUn
|
|||
}
|
||||
|
||||
if( aIncludeWidth )
|
||||
{
|
||||
aList.emplace_back( _( "Line Width" ), EDA_UNIT_UTILS::UI::MessageTextFromValue( aIuScale, aUnits, GetWidth() ) );
|
||||
}
|
||||
aList.emplace_back( _( "Line Width" ), aUnitsProvider->MessageTextFromValue( GetWidth() ) );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -234,11 +234,11 @@ int SELECTION_TOOL::SelectionMenu( const TOOL_EVENT& aEvent )
|
|||
|
||||
bool SELECTION_TOOL::doSelectionMenu( COLLECTOR* aCollector )
|
||||
{
|
||||
EDA_UNITS userUnits = getEditFrame<EDA_DRAW_FRAME>()->GetUserUnits();
|
||||
EDA_ITEM* current = nullptr;
|
||||
SELECTION highlightGroup;
|
||||
bool selectAll = false;
|
||||
bool expandSelection = false;
|
||||
UNITS_PROVIDER* unitsProvider = getEditFrame<EDA_DRAW_FRAME>();
|
||||
EDA_ITEM* current = nullptr;
|
||||
SELECTION highlightGroup;
|
||||
bool selectAll = false;
|
||||
bool expandSelection = false;
|
||||
|
||||
highlightGroup.SetLayer( LAYER_SELECT_OVERLAY );
|
||||
getView()->Add( &highlightGroup );
|
||||
|
@ -263,18 +263,18 @@ bool SELECTION_TOOL::doSelectionMenu( COLLECTOR* aCollector )
|
|||
{
|
||||
#ifdef __WXMAC__
|
||||
menuText = wxString::Format( "%s\t%d",
|
||||
item->GetSelectMenuText( userUnits ),
|
||||
item->GetSelectMenuText( unitsProvider ),
|
||||
i + 1 );
|
||||
#else
|
||||
menuText = wxString::Format( "&%d %s\t%d",
|
||||
i + 1,
|
||||
item->GetSelectMenuText( userUnits ),
|
||||
item->GetSelectMenuText( unitsProvider ),
|
||||
i + 1 );
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
menuText = item->GetSelectMenuText( userUnits );
|
||||
menuText = item->GetSelectMenuText( unitsProvider );
|
||||
}
|
||||
|
||||
menu.Add( menuText, i + 1, item->GetMenuImage() );
|
||||
|
|
|
@ -65,7 +65,8 @@
|
|||
|
||||
CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||
KIWAY_PLAYER( aKiway, aParent, FRAME_CVPCB, _( "Assign Footprints" ), wxDefaultPosition,
|
||||
wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, CVPCB_MAINFRAME_NAME ),
|
||||
wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, CVPCB_MAINFRAME_NAME,
|
||||
unityScale ),
|
||||
m_footprintListPendingUpdate( false ),
|
||||
m_viewerPendingUpdate( false )
|
||||
{
|
||||
|
|
|
@ -984,10 +984,14 @@ void CONNECTION_GRAPH::collectAllDriverValues()
|
|||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
UNITS_PROVIDER unitsProvider( schIUScale, EDA_UNITS::MILLIMETRES );
|
||||
|
||||
wxLogTrace( ConnTrace, "Unexpected strong driver %s",
|
||||
driver->GetSelectMenuText( EDA_UNITS::MILLIMETRES ) );
|
||||
driver->GetSelectMenuText( &unitsProvider ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1174,10 +1178,12 @@ void CONNECTION_GRAPH::processSubGraphs()
|
|||
}
|
||||
else
|
||||
{
|
||||
UNITS_PROVIDER unitsProvider( schIUScale, EDA_UNITS::MILLIMETRES );
|
||||
|
||||
wxLogTrace( ConnTrace,
|
||||
"%ld (%s) weakly driven by unique sheet pin %s, promoting",
|
||||
subgraph->m_code, name,
|
||||
subgraph->m_driver->GetSelectMenuText( EDA_UNITS::MILLIMETRES ) );
|
||||
"%ld (%s) weakly driven by unique sheet pin %s, promoting",
|
||||
subgraph->m_code, name,
|
||||
subgraph->m_driver->GetSelectMenuText( &unitsProvider ) );
|
||||
|
||||
subgraph->m_strong_driver = true;
|
||||
}
|
||||
|
|
|
@ -983,7 +983,7 @@ bool DIALOG_ERC::writeReport( const wxString& aFullFileName )
|
|||
default: break;
|
||||
}
|
||||
|
||||
msg << marker->GetRCItem()->ShowReport( schIUScale, GetUserUnits(), severity, itemMap );
|
||||
msg << marker->GetRCItem()->ShowReport( m_parent, severity, itemMap );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -497,7 +497,7 @@ void LIB_FIELD::SetName( const wxString& aName )
|
|||
}
|
||||
|
||||
|
||||
wxString LIB_FIELD::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
wxString LIB_FIELD::GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
return wxString::Format( "%s '%s'", GetName(), KIUI::EllipsizeMenuText( GetShownText() ) );
|
||||
}
|
||||
|
|
|
@ -167,7 +167,7 @@ public:
|
|||
void Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffset,
|
||||
const TRANSFORM& aTransform, bool aDimmed ) const override;
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
|
||||
|
||||
BITMAPS GetMenuImage() const override;
|
||||
|
||||
|
|
|
@ -1322,7 +1322,7 @@ BITMAPS LIB_PIN::GetMenuImage() const
|
|||
}
|
||||
|
||||
|
||||
wxString LIB_PIN::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
wxString LIB_PIN::GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
if( !m_name.IsEmpty() )
|
||||
{
|
||||
|
|
|
@ -235,7 +235,7 @@ public:
|
|||
|
||||
BITMAPS GetMenuImage() const override;
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
|
||||
|
||||
EDA_ITEM* Clone() const override;
|
||||
|
||||
|
|
|
@ -447,22 +447,22 @@ void LIB_SHAPE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
|
|||
}
|
||||
|
||||
|
||||
wxString LIB_SHAPE::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
wxString LIB_SHAPE::GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
switch( GetShape() )
|
||||
{
|
||||
case SHAPE_T::ARC:
|
||||
return wxString::Format( _( "Arc, radius %s" ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aUnits, GetRadius() ) );
|
||||
aUnitsProvider->MessageTextFromValue( GetRadius() ) );
|
||||
|
||||
case SHAPE_T::CIRCLE:
|
||||
return wxString::Format( _( "Circle, radius %s" ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aUnits, GetRadius() ) );
|
||||
aUnitsProvider->MessageTextFromValue( GetRadius() ) );
|
||||
|
||||
case SHAPE_T::RECT:
|
||||
return wxString::Format( _( "Rectangle, width %s height %s" ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aUnits, std::abs( m_start.x - m_end.x ) ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aUnits, std::abs( m_start.y - m_end.y ) ) );
|
||||
aUnitsProvider->MessageTextFromValue( std::abs( m_start.x - m_end.x ) ),
|
||||
aUnitsProvider->MessageTextFromValue( std::abs( m_start.y - m_end.y ) ) );
|
||||
|
||||
case SHAPE_T::POLY:
|
||||
return wxString::Format( _( "Polyline, %d points" ),
|
||||
|
|
|
@ -107,7 +107,7 @@ public:
|
|||
void Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffset,
|
||||
const TRANSFORM& aTransform, bool aDimmed ) const override;
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
|
||||
|
||||
BITMAPS GetMenuImage() const override;
|
||||
|
||||
|
|
|
@ -438,7 +438,7 @@ const BOX2I LIB_TEXT::GetBoundingBox() const
|
|||
}
|
||||
|
||||
|
||||
wxString LIB_TEXT::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
wxString LIB_TEXT::GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
return wxString::Format( _( "Graphic Text '%s'" ), KIUI::EllipsizeMenuText( GetShownText() ) );
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ public:
|
|||
void Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffset,
|
||||
const TRANSFORM& aTransform, bool aDimmed ) const override;
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
|
||||
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
||||
|
||||
BITMAPS GetMenuImage() const override;
|
||||
|
|
|
@ -356,7 +356,7 @@ bool LIB_TEXTBOX::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy )
|
|||
}
|
||||
|
||||
|
||||
wxString LIB_TEXTBOX::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
wxString LIB_TEXTBOX::GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
return wxString::Format( _( "Graphic Text Box" ) );
|
||||
}
|
||||
|
@ -458,13 +458,13 @@ void LIB_TEXTBOX::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL
|
|||
|
||||
aList.emplace_back( _( "Text Size" ), aFrame->MessageTextFromValue( GetTextWidth() ) );
|
||||
|
||||
wxString msg = aFrame->MessageTextFromValue( std::abs( GetEnd().x - GetStart().x ) );
|
||||
aList.emplace_back( _( "Box Width" ), msg );
|
||||
aList.emplace_back( _( "Box Width" ),
|
||||
aFrame->MessageTextFromValue( std::abs( GetEnd().x - GetStart().x ) ) );
|
||||
|
||||
msg = aFrame->MessageTextFromValue( std::abs( GetEnd().y - GetStart().y ) );
|
||||
aList.emplace_back( _( "Box Height" ), msg );
|
||||
aList.emplace_back( _( "Box Height" ),
|
||||
aFrame->MessageTextFromValue( std::abs( GetEnd().y - GetStart().y ) ) );
|
||||
|
||||
m_stroke.GetMsgPanelInfo( schIUScale, aFrame->GetUserUnits(), aList );
|
||||
m_stroke.GetMsgPanelInfo( aFrame, aList );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ public:
|
|||
|
||||
virtual bool IsReplaceable() const override { return true; }
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
|
||||
|
||||
BITMAPS GetMenuImage() const override;
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ public:
|
|||
void MirrorVertically( int aCenter ) override;
|
||||
void Rotate( const VECTOR2I& aCenter ) override;
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override
|
||||
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override
|
||||
{
|
||||
return wxString( _( "Image" ) );
|
||||
}
|
||||
|
|
|
@ -412,13 +412,13 @@ std::vector<VECTOR2I> SCH_BUS_ENTRY_BASE::GetConnectionPoints() const
|
|||
}
|
||||
|
||||
|
||||
wxString SCH_BUS_WIRE_ENTRY::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
wxString SCH_BUS_WIRE_ENTRY::GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
return wxString( _( "Bus to Wire Entry" ) );
|
||||
}
|
||||
|
||||
|
||||
wxString SCH_BUS_BUS_ENTRY::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
wxString SCH_BUS_BUS_ENTRY::GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
return wxString( _( "Bus to Bus Entry" ) );
|
||||
}
|
||||
|
|
|
@ -178,7 +178,7 @@ public:
|
|||
( aItem->GetLayer() == LAYER_WIRE || aItem->GetLayer() == LAYER_BUS );
|
||||
}
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
|
||||
|
||||
EDA_ITEM* Clone() const override;
|
||||
|
||||
|
@ -225,7 +225,7 @@ public:
|
|||
return aItem->Type() == SCH_LINE_T && aItem->GetLayer() == LAYER_BUS;
|
||||
}
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
|
||||
|
||||
EDA_ITEM* Clone() const override;
|
||||
|
||||
|
|
|
@ -439,7 +439,9 @@ void SCH_CONNECTION::AppendInfoToMsgPanel( std::vector<MSG_PANEL_ITEM>& aList )
|
|||
|
||||
if( SCH_ITEM* driver = Driver() )
|
||||
{
|
||||
msg.Printf( "%s at %p", driver->GetSelectMenuText( EDA_UNITS::MILLIMETRES ), driver );
|
||||
UNITS_PROVIDER unitsProvider( schIUScale, EDA_UNITS::MILLIMETRES );
|
||||
|
||||
msg.Printf( "%s at %p", driver->GetSelectMenuText( &unitsProvider ), driver );
|
||||
aList.emplace_back( wxT( "Connection Source" ), msg );
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -553,9 +553,6 @@ bool SCH_FIELD::Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) co
|
|||
|
||||
wxString text = GetShownText();
|
||||
|
||||
wxLogTrace( traceFindItem, wxT( " child item " )
|
||||
+ GetSelectMenuText( EDA_UNITS::MILLIMETRES ) );
|
||||
|
||||
if( !IsVisible() && !searchHiddenFields )
|
||||
return false;
|
||||
|
||||
|
@ -704,7 +701,7 @@ void SCH_FIELD::Rotate( const VECTOR2I& aCenter )
|
|||
}
|
||||
|
||||
|
||||
wxString SCH_FIELD::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
wxString SCH_FIELD::GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
return wxString::Format( "%s '%s'", GetName(), KIUI::EllipsizeMenuText( GetShownText() ) );
|
||||
}
|
||||
|
|
|
@ -204,7 +204,7 @@ public:
|
|||
|
||||
bool Replace( const EDA_SEARCH_DATA& aSearchData, void* aAuxData = nullptr ) override;
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
|
||||
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
||||
|
||||
BITMAPS GetMenuImage() const override;
|
||||
|
|
|
@ -92,7 +92,7 @@ public:
|
|||
|| aItem->Type() == SCH_SYMBOL_T );
|
||||
}
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override
|
||||
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override
|
||||
{
|
||||
return wxString( _( "Junction" ) );
|
||||
}
|
||||
|
|
|
@ -1020,7 +1020,7 @@ const BOX2I SCH_LABEL::GetBodyBoundingBox() const
|
|||
}
|
||||
|
||||
|
||||
wxString SCH_LABEL::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
wxString SCH_LABEL::GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
return wxString::Format( _( "Label '%s'" ), KIUI::EllipsizeMenuText( GetShownText() ) );
|
||||
}
|
||||
|
@ -1191,7 +1191,7 @@ void SCH_DIRECTIVE_LABEL::AutoplaceFields( SCH_SCREEN* aScreen, bool aManual )
|
|||
}
|
||||
|
||||
|
||||
wxString SCH_DIRECTIVE_LABEL::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
wxString SCH_DIRECTIVE_LABEL::GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
if( m_fields.empty() )
|
||||
{
|
||||
|
@ -1473,7 +1473,7 @@ void SCH_GLOBALLABEL::CreateGraphicShape( const RENDER_SETTINGS* aRenderSettings
|
|||
}
|
||||
|
||||
|
||||
wxString SCH_GLOBALLABEL::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
wxString SCH_GLOBALLABEL::GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
return wxString::Format( _( "Global Label '%s'" ), KIUI::EllipsizeMenuText( GetShownText() ) );
|
||||
}
|
||||
|
@ -1606,7 +1606,7 @@ VECTOR2I SCH_HIERLABEL::GetSchematicTextOffset( const RENDER_SETTINGS* aSettings
|
|||
}
|
||||
|
||||
|
||||
wxString SCH_HIERLABEL::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
wxString SCH_HIERLABEL::GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
return wxString::Format( _( "Hierarchical Label '%s'" ),
|
||||
KIUI::EllipsizeMenuText( GetShownText() ) );
|
||||
|
|
|
@ -229,7 +229,7 @@ public:
|
|||
|
||||
bool IsConnectable() const override { return true; }
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
|
||||
|
||||
BITMAPS GetMenuImage() const override;
|
||||
|
||||
|
@ -291,7 +291,7 @@ public:
|
|||
|
||||
void AutoplaceFields( SCH_SCREEN* aScreen, bool aManual ) override;
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
|
||||
|
||||
bool IsConnectable() const override { return true; }
|
||||
|
||||
|
@ -347,7 +347,7 @@ public:
|
|||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
|
||||
|
||||
BITMAPS GetMenuImage() const override;
|
||||
|
||||
|
@ -399,7 +399,7 @@ public:
|
|||
|
||||
bool IsConnectable() const override { return true; }
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
|
||||
|
||||
BITMAPS GetMenuImage() const override;
|
||||
|
||||
|
|
|
@ -691,7 +691,7 @@ void SCH_LINE::GetSelectedPoints( std::vector<VECTOR2I>& aPoints ) const
|
|||
}
|
||||
|
||||
|
||||
wxString SCH_LINE::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
wxString SCH_LINE::GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
wxString txtfmt;
|
||||
|
||||
|
@ -724,7 +724,7 @@ wxString SCH_LINE::GetSelectMenuText( EDA_UNITS aUnits ) const
|
|||
}
|
||||
|
||||
return wxString::Format( txtfmt,
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aUnits, EuclideanNorm( m_start - m_end ) ) );
|
||||
aUnitsProvider->MessageTextFromValue( EuclideanNorm( m_start - m_end ) ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -897,7 +897,7 @@ void SCH_LINE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_IT
|
|||
if( GetEffectiveLineStyle() != lineStyle )
|
||||
aList.emplace_back( _( "Line Style" ), _( "from netclass" ) );
|
||||
else
|
||||
m_stroke.GetMsgPanelInfo( schIUScale, aFrame->GetUserUnits(), aList, true, false );
|
||||
m_stroke.GetMsgPanelInfo( aFrame, aList, true, false );
|
||||
|
||||
SCH_CONNECTION* conn = nullptr;
|
||||
|
||||
|
|
|
@ -245,7 +245,7 @@ public:
|
|||
|
||||
bool CanConnect( const SCH_ITEM* aItem ) const override;
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
|
||||
|
||||
BITMAPS GetMenuImage() const override;
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ public:
|
|||
|
||||
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override
|
||||
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override
|
||||
{
|
||||
return wxString( _( "ERC Marker" ) );
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ public:
|
|||
|
||||
std::vector<VECTOR2I> GetConnectionPoints() const override;
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override
|
||||
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override
|
||||
{
|
||||
return wxString( _( "No Connect" ) );
|
||||
}
|
||||
|
|
|
@ -191,17 +191,16 @@ SCH_SYMBOL* SCH_PIN::GetParentSymbol() const
|
|||
}
|
||||
|
||||
|
||||
wxString SCH_PIN::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
wxString SCH_PIN::GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
return wxString::Format( "Symbol %s %s",
|
||||
GetParentSymbol()->GetField( REFERENCE_FIELD )->GetShownText(),
|
||||
m_libPin->GetSelectMenuText( aUnits ) );
|
||||
m_libPin->GetSelectMenuText( aUnitsProvider ) );
|
||||
}
|
||||
|
||||
|
||||
void SCH_PIN::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
|
||||
{
|
||||
EDA_UNITS units = aFrame->GetUserUnits();
|
||||
wxString msg;
|
||||
|
||||
aList.emplace_back( _( "Type" ), _( "Pin" ) );
|
||||
|
@ -222,7 +221,7 @@ void SCH_PIN::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITE
|
|||
|
||||
aList.emplace_back( _( "Visible" ), IsVisible() ? _( "Yes" ) : _( "No" ) );
|
||||
|
||||
aList.emplace_back( _( "Length" ), EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, units, GetLength() ), true );
|
||||
aList.emplace_back( _( "Length" ), aFrame->MessageTextFromValue( GetLength() ), true );
|
||||
|
||||
int i = PinOrientationIndex( GetOrientation() );
|
||||
aList.emplace_back( _( "Orientation" ), PinOrientationName( (unsigned) i ) );
|
||||
|
|
|
@ -68,7 +68,7 @@ public:
|
|||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
|
||||
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
||||
|
||||
void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override {}
|
||||
|
|
|
@ -368,22 +368,22 @@ void SCH_SHAPE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
|
|||
}
|
||||
|
||||
|
||||
wxString SCH_SHAPE::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
wxString SCH_SHAPE::GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
switch( GetShape() )
|
||||
{
|
||||
case SHAPE_T::ARC:
|
||||
return wxString::Format( _( "Arc, radius %s" ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aUnits, GetRadius() ) );
|
||||
aUnitsProvider->MessageTextFromValue( GetRadius() ) );
|
||||
|
||||
case SHAPE_T::CIRCLE:
|
||||
return wxString::Format( _( "Circle, radius %s" ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aUnits, GetRadius() ) );
|
||||
aUnitsProvider->MessageTextFromValue( GetRadius() ) );
|
||||
|
||||
case SHAPE_T::RECT:
|
||||
return wxString::Format( _( "Rectangle, width %s height %s" ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aUnits, std::abs( m_start.x - m_end.x ) ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aUnits, std::abs( m_start.y - m_end.y ) ) );
|
||||
aUnitsProvider->MessageTextFromValue( std::abs( m_start.x - m_end.x ) ),
|
||||
aUnitsProvider->MessageTextFromValue( std::abs( m_start.y - m_end.y ) ) );
|
||||
|
||||
case SHAPE_T::POLY:
|
||||
return wxString::Format( _( "Polyline, %d points" ),
|
||||
|
|
|
@ -99,7 +99,7 @@ public:
|
|||
|
||||
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
|
||||
|
||||
BITMAPS GetMenuImage() const override;
|
||||
|
||||
|
|
|
@ -914,8 +914,6 @@ void SCH_SHEET::Resize( const wxSize& aSize )
|
|||
|
||||
bool SCH_SHEET::Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const
|
||||
{
|
||||
wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText( EDA_UNITS::MILLIMETRES ) );
|
||||
|
||||
// Sheets are searchable via the child field and pin item text.
|
||||
return false;
|
||||
}
|
||||
|
@ -1035,7 +1033,7 @@ void SCH_SHEET::RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction
|
|||
}
|
||||
|
||||
|
||||
wxString SCH_SHEET::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
wxString SCH_SHEET::GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
return wxString::Format( _( "Hierarchical Sheet %s" ),
|
||||
m_fields[ SHEETNAME ].GetText() );
|
||||
|
|
|
@ -355,7 +355,7 @@ public:
|
|||
|
||||
void RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction ) override;
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
|
||||
|
||||
BITMAPS GetMenuImage() const override;
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ public:
|
|||
SCH_ITEM( nullptr, NOT_USED )
|
||||
{}
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override
|
||||
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override
|
||||
{
|
||||
return _( "(Deleted Item)" );
|
||||
}
|
||||
|
|
|
@ -325,7 +325,7 @@ void SCH_SHEET_PIN::GetEndPoints( std::vector<DANGLING_END_ITEM>& aItemList )
|
|||
}
|
||||
|
||||
|
||||
wxString SCH_SHEET_PIN::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
wxString SCH_SHEET_PIN::GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
return wxString::Format( _( "Hierarchical Sheet Pin %s" ),
|
||||
KIUI::EllipsizeMenuText( GetShownText() ) );
|
||||
|
|
|
@ -182,7 +182,7 @@ public:
|
|||
|
||||
bool IsConnectable() const override { return true; }
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
|
||||
|
||||
BITMAPS GetMenuImage() const override;
|
||||
|
||||
|
|
|
@ -1662,8 +1662,6 @@ void SCH_SYMBOL::Rotate( const VECTOR2I& aCenter )
|
|||
|
||||
bool SCH_SYMBOL::Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const
|
||||
{
|
||||
wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText( EDA_UNITS::MILLIMETRES ) );
|
||||
|
||||
// Symbols are searchable via the child field and pin item text.
|
||||
return false;
|
||||
}
|
||||
|
@ -1781,7 +1779,7 @@ LIB_ITEM* SCH_SYMBOL::GetDrawItem( const VECTOR2I& aPosition, KICAD_T aType )
|
|||
}
|
||||
|
||||
|
||||
wxString SCH_SYMBOL::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
wxString SCH_SYMBOL::GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
return wxString::Format( _( "Symbol %s [%s]" ),
|
||||
GetField( REFERENCE_FIELD )->GetShownText(),
|
||||
|
|
|
@ -691,7 +691,7 @@ public:
|
|||
*/
|
||||
LIB_ITEM* GetDrawItem( const VECTOR2I& aPosition, KICAD_T aType = TYPE_NOT_INIT );
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
|
||||
|
||||
BITMAPS GetMenuImage() const override;
|
||||
|
||||
|
|
|
@ -393,7 +393,7 @@ void SCH_TEXT::DoHypertextAction( EDA_DRAW_FRAME* aFrame ) const
|
|||
}
|
||||
|
||||
|
||||
wxString SCH_TEXT::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
wxString SCH_TEXT::GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
return wxString::Format( _( "Graphic Text '%s'" ), KIUI::EllipsizeMenuText( GetShownText() ) );
|
||||
}
|
||||
|
|
|
@ -201,7 +201,7 @@ public:
|
|||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
|
||||
|
||||
BITMAPS GetMenuImage() const override;
|
||||
|
||||
|
|
|
@ -363,7 +363,7 @@ void SCH_TEXTBOX::DoHypertextAction( EDA_DRAW_FRAME* aFrame ) const
|
|||
}
|
||||
|
||||
|
||||
wxString SCH_TEXTBOX::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
wxString SCH_TEXTBOX::GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
return wxString::Format( _( "Graphic Text Box" ) );
|
||||
}
|
||||
|
@ -435,8 +435,6 @@ void SCH_TEXTBOX::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
|||
|
||||
void SCH_TEXTBOX::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
|
||||
{
|
||||
EDA_UNITS units = aFrame->GetUserUnits();
|
||||
|
||||
// Don't use GetShownText() here; we want to show the user the variable references
|
||||
aList.emplace_back( _( "Text Box" ), KIUI::EllipsizeStatusText( aFrame, GetText() ) );
|
||||
|
||||
|
@ -446,13 +444,13 @@ void SCH_TEXTBOX::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL
|
|||
int style = IsBold() && IsItalic() ? 3 : IsBold() ? 2 : IsItalic() ? 1 : 0;
|
||||
aList.emplace_back( _( "Style" ), textStyle[style] );
|
||||
|
||||
aList.emplace_back( _( "Text Size" ), EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, units, GetTextWidth() ) );
|
||||
aList.emplace_back( _( "Text Size" ), aFrame->MessageTextFromValue( GetTextWidth() ) );
|
||||
|
||||
wxString msg = EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, units, std::abs( GetEnd().x - GetStart().x ) );
|
||||
aList.emplace_back( _( "Box Width" ), msg );
|
||||
aList.emplace_back( _( "Box Width" ),
|
||||
aFrame->MessageTextFromValue( std::abs( GetEnd().x - GetStart().x ) ) );
|
||||
|
||||
msg = EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, units, std::abs( GetEnd().y - GetStart().y ) );
|
||||
aList.emplace_back( _( "Box Height" ), msg );
|
||||
aList.emplace_back( _( "Box Height" ),
|
||||
aFrame->MessageTextFromValue( std::abs( GetEnd().y - GetStart().y ) ) );
|
||||
|
||||
m_stroke.GetMsgPanelInfo( schIUScale, units, aList );
|
||||
m_stroke.GetMsgPanelInfo( aFrame, aList );
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ public:
|
|||
|
||||
virtual bool IsReplaceable() const override { return true; }
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
|
||||
|
||||
BITMAPS GetMenuImage() const override;
|
||||
|
||||
|
|
|
@ -993,7 +993,7 @@ INSPECT_RESULT GERBER_DRAW_ITEM::Visit( INSPECTOR inspector, void* testData,
|
|||
}
|
||||
|
||||
|
||||
wxString GERBER_DRAW_ITEM::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
wxString GERBER_DRAW_ITEM::GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
wxString layerName = GERBER_FILE_IMAGE_LIST::GetImagesList().GetDisplayName( GetLayer(), true );
|
||||
|
||||
|
|
|
@ -222,7 +222,7 @@ public:
|
|||
const std::vector<KICAD_T>& aScanTypes ) override;
|
||||
|
||||
///< @copydoc EDA_ITEM::GetSelectMenuText()
|
||||
virtual wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
virtual wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
|
||||
|
||||
///< @copydoc EDA_ITEM::GetMenuImage()
|
||||
BITMAPS GetMenuImage() const override;
|
||||
|
|
|
@ -341,7 +341,7 @@ public:
|
|||
BOARD_ITEM( nullptr, NOT_USED )
|
||||
{}
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override
|
||||
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override
|
||||
{
|
||||
return _( "(Deleted Item)" );
|
||||
}
|
||||
|
|
|
@ -143,7 +143,7 @@ public:
|
|||
|
||||
void PrintWsItem( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override;
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
|
||||
|
@ -178,7 +178,7 @@ public:
|
|||
|
||||
void PrintWsItem( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override;
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
|
||||
|
@ -232,7 +232,7 @@ public:
|
|||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
|
||||
bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
|
||||
|
@ -279,7 +279,7 @@ public:
|
|||
const BOX2I GetBoundingBox() const override;
|
||||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override { return false; }
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
|
||||
|
@ -329,7 +329,7 @@ public:
|
|||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
|
||||
bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
|
||||
|
@ -362,7 +362,7 @@ public:
|
|||
bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||
const BOX2I GetBoundingBox() const override;
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
#include <widgets/ui_common.h>
|
||||
#include <widgets/infobar.h>
|
||||
#include <undo_redo_container.h>
|
||||
#include <eda_units.h>
|
||||
#include <units_provider.h>
|
||||
#include <origin_transforms.h>
|
||||
|
||||
// Option for main frames
|
||||
|
@ -101,7 +101,8 @@ wxDECLARE_EVENT( UNITS_CHANGED, wxCommandEvent );
|
|||
* calling it from the derived class's SaveSettings(). This class is not a #KIWAY_PLAYER
|
||||
* because #KICAD_MANAGER_FRAME is derived from it and that class is not a player.
|
||||
*/
|
||||
class EDA_BASE_FRAME : public wxFrame, public TOOLS_HOLDER, public KIWAY_HOLDER
|
||||
class EDA_BASE_FRAME : public wxFrame, public TOOLS_HOLDER, public KIWAY_HOLDER,
|
||||
public UNITS_PROVIDER
|
||||
{
|
||||
public:
|
||||
/**
|
||||
|
@ -115,25 +116,10 @@ public:
|
|||
|
||||
EDA_BASE_FRAME( wxWindow* aParent, FRAME_T aFrameType, const wxString& aTitle,
|
||||
const wxPoint& aPos, const wxSize& aSize, long aStyle,
|
||||
const wxString& aFrameName, KIWAY* aKiway );
|
||||
|
||||
EDA_BASE_FRAME( FRAME_T aFrameType, KIWAY* aKiway );
|
||||
const wxString& aFrameName, KIWAY* aKiway, const EDA_IU_SCALE& aIuScale );
|
||||
|
||||
~EDA_BASE_FRAME();
|
||||
|
||||
/**
|
||||
* Return the user units currently in use.
|
||||
*/
|
||||
EDA_UNITS GetUserUnits() const
|
||||
{
|
||||
return m_userUnits;
|
||||
}
|
||||
|
||||
void SetUserUnits( EDA_UNITS aUnits )
|
||||
{
|
||||
m_userUnits = aUnits;
|
||||
}
|
||||
|
||||
void ChangeUserUnits( EDA_UNITS aUnits );
|
||||
|
||||
virtual void ToggleUserUnits() { }
|
||||
|
|
|
@ -450,67 +450,6 @@ public:
|
|||
*/
|
||||
void ShowChangedLanguage() override;
|
||||
|
||||
const EDA_IU_SCALE& GetIuScale() const { return m_iuScale; }
|
||||
|
||||
/**
|
||||
* Converts \a aValue in internal units into a united string.
|
||||
*
|
||||
* For readability, trailing 0s are removed if the mantissa has 3 or more digits.
|
||||
* This function should be used to display values in dialogs because a value entered in mm
|
||||
* (for instance 2.0 mm) could need up to 8 digits mantissa if displayed in inch to avoid
|
||||
* truncation or rounding made just by the printf function.
|
||||
*
|
||||
* @param aValue = value in internal units
|
||||
* @param aAddUnitLabel = true to add symbol unit to the string value
|
||||
* @return A wxString object containing value and optionally the symbol unit (like 2.000 mm)
|
||||
*/
|
||||
wxString StringFromValue( double aValue, bool aAddUnitLabel = false,
|
||||
EDA_DATA_TYPE aType = EDA_DATA_TYPE::DISTANCE )
|
||||
{
|
||||
return EDA_UNIT_UTILS::UI::StringFromValue( GetIuScale(), GetUserUnits(), aValue,
|
||||
aAddUnitLabel, aType );
|
||||
}
|
||||
|
||||
wxString StringFromValue( const EDA_ANGLE& aValue, bool aAddUnitLabel = false )
|
||||
{
|
||||
return EDA_UNIT_UTILS::UI::StringFromValue( unityScale, EDA_UNITS::DEGREES,
|
||||
aValue.AsDegrees(), aAddUnitLabel,
|
||||
EDA_DATA_TYPE::DISTANCE );
|
||||
}
|
||||
|
||||
/**
|
||||
* A lower-precision version of StringFromValue().
|
||||
*
|
||||
* Should ONLY be used for status text and messages. Not suitable for dialogs, files, etc.
|
||||
* where the loss of precision matters.
|
||||
*/
|
||||
wxString MessageTextFromValue( double aValue, bool aAddUnitLabel = true,
|
||||
EDA_DATA_TYPE aType = EDA_DATA_TYPE::DISTANCE )
|
||||
{
|
||||
return EDA_UNIT_UTILS::UI::MessageTextFromValue( GetIuScale(), GetUserUnits(), aValue,
|
||||
aAddUnitLabel, aType );
|
||||
}
|
||||
|
||||
wxString MessageTextFromValue( const EDA_ANGLE& aValue, bool aAddUnitLabel = true )
|
||||
{
|
||||
return EDA_UNIT_UTILS::UI::MessageTextFromValue( unityScale, EDA_UNITS::DEGREES,
|
||||
aValue.AsDegrees() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts \a aTextValue in \a aUnits to internal units used by the frame.
|
||||
* @warning This utilizes the current locale and will break if decimal formats differ
|
||||
*
|
||||
* @param aTextValue A reference to a wxString object containing the string to convert.
|
||||
* @return internal units value
|
||||
*/
|
||||
long long int ValueFromString( const wxString& aTextValue,
|
||||
EDA_DATA_TYPE aType = EDA_DATA_TYPE::DISTANCE )
|
||||
{
|
||||
return EDA_UNIT_UTILS::UI::ValueFromString( GetIuScale(), GetUserUnits(), aTextValue,
|
||||
aType );
|
||||
}
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
protected:
|
||||
|
@ -584,7 +523,6 @@ protected:
|
|||
private:
|
||||
BASE_SCREEN* m_currentScreen; ///< current used SCREEN
|
||||
EDA_DRAW_PANEL_GAL* m_canvas;
|
||||
const EDA_IU_SCALE& m_iuScale;
|
||||
|
||||
///< This the frame's interface to setting GAL display options.
|
||||
KIGFX::GAL_DISPLAY_OPTIONS m_galDisplayOptions;
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include <eda_search_data.h>
|
||||
#include <view/view_item.h>
|
||||
#include <kiid.h>
|
||||
|
||||
#include <units_provider.h>
|
||||
|
||||
enum class BITMAPS : unsigned int;
|
||||
|
||||
|
@ -370,7 +370,7 @@ public:
|
|||
*
|
||||
* @return The menu text string.
|
||||
*/
|
||||
virtual wxString GetSelectMenuText( EDA_UNITS aUnits ) const;
|
||||
virtual wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const;
|
||||
|
||||
/**
|
||||
* Return a pointer to an image to be used in menus.
|
||||
|
|
|
@ -67,7 +67,7 @@ class KIWAY_PLAYER : public EDA_BASE_FRAME
|
|||
public:
|
||||
KIWAY_PLAYER( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
|
||||
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
|
||||
long aStyle, const wxString& aWdoName = wxFrameNameStr );
|
||||
long aStyle, const wxString& aFrameName, const EDA_IU_SCALE& aIuScale );
|
||||
|
||||
/// Don't use this one, only wxformbuilder uses it, and it must be augmented with
|
||||
/// a SetKiway() early in derived constructor.
|
||||
|
|
|
@ -180,7 +180,7 @@ public:
|
|||
void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) override;
|
||||
|
||||
///< @copydoc EDA_ITEM::GetSelectMenuText
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
|
||||
|
||||
///< @copydoc EDA_ITEM::GetMenuImage
|
||||
BITMAPS GetMenuImage() const override;
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#define RC_ITEM_H
|
||||
|
||||
#include <wx/dataview.h>
|
||||
#include <units_provider.h>
|
||||
#include <kiid.h>
|
||||
#include <reporter.h>
|
||||
#include <math/vector2d.h>
|
||||
|
@ -129,7 +130,7 @@ public:
|
|||
*
|
||||
* @return wxString - the simple multi-line report text.
|
||||
*/
|
||||
virtual wxString ShowReport( const EDA_IU_SCALE& aIuScale, EDA_UNITS aUnits, SEVERITY aSeverity,
|
||||
virtual wxString ShowReport( UNITS_PROVIDER* aUnitsProvider, SEVERITY aSeverity,
|
||||
const std::map<KIID, EDA_ITEM*>& aItemMap ) const;
|
||||
|
||||
int GetErrorCode() const { return m_errorCode; }
|
||||
|
@ -160,12 +161,6 @@ public:
|
|||
return wxEmptyString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format a coordinate or position to text.
|
||||
*/
|
||||
static wxString ShowCoord( const EDA_IU_SCALE& aIuScale, EDA_UNITS aUnits,
|
||||
const VECTOR2I& aPos );
|
||||
|
||||
protected:
|
||||
int m_errorCode; ///< The error code's numeric value
|
||||
wxString m_errorMessage; ///< A message describing the details of this specific error
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include <map>
|
||||
#include <bitmaps.h>
|
||||
#include <eda_units.h>
|
||||
#include <units_provider.h>
|
||||
#include <gal/color4d.h>
|
||||
#include <wx/translation.h>
|
||||
#include <geometry/shape.h>
|
||||
|
@ -113,7 +113,7 @@ public:
|
|||
|
||||
void Format( OUTPUTFORMATTER* out, const EDA_IU_SCALE& aIuScale, int nestLevel ) const;
|
||||
|
||||
void GetMsgPanelInfo( const EDA_IU_SCALE& aIuScale, EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList,
|
||||
void GetMsgPanelInfo( UNITS_PROVIDER* aUnitsProvider, std::vector<MSG_PANEL_ITEM>& aList,
|
||||
bool aIncludeStyle = true, bool aIncludeWidth = true );
|
||||
|
||||
// Helper functions
|
||||
|
|
|
@ -0,0 +1,108 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2022 KiCad Developers, see AUTHORS.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
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef UNITS_PROVIDER_H
|
||||
#define UNITS_PROVIDER_H
|
||||
|
||||
#include <eda_units.h>
|
||||
|
||||
class UNITS_PROVIDER
|
||||
{
|
||||
public:
|
||||
UNITS_PROVIDER( const EDA_IU_SCALE& aIuScale, EDA_UNITS aUnits ) :
|
||||
m_iuScale( aIuScale ),
|
||||
m_userUnits( aUnits )
|
||||
{}
|
||||
|
||||
EDA_UNITS GetUserUnits() const { return m_userUnits; }
|
||||
void SetUserUnits( EDA_UNITS aUnits ) { m_userUnits = aUnits; }
|
||||
|
||||
const EDA_IU_SCALE& GetIuScale() const { return m_iuScale; }
|
||||
// No SetIuScale(); scale is invariant
|
||||
|
||||
/**
|
||||
* Converts \a aValue in internal units into a united string.
|
||||
*
|
||||
* For readability, trailing 0s are removed if the mantissa has 3 or more digits.
|
||||
* This function should be used to display values in dialogs because a value entered in mm
|
||||
* (for instance 2.0 mm) could need up to 8 digits mantissa if displayed in inch to avoid
|
||||
* truncation or rounding made just by the printf function.
|
||||
*
|
||||
* @param aValue = value in internal units
|
||||
* @param aAddUnitLabel = true to add symbol unit to the string value
|
||||
* @return A wxString object containing value and optionally the symbol unit (like 2.000 mm)
|
||||
*/
|
||||
wxString StringFromValue( double aValue, bool aAddUnitLabel = false,
|
||||
EDA_DATA_TYPE aType = EDA_DATA_TYPE::DISTANCE )
|
||||
{
|
||||
return EDA_UNIT_UTILS::UI::StringFromValue( GetIuScale(), GetUserUnits(), aValue,
|
||||
aAddUnitLabel, aType );
|
||||
}
|
||||
|
||||
wxString StringFromValue( const EDA_ANGLE& aValue, bool aAddUnitLabel = false )
|
||||
{
|
||||
return EDA_UNIT_UTILS::UI::StringFromValue( unityScale, EDA_UNITS::DEGREES,
|
||||
aValue.AsDegrees(), aAddUnitLabel,
|
||||
EDA_DATA_TYPE::DISTANCE );
|
||||
}
|
||||
|
||||
/**
|
||||
* A lower-precision version of StringFromValue().
|
||||
*
|
||||
* Should ONLY be used for status text and messages. Not suitable for dialogs, files, etc.
|
||||
* where the loss of precision matters.
|
||||
*/
|
||||
wxString MessageTextFromValue( double aValue, bool aAddUnitLabel = true,
|
||||
EDA_DATA_TYPE aType = EDA_DATA_TYPE::DISTANCE )
|
||||
{
|
||||
return EDA_UNIT_UTILS::UI::MessageTextFromValue( GetIuScale(), GetUserUnits(), aValue,
|
||||
aAddUnitLabel, aType );
|
||||
}
|
||||
|
||||
wxString MessageTextFromValue( const EDA_ANGLE& aValue, bool aAddUnitLabel = true )
|
||||
{
|
||||
return EDA_UNIT_UTILS::UI::MessageTextFromValue( unityScale, EDA_UNITS::DEGREES,
|
||||
aValue.AsDegrees(), aAddUnitLabel,
|
||||
EDA_DATA_TYPE::DISTANCE );
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts \a aTextValue in \a aUnits to internal units used by the frame.
|
||||
* @warning This utilizes the current locale and will break if decimal formats differ
|
||||
*
|
||||
* @param aTextValue A reference to a wxString object containing the string to convert.
|
||||
* @return internal units value
|
||||
*/
|
||||
long long int ValueFromString( const wxString& aTextValue,
|
||||
EDA_DATA_TYPE aType = EDA_DATA_TYPE::DISTANCE )
|
||||
{
|
||||
return EDA_UNIT_UTILS::UI::ValueFromString( GetIuScale(), GetUserUnits(), aTextValue,
|
||||
aType );
|
||||
}
|
||||
|
||||
private:
|
||||
const EDA_IU_SCALE& m_iuScale;
|
||||
EDA_UNITS m_userUnits;
|
||||
};
|
||||
|
||||
#endif // UNITS_PROVIDER_H
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2013 CERN (www.cern.ch)
|
||||
* Copyright (C) 2004-2021 KiCad Developers, see change_log.txt for contributors.
|
||||
* Copyright (C) 2004-2022 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
|
||||
|
@ -111,8 +111,8 @@ END_EVENT_TABLE()
|
|||
|
||||
KICAD_MANAGER_FRAME::KICAD_MANAGER_FRAME( wxWindow* parent, const wxString& title,
|
||||
const wxPoint& pos, const wxSize& size ) :
|
||||
EDA_BASE_FRAME( parent, KICAD_MAIN_FRAME_T, title, pos, size,
|
||||
KICAD_DEFAULT_DRAWFRAME_STYLE, KICAD_MANAGER_FRAME_NAME, &::Kiway ),
|
||||
EDA_BASE_FRAME( parent, KICAD_MAIN_FRAME_T, title, pos, size, KICAD_DEFAULT_DRAWFRAME_STYLE,
|
||||
KICAD_MANAGER_FRAME_NAME, &::Kiway, unityScale ),
|
||||
m_leftWin( nullptr ),
|
||||
m_launcher( nullptr ),
|
||||
m_mainToolBar( nullptr )
|
||||
|
|
|
@ -868,7 +868,7 @@ void BOARD::Remove( BOARD_ITEM* aBoardItem, REMOVE_MODE aRemoveMode )
|
|||
}
|
||||
|
||||
|
||||
wxString BOARD::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
wxString BOARD::GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
return wxString::Format( _( "PCB" ) );
|
||||
}
|
||||
|
|
|
@ -625,7 +625,7 @@ public:
|
|||
const TITLE_BLOCK& GetTitleBlock() const { return m_titles; }
|
||||
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) { m_titles = aTitleBlock; }
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
|
||||
|
||||
/**
|
||||
* Extract the board outlines and build a closed polygon from lines, arcs and circle items
|
||||
|
|
|
@ -1025,8 +1025,8 @@ bool DIALOG_DRC::writeReport( const wxString& aFullFileName )
|
|||
std::map<KIID, EDA_ITEM*> itemMap;
|
||||
m_frame->GetBoard()->FillItemMap( itemMap );
|
||||
|
||||
EDA_UNITS units = GetUserUnits();
|
||||
BOARD_DESIGN_SETTINGS& bds = m_frame->GetBoard()->GetDesignSettings();
|
||||
UNITS_PROVIDER unitsProvider( pcbIUScale, GetUserUnits() );
|
||||
int count;
|
||||
|
||||
fprintf( fp, "** Drc report for %s **\n", TO_UTF8( m_frame->GetBoard()->GetFileName() ) );
|
||||
|
@ -1047,7 +1047,7 @@ bool DIALOG_DRC::writeReport( const wxString& aFullFileName )
|
|||
if( severity == RPT_SEVERITY_EXCLUSION )
|
||||
severity = bds.GetSeverity( item->GetErrorCode() );
|
||||
|
||||
fprintf( fp, "%s", TO_UTF8( item->ShowReport( pcbIUScale, units, severity, itemMap ) ) );
|
||||
fprintf( fp, "%s", TO_UTF8( item->ShowReport( &unitsProvider, severity, itemMap ) ) );
|
||||
}
|
||||
|
||||
count = m_ratsnestProvider->GetCount();
|
||||
|
@ -1059,7 +1059,7 @@ bool DIALOG_DRC::writeReport( const wxString& aFullFileName )
|
|||
const std::shared_ptr<RC_ITEM>& item = m_ratsnestProvider->GetItem( i );
|
||||
SEVERITY severity = bds.GetSeverity( item->GetErrorCode() );
|
||||
|
||||
fprintf( fp, "%s", TO_UTF8( item->ShowReport( pcbIUScale, units, severity, itemMap ) ) );
|
||||
fprintf( fp, "%s", TO_UTF8( item->ShowReport( &unitsProvider, severity, itemMap ) ) );
|
||||
}
|
||||
|
||||
count = m_fpWarningsProvider->GetCount();
|
||||
|
@ -1071,7 +1071,7 @@ bool DIALOG_DRC::writeReport( const wxString& aFullFileName )
|
|||
const std::shared_ptr<RC_ITEM>& item = m_fpWarningsProvider->GetItem( i );
|
||||
SEVERITY severity = bds.GetSeverity( item->GetErrorCode() );
|
||||
|
||||
fprintf( fp, "%s", TO_UTF8( item->ShowReport( pcbIUScale, units, severity, itemMap ) ) );
|
||||
fprintf( fp, "%s", TO_UTF8( item->ShowReport( &unitsProvider, severity, itemMap ) ) );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ DIALOG_GROUP_PROPERTIES::DIALOG_GROUP_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent,
|
|||
m_locked->Show( dynamic_cast<PCB_EDIT_FRAME*>( aParent ) != nullptr );
|
||||
|
||||
for( BOARD_ITEM* item : m_group->GetItems() )
|
||||
m_membersList->Append( item->GetSelectMenuText( m_brdEditor->GetUserUnits() ), item );
|
||||
m_membersList->Append( item->GetSelectMenuText( m_brdEditor ), item );
|
||||
|
||||
SetupStandardButtons();
|
||||
|
||||
|
@ -155,7 +155,7 @@ void DIALOG_GROUP_PROPERTIES::DoAddMember( EDA_ITEM* aItem )
|
|||
if( aItem == m_group )
|
||||
return;
|
||||
|
||||
m_membersList->Append( aItem->GetSelectMenuText( m_brdEditor->GetUserUnits() ), aItem );
|
||||
m_membersList->Append( aItem->GetSelectMenuText( m_brdEditor ), aItem );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -243,13 +243,14 @@ void DIALOG_POSITION_RELATIVE::OnUseUserOriginClick( wxCommandEvent& event )
|
|||
|
||||
void DIALOG_POSITION_RELATIVE::UpdateAnchor( EDA_ITEM* aItem )
|
||||
{
|
||||
wxString reference = _( "<none selected>" );
|
||||
BOARD_ITEM* item = dynamic_cast<BOARD_ITEM*>( aItem );
|
||||
UNITS_PROVIDER unitsProvider( pcbIUScale, GetUserUnits() );
|
||||
BOARD_ITEM* item = dynamic_cast<BOARD_ITEM*>( aItem );
|
||||
wxString reference = _( "<none selected>" );
|
||||
|
||||
if( item )
|
||||
{
|
||||
m_anchor_position = item->GetPosition();
|
||||
reference = item->GetSelectMenuText( GetUserUnits() );
|
||||
reference = item->GetSelectMenuText( &unitsProvider );
|
||||
}
|
||||
|
||||
m_referenceInfo->SetLabel( wxString::Format( _( "Reference item: %s" ), reference ) );
|
||||
|
|
|
@ -64,12 +64,12 @@ void drcPrintDebugMessage( int level, const wxString& msg, const char *function,
|
|||
|
||||
|
||||
DRC_ENGINE::DRC_ENGINE( BOARD* aBoard, BOARD_DESIGN_SETTINGS *aSettings ) :
|
||||
UNITS_PROVIDER( pcbIUScale, EDA_UNITS::MILLIMETRES ),
|
||||
m_designSettings ( aSettings ),
|
||||
m_board( aBoard ),
|
||||
m_drawingSheet( nullptr ),
|
||||
m_schematicNetlist( nullptr ),
|
||||
m_rulesValid( false ),
|
||||
m_userUnits( EDA_UNITS::MILLIMETRES ),
|
||||
m_reportAllTrackErrors( false ),
|
||||
m_testFootprints( false ),
|
||||
m_reporter( nullptr ),
|
||||
|
@ -564,7 +564,7 @@ void DRC_ENGINE::InitEngine( const wxFileName& aRulePath )
|
|||
|
||||
void DRC_ENGINE::RunTests( EDA_UNITS aUnits, bool aReportAllTrackErrors, bool aTestFootprints )
|
||||
{
|
||||
m_userUnits = aUnits;
|
||||
SetUserUnits( aUnits );
|
||||
|
||||
m_reportAllTrackErrors = aReportAllTrackErrors;
|
||||
m_testFootprints = aTestFootprints;
|
||||
|
@ -595,7 +595,7 @@ void DRC_ENGINE::RunTests( EDA_UNITS aUnits, bool aReportAllTrackErrors, bool aT
|
|||
{
|
||||
ReportAux( wxString::Format( wxT( "Run DRC provider: '%s'" ), provider->GetName() ) );
|
||||
|
||||
if( !provider->Run() )
|
||||
if( !provider->RunTests( aUnits ) )
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -606,10 +606,6 @@ void DRC_ENGINE::RunTests( EDA_UNITS aUnits, bool aReportAllTrackErrors, bool aT
|
|||
|
||||
|
||||
#define REPORT( s ) { if( aReporter ) { aReporter->Report( s ); } }
|
||||
#define UNITS aReporter ? aReporter->GetUnits() : EDA_UNITS::MILLIMETRES
|
||||
#define REPORT_VALUE( v ) EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, UNITS, v )
|
||||
#define REPORT_UNSCALED_VALUE( v ) \
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( unityScale, EDA_UNITS::UNSCALED, v )
|
||||
|
||||
DRC_CONSTRAINT DRC_ENGINE::EvalZoneConnection( const BOARD_ITEM* a, const BOARD_ITEM* b,
|
||||
PCB_LAYER_ID aLayer, REPORTER* aReporter )
|
||||
|
@ -735,8 +731,8 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO
|
|||
{
|
||||
REPORT( "" )
|
||||
REPORT( wxString::Format( _( "Local override on %s; clearance: %s." ),
|
||||
EscapeHTML( a->GetSelectMenuText( UNITS ) ),
|
||||
REPORT_VALUE( overrideA ) ) )
|
||||
EscapeHTML( a->GetSelectMenuText( this ) ),
|
||||
MessageTextFromValue( overrideA ) ) )
|
||||
|
||||
override_val = ac->GetLocalClearanceOverrides( &msg );
|
||||
}
|
||||
|
@ -745,8 +741,8 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO
|
|||
{
|
||||
REPORT( "" )
|
||||
REPORT( wxString::Format( _( "Local override on %s; clearance: %s." ),
|
||||
EscapeHTML( b->GetSelectMenuText( UNITS ) ),
|
||||
EscapeHTML( REPORT_VALUE( overrideB ) ) ) )
|
||||
EscapeHTML( b->GetSelectMenuText( this ) ),
|
||||
EscapeHTML( MessageTextFromValue( overrideB ) ) ) )
|
||||
|
||||
if( overrideB > override_val )
|
||||
override_val = bc->GetLocalClearanceOverrides( &msg );
|
||||
|
@ -763,7 +759,7 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO
|
|||
|
||||
REPORT( "" )
|
||||
REPORT( wxString::Format( _( "Board minimum clearance: %s." ),
|
||||
REPORT_VALUE( override_val ) ) )
|
||||
MessageTextFromValue( override_val ) ) )
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -775,7 +771,7 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO
|
|||
|
||||
REPORT( "" )
|
||||
REPORT( wxString::Format( _( "Board minimum hole clearance: %s." ),
|
||||
REPORT_VALUE( override_val ) ) )
|
||||
MessageTextFromValue( override_val ) ) )
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -794,7 +790,7 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO
|
|||
|
||||
REPORT( "" )
|
||||
REPORT( wxString::Format( _( "Local override on %s; zone connection: %s." ),
|
||||
EscapeHTML( pad->GetSelectMenuText( UNITS ) ),
|
||||
EscapeHTML( pad->GetSelectMenuText( this ) ),
|
||||
EscapeHTML( PrintZoneConnection( override ) ) ) )
|
||||
|
||||
constraint.SetName( msg );
|
||||
|
@ -811,8 +807,8 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO
|
|||
|
||||
REPORT( "" )
|
||||
REPORT( wxString::Format( _( "Local override on %s; thermal relief gap: %s." ),
|
||||
EscapeHTML( pad->GetSelectMenuText( UNITS ) ),
|
||||
EscapeHTML( REPORT_VALUE( gap_override ) ) ) )
|
||||
EscapeHTML( pad->GetSelectMenuText( this ) ),
|
||||
EscapeHTML( MessageTextFromValue( gap_override ) ) ) )
|
||||
|
||||
constraint.SetName( msg );
|
||||
constraint.m_Value.SetMin( gap_override );
|
||||
|
@ -828,8 +824,8 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO
|
|||
|
||||
REPORT( "" )
|
||||
REPORT( wxString::Format( _( "Local override on %s; thermal spoke width: %s." ),
|
||||
EscapeHTML( pad->GetSelectMenuText( UNITS ) ),
|
||||
EscapeHTML( REPORT_VALUE( spoke_override ) ) ) )
|
||||
EscapeHTML( pad->GetSelectMenuText( this ) ),
|
||||
EscapeHTML( MessageTextFromValue( spoke_override ) ) ) )
|
||||
|
||||
if( zone && zone->GetMinThickness() > spoke_override )
|
||||
{
|
||||
|
@ -837,8 +833,8 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO
|
|||
|
||||
REPORT( "" )
|
||||
REPORT( wxString::Format( _( "%s min thickness: %s." ),
|
||||
EscapeHTML( zone->GetSelectMenuText( UNITS ) ),
|
||||
EscapeHTML( REPORT_VALUE( spoke_override ) ) ) )
|
||||
EscapeHTML( zone->GetSelectMenuText( this ) ),
|
||||
EscapeHTML( MessageTextFromValue( spoke_override ) ) ) )
|
||||
}
|
||||
|
||||
constraint.SetName( msg );
|
||||
|
@ -882,37 +878,38 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO
|
|||
case PHYSICAL_HOLE_CLEARANCE_CONSTRAINT:
|
||||
REPORT( wxString::Format( _( "Checking %s clearance: %s." ),
|
||||
EscapeHTML( c->constraint.GetName() ),
|
||||
REPORT_VALUE( c->constraint.m_Value.Min() ) ) )
|
||||
MessageTextFromValue( c->constraint.m_Value.Min() ) ) )
|
||||
break;
|
||||
|
||||
case DIFF_PAIR_MAX_UNCOUPLED_CONSTRAINT:
|
||||
REPORT( wxString::Format( _( "Checking %s max uncoupled length: %s." ),
|
||||
EscapeHTML( c->constraint.GetName() ),
|
||||
REPORT_VALUE( c->constraint.m_Value.Max() ) ) )
|
||||
MessageTextFromValue( c->constraint.m_Value.Max() ) ) )
|
||||
break;
|
||||
|
||||
case SKEW_CONSTRAINT:
|
||||
REPORT( wxString::Format( _( "Checking %s max skew: %s." ),
|
||||
EscapeHTML( c->constraint.GetName() ),
|
||||
REPORT_VALUE( c->constraint.m_Value.Max() ) ) )
|
||||
MessageTextFromValue( c->constraint.m_Value.Max() ) ) )
|
||||
break;
|
||||
|
||||
case THERMAL_RELIEF_GAP_CONSTRAINT:
|
||||
REPORT( wxString::Format( _( "Checking %s gap: %s." ),
|
||||
EscapeHTML( c->constraint.GetName() ),
|
||||
REPORT_VALUE( c->constraint.m_Value.Min() ) ) )
|
||||
MessageTextFromValue( c->constraint.m_Value.Min() ) ) )
|
||||
break;
|
||||
|
||||
case THERMAL_SPOKE_WIDTH_CONSTRAINT:
|
||||
REPORT( wxString::Format( _( "Checking %s thermal spoke width: %s." ),
|
||||
EscapeHTML( c->constraint.GetName() ),
|
||||
REPORT_VALUE( c->constraint.m_Value.Opt() ) ) )
|
||||
MessageTextFromValue( c->constraint.m_Value.Opt() ) ) )
|
||||
break;
|
||||
|
||||
case MIN_RESOLVED_SPOKES_CONSTRAINT:
|
||||
REPORT( wxString::Format( _( "Checking %s min spoke count: %s." ),
|
||||
EscapeHTML( c->constraint.GetName() ),
|
||||
REPORT_UNSCALED_VALUE( c->constraint.m_Value.Min() ) ) )
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( unityScale, EDA_UNITS::UNSCALED,
|
||||
c->constraint.m_Value.Min() ) ) )
|
||||
break;
|
||||
|
||||
case ZONE_CONNECTION_CONSTRAINT:
|
||||
|
@ -940,8 +937,8 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO
|
|||
|
||||
if( implicit )
|
||||
{
|
||||
min = REPORT_VALUE( c->constraint.m_Value.Min() );
|
||||
opt = REPORT_VALUE( c->constraint.m_Value.Opt() );
|
||||
min = MessageTextFromValue( c->constraint.m_Value.Min() );
|
||||
opt = MessageTextFromValue( c->constraint.m_Value.Opt() );
|
||||
|
||||
switch( c->constraint.m_Type )
|
||||
{
|
||||
|
@ -1037,13 +1034,13 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO
|
|||
else
|
||||
{
|
||||
if( c->constraint.m_Value.HasMin() )
|
||||
min = REPORT_VALUE( c->constraint.m_Value.Min() );
|
||||
min = MessageTextFromValue( c->constraint.m_Value.Min() );
|
||||
|
||||
if( c->constraint.m_Value.HasOpt() )
|
||||
opt = REPORT_VALUE( c->constraint.m_Value.Opt() );
|
||||
opt = MessageTextFromValue( c->constraint.m_Value.Opt() );
|
||||
|
||||
if( c->constraint.m_Value.HasMax() )
|
||||
max = REPORT_VALUE( c->constraint.m_Value.Max() );
|
||||
max = MessageTextFromValue( c->constraint.m_Value.Max() );
|
||||
|
||||
REPORT( wxString::Format( _( "Checking %s: min %s; opt %s; max %s." ),
|
||||
EscapeHTML( c->constraint.GetName() ),
|
||||
|
@ -1181,7 +1178,7 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO
|
|||
const BOARD_ITEM* x = !hasDrilledHole( a ) ? a : b;
|
||||
|
||||
REPORT( wxString::Format( _( "%s is not a drilled hole; rule ignored." ),
|
||||
x->GetSelectMenuText( UNITS ) ) )
|
||||
x->GetSelectMenuText( this ) ) )
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -1319,8 +1316,8 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO
|
|||
{
|
||||
REPORT( "" )
|
||||
REPORT( wxString::Format( _( "Local clearance on %s; clearance: %s." ),
|
||||
EscapeHTML( a->GetSelectMenuText( UNITS ) ),
|
||||
REPORT_VALUE( localA ) ) )
|
||||
EscapeHTML( a->GetSelectMenuText( this ) ),
|
||||
MessageTextFromValue( localA ) ) )
|
||||
|
||||
if( localA > clearance )
|
||||
{
|
||||
|
@ -1336,8 +1333,8 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO
|
|||
{
|
||||
REPORT( "" )
|
||||
REPORT( wxString::Format( _( "Local clearance on %s; clearance: %s." ),
|
||||
EscapeHTML( b->GetSelectMenuText( UNITS ) ),
|
||||
REPORT_VALUE( localB ) ) )
|
||||
EscapeHTML( b->GetSelectMenuText( this ) ),
|
||||
MessageTextFromValue( localB ) ) )
|
||||
|
||||
if( localB > clearance )
|
||||
{
|
||||
|
@ -1351,7 +1348,7 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO
|
|||
|
||||
REPORT( "" )
|
||||
REPORT( wxString::Format( _( "Board minimum clearance: %s." ),
|
||||
REPORT_VALUE( m_designSettings->m_MinClearance ) ) )
|
||||
MessageTextFromValue( m_designSettings->m_MinClearance ) ) )
|
||||
|
||||
if( clearance < m_designSettings->m_MinClearance )
|
||||
{
|
||||
|
@ -1366,7 +1363,7 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO
|
|||
{
|
||||
REPORT( "" )
|
||||
REPORT( wxString::Format( _( "Board minimum clearance: %s." ),
|
||||
REPORT_VALUE( m_designSettings->m_MinClearance ) ) )
|
||||
MessageTextFromValue( m_designSettings->m_MinClearance ) ) )
|
||||
|
||||
if( constraint.m_Value.Min() < m_designSettings->m_MinClearance )
|
||||
{
|
||||
|
@ -1387,7 +1384,7 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO
|
|||
{
|
||||
REPORT( "" )
|
||||
REPORT( wxString::Format( _( "%s zone connection: %s." ),
|
||||
EscapeHTML( parentFootprint->GetSelectMenuText( UNITS ) ),
|
||||
EscapeHTML( parentFootprint->GetSelectMenuText( this ) ),
|
||||
EscapeHTML( PrintZoneConnection( local ) ) ) )
|
||||
|
||||
constraint.SetParentRule( nullptr );
|
||||
|
@ -1403,7 +1400,7 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO
|
|||
|
||||
REPORT( "" )
|
||||
REPORT( wxString::Format( _( "%s pad connection: %s." ),
|
||||
EscapeHTML( zone->GetSelectMenuText( UNITS ) ),
|
||||
EscapeHTML( zone->GetSelectMenuText( this ) ),
|
||||
EscapeHTML( PrintZoneConnection( local ) ) ) )
|
||||
|
||||
constraint.SetParentRule( nullptr );
|
||||
|
@ -1420,8 +1417,8 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO
|
|||
|
||||
REPORT( "" )
|
||||
REPORT( wxString::Format( _( "%s thermal relief gap: %s." ),
|
||||
EscapeHTML( zone->GetSelectMenuText( UNITS ) ),
|
||||
EscapeHTML( REPORT_VALUE( local ) ) ) )
|
||||
EscapeHTML( zone->GetSelectMenuText( this ) ),
|
||||
EscapeHTML( MessageTextFromValue( local ) ) ) )
|
||||
|
||||
constraint.SetParentRule( nullptr );
|
||||
constraint.SetName( _( "zone" ) );
|
||||
|
@ -1437,8 +1434,8 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO
|
|||
|
||||
REPORT( "" )
|
||||
REPORT( wxString::Format( _( "%s thermal spoke width: %s." ),
|
||||
EscapeHTML( zone->GetSelectMenuText( UNITS ) ),
|
||||
EscapeHTML( REPORT_VALUE( local ) ) ) )
|
||||
EscapeHTML( zone->GetSelectMenuText( this ) ),
|
||||
EscapeHTML( MessageTextFromValue( local ) ) ) )
|
||||
|
||||
constraint.SetParentRule( nullptr );
|
||||
constraint.SetName( _( "zone" ) );
|
||||
|
@ -1530,8 +1527,6 @@ void DRC_ENGINE::ProcessAssertions( const BOARD_ITEM* a,
|
|||
|
||||
|
||||
#undef REPORT
|
||||
#undef UNITS
|
||||
#undef REPORT_VALUE
|
||||
|
||||
|
||||
bool DRC_ENGINE::IsErrorLimitExceeded( int error_code )
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include <vector>
|
||||
#include <unordered_map>
|
||||
|
||||
#include <eda_units.h>
|
||||
#include <units_provider.h>
|
||||
#include <geometry/shape.h>
|
||||
|
||||
#include <drc/drc_rule.h>
|
||||
|
@ -79,7 +79,7 @@ typedef std::function<void( const std::shared_ptr<DRC_ITEM>& aItem,
|
|||
* Note that EvalRules() has yet another optional REPORTER for reporting resolution info to
|
||||
* the user.
|
||||
*/
|
||||
class DRC_ENGINE
|
||||
class DRC_ENGINE : public UNITS_PROVIDER
|
||||
{
|
||||
public:
|
||||
DRC_ENGINE( BOARD* aBoard = nullptr, BOARD_DESIGN_SETTINGS* aSettings = nullptr );
|
||||
|
@ -159,7 +159,6 @@ public:
|
|||
|
||||
bool HasRulesForConstraintType( DRC_CONSTRAINT_T constraintID );
|
||||
|
||||
EDA_UNITS UserUnits() const { return m_userUnits; }
|
||||
bool GetReportAllTrackErrors() const { return m_reportAllTrackErrors; }
|
||||
bool GetTestFootprints() const { return m_testFootprints; }
|
||||
|
||||
|
@ -238,7 +237,6 @@ protected:
|
|||
bool m_rulesValid;
|
||||
std::vector<DRC_TEST_PROVIDER*> m_testProviders;
|
||||
|
||||
EDA_UNITS m_userUnits;
|
||||
std::vector<int> m_errorLimits;
|
||||
bool m_reportAllTrackErrors;
|
||||
bool m_testFootprints;
|
||||
|
|
|
@ -44,7 +44,8 @@ DRC_TEST_PROVIDER_REGISTRY::~DRC_TEST_PROVIDER_REGISTRY()
|
|||
|
||||
|
||||
DRC_TEST_PROVIDER::DRC_TEST_PROVIDER() :
|
||||
m_drcEngine( nullptr )
|
||||
UNITS_PROVIDER( pcbIUScale, EDA_UNITS::MILLIMETRES ),
|
||||
m_drcEngine( nullptr )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -112,12 +113,6 @@ void DRC_TEST_PROVIDER::reportAux( wxString fmt, ... )
|
|||
}
|
||||
|
||||
|
||||
EDA_UNITS DRC_TEST_PROVIDER::userUnits() const
|
||||
{
|
||||
return m_drcEngine->UserUnits();
|
||||
}
|
||||
|
||||
|
||||
void DRC_TEST_PROVIDER::accountCheck( const DRC_RULE* ruleToTest )
|
||||
{
|
||||
auto it = m_stats.find( ruleToTest );
|
||||
|
|
|
@ -69,10 +69,10 @@ public:
|
|||
* Represent a DRC "provider" which runs some DRC functions over a #BOARD and spits out
|
||||
* #DRC_ITEMs and positions as needed.
|
||||
*/
|
||||
class DRC_TEST_PROVIDER
|
||||
class DRC_TEST_PROVIDER : public UNITS_PROVIDER
|
||||
{
|
||||
public:
|
||||
DRC_TEST_PROVIDER ();
|
||||
DRC_TEST_PROVIDER();
|
||||
virtual ~DRC_TEST_PROVIDER() = default;
|
||||
|
||||
static void Init();
|
||||
|
@ -83,6 +83,12 @@ public:
|
|||
m_stats.clear();
|
||||
}
|
||||
|
||||
bool RunTests( EDA_UNITS aUnits )
|
||||
{
|
||||
SetUserUnits( aUnits );
|
||||
return Run();
|
||||
}
|
||||
|
||||
/**
|
||||
* Run this provider against the given PCB with configured options (if any).
|
||||
*/
|
||||
|
|
|
@ -247,16 +247,16 @@ bool DRC_TEST_PROVIDER_ANNULAR_WIDTH::Run()
|
|||
{
|
||||
msg.Printf( _( "(%s min annular width %s; actual %s)" ),
|
||||
constraint.GetName(),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), v_min ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), annularWidth ) );
|
||||
MessageTextFromValue( v_min ),
|
||||
MessageTextFromValue( annularWidth ) );
|
||||
}
|
||||
|
||||
if( fail_max )
|
||||
{
|
||||
msg.Printf( _( "(%s max annular width %s; actual %s)" ),
|
||||
constraint.GetName(),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), v_max ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), annularWidth ) );
|
||||
MessageTextFromValue( v_max ),
|
||||
MessageTextFromValue( annularWidth ) );
|
||||
}
|
||||
|
||||
drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( " " ) + msg );
|
||||
|
|
|
@ -757,8 +757,8 @@ bool DRC_TEST_PROVIDER_CONNECTION_WIDTH::Run()
|
|||
wxString msg;
|
||||
|
||||
msg.Printf( _( "Minimum connection width %s; actual %s" ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), aMinWidth ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), dist ) );
|
||||
MessageTextFromValue( aMinWidth ),
|
||||
MessageTextFromValue( dist ) );
|
||||
|
||||
drce->SetErrorMessage( msg + wxS( " " ) + layerDesc( aLayer ) );
|
||||
drce->SetViolatingRule( c.GetParentRule() );
|
||||
|
|
|
@ -222,8 +222,8 @@ bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackAgainstItem( PCB_TRACK* track,
|
|||
|
||||
msg.Printf( _( "(%s clearance %s; actual %s)" ),
|
||||
constraint.GetName(),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), clearance ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), actual ) );
|
||||
MessageTextFromValue( clearance ),
|
||||
MessageTextFromValue( actual ) );
|
||||
|
||||
drce->SetErrorMessage( drce->GetErrorText() + wxS( " " ) + msg );
|
||||
drce->SetItems( track, other );
|
||||
|
@ -266,8 +266,8 @@ bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackAgainstItem( PCB_TRACK* track,
|
|||
|
||||
msg.Printf( _( "(%s clearance %s; actual %s)" ),
|
||||
constraint.GetName(),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), clearance ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), actual ) );
|
||||
MessageTextFromValue( clearance ),
|
||||
MessageTextFromValue( actual ) );
|
||||
|
||||
drce->SetErrorMessage( drce->GetErrorText() + wxS( " " ) + msg );
|
||||
drce->SetItems( track, other );
|
||||
|
@ -350,8 +350,8 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZone( BOARD_ITEM* aItem,
|
|||
|
||||
msg.Printf( _( "(%s clearance %s; actual %s)" ),
|
||||
constraint.GetName(),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), clearance ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), actual ) );
|
||||
MessageTextFromValue( clearance ),
|
||||
MessageTextFromValue( actual ) );
|
||||
|
||||
drce->SetErrorMessage( drce->GetErrorText() + wxS( " " ) + msg );
|
||||
drce->SetItems( aItem, aZone );
|
||||
|
@ -391,8 +391,8 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZone( BOARD_ITEM* aItem,
|
|||
|
||||
msg.Printf( _( "(%s clearance %s; actual %s)" ),
|
||||
constraint.GetName(),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), clearance ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), actual ) );
|
||||
MessageTextFromValue( clearance ),
|
||||
MessageTextFromValue( actual ) );
|
||||
|
||||
drce->SetErrorMessage( drce->GetErrorText() + wxS( " " ) + msg );
|
||||
drce->SetItems( aItem, aZone );
|
||||
|
@ -603,8 +603,8 @@ bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem( PAD* pad, SHAPE* pa
|
|||
|
||||
msg.Printf( _( "(%s clearance %s; actual %s)" ),
|
||||
constraint.GetName(),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), clearance ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), actual ) );
|
||||
MessageTextFromValue( clearance ),
|
||||
MessageTextFromValue( actual ) );
|
||||
|
||||
drce->SetErrorMessage( drce->GetErrorText() + wxS( " " ) + msg );
|
||||
drce->SetItems( pad, other );
|
||||
|
@ -636,8 +636,8 @@ bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem( PAD* pad, SHAPE* pa
|
|||
|
||||
msg.Printf( _( "(%s clearance %s; actual %s)" ),
|
||||
constraint.GetName(),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), clearance ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), actual ) );
|
||||
MessageTextFromValue( clearance ),
|
||||
MessageTextFromValue( actual ) );
|
||||
|
||||
drce->SetErrorMessage( drce->GetErrorText() + wxS( " " ) + msg );
|
||||
drce->SetItems( pad, other );
|
||||
|
@ -659,8 +659,8 @@ bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem( PAD* pad, SHAPE* pa
|
|||
|
||||
msg.Printf( _( "(%s clearance %s; actual %s)" ),
|
||||
constraint.GetName(),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), clearance ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), actual ) );
|
||||
MessageTextFromValue( clearance ),
|
||||
MessageTextFromValue( actual ) );
|
||||
|
||||
drce->SetErrorMessage( drce->GetErrorText() + wxS( " " ) + msg );
|
||||
drce->SetItems( pad, other );
|
||||
|
@ -682,8 +682,8 @@ bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem( PAD* pad, SHAPE* pa
|
|||
|
||||
msg.Printf( _( "(%s clearance %s; actual %s)" ),
|
||||
constraint.GetName(),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), clearance ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), actual ) );
|
||||
MessageTextFromValue( clearance ),
|
||||
MessageTextFromValue( actual ) );
|
||||
|
||||
drce->SetErrorMessage( drce->GetErrorText() + wxS( " " ) + msg );
|
||||
drce->SetItems( pad, otherVia );
|
||||
|
@ -935,8 +935,8 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZonesToZones()
|
|||
|
||||
msg.Printf( _( "(%s clearance %s; actual %s)" ),
|
||||
constraint.GetName(),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), zone2zoneClearance ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), std::max( actual, 0 ) ) );
|
||||
MessageTextFromValue( zone2zoneClearance ),
|
||||
MessageTextFromValue( std::max( actual, 0 ) ) );
|
||||
|
||||
drce->SetErrorMessage( drce->GetErrorText() + wxS( " " ) + msg );
|
||||
}
|
||||
|
|
|
@ -232,8 +232,8 @@ bool DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::testCourtyardClearances()
|
|||
wxString msg;
|
||||
msg.Printf( _( "(%s clearance %s; actual %s)" ),
|
||||
constraint.GetName(),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), clearance ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), actual ) );
|
||||
MessageTextFromValue( clearance ),
|
||||
MessageTextFromValue( actual ) );
|
||||
|
||||
drce->SetErrorMessage( drce->GetErrorText() + wxS( " " ) + msg );
|
||||
drce->SetViolatingRule( constraint.GetParentRule() );
|
||||
|
@ -266,8 +266,8 @@ bool DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::testCourtyardClearances()
|
|||
wxString msg;
|
||||
msg.Printf( _( "(%s clearance %s; actual %s)" ),
|
||||
constraint.GetName(),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), clearance ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), actual ) );
|
||||
MessageTextFromValue( clearance ),
|
||||
MessageTextFromValue( actual ) );
|
||||
|
||||
drce->SetErrorMessage( drce->GetErrorText() + wxS( " " ) + msg );
|
||||
drce->SetViolatingRule( constraint.GetParentRule() );
|
||||
|
|
|
@ -420,8 +420,8 @@ bool test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run()
|
|||
|
||||
int totalLen = std::max( itemSet.totalLengthN, itemSet.totalLengthP );
|
||||
reportAux( wxString::Format( wxT( " - coupled length: %s, total length: %s" ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), itemSet.totalCoupled ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), totalLen ) ) );
|
||||
MessageTextFromValue( itemSet.totalCoupled ),
|
||||
MessageTextFromValue( totalLen ) ) );
|
||||
|
||||
int totalUncoupled = totalLen - itemSet.totalCoupled;
|
||||
|
||||
|
@ -438,8 +438,8 @@ bool test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run()
|
|||
|
||||
msg = wxString::Format( _( "(%s maximum uncoupled length: %s; actual: %s)" ),
|
||||
maxUncoupledConstraint->GetParentRule()->m_Name,
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), val.Max() ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), totalUncoupled ) );
|
||||
MessageTextFromValue( val.Max() ),
|
||||
MessageTextFromValue( totalUncoupled ) );
|
||||
|
||||
drce->SetErrorMessage( drce->GetErrorText() + wxS( " " ) + msg );
|
||||
|
||||
|
@ -490,14 +490,14 @@ bool test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run()
|
|||
|
||||
if( val.HasMin() )
|
||||
msg += wxString::Format( _( "minimum gap: %s; " ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), val.Min() ) );
|
||||
MessageTextFromValue( val.Min() ) );
|
||||
|
||||
if( val.HasMax() )
|
||||
msg += wxString::Format( _( "maximum gap: %s; " ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), val.Max() ) );
|
||||
MessageTextFromValue( val.Max() ) );
|
||||
|
||||
msg += wxString::Format( _( "actual: %s)" ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), dp.computedGap ) );
|
||||
MessageTextFromValue( dp.computedGap ) );
|
||||
|
||||
drcItem->SetErrorMessage( msg );
|
||||
|
||||
|
|
|
@ -121,8 +121,8 @@ bool DRC_TEST_PROVIDER_EDGE_CLEARANCE::testAgainstEdge( BOARD_ITEM* item, SHAPE*
|
|||
|
||||
msg.Printf( _( "(%s clearance %s; actual %s)" ),
|
||||
constraint.GetName(),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), minClearance ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), actual ) );
|
||||
MessageTextFromValue( minClearance ),
|
||||
MessageTextFromValue( actual ) );
|
||||
|
||||
drce->SetErrorMessage( drce->GetErrorText() + wxS( " " ) + msg );
|
||||
}
|
||||
|
|
|
@ -157,15 +157,15 @@ void DRC_TEST_PROVIDER_HOLE_SIZE::checkPadHole( PAD* aPad )
|
|||
{
|
||||
msg.Printf( _( "(%s min width %s; actual %s)" ),
|
||||
constraint.GetName(),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), constraintValue ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), holeMinor ) );
|
||||
MessageTextFromValue( constraintValue ),
|
||||
MessageTextFromValue( holeMinor ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
msg.Printf( _( "(%s max width %s; actual %s)" ),
|
||||
constraint.GetName(),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), constraintValue ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), holeMajor ) );
|
||||
MessageTextFromValue( constraintValue ),
|
||||
MessageTextFromValue( holeMajor ) );
|
||||
}
|
||||
|
||||
drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( " " ) + msg );
|
||||
|
@ -226,15 +226,15 @@ void DRC_TEST_PROVIDER_HOLE_SIZE::checkViaHole( PCB_VIA* via, bool aExceedMicro,
|
|||
{
|
||||
msg.Printf( _( "(%s min width %s; actual %s)" ),
|
||||
constraint.GetName(),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), constraintValue ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), via->GetDrillValue() ) );
|
||||
MessageTextFromValue( constraintValue ),
|
||||
MessageTextFromValue( via->GetDrillValue() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
msg.Printf( _( "(%s max width %s; actual %s)" ),
|
||||
constraint.GetName(),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), constraintValue ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), via->GetDrillValue() ) );
|
||||
MessageTextFromValue( constraintValue ),
|
||||
MessageTextFromValue( via->GetDrillValue() ) );
|
||||
}
|
||||
|
||||
drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( " " ) + msg );
|
||||
|
|
|
@ -305,8 +305,8 @@ bool DRC_TEST_PROVIDER_HOLE_TO_HOLE::testHoleAgainstHole( BOARD_ITEM* aItem, SHA
|
|||
|
||||
msg.Printf( _( "(%s min %s; actual %s)" ),
|
||||
constraint.GetName(),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), minClearance ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), actual ) );
|
||||
MessageTextFromValue( minClearance ),
|
||||
MessageTextFromValue( actual ) );
|
||||
|
||||
drce->SetErrorMessage( drce->GetErrorText() + wxS( " " ) + msg );
|
||||
drce->SetItems( aItem, aOther );
|
||||
|
|
|
@ -115,15 +115,15 @@ void DRC_TEST_PROVIDER_MATCHED_LENGTH::checkLengths( const DRC_CONSTRAINT& aCons
|
|||
{
|
||||
msg.Printf( _( "(%s min length: %s; actual: %s)" ),
|
||||
aConstraint.GetName(),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), minLen ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), ent.total ) );
|
||||
MessageTextFromValue( minLen ),
|
||||
MessageTextFromValue( ent.total ) );
|
||||
}
|
||||
else if( maxViolation )
|
||||
{
|
||||
msg.Printf( _( "(%s max length: %s; actual: %s)" ),
|
||||
aConstraint.GetName(),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), maxLen ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), ent.total ) );
|
||||
MessageTextFromValue( maxLen ),
|
||||
MessageTextFromValue( ent.total ) );
|
||||
}
|
||||
|
||||
drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( " " ) + msg );
|
||||
|
@ -159,10 +159,10 @@ void DRC_TEST_PROVIDER_MATCHED_LENGTH::checkSkews( const DRC_CONSTRAINT& aConstr
|
|||
|
||||
msg.Printf( _( "(%s max skew: %s; actual: %s; average net length: %s; actual: %s)" ),
|
||||
aConstraint.GetName(),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), aConstraint.GetValue().Max() ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), skew ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), avgLength ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), ent.total ) );
|
||||
MessageTextFromValue( aConstraint.GetValue().Max() ),
|
||||
MessageTextFromValue( skew ),
|
||||
MessageTextFromValue( avgLength ),
|
||||
MessageTextFromValue( ent.total ) );
|
||||
|
||||
drcItem->SetErrorMessage( drcItem->GetErrorText() + " " + msg );
|
||||
|
||||
|
@ -378,10 +378,10 @@ bool DRC_TEST_PROVIDER_MATCHED_LENGTH::runInternal( bool aDelayReportMode )
|
|||
ent.from,
|
||||
ent.to,
|
||||
(int) ent.items.size(),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), ent.total ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), ent.totalRoute ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), ent.totalVia ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), ent.totalPadToDie ),
|
||||
MessageTextFromValue( ent.total ),
|
||||
MessageTextFromValue( ent.totalRoute ),
|
||||
MessageTextFromValue( ent.totalVia ),
|
||||
MessageTextFromValue( ent.totalPadToDie ),
|
||||
ent.viaCount ) );
|
||||
}
|
||||
|
||||
|
|
|
@ -497,8 +497,8 @@ void DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testShapeLineChain( const SHAPE_LINE_
|
|||
|
||||
msg.Printf( _( "Internal clearance violation (%s clearance %s; actual %s)" ),
|
||||
aConstraint.GetName(),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), clearance ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), collision.second ) );
|
||||
MessageTextFromValue( clearance ),
|
||||
MessageTextFromValue( collision.second ) );
|
||||
|
||||
drce->SetErrorMessage( msg );
|
||||
drce->SetItems( aParentItem );
|
||||
|
@ -548,8 +548,8 @@ void DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testZoneLayer( ZONE* aZone, PCB_LAYER
|
|||
|
||||
msg.Printf( _( "(%s clearance %s; actual %s)" ),
|
||||
aConstraint.GetName(),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), clearance ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), actual ) );
|
||||
MessageTextFromValue( clearance ),
|
||||
MessageTextFromValue( actual ) );
|
||||
|
||||
drce->SetErrorMessage( drce->GetErrorText() + wxS( " " ) + msg );
|
||||
drce->SetItems( aZone );
|
||||
|
@ -607,8 +607,8 @@ bool DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testItemAgainstItem( BOARD_ITEM* aIte
|
|||
|
||||
msg.Printf( _( "(%s clearance %s; actual %s)" ),
|
||||
constraint.GetName(),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), clearance ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), actual ) );
|
||||
MessageTextFromValue( clearance ),
|
||||
MessageTextFromValue( actual ) );
|
||||
|
||||
drce->SetErrorMessage( drce->GetErrorText() + wxS( " " ) + msg );
|
||||
drce->SetItems( aItem, other );
|
||||
|
@ -660,8 +660,8 @@ bool DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testItemAgainstItem( BOARD_ITEM* aIte
|
|||
|
||||
msg.Printf( _( "(%s clearance %s; actual %s)" ),
|
||||
constraint.GetName(),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), clearance ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), actual ) );
|
||||
MessageTextFromValue( clearance ),
|
||||
MessageTextFromValue( actual ) );
|
||||
|
||||
drce->SetErrorMessage( drce->GetErrorText() + wxS( " " ) + msg );
|
||||
drce->SetItems( aItem, other );
|
||||
|
@ -677,8 +677,8 @@ bool DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testItemAgainstItem( BOARD_ITEM* aIte
|
|||
|
||||
msg.Printf( _( "(%s clearance %s; actual %s)" ),
|
||||
constraint.GetName(),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), clearance ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), actual ) );
|
||||
MessageTextFromValue( clearance ),
|
||||
MessageTextFromValue( actual ) );
|
||||
|
||||
drce->SetErrorMessage( drce->GetErrorText() + wxS( " " ) + msg );
|
||||
drce->SetItems( aItem, other );
|
||||
|
@ -771,8 +771,8 @@ void DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testItemAgainstZones( BOARD_ITEM* aIt
|
|||
|
||||
msg.Printf( _( "(%s clearance %s; actual %s)" ),
|
||||
constraint.GetName(),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), clearance ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), actual ) );
|
||||
MessageTextFromValue( clearance ),
|
||||
MessageTextFromValue( actual ) );
|
||||
|
||||
drce->SetErrorMessage( drce->GetErrorText() + wxS( " " ) + msg );
|
||||
drce->SetItems( aItem, zone );
|
||||
|
@ -812,8 +812,8 @@ void DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testItemAgainstZones( BOARD_ITEM* aIt
|
|||
|
||||
msg.Printf( _( "(%s clearance %s; actual %s)" ),
|
||||
constraint.GetName(),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), clearance ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), actual ) );
|
||||
MessageTextFromValue( clearance ),
|
||||
MessageTextFromValue( actual ) );
|
||||
|
||||
drce->SetErrorMessage( drce->GetErrorText() + wxS( " " ) + msg );
|
||||
drce->SetItems( aItem, zone );
|
||||
|
|
|
@ -241,8 +241,8 @@ bool DRC_TEST_PROVIDER_SILK_CLEARANCE::Run()
|
|||
|
||||
msg.Printf( _( "(%s clearance %s; actual %s)" ),
|
||||
constraint.GetParentRule()->m_Name,
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), minClearance ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), actual ) );
|
||||
MessageTextFromValue( minClearance ),
|
||||
MessageTextFromValue( actual ) );
|
||||
|
||||
drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( " " ) + msg );
|
||||
}
|
||||
|
|
|
@ -280,8 +280,8 @@ void DRC_TEST_PROVIDER_SOLDER_MASK::testSilkToMaskClearance()
|
|||
|
||||
msg.Printf( _( "(%s clearance %s; actual %s)" ),
|
||||
constraint.GetName(),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), clearance ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), actual ) );
|
||||
MessageTextFromValue( clearance ),
|
||||
MessageTextFromValue( actual ) );
|
||||
|
||||
drce->SetErrorMessage( drce->GetErrorText() + wxS( " " ) + msg );
|
||||
drce->SetItems( item );
|
||||
|
|
|
@ -109,8 +109,8 @@ bool DRC_TEST_PROVIDER_TEXT_DIMS::Run()
|
|||
|
||||
msg.Printf( _( "(%s min height %s; actual %s)" ),
|
||||
constraint.GetName(),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), constraint.Value().Min() ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), actualHeight ) );
|
||||
MessageTextFromValue( constraint.Value().Min() ),
|
||||
MessageTextFromValue( actualHeight ) );
|
||||
|
||||
drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( " " ) + msg );
|
||||
drcItem->SetItems( item );
|
||||
|
@ -126,8 +126,8 @@ bool DRC_TEST_PROVIDER_TEXT_DIMS::Run()
|
|||
|
||||
msg.Printf( _( "(%s max height %s; actual %s)" ),
|
||||
constraint.GetName(),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), constraint.Value().Max() ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), actualHeight ) );
|
||||
MessageTextFromValue( constraint.Value().Max() ),
|
||||
MessageTextFromValue( actualHeight ) );
|
||||
|
||||
drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( " " ) + msg );
|
||||
drcItem->SetItems( item );
|
||||
|
@ -229,8 +229,8 @@ bool DRC_TEST_PROVIDER_TEXT_DIMS::Run()
|
|||
|
||||
msg.Printf( _( "(%s min thickness %s; actual %s)" ),
|
||||
constraint.GetName(),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), constraint.Value().Min() ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), actualThickness ) );
|
||||
MessageTextFromValue( constraint.Value().Min() ),
|
||||
MessageTextFromValue( actualThickness ) );
|
||||
|
||||
drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( " " ) + msg );
|
||||
drcItem->SetItems( item );
|
||||
|
@ -246,8 +246,8 @@ bool DRC_TEST_PROVIDER_TEXT_DIMS::Run()
|
|||
|
||||
msg.Printf( _( "(%s max thickness %s; actual %s)" ),
|
||||
constraint.GetName(),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), constraint.Value().Max() ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), actualThickness ) );
|
||||
MessageTextFromValue( constraint.Value().Max() ),
|
||||
MessageTextFromValue( actualThickness ) );
|
||||
|
||||
drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( " " ) + msg );
|
||||
drcItem->SetItems( item );
|
||||
|
|
|
@ -130,15 +130,15 @@ bool DRC_TEST_PROVIDER_TRACK_WIDTH::Run()
|
|||
{
|
||||
msg.Printf( _( "(%s min width %s; actual %s)" ),
|
||||
constraint.GetName(),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), constraintWidth ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), actual ) );
|
||||
MessageTextFromValue( constraintWidth ),
|
||||
MessageTextFromValue( actual ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
msg.Printf( _( "(%s max width %s; actual %s)" ),
|
||||
constraint.GetName(),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), constraintWidth ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), actual ) );
|
||||
MessageTextFromValue( constraintWidth ),
|
||||
MessageTextFromValue( actual ) );
|
||||
}
|
||||
|
||||
drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( " " ) + msg );
|
||||
|
|
|
@ -120,15 +120,15 @@ bool DRC_TEST_PROVIDER_VIA_DIAMETER::Run()
|
|||
{
|
||||
msg.Printf( _( "(%s min diameter %s; actual %s)" ),
|
||||
constraint.GetName(),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), constraintDiameter ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), actual ) );
|
||||
MessageTextFromValue( constraintDiameter ),
|
||||
MessageTextFromValue( actual ) );
|
||||
}
|
||||
else if( fail_max )
|
||||
{
|
||||
msg.Printf( _( "(%s max diameter %s; actual %s)" ),
|
||||
constraint.GetName(),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), constraintDiameter ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), actual ) );
|
||||
MessageTextFromValue( constraintDiameter ),
|
||||
MessageTextFromValue( actual ) );
|
||||
}
|
||||
|
||||
drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( " " ) + msg );
|
||||
|
|
|
@ -1350,7 +1350,7 @@ INSPECT_RESULT FOOTPRINT::Visit( INSPECTOR inspector, void* testData,
|
|||
}
|
||||
|
||||
|
||||
wxString FOOTPRINT::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
wxString FOOTPRINT::GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
wxString reference = GetReference();
|
||||
|
||||
|
|
|
@ -644,7 +644,7 @@ public:
|
|||
return wxT( "FOOTPRINT" );
|
||||
}
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
|
||||
|
||||
BITMAPS GetMenuImage() const override;
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ void FP_SHAPE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_IT
|
|||
}
|
||||
|
||||
|
||||
wxString FP_SHAPE::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
wxString FP_SHAPE::GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
return wxString::Format( _( "%s on %s" ),
|
||||
ShowShape(),
|
||||
|
|
|
@ -140,7 +140,7 @@ public:
|
|||
|
||||
wxString GetParentAsString() const { return m_parent->m_Uuid.AsString(); }
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
|
||||
|
||||
BITMAPS GetMenuImage() const override;
|
||||
|
||||
|
|
|
@ -300,7 +300,7 @@ void FP_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITE
|
|||
}
|
||||
|
||||
|
||||
wxString FP_TEXT::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
wxString FP_TEXT::GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
switch( m_Type )
|
||||
{
|
||||
|
|
|
@ -176,7 +176,7 @@ public:
|
|||
return wxT( "FP_TEXT" );
|
||||
}
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
|
||||
|
||||
BITMAPS GetMenuImage() const override;
|
||||
|
||||
|
|
|
@ -322,11 +322,11 @@ void FP_TEXTBOX::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_
|
|||
msg = aFrame->MessageTextFromValue( std::abs( GetEnd().y - GetStart().y ) );
|
||||
aList.emplace_back( _( "Box Height" ), msg );
|
||||
|
||||
m_stroke.GetMsgPanelInfo( pcbIUScale, aFrame->GetUserUnits(), aList );
|
||||
m_stroke.GetMsgPanelInfo( aFrame, aList );
|
||||
}
|
||||
|
||||
|
||||
wxString FP_TEXTBOX::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
wxString FP_TEXTBOX::GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
return wxString::Format( _( "Footprint Text Box of %s" ),
|
||||
static_cast<FOOTPRINT*>( GetParent() )->GetReference() );
|
||||
|
|
|
@ -128,7 +128,7 @@ public:
|
|||
return wxT( "FP_TEXTBOX" );
|
||||
}
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
|
||||
|
||||
BITMAPS GetMenuImage() const override;
|
||||
|
||||
|
|
|
@ -1217,7 +1217,7 @@ wxString PAD::ShowPadAttr() const
|
|||
}
|
||||
|
||||
|
||||
wxString PAD::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
wxString PAD::GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
if( GetNumber().IsEmpty() )
|
||||
{
|
||||
|
|
|
@ -663,7 +663,7 @@ public:
|
|||
|
||||
void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override;
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
|
||||
|
||||
BITMAPS GetMenuImage() const override;
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ public:
|
|||
void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) override;
|
||||
void Rotate( const VECTOR2I& aCenter, const EDA_ANGLE& aAngle ) override;
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override
|
||||
wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override
|
||||
{
|
||||
return wxString( _( "Image" ) );
|
||||
}
|
||||
|
|
|
@ -318,28 +318,29 @@ void PCB_DIMENSION_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame,
|
|||
|
||||
aList.emplace_back( _( "Suffix" ), GetSuffix() );
|
||||
|
||||
EDA_UNITS units;
|
||||
// Use our own UNITS_PROVIDER to report dimension info in dimension's units rather than
|
||||
// in frame's units.
|
||||
UNITS_PROVIDER unitsProvider( pcbIUScale, EDA_UNITS::MILLIMETRES );
|
||||
unitsProvider.SetUserUnits( GetUnits() );
|
||||
|
||||
GetUnits( units );
|
||||
aList.emplace_back( _( "Units" ), EDA_UNIT_UTILS::GetLabel( units ) );
|
||||
aList.emplace_back( _( "Units" ), EDA_UNIT_UTILS::GetLabel( GetUnits() ) );
|
||||
|
||||
aList.emplace_back( _( "Font" ), m_text.GetDrawFont()->GetName() );
|
||||
aList.emplace_back( _( "Text Thickness" ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, units, m_text.GetTextThickness() ) );
|
||||
unitsProvider.MessageTextFromValue( m_text.GetTextThickness() ) );
|
||||
aList.emplace_back( _( "Text Width" ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, units, m_text.GetTextWidth() ) );
|
||||
unitsProvider.MessageTextFromValue( m_text.GetTextWidth() ) );
|
||||
aList.emplace_back( _( "Text Height" ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, units, m_text.GetTextHeight() ) );
|
||||
unitsProvider.MessageTextFromValue( m_text.GetTextHeight() ) );
|
||||
|
||||
ORIGIN_TRANSFORMS originTransforms = aFrame->GetOriginTransforms();
|
||||
units = aFrame->GetUserUnits();
|
||||
|
||||
if( Type() == PCB_DIM_CENTER_T || Type() == PCB_FP_DIM_CENTER_T )
|
||||
{
|
||||
VECTOR2I startCoord = originTransforms.ToDisplayAbs( GetStart() );
|
||||
wxString start = wxString::Format( wxT( "@(%s, %s)" ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, units, startCoord.x ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, units, startCoord.y ) );
|
||||
aFrame->MessageTextFromValue( startCoord.x ),
|
||||
aFrame->MessageTextFromValue( startCoord.y ) );
|
||||
|
||||
aList.emplace_back( start, wxEmptyString );
|
||||
}
|
||||
|
@ -347,12 +348,12 @@ void PCB_DIMENSION_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame,
|
|||
{
|
||||
VECTOR2I startCoord = originTransforms.ToDisplayAbs( GetStart() );
|
||||
wxString start = wxString::Format( wxT( "@(%s, %s)" ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, units, startCoord.x ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, units, startCoord.y ) );
|
||||
aFrame->MessageTextFromValue( startCoord.x ),
|
||||
aFrame->MessageTextFromValue( startCoord.y ) );
|
||||
VECTOR2I endCoord = originTransforms.ToDisplayAbs( GetEnd() );
|
||||
wxString end = wxString::Format( wxT( "@(%s, %s)" ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, units, endCoord.x ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, units, endCoord.y ) );
|
||||
aFrame->MessageTextFromValue( endCoord.x ),
|
||||
aFrame->MessageTextFromValue( endCoord.y ) );
|
||||
|
||||
aList.emplace_back( start, end );
|
||||
}
|
||||
|
@ -446,7 +447,7 @@ const BOX2I PCB_DIMENSION_BASE::GetBoundingBox() const
|
|||
}
|
||||
|
||||
|
||||
wxString PCB_DIMENSION_BASE::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
wxString PCB_DIMENSION_BASE::GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
return wxString::Format( _( "Dimension '%s' on %s" ), GetText(), GetLayerName() );
|
||||
}
|
||||
|
@ -729,11 +730,12 @@ void PCB_DIM_ALIGNED::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_P
|
|||
{
|
||||
PCB_DIMENSION_BASE::GetMsgPanelInfo( aFrame, aList );
|
||||
|
||||
EDA_UNITS units;
|
||||
GetUnits( units );
|
||||
// Use our own UNITS_PROVIDER to report dimension info in dimension's units rather than
|
||||
// in frame's units.
|
||||
UNITS_PROVIDER unitsProvider( pcbIUScale, EDA_UNITS::MILLIMETRES );
|
||||
unitsProvider.SetUserUnits( GetUnits() );
|
||||
|
||||
aList.emplace_back( _( "Height" ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, units, m_height ) );
|
||||
aList.emplace_back( _( "Height" ), unitsProvider.MessageTextFromValue( m_height ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1082,12 +1084,11 @@ void PCB_DIM_LEADER::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PA
|
|||
aList.emplace_back( _( "Leader" ), m_text.GetShownText() );
|
||||
|
||||
ORIGIN_TRANSFORMS originTransforms = aFrame->GetOriginTransforms();
|
||||
EDA_UNITS units = aFrame->GetUserUnits();
|
||||
|
||||
VECTOR2I startCoord = originTransforms.ToDisplayAbs( GetStart() );
|
||||
wxString start = wxString::Format( wxT( "@(%s, %s)" ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, units, startCoord.x ),
|
||||
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, units, startCoord.y ) );
|
||||
aFrame->MessageTextFromValue( startCoord.x ),
|
||||
aFrame->MessageTextFromValue( startCoord.y ) );
|
||||
|
||||
aList.emplace_back( start, wxEmptyString );
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue