Commit 30c7821b authored by jean-pierre charras's avatar jean-pierre charras
Browse files

Grebview: add info in layer manager for Excellon drill filles, similar to X2...

Grebview: add info in layer manager for Excellon drill filles, similar to X2 file function info in X2 gerber files.
parent 49fa6f92
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -548,6 +548,9 @@ int EDA_BASE_FRAME::ReadHotkeyConfigFile( const wxString& aFilename,
{
    wxFile cfgfile( aFilename );

    if( !cfgfile.IsOpened() )       // There is a problem to open file
        return 0;

    // get length
    cfgfile.SeekEnd();
    wxFileOffset size = cfgfile.Tell();
+1 −1
Original line number Diff line number Diff line
@@ -455,7 +455,7 @@ const wxString GERBER_IMAGE_LIST::GetDisplayName( int aIdx )
    if( aIdx >= 0 && aIdx < (int)m_GERBER_List.size() )
        gerber = m_GERBER_List[aIdx];

    if( gerber && gerber->m_InUse)
    if( IsUsed(aIdx ) )
    {
        if( gerber->m_FileFunction )
            name.Printf( _( "Layer %d (%s, %s)" ), aIdx + 1,
+1 −1
Original line number Diff line number Diff line
/*
 * This program source code file is part of KiCad, a free EDA CAD application.
 *
 * Copyright (C) 2004-2010 Jean-Pierre Charras, jean-pierre.charras@gpisa-lab.inpg.fr
 * Copyright (C) 2004-2010 Jean-Pierre Charras, jp.charras at wanadoo.fr
 * Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
 * Copyright (C) 2010 KiCad Developers, see change_log.txt for contributors.
 *
+27 −11
Original line number Diff line number Diff line
@@ -8,8 +8,8 @@
/*
 * This program source code file is part of KiCad, a free EDA CAD application.
 *
 * Copyright (C) 1992-2011 Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
 * Copyright (C) 1992-2011 KiCad Developers, see change_log.txt for contributors.
 * Copyright (C) 1992-2014 Jean-Pierre Charras <jp.charras at wanadoo.fr>
 * Copyright (C) 1992-2014 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
@@ -75,6 +75,7 @@
#include <class_GERBER.h>
#include <class_excellon.h>
#include <kicad_string.h>
#include <class_X2_gerber_attributes.h>

#include <cmath>

@@ -105,6 +106,12 @@ void fillLineGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
                              wxSize            aPenSize,
                              bool              aLayerNegative  );

// Getber X2 files have a file attribute which specify the type of image
// (copper, solder paste ... and sides tpo, bottom or inner copper layers)
// Excellon drill files do not have attributes, so, just to identify the image
// In gerbview, we add this attribute, like a Gerber drill file
static const char file_attribute[] = ".FileFunction,Other,Drill*";

static EXCELLON_CMD excellonHeaderCmdList[] =
{
    { "M0",     DRILL_M_END,                 -1 },  // End of Program - No Rewind
@@ -168,16 +175,16 @@ static EXCELLON_CMD excellon_G_CmdList[] =
bool GERBVIEW_FRAME::Read_EXCELLON_File( const wxString& aFullFileName )
{
    wxString msg;
    int layer = getActiveLayer();      // current layer used in GerbView
    EXCELLON_IMAGE* drill_Layer = (EXCELLON_IMAGE*) g_GERBER_List.GetGbrImage( layer );
    int layerId = getActiveLayer();      // current layer used in GerbView
    EXCELLON_IMAGE* drill_Layer = (EXCELLON_IMAGE*) g_GERBER_List.GetGbrImage( layerId );

    if( drill_Layer == NULL )
    {
        drill_Layer = new EXCELLON_IMAGE( this, layer );
        layer = g_GERBER_List.AddGbrImage( drill_Layer, layer );
        drill_Layer = new EXCELLON_IMAGE( this, layerId );
        layerId = g_GERBER_List.AddGbrImage( drill_Layer, layerId );
    }

    if( layer < 0 )
    if( layerId < 0 )
    {
        DisplayError( this, _( "No room to load file" ) );
        return false;
@@ -220,7 +227,7 @@ bool EXCELLON_IMAGE::Read_EXCELLON_File( FILE * aFile,
    m_FileName = aFullFileName;
    m_Current_File = aFile;

    SetLocaleTo_C_standard();
    LOCALE_IO toggleIo;

    // FILE_LINE_READER will close the file.
    if( m_Current_File == NULL )
@@ -289,7 +296,16 @@ bool EXCELLON_IMAGE::Read_EXCELLON_File( FILE * aFile,
            }   // End switch
        }
    }
    SetLocaleTo_Default();

    // Add our file attribute, to identify the drill file
    X2_ATTRIBUTE dummy;
    char* text = (char*)file_attribute;
    dummy.ParseAttribCmd( m_Current_File, NULL, 0, text );
    delete m_FileFunction;
    m_FileFunction = new X2_ATTRIBUTE_FILEFUNCTION( dummy );

    m_InUse = true;

    return true;
}

+2 −2
Original line number Diff line number Diff line
@@ -77,7 +77,7 @@ bool GERBVIEW_FRAME::Read_GERBER_File( const wxString& GERBER_FullFileName,
    if( path != wxEmptyString )
        wxSetWorkingDirectory( path );

    SetLocaleTo_C_standard();
    LOCALE_IO toggleIo;

    while( true )
    {
@@ -171,8 +171,8 @@ bool GERBVIEW_FRAME::Read_GERBER_File( const wxString& GERBER_FullFileName,
            }
        }
    }

    fclose( gerber->m_Current_File );
    SetLocaleTo_Default();

    gerber->m_InUse = true;

+1 −1

File changed.

Contains only whitespace changes.

+1 −1

File changed.

Contains only whitespace changes.

Loading