OpenGL context must be saved/restored around a translation.
Also includes a bunch of code cleanup. Fixes: lp:1838655 * https://bugs.launchpad.net/kicad/+bug/1838655
This commit is contained in:
parent
5151cd0bfe
commit
56bf72cc5d
|
@ -2106,8 +2106,8 @@ bool CONNECTION_GRAPH::ercCheckNoConnects( const CONNECTION_SUBGRAPH* aSubgraph,
|
||||||
wxPoint pos = pin->GetTransformedPosition();
|
wxPoint pos = pin->GetTransformedPosition();
|
||||||
|
|
||||||
msg.Printf( _( "Pin %s of component %s has a no-connect marker but is connected" ),
|
msg.Printf( _( "Pin %s of component %s has a no-connect marker but is connected" ),
|
||||||
GetChars( pin->GetName() ),
|
pin->GetName(),
|
||||||
GetChars( pin->GetParentComponent()->GetRef( &aSubgraph->m_sheet ) ) );
|
pin->GetParentComponent()->GetRef( &aSubgraph->m_sheet ) );
|
||||||
|
|
||||||
auto marker = new SCH_MARKER();
|
auto marker = new SCH_MARKER();
|
||||||
marker->SetTimeStamp( GetNewTimeStamp() );
|
marker->SetTimeStamp( GetNewTimeStamp() );
|
||||||
|
@ -2158,22 +2158,22 @@ bool CONNECTION_GRAPH::ercCheckNoConnects( const CONNECTION_SUBGRAPH* aSubgraph,
|
||||||
pin = static_cast<SCH_PIN*>( item );
|
pin = static_cast<SCH_PIN*>( item );
|
||||||
else
|
else
|
||||||
has_other_connections = true;
|
has_other_connections = true;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if( item->IsConnectable() )
|
if( item->IsConnectable() )
|
||||||
has_other_connections = true;
|
has_other_connections = true;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if invisible power pins connect to anything else
|
// Check if invisible power pins connect to anything else.
|
||||||
// Note this won't catch if a component has multiple invisible power
|
// Note this won't catch a component with multiple invisible power pins but these don't
|
||||||
// pins but these don't connect to any other net; maybe that should be
|
// connect to any other net; maybe that should be added as a further optional ERC check?
|
||||||
// added as a further optional ERC check.
|
|
||||||
|
|
||||||
if( pin && !has_other_connections &&
|
if( pin && !has_other_connections && pin->IsPowerConnection() && !pin->IsVisible() )
|
||||||
pin->IsPowerConnection() && !pin->IsVisible() )
|
|
||||||
{
|
{
|
||||||
wxString name = pin->Connection( sheet )->Name();
|
wxString name = pin->Connection( sheet )->Name();
|
||||||
wxString local_name = pin->Connection( sheet )->Name( true );
|
wxString local_name = pin->Connection( sheet )->Name( true );
|
||||||
|
@ -2192,8 +2192,8 @@ bool CONNECTION_GRAPH::ercCheckNoConnects( const CONNECTION_SUBGRAPH* aSubgraph,
|
||||||
wxPoint pos = pin->GetTransformedPosition();
|
wxPoint pos = pin->GetTransformedPosition();
|
||||||
|
|
||||||
msg.Printf( _( "Pin %s of component %s is unconnected." ),
|
msg.Printf( _( "Pin %s of component %s is unconnected." ),
|
||||||
GetChars( pin->GetName() ),
|
pin->GetName(),
|
||||||
GetChars( pin->GetParentComponent()->GetRef( &aSubgraph->m_sheet ) ) );
|
pin->GetParentComponent()->GetRef( &aSubgraph->m_sheet ) );
|
||||||
|
|
||||||
auto marker = new SCH_MARKER();
|
auto marker = new SCH_MARKER();
|
||||||
marker->SetTimeStamp( GetNewTimeStamp() );
|
marker->SetTimeStamp( GetNewTimeStamp() );
|
||||||
|
|
|
@ -508,9 +508,8 @@ void DIALOG_ERC::TestErc( REPORTER& aReporter )
|
||||||
// Erase all previous DRC markers.
|
// Erase all previous DRC markers.
|
||||||
screens.DeleteAllMarkers( MARKER_BASE::MARKER_ERC );
|
screens.DeleteAllMarkers( MARKER_BASE::MARKER_ERC );
|
||||||
|
|
||||||
/* Test duplicate sheet names inside a given sheet, one cannot have sheets with
|
// Test duplicate sheet names inside a given sheet. While one can have multiple references
|
||||||
* duplicate names (file names can be duplicated).
|
// to the same file, each must have a unique name.
|
||||||
*/
|
|
||||||
TestDuplicateSheetNames( true );
|
TestDuplicateSheetNames( true );
|
||||||
|
|
||||||
TestConflictingBusAliases();
|
TestConflictingBusAliases();
|
||||||
|
@ -519,8 +518,7 @@ void DIALOG_ERC::TestErc( REPORTER& aReporter )
|
||||||
m_parent->RecalculateConnections();
|
m_parent->RecalculateConnections();
|
||||||
g_ConnectionGraph->RunERC( m_settings );
|
g_ConnectionGraph->RunERC( m_settings );
|
||||||
|
|
||||||
/* Test is all units of each multiunit component have the same footprint assigned.
|
// Test is all units of each multiunit component have the same footprint assigned.
|
||||||
*/
|
|
||||||
TestMultiunitFootprints( sheets );
|
TestMultiunitFootprints( sheets );
|
||||||
|
|
||||||
std::unique_ptr<NETLIST_OBJECT_LIST> objectsConnectedList( m_parent->BuildNetListBase() );
|
std::unique_ptr<NETLIST_OBJECT_LIST> objectsConnectedList( m_parent->BuildNetListBase() );
|
||||||
|
@ -532,21 +530,15 @@ void DIALOG_ERC::TestErc( REPORTER& aReporter )
|
||||||
unsigned nextItemIdx = 0;
|
unsigned nextItemIdx = 0;
|
||||||
int MinConn = NOC;
|
int MinConn = NOC;
|
||||||
|
|
||||||
/* Check that a pin appears in only one net. This check is necessary
|
// Check that a pin appears in only one net. This check is necessary because multi-unit
|
||||||
* because multi-unit components that have shared pins can be wired to
|
// components that have shared pins could be wired to different nets.
|
||||||
* different nets.
|
|
||||||
*/
|
|
||||||
std::unordered_map<wxString, wxString> pin_to_net_map;
|
std::unordered_map<wxString, wxString> pin_to_net_map;
|
||||||
|
|
||||||
/* The netlist generated by SCH_EDIT_FRAME::BuildNetListBase is sorted
|
// The netlist generated by SCH_EDIT_FRAME::BuildNetListBase is sorted by net number, which
|
||||||
* by net number, which means we can group netlist items into ranges
|
// means we can group netlist items into ranges that live in the same net. The range from
|
||||||
* that live in the same net. The range from nextItem to the current
|
// nextItem to the current item (exclusive) needs to be checked against the current item.
|
||||||
* item (exclusive) needs to be checked against the current item. The
|
// The lastItem variable is used as a helper to pass the last item's number from one loop
|
||||||
* lastItem variable is used as a helper to pass the last item's number
|
// iteration to the next, which simplifies the initial pass.
|
||||||
* from one loop iteration to the next, which simplifies the initial
|
|
||||||
* pass.
|
|
||||||
*/
|
|
||||||
|
|
||||||
for( unsigned itemIdx = 0; itemIdx < objectsConnectedList->size(); itemIdx++ )
|
for( unsigned itemIdx = 0; itemIdx < objectsConnectedList->size(); itemIdx++ )
|
||||||
{
|
{
|
||||||
auto item = objectsConnectedList->GetItem( itemIdx );
|
auto item = objectsConnectedList->GetItem( itemIdx );
|
||||||
|
|
126
eeschema/erc.cpp
126
eeschema/erc.cpp
|
@ -32,15 +32,12 @@
|
||||||
#include <sch_draw_panel.h>
|
#include <sch_draw_panel.h>
|
||||||
#include <kicad_string.h>
|
#include <kicad_string.h>
|
||||||
#include <sch_edit_frame.h>
|
#include <sch_edit_frame.h>
|
||||||
|
|
||||||
#include <netlist.h>
|
|
||||||
#include <netlist_object.h>
|
#include <netlist_object.h>
|
||||||
#include <lib_pin.h>
|
#include <lib_pin.h>
|
||||||
#include <erc.h>
|
#include <erc.h>
|
||||||
#include <sch_marker.h>
|
#include <sch_marker.h>
|
||||||
#include <sch_sheet.h>
|
#include <sch_sheet.h>
|
||||||
#include <sch_reference_list.h>
|
#include <sch_reference_list.h>
|
||||||
|
|
||||||
#include <wx/ffile.h>
|
#include <wx/ffile.h>
|
||||||
|
|
||||||
|
|
||||||
|
@ -227,65 +224,44 @@ int TestDuplicateSheetNames( bool aCreateMarker )
|
||||||
|
|
||||||
int TestConflictingBusAliases( bool aCreateMarker )
|
int TestConflictingBusAliases( bool aCreateMarker )
|
||||||
{
|
{
|
||||||
using std::pair;
|
wxString msg;
|
||||||
using std::shared_ptr;
|
wxPoint dummyPos( 0, 0 );
|
||||||
using std::vector;
|
int err_count = 0;
|
||||||
|
|
||||||
int err_count = 0;
|
|
||||||
SCH_SCREENS screens;
|
SCH_SCREENS screens;
|
||||||
vector< shared_ptr<BUS_ALIAS> > aliases;
|
std::vector< std::shared_ptr<BUS_ALIAS> > aliases;
|
||||||
vector< pair< shared_ptr<BUS_ALIAS>, shared_ptr<BUS_ALIAS> > > conflicts;
|
|
||||||
|
|
||||||
for( auto screen = screens.GetFirst(); screen != NULL; screen = screens.GetNext() )
|
for( auto screen = screens.GetFirst(); screen != NULL; screen = screens.GetNext() )
|
||||||
{
|
{
|
||||||
auto screen_aliases = screen->GetBusAliases();
|
std::unordered_set< std::shared_ptr<BUS_ALIAS> > screen_aliases = screen->GetBusAliases();
|
||||||
|
|
||||||
for( auto alias : screen_aliases )
|
for( const std::shared_ptr<BUS_ALIAS>& alias : screen_aliases )
|
||||||
{
|
{
|
||||||
for( auto test : aliases )
|
for( const std::shared_ptr<BUS_ALIAS>& test : aliases )
|
||||||
{
|
{
|
||||||
if( alias->GetName() == test->GetName() &&
|
if( alias->GetName() == test->GetName() && alias->Members() != test->Members() )
|
||||||
alias->Members() != test->Members() )
|
|
||||||
{
|
{
|
||||||
conflicts.push_back( std::make_pair( alias, test ) );
|
if( aCreateMarker )
|
||||||
|
{
|
||||||
|
msg = wxString::Format( _( "Bus alias %s has conflicting definitions on"
|
||||||
|
"multiple sheets: %s and %s" ),
|
||||||
|
alias->GetName(),
|
||||||
|
alias->GetParent()->GetFileName(),
|
||||||
|
test->GetParent()->GetFileName() );
|
||||||
|
|
||||||
|
SCH_MARKER* marker = new SCH_MARKER();
|
||||||
|
marker->SetData( ERCE_BUS_ALIAS_CONFLICT, dummyPos, msg, dummyPos );
|
||||||
|
marker->SetMarkerType( MARKER_BASE::MARKER_ERC );
|
||||||
|
marker->SetErrorLevel( MARKER_BASE::MARKER_SEVERITY_ERROR );
|
||||||
|
|
||||||
|
test->GetParent()->Append( marker );
|
||||||
|
}
|
||||||
|
|
||||||
|
++err_count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
aliases.insert( aliases.end(),
|
aliases.insert( aliases.end(), screen_aliases.begin(), screen_aliases.end() );
|
||||||
screen_aliases.begin(), screen_aliases.end() );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !conflicts.empty() )
|
|
||||||
{
|
|
||||||
if( aCreateMarker )
|
|
||||||
{
|
|
||||||
wxString msg;
|
|
||||||
|
|
||||||
for( auto conflict : conflicts )
|
|
||||||
{
|
|
||||||
auto marker = new SCH_MARKER();
|
|
||||||
auto a1 = conflict.first;
|
|
||||||
auto a2 = conflict.second;
|
|
||||||
|
|
||||||
msg.Printf( _( "Bus alias %s has conflicting definitions on multiple sheets: " ),
|
|
||||||
GetChars( a1->GetName() ) );
|
|
||||||
|
|
||||||
wxFileName f1 = a1->GetParent()->GetFileName();
|
|
||||||
wxFileName f2 = a2->GetParent()->GetFileName();
|
|
||||||
|
|
||||||
msg << f1.GetFullName() << " and " << f2.GetFullName();
|
|
||||||
|
|
||||||
marker->SetData( ERCE_BUS_ALIAS_CONFLICT, wxPoint( 0, 0 ),
|
|
||||||
msg, wxPoint( 0, 0 ) );
|
|
||||||
marker->SetMarkerType( MARKER_BASE::MARKER_ERC );
|
|
||||||
marker->SetErrorLevel( MARKER_BASE::MARKER_SEVERITY_ERROR );
|
|
||||||
|
|
||||||
a2->GetParent()->Append( marker );
|
|
||||||
|
|
||||||
++err_count;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return err_count;
|
return err_count;
|
||||||
|
@ -313,7 +289,7 @@ int TestMultiunitFootprints( SCH_SHEET_LIST& aSheetList )
|
||||||
wxString fp;
|
wxString fp;
|
||||||
wxString unitName;
|
wxString unitName;
|
||||||
|
|
||||||
for( unsigned i = 0; i < component.second.GetCount(); ++i )
|
for( int i = 0; i < component.second.GetCount(); ++i )
|
||||||
{
|
{
|
||||||
SCH_COMPONENT* cmp = refList.GetItem( i ).GetComp();
|
SCH_COMPONENT* cmp = refList.GetItem( i ).GetComp();
|
||||||
SCH_SHEET_PATH sheetPath = refList.GetItem( i ).GetSheetPath();
|
SCH_SHEET_PATH sheetPath = refList.GetItem( i ).GetSheetPath();
|
||||||
|
@ -327,7 +303,7 @@ int TestMultiunitFootprints( SCH_SHEET_LIST& aSheetList )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for( unsigned i = 0; i < component.second.GetCount(); ++i )
|
for( int i = 0; i < component.second.GetCount(); ++i )
|
||||||
{
|
{
|
||||||
SCH_REFERENCE& ref = refList.GetItem( i );
|
SCH_REFERENCE& ref = refList.GetItem( i );
|
||||||
SCH_COMPONENT* unit = ref.GetComp();
|
SCH_COMPONENT* unit = ref.GetComp();
|
||||||
|
@ -362,8 +338,7 @@ int TestMultiunitFootprints( SCH_SHEET_LIST& aSheetList )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Diagnose( NETLIST_OBJECT* aNetItemRef, NETLIST_OBJECT* aNetItemTst,
|
void Diagnose( NETLIST_OBJECT* aNetItemRef, NETLIST_OBJECT* aNetItemTst, int aMinConn, int aDiag )
|
||||||
int aMinConn, int aDiag )
|
|
||||||
{
|
{
|
||||||
SCH_MARKER* marker = NULL;
|
SCH_MARKER* marker = NULL;
|
||||||
SCH_SCREEN* screen;
|
SCH_SCREEN* screen;
|
||||||
|
@ -403,10 +378,7 @@ void Diagnose( NETLIST_OBJECT* aNetItemRef, NETLIST_OBJECT* aNetItemTst,
|
||||||
GetChars( GetText( ii ) ),
|
GetChars( GetText( ii ) ),
|
||||||
GetChars( cmp_ref ),
|
GetChars( cmp_ref ),
|
||||||
aNetItemRef->GetNet() );
|
aNetItemRef->GetNet() );
|
||||||
marker->SetData( ERCE_PIN_NOT_DRIVEN,
|
marker->SetData( ERCE_PIN_NOT_DRIVEN, aNetItemRef->m_Start, msg, aNetItemRef->m_Start );
|
||||||
aNetItemRef->m_Start,
|
|
||||||
msg,
|
|
||||||
aNetItemRef->m_Start );
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -442,8 +414,7 @@ void Diagnose( NETLIST_OBJECT* aNetItemRef, NETLIST_OBJECT* aNetItemTst,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TestOthersItems( NETLIST_OBJECT_LIST* aList,
|
void TestOthersItems( NETLIST_OBJECT_LIST* aList, unsigned aNetItemRef, unsigned aNetStart,
|
||||||
unsigned aNetItemRef, unsigned aNetStart,
|
|
||||||
int* aMinConnexion )
|
int* aMinConnexion )
|
||||||
{
|
{
|
||||||
unsigned netItemTst = aNetStart;
|
unsigned netItemTst = aNetStart;
|
||||||
|
@ -597,17 +568,12 @@ int NETLIST_OBJECT_LIST::CountPinsInNet( unsigned aNetStart )
|
||||||
|
|
||||||
bool WriteDiagnosticERC( EDA_UNITS_T aUnits, const wxString& aFullFileName )
|
bool WriteDiagnosticERC( EDA_UNITS_T aUnits, const wxString& aFullFileName )
|
||||||
{
|
{
|
||||||
wxString msg;
|
|
||||||
|
|
||||||
wxFFile file( aFullFileName, wxT( "wt" ) );
|
wxFFile file( aFullFileName, wxT( "wt" ) );
|
||||||
|
|
||||||
if( !file.IsOpened() )
|
if( !file.IsOpened() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
msg = _( "ERC report" );
|
wxString msg = wxString::Format( _( "ERC report (%s, Encoding UTF8)\n" ), DateAndTime() );
|
||||||
msg << wxT(" (") << DateAndTime() << wxT( ", " )
|
|
||||||
<< _( "Encoding UTF8" ) << wxT( " )\n" );
|
|
||||||
|
|
||||||
int err_count = 0;
|
int err_count = 0;
|
||||||
int warn_count = 0;
|
int warn_count = 0;
|
||||||
int total_count = 0;
|
int total_count = 0;
|
||||||
|
@ -724,7 +690,7 @@ struct compare_paths
|
||||||
};
|
};
|
||||||
|
|
||||||
// Helper functions to build the warning messages about Similar Labels:
|
// Helper functions to build the warning messages about Similar Labels:
|
||||||
static int countIndenticalLabels( std::vector<NETLIST_OBJECT*>& aList, NETLIST_OBJECT* aLabel );
|
static int countIndenticalLabels( std::vector<NETLIST_OBJECT*>& aList, NETLIST_OBJECT* aRef );
|
||||||
static void SimilarLabelsDiagnose( NETLIST_OBJECT* aItemA, NETLIST_OBJECT* aItemB );
|
static void SimilarLabelsDiagnose( NETLIST_OBJECT* aItemA, NETLIST_OBJECT* aItemB );
|
||||||
|
|
||||||
|
|
||||||
|
@ -851,28 +817,23 @@ void NETLIST_OBJECT_LIST::TestforSimilarLabels()
|
||||||
// Helper function: count the number of labels identical to aLabel
|
// Helper function: count the number of labels identical to aLabel
|
||||||
// for global label: global labels in the full project
|
// for global label: global labels in the full project
|
||||||
// for local label: all labels in the current sheet
|
// for local label: all labels in the current sheet
|
||||||
static int countIndenticalLabels( std::vector<NETLIST_OBJECT*>& aList, NETLIST_OBJECT* aLabel )
|
static int countIndenticalLabels( std::vector<NETLIST_OBJECT*>& aList, NETLIST_OBJECT* aRef )
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
if( aLabel->IsLabelGlobal() )
|
if( aRef->IsLabelGlobal() )
|
||||||
{
|
{
|
||||||
for( unsigned netItem = 0; netItem < aList.size(); ++netItem )
|
for( auto i : aList)
|
||||||
{
|
{
|
||||||
NETLIST_OBJECT* item = aList[netItem];
|
if( i->IsLabelGlobal() && i->m_Label == aRef->m_Label )
|
||||||
|
|
||||||
if( item->IsLabelGlobal() && item->m_Label == aLabel->m_Label )
|
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for( unsigned netItem = 0; netItem < aList.size(); ++netItem )
|
for( auto i : aList)
|
||||||
{
|
{
|
||||||
NETLIST_OBJECT* item = aList[netItem];
|
if( i->m_Label == aRef->m_Label && i->m_SheetPath.Path() == aRef->m_SheetPath.Path() )
|
||||||
|
|
||||||
if( item->m_Label == aLabel->m_Label &&
|
|
||||||
item->m_SheetPath.Path() == aLabel->m_SheetPath.Path() )
|
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -892,18 +853,17 @@ static void SimilarLabelsDiagnose( NETLIST_OBJECT* aItemA, NETLIST_OBJECT* aItem
|
||||||
SCH_SCREEN* screen = aItemA->m_SheetPath.LastScreen();
|
SCH_SCREEN* screen = aItemA->m_SheetPath.LastScreen();
|
||||||
screen->Append( marker );
|
screen->Append( marker );
|
||||||
|
|
||||||
wxString fmt = aItemA->IsLabelGlobal() ?
|
wxString fmt = aItemA->IsLabelGlobal() ? _( "Global label '%s' (sheet '%s') looks like:" ) :
|
||||||
_( "Global label \"%s\" (sheet \"%s\") looks like:" ) :
|
_( "Local label '%s' (sheet '%s') looks like:" );
|
||||||
_( "Local label \"%s\" (sheet \"%s\") looks like:" );
|
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
msg.Printf( fmt, GetChars( aItemA->m_Label ), GetChars( aItemA->m_SheetPath.PathHumanReadable() ) );
|
msg.Printf( fmt, aItemA->m_Label, aItemA->m_SheetPath.PathHumanReadable() );
|
||||||
marker->SetData( aItemA->IsLabelGlobal() && aItemB->IsLabelGlobal() ?
|
marker->SetData( aItemA->IsLabelGlobal() && aItemB->IsLabelGlobal() ?
|
||||||
ERCE_SIMILAR_GLBL_LABELS : ERCE_SIMILAR_LABELS,
|
ERCE_SIMILAR_GLBL_LABELS : ERCE_SIMILAR_LABELS,
|
||||||
aItemA->m_Start, msg, aItemA->m_Start );
|
aItemA->m_Start, msg, aItemA->m_Start );
|
||||||
|
|
||||||
fmt = aItemB->IsLabelGlobal() ? _( "Global label \"%s\" (sheet \"%s\")" ) :
|
fmt = aItemB->IsLabelGlobal() ? _( "Global label \"%s\" (sheet \"%s\")" ) :
|
||||||
_( "Local label \"%s\" (sheet \"%s\")" );
|
_( "Local label \"%s\" (sheet \"%s\")" );
|
||||||
msg.Printf( fmt, GetChars( aItemB->m_Label ), GetChars( aItemB->m_SheetPath.PathHumanReadable() ) );
|
msg.Printf( fmt, aItemB->m_Label, aItemB->m_SheetPath.PathHumanReadable() );
|
||||||
marker->SetAuxiliaryData( msg, aItemB->m_Start );
|
marker->SetAuxiliaryData( msg, aItemB->m_Start );
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
#include <base_units.h>
|
#include <base_units.h>
|
||||||
|
|
||||||
#include <sch_marker.h>
|
#include <sch_marker.h>
|
||||||
#include <erc.h>
|
|
||||||
|
|
||||||
/// Factor to convert the maker unit shape to internal units:
|
/// Factor to convert the maker unit shape to internal units:
|
||||||
#define SCALING_FACTOR Millimeter2iu( 0.1 )
|
#define SCALING_FACTOR Millimeter2iu( 0.1 )
|
||||||
|
@ -65,8 +64,7 @@ void SCH_MARKER::SwapData( SCH_ITEM* aItem )
|
||||||
void SCH_MARKER::Show( int nestLevel, std::ostream& os ) const
|
void SCH_MARKER::Show( int nestLevel, std::ostream& os ) const
|
||||||
{
|
{
|
||||||
// for now, make it look like XML:
|
// for now, make it look like XML:
|
||||||
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str()
|
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << GetPos() << "/>\n";
|
||||||
<< GetPos() << "/>\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -97,8 +95,9 @@ bool SCH_MARKER::Matches( wxFindReplaceData& aSearchData, void* aAuxData )
|
||||||
|
|
||||||
void SCH_MARKER::ViewGetLayers( int aLayers[], int& aCount ) const
|
void SCH_MARKER::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||||
{
|
{
|
||||||
aCount = 1;
|
aCount = 2;
|
||||||
aLayers[0] = this->m_ErrorLevel == MARKER_SEVERITY_ERROR ? LAYER_ERC_ERR : LAYER_ERC_WARN;
|
aLayers[0] = this->m_ErrorLevel == MARKER_SEVERITY_ERROR ? LAYER_ERC_ERR : LAYER_ERC_WARN;
|
||||||
|
aLayers[1] = LAYER_SELECTION_SHADOWS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1622,13 +1622,14 @@ void SCH_PAINTER::draw( SCH_MARKER *aMarker, int aLayer )
|
||||||
if( drawingShadows && !aMarker->IsSelected() )
|
if( drawingShadows && !aMarker->IsSelected() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int layer = LAYER_ERC_WARN;
|
|
||||||
|
|
||||||
if( aMarker->GetErrorLevel() == MARKER_BASE::MARKER_SEVERITY_ERROR )
|
if( aMarker->GetErrorLevel() == MARKER_BASE::MARKER_SEVERITY_ERROR )
|
||||||
layer = LAYER_ERC_ERR;
|
aLayer = LAYER_ERC_ERR;
|
||||||
|
else
|
||||||
|
aLayer = LAYER_ERC_WARN;
|
||||||
|
|
||||||
COLOR4D color = getRenderColor( aMarker, layer, drawingShadows );
|
COLOR4D color = getRenderColor( aMarker, aLayer, drawingShadows );
|
||||||
|
|
||||||
|
m_gal->Save();
|
||||||
m_gal->Translate( aMarker->GetPosition() );
|
m_gal->Translate( aMarker->GetPosition() );
|
||||||
m_gal->SetIsFill( !drawingShadows );
|
m_gal->SetIsFill( !drawingShadows );
|
||||||
m_gal->SetFillColor( color );
|
m_gal->SetFillColor( color );
|
||||||
|
@ -1640,6 +1641,7 @@ void SCH_PAINTER::draw( SCH_MARKER *aMarker, int aLayer )
|
||||||
aMarker->ShapeToPolygon( polygon );
|
aMarker->ShapeToPolygon( polygon );
|
||||||
|
|
||||||
m_gal->DrawPolygon( polygon );
|
m_gal->DrawPolygon( polygon );
|
||||||
|
m_gal->Restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue