CVPcb code refactoring, global variable elimination, and UI updates.
* Add methods to read and write project file parameters using dynamically defined list. * Remove all global variables defined in CVPcb code. * Dynamically define project file settings so class member variables can be used. * Separate reading and writing application settings from project file settings. * Make application UI objects and dialogs respect system UI font. * Remove non-standard widget colors from CVPcb dialogs. * Changed CVPcb object link list implementation to use wxList. * Changed project library and path dialog to make OK button save project file instead of confusing "Save Cfg" button. * Eliminate some duplicate file wildcard and extension definitions. * The usual code reformatting, commenting, and spelling fixes.
This commit is contained in:
parent
bd3b4baa32
commit
aa51c05dc6
|
@ -53,6 +53,7 @@ const wxString SchematicFileExtension( wxT( "sch" ) );
|
|||
const wxString BoardFileExtension( wxT( "brd" ) );
|
||||
const wxString NetlistFileExtension( wxT( "net" ) );
|
||||
const wxString GerberFileExtension( wxT( "pho" ) );
|
||||
const wxString PdfFileExtension( wxT( "pdf" ) );
|
||||
|
||||
/* Proper wxFileDialog wild card definitions. */
|
||||
const wxString ProjectFileWildcard( _( "Kicad project files (*.pro)|*.pro" ) );
|
||||
|
@ -60,6 +61,7 @@ const wxString BoardFileWildcard( _( "Kicad PCB files (*.brd)|*.brd") );
|
|||
const wxString SchematicFileWildcard( _( "Kicad schematic files (*.sch)|*.sch" ) );
|
||||
const wxString NetlistFileWildcard( _( "Kicad netlist files (*.net)|*.net" ) );
|
||||
const wxString GerberFileWildcard( _( "Gerber files (*.pho)|*.pho" ) );
|
||||
const wxString PdfFileWildcard( _( "Portable document format files (*.pdf)|*.pdf" ) );
|
||||
const wxString AllFilesWildcard( _( "All files (*)|*") );
|
||||
|
||||
|
||||
|
|
|
@ -149,7 +149,7 @@ bool GetAssociatedDocument( wxFrame* aFrame,
|
|||
if( !wxFileExists( fullfilename ) )
|
||||
{
|
||||
msg = _( "Doc File " );
|
||||
msg << wxT("\"") << fullfilename << wxT("\"") << _( " not found" );
|
||||
msg << wxT("\"") << aDocName << wxT("\"") << _( " not found" );
|
||||
DisplayError( aFrame, msg );
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -179,6 +179,62 @@ void WinEDA_App::WriteProjectConfig( const wxString& fileName,
|
|||
m_ProjectConfig = NULL;
|
||||
}
|
||||
|
||||
|
||||
void WinEDA_App::WriteProjectConfig( const wxString& fileName,
|
||||
const wxString& GroupName,
|
||||
const PARAM_CFG_ARRAY& params )
|
||||
{
|
||||
PARAM_CFG_BASE* param;
|
||||
wxString msg;
|
||||
size_t i;
|
||||
|
||||
ReCreatePrjConfig( fileName, GroupName, FORCE_LOCAL_CONFIG );
|
||||
|
||||
/* Write date ( surtout pour eviter bug de wxFileConfig
|
||||
* qui se trompe de rubrique si declaration [xx] en premiere ligne
|
||||
* (en fait si groupe vide) */
|
||||
m_ProjectConfig->SetPath( wxCONFIG_PATH_SEPARATOR );
|
||||
|
||||
msg = DateAndTime();
|
||||
m_ProjectConfig->Write( wxT( "update" ), msg );
|
||||
|
||||
msg = GetAppName();
|
||||
m_ProjectConfig->Write( wxT( "last_client" ), msg );
|
||||
|
||||
/* Save parameters */
|
||||
m_ProjectConfig->DeleteGroup( GroupName ); // Erase all datas
|
||||
m_ProjectConfig->Flush();
|
||||
|
||||
m_ProjectConfig->SetPath( GroupName );
|
||||
m_ProjectConfig->Write( wxT( "version" ), CONFIG_VERSION );
|
||||
m_ProjectConfig->SetPath( wxCONFIG_PATH_SEPARATOR );
|
||||
|
||||
for( i = 0; i < params.GetCount(); i++ )
|
||||
{
|
||||
param = ¶ms[i];
|
||||
if( param->m_Group )
|
||||
m_ProjectConfig->SetPath( param->m_Group );
|
||||
else
|
||||
m_ProjectConfig->SetPath( GroupName );
|
||||
|
||||
if( param->m_Setup )
|
||||
continue;
|
||||
|
||||
if ( param->m_Type == PARAM_COMMAND_ERASE ) // Erase all data
|
||||
{
|
||||
if( param->m_Ident )
|
||||
m_ProjectConfig->DeleteGroup( param->m_Ident );
|
||||
}
|
||||
else
|
||||
param->SaveParam( m_ProjectConfig );
|
||||
}
|
||||
|
||||
m_ProjectConfig->SetPath( UNIX_STRING_DIR_SEP );
|
||||
delete m_ProjectConfig;
|
||||
m_ProjectConfig = NULL;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************/
|
||||
void WinEDA_App::SaveCurrentSetupValues( PARAM_CFG_BASE** aList )
|
||||
/*****************************************************************/
|
||||
|
@ -277,6 +333,60 @@ bool WinEDA_App::ReadProjectConfig( const wxString& local_config_filename,
|
|||
}
|
||||
|
||||
|
||||
bool WinEDA_App::ReadProjectConfig( const wxString& local_config_filename,
|
||||
const wxString& GroupName,
|
||||
const PARAM_CFG_ARRAY& params,
|
||||
bool Load_Only_if_New )
|
||||
{
|
||||
size_t i;
|
||||
PARAM_CFG_BASE* param;
|
||||
wxString timestamp;
|
||||
|
||||
ReCreatePrjConfig( local_config_filename, GroupName, false );
|
||||
|
||||
m_ProjectConfig->SetPath( wxCONFIG_PATH_SEPARATOR );
|
||||
timestamp = m_ProjectConfig->Read( wxT( "update" ) );
|
||||
if( Load_Only_if_New && ( !timestamp.IsEmpty() )
|
||||
&& (timestamp == m_CurrentOptionFileDateAndTime) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_CurrentOptionFileDateAndTime = timestamp;
|
||||
|
||||
if( !g_Prj_Default_Config_FullFilename.IsEmpty() )
|
||||
m_CurrentOptionFile = g_Prj_Default_Config_FullFilename;
|
||||
else
|
||||
{
|
||||
if( wxPathOnly( g_Prj_Config_LocalFilename ).IsEmpty() )
|
||||
m_CurrentOptionFile = wxGetCwd() + STRING_DIR_SEP +
|
||||
g_Prj_Config_LocalFilename;
|
||||
else
|
||||
m_CurrentOptionFile = g_Prj_Config_LocalFilename;
|
||||
}
|
||||
|
||||
for( i = 0; i < params.GetCount(); i++ )
|
||||
{
|
||||
param = ¶ms[i];
|
||||
|
||||
if( param->m_Group )
|
||||
m_ProjectConfig->SetPath( param->m_Group );
|
||||
else
|
||||
m_ProjectConfig->SetPath( GroupName );
|
||||
|
||||
if( param->m_Setup )
|
||||
continue;
|
||||
|
||||
param->ReadParam( m_ProjectConfig );
|
||||
}
|
||||
|
||||
delete m_ProjectConfig;
|
||||
m_ProjectConfig = NULL;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************/
|
||||
void WinEDA_App::ReadCurrentSetupValues( PARAM_CFG_BASE** aList )
|
||||
/***************************************************************/
|
||||
|
|
|
@ -26,7 +26,6 @@ WinEDA_EnterText::WinEDA_EnterText( wxWindow* parent,
|
|||
|
||||
m_Title = new wxStaticText( parent, -1, Title );
|
||||
|
||||
m_Title->SetForegroundColour( wxColour( 200, 0, 0 ) );
|
||||
BoxSizer->Add( m_Title, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE, 5 );
|
||||
|
||||
m_FrameText = new wxTextCtrl( parent, -1, TextToEdit, wxDefaultPosition, Size );
|
||||
|
|
|
@ -21,7 +21,6 @@ set(CVPCB_SRCS
|
|||
listboxes.cpp
|
||||
listlib.cpp
|
||||
loadcmp.cpp
|
||||
memoire.cpp
|
||||
menucfg.cpp
|
||||
readschematicnetlist.cpp
|
||||
savecmp.cpp
|
||||
|
@ -29,17 +28,6 @@ set(CVPCB_SRCS
|
|||
tool_cvpcb.cpp
|
||||
writenetlistpcbnew.cpp)
|
||||
|
||||
set(CVPCB_EXTRA_SRCS
|
||||
# ../pcbnew/class_board_item.cpp
|
||||
# ../pcbnew/class_drawsegment.cpp
|
||||
# ../pcbnew/class_edge_mod.cpp
|
||||
# ../pcbnew/class_equipot.cpp
|
||||
# ../pcbnew/class_module.cpp
|
||||
# ../pcbnew/class_text_mod.cpp
|
||||
../pcbnew/ioascii.cpp
|
||||
# ../pcbnew/tracemod.cpp
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
if(MINGW)
|
||||
# CVPCB_RESOURCES variable is set by the macro.
|
||||
|
@ -58,7 +46,7 @@ if(APPLE)
|
|||
set(MACOSX_BUNDLE_NAME cvpcb)
|
||||
endif(APPLE)
|
||||
|
||||
add_executable(cvpcb WIN32 MACOSX_BUNDLE ${CVPCB_SRCS} ${CVPCB_EXTRA_SRCS} ${CVPCB_RESOURCES})
|
||||
add_executable(cvpcb WIN32 MACOSX_BUNDLE ${CVPCB_SRCS} ${CVPCB_RESOURCES})
|
||||
|
||||
target_link_libraries(cvpcb 3d-viewer common pcbcommon polygon bitmaps kbool ${OPENGL_LIBRARIES} ${wxWidgets_LIBRARIES})
|
||||
|
||||
|
|
|
@ -29,40 +29,66 @@ public:
|
|||
};
|
||||
|
||||
|
||||
/* routines locales : */
|
||||
static int auto_select( WinEDA_CvpcbFrame* frame,
|
||||
STORECMP* Cmp,
|
||||
AUTOMODULE* BaseListeMod );
|
||||
static char * ReadQuotedText(wxString & aTarget, char * aText);
|
||||
/*
|
||||
* read the string between quotes and put it in aTarget
|
||||
* put text in aTarget
|
||||
* return a pointer to the last read char (the second quote if Ok)
|
||||
*/
|
||||
char * ReadQuotedText(wxString & aTarget, char * aText)
|
||||
{
|
||||
// search the first quote:
|
||||
for( ; *aText != 0; aText++ )
|
||||
{
|
||||
if( *aText == QUOTE )
|
||||
break;
|
||||
}
|
||||
|
||||
/*************************************************************/
|
||||
void WinEDA_CvpcbFrame::AssocieModule( wxCommandEvent& event )
|
||||
/*************************************************************/
|
||||
if ( *aText == 0 )
|
||||
return NULL;
|
||||
|
||||
/* Called by the automatic association button
|
||||
* Read *.equ files to try to find acorresponding footprint
|
||||
* for each component that is not already linked to a footprint ( a "free" component )
|
||||
aText++;
|
||||
for(; *aText != 0; aText++ )
|
||||
{
|
||||
if( *aText == QUOTE )
|
||||
break;
|
||||
aTarget.Append(*aText);
|
||||
}
|
||||
|
||||
return aText;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Called by the automatic association button
|
||||
* Read *.equ files to try to find corresponding footprint
|
||||
* for each component that is not already linked to a footprint ( a "free"
|
||||
* component )
|
||||
* format of a line:
|
||||
* 'cmp_ref' 'footprint_name'
|
||||
*/
|
||||
void WinEDA_CvpcbFrame::AssocieModule( wxCommandEvent& event )
|
||||
{
|
||||
COMPONENT_LIST::iterator iCmp;
|
||||
FOOTPRINT_LIST::iterator iFp;
|
||||
wxFileName fn;
|
||||
wxString msg, tmp;
|
||||
char Line[1024];
|
||||
FILE* file;
|
||||
AUTOMODULE* ItemModule, * NextMod;
|
||||
AUTOMODULE* BaseListeMod = NULL;
|
||||
STORECMP* Component;
|
||||
COMPONENT* Component;
|
||||
FOOTPRINT* footprint;
|
||||
size_t ii;
|
||||
int nb_correspondances = 0;
|
||||
|
||||
if( nbcomp <= 0 )
|
||||
if( m_components.empty() )
|
||||
return;
|
||||
|
||||
/* recherche des equivalences a travers les fichiers possibles */
|
||||
for( unsigned ii = 0; ii < g_ListName_Equ.GetCount(); ii++ )
|
||||
for( ii = 0; ii < m_AliasLibNames.GetCount(); ii++ )
|
||||
{
|
||||
fn = g_ListName_Equ[ii];
|
||||
fn.SetExt( EquivFileExtension );
|
||||
fn = m_AliasLibNames[ii];
|
||||
fn.SetExt( FootprintAliasFileExtension );
|
||||
|
||||
tmp = wxGetApp().FindLibraryPath( fn );
|
||||
|
||||
|
@ -110,18 +136,41 @@ void WinEDA_CvpcbFrame::AssocieModule( wxCommandEvent& event )
|
|||
fclose( file );
|
||||
}
|
||||
|
||||
|
||||
/* display some info */
|
||||
msg.Printf( _( "%d equivalences" ), nb_correspondances );
|
||||
SetStatusText( msg, 0 );
|
||||
wxMessageBox(msg);
|
||||
|
||||
Component = g_BaseListeCmp;
|
||||
for( unsigned ii = 0; Component != NULL; Component = Component->Pnext, ii++ )
|
||||
for( iCmp = m_components.begin(); iCmp != m_components.end(); ++iCmp )
|
||||
{
|
||||
m_ListCmp->SetSelection( ii, TRUE );
|
||||
Component = *iCmp;
|
||||
m_ListCmp->SetSelection( m_components.IndexOf( Component ), TRUE );
|
||||
|
||||
if( Component->m_Module.IsEmpty() )
|
||||
auto_select( this, Component, BaseListeMod );
|
||||
{
|
||||
ItemModule = BaseListeMod;
|
||||
for( ; ItemModule != NULL; ItemModule = ItemModule->Pnext )
|
||||
{
|
||||
if( ItemModule->m_Name.CmpNoCase( Component->m_Valeur ) != 0 )
|
||||
continue;
|
||||
|
||||
for( iFp = m_footprints.begin(); iFp != m_footprints.end(); ++iFp )
|
||||
{
|
||||
footprint = *iFp;
|
||||
|
||||
if( ItemModule->m_LibName.CmpNoCase( footprint->m_Module ) == 0 )
|
||||
{
|
||||
SetNewPkg( footprint->m_Module );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
msg.Printf( _( "Component %s: Footprint %s not found in " \
|
||||
"libraries" ), Component->m_Valeur.GetData(),
|
||||
ItemModule->m_LibName.GetData() );
|
||||
DisplayError( this, msg, 10 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* free memory: */
|
||||
|
@ -133,77 +182,3 @@ void WinEDA_CvpcbFrame::AssocieModule( wxCommandEvent& event )
|
|||
|
||||
BaseListeMod = NULL;
|
||||
}
|
||||
|
||||
/***************************************************/
|
||||
char * ReadQuotedText(wxString & aTarget, char * aText)
|
||||
/***************************************************/
|
||||
/** read the string between quotes and put it in aTarget
|
||||
* put text in aTarget
|
||||
* return a pointer to the last read char (the second quote if Ok)
|
||||
*/
|
||||
{
|
||||
// search the first quote:
|
||||
for( ; *aText != 0; aText++ )
|
||||
{
|
||||
if( *aText == QUOTE )
|
||||
break;
|
||||
}
|
||||
|
||||
if ( *aText == 0 )
|
||||
return NULL;
|
||||
|
||||
aText++;
|
||||
for(; *aText != 0; aText++ )
|
||||
{
|
||||
if( *aText == QUOTE )
|
||||
break;
|
||||
aTarget.Append(*aText);
|
||||
}
|
||||
|
||||
return aText;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************/
|
||||
int auto_select( WinEDA_CvpcbFrame* frame, STORECMP* Cmp,
|
||||
AUTOMODULE* BaseListeMod )
|
||||
/****************************************************************/
|
||||
|
||||
/* associe automatiquement composant et Module
|
||||
* Retourne;
|
||||
* 0 si OK
|
||||
* 1 si module specifie non trouve en liste librairie
|
||||
* 2 si pas de module specifie dans la liste des equivalences
|
||||
*/
|
||||
{
|
||||
AUTOMODULE* ItemModule;
|
||||
STOREMOD* Module;
|
||||
wxString msg;
|
||||
|
||||
/* examen de la liste des correspondances */
|
||||
ItemModule = BaseListeMod;
|
||||
for( ; ItemModule != NULL; ItemModule = ItemModule->Pnext )
|
||||
{
|
||||
if( ItemModule->m_Name.CmpNoCase( Cmp->m_Valeur ) != 0 )
|
||||
continue;
|
||||
|
||||
/* Correspondance trouvee, recherche nom module dans la liste des
|
||||
* modules disponibles en librairie */
|
||||
Module = g_BaseListePkg;
|
||||
for( ; Module != NULL; Module = Module->Pnext )
|
||||
{
|
||||
if( ItemModule->m_LibName.CmpNoCase( Module->m_Module ) == 0 )
|
||||
{
|
||||
frame->SetNewPkg( Module->m_Module );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
msg.Printf( _( "Component %s: Footprint %s not found in libraries" ),
|
||||
Cmp->m_Valeur.GetData(), ItemModule->m_LibName.GetData() );
|
||||
DisplayError( frame, msg, 10 );
|
||||
return 2;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -8,74 +8,105 @@
|
|||
#include "appl_wxstruct.h"
|
||||
#include "common.h"
|
||||
#include "gestfich.h"
|
||||
#include "param_config.h"
|
||||
#include "cvpcb.h"
|
||||
#include "protos.h"
|
||||
#include "cvstruct.h"
|
||||
#include "cfg.h"
|
||||
|
||||
/* Routines Locales */
|
||||
/**/
|
||||
|
||||
|
||||
/**************************************************/
|
||||
void Read_Config( const wxString& FileName )
|
||||
/**************************************************/
|
||||
#define GROUP wxT("/cvpcb")
|
||||
#define GROUPLIB wxT("/pcbnew/libraries")
|
||||
#define GROUPEQU wxT("/cvpcb/libraries")
|
||||
|
||||
/* lit la configuration
|
||||
|
||||
/**
|
||||
* Return project file parameter list for CVPcb.
|
||||
*
|
||||
* Populate the project file parameter array specific to CVPcb if it hasn't
|
||||
* already been populated and return a reference to the array to the caller.
|
||||
* Creating the parameter list at run time has the advantage of being able
|
||||
* to define local variables. The old method of statically building the array
|
||||
* at compile time requiring global variable definitions.
|
||||
*/
|
||||
const PARAM_CFG_ARRAY& WinEDA_CvpcbFrame::GetProjectFileParameters( void )
|
||||
{
|
||||
if( !m_projectFileParams.IsEmpty() )
|
||||
return m_projectFileParams;
|
||||
|
||||
m_projectFileParams.Add( new PARAM_CFG_BASE( GROUPLIB,
|
||||
PARAM_COMMAND_ERASE ) );
|
||||
m_projectFileParams.Add( new PARAM_CFG_LIBNAME_LIST( wxT( "LibName" ),
|
||||
&m_ModuleLibNames,
|
||||
GROUPLIB ) );
|
||||
m_projectFileParams.Add( new PARAM_CFG_LIBNAME_LIST( wxT( "EquName" ),
|
||||
&m_AliasLibNames,
|
||||
GROUPEQU ) );
|
||||
m_projectFileParams.Add( new PARAM_CFG_WXSTRING( wxT( "NetIExt" ),
|
||||
&m_NetlistFileExtension ) );
|
||||
m_projectFileParams.Add( new PARAM_CFG_WXSTRING( wxT( "LibDir" ),
|
||||
&m_UserLibraryPath,
|
||||
GROUPLIB ) );
|
||||
|
||||
return m_projectFileParams;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
* Remarque:
|
||||
* le chemin de l'executable cvpcb.exe doit etre dans BinDir
|
||||
*
|
||||
*/
|
||||
void WinEDA_CvpcbFrame::LoadProjectFile( const wxString& FileName )
|
||||
{
|
||||
wxFileName fn = FileName;
|
||||
|
||||
/* Init des valeurs par defaut */
|
||||
g_LibName_List.Clear();
|
||||
g_ListName_Equ.Clear();
|
||||
m_ModuleLibNames.Clear();
|
||||
m_AliasLibNames.Clear();
|
||||
|
||||
if( fn.GetExt() != ProjectFileExtension )
|
||||
fn.SetExt( ProjectFileExtension );
|
||||
|
||||
wxGetApp().RemoveLibraryPath( g_UserLibDirBuffer );
|
||||
wxGetApp().RemoveLibraryPath( m_UserLibraryPath );
|
||||
|
||||
wxGetApp().ReadProjectConfig( fn.GetFullPath(),
|
||||
GROUP, ParamCfgList, FALSE );
|
||||
wxGetApp().ReadProjectConfig( fn.GetFullPath(), GROUP,
|
||||
GetProjectFileParameters(), FALSE );
|
||||
|
||||
if( g_NetlistFileExtension.IsEmpty() )
|
||||
g_NetlistFileExtension = wxT( "net" );
|
||||
if( m_NetlistFileExtension.IsEmpty() )
|
||||
m_NetlistFileExtension = wxT( "net" );
|
||||
|
||||
/* User library path takes precedent over default library search paths. */
|
||||
wxGetApp().InsertLibraryPath( g_UserLibDirBuffer, 1 );
|
||||
wxGetApp().InsertLibraryPath( m_UserLibraryPath, 1 );
|
||||
}
|
||||
|
||||
|
||||
/************************************************************/
|
||||
void WinEDA_CvpcbFrame::Update_Config( wxCommandEvent& event )
|
||||
/************************************************************/
|
||||
|
||||
/* fonction relai d'appel a Save_Config,
|
||||
* la vraie fonction de sauvegarde de la config
|
||||
*/
|
||||
void WinEDA_CvpcbFrame::Update_Config( wxCommandEvent& event )
|
||||
{
|
||||
Save_Config( this, m_NetlistFileName.GetFullPath() );
|
||||
SaveProjectFile( m_NetlistFileName.GetFullPath() );
|
||||
}
|
||||
|
||||
|
||||
void Save_Config( wxWindow* parent, const wxString& fileName )
|
||||
void WinEDA_CvpcbFrame::SaveProjectFile( const wxString& fileName )
|
||||
{
|
||||
wxFileName fn = fileName;
|
||||
|
||||
fn.SetExt( ProjectFileExtension );
|
||||
|
||||
wxFileDialog dlg( parent, _( "Save Project File" ), fn.GetPath(),
|
||||
wxFileDialog dlg( this, _( "Save Project File" ), fn.GetPath(),
|
||||
fn.GetFullName(), ProjectFileWildcard, wxFD_SAVE );
|
||||
|
||||
if( dlg.ShowModal() == wxID_CANCEL )
|
||||
return;
|
||||
|
||||
/* ecriture de la configuration */
|
||||
wxGetApp().WriteProjectConfig( dlg.GetPath(), GROUP, ParamCfgList );
|
||||
wxGetApp().WriteProjectConfig( dlg.GetPath(), GROUP,
|
||||
GetProjectFileParameters() );
|
||||
}
|
||||
|
|
130
cvpcb/cfg.h
130
cvpcb/cfg.h
|
@ -1,130 +0,0 @@
|
|||
/*******************************************************/
|
||||
/** cfg.h : configuration: definition des structures **/
|
||||
/*******************************************************/
|
||||
|
||||
#include "param_config.h"
|
||||
|
||||
#define INSETUP TRUE
|
||||
|
||||
#define GROUP wxT("/cvpcb")
|
||||
#define GROUPCOMMON wxT("/common")
|
||||
#define GROUPLIB wxT("/pcbnew/libraries")
|
||||
#define GROUPEQU wxT("/cvpcb/libraries")
|
||||
|
||||
/* Liste des parametres */
|
||||
|
||||
static PARAM_CFG_BASE CommandCfg
|
||||
(
|
||||
GROUPLIB, /* identification de groupe */
|
||||
PARAM_COMMAND_ERASE /* type */
|
||||
);
|
||||
|
||||
static PARAM_CFG_LIBNAME_LIST LibNameBufCfg
|
||||
(
|
||||
wxT("LibName"), /* identification */
|
||||
&g_LibName_List, /* Adresse du parametre */
|
||||
GROUPLIB
|
||||
);
|
||||
|
||||
static PARAM_CFG_LIBNAME_LIST EquivNameBufCfg
|
||||
(
|
||||
wxT("EquName"), /* identification */
|
||||
&g_ListName_Equ, /* Adresse du parametre */
|
||||
GROUPEQU
|
||||
);
|
||||
|
||||
static PARAM_CFG_WXSTRING NetInExtBufCfg
|
||||
(
|
||||
wxT("NetIExt"), /* identification */
|
||||
&g_NetlistFileExtension
|
||||
);
|
||||
|
||||
static PARAM_CFG_WXSTRING NetDirBufCfg
|
||||
(
|
||||
wxT("NetDir"), /* identification */
|
||||
&g_UserNetDirBuffer, /* Adresse du parametre */
|
||||
GROUPCOMMON
|
||||
);
|
||||
|
||||
static PARAM_CFG_WXSTRING UserLibDirBufCfg
|
||||
(
|
||||
wxT("LibDir"), /* identification */
|
||||
&g_UserLibDirBuffer, /* Adresse du parametre */
|
||||
GROUPLIB
|
||||
);
|
||||
|
||||
static PARAM_CFG_BOOL DisplayPadFillCfg
|
||||
(
|
||||
INSETUP,
|
||||
wxT("DiPadFi"), /* identification */
|
||||
&DisplayOpt.DisplayPadFill, /* Adresse du parametre */
|
||||
TRUE /* Valeur par defaut */
|
||||
);
|
||||
|
||||
static PARAM_CFG_BOOL DisplayPadNumCfg
|
||||
(
|
||||
INSETUP,
|
||||
wxT("DiPadNu"), /* identification */
|
||||
&DisplayOpt.DisplayPadNum, /* Adresse du parametre */
|
||||
TRUE /* Valeur par defaut */
|
||||
);
|
||||
|
||||
static PARAM_CFG_BOOL DisplayPadNoConnCfg
|
||||
(
|
||||
INSETUP,
|
||||
wxT("DiPadNC"), /* identification */
|
||||
&DisplayOpt.DisplayPadNoConn, /* Adresse du parametre */
|
||||
FALSE /* Valeur par defaut */
|
||||
);
|
||||
|
||||
static PARAM_CFG_BOOL DisplayPadIsolCfg
|
||||
(
|
||||
INSETUP,
|
||||
wxT("DiPadMg"), /* identification */
|
||||
&DisplayOpt.DisplayPadIsol, /* Adresse du parametre */
|
||||
FALSE /* Valeur par defaut */
|
||||
);
|
||||
|
||||
static PARAM_CFG_INT DisplayModEdgeCfg
|
||||
(
|
||||
INSETUP,
|
||||
wxT("DiModEd"), /* identification */
|
||||
&DisplayOpt.DisplayModEdge, /* Adresse du parametre */
|
||||
1, /* Valeur par defaut */
|
||||
0, 1 /* Valeurs extremes */
|
||||
);
|
||||
|
||||
static PARAM_CFG_INT DisplayModTextCfg
|
||||
(
|
||||
INSETUP,
|
||||
wxT("DiModTx"), /* identification */
|
||||
&DisplayOpt.DisplayModText, /* Adresse du parametre */
|
||||
1, /* Valeur par defaut */
|
||||
0, 1 /* Valeurs extremes */
|
||||
);
|
||||
|
||||
static PARAM_CFG_BOOL DisplayPcbTrackFillCfg
|
||||
(
|
||||
INSETUP,
|
||||
wxT("DiPcbTF"), /* identification */
|
||||
&DisplayOpt.DisplayPcbTrackFill, /* Adresse du parametre */
|
||||
TRUE /* Valeur par defaut */
|
||||
);
|
||||
|
||||
static PARAM_CFG_BASE * ParamCfgList[] =
|
||||
{
|
||||
& CommandCfg,
|
||||
& NetInExtBufCfg,
|
||||
& NetDirBufCfg,
|
||||
& UserLibDirBufCfg,
|
||||
& LibNameBufCfg,
|
||||
& EquivNameBufCfg,
|
||||
& DisplayPadFillCfg,
|
||||
& DisplayPadNumCfg,
|
||||
& DisplayPadNoConnCfg,
|
||||
& DisplayPadIsolCfg,
|
||||
& DisplayModEdgeCfg,
|
||||
& DisplayModTextCfg,
|
||||
& DisplayPcbTrackFillCfg,
|
||||
NULL
|
||||
};
|
|
@ -2,58 +2,73 @@
|
|||
/* class_cvpcb.cpp */
|
||||
/*******************/
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
// for all others, include the necessary headers (this file is usually all you
|
||||
// need because it includes almost all "standard" wxWindows headers
|
||||
#ifndef WX_PRECOMP
|
||||
#include <wx/wx.h>
|
||||
#endif
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "common.h"
|
||||
#include "kicad_string.h"
|
||||
|
||||
#include "cvpcb.h"
|
||||
|
||||
STORECMP::STORECMP()
|
||||
#include <wx/listimpl.cpp>
|
||||
|
||||
|
||||
WX_DEFINE_LIST( PIN_LIST );
|
||||
|
||||
PIN::PIN()
|
||||
{
|
||||
Pnext = Pback = NULL;
|
||||
m_Type = STRUCT_COMPONENT;
|
||||
m_Pins = NULL;
|
||||
m_Num = 0;
|
||||
m_Multi = 0;
|
||||
m_Index = 0; /* variable utilisee selon types de netlistes */
|
||||
m_PinType = 0; /* code type electrique ( Entree Sortie Passive..) */
|
||||
}
|
||||
|
||||
STORECMP::~STORECMP()
|
||||
int compare( const PIN** item1, const PIN** item2 )
|
||||
{
|
||||
STOREPIN * Pin, * NextPin;
|
||||
|
||||
for( Pin = m_Pins; Pin != NULL; Pin = NextPin )
|
||||
{
|
||||
NextPin = Pin->Pnext; delete Pin;
|
||||
}
|
||||
return StrLenNumICmp( (*item1)->m_PinNum.GetData(),
|
||||
(*item2)->m_PinNum.GetData(), 4 );
|
||||
}
|
||||
|
||||
bool same_pin_number( const PIN* item1, const PIN* item2 )
|
||||
{
|
||||
wxASSERT( item1 != NULL && item2 != NULL );
|
||||
|
||||
return ( item1->m_PinNum == item2->m_PinNum );
|
||||
}
|
||||
|
||||
bool same_pin_net( const PIN* item1, const PIN* item2 )
|
||||
{
|
||||
wxASSERT( item1 != NULL && item2 != NULL );
|
||||
|
||||
return ( item1->m_PinNet == item2->m_PinNet );
|
||||
}
|
||||
|
||||
|
||||
WX_DEFINE_LIST( COMPONENT_LIST );
|
||||
|
||||
STOREMOD::STOREMOD()
|
||||
COMPONENT::COMPONENT()
|
||||
{
|
||||
Pnext = Pback = NULL;
|
||||
m_Type = STRUCT_MODULE;
|
||||
m_Num = 0;
|
||||
m_Num = 0;
|
||||
m_Multi = 0;
|
||||
}
|
||||
|
||||
COMPONENT::~COMPONENT()
|
||||
{
|
||||
m_Pins.DeleteContents( true );
|
||||
m_Pins.Clear();
|
||||
}
|
||||
|
||||
int compare( const COMPONENT** item1, const COMPONENT** item2 )
|
||||
{
|
||||
return StrNumICmp( (*item1)->m_Reference.GetData(),
|
||||
(*item2)->m_Reference.GetData() );
|
||||
}
|
||||
|
||||
|
||||
STOREPIN::STOREPIN()
|
||||
WX_DEFINE_LIST( FOOTPRINT_LIST );
|
||||
|
||||
FOOTPRINT::FOOTPRINT()
|
||||
{
|
||||
m_Type = STRUCT_PIN; /* Type de la structure */
|
||||
Pnext = NULL; /* Chainage avant */
|
||||
m_Index = 0; /* variable utilisee selon types de netlistes */
|
||||
m_PinType = 0; /* code type electrique ( Entree Sortie Passive..) */
|
||||
m_Num = 0;
|
||||
}
|
||||
|
||||
int compare( const FOOTPRINT** item1, const FOOTPRINT** item2 )
|
||||
{
|
||||
return StrNumICmp( (*item1)->m_Module.GetData(),
|
||||
(*item2)->m_Module.GetData() );
|
||||
}
|
||||
|
|
|
@ -4,17 +4,16 @@
|
|||
#include "fctsys.h"
|
||||
#include "appl_wxstruct.h"
|
||||
#include "common.h"
|
||||
#include "macros.h"
|
||||
#include "confirm.h"
|
||||
#include "eda_doc.h"
|
||||
#include "gestfich.h"
|
||||
#include "id.h"
|
||||
|
||||
#include <wx/fontdlg.h>
|
||||
#include "param_config.h"
|
||||
|
||||
#include "3d_viewer.h"
|
||||
|
||||
#include "cvpcb.h"
|
||||
#include "pcbnew.h"
|
||||
#include "bitmaps.h"
|
||||
#include "protos.h"
|
||||
#include "cvstruct.h"
|
||||
|
@ -25,10 +24,15 @@
|
|||
#define FRAME_MIN_SIZE_Y 300
|
||||
|
||||
|
||||
// option key to close cvpcb after saving files
|
||||
static const wxString KeepCvpcbOpenEntry( wxT( "KeepCvpcbOpen" ) );
|
||||
static const wxString FootprintDocFileEntry( wxT( "footprints_doc_file" ) );
|
||||
|
||||
|
||||
/*************************************/
|
||||
/* Event table for WinEDA_CvpcbFrame */
|
||||
/*************************************/
|
||||
BEGIN_EVENT_TABLE( WinEDA_CvpcbFrame, wxFrame )
|
||||
BEGIN_EVENT_TABLE( WinEDA_CvpcbFrame, WinEDA_BasicFrame )
|
||||
EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, WinEDA_CvpcbFrame::LoadNetList )
|
||||
|
||||
// Menu events
|
||||
|
@ -46,10 +50,9 @@ BEGIN_EVENT_TABLE( WinEDA_CvpcbFrame, wxFrame )
|
|||
WinEDA_CvpcbFrame::ConfigCvpcb )
|
||||
EVT_MENU( ID_CONFIG_SAVE,
|
||||
WinEDA_CvpcbFrame::Update_Config )
|
||||
EVT_MENU( ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE,
|
||||
WinEDA_CvpcbFrame::OnKeepOpenOnSave )
|
||||
|
||||
EVT_MENU_RANGE( ID_PREFERENCES_FONT_DIALOG,
|
||||
ID_PREFERENCES_FONT_END,
|
||||
WinEDA_CvpcbFrame::ProcessFontPreferences )
|
||||
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE,
|
||||
ID_LANGUAGE_CHOICE_END,
|
||||
WinEDA_CvpcbFrame::SetLanguage )
|
||||
|
@ -94,6 +97,9 @@ BEGIN_EVENT_TABLE( WinEDA_CvpcbFrame, wxFrame )
|
|||
WinEDA_CvpcbFrame::OnLeftDClick )
|
||||
EVT_LIST_ITEM_SELECTED( ID_CVPCB_COMPONENT_LIST,
|
||||
WinEDA_CvpcbFrame::OnSelectComponent )
|
||||
|
||||
EVT_UPDATE_UI( ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE,
|
||||
WinEDA_CvpcbFrame::OnUpdateKeepOpenOnSave )
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
|
@ -106,10 +112,23 @@ WinEDA_CvpcbFrame::WinEDA_CvpcbFrame( const wxString& title, long style ) :
|
|||
{
|
||||
m_FrameName = wxT( "CvpcbFrame" );
|
||||
|
||||
m_ListCmp = NULL;
|
||||
m_FootprintList = NULL;
|
||||
DrawFrame = NULL;
|
||||
m_HToolBar = NULL;
|
||||
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;
|
||||
|
||||
|
||||
/* Name of the document footprint list
|
||||
* usually located in share/modules/footprints_doc
|
||||
* 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;
|
||||
|
||||
// Give an icon
|
||||
#ifdef __WINDOWS__
|
||||
|
@ -178,6 +197,48 @@ WinEDA_CvpcbFrame::~WinEDA_CvpcbFrame()
|
|||
ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST );
|
||||
config->Write( wxT( FILTERFOOTPRINTKEY ), state );
|
||||
}
|
||||
|
||||
m_footprints.DeleteContents( true );
|
||||
m_footprints.Clear();
|
||||
m_components.DeleteContents( true );
|
||||
m_components.Clear();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load Cvpcb main frame specific configuration settings.
|
||||
*
|
||||
* Don't forget to call this base method from any derived classes or the
|
||||
* settings will not get loaded.
|
||||
*/
|
||||
void WinEDA_CvpcbFrame::LoadSettings()
|
||||
{
|
||||
wxASSERT( wxGetApp().m_EDA_Config != NULL );
|
||||
|
||||
wxConfig* cfg = wxGetApp().m_EDA_Config;
|
||||
|
||||
WinEDA_BasicFrame::LoadSettings();
|
||||
cfg->Read( KeepCvpcbOpenEntry, &m_KeepCvpcbOpen, false );
|
||||
cfg->Read( FootprintDocFileEntry, &m_DocModulesFileName,
|
||||
DEFAULT_FOOTPRINTS_LIST_FILENAME );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Save Cvpcb frame specific configuration settings.
|
||||
*
|
||||
* Don't forget to call this base method from any derived classes or the
|
||||
* settings will not get saved.
|
||||
*/
|
||||
void WinEDA_CvpcbFrame::SaveSettings()
|
||||
{
|
||||
wxASSERT( wxGetApp().m_EDA_Config != NULL );
|
||||
|
||||
wxConfig* cfg = wxGetApp().m_EDA_Config;
|
||||
|
||||
WinEDA_BasicFrame::SaveSettings();
|
||||
cfg->Write( KeepCvpcbOpenEntry, m_KeepCvpcbOpen );
|
||||
cfg->Write( FootprintDocFileEntry, m_DocModulesFileName );
|
||||
}
|
||||
|
||||
|
||||
|
@ -203,7 +264,7 @@ void WinEDA_CvpcbFrame::OnCloseWindow( wxCloseEvent& Event )
|
|||
{
|
||||
int diag;
|
||||
|
||||
if( modified )
|
||||
if( m_modified )
|
||||
{
|
||||
unsigned ii;
|
||||
wxMessageDialog dialog( this,
|
||||
|
@ -226,7 +287,7 @@ void WinEDA_CvpcbFrame::OnCloseWindow( wxCloseEvent& Event )
|
|||
case wxID_YES:
|
||||
diag = SaveNetList( wxEmptyString );
|
||||
if( diag > 0 )
|
||||
modified = 0;
|
||||
m_modified = false;
|
||||
else if( diag == 0 )
|
||||
{
|
||||
if( !IsOK( this,
|
||||
|
@ -252,12 +313,8 @@ void WinEDA_CvpcbFrame::OnCloseWindow( wxCloseEvent& Event )
|
|||
SetLastProject( m_NetlistFileName.GetFullPath() );
|
||||
}
|
||||
|
||||
FreeMemoryModules();
|
||||
FreeMemoryComponents();
|
||||
modified = 0;
|
||||
|
||||
m_modified = false;
|
||||
SaveSettings();
|
||||
|
||||
Destroy();
|
||||
return;
|
||||
}
|
||||
|
@ -275,28 +332,34 @@ void WinEDA_CvpcbFrame::OnChar( wxKeyEvent& event )
|
|||
void WinEDA_CvpcbFrame::ToFirstNA( wxCommandEvent& event )
|
||||
/*******************************************************/
|
||||
{
|
||||
STORECMP* Composant;
|
||||
int ii, selection;;
|
||||
COMPONENT_LIST::iterator i;
|
||||
COMPONENT* Component;
|
||||
int ii = 0;
|
||||
int selection;
|
||||
|
||||
if( m_components.empty() )
|
||||
return;
|
||||
|
||||
Composant = g_BaseListeCmp;
|
||||
selection = m_ListCmp->GetSelection();
|
||||
|
||||
if( selection < 0 )
|
||||
selection = 0;
|
||||
|
||||
for( ii = 0; Composant != NULL; Composant = Composant->Pnext )
|
||||
for( i = m_components.begin(); i != m_components.end(); ++i )
|
||||
{
|
||||
if( Composant->m_Module.IsEmpty() && (ii > selection) )
|
||||
break;
|
||||
Component = *i;
|
||||
|
||||
if( Component->m_Module.IsEmpty() && ii > selection )
|
||||
{
|
||||
m_ListCmp->SetSelection( ii );
|
||||
return;
|
||||
}
|
||||
|
||||
ii++;
|
||||
}
|
||||
|
||||
if( Composant == NULL )
|
||||
{
|
||||
wxBell(); ii = selection;
|
||||
}
|
||||
|
||||
if( g_BaseListeCmp )
|
||||
m_ListCmp->SetSelection( ii );
|
||||
wxBell();
|
||||
m_ListCmp->SetSelection( selection );
|
||||
}
|
||||
|
||||
|
||||
|
@ -304,35 +367,34 @@ void WinEDA_CvpcbFrame::ToFirstNA( wxCommandEvent& event )
|
|||
void WinEDA_CvpcbFrame::ToPreviousNA( wxCommandEvent& event )
|
||||
/**********************************************************/
|
||||
{
|
||||
STORECMP* Composant;
|
||||
int ii, selection;
|
||||
COMPONENT_LIST::reverse_iterator i;
|
||||
COMPONENT* Component;
|
||||
int ii;
|
||||
int selection;
|
||||
|
||||
Composant = g_BaseListeCmp;
|
||||
if( m_components.empty() )
|
||||
return;
|
||||
|
||||
ii = m_ListCmp->GetCount() - 1;
|
||||
selection = m_ListCmp->GetSelection();
|
||||
|
||||
if( selection < 0 )
|
||||
selection = 0;
|
||||
selection = m_ListCmp->GetCount() - 1;
|
||||
|
||||
for( ii = 0; Composant != NULL; Composant = Composant->Pnext )
|
||||
for( i = m_components.rbegin(); i != m_components.rend(); ++i )
|
||||
{
|
||||
if( ii == selection )
|
||||
break;
|
||||
ii++;
|
||||
}
|
||||
Component = *i;
|
||||
|
||||
for( ; Composant != NULL; Composant = Composant->Pback )
|
||||
{
|
||||
if( Composant->m_Module.IsEmpty() && (ii != selection) )
|
||||
break;
|
||||
if( Component->m_Module.IsEmpty() && ii < selection )
|
||||
{
|
||||
m_ListCmp->SetSelection( ii );
|
||||
return;
|
||||
}
|
||||
ii--;
|
||||
}
|
||||
|
||||
if( Composant == NULL )
|
||||
{
|
||||
wxBell(); ii = selection;
|
||||
}
|
||||
|
||||
if( g_BaseListeCmp )
|
||||
m_ListCmp->SetSelection( ii );
|
||||
wxBell();
|
||||
m_ListCmp->SetSelection( selection );
|
||||
}
|
||||
|
||||
|
||||
|
@ -342,8 +404,8 @@ void WinEDA_CvpcbFrame::SaveQuitCvpcb( wxCommandEvent& event )
|
|||
{
|
||||
if( SaveNetList( wxEmptyString ) > 0 )
|
||||
{
|
||||
modified = 0;
|
||||
if ( ! g_KeepCvpcbOpen )
|
||||
m_modified = false;
|
||||
if ( ! m_KeepCvpcbOpen )
|
||||
Close( TRUE );
|
||||
}
|
||||
}
|
||||
|
@ -356,33 +418,32 @@ void WinEDA_CvpcbFrame::DelAssociations( wxCommandEvent& event )
|
|||
/* Supprime toutes les associations deja faites
|
||||
*/
|
||||
{
|
||||
int ii;
|
||||
STORECMP* Composant;
|
||||
wxString Line;
|
||||
COMPONENT_LIST::iterator i;
|
||||
COMPONENT* Component;
|
||||
wxString Line;
|
||||
|
||||
if( IsOK( this, _( "Delete selections" ) ) )
|
||||
{
|
||||
Composant = g_BaseListeCmp;
|
||||
for( ii = 0; Composant != NULL; Composant = Composant->Pnext, ii++ )
|
||||
for( i = m_components.begin(); i != m_components.end(); ++i )
|
||||
{
|
||||
Composant->m_Module.Empty();
|
||||
m_ListCmp->SetSelection( ii );
|
||||
Component = *i;
|
||||
Component->m_Module.Empty();
|
||||
SetNewPkg( wxEmptyString );
|
||||
}
|
||||
|
||||
m_ListCmp->SetSelection( 0 );
|
||||
composants_non_affectes = nbcomp;
|
||||
m_undefinedComponentCnt = m_components.GetCount();
|
||||
}
|
||||
|
||||
Line.Printf( _( "Components: %d (free: %d)" ), nbcomp,
|
||||
composants_non_affectes );
|
||||
Line.Printf( _( "Components: %d (free: %d)" ), m_components.GetCount(),
|
||||
m_components.GetCount() );
|
||||
SetStatusText( Line, 1 );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Called when click on Load Netlist button or by file history menu entries
|
||||
* Read a netlist slected by user
|
||||
* Read a netlist selected by user
|
||||
*/
|
||||
void WinEDA_CvpcbFrame::LoadNetList( wxCommandEvent& event )
|
||||
{
|
||||
|
@ -445,6 +506,12 @@ void WinEDA_CvpcbFrame::ConfigCvpcb( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
void WinEDA_CvpcbFrame::OnKeepOpenOnSave( wxCommandEvent& event )
|
||||
{
|
||||
m_KeepCvpcbOpen = event.IsChecked();
|
||||
}
|
||||
|
||||
|
||||
/************************************************************/
|
||||
void WinEDA_CvpcbFrame::DisplayModule( wxCommandEvent& event )
|
||||
/************************************************************/
|
||||
|
@ -459,29 +526,6 @@ void WinEDA_CvpcbFrame::DisplayModule( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
/****************************************************************/
|
||||
void WinEDA_CvpcbFrame::AddFontSelectionMenu( wxMenu* main_menu )
|
||||
/*****************************************************************/
|
||||
|
||||
/* create the submenu for fonte selection and setup fonte size
|
||||
*/
|
||||
{
|
||||
wxMenu* fontmenu = new wxMenu();
|
||||
|
||||
ADD_MENUITEM( fontmenu,
|
||||
ID_PREFERENCES_FONT_DIALOG,
|
||||
_( "Dialog boxes" ),
|
||||
fonts_xpm );
|
||||
|
||||
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( main_menu,
|
||||
fontmenu,
|
||||
ID_PREFERENCES_FONT,
|
||||
_( "&Font" ),
|
||||
_( "Choose font type and size for dialogs, information and status box" ),
|
||||
fonts_xpm );
|
||||
}
|
||||
|
||||
|
||||
/********************************************************/
|
||||
void WinEDA_CvpcbFrame::SetLanguage( wxCommandEvent& event )
|
||||
/********************************************************/
|
||||
|
@ -499,34 +543,8 @@ void WinEDA_CvpcbFrame::SetLanguage( wxCommandEvent& event )
|
|||
void WinEDA_CvpcbFrame::DisplayDocFile( wxCommandEvent& event )
|
||||
/*************************************************************/
|
||||
{
|
||||
wxConfig* cfg = wxGetApp().m_EDA_CommonConfig;
|
||||
cfg->Read( DOC_FOOTPRINTS_LIST_KEY, g_DocModulesFileName );
|
||||
|
||||
GetAssociatedDocument( this, g_DocModulesFileName, &wxGetApp().GetLibraryPathList() );
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************/
|
||||
void WinEDA_CvpcbFrame::ProcessFontPreferences( wxCommandEvent& event )
|
||||
/********************************************************************/
|
||||
{
|
||||
int id = event.GetId();
|
||||
wxFont font;
|
||||
|
||||
switch( id )
|
||||
{
|
||||
case ID_PREFERENCES_FONT:
|
||||
case ID_PREFERENCES_FONT_DIALOG:
|
||||
WinEDA_BasicFrame::ProcessFontPreferences( id );
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
DisplayError( this,
|
||||
wxT( "WinEDA_DrawFrame::ProcessFontPreferences " \
|
||||
"Internal Error" ) );
|
||||
break;
|
||||
}
|
||||
GetAssociatedDocument( this, m_DocModulesFileName,
|
||||
&wxGetApp().GetLibraryPathList() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -550,8 +568,8 @@ void WinEDA_CvpcbFrame::OnLeftDClick( wxListEvent& event )
|
|||
void WinEDA_CvpcbFrame::OnSelectComponent( wxListEvent& event )
|
||||
/*************************************************************/
|
||||
{
|
||||
STORECMP* Component;
|
||||
int selection;
|
||||
COMPONENT* Component;
|
||||
int selection;
|
||||
|
||||
if( !m_HToolBar->GetToolState( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST ) )
|
||||
{
|
||||
|
@ -566,13 +584,7 @@ void WinEDA_CvpcbFrame::OnSelectComponent( wxListEvent& event )
|
|||
return;
|
||||
}
|
||||
|
||||
Component = g_BaseListeCmp;
|
||||
for( int ii = 0; Component != NULL; Component = Component->Pnext )
|
||||
{
|
||||
if( ii == selection )
|
||||
break;
|
||||
ii++;
|
||||
}
|
||||
Component = m_components[ selection ];
|
||||
|
||||
if( Component == NULL )
|
||||
{
|
||||
|
@ -580,7 +592,7 @@ void WinEDA_CvpcbFrame::OnSelectComponent( wxListEvent& event )
|
|||
return;
|
||||
}
|
||||
|
||||
m_FootprintList->SetFootprintFilteredList( Component );
|
||||
m_FootprintList->SetFootprintFilteredList( Component, m_footprints );
|
||||
}
|
||||
|
||||
|
||||
|
@ -595,3 +607,9 @@ void WinEDA_CvpcbFrame::OnSelectFilteringFootprint( wxCommandEvent& event )
|
|||
|
||||
OnSelectComponent( l_event );
|
||||
}
|
||||
|
||||
|
||||
void WinEDA_CvpcbFrame::OnUpdateKeepOpenOnSave( wxUpdateUIEvent& event )
|
||||
{
|
||||
event.Check( m_KeepCvpcbOpen );
|
||||
}
|
||||
|
|
|
@ -22,53 +22,20 @@
|
|||
/* Constant string definitions for CvPcb */
|
||||
const wxString ComponentFileExtension( wxT( "cmp" ) );
|
||||
const wxString RetroFileExtension( wxT( "stf" ) );
|
||||
const wxString EquivFileExtension( wxT( "equ" ) );
|
||||
const wxString FootprintAliasFileExtension( wxT( "equ" ) );
|
||||
|
||||
// Wildcard for footprint libraries filesnames
|
||||
const wxString g_FootprintLibFileWildcard( wxT( "Kicad footprint library file " \
|
||||
"(*.mod)|*.mod" ) );
|
||||
// Wildcard for schematic retroannotation (import footprint names in schematic):
|
||||
const wxString RetroFileWildcard( _( "Kicad component list files (*.stf)|*.stf" ) );
|
||||
|
||||
// Wildcard for alias footprint files
|
||||
const wxString EquivFileWildcard( _( "Kicad footprint alias files (*.equ)|*.equ" ) );
|
||||
const wxString RetroFileWildcard( _( "Kicad component list files " \
|
||||
"(*.stf)|*.stf" ) );
|
||||
const wxString FootprintAliasFileWildcard( _( "Kicad footprint alias files " \
|
||||
"(*.equ)|*.equ" ) );
|
||||
|
||||
const wxString titleLibLoadError( _( "Library Load Error" ) );
|
||||
|
||||
|
||||
/* Global variables used in CVPcb. */
|
||||
int g_FlagEESchema;
|
||||
int Rjustify;
|
||||
int modified;
|
||||
int nbcomp;
|
||||
int nblib;
|
||||
int composants_non_affectes;
|
||||
|
||||
// Option to keep cvpcb open after saving netlist files
|
||||
bool g_KeepCvpcbOpen = false;
|
||||
|
||||
|
||||
STOREMOD* g_BaseListePkg = NULL;
|
||||
STORECMP* g_BaseListeCmp = NULL;
|
||||
|
||||
wxString g_UserNetDirBuffer; // Netlist path (void = current working directory)
|
||||
wxString g_NetlistFileExtension;
|
||||
|
||||
wxArrayString g_ListName_Equ; // list of .equ files to load
|
||||
|
||||
/* Name of the document footprint list
|
||||
* usually located in share/modules/footprints_doc
|
||||
* this is of the responsability to users to create this file
|
||||
* if they want to have a list of footprints
|
||||
*/
|
||||
wxString g_DocModulesFileName = DEFAULT_FOOTPRINTS_LIST_FILENAME;
|
||||
|
||||
|
||||
|
||||
// Create a new application object
|
||||
IMPLEMENT_APP( WinEDA_App )
|
||||
|
||||
/* fonctions locales */
|
||||
|
||||
/************************************/
|
||||
/* Called to initialize the program */
|
||||
|
@ -105,17 +72,10 @@ bool WinEDA_App::OnInit()
|
|||
wxString Title = GetTitle() + wxT( " " ) + GetBuildVersion();
|
||||
frame = new WinEDA_CvpcbFrame( Title );
|
||||
|
||||
msg.Printf( wxT( "Modules: %d" ), nblib );
|
||||
frame->SetStatusText( msg, 2 );
|
||||
|
||||
// Show the frame
|
||||
SetTopWindow( frame );
|
||||
|
||||
Read_Config( fn.GetFullPath() );
|
||||
long tmp;
|
||||
if ( wxGetApp().m_EDA_CommonConfig->Read( CLOSE_OPTION_KEY, & tmp) )
|
||||
g_KeepCvpcbOpen = tmp;
|
||||
|
||||
frame->LoadProjectFile( fn.GetFullPath() );
|
||||
frame->Show( TRUE );
|
||||
frame->BuildFootprintListBox();
|
||||
|
||||
|
@ -125,13 +85,13 @@ bool WinEDA_App::OnInit()
|
|||
|
||||
if( frame->ReadNetList() )
|
||||
{
|
||||
g_NetlistFileExtension = fn.GetExt();
|
||||
frame->m_NetlistFileExtension = fn.GetExt();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
listlib();
|
||||
g_NetlistFileExtension = wxT( "net" );
|
||||
LoadFootprintFiles( frame->m_ModuleLibNames, frame->m_footprints );
|
||||
frame->m_NetlistFileExtension = wxT( "net" );
|
||||
frame->m_NetlistFileName.Clear();
|
||||
frame->SetTitle( GetTitle() + wxT( " " ) + GetBuildVersion() +
|
||||
wxGetCwd() + wxFileName::GetPathSeparator() +
|
||||
|
|
103
cvpcb/cvpcb.h
103
cvpcb/cvpcb.h
|
@ -8,12 +8,8 @@
|
|||
#include "pcbcommon.h"
|
||||
|
||||
// config for footprints doc file acces
|
||||
#define DOC_FOOTPRINTS_LIST_KEY wxT( "footprints_doc_file" )
|
||||
#define DEFAULT_FOOTPRINTS_LIST_FILENAME wxT( "footprints_doc/footprints.pdf" )
|
||||
|
||||
// option key to close cvpcb after saving files
|
||||
#define CLOSE_OPTION_KEY wxT( "KeepCvpcbOpen" )
|
||||
|
||||
// Define print format to display a schematic component line
|
||||
#define CMP_FORMAT wxT( "%3d %8s - %16s : %-.32s" )
|
||||
|
||||
|
@ -27,38 +23,35 @@
|
|||
#define TYPE_VIEWLOGIC_NET 4
|
||||
|
||||
|
||||
enum TypeOfStruct {
|
||||
STRUCT_NOT_INIT,
|
||||
STRUCT_COMPONENT,
|
||||
STRUCT_PIN,
|
||||
STRUCT_MODULE,
|
||||
STRUCT_PSEUDOMODULE
|
||||
};
|
||||
|
||||
class STOREPIN
|
||||
class PIN
|
||||
{
|
||||
public:
|
||||
int m_Type; /* Type de la structure */
|
||||
STOREPIN* Pnext; /* Chainage avant */
|
||||
int m_Index; /* variable utilisee selon types de netlistes */
|
||||
int m_PinType; /* code type electrique ( Entree Sortie Passive..) */
|
||||
wxString m_PinNet; /* Pointeur sur le texte nom de net */
|
||||
int m_Index; /* variable utilisee selon types de netlistes */
|
||||
int m_PinType; /* code type electrique ( Entree Sortie Passive..) */
|
||||
wxString m_PinNet; /* Pointeur sur le texte nom de net */
|
||||
wxString m_PinNum;
|
||||
wxString m_PinName;
|
||||
wxString m_Repere; /* utilise selon formats de netliste */
|
||||
wxString m_Repere; /* utilise selon formats de netliste */
|
||||
|
||||
STOREPIN();
|
||||
PIN();
|
||||
};
|
||||
|
||||
class STORECMP
|
||||
WX_DECLARE_LIST( PIN, PIN_LIST );
|
||||
|
||||
/* PIN object list sort function. */
|
||||
extern int compare( const PIN** item1, const PIN** item2 );
|
||||
|
||||
/* PIN object comparison functions. */
|
||||
extern bool same_pin_number( const PIN* item1, const PIN* item2 );
|
||||
extern bool same_pin_net( const PIN* item1, const PIN* item2 );
|
||||
|
||||
|
||||
class COMPONENT
|
||||
{
|
||||
public:
|
||||
int m_Type; /* Type de la structure */
|
||||
STORECMP* Pnext; /* Chainage avant */
|
||||
STORECMP* Pback; /* Chainage arriere */
|
||||
int m_Num; /* Numero d'ordre */
|
||||
int m_Multi; /* Nombre d' unites par boitier */
|
||||
STOREPIN* m_Pins; /* pointeur sur la liste des Pins */
|
||||
PIN_LIST m_Pins; /* pointeur sur la liste des Pins */
|
||||
wxString m_Reference; /* U3, R5 ... */
|
||||
wxString m_Valeur; /* 7400, 47K ... */
|
||||
wxString m_TimeStamp; /* Signature temporelle ("00000000" si absente) */
|
||||
|
@ -67,71 +60,43 @@ public:
|
|||
wxArrayString m_FootprintFilter; /* List of allowed footprints (wildcart allowed
|
||||
* if void: no filtering */
|
||||
|
||||
STORECMP();
|
||||
~STORECMP();
|
||||
COMPONENT();
|
||||
~COMPONENT();
|
||||
};
|
||||
|
||||
class STOREMOD
|
||||
WX_DECLARE_LIST( COMPONENT, COMPONENT_LIST );
|
||||
|
||||
/* COMPONENT object list sort function. */
|
||||
extern int compare( const COMPONENT** item1, const COMPONENT** item2 );
|
||||
|
||||
|
||||
class FOOTPRINT
|
||||
{
|
||||
public:
|
||||
int m_Type; /* Type de la structure */
|
||||
STOREMOD* Pnext; /* Chainage avant */
|
||||
STOREMOD* Pback; /* Chainage arriere */
|
||||
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 */
|
||||
|
||||
STOREMOD();
|
||||
FOOTPRINT();
|
||||
};
|
||||
|
||||
WX_DECLARE_LIST( FOOTPRINT, FOOTPRINT_LIST );
|
||||
|
||||
/* FOOTPRINT object list sort function. */
|
||||
extern int compare( const FOOTPRINT** item1, const FOOTPRINT** item2 );
|
||||
|
||||
/* Gestion des noms des librairies */
|
||||
extern const wxString EquivFileExtension;
|
||||
extern const wxString FootprintAliasFileExtension;
|
||||
extern const wxString RetroFileExtension;
|
||||
extern const wxString ComponentFileExtension;
|
||||
|
||||
extern const wxString RetroFileWildcard;
|
||||
extern const wxString EquivFileWildcard;
|
||||
extern const wxString FootprintAliasFileWildcard;
|
||||
|
||||
extern const wxString titleLibLoadError;
|
||||
|
||||
// Wildcard for footprint libraries filesnames
|
||||
extern const wxString g_FootprintLibFileWildcard;
|
||||
|
||||
// Wildcard for schematic retroannotation (import footprint names in schematic):
|
||||
extern const wxString g_FootprintEquFileWildcard;
|
||||
|
||||
/* Name of the document footprint list
|
||||
* usually located in share/modules/footprints_doc
|
||||
* this is of the responsability to users to create this file
|
||||
* if they want to have a list of footprints
|
||||
*/
|
||||
extern wxString g_DocModulesFileName;
|
||||
|
||||
/* CvPcb global variable definition references. */
|
||||
extern STOREMOD* g_BaseListePkg;
|
||||
extern STORECMP* g_BaseListeCmp;
|
||||
|
||||
extern wxString g_NetlistFileExtension;
|
||||
extern wxString g_UserNetDirBuffer;
|
||||
|
||||
extern wxArrayString g_ListName_Equ; // list of .equ files to load
|
||||
|
||||
extern int g_FlagEESchema;
|
||||
extern int Rjustify; /* flag pout troncature des noms de Net:
|
||||
* = 0: debut de chaine conservee (->ORCADPCB2)
|
||||
* = 1: fin de chaine conservee (->VIEWLOGIC) */
|
||||
|
||||
extern int modified; /* Flag != 0 si modif attribution des module. */
|
||||
|
||||
extern int nbcomp; /* nombre de composants trouves */
|
||||
extern int nblib; /* nombre d'empreintes trouvees */
|
||||
extern int composants_non_affectes; /* nbre de composants non affectes */
|
||||
|
||||
extern bool g_KeepCvpcbOpen; // Option to keep cvpcb open after saving netlist files
|
||||
|
||||
void Plume( int state );
|
||||
|
||||
#endif /* __CVPCB_H__ */
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/***********************************************************/
|
||||
/* wxstruct.h: */
|
||||
/* cvstruct.h : */
|
||||
/* descriptions des principales classes derivees utilisees */
|
||||
/***********************************************************/
|
||||
|
||||
|
@ -8,12 +8,13 @@
|
|||
|
||||
#include "wx/listctrl.h"
|
||||
#include <wx/filename.h>
|
||||
#include "param_config.h"
|
||||
#include "cvpcb.h"
|
||||
|
||||
/* Forward declarations of all top-level window classes. */
|
||||
class FootprintListBox;
|
||||
class ListBoxCmp;
|
||||
class WinEDA_DisplayFrame;
|
||||
class STORECMP;
|
||||
|
||||
#define LIST_BOX_TYPE wxListView
|
||||
|
||||
|
@ -25,11 +26,26 @@ class WinEDA_CvpcbFrame : public WinEDA_BasicFrame
|
|||
{
|
||||
public:
|
||||
|
||||
bool m_KeepCvpcbOpen;
|
||||
FootprintListBox* m_FootprintList;
|
||||
ListBoxCmp* m_ListCmp;
|
||||
WinEDA_DisplayFrame* DrawFrame;
|
||||
WinEDA_Toolbar* m_HToolBar; // Toolbar horizontal haut d'ecran
|
||||
wxFileName m_NetlistFileName;
|
||||
wxArrayString m_ModuleLibNames;
|
||||
wxArrayString m_AliasLibNames;
|
||||
wxString m_UserLibraryPath;
|
||||
wxString m_NetlistFileExtension;
|
||||
wxString m_DocModulesFileName;
|
||||
FOOTPRINT_LIST m_footprints;
|
||||
COMPONENT_LIST m_components;
|
||||
|
||||
protected:
|
||||
int m_undefinedComponentCnt;
|
||||
bool m_modified;
|
||||
bool m_rightJustify;
|
||||
bool m_isEESchemaNetlist;
|
||||
PARAM_CFG_ARRAY m_projectFileParams;
|
||||
|
||||
// Constructor and destructor
|
||||
public:
|
||||
|
@ -49,8 +65,6 @@ public:
|
|||
void ReCreateHToolbar();
|
||||
virtual void ReCreateMenuBar();
|
||||
void SetLanguage( wxCommandEvent& event );
|
||||
void AddFontSelectionMenu( wxMenu* main_menu );
|
||||
void ProcessFontPreferences( wxCommandEvent& event );
|
||||
|
||||
void ToFirstNA( wxCommandEvent& event );
|
||||
void ToPreviousNA( wxCommandEvent& event );
|
||||
|
@ -58,11 +72,15 @@ public:
|
|||
void SaveQuitCvpcb( wxCommandEvent& event );
|
||||
void LoadNetList( wxCommandEvent& event );
|
||||
void ConfigCvpcb( wxCommandEvent& event );
|
||||
void OnKeepOpenOnSave( wxCommandEvent& event );
|
||||
void DisplayModule( wxCommandEvent& event );
|
||||
void AssocieModule( wxCommandEvent& event );
|
||||
void WriteStuffList( wxCommandEvent& event );
|
||||
void DisplayDocFile( wxCommandEvent& event );
|
||||
void OnSelectFilteringFootprint( wxCommandEvent& event );
|
||||
|
||||
void OnUpdateKeepOpenOnSave( wxUpdateUIEvent& event );
|
||||
|
||||
void SetNewPkg( const wxString& package );
|
||||
void BuildCmpListBox();
|
||||
void BuildFootprintListBox();
|
||||
|
@ -75,6 +93,12 @@ public:
|
|||
int ReadFootprintFilterList( FILE* f );
|
||||
int ReadViewlogicWirList();
|
||||
int ReadViewlogicNetList();
|
||||
void LoadProjectFile( const wxString& FileName );
|
||||
void SaveProjectFile( const wxString& fileName );
|
||||
virtual void LoadSettings();
|
||||
virtual void SaveSettings();
|
||||
|
||||
const PARAM_CFG_ARRAY& GetProjectFileParameters( void );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
@ -91,7 +115,7 @@ public:
|
|||
public:
|
||||
|
||||
ListBoxBase( WinEDA_CvpcbFrame * parent, wxWindowID id,
|
||||
const wxPoint &loc, const wxSize &size );
|
||||
const wxPoint &loc, const wxSize &size );
|
||||
|
||||
~ListBoxBase();
|
||||
|
||||
|
@ -113,17 +137,18 @@ public:
|
|||
bool m_UseFootprintFullList;
|
||||
|
||||
public:
|
||||
FootprintListBox( WinEDA_CvpcbFrame * parent,
|
||||
wxWindowID id, const wxPoint &loc, const wxSize &size,
|
||||
int nbitems, wxString choice[] );
|
||||
FootprintListBox( WinEDA_CvpcbFrame * parent, wxWindowID id,
|
||||
const wxPoint &loc, const wxSize &size,
|
||||
int nbitems, wxString choice[] );
|
||||
~FootprintListBox();
|
||||
|
||||
int GetCount();
|
||||
void SetSelection( unsigned index, bool State = TRUE );
|
||||
void SetString( unsigned linecount, const wxString& text );
|
||||
void AppendLine( const wxString& text );
|
||||
void SetFootprintFullList();
|
||||
void SetFootprintFilteredList( STORECMP* Component );
|
||||
void SetFootprintFullList( FOOTPRINT_LIST& list );
|
||||
void SetFootprintFilteredList( COMPONENT* Component,
|
||||
FOOTPRINT_LIST& list );
|
||||
void SetActiveFootprintList( bool FullList, bool Redraw = FALSE );
|
||||
|
||||
wxString GetSelectedFootprint();
|
||||
|
@ -147,8 +172,8 @@ public:
|
|||
public:
|
||||
|
||||
ListBoxCmp( WinEDA_CvpcbFrame * parent, wxWindowID id,
|
||||
const wxPoint &loc, const wxSize &size,
|
||||
int nbitems, wxString choice[] );
|
||||
const wxPoint &loc, const wxSize &size,
|
||||
int nbitems, wxString choice[] );
|
||||
|
||||
~ListBoxCmp();
|
||||
|
||||
|
|
|
@ -24,12 +24,14 @@ DIALOG_CVPCB_CONFIG::DIALOG_CVPCB_CONFIG( WinEDA_CvpcbFrame* parent ) :
|
|||
DIALOG_CVPCB_CONFIG_FBP( parent )
|
||||
{
|
||||
wxString title;
|
||||
wxFileName fn = parent->m_NetlistFileName;
|
||||
fn.SetExt( ProjectFileExtension );
|
||||
|
||||
m_Parent = parent;
|
||||
m_Config = wxGetApp().m_EDA_CommonConfig;
|
||||
|
||||
|
||||
Init( );
|
||||
title = _( "from " ) + wxGetApp().m_CurrentOptionFile;
|
||||
title = _( "Project file: " ) + fn.GetFullPath();
|
||||
SetTitle( title );
|
||||
if( GetSizer() )
|
||||
{
|
||||
|
@ -44,35 +46,16 @@ void DIALOG_CVPCB_CONFIG::Init()
|
|||
{
|
||||
wxString msg;
|
||||
|
||||
SetFont( *g_DialogFont );
|
||||
SetFocus();
|
||||
|
||||
m_LibListChanged = false;
|
||||
m_LibPathChanged = false;
|
||||
m_UserLibDirBufferImg = g_UserLibDirBuffer; // Save the original lib path
|
||||
m_UserLibDirBufferImg = m_Parent->m_UserLibraryPath;
|
||||
|
||||
// Display current files extension (info)
|
||||
msg = m_InfoCmpFileExt->GetLabel() + ComponentFileExtension;
|
||||
m_InfoCmpFileExt->SetLabel( msg );
|
||||
m_ListLibr->InsertItems( m_Parent->m_ModuleLibNames, 0 );
|
||||
m_ListEquiv->InsertItems( m_Parent->m_AliasLibNames, 0 );
|
||||
|
||||
msg = m_InfoLibFileExt->GetLabel() + ModuleFileExtension;
|
||||
m_InfoLibFileExt->SetLabel( msg );
|
||||
|
||||
msg = m_InfoNetlistFileExt->GetLabel() + g_NetlistFileExtension;
|
||||
m_InfoNetlistFileExt->SetLabel( msg );
|
||||
|
||||
msg = m_InfoEquivFileExt->GetLabel() + EquivFileExtension;
|
||||
m_InfoEquivFileExt->SetLabel( msg );
|
||||
|
||||
msg = m_InfoRetroannotFileExt->GetLabel() + RetroFileExtension;
|
||||
m_InfoRetroannotFileExt->SetLabel( msg );
|
||||
|
||||
m_ListLibr->InsertItems( g_LibName_List, 0 );
|
||||
m_ListEquiv->InsertItems( g_ListName_Equ, 0 );
|
||||
|
||||
// Display current modules doc file:
|
||||
m_Config->Read( DOC_FOOTPRINTS_LIST_KEY, g_DocModulesFileName );
|
||||
m_TextHelpModulesFileName->SetValue( g_DocModulesFileName );
|
||||
m_TextHelpModulesFileName->SetValue( m_Parent->m_DocModulesFileName );
|
||||
|
||||
// Load user libs paths:
|
||||
wxStringTokenizer Token( m_UserLibDirBufferImg, wxT( ";\n\r" ) );
|
||||
|
@ -93,8 +76,6 @@ void DIALOG_CVPCB_CONFIG::Init()
|
|||
// select the first path afer the current path project
|
||||
if( libpaths.GetCount() > 1 )
|
||||
m_DefaultLibraryPathslistBox->Select( 1 );
|
||||
|
||||
m_radioBoxCloseOpt->SetSelection ( g_KeepCvpcbOpen ? 1 : 0 );
|
||||
}
|
||||
|
||||
|
||||
|
@ -108,9 +89,10 @@ void DIALOG_CVPCB_CONFIG::OnCancelClick( wxCommandEvent& event )
|
|||
for( unsigned ii = 0; ii < m_ListLibr->GetCount(); ii++ )
|
||||
wxGetApp().RemoveLibraryPath( m_listUserPaths->GetString( ii ) );
|
||||
|
||||
wxGetApp().InsertLibraryPath( g_UserLibDirBuffer, 1 );
|
||||
wxGetApp().InsertLibraryPath( m_Parent->m_UserLibraryPath, 1 );
|
||||
}
|
||||
EndModal( -1 );
|
||||
|
||||
EndModal( wxID_CANCEL );
|
||||
}
|
||||
|
||||
|
||||
|
@ -118,21 +100,17 @@ void DIALOG_CVPCB_CONFIG::OnCancelClick( wxCommandEvent& event )
|
|||
void DIALOG_CVPCB_CONFIG::OnOkClick( wxCommandEvent& event )
|
||||
/**************************************************************/
|
||||
{
|
||||
g_KeepCvpcbOpen = m_radioBoxCloseOpt->GetSelection( ) ? true : false;
|
||||
m_Config->Write( CLOSE_OPTION_KEY, (long) g_KeepCvpcbOpen );
|
||||
|
||||
m_Config->Write( DOC_FOOTPRINTS_LIST_KEY,
|
||||
m_TextHelpModulesFileName->GetValue() );
|
||||
m_Parent->m_DocModulesFileName = m_TextHelpModulesFileName->GetValue();
|
||||
|
||||
// Recreate the user lib path
|
||||
if( m_LibPathChanged )
|
||||
{
|
||||
g_UserLibDirBuffer.Empty();
|
||||
m_Parent->m_UserLibraryPath.Empty();
|
||||
for( unsigned ii = 0; ii < m_listUserPaths->GetCount(); ii++ )
|
||||
{
|
||||
if( ii > 0 )
|
||||
g_UserLibDirBuffer << wxT( ";" );
|
||||
g_UserLibDirBuffer << m_listUserPaths->GetString( ii );
|
||||
m_Parent->m_UserLibraryPath << wxT( ";" );
|
||||
m_Parent->m_UserLibraryPath << m_listUserPaths->GetString( ii );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -141,20 +119,22 @@ void DIALOG_CVPCB_CONFIG::OnOkClick( wxCommandEvent& event )
|
|||
if( m_LibListChanged || m_LibPathChanged )
|
||||
{
|
||||
// Recreate lib list
|
||||
g_LibName_List.Clear();
|
||||
m_Parent->m_ModuleLibNames.Clear();
|
||||
for( unsigned ii = 0; ii < m_ListLibr->GetCount(); ii++ )
|
||||
g_LibName_List.Add( m_ListLibr->GetString( ii ) );
|
||||
m_Parent->m_ModuleLibNames.Add( m_ListLibr->GetString( ii ) );
|
||||
|
||||
// Recreate equ list
|
||||
g_ListName_Equ.Clear();
|
||||
m_Parent->m_AliasLibNames.Clear();
|
||||
for( unsigned ii = 0; ii < m_ListEquiv->GetCount(); ii++ )
|
||||
g_ListName_Equ.Add( m_ListEquiv->GetString( ii ) );
|
||||
m_Parent->m_AliasLibNames.Add( m_ListEquiv->GetString( ii ) );
|
||||
|
||||
listlib();
|
||||
LoadFootprintFiles( m_Parent->m_ModuleLibNames,
|
||||
m_Parent->m_footprints );
|
||||
m_Parent->BuildFootprintListBox();
|
||||
}
|
||||
if( event.GetId() != ID_SAVE_CFG )
|
||||
EndModal( 0 );
|
||||
|
||||
m_Parent->SaveProjectFile( m_Parent->m_NetlistFileName.GetFullPath() );
|
||||
EndModal( wxID_OK );
|
||||
}
|
||||
|
||||
|
||||
|
@ -209,12 +189,12 @@ void DIALOG_CVPCB_CONFIG::OnAddOrInsertLibClick( wxCommandEvent& event )
|
|||
if( (event.GetId() == ID_INSERT_EQU) || (event.GetId() == ID_INSERT_LIB) )
|
||||
insert = true;
|
||||
|
||||
wildcard = EquivFileWildcard;
|
||||
wildcard = FootprintAliasFileWildcard;
|
||||
wxListBox * list = m_ListEquiv;
|
||||
if( (event.GetId() == ID_ADD_LIB) || (event.GetId() == ID_INSERT_LIB) )
|
||||
{
|
||||
list = m_ListLibr;
|
||||
wildcard = g_FootprintLibFileWildcard;
|
||||
wildcard = ModuleFileWildcard;
|
||||
}
|
||||
|
||||
ii = list->GetSelection();
|
||||
|
@ -246,8 +226,8 @@ void DIALOG_CVPCB_CONFIG::OnAddOrInsertLibClick( wxCommandEvent& event )
|
|||
* list, just add the library name to the list. Otherwise, add
|
||||
* the library name with the full or relative path.
|
||||
* the relative path, when possible is preferable,
|
||||
* because it preserve use of default libraries paths, when the path is a sub path of these default paths
|
||||
*
|
||||
* because it preserve use of default libraries paths, when the path
|
||||
* is a sub path of these default paths
|
||||
*/
|
||||
if( wxGetApp().GetLibraryPathList().Index( fn.GetPath() ) != wxNOT_FOUND ) // Ok, trivial case
|
||||
libfilename = fn.GetName();
|
||||
|
@ -283,15 +263,6 @@ void DIALOG_CVPCB_CONFIG::OnAddOrInsertLibClick( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
/*******************************************************************/
|
||||
void DIALOG_CVPCB_CONFIG::OnSaveCfgClick( wxCommandEvent& event )
|
||||
/*******************************************************************/
|
||||
{
|
||||
OnOkClick( event );
|
||||
Save_Config( this, m_Parent->m_NetlistFileName.GetFullPath() );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************/
|
||||
void DIALOG_CVPCB_CONFIG::OnAddOrInsertPath( wxCommandEvent& event )
|
||||
/***********************************************************************/
|
||||
|
@ -370,16 +341,14 @@ void DIALOG_CVPCB_CONFIG::OnRemoveUserPath( wxCommandEvent& event )
|
|||
void DIALOG_CVPCB_CONFIG::OnBrowseModDocFile( wxCommandEvent& event )
|
||||
/**************************************************************************/
|
||||
{
|
||||
wxString FullFileName, mask;
|
||||
wxString FullFileName;
|
||||
wxString docpath, filename;
|
||||
|
||||
docpath = wxGetApp().ReturnLastVisitedLibraryPath( wxT( "doc" ) );
|
||||
|
||||
mask = wxT( "*.pdf" );
|
||||
|
||||
wxFileDialog FilesDialog( this, _( "Footprint document file:" ), docpath,
|
||||
wxEmptyString, mask,
|
||||
wxFD_DEFAULT_STYLE );
|
||||
wxEmptyString, PdfFileWildcard,
|
||||
wxFD_DEFAULT_STYLE | wxFD_FILE_MUST_EXIST );
|
||||
|
||||
if( FilesDialog.ShowModal() != wxID_OK )
|
||||
return;
|
||||
|
@ -390,7 +359,8 @@ void DIALOG_CVPCB_CONFIG::OnBrowseModDocFile( wxCommandEvent& event )
|
|||
* list, just add the library name to the list. Otherwise, add
|
||||
* the library name with the full or relative path.
|
||||
* the relative path, when possible is preferable,
|
||||
* because it preserve use of default libraries paths, when the path is a sub path of these default paths
|
||||
* because it preserve use of default libraries paths, when the path is
|
||||
* a sub path of these default paths
|
||||
*/
|
||||
wxFileName fn = FullFileName;
|
||||
wxGetApp().SaveLastVisitedLibraryPath( fn.GetPath() );
|
||||
|
|
|
@ -26,7 +26,6 @@ private:
|
|||
void OnCloseWindow( wxCloseEvent& event );
|
||||
void OnOkClick( wxCommandEvent& event );
|
||||
void OnCancelClick( wxCommandEvent& event );
|
||||
void OnSaveCfgClick( wxCommandEvent& event );
|
||||
void OnAddOrInsertLibClick( wxCommandEvent& event );
|
||||
void OnRemoveLibClick( wxCommandEvent& event );
|
||||
void OnBrowseModDocFile( wxCommandEvent& event );
|
||||
|
|
|
@ -16,175 +16,92 @@ DIALOG_CVPCB_CONFIG_FBP::DIALOG_CVPCB_CONFIG_FBP( wxWindow* parent, wxWindowID i
|
|||
wxBoxSizer* bMainSizer;
|
||||
bMainSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxBoxSizer* bUpperSizer;
|
||||
bUpperSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
wxBoxSizer* bLeftSizer;
|
||||
bLeftSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_buttonOk = new wxButton( this, wxID_OK, _("Ok"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bLeftSizer->Add( m_buttonOk, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
|
||||
|
||||
m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bLeftSizer->Add( m_buttonCancel, 0, wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_buttonSave = new wxButton( this, ID_SAVE_CFG, _("Save Cfg"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_buttonSave->SetToolTip( _("Accept and save current configuration setting in the local .pro file") );
|
||||
|
||||
bLeftSizer->Add( m_buttonSave, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 );
|
||||
|
||||
|
||||
bLeftSizer->Add( 0, 20, 1, wxEXPAND, 5 );
|
||||
|
||||
wxStaticBoxSizer* sFileExtBox;
|
||||
sFileExtBox = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Files ext:") ), wxVERTICAL );
|
||||
|
||||
m_InfoCmpFileExt = new wxStaticText( this, wxID_ANY, _("Cmp file Ext: "), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_InfoCmpFileExt->Wrap( -1 );
|
||||
sFileExtBox->Add( m_InfoCmpFileExt, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_InfoLibFileExt = new wxStaticText( this, wxID_ANY, _("Library file Ext: "), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_InfoLibFileExt->Wrap( -1 );
|
||||
sFileExtBox->Add( m_InfoLibFileExt, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_InfoNetlistFileExt = new wxStaticText( this, wxID_ANY, _("Netlist file Ext: "), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_InfoNetlistFileExt->Wrap( -1 );
|
||||
sFileExtBox->Add( m_InfoNetlistFileExt, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_InfoEquivFileExt = new wxStaticText( this, wxID_ANY, _("Equiv file Ext: "), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_InfoEquivFileExt->Wrap( -1 );
|
||||
sFileExtBox->Add( m_InfoEquivFileExt, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_InfoRetroannotFileExt = new wxStaticText( this, wxID_ANY, _("Retro file Ext: "), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_InfoRetroannotFileExt->Wrap( -1 );
|
||||
sFileExtBox->Add( m_InfoRetroannotFileExt, 0, wxALL, 5 );
|
||||
|
||||
bLeftSizer->Add( sFileExtBox, 0, wxEXPAND, 5 );
|
||||
|
||||
wxString m_radioBoxCloseOptChoices[] = { _("Close after Save"), _("Keep Open") };
|
||||
int m_radioBoxCloseOptNChoices = sizeof( m_radioBoxCloseOptChoices ) / sizeof( wxString );
|
||||
m_radioBoxCloseOpt = new wxRadioBox( this, wxID_ANY, _("Cvpcb Close Option:"), wxDefaultPosition, wxDefaultSize, m_radioBoxCloseOptNChoices, m_radioBoxCloseOptChoices, 1, wxRA_SPECIFY_COLS );
|
||||
m_radioBoxCloseOpt->SetSelection( 0 );
|
||||
m_radioBoxCloseOpt->SetToolTip( _("After saving the nelist and the components files, Cvpcb can be kept open, or automatically closed") );
|
||||
|
||||
bLeftSizer->Add( m_radioBoxCloseOpt, 0, wxALL, 5 );
|
||||
|
||||
bUpperSizer->Add( bLeftSizer, 0, wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
wxStaticBoxSizer* sbLibsChoiceSizer;
|
||||
sbLibsChoiceSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Libraries") ), wxVERTICAL );
|
||||
sbLibsChoiceSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Footprint library files") ), wxHORIZONTAL );
|
||||
|
||||
wxBoxSizer* bLibsButtonsSizer;
|
||||
bLibsButtonsSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
m_ListLibr = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_HSCROLL|wxLB_NEEDED_SB|wxLB_SINGLE );
|
||||
m_ListLibr->SetToolTip( _("List of active library files.\nOnly library files in this list are loaded by Pcbnew.\nThe order of this list is important:\nPcbnew searchs for a given footprint using this list order priority.") );
|
||||
m_ListLibr->SetMinSize( wxSize( 450,-1 ) );
|
||||
|
||||
sbLibsChoiceSizer->Add( bLibsButtonsSizer, 0, wxALIGN_CENTER_HORIZONTAL, 5 );
|
||||
|
||||
m_staticTextlibList = new wxStaticText( this, wxID_ANY, _("Active Libraries:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextlibList->Wrap( -1 );
|
||||
sbLibsChoiceSizer->Add( m_staticTextlibList, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
sbLibsChoiceSizer->Add( m_ListLibr, 1, wxALL|wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bSizerLibButtons;
|
||||
bSizerLibButtons = new wxBoxSizer( wxHORIZONTAL );
|
||||
bSizerLibButtons = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_buttonAddLib = new wxButton( this, ID_ADD_LIB, _("Add"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_buttonAddLib->SetToolTip( _("Add a new library after the selected library, and load it") );
|
||||
|
||||
bSizerLibButtons->Add( m_buttonAddLib, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
|
||||
bSizerLibButtons->Add( m_buttonAddLib, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
m_buttonInsLib = new wxButton( this, ID_INSERT_LIB, _("Insert"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_buttonInsLib->SetToolTip( _("Add a new library before the selected library, and load it") );
|
||||
|
||||
bSizerLibButtons->Add( m_buttonInsLib, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxBOTTOM, 5 );
|
||||
bSizerLibButtons->Add( m_buttonInsLib, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
m_buttonRemoveLib = new wxButton( this, ID_REMOVE_LIB, _("Remove"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_buttonRemoveLib->SetToolTip( _("Unload the selected library") );
|
||||
|
||||
bSizerLibButtons->Add( m_buttonRemoveLib, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
|
||||
bSizerLibButtons->Add( m_buttonRemoveLib, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
sbLibsChoiceSizer->Add( bSizerLibButtons, 0, wxALIGN_CENTER_HORIZONTAL, 5 );
|
||||
sbLibsChoiceSizer->Add( bSizerLibButtons, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_ListLibr = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_HSCROLL|wxLB_NEEDED_SB|wxLB_SINGLE );
|
||||
m_ListLibr->SetToolTip( _("List of active library files.\nOnly library files in this list are loaded by Pcbnew.\nThe order of this list is important:\nPcbnew searchs for a given footprint using this list order priority.") );
|
||||
m_ListLibr->SetMinSize( wxSize( 200,-1 ) );
|
||||
|
||||
sbLibsChoiceSizer->Add( m_ListLibr, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
bUpperSizer->Add( sbLibsChoiceSizer, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );
|
||||
bMainSizer->Add( sbLibsChoiceSizer, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
wxStaticBoxSizer* sbEquivChoiceSizer;
|
||||
sbEquivChoiceSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Libraries") ), wxVERTICAL );
|
||||
sbEquivChoiceSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Footprint alias files") ), wxHORIZONTAL );
|
||||
|
||||
wxBoxSizer* bEquivButtonsSizer;
|
||||
bEquivButtonsSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
m_ListEquiv = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_HSCROLL|wxLB_NEEDED_SB|wxLB_SINGLE );
|
||||
m_ListEquiv->SetToolTip( _("List of active library files.\nOnly library files in this list are loaded by Pcbnew.\nThe order of this list is important:\nPcbnew searchs for a given footprint using this list order priority.") );
|
||||
m_ListEquiv->SetMinSize( wxSize( 400,-1 ) );
|
||||
|
||||
sbEquivChoiceSizer->Add( bEquivButtonsSizer, 0, wxALIGN_CENTER_HORIZONTAL, 5 );
|
||||
|
||||
m_staticTextEquList = new wxStaticText( this, wxID_ANY, _("Active Equivalente Files:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextEquList->Wrap( -1 );
|
||||
sbEquivChoiceSizer->Add( m_staticTextEquList, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
sbEquivChoiceSizer->Add( m_ListEquiv, 1, wxALL|wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bSizerEquButtons;
|
||||
bSizerEquButtons = new wxBoxSizer( wxHORIZONTAL );
|
||||
bSizerEquButtons = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_buttonAddEqu = new wxButton( this, ID_ADD_EQU, _("Add"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_buttonAddEqu->SetToolTip( _("Add a new library after the selected library, and load it") );
|
||||
|
||||
bSizerEquButtons->Add( m_buttonAddEqu, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
|
||||
bSizerEquButtons->Add( m_buttonAddEqu, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT|wxTOP, 5 );
|
||||
|
||||
m_buttonInsEqu = new wxButton( this, ID_INSERT_EQU, _("Insert"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_buttonInsEqu->SetToolTip( _("Add a new library before the selected library, and load it") );
|
||||
|
||||
bSizerEquButtons->Add( m_buttonInsEqu, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxBOTTOM, 5 );
|
||||
bSizerEquButtons->Add( m_buttonInsEqu, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
m_buttonRemoveEqu = new wxButton( this, ID_REMOVE_EQU, _("Remove"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_buttonRemoveEqu->SetToolTip( _("Unload the selected library") );
|
||||
|
||||
bSizerEquButtons->Add( m_buttonRemoveEqu, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
|
||||
bSizerEquButtons->Add( m_buttonRemoveEqu, 0, wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
sbEquivChoiceSizer->Add( bSizerEquButtons, 0, wxALIGN_CENTER_HORIZONTAL, 5 );
|
||||
sbEquivChoiceSizer->Add( bSizerEquButtons, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_ListEquiv = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_HSCROLL|wxLB_NEEDED_SB|wxLB_SINGLE );
|
||||
m_ListEquiv->SetToolTip( _("List of active library files.\nOnly library files in this list are loaded by Pcbnew.\nThe order of this list is important:\nPcbnew searchs for a given footprint using this list order priority.") );
|
||||
m_ListEquiv->SetMinSize( wxSize( 200,-1 ) );
|
||||
|
||||
sbEquivChoiceSizer->Add( m_ListEquiv, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
bUpperSizer->Add( sbEquivChoiceSizer, 1, wxEXPAND, 5 );
|
||||
|
||||
bMainSizer->Add( bUpperSizer, 1, wxEXPAND, 5 );
|
||||
|
||||
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
bMainSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
|
||||
bMainSizer->Add( sbEquivChoiceSizer, 1, wxALL|wxEXPAND, 5 );
|
||||
|
||||
wxStaticBoxSizer* sbModulesDocSizer;
|
||||
sbModulesDocSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Module Doc File:") ), wxHORIZONTAL );
|
||||
sbModulesDocSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Footprint documentation file") ), wxHORIZONTAL );
|
||||
|
||||
m_TextHelpModulesFileName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
sbModulesDocSizer->Add( m_TextHelpModulesFileName, 1, wxALL, 5 );
|
||||
sbModulesDocSizer->Add( m_TextHelpModulesFileName, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_buttonModDoc = new wxButton( this, ID_BROWSE_MOD_DOC, _("Browse"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
sbModulesDocSizer->Add( m_buttonModDoc, 0, wxALL, 5 );
|
||||
|
||||
bMainSizer->Add( sbModulesDocSizer, 0, wxEXPAND, 5 );
|
||||
|
||||
wxStaticBoxSizer* sbLibPathSizer;
|
||||
sbLibPathSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Path for Libraries Files:") ), wxVERTICAL );
|
||||
|
||||
wxBoxSizer* bUserLibPathSizer;
|
||||
bUserLibPathSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
bMainSizer->Add( sbModulesDocSizer, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
wxStaticBoxSizer* sbSizer4;
|
||||
sbSizer4 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("User Path:") ), wxHORIZONTAL );
|
||||
sbSizer4 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("User defined search paths") ), wxHORIZONTAL );
|
||||
|
||||
wxBoxSizer* bUserListSizer;
|
||||
bUserListSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_listUserPaths = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
|
||||
m_listUserPaths = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_NEEDED_SB );
|
||||
m_listUserPaths->SetToolTip( _("Additional paths used in this project. The priority is highter than default Kicad paths.") );
|
||||
m_listUserPaths->SetMinSize( wxSize( 300,-1 ) );
|
||||
|
||||
bUserListSizer->Add( m_listUserPaths, 1, wxEXPAND, 5 );
|
||||
bUserListSizer->Add( m_listUserPaths, 1, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 );
|
||||
|
||||
sbSizer4->Add( bUserListSizer, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
|
||||
sbSizer4->Add( bUserListSizer, 1, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bUserPathsButtonsSizer;
|
||||
bUserPathsButtonsSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
@ -198,32 +115,40 @@ DIALOG_CVPCB_CONFIG_FBP::DIALOG_CVPCB_CONFIG_FBP( wxWindow* parent, wxWindowID i
|
|||
m_buttonRemovePath = new wxButton( this, ID_REMOVE_PATH, _("Remove"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bUserPathsButtonsSizer->Add( m_buttonRemovePath, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
sbSizer4->Add( bUserPathsButtonsSizer, 0, wxEXPAND, 5 );
|
||||
sbSizer4->Add( bUserPathsButtonsSizer, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
bUserLibPathSizer->Add( sbSizer4, 1, wxEXPAND, 5 );
|
||||
bMainSizer->Add( sbSizer4, 1, wxALL|wxEXPAND, 5 );
|
||||
|
||||
sbLibPathSizer->Add( bUserLibPathSizer, 1, wxEXPAND, 5 );
|
||||
|
||||
m_staticTextcurrenpaths = new wxStaticText( this, wxID_ANY, _("Current Full Paths for Libraries Files in Use:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextcurrenpaths->Wrap( -1 );
|
||||
sbLibPathSizer->Add( m_staticTextcurrenpaths, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
wxStaticBoxSizer* sbSizer6;
|
||||
sbSizer6 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Current search path list") ), wxHORIZONTAL );
|
||||
|
||||
m_DefaultLibraryPathslistBox = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_NEEDED_SB );
|
||||
m_DefaultLibraryPathslistBox->SetToolTip( _("Paths (system paths and user paths) used to search and load libraries files and component doc files.\nSorted by decreasing priority order.") );
|
||||
m_DefaultLibraryPathslistBox->SetMinSize( wxSize( -1,70 ) );
|
||||
|
||||
sbLibPathSizer->Add( m_DefaultLibraryPathslistBox, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
sbSizer6->Add( m_DefaultLibraryPathslistBox, 1, wxALL|wxEXPAND, 5 );
|
||||
|
||||
bMainSizer->Add( sbLibPathSizer, 0, wxEXPAND, 5 );
|
||||
bMainSizer->Add( sbSizer6, 1, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
bMainSizer->Add( m_staticline2, 0, wxEXPAND | wxALL, 5 );
|
||||
|
||||
m_sdbSizer2 = new wxStdDialogButtonSizer();
|
||||
m_sdbSizer2OK = new wxButton( this, wxID_OK );
|
||||
m_sdbSizer2->AddButton( m_sdbSizer2OK );
|
||||
m_sdbSizer2Cancel = new wxButton( this, wxID_CANCEL );
|
||||
m_sdbSizer2->AddButton( m_sdbSizer2Cancel );
|
||||
m_sdbSizer2->Realize();
|
||||
bMainSizer->Add( m_sdbSizer2, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
this->SetSizer( bMainSizer );
|
||||
this->Layout();
|
||||
bMainSizer->Fit( this );
|
||||
|
||||
this->Centre( wxBOTH );
|
||||
|
||||
// Connect Events
|
||||
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_CVPCB_CONFIG_FBP::OnCloseWindow ) );
|
||||
m_buttonOk->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CVPCB_CONFIG_FBP::OnOkClick ), NULL, this );
|
||||
m_buttonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CVPCB_CONFIG_FBP::OnCancelClick ), NULL, this );
|
||||
m_buttonSave->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CVPCB_CONFIG_FBP::OnSaveCfgClick ), NULL, this );
|
||||
m_buttonAddLib->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CVPCB_CONFIG_FBP::OnAddOrInsertLibClick ), NULL, this );
|
||||
m_buttonInsLib->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CVPCB_CONFIG_FBP::OnAddOrInsertLibClick ), NULL, this );
|
||||
m_buttonRemoveLib->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CVPCB_CONFIG_FBP::OnRemoveLibClick ), NULL, this );
|
||||
|
@ -234,15 +159,14 @@ DIALOG_CVPCB_CONFIG_FBP::DIALOG_CVPCB_CONFIG_FBP( wxWindow* parent, wxWindowID i
|
|||
m_buttonAddPath->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CVPCB_CONFIG_FBP::OnAddOrInsertPath ), NULL, this );
|
||||
m_buttonInsPath->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CVPCB_CONFIG_FBP::OnAddOrInsertPath ), NULL, this );
|
||||
m_buttonRemovePath->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CVPCB_CONFIG_FBP::OnRemoveUserPath ), NULL, this );
|
||||
m_sdbSizer2Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CVPCB_CONFIG_FBP::OnCancelClick ), NULL, this );
|
||||
m_sdbSizer2OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CVPCB_CONFIG_FBP::OnOkClick ), NULL, this );
|
||||
}
|
||||
|
||||
DIALOG_CVPCB_CONFIG_FBP::~DIALOG_CVPCB_CONFIG_FBP()
|
||||
{
|
||||
// Disconnect Events
|
||||
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_CVPCB_CONFIG_FBP::OnCloseWindow ) );
|
||||
m_buttonOk->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CVPCB_CONFIG_FBP::OnOkClick ), NULL, this );
|
||||
m_buttonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CVPCB_CONFIG_FBP::OnCancelClick ), NULL, this );
|
||||
m_buttonSave->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CVPCB_CONFIG_FBP::OnSaveCfgClick ), NULL, this );
|
||||
m_buttonAddLib->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CVPCB_CONFIG_FBP::OnAddOrInsertLibClick ), NULL, this );
|
||||
m_buttonInsLib->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CVPCB_CONFIG_FBP::OnAddOrInsertLibClick ), NULL, this );
|
||||
m_buttonRemoveLib->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CVPCB_CONFIG_FBP::OnRemoveLibClick ), NULL, this );
|
||||
|
@ -253,4 +177,6 @@ DIALOG_CVPCB_CONFIG_FBP::~DIALOG_CVPCB_CONFIG_FBP()
|
|||
m_buttonAddPath->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CVPCB_CONFIG_FBP::OnAddOrInsertPath ), NULL, this );
|
||||
m_buttonInsPath->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CVPCB_CONFIG_FBP::OnAddOrInsertPath ), NULL, this );
|
||||
m_buttonRemovePath->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CVPCB_CONFIG_FBP::OnRemoveUserPath ), NULL, this );
|
||||
m_sdbSizer2Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CVPCB_CONFIG_FBP::OnCancelClick ), NULL, this );
|
||||
m_sdbSizer2OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CVPCB_CONFIG_FBP::OnOkClick ), NULL, this );
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -11,18 +11,16 @@
|
|||
#include <wx/intl.h>
|
||||
|
||||
#include <wx/string.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/listbox.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/statbox.h>
|
||||
#include <wx/radiobox.h>
|
||||
#include <wx/listbox.h>
|
||||
#include <wx/statline.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/statline.h>
|
||||
#include <wx/dialog.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
@ -37,8 +35,7 @@ class DIALOG_CVPCB_CONFIG_FBP : public wxDialog
|
|||
protected:
|
||||
enum
|
||||
{
|
||||
ID_SAVE_CFG = 1000,
|
||||
ID_ADD_LIB,
|
||||
ID_ADD_LIB = 1000,
|
||||
ID_INSERT_LIB,
|
||||
ID_REMOVE_LIB,
|
||||
ID_ADD_EQU,
|
||||
|
@ -50,50 +47,39 @@ class DIALOG_CVPCB_CONFIG_FBP : public wxDialog
|
|||
ID_REMOVE_PATH,
|
||||
};
|
||||
|
||||
wxButton* m_buttonOk;
|
||||
wxButton* m_buttonCancel;
|
||||
wxButton* m_buttonSave;
|
||||
|
||||
wxStaticText* m_InfoCmpFileExt;
|
||||
wxStaticText* m_InfoLibFileExt;
|
||||
wxStaticText* m_InfoNetlistFileExt;
|
||||
wxStaticText* m_InfoEquivFileExt;
|
||||
wxStaticText* m_InfoRetroannotFileExt;
|
||||
wxRadioBox* m_radioBoxCloseOpt;
|
||||
wxStaticText* m_staticTextlibList;
|
||||
wxListBox* m_ListLibr;
|
||||
wxButton* m_buttonAddLib;
|
||||
wxButton* m_buttonInsLib;
|
||||
wxButton* m_buttonRemoveLib;
|
||||
wxListBox* m_ListLibr;
|
||||
wxStaticText* m_staticTextEquList;
|
||||
wxListBox* m_ListEquiv;
|
||||
wxButton* m_buttonAddEqu;
|
||||
wxButton* m_buttonInsEqu;
|
||||
wxButton* m_buttonRemoveEqu;
|
||||
wxListBox* m_ListEquiv;
|
||||
wxStaticLine* m_staticline1;
|
||||
wxTextCtrl* m_TextHelpModulesFileName;
|
||||
wxButton* m_buttonModDoc;
|
||||
wxListBox* m_listUserPaths;
|
||||
wxButton* m_buttonAddPath;
|
||||
wxButton* m_buttonInsPath;
|
||||
wxButton* m_buttonRemovePath;
|
||||
wxStaticText* m_staticTextcurrenpaths;
|
||||
wxListBox* m_DefaultLibraryPathslistBox;
|
||||
wxStaticLine* m_staticline2;
|
||||
wxStdDialogButtonSizer* m_sdbSizer2;
|
||||
wxButton* m_sdbSizer2OK;
|
||||
wxButton* m_sdbSizer2Cancel;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnCloseWindow( wxCloseEvent& event ){ event.Skip(); }
|
||||
virtual void OnOkClick( wxCommandEvent& event ){ event.Skip(); }
|
||||
virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); }
|
||||
virtual void OnSaveCfgClick( wxCommandEvent& event ){ event.Skip(); }
|
||||
virtual void OnAddOrInsertLibClick( wxCommandEvent& event ){ event.Skip(); }
|
||||
virtual void OnRemoveLibClick( wxCommandEvent& event ){ event.Skip(); }
|
||||
virtual void OnBrowseModDocFile( wxCommandEvent& event ){ event.Skip(); }
|
||||
virtual void OnAddOrInsertPath( wxCommandEvent& event ){ event.Skip(); }
|
||||
virtual void OnRemoveUserPath( wxCommandEvent& event ){ event.Skip(); }
|
||||
virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); }
|
||||
virtual void OnOkClick( wxCommandEvent& event ){ event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
DIALOG_CVPCB_CONFIG_FBP( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 641,612 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
DIALOG_CVPCB_CONFIG_FBP( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
~DIALOG_CVPCB_CONFIG_FBP();
|
||||
|
||||
};
|
||||
|
|
|
@ -57,8 +57,6 @@ IMPLEMENT_DYNAMIC_CLASS( WinEDA_FootprintDisplayOptionsFrame, wxDialog )
|
|||
BEGIN_EVENT_TABLE( WinEDA_FootprintDisplayOptionsFrame, wxDialog )
|
||||
|
||||
////@begin WinEDA_FootprintDisplayOptionsFrame event table entries
|
||||
EVT_BUTTON( ID_SAVE_CONFIG, WinEDA_FootprintDisplayOptionsFrame::OnSaveConfigClick )
|
||||
|
||||
EVT_BUTTON( wxID_OK, WinEDA_FootprintDisplayOptionsFrame::OnOkClick )
|
||||
|
||||
EVT_BUTTON( wxID_CANCEL, WinEDA_FootprintDisplayOptionsFrame::OnCancelClick )
|
||||
|
@ -98,7 +96,6 @@ bool WinEDA_FootprintDisplayOptionsFrame::Create( wxWindow* parent, wxWindowID i
|
|||
ColumnBoxSizer = NULL;
|
||||
m_IsShowPadFill = NULL;
|
||||
m_IsShowPadNum = NULL;
|
||||
BottomBoxSizer = NULL;
|
||||
m_CancelButton = NULL;
|
||||
////@end WinEDA_FootprintDisplayOptionsFrame member initialisation
|
||||
|
||||
|
@ -122,10 +119,8 @@ bool WinEDA_FootprintDisplayOptionsFrame::Create( wxWindow* parent, wxWindowID i
|
|||
|
||||
void WinEDA_FootprintDisplayOptionsFrame::CreateControls()
|
||||
{
|
||||
SetFont(*g_DialogFont);
|
||||
|
||||
////@begin WinEDA_FootprintDisplayOptionsFrame content construction
|
||||
// Generated by DialogBlocks, 21/07/2008 15:12:47 (unregistered)
|
||||
// Generated by DialogBlocks, 16/04/2009 14:23:49 (unregistered)
|
||||
|
||||
WinEDA_FootprintDisplayOptionsFrame* itemDialog1 = this;
|
||||
|
||||
|
@ -152,40 +147,34 @@ void WinEDA_FootprintDisplayOptionsFrame::CreateControls()
|
|||
MainBoxSizer->Add(m_TextDisplayOption, 0, wxALIGN_TOP|wxALL, 5);
|
||||
|
||||
ColumnBoxSizer = new wxBoxSizer(wxVERTICAL);
|
||||
MainBoxSizer->Add(ColumnBoxSizer, 1, wxALIGN_TOP|wxLEFT|wxRIGHT|wxTOP, 5);
|
||||
MainBoxSizer->Add(ColumnBoxSizer, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
|
||||
m_IsShowPadFill = new wxCheckBox( itemDialog1, PADFILL_OPT, _("&Pad Filled"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
|
||||
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_IsShowPadNum = new wxCheckBox( itemDialog1, PADNUM_OPT, _("Display Pad &Num"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
|
||||
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);
|
||||
|
||||
ColumnBoxSizer->Add(5, 5, 0, wxGROW|wxTOP, 5);
|
||||
wxStaticLine* itemStaticLine9 = new wxStaticLine( itemDialog1, ID_STATICLINE1, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
OuterBoxSizer->Add(itemStaticLine9, 0, wxGROW|wxALL, 5);
|
||||
|
||||
wxButton* itemButton10 = new wxButton( itemDialog1, ID_SAVE_CONFIG, _("Save Cfg"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
ColumnBoxSizer->Add(itemButton10, 0, wxALIGN_LEFT|wxALL, 5);
|
||||
wxStdDialogButtonSizer* itemStdDialogButtonSizer10 = new wxStdDialogButtonSizer;
|
||||
|
||||
wxStaticLine* itemStaticLine11 = new wxStaticLine( itemDialog1, ID_STATICLINE1, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
OuterBoxSizer->Add(itemStaticLine11, 0, wxGROW|wxALL, 5);
|
||||
|
||||
BottomBoxSizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
OuterBoxSizer->Add(BottomBoxSizer, 0, wxALIGN_RIGHT|wxALL, 5);
|
||||
|
||||
wxButton* itemButton13 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemButton13->SetDefault();
|
||||
itemButton13->SetForegroundColour(wxColour(255, 0, 0));
|
||||
BottomBoxSizer->Add(itemButton13, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
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 );
|
||||
m_CancelButton->SetForegroundColour(wxColour(0, 0, 255));
|
||||
BottomBoxSizer->Add(m_CancelButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
itemStdDialogButtonSizer10->AddButton(m_CancelButton);
|
||||
|
||||
wxButton* itemButton15 = new wxButton( itemDialog1, wxID_APPLY, _("&Apply"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
BottomBoxSizer->Add(itemButton15, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
wxButton* itemButton13 = new wxButton( itemDialog1, wxID_APPLY, _("&Apply"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemStdDialogButtonSizer10->AddButton(itemButton13);
|
||||
|
||||
itemStdDialogButtonSizer10->Realize();
|
||||
|
||||
// Set validators
|
||||
m_EdgesDisplayOption->SetValidator( wxGenericValidator(& DisplayOpt.DisplayModEdge) );
|
||||
|
@ -240,33 +229,14 @@ void WinEDA_FootprintDisplayOptionsFrame::UpdateObjectSettings(void)
|
|||
{
|
||||
// Update settings
|
||||
////@begin WinEDA_FootprintDisplayOptionsFrame update settings
|
||||
DisplayOpt.DisplayModEdge = m_Parent->m_DisplayModEdge =
|
||||
m_EdgesDisplayOption->GetSelection();
|
||||
|
||||
DisplayOpt.DisplayModText = m_Parent->m_DisplayModText =
|
||||
m_TextDisplayOption->GetSelection();
|
||||
|
||||
DisplayOpt.DisplayPadNum = m_Parent->m_DisplayPadNum =
|
||||
m_IsShowPadNum->GetValue();
|
||||
|
||||
DisplayOpt.DisplayPadFill = m_Parent->m_DisplayPadFill =
|
||||
m_IsShowPadFill->GetValue();
|
||||
|
||||
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->DrawPanel->Refresh();
|
||||
////@end WinEDA_FootprintDisplayOptionsFrame update settings
|
||||
}
|
||||
|
||||
/*!
|
||||
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_SAVE_CONFIG
|
||||
*/
|
||||
|
||||
void WinEDA_FootprintDisplayOptionsFrame::OnSaveConfigClick( wxCommandEvent& event )
|
||||
{
|
||||
WinEDA_CvpcbFrame* parent = ( WinEDA_CvpcbFrame* )GetParent();
|
||||
wxASSERT( parent && parent->IsKindOf( CLASSINFO( WinEDA_CvpcbFrame ) ) );
|
||||
Save_Config( this, parent->m_NetlistFileName.GetFullPath() );
|
||||
}
|
||||
|
||||
/*!
|
||||
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
|
||||
*/
|
||||
|
|
|
@ -45,7 +45,6 @@ class wxBoxSizer;
|
|||
#define TEXT_SELECT 10002
|
||||
#define PADFILL_OPT 10003
|
||||
#define PADNUM_OPT 10004
|
||||
#define ID_SAVE_CONFIG 10005
|
||||
#define ID_STATICLINE1 10006
|
||||
#define SYMBOL_WINEDA_FOOTPRINTDISPLAYOPTIONSFRAME_STYLE wxDEFAULT_DIALOG_STYLE|MAYBE_RESIZE_BORDER
|
||||
#define SYMBOL_WINEDA_FOOTPRINTDISPLAYOPTIONSFRAME_TITLE _("Display Options")
|
||||
|
@ -84,9 +83,6 @@ public:
|
|||
|
||||
////@begin WinEDA_FootprintDisplayOptionsFrame event handler declarations
|
||||
|
||||
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_SAVE_CONFIG
|
||||
void OnSaveConfigClick( wxCommandEvent& event );
|
||||
|
||||
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
|
||||
void OnOkClick( wxCommandEvent& event );
|
||||
|
||||
|
@ -120,7 +116,6 @@ public:
|
|||
wxBoxSizer* ColumnBoxSizer;
|
||||
wxCheckBox* m_IsShowPadFill;
|
||||
wxCheckBox* m_IsShowPadNum;
|
||||
wxBoxSizer* BottomBoxSizer;
|
||||
wxButton* m_CancelButton;
|
||||
////@end WinEDA_FootprintDisplayOptionsFrame member variables
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
<string name="resource_prefix">""</string>
|
||||
<bool name="use_two_step_construction">0</bool>
|
||||
<bool name="use_enums">0</bool>
|
||||
<bool name="generate_for_xrced">0</bool>
|
||||
<string name="current_platform">"<All platforms>"</string>
|
||||
<string name="target_wx_version">"<Any>"</string>
|
||||
<string name="cpp_header_comment">"/////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -114,6 +115,7 @@
|
|||
<bool name="archive_all_image_files">0</bool>
|
||||
<bool name="xrc_retain_relative_paths">1</bool>
|
||||
<bool name="xrc_generate_id_tags">0</bool>
|
||||
<bool name="xrc_use_name_property">0</bool>
|
||||
</header>
|
||||
<data>
|
||||
<document>
|
||||
|
@ -136,7 +138,7 @@
|
|||
<long name="locked">0</long>
|
||||
<string name="template-name">""</string>
|
||||
<bool name="dirty">1</bool>
|
||||
<long name="makefile-last-written">0</long>
|
||||
<long name="makefile-last-written">-8519680</long>
|
||||
<string name="Compiler name">""</string>
|
||||
<string name="Build mode">"Debug"</string>
|
||||
<string name="Unicode mode">"ANSI"</string>
|
||||
|
@ -157,6 +159,7 @@
|
|||
<string name="Compiler location">"%AUTO%"</string>
|
||||
<string name="wxWidgets location">"%AUTO%"</string>
|
||||
<string name="C++ command">"%AUTO%"</string>
|
||||
<string name="C command">"%AUTO%"</string>
|
||||
<string name="Resource compiler">"%AUTO%"</string>
|
||||
<string name="Make command">"%AUTO%"</string>
|
||||
<string name="Project makefile">"%AUTO%"</string>
|
||||
|
@ -168,6 +171,7 @@
|
|||
<string name="Optimizations">"%AUTO%"</string>
|
||||
<string name="Warnings">"%AUTO%"</string>
|
||||
<string name="Debug flags">"%AUTO%"</string>
|
||||
<string name="Extra compile flags">"%AUTO%"</string>
|
||||
<string name="Libraries">"%AUTO%"</string>
|
||||
<string name="Library path">"%AUTO%"</string>
|
||||
<string name="Linker flags">"%AUTO%"</string>
|
||||
|
@ -180,6 +184,7 @@
|
|||
<string name="PATH variable">"%AUTO%"</string>
|
||||
<bool name="Suppress source rules">0</bool>
|
||||
<bool name="Enable makefile generation">1</bool>
|
||||
<string name="CFG">""</string>
|
||||
</document>
|
||||
</document>
|
||||
</data>
|
||||
|
@ -465,13 +470,13 @@
|
|||
<string name="proxy-Orientation">"Vertical"</string>
|
||||
<string name="proxy-Member variable name">"ColumnBoxSizer"</string>
|
||||
<string name="proxy-AlignH">"Centre"</string>
|
||||
<string name="proxy-AlignV">"Top"</string>
|
||||
<string name="proxy-AlignV">"Centre"</string>
|
||||
<long name="proxy-Stretch factor">1</long>
|
||||
<long name="proxy-Border">5</long>
|
||||
<bool name="proxy-wxLEFT">1</bool>
|
||||
<bool name="proxy-wxRIGHT">1</bool>
|
||||
<bool name="proxy-wxTOP">1</bool>
|
||||
<bool name="proxy-wxBOTTOM">0</bool>
|
||||
<bool name="proxy-wxBOTTOM">1</bool>
|
||||
<bool name="proxy-wxSHAPED">0</bool>
|
||||
<bool name="proxy-wxADJUST_MINSIZE">0</bool>
|
||||
<bool name="proxy-wxFIXED_MINSIZE">0</bool>
|
||||
|
@ -497,7 +502,7 @@
|
|||
<string name="proxy-Implementation filename">""</string>
|
||||
<string name="proxy-Header filename">""</string>
|
||||
<string name="proxy-Member variable name">"m_IsShowPadFill"</string>
|
||||
<string name="proxy-Label">"&Pad Filled"</string>
|
||||
<string name="proxy-Label">"Fill &pad"</string>
|
||||
<bool name="proxy-Initial value">0</bool>
|
||||
<string name="proxy-Help text">""</string>
|
||||
<string name="proxy-Tooltip text">""</string>
|
||||
|
@ -561,7 +566,7 @@
|
|||
<string name="proxy-Implementation filename">""</string>
|
||||
<string name="proxy-Header filename">""</string>
|
||||
<string name="proxy-Member variable name">"m_IsShowPadNum"</string>
|
||||
<string name="proxy-Label">"Display Pad &Num"</string>
|
||||
<string name="proxy-Label">"Show pad &number"</string>
|
||||
<bool name="proxy-Initial value">0</bool>
|
||||
<string name="proxy-Help text">""</string>
|
||||
<string name="proxy-Tooltip text">"Display pad number"</string>
|
||||
|
@ -604,99 +609,6 @@
|
|||
<string name="proxy-Custom arguments">""</string>
|
||||
<string name="proxy-Custom ctor arguments">""</string>
|
||||
</document>
|
||||
<document>
|
||||
<string name="title">"Spacer"</string>
|
||||
<string name="type">"dialog-control-document"</string>
|
||||
<string name="filename">""</string>
|
||||
<string name="icon-name">"spacer"</string>
|
||||
<long name="is-transient">0</long>
|
||||
<long name="owns-file">1</long>
|
||||
<long name="title-mode">0</long>
|
||||
<long name="locked">0</long>
|
||||
<string name="created">"24/10/2007"</string>
|
||||
<string name="proxy-type">"wbSpacerProxy"</string>
|
||||
<long name="proxy-Width">5</long>
|
||||
<long name="proxy-Height">5</long>
|
||||
<string name="proxy-AlignH">"Expand"</string>
|
||||
<string name="proxy-AlignV">"Centre"</string>
|
||||
<long name="proxy-Stretch factor">0</long>
|
||||
<long name="proxy-Border">5</long>
|
||||
<bool name="proxy-wxLEFT">0</bool>
|
||||
<bool name="proxy-wxRIGHT">0</bool>
|
||||
<bool name="proxy-wxTOP">1</bool>
|
||||
<bool name="proxy-wxBOTTOM">0</bool>
|
||||
<bool name="proxy-wxSHAPED">0</bool>
|
||||
<bool name="proxy-wxADJUST_MINSIZE">0</bool>
|
||||
<bool name="proxy-wxFIXED_MINSIZE">0</bool>
|
||||
<string name="proxy-Platform">"<Any platform>"</string>
|
||||
</document>
|
||||
<document>
|
||||
<string name="title">"wxButton: ID_SAVE_CONFIG"</string>
|
||||
<string name="type">"dialog-control-document"</string>
|
||||
<string name="filename">""</string>
|
||||
<string name="icon-name">"dialogcontrol"</string>
|
||||
<long name="is-transient">0</long>
|
||||
<long name="owns-file">1</long>
|
||||
<long name="title-mode">0</long>
|
||||
<long name="locked">0</long>
|
||||
<string name="created">"24/10/2007"</string>
|
||||
<string name="proxy-type">"wbButtonProxy"</string>
|
||||
<string name="event-handler-0">"wxEVT_COMMAND_BUTTON_CLICKED|OnSaveConfigClick|||"</string>
|
||||
<string name="proxy-Id name">"ID_SAVE_CONFIG"</string>
|
||||
<long name="proxy-Id value">10005</long>
|
||||
<string name="proxy-Name">""</string>
|
||||
<string name="proxy-Class">"wxButton"</string>
|
||||
<string name="proxy-Base class">"wxButton"</string>
|
||||
<bool name="proxy-External implementation">1</bool>
|
||||
<bool name="proxy-Separate files">0</bool>
|
||||
<string name="proxy-Implementation filename">""</string>
|
||||
<string name="proxy-Header filename">""</string>
|
||||
<string name="proxy-Member variable name">""</string>
|
||||
<string name="proxy-Label">"Save Cfg"</string>
|
||||
<bool name="proxy-Default">0</bool>
|
||||
<string name="proxy-Help text">""</string>
|
||||
<string name="proxy-Tooltip text">""</string>
|
||||
<string name="proxy-Data variable">""</string>
|
||||
<string name="proxy-Data validator">""</string>
|
||||
<string name="proxy-Data source">""</string>
|
||||
<string name="proxy-Data class name">""</string>
|
||||
<string name="proxy-Data class implementation filename">""</string>
|
||||
<string name="proxy-Data class header filename">""</string>
|
||||
<string name="proxy-Data class manager window">""</string>
|
||||
<string name="proxy-Background colour">""</string>
|
||||
<string name="proxy-Foreground colour">""</string>
|
||||
<string name="proxy-Font">""</string>
|
||||
<bool name="proxy-Hidden">0</bool>
|
||||
<bool name="proxy-Enabled">1</bool>
|
||||
<string name="proxy-Platform">"<Any platform>"</string>
|
||||
<bool name="proxy-wxBU_LEFT">0</bool>
|
||||
<bool name="proxy-wxBU_RIGHT">0</bool>
|
||||
<bool name="proxy-wxBU_TOP">0</bool>
|
||||
<bool name="proxy-wxBU_BOTTOM">0</bool>
|
||||
<bool name="proxy-wxBU_EXACTFIT">0</bool>
|
||||
<bool name="proxy-wxNO_BORDER">0</bool>
|
||||
<bool name="proxy-wxWANTS_CHARS">0</bool>
|
||||
<bool name="proxy-wxNO_FULL_REPAINT_ON_RESIZE">0</bool>
|
||||
<bool name="proxy-wxFULL_REPAINT_ON_RESIZE">0</bool>
|
||||
<string name="proxy-Custom styles">""</string>
|
||||
<long name="proxy-X">-1</long>
|
||||
<long name="proxy-Y">-1</long>
|
||||
<long name="proxy-Width">-1</long>
|
||||
<long name="proxy-Height">-1</long>
|
||||
<string name="proxy-AlignH">"Left"</string>
|
||||
<string name="proxy-AlignV">"Centre"</string>
|
||||
<long name="proxy-Stretch factor">0</long>
|
||||
<long name="proxy-Border">5</long>
|
||||
<bool name="proxy-wxLEFT">1</bool>
|
||||
<bool name="proxy-wxRIGHT">1</bool>
|
||||
<bool name="proxy-wxTOP">1</bool>
|
||||
<bool name="proxy-wxBOTTOM">1</bool>
|
||||
<bool name="proxy-wxSHAPED">0</bool>
|
||||
<bool name="proxy-wxADJUST_MINSIZE">0</bool>
|
||||
<bool name="proxy-wxFIXED_MINSIZE">0</bool>
|
||||
<string name="proxy-Custom arguments">""</string>
|
||||
<string name="proxy-Custom ctor arguments">""</string>
|
||||
</document>
|
||||
</document>
|
||||
</document>
|
||||
<document>
|
||||
|
@ -755,7 +667,7 @@
|
|||
<bool name="proxy-wxFIXED_MINSIZE">0</bool>
|
||||
</document>
|
||||
<document>
|
||||
<string name="title">"wxBoxSizer H"</string>
|
||||
<string name="title">"wxStdDialogButtonSizer"</string>
|
||||
<string name="type">"dialog-control-document"</string>
|
||||
<string name="filename">""</string>
|
||||
<string name="icon-name">"sizer"</string>
|
||||
|
@ -763,11 +675,17 @@
|
|||
<long name="owns-file">1</long>
|
||||
<long name="title-mode">0</long>
|
||||
<long name="locked">0</long>
|
||||
<string name="created">"24/10/2007"</string>
|
||||
<string name="proxy-type">"wbBoxSizerProxy"</string>
|
||||
<string name="proxy-Orientation">"Horizontal"</string>
|
||||
<string name="proxy-Member variable name">"BottomBoxSizer"</string>
|
||||
<string name="proxy-AlignH">"Right"</string>
|
||||
<string name="proxy-type">"wbStdDialogButtonSizerProxy"</string>
|
||||
<bool name="proxy-wxID_OK">1</bool>
|
||||
<bool name="proxy-wxID_CANCEL">1</bool>
|
||||
<bool name="proxy-wxID_YES">0</bool>
|
||||
<bool name="proxy-wxID_NO">0</bool>
|
||||
<bool name="proxy-wxID_HELP">0</bool>
|
||||
<bool name="proxy-wxID_APPLY">1</bool>
|
||||
<bool name="proxy-wxID_SAVE">0</bool>
|
||||
<bool name="proxy-wxID_CONTEXT_HELP">0</bool>
|
||||
<string name="proxy-Member variable name">""</string>
|
||||
<string name="proxy-AlignH">"Centre"</string>
|
||||
<string name="proxy-AlignV">"Centre"</string>
|
||||
<long name="proxy-Stretch factor">0</long>
|
||||
<long name="proxy-Border">5</long>
|
||||
|
@ -787,10 +705,9 @@
|
|||
<long name="is-transient">0</long>
|
||||
<long name="owns-file">1</long>
|
||||
<long name="title-mode">0</long>
|
||||
<long name="locked">0</long>
|
||||
<string name="created">"24/10/2007"</string>
|
||||
<long name="locked">1</long>
|
||||
<string name="proxy-type">"wbButtonProxy"</string>
|
||||
<string name="event-handler-0">"wxEVT_COMMAND_BUTTON_CLICKED|OnOkClick|NONE||"</string>
|
||||
<string name="event-handler-0">"wxEVT_COMMAND_BUTTON_CLICKED|OnOkClick|NONE||WinEDA_FootprintDisplayOptionsFrame"</string>
|
||||
<string name="proxy-Id name">"wxID_OK"</string>
|
||||
<long name="proxy-Id value">5100</long>
|
||||
<string name="proxy-Name">""</string>
|
||||
|
@ -802,7 +719,7 @@
|
|||
<string name="proxy-Header filename">""</string>
|
||||
<string name="proxy-Member variable name">""</string>
|
||||
<string name="proxy-Label">"&OK"</string>
|
||||
<bool name="proxy-Default">1</bool>
|
||||
<bool name="proxy-Default">0</bool>
|
||||
<string name="proxy-Help text">""</string>
|
||||
<string name="proxy-Tooltip text">""</string>
|
||||
<string name="proxy-Data variable">""</string>
|
||||
|
@ -813,7 +730,7 @@
|
|||
<string name="proxy-Data class header filename">""</string>
|
||||
<string name="proxy-Data class manager window">""</string>
|
||||
<string name="proxy-Background colour">""</string>
|
||||
<string name="proxy-Foreground colour">"FF0000"</string>
|
||||
<string name="proxy-Foreground colour">""</string>
|
||||
<string name="proxy-Font">""</string>
|
||||
<bool name="proxy-Hidden">0</bool>
|
||||
<bool name="proxy-Enabled">1</bool>
|
||||
|
@ -854,8 +771,7 @@
|
|||
<long name="is-transient">0</long>
|
||||
<long name="owns-file">1</long>
|
||||
<long name="title-mode">0</long>
|
||||
<long name="locked">0</long>
|
||||
<string name="created">"24/10/2007"</string>
|
||||
<long name="locked">1</long>
|
||||
<string name="proxy-type">"wbButtonProxy"</string>
|
||||
<string name="event-handler-0">"wxEVT_COMMAND_BUTTON_CLICKED|OnCancelClick|NONE||WinEDA_FootprintDisplayOptionsFrame"</string>
|
||||
<string name="proxy-Id name">"wxID_CANCEL"</string>
|
||||
|
@ -880,7 +796,7 @@
|
|||
<string name="proxy-Data class header filename">""</string>
|
||||
<string name="proxy-Data class manager window">""</string>
|
||||
<string name="proxy-Background colour">""</string>
|
||||
<string name="proxy-Foreground colour">"0000FF"</string>
|
||||
<string name="proxy-Foreground colour">""</string>
|
||||
<string name="proxy-Font">""</string>
|
||||
<bool name="proxy-Hidden">0</bool>
|
||||
<bool name="proxy-Enabled">1</bool>
|
||||
|
@ -921,10 +837,9 @@
|
|||
<long name="is-transient">0</long>
|
||||
<long name="owns-file">1</long>
|
||||
<long name="title-mode">0</long>
|
||||
<long name="locked">0</long>
|
||||
<string name="created">"24/10/2007"</string>
|
||||
<long name="locked">1</long>
|
||||
<string name="proxy-type">"wbButtonProxy"</string>
|
||||
<string name="event-handler-0">"wxEVT_COMMAND_BUTTON_CLICKED|OnApplyClick|NONE||"</string>
|
||||
<string name="event-handler-0">"wxEVT_COMMAND_BUTTON_CLICKED|OnApplyClick|NONE||WinEDA_FootprintDisplayOptionsFrame"</string>
|
||||
<string name="proxy-Id name">"wxID_APPLY"</string>
|
||||
<long name="proxy-Id value">5102</long>
|
||||
<string name="proxy-Name">""</string>
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
/* Construction de la table des evenements pour WinEDA_DrawFrame */
|
||||
/*****************************************************************/
|
||||
|
||||
BEGIN_EVENT_TABLE( WinEDA_DisplayFrame, WinEDA_DrawFrame )
|
||||
BEGIN_EVENT_TABLE( WinEDA_DisplayFrame, WinEDA_BasePcbFrame )
|
||||
EVT_CLOSE( WinEDA_DisplayFrame::OnCloseWindow )
|
||||
EVT_SIZE( WinEDA_DrawFrame::OnSize )
|
||||
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA_DisplayFrame::OnZoom )
|
||||
|
|
|
@ -17,12 +17,13 @@
|
|||
|
||||
void WinEDA_CvpcbFrame::WriteStuffList( wxCommandEvent& event )
|
||||
{
|
||||
FILE* FileEquiv;
|
||||
STORECMP* Cmp;
|
||||
wxString Line;
|
||||
COMPONENT_LIST::iterator i;
|
||||
FILE* FileEquiv;
|
||||
COMPONENT* Cmp;
|
||||
wxString Line;
|
||||
wxFileName fn = m_NetlistFileName;
|
||||
|
||||
if( nbcomp <= 0 )
|
||||
if( m_components.GetCount() <= 0 )
|
||||
return;
|
||||
|
||||
/* calcul du nom du fichier */
|
||||
|
@ -45,8 +46,10 @@ void WinEDA_CvpcbFrame::WriteStuffList( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
/* Generation de la liste */
|
||||
for( Cmp = g_BaseListeCmp; Cmp != NULL; Cmp = Cmp->Pnext )
|
||||
for( i = m_components.begin(); i != m_components.end(); ++i )
|
||||
{
|
||||
Cmp = *i;
|
||||
|
||||
/* génération du composant si son empreinte est définie */
|
||||
if( Cmp->m_Module.IsEmpty() )
|
||||
continue;
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/***************/
|
||||
/* genorcad() */
|
||||
/***************/
|
||||
/***************/
|
||||
/* genorcad() */
|
||||
/***************/
|
||||
|
||||
/*
|
||||
ComplŠte la netliste (*.NET) en y placant les ref *.lib FORMAT ORCADPCB
|
||||
La valeur (Part Value) est tronquee a 16 lettres
|
||||
*/
|
||||
* ComplŠte la netliste (*.NET) en y placant les ref *.lib FORMAT ORCADPCB
|
||||
* La valeur (Part Value) est tronquee a 16 lettres
|
||||
*/
|
||||
|
||||
#include "fctsys.h"
|
||||
|
||||
|
@ -17,185 +17,174 @@ La valeur (Part Value) est tronquee a 16 lettres
|
|||
#define MAX_LEN_NETNAME 16
|
||||
|
||||
/* Routines locales */
|
||||
static void TriPinsModule( STORECMP * CurrentCmp );
|
||||
static int PinCompare(const void *cmp1, const void *cmp2);
|
||||
static void ChangePinNet( wxString & PinNet );
|
||||
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; /* Nombre utilise pour cree des NetNames lors de
|
||||
* reaffectation de NetNames */
|
||||
|
||||
int genorcad()
|
||||
int genorcad( bool rightJustify )
|
||||
{
|
||||
char Line[1024];
|
||||
STOREPIN * Pin;
|
||||
STORECMP * CurrentCmp;
|
||||
wxString Title = wxGetApp().GetAppName() + wxT(" ") + GetBuildVersion();
|
||||
char Line[1024];
|
||||
PIN* Pin;
|
||||
COMPONENT* CurrentCmp;
|
||||
wxString Title = wxGetApp().GetAppName() + wxT( " " ) + GetBuildVersion();
|
||||
|
||||
NetNumCode = 1; DateAndTime(Line);
|
||||
fprintf(dest,"( { Netlist by %s, date = %s }\n",
|
||||
CONV_TO_UTF8(Title), Line ) ;
|
||||
NetNumCode = 1; DateAndTime( Line );
|
||||
fprintf( dest, "( { Netlist by %s, date = %s }\n",
|
||||
CONV_TO_UTF8( Title ), Line );
|
||||
|
||||
/***********************/
|
||||
/* Lecture de la liste */
|
||||
/***********************/
|
||||
/***********************/
|
||||
/* Lecture de la liste */
|
||||
/***********************/
|
||||
|
||||
CurrentCmp = BaseListeCmp;
|
||||
for( ; CurrentCmp != NULL; CurrentCmp = CurrentCmp->Pnext)
|
||||
{
|
||||
fprintf(dest," ( %s ", CONV_TO_UTF8(CurrentCmp->m_TimeStamp));
|
||||
CurrentCmp = BaseListeCmp;
|
||||
for( ; CurrentCmp != NULL; CurrentCmp = CurrentCmp->Pnext )
|
||||
{
|
||||
fprintf( dest, " ( %s ", CONV_TO_UTF8( CurrentCmp->m_TimeStamp ) );
|
||||
|
||||
if( ! CurrentCmp->m_Module.IsEmpty() )
|
||||
fprintf(dest, CONV_TO_UTF8(CurrentCmp->m_Module));
|
||||
if( !CurrentCmp->m_Module.IsEmpty() )
|
||||
fprintf( dest, CONV_TO_UTF8( CurrentCmp->m_Module ) );
|
||||
|
||||
else fprintf(dest,"$noname$") ;
|
||||
else
|
||||
fprintf( dest, "$noname$" );
|
||||
|
||||
fprintf(dest," %s ",CONV_TO_UTF8(CurrentCmp->m_Reference)) ;
|
||||
fprintf( dest, " %s ", CONV_TO_UTF8( CurrentCmp->m_Reference ) );
|
||||
|
||||
/* placement de la valeur */
|
||||
fprintf(dest,"%s\n",CONV_TO_UTF8(CurrentCmp->m_Valeur)) ;
|
||||
/* placement de la valeur */
|
||||
fprintf( dest, "%s\n", CONV_TO_UTF8( CurrentCmp->m_Valeur ) );
|
||||
|
||||
/* Tri des pins */
|
||||
TriPinsModule( CurrentCmp );
|
||||
/* Tri des pins */
|
||||
TriPinsModule( CurrentCmp );
|
||||
|
||||
/* Placement de la liste des pins */
|
||||
Pin = CurrentCmp->m_Pins;
|
||||
for( ; Pin != NULL; Pin = Pin->Pnext )
|
||||
{
|
||||
if( Pin->m_PinNet.Len() > MAX_LEN_NETNAME)
|
||||
ChangePinNet( Pin->m_PinNet );
|
||||
|
||||
if( ! Pin->m_PinNet.IsEmpty() )
|
||||
fprintf(dest," ( %s %s )\n",
|
||||
CONV_TO_UTF8(Pin->m_PinNum),
|
||||
CONV_TO_UTF8(Pin->m_PinNet));
|
||||
else
|
||||
fprintf(dest," ( %s ? )\n", CONV_TO_UTF8(Pin->m_PinNum));
|
||||
}
|
||||
fprintf(dest," )\n");
|
||||
}
|
||||
fprintf(dest,")\n*\n");
|
||||
fclose(dest);
|
||||
return(0);
|
||||
/* Placement de la liste des pins */
|
||||
Pin = CurrentCmp->m_Pins;
|
||||
for( ; Pin != NULL; Pin = Pin->Pnext )
|
||||
{
|
||||
if( Pin->m_PinNet.Len() > MAX_LEN_NETNAME )
|
||||
ChangePinNet( Pin->m_PinNet, rightJustify );
|
||||
|
||||
if( !Pin->m_PinNet.IsEmpty() )
|
||||
fprintf( dest, " ( %s %s )\n",
|
||||
CONV_TO_UTF8( Pin->m_PinNum ),
|
||||
CONV_TO_UTF8( Pin->m_PinNet ) );
|
||||
else
|
||||
fprintf( dest, " ( %s ? )\n", CONV_TO_UTF8( Pin->m_PinNum ) );
|
||||
}
|
||||
|
||||
fprintf( dest, " )\n" );
|
||||
}
|
||||
|
||||
fprintf( dest, ")\n*\n" );
|
||||
fclose( dest );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************/
|
||||
static void TriPinsModule( COMPONENT* CurrentCmp )
|
||||
/***********************************************/
|
||||
|
||||
/***********************************************/
|
||||
static void TriPinsModule( STORECMP * CurrentCmp )
|
||||
/***********************************************/
|
||||
/* Tri et controle des pins du module CurrentCmp
|
||||
*/
|
||||
*/
|
||||
{
|
||||
STOREPIN * Pin, * NextPin, ** BasePin;
|
||||
int nbpins = 0, ii;
|
||||
PIN* Pin, * NextPin, ** BasePin;
|
||||
int nbpins = 0, ii;
|
||||
|
||||
Pin = CurrentCmp->m_Pins;
|
||||
if( Pin == NULL ) return;
|
||||
Pin = CurrentCmp->m_Pins;
|
||||
if( Pin == NULL )
|
||||
return;
|
||||
|
||||
/* comptage des pins */
|
||||
for( ; Pin != NULL ; Pin = Pin->Pnext ) nbpins++;
|
||||
/* comptage des pins */
|
||||
for( ; Pin != NULL; Pin = Pin->Pnext )
|
||||
nbpins++;
|
||||
|
||||
/* Tri des pins: etablissement de la liste des pointeurs */
|
||||
BasePin = (STOREPIN ** )MyZMalloc( nbpins * sizeof(STOREPIN*) );
|
||||
/* Tri des pins: etablissement de la liste des pointeurs */
|
||||
BasePin = (PIN**) MyZMalloc( nbpins * sizeof(PIN*) );
|
||||
|
||||
Pin = CurrentCmp->m_Pins;
|
||||
for( ii = 0 ; ii < nbpins ; ii++, Pin = Pin->Pnext )
|
||||
{
|
||||
BasePin[ii] = Pin;
|
||||
}
|
||||
/* Tri des Pins */
|
||||
qsort( BasePin, nbpins, sizeof( STORECMP*), PinCompare) ;
|
||||
Pin = CurrentCmp->m_Pins;
|
||||
for( ii = 0; ii < nbpins; ii++, Pin = Pin->Pnext )
|
||||
{
|
||||
BasePin[ii] = Pin;
|
||||
}
|
||||
|
||||
/* Remise a jour des pointeurs chaines */
|
||||
for( ii = 0 ; ii < nbpins-1 ; ii++ )
|
||||
{
|
||||
BasePin[ii]->Pnext = BasePin[ii+1];
|
||||
}
|
||||
BasePin[ii]->Pnext = NULL;
|
||||
CurrentCmp->m_Pins = BasePin[0];
|
||||
/* Tri des Pins */
|
||||
qsort( BasePin, nbpins, sizeof( COMPONENT*), PinCompare );
|
||||
|
||||
MyFree(BasePin);
|
||||
/* Remise a jour des pointeurs chaines */
|
||||
for( ii = 0; ii < nbpins - 1; ii++ )
|
||||
{
|
||||
BasePin[ii]->Pnext = BasePin[ii + 1];
|
||||
}
|
||||
|
||||
/* Elimination des redondances */
|
||||
Pin = CurrentCmp->m_Pins;
|
||||
while( Pin != NULL)
|
||||
{
|
||||
NextPin = Pin->Pnext;
|
||||
if ( NextPin == NULL ) break;
|
||||
if( Pin->m_PinNum != NextPin->m_PinNum )
|
||||
{
|
||||
Pin = Pin->Pnext; continue;
|
||||
}
|
||||
/* 2 pins successives ont le meme numero */
|
||||
if( Pin->m_PinNet != NextPin->m_PinNet )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _("%s %s pin %s : Different Nets"),
|
||||
CurrentCmp->m_Reference.GetData(),CurrentCmp->m_Valeur.GetData(),
|
||||
Pin->m_PinNum.GetData());
|
||||
DisplayError(NULL, msg, 60 );
|
||||
}
|
||||
Pin->Pnext = NextPin->Pnext;
|
||||
delete NextPin;
|
||||
}
|
||||
}
|
||||
BasePin[ii]->Pnext = NULL;
|
||||
CurrentCmp->m_Pins = BasePin[0];
|
||||
|
||||
MyFree( BasePin );
|
||||
|
||||
/*******************************************************/
|
||||
static int PinCompare(const void *cmp1,const void *cmp2)
|
||||
/*******************************************************/
|
||||
/*
|
||||
routine PinCompare() pour qsort() pour classement alphabetique
|
||||
pour tri de la liste des Pins
|
||||
*/
|
||||
{
|
||||
STOREPIN **pt1 , **pt2 ;
|
||||
int ii;
|
||||
|
||||
pt1 = (STOREPIN**)cmp1;
|
||||
pt2 = (STOREPIN**)cmp2;
|
||||
|
||||
ii = StrLenNumICmp( (*pt1)->m_PinNum.GetData(), (*pt2)->m_PinNum.GetData(), 4);
|
||||
return(ii);
|
||||
/* Elimination des redondances */
|
||||
Pin = CurrentCmp->m_Pins;
|
||||
while( Pin != NULL )
|
||||
{
|
||||
NextPin = Pin->Pnext;
|
||||
if( NextPin == NULL )
|
||||
break;
|
||||
if( Pin->m_PinNum != NextPin->m_PinNum )
|
||||
{
|
||||
Pin = Pin->Pnext; continue;
|
||||
}
|
||||
/* 2 pins successives ont le meme numero */
|
||||
if( Pin->m_PinNet != NextPin->m_PinNet )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "%s %s pin %s : Different Nets" ),
|
||||
CurrentCmp->m_Reference.GetData(),
|
||||
CurrentCmp->m_Valeur.GetData(),
|
||||
Pin->m_PinNum.GetData() );
|
||||
DisplayError( NULL, msg, 60 );
|
||||
}
|
||||
Pin->Pnext = NextPin->Pnext;
|
||||
delete NextPin;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************/
|
||||
static void ChangePinNet( wxString & PinNet )
|
||||
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
|
||||
*/
|
||||
* suivi de _Xnnnnn ou nnnnn est un nom de 0 a 99999
|
||||
*/
|
||||
{
|
||||
STOREPIN * Pin;
|
||||
STORECMP * CurrentCmp;
|
||||
int ii;
|
||||
wxString OldName;
|
||||
wxString NewName;
|
||||
PIN* Pin;
|
||||
COMPONENT* CurrentCmp;
|
||||
int ii;
|
||||
wxString OldName;
|
||||
wxString NewName;
|
||||
|
||||
OldName = PinNet;
|
||||
ii = PinNet.Len();
|
||||
if( Rjustify ) /* On conserve les 8 dernieres lettres du nom */
|
||||
{
|
||||
NewName= OldName.Right(8); NewName << NetNumCode;
|
||||
}
|
||||
OldName = PinNet;
|
||||
ii = PinNet.Len();
|
||||
if( rightJustify ) /* On conserve les 8 dernieres lettres du nom */
|
||||
{
|
||||
NewName = OldName.Right( 8 ); NewName << NetNumCode;
|
||||
}
|
||||
else /* On conserve les 8 premieres lettres du nom */
|
||||
{
|
||||
NewName = OldName.Left( 8 ); NewName << NetNumCode;
|
||||
}
|
||||
NetNumCode++;
|
||||
|
||||
else /* On conserve les 8 premieres lettres du nom */
|
||||
{
|
||||
NewName = OldName.Left(8); NewName << NetNumCode;
|
||||
}
|
||||
NetNumCode ++;
|
||||
|
||||
CurrentCmp = BaseListeCmp;
|
||||
for( ; CurrentCmp != NULL; CurrentCmp = CurrentCmp->Pnext)
|
||||
{
|
||||
Pin = CurrentCmp->m_Pins;
|
||||
for( ; Pin != NULL; Pin = Pin->Pnext )
|
||||
{
|
||||
if( Pin->m_PinNet != OldName ) continue;
|
||||
Pin->m_PinNet = NewName;
|
||||
}
|
||||
}
|
||||
CurrentCmp = BaseListeCmp;
|
||||
for( ; CurrentCmp != NULL; CurrentCmp = CurrentCmp->Pnext )
|
||||
{
|
||||
Pin = CurrentCmp->m_Pins;
|
||||
for( ; Pin != NULL; Pin = Pin->Pnext )
|
||||
{
|
||||
if( Pin->m_PinNet != OldName )
|
||||
continue;
|
||||
Pin->m_PinNet = NewName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
102
cvpcb/init.cpp
102
cvpcb/init.cpp
|
@ -19,20 +19,19 @@
|
|||
/* routines locales : */
|
||||
|
||||
|
||||
/**********************************************************/
|
||||
void WinEDA_CvpcbFrame::SetNewPkg( const wxString& package )
|
||||
/*********************************************************/
|
||||
|
||||
/*
|
||||
* - Affecte un module au composant selectionne
|
||||
* - Selectionne le composant suivant
|
||||
*/
|
||||
void WinEDA_CvpcbFrame::SetNewPkg( const wxString& package )
|
||||
{
|
||||
STORECMP* Composant;
|
||||
int ii, NumCmp, IsNew = 1;
|
||||
wxString Line;
|
||||
COMPONENT_LIST::iterator i;
|
||||
COMPONENT* Component;
|
||||
bool isUndefined = false;
|
||||
int NumCmp;
|
||||
wxString Line;
|
||||
|
||||
if( g_BaseListeCmp == NULL )
|
||||
if( m_components.empty() )
|
||||
return;
|
||||
|
||||
NumCmp = m_ListCmp->GetSelection();
|
||||
|
@ -42,26 +41,22 @@ void WinEDA_CvpcbFrame::SetNewPkg( const wxString& package )
|
|||
m_ListCmp->SetSelection( NumCmp, TRUE );
|
||||
}
|
||||
|
||||
Composant = g_BaseListeCmp;
|
||||
for( ii = 0; Composant != NULL; Composant = Composant->Pnext, ii++ )
|
||||
{
|
||||
if( NumCmp == ii )
|
||||
break;
|
||||
}
|
||||
Component = m_components[ NumCmp ];
|
||||
|
||||
if( Composant == NULL )
|
||||
if( Component == NULL )
|
||||
return;
|
||||
if( !Composant->m_Module.IsEmpty() )
|
||||
IsNew = 0;
|
||||
|
||||
Composant->m_Module = package;
|
||||
isUndefined = Component->m_Module.IsEmpty();
|
||||
|
||||
Line.Printf( CMP_FORMAT, ii + 1,
|
||||
Composant->m_Reference.GetData(), Composant->m_Valeur.GetData(),
|
||||
Composant->m_Module.GetData() );
|
||||
modified = 1;
|
||||
if( IsNew )
|
||||
composants_non_affectes -= 1;
|
||||
Component->m_Module = package;
|
||||
|
||||
Line.Printf( CMP_FORMAT, NumCmp + 1,
|
||||
Component->m_Reference.GetData(), Component->m_Valeur.GetData(),
|
||||
Component->m_Module.GetData() );
|
||||
m_modified = true;
|
||||
|
||||
if( isUndefined )
|
||||
m_undefinedComponentCnt -= 1;
|
||||
|
||||
m_ListCmp->SetString( NumCmp, Line );
|
||||
m_ListCmp->SetSelection( NumCmp, FALSE );
|
||||
|
@ -72,22 +67,21 @@ void WinEDA_CvpcbFrame::SetNewPkg( const wxString& package )
|
|||
m_ListCmp->SetSelection( NumCmp, TRUE );
|
||||
|
||||
Line.Printf( _( "Components: %d (free: %d)" ),
|
||||
nbcomp, composants_non_affectes );
|
||||
m_components.GetCount(), m_undefinedComponentCnt );
|
||||
SetStatusText( Line, 1 );
|
||||
}
|
||||
|
||||
|
||||
/********************************************/
|
||||
bool WinEDA_CvpcbFrame::ReadNetList()
|
||||
/*******************************************/
|
||||
|
||||
/* Lecture de la netliste selon format, ainsi que du fichier des composants
|
||||
/*
|
||||
* Lecture de la netliste selon format, ainsi que du fichier des composants
|
||||
*/
|
||||
bool WinEDA_CvpcbFrame::ReadNetList()
|
||||
{
|
||||
STORECMP* Composant;
|
||||
wxString msg;
|
||||
int ii;
|
||||
int error_level;
|
||||
COMPONENT_LIST::iterator i;
|
||||
COMPONENT* Component;
|
||||
wxString msg;
|
||||
int error_level;
|
||||
|
||||
error_level = ReadSchematicNetlist();
|
||||
|
||||
|
@ -101,36 +95,35 @@ bool WinEDA_CvpcbFrame::ReadNetList()
|
|||
}
|
||||
|
||||
/* lecture des correspondances */
|
||||
loadcmp( m_NetlistFileName.GetFullPath() );
|
||||
LoadComponentFile( m_NetlistFileName.GetFullPath(), m_components );
|
||||
|
||||
if( m_ListCmp == NULL )
|
||||
return false;
|
||||
|
||||
Read_Config( m_NetlistFileName.GetFullPath() );
|
||||
|
||||
listlib();
|
||||
LoadProjectFile( m_NetlistFileName.GetFullPath() );
|
||||
LoadFootprintFiles( m_ModuleLibNames, m_footprints );
|
||||
BuildFootprintListBox();
|
||||
|
||||
m_ListCmp->Clear();
|
||||
Composant = g_BaseListeCmp;
|
||||
|
||||
composants_non_affectes = 0;
|
||||
for( ii = 1; Composant != NULL; Composant = Composant->Pnext, ii++ )
|
||||
m_undefinedComponentCnt = 0;
|
||||
for( i = m_components.begin(); i != m_components.end(); ++i )
|
||||
{
|
||||
msg.Printf( CMP_FORMAT, ii,
|
||||
Composant->m_Reference.GetData(),
|
||||
Composant->m_Valeur.GetData(),
|
||||
Composant->m_Module.GetData() );
|
||||
Component = *i;
|
||||
msg.Printf( CMP_FORMAT, m_ListCmp->GetCount() + 1,
|
||||
Component->m_Reference.GetData(),
|
||||
Component->m_Valeur.GetData(),
|
||||
Component->m_Module.GetData() );
|
||||
m_ListCmp->AppendLine( msg );
|
||||
if( Composant->m_Module.IsEmpty() )
|
||||
composants_non_affectes += 1;
|
||||
if( Component->m_Module.IsEmpty() )
|
||||
m_undefinedComponentCnt += 1;
|
||||
}
|
||||
|
||||
if( g_BaseListeCmp )
|
||||
if( !m_components.empty() )
|
||||
m_ListCmp->SetSelection( 0, TRUE );
|
||||
|
||||
msg.Printf( _( "Components: %d (free: %d)" ), nbcomp,
|
||||
composants_non_affectes );
|
||||
msg.Printf( _( "Components: %d (free: %d)" ), m_components.GetCount(),
|
||||
m_undefinedComponentCnt );
|
||||
SetStatusText( msg, 1 );
|
||||
|
||||
/* Mise a jour du titre de la fenetre principale */
|
||||
|
@ -140,14 +133,12 @@ bool WinEDA_CvpcbFrame::ReadNetList()
|
|||
}
|
||||
|
||||
|
||||
/*****************************************************************/
|
||||
int WinEDA_CvpcbFrame::SaveNetList( const wxString& fileName )
|
||||
/*****************************************************************/
|
||||
|
||||
/* Sauvegarde des fichiers netliste et cmp
|
||||
/*
|
||||
* Sauvegarde des fichiers netliste et cmp
|
||||
* Le nom complet du fichier Netliste doit etre dans FFileName.
|
||||
* Le nom du fichier cmp en est deduit
|
||||
*/
|
||||
int WinEDA_CvpcbFrame::SaveNetList( const wxString& fileName )
|
||||
{
|
||||
wxFileName fn;
|
||||
|
||||
|
@ -177,7 +168,8 @@ int WinEDA_CvpcbFrame::SaveNetList( const wxString& fileName )
|
|||
return 0;
|
||||
}
|
||||
|
||||
GenNetlistPcbnew( netlist );
|
||||
GenNetlistPcbnew( netlist, m_components, m_isEESchemaNetlist,
|
||||
m_rightJustify );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
/* Not directly used: the 2 list boxes actually used are derived from it */
|
||||
/******************************************************************************/
|
||||
|
||||
ListBoxBase::ListBoxBase( WinEDA_CvpcbFrame* parent,
|
||||
wxWindowID id, const wxPoint& loc, const wxSize& size ) :
|
||||
ListBoxBase::ListBoxBase( WinEDA_CvpcbFrame* parent, wxWindowID id,
|
||||
const wxPoint& loc, const wxSize& size ) :
|
||||
LIST_BOX_TYPE( parent, id, loc, size,
|
||||
wxSUNKEN_BORDER | wxLC_NO_HEADER |
|
||||
wxLC_SINGLE_SEL | wxLC_REPORT | wxLC_VIRTUAL )
|
||||
|
@ -38,7 +38,7 @@ ListBoxBase::~ListBoxBase()
|
|||
void ListBoxBase::OnSize( wxSizeEvent& event )
|
||||
/************************************************/
|
||||
|
||||
// Ajust the column width to the entire available window width
|
||||
// Adjust the column width to the entire available window width
|
||||
{
|
||||
wxSize size = GetClientSize();
|
||||
int width = 0;
|
||||
|
@ -66,7 +66,8 @@ int ListBoxBase::GetSelection()
|
|||
/***************************************/
|
||||
|
||||
FootprintListBox::FootprintListBox( WinEDA_CvpcbFrame* parent,
|
||||
wxWindowID id, const wxPoint& loc, const wxSize& size,
|
||||
wxWindowID id, const wxPoint& loc,
|
||||
const wxSize& size,
|
||||
int nbitems, wxString choice[] ) :
|
||||
ListBoxBase( parent, id, loc, size )
|
||||
{
|
||||
|
@ -138,7 +139,7 @@ void FootprintListBox::AppendLine( const wxString& text )
|
|||
wxString FootprintListBox::OnGetItemText( long item, long column ) const
|
||||
/*********************************************************************/
|
||||
|
||||
/* Overlayed function: MUST be provided in wxLC_VIRTUAL mode
|
||||
/* Overlaid function: MUST be provided in wxLC_VIRTUAL mode
|
||||
* because real data is not handled by ListBoxBase
|
||||
*/
|
||||
{
|
||||
|
@ -197,7 +198,7 @@ END_EVENT_TABLE()
|
|||
void ListBoxCmp::Clear()
|
||||
/****************************/
|
||||
|
||||
// Reset ALL datas
|
||||
// Reset ALL data
|
||||
{
|
||||
m_ComponentList.Clear();
|
||||
SetItemCount( 0 );
|
||||
|
@ -242,8 +243,8 @@ void ListBoxCmp::AppendLine( const wxString& text )
|
|||
wxString ListBoxCmp::OnGetItemText( long item, long column ) const
|
||||
/****************************************************************/
|
||||
|
||||
/* Overlayed function: MUST be provided in wxLC_VIRTUAL mode
|
||||
* because real datas are not handled by ListBoxBase
|
||||
/* Overlaid function: MUST be provided in wxLC_VIRTUAL mode
|
||||
* because real data are not handled by ListBoxBase
|
||||
*/
|
||||
{
|
||||
return m_ComponentList.Item( item );
|
||||
|
@ -279,10 +280,11 @@ void WinEDA_CvpcbFrame::BuildCmpListBox()
|
|||
/* Create or update the schematic components list.
|
||||
*/
|
||||
{
|
||||
int ii;
|
||||
STORECMP* Composant;
|
||||
wxString msg;
|
||||
wxSize size( 10, 10 );
|
||||
COMPONENT_LIST::iterator i;
|
||||
COMPONENT* Component;
|
||||
wxString msg;
|
||||
wxSize size( 10, 10 );
|
||||
wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
|
||||
|
||||
if( m_ListCmp == NULL )
|
||||
{
|
||||
|
@ -291,21 +293,25 @@ void WinEDA_CvpcbFrame::BuildCmpListBox()
|
|||
0, NULL );
|
||||
m_ListCmp->SetBackgroundColour( wxColour( 225, 255, 255 ) );
|
||||
m_ListCmp->SetForegroundColour( wxColour( 0, 0, 0 ) );
|
||||
m_ListCmp->SetFont( *g_FixedFont );
|
||||
m_ListCmp->SetFont( wxFont( guiFont.GetPointSize(),
|
||||
wxFONTFAMILY_MODERN,
|
||||
wxFONTSTYLE_NORMAL,
|
||||
wxFONTWEIGHT_NORMAL ) );
|
||||
}
|
||||
|
||||
m_ListCmp->m_ComponentList.Clear();
|
||||
Composant = g_BaseListeCmp;
|
||||
for( ii = 1; Composant != NULL; Composant = Composant->Pnext, ii++ )
|
||||
|
||||
for( i = m_components.begin(); i != m_components.end(); ++i )
|
||||
{
|
||||
msg.Printf( CMP_FORMAT, ii,
|
||||
Composant->m_Reference.GetData(), Composant->m_Valeur.GetData(),
|
||||
Composant->m_Module.GetData() );
|
||||
Component = *i;
|
||||
msg.Printf( CMP_FORMAT, m_ListCmp->GetCount() + 1,
|
||||
Component->m_Reference.GetData(),
|
||||
Component->m_Valeur.GetData(),
|
||||
Component->m_Module.GetData() );
|
||||
m_ListCmp->m_ComponentList.Add( msg );
|
||||
}
|
||||
|
||||
m_ListCmp->SetItemCount( m_ListCmp->m_ComponentList.Count() );
|
||||
|
||||
m_ListCmp->SetSelection( 0, TRUE );
|
||||
}
|
||||
|
||||
|
@ -319,6 +325,7 @@ void WinEDA_CvpcbFrame::BuildFootprintListBox()
|
|||
{
|
||||
wxString msg;
|
||||
wxSize size( 10, 10 );
|
||||
wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
|
||||
|
||||
if( m_FootprintList == NULL )
|
||||
{
|
||||
|
@ -327,10 +334,13 @@ void WinEDA_CvpcbFrame::BuildFootprintListBox()
|
|||
0, NULL );
|
||||
m_FootprintList->SetBackgroundColour( wxColour( 225, 255, 225 ) );
|
||||
m_FootprintList->SetForegroundColour( wxColour( 0, 0, 0 ) );
|
||||
m_FootprintList->SetFont( *g_FixedFont );
|
||||
m_FootprintList->SetFont( wxFont( guiFont.GetPointSize(),
|
||||
wxFONTFAMILY_MODERN,
|
||||
wxFONTSTYLE_NORMAL,
|
||||
wxFONTWEIGHT_NORMAL ) );
|
||||
}
|
||||
|
||||
m_FootprintList->SetFootprintFullList();
|
||||
m_FootprintList->SetFootprintFullList( m_footprints );
|
||||
|
||||
msg.Printf( _( "Footprints: %d" ), m_FootprintList->GetCount() );
|
||||
SetStatusText( msg, 2 );
|
||||
|
@ -338,51 +348,57 @@ void WinEDA_CvpcbFrame::BuildFootprintListBox()
|
|||
|
||||
|
||||
/************************************************/
|
||||
void FootprintListBox::SetFootprintFullList()
|
||||
/************************************************/
|
||||
void FootprintListBox::SetFootprintFullList( FOOTPRINT_LIST& list )
|
||||
{
|
||||
STOREMOD* FootprintItem;
|
||||
wxString msg;
|
||||
int OldSelection = GetSelection();
|
||||
FOOTPRINT_LIST::iterator i;
|
||||
FOOTPRINT* footprint;
|
||||
wxString msg;
|
||||
int OldSelection = GetSelection();
|
||||
|
||||
m_FullFootprintList.Clear();
|
||||
FootprintItem = g_BaseListePkg;
|
||||
|
||||
for( int ii = 1; FootprintItem != NULL; FootprintItem = FootprintItem->Pnext, ii++ )
|
||||
for( i = list.begin(); i != list.end(); ++i )
|
||||
{
|
||||
msg.Printf( wxT( "%3d %s" ), ii, FootprintItem->m_Module.GetData() );
|
||||
footprint = *i;
|
||||
msg.Printf( wxT( "%3d %s" ), m_FullFootprintList.GetCount() + 1,
|
||||
footprint->m_Module.GetData() );
|
||||
m_FullFootprintList.Add( msg );
|
||||
}
|
||||
|
||||
SetActiveFootprintList( TRUE );
|
||||
|
||||
if( (GetCount() == 0) || (OldSelection < 0) || ( OldSelection >= GetCount() ) )
|
||||
if( ( GetCount() == 0 )
|
||||
|| ( OldSelection < 0 ) || ( OldSelection >= GetCount() ) )
|
||||
SetSelection( 0, TRUE );
|
||||
Refresh();
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
void FootprintListBox::SetFootprintFilteredList( STORECMP* Component )
|
||||
void FootprintListBox::SetFootprintFilteredList( COMPONENT* Component,
|
||||
FOOTPRINT_LIST& list )
|
||||
/*********************************************************************/
|
||||
{
|
||||
STOREMOD* FootprintItem;
|
||||
wxString msg;
|
||||
int OldSelection = GetSelection();
|
||||
bool HasItem = FALSE;
|
||||
FOOTPRINT_LIST::iterator i;
|
||||
FOOTPRINT* footprint;
|
||||
wxString msg;
|
||||
unsigned jj;
|
||||
int OldSelection = GetSelection();
|
||||
bool HasItem = FALSE;
|
||||
|
||||
m_FilteredFootprintList.Clear();
|
||||
FootprintItem = g_BaseListePkg;
|
||||
|
||||
int cmpnum = 1;
|
||||
for( int ii = 0; FootprintItem != NULL; FootprintItem = FootprintItem->Pnext, ii++ )
|
||||
for( i = list.begin(); i != list.end(); ++i )
|
||||
{
|
||||
footprint = *i;
|
||||
|
||||
/* Search for matching footprints */
|
||||
for( unsigned jj = 0; jj < Component->m_FootprintFilter.GetCount(); jj++ )
|
||||
for( jj = 0; jj < Component->m_FootprintFilter.GetCount(); jj++ )
|
||||
{
|
||||
if( !FootprintItem->m_Module.Matches( Component->m_FootprintFilter[jj] ) )
|
||||
if( !footprint->m_Module.Matches( Component->m_FootprintFilter[jj] ) )
|
||||
continue;
|
||||
msg.Printf( wxT( "%3d %s" ), cmpnum++, FootprintItem->m_Module.GetData() );
|
||||
msg.Printf( wxT( "%3d %s" ), m_FilteredFootprintList.GetCount() + 1,
|
||||
footprint->m_Module.GetData() );
|
||||
m_FilteredFootprintList.Add( msg );
|
||||
HasItem = TRUE;
|
||||
}
|
||||
|
@ -393,7 +409,7 @@ void FootprintListBox::SetFootprintFilteredList( STORECMP* Component )
|
|||
else
|
||||
SetActiveFootprintList( TRUE );
|
||||
|
||||
if( (GetCount() == 0) || ( OldSelection >= GetCount() ) )
|
||||
if( ( GetCount() == 0 ) || ( OldSelection >= GetCount() ) )
|
||||
SetSelection( 0, TRUE );
|
||||
|
||||
Refresh();
|
||||
|
@ -422,8 +438,10 @@ void FootprintListBox::SetActiveFootprintList( bool FullList, bool Redraw )
|
|||
if ( m_ActiveFootprintList )
|
||||
{
|
||||
bool new_selection;
|
||||
if( FullList ) new_selection = TRUE;
|
||||
else new_selection = FALSE;
|
||||
if( FullList )
|
||||
new_selection = TRUE;
|
||||
else
|
||||
new_selection = FALSE;
|
||||
if( new_selection != old_selection )
|
||||
SetSelection( 0, TRUE );
|
||||
}
|
||||
|
@ -443,13 +461,14 @@ void FootprintListBox::SetActiveFootprintList( bool FullList, bool Redraw )
|
|||
|
||||
if( Redraw )
|
||||
{
|
||||
if( !m_UseFootprintFullList || (m_UseFootprintFullList != old_selection) )
|
||||
if( !m_UseFootprintFullList
|
||||
|| ( m_UseFootprintFullList != old_selection ) )
|
||||
{
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
if( !m_UseFootprintFullList || (m_UseFootprintFullList != old_selection) )
|
||||
if( !m_UseFootprintFullList || ( m_UseFootprintFullList != old_selection ) )
|
||||
{
|
||||
m_Parent->SetStatusText( wxEmptyString, 0 );
|
||||
m_Parent->SetStatusText( wxEmptyString, 1 );
|
||||
|
@ -457,9 +476,11 @@ void FootprintListBox::SetActiveFootprintList( bool FullList, bool Redraw )
|
|||
|
||||
wxString msg;
|
||||
if( FullList )
|
||||
msg.Printf( _( "Footprints (All): %d" ), m_ActiveFootprintList->GetCount() );
|
||||
msg.Printf( _( "Footprints (All): %d" ),
|
||||
m_ActiveFootprintList->GetCount() );
|
||||
else
|
||||
msg.Printf( _( "Footprints (filtered): %d" ), m_ActiveFootprintList->GetCount() );
|
||||
msg.Printf( _( "Footprints (filtered): %d" ),
|
||||
m_ActiveFootprintList->GetCount() );
|
||||
m_Parent->SetStatusText( msg, 2 );
|
||||
}
|
||||
|
||||
|
@ -469,8 +490,7 @@ void FootprintListBox::SetActiveFootprintList( bool FullList, bool Redraw )
|
|||
/**************************************/
|
||||
|
||||
BEGIN_EVENT_TABLE( FootprintListBox, LIST_BOX_TYPE )
|
||||
EVT_SIZE( ListBoxBase::OnSize )
|
||||
|
||||
EVT_SIZE( ListBoxBase::OnSize )
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
|
@ -478,10 +498,10 @@ END_EVENT_TABLE()
|
|||
void FootprintListBox::OnLeftClick( wxListEvent& event )
|
||||
/********************************************************/
|
||||
{
|
||||
STOREMOD* Module;
|
||||
FOOTPRINT* Module;
|
||||
wxString FootprintName = GetSelectedFootprint();
|
||||
|
||||
Module = GetModuleDescrByName( FootprintName );
|
||||
Module = GetModuleDescrByName( FootprintName, m_Parent->m_footprints );
|
||||
if( m_Parent->DrawFrame )
|
||||
{
|
||||
m_Parent->CreateScreenCmp(); /* refresh general */
|
||||
|
@ -510,17 +530,19 @@ void FootprintListBox::OnLeftDClick( wxListEvent& event )
|
|||
}
|
||||
|
||||
|
||||
/**************************************************************/
|
||||
STOREMOD* GetModuleDescrByName( const wxString& FootprintName )
|
||||
/**************************************************************/
|
||||
FOOTPRINT* GetModuleDescrByName( const wxString& FootprintName,
|
||||
FOOTPRINT_LIST& list )
|
||||
{
|
||||
STOREMOD* FootprintItem = g_BaseListePkg;
|
||||
FOOTPRINT_LIST::iterator i;
|
||||
FOOTPRINT* footprint;
|
||||
|
||||
for( ; FootprintItem != NULL; FootprintItem = FootprintItem->Pnext )
|
||||
for( i = list.begin() ; i != list.end(); ++i )
|
||||
{
|
||||
if( FootprintItem->m_Module == FootprintName )
|
||||
break; // found !
|
||||
footprint = *i;
|
||||
|
||||
if( *footprint->m_Module == FootprintName )
|
||||
return footprint;
|
||||
}
|
||||
|
||||
return FootprintItem;
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -20,16 +20,11 @@
|
|||
#include "protos.h"
|
||||
|
||||
/* routines locales : */
|
||||
static void ReadDocLib( const wxString& ModLibName );
|
||||
static int LibCompare( void* mod1, void* mod2 );
|
||||
static STOREMOD* TriListeModules( STOREMOD* BaseListe, int nbitems );
|
||||
static void ReadDocLib( const wxString& ModLibName, FOOTPRINT_LIST& list );
|
||||
|
||||
|
||||
/*********************/
|
||||
bool listlib()
|
||||
/*********************/
|
||||
|
||||
/* Routine lisant la liste des librairies, et generant la liste chainee
|
||||
/**
|
||||
* Routine lisant la liste des librairies, et generant la liste chainee
|
||||
* des modules disponibles
|
||||
*
|
||||
* Module descr format:
|
||||
|
@ -40,22 +35,25 @@ bool listlib()
|
|||
* $EndMODULE
|
||||
*
|
||||
*/
|
||||
bool LoadFootprintFiles( const wxArrayString& libNames,
|
||||
FOOTPRINT_LIST& list )
|
||||
{
|
||||
FILE* file; /* pour lecture librairie */
|
||||
char buffer[1024];
|
||||
wxFileName fn;
|
||||
int end;
|
||||
STOREMOD* ItemLib;
|
||||
FOOTPRINT* ItemLib;
|
||||
unsigned ii;
|
||||
wxString tmp, msg;
|
||||
|
||||
if( g_BaseListePkg ) /* Liste Deja existante, a supprimer */
|
||||
if( !list.empty() )
|
||||
{
|
||||
FreeMemoryModules();
|
||||
g_BaseListePkg = NULL;
|
||||
list.DeleteContents( true );
|
||||
list.Clear();
|
||||
list.DeleteContents( false );
|
||||
}
|
||||
|
||||
if( g_LibName_List.GetCount() == 0 )
|
||||
if( libNames.GetCount() == 0 )
|
||||
{
|
||||
wxMessageBox( _( "No PCB foot print libraries are listed in the " \
|
||||
"current project file." ), _( "Project File Error" ),
|
||||
|
@ -63,13 +61,11 @@ bool listlib()
|
|||
return false;
|
||||
}
|
||||
|
||||
nblib = 0;
|
||||
|
||||
/* Lecture des Librairies */
|
||||
for( ii = 0; ii < g_LibName_List.GetCount(); ii++ )
|
||||
for( ii = 0; ii < libNames.GetCount(); ii++ )
|
||||
{
|
||||
/* Calcul du nom complet de la librairie */
|
||||
fn = g_LibName_List[ii];
|
||||
fn = libNames[ii];
|
||||
fn.SetExt( ModuleFileExtension );
|
||||
|
||||
tmp = wxGetApp().FindLibraryPath( fn );
|
||||
|
@ -122,12 +118,10 @@ bool listlib()
|
|||
break;
|
||||
}
|
||||
|
||||
ItemLib = new STOREMOD();
|
||||
ItemLib->Pnext = g_BaseListePkg;
|
||||
g_BaseListePkg = ItemLib;
|
||||
ItemLib->m_Module = CONV_FROM_UTF8( StrPurge( buffer ) );
|
||||
ItemLib = new FOOTPRINT();
|
||||
ItemLib->m_Module = CONV_FROM_UTF8( StrPurge( buffer ) );
|
||||
ItemLib->m_LibName = tmp;
|
||||
nblib++;
|
||||
list.push_back( ItemLib );
|
||||
}
|
||||
|
||||
if( !end )
|
||||
|
@ -141,104 +135,29 @@ bool listlib()
|
|||
}
|
||||
|
||||
fclose( file );
|
||||
ReadDocLib( tmp );
|
||||
ReadDocLib( tmp, list );
|
||||
}
|
||||
|
||||
/* classement alphabetique: */
|
||||
if( g_BaseListePkg )
|
||||
g_BaseListePkg = TriListeModules( g_BaseListePkg, nblib );
|
||||
list.Sort( compare );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/************************************************/
|
||||
static int LibCompare( void* mod1, void* mod2 )
|
||||
/************************************************/
|
||||
|
||||
/*
|
||||
* routine compare() pour qsort() en classement alphabétique des modules
|
||||
*/
|
||||
{
|
||||
int ii;
|
||||
STOREMOD* pt1, * pt2;
|
||||
|
||||
pt1 = *( (STOREMOD**) mod1 );
|
||||
pt2 = *( (STOREMOD**) mod2 );
|
||||
|
||||
ii = StrNumICmp( pt1->m_Module.GetData(), pt2->m_Module.GetData() );
|
||||
return ii;
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************/
|
||||
static STOREMOD* TriListeModules( STOREMOD* BaseListe, int nbitems )
|
||||
/********************************************************************/
|
||||
|
||||
/* Tri la liste des Modules par ordre alphabetique et met a jour
|
||||
* le nouveau chainage avant/arriere
|
||||
* retourne un pointeur sur le 1er element de la liste
|
||||
*/
|
||||
{
|
||||
STOREMOD** bufferptr, * Item;
|
||||
int ii, nb;
|
||||
|
||||
if( nbitems <= 0 )
|
||||
return NULL;
|
||||
if( BaseListe == NULL )
|
||||
return NULL;
|
||||
|
||||
if( nbitems == 1 )
|
||||
return BaseListe; // Tri inutile et impossible
|
||||
|
||||
bufferptr = (STOREMOD**) MyZMalloc( (nbitems + 3) * sizeof(STOREMOD*) );
|
||||
|
||||
for( ii = 1, nb = 0, Item = BaseListe;
|
||||
Item != NULL;
|
||||
Item = Item->Pnext, ii++ )
|
||||
{
|
||||
nb++;
|
||||
bufferptr[ii] = Item;
|
||||
}
|
||||
|
||||
/* ici bufferptr[0] = NULL et bufferptr[nbitem+1] = NULL et ces 2 valeurs
|
||||
* representent le chainage arriere du 1er element ( = NULL),
|
||||
* et le chainage avant du dernier element ( = NULL ) */
|
||||
|
||||
qsort( bufferptr + 1, nb, sizeof(STOREMOD*),
|
||||
( int( * ) ( const void*, const void* ) )LibCompare );
|
||||
|
||||
/* Mise a jour du chainage */
|
||||
for( ii = 1; ii <= nb; ii++ )
|
||||
{
|
||||
Item = bufferptr[ii];
|
||||
Item->m_Num = ii;
|
||||
Item->Pnext = bufferptr[ii + 1];
|
||||
Item->Pback = bufferptr[ii - 1];
|
||||
}
|
||||
|
||||
Item = bufferptr[1];
|
||||
MyFree( bufferptr );
|
||||
|
||||
return Item;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************/
|
||||
static void ReadDocLib( const wxString& ModLibName )
|
||||
/***************************************************/
|
||||
|
||||
/* 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
|
||||
*/
|
||||
static void ReadDocLib( const wxString& ModLibName, FOOTPRINT_LIST& list )
|
||||
{
|
||||
STOREMOD* NewMod;
|
||||
char Line[1024];
|
||||
wxString ModuleName;
|
||||
wxString msg;
|
||||
FILE* LibDoc;
|
||||
FOOTPRINT* NewMod;
|
||||
FOOTPRINT* tmp;
|
||||
char Line[1024];
|
||||
wxString ModuleName;
|
||||
wxString msg;
|
||||
FILE* LibDoc;
|
||||
wxFileName fn = ModLibName;
|
||||
FOOTPRINT_LIST::iterator i;
|
||||
|
||||
fn.SetExt( wxT( "mdc" ) );
|
||||
|
||||
|
@ -277,12 +196,15 @@ static void ReadDocLib( const wxString& ModLibName )
|
|||
{
|
||||
case 'L': /* LibName */
|
||||
ModuleName = CONV_FROM_UTF8( StrPurge( Line + 3 ) );
|
||||
NewMod = g_BaseListePkg;
|
||||
while( NewMod )
|
||||
for( i = list.begin(); i != list.end(); ++i )
|
||||
{
|
||||
if( ModuleName == NewMod->m_Module )
|
||||
tmp = *i;
|
||||
|
||||
if( ModuleName == tmp->m_Module )
|
||||
{
|
||||
NewMod = tmp;
|
||||
break;
|
||||
NewMod = NewMod->Pnext;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -293,7 +215,7 @@ static void ReadDocLib( const wxString& ModLibName )
|
|||
break;
|
||||
|
||||
case 'C': /* Doc */
|
||||
if( NewMod && (!NewMod->m_Doc ) )
|
||||
if( NewMod && ( !NewMod->m_Doc ) )
|
||||
NewMod->m_Doc = CONV_FROM_UTF8( StrPurge( Line + 3 ) );
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -35,11 +35,12 @@ MODULE* WinEDA_DisplayFrame::Get_Module( const wxString& CmpName )
|
|||
wxString tmp, msg;
|
||||
wxFileName fn;
|
||||
MODULE* Module = NULL;
|
||||
WinEDA_CvpcbFrame* parent = ( WinEDA_CvpcbFrame* ) GetParent();
|
||||
|
||||
for( ii = 0; ii < g_LibName_List.GetCount(); ii++ )
|
||||
for( ii = 0; ii < parent->m_ModuleLibNames.GetCount(); ii++ )
|
||||
{
|
||||
/* Calcul du nom complet de la librairie */
|
||||
fn = g_LibName_List[ii];
|
||||
fn = parent->m_ModuleLibNames[ii];
|
||||
fn.SetExt( ModuleFileExtension );
|
||||
|
||||
tmp = wxGetApp().FindLibraryPath( fn );
|
||||
|
|
|
@ -1,58 +0,0 @@
|
|||
/**********************************************/
|
||||
/* Routines de gestion de la memoire */
|
||||
/**********************************************/
|
||||
|
||||
/* Fichier memoire.cpp */
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "wxstruct.h"
|
||||
#include "common.h"
|
||||
#include "cvpcb.h"
|
||||
|
||||
|
||||
/********************************/
|
||||
void FreeMemoryModules()
|
||||
/********************************/
|
||||
|
||||
/* Routine de liberation memoire de la liste des modules
|
||||
- remet a NULL g_BaseListePkg
|
||||
- remet a 0 nblib;
|
||||
*/
|
||||
{
|
||||
STOREMOD * Module, * NextMod;
|
||||
|
||||
if( g_BaseListePkg == NULL) return;
|
||||
|
||||
for ( Module = g_BaseListePkg; Module != NULL; Module = NextMod)
|
||||
{
|
||||
NextMod = Module->Pnext;
|
||||
delete Module;
|
||||
}
|
||||
|
||||
nblib = 0;
|
||||
g_BaseListePkg = NULL;
|
||||
}
|
||||
|
||||
/***********************************/
|
||||
void FreeMemoryComponents()
|
||||
/***********************************/
|
||||
|
||||
/* Routine de liberation memoire de la liste des composants
|
||||
- remet a NULL BaseListeMod
|
||||
- remet a 0 nbcomp
|
||||
*/
|
||||
{
|
||||
STORECMP * Cmp, * NextCmp;
|
||||
|
||||
if( g_BaseListeCmp == NULL ) return;
|
||||
|
||||
for( Cmp = g_BaseListeCmp; Cmp != NULL; Cmp = NextCmp )
|
||||
{
|
||||
NextCmp = Cmp->Pnext;
|
||||
delete Cmp;
|
||||
}
|
||||
|
||||
nbcomp = 0;
|
||||
g_BaseListeCmp = NULL;
|
||||
}
|
||||
|
|
@ -62,15 +62,18 @@ void WinEDA_CvpcbFrame::ReCreateMenuBar()
|
|||
item->SetBitmap( config_xpm );
|
||||
configmenu->Append( item );
|
||||
|
||||
// Font selection and setup
|
||||
AddFontSelectionMenu( configmenu );
|
||||
|
||||
wxGetApp().AddMenuLanguageList( configmenu );
|
||||
|
||||
item = new wxMenuItem( configmenu, ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE,
|
||||
_( "Keep Open On Save" ),
|
||||
_( "Prevent CVPcb from exiting after saving " \
|
||||
"netlist file" ),
|
||||
wxITEM_CHECK );
|
||||
configmenu->Append( item );
|
||||
configmenu->AppendSeparator();
|
||||
item = new wxMenuItem( configmenu, ID_CONFIG_SAVE,
|
||||
_( "&Save config" ),
|
||||
_( "Save configuration in current dir" ) );
|
||||
_( "&Save Project File" ),
|
||||
_( "Save changes to the project file" ) );
|
||||
item->SetBitmap( save_setup_xpm );
|
||||
configmenu->Append( item );
|
||||
|
||||
|
|
|
@ -5,32 +5,16 @@
|
|||
#ifndef PROTOS_H
|
||||
#define PROTOS_H
|
||||
|
||||
int GenNetlistPcbnew( FILE* f ) ;
|
||||
bool loadcmp( const wxString& fileName ) ;
|
||||
bool listlib() ;
|
||||
extern int GenNetlistPcbnew( FILE* f, COMPONENT_LIST& list,
|
||||
bool isEESchemaNetlist = true,
|
||||
bool rightJustify = false );
|
||||
extern bool LoadComponentFile( const wxString& fileName,
|
||||
COMPONENT_LIST& list );
|
||||
extern bool LoadFootprintFiles( const wxArrayString& libNames,
|
||||
FOOTPRINT_LIST& list );
|
||||
|
||||
STOREMOD * GetModuleDescrByName(const wxString & FootprintName);
|
||||
|
||||
|
||||
/***********/
|
||||
/* CFG.CPP */
|
||||
/***********/
|
||||
void Save_Config( wxWindow* parent, const wxString& fileName );
|
||||
void Read_Config( const wxString & FullFileName ); /* lit la configuration */
|
||||
|
||||
|
||||
/***************/
|
||||
/* MEMOIRE.CPP */
|
||||
/***************/
|
||||
void FreeMemoryComponents();
|
||||
/* Routine de liberation memoire de la liste des composants
|
||||
- remet a NULL BaseListeMod
|
||||
- remet a 0 NbComp */
|
||||
|
||||
void FreeMemoryModules();
|
||||
/* Routine de liberation memoire de la liste des modules
|
||||
- remet a NULL g_BaseListePkg
|
||||
- rement a 0 NbLib; */
|
||||
FOOTPRINT* GetModuleDescrByName( const wxString& FootprintName,
|
||||
FOOTPRINT_LIST& list );
|
||||
|
||||
#endif // PROTOS_H
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/* readschematicnetlist.cpp */
|
||||
/****************************/
|
||||
|
||||
/* Read a nelist type Eeschema or OrcadPCB2 and buid the component list
|
||||
/* Read a nelist type Eeschema or OrcadPCB2 and build the component list
|
||||
* Manages the lines like :
|
||||
* ( XXXXXX VALEUR|(pin1,pin2,...=newalim) ID VALEUR
|
||||
*/
|
||||
|
@ -23,20 +23,16 @@
|
|||
|
||||
/* routines locales : */
|
||||
|
||||
static int ReadPinConnection( FILE* f, STORECMP* CurrentCmp );
|
||||
static int CmpCompare( void* cmp1, void* cmp2 ); /* routine pour qsort() de tri de liste des composants */
|
||||
static STORECMP* TriListeComposants( STORECMP* BaseListe, int nbitems );
|
||||
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 */
|
||||
/* 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 datas
|
||||
#define BUFFER_CHAR_SIZE 1024 // Size of buffers used to store netlist data
|
||||
|
||||
/************************************************/
|
||||
int WinEDA_CvpcbFrame::ReadSchematicNetlist()
|
||||
/************************************************/
|
||||
|
||||
/** Function ReadSchematicNetlist
|
||||
/**
|
||||
* Function ReadSchematicNetlist
|
||||
* Read a Eeschema (or OrcadPCB) netlist
|
||||
* like:
|
||||
* # EESchema Netlist Version 1.1 created 15/5/2008-12:09:21
|
||||
|
@ -87,26 +83,30 @@ int WinEDA_CvpcbFrame::ReadSchematicNetlist()
|
|||
* $endfootprintlist
|
||||
* }
|
||||
*/
|
||||
int WinEDA_CvpcbFrame::ReadSchematicNetlist()
|
||||
{
|
||||
char alim[1024];
|
||||
int i, k, l;
|
||||
char* LibName;
|
||||
char Line[BUFFER_CHAR_SIZE + 1];
|
||||
wxString component_reference; /* buffer for component reference (U1, R4...) */
|
||||
wxString schematic_timestamp; /* buffer for component time stamp */
|
||||
wxString footprint_name; /* buffer for component footprint field */
|
||||
wxString component_value; /* buffer for component values (470K, 22nF ...) */
|
||||
char* ptchar;
|
||||
STORECMP* Cmp;
|
||||
FILE* source;
|
||||
char alim[1024];
|
||||
int i, k, l;
|
||||
char* LibName;
|
||||
char Line[BUFFER_CHAR_SIZE + 1];
|
||||
wxString component_reference; /* buffer for component reference (U1, R4...) */
|
||||
wxString schematic_timestamp; /* buffer for component time stamp */
|
||||
wxString footprint_name; /* buffer for component footprint field */
|
||||
wxString component_value; /* buffer for component values (470K, 22nF ...) */
|
||||
char* ptchar;
|
||||
COMPONENT* Cmp;
|
||||
FILE* source;
|
||||
|
||||
modified = 0;
|
||||
Rjustify = 0;
|
||||
g_FlagEESchema = FALSE;
|
||||
m_modified = false;
|
||||
m_isEESchemaNetlist = false;
|
||||
|
||||
/* Clear components buffer */
|
||||
if( g_BaseListeCmp )
|
||||
FreeMemoryComponents();
|
||||
if( !m_components.empty() )
|
||||
{
|
||||
m_components.DeleteContents( true );
|
||||
m_components.Clear();
|
||||
m_components.DeleteContents( false );
|
||||
}
|
||||
|
||||
source = wxFopen( m_NetlistFileName.GetFullPath(), wxT( "rt" ) );
|
||||
|
||||
|
@ -129,7 +129,7 @@ int WinEDA_CvpcbFrame::ReadSchematicNetlist()
|
|||
{
|
||||
i = strnicmp( Line, "# EESchema", 7 ); /* net type EESchema */
|
||||
if( i == 0 )
|
||||
g_FlagEESchema = TRUE;
|
||||
m_isEESchemaNetlist = TRUE;
|
||||
}
|
||||
|
||||
if( i != 0 )
|
||||
|
@ -143,7 +143,7 @@ int WinEDA_CvpcbFrame::ReadSchematicNetlist()
|
|||
SetStatusText( _( "Netlist Format: EESchema" ), 0 );
|
||||
|
||||
|
||||
/* Read the netlit */
|
||||
/* Read the netlist */
|
||||
for( ; ; )
|
||||
{
|
||||
/* Search the beginning of a component description */
|
||||
|
@ -255,13 +255,12 @@ int WinEDA_CvpcbFrame::ReadSchematicNetlist()
|
|||
}
|
||||
|
||||
/* Store info for this component */
|
||||
Cmp = new STORECMP();
|
||||
Cmp->Pnext = g_BaseListeCmp;
|
||||
g_BaseListeCmp = Cmp;
|
||||
Cmp = new COMPONENT();
|
||||
Cmp->m_Reference = component_reference;
|
||||
Cmp->m_Valeur = component_value;
|
||||
m_components.push_back( Cmp );
|
||||
|
||||
if( g_FlagEESchema ) /* copy footprint name: */
|
||||
if( m_isEESchemaNetlist ) /* copy footprint name: */
|
||||
{
|
||||
if( strnicmp( LibName, "$noname", 7 ) != 0 )
|
||||
{
|
||||
|
@ -275,26 +274,22 @@ int WinEDA_CvpcbFrame::ReadSchematicNetlist()
|
|||
Cmp->m_TimeStamp = schematic_timestamp;
|
||||
|
||||
ReadPinConnection( source, Cmp );
|
||||
|
||||
nbcomp++;
|
||||
}
|
||||
|
||||
fclose( source );
|
||||
|
||||
/* Alpabetic sorting : */
|
||||
g_BaseListeCmp = TriListeComposants( g_BaseListeCmp, nbcomp );
|
||||
m_components.Sort( compare );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/********************************************************/
|
||||
int WinEDA_CvpcbFrame::ReadFootprintFilterList( FILE* f )
|
||||
/********************************************************/
|
||||
{
|
||||
char Line[BUFFER_CHAR_SIZE + 1];
|
||||
wxString CmpRef;
|
||||
STORECMP* Cmp = NULL;
|
||||
COMPONENT_LIST::iterator i;
|
||||
char Line[BUFFER_CHAR_SIZE + 1];
|
||||
wxString CmpRef;
|
||||
COMPONENT* Cmp = NULL;
|
||||
|
||||
for( ; ; )
|
||||
{
|
||||
|
@ -313,9 +308,12 @@ int WinEDA_CvpcbFrame::ReadFootprintFilterList( FILE* f )
|
|||
CmpRef = CONV_FROM_UTF8( Line + 11 );
|
||||
CmpRef.Trim( TRUE );
|
||||
CmpRef.Trim( FALSE );
|
||||
|
||||
/* Search the new component in list */
|
||||
for( Cmp = g_BaseListeCmp; Cmp != NULL; Cmp = Cmp->Pnext )
|
||||
for( i = m_components.begin(); i != m_components.end(); ++i )
|
||||
{
|
||||
Cmp = *i;
|
||||
|
||||
if( Cmp->m_Reference == CmpRef )
|
||||
break;
|
||||
}
|
||||
|
@ -333,16 +331,13 @@ int WinEDA_CvpcbFrame::ReadFootprintFilterList( FILE* f )
|
|||
}
|
||||
|
||||
|
||||
/***********************************/
|
||||
int ReadPinConnection( FILE* f, STORECMP* Cmp )
|
||||
/***********************************/
|
||||
int ReadPinConnection( FILE* f, COMPONENT* Cmp )
|
||||
{
|
||||
int i, jj;
|
||||
wxString numpin;
|
||||
wxString net;
|
||||
char Line[BUFFER_CHAR_SIZE + 1];
|
||||
STOREPIN* Pin = NULL;
|
||||
STOREPIN** LastPin = &Cmp->m_Pins;
|
||||
int i, jj;
|
||||
wxString numpin;
|
||||
wxString net;
|
||||
char Line[BUFFER_CHAR_SIZE + 1];
|
||||
PIN* Pin = NULL;
|
||||
|
||||
for( ; ; )
|
||||
{
|
||||
|
@ -392,69 +387,10 @@ int ReadPinConnection( FILE* f, STORECMP* Cmp )
|
|||
net.Append( Line[i] );
|
||||
}
|
||||
|
||||
Pin = new STOREPIN();
|
||||
*LastPin = Pin;
|
||||
LastPin = &Pin->Pnext;
|
||||
Pin = new PIN();
|
||||
Pin->m_PinNum = numpin;
|
||||
Pin->m_PinNet = net;
|
||||
Cmp->m_Pins.push_back( Pin );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************/
|
||||
STORECMP* TriListeComposants( STORECMP* BaseListe, int nbitems )
|
||||
/****************************************************************/
|
||||
|
||||
/* Sort the component list( this is a linked list)
|
||||
* retourn the beginning of the list
|
||||
*/
|
||||
{
|
||||
STORECMP** bufferptr, * Item;
|
||||
int ii;
|
||||
|
||||
if( nbitems <= 0 )
|
||||
return NULL;
|
||||
bufferptr = (STORECMP**) MyZMalloc( (nbitems + 2) * sizeof(STORECMP*) );
|
||||
|
||||
for( ii = 1, Item = BaseListe; Item != NULL; Item = Item->Pnext, ii++ )
|
||||
{
|
||||
bufferptr[ii] = Item;
|
||||
}
|
||||
|
||||
/* Here: bufferptr[0] = NULL and bufferptr[nbitem+1] = NULL.
|
||||
* These 2 values are the first item back link, and the last item forward link
|
||||
*/
|
||||
|
||||
qsort( bufferptr + 1, nbitems, sizeof(STORECMP*),
|
||||
( int( * ) ( const void*, const void* ) )CmpCompare );
|
||||
/* Update linked list */
|
||||
for( ii = 1; ii <= nbitems; ii++ )
|
||||
{
|
||||
Item = bufferptr[ii];
|
||||
Item->m_Num = ii;
|
||||
Item->Pnext = bufferptr[ii + 1];
|
||||
Item->Pback = bufferptr[ii - 1];
|
||||
}
|
||||
|
||||
return bufferptr[1];
|
||||
}
|
||||
|
||||
|
||||
/****************************************/
|
||||
int CmpCompare( void* mod1, void* mod2 )
|
||||
/****************************************/
|
||||
|
||||
/*
|
||||
* Compare function for qsort() : alphabetic sorting, with numbering order
|
||||
*/
|
||||
{
|
||||
int ii;
|
||||
STORECMP* pt1, * pt2;
|
||||
|
||||
pt1 = *( (STORECMP**) mod1 );
|
||||
pt2 = *( (STORECMP**) mod2 );
|
||||
|
||||
ii = StrNumICmp( pt1->m_Reference.GetData(), pt2->m_Reference.GetData() );
|
||||
return ii;
|
||||
}
|
||||
|
|
|
@ -24,19 +24,19 @@ char EnteteCmpMod[] = { "Cmp-Mod V01" };
|
|||
const wxString titleComponentLibErr( _( "Component Library Error" ) );
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Routine de sauvegarde du fichier des modules
|
||||
/*
|
||||
* Routine de sauvegarde du fichier des modules
|
||||
* Retourne 1 si OK
|
||||
* 0 si ecriture non faite
|
||||
*/
|
||||
/****************************************************************************/
|
||||
int WinEDA_CvpcbFrame::SaveComponentList( const wxString& NetlistFullFileName )
|
||||
{
|
||||
STORECMP* Cmp;
|
||||
FILE* dest;
|
||||
wxFileName fn( NetlistFullFileName );
|
||||
char Line[1024];
|
||||
wxString Title = wxGetApp().GetAppName() + wxT( " " ) + GetBuildVersion();
|
||||
COMPONENT_LIST::iterator i;
|
||||
COMPONENT* Cmp;
|
||||
FILE* dest;
|
||||
wxFileName fn( NetlistFullFileName );
|
||||
char Line[1024];
|
||||
wxString Title = wxGetApp().GetTitle() + wxT( " " ) + GetBuildVersion();
|
||||
|
||||
/* calcul du nom du fichier */
|
||||
fn.SetExt( ComponentFileExtension );
|
||||
|
@ -49,8 +49,9 @@ int WinEDA_CvpcbFrame::SaveComponentList( const wxString& NetlistFullFileName )
|
|||
fprintf( dest, " Created by %s", CONV_TO_UTF8( Title ) );
|
||||
fprintf( dest, " date = %s\n", DateAndTime( Line ) );
|
||||
|
||||
for( Cmp = g_BaseListeCmp; Cmp != NULL; Cmp = Cmp->Pnext )
|
||||
for( i = m_components.begin(); i != m_components.end(); ++i )
|
||||
{
|
||||
Cmp = *i;
|
||||
fprintf( dest, "\nBeginCmp\n" );
|
||||
fprintf( dest, "TimeStamp = %s;\n", CONV_TO_UTF8( Cmp->m_TimeStamp ) );
|
||||
fprintf( dest, "Reference = %s;\n", CONV_TO_UTF8( Cmp->m_Reference ) );
|
||||
|
@ -61,23 +62,22 @@ int WinEDA_CvpcbFrame::SaveComponentList( const wxString& NetlistFullFileName )
|
|||
|
||||
fprintf( dest, "\nEndListe\n" );
|
||||
fclose( dest );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/***************/
|
||||
/* recupere la liste des associations composants/empreintes
|
||||
/*
|
||||
* recupere la liste des associations composants/empreintes
|
||||
*/
|
||||
/****************/
|
||||
bool loadcmp( const wxString& fileName )
|
||||
bool LoadComponentFile( const wxString& fileName, COMPONENT_LIST& list )
|
||||
{
|
||||
wxString timestamp, valeur, ilib, namecmp, msg;
|
||||
bool read_cmp_data = FALSE, eof = FALSE;
|
||||
STORECMP* Cmp;
|
||||
char Line[1024], * ident, * data;
|
||||
FILE* source;
|
||||
wxFileName fn = fileName;
|
||||
COMPONENT_LIST::iterator i;
|
||||
wxString timestamp, valeur, ilib, namecmp, msg;
|
||||
bool read_cmp_data = FALSE, eof = FALSE;
|
||||
COMPONENT* Cmp;
|
||||
char Line[1024], * ident, * data;
|
||||
FILE* source;
|
||||
wxFileName fn = fileName;
|
||||
|
||||
/* calcul du nom du fichier */
|
||||
fn.SetExt( ComponentFileExtension );
|
||||
|
@ -176,8 +176,10 @@ bool loadcmp( const wxString& fileName )
|
|||
|
||||
/* Recherche du composant correspondant en netliste et
|
||||
* mise a jour de ses parametres */
|
||||
for( Cmp = g_BaseListeCmp; Cmp != NULL; Cmp = Cmp->Pnext )
|
||||
for( i = list.begin(); i != list.end(); ++i )
|
||||
{
|
||||
Cmp = *i;
|
||||
|
||||
if( namecmp != Cmp->m_Reference )
|
||||
continue;
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ void WinEDA_CvpcbFrame::CreateScreenCmp()
|
|||
{
|
||||
msg = _( "Footprint: " ) + FootprintName;
|
||||
DrawFrame->SetTitle( msg );
|
||||
STOREMOD* Module = GetModuleDescrByName( FootprintName );
|
||||
FOOTPRINT* Module = GetModuleDescrByName( FootprintName, m_footprints );
|
||||
msg = _( "Lib: " );
|
||||
|
||||
if( Module )
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
/***************************/
|
||||
|
||||
/*
|
||||
* Complete la netliste (*.NET) en y placant les ref *.lib FORMAT PCBNEW ou ORCADPCB
|
||||
* Complete la netliste (*.NET) en y placant les ref *.lib FORMAT PCBNEW ou
|
||||
* ORCADPCB
|
||||
*/
|
||||
|
||||
#include "fctsys.h"
|
||||
|
@ -19,27 +20,72 @@
|
|||
#define MAX_LEN_NETNAME 16
|
||||
|
||||
/* Routines locales */
|
||||
static void TriPinsModule( STORECMP* CurrentCmp );
|
||||
static int PinCompare( const void* cmp1, const void* cmp2 );
|
||||
static void ChangePinNet( wxString& PinNet );
|
||||
static void WriteFootprintFilterInfos( FILE* dest );
|
||||
|
||||
/* Variables Locales */
|
||||
int NetNumCode; /* Nombre utilise pour cree des NetNames lors de
|
||||
* reaffectation de NetNames */
|
||||
static void ChangePinNet( COMPONENT_LIST& list, wxString& PinNet,
|
||||
int* netNumber, bool rightJustify );
|
||||
static void WriteFootprintFilterInfos( FILE* dest, COMPONENT_LIST& list );
|
||||
|
||||
|
||||
/*************************/
|
||||
int GenNetlistPcbnew( FILE* file )
|
||||
static void RemoveDuplicatePins( COMPONENT* component )
|
||||
{
|
||||
wxASSERT( component != NULL );
|
||||
|
||||
PIN_LIST::iterator i;
|
||||
PIN *pin1, *pin2;
|
||||
wxString msg;
|
||||
|
||||
if( component->m_Pins.size() <= 1 )
|
||||
return;
|
||||
|
||||
i = component->m_Pins.begin();
|
||||
pin1 = *i;
|
||||
++i;
|
||||
|
||||
while( i != component->m_Pins.end() )
|
||||
{
|
||||
pin2 = *i;
|
||||
|
||||
wxASSERT( pin2 != NULL );
|
||||
|
||||
if( !same_pin_number( pin1, pin2 ) )
|
||||
{
|
||||
pin1 = pin2;
|
||||
++i;
|
||||
continue;
|
||||
}
|
||||
|
||||
if( !same_pin_net( pin1, pin2 ) )
|
||||
{
|
||||
msg.Printf( _( "Component %s %s pin %s : Different Nets" ),
|
||||
component->m_Reference.GetData(),
|
||||
component->m_Valeur.GetData(),
|
||||
pin1->m_PinNum.GetData() );
|
||||
DisplayError( NULL, msg, 60 );
|
||||
}
|
||||
|
||||
wxLogDebug( wxT( "Removing duplicate pin %s from component %s: %s" ),
|
||||
pin1->m_PinNum.c_str(), component->m_Reference.c_str(),
|
||||
component->m_Valeur.c_str() );
|
||||
pin1 = pin2;
|
||||
i = component->m_Pins.erase( i );
|
||||
delete pin2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int GenNetlistPcbnew( FILE* file, COMPONENT_LIST& list, bool isEESchemaNetlist,
|
||||
bool rightJustify )
|
||||
{
|
||||
#define NETLIST_HEAD_STRING "EESchema Netlist Version 1.1"
|
||||
char Line[1024];
|
||||
STOREPIN* Pin;
|
||||
STORECMP* CurrentCmp;
|
||||
wxString Title = wxGetApp().GetAppName() + wxT( " " ) + GetBuildVersion();
|
||||
COMPONENT_LIST::iterator iCmp;
|
||||
PIN_LIST::iterator iPin;
|
||||
char Line[1024];
|
||||
PIN* Pin;
|
||||
COMPONENT* Component;
|
||||
int netNumber = 1;
|
||||
|
||||
NetNumCode = 1; DateAndTime( Line );
|
||||
if( g_FlagEESchema )
|
||||
DateAndTime( Line );
|
||||
|
||||
if( isEESchemaNetlist )
|
||||
fprintf( file, "# %s created %s\n(\n", NETLIST_HEAD_STRING, Line );
|
||||
else
|
||||
fprintf( file, "( { netlist created %s }\n", Line );
|
||||
|
@ -48,31 +94,33 @@ int GenNetlistPcbnew( FILE* file )
|
|||
/* Lecture de la liste */
|
||||
/***********************/
|
||||
|
||||
CurrentCmp = g_BaseListeCmp;
|
||||
for( ; CurrentCmp != NULL; CurrentCmp = CurrentCmp->Pnext )
|
||||
for( iCmp = list.begin(); iCmp != list.end(); ++iCmp )
|
||||
{
|
||||
fprintf( file, " ( %s ", CONV_TO_UTF8( CurrentCmp->m_TimeStamp ) );
|
||||
Component = *iCmp;
|
||||
|
||||
if( !CurrentCmp->m_Module.IsEmpty() )
|
||||
fprintf( file, CONV_TO_UTF8( CurrentCmp->m_Module ) );
|
||||
fprintf( file, " ( %s ", CONV_TO_UTF8( Component->m_TimeStamp ) );
|
||||
|
||||
if( !Component->m_Module.IsEmpty() )
|
||||
fprintf( file, CONV_TO_UTF8( Component->m_Module ) );
|
||||
|
||||
else
|
||||
fprintf( file, "$noname$" );
|
||||
|
||||
fprintf( file, " %s ", CONV_TO_UTF8( CurrentCmp->m_Reference ) );
|
||||
fprintf( file, " %s ", CONV_TO_UTF8( Component->m_Reference ) );
|
||||
|
||||
/* placement de la valeur */
|
||||
fprintf( file, "%s\n", CONV_TO_UTF8( CurrentCmp->m_Valeur ) );
|
||||
fprintf( file, "%s\n", CONV_TO_UTF8( Component->m_Valeur ) );
|
||||
|
||||
/* Tri des pins */
|
||||
TriPinsModule( CurrentCmp );
|
||||
Component->m_Pins.Sort( compare );
|
||||
RemoveDuplicatePins( Component );
|
||||
|
||||
/* Placement de la liste des pins */
|
||||
Pin = CurrentCmp->m_Pins;
|
||||
for( ; Pin != NULL; Pin = Pin->Pnext )
|
||||
for( iPin = Component->m_Pins.begin(); iPin != Component->m_Pins.end();
|
||||
++iPin )
|
||||
{
|
||||
Pin = *iPin;
|
||||
if( Pin->m_PinNet.Len() > MAX_LEN_NETNAME )
|
||||
ChangePinNet( Pin->m_PinNet );
|
||||
ChangePinNet( list, Pin->m_PinNet, &netNumber, rightJustify );
|
||||
|
||||
if( !Pin->m_PinNet.IsEmpty() )
|
||||
fprintf( file, " ( %s %s )\n",
|
||||
|
@ -87,24 +135,26 @@ int GenNetlistPcbnew( FILE* file )
|
|||
|
||||
fprintf( file, ")\n*\n" );
|
||||
|
||||
if( g_FlagEESchema )
|
||||
WriteFootprintFilterInfos( file );
|
||||
if( isEESchemaNetlist )
|
||||
WriteFootprintFilterInfos( file, list );
|
||||
|
||||
fclose( file );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/******************************************/
|
||||
void WriteFootprintFilterInfos( FILE* file )
|
||||
/******************************************/
|
||||
/* Write the allowed footprint list for each component */
|
||||
/*
|
||||
* Write the allowed footprint list for each component
|
||||
*/
|
||||
void WriteFootprintFilterInfos( FILE* file, COMPONENT_LIST& list )
|
||||
{
|
||||
STORECMP* component = g_BaseListeCmp;
|
||||
bool WriteHeader = FALSE;
|
||||
COMPONENT_LIST::iterator i;
|
||||
COMPONENT* component;
|
||||
bool WriteHeader = FALSE;
|
||||
|
||||
for( ; component != NULL; component = component->Pnext )
|
||||
for( i = list.begin(); i != list.end(); ++i )
|
||||
{
|
||||
component = *i;
|
||||
unsigned int FilterCount;
|
||||
FilterCount = component->m_FootprintFilter.GetCount();
|
||||
if( FilterCount == 0 )
|
||||
|
@ -131,131 +181,48 @@ void WriteFootprintFilterInfos( FILE* file )
|
|||
}
|
||||
|
||||
|
||||
/***********************************************/
|
||||
static void TriPinsModule( STORECMP* CurrentCmp )
|
||||
/***********************************************/
|
||||
|
||||
/* Tri et controle des pins du module CurrentCmp
|
||||
*/
|
||||
{
|
||||
STOREPIN* Pin, * NextPin, ** BasePin;
|
||||
int nbpins = 0, ii;
|
||||
|
||||
Pin = CurrentCmp->m_Pins;
|
||||
if( Pin == NULL )
|
||||
return;
|
||||
|
||||
/* comptage des pins */
|
||||
for( ; Pin != NULL; Pin = Pin->Pnext )
|
||||
nbpins++;
|
||||
|
||||
/* Tri des pins: etablissement de la liste des pointeurs */
|
||||
BasePin = (STOREPIN**) MyZMalloc( nbpins * sizeof(STOREPIN*) );
|
||||
|
||||
Pin = CurrentCmp->m_Pins;
|
||||
for( ii = 0; ii < nbpins; ii++, Pin = Pin->Pnext )
|
||||
{
|
||||
BasePin[ii] = Pin;
|
||||
}
|
||||
|
||||
/* Tri des Pins */
|
||||
qsort( BasePin, nbpins, sizeof( STORECMP*), PinCompare );
|
||||
|
||||
/* Remise a jour des pointeurs chaines */
|
||||
for( ii = 0; ii < nbpins - 1; ii++ )
|
||||
{
|
||||
BasePin[ii]->Pnext = BasePin[ii + 1];
|
||||
}
|
||||
|
||||
BasePin[ii]->Pnext = NULL;
|
||||
CurrentCmp->m_Pins = BasePin[0];
|
||||
|
||||
MyFree( BasePin );
|
||||
|
||||
/* Elimination des redondances */
|
||||
Pin = CurrentCmp->m_Pins;
|
||||
while( Pin != NULL )
|
||||
{
|
||||
NextPin = Pin->Pnext;
|
||||
if( NextPin == NULL )
|
||||
break;
|
||||
if( Pin->m_PinNum != NextPin->m_PinNum )
|
||||
{
|
||||
Pin = Pin->Pnext; continue;
|
||||
}
|
||||
/* 2 pins successives ont le meme numero */
|
||||
if( Pin->m_PinNet != NextPin->m_PinNet )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "%s %s pin %s : Different Nets" ),
|
||||
CurrentCmp->m_Reference.GetData(),
|
||||
CurrentCmp->m_Valeur.GetData(),
|
||||
Pin->m_PinNum.GetData() );
|
||||
DisplayError( NULL, msg, 60 );
|
||||
}
|
||||
Pin->Pnext = NextPin->Pnext;
|
||||
delete NextPin;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************/
|
||||
static int PinCompare( const void* cmp1, const void* cmp2 )
|
||||
/*******************************************************/
|
||||
|
||||
/*
|
||||
* routine PinCompare() pour qsort() pour classement alphabetique
|
||||
* pour tri de la liste des Pins
|
||||
* 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( COMPONENT_LIST& list, wxString& PinNet,
|
||||
int* netNumber, bool rightJustify )
|
||||
{
|
||||
STOREPIN** pt1, ** pt2;
|
||||
int ii;
|
||||
wxASSERT( netNumber != NULL );
|
||||
|
||||
pt1 = (STOREPIN**) cmp1;
|
||||
pt2 = (STOREPIN**) cmp2;
|
||||
|
||||
ii = StrLenNumICmp( (*pt1)->m_PinNum.GetData(),
|
||||
(*pt2)->m_PinNum.GetData(), 4 );
|
||||
return ii;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************/
|
||||
static void ChangePinNet( wxString& PinNet )
|
||||
/*******************************************/
|
||||
|
||||
/* 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
|
||||
*/
|
||||
{
|
||||
STOREPIN* Pin;
|
||||
STORECMP* CurrentCmp;
|
||||
int ii;
|
||||
wxString OldName;
|
||||
wxString NewName;
|
||||
COMPONENT_LIST::iterator iCmp;
|
||||
PIN_LIST::iterator iPin;
|
||||
PIN* Pin;
|
||||
COMPONENT* Cmp;
|
||||
wxString OldName;
|
||||
wxString NewName;
|
||||
|
||||
OldName = PinNet;
|
||||
ii = PinNet.Len();
|
||||
if( Rjustify ) /* On conserve les 8 dernieres lettres du nom */
|
||||
|
||||
if( rightJustify ) /* On conserve les 8 dernieres lettres du nom */
|
||||
{
|
||||
NewName = OldName.Right( 8 );
|
||||
NewName << NetNumCode;
|
||||
NewName << *netNumber;
|
||||
}
|
||||
else /* On conserve les 8 premieres lettres du nom */
|
||||
{
|
||||
NewName = OldName.Left( 8 );
|
||||
NewName << NetNumCode;
|
||||
NewName << *netNumber;
|
||||
}
|
||||
NetNumCode++;
|
||||
|
||||
CurrentCmp = g_BaseListeCmp;
|
||||
for( ; CurrentCmp != NULL; CurrentCmp = CurrentCmp->Pnext )
|
||||
*netNumber = *netNumber + 1;
|
||||
|
||||
for( iCmp = list.begin(); iCmp != list.end(); ++iCmp )
|
||||
{
|
||||
Pin = CurrentCmp->m_Pins;
|
||||
for( ; Pin != NULL; Pin = Pin->Pnext )
|
||||
Cmp = *iCmp;
|
||||
|
||||
for( iPin = Cmp->m_Pins.begin(); iPin != Cmp->m_Pins.end(); ++iPin )
|
||||
{
|
||||
Pin = *iPin;
|
||||
|
||||
if( Pin->m_PinNet != OldName )
|
||||
continue;
|
||||
|
||||
Pin->m_PinNet = NewName;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
#include <wx/docview.h>
|
||||
#include <wx/config.h>
|
||||
#include <wx/filename.h>
|
||||
#include "param_config.h"
|
||||
|
||||
|
||||
enum id_app_type {
|
||||
APP_TYPE_UNKOWN,
|
||||
|
@ -26,7 +28,6 @@ enum id_app_type {
|
|||
|
||||
class wxConfigBase;
|
||||
class wxFileConfig;
|
||||
class PARAM_CFG_BASE;
|
||||
class wxSingleInstanceChecker;
|
||||
class wxHtmlHelpController;
|
||||
|
||||
|
@ -120,6 +121,9 @@ public:
|
|||
void WriteProjectConfig( const wxString& local_config_filename,
|
||||
const wxString& GroupName,
|
||||
PARAM_CFG_BASE** List );
|
||||
void WriteProjectConfig( const wxString& fileName,
|
||||
const wxString& GroupName,
|
||||
const PARAM_CFG_ARRAY& params );
|
||||
|
||||
/** Function SaveCurrentSetupValues()
|
||||
* Save the current setup values in m_EDA_Config
|
||||
|
@ -136,7 +140,12 @@ public:
|
|||
void ReadCurrentSetupValues( PARAM_CFG_BASE** aList );
|
||||
|
||||
bool ReadProjectConfig( const wxString& local_config_filename,
|
||||
const wxString& GroupName, PARAM_CFG_BASE** List,
|
||||
const wxString& GroupName,
|
||||
PARAM_CFG_BASE** List,
|
||||
bool Load_Only_if_New );
|
||||
bool ReadProjectConfig( const wxString& local_config_filename,
|
||||
const wxString& GroupName,
|
||||
const PARAM_CFG_ARRAY& List,
|
||||
bool Load_Only_if_New );
|
||||
bool ReCreatePrjConfig( const wxString& local_config_filename,
|
||||
const wxString& GroupName,
|
||||
|
|
|
@ -171,12 +171,14 @@ extern const wxString SchematicFileExtension;
|
|||
extern const wxString BoardFileExtension;
|
||||
extern const wxString NetlistFileExtension;
|
||||
extern const wxString GerberFileExtension;
|
||||
extern const wxString PdfFileExtension;
|
||||
|
||||
extern const wxString ProjectFileWildcard;
|
||||
extern const wxString SchematicFileWildcard;
|
||||
extern const wxString BoardFileWildcard;
|
||||
extern const wxString NetlistFileWildcard;
|
||||
extern const wxString GerberFileWildcard;
|
||||
extern const wxString PdfFileWildcard;
|
||||
extern const wxString AllFilesWildcard;
|
||||
|
||||
|
||||
|
|
|
@ -461,6 +461,7 @@ enum main_id {
|
|||
ID_CVPCB_SHOW3D_FRAME,
|
||||
ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST,
|
||||
ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST,
|
||||
ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE,
|
||||
ID_CVPCB_UNUSED0,
|
||||
ID_CVPCB_UNUSED1,
|
||||
ID_CVPCB_UNUSED2,
|
||||
|
|
|
@ -59,12 +59,10 @@ const wxChar* s_AllowedExtensionsToList[] =
|
|||
|
||||
/* File extension definitions. */
|
||||
const wxString PythonFileExtension( wxT( "py" ) );
|
||||
const wxString PdfFileExtension( wxT( "pdf" ) );
|
||||
const wxString TextFileExtension( wxT( "txt" ) );
|
||||
|
||||
/* File wildcard definitions. */
|
||||
const wxString PythonFileWildcard( wxT( "Python files (*.py)|*.py" ) );
|
||||
const wxString PdfFileWildcard( wxT( "Portable document files (*.pdf)|*.pdf" ) );
|
||||
const wxString TextFileWildcard( wxT( "Text files (*.txt)|*.txt" ) );
|
||||
|
||||
|
||||
|
|
|
@ -25,6 +25,11 @@
|
|||
static const wxString UserGridSizeXEntry( wxT( "PcbUserGrid_X" ) );
|
||||
static const wxString UserGridSizeYEntry( wxT( "PcbUserGrid_Y" ) );
|
||||
static const wxString UserGridUnitsEntry( wxT( "PcbUserGrid_Unit" ) );
|
||||
static const wxString DisplayPadFillEntry( wxT( "DiPadFi" ) );
|
||||
static const wxString DisplayPadNumberEntry( wxT( "DiPadNu" ) );
|
||||
static const wxString DisplayModuleEdgeEntry( wxT( "DiModEd" ) );
|
||||
static const wxString DisplayModuleTextEntry( wxT( "DiModTx" ) );
|
||||
|
||||
|
||||
/*******************************/
|
||||
/* class WinEDA_BasePcbFrame */
|
||||
|
@ -392,6 +397,16 @@ void WinEDA_BasePcbFrame::LoadSettings()
|
|||
cfg->Read( m_FrameName + UserGridSizeYEntry, &m_UserGridSize.y, 0.01 );
|
||||
cfg->Read( m_FrameName + UserGridUnitsEntry, &m_UserGridUnits,
|
||||
( long )INCHES );
|
||||
cfg->Read( m_FrameName + DisplayPadFillEntry, &m_DisplayPadFill, true );
|
||||
cfg->Read( m_FrameName + DisplayPadNumberEntry, &m_DisplayPadNum, true );
|
||||
cfg->Read( m_FrameName + DisplayModuleEdgeEntry, &m_DisplayModEdge,
|
||||
( long )FILLED );
|
||||
if( m_DisplayModEdge < FILAIRE || m_DisplayModEdge > SKETCH )
|
||||
m_DisplayModEdge = FILLED;
|
||||
cfg->Read( m_FrameName + DisplayModuleTextEntry, &m_DisplayModText,
|
||||
( long )FILLED );
|
||||
if( m_DisplayModText < FILAIRE || m_DisplayModText > SKETCH )
|
||||
m_DisplayModText = FILLED;
|
||||
}
|
||||
|
||||
|
||||
|
@ -411,4 +426,8 @@ void WinEDA_BasePcbFrame::SaveSettings()
|
|||
cfg->Write( m_FrameName + UserGridSizeXEntry, m_UserGridSize.x );
|
||||
cfg->Write( m_FrameName + UserGridSizeYEntry, m_UserGridSize.y );
|
||||
cfg->Write( m_FrameName + UserGridUnitsEntry, ( long )m_UserGridUnits );
|
||||
cfg->Write( m_FrameName + DisplayPadFillEntry, m_DisplayPadFill );
|
||||
cfg->Write( m_FrameName + DisplayPadNumberEntry, m_DisplayPadNum );
|
||||
cfg->Write( m_FrameName + DisplayModuleEdgeEntry, ( long )m_DisplayModEdge );
|
||||
cfg->Write( m_FrameName + DisplayModuleTextEntry, ( long )m_DisplayModText );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue