# HG changeset patch # User John Tsiombikas # Date 1304133171 -10800 # Node ID 17f5ff624da3bff152b8bc60d6933d00cca76a30 # Parent 3138c38433e257440589668e84a440ace32012c1 minor fixes in the layout system diff -r 3138c38433e2 -r 17f5ff624da3 src/imtk.c --- a/src/imtk.c Sat Apr 30 05:36:56 2011 +0300 +++ b/src/imtk.c Sat Apr 30 06:12:51 2011 +0300 @@ -96,7 +96,6 @@ { int max_span_y, max_box_y; - box[2] += width + spacing; span[2] += width + spacing; if(height > span[3]) { @@ -109,6 +108,9 @@ if(max_span_y > max_box_y) { box[3] = max_span_y - box[1]; } + if(span[2] > box[2]) { + box[2] = span[2]; + } if(layout == IMTK_VERTICAL) { imtk_layout_newline(); diff -r 3138c38433e2 -r 17f5ff624da3 src/slider.c --- a/src/slider.c Sat Apr 30 05:36:56 2011 +0300 +++ b/src/slider.c Sat Apr 30 06:12:51 2011 +0300 @@ -9,11 +9,11 @@ #define THUMB_WIDTH 10 #define THUMB_HEIGHT 20 -static void draw_slider(int id, float pos, float min, float max, int x, int y, int over); +static int draw_slider(int id, float pos, float min, float max, int x, int y, int over); float imtk_slider(int id, float pos, float min, float max, int x, int y) { - int mousex, mousey, thumb_x, thumb_y, over = 0; + int mousex, mousey, thumb_x, thumb_y, txsz, over = 0; float range = max - min; assert(id >= 0); @@ -64,13 +64,13 @@ if(pos > 1.0) pos = 1.0; } - draw_slider(id, pos, min, max, x, y, over); - imtk_layout_advance(SLIDER_SIZE + THUMB_WIDTH, THUMB_HEIGHT); + txsz = draw_slider(id, pos, min, max, x, y, over); + imtk_layout_advance(SLIDER_SIZE + THUMB_WIDTH + txsz, THUMB_HEIGHT); return pos * range + min; } -static void draw_slider(int id, float pos, float min, float max, int x, int y, int over) +static int draw_slider(int id, float pos, float min, float max, int x, int y, int over) { float range = max - min; int thumb_x, thumb_y; @@ -105,5 +105,6 @@ sprintf(buf, "%.3f", pos * range + min); glColor4fv(imtk_get_color(IMTK_TEXT_COLOR)); imtk_draw_string(x + SLIDER_SIZE + THUMB_WIDTH / 2 + 2, y + 4, buf); + return imtk_string_size(buf); }