Commit 8eff8df9 authored by dickelbeck's avatar dickelbeck

beautify

parent ce04867e
...@@ -277,7 +277,7 @@ wxString ReturnPcbLayerName( int layer_number, bool omitSpacePadding ) ...@@ -277,7 +277,7 @@ wxString ReturnPcbLayerName( int layer_number, bool omitSpacePadding )
*/ */
{ {
#if 0 && defined(DEBUG) #if 1 && defined(DEBUG)
// Dick: this code is working fine, but we have no place to store the layer names yet. // Dick: this code is working fine, but we have no place to store the layer names yet.
...@@ -293,12 +293,12 @@ wxString ReturnPcbLayerName( int layer_number, bool omitSpacePadding ) ...@@ -293,12 +293,12 @@ wxString ReturnPcbLayerName( int layer_number, bool omitSpacePadding )
#if 1 // my specific layer names #if 1 // my specific layer names
static const wxString layer_name_list[] = { static const wxString layer_name_list[] = {
_( "H2 Bottom" ), _( "Power" ), _( "V2 Signal" ), _( "H1 Signal" ), _( "H2 Bottom" ), _( "Power" ), _( "V2 Signal" ), _( "H1 Signal" ),
_( "Ground" ), _( "Inner L5 " ), _( "Inner L6 " ), _( "Inner L7 " ), _( "Ground" ), _( "Inner L5" ), _( "Inner L6" ), _( "Inner L7" ),
_( "Inner L8 " ), _( "Inner L9 " ), _( "Inner L10" ), _( "Inner L11" ), _( "Inner L8" ), _( "Inner L9" ), _( "Inner L10" ), _( "Inner L11" ),
_( "Inner L12" ), _( "Inner L13" ), _( "Inner L14" ), _( "Component" ), _( "Inner L12" ), _( "Inner L13" ), _( "Inner L14" ), _( "Component" ),
_( "Adhes Cop" ), _( "Adhes Cmp" ), _( "SoldP Cop" ), _( "SoldP Cmp" ), _( "Adhes Cop" ), _( "Adhes Cmp" ), _( "SoldP Cop" ), _( "SoldP Cmp" ),
_( "SilkS Cop" ), _( "SilkS Cmp" ), _( "Mask Cop " ), _( "Mask Cmp " ), _( "SilkS Cop" ), _( "SilkS Cmp" ), _( "Mask Cop" ), _( "Mask Cmp" ),
_( "Drawings " ), _( "Comments " ), _( "Eco1 " ), _( "Eco2 " ), _( "Drawings " ), _( "Comments" ), _( "Eco1" ), _( "Eco2" ),
_( "Edges Pcb" ), _( "BAD INDEX" ), _( "Edges Pcb" ), _( "BAD INDEX" ),
}; };
#else #else
......
...@@ -270,7 +270,8 @@ void WinEDA_App::GetSettings() ...@@ -270,7 +270,8 @@ void WinEDA_App::GetSettings()
wxString Line, Ident; wxString Line, Ident;
unsigned ii; unsigned ii;
m_HelpSize.x = 500; m_HelpSize.y = 400; m_HelpSize.x = 500;
m_HelpSize.y = 400;
if( m_EDA_CommonConfig ) if( m_EDA_CommonConfig )
{ {
...@@ -285,8 +286,11 @@ void WinEDA_App::GetSettings() ...@@ -285,8 +286,11 @@ void WinEDA_App::GetSettings()
for( ii = 0; ii < 10; ii++ ) for( ii = 0; ii < 10; ii++ )
{ {
Ident = wxT( "LastProject" ); if( ii ) Ident = wxT( "LastProject" );
if( ii )
Ident << ii; Ident << ii;
if( m_EDA_Config->Read( Ident, &Line ) ) if( m_EDA_Config->Read( Ident, &Line ) )
m_LastProject.Add( Line ); m_LastProject.Add( Line );
} }
...@@ -299,6 +303,7 @@ void WinEDA_App::GetSettings() ...@@ -299,6 +303,7 @@ void WinEDA_App::GetSettings()
Line = m_EDA_Config->Read( wxT( "SdtFontType" ), wxEmptyString ); Line = m_EDA_Config->Read( wxT( "SdtFontType" ), wxEmptyString );
if( !Line.IsEmpty() ) if( !Line.IsEmpty() )
g_StdFont->SetFaceName( Line ); g_StdFont->SetFaceName( Line );
ii = m_EDA_Config->Read( wxT( "SdtFontStyle" ), wxFONTFAMILY_ROMAN ); ii = m_EDA_Config->Read( wxT( "SdtFontStyle" ), wxFONTFAMILY_ROMAN );
g_StdFont->SetStyle( ii ); g_StdFont->SetStyle( ii );
ii = m_EDA_Config->Read( wxT( "SdtFontWeight" ), wxNORMAL ); ii = m_EDA_Config->Read( wxT( "SdtFontWeight" ), wxNORMAL );
...@@ -309,6 +314,7 @@ void WinEDA_App::GetSettings() ...@@ -309,6 +314,7 @@ void WinEDA_App::GetSettings()
Line = m_EDA_Config->Read( wxT( "MsgFontType" ), wxEmptyString ); Line = m_EDA_Config->Read( wxT( "MsgFontType" ), wxEmptyString );
if( !Line.IsEmpty() ) if( !Line.IsEmpty() )
g_MsgFont->SetFaceName( Line ); g_MsgFont->SetFaceName( Line );
ii = m_EDA_Config->Read( wxT( "MsgFontStyle" ), wxFONTFAMILY_ROMAN ); ii = m_EDA_Config->Read( wxT( "MsgFontStyle" ), wxFONTFAMILY_ROMAN );
g_MsgFont->SetStyle( ii ); g_MsgFont->SetStyle( ii );
ii = m_EDA_Config->Read( wxT( "MsgFontWeight" ), wxNORMAL ); ii = m_EDA_Config->Read( wxT( "MsgFontWeight" ), wxNORMAL );
...@@ -318,6 +324,7 @@ void WinEDA_App::GetSettings() ...@@ -318,6 +324,7 @@ void WinEDA_App::GetSettings()
Line = m_EDA_Config->Read( wxT( "DialogFontType" ), wxEmptyString ); Line = m_EDA_Config->Read( wxT( "DialogFontType" ), wxEmptyString );
if( !Line.IsEmpty() ) if( !Line.IsEmpty() )
g_DialogFont->SetFaceName( Line ); g_DialogFont->SetFaceName( Line );
ii = m_EDA_Config->Read( wxT( "DialogFontStyle" ), wxFONTFAMILY_ROMAN ); ii = m_EDA_Config->Read( wxT( "DialogFontStyle" ), wxFONTFAMILY_ROMAN );
g_DialogFont->SetStyle( ii ); g_DialogFont->SetStyle( ii );
ii = m_EDA_Config->Read( wxT( "DialogFontWeight" ), wxNORMAL ); ii = m_EDA_Config->Read( wxT( "DialogFontWeight" ), wxNORMAL );
...@@ -343,7 +350,6 @@ void WinEDA_App::SaveSettings() ...@@ -343,7 +350,6 @@ void WinEDA_App::SaveSettings()
{ {
unsigned int ii; unsigned int ii;
if( m_EDA_Config == NULL ) if( m_EDA_Config == NULL )
return; return;
......
This diff is collapsed.
/***********************************/ /***********************************/
/** pcbcfg() : configuration **/ /** pcbcfg() : configuration **/
/***********************************/ /***********************************/
/* lit ou met a jour la configuration de PCBNEW */ /* lit ou met a jour la configuration de PCBNEW */
...@@ -21,52 +21,55 @@ ...@@ -21,52 +21,55 @@
/* Variables locales */ /* Variables locales */
#define HOTKEY_FILENAME wxT("pcbnew") #define HOTKEY_FILENAME wxT( "pcbnew" )
/***********************************************************/ /***********************************************************/
void WinEDA_PcbFrame::Process_Config(wxCommandEvent& event) void WinEDA_PcbFrame::Process_Config( wxCommandEvent& event )
/***********************************************************/ /***********************************************************/
{ {
int id = event.GetId(); int id = event.GetId();
wxPoint pos; wxPoint pos;
wxClientDC dc(DrawPanel);
wxString FullFileName;
DrawPanel->PrepareGraphicContext(&dc); wxClientDC dc( DrawPanel );
wxString FullFileName;
DrawPanel->PrepareGraphicContext( &dc );
pos = GetPosition(); pos = GetPosition();
pos.x += 20; pos.y += 20; pos.x += 20;
pos.y += 20;
switch( id ) switch( id )
{ {
case ID_COLORS_SETUP : case ID_COLORS_SETUP:
DisplayColorSetupFrame(this, pos); DisplayColorSetupFrame( this, pos );
break; break;
case ID_CONFIG_REQ : // Creation de la fenetre de configuration case ID_CONFIG_REQ: // Creation de la fenetre de configuration
InstallConfigFrame(pos); InstallConfigFrame( pos );
break; break;
case ID_PCB_TRACK_SIZE_SETUP: case ID_PCB_TRACK_SIZE_SETUP:
case ID_PCB_LOOK_SETUP: case ID_PCB_LOOK_SETUP:
case ID_OPTIONS_SETUP: case ID_OPTIONS_SETUP:
case ID_PCB_DRAWINGS_WIDTHS_SETUP: case ID_PCB_DRAWINGS_WIDTHS_SETUP:
InstallPcbOptionsFrame(pos, &dc, id); InstallPcbOptionsFrame( pos, &dc, id );
break; break;
case ID_PCB_PAD_SETUP: case ID_PCB_PAD_SETUP:
InstallPadOptionsFrame( NULL, NULL, pos); InstallPadOptionsFrame( NULL, NULL, pos );
break; break;
case ID_CONFIG_SAVE: case ID_CONFIG_SAVE:
Update_config(this); Update_config( this );
break; break;
case ID_CONFIG_READ: case ID_CONFIG_READ:
FullFileName = GetScreen()->m_FileName.AfterLast('/'); FullFileName = GetScreen()->m_FileName.AfterLast( '/' );
ChangeFileNameExt(FullFileName, g_Prj_Config_Filename_ext); ChangeFileNameExt( FullFileName, g_Prj_Config_Filename_ext );
FullFileName = EDA_FileSelector(_("Read config file"), FullFileName = EDA_FileSelector( _( "Read config file" ),
wxPathOnly(GetScreen()->m_FileName),/* Chemin par defaut */ wxPathOnly( GetScreen()->m_FileName ), /* Chemin par defaut */
FullFileName, /* nom fichier par defaut */ FullFileName, /* nom fichier par defaut */
g_Prj_Config_Filename_ext, /* extension par defaut */ g_Prj_Config_Filename_ext, /* extension par defaut */
FullFileName, /* Masque d'affichage */ FullFileName, /* Masque d'affichage */
...@@ -74,25 +77,26 @@ wxString FullFileName; ...@@ -74,25 +77,26 @@ wxString FullFileName;
wxFD_OPEN, wxFD_OPEN,
TRUE /* ne change pas de repertoire courant */ TRUE /* ne change pas de repertoire courant */
); );
if ( FullFileName.IsEmpty()) break; if( FullFileName.IsEmpty() )
if ( ! wxFileExists(FullFileName) ) break;
if( !wxFileExists( FullFileName ) )
{ {
wxString msg; wxString msg;
msg.Printf(_("File %s not found"), FullFileName.GetData()); msg.Printf( _( "File %s not found" ), FullFileName.GetData() );
DisplayError(this, msg); break; DisplayError( this, msg ); break;
} }
Read_Config(FullFileName ); Read_Config( FullFileName );
break; break;
case ID_PREFERENCES_CREATE_CONFIG_HOTKEYS: case ID_PREFERENCES_CREATE_CONFIG_HOTKEYS:
FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice ); FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice );
FullFileName += HOTKEY_FILENAME; FullFileName += HOTKEY_FILENAME;
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT; FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
WriteHotkeyConfigFile(FullFileName, s_Pcbnew_Editor_Hokeys_Descr, true); WriteHotkeyConfigFile( FullFileName, s_Pcbnew_Editor_Hokeys_Descr, true );
break; break;
case ID_PREFERENCES_READ_CONFIG_HOTKEYS: case ID_PREFERENCES_READ_CONFIG_HOTKEYS:
Read_Hotkey_Config( this, true); Read_Hotkey_Config( this, true );
break; break;
case ID_PREFERENCES_EDIT_CONFIG_HOTKEYS: case ID_PREFERENCES_EDIT_CONFIG_HOTKEYS:
...@@ -101,8 +105,8 @@ wxString FullFileName; ...@@ -101,8 +105,8 @@ wxString FullFileName;
FullFileName += HOTKEY_FILENAME; FullFileName += HOTKEY_FILENAME;
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT; FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
wxString editorname = GetEditorName(); wxString editorname = GetEditorName();
if ( !editorname.IsEmpty() ) if( !editorname.IsEmpty() )
ExecuteFile(this, editorname, FullFileName); ExecuteFile( this, editorname, FullFileName );
break; break;
} }
...@@ -116,54 +120,57 @@ wxString FullFileName; ...@@ -116,54 +120,57 @@ wxString FullFileName;
break; break;
default: default:
DisplayError(this, wxT("WinEDA_PcbFrame::Process_Config internal error")); DisplayError( this, wxT( "WinEDA_PcbFrame::Process_Config internal error" ) );
} }
} }
/***************************************************************/ /***************************************************************/
bool Read_Hotkey_Config( WinEDA_DrawFrame * frame, bool verbose ) bool Read_Hotkey_Config( WinEDA_DrawFrame* frame, bool verbose )
/***************************************************************/ /***************************************************************/
/* /*
* Read the hotkey files config for pcbnew and module_edit * Read the hotkey files config for pcbnew and module_edit
*/ */
{ {
wxString FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice ); wxString FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice );
FullFileName += HOTKEY_FILENAME; FullFileName += HOTKEY_FILENAME;
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT; FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
return frame->ReadHotkeyConfigFile(FullFileName, s_Pcbnew_Editor_Hokeys_Descr, verbose); return frame->ReadHotkeyConfigFile( FullFileName, s_Pcbnew_Editor_Hokeys_Descr, verbose );
} }
/**************************************************************************/ /**************************************************************************/
bool Read_Config(const wxString & project_name) bool Read_Config( const wxString& project_name )
/*************************************************************************/ /*************************************************************************/
/* lit la configuration, si elle n'a pas deja ete lue
1 - lit <nom fichier brd>.pro
2 - si non trouve lit <chemin de *.exe>/kicad.pro
3 - si non trouve: init des variables aux valeurs par defaut
Retourne TRUE si lu, FALSE si config non lue ou non modifie /* lit la configuration, si elle n'a pas deja ete lue
*/ * 1 - lit <nom fichier brd>.pro
* 2 - si non trouve lit <chemin de *.exe>/kicad.pro
* 3 - si non trouve: init des variables aux valeurs par defaut
*
* Retourne TRUE si lu, FALSE si config non lue ou non modifie
*/
{ {
wxString FullFileName; wxString FullFileName;
int ii; int ii;
g_Prj_Config_Filename_ext = wxT(".pro"); g_Prj_Config_Filename_ext = wxT( ".pro" );
FullFileName = project_name; FullFileName = project_name;
ChangeFileNameExt(FullFileName, g_Prj_Config_Filename_ext); ChangeFileNameExt( FullFileName, g_Prj_Config_Filename_ext );
/* Init des valeurs par defaut */ /* Init des valeurs par defaut */
g_LibName_List.Clear(); g_LibName_List.Clear();
g_EDA_Appl->ReadProjectConfig( FullFileName, g_EDA_Appl->ReadProjectConfig( FullFileName,
GROUP, ParamCfgList, FALSE); GROUP, ParamCfgList, FALSE );
/* Traitement des variables particulieres: */ /* Traitement des variables particulieres: */
SetRealLibraryPath( wxT("modules") ); SetRealLibraryPath( wxT( "modules" ) );
if (ScreenPcb) if( ScreenPcb )
{ {
ScreenPcb->m_Diviseur_Grille = Pcbdiv_grille; ScreenPcb->m_Diviseur_Grille = Pcbdiv_grille;
ScreenPcb->m_UserGrid = g_UserGrid; ScreenPcb->m_UserGrid = g_UserGrid;
...@@ -172,7 +179,7 @@ int ii; ...@@ -172,7 +179,7 @@ int ii;
g_DesignSettings.m_TrackWidthHistory[0] = g_DesignSettings.m_CurrentTrackWidth; g_DesignSettings.m_TrackWidthHistory[0] = g_DesignSettings.m_CurrentTrackWidth;
g_DesignSettings.m_ViaSizeHistory[0] = g_DesignSettings.m_CurrentViaSize; g_DesignSettings.m_ViaSizeHistory[0] = g_DesignSettings.m_CurrentViaSize;
for ( ii = 1; ii < HISTORY_NUMBER; ii++) for( ii = 1; ii < HISTORY_NUMBER; ii++ )
{ {
g_DesignSettings.m_TrackWidthHistory[ii] = 0; g_DesignSettings.m_TrackWidthHistory[ii] = 0;
g_DesignSettings.m_ViaSizeHistory[ii] = 0; g_DesignSettings.m_ViaSizeHistory[ii] = 0;
...@@ -181,20 +188,21 @@ int ii; ...@@ -181,20 +188,21 @@ int ii;
return TRUE; return TRUE;
} }
/**********************************************************/ /**********************************************************/
void WinEDA_PcbFrame::Update_config(wxWindow * displayframe) void WinEDA_PcbFrame::Update_config( wxWindow* displayframe )
/***********************************************************/ /***********************************************************/
/* enregistrement de la config */ /* enregistrement de la config */
{ {
wxString FullFileName; wxString FullFileName;
wxString mask; wxString mask;
mask = wxT("*") + g_Prj_Config_Filename_ext; mask = wxT( "*" ) + g_Prj_Config_Filename_ext;
FullFileName = GetScreen()->m_FileName.AfterLast('/'); FullFileName = GetScreen()->m_FileName.AfterLast( '/' );
ChangeFileNameExt(FullFileName, g_Prj_Config_Filename_ext); ChangeFileNameExt( FullFileName, g_Prj_Config_Filename_ext );
FullFileName = EDA_FileSelector(_("Save preferences"), FullFileName = EDA_FileSelector( _( "Save preferences" ),
wxPathOnly(GetScreen()->m_FileName), /* Chemin par defaut */ wxPathOnly( GetScreen()->m_FileName ), /* Chemin par defaut */
FullFileName, /* nom fichier par defaut */ FullFileName, /* nom fichier par defaut */
g_Prj_Config_Filename_ext, /* extension par defaut */ g_Prj_Config_Filename_ext, /* extension par defaut */
mask, /* Masque d'affichage */ mask, /* Masque d'affichage */
...@@ -202,12 +210,11 @@ wxString mask; ...@@ -202,12 +210,11 @@ wxString mask;
wxFD_SAVE, wxFD_SAVE,
TRUE TRUE
); );
if ( FullFileName.IsEmpty() ) return; if( FullFileName.IsEmpty() )
return;
Pcbdiv_grille = GetScreen()->m_Diviseur_Grille; Pcbdiv_grille = GetScreen()->m_Diviseur_Grille;
/* ecriture de la configuration */ /* ecriture de la configuration */
g_EDA_Appl->WriteProjectConfig(FullFileName, wxT("/pcbnew"), ParamCfgList); g_EDA_Appl->WriteProjectConfig( FullFileName, wxT( "/pcbnew" ), ParamCfgList );
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment