diff --git a/cvpcb/autosel.cpp b/cvpcb/autosel.cpp index 57284caa79..3d522188ac 100644 --- a/cvpcb/autosel.cpp +++ b/cvpcb/autosel.cpp @@ -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 ); diff --git a/cvpcb/cfg.cpp b/cvpcb/cfg.cpp index bc3e2a7d60..8d310a5a17 100644 --- a/cvpcb/cfg.cpp +++ b/cvpcb/cfg.cpp @@ -1,8 +1,6 @@ -/***************************************/ -/** 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 /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.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() ); } diff --git a/cvpcb/class_cvpcb.cpp b/cvpcb/class_cvpcb.cpp index 6c526a8c68..e362cfebbf 100644 --- a/cvpcb/class_cvpcb.cpp +++ b/cvpcb/class_cvpcb.cpp @@ -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 ) diff --git a/cvpcb/cvframe.cpp b/cvpcb/cvframe.cpp index fc1db0c493..388fc0a103 100644 --- a/cvpcb/cvframe.cpp +++ b/cvpcb/cvframe.cpp @@ -26,13 +26,10 @@ static const wxString KeepCvpcbOpenEntry( wxT( "KeepCvpcbOpen" ) ); static const wxString FootprintDocFileEntry( wxT( "footprints_doc_file" ) ); -/*************************************/ -/* Event table for WinEDA_CvpcbFrame */ -/*************************************/ BEGIN_EVENT_TABLE( WinEDA_CvpcbFrame, WinEDA_BasicFrame ) EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, WinEDA_CvpcbFrame::LoadNetList ) -// Menu events + // Menu events EVT_MENU( ID_LOAD_PROJECT, WinEDA_CvpcbFrame::LoadNetList ) EVT_MENU( ID_SAVE_PROJECT, @@ -54,7 +51,7 @@ BEGIN_EVENT_TABLE( WinEDA_CvpcbFrame, WinEDA_BasicFrame ) ID_LANGUAGE_CHOICE_END, WinEDA_CvpcbFrame::SetLanguage ) -// Toolbar events + // Toolbar events EVT_TOOL( ID_CVPCB_QUIT, WinEDA_CvpcbFrame::OnQuit ) EVT_TOOL( ID_CVPCB_READ_INPUT_NETLIST, @@ -82,12 +79,12 @@ BEGIN_EVENT_TABLE( WinEDA_CvpcbFrame, WinEDA_BasicFrame ) EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST, WinEDA_CvpcbFrame::OnSelectFilteringFootprint ) -// Frame events + // Frame events EVT_CHAR( WinEDA_CvpcbFrame::OnChar ) EVT_CLOSE( WinEDA_CvpcbFrame::OnCloseWindow ) EVT_SIZE( WinEDA_CvpcbFrame::OnSize ) -// List item events + // List item events EVT_LIST_ITEM_SELECTED( ID_CVPCB_FOOTPRINT_LIST, WinEDA_CvpcbFrame::OnLeftClick ) EVT_LIST_ITEM_ACTIVATED( ID_CVPCB_FOOTPRINT_LIST, @@ -99,22 +96,19 @@ BEGIN_EVENT_TABLE( WinEDA_CvpcbFrame, WinEDA_BasicFrame ) WinEDA_CvpcbFrame::OnUpdateKeepOpenOnSave ) END_EVENT_TABLE() - -/*******************************************************/ -/* Constructeur de WinEDA_CvpcbFrame: la fenetre generale */ -/*******************************************************/ -WinEDA_CvpcbFrame::WinEDA_CvpcbFrame( const wxString& title, long style ) : +WinEDA_CvpcbFrame::WinEDA_CvpcbFrame( const wxString& title, + long style ) : WinEDA_BasicFrame( NULL, CVPCB_FRAME, title, wxDefaultPosition, wxDefaultSize, style ) { m_FrameName = wxT( "CvpcbFrame" ); - m_ListCmp = NULL; - m_FootprintList = NULL; - DrawFrame = NULL; - m_HToolBar = NULL; - m_modified = false; - m_rightJustify = false; + m_ListCmp = NULL; + m_FootprintList = NULL; + DrawFrame = NULL; + m_HToolBar = NULL; + m_modified = false; + m_rightJustify = false; m_isEESchemaNetlist = false; m_KeepCvpcbOpen = false; m_undefinedComponentCnt = 0; @@ -125,7 +119,7 @@ WinEDA_CvpcbFrame::WinEDA_CvpcbFrame( const wxString& title, long style ) : * this is of the responsibility to users to create this file * if they want to have a list of footprints */ - m_DocModulesFileName = DEFAULT_FOOTPRINTS_LIST_FILENAME; + m_DocModulesFileName = DEFAULT_FOOTPRINTS_LIST_FILENAME; // Give an icon #ifdef __WINDOWS__ @@ -151,13 +145,11 @@ WinEDA_CvpcbFrame::WinEDA_CvpcbFrame( const wxString& title, long style ) : ReCreateMenuBar(); ReCreateHToolbar(); - // Creation des listes de modules disponibles et des composants du schema - // Create child subwindows. + // Create list of available modules and components of the schematic BuildCmpListBox(); BuildFOOTPRINTS_LISTBOX(); - /* Creation des contraintes de dimension de la fenetre d'affichage des - * composants du schema */ + /* Create size constraints of the component list window display. */ wxLayoutConstraints* linkpos = new wxLayoutConstraints; linkpos->top.SameAs( this, wxTop ); linkpos->bottom.SameAs( this, wxBottom ); @@ -166,8 +158,7 @@ WinEDA_CvpcbFrame::WinEDA_CvpcbFrame( const wxString& title, long style ) : if( m_ListCmp ) m_ListCmp->SetConstraints( linkpos ); - /* Creation des contraintes de dimension de la fenetre d'affichage des - * modules de la librairie */ + /* Create size constraints for the footprint display window. */ linkpos = new wxLayoutConstraints; linkpos->top.SameAs( m_ListCmp, wxTop ); linkpos->bottom.SameAs( m_ListCmp, wxBottom ); @@ -183,38 +174,37 @@ WinEDA_CvpcbFrame::WinEDA_CvpcbFrame( const wxString& title, long style ) : SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); #if defined(KICAD_AUIMANAGER) - m_auimgr.SetManagedWindow(this); + m_auimgr.SetManagedWindow( this ); wxAuiPaneInfo horiz; - horiz.Gripper(false); - horiz.DockFixed(true); - horiz.Movable(false); - horiz.Floatable(false); - horiz.CloseButton(false); - horiz.CaptionVisible(false); + horiz.Gripper( false ); + horiz.DockFixed( true ); + horiz.Movable( false ); + horiz.Floatable( false ); + horiz.CloseButton( false ); + horiz.CaptionVisible( false ); - wxAuiPaneInfo vert(horiz); + wxAuiPaneInfo vert( horiz ); - vert.TopDockable(false).BottomDockable(false); - horiz.LeftDockable(false).RightDockable(false); + vert.TopDockable( false ).BottomDockable( false ); + horiz.LeftDockable( false ).RightDockable( false ); - m_auimgr.AddPane(m_HToolBar, - wxAuiPaneInfo(horiz).Name(wxT("m_HToolBar")).Top()); + m_auimgr.AddPane( m_HToolBar, + wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top() ); - m_auimgr.AddPane(m_FootprintList, - wxAuiPaneInfo(horiz).Name(wxT("m_FootprintList")).Left().BestSize(m_FrameSize.x * 0.3 ,m_FrameSize.y * 0.9)); + m_auimgr.AddPane( m_FootprintList, + wxAuiPaneInfo( horiz ).Name( wxT( "m_FootprintList" ) ). + Left().BestSize( m_FrameSize.x * 0.3, m_FrameSize.y * 0.9 ) ); - m_auimgr.AddPane(m_ListCmp, - wxAuiPaneInfo().Name(wxT("m_ListCmp")).CentrePane()); + m_auimgr.AddPane( m_ListCmp, + wxAuiPaneInfo().Name( wxT( "m_ListCmp" ) ).CentrePane() ); m_auimgr.Update(); #endif } -/******************************************/ WinEDA_CvpcbFrame::~WinEDA_CvpcbFrame() -/******************************************/ { wxConfig* config = wxGetApp().m_EDA_Config; @@ -268,25 +258,19 @@ void WinEDA_CvpcbFrame::SaveSettings() } -/************************************************/ void WinEDA_CvpcbFrame::OnSize( wxSizeEvent& event ) -/************************************************/ { event.Skip(); } -/******************************************************/ void WinEDA_CvpcbFrame::OnQuit( wxCommandEvent& event ) -/******************************************************/ { Close( TRUE ); } -/**********************************************************/ void WinEDA_CvpcbFrame::OnCloseWindow( wxCloseEvent& Event ) -/**********************************************************/ { int diag; @@ -296,7 +280,8 @@ void WinEDA_CvpcbFrame::OnCloseWindow( wxCloseEvent& Event ) wxMessageDialog dialog( this, _( "Net and component list modified.\nSave before exit ?" ), _( "Confirmation" ), - wxYES_NO | wxCANCEL | wxICON_EXCLAMATION | wxYES_DEFAULT ); + wxYES_NO | wxCANCEL | wxICON_EXCLAMATION | + wxYES_DEFAULT ); ii = dialog.ShowModal(); @@ -330,7 +315,8 @@ void WinEDA_CvpcbFrame::OnCloseWindow( wxCloseEvent& Event ) // Close the help frame if( wxGetApp().m_HtmlCtrl ) { - if( wxGetApp().m_HtmlCtrl->GetFrame() ) // returns NULL if no help frame active + if( wxGetApp().m_HtmlCtrl->GetFrame() ) // returns NULL if no help + // frame active wxGetApp().m_HtmlCtrl->GetFrame()->Close( TRUE ); } @@ -346,35 +332,31 @@ void WinEDA_CvpcbFrame::OnCloseWindow( wxCloseEvent& Event ) } -/************************************************/ void WinEDA_CvpcbFrame::OnChar( wxKeyEvent& event ) -/************************************************/ { switch( event.GetKeyCode() ) { - case WXK_LEFT: - case WXK_NUMPAD_LEFT: - m_ListCmp->SetFocus(); - break; + case WXK_LEFT: + case WXK_NUMPAD_LEFT: + m_ListCmp->SetFocus(); + break; - case WXK_RIGHT: - case WXK_NUMPAD_RIGHT: - m_FootprintList->SetFocus();; - break; + case WXK_RIGHT: + case WXK_NUMPAD_RIGHT: + m_FootprintList->SetFocus();; + break; - default: - event.Skip(); - break; + default: + event.Skip(); + break; } } -/*******************************************************/ void WinEDA_CvpcbFrame::ToFirstNA( wxCommandEvent& event ) -/*******************************************************/ { - int ii = 0; - int selection; + int ii = 0; + int selection; if( m_components.empty() ) return; @@ -384,8 +366,7 @@ void WinEDA_CvpcbFrame::ToFirstNA( wxCommandEvent& event ) if( selection < 0 ) selection = 0; - BOOST_FOREACH( COMPONENT& component, m_components ) - { + BOOST_FOREACH( COMPONENT & component, m_components ) { if( component.m_Module.IsEmpty() && ii > selection ) { m_ListCmp->SetSelection( ii ); @@ -400,12 +381,10 @@ void WinEDA_CvpcbFrame::ToFirstNA( wxCommandEvent& event ) } -/**********************************************************/ void WinEDA_CvpcbFrame::ToPreviousNA( wxCommandEvent& event ) -/**********************************************************/ { - int ii; - int selection; + int ii; + int selection; if( m_components.empty() ) return; @@ -416,7 +395,7 @@ void WinEDA_CvpcbFrame::ToPreviousNA( wxCommandEvent& event ) if( selection < 0 ) selection = m_ListCmp->GetCount() - 1; - BOOST_REVERSE_FOREACH( COMPONENT& component, m_components ) + BOOST_REVERSE_FOREACH( COMPONENT & component, m_components ) { if( component.m_Module.IsEmpty() && ii < selection ) { @@ -431,33 +410,29 @@ void WinEDA_CvpcbFrame::ToPreviousNA( wxCommandEvent& event ) } -/**********************************************************/ void WinEDA_CvpcbFrame::SaveQuitCvpcb( wxCommandEvent& event ) -/**********************************************************/ { if( SaveNetList( wxEmptyString ) > 0 ) { m_modified = false; - if ( ! m_KeepCvpcbOpen ) + if( !m_KeepCvpcbOpen ) Close( TRUE ); } } -/*************************************************************/ -void WinEDA_CvpcbFrame::DelAssociations( wxCommandEvent& event ) -/*************************************************************/ - -/* Supprime toutes les associations deja faites +/* Removes all associations already made */ + +void WinEDA_CvpcbFrame::DelAssociations( wxCommandEvent& event ) { - wxString Line; + wxString Line; if( IsOK( this, _( "Delete selections" ) ) ) { m_ListCmp->SetSelection( 0 ); - BOOST_FOREACH( COMPONENT& component, m_components ) + BOOST_FOREACH( COMPONENT & component, m_components ) { component.m_Module.Empty(); SetNewPkg( wxEmptyString ); @@ -483,7 +458,7 @@ void WinEDA_CvpcbFrame::LoadNetList( wxCommandEvent& event ) wxFileName newFileName; int id = event.GetId(); - if ( id >= wxID_FILE1 && id <= wxID_FILE9 ) + if( id >= wxID_FILE1 && id <= wxID_FILE9 ) { newFileName = GetFileFromHistory( id, _( "Netlist" ) ); } @@ -529,11 +504,10 @@ void WinEDA_CvpcbFrame::LoadNetList( wxCommandEvent& event ) } -/***********************************************************/ void WinEDA_CvpcbFrame::ConfigCvpcb( wxCommandEvent& event ) -/***********************************************************/ { DIALOG_CVPCB_CONFIG ConfigFrame( this ); + ConfigFrame.ShowModal(); } @@ -544,13 +518,7 @@ void WinEDA_CvpcbFrame::OnKeepOpenOnSave( wxCommandEvent& event ) } -/************************************************************/ void WinEDA_CvpcbFrame::DisplayModule( wxCommandEvent& event ) -/************************************************************/ - -/* Fonction liee au boutton "Visu" - * Affiche l'ecran de visualisation des modules - */ { CreateScreenCmp(); DrawFrame->AdjustScrollBars(); @@ -558,9 +526,7 @@ void WinEDA_CvpcbFrame::DisplayModule( wxCommandEvent& event ) } -/********************************************************/ void WinEDA_CvpcbFrame::SetLanguage( wxCommandEvent& event ) -/********************************************************/ { int id = event.GetId(); @@ -571,36 +537,28 @@ void WinEDA_CvpcbFrame::SetLanguage( wxCommandEvent& event ) } -/*************************************************************/ void WinEDA_CvpcbFrame::DisplayDocFile( wxCommandEvent& event ) -/*************************************************************/ { - GetAssociatedDocument( this, m_DocModulesFileName, + GetAssociatedDocument( this, m_DocModulesFileName, &wxGetApp().GetLibraryPathList() ); } -/******************************************************/ void WinEDA_CvpcbFrame::OnLeftClick( wxListEvent& event ) -/******************************************************/ { m_FootprintList->OnLeftClick( event ); } -/******************************************************/ void WinEDA_CvpcbFrame::OnLeftDClick( wxListEvent& event ) -/******************************************************/ { m_FootprintList->OnLeftDClick( event ); } -/*************************************************************/ void WinEDA_CvpcbFrame::OnSelectComponent( wxListEvent& event ) -/*************************************************************/ { - int selection; + int selection; if( !m_HToolBar->GetToolState( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST ) ) { @@ -626,12 +584,9 @@ void WinEDA_CvpcbFrame::OnSelectComponent( wxListEvent& event ) } -/************************************************************************/ -void WinEDA_CvpcbFrame::OnSelectFilteringFootprint( wxCommandEvent& event ) -/************************************************************************/ - /* Select full/filtered footprint display on tool click */ +void WinEDA_CvpcbFrame::OnSelectFilteringFootprint( wxCommandEvent& event ) { wxListEvent l_event; diff --git a/cvpcb/cvpcb.h b/cvpcb/cvpcb.h index 6b5a412f4b..c7dfa54897 100644 --- a/cvpcb/cvpcb.h +++ b/cvpcb/cvpcb.h @@ -1,6 +1,6 @@ -/**********************************************/ -/* CVPCB : declaration des variables globales */ -/**********************************************/ +/*********/ +/* CVPCB */ +/*********/ #ifndef __CVPCB_H__ #define __CVPCB_H__ @@ -11,7 +11,7 @@ #include -// 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; diff --git a/cvpcb/cvstruct.h b/cvpcb/cvstruct.h index d2de7b0a80..169527d64d 100644 --- a/cvpcb/cvstruct.h +++ b/cvpcb/cvstruct.h @@ -1,7 +1,6 @@ -/***********************************************************/ -/* 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, diff --git a/cvpcb/dialog_cvpcb_config.cpp b/cvpcb/dialog_cvpcb_config.cpp index 0e38a7405f..3222c3dc67 100644 --- a/cvpcb/dialog_cvpcb_config.cpp +++ b/cvpcb/dialog_cvpcb_config.cpp @@ -1,5 +1,4 @@ ///////////////////////////////////////////////////////////////////////////// - // 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; diff --git a/cvpcb/dialog_display_options.cpp b/cvpcb/dialog_display_options.cpp index db5d122341..6df918bdd4 100644 --- a/cvpcb/dialog_display_options.cpp +++ b/cvpcb/dialog_display_options.cpp @@ -1,4 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// + // Name: dialog_display_options.cpp // Purpose: // Author: jean-pierre Charras @@ -32,17 +33,14 @@ ////@end XPM images -/*********************************************************************/ -void WinEDA_DisplayFrame::InstallOptionsDisplay(wxCommandEvent& event) -/*********************************************************************/ -/* Creation de la fenetre d'options de la fenetre de visu */ +void WinEDA_DisplayFrame::InstallOptionsDisplay( wxCommandEvent& event ) { - WinEDA_FootprintDisplayOptionsFrame* OptionWindow = - new WinEDA_FootprintDisplayOptionsFrame(this); - OptionWindow->ShowModal(); - OptionWindow->Destroy(); -} + WinEDA_FootprintDisplayOptionsFrame* OptionWindow = + new WinEDA_FootprintDisplayOptionsFrame( this ); + OptionWindow->ShowModal(); + OptionWindow->Destroy(); +} /*! @@ -72,49 +70,65 @@ END_EVENT_TABLE() * WinEDA_FootprintDisplayOptionsFrame constructors */ -WinEDA_FootprintDisplayOptionsFrame::WinEDA_FootprintDisplayOptionsFrame( ) +WinEDA_FootprintDisplayOptionsFrame::WinEDA_FootprintDisplayOptionsFrame() { } -WinEDA_FootprintDisplayOptionsFrame::WinEDA_FootprintDisplayOptionsFrame( WinEDA_BasePcbFrame* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) -{ - m_Parent = parent; - Create(parent, id, caption, pos, size, style); +WinEDA_FootprintDisplayOptionsFrame::WinEDA_FootprintDisplayOptionsFrame( + WinEDA_BasePcbFrame* parent, + wxWindowID id, + const wxString& caption, + const wxPoint& pos, + const wxSize& size, + long style ) +{ + m_Parent = parent; + + Create( parent, id, caption, pos, size, style ); } + /*! * WinEDA_FootprintDisplayOptionsFrame creator */ -bool WinEDA_FootprintDisplayOptionsFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) +bool WinEDA_FootprintDisplayOptionsFrame::Create( wxWindow* parent, + wxWindowID id, + const wxString& caption, + const wxPoint& pos, + const wxSize& size, + long style ) { ////@begin WinEDA_FootprintDisplayOptionsFrame member initialisation OuterBoxSizer = NULL; - MainBoxSizer = NULL; + MainBoxSizer = NULL; m_EdgesDisplayOption = NULL; - m_TextDisplayOption = NULL; - ColumnBoxSizer = NULL; + m_TextDisplayOption = NULL; + ColumnBoxSizer = NULL; m_IsShowPadFill = NULL; m_IsShowViaFill = NULL; - m_IsShowPadNum = NULL; - m_CancelButton = NULL; + m_IsShowPadNum = NULL; + m_CancelButton = NULL; + ////@end WinEDA_FootprintDisplayOptionsFrame member initialisation ////@begin WinEDA_FootprintDisplayOptionsFrame creation - SetExtraStyle(wxWS_EX_BLOCK_EVENTS); + SetExtraStyle( wxWS_EX_BLOCK_EVENTS ); wxDialog::Create( parent, id, caption, pos, size, style ); CreateControls(); - if (GetSizer()) + if( GetSizer() ) { - GetSizer()->SetSizeHints(this); + GetSizer()->SetSizeHints( this ); } Centre(); + ////@end WinEDA_FootprintDisplayOptionsFrame creation return true; } + /*! * Control creation for WinEDA_FootprintDisplayOptionsFrame */ @@ -126,73 +140,108 @@ void WinEDA_FootprintDisplayOptionsFrame::CreateControls() WinEDA_FootprintDisplayOptionsFrame* itemDialog1 = this; - OuterBoxSizer = new wxBoxSizer(wxVERTICAL); - itemDialog1->SetSizer(OuterBoxSizer); + OuterBoxSizer = new wxBoxSizer( wxVERTICAL ); + itemDialog1->SetSizer( OuterBoxSizer ); - MainBoxSizer = new wxBoxSizer(wxHORIZONTAL); - OuterBoxSizer->Add(MainBoxSizer, 1, wxGROW|wxALL, 5); + MainBoxSizer = new wxBoxSizer( wxHORIZONTAL ); + OuterBoxSizer->Add( MainBoxSizer, 1, wxGROW | wxALL, 5 ); wxArrayString m_EdgesDisplayOptionStrings; - m_EdgesDisplayOptionStrings.Add(_("&Line")); - m_EdgesDisplayOptionStrings.Add(_("&Filled")); - m_EdgesDisplayOptionStrings.Add(_("&Sketch")); - m_EdgesDisplayOption = new wxRadioBox( itemDialog1, EDGE_SELECT, _("Edges:"), wxDefaultPosition, wxDefaultSize, m_EdgesDisplayOptionStrings, 1, wxRA_SPECIFY_COLS ); - m_EdgesDisplayOption->SetSelection(0); - MainBoxSizer->Add(m_EdgesDisplayOption, 0, wxALIGN_TOP|wxALL, 5); + m_EdgesDisplayOptionStrings.Add( _( "&Line" ) ); + m_EdgesDisplayOptionStrings.Add( _( "&Filled" ) ); + m_EdgesDisplayOptionStrings.Add( _( "&Sketch" ) ); + m_EdgesDisplayOption = + new wxRadioBox( itemDialog1, EDGE_SELECT, _( "Edges:" ), + wxDefaultPosition, wxDefaultSize, + m_EdgesDisplayOptionStrings, + 1, wxRA_SPECIFY_COLS ); + m_EdgesDisplayOption->SetSelection( 0 ); + MainBoxSizer->Add( m_EdgesDisplayOption, 0, wxALIGN_TOP | wxALL, 5 ); wxArrayString m_TextDisplayOptionStrings; - m_TextDisplayOptionStrings.Add(_("&Line")); - m_TextDisplayOptionStrings.Add(_("&Filled")); - m_TextDisplayOptionStrings.Add(_("&Sketch")); - m_TextDisplayOption = new wxRadioBox( itemDialog1, TEXT_SELECT, _("Texts:"), wxDefaultPosition, wxDefaultSize, m_TextDisplayOptionStrings, 1, wxRA_SPECIFY_COLS ); - m_TextDisplayOption->SetSelection(0); - MainBoxSizer->Add(m_TextDisplayOption, 0, wxALIGN_TOP|wxALL, 5); + m_TextDisplayOptionStrings.Add( _( "&Line" ) ); + m_TextDisplayOptionStrings.Add( _( "&Filled" ) ); + m_TextDisplayOptionStrings.Add( _( "&Sketch" ) ); + m_TextDisplayOption = + new wxRadioBox( itemDialog1, TEXT_SELECT, _( "Texts:" ), + wxDefaultPosition, wxDefaultSize, + m_TextDisplayOptionStrings, 1, + wxRA_SPECIFY_COLS ); + m_TextDisplayOption->SetSelection( 0 ); + MainBoxSizer->Add( m_TextDisplayOption, 0, wxALIGN_TOP | wxALL, 5 ); - ColumnBoxSizer = new wxBoxSizer(wxVERTICAL); - MainBoxSizer->Add(ColumnBoxSizer, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5); + ColumnBoxSizer = new wxBoxSizer( wxVERTICAL ); + MainBoxSizer->Add( ColumnBoxSizer, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); - m_IsShowPadFill = new wxCheckBox( itemDialog1, PADFILL_OPT, _("Fill &pad"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); - m_IsShowPadFill->SetValue(false); - ColumnBoxSizer->Add(m_IsShowPadFill, 1, wxGROW|wxALL, 5); + m_IsShowPadFill = new wxCheckBox( itemDialog1, PADFILL_OPT, + _( "Fill &pad" ), wxDefaultPosition, + wxDefaultSize, wxCHK_2STATE ); + m_IsShowPadFill->SetValue( false ); + ColumnBoxSizer->Add( m_IsShowPadFill, 1, wxGROW | wxALL, 5 ); - m_IsShowViaFill = new wxCheckBox( itemDialog1, VIAFILL_OPT, _("Fill &via"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); - m_IsShowViaFill->SetValue(false); - ColumnBoxSizer->Add(m_IsShowViaFill, 1, wxGROW|wxALL, 5); + m_IsShowViaFill = new wxCheckBox( itemDialog1, VIAFILL_OPT, + _( "Fill &via" ), wxDefaultPosition, + wxDefaultSize, wxCHK_2STATE ); + m_IsShowViaFill->SetValue( false ); + ColumnBoxSizer->Add( m_IsShowViaFill, 1, wxGROW | wxALL, 5 ); - m_IsShowPadNum = new wxCheckBox( itemDialog1, PADNUM_OPT, _("Show pad &number"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); - m_IsShowPadNum->SetValue(false); - if (WinEDA_FootprintDisplayOptionsFrame::ShowToolTips()) - m_IsShowPadNum->SetToolTip(_("Display pad number")); - ColumnBoxSizer->Add(m_IsShowPadNum, 1, wxGROW|wxALL, 5); + m_IsShowPadNum = + new wxCheckBox( itemDialog1, PADNUM_OPT, _( "Show pad &number" ), + wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); + m_IsShowPadNum->SetValue( false ); + if( WinEDA_FootprintDisplayOptionsFrame::ShowToolTips() ) + m_IsShowPadNum->SetToolTip( _( "Display pad number" ) ); + ColumnBoxSizer->Add( m_IsShowPadNum, 1, wxGROW | wxALL, 5 ); - wxStaticLine* itemStaticLine9 = new wxStaticLine( itemDialog1, ID_STATICLINE1, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - OuterBoxSizer->Add(itemStaticLine9, 0, wxGROW|wxALL, 5); + wxStaticLine* itemStaticLine9 = new wxStaticLine( itemDialog1, + ID_STATICLINE1, + wxDefaultPosition, + wxDefaultSize, + wxLI_HORIZONTAL ); + OuterBoxSizer->Add( itemStaticLine9, 0, wxGROW | wxALL, 5 ); - wxStdDialogButtonSizer* itemStdDialogButtonSizer10 = new wxStdDialogButtonSizer; + wxStdDialogButtonSizer* itemStdDialogButtonSizer10 = + new wxStdDialogButtonSizer; - OuterBoxSizer->Add(itemStdDialogButtonSizer10, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); - wxButton* itemButton11 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 ); - itemStdDialogButtonSizer10->AddButton(itemButton11); + OuterBoxSizer->Add( itemStdDialogButtonSizer10, + 0, + wxALIGN_CENTER_HORIZONTAL | wxALL, + 5 ); + wxButton* itemButton11 = new wxButton( itemDialog1, wxID_OK, _( "&OK" ), + wxDefaultPosition, + wxDefaultSize, 0 ); + itemStdDialogButtonSizer10->AddButton( itemButton11 ); - m_CancelButton = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); - itemStdDialogButtonSizer10->AddButton(m_CancelButton); + m_CancelButton = new wxButton( itemDialog1, wxID_CANCEL, _( "&Cancel" ), + wxDefaultPosition, wxDefaultSize, 0 ); + itemStdDialogButtonSizer10->AddButton( m_CancelButton ); - wxButton* itemButton13 = new wxButton( itemDialog1, wxID_APPLY, _("&Apply"), wxDefaultPosition, wxDefaultSize, 0 ); - itemStdDialogButtonSizer10->AddButton(itemButton13); + wxButton* itemButton13 = + new wxButton( itemDialog1, wxID_APPLY, _( "&Apply" ), + wxDefaultPosition, wxDefaultSize, 0 ); + itemStdDialogButtonSizer10->AddButton( itemButton13 ); itemStdDialogButtonSizer10->Realize(); // Set validators - m_EdgesDisplayOption->SetValidator( wxGenericValidator(& DisplayOpt.DisplayModEdge) ); - m_TextDisplayOption->SetValidator( wxGenericValidator(& DisplayOpt.DisplayModText) ); - m_IsShowPadFill->SetValidator( wxGenericValidator( & DisplayOpt.DisplayPadFill) ); - m_IsShowViaFill->SetValidator( wxGenericValidator( & DisplayOpt.DisplayViaFill) ); - m_IsShowPadNum->SetValidator( wxGenericValidator(& DisplayOpt.DisplayPadNum) ); + m_EdgesDisplayOption->SetValidator( wxGenericValidator( &DisplayOpt. + DisplayModEdge ) ); + m_TextDisplayOption->SetValidator( wxGenericValidator( &DisplayOpt. + DisplayModText ) ); + m_IsShowPadFill->SetValidator( wxGenericValidator( &DisplayOpt. + DisplayPadFill ) ); + m_IsShowViaFill->SetValidator( wxGenericValidator( &DisplayOpt. + DisplayViaFill ) ); + m_IsShowPadNum->SetValidator( wxGenericValidator( &DisplayOpt. + DisplayPadNum ) ); + ////@end WinEDA_FootprintDisplayOptionsFrame content construction - m_CancelButton->SetFocus(); /* Necessary to use escape key as cancel under wxGRk */ + /* Necessary to use escape key as cancel under wxGTK. */ + m_CancelButton->SetFocus(); } + /*! * Should we show tooltips? */ @@ -202,59 +251,69 @@ bool WinEDA_FootprintDisplayOptionsFrame::ShowToolTips() return true; } + /*! * Get bitmap resources */ -wxBitmap WinEDA_FootprintDisplayOptionsFrame::GetBitmapResource( const wxString& name ) +wxBitmap WinEDA_FootprintDisplayOptionsFrame::GetBitmapResource( + const wxString& name ) { // Bitmap retrieval ////@begin WinEDA_FootprintDisplayOptionsFrame bitmap retrieval - wxUnusedVar(name); + wxUnusedVar( name ); return wxNullBitmap; + ////@end WinEDA_FootprintDisplayOptionsFrame bitmap retrieval } + /*! * Get icon resources */ -wxIcon WinEDA_FootprintDisplayOptionsFrame::GetIconResource( const wxString& name ) +wxIcon WinEDA_FootprintDisplayOptionsFrame::GetIconResource( + const wxString& name ) { // Icon retrieval ////@begin WinEDA_FootprintDisplayOptionsFrame icon retrieval - wxUnusedVar(name); + wxUnusedVar( name ); return wxNullIcon; + ////@end WinEDA_FootprintDisplayOptionsFrame icon retrieval } + /*! * Update settings related to edges, text strings, and pads */ -void WinEDA_FootprintDisplayOptionsFrame::UpdateObjectSettings(void) +void WinEDA_FootprintDisplayOptionsFrame::UpdateObjectSettings( void ) { // Update settings ////@begin WinEDA_FootprintDisplayOptionsFrame update settings m_Parent->m_DisplayModEdge = m_EdgesDisplayOption->GetSelection(); - m_Parent->m_DisplayModText = m_TextDisplayOption->GetSelection(); - m_Parent->m_DisplayPadNum = m_IsShowPadNum->GetValue(); - m_Parent->m_DisplayPadFill = m_IsShowPadFill->GetValue(); + m_Parent->m_DisplayModText = m_TextDisplayOption->GetSelection(); + m_Parent->m_DisplayPadNum = m_IsShowPadNum->GetValue(); + m_Parent->m_DisplayPadFill = m_IsShowPadFill->GetValue(); m_Parent->m_DisplayViaFill = m_IsShowViaFill->GetValue(); - m_Parent->DrawPanel->Refresh(); + m_Parent->DrawPanel->Refresh(); + ////@end WinEDA_FootprintDisplayOptionsFrame update settings } + /*! * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK */ void WinEDA_FootprintDisplayOptionsFrame::OnOkClick( wxCommandEvent& event ) { - UpdateObjectSettings(); + UpdateObjectSettings(); EndModal( 1 ); } + /*! * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL */ @@ -264,11 +323,12 @@ void WinEDA_FootprintDisplayOptionsFrame::OnCancelClick( wxCommandEvent& event ) EndModal( -1 ); } + /*! * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_APPLY */ void WinEDA_FootprintDisplayOptionsFrame::OnApplyClick( wxCommandEvent& event ) { - UpdateObjectSettings(); + UpdateObjectSettings(); } diff --git a/cvpcb/displayframe.cpp b/cvpcb/displayframe.cpp index a0eebd8676..79030bad77 100644 --- a/cvpcb/displayframe.cpp +++ b/cvpcb/displayframe.cpp @@ -1,6 +1,6 @@ -/*********************************************************************/ -/** 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 * 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 diff --git a/cvpcb/genequiv.cpp b/cvpcb/genequiv.cpp index 077eadac26..e5352912c1 100644 --- a/cvpcb/genequiv.cpp +++ b/cvpcb/genequiv.cpp @@ -1,8 +1,6 @@ -/***************/ -/* 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 ) { - /* génération du composant si son empreinte est définie */ if( component.m_Module.empty() ) continue; fprintf( FileEquiv, "comp = \"%s\" module = \"%s\"\n", diff --git a/cvpcb/genorcad.cpp b/cvpcb/genorcad.cpp index 9e4bdfb94a..1481e9d619 100644 --- a/cvpcb/genorcad.cpp +++ b/cvpcb/genorcad.cpp @@ -1,10 +1,10 @@ -/***************/ -/* genorcad() */ -/***************/ +/*****************/ +/* genorcad.cpp */ +/*****************/ /* - * ComplŠte 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; } diff --git a/cvpcb/init.cpp b/cvpcb/init.cpp index 8a6033ce28..dd4158bdec 100644 --- a/cvpcb/init.cpp +++ b/cvpcb/init.cpp @@ -1,7 +1,6 @@ -/*******************************************************************/ -/* 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; } diff --git a/cvpcb/listlib.cpp b/cvpcb/listlib.cpp index 6d42318aae..ded36aba82 100644 --- a/cvpcb/listlib.cpp +++ b/cvpcb/listlib.cpp @@ -1,12 +1,12 @@ -/**************/ +/***************/ /* listlib.cpp */ -/**************/ +/**(************/ + /* - * cherche toutes les ref *.??? si nom fichier pr‚sent, - * ou examine [MODULE.LIB] + * Searches for all ref *.??? if offering their file name, + * or reviews [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 ) ) diff --git a/cvpcb/loadcmp.cpp b/cvpcb/loadcmp.cpp index c44856c803..13eebe9fd3 100644 --- a/cvpcb/loadcmp.cpp +++ b/cvpcb/loadcmp.cpp @@ -1,6 +1,6 @@ -/***************************************************/ -/* 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; diff --git a/cvpcb/menucfg.cpp b/cvpcb/menucfg.cpp index fdf92d2b6c..2460fbf8ee 100644 --- a/cvpcb/menucfg.cpp +++ b/cvpcb/menucfg.cpp @@ -1,5 +1,5 @@ /***************************************/ -/* 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 ); } diff --git a/cvpcb/protos.h b/cvpcb/protos.h index b5df8b6715..e1adb4c35b 100644 --- a/cvpcb/protos.h +++ b/cvpcb/protos.h @@ -1,6 +1,6 @@ - /**************************************/ - /** 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 diff --git a/cvpcb/readschematicnetlist.cpp b/cvpcb/readschematicnetlist.cpp index 2b9e7bb2c7..f6db8441bd 100644 --- a/cvpcb/readschematicnetlist.cpp +++ b/cvpcb/readschematicnetlist.cpp @@ -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] == ' ' ) diff --git a/cvpcb/savecmp.cpp b/cvpcb/savecmp.cpp index f1e1fe6115..d30fd4631d 100644 --- a/cvpcb/savecmp.cpp +++ b/cvpcb/savecmp.cpp @@ -1,8 +1,6 @@ -/**************/ -/* 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; } } diff --git a/cvpcb/setvisu.cpp b/cvpcb/setvisu.cpp index 18cb25342e..64d1b3641c 100644 --- a/cvpcb/setvisu.cpp +++ b/cvpcb/setvisu.cpp @@ -1,6 +1,6 @@ -/*********************************************************************/ -/** 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 * 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" diff --git a/cvpcb/tool_cvpcb.cpp b/cvpcb/tool_cvpcb.cpp index abd5198165..091b7dc8c6 100644 --- a/cvpcb/tool_cvpcb.cpp +++ b/cvpcb/tool_cvpcb.cpp @@ -1,6 +1,6 @@ -/***************************************************/ -/* 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, diff --git a/cvpcb/writenetlistpcbnew.cpp b/cvpcb/writenetlistpcbnew.cpp index 5cdd1adea3..fa6a48017c 100644 --- a/cvpcb/writenetlistpcbnew.cpp +++ b/cvpcb/writenetlistpcbnew.cpp @@ -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;