From e8ab661504e664edc2890be4cedbb2e98892cf2e Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Mon, 12 Aug 2019 09:30:46 -0400 Subject: [PATCH] PCB calculator: fix regulator dialog layout. Set default dialog size to -1,-1 to allow the dialog to size itself properly to prevent the buttons in the standard dialog button sizer from being truncated. Fixes lp:1839695 https://bugs.launchpad.net/kicad/+bug/1839695 (cherry picked from commit e3e546f7d273ec076f94b090e4a30f3b5cc7ea47) --- .../dialogs/dialog_regulator_data.fbp | 342 ++---------------- .../dialogs/dialog_regulator_data_base.cpp | 92 ++--- .../dialogs/dialog_regulator_data_base.h | 28 +- 3 files changed, 81 insertions(+), 381 deletions(-) diff --git a/pcb_calculator/dialogs/dialog_regulator_data.fbp b/pcb_calculator/dialogs/dialog_regulator_data.fbp index c72cef9eba..995c542cf3 100644 --- a/pcb_calculator/dialogs/dialog_regulator_data.fbp +++ b/pcb_calculator/dialogs/dialog_regulator_data.fbp @@ -1,6 +1,6 @@ - + C++ @@ -14,6 +14,7 @@ dialog_regulator_data_base 1000 none + 1 dialog_regulator_data @@ -25,6 +26,7 @@ 1 1 UI + 0 0 0 @@ -42,55 +44,19 @@ 0 wxID_ANY - + -1,-1 DIALOG_EDITOR_DATA_BASE - 292,200 - wxDEFAULT_DIALOG_STYLE + -1,-1 + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER DIALOG_SHIM; dialog_shim.h Regulator Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + 300,-1 bSizerMain wxVERTICAL none @@ -143,6 +109,7 @@ 0 wxID_ANY Name: + 0 0 @@ -168,34 +135,11 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND + wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND 0 1 @@ -255,33 +199,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -327,6 +244,7 @@ 0 wxID_ANY Vref: + 0 0 @@ -352,34 +270,11 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND + wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND 0 1 @@ -439,33 +334,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -501,6 +369,7 @@ 0 wxID_ANY Volt + 0 0 @@ -526,29 +395,6 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - @@ -584,6 +430,7 @@ 0 wxID_ANY Type: + 0 0 @@ -609,34 +456,11 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND + wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND 0 1 @@ -696,30 +520,7 @@ - OnRegTypeSelection - - - - - - - - - - - - - - - - - - - - - - @@ -765,6 +566,7 @@ 0 wxID_ANY Iadj: + 0 0 @@ -790,34 +592,11 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND + wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND 0 1 @@ -877,33 +656,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -939,6 +691,7 @@ 0 wxID_ANY uA + 0 0 @@ -964,29 +717,6 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - @@ -1003,7 +733,7 @@ 5 - wxEXPAND | wxALL + wxEXPAND 0 1 @@ -1040,7 +770,7 @@ 0 1 - m_staticline2 + m_staticline 1 @@ -1057,34 +787,11 @@ - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxALL + wxALL|wxEXPAND 0 0 @@ -1096,16 +803,9 @@ 0 0 - m_sdbSizerButtons + m_sdbSizer protected - - - - - OnOKClick - - diff --git a/pcb_calculator/dialogs/dialog_regulator_data_base.cpp b/pcb_calculator/dialogs/dialog_regulator_data_base.cpp index 94e514115f..9b7ca0d372 100644 --- a/pcb_calculator/dialogs/dialog_regulator_data_base.cpp +++ b/pcb_calculator/dialogs/dialog_regulator_data_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 19 2018) +// C++ code generated with wxFormBuilder (version Aug 12 2019) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -11,96 +11,98 @@ DIALOG_EDITOR_DATA_BASE::DIALOG_EDITOR_DATA_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 ); - + this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize ); + wxBoxSizer* bSizerMain; bSizerMain = new wxBoxSizer( wxVERTICAL ); - + + bSizerMain->SetMinSize( wxSize( 300,-1 ) ); wxFlexGridSizer* fgSizerPrms; fgSizerPrms = new wxFlexGridSizer( 4, 3, 0, 0 ); fgSizerPrms->AddGrowableCol( 1 ); fgSizerPrms->AddGrowableRow( 0 ); fgSizerPrms->SetFlexibleDirection( wxHORIZONTAL ); fgSizerPrms->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - + m_staticTextName = new wxStaticText( this, wxID_ANY, _("Name:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextName->Wrap( -1 ); fgSizerPrms->Add( m_staticTextName, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - + m_textCtrlName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgSizerPrms->Add( m_textCtrlName, 0, wxALL|wxEXPAND, 5 ); - - + fgSizerPrms->Add( m_textCtrlName, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 ); + + fgSizerPrms->Add( 0, 0, 1, wxEXPAND, 5 ); - + m_staticTextVref = new wxStaticText( this, wxID_ANY, _("Vref:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextVref->Wrap( -1 ); fgSizerPrms->Add( m_staticTextVref, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - + m_textCtrlVref = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgSizerPrms->Add( m_textCtrlVref, 0, wxALL|wxEXPAND, 5 ); - + fgSizerPrms->Add( m_textCtrlVref, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 ); + m_staticTextVrefUnit = new wxStaticText( this, wxID_ANY, _("Volt"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextVrefUnit->Wrap( -1 ); fgSizerPrms->Add( m_staticTextVrefUnit, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - + m_staticTextType = new wxStaticText( this, wxID_ANY, _("Type:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextType->Wrap( -1 ); fgSizerPrms->Add( m_staticTextType, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - + wxString m_choiceRegTypeChoices[] = { _("Separate sense pin"), _("3 terminals regulator") }; int m_choiceRegTypeNChoices = sizeof( m_choiceRegTypeChoices ) / sizeof( wxString ); m_choiceRegType = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceRegTypeNChoices, m_choiceRegTypeChoices, 0 ); m_choiceRegType->SetSelection( 0 ); - fgSizerPrms->Add( m_choiceRegType, 0, wxALL|wxEXPAND, 5 ); - - + fgSizerPrms->Add( m_choiceRegType, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 ); + + fgSizerPrms->Add( 0, 0, 1, wxEXPAND, 5 ); - + m_RegulIadjTitle = new wxStaticText( this, wxID_ANY, _("Iadj:"), wxDefaultPosition, wxDefaultSize, 0 ); m_RegulIadjTitle->Wrap( -1 ); fgSizerPrms->Add( m_RegulIadjTitle, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - + m_RegulIadjValue = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgSizerPrms->Add( m_RegulIadjValue, 0, wxALL|wxEXPAND, 5 ); - + fgSizerPrms->Add( m_RegulIadjValue, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 ); + m_IadjUnitLabel = new wxStaticText( this, wxID_ANY, _("uA"), wxDefaultPosition, wxDefaultSize, 0 ); m_IadjUnitLabel->Wrap( -1 ); fgSizerPrms->Add( m_IadjUnitLabel, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - - + + bSizerMain->Add( fgSizerPrms, 0, wxEXPAND, 5 ); - - + + bSizerMain->Add( 0, 0, 1, wxEXPAND, 5 ); - - m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bSizerMain->Add( m_staticline2, 0, wxEXPAND | wxALL, 5 ); - - m_sdbSizerButtons = new wxStdDialogButtonSizer(); - m_sdbSizerButtonsOK = new wxButton( this, wxID_OK ); - m_sdbSizerButtons->AddButton( m_sdbSizerButtonsOK ); - m_sdbSizerButtonsCancel = new wxButton( this, wxID_CANCEL ); - m_sdbSizerButtons->AddButton( m_sdbSizerButtonsCancel ); - m_sdbSizerButtons->Realize(); - - bSizerMain->Add( m_sdbSizerButtons, 0, wxEXPAND|wxALL, 5 ); - - + + m_staticline = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizerMain->Add( m_staticline, 0, 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(); + + bSizerMain->Add( m_sdbSizer, 0, wxALL|wxEXPAND, 5 ); + + this->SetSizer( bSizerMain ); this->Layout(); - + bSizerMain->Fit( this ); + this->Centre( wxBOTH ); - + // Connect Events m_choiceRegType->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_EDITOR_DATA_BASE::OnRegTypeSelection ), NULL, this ); - m_sdbSizerButtonsOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDITOR_DATA_BASE::OnOKClick ), NULL, this ); + m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDITOR_DATA_BASE::OnOKClick ), NULL, this ); } DIALOG_EDITOR_DATA_BASE::~DIALOG_EDITOR_DATA_BASE() { // Disconnect Events m_choiceRegType->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_EDITOR_DATA_BASE::OnRegTypeSelection ), NULL, this ); - m_sdbSizerButtonsOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDITOR_DATA_BASE::OnOKClick ), NULL, this ); - + m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDITOR_DATA_BASE::OnOKClick ), NULL, this ); + } diff --git a/pcb_calculator/dialogs/dialog_regulator_data_base.h b/pcb_calculator/dialogs/dialog_regulator_data_base.h index b9f0ed2ee1..a26d15178d 100644 --- a/pcb_calculator/dialogs/dialog_regulator_data_base.h +++ b/pcb_calculator/dialogs/dialog_regulator_data_base.h @@ -1,12 +1,11 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 19 2018) +// C++ code generated with wxFormBuilder (version Aug 12 2019) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// -#ifndef __DIALOG_REGULATOR_DATA_BASE_H__ -#define __DIALOG_REGULATOR_DATA_BASE_H__ +#pragma once #include #include @@ -34,7 +33,7 @@ class DIALOG_EDITOR_DATA_BASE : public DIALOG_SHIM { private: - + protected: wxStaticText* m_staticTextName; wxTextCtrl* m_textCtrlName; @@ -46,21 +45,20 @@ class DIALOG_EDITOR_DATA_BASE : public DIALOG_SHIM wxStaticText* m_RegulIadjTitle; wxTextCtrl* m_RegulIadjValue; wxStaticText* m_IadjUnitLabel; - wxStaticLine* m_staticline2; - wxStdDialogButtonSizer* m_sdbSizerButtons; - wxButton* m_sdbSizerButtonsOK; - wxButton* m_sdbSizerButtonsCancel; - + wxStaticLine* m_staticline; + wxStdDialogButtonSizer* m_sdbSizer; + wxButton* m_sdbSizerOK; + wxButton* m_sdbSizerCancel; + // Virtual event handlers, overide them in your derived class virtual void OnRegTypeSelection( wxCommandEvent& event ) { event.Skip(); } virtual void OnOKClick( wxCommandEvent& event ) { event.Skip(); } - - + + public: - - DIALOG_EDITOR_DATA_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Regulator Parameters"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 292,200 ), long style = wxDEFAULT_DIALOG_STYLE ); + + DIALOG_EDITOR_DATA_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Regulator Parameters"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_EDITOR_DATA_BASE(); - + }; -#endif //__DIALOG_REGULATOR_DATA_BASE_H__