Commit 7e7a7937 authored by CHARRAS's avatar CHARRAS
Browse files

some changes about zones: enhanced dialog, and files reorganisation

parent fdb2905b
Loading
Loading
Loading
Loading

bitmaps/fill_zone.xpm

0 → 100644
+41 −0
Original line number Diff line number Diff line
/* XPM */
#ifndef XPMMAIN
extern const char *fill_zone_xpm[];
#else
const char *fill_zone_xpm[] = {
/* columns rows colors chars-per-pixel */
"16 16 15 1",
"# c #FCFEFC",
"@ c #ACBEFC",
"O c #444A5C",
"$ c #645AEC",
"X c #040204",
"o c #ECEAEC",
". c #F4F2F4",
"  c None",
"+ c #C4C6CC",
"& c #6476C4",
"* c #A4A2AC",
"= c #848A9C",
"; c #646674",
"% c #8496F4",
"- c #7C7E8C",
/* pixels */
"  .  XX   . .. .",
"   oX  X o   o  ",
"    X OXX  o    ",
"oo oXO+X X@@ooo ",
"    O+.X#.X$%@oo",
" o O+.#X..+X$%@o",
"o O+.##..+*=X$%@",
"&O+.##..+*=-;$%@",
"O+.##..+*=-;X$%@",
" X+#. +*=-;X&$%@",
"  X+.+*=-;X &$%@",
"   X=*=-;X  &$%@",
"    X;-;X   &$%&",
"     X;X    &$% ",
"      X      $% ",
"             $% "
};
#endif
+5 −0
Original line number Diff line number Diff line
@@ -4,6 +4,11 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.

2007-Dec-17 UPDATE  Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+pcbnew:
	some changes about zones: enhanced dialog, and files reorganisation.


2007-Dec-14 UPDATE   Dick Hollenbeck <dick@softplc.com>
================================================================================
+12 −6
Original line number Diff line number Diff line
@@ -155,6 +155,8 @@ void FootprintListBox::SetSelection( unsigned index, bool State )
    if( (int) index >= GetCount() )
        index = GetCount() - 1;

	if ( (index >= 0)  && (GetCount() > 0) )
	{
#ifndef __WXMAC__
		Select( index, State );
#endif
@@ -163,6 +165,7 @@ void FootprintListBox::SetSelection( unsigned index, bool State )
		Refresh();
#endif
	}
}


/**************************************************/
@@ -256,6 +259,8 @@ void ListBoxCmp::SetSelection( unsigned index, bool State )
    if( (int) index >= GetCount() )
        index = GetCount() - 1;

	if ( (index >= 0) && (GetCount() > 0) )
	{
#ifndef __WXMAC__
		Select( index, State );
#endif
@@ -264,6 +269,7 @@ void ListBoxCmp::SetSelection( unsigned index, bool State )
		Refresh();
#endif
	}
}


/********************************************/
+360 −318
Original line number Diff line number Diff line
/***************************/
/****************************/
/* readschematicnetlist.cpp */
/***************************/
/****************************/

/* convertit la netliste ORCADPCB en netliste ORCADPCB (fichier temporaire)
assure la raffectation des alimentations selon le format :
( XXXXXX VALEUR|(pin1,pin2,...=newalim) ID VALEUR
/* Read a nelist type Eeschema or OrcadPCB2 and buid the component list
 * Manages the lines like :
 * ( XXXXXX VALEUR|(pin1,pin2,...=newalim) ID VALEUR
 */

#include "fctsys.h"
@@ -19,8 +19,9 @@ assure la r

/* routines locales : */

static int pin_orcad(STORECMP * CurrentCmp);
static int ReadPinConnection( STORECMP* CurrentCmp );

#define BUFFER_CHAR_SIZE 1024   // Size of buffers used to  store netlist datas

