From c9b9ccd2b607adc123a4aa9139f8831d79c86bf3 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 9 Mar 2015 10:25:39 +0100 Subject: [PATCH] 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. --- demos/ecc83/ecc83-pp_v2.kicad_pcb | 93 ++++++++++++++-------------- eeschema/load_one_schematic_file.cpp | 41 +++++------- pcbnew/class_text_mod.cpp | 7 +-- 3 files changed, 65 insertions(+), 76 deletions(-) diff --git a/demos/ecc83/ecc83-pp_v2.kicad_pcb b/demos/ecc83/ecc83-pp_v2.kicad_pcb index dcfca8358c..a4a6dbbf2e 100644 --- a/demos/ecc83/ecc83-pp_v2.kicad_pcb +++ b/demos/ecc83/ecc83-pp_v2.kicad_pcb @@ -1,4 +1,4 @@ -(kicad_pcb (version 4) (host pcbnew "(2014-12-31 BZR 5344)-product") +(kicad_pcb (version 4) (host pcbnew "(2015-03-04 BZR 5478)-product") (general (links 21) @@ -58,11 +58,11 @@ (mod_edge_width 0.381) (mod_text_size 1.524 1.524) (mod_text_width 0.3048) - (pad_size 2.794 1.397) - (pad_drill 1.9304) + (pad_size 4.50088 4.50088) + (pad_drill 3.0988) (pad_to_mask_clearance 0.1) (aux_axis_origin 0 0) - (visible_elements 7FFFF7FF) + (visible_elements 7FFFFFFF) (pcbplotparams (layerselection 0x00030_80000001) (usegerberextensions true) @@ -475,7 +475,7 @@ (net 13 "Net-(P8-Pad1)")) ) - (module Valves:VALVE-ECC-83-2 (layer Dessus) (tedit 54A5A61F) (tstamp 54A5A6B2) + (module Valves:VALVE-ECC-83-2 (layer Dessus) (tedit 54FC7E9D) (tstamp 54A5A6B2) (at 149.3 109.2) (path /48B4F266) (fp_text reference U1 (at 0 -11.43) (layer F.SilkS) @@ -503,8 +503,7 @@ (net 4 "Net-(C2-Pad2)")) (pad 9 thru_hole oval (at -3.4544 4.75488 54) (size 2.032 3.048) (drill oval 1.016 2.032) (layers *.Cu *.Mask F.SilkS) (net 7 "Net-(P4-Pad2)")) - (pad 2 thru_hole circle (at 0 0) (size 4.50088 4.50088) (drill 3.0988) (layers *.Cu *.Mask F.SilkS) - (net 5 "Net-(P1-Pad2)")) + (pad 0 thru_hole circle (at 0 0) (size 4.50088 4.50088) (drill 3.0988) (layers *.Cu *.Mask F.SilkS)) (model Valves/VALVE-ECC-83-2.wrl (at (xyz 0 0 0)) (scale (xyz 1 1 1)) @@ -518,54 +517,54 @@ (gr_line (start 120.015 90.805) (end 120.015 132.715) (angle 90) (layer Edge.Cuts) (width 0.381)) (segment (start 165.1 123.825) (end 165.354 123.825) (width 0.8636) (layer Dessous) (net 1) (status 30)) - (segment (start 124.46 102.87) (end 125.73 101.6) (width 0.8636) (layer Dessous) (net 2)) - (segment (start 131.445 101.6) (end 142.90548 101.6) (width 0.8636) (layer Dessous) (net 2) (status 810)) - (segment (start 142.90548 101.6) (end 145.7706 104.46512) (width 0.8636) (layer Dessous) (net 2) (status 420)) - (segment (start 123.19 102.87) (end 124.46 102.87) (width 0.8636) (layer Dessous) (net 2) (status 810)) (segment (start 125.73 101.6) (end 131.445 101.6) (width 0.8636) (layer Dessous) (net 2) (status 420)) - (segment (start 128.905 111.125) (end 123.19 111.125) (width 0.8636) (layer Dessous) (net 3) (status 420)) - (segment (start 131.445 108.585) (end 128.905 111.125) (width 0.8636) (layer Dessous) (net 3) (status 810)) - (segment (start 123.825 114.935) (end 123.19 114.3) (width 0.8636) (layer Dessous) (net 3) (status 10)) - (segment (start 123.19 114.3) (end 123.19 111.125) (width 0.8636) (layer Dessous) (net 3) (status 20)) + (segment (start 123.19 102.87) (end 124.46 102.87) (width 0.8636) (layer Dessous) (net 2) (status 810)) + (segment (start 142.90548 101.6) (end 145.7706 104.46512) (width 0.8636) (layer Dessous) (net 2) (status 420)) + (segment (start 131.445 101.6) (end 142.90548 101.6) (width 0.8636) (layer Dessous) (net 2) (status 810)) + (segment (start 124.46 102.87) (end 125.73 101.6) (width 0.8636) (layer Dessous) (net 2)) (segment (start 124.46 114.935) (end 123.825 114.935) (width 0.8636) (layer Dessous) (net 3) (status 30)) - (segment (start 131.445 128.905) (end 140.97 128.905) (width 0.8636) (layer Dessous) (net 4) (status C30)) - (segment (start 143.61668 111.00816) (end 143.61668 111.65332) (width 0.8636) (layer Dessous) (net 4) (status 830)) - (segment (start 143.51 127.635) (end 143.51 116.84) (width 0.8636) (layer Dessous) (net 4)) - (segment (start 142.24 128.905) (end 143.51 127.635) (width 0.8636) (layer Dessous) (net 4)) - (segment (start 140.97 128.905) (end 142.24 128.905) (width 0.8636) (layer Dessous) (net 4) (status 810)) - (segment (start 143.61668 111.65332) (end 142.875 112.395) (width 0.8636) (layer Dessous) (net 4) (status 10)) - (segment (start 142.875 112.395) (end 142.875 116.205) (width 0.8636) (layer Dessous) (net 4)) + (segment (start 123.19 114.3) (end 123.19 111.125) (width 0.8636) (layer Dessous) (net 3) (status 20)) + (segment (start 123.825 114.935) (end 123.19 114.3) (width 0.8636) (layer Dessous) (net 3) (status 10)) + (segment (start 131.445 108.585) (end 128.905 111.125) (width 0.8636) (layer Dessous) (net 3) (status 810)) + (segment (start 128.905 111.125) (end 123.19 111.125) (width 0.8636) (layer Dessous) (net 3) (status 420)) (segment (start 142.875 116.205) (end 143.51 116.84) (width 0.8636) (layer Dessous) (net 4)) - (segment (start 154.83332 111.0488) (end 159.9438 111.0488) (width 0.8636) (layer Dessous) (net 5) (status 810)) - (segment (start 165.1 113.03) (end 165.1 116.205) (width 0.8636) (layer Dessous) (net 5) (status C30)) - (segment (start 159.9438 111.0488) (end 161.925 113.03) (width 0.8636) (layer Dessous) (net 5)) + (segment (start 142.875 112.395) (end 142.875 116.205) (width 0.8636) (layer Dessous) (net 4)) + (segment (start 143.61668 111.65332) (end 142.875 112.395) (width 0.8636) (layer Dessous) (net 4) (status 10)) + (segment (start 140.97 128.905) (end 142.24 128.905) (width 0.8636) (layer Dessous) (net 4) (status 810)) + (segment (start 142.24 128.905) (end 143.51 127.635) (width 0.8636) (layer Dessous) (net 4)) + (segment (start 143.51 127.635) (end 143.51 116.84) (width 0.8636) (layer Dessous) (net 4)) + (segment (start 143.61668 111.00816) (end 143.61668 111.65332) (width 0.8636) (layer Dessous) (net 4) (status 830)) + (segment (start 131.445 128.905) (end 140.97 128.905) (width 0.8636) (layer Dessous) (net 4) (status C30)) (segment (start 161.925 113.03) (end 165.1 113.03) (width 0.8636) (layer Dessous) (net 5) (status 420)) - (segment (start 152.7544 104.44512) (end 152.7544 105.5456) (width 0.8636) (layer Dessous) (net 6) (status C00000)) - (segment (start 152.7544 105.5456) (end 152.5 105.8) (width 0.8636) (layer Dessous) (net 6) (tstamp 54A5A703) (status 400000)) - (segment (start 152.5 105.8) (end 152.5 110.7) (width 0.8636) (layer Dessous) (net 6) (tstamp 54A5A705)) - (segment (start 152.5 110.7) (end 149.86 113.34) (width 0.8636) (layer Dessous) (net 6) (tstamp 54A5A707)) - (segment (start 149.86 113.34) (end 149.86 115.697) (width 0.8636) (layer Dessous) (net 6) (tstamp 54A5A709)) - (segment (start 150.495 128.905) (end 150.495 116.332) (width 0.8636) (layer Dessous) (net 6) (status 810)) - (segment (start 151.54148 103.3272) (end 152.6794 104.46512) (width 0.8636) (layer Dessous) (net 6) (status 420)) - (segment (start 149.225 103.3272) (end 151.54148 103.3272) (width 0.8636) (layer Dessous) (net 6) (status 10)) + (segment (start 159.9438 111.0488) (end 161.925 113.03) (width 0.8636) (layer Dessous) (net 5)) + (segment (start 165.1 113.03) (end 165.1 116.205) (width 0.8636) (layer Dessous) (net 5) (status C30)) + (segment (start 154.83332 111.0488) (end 159.9438 111.0488) (width 0.8636) (layer Dessous) (net 5) (status 810)) (segment (start 149.86 115.697) (end 150.495 116.332) (width 0.8636) (layer Dessous) (net 6)) - (segment (start 147.955 116.15928) (end 145.7706 113.97488) (width 0.8636) (layer Dessous) (net 7) (status 420)) + (segment (start 149.225 103.3272) (end 151.54148 103.3272) (width 0.8636) (layer Dessous) (net 6) (status 10)) + (segment (start 151.54148 103.3272) (end 152.6794 104.46512) (width 0.8636) (layer Dessous) (net 6) (status 420)) + (segment (start 150.495 128.905) (end 150.495 116.332) (width 0.8636) (layer Dessous) (net 6) (status 810)) + (segment (start 149.86 113.34) (end 149.86 115.697) (width 0.8636) (layer Dessous) (net 6) (tstamp 54A5A709)) + (segment (start 152.5 110.7) (end 149.86 113.34) (width 0.8636) (layer Dessous) (net 6) (tstamp 54A5A707)) + (segment (start 152.5 105.8) (end 152.5 110.7) (width 0.8636) (layer Dessous) (net 6) (tstamp 54A5A705)) + (segment (start 152.7544 105.5456) (end 152.5 105.8) (width 0.8636) (layer Dessous) (net 6) (tstamp 54A5A703)) + (segment (start 152.7544 104.44512) (end 152.7544 105.5456) (width 0.8636) (layer Dessous) (net 6)) (segment (start 147.955 128.905) (end 147.955 116.15928) (width 0.8636) (layer Dessous) (net 7) (status 810)) - (segment (start 140.97 123.825) (end 139.065 125.73) (width 0.8636) (layer Dessous) (net 8)) - (segment (start 139.065 125.73) (end 130.175 125.73) (width 0.8636) (layer Dessous) (net 8)) - (segment (start 130.175 125.73) (end 128.905 127) (width 0.8636) (layer Dessous) (net 8)) - (segment (start 143.61668 107.3912) (end 142.1638 107.3912) (width 0.8636) (layer Dessous) (net 8) (status 810)) - (segment (start 140.97 108.585) (end 140.97 121.285) (width 0.8636) (layer Dessous) (net 8) (status 420)) - (segment (start 142.1638 107.3912) (end 140.97 108.585) (width 0.8636) (layer Dessous) (net 8)) - (segment (start 140.97 121.285) (end 140.97 123.825) (width 0.8636) (layer Dessous) (net 8) (status 810)) - (segment (start 154.94 116.23548) (end 152.6794 113.97488) (width 0.8636) (layer Dessous) (net 8) (status 420)) - (segment (start 154.94 130.175) (end 154.94 116.23548) (width 0.8636) (layer Dessous) (net 8)) - (segment (start 128.905 127) (end 128.905 130.175) (width 0.8636) (layer Dessous) (net 8)) - (segment (start 128.905 130.175) (end 130.175 131.445) (width 0.8636) (layer Dessous) (net 8)) - (segment (start 130.175 131.445) (end 153.67 131.445) (width 0.8636) (layer Dessous) (net 8)) + (segment (start 147.955 116.15928) (end 145.7706 113.97488) (width 0.8636) (layer Dessous) (net 7) (status 420)) (segment (start 153.67 131.445) (end 154.94 130.175) (width 0.8636) (layer Dessous) (net 8)) - (segment (start 165.0238 107.3912) (end 165.1 107.315) (width 0.8636) (layer Dessous) (net 9) (status 430)) + (segment (start 130.175 131.445) (end 153.67 131.445) (width 0.8636) (layer Dessous) (net 8)) + (segment (start 128.905 130.175) (end 130.175 131.445) (width 0.8636) (layer Dessous) (net 8)) + (segment (start 128.905 127) (end 128.905 130.175) (width 0.8636) (layer Dessous) (net 8)) + (segment (start 154.94 130.175) (end 154.94 116.23548) (width 0.8636) (layer Dessous) (net 8)) + (segment (start 154.94 116.23548) (end 152.6794 113.97488) (width 0.8636) (layer Dessous) (net 8) (status 420)) + (segment (start 140.97 121.285) (end 140.97 123.825) (width 0.8636) (layer Dessous) (net 8) (status 810)) + (segment (start 142.1638 107.3912) (end 140.97 108.585) (width 0.8636) (layer Dessous) (net 8)) + (segment (start 140.97 108.585) (end 140.97 121.285) (width 0.8636) (layer Dessous) (net 8) (status 420)) + (segment (start 143.61668 107.3912) (end 142.1638 107.3912) (width 0.8636) (layer Dessous) (net 8) (status 810)) + (segment (start 130.175 125.73) (end 128.905 127) (width 0.8636) (layer Dessous) (net 8)) + (segment (start 139.065 125.73) (end 130.175 125.73) (width 0.8636) (layer Dessous) (net 8)) + (segment (start 140.97 123.825) (end 139.065 125.73) (width 0.8636) (layer Dessous) (net 8)) (segment (start 154.83332 107.3912) (end 165.0238 107.3912) (width 0.8636) (layer Dessous) (net 9) (status 830)) + (segment (start 165.0238 107.3912) (end 165.1 107.315) (width 0.8636) (layer Dessous) (net 9) (status 430)) (zone (net 1) (net_name GND) (layer Dessous) (tstamp 4EED96A1) (hatch edge 0.508) (connect_pads (clearance 0.635)) diff --git a/eeschema/load_one_schematic_file.cpp b/eeschema/load_one_schematic_file.cpp index e63667c752..c174a7bf46 100644 --- a/eeschema/load_one_schematic_file.cpp +++ b/eeschema/load_one_schematic_file.cpp @@ -50,8 +50,6 @@ 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 ) { @@ -142,14 +140,25 @@ again." ); } #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 ) ); - DisplayError( this, msgDiag ); - return false; - } + line = reader.Line(); - LoadLayers( &reader ); + while( *line == ' ' ) + line++; + + if( strnicmp( line, "EELAYER END", 11 ) == 0 ) + break; // end of not used header found + } while( reader.ReadLine() ) { @@ -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 #define SZ( x ) (sizeof(x)-1) diff --git a/pcbnew/class_text_mod.cpp b/pcbnew/class_text_mod.cpp index 619710946b..a90b51e234 100644 --- a/pcbnew/class_text_mod.cpp +++ b/pcbnew/class_text_mod.cpp @@ -262,10 +262,8 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, wxASSERT( m_Parent ); BOARD* brd = GetBoard( ); - EDA_COLOR_T color = brd->GetLayerColor( GetLayer() ); - /* For reference and value suppress the element if the layer it is * on is on a disabled side, user text also has standard layer * hiding. @@ -317,15 +315,14 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, if( m_Mirror ) size.x = -size.x; - EDA_RECT* clipbox = panel? panel->GetClipBox() : NULL; - DrawGraphicText( clipbox, DC, pos, color, GetShownText(), orient, + DrawGraphicText( panel->GetClipBox(), DC, pos, color, GetShownText(), orient, size, m_HJustify, m_VJustify, width, m_Italic, m_Bold ); // Enable these line to draw the bounding box (debug tests purposes only) #if 0 { EDA_RECT BoundaryBox = GetBoundingBox(); - GRRect( clipbox, DC, BoundaryBox, 0, BROWN ); + GRRect( panel->GetClipBox(), DC, BoundaryBox, 0, BROWN ); } #endif }