void gnucash_cursor_configure (GnucashCursor *cursor) { gint x = 0, y = 0, w = 0, h = 0; g_return_if_fail (cursor != NULL); g_return_if_fail (GNUCASH_IS_CURSOR (cursor)); if (!cursor->sheet) return; g_return_if_fail (GTK_IS_LAYOUT (cursor->sheet)); gnucash_cursor_get_pixel_coords (cursor, &x, &y, &w, &h); cursor->x = x; cursor->y = y; cursor->w = w; cursor->h = h + 2; gnucash_sheet_style_get_cell_pixel_rel_coords (cursor->style, cursor->cell.row, cursor->cell.col, &x, &y, &w, &h); cursor->cell.x = x; cursor->cell.y = y; cursor->cell.w = w; cursor->cell.h = h; }
void gnucash_cursor_set (GnucashCursor *cursor, VirtualLocation virt_loc) { GnucashSheet *sheet; g_return_if_fail (cursor != NULL); g_return_if_fail (GNUCASH_IS_CURSOR (cursor)); sheet = cursor->sheet; gnucash_cursor_request_redraw (cursor); gnucash_cursor_set_block (cursor, virt_loc.vcell_loc); gnucash_cursor_set_cell (cursor, virt_loc.phys_row_offset, virt_loc.phys_col_offset); gnucash_cursor_configure (cursor); gnome_canvas_item_set (GNOME_CANVAS_ITEM(sheet->header_item), "cursor_name", cursor->style->cursor->cursor_name, NULL); gnucash_cursor_request_redraw (cursor); }
void gnucash_cursor_set_style (GnucashCursor *cursor, SheetBlockStyle *style) { g_return_if_fail (cursor != NULL); g_return_if_fail (GNUCASH_IS_CURSOR(cursor)); cursor->style = style; }
void gnucash_cursor_get_virt (GnucashCursor *cursor, VirtualLocation *virt_loc) { g_return_if_fail (cursor != NULL); g_return_if_fail (GNUCASH_IS_CURSOR (cursor)); virt_loc->vcell_loc.virt_row = cursor->row; virt_loc->vcell_loc.virt_col = cursor->col; virt_loc->phys_row_offset = cursor->cell.row; virt_loc->phys_col_offset = cursor->cell.col; }
static void gnucash_cursor_set_cell (GnucashCursor *cursor, gint cell_row, gint cell_col) { SheetBlockStyle *style; g_return_if_fail (cursor != NULL); g_return_if_fail (GNUCASH_IS_CURSOR (cursor)); style = cursor->style; if (cell_row < 0 || cell_row >= style->nrows || cell_col < 0 || cell_col >= style->ncols) return; cursor->cell.row = cell_row; cursor->cell.col = cell_col; }
static void gnucash_cursor_set_cell (GnucashCursor *cursor, gint cell_row, gint cell_col) { GnucashItemCursor *item_cursor; SheetBlockStyle *style; g_return_if_fail (cursor != NULL); g_return_if_fail (GNUCASH_IS_CURSOR (cursor)); item_cursor = GNUCASH_ITEM_CURSOR(cursor->cursor[GNUCASH_CURSOR_CELL]); style = cursor->style; if (cell_row < 0 || cell_row >= style->nrows || cell_col < 0 || cell_col >= style->ncols) return; item_cursor->row = cell_row; item_cursor->col = cell_col; }
static void gnucash_cursor_set_block (GnucashCursor *cursor, VirtualCellLocation vcell_loc) { GnucashSheet *sheet; g_return_if_fail (cursor != NULL); g_return_if_fail (GNUCASH_IS_CURSOR (cursor)); sheet = cursor->sheet; if (vcell_loc.virt_row < 0 || vcell_loc.virt_row >= sheet->num_virt_rows || vcell_loc.virt_col < 0 || vcell_loc.virt_col >= sheet->num_virt_cols) return; cursor->style = gnucash_sheet_get_style (sheet, vcell_loc); cursor->row = vcell_loc.virt_row; cursor->col = vcell_loc.virt_col; }
void gnucash_cursor_set (GnucashCursor *cursor, VirtualLocation virt_loc) { GnucashSheet *sheet; g_return_if_fail (cursor != NULL); g_return_if_fail (GNUCASH_IS_CURSOR (cursor)); sheet = cursor->sheet; gnucash_cursor_set_block (cursor, virt_loc.vcell_loc); gnucash_cursor_set_cell (cursor, virt_loc.phys_row_offset, virt_loc.phys_col_offset); gnucash_cursor_configure (cursor); g_object_set (G_OBJECT(sheet->header_item), "cursor_name", cursor->style->cursor->cursor_name, NULL); }
void gnucash_cursor_configure (GnucashCursor *cursor) { GnomeCanvasItem *item; GnucashItemCursor *block_cursor; GnucashItemCursor *cell_cursor; GnomeCanvas *canvas; gint x, y, w, h; double wx, wy; g_return_if_fail (cursor != NULL); g_return_if_fail (GNUCASH_IS_CURSOR (cursor)); canvas = GNOME_CANVAS(GNOME_CANVAS_ITEM(cursor)->canvas); item = GNOME_CANVAS_ITEM (cursor); gnucash_cursor_get_pixel_coords (cursor, &x, &y, &w, &h); gnome_canvas_item_set (GNOME_CANVAS_ITEM(cursor), "GnomeCanvasGroup::x", (double)x, "GnomeCanvasGroup::y", (double)y, NULL); cursor->w = w; cursor->h = h + 1; item->x1 = cursor->x = x; item->y1 = cursor->y = y; item->x2 = x + w; item->y2 = y + h + 1; item = cursor->cursor[GNUCASH_CURSOR_BLOCK]; block_cursor = GNUCASH_ITEM_CURSOR (item); wx = 0; wy = 0; gnome_canvas_item_i2w (item, &wx, &wy); gnome_canvas_w2c (canvas, wx, wy, &block_cursor->x, &block_cursor->y); block_cursor->w = w; block_cursor->h = h + 1; item->x1 = block_cursor->x; item->y1 = block_cursor->y; item->x2 = block_cursor->x + w; item->y2 = block_cursor->y + h + 1; item = cursor->cursor[GNUCASH_CURSOR_CELL]; cell_cursor = GNUCASH_ITEM_CURSOR(item); gnucash_sheet_style_get_cell_pixel_rel_coords (cursor->style, cell_cursor->row, cell_cursor->col, &x, &y, &w, &h); wx = x - block_cursor->x; wy = y; gnome_canvas_item_i2w (item, &wx, &wy); gnome_canvas_w2c (canvas, wx, wy, &cell_cursor->x, &cell_cursor->y); cell_cursor->w = w; cell_cursor->h = h; item->x1 = cell_cursor->x; item->y1 = cell_cursor->y; item->x2 = cell_cursor->x + w; item->y2 = cell_cursor->y + h; }