Loading change_log.txt +10 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,16 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with email address. 2007-Jul-25 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> ================================================================================ ** Some minor enhancements + pcbnew In Drc diags, better (more explicit) messages Change (and simplify) code in 'update' as well as 'insert' modules into main PCB from within the module editor, because it had a bug (crashes when there was no footprint in pcb) 2007-June-21 UPDATE Tim Hanson <tim@hardcarve.com> ================================================================================ + pcbnew Loading cvpcb/cvpcb.h +1 −1 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ #include "colors.h" // Define print format d to display a schematic component line #define CMP_FORMAT wxT("%3d %8.8s - %16.16s : %-.32s") #define CMP_FORMAT wxT("%3d %+8s - %+16s : %-.32s") #define FILTERFOOTPRINTKEY "FilterFootprint" Loading cvpcb/options.cppdeleted 100644 → 0 +0 −225 Original line number Diff line number Diff line /*****************************************************************/ /** options.cpp: options pour la visualisation des composants **/ /****************************************************************/ #include "fctsys.h" #include "wxstruct.h" #include "common.h" #include "cvpcb.h" #include "protos.h" enum { SET_OPTION = 8000, SET_EDGE_FORMAT, SET_TEXTE_FORMAT, PADFILL_OPT, PADNUM_OPT, EDGE_SELECT, TEXT_SELECT, ID_SAVE_CONFIG }; /********************************************/ /* Classes derivees pour la fenetre Options */ /********************************************/ class wxMyCheckBox: public wxCheckBox { private: protected: public: bool * BoolVar; // Constructor and destructor wxMyCheckBox(wxWindow *parent, int id, const wxString & Title, bool * RefVar, wxPoint& pos); ~wxMyCheckBox(void) { }; }; /************************************************************/ /* classe derivee pour la fenetre de selection des options */ /* d'affichage du module */ /************************************************************/ class wxOptionsBox: public wxDialog { private: protected: public: WinEDA_BasePcbFrame * m_Parent; wxMyCheckBox * IsShowPadFill; wxMyCheckBox * IsShowPadNum; wxRadioBox * EdgeRadioBox; wxRadioBox *TextRadioBox; // Constructor and destructor wxOptionsBox(WinEDA_BasePcbFrame * parent, wxPoint& pos); ~wxOptionsBox(void); bool OnClose(void); void SetOptPadFill( wxCommandEvent& event); void SetOptPadNum( wxCommandEvent& event); void ReturnDisplayEdgeFormat(wxCommandEvent& event); void ReturnDisplayTexteFormat(wxCommandEvent& event); void SaveConfig(wxCommandEvent& event); DECLARE_EVENT_TABLE() }; BEGIN_EVENT_TABLE(wxOptionsBox, wxDialog ) EVT_CHECKBOX(PADFILL_OPT, wxOptionsBox::SetOptPadFill) EVT_CHECKBOX(PADNUM_OPT, wxOptionsBox::SetOptPadNum) EVT_RADIOBOX(EDGE_SELECT, wxOptionsBox::ReturnDisplayEdgeFormat) EVT_RADIOBOX(TEXT_SELECT, wxOptionsBox::ReturnDisplayTexteFormat) EVT_BUTTON(ID_SAVE_CONFIG, wxOptionsBox::SaveConfig) END_EVENT_TABLE() /*********************************************************************/ void WinEDA_DisplayFrame::InstallOptionsDisplay(wxCommandEvent& event) /*********************************************************************/ /* Creation de la fenetre d'options de la fenetre de visu */ { wxPoint pos; GetPosition(&pos.x, &pos.y); pos.x += 10; if (pos.x < 0 ) pos.x = 0; pos.y += 50; if (pos.y < 0 ) pos.y = 0; wxOptionsBox * OptionWindow = new wxOptionsBox(this, pos); OptionWindow->ShowModal(); OptionWindow->Destroy(); } /********************************/ /* Constructeur de wxMyCheckBox */ /********************************/ wxMyCheckBox::wxMyCheckBox(wxWindow *parent, int id, const wxString & Title, bool * RefVar, wxPoint& pos): wxCheckBox(parent, id, Title, pos) { BoolVar = RefVar; if( * BoolVar ) this->SetValue(TRUE); else this->SetValue(FALSE); } /******************************************************/ void wxOptionsBox::SetOptPadFill(wxCommandEvent& event) /******************************************************/ { *IsShowPadFill->BoolVar == 0 ? * IsShowPadFill->BoolVar = 1 : * IsShowPadFill->BoolVar = 0; DisplayOpt.DisplayPadFill = m_Parent->m_DisplayPadFill = IsShowPadFill->BoolVar; m_Parent->ReDrawPanel(); } /******************************************************/ void wxOptionsBox::SetOptPadNum(wxCommandEvent& event) /******************************************************/ { *IsShowPadNum->BoolVar == 0 ? *IsShowPadNum->BoolVar = TRUE : *IsShowPadNum->BoolVar = FALSE; DisplayOpt.DisplayPadNum = m_Parent->m_DisplayPadNum = IsShowPadNum->BoolVar; m_Parent->ReDrawPanel(); } /********************************/ /* Constructeur de wxOptionsBox */ /********************************/ wxOptionsBox::wxOptionsBox(WinEDA_BasePcbFrame * parent, wxPoint& bpos): wxDialog(parent, -1, _("Options"), bpos, wxSize(220, 195), DIALOG_STYLE) { wxPoint pos; m_Parent = parent; SetFont(*g_DialogFont); pos.x = 100; pos.y = 15; new wxButton(this, ID_SAVE_CONFIG, _("Save Cfg"), pos); pos.x = 10; pos.y = 10; IsShowPadFill = new wxMyCheckBox(this, PADFILL_OPT, _("&Pad Fill"), &DisplayOpt.DisplayPadFill, pos); pos.y += 20; IsShowPadNum = new wxMyCheckBox(this, PADNUM_OPT, _("Pad &Num"), &DisplayOpt.DisplayPadNum, pos); pos.y += 25; wxString DrawOpt[] = { _("&Filaire"), _("&Filled"), _("&Sketch")}; EdgeRadioBox = new wxRadioBox(this, EDGE_SELECT, _("Edges:"), pos, wxSize(-1,-1), 3,DrawOpt,1,wxRA_SPECIFY_COLS); EdgeRadioBox->SetSelection(DisplayOpt.DisplayModEdge); pos.x += 100; TextRadioBox = new wxRadioBox(this, TEXT_SELECT, _("Texts:"), pos,wxSize(-1,-1), 3, DrawOpt, 1,wxRA_SPECIFY_COLS); TextRadioBox->SetSelection(DisplayOpt.DisplayModText); } /*****************************/ /* Destructeur de OptionsBox */ /*****************************/ wxOptionsBox::~wxOptionsBox(void) { } /**************************************/ /* Fonctions de base de wxMyDialogBox */ /**************************************/ /*******************************/ bool wxOptionsBox::OnClose(void) /*******************************/ { Show(FALSE); return TRUE; } /****************************************************************/ void wxOptionsBox::ReturnDisplayEdgeFormat(wxCommandEvent& event) /****************************************************************/ { DisplayOpt.DisplayModEdge = m_Parent->m_DisplayModEdge = EdgeRadioBox->GetSelection(); m_Parent->ReDrawPanel(); } /****************************************************************/ void wxOptionsBox::ReturnDisplayTexteFormat(wxCommandEvent& event) /****************************************************************/ { DisplayOpt.DisplayModText = m_Parent->m_DisplayModText = TextRadioBox->GetSelection(); m_Parent->ReDrawPanel(); } /***************************************************/ void wxOptionsBox::SaveConfig(wxCommandEvent& event) /***************************************************/ { Save_Config(this); } cvpcb/rdorcad.cppdeleted 100644 → 0 +0 −320 Original line number Diff line number Diff line /************/ /* rdorcad()*/ /************/ /* convertit la netliste ORCADPCB en netliste ORCADPCB (fichier temporaire) assure la raffectation des alimentations selon le format : ( XXXXXX VALEUR|(pin1,pin2,...=newalim) ID VALEUR */ #include "fctsys.h" #include "wxstruct.h" #include "common.h" #include "cvpcb.h" #include "protos.h" #define SEPARATEUR '|' /* caractere separateur dans netliste */ /* routines locales : */ int pin_orcad(STORECMP * CurrentCmp); /****************************************/ /* int WinEDA_CvpcbFrame::rdorcad(void) */ /****************************************/ int WinEDA_CvpcbFrame::rdorcad(void) { int i , j , k ,l ; char * LibName; char Line[1024]; int FlagEESchema = 0; char label[80] ; /* buffer des references composants */ char ref_schema[80] ; /* buffer de la ref schematique */ char val[80] ; /* buffer des valeurs/ref.lib */ char postval[80] ; /* buffer de la valeur de fin de ligne (vraie valeur) */ char *ptchar ; /* pointeur de service */ STORECMP * Cmp; modified = 0; Rjustify = 0; /* Raz buffer et variable de gestion */ if( 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); } /* 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) ; if( i != 0 ) i = strnicmp(Line,"({",2) ; if( i != 0 ) { i = strnicmp(Line,"# EESchema",7) ; /* net type EESchema */ if( i == 0 ) FlagEESchema = 1; } 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: EESchema"), 0); /* Lecture de la liste */ for (;;) { /* recherche du debut de la description d'un composant */ if( fgets(Line,80,source) == 0 ) break; /* suppression des blancs en dbut de ligne */ i = 0 ; while (Line[i] == ' ') i++ ; /* elimination des lignes vides : */ if (Line[i] < ' ') 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 */ j = 0 ; while ( Line[i] != ' ') ref_schema[j++] = Line[i++] ; ref_schema[j] = 0 ; /* recherche val/ref.lib */ while ( Line[i] == ' ') i++ ; /* i pointe la valeur du composant */ LibName = Line + i; memset(label, 0, sizeof(label)); memset(val, 0, sizeof(val) ) ; memset(postval, 0, sizeof(postval) ) ; memset(alim, 0, sizeof(alim) ) ; /* lecture valeur du composant */ /* recherche fin de valeur (' ') */ ptchar = strstr(&Line[i]," ") ; if (ptchar == 0) { wxString msg; msg.Printf( _("Netlist error: %s"),Line) ; DisplayError(NULL, msg); k = 0 ; } else k = ptchar - Line ; for (j = 0 ; i < k ; i++) { if ( Line[i] == SEPARATEUR ) break ; if ( j < 8 ) val[j++] = Line[i] ; } 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 */ /* debut reference trouv */ for ( k = 0 ; k < 8 ; i++ , k++ ) { if ( Line[i] <= ' ' ) break ; label[k] = Line[i] ; } /* recherche vraie valeur du composant */ while(Line[i] != ' ') i++ ; /* elimination fin reference */ while(Line[i] == ' ') i++ ; /* recherche debut vraie valeur */ /* debut vraie valeur trouve */ for ( k = 0 ; k < 16 ; i++ , k++ ) { if ( Line[i] <= ' ' ) break ; postval[k] = Line[i] ; } /* classement du composant ,suivi de sa valeur */ Cmp = new STORECMP(); Cmp->Pnext = BaseListeCmp; BaseListeCmp = Cmp; Cmp->m_Reference = CONV_FROM_UTF8(label); Cmp->m_Valeur = CONV_FROM_UTF8(postval) ; if( FlagEESchema ) /* Copie du nom module: */ { if( strnicmp(LibName, "$noname", 7 ) != 0 ) { while( *LibName > ' ' ) { Cmp->m_Module.Append(*LibName); LibName++; } } } /* classement du TimeStamp */ Cmp->m_TimeStamp = CONV_FROM_UTF8(ref_schema); pin_orcad( Cmp) ; nbcomp++ ; } fclose(source); /* reclassement alpabtique : */ BaseListeCmp = TriListeComposantss( BaseListeCmp, nbcomp); return(0); } /***********************************/ int pin_orcad(STORECMP * Cmp) /***********************************/ { int i , jj; char numpin[9] , net[1024] ; char Line[1024]; STOREPIN * Pin = NULL; STOREPIN ** LastPin = & Cmp->m_Pins; for ( ;; ) { /* debut description trouv */ for ( ;; ) { if ( fgets(Line,80,source) == 0 ) return(-1) ; /* suppression des blancs en dbut de ligne */ i = 0 ; while (Line[i] == ' ') i++ ; while (Line[i] == '(') i++ ; while (Line[i] == ' ') i++ ; /* elimination des lignes vides : */ if (Line[i] < ' ') continue ; /* fin de description ? */ if (Line[i] == ')' ) return(0) ; memset( net, 0, sizeof(net) ); memset( numpin, 0, sizeof(numpin) ); /* lecture name pin , 4 lettres */ for (jj = 0 ; jj < 4 ; jj++ , i++) { if ( Line[i] == ' ' ) break ; numpin[jj] = Line[i] ; } /* recherche affectation force de net */ if ( reaffect(numpin,net) != 0) { Pin = new STOREPIN(); *LastPin = Pin; LastPin = &Pin->Pnext; Pin->m_PinNum = CONV_FROM_UTF8(numpin); Pin->m_PinNet = CONV_FROM_UTF8(net); continue ; } /* recherche netname */ while(Line[i] == ' ') i++ ; /* recherche debut reference */ /* debut netname trouv */ for ( jj = 0 ; jj < (int)sizeof(net)-1 ; i++ , jj++ ) { if ( Line[i] <= ' ' ) break ; net[jj] = Line[i] ; } Pin = new STOREPIN(); *LastPin = Pin; LastPin = &Pin->Pnext; Pin->m_PinNum = CONV_FROM_UTF8(numpin); Pin->m_PinNet = CONV_FROM_UTF8(net); } } } /****************************************************************/ 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 */ { STORECMP ** bufferptr, * Item; int ii; if (nbitems <= 0 ) return(NULL); bufferptr = (STORECMP**)MyZMalloc( (nbitems+2) * sizeof(STORECMP*) ); for( ii= 1, Item = BaseListe; Item != NULL; Item = Item->Pnext, 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 */ qsort(bufferptr+1,nbitems,sizeof(STORECMP*), (int(*)(const void*,const void*))CmpCompare) ; /* Mise a jour du chainage */ for( ii = 1; ii <= nbitems; ii++ ) { Item = bufferptr[ii]; Item->m_Num = ii; Item->Pnext = bufferptr[ii+1]; Item->Pback = bufferptr[ii-1]; } return(bufferptr[1]); } /****************************************/ int CmpCompare(void * mod1, void * mod2) /****************************************/ /* routine compare() pour qsort() en classement alphabetique des composants */ { int ii; STORECMP *pt1 , *pt2 ; pt1 = * ((STORECMP**)mod1); pt2 = * ((STORECMP**)mod2); //FIXME: ii = StrNumICmp( (const wxChar*) pt1->m_Reference, (const wxChar*) pt2->m_Reference ); return(ii); } cvpcb/readschematicnetlist.cpp +19 −19 Original line number Diff line number Diff line Loading @@ -29,10 +29,10 @@ int WinEDA_CvpcbFrame::ReadSchematicNetlist(void) int i , j , k ,l ; char * LibName; char Line[1024]; char label[80] ; /* buffer des references composants */ char component_reference[80] ; /* buffer des references composants */ char ref_schema[80] ; /* buffer de la ref schematique */ char val[80] ; /* buffer des valeurs/ref.lib */ char postval[80] ; /* buffer de la valeur de fin de ligne (vraie valeur) */ char footprint_name[80] ; /* buffer des ref.lib */ char component_value[80] ; /* buffer des valeurs */ char *ptchar ; /* pointeur de service */ STORECMP * Cmp; Loading Loading @@ -111,9 +111,9 @@ STORECMP * Cmp; while ( Line[i] == ' ') i++ ; /* i pointe la valeur du composant */ LibName = Line + i; memset(label, 0, sizeof(label)); memset(val, 0, sizeof(val) ) ; memset(postval, 0, sizeof(postval) ) ; 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 */ Loading @@ -132,7 +132,8 @@ STORECMP * Cmp; for (j = 0 ; i < k ; i++) { if ( Line[i] == SEPARATEUR ) break ; if ( j < 8 ) val[j++] = Line[i] ; if ( j < (int)(sizeof(footprint_name)-1) ) footprint_name[j++] = Line[i] ; } if ( (Line[++i] == '(') && (Line[k-1] == ')' ) ) Loading @@ -147,21 +148,20 @@ STORECMP * Cmp; while(Line[i] == ' ') i++ ; /* recherche debut reference */ /* debut reference trouv */ for ( k = 0 ; k < 8 ; i++ , k++ ) for ( k = 0 ; k < (int)(sizeof(component_reference)-1) ; i++ , k++ ) { if ( Line[i] <= ' ' ) break ; label[k] = Line[i] ; component_reference[k] = Line[i] ; } /* recherche vraie valeur du composant */ while(Line[i] != ' ') i++ ; /* elimination fin reference */ while(Line[i] == ' ') i++ ; /* recherche debut vraie valeur */ /* recherche valeur du composant */ while(Line[i] == ' ') i++ ; /* recherche debut valeur */ /* debut vraie valeur trouve */ for ( k = 0 ; k < 16 ; i++ , k++ ) /* debut vraie valeur trouvee */ for ( k = 0 ; k < (int)(sizeof(component_value)-1) ; i++ , k++ ) { if ( Line[i] <= ' ' ) break ; postval[k] = Line[i] ; component_value[k] = Line[i] ; } Loading @@ -169,8 +169,8 @@ STORECMP * Cmp; Cmp = new STORECMP(); Cmp->Pnext = g_BaseListeCmp; g_BaseListeCmp = Cmp; Cmp->m_Reference = CONV_FROM_UTF8(label); Cmp->m_Valeur = CONV_FROM_UTF8(postval) ; Cmp->m_Reference = CONV_FROM_UTF8(component_reference); Cmp->m_Valeur = CONV_FROM_UTF8(component_value) ; if( g_FlagEESchema ) /* Copie du nom module: */ { Loading Loading
change_log.txt +10 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,16 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with email address. 2007-Jul-25 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> ================================================================================ ** Some minor enhancements + pcbnew In Drc diags, better (more explicit) messages Change (and simplify) code in 'update' as well as 'insert' modules into main PCB from within the module editor, because it had a bug (crashes when there was no footprint in pcb) 2007-June-21 UPDATE Tim Hanson <tim@hardcarve.com> ================================================================================ + pcbnew Loading
cvpcb/cvpcb.h +1 −1 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ #include "colors.h" // Define print format d to display a schematic component line #define CMP_FORMAT wxT("%3d %8.8s - %16.16s : %-.32s") #define CMP_FORMAT wxT("%3d %+8s - %+16s : %-.32s") #define FILTERFOOTPRINTKEY "FilterFootprint" Loading
cvpcb/options.cppdeleted 100644 → 0 +0 −225 Original line number Diff line number Diff line /*****************************************************************/ /** options.cpp: options pour la visualisation des composants **/ /****************************************************************/ #include "fctsys.h" #include "wxstruct.h" #include "common.h" #include "cvpcb.h" #include "protos.h" enum { SET_OPTION = 8000, SET_EDGE_FORMAT, SET_TEXTE_FORMAT, PADFILL_OPT, PADNUM_OPT, EDGE_SELECT, TEXT_SELECT, ID_SAVE_CONFIG }; /********************************************/ /* Classes derivees pour la fenetre Options */ /********************************************/ class wxMyCheckBox: public wxCheckBox { private: protected: public: bool * BoolVar; // Constructor and destructor wxMyCheckBox(wxWindow *parent, int id, const wxString & Title, bool * RefVar, wxPoint& pos); ~wxMyCheckBox(void) { }; }; /************************************************************/ /* classe derivee pour la fenetre de selection des options */ /* d'affichage du module */ /************************************************************/ class wxOptionsBox: public wxDialog { private: protected: public: WinEDA_BasePcbFrame * m_Parent; wxMyCheckBox * IsShowPadFill; wxMyCheckBox * IsShowPadNum; wxRadioBox * EdgeRadioBox; wxRadioBox *TextRadioBox; // Constructor and destructor wxOptionsBox(WinEDA_BasePcbFrame * parent, wxPoint& pos); ~wxOptionsBox(void); bool OnClose(void); void SetOptPadFill( wxCommandEvent& event); void SetOptPadNum( wxCommandEvent& event); void ReturnDisplayEdgeFormat(wxCommandEvent& event); void ReturnDisplayTexteFormat(wxCommandEvent& event); void SaveConfig(wxCommandEvent& event); DECLARE_EVENT_TABLE() }; BEGIN_EVENT_TABLE(wxOptionsBox, wxDialog ) EVT_CHECKBOX(PADFILL_OPT, wxOptionsBox::SetOptPadFill) EVT_CHECKBOX(PADNUM_OPT, wxOptionsBox::SetOptPadNum) EVT_RADIOBOX(EDGE_SELECT, wxOptionsBox::ReturnDisplayEdgeFormat) EVT_RADIOBOX(TEXT_SELECT, wxOptionsBox::ReturnDisplayTexteFormat) EVT_BUTTON(ID_SAVE_CONFIG, wxOptionsBox::SaveConfig) END_EVENT_TABLE() /*********************************************************************/ void WinEDA_DisplayFrame::InstallOptionsDisplay(wxCommandEvent& event) /*********************************************************************/ /* Creation de la fenetre d'options de la fenetre de visu */ { wxPoint pos; GetPosition(&pos.x, &pos.y); pos.x += 10; if (pos.x < 0 ) pos.x = 0; pos.y += 50; if (pos.y < 0 ) pos.y = 0; wxOptionsBox * OptionWindow = new wxOptionsBox(this, pos); OptionWindow->ShowModal(); OptionWindow->Destroy(); } /********************************/ /* Constructeur de wxMyCheckBox */ /********************************/ wxMyCheckBox::wxMyCheckBox(wxWindow *parent, int id, const wxString & Title, bool * RefVar, wxPoint& pos): wxCheckBox(parent, id, Title, pos) { BoolVar = RefVar; if( * BoolVar ) this->SetValue(TRUE); else this->SetValue(FALSE); } /******************************************************/ void wxOptionsBox::SetOptPadFill(wxCommandEvent& event) /******************************************************/ { *IsShowPadFill->BoolVar == 0 ? * IsShowPadFill->BoolVar = 1 : * IsShowPadFill->BoolVar = 0; DisplayOpt.DisplayPadFill = m_Parent->m_DisplayPadFill = IsShowPadFill->BoolVar; m_Parent->ReDrawPanel(); } /******************************************************/ void wxOptionsBox::SetOptPadNum(wxCommandEvent& event) /******************************************************/ { *IsShowPadNum->BoolVar == 0 ? *IsShowPadNum->BoolVar = TRUE : *IsShowPadNum->BoolVar = FALSE; DisplayOpt.DisplayPadNum = m_Parent->m_DisplayPadNum = IsShowPadNum->BoolVar; m_Parent->ReDrawPanel(); } /********************************/ /* Constructeur de wxOptionsBox */ /********************************/ wxOptionsBox::wxOptionsBox(WinEDA_BasePcbFrame * parent, wxPoint& bpos): wxDialog(parent, -1, _("Options"), bpos, wxSize(220, 195), DIALOG_STYLE) { wxPoint pos; m_Parent = parent; SetFont(*g_DialogFont); pos.x = 100; pos.y = 15; new wxButton(this, ID_SAVE_CONFIG, _("Save Cfg"), pos); pos.x = 10; pos.y = 10; IsShowPadFill = new wxMyCheckBox(this, PADFILL_OPT, _("&Pad Fill"), &DisplayOpt.DisplayPadFill, pos); pos.y += 20; IsShowPadNum = new wxMyCheckBox(this, PADNUM_OPT, _("Pad &Num"), &DisplayOpt.DisplayPadNum, pos); pos.y += 25; wxString DrawOpt[] = { _("&Filaire"), _("&Filled"), _("&Sketch")}; EdgeRadioBox = new wxRadioBox(this, EDGE_SELECT, _("Edges:"), pos, wxSize(-1,-1), 3,DrawOpt,1,wxRA_SPECIFY_COLS); EdgeRadioBox->SetSelection(DisplayOpt.DisplayModEdge); pos.x += 100; TextRadioBox = new wxRadioBox(this, TEXT_SELECT, _("Texts:"), pos,wxSize(-1,-1), 3, DrawOpt, 1,wxRA_SPECIFY_COLS); TextRadioBox->SetSelection(DisplayOpt.DisplayModText); } /*****************************/ /* Destructeur de OptionsBox */ /*****************************/ wxOptionsBox::~wxOptionsBox(void) { } /**************************************/ /* Fonctions de base de wxMyDialogBox */ /**************************************/ /*******************************/ bool wxOptionsBox::OnClose(void) /*******************************/ { Show(FALSE); return TRUE; } /****************************************************************/ void wxOptionsBox::ReturnDisplayEdgeFormat(wxCommandEvent& event) /****************************************************************/ { DisplayOpt.DisplayModEdge = m_Parent->m_DisplayModEdge = EdgeRadioBox->GetSelection(); m_Parent->ReDrawPanel(); } /****************************************************************/ void wxOptionsBox::ReturnDisplayTexteFormat(wxCommandEvent& event) /****************************************************************/ { DisplayOpt.DisplayModText = m_Parent->m_DisplayModText = TextRadioBox->GetSelection(); m_Parent->ReDrawPanel(); } /***************************************************/ void wxOptionsBox::SaveConfig(wxCommandEvent& event) /***************************************************/ { Save_Config(this); }
cvpcb/rdorcad.cppdeleted 100644 → 0 +0 −320 Original line number Diff line number Diff line /************/ /* rdorcad()*/ /************/ /* convertit la netliste ORCADPCB en netliste ORCADPCB (fichier temporaire) assure la raffectation des alimentations selon le format : ( XXXXXX VALEUR|(pin1,pin2,...=newalim) ID VALEUR */ #include "fctsys.h" #include "wxstruct.h" #include "common.h" #include "cvpcb.h" #include "protos.h" #define SEPARATEUR '|' /* caractere separateur dans netliste */ /* routines locales : */ int pin_orcad(STORECMP * CurrentCmp); /****************************************/ /* int WinEDA_CvpcbFrame::rdorcad(void) */ /****************************************/ int WinEDA_CvpcbFrame::rdorcad(void) { int i , j , k ,l ; char * LibName; char Line[1024]; int FlagEESchema = 0; char label[80] ; /* buffer des references composants */ char ref_schema[80] ; /* buffer de la ref schematique */ char val[80] ; /* buffer des valeurs/ref.lib */ char postval[80] ; /* buffer de la valeur de fin de ligne (vraie valeur) */ char *ptchar ; /* pointeur de service */ STORECMP * Cmp; modified = 0; Rjustify = 0; /* Raz buffer et variable de gestion */ if( 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); } /* 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) ; if( i != 0 ) i = strnicmp(Line,"({",2) ; if( i != 0 ) { i = strnicmp(Line,"# EESchema",7) ; /* net type EESchema */ if( i == 0 ) FlagEESchema = 1; } 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: EESchema"), 0); /* Lecture de la liste */ for (;;) { /* recherche du debut de la description d'un composant */ if( fgets(Line,80,source) == 0 ) break; /* suppression des blancs en dbut de ligne */ i = 0 ; while (Line[i] == ' ') i++ ; /* elimination des lignes vides : */ if (Line[i] < ' ') 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 */ j = 0 ; while ( Line[i] != ' ') ref_schema[j++] = Line[i++] ; ref_schema[j] = 0 ; /* recherche val/ref.lib */ while ( Line[i] == ' ') i++ ; /* i pointe la valeur du composant */ LibName = Line + i; memset(label, 0, sizeof(label)); memset(val, 0, sizeof(val) ) ; memset(postval, 0, sizeof(postval) ) ; memset(alim, 0, sizeof(alim) ) ; /* lecture valeur du composant */ /* recherche fin de valeur (' ') */ ptchar = strstr(&Line[i]," ") ; if (ptchar == 0) { wxString msg; msg.Printf( _("Netlist error: %s"),Line) ; DisplayError(NULL, msg); k = 0 ; } else k = ptchar - Line ; for (j = 0 ; i < k ; i++) { if ( Line[i] == SEPARATEUR ) break ; if ( j < 8 ) val[j++] = Line[i] ; } 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 */ /* debut reference trouv */ for ( k = 0 ; k < 8 ; i++ , k++ ) { if ( Line[i] <= ' ' ) break ; label[k] = Line[i] ; } /* recherche vraie valeur du composant */ while(Line[i] != ' ') i++ ; /* elimination fin reference */ while(Line[i] == ' ') i++ ; /* recherche debut vraie valeur */ /* debut vraie valeur trouve */ for ( k = 0 ; k < 16 ; i++ , k++ ) { if ( Line[i] <= ' ' ) break ; postval[k] = Line[i] ; } /* classement du composant ,suivi de sa valeur */ Cmp = new STORECMP(); Cmp->Pnext = BaseListeCmp; BaseListeCmp = Cmp; Cmp->m_Reference = CONV_FROM_UTF8(label); Cmp->m_Valeur = CONV_FROM_UTF8(postval) ; if( FlagEESchema ) /* Copie du nom module: */ { if( strnicmp(LibName, "$noname", 7 ) != 0 ) { while( *LibName > ' ' ) { Cmp->m_Module.Append(*LibName); LibName++; } } } /* classement du TimeStamp */ Cmp->m_TimeStamp = CONV_FROM_UTF8(ref_schema); pin_orcad( Cmp) ; nbcomp++ ; } fclose(source); /* reclassement alpabtique : */ BaseListeCmp = TriListeComposantss( BaseListeCmp, nbcomp); return(0); } /***********************************/ int pin_orcad(STORECMP * Cmp) /***********************************/ { int i , jj; char numpin[9] , net[1024] ; char Line[1024]; STOREPIN * Pin = NULL; STOREPIN ** LastPin = & Cmp->m_Pins; for ( ;; ) { /* debut description trouv */ for ( ;; ) { if ( fgets(Line,80,source) == 0 ) return(-1) ; /* suppression des blancs en dbut de ligne */ i = 0 ; while (Line[i] == ' ') i++ ; while (Line[i] == '(') i++ ; while (Line[i] == ' ') i++ ; /* elimination des lignes vides : */ if (Line[i] < ' ') continue ; /* fin de description ? */ if (Line[i] == ')' ) return(0) ; memset( net, 0, sizeof(net) ); memset( numpin, 0, sizeof(numpin) ); /* lecture name pin , 4 lettres */ for (jj = 0 ; jj < 4 ; jj++ , i++) { if ( Line[i] == ' ' ) break ; numpin[jj] = Line[i] ; } /* recherche affectation force de net */ if ( reaffect(numpin,net) != 0) { Pin = new STOREPIN(); *LastPin = Pin; LastPin = &Pin->Pnext; Pin->m_PinNum = CONV_FROM_UTF8(numpin); Pin->m_PinNet = CONV_FROM_UTF8(net); continue ; } /* recherche netname */ while(Line[i] == ' ') i++ ; /* recherche debut reference */ /* debut netname trouv */ for ( jj = 0 ; jj < (int)sizeof(net)-1 ; i++ , jj++ ) { if ( Line[i] <= ' ' ) break ; net[jj] = Line[i] ; } Pin = new STOREPIN(); *LastPin = Pin; LastPin = &Pin->Pnext; Pin->m_PinNum = CONV_FROM_UTF8(numpin); Pin->m_PinNet = CONV_FROM_UTF8(net); } } } /****************************************************************/ 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 */ { STORECMP ** bufferptr, * Item; int ii; if (nbitems <= 0 ) return(NULL); bufferptr = (STORECMP**)MyZMalloc( (nbitems+2) * sizeof(STORECMP*) ); for( ii= 1, Item = BaseListe; Item != NULL; Item = Item->Pnext, 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 */ qsort(bufferptr+1,nbitems,sizeof(STORECMP*), (int(*)(const void*,const void*))CmpCompare) ; /* Mise a jour du chainage */ for( ii = 1; ii <= nbitems; ii++ ) { Item = bufferptr[ii]; Item->m_Num = ii; Item->Pnext = bufferptr[ii+1]; Item->Pback = bufferptr[ii-1]; } return(bufferptr[1]); } /****************************************/ int CmpCompare(void * mod1, void * mod2) /****************************************/ /* routine compare() pour qsort() en classement alphabetique des composants */ { int ii; STORECMP *pt1 , *pt2 ; pt1 = * ((STORECMP**)mod1); pt2 = * ((STORECMP**)mod2); //FIXME: ii = StrNumICmp( (const wxChar*) pt1->m_Reference, (const wxChar*) pt2->m_Reference ); return(ii); }
cvpcb/readschematicnetlist.cpp +19 −19 Original line number Diff line number Diff line Loading @@ -29,10 +29,10 @@ int WinEDA_CvpcbFrame::ReadSchematicNetlist(void) int i , j , k ,l ; char * LibName; char Line[1024]; char label[80] ; /* buffer des references composants */ char component_reference[80] ; /* buffer des references composants */ char ref_schema[80] ; /* buffer de la ref schematique */ char val[80] ; /* buffer des valeurs/ref.lib */ char postval[80] ; /* buffer de la valeur de fin de ligne (vraie valeur) */ char footprint_name[80] ; /* buffer des ref.lib */ char component_value[80] ; /* buffer des valeurs */ char *ptchar ; /* pointeur de service */ STORECMP * Cmp; Loading Loading @@ -111,9 +111,9 @@ STORECMP * Cmp; while ( Line[i] == ' ') i++ ; /* i pointe la valeur du composant */ LibName = Line + i; memset(label, 0, sizeof(label)); memset(val, 0, sizeof(val) ) ; memset(postval, 0, sizeof(postval) ) ; 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 */ Loading @@ -132,7 +132,8 @@ STORECMP * Cmp; for (j = 0 ; i < k ; i++) { if ( Line[i] == SEPARATEUR ) break ; if ( j < 8 ) val[j++] = Line[i] ; if ( j < (int)(sizeof(footprint_name)-1) ) footprint_name[j++] = Line[i] ; } if ( (Line[++i] == '(') && (Line[k-1] == ')' ) ) Loading @@ -147,21 +148,20 @@ STORECMP * Cmp; while(Line[i] == ' ') i++ ; /* recherche debut reference */ /* debut reference trouv */ for ( k = 0 ; k < 8 ; i++ , k++ ) for ( k = 0 ; k < (int)(sizeof(component_reference)-1) ; i++ , k++ ) { if ( Line[i] <= ' ' ) break ; label[k] = Line[i] ; component_reference[k] = Line[i] ; } /* recherche vraie valeur du composant */ while(Line[i] != ' ') i++ ; /* elimination fin reference */ while(Line[i] == ' ') i++ ; /* recherche debut vraie valeur */ /* recherche valeur du composant */ while(Line[i] == ' ') i++ ; /* recherche debut valeur */ /* debut vraie valeur trouve */ for ( k = 0 ; k < 16 ; i++ , k++ ) /* debut vraie valeur trouvee */ for ( k = 0 ; k < (int)(sizeof(component_value)-1) ; i++ , k++ ) { if ( Line[i] <= ' ' ) break ; postval[k] = Line[i] ; component_value[k] = Line[i] ; } Loading @@ -169,8 +169,8 @@ STORECMP * Cmp; Cmp = new STORECMP(); Cmp->Pnext = g_BaseListeCmp; g_BaseListeCmp = Cmp; Cmp->m_Reference = CONV_FROM_UTF8(label); Cmp->m_Valeur = CONV_FROM_UTF8(postval) ; Cmp->m_Reference = CONV_FROM_UTF8(component_reference); Cmp->m_Valeur = CONV_FROM_UTF8(component_value) ; if( g_FlagEESchema ) /* Copie du nom module: */ { Loading