From 5f3cbff977ad67291a6a88980d53d6cf86e7cfa4 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 21 Dec 2018 10:11:50 +0100 Subject: [PATCH] Pcbnew, DIALOG_SET_GRID_BASE: A few cosmetic enhancements and fix a wxWidgets minor alert --- pcbnew/dialogs/dialog_set_grid_base.cpp | 133 +++--- pcbnew/dialogs/dialog_set_grid_base.fbp | 610 ++++-------------------- pcbnew/dialogs/dialog_set_grid_base.h | 25 +- 3 files changed, 173 insertions(+), 595 deletions(-) diff --git a/pcbnew/dialogs/dialog_set_grid_base.cpp b/pcbnew/dialogs/dialog_set_grid_base.cpp index ab2ad5d1b1..283402eac8 100644 --- a/pcbnew/dialogs/dialog_set_grid_base.cpp +++ b/pcbnew/dialogs/dialog_set_grid_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Dec 30 2017) +// C++ code generated with wxFormBuilder (version Dec 1 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -12,157 +12,160 @@ DIALOG_SET_GRID_BASE::DIALOG_SET_GRID_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) { this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - + wxBoxSizer* bSizerMain; bSizerMain = new wxBoxSizer( wxVERTICAL ); - + wxBoxSizer* bUpperSizer; bUpperSizer = new wxBoxSizer( wxHORIZONTAL ); - + wxStaticBoxSizer* sbLeftSizer; sbLeftSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Grid Origin") ), wxVERTICAL ); - + wxFlexGridSizer* fgSizerGridOrigin; fgSizerGridOrigin = new wxFlexGridSizer( 2, 3, 0, 0 ); fgSizerGridOrigin->AddGrowableCol( 1 ); fgSizerGridOrigin->SetFlexibleDirection( wxBOTH ); fgSizerGridOrigin->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - + m_staticTextGridPosX = new wxStaticText( sbLeftSizer->GetStaticBox(), wxID_ANY, _("X:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextGridPosX->Wrap( -1 ); fgSizerGridOrigin->Add( m_staticTextGridPosX, 0, wxALIGN_CENTER_VERTICAL, 5 ); - + m_GridOriginXCtrl = new wxTextCtrl( sbLeftSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); fgSizerGridOrigin->Add( m_GridOriginXCtrl, 0, wxEXPAND|wxLEFT, 5 ); - + m_TextPosXUnits = new wxStaticText( sbLeftSizer->GetStaticBox(), wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 ); m_TextPosXUnits->Wrap( -1 ); fgSizerGridOrigin->Add( m_TextPosXUnits, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT, 5 ); - + m_staticTextGridPosY = new wxStaticText( sbLeftSizer->GetStaticBox(), wxID_ANY, _("Y:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextGridPosY->Wrap( -1 ); fgSizerGridOrigin->Add( m_staticTextGridPosY, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5 ); - + m_GridOriginYCtrl = new wxTextCtrl( sbLeftSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); fgSizerGridOrigin->Add( m_GridOriginYCtrl, 0, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 ); - + m_TextPosYUnits = new wxStaticText( sbLeftSizer->GetStaticBox(), wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 ); m_TextPosYUnits->Wrap( -1 ); fgSizerGridOrigin->Add( m_TextPosYUnits, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT, 5 ); - - - sbLeftSizer->Add( fgSizerGridOrigin, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); - - - bUpperSizer->Add( sbLeftSizer, 0, wxEXPAND|wxALL, 5 ); - + + + sbLeftSizer->Add( fgSizerGridOrigin, 0, wxEXPAND|wxALL, 5 ); + + + bUpperSizer->Add( sbLeftSizer, 1, wxEXPAND|wxALL, 5 ); + wxStaticBoxSizer* sbUserGridSizer; sbUserGridSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("User Defined Grid") ), wxVERTICAL ); - + wxFlexGridSizer* fgSizer31; fgSizer31 = new wxFlexGridSizer( 2, 3, 0, 0 ); fgSizer31->AddGrowableCol( 1 ); fgSizer31->SetFlexibleDirection( wxBOTH ); fgSizer31->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - + m_staticTextSizeX = new wxStaticText( sbUserGridSizer->GetStaticBox(), wxID_ANY, _("Size X:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextSizeX->Wrap( -1 ); fgSizer31->Add( m_staticTextSizeX, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 ); - + m_OptGridSizeX = new wxTextCtrl( sbUserGridSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); fgSizer31->Add( m_OptGridSizeX, 0, wxEXPAND|wxBOTTOM|wxLEFT, 5 ); - + m_TextSizeXUnits = new wxStaticText( sbUserGridSizer->GetStaticBox(), wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 ); m_TextSizeXUnits->Wrap( -1 ); fgSizer31->Add( m_TextSizeXUnits, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 ); - + m_staticTextSizeY = new wxStaticText( sbUserGridSizer->GetStaticBox(), wxID_ANY, _("Size Y:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextSizeY->Wrap( -1 ); fgSizer31->Add( m_staticTextSizeY, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - + m_OptGridSizeY = new wxTextCtrl( sbUserGridSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); fgSizer31->Add( m_OptGridSizeY, 0, wxEXPAND|wxLEFT, 5 ); - + m_TextSizeYUnits = new wxStaticText( sbUserGridSizer->GetStaticBox(), wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 ); m_TextSizeYUnits->Wrap( -1 ); fgSizer31->Add( m_TextSizeYUnits, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - - sbUserGridSizer->Add( fgSizer31, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - - bUpperSizer->Add( sbUserGridSizer, 0, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 ); - - + + + sbUserGridSizer->Add( fgSizer31, 0, wxEXPAND|wxALL, 5 ); + + + bUpperSizer->Add( sbUserGridSizer, 1, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 ); + + bSizerMain->Add( bUpperSizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); - + wxStaticBoxSizer* sbFastSwitchSizer; sbFastSwitchSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Fast Switching") ), wxVERTICAL ); - + wxFlexGridSizer* fgSizer3; fgSizer3 = new wxFlexGridSizer( 2, 3, 0, 5 ); fgSizer3->AddGrowableCol( 1 ); fgSizer3->SetFlexibleDirection( wxBOTH ); fgSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - + m_staticTextGrid1 = new wxStaticText( sbFastSwitchSizer->GetStaticBox(), wxID_ANY, _("Grid 1:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextGrid1->Wrap( -1 ); fgSizer3->Add( m_staticTextGrid1, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_comboBoxGrid1 = new wxComboBox( sbFastSwitchSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY ); + + m_comboBoxGrid1 = new wxComboBox( sbFastSwitchSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY ); m_comboBoxGrid1->SetMinSize( wxSize( 240,-1 ) ); - + fgSizer3->Add( m_comboBoxGrid1, 0, wxEXPAND, 5 ); - + m_grid1HotKey = new wxStaticText( sbFastSwitchSizer->GetStaticBox(), wxID_ANY, _("(hotkey)"), wxDefaultPosition, wxDefaultSize, 0 ); m_grid1HotKey->Wrap( -1 ); fgSizer3->Add( m_grid1HotKey, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - + m_staticTextGrid2 = new wxStaticText( sbFastSwitchSizer->GetStaticBox(), wxID_ANY, _("Grid 2:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextGrid2->Wrap( -1 ); fgSizer3->Add( m_staticTextGrid2, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); - - m_comboBoxGrid2 = new wxComboBox( sbFastSwitchSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY ); + + m_comboBoxGrid2 = new wxComboBox( sbFastSwitchSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY ); m_comboBoxGrid2->SetMinSize( wxSize( 240,-1 ) ); - + fgSizer3->Add( m_comboBoxGrid2, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); - + m_grid2HotKey = new wxStaticText( sbFastSwitchSizer->GetStaticBox(), wxID_ANY, _("(hotkey)"), wxDefaultPosition, wxDefaultSize, 0 ); m_grid2HotKey->Wrap( -1 ); fgSizer3->Add( m_grid2HotKey, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - - sbFastSwitchSizer->Add( fgSizer3, 0, wxEXPAND|wxLEFT, 5 ); - - - bSizerMain->Add( sbFastSwitchSizer, 0, wxEXPAND|wxRIGHT|wxLEFT, 10 ); - + + + sbFastSwitchSizer->Add( fgSizer3, 0, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 ); + + + bSizerMain->Add( sbFastSwitchSizer, 0, wxEXPAND|wxALL, 10 ); + + m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizerMain->Add( m_staticline1, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + wxBoxSizer* bButtonSizer; bButtonSizer = new wxBoxSizer( wxHORIZONTAL ); - + m_buttonReset = new wxButton( this, wxID_ANY, _("Reset Grid Origin"), wxDefaultPosition, wxDefaultSize, 0 ); - bButtonSizer->Add( m_buttonReset, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); - - + bButtonSizer->Add( m_buttonReset, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + bButtonSizer->Add( 0, 0, 1, wxEXPAND, 5 ); - + m_sdbSizer = new wxStdDialogButtonSizer(); m_sdbSizerOK = new wxButton( this, wxID_OK ); m_sdbSizer->AddButton( m_sdbSizerOK ); m_sdbSizerCancel = new wxButton( this, wxID_CANCEL ); m_sdbSizer->AddButton( m_sdbSizerCancel ); m_sdbSizer->Realize(); - - bButtonSizer->Add( m_sdbSizer, 0, wxEXPAND|wxALL, 5 ); - - + + bButtonSizer->Add( m_sdbSizer, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizerMain->Add( bButtonSizer, 0, wxEXPAND|wxLEFT, 10 ); - - + + this->SetSizer( bSizerMain ); this->Layout(); bSizerMain->Fit( this ); - + // Connect Events this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_SET_GRID_BASE::OnInitDlg ) ); m_buttonReset->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SET_GRID_BASE::OnResetGridOrgClick ), NULL, this ); @@ -177,5 +180,5 @@ DIALOG_SET_GRID_BASE::~DIALOG_SET_GRID_BASE() m_buttonReset->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SET_GRID_BASE::OnResetGridOrgClick ), NULL, this ); m_sdbSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SET_GRID_BASE::OnCancelClick ), NULL, this ); m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SET_GRID_BASE::OnOkClick ), NULL, this ); - + } diff --git a/pcbnew/dialogs/dialog_set_grid_base.fbp b/pcbnew/dialogs/dialog_set_grid_base.fbp index 9154b0d7a8..dab3774fa5 100644 --- a/pcbnew/dialogs/dialog_set_grid_base.fbp +++ b/pcbnew/dialogs/dialog_set_grid_base.fbp @@ -1,6 +1,6 @@ - + C++ @@ -14,6 +14,7 @@ dialog_set_grid_base 1000 none + 1 dialog_set_grid @@ -45,49 +46,14 @@ DIALOG_SET_GRID_BASE -1,-1 - wxDEFAULT_DIALOG_STYLE + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER DIALOG_SHIM; dialog_shim.h Grid Settings - - - - - - - - - - - - - - - OnInitDlg - - - - - - - - - - - - - - - - - - - - bSizerMain @@ -105,8 +71,8 @@ 5 wxEXPAND|wxALL - 0 - + 1 + wxID_ANY Grid Origin @@ -114,10 +80,9 @@ wxVERTICAL 1 none - 5 - wxEXPAND|wxRIGHT|wxLEFT + wxEXPAND|wxALL 0 3 @@ -164,6 +129,7 @@ 0 wxID_ANY X: + 0 0 @@ -189,29 +155,6 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - @@ -276,33 +219,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -338,6 +254,7 @@ 0 wxID_ANY mm + 0 0 @@ -363,29 +280,6 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - @@ -421,6 +315,7 @@ 0 wxID_ANY Y: + 0 0 @@ -446,29 +341,6 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - @@ -533,33 +405,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -595,6 +440,7 @@ 0 wxID_ANY mm + 0 0 @@ -620,29 +466,6 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - @@ -652,8 +475,8 @@ 5 wxEXPAND|wxTOP|wxBOTTOM|wxLEFT - 0 - + 1 + wxID_ANY User Defined Grid @@ -661,10 +484,9 @@ wxVERTICAL 1 none - 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + wxEXPAND|wxALL 0 3 @@ -711,6 +533,7 @@ 0 wxID_ANY Size X: + 0 0 @@ -736,29 +559,6 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - @@ -823,33 +623,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -885,6 +658,7 @@ 0 wxID_ANY mm + 0 0 @@ -910,29 +684,6 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - @@ -968,6 +719,7 @@ 0 wxID_ANY Size Y: + 0 0 @@ -993,29 +745,6 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - @@ -1080,33 +809,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1142,6 +844,7 @@ 0 wxID_ANY mm + 0 0 @@ -1167,29 +870,6 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - @@ -1200,7 +880,7 @@ 10 - wxEXPAND|wxRIGHT|wxLEFT + wxEXPAND|wxALL 0 wxID_ANY @@ -1210,10 +890,9 @@ wxVERTICAL 1 none - 5 - wxEXPAND|wxLEFT + wxEXPAND|wxTOP|wxBOTTOM|wxLEFT 0 3 @@ -1260,6 +939,7 @@ 0 wxID_ANY Grid 1: + 0 0 @@ -1285,29 +965,6 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - @@ -1373,34 +1030,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1436,6 +1065,7 @@ 0 wxID_ANY (hotkey) + 0 0 @@ -1461,29 +1091,6 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - @@ -1519,6 +1126,7 @@ 0 wxID_ANY Grid 2: + 0 0 @@ -1544,29 +1152,6 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - @@ -1632,34 +1217,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1695,6 +1252,7 @@ 0 wxID_ANY (hotkey) + 0 0 @@ -1720,35 +1278,70 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - + + 5 + wxEXPAND|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline1 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + ; ; forward_declare + 0 + + + + + + 10 wxEXPAND|wxLEFT @@ -1760,7 +1353,7 @@ none 5 - wxEXPAND|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT + wxALIGN_CENTER_VERTICAL|wxALL 0 1 @@ -1773,25 +1366,31 @@ + 1 0 1 1 + 0 0 + Dock 0 Left 1 1 + 0 0 wxID_ANY Reset Grid Origin + + 0 0 @@ -1806,6 +1405,8 @@ protected 1 + + Resizable 1 @@ -1821,29 +1422,6 @@ OnResetGridOrgClick - - - - - - - - - - - - - - - - - - - - - - - @@ -1858,7 +1436,7 @@ 5 - wxEXPAND|wxALL + wxALL|wxALIGN_CENTER_VERTICAL 0 0 @@ -1872,14 +1450,8 @@ m_sdbSizer protected - OnCancelClick - - - OnOkClick - - diff --git a/pcbnew/dialogs/dialog_set_grid_base.h b/pcbnew/dialogs/dialog_set_grid_base.h index b71c6d6221..af743cc3c4 100644 --- a/pcbnew/dialogs/dialog_set_grid_base.h +++ b/pcbnew/dialogs/dialog_set_grid_base.h @@ -1,12 +1,11 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Dec 30 2017) +// C++ code generated with wxFormBuilder (version Dec 1 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// -#ifndef __DIALOG_SET_GRID_BASE_H__ -#define __DIALOG_SET_GRID_BASE_H__ +#pragma once #include #include @@ -22,6 +21,10 @@ #include #include #include +#include +#include +#include +#include #include #include @@ -34,7 +37,7 @@ class DIALOG_SET_GRID_BASE : public DIALOG_SHIM { private: - + protected: wxStaticText* m_staticTextGridPosX; wxTextCtrl* m_GridOriginXCtrl; @@ -54,23 +57,23 @@ class DIALOG_SET_GRID_BASE : public DIALOG_SHIM wxStaticText* m_staticTextGrid2; wxComboBox* m_comboBoxGrid2; wxStaticText* m_grid2HotKey; + wxStaticLine* m_staticline1; wxButton* m_buttonReset; wxStdDialogButtonSizer* m_sdbSizer; wxButton* m_sdbSizerOK; wxButton* m_sdbSizerCancel; - + // Virtual event handlers, overide them in your derived class virtual void OnInitDlg( wxInitDialogEvent& event ) { event.Skip(); } virtual void OnResetGridOrgClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } - - + + public: - - DIALOG_SET_GRID_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Grid Settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE ); + + DIALOG_SET_GRID_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Grid Settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_SET_GRID_BASE(); - + }; -#endif //__DIALOG_SET_GRID_BASE_H__