Cleanup register help handling. General cleanups.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@5127 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas 2001-08-14 09:20:04 +00:00
parent 8e5c8ca45a
commit be4f4ff940
19 changed files with 182 additions and 196 deletions

View File

@ -119,7 +119,6 @@ static void advance_toggle( GtkButton *b, SchedXactionEditorDialog *sxed );
/* ledger standard-handlers */
static void sxe_ledger_destroy( xaccLedgerDisplay *ld );
static gncUIWidget sxe_ledger_get_parent( xaccLedgerDisplay *ld );
static void sxe_ledger_set_help( xaccLedgerDisplay *ld, const char *help_str );
/* ledger callbacks */
static void sxe_register_record_cb( GnucashRegister *reg, gpointer d );
@ -681,8 +680,7 @@ schedXact_editor_create_ledger( SchedXactionEditorDialog *sxed )
xaccLedgerDisplaySetHandlers( sxed->ledger,
sxe_ledger_destroy,
sxe_ledger_get_parent,
sxe_ledger_set_help );
sxe_ledger_get_parent );
xaccLedgerDisplaySetUserData( sxed->ledger, (gpointer)sxed );
splitreg = xaccLedgerDisplayGetSR( sxed->ledger );
@ -1058,19 +1056,6 @@ sxe_ledger_get_parent( xaccLedgerDisplay *ld )
return sxed->dialog;
}
static
void
sxe_ledger_set_help( xaccLedgerDisplay *ld, const char *help_str )
{
/* FIXME: display the given help text somewhere.
FIXME: well, we have the place, but this is called far too often
*/
#if 0
DEBUG( "FIXME: sxe_ledger_set_help called with \"%s\"\n",
help_str );
#endif /* 0 */
}
static
void
sxe_register_record_cb( GnucashRegister *reg, gpointer d )

View File

