mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
get rid of the special action-cell type. Not needed, and confusing,
it would seem ... git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@462 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
70ae318ae3
commit
32ad35813b
@ -35,7 +35,7 @@ xaccLoadRegister (BasicRegister *reg, Split **slist)
|
||||
xaccSetBasicCellValue (reg->dateCell, buff);
|
||||
|
||||
xaccSetBasicCellValue (reg->numCell, trans->num);
|
||||
xaccSetBasicCellValue (reg->actionCell, split->action);
|
||||
xaccSetBasicCellValue (&(reg->actionCell->cell), split->action);
|
||||
xaccSetQuickFillCellValue (reg->descCell, trans->description);
|
||||
xaccSetBasicCellValue (reg->memoCell, split->memo);
|
||||
|
||||
|
@ -671,7 +671,6 @@ recordCB( Widget mw, XtPointer cd, XtPointer cb )
|
||||
{
|
||||
RegWindow *regData = (RegWindow *)cd;
|
||||
|
||||
XbaeMatrixCommitEdit( regData->reg, False );
|
||||
/* hack alert */
|
||||
/* regSaveTransaction( regData, regData->currEntry ); */
|
||||
regData->changed = MOD_NONE;
|
||||
@ -733,7 +732,6 @@ static void
|
||||
cancelCB( Widget mw, XtPointer cd, XtPointer cb )
|
||||
{
|
||||
RegWindow *regData = (RegWindow *)cd;
|
||||
XbaeMatrixCancelEdit( regData->reg, False );
|
||||
}
|
||||
|
||||
/************************** END OF FILE *************************/
|
||||
|
10
src/main.c
10
src/main.c
@ -105,11 +105,11 @@ String fbRes[] = {
|
||||
"*recn*cellMarginWidth: 0",
|
||||
"*recn*cellMarginHeight: 0",
|
||||
/* combobox -- don't want the cell to be outlined */
|
||||
"*reg*popbox*shadowThickness: 0",
|
||||
"*reg*popbox*list*shadowThickness: 1", /* we *do* want the combobox scroll bar to show, thoguh */
|
||||
"*reg*popbox*list*thickness: 24", /* slider width ignored ... why ??? */
|
||||
"*reg*popbox*list*VertScrollBar*width: 24", /* slider width ignored ... why ??? */
|
||||
"*reg*popbox*list*troughColor: #9999aa", /* ignored -- why ???*/
|
||||
"*reg*combocell*shadowThickness: 0",
|
||||
"*reg*combocell*list*shadowThickness: 1", /* we *do* want the combobox scroll bar to show, thoguh */
|
||||
"*reg*combocell*list*thickness: 24", /* slider width ignored ... why ??? */
|
||||
"*reg*combocell*list*VertScrollBar*width: 24", /* slider width ignored ... why ??? */
|
||||
"*reg*combocell*list*troughColor: #9999aa", /* ignored -- why ???*/
|
||||
NULL,
|
||||
};
|
||||
|
||||
|
@ -26,7 +26,7 @@ LIBXBAE = ../../lib/Xbae-4.6.2-linas/libXbae.a
|
||||
LIBCOMBO = ../lib/ComboBox-1.33/libComboBox.a
|
||||
LIBTRANS = ../Account.o ../Data.o ../FileIO.o ../Transaction.o ../date.o
|
||||
######################################################################
|
||||
SRCS = actioncell.c basiccell.c cellblock.c combocell.c \
|
||||
SRCS = basiccell.c cellblock.c combocell.c \
|
||||
datecell.c pricecell.c QuickFill.c quickfillcell.c \
|
||||
recncell.c register.c table.c textcell.c
|
||||
OBJS = ${SRCS:.c=.o}
|
||||
|
@ -1,75 +0,0 @@
|
||||
|
||||
#include "actioncell.h"
|
||||
#include "messages.h"
|
||||
|
||||
static void realizeAction (struct _BasicCell *bcell, void *w, int width);
|
||||
static void destroyAction (struct _BasicCell *bcell);
|
||||
|
||||
/* =============================================== */
|
||||
|
||||
ActionCell *xaccMallocActionCell (void)
|
||||
{
|
||||
ActionCell * cell;
|
||||
cell = (ActionCell *) malloc (sizeof (ActionCell));
|
||||
xaccInitActionCell (cell);
|
||||
return cell;
|
||||
}
|
||||
|
||||
void xaccInitActionCell (ActionCell *cell)
|
||||
{
|
||||
xaccInitComboCell ( &(cell->cell));
|
||||
cell->chain_realize = cell->cell.cell.realize;
|
||||
cell->cell.cell.realize = realizeAction;
|
||||
}
|
||||
|
||||
/* =============================================== */
|
||||
|
||||
static
|
||||
void realizeAction (struct _BasicCell *bcell, void *w, int width)
|
||||
{
|
||||
ActionCell *cell = (ActionCell *) bcell;
|
||||
|
||||
/* first, call the combobox realize */
|
||||
cell->cell.cell.realize = cell->chain_realize;
|
||||
if (cell->chain_realize) {
|
||||
(cell->chain_realize) (bcell, w, width);
|
||||
}
|
||||
|
||||
/* now, install our destroy */
|
||||
cell->chain_destroy = cell->cell.cell.destroy;
|
||||
cell->cell.cell.destroy = destroyAction;
|
||||
|
||||
/* finally, add menu items */
|
||||
xaccAddComboCellMenuItem ( &(cell->cell), BUY_STR);
|
||||
xaccAddComboCellMenuItem ( &(cell->cell), SELL_STR);
|
||||
xaccAddComboCellMenuItem ( &(cell->cell), PRICE_STR);
|
||||
xaccAddComboCellMenuItem ( &(cell->cell), INT_STR);
|
||||
xaccAddComboCellMenuItem ( &(cell->cell), DIV_STR);
|
||||
xaccAddComboCellMenuItem ( &(cell->cell), LTCG_STR);
|
||||
xaccAddComboCellMenuItem ( &(cell->cell), STCG_STR);
|
||||
xaccAddComboCellMenuItem ( &(cell->cell), DIST_STR);
|
||||
xaccAddComboCellMenuItem ( &(cell->cell), SPLIT_STR);
|
||||
xaccAddComboCellMenuItem ( &(cell->cell), DEPOSIT_STR);
|
||||
xaccAddComboCellMenuItem ( &(cell->cell), WITHDRAW_STR);
|
||||
|
||||
}
|
||||
|
||||
/* =============================================== */
|
||||
|
||||
static
|
||||
void destroyAction (struct _BasicCell *bcell)
|
||||
{
|
||||
ActionCell *cell = (ActionCell *) bcell;
|
||||
|
||||
/* first, call the combobox destroy */
|
||||
cell->cell.cell.destroy = cell->chain_destroy;
|
||||
if (cell->chain_destroy) {
|
||||
(cell->chain_destroy) (bcell);
|
||||
}
|
||||
|
||||
/* now, install our realize */
|
||||
cell->chain_realize = cell->cell.cell.realize;
|
||||
cell->cell.cell.realize = realizeAction;
|
||||
}
|
||||
|
||||
/* =============== end of file =================== */
|
@ -1,31 +0,0 @@
|
||||
/*
|
||||
* FILE:
|
||||
* actioncell.h
|
||||
*
|
||||
* FUNCTION:
|
||||
* Implements a actionbox cell
|
||||
*
|
||||
* HISTORY:
|
||||
* Created Jan 1998 Linas Vepstas
|
||||
* Copyright (c) 1998 Linas Vepstas
|
||||
*/
|
||||
|
||||
#ifndef __XACC_ACTION_CELL_C__
|
||||
#define __XACC_ACTION_CELL_C__
|
||||
|
||||
#include "combocell.h"
|
||||
|
||||
typedef struct _ActionCell {
|
||||
ComboCell cell;
|
||||
void (* chain_realize) (struct _BasicCell *,
|
||||
void *gui_handle,
|
||||
int pixel_width);
|
||||
void (* chain_destroy) (struct _BasicCell *);
|
||||
} ActionCell;
|
||||
|
||||
ActionCell * xaccMallocActionCell (void);
|
||||
void xaccInitActionCell (ActionCell *);
|
||||
|
||||
#endif /* __XACC_ACTION_CELL_C__ */
|
||||
|
||||
/* --------------- end of file ---------------------- */
|
@ -42,6 +42,8 @@ void xaccInitComboCell (ComboCell *cell)
|
||||
{
|
||||
xaccInitBasicCell ( &(cell->cell));
|
||||
cell->cell.realize = realizeCombo;
|
||||
cell->menuitems = (char **) malloc (sizeof (char *));
|
||||
cell->menuitems[0] = NULL;
|
||||
}
|
||||
|
||||
/* =============================================== */
|
||||
@ -49,15 +51,26 @@ void xaccInitComboCell (ComboCell *cell)
|
||||
void
|
||||
xaccAddComboCellMenuItem (ComboCell *cell, char * menustr)
|
||||
{
|
||||
PopBox *box;
|
||||
XmString str;
|
||||
box = (PopBox *) (cell->cell.gui_private);
|
||||
int n = 0;
|
||||
char ** oldarr;
|
||||
|
||||
if (!box) return;
|
||||
if (!cell) return;
|
||||
if (!menustr) return;
|
||||
|
||||
str = XmStringCreateLtoR (menustr, XmSTRING_DEFAULT_CHARSET);
|
||||
XmComboBoxAddItem (box->combobox, str, 0);
|
||||
XmStringFree (str);
|
||||
oldarr = cell->menuitems;
|
||||
while (oldarr[n]) n ++;
|
||||
|
||||
cell->menuitems = (char **) malloc ((n+2) *sizeof (char *));
|
||||
|
||||
n = 0;
|
||||
while (oldarr[n]) {
|
||||
cell->menuitems[n] = oldarr[n];
|
||||
n++;
|
||||
}
|
||||
cell->menuitems[n] = strdup (menustr);
|
||||
cell->menuitems[n+1] = NULL;
|
||||
|
||||
free (oldarr);
|
||||
}
|
||||
|
||||
/* =============================================== */
|
||||
@ -100,7 +113,7 @@ void realizeCombo (struct _BasicCell *bcell, void *w, int pixel_width)
|
||||
|
||||
/* create the pop GUI */
|
||||
combobox = XtVaCreateManagedWidget
|
||||
("popbox", xmComboBoxWidgetClass, parent,
|
||||
("combocell", xmComboBoxWidgetClass, parent,
|
||||
XmNshadowThickness, 0, /* don't draw a shadow,
|
||||
* use bae shadows */
|
||||
XmNeditable, False, /* user can only pick from list */
|
||||
@ -121,7 +134,24 @@ void realizeCombo (struct _BasicCell *bcell, void *w, int pixel_width)
|
||||
XtAddCallback (combobox, XmNunselectionCallback, selectCB, (XtPointer)cell);
|
||||
XtAddCallback (combobox, XmNdropDownCallback, dropDownCB, (XtPointer)box);
|
||||
|
||||
/* unmap the widget by moving it to an invlid location */
|
||||
moveCombo (bcell, -1, -1);
|
||||
|
||||
/* add menu items */
|
||||
if (cell->menuitems) {
|
||||
char * menustr;
|
||||
int i=0;
|
||||
|
||||
menustr = cell->menuitems[i];
|
||||
while (menustr) {
|
||||
XmString str;
|
||||
str = XmStringCreateLtoR (menustr, XmSTRING_DEFAULT_CHARSET);
|
||||
XmComboBoxAddItem (box->combobox, str, 0);
|
||||
XmStringFree (str);
|
||||
i++;
|
||||
menustr = cell->menuitems[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* =============================================== */
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
typedef struct _ComboCell {
|
||||
BasicCell cell;
|
||||
char ** menuitems;
|
||||
} ComboCell;
|
||||
|
||||
ComboCell * xaccMallocComboCell (void);
|
||||
|
@ -3,7 +3,7 @@
|
||||
* register.c
|
||||
*/
|
||||
|
||||
#include "actioncell.h"
|
||||
#include "messages.h"
|
||||
#include "register.h"
|
||||
|
||||
#define DATE_CELL_C 0
|
||||
@ -67,22 +67,22 @@ void xaccInitBasicRegister (BasicRegister *reg)
|
||||
cell = (BasicCell *) xaccMallocDateCell();
|
||||
cell->width = 11;
|
||||
xaccAddCell (header, cell, 0, DATE_CELL_C);
|
||||
xaccSetBasicCellValue (cell, "Date");
|
||||
xaccSetBasicCellValue (cell, DATE_STR);
|
||||
|
||||
cell = xaccMallocTextCell();
|
||||
cell->width = 7;
|
||||
xaccAddCell (header, cell, 0, NUM_CELL_C);
|
||||
xaccSetBasicCellValue (cell, "Num");
|
||||
xaccSetBasicCellValue (cell, NUM_STR);
|
||||
|
||||
cell = xaccMallocTextCell();
|
||||
cell->width = 11;
|
||||
xaccAddCell (header, cell, XFRM_CELL_R, XFRM_CELL_C);
|
||||
xaccSetBasicCellValue (cell, "Transfer From");
|
||||
xaccSetBasicCellValue (cell, XFRM_STR);
|
||||
|
||||
cell = xaccMallocTextCell();
|
||||
cell->width = 29;
|
||||
xaccAddCell (header, cell, 0, DESC_CELL_C);
|
||||
xaccSetBasicCellValue (cell, "Description");
|
||||
xaccSetBasicCellValue (cell, DESC_STR);
|
||||
|
||||
cell = xaccMallocRecnCell();
|
||||
cell->width = 1;
|
||||
@ -92,17 +92,17 @@ void xaccInitBasicRegister (BasicRegister *reg)
|
||||
cell = (BasicCell *) xaccMallocPriceCell();
|
||||
cell->width = 9;
|
||||
xaccAddCell (header, cell, 0, CRED_CELL_C);
|
||||
xaccSetBasicCellValue (cell, "Credit");
|
||||
xaccSetBasicCellValue (cell, CREDIT_STR);
|
||||
|
||||
cell = (BasicCell *) xaccMallocPriceCell();
|
||||
cell->width = 9;
|
||||
xaccAddCell (header, cell, 0, DEBT_CELL_C);
|
||||
xaccSetBasicCellValue (cell, "Debit");
|
||||
xaccSetBasicCellValue (cell, DEBIT_STR);
|
||||
|
||||
cell = (BasicCell *) xaccMallocPriceCell();
|
||||
cell->width = 9;
|
||||
xaccAddCell (header, cell, 0, BALN_CELL_C);
|
||||
xaccSetBasicCellValue (cell, "Balance");
|
||||
xaccSetBasicCellValue (cell, BALN_STR);
|
||||
|
||||
|
||||
/* --------------------------- */
|
||||
@ -119,15 +119,13 @@ void xaccInitBasicRegister (BasicRegister *reg)
|
||||
xaccAddCell (curs, cell, NUM_CELL_R, NUM_CELL_C);
|
||||
reg->numCell = cell;
|
||||
|
||||
cell = (BasicCell *) xaccMallocActionCell();
|
||||
cell->width = 7;
|
||||
xaccAddCell (curs, cell, ACTN_CELL_R, ACTN_CELL_C);
|
||||
reg->actionCell = cell;
|
||||
reg->actionCell = xaccMallocComboCell();
|
||||
reg->actionCell->cell.width = 7;
|
||||
xaccAddCell (curs, &(reg->actionCell->cell), ACTN_CELL_R, ACTN_CELL_C);
|
||||
|
||||
cell = xaccMallocTextCell();
|
||||
cell->width = 11;
|
||||
xaccAddCell (curs, cell, XFRM_CELL_R, XFRM_CELL_C);
|
||||
reg->xferCell = cell;
|
||||
reg->xfrmCell = xaccMallocComboCell();
|
||||
reg->xfrmCell->cell.width = 11;
|
||||
xaccAddCell (curs, &(reg->xfrmCell->cell), XFRM_CELL_R, XFRM_CELL_C);
|
||||
|
||||
reg->descCell = xaccMallocQuickFillCell();
|
||||
reg->descCell->cell.width = 9;
|
||||
@ -169,6 +167,21 @@ void xaccInitBasicRegister (BasicRegister *reg)
|
||||
xaccNextRight (curs, MEMO_CELL_R, MEMO_CELL_C, -1-DATE_CELL_R, -1-DATE_CELL_C);
|
||||
|
||||
|
||||
/* -------------------------------- */
|
||||
/* add menu items for the action cell */
|
||||
|
||||
xaccAddComboCellMenuItem ( reg->actionCell, BUY_STR);
|
||||
xaccAddComboCellMenuItem ( reg->actionCell, SELL_STR);
|
||||
xaccAddComboCellMenuItem ( reg->actionCell, PRICE_STR);
|
||||
xaccAddComboCellMenuItem ( reg->actionCell, INT_STR);
|
||||
xaccAddComboCellMenuItem ( reg->actionCell, DIV_STR);
|
||||
xaccAddComboCellMenuItem ( reg->actionCell, LTCG_STR);
|
||||
xaccAddComboCellMenuItem ( reg->actionCell, STCG_STR);
|
||||
xaccAddComboCellMenuItem ( reg->actionCell, DIST_STR);
|
||||
xaccAddComboCellMenuItem ( reg->actionCell, SPLIT_STR);
|
||||
xaccAddComboCellMenuItem ( reg->actionCell, DEPOSIT_STR);
|
||||
xaccAddComboCellMenuItem ( reg->actionCell, WITHDRAW_STR);
|
||||
|
||||
/* -------------------------------- */
|
||||
table = xaccMallocTable (0, 0);
|
||||
table -> header = header;
|
||||
|
@ -7,6 +7,7 @@
|
||||
#define __XACC_REGISTER_H__
|
||||
|
||||
#include "basiccell.h"
|
||||
#include "combocell.h"
|
||||
#include "datecell.h"
|
||||
#include "quickfillcell.h"
|
||||
#include "pricecell.h"
|
||||
@ -20,8 +21,8 @@ typedef struct _BasicRegister {
|
||||
CellBlock * header;
|
||||
BasicCell * dateCell;
|
||||
BasicCell * numCell;
|
||||
BasicCell * actionCell;
|
||||
BasicCell * xferCell;
|
||||
ComboCell * actionCell;
|
||||
ComboCell * xfrmCell;
|
||||
QuickFillCell * descCell;
|
||||
BasicCell * memoCell;
|
||||
BasicCell * recnCell;
|
||||
|
Loading…
Reference in New Issue
Block a user