From 070a4044ebb34dc55a2e76c8f35b8d5ab6d7f4ef Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Mon, 6 May 2002 04:11:50 +0000 Subject: [PATCH] Clip text in file list properly. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2196 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- CHANGES | 1 + src/Fl_File_Browser.cxx | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index 4390d8669..799dadf91 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,7 @@ CHANGES IN FLTK 1.1.0rc2 - Portability fixes. + - Fl_File_Browser didn't clip items to the column width. - Fl_Window::draw() cleared the window label but didn't restore it, so windows could lose their titles. - Eliminated multiple definitions of dirent structure diff --git a/src/Fl_File_Browser.cxx b/src/Fl_File_Browser.cxx index 06a5b2ba3..debffaec5 100644 --- a/src/Fl_File_Browser.cxx +++ b/src/Fl_File_Browser.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_File_Browser.cxx,v 1.1.2.14 2002/05/02 14:31:10 easysw Exp $" +// "$Id: Fl_File_Browser.cxx,v 1.1.2.15 2002/05/06 04:11:50 easysw Exp $" // // Fl_File_Browser routines. // @@ -342,7 +342,18 @@ Fl_File_Browser::item_draw(void *p, // I - List item data // Tab - nul terminate this fragment and draw it... *ptr = '\0'; - fl_draw(fragment, x + width, y, w - width, fl_height(), + int cW = w - width; // Clip width... + + if (columns) + { + // Try clipping inside this column... + for (i = 0; i < column && columns[i]; i ++); + + if (columns[i]) + cW = columns[i]; + } + + fl_draw(fragment, x + width, y, cW, fl_height(), (Fl_Align)(FL_ALIGN_LEFT | FL_ALIGN_CLIP), 0, 0); // Advance to the next column... @@ -627,5 +638,5 @@ Fl_File_Browser::filter(const char *pattern) // I - Pattern string // -// End of "$Id: Fl_File_Browser.cxx,v 1.1.2.14 2002/05/02 14:31:10 easysw Exp $". +// End of "$Id: Fl_File_Browser.cxx,v 1.1.2.15 2002/05/06 04:11:50 easysw Exp $". //