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