[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] (no subject)
From: |
Greg Chicares |
Subject: |
[lmi-commits] (no subject) |
Date: |
Sat, 28 May 2016 01:28:06 +0000 (UTC) |
branch: master
commit 4df90d1a0fcd857e286d38933473d0d22f876d26
Author: Vadim Zeitlin <address@hidden>
Date: Sat Apr 2 19:15:56 2016 +0200
GTK: fix size of spin controls in sequence editor
Don't hard code 20px as the "extra" size to add when computing
wxSpinCtrl width, this is too much under MSW and much too little under
GTK+ 3, resulting in spin controls text part not being visible at all,
thus making the control unusable.
Rely on wxControl->GetSizeFromTextSize() instead, which is supposed to
be implemented correctly for all controls and ports.
---
input_sequence_entry.cpp | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/input_sequence_entry.cpp b/input_sequence_entry.cpp
index a4fc94a..a53f1b4 100644
--- a/input_sequence_entry.cpp
+++ b/input_sequence_entry.cpp
@@ -552,11 +552,9 @@ std::string InputSequenceEditor::sequence_string()
return s;
}
-void SizeWinForText(wxWindow* win, wxString const& text, int extra = 0)
+void SizeWinForText(wxControl* win, wxString const& text)
{
- int x, y;
- win->GetTextExtent(text, &x, &y);
- win->SetMinSize(wxSize(x + extra, -1));
+ win->SetMinSize(win->GetSizeFromTextSize(win->GetTextExtent(text).x));
}
void InputSequenceEditor::add_row()
@@ -636,7 +634,7 @@ void InputSequenceEditor::insert_row(int new_row)
sizer_->wxSizer::Insert(insert_pos++, duration_mode, flags);
wxSpinCtrl* duration_num = new(wx) wxSpinCtrl(rows_area_, wxID_ANY, "");
sizer_->wxSizer::Insert(insert_pos++, duration_num, flags);
- SizeWinForText(duration_num, "9999", 20);
+ SizeWinForText(duration_num, "9999");
wxStaticText* then_label = new(wx) wxStaticText
(rows_area_
,wxID_ANY
- [lmi-commits] [lmi] master updated (0798ad3 -> b27a3af), Greg Chicares, 2016/05/27
- [lmi-commits] (no subject), Greg Chicares, 2016/05/27
- [lmi-commits] (no subject), Greg Chicares, 2016/05/27
- [lmi-commits] (no subject), Greg Chicares, 2016/05/27
- [lmi-commits] (no subject),
Greg Chicares <=
- [lmi-commits] (no subject), Greg Chicares, 2016/05/27
- [lmi-commits] (no subject), Greg Chicares, 2016/05/27
- [lmi-commits] (no subject), Greg Chicares, 2016/05/27
- [lmi-commits] (no subject), Greg Chicares, 2016/05/27