From c484660b4c1997eb20e9255a195d4eaa05c55995 Mon Sep 17 00:00:00 2001 From: "Zane U. Ji" Date: Thu, 17 Oct 2013 01:34:15 +0800 Subject: [PATCH] Fixed a layout problem --- src/commandpanel.cpp | 25 +++---------------------- src/commandpanel.h | 2 +- 2 files changed, 4 insertions(+), 23 deletions(-) diff --git a/src/commandpanel.cpp b/src/commandpanel.cpp index 967fec6..9735da6 100755 --- a/src/commandpanel.cpp +++ b/src/commandpanel.cpp @@ -54,18 +54,7 @@ CommandPanel::CommandPanel ( wxButton *fullpathButton = new wxButton ( this, ID_BUTTON_FULLPATH, fullpath, wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT | wxNO_BORDER ); - int editWidth, editHeight; - parent->GetSize( &editWidth, &editHeight); - editWidth -= sizerOffset * 2; - - commandEdit = new wxTextCtrl ( - this, - wxID_ANY, - _T ( "" ), - wxDefaultPosition, - wxSize ( editWidth, -1 ) - ); - + commandEdit = new wxTextCtrl ( this, wxID_ANY ); commandEdit->SetValue ( cmd ); runButton = new wxButton ( @@ -137,27 +126,19 @@ CommandPanel::CommandPanel ( variablesSizer->Add ( extensionButton, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, sizerOffset ); variablesSizer->Add ( fullpathButton, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, sizerOffset ); - topSizer = new wxBoxSizer ( wxHORIZONTAL ); - topSizer->Add ( commandEdit, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL | wxEXPAND, sizerOffset ); - - topSizer->Layout(); - bottomSizer = new wxBoxSizer ( wxHORIZONTAL ); bottomSizer->Add ( runButton, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, sizerOffset ); bottomSizer->Add ( syncBox, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, sizerOffset ); bottomSizer->Add ( variablesSizer, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, sizerOffset ); bottomSizer->Add ( outputSizer, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, sizerOffset ); - bottomSizer->Layout(); - mainSizer = new wxBoxSizer ( wxVERTICAL ); - mainSizer->Add ( topSizer ); + mainSizer->Add ( commandEdit, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL | wxEXPAND, sizerOffset ); mainSizer->Add ( bottomSizer ); - mainSizer->Layout(); this->SetSizer ( mainSizer ); - this->SetSize ( -1, ( runButton->GetSize().GetHeight() * 2 ) + 25 ); + mainSizer->SetSizeHints ( this ); } CommandPanel::~CommandPanel() diff --git a/src/commandpanel.h b/src/commandpanel.h index 649b134..c34cc79 100755 --- a/src/commandpanel.h +++ b/src/commandpanel.h @@ -63,7 +63,7 @@ class CommandPanel : public wxPanel wxButton *runButton; wxCheckBox *syncBox; wxRadioButton *outputIgnore, *outputInsert, *outputNewDocument; - wxBoxSizer *topSizer, *bottomSizer, *mainSizer; + wxBoxSizer *bottomSizer, *mainSizer; MyFrame *parent; DECLARE_EVENT_TABLE() };