add and translate some comments. fixed a problem in modedit (delete module in lib not working)
This commit is contained in:
parent
71ca194b68
commit
9efbf02042
|
@ -8,7 +8,7 @@
|
|||
#include "appl_wxstruct.h"
|
||||
|
||||
|
||||
#define BUILD_VERSION wxT("(20090325-unstable)")
|
||||
#define BUILD_VERSION wxT("(20090406-unstable)")
|
||||
|
||||
wxString g_BuildVersion
|
||||
|
||||
|
|
|
@ -252,14 +252,32 @@ public:
|
|||
|
||||
|
||||
// loading footprints
|
||||
MODULE* Get_Librairie_Module( wxWindow* winaff,
|
||||
const wxString& library,
|
||||
const wxString& ModuleName,
|
||||
bool show_msg_err );
|
||||
/** function Get_Librairie_Module
|
||||
*
|
||||
* Read active libraries or one library to find and load a given module
|
||||
* If found the lodule is linked to the tail of linked list of modules
|
||||
* @param aLibrary: the full filename of the library to read. If empty, all active libraries are read
|
||||
* @param aModuleName = module name to load
|
||||
* @param aDisplayMessageError = true to display an error message if any.
|
||||
* @return a MODULE * pointer to the new module, or NULL
|
||||
*
|
||||
*/
|
||||
MODULE* Get_Librairie_Module( const wxString& aLibraryFullFilename,
|
||||
const wxString& aModuleName,
|
||||
bool aDisplayMessageError );
|
||||
|
||||
/** Function Select_1_Module_From_List
|
||||
* Display a list of modules found in active libraries or a given library
|
||||
* @param aLibraryFullFilename = library to list (if aLibraryFullFilename == void, list all modules)
|
||||
* @param aMask = Display filter (wildcart)( Mask = wxEmptyString if not used )
|
||||
* @param aKeyWord = keyword list, to display a filtered list of module having one (or more) of these keyworks in their keywork list
|
||||
* ( aKeyWord = wxEmptyString if not used )
|
||||
*
|
||||
* @return wxEmptyString if abort or fails, or the selected module name if Ok
|
||||
*/
|
||||
wxString Select_1_Module_From_List(
|
||||
WinEDA_DrawFrame* active_window, const wxString& Library,
|
||||
const wxString& Mask, const wxString& KeyWord );
|
||||
WinEDA_DrawFrame* active_window, const wxString& aLibraryFullFilename,
|
||||
const wxString& aMask, const wxString& aKeyWord );
|
||||
|
||||
MODULE* Load_Module_From_Library( const wxString& library, wxDC* DC );
|
||||
|
||||
|
|
Binary file not shown.
9255
internat/fr/kicad.po
9255
internat/fr/kicad.po
File diff suppressed because it is too large
Load Diff
|
@ -213,7 +213,7 @@ void WinEDA_ModuleEditFrame::Export_Module( MODULE* ptmod, bool createlib )
|
|||
|
||||
/**********************************************************/
|
||||
void WinEDA_ModuleEditFrame::Delete_Module_In_Library( const
|
||||
wxString& libname )
|
||||
wxString& aLibname )
|
||||
/**********************************************************/
|
||||
{
|
||||
wxFileName newFileName;
|
||||
|
@ -224,17 +224,17 @@ void WinEDA_ModuleEditFrame::Delete_Module_In_Library( const
|
|||
wxString CmpName, msg;
|
||||
|
||||
/* Demande du nom du composant a supprimer */
|
||||
CmpName = Select_1_Module_From_List( this, libname, wxEmptyString, wxEmptyString );
|
||||
CmpName = Select_1_Module_From_List( this, aLibname, wxEmptyString, wxEmptyString );
|
||||
if( CmpName == wxEmptyString )
|
||||
return;
|
||||
|
||||
/* Confirmation */
|
||||
msg.Printf( _( "Ok to delete module %s in library %s" ),
|
||||
CmpName.GetData(), libname.GetData() );
|
||||
CmpName.GetData(), aLibname.GetData() );
|
||||
if( !IsOK( this, msg ) )
|
||||
return;
|
||||
|
||||
oldFileName = libname;
|
||||
oldFileName = aLibname;
|
||||
|
||||
if( ( lib_module = wxFopen( oldFileName.GetFullPath(),
|
||||
wxT( "rt" ) ) ) == NULL )
|
||||
|
|
|
@ -133,7 +133,7 @@ MODULE* WinEDA_BasePcbFrame::Load_Module_From_Library( const wxString& library,
|
|||
}
|
||||
}
|
||||
|
||||
module = Get_Librairie_Module( this, library, ModuleName, FALSE );
|
||||
module = Get_Librairie_Module( library, ModuleName, FALSE );
|
||||
|
||||
if( (module == NULL) && AllowWildSeach ) /* Attemp to search with wildcard */
|
||||
{
|
||||
|
@ -147,7 +147,7 @@ MODULE* WinEDA_BasePcbFrame::Load_Module_From_Library( const wxString& library,
|
|||
return NULL; /* annulation de commande */
|
||||
}
|
||||
else
|
||||
module = Get_Librairie_Module( this, library, ModuleName, TRUE );
|
||||
module = Get_Librairie_Module( library, ModuleName, TRUE );
|
||||
}
|
||||
|
||||
GetScreen()->m_Curseur = curspos;
|
||||
|
@ -170,21 +170,19 @@ MODULE* WinEDA_BasePcbFrame::Load_Module_From_Library( const wxString& library,
|
|||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
/** function Get_Librairie_Module
|
||||
*
|
||||
* 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.
|
||||
* Read active libraries or one library to find and load a given module
|
||||
* If found the lodule is linked to the tail of linked list of modules
|
||||
* @param aLibrary: the full filename of the library to read. If empty, all active libraries are read
|
||||
* @param aModuleName = module name to load
|
||||
* @param aDisplayMessageError = true to display an error message if any.
|
||||
* @return a MODULE * pointer to the new module, or NULL
|
||||
*
|
||||
*****************************************************************************/
|
||||
MODULE* WinEDA_BasePcbFrame::Get_Librairie_Module( wxWindow* winaff,
|
||||
const wxString& library,
|
||||
const wxString& ModuleName,
|
||||
bool show_msg_err )
|
||||
*/
|
||||
MODULE* WinEDA_BasePcbFrame::Get_Librairie_Module( const wxString& aLibraryFullFilename,
|
||||
const wxString& aModuleName,
|
||||
bool aDisplayMessageError )
|
||||
{
|
||||
int LineNum, Found = 0;
|
||||
wxFileName fn;
|
||||
|
@ -194,11 +192,14 @@ MODULE* WinEDA_BasePcbFrame::Get_Librairie_Module( wxWindow* winaff,
|
|||
MODULE* NewModule;
|
||||
FILE* file = NULL;
|
||||
unsigned ii;
|
||||
bool one_lib = aLibraryFullFilename.IsEmpty() ? false : true;
|
||||
|
||||
for( ii = 0; ii < g_LibName_List.GetCount(); ii++ )
|
||||
{
|
||||
fn = wxFileName( wxEmptyString, g_LibName_List[ii],
|
||||
ModuleFileExtension );
|
||||
if ( one_lib )
|
||||
fn = aLibraryFullFilename;
|
||||
else
|
||||
fn = wxFileName( wxEmptyString, g_LibName_List[ii], ModuleFileExtension );
|
||||
|
||||
tmp = wxGetApp().GetLibraryPathList().FindValidPath( fn.GetFullName() );
|
||||
|
||||
|
@ -253,7 +254,7 @@ MODULE* WinEDA_BasePcbFrame::Get_Librairie_Module( wxWindow* winaff,
|
|||
break;
|
||||
StrPurge( Line );
|
||||
msg = CONV_FROM_UTF8( Line );
|
||||
if( msg.CmpNoCase( ModuleName ) == 0 )
|
||||
if( msg.CmpNoCase( aModuleName ) == 0 )
|
||||
{
|
||||
Found = 1;
|
||||
break; /* Trouve! */
|
||||
|
@ -274,7 +275,7 @@ MODULE* WinEDA_BasePcbFrame::Get_Librairie_Module( wxWindow* winaff,
|
|||
/* Lecture du nom du composant */
|
||||
Name = CONV_FROM_UTF8( Line + 8 );
|
||||
|
||||
if( Name.CmpNoCase( ModuleName ) == 0 ) /* composant localise */
|
||||
if( Name.CmpNoCase( aModuleName ) == 0 ) /* composant localise */
|
||||
{
|
||||
NewModule = new MODULE( GetBoard() );
|
||||
|
||||
|
@ -291,12 +292,15 @@ MODULE* WinEDA_BasePcbFrame::Get_Librairie_Module( wxWindow* winaff,
|
|||
}
|
||||
|
||||
fclose( file );
|
||||
if ( one_lib )
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if( show_msg_err )
|
||||
if( aDisplayMessageError )
|
||||
{
|
||||
msg.Printf( _( "Module <%s> not found" ), ModuleName.c_str() );
|
||||
DisplayError( winaff, msg );
|
||||
msg.Printf( _( "Module <%s> not found" ), aModuleName.c_str() );
|
||||
DisplayError( NULL, msg );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
@ -306,19 +310,18 @@ MODULE* WinEDA_BasePcbFrame::Get_Librairie_Module( wxWindow* winaff,
|
|||
/***************************************************************/
|
||||
wxString WinEDA_BasePcbFrame::Select_1_Module_From_List(
|
||||
WinEDA_DrawFrame* active_window,
|
||||
const wxString& Library,
|
||||
const wxString& Mask, const wxString& KeyWord )
|
||||
const wxString& aLibraryFullFilename,
|
||||
const wxString& aMask, const wxString& aKeyWord )
|
||||
/***************************************************************/
|
||||
|
||||
/*
|
||||
* Affiche la liste des modules des librairies
|
||||
* Recherche dans la librairie Library ou generale si Library == NULL
|
||||
* Mask = Filtre d'affichage( Mask = wxEmptyString pour listage non filtré )
|
||||
* KeyWord = Liste de mots cles, Recherche limitee aux composants
|
||||
* ayant ces mots cles ( KeyWord = wxEmptyString pour listage de tous les modules )
|
||||
/** Function Select_1_Module_From_List
|
||||
* Display a list of modules found in active libraries or a given library
|
||||
* @param aLibraryFullFilename = library to list (if aLibraryFullFilename == void, list all modules)
|
||||
* @param aMask = Display filter (wildcart)( Mask = wxEmptyString if not used )
|
||||
* @param aKeyWord = keyword list, to display a filtered list of module having one (or more) of these keyworks in their keywork list
|
||||
* ( aKeyWord = wxEmptyString if not used )
|
||||
*
|
||||
* retourne wxEmptyString si abort ou probleme
|
||||
* ou le nom du module
|
||||
* @return wxEmptyString if abort or fails, or the selected module name if Ok
|
||||
*/
|
||||
{
|
||||
int LineNum;
|
||||
|
@ -341,14 +344,13 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List(
|
|||
for( ii = 0; ii < g_LibName_List.GetCount(); ii++ )
|
||||
{
|
||||
/* Calcul du nom complet de la librairie */
|
||||
if( Library.IsEmpty() )
|
||||
if( aLibraryFullFilename.IsEmpty() )
|
||||
{
|
||||
fn = wxFileName( wxEmptyString, g_LibName_List[ii],
|
||||
ModuleFileExtension );
|
||||
}
|
||||
else
|
||||
fn = wxFileName( wxEmptyString, Library, ModuleFileExtension );
|
||||
|
||||
fn = aLibraryFullFilename;
|
||||
|
||||
tmp = wxGetApp().GetLibraryPathList().FindValidPath( fn.GetFullName() );
|
||||
|
||||
|
@ -363,10 +365,10 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List(
|
|||
|
||||
ReadDocLib( tmp );
|
||||
|
||||
if( !KeyWord.IsEmpty() ) /* Inutile de lire la librairie si selection
|
||||
if( !aKeyWord.IsEmpty() ) /* Inutile de lire la librairie si selection
|
||||
* par mots cles, deja lus */
|
||||
{
|
||||
if( !Library.IsEmpty() )
|
||||
if( !aLibraryFullFilename.IsEmpty() )
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
|
@ -375,7 +377,7 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List(
|
|||
|
||||
if( file == NULL )
|
||||
{
|
||||
if( !Library.IsEmpty() )
|
||||
if( !aLibraryFullFilename.IsEmpty() )
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
|
@ -413,12 +415,12 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List(
|
|||
break;
|
||||
strupper( Line );
|
||||
msg = CONV_FROM_UTF8( StrPurge( Line ) );
|
||||
if( Mask.IsEmpty() )
|
||||
if( aMask.IsEmpty() )
|
||||
{
|
||||
ListBox->Append( msg );
|
||||
NbModules++;
|
||||
}
|
||||
else if( WildCompareString( Mask, msg, FALSE ) )
|
||||
else if( WildCompareString( aMask, msg, FALSE ) )
|
||||
{
|
||||
ListBox->Append( msg );
|
||||
NbModules++;
|
||||
|
@ -431,17 +433,17 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List(
|
|||
fclose( file );
|
||||
file = NULL;
|
||||
|
||||
if( !Library.IsEmpty() )
|
||||
if( !aLibraryFullFilename.IsEmpty() )
|
||||
break;
|
||||
}
|
||||
|
||||
/* creation de la liste des modules si recherche par mots-cles */
|
||||
if( !KeyWord.IsEmpty() )
|
||||
if( !aKeyWord.IsEmpty() )
|
||||
{
|
||||
ModList* ItemMod = MList;
|
||||
while( ItemMod != NULL )
|
||||
{
|
||||
if( KeyWordOk( KeyWord, ItemMod->m_KeyWord ) )
|
||||
if( KeyWordOk( aKeyWord, ItemMod->m_KeyWord ) )
|
||||
{
|
||||
NbModules++;
|
||||
ListBox->Append( ItemMod->m_Name );
|
||||
|
|
|
@ -69,7 +69,6 @@ BOARD_ITEM* WinEDA_ModuleEditFrame::ModeditLocateAndDisplay( int aHotKeyCode )
|
|||
item = (*m_Collector)[0];
|
||||
SetCurItem( item );
|
||||
}
|
||||
|
||||
else // we can't figure out which item user wants, do popup menu so user can choose
|
||||
{
|
||||
wxMenu itemMenu;
|
||||
|
@ -122,7 +121,6 @@ BOARD_ITEM* WinEDA_ModuleEditFrame::ModeditLocateAndDisplay( int aHotKeyCode )
|
|||
}
|
||||
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||
/****************************************************************************/
|
||||
|
@ -205,10 +203,10 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
{
|
||||
wxFileName fn = wxFileName( wxEmptyString, m_CurrentLib,
|
||||
ModuleFileExtension );
|
||||
wxString tmp =
|
||||
wxString full_libraryfilename =
|
||||
wxGetApp().GetLibraryPathList().FindValidPath( fn.GetFullName() );
|
||||
if( wxFileName::FileExists( tmp ) )
|
||||
Delete_Module_In_Library( tmp );
|
||||
if( wxFileName::FileExists( full_libraryfilename ) )
|
||||
Delete_Module_In_Library( full_libraryfilename );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -346,11 +344,21 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
break;
|
||||
|
||||
case ID_MODEDIT_LOAD_MODULE:
|
||||
{
|
||||
wxString full_libraryfilename;
|
||||
if( !m_CurrentLib.IsEmpty() )
|
||||
{
|
||||
wxFileName fn = wxFileName( wxEmptyString, m_CurrentLib,
|
||||
ModuleFileExtension );
|
||||
full_libraryfilename =
|
||||
wxGetApp().GetLibraryPathList().FindValidPath( fn.GetFullName() );
|
||||
}
|
||||
GetScreen()->ClearUndoRedoList();
|
||||
SetCurItem( NULL );
|
||||
Clear_Pcb( true );
|
||||
GetScreen()->m_Curseur = wxPoint( 0, 0 );
|
||||
Load_Module_From_Library( m_CurrentLib, &dc );
|
||||
Load_Module_From_Library( full_libraryfilename, &dc );
|
||||
}
|
||||
if( GetBoard()->m_Modules )
|
||||
GetBoard()->m_Modules->m_Flags = 0;
|
||||
|
||||
|
|
|
@ -491,7 +491,7 @@ MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
|
|||
if( aChangeFootprint )
|
||||
{
|
||||
MODULE* NewModule =
|
||||
aFrame->Get_Librairie_Module( NULL, wxEmptyString, NameLibCmp, TRUE );
|
||||
aFrame->Get_Librairie_Module( wxEmptyString, NameLibCmp, TRUE );
|
||||
if( NewModule ) /* Nouveau module trouve : changement de module */
|
||||
Module = aFrame->Exchange_Module( NULL, Module, NewModule );
|
||||
}
|
||||
|
@ -1036,7 +1036,7 @@ void LoadListeModules( WinEDA_PcbFrame* aPcbFrame, wxDC* DC )
|
|||
if( (ii == 0) || ( ref->m_LibName != cmp->m_LibName) )
|
||||
{
|
||||
/* New footprint : must be loaded from a library */
|
||||
Module = aPcbFrame->Get_Librairie_Module( NULL, wxEmptyString, cmp->m_LibName, FALSE );
|
||||
Module = aPcbFrame->Get_Librairie_Module( wxEmptyString, cmp->m_LibName, FALSE );
|
||||
ref = cmp;
|
||||
if( Module == NULL )
|
||||
{
|
||||
|
|
|
@ -494,7 +494,7 @@ MODULE* WinEDA_ExchangeModuleFrame::Change_1_Module( MODULE* Module,
|
|||
|
||||
namecmp.Trim( TRUE );
|
||||
namecmp.Trim( FALSE );
|
||||
NewModule = m_Parent->Get_Librairie_Module( this, wxEmptyString, namecmp, ShowError );
|
||||
NewModule = m_Parent->Get_Librairie_Module( wxEmptyString, namecmp, ShowError );
|
||||
if( NewModule == NULL ) /* Nouveau module NON trouve, reaffichage de l'ancien */
|
||||
{
|
||||
m_WinMsg->WriteText( wxT( "No\n" ) );
|
||||
|
|
Loading…
Reference in New Issue