changeset 380:fcb52d773ed2

Implement tests for setting background color on render boxes. Calculate full font height correctly.
author mhessling@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 29 Apr 2003 10:54:09 +0000
parents 2e5f3cb38d19
children 0df4ad2ac083
files dwtest.c
diffstat 1 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/dwtest.c	Tue Apr 29 10:52:47 2003 +0000
+++ b/dwtest.c	Tue Apr 29 10:54:09 2003 +0000
@@ -227,7 +227,7 @@
 void draw_file( int row, int col )
 {
 	char buf[10];
-	int i,y;
+	int i,y,fileline;
 	char *pLine;
 
 	if ( current_file )
@@ -235,10 +235,13 @@
 		dw_color_foreground_set(DW_CLR_WHITE);
 		dw_draw_rect(0, text1pm, TRUE, 0, 0, DW_PIXMAP_WIDTH(text1pm), DW_PIXMAP_HEIGHT(text1pm));
 		dw_draw_rect(0, text2pm, TRUE, 0, 0, DW_PIXMAP_WIDTH(text2pm), DW_PIXMAP_HEIGHT(text2pm));
+
 		for ( i = 0;(i < rows) && (i+row < num_lines); i++)
 		{
+			fileline = i + row - 1;
 			y = i*(font_height+font_gap);
-			dw_color_foreground_set( i );
+			dw_color_background_set( 1 + (fileline % 15) );
+			dw_color_foreground_set( fileline % 16 );
 			sprintf( buf, "%6.6d", i+row );
 			dw_draw_text( 0, text1pm, 0, y, buf);
 			pLine = lp[i+row];
@@ -331,7 +334,7 @@
 	cols = width / font_width;
 
 	/* Create new pixmaps with the current sizes */
-	text1pm = dw_pixmap_new(textbox1, (font_width*(width1+1)), height+1, depth);
+	text1pm = dw_pixmap_new(textbox1, (font_width*(width1)), height, depth);
 	text2pm = dw_pixmap_new(textbox2, width, height, depth);
 
 	/* Destroy the old pixmaps */
@@ -491,13 +494,16 @@
 	/* create render box for number pixmap */
 	textbox1 = dw_render_new( 100 );
 	dw_window_set_font(textbox1, FIXEDFONT);
-	dw_font_text_extents(textbox1, NULL, "O", &font_width, &font_height);
+	dw_font_text_extents(textbox1, NULL, "Og", &font_width, &font_height);
+	font_width = font_width / 2;
 	vscrollbox = dw_box_new(BOXVERT, 0);
 	dw_box_pack_start(vscrollbox, textbox1, font_width*width1, font_height*rows, FALSE, TRUE, 0);
 	dw_box_pack_start(vscrollbox, 0, (font_width*(width1+1)), SCROLLBARWIDTH, FALSE, FALSE, 0);
 	dw_box_pack_start(pagebox, vscrollbox, 0, 0, FALSE, TRUE, 0);
 
-	/* create render box for gap pixmap */
+	/* pack empty space 1 character wide */
+	dw_box_pack_start(pagebox, 0, font_width, 0, FALSE, TRUE, 0);
+
 	/* create box for filecontents and horz scrollbar */
 	textboxA = dw_box_new( BOXVERT,0 );
 	dw_box_pack_start( pagebox, textboxA, 0, 0, TRUE, TRUE, 0);