diff --git a/change_log.txt b/change_log.txt index 8844da2962..57f1ad0619 100644 --- a/change_log.txt +++ b/change_log.txt @@ -5,6 +5,15 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with email address. +2008-Juil-31 UPDATE Jean-Pierre Charras +================================================================================ ++eeschema: + Added component sheet X,Y location in BOM. + Netlist generation: now spaces in names are replaced by '_' for pcbnew (which does not accept spaces) + Bug: print all pages did not work. + Please note in complex hierarchy, the current "Print All" function needs to be enhanced, + because it does not draw all sheets but only all different sheets + 2008-Jule-08 UPDATE Andrey Fedorushkov ================================================================================ +pcbnew: diff --git a/common/worksheet.cpp b/common/worksheet.cpp index 99b53feca5..b02c012cd8 100644 --- a/common/worksheet.cpp +++ b/common/worksheet.cpp @@ -30,18 +30,18 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w wxString Line; Ki_WorkSheetData* WsItem; int scale = m_InternalUnits / 1000; - wxSize size( SIZETEXT* scale, SIZETEXT* scale ); - wxSize size_ref( SIZETEXT_REF* scale, SIZETEXT_REF* scale ); + wxSize size( SIZETEXT * scale, SIZETEXT * scale ); + wxSize size_ref( SIZETEXT_REF * scale, SIZETEXT_REF * scale ); - wxString msg; - int UpperLimit = VARIABLE_BLOCK_START_POSITION; - int width = line_width; + wxString msg; + int UpperLimit = VARIABLE_BLOCK_START_POSITION; + int width = line_width; Color = RED; if( Sheet == NULL ) { DisplayError( this, - wxT( "WinEDA_DrawFrame::TraceWorkSheet() error: m_CurrentSheet NULL" ) ); + wxT( "WinEDA_DrawFrame::TraceWorkSheet() error: NULL Sheet" ) ); return; } @@ -315,6 +315,61 @@ void WinEDA_DrawFrame::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_w } +/************************************************************************************************/ +wxString WinEDA_DrawFrame::GetXYSheetReferences( BASE_SCREEN* aScreen, const wxPoint& aPosition ) +/************************************************************************************************/ + +/** Function GetXYSheetReferences + * Return the X,Y sheet references where the point position is located + * @param aScreen = screen to use + * @param aPosition = position to identify by YX ref + * @return a wxString containing the message locator like A3 or B6 (or ?? if out of page limits) + */ +{ + Ki_PageDescr* Sheet = aScreen->m_CurrentSheetDesc; + int ii, xg, yg, ipas, gxpas, gypas; + int refx, refy; + wxString msg; + + if( Sheet == NULL ) + { + DisplayError( this, + wxT( "WinEDA_DrawFrame::GetXYSheetReferences() error: NULL Sheet" ) ); + return msg; + } + + refx = Sheet->m_LeftMargin; + refy = Sheet->m_TopMargin; /* Upper left corner */ + xg = Sheet->m_Size.x - Sheet->m_RightMargin; + yg = Sheet->m_Size.y - Sheet->m_BottomMargin; /* lower right corner */ + + /* Get the Y axis identifier (A symbol A ... Z) */ + if( aPosition.y < refy || aPosition.y > yg ) // Ouside of Y limits + msg << wxT( "?" ); + else + { + ipas = (yg - refy) / PAS_REF; // ipas = Y count sections + gypas = ( yg - refy) / ipas; // gypas = Y section size + ii = (aPosition.y - refy) / gypas; + msg.Printf( wxT( "%c" ), 'A' + ii ); + } + + /* Get the X axis identifier (A number 1 ... n) */ + if( aPosition.x < refx || aPosition.x > xg ) // Ouside of X limits + msg << wxT( "?" ); + else + { + ipas = (xg - refx) / PAS_REF; // ipas = X count sections + gxpas = ( xg - refx) / ipas; // gxpas = X section size + + ii = (aPosition.x - refx) / gxpas; + msg << ii + 1; + } + + return msg; +} + + /*********************************************************************/ wxString WinEDA_DrawFrame::GetScreenDesc() /*********************************************************************/ diff --git a/cvpcb/rdpcad.cpp b/cvpcb/rdpcad.cpp index e6c03b70f3..29a621fa2c 100644 --- a/cvpcb/rdpcad.cpp +++ b/cvpcb/rdpcad.cpp @@ -1,11 +1,11 @@ - /****************/ - /* rdpcad() */ - /***************/ +/****************/ +/* rdpcad() */ +/***************/ /* convertit la netliste PCAD en netliste standard (fichier temporaire) -assure la reaffectation des alimentations selon le format : -{I VALEUR(pin1,pin2,...=newalim).PRT ID -*/ + * assure la reaffectation des alimentations selon le format : + * {I VALEUR(pin1,pin2,...=newalim).PRT ID + */ #include "fctsys.h" @@ -18,257 +18,296 @@ assure la reaffectation des alimentations selon le format : #define SEPARATEUR '|' /* routines locales : */ -int pin() ; +int pin(); /***************************************/ int WinEDA_CvpcbFrame::rdpcad() /***************************************/ { -int i , j , k ,l ; -char Line[1024]; -char label[80] ; /* buffer des references composants */ -char val[80] ; /* buffer des valeurs */ -char *ptchar ; /* pointeur de service */ -STORECMP * Cmp; + int i, j, k, l; + char Line[1024]; + char label[80]; /* buffer des references composants */ + char val[80]; /* buffer des valeurs */ + char* ptchar; /* pointeur de service */ + STORECMP* Cmp; - modified = 0; - Rjustify = 0; + modified = 0; + Rjustify = 0; - /* Raz buffer et variable de gestion */ - if( g_BaseListeCmp ) FreeMemoryComponants(); + /* Raz buffer et variable de gestion */ + if( g_BaseListeCmp ) + FreeMemoryComponants(); - /* Ouverture du fichier source */ - source = wxFopen(FFileName, wxT("rt")); - if (source == 0) - { - wxString msg; - msg.Printf( _("File <%s> not found"),FFileName.GetData()); - DisplayError(this, msg); return(-1); - } + /* Ouverture du fichier source */ + source = wxFopen( FFileName, wxT( "rt" ) ); + if( source == 0 ) + { + wxString msg; + msg.Printf( _( "File <%s> not found" ), FFileName.GetData() ); + DisplayError( this, msg ); return -1; + } - /* Lecture entete qui doit etre "{COMPONENT ORCAD.PCB" ou "{ OrCAD PCB"*/ - fgets(Line,255,source) ; - i = strncmp(Line,"{COMPONENT ORCAD.PCB",9) ; /* net type PCAD */ + /* Lecture entete qui doit etre "{COMPONENT ORCAD.PCB" ou "{ OrCAD PCB"*/ + fgets( Line, 255, source ); + i = strncmp( Line, "{COMPONENT ORCAD.PCB", 9 ); /* net type PCAD */ - if ( i != 0 ) - { - wxString msg, Lineconv = CONV_FROM_UTF8(Line); - msg.Printf( _("Unknown file format <%s>"), Lineconv.GetData()); - DisplayError(this, msg); - fclose(source); return(-3) ; - } + if( i != 0 ) + { + wxString msg, Lineconv = CONV_FROM_UTF8( Line ); + msg.Printf( _( "Unknown file format <%s>" ), Lineconv.GetData() ); + DisplayError( this, msg ); + fclose( source ); return -3; + } - SetStatusText( _("Netlist Format: Pcad"), 0); + SetStatusText( _( "Netlist Format: Pcad" ), 0 ); - /* Lecture de la liste */ + /* Lecture de la liste */ -for ( ;; ) - { - /* recherche du debut de la description d'un composant */ + for( ; ; ) + { + /* recherche du debut de la description d'un composant */ - if ( fgets(Line,80,source) == 0 ) break ; + if( fgets( Line, 80, source ) == 0 ) + break; - /* suppression des blancs en d‚but de ligne */ - i = 0 ; while (Line[i] == ' ') i++ ; + /* suppression des blancs en d‚but de ligne */ + i = 0; while( Line[i] == ' ' ) + i++; - /* elimination des lignes vides : */ - if (Line[i] < ' ') continue ; + /* elimination des lignes vides : */ + if( Line[i] < ' ' ) + continue; - if (strncmp(&Line[i],"{I",2) != 0) continue ; + if( strncmp( &Line[i], "{I", 2 ) != 0 ) + continue; - /****************************/ - /* debut description trouv‚ */ - /****************************/ + /****************************/ + /* debut description trouv‚ */ + /****************************/ - i += 3 ; /* i pointe le 1er caractere de la valeur du composant */ + i += 3; /* i pointe le 1er caractere de la valeur du composant */ - for (j = 0 ; j < 20 ; j++) - { - label[j] = 0 ; val[j] = ' ' ; - } - val[16] = 0 ; + for( j = 0; j < 20; j++ ) + { + label[j] = 0; val[j] = ' '; + } - for (j =0 ; j < 80 ; j++) alim[j] = 0 ; + val[16] = 0; - /* lecture valeur du composant ( toujours r‚ecrire sur 8 caracteres) */ + for( j = 0; j < 80; j++ ) + alim[j] = 0; - /* recherche fin de valeur (.PRT) */ - ptchar = strstr(Line,".PRT") ; - if (ptchar == 0) - { - sprintf(cbuf,"Netlist error: %s\n",Line) ; -// Affiche_Message(cbuf) ; - } - k = ptchar - Line ; + /* lecture valeur du composant ( toujours reecrire sur 8 caracteres) */ - for (j = 0 ; i < k ; i++) - { - if ( Line[i] == SEPARATEUR ) break ; - if ( j < 8 ) val[j++] = Line[i] ; - } + /* recherche fin de valeur (.PRT) */ + ptchar = strstr( Line, ".PRT" ); + if( ptchar == 0 ) + { + //Netlist error: todo: display a message error + } + k = ptchar - Line; - if ( (Line[++i] == '(') && (Line[k-1] == ')' ) ) - { - i++ ; l = 0 ; while ( k-1 > i ) alim[l++] = Line[i++] ; - } + for( j = 0; i < k; i++ ) + { + if( Line[i] == SEPARATEUR ) + break; + if( j < 8 ) + val[j++] = Line[i]; + } - else i = k ; + if( (Line[++i] == '(') && (Line[k - 1] == ')' ) ) + { + i++; l = 0; while( k - 1 > i ) + alim[l++] = Line[i++]; + } + else + i = k; - /* recherche reference du composant */ - while(Line[i] != ' ') i++ ; /* elimination fin valeur */ - while(Line[i] == ' ') i++ ; /* recherche debut reference */ + /* recherche reference du composant */ + while( Line[i] != ' ' ) + i++; /* elimination fin valeur */ - /* debut reference trouv‚ */ - for ( k = 0 ; k < 8 ; i++ , k++ ) - { - if ( Line[i] <= ' ' ) break ; - label[k] = Line[i] ; - } - /* classement du composant ,suivi de sa valeur */ - Cmp = new STORECMP(); - Cmp->Pnext = g_BaseListeCmp; - g_BaseListeCmp = Cmp; - Cmp->m_Reference = CONV_FROM_UTF8(label); - Cmp->m_Valeur = CONV_FROM_UTF8(val); - pin() ; - nbcomp++ ; - } + while( Line[i] == ' ' ) + i++; /* recherche debut reference */ - fclose(source); + /* debut reference trouv‚ */ + for( k = 0; k < 8; i++, k++ ) + { + if( Line[i] <= ' ' ) + break; + label[k] = Line[i]; + } - /* reclassement alpab‚tique : */ - g_BaseListeCmp = TriListeComposantss( g_BaseListeCmp, nbcomp); + /* classement du composant ,suivi de sa valeur */ + Cmp = new STORECMP(); + Cmp->Pnext = g_BaseListeCmp; + g_BaseListeCmp = Cmp; + Cmp->m_Reference = CONV_FROM_UTF8( label ); + Cmp->m_Valeur = CONV_FROM_UTF8( val ); + pin(); + nbcomp++; + } - return(0); + fclose( source ); + + /* reclassement alpab‚tique : */ + g_BaseListeCmp = TriListeComposantss( g_BaseListeCmp, nbcomp ); + + return 0; } - /***********************************/ - /* pin() : analyse liste des pines */ - /***********************************/ + +/***********************************/ +/* pin() : analyse liste des pines */ +/***********************************/ int pin() { -int i , j , k ; -char numpin[9] , net[9] ; -char Line[1024]; + int i, j, k; + char numpin[9], net[9]; + char Line[1024]; -for ( ;; ) - { - /* recherche du debut de la description des pins d'un composant */ + for( ; ; ) + { + /* recherche du debut de la description des pins d'un composant */ - if ( fgets(Line,80,source) == 0 ) return(-1) ; - /* suppression des blancs en d‚but de ligne */ - i = 0 ; while (Line[i] == ' ') i++ ; + if( fgets( Line, 80, source ) == 0 ) + return -1; + /* suppression des blancs en d‚but de ligne */ + i = 0; while( Line[i] == ' ' ) + i++; - /* elimination des lignes vides : */ - if (Line[i] < ' ') continue ; + /* elimination des lignes vides : */ + if( Line[i] < ' ' ) + continue; - if (strncmp(&Line[i],"{CN",3) != 0) continue ; + if( strncmp( &Line[i], "{CN", 3 ) != 0 ) + continue; - /* debut description trouv‚ */ - for ( ;; ) - { - if ( fgets(Line,80,source) == 0 ) return(-1) ; - /* suppression des blancs en d‚but de ligne */ - i = 0 ; while (Line[i] == ' ') i++ ; + /* debut description trouv‚ */ + for( ; ; ) + { + if( fgets( Line, 80, source ) == 0 ) + return -1; + /* suppression des blancs en d‚but de ligne */ + i = 0; while( Line[i] == ' ' ) + i++; - /* elimination des lignes vides : */ - if (Line[i] < ' ') continue ; + /* elimination des lignes vides : */ + if( Line[i] < ' ' ) + continue; - /* fin de description ? */ - if (Line[i] == '}' ) return(0) ; + /* fin de description ? */ + if( Line[i] == '}' ) + return 0; - memset( net, 0, sizeof(net) ) ; - memset( numpin, 0, sizeof(numpin) ) ; + memset( net, 0, sizeof(net) ); + memset( numpin, 0, sizeof(numpin) ); - /* lecture name pin , 4 lettres */ - for (j = 0 ; j < 4 ; j++ , i++) - { - if ( Line[i] == ' ' ) break ; - numpin[j] = Line[i] ; - } - j = 0 ; + /* lecture name pin , 4 lettres */ + for( j = 0; j < 4; j++, i++ ) + { + if( Line[i] == ' ' ) + break; + numpin[j] = Line[i]; + } - /* recherche affectation forc‚e de net */ - if ( reaffect(&numpin[j],net) != 0) - { + j = 0; + + /* recherche affectation forc‚e de net */ + if( reaffect( &numpin[j], net ) != 0 ) + { // fprintf(dest,"%s:%s\n",&numpin[j],net) ; - continue ; - } + continue; + } - /* recherche netname */ - while(Line[i] == ' ') i++ ; /* recherche debut reference */ + /* recherche netname */ + while( Line[i] == ' ' ) + i++; /* recherche debut reference */ - /* debut netname trouv‚ */ - for ( k = 0 ; k < 8 ; i++ , k++ ) - { - if ( Line[i] <= ' ' ) break ; - net[k] = Line[i] ; - } - /* les pins non connect‚es sont ‚limin‚es :*/ - if (net[0] == '?' ) continue ; + /* debut netname trouv‚ */ + for( k = 0; k < 8; i++, k++ ) + { + if( Line[i] <= ' ' ) + break; + net[k] = Line[i]; + } + + /* les pins non connect‚es sont ‚limin‚es :*/ + if( net[0] == '?' ) + continue; // fprintf(dest,"%s:%s\n",&numpin[j],net) ; - } - } + } + } } /**************************************/ -int reaffect( char *ib, char *net) +int reaffect( char* ib, char* net ) /**************************************/ -/* force un nom de net pour une pine -ib = reference de pin , net = nouveau net ; alim = ligne de consigne -*/ + +/* force un nom de net pour une pin + * ib = reference de pin , net = nouveau net ; alim = ligne de consigne + */ { -char *pt , *pt0 , npin[12] ; -int i ; + char* pt, * pt0, npin[12]; + int i; -pt = alim ; + pt = alim; -while (*pt != 0 ) - { - memset( npin, 0, sizeof(npin) ) ; + while( *pt != 0 ) + { + memset( npin, 0, sizeof(npin) ); - /* recherche separateur (':' ou ',') */ - while ( (*pt != ':') && (*pt != ',') ) - { - pt++ ; if (*pt == 0 ) return(0) ; - } - /* suppression des blancs eventuels */ - pt0 = pt ; /* save position du nom du net */ - pt0-- ; while (*pt0 == ' ') pt0-- ; + /* recherche separateur (':' ou ',') */ + while( (*pt != ':') && (*pt != ',') ) + { + pt++; if( *pt == 0 ) + return 0; + } - for (i = 3 ; i >= 0 ; i-- ) - { - if ( (*pt0 == ',') || (*pt0 ==' ')) break ; - npin[i] = *pt0 ; - if (pt0 == alim) break ; - pt0-- ; - } + /* suppression des blancs eventuels */ + pt0 = pt; /* save position du nom du net */ + pt0--; while( *pt0 == ' ' ) + pt0--; - while ( npin[0] == ' ' ) /* suppression des espaces a gauche */ - { - npin[0] = npin[1] ; - npin[1] = npin[2] ; - npin[2] = npin[3] ; - npin[3] = ' ' ; - } - if (strncmp(npin,ib,4) == 0 ) /* pin trouv‚e */ - { - pt++ ; while ((*pt == ' ' ) && (*pt != 0 )) pt++ ; - i = 0 ; - while ((*pt != 0) && (*pt != ',') && ( i < 8 ) ) - { - net[i++] = *pt++ ; - } - net[i] = 0 ; - return(1) ; - } - pt++ ; - } -return(0) ; + for( i = 3; i >= 0; i-- ) + { + if( (*pt0 == ',') || (*pt0 ==' ') ) + break; + npin[i] = *pt0; + if( pt0 == alim ) + break; + pt0--; + } + + while( npin[0] == ' ' ) /* suppression des espaces a gauche */ + { + npin[0] = npin[1]; + npin[1] = npin[2]; + npin[2] = npin[3]; + npin[3] = ' '; + } + + if( strncmp( npin, ib, 4 ) == 0 ) /* pin trouv‚e */ + { + pt++; while( (*pt == ' ' ) && (*pt != 0 ) ) + pt++; + + i = 0; + while( (*pt != 0) && (*pt != ',') && ( i < 8 ) ) + { + net[i++] = *pt++; + } + + net[i] = 0; + return 1; + } + pt++; + } + + return 0; } - diff --git a/cvpcb/readschematicnetlist.cpp b/cvpcb/readschematicnetlist.cpp index d09b618d60..51d1d53595 100644 --- a/cvpcb/readschematicnetlist.cpp +++ b/cvpcb/readschematicnetlist.cpp @@ -57,7 +57,7 @@ int WinEDA_CvpcbFrame::ReadSchematicNetlist() /* Read the file header (must be "( { OrCAD PCB" or "({ OrCAD PCB" ) * or "# EESchema Netliste" */ - fgets( Line, 255, source ); + fgets( Line, BUFFER_CHAR_SIZE, source ); /* test for netlist type PCB2 */ i = strnicmp( Line, "( {", 3 ); if( i != 0 ) @@ -310,7 +310,7 @@ int ReadPinConnection( STORECMP* Cmp ) memset( net, 0, sizeof(net) ); memset( numpin, 0, sizeof(numpin) ); - /* Read pi name , 4 letters */ + /* Read pin name , 4 letters */ for( jj = 0; jj < 4; jj++, i++ ) { if( Line[i] == ' ' ) diff --git a/eeschema/build_BOM.cpp b/eeschema/build_BOM.cpp index 0499199d11..199ff619dc 100644 --- a/eeschema/build_BOM.cpp +++ b/eeschema/build_BOM.cpp @@ -312,8 +312,8 @@ int BuildComponentsListFromSchematic( ListComponent* aList ) CONV_TO_UTF8( DrawLibItem->GetRef( sheet ) ), sizeof( aList->m_Ref ) ); - // @todo the above line is probably a bug, because it will not always nul terminate m_Ref. - + // Ensure always nul terminate m_Ref. + aList->m_Ref[sizeof( aList->m_Ref ) - 1 ] = 0; aList++; } } @@ -670,7 +670,11 @@ int WinEDA_Build_BOM_Frame::PrintComponentsListByRef( FILE* f, fprintf( f, "ref%cvalue", s_ExportSeparatorSymbol ); if( aIncludeSubComponents ) + { fprintf( f, "%csheet path", s_ExportSeparatorSymbol ); + fprintf( f, "%clocation", s_ExportSeparatorSymbol ); + + } if( m_AddFootprintField->IsChecked() ) fprintf( f, "%cfootprint", s_ExportSeparatorSymbol ); @@ -737,9 +741,17 @@ int WinEDA_Build_BOM_Frame::PrintComponentsListByRef( FILE* f, { msg = aList[ii].m_SheetList.PathHumanReadable(); if( CompactForm ) + { fprintf( f, "%c%s", s_ExportSeparatorSymbol, CONV_TO_UTF8( msg ) ); + msg = m_Parent->GetXYSheetReferences( (BASE_SCREEN*)DrawLibItem->m_Parent, DrawLibItem->m_Pos ); + fprintf( f, "%c%s)", s_ExportSeparatorSymbol, CONV_TO_UTF8( msg ) ); + } else + { fprintf( f, " (Sheet %s)", CONV_TO_UTF8( msg ) ); + msg = m_Parent->GetXYSheetReferences( (BASE_SCREEN*)DrawLibItem->m_Parent, DrawLibItem->m_Pos ); + fprintf( f, " (loc %s)", CONV_TO_UTF8( msg ) ); + } } PrintFieldData( f, DrawLibItem, CompactForm ); @@ -811,6 +823,8 @@ int WinEDA_Build_BOM_Frame::PrintComponentsListByVal( FILE* f, { msg = aList[ii].m_SheetList.PathHumanReadable(); fprintf( f, " (Sheet %s)", CONV_TO_UTF8( msg ) ); + msg = m_Parent->GetXYSheetReferences( (BASE_SCREEN*)DrawLibItem->m_Parent, DrawLibItem->m_Pos ); + fprintf( f, " (loc %s)", CONV_TO_UTF8( msg ) ); } PrintFieldData( f, DrawLibItem ); diff --git a/eeschema/eeredraw.cpp b/eeschema/eeredraw.cpp index 1bbb101678..674cedd330 100644 --- a/eeschema/eeredraw.cpp +++ b/eeschema/eeredraw.cpp @@ -137,16 +137,20 @@ void WinEDA_SchematicFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) /*******************************************************************************/ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int PrintMask ) /*******************************************************************************/ +/** PrintPage + * used to print a page. + * Print the page pointed by ActiveScreen, set by the calling print function + * @param DC = wxDC given by the calling print function + * @param Print_Sheet_Ref = true to print page references + * @param PrintMask = not used here + */ { - BASE_SCREEN* screen; - wxBeginBusyCursor(); - ActiveScreen = screen = m_Parent->GetBaseScreen(); - RedrawStructList( this, DC, screen->EEDrawList, GR_COPY ); + RedrawStructList( this, DC, ActiveScreen->EEDrawList, GR_COPY ); if( Print_Sheet_Ref ) - m_Parent->TraceWorkSheet( DC, screen, g_DrawMinimunLineWidth ); + m_Parent->TraceWorkSheet( DC, ActiveScreen, g_DrawMinimunLineWidth ); wxEndBusyCursor(); } diff --git a/eeschema/hierarch.cpp b/eeschema/hierarch.cpp index 0697b838d5..c060eead56 100644 --- a/eeschema/hierarch.cpp +++ b/eeschema/hierarch.cpp @@ -20,311 +20,333 @@ #include "bitmaps.h" -static bool UpdateScreenFromSheet(WinEDA_SchematicFrame * frame); +static bool UpdateScreenFromSheet( WinEDA_SchematicFrame* frame ); enum { - ID_TREECTRL_HIERARCHY = 1600 + ID_TREECTRL_HIERARCHY = 1600 }; class WinEDA_HierFrame; /* Cette classe permet de memoriser la feuille (sheet) associ�e a l'item - pour l'arbre de hierarchie */ -class TreeItemData: public wxTreeItemData + * pour l'arbre de hierarchie */ +class TreeItemData : public wxTreeItemData { public: - DrawSheetPath m_SheetList; - TreeItemData(DrawSheetPath sheet) :wxTreeItemData() - { - m_SheetList = sheet; - } + DrawSheetPath m_SheetList; + TreeItemData( DrawSheetPath sheet ) : wxTreeItemData() + { + m_SheetList = sheet; + } }; /* Classe de l'arbre de hierarchie */ class WinEDA_Tree : public wxTreeCtrl { private: - WinEDA_HierFrame * m_Parent; - wxImageList *imageList; + WinEDA_HierFrame* m_Parent; + wxImageList* imageList; public: - WinEDA_Tree() { } - WinEDA_Tree(WinEDA_HierFrame *parent); + WinEDA_Tree() { } + WinEDA_Tree( WinEDA_HierFrame* parent ); - DECLARE_DYNAMIC_CLASS(WinEDA_Tree) + DECLARE_DYNAMIC_CLASS( WinEDA_Tree ) }; -IMPLEMENT_DYNAMIC_CLASS(WinEDA_Tree, wxTreeCtrl) +IMPLEMENT_DYNAMIC_CLASS( WinEDA_Tree, wxTreeCtrl ) - -WinEDA_Tree::WinEDA_Tree(WinEDA_HierFrame *parent) : - wxTreeCtrl( (wxWindow*)parent, ID_TREECTRL_HIERARCHY, - wxDefaultPosition, wxDefaultSize, - wxTR_HAS_BUTTONS, wxDefaultValidator, wxT("HierachyTreeCtrl")) +WinEDA_Tree::WinEDA_Tree( WinEDA_HierFrame* parent ) : + wxTreeCtrl( (wxWindow*)parent, ID_TREECTRL_HIERARCHY, + wxDefaultPosition, wxDefaultSize, + wxTR_HAS_BUTTONS, wxDefaultValidator, wxT( "HierachyTreeCtrl" ) ) { - m_Parent = parent; - // Make an image list containing small icons - imageList = new wxImageList(16, 15, TRUE, 2); + m_Parent = parent; - imageList->Add(wxBitmap(tree_nosel_xpm)); - imageList->Add(wxBitmap(tree_sel_xpm)); + // Make an image list containing small icons + imageList = new wxImageList( 16, 15, TRUE, 2 ); - AssignImageList(imageList); + imageList->Add( wxBitmap( tree_nosel_xpm ) ); + imageList->Add( wxBitmap( tree_sel_xpm ) ); + AssignImageList( imageList ); } + /* Classe definissant la fenetre d'affichage de la hierarchie */ class WinEDA_HierFrame : public wxDialog { public: - WinEDA_SchematicFrame * m_Parent; - WinEDA_Tree * m_Tree; - int m_nbsheets; - wxDC * m_DC; + WinEDA_SchematicFrame* m_Parent; + WinEDA_Tree* m_Tree; + int m_nbsheets; + wxDC* m_DC; private: - wxSize m_TreeSize; // Taille de l'arbre de hierarchie - int maxposx; + wxSize m_TreeSize; // Taille de l'arbre de hierarchie + int maxposx; public: - WinEDA_HierFrame(WinEDA_SchematicFrame *parent, wxDC * DC, const wxPoint& pos); - void BuildSheetList(DrawSheetPath * list, wxTreeItemId * previousmenu); - ~WinEDA_HierFrame(); + WinEDA_HierFrame( WinEDA_SchematicFrame* parent, wxDC* DC, const wxPoint& pos ); + void BuildSheetList( DrawSheetPath* list, wxTreeItemId* previousmenu ); - void OnSelect(wxTreeEvent& event); + ~WinEDA_HierFrame(); + + void OnSelect( wxTreeEvent& event ); private: - void OnQuit(wxCommandEvent& event); + void OnQuit( wxCommandEvent& event ); - DECLARE_EVENT_TABLE() + DECLARE_EVENT_TABLE() }; -BEGIN_EVENT_TABLE(WinEDA_HierFrame, wxDialog) - EVT_TREE_ITEM_ACTIVATED(ID_TREECTRL_HIERARCHY, - WinEDA_HierFrame::OnSelect) +BEGIN_EVENT_TABLE( WinEDA_HierFrame, wxDialog ) +EVT_TREE_ITEM_ACTIVATED( ID_TREECTRL_HIERARCHY, + WinEDA_HierFrame::OnSelect ) END_EVENT_TABLE() /*************************************************************************/ -void WinEDA_SchematicFrame::InstallHierarchyFrame(wxDC * DC, wxPoint &pos) +void WinEDA_SchematicFrame::InstallHierarchyFrame( wxDC* DC, wxPoint& pos ) /*************************************************************************/ { - WinEDA_HierFrame * treeframe = new WinEDA_HierFrame(this, DC, pos); - treeframe->ShowModal(); treeframe->Destroy(); + WinEDA_HierFrame* treeframe = new WinEDA_HierFrame( this, DC, pos ); + + treeframe->ShowModal(); treeframe->Destroy(); } -WinEDA_HierFrame::WinEDA_HierFrame(WinEDA_SchematicFrame *parent, wxDC * DC, - const wxPoint& pos): - wxDialog(parent, -1, _("Navigator"), pos, wxSize(110,50), - DIALOG_STYLE) +WinEDA_HierFrame::WinEDA_HierFrame( WinEDA_SchematicFrame* parent, wxDC* DC, + const wxPoint& pos ) : + wxDialog( parent, -1, _( "Navigator" ), pos, wxSize( 110, 50 ), + DIALOG_STYLE ) { - wxTreeItemId cellule; + wxTreeItemId cellule; - m_Parent = parent; - m_DC = DC; - m_Tree = new WinEDA_Tree(this); + m_Parent = parent; + m_DC = DC; + m_Tree = new WinEDA_Tree( this ); - m_nbsheets = 1; + m_nbsheets = 1; - cellule = m_Tree->AddRoot(_("Root"), 0, 1); - m_Tree->SetItemBold(cellule, TRUE); - DrawSheetPath list; - list.Push(g_RootSheet); - m_Tree->SetItemData( cellule, new TreeItemData(list) ); + cellule = m_Tree->AddRoot( _( "Root" ), 0, 1 ); + m_Tree->SetItemBold( cellule, TRUE ); + DrawSheetPath list; + list.Push( g_RootSheet ); + m_Tree->SetItemData( cellule, new TreeItemData( list ) ); -wxRect itemrect; + wxRect itemrect; #ifdef __UNIX__ - itemrect.SetWidth(100); - itemrect.SetHeight(20); + itemrect.SetWidth( 100 ); + itemrect.SetHeight( 20 ); #else - m_Tree->GetBoundingRect(cellule,itemrect); + m_Tree->GetBoundingRect( cellule, itemrect ); #endif - m_TreeSize.x = itemrect.GetWidth() + 10; - m_TreeSize.y = 20; + m_TreeSize.x = itemrect.GetWidth() + 10; + m_TreeSize.y = 20; - if( m_Parent->GetSheet()->Last() == g_RootSheet ) - m_Tree->SelectItem(cellule); //root. + if( m_Parent->GetSheet()->Last() == g_RootSheet ) + m_Tree->SelectItem( cellule ); //root. - maxposx = 15; - BuildSheetList(&list, &cellule); + maxposx = 15; + BuildSheetList( &list, &cellule ); - if ( m_nbsheets > 1) - { - m_Tree->Expand(cellule); + if( m_nbsheets > 1 ) + { + m_Tree->Expand( cellule ); - // Reajustage de la taille de la frame a une valeur optimale - m_TreeSize.y += m_nbsheets * itemrect.GetHeight(); - m_TreeSize.x = MIN(m_TreeSize.x, 250); - m_TreeSize.y = MIN( m_TreeSize.y, 350); - SetClientSize(m_TreeSize); - } + // Reajustage de la taille de la frame a une valeur optimale + m_TreeSize.y += m_nbsheets * itemrect.GetHeight(); + m_TreeSize.x = MIN( m_TreeSize.x, 250 ); + m_TreeSize.y = MIN( m_TreeSize.y, 350 ); + SetClientSize( m_TreeSize ); + } } + WinEDA_HierFrame::~WinEDA_HierFrame() { } /************************************************************************/ -void WinEDA_HierFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) +void WinEDA_HierFrame::OnQuit( wxCommandEvent& WXUNUSED (event) ) /************************************************************************/ { // true is to force the frame to close - Close(true); + Close( true ); } + /********************************************************************/ -void WinEDA_HierFrame::BuildSheetList(DrawSheetPath* list, - wxTreeItemId * previousmenu) +void WinEDA_HierFrame::BuildSheetList( DrawSheetPath* list, + wxTreeItemId* previousmenu ) /********************************************************************/ + /* Routine de creation de l'arbre de navigation dans la hierarchy -schematique - Cette routine est Reentrante ! -*/ + * schematique + * Cette routine est Reentrante ! + */ { -wxTreeItemId menu; + wxTreeItemId menu; - if( m_nbsheets > NB_MAX_SHEET ){ - if( m_nbsheets == (NB_MAX_SHEET + 1) ){ - wxString msg; - msg << wxT("BuildSheetList: Error: nbsheets > ") << NB_MAX_SHEET; - DisplayError(this, msg); - m_nbsheets++; - } - return; - } + if( m_nbsheets > NB_MAX_SHEET ) + { + if( m_nbsheets == (NB_MAX_SHEET + 1) ) + { + wxString msg; + msg << wxT( "BuildSheetList: Error: nbsheets > " ) << NB_MAX_SHEET; + DisplayError( this, msg ); + m_nbsheets++; + } + return; + } - maxposx += m_Tree->GetIndent(); - EDA_BaseStruct* bs = list->LastDrawList(); - while(bs && m_nbsheets < NB_MAX_SHEET){ - if(bs->Type() == DRAW_SHEET_STRUCT_TYPE){ - DrawSheetStruct* ss = (DrawSheetStruct*)bs; - m_nbsheets++; - menu = m_Tree->AppendItem(*previousmenu, - ss->m_SheetName, 0 , 1 ); - list->Push(ss); - m_Tree->SetItemData( menu, new TreeItemData(*list) ); - int ll = m_Tree->GetItemText(menu).Len(); + maxposx += m_Tree->GetIndent(); + EDA_BaseStruct* bs = list->LastDrawList(); + while( bs && m_nbsheets < NB_MAX_SHEET ) + { + if( bs->Type() == DRAW_SHEET_STRUCT_TYPE ) + { + DrawSheetStruct* ss = (DrawSheetStruct*) bs; + m_nbsheets++; + menu = m_Tree->AppendItem( *previousmenu, + ss->m_SheetName, 0, 1 ); + list->Push( ss ); + m_Tree->SetItemData( menu, new TreeItemData( *list ) ); + int ll = m_Tree->GetItemText( menu ).Len(); #ifdef __WINDOWS__ - ll *= 9; // * char width + ll *= 9; // * char width #else - ll *= 12; // * char width + ll *= 12; // * char width #endif - ll += maxposx + 20; - m_TreeSize.x = MAX(m_TreeSize.x, ll); - m_TreeSize.y += 1; - if ( *list == *(m_Parent->GetSheet()) ){ - m_Tree->EnsureVisible(menu); - m_Tree->SelectItem(menu); - } - BuildSheetList(list, &menu); - m_Tree->Expand(menu); - list->Pop(); - } - bs = bs->Pnext; - } - maxposx -= m_Tree->GetIndent(); + ll += maxposx + 20; + m_TreeSize.x = MAX( m_TreeSize.x, ll ); + m_TreeSize.y += 1; + if( *list == *( m_Parent->GetSheet() ) ) + { + m_Tree->EnsureVisible( menu ); + m_Tree->SelectItem( menu ); + } + BuildSheetList( list, &menu ); + m_Tree->Expand( menu ); + list->Pop(); + } + bs = bs->Pnext; + } + + maxposx -= m_Tree->GetIndent(); } /***************************************************/ -void WinEDA_HierFrame::OnSelect(wxTreeEvent& event) +void WinEDA_HierFrame::OnSelect( wxTreeEvent& event ) /***************************************************/ + /* Called on a double-click on a tree item: - Open the selected sheet, and display the corresponding screen -*/ + * Open the selected sheet, and display the corresponding screen + */ { - wxTreeItemId ItemSel = m_Tree->GetSelection(); + wxTreeItemId ItemSel = m_Tree->GetSelection(); - *(m_Parent->m_CurrentSheet) = - ((TreeItemData*)(m_Tree->GetItemData(ItemSel)))->m_SheetList; - UpdateScreenFromSheet(m_Parent); - Close(TRUE); + *(m_Parent->m_CurrentSheet) = + ( (TreeItemData*) ( m_Tree->GetItemData( ItemSel ) ) )->m_SheetList; + UpdateScreenFromSheet( m_Parent ); + Close( TRUE ); } + /******************************************************/ void WinEDA_SchematicFrame::InstallPreviousSheet() /******************************************************/ + /* Set the current screen to display the parent sheet of the current displayed sheet -*/ + */ { - if( m_CurrentSheet->Last() == g_RootSheet ) return; + if( m_CurrentSheet->Last() == g_RootSheet ) + return; - g_ItemToRepeat = NULL; - MsgPanel->EraseMsgBox(); - //make a copy for testing purposes. - DrawSheetPath listtemp = *m_CurrentSheet; - listtemp.Pop(); - if ( listtemp.LastScreen() == NULL ){ - DisplayError( this, wxT("InstallPreviousScreen() Error: Sheet not found")); - return; - } - m_CurrentSheet->Pop(); - UpdateScreenFromSheet(this); + g_ItemToRepeat = NULL; + MsgPanel->EraseMsgBox(); + + //make a copy for testing purposes. + DrawSheetPath listtemp = *m_CurrentSheet; + listtemp.Pop(); + if( listtemp.LastScreen() == NULL ) + { + DisplayError( this, wxT( "InstallPreviousScreen() Error: Sheet not found" ) ); + return; + } + m_CurrentSheet->Pop(); + UpdateScreenFromSheet( this ); } + /*********************************************************************/ -void WinEDA_SchematicFrame::InstallNextScreen(DrawSheetStruct * Sheet) +void WinEDA_SchematicFrame::InstallNextScreen( DrawSheetStruct* Sheet ) /*********************************************************************/ + /* Routine d'installation de l'ecran correspondant au symbole Sheet pointe - par la souris - have to be careful here because the DrawSheetStructs within the EEDrawList - don't actually have a valid m_AssociatedScreen (on purpose -- you need the m_SubSheet hierarchy - to maintain path info (well, this is but one way to maintain path info..) -*/ + * par la souris + * have to be careful here because the DrawSheetStructs within the EEDrawList + * don't actually have a valid m_AssociatedScreen (on purpose -- you need the m_SubSheet hierarchy + * to maintain path info (well, this is but one way to maintain path info..) + */ { - if( Sheet == NULL) - { - DisplayError(this,wxT("InstallNextScreen() error")); return; - } - m_CurrentSheet->Push(Sheet); - g_ItemToRepeat = NULL; - MsgPanel->EraseMsgBox(); - UpdateScreenFromSheet(this); + if( Sheet == NULL ) + { + DisplayError( this, wxT( "InstallNextScreen() error" ) ); return; + } + m_CurrentSheet->Push( Sheet ); + g_ItemToRepeat = NULL; + MsgPanel->EraseMsgBox(); + UpdateScreenFromSheet( this ); } + /**************************************************************/ -static bool UpdateScreenFromSheet(WinEDA_SchematicFrame * frame) +static bool UpdateScreenFromSheet( WinEDA_SchematicFrame* frame ) /**************************************************************/ /* Recherche et installe de l'ecran relatif au sheet symbole Sheet. - Si Sheet == NULL installation de l'ecran de base ( Root ). -*/ + * Si Sheet == NULL installation de l'ecran de base ( Root ). + */ { - SCH_SCREEN * NewScreen; + SCH_SCREEN* NewScreen; - NewScreen = frame->m_CurrentSheet->LastScreen(); - if(!NewScreen) - { - DisplayError(frame, wxT("Screen not found for this sheet")); - return false; - } + NewScreen = frame->m_CurrentSheet->LastScreen(); + if( !NewScreen ) + { + DisplayError( frame, wxT( "Screen not found for this sheet" ) ); + return false; + } - // Reinit des parametres d'affichage du nouvel ecran - // assumes m_CurrentSheet has already been updated. - frame->MsgPanel->EraseMsgBox(); - frame->DrawPanel->SetScrollbars( frame->DrawPanel->m_Scroll_unit, - frame->DrawPanel->m_Scroll_unit, - NewScreen->m_ScrollbarNumber.x, - NewScreen->m_ScrollbarNumber.y, - NewScreen->m_ScrollbarPos.x, - NewScreen->m_ScrollbarPos.y,TRUE); + // Reinit des parametres d'affichage du nouvel ecran + // assumes m_CurrentSheet has already been updated. + frame->MsgPanel->EraseMsgBox(); + frame->DrawPanel->SetScrollbars( frame->DrawPanel->m_Scroll_unit, + frame->DrawPanel->m_Scroll_unit, + NewScreen->m_ScrollbarNumber.x, + NewScreen->m_ScrollbarNumber.y, + NewScreen->m_ScrollbarPos.x, + NewScreen->m_ScrollbarPos.y, TRUE ); - //update the References - frame->m_CurrentSheet->UpdateAllScreenReferences(); + //update the References + frame->m_CurrentSheet->UpdateAllScreenReferences(); frame->SetSheetNumberAndCount(); - frame->DrawPanel->m_CanStartBlock = -1; - ActiveScreen = frame->m_CurrentSheet->LastScreen(); - if ( NewScreen->m_FirstRedraw ){ - NewScreen->m_FirstRedraw = FALSE; - frame->Zoom_Automatique(TRUE); - }else{ - frame->DrawPanel->Refresh(); - frame->DrawPanel->MouseToCursorSchema(); - } - return true; + frame->DrawPanel->m_CanStartBlock = -1; + ActiveScreen = frame->m_CurrentSheet->LastScreen(); + if( NewScreen->m_FirstRedraw ) + { + NewScreen->m_FirstRedraw = FALSE; + frame->Zoom_Automatique( TRUE ); + } + else + { + frame->DrawPanel->Refresh(); + frame->DrawPanel->MouseToCursorSchema(); + } + return true; } - diff --git a/eeschema/netform.cpp b/eeschema/netform.cpp index bd29ec2c4b..b664d657d5 100644 --- a/eeschema/netform.cpp +++ b/eeschema/netform.cpp @@ -236,11 +236,13 @@ static wxString ReturnPinNetName( ObjetNetListStruct* Pin, { if( g_TabObjNet[jj].m_Type != NET_PINLABEL ) { - NetName = g_TabObjNet[jj].m_SheetList.PathHumanReadable() - + NetName; + wxString lnet = NetName; + NetName = g_TabObjNet[jj].m_SheetList.PathHumanReadable(); + // If sheet path is too long, use the time stamp name insteed + if ( NetName.Length() > 32 ) + NetName = g_TabObjNet[jj].m_SheetList.Path(); + NetName += lnet; } - - //NetName << wxT("_") << g_TabObjNet[jj].m_SheetList.PathHumanReadable(); } else { @@ -619,7 +621,8 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with continue; wxString netname = ReturnPinNetName( Pin, wxT( "N-%.6d" ) ); if( netname.IsEmpty() ) - netname = wxT( " ?" ); + netname = wxT( "?" ); + netname.Replace( wxT( " " ), wxT( "_" ) ); fprintf( f, " ( %4.4s %s )\n", (char*) &Pin->m_PinNum, CONV_TO_UTF8( netname ) ); } diff --git a/include/build_version.h b/include/build_version.h index 33b6a50596..2cc961763d 100644 --- a/include/build_version.h +++ b/include/build_version.h @@ -9,7 +9,7 @@ COMMON_GLOBL wxString g_BuildVersion # include "config.h" (wxT(KICAD_SVN_VERSION)) # else - (wxT("(20080715")) + (wxT("(20080731.r1175")) # endif #endif ; diff --git a/include/pad_shapes.h b/include/pad_shapes.h index 53c578e35e..cf9858c8db 100644 --- a/include/pad_shapes.h +++ b/include/pad_shapes.h @@ -20,8 +20,7 @@ #define PAD_SMD 1 // Smd pad, appears on the layer paste (default) #define PAD_CONN 2 // Like smd, does not appear on the layer paste (default) // reserved, but not yet really used: -#define PAD_P_HOLE 3 // trou simple, utile sur pad stack -#define PAD_MECA 4 // PAD "mecanique" (fixation, zone cuivre...) +#define PAD_HOLE_NOT_PLATED 3 // like PAD_STANDARD, but not plated (no connection between copper layers) #endif // PAD_SHAPES_H_ diff --git a/include/wxstruct.h b/include/wxstruct.h index 4caeca2b4e..af711c017b 100644 --- a/include/wxstruct.h +++ b/include/wxstruct.h @@ -298,6 +298,14 @@ public: void OnActivate( wxActivateEvent& event ); void ReDrawPanel(); void TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_width ); + /** Function GetXYSheetReferences + * Return the X,Y sheet references where the point position is located + * @param aScreen = screen to use + * @param aPosition = position to identify by YX ref + * @return a wxString containing the message locator like A3 or B6 (or ?? if out of page limits) + */ + wxString GetXYSheetReferences( BASE_SCREEN* aScreen, const wxPoint& aPosition ); + void DisplayToolMsg( const wxString msg ); void Process_Zoom( wxCommandEvent& event ); void Process_Grid( wxCommandEvent& event ); diff --git a/pcbnew/class_pad.cpp b/pcbnew/class_pad.cpp index 15c6e646bf..6904edbf9d 100644 --- a/pcbnew/class_pad.cpp +++ b/pcbnew/class_pad.cpp @@ -94,7 +94,7 @@ EDA_Rect D_PAD::GetBoundingBox() EDA_Rect area; area.SetOrigin(m_Pos); area.Inflate(m_Rayon, m_Rayon); - + return area; } @@ -256,7 +256,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin int zoom; int fillpad = 0; wxPoint shape_pos; - + if ( m_Flags & DO_NOT_DRAW ) return; @@ -747,9 +747,7 @@ int D_PAD::ReadDescr( FILE* File, int* LineNum ) if( strncmp( BufLine, "CONN", 4 ) == 0 ) m_Attribut = PAD_CONN; if( strncmp( BufLine, "HOLE", 4 ) == 0 ) - m_Attribut = PAD_P_HOLE; - if( strncmp( BufLine, "MECA", 4 ) == 0 ) - m_Attribut = PAD_MECA; + m_Attribut = PAD_HOLE_NOT_PLATED; break; case 'N': /* Lecture du netname */ @@ -777,7 +775,9 @@ int D_PAD::ReadDescr( FILE* File, int* LineNum ) } +/*************************************/ bool D_PAD::Save( FILE* aFile ) const +/*************************************/ { int cshape; const char* texttype; @@ -833,12 +833,9 @@ bool D_PAD::Save( FILE* aFile ) const case PAD_CONN: texttype = "CONN"; break; - case PAD_P_HOLE: + case PAD_HOLE_NOT_PLATED: texttype = "HOLE"; break; - case PAD_MECA: - texttype = "MECA"; break; - default: texttype = "STD"; DisplayError( NULL, wxT( "Invalid Pad attribute" ) ); @@ -1144,8 +1141,7 @@ static const char* ShowPadAttr( int aPadAttr ) case PAD_STANDARD: return "STD"; case PAD_SMD: return "SMD"; case PAD_CONN: return "CONN"; - case PAD_P_HOLE: return "HOLE"; - case PAD_MECA: return "MECA"; + case PAD_HOLE_NOT_PLATED: return "HOLE"; default: return "??unkown??"; } } diff --git a/pcbnew/dialog_pad_edit.cpp b/pcbnew/dialog_pad_edit.cpp index 4bd4719758..731306773c 100644 --- a/pcbnew/dialog_pad_edit.cpp +++ b/pcbnew/dialog_pad_edit.cpp @@ -1,12 +1,12 @@ ///////////////////////////////////////////////////////////////////////////// // Name: dialog_pad_edit.cpp -// Purpose: +// Purpose: // Author: jean-pierre Charras -// Modified by: +// Modified by: // Created: 28/02/2006 13:34:48 -// RCS-ID: +// RCS-ID: // Copyright: License GNU -// Licence: +// Licence: ///////////////////////////////////////////////////////////////////////////// // Generated by DialogBlocks (unregistered), 28/02/2006 13:34:48 @@ -141,10 +141,10 @@ bool WinEDA_PadPropertiesFrame::Create( wxWindow* parent, wxWindowID id, const w */ void WinEDA_PadPropertiesFrame::CreateControls() -{ +{ SetFont(*g_DialogFont); ////@begin WinEDA_PadPropertiesFrame content construction - // Generated by DialogBlocks, 27/08/2007 21:03:59 (unregistered) + // Generated by DialogBlocks, 30/07/2008 22:05:19 (unregistered) WinEDA_PadPropertiesFrame* itemDialog1 = this; @@ -205,8 +205,6 @@ void WinEDA_PadPropertiesFrame::CreateControls() m_PadTypeStrings.Add(_("Standard")); m_PadTypeStrings.Add(_("SMD")); m_PadTypeStrings.Add(_("Conn")); - m_PadTypeStrings.Add(_("Hole")); - m_PadTypeStrings.Add(_("Mechanical")); m_PadType = new wxRadioBox( itemDialog1, ID_LISTBOX_TYPE_PAD, _("Pad Type:"), wxDefaultPosition, wxDefaultSize, m_PadTypeStrings, 1, wxRA_SPECIFY_COLS ); m_PadType->SetSelection(0); m_PadOptSizer->Add(m_PadType, 0, wxGROW|wxALL, 5); @@ -234,7 +232,7 @@ void WinEDA_PadPropertiesFrame::CreateControls() m_PadLayerCmp->SetValue(false); itemStaticBoxSizer18->Add(m_PadLayerCmp, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5); - itemStaticBoxSizer18->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); + itemStaticBoxSizer18->Add(5, 5, 0, wxGROW|wxALL, 5); m_PadLayerAdhCmp = new wxCheckBox( itemDialog1, ID_CHECKBOX2, _("Adhesive Cmp"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_PadLayerAdhCmp->SetValue(false); @@ -337,7 +335,7 @@ void WinEDA_PadPropertiesFrame::OnCancelClick( wxCommandEvent& event ) ////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_PadPropertiesFrame. // Before editing this code, remove the block markers. event.Skip(); -////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_PadPropertiesFrame. +////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_PadPropertiesFrame. } @@ -386,7 +384,7 @@ void WinEDA_PadPropertiesFrame::OnListboxShapePadSelected( wxCommandEvent& event void WinEDA_PadPropertiesFrame::OnListboxTypePadSelected( wxCommandEvent& event ) { - PadTypeSelectedEvent(event); + PadTypeSelected(); } diff --git a/pcbnew/dialog_pad_edit.h b/pcbnew/dialog_pad_edit.h index b719f1f07b..0e3d117fce 100644 --- a/pcbnew/dialog_pad_edit.h +++ b/pcbnew/dialog_pad_edit.h @@ -1,12 +1,12 @@ ///////////////////////////////////////////////////////////////////////////// // Name: dialog_pad_edit.h -// Purpose: +// Purpose: // Author: jean-pierre Charras -// Modified by: +// Modified by: // Created: 28/02/2006 13:34:48 -// RCS-ID: +// RCS-ID: // Copyright: License GNU -// Licence: +// Licence: ///////////////////////////////////////////////////////////////////////////// // Generated by DialogBlocks (unregistered), 28/02/2006 13:34:48 @@ -58,7 +58,7 @@ class wxBoxSizer; #define ID_CHECKBOX10 10016 #define ID_CHECKBOX11 10017 #define ID_CHECKBOX12 10018 -#define SYMBOL_WINEDA_PADPROPERTIESFRAME_STYLE wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX +#define SYMBOL_WINEDA_PADPROPERTIESFRAME_STYLE wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX|MAYBE_RESIZE_BORDER #define SYMBOL_WINEDA_PADPROPERTIESFRAME_TITLE _("Pad properties") #define SYMBOL_WINEDA_PADPROPERTIESFRAME_IDNAME ID_DIALOG #define SYMBOL_WINEDA_PADPROPERTIESFRAME_SIZE wxSize(400, 300) @@ -78,7 +78,7 @@ class wxBoxSizer; */ class WinEDA_PadPropertiesFrame: public wxDialog -{ +{ DECLARE_DYNAMIC_CLASS( WinEDA_PadPropertiesFrame ) DECLARE_EVENT_TABLE() @@ -131,7 +131,6 @@ public: void PadPropertiesAccept(wxCommandEvent& event); void PadTypeSelected(); - void PadTypeSelectedEvent(wxCommandEvent& event); void PadOrientEvent(wxCommandEvent& event); void SetPadLayersList(long layer_mask); void SetOthersControls(); diff --git a/pcbnew/dialog_pad_edit.pjd b/pcbnew/dialog_pad_edit.pjd index 8334014bed..b1ccb5599d 100644 --- a/pcbnew/dialog_pad_edit.pjd +++ b/pcbnew/dialog_pad_edit.pjd @@ -10,8 +10,10 @@ 0 0 0 + 1 1 1 + 1 0 "jean-pierre Charras" "License GNU" @@ -106,10 +108,12 @@ 0 0 1 + 0 1 1 0 1 + 0 @@ -132,6 +136,7 @@ 0 "" 1 + -8519680 "" "Debug" "ANSI" @@ -173,6 +178,8 @@ "%AUTO%" "%AUTO%" "%AUTO%" + 0 + 1 @@ -213,6 +220,7 @@ 0 "" 0 + 0 "ID_DIALOG" 10000 "WinEDA_PadPropertiesFrame" @@ -233,10 +241,16 @@ 0 1 "<Any platform>" + "" + "" + "" + "" + "" + "" + "Tiled" 0 1 0 - 0 1 0 0 @@ -321,6 +335,7 @@ "wbStaticTextProxy" "wxID_STATIC" 5105 + "" "wxStaticText" "wxStaticText" 1 @@ -340,6 +355,11 @@ "<Any platform>" "" "" + "" + "" + "" + "" + "" 0 0 0 @@ -385,6 +405,7 @@ "wbTextCtrlProxy" "ID_TEXTCTRL_PADNUM" 10001 + "" "wxTextCtrl" "wxTextCtrl" 1 @@ -404,6 +425,11 @@ "<Any platform>" "" "" + "" + "" + "" + "" + "" 0 0 0 @@ -419,6 +445,7 @@ 0 0 0 + 0 0 0 0 @@ -461,6 +488,7 @@ "wbStaticTextProxy" "wxID_STATIC" 5105 + "" "wxStaticText" "wxStaticText" 1 @@ -480,6 +508,11 @@ "<Any platform>" "" "" + "" + "" + "" + "" + "" 0 0 0 @@ -525,6 +558,7 @@ "wbTextCtrlProxy" "ID_TEXTCTRL_NETNAME" 10002 + "" "wxTextCtrl" "wxTextCtrl" 1 @@ -544,6 +578,11 @@ "<Any platform>" "" "" + "" + "" + "" + "" + "" 0 0 0 @@ -559,6 +598,7 @@ 0 0 0 + 0 0 0 0 @@ -654,6 +694,7 @@ "wxEVT_COMMAND_RADIOBOX_SELECTED|OnRadioboxDrillShapeSelected" "ID_RADIOBOX_DRILL_SHAPE" 10019 + "" "wxRadioBox" "wxRadioBox" 1 @@ -675,6 +716,11 @@ "<Any platform>" "" "" + "" + "" + "" + "" + "" 0 1 0 @@ -739,6 +785,7 @@ "wxEVT_COMMAND_RADIOBOX_SELECTED|OnListboxOrientPadSelected" "ID_LISTBOX_ORIENT_PAD" 10003 + "" "wxRadioBox" "wxRadioBox" 1 @@ -760,6 +807,11 @@ "<Any platform>" "" "" + "" + "" + "" + "" + "" 0 1 0 @@ -798,6 +850,7 @@ "wxEVT_COMMAND_RADIOBOX_SELECTED|OnListboxShapePadSelected" "ID_LISTBOX_SHAPE_PAD" 10004 + "" "wxRadioBox" "wxRadioBox" 1 @@ -819,6 +872,11 @@ "<Any platform>" "" "" + "" + "" + "" + "" + "" 0 1 0 @@ -857,6 +915,7 @@ "wxEVT_COMMAND_RADIOBOX_SELECTED|OnListboxTypePadSelected" "ID_LISTBOX_TYPE_PAD" 10005 + "" "wxRadioBox" "wxRadioBox" 1 @@ -866,7 +925,7 @@ "m_PadType" "Pad Type:" 1 - "Standard|SMD|Conn|Hole|Mechanical" + "Standard|SMD|Conn" 0 "" "" @@ -878,6 +937,11 @@ "<Any platform>" "" "" + "" + "" + "" + "" + "" 0 1 0 @@ -942,6 +1006,7 @@ "wxEVT_COMMAND_BUTTON_CLICKED|OnOkClick" "wxID_OK" 5100 + "" "wxButton" "wxButton" 1 @@ -953,6 +1018,13 @@ 0 "" "" + "" + "" + "" + "" + "" + "" + "" "" "CC0000" "" @@ -1001,6 +1073,7 @@ "wxEVT_COMMAND_BUTTON_CLICKED|OnCancelClick" "wxID_CANCEL" 5101 + "" "wxButton" "wxButton" 1 @@ -1012,6 +1085,13 @@ 0 "" "" + "" + "" + "" + "" + "" + "" + "" "" "0000FF" "" @@ -1093,6 +1173,7 @@ "wbCheckBoxProxy" "ID_CHECKBOX" 10006 + "" "wxCheckBox" "wxCheckBox" 1 @@ -1106,6 +1187,11 @@ "" "" "" + "" + "" + "" + "" + "" "" "" "" @@ -1151,6 +1237,7 @@ "wbCheckBoxProxy" "ID_CHECKBOX1" 10007 + "" "wxCheckBox" "wxCheckBox" 1 @@ -1164,6 +1251,11 @@ "" "" "" + "" + "" + "" + "" + "" "" "" "" @@ -1209,7 +1301,7 @@ "wbSpacerProxy" 5 5 - "Centre" + "Expand" "Centre" 0 5 @@ -1235,6 +1327,7 @@ "wbCheckBoxProxy" "ID_CHECKBOX2" 10008 + "" "wxCheckBox" "wxCheckBox" 1 @@ -1248,6 +1341,11 @@ "" "" "" + "" + "" + "" + "" + "" "" "" "" @@ -1293,6 +1391,7 @@ "wbCheckBoxProxy" "ID_CHECKBOX3" 10009 + "" "wxCheckBox" "wxCheckBox" 1 @@ -1306,6 +1405,11 @@ "" "" "" + "" + "" + "" + "" + "" "" "" "" @@ -1351,6 +1455,7 @@ "wbCheckBoxProxy" "ID_CHECKBOX4" 10010 + "" "wxCheckBox" "wxCheckBox" 1 @@ -1364,6 +1469,11 @@ "" "" "" + "" + "" + "" + "" + "" "" "" "" @@ -1409,6 +1519,7 @@ "wbCheckBoxProxy" "ID_CHECKBOX5" 10011 + "" "wxCheckBox" "wxCheckBox" 1 @@ -1422,6 +1533,11 @@ "" "" "" + "" + "" + "" + "" + "" "" "" "" @@ -1467,6 +1583,7 @@ "wbCheckBoxProxy" "ID_CHECKBOX6" 10012 + "" "wxCheckBox" "wxCheckBox" 1 @@ -1480,6 +1597,11 @@ "" "" "" + "" + "" + "" + "" + "" "" "" "" @@ -1525,6 +1647,7 @@ "wbCheckBoxProxy" "ID_CHECKBOX7" 10013 + "" "wxCheckBox" "wxCheckBox" 1 @@ -1538,6 +1661,11 @@ "" "" "" + "" + "" + "" + "" + "" "" "" "" @@ -1583,6 +1711,7 @@ "wbCheckBoxProxy" "ID_CHECKBOX8" 10014 + "" "wxCheckBox" "wxCheckBox" 1 @@ -1596,6 +1725,11 @@ "" "" "" + "" + "" + "" + "" + "" "" "" "" @@ -1641,6 +1775,7 @@ "wbCheckBoxProxy" "ID_CHECKBOX9" 10015 + "" "wxCheckBox" "wxCheckBox" 1 @@ -1654,6 +1789,11 @@ "" "" "" + "" + "" + "" + "" + "" "" "" "" @@ -1699,6 +1839,7 @@ "wbCheckBoxProxy" "ID_CHECKBOX10" 10016 + "" "wxCheckBox" "wxCheckBox" 1 @@ -1712,6 +1853,11 @@ "" "" "" + "" + "" + "" + "" + "" "" "" "" @@ -1757,6 +1903,7 @@ "wbCheckBoxProxy" "ID_CHECKBOX11" 10017 + "" "wxCheckBox" "wxCheckBox" 1 @@ -1770,6 +1917,11 @@ "" "" "" + "" + "" + "" + "" + "" "" "" "" @@ -1815,6 +1967,7 @@ "wbCheckBoxProxy" "ID_CHECKBOX12" 10018 + "" "wxCheckBox" "wxCheckBox" 1 @@ -1828,6 +1981,11 @@ "" "" "" + "" + "" + "" + "" + "" "" "" "" diff --git a/pcbnew/editpads.cpp b/pcbnew/editpads.cpp index 226eb8c723..bd96fa6922 100644 --- a/pcbnew/editpads.cpp +++ b/pcbnew/editpads.cpp @@ -26,22 +26,26 @@ int CodeShape[NBSHAPES] = /* forme des pads */ }; -#define NBTYPES 5 +#define NBTYPES 4 int CodeType[NBTYPES] = { - PAD_STANDARD, PAD_SMD, PAD_CONN, PAD_P_HOLE, PAD_MECA + PAD_STANDARD, PAD_SMD, PAD_CONN, PAD_HOLE_NOT_PLATED }; - +// Default mask layers for pads according to the pas type static long Std_Pad_Layers[NBTYPES] = { + // PAD_STANDARD: ALL_CU_LAYERS | SILKSCREEN_LAYER_CMP | SOLDERMASK_LAYER_CU | SOLDERMASK_LAYER_CMP, + + // PAD_CONN: CMP_LAYER | SOLDERPASTE_LAYER_CMP | SOLDERMASK_LAYER_CMP, + + // PAD_SMD: CMP_LAYER | SOLDERMASK_LAYER_CMP, - ALL_CU_LAYERS | SILKSCREEN_LAYER_CU | SILKSCREEN_LAYER_CMP | - SOLDERMASK_LAYER_CU | SOLDERMASK_LAYER_CMP, - ALL_CU_LAYERS | SILKSCREEN_LAYER_CU | SILKSCREEN_LAYER_CMP | - SOLDERMASK_LAYER_CU | SOLDERMASK_LAYER_CMP + + //PAD_HOLE_NOT_PLATED: + ALL_CU_LAYERS | SILKSCREEN_LAYER_CMP | SOLDERMASK_LAYER_CU | SOLDERMASK_LAYER_CMP }; @@ -247,18 +251,12 @@ void WinEDA_PadPropertiesFrame::PadOrientEvent( wxCommandEvent& event ) } -/**************************************************************************/ -void WinEDA_PadPropertiesFrame::PadTypeSelectedEvent( wxCommandEvent& event ) -/**************************************************************************/ - -/* calcule un layer_mask type selon la selection du type du pad - */ -{ - PadTypeSelected(); -} - +/************************************************/ void WinEDA_PadPropertiesFrame::PadTypeSelected() +/************************************************/ +/* Adjust the better mask layer according to the selected pad type + */ { long layer_mask; int ii; @@ -524,8 +522,11 @@ void WinEDA_PadPropertiesFrame::PadPropertiesAccept( wxCommandEvent& event ) CurrentPad->m_Drill = wxSize( 0, 0 ); break; - case PAD_P_HOLE: - case PAD_MECA: + case PAD_HOLE_NOT_PLATED: + break; + + default: + DisplayError(this, wxT("Error: unknown pad type")); break; } diff --git a/pcbnew/files.cpp b/pcbnew/files.cpp index 6d08f1579f..4997a546fc 100644 --- a/pcbnew/files.cpp +++ b/pcbnew/files.cpp @@ -132,6 +132,7 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, bool Append ) int ii; FILE* source; wxString msg; + char cbuf[1024]; ActiveScreen = GetScreen(); diff --git a/pcbnew/librairi.cpp b/pcbnew/librairi.cpp index f80d28bdd9..ef71639f81 100644 --- a/pcbnew/librairi.cpp +++ b/pcbnew/librairi.cpp @@ -794,6 +794,7 @@ int WinEDA_ModuleEditFrame::Create_Librairie( const wxString& LibName ) { FILE* lib_module; wxString msg; + char cbuf[256]; if( wxFileExists( LibName ) ) { @@ -835,6 +836,7 @@ static bool CreateDocLibrary( const wxString& LibName ) */ { char Line[1024]; + char cbuf[256]; wxString Name, Doc, KeyWord; wxString LibDocName; FILE* LibMod, * LibDoc; diff --git a/pcbnew/pcbnew.h b/pcbnew/pcbnew.h index e693226d03..e981e5bb3b 100644 --- a/pcbnew/pcbnew.h +++ b/pcbnew/pcbnew.h @@ -212,10 +212,7 @@ eda_global char* adr_himem; /* adresse haute limite de la memoire disponible eda_global char* adr_max; /* adresse haute maxi utilisee pour la memoire */ -/* variables g�erales */ - -eda_global char cbuf[1024]; /* buffer for some text printing */ -eda_global BOARD* g_ModuleEditor_Pcb; /* board used to edit footprints (used by modedit)*/ +/* variables generales */ eda_global int g_TimeOut; // Timer for automatic saving eda_global int g_SaveTime; // Time for next saving @@ -320,6 +317,7 @@ eda_global int g_PadCMPColor; #endif eda_global PCB_SCREEN* ScreenPcb; /* Ecran principal */ +eda_global BOARD* g_ModuleEditor_Pcb; /* board used to edit footprints (used by modedit)*/ eda_global PCB_SCREEN* ScreenModule; /* Ecran de l'editeur de modules */ diff --git a/pcbnew/plotgerb.cpp b/pcbnew/plotgerb.cpp index 7bf18dc46e..f33dffd33e 100644 --- a/pcbnew/plotgerb.cpp +++ b/pcbnew/plotgerb.cpp @@ -367,6 +367,7 @@ void trace_1_pastille_OVALE_GERBER( wxPoint pos, wxSize size, int orient ) */ { D_CODE* dcode_ptr; + char cbuf[256]; int x0, y0, x1, y1, delta; if( orient == 900 || orient == 2700 ) /* orient tournee de 90 deg */ @@ -420,6 +421,7 @@ void Plot_1_CIRCLE_pad_GERBER( wxPoint pos, int diametre ) */ { D_CODE* dcode_ptr; + char cbuf[256]; wxSize size( diametre, diametre ); @@ -451,6 +453,7 @@ void PlotRectangularPad_GERBER( wxPoint pos, wxSize size, int orient ) */ { D_CODE* dcode_ptr; + char cbuf[256]; /* Trace de la forme flashee */ switch( orient ) @@ -630,6 +633,7 @@ void PlotGERBERLine( wxPoint start, wxPoint end, int large ) */ { D_CODE* dcode_ptr; + char cbuf[256]; UserToDeviceCoordinate( start ); UserToDeviceCoordinate( end ); @@ -865,6 +869,7 @@ int WinEDA_BasePcbFrame::Gen_D_CODE_File( FILE* penfile ) */ { D_CODE* ptr_tool; + char cbuf[1024]; int nb_dcodes = 0; /* Init : */ diff --git a/pcbnew/plothpgl.cpp b/pcbnew/plothpgl.cpp index 915047ce31..a0df102736 100644 --- a/pcbnew/plothpgl.cpp +++ b/pcbnew/plothpgl.cpp @@ -499,6 +499,7 @@ void trace_1_pastille_RONDE_HPGL( wxPoint pos, int diametre, int modetrace ) /**************************************************************************/ /* Trace 1 pastille RONDE (via,pad rond) en position pos */ { + char cbuf[1024]; int rayon, delta; UserToDeviceCoordinate( pos ); diff --git a/pcbnew/router.cpp b/pcbnew/router.cpp index bb883490ff..d7b3a3b29c 100644 --- a/pcbnew/router.cpp +++ b/pcbnew/router.cpp @@ -237,8 +237,7 @@ void Out_Pads( BOARD* Pcb, FILE* outfile ) fprintf( outfile, " %d", 2 ); break; - case PAD_P_HOLE: - case PAD_MECA: + case PAD_HOLE_NOT_PLATED: fprintf( outfile, " %d", 4 ); break; }