mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
add destroy methods
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@728 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
0ade72fb1b
commit
ed91e8e978
@ -6,7 +6,7 @@
|
||||
* Implements the gui-independent parts of the table infrastructure.
|
||||
*
|
||||
* HISTORY:
|
||||
* Copyright (c) 1988 Linas Vepstas
|
||||
* Copyright (c) 1998 Linas Vepstas
|
||||
*/
|
||||
|
||||
/********************************************************************\
|
||||
@ -140,6 +140,42 @@
|
||||
|
||||
/* ==================================================== */
|
||||
|
||||
void
|
||||
xaccFreeTableEntries (Table * table)
|
||||
{
|
||||
int i,j;
|
||||
/* free the entries and locators */
|
||||
for (i=0; i<table->num_phys_rows; i++) {
|
||||
for (j=0; j<table->num_phys_cols; j++) {
|
||||
free (table->entries[i][j]);
|
||||
table->entries[i][j] = NULL;
|
||||
|
||||
free (table->locators[i][j]);
|
||||
table->locators[i][j] = NULL;
|
||||
}
|
||||
free (table->entries[i]);
|
||||
table->entries[i] = NULL;
|
||||
|
||||
free (table->locators[i]);
|
||||
table->locators[i] = NULL;
|
||||
}
|
||||
free (table->entries);
|
||||
table->entries = NULL;
|
||||
|
||||
free (table->locators);
|
||||
table->locators = NULL;
|
||||
|
||||
/* null out user data and handlers */
|
||||
for (i=0; i<table->num_virt_rows; i++) {
|
||||
for (j=0; j<table->num_virt_cols; j++) {
|
||||
table->handlers = NULL;
|
||||
table->user_data = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ==================================================== */
|
||||
|
||||
static Locator *
|
||||
xaccMallocLocator (void)
|
||||
{
|
||||
|
@ -6,7 +6,7 @@
|
||||
* Implements the gui-independent parts of the table infrastructure.
|
||||
*
|
||||
* HISTORY:
|
||||
* Copyright (c) 1988 Linas Vepstas
|
||||
* Copyright (c) 1998 Linas Vepstas
|
||||
*/
|
||||
|
||||
/********************************************************************\
|
||||
@ -28,10 +28,12 @@
|
||||
#ifndef __XACC_TABLE_ALLGUI_H__
|
||||
#define __XACC_TABLE_ALLGUI_H__
|
||||
|
||||
/* hack-alert, to pick up the table definition.
|
||||
* since C lacks the inheritance of C++
|
||||
* fix this someday.
|
||||
/* hack alert -- move a portion of the gui-independent
|
||||
* table structure definition, currentlu in table-motif.h,
|
||||
* to here. But C lacks the inheritance of C++, so this
|
||||
* is ugly.
|
||||
*/
|
||||
|
||||
#define XMOTIF
|
||||
#ifdef XMOTIF
|
||||
#include "table-motif.h"
|
||||
@ -41,13 +43,16 @@
|
||||
#include "table-gtk.h"
|
||||
#endif
|
||||
|
||||
/* free the gui-independent parts of the table structure. */
|
||||
void xaccFreeTableEntries (Table *);
|
||||
|
||||
/* resize the various arrays that compose the table */
|
||||
extern void
|
||||
void
|
||||
xaccTableResize (Table * table, int num_phys_rows, int num_phys_cols,
|
||||
int new_virt_rows, int new_virt_cols);
|
||||
|
||||
/* indicate what handler should be used for a given virtual block */
|
||||
extern void
|
||||
void
|
||||
xaccSetCursor (Table *table, CellBlock *curs,
|
||||
int phys_row_origin, int phys_col_origin,
|
||||
int virt_row, int virt_col);
|
||||
|
@ -8,7 +8,7 @@
|
||||
* ported to GTK, etc.
|
||||
*
|
||||
* HISTORY:
|
||||
* Copyright (c) 1988 Linas Vepstas
|
||||
* Copyright (c) 1998 Linas Vepstas
|
||||
*/
|
||||
|
||||
/********************************************************************\
|
||||
@ -94,6 +94,21 @@ xaccInitTable (Table * table)
|
||||
|
||||
/* ==================================================== */
|
||||
|
||||
void
|
||||
xaccDestroyTable (Table * table)
|
||||
{
|
||||
/* free the gui-independent parts */
|
||||
xaccFreeTableEntries (table);
|
||||
|
||||
/* hmmm what about the motif widget ??? */
|
||||
|
||||
/* intialize vars to null value so that any access is voided. */
|
||||
xaccInitTable (table);
|
||||
free (table);
|
||||
}
|
||||
|
||||
/* ==================================================== */
|
||||
|
||||
void
|
||||
xaccSetTableSize (Table * table, int phys_rows, int phys_cols,
|
||||
int virt_rows, int virt_cols)
|
||||
@ -236,7 +251,7 @@ enterCB (Widget mw, XtPointer cd, XtPointer cb)
|
||||
XbaeMatrixEnterCellCallbackStruct *cbs;
|
||||
int row, col;
|
||||
int rel_row, rel_col;
|
||||
const char * (*enter) (struct _BasicCell *, const char *);
|
||||
const char * (*enter) (BasicCell *, const char *);
|
||||
|
||||
table = (Table *) cd;
|
||||
arr = table->current_cursor;
|
||||
@ -295,7 +310,7 @@ modifyCB (Widget mw, XtPointer cd, XtPointer cb)
|
||||
XbaeMatrixModifyVerifyCallbackStruct *cbs;
|
||||
int row, col;
|
||||
int rel_row, rel_col;
|
||||
const char * (*mv) (struct _BasicCell *,
|
||||
const char * (*mv) (BasicCell *,
|
||||
const char *,
|
||||
const char *,
|
||||
const char *);
|
||||
@ -383,7 +398,7 @@ leaveCB (Widget mw, XtPointer cd, XtPointer cb)
|
||||
XbaeMatrixLeaveCellCallbackStruct *cbs;
|
||||
int row, col;
|
||||
int rel_row, rel_col;
|
||||
const char * (*leave) (struct _BasicCell *, const char *);
|
||||
const char * (*leave) (BasicCell *, const char *);
|
||||
char * newval;
|
||||
|
||||
table = (Table *) cd;
|
||||
@ -597,15 +612,14 @@ xaccCreateTable (Table *table, Widget parent, char * name)
|
||||
BasicCell *cell;
|
||||
cell = curs->cells[i][j];
|
||||
if (cell) {
|
||||
void (*xt_realize) (struct _BasicCell *,
|
||||
void (*xt_realize) (BasicCell *,
|
||||
void *gui,
|
||||
int pixel_width);
|
||||
xt_realize = cell->realize;
|
||||
if (xt_realize) {
|
||||
int pixel_width;
|
||||
pixel_width = XbaeMatrixGetColumnPixelWidth (reg, j);
|
||||
xt_realize (((struct _BasicCell *) cell),
|
||||
((void *) reg), pixel_width);
|
||||
xt_realize (cell, ((void *) reg), pixel_width);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -123,6 +123,7 @@ typedef struct _Table {
|
||||
|
||||
Table * xaccMallocTable (void);
|
||||
void xaccInitTable (Table *);
|
||||
void xaccDestroyTable (Table *);
|
||||
|
||||
/* rsize the table to the indicated dimensions.
|
||||
* calls the gui-independent xaccTableResize() routine,
|
||||
@ -135,8 +136,6 @@ void xaccSetTableSize (Table * table, int phys_rows, int phys_cols,
|
||||
Widget xaccCreateTable (Table *, Widget parent, char * name);
|
||||
void xaccNextTabGroup (Table *, Widget);
|
||||
|
||||
void xaccDestroyTable (Table *);
|
||||
|
||||
/* redraw the table GUI */
|
||||
void xaccRefreshTableGUI (Table *);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user