comparison dwtest.c @ 385:761e5fddffca

Remove font_gap to make testing of render box drawing simpler.
author mhessling@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 01 May 2003 09:07:27 +0000
parents fcb52d773ed2
children 2059f18e9c20
comparison
equal deleted inserted replaced
384:cbf4df4bc2f1 385:761e5fddffca
57 HPIXMAP text1pm,text2pm; 57 HPIXMAP text1pm,text2pm;
58 unsigned long fileicon,foldericon,mle_point=-1; 58 unsigned long fileicon,foldericon,mle_point=-1;
59 59
60 int font_width = 8; 60 int font_width = 8;
61 int font_height=12; 61 int font_height=12;
62 int font_gap = 2;
63 int rows=100,width1=6,cols=80; 62 int rows=100,width1=6,cols=80;
64 char *current_file = NULL; 63 char *current_file = NULL;
65 int timerid; 64 int timerid;
66 int num_lines=0; 65 int num_lines=0;
67 int max_linewidth=0; 66 int max_linewidth=0;
237 dw_draw_rect(0, text2pm, TRUE, 0, 0, DW_PIXMAP_WIDTH(text2pm), DW_PIXMAP_HEIGHT(text2pm)); 236 dw_draw_rect(0, text2pm, TRUE, 0, 0, DW_PIXMAP_WIDTH(text2pm), DW_PIXMAP_HEIGHT(text2pm));
238 237
239 for ( i = 0;(i < rows) && (i+row < num_lines); i++) 238 for ( i = 0;(i < rows) && (i+row < num_lines); i++)
240 { 239 {
241 fileline = i + row - 1; 240 fileline = i + row - 1;
242 y = i*(font_height+font_gap); 241 y = i*font_height;
243 dw_color_background_set( 1 + (fileline % 15) ); 242 dw_color_background_set( 1 + (fileline % 15) );
244 dw_color_foreground_set( fileline % 16 ); 243 dw_color_foreground_set( fileline % 16 );
245 sprintf( buf, "%6.6d", i+row ); 244 sprintf( buf, "%6.6d", i+row );
246 dw_draw_text( 0, text1pm, 0, y, buf); 245 dw_draw_text( 0, text1pm, 0, y, buf);
247 pLine = lp[i+row]; 246 pLine = lp[i+row];
328 int DWSIGNAL configure_event(HWND hwnd, int width, int height, void *data) 327 int DWSIGNAL configure_event(HWND hwnd, int width, int height, void *data)
329 { 328 {
330 HPIXMAP old1 = text1pm, old2 = text2pm; 329 HPIXMAP old1 = text1pm, old2 = text2pm;
331 int depth = dw_color_depth(); 330 int depth = dw_color_depth();
332 331
333 rows = height / (font_height+font_gap); 332 rows = height / font_height;
334 cols = width / font_width; 333 cols = width / font_width;
335 334
336 /* Create new pixmaps with the current sizes */ 335 /* Create new pixmaps with the current sizes */
337 text1pm = dw_pixmap_new(textbox1, (font_width*(width1)), height, depth); 336 text1pm = dw_pixmap_new(textbox1, (font_width*(width1)), height, depth);
338 text2pm = dw_pixmap_new(textbox2, width, height, depth); 337 text2pm = dw_pixmap_new(textbox2, width, height, depth);
492 dw_box_pack_start( notebookbox2, status1, 100, 20, TRUE, FALSE, 1); 491 dw_box_pack_start( notebookbox2, status1, 100, 20, TRUE, FALSE, 1);
493 492
494 /* create render box for number pixmap */ 493 /* create render box for number pixmap */
495 textbox1 = dw_render_new( 100 ); 494 textbox1 = dw_render_new( 100 );
496 dw_window_set_font(textbox1, FIXEDFONT); 495 dw_window_set_font(textbox1, FIXEDFONT);
497 dw_font_text_extents(textbox1, NULL, "Og", &font_width, &font_height); 496 dw_font_text_extents(textbox1, NULL, "(g", &font_width, &font_height);
498 font_width = font_width / 2; 497 font_width = font_width / 2;
499 vscrollbox = dw_box_new(BOXVERT, 0); 498 vscrollbox = dw_box_new(BOXVERT, 0);
500 dw_box_pack_start(vscrollbox, textbox1, font_width*width1, font_height*rows, FALSE, TRUE, 0); 499 dw_box_pack_start(vscrollbox, textbox1, font_width*width1, font_height*rows, FALSE, TRUE, 0);
501 dw_box_pack_start(vscrollbox, 0, (font_width*(width1+1)), SCROLLBARWIDTH, FALSE, FALSE, 0); 500 dw_box_pack_start(vscrollbox, 0, (font_width*(width1+1)), SCROLLBARWIDTH, FALSE, FALSE, 0);
502 dw_box_pack_start(pagebox, vscrollbox, 0, 0, FALSE, TRUE, 0); 501 dw_box_pack_start(pagebox, vscrollbox, 0, 0, FALSE, TRUE, 0);
522 dw_box_pack_start(vscrollbox, vscrollbar, SCROLLBARWIDTH, 100, FALSE, TRUE, 0); 521 dw_box_pack_start(vscrollbox, vscrollbar, SCROLLBARWIDTH, 100, FALSE, TRUE, 0);
523 /* Pack an area of empty space 14x14 pixels */ 522 /* Pack an area of empty space 14x14 pixels */
524 dw_box_pack_start(vscrollbox, 0, SCROLLBARWIDTH, SCROLLBARWIDTH, FALSE, FALSE, 0); 523 dw_box_pack_start(vscrollbox, 0, SCROLLBARWIDTH, SCROLLBARWIDTH, FALSE, FALSE, 0);
525 dw_box_pack_start(pagebox, vscrollbox, 0, 0, FALSE, TRUE, 0); 524 dw_box_pack_start(pagebox, vscrollbox, 0, 0, FALSE, TRUE, 0);
526 525
527 text1pm = dw_pixmap_new( textbox1, (font_width*(width1+1)), font_height*rows, depth ); 526 text1pm = dw_pixmap_new( textbox1, font_width*width1, font_height*rows, depth );
528 text2pm = dw_pixmap_new( textbox2, font_width*cols, font_height*rows, depth ); 527 text2pm = dw_pixmap_new( textbox2, font_width*cols, font_height*rows, depth );
529 528
530 dw_messagebox("DWTest", "Width: %d Height: %d\n", font_width, font_height); 529 dw_messagebox("DWTest", "Width: %d Height: %d\n", font_width, font_height);
531 dw_draw_rect(0, text1pm, TRUE, 0, 0, font_width*width1, font_height*rows); 530 dw_draw_rect(0, text1pm, TRUE, 0, 0, font_width*width1, font_height*rows);
532 dw_draw_rect(0, text2pm, TRUE, 0, 0, font_width*cols, font_height*rows); 531 dw_draw_rect(0, text2pm, TRUE, 0, 0, font_width*cols, font_height*rows);