mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Merge branch 'gtk3-update4' of https://github.com/Bob-IT/gnucash
This commit is contained in:
commit
88e365d2d1
@ -742,14 +742,6 @@ gnc_split_register_get_border (VirtualLocation virt_loc,
|
||||
cursor_class =
|
||||
gnc_split_register_cursor_name_to_class (vcell->cellblock->cursor_name);
|
||||
|
||||
if (cursor_class == CURSOR_CLASS_TRANS &&
|
||||
virt_loc.phys_col_offset == vcell->cellblock->start_col)
|
||||
borders->left = CELL_BORDER_LINE_NONE;
|
||||
|
||||
if (cursor_class == CURSOR_CLASS_TRANS &&
|
||||
virt_loc.phys_col_offset == vcell->cellblock->stop_col)
|
||||
borders->right = CELL_BORDER_LINE_NONE;
|
||||
|
||||
if (cursor_class == CURSOR_CLASS_SPLIT)
|
||||
{
|
||||
borders->top = CELL_BORDER_LINE_LIGHT;
|
||||
@ -758,9 +750,9 @@ gnc_split_register_get_border (VirtualLocation virt_loc,
|
||||
borders->right = MIN (borders->right, CELL_BORDER_LINE_LIGHT);
|
||||
|
||||
if (virt_loc.phys_col_offset == vcell->cellblock->start_col)
|
||||
borders->left = CELL_BORDER_LINE_LIGHT;
|
||||
borders->left = CELL_BORDER_LINE_NORMAL;
|
||||
if (virt_loc.phys_col_offset == vcell->cellblock->stop_col)
|
||||
borders->right = CELL_BORDER_LINE_LIGHT;
|
||||
borders->right = CELL_BORDER_LINE_NORMAL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,10 +51,15 @@ enum
|
||||
static gboolean
|
||||
gnc_header_draw (GtkWidget *header, cairo_t *cr)
|
||||
{
|
||||
cairo_save (cr);
|
||||
cairo_set_source_surface (cr, GNC_HEADER(header)->surface, 0, 0);
|
||||
GnucashSheet *sheet = GNC_HEADER(header)->sheet;
|
||||
GdkWindow *sheet_layout_win = gtk_layout_get_bin_window (GTK_LAYOUT(sheet));
|
||||
gint x, y;
|
||||
|
||||
// use this to get the scroll x value to align the header
|
||||
gdk_window_get_position (sheet_layout_win, &x, &y);
|
||||
|
||||
cairo_set_source_surface (cr, GNC_HEADER(header)->surface, x, 0);
|
||||
cairo_paint (cr);
|
||||
cairo_restore (cr);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -101,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;*/
|
||||
|
||||
@ -152,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 =
|
||||
@ -184,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);
|
||||
@ -369,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);
|
||||
}
|
||||
|
||||
@ -450,7 +464,6 @@ gnc_header_event (GtkWidget *widget, GdkEvent *event)
|
||||
header->resize_col_width = cd->pixel_width;
|
||||
header->resize_x = x;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case GDK_BUTTON_RELEASE:
|
||||
@ -469,8 +482,8 @@ 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;
|
||||
}
|
||||
|
||||
@ -501,14 +514,12 @@ gnc_header_event (GtkWidget *widget, GdkEvent *event)
|
||||
header->resize_col = -1;
|
||||
gnc_header_auto_resize_column (header, resize_col);
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -557,7 +568,6 @@ gnc_header_set_property (GObject *object,
|
||||
case PROP_SHEET:
|
||||
header->sheet = GNUCASH_SHEET (g_value_get_object (value));
|
||||
gtk_scrollable_set_hadjustment (GTK_SCROLLABLE(layout), header->sheet->hadj);
|
||||
|
||||
needs_update = TRUE;
|
||||
break;
|
||||
case PROP_CURSOR_NAME:
|
||||
@ -591,6 +601,9 @@ gnc_header_init (GncHeader *header)
|
||||
header->width = 400;
|
||||
header->style = NULL;
|
||||
|
||||
// This sets a style class for when Gtk+ version is less than 3.20
|
||||
gnc_widget_set_css_name (GTK_WIDGET(header), "header");
|
||||
|
||||
gtk_widget_add_events(GTK_WIDGET(header), (GDK_EXPOSURE_MASK
|
||||
| GDK_BUTTON_PRESS_MASK
|
||||
| GDK_BUTTON_RELEASE_MASK
|
||||
@ -609,6 +622,10 @@ gnc_header_class_init (GncHeaderClass *header_class)
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (header_class);
|
||||
GtkWidgetClass *item_class = GTK_WIDGET_CLASS (header_class);
|
||||
|
||||
#if GTK_CHECK_VERSION(3,20,0)
|
||||
gtk_widget_class_set_css_name (GTK_WIDGET_CLASS(header_class), "header");
|
||||
#endif
|
||||
|
||||
parent_class = g_type_class_peek_parent (header_class);
|
||||
|
||||
object_class->finalize = gnc_header_finalize;
|
||||
|
@ -84,6 +84,12 @@ gnc_item_edit_get_pixel_coords (GncItemEdit *item_edit,
|
||||
item_edit->virt_loc.phys_col_offset,
|
||||
x, y, w, h);
|
||||
|
||||
// alter cell size of first column
|
||||
if (item_edit->virt_loc.phys_col_offset == 0)
|
||||
{
|
||||
*x = *x + 1;
|
||||
*w = *w - 1;
|
||||
}
|
||||
*x += xd;
|
||||
*y += yd;
|
||||
}
|
||||
@ -101,6 +107,7 @@ gnc_item_edit_update (GncItemEdit *item_edit)
|
||||
{
|
||||
gint x, y, w, h;
|
||||
|
||||
//FIXME this does not appear to be realiable, widget does not always move to correct place
|
||||
gnc_item_edit_get_pixel_coords (item_edit, &x, &y, &w, &h);
|
||||
gtk_layout_move (GTK_LAYOUT(item_edit->sheet),
|
||||
GTK_WIDGET(item_edit), x, y);
|
||||
@ -160,7 +167,8 @@ gnc_item_edit_init (GncItemEdit *item_edit)
|
||||
|
||||
item_edit->popup_toggle.ebox = NULL;
|
||||
item_edit->popup_toggle.tbutton = NULL;
|
||||
item_edit->popup_toggle.arrow = NULL;
|
||||
item_edit->popup_toggle.arrow_up = NULL;
|
||||
item_edit->popup_toggle.arrow_down = NULL;
|
||||
item_edit->popup_toggle.signals_connected = FALSE;
|
||||
|
||||
item_edit->popup_item = NULL;
|
||||
@ -415,7 +423,7 @@ gnc_item_edit_get_preferred_width (GtkWidget *widget,
|
||||
{
|
||||
gint x, y, w, h;
|
||||
gnc_item_edit_get_pixel_coords (GNC_ITEM_EDIT (widget), &x, &y, &w, &h);
|
||||
*minimal_width = *natural_width = w + 1;
|
||||
*minimal_width = *natural_width = w - 1;
|
||||
}
|
||||
|
||||
|
||||
@ -426,7 +434,7 @@ gnc_item_edit_get_preferred_height (GtkWidget *widget,
|
||||
{
|
||||
gint x, y, w, h;
|
||||
gnc_item_edit_get_pixel_coords (GNC_ITEM_EDIT (widget), &x, &y, &w, &h);
|
||||
*minimal_width = *natural_width = h + 1;
|
||||
*minimal_width = *natural_width = h - 1;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -438,6 +446,10 @@ gnc_item_edit_class_init (GncItemEditClass *gnc_item_edit_class)
|
||||
GObjectClass *object_class;
|
||||
GtkWidgetClass *widget_class;
|
||||
|
||||
#if GTK_CHECK_VERSION(3,20,0)
|
||||
gtk_widget_class_set_css_name (GTK_WIDGET_CLASS(gnc_item_edit_class), "cursor");
|
||||
#endif
|
||||
|
||||
gnc_item_edit_parent_class = g_type_class_peek_parent (gnc_item_edit_class);
|
||||
|
||||
object_class = G_OBJECT_CLASS (gnc_item_edit_class);
|
||||
@ -495,6 +507,7 @@ GtkWidget *
|
||||
gnc_item_edit_new (GnucashSheet *sheet)
|
||||
{
|
||||
char *hpad_str, *vpad_str, *entry_css;
|
||||
GtkWidget *box;
|
||||
GtkStyleContext *stylecontext;
|
||||
GtkCssProvider *provider;
|
||||
GncItemEdit *item_edit =
|
||||
@ -505,6 +518,9 @@ gnc_item_edit_new (GnucashSheet *sheet)
|
||||
NULL);
|
||||
gtk_layout_put (GTK_LAYOUT(sheet), GTK_WIDGET(item_edit), 0, 0);
|
||||
|
||||
// This sets a style class for when Gtk+ version is less than 3.20
|
||||
gnc_widget_set_css_name (GTK_WIDGET(item_edit), "cursor");
|
||||
|
||||
/* Create the text entry */
|
||||
item_edit->editor = gtk_entry_new();
|
||||
sheet->entry = item_edit->editor;
|
||||
@ -527,13 +543,17 @@ gnc_item_edit_new (GnucashSheet *sheet)
|
||||
/* Create the popup button
|
||||
It will only be displayed when the cell being edited provides
|
||||
a popup item (like a calendar or account list) */
|
||||
item_edit->popup_toggle.arrow = gtk_image_new_from_icon_name ("go-down", GTK_ICON_SIZE_BUTTON);
|
||||
item_edit->popup_toggle.arrow_down = gtk_image_new_from_icon_name ("go-down", GTK_ICON_SIZE_BUTTON);
|
||||
item_edit->popup_toggle.arrow_up = gtk_image_new_from_icon_name ("go-up", GTK_ICON_SIZE_BUTTON);
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_box_pack_start (GTK_BOX(box), GTK_WIDGET(item_edit->popup_toggle.arrow_down), FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX(box), GTK_WIDGET(item_edit->popup_toggle.arrow_up),FALSE, FALSE, 0);
|
||||
|
||||
item_edit->popup_toggle.tbutton = gtk_toggle_button_new();
|
||||
gtk_toggle_button_set_mode (
|
||||
GTK_TOGGLE_BUTTON (item_edit->popup_toggle.tbutton), FALSE);
|
||||
gtk_container_add(GTK_CONTAINER(item_edit->popup_toggle.tbutton),
|
||||
GTK_WIDGET(item_edit->popup_toggle.arrow));
|
||||
gtk_container_add(GTK_CONTAINER(item_edit->popup_toggle.tbutton), GTK_WIDGET(box));
|
||||
|
||||
/* Force padding on the button to
|
||||
1. keep it small
|
||||
@ -556,6 +576,8 @@ gnc_item_edit_new (GnucashSheet *sheet)
|
||||
FALSE, TRUE, 0);
|
||||
gtk_widget_show_all(GTK_WIDGET(item_edit));
|
||||
|
||||
gtk_widget_hide (GTK_WIDGET(item_edit->popup_toggle.arrow_up));
|
||||
|
||||
return GTK_WIDGET(item_edit);
|
||||
}
|
||||
|
||||
@ -564,11 +586,11 @@ void
|
||||
gnc_item_edit_show_popup (GncItemEdit *item_edit)
|
||||
{
|
||||
GtkToggleButton *toggle;
|
||||
GtkAdjustment *vadj;
|
||||
GtkAdjustment *vadj, *hadj;
|
||||
GtkAllocation alloc;
|
||||
GnucashSheet *sheet;
|
||||
gint x, y, w, h;
|
||||
gint y_offset;
|
||||
gint y_offset, x_offset;
|
||||
gint popup_x, popup_y;
|
||||
gint popup_w;
|
||||
gint popup_h;
|
||||
@ -591,8 +613,10 @@ gnc_item_edit_show_popup (GncItemEdit *item_edit)
|
||||
view_width = alloc.width;
|
||||
|
||||
vadj = gtk_scrollable_get_vadjustment(GTK_SCROLLABLE(sheet));
|
||||
hadj = gtk_scrollable_get_hadjustment(GTK_SCROLLABLE(sheet));
|
||||
|
||||
y_offset = gtk_adjustment_get_value(vadj);
|
||||
x_offset = gtk_adjustment_get_value(hadj);
|
||||
gnc_item_edit_get_pixel_coords (item_edit, &x, &y, &w, &h);
|
||||
|
||||
popup_x = x;
|
||||
@ -602,7 +626,7 @@ gnc_item_edit_show_popup (GncItemEdit *item_edit)
|
||||
|
||||
if (up_height > down_height)
|
||||
{
|
||||
popup_y = y_offset;
|
||||
popup_y = y + y_offset;
|
||||
popup_h = up_height;
|
||||
}
|
||||
else
|
||||
@ -611,7 +635,7 @@ gnc_item_edit_show_popup (GncItemEdit *item_edit)
|
||||
popup_h = down_height;
|
||||
}
|
||||
|
||||
popup_max_width = view_width - popup_x;
|
||||
popup_max_width = view_width - popup_x + x_offset;
|
||||
|
||||
if (item_edit->get_popup_height)
|
||||
popup_h = item_edit->get_popup_height
|
||||
@ -626,11 +650,13 @@ gnc_item_edit_show_popup (GncItemEdit *item_edit)
|
||||
else
|
||||
popup_w = -1;
|
||||
|
||||
if (up_height > down_height)
|
||||
popup_y = y - popup_h;
|
||||
|
||||
if (!gtk_widget_get_parent (item_edit->popup_item))
|
||||
gtk_layout_put (GTK_LAYOUT(sheet), item_edit->popup_item,
|
||||
popup_x, popup_y);
|
||||
gtk_widget_set_size_request(item_edit->popup_item, popup_w, popup_h);
|
||||
// FIXME what about the GtkAnchorType that the GNOME_CANVAS_ITEM used ?
|
||||
|
||||
toggle = GTK_TOGGLE_BUTTON(item_edit->popup_toggle.tbutton);
|
||||
|
||||
@ -641,7 +667,8 @@ gnc_item_edit_show_popup (GncItemEdit *item_edit)
|
||||
unblock_toggle_signals (item_edit);
|
||||
}
|
||||
|
||||
item_edit->popup_toggle.arrow = gtk_image_new_from_icon_name ("go-up", GTK_ICON_SIZE_BUTTON);
|
||||
gtk_widget_hide (item_edit->popup_toggle.arrow_down);
|
||||
gtk_widget_show (item_edit->popup_toggle.arrow_up);
|
||||
|
||||
if (item_edit->popup_set_focus)
|
||||
item_edit->popup_set_focus (item_edit->popup_item,
|
||||
@ -663,9 +690,11 @@ gnc_item_edit_show_popup (GncItemEdit *item_edit)
|
||||
{
|
||||
popup_x -= popup_width - popup_max_width;
|
||||
popup_x = MAX (0, popup_x);
|
||||
gtk_layout_move (GTK_LAYOUT(sheet), item_edit->popup_item,
|
||||
popup_x, popup_y);
|
||||
}
|
||||
else
|
||||
popup_x = x;
|
||||
|
||||
gtk_layout_move (GTK_LAYOUT(sheet), item_edit->popup_item, popup_x, popup_y);
|
||||
}
|
||||
}
|
||||
|
||||
@ -684,7 +713,8 @@ gnc_item_edit_hide_popup (GncItemEdit *item_edit)
|
||||
|
||||
gtk_container_remove (GTK_CONTAINER(item_edit->sheet), item_edit->popup_item);
|
||||
|
||||
item_edit->popup_toggle.arrow = gtk_image_new_from_icon_name ("go-down", GTK_ICON_SIZE_BUTTON);
|
||||
gtk_widget_hide (item_edit->popup_toggle.arrow_up);
|
||||
gtk_widget_show (item_edit->popup_toggle.arrow_down);
|
||||
|
||||
gtk_toggle_button_set_active
|
||||
(GTK_TOGGLE_BUTTON(item_edit->popup_toggle.tbutton), FALSE);
|
||||
|
@ -61,7 +61,8 @@ struct _PopupToggle
|
||||
{
|
||||
GtkWidget *ebox;
|
||||
GtkWidget *tbutton;
|
||||
GtkWidget *arrow;
|
||||
GtkWidget *arrow_up;
|
||||
GtkWidget *arrow_down;
|
||||
gboolean signals_connected;
|
||||
};
|
||||
|
||||
|
@ -300,6 +300,10 @@ gnucash_register_class_init (GnucashRegisterClass *klass)
|
||||
|
||||
gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
#if GTK_CHECK_VERSION(3,20,0)
|
||||
gtk_widget_class_set_css_name (GTK_WIDGET_CLASS(klass), "register");
|
||||
#endif
|
||||
|
||||
register_parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
register_signals[ACTIVATE_CURSOR] =
|
||||
@ -346,6 +350,9 @@ gnucash_register_init (GnucashRegister *g_reg)
|
||||
gtk_widget_set_can_focus (GTK_WIDGET(table), FALSE);
|
||||
gtk_widget_set_can_default (GTK_WIDGET(table), FALSE);
|
||||
|
||||
// This sets a style class for when Gtk+ version is less than 3.20
|
||||
gnc_widget_set_css_name (GTK_WIDGET(g_reg), "register");
|
||||
|
||||
gtk_grid_set_row_homogeneous (GTK_GRID(table), FALSE);
|
||||
gtk_grid_set_column_homogeneous (GTK_GRID(table), FALSE);
|
||||
}
|
||||
@ -502,7 +509,7 @@ gnucash_register_create_widget (Table *table)
|
||||
gtk_widget_show (sheet);
|
||||
|
||||
scrollbar = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, GNUCASH_SHEET(sheet)->vadj);
|
||||
gtk_grid_attach (GTK_GRID(widget), GTK_WIDGET(scrollbar), 1, 0, 1, 4);
|
||||
gtk_grid_attach (GTK_GRID(widget), GTK_WIDGET(scrollbar), 1, 0, 1, 2);
|
||||
gtk_widget_set_hexpand (GTK_WIDGET(scrollbar), FALSE);
|
||||
gtk_widget_set_halign (GTK_WIDGET(scrollbar), GTK_ALIGN_FILL);
|
||||
gtk_widget_set_vexpand (GTK_WIDGET(scrollbar), TRUE);
|
||||
@ -511,7 +518,7 @@ gnucash_register_create_widget (Table *table)
|
||||
gtk_widget_show (scrollbar);
|
||||
|
||||
scrollbar = gtk_scrollbar_new (GTK_ORIENTATION_HORIZONTAL, GNUCASH_SHEET(sheet)->hadj);
|
||||
gtk_grid_attach (GTK_GRID(widget), GTK_WIDGET(scrollbar), 0, 3, 1, 1);
|
||||
gtk_grid_attach (GTK_GRID(widget), GTK_WIDGET(scrollbar), 0, 2, 1, 1);
|
||||
gtk_widget_set_hexpand (GTK_WIDGET(scrollbar), TRUE);
|
||||
gtk_widget_set_halign (GTK_WIDGET(scrollbar), GTK_ALIGN_FILL);
|
||||
gtk_widget_set_vexpand (GTK_WIDGET(scrollbar), FALSE);
|
||||
@ -538,7 +545,7 @@ gnucash_register_create_widget (Table *table)
|
||||
gtk_box_pack_start(GTK_BOX(box),
|
||||
GNUCASH_SHEET(sheet)->split_color, TRUE, TRUE, 0);
|
||||
|
||||
gtk_grid_attach (GTK_GRID(widget), GTK_WIDGET(box), 0, 4, 1, 1);
|
||||
gtk_grid_attach (GTK_GRID(widget), GTK_WIDGET(box), 0, 3, 1, 1);
|
||||
gtk_widget_set_hexpand (GTK_WIDGET(box), TRUE);
|
||||
gtk_widget_set_halign (GTK_WIDGET(box), GTK_ALIGN_FILL);
|
||||
gtk_widget_set_vexpand (GTK_WIDGET(box), TRUE);
|
||||
|
@ -338,11 +338,9 @@ draw_hatching (cairo_t *cr,
|
||||
cairo_set_source_rgb (cr, fg_color->red, fg_color->green, fg_color->blue);
|
||||
|
||||
cairo_rectangle (cr, h_x, h_y, h_size, h_size);
|
||||
|
||||
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_rel_move_to (cr, -h_size, 0);
|
||||
cairo_rel_line_to (cr, h_size, -h_size);
|
||||
cairo_stroke (cr);
|
||||
}
|
||||
@ -370,7 +368,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_move_to (cr, x, y + 0.5 + offset);
|
||||
cairo_move_to (cr, x, y - 0.5 + offset);
|
||||
cairo_rel_line_to (cr, width, 0);
|
||||
cairo_stroke (cr);
|
||||
}
|
||||
@ -423,42 +421,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.5,
|
||||
(borders.top >= borders.right ?
|
||||
x + width : x + width - 1),
|
||||
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;
|
||||
@ -700,19 +697,37 @@ gnucash_sheet_draw_cursor (GnucashCursor *cursor, cairo_t *cr)
|
||||
|
||||
fg_color = &gn_black;
|
||||
|
||||
/* draw the rectangle around the entire active
|
||||
* virtual *row */
|
||||
cairo_rectangle (cr, cursor->x - x + 0.5, cursor->y - y + 0.5,
|
||||
cursor->w - 1.0, cursor->h - 1.0);
|
||||
cairo_move_to (cr, cursor->x - x, cursor->y - y + cursor->h - 1.5);
|
||||
cairo_rel_line_to (cr, cursor->w, 0);
|
||||
/* draw the rectangle around the entire active virtual row - transaction rows only - double line */
|
||||
cairo_set_source_rgb (cr, fg_color->red, fg_color->green, fg_color->blue);
|
||||
if (cursor->x == 0)
|
||||
cairo_rectangle (cr, cursor->x - x + 0.5, cursor->y - y - 0.5, cursor->w - 1.0, cursor->h - 2.0);
|
||||
else
|
||||
cairo_rectangle (cr, cursor->x - x - 0.5, cursor->y - y - 0.5, cursor->w, cursor->h - 2.0);
|
||||
|
||||
cairo_set_line_width (cr, 1.0);
|
||||
cairo_stroke (cr);
|
||||
|
||||
cairo_rectangle (cr, cc->x - x + 0.5, cursor->y + cc->y - y + 0.5,
|
||||
cc->w - 1.0, cc->h - 1.0);
|
||||
// make the bottom line thicker
|
||||
cairo_move_to (cr, cursor->x - x + 0.5, cursor->y - y + cursor->h - 1.5);
|
||||
cairo_rel_line_to (cr, cursor->w, 0);
|
||||
cairo_stroke (cr);
|
||||
|
||||
/* draw rectangle around the active cell */
|
||||
cairo_set_source_rgb (cr, fg_color->red, fg_color->green, fg_color->blue);
|
||||
if (cc->x != 0)
|
||||
cairo_rectangle (cr, cc->x - x - 0.5, cursor->y + cc->y - y - 0.5, cc->w, cc->h);
|
||||
else
|
||||
cairo_rectangle (cr, cc->x - x + 0.5, cursor->y + cc->y - y - 0.5, cc->w - 1.0, cc->h);
|
||||
|
||||
cairo_set_line_width (cr, 1.0);
|
||||
cairo_stroke (cr);
|
||||
}
|
||||
|
||||
void
|
||||
gnc_widget_set_css_name (GtkWidget *widget, const char *name)
|
||||
{
|
||||
#if !GTK_CHECK_VERSION(3,20,0)
|
||||
GtkStyleContext *context = gtk_widget_get_style_context (widget);
|
||||
gtk_style_context_add_class (context, name);
|
||||
#endif
|
||||
}
|
||||
|
@ -2477,6 +2477,10 @@ gnucash_sheet_class_init (GnucashSheetClass *klass)
|
||||
gobject_class = G_OBJECT_CLASS (klass);
|
||||
widget_class = GTK_WIDGET_CLASS (klass);
|
||||
|
||||
#if GTK_CHECK_VERSION(3,20,0)
|
||||
gtk_widget_class_set_css_name (GTK_WIDGET_CLASS(klass), "sheet");
|
||||
#endif
|
||||
|
||||
sheet_parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
/* Method override */
|
||||
@ -2503,6 +2507,9 @@ gnucash_sheet_init (GnucashSheet *sheet)
|
||||
gtk_widget_set_can_focus (GTK_WIDGET(sheet), TRUE);
|
||||
gtk_widget_set_can_default (GTK_WIDGET(sheet), TRUE);
|
||||
|
||||
// This sets a style class for when Gtk+ version is less than 3.20
|
||||
gnc_widget_set_css_name (GTK_WIDGET(sheet), "sheet");
|
||||
|
||||
sheet->num_visible_blocks = 1;
|
||||
sheet->num_visible_phys_rows = 1;
|
||||
|
||||
|
@ -138,6 +138,7 @@ gboolean gnucash_sheet_draw_internal (GnucashSheet *sheet, cairo_t *cr,
|
||||
GtkAllocation *alloc);
|
||||
void gnucash_sheet_draw_cursor (GnucashCursor *cursor, cairo_t *cr);
|
||||
|
||||
void gnc_widget_set_css_name (GtkWidget *widget, const char *name);
|
||||
|
||||
/** @} */
|
||||
#endif
|
||||
|
@ -592,9 +592,6 @@ gnucash_sheet_get_borders (GnucashSheet *sheet, VirtualLocation virt_loc,
|
||||
borders->left = line_style;
|
||||
borders->right = line_style;
|
||||
|
||||
if (virt_loc.phys_col_offset == 0)
|
||||
borders->left = CELL_BORDER_LINE_NORMAL;
|
||||
|
||||
style = gnucash_sheet_get_style_from_cursor (sheet, CURSOR_HEADER);
|
||||
if (style)
|
||||
if (virt_loc.phys_col_offset == (style->ncols - 1))
|
||||
|
Loading…
Reference in New Issue
Block a user