2010-10-06 17:28:07 +00:00
|
|
|
/*****************************/
|
|
|
|
/* dialog_gerber_config.cpp */
|
|
|
|
/****************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
/*
|
2007-11-02 09:58:42 +00:00
|
|
|
* Options for file extensions
|
2007-09-25 06:15:54 +00:00
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
#include "fctsys.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "appl_wxstruct.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "common.h"
|
|
|
|
#include "gerbview.h"
|
2010-11-18 21:16:28 +00:00
|
|
|
#include "dialog_helpers.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2009-11-09 14:00:22 +00:00
|
|
|
enum
|
|
|
|
{
|
2007-11-02 09:58:42 +00:00
|
|
|
ID_SAVE_CFG = 1000
|
|
|
|
};
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2007-11-02 09:58:42 +00:00
|
|
|
class WinEDA_ConfigFrame : public wxDialog
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
|
|
|
private:
|
|
|
|
|
2007-11-02 09:58:42 +00:00
|
|
|
WinEDA_GerberFrame* m_Parent;
|
|
|
|
wxListBox* ListLibr;
|
|
|
|
int LibModified;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-11-02 09:58:42 +00:00
|
|
|
WinEDA_EnterText* TextDrillExt;
|
|
|
|
WinEDA_EnterText* TextPhotoExt;
|
|
|
|
WinEDA_EnterText* TextPenExt;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
public:
|
2007-11-02 09:58:42 +00:00
|
|
|
WinEDA_ConfigFrame( WinEDA_GerberFrame* parent, const wxPoint& pos );
|
|
|
|
~WinEDA_ConfigFrame() { };
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
private:
|
2007-11-02 09:58:42 +00:00
|
|
|
void SaveCfg( wxCommandEvent& event );
|
|
|
|
void OnOkClick( wxCommandEvent& event );
|
|
|
|
void OnCancelClick( wxCommandEvent& event );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-11-02 09:58:42 +00:00
|
|
|
DECLARE_EVENT_TABLE()
|
2007-06-05 12:10:51 +00:00
|
|
|
};
|
2009-11-09 14:00:22 +00:00
|
|
|
|
|
|
|
|
2007-11-02 09:58:42 +00:00
|
|
|
BEGIN_EVENT_TABLE( WinEDA_ConfigFrame, wxDialog )
|
2008-12-08 15:27:13 +00:00
|
|
|
EVT_BUTTON( ID_SAVE_CFG, WinEDA_ConfigFrame::SaveCfg )
|
|
|
|
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()
|
|
|
|
|
|
|
|
|
2010-11-12 16:36:43 +00:00
|
|
|
/**
|
|
|
|
* Function InstallConfigFrame
|
2009-11-09 14:00:22 +00:00
|
|
|
* install the dialog box to configure some gerbview options
|
|
|
|
* mainly the default file extensions
|
2007-11-02 09:58:42 +00:00
|
|
|
*/
|
2009-11-09 14:00:22 +00:00
|
|
|
void WinEDA_GerberFrame::InstallConfigFrame( const wxPoint& pos )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-11-02 09:58:42 +00:00
|
|
|
WinEDA_ConfigFrame* CfgFrame = new WinEDA_ConfigFrame( this, pos );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-11-02 09:58:42 +00:00
|
|
|
CfgFrame->ShowModal();
|
|
|
|
CfgFrame->Destroy();
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2007-11-02 09:58:42 +00:00
|
|
|
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-06-05 12:10:51 +00:00
|
|
|
{
|
2007-11-02 09:58:42 +00:00
|
|
|
const int LEN_EXT = 100;
|
|
|
|
wxString title;
|
|
|
|
|
|
|
|
m_Parent = parent;
|
|
|
|
|
2009-11-09 14:00:22 +00:00
|
|
|
/* Shows the config filename currently used : */
|
2008-12-08 15:27:13 +00:00
|
|
|
title = _( "from " ) + wxGetApp().m_CurrentOptionFile;
|
2007-11-02 09:58:42 +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 );
|
|
|
|
|
|
|
|
/* Created the buttons */
|
|
|
|
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" ) );
|
|
|
|
RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
|
|
|
|
|
|
|
|
Button = new wxButton( this, wxID_CANCEL, _( "Cancel" ) );
|
|
|
|
RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
|
|
|
|
|
|
|
|
wxSize size;
|
|
|
|
size.x = LEN_EXT;
|
|
|
|
size.y = -1;
|
|
|
|
TextDrillExt = new WinEDA_EnterText( this,
|
2008-12-08 15:27:13 +00:00
|
|
|
_( "Drill File Ext:" ),
|
|
|
|
g_DrillFilenameExt,
|
2007-11-02 09:58:42 +00:00
|
|
|
LeftBoxSizer, size );
|
|
|
|
|
|
|
|
TextPhotoExt = new WinEDA_EnterText( this,
|
2008-12-08 15:27:13 +00:00
|
|
|
_( "Gerber File Ext:" ),
|
|
|
|
g_PhotoFilenameExt,
|
2007-11-02 09:58:42 +00:00
|
|
|
LeftBoxSizer, size );
|
|
|
|
|
|
|
|
TextPenExt = new WinEDA_EnterText( this,
|
2008-12-08 15:27:13 +00:00
|
|
|
_( "D code File Ext:" ),
|
|
|
|
g_PenFilenameExt,
|
2007-11-02 09:58:42 +00:00
|
|
|
LeftBoxSizer, size );
|
|
|
|
|
|
|
|
GetSizer()->Fit( this );
|
|
|
|
GetSizer()->SetSizeHints( this );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-12-18 18:47:58 +00:00
|
|
|
void WinEDA_ConfigFrame::OnOkClick( wxCommandEvent &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();
|
2007-11-02 09:58:42 +00:00
|
|
|
g_PenFilenameExt = TextPenExt->GetValue();
|
2007-09-25 06:15:54 +00:00
|
|
|
|
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
|
|
|
|
2010-12-18 18:47:58 +00:00
|
|
|
void WinEDA_ConfigFrame::OnCancelClick( wxCommandEvent &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
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-02 09:58:42 +00:00
|
|
|
void WinEDA_ConfigFrame::SaveCfg( wxCommandEvent& event )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-11-02 09:58:42 +00:00
|
|
|
m_Parent->Update_config();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|