comparison dwtest.c @ 229:4166c18586e5

Fixed number of lines calculation in configure_event() taking into account font_gap... and make sure draw_file() does not exceed the number of lines in the buffer.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Wed, 05 Feb 2003 06:48:35 +0000
parents 5e6d8e024214
children a3775f5b877f
comparison
equal deleted inserted replaced
228:326e114923cf 229:4166c18586e5
96 if ( current_file ) 96 if ( current_file )
97 { 97 {
98 dw_color_foreground_set(DW_CLR_WHITE); 98 dw_color_foreground_set(DW_CLR_WHITE);
99 dw_draw_rect(0, text1pm, TRUE, 0, 0, DW_PIXMAP_WIDTH(text1pm), DW_PIXMAP_HEIGHT(text1pm)); 99 dw_draw_rect(0, text1pm, TRUE, 0, 0, DW_PIXMAP_WIDTH(text1pm), DW_PIXMAP_HEIGHT(text1pm));
100 dw_draw_rect(0, text2pm, TRUE, 0, 0, DW_PIXMAP_WIDTH(text2pm), DW_PIXMAP_HEIGHT(text2pm)); 100 dw_draw_rect(0, text2pm, TRUE, 0, 0, DW_PIXMAP_WIDTH(text2pm), DW_PIXMAP_HEIGHT(text2pm));
101 for ( i = 0;(i < rows); i++) 101 for ( i = 0;(i < rows) && (i+row < num_lines); i++)
102 { 102 {
103 y = i*(font_height+font_gap); 103 y = i*(font_height+font_gap);
104 dw_color_foreground_set( i ); 104 dw_color_foreground_set( i );
105 sprintf( buf, "%6.6d", i+row ); 105 sprintf( buf, "%6.6d", i+row );
106 dw_draw_text( NULL, text1pm, 0, y, buf); 106 dw_draw_text( NULL, text1pm, 0, y, buf);
178 { 178 {
179 HPIXMAP old1 = text1pm, old2 = text2pm; 179 HPIXMAP old1 = text1pm, old2 = text2pm;
180 unsigned long height1; 180 unsigned long height1;
181 int depth = dw_color_depth(); 181 int depth = dw_color_depth();
182 182
183 rows = height / font_height; 183 rows = height / (font_height+font_gap);
184 cols = width / font_width; 184 cols = width / font_width;
185 185
186 dw_window_get_pos_size(textbox1, NULL, NULL, NULL, &height1); 186 dw_window_get_pos_size(textbox1, NULL, NULL, NULL, &height1);
187 187
188 /* Create new pixmaps with the current sizes */ 188 /* Create new pixmaps with the current sizes */