Mercurial > hg > xemacs-beta
comparison lwlib/xlwgauge.c @ 400:a86b2b5e0111 r21-2-30
Import from CVS: tag r21-2-30
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:14:34 +0200 |
parents | 74fd4e045ea6 |
children | de805c49cfc1 |
comparison
equal
deleted
inserted
replaced
399:376370fb5946 | 400:a86b2b5e0111 |
---|---|
464 | 464 |
465 /* draw labels */ | 465 /* draw labels */ |
466 if( gw->gauge.nlabels > 1 ) | 466 if( gw->gauge.nlabels > 1 ) |
467 { | 467 { |
468 char label[20], *s = label ; | 468 char label[20], *s = label ; |
469 int len, w,h =0 ; | 469 int xlen, wd,h =0 ; |
470 | 470 |
471 if( gw->gauge.orientation == XtorientHorizontal ) | 471 if( gw->gauge.orientation == XtorientHorizontal ) |
472 y = gw->gauge.lmargin + gw->label.font->max_bounds.ascent - 1 ; | 472 y = gw->gauge.lmargin + gw->label.font->max_bounds.ascent - 1 ; |
473 else { | 473 else { |
474 y = gw->gauge.lmargin ; | 474 y = gw->gauge.lmargin ; |
481 sprintf(label, "%d", v0+i*(v1 - v0)/(gw->gauge.nlabels - 1)) ; | 481 sprintf(label, "%d", v0+i*(v1 - v0)/(gw->gauge.nlabels - 1)) ; |
482 else | 482 else |
483 s = gw->gauge.labels[i] ; | 483 s = gw->gauge.labels[i] ; |
484 if( s != NULL ) { | 484 if( s != NULL ) { |
485 x = e0 + i*(e1-e0-1)/(gw->gauge.nlabels-1) ; | 485 x = e0 + i*(e1-e0-1)/(gw->gauge.nlabels-1) ; |
486 len = strlen(s) ; | 486 xlen = strlen(s) ; |
487 if( gw->gauge.orientation == XtorientHorizontal ) { | 487 if( gw->gauge.orientation == XtorientHorizontal ) { |
488 w = XTextWidth(gw->label.font, s, len) ; | 488 wd = XTextWidth(gw->label.font, s, xlen) ; |
489 XDrawString(dpy,win,gc, x-w/2,y, s,len) ; | 489 XDrawString(dpy,win,gc, x-wd/2,y, s,xlen) ; |
490 } | 490 } |
491 else { | 491 else { |
492 XDrawString(dpy,win,gc, y,x+h, s,len) ; | 492 XDrawString(dpy,win,gc, y,x+h, s,xlen) ; |
493 } | 493 } |
494 } | 494 } |
495 } | 495 } |
496 } | 496 } |
497 } | 497 } |