More cleanup.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@5142 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas
2001-08-16 08:34:04 +00:00
parent f917b12b06
commit 589465e2cb
21 changed files with 203 additions and 476 deletions
+2 -4
View File
@@ -18,8 +18,7 @@ libgncmod_register_core_la_SOURCES = \
table-allgui.c \
table-control.c \
table-layout.c \
table-model.c \
textcell.c
table-model.c
noinst_HEADERS = \
QuickFill.h \
@@ -38,8 +37,7 @@ noinst_HEADERS = \
table-allgui.h \
table-control.h \
table-layout.h \
table-model.h \
textcell.h
table-model.h
EXTRA_DIST = \
.cvsignore
+3 -7
View File
@@ -200,7 +200,7 @@ gnc_basic_cell_set_value (BasicCell *cell, const char *val)
cell->set_value = cb;
}
else
xaccSetBasicCellValueInternal (cell, val);
gnc_basic_cell_set_value_internal (cell, val);
}
gboolean
@@ -249,8 +249,6 @@ xaccSetBasicCellBlankHelp (BasicCell *cell, const char *blank_help)
cell->blank_help = g_strdup (blank_help);
}
/* ===================================================== */
char *
xaccBasicCellGetHelp (BasicCell *cell)
{
@@ -263,10 +261,8 @@ xaccBasicCellGetHelp (BasicCell *cell)
return cell->get_help_value(cell);
}
/* ===================================================== */
void
xaccSetBasicCellValueInternal (BasicCell *cell, const char *value)
gnc_basic_cell_set_value_internal (BasicCell *cell, const char *value)
{
if (value == NULL)
value = "";
@@ -283,7 +279,7 @@ xaccSetBasicCellWCValueInternal (BasicCell *cell, const GdkWChar *value)
{
if (!value)
{
xaccSetBasicCellValueInternal (cell, "");
gnc_basic_cell_set_value_internal (cell, "");
return;
}
+2 -2
View File
@@ -261,8 +261,8 @@ void xaccSetBasicCellBlankHelp (BasicCell *bcell, const char *help);
char * xaccBasicCellGetHelp (BasicCell *bcell);
/* for sub-class use only */
void xaccSetBasicCellValueInternal (BasicCell *bcell,
const char *value);
void gnc_basic_cell_set_value_internal (BasicCell *bcell,
const char *value);
void xaccSetBasicCellWCValueInternal (BasicCell *bcell,
const GdkWChar *value);
+44 -41
View File
@@ -30,7 +30,7 @@
*
* HISTORY:
* Copyright (c) 1998 Linas Vepstas
* Copyright (c) 2000 Dave Peticolas
* Copyright (c) 2000-2001 Dave Peticolas <dave@krondo.com>
*/
#include "config.h"
@@ -45,9 +45,11 @@ gnc_cellblock_new (int rows, int cols, const char *cursor_name)
{
CellBlock *cellblock;
g_return_val_if_fail (rows > 0, NULL);
g_return_val_if_fail (cols > 0, NULL);
g_return_val_if_fail (cursor_name != NULL, NULL);
cellblock = g_new0(CellBlock, 1);
cellblock = g_new0 (CellBlock, 1);
gnc_cellblock_init (cellblock, rows, cols);
@@ -56,25 +58,6 @@ gnc_cellblock_new (int rows, int cols, const char *cursor_name)
return cellblock;
}
static void
gnc_cellblock_cell_construct (gpointer _cb_cell, gpointer user_data)
{
CellBlockCell *cb_cell = _cb_cell;
cb_cell->cell = NULL;
}
static void
gnc_cellblock_cell_destroy (gpointer _cb_cell, gpointer user_data)
{
CellBlockCell *cb_cell = _cb_cell;
if (cb_cell == NULL)
return;
cb_cell->cell = NULL;
}
static void
gnc_cellblock_init (CellBlock *cellblock, int rows, int cols)
{
@@ -86,10 +69,9 @@ gnc_cellblock_init (CellBlock *cellblock, int rows, int cols)
cellblock->stop_col = -1;
/* malloc new cell table */
cellblock->cb_cells = g_table_new (sizeof (CellBlockCell),
gnc_cellblock_cell_construct,
gnc_cellblock_cell_destroy, NULL);
g_table_resize (cellblock->cb_cells, rows, cols);
cellblock->cells = g_ptr_array_new ();
g_ptr_array_set_size (cellblock->cells, rows * cols);
}
void
@@ -97,8 +79,8 @@ gnc_cellblock_destroy (CellBlock *cellblock)
{
if (!cellblock) return;
g_table_destroy (cellblock->cb_cells);
cellblock->cb_cells = NULL;
g_ptr_array_free (cellblock->cells, FALSE);
cellblock->cells = NULL;
g_free (cellblock->cursor_name);
cellblock->cursor_name = NULL;
@@ -106,13 +88,36 @@ gnc_cellblock_destroy (CellBlock *cellblock)
g_free (cellblock);
}
CellBlockCell *
void
gnc_cellblock_set_cell (CellBlock *cellblock,
int row, int col,
BasicCell *cell)
{
if (cellblock == NULL)
return;
if (row < 0 || row >= cellblock->num_rows)
return;
if (col < 0 || col >= cellblock->num_cols)
return;
cellblock->cells->pdata[(row * cellblock->num_cols) + col] = cell;
}
BasicCell *
gnc_cellblock_get_cell (CellBlock *cellblock, int row, int col)
{
if (cellblock == NULL)
return NULL;
return g_table_index (cellblock->cb_cells, row, col);
if (row < 0 || row >= cellblock->num_rows)
return NULL;
if (col < 0 || col >= cellblock->num_cols)
return NULL;
return cellblock->cells->pdata[(row * cellblock->num_cols) + col];
}
gboolean
@@ -126,17 +131,17 @@ gnc_cellblock_changed (CellBlock *cursor, gboolean include_conditional)
for (r = 0; r < cursor->num_rows; r++)
for (c = 0; c < cursor->num_cols; c++)
{
CellBlockCell *cb_cell;
BasicCell *cell;
cb_cell = gnc_cellblock_get_cell (cursor, r, c);
if (cb_cell == NULL)
cell = gnc_cellblock_get_cell (cursor, r, c);
if (cell == NULL)
continue;
if (gnc_basic_cell_get_changed (cb_cell->cell))
if (gnc_basic_cell_get_changed (cell))
return TRUE;
if (include_conditional &&
gnc_basic_cell_get_conditionally_changed (cb_cell->cell))
gnc_basic_cell_get_conditionally_changed (cell))
return TRUE;
}
@@ -154,15 +159,13 @@ gnc_cellblock_clear_changes (CellBlock *cursor)
for (r = 0; r < cursor->num_rows; r++)
for (c = 0; c < cursor->num_cols; c++)
{
CellBlockCell *cb_cell;
BasicCell *cell;
cb_cell = gnc_cellblock_get_cell (cursor, r, c);
if (cb_cell == NULL)
cell = gnc_cellblock_get_cell (cursor, r, c);
if (cell == NULL)
continue;
gnc_basic_cell_set_changed (cb_cell->cell, FALSE);
gnc_basic_cell_set_conditionally_changed (cb_cell->cell, FALSE);
gnc_basic_cell_set_changed (cell, FALSE);
gnc_basic_cell_set_conditionally_changed (cell, FALSE);
}
}
/* --------------- end of file ----------------- */
+10 -14
View File
@@ -65,13 +65,6 @@
#include "gtable.h"
typedef struct
{
BasicCell *cell; /* cell handler */
} CellBlockCell;
typedef struct
{
short num_rows;
@@ -82,7 +75,7 @@ typedef struct
char *cursor_name;
GTable *cb_cells; /* Holds the CellBlockCell table */
GPtrArray *cells; /* Holds the CellBlockCell table */
} CellBlock;
@@ -90,13 +83,16 @@ CellBlock * gnc_cellblock_new (int rows, int cols, const char *cursor_name);
void gnc_cellblock_destroy (CellBlock *cellblock);
CellBlockCell * gnc_cellblock_get_cell (CellBlock *cellblock,
int row, int col);
void gnc_cellblock_set_cell (CellBlock *cellblock,
int row, int col,
BasicCell *cell);
gboolean gnc_cellblock_changed (CellBlock *cursor,
gboolean include_conditional);
BasicCell * gnc_cellblock_get_cell (CellBlock *cellblock,
int row, int col);
void gnc_cellblock_clear_changes (CellBlock *cursor);
gboolean gnc_cellblock_changed (CellBlock *cursor,
gboolean include_conditional);
void gnc_cellblock_clear_changes (CellBlock *cursor);
#endif
+2 -2
View File
@@ -148,7 +148,7 @@ NumMV (BasicCell *_cell,
if (safe_strcmp(buff, "") == 0)
return;
xaccSetBasicCellValueInternal (&cell->cell, buff);
gnc_basic_cell_set_value_internal (&cell->cell, buff);
*cursor_position = -1;
@@ -185,7 +185,7 @@ setNumCellValue (BasicCell *_cell, const char *str)
cell->next_num = number + 1;
}
xaccSetBasicCellValueInternal (_cell, str);
gnc_basic_cell_set_value_internal (_cell, str);
}
/* ================================================ */
+3 -3
View File
@@ -158,7 +158,7 @@ PriceParse (PriceCell *cell, gboolean update_value)
return;
/* Otherwise, change it */
xaccSetBasicCellValueInternal (&cell->cell, newval);
gnc_basic_cell_set_value_internal (&cell->cell, newval);
}
/* ================================================ */
@@ -271,7 +271,7 @@ xaccSetPriceCellValue (PriceCell * cell, gnc_numeric amount)
if (safe_strcmp (buff, cell->cell.value) == 0)
return FALSE;
xaccSetBasicCellValueInternal (&cell->cell, buff);
gnc_basic_cell_set_value_internal (&cell->cell, buff);
return TRUE;
}
@@ -298,7 +298,7 @@ xaccSetPriceCellBlank (PriceCell *cell)
cell->amount = gnc_numeric_zero ();
cell->need_to_parse = FALSE;
xaccSetBasicCellValueInternal (&cell->cell, "");
gnc_basic_cell_set_value_internal (&cell->cell, "");
}
/* ================================================ */
+2 -2
View File
@@ -231,7 +231,7 @@ quick_modify (BasicCell *_cell,
*end_selection = -1;
*cursor_position += change_len;
xaccSetBasicCellValueInternal (&cell->cell, match_str);
gnc_basic_cell_set_value_internal (&cell->cell, match_str);
}
/* ================================================ */
@@ -307,7 +307,7 @@ xaccSetQuickFillCellValue (QuickFillCell *cell, const char * value)
if (cell == NULL)
return;
xaccSetBasicCellValueInternal (&cell->cell, value);
gnc_basic_cell_set_value_internal (&cell->cell, value);
gnc_quickfill_insert_wc (cell->qf, cell->cell.value_w, cell->sort);
}
+2 -2
View File
@@ -136,7 +136,7 @@ RecnSetValue (BasicCell *_cell, const char *value)
if (!value || *value == '\0')
{
cell->reconciled_flag = NREC;
xaccSetBasicCellValueInternal (_cell, "");
gnc_basic_cell_set_value_internal (_cell, "");
return;
}
@@ -171,7 +171,7 @@ xaccRecnCellSetFlag (RecnCell *cell, char reconciled_flag)
string = RecnCellGetString (reconciled_flag);
xaccSetBasicCellValueInternal (&cell->cell, string);
gnc_basic_cell_set_value_internal (&cell->cell, string);
}
/* ================================================ */
@@ -31,7 +31,6 @@
#include "pricecell.h"
#include "recncell.h"
#include "register-common.h"
#include "textcell.h"
#include "quickfillcell.h"
@@ -60,8 +59,6 @@ gnc_register_init (void)
gnc_register_add_cell_type (RECN_CELL_TYPE_NAME, xaccMallocRecnCell);
gnc_register_add_cell_type (TEXT_CELL_TYPE_NAME, xaccMallocTextCell);
gnc_register_add_cell_type (QUICKFILL_CELL_TYPE_NAME,
xaccMallocQuickFillCell);
}
@@ -34,7 +34,6 @@
#define NUM_CELL_TYPE_NAME "num-cell"
#define PRICE_CELL_TYPE_NAME "price-cell"
#define RECN_CELL_TYPE_NAME "recn-cell"
#define TEXT_CELL_TYPE_NAME "text-cell"
#define QUICKFILL_CELL_TYPE_NAME "quickfill-cell"
void gnc_register_init (void);
+9 -12
View File
@@ -206,7 +206,7 @@ set_cell (SplitRegister *reg, CellBlock *cursor,
{
CellBlock *header;
CellBlock *cursor_sl;
CellBlockCell *cb_cell;
BasicCell *cell;
header = gnc_table_layout_get_cursor (reg->table->layout, CURSOR_HEADER);
@@ -216,17 +216,14 @@ set_cell (SplitRegister *reg, CellBlock *cursor,
header->start_col = MIN (header->start_col, col);
header->stop_col = MAX (header->stop_col, col);
cb_cell = gnc_cellblock_get_cell (cursor, row, col);
cb_cell->cell = gnc_table_layout_get_cell (reg->table->layout, cell_type);
cb_cell = gnc_cellblock_get_cell (header, row, col);
cell = gnc_table_layout_get_cell (reg->table->layout, cell_type);
gnc_cellblock_set_cell (cursor, row, col, cell);
cursor_sl = gnc_table_layout_get_cursor (reg->table->layout,
CURSOR_SINGLE_LEDGER);
if (cb_cell && (cursor == cursor_sl))
cb_cell->cell = gnc_table_layout_get_cell (reg->table->layout, cell_type);
if (cursor == cursor_sl)
gnc_cellblock_set_cell (header, row, col, cell);
}
static void
@@ -236,13 +233,13 @@ copy_cursor_row (SplitRegister *reg, CellBlock *to, CellBlock *from, int row)
for (col = 0; col < from->num_cols; col++)
{
CellBlockCell *cb_cell;
BasicCell *cell;
cb_cell = gnc_cellblock_get_cell (from, row, col);
if (!cb_cell || !cb_cell->cell || cb_cell->cell->cell_type < 0)
cell = gnc_cellblock_get_cell (from, row, col);
if (!cell || cell->cell_type < 0)
continue;
set_cell (reg, to, cb_cell->cell->cell_type, row, col);
set_cell (reg, to, cell->cell_type, row, col);
}
}
+70 -136
View File
@@ -200,8 +200,6 @@ gnc_table_virtual_cell_out_of_bounds (Table *table,
(vcell_loc.virt_col >= table->num_virt_cols));
}
/* ==================================================== */
VirtualCell *
gnc_table_get_virtual_cell (Table *table, VirtualCellLocation vcell_loc)
{
@@ -212,8 +210,6 @@ gnc_table_get_virtual_cell (Table *table, VirtualCellLocation vcell_loc)
vcell_loc.virt_row, vcell_loc.virt_col);
}
/* ==================================================== */
VirtualCell *
gnc_table_get_header_cell (Table *table)
{
@@ -222,8 +218,6 @@ gnc_table_get_header_cell (Table *table)
return gnc_table_get_virtual_cell (table, vcell_loc);
}
/* ==================================================== */
static const char *
gnc_table_get_entry_internal (Table *table, VirtualLocation virt_loc,
gboolean *conditionally_changed)
@@ -242,22 +236,11 @@ gnc_table_get_entry_internal (Table *table, VirtualLocation virt_loc,
const char *
gnc_table_get_entry (Table *table, VirtualLocation virt_loc)
{
VirtualCell *vcell;
CellBlockCell *cb_cell;
BasicCell *cell;
const char *entry;
vcell = gnc_table_get_virtual_cell (table, virt_loc.vcell_loc);
if (vcell == NULL)
return "";
cb_cell = gnc_cellblock_get_cell (vcell->cellblock,
virt_loc.phys_row_offset,
virt_loc.phys_col_offset);
if (cb_cell == NULL)
return "";
if (cb_cell->cell == NULL)
return "";
if (cb_cell->cell->cell_type < 0)
cell = gnc_table_get_cell (table, virt_loc);
if (!cell || cell->cell_type < 0)
return "";
if (virt_cell_loc_equal (table->current_cursor_loc.vcell_loc,
@@ -268,7 +251,7 @@ gnc_table_get_entry (Table *table, VirtualLocation virt_loc)
io_flags = gnc_table_get_io_flags (table, virt_loc);
if (io_flags & XACC_CELL_ALLOW_INPUT)
return cb_cell->cell->value;
return cell->value;
}
entry = table->model->entry_handler (virt_loc, TRUE, NULL,
@@ -279,8 +262,6 @@ gnc_table_get_entry (Table *table, VirtualLocation virt_loc)
return entry;
}
/* ==================================================== */
CellIOFlags
gnc_table_get_io_flags (Table *table, VirtualLocation virt_loc)
{
@@ -291,8 +272,6 @@ gnc_table_get_io_flags (Table *table, VirtualLocation virt_loc)
table->model->handler_user_data);
}
/* ==================================================== */
const char *
gnc_table_get_label (Table *table, VirtualLocation virt_loc)
{
@@ -303,8 +282,6 @@ gnc_table_get_label (Table *table, VirtualLocation virt_loc)
table->model->handler_user_data);
}
/* ==================================================== */
guint32
gnc_table_get_fg_color (Table *table, VirtualLocation virt_loc)
{
@@ -315,8 +292,6 @@ gnc_table_get_fg_color (Table *table, VirtualLocation virt_loc)
table->model->handler_user_data);
}
/* ==================================================== */
guint32
gnc_table_get_bg_color (Table *table, VirtualLocation virt_loc,
gboolean *hatching)
@@ -328,8 +303,6 @@ gnc_table_get_bg_color (Table *table, VirtualLocation virt_loc,
table->model->handler_user_data);
}
/* ==================================================== */
void
gnc_table_get_borders (Table *table, VirtualLocation virt_loc,
PhysicalCellBorders *borders)
@@ -341,53 +314,34 @@ gnc_table_get_borders (Table *table, VirtualLocation virt_loc,
table->model->handler_user_data);
}
/* ==================================================== */
CellAlignment
gnc_table_get_align (Table *table, VirtualLocation virt_loc)
{
VirtualCell *vcell;
CellBlockCell *cb_cell;
BasicCell *cell;
vcell = gnc_table_get_virtual_cell (table, virt_loc.vcell_loc);
if (vcell == NULL)
cell = gnc_table_get_cell (table, virt_loc);
if (!cell)
return CELL_ALIGN_RIGHT;
cb_cell = gnc_cellblock_get_cell (vcell->cellblock,
virt_loc.phys_row_offset,
virt_loc.phys_col_offset);
if (cb_cell == NULL)
return CELL_ALIGN_RIGHT;
return cb_cell->cell->alignment;
return cell->alignment;
}
/* ==================================================== */
gboolean
gnc_table_is_popup (Table *table, VirtualLocation virt_loc)
{
VirtualCell *vcell;
CellBlockCell *cb_cell;
BasicCell *cell;
vcell = gnc_table_get_virtual_cell (table, virt_loc.vcell_loc);
if (vcell == NULL)
cell = gnc_table_get_cell (table, virt_loc);
if (!cell)
return FALSE;
cb_cell = gnc_cellblock_get_cell (vcell->cellblock,
virt_loc.phys_row_offset,
virt_loc.phys_col_offset);
if (cb_cell == NULL || cb_cell->cell == NULL)
return FALSE;
return cb_cell->cell->is_popup;
return cell->is_popup;
}
char *
gnc_table_get_help (Table *table)
{
VirtualCell *vcell;
CellBlockCell *cb_cell;
BasicCell *cell;
VirtualLocation virt_loc;
if (!table)
@@ -395,44 +349,28 @@ gnc_table_get_help (Table *table)
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)
cell = gnc_table_get_cell (table, virt_loc);
if (!cell)
return FALSE;
return xaccBasicCellGetHelp (cb_cell->cell);
return xaccBasicCellGetHelp (cell);
}
BasicCell *
gnc_table_get_cell (Table *table, VirtualLocation virt_loc)
{
VirtualCell *vcell;
CellBlock *cellblock;
CellBlockCell *cb_cell;
if (table == NULL)
if (!table)
return NULL;
vcell = gnc_table_get_virtual_cell (table, virt_loc.vcell_loc);
if (vcell == NULL)
if (!vcell)
return NULL;
cellblock = vcell->cellblock;
cb_cell = gnc_cellblock_get_cell (cellblock,
virt_loc.phys_row_offset,
virt_loc.phys_col_offset);
if (cb_cell == NULL)
return NULL;
return cb_cell->cell;
return gnc_cellblock_get_cell (vcell->cellblock,
virt_loc.phys_row_offset,
virt_loc.phys_col_offset);
}
int
@@ -469,14 +407,14 @@ gnc_table_get_cell_location (Table *table,
for (cell_row = 0; cell_row < cellblock->num_rows; cell_row++)
for (cell_col = 0; cell_col < cellblock->num_cols; cell_col++)
{
CellBlockCell *cb_cell;
BasicCell *cell;
int ctype;
cb_cell = gnc_cellblock_get_cell (cellblock, cell_row, cell_col);
if (!cb_cell || !cb_cell->cell)
cell = gnc_cellblock_get_cell (cellblock, cell_row, cell_col);
if (!cell)
return FALSE;
ctype = cb_cell->cell->cell_type;
ctype = cell->cell_type;
if (ctype == cell_type)
{
@@ -724,13 +662,11 @@ gnc_table_move_cursor_internal (Table *table,
for (cell_row = 0; cell_row < curs->num_rows; cell_row++)
for (cell_col = 0; cell_col < curs->num_cols; cell_col++)
{
CellBlockCell *cb_cell;
BasicCell *cell;
cb_cell = gnc_cellblock_get_cell (curs, cell_row, cell_col);
if (cb_cell && cb_cell->cell)
cell = gnc_cellblock_get_cell (curs, cell_row, cell_col);
if (cell)
{
BasicCell *cell = cb_cell->cell;
cell->changed = FALSE;
cell->conditionally_changed = FALSE;
@@ -766,17 +702,15 @@ gnc_table_move_cursor_internal (Table *table,
for (cell_row = 0; cell_row < curs->num_rows; cell_row++)
for (cell_col = 0; cell_col < curs->num_cols; cell_col++)
{
CellBlockCell *cb_cell;
BasicCell *cell;
CellIOFlags io_flags;
virt_loc.phys_row_offset = cell_row;
virt_loc.phys_col_offset = cell_col;
cb_cell = gnc_cellblock_get_cell(curs, cell_row, cell_col);
if (cb_cell && cb_cell->cell)
cell = gnc_cellblock_get_cell(curs, cell_row, cell_col);
if (cell)
{
BasicCell *cell = cb_cell->cell;
/* if a cell has a GUI, move that first, before setting
* the cell value. Otherwise, we'll end up putting the
* new values in the old cell locations, and that would
@@ -988,15 +922,14 @@ gnc_table_virtual_loc_valid(Table *table,
/* Handle the non gui-specific parts of a cell enter callback */
gboolean
gnc_table_enter_update(Table *table,
VirtualLocation virt_loc,
int *cursor_position,
int *start_selection,
int *end_selection)
gnc_table_enter_update (Table *table,
VirtualLocation virt_loc,
int *cursor_position,
int *start_selection,
int *end_selection)
{
gboolean can_edit = TRUE;
CellEnterFunc enter;
CellBlockCell *cb_cell;
BasicCell *cell;
CellBlock *cb;
int cell_row;
@@ -1016,8 +949,10 @@ gnc_table_enter_update(Table *table,
cell_row, cell_col);
/* OK, if there is a callback for this cell, call it */
cb_cell = gnc_cellblock_get_cell (cb, cell_row, cell_col);
cell = cb_cell->cell;
cell = gnc_cellblock_get_cell (cb, cell_row, cell_col);
if (!cell)
return FALSE;
enter = cell->enter_cell;
if (enter)
@@ -1027,11 +962,11 @@ gnc_table_enter_update(Table *table,
DEBUG("gnc_table_enter_update(): %d %d has enter handler\n",
cell_row, cell_col);
old_value = g_strdup(cell->value);
old_value = g_strdup (cell->value);
can_edit = enter(cell, cursor_position, start_selection, end_selection);
can_edit = enter (cell, cursor_position, start_selection, end_selection);
if (safe_strcmp(old_value, cell->value) != 0)
if (safe_strcmp (old_value, cell->value) != 0)
cell->changed = TRUE;
g_free (old_value);
@@ -1048,10 +983,9 @@ gnc_table_enter_update(Table *table,
/* ==================================================== */
void
gnc_table_leave_update(Table *table, VirtualLocation virt_loc)
gnc_table_leave_update (Table *table, VirtualLocation virt_loc)
{
CellLeaveFunc leave;
CellBlockCell *cb_cell;
BasicCell *cell;
CellBlock *cb;
int cell_row;
@@ -1071,22 +1005,21 @@ gnc_table_leave_update(Table *table, VirtualLocation virt_loc)
cell_row, cell_col);
/* OK, if there is a callback for this cell, call it */
cb_cell = gnc_cellblock_get_cell (cb, cell_row, cell_col);
if (!cb_cell || !cb_cell->cell)
cell = gnc_cellblock_get_cell (cb, cell_row, cell_col);
if (!cell)
return;
cell = cb_cell->cell;
leave = cell->leave_cell;
if (leave)
{
char * old_value;
old_value = g_strdup(cell->value);
old_value = g_strdup (cell->value);
leave (cell);
if (safe_strcmp(old_value, cell->value) != 0)
if (safe_strcmp (old_value, cell->value) != 0)
cell->changed = TRUE;
g_free (old_value);
@@ -1113,20 +1046,19 @@ gnc_table_confirm_change (Table *table, VirtualLocation virt_loc)
/* returned result should not be touched by the caller.
* NULL return value means the edit was rejected. */
const char *
gnc_table_modify_update(Table *table,
VirtualLocation virt_loc,
const GdkWChar *change,
int change_len,
const GdkWChar *newval,
int newval_len,
int *cursor_position,
int *start_selection,
int *end_selection,
gboolean *cancelled)
gnc_table_modify_update (Table *table,
VirtualLocation virt_loc,
const GdkWChar *change,
int change_len,
const GdkWChar *newval,
int newval_len,
int *cursor_position,
int *start_selection,
int *end_selection,
gboolean *cancelled)
{
gboolean changed = FALSE;
CellModifyVerifyFunc mv;
CellBlockCell *cb_cell;
BasicCell *cell;
CellBlock *cb;
int cell_row;
@@ -1157,8 +1089,10 @@ gnc_table_modify_update(Table *table,
*cancelled = FALSE;
/* OK, if there is a callback for this cell, call it */
cb_cell = gnc_cellblock_get_cell (cb, cell_row, cell_col);
cell = cb_cell->cell;
cell = gnc_cellblock_get_cell (cb, cell_row, cell_col);
if (!cell)
return NULL;
mv = cell->modify_verify;
old_value = g_strdup (cell->value);
@@ -1207,7 +1141,6 @@ gnc_table_direct_update (Table *table,
int *end_selection,
gpointer gui_data)
{
CellBlockCell *cb_cell;
gboolean result;
BasicCell *cell;
CellBlock *cb;
@@ -1223,8 +1156,9 @@ gnc_table_direct_update (Table *table,
cell_row = virt_loc.phys_row_offset;
cell_col = virt_loc.phys_col_offset;
cb_cell = gnc_cellblock_get_cell (cb, cell_row, cell_col);
cell = cb_cell->cell;
cell = gnc_cellblock_get_cell (cb, cell_row, cell_col);
if (!cell)
return FALSE;
ENTER ("\n");
@@ -1402,6 +1336,7 @@ gnc_table_move_tab (Table *table,
{
VirtualCell *vcell;
VirtualLocation vloc;
BasicCell *cell;
if ((table == NULL) || (virt_loc == NULL))
return FALSE;
@@ -1414,7 +1349,6 @@ gnc_table_move_tab (Table *table,
while (1)
{
CellBlockCell *cb_cell;
CellIOFlags io_flags;
if (move_right)
@@ -1446,10 +1380,10 @@ gnc_table_move_tab (Table *table,
if ((vcell == NULL) || (vcell->cellblock == NULL) || !vcell->visible)
return FALSE;
cb_cell = gnc_cellblock_get_cell (vcell->cellblock,
vloc.phys_row_offset,
vloc.phys_col_offset);
if ((cb_cell == NULL) || (cb_cell->cell == NULL))
cell = gnc_cellblock_get_cell (vcell->cellblock,
vloc.phys_row_offset,
vloc.phys_col_offset);
if (!cell)
continue;
io_flags = gnc_table_get_io_flags (table, vloc);
+4 -4
View File
@@ -346,13 +346,13 @@ restore_cell (BasicCell *bcell, CellBuffer *cb, CellBlock *cursor)
for (r = 0; r < cursor->num_rows; r++)
for (c = 0; c < cursor->num_cols; c++)
{
CellBlockCell *cb_cell;
BasicCell *cell;
cb_cell = gnc_cellblock_get_cell (cursor, r, c);
if (cb_cell == NULL)
cell = gnc_cellblock_get_cell (cursor, r, c);
if (!cell)
continue;
if (cb_cell->cell == bcell)
if (cell == bcell)
{
gnc_basic_cell_set_value (bcell, cb->value);
bcell->changed = cb->changed;
-79
View File
@@ -1,79 +0,0 @@
/********************************************************************\
* textcell.c -- simple plain-ascii text display/input cell *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, contact: *
* *
* Free Software Foundation Voice: +1-617-542-5942 *
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org *
* *
\********************************************************************/
/*
* FILE:
* textcell.c
*
* FUNCTION:
* implements the simplest possible cell -- a text cell
*
* HISTORY:
* Copyright (c) 1998 Linas Vepstas
* Copyright (c) 2000 Dave Peticolas
*/
#include <stdlib.h>
#include <string.h>
#include "basiccell.h"
#include "textcell.h"
/* ================================================ */
/* by definition, all text is valid text. So accept
* all modifications */
static void
TextMV (struct _BasicCell *_cell,
const GdkWChar *change,
int change_len,
const GdkWChar *newval,
int newval_len,
int *cursor_position,
int *start_selection,
int *end_selection)
{
xaccSetBasicCellWCValueInternal (_cell, newval);
}
/* ================================================ */
static void
xaccInitTextCell (BasicCell *cell)
{
cell->modify_verify = TextMV;
}
/* ================================================ */
BasicCell *
xaccMallocTextCell (void)
{
BasicCell *cell;
cell = gnc_basic_cell_new ();
xaccInitTextCell (cell);
return cell;
}
/* --------------- end of file ---------------------- */
-47
View File
@@ -1,47 +0,0 @@
/********************************************************************\
* textcell.h -- simple plain-ascii text display/input cell *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, contact: *
* *
* Free Software Foundation Voice: +1-617-542-5942 *
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org *
* *
\********************************************************************/
/*
* FILE:
* textcell.h
*
* FUNCTION:
* The TextCell object implements the simplest possible cell --
* a text cell. The text cell simply accepts any and all typed
* data from the keyboard, and displays in in the cell.
*
* HISTORY:
* Copyright (c) 1998 Linas Vepstas
* Copyright (c) 2000 Dave Peticolas
*/
#ifndef TEXT_CELL_H
#define TEXT_CELL_H
#include "basiccell.h"
/* installs a callback to handle text recording */
BasicCell * xaccMallocTextCell (void);
#endif /* TEXT_CELL_H */
/* --------------- end of file ---------------------- */
+6 -43
View File
@@ -92,8 +92,6 @@ static short module = MOD_GTK_REG;
static gboolean auto_pop_combos = FALSE;
/* =============================================== */
BasicCell *
xaccMallocComboCell (void)
{
@@ -145,8 +143,6 @@ xaccInitComboCell (ComboCell *cell)
box->ignore_helps = NULL;
}
/* =============================================== */
static void
select_item_cb (GNCItemList *item_list, char *item_string, gpointer data)
{
@@ -266,8 +262,6 @@ unblock_list_signals (ComboCell *cell)
gtk_signal_handler_unblock_by_data (GTK_OBJECT(box->item_list), cell);
}
/* =============================================== */
static void
combo_cell_gui_destroy (BasicCell *bcell)
{
@@ -294,16 +288,12 @@ combo_cell_gui_destroy (BasicCell *bcell)
DEBUG("combo destroyed\n");
}
/* =============================================== */
static void
menustring_free (gpointer string, gpointer user_data)
{
g_free (string);
}
/* =============================================== */
static void
combo_cell_destroy (BasicCell *bcell)
{
@@ -349,8 +339,6 @@ combo_cell_destroy (BasicCell *bcell)
cell->cell.gui_realize = NULL;
}
/* =============================================== */
void
xaccClearComboCellMenu (ComboCell * cell)
{
@@ -385,10 +373,8 @@ xaccClearComboCellMenu (ComboCell * cell)
box->list_sorted = TRUE;
}
/* =============================================== */
static void
gnc_append_string_to_list(gpointer _string, gpointer _item_list)
gnc_append_string_to_list (gpointer _string, gpointer _item_list)
{
char *string = _string;
GNCItemList *item_list = GNC_ITEM_LIST (_item_list);
@@ -531,11 +517,9 @@ ComboMV (BasicCell *_cell,
gnc_item_list_select (box->item_list, match_str);
unblock_list_signals (cell);
xaccSetBasicCellValueInternal (_cell, match_str);
gnc_basic_cell_set_value_internal (_cell, match_str);
}
/* =============================================== */
static gboolean
ComboDirect (BasicCell *bcell,
int *cursor_position,
@@ -591,8 +575,8 @@ ComboDirect (BasicCell *bcell,
strlen (bcell->value)) == 0) &&
(strcmp (match_str, bcell->value) != 0))
{
xaccSetBasicCellValueInternal (bcell,
match_str);
gnc_basic_cell_set_value_internal (bcell,
match_str);
block_list_signals (cell);
gnc_item_list_select (box->item_list,
@@ -676,7 +660,7 @@ ComboDirect (BasicCell *bcell,
(strncmp (match_str, bcell->value, strlen (bcell->value)) == 0) &&
(strcmp (match_str, bcell->value) != 0))
{
xaccSetBasicCellValueInternal (bcell, match_str);
gnc_basic_cell_set_value_internal (bcell, match_str);
block_list_signals (cell);
gnc_item_list_select (box->item_list, match_str);
@@ -690,8 +674,6 @@ ComboDirect (BasicCell *bcell,
return TRUE;
}
/* =============================================== */
static char *
ComboHelpValue (BasicCell *bcell)
{
@@ -722,8 +704,6 @@ ComboHelpValue (BasicCell *bcell)
return NULL;
}
/* =============================================== */
static void
combo_cell_gui_realize (BasicCell *bcell, gpointer data)
{
@@ -751,8 +731,6 @@ combo_cell_gui_realize (BasicCell *bcell, gpointer data)
cell->cell.get_help_value = ComboHelpValue;
}
/* =============================================== */
static void
combo_cell_gui_move (BasicCell *bcell)
{
@@ -857,8 +835,6 @@ combo_cell_enter (BasicCell *bcell,
return TRUE;
}
/* =============================================== */
static void
combo_cell_leave (BasicCell *bcell)
{
@@ -887,12 +863,10 @@ combo_cell_leave (BasicCell *bcell)
if (find)
return;
xaccSetBasicCellValueInternal (bcell, "");
gnc_basic_cell_set_value_internal (bcell, "");
}
}
/* =============================================== */
void
xaccComboCellSetStrict (ComboCell *cell, gboolean strict)
{
@@ -906,8 +880,6 @@ xaccComboCellSetStrict (ComboCell *cell, gboolean strict)
box->strict = strict;
}
/* =============================================== */
void
xaccComboCellSetCompleteChar (ComboCell *cell, char complete_char)
{
@@ -921,8 +893,6 @@ xaccComboCellSetCompleteChar (ComboCell *cell, char complete_char)
box->complete_char = complete_char;
}
/* =============================================== */
void
xaccComboCellAddIgnoreString (ComboCell *cell,
const char *ignore_string,
@@ -941,8 +911,6 @@ xaccComboCellAddIgnoreString (ComboCell *cell,
g_strdup (ignore_help));
}
/* =============================================== */
void
xaccComboCellSetAutoSize (ComboCell *cell, gboolean autosize)
{
@@ -958,17 +926,12 @@ xaccComboCellSetAutoSize (ComboCell *cell, gboolean autosize)
box->autosize = autosize;
}
/* =============================================== */
void
xaccComboCellSetAutoPop (gboolean auto_pop_combos_arg)
{
auto_pop_combos = auto_pop_combos_arg;
}
/* =============== end of file =================== */
/*
Local Variables:
c-basic-offset: 8
+7 -34
View File
@@ -219,7 +219,7 @@ xaccInitDateCell (DateCell *cell)
box->date = *localtime (&secs);
printDateCellDate (cell, buff);
xaccSetBasicCellValueInternal (&cell->cell, buff);
gnc_basic_cell_set_value_internal (&cell->cell, buff);
}
BasicCell *
@@ -234,8 +234,6 @@ xaccMallocDateCell (void)
return &cell->cell;
}
/* =============================================== */
static void
date_picked_cb (GNCDatePicker *gdp, gpointer data)
{
@@ -353,8 +351,6 @@ unblock_picker_signals (DateCell *cell)
gtk_signal_handler_unblock_by_data (GTK_OBJECT (box->date_picker), cell);
}
/* =============================================== */
static void
date_cell_gui_destroy (BasicCell *bcell)
{
@@ -381,8 +377,6 @@ date_cell_gui_destroy (BasicCell *bcell)
DEBUG ("date destroyed\n");
}
/* =============================================== */
static void
date_cell_destroy (BasicCell *bcell)
{
@@ -422,7 +416,7 @@ xaccSetDateCellValue (DateCell *cell, int day, int mon, int year)
printDate (buff, dada.tm_mday, dada.tm_mon + 1, dada.tm_year + 1900);
xaccSetBasicCellValueInternal (&cell->cell, buff);
gnc_basic_cell_set_value_internal (&cell->cell, buff);
if (!box->date_picker)
return;
@@ -432,8 +426,6 @@ xaccSetDateCellValue (DateCell *cell, int day, int mon, int year)
unblock_picker_signals (cell);
}
/* =============================================== */
void
xaccSetDateCellValueSecs (DateCell *cell, time_t secs)
{
@@ -449,7 +441,7 @@ xaccSetDateCellValueSecs (DateCell *cell, time_t secs)
box->date.tm_mon + 1,
box->date.tm_year + 1900);
xaccSetBasicCellValueInternal (&cell->cell, buff);
gnc_basic_cell_set_value_internal (&cell->cell, buff);
if (!box->date_picker)
return;
@@ -462,8 +454,6 @@ xaccSetDateCellValueSecs (DateCell *cell, time_t secs)
unblock_picker_signals (cell);
}
/* ================================================ */
#define THIRTY_TWO_YEARS 0x3c30fc00LL
void
@@ -513,7 +503,7 @@ xaccSetDateCellValueSecsL (DateCell *cell, long long secs)
box->date.tm_mon + 1,
box->date.tm_year + 1900);
xaccSetBasicCellValueInternal (&cell->cell, buff);
gnc_basic_cell_set_value_internal (&cell->cell, buff);
if (!box->date_picker)
return;
@@ -526,8 +516,6 @@ xaccSetDateCellValueSecsL (DateCell *cell, long long secs)
unblock_picker_signals (cell);
}
/* ================================================ */
void
xaccCommitDateCell (DateCell *cell)
{
@@ -544,7 +532,7 @@ xaccCommitDateCell (DateCell *cell)
box->date.tm_mon + 1,
box->date.tm_year + 1900);
xaccSetBasicCellValueInternal (&cell->cell, buff);
gnc_basic_cell_set_value_internal (&cell->cell, buff);
if (!box->date_picker)
return;
@@ -557,7 +545,6 @@ xaccCommitDateCell (DateCell *cell)
unblock_picker_signals (cell);
}
/* =============================================== */
static gboolean
DateDirect (BasicCell *bcell,
int *cursor_position,
@@ -688,7 +675,7 @@ DateDirect (BasicCell *bcell,
box->date.tm_mon + 1,
box->date.tm_year + 1900);
xaccSetBasicCellValueInternal (&cell->cell, buff);
gnc_basic_cell_set_value_internal (&cell->cell, buff);
*start_selection = 0;
*end_selection = -1;
@@ -783,8 +770,6 @@ DateMV (BasicCell *_cell,
}
}
/* =============================================== */
static void
realizeDate (BasicCell *bcell, gpointer data)
{
@@ -808,8 +793,6 @@ realizeDate (BasicCell *bcell, gpointer data)
cell->cell.leave_cell = leaveDate;
}
/* =============================================== */
static void
moveDate (BasicCell *bcell)
{
@@ -823,8 +806,6 @@ moveDate (BasicCell *bcell)
box->calendar_popped = FALSE;
}
/* =============================================== */
static int
get_popup_height (GnomeCanvasItem *item,
int space_available,
@@ -877,8 +858,6 @@ enterDate (BasicCell *bcell,
return TRUE;
}
/* =============================================== */
static void
leaveDate (BasicCell *bcell)
{
@@ -892,8 +871,6 @@ leaveDate (BasicCell *bcell)
box->calendar_popped = FALSE;
}
/* ================================================ */
void
xaccDateCellGetDate (DateCell *cell, Timespec *ts)
{
@@ -908,8 +885,6 @@ xaccDateCellGetDate (DateCell *cell, Timespec *ts)
ts->tv_nsec = 0;
}
/* ================================================ */
static void
setDateCellValue (BasicCell *_cell, const char *str)
{
@@ -924,7 +899,7 @@ setDateCellValue (BasicCell *_cell, const char *str)
box->date.tm_mon + 1,
box->date.tm_year + 1900);
xaccSetBasicCellValueInternal (_cell, buff);
gnc_basic_cell_set_value_internal (_cell, buff);
if (!box->date_picker)
return;
@@ -936,5 +911,3 @@ setDateCellValue (BasicCell *_cell, const char *str)
box->date.tm_year + 1900);
unblock_picker_signals (cell);
}
/* =============== end of file =================== */
+6 -8
View File
@@ -75,11 +75,10 @@ gnucash_cursor_get_pixel_coords (GnucashCursor *cursor,
for (col = 0; col < vcell->cellblock->num_cols; col++)
{
CellBlockCell *cb_cell;
BasicCell *cell;
cb_cell = gnc_cellblock_get_cell (vcell->cellblock, 0, col);
if (cb_cell && cb_cell->cell &&
cb_cell->cell->cell_type >= 0)
cell = gnc_cellblock_get_cell (vcell->cellblock, 0, col);
if (cell && cell->cell_type >= 0)
break;
}
@@ -93,11 +92,10 @@ gnucash_cursor_get_pixel_coords (GnucashCursor *cursor,
for (col = vcell->cellblock->num_cols - 1; col >= 0; col--)
{
CellBlockCell *cb_cell;
BasicCell *cell;
cb_cell = gnc_cellblock_get_cell (vcell->cellblock, 0, col);
if (cb_cell && cb_cell->cell &&
cb_cell->cell->cell_type >= 0)
cell = gnc_cellblock_get_cell (vcell->cellblock, 0, col);
if (cell && cell->cell_type >= 0)
break;
}
+3 -4
View File
@@ -133,7 +133,7 @@ gnucash_header_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
{
gint x_offset, y_offset;
GdkRectangle rect;
CellBlockCell *cb_cell;
BasicCell *cell;
virt_loc.phys_col_offset = j;
@@ -144,9 +144,8 @@ gnucash_header_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
else
w = cd->pixel_width;
cb_cell = gnc_cellblock_get_cell (cb, i, j);
if (!cb_cell || !cb_cell->cell ||
cb_cell->cell->cell_type < 0)
cell = gnc_cellblock_get_cell (cb, i, j);
if (!cell || cell->cell_type < 0)
{
xpaint += w;
continue;
+28 -28
View File
@@ -168,7 +168,7 @@ set_dimensions_pass_one (GnucashSheet *sheet, CellBlock *cursor,
{
int width;
char *text;
CellBlockCell *cb_cell;
BasicCell *cell;
cd = g_table_index (dimensions->cell_dimensions,
row, col);
@@ -179,11 +179,11 @@ set_dimensions_pass_one (GnucashSheet *sheet, CellBlock *cursor,
if (cd->pixel_width > 0)
continue;
cb_cell = gnc_cellblock_get_cell (cursor, row, col);
if (!cb_cell || !cb_cell->cell)
cell = gnc_cellblock_get_cell (cursor, row, col);
if (!cell)
continue;
text = cb_cell->cell->sample_text;
text = cell->sample_text;
if (text)
cd->can_span_over = FALSE;
@@ -195,7 +195,7 @@ set_dimensions_pass_one (GnucashSheet *sheet, CellBlock *cursor,
else
width = 0;
if (cb_cell->cell && cb_cell->cell->is_popup)
if (cell && cell->is_popup)
width += item_edit_get_toggle_offset
(cd->pixel_height);
@@ -247,11 +247,11 @@ set_dimensions_pass_two (GnucashSheet *sheet, int default_width)
if (width < default_width)
for (col = 0; col < num_cols; col++)
{
CellBlockCell *cb_cell;
BasicCell *cell;
cb_cell = gnc_cellblock_get_cell (cursor, 0, col);
cell = gnc_cellblock_get_cell (cursor, 0, col);
if (!cb_cell->cell->expandable)
if (!cell || !cell->expandable)
continue;
cd = g_table_index (cd_table, 0, col);
@@ -268,14 +268,14 @@ set_dimensions_pass_two (GnucashSheet *sheet, int default_width)
for (col = 0; col < num_cols; col++)
{
CellBlockCell *cb_cell;
BasicCell *cell;
const char *text;
int sample_width;
int old_width;
cb_cell = gnc_cellblock_get_cell (cursor, 0, col);
cell = gnc_cellblock_get_cell (cursor, 0, col);
if (!cb_cell->cell->expandable)
if (!cell || !cell->expandable)
continue;
cd = g_table_index (cd_table, 0, col);
@@ -284,7 +284,7 @@ set_dimensions_pass_two (GnucashSheet *sheet, int default_width)
cd->pixel_width += (default_width - width);
text = cb_cell->cell->sample_text;
text = cell->sample_text;
if (text)
{
sample_width = gdk_string_width (font, text);
@@ -339,16 +339,16 @@ set_dimensions_pass_two (GnucashSheet *sheet, int default_width)
for (col = 0; col < num_cols; col++)
{
CellBlockCell *cb_cell;
BasicCell *cell;
cb_cell = gnc_cellblock_get_cell (cursor,
cell = gnc_cellblock_get_cell (cursor,
row, col);
if (!cb_cell || !cb_cell->cell)
if (!cell)
continue;
cd = g_table_index (cd_table, row, col);
if (cb_cell->cell->span)
if (cell->span)
{
cd_span = cd;
continue;
@@ -360,7 +360,7 @@ set_dimensions_pass_two (GnucashSheet *sheet, int default_width)
if (cd_span == NULL)
continue;
if (cb_cell->cell->sample_text != NULL)
if (cell->sample_text != NULL)
{
cd_span = NULL;
continue;
@@ -879,21 +879,21 @@ gnucash_sheet_get_header_widths (GnucashSheet *sheet, int *header_widths)
for (col = 0; col < style->ncols; col++)
{
CellDimensions *cd;
CellBlockCell *cb_cell;
BasicCell *cell;
cd = gnucash_style_get_cell_dimensions (style,
row, col);
if (cd == NULL)
continue;
cb_cell = gnc_cellblock_get_cell (header, row, col);
if (cb_cell == NULL || cb_cell->cell == NULL)
cell = gnc_cellblock_get_cell (header, row, col);
if (!cell)
continue;
if (cb_cell->cell->cell_type < 0)
if (cell->cell_type < 0)
continue;
header_widths[cb_cell->cell->cell_type] = cd->pixel_width;
header_widths[cell->cell_type] = cd->pixel_width;
}
}
@@ -917,22 +917,22 @@ gnucash_sheet_set_header_widths (GnucashSheet *sheet, int *header_widths)
for (col = 0; col < style->ncols; col++)
{
CellDimensions *cd;
CellBlockCell *cb_cell;
BasicCell *cell;
cd = gnucash_style_get_cell_dimensions (style,
row, col);
cb_cell = gnc_cellblock_get_cell (header, row, col);
if (!cb_cell || !cb_cell->cell)
cell = gnc_cellblock_get_cell (header, row, col);
if (!cell)
continue;
if (cb_cell->cell->cell_type < 0)
if (cell->cell_type < 0)
continue;
if (header_widths[cb_cell->cell->cell_type] < 0)
if (header_widths[cell->cell_type] < 0)
continue;
cd->pixel_width = header_widths[cb_cell->cell->cell_type];
cd->pixel_width = header_widths[cell->cell_type];
}
}