Added: handling multiple user paths in library path list in Cvpcb. Other minor changes

This commit is contained in:
charras 2009-04-21 17:56:27 +00:00
parent 6039a5f785
commit b4b57a96e7
20 changed files with 2670 additions and 2582 deletions

View File

@ -25,7 +25,7 @@ int S3D_MASTER:: ReadData()
{
char line[1024], * text;
wxFileName fn;
wxString tmp;
wxString FullFilename;
FILE* file;
int LineNum = 0;
@ -34,23 +34,23 @@ int S3D_MASTER:: ReadData()
return 1;
}
fn = m_Shape3DName;
if( !fn.FileExists() )
if( wxFileName::FileExists(m_Shape3DName) )
FullFilename = m_Shape3DName;
else
{
tmp = wxGetApp().FindLibraryPath( fn );
fn = m_Shape3DName;
FullFilename = wxGetApp().FindLibraryPath( fn );
if( !tmp )
if( FullFilename.IsEmpty() )
{
wxLogDebug( _( "3D part library <%s> could not be found." ),
fn.GetFullPath().c_str() );
return -1;
}
fn = tmp;
}
file = wxFopen( fn.GetFullPath(), wxT( "rt" ) );
file = wxFopen( FullFilename, wxT( "rt" ) );
if( file == NULL )
{

View File

@ -3,7 +3,7 @@
* under GNU General Public License (see copyright.txt)
== Main Author
Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
Maitre de Conferences
IUT1 GEII2
Universite Joseph Fourier (U.J.F.)
@ -24,7 +24,7 @@ Wayne Stambaugh <stambaughw@verizon.net>
See also CHANGELOG.txt for contributors.
== Document Writers
Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
Igor Plyatov <plyatov@gmail.com>
== Translators

View File

@ -8,7 +8,7 @@
#include "appl_wxstruct.h"
#define BUILD_VERSION wxT("(20090414-unstable)")
#define BUILD_VERSION wxT("(20090421-unstable)")
wxString g_BuildVersion
@ -138,7 +138,7 @@ void InitKiCadAbout( wxAboutDialogInfo& info )
info.AddDeveloper( SetMsg( wxT( "Wayne Stambaugh <stambaughw@verizon.net>" ) ) );
/* Add document writers*/
info.AddDocWriter( wxT( "Jean-Pierre Charras <jean-pierre.charras@inpg.fr>" ) );
info.AddDocWriter( wxT( "Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>" ) );
info.AddDocWriter( SetMsg( wxT( "Igor Plyatov <plyatov@gmail.com>" ) ) );
/* Add translators */

View File

@ -112,6 +112,11 @@ bool GetAssociatedDocument( wxFrame* aFrame,
/* Compute the full file name */
if( wxIsAbsolutePath( aDocName ) || aPaths == NULL)
fullfilename = aDocName;
/* If the file exists, this is a trivial case: return the filename "as this"
* the name can be an absolute path, or a relative path like ./filename or ../<filename>
*/
else if( wxFileName::FileExists( aDocName ) )
fullfilename = aDocName;
else
{
fullfilename = aPaths->FindValidPath( aDocName );

View File

@ -12,7 +12,8 @@ set(CVPCB_SRCS
class_cvpcb.cpp
cvframe.cpp
cvpcb.cpp
# dialog_cvpcb_config.cpp
dialog_cvpcb_config.cpp
dialog_cvpcb_config_fbp.cpp
dialog_display_options.cpp
displayframe.cpp
genequiv.cpp

View File

@ -9,6 +9,7 @@
#include "confirm.h"
#include "gestfich.h"
#include "appl_wxstruct.h"
#include "kicad_string.h"
#include "cvpcb.h"
#include "protos.h"
@ -23,7 +24,6 @@ public:
AUTOMODULE* Pnext;
wxString m_Name;
wxString m_LibName;
wxString m_Library;
AUTOMODULE() { m_Type = 0; Pnext = NULL; }
};
@ -33,27 +33,20 @@ public:
static int auto_select( WinEDA_CvpcbFrame* frame,
STORECMP* Cmp,
AUTOMODULE* BaseListeMod );
static void auto_associe( WinEDA_CvpcbFrame* frame );
static char * ReadQuotedText(wxString & aTarget, char * aText);
/*************************************************************/
void WinEDA_CvpcbFrame::AssocieModule( wxCommandEvent& event )
/*************************************************************/
/* Fonction liee au boutton "Auto"
* Lance l'association automatique modules/composants
/* 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 )
* format of a line:
* 'cmp_ref' 'footprint_name'
*/
{
auto_associe( this );
}
/**************************************************/
static void auto_associe( WinEDA_CvpcbFrame* frame )
/**************************************************/
{
wxFileName fn;
unsigned ii, j, k;
wxString msg, tmp;
char Line[1024];
FILE* file;
@ -66,7 +59,7 @@ static void auto_associe( WinEDA_CvpcbFrame* frame )
return;
/* recherche des equivalences a travers les fichiers possibles */
for( ii = 0; ii < g_ListName_Equ.GetCount(); ii++ )
for( unsigned ii = 0; ii < g_ListName_Equ.GetCount(); ii++ )
{
fn = g_ListName_Equ[ii];
fn.SetExt( EquivFileExtension );
@ -92,16 +85,13 @@ static void auto_associe( WinEDA_CvpcbFrame* frame )
}
/* lecture fichier n */
while( fgets( Line, 79, file ) != 0 )
while( GetLine( file, Line, NULL, sizeof(Line) ) != NULL )
{
/* elimination des lignes vides */
for( j = 0; j < 40; j++ )
{
if( Line[j] == 0 )
goto fin_de_while;
if( Line[j] == QUOTE )
break;
}
char * text = Line;
text = ReadQuotedText(tmp, text);
if ( text == NULL || (*text == 0 ) )
continue;
ItemModule = new AUTOMODULE();
ItemModule->Pnext = BaseListeMod;
@ -109,56 +99,73 @@ static void auto_associe( WinEDA_CvpcbFrame* frame )
/* stockage du composant ( 'namecmp' 'namelib')
* name et namelib */
for( j++; j < 40; j++, k++ )
{
if( Line[j] == QUOTE )
break;
ItemModule->m_Name.Append( Line[j] );
}
ItemModule->m_Name = tmp;
j++;
for( ; j < 80; )
if( Line[j++] == QUOTE )
break;
for( ; ; j++ )
{
if( Line[j] == QUOTE )
break;
ItemModule->m_LibName.Append( Line[j] );
}
text++;
ReadQuotedText(ItemModule->m_LibName, text);
nb_correspondances++;
fin_de_while:;
}
fclose( file );
/* Affichage Statistiques */
msg.Printf( _( "%d equivalences" ), nb_correspondances );
frame->SetStatusText( msg, 0 );
}
/* display some info */
msg.Printf( _( "%d equivalences" ), nb_correspondances );
SetStatusText( msg, 0 );
wxMessageBox(msg);
Component = g_BaseListeCmp;
for( ii = 0; Component != NULL; Component = Component->Pnext, ii++ )
for( unsigned ii = 0; Component != NULL; Component = Component->Pnext, ii++ )
{
frame->m_ListCmp->SetSelection( ii, TRUE );
m_ListCmp->SetSelection( ii, TRUE );
if( Component->m_Module.IsEmpty() )
auto_select( frame, Component, BaseListeMod );
auto_select( this, Component, BaseListeMod );
}
/* Liberation memoire */
/* free memory: */
for( ItemModule = BaseListeMod; ItemModule != NULL; ItemModule = NextMod )
{
NextMod = ItemModule->Pnext; delete ItemModule;
NextMod = ItemModule->Pnext;
delete ItemModule;
}
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;
}
/****************************************************************/
static int auto_select( WinEDA_CvpcbFrame* frame, STORECMP* Cmp,
int auto_select( WinEDA_CvpcbFrame* frame, STORECMP* Cmp,
AUTOMODULE* BaseListeMod )
/****************************************************************/

View File

@ -18,6 +18,7 @@
#include "bitmaps.h"
#include "protos.h"
#include "cvstruct.h"
#include "dialog_cvpcb_config.h"
#define FRAME_MIN_SIZE_X 450
@ -342,7 +343,8 @@ void WinEDA_CvpcbFrame::SaveQuitCvpcb( wxCommandEvent& event )
if( SaveNetList( wxEmptyString ) > 0 )
{
modified = 0;
Close( TRUE );
if ( ! g_KeepCvpcbOpen )
Close( TRUE );
}
}
@ -437,12 +439,9 @@ void WinEDA_CvpcbFrame::LoadNetList( wxCommandEvent& event )
/***********************************************************/
void WinEDA_CvpcbFrame::ConfigCvpcb( wxCommandEvent& event )
/***********************************************************/
/* Fonction liee au boutton "Config"
* Affiche le panneau de configuration
*/
{
CreateConfigWindow();
DIALOG_CVPCB_CONFIG ConfigFrame( this );
ConfigFrame.ShowModal();
}
@ -500,18 +499,10 @@ void WinEDA_CvpcbFrame::SetLanguage( wxCommandEvent& event )
void WinEDA_CvpcbFrame::DisplayDocFile( wxCommandEvent& event )
/*************************************************************/
{
wxASSERT( wxGetApp().m_EDA_CommonConfig != NULL );
wxString DocModuleFileName, fullfilename;
wxConfig* cfg = wxGetApp().m_EDA_CommonConfig;
DocModuleFileName = cfg->Read( DOC_FOOTPRINTS_LIST_KEY,
DEFAULT_FOOTPRINTS_LIST_FILENAME );
if( wxIsAbsolutePath( DocModuleFileName ) )
fullfilename = DocModuleFileName;
else
fullfilename = FindKicadHelpPath() + wxT( "../" ) + DocModuleFileName;
GetAssociatedDocument( this, fullfilename );
cfg->Read( DOC_FOOTPRINTS_LIST_KEY, g_DocModulesFileName );
GetAssociatedDocument( this, g_DocModulesFileName, &wxGetApp().GetLibraryPathList() );
}

View File

@ -24,9 +24,13 @@ const wxString ComponentFileExtension( wxT( "cmp" ) );
const wxString RetroFileExtension( wxT( "stf" ) );
const wxString EquivFileExtension( wxT( "equ" ) );
/* TODO: What is a stuff file??? Please fix this wild card in English if
* you know. */
// 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 titleLibLoadError( _( "Library Load Error" ) );
@ -40,6 +44,10 @@ 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;
@ -48,6 +56,14 @@ 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 )
@ -65,7 +81,7 @@ bool WinEDA_App::OnInit()
wxString currCWD = wxGetCwd();
WinEDA_CvpcbFrame* frame = NULL;
InitEDA_Appl( wxT( "CVpcb" ), APP_TYPE_CVPCB );
InitEDA_Appl( wxT( "Cvpcb" ), APP_TYPE_CVPCB );
if( m_Checker && m_Checker->IsAnotherRunning() )
{
@ -96,6 +112,9 @@ bool WinEDA_App::OnInit()
SetTopWindow( frame );
Read_Config( fn.GetFullPath() );
long tmp;
if ( wxGetApp().m_EDA_CommonConfig->Read( CLOSE_OPTION_KEY, & tmp) )
g_KeepCvpcbOpen = tmp;
frame->Show( TRUE );
frame->BuildFootprintListBox();

View File

@ -8,8 +8,11 @@
#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")
#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" )
@ -62,7 +65,7 @@ public:
wxString m_Module; /* Nom du module (Package) corresp */
wxString m_Repere; /* utilise selon formats de netliste */
wxArrayString m_FootprintFilter; /* List of allowed footprints (wildcart allowed
* if void: no filtering */
* if void: no filtering */
STORECMP();
~STORECMP();
@ -94,25 +97,40 @@ extern const wxString EquivFileWildcard;
extern const wxString titleLibLoadError;
/* CvPcb global variable definition references. */
extern STOREMOD* g_BaseListePkg;
extern STORECMP* g_BaseListeCmp;
// Wildcard for footprint libraries filesnames
extern const wxString g_FootprintLibFileWildcard;
extern wxString g_NetlistFileExtension;
extern wxString g_UserNetDirBuffer;
// 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:
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 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 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 );

View File

@ -67,7 +67,6 @@ public:
void BuildCmpListBox();
void BuildFootprintListBox();
void CreateScreenCmp();
void CreateConfigWindow();
int SaveNetList( const wxString& FullFileName );
int SaveComponentList( const wxString& FullFileName );
bool ReadNetList();

View File

@ -1,346 +1,400 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_cvpcb_config.cpp
// Purpose:
// Author: jean-pierre Charras
// Modified by:
// Created: 17/02/2006 18:43:13
// RCS-ID:
// Copyright: License GNU
// Licence:
// Licence: gpl
/////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 17/02/2006 18:43:13
#include "fctsys.h"
#include <wx/tokenzr.h>
#include "appl_wxstruct.h"
#include "common.h"
#include "confirm.h"
#include "gestfich.h"
#include "cvpcb.h"
#include "cvstruct.h"
////@begin includes
////@end includes
#include "bitmaps.h"
#include "protos.h"
#include "dialog_cvpcb_config.h"
////@begin XPM images
////@end XPM images
/*!
* KiConfigCvpcbFrame type definition
*/
IMPLEMENT_DYNAMIC_CLASS( KiConfigCvpcbFrame, wxDialog )
/*!
* KiConfigCvpcbFrame event table definition
*/
BEGIN_EVENT_TABLE( KiConfigCvpcbFrame, wxDialog )
////@begin KiConfigCvpcbFrame event table entries
EVT_BUTTON( SAVE_CFG, KiConfigCvpcbFrame::OnSaveCfgClick )
EVT_BUTTON( ID_READ_OLDCFG, KiConfigCvpcbFrame::OnReadOldcfgClick )
EVT_BUTTON( wxID_OK, KiConfigCvpcbFrame::OnOkClick )
EVT_BUTTON( DEL_LIB, KiConfigCvpcbFrame::OnDelLibClick )
EVT_BUTTON( ADD_LIB, KiConfigCvpcbFrame::OnAddLibClick )
EVT_BUTTON( INSERT_LIB, KiConfigCvpcbFrame::OnInsertLibClick )
EVT_BUTTON( DEL_EQU, KiConfigCvpcbFrame::OnDelEquClick )
EVT_BUTTON( ADD_EQU, KiConfigCvpcbFrame::OnAddEquClick )
EVT_BUTTON( INSERT_EQU, KiConfigCvpcbFrame::OnInsertEquClick )
////@end KiConfigCvpcbFrame event table entries
END_EVENT_TABLE()
/*!
* KiConfigCvpcbFrame constructors
*/
KiConfigCvpcbFrame::KiConfigCvpcbFrame( )
DIALOG_CVPCB_CONFIG::DIALOG_CVPCB_CONFIG( WinEDA_CvpcbFrame* parent ) :
DIALOG_CVPCB_CONFIG_FBP( parent )
{
}
wxString title;
KiConfigCvpcbFrame::KiConfigCvpcbFrame( WinEDA_CvpcbFrame* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
wxString title;
m_Parent = parent;
m_DoUpdate = TRUE;
Create(parent, id, caption, pos, size, style);
title = _("from ") + wxGetApp().m_CurrentOptionFile;
SetTitle(title);
}
/*!
* KiConfigCvpcbFrame creator
*/
bool KiConfigCvpcbFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
////@begin KiConfigCvpcbFrame member initialisation
m_OkButton = NULL;
m_FileExtList = NULL;
m_RightBoxSizer = NULL;
m_ListLibr = NULL;
m_ListEquiv = NULL;
m_FileExtBoxSizerH = NULL;
m_NetExtBoxSizer = NULL;
////@end KiConfigCvpcbFrame member initialisation
////@begin KiConfigCvpcbFrame creation
SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
wxDialog::Create( parent, id, caption, pos, size, style );
CreateControls();
if (GetSizer())
m_Parent = parent;
m_Config = wxGetApp().m_EDA_CommonConfig;
Init( );
title = _( "from " ) + wxGetApp().m_CurrentOptionFile;
SetTitle( title );
if( GetSizer() )
{
GetSizer()->SetSizeHints(this);
GetSizer()->SetSizeHints( this );
}
Centre();
////@end KiConfigCvpcbFrame creation
return true;
}
/*!
* Control creation for KiConfigCvpcbFrame
*/
void KiConfigCvpcbFrame::CreateControls()
/*************************************/
void DIALOG_CVPCB_CONFIG::Init()
/*************************************/
{
SetFont(*g_DialogFont);
wxString msg;
////@begin KiConfigCvpcbFrame content construction
// Generated by DialogBlocks, 31/07/2008 20:39:18 (unregistered)
SetFont( *g_DialogFont );
SetFocus();
KiConfigCvpcbFrame* itemDialog1 = this;
m_LibListChanged = false;
m_LibPathChanged = false;
m_UserLibDirBufferImg = g_UserLibDirBuffer; // Save the original lib path
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
itemDialog1->SetSizer(itemBoxSizer2);
// Display current files extension (info)
msg = m_InfoCmpFileExt->GetLabel() + ComponentFileExtension;
m_InfoCmpFileExt->SetLabel( msg );
wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer2->Add(itemBoxSizer3, 0, wxGROW|wxALL, 5);
msg = m_InfoLibFileExt->GetLabel() + ModuleFileExtension;
m_InfoLibFileExt->SetLabel( msg );
wxButton* itemButton4 = new wxButton( itemDialog1, SAVE_CFG, _("Save Cfg"), wxDefaultPosition, wxDefaultSize, 0 );
itemButton4->SetForegroundColour(wxColour(198, 0, 0));
itemBoxSizer3->Add(itemButton4, 0, wxGROW|wxALL, 5);
msg = m_InfoNetlistFileExt->GetLabel() + g_NetlistFileExtension;
m_InfoNetlistFileExt->SetLabel( msg );
wxButton* itemButton5 = new wxButton( itemDialog1, ID_READ_OLDCFG, _("Read Cfg"), wxDefaultPosition, wxDefaultSize, 0 );
itemButton5->SetForegroundColour(wxColour(0, 0, 255));
itemBoxSizer3->Add(itemButton5, 0, wxGROW|wxLEFT|wxRIGHT, 5);
msg = m_InfoEquivFileExt->GetLabel() + EquivFileExtension;
m_InfoEquivFileExt->SetLabel( msg );
itemBoxSizer3->Add(5, 5, 0, wxGROW|wxALL, 5);
msg = m_InfoRetroannotFileExt->GetLabel() + RetroFileExtension;
m_InfoRetroannotFileExt->SetLabel( msg );
m_OkButton = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
m_OkButton->SetDefault();
m_OkButton->SetForegroundColour(wxColour(0, 128, 0));
itemBoxSizer3->Add(m_OkButton, 0, wxGROW|wxALL, 5);
m_ListLibr->InsertItems( g_LibName_List, 0 );
m_ListEquiv->InsertItems( g_ListName_Equ, 0 );
wxStaticBox* itemStaticBoxSizer8Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Files ext:"));
m_FileExtList = new wxStaticBoxSizer(itemStaticBoxSizer8Static, wxVERTICAL);
itemBoxSizer3->Add(m_FileExtList, 0, wxGROW|wxALL, 5);
// Display current modules doc file:
m_Config->Read( DOC_FOOTPRINTS_LIST_KEY, g_DocModulesFileName );
m_TextHelpModulesFileName->SetValue( g_DocModulesFileName );
m_RightBoxSizer = new wxBoxSizer(wxVERTICAL);
itemBoxSizer2->Add(m_RightBoxSizer, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
// Load user libs paths:
wxStringTokenizer Token( m_UserLibDirBufferImg, wxT( ";\n\r" ) );
while( Token.HasMoreTokens() )
{
wxString path = Token.GetNextToken();
if( wxFileName::DirExists( path ) )
m_listUserPaths->Append( path );
}
wxBoxSizer* itemBoxSizer10 = new wxBoxSizer(wxHORIZONTAL);
m_RightBoxSizer->Add(itemBoxSizer10, 1, wxALIGN_CENTER_HORIZONTAL, 5);
// Display actual libraries paths:
wxPathList libpaths = wxGetApp().GetLibraryPathList();
for( unsigned ii = 0; ii < libpaths.GetCount(); ii++ )
{
m_DefaultLibraryPathslistBox->Append( libpaths[ii] );
}
wxBoxSizer* itemBoxSizer11 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer10->Add(itemBoxSizer11, 0, wxGROW|wxLEFT|wxTOP|wxBOTTOM, 5);
wxBoxSizer* itemBoxSizer12 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer11->Add(itemBoxSizer12, 1, wxALIGN_CENTER_HORIZONTAL, 5);
wxBoxSizer* itemBoxSizer13 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer12->Add(itemBoxSizer13, 0, wxGROW, 5);
wxButton* itemButton14 = new wxButton( itemDialog1, DEL_LIB, _("Del"), wxDefaultPosition, wxDefaultSize, 0 );
itemButton14->SetForegroundColour(wxColour(191, 0, 0));
itemBoxSizer13->Add(itemButton14, 0, wxGROW|wxLEFT|wxTOP|wxBOTTOM, 5);
wxButton* itemButton15 = new wxButton( itemDialog1, ADD_LIB, _("Add"), wxDefaultPosition, wxDefaultSize, 0 );
itemButton15->SetForegroundColour(wxColour(0, 128, 0));
itemBoxSizer13->Add(itemButton15, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
wxButton* itemButton16 = new wxButton( itemDialog1, INSERT_LIB, _("Ins"), wxDefaultPosition, wxDefaultSize, 0 );
itemButton16->SetForegroundColour(wxColour(0, 0, 255));
itemBoxSizer13->Add(itemButton16, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxTOP|wxBOTTOM, 5);
wxBoxSizer* itemBoxSizer17 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer12->Add(itemBoxSizer17, 1, wxGROW|wxTOP, 5);
wxStaticText* itemStaticText18 = new wxStaticText( itemDialog1, wxID_STATIC, _("Libraries"), wxDefaultPosition, wxDefaultSize, 0 );
itemStaticText18->SetForegroundColour(wxColour(204, 0, 0));
itemBoxSizer17->Add(itemStaticText18, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
wxArrayString m_ListLibrStrings;
m_ListLibr = new wxListBox( itemDialog1, ID_LISTBOX, wxDefaultPosition, wxSize(-1, 200), m_ListLibrStrings, wxLB_SINGLE );
itemBoxSizer17->Add(m_ListLibr, 1, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
wxBoxSizer* itemBoxSizer20 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer10->Add(itemBoxSizer20, 0, wxGROW|wxTOP|wxBOTTOM, 5);
wxBoxSizer* itemBoxSizer21 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer20->Add(itemBoxSizer21, 1, wxALIGN_CENTER_HORIZONTAL, 5);
wxBoxSizer* itemBoxSizer22 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer21->Add(itemBoxSizer22, 0, wxGROW, 5);
wxButton* itemButton23 = new wxButton( itemDialog1, DEL_EQU, _("Del"), wxDefaultPosition, wxDefaultSize, 0 );
itemButton23->SetForegroundColour(wxColour(196, 0, 0));
itemBoxSizer22->Add(itemButton23, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
wxButton* itemButton24 = new wxButton( itemDialog1, ADD_EQU, _("Add"), wxDefaultPosition, wxDefaultSize, 0 );
itemButton24->SetForegroundColour(wxColour(0, 128, 0));
itemBoxSizer22->Add(itemButton24, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
wxButton* itemButton25 = new wxButton( itemDialog1, INSERT_EQU, _("Ins"), wxDefaultPosition, wxDefaultSize, 0 );
itemButton25->SetForegroundColour(wxColour(0, 0, 255));
itemBoxSizer22->Add(itemButton25, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxTOP|wxBOTTOM, 5);
wxBoxSizer* itemBoxSizer26 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer21->Add(itemBoxSizer26, 1, wxGROW|wxTOP, 5);
wxStaticText* itemStaticText27 = new wxStaticText( itemDialog1, wxID_STATIC, _("Equiv"), wxDefaultPosition, wxDefaultSize, 0 );
itemStaticText27->SetForegroundColour(wxColour(204, 0, 0));
itemBoxSizer26->Add(itemStaticText27, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
wxArrayString m_ListEquivStrings;
m_ListEquiv = new wxListBox( itemDialog1, ID_LISTBOX1, wxDefaultPosition, wxSize(-1, 200), m_ListEquivStrings, wxLB_SINGLE );
itemBoxSizer26->Add(m_ListEquiv, 1, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
m_FileExtBoxSizerH = new wxBoxSizer(wxHORIZONTAL);
m_RightBoxSizer->Add(m_FileExtBoxSizerH, 0, wxGROW, 5);
m_NetExtBoxSizer = new wxBoxSizer(wxVERTICAL);
m_FileExtBoxSizerH->Add(m_NetExtBoxSizer, 0, wxGROW|wxRIGHT, 5);
////@end KiConfigCvpcbFrame content construction
SetDialogDatas();
m_OkButton->SetFocus( );
// select the first path afer the current path project
if( libpaths.GetCount() > 1 )
m_DefaultLibraryPathslistBox->Select( 1 );
m_radioBoxCloseOpt->SetSelection ( g_KeepCvpcbOpen ? 1 : 0 );
}
/*!
* Should we show tooltips?
*/
bool KiConfigCvpcbFrame::ShowToolTips()
/******************************************************************/
void DIALOG_CVPCB_CONFIG::OnCancelClick( wxCommandEvent& event )
/******************************************************************/
{
return true;
// Recreate the user lib path
if( m_LibPathChanged )
{
for( unsigned ii = 0; ii < m_ListLibr->GetCount(); ii++ )
wxGetApp().RemoveLibraryPath( m_listUserPaths->GetString( ii ) );
wxGetApp().InsertLibraryPath( g_UserLibDirBuffer, 1 );
}
EndModal( -1 );
}
/*!
* Get bitmap resources
*/
wxBitmap KiConfigCvpcbFrame::GetBitmapResource( const wxString& name )
/**************************************************************/
void DIALOG_CVPCB_CONFIG::OnOkClick( wxCommandEvent& event )
/**************************************************************/
{
// Bitmap retrieval
////@begin KiConfigCvpcbFrame bitmap retrieval
wxUnusedVar(name);
return wxNullBitmap;
////@end KiConfigCvpcbFrame bitmap retrieval
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() );
// Recreate the user lib path
if( m_LibPathChanged )
{
g_UserLibDirBuffer.Empty();
for( unsigned ii = 0; ii < m_listUserPaths->GetCount(); ii++ )
{
if( ii > 0 )
g_UserLibDirBuffer << wxT( ";" );
g_UserLibDirBuffer << m_listUserPaths->GetString( ii );
}
}
// Set new active library list if the lib list of if default path list was modified
if( m_LibListChanged || m_LibPathChanged )
{
// Recreate lib list
g_LibName_List.Clear();
for( unsigned ii = 0; ii < m_ListLibr->GetCount(); ii++ )
g_LibName_List.Add( m_ListLibr->GetString( ii ) );
// Recreate equ list
g_ListName_Equ.Clear();
for( unsigned ii = 0; ii < m_ListEquiv->GetCount(); ii++ )
g_ListName_Equ.Add( m_ListEquiv->GetString( ii ) );
listlib();
m_Parent->BuildFootprintListBox();
}
if( event.GetId() != ID_SAVE_CFG )
EndModal( 0 );
}
/*!
* Get icon resources
*/
wxIcon KiConfigCvpcbFrame::GetIconResource( const wxString& name )
/**************************************************************/
void DIALOG_CVPCB_CONFIG::OnCloseWindow( wxCloseEvent& event )
/**************************************************************/
{
// Icon retrieval
#ifdef __WINDOWS__
return( wxICON(a_icon_cvpcb));
#else
return( wxICON(icon_cvpcb));
#endif
EndModal( 0 );
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for SAVE_CFG
/*********************************************************************/
void DIALOG_CVPCB_CONFIG::OnRemoveLibClick( wxCommandEvent& event )
/*********************************************************************/
/* Remove a library to the library list.
* The real list (g_LibName_List) is not changed, so the change can be cancelled
*/
void KiConfigCvpcbFrame::OnSaveCfgClick( wxCommandEvent& event )
{
SaveCfg(event);
int ii;
wxListBox * list = m_ListEquiv;
if( event.GetId() == ID_REMOVE_LIB )
list = m_ListLibr;
ii = list->GetSelection();
if( ii < 0 )
return;
list->Delete( ii );
m_LibListChanged = TRUE;
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_READ_OLDCFG
/**************************************************************************/
void DIALOG_CVPCB_CONFIG::OnAddOrInsertLibClick( wxCommandEvent& event )
/**************************************************************************/
/* Insert or add a library to the library list:
* The new library is put in list before (insert button) the selection,
* or added (add button) to end of list
* The real list (g_LibName_List) is not changed, so the change can be cancelled
*/
void KiConfigCvpcbFrame::OnReadOldcfgClick( wxCommandEvent& event )
{
ReadOldCfg(event);
}
int ii;
wxString libfilename, wildcard;
wxFileName fn;
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
*/
bool insert = false;
void KiConfigCvpcbFrame::OnOkClick( wxCommandEvent& event )
{
AcceptCfg(event);
}
if( (event.GetId() == ID_INSERT_EQU) || (event.GetId() == ID_INSERT_LIB) )
insert = true;
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for DEL_LIB
*/
wildcard = EquivFileWildcard;
wxListBox * list = m_ListEquiv;
if( (event.GetId() == ID_ADD_LIB) || (event.GetId() == ID_INSERT_LIB) )
{
list = m_ListLibr;
wildcard = g_FootprintLibFileWildcard;
}
void KiConfigCvpcbFrame::OnDelLibClick( wxCommandEvent& event )
{
LibDelFct(event);
}
ii = list->GetSelection();
if( ii == wxNOT_FOUND )
ii = 0;
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ADD_LIB
*/
wxString libpath;
libpath = m_DefaultLibraryPathslistBox->GetStringSelection();
if( libpath.IsEmpty() )
libpath = wxGetApp().ReturnLastVisitedLibraryPath();
void KiConfigCvpcbFrame::OnAddLibClick( wxCommandEvent& event )
{
LibAddFct(event);
}
wxFileDialog FilesDialog( this, _( "Footprint library files:" ), libpath,
wxEmptyString, wildcard,
wxFD_DEFAULT_STYLE | wxFD_MULTIPLE );
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for INSERT_LIB
*/
if( FilesDialog.ShowModal() != wxID_OK )
return;
void KiConfigCvpcbFrame::OnInsertLibClick( wxCommandEvent& event )
{
LibAddFct(event);
}
wxArrayString Filenames;
FilesDialog.GetPaths( Filenames );
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for DEL_EQU
*/
for( unsigned jj = 0; jj < Filenames.GetCount(); jj++ )
{
fn = Filenames[jj];
if( jj == 0 )
wxGetApp().SaveLastVisitedLibraryPath( fn.GetPath() );
void KiConfigCvpcbFrame::OnDelEquClick( wxCommandEvent& event )
{
EquDelFct(event);
}
/* If the library path is already in the library search paths
* 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
*
*/
if( wxGetApp().GetLibraryPathList().Index( fn.GetPath() ) != wxNOT_FOUND ) // Ok, trivial case
libfilename = fn.GetName();
else // not in the default, : see if this file is in a subpath:
{
libfilename = fn.GetPathWithSep() + fn.GetName();
for( unsigned kk = 0; kk < wxGetApp().GetLibraryPathList().GetCount(); kk++ )
{
if( fn.MakeRelativeTo( wxGetApp().GetLibraryPathList()[kk] ) )
{
libfilename = fn.GetPathWithSep() + fn.GetName();
break;
}
}
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ADD_EQU
*/
void KiConfigCvpcbFrame::OnAddEquClick( wxCommandEvent& event )
{
EquAddFct(event);
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for INSERT_EQU
*/
void KiConfigCvpcbFrame::OnInsertEquClick( wxCommandEvent& event )
{
EquAddFct(event);
//Add or insert new library name, if not already in list
if( list->FindString( libfilename, fn.IsCaseSensitive() ) == wxNOT_FOUND )
{
m_LibListChanged = TRUE;
if( ! insert )
list->Append( libfilename );
else
list->Insert( libfilename, ii++ );
}
else
{
wxString msg = wxT( "<" ) + libfilename + wxT( "> : " ) +
_( "Library already in use" );
DisplayError( this, msg );
}
}
}
/*******************************************************************/
void DIALOG_CVPCB_CONFIG::OnSaveCfgClick( wxCommandEvent& event )
/*******************************************************************/
{
OnOkClick( event );
Save_Config( this, m_Parent->m_NetlistFileName.GetFullPath() );
}
/***********************************************************************/
void DIALOG_CVPCB_CONFIG::OnAddOrInsertPath( wxCommandEvent& event )
/***********************************************************************/
{
wxString path = wxGetApp().ReturnLastVisitedLibraryPath();
bool select = EDA_DirectorySelector( _( "Default Path for Libraries" ), /* Titre de la fenetre */
path, /* Chemin par defaut */
wxDD_DEFAULT_STYLE,
this, /* parent frame */
wxDefaultPosition );
if( !select )
return;
if( !wxFileName::DirExists( path ) ) // Should not occurs
return;
// Add or insert path if not already in list
if( m_listUserPaths->FindString( path ) == wxNOT_FOUND )
{
int ipos = m_listUserPaths->GetCount();
if( event.GetId() == ID_INSERT_PATH )
{
if( ipos )
ipos--;
int jj = m_listUserPaths->GetSelection();
if( jj >= 0 )
ipos = jj;
}
m_listUserPaths->Insert( path, ipos );
m_LibPathChanged = true;
wxGetApp().InsertLibraryPath( path, ipos + 1 );
// Display actual libraries paths:
wxPathList libpaths = wxGetApp().GetLibraryPathList();
m_DefaultLibraryPathslistBox->Clear();
for( unsigned ii = 0; ii < libpaths.GetCount(); ii++ )
{
m_DefaultLibraryPathslistBox->Append( libpaths[ii] );
}
}
else
DisplayError( this, _( "Path already in use" ) );
wxGetApp().SaveLastVisitedLibraryPath( path );
}
/***********************************************************************/
void DIALOG_CVPCB_CONFIG::OnRemoveUserPath( wxCommandEvent& event )
/***********************************************************************/
{
int ii = m_listUserPaths->GetSelection();
if( ii < 0 )
ii = m_listUserPaths->GetCount() - 1;
if( ii >= 0 )
{
wxGetApp().RemoveLibraryPath( m_listUserPaths->GetStringSelection() );
m_listUserPaths->Delete( ii );
m_LibPathChanged = true;
}
// Display actual libraries paths:
wxPathList libpaths = wxGetApp().GetLibraryPathList();
m_DefaultLibraryPathslistBox->Clear();
for( unsigned ii = 0; ii < libpaths.GetCount(); ii++ )
{
m_DefaultLibraryPathslistBox->Append( libpaths[ii] );
}
}
/**************************************************************************/
void DIALOG_CVPCB_CONFIG::OnBrowseModDocFile( wxCommandEvent& event )
/**************************************************************************/
{
wxString FullFileName, mask;
wxString docpath, filename;
docpath = wxGetApp().ReturnLastVisitedLibraryPath( wxT( "doc" ) );
mask = wxT( "*.pdf" );
wxFileDialog FilesDialog( this, _( "Footprint document file:" ), docpath,
wxEmptyString, mask,
wxFD_DEFAULT_STYLE );
if( FilesDialog.ShowModal() != wxID_OK )
return;
FullFileName = FilesDialog.GetPath();
/* If the path is already in the library search paths
* 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
*/
wxFileName fn = FullFileName;
wxGetApp().SaveLastVisitedLibraryPath( fn.GetPath() );
filename = wxGetApp().ReturnFilenameWithRelativePathInLibPath( FullFileName );
m_TextHelpModulesFileName->SetValue( filename );
}

View File

@ -1,157 +1,44 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_cvpcb_config.h
// Purpose:
// Author: jean-pierre Charras
// Modified by:
// Created: 17/02/2006 18:43:13
// RCS-ID:
// Copyright: License GNU
// Licence:
/////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 17/02/2006 18:43:13
// Name: dialog_display_options.h
// Author: jean-pierre Charras
// Licence: GPL
/////////////////////////////////////////////////////////////////////////////
#ifndef _DIALOG_CVPCB_CONFIG_H_
#define _DIALOG_CVPCB_CONFIG_H_
/*!
* Includes
*/
#include "dialog_cvpcb_config_fbp.h"
////@begin includes
////@end includes
/*!
* Forward declarations
*/
////@begin forward declarations
class wxBoxSizer;
////@end forward declarations
/*!
* Control identifiers
*/
////@begin control identifiers
#define ID_DIALOG 10000
#define SAVE_CFG 10001
#define ID_READ_OLDCFG 10002
#define DEL_LIB 10004
#define ADD_LIB 10005
#define INSERT_LIB 10006
#define ID_LISTBOX 10010
#define DEL_EQU 10007
#define ADD_EQU 10008
#define INSERT_EQU 10009
#define ID_LISTBOX1 10011
#define SYMBOL_KICONFIGCVPCBFRAME_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX
#define SYMBOL_KICONFIGCVPCBFRAME_TITLE _("Cvpcb Configuration")
#define SYMBOL_KICONFIGCVPCBFRAME_IDNAME ID_DIALOG
#define SYMBOL_KICONFIGCVPCBFRAME_SIZE wxSize(400, 300)
#define SYMBOL_KICONFIGCVPCBFRAME_POSITION wxDefaultPosition
////@end control identifiers
/*!
* Compatibility
*/
#ifndef wxCLOSE_BOX
#define wxCLOSE_BOX 0x1000
#endif
/*!
* KiConfigCvpcbFrame class declaration
*/
class KiConfigCvpcbFrame: public wxDialog
class DIALOG_CVPCB_CONFIG : public DIALOG_CVPCB_CONFIG_FBP
{
DECLARE_DYNAMIC_CLASS( KiConfigCvpcbFrame )
DECLARE_EVENT_TABLE()
private:
WinEDA_CvpcbFrame* m_Parent;
wxConfig * m_Config;
wxString m_UserLibDirBufferImg;
bool m_LibListChanged;
bool m_LibPathChanged;
private:
void Init();
// Virtual event handlers
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 );
void OnAddOrInsertPath( wxCommandEvent& event );
void OnRemoveUserPath( wxCommandEvent& event );
public:
/// Constructors
KiConfigCvpcbFrame( );
KiConfigCvpcbFrame( WinEDA_CvpcbFrame* parent, wxWindowID id = SYMBOL_KICONFIGCVPCBFRAME_IDNAME, const wxString& caption = SYMBOL_KICONFIGCVPCBFRAME_TITLE, const wxPoint& pos = SYMBOL_KICONFIGCVPCBFRAME_POSITION, const wxSize& size = SYMBOL_KICONFIGCVPCBFRAME_SIZE, long style = SYMBOL_KICONFIGCVPCBFRAME_STYLE );
/// Creation
bool Create( wxWindow* parent, wxWindowID id = SYMBOL_KICONFIGCVPCBFRAME_IDNAME, const wxString& caption = SYMBOL_KICONFIGCVPCBFRAME_TITLE, const wxPoint& pos = SYMBOL_KICONFIGCVPCBFRAME_POSITION, const wxSize& size = SYMBOL_KICONFIGCVPCBFRAME_SIZE, long style = SYMBOL_KICONFIGCVPCBFRAME_STYLE );
/// Creates the controls and sizers
void CreateControls();
////@begin KiConfigCvpcbFrame event handler declarations
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for SAVE_CFG
void OnSaveCfgClick( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_READ_OLDCFG
void OnReadOldcfgClick( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
void OnOkClick( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for DEL_LIB
void OnDelLibClick( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ADD_LIB
void OnAddLibClick( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for INSERT_LIB
void OnInsertLibClick( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for DEL_EQU
void OnDelEquClick( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ADD_EQU
void OnAddEquClick( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for INSERT_EQU
void OnInsertEquClick( wxCommandEvent& event );
////@end KiConfigCvpcbFrame event handler declarations
////@begin KiConfigCvpcbFrame member function declarations
/// Retrieves bitmap resources
wxBitmap GetBitmapResource( const wxString& name );
/// Retrieves icon resources
wxIcon GetIconResource( const wxString& name );
////@end KiConfigCvpcbFrame member function declarations
/// Should we show tooltips?
static bool ShowToolTips();
void Update();
void AcceptCfg(wxCommandEvent& event);
void SaveCfg(wxCommandEvent& event);
void ReadOldCfg(wxCommandEvent& event);
void LibDelFct(wxCommandEvent& event);
void LibAddFct(wxCommandEvent& event);
void EquDelFct(wxCommandEvent& event);
void EquAddFct(wxCommandEvent& event);
void SetDialogDatas();
////@begin KiConfigCvpcbFrame member variables
wxButton* m_OkButton;
wxStaticBoxSizer* m_FileExtList;
wxBoxSizer* m_RightBoxSizer;
wxListBox* m_ListLibr;
wxListBox* m_ListEquiv;
wxBoxSizer* m_FileExtBoxSizerH;
wxBoxSizer* m_NetExtBoxSizer;
////@end KiConfigCvpcbFrame member variables
WinEDA_CvpcbFrame * m_Parent;
bool m_DoUpdate;
WinEDA_EnterText * m_LibDirCtrl;
WinEDA_EnterText * m_NetInputExtCtrl;
WinEDA_EnterText * m_PkgExtCtrl;
WinEDA_EnterText * m_TextHelpModulesFileName;
DIALOG_CVPCB_CONFIG( WinEDA_CvpcbFrame* parent );
~DIALOG_CVPCB_CONFIG() {};
};
#endif
// _DIALOG_CVPCB_CONFIG_H_
// _DIALOG_CVPCB_CONFIG_H_

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,256 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_cvpcb_config_fbp.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_CVPCB_CONFIG_FBP::DIALOG_CVPCB_CONFIG_FBP( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
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 );
wxBoxSizer* bLibsButtonsSizer;
bLibsButtonsSizer = new wxBoxSizer( wxHORIZONTAL );
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 );
wxBoxSizer* bSizerLibButtons;
bSizerLibButtons = new wxBoxSizer( wxHORIZONTAL );
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 );
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 );
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 );
sbLibsChoiceSizer->Add( bSizerLibButtons, 0, wxALIGN_CENTER_HORIZONTAL, 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 );
wxStaticBoxSizer* sbEquivChoiceSizer;
sbEquivChoiceSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Libraries") ), wxVERTICAL );
wxBoxSizer* bEquivButtonsSizer;
bEquivButtonsSizer = new wxBoxSizer( wxHORIZONTAL );
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 );
wxBoxSizer* bSizerEquButtons;
bSizerEquButtons = new wxBoxSizer( wxHORIZONTAL );
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 );
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 );
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 );
sbEquivChoiceSizer->Add( bSizerEquButtons, 0, wxALIGN_CENTER_HORIZONTAL, 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 );
wxStaticBoxSizer* sbModulesDocSizer;
sbModulesDocSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Module Doc File:") ), wxHORIZONTAL );
m_TextHelpModulesFileName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
sbModulesDocSizer->Add( m_TextHelpModulesFileName, 1, 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 );
wxStaticBoxSizer* sbSizer4;
sbSizer4 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("User Path:") ), wxHORIZONTAL );
wxBoxSizer* bUserListSizer;
bUserListSizer = new wxBoxSizer( wxVERTICAL );
m_listUserPaths = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
m_listUserPaths->SetToolTip( _("Additional paths used in this project. The priority is highter than default Kicad paths.") );
bUserListSizer->Add( m_listUserPaths, 1, wxEXPAND, 5 );
sbSizer4->Add( bUserListSizer, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
wxBoxSizer* bUserPathsButtonsSizer;
bUserPathsButtonsSizer = new wxBoxSizer( wxVERTICAL );
m_buttonAddPath = new wxButton( this, ID_LIB_PATH_SEL, _("Add"), wxDefaultPosition, wxDefaultSize, 0 );
bUserPathsButtonsSizer->Add( m_buttonAddPath, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 );
m_buttonInsPath = new wxButton( this, ID_INSERT_PATH, _("Insert"), wxDefaultPosition, wxDefaultSize, 0 );
bUserPathsButtonsSizer->Add( m_buttonInsPath, 0, wxRIGHT|wxLEFT, 5 );
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 );
bUserLibPathSizer->Add( sbSizer4, 1, 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 );
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 );
bMainSizer->Add( sbLibPathSizer, 0, wxEXPAND, 5 );
this->SetSizer( bMainSizer );
this->Layout();
// 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 );
m_buttonAddEqu->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CVPCB_CONFIG_FBP::OnAddOrInsertLibClick ), NULL, this );
m_buttonInsEqu->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CVPCB_CONFIG_FBP::OnAddOrInsertLibClick ), NULL, this );
m_buttonRemoveEqu->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CVPCB_CONFIG_FBP::OnRemoveLibClick ), NULL, this );
m_buttonModDoc->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CVPCB_CONFIG_FBP::OnBrowseModDocFile ), NULL, this );
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 );
}
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 );
m_buttonAddEqu->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CVPCB_CONFIG_FBP::OnAddOrInsertLibClick ), NULL, this );
m_buttonInsEqu->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CVPCB_CONFIG_FBP::OnAddOrInsertLibClick ), NULL, this );
m_buttonRemoveEqu->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CVPCB_CONFIG_FBP::OnRemoveLibClick ), NULL, this );
m_buttonModDoc->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CVPCB_CONFIG_FBP::OnBrowseModDocFile ), NULL, this );
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 );
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,101 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_cvpcb_config_fbp__
#define __dialog_cvpcb_config_fbp__
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/button.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/stattext.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/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_CVPCB_CONFIG_FBP
///////////////////////////////////////////////////////////////////////////////
class DIALOG_CVPCB_CONFIG_FBP : public wxDialog
{
private:
protected:
enum
{
ID_SAVE_CFG = 1000,
ID_ADD_LIB,
ID_INSERT_LIB,
ID_REMOVE_LIB,
ID_ADD_EQU,
ID_INSERT_EQU,
ID_REMOVE_EQU,
ID_BROWSE_MOD_DOC,
ID_LIB_PATH_SEL,
ID_INSERT_PATH,
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;
wxButton* m_buttonAddLib;
wxButton* m_buttonInsLib;
wxButton* m_buttonRemoveLib;
wxListBox* m_ListLibr;
wxStaticText* m_staticTextEquList;
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;
// 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(); }
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();
};
#endif //__dialog_cvpcb_config_fbp__

View File

@ -16,6 +16,8 @@ OBJECTS = $(TARGET).o \
class_board_item.o\
memoire.o \
cvframe.o\
dialog_cvpcb_config.o\
dialog_cvpcb_config_fbp.o\
listboxes.o\
displayframe.o\
init.o\

View File

@ -1,9 +1,7 @@
/***************************************/
/** menucfg : configuration de CVPCB **/
/* menucfg : buils the cvpcb main menu */
/***************************************/
/* cree et/ou affiche et modifie la configuration de CVPCB */
#include "fctsys.h"
#include "appl_wxstruct.h"
#include "common.h"
@ -11,357 +9,87 @@
#include "gestfich.h"
#include "cvpcb.h"
#include "protos.h"
#include "cvstruct.h"
/*****************************************/
/* classe pour la frame de Configuration */
/*****************************************/
#include "dialog_cvpcb_config.cpp"
#include "bitmaps.h"
#include "id.h"
/***************************************************/
void WinEDA_CvpcbFrame::CreateConfigWindow()
/***************************************************/
/* Creation de la fenetre de configuration de CVPCB */
/*******************************************/
void WinEDA_CvpcbFrame::ReCreateMenuBar()
/*******************************************/
/* Creation des menus de la fenetre principale
*/
{
KiConfigCvpcbFrame* ConfigFrame = new KiConfigCvpcbFrame( this );
wxMenuItem* item;
wxMenuBar* menuBar = GetMenuBar();
/* Destroy the existing menu bar so it can be rebuilt. This allows
* language changes of the menu text on the fly. */
if( menuBar )
SetMenuBar( NULL );
ConfigFrame->ShowModal();
ConfigFrame->Destroy();
}
/*********************************************/
void KiConfigCvpcbFrame::SetDialogDatas()
/*********************************************/
{
wxConfig* cfg = wxGetApp().m_EDA_CommonConfig;
m_ListLibr->InsertItems( g_LibName_List, 0 );
m_ListEquiv->InsertItems( g_ListName_Equ, 0 );
m_LibDirCtrl = new WinEDA_EnterText( this, _( "Lib Dir:" ),
g_UserLibDirBuffer,
m_RightBoxSizer, wxDefaultSize );
m_NetInputExtCtrl = new WinEDA_EnterText( this, _( "Net Input Ext:" ),
g_NetlistFileExtension,
m_NetExtBoxSizer, wxDefaultSize );
wxString DocModuleFileName = cfg->Read( DOC_FOOTPRINTS_LIST_KEY,
DEFAULT_FOOTPRINTS_LIST_FILENAME );
m_TextHelpModulesFileName = new WinEDA_EnterText( this,
_( "Module Doc File:" ),
DocModuleFileName,
m_RightBoxSizer,
wxDefaultSize );
/* Create info on Files ext */
wxStaticText* StaticText;
wxString text;
text.Printf( wxT( "%s .%s" ), _( "Cmp ext:" ),
ComponentFileExtension.c_str() );
StaticText = new wxStaticText( this, -1, text );
m_FileExtList->Add( StaticText,
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxBOTTOM |
wxADJUST_MINSIZE );
text.Printf( wxT( "%s .%s" ), _( "Lib ext:" ),
ModuleFileExtension.c_str() );
StaticText = new wxStaticText( this, -1, text );
m_FileExtList->Add( StaticText,
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxBOTTOM |
wxADJUST_MINSIZE );
text.Printf( wxT( "%s .%s" ), _( "NetOut ext:" ), NetExtBuffer.c_str() );
StaticText = new wxStaticText( this, -1, text );
m_FileExtList->Add( StaticText,
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxBOTTOM |
wxADJUST_MINSIZE );
text.Printf( wxT( "%s .%s" ), _( "Equiv ext:" ),
EquivFileExtension.c_str() );
StaticText = new wxStaticText( this, -1, text );
m_FileExtList->Add( StaticText,
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxBOTTOM |
wxADJUST_MINSIZE );
text.Printf( wxT( "%s .%s" ), _( "Retro ext:" ),
RetroFileExtension.c_str() );
StaticText = new wxStaticText( this, -1, text );
m_FileExtList->Add( StaticText,
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxBOTTOM |
wxADJUST_MINSIZE );
}
/********************************************************/
void KiConfigCvpcbFrame::AcceptCfg( wxCommandEvent& event )
/********************************************************/
{
Update();
Close();
}
/**********************************/
void KiConfigCvpcbFrame::Update()
/**********************************/
{
wxASSERT( wxGetApp().m_EDA_CommonConfig != NULL );
wxString msg;
wxConfig* cfg = wxGetApp().m_EDA_CommonConfig;
if( !m_DoUpdate )
return;
g_NetlistFileExtension = m_NetInputExtCtrl->GetValue();
cfg->Write( DOC_FOOTPRINTS_LIST_KEY, m_TextHelpModulesFileName->GetValue() );
msg = m_LibDirCtrl->GetValue();
if( msg != g_UserLibDirBuffer )
{
g_UserLibDirBuffer = m_LibDirCtrl->GetValue();
listlib();
m_Parent->BuildFootprintListBox();
}
}
/****************************************************/
void KiConfigCvpcbFrame::SaveCfg( wxCommandEvent& event )
/****************************************************/
{
WinEDA_CvpcbFrame* parent = ( WinEDA_CvpcbFrame* )GetParent();
wxASSERT( parent && parent->IsKindOf( CLASSINFO( WinEDA_CvpcbFrame ) ) );
Update();
Save_Config( this, parent->m_NetlistFileName.GetFullPath() );
}
/******************************************************/
void KiConfigCvpcbFrame::ReadOldCfg( wxCommandEvent& event )
{
WinEDA_CvpcbFrame* parent = ( WinEDA_CvpcbFrame* )GetParent();
wxASSERT( parent && parent->IsKindOf( CLASSINFO( WinEDA_CvpcbFrame ) ) );
wxFileName fn = parent->m_NetlistFileName;
fn.SetExt( ProjectFileExtension );
wxFileDialog dlg( this, _( "Load Project File" ), fn.GetPath(),
fn.GetFullName(), ProjectFileWildcard,
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
if( dlg.ShowModal() == wxID_CANCEL )
return;
Read_Config( dlg.GetPath() );
m_DoUpdate = FALSE;
Close( TRUE );
}
/*******************************************************/
void KiConfigCvpcbFrame::LibDelFct( wxCommandEvent& event )
/*******************************************************/
{
int ii;
ii = m_ListLibr->GetSelection();
if( ii < 0 )
return;
g_LibName_List.RemoveAt( ii );
/* suppression de la reference dans la liste des librairies */
m_ListLibr->Delete( ii );
g_UserLibDirBuffer = m_LibDirCtrl->GetValue();
listlib();
m_Parent->BuildFootprintListBox();
}
/********************************************************/
void KiConfigCvpcbFrame::LibAddFct( wxCommandEvent& event )
/********************************************************/
{
int ii;
wxFileName fn;
wxString tmp;
wxArrayString Filenames;
ii = m_ListLibr->GetSelection();
if( ii == wxNOT_FOUND && event.GetId() != ADD_LIB )
ii = 0;
Update();
wxString libpath = m_LibDirCtrl->GetValue();
if ( libpath.IsEmpty() )
libpath = wxGetApp().ReturnLastVisitedLibraryPath();
if ( libpath.IsEmpty() )
{ /* Initialize default path to the main default lib path
* this is the second path in list (the first is the project path)
*/
ii = wxGetApp().GetLibraryPathList().GetCount();
if ( ii > 2 )
ii = 2;
if ( ii > 0 )
libpath = wxGetApp().GetLibraryPathList()[ii-1];
else
libpath = wxGetCwd();
}
wxFileDialog dlg( this, _( "Foot Print Library Files" ), libpath,
wxEmptyString, ModuleFileWildcard,
wxFD_OPEN | wxFD_MULTIPLE | wxFD_FILE_MUST_EXIST );
if( dlg.ShowModal() == wxID_CANCEL )
return;
dlg.GetPaths( Filenames );
if( Filenames.GetCount() == 0 )
return;
for( unsigned jj = 0; jj < Filenames.GetCount(); jj++ )
{
fn = Filenames[jj];
if ( jj == 0 )
wxGetApp().SaveLastVisitedLibraryPath( fn.GetPath() );
/* If the library path is already in the library search paths
* list, just add the library name to the list. Otherwise, add
* the library name with the full path. */
if( wxGetApp().GetLibraryPathList().Index( fn.GetPath() ) == wxNOT_FOUND )
tmp = fn.GetPathWithSep() + fn.GetName();
else
tmp = fn.GetName();
// Add or insert new library name.
if( g_LibName_List.Index( tmp, fn.IsCaseSensitive() ) == wxNOT_FOUND )
{
if( event.GetId() == ADD_LIB )
g_LibName_List.Add( tmp );
else
g_LibName_List.Insert( tmp, ii++ );
}
else
{
wxString msg = wxT( "<" ) + tmp + wxT( "> : " ) +
_( "Library already in use" );
DisplayError( this, msg );
}
}
g_UserLibDirBuffer = m_LibDirCtrl->GetValue();
listlib();
m_Parent->BuildFootprintListBox();
m_ListLibr->Clear();
m_ListLibr->InsertItems( g_LibName_List, 0 );
}
/********************************************************/
void KiConfigCvpcbFrame::EquDelFct( wxCommandEvent& event )
/********************************************************/
{
int ii;
ii = m_ListEquiv->GetSelection();
if( ii < 0 )
return;
g_ListName_Equ.RemoveAt( ii );
m_ListEquiv->Delete( ii );
}
/********************************************************/
void KiConfigCvpcbFrame::EquAddFct( wxCommandEvent& event )
/********************************************************/
{
int ii;
wxFileName fn;
wxString libName;
ii = m_ListEquiv->GetSelection();
if( event.GetId() == ADD_EQU )
ii++; /* Ajout apres selection */
if( ii < 0 )
ii = 0;
Update();
wxString libpath = m_LibDirCtrl->GetValue();
if ( libpath.IsEmpty() )
libpath = wxGetApp().ReturnLastVisitedLibraryPath();
if ( libpath.IsEmpty() )
{ /* Initialize default path to the main default lib path
* this is the second path in list (the first is the project path)
*/
ii = wxGetApp().GetLibraryPathList().GetCount();
if ( ii > 2 )
ii = 2;
if ( ii > 0 )
libpath = wxGetApp().GetLibraryPathList()[ii-1];
else
libpath = wxGetCwd();
}
wxFileDialog dlg( this, _( "Open Footprint Alias Files" ),
libpath, wxEmptyString, EquivFileWildcard,
wxFD_OPEN | wxFD_MULTIPLE | wxFD_FILE_MUST_EXIST );
if( dlg.ShowModal() == wxID_CANCEL )
return;
wxArrayString Filenames;
dlg.GetFilenames( Filenames );
if( Filenames.GetCount() == 0 )
return;
for( unsigned jj = 0; jj < Filenames.GetCount(); jj++ )
{
fn = Filenames[jj];
if ( jj == 0 )
wxGetApp().SaveLastVisitedLibraryPath( fn.GetPath() );
/* Use the file name without extension if the library path is
* already in the default library search path. Otherwise, use
* the full path and file name without the extension. */
if( wxGetApp().GetLibraryPathList().Index( fn.GetPath() ) == wxNOT_FOUND )
libName = fn.GetPathWithSep() + fn.GetName();
else
libName = fn.GetName();
//Add or insert new equiv library name
if( g_ListName_Equ.Index( libName ) == wxNOT_FOUND )
{
g_ListName_Equ.Insert( libName, ii++ );
}
else
{
wxString msg;
msg << wxT( "<" ) << libName << wxT( "> : " ) <<
_( "Library already in use" );
DisplayError( this, msg );
}
}
/* Update display list */
g_UserLibDirBuffer = m_LibDirCtrl->GetValue();
listlib();
m_ListEquiv->Clear();
m_ListEquiv->InsertItems( g_ListName_Equ, 0 );
menuBar = new wxMenuBar();
wxMenu* filesMenu = new wxMenu;
item = new wxMenuItem( filesMenu, ID_LOAD_PROJECT,
_( "&Open" ),
_( "Open a NetList file" ) );
item->SetBitmap( open_xpm );
filesMenu->Append( item );
filesMenu->AppendSeparator();
item = new wxMenuItem( filesMenu, ID_SAVE_PROJECT,
_( "&Save As..." ),
_( "Save New NetList and Footprints List files" ) );
item->SetBitmap( save_xpm );
filesMenu->Append( item );
filesMenu->AppendSeparator();
item = new wxMenuItem( filesMenu, ID_CVPCB_QUIT, _( "E&xit" ),
_( "Quit Cvpcb" ) );
item->SetBitmap( exit_xpm );
filesMenu->Append( item );
// Creation des selections des anciens fichiers
wxGetApp().m_fileHistory.AddFilesToMenu( filesMenu );
// Menu Configuration:
wxMenu* configmenu = new wxMenu;
item = new wxMenuItem( configmenu, ID_CONFIG_REQ, _( "&Configuration" ),
_( "Setting Libraries, Directories and others..." ) );
item->SetBitmap( config_xpm );
configmenu->Append( item );
// Font selection and setup
AddFontSelectionMenu( configmenu );
wxGetApp().AddMenuLanguageList( configmenu );
configmenu->AppendSeparator();
item = new wxMenuItem( configmenu, ID_CONFIG_SAVE,
_( "&Save config" ),
_( "Save configuration in current dir" ) );
item->SetBitmap( save_setup_xpm );
configmenu->Append( item );
// Menu Help:
wxMenu* helpMenu = new wxMenu;
item = new wxMenuItem( helpMenu, ID_CVPCB_DISPLAY_HELP, _( "&Contents" ),
_( "Open the cvpcb manual" ) );
item->SetBitmap( help_xpm );
helpMenu->Append( item );
item = new wxMenuItem( helpMenu, ID_CVPCB_DISPLAY_LICENCE,
_( "&About cvpcb" ),
_( "About cvpcb schematic to pcb converter" ) );
item->SetBitmap( info_xpm );
helpMenu->Append( item );
menuBar->Append( filesMenu, _( "&File" ) );
menuBar->Append( configmenu, _( "&Preferences" ) );
menuBar->Append( helpMenu, _( "&Help" ) );
// Associate the menu bar with the frame
SetMenuBar( menuBar );
}

View File

@ -58,11 +58,11 @@ void WinEDA_CvpcbFrame::ReCreateHToolbar()
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_CVPCB_CREATE_STUFF_FILE,
wxBitmap( save_cmpstuff_xpm ),
_( "Create stuff file (component/footprint list)" ) );
_( "Create export file (component/footprint list, used by eeschema to fill the footprint field of components)" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_PCB_DISPLAY_FOOTPRINT_DOC,
wxBitmap( file_footprint_xpm ),
wxBitmap( datasheet_xpm ),
_( "Display footprints list documentation" ) );
m_HToolBar->AddSeparator();
@ -90,81 +90,3 @@ void WinEDA_CvpcbFrame::ReCreateHToolbar()
m_HToolBar->Realize();
}
/*******************************************/
void WinEDA_CvpcbFrame::ReCreateMenuBar()
/*******************************************/
/* Creation des menus de la fenetre principale
*/
{
wxMenuItem* item;
wxMenuBar* menuBar = GetMenuBar();
/* Destroy the existing menu bar so it can be rebuilt. This allows
* language changes of the menu text on the fly. */
if( menuBar )
SetMenuBar( NULL );
menuBar = new wxMenuBar();
wxMenu* filesMenu = new wxMenu;
item = new wxMenuItem( filesMenu, ID_LOAD_PROJECT,
_( "&Open" ),
_( "Open a NetList file" ) );
item->SetBitmap( open_xpm );
filesMenu->Append( item );
filesMenu->AppendSeparator();
item = new wxMenuItem( filesMenu, ID_SAVE_PROJECT,
_( "&Save As..." ),
_( "Save New NetList and Footprints List files" ) );
item->SetBitmap( save_xpm );
filesMenu->Append( item );
filesMenu->AppendSeparator();
item = new wxMenuItem( filesMenu, ID_CVPCB_QUIT, _( "E&xit" ),
_( "Quit Cvpcb" ) );
item->SetBitmap( exit_xpm );
filesMenu->Append( item );
// Creation des selections des anciens fichiers
wxGetApp().m_fileHistory.AddFilesToMenu( filesMenu );
// Menu Configuration:
wxMenu* configmenu = new wxMenu;
item = new wxMenuItem( configmenu, ID_CONFIG_REQ, _( "&Configuration" ),
_( "Setting Libraries, Directories and others..." ) );
item->SetBitmap( config_xpm );
configmenu->Append( item );
// Font selection and setup
AddFontSelectionMenu( configmenu );
wxGetApp().AddMenuLanguageList( configmenu );
configmenu->AppendSeparator();
item = new wxMenuItem( configmenu, ID_CONFIG_SAVE,
_( "&Save config" ),
_( "Save configuration in current dir" ) );
item->SetBitmap( save_setup_xpm );
configmenu->Append( item );
// Menu Help:
wxMenu* helpMenu = new wxMenu;
item = new wxMenuItem( helpMenu, ID_CVPCB_DISPLAY_HELP, _( "&Contents" ),
_( "Open the cvpcb manual" ) );
item->SetBitmap( help_xpm );
helpMenu->Append( item );
item = new wxMenuItem( helpMenu, ID_CVPCB_DISPLAY_LICENCE,
_( "&About cvpcb" ),
_( "About cvpcb schematic to pcb converter" ) );
item->SetBitmap( info_xpm );
helpMenu->Append( item );
menuBar->Append( filesMenu, _( "&File" ) );
menuBar->Append( configmenu, _( "&Preferences" ) );
menuBar->Append( helpMenu, _( "&Help" ) );
// Associate the menu bar with the frame
SetMenuBar( menuBar );
}

View File

@ -185,7 +185,7 @@ void DIALOG_PCBNEW_CONFIG_LIBS::OnAddOrInsertLibClick( wxCommandEvent& event )
wxFileName fn;
ii = m_ListLibr->GetSelection();
if( ii == wxNOT_FOUND && event.GetId() != ID_ADD_LIB )
if( ii == wxNOT_FOUND )
ii = 0;
wxString libpath;