/************************************************/
int WinEDA_CvpcbFrame::ReadSchematicNetlist()
@@ -28,11 +29,11 @@ int WinEDA_CvpcbFrame::ReadSchematicNetlist()
{
    int       i, j, k, l;
    char*     LibName;
char Line[1024];
char component_reference[80] ;		/* buffer des references composants */
char ref_schema[80] ;				/* buffer de la ref schematique */
char footprint_name[80] ;			/* buffer des ref.lib */
char component_value[80] ;			/* buffer des valeurs  */
    char      Line[BUFFER_CHAR_SIZE + 1];
    char      component_reference[BUFFER_CHAR_SIZE + 1];    /* buffer for component reference (U1, R4...) */
    char      schematic_timestamp[BUFFER_CHAR_SIZE + 1];    /* buffer for component time stamp */
    char      footprint_name[BUFFER_CHAR_SIZE + 1];         /* buffer for component footprint field */
    char      component_value[BUFFER_CHAR_SIZE + 1];        /* buffer for component values (470K, 22nF ...) */
    char*     ptchar;                                       /* pointeur de service */
    STORECMP* Cmp;

@@ -41,7 +42,8 @@ STORECMP * Cmp;
    g_FlagEESchema = FALSE;

    /* Raz buffer et variable de gestion */
	if( g_BaseListeCmp ) FreeMemoryComponants();
    if( g_BaseListeCmp )
        FreeMemoryComponants();

    /* Ouverture du fichier source */
    source = wxFopen( FFileName, wxT( "rt" ) );
@@ -49,11 +51,12 @@ STORECMP * Cmp;
    {
        wxString msg;
        msg.Printf( _( "File <%s> not found" ), FFileName.GetData() );
		DisplayError(this, msg); return(-1);
        DisplayError( this, msg ); return -1;
    }

	/* Read the file header (must be  "( { OrCAD PCB" or "({ OrCAD PCB" ) */
	/* or "# EESchema Netliste"*/
    /* Read the file header (must be  "( { OrCAD PCB" or "({ OrCAD PCB" )
     * or "# EESchema Netliste"
     */
    fgets( Line, 255, source );
    /* test for netlist type PCB2 */
    i = strnicmp( Line, "( {", 3 );
@@ -62,7 +65,8 @@ STORECMP * Cmp;
    if( i != 0 )
    {
        i = strnicmp( Line, "# EESchema", 7 ); /* net type EESchema */
		if( i == 0 )  g_FlagEESchema = TRUE;
        if( i == 0 )
            g_FlagEESchema = TRUE;
    }

    if( i != 0 )
@@ -70,24 +74,27 @@ STORECMP * Cmp;
        wxString msg, Lineconv = CONV_FROM_UTF8( Line );
        msg.Printf( _( "Unknown file format <%s>" ), Lineconv.GetData() );
        DisplayError( this, msg );
		fclose(source); return(-3) ;
        fclose( source ); return -3;
    }

    SetStatusText( _( "Netlist Format: EESchema" ), 0 );


	/* Lecture de la liste */
    /* Read the netlit */
    for( ; ; )
    {
		/* recherche du debut de la description d'un composant */
        /* Search the beginning of a component description */

		if( fgets(Line,255,source)  == 0 ) break;
        if( fgets( Line, BUFFER_CHAR_SIZE, source )  == 0 )
            break;

        /* Remove blanks */
		i = 0 ; while (Line[i] == ' ') i++ ;
        i = 0; while( Line[i] == ' ' )
            i++;

		/* elimination des lignes vides : */
		if (Line[i] < ' ') continue ;
        /* remove empty lines : */
        if( Line[i] < ' ' )
            continue;

        if( strnicmp( &Line[i], "{ Allowed footprints", 20 ) == 0 )
        {
@@ -95,31 +102,41 @@ STORECMP * Cmp;
            continue;
        }

		if (strnicmp(&Line[i],"( ",2) != 0) continue ;
        if( strnicmp( &Line[i], "( ", 2 ) != 0 )
            continue;

		/****************************/
		/* debut description trouve */
		/****************************/
		/* memo ident schema */
		while ( Line[i] != ' ') i++ ;
		while ( Line[i] == ' ') i++ ; /* i pointe 1er caractere de l'ident schema */
        /*******************************/
        /* Component description found */
        /*******************************/
        while( Line[i] != ' ' )
            i++;

		j = 0 ; while ( Line[i] != ' ') ref_schema[j++] = Line[i++] ;
		ref_schema[j] = 0 ;
        while( Line[i] == ' ' )
            i++;

		/* recherche val/ref.lib */
		while ( Line[i] == ' ') i++ ; /* i pointe la valeur du composant */
        /* i points the beginning of the schematic time stamp */

        j = 0; while( Line[i] != ' ' )
            schematic_timestamp[j++] = Line[i++];

        schematic_timestamp[j] = 0;

        /* search val/ref.lib */
        while( Line[i] == ' ' )
            i++;

        /* i points the component value */
        LibName = Line + i;

        memset( schematic_timestamp, 0, sizeof(schematic_timestamp) );
        memset( component_reference, 0, sizeof(component_reference) );
        memset( footprint_name, 0, sizeof(footprint_name) );
        memset( component_value, 0, sizeof(component_value) );
        memset( alim, 0, sizeof(alim) );

		/* lecture valeur du composant */
        /* Read value */

		/* recherche fin de valeur (' ') */
		ptchar = strstr(&Line[i]," ") ;
        ptchar = strstr( &Line[i], " " );  // Search end of value field (space)
        if( ptchar == 0 )
        {
            wxString msg;
@@ -127,52 +144,64 @@ STORECMP * Cmp;
            DisplayError( NULL, msg );
            k = 0;
        }
		else k = ptchar - Line ;
        else
            k = ptchar - Line;

        for( j = 0; i < k;  i++ )
        {
			if ( Line[i] == SEPARATEUR ) break ;
            if( Line[i] == SEPARATEUR )
                break;
            if( j < (int) (sizeof(footprint_name) - 1) )
                footprint_name[j++] = Line[i];
        }

        if( (Line[++i] == '(') && (Line[k - 1] == ')' ) )
        {
			i++ ; l = 0 ; while ( k-1 > i ) alim[l++] = Line[i++] ;
            i++; l = 0; while( k - 1 > i )
                alim[l++] = Line[i++];
        }
        else
            i = k;

		else	i = k ;
        /* Search component reference */
        while( Line[i] != ' ' )
            i++;

		/* recherche reference du composant */
		while(Line[i] != ' ') i++ ; /* elimination fin valeur */
		while(Line[i] == ' ') i++ ; /* recherche debut reference */
        /* goto end of value field */
        while( Line[i] == ' ' )
            i++;

        /* goto beginning of  reference */

        /* debut reference trouv */
        for( k = 0; k < (int) (sizeof(component_reference) - 1); i++, k++ )
        {
			if ( Line[i] <= ' ' ) break ;
            if( Line[i] <= ' ' )
                break;
            component_reference[k] = Line[i];
        }

		/* recherche valeur du composant */
		while(Line[i] == ' ') i++ ; /* recherche debut valeur */
        /* Search component value */
        while( Line[i] == ' ' )
            i++;

        /** goto beginning of  value */

		/* debut vraie valeur trouvee */
        for( k = 0; k < (int) (sizeof(component_value) - 1); i++, k++ )
        {
			if ( Line[i] <= ' ' ) break ;
            if( Line[i] <= ' ' )
                break;
            component_value[k] = Line[i];
        }


		/* classement du composant ,suivi de sa valeur */
        /* Store info for this component */
        Cmp = new STORECMP();
        Cmp->Pnext       = g_BaseListeCmp;
        g_BaseListeCmp   = Cmp;
        Cmp->m_Reference = CONV_FROM_UTF8( component_reference );
        Cmp->m_Valeur    = CONV_FROM_UTF8( component_value );

		if(  g_FlagEESchema )	/* Copie du nom module: */
        if(  g_FlagEESchema )   /* copy footprint name: */
        {
            if( strnicmp( LibName, "$noname", 7 ) != 0 )
            {
@@ -183,38 +212,41 @@ STORECMP * Cmp;
                }
            }
        }
		/* classement du TimeStamp */
		Cmp->m_TimeStamp = CONV_FROM_UTF8(ref_schema);
        Cmp->m_TimeStamp = CONV_FROM_UTF8( schematic_timestamp );

		pin_orcad( Cmp) ;
        ReadPinConnection( Cmp );

        nbcomp++;
    }

    fclose( source );

	/* reclassement alpabetique : */
    /* Alpabetic sorting : */
    g_BaseListeCmp = TriListeComposantss( g_BaseListeCmp, nbcomp );

	return(0);
    return 0;
}


/********************************************************/
int WinEDA_CvpcbFrame::ReadFootprintFilterList( FILE* f )
/********************************************************/
{
char Line[1024];
    char      Line[BUFFER_CHAR_SIZE + 1];
    wxString  CmpRef;
    STORECMP* Cmp = NULL;

    for( ; ; )
    {
		if( fgets(Line,255,source)  == 0 ) break;
        if( fgets( Line, BUFFER_CHAR_SIZE, source )  == 0 )
            break;
        if( strnicmp( Line, "$endlist", 8 ) == 0 )
        {
            Cmp = NULL;
            continue;
        }
		if (strnicmp(Line,"$endfootprintlist", 4 ) == 0 ) return 0;
        if( strnicmp( Line, "$endfootprintlist", 4 ) == 0 )
            return 0;

        if( strnicmp( Line, "$component", 10 ) == 0 ) // New component ref found
        {
@@ -223,10 +255,10 @@ STORECMP * Cmp = NULL;
            /* Search the new component in list */
            for( Cmp = g_BaseListeCmp; Cmp != NULL; Cmp = Cmp->Pnext )
            {
				if ( Cmp->m_Reference == CmpRef) break;
                if( Cmp->m_Reference == CmpRef )
                    break;
            }
        }
		
        else if( Cmp )
        {
            wxString fp = CONV_FROM_UTF8( Line + 1 );
@@ -240,12 +272,12 @@ STORECMP * Cmp = NULL;


/***********************************/
int pin_orcad(STORECMP * Cmp)
int ReadPinConnection( STORECMP* Cmp )
/***********************************/
{
    int        i, jj;
char numpin[9] , net[1024] ;
char Line[1024];
    char       numpin[BUFFER_CHAR_SIZE + 1], net[BUFFER_CHAR_SIZE + 1];
    char       Line[BUFFER_CHAR_SIZE + 1];
    STOREPIN*  Pin     = NULL;
    STOREPIN** LastPin = &Cmp->m_Pins;

@@ -254,30 +286,39 @@ for ( ;; )
        /* debut description trouv */
        for( ; ; )
        {
		if ( fgets(Line,80,source) == 0 ) return(-1) ;
            if( fgets( Line, BUFFER_CHAR_SIZE, source ) == 0 )
                return -1;

            /* remove blanks from the beginning of the line */
            i = 0; while( Line[i] == ' ' )
                i++;

		/* suppression des blancs en dbut de ligne */
		i = 0 ; while (Line[i] == ' ') i++ ;
		while (Line[i] == '(') i++ ;
		while (Line[i] == ' ') i++ ;
            while( Line[i] == '(' )
                i++;

		/* elimination des lignes vides : */
		if (Line[i] < ' ') continue ;
            while( Line[i] == ' ' )
                i++;

            /* remove empty lines : */
            if( Line[i] < ' ' )
                continue;

            /* fin de description ? */
		if (Line[i] == ')' ) return(0) ;
            if( Line[i] == ')' )
                return 0;

            memset( net, 0, sizeof(net) );
            memset( numpin, 0, sizeof(numpin) );

		/* lecture name pin , 4 lettres */
            /* Read pi name , 4 letters */
            for( jj = 0; jj < 4; jj++, i++ )
            {
			if ( Line[i] == ' ' ) break ;
                if( Line[i] == ' ' )
                    break;
                numpin[jj] = Line[i];
            }

		/* recherche affectation force de net  */
            /* Search for a net attribute  */
            if( reaffect( numpin, net ) != 0 )
            {
                Pin           = new STOREPIN();
@@ -287,13 +328,14 @@ for ( ;; )
                continue;
            }

		/* recherche netname */
		while(Line[i] == ' ') i++ ; /* recherche debut reference */
            /* Read netname */
            while( Line[i] == ' ' )
                i++;

		/* debut netname trouv */
            for( jj = 0; jj < (int) sizeof(net) - 1; i++, jj++ )
            {
			if ( Line[i] <= ' ' ) break ;
                if( Line[i] <= ' ' )
                    break;
                net[jj] = Line[i];
            }

@@ -309,15 +351,16 @@ for ( ;; )
/****************************************************************/
STORECMP* TriListeComposantss( STORECMP* BaseListe, int nbitems )
/****************************************************************/
/* Tri la liste des composants par ordre alphabetique et me a jour
le nouveau chainage avant/arriere
	retourne un pointeur sur le 1er element de la liste

/* Sort the component list( this is a linked list)
 * retourn the beginning of the list
 */
{
    STORECMP** bufferptr, * Item;
    int        ii;

	if (nbitems <= 0 ) return(NULL);
    if( nbitems <= 0 )
        return NULL;
    bufferptr = (STORECMP**) MyZMalloc( (nbitems + 2) * sizeof(STORECMP*) );

    for( ii = 1, Item = BaseListe; Item != NULL; Item = Item->Pnext, ii++ )
@@ -325,13 +368,13 @@ int ii;
        bufferptr[ii] = Item;
    }

	/* ici bufferptr[0] = NULL et bufferptr[nbitem+1] = NULL et ces 2 valeurs
	representent le chainage arriere du 1er element, et le chainage avant
	du dernier element */
    /* Here: bufferptr[0] = NULL and bufferptr[nbitem+1] = NULL.
     * These 2 values are the first item back link, and the last item forward link
     */

    qsort( bufferptr + 1, nbitems, sizeof(STORECMP*),
           ( int( * ) ( const void*, const void* ) )CmpCompare );
	/* Mise a jour du chainage */
    /* Update linked list */
    for( ii = 1; ii <= nbitems; ii++ )
    {
        Item = bufferptr[ii];
@@ -339,15 +382,17 @@ int ii;
        Item->Pnext = bufferptr[ii + 1];
        Item->Pback = bufferptr[ii - 1];
    }
	return(bufferptr[1]);

    return bufferptr[1];
}


/****************************************/
int CmpCompare( void* mod1, void* mod2 )
/****************************************/

/*
routine compare() pour qsort() en classement alphabetique des composants
 * Function compare() for qsort() : alphabetic sorting, with numbering order
 */
{
    int       ii;
@@ -358,8 +403,5 @@ STORECMP *pt1 , *pt2 ;

    //FIXME:
    ii = StrNumICmp( (const wxChar*) pt1->m_Reference, (const wxChar*) pt2->m_Reference );
	return(ii);
    return ii;
}


+1 −0
Original line number Diff line number Diff line
@@ -183,6 +183,7 @@
	#include "../bitmaps/transistor.xpm"
	#include "../bitmaps/kicad_icon_small.xpm"
	#include "../bitmaps/general_ratsnet.xpm"
	#include "../bitmaps/fill_zone.xpm"

// Largeur du toolbar vertical
#define VTOOLBAR_WIDTH 26
Loading