mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
2001-08-11 Dave Peticolas <dave@krondo.com>
* src/register/register-core/table-allgui.[ch]: update for api changes. Move some layout code to table-layout.c. * src/register/register-core/splitreg.[ch]: update for api changes * src/register/register-core/cellblock.[ch]: move cursor changed functions here * src/register/register-core/Makefile.am: add new files * src/register/ledger-core/SplitLedger.c: update for api changes * src/register/register-core/table-layout.[ch]: new file. table layout object encapsulates table structure. * src/scm/main.scm: add lib path to LD_LIBRARY_PATH git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@5112 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
b466684199
commit
259de1c55a
19
ChangeLog
19
ChangeLog
@ -1,3 +1,22 @@
|
||||
2001-08-11 Dave Peticolas <dave@krondo.com>
|
||||
|
||||
* src/register/register-core/table-allgui.[ch]: update for
|
||||
api changes. Move some layout code to table-layout.c.
|
||||
|
||||
* src/register/register-core/splitreg.[ch]: update for api changes
|
||||
|
||||
* src/register/register-core/cellblock.[ch]: move cursor
|
||||
changed functions here
|
||||
|
||||
* src/register/register-core/Makefile.am: add new files
|
||||
|
||||
* src/register/ledger-core/SplitLedger.c: update for api changes
|
||||
|
||||
* src/register/register-core/table-layout.[ch]: new file.
|
||||
table layout object encapsulates table structure.
|
||||
|
||||
* src/scm/main.scm: add lib path to LD_LIBRARY_PATH
|
||||
|
||||
2001-08-10 Christian Stimming <stimming@tuhh.de>
|
||||
|
||||
* po/gnc-glossary.txt: Updated explanation for "to scrub" to clear
|
||||
|
@ -1425,7 +1425,7 @@ LedgerTraverse (Table *table,
|
||||
return FALSE;
|
||||
|
||||
/* no changes, make sure we aren't going off the end */
|
||||
changed = gnc_register_get_cursor_changed (reg, FALSE);
|
||||
changed = gnc_table_current_cursor_changed (table, FALSE);
|
||||
if (!changed && (pending_trans != trans))
|
||||
{
|
||||
gnc_table_find_close_valid_cell (table, &virt_loc, info->exact_traversal);
|
||||
@ -2036,7 +2036,7 @@ xaccSRDuplicateCurrent (SplitRegister *reg)
|
||||
if ((split == NULL) && (cursor_class == CURSOR_CLASS_TRANS))
|
||||
return NULL;
|
||||
|
||||
changed = gnc_register_get_cursor_changed (reg, FALSE);
|
||||
changed = gnc_table_current_cursor_changed (reg->table, FALSE);
|
||||
|
||||
/* See if we were asked to duplicate an unchanged blank split.
|
||||
* There's no point in doing that! */
|
||||
@ -2197,7 +2197,7 @@ xaccSRCopyCurrentInternal (SplitRegister *reg, gboolean use_cut_semantics)
|
||||
if ((split == NULL) && (cursor_class == CURSOR_CLASS_TRANS))
|
||||
return;
|
||||
|
||||
changed = gnc_register_get_cursor_changed (reg, FALSE);
|
||||
changed = gnc_table_current_cursor_changed (reg->table, FALSE);
|
||||
|
||||
/* See if we were asked to copy an unchanged blank split. Don't. */
|
||||
if (!changed && ((split == NULL) || (split == blank_split)))
|
||||
@ -2294,7 +2294,7 @@ xaccSRCutCurrent (SplitRegister *reg)
|
||||
if ((split == NULL) && (cursor_class == CURSOR_CLASS_TRANS))
|
||||
return;
|
||||
|
||||
changed = gnc_register_get_cursor_changed (reg, FALSE);
|
||||
changed = gnc_table_current_cursor_changed (reg->table, FALSE);
|
||||
|
||||
/* See if we were asked to cut an unchanged blank split. Don't. */
|
||||
if (!changed && ((split == NULL) || (split == blank_split)))
|
||||
@ -2636,12 +2636,12 @@ xaccSRCancelCursorSplitChanges (SplitRegister *reg)
|
||||
|
||||
virt_loc = reg->table->current_cursor_loc;
|
||||
|
||||
if (!gnc_register_get_cursor_changed (reg, FALSE))
|
||||
if (!gnc_table_current_cursor_changed (reg->table, FALSE))
|
||||
return;
|
||||
|
||||
/* We're just cancelling the current split here, not the transaction.
|
||||
* When cancelling edits, reload the cursor from the transaction. */
|
||||
gnc_register_clear_changes (reg);
|
||||
gnc_table_clear_current_cursor_changes (reg->table);
|
||||
|
||||
if (gnc_table_find_close_valid_cell (reg->table, &virt_loc, FALSE))
|
||||
gnc_table_move_cursor_gui (reg->table, virt_loc);
|
||||
@ -2702,7 +2702,7 @@ xaccSRSaveRegEntryToSCM (SplitRegister *reg, SCM trans_scm, SCM split_scm,
|
||||
/* use the changed flag to avoid heavy-weight updates
|
||||
* of the split & transaction fields. This will help
|
||||
* cut down on uneccessary register redraws. */
|
||||
if (!gnc_register_get_cursor_changed (reg, FALSE))
|
||||
if (!gnc_table_current_cursor_changed (reg->table, FALSE))
|
||||
return FALSE;
|
||||
|
||||
/* get the handle to the current split and transaction */
|
||||
@ -2904,7 +2904,7 @@ xaccSRSaveRegEntry (SplitRegister *reg, gboolean do_commit)
|
||||
/* use the changed flag to avoid heavy-weight updates
|
||||
* of the split & transaction fields. This will help
|
||||
* cut down on uneccessary register redraws. */
|
||||
if (!gnc_register_get_cursor_changed (reg, FALSE))
|
||||
if (!gnc_table_current_cursor_changed (reg->table, FALSE))
|
||||
{
|
||||
if (!do_commit)
|
||||
return FALSE;
|
||||
@ -3027,7 +3027,7 @@ xaccSRSaveRegEntry (SplitRegister *reg, gboolean do_commit)
|
||||
}
|
||||
}
|
||||
|
||||
gnc_register_clear_changes (reg);
|
||||
gnc_table_clear_current_cursor_changes (reg->table);
|
||||
|
||||
gnc_resume_gui_refresh ();
|
||||
|
||||
@ -4940,7 +4940,7 @@ xaccSRLoadRegister (SplitRegister *reg, GList * slist,
|
||||
SRInfo *info = xaccSRGetInfo (reg);
|
||||
Split *blank_split = xaccSplitLookup (&info->blank_split_guid);
|
||||
Transaction *pending_trans = xaccTransLookup (&info->pending_trans_guid);
|
||||
RegisterBuffer *reg_buffer;
|
||||
CursorBuffer *cursor_buffer;
|
||||
GHashTable *trans_table = NULL;
|
||||
CellBlock *lead_cursor;
|
||||
Transaction *blank_trans;
|
||||
@ -5023,14 +5023,14 @@ xaccSRLoadRegister (SplitRegister *reg, GList * slist,
|
||||
|
||||
/* If the current cursor has changed we save the values for later
|
||||
* possible restoration. */
|
||||
if (gnc_register_get_cursor_changed (reg, TRUE) &&
|
||||
if (gnc_table_current_cursor_changed (table, TRUE) &&
|
||||
(find_split == xaccSRGetCurrentSplit (reg)))
|
||||
{
|
||||
reg_buffer = gnc_register_buffer_new ();
|
||||
gnc_register_save_cursor (reg, reg_buffer);
|
||||
cursor_buffer = gnc_cursor_buffer_new ();
|
||||
gnc_table_save_current_cursor (table, cursor_buffer);
|
||||
}
|
||||
else
|
||||
reg_buffer = NULL;
|
||||
cursor_buffer = NULL;
|
||||
|
||||
/* disable move callback -- we don't want the cascade of
|
||||
* callbacks while we are fiddling with loading the register */
|
||||
@ -5239,13 +5239,11 @@ xaccSRLoadRegister (SplitRegister *reg, GList * slist,
|
||||
new_split_row = save_loc.vcell_loc.virt_row;
|
||||
|
||||
if (find_split == xaccSRGetCurrentSplit (reg))
|
||||
gnc_register_restore_cursor (reg, reg_buffer);
|
||||
gnc_table_restore_current_cursor (table, cursor_buffer);
|
||||
}
|
||||
|
||||
if (reg_buffer != NULL)
|
||||
gnc_register_buffer_destroy (reg_buffer);
|
||||
|
||||
reg_buffer = NULL;
|
||||
gnc_cursor_buffer_destroy (cursor_buffer);
|
||||
cursor_buffer = NULL;
|
||||
}
|
||||
|
||||
/* If we didn't find the pending transaction, it was removed
|
||||
@ -5363,16 +5361,16 @@ xaccSRLoadXferCells (SplitRegister *reg, Account *base_account)
|
||||
gboolean
|
||||
xaccSRHasPendingChanges (SplitRegister *reg)
|
||||
{
|
||||
SRInfo *info = xaccSRGetInfo(reg);
|
||||
Transaction *pending_trans = xaccTransLookup(&info->pending_trans_guid);
|
||||
SRInfo *info = xaccSRGetInfo (reg);
|
||||
Transaction *pending_trans = xaccTransLookup (&info->pending_trans_guid);
|
||||
|
||||
if (reg == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (gnc_register_get_cursor_changed (reg, FALSE))
|
||||
if (gnc_table_current_cursor_changed (reg->table, FALSE))
|
||||
return TRUE;
|
||||
|
||||
return xaccTransIsOpen(pending_trans);
|
||||
return xaccTransIsOpen (pending_trans);
|
||||
}
|
||||
|
||||
/* ======================================================== */
|
||||
|
@ -16,6 +16,7 @@ libgncmod_register_core_la_SOURCES = \
|
||||
register-common.c \
|
||||
splitreg.c \
|
||||
table-allgui.c \
|
||||
table-layout.c \
|
||||
table-model.c \
|
||||
textcell.c
|
||||
|
||||
@ -34,6 +35,7 @@ noinst_HEADERS = \
|
||||
register-common.h \
|
||||
splitreg.h \
|
||||
table-allgui.h \
|
||||
table-layout.h \
|
||||
table-model.h \
|
||||
textcell.h
|
||||
|
||||
|
@ -33,13 +33,13 @@
|
||||
* Copyright (c) 2000 Dave Peticolas
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "cellblock.h"
|
||||
|
||||
static void gnc_cellblock_init (CellBlock *cellblock, int rows, int cols);
|
||||
|
||||
|
||||
/* =================================================== */
|
||||
|
||||
CellBlock *
|
||||
gnc_cellblock_new (int rows, int cols, int cursor_type)
|
||||
{
|
||||
@ -54,8 +54,6 @@ gnc_cellblock_new (int rows, int cols, int cursor_type)
|
||||
return cellblock;
|
||||
}
|
||||
|
||||
/* =================================================== */
|
||||
|
||||
static void
|
||||
gnc_cellblock_cell_construct (gpointer _cb_cell, gpointer user_data)
|
||||
{
|
||||
@ -70,8 +68,6 @@ gnc_cellblock_cell_construct (gpointer _cb_cell, gpointer user_data)
|
||||
cb_cell->span = FALSE;
|
||||
}
|
||||
|
||||
/* =================================================== */
|
||||
|
||||
static void
|
||||
gnc_cellblock_cell_destroy (gpointer _cb_cell, gpointer user_data)
|
||||
{
|
||||
@ -87,8 +83,6 @@ gnc_cellblock_cell_destroy (gpointer _cb_cell, gpointer user_data)
|
||||
cb_cell->sample_text = NULL;
|
||||
}
|
||||
|
||||
/* =================================================== */
|
||||
|
||||
static void
|
||||
gnc_cellblock_init (CellBlock *cellblock, int rows, int cols)
|
||||
{
|
||||
@ -106,8 +100,6 @@ gnc_cellblock_init (CellBlock *cellblock, int rows, int cols)
|
||||
g_table_resize (cellblock->cb_cells, rows, cols);
|
||||
}
|
||||
|
||||
/* =================================================== */
|
||||
|
||||
void
|
||||
gnc_cellblock_destroy (CellBlock *cellblock)
|
||||
{
|
||||
@ -119,8 +111,6 @@ gnc_cellblock_destroy (CellBlock *cellblock)
|
||||
g_free (cellblock);
|
||||
}
|
||||
|
||||
/* =================================================== */
|
||||
|
||||
CellBlockCell *
|
||||
gnc_cellblock_get_cell (CellBlock *cellblock, int row, int col)
|
||||
{
|
||||
@ -130,4 +120,54 @@ gnc_cellblock_get_cell (CellBlock *cellblock, int row, int col)
|
||||
return g_table_index (cellblock->cb_cells, row, col);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gnc_cellblock_changed (CellBlock *cursor, gboolean include_conditional)
|
||||
{
|
||||
int r, c;
|
||||
|
||||
if (!cursor)
|
||||
return FALSE;
|
||||
|
||||
for (r = 0; r < cursor->num_rows; r++)
|
||||
for (c = 0; c < cursor->num_cols; c++)
|
||||
{
|
||||
CellBlockCell *cb_cell;
|
||||
|
||||
cb_cell = gnc_cellblock_get_cell (cursor, r, c);
|
||||
if (cb_cell == NULL)
|
||||
continue;
|
||||
|
||||
if (gnc_basic_cell_get_changed (cb_cell->cell))
|
||||
return TRUE;
|
||||
|
||||
if (include_conditional &&
|
||||
gnc_basic_cell_get_conditionally_changed (cb_cell->cell))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
gnc_cellblock_clear_changes (CellBlock *cursor)
|
||||
{
|
||||
int r, c;
|
||||
|
||||
if (!cursor)
|
||||
return;
|
||||
|
||||
for (r = 0; r < cursor->num_rows; r++)
|
||||
for (c = 0; c < cursor->num_cols; c++)
|
||||
{
|
||||
CellBlockCell *cb_cell;
|
||||
|
||||
cb_cell = gnc_cellblock_get_cell (cursor, r, c);
|
||||
if (cb_cell == NULL)
|
||||
continue;
|
||||
|
||||
gnc_basic_cell_set_changed (cb_cell->cell, FALSE);
|
||||
gnc_basic_cell_set_conditionally_changed (cb_cell->cell, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------- end of file ----------------- */
|
||||
|
@ -107,4 +107,10 @@ void gnc_cellblock_destroy (CellBlock *cellblock);
|
||||
CellBlockCell * gnc_cellblock_get_cell (CellBlock *cellblock,
|
||||
int row, int col);
|
||||
|
||||
#endif /* XACC_CELL_BLOCK_H */
|
||||
gboolean gnc_cellblock_changed (CellBlock *cursor,
|
||||
gboolean include_conditional);
|
||||
|
||||
void gnc_cellblock_clear_changes (CellBlock *cursor);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -57,26 +57,6 @@
|
||||
/* This static indicates the debugging module that this .o belongs to. */
|
||||
static short module = MOD_REGISTER;
|
||||
|
||||
typedef struct cell_node
|
||||
{
|
||||
CellType cell_type;
|
||||
BasicCell *cell;
|
||||
} CellNode;
|
||||
|
||||
typedef struct _CellBuffer CellBuffer;
|
||||
struct _CellBuffer
|
||||
{
|
||||
CellType cell_type;
|
||||
char * value;
|
||||
guint32 changed;
|
||||
guint32 conditionally_changed;
|
||||
};
|
||||
|
||||
struct _RegisterBuffer
|
||||
{
|
||||
GList *buffers;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char *string;
|
||||
@ -147,37 +127,22 @@ gnc_register_add_cell (SplitRegister *sr,
|
||||
const char *cell_type_name)
|
||||
{
|
||||
BasicCell *cell;
|
||||
CellNode *node;
|
||||
|
||||
g_return_if_fail (sr != NULL);
|
||||
g_return_if_fail (cell_type_name != NULL);
|
||||
|
||||
cell = gnc_register_make_cell (cell_type_name);
|
||||
|
||||
node = g_new0 (CellNode, 1);
|
||||
|
||||
node->cell_type = cell_type;
|
||||
node->cell = cell;
|
||||
|
||||
sr->cells = g_list_prepend (sr->cells, node);
|
||||
gnc_table_layout_add_cell (sr->table->layout, cell_type, cell);
|
||||
}
|
||||
|
||||
BasicCell *
|
||||
gnc_register_get_cell (SplitRegister *sr, CellType cell_type)
|
||||
{
|
||||
GList *node;
|
||||
|
||||
g_return_val_if_fail (sr != NULL, NULL);
|
||||
g_return_val_if_fail (sr->table != NULL, NULL);
|
||||
|
||||
for (node = sr->cells; node; node = node->next)
|
||||
{
|
||||
CellNode *cn = node->data;
|
||||
|
||||
if (cn->cell_type == cell_type)
|
||||
return cn->cell;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return gnc_table_layout_get_cell (sr->table->layout, cell_type);
|
||||
}
|
||||
|
||||
const char *
|
||||
@ -191,29 +156,6 @@ gnc_register_get_cell_value (SplitRegister *sr, CellType cell_type)
|
||||
return gnc_basic_cell_get_value (cell);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gnc_register_get_cursor_changed (SplitRegister *sr,
|
||||
gboolean include_conditional)
|
||||
{
|
||||
GList *node;
|
||||
|
||||
if (!sr) return FALSE;
|
||||
|
||||
for (node = sr->cells; node; node = node->next)
|
||||
{
|
||||
CellNode *cn = node->data;
|
||||
|
||||
if (gnc_basic_cell_get_changed (cn->cell))
|
||||
return TRUE;
|
||||
|
||||
if (include_conditional &&
|
||||
gnc_basic_cell_get_conditionally_changed (cn->cell))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gnc_register_get_cell_changed (SplitRegister *sr,
|
||||
CellType cell_type,
|
||||
@ -233,22 +175,6 @@ gnc_register_get_cell_changed (SplitRegister *sr,
|
||||
gnc_basic_cell_get_conditionally_changed (cell));
|
||||
}
|
||||
|
||||
void
|
||||
gnc_register_clear_changes (SplitRegister *sr)
|
||||
{
|
||||
GList *node;
|
||||
|
||||
if (!sr) return;
|
||||
|
||||
for (node = sr->cells; node; node = node->next)
|
||||
{
|
||||
CellNode *cn = node->data;
|
||||
|
||||
gnc_basic_cell_set_changed (cn->cell, FALSE);
|
||||
gnc_basic_cell_set_conditionally_changed (cn->cell, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
/* ============================================== */
|
||||
/* configAction strings into the action cell */
|
||||
/* hack alert -- this stuff really, really should be in a config file ... */
|
||||
@ -730,9 +656,8 @@ xaccInitSplitRegister (SplitRegister *reg,
|
||||
TableModel *model,
|
||||
gboolean templateMode)
|
||||
{
|
||||
Table * table;
|
||||
reg->table = gnc_table_new (model);
|
||||
|
||||
reg->table = NULL;
|
||||
reg->user_data = NULL;
|
||||
reg->destroy = NULL;
|
||||
|
||||
@ -868,18 +793,14 @@ xaccInitSplitRegister (SplitRegister *reg,
|
||||
/* add menu items for the action cell */
|
||||
configAction (reg);
|
||||
|
||||
table = gnc_table_new (model);
|
||||
|
||||
reg->table = table;
|
||||
|
||||
/* Set up header */
|
||||
{
|
||||
VirtualCellLocation vcell_loc = { 0, 0 };
|
||||
|
||||
gnc_table_set_vcell (table, reg->cursor_header,
|
||||
gnc_table_set_vcell (reg->table, reg->cursor_header,
|
||||
NULL, TRUE, TRUE, vcell_loc);
|
||||
|
||||
table->num_header_phys_rows = use_double_line ? 2 : 1;
|
||||
reg->table->num_header_phys_rows = use_double_line ? 2 : 1;
|
||||
}
|
||||
|
||||
/* Set up first and only initial row */
|
||||
@ -891,9 +812,9 @@ xaccInitSplitRegister (SplitRegister *reg,
|
||||
vloc.phys_row_offset = 0;
|
||||
vloc.phys_col_offset = 0;
|
||||
|
||||
gnc_table_set_vcell (table, reg->cursor_ledger_single,
|
||||
gnc_table_set_vcell (reg->table, reg->cursor_ledger_single,
|
||||
NULL, TRUE, TRUE, vloc.vcell_loc);
|
||||
gnc_table_move_cursor (table, vloc);
|
||||
gnc_table_move_cursor (reg->table, vloc);
|
||||
}
|
||||
}
|
||||
|
||||
@ -957,17 +878,6 @@ xaccDestroySplitRegister (SplitRegister *reg)
|
||||
reg->cursor_journal_double = NULL;
|
||||
reg->cursor_split = NULL;
|
||||
|
||||
for (node = reg->cells; node; node = node->next)
|
||||
{
|
||||
CellNode *cn = node->data;
|
||||
|
||||
gnc_basic_cell_destroy (cn->cell);
|
||||
g_free (cn);
|
||||
}
|
||||
|
||||
g_list_free (reg->cells);
|
||||
reg->cells = NULL;
|
||||
|
||||
g_free (reg->debit_str);
|
||||
g_free (reg->tdebit_str);
|
||||
g_free (reg->credit_str);
|
||||
@ -1065,27 +975,6 @@ xaccCursorTypeToClass (CursorType cursor_type)
|
||||
|
||||
/* ============================================== */
|
||||
|
||||
static CellType
|
||||
sr_cell_type (SplitRegister *reg, void * cell)
|
||||
{
|
||||
GList *node;
|
||||
|
||||
if (reg == NULL)
|
||||
return NO_CELL;
|
||||
|
||||
for (node = reg->cells; node; node = node->next)
|
||||
{
|
||||
CellNode *cn = node->data;
|
||||
|
||||
if (cell == cn->cell)
|
||||
return cn->cell_type;
|
||||
}
|
||||
|
||||
return NO_CELL;
|
||||
}
|
||||
|
||||
/* ============================================== */
|
||||
|
||||
CellType
|
||||
xaccSplitRegisterGetCurrentCellType (SplitRegister *reg)
|
||||
{
|
||||
@ -1145,7 +1034,7 @@ xaccSplitRegisterGetCellType (SplitRegister *reg, VirtualLocation virt_loc)
|
||||
if (cell == NULL)
|
||||
return NO_CELL;
|
||||
|
||||
return sr_cell_type (reg, cell);
|
||||
return gnc_table_layout_get_cell_type (reg->table->layout, cell);
|
||||
}
|
||||
|
||||
/* ============================================== */
|
||||
@ -1177,10 +1066,12 @@ xaccSplitRegisterGetCellLoc (SplitRegister *reg, CellType cell_type,
|
||||
for (cell_col = 0; cell_col < cellblock->num_cols; cell_col++)
|
||||
{
|
||||
CellBlockCell *cb_cell;
|
||||
CellType ctype;
|
||||
|
||||
cb_cell = gnc_cellblock_get_cell (cellblock, cell_row, cell_col);
|
||||
ctype = gnc_table_layout_get_cell_type (table->layout, cb_cell->cell);
|
||||
|
||||
if (sr_cell_type (reg, cb_cell->cell) == cell_type)
|
||||
if (ctype == cell_type)
|
||||
{
|
||||
if (virt_loc != NULL)
|
||||
{
|
||||
@ -1217,162 +1108,6 @@ xaccSplitRegisterGetCurrentCellLoc (SplitRegister *reg, CellType cell_type,
|
||||
virt_loc);
|
||||
}
|
||||
|
||||
/* ============================================== */
|
||||
|
||||
RegisterBuffer *
|
||||
gnc_register_buffer_new (void)
|
||||
{
|
||||
RegisterBuffer *rb;
|
||||
|
||||
rb = g_new0 (RegisterBuffer, 1);
|
||||
|
||||
return rb;
|
||||
}
|
||||
|
||||
/* ============================================== */
|
||||
|
||||
static void
|
||||
destroy_cell_buffer (CellBuffer *cb)
|
||||
{
|
||||
if (cb == NULL)
|
||||
return;
|
||||
|
||||
g_free (cb->value);
|
||||
cb->value = NULL;
|
||||
|
||||
g_free (cb);
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_register_buffer_clear (RegisterBuffer *rb)
|
||||
{
|
||||
GList *node;
|
||||
|
||||
if (!rb) return;
|
||||
|
||||
for (node = rb->buffers; node; node = node->next)
|
||||
{
|
||||
CellBuffer *cb = node->data;
|
||||
|
||||
destroy_cell_buffer (cb);
|
||||
}
|
||||
|
||||
g_list_free (rb->buffers);
|
||||
rb->buffers = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
gnc_register_buffer_destroy (RegisterBuffer *rb)
|
||||
{
|
||||
if (!rb) return;
|
||||
|
||||
gnc_register_buffer_clear (rb);
|
||||
|
||||
g_free (rb);
|
||||
}
|
||||
|
||||
/* ============================================== */
|
||||
|
||||
static CellBuffer *
|
||||
save_cell (BasicCell *bcell)
|
||||
{
|
||||
CellBuffer *cb;
|
||||
|
||||
if (!bcell)
|
||||
return NULL;
|
||||
|
||||
cb = g_new0 (CellBuffer, 1);
|
||||
|
||||
cb->value = g_strdup (bcell->value);
|
||||
cb->changed = bcell->changed;
|
||||
cb->conditionally_changed = bcell->conditionally_changed;
|
||||
|
||||
return cb;
|
||||
}
|
||||
|
||||
void
|
||||
gnc_register_save_cursor (SplitRegister *sr, RegisterBuffer *rb)
|
||||
{
|
||||
GList *node;
|
||||
|
||||
if ((sr == NULL) || (rb == NULL))
|
||||
return;
|
||||
|
||||
gnc_register_buffer_clear (rb);
|
||||
|
||||
for (node = sr->cells; node; node = node->next)
|
||||
{
|
||||
CellNode *cn = node->data;
|
||||
CellBuffer *cb;
|
||||
|
||||
if (!gnc_basic_cell_get_changed (cn->cell) &&
|
||||
!gnc_basic_cell_get_conditionally_changed (cn->cell))
|
||||
continue;
|
||||
|
||||
cb = save_cell (cn->cell);
|
||||
cb->cell_type = cn->cell_type;
|
||||
|
||||
rb->buffers = g_list_prepend (rb->buffers, cb);
|
||||
}
|
||||
}
|
||||
|
||||
/* ============================================== */
|
||||
|
||||
static void
|
||||
restore_cell (BasicCell *bcell, CellBuffer *cb, CellBlock *cursor)
|
||||
{
|
||||
int r, c;
|
||||
|
||||
if ((bcell == NULL) || (cb == NULL))
|
||||
return;
|
||||
|
||||
if (!cb->changed && !cb->conditionally_changed)
|
||||
return;
|
||||
|
||||
/* only restore if it's in the current cursor */
|
||||
for (r = 0; r < cursor->num_rows; r++)
|
||||
for (c = 0; c < cursor->num_cols; c++)
|
||||
{
|
||||
CellBlockCell *cb_cell;
|
||||
|
||||
cb_cell = gnc_cellblock_get_cell (cursor, r, c);
|
||||
if (cb_cell == NULL)
|
||||
continue;
|
||||
|
||||
if (cb_cell->cell == bcell)
|
||||
{
|
||||
xaccSetBasicCellValue(bcell, cb->value);
|
||||
bcell->changed = cb->changed;
|
||||
bcell->conditionally_changed = cb->conditionally_changed;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gnc_register_restore_cursor (SplitRegister *sr, RegisterBuffer *rb)
|
||||
{
|
||||
CellBlock *cursor;
|
||||
GList *node;
|
||||
|
||||
if ((sr == NULL) || (sr->table == NULL) || (rb == NULL))
|
||||
return;
|
||||
|
||||
cursor = sr->table->current_cursor;
|
||||
if (cursor == NULL)
|
||||
return;
|
||||
|
||||
for (node = rb->buffers; node; node = node->next)
|
||||
{
|
||||
CellBuffer *cb = node->data;
|
||||
BasicCell *cell;
|
||||
|
||||
cell = gnc_register_get_cell (sr, cb->cell_type);
|
||||
|
||||
restore_cell (cell, cb, cursor);
|
||||
}
|
||||
}
|
||||
|
||||
/* keep in sync with CellType enum */
|
||||
static const char *cell_names[] =
|
||||
{
|
||||
|
@ -139,7 +139,6 @@ typedef enum
|
||||
NUM_CURSOR_TYPES
|
||||
} CursorType;
|
||||
|
||||
typedef struct _RegisterBuffer RegisterBuffer;
|
||||
typedef struct _SplitRegister SplitRegister;
|
||||
|
||||
typedef void (*SplitRegisterDestroyCB) (SplitRegister *reg);
|
||||
@ -163,12 +162,10 @@ struct _SplitRegister
|
||||
|
||||
/* some private data; outsiders should not access this */
|
||||
|
||||
GList *cells;
|
||||
|
||||
/**
|
||||
* A flag indicating a "template" register.
|
||||
**/
|
||||
gboolean template;
|
||||
gboolean template; /* FIXME: this should not be here! */
|
||||
|
||||
/**
|
||||
* The template account which the transactions in a template
|
||||
@ -210,12 +207,9 @@ BasicCell * gnc_register_get_cell (SplitRegister *sr, CellType cell_type);
|
||||
const char * gnc_register_get_cell_value (SplitRegister *sr,
|
||||
CellType cell_type);
|
||||
|
||||
gboolean gnc_register_get_cursor_changed (SplitRegister *sr,
|
||||
gboolean include_conditional);
|
||||
gboolean gnc_register_get_cell_changed (SplitRegister *sr,
|
||||
CellType cell_type,
|
||||
gboolean include_conditional);
|
||||
void gnc_register_clear_changes (SplitRegister *sr);
|
||||
|
||||
/* Returns the type of the current cursor */
|
||||
CursorClass xaccSplitRegisterGetCurrentCursorClass (SplitRegister *reg);
|
||||
@ -245,13 +239,6 @@ gboolean xaccSplitRegisterGetCurrentCellLoc (SplitRegister *reg,
|
||||
CellType cell_type,
|
||||
VirtualLocation *virt_loc);
|
||||
|
||||
/* Functions for working with split register buffers */
|
||||
RegisterBuffer * gnc_register_buffer_new (void);
|
||||
void gnc_register_buffer_destroy (RegisterBuffer *rb);
|
||||
|
||||
void gnc_register_save_cursor (SplitRegister *sr, RegisterBuffer *srb);
|
||||
void gnc_register_restore_cursor (SplitRegister *sr, RegisterBuffer *srb);
|
||||
|
||||
const char * xaccSplitRegisterGetCellTypeName (CellType type);
|
||||
CellType xaccSplitRegisterGetCellTypeFromName (const char *name);
|
||||
|
||||
|
@ -65,22 +65,23 @@ static void gnc_table_resize (Table * table, int virt_rows, int virt_cols);
|
||||
Table *
|
||||
gnc_table_new (TableModel *model)
|
||||
{
|
||||
Table *table;
|
||||
Table *table;
|
||||
|
||||
g_return_val_if_fail (model != NULL, NULL);
|
||||
g_return_val_if_fail (model->entry_handler, NULL);
|
||||
g_return_val_if_fail (model != NULL, NULL);
|
||||
g_return_val_if_fail (model->entry_handler, NULL);
|
||||
|
||||
table = g_new0 (Table, 1);
|
||||
table = g_new0 (Table, 1);
|
||||
|
||||
table->model = model;
|
||||
table->layout = gnc_table_layout_new ();
|
||||
table->model = model;
|
||||
|
||||
gnc_table_init (table);
|
||||
gnc_table_init (table);
|
||||
|
||||
table->virt_cells = g_table_new (sizeof (VirtualCell),
|
||||
gnc_virtual_cell_construct,
|
||||
gnc_virtual_cell_destroy, table);
|
||||
table->virt_cells = g_table_new (sizeof (VirtualCell),
|
||||
gnc_virtual_cell_construct,
|
||||
gnc_virtual_cell_destroy, table);
|
||||
|
||||
return table;
|
||||
return table;
|
||||
}
|
||||
|
||||
/* ==================================================== */
|
||||
@ -88,30 +89,28 @@ gnc_table_new (TableModel *model)
|
||||
static void
|
||||
gnc_table_init (Table * table)
|
||||
{
|
||||
table->num_virt_rows = -1;
|
||||
table->num_virt_cols = -1;
|
||||
table->num_virt_rows = -1;
|
||||
table->num_virt_cols = -1;
|
||||
|
||||
table->num_header_phys_rows = -1;
|
||||
table->num_header_phys_rows = -1;
|
||||
|
||||
table->current_cursor = NULL;
|
||||
table->current_cursor = NULL;
|
||||
|
||||
gnc_virtual_location_init (&table->current_cursor_loc);
|
||||
gnc_virtual_location_init (&table->current_cursor_loc);
|
||||
|
||||
table->move_cursor = NULL;
|
||||
table->traverse = NULL;
|
||||
table->set_help = NULL;
|
||||
table->user_data = NULL;
|
||||
table->move_cursor = NULL;
|
||||
table->traverse = NULL;
|
||||
table->set_help = NULL;
|
||||
table->user_data = NULL;
|
||||
|
||||
table->alternate_bg_colors = FALSE;
|
||||
table->dividing_row = -1;
|
||||
|
||||
table->dividing_row = -1;
|
||||
/* initialize private data */
|
||||
|
||||
/* initialize private data */
|
||||
table->virt_cells = NULL;
|
||||
|
||||
table->virt_cells = NULL;
|
||||
|
||||
table->ui_data = NULL;
|
||||
table->destroy = NULL;
|
||||
table->ui_data = NULL;
|
||||
table->destroy = NULL;
|
||||
}
|
||||
|
||||
/* ==================================================== */
|
||||
@ -119,23 +118,63 @@ gnc_table_init (Table * table)
|
||||
void
|
||||
gnc_table_destroy (Table * table)
|
||||
{
|
||||
/* invoke destroy callback */
|
||||
if (table->destroy)
|
||||
table->destroy(table);
|
||||
/* invoke destroy callback */
|
||||
if (table->destroy)
|
||||
table->destroy(table);
|
||||
|
||||
/* free the dynamic structures */
|
||||
gnc_table_free_data (table);
|
||||
/* free the dynamic structures */
|
||||
gnc_table_free_data (table);
|
||||
|
||||
/* free the cell tables */
|
||||
g_table_destroy(table->virt_cells);
|
||||
/* free the cell tables */
|
||||
g_table_destroy (table->virt_cells);
|
||||
|
||||
/* intialize vars to null value so that any access is voided. */
|
||||
gnc_table_init (table);
|
||||
gnc_table_layout_destroy (table->layout);
|
||||
table->layout = NULL;
|
||||
|
||||
g_free (table);
|
||||
/* intialize vars to null value so that any access is voided. */
|
||||
gnc_table_init (table);
|
||||
|
||||
g_free (table);
|
||||
}
|
||||
|
||||
/* ==================================================== */
|
||||
gboolean
|
||||
gnc_table_current_cursor_changed (Table *table,
|
||||
gboolean include_conditional)
|
||||
{
|
||||
if (!table)
|
||||
return FALSE;
|
||||
|
||||
return gnc_cellblock_changed (table->current_cursor, include_conditional);
|
||||
}
|
||||
|
||||
void
|
||||
gnc_table_clear_current_cursor_changes (Table *table)
|
||||
{
|
||||
if (!table)
|
||||
return;
|
||||
|
||||
gnc_cellblock_clear_changes (table->current_cursor);
|
||||
}
|
||||
|
||||
void
|
||||
gnc_table_save_current_cursor (Table *table, CursorBuffer *buffer)
|
||||
{
|
||||
if (!table || !buffer)
|
||||
return;
|
||||
|
||||
gnc_table_layout_save_cursor (table->layout, table->current_cursor, buffer);
|
||||
}
|
||||
|
||||
void
|
||||
gnc_table_restore_current_cursor (Table *table,
|
||||
CursorBuffer *buffer)
|
||||
{
|
||||
if (!table || !buffer)
|
||||
return;
|
||||
|
||||
gnc_table_layout_restore_cursor (table->layout,
|
||||
table->current_cursor, buffer);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gnc_table_virtual_cell_out_of_bounds (Table *table,
|
||||
|
@ -96,6 +96,7 @@
|
||||
#include "gnc-common.h"
|
||||
#include "gtable.h"
|
||||
#include "register-common.h"
|
||||
#include "table-layout.h"
|
||||
#include "table-model.h"
|
||||
|
||||
|
||||
@ -136,6 +137,8 @@ typedef void (*TableDestroyFunc) (Table *table);
|
||||
|
||||
struct _Table
|
||||
{
|
||||
TableLayout *layout;
|
||||
|
||||
short num_virt_rows;
|
||||
short num_virt_cols;
|
||||
|
||||
@ -158,12 +161,6 @@ struct _Table
|
||||
* It can be used by higher-level code. */
|
||||
gpointer user_data;
|
||||
|
||||
/* Determines whether the passive background
|
||||
* colors alternate between odd and even virt
|
||||
* rows, or between the first and non-first
|
||||
* physical rows within cellblocks. */
|
||||
gboolean alternate_bg_colors;
|
||||
|
||||
/* If positive, denotes a row that marks a boundary that should
|
||||
* be visually distinguished. */
|
||||
short dividing_row;
|
||||
@ -189,8 +186,20 @@ Table * gnc_table_new (TableModel *model);
|
||||
void gnc_table_save_state (Table *table);
|
||||
void gnc_table_destroy (Table *table);
|
||||
|
||||
/* Thi function checks the bounds of virtal locations in the table
|
||||
* and returns TRUE if they are out of bounds. */
|
||||
|
||||
/* Functions to work with current cursor */
|
||||
gboolean gnc_table_current_cursor_changed (Table *table,
|
||||
gboolean include_conditional);
|
||||
|
||||
void gnc_table_clear_current_cursor_changes (Table *table);
|
||||
|
||||
void gnc_table_save_current_cursor (Table *table, CursorBuffer *buffer);
|
||||
void gnc_table_restore_current_cursor (Table *table,
|
||||
CursorBuffer *buffer);
|
||||
|
||||
|
||||
/* This function checks the given location and returns true
|
||||
* if it is out of bounds of the table. */
|
||||
gboolean gnc_table_virtual_cell_out_of_bounds (Table *table,
|
||||
VirtualCellLocation vcell_loc);
|
||||
|
||||
@ -359,5 +368,3 @@ gboolean gnc_table_traverse_update(Table *table,
|
||||
VirtualLocation *dest_loc);
|
||||
|
||||
#endif /* TABLE_ALLGUI_H */
|
||||
|
||||
/* ================== end of file ======================= */
|
||||
|
289
src/register/register-core/table-layout.c
Normal file
289
src/register/register-core/table-layout.c
Normal file
@ -0,0 +1,289 @@
|
||||
/********************************************************************\
|
||||
* table-layout.c -- 2D table layout *
|
||||
* Copyright (c) 2001 Free Software Foundation *
|
||||
* Author: Dave Peticolas <dave@krondo.com> *
|
||||
* *
|
||||
* 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 *
|
||||
* *
|
||||
\********************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include "basiccell.h"
|
||||
#include "table-layout.h"
|
||||
|
||||
|
||||
struct table_layout_struct
|
||||
{
|
||||
GList *cells; /* The cells in the table */
|
||||
};
|
||||
|
||||
typedef struct cell_node
|
||||
{
|
||||
int cell_type;
|
||||
BasicCell *cell;
|
||||
} CellNode;
|
||||
|
||||
typedef struct _CellBuffer CellBuffer;
|
||||
struct _CellBuffer
|
||||
{
|
||||
int cell_type;
|
||||
char * value;
|
||||
guint32 changed;
|
||||
guint32 conditionally_changed;
|
||||
};
|
||||
|
||||
struct cursor_buffer_struct
|
||||
{
|
||||
GList *cell_buffers;
|
||||
};
|
||||
|
||||
|
||||
TableLayout *
|
||||
gnc_table_layout_new (void)
|
||||
{
|
||||
TableLayout *layout;
|
||||
|
||||
layout = g_new0 (TableLayout, 1);
|
||||
|
||||
return layout;
|
||||
}
|
||||
|
||||
void
|
||||
gnc_table_layout_destroy (TableLayout *layout)
|
||||
{
|
||||
GList *node;
|
||||
|
||||
if (!layout)
|
||||
return;
|
||||
|
||||
for (node = layout->cells; node; node = node->next)
|
||||
{
|
||||
CellNode *cn = node->data;
|
||||
|
||||
gnc_basic_cell_destroy (cn->cell);
|
||||
g_free (cn);
|
||||
}
|
||||
|
||||
g_list_free (layout->cells);
|
||||
layout->cells = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
gnc_table_layout_add_cell (TableLayout *layout,
|
||||
int cell_type,
|
||||
BasicCell *cell)
|
||||
{
|
||||
CellNode *node;
|
||||
|
||||
g_return_if_fail (layout != NULL);
|
||||
g_return_if_fail (cell != NULL);
|
||||
|
||||
node = g_new0 (CellNode, 1);
|
||||
|
||||
node->cell_type = cell_type;
|
||||
node->cell = cell;
|
||||
|
||||
layout->cells = g_list_prepend (layout->cells, node);
|
||||
}
|
||||
|
||||
BasicCell *
|
||||
gnc_table_layout_get_cell (TableLayout *layout, int cell_type)
|
||||
{
|
||||
GList *node;
|
||||
|
||||
g_return_val_if_fail (layout != NULL, NULL);
|
||||
|
||||
for (node = layout->cells; node; node = node->next)
|
||||
{
|
||||
CellNode *cn = node->data;
|
||||
|
||||
if (cn->cell_type == cell_type)
|
||||
return cn->cell;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
gnc_table_layout_get_cell_type (TableLayout *layout, BasicCell *cell)
|
||||
{
|
||||
GList *node;
|
||||
|
||||
if (!layout || !cell)
|
||||
return -1;
|
||||
|
||||
for (node = layout->cells; node; node = node->next)
|
||||
{
|
||||
CellNode *cn = node->data;
|
||||
|
||||
if (cn->cell == cell)
|
||||
return cn->cell_type;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
CursorBuffer *
|
||||
gnc_cursor_buffer_new (void)
|
||||
{
|
||||
CursorBuffer *buffer;
|
||||
|
||||
buffer = g_new0 (CursorBuffer, 1);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
static void
|
||||
destroy_cell_buffer (CellBuffer *cb)
|
||||
{
|
||||
if (cb == NULL)
|
||||
return;
|
||||
|
||||
g_free (cb->value);
|
||||
cb->value = NULL;
|
||||
|
||||
g_free (cb);
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_cursor_buffer_clear (CursorBuffer *buffer)
|
||||
{
|
||||
GList *node;
|
||||
|
||||
if (!buffer) return;
|
||||
|
||||
for (node = buffer->cell_buffers; node; node = node->next)
|
||||
{
|
||||
CellBuffer *cb = node->data;
|
||||
|
||||
destroy_cell_buffer (cb);
|
||||
}
|
||||
|
||||
g_list_free (buffer->cell_buffers);
|
||||
buffer->cell_buffers = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
gnc_cursor_buffer_destroy (CursorBuffer *buffer)
|
||||
{
|
||||
if (!buffer) return;
|
||||
|
||||
gnc_cursor_buffer_clear (buffer);
|
||||
|
||||
g_free (buffer);
|
||||
}
|
||||
|
||||
static CellBuffer *
|
||||
save_cell (BasicCell *bcell)
|
||||
{
|
||||
CellBuffer *cb;
|
||||
|
||||
if (!bcell)
|
||||
return NULL;
|
||||
|
||||
cb = g_new0 (CellBuffer, 1);
|
||||
|
||||
cb->value = g_strdup (bcell->value);
|
||||
cb->changed = bcell->changed;
|
||||
cb->conditionally_changed = bcell->conditionally_changed;
|
||||
|
||||
return cb;
|
||||
}
|
||||
|
||||
void
|
||||
gnc_table_layout_save_cursor (TableLayout *layout,
|
||||
CellBlock *cursor,
|
||||
CursorBuffer *buffer)
|
||||
{
|
||||
GList *node;
|
||||
|
||||
if (!layout || !cursor || !buffer)
|
||||
return;
|
||||
|
||||
gnc_cursor_buffer_clear (buffer);
|
||||
|
||||
for (node = layout->cells; node; node = node->next)
|
||||
{
|
||||
CellNode *cn = node->data;
|
||||
CellBuffer *cb;
|
||||
|
||||
if (!gnc_basic_cell_get_changed (cn->cell) &&
|
||||
!gnc_basic_cell_get_conditionally_changed (cn->cell))
|
||||
continue;
|
||||
|
||||
cb = save_cell (cn->cell);
|
||||
cb->cell_type = cn->cell_type;
|
||||
|
||||
buffer->cell_buffers = g_list_prepend (buffer->cell_buffers, cb);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
restore_cell (BasicCell *bcell, CellBuffer *cb, CellBlock *cursor)
|
||||
{
|
||||
int r, c;
|
||||
|
||||
if (!bcell || !cb || !cursor)
|
||||
return;
|
||||
|
||||
if (!cb->changed && !cb->conditionally_changed)
|
||||
return;
|
||||
|
||||
/* only restore if it's in the current cursor */
|
||||
for (r = 0; r < cursor->num_rows; r++)
|
||||
for (c = 0; c < cursor->num_cols; c++)
|
||||
{
|
||||
CellBlockCell *cb_cell;
|
||||
|
||||
cb_cell = gnc_cellblock_get_cell (cursor, r, c);
|
||||
if (cb_cell == NULL)
|
||||
continue;
|
||||
|
||||
if (cb_cell->cell == bcell)
|
||||
{
|
||||
xaccSetBasicCellValue (bcell, cb->value);
|
||||
bcell->changed = cb->changed;
|
||||
bcell->conditionally_changed = cb->conditionally_changed;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gnc_table_layout_restore_cursor (TableLayout *layout,
|
||||
CellBlock *cursor,
|
||||
CursorBuffer *buffer)
|
||||
{
|
||||
GList *node;
|
||||
|
||||
if (!layout || !cursor || !buffer)
|
||||
return;
|
||||
|
||||
for (node = buffer->cell_buffers; node; node = node->next)
|
||||
{
|
||||
CellBuffer *cb = node->data;
|
||||
BasicCell *cell;
|
||||
|
||||
cell = gnc_table_layout_get_cell (layout, cb->cell_type);
|
||||
|
||||
restore_cell (cell, cb, cursor);
|
||||
}
|
||||
}
|
55
src/register/register-core/table-layout.h
Normal file
55
src/register/register-core/table-layout.h
Normal file
@ -0,0 +1,55 @@
|
||||
/********************************************************************\
|
||||
* table-layout.h -- 2D table layout *
|
||||
* Copyright (c) 2001 Free Software Foundation *
|
||||
* Author: Dave Peticolas <dave@krondo.com> *
|
||||
* *
|
||||
* 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 *
|
||||
* *
|
||||
\********************************************************************/
|
||||
|
||||
#ifndef TABLE_LAYOUT_H
|
||||
#define TABLE_LAYOUT_H
|
||||
|
||||
#include "basiccell.h"
|
||||
#include "cellblock.h"
|
||||
|
||||
typedef struct table_layout_struct TableLayout;
|
||||
typedef struct cursor_buffer_struct CursorBuffer;
|
||||
|
||||
|
||||
TableLayout * gnc_table_layout_new (void);
|
||||
void gnc_table_layout_destroy (TableLayout *layout);
|
||||
|
||||
void gnc_table_layout_add_cell (TableLayout *layout,
|
||||
int cell_type,
|
||||
BasicCell *cell);
|
||||
|
||||
BasicCell * gnc_table_layout_get_cell (TableLayout *layout, int cell_type);
|
||||
int gnc_table_layout_get_cell_type (TableLayout *layout, BasicCell *cell);
|
||||
|
||||
CursorBuffer * gnc_cursor_buffer_new (void);
|
||||
void gnc_cursor_buffer_destroy (CursorBuffer *buffer);
|
||||
|
||||
void gnc_table_layout_save_cursor (TableLayout *layout,
|
||||
CellBlock *cursor,
|
||||
CursorBuffer *buffer);
|
||||
void gnc_table_layout_restore_cursor (TableLayout *layout,
|
||||
CellBlock *cursor,
|
||||
CursorBuffer *buffer);
|
||||
|
||||
#endif
|
@ -42,6 +42,7 @@
|
||||
|
||||
;; first make sure the search paths are reasonable. probably shouldn't
|
||||
;; need to do this.
|
||||
(append-path "LD_LIBRARY_PATH" gnc:_lib-dir-default_)
|
||||
(append-path "LD_LIBRARY_PATH" gnc:_pkglib-dir-default_)
|
||||
(append-path "GNC_MODULE_PATH" gnc:_pkglib-dir-default_)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user