@ -117,9 +117,10 @@ static int last_stock_width = 0;
/** PROTOTYPES ******************************************************/
static void gnc_register_redraw_all_cb (GnucashRegister *g_reg, gpointer data);
static void gnc_register_redraw_help_cb (GnucashRegister *g_reg,
gpointer data);
static void gnc_reg_refresh_toolbar(RegWindow *regData);
static void regDestroy(xaccLedgerDisplay *ledger);
static void regSetHelp(xaccLedgerDisplay *ledger, const char *help_str);
static void gnc_register_check_close(RegWindow *regData);
static void cutCB(GtkWidget *w, gpointer data);
static void copyCB(GtkWidget *w, gpointer data);
@ -1985,8 +1986,7 @@ regWindowLedger (xaccLedgerDisplay *ledger)
xaccLedgerDisplaySetHandlers (ledger,
regDestroy,
gnc_register_get_parent,
regSetHelp);
gnc_register_get_parent);
register_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
@ -2133,6 +2133,8 @@ regWindowLedger (xaccLedgerDisplay *ledger)
GTK_SIGNAL_FUNC(gnc_register_record_cb), regData);
gtk_signal_connect (GTK_OBJECT(register_widget), "redraw_all",
GTK_SIGNAL_FUNC(gnc_register_redraw_all_cb), regData);
gtk_signal_connect (GTK_OBJECT(register_widget), "redraw_help",
GTK_SIGNAL_FUNC(gnc_register_redraw_help_cb), regData);
popup = gnc_register_create_popup_menu (regData);
gnucash_register_attach_popup (GNUCASH_REGISTER(register_widget),
@ -2450,6 +2452,27 @@ gnc_register_redraw_all_cb (GnucashRegister *g_reg, gpointer data)
}
}
static void
gnc_register_redraw_help_cb (GnucashRegister *g_reg, gpointer data)
{
RegWindow *regData = data;
SplitRegister *reg;
const char *status;
char *help;
if (!regData)
return;
reg = xaccLedgerDisplayGetSR (regData->ledger);
help = gnc_table_get_help (reg->table);
status = help ? help : "";
gnome_appbar_set_default (GNOME_APPBAR(regData->statusbar), status);
g_free (help);
}
static void
gnc_reg_save_size (RegWindow *regData)
@ -2508,24 +2531,6 @@ regDestroy (xaccLedgerDisplay *ledger)
}
static void
regSetHelp (xaccLedgerDisplay *ledger, const char *help_str)
{
RegWindow *regData = xaccLedgerDisplayGetUserData (ledger);
const gchar *status;
if (!regData)
return;
if (help_str != NULL)
status = help_str;
else
status = "";
gnome_appbar_set_default (GNOME_APPBAR(regData->statusbar), status);
}
static void
newAccountCB (GtkWidget * w, gpointer data)
{

View File

@ -62,7 +62,6 @@ struct _xaccLedgerDisplay
LedgerDisplayDestroy destroy;
LedgerDisplayGetParent get_parent;
LedgerDisplaySetHelp set_help;
gpointer user_data;
@ -126,15 +125,13 @@ xaccLedgerDisplayGetUserData (xaccLedgerDisplay *ld)
void
xaccLedgerDisplaySetHandlers (xaccLedgerDisplay *ld,
LedgerDisplayDestroy destroy,
LedgerDisplayGetParent get_parent,
LedgerDisplaySetHelp set_help)
LedgerDisplayGetParent get_parent)
{
if (!ld)
return;
ld->destroy = destroy;
ld->get_parent = get_parent;
ld->set_help = set_help;
}
SplitRegister *
@ -489,20 +486,6 @@ xaccLedgerDisplayParent (void *user_data)
return regData->get_parent (regData);
}
static void
xaccLedgerDisplaySetHelp (void *user_data, const char *help_str)
{
xaccLedgerDisplay *regData = user_data;
if (regData == NULL)
return;
if (regData->set_help == NULL)
return;
regData->set_help (regData, help_str);
}
static gpointer
xaccMLGUIDMalloc (void)
{
@ -786,7 +769,6 @@ xaccLedgerDisplayInternal (Account *lead_account, Query *q,
ld->loading = FALSE;
ld->destroy = NULL;
ld->get_parent = NULL;
ld->set_help = NULL;
ld->user_data = NULL;
show_all = gnc_lookup_boolean_option ("Register",
@ -838,9 +820,7 @@ xaccLedgerDisplayInternal (Account *lead_account, Query *q,
ld->control->user_data = ld->reg;
xaccSRSetData (ld->reg, ld,
xaccLedgerDisplayParent,
xaccLedgerDisplaySetHelp);
xaccSRSetData (ld->reg, ld, xaccLedgerDisplayParent);
ld->reg->template = templateMode;

View File

@ -70,8 +70,7 @@ gpointer xaccLedgerDisplayGetUserData (xaccLedgerDisplay *ld);
/* set the handlers used by the ledger display */
void xaccLedgerDisplaySetHandlers (xaccLedgerDisplay *ld,
LedgerDisplayDestroy destroy,
LedgerDisplayGetParent get_parent,
LedgerDisplaySetHelp set_help);
LedgerDisplayGetParent get_parent);
/* return the split register associated with a ledger display */
SplitRegister * xaccLedgerDisplayGetSR (xaccLedgerDisplay *ld);

View File

@ -172,8 +172,7 @@ xaccSRDestroyRegisterData (SplitRegister *reg)
void
xaccSRSetData (SplitRegister *reg, void *user_data,
SRGetParentCallback get_parent,
SRSetHelpCallback set_help)
SRGetParentCallback get_parent)
{
SRInfo *info = xaccSRGetInfo (reg);
@ -181,7 +180,6 @@ xaccSRSetData (SplitRegister *reg, void *user_data,
info->user_data = user_data;
info->get_parent = get_parent;
info->set_help = set_help;
}
void
@ -357,26 +355,6 @@ xaccSRCurrentTransExpanded (SplitRegister *reg)
return info->trans_expanded;
}
/* ======================================================== */
static void
LedgerSetHelp (Table *table, const char *help_str)
{
/* FIXME */
return;
#if 0
SplitRegister *reg = table->user_data;
SRInfo *info = xaccSRGetInfo(reg);
if (info->set_help == NULL)
return;
info->set_help(info->user_data, help_str);
#endif
}
/* ======================================================== */
static void
LedgerDestroy (SplitRegister *reg)
{
@ -3596,7 +3574,7 @@ xaccSRLoadRegister (SplitRegister *reg, GList * slist,
/* disable move callback -- we don't want the cascade of
* callbacks while we are fiddling with loading the register */
table->control->allow_move = FALSE;
gnc_table_control_allow_move (table->control, FALSE);
/* invalidate the cursor */
{
@ -3649,7 +3627,7 @@ xaccSRLoadRegister (SplitRegister *reg, GList * slist,
}
}
table->dividing_row = -1;
table->model->dividing_row = -1;
if (multi_line)
trans_table = g_hash_table_new (g_direct_hash, g_direct_equal);
@ -3682,7 +3660,7 @@ xaccSRLoadRegister (SplitRegister *reg, GList * slist,
!found_divider &&
(present < xaccTransGetDate (trans)))
{
table->dividing_row = vcell_loc.virt_row;
table->model->dividing_row = vcell_loc.virt_row;
found_divider = TRUE;
}
@ -3853,9 +3831,7 @@ xaccSRLoadRegister (SplitRegister *reg, GList * slist,
recn_cell_confirm, reg);
/* enable callback for cursor user-driven moves */
table->control->allow_move = TRUE;
table->set_help = LedgerSetHelp;
gnc_table_control_allow_move (table->control, TRUE);
reg->destroy = LedgerDestroy;

View File

@ -61,8 +61,7 @@ typedef gboolean (*SRReverseBalanceCallback) (Account *account);
/* The xaccSRSetData() method sets the user data and callback
* hooks for the register. */
void xaccSRSetData(SplitRegister *reg, gpointer user_data,
SRGetParentCallback get_parent,
SRSetHelpCallback set_help);
SRGetParentCallback get_parent);
/* The xaccSRSetReverseBalanceCallback() method sets up
* a callback used to determine whether split balances

View File

@ -98,9 +98,6 @@ struct _SRInfo
/* hook to get parent widget */
SRGetParentCallback get_parent;
/* hook to set help string */
SRSetHelpCallback set_help;
};

View File

@ -866,8 +866,6 @@ xaccInitSplitRegister (SplitRegister *reg,
header = gnc_table_layout_get_cursor (reg->table->layout, CURSOR_HEADER);
gnc_table_set_vcell (reg->table, header, NULL, TRUE, TRUE, vcell_loc);
reg->table->num_header_phys_rows = use_double_line ? 2 : 1;
}
/* Set up first and only initial row */
@ -906,8 +904,6 @@ xaccConfigSplitRegister (SplitRegister *reg,
reg->style = newstyle;
reg->use_double_line = use_double_line;
reg->table->num_header_phys_rows = use_double_line ? 2 : 1;
gnc_table_realize_gui (reg->table);
}

View File

@ -69,7 +69,7 @@ typedef enum
INCOME_LEDGER,
PORTFOLIO_LEDGER,
SEARCH_LEDGER,
NUM_REGISTER_TYPES
} SplitRegisterType;
@ -133,14 +133,14 @@ typedef enum
#define CURSOR_DOUBLE_JOURNAL "cursor-double-journal"
#define CURSOR_SPLIT "cursor-split"
typedef struct _SplitRegister SplitRegister;
typedef struct split_register SplitRegister;
typedef void (*SplitRegisterDestroyCB) (SplitRegister *reg);
struct _SplitRegister
struct split_register
{
/* the table itself that implements the underlying GUI. */
Table * table;
Table * table;
SplitRegisterType type;
SplitRegisterStyle style;

View File

@ -94,20 +94,15 @@ gnc_table_init (Table * table)
table->num_virt_rows = -1;
table->num_virt_cols = -1;
table->num_header_phys_rows = -1;
table->current_cursor = NULL;
gnc_virtual_location_init (&table->current_cursor_loc);
table->set_help = NULL;
table->dividing_row = -1;
/* initialize private data */
table->virt_cells = NULL;
table->ui_redraw_help = NULL;
table->ui_destroy = NULL;
table->ui_data = NULL;
}
@ -368,7 +363,31 @@ gnc_table_is_popup (Table *table, VirtualLocation virt_loc)
return cb_cell->cell->is_popup;
}
/* ==================================================== */
char *
gnc_table_get_help (Table *table)
{
VirtualCell *vcell;
CellBlockCell *cb_cell;
VirtualLocation virt_loc;
if (!table)
return NULL;
virt_loc = table->current_cursor_loc;
vcell = gnc_table_get_virtual_cell (table, virt_loc.vcell_loc);
if (!vcell)
return NULL;
cb_cell = gnc_cellblock_get_cell (vcell->cellblock,
virt_loc.phys_row_offset,
virt_loc.phys_col_offset);
if (!cb_cell || !cb_cell->cell)
return FALSE;
return xaccBasicCellGetHelp (cb_cell->cell);
}
void
gnc_table_set_size (Table * table, int virt_rows, int virt_cols)
@ -920,16 +939,8 @@ gnc_table_enter_update(Table *table,
g_free (old_value);
}
if (table->set_help)
{
char *help_str;
help_str = xaccBasicCellGetHelp(cell);
table->set_help(table, help_str);
g_free(help_str);
}
if (table->ui_redraw_help)
table->ui_redraw_help (table);
LEAVE("return %d\n", can_edit);
@ -1072,16 +1083,8 @@ gnc_table_modify_update(Table *table,
g_free (old_value);
if (table->set_help)
{
char *help_str;
help_str = xaccBasicCellGetHelp (cell);
table->set_help (table, help_str);
g_free (help_str);
}
if (table->ui_redraw_help)
table->ui_redraw_help (table);
LEAVE ("change %d %d (relrow=%d relcol=%d) val=%s\n",
virt_loc.vcell_loc.virt_row,
@ -1156,16 +1159,8 @@ gnc_table_direct_update (Table *table,
g_free (old_value);
if (table->set_help)
{
char *help_str;
help_str = xaccBasicCellGetHelp (cell);
table->set_help (table, help_str);
g_free (help_str);
}
if (table->ui_redraw_help)
table->ui_redraw_help (table);
return result;
}

View File

@ -115,40 +115,28 @@ struct _VirtualCell
typedef struct table Table;
typedef void (*TableRedrawHelpFunc) (Table *table);
typedef void (*TableDestroyFunc) (Table *table);
typedef void (*TableSetHelpFunc) (Table *table,
const char *help_str);
struct table
{
TableControl *control;
TableLayout *layout;
TableModel *model;
short num_virt_rows;
short num_virt_cols;
short num_header_phys_rows;
int num_virt_rows;
int num_virt_cols;
CellBlock *current_cursor;
VirtualLocation current_cursor_loc;
/* callback to set a help string associated with a cell */
TableSetHelpFunc set_help;
/* If positive, denotes a row that marks a boundary that should
* be visually distinguished. */
short dividing_row;
/* private data */
/* This is black-box stuff that higher-level code should not access */
/* The virtual cell table */
GTable *virt_cells;
TableRedrawHelpFunc ui_redraw_help;
TableDestroyFunc ui_destroy;
gpointer ui_data;
};
@ -178,7 +166,7 @@ gboolean gnc_table_virtual_cell_out_of_bounds (Table *table,
VirtualCellLocation vcell_loc);
/* This function returns the virtual cell associated with a particular
* virtual location. If the location is out of bounds, NULL is
* virtual location. If the location is out of bounds, NULL is *
* returned. */
VirtualCell * gnc_table_get_virtual_cell (Table *table,
VirtualCellLocation vcell_loc);
@ -201,6 +189,9 @@ CellAlignment gnc_table_get_align (Table *table, VirtualLocation virt_loc);
gboolean gnc_table_is_popup (Table *table, VirtualLocation virt_loc);
char * gnc_table_get_help (Table *table);
/* Return the virtual cell of the header */
VirtualCell * gnc_table_get_header_cell (Table *table);
@ -208,8 +199,6 @@ VirtualCell * gnc_table_get_header_cell (Table *table);
* indicated dimensions. */
void gnc_table_set_size (Table * table, int virt_rows, int virt_cols);
void gnc_table_realize_gui (Table *table);
/* Indicate what handler should be used for a given virtual block */
void gnc_table_set_vcell (Table *table, CellBlock *cursor,
gconstpointer vcell_data,
@ -271,6 +260,8 @@ gboolean gnc_table_find_close_valid_cell (Table *table,
/* Initialize the GUI from a table */
void gnc_table_init_gui (gncUIWidget widget, gpointer data);
void gnc_table_realize_gui (Table *table);
/* Refresh the current cursor gui */
void gnc_table_refresh_current_cursor_gui (Table * table,
gboolean do_scroll);

View File

@ -34,6 +34,8 @@ gnc_table_model_new (void)
model = g_new0 (TableModel, 1);
model->dividing_row = -1;
return model;
}

View File

@ -97,6 +97,10 @@ typedef struct
gpointer handler_user_data;
/* If positive, denotes a row that marks a boundary that should
* be visually distinguished. */
int dividing_row;
VirtCellDataAllocator cell_data_allocator;
VirtCellDataDeallocator cell_data_deallocator;
VirtCellDataCopy cell_data_copy;

View File

@ -424,9 +424,10 @@ draw_cell (GnucashGrid *grid,
x, y, width, height);
/* dividing line */
if ((virt_loc.phys_row_offset == 0) && (table->dividing_row >= 0))
if ((virt_loc.phys_row_offset == 0) &&
(table->model->dividing_row >= 0))
{
if (virt_loc.vcell_loc.virt_row == table->dividing_row)
if (virt_loc.vcell_loc.virt_row == table->model->dividing_row)
{
gdk_gc_set_foreground (grid->gc, &gn_blue);
gdk_draw_line (drawable, grid->gc, x, y, x + width, y);
@ -434,9 +435,10 @@ draw_cell (GnucashGrid *grid,
}
if ((virt_loc.phys_row_offset == (block->style->nrows - 1)) &&
(table->dividing_row >= 0))
(table->model->dividing_row >= 0))
{
if (virt_loc.vcell_loc.virt_row == (table->dividing_row - 1))
if (virt_loc.vcell_loc.virt_row ==
(table->model->dividing_row - 1))
{
gdk_gc_set_foreground (grid->gc, &gn_blue);
gdk_draw_line (drawable, grid->gc, x, y + height,

View File

@ -90,9 +90,8 @@ gnucash_header_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
bg_color = gnucash_color_argb_to_gdk (argb);
h = style->dimensions->height;
if (header->style->nrows == 1 &&
header->sheet->table->num_header_phys_rows == 2)
h *= 2;
h *= header->num_phys_rows;
h /= header->style->nrows;
gdk_gc_set_foreground (header->gc, bg_color);
@ -282,12 +281,11 @@ gnucash_header_destroy (GtkObject *object)
void
gnucash_header_reconfigure (GnucashHeader *header)
{
int w, h;
GnomeCanvas *canvas;
GtkWidget *widget;
GnucashSheet *sheet;
SheetBlockStyle *old_style;
int w, h;
g_return_if_fail (header != NULL);
g_return_if_fail (GNUCASH_IS_HEADER (header));
@ -303,18 +301,12 @@ gnucash_header_reconfigure (GnucashHeader *header)
if (header->style == NULL)
return;
/* Check for a valid header row. This can be invalid during
arg setting. */
if (header->row < 0 || header->row >= header->style->nrows)
return;
sheet->width = header->style->dimensions->width;
w = header->style->dimensions->width;
h = header->style->dimensions->height;
if (header->style->nrows == 1 &&
header->sheet->table->num_header_phys_rows == 2)
h *= 2;
h *= header->num_phys_rows;
h /= header->style->nrows;
h += 2;
if (header->height != h ||
@ -333,6 +325,16 @@ gnucash_header_reconfigure (GnucashHeader *header)
}
}
void
gnucash_header_set_header_rows (GnucashHeader *header,
int num_phys_rows)
{
g_return_if_fail (header != NULL);
g_return_if_fail (GNUCASH_IS_HEADER (header));
header->num_phys_rows = num_phys_rows;
}
static double
gnucash_header_point (GnomeCanvasItem *item,
double x, double y, int cx, int cy,
@ -357,7 +359,7 @@ pointer_on_resize_line (GnucashHeader *header, int x, int y, int *col)
int j;
for (j = 0; j < style->ncols; j++) {
cd = gnucash_style_get_cell_dimensions (style, header->row, j);
cd = gnucash_style_get_cell_dimensions (style, 0, j);
pixels += cd->pixel_width;
if (x >= pixels - 1 && x <= pixels + 1)
on_the_line = TRUE;
@ -371,7 +373,6 @@ pointer_on_resize_line (GnucashHeader *header, int x, int y, int *col)
return on_the_line;
}
static int
find_resize_col (GnucashHeader *header, int col)
{
@ -493,9 +494,8 @@ gnucash_header_event (GnomeCanvasItem *item, GdkEvent *event)
if (col > -1) {
CellDimensions *cd;
cd = gnucash_style_get_cell_dimensions (header->style,
header->row,
col);
cd = gnucash_style_get_cell_dimensions
(header->style, 0, col);
header->in_resize = TRUE;
header->resize_col = col;

View File

@ -39,12 +39,15 @@ typedef struct {
char *cursor_name;
int row;
int num_phys_rows;
int in_resize;
int resize_col_width;
int resize_x;
int resize_col;
int needs_ungrab;
gboolean needs_ungrab;
int height;
int width;
@ -62,6 +65,8 @@ typedef struct {
GtkWidget *gnucash_header_new (GnucashSheet *sheet);
void gnucash_header_reconfigure (GnucashHeader *header);
void gnucash_header_set_header_rows (GnucashHeader *header,
int num_phys_rows);
#endif /* GNUCASH_HEADER_H */

View File

@ -67,6 +67,7 @@ enum
{
ACTIVATE_CURSOR,
REDRAW_ALL,
REDRAW_HELP,
LAST_SIGNAL
};
@ -535,6 +536,14 @@ gnucash_sheet_redraw_all (GnucashSheet *sheet)
gtk_signal_emit_by_name (GTK_OBJECT (sheet->reg), "redraw_all");
}
void
gnucash_sheet_redraw_help (GnucashSheet *sheet)
{
g_return_if_fail (sheet != NULL);
g_return_if_fail (GNUCASH_IS_SHEET(sheet));
gtk_signal_emit_by_name (GTK_OBJECT (sheet->reg), "redraw_help");
}
void
gnucash_sheet_redraw_block (GnucashSheet *sheet, VirtualCellLocation vcell_loc)
@ -1893,14 +1902,16 @@ gnucash_sheet_block_set_from_table (GnucashSheet *sheet,
vcell = gnc_table_get_virtual_cell (table, vcell_loc);
if (block->style && (block->style != style)) {
if (block->style && (block->style != style))
{
gnucash_style_unref (block->style);
block->style = NULL;
}
block->visible = (vcell) ? vcell->visible : TRUE;
if (block->style == NULL) {
if (block->style == NULL)
{
block->style = style;
gnucash_style_ref(block->style);
return TRUE;
@ -2074,7 +2085,7 @@ void
gnucash_sheet_table_load (GnucashSheet *sheet, gboolean do_scroll)
{
Table *table;
gint num_virt_rows;
gint num_header_phys_rows;
gint i, j;
g_return_if_fail (sheet != NULL);
@ -2082,25 +2093,35 @@ gnucash_sheet_table_load (GnucashSheet *sheet, gboolean do_scroll)
g_return_if_fail (sheet->table != NULL);
table = sheet->table;
num_virt_rows = table->num_virt_rows;
gnucash_header_reconfigure (GNUCASH_HEADER(sheet->header_item));
gtk_layout_freeze (GTK_LAYOUT(sheet));
gnucash_sheet_stop_editing (sheet);
/* resize the sheet */
gnucash_sheet_resize (sheet);
num_header_phys_rows = 0;
/* fill it up */
for (i = 0; i < table->num_virt_rows; i++)
for (j = 0; j < table->num_virt_cols; j++) {
for (j = 0; j < table->num_virt_cols; j++)
{
VirtualCellLocation vcell_loc = { i, j };
VirtualCell *vcell;
gnucash_sheet_block_set_from_table (sheet, vcell_loc);
vcell = gnc_table_get_virtual_cell (table, vcell_loc);
num_header_phys_rows =
MAX (num_header_phys_rows,
vcell->cellblock->num_rows);
}
gnucash_header_set_header_rows (GNUCASH_HEADER (sheet->header_item),
num_header_phys_rows);
gnucash_header_reconfigure (GNUCASH_HEADER(sheet->header_item));
gnucash_sheet_recompute_block_offsets (sheet);
gnucash_sheet_set_scroll_region (sheet);
@ -2337,11 +2358,21 @@ gnucash_register_class_init (GnucashRegisterClass *class)
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
register_signals[REDRAW_HELP] =
gtk_signal_new("redraw_help",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET(GnucashRegisterClass,
redraw_help),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
gtk_object_class_add_signals(object_class, register_signals,
LAST_SIGNAL);
class->activate_cursor = NULL;
class->redraw_all = NULL;
class->redraw_help = NULL;
}

View File

@ -150,6 +150,7 @@ gint gnucash_sheet_col_max_width (GnucashSheet *sheet,
gint virt_col, gint cell_col);
void gnucash_sheet_redraw_all (GnucashSheet *sheet);
void gnucash_sheet_redraw_help (GnucashSheet *sheet);
void gnucash_sheet_redraw_block (GnucashSheet *sheet,
VirtualCellLocation vcell_loc);
@ -210,6 +211,7 @@ typedef struct
void (*activate_cursor) (GnucashRegister *reg);
void (*redraw_all) (GnucashRegister *reg);
void (*redraw_help) (GnucashRegister *reg);
} GnucashRegisterClass;
#endif

View File

@ -99,7 +99,23 @@ gnc_table_save_state (Table *table)
}
static void
table_destroy_cb(Table *table)
table_ui_redraw_cb (Table *table)
{
GnucashSheet *sheet;
if (table == NULL)
return;
if (table->ui_data == NULL)
return;
sheet = GNUCASH_SHEET (table->ui_data);
gnucash_sheet_redraw_help (sheet);
}
static void
table_destroy_cb (Table *table)
{
GnucashSheet *sheet;
@ -130,10 +146,11 @@ gnc_table_init_gui (gncUIWidget widget, void *data)
g_return_if_fail (GNUCASH_IS_REGISTER (widget));
g_return_if_fail (data != NULL);
greg = GNUCASH_REGISTER(widget);
sheet = GNUCASH_SHEET(greg->sheet);
greg = GNUCASH_REGISTER (widget);
sheet = GNUCASH_SHEET (greg->sheet);
table = sheet->table;
table->ui_redraw_help = table_ui_redraw_cb;
table->ui_destroy = table_destroy_cb;
table->ui_data = sheet;
@ -150,7 +167,7 @@ gnc_table_init_gui (gncUIWidget widget, void *data)
else
alist = SCM_EOL;
while (gh_list_p(alist) && !gh_null_p(alist))
while (gh_list_p (alist) && !gh_null_p (alist))
{
char *name;
CellType ctype;