Enhance the way sequence widget labels are drawn.

This commit is contained in:
Jonathan Moore Liles 2008-04-30 19:57:11 -05:00
parent 80005dcf89
commit 2bec4b16f1
1 changed files with 14 additions and 13 deletions

View File

@ -60,7 +60,7 @@ Sequence_Widget::draw_label ( const char *label, Fl_Align align, Fl_Color color
lab.color = color; lab.color = color;
// lab.type = FL_SHADOW_LABEL; // lab.type = FL_SHADOW_LABEL;
lab.type = FL_ENGRAVED_LABEL; lab.type = FL_NORMAL_LABEL;
lab.value = label; lab.value = label;
lab.font = FL_HELVETICA; lab.font = FL_HELVETICA;
lab.size = 14; lab.size = 14;
@ -89,20 +89,21 @@ Sequence_Widget::draw_label ( const char *label, Fl_Align align, Fl_Color color
if ( abs_x() < scroll_x() ) if ( abs_x() < scroll_x() )
dx = min( 32767, scroll_x() - abs_x() ); dx = min( 32767, scroll_x() - abs_x() );
{ // const Fl_Boxtype b = FL_ROUND_UP_BOX;
const Fl_Boxtype b = FL_ROUND_UP_BOX; const Fl_Boxtype b = FL_ROUNDED_BOX;
const int bx = Fl::box_dx( b ); const int bx = Fl::box_dx( b ) + 1;
const int bw = Fl::box_dw( b ); const int bw = Fl::box_dw( b ) + 1;
if ( align & FL_ALIGN_BOTTOM ) if ( align & FL_ALIGN_BOTTOM )
fl_draw_box( b, X - dx - bx, Y + H - lh, lw + bw, lh, FL_GRAY ); fl_draw_box( b, X - dx - bx, Y + H - lh, lw + bw, lh, FL_GRAY );
else if ( align == FL_ALIGN_LEFT ) else if ( align == FL_ALIGN_LEFT )
fl_draw_box( b, X - dx, Y + ((H / 2) - (lh / 2)), lw + bw, lh, FL_GRAY ); fl_draw_box( b, X - dx, Y + ((H >> 1) - (lh >> 1)), lw + bw, lh, FL_GRAY );
else if ( align & FL_ALIGN_TOP ) else if ( align & FL_ALIGN_TOP )
fl_draw_box( b, X - dx - bx + ((W / 2) - (lw / 2)), Y + ((H / 2) - (lh / 2)), lw + bw, lh, FL_GRAY ); fl_draw_box( b, X - dx - bx + ((W >> 1) - (lw >> 1)), Y + ((H >> 1) - (lh >> 1)), lw + bw, lh, FL_GRAY );
}
lab.draw( X - dx, Y, W, H, align ); // lab.draw( X - dx, Y, W, H, align );
fl_color( color );
fl_draw( label, ( X - dx ) + bx, Y, W, H, align );
if ( align & FL_ALIGN_CLIP ) fl_pop_clip(); if ( align & FL_ALIGN_CLIP ) fl_pop_clip();