Commit 72b90c6a authored by dickelbeck's avatar dickelbeck
Browse files

see change_log.txt

parent fcc86fb0
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -5,6 +5,26 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.

2008-Mar-1 UPDATE   Dick Hollenbeck <dick@softplc.com>
================================================================================
+pcbnew

    Changed ioascii.cpp to save and load board specific layer names, for DEBUG
    build only. I want to add class LAYER, see below. Added
    BOARD::SetLayerName(), BOARD::SetLayerType(), and BOARD::GetLayerType().
    Will add a UI for editing those soon as soon class LAYER is stable. The
    BOARD::SetLayerXXXX( int layerNdx, VALUE ) functions would simply route to
    LAYER::SetXXXX( VALUE ). Then layer specific global variables would migrate
    to the BOARD::LAYER[]s.

    Jean-Pierre please have a look at pcbstruct.h's class LAYER which is just a
    prototype for now.  EDA_BoardDesignSettings::m_LayerColor would go away,
    and then I would add ptr_vector<LAYER> to EDA_BoardDesignSettings or BOARD.
    Whether EDA_BoardDesignSettings or BOARD I don't have a strong preference.
    I understand this is a bunch of work, and there are tricks needed to handle
    adding and deleting the number of layers....


2008-Feb-29 UPDATE   Dick Hollenbeck <dick@softplc.com>
================================================================================
+pcbnew
+33 −1
Original line number Diff line number Diff line
@@ -148,6 +148,38 @@ struct CHEVELU;
/* Class to handle a board */
#include "class_board.h"


/**
 * Class LAYER
 * holds information pertinent to a layer of a BOARD.
 */
class LAYER
{
    wxString    m_Name;
    LAYER_T     m_Type;
    int         m_Color;
    bool        m_Visible;      // ? use flags in m_Color instead ?

public:
    bool   SetName( const wxString& aLayerName );

    const wxString& GetName();

    bool SetType( LAYER_T aLayerType );

    LAYER_T GetType();

    int GetColor()  { return m_Color; }

    void SetColor( int aColor )  { m_Color = aColor; }

    bool IsVisible();

    void SetVisible( bool isVisible );
};



// Class for handle current printed board design settings
#define HISTORY_NUMBER 8
class EDA_BoardDesignSettings
+26 −4
Original line number Diff line number Diff line
@@ -84,6 +84,27 @@ wxString BOARD::GetLayerName( int aLayerIndex ) const
}


bool BOARD::SetLayerName( int aLayerIndex, const wxString& aLayerName )
{
    // a dummy temporarily.
    D(printf("SetLayerName( %d, %s )\n", aLayerIndex, CONV_TO_UTF8(aLayerName) );)
    return true;
}


LAYER_T BOARD::GetLayerType( int aLayerIndex ) const
{
    return LT_SIGNAL;
}


bool BOARD::SetLayerType( int aLayerIndex, LAYER_T aLayerType )
{
    // a dummy temporarily.
    return true;
}


int BOARD::GetCopperLayerCount() const
{
    return m_BoardSettings->m_CopperLayerCount;
@@ -624,7 +645,8 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
}


/*  now using PcbGeneralLocateAndDisplay()
/*  now using PcbGeneralLocateAndDisplay(), but this remains a useful example
    of how the INSPECTOR can be used in a lightweight way.
// see pcbstruct.h
BOARD_ITEM* BOARD::FindPadOrModule( const wxPoint& refPos, int layer )
{
+46 −2
Original line number Diff line number Diff line
@@ -8,6 +8,19 @@
class ZONE_CONTAINER;
class EDA_BoardDesignSettings;


/**
 * Enum LAYER_T
 * gives the allowed types of layers, same as Specctra DSN spec.
 */
enum LAYER_T
{
    LT_SIGNAL,
    LT_POWER,
    LT_MIXED,
};


