2007-06-05 12:10:51 +00:00
|
|
|
/********************************************/
|
|
|
|
/* PCBNEW - Gestion des Options et Reglages */
|
|
|
|
/********************************************/
|
|
|
|
|
|
|
|
/* Fichier reglage.cpp */
|
|
|
|
|
|
|
|
/*
|
2007-09-25 06:15:54 +00:00
|
|
|
* Affichage et modifications des parametres de travail de PcbNew
|
|
|
|
* Parametres = dimensions des via, pistes, isolements, options...
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
#include "gerbview.h"
|
|
|
|
#include "pcbplot.h"
|
|
|
|
|
|
|
|
#include "protos.h"
|
|
|
|
|
|
|
|
/* Fonctions locales */
|
|
|
|
|
|
|
|
/* variables locales */
|
|
|
|
|
|
|
|
/***********/
|
|
|
|
|
|
|
|
enum {
|
2007-09-25 06:15:54 +00:00
|
|
|
ID_SAVE_CFG = 1000
|
2007-06-05 12:10:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Routines Locales */
|
|
|
|
|
|
|
|
/*************************************************/
|
|
|
|
/* classe derivee pour la frame de Configuration */
|
|
|
|
/*************************************************/
|
|
|
|
|
|
|
|
class WinEDA_ConfigFrame: public wxDialog
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
|
|
|
|
WinEDA_GerberFrame * m_Parent;
|
|
|
|
wxListBox * ListLibr;
|
|
|
|
int LibModified;
|
|
|
|
|
|
|
|
WinEDA_EnterText * TextDrillExt;
|
|
|
|
WinEDA_EnterText * TextPhotoExt;
|
|
|
|
WinEDA_EnterText * TextPenExt;
|
|
|
|
|
|
|
|
// Constructor and destructor
|
|
|
|
public:
|
|
|
|
WinEDA_ConfigFrame(WinEDA_GerberFrame *parent,const wxPoint& pos);
|
2007-09-13 11:55:46 +00:00
|
|
|
~WinEDA_ConfigFrame() {};
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
void SaveCfg(wxCommandEvent & event);
|
2007-09-25 06:15:54 +00:00
|
|
|
void OnOkClick(wxCommandEvent & event);
|
|
|
|
void OnCancelClick(wxCommandEvent & event);
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
|
|
|
|
};
|
|
|
|
/* Construction de la table des evenements pour WinEDA_ConfigFrame */
|
|
|
|
BEGIN_EVENT_TABLE(WinEDA_ConfigFrame, wxDialog)
|
|
|
|
EVT_BUTTON(ID_SAVE_CFG, WinEDA_ConfigFrame::SaveCfg)
|
2007-09-25 06:15:54 +00:00
|
|
|
EVT_BUTTON(wxID_OK, WinEDA_ConfigFrame::OnOkClick)
|
|
|
|
EVT_BUTTON(wxID_CANCEL, WinEDA_ConfigFrame::OnCancelClick)
|
2007-06-05 12:10:51 +00:00
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************/
|
|
|
|
/* void WinEDA_GerberFrame::InstallConfigFrame(const wxPoint & pos) */
|
|
|
|
/*****************************************************************/
|
|
|
|
|
|
|
|
void WinEDA_GerberFrame::InstallConfigFrame(const wxPoint & pos)
|
|
|
|
{
|
2007-09-25 06:15:54 +00:00
|
|
|
WinEDA_ConfigFrame * CfgFrame = new WinEDA_ConfigFrame(this, pos);
|
|
|
|
CfgFrame->ShowModal();
|
|
|
|
CfgFrame->Destroy();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/************************************************************/
|
|
|
|
/* Constructeur de WinEDA_ConfigFrame: la fenetre de config */
|
|
|
|
/************************************************************/
|
|
|
|
|
|
|
|
WinEDA_ConfigFrame::WinEDA_ConfigFrame(WinEDA_GerberFrame *parent,
|
|
|
|
const wxPoint& framepos):
|
|
|
|
wxDialog(parent, -1, wxEmptyString, framepos, wxSize(300, 180),
|
|
|
|
wxDEFAULT_DIALOG_STYLE|wxFRAME_FLOAT_ON_PARENT )
|
|
|
|
{
|
2007-09-25 06:15:54 +00:00
|
|
|
const int LEN_EXT = 100;
|
2007-06-05 12:10:51 +00:00
|
|
|
wxString title;
|
|
|
|
|
|
|
|
m_Parent = parent;
|
|
|
|
SetFont(* g_DialogFont);
|
|
|
|
|
2007-10-26 06:08:19 +00:00
|
|
|
title = _("from ") + g_EDA_Appl->m_CurrentOptionFile;
|
2007-06-05 12:10:51 +00:00
|
|
|
SetTitle(title);
|
|
|
|
|
|
|
|
LibModified = FALSE;
|
|
|
|
wxBoxSizer * MainBoxSizer = new wxBoxSizer(wxHORIZONTAL);
|
|
|
|
SetSizer(MainBoxSizer);
|
|
|
|
wxBoxSizer * RightBoxSizer = new wxBoxSizer(wxVERTICAL);
|
|
|
|
wxBoxSizer * LeftBoxSizer = new wxBoxSizer(wxVERTICAL);
|
|
|
|
MainBoxSizer->Add(LeftBoxSizer, 0, wxGROW|wxALL, 5);
|
|
|
|
MainBoxSizer->Add(RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
2007-09-25 06:15:54 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/* Creation des boutons de commande */
|
2007-09-25 06:15:54 +00:00
|
|
|
wxButton * Button = new wxButton(this, ID_SAVE_CFG, _("Save Cfg..."));
|
|
|
|
RightBoxSizer->Add(Button, 0, wxGROW|wxALL, 5);
|
|
|
|
|
|
|
|
// Provide a spacer to improve appearance of dialog box
|
|
|
|
RightBoxSizer->AddSpacer(20);
|
|
|
|
|
|
|
|
Button = new wxButton(this, wxID_OK, _("OK"));
|
2007-06-05 12:10:51 +00:00
|
|
|
Button->SetForegroundColour(*wxRED);
|
|
|
|
RightBoxSizer->Add(Button, 0, wxGROW|wxALL, 5);
|
|
|
|
|
2007-09-25 06:15:54 +00:00
|
|
|
Button = new wxButton(this, wxID_CANCEL, _("Cancel"));
|
2007-06-05 12:10:51 +00:00
|
|
|
Button->SetForegroundColour(*wxBLUE);
|
|
|
|
RightBoxSizer->Add(Button, 0, wxGROW|wxALL, 5);
|
|
|
|
|
|
|
|
wxSize size;
|
2007-09-25 06:15:54 +00:00
|
|
|
size.x = LEN_EXT;
|
|
|
|
size.y = -1;
|
2007-06-05 12:10:51 +00:00
|
|
|
TextDrillExt = new WinEDA_EnterText(this,
|
|
|
|
_("Drill File Ext:"), g_DrillFilenameExt,
|
|
|
|
LeftBoxSizer, size);
|
|
|
|
|
|
|
|
TextPhotoExt = new WinEDA_EnterText(this,
|
|
|
|
_("Gerber File Ext:"), g_PhotoFilenameExt,
|
|
|
|
LeftBoxSizer, size);
|
|
|
|
|
|
|
|
TextPenExt = new WinEDA_EnterText(this,
|
2007-09-14 10:07:38 +00:00
|
|
|
_("D code File Ext:"), g_PenFilenameExt,
|
2007-06-05 12:10:51 +00:00
|
|
|
LeftBoxSizer, size);
|
|
|
|
|
|
|
|
GetSizer()->Fit(this);
|
|
|
|
GetSizer()->SetSizeHints(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************/
|
|
|
|
/* Fonctions de base de WinEDA_ConfigFrame: la fenetre de config */
|
|
|
|
/*****************************************************************/
|
|
|
|
|
2007-09-25 06:15:54 +00:00
|
|
|
|
|
|
|
/******************************************************************/
|
|
|
|
void WinEDA_ConfigFrame::OnOkClick(wxCommandEvent& WXUNUSED(event))
|
|
|
|
/******************************************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-09-25 06:15:54 +00:00
|
|
|
g_DrillFilenameExt = TextDrillExt->GetValue();
|
|
|
|
g_PhotoFilenameExt = TextPhotoExt->GetValue();
|
|
|
|
g_PenFilenameExt = TextPenExt->GetValue();
|
|
|
|
|
2007-10-07 03:08:24 +00:00
|
|
|
EndModal( 1 );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-09-25 06:15:54 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/******************************************************************/
|
2007-09-25 06:15:54 +00:00
|
|
|
void WinEDA_ConfigFrame::OnCancelClick(wxCommandEvent& WXUNUSED(event))
|
2007-06-05 12:10:51 +00:00
|
|
|
/******************************************************************/
|
|
|
|
{
|
2007-10-07 03:08:24 +00:00
|
|
|
EndModal( -1 );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************/
|
|
|
|
void WinEDA_ConfigFrame::SaveCfg(wxCommandEvent& event)
|
|
|
|
/******************************************************/
|
|
|
|
{
|
|
|
|
m_Parent->Update_config();
|
|
|
|
}
|