2007-06-05 12:10:51 +00:00
|
|
|
/******************************************/
|
|
|
|
/** cfg.cpp : configuration pour Gerbview */
|
|
|
|
/******************************************/
|
|
|
|
|
|
|
|
/* lit ou met a jour la configuration de PCBNEW */
|
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
#include "gerbview.h"
|
|
|
|
#include "pcbplot.h"
|
|
|
|
#include "cfg.h"
|
|
|
|
#include "id.h"
|
2007-09-10 04:51:01 +00:00
|
|
|
#include "hotkeys_basic.h"
|
|
|
|
#include "hotkeys.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#include "protos.h"
|
|
|
|
|
2007-09-10 04:51:01 +00:00
|
|
|
/* Local functions */
|
|
|
|
static bool Read_Hotkey_Config( WinEDA_DrawFrame * frame, bool verbose );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
/* Variables locales */
|
|
|
|
|
2007-09-10 04:51:01 +00:00
|
|
|
#define HOTKEY_FILENAME wxT("gerbview")
|
|
|
|
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/*************************************************************/
|
|
|
|
void WinEDA_GerberFrame::Process_Config(wxCommandEvent& event)
|
|
|
|
/*************************************************************/
|
|
|
|
{
|
|
|
|
int id = event.GetId();
|
|
|
|
wxPoint pos;
|
2007-09-10 04:51:01 +00:00
|
|
|
wxString FullFileName;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
pos = GetPosition();
|
|
|
|
pos.x += 20; pos.y += 20;
|
|
|
|
|
|
|
|
switch( id )
|
|
|
|
{
|
|
|
|
case ID_COLORS_SETUP :
|
|
|
|
DisplayColorSetupFrame(this, pos);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_CONFIG_REQ : // Creation de la fenetre de configuration
|
|
|
|
{
|
|
|
|
InstallConfigFrame(pos);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case ID_PCB_TRACK_SIZE_SETUP:
|
|
|
|
case ID_PCB_LOOK_SETUP:
|
|
|
|
case ID_OPTIONS_SETUP:
|
|
|
|
InstallPcbOptionsFrame(pos, id);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_CONFIG_SAVE:
|
|
|
|
Update_config();
|
|
|
|
break;
|
|
|
|
|
2007-09-10 04:51:01 +00:00
|
|
|
case ID_PREFERENCES_CREATE_CONFIG_HOTKEYS:
|
|
|
|
FullFileName = DEFAULT_HOTKEY_FILENAME_PATH;
|
|
|
|
FullFileName += HOTKEY_FILENAME;
|
|
|
|
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
|
|
|
|
WriteHotkeyConfigFile(FullFileName, s_Gerbview_Hokeys_Descr, true);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_PREFERENCES_READ_CONFIG_HOTKEYS:
|
|
|
|
Read_Hotkey_Config( this, true);
|
|
|
|
break;
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
default:
|
|
|
|
DisplayError(this, wxT("WinEDA_GerberFrame::Process_Config internal error"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************/
|
2007-09-13 11:55:46 +00:00
|
|
|
bool Read_Config()
|
2007-06-05 12:10:51 +00:00
|
|
|
/*****************************************************/
|
|
|
|
/* lit la configuration, si elle n'a pas deja etee lue
|
|
|
|
1 - lit gerbview.cnf
|
|
|
|
2 - si non trouve lit <chemin de gerbview.exe>/gerbview.cnf
|
|
|
|
3 - si non trouve: init des variables aux valeurs par defaut
|
|
|
|
|
|
|
|
Retourne un pointeur su le message d'erreur a afficher
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
g_Prj_Config_Filename_ext = wxT(".cnf");
|
|
|
|
EDA_Appl->ReadProjectConfig( wxT("gerbview"), GROUP, ParamCfgList, FALSE);
|
|
|
|
|
|
|
|
/* Inits autres variables */
|
|
|
|
if (ScreenPcb) ScreenPcb->SetGrid(TmpGrid);
|
|
|
|
if ( g_PhotoFilenameExt.IsEmpty() ) g_PhotoFilenameExt = wxT(".pho");
|
|
|
|
if ( g_DrillFilenameExt.IsEmpty() ) g_DrillFilenameExt = wxT(".drl");
|
|
|
|
if ( g_PenFilenameExt.IsEmpty() ) g_PenFilenameExt = wxT(".pen");
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************/
|
2007-09-13 11:55:46 +00:00
|
|
|
void WinEDA_GerberFrame::Update_config()
|
2007-06-05 12:10:51 +00:00
|
|
|
/******************************************/
|
|
|
|
/*
|
|
|
|
creation du fichier de config
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
wxString FullFileName;
|
|
|
|
wxString mask( wxT("*") ),
|
|
|
|
|
|
|
|
g_Prj_Config_Filename_ext = wxT(".cnf";)
|
|
|
|
mask += g_Prj_Config_Filename_ext;
|
|
|
|
FullFileName = wxT("gerbview");
|
|
|
|
ChangeFileNameExt( FullFileName, g_Prj_Config_Filename_ext );
|
|
|
|
|
|
|
|
FullFileName = EDA_FileSelector(_("Save config file"),
|
|
|
|
wxEmptyString, /* Chemin par defaut */
|
|
|
|
FullFileName, /* nom fichier par defaut */
|
|
|
|
g_Prj_Config_Filename_ext, /* extension par defaut */
|
|
|
|
mask, /* Masque d'affichage */
|
|
|
|
this,
|
|
|
|
wxFD_SAVE,
|
|
|
|
TRUE
|
|
|
|
);
|
|
|
|
if ( FullFileName.IsEmpty() ) return;
|
|
|
|
|
|
|
|
/* ecriture de la configuration */
|
|
|
|
EDA_Appl->WriteProjectConfig(FullFileName, GROUP, ParamCfgList);
|
|
|
|
}
|
|
|
|
|
2007-09-10 04:51:01 +00:00
|
|
|
|
|
|
|
/***************************************************************/
|
|
|
|
bool Read_Hotkey_Config( WinEDA_DrawFrame * frame, bool verbose )
|
|
|
|
/***************************************************************/
|
|
|
|
/*
|
|
|
|
* Read the hotkey files config for pcbnew and module_edit
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
wxString FullFileName = DEFAULT_HOTKEY_FILENAME_PATH;
|
|
|
|
FullFileName += HOTKEY_FILENAME;
|
|
|
|
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
|
|
|
|
return frame->ReadHotkeyConfigFile(FullFileName, s_Gerbview_Hokeys_Descr, verbose);
|
|
|
|
}
|
|
|
|
|
|
|
|
|