Browse Source
More header file realignments to reduce recompiling and general code cleaning.
pull/1/head
More header file realignments to reduce recompiling and general code cleaning.
pull/1/head
293 changed files with 4312 additions and 4108 deletions
-
23d-viewer/3d_canvas.cpp
-
23d-viewer/3d_class.cpp
-
173d-viewer/3d_draw.cpp
-
53d-viewer/3d_frame.cpp
-
33d-viewer/3d_read_mesh.cpp
-
8CHANGELOG.txt
-
4CMakeModules/FindSubversion.cmake
-
6common/about_kicad.cpp
-
3common/base_screen.cpp
-
7common/base_struct.cpp
-
6common/basicframe.cpp
-
7common/block_commande.cpp
-
1common/class_drawpickedstruct.cpp
-
1common/common.cpp
-
1common/common_plotGERBER_functions.cpp
-
2common/common_plotHPGL_functions.cpp
-
1common/common_plotPS_functions.cpp
-
2common/common_plot_functions.cpp
-
7common/copy_to_clipboard.cpp
-
2common/displlst.cpp
-
5common/drawframe.cpp
-
7common/drawpanel.cpp
-
2common/drawtxt.cpp
-
20common/eda_doc.cpp
-
3common/edaappl.cpp
-
9common/gestfich.cpp
-
3common/get_component_dialog.cpp
-
2common/gr_basic.cpp
-
6common/hotkeys_basic.cpp
-
5common/msgpanel.cpp
-
4common/projet_config.cpp
-
2common/string.cpp
-
47common/toolbars.cpp
-
1485common/trigo.cpp
-
8common/worksheet.cpp
-
3common/wxwineda.cpp
-
7common/zoom.cpp
-
6cvpcb/autosel.cpp
-
5cvpcb/cfg.cpp
-
10cvpcb/cvframe.cpp
-
10cvpcb/cvpcb.cpp
-
5cvpcb/cvpcb.h
-
13cvpcb/dialog_display_options.cpp
-
6cvpcb/displayframe.cpp
-
101cvpcb/genequiv.cpp
-
353cvpcb/init.cpp
-
6cvpcb/listboxes.cpp
-
445cvpcb/listlib.cpp
-
9cvpcb/loadcmp.cpp
-
4cvpcb/menucfg.cpp
-
7cvpcb/readschematicnetlist.cpp
-
302cvpcb/savecmp.cpp
-
11cvpcb/setvisu.cpp
-
11cvpcb/tool_cvpcb.cpp
-
396cvpcb/writenetlistpcbnew.cpp
-
1eeschema/affiche.cpp
-
3eeschema/annotate.cpp
-
12eeschema/annotate_dialog.cpp
-
1eeschema/annotate_dialog.h
-
7eeschema/backanno.cpp
-
6eeschema/block.cpp
-
6eeschema/block_libedit.cpp
-
5eeschema/build_BOM.cpp
-
5eeschema/bus-wire-junction.cpp
-
7eeschema/busentry.cpp
-
6eeschema/class_drawsheet.cpp
-
5eeschema/class_hierarchical_PIN_sheet.cpp
-
3eeschema/class_library.cpp
-
3eeschema/class_pin.cpp
-
4eeschema/class_screen.cpp
-
8eeschema/class_text-label.cpp
-
4eeschema/classes_body_items.cpp
-
3eeschema/cleanup.cpp
-
2eeschema/component_class.cpp
-
11eeschema/controle.cpp
-
2eeschema/cross-probing.cpp
-
212eeschema/database.cpp
-
4eeschema/delsheet.cpp
-
4eeschema/dialog_SVG_print.cpp
-
12eeschema/dialog_build_BOM.cpp
-
13eeschema/dialog_create_component.cpp
-
5eeschema/dialog_edit_component_in_schematic.cpp
-
1eeschema/dialog_edit_label.cpp
-
1eeschema/dialog_edit_libentry_fields_in_lib.cpp
-
16eeschema/dialog_eeschema_config.cpp
-
19eeschema/dialog_options.cpp
-
4eeschema/dialog_print_using_printer.cpp
-
4eeschema/edit_component_in_lib.cpp
-
4eeschema/edit_component_in_schematic.cpp
-
3eeschema/edit_graphic_bodyitem_text.cpp
-
4eeschema/edit_label.cpp
-
7eeschema/eeconfig.cpp
-
4eeschema/eecreate.cpp
-
18eeschema/eelayer.cpp
-
3eeschema/eelibs_draw_components.cpp
-
6eeschema/eelibs_read_libraryfiles.cpp
-
4eeschema/eeredraw.cpp
-
9eeschema/eeschema.cpp
-
7eeschema/erc.cpp
-
4eeschema/files-io.cpp
@ -1,36 +1,31 @@ |
|||
/******************************************************************/ |
|||
/* toolbars.cpp - fonctions des classes du type WinEDA_ttolbar */ |
|||
/******************************************************************/ |
|||
/******************************************************************/ |
|||
/* toolbars.cpp - fonctions des classes du type WinEDA_ttolbar */ |
|||
/******************************************************************/ |
|||
|
|||
#ifdef __GNUG__
|
|||
#pragma implementation
|
|||
#endif
|
|||
|
|||
#include "fctsys.h"
|
|||
#include "common.h"
|
|||
#include "wxstruct.h"
|
|||
|
|||
/*************************/ |
|||
/* class WinEDA_HToolbar */ |
|||
/*************************/ |
|||
|
|||
#include "id.h"
|
|||
|
|||
/*************************/ |
|||
/* class WinEDA_HToolbar */ |
|||
/*************************/ |
|||
|
|||
WinEDA_Toolbar::WinEDA_Toolbar(id_toolbar type, wxWindow * parent, |
|||
wxWindowID id, bool horizontal): |
|||
wxToolBar(parent,id, wxPoint(-1,-1), wxSize(-1,-1), |
|||
horizontal ? wxTB_HORIZONTAL : wxTB_VERTICAL) |
|||
WinEDA_Toolbar::WinEDA_Toolbar( id_toolbar type, wxWindow * parent, |
|||
wxWindowID id, bool horizontal ): |
|||
wxToolBar( parent, id, wxPoint( -1,-1 ), wxSize( -1,-1 ), |
|||
horizontal ? wxTB_HORIZONTAL : wxTB_VERTICAL ) |
|||
{ |
|||
m_Parent = parent; |
|||
Pnext = NULL; |
|||
m_Ident = type; |
|||
m_Horizontal = horizontal; |
|||
m_Size = 24; |
|||
|
|||
SetToolBitmapSize(wxSize(16,16)); |
|||
SetMargins(0,0); |
|||
SetToolSeparation(1); |
|||
SetToolPacking(1); |
|||
m_Parent = parent; |
|||
Pnext = NULL; |
|||
m_Ident = type; |
|||
m_Horizontal = horizontal; |
|||
m_Size = 24; |
|||
|
|||
SetToolBitmapSize(wxSize(16,16)); |
|||
SetMargins(0,0); |
|||
SetToolSeparation(1); |
|||
SetToolPacking(1); |
|||
} |
|||
|
|||
|
1485
common/trigo.cpp
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -1,59 +1,62 @@ |
|||
/***************/ |
|||
/* genstf() */ |
|||
/***************/ |
|||
/***************/ |
|||
/* genstf() */ |
|||
/***************/ |
|||
|
|||
/* genere le fichier STF type 'ref' 'nom_empreinte' pour DRAFT */ |
|||
|
|||
#include "fctsys.h"
|
|||
|
|||
#include "wxstruct.h"
|
|||
#include "common.h"
|
|||
#include "cvpcb.h"
|
|||
#include "confirm.h"
|
|||
#include "gestfich.h"
|
|||
|
|||
#include "cvpcb.h"
|
|||
#include "protos.h"
|
|||
#include "cvstruct.h"
|
|||
|
|||
void WinEDA_CvpcbFrame::WriteStuffList(wxCommandEvent & event) |
|||
|
|||
void WinEDA_CvpcbFrame::WriteStuffList( wxCommandEvent& event ) |
|||
{ |
|||
FILE * FileEquiv; |
|||
STORECMP * Cmp; |
|||
wxString Line, FullFileName, Mask; |
|||
|
|||
if( nbcomp <= 0 ) return; |
|||
|
|||
/* calcul du nom du fichier */ |
|||
Mask = wxT("*") + ExtRetroBuffer; |
|||
FullFileName = FFileName; |
|||
ChangeFileNameExt(FullFileName, ExtRetroBuffer); |
|||
|
|||
FullFileName = EDA_FileSelector( wxT("Create Stuff File"), |
|||
wxGetCwd(), /* Chemin par defaut */ |
|||
FullFileName, /* nom fichier par defaut */ |
|||
ExtRetroBuffer, /* extension par defaut */ |
|||
Mask, /* Masque d'affichage */ |
|||
this, |
|||
wxFD_SAVE, |
|||
TRUE |
|||
); |
|||
if ( FullFileName.IsEmpty() ) return; |
|||
|
|||
FileEquiv = wxFopen(FullFileName, wxT("wt") ); |
|||
if (FileEquiv == 0 ) |
|||
{ |
|||
Line = _("Unable to create ") + FullFileName; |
|||
DisplayError(this, Line,30); |
|||
return; |
|||
} |
|||
|
|||
/* Generation de la liste */ |
|||
for (Cmp = g_BaseListeCmp ; Cmp != NULL ; Cmp = Cmp->Pnext ) |
|||
{ |
|||
/* génération du composant si son empreinte est définie */ |
|||
if ( Cmp->m_Module.IsEmpty() ) continue; |
|||
fprintf(FileEquiv, "comp = \"%s\" module = \"%s\"\n", |
|||
CONV_TO_UTF8(Cmp->m_Reference), |
|||
CONV_TO_UTF8(Cmp->m_Module)); |
|||
} |
|||
|
|||
fclose(FileEquiv); |
|||
FILE* FileEquiv; |
|||
STORECMP* Cmp; |
|||
wxString Line, FullFileName, Mask; |
|||
|
|||
if( nbcomp <= 0 ) |
|||
return; |
|||
|
|||
/* calcul du nom du fichier */ |
|||
Mask = wxT( "*" ) + ExtRetroBuffer; |
|||
FullFileName = FFileName; |
|||
ChangeFileNameExt( FullFileName, ExtRetroBuffer ); |
|||
|
|||
FullFileName = EDA_FileSelector( wxT( "Create Stuff File" ), |
|||
wxGetCwd(), /* Chemin par defaut */ |
|||
FullFileName, /* nom fichier par defaut */ |
|||
ExtRetroBuffer, /* extension par defaut */ |
|||
Mask, /* Masque d'affichage */ |
|||
this, |
|||
wxFD_SAVE, |
|||
TRUE ); |
|||
if( FullFileName.IsEmpty() ) |
|||
return; |
|||
|
|||
FileEquiv = wxFopen( FullFileName, wxT( "wt" ) ); |
|||
if( FileEquiv == 0 ) |
|||
{ |
|||
Line = _( "Unable to create " ) + FullFileName; |
|||
DisplayError( this, Line, 30 ); |
|||
return; |
|||
} |
|||
|
|||
/* Generation de la liste */ |
|||
for( Cmp = g_BaseListeCmp; Cmp != NULL; Cmp = Cmp->Pnext ) |
|||
{ |
|||
/* génération du composant si son empreinte est définie */ |
|||
if( Cmp->m_Module.IsEmpty() ) |
|||
continue; |
|||
fprintf( FileEquiv, "comp = \"%s\" module = \"%s\"\n", |
|||
CONV_TO_UTF8( Cmp->m_Reference ), |
|||
CONV_TO_UTF8( Cmp->m_Module ) ); |
|||
} |
|||
|
|||
fclose( FileEquiv ); |
|||
} |
|||
|
@ -1,214 +1,237 @@ |
|||
/*******************************************************************/ |
|||
/* CVPCB: Routines de base : */ |
|||
/* lecture Netliste et creation des fenetres composants et modules */ |
|||
/*******************************************************************/ |
|||
/*******************************************************************/ |
|||
/* CVPCB: Routines de base : */ |
|||
/* lecture Netliste et creation des fenetres composants et modules */ |
|||
/*******************************************************************/ |
|||
|
|||
#include "fctsys.h"
|
|||
#include "common.h"
|
|||
|
|||
#include "cvpcb.h"
|
|||
#include "confirm.h"
|
|||
#include "gr_basic.h"
|
|||
#include "gestfich.h"
|
|||
#include "id.h"
|
|||
|
|||
#include "cvpcb.h"
|
|||
#include "protos.h"
|
|||
#include "id.h"
|
|||
#include "cvstruct.h"
|
|||
|
|||
|
|||
/* routines locales : */ |
|||
|
|||
|
|||
/**********************************************************/ |
|||
void WinEDA_CvpcbFrame::SetNewPkg(const wxString & package) |
|||
void WinEDA_CvpcbFrame::SetNewPkg( const wxString& package ) |
|||
/*********************************************************/ |
|||
|
|||
/*
|
|||
- Affecte un module au composant selectionne |
|||
- Selectionne le composant suivant |
|||
*/ |
|||
* - Affecte un module au composant selectionne |
|||
* - Selectionne le composant suivant |
|||
*/ |
|||
{ |
|||
STORECMP * Composant; |
|||
int ii, NumCmp, IsNew = 1; |
|||
wxString Line; |
|||
|
|||
if ( g_BaseListeCmp == NULL ) return; |
|||
|
|||
NumCmp = m_ListCmp->GetSelection(); |
|||
if( NumCmp < 0 ) |
|||
{ |
|||
NumCmp = 0; |
|||
m_ListCmp->SetSelection(NumCmp, TRUE); |
|||
} |
|||
|
|||
Composant = g_BaseListeCmp; |
|||
for ( ii = 0; Composant != NULL; Composant = Composant->Pnext, ii++ ) |
|||
{ |
|||
if ( NumCmp == ii ) break; |
|||
} |
|||
|
|||
if ( Composant == NULL ) return; |
|||
if ( ! Composant->m_Module.IsEmpty() ) IsNew = 0; |
|||
|
|||
Composant->m_Module = package; |
|||
|
|||
Line.Printf( CMP_FORMAT ,ii+1, |
|||
Composant->m_Reference.GetData(), Composant->m_Valeur.GetData(), |
|||
Composant->m_Module.GetData()); |
|||
modified = 1; |
|||
if ( IsNew ) composants_non_affectes -= 1; |
|||
|
|||
m_ListCmp->SetString(NumCmp, Line); |
|||
m_ListCmp->SetSelection(NumCmp, FALSE); |
|||
|
|||
// We activate next component:
|
|||
if ( NumCmp < (m_ListCmp->GetCount() - 1) ) NumCmp++; |
|||
m_ListCmp->SetSelection(NumCmp, TRUE); |
|||
|
|||
Line.Printf( _("Components: %d (free: %d)"), |
|||
nbcomp, composants_non_affectes); |
|||
SetStatusText(Line,1); |
|||
STORECMP* Composant; |
|||
int ii, NumCmp, IsNew = 1; |
|||
wxString Line; |
|||
|
|||
if( g_BaseListeCmp == NULL ) |
|||
return; |
|||
|
|||
NumCmp = m_ListCmp->GetSelection(); |
|||
if( NumCmp < 0 ) |
|||
{ |
|||
NumCmp = 0; |
|||
m_ListCmp->SetSelection( NumCmp, TRUE ); |
|||
} |
|||
|
|||
Composant = g_BaseListeCmp; |
|||
for( ii = 0; Composant != NULL; Composant = Composant->Pnext, ii++ ) |
|||
{ |
|||
if( NumCmp == ii ) |
|||
break; |
|||
} |
|||
|
|||
if( Composant == NULL ) |
|||
return; |
|||
if( !Composant->m_Module.IsEmpty() ) |
|||
IsNew = 0; |
|||
|
|||
Composant->m_Module = package; |
|||
|
|||
Line.Printf( CMP_FORMAT, ii + 1, |
|||
Composant->m_Reference.GetData(), Composant->m_Valeur.GetData(), |
|||
Composant->m_Module.GetData() ); |
|||
modified = 1; |
|||
if( IsNew ) |
|||
composants_non_affectes -= 1; |
|||
|
|||
m_ListCmp->SetString( NumCmp, Line ); |
|||
m_ListCmp->SetSelection( NumCmp, FALSE ); |
|||
|
|||
// We activate next component:
|
|||
if( NumCmp < (m_ListCmp->GetCount() - 1) ) |
|||
NumCmp++; |
|||
m_ListCmp->SetSelection( NumCmp, TRUE ); |
|||
|
|||
Line.Printf( _( "Components: %d (free: %d)" ), |
|||
nbcomp, composants_non_affectes ); |
|||
SetStatusText( Line, 1 ); |
|||
} |
|||
|
|||
|
|||
/********************************************/ |
|||
void WinEDA_CvpcbFrame::ReadNetListe() |
|||
/*******************************************/ |
|||
|
|||
/* Lecture de la netliste selon format, ainsi que du fichier des composants
|
|||
*/ |
|||
*/ |
|||
{ |
|||
STORECMP * Composant; |
|||
wxString msg; |
|||
int ii; |
|||
int error_level; |
|||
STORECMP* Composant; |
|||
wxString msg; |
|||
int ii; |
|||
int error_level; |
|||
|
|||
error_level = ReadSchematicNetlist(); |
|||
error_level = ReadSchematicNetlist(); |
|||
|
|||
if ( error_level < 0 ) return; |
|||
if( error_level < 0 ) |
|||
return; |
|||
|
|||
/* lecture des correspondances */ |
|||
loadcmp(); |
|||
/* lecture des correspondances */ |
|||
loadcmp(); |
|||
|
|||
if (m_ListCmp == NULL ) return; |
|||
if( m_ListCmp == NULL ) |
|||
return; |
|||
|
|||
if ( ! NetInNameBuffer.IsEmpty() ) |
|||
wxSetWorkingDirectory( wxPathOnly(NetInNameBuffer) ); |
|||
if( !NetInNameBuffer.IsEmpty() ) |
|||
wxSetWorkingDirectory( wxPathOnly( NetInNameBuffer ) ); |
|||
|
|||
Read_Config(NetInNameBuffer); // relecture de la config (elle peut etre modifiée)
|
|||
Read_Config( NetInNameBuffer ); // relecture de la config (elle peut etre modifiée)
|
|||
|
|||
listlib(); |
|||
BuildFootprintListBox(); |
|||
listlib(); |
|||
BuildFootprintListBox(); |
|||
|
|||
m_ListCmp->Clear(); |
|||
Composant = g_BaseListeCmp; |
|||
m_ListCmp->Clear(); |
|||
Composant = g_BaseListeCmp; |
|||
|
|||
composants_non_affectes = 0; |
|||
for ( ii = 1;Composant != NULL; Composant = Composant->Pnext, ii++ ) |
|||
{ |
|||
msg.Printf(CMP_FORMAT ,ii, |
|||
Composant->m_Reference.GetData(), Composant->m_Valeur.GetData(), |
|||
Composant->m_Module.GetData()); |
|||
m_ListCmp->AppendLine(msg); |
|||
if( Composant->m_Module.IsEmpty() ) composants_non_affectes += 1; |
|||
} |
|||
if ( g_BaseListeCmp ) |
|||
m_ListCmp->SetSelection(0, TRUE); |
|||
composants_non_affectes = 0; |
|||
for( ii = 1; Composant != NULL; Composant = Composant->Pnext, ii++ ) |
|||
{ |
|||
msg.Printf( CMP_FORMAT, ii, |
|||
Composant->m_Reference.GetData(), |
|||
Composant->m_Valeur.GetData(), |
|||
Composant->m_Module.GetData() ); |
|||
m_ListCmp->AppendLine( msg ); |
|||
if( Composant->m_Module.IsEmpty() ) |
|||
composants_non_affectes += 1; |
|||
} |
|||
|
|||
msg.Printf(_("Componants: %d (free: %d)"), nbcomp, composants_non_affectes); |
|||
SetStatusText(msg,1); |
|||
if( g_BaseListeCmp ) |
|||
m_ListCmp->SetSelection( 0, TRUE ); |
|||
|
|||
/* Mise a jour du titre de la fenetre principale */ |
|||
wxString Title = g_Main_Title + wxT(" ") + GetBuildVersion(); |
|||
msg.Printf( wxT("%s [%s]"), Title.GetData(), FFileName.GetData()); |
|||
SetTitle(msg); |
|||
msg.Printf( _( "Componants: %d (free: %d)" ), nbcomp, |
|||
composants_non_affectes ); |
|||
SetStatusText( msg, 1 ); |
|||
|
|||
/* Mise a jour du titre de la fenetre principale */ |
|||
wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion(); |
|||
msg.Printf( wxT( "%s [%s]" ), Title.GetData(), FFileName.GetData() ); |
|||
SetTitle( msg ); |
|||
} |
|||
|
|||
|
|||
/*****************************************************************/ |
|||
int WinEDA_CvpcbFrame::SaveNetList(const wxString & FullFilename) |
|||
int WinEDA_CvpcbFrame::SaveNetList( const wxString& FullFilename ) |
|||
/*****************************************************************/ |
|||
|
|||
/* Sauvegarde des fichiers netliste et cmp
|
|||
Le nom complet du fichier Netliste doit etre dans FFileName. |
|||
Le nom du fichier cmp en est deduit |
|||
*/ |
|||
* Le nom complet du fichier Netliste doit etre dans FFileName. |
|||
* Le nom du fichier cmp en est deduit |
|||
*/ |
|||
{ |
|||
wxString NetlistFullFileName = FullFilename; |
|||
|
|||
if ( NetlistFullFileName.IsEmpty() ) |
|||
{ |
|||
wxString Mask = wxT("*") + NetExtBuffer; |
|||
if ( ! NetNameBuffer.IsEmpty() ) |
|||
{ |
|||
NetlistFullFileName = NetNameBuffer; |
|||
ChangeFileNameExt(NetlistFullFileName, NetExtBuffer); |
|||
} |
|||
|
|||
NetlistFullFileName = EDA_FileSelector( _("Save NetList and Components List files"), |
|||
NetDirBuffer, /* Chemin par defaut */ |
|||
NetlistFullFileName, /* nom fichier par defaut */ |
|||
NetExtBuffer, /* extension par defaut */ |
|||
Mask, /* Masque d'affichage */ |
|||
this, |
|||
wxFD_SAVE, |
|||
TRUE |
|||
); |
|||
} |
|||
if ( NetlistFullFileName.IsEmpty() ) return -1; |
|||
|
|||
FFileName = NetlistFullFileName; |
|||
NetNameBuffer = NetlistFullFileName; |
|||
if( SaveComponentList(NetlistFullFileName) == 0 ) |
|||
{ |
|||
DisplayError(this, _("Unable to create component file (.cmp)") ); |
|||
return 0; |
|||
} |
|||
|
|||
dest = wxFopen(NetlistFullFileName, wxT("wt") ); |
|||
if( dest == 0 ) |
|||
{ |
|||
DisplayError(this, _("Unable to create netlist file") ); |
|||
return 0; |
|||
} |
|||
|
|||
GenNetlistPcbnew() ; |
|||
|
|||
return 1; |
|||
wxString NetlistFullFileName = FullFilename; |
|||
|
|||
if( NetlistFullFileName.IsEmpty() ) |
|||
{ |
|||
wxString Mask = wxT( "*" ) + NetExtBuffer; |
|||
if( !NetNameBuffer.IsEmpty() ) |
|||
{ |
|||
NetlistFullFileName = NetNameBuffer; |
|||
ChangeFileNameExt( NetlistFullFileName, NetExtBuffer ); |
|||
} |
|||
|
|||
NetlistFullFileName = |
|||
EDA_FileSelector( _( "Save NetList and Components List files" ), |
|||
NetDirBuffer, /* Chemin par defaut */ |
|||
NetlistFullFileName, /* nom fichier par defaut */ |
|||
NetExtBuffer, /* extension par defaut */ |
|||
Mask, /* Masque d'affichage */ |
|||
this, |
|||
wxFD_SAVE, |
|||
TRUE |
|||
); |
|||
} |
|||
if( NetlistFullFileName.IsEmpty() ) |
|||
return -1; |
|||
|
|||
FFileName = NetlistFullFileName; |
|||
NetNameBuffer = NetlistFullFileName; |
|||
if( SaveComponentList( NetlistFullFileName ) == 0 ) |
|||
{ |
|||
DisplayError( this, _( "Unable to create component file (.cmp)" ) ); |
|||
return 0; |
|||
} |
|||
|
|||
dest = wxFopen( NetlistFullFileName, wxT( "wt" ) ); |
|||
if( dest == 0 ) |
|||
{ |
|||
DisplayError( this, _( "Unable to create netlist file" ) ); |
|||
return 0; |
|||
} |
|||
|
|||
GenNetlistPcbnew(); |
|||
|
|||
return 1; |
|||
} |
|||
|
|||
|
|||
/**********************************************************************/ |
|||
bool WinEDA_CvpcbFrame::ReadInputNetList(const wxString & FullFileName) |
|||
bool WinEDA_CvpcbFrame::ReadInputNetList( const wxString& FullFileName ) |
|||
/**********************************************************************/ |
|||
|
|||
/* Routine de selection du nom de la netliste d'entree, et de lecure de
|
|||
celle-ci |
|||
*/ |
|||
* celle-ci |
|||
*/ |
|||
{ |
|||
wxString Mask, Line; |
|||
|
|||
if ( FullFileName.IsEmpty() ) |
|||
{ |
|||
if( ! NetInExtBuffer.IsEmpty() ) Mask = wxT("*") + NetInExtBuffer; |
|||
else Mask = wxT("*.net"); |
|||
Line = EDA_FileSelector(_("Load Net List"), |
|||
NetDirBuffer, /* Chemin par defaut */ |
|||
NetInNameBuffer, /* nom fichier par defaut */ |
|||
NetInExtBuffer, /* extension par defaut */ |
|||
Mask, /* Masque d'affichage */ |
|||
this, |
|||
0, |
|||
FALSE |
|||
); |
|||
if ( Line.IsEmpty()) return(FALSE); |
|||
} |
|||
else Line = FullFileName; |
|||
|
|||
NetInNameBuffer = Line; |
|||
NetNameBuffer = Line; |
|||
FFileName = NetInNameBuffer; |
|||
|
|||
/* Mise a jour du titre de la fenetre principale */ |
|||
Line = g_Main_Title + wxT(" ") + GetBuildVersion(); |
|||
Line += wxT(" ") + NetInNameBuffer; |
|||
SetTitle(Line); |
|||
|
|||
ReadNetListe(); |
|||
|
|||
return(TRUE); |
|||
wxString Mask, Line; |
|||
|
|||
if( FullFileName.IsEmpty() ) |
|||
{ |
|||
if( !NetInExtBuffer.IsEmpty() ) |
|||
Mask = wxT( "*" ) + NetInExtBuffer; |
|||
else |
|||
Mask = wxT( "*.net" ); |
|||
Line = EDA_FileSelector( _( "Load Net List" ), |
|||
NetDirBuffer, /* Chemin par defaut */ |
|||
NetInNameBuffer, /* nom fichier par defaut */ |
|||
NetInExtBuffer, /* extension par defaut */ |
|||
Mask, /* Masque d'affichage */ |
|||
this, |
|||
0, |
|||
FALSE |
|||
); |
|||
if( Line.IsEmpty() ) |
|||
return FALSE; |
|||
} |
|||
else |
|||
Line = FullFileName; |
|||
|
|||
NetInNameBuffer = Line; |
|||
NetNameBuffer = Line; |
|||
FFileName = NetInNameBuffer; |
|||
|
|||
/* Mise a jour du titre de la fenetre principale */ |
|||
Line = g_Main_Title + wxT( " " ) + GetBuildVersion(); |
|||
Line += wxT( " " ) + NetInNameBuffer; |
|||
SetTitle( Line ); |
|||
|
|||
ReadNetListe(); |
|||
|
|||
return TRUE; |
|||
} |
|||
|
@ -1,250 +1,277 @@ |
|||
/**************/ |
|||
/* listlib.cpp */ |
|||
/**************/ |
|||
/**************/ |
|||
/* listlib.cpp */ |
|||
/**************/ |
|||
|
|||
/*
|
|||
cherche toutes les ref <chemin lib>*.??? si nom fichier pr‚sent, |
|||
ou examine <chemin lib>[MODULE.LIB] |
|||
*/ |
|||
* cherche toutes les ref <chemin lib>*.??? si nom fichier pr‚sent, |
|||
* ou examine <chemin lib>[MODULE.LIB] |
|||
*/ |
|||
|
|||
#include "fctsys.h"
|
|||
|
|||
#include "wxstruct.h"
|
|||
|
|||
#include "common.h"
|
|||
#include "cvpcb.h"
|
|||
#include "confirm.h"
|
|||
#include "kicad_string.h"
|
|||
#include "gestfich.h"
|
|||
|
|||
#include "cvpcb.h"
|
|||
#include "protos.h"
|
|||
|
|||
FILE *name_libmodules ; /* pour lecture librairie */ |
|||
FILE* name_libmodules; /* pour lecture librairie */ |
|||
|
|||
/* routines locales : */ |
|||
static void ReadDocLib(const wxString & ModLibName ); |
|||
static int LibCompare(void * mod1, void * mod2); |
|||
static STOREMOD * TriListeModules(STOREMOD * BaseListe, int nbitems); |
|||
static void ReadDocLib( const wxString& ModLibName ); |
|||
static int LibCompare( void* mod1, void* mod2 ); |
|||
static STOREMOD* TriListeModules( STOREMOD* BaseListe, int nbitems ); |
|||
|
|||
/**/ |
|||
|
|||
/*********************/ |
|||
int listlib() |
|||
/*********************/ |
|||
/* Routine lisant la liste des librairies, et generant la liste chainee
|
|||
des modules disponibles |
|||
|
|||
Module descr format: |
|||
$MODULE c64acmd |
|||
Li c64acmd |
|||
Cd Connecteur DIN Europe 96 Contacts AC male droit |
|||
Kw PAD_CONN DIN |
|||
$EndMODULE |
|||
|
|||
*/ |
|||
/* Routine lisant la liste des librairies, et generant la liste chainee
|
|||
* des modules disponibles |
|||
* |
|||
* Module descr format: |
|||
* $MODULE c64acmd |
|||
* Li c64acmd |
|||
* Cd Connecteur DIN Europe 96 Contacts AC male droit |
|||
* Kw PAD_CONN DIN |
|||
* $EndMODULE |
|||
* |
|||
*/ |
|||
{ |
|||
char buffer[1024]; |
|||
wxString FullLibName; |
|||
int errorlevel = 0, end; |
|||
int flag_librairie; |
|||
STOREMOD * ItemLib; |
|||
unsigned ii; |
|||
wxString msg; |
|||
|
|||
if( g_BaseListePkg ) /* Liste Deja existante, a supprimer */ |
|||
{ |
|||
FreeMemoryModules(); g_BaseListePkg = NULL; |
|||
} |
|||
|
|||
if ( g_LibName_List.GetCount() == 0 ) return -4; |
|||
|
|||
/* init recherche */ |
|||
SetRealLibraryPath( wxT("modules")); |
|||
nblib = 0; |
|||
|
|||
/* Lecture des Librairies */ |
|||
for( ii= 0 ; ii < g_LibName_List.GetCount(); ii++) |
|||
{ |
|||
/* Calcul du nom complet de la librairie */ |
|||
FullLibName = MakeFileName(g_RealLibDirBuffer, g_LibName_List[ii], LibExtBuffer); |
|||
/* acces a une librairie */ |
|||
if ((name_libmodules = wxFopen(FullLibName, wxT("rt"))) == NULL ) |
|||
{ |
|||
msg.Printf( _("Library file <%s> not found"),FullLibName.GetData()); |
|||
DisplayError(NULL, msg, 20); |
|||
continue; |
|||
} |
|||
|
|||
/* Controle du type de la librairie : */ |
|||
flag_librairie = 0; |
|||
fgets(buffer,32,name_libmodules) ; |
|||
if( strncmp(buffer,ENTETE_LIBRAIRIE,L_ENTETE_LIB) != 0 ) |
|||
{ |
|||
msg.Printf(_("Library file <%s> is not a module library"), |
|||
FullLibName.GetData()); |
|||
DisplayError(NULL, msg, 20); |
|||
fclose(name_libmodules); continue; |
|||
} |
|||
|
|||
/* Lecture du nombre de composants */ |
|||
fseek(name_libmodules,0,0) ; |
|||
|
|||
/* lecture nom des composants : */ |
|||
end = 0; |
|||
while( !end && fgets(buffer,255,name_libmodules) != NULL ) |
|||
{ |
|||
if(strnicmp(buffer,"$INDEX",6) == 0 ) |
|||
{ |
|||
while( fgets(buffer,255,name_libmodules) != NULL ) |
|||
{ |
|||
if(strnicmp(buffer,"$EndINDEX",6) == 0 ) |
|||
{ end = 1; break; } |
|||
|
|||
ItemLib = new STOREMOD(); |
|||
ItemLib->Pnext = g_BaseListePkg; |
|||
g_BaseListePkg = ItemLib; |
|||
ItemLib->m_Module = CONV_FROM_UTF8(StrPurge(buffer)); |
|||
ItemLib->m_LibName = FullLibName; |
|||
|
|||
nblib++; |
|||
} |
|||
if( !end ) errorlevel = -3; |
|||
} |
|||
} |
|||
fclose(name_libmodules); |
|||
ReadDocLib(FullLibName ); |
|||
} |
|||
|
|||
/* classement alphabetique: */ |
|||
if( g_BaseListePkg ) |
|||
g_BaseListePkg = TriListeModules(g_BaseListePkg, nblib); |
|||
|
|||
return(errorlevel) ; |
|||
char buffer[1024]; |
|||
wxString FullLibName; |
|||
int errorlevel = 0, end; |
|||
int flag_librairie; |
|||
STOREMOD* ItemLib; |
|||
unsigned ii; |
|||
wxString msg; |
|||
|
|||
if( g_BaseListePkg ) /* Liste Deja existante, a supprimer */ |
|||
{ |
|||
FreeMemoryModules(); |
|||
g_BaseListePkg = NULL; |
|||
} |
|||
|
|||
if( g_LibName_List.GetCount() == 0 ) |
|||
return -4; |
|||
|
|||
/* init recherche */ |
|||
SetRealLibraryPath( wxT( "modules" ) ); |
|||
nblib = 0; |
|||
|
|||
/* Lecture des Librairies */ |
|||
for( ii = 0; ii < g_LibName_List.GetCount(); ii++ ) |
|||
{ |
|||
/* Calcul du nom complet de la librairie */ |
|||
FullLibName = MakeFileName( g_RealLibDirBuffer, |
|||
g_LibName_List[ii], |
|||
LibExtBuffer ); |
|||
/* acces a une librairie */ |
|||
if( ( name_libmodules = wxFopen( FullLibName, wxT( "rt" ) ) ) == NULL ) |
|||
{ |
|||
msg.Printf( _( "Library file <%s> not found" ), |
|||
FullLibName.GetData() ); |
|||
DisplayError( NULL, msg, 20 ); |
|||
continue; |
|||
} |
|||
|
|||
/* Controle du type de la librairie : */ |
|||
flag_librairie = 0; |
|||
fgets( buffer, 32, name_libmodules ); |
|||
if( strncmp( buffer, ENTETE_LIBRAIRIE, L_ENTETE_LIB ) != 0 ) |
|||
{ |
|||
msg.Printf( _( "Library file <%s> is not a module library" ), |
|||
FullLibName.GetData() ); |
|||
DisplayError( NULL, msg, 20 ); |
|||
fclose( name_libmodules ); |
|||
continue; |
|||
} |
|||
|
|||
/* Lecture du nombre de composants */ |
|||
fseek( name_libmodules, 0, 0 ); |
|||
|
|||
/* lecture nom des composants : */ |
|||
end = 0; |
|||
while( !end && fgets( buffer, 255, name_libmodules ) != NULL ) |
|||
{ |
|||
if( strnicmp( buffer, "$INDEX", 6 ) == 0 ) |
|||
{ |
|||
while( fgets( buffer, 255, name_libmodules ) != NULL ) |
|||
{ |
|||
if( strnicmp( buffer, "$EndINDEX", 6 ) == 0 ) |
|||
{ |
|||
end = 1; |
|||
break; |
|||
} |
|||
|
|||
ItemLib = new STOREMOD(); |
|||
ItemLib->Pnext = g_BaseListePkg; |
|||
g_BaseListePkg = ItemLib; |
|||
ItemLib->m_Module = CONV_FROM_UTF8( StrPurge( buffer ) ); |
|||
ItemLib->m_LibName = FullLibName; |
|||
|
|||
nblib++; |
|||
} |
|||
|
|||
if( !end ) |
|||
errorlevel = -3; |
|||
} |
|||
} |
|||
|
|||
fclose( name_libmodules ); |
|||
ReadDocLib( FullLibName ); |
|||
} |
|||
|
|||
/* classement alphabetique: */ |
|||
if( g_BaseListePkg ) |
|||
g_BaseListePkg = TriListeModules( g_BaseListePkg, nblib ); |
|||
|
|||
return errorlevel; |
|||
} |
|||
|
|||
|
|||
/************************************************/ |
|||
static int LibCompare(void * mod1, void * mod2) |
|||
static int LibCompare( void* mod1, void* mod2 ) |
|||
/************************************************/ |
|||
|
|||
/*
|
|||
routine compare() pour qsort() en classement alphabétique des modules |
|||
*/ |
|||
* routine compare() pour qsort() en classement alphabétique des modules |
|||
*/ |
|||
{ |
|||
int ii; |
|||
STOREMOD *pt1 , *pt2; |
|||
int ii; |
|||
STOREMOD* pt1, * pt2; |
|||
|
|||
pt1 = * ((STOREMOD**)mod1); |
|||
pt2 = * ((STOREMOD**)mod2); |
|||
pt1 = *( (STOREMOD**) mod1 ); |
|||
pt2 = *( (STOREMOD**) mod2 ); |
|||
|
|||
ii = StrNumICmp( pt1->m_Module.GetData(), pt2->m_Module.GetData() ); |
|||
return(ii); |
|||
ii = StrNumICmp( pt1->m_Module.GetData(), pt2->m_Module.GetData() ); |
|||
return ii; |
|||
} |
|||
|
|||
|
|||
|
|||
/********************************************************************/ |
|||
static STOREMOD * TriListeModules(STOREMOD * BaseListe, int nbitems) |
|||
static STOREMOD* TriListeModules( STOREMOD* BaseListe, int nbitems ) |
|||
/********************************************************************/ |
|||
|
|||
/* Tri la liste des Modules par ordre alphabetique et met a jour
|
|||
le nouveau chainage avant/arriere |
|||
retourne un pointeur sur le 1er element de la liste |
|||
*/ |
|||
* le nouveau chainage avant/arriere |
|||
* retourne un pointeur sur le 1er element de la liste |
|||
*/ |
|||
{ |
|||
STOREMOD ** bufferptr, * Item; |
|||
int ii, nb; |
|||
|
|||
if (nbitems <= 0 ) return(NULL); |
|||
if ( BaseListe == NULL ) return(NULL); |
|||
|
|||
if (nbitems == 1 ) return(BaseListe); // Tri inutile et impossible
|
|||
|
|||
bufferptr = (STOREMOD**)MyZMalloc( (nbitems+3) * sizeof(STOREMOD*) ); |
|||
|
|||
for( ii = 1, nb = 0, Item = BaseListe; Item != NULL; Item = Item->Pnext, ii++) |
|||
{ |
|||
nb++; |
|||
bufferptr[ii] = Item; |
|||
} |
|||
|
|||
/* ici bufferptr[0] = NULL et bufferptr[nbitem+1] = NULL et ces 2 valeurs
|
|||
representent le chainage arriere du 1er element ( = NULL), |
|||
et le chainage avant du dernier element ( = NULL ) */ |
|||
|
|||
qsort(bufferptr+1,nb,sizeof(STOREMOD*), |
|||
(int(*)(const void*,const void*))LibCompare) ; |
|||
|
|||
/* Mise a jour du chainage */ |
|||
for( ii = 1; ii <= nb; ii++ ) |
|||
{ |
|||
Item = bufferptr[ii]; |
|||
Item->m_Num = ii; |
|||
Item->Pnext = bufferptr[ii+1]; |
|||
Item->Pback = bufferptr[ii-1]; |
|||
} |
|||
|
|||
Item = bufferptr[1]; |
|||
MyFree(bufferptr); |
|||
|
|||
return(Item); |
|||
STOREMOD** bufferptr, * Item; |
|||
int ii, nb; |
|||
|
|||
if( nbitems <= 0 ) |
|||
return NULL; |
|||
if( BaseListe == NULL ) |
|||
return NULL; |
|||
|
|||
if( nbitems == 1 ) |
|||
return BaseListe; // Tri inutile et impossible
|
|||
|
|||
bufferptr = (STOREMOD**) MyZMalloc( (nbitems + 3) * sizeof(STOREMOD*) ); |
|||
|
|||
for( ii = 1, nb = 0, Item = BaseListe; |
|||
Item != NULL; |
|||
Item = Item->Pnext, ii++ ) |
|||
{ |
|||
nb++; |
|||
bufferptr[ii] = Item; |
|||
} |
|||
|
|||
/* ici bufferptr[0] = NULL et bufferptr[nbitem+1] = NULL et ces 2 valeurs
|
|||
* representent le chainage arriere du 1er element ( = NULL), |
|||
* et le chainage avant du dernier element ( = NULL ) */ |
|||
|
|||
qsort( bufferptr + 1, nb, sizeof(STOREMOD*), |
|||
( int( * ) ( const void*, const void* ) )LibCompare ); |
|||
|
|||
/* Mise a jour du chainage */ |
|||
for( ii = 1; ii <= nb; ii++ ) |
|||
{ |
|||
Item = bufferptr[ii]; |
|||
Item->m_Num = ii; |
|||
Item->Pnext = bufferptr[ii + 1]; |
|||
Item->Pback = bufferptr[ii - 1]; |
|||
} |
|||
|
|||
Item = bufferptr[1]; |
|||
MyFree( bufferptr ); |
|||
|
|||
return Item; |
|||
} |
|||
|
|||
|
|||
|
|||
/***************************************************/ |
|||
static void ReadDocLib(const wxString & ModLibName ) |
|||
static void ReadDocLib( const wxString& ModLibName ) |
|||
/***************************************************/ |
|||
|
|||
/* Routine de lecture du fichier Doc associe a la librairie ModLibName.
|
|||
Cree en memoire la chaine liste des docs pointee par MList |
|||
ModLibName = full file Name de la librairie Modules |
|||
*/ |
|||
* Cree en memoire la chaine liste des docs pointee par MList |
|||
* ModLibName = full file Name de la librairie Modules |
|||
*/ |
|||
{ |
|||
STOREMOD * NewMod; |
|||
char Line[1024]; |
|||
wxString ModuleName; |
|||
wxString docfilename; |
|||
FILE * LibDoc; |
|||
|
|||
docfilename = ModLibName; |
|||
ChangeFileNameExt(docfilename, EXT_DOC); |
|||
|
|||
if( (LibDoc = wxFopen(docfilename, wxT("rt"))) == NULL ) return; |
|||
|
|||
GetLine(LibDoc, Line, NULL, sizeof(Line) -1); |
|||
if(strnicmp( Line,ENTETE_LIBDOC, L_ENTETE_LIB) != 0) return; |
|||
|
|||
/* Lecture de la librairie */ |
|||
while( GetLine(LibDoc,Line, NULL, sizeof(Line) -1) ) |
|||
{ |
|||
NewMod = NULL; |
|||
if( Line[0] != '$' ) continue; |
|||
if( Line[1] == 'E' ) break;; |
|||
if( Line[1] == 'M' ) /* Debut decription 1 module */ |
|||
{ |
|||
while( GetLine(LibDoc,Line, NULL, sizeof(Line) -1) ) |
|||
{ |
|||
if( Line[0] == '$' ) /* $EndMODULE */ |
|||
break; |
|||
switch( Line[0] ) |
|||
{ |
|||
case 'L': /* LibName */ |
|||
ModuleName = CONV_FROM_UTF8(StrPurge(Line+3)); |
|||
NewMod = g_BaseListePkg; |
|||
while ( NewMod ) |
|||
{ |
|||
if( ModuleName == NewMod->m_Module ) break; |
|||
NewMod = NewMod->Pnext; |
|||
} |
|||
break; |
|||
|
|||
case 'K': /* KeyWords */ |
|||
if( NewMod && (! NewMod->m_KeyWord) ) |
|||
NewMod->m_KeyWord = CONV_FROM_UTF8(StrPurge(Line+3) ); |
|||
break; |
|||
|
|||
case 'C': /* Doc */ |
|||
if( NewMod && (! NewMod->m_Doc ) ) |
|||
NewMod->m_Doc = CONV_FROM_UTF8(StrPurge(Line+3) ); |
|||
break; |
|||
} |
|||
} |
|||
} /* lecture 1 descr module */ |
|||
} /* Fin lecture librairie */ |
|||
fclose(LibDoc); |
|||
STOREMOD* NewMod; |
|||
char Line[1024]; |
|||
wxString ModuleName; |
|||
wxString docfilename; |
|||
FILE* LibDoc; |
|||
|
|||
docfilename = ModLibName; |
|||
ChangeFileNameExt( docfilename, EXT_DOC ); |
|||
|
|||
if( ( LibDoc = wxFopen( docfilename, wxT( "rt" ) ) ) == NULL ) |
|||
return; |
|||
|
|||
GetLine( LibDoc, Line, NULL, sizeof(Line) - 1 ); |
|||
if( strnicmp( Line, ENTETE_LIBDOC, L_ENTETE_LIB ) != 0 ) |
|||
return; |
|||
|
|||
/* Lecture de la librairie */ |
|||
while( GetLine( LibDoc, Line, NULL, sizeof(Line) - 1 ) ) |
|||
{ |
|||
NewMod = NULL; |
|||
if( Line[0] != '$' ) |
|||
continue; |
|||
if( Line[1] == 'E' ) |
|||
break;; |
|||
if( Line[1] == 'M' ) /* Debut decription 1 module */ |
|||
{ |
|||
while( GetLine( LibDoc, Line, NULL, sizeof(Line) - 1 ) ) |
|||
{ |
|||
if( Line[0] == '$' ) /* $EndMODULE */ |
|||
break; |
|||
switch( Line[0] ) |
|||
{ |
|||
case 'L': /* LibName */ |
|||
ModuleName = CONV_FROM_UTF8( StrPurge( Line + 3 ) ); |
|||
NewMod = g_BaseListePkg; |
|||
while( NewMod ) |
|||
{ |
|||
if( ModuleName == NewMod->m_Module ) |
|||
break; |
|||
NewMod = NewMod->Pnext; |
|||
} |
|||
|
|||
break; |
|||
|
|||
case 'K': /* KeyWords */ |
|||
if( NewMod && (!NewMod->m_KeyWord) ) |
|||
NewMod->m_KeyWord = CONV_FROM_UTF8( StrPurge( Line + 3 ) ); |
|||
break; |
|||
|
|||
case 'C': /* Doc */ |
|||
if( NewMod && (!NewMod->m_Doc ) ) |
|||
NewMod->m_Doc = CONV_FROM_UTF8( StrPurge( Line + 3 ) ); |
|||
break; |
|||
} |
|||
} |
|||
} /* lecture 1 descr module */ |
|||
} /* Fin lecture librairie */ |
|||
|
|||
fclose( LibDoc ); |
|||
} |
|||
|
|||
|
@ -1,167 +1,181 @@ |
|||
/**************/ |
|||
/* savecmp() */ |
|||
/**************/ |
|||
/**************/ |
|||
/* savecmp() */ |
|||
/**************/ |
|||
|
|||
/* sauvegarde la liste des associations composants/empreintes */ |
|||
|
|||
#include "fctsys.h"
|
|||
|
|||
#include "wxstruct.h"
|
|||
#include "common.h"
|
|||
#include "confirm.h"
|
|||
#include "kicad_string.h"
|
|||
#include "gestfich.h"
|
|||
|
|||
#include "cvpcb.h"
|
|||
#include "protos.h"
|
|||
#include "cvstruct.h"
|
|||
|
|||
|
|||
/* Chaines de caractere d'identification */ |
|||
char EnteteCmpMod[] = {"Cmp-Mod V01"}; |
|||
char EnteteCmpMod[] = { "Cmp-Mod V01" }; |
|||
|
|||
/****************************************************************************/ |
|||
int WinEDA_CvpcbFrame::SaveComponentList(const wxString & NetlistFullFileName) |
|||
int WinEDA_CvpcbFrame::SaveComponentList( const wxString& NetlistFullFileName ) |
|||
/*****************************************************************************/ |
|||
|
|||
/* Routine de sauvegarde du fichier des modules
|
|||
Retourne 1 si OK |
|||
0 si ecriture non faite |
|||
*/ |
|||
* Retourne 1 si OK |
|||
* 0 si ecriture non faite |
|||
*/ |
|||
{ |
|||
STORECMP * Cmp; |
|||
wxString FullFileName; |
|||
char Line[1024]; |
|||
wxString Title = g_Main_Title + wxT(" ") + GetBuildVersion(); |
|||
|
|||
/* calcul du nom du fichier */ |
|||
FullFileName = NetlistFullFileName; |
|||
ChangeFileNameExt(FullFileName, g_ExtCmpBuffer); |
|||
|
|||
dest = wxFopen(FullFileName, wxT("wt") ); |
|||
if( dest == NULL ) return(0); /* Erreur ecriture */ |
|||
|
|||
fprintf(dest,"%s", EnteteCmpMod); |
|||
fprintf(dest," Created by %s", CONV_TO_UTF8(Title)); |
|||
fprintf(dest," date = %s\n", DateAndTime(Line)); |
|||
|
|||
for ( Cmp = g_BaseListeCmp ; Cmp != NULL ; Cmp = Cmp->Pnext ) |
|||
{ |
|||
fprintf(dest,"\nBeginCmp\n"); |
|||
fprintf(dest,"TimeStamp = %s;\n", CONV_TO_UTF8(Cmp->m_TimeStamp)); |
|||
fprintf(dest,"Reference = %s;\n", CONV_TO_UTF8(Cmp->m_Reference)); |
|||
fprintf(dest,"ValeurCmp = %s;\n", CONV_TO_UTF8(Cmp->m_Valeur)); |
|||
fprintf(dest,"IdModule = %s;\n", CONV_TO_UTF8(Cmp->m_Module)); |
|||
fprintf(dest,"EndCmp\n"); |
|||
} |
|||
fprintf(dest,"\nEndListe\n") ; |
|||
fclose(dest) ; |
|||
|
|||
return(1) ; |
|||
STORECMP* Cmp; |
|||
wxString FullFileName; |
|||
char Line[1024]; |
|||
wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion(); |
|||
|
|||
/* calcul du nom du fichier */ |
|||
FullFileName = NetlistFullFileName; |
|||
ChangeFileNameExt( FullFileName, g_ExtCmpBuffer ); |
|||
|
|||
dest = wxFopen( FullFileName, wxT( "wt" ) ); |
|||
if( dest == NULL ) |
|||
return 0; /* Erreur ecriture */ |
|||
|
|||
fprintf( dest, "%s", EnteteCmpMod ); |
|||
fprintf( dest, " Created by %s", CONV_TO_UTF8( Title ) ); |
|||
fprintf( dest, " date = %s\n", DateAndTime( Line ) ); |
|||
|
|||
for( Cmp = g_BaseListeCmp; Cmp != NULL; Cmp = Cmp->Pnext ) |
|||
{ |
|||
fprintf( dest, "\nBeginCmp\n" ); |
|||
fprintf( dest, "TimeStamp = %s;\n", CONV_TO_UTF8( Cmp->m_TimeStamp ) ); |
|||
fprintf( dest, "Reference = %s;\n", CONV_TO_UTF8( Cmp->m_Reference ) ); |
|||
fprintf( dest, "ValeurCmp = %s;\n", CONV_TO_UTF8( Cmp->m_Valeur ) ); |
|||
fprintf( dest, "IdModule = %s;\n", CONV_TO_UTF8( Cmp->m_Module ) ); |
|||
fprintf( dest, "EndCmp\n" ); |
|||
} |
|||
|
|||
fprintf( dest, "\nEndListe\n" ); |
|||
fclose( dest ); |
|||
|
|||
return 1; |
|||
} |
|||
|
|||
|
|||
/****************/ |
|||
int loadcmp() |
|||
/***************/ |
|||
|
|||
/* recupere la liste des associations composants/empreintes
|
|||
*/ |
|||
*/ |
|||
{ |
|||
wxString timestamp, valeur, ilib, namecmp; |
|||
bool read_cmp_data = FALSE, eof = FALSE; |
|||
STORECMP * Cmp; |
|||
char Line[1024], * ident, *data; |
|||
wxString FullFileName; |
|||
|
|||
/* calcul du nom du fichier */ |
|||
FullFileName = FFileName; |
|||
ChangeFileNameExt(FullFileName, g_ExtCmpBuffer); |
|||
|
|||
source = wxFopen(FullFileName, wxT("rt") ); |
|||
if (source == NULL ) |
|||
{ |
|||
return(0) ; |
|||
} |
|||
|
|||
/* Identification du Type de fichier CmpMod */ |
|||
if ( fgets(Line,79,source) == 0 ) return(0); |
|||
if( strnicmp(Line, EnteteCmpMod, 11 ) != 0 ) /* old file version*/ |
|||
{ |
|||
fclose(source) ; |
|||
DisplayError( NULL, wxT("Old version of Componaent file, recreate it!")); |
|||
return(0) ; |
|||
} |
|||
|
|||
/* lecture de la liste */ |
|||
while( ! eof && fgets(Line,79,source) != 0 ) |
|||
{ |
|||
if( strnicmp(Line, "EndListe", 8 ) == 0 ) break; |
|||
|
|||
/* Recherche du debut de description du composant */ |
|||
if( strnicmp(Line, "BeginCmp", 8 ) != 0 ) continue; |
|||
timestamp.Empty(); |
|||
valeur.Empty(); |
|||
ilib.Empty(); |
|||
namecmp.Empty(); |
|||
read_cmp_data = TRUE; |
|||
|
|||
while( ! eof && read_cmp_data ) |
|||
{ |
|||
if( fgets(Line, 1024,source) == 0 ) |
|||
{ |
|||
eof = TRUE; break; |
|||
} |
|||
|
|||
if( strnicmp(Line, "EndCmp", 6 ) == 0 ) |
|||
{ |
|||
read_cmp_data = TRUE; break; |
|||
} |
|||
|
|||
ident = strtok ( Line,"=;\n\r"); |
|||
data = strtok ( NULL,";\n\r"); |
|||
if( strnicmp(ident, "TimeStamp", 9) == 0) |
|||
{ |
|||
timestamp = CONV_FROM_UTF8(data); |
|||
timestamp.Trim(TRUE); |
|||
timestamp.Trim(FALSE); |
|||
continue; |
|||
} |
|||
|
|||
if( strnicmp(ident, "Reference", 9) == 0) |
|||
{ |
|||
namecmp = CONV_FROM_UTF8(data); |
|||
namecmp.Trim(TRUE); |
|||
namecmp.Trim(FALSE); |
|||
continue; |
|||
} |
|||
|
|||
if( strnicmp(ident, "ValeurCmp", 9) == 0) |
|||
{ |
|||
valeur = CONV_FROM_UTF8(data); |
|||
valeur.Trim(TRUE); |
|||
valeur.Trim(FALSE); |
|||
continue; |
|||
} |
|||
|
|||
if( strnicmp(ident, "IdModule", 8) == 0) |
|||
{ |
|||
ilib = CONV_FROM_UTF8(data); |
|||
ilib.Trim(TRUE); |
|||
ilib.Trim(FALSE); |
|||
continue; |
|||
} |
|||
} /* Fin lecture description de 1 composant */ |
|||
|
|||
/* Recherche du composant correspondant en netliste et
|
|||
mise a jour de ses parametres */ |
|||
for ( Cmp = g_BaseListeCmp ; Cmp != NULL ; Cmp = Cmp->Pnext ) |
|||
{ |
|||
if (selection_type == 1 ) |
|||
{ |
|||
if( timestamp != Cmp->m_TimeStamp ) |
|||
continue ; |
|||
} |
|||
else |
|||
if( namecmp != Cmp->m_Reference ) continue; |
|||
|
|||
/* composant identifie , copie du nom du module correspondant */ |
|||
Cmp->m_Module= ilib; |
|||
} |
|||
} |
|||
fclose(source) ; |
|||
return(1) ; |
|||
wxString timestamp, valeur, ilib, namecmp; |
|||
bool read_cmp_data = FALSE, eof = FALSE; |
|||
STORECMP* Cmp; |
|||
char Line[1024], * ident, * data; |
|||
wxString FullFileName; |
|||
|
|||
/* calcul du nom du fichier */ |
|||
FullFileName = FFileName; |
|||
ChangeFileNameExt( FullFileName, g_ExtCmpBuffer ); |
|||
|
|||
source = wxFopen( FullFileName, wxT( "rt" ) ); |
|||
if( source == NULL ) |
|||
{ |
|||
return 0; |
|||
} |
|||
|
|||
/* Identification du Type de fichier CmpMod */ |
|||
if( fgets( Line, 79, source ) == 0 ) |
|||
return 0; |
|||
if( strnicmp( Line, EnteteCmpMod, 11 ) != 0 ) /* old file version*/ |
|||
{ |
|||
fclose( source ); |
|||
DisplayError( NULL, |
|||
wxT( "Old version of Componaent file, recreate it!" ) ); |
|||
return 0; |
|||
} |
|||
|
|||
/* lecture de la liste */ |
|||
while( !eof && fgets( Line, 79, source ) != 0 ) |
|||
{ |
|||
if( strnicmp( Line, "EndListe", 8 ) == 0 ) |
|||
break; |
|||
|
|||
/* Recherche du debut de description du composant */ |
|||
if( strnicmp( Line, "BeginCmp", 8 ) != 0 ) |
|||
continue; |
|||
timestamp.Empty(); |
|||
valeur.Empty(); |
|||
ilib.Empty(); |
|||
namecmp.Empty(); |
|||
read_cmp_data = TRUE; |
|||
|
|||
while( !eof && read_cmp_data ) |
|||
{ |
|||
if( fgets( Line, 1024, source ) == 0 ) |
|||
{ |
|||
eof = TRUE; break; |
|||
} |
|||
|
|||
if( strnicmp( Line, "EndCmp", 6 ) == 0 ) |
|||
{ |
|||
read_cmp_data = TRUE; break; |
|||
} |
|||
|
|||
ident = strtok( Line, "=;\n\r" ); |
|||
data = strtok( NULL, ";\n\r" ); |
|||
if( strnicmp( ident, "TimeStamp", 9 ) == 0 ) |
|||
{ |
|||
timestamp = CONV_FROM_UTF8( data ); |
|||
timestamp.Trim( TRUE ); |
|||
timestamp.Trim( FALSE ); |
|||
continue; |
|||
} |
|||
|
|||
if( strnicmp( ident, "Reference", 9 ) == 0 ) |
|||
{ |
|||
namecmp = CONV_FROM_UTF8( data ); |
|||
namecmp.Trim( TRUE ); |
|||
namecmp.Trim( FALSE ); |
|||
continue; |
|||
} |
|||
|
|||
if( strnicmp( ident, "ValeurCmp", 9 ) == 0 ) |
|||
{ |
|||
valeur = CONV_FROM_UTF8( data ); |
|||
valeur.Trim( TRUE ); |
|||
valeur.Trim( FALSE ); |
|||
continue; |
|||
} |
|||
|
|||
if( strnicmp( ident, "IdModule", 8 ) == 0 ) |
|||
{ |
|||
ilib = CONV_FROM_UTF8( data ); |
|||
ilib.Trim( TRUE ); |
|||
ilib.Trim( FALSE ); |
|||
continue; |
|||
} |
|||
} /* Fin lecture description de 1 composant */ |
|||
|
|||
/* Recherche du composant correspondant en netliste et
|
|||
* mise a jour de ses parametres */ |
|||
for( Cmp = g_BaseListeCmp; Cmp != NULL; Cmp = Cmp->Pnext ) |
|||
{ |
|||
if( selection_type == 1 ) |
|||
{ |
|||
if( timestamp != Cmp->m_TimeStamp ) |
|||
continue; |
|||
} |
|||
else |
|||
if( namecmp != Cmp->m_Reference ) |
|||
continue; |
|||
|
|||
/* composant identifie , copie du nom du module correspondant */ |
|||
Cmp->m_Module = ilib; |
|||
} |
|||
} |
|||
|
|||
fclose( source ); |
|||
return 1; |
|||
} |
|||
|
|||
|
Some files were not shown because too many files changed in this diff
Write
Preview
Loading…
Cancel
Save
Reference in new issue