[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] Input-sequence editor testing
From: |
Vaclav Slavik |
Subject: |
Re: [lmi] Input-sequence editor testing |
Date: |
Sun, 10 Jul 2011 15:37:00 +0200 |
User-agent: |
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 |
Hi,
On 2011-07-09 19:32, Václav Slavík wrote:
> Sounds like CentreOnParent() bug to me and one that should be fixed
> in the library. I'll have a look at it, thanks for spotting the problem!
I was wrong about this. There were two related bugs in InputSequenceEditor,
the first one was causing the defect you observed:
(1) InputSequenceEditor was centered immediately after creation, before
filling it with sequence data -- and thus changing dialog's size.
CentreOnParent() _did_ ensure that it stayed on-screen, but it was early,
when the dialog was small.
(2) The dialog could grow too large when adding new rows to the sequence
and move off screen.
The patch below fixes both issues.
Regards,
Vaclav
diff --git a/input_sequence_entry.cpp b/input_sequence_entry.cpp
index 0a0fb9a..d472b37 100644
--- a/input_sequence_entry.cpp
+++ b/input_sequence_entry.cpp
@@ -42,6 +42,7 @@
#include <wx/choice.h>
#include <wx/combobox.h>
#include <wx/dialog.h>
+#include <wx/display.h>
#include <wx/sizer.h>
#include <wx/spinctrl.h>
#include <wx/stattext.h>
@@ -788,6 +789,19 @@ void InputSequenceEditor::redo_layout()
sizer->Layout();
sizer->Fit(this);
sizer->SetSizeHints(this);
+
+ // Make sure the editor is still fully visible and doesn't extend
+ // off-screen after being resized:
+ int display = wxDisplay::GetFromWindow(this);
+ wxDisplay dpy(display == wxNOT_FOUND ? 0 : display);
+ wxRect rect_display(dpy.GetClientArea());
+ wxRect rect_win(GetRect());
+
+ if(!rect_display.Contains(rect_win.GetBottomRight()))
+ {
+ rect_win.Offset(0, rect_display.GetBottom() - rect_win.GetBottom());
+ SetSize(rect_win);
+ }
}
wxString InputSequenceEditor::format_from_text(int row)
@@ -1197,7 +1211,6 @@ void InputSequenceEntry::UponOpenEditor(wxCommandEvent&)
// Center the window on the [...] button for best locality -- it will be
// close to user's point of attention and the mouse cursor.
InputSequenceEditor editor(button_, title_, *input);
- editor.CentreOnParent();
std::string sequence_string = std::string(text_->GetValue());
std::string const name(GetName().c_str());
@@ -1238,6 +1251,8 @@ void InputSequenceEntry::UponOpenEditor(wxCommandEvent&)
editor.sequence(sequence);
+ editor.CentreOnParent();
+
if(wxID_OK == editor.ShowModal())
{
text_->SetValue(editor.sequence_string());
- Re: [lmi] Input-sequence editor testing, Greg Chicares, 2011/07/09
- Re: [lmi] Input-sequence editor testing, Václav Slavík, 2011/07/09
- Re: [lmi] Input-sequence editor testing, Greg Chicares, 2011/07/09
- Re: [lmi] Input-sequence editor testing, Vadim Zeitlin, 2011/07/09
- Re: [lmi] Input-sequence editor testing, Václav Slavík, 2011/07/10
- Re: [lmi] Input-sequence editor testing, Vadim Zeitlin, 2011/07/10
- Re: [lmi] Input-sequence editor testing, Greg Chicares, 2011/07/10
- Re: [lmi] Input-sequence editor testing, Vadim Zeitlin, 2011/07/12
- Re: [lmi] Input-sequence editor testing, Greg Chicares, 2011/07/10
- Re: [lmi] TAB and focus handling in MvcController (was: Input-sequence editor testing), Vadim Zeitlin, 2011/07/11
Re: [lmi] Input-sequence editor testing,
Vaclav Slavik <=