imtk

changeset 24:f416d8def7ef

can't remember
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 05 Sep 2011 03:43:30 +0300
parents 4c2b3e281409
children bb358d8c4903
files src/layout.c test.c
diffstat 2 files changed, 14 insertions(+), 5 deletions(-) [+]
line diff
     1.1 --- a/src/layout.c	Sat May 28 22:31:51 2011 +0300
     1.2 +++ b/src/layout.c	Mon Sep 05 03:43:30 2011 +0300
     1.3 @@ -1,4 +1,5 @@
     1.4  #include <string.h>
     1.5 +#include <assert.h>
     1.6  #include "imtk.h"
     1.7  
     1.8  struct layout {
     1.9 @@ -31,15 +32,16 @@
    1.10  		return -1;
    1.11  	}
    1.12  	top--;
    1.13 +	return 0;
    1.14  }
    1.15  
    1.16 -void imtk_layout_start(int x, int y, int sp, int dir)
    1.17 +void imtk_layout_start(int x, int y)
    1.18  {
    1.19  	st[top].box[0] = st[top].span[0] = x;
    1.20  	st[top].box[1] = st[top].span[1] = y;
    1.21  	st[top].box[2] = st[top].box[3] = st[top].span[2] = st[top].span[3] = 0;
    1.22 -	st[top].spacing = sp;
    1.23 -	st[top].dir = dir;
    1.24 +/*	st[top].spacing = sp;
    1.25 +	st[top].dir = dir;*/
    1.26  }
    1.27  
    1.28  void imtk_layout_dir(int dir)
    1.29 @@ -50,6 +52,11 @@
    1.30  	}
    1.31  }
    1.32  
    1.33 +void imtk_layout_spacing(int spacing)
    1.34 +{
    1.35 +	st[top].spacing = spacing;
    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 @@ -78,7 +85,7 @@
    1.42  void imtk_layout_newline(void)
    1.43  {
    1.44  	st[top].span[0] = st[top].box[0];
    1.45 -	st[top].span[1] = st[top].box[1] + st[top].box[3] + spacing;
    1.46 +	st[top].span[1] = st[top].box[1] + st[top].box[3] + st[top].spacing;
    1.47  	st[top].span[2] = st[top].span[3] = 0;
    1.48  }
    1.49  
     2.1 --- a/test.c	Sat May 28 22:31:51 2011 +0300
     2.2 +++ b/test.c	Mon Sep 05 03:43:30 2011 +0300
     2.3 @@ -125,7 +125,9 @@
     2.4  	char *itemlist;
     2.5  
     2.6  	imtk_begin();
     2.7 -	imtk_layout_start(30, 50, 10, IMTK_VERTICAL);
     2.8 +	imtk_layout_start(30, 50);
     2.9 +	imtk_layout_spacing(10);
    2.10 +	imtk_layout_dir(IMTK_VERTICAL);
    2.11  
    2.12  	/*glBegin(GL_QUADS);
    2.13  	glColor3f(0.6, 0.6, 0.6);