mail[Wesnoth-commits] r33450 - in /trunk: changelog src/gui/widgets/text_box.cpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by koraq on March 08, 2009 - 19:01:
Author: mordante
Date: Sun Mar  8 19:01:55 2009
New Revision: 33450

URL: http://svn.gna.org/viewcvs/wesnoth?rev=33450&view=rev
Log:
Improve the showing of ellipses in the textbox.

Depending on the location of the cursor the ellipses are shown at the
beginning or the end. If the text is way too long the text under the
cursor can still be hiden, but pango doesn't seem to have a smart
ellipse mode. Fixes bug #13083.

Modified:
    trunk/changelog
    trunk/src/gui/widgets/text_box.cpp

Modified: trunk/changelog
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/changelog?rev=33450&r1=33449&r2=33450&view=diff
==============================================================================
--- trunk/changelog (original)
+++ trunk/changelog Sun Mar  8 19:01:55 2009
@@ -7,6 +7,7 @@
  * User interface:
    * Fixed a crash when trying to use scrollbars in an invisible widget
    * Fixed the setting of the ellipse_mode in ttext
+   * Improve the showing of ellipses in the textbox (bug #13083)
  * Miscellaneous and bug fixes:
    * Fix another savegame cache corruption
    * Fixed bug #13099: MP lobby player list becomes inaccurate over time

Modified: trunk/src/gui/widgets/text_box.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/text_box.cpp?rev=33450&r1=33449&r2=33450&view=diff
==============================================================================
--- trunk/src/gui/widgets/text_box.cpp (original)
+++ trunk/src/gui/widgets/text_box.cpp Sun Mar  8 19:01:55 2009
@@ -101,6 +101,17 @@
        // Set the cursor info.
        const unsigned start = get_selection_start();
        const int length = get_selection_length();
+
+
+       PangoEllipsizeMode ellipse_mode = PANGO_ELLIPSIZE_NONE;
+       if(!can_wrap()) {
+               if((start + length) > (get_length() / 2)) {
+                       ellipse_mode = PANGO_ELLIPSIZE_START;
+               } else {
+                       ellipse_mode = PANGO_ELLIPSIZE_END;
+               }
+       }
+       set_ellipse_mode(ellipse_mode);
 
        // Set the selection info
        unsigned start_offset = 0;
@@ -133,6 +144,7 @@
 
                tmp.set_variable("selection_offset", variant(start_offset));
                tmp.set_variable("selection_width", variant(end_offset  - 
start_offset ));
+               tmp.set_variable("text_wrap_mode", variant(ellipse_mode));
        }
 }
 




Related Messages


Powered by MHonArc, Updated Sun Mar 08 20:00:32 2009