kicad/cvpcb/cfg.cpp

91 lines
2.3 KiB
C++
Raw Normal View History

2008-03-04 04:22:27 +00:00
/***************************************/
/** cfg.cpp : configuration de CVPCB **/
/***************************************/
/* lit ou met a jour la configuration de CVPCB */
#include "fctsys.h"
#include "wxstruct.h"
#include "common.h"
#include "cvpcb.h"
#include "protos.h"
#include "cfg.h"
/* Routines Locales */
/**/
/**************************************************/
2008-03-04 04:22:27 +00:00
void Read_Config( const wxString& FileName )
/**************************************************/
2008-03-04 04:22:27 +00:00
/* 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
*/
{
2008-03-04 04:22:27 +00:00
wxString FullFileName = FileName;
/* Init des valeurs par defaut */
g_LibName_List.Clear();
g_ListName_Equ.Clear();
2008-03-04 04:22:27 +00:00
g_EDA_Appl->ReadProjectConfig( FullFileName,
GROUP, ParamCfgList, FALSE );
2008-03-04 04:22:27 +00:00
if( NetInExtBuffer.IsEmpty() )
NetInExtBuffer = wxT( ".net" );
2008-03-04 04:22:27 +00:00
/* Inits autres variables */
SetRealLibraryPath( wxT( "modules" ) );
}
/************************************************************/
2008-03-04 04:22:27 +00:00
void WinEDA_CvpcbFrame::Update_Config( wxCommandEvent& event )
/************************************************************/
2008-03-04 04:22:27 +00:00
/* fonction relai d'appel a Save_Config,
2008-03-04 04:22:27 +00:00
* la vraie fonction de sauvegarde de la config
*/
{
2008-03-04 04:22:27 +00:00
Save_Config( this );
}
2008-03-04 04:22:27 +00:00
/************************************/
2008-03-04 04:22:27 +00:00
void Save_Config( wxWindow* parent )
/************************************/
/* enregistrement de la config */
{
2008-03-04 04:22:27 +00:00
wxString path, FullFileName;
2008-03-04 04:22:27 +00:00
wxString mask( wxT( "*" ) );
FullFileName = FFileName;
ChangeFileNameExt( FullFileName, g_Prj_Config_Filename_ext );
path = wxGetCwd();
FullFileName = EDA_FileSelector( _( "Save preferences" ),
path, /* Chemin par defaut */
FullFileName, /* nom fichier par defaut */
g_Prj_Config_Filename_ext, /* extension par defaut */
mask, /* Masque d'affichage */
parent,
wxFD_SAVE,
TRUE
);
if( FullFileName.IsEmpty() )
return;
/* ecriture de la configuration */
g_EDA_Appl->WriteProjectConfig( FullFileName, GROUP, ParamCfgList );
}