Commit 8c36cbf4 authored by stambaughw's avatar stambaughw

Complete comment translation of cvpcb source and fix tool tip capitalization.

parent 56995b33
......@@ -2,7 +2,7 @@
/* CVPCB: autosel.cpp */
/**********************/
/* Routines de selection automatique des modules */
/* Routines for automatic selection of modules. */
#include "fctsys.h"
#include "common.h"
......@@ -81,7 +81,7 @@ void WinEDA_CvpcbFrame::AssocieModule( wxCommandEvent& event )
if( m_components.empty() )
return;
/* recherche des equivalences a travers les fichiers possibles */
/* Find equivalents in all available files. */
for( ii = 0; ii < m_AliasLibNames.GetCount(); ii++ )
{
fn = m_AliasLibNames[ii];
......@@ -106,7 +106,6 @@ found in the default search paths." ),
continue;
}
/* lecture fichier n */
while( GetLine( file, Line, NULL, sizeof(Line) ) != NULL )
{
char* text = Line;
......@@ -133,7 +132,7 @@ found in the default search paths." ),
fclose( file );
}
/* Display the number of footpint aliases. */
/* Display the number of footprint aliases. */
msg.Printf( _( "%d footprint aliases found." ), aliases.size() );
SetStatusText( msg, 0 );
......
/***************************************/
/** cfg.cpp : configuration de CVPCB **/
/***************************************/
/* lit ou met a jour la configuration de CVPCB */
/*************/
/** cfg.cpp **/
/*************/
#include "fctsys.h"
#include "appl_wxstruct.h"
......@@ -52,20 +50,19 @@ PARAM_CFG_ARRAY& WinEDA_CvpcbFrame::GetProjectFileParameters( void )
/**
* lit la configuration
* 1 - lit cvpcb.cnf
* 2 - si non trouve lit <chemin de cvpcb.exe>/cvpcb.cnf
* 3 - si non trouve: init des variables aux valeurs par defaut
* Reads the configuration
* 1 - bed cvpcb.cnf
* 2 - if not in path of <cvpcb.exe> / cvpcb.cnf
* 3 - If not found: init variables to default values
*
* Remarque:
* le chemin de l'executable cvpcb.exe doit etre dans BinDir
* Note:
* The path of the executable must be in cvpcb.exe.
*
*/
void WinEDA_CvpcbFrame::LoadProjectFile( const wxString& FileName )
{
wxFileName fn = FileName;
/* Init des valeurs par defaut */
m_ModuleLibNames.Clear();
m_AliasLibNames.Clear();
......@@ -85,9 +82,6 @@ void WinEDA_CvpcbFrame::LoadProjectFile( const wxString& FileName )
}
/* fonction relai d'appel a Save_Config,
* la vraie fonction de sauvegarde de la config
*/
void WinEDA_CvpcbFrame::Update_Config( wxCommandEvent& event )
{
SaveProjectFile( m_NetlistFileName.GetFullPath() );
......@@ -106,7 +100,6 @@ void WinEDA_CvpcbFrame::SaveProjectFile( const wxString& fileName )
if( dlg.ShowModal() == wxID_CANCEL )
return;
/* ecriture de la configuration */
wxGetApp().WriteProjectConfig( dlg.GetPath(), GROUP,
GetProjectFileParameters() );
}
......@@ -10,8 +10,8 @@
PIN::PIN()
{
m_Index = 0; /* variable utilisee selon types de netlistes */
m_Type = 0; /* code type electrique ( Entree Sortie Passive..) */
m_Index = 0; /* Variable used by types of netlists. */
m_Type = 0; /* Electrical type. */
}
bool operator<( const PIN& item1, const PIN& item2 )
......
This diff is collapsed.
/**********************************************/
/* CVPCB : declaration des variables globales */
/**********************************************/
/*********/
/* CVPCB */
/*********/
#ifndef __CVPCB_H__
#define __CVPCB_H__
......@@ -11,7 +11,7 @@
#include <boost/foreach.hpp>
// config for footprints doc file acces
// config for footprints doc file access
#define DEFAULT_FOOTPRINTS_LIST_FILENAME wxT( "footprints_doc/footprints.pdf" )
// Define print format to display a schematic component line
......@@ -19,7 +19,7 @@
#define FILTERFOOTPRINTKEY "FilterFootprint"
/* Types de netliste: */
/* Net list types. */
#define TYPE_NON_SPECIFIE 0
#define TYPE_ORCADPCB2 1
#define TYPE_PCAD 2
......@@ -30,12 +30,12 @@
class PIN
{
public:
int m_Index; /* variable utilisee selon types de netlistes */
int m_Type; /* code type electrique ( Entree Sortie Passive..) */
wxString m_Net; /* Pointeur sur le texte nom de net */
int m_Index; /* Type of net list. */
int m_Type; /* Electrical connection type. */
wxString m_Net; /* Name of net. */
wxString m_Number;
wxString m_Name;
wxString m_Repere; /* utilise selon formats de netliste */
wxString m_Repere; /* Formats used by net lister. */
PIN();
};
......@@ -55,14 +55,14 @@ extern bool same_pin_net( const PIN* item1, const PIN* item2 );
class COMPONENT
{
public:
int m_Num; /* Numero d'ordre */
int m_Multi; /* Nombre d' unites par boitier */
PIN_LIST m_Pins; /* pointeur sur la liste des Pins */
wxString m_Reference; /* U3, R5 ... */
wxString m_Value; /* 7400, 47K ... */
wxString m_TimeStamp; /* Signature temporelle ("00000000" si absente) */
wxString m_Module; /* Nom du module (Package) corresp */
wxString m_Repere; /* utilise selon formats de netliste */
int m_Num; /* Component number. */
int m_Multi; /* Part if component has multiple parts. */
PIN_LIST m_Pins; /* List of component pins. */
wxString m_Reference; /* Reference designator: U3, R5 ... */
wxString m_Value; /* Value: 7400, 47K ... */
wxString m_TimeStamp; /* Time stamp ("00000000" if absent) */
wxString m_Module; /* Footprint (module) name. */
wxString m_Repere; /* Net list format */
wxArrayString m_FootprintFilter; /* List of allowed footprints (wildcards
* allowed ). If empty: no filtering */
......@@ -79,11 +79,11 @@ extern bool operator<( const COMPONENT& item1, const COMPONENT& item2 );
class FOOTPRINT
{
public:
wxString m_Module; /* Nom du module */
wxString m_LibName; /* Nom de la librairie contenant ce module */
int m_Num; /* Numero d'ordre pour affichage sur la liste */
wxString m_Doc; /* Doc associee */
wxString m_KeyWord; /* Mots cles associes */
wxString m_Module; /* Module name. */
wxString m_LibName; /* Name of the library containing this module. */
int m_Num; /* Order number in the display list. */
wxString m_Doc; /* Footprint description. */
wxString m_KeyWord; /* Footprint key words. */
FOOTPRINT();
};
......@@ -93,7 +93,6 @@ typedef boost::ptr_vector< FOOTPRINT > FOOTPRINT_LIST;
/* FOOTPRINT object list sort function. */
extern bool operator<( const FOOTPRINT& item1, const FOOTPRINT& item2 );
/* Gestion des noms des librairies */
extern const wxString FootprintAliasFileExtension;
extern const wxString RetroFileExtension;
extern const wxString ComponentFileExtension;
......
/***********************************************************/
/* cvstruct.h : */
/* descriptions des principales classes derivees utilisees */
/***********************************************************/
/*********************************************************/
/* cvstruct.h */
/*********************************************************/
#ifndef CVSTRUCT_H
#define CVSTRUCT_H
......@@ -59,7 +58,7 @@ public:
FOOTPRINTS_LISTBOX* m_FootprintList;
COMPONENTS_LISTBOX* m_ListCmp;
WinEDA_DisplayFrame* DrawFrame;
WinEDA_Toolbar* m_HToolBar; // Toolbar horizontal haut d'ecran
WinEDA_Toolbar* m_HToolBar;
wxFileName m_NetlistFileName;
wxArrayString m_ModuleLibNames;
wxArrayString m_AliasLibNames;
......@@ -76,7 +75,6 @@ protected:
bool m_isEESchemaNetlist;
PARAM_CFG_ARRAY m_projectFileParams;
// Constructor and destructor
public:
WinEDA_CvpcbFrame( const wxString& title,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
......@@ -86,7 +84,7 @@ public:
void OnLeftDClick( wxListEvent& event );
void OnSelectComponent( wxListEvent& event );
void Update_Config( wxCommandEvent& event ); /* enregistrement de la config */
void Update_Config( wxCommandEvent& event );
void OnQuit( wxCommandEvent& event );
void OnCloseWindow( wxCloseEvent& Event );
void OnSize( wxSizeEvent& SizeEvent );
......@@ -269,7 +267,8 @@ public:
* add a list of pickers to handle a list of items
* @param aItemsList = the list of items modified by the command to undo
* @param aTypeCommand = command type (see enum UndoRedoOpType)
* @param aTransformPoint = the reference point of the transformation, for commands like move
* @param aTransformPoint = the reference point of the transformation,
* for commands like move
*/
virtual void SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
UndoRedoOpType aTypeCommand,
......
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_cvpcb_config.cpp
// Author: jean-pierre Charras
// Licence: gpl
......@@ -40,9 +39,7 @@ DIALOG_CVPCB_CONFIG::DIALOG_CVPCB_CONFIG( WinEDA_CvpcbFrame* parent ) :
}
/*************************************/
void DIALOG_CVPCB_CONFIG::Init()
/*************************************/
{
wxString msg;
......@@ -73,15 +70,13 @@ void DIALOG_CVPCB_CONFIG::Init()
m_DefaultLibraryPathslistBox->Append( libpaths[ii] );
}
// select the first path afer the current path project
// select the first path after the current path project
if( libpaths.GetCount() > 1 )
m_DefaultLibraryPathslistBox->Select( 1 );
}
/******************************************************************/
void DIALOG_CVPCB_CONFIG::OnCancelClick( wxCommandEvent& event )
/******************************************************************/
{
// Recreate the user lib path
if( m_LibPathChanged )
......@@ -96,9 +91,7 @@ void DIALOG_CVPCB_CONFIG::OnCancelClick( wxCommandEvent& event )
}
/**************************************************************/
void DIALOG_CVPCB_CONFIG::OnOkClick( wxCommandEvent& event )
/**************************************************************/
{
m_Parent->m_DocModulesFileName = m_TextHelpModulesFileName->GetValue();
......@@ -114,8 +107,8 @@ void DIALOG_CVPCB_CONFIG::OnOkClick( wxCommandEvent& event )
}
}
// Set new active library list if the lib list of if default path list was modified
// Set new active library list if the lib list of if default path list
// was modified
if( m_LibListChanged || m_LibPathChanged )
{
// Recreate lib list
......@@ -138,21 +131,16 @@ void DIALOG_CVPCB_CONFIG::OnOkClick( wxCommandEvent& event )
}
/**************************************************************/
void DIALOG_CVPCB_CONFIG::OnCloseWindow( wxCloseEvent& event )
/**************************************************************/
{
EndModal( 0 );
}
/*********************************************************************/
void DIALOG_CVPCB_CONFIG::OnRemoveLibClick( wxCommandEvent& event )
/*********************************************************************/
/* Remove a library to the library list.
* The real list (g_LibName_List) is not changed, so the change can be cancelled
* The real list (g_LibName_List) is not changed, so the change can be canceled
*/
void DIALOG_CVPCB_CONFIG::OnRemoveLibClick( wxCommandEvent& event )
{
int ii;
......@@ -170,15 +158,12 @@ void DIALOG_CVPCB_CONFIG::OnRemoveLibClick( wxCommandEvent& event )
}
/**************************************************************************/
void DIALOG_CVPCB_CONFIG::OnAddOrInsertLibClick( wxCommandEvent& event )
/**************************************************************************/
/* Insert or add a library to the library list:
* The new library is put in list before (insert button) the selection,
* or added (add button) to end of list
* The real list (g_LibName_List) is not changed, so the change can be cancelled
* The real list (g_LibName_List) is not changed, so the change can be canceled
*/
void DIALOG_CVPCB_CONFIG::OnAddOrInsertLibClick( wxCommandEvent& event )
{
int ii;
wxString libfilename, wildcard;
......@@ -235,7 +220,7 @@ void DIALOG_CVPCB_CONFIG::OnAddOrInsertLibClick( wxCommandEvent& event )
fn.SetExt(wxEmptyString);
libfilename = fn.GetFullPath();
//Add or insert new library name, if not already in list
// Add or insert new library name, if not already in list
if( list->FindString( libfilename, fn.IsCaseSensitive() ) == wxNOT_FOUND )
{
m_LibListChanged = TRUE;
......@@ -254,16 +239,14 @@ void DIALOG_CVPCB_CONFIG::OnAddOrInsertLibClick( wxCommandEvent& event )
}
/***********************************************************************/
void DIALOG_CVPCB_CONFIG::OnAddOrInsertPath( wxCommandEvent& event )
/***********************************************************************/
{
wxString path = wxGetApp().ReturnLastVisitedLibraryPath();
bool select = EDA_DirectorySelector( _( "Default Path for Libraries" ), /* Titre de la fenetre */
path, /* Chemin par defaut */
bool select = EDA_DirectorySelector( _( "Default Path for Libraries" ),
path,
wxDD_DEFAULT_STYLE,
this, /* parent frame */
this,
wxDefaultPosition );
if( !select )
......@@ -303,9 +286,7 @@ void DIALOG_CVPCB_CONFIG::OnAddOrInsertPath( wxCommandEvent& event )
}
/***********************************************************************/
void DIALOG_CVPCB_CONFIG::OnRemoveUserPath( wxCommandEvent& event )
/***********************************************************************/
{
int ii = m_listUserPaths->GetSelection();
......@@ -328,9 +309,7 @@ void DIALOG_CVPCB_CONFIG::OnRemoveUserPath( wxCommandEvent& event )
}
/**************************************************************************/
void DIALOG_CVPCB_CONFIG::OnBrowseModDocFile( wxCommandEvent& event )
/**************************************************************************/
{
wxString FullFileName;
wxString docpath, filename;
......
This diff is collapsed.
/*********************************************************************/
/** setvisu() : initialisations de l'ecran d'affichage du composant **/
/*********************************************************************/
/**********************/
/** displayframe.cpp **/
/**********************/
#include "fctsys.h"
#include "appl_wxstruct.h"
......@@ -17,16 +17,12 @@
/*
* NOTE: There is something in 3d_viewer.h that causes a compiler error in
* <boost/foreach.hpp> in Linux so move it after cvpcb.h where it is
* included to prevent the error from occuring.
* included to prevent the error from occurring.
*/
#include "3d_viewer.h"
/*****************************************************************/
/* Construction de la table des evenements pour WinEDA_DrawFrame */
/*****************************************************************/
BEGIN_EVENT_TABLE( WinEDA_DisplayFrame, WinEDA_BasePcbFrame )
EVT_CLOSE( WinEDA_DisplayFrame::OnCloseWindow )
EVT_SIZE( WinEDA_DrawFrame::OnSize )
......@@ -61,14 +57,15 @@ WinEDA_DisplayFrame::WinEDA_DisplayFrame( WinEDA_CvpcbFrame* father,
SetBaseScreen( new PCB_SCREEN() );
LoadSettings();
// Initilialize grid id to a default value if not found in config or bad:
// Internalize grid id to a default value if not found in config or bad:
if( (m_LastGridSizeId <= 0) ||
(m_LastGridSizeId < (ID_POPUP_GRID_USER - ID_POPUP_GRID_LEVEL_1000)) )
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_500 - ID_POPUP_GRID_LEVEL_1000;
// Initialize some display options
DisplayOpt.DisplayPadIsol = false; // Pad clearance has no meaning here
DisplayOpt.ShowTrackClearanceMode = 0; // tracks and vias clearance has no meaning here
DisplayOpt.ShowTrackClearanceMode = 0; /* tracks and vias clearance has
* no meaning here. */
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
......@@ -78,9 +75,7 @@ WinEDA_DisplayFrame::WinEDA_DisplayFrame( WinEDA_CvpcbFrame* father,
}
/******************************************/
WinEDA_DisplayFrame::~WinEDA_DisplayFrame()
/******************************************/
{
delete GetBoard();
......@@ -91,13 +86,10 @@ WinEDA_DisplayFrame::~WinEDA_DisplayFrame()
}
/************************************************************/
void WinEDA_DisplayFrame::OnCloseWindow( wxCloseEvent& event )
/************************************************************/
/* Called when the frame is closed
* Save current settings (frame position and size
*/
void WinEDA_DisplayFrame::OnCloseWindow( wxCloseEvent& event )
{
wxPoint pos;
wxSize size;
......@@ -110,16 +102,12 @@ void WinEDA_DisplayFrame::OnCloseWindow( wxCloseEvent& event )
}
/************************************************/
void WinEDA_DisplayFrame::ReCreateVToolbar()
/************************************************/
{
}
/************************************************/
void WinEDA_DisplayFrame::ReCreateHToolbar()
/************************************************/
{
if( m_HToolBar != NULL )
return;
......@@ -161,38 +149,29 @@ void WinEDA_DisplayFrame::ReCreateHToolbar()
}
/*******************************************/
void WinEDA_DisplayFrame::SetToolbars()
/*******************************************/
{
}
/*************************************************************************/
void WinEDA_DisplayFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
/*************************************************************************/
{
}
/*************************************************************************/
void WinEDA_DisplayFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
/*************************************************************************/
{
}
/*********************************************************************************/
bool WinEDA_DisplayFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
/*********************************************************************************/
bool WinEDA_DisplayFrame::OnRightClick( const wxPoint& MousePos,
wxMenu* PopMenu )
{
return true;
}
/****************************************************************/
void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
/****************************************************************/
{
wxRealPoint delta;
int flagcurseur = 0;
......@@ -325,7 +304,7 @@ void WinEDA_DisplayFrame::Show3D_Frame( wxCommandEvent& event )
m_Draw3DFrame->Show( TRUE );
}
/* Virtual fonction needed by the PCB_SCREEN class derived from BASE_SCREEN
/* Virtual function needed by the PCB_SCREEN class derived from BASE_SCREEN
* this is a virtual pure function in BASE_SCREEN
* do nothing in cvpcb
* could be removed later
......
/***************/
/* genstf() */
/***************/
/* genere le fichier STF type 'ref' 'nom_empreinte' pour DRAFT */
/*****************/
/* genequiv.cpp */
/*****************/
#include "fctsys.h"
#include "wxstruct.h"
......@@ -24,7 +22,6 @@ void WinEDA_CvpcbFrame::WriteStuffList( wxCommandEvent& event )
if( m_components.empty() )
return;
/* calcul du nom du fichier */
fn.SetExt( RetroFileExtension );
wxFileDialog dlg( this, wxT( "Save Stuff File" ), fn.GetPath(),
......@@ -43,10 +40,8 @@ void WinEDA_CvpcbFrame::WriteStuffList( wxCommandEvent& event )
return;
}
/* Generation de la liste */
BOOST_FOREACH( COMPONENT& component, m_components )
{
/* gnration du composant si son empreinte est dfinie */
if( component.m_Module.empty() )
continue;
fprintf( FileEquiv, "comp = \"%s\" module = \"%s\"\n",
......
/***************/
/* genorcad() */
/***************/
/*****************/
/* genorcad.cpp */
/*****************/
/*
* Complte la netliste (*.NET) en y placant les ref *.lib FORMAT ORCADPCB
* La valeur (Part Value) est tronquee a 16 lettres
* Create the netlist (* NET) by placing the *.lib ref FORMAT ORCADPCB
* The value (share value) is truncated to 16 letters.
*/
#include "fctsys.h"
......@@ -16,13 +16,13 @@
#define MAX_LEN_NETNAME 16
/* Routines locales */
static void TriPinsModule( COMPONENT* CurrentCmp );
static void ChangePinNet( wxString& PinNet, bool rightJustify );
/* Variables Locales */
int NetNumCode; /* Nombre utilise pour cree des NetNames lors de
* reaffectation de NetNames */
int NetNumCode; /* Number of used for NetNames created during
* reallocation of NetNames. */
int genorcad( bool rightJustify )
{
......@@ -35,10 +35,6 @@ int genorcad( bool rightJustify )
fprintf( dest, "( { Netlist by %s, date = %s }\n",
CONV_TO_UTF8( Title ), Line );
/***********************/
/* Lecture de la liste */
/***********************/
CurrentCmp = BaseListeCmp;
for( ; CurrentCmp != NULL; CurrentCmp = CurrentCmp->Pnext )
{
......@@ -52,13 +48,11 @@ int genorcad( bool rightJustify )
fprintf( dest, " %s ", CONV_TO_UTF8( CurrentCmp->m_Reference ) );
/* placement de la valeur */
fprintf( dest, "%s\n", CONV_TO_UTF8( CurrentCmp->m_Value ) );
/* Tri des pins */
/* Sort pins. */
TriPinsModule( CurrentCmp );
/* Placement de la liste des pins */
Pin = CurrentCmp->m_Pins;
for( ; Pin != NULL; Pin = Pin->Pnext )
{
......@@ -82,12 +76,8 @@ int genorcad( bool rightJustify )
}
/***********************************************/
/* Sort pins */
static void TriPinsModule( COMPONENT* CurrentCmp )
/***********************************************/
/* Tri et controle des pins du module CurrentCmp
*/
{
PIN* Pin, * NextPin, ** BasePin;
int nbpins = 0, ii;
......@@ -96,11 +86,9 @@ static void TriPinsModule( COMPONENT* CurrentCmp )
if( Pin == NULL )
return;
/* comptage des pins */
for( ; Pin != NULL; Pin = Pin->Pnext )
nbpins++;
/* Tri des pins: etablissement de la liste des pointeurs */
BasePin = (PIN**) MyZMalloc( nbpins * sizeof(PIN*) );
Pin = CurrentCmp->m_Pins;
......@@ -109,10 +97,8 @@ static void TriPinsModule( COMPONENT* CurrentCmp )
BasePin[ii] = Pin;
}
/* Tri des Pins */
qsort( BasePin, nbpins, sizeof( COMPONENT*), PinCompare );
/* Remise a jour des pointeurs chaines */
for( ii = 0; ii < nbpins - 1; ii++ )
{
BasePin[ii]->Pnext = BasePin[ii + 1];
......@@ -123,7 +109,7 @@ static void TriPinsModule( COMPONENT* CurrentCmp )
MyFree( BasePin );
/* Elimination des redondances */
/* Remove duplicate pins. */
Pin = CurrentCmp->m_Pins;
while( Pin != NULL )
{
......@@ -134,7 +120,7 @@ static void TriPinsModule( COMPONENT* CurrentCmp )
{
Pin = Pin->Pnext; continue;
}
/* 2 pins successives ont le meme numero */
/* Successive 2 pins have the same number. */
if( Pin->m_PinNet != NextPin->m_PinNet )
{
wxString msg;
......@@ -150,13 +136,12 @@ static void TriPinsModule( COMPONENT* CurrentCmp )
}
/*******************************************/
static void ChangePinNet( wxString& PinNet, bool rightJustify )
/*******************************************/
/* Change le NetName PinNet par un nom compose des 8 derniers codes de PinNet
* suivi de _Xnnnnn ou nnnnn est un nom de 0 a 99999
/* **** JP translate ****
*
* Change le NetName PinNet par un nom compose des 8 derniers codes de PinNet
* suivi de _Xnnnnn ou nnnnn est un nom de 0 a 99999
*/
static void ChangePinNet( wxString& PinNet, bool rightJustify )
{
PIN* Pin;
COMPONENT* CurrentCmp;
......@@ -166,11 +151,11 @@ static void ChangePinNet( wxString& PinNet, bool rightJustify )
OldName = PinNet;
ii = PinNet.Len();
if( rightJustify ) /* On conserve les 8 dernieres lettres du nom */
if( rightJustify ) /* Retain the last 8 letters of the name. */
{
NewName = OldName.Right( 8 ); NewName << NetNumCode;
}
else /* On conserve les 8 premieres lettres du nom */
else /* Retains the 8 first letters of the name. */
{
NewName = OldName.Left( 8 ); NewName << NetNumCode;
}
......
/*******************************************************************/
/* CVPCB: Routines de base : */
/* lecture Netliste et creation des fenetres composants et modules */
/*******************************************************************/
/**************/
/* init.cpp */
/**************/
#include "fctsys.h"
#include "common.h"
......@@ -15,12 +14,9 @@
#include "cvstruct.h"
/* routines locales : */
/*
* - Affecte un module au composant selectionne
* - Selectionne le composant suivant
* Set the module to the selected component
* Selects the next component
*/
void WinEDA_CvpcbFrame::SetNewPkg( const wxString& package )
{
......@@ -49,7 +45,8 @@ void WinEDA_CvpcbFrame::SetNewPkg( const wxString& package )
Component->m_Module = package;
Line.Printf( CMP_FORMAT, NumCmp + 1,
GetChars( Component->m_Reference ), GetChars( Component->m_Value ),
GetChars( Component->m_Reference ),
GetChars( Component->m_Value ),
GetChars( Component->m_Module ) );
m_modified = true;
......@@ -70,9 +67,8 @@ void WinEDA_CvpcbFrame::SetNewPkg( const wxString& package )
}
/*
* Lecture de la netliste selon format, ainsi que du fichier des composants
* Read the netlist format and file components.
*/
bool WinEDA_CvpcbFrame::ReadNetList()
{
......@@ -89,7 +85,6 @@ bool WinEDA_CvpcbFrame::ReadNetList()
return false;
}
/* lecture des correspondances */
LoadComponentFile( m_NetlistFileName.GetFullPath(), m_components );
if( m_ListCmp == NULL )
......@@ -120,7 +115,7 @@ bool WinEDA_CvpcbFrame::ReadNetList()
m_undefinedComponentCnt );
SetStatusText( msg, 1 );
/* Mise a jour du titre de la fenetre principale */
/* Update the title of the main window. */
SetTitle( wxGetApp().GetTitle() + wxT( " " ) + GetBuildVersion() +
wxT( " " ) + m_NetlistFileName.GetFullPath() );
return true;
......@@ -128,9 +123,9 @@ bool WinEDA_CvpcbFrame::ReadNetList()
/*
* Sauvegarde des fichiers netliste et cmp
* Le nom complet du fichier Netliste doit etre dans FFileName.
* Le nom du fichier cmp en est deduit
* Backup and NetList cmp
* The full name of the netlist file must be in FFileName.
* The file name is deducted in cmp
*/
int WinEDA_CvpcbFrame::SaveNetList( const wxString& fileName )
{
......@@ -158,7 +153,7 @@ int WinEDA_CvpcbFrame::SaveNetList( const wxString& fileName )
if( netlist == 0 )
{
DisplayError( this, _( "Unable to create netlist file" ) );
DisplayError( this, _( "Unable to create net list file" ) );
return 0;
}
......
/**************/
/***************/
/* listlib.cpp */
/**************/
/**(************/
/*
* cherche toutes les ref <chemin lib>*.??? si nom fichier prsent,
* ou examine <chemin lib>[MODULE.LIB]
* Searches for all ref <path lib> *.??? if offering their file name,
* or reviews <path lib> [MODULE.LIB]
*/
#include "fctsys.h"
#include "wxstruct.h"
#include "common.h"
......@@ -25,26 +25,25 @@
static wxString s_files_not_found;
static wxString s_files_invalid;
/* routines locales : */
static void ReadDocLib( const wxString& ModLibName, FOOTPRINT_LIST& list );
/**
* Routine lisant la liste des librairies, et generant la liste chainee
* des modules disponibles
* Read the list of libraries and generate a list modules.
*
* Module descr format:
* $MODULE c64acmd
* Li c64acmd
* Cd Connecteur DIN Europe 96 Contacts AC male droit
* Kw PAD_CONN DIN
* $EndMODULE
* Module description format:
* $MODULE c64acmd
* Li c64acmd DIN connector
* Cd Europe 96 Contact AC male right
* Kw PAD_CONN DIN
* $Endmodule
*
*/
bool LoadFootprintFiles( const wxArrayString& libNames,
FOOTPRINT_LIST& list )
{
FILE* file; /* pour lecture librairie */
FILE* file;
char buffer[1024];
wxFileName filename;
int end;
......@@ -68,13 +67,11 @@ bool LoadFootprintFiles( const wxArrayString& libNames,
/* Parse Libraries Listed */
for( i = 0; i < libNames.GetCount(); i++ )
{
/* Calcul du nom complet de la librairie */
filename = libNames[i];
filename.SetExt( ModuleFileExtension );
tmp = wxGetApp().FindLibraryPath( filename );
if( !tmp )
{
s_files_not_found << filename.GetFullName() << wxT("\n");
......@@ -99,10 +96,9 @@ bool LoadFootprintFiles( const wxArrayString& libNames,
continue;
}
/* TODO Lecture du nombre de composants */
/* TODO: Read the number of components. */
fseek( file, 0, 0 );
/* TODO lecture nom des composants : */
end = 0;
while( !end && fgets( buffer, 255, file ) != NULL )
{
......@@ -162,13 +158,11 @@ bool LoadFootprintFiles( const wxArrayString& libNames,
/**
* 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
* Read the file Doc combines a library ModLibName.
* Create the list of doc strings pointed to by list
* ModLibName = full file name of the library modules
*/
static void
ReadDocLib( const wxString& ModLibName,
FOOTPRINT_LIST& list )
static void ReadDocLib( const wxString& ModLibName, FOOTPRINT_LIST& list )
{
FOOTPRINT* NewMod;
char Line[1024];
......@@ -202,7 +196,7 @@ ReadDocLib( const wxString& ModLibName,
continue;
if( Line[1] == 'E' )
break;
if( Line[1] == 'M' ) /* 1 module description */
if( Line[1] == 'M' )
{
/* Parse file line by line */
while( GetLine( mdc_file, Line, NULL, sizeof(Line) - 1 ) )
......
/***************************************************/
/* Localisation des elements pointes par la souris */
/***************************************************/
/***************/
/* loadcmp.cpp */
/***************/
#include "fctsys.h"
#include "wxstruct.h"
......@@ -16,17 +16,14 @@
#include "cvstruct.h"
/*****************************************************************
/**
* Analyze the libraries to find the module.
* If this module is found, copy it into memory, and
* string end of the list of modules.
*
* Analyse les LIBRAIRIES pour trouver le module demande
* Si ce module est trouve, le copie en memoire, et le
* chaine en fin de liste des modules
* - Entree:
* name_cmp = nom du module
* - Retour:
* Pointeur sur le nouveau module.
*
*****************************************************************/
* @param CmpName - Module name
* @return - Module if found otherwise NULL.
*/
MODULE* WinEDA_DisplayFrame::Get_Module( const wxString& CmpName )
{
int LineNum, Found = 0;
......@@ -39,7 +36,6 @@ MODULE* WinEDA_DisplayFrame::Get_Module( const wxString& CmpName )
for( ii = 0; ii < parent->m_ModuleLibNames.GetCount(); ii++ )
{
/* Calcul du nom complet de la librairie */
fn = parent->m_ModuleLibNames[ii];
fn.SetExt( ModuleFileExtension );
......@@ -64,7 +60,7 @@ found in the default search paths." ),
continue;
}
/* lecture entete chaine definie par ENTETE_LIBRAIRIE */
/* Read header. */
LineNum = 0;
GetLine( file, Line, &LineNum );
StrPurge( Line );
......@@ -78,7 +74,6 @@ found in the default search paths." ),
return NULL;
}
/* Lecture de la liste des composants de la librairie */
Found = 0;
while( !Found && GetLine( file, Line, &LineNum ) )
{
......@@ -96,13 +91,12 @@ found in the default search paths." ),
if( stricmp( Line, CONV_TO_UTF8( CmpName ) ) == 0 )
{
Found = 1;
break; /* Trouve! */
break;
}
}
}
}
/* Lecture de la librairie */
while( Found && GetLine( file, Line, &LineNum ) )
{
if( Line[0] != '$' )
......@@ -114,15 +108,16 @@ found in the default search paths." ),
if( strnicmp( Line, "$MODULE", 7 ) != 0 )
continue;
/* Lecture du nom du composant */
/* Read component name. */
sscanf( Line + 7, " %s", Name );
if( stricmp( Name, CONV_TO_UTF8( CmpName ) ) == 0 ) /* composant localise */
if( stricmp( Name, CONV_TO_UTF8( CmpName ) ) == 0 )
{
Module = new MODULE( GetBoard() );
// Switch the locale to standard C (needed to print floating point numbers like 1.3)
// Switch the locale to standard C (needed to print floating
// point numbers like 1.3)
SetLocaleTo_C_standard();
Module->ReadDescr( file, &LineNum );
SetLocaleTo_Default(); // revert to the current locale
SetLocaleTo_Default(); // revert to the current locale
Module->SetPosition( wxPoint( 0, 0 ) );
fclose( file );
return Module;
......
/***************************************/
/* menucfg : buils the cvpcb main menu */
/* menucfg : build the cvpcb main menu */
/***************************************/
#include "fctsys.h"
......@@ -14,34 +14,24 @@
#include "bitmaps.h"
/*******************************************/
void WinEDA_CvpcbFrame::ReCreateMenuBar()
/*******************************************/
/* Creation des menus de la fenetre principale
*/
{
wxMenuItem* item;
wxMenuBar* menuBar;
/* Destroy the existing menu bar so it can be rebuilt. This allows
* language changes of the menu text on the fly. */
// if( menuBar )
// SetMenuBar( NULL );
menuBar = new wxMenuBar();
wxMenu* filesMenu = new wxMenu;
item = new wxMenuItem( filesMenu, ID_LOAD_PROJECT,
_( "&Open" ),
_( "Open a NetList file" ) );
_( "Open a net list file" ) );
item->SetBitmap( open_xpm );
filesMenu->Append( item );
filesMenu->AppendSeparator();
item = new wxMenuItem( filesMenu, ID_SAVE_PROJECT,
_( "&Save As..." ),
_( "Save New NetList and Footprints List files" ) );
_( "Save new net list and footprint list files" ) );
item->SetBitmap( save_xpm );
filesMenu->Append( item );
......@@ -51,13 +41,12 @@ void WinEDA_CvpcbFrame::ReCreateMenuBar()
item->SetBitmap( exit_xpm );
filesMenu->Append( item );
// Creation des selections des anciens fichiers
wxGetApp().m_fileHistory.AddFilesToMenu( filesMenu );
// Menu Configuration:
wxMenu* configmenu = new wxMenu;
item = new wxMenuItem( configmenu, ID_CONFIG_REQ, _( "&Configuration" ),
_( "Setting Libraries, Directories and others..." ) );
_( "Set libraries and library search paths" ) );
item->SetBitmap( config_xpm );
configmenu->Append( item );
......@@ -91,6 +80,7 @@ void WinEDA_CvpcbFrame::ReCreateMenuBar()
menuBar->Append( configmenu, _( "&Preferences" ) );
menuBar->Append( helpMenu, _( "&Help" ) );
// Associate the menu bar with the frame
/* Calling SetMenuBar() will Destroy the existing menu bar so it can be
* rebuilt. This allows language changes of the menu text on the fly. */
SetMenuBar( menuBar );
}
/**************************************/
/** protos.h liste des fonctions **/
/**************************************/
/**************/
/** protos.h **/
/**************/
#ifndef PROTOS_H
#define PROTOS_H
......@@ -16,5 +16,5 @@ extern bool LoadFootprintFiles( const wxArrayString& libNames,
FOOTPRINT* GetModuleDescrByName( const wxString& FootprintName,
FOOTPRINT_LIST& list );
#endif // PROTOS_H
#endif // PROTOS_H
......@@ -19,16 +19,16 @@
#include "cvstruct.h"
#define SEPARATEUR '|' /* caractere separateur dans netliste */
#define SEPARATEUR '|' /* Separator character in NetList */
/* routines locales : */
static int ReadPinConnection( FILE* f, COMPONENT* CurrentCmp );
/* Tri la liste des composants par ordre alphabetique et met a jour le nouveau
* chainage avant/arriere retourne un pointeur sur le 1er element de la liste */
#define BUFFER_CHAR_SIZE 1024 // Size of buffers used to store netlist data
/* Sort the list alphabetically by component and and returns
* a pointer to the 1st element of list */
#define BUFFER_CHAR_SIZE 1024 // Size of buffers used to store netlist data
/**
......@@ -117,7 +117,7 @@ int WinEDA_CvpcbFrame::ReadSchematicNetlist()
}
/* Read the file header (must be "( { OrCAD PCB" or "({ OrCAD PCB" )
* or "# EESchema Netliste"
* or "# EESchema Netlist"
*/
result = fgets( Line, BUFFER_CHAR_SIZE, source );
/* test for netlist type PCB2 */
......@@ -231,9 +231,7 @@ int WinEDA_CvpcbFrame::ReadSchematicNetlist()
while( Line[i] == ' ' )
i++;
/* goto beginning of reference */
/* debut reference trouv */
/* goto beginning of reference */
for( ; ; i++ )
{
#if defined(KICAD_GOST)
......@@ -249,7 +247,7 @@ int WinEDA_CvpcbFrame::ReadSchematicNetlist()
while( Line[i] == ' ' )
i++;
/** goto beginning of value */
/** goto beginning of value */
for( ; ; i++ )
{
......@@ -348,13 +346,13 @@ int ReadPinConnection( FILE* f, COMPONENT* Cmp )
for( ; ; )
{
/* debut description trouv */
/* Find beginning of description. */
for( ; ; )
{
if( fgets( Line, BUFFER_CHAR_SIZE, f ) == 0 )
return -1;
/* remove blanks from the beginning of the line */
/* Remove blanks from the beginning of the line. */
i = 0; while( Line[i] == ' ' )
i++;
......@@ -368,14 +366,14 @@ int ReadPinConnection( FILE* f, COMPONENT* Cmp )
if( Line[i] < ' ' )
continue;
/* fin de description ? */
/* End of description? */
if( Line[i] == ')' )
return 0;
net.Empty();
numpin.Empty();
/* Read pin name , 4 letters */
/* Read pin name, 4 letters */
for( jj = 0; jj < 4; jj++, i++ )
{
if( Line[i] == ' ' )
......
/**************/
/* savecmp() */
/**************/
/* sauvegarde la liste des associations composants/empreintes */
/****************/
/* savecmp.cpp */
/****************/
#include "fctsys.h"
#include "wxstruct.h"
......@@ -18,16 +16,17 @@
#include "cvstruct.h"
/* Chaines de caractere d'identification */
/* File header. */
char EnteteCmpMod[] = { "Cmp-Mod V01" };
const wxString titleComponentLibErr( _( "Component Library Error" ) );
/*
* Routine de sauvegarde du fichier des modules
* Retourne 1 si OK
* 0 si ecriture non faite
* Backup modules file.
*
* @param NetlistFullFileName - Name of net list file to save.
* @returns - 1 if OK, 0 if error.
*/
int WinEDA_CvpcbFrame::SaveComponentList( const wxString& NetlistFullFileName )
{
......@@ -36,12 +35,11 @@ int WinEDA_CvpcbFrame::SaveComponentList( const wxString& NetlistFullFileName )
char Line[1024];
wxString Title = wxGetApp().GetTitle() + wxT( " " ) + GetBuildVersion();
/* calcul du nom du fichier */
fn.SetExt( ComponentFileExtension );
dest = wxFopen( fn.GetFullPath(), wxT( "wt" ) );
if( dest == NULL )
return 0; /* Erreur ecriture */
return 0;
fprintf( dest, "%s", EnteteCmpMod );
fprintf( dest, " Created by %s", CONV_TO_UTF8( Title ) );
......@@ -68,7 +66,7 @@ int WinEDA_CvpcbFrame::SaveComponentList( const wxString& NetlistFullFileName )
/*
* recupere la liste des associations composants/empreintes
* Load list of associated components and footprints.
*/
bool LoadComponentFile( const wxString& fileName, COMPONENT_LIST& list )
{
......@@ -78,7 +76,6 @@ bool LoadComponentFile( const wxString& fileName, COMPONENT_LIST& list )
FILE* source;
wxFileName fn = fileName;
/* calcul du nom du fichier */
fn.SetExt( ComponentFileExtension );
source = wxFopen( fn.GetFullPath(), wxT( "rt" ) );
......@@ -90,7 +87,7 @@ bool LoadComponentFile( const wxString& fileName, COMPONENT_LIST& list )
return false;
}
/* Identification du Type de fichier CmpMod */
/* Identification of the type of file CmpMod */
if( fgets( Line, 79, source ) == 0 )
{
msg.Printf( _( " <%s> does not appear to be a valid Kicad component library." ),
......@@ -108,13 +105,12 @@ bool LoadComponentFile( const wxString& fileName, COMPONENT_LIST& list )
return false;
}
/* 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 */
/* Search the beginning of the component description. */
if( strnicmp( Line, "BeginCmp", 8 ) != 0 )
continue;
timestamp.Empty();
......@@ -171,16 +167,16 @@ bool LoadComponentFile( const wxString& fileName, COMPONENT_LIST& list )
ilib.Trim( FALSE );
continue;
}
} /* Fin lecture description de 1 composant */
} /* End reading component description. */
/* Recherche du composant correspondant en netliste et
* mise a jour de ses parametres */
/* Search corresponding component and NetList
* Update its parameters. */
BOOST_FOREACH( COMPONENT& component, list )
{
if( namecmp != component.m_Reference )
continue;
/* composant identifie , copie du nom du module correspondant */
/* Copy the name of the corresponding module. */
component.m_Module = ilib;
}
}
......
/*********************************************************************/
/** setvisu.cpp: initialisations de l'ecran d'affichage du composant **/
/*********************************************************************/
/*****************/
/** setvisu.cpp **/
/*****************/
#include "fctsys.h"
#include "common.h"
......@@ -14,7 +14,7 @@
/*
* NOTE: There is something in 3d_viewer.h that causes a compiler error in
* <boost/foreach.hpp> in Linux so move it after cvpcb.h where it is
* included to prevent the error from occuring.
* included to prevent the error from occurring.
*/
#include "3d_viewer.h"
......
/***************************************************/
/* tool_cvpcb.cpp: construction du menu principal */
/***************************************************/
/********************/
/* tool_cvpcb.cpp */
/********************/
#include "fctsys.h"
#include "appl_wxstruct.h"
......@@ -13,9 +13,7 @@
#include "cvstruct.h"
/*********************************************/
void WinEDA_CvpcbFrame::ReCreateHToolbar()
/*********************************************/
{
wxConfig* config = wxGetApp().m_EDA_Config;
......@@ -23,16 +21,18 @@ void WinEDA_CvpcbFrame::ReCreateHToolbar()
return;
m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE );
#if !defined(KICAD_AUIMANAGER)
SetToolBar( (wxToolBar *)m_HToolBar );
#endif
m_HToolBar->AddTool( ID_CVPCB_READ_INPUT_NETLIST, wxEmptyString,
wxBitmap( open_xpm ),
_( "Open a NetList file" ) );
_( "Open a net list file" ) );
m_HToolBar->AddTool( ID_CVPCB_SAVEQUITCVPCB, wxEmptyString,
wxBitmap( save_xpm ),
_( "Save NetList and Footprints List files" ) );
_( "Save net list and footprint files" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_CVPCB_CREATE_CONFIGWINDOW, wxEmptyString,
......@@ -46,7 +46,7 @@ void WinEDA_CvpcbFrame::ReCreateHToolbar()
m_HToolBar->AddTool( ID_CVPCB_AUTO_ASSOCIE, wxEmptyString,
wxBitmap( auto_associe_xpm ),
_( "Automatic Association" ) );
_( "Perform automatic footprint association" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_CVPCB_GOTO_PREVIOUSNA, wxEmptyString,
......
......@@ -2,10 +2,6 @@
/* writenetlistpcbnew.cpp */
/***************************/
/*
* Complete la netliste (*.NET) en y placant les ref *.lib FORMAT PCBNEW ou
* ORCADPCB
*/
#include "fctsys.h"
#include "common.h"
......@@ -19,7 +15,7 @@
#define MAX_LEN_NETNAME 16
/* Routines locales */
static void ChangePinNet( COMPONENT_LIST& list, wxString& PinNet,
int* netNumber, bool rightJustify );
static void WriteFootprintFilterInfos( FILE* dest, COMPONENT_LIST& list );
......@@ -66,6 +62,13 @@ static void RemoveDuplicatePins( COMPONENT& component )
}
/**
* Create Kicad net list file.
*
* @todo: None of the printf() call return values are checked for failure,
* a value less than zero. Check all printf() return values and
* return a true(pass) or false(fail) to the caller.
*/
int GenNetlistPcbnew( FILE* file, COMPONENT_LIST& list, bool isEESchemaNetlist,
bool rightJustify )
{
......@@ -80,9 +83,6 @@ int GenNetlistPcbnew( FILE* file, COMPONENT_LIST& list, bool isEESchemaNetlist,
else
fprintf( file, "( { netlist created %s }\n", Line );
/***********************/
/* Lecture de la liste */
/***********************/
BOOST_FOREACH( COMPONENT& component, list )
{
......@@ -96,13 +96,11 @@ int GenNetlistPcbnew( FILE* file, COMPONENT_LIST& list, bool isEESchemaNetlist,
fprintf( file, " %s ", CONV_TO_UTF8( component.m_Reference ) );
/* placement de la valeur */
fprintf( file, "%s\n", CONV_TO_UTF8( component.m_Value ) );
component.m_Pins.sort();
RemoveDuplicatePins( component );
/* Placement de la liste des pins */
BOOST_FOREACH( PIN& pin, component.m_Pins )
{
if( pin.m_Net.Len() > MAX_LEN_NETNAME )
......@@ -164,7 +162,7 @@ void WriteFootprintFilterInfos( FILE* file, COMPONENT_LIST& list )
}
/*
/* *** JP translate ***
* Change le NetName PinNet par un nom compose des 8 derniers codes de PinNet
* suivi de _Xnnnnn ou nnnnn est un nom de 0 a 99999
*/
......@@ -178,12 +176,12 @@ static void ChangePinNet( COMPONENT_LIST& list, wxString& PinNet,
OldName = PinNet;
if( rightJustify ) /* On conserve les 8 dernieres lettres du nom */
if( rightJustify ) /* Retain the last 8 letters of the name. */
{
NewName = OldName.Right( 8 );
NewName << *netNumber;
}
else /* On conserve les 8 premieres lettres du nom */
else /* Retain the first 8 letters of the name. */
{
NewName = OldName.Left( 8 );
NewName << *netNumber;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment