Commit ef498f88 authored by g_harland's avatar g_harland

Enhance three dialog boxes for gerbview (as described in change_log.txt)

parent 19330ff0
......@@ -5,6 +5,17 @@ Please add newer entries at the top, list the date and your name with
email address.
2007-Sep-25 UPDATE Geoff Harland <gharlandau@yahoo.com.au>
================================================================================
+ gerbview
The "Exit" button previously provided within the dialog box invoked from the
"Preferences -> File ext" menu entry has now been replaced by "OK" and "Cancel"
buttons. Similarly, the "Accept" button previously provided within each of the
dialog boxes invoked from the "Preferences -> Options" and "Preferences -> Display"
menu entries has now been replaced by an "OK" button. And each of those three
dialog boxes can now (otherwise) be cancelled by pressing the "Esc" key.
2007-sept-22 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+ all
......
......@@ -5,8 +5,8 @@
/* Fichier options.cpp */
/*
Affichage et modifications des parametres de travail Gerbview
*/
* Affichage et modifications des parametres de travail Gerbview
*/
#include "fctsys.h"
......@@ -94,7 +94,6 @@ wxClientDC dc(DrawPanel);
DrawPanel->ReDraw(&dc, TRUE);
break;
default:
DisplayError(this, wxT("WinEDA_PcbFrame::OnSelectOptionToolbar error"));
break;
......@@ -104,11 +103,6 @@ wxClientDC dc(DrawPanel);
}
enum id_optpcb
{
ID_ACCEPT_OPT = 1000,
ID_CANCEL_OPT
};
/*************************************************/
/* classe derivee pour la frame de Configuration */
/*************************************************/
......@@ -123,24 +117,22 @@ private:
wxRadioBox * m_CursorShape;
wxRadioBox * m_GerberDefaultScale;
// Constructor and destructor
public:
WinEDA_GerberGeneralOptionsFrame(WinEDA_BasePcbFrame *parent,const wxPoint& pos);
~WinEDA_GerberGeneralOptionsFrame() {};
private:
void AcceptPcbOptions(wxCommandEvent& event);
void OnQuit(wxCommandEvent & event);
void OnOkClick(wxCommandEvent& event);
void OnCancelClick(wxCommandEvent & event);
DECLARE_EVENT_TABLE()
};
/* Construction de la table des evenements pour WinEDA_GerberGeneralOptionsFrame */
BEGIN_EVENT_TABLE(WinEDA_GerberGeneralOptionsFrame, wxDialog)
EVT_BUTTON(ID_ACCEPT_OPT, WinEDA_GerberGeneralOptionsFrame::AcceptPcbOptions)
EVT_BUTTON(ID_CANCEL_OPT, WinEDA_GerberGeneralOptionsFrame::OnQuit)
EVT_BUTTON(wxID_OK, WinEDA_GerberGeneralOptionsFrame::OnOkClick)
EVT_BUTTON(wxID_CANCEL, WinEDA_GerberGeneralOptionsFrame::OnCancelClick)
END_EVENT_TABLE()
......@@ -168,11 +160,11 @@ WinEDA_GerberGeneralOptionsFrame::WinEDA_GerberGeneralOptionsFrame(WinEDA_BasePc
MainBoxSizer->Add(MiddleBoxSizer, 0, wxGROW|wxALL, 5);
MainBoxSizer->Add(RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxButton * Button = new wxButton(this, ID_ACCEPT_OPT, _("Accept"));
wxButton * Button = new wxButton(this, wxID_OK, _("OK"));
Button->SetForegroundColour(*wxRED);
RightBoxSizer->Add(Button, 0, wxGROW|wxALL, 5);
Button = new wxButton(this, ID_CANCEL_OPT, _("Cancel"));
Button = new wxButton(this, wxID_CANCEL, _("Cancel"));
Button->SetForegroundColour(*wxBLUE);
RightBoxSizer->Add(Button, 0, wxGROW|wxALL, 5);
......@@ -210,28 +202,27 @@ wxString list_scales[2] = { _("format: 2.3"), _("format 3.4") };
m_GerberDefaultScale->SetSelection( (g_Default_GERBER_Format == 23) ? 0 : 1);
MiddleBoxSizer->Add(m_GerberDefaultScale, 0, wxGROW|wxALL, 5);
GetSizer()->Fit(this);
GetSizer()->SetSizeHints(this);
}
/************************************************************************/
void WinEDA_GerberGeneralOptionsFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
void WinEDA_GerberGeneralOptionsFrame::OnCancelClick(wxCommandEvent& WXUNUSED(event))
/************************************************************************/
{
// true is to force the frame to close
Close(true);
EndModal(0);
}
/*****************************************************************************/
void WinEDA_GerberGeneralOptionsFrame::AcceptPcbOptions(wxCommandEvent& event)
void WinEDA_GerberGeneralOptionsFrame::OnOkClick(wxCommandEvent& event)
/*****************************************************************************/
{
DisplayOpt.DisplayPolarCood =
(m_PolarDisplay->GetSelection() == 0) ? FALSE : TRUE;
g_UnitMetric = (m_BoxUnits->GetSelection() == 0) ? 0 : 1;
g_UnitMetric = (m_BoxUnits->GetSelection() == 0) ? 0 : 1;
g_CursorShape = m_CursorShape->GetSelection();
g_Default_GERBER_Format =
(m_GerberDefaultScale->GetSelection() == 0) ? 23 : 34;
......@@ -265,16 +256,16 @@ public:
WinEDA_LookFrame(WinEDA_BasePcbFrame *parent,const wxPoint& pos);
~WinEDA_LookFrame() {};
void AcceptPcbOptions(wxCommandEvent& event);
void OnQuit(wxCommandEvent & event);
void OnOkClick(wxCommandEvent& event);
void OnCancelClick(wxCommandEvent & event);
DECLARE_EVENT_TABLE()
};
/* Construction de la table des evenements pour WinEDA_LookFrame */
BEGIN_EVENT_TABLE(WinEDA_LookFrame, wxDialog)
EVT_BUTTON(ID_ACCEPT_OPT, WinEDA_LookFrame::AcceptPcbOptions)
EVT_BUTTON(ID_CANCEL_OPT, WinEDA_LookFrame::OnQuit)
EVT_BUTTON(wxID_OK, WinEDA_LookFrame::OnOkClick)
EVT_BUTTON(wxID_CANCEL, WinEDA_LookFrame::OnCancelClick)
END_EVENT_TABLE()
......@@ -298,11 +289,11 @@ WinEDA_LookFrame::WinEDA_LookFrame(WinEDA_BasePcbFrame *parent,
MainBoxSizer->Add(MiddleBoxSizer, 0, wxGROW|wxALL, 5);
MainBoxSizer->Add(RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxButton * Button = new wxButton(this, ID_ACCEPT_OPT, _("Accept"));
wxButton * Button = new wxButton(this, wxID_OK, _("OK"));
Button->SetForegroundColour(*wxRED);
RightBoxSizer->Add(Button, 0, wxGROW|wxALL, 5);
Button = new wxButton(this, ID_CANCEL_OPT, _("Cancel"));
Button = new wxButton(this, wxID_CANCEL, _("Cancel"));
Button->SetForegroundColour(*wxBLUE);
RightBoxSizer->Add(Button, 0, wxGROW|wxALL, 5);
......@@ -311,13 +302,15 @@ wxString list_opt2[2] = { _("Sketch"), _("Filled") };
m_OptDisplayLines = new wxRadioBox(this, -1, _("Lines:"),
wxDefaultPosition, wxDefaultSize,
2, list_opt2, 1);
if ( DisplayOpt.DisplayPcbTrackFill ) m_OptDisplayLines->SetSelection(1);
if ( DisplayOpt.DisplayPcbTrackFill )
m_OptDisplayLines->SetSelection(1);
LeftBoxSizer->Add(m_OptDisplayLines, 0, wxGROW|wxALL, 5);
m_OptDisplayFlashes = new wxRadioBox(this, -1, _("Spots:"),
wxDefaultPosition, wxDefaultSize,
2, list_opt2, 1);
if ( DisplayOpt.DisplayPadFill ) m_OptDisplayFlashes->SetSelection(1);
if ( DisplayOpt.DisplayPadFill )
m_OptDisplayFlashes->SetSelection(1);
LeftBoxSizer->Add(m_OptDisplayFlashes, 0, wxGROW|wxALL, 5);
wxString list_opt3[3] = { _("Sketch"), _("Filled"), _("Line") };
......@@ -328,7 +321,8 @@ wxString list_opt3[3] = { _("Sketch"), _("Filled"), _("Line") };
MiddleBoxSizer->Add(m_OptDisplayDrawings, 0, wxGROW|wxALL, 5);
m_OptDisplayDCodes = new wxCheckBox(this, -1, _("Show D codes"));
if ( DisplayOpt.DisplayPadNum ) m_OptDisplayDCodes->SetValue(TRUE);
if ( DisplayOpt.DisplayPadNum )
m_OptDisplayDCodes->SetValue(TRUE);
MiddleBoxSizer->Add(m_OptDisplayDCodes, 0, wxGROW|wxALL, 5);
GetSizer()->Fit(this);
......@@ -337,27 +331,28 @@ wxString list_opt3[3] = { _("Sketch"), _("Filled"), _("Line") };
/**************************************************************/
void WinEDA_LookFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
void WinEDA_LookFrame::OnCancelClick(wxCommandEvent& WXUNUSED(event))
/**************************************************************/
{
// true is to force the frame to close
Close(true);
EndModal(0);
}
/*************************************************************/
void WinEDA_LookFrame::AcceptPcbOptions(wxCommandEvent& event)
void WinEDA_LookFrame::OnOkClick(wxCommandEvent& event)
/*************************************************************/
/* Met a jour les options
*/
*/
{
if ( m_OptDisplayLines->GetSelection() == 1)
if ( m_OptDisplayLines->GetSelection() == 1 )
DisplayOpt.DisplayPcbTrackFill = TRUE;
else DisplayOpt.DisplayPcbTrackFill = FALSE;
else
DisplayOpt.DisplayPcbTrackFill = FALSE;
if (m_OptDisplayFlashes->GetSelection() == 1 )
if ( m_OptDisplayFlashes->GetSelection() == 1 )
DisplayOpt.DisplayPadFill = TRUE;
else DisplayOpt.DisplayPadFill = FALSE;
else
DisplayOpt.DisplayPadFill = FALSE;
DisplayOpt.DisplayPadNum = m_OptDisplayDCodes->GetValue();
......@@ -379,25 +374,25 @@ void WinEDA_LookFrame::AcceptPcbOptions(wxCommandEvent& event)
void WinEDA_GerberFrame::InstallPcbOptionsFrame(const wxPoint & pos, int id)
/***************************************************************************/
{
switch ( id )
{
{
case ID_PCB_LOOK_SETUP:
{
{
WinEDA_LookFrame * OptionsFrame =
new WinEDA_LookFrame(this, pos);
OptionsFrame->ShowModal(); OptionsFrame->Destroy();
}
OptionsFrame->ShowModal();
OptionsFrame->Destroy();
}
break;
case ID_OPTIONS_SETUP:
{
{
WinEDA_GerberGeneralOptionsFrame * OptionsFrame =
new WinEDA_GerberGeneralOptionsFrame(this, pos);
OptionsFrame->ShowModal(); OptionsFrame->Destroy();
}
break;
OptionsFrame->ShowModal();
OptionsFrame->Destroy();
}
break;
}
}
......@@ -5,9 +5,9 @@
/* Fichier reglage.cpp */
/*
Affichage et modifications des parametres de travail de PcbNew
Parametres = dimensions des via, pistes, isolements, options...
*/
* Affichage et modifications des parametres de travail de PcbNew
* Parametres = dimensions des via, pistes, isolements, options...
*/
#include "fctsys.h"
......@@ -25,8 +25,7 @@
/***********/
enum {
ID_SAVE_CFG = 1000,
ID_EXIT_CFG
ID_SAVE_CFG = 1000
};
/* Routines Locales */
......@@ -54,8 +53,8 @@ public:
private:
void SaveCfg(wxCommandEvent & event);
void OnQuit(wxCommandEvent & event);
void OnCloseWindow(wxCloseEvent & event);
void OnOkClick(wxCommandEvent & event);
void OnCancelClick(wxCommandEvent & event);
DECLARE_EVENT_TABLE()
......@@ -63,8 +62,8 @@ private:
/* Construction de la table des evenements pour WinEDA_ConfigFrame */
BEGIN_EVENT_TABLE(WinEDA_ConfigFrame, wxDialog)
EVT_BUTTON(ID_SAVE_CFG, WinEDA_ConfigFrame::SaveCfg)
EVT_BUTTON(ID_EXIT_CFG, WinEDA_ConfigFrame::OnQuit)
EVT_CLOSE(WinEDA_ConfigFrame::OnCloseWindow)
EVT_BUTTON(wxID_OK, WinEDA_ConfigFrame::OnOkClick)
EVT_BUTTON(wxID_CANCEL, WinEDA_ConfigFrame::OnCancelClick)
END_EVENT_TABLE()
......@@ -75,8 +74,9 @@ END_EVENT_TABLE()
void WinEDA_GerberFrame::InstallConfigFrame(const wxPoint & pos)
{
WinEDA_ConfigFrame * CfgFrame = new WinEDA_ConfigFrame(this, pos);
CfgFrame->ShowModal(); CfgFrame->Destroy();
WinEDA_ConfigFrame * CfgFrame = new WinEDA_ConfigFrame(this, pos);
CfgFrame->ShowModal();
CfgFrame->Destroy();
}
......@@ -89,7 +89,7 @@ WinEDA_ConfigFrame::WinEDA_ConfigFrame(WinEDA_GerberFrame *parent,
wxDialog(parent, -1, wxEmptyString, framepos, wxSize(300, 180),
wxDEFAULT_DIALOG_STYLE|wxFRAME_FLOAT_ON_PARENT )
{
#define LEN_EXT 100
const int LEN_EXT = 100;
wxString title;
m_Parent = parent;
......@@ -105,18 +105,25 @@ wxString title;
wxBoxSizer * LeftBoxSizer = new wxBoxSizer(wxVERTICAL);
MainBoxSizer->Add(LeftBoxSizer, 0, wxGROW|wxALL, 5);
MainBoxSizer->Add(RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
/* Creation des boutons de commande */
wxButton * Button = new wxButton(this, ID_SAVE_CFG, _("Save Cfg"));
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"));
Button->SetForegroundColour(*wxRED);
RightBoxSizer->Add(Button, 0, wxGROW|wxALL, 5);
Button = new wxButton(this, ID_EXIT_CFG, _("Exit"));
Button = new wxButton(this, wxID_CANCEL, _("Cancel"));
Button->SetForegroundColour(*wxBLUE);
RightBoxSizer->Add(Button, 0, wxGROW|wxALL, 5);
wxSize size;
size.x = LEN_EXT; size.y = -1;
size.x = LEN_EXT;
size.y = -1;
TextDrillExt = new WinEDA_EnterText(this,
_("Drill File Ext:"), g_DrillFilenameExt,
LeftBoxSizer, size);
......@@ -138,20 +145,24 @@ wxString title;
/* Fonctions de base de WinEDA_ConfigFrame: la fenetre de config */
/*****************************************************************/
void WinEDA_ConfigFrame::OnCloseWindow(wxCloseEvent & event)
/******************************************************************/
void WinEDA_ConfigFrame::OnOkClick(wxCommandEvent& WXUNUSED(event))
/******************************************************************/
{
g_DrillFilenameExt = TextDrillExt->GetValue();
g_PhotoFilenameExt = TextPhotoExt->GetValue();
g_PenFilenameExt = TextPenExt->GetValue();
EndModal(0);
g_DrillFilenameExt = TextDrillExt->GetValue();
g_PhotoFilenameExt = TextPhotoExt->GetValue();
g_PenFilenameExt = TextPenExt->GetValue();
EndModal(1);
}
/******************************************************************/
void WinEDA_ConfigFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
void WinEDA_ConfigFrame::OnCancelClick(wxCommandEvent& WXUNUSED(event))
/******************************************************************/
{
// true is to force the frame to close
Close(true);
EndModal(0);
}
......@@ -162,4 +173,3 @@ void WinEDA_ConfigFrame::SaveCfg(wxCommandEvent& event)
m_Parent->Update_config();
}
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