Changeset 845

Show
Ignore:
Timestamp:
10/03/07 07:12:11 (14 months ago)
Author:
michael
Message:

automatic marquee patch from Manuel Grot

Location:
trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/widget_text.c

    r840 r845  
    8686      pad = 0; 
    8787  break; 
     88    case ALIGN_AUTOMATIC: 
     89  if (len <= width) { 
     90      pad = 0; 
     91      break; 
     92  } 
    8893    case ALIGN_MARQUEE: 
    8994  pad = width - T->scroll; 
     
    220225  /* update callback timer, so we do nothing here; otherwise */ 
    221226  /* we simply call this scroll callback directly */ 
    222   if (T->align != ALIGN_MARQUEE) { 
     227  if (T->align != ALIGN_MARQUEE || T->align != ALIGN_AUTOMATIC) { 
    223228      widget_text_scroll(Self); 
    224229  } 
     
    280285  Text->align = ALIGN_MARQUEE; 
    281286  break; 
     287    case 'A': 
     288  Text->align = ALIGN_AUTOMATIC; 
     289  break; 
    282290    default: 
    283291  error("widget %s has unknown alignment '%s', using 'Left'", section, c); 
     
    293301 
    294302    /* marquee scroller speed: interval (msec), default 500msec */ 
    295     if (Text->align == ALIGN_MARQUEE) { 
     303    if (Text->align == ALIGN_MARQUEE || Text->align == ALIGN_AUTOMATIC) { 
    296304  cfg_number(section, "speed", 500, 10, -1, &(Text->speed)); 
    297305    } 
     
    307315 
    308316    /* 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) { 
    310318  timer_add(widget_text_scroll, Self, Text->speed, 0); 
    311319    } 
  • trunk/widget_text.h

    r840 r845  
    3131#include "property.h" 
    3232 
    33 typedef enum { ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT, ALIGN_MARQUEE } TEXT_ALIGN; 
     33typedef enum { ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT, ALIGN_MARQUEE, ALIGN_AUTOMATIC } TEXT_ALIGN; 
    3434 
    3535typedef struct WIDGET_TEXT { 
     
    4242    int width;      /* field width */ 
    4343    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) */ 
    4545    int update;     /* update interval */ 
    4646    int scroll;     /* marquee starting point */