/* * Returns the coordinates for the editor bounding box */ void gnc_item_edit_get_pixel_coords (GncItemEdit *item_edit, int *x, int *y, int *w, int *h) { GnucashSheet *sheet = item_edit->sheet; SheetBlock *block; int xd, yd; block = gnucash_sheet_get_block (sheet, item_edit->virt_loc.vcell_loc); if (block == NULL) return; xd = block->origin_x; yd = block->origin_y; gnucash_sheet_style_get_cell_pixel_rel_coords (item_edit->style, item_edit->virt_loc.phys_row_offset, 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; }
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_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; }