mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Mork work on transaction display.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3159 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
761806205a
commit
7c4cb62b83
@ -3234,6 +3234,10 @@ xaccSRGetBGColorHandler (VirtualLocation virt_loc, gpointer user_data)
|
|||||||
if (!vcell || !vcell->cellblock)
|
if (!vcell || !vcell->cellblock)
|
||||||
return bg_color;
|
return bg_color;
|
||||||
|
|
||||||
|
if ((virt_loc.phys_col_offset < vcell->cellblock->start_col) ||
|
||||||
|
(virt_loc.phys_col_offset > vcell->cellblock->stop_col))
|
||||||
|
return bg_color;
|
||||||
|
|
||||||
is_current = virt_cell_loc_equal (reg->table->current_cursor_loc.vcell_loc,
|
is_current = virt_cell_loc_equal (reg->table->current_cursor_loc.vcell_loc,
|
||||||
virt_loc.vcell_loc);
|
virt_loc.vcell_loc);
|
||||||
|
|
||||||
|
@ -606,19 +606,20 @@ gnc_configure_register_borders_cb(void *data)
|
|||||||
static void
|
static void
|
||||||
gnc_configure_register_borders(void)
|
gnc_configure_register_borders(void)
|
||||||
{
|
{
|
||||||
RegisterBorders reg_borders = 0;
|
gboolean use_vertical_lines;
|
||||||
|
gboolean use_horizontal_lines;
|
||||||
|
|
||||||
|
use_vertical_lines = gnc_lookup_boolean_option("Register",
|
||||||
|
"Show Vertical Borders",
|
||||||
|
TRUE);
|
||||||
|
|
||||||
if (gnc_lookup_boolean_option("Register",
|
|
||||||
"Show Vertical Borders",
|
|
||||||
TRUE))
|
|
||||||
reg_borders |= STYLE_BORDER_LEFT | STYLE_BORDER_RIGHT;
|
|
||||||
|
|
||||||
if (gnc_lookup_boolean_option("Register",
|
use_horizontal_lines = gnc_lookup_boolean_option("Register",
|
||||||
"Show Horizontal Borders",
|
"Show Horizontal Borders",
|
||||||
TRUE))
|
TRUE);
|
||||||
reg_borders |= STYLE_BORDER_TOP | STYLE_BORDER_BOTTOM;
|
|
||||||
|
gnucash_style_config_register_borders (use_vertical_lines,
|
||||||
gnucash_style_set_register_borders (reg_borders);
|
use_horizontal_lines);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* gnc_configure_auto_raise_cb
|
/* gnc_configure_auto_raise_cb
|
||||||
|
@ -96,6 +96,9 @@ gnc_cellblock_init (CellBlock *cellblock, int rows, int cols)
|
|||||||
cellblock->num_rows = rows;
|
cellblock->num_rows = rows;
|
||||||
cellblock->num_cols = cols;
|
cellblock->num_cols = cols;
|
||||||
|
|
||||||
|
cellblock->start_col = cols;
|
||||||
|
cellblock->stop_col = -1;
|
||||||
|
|
||||||
/* malloc new cell table */
|
/* malloc new cell table */
|
||||||
cellblock->cb_cells = g_table_new (sizeof (CellBlockCell),
|
cellblock->cb_cells = g_table_new (sizeof (CellBlockCell),
|
||||||
gnc_cellblock_cell_construct,
|
gnc_cellblock_cell_construct,
|
||||||
|
@ -91,6 +91,9 @@ typedef struct
|
|||||||
short num_rows;
|
short num_rows;
|
||||||
short num_cols;
|
short num_cols;
|
||||||
|
|
||||||
|
short start_col;
|
||||||
|
short stop_col;
|
||||||
|
|
||||||
short cursor_type;
|
short cursor_type;
|
||||||
|
|
||||||
GTable *cb_cells; /* Holds the CellBlockCell table */
|
GTable *cb_cells; /* Holds the CellBlockCell table */
|
||||||
|
@ -23,8 +23,9 @@
|
|||||||
*
|
*
|
||||||
* Based heavily (i.e., cut and pasted from) on the Gnumeric ItemCursor.
|
* Based heavily (i.e., cut and pasted from) on the Gnumeric ItemCursor.
|
||||||
*
|
*
|
||||||
* Author:
|
* Authors:
|
||||||
* Heath Martin <martinh@pegasus.cc.ucf.edu>
|
* Heath Martin <martinh@pegasus.cc.ucf.edu>
|
||||||
|
* Dave Peticolas <dave@krondo.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "gnucash-sheet.h"
|
#include "gnucash-sheet.h"
|
||||||
@ -44,13 +45,17 @@ enum {
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gnucash_cursor_get_pixel_coords (GnucashCursor *cursor, gint *x, gint *y,
|
gnucash_cursor_get_pixel_coords (GnucashCursor *cursor,
|
||||||
|
gint *x, gint *y,
|
||||||
gint *w, gint *h)
|
gint *w, gint *h)
|
||||||
{
|
{
|
||||||
GnucashSheet *sheet = cursor->sheet;
|
GnucashSheet *sheet = cursor->sheet;
|
||||||
GnucashItemCursor *item_cursor;
|
GnucashItemCursor *item_cursor;
|
||||||
VirtualCellLocation vcell_loc;
|
VirtualCellLocation vcell_loc;
|
||||||
|
CellDimensions *cd;
|
||||||
|
VirtualCell *vcell;
|
||||||
SheetBlock *block;
|
SheetBlock *block;
|
||||||
|
gint col;
|
||||||
|
|
||||||
item_cursor =
|
item_cursor =
|
||||||
GNUCASH_ITEM_CURSOR(cursor->cursor[GNUCASH_CURSOR_BLOCK]);
|
GNUCASH_ITEM_CURSOR(cursor->cursor[GNUCASH_CURSOR_BLOCK]);
|
||||||
@ -59,14 +64,46 @@ gnucash_cursor_get_pixel_coords (GnucashCursor *cursor, gint *x, gint *y,
|
|||||||
vcell_loc.virt_col = item_cursor->col;
|
vcell_loc.virt_col = item_cursor->col;
|
||||||
|
|
||||||
block = gnucash_sheet_get_block (sheet, vcell_loc);
|
block = gnucash_sheet_get_block (sheet, vcell_loc);
|
||||||
if (block == NULL)
|
if (!block)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
vcell = gnc_table_get_virtual_cell (sheet->table, vcell_loc);
|
||||||
|
if (!vcell)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (col = 0; col < vcell->cellblock->num_cols; col++)
|
||||||
|
{
|
||||||
|
CellBlockCell *cb_cell;
|
||||||
|
|
||||||
|
cb_cell = gnc_cellblock_get_cell (vcell->cellblock, 0, col);
|
||||||
|
if (cb_cell->cell_type != NO_CELL)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
*y = block->origin_y;
|
*y = block->origin_y;
|
||||||
*x = block->origin_x;
|
|
||||||
|
cd = gnucash_style_get_cell_dimensions (block->style, 0, col);
|
||||||
|
if (cd)
|
||||||
|
*x = cd->origin_x;
|
||||||
|
else
|
||||||
|
*x = block->origin_x;
|
||||||
|
|
||||||
|
for (col = vcell->cellblock->num_cols - 1; col >= 0; col--)
|
||||||
|
{
|
||||||
|
CellBlockCell *cb_cell;
|
||||||
|
|
||||||
|
cb_cell = gnc_cellblock_get_cell (vcell->cellblock, 0, col);
|
||||||
|
if (cb_cell->cell_type != NO_CELL)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
*h = block->style->dimensions->height;
|
*h = block->style->dimensions->height;
|
||||||
*w = block->style->dimensions->width;
|
|
||||||
|
cd = gnucash_style_get_cell_dimensions (block->style, 0, col);
|
||||||
|
if (cd)
|
||||||
|
*w = cd->origin_x + cd->pixel_width - *x;
|
||||||
|
else
|
||||||
|
*w = block->style->dimensions->width - *x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -117,19 +154,17 @@ void
|
|||||||
gnucash_cursor_configure (GnucashCursor *cursor)
|
gnucash_cursor_configure (GnucashCursor *cursor)
|
||||||
{
|
{
|
||||||
GnomeCanvasItem *item;
|
GnomeCanvasItem *item;
|
||||||
GnucashItemCursor *item_cursor;
|
GnucashItemCursor *block_cursor;
|
||||||
GnomeCanvasGroup *group;
|
GnucashItemCursor *cell_cursor;
|
||||||
GnomeCanvas *canvas;
|
GnomeCanvas *canvas;
|
||||||
gint x, y, w, h;
|
gint x, y, w, h;
|
||||||
double wx, wy;
|
double wx, wy;
|
||||||
|
|
||||||
g_return_if_fail (cursor != NULL);
|
g_return_if_fail (cursor != NULL);
|
||||||
g_return_if_fail (GNUCASH_IS_CURSOR (cursor));
|
g_return_if_fail (GNUCASH_IS_CURSOR (cursor));
|
||||||
|
|
||||||
canvas = GNOME_CANVAS(GNOME_CANVAS_ITEM(cursor)->canvas);
|
canvas = GNOME_CANVAS(GNOME_CANVAS_ITEM(cursor)->canvas);
|
||||||
|
|
||||||
group = GNOME_CANVAS_GROUP(cursor);
|
|
||||||
|
|
||||||
item = GNOME_CANVAS_ITEM (cursor);
|
item = GNOME_CANVAS_ITEM (cursor);
|
||||||
|
|
||||||
gnucash_cursor_get_pixel_coords (cursor, &x, &y, &w, &h);
|
gnucash_cursor_get_pixel_coords (cursor, &x, &y, &w, &h);
|
||||||
@ -147,40 +182,40 @@ gnucash_cursor_configure (GnucashCursor *cursor)
|
|||||||
item->y2 = y + h;
|
item->y2 = y + h;
|
||||||
|
|
||||||
item = cursor->cursor[GNUCASH_CURSOR_BLOCK];
|
item = cursor->cursor[GNUCASH_CURSOR_BLOCK];
|
||||||
item_cursor = GNUCASH_ITEM_CURSOR (item);
|
block_cursor = GNUCASH_ITEM_CURSOR (item);
|
||||||
|
|
||||||
wx = 0;
|
wx = 0;
|
||||||
wy = 0;
|
wy = 0;
|
||||||
|
|
||||||
gnome_canvas_item_i2w (item, &wx, &wy);
|
gnome_canvas_item_i2w (item, &wx, &wy);
|
||||||
gnome_canvas_w2c (canvas, wx, wy, &item_cursor->x, &item_cursor->y);
|
gnome_canvas_w2c (canvas, wx, wy, &block_cursor->x, &block_cursor->y);
|
||||||
item_cursor->w = w;
|
block_cursor->w = w;
|
||||||
item_cursor->h = h;
|
block_cursor->h = h;
|
||||||
|
|
||||||
item->x1 = item_cursor->x;
|
item->x1 = block_cursor->x;
|
||||||
item->y1 = item_cursor->y;
|
item->y1 = block_cursor->y;
|
||||||
item->x2 = item_cursor->x + w;
|
item->x2 = block_cursor->x + w;
|
||||||
item->y2 = item_cursor->y + h;
|
item->y2 = block_cursor->y + h;
|
||||||
|
|
||||||
item = cursor->cursor[GNUCASH_CURSOR_CELL];
|
item = cursor->cursor[GNUCASH_CURSOR_CELL];
|
||||||
item_cursor = GNUCASH_ITEM_CURSOR(item);
|
cell_cursor = GNUCASH_ITEM_CURSOR(item);
|
||||||
|
|
||||||
gnucash_sheet_style_get_cell_pixel_rel_coords (cursor->style,
|
gnucash_sheet_style_get_cell_pixel_rel_coords (cursor->style,
|
||||||
item_cursor->row,
|
cell_cursor->row,
|
||||||
item_cursor->col,
|
cell_cursor->col,
|
||||||
&x, &y, &w, &h);
|
&x, &y, &w, &h);
|
||||||
wx = x;
|
wx = x - block_cursor->x;
|
||||||
wy = y;
|
wy = y;
|
||||||
|
|
||||||
gnome_canvas_item_i2w (item, &wx, &wy);
|
gnome_canvas_item_i2w (item, &wx, &wy);
|
||||||
gnome_canvas_w2c (canvas, wx, wy, &item_cursor->x, &item_cursor->y);
|
gnome_canvas_w2c (canvas, wx, wy, &cell_cursor->x, &cell_cursor->y);
|
||||||
item_cursor->w = w;
|
cell_cursor->w = w;
|
||||||
item_cursor->h = h;
|
cell_cursor->h = h;
|
||||||
|
|
||||||
item->x1 = item_cursor->x;
|
item->x1 = cell_cursor->x;
|
||||||
item->y1 = item_cursor->y;
|
item->y1 = cell_cursor->y;
|
||||||
item->x2 = item_cursor->x+ w;
|
item->x2 = cell_cursor->x + w;
|
||||||
item->y2 = item_cursor->y + h;
|
item->y2 = cell_cursor->y + h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -205,7 +240,7 @@ gnucash_item_cursor_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
|
|||||||
GDK_LINE_SOLID, -1, -1);
|
GDK_LINE_SOLID, -1, -1);
|
||||||
gdk_gc_set_foreground (cursor->gc, &gn_black);
|
gdk_gc_set_foreground (cursor->gc, &gn_black);
|
||||||
gdk_gc_set_background (cursor->gc, &gn_white);
|
gdk_gc_set_background (cursor->gc, &gn_white);
|
||||||
|
|
||||||
gdk_draw_rectangle (drawable, cursor->gc, FALSE,
|
gdk_draw_rectangle (drawable, cursor->gc, FALSE,
|
||||||
dx+2, dy+2, dw-4, dh-4);
|
dx+2, dy+2, dw-4, dh-4);
|
||||||
gdk_draw_rectangle (drawable, cursor->gc, FALSE,
|
gdk_draw_rectangle (drawable, cursor->gc, FALSE,
|
||||||
|
@ -39,14 +39,16 @@ GtkType gnucash_item_cursor_get_type (void);
|
|||||||
GtkType gnucash_cursor_get_type (void);
|
GtkType gnucash_cursor_get_type (void);
|
||||||
|
|
||||||
|
|
||||||
enum {
|
enum
|
||||||
|
{
|
||||||
GNUCASH_CURSOR_CELL,
|
GNUCASH_CURSOR_CELL,
|
||||||
GNUCASH_CURSOR_BLOCK,
|
GNUCASH_CURSOR_BLOCK,
|
||||||
GNUCASH_CURSOR_MAX,
|
GNUCASH_CURSOR_NUM
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct
|
||||||
|
{
|
||||||
GnomeCanvasItem canvas_item;
|
GnomeCanvasItem canvas_item;
|
||||||
|
|
||||||
gint type;
|
gint type;
|
||||||
@ -55,8 +57,7 @@ typedef struct {
|
|||||||
gint col;
|
gint col;
|
||||||
|
|
||||||
/* precomputed pixel coords for the item cursor*/
|
/* precomputed pixel coords for the item cursor*/
|
||||||
gint x, y, w, h;
|
gint x, y, w, h;
|
||||||
|
|
||||||
} GnucashItemCursor;
|
} GnucashItemCursor;
|
||||||
|
|
||||||
|
|
||||||
@ -64,20 +65,21 @@ typedef struct
|
|||||||
{
|
{
|
||||||
GnomeCanvasGroup canvas_group;
|
GnomeCanvasGroup canvas_group;
|
||||||
|
|
||||||
GnomeCanvasItem *cursor[GNUCASH_CURSOR_MAX];
|
GnomeCanvasItem *cursor[GNUCASH_CURSOR_NUM];
|
||||||
|
|
||||||
GnucashSheet *sheet;
|
GnucashSheet *sheet;
|
||||||
GnucashGrid *grid;
|
GnucashGrid *grid;
|
||||||
|
|
||||||
/* precomputed pixel coords for the block cursor*/
|
/* precomputed pixel coords for the block cursor*/
|
||||||
gint x, y, w, h;
|
gint x, y, w, h;
|
||||||
|
|
||||||
GdkGC *gc;
|
GdkGC *gc;
|
||||||
SheetBlockStyle *style;
|
SheetBlockStyle *style;
|
||||||
} GnucashCursor;
|
} GnucashCursor;
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct
|
||||||
|
{
|
||||||
GnomeCanvasItemClass parent_class;
|
GnomeCanvasItemClass parent_class;
|
||||||
} GnucashItemCursorClass;
|
} GnucashItemCursorClass;
|
||||||
|
|
||||||
@ -90,7 +92,8 @@ typedef struct
|
|||||||
|
|
||||||
GnomeCanvasItem *gnucash_cursor_new (GnomeCanvasGroup *parent);
|
GnomeCanvasItem *gnucash_cursor_new (GnomeCanvasGroup *parent);
|
||||||
|
|
||||||
void gnucash_cursor_get_virt (GnucashCursor *cursor, VirtualLocation *virt_loc);
|
void gnucash_cursor_get_virt (GnucashCursor *cursor,
|
||||||
|
VirtualLocation *virt_loc);
|
||||||
|
|
||||||
void gnucash_cursor_set (GnucashCursor *cursor, VirtualLocation virt_loc);
|
void gnucash_cursor_set (GnucashCursor *cursor, VirtualLocation virt_loc);
|
||||||
|
|
||||||
|
@ -251,6 +251,86 @@ gnucash_grid_find_loc_by_pixel (GnucashGrid *grid, gint x, gint y,
|
|||||||
return gnucash_grid_find_cell_by_pixel (grid, x, y, virt_loc);
|
return gnucash_grid_find_cell_by_pixel (grid, x, y, virt_loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
G_INLINE_FUNC void
|
||||||
|
draw_cell_line (GdkDrawable *drawable,
|
||||||
|
GdkGC *gc, GdkColor *bg_color,
|
||||||
|
int x1, int y1, int x2, int y2,
|
||||||
|
PhysicalCellBorderLineStyle style);
|
||||||
|
|
||||||
|
G_INLINE_FUNC void
|
||||||
|
draw_cell_line (GdkDrawable *drawable,
|
||||||
|
GdkGC *gc, GdkColor *bg_color,
|
||||||
|
int x1, int y1, int x2, int y2,
|
||||||
|
PhysicalCellBorderLineStyle style)
|
||||||
|
{
|
||||||
|
GdkColor *fg_color;
|
||||||
|
|
||||||
|
switch (style)
|
||||||
|
{
|
||||||
|
case CELL_BORDER_LINE_NONE:
|
||||||
|
fg_color = bg_color;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CELL_BORDER_LINE_LIGHT:
|
||||||
|
fg_color = &gn_light_gray;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CELL_BORDER_LINE_NORMAL:
|
||||||
|
case CELL_BORDER_LINE_HEAVY:
|
||||||
|
fg_color = &gn_black;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
gdk_gc_set_foreground (gc, fg_color);
|
||||||
|
gdk_draw_line (drawable, gc, x1, y1, x2, y2);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
get_cell_borders (GnucashSheet *sheet, VirtualLocation virt_loc,
|
||||||
|
PhysicalCellBorders *borders)
|
||||||
|
{
|
||||||
|
VirtualLocation v_loc;
|
||||||
|
PhysicalCellBorders neighbor;
|
||||||
|
|
||||||
|
gnucash_sheet_get_borders (sheet, virt_loc, borders);
|
||||||
|
|
||||||
|
/* top */
|
||||||
|
v_loc = virt_loc;
|
||||||
|
if (gnc_table_move_vertical_position (sheet->table, &v_loc, -1))
|
||||||
|
{
|
||||||
|
gnucash_sheet_get_borders (sheet, v_loc, &neighbor);
|
||||||
|
borders->top = MAX (borders->top, neighbor.bottom);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* bottom */
|
||||||
|
v_loc = virt_loc;
|
||||||
|
if (gnc_table_move_vertical_position (sheet->table, &v_loc, 1))
|
||||||
|
{
|
||||||
|
gnucash_sheet_get_borders (sheet, v_loc, &neighbor);
|
||||||
|
borders->bottom = MAX (borders->bottom, neighbor.top);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* left */
|
||||||
|
v_loc = virt_loc;
|
||||||
|
v_loc.phys_col_offset--;
|
||||||
|
if (gnc_table_virtual_loc_valid (sheet->table, v_loc, TRUE))
|
||||||
|
{
|
||||||
|
gnucash_sheet_get_borders (sheet, v_loc, &neighbor);
|
||||||
|
borders->left = MAX (borders->left, neighbor.right);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* right */
|
||||||
|
v_loc = virt_loc;
|
||||||
|
v_loc.phys_col_offset++;
|
||||||
|
if (gnc_table_virtual_loc_valid (sheet->table, v_loc, TRUE))
|
||||||
|
{
|
||||||
|
gnucash_sheet_get_borders (sheet, v_loc, &neighbor);
|
||||||
|
borders->right = MAX (borders->right, neighbor.left);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
draw_cell (GnucashGrid *grid,
|
draw_cell (GnucashGrid *grid,
|
||||||
@ -260,6 +340,7 @@ draw_cell (GnucashGrid *grid,
|
|||||||
int x, int y, int width, int height)
|
int x, int y, int width, int height)
|
||||||
{
|
{
|
||||||
Table *table = grid->sheet->table;
|
Table *table = grid->sheet->table;
|
||||||
|
PhysicalCellBorders borders;
|
||||||
const char *text;
|
const char *text;
|
||||||
GdkFont *font;
|
GdkFont *font;
|
||||||
GdkColor *bg_color;
|
GdkColor *bg_color;
|
||||||
@ -267,7 +348,6 @@ draw_cell (GnucashGrid *grid,
|
|||||||
gint x_offset, y_offset;
|
gint x_offset, y_offset;
|
||||||
GdkRectangle rect;
|
GdkRectangle rect;
|
||||||
guint32 argb;
|
guint32 argb;
|
||||||
gint borders;
|
|
||||||
|
|
||||||
gdk_gc_set_background (grid->gc, &gn_white);
|
gdk_gc_set_background (grid->gc, &gn_white);
|
||||||
|
|
||||||
@ -275,28 +355,30 @@ draw_cell (GnucashGrid *grid,
|
|||||||
bg_color = gnucash_color_argb_to_gdk (argb);
|
bg_color = gnucash_color_argb_to_gdk (argb);
|
||||||
|
|
||||||
gdk_gc_set_foreground (grid->gc, bg_color);
|
gdk_gc_set_foreground (grid->gc, bg_color);
|
||||||
gdk_draw_rectangle (drawable, grid->gc, TRUE, x, y, width, height);
|
gdk_draw_rectangle (drawable, grid->gc, TRUE,
|
||||||
|
x + 1, y + 1, width - 1, height - 1);
|
||||||
|
|
||||||
gdk_gc_set_foreground (grid->gc, &gn_black);
|
get_cell_borders (grid->sheet, virt_loc, &borders);
|
||||||
|
|
||||||
borders = gnucash_sheet_get_borders (grid->sheet, virt_loc);
|
|
||||||
/* top */
|
/* top */
|
||||||
if (borders & STYLE_BORDER_TOP)
|
draw_cell_line (drawable, grid->gc, bg_color,
|
||||||
gdk_draw_line (drawable, grid->gc, x, y, x+width, y);
|
x, y, x + width, y,
|
||||||
|
borders.top);
|
||||||
|
|
||||||
/* right */
|
/* right */
|
||||||
if (borders & STYLE_BORDER_RIGHT)
|
draw_cell_line (drawable, grid->gc, bg_color,
|
||||||
gdk_draw_line (drawable, grid->gc, x+width, y,
|
x + width, y, x + width, y + height,
|
||||||
x+width, y+height);
|
borders.right);
|
||||||
|
|
||||||
/* bottom */
|
/* bottom */
|
||||||
if (borders & STYLE_BORDER_BOTTOM)
|
draw_cell_line (drawable, grid->gc, bg_color,
|
||||||
gdk_draw_line (drawable, grid->gc, x+width,
|
x + width, y + height, x, y + height,
|
||||||
y+height, x, y+height);
|
borders.bottom);
|
||||||
|
|
||||||
/* left */
|
/* left */
|
||||||
if (borders & STYLE_BORDER_LEFT)
|
draw_cell_line (drawable, grid->gc, bg_color,
|
||||||
gdk_draw_line (drawable, grid->gc, x, y+height, x, y);
|
x, y + height, x, y,
|
||||||
|
borders.left);
|
||||||
|
|
||||||
/* dividing line */
|
/* dividing line */
|
||||||
if ((virt_loc.phys_row_offset == 0) && (table->dividing_row >= 0))
|
if ((virt_loc.phys_row_offset == 0) && (table->dividing_row >= 0))
|
||||||
@ -355,14 +437,14 @@ draw_cell (GnucashGrid *grid,
|
|||||||
x_offset = CELL_HPADDING;
|
x_offset = CELL_HPADDING;
|
||||||
else {
|
else {
|
||||||
x_offset = width / 2;
|
x_offset = width / 2;
|
||||||
x_offset -= gdk_string_measure (font, text) / 2;
|
x_offset -= gdk_string_measure(font, text) / 2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
rect.x = x + CELL_HPADDING;
|
rect.x = x + CELL_HPADDING;
|
||||||
rect.y = y + CELL_VPADDING;
|
rect.y = y + CELL_VPADDING;
|
||||||
rect.width = width - 2*CELL_HPADDING;
|
rect.width = width - 2 * CELL_HPADDING;
|
||||||
rect.height = height;
|
rect.height = height;
|
||||||
|
|
||||||
gdk_gc_set_clip_rectangle (grid->gc, &rect);
|
gdk_gc_set_clip_rectangle (grid->gc, &rect);
|
||||||
@ -428,7 +510,6 @@ draw_block (GnucashGrid *grid,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: this only does the first virtual column */
|
|
||||||
static void
|
static void
|
||||||
gnucash_grid_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
|
gnucash_grid_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
|
||||||
int x, int y, int width, int height)
|
int x, int y, int width, int height)
|
||||||
@ -437,12 +518,8 @@ gnucash_grid_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
|
|||||||
VirtualLocation virt_loc;
|
VirtualLocation virt_loc;
|
||||||
SheetBlock *sheet_block;
|
SheetBlock *sheet_block;
|
||||||
|
|
||||||
g_return_if_fail(x >= 0);
|
if (x < 0 || y < 0)
|
||||||
g_return_if_fail(y >= 0);
|
return;
|
||||||
|
|
||||||
/* The default background */
|
|
||||||
gdk_draw_rectangle (drawable, grid->fill_gc, TRUE,
|
|
||||||
0, 0, width, height);
|
|
||||||
|
|
||||||
/* compute our initial values where we start drawing */
|
/* compute our initial values where we start drawing */
|
||||||
sheet_block = gnucash_grid_find_block_by_pixel (grid, x, y,
|
sheet_block = gnucash_grid_find_block_by_pixel (grid, x, y,
|
||||||
|
@ -43,7 +43,8 @@ GdkFont *gnucash_register_hint_font = NULL;
|
|||||||
static char *register_font_name = NULL;
|
static char *register_font_name = NULL;
|
||||||
static char *register_hint_font_name = NULL;
|
static char *register_hint_font_name = NULL;
|
||||||
|
|
||||||
static RegisterBorders reg_borders = 0;
|
static gboolean use_vertical_lines = TRUE;
|
||||||
|
static gboolean use_horizontal_lines = TRUE;
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
style_get_key (SheetBlockStyle *style)
|
style_get_key (SheetBlockStyle *style)
|
||||||
@ -485,34 +486,45 @@ gnucash_sheet_styles_recompile(GnucashSheet *sheet)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
gnucash_style_set_register_borders (int reg_borders_new)
|
gnucash_style_config_register_borders (gboolean use_vertical_lines_in,
|
||||||
|
gboolean use_horizontal_lines_in)
|
||||||
{
|
{
|
||||||
reg_borders = reg_borders_new;
|
use_vertical_lines = use_vertical_lines_in;
|
||||||
|
use_horizontal_lines = use_horizontal_lines_in;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
gint
|
void
|
||||||
gnucash_sheet_get_borders (GnucashSheet *sheet, VirtualLocation virt_loc)
|
gnucash_sheet_get_borders (GnucashSheet *sheet, VirtualLocation virt_loc,
|
||||||
|
PhysicalCellBorders *borders)
|
||||||
{
|
{
|
||||||
SheetBlockStyle *style;
|
SheetBlockStyle *style;
|
||||||
gint borders;
|
PhysicalCellBorderLineStyle line_style;
|
||||||
|
|
||||||
g_return_val_if_fail (sheet != NULL, 0);
|
g_return_if_fail (sheet != NULL);
|
||||||
g_return_val_if_fail (GNUCASH_IS_SHEET (sheet), 0);
|
g_return_if_fail (GNUCASH_IS_SHEET (sheet));
|
||||||
|
|
||||||
borders = reg_borders;
|
line_style = use_vertical_lines ?
|
||||||
|
CELL_BORDER_LINE_NORMAL : CELL_BORDER_LINE_NONE;
|
||||||
|
|
||||||
|
borders->top = line_style;
|
||||||
|
borders->bottom = line_style;
|
||||||
|
|
||||||
|
line_style = use_horizontal_lines ?
|
||||||
|
CELL_BORDER_LINE_NORMAL : CELL_BORDER_LINE_NONE;
|
||||||
|
|
||||||
|
borders->left = line_style;
|
||||||
|
borders->right = line_style;
|
||||||
|
|
||||||
if (virt_loc.phys_col_offset == 0)
|
if (virt_loc.phys_col_offset == 0)
|
||||||
return borders |= STYLE_BORDER_LEFT;
|
borders->left = CELL_BORDER_LINE_NORMAL;
|
||||||
|
|
||||||
style = sheet->cursor_styles[CURSOR_TYPE_HEADER];
|
style = sheet->cursor_styles[CURSOR_TYPE_HEADER];
|
||||||
if (style == NULL)
|
if (style)
|
||||||
return borders;
|
if (virt_loc.phys_col_offset == (style->ncols - 1))
|
||||||
|
borders->right = CELL_BORDER_LINE_NORMAL;
|
||||||
|
|
||||||
if (virt_loc.phys_col_offset == (style->ncols - 1))
|
gnc_table_get_borders (sheet->table, virt_loc, borders);
|
||||||
return borders |= STYLE_BORDER_RIGHT;
|
|
||||||
|
|
||||||
return borders;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,13 +26,6 @@
|
|||||||
#include "splitreg.h"
|
#include "splitreg.h"
|
||||||
#include "gnucash-sheet.h"
|
#include "gnucash-sheet.h"
|
||||||
|
|
||||||
#define STYLE_BORDER_LEFT (1 << 0)
|
|
||||||
#define STYLE_BORDER_RIGHT (1 << 1)
|
|
||||||
#define STYLE_BORDER_TOP (1 << 2)
|
|
||||||
#define STYLE_BORDER_BOTTOM (1 << 3)
|
|
||||||
|
|
||||||
typedef int RegisterBorders;
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
gint pixel_height;
|
gint pixel_height;
|
||||||
@ -116,11 +109,13 @@ void gnucash_sheet_style_get_cell_pixel_rel_coords (SheetBlockStyle *style,
|
|||||||
gint *x, gint *y,
|
gint *x, gint *y,
|
||||||
gint *w, gint *h);
|
gint *w, gint *h);
|
||||||
|
|
||||||
void gnucash_style_ref (SheetBlockStyle *style);
|
void gnucash_style_ref (SheetBlockStyle *style);
|
||||||
void gnucash_style_unref (SheetBlockStyle *style);
|
void gnucash_style_unref (SheetBlockStyle *style);
|
||||||
|
|
||||||
void gnucash_style_set_register_borders (int reg_borders_new);
|
void gnucash_style_config_register_borders (gboolean use_vertical_lines,
|
||||||
gint gnucash_sheet_get_borders (GnucashSheet *sheet, VirtualLocation virt_loc);
|
gboolean use_horizontal_lines);
|
||||||
|
void gnucash_sheet_get_borders (GnucashSheet *sheet, VirtualLocation virt_loc,
|
||||||
|
PhysicalCellBorders *borders);
|
||||||
|
|
||||||
void gnucash_sheet_get_header_widths (GnucashSheet *sheet, int *header_widths);
|
void gnucash_sheet_get_header_widths (GnucashSheet *sheet, int *header_widths);
|
||||||
void gnucash_sheet_set_header_widths (GnucashSheet *sheet, int *header_widths);
|
void gnucash_sheet_set_header_widths (GnucashSheet *sheet, int *header_widths);
|
||||||
|
@ -308,6 +308,12 @@ set_cell (SplitRegister *reg, CellBlock *cursor,
|
|||||||
CellBlockCell *cb_cell;
|
CellBlockCell *cb_cell;
|
||||||
BasicCell *hcell;
|
BasicCell *hcell;
|
||||||
|
|
||||||
|
cursor->start_col = MIN (cursor->start_col, col);
|
||||||
|
cursor->stop_col = MAX (cursor->stop_col, col);
|
||||||
|
|
||||||
|
reg->cursor_header->start_col = MIN (reg->cursor_header->start_col, col);
|
||||||
|
reg->cursor_header->stop_col = MAX (reg->cursor_header->stop_col, col);
|
||||||
|
|
||||||
hcell = reg->header_cells[cell_type];
|
hcell = reg->header_cells[cell_type];
|
||||||
|
|
||||||
cb_cell = gnc_cellblock_get_cell (cursor, row, col);
|
cb_cell = gnc_cellblock_get_cell (cursor, row, col);
|
||||||
@ -335,12 +341,6 @@ set_cell (SplitRegister *reg, CellBlock *cursor,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* SET_CELL macro initializes cells in the register */
|
|
||||||
|
|
||||||
#define SET_CELL(NAME,col,row) { \
|
|
||||||
set_cell (reg, curs, NAME##_CELL, row, col); \
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
copy_cursor_row (SplitRegister *reg, CellBlock *to, CellBlock *from, int row)
|
copy_cursor_row (SplitRegister *reg, CellBlock *to, CellBlock *from, int row)
|
||||||
{
|
{
|
||||||
@ -408,41 +408,41 @@ configLayout (SplitRegister *reg)
|
|||||||
case EQUITY_REGISTER:
|
case EQUITY_REGISTER:
|
||||||
{
|
{
|
||||||
curs = reg->cursor_ledger_single;
|
curs = reg->cursor_ledger_single;
|
||||||
SET_CELL (DATE, 0, 0);
|
set_cell (reg, curs, DATE_CELL, 0, 0);
|
||||||
SET_CELL (NUM, 1, 0);
|
set_cell (reg, curs, NUM_CELL, 0, 1);
|
||||||
SET_CELL (DESC, 2, 0);
|
set_cell (reg, curs, DESC_CELL, 0, 2);
|
||||||
SET_CELL (MXFRM, 3, 0);
|
set_cell (reg, curs, MXFRM_CELL, 0, 3);
|
||||||
SET_CELL (RECN, 4, 0);
|
set_cell (reg, curs, RECN_CELL, 0, 4);
|
||||||
SET_CELL (DEBT, 5, 0);
|
set_cell (reg, curs, DEBT_CELL, 0, 5);
|
||||||
SET_CELL (CRED, 6, 0);
|
set_cell (reg, curs, CRED_CELL, 0, 6);
|
||||||
SET_CELL (BALN, 7, 0);
|
set_cell (reg, curs, BALN_CELL, 0, 7);
|
||||||
|
|
||||||
curs = reg->cursor_ledger_double;
|
curs = reg->cursor_ledger_double;
|
||||||
copy_cursor_row (reg, curs, reg->cursor_ledger_single, 0);
|
copy_cursor_row (reg, curs, reg->cursor_ledger_single, 0);
|
||||||
|
|
||||||
SET_CELL (ACTN, 1, 1);
|
set_cell (reg, curs, ACTN_CELL, 1, 1);
|
||||||
SET_CELL (MEMO, 2, 1);
|
set_cell (reg, curs, MEMO_CELL, 1, 2);
|
||||||
|
|
||||||
curs = reg->cursor_journal_single;
|
curs = reg->cursor_journal_single;
|
||||||
SET_CELL (DATE, 0, 0);
|
set_cell (reg, curs, DATE_CELL, 0, 0);
|
||||||
SET_CELL (NUM, 1, 0);
|
set_cell (reg, curs, NUM_CELL, 0, 1);
|
||||||
SET_CELL (DESC, 2, 0);
|
set_cell (reg, curs, DESC_CELL, 0, 2);
|
||||||
SET_CELL (RECN, 4, 0);
|
set_cell (reg, curs, RECN_CELL, 0, 4);
|
||||||
SET_CELL (DEBT, 5, 0);
|
set_cell (reg, curs, DEBT_CELL, 0, 5);
|
||||||
SET_CELL (CRED, 6, 0);
|
set_cell (reg, curs, CRED_CELL, 0, 6);
|
||||||
SET_CELL (BALN, 7, 0);
|
set_cell (reg, curs, BALN_CELL, 0, 7);
|
||||||
|
|
||||||
curs = reg->cursor_journal_double;
|
curs = reg->cursor_journal_double;
|
||||||
copy_cursor_row (reg, curs, reg->cursor_journal_single, 0);
|
copy_cursor_row (reg, curs, reg->cursor_journal_single, 0);
|
||||||
|
|
||||||
SET_CELL (MEMO, 2, 1);
|
set_cell (reg, curs, MEMO_CELL, 1, 2);
|
||||||
|
|
||||||
curs = reg->cursor_split;
|
curs = reg->cursor_split;
|
||||||
SET_CELL (ACTN, 1, 0);
|
set_cell (reg, curs, ACTN_CELL, 0, 1);
|
||||||
SET_CELL (MEMO, 2, 0);
|
set_cell (reg, curs, MEMO_CELL, 0, 2);
|
||||||
SET_CELL (XFRM, 3, 0);
|
set_cell (reg, curs, XFRM_CELL, 0, 3);
|
||||||
SET_CELL (DEBT, 5, 0);
|
set_cell (reg, curs, DEBT_CELL, 0, 5);
|
||||||
SET_CELL (CRED, 6, 0);
|
set_cell (reg, curs, CRED_CELL, 0, 6);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -453,41 +453,41 @@ configLayout (SplitRegister *reg)
|
|||||||
case SEARCH_LEDGER:
|
case SEARCH_LEDGER:
|
||||||
{
|
{
|
||||||
curs = reg->cursor_ledger_single;
|
curs = reg->cursor_ledger_single;
|
||||||
SET_CELL (DATE, 0, 0);
|
set_cell (reg, curs, DATE_CELL, 0, 0);
|
||||||
SET_CELL (NUM, 1, 0);
|
set_cell (reg, curs, NUM_CELL, 0, 1);
|
||||||
SET_CELL (DESC, 2, 0);
|
set_cell (reg, curs, DESC_CELL, 0, 2);
|
||||||
SET_CELL (XTO, 3, 0);
|
set_cell (reg, curs, XTO_CELL, 0, 3);
|
||||||
SET_CELL (MXFRM, 4, 0);
|
set_cell (reg, curs, MXFRM_CELL, 0, 4);
|
||||||
SET_CELL (RECN, 5, 0);
|
set_cell (reg, curs, RECN_CELL, 0, 5);
|
||||||
SET_CELL (DEBT, 6, 0);
|
set_cell (reg, curs, DEBT_CELL, 0, 6);
|
||||||
SET_CELL (CRED, 7, 0);
|
set_cell (reg, curs, CRED_CELL, 0, 7);
|
||||||
|
|
||||||
curs = reg->cursor_ledger_double;
|
curs = reg->cursor_ledger_double;
|
||||||
copy_cursor_row (reg, curs, reg->cursor_ledger_single, 0);
|
copy_cursor_row (reg, curs, reg->cursor_ledger_single, 0);
|
||||||
|
|
||||||
SET_CELL (ACTN, 1, 1);
|
set_cell (reg, curs, ACTN_CELL, 1, 1);
|
||||||
SET_CELL (MEMO, 2, 1);
|
set_cell (reg, curs, MEMO_CELL, 1, 2);
|
||||||
|
|
||||||
curs = reg->cursor_journal_single;
|
curs = reg->cursor_journal_single;
|
||||||
SET_CELL (DATE, 0, 0);
|
set_cell (reg, curs, DATE_CELL, 0, 0);
|
||||||
SET_CELL (NUM, 1, 0);
|
set_cell (reg, curs, NUM_CELL, 0, 1);
|
||||||
SET_CELL (DESC, 2, 0);
|
set_cell (reg, curs, DESC_CELL, 0, 2);
|
||||||
SET_CELL (XTO, 3, 0);
|
set_cell (reg, curs, XTO_CELL, 0, 3);
|
||||||
SET_CELL (RECN, 5, 0);
|
set_cell (reg, curs, RECN_CELL, 0, 5);
|
||||||
SET_CELL (DEBT, 6, 0);
|
set_cell (reg, curs, DEBT_CELL, 0, 6);
|
||||||
SET_CELL (CRED, 7, 0);
|
set_cell (reg, curs, CRED_CELL, 0, 7);
|
||||||
|
|
||||||
curs = reg->cursor_journal_double;
|
curs = reg->cursor_journal_double;
|
||||||
copy_cursor_row (reg, curs, reg->cursor_journal_single, 0);
|
copy_cursor_row (reg, curs, reg->cursor_journal_single, 0);
|
||||||
|
|
||||||
SET_CELL (MEMO, 2, 1);
|
set_cell (reg, curs, MEMO_CELL, 1, 2);
|
||||||
|
|
||||||
curs = reg->cursor_split;
|
curs = reg->cursor_split;
|
||||||
SET_CELL (ACTN, 1, 0);
|
set_cell (reg, curs, ACTN_CELL, 0, 1);
|
||||||
SET_CELL (MEMO, 2, 0);
|
set_cell (reg, curs, MEMO_CELL, 0, 2);
|
||||||
SET_CELL (XFRM, 4, 0);
|
set_cell (reg, curs, XFRM_CELL, 0, 4);
|
||||||
SET_CELL (DEBT, 6, 0);
|
set_cell (reg, curs, DEBT_CELL, 0, 6);
|
||||||
SET_CELL (CRED, 7, 0);
|
set_cell (reg, curs, CRED_CELL, 0, 7);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -497,47 +497,47 @@ configLayout (SplitRegister *reg)
|
|||||||
case CURRENCY_REGISTER:
|
case CURRENCY_REGISTER:
|
||||||
{
|
{
|
||||||
curs = reg->cursor_ledger_single;
|
curs = reg->cursor_ledger_single;
|
||||||
SET_CELL (DATE, 0, 0);
|
set_cell (reg, curs, DATE_CELL, 0, 0);
|
||||||
SET_CELL (NUM, 1, 0);
|
set_cell (reg, curs, NUM_CELL, 0, 1);
|
||||||
SET_CELL (DESC, 2, 0);
|
set_cell (reg, curs, DESC_CELL, 0, 2);
|
||||||
SET_CELL (MXFRM, 3, 0);
|
set_cell (reg, curs, MXFRM_CELL, 0, 3);
|
||||||
SET_CELL (RECN, 4, 0);
|
set_cell (reg, curs, RECN_CELL, 0, 4);
|
||||||
SET_CELL (SHRS, 5, 0);
|
set_cell (reg, curs, SHRS_CELL, 0, 5);
|
||||||
SET_CELL (PRIC, 6, 0);
|
set_cell (reg, curs, PRIC_CELL, 0, 6);
|
||||||
SET_CELL (DEBT, 7, 0);
|
set_cell (reg, curs, DEBT_CELL, 0, 7);
|
||||||
SET_CELL (CRED, 8, 0);
|
set_cell (reg, curs, CRED_CELL, 0, 8);
|
||||||
SET_CELL (SHRBALN, 9, 0);
|
set_cell (reg, curs, SHRBALN_CELL, 0, 9);
|
||||||
SET_CELL (BALN, 10, 0);
|
set_cell (reg, curs, BALN_CELL, 0, 10);
|
||||||
|
|
||||||
curs = reg->cursor_ledger_double;
|
curs = reg->cursor_ledger_double;
|
||||||
copy_cursor_row (reg, curs, reg->cursor_ledger_single, 0);
|
copy_cursor_row (reg, curs, reg->cursor_ledger_single, 0);
|
||||||
|
|
||||||
SET_CELL (ACTN, 1, 1);
|
set_cell (reg, curs, ACTN_CELL, 1, 1);
|
||||||
SET_CELL (MEMO, 2, 1);
|
set_cell (reg, curs, MEMO_CELL, 1, 2);
|
||||||
|
|
||||||
curs = reg->cursor_journal_single;
|
curs = reg->cursor_journal_single;
|
||||||
SET_CELL (DATE, 0, 0);
|
set_cell (reg, curs, DATE_CELL, 0, 0);
|
||||||
SET_CELL (NUM, 1, 0);
|
set_cell (reg, curs, NUM_CELL, 0, 1);
|
||||||
SET_CELL (DESC, 2, 0);
|
set_cell (reg, curs, DESC_CELL, 0, 2);
|
||||||
SET_CELL (RECN, 4, 0);
|
set_cell (reg, curs, RECN_CELL, 0, 4);
|
||||||
SET_CELL (SHRS, 5, 0);
|
set_cell (reg, curs, SHRS_CELL, 0, 5);
|
||||||
SET_CELL (PRIC, 6, 0);
|
set_cell (reg, curs, PRIC_CELL, 0, 6);
|
||||||
SET_CELL (DEBT, 7, 0);
|
set_cell (reg, curs, DEBT_CELL, 0, 7);
|
||||||
SET_CELL (CRED, 8, 0);
|
set_cell (reg, curs, CRED_CELL, 0, 8);
|
||||||
SET_CELL (SHRBALN, 9, 0);
|
set_cell (reg, curs, SHRBALN_CELL, 0, 9);
|
||||||
SET_CELL (BALN, 10, 0);
|
set_cell (reg, curs, BALN_CELL, 0, 10);
|
||||||
|
|
||||||
curs = reg->cursor_journal_double;
|
curs = reg->cursor_journal_double;
|
||||||
copy_cursor_row (reg, curs, reg->cursor_journal_single, 0);
|
copy_cursor_row (reg, curs, reg->cursor_journal_single, 0);
|
||||||
|
|
||||||
SET_CELL (MEMO, 2, 1);
|
set_cell (reg, curs, MEMO_CELL, 1, 2);
|
||||||
|
|
||||||
curs = reg->cursor_split;
|
curs = reg->cursor_split;
|
||||||
SET_CELL (ACTN, 1, 0);
|
set_cell (reg, curs, ACTN_CELL, 0, 1);
|
||||||
SET_CELL (MEMO, 2, 0);
|
set_cell (reg, curs, MEMO_CELL, 0, 2);
|
||||||
SET_CELL (XFRM, 3, 0);
|
set_cell (reg, curs, XFRM_CELL, 0, 3);
|
||||||
SET_CELL (DEBT, 7, 0);
|
set_cell (reg, curs, DEBT_CELL, 0, 7);
|
||||||
SET_CELL (CRED, 8, 0);
|
set_cell (reg, curs, CRED_CELL, 0, 8);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -546,47 +546,47 @@ configLayout (SplitRegister *reg)
|
|||||||
case PORTFOLIO_LEDGER:
|
case PORTFOLIO_LEDGER:
|
||||||
{
|
{
|
||||||
curs = reg->cursor_ledger_single;
|
curs = reg->cursor_ledger_single;
|
||||||
SET_CELL (DATE, 0, 0);
|
set_cell (reg, curs, DATE_CELL, 0, 0);
|
||||||
SET_CELL (NUM, 1, 0);
|
set_cell (reg, curs, NUM_CELL, 0, 1);
|
||||||
SET_CELL (DESC, 2, 0);
|
set_cell (reg, curs, DESC_CELL, 0, 2);
|
||||||
SET_CELL (XTO, 3, 0);
|
set_cell (reg, curs, XTO_CELL, 0, 3);
|
||||||
SET_CELL (MXFRM, 4, 0);
|
set_cell (reg, curs, MXFRM_CELL, 0, 4);
|
||||||
SET_CELL (RECN, 5, 0);
|
set_cell (reg, curs, RECN_CELL, 0, 5);
|
||||||
SET_CELL (SHRS, 6, 0);
|
set_cell (reg, curs, SHRS_CELL, 0, 6);
|
||||||
SET_CELL (PRIC, 7, 0);
|
set_cell (reg, curs, PRIC_CELL, 0, 7);
|
||||||
SET_CELL (DEBT, 8, 0);
|
set_cell (reg, curs, DEBT_CELL, 0, 8);
|
||||||
SET_CELL (CRED, 9, 0);
|
set_cell (reg, curs, CRED_CELL, 0, 9);
|
||||||
SET_CELL (SHRBALN, 10, 0);
|
set_cell (reg, curs, SHRBALN_CELL, 0, 10);
|
||||||
|
|
||||||
curs = reg->cursor_ledger_double;
|
curs = reg->cursor_ledger_double;
|
||||||
copy_cursor_row (reg, curs, reg->cursor_ledger_single, 0);
|
copy_cursor_row (reg, curs, reg->cursor_ledger_single, 0);
|
||||||
|
|
||||||
SET_CELL (ACTN, 1, 1);
|
set_cell (reg, curs, ACTN_CELL, 1, 1);
|
||||||
SET_CELL (MEMO, 2, 1);
|
set_cell (reg, curs, MEMO_CELL, 1, 2);
|
||||||
|
|
||||||
curs = reg->cursor_journal_single;
|
curs = reg->cursor_journal_single;
|
||||||
SET_CELL (DATE, 0, 0);
|
set_cell (reg, curs, DATE_CELL, 0, 0);
|
||||||
SET_CELL (NUM, 1, 0);
|
set_cell (reg, curs, NUM_CELL, 0, 1);
|
||||||
SET_CELL (DESC, 2, 0);
|
set_cell (reg, curs, DESC_CELL, 0, 2);
|
||||||
SET_CELL (XTO, 3, 0);
|
set_cell (reg, curs, XTO_CELL, 0, 3);
|
||||||
SET_CELL (RECN, 5, 0);
|
set_cell (reg, curs, RECN_CELL, 0, 5);
|
||||||
SET_CELL (SHRS, 6, 0);
|
set_cell (reg, curs, SHRS_CELL, 0, 6);
|
||||||
SET_CELL (PRIC, 7, 0);
|
set_cell (reg, curs, PRIC_CELL, 0, 7);
|
||||||
SET_CELL (DEBT, 8, 0);
|
set_cell (reg, curs, DEBT_CELL, 0, 8);
|
||||||
SET_CELL (CRED, 9, 0);
|
set_cell (reg, curs, CRED_CELL, 0, 9);
|
||||||
SET_CELL (SHRBALN, 10, 0);
|
set_cell (reg, curs, SHRBALN_CELL, 0, 10);
|
||||||
|
|
||||||
curs = reg->cursor_journal_double;
|
curs = reg->cursor_journal_double;
|
||||||
copy_cursor_row (reg, curs, reg->cursor_journal_single, 0);
|
copy_cursor_row (reg, curs, reg->cursor_journal_single, 0);
|
||||||
|
|
||||||
SET_CELL (MEMO, 2, 1);
|
set_cell (reg, curs, MEMO_CELL, 1, 2);
|
||||||
|
|
||||||
curs = reg->cursor_split;
|
curs = reg->cursor_split;
|
||||||
SET_CELL (ACTN, 1, 0);
|
set_cell (reg, curs, ACTN_CELL, 0, 1);
|
||||||
SET_CELL (MEMO, 2, 0);
|
set_cell (reg, curs, MEMO_CELL, 0, 2);
|
||||||
SET_CELL (XFRM, 4, 0);
|
set_cell (reg, curs, XFRM_CELL, 0, 4);
|
||||||
SET_CELL (DEBT, 8, 0);
|
set_cell (reg, curs, DEBT_CELL, 0, 8);
|
||||||
SET_CELL (CRED, 9, 0);
|
set_cell (reg, curs, CRED_CELL, 0, 9);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -683,6 +683,30 @@ mallocCursors (SplitRegister *reg)
|
|||||||
|
|
||||||
/* ============================================== */
|
/* ============================================== */
|
||||||
|
|
||||||
|
static void
|
||||||
|
sr_get_cell_borders (VirtualLocation virt_loc,
|
||||||
|
PhysicalCellBorders *borders,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
SplitRegister *reg = user_data;
|
||||||
|
VirtualCell *vcell;
|
||||||
|
|
||||||
|
vcell = gnc_table_get_virtual_cell (reg->table, virt_loc.vcell_loc);
|
||||||
|
if (!vcell || !vcell->cellblock)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if ((virt_loc.phys_col_offset < vcell->cellblock->start_col) ||
|
||||||
|
(virt_loc.phys_col_offset > vcell->cellblock->stop_col))
|
||||||
|
{
|
||||||
|
borders->top = CELL_BORDER_LINE_NONE;
|
||||||
|
borders->bottom = CELL_BORDER_LINE_NONE;
|
||||||
|
borders->left = CELL_BORDER_LINE_NONE;
|
||||||
|
borders->right = CELL_BORDER_LINE_NONE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ============================================== */
|
||||||
|
|
||||||
#define NEW(NAME, CN, TYPE) \
|
#define NEW(NAME, CN, TYPE) \
|
||||||
reg->CN##Cell = xaccMalloc##TYPE##Cell(); \
|
reg->CN##Cell = xaccMalloc##TYPE##Cell(); \
|
||||||
reg->cells[NAME##_CELL] = (BasicCell *) reg->CN##Cell;
|
reg->cells[NAME##_CELL] = (BasicCell *) reg->CN##Cell;
|
||||||
@ -733,7 +757,6 @@ xaccInitSplitRegister (SplitRegister *reg,
|
|||||||
NEW (RECN, recn, Recn);
|
NEW (RECN, recn, Recn);
|
||||||
NEW (SHRBALN, shrbaln, Price);
|
NEW (SHRBALN, shrbaln, Price);
|
||||||
NEW (BALN, balance, Price);
|
NEW (BALN, balance, Price);
|
||||||
|
|
||||||
NEW (XFRM, xfrm, Combo);
|
NEW (XFRM, xfrm, Combo);
|
||||||
NEW (MXFRM, mxfrm, Combo);
|
NEW (MXFRM, mxfrm, Combo);
|
||||||
NEW (XTO, xto, Combo);
|
NEW (XTO, xto, Combo);
|
||||||
@ -847,8 +870,14 @@ xaccInitSplitRegister (SplitRegister *reg,
|
|||||||
/* add menu items for the action cell */
|
/* add menu items for the action cell */
|
||||||
configAction (reg);
|
configAction (reg);
|
||||||
|
|
||||||
table = gnc_table_new (entry_handler, fg_color_handler, bg_color_handler,
|
table = gnc_table_new (entry_handler,
|
||||||
reg, allocator, deallocator, copy);
|
fg_color_handler,
|
||||||
|
bg_color_handler,
|
||||||
|
sr_get_cell_borders,
|
||||||
|
reg,
|
||||||
|
allocator,
|
||||||
|
deallocator,
|
||||||
|
copy);
|
||||||
|
|
||||||
/* Set up header */
|
/* Set up header */
|
||||||
{
|
{
|
||||||
|
@ -62,6 +62,7 @@ Table *
|
|||||||
gnc_table_new (TableGetEntryHandler entry_handler,
|
gnc_table_new (TableGetEntryHandler entry_handler,
|
||||||
TableGetFGColorHandler fg_color_handler,
|
TableGetFGColorHandler fg_color_handler,
|
||||||
TableGetBGColorHandler bg_color_handler,
|
TableGetBGColorHandler bg_color_handler,
|
||||||
|
TableGetCellBorderHandler cell_border_handler,
|
||||||
gpointer handler_user_data,
|
gpointer handler_user_data,
|
||||||
VirtCellDataAllocator allocator,
|
VirtCellDataAllocator allocator,
|
||||||
VirtCellDataDeallocator deallocator,
|
VirtCellDataDeallocator deallocator,
|
||||||
@ -76,6 +77,7 @@ gnc_table_new (TableGetEntryHandler entry_handler,
|
|||||||
table->entry_handler = entry_handler;
|
table->entry_handler = entry_handler;
|
||||||
table->fg_color_handler = fg_color_handler;
|
table->fg_color_handler = fg_color_handler;
|
||||||
table->bg_color_handler = bg_color_handler;
|
table->bg_color_handler = bg_color_handler;
|
||||||
|
table->cell_border_handler = cell_border_handler;
|
||||||
table->handler_user_data = handler_user_data;
|
table->handler_user_data = handler_user_data;
|
||||||
table->vcell_data_allocator = allocator;
|
table->vcell_data_allocator = allocator;
|
||||||
table->vcell_data_deallocator = deallocator;
|
table->vcell_data_deallocator = deallocator;
|
||||||
@ -263,6 +265,18 @@ gnc_table_get_bg_color (Table *table, VirtualLocation virt_loc)
|
|||||||
|
|
||||||
/* ==================================================== */
|
/* ==================================================== */
|
||||||
|
|
||||||
|
void
|
||||||
|
gnc_table_get_borders (Table *table, VirtualLocation virt_loc,
|
||||||
|
PhysicalCellBorders *borders)
|
||||||
|
{
|
||||||
|
if (!table->cell_border_handler)
|
||||||
|
return;
|
||||||
|
|
||||||
|
table->cell_border_handler (virt_loc, borders, table->handler_user_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ==================================================== */
|
||||||
|
|
||||||
CellAlignment
|
CellAlignment
|
||||||
gnc_table_get_align (Table *table, VirtualLocation virt_loc)
|
gnc_table_get_align (Table *table, VirtualLocation virt_loc)
|
||||||
{
|
{
|
||||||
@ -877,7 +891,7 @@ gnc_table_leave_update(Table *table, VirtualLocation virt_loc)
|
|||||||
int cell_col;
|
int cell_col;
|
||||||
|
|
||||||
if (table == NULL)
|
if (table == NULL)
|
||||||
return NULL;
|
return;
|
||||||
|
|
||||||
cb = table->current_cursor;
|
cb = table->current_cursor;
|
||||||
|
|
||||||
|
@ -96,7 +96,8 @@
|
|||||||
#include "gtable.h"
|
#include "gtable.h"
|
||||||
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum
|
||||||
|
{
|
||||||
GNC_TABLE_TRAVERSE_POINTER,
|
GNC_TABLE_TRAVERSE_POINTER,
|
||||||
GNC_TABLE_TRAVERSE_LEFT,
|
GNC_TABLE_TRAVERSE_LEFT,
|
||||||
GNC_TABLE_TRAVERSE_RIGHT,
|
GNC_TABLE_TRAVERSE_RIGHT,
|
||||||
@ -118,6 +119,23 @@ struct _VirtualCell
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
CELL_BORDER_LINE_NONE,
|
||||||
|
CELL_BORDER_LINE_LIGHT,
|
||||||
|
CELL_BORDER_LINE_NORMAL,
|
||||||
|
CELL_BORDER_LINE_HEAVY
|
||||||
|
} PhysicalCellBorderLineStyle;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
PhysicalCellBorderLineStyle top;
|
||||||
|
PhysicalCellBorderLineStyle bottom;
|
||||||
|
PhysicalCellBorderLineStyle left;
|
||||||
|
PhysicalCellBorderLineStyle right;
|
||||||
|
} PhysicalCellBorders;
|
||||||
|
|
||||||
|
|
||||||
typedef struct _Table Table;
|
typedef struct _Table Table;
|
||||||
|
|
||||||
typedef void (*TableMoveFunc) (Table *table,
|
typedef void (*TableMoveFunc) (Table *table,
|
||||||
@ -142,6 +160,10 @@ typedef guint32 (*TableGetFGColorHandler) (VirtualLocation virt_loc,
|
|||||||
typedef guint32 (*TableGetBGColorHandler) (VirtualLocation virt_loc,
|
typedef guint32 (*TableGetBGColorHandler) (VirtualLocation virt_loc,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
|
typedef void (*TableGetCellBorderHandler) (VirtualLocation virt_loc,
|
||||||
|
PhysicalCellBorders *borders,
|
||||||
|
gpointer user_data);
|
||||||
|
|
||||||
typedef gpointer (*VirtCellDataAllocator) (void);
|
typedef gpointer (*VirtCellDataAllocator) (void);
|
||||||
typedef void (*VirtCellDataDeallocator) (gpointer user_data);
|
typedef void (*VirtCellDataDeallocator) (gpointer user_data);
|
||||||
typedef void (*VirtCellDataCopy) (gpointer to, gconstpointer from);
|
typedef void (*VirtCellDataCopy) (gpointer to, gconstpointer from);
|
||||||
@ -190,6 +212,7 @@ struct _Table
|
|||||||
TableGetEntryHandler entry_handler;
|
TableGetEntryHandler entry_handler;
|
||||||
TableGetFGColorHandler fg_color_handler;
|
TableGetFGColorHandler fg_color_handler;
|
||||||
TableGetBGColorHandler bg_color_handler;
|
TableGetBGColorHandler bg_color_handler;
|
||||||
|
TableGetCellBorderHandler cell_border_handler;
|
||||||
|
|
||||||
gpointer handler_user_data;
|
gpointer handler_user_data;
|
||||||
|
|
||||||
@ -205,6 +228,7 @@ struct _Table
|
|||||||
Table * gnc_table_new (TableGetEntryHandler entry_handler,
|
Table * gnc_table_new (TableGetEntryHandler entry_handler,
|
||||||
TableGetFGColorHandler fg_color_handler,
|
TableGetFGColorHandler fg_color_handler,
|
||||||
TableGetBGColorHandler bg_color_handler,
|
TableGetBGColorHandler bg_color_handler,
|
||||||
|
TableGetCellBorderHandler cell_border_handler,
|
||||||
gpointer handler_user_data,
|
gpointer handler_user_data,
|
||||||
VirtCellDataAllocator allocator,
|
VirtCellDataAllocator allocator,
|
||||||
VirtCellDataDeallocator deallocator,
|
VirtCellDataDeallocator deallocator,
|
||||||
@ -245,6 +269,9 @@ guint32 gnc_table_get_fg_color (Table *table, VirtualLocation virt_loc);
|
|||||||
|
|
||||||
guint32 gnc_table_get_bg_color (Table *table, VirtualLocation virt_loc);
|
guint32 gnc_table_get_bg_color (Table *table, VirtualLocation virt_loc);
|
||||||
|
|
||||||
|
void gnc_table_get_borders (Table *table, VirtualLocation virt_loc,
|
||||||
|
PhysicalCellBorders *borders);
|
||||||
|
|
||||||
CellAlignment gnc_table_get_align (Table *table, VirtualLocation virt_loc);
|
CellAlignment gnc_table_get_align (Table *table, VirtualLocation virt_loc);
|
||||||
|
|
||||||
/* Return the virtual cell of the header */
|
/* Return the virtual cell of the header */
|
||||||
|
Loading…
Reference in New Issue
Block a user