/***********************************************/
/* class BOARD : handle datas to build a board */
/***********************************************/
@@ -134,14 +147,45 @@ public:

    /**
     * Function GetLayerName
     * returns the name of the requested layer.  Hopefully layer names will
     * be stored in the BOARD.  This function anticipates that.
     * returns the name of the copper layer given by aLayerIndex.
     *
     * @param aLayerIndex A layer index, like COPPER_LAYER_N, etc.
     * @return wxString - the layer name.
     */
    wxString GetLayerName( int aLayerIndex ) const;

    /**
     * Function SetLayerName
     * changes the name of the layer given by aLayerIndex.
     *
     * @param aLayerIndex A layer index, like COPPER_LAYER_N, etc.
     * @param aLayerName The new layer name
     * @return bool - true if aLayerName was legal and unique amoung other
     *   layer names at other layer indices and aLayerIndex was within range, else false.
     */
    bool SetLayerName( int aLayerIndex, const wxString& aLayerName );

    /**
     * Function GetLayerType
     * returns the type of the copper layer given by aLayerIndex.
     *
     * @param aLayerIndex A layer index, like COPPER_LAYER_N, etc.
     * @return LAYER_T - the layer type, or LAYER_T(-1) if the
     *  index was out of range.
     */
    LAYER_T GetLayerType( int aLayerIndex ) const;

    /**
     * Function SetLayerName
     * changes the name of the layer given by aLayerIndex.
     *
     * @param aLayerIndex A layer index, like COPPER_LAYER_N, etc.
     * @param aLayerType The new layer type.
     * @return bool - true if aLayerType was legal and aLayerIndex was within range, else false.
     */
    bool SetLayerType( int aLayerIndex, LAYER_T aLayerType );


    /* Routines de calcul des nombres de segments pistes et zones */
    int     GetNumSegmTrack();
    int     GetNumSegmZone();
+95 −63
Original line number Diff line number Diff line
@@ -304,6 +304,18 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
            continue;
        }

        const int LAYERKEYZ = sizeof("Layer[")-1;

        if( strncmp( Line, "Layer[", LAYERKEYZ ) == 0 )
        {
            const char* cp = Line + LAYERKEYZ;
            int layer = atoi(cp);

            wxString layerName = CONV_FROM_UTF8( data );
            m_Pcb->SetLayerName( layer, layerName );
            continue;
        }

        if( stricmp( Line, "TrackWidth" ) == 0 )
        {
            g_DesignSettings.m_CurrentTrackWidth = atoi( data );
@@ -489,76 +501,92 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )

#ifdef PCBNEW
/***************************************************************/
static int WriteSetup( FILE* File, WinEDA_BasePcbFrame* frame )
static int WriteSetup( FILE* aFile, WinEDA_BasePcbFrame* aFrame
#if defined(DEBUG)
    , BOARD* aBoard
#endif
                      )
