Patch #960 2006-03-28 04:02

pecan

set statusbar widths to fit any dpi
Download
960-set_statusbar_w.patch (1.0 KB)
Category
 
Status
Accepted
Close date
2006-03-28 21:28
Assigned to
 
Index: src/src/main.cpp
===================================================================
--- src/src/main.cpp    (revision 2264)
+++ src/src/main.cpp    (working copy)
@@ -1194,7 +1194,19 @@
 #if wxUSE_STATUSBAR
     const int count = 6;
     CreateStatusBar(count);
-    int statusWidths[count] = {-1, 96, 148, 64, 64, 96};
+    //int statusWidths[count] = {-1, 96, 148, 64, 64, 96};
+    CreateStatusBar(count);
+    // set statusbar widths to fit any dpi //pecan 2006/03/27
+    wxClientDC dc(this);
+    wxFont font = dc.GetFont();
+    wxCoord Pos2,Pos3,Pos4,Pos5,Pos6,h;
+    dc.GetTextExtent(wxT(" WINDOWS-1252 "), &Pos2, &h);
+    dc.GetTextExtent(wxT(" Line 1234, Column 123 "), &Pos3, &h);
+    dc.GetTextExtent(wxT(" Overwrite"),  &Pos4, &h);
+    dc.GetTextExtent(wxT(" Modified"),   &Pos5, &h);
+    dc.GetTextExtent(wxT(" Read/Write....."), &Pos6, &h);
+
+    int statusWidths[count] = {-1, Pos2, Pos3, Pos4, Pos5, Pos6};
     SetStatusWidths(count, statusWidths);
 #endif // wxUSE_STATUSBAR
 }
pecan 2006-03-28 04:03

The statusbar text is being truncated at 120 and greater dpi.

This patch sets the text widths via GetTextExtent() to fit

any dpi.

pecan 2006-03-28 17:56

Adjusted for GTK which seems to be compressing

the blank character by half a char width.

thomasdenk 2006-03-28 21:28

Modified slightly, so it writes directly into the target array (also, strings should be translated). Thank you :)