Fix incorrect (un)wrapping of the subs edit box toolbar on video zoom changes

The size of the contents is not updated until after SubsEditBox::OnSize
is called, so the wrapping logic was being done based on the previous
available area, rather than the new size.

Originally committed to SVN as r6284.
This commit is contained in:
Thomas Goyne 2012-01-13 20:18:29 +00:00
parent 5774e87248
commit 54ebe9b37a
1 changed files with 3 additions and 3 deletions

View File

@ -551,19 +551,19 @@ void SubsEditBox::CommitTimes(TimeField field) {
} }
void SubsEditBox::OnSize(wxSizeEvent &evt) { void SubsEditBox::OnSize(wxSizeEvent &evt) {
int topWidth = TopSizer->GetSize().GetWidth(); int availableWidth = GetVirtualSize().GetWidth();
int midMin = MiddleSizer->GetMinSize().GetWidth(); int midMin = MiddleSizer->GetMinSize().GetWidth();
int botMin = MiddleBotSizer->GetMinSize().GetWidth(); int botMin = MiddleBotSizer->GetMinSize().GetWidth();
if (splitLineMode) { if (splitLineMode) {
if (topWidth >= midMin + botMin) { if (availableWidth > midMin + botMin) {
MainSizer->Detach(MiddleBotSizer); MainSizer->Detach(MiddleBotSizer);
MiddleSizer->Add(MiddleBotSizer,0,wxALIGN_CENTER_VERTICAL); MiddleSizer->Add(MiddleBotSizer,0,wxALIGN_CENTER_VERTICAL);
splitLineMode = false; splitLineMode = false;
} }
} }
else { else {
if (topWidth < midMin) { if (availableWidth < midMin) {
MiddleSizer->Detach(MiddleBotSizer); MiddleSizer->Detach(MiddleBotSizer);
MainSizer->Insert(2,MiddleBotSizer,0,wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM,3); MainSizer->Insert(2,MiddleBotSizer,0,wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM,3);
splitLineMode = true; splitLineMode = true;