Commit c9b9ccd2 authored by jean-pierre charras's avatar jean-pierre charras

Fix issue #1429665 (eeschema doesn't recognize .sch file when the LIBS section...

Fix issue #1429665 (eeschema doesn't recognize .sch file when the LIBS section is empty. But the section is not used, just a comment, therefore can be empty).
Very minor other fixes.
parent 086ff54e
This diff is collapsed.
...@@ -50,8 +50,6 @@ ...@@ -50,8 +50,6 @@
bool ReadSchemaDescr( LINE_READER* aLine, wxString& aMsgDiag, SCH_SCREEN* Window ); bool ReadSchemaDescr( LINE_READER* aLine, wxString& aMsgDiag, SCH_SCREEN* Window );
static void LoadLayers( LINE_READER* aLine );
bool SCH_EDIT_FRAME::LoadOneEEFile( SCH_SCREEN* aScreen, const wxString& aFullFileName, bool append ) bool SCH_EDIT_FRAME::LoadOneEEFile( SCH_SCREEN* aScreen, const wxString& aFullFileName, bool append )
{ {
...@@ -142,14 +140,25 @@ again." ); ...@@ -142,14 +140,25 @@ again." );
} }
#endif #endif
if( !reader.ReadLine() || strncmp( reader, "LIBS:", 5 ) != 0 ) // The next lines are the lib list section, and are mainly comments, like:
// LIBS:power
// the lib list is not used, but is in schematic file just in case.
// It is usually not empty, but we accept empty list.
// If empty, there is a legacy section, not used
// EELAYER i j
// and the last line is
// EELAYER END
// Skip all lines until end end of header EELAYER END is found
while( reader.ReadLine() )
{ {
msgDiag.Printf( _( "<%s> is NOT an Eeschema file!" ), GetChars( aFullFileName ) ); line = reader.Line();
DisplayError( this, msgDiag );
return false; while( *line == ' ' )
} line++;
LoadLayers( &reader ); if( strnicmp( line, "EELAYER END", 11 ) == 0 )
break; // end of not used header found
}
while( reader.ReadLine() ) while( reader.ReadLine() )
{ {
...@@ -270,22 +279,6 @@ again." ); ...@@ -270,22 +279,6 @@ again." );
} }
static void LoadLayers( LINE_READER* aLine )
{
/* read the layer descr
* legacy code, not actually used, so this section is just skipped
* read lines like
* EELAYER 25 0
* EELAYER END
*/
while( aLine->ReadLine() )
{
if( strnicmp( *aLine, "EELAYER END", 11 ) == 0 )
break;
}
}
/// Get the length of a string constant, at compile time /// Get the length of a string constant, at compile time
#define SZ( x ) (sizeof(x)-1) #define SZ( x ) (sizeof(x)-1)
......
...@@ -262,10 +262,8 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, ...@@ -262,10 +262,8 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
wxASSERT( m_Parent ); wxASSERT( m_Parent );
BOARD* brd = GetBoard( ); BOARD* brd = GetBoard( );
EDA_COLOR_T color = brd->GetLayerColor( GetLayer() ); EDA_COLOR_T color = brd->GetLayerColor( GetLayer() );
/* For reference and value suppress the element if the layer it is /* For reference and value suppress the element if the layer it is
* on is on a disabled side, user text also has standard layer * on is on a disabled side, user text also has standard layer
* hiding. * hiding.
...@@ -317,15 +315,14 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, ...@@ -317,15 +315,14 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
if( m_Mirror ) if( m_Mirror )
size.x = -size.x; size.x = -size.x;
EDA_RECT* clipbox = panel? panel->GetClipBox() : NULL; DrawGraphicText( panel->GetClipBox(), DC, pos, color, GetShownText(), orient,
DrawGraphicText( clipbox, DC, pos, color, GetShownText(), orient,
size, m_HJustify, m_VJustify, width, m_Italic, m_Bold ); size, m_HJustify, m_VJustify, width, m_Italic, m_Bold );
// Enable these line to draw the bounding box (debug tests purposes only) // Enable these line to draw the bounding box (debug tests purposes only)
#if 0 #if 0
{ {
EDA_RECT BoundaryBox = GetBoundingBox(); EDA_RECT BoundaryBox = GetBoundingBox();
GRRect( clipbox, DC, BoundaryBox, 0, BROWN ); GRRect( panel->GetClipBox(), DC, BoundaryBox, 0, BROWN );
} }
#endif #endif
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment