lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [5232] Improve pop-up dialog placement (VS)


From: Greg Chicares
Subject: [lmi-commits] [5232] Improve pop-up dialog placement (VS)
Date: Sun, 07 Aug 2011 16:09:47 +0000

Revision: 5232
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=5232
Author:   chicares
Date:     2011-08-07 16:09:47 +0000 (Sun, 07 Aug 2011)
Log Message:
-----------
Improve pop-up dialog placement (VS)

Modified Paths:
--------------
    lmi/trunk/ChangeLog
    lmi/trunk/input_sequence_entry.cpp

Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2011-08-07 12:15:33 UTC (rev 5231)
+++ lmi/trunk/ChangeLog 2011-08-07 16:09:47 UTC (rev 5232)
@@ -28151,3 +28151,9 @@
 Make "..." button less obtrusive (VS). See:
   http://lists.nongnu.org/archive/html/lmi/2011-06/msg00057.html
 
+20110807T1609Z <address@hidden> [637]
+
+  input_sequence_entry.cpp
+Improve pop-up dialog placement (VS). See:
+  http://lists.nongnu.org/archive/html/lmi/2011-07/msg00017.html
+

Modified: lmi/trunk/input_sequence_entry.cpp
===================================================================
--- lmi/trunk/input_sequence_entry.cpp  2011-08-07 12:15:33 UTC (rev 5231)
+++ lmi/trunk/input_sequence_entry.cpp  2011-08-07 16:09:47 UTC (rev 5232)
@@ -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>
@@ -797,6 +798,19 @@
     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)
@@ -1334,7 +1348,6 @@
     // 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_, in);
-    editor.CentreOnParent();
 
     std::string sequence_string = std::string(text_->GetValue());
     datum_sequence const& ds = *member_cast<datum_sequence>(in[field_name()]);
@@ -1375,6 +1388,8 @@
     editor.sequence(sequence);
 
     editor.associate_text_ctrl(text_);
+    editor.CentreOnParent();
+
     editor.ShowModal();
 }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]