Eradicate g_UserUnit from ERC/DRC.
(cherry picked from commit 98b8cd4)
This commit is contained in:
parent
2ff414adb4
commit
ef3e045a9b
|
@ -103,14 +103,14 @@ MARKER_BASE::MARKER_BASE()
|
|||
}
|
||||
|
||||
|
||||
MARKER_BASE::MARKER_BASE( int aErrorCode, const wxPoint& aMarkerPos,
|
||||
MARKER_BASE::MARKER_BASE( EDA_UNITS_T aUnits, int aErrorCode, const wxPoint& aMarkerPos,
|
||||
EDA_ITEM* aItem, const wxPoint& aPos,
|
||||
EDA_ITEM* bItem, const wxPoint& bPos )
|
||||
{
|
||||
m_ScalingFactor = M_SHAPE_SCALE;
|
||||
init();
|
||||
|
||||
SetData( aErrorCode, aMarkerPos, aItem, aPos, bItem, bPos );
|
||||
SetData( aUnits, aErrorCode, aMarkerPos, aItem, aPos, bItem, bPos );
|
||||
}
|
||||
|
||||
|
||||
|
@ -130,6 +130,7 @@ MARKER_BASE::MARKER_BASE( int aErrorCode, const wxPoint& aMarkerPos,
|
|||
{
|
||||
m_ScalingFactor = M_SHAPE_SCALE;
|
||||
init();
|
||||
|
||||
SetData( aErrorCode, aMarkerPos, aText, aPos );
|
||||
}
|
||||
|
||||
|
@ -139,12 +140,12 @@ MARKER_BASE::~MARKER_BASE()
|
|||
}
|
||||
|
||||
|
||||
void MARKER_BASE::SetData( int aErrorCode, const wxPoint& aMarkerPos,
|
||||
void MARKER_BASE::SetData( EDA_UNITS_T aUnits, int aErrorCode, const wxPoint& aMarkerPos,
|
||||
EDA_ITEM* aItem, const wxPoint& aPos,
|
||||
EDA_ITEM* bItem, const wxPoint& bPos )
|
||||
{
|
||||
m_Pos = aMarkerPos;
|
||||
m_drc.SetData( aErrorCode, aItem, aPos, bItem, bPos );
|
||||
m_drc.SetData( aUnits, aErrorCode, aItem, aPos, bItem, bPos );
|
||||
m_drc.SetParent( this );
|
||||
}
|
||||
|
||||
|
@ -207,7 +208,7 @@ void MARKER_BASE::DrawMarker( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDr
|
|||
|
||||
void MARKER_BASE::DisplayMarkerInfo( EDA_DRAW_FRAME* aFrame )
|
||||
{
|
||||
wxString msg = m_drc.ShowHtml();
|
||||
wxString msg = m_drc.ShowHtml( aFrame->GetUserUnits() );
|
||||
DIALOG_DISPLAY_HTML_TEXT_BASE infodisplay( (wxWindow*)aFrame, wxID_ANY, _( "Marker Info" ),
|
||||
wxGetMousePosition(), wxSize( 550, 140 ) );
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ public:
|
|||
* Function DisplayList();
|
||||
* Build the Html marker list and show it
|
||||
*/
|
||||
void DisplayList()
|
||||
void DisplayList( EDA_UNITS_T aUnits )
|
||||
{
|
||||
wxString htmlpage;
|
||||
wxColour bgcolor = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW );
|
||||
|
@ -82,7 +82,7 @@ public:
|
|||
for( unsigned ii = 0; ii < m_MarkerListReferences.size(); ii++ )
|
||||
{
|
||||
href.Printf( wxT( "href='%d'" ), ii );
|
||||
marker_text = m_MarkerListReferences[ii]->GetReporter().ShowHtml();
|
||||
marker_text = m_MarkerListReferences[ii]->GetReporter().ShowHtml( aUnits );
|
||||
marker_text.Replace( wxT( "href=''"), href );
|
||||
htmlpage += marker_text;
|
||||
}
|
||||
|
|
|
@ -409,7 +409,7 @@ void DIALOG_ERC::DisplayERC_MarkersList()
|
|||
}
|
||||
}
|
||||
|
||||
m_MarkersList->DisplayList();
|
||||
m_MarkersList->DisplayList( GetUserUnits() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -637,7 +637,7 @@ void DIALOG_ERC::TestErc( REPORTER& aReporter )
|
|||
if( dlg.ShowModal() == wxID_CANCEL )
|
||||
return;
|
||||
|
||||
if( WriteDiagnosticERC( dlg.GetPath() ) )
|
||||
if( WriteDiagnosticERC( GetUserUnits(), dlg.GetPath() ) )
|
||||
ExecuteFile( this, Pgm().GetEditorName(), QuoteFullPath( fn ) );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ wxString DRC_ITEM::ShowCoord( EDA_UNITS_T aUnits, const wxPoint& aPos )
|
|||
}
|
||||
|
||||
|
||||
wxString DRC_ITEM::ShowHtml() const
|
||||
wxString DRC_ITEM::ShowHtml( EDA_UNITS_T aUnits ) const
|
||||
{
|
||||
wxString mainText = m_MainText;
|
||||
// a wxHtmlWindows does not like < and > in the text to display
|
||||
|
@ -107,9 +107,9 @@ wxString DRC_ITEM::ShowHtml() const
|
|||
return wxString::Format( _( "<p><b>%s</b><br> <font color='%s'><a href=''>%s</a></font>: %s<br> %s: %s" ),
|
||||
errText,
|
||||
hrefColour.GetAsString( wxC2S_HTML_SYNTAX ),
|
||||
ShowCoord( g_UserUnit, m_MainPosition ),
|
||||
ShowCoord( aUnits, m_MainPosition ),
|
||||
mainText,
|
||||
ShowCoord( g_UserUnit, m_AuxiliaryPosition ),
|
||||
ShowCoord( aUnits, m_AuxiliaryPosition ),
|
||||
auxText );
|
||||
}
|
||||
else
|
||||
|
@ -117,22 +117,22 @@ wxString DRC_ITEM::ShowHtml() const
|
|||
return wxString::Format( _( "<p><b>%s</b><br> <font color='%s'><a href=''>%s</a></font>: %s" ),
|
||||
errText,
|
||||
hrefColour.GetAsString( wxC2S_HTML_SYNTAX ),
|
||||
ShowCoord( g_UserUnit, m_MainPosition ),
|
||||
ShowCoord( aUnits, m_MainPosition ),
|
||||
mainText );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
wxString DRC_ITEM::ShowReport() const
|
||||
wxString DRC_ITEM::ShowReport( EDA_UNITS_T aUnits ) const
|
||||
{
|
||||
if( m_hasSecondItem )
|
||||
{
|
||||
return wxString::Format( wxT( "ErrType(%d): %s\n %s: %s\n %s: %s\n" ),
|
||||
m_ErrorCode,
|
||||
GetErrorText(),
|
||||
ShowCoord( g_UserUnit, m_MainPosition ),
|
||||
ShowCoord( aUnits, m_MainPosition ),
|
||||
m_MainText,
|
||||
ShowCoord( g_UserUnit, m_AuxiliaryPosition ),
|
||||
ShowCoord( aUnits, m_AuxiliaryPosition ),
|
||||
m_AuxiliaryText );
|
||||
}
|
||||
else
|
||||
|
@ -140,7 +140,7 @@ wxString DRC_ITEM::ShowReport() const
|
|||
return wxString::Format( wxT( "ErrType(%d): %s\n %s: %s\n" ),
|
||||
m_ErrorCode,
|
||||
GetErrorText(),
|
||||
ShowCoord( g_UserUnit, m_MainPosition ),
|
||||
ShowCoord( aUnits, m_MainPosition ),
|
||||
m_MainText );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -580,7 +580,7 @@ int NETLIST_OBJECT_LIST::CountPinsInNet( unsigned aNetStart )
|
|||
return count;
|
||||
}
|
||||
|
||||
bool WriteDiagnosticERC( const wxString& aFullFileName )
|
||||
bool WriteDiagnosticERC( EDA_UNITS_T aUnits, const wxString& aFullFileName )
|
||||
{
|
||||
wxString msg;
|
||||
|
||||
|
@ -621,7 +621,7 @@ bool WriteDiagnosticERC( const wxString& aFullFileName )
|
|||
if( marker->GetErrorLevel() == MARKER_BASE::MARKER_SEVERITY_WARNING )
|
||||
warn_count++;
|
||||
|
||||
msg << marker->GetReporter().ShowReport();
|
||||
msg << marker->GetReporter().ShowReport( aUnits );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ extern const wxString CommentERC_V[];
|
|||
*
|
||||
* @param aFullFileName A wxString object containing the file name and path.
|
||||
*/
|
||||
bool WriteDiagnosticERC( const wxString& aFullFileName );
|
||||
bool WriteDiagnosticERC( EDA_UNITS_T aUnits, const wxString& aFullFileName );
|
||||
|
||||
/**
|
||||
* Performs ERC testing and creates an ERC marker to show the ERC problem for aNetItemRef
|
||||
|
|
|
@ -72,10 +72,10 @@ public:
|
|||
m_auxItemWeakRef = nullptr;
|
||||
}
|
||||
|
||||
DRC_ITEM( int aErrorCode, EDA_ITEM* aMainItem, const wxPoint& aMainPos,
|
||||
DRC_ITEM( EDA_UNITS_T aUnits, int aErrorCode, EDA_ITEM* aMainItem, const wxPoint& aMainPos,
|
||||
EDA_ITEM* bAuxiliaryItem, const wxPoint& bAuxiliaryPos )
|
||||
{
|
||||
SetData( aErrorCode, aMainItem, aMainPos, bAuxiliaryItem, bAuxiliaryPos );
|
||||
SetData( aUnits, aErrorCode, aMainItem, aMainPos, bAuxiliaryItem, bAuxiliaryPos );
|
||||
}
|
||||
|
||||
|
||||
|
@ -88,11 +88,11 @@ public:
|
|||
* @param aMainPos = position the first item and therefore of this issue
|
||||
* @param bAuxiliaryPos = position the second item
|
||||
*/
|
||||
void SetData( int aErrorCode, EDA_ITEM* aMainItem, const wxPoint& aMainPos,
|
||||
void SetData( EDA_UNITS_T aUnits, int aErrorCode, EDA_ITEM* aMainItem, const wxPoint& aMainPos,
|
||||
EDA_ITEM* bAuxiliaryItem = nullptr, const wxPoint& bAuxiliaryPos = wxPoint() )
|
||||
{
|
||||
m_ErrorCode = aErrorCode;
|
||||
m_MainText = aMainItem->GetSelectMenuText( g_UserUnit );
|
||||
m_MainText = aMainItem->GetSelectMenuText( aUnits );
|
||||
m_AuxiliaryText = wxEmptyString;
|
||||
m_MainPosition = aMainPos;
|
||||
m_AuxiliaryPosition = bAuxiliaryPos;
|
||||
|
@ -101,7 +101,7 @@ public:
|
|||
m_parent = nullptr;
|
||||
|
||||
if( m_hasSecondItem )
|
||||
m_AuxiliaryText = bAuxiliaryItem->GetSelectMenuText( g_UserUnit );
|
||||
m_AuxiliaryText = bAuxiliaryItem->GetSelectMenuText( aUnits );
|
||||
|
||||
// Weak references (void*). One must search the BOARD_ITEMS or SCH_ITEMS for a match.
|
||||
m_mainItemWeakRef = aMainItem;
|
||||
|
@ -174,7 +174,7 @@ public:
|
|||
* wxWidget's wxHtmlListBox class.
|
||||
* @return wxString - the html text.
|
||||
*/
|
||||
wxString ShowHtml() const;
|
||||
wxString ShowHtml( EDA_UNITS_T aUnits ) const;
|
||||
|
||||
/**
|
||||
* Function ShowReport
|
||||
|
@ -182,7 +182,7 @@ public:
|
|||
* to disk in a report.
|
||||
* @return wxString - the simple multi-line report text.
|
||||
*/
|
||||
wxString ShowReport() const;
|
||||
wxString ShowReport( EDA_UNITS_T aUnits ) const;
|
||||
|
||||
/**
|
||||
* Function GetErrorCode
|
||||
|
|
|
@ -78,7 +78,7 @@ public:
|
|||
* @param bItem The second of the two conflicting objects
|
||||
* @param bPos The position of the second of two objects
|
||||
*/
|
||||
MARKER_BASE( int aErrorCode, const wxPoint& aMarkerPos,
|
||||
MARKER_BASE( EDA_UNITS_T aUnits, int aErrorCode, const wxPoint& aMarkerPos,
|
||||
EDA_ITEM* aItem, const wxPoint& aPos,
|
||||
EDA_ITEM* bItem, const wxPoint& bPos );
|
||||
|
||||
|
@ -175,7 +175,7 @@ public:
|
|||
* @param bItem The second of the two conflicting objects
|
||||
* @param bPos The position of the second of two objects
|
||||
*/
|
||||
void SetData( int aErrorCode, const wxPoint& aMarkerPos,
|
||||
void SetData( EDA_UNITS_T aUnits, int aErrorCode, const wxPoint& aMarkerPos,
|
||||
EDA_ITEM* aItem, const wxPoint& aPos,
|
||||
EDA_ITEM* bItem = nullptr, const wxPoint& bPos = wxPoint() );
|
||||
|
||||
|
|
|
@ -47,18 +47,18 @@
|
|||
|
||||
MARKER_PCB::MARKER_PCB( BOARD_ITEM* aParent ) :
|
||||
BOARD_ITEM( aParent, PCB_MARKER_T ),
|
||||
MARKER_BASE(), m_item( NULL )
|
||||
MARKER_BASE(), m_item( nullptr )
|
||||
{
|
||||
m_Color = WHITE;
|
||||
m_ScalingFactor = SCALING_FACTOR;
|
||||
}
|
||||
|
||||
|
||||
MARKER_PCB::MARKER_PCB( int aErrorCode, const wxPoint& aMarkerPos,
|
||||
MARKER_PCB::MARKER_PCB( EDA_UNITS_T aUnits, int aErrorCode, const wxPoint& aMarkerPos,
|
||||
BOARD_ITEM* aItem, const wxPoint& aPos,
|
||||
BOARD_ITEM* bItem, const wxPoint& bPos ) :
|
||||
BOARD_ITEM( NULL, PCB_MARKER_T ), // parent set during BOARD::Add()
|
||||
MARKER_BASE( aErrorCode, aMarkerPos, aItem, aPos, bItem, bPos ), m_item( NULL )
|
||||
BOARD_ITEM( nullptr, PCB_MARKER_T ), // parent set during BOARD::Add()
|
||||
MARKER_BASE( aUnits, aErrorCode, aMarkerPos, aItem, aPos, bItem, bPos ), m_item( nullptr )
|
||||
{
|
||||
m_Color = WHITE;
|
||||
m_ScalingFactor = SCALING_FACTOR;
|
||||
|
@ -68,8 +68,8 @@ MARKER_PCB::MARKER_PCB( int aErrorCode, const wxPoint& aMarkerPos,
|
|||
MARKER_PCB::MARKER_PCB( int aErrorCode, const wxPoint& aMarkerPos,
|
||||
const wxString& aText, const wxPoint& aPos,
|
||||
const wxString& bText, const wxPoint& bPos ) :
|
||||
BOARD_ITEM( NULL, PCB_MARKER_T ), // parent set during BOARD::Add()
|
||||
MARKER_BASE( aErrorCode, aMarkerPos, aText, aPos, bText, bPos ), m_item( NULL )
|
||||
BOARD_ITEM( nullptr, PCB_MARKER_T ), // parent set during BOARD::Add()
|
||||
MARKER_BASE( aErrorCode, aMarkerPos, aText, aPos, bText, bPos ), m_item( nullptr )
|
||||
{
|
||||
m_Color = WHITE;
|
||||
m_ScalingFactor = SCALING_FACTOR;
|
||||
|
@ -95,30 +95,20 @@ bool MARKER_PCB::IsOnLayer( PCB_LAYER_ID aLayer ) const
|
|||
|
||||
void MARKER_PCB::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList )
|
||||
{
|
||||
const DRC_ITEM& rpt = m_drc;
|
||||
wxString errorTxt, txtA, txtB;
|
||||
|
||||
aList.push_back( MSG_PANEL_ITEM( _( "Type" ), _( "Marker" ), DARKCYAN ) );
|
||||
aList.emplace_back( MSG_PANEL_ITEM( _( "Type" ), _( "Marker" ), DARKCYAN ) );
|
||||
|
||||
wxString errorTxt;
|
||||
errorTxt.Printf( _( "ErrType (%d)- %s:" ), m_drc.GetErrorCode(), m_drc.GetErrorText() );
|
||||
|
||||
errorTxt.Printf( _( "ErrType (%d)- %s:" ),
|
||||
rpt.GetErrorCode(),
|
||||
GetChars( rpt.GetErrorText() ) );
|
||||
aList.emplace_back( MSG_PANEL_ITEM( errorTxt, wxEmptyString, RED ) );
|
||||
|
||||
aList.push_back( MSG_PANEL_ITEM( errorTxt, wxEmptyString, RED ) );
|
||||
txtA.Printf( wxT( "%s: %s" ), DRC_ITEM::ShowCoord( aUnits, m_drc.GetPointA() ), m_drc.GetTextA() );
|
||||
|
||||
wxString txtA = wxString::Format( wxT( "%s: %s" ),
|
||||
DRC_ITEM::ShowCoord( aUnits, rpt.GetPointA() ),
|
||||
rpt.GetTextA() );
|
||||
wxString txtB;
|
||||
if( rpt.HasSecondItem() )
|
||||
{
|
||||
txtB = wxString::Format( wxT( "%s: %s" ),
|
||||
DRC_ITEM::ShowCoord( aUnits, rpt.GetPointB() ),
|
||||
rpt.GetTextB() );
|
||||
}
|
||||
if( m_drc.HasSecondItem() )
|
||||
txtB.Printf( wxT( "%s: %s" ), DRC_ITEM::ShowCoord( aUnits, m_drc.GetPointB() ), m_drc.GetTextB() );
|
||||
|
||||
aList.push_back( MSG_PANEL_ITEM( txtA, txtB, DARKBROWN ) );
|
||||
aList.emplace_back( MSG_PANEL_ITEM( txtA, txtB, DARKBROWN ) );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ public:
|
|||
* @param bItem The second of the two conflicting objects
|
||||
* @param bPos The position of the second of two objects
|
||||
*/
|
||||
MARKER_PCB( int aErrorCode, const wxPoint& aMarkerPos,
|
||||
MARKER_PCB( EDA_UNITS_T aUnits, int aErrorCode, const wxPoint& aMarkerPos,
|
||||
BOARD_ITEM* aItem, const wxPoint& aPos,
|
||||
BOARD_ITEM* bItem = nullptr, const wxPoint& bPos = wxPoint() );
|
||||
|
||||
|
|
|
@ -631,6 +631,7 @@ bool DIALOG_DRC_CONTROL::writeReport( const wxString& aFullFileName )
|
|||
return false;
|
||||
|
||||
int count;
|
||||
EDA_UNITS_T units = GetUserUnits();
|
||||
|
||||
fprintf( fp, "** Drc report for %s **\n",
|
||||
TO_UTF8( m_brdEditor->GetBoard()->GetFileName() ) );
|
||||
|
@ -644,14 +645,14 @@ bool DIALOG_DRC_CONTROL::writeReport( const wxString& aFullFileName )
|
|||
fprintf( fp, "\n** Found %d DRC errors **\n", count );
|
||||
|
||||
for( int i = 0; i<count; ++i )
|
||||
fprintf( fp, "%s", TO_UTF8( m_ClearanceListBox->GetItem( i )->ShowReport()) );
|
||||
fprintf( fp, "%s", TO_UTF8( m_ClearanceListBox->GetItem( i )->ShowReport( units ) ) );
|
||||
|
||||
count = m_UnconnectedListBox->GetItemCount();
|
||||
|
||||
fprintf( fp, "\n** Found %d unconnected pads **\n", count );
|
||||
|
||||
for( int i = 0; i<count; ++i )
|
||||
fprintf( fp, "%s", TO_UTF8( m_UnconnectedListBox->GetItem( i )->ShowReport() ) );
|
||||
fprintf( fp, "%s", TO_UTF8( m_UnconnectedListBox->GetItem( i )->ShowReport( units ) ) );
|
||||
|
||||
fprintf( fp, "\n** End of Report **\n" );
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ public:
|
|||
|
||||
//-----<Interface DRC_ITEM_LIST>---------------------------------------
|
||||
|
||||
void DeleteAllItems() override
|
||||
void DeleteAllItems() override
|
||||
{
|
||||
m_board->DeleteMARKERs();
|
||||
}
|
||||
|
@ -188,6 +188,7 @@ public:
|
|||
class DRCLISTBOX : public wxHtmlListBox
|
||||
{
|
||||
private:
|
||||
EDA_UNITS_T m_units;
|
||||
DRC_ITEM_LIST* m_list; ///< wxHtmlListBox does not own the list, I do
|
||||
|
||||
public:
|
||||
|
@ -213,10 +214,11 @@ public:
|
|||
* @param aList The DRC_ITEM_LIST* containing the DRC_ITEMs which will be
|
||||
* displayed in the wxHtmlListBox
|
||||
*/
|
||||
void SetList( DRC_ITEM_LIST* aList )
|
||||
void SetList( EDA_UNITS_T aUnits, DRC_ITEM_LIST* aList )
|
||||
{
|
||||
delete m_list;
|
||||
|
||||
m_units = aUnits;
|
||||
m_list = aList;
|
||||
SetItemCount( aList->GetCount() );
|
||||
Refresh();
|
||||
|
@ -254,7 +256,7 @@ public:
|
|||
|
||||
return wxString::Format( wxT( "<font color='%s'>%s</font>" ),
|
||||
color.GetAsString( wxC2S_HTML_SYNTAX ),
|
||||
item->ShowHtml() );
|
||||
item->ShowHtml( m_units ) );
|
||||
}
|
||||
}
|
||||
return wxString();
|
||||
|
|
|
@ -131,6 +131,7 @@ DRC::DRC( PCB_EDIT_FRAME* aPcbWindow )
|
|||
m_pcbEditorFrame = aPcbWindow;
|
||||
m_pcb = aPcbWindow->GetBoard();
|
||||
m_drcDialog = NULL;
|
||||
m_units = aPcbWindow->GetUserUnits();
|
||||
|
||||
// establish initial values for everything:
|
||||
m_drcInLegacyRoutingMode = false;
|
||||
|
@ -205,6 +206,7 @@ int DRC::DrcOnCreatingTrack( TRACK* aRefSegm, TRACK* aList )
|
|||
int DRC::TestZoneToZoneOutline( ZONE_CONTAINER* aZone, bool aCreateMarkers )
|
||||
{
|
||||
BOARD* board = m_pcbEditorFrame->GetBoard();
|
||||
EDA_UNITS_T units = m_pcbEditorFrame->GetUserUnits();
|
||||
BOARD_COMMIT commit( m_pcbEditorFrame );
|
||||
int nerrors = 0;
|
||||
|
||||
|
@ -272,8 +274,8 @@ int DRC::TestZoneToZoneOutline( ZONE_CONTAINER* aZone, bool aCreateMarkers )
|
|||
if( aCreateMarkers )
|
||||
{
|
||||
wxPoint pt( currentVertex.x, currentVertex.y );
|
||||
MARKER_PCB* marker = new MARKER_PCB( COPPERAREA_INSIDE_COPPERAREA,
|
||||
pt, zoneRef, pt, zoneToTest, pt );
|
||||
auto marker = new MARKER_PCB( units, COPPERAREA_INSIDE_COPPERAREA,
|
||||
pt, zoneRef, pt, zoneToTest, pt );
|
||||
commit.Add( marker );
|
||||
}
|
||||
|
||||
|
@ -292,8 +294,8 @@ int DRC::TestZoneToZoneOutline( ZONE_CONTAINER* aZone, bool aCreateMarkers )
|
|||
if( aCreateMarkers )
|
||||
{
|
||||
wxPoint pt( currentVertex.x, currentVertex.y );
|
||||
MARKER_PCB* marker = new MARKER_PCB( COPPERAREA_INSIDE_COPPERAREA,
|
||||
pt, zoneToTest, pt, zoneRef, pt );
|
||||
auto marker = new MARKER_PCB( units, COPPERAREA_INSIDE_COPPERAREA,
|
||||
pt, zoneToTest, pt, zoneRef, pt );
|
||||
commit.Add( marker );
|
||||
}
|
||||
|
||||
|
@ -338,8 +340,8 @@ int DRC::TestZoneToZoneOutline( ZONE_CONTAINER* aZone, bool aCreateMarkers )
|
|||
// COPPERAREA_COPPERAREA error : intersect or too close
|
||||
if( aCreateMarkers )
|
||||
{
|
||||
MARKER_PCB* marker = new MARKER_PCB( COPPERAREA_CLOSE_TO_COPPERAREA,
|
||||
pt, zoneRef, pt, zoneToTest, pt );
|
||||
auto marker = new MARKER_PCB( units, COPPERAREA_CLOSE_TO_COPPERAREA,
|
||||
pt, zoneRef, pt, zoneToTest, pt );
|
||||
commit.Add( marker );
|
||||
}
|
||||
|
||||
|
@ -547,8 +549,10 @@ void DRC::updatePointers()
|
|||
|
||||
if( m_drcDialog ) // Use diag list boxes only in DRC dialog
|
||||
{
|
||||
m_drcDialog->m_ClearanceListBox->SetList( new DRC_LIST_MARKERS( m_pcb ) );
|
||||
m_drcDialog->m_UnconnectedListBox->SetList( new DRC_LIST_UNCONNECTED( &m_unconnected ) );
|
||||
m_drcDialog->m_ClearanceListBox->SetList(
|
||||
m_pcbEditorFrame->GetUserUnits(), new DRC_LIST_MARKERS( m_pcb ) );
|
||||
m_drcDialog->m_UnconnectedListBox->SetList(
|
||||
m_pcbEditorFrame->GetUserUnits(), new DRC_LIST_UNCONNECTED( &m_unconnected ) );
|
||||
|
||||
m_drcDialog->UpdateDisplayedCounts();
|
||||
}
|
||||
|
@ -561,7 +565,7 @@ bool DRC::doNetClass( const NETCLASSPTR& nc, wxString& msg )
|
|||
|
||||
const BOARD_DESIGN_SETTINGS& g = m_pcb->GetDesignSettings();
|
||||
|
||||
#define FmtVal( x ) GetChars( StringFromValue( g_UserUnit, x ) )
|
||||
#define FmtVal( x ) GetChars( StringFromValue( m_pcbEditorFrame->GetUserUnits(), x ) )
|
||||
|
||||
#if 0 // set to 1 when (if...) BOARD_DESIGN_SETTINGS has a m_MinClearance value
|
||||
if( nc->GetClearance() < g.m_MinClearance )
|
||||
|
@ -777,7 +781,8 @@ void DRC::testDrilledHoles()
|
|||
if( KiROUND( GetLineLength( checkHole.m_location, refHole.m_location ) )
|
||||
< checkHole.m_drillRadius + refHole.m_drillRadius + holeToHoleMin )
|
||||
{
|
||||
addMarkerToPcb( new MARKER_PCB( DRCE_DRILLED_HOLES_TOO_CLOSE, refHole.m_location,
|
||||
addMarkerToPcb( new MARKER_PCB( m_pcbEditorFrame->GetUserUnits(),
|
||||
DRCE_DRILLED_HOLES_TOO_CLOSE, refHole.m_location,
|
||||
refHole.m_owner, refHole.m_location,
|
||||
checkHole.m_owner, checkHole.m_location ) );
|
||||
}
|
||||
|
@ -862,12 +867,12 @@ void DRC::testUnconnected()
|
|||
auto src = edge.GetSourcePos();
|
||||
auto dst = edge.GetTargetPos();
|
||||
|
||||
DRC_ITEM* uncItem = new DRC_ITEM( DRCE_UNCONNECTED_ITEMS,
|
||||
edge.GetSourceNode()->Parent(),
|
||||
wxPoint( src.x, src.y ),
|
||||
edge.GetTargetNode()->Parent(),
|
||||
wxPoint( dst.x, dst.y ) );
|
||||
m_unconnected.push_back( uncItem );
|
||||
m_unconnected.emplace_back( new DRC_ITEM( m_pcbEditorFrame->GetUserUnits(),
|
||||
DRCE_UNCONNECTED_ITEMS,
|
||||
edge.GetSourceNode()->Parent(),
|
||||
wxPoint( src.x, src.y ),
|
||||
edge.GetTargetNode()->Parent(),
|
||||
wxPoint( dst.x, dst.y ) ) );
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1013,8 +1018,7 @@ void DRC::testTexts()
|
|||
if( dist < min_dist )
|
||||
{
|
||||
addMarkerToPcb( fillMarker( track, text,
|
||||
DRCE_TRACK_INSIDE_TEXT,
|
||||
m_currentMarker ) );
|
||||
DRCE_TRACK_INSIDE_TEXT, m_currentMarker ) );
|
||||
m_currentMarker = nullptr;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -214,6 +214,7 @@ private:
|
|||
PCB_EDIT_FRAME* m_pcbEditorFrame; ///< The pcb frame editor which owns the board
|
||||
BOARD* m_pcb;
|
||||
DIALOG_DRC_CONTROL* m_drcDialog;
|
||||
EDA_UNITS_T m_units;
|
||||
|
||||
DRC_LIST m_unconnected; ///< list of unconnected pads, as DRC_ITEMs
|
||||
|
||||
|
|
|
@ -155,7 +155,7 @@ wxString DRC_ITEM::ShowCoord( EDA_UNITS_T aUnits, const wxPoint& aPos )
|
|||
}
|
||||
|
||||
|
||||
wxString DRC_ITEM::ShowHtml() const
|
||||
wxString DRC_ITEM::ShowHtml( EDA_UNITS_T aUnits ) const
|
||||
{
|
||||
wxString mainText = m_MainText;
|
||||
// a wxHtmlWindows does not like < and > in the text to display
|
||||
|
@ -185,31 +185,31 @@ wxString DRC_ITEM::ShowHtml() const
|
|||
// to add color if you want:
|
||||
return wxString::Format( wxT( "<b>%s</b><br> %s: %s<br> %s: %s" ),
|
||||
errText,
|
||||
ShowCoord( g_UserUnit, m_MainPosition ),
|
||||
ShowCoord( aUnits, m_MainPosition ),
|
||||
mainText,
|
||||
ShowCoord( g_UserUnit, m_AuxiliaryPosition ),
|
||||
ShowCoord( aUnits, m_AuxiliaryPosition ),
|
||||
auxText );
|
||||
}
|
||||
else
|
||||
{
|
||||
return wxString::Format( wxT( "<b>%s</b><br> %s: %s" ),
|
||||
errText,
|
||||
ShowCoord( g_UserUnit, m_MainPosition ),
|
||||
ShowCoord( aUnits, m_MainPosition ),
|
||||
mainText );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
wxString DRC_ITEM::ShowReport() const
|
||||
wxString DRC_ITEM::ShowReport( EDA_UNITS_T aUnits ) const
|
||||
{
|
||||
if( m_hasSecondItem )
|
||||
{
|
||||
return wxString::Format( wxT( "ErrType(%d): %s\n %s: %s\n %s: %s\n" ),
|
||||
m_ErrorCode,
|
||||
GetErrorText(),
|
||||
ShowCoord( g_UserUnit, m_MainPosition ),
|
||||
ShowCoord( aUnits, m_MainPosition ),
|
||||
m_MainText,
|
||||
ShowCoord( g_UserUnit, m_AuxiliaryPosition ),
|
||||
ShowCoord( aUnits, m_AuxiliaryPosition ),
|
||||
m_AuxiliaryText );
|
||||
}
|
||||
else
|
||||
|
@ -217,7 +217,7 @@ wxString DRC_ITEM::ShowReport() const
|
|||
return wxString::Format( wxT( "ErrType(%d): %s\n %s: %s\n" ),
|
||||
m_ErrorCode,
|
||||
GetErrorText(),
|
||||
ShowCoord( g_UserUnit, m_MainPosition ),
|
||||
ShowCoord( aUnits, m_MainPosition ),
|
||||
m_MainText );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,9 +90,9 @@ MARKER_PCB* DRC::fillMarker( TRACK* aTrack, BOARD_ITEM* bItem, int aErrorCode, M
|
|||
posA = aTrack->GetPosition();
|
||||
|
||||
if( fillMe )
|
||||
fillMe->SetData( aErrorCode, posA, aTrack, aTrack->GetPosition(), bItem, posB );
|
||||
fillMe->SetData( m_units, aErrorCode, posA, aTrack, aTrack->GetPosition(), bItem, posB );
|
||||
else
|
||||
fillMe = new MARKER_PCB( aErrorCode, posA, aTrack, aTrack->GetPosition(), bItem, posB );
|
||||
fillMe = new MARKER_PCB( m_units, aErrorCode, posA, aTrack, aTrack->GetPosition(), bItem, posB );
|
||||
|
||||
return fillMe;
|
||||
}
|
||||
|
@ -122,9 +122,9 @@ MARKER_PCB* DRC::fillMarker( D_PAD* aPad, BOARD_ITEM* aItem, int aErrorCode, MAR
|
|||
}
|
||||
|
||||
if( fillMe )
|
||||
fillMe->SetData( aErrorCode, posA, aPad, posA, aItem, posB );
|
||||
fillMe->SetData( m_units, aErrorCode, posA, aPad, posA, aItem, posB );
|
||||
else
|
||||
fillMe = new MARKER_PCB( aErrorCode, posA, aPad, posA, aItem, posB );
|
||||
fillMe = new MARKER_PCB( m_units, aErrorCode, posA, aPad, posA, aItem, posB );
|
||||
|
||||
return fillMe;
|
||||
}
|
||||
|
@ -141,9 +141,9 @@ MARKER_PCB* DRC::fillMarker( const wxPoint& aPos, BOARD_ITEM* aItem, BOARD_ITEM*
|
|||
int aErrorCode, MARKER_PCB* fillMe )
|
||||
{
|
||||
if( fillMe )
|
||||
fillMe->SetData( aErrorCode, aPos, aItem, aPos, bItem, aPos );
|
||||
fillMe->SetData( m_units, aErrorCode, aPos, aItem, aPos, bItem, aPos );
|
||||
else
|
||||
fillMe = new MARKER_PCB( aErrorCode, aPos, aItem, aPos, bItem, aPos );
|
||||
fillMe = new MARKER_PCB( m_units, aErrorCode, aPos, aItem, aPos, bItem, aPos );
|
||||
|
||||
return fillMe;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue