code cleanup in project_config.cpp and some enhancements

This commit is contained in:
charras 2009-03-28 20:02:34 +00:00
parent 2eaa28f0cb
commit b65590f708
22 changed files with 1426 additions and 387 deletions

View File

@ -4,6 +4,17 @@ KiCad ChangeLog 2009
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2009-mar-28 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
++All
code cleanup in project_config.cpp.
Now parameters common to all projects are saved on exit.
(they are usally options like colors, draw options ...)
++pcbnew:
added option to show or not netnames on pads and tracks
2009-mar-23 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> 2009-mar-23 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================ ================================================================================
++pcbnew: ++pcbnew:

View File

@ -53,7 +53,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
void (* aCallback) (int x0, int y0, int xf, int yf)) void (* aCallback) (int x0, int y0, int xf, int yf))
/****************************************************************************************************/ /****************************************************************************************************/
{ {
int ii, kk, char_count, AsciiCode, endcar; int kk, char_count, AsciiCode;
int x0, y0; int x0, y0;
int size_h, size_v, pitch; int size_h, size_v, pitch;
SH_CODE f_cod, plume = 'U'; SH_CODE f_cod, plume = 'U';
@ -62,9 +62,10 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
int ux0, uy0, dx, dy; // Draw coordinate for segments to draw. also used in some other calculation int ux0, uy0, dx, dy; // Draw coordinate for segments to draw. also used in some other calculation
int cX, cY; // Texte center int cX, cY; // Texte center
int ox, oy; // Draw coordinates for the current char int ox, oy; // Draw coordinates for the current char
int coord[100]; // Buffer coordinate used to draw polylines (char shapes) #define BUF_SIZE 100
wxPoint coord[BUF_SIZE+1]; // Buffer coordinate used to draw polylines (one char shape)
bool sketch_mode = false; bool sketch_mode = false;
bool italic_reverse = false; // true for mirrored texts with m_Size.x < 0 bool italic_reverse = false; // true for mirrored texts with m_Size.x < 0
size_h = aSize.x; size_h = aSize.x;
size_v = aSize.y; size_v = aSize.y;
@ -72,7 +73,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
if( aWidth < 0 ) if( aWidth < 0 )
{ {
aWidth = -aWidth; aWidth = -aWidth;
sketch_mode = TRUE; sketch_mode = true;
} }
int thickness = aWidth; int thickness = aWidth;
if ( aSize.x < 0 ) // text is mirrored using size.x < 0 (mirror / Y axis) if ( aSize.x < 0 ) // text is mirrored using size.x < 0 (mirror / Y axis)
@ -234,7 +235,9 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
ptcar = graphic_fonte_shape[AsciiCode]; /* ptcar pointe la description ptcar = graphic_fonte_shape[AsciiCode]; /* ptcar pointe la description
* du caractere a dessiner */ * du caractere a dessiner */
for( ii = 0, endcar = FALSE; !endcar; ptcar++ ) int point_count;
bool endcar;
for( point_count = 0, endcar = false; !endcar; ptcar++ )
{ {
f_cod = *ptcar; f_cod = *ptcar;
@ -242,36 +245,34 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
switch( f_cod ) switch( f_cod )
{ {
case 'X': case 'X':
endcar = TRUE; /* fin du caractere */ endcar = true; /* fin du caractere */
break; break;
case 'U': case 'U':
if( ii && (plume == 'D' ) ) if( point_count && (plume == 'D' ) )
{ {
if( aWidth <= 1 ) if( aWidth <= 1 )
aWidth = 0; aWidth = 0;
if ( aCallback ) if ( aCallback )
{ {
int ik, * coordptr; for( int ik = 0; ik < (point_count - 1); ik ++ )
coordptr = coord; {
for( ik = 0; ik < (ii - 2); ik += 2, coordptr += 2 ) aCallback( coord[ik].x, coord[ik].y,
aCallback( *coordptr, *(coordptr + 1), coord[ik+1].x, coord[ik+1].y );
*(coordptr + 2), *(coordptr + 3) ); }
} }
else if( sketch_mode ) else if( sketch_mode )
{ {
int ik, * coordptr; for( int ik = 0; ik < (point_count - 1); ik ++ )
coordptr = coord; GRCSegm( &aPanel->m_ClipBox, aDC, coord[ik].x, coord[ik].y,
for( ik = 0; ik < (ii - 2); ik += 2, coordptr += 2 ) coord[ik+1].x, coord[ik+1].y, aWidth, aColor );
GRCSegm( &aPanel->m_ClipBox, aDC, *coordptr, *(coordptr + 1),
*(coordptr + 2), *(coordptr + 3), aWidth, aColor );
} }
else else
GRPoly( &aPanel->m_ClipBox, aDC, ii / 2, (wxPoint*)coord, 0, GRPoly( &aPanel->m_ClipBox, aDC, point_count, coord, 0,
aWidth, aColor, aColor ); aWidth, aColor, aColor );
} }
plume = f_cod; ii = 0; plume = f_cod; point_count = 0;
break; break;
case 'D': case 'D':
@ -295,8 +296,10 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
dx = k2 + ox; dy = k1 + oy; dx = k2 + ox; dy = k1 + oy;
RotatePoint( &dx, &dy, cX, cY, aOrient ); RotatePoint( &dx, &dy, cX, cY, aOrient );
coord[ii++] = dx; coord[point_count].x = dx;
coord[ii++] = dy; coord[point_count].y = dy;
if ( point_count < BUF_SIZE-1 )
point_count++;
break; break;
} }
} }

View File

@ -26,6 +26,7 @@
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "common.h" #include "common.h"
#include "param_config.h"
#include "worksheet.h" #include "worksheet.h"
#include "id.h" #include "id.h"
#include "build_version.h" #include "build_version.h"

View File

@ -8,10 +8,11 @@
#include "common.h" #include "common.h"
#include "kicad_string.h" #include "kicad_string.h"
#include "gestfich.h" #include "gestfich.h"
#include "param_config.h"
#define CONFIG_VERSION 1 #define CONFIG_VERSION 1
#define FORCE_LOCAL_CONFIG TRUE #define FORCE_LOCAL_CONFIG true
/*********************************************************************/ /*********************************************************************/
@ -26,8 +27,8 @@ static bool ReCreatePrjConfig( const wxString& local_config_filename,
* g_Prj_Config_LocalFilename * g_Prj_Config_LocalFilename
* g_Prj_Default_Config_FullFilename * g_Prj_Default_Config_FullFilename
* return: * return:
* TRUE si config locale * true si config locale
* FALSE si default config * false si default config
*/ */
{ {
// free old config // free old config
@ -56,7 +57,7 @@ static bool ReCreatePrjConfig( const wxString& local_config_filename,
g_Prj_Config->DontCreateOnDemand(); g_Prj_Config->DontCreateOnDemand();
if( ForceUseLocalConfig ) if( ForceUseLocalConfig )
return TRUE; return true;
// Test de la bonne version du fichier (ou groupe) de configuration // Test de la bonne version du fichier (ou groupe) de configuration
int version = -1, def_version = 0; int version = -1, def_version = 0;
@ -64,7 +65,7 @@ static bool ReCreatePrjConfig( const wxString& local_config_filename,
version = g_Prj_Config->Read( wxT( "version" ), def_version ); version = g_Prj_Config->Read( wxT( "version" ), def_version );
g_Prj_Config->SetPath( UNIX_STRING_DIR_SEP ); g_Prj_Config->SetPath( UNIX_STRING_DIR_SEP );
if( version > 0 ) if( version > 0 )
return TRUE; return true;
else else
delete g_Prj_Config; // Version incorrecte delete g_Prj_Config; // Version incorrecte
} }
@ -86,7 +87,7 @@ static bool ReCreatePrjConfig( const wxString& local_config_filename,
g_Prj_Config->DontCreateOnDemand(); g_Prj_Config->DontCreateOnDemand();
return FALSE; return false;
} }
@ -95,10 +96,15 @@ void WinEDA_App::WriteProjectConfig( const wxString& local_config_filename,
const wxString& GroupName, const wxString& GroupName,
PARAM_CFG_BASE** List ) PARAM_CFG_BASE** List )
/***************************************************************************************/ /***************************************************************************************/
/* enregistrement de la config "projet"*/
/** Function WriteProjectConfig
* Save the current "projet" parameters
* saved parameters are parameters that have the .m_Setup member set to false
* saving file is the .pro file project
*/
{ {
const PARAM_CFG_BASE* pt_cfg; PARAM_CFG_BASE* pt_cfg;
wxString msg; wxString msg;
ReCreatePrjConfig( local_config_filename, GroupName, ReCreatePrjConfig( local_config_filename, GroupName,
FORCE_LOCAL_CONFIG ); FORCE_LOCAL_CONFIG );
@ -114,7 +120,7 @@ void WinEDA_App::WriteProjectConfig( const wxString& local_config_filename,
g_Prj_Config->Write( wxT( "last_client" ), msg ); g_Prj_Config->Write( wxT( "last_client" ), msg );
/* ecriture de la configuration */ /* Save parameters */
g_Prj_Config->DeleteGroup( GroupName ); // Erase all datas g_Prj_Config->DeleteGroup( GroupName ); // Erase all datas
g_Prj_Config->Flush(); g_Prj_Config->Flush();
@ -130,102 +136,16 @@ void WinEDA_App::WriteProjectConfig( const wxString& local_config_filename,
else else
g_Prj_Config->SetPath( GroupName ); g_Prj_Config->SetPath( GroupName );
switch( pt_cfg->m_Type ) if( pt_cfg->m_Setup )
continue;
if ( pt_cfg->m_Type == PARAM_COMMAND_ERASE ) // Erase all data
{ {
case PARAM_INT:
#undef PTCFG
#define PTCFG ( (PARAM_CFG_INT*) pt_cfg )
if( PTCFG->m_Pt_param == NULL )
break;
if( pt_cfg->m_Setup )
m_EDA_Config->Write( pt_cfg->m_Ident, *PTCFG->m_Pt_param );
else
g_Prj_Config->Write( pt_cfg->m_Ident, *PTCFG->m_Pt_param );
break;
case PARAM_SETCOLOR:
#undef PTCFG
#define PTCFG ( (PARAM_CFG_SETCOLOR*) pt_cfg )
if( PTCFG->m_Pt_param == NULL )
break;
if( pt_cfg->m_Setup )
m_EDA_Config->Write( pt_cfg->m_Ident, *PTCFG->m_Pt_param );
else
g_Prj_Config->Write( pt_cfg->m_Ident, *PTCFG->m_Pt_param );
break;
case PARAM_DOUBLE:
#undef PTCFG
#define PTCFG ( (PARAM_CFG_DOUBLE*) pt_cfg )
if( PTCFG->m_Pt_param == NULL )
break;
if( pt_cfg->m_Setup )
m_EDA_Config->Write( pt_cfg->m_Ident, *PTCFG->m_Pt_param );
else
g_Prj_Config->Write( pt_cfg->m_Ident, *PTCFG->m_Pt_param );
break;
case PARAM_BOOL:
#undef PTCFG
#define PTCFG ( (PARAM_CFG_BOOL*) pt_cfg )
if( PTCFG->m_Pt_param == NULL )
break;
if( pt_cfg->m_Setup )
m_EDA_Config->Write( pt_cfg->m_Ident, (int) *PTCFG->m_Pt_param );
else
g_Prj_Config->Write( pt_cfg->m_Ident, (int) *PTCFG->m_Pt_param );
break;
case PARAM_WXSTRING:
#undef PTCFG
#define PTCFG ( (PARAM_CFG_WXSTRING*) pt_cfg )
if( PTCFG->m_Pt_param == NULL )
break;
if( pt_cfg->m_Setup )
m_EDA_Config->Write( pt_cfg->m_Ident, *PTCFG->m_Pt_param );
else
g_Prj_Config->Write( pt_cfg->m_Ident, *PTCFG->m_Pt_param );
break;
case PARAM_LIBNAME_LIST:
{
#undef PTCFG
#define PTCFG ( (PARAM_CFG_LIBNAME_LIST*) pt_cfg )
if( PTCFG->m_Pt_param == NULL )
break;
wxArrayString* libname_list = PTCFG->m_Pt_param;
if( libname_list == NULL )
break;
unsigned indexlib = 0;
wxString cle_config;
for( ; indexlib < libname_list->GetCount(); indexlib++ )
{
cle_config = pt_cfg->m_Ident;
// We use indexlib+1 because first lib name is LibName1
cle_config << (indexlib + 1);
g_Prj_Config->Write( cle_config,
libname_list->Item( indexlib ) );
}
break;
}
case PARAM_COMMAND_ERASE: // Erase all datas
if( pt_cfg->m_Ident ) if( pt_cfg->m_Ident )
{
m_EDA_Config->DeleteGroup( pt_cfg->m_Ident );
g_Prj_Config->DeleteGroup( pt_cfg->m_Ident ); g_Prj_Config->DeleteGroup( pt_cfg->m_Ident );
}
break;
} }
else
pt_cfg->SaveParam( g_Prj_Config );
} }
g_Prj_Config->SetPath( UNIX_STRING_DIR_SEP ); g_Prj_Config->SetPath( UNIX_STRING_DIR_SEP );
@ -234,6 +154,39 @@ void WinEDA_App::WriteProjectConfig( const wxString& local_config_filename,
} }
/*****************************************************************/
void WinEDA_App::SaveCurrentSetupValues( PARAM_CFG_BASE** aList )
/*****************************************************************/
/** Function SaveCurrentSetupValues()
* Save the current setup values in m_EDA_Config
* saved parameters are parameters that have the .m_Setup member set to true
* @param aList = array of PARAM_CFG_BASE pointers
*/
{
PARAM_CFG_BASE* pt_cfg;
wxString msg;
if( m_EDA_Config == NULL )
return;
for( ; *aList != NULL; aList++ )
{
pt_cfg = *aList;
if( pt_cfg->m_Setup == false )
continue;
if ( pt_cfg->m_Type == PARAM_COMMAND_ERASE ) // Erase all data
{
if( pt_cfg->m_Ident )
m_EDA_Config->DeleteGroup( pt_cfg->m_Ident );
}
else
pt_cfg->SaveParam( m_EDA_Config );
}
}
/***************************************************************************************/ /***************************************************************************************/
bool WinEDA_App::ReadProjectConfig( const wxString& local_config_filename, bool WinEDA_App::ReadProjectConfig( const wxString& local_config_filename,
const wxString& GroupName, const wxString& GroupName,
@ -241,31 +194,34 @@ bool WinEDA_App::ReadProjectConfig( const wxString& local_config_filename,
bool Load_Only_if_New ) bool Load_Only_if_New )
/***************************************************************************************/ /***************************************************************************************/
/* Lecture de la config "projet" /** Function ReadProjectConfig
*** si Load_Only_if_New == TRUE, elle n'est lue que si elle * Read the current "projet" parameters
*** est differente de la config actuelle (dates differentes) * Parameters are parameters that have the .m_Setup member set to false
* read file is the .pro file project
* *
* return: * if Load_Only_if_New == true, this file is read only if it diders from
* TRUE si lue. * the current config (different dates )
* Met a jour en plus: *
* @return true if read.
* Also set:
* wxGetApp().m_CurrentOptionFileDateAndTime * wxGetApp().m_CurrentOptionFileDateAndTime
* wxGetApp().m_CurrentOptionFile * wxGetApp().m_CurrentOptionFile
*/ */
{ {
const PARAM_CFG_BASE* pt_cfg; PARAM_CFG_BASE* pt_cfg;
wxString timestamp; wxString timestamp;
if( List == NULL ) if( List == NULL )
return FALSE; return false;
ReCreatePrjConfig( local_config_filename, GroupName, FALSE ); ReCreatePrjConfig( local_config_filename, GroupName, false );
g_Prj_Config->SetPath( UNIX_STRING_DIR_SEP ); g_Prj_Config->SetPath( UNIX_STRING_DIR_SEP );
timestamp = g_Prj_Config->Read( wxT( "update" ) ); timestamp = g_Prj_Config->Read( wxT( "update" ) );
if( Load_Only_if_New && ( !timestamp.IsEmpty() ) if( Load_Only_if_New && ( !timestamp.IsEmpty() )
&& (timestamp == wxGetApp().m_CurrentOptionFileDateAndTime) ) && (timestamp == wxGetApp().m_CurrentOptionFileDateAndTime) )
{ {
return FALSE; return false;
} }
wxGetApp().m_CurrentOptionFileDateAndTime = timestamp; wxGetApp().m_CurrentOptionFileDateAndTime = timestamp;
@ -289,121 +245,39 @@ bool WinEDA_App::ReadProjectConfig( const wxString& local_config_filename,
else else
g_Prj_Config->SetPath( GroupName ); g_Prj_Config->SetPath( GroupName );
switch( pt_cfg->m_Type ) if( pt_cfg->m_Setup )
{ continue;
case PARAM_INT:
{
#undef PTCFG
#define PTCFG ( (PARAM_CFG_INT*) pt_cfg )
int itmp;
if( pt_cfg->m_Setup )
itmp = m_EDA_Config->Read( pt_cfg->m_Ident, PTCFG->m_Default );
else
itmp = g_Prj_Config->Read( pt_cfg->m_Ident, PTCFG->m_Default );
if( (itmp < PTCFG->m_Min) || (itmp > PTCFG->m_Max) ) pt_cfg->ReadParam( g_Prj_Config );
itmp = PTCFG->m_Default;
*PTCFG->m_Pt_param = itmp;
break;
}
case PARAM_SETCOLOR:
{
#undef PTCFG
#define PTCFG ( (PARAM_CFG_SETCOLOR*) pt_cfg )
int itmp;
if( pt_cfg->m_Setup )
itmp = m_EDA_Config->Read( pt_cfg->m_Ident, PTCFG->m_Default );
else
itmp = g_Prj_Config->Read( pt_cfg->m_Ident, PTCFG->m_Default );
if( (itmp < 0) || (itmp > MAX_COLOR) )
itmp = PTCFG->m_Default;
*PTCFG->m_Pt_param = itmp;
break;
}
case PARAM_DOUBLE:
{
#undef PTCFG
#define PTCFG ( (PARAM_CFG_DOUBLE*) pt_cfg )
double ftmp = 0;
wxString msg;
if( pt_cfg->m_Setup )
msg = m_EDA_Config->Read( pt_cfg->m_Ident, wxT( "" ) );
else
msg = g_Prj_Config->Read( pt_cfg->m_Ident, wxT( "" ) );
if( msg.IsEmpty() )
ftmp = PTCFG->m_Default;
else
{
msg.ToDouble( &ftmp );
if( (ftmp < PTCFG->m_Min) || (ftmp > PTCFG->m_Max) )
ftmp = PTCFG->m_Default;
}
*PTCFG->m_Pt_param = ftmp;
break;
}
case PARAM_BOOL:
{
#undef PTCFG
#define PTCFG ( (PARAM_CFG_BOOL*) pt_cfg )
int itmp;
if( pt_cfg->m_Setup )
itmp = m_EDA_Config->Read( pt_cfg->m_Ident, PTCFG->m_Default );
else
itmp = g_Prj_Config->Read( pt_cfg->m_Ident, PTCFG->m_Default );
*PTCFG->m_Pt_param = itmp ? TRUE : FALSE;
break;
}
case PARAM_WXSTRING:
{
#undef PTCFG
#define PTCFG ( (PARAM_CFG_WXSTRING*) pt_cfg )
if( PTCFG->m_Pt_param == NULL )
break;
if( pt_cfg->m_Setup )
*PTCFG->m_Pt_param = m_EDA_Config->Read( pt_cfg->m_Ident );
else
*PTCFG->m_Pt_param = g_Prj_Config->Read( pt_cfg->m_Ident );
break;
}
case PARAM_LIBNAME_LIST:
{
#undef PTCFG
#define PTCFG ( (PARAM_CFG_LIBNAME_LIST*) pt_cfg )
int indexlib = 1; // We start indexlib to 1 because first lib name is LibName1
wxString libname, id_lib;
wxArrayString* libname_list = PTCFG->m_Pt_param;
while( 1 )
{
id_lib = pt_cfg->m_Ident; id_lib << indexlib; indexlib++;
libname = g_Prj_Config->Read( id_lib, wxT( "" ) );
if( libname.IsEmpty() )
break;
libname_list->Add( libname );
}
break;
}
case PARAM_COMMAND_ERASE:
break;
}
} }
delete g_Prj_Config; delete g_Prj_Config;
g_Prj_Config = NULL; g_Prj_Config = NULL;
return TRUE; return true;
}
/***************************************************************/
void WinEDA_App::ReadCurrentSetupValues( PARAM_CFG_BASE** aList )
/***************************************************************/
/** Function ReadCurrentSetupValues()
* Raed the current setup values previously saved, from m_EDA_Config
* saved parameters are parameters that have the .m_Setup member set to true
* @param aList = array of PARAM_CFG_BASE pointers
*/
{
PARAM_CFG_BASE* pt_cfg;
for( ; *aList != NULL; aList++ )
{
pt_cfg = *aList;
if( pt_cfg->m_Setup == false )
continue;
pt_cfg->ReadParam( m_EDA_Config );
}
} }
@ -417,7 +291,7 @@ PARAM_CFG_BASE::PARAM_CFG_BASE( const wxChar* ident, const paramcfg_id type,
m_Ident = ident; m_Ident = ident;
m_Type = type; m_Type = type;
m_Group = group; m_Group = group;
m_Setup = FALSE; m_Setup = false;
} }
@ -446,6 +320,37 @@ PARAM_CFG_INT::PARAM_CFG_INT( bool Insetup, const wxChar* ident, int* ptparam,
} }
/** ReadParam
* read the value of parameter thi stored in aConfig
* @param aConfig = the wxConfigBase that store the parameter
*/
void PARAM_CFG_INT::ReadParam( wxConfigBase* aConfig )
{
if( m_Pt_param == NULL || aConfig == NULL )
return;
int itmp = aConfig->Read( m_Ident, m_Default );
if( (itmp < m_Min) || (itmp > m_Max) )
itmp = m_Default;
*m_Pt_param = itmp;
}
/** SaveParam
* the the value of parameter thi stored in aConfig
* @param aConfig = the wxConfigBase that can store the parameter
*/
void PARAM_CFG_INT::SaveParam( wxConfigBase* aConfig )
{
if( m_Pt_param == NULL || aConfig == NULL )
return;
aConfig->Write( m_Ident, *m_Pt_param );
}
/**************************************************************************/
PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( const wxChar* ident, int* ptparam, PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( const wxChar* ident, int* ptparam,
int default_val, int default_val,
const wxChar* group ) : const wxChar* group ) :
@ -469,6 +374,34 @@ PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( bool Insetup,
} }
/** ReadParam
* read the value of parameter thi stored in aConfig
* @param aConfig = the wxConfigBase that store the parameter
*/
void PARAM_CFG_SETCOLOR::ReadParam( wxConfigBase* aConfig )
{
if( m_Pt_param == NULL || aConfig == NULL )
return;
int itmp = aConfig->Read( m_Ident, m_Default );
if( (itmp < 0) || (itmp > MAX_COLOR) )
itmp = m_Default;
*m_Pt_param = itmp;
}
/** SaveParam
* the the value of parameter thi stored in aConfig
* @param aConfig = the wxConfigBase that can store the parameter
*/
void PARAM_CFG_SETCOLOR::SaveParam( wxConfigBase* aConfig )
{
if( m_Pt_param == NULL || aConfig == NULL )
return;
aConfig->Write( m_Ident, *m_Pt_param );
}
PARAM_CFG_DOUBLE::PARAM_CFG_DOUBLE( const wxChar* ident, double* ptparam, PARAM_CFG_DOUBLE::PARAM_CFG_DOUBLE( const wxChar* ident, double* ptparam,
double default_val, double min, double max, double default_val, double min, double max,
const wxChar* group ) : const wxChar* group ) :
@ -498,12 +431,50 @@ PARAM_CFG_DOUBLE::PARAM_CFG_DOUBLE( bool Insetup,
} }
/** ReadParam
* read the value of parameter thi stored in aConfig
* @param aConfig = the wxConfigBase that store the parameter
*/
void PARAM_CFG_DOUBLE::ReadParam( wxConfigBase* aConfig )
{
if( m_Pt_param == NULL || aConfig == NULL )
return;
double ftmp = 0;
wxString msg;
msg = g_Prj_Config->Read( m_Ident, wxT( "" ) );
if( msg.IsEmpty() )
ftmp = m_Default;
else
{
msg.ToDouble( &ftmp );
if( (ftmp < m_Min) || (ftmp > m_Max) )
ftmp = m_Default;
}
*m_Pt_param = ftmp;
}
/** SaveParam
* the the value of parameter thi stored in aConfig
* @param aConfig = the wxConfigBase that can store the parameter
*/
void PARAM_CFG_DOUBLE::SaveParam( wxConfigBase* aConfig )
{
if( m_Pt_param == NULL || aConfig == NULL )
return;
aConfig->Write( m_Ident, *m_Pt_param );
}
/***********************************************************************/
PARAM_CFG_BOOL::PARAM_CFG_BOOL( const wxChar* ident, bool* ptparam, PARAM_CFG_BOOL::PARAM_CFG_BOOL( const wxChar* ident, bool* ptparam,
int default_val, const wxChar* group ) : int default_val, const wxChar* group ) :
PARAM_CFG_BASE( ident, PARAM_BOOL, group ) PARAM_CFG_BASE( ident, PARAM_BOOL, group )
{ {
m_Pt_param = ptparam; m_Pt_param = ptparam;
m_Default = default_val ? TRUE : FALSE; m_Default = default_val ? true : false;
} }
@ -515,11 +486,38 @@ PARAM_CFG_BOOL::PARAM_CFG_BOOL( bool Insetup,
PARAM_CFG_BASE( ident, PARAM_BOOL, group ) PARAM_CFG_BASE( ident, PARAM_BOOL, group )
{ {
m_Pt_param = ptparam; m_Pt_param = ptparam;
m_Default = default_val ? TRUE : FALSE; m_Default = default_val ? true : false;
m_Setup = Insetup; m_Setup = Insetup;
} }
/** ReadParam
* read the value of parameter thi stored in aConfig
* @param aConfig = the wxConfigBase that store the parameter
*/
void PARAM_CFG_BOOL::ReadParam( wxConfigBase* aConfig )
{
if( m_Pt_param == NULL || aConfig == NULL )
return;
int itmp = aConfig->Read( m_Ident, (int) m_Default );
*m_Pt_param = itmp ? true : false;
}
/** SaveParam
* the the value of parameter thi stored in aConfig
* @param aConfig = the wxConfigBase that can store the parameter
*/
void PARAM_CFG_BOOL::SaveParam( wxConfigBase* aConfig )
{
if( m_Pt_param == NULL || aConfig == NULL )
return;
aConfig->Write( m_Ident, *m_Pt_param );
}
/*********************************************************************/
PARAM_CFG_WXSTRING::PARAM_CFG_WXSTRING( const wxChar* ident, PARAM_CFG_WXSTRING::PARAM_CFG_WXSTRING( const wxChar* ident,
wxString* ptparam, wxString* ptparam,
const wxChar* group ) : const wxChar* group ) :
@ -539,6 +537,31 @@ PARAM_CFG_WXSTRING::PARAM_CFG_WXSTRING( bool Insetup, const wxChar* ident,
} }
/** ReadParam
* read the value of parameter thi stored in aConfig
* @param aConfig = the wxConfigBase that store the parameter
*/
void PARAM_CFG_WXSTRING::ReadParam( wxConfigBase* aConfig )
{
if( m_Pt_param == NULL || aConfig == NULL )
return;
*m_Pt_param = aConfig->Read( m_Ident );
}
/** SaveParam
* the the value of parameter thi stored in aConfig
* @param aConfig = the wxConfigBase that can store the parameter
*/
void PARAM_CFG_WXSTRING::SaveParam( wxConfigBase* aConfig )
{
if( m_Pt_param == NULL || aConfig == NULL )
return;
aConfig->Write( m_Ident, *m_Pt_param );
}
/***************************************************************************/
PARAM_CFG_LIBNAME_LIST::PARAM_CFG_LIBNAME_LIST( const wxChar* ident, PARAM_CFG_LIBNAME_LIST::PARAM_CFG_LIBNAME_LIST( const wxChar* ident,
wxArrayString* ptparam, wxArrayString* ptparam,
const wxChar* group ) : const wxChar* group ) :
@ -546,3 +569,50 @@ PARAM_CFG_LIBNAME_LIST::PARAM_CFG_LIBNAME_LIST( const wxChar* ident,
{ {
m_Pt_param = ptparam; m_Pt_param = ptparam;
} }
/** ReadParam
* read the value of parameter thi stored in aConfig
* @param aConfig = the wxConfigBase that store the parameter
*/
void PARAM_CFG_LIBNAME_LIST::ReadParam( wxConfigBase* aConfig )
{
if( m_Pt_param == NULL || aConfig == NULL )
return;
int indexlib = 1; // We start indexlib to 1 because first lib name is LibName1
wxString libname, id_lib;
wxArrayString* libname_list = m_Pt_param;
while( 1 )
{
id_lib = m_Ident;
id_lib << indexlib;
indexlib++;
libname = aConfig->Read( id_lib, wxT( "" ) );
if( libname.IsEmpty() )
break;
libname_list->Add( libname );
}
}
/** SaveParam
* the the value of parameter thi stored in aConfig
* @param aConfig = the wxConfigBase that can store the parameter
*/
void PARAM_CFG_LIBNAME_LIST::SaveParam( wxConfigBase* aConfig )
{
if( m_Pt_param == NULL || aConfig == NULL )
return;
wxArrayString* libname_list = m_Pt_param;
unsigned indexlib = 0;
wxString cle_config;
for( ; indexlib < libname_list->GetCount(); indexlib++ )
{
cle_config = m_Ident;
// We use indexlib+1 because first lib name is LibName1
cle_config << (indexlib + 1);
aConfig->Write( cle_config, libname_list->Item( indexlib ) );
}
}

View File

@ -6,6 +6,8 @@
#define eda_global extern #define eda_global extern
#endif #endif
#include "param_config.h"
#define INSETUP TRUE #define INSETUP TRUE
#define GROUP wxT("/cvpcb") #define GROUP wxT("/cvpcb")

View File

@ -6,6 +6,8 @@
#define eda_global extern #define eda_global extern
#endif #endif
#include "param_config.h"
#define GROUP wxT( "/eeschema" ) #define GROUP wxT( "/eeschema" )
#define GROUPCOMMON wxT( "/common" ) #define GROUPCOMMON wxT( "/common" )
#define GROUPLIB wxT( "libraries" ) #define GROUPLIB wxT( "libraries" )

View File

@ -63,6 +63,8 @@ bool WinEDA_App::OnInit()
/* init EESCHEMA */ /* init EESCHEMA */
GetSettings(); // read current setup GetSettings(); // read current setup
SeedLayers(); SeedLayers();
extern PARAM_CFG_BASE* ParamCfgList[];
wxGetApp().ReadCurrentSetupValues( ParamCfgList );
Read_Hotkey_Config( frame, false ); /* Must be called before creating Read_Hotkey_Config( frame, false ); /* Must be called before creating
* the main frame in order to * the main frame in order to
* display the real hotkeys in menus * display the real hotkeys in menus

View File

@ -186,6 +186,9 @@ WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father,
WinEDA_SchematicFrame::~WinEDA_SchematicFrame() WinEDA_SchematicFrame::~WinEDA_SchematicFrame()
{ {
extern PARAM_CFG_BASE* ParamCfgList[];
wxGetApp().SaveCurrentSetupValues( ParamCfgList );
SAFE_DELETE( g_RootSheet ); SAFE_DELETE( g_RootSheet );
SAFE_DELETE( m_CurrentSheet ); //a DrawSheetPath, on the heap. SAFE_DELETE( m_CurrentSheet ); //a DrawSheetPath, on the heap.
m_CurrentSheet = NULL; m_CurrentSheet = NULL;

View File

@ -7,6 +7,7 @@
#endif #endif
#include "fctsys.h" #include "fctsys.h"
#include "appl_wxstruct.h"
#include "wxstruct.h" #include "wxstruct.h"
#include "common.h" #include "common.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
@ -163,6 +164,9 @@ WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father,
WinEDA_GerberFrame::~WinEDA_GerberFrame() WinEDA_GerberFrame::~WinEDA_GerberFrame()
{ {
SetBaseScreen( ScreenPcb ); SetBaseScreen( ScreenPcb );
extern PARAM_CFG_BASE* ParamCfgList[];
wxGetApp().SaveCurrentSetupValues( ParamCfgList );
} }

View File

@ -37,6 +37,8 @@ bool WinEDA_App::OnInit()
ActiveScreen = ScreenPcb; ActiveScreen = ScreenPcb;
GetSettings(); GetSettings();
extern PARAM_CFG_BASE* ParamCfgList[];
wxGetApp().ReadCurrentSetupValues( ParamCfgList );
if( m_Checker && m_Checker->IsAnotherRunning() ) if( m_Checker && m_Checker->IsAnotherRunning() )
{ {

View File

@ -1,6 +1,9 @@
/**********************************************************/ /**********************************************************/
/** cfg.h : configuration: definition des structures **/ /* gerber_config.h : configuration: setup parameters list */
/**********************************************************/ /**********************************************************/
#include "param_config.h"
#define GROUP wxT("/gerbview") #define GROUP wxT("/gerbview")
#define GROUPLIB wxT("libraries") #define GROUPLIB wxT("libraries")
@ -444,7 +447,7 @@ static PARAM_CFG_INT CursorShapeCfg
0, 1 /* Valeurs extremes */ 0, 1 /* Valeurs extremes */
); );
static PARAM_CFG_BASE * ParamCfgList[] = PARAM_CFG_BASE * ParamCfgList[] =
{ {
& PhotoExtBufCfg, & PhotoExtBufCfg,
& PenExtBufCfg, & PenExtBufCfg,

View File

@ -82,6 +82,20 @@ public:
const wxString& GroupName, const wxString& GroupName,
PARAM_CFG_BASE** List ); PARAM_CFG_BASE** List );
/** Function SaveCurrentSetupValues()
* Save the current setup values in m_EDA_Config
* saved parameters are parameters that have the .m_Setup member set to true
* @param aList = array of PARAM_CFG_BASE pointers
*/
void SaveCurrentSetupValues( PARAM_CFG_BASE** aList );
/** Function ReadCurrentSetupValues()
* Raed the current setup values previously saved, from m_EDA_Config
* saved parameters are parameters that have the .m_Setup member set to true
* @param aList = array of PARAM_CFG_BASE pointers
*/
void ReadCurrentSetupValues( PARAM_CFG_BASE** aList );
bool ReadProjectConfig( const wxString& local_config_filename, 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 Load_Only_if_New );