/***************************************************************/
{
    char text[1024];
    int  ii, jj;

    fprintf( File, "$SETUP\n" );
    fprintf( aFile, "$SETUP\n" );
    sprintf( text, "InternalUnit %f INCH\n", 1.0 / PCB_INTERNAL_UNIT );
    fprintf( File, text );
    fprintf( aFile, text );

    if( frame->GetScreen()->m_UserGridIsON )
    if( aFrame->GetScreen()->m_UserGridIsON )
        ii = jj = -1;
    else
    {
        ii = frame->GetScreen()->GetGrid().x;
        jj = frame->GetScreen()->GetGrid().y;
        ii = aFrame->GetScreen()->GetGrid().x;
        jj = aFrame->GetScreen()->GetGrid().y;
    }

    sprintf( text, "GridSize %d %d\n", ii, jj );
    fprintf( File, text );
    fprintf( aFile, text );

    sprintf( text, "UserGridSize %lf %lf %s\n",
             frame->GetScreen()->m_UserGrid.x, frame->GetScreen()->m_UserGrid.y,
             aFrame->GetScreen()->m_UserGrid.x, aFrame->GetScreen()->m_UserGrid.y,
             ( g_UserGrid_Unit == 0 ) ? "INCH" : "mm" );
    fprintf( File, text );
    fprintf( aFile, text );

    fprintf( aFile, "ZoneGridSize %d\n", g_GridRoutingSize );

    fprintf( File, "ZoneGridSize %d\n", g_GridRoutingSize );

    fprintf( File, "Layers %d\n", g_DesignSettings.m_CopperLayerCount );
    fprintf( File, "TrackWidth %d\n", g_DesignSettings.m_CurrentTrackWidth );
#if defined(DEBUG)
    fprintf( aFile, "Layers %d\n", aBoard->GetCopperLayerCount() );
    for( int layer=0;  layer<aBoard->GetCopperLayerCount();  ++layer )
    {
        fprintf( aFile, "Layer[%d] %s\n", layer, CONV_TO_UTF8( aBoard->GetLayerName(layer) ) );
    }

#else
    fprintf( aFile, "Layers %d\n", g_DesignSettings.m_CopperLayerCount );
#endif

    fprintf( aFile, "TrackWidth %d\n", g_DesignSettings.m_CurrentTrackWidth );
    for( ii = 0; ii < HISTORY_NUMBER; ii++ )
    {
        if( g_DesignSettings.m_TrackWidthHistory[ii] == 0 )
            break;
        fprintf( File, "TrackWidthHistory %d\n",
        fprintf( aFile, "TrackWidthHistory %d\n",
                 g_DesignSettings.m_TrackWidthHistory[ii] );
    }

    fprintf( File, "TrackClearence %d\n", g_DesignSettings.m_TrackClearence );
    fprintf( File, "ZoneClearence %d\n", g_DesignSettings.m_ZoneClearence );
    fprintf( aFile, "TrackClearence %d\n", g_DesignSettings.m_TrackClearence );
    fprintf( aFile, "ZoneClearence %d\n", g_DesignSettings.m_ZoneClearence );

    fprintf( aFile, "DrawSegmWidth %d\n", g_DesignSettings.m_DrawSegmentWidth );
    fprintf( aFile, "EdgeSegmWidth %d\n", g_DesignSettings.m_EdgeSegmentWidth );
    fprintf( aFile, "ViaSize %d\n", g_DesignSettings.m_CurrentViaSize );
    fprintf( aFile, "ViaDrill %d\n", g_DesignSettings.m_ViaDrill );

    fprintf( File, "DrawSegmWidth %d\n", g_DesignSettings.m_DrawSegmentWidth );
    fprintf( File, "EdgeSegmWidth %d\n", g_DesignSettings.m_EdgeSegmentWidth );
    fprintf( File, "ViaSize %d\n", g_DesignSettings.m_CurrentViaSize );
    fprintf( File, "ViaDrill %d\n", g_DesignSettings.m_ViaDrill );
    for( ii = 0; ii < HISTORY_NUMBER; ii++ )
    {
        if( g_DesignSettings.m_ViaSizeHistory[ii] == 0 )
            break;
        fprintf( File, "ViaSizeHistory %d\n", g_DesignSettings.m_ViaSizeHistory[ii] );
        fprintf( aFile, "ViaSizeHistory %d\n", g_DesignSettings.m_ViaSizeHistory[ii] );
    }

	fprintf( File, "MicroViaSize %d\n", g_DesignSettings.m_CurrentMicroViaSize);
	fprintf( File, "MicroViaDrill %d\n", g_DesignSettings.m_MicroViaDrill);
    fprintf( File, "MicroViasAllowed %d\n", g_DesignSettings.m_MicroViasAllowed);
    fprintf( aFile, "MicroViaSize %d\n", g_DesignSettings.m_CurrentMicroViaSize);
    fprintf( aFile, "MicroViaDrill %d\n", g_DesignSettings.m_MicroViaDrill);
    fprintf( aFile, "MicroViasAllowed %d\n", g_DesignSettings.m_MicroViasAllowed);

    fprintf( File, "TextPcbWidth %d\n", g_DesignSettings.m_PcbTextWidth );
    fprintf( File, "TextPcbSize %d %d\n",
    fprintf( aFile, "TextPcbWidth %d\n", g_DesignSettings.m_PcbTextWidth );
    fprintf( aFile, "TextPcbSize %d %d\n",
             g_DesignSettings.m_PcbTextSize.x, g_DesignSettings.m_PcbTextSize.y );

    fprintf( File, "EdgeModWidth %d\n", ModuleSegmentWidth );
    fprintf( File, "TextModSize %d %d\n", ModuleTextSize.x, ModuleTextSize.y );
    fprintf( File, "TextModWidth %d\n", ModuleTextWidth );
    fprintf( File, "PadSize %d %d\n", g_Pad_Master.m_Size.x, g_Pad_Master.m_Size.y );
    fprintf( File, "PadDrill %d\n", g_Pad_Master.m_Drill.x );
    fprintf( aFile, "EdgeModWidth %d\n", ModuleSegmentWidth );
    fprintf( aFile, "TextModSize %d %d\n", ModuleTextSize.x, ModuleTextSize.y );
    fprintf( aFile, "TextModWidth %d\n", ModuleTextWidth );
    fprintf( aFile, "PadSize %d %d\n", g_Pad_Master.m_Size.x, g_Pad_Master.m_Size.y );
    fprintf( aFile, "PadDrill %d\n", g_Pad_Master.m_Drill.x );

    fprintf( File, "AuxiliaryAxisOrg %d %d\n",
             frame->m_Auxiliary_Axis_Position.x, frame->m_Auxiliary_Axis_Position.y );
    fprintf( aFile, "AuxiliaryAxisOrg %d %d\n",
             aFrame->m_Auxiliary_Axis_Position.x, aFrame->m_Auxiliary_Axis_Position.y );

    fprintf( File, "$EndSETUP\n\n" );
    fprintf( aFile, "$EndSETUP\n\n" );
    return 1;
}

@@ -1029,7 +1057,11 @@ int WinEDA_PcbFrame::SavePcbFormatAscii( FILE* aFile )

    WriteGeneralDescrPcb( aFile );
    WriteSheetDescr( m_CurrentScreen, aFile );
    WriteSetup( aFile, this );
    WriteSetup( aFile, this
#if defined(DEBUG)
        , m_Pcb
#endif
               );

    rc = m_Pcb->Save( aFile );

Loading