mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
compilable table.c
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@400 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
466db001ab
commit
f0e8b299de
@ -6,7 +6,7 @@ INCLPATH = -I/usr/include \
|
|||||||
-I./../include \
|
-I./../include \
|
||||||
-I./../lib/ComboBox-1.33 \
|
-I./../lib/ComboBox-1.33 \
|
||||||
-I./../lib/XmHTML-1.1.0/src \
|
-I./../lib/XmHTML-1.1.0/src \
|
||||||
-I./../lib/Xbae-4.6.2-linas
|
-I./../../lib/Xbae-4.6.2-linas
|
||||||
|
|
||||||
# libhtmlw eliminated due to license restrictions
|
# libhtmlw eliminated due to license restrictions
|
||||||
# and general brokenness
|
# and general brokenness
|
||||||
@ -24,7 +24,7 @@ LIBXMHTML= ../lib/XmHTML-1.1.0/src/libXmHTML.a
|
|||||||
LIBXBAE = ../lib/Xbae-4.6.2-linas/libXbae.a
|
LIBXBAE = ../lib/Xbae-4.6.2-linas/libXbae.a
|
||||||
LIBCOMBO = ../lib/ComboBox-1.33/libComboBox.a
|
LIBCOMBO = ../lib/ComboBox-1.33/libComboBox.a
|
||||||
######################################################################
|
######################################################################
|
||||||
SRCS = cell.c price.c single.c
|
SRCS = cell.c price.c single.c table.c
|
||||||
OBJS = ${SRCS:.c=.o}
|
OBJS = ${SRCS:.c=.o}
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
|
66
src/register/table.c
Normal file
66
src/register/table.c
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include <Xbae/Matrix.h>
|
||||||
|
|
||||||
|
#include "table.h"
|
||||||
|
|
||||||
|
Table *
|
||||||
|
xaccMallocTable (int numentries)
|
||||||
|
{
|
||||||
|
Table *table;
|
||||||
|
table = (Table *) malloc (sizeof (Table));
|
||||||
|
table->header = NULL;
|
||||||
|
table->cursor = NULL;
|
||||||
|
table->entries = NULL;
|
||||||
|
xaccInitTable (table, numentries);
|
||||||
|
return table;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ==================================================== */
|
||||||
|
|
||||||
|
void
|
||||||
|
xaccInitTable (Table * table, int numentries)
|
||||||
|
{
|
||||||
|
int num_phys_rows;
|
||||||
|
int num_phys_cols;
|
||||||
|
int i,j;
|
||||||
|
|
||||||
|
/* delete old entries */
|
||||||
|
if (table->entries) {
|
||||||
|
}
|
||||||
|
|
||||||
|
table->numEntries = numentries;
|
||||||
|
|
||||||
|
/* compute number of physical rows */
|
||||||
|
num_phys_rows = 0;
|
||||||
|
if (table->header) {
|
||||||
|
num_phys_rows += table->header->numRows;
|
||||||
|
}
|
||||||
|
if (table->cursor) {
|
||||||
|
num_phys_rows += numentries* table->cursor->numRows;
|
||||||
|
num_phys_cols = table->cursor->numCols;
|
||||||
|
}
|
||||||
|
table->num_phys_rows = num_phys_rows;
|
||||||
|
table->num_phys_cols = num_phys_cols;
|
||||||
|
|
||||||
|
/* create an empty table */
|
||||||
|
table->entries = (char ***) malloc (num_phys_rows * sizeof (char **));
|
||||||
|
for (i=0; i<num_phys_rows; i++) {
|
||||||
|
table->entries[i] = (char **) malloc (num_phys_cols * sizeof (char *));
|
||||||
|
for (j=0; j<num_phys_cols; j++) {
|
||||||
|
table->entries[i][j] = strdup ("");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ==================================================== */
|
||||||
|
|
||||||
|
void
|
||||||
|
xaccRefreshTable (Table * table)
|
||||||
|
{
|
||||||
|
|
||||||
|
XtVaSetValues (table->reg, XmNcells, table->entries, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ================== end of file ======================= */
|
@ -25,7 +25,7 @@ typedef struct _Table {
|
|||||||
/* private data, cahces, etc. */
|
/* private data, cahces, etc. */
|
||||||
int num_phys_rows;
|
int num_phys_rows;
|
||||||
int num_phys_cols;
|
int num_phys_cols;
|
||||||
} CellArray;
|
} Table;
|
||||||
|
|
||||||
|
|
||||||
Table * xaccMallocTable (int numentries);
|
Table * xaccMallocTable (int numentries);
|
||||||
@ -38,63 +38,4 @@ void xaccRefreshTable (Table *);
|
|||||||
void xaccSetCursor (Table *, CellArray *);
|
void xaccSetCursor (Table *, CellArray *);
|
||||||
|
|
||||||
#endif __XACC_TABLE_H__
|
#endif __XACC_TABLE_H__
|
||||||
|
|
||||||
Table *
|
|
||||||
xaccMallocTable (int numentries)
|
|
||||||
{
|
|
||||||
Table *table;
|
|
||||||
table = (Table *) malloc (sizeof (Table));
|
|
||||||
table->header = NULL;
|
|
||||||
table->cursor = NULL;
|
|
||||||
table->entries = NULL;
|
|
||||||
xaccInitTable (table, numentries);
|
|
||||||
return table;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ==================================================== */
|
|
||||||
|
|
||||||
void
|
|
||||||
xaccInitTable (Table * table, int numentries)
|
|
||||||
{
|
|
||||||
int num_phys_rows;
|
|
||||||
int num_phys_cols;
|
|
||||||
int i,j;
|
|
||||||
|
|
||||||
/* delete old entries */
|
|
||||||
if (table->entries) {
|
|
||||||
}
|
|
||||||
|
|
||||||
table->numEntries = numentries;
|
|
||||||
|
|
||||||
/* compute number of physical rows */
|
|
||||||
num_phys_rows = 0;
|
|
||||||
if (header) {
|
|
||||||
num_phys_rows += header->numRows;
|
|
||||||
}
|
|
||||||
if (cursor) {
|
|
||||||
num_phys_rows += numentries* cursor->numRows;
|
|
||||||
num_phys_cols = cursor->numCols;
|
|
||||||
}
|
|
||||||
table->num_phys_rows = num_phys_rows;
|
|
||||||
table->num_phys_cols = num_phys_cols;
|
|
||||||
|
|
||||||
/* create an empty table */
|
|
||||||
table->entries = (char ***) malloc (num_phys_rows * sizeof (char **));
|
|
||||||
for (i=0; i<num_phys_rows; i++) {
|
|
||||||
table->entries[i] = (char **) malloc (num_phys_cols * sizeof (char *));
|
|
||||||
for (j=0; j<num_phys_cols; j++) {
|
|
||||||
table->entries[i][j] = strdup ("");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ==================================================== */
|
|
||||||
|
|
||||||
void
|
|
||||||
xaccRefreshTable (Table * table)
|
|
||||||
{
|
|
||||||
|
|
||||||
XtVaSetValues (table->reg, XmNcells, table->entires, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ================== end of file ======================= */
|
/* ================== end of file ======================= */
|
||||||
|
Loading…
Reference in New Issue
Block a user