Changeset 845
- Timestamp:
- 10/03/07 07:12:11 (14 months ago)
- Location:
- trunk
- Files:
-
- 2 modified
-
widget_text.c (modified) (5 diffs)
-
widget_text.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/widget_text.c
r840 r845 86 86 pad = 0; 87 87 break; 88 case ALIGN_AUTOMATIC: 89 if (len <= width) { 90 pad = 0; 91 break; 92 } 88 93 case ALIGN_MARQUEE: 89 94 pad = width - T->scroll; … … 220 225 /* update callback timer, so we do nothing here; otherwise */ 221 226 /* we simply call this scroll callback directly */ 222 if (T->align != ALIGN_MARQUEE ) {227 if (T->align != ALIGN_MARQUEE || T->align != ALIGN_AUTOMATIC) { 223 228 widget_text_scroll(Self); 224 229 } … … 280 285 Text->align = ALIGN_MARQUEE; 281 286 break; 287 case 'A': 288 Text->align = ALIGN_AUTOMATIC; 289 break; 282 290 default: 283 291 error("widget %s has unknown alignment '%s', using 'Left'", section, c); … … 293 301 294 302 /* marquee scroller speed: interval (msec), default 500msec */ 295 if (Text->align == ALIGN_MARQUEE ) {303 if (Text->align == ALIGN_MARQUEE || Text->align == ALIGN_AUTOMATIC) { 296 304 cfg_number(section, "speed", 500, 10, -1, &(Text->speed)); 297 305 } … … 307 315 308 316 /* a marquee scroller has its own timer and callback */ 309 if (Text->align == ALIGN_MARQUEE ) {317 if (Text->align == ALIGN_MARQUEE || Text->align == ALIGN_AUTOMATIC) { 310 318 timer_add(widget_text_scroll, Self, Text->speed, 0); 311 319 } -
trunk/widget_text.h
r840 r845 31 31 #include "property.h" 32 32 33 typedef enum { ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT, ALIGN_MARQUEE } TEXT_ALIGN;33 typedef enum { ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT, ALIGN_MARQUEE, ALIGN_AUTOMATIC } TEXT_ALIGN; 34 34 35 35 typedef struct WIDGET_TEXT { … … 42 42 int width; /* field width */ 43 43 int precision; /* number of digits after the decimal point */ 44 TEXT_ALIGN align; /* alignment: L(eft), C(enter), R(ight), M(arquee) */44 TEXT_ALIGN align; /* alignment: L(eft), C(enter), R(ight), M(arquee), A(utomatic) */ 45 45 int update; /* update interval */ 46 46 int scroll; /* marquee starting point */
