see change_log.txt

This commit is contained in:
dickelbeck 2008-03-01 13:15:41 +00:00
parent fcc86fb007
commit 72b90c6a8a
6 changed files with 221 additions and 69 deletions

View File

@ -5,6 +5,26 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. 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> 2008-Feb-29 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================ ================================================================================
+pcbnew +pcbnew

View File

@ -148,6 +148,38 @@ struct CHEVELU;
/* Class to handle a board */ /* Class to handle a board */
#include "class_board.h" #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 // Class for handle current printed board design settings
#define HISTORY_NUMBER 8 #define HISTORY_NUMBER 8
class EDA_BoardDesignSettings class EDA_BoardDesignSettings

View File

@ -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 int BOARD::GetCopperLayerCount() const
{ {
return m_BoardSettings->m_CopperLayerCount; 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 // see pcbstruct.h
BOARD_ITEM* BOARD::FindPadOrModule( const wxPoint& refPos, int layer ) BOARD_ITEM* BOARD::FindPadOrModule( const wxPoint& refPos, int layer )
{ {
@ -993,12 +1015,12 @@ void BOARD::Show( int nestLevel, std::ostream& os )
for( ; p; p = p->Next() ) for( ; p; p = p->Next() )
p->Show( nestLevel+2, os ); p->Show( nestLevel+2, os );
NestedSpace( nestLevel+1, os ) << "</zones>\n"; NestedSpace( nestLevel+1, os ) << "</zones>\n";
/* /*
NestedSpace( nestLevel+1, os ) << "<zone_container>\n"; NestedSpace( nestLevel+1, os ) << "<zone_container>\n";
for( ZONE_CONTAINERS::iterator i=m_ZoneDescriptorList.begin(); i!=m_ZoneDescriptorList.end(); ++i ) for( ZONE_CONTAINERS::iterator i=m_ZoneDescriptorList.begin(); i!=m_ZoneDescriptorList.end(); ++i )
(*i)->Show( nestLevel+2, os ); (*i)->Show( nestLevel+2, os );
NestedSpace( nestLevel+1, os ) << "</zone_container>\n"; NestedSpace( nestLevel+1, os ) << "</zone_container>\n";
*/ */
p = (BOARD_ITEM*) m_Son; p = (BOARD_ITEM*) m_Son;
for( ; p; p = p->Next() ) for( ; p; p = p->Next() )

View File

@ -8,6 +8,19 @@
class ZONE_CONTAINER; class ZONE_CONTAINER;
class EDA_BoardDesignSettings; 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 */ /* class BOARD : handle datas to build a board */
/***********************************************/ /***********************************************/
@ -134,14 +147,45 @@ public:
/** /**
* Function GetLayerName * Function GetLayerName
* returns the name of the requested layer. Hopefully layer names will * returns the name of the copper layer given by aLayerIndex.
* be stored in the BOARD. This function anticipates that.
* *
* @param aLayerIndex A layer index, like COPPER_LAYER_N, etc. * @param aLayerIndex A layer index, like COPPER_LAYER_N, etc.
* @return wxString - the layer name. * @return wxString - the layer name.
*/ */
wxString GetLayerName( int aLayerIndex ) const; 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 */ /* Routines de calcul des nombres de segments pistes et zones */
int GetNumSegmTrack(); int GetNumSegmTrack();
int GetNumSegmZone(); int GetNumSegmZone();

View File

@ -156,7 +156,7 @@ int WinEDA_BasePcbFrame::ReadListeSegmentDescr( FILE* File,
if( arg_count < 7 || drill <= 0 ) if( arg_count < 7 || drill <= 0 )
PtSegm->SetDrillDefault(); PtSegm->SetDrillDefault();
else else
PtSegm->SetDrillValue(drill); PtSegm->SetDrillValue(drill);
PtSegm->SetLayer( layer ); PtSegm->SetLayer( layer );
@ -304,6 +304,18 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
continue; 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 ) if( stricmp( Line, "TrackWidth" ) == 0 )
{ {
g_DesignSettings.m_CurrentTrackWidth = atoi( data ); g_DesignSettings.m_CurrentTrackWidth = atoi( data );
@ -489,76 +501,92 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
#ifdef PCBNEW #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]; char text[1024];
int ii, jj; int ii, jj;
fprintf( File, "$SETUP\n" ); fprintf( aFile, "$SETUP\n" );
sprintf( text, "InternalUnit %f INCH\n", 1.0 / PCB_INTERNAL_UNIT ); 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; ii = jj = -1;
else else
{ {
ii = frame->GetScreen()->GetGrid().x; ii = aFrame->GetScreen()->GetGrid().x;
jj = frame->GetScreen()->GetGrid().y; jj = aFrame->GetScreen()->GetGrid().y;
} }
sprintf( text, "GridSize %d %d\n", ii, jj ); sprintf( text, "GridSize %d %d\n", ii, jj );
fprintf( File, text ); fprintf( aFile, text );
sprintf( text, "UserGridSize %lf %lf %s\n", 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" ); ( g_UserGrid_Unit == 0 ) ? "INCH" : "mm" );
fprintf( File, text ); fprintf( aFile, text );
fprintf( File, "ZoneGridSize %d\n", g_GridRoutingSize ); fprintf( aFile, "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++ ) for( ii = 0; ii < HISTORY_NUMBER; ii++ )
{ {
if( g_DesignSettings.m_TrackWidthHistory[ii] == 0 ) if( g_DesignSettings.m_TrackWidthHistory[ii] == 0 )
break; break;
fprintf( File, "TrackWidthHistory %d\n", fprintf( aFile, "TrackWidthHistory %d\n",
g_DesignSettings.m_TrackWidthHistory[ii] ); g_DesignSettings.m_TrackWidthHistory[ii] );
} }
fprintf( File, "TrackClearence %d\n", g_DesignSettings.m_TrackClearence ); fprintf( aFile, "TrackClearence %d\n", g_DesignSettings.m_TrackClearence );
fprintf( File, "ZoneClearence %d\n", g_DesignSettings.m_ZoneClearence ); 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++ ) for( ii = 0; ii < HISTORY_NUMBER; ii++ )
{ {
if( g_DesignSettings.m_ViaSizeHistory[ii] == 0 ) if( g_DesignSettings.m_ViaSizeHistory[ii] == 0 )
break; 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( aFile, "MicroViaSize %d\n", g_DesignSettings.m_CurrentMicroViaSize);
fprintf( File, "MicroViaDrill %d\n", g_DesignSettings.m_MicroViaDrill); fprintf( aFile, "MicroViaDrill %d\n", g_DesignSettings.m_MicroViaDrill);
fprintf( File, "MicroViasAllowed %d\n", g_DesignSettings.m_MicroViasAllowed); fprintf( aFile, "MicroViasAllowed %d\n", g_DesignSettings.m_MicroViasAllowed);
fprintf( File, "TextPcbWidth %d\n", g_DesignSettings.m_PcbTextWidth ); fprintf( aFile, "TextPcbWidth %d\n", g_DesignSettings.m_PcbTextWidth );
fprintf( File, "TextPcbSize %d %d\n", fprintf( aFile, "TextPcbSize %d %d\n",
g_DesignSettings.m_PcbTextSize.x, g_DesignSettings.m_PcbTextSize.y ); g_DesignSettings.m_PcbTextSize.x, g_DesignSettings.m_PcbTextSize.y );
fprintf( File, "EdgeModWidth %d\n", ModuleSegmentWidth ); fprintf( aFile, "EdgeModWidth %d\n", ModuleSegmentWidth );
fprintf( File, "TextModSize %d %d\n", ModuleTextSize.x, ModuleTextSize.y ); fprintf( aFile, "TextModSize %d %d\n", ModuleTextSize.x, ModuleTextSize.y );
fprintf( File, "TextModWidth %d\n", ModuleTextWidth ); fprintf( aFile, "TextModWidth %d\n", ModuleTextWidth );
fprintf( File, "PadSize %d %d\n", g_Pad_Master.m_Size.x, g_Pad_Master.m_Size.y ); fprintf( aFile, "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, "PadDrill %d\n", g_Pad_Master.m_Drill.x );
fprintf( File, "AuxiliaryAxisOrg %d %d\n", fprintf( aFile, "AuxiliaryAxisOrg %d %d\n",
frame->m_Auxiliary_Axis_Position.x, frame->m_Auxiliary_Axis_Position.y ); aFrame->m_Auxiliary_Axis_Position.x, aFrame->m_Auxiliary_Axis_Position.y );
fprintf( File, "$EndSETUP\n\n" ); fprintf( aFile, "$EndSETUP\n\n" );
return 1; return 1;
} }
@ -841,11 +869,11 @@ int WinEDA_PcbFrame::ReadPcbFile( wxDC* DC, FILE* File, bool Append )
if( strnicmp( Line, "$CZONE_OUTLINE", 7 ) == 0 ) if( strnicmp( Line, "$CZONE_OUTLINE", 7 ) == 0 )
{ {
ZONE_CONTAINER * zone_descr = new ZONE_CONTAINER(m_Pcb); ZONE_CONTAINER * zone_descr = new ZONE_CONTAINER(m_Pcb);
zone_descr->ReadDescr( File, &LineNum ); zone_descr->ReadDescr( File, &LineNum );
m_Pcb->Add(zone_descr); m_Pcb->Add(zone_descr);
continue; continue;
} }
if( strnicmp( Line, "$MODULE", 7 ) == 0 ) if( strnicmp( Line, "$MODULE", 7 ) == 0 )
{ {
@ -992,8 +1020,8 @@ int WinEDA_PcbFrame::ReadPcbFile( wxDC* DC, FILE* File, bool Append )
Affiche_Message( wxEmptyString ); Affiche_Message( wxEmptyString );
BestZoom(); BestZoom();
DrawPanel->ReDraw(DC, true); DrawPanel->ReDraw(DC, true);
#ifdef PCBNEW #ifdef PCBNEW
Compile_Ratsnest( DC, TRUE ); Compile_Ratsnest( DC, TRUE );
@ -1029,7 +1057,11 @@ int WinEDA_PcbFrame::SavePcbFormatAscii( FILE* aFile )
WriteGeneralDescrPcb( aFile ); WriteGeneralDescrPcb( aFile );
WriteSheetDescr( m_CurrentScreen, aFile ); WriteSheetDescr( m_CurrentScreen, aFile );
WriteSetup( aFile, this ); WriteSetup( aFile, this
#if defined(DEBUG)
, m_Pcb
#endif
);
rc = m_Pcb->Save( aFile ); rc = m_Pcb->Save( aFile );

View File

@ -640,6 +640,7 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, MODULE* aModule )
} }
} }
#if 1 // enable image (outline) scopes.
static const KICAD_T scanEDGEs[] = { TYPEEDGEMODULE, EOT }; static const KICAD_T scanEDGEs[] = { TYPEEDGEMODULE, EOT };
// get all the MODULE's EDGE_MODULEs and convert those to DSN outlines. // get all the MODULE's EDGE_MODULEs and convert those to DSN outlines.
@ -707,6 +708,7 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, MODULE* aModule )
continue; continue;
} }
} }
#endif
return image; return image;
} }