code cleanup in project_config.cpp and some enhancements
This commit is contained in:
parent
2eaa28f0cb
commit
b65590f708
|
@ -4,6 +4,17 @@ KiCad ChangeLog 2009
|
|||
Please add newer entries at the top, list the date and your name with
|
||||
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>
|
||||
================================================================================
|
||||
++pcbnew:
|
||||
|
|
|
@ -53,7 +53,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
|
|||
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 size_h, size_v, pitch;
|
||||
SH_CODE f_cod, plume = 'U';
|
||||
|
@ -62,7 +62,8 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
|
|||
int ux0, uy0, dx, dy; // Draw coordinate for segments to draw. also used in some other calculation
|
||||
int cX, cY; // Texte center
|
||||
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 italic_reverse = false; // true for mirrored texts with m_Size.x < 0
|
||||
|
||||
|
@ -72,7 +73,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
|
|||
if( aWidth < 0 )
|
||||
{
|
||||
aWidth = -aWidth;
|
||||
sketch_mode = TRUE;
|
||||
sketch_mode = true;
|
||||
}
|
||||
int thickness = aWidth;
|
||||
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
|
||||
* 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;
|
||||
|
||||
|
@ -242,36 +245,34 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
|
|||
switch( f_cod )
|
||||
{
|
||||
case 'X':
|
||||
endcar = TRUE; /* fin du caractere */
|
||||
endcar = true; /* fin du caractere */
|
||||
break;
|
||||
|
||||
case 'U':
|
||||
if( ii && (plume == 'D' ) )
|
||||
if( point_count && (plume == 'D' ) )
|
||||
{
|
||||
if( aWidth <= 1 )
|
||||
aWidth = 0;
|
||||
if ( aCallback )
|
||||
{
|
||||
int ik, * coordptr;
|
||||
coordptr = coord;
|
||||
for( ik = 0; ik < (ii - 2); ik += 2, coordptr += 2 )
|
||||
aCallback( *coordptr, *(coordptr + 1),
|
||||
*(coordptr + 2), *(coordptr + 3) );
|
||||
for( int ik = 0; ik < (point_count - 1); ik ++ )
|
||||
{
|
||||
aCallback( coord[ik].x, coord[ik].y,
|
||||
coord[ik+1].x, coord[ik+1].y );
|
||||
}
|
||||
}
|
||||
|
||||
else if( sketch_mode )
|
||||
{
|
||||
int ik, * coordptr;
|
||||
coordptr = coord;
|
||||
for( ik = 0; ik < (ii - 2); ik += 2, coordptr += 2 )
|
||||
GRCSegm( &aPanel->m_ClipBox, aDC, *coordptr, *(coordptr + 1),
|
||||
*(coordptr + 2), *(coordptr + 3), aWidth, aColor );
|
||||
for( int ik = 0; ik < (point_count - 1); ik ++ )
|
||||
GRCSegm( &aPanel->m_ClipBox, aDC, coord[ik].x, coord[ik].y,
|
||||
coord[ik+1].x, coord[ik+1].y, aWidth, aColor );
|
||||
}
|
||||
else
|
||||
GRPoly( &aPanel->m_ClipBox, aDC, ii / 2, (wxPoint*)coord, 0,
|
||||
GRPoly( &aPanel->m_ClipBox, aDC, point_count, coord, 0,
|
||||
aWidth, aColor, aColor );
|
||||
}
|
||||
plume = f_cod; ii = 0;
|
||||
plume = f_cod; point_count = 0;
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
|
@ -295,8 +296,10 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
|
|||
dx = k2 + ox; dy = k1 + oy;
|
||||
|
||||
RotatePoint( &dx, &dy, cX, cY, aOrient );
|
||||
coord[ii++] = dx;
|
||||
coord[ii++] = dy;
|
||||
coord[point_count].x = dx;
|
||||
coord[point_count].y = dy;
|
||||
if ( point_count < BUF_SIZE-1 )
|
||||
point_count++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include "appl_wxstruct.h"
|
||||
#include "common.h"
|
||||
#include "param_config.h"
|
||||
#include "worksheet.h"
|
||||
#include "id.h"
|
||||
#include "build_version.h"
|
||||
|
|
|
@ -8,10 +8,11 @@
|
|||
#include "common.h"
|
||||
#include "kicad_string.h"
|
||||
#include "gestfich.h"
|
||||
#include "param_config.h"
|
||||
|
||||
#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_Default_Config_FullFilename
|
||||
* return:
|
||||
* TRUE si config locale
|
||||
* FALSE si default config
|
||||
* true si config locale
|
||||
* false si default config
|
||||
*/
|
||||
{
|
||||
// free old config
|
||||
|
@ -56,7 +57,7 @@ static bool ReCreatePrjConfig( const wxString& local_config_filename,
|
|||
g_Prj_Config->DontCreateOnDemand();
|
||||
|
||||
if( ForceUseLocalConfig )
|
||||
return TRUE;
|
||||
return true;
|
||||
|
||||
// Test de la bonne version du fichier (ou groupe) de configuration
|
||||
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 );
|
||||
g_Prj_Config->SetPath( UNIX_STRING_DIR_SEP );
|
||||
if( version > 0 )
|
||||
return TRUE;
|
||||
return true;
|
||||
else
|
||||
delete g_Prj_Config; // Version incorrecte
|
||||
}
|
||||
|
@ -86,7 +87,7 @@ static bool ReCreatePrjConfig( const wxString& local_config_filename,
|
|||
|
||||
g_Prj_Config->DontCreateOnDemand();
|
||||
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -95,9 +96,14 @@ void WinEDA_App::WriteProjectConfig( const wxString& local_config_filename,
|
|||
const wxString& GroupName,
|
||||
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;
|
||||
|
||||
ReCreatePrjConfig( local_config_filename, GroupName,
|
||||
|
@ -114,7 +120,7 @@ void WinEDA_App::WriteProjectConfig( const wxString& local_config_filename,
|
|||
|
||||
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->Flush();
|
||||
|
||||
|
@ -130,102 +136,16 @@ void WinEDA_App::WriteProjectConfig( const wxString& local_config_filename,
|
|||
else
|
||||
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 )
|
||||
{
|
||||
m_EDA_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 );
|
||||
|
@ -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,
|
||||
const wxString& GroupName,
|
||||
|
@ -241,31 +194,34 @@ bool WinEDA_App::ReadProjectConfig( const wxString& local_config_filename,
|
|||
bool Load_Only_if_New )
|
||||
/***************************************************************************************/
|
||||
|
||||
/* Lecture de la config "projet"
|
||||
*** si Load_Only_if_New == TRUE, elle n'est lue que si elle
|
||||
*** est differente de la config actuelle (dates differentes)
|
||||
/** Function ReadProjectConfig
|
||||
* Read the current "projet" parameters
|
||||
* Parameters are parameters that have the .m_Setup member set to false
|
||||
* read file is the .pro file project
|
||||
*
|
||||
* return:
|
||||
* TRUE si lue.
|
||||
* Met a jour en plus:
|
||||
* if Load_Only_if_New == true, this file is read only if it diders from
|
||||
* the current config (different dates )
|
||||
*
|
||||
* @return true if read.
|
||||
* Also set:
|
||||
* wxGetApp().m_CurrentOptionFileDateAndTime
|
||||
* wxGetApp().m_CurrentOptionFile
|
||||
*/
|
||||
{
|
||||
const PARAM_CFG_BASE* pt_cfg;
|
||||
PARAM_CFG_BASE* pt_cfg;
|
||||
wxString timestamp;
|
||||
|
||||
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 );
|
||||
timestamp = g_Prj_Config->Read( wxT( "update" ) );
|
||||
if( Load_Only_if_New && ( !timestamp.IsEmpty() )
|
||||
&& (timestamp == wxGetApp().m_CurrentOptionFileDateAndTime) )
|
||||
{
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
wxGetApp().m_CurrentOptionFileDateAndTime = timestamp;
|
||||
|
@ -289,121 +245,39 @@ bool WinEDA_App::ReadProjectConfig( const wxString& local_config_filename,
|
|||
else
|
||||
g_Prj_Config->SetPath( GroupName );
|
||||
|
||||
switch( pt_cfg->m_Type )
|
||||
{
|
||||
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 );
|
||||
continue;
|
||||
|
||||
if( (itmp < PTCFG->m_Min) || (itmp > PTCFG->m_Max) )
|
||||
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;
|
||||
}
|
||||
pt_cfg->ReadParam( g_Prj_Config );
|
||||
}
|
||||
|
||||
delete g_Prj_Config;
|
||||
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_Type = type;
|
||||
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,
|
||||
int default_val,
|
||||
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,
|
||||
double default_val, double min, double max,
|
||||
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,
|
||||
int default_val, const wxChar* group ) :
|
||||
PARAM_CFG_BASE( ident, PARAM_BOOL, group )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
m_Pt_param = ptparam;
|
||||
m_Default = default_val ? TRUE : FALSE;
|
||||
m_Default = default_val ? true : false;
|
||||
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,
|
||||
wxString* ptparam,
|
||||
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,
|
||||
wxArrayString* ptparam,
|
||||
const wxChar* group ) :
|
||||
|
@ -546,3 +569,50 @@ PARAM_CFG_LIBNAME_LIST::PARAM_CFG_LIBNAME_LIST( const wxChar* ident,
|
|||
{
|
||||
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 ) );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#define eda_global extern
|
||||
#endif
|
||||
|
||||
#include "param_config.h"
|
||||
|
||||
#define INSETUP TRUE
|
||||
|
||||
#define GROUP wxT("/cvpcb")
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#define eda_global extern
|
||||
#endif
|
||||
|
||||
#include "param_config.h"
|
||||
|
||||
#define GROUP wxT( "/eeschema" )
|
||||
#define GROUPCOMMON wxT( "/common" )
|
||||
#define GROUPLIB wxT( "libraries" )
|
||||
|
|
|
@ -63,6 +63,8 @@ bool WinEDA_App::OnInit()
|
|||
/* init EESCHEMA */
|
||||
GetSettings(); // read current setup
|
||||
SeedLayers();
|
||||
extern PARAM_CFG_BASE* ParamCfgList[];
|
||||
wxGetApp().ReadCurrentSetupValues( ParamCfgList );
|
||||
Read_Hotkey_Config( frame, false ); /* Must be called before creating
|
||||
* the main frame in order to
|
||||
* display the real hotkeys in menus
|
||||
|
|
|
@ -186,6 +186,9 @@ WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father,
|
|||
|
||||
WinEDA_SchematicFrame::~WinEDA_SchematicFrame()
|
||||
{
|
||||
extern PARAM_CFG_BASE* ParamCfgList[];
|
||||
wxGetApp().SaveCurrentSetupValues( ParamCfgList );
|
||||
|
||||
SAFE_DELETE( g_RootSheet );
|
||||
SAFE_DELETE( m_CurrentSheet ); //a DrawSheetPath, on the heap.
|
||||
m_CurrentSheet = NULL;
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#endif
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "appl_wxstruct.h"
|
||||
#include "wxstruct.h"
|
||||
#include "common.h"
|
||||
#include "class_drawpanel.h"
|
||||
|
@ -163,6 +164,9 @@ WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father,
|
|||
WinEDA_GerberFrame::~WinEDA_GerberFrame()
|
||||
{
|
||||
SetBaseScreen( ScreenPcb );
|
||||
extern PARAM_CFG_BASE* ParamCfgList[];
|
||||
wxGetApp().SaveCurrentSetupValues( ParamCfgList );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -37,6 +37,8 @@ bool WinEDA_App::OnInit()
|
|||
|
||||
ActiveScreen = ScreenPcb;
|
||||
GetSettings();
|
||||
extern PARAM_CFG_BASE* ParamCfgList[];
|
||||
wxGetApp().ReadCurrentSetupValues( ParamCfgList );
|
||||
|
||||
if( m_Checker && m_Checker->IsAnotherRunning() )
|
||||
{
|
||||
|
|
|
@ -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 GROUPLIB wxT("libraries")
|
||||
|
||||
|
@ -444,7 +447,7 @@ static PARAM_CFG_INT CursorShapeCfg
|
|||
0, 1 /* Valeurs extremes */
|
||||
);
|
||||
|
||||
static PARAM_CFG_BASE * ParamCfgList[] =
|
||||
PARAM_CFG_BASE * ParamCfgList[] =
|
||||
{
|
||||
& PhotoExtBufCfg,
|
||||
& PenExtBufCfg,
|
||||
|
|
|
@ -82,6 +82,20 @@ public:
|
|||
const wxString& GroupName,
|
||||
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,
|
||||
const wxString& GroupName, PARAM_CFG_BASE** List,
|
||||
bool Load_Only_if_New );
|
||||
|
|
114
include/common.h
114
include/common.h
|
@ -86,117 +86,8 @@ enum pseudokeys {
|
|||
/* forward declarations: */
|
||||
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 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 );
|
||||
};
|
||||
//#define MAX_COLOR 0x8001F
|
||||
|
||||
|
||||
/***********************************/
|
||||
|
@ -220,7 +111,7 @@ private:
|
|||
};
|
||||
|
||||
|
||||
/* Gestion des feuilles de trac<61>:
|
||||
/* Clsass to handle pages sizes:
|
||||
*/
|
||||
class Ki_PageDescr
|
||||
{
|
||||
|
@ -311,6 +202,7 @@ COMMON_GLOBL bool g_ShowPageLimits // TRUE to display the page limits
|
|||
#endif
|
||||
;
|
||||
|
||||
|
||||
/* Gloabl variables for project handling */
|
||||
COMMON_GLOBL wxString g_Prj_Config_Filename_ext
|
||||
#ifdef EDA_BASE
|
||||
|
|
|
@ -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
|
@ -2,6 +2,7 @@
|
|||
/* prjconfig.h : configuration: definition des structures */
|
||||
/**********************************************************/
|
||||
|
||||
#include "param_config.h"
|
||||
|
||||
|
||||
/* Liste des parametres */
|
||||
|
|
|
@ -35,7 +35,7 @@ DialogDisplayOptions_base::DialogDisplayOptions_base( wxWindow* parent, wxWindow
|
|||
|
||||
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 );
|
||||
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 );
|
||||
|
@ -48,7 +48,7 @@ DialogDisplayOptions_base::DialogDisplayOptions_base( wxWindow* parent, wxWindow
|
|||
wxStaticBoxSizer* sbMiddleLeftSizer;
|
||||
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 );
|
||||
m_ShowNetNamesOption = new wxRadioBox( this, wxID_ANY, _("Show Net Names:"), wxDefaultPosition, wxDefaultSize, m_ShowNetNamesOptionNChoices, m_ShowNetNamesOptionChoices, 1, wxRA_SPECIFY_COLS );
|
||||
m_ShowNetNamesOption->SetSelection( 3 );
|
||||
|
@ -87,16 +87,16 @@ DialogDisplayOptions_base::DialogDisplayOptions_base( wxWindow* parent, wxWindow
|
|||
m_OptDisplayPads->SetSelection( 1 );
|
||||
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 );
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
bRModuleSizer->Add( m_OptDisplayPadNoConn, 0, wxALL, 5 );
|
||||
|
|
|
@ -201,7 +201,7 @@
|
|||
<property name="proportion">0</property>
|
||||
<object class="wxRadioBox" expanded="1">
|
||||
<property name="bg"></property>
|
||||
<property name="choices">"Never" "Defined Holes" "Always"</property>
|
||||
<property name="choices">"Never" "Defined holes" "Always"</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
|
@ -269,7 +269,7 @@
|
|||
<property name="proportion">0</property>
|
||||
<object class="wxRadioBox" expanded="1">
|
||||
<property name="bg"></property>
|
||||
<property name="choices">"Do Not Show" "On Pads" "OnTracks" "On Pads and Tracks"</property>
|
||||
<property name="choices">"Do not show" "On pads" "On tracks" "On pads and tracks"</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
|
@ -529,7 +529,7 @@
|
|||
<property name="font"></property>
|
||||
<property name="hidden">0</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="minimum_size"></property>
|
||||
<property name="name">m_OptDisplayPadClearence</property>
|
||||
|
@ -581,7 +581,7 @@
|
|||
<property name="font"></property>
|
||||
<property name="hidden">0</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="minimum_size"></property>
|
||||
<property name="name">m_OptDisplayPadNumber</property>
|
||||
|
@ -633,7 +633,7 @@
|
|||
<property name="font"></property>
|
||||
<property name="hidden">0</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="minimum_size"></property>
|
||||
<property name="name">m_OptDisplayPadNoConn</property>
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
/** pcbcfg.h : configuration: definition des structures **/
|
||||
/**********************************************************/
|
||||
|
||||
#include "param_config.h"
|
||||
|
||||
#define GROUP wxT( "/pcbnew" )
|
||||
#define GROUPLIB wxT( "/pcbnew/libraries" )
|
||||
#define GROUPCOMMON wxT( "/common" )
|
||||
|
|
|
@ -211,7 +211,6 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
|
|||
wxConfig* config = wxGetApp().m_EDA_Config;
|
||||
|
||||
m_FrameName = wxT( "PcbFrame" );
|
||||
//m_AboutTitle = g_PcbnewAboutTitle;
|
||||
m_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines
|
||||
m_Draw_Grid = g_ShowGrid; // TRUE pour avoir la grille dessinee
|
||||
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()
|
||||
/************************************/
|
||||
{
|
||||
extern PARAM_CFG_BASE* ParamCfgList[];
|
||||
wxGetApp().SaveCurrentSetupValues( ParamCfgList );
|
||||
|
||||
SetBaseScreen( ScreenPcb );
|
||||
|
||||
delete m_drc;
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "eda_dde.h"
|
||||
|
||||
wxString g_Main_Title( wxT( "PCBnew" ) );
|
||||
extern PARAM_CFG_BASE* ParamCfgList[];
|
||||
|
||||
IMPLEMENT_APP( WinEDA_App )
|
||||
|
||||
|
@ -57,6 +58,7 @@ bool WinEDA_App::OnInit()
|
|||
}
|
||||
|
||||
Read_Config( FFileName );
|
||||
wxGetApp().ReadCurrentSetupValues( ParamCfgList );
|
||||
g_DrawBgColor = BLACK;
|
||||
Read_Hotkey_Config( frame, false ); /* Must be called before creating the
|
||||
* main frame in order to display the
|
||||
|
|
Loading…
Reference in New Issue