View File

@ -86,117 +86,8 @@ enum pseudokeys {
/* forward declarations: */ /* forward declarations: */
class LibNameList; class LibNameList;
/* definifition des types de parametre des files de configuration */
enum paramcfg_id /* type du parametre dans la structure ParamConfig */
{
PARAM_INT,
PARAM_SETCOLOR,
PARAM_DOUBLE,
PARAM_BOOL,
PARAM_LIBNAME_LIST,
PARAM_WXSTRING,
PARAM_COMMAND_ERASE
};
#define MAX_COLOR 0x8001F //#define MAX_COLOR 0x8001F
#define INT_MINVAL 0x80000000
#define INT_MAXVAL 0x7FFFFFFF
class PARAM_CFG_BASE
{
public:
const wxChar* m_Ident; /* Abreviation de reperage des debuts de lignes */
paramcfg_id m_Type; /* flag type des parametres */
const wxChar* m_Group; /* Nom du groupe (rubrique) de classement */
bool m_Setup; /* TRUE -> inscription en setup (registration base)*/
public:
PARAM_CFG_BASE( const wxChar* ident, const paramcfg_id type, const wxChar* group = NULL );
~PARAM_CFG_BASE() { };
};
class PARAM_CFG_INT : public PARAM_CFG_BASE
{
public:
int* m_Pt_param; /* pointeur sur le parametre a configurer */
int m_Min, m_Max; /* valeurs extremes du parametre */
int m_Default; /* valeur par defaut */
public:
PARAM_CFG_INT( const wxChar* ident, int* ptparam,
int default_val = 0, int min = INT_MINVAL, int max = INT_MAXVAL,
const wxChar* group = NULL );
PARAM_CFG_INT( bool Insetup, const wxChar* ident, int* ptparam,
int default_val = 0, int min = INT_MINVAL, int max = INT_MAXVAL,
const wxChar* group = NULL );
};
class PARAM_CFG_SETCOLOR : public PARAM_CFG_BASE
{
public:
int* m_Pt_param; /* pointeur sur le parametre a configurer */
int m_Default; /* valeur par defaut */
public:
PARAM_CFG_SETCOLOR( const wxChar* ident, int* ptparam,
int default_val, const wxChar* group = NULL );
PARAM_CFG_SETCOLOR( bool Insetup, const wxChar* ident, int* ptparam,
int default_val, const wxChar* group = NULL );
};
class PARAM_CFG_DOUBLE : public PARAM_CFG_BASE
{
public:
double* m_Pt_param; /* pointeur sur le parametre a configurer */
double m_Default; /* valeur par defaut */
double m_Min, m_Max; /* valeurs extremes du parametre */
public:
PARAM_CFG_DOUBLE( const wxChar* ident, double* ptparam,
double default_val = 0.0, double min = 0.0, double max = 10000.0,
const wxChar* group = NULL );
PARAM_CFG_DOUBLE( bool Insetup, const wxChar* ident, double* ptparam,
double default_val = 0.0, double min = 0.0, double max = 10000.0,
const wxChar* group = NULL );
};
class PARAM_CFG_BOOL : public PARAM_CFG_BASE
{
public:
bool* m_Pt_param; /* pointeur sur le parametre a configurer */
int m_Default; /* valeur par defaut */
public:
PARAM_CFG_BOOL( const wxChar* ident, bool* ptparam,
int default_val = FALSE, const wxChar* group = NULL );
PARAM_CFG_BOOL( bool Insetup, const wxChar* ident, bool* ptparam,
int default_val = FALSE, const wxChar* group = NULL );
};
class PARAM_CFG_WXSTRING : public PARAM_CFG_BASE
{
public:
wxString* m_Pt_param; /* pointeur sur le parametre a configurer */
public:
PARAM_CFG_WXSTRING( const wxChar* ident, wxString* ptparam, const wxChar* group = NULL );
PARAM_CFG_WXSTRING( bool Insetup,
const wxChar* ident,
wxString* ptparam,
const wxChar* group = NULL );
};
class PARAM_CFG_LIBNAME_LIST : public PARAM_CFG_BASE
{
public:
wxArrayString* m_Pt_param; /* pointeur sur le parametre a configurer */
public:
PARAM_CFG_LIBNAME_LIST( const wxChar* ident,
wxArrayString* ptparam,
const wxChar* group = NULL );
};
/***********************************/ /***********************************/
@ -220,7 +111,7 @@ private:
}; };
/* Gestion des feuilles de trac<61>: /* Clsass to handle pages sizes:
*/ */
class Ki_PageDescr class Ki_PageDescr
{ {
@ -311,6 +202,7 @@ COMMON_GLOBL bool g_ShowPageLimits // TRUE to display the page limits
#endif #endif
; ;
/* Gloabl variables for project handling */ /* Gloabl variables for project handling */
COMMON_GLOBL wxString g_Prj_Config_Filename_ext COMMON_GLOBL wxString g_Prj_Config_Filename_ext
#ifdef EDA_BASE #ifdef EDA_BASE

213
include/param_config.h Normal file
View File

@ -0,0 +1,213 @@
/**
* The common library
* @file param_config.h
*/
#ifndef __PARAM_CONFIG_H__
#define __PARAM_CONFIG_H__ 1
#include "wx/confbase.h"
#include "wx/fileconf.h"
#ifndef COMMON_GLOBL
# define COMMON_GLOBL extern
#endif
/* definifition des types de parametre des files de configuration */
enum paramcfg_id /* type du parametre dans la structure ParamConfig */
{
PARAM_INT,
PARAM_SETCOLOR,
PARAM_DOUBLE,
PARAM_BOOL,
PARAM_LIBNAME_LIST,
PARAM_WXSTRING,
PARAM_COMMAND_ERASE
};
#define MAX_COLOR 0x8001F
#define INT_MINVAL 0x80000000
#define INT_MAXVAL 0x7FFFFFFF
class PARAM_CFG_BASE
{
public:
const wxChar* m_Ident; /* Keyword in config data */
paramcfg_id m_Type; /* Type of parameter */
const wxChar* m_Group; /* Group name (tjis is like a path in the config data) */
bool m_Setup; /* TRUE -> setup parameter (used for all projects), FALSE = parameter relative to a project */
public:
PARAM_CFG_BASE( const wxChar* ident, const paramcfg_id type, const wxChar* group = NULL );
~PARAM_CFG_BASE() { };
/** ReadParam
* read the value of parameter thi stored in aConfig
* @param aConfig = the wxConfigBase that store the parameter
*/
virtual void ReadParam( wxConfigBase* aConfig ) {};
/** SaveParam
* the the value of parameter thi stored in aConfig
* @param aConfig = the wxConfigBase that can store the parameter
*/
virtual void SaveParam( wxConfigBase* aConfig ) {};
};
class PARAM_CFG_INT : public PARAM_CFG_BASE
{
public:
int* m_Pt_param; /* pointeur sur le parametre a configurer */
int m_Min, m_Max; /* valeurs extremes du parametre */
int m_Default; /* valeur par defaut */
public:
PARAM_CFG_INT( const wxChar* ident, int* ptparam,
int default_val = 0, int min = INT_MINVAL, int max = INT_MAXVAL,
const wxChar* group = NULL );
PARAM_CFG_INT( bool Insetup, const wxChar* ident, int* ptparam,
int default_val = 0, int min = INT_MINVAL, int max = INT_MAXVAL,
const wxChar* group = NULL );
/** ReadParam
* read the value of parameter thi stored in aConfig
* @param aConfig = the wxConfigBase that store the parameter
*/
virtual void ReadParam( wxConfigBase* aConfig );
/** SaveParam
* the the value of parameter thi stored in aConfig
* @param aConfig = the wxConfigBase that can store the parameter
*/
virtual void SaveParam( wxConfigBase* aConfig );
};
class PARAM_CFG_SETCOLOR : public PARAM_CFG_BASE
{
public:
int* m_Pt_param; /* pointeur sur le parametre a configurer */
int m_Default; /* valeur par defaut */
public:
PARAM_CFG_SETCOLOR( const wxChar* ident, int* ptparam,
int default_val, const wxChar* group = NULL );
PARAM_CFG_SETCOLOR( bool Insetup, const wxChar* ident, int* ptparam,
int default_val, const wxChar* group = NULL );
/** ReadParam
* read the value of parameter thi stored in aConfig
* @param aConfig = the wxConfigBase that store the parameter
*/
virtual void ReadParam( wxConfigBase* aConfig );
/** SaveParam
* the the value of parameter thi stored in aConfig
* @param aConfig = the wxConfigBase that can store the parameter
*/
virtual void SaveParam( wxConfigBase* aConfig );
};
class PARAM_CFG_DOUBLE : public PARAM_CFG_BASE
{
public:
double* m_Pt_param; /* pointeur sur le parametre a configurer */
double m_Default; /* valeur par defaut */
double m_Min, m_Max; /* valeurs extremes du parametre */
public:
PARAM_CFG_DOUBLE( const wxChar* ident, double* ptparam,
double default_val = 0.0, double min = 0.0, double max = 10000.0,
const wxChar* group = NULL );
PARAM_CFG_DOUBLE( bool Insetup, const wxChar* ident, double* ptparam,
double default_val = 0.0, double min = 0.0, double max = 10000.0,
const wxChar* group = NULL );
/** ReadParam
* read the value of parameter thi stored in aConfig
* @param aConfig = the wxConfigBase that store the parameter
*/
virtual void ReadParam( wxConfigBase* aConfig );
/** SaveParam
* the the value of parameter thi stored in aConfig
* @param aConfig = the wxConfigBase that can store the parameter
*/
virtual void SaveParam( wxConfigBase* aConfig );
};
class PARAM_CFG_BOOL : public PARAM_CFG_BASE
{
public:
bool* m_Pt_param; /* pointeur sur le parametre a configurer */
int m_Default; /* valeur par defaut */
public:
PARAM_CFG_BOOL( const wxChar* ident, bool* ptparam,
int default_val = FALSE, const wxChar* group = NULL );
PARAM_CFG_BOOL( bool Insetup, const wxChar* ident, bool* ptparam,
int default_val = FALSE, const wxChar* group = NULL );
/** ReadParam
* read the value of parameter thi stored in aConfig
* @param aConfig = the wxConfigBase that store the parameter
*/
virtual void ReadParam( wxConfigBase* aConfig );
/** SaveParam
* the the value of parameter thi stored in aConfig
* @param aConfig = the wxConfigBase that can store the parameter
*/
virtual void SaveParam( wxConfigBase* aConfig );
};
class PARAM_CFG_WXSTRING : public PARAM_CFG_BASE
{
public:
wxString* m_Pt_param; /* pointeur sur le parametre a configurer */
public:
PARAM_CFG_WXSTRING( const wxChar* ident, wxString* ptparam, const wxChar* group = NULL );
PARAM_CFG_WXSTRING( bool Insetup,
const wxChar* ident,
wxString* ptparam,
const wxChar* group = NULL );
/** ReadParam
* read the value of parameter thi stored in aConfig
* @param aConfig = the wxConfigBase that store the parameter
*/
virtual void ReadParam( wxConfigBase* aConfig );
/** SaveParam
* the the value of parameter thi stored in aConfig
* @param aConfig = the wxConfigBase that can store the parameter
*/
virtual void SaveParam( wxConfigBase* aConfig );
};
class PARAM_CFG_LIBNAME_LIST : public PARAM_CFG_BASE
{
public:
wxArrayString* m_Pt_param; /* pointeur sur le parametre a configurer */
public:
PARAM_CFG_LIBNAME_LIST( const wxChar* ident,
wxArrayString* ptparam,
const wxChar* group = NULL );
/** ReadParam
* read the value of parameter thi stored in aConfig
* @param aConfig = the wxConfigBase that store the parameter
*/
virtual void ReadParam( wxConfigBase* aConfig );
/** SaveParam
* the the value of parameter thi stored in aConfig
* @param aConfig = the wxConfigBase that can store the parameter
*/
virtual void SaveParam( wxConfigBase* aConfig );
};
#endif /* __PARAM_CONFIG_H__ */

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,7 @@
/* prjconfig.h : configuration: definition des structures */ /* prjconfig.h : configuration: definition des structures */
/**********************************************************/ /**********************************************************/
#include "param_config.h"
/* Liste des parametres */ /* Liste des parametres */

View File

@ -35,7 +35,7 @@ DialogDisplayOptions_base::DialogDisplayOptions_base( wxWindow* parent, wxWindow
sLeftBoxSizer->Add( m_OptDisplayTracksClearance, 0, wxALL|wxEXPAND, 5 ); sLeftBoxSizer->Add( m_OptDisplayTracksClearance, 0, wxALL|wxEXPAND, 5 );
wxString m_OptDisplayViaHoleChoices[] = { _("Never"), _("Defined Holes"), _("Always") }; wxString m_OptDisplayViaHoleChoices[] = { _("Never"), _("Defined holes"), _("Always") };
int m_OptDisplayViaHoleNChoices = sizeof( m_OptDisplayViaHoleChoices ) / sizeof( wxString ); int m_OptDisplayViaHoleNChoices = sizeof( m_OptDisplayViaHoleChoices ) / sizeof( wxString );
m_OptDisplayViaHole = new wxRadioBox( this, ID_VIAS_HOLES, _("Show Via Holes:"), wxDefaultPosition, wxDefaultSize, m_OptDisplayViaHoleNChoices, m_OptDisplayViaHoleChoices, 1, wxRA_SPECIFY_COLS ); m_OptDisplayViaHole = new wxRadioBox( this, ID_VIAS_HOLES, _("Show Via Holes:"), wxDefaultPosition, wxDefaultSize, m_OptDisplayViaHoleNChoices, m_OptDisplayViaHoleChoices, 1, wxRA_SPECIFY_COLS );
m_OptDisplayViaHole->SetSelection( 1 ); m_OptDisplayViaHole->SetSelection( 1 );
@ -48,7 +48,7 @@ DialogDisplayOptions_base::DialogDisplayOptions_base( wxWindow* parent, wxWindow
wxStaticBoxSizer* sbMiddleLeftSizer; wxStaticBoxSizer* sbMiddleLeftSizer;
sbMiddleLeftSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Net Names:") ), wxVERTICAL ); sbMiddleLeftSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Net Names:") ), wxVERTICAL );
wxString m_ShowNetNamesOptionChoices[] = { _("Do Not Show"), _("On Pads"), _("OnTracks"), _("On Pads and Tracks") }; wxString m_ShowNetNamesOptionChoices[] = { _("Do not show"), _("On pads"), _("On tracks"), _("On pads and tracks") };
int m_ShowNetNamesOptionNChoices = sizeof( m_ShowNetNamesOptionChoices ) / sizeof( wxString ); int m_ShowNetNamesOptionNChoices = sizeof( m_ShowNetNamesOptionChoices ) / sizeof( wxString );
m_ShowNetNamesOption = new wxRadioBox( this, wxID_ANY, _("Show Net Names:"), wxDefaultPosition, wxDefaultSize, m_ShowNetNamesOptionNChoices, m_ShowNetNamesOptionChoices, 1, wxRA_SPECIFY_COLS ); m_ShowNetNamesOption = new wxRadioBox( this, wxID_ANY, _("Show Net Names:"), wxDefaultPosition, wxDefaultSize, m_ShowNetNamesOptionNChoices, m_ShowNetNamesOptionChoices, 1, wxRA_SPECIFY_COLS );
m_ShowNetNamesOption->SetSelection( 3 ); m_ShowNetNamesOption->SetSelection( 3 );
@ -87,16 +87,16 @@ DialogDisplayOptions_base::DialogDisplayOptions_base( wxWindow* parent, wxWindow
m_OptDisplayPads->SetSelection( 1 ); m_OptDisplayPads->SetSelection( 1 );
bRModuleSizer->Add( m_OptDisplayPads, 0, wxALL|wxEXPAND, 5 ); bRModuleSizer->Add( m_OptDisplayPads, 0, wxALL|wxEXPAND, 5 );
m_OptDisplayPadClearence = new wxCheckBox( this, wxID_ANY, _("Show Pad Clearance"), wxDefaultPosition, wxDefaultSize, 0 ); m_OptDisplayPadClearence = new wxCheckBox( this, wxID_ANY, _("Show pad clearance"), wxDefaultPosition, wxDefaultSize, 0 );
bRModuleSizer->Add( m_OptDisplayPadClearence, 0, wxALL, 5 ); bRModuleSizer->Add( m_OptDisplayPadClearence, 0, wxALL, 5 );
m_OptDisplayPadNumber = new wxCheckBox( this, wxID_ANY, _("Show Pad Number"), wxDefaultPosition, wxDefaultSize, 0 ); m_OptDisplayPadNumber = new wxCheckBox( this, wxID_ANY, _("Show pad number"), wxDefaultPosition, wxDefaultSize, 0 );
m_OptDisplayPadNumber->SetValue(true); m_OptDisplayPadNumber->SetValue(true);
bRModuleSizer->Add( m_OptDisplayPadNumber, 0, wxALL, 5 ); bRModuleSizer->Add( m_OptDisplayPadNumber, 0, wxALL, 5 );
m_OptDisplayPadNoConn = new wxCheckBox( this, wxID_ANY, _("Show Pad NoConnect"), wxDefaultPosition, wxDefaultSize, 0 ); m_OptDisplayPadNoConn = new wxCheckBox( this, wxID_ANY, _("Show pad NoConnect"), wxDefaultPosition, wxDefaultSize, 0 );
m_OptDisplayPadNoConn->SetValue(true); m_OptDisplayPadNoConn->SetValue(true);
bRModuleSizer->Add( m_OptDisplayPadNoConn, 0, wxALL, 5 ); bRModuleSizer->Add( m_OptDisplayPadNoConn, 0, wxALL, 5 );

View File

@ -201,7 +201,7 @@
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxRadioBox" expanded="1"> <object class="wxRadioBox" expanded="1">
<property name="bg"></property> <property name="bg"></property>
<property name="choices">&quot;Never&quot; &quot;Defined Holes&quot; &quot;Always&quot;</property> <property name="choices">&quot;Never&quot; &quot;Defined holes&quot; &quot;Always&quot;</property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="enabled">1</property> <property name="enabled">1</property>
<property name="fg"></property> <property name="fg"></property>
@ -269,7 +269,7 @@
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxRadioBox" expanded="1"> <object class="wxRadioBox" expanded="1">
<property name="bg"></property> <property name="bg"></property>
<property name="choices">&quot;Do Not Show&quot; &quot;On Pads&quot; &quot;OnTracks&quot; &quot;On Pads and Tracks&quot;</property> <property name="choices">&quot;Do not show&quot; &quot;On pads&quot; &quot;On tracks&quot; &quot;On pads and tracks&quot;</property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="enabled">1</property> <property name="enabled">1</property>
<property name="fg"></property> <property name="fg"></property>
@ -529,7 +529,7 @@
<property name="font"></property> <property name="font"></property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Show Pad Clearance</property> <property name="label">Show pad clearance</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">m_OptDisplayPadClearence</property> <property name="name">m_OptDisplayPadClearence</property>
@ -581,7 +581,7 @@
<property name="font"></property> <property name="font"></property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Show Pad Number</property> <property name="label">Show pad number</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">m_OptDisplayPadNumber</property> <property name="name">m_OptDisplayPadNumber</property>
@ -633,7 +633,7 @@
<property name="font"></property> <property name="font"></property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Show Pad NoConnect</property> <property name="label">Show pad NoConnect</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">m_OptDisplayPadNoConn</property> <property name="name">m_OptDisplayPadNoConn</property>

View File

@ -2,6 +2,8 @@
/** pcbcfg.h : configuration: definition des structures **/ /** pcbcfg.h : configuration: definition des structures **/
/**********************************************************/ /**********************************************************/
#include "param_config.h"
#define GROUP wxT( "/pcbnew" ) #define GROUP wxT( "/pcbnew" )
#define GROUPLIB wxT( "/pcbnew/libraries" ) #define GROUPLIB wxT( "/pcbnew/libraries" )
#define GROUPCOMMON wxT( "/common" ) #define GROUPCOMMON wxT( "/common" )

View File

@ -211,7 +211,6 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
wxConfig* config = wxGetApp().m_EDA_Config; wxConfig* config = wxGetApp().m_EDA_Config;
m_FrameName = wxT( "PcbFrame" ); m_FrameName = wxT( "PcbFrame" );
//m_AboutTitle = g_PcbnewAboutTitle;
m_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines m_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines
m_Draw_Grid = g_ShowGrid; // TRUE pour avoir la grille dessinee m_Draw_Grid = g_ShowGrid; // TRUE pour avoir la grille dessinee
m_Draw_Sheet_Ref = TRUE; // TRUE pour avoir le cartouche dessine m_Draw_Sheet_Ref = TRUE; // TRUE pour avoir le cartouche dessine
@ -291,6 +290,9 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
WinEDA_PcbFrame::~WinEDA_PcbFrame() WinEDA_PcbFrame::~WinEDA_PcbFrame()
/************************************/ /************************************/
{ {
extern PARAM_CFG_BASE* ParamCfgList[];
wxGetApp().SaveCurrentSetupValues( ParamCfgList );
SetBaseScreen( ScreenPcb ); SetBaseScreen( ScreenPcb );
delete m_drc; delete m_drc;

View File

@ -29,6 +29,7 @@
#include "eda_dde.h" #include "eda_dde.h"
wxString g_Main_Title( wxT( "PCBnew" ) ); wxString g_Main_Title( wxT( "PCBnew" ) );
extern PARAM_CFG_BASE* ParamCfgList[];
IMPLEMENT_APP( WinEDA_App ) IMPLEMENT_APP( WinEDA_App )
@ -57,6 +58,7 @@ bool WinEDA_App::OnInit()
} }
Read_Config( FFileName ); Read_Config( FFileName );
wxGetApp().ReadCurrentSetupValues( ParamCfgList );
g_DrawBgColor = BLACK; g_DrawBgColor = BLACK;
Read_Hotkey_Config( frame, false ); /* Must be called before creating the Read_Hotkey_Config( frame, false ); /* Must be called before creating the
* main frame in order to display the * main frame in order to display the