imtk

diff src/imtk.c @ 23:4c2b3e281409

added a half-assed automatic layout thing
author John Tsiombikas <nuclear@siggraph.org>
date Sat, 28 May 2011 22:31:51 +0300
parents 17f5ff624da3
children
line diff
     1.1 --- a/src/imtk.c	Sat Apr 30 06:12:51 2011 +0300
     1.2 +++ b/src/imtk.c	Sat May 28 22:31:51 2011 +0300
     1.3 @@ -12,7 +12,6 @@
     1.4  #include "state.h"
     1.5  #include "draw.h"
     1.6  
     1.7 -
     1.8  void imtk_post_redisplay(void)
     1.9  {
    1.10  	glutPostRedisplay();
    1.11 @@ -69,68 +68,3 @@
    1.12  	imtk_draw_string(x, y + 14, str);
    1.13  	imtk_layout_advance(imtk_string_size(str), 12);
    1.14  }
    1.15 -
    1.16 -
    1.17 -static int box[4], span[4];
    1.18 -static int spacing;
    1.19 -static int layout;
    1.20 -
    1.21 -void imtk_layout_start(int x, int y, int sp, int dir)
    1.22 -{
    1.23 -	box[0] = span[0] = x;
    1.24 -	box[1] = span[1] = y;
    1.25 -	box[2] = box[3] = span[2] = span[3] = 0;
    1.26 -	spacing = sp;
    1.27 -	layout = dir;
    1.28 -}
    1.29 -
    1.30 -void imtk_layout_dir(int dir)
    1.31 -{
    1.32 -	layout = dir;
    1.33 -	if(dir == IMTK_VERTICAL) {
    1.34 -		imtk_layout_newline();
    1.35 -	}
    1.36 -}
    1.37 -
    1.38 -void imtk_layout_advance(int width, int height)
    1.39 -{
    1.40 -	int max_span_y, max_box_y;
    1.41 -
    1.42 -	span[2] += width + spacing;
    1.43 -
    1.44 -	if(height > span[3]) {
    1.45 -		span[3] = height;
    1.46 -	}
    1.47 -
    1.48 -	max_span_y = span[1] + span[3];
    1.49 -	max_box_y = box[1] + box[3];
    1.50 -
    1.51 -	if(max_span_y > max_box_y) {
    1.52 -		box[3] = max_span_y - box[1];
    1.53 -	}
    1.54 -	if(span[2] > box[2]) {
    1.55 -		box[2] = span[2];
    1.56 -	}
    1.57 -
    1.58 -	if(layout == IMTK_VERTICAL) {
    1.59 -		imtk_layout_newline();
    1.60 -	}
    1.61 -}
    1.62 -
    1.63 -void imtk_layout_newline(void)
    1.64 -{
    1.65 -	span[0] = box[0];
    1.66 -	span[1] = box[1] + box[3] + spacing;
    1.67 -	span[2] = span[3] = 0;
    1.68 -}
    1.69 -
    1.70 -void imtk_layout_get_pos(int *x, int *y)
    1.71 -{
    1.72 -	*x = span[0] + span[2];
    1.73 -	*y = span[1];
    1.74 -}
    1.75 -
    1.76 -void imtk_layout_get_bounds(int *bbox)
    1.77 -{
    1.78 -	memcpy(bbox, box, sizeof box);
    1.79 -}