mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Change the cell grid lines slightly
Grid lines will be generally be drawn by subtracting 0.5 from the x and y values apart from the left border of the first column cell has 0.5 added to the x value and the first row cell has 0.5 added to the top border y value. By doing this the overall dimensions does not change and all borders are visible.
This commit is contained in:
parent
9b582c386a
commit
60ff88041d
@ -106,13 +106,18 @@ gnc_header_draw_offscreen (GncHeader *header)
|
||||
header->height);
|
||||
|
||||
cr = cairo_create (header->surface);
|
||||
// Fill background color of header
|
||||
cairo_rectangle (cr, 0.5, 0.5, header->width - 1.0, header->height - 1.0);
|
||||
cairo_set_source_rgb (cr, bg_color->red, bg_color->green, bg_color->blue);
|
||||
cairo_fill_preserve (cr);
|
||||
|
||||
// Draw bottom horizontal line, makes bottom line thicker
|
||||
cairo_set_source_rgb (cr, fg_color->red, fg_color->green, fg_color->blue);
|
||||
cairo_move_to (cr, 0.5, header->height - 1.5);
|
||||
cairo_line_to (cr, header->width - 1.0, header->height - 1.5);
|
||||
cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
|
||||
cairo_set_line_width (cr, 1.0);
|
||||
cairo_stroke (cr);
|
||||
// cairo_set_line_width (cr, 1.0);
|
||||
|
||||
/*font = gnucash_register_font;*/
|
||||
|
||||
@ -157,7 +162,8 @@ gnc_header_draw_offscreen (GncHeader *header)
|
||||
continue;
|
||||
}
|
||||
|
||||
cairo_rectangle (cr, col_offset + 0.5, row_offset + 0.5, w, h);
|
||||
cairo_rectangle (cr, col_offset - 0.5, row_offset + 0.5, w, h);
|
||||
cairo_set_line_width (cr, 1.0);
|
||||
cairo_stroke (cr);
|
||||
|
||||
virt_loc.vcell_loc =
|
||||
@ -189,6 +195,7 @@ gnc_header_draw_offscreen (GncHeader *header)
|
||||
text_h = h - 2;
|
||||
cairo_save (cr);
|
||||
cairo_rectangle (cr, text_x, text_y, text_w, text_h);
|
||||
cairo_set_source_rgb (cr, fg_color->red, fg_color->green, fg_color->blue);
|
||||
cairo_clip (cr);
|
||||
cairo_move_to (cr, text_x, text_y);
|
||||
pango_cairo_show_layout (cr, layout);
|
||||
@ -374,10 +381,12 @@ gnc_header_resize_column (GncHeader *header, gint col, gint width)
|
||||
gnucash_cursor_configure (GNUCASH_CURSOR(sheet->cursor));
|
||||
gnc_item_edit_configure (gnucash_sheet_get_item_edit (sheet));
|
||||
|
||||
gnc_header_reconfigure (header);
|
||||
|
||||
gnucash_sheet_set_scroll_region (sheet);
|
||||
gnucash_sheet_update_adjustments (sheet);
|
||||
|
||||
gnc_header_reconfigure (header);
|
||||
//FIXME Not required? gnc_header_request_redraw (header);
|
||||
gnucash_sheet_redraw_all (sheet);
|
||||
}
|
||||
|
||||
@ -474,6 +483,7 @@ gnc_header_event (GtkWidget *widget, GdkEvent *event)
|
||||
header->resize_col_width);
|
||||
header->in_resize = FALSE;
|
||||
header->resize_col = -1;
|
||||
gnc_header_request_redraw (header);
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -342,7 +342,7 @@ draw_hatching (cairo_t *cr,
|
||||
cairo_move_to (cr, h_x, h_y);
|
||||
cairo_rel_line_to (cr, h_size, h_size);
|
||||
|
||||
cairo_rel_move_to (cr, -h_x, 0);
|
||||
cairo_move_to (cr, h_x , h_y + h_size);
|
||||
cairo_rel_line_to (cr, h_size, -h_size);
|
||||
cairo_stroke (cr);
|
||||
}
|
||||
@ -369,7 +369,7 @@ draw_divider_line (cairo_t *cr, VirtualLocation virt_loc,
|
||||
|
||||
cairo_set_source_rgb (cr, fg_color->red, fg_color->green, fg_color->blue);
|
||||
|
||||
cairo_set_line_width (cr, 3.0);
|
||||
cairo_set_line_width (cr, 2.0);
|
||||
cairo_move_to (cr, x, y + 0.5 + offset);
|
||||
cairo_rel_line_to (cr, width, 0);
|
||||
cairo_stroke (cr);
|
||||
@ -423,42 +423,41 @@ draw_cell (GnucashSheet *sheet,
|
||||
/* top */
|
||||
draw_cell_line (cr, bg_color,
|
||||
(borders.top >= borders.left ? x : x + 1.0),
|
||||
y + 0.5,
|
||||
(y == 0 ? y + 0.5 : y - 0.5),
|
||||
(borders.top >= borders.right ?
|
||||
x + width : x + width - 1),
|
||||
y + 0.5,
|
||||
(y == 0 ? y + 0.5 : y - 0.5),
|
||||
borders.top);
|
||||
|
||||
/* bottom */
|
||||
draw_cell_line (cr, bg_color,
|
||||
(borders.bottom >= borders.left ? x : x + 1),
|
||||
y + height + 0.5,
|
||||
(borders.bottom >= borders.left ? x : x + 1.0),
|
||||
y + height - 0.5,
|
||||
(borders.bottom >= borders.right ?
|
||||
x + width : x + width - 1),
|
||||
y + height + 0.5,
|
||||
y + height - 0.5,
|
||||
borders.bottom);
|
||||
|
||||
/* left */
|
||||
draw_cell_line (cr, bg_color,
|
||||
x + 0.5,
|
||||
(borders.left > borders.top ? y : y + 1),
|
||||
x + 0.5,
|
||||
(x == 0 ? x + 0.5 : x - 0.5),
|
||||
(borders.left > borders.top ? y : y),
|
||||
(x == 0 ? x + 0.5 : x - 0.5),
|
||||
(borders.left > borders.bottom ?
|
||||
y + height : y + height - 1),
|
||||
y + height : y + height),
|
||||
borders.left);
|
||||
|
||||
/* right */
|
||||
draw_cell_line (cr, bg_color,
|
||||
x + width + 0.5,
|
||||
(borders.right > borders.top ? y : y + 1),
|
||||
x + width + 0.5,
|
||||
x + width - 0.5,
|
||||
(borders.right > borders.top ? y : y),
|
||||
x + width - 0.5,
|
||||
(borders.right > borders.bottom ?
|
||||
y + height : y + height - 1),
|
||||
y + height : y + height),
|
||||
borders.right);
|
||||
|
||||
if (hatching)
|
||||
draw_hatching (cr,
|
||||
x, y, width, height);
|
||||
draw_hatching (cr, x, y, width, height);
|
||||
|
||||
/* dividing line upper (red) */
|
||||
fg_color = &gn_red;
|
||||
@ -561,7 +560,7 @@ draw_cell (GnucashSheet *sheet,
|
||||
|
||||
|
||||
|
||||
cairo_move_to (cr, rect.x + x_offset, rect.y + 1);
|
||||
cairo_move_to (cr, rect.x + x_offset, rect.y - 1); //FIXME Not sure about this change from + 1
|
||||
pango_cairo_show_layout (cr, layout);
|
||||
|
||||
cairo_restore (cr);
|
||||
|
Loading…
Reference in New Issue
Block a user