mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
add implementation
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@397 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
b17c29bba4
commit
fd868aa714
@ -1,23 +1,53 @@
|
||||
|
||||
#include <Xm/Xm.h>
|
||||
#include "single.h"
|
||||
#include <stdlib.h>
|
||||
#include "cell.h"
|
||||
|
||||
typedef struct _CellArray {
|
||||
CellArray * xaccMallocCellArray (int numrows, int numcols)
|
||||
{
|
||||
|
||||
short numRows;
|
||||
short numCols;
|
||||
CellArray *arr;
|
||||
arr = (CellArray *) malloc (sizeof (CellArray *));
|
||||
|
||||
SingleCell **cells; /* row-col array */
|
||||
arr->cells = NULL;
|
||||
xaccInitCellArray (arr, numrows, numcols);
|
||||
|
||||
Widget reg; /* the XbaeMatrix */
|
||||
} CellArray;
|
||||
return arr;
|
||||
}
|
||||
|
||||
/* =================================================== */
|
||||
|
||||
CellArray * xaccMallocCellArray (void);
|
||||
void xaccInitCellArray (CellArray *, int numrows, int numcols);
|
||||
void xaccDestroyCellArray (CellArray *);
|
||||
void
|
||||
xaccInitCellArray (CellArray *arr, int numrows, int numcols)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* add a cell to the array */
|
||||
void xaccAddCell (SingleCell *);
|
||||
arr->numRows = numrows;
|
||||
arr->numCols = numcols;
|
||||
|
||||
if (arr->cells) {
|
||||
for (i=0; i<numrows; i++) {
|
||||
if (arr->cells[i]) free (arr->cells[i]);
|
||||
}
|
||||
free (arr->cells);
|
||||
}
|
||||
|
||||
arr->cells = (SingleCell ***) malloc (numrows * sizeof (SingleCell **));
|
||||
for (i=0; i<numrows; i++) {
|
||||
arr->cells[i] = (SingleCell **) malloc (numcols * sizeof (SingleCell *));
|
||||
}
|
||||
}
|
||||
|
||||
/* =================================================== */
|
||||
|
||||
void
|
||||
xaccAddCell (CellArray *arr, SingleCell *cell)
|
||||
{
|
||||
int i,j;
|
||||
|
||||
i = cell->row;
|
||||
j = cell->col;
|
||||
|
||||
arr->cells[i][j] = cell;
|
||||
}
|
||||
|
||||
/* --------------- end of file ----------------- */
|
||||
|
26
src/register/cellblock.h
Normal file
26
src/register/cellblock.h
Normal file
@ -0,0 +1,26 @@
|
||||
|
||||
#ifndef __XACC_CELL_H__
|
||||
#define __XACC_CELL_H__
|
||||
|
||||
#include <Xm/Xm.h>
|
||||
#include "single.h"
|
||||
|
||||
typedef struct _CellArray {
|
||||
|
||||
short numRows;
|
||||
short numCols;
|
||||
|
||||
SingleCell ***cells; /* row-col array */
|
||||
|
||||
Widget reg; /* the XbaeMatrix */
|
||||
} CellArray;
|
||||
|
||||
|
||||
CellArray * xaccMallocCellArray (int numrows, int numcols);
|
||||
void xaccInitCellArray (CellArray *, int numrows, int numcols);
|
||||
void xaccDestroyCellArray (CellArray *);
|
||||
|
||||
/* add a cell to the array */
|
||||
void xaccAddCell (CellArray *, SingleCell *);
|
||||
|
||||
#endif __XACC_CELL_H__
|
Loading…
Reference in New Issue
Block a user