Commit ef498f88 authored by g_harland's avatar g_harland
Browse files

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

parent 19330ff0
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -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
+45 −50
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
	/*	 Fichier options.cpp 	*/

/*
 Affichage et modifications des parametres de travail Gerbview
 * Affichage et modifications des parametres de travail Gerbview
 */


@@ -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,23 +202,22 @@ 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 =
@@ -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 )
		DisplayOpt.DisplayPcbTrackFill = TRUE;
	else DisplayOpt.DisplayPcbTrackFill = FALSE;
	else
		DisplayOpt.DisplayPcbTrackFill = FALSE;

	if ( m_OptDisplayFlashes->GetSelection() == 1 )
		 DisplayOpt.DisplayPadFill = TRUE;
	else DisplayOpt.DisplayPadFill = FALSE;
	else
		DisplayOpt.DisplayPadFill = FALSE;

	DisplayOpt.DisplayPadNum = m_OptDisplayDCodes->GetValue();

@@ -379,14 +374,14 @@ 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;

@@ -394,10 +389,10 @@ void WinEDA_GerberFrame::InstallPcbOptionsFrame(const wxPoint & pos, int id)
		{
			WinEDA_GerberGeneralOptionsFrame * OptionsFrame =
				new WinEDA_GerberGeneralOptionsFrame(this, pos);
			OptionsFrame->ShowModal(); OptionsFrame->Destroy();
			OptionsFrame->ShowModal();
			OptionsFrame->Destroy();
		}
			break;
	}
}
+35 −25
Original line number Diff line number Diff line
@@ -5,8 +5,8 @@
	/*	 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...
 */


@@ -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()


@@ -76,7 +75,8 @@ END_EVENT_TABLE()
void WinEDA_GerberFrame::InstallConfigFrame(const wxPoint & 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,
		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;
@@ -107,16 +107,23 @@ wxString title;
	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);

    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();
}