This is the mail archive of the cygwin-apps mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH setup 1/4] Fix truncation of "Bin?" and "Src?" column headers


It seems that the the "Bin?" and "Src? columns in the PickView are usually not
quite wide enough, and display truncated with an ellipsis, e.g. 'B...' and
'S...', which is completely unintelligible.

Try to more correctly size these colums.  3*GetSystemMetrics(SM_CXEDGE) seems to
be documented as the default value for the margin of a header control, so text
length + twice that is the minimum header width needed.

ChangeLog:

2015-03-02  Jon TURNEY  <jon.turney@dronecode.org.uk>

	* PickView.cc (init_headers): More correctly size "Bin?" and
	"Src?" columns.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
---
 PickView.cc | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/PickView.cc b/PickView.cc
index 00a3c3a..4630ee9 100644
--- a/PickView.cc
+++ b/PickView.cc
@@ -441,13 +441,15 @@ PickView::init_headers (HDC dc)
       headers[i].x = 0;
     }
 
-  // accomodate widths of the 'bin' and 'src' checkbox columns
-  // FIXME: What's up with the "0"? It's probably a mistake, and should be
-  // "". It used to be written as 0, and was subject to a bizarre implicit
-  // conversion by the unwise String(int) constructor.
-  note_width (headers, dc, "0", HMARGIN + 11, bintick_col);
-  note_width (headers, dc, "0", HMARGIN + 11, srctick_col);
-  
+  // A margin of 3*GetSystemMetrics(SM_CXEDGE) is used at each side of the
+  // header text.  (Probably should use that rather than hard-coding HMARGIN
+  // everywhere)
+  int addend = 2*3*GetSystemMetrics(SM_CXEDGE);
+
+  // accommodate widths of the 'bin' and 'src' checkbox columns
+  note_width (headers, dc, headers[bintick_col].text, addend, bintick_col);
+  note_width (headers, dc, headers[srctick_col].text, addend, srctick_col);
+
   // accomodate the width of each category name
   packagedb db;
   for (packagedb::categoriesType::iterator n = packagedb::categories.begin();
-- 
2.1.4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]