mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
add new function
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@647 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
b4a29a9aca
commit
c1479157b3
@ -235,4 +235,43 @@ xaccTableResizeUserData (Table * table, int new_virt_rows, int new_virt_cols)
|
||||
}
|
||||
}
|
||||
|
||||
/* ==================================================== */
|
||||
|
||||
void
|
||||
xaccAddCursor (Table *table, CellBlock *curs)
|
||||
{
|
||||
CellBlock **old_arr;
|
||||
size_t ncurs = 0;
|
||||
|
||||
/* count the old number of entries */
|
||||
if (table->cursors) {
|
||||
CellBlock *tmp = table->cursors[0];
|
||||
while (tmp) {
|
||||
ncurs ++;
|
||||
tmp = table->cursors[ncurs];
|
||||
}
|
||||
}
|
||||
old_arr = table->cursors;
|
||||
|
||||
/* malloc the list of new handlers */
|
||||
table->cursors = (CellBlock **) malloc ((ncurs+2) * sizeof (CellBlock *));
|
||||
|
||||
/* copy the old array to the new array */
|
||||
ncurs = 0;
|
||||
if (old_arr) {
|
||||
CellBlock *tmp = old_arr[0];
|
||||
while (tmp) {
|
||||
table->cursors[ncurs] = tmp;
|
||||
ncurs ++;
|
||||
tmp = old_arr[ncurs];
|
||||
}
|
||||
}
|
||||
|
||||
/* append the new cursor to the list */
|
||||
table->cursors[ncurs] = curs;
|
||||
table->cursors[ncurs+1] = NULL;
|
||||
|
||||
free (old_arr);
|
||||
}
|
||||
|
||||
/* ================== end of file ======================= */
|
||||
|
@ -47,6 +47,9 @@ xaccTableResizeStringArr (Table * table, int num_phys_rows, int num_phys_cols);
|
||||
extern void
|
||||
xaccTableResizeUserData (Table * table, int new_virt_rows, int new_virt_cols);
|
||||
|
||||
extern void
|
||||
xaccAddCursor (Table *table, CellBlock *curs);
|
||||
|
||||
#endif /* __XACC_TABLE_ALLGUI_H__ */
|
||||
|
||||
/* ================== end of file ======================= */
|
||||
|
Loading…
Reference in New Issue
Block a user