mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
misc fixes
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@508 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
35cb0f710e
commit
52a912652c
@ -121,7 +121,7 @@ adjBWindow( Widget parent, Account *acc )
|
||||
NULL );
|
||||
|
||||
todaysDate(&date);
|
||||
sprintf(buf,"%2d/%2d/%4d", date.month, date.day, date.year);
|
||||
sprtDate (buf, date.day, date.month, date.year);
|
||||
|
||||
adjBData->date =
|
||||
XtVaCreateManagedWidget( "text",
|
||||
|
28
src/Ledger.c
28
src/Ledger.c
@ -117,7 +117,7 @@ printf ("saving %s \n", trans->description);
|
||||
strcmp (SPLIT_STR, reg->xfrmCell->cell.value)) {
|
||||
Split *peer_split;
|
||||
|
||||
printf ("xfr from %s to %x \n", xfr, reg->xfrmCell->cell.value);
|
||||
printf ("xfr from %s to %s \n", xfr, reg->xfrmCell->cell.value);
|
||||
peer_split = GetPeerSplit (split);
|
||||
if (peer_split) {
|
||||
acc = (Account *) (peer_split->acc);
|
||||
@ -151,6 +151,10 @@ xaccLoadRegEntry (BasicRegister *reg, Split *split)
|
||||
if (!split) return;
|
||||
trans = (Transaction *) (split->parent);
|
||||
|
||||
printf ("load cell %s %2d/%2d/%4d \n", trans->description,
|
||||
trans->date.day, trans->date.month, trans->date.year);
|
||||
|
||||
|
||||
xaccSetDateCellValue (reg->dateCell, trans->date.day,
|
||||
trans->date.month,
|
||||
trans->date.year);
|
||||
@ -173,6 +177,7 @@ xaccLoadRegEntry (BasicRegister *reg, Split *split)
|
||||
|
||||
xaccSetAmountCellValue (reg->balanceCell, split->balance);
|
||||
|
||||
|
||||
reg->table->cursor->user_data = (void *) split;
|
||||
|
||||
/* copy cursor contents into the table */
|
||||
@ -189,31 +194,45 @@ xaccLoadRegister (BasicRegister *reg, Split **slist)
|
||||
Transaction *trans;
|
||||
char buff[BUFSIZE];
|
||||
Table *table;
|
||||
int save_cursor_row;
|
||||
|
||||
table = reg->table;
|
||||
|
||||
/* disable callback */
|
||||
/* disable move callback -- we con't want the cascade of
|
||||
* callbacks while we are fiddling with loading the register */
|
||||
table->move_cursor = NULL;
|
||||
|
||||
/* save the current cursor location; we want to restore
|
||||
* it after the reload. */
|
||||
save_cursor_row = table->current_cursor_row;
|
||||
xaccMoveCursorGUI (table, -1, -1);
|
||||
|
||||
/* set table size to number of items in list */
|
||||
i=0;
|
||||
while (slist[i]) i++;
|
||||
xaccSetTableSize (table, i, 1);
|
||||
|
||||
printf ("load reg of %d entries --------------------------- \n",i);
|
||||
/* populate the table */
|
||||
i=0;
|
||||
split = slist[0];
|
||||
while (split) {
|
||||
|
||||
xaccMoveCursor (table, i, 0);
|
||||
table->current_cursor_row = i;
|
||||
table->current_cursor_col = 0;
|
||||
xaccLoadRegEntry (reg, split);
|
||||
|
||||
i++;
|
||||
split = slist[i];
|
||||
}
|
||||
|
||||
/* restore the cursor to it original location */
|
||||
if (i <= save_cursor_row) save_cursor_row = i - 1;
|
||||
if (0 > save_cursor_row) save_cursor_row = 0;
|
||||
xaccMoveCursorGUI (table, save_cursor_row, 0);
|
||||
xaccRefreshTableGUI (table);
|
||||
|
||||
/* enable callback for cursor moves */
|
||||
/* enable callback for cursor user-driven moves */
|
||||
table->move_cursor = LedgerMoveCursor;
|
||||
table->client_data = (void *) reg;
|
||||
}
|
||||
@ -245,6 +264,7 @@ LoadXferCell (ComboCell *cell, AccountGroup *grp)
|
||||
|
||||
void xaccLoadXferCell (ComboCell *cell, AccountGroup *grp)
|
||||
{
|
||||
xaccAddComboCellMenuItem (cell, "");
|
||||
xaccAddComboCellMenuItem (cell, SPLIT_STR);
|
||||
LoadXferCell (cell, grp);
|
||||
}
|
||||
|
@ -45,6 +45,15 @@ char days[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };
|
||||
|
||||
static int been_here = 0;
|
||||
|
||||
/********************************************************************\
|
||||
\********************************************************************/
|
||||
|
||||
void
|
||||
sprtDate (char * buff, int day, int month, int year)
|
||||
{
|
||||
sprintf (buff, "%2d/%2d/%4d", month, day, year);
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
* adjustDay *
|
||||
* adds adj to the current day of the month... the resulting day *
|
||||
|
@ -356,21 +356,27 @@ static void selectCB (Widget w, XtPointer cd, XtPointer cb )
|
||||
cell = (ComboCell *) cd;
|
||||
box = (PopBox *) (cell->cell.gui_private);
|
||||
|
||||
if ((0 > box->currow) || (0 > box->curcol)) {
|
||||
/*
|
||||
printf ("Internal Error: ComboBox: incorrect cell location \n");
|
||||
return;
|
||||
*/
|
||||
}
|
||||
/* check for a valid mapping of the widget.
|
||||
* Note that if the combo box value is set to
|
||||
* a string that is not in the combo box menu
|
||||
* (for example, the empty string ""), then the
|
||||
* combobox will issue an XmCR_UNSELECT event.
|
||||
* This typically happens while loading the array.
|
||||
* We want to ignore these. */
|
||||
if ((0 > box->currow) || (0 > box->curcol)) return;
|
||||
|
||||
/* check the reason, because the unslect callback
|
||||
* doesn't even have a value field! */
|
||||
if ( (XmCR_SINGLE_SELECT == selection->reason) ||
|
||||
(XmCR_SINGLE_SELECT == selection->reason) ) {
|
||||
(XmCR_BROWSE_SELECT == selection->reason) ) {
|
||||
choice = XmCvtXmStringToCT (selection->value);
|
||||
} else
|
||||
if (XmCR_UNSELECT == selection->reason) {
|
||||
choice = XtNewString ("");
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
if (!choice) choice = XtNewString ("");
|
||||
|
||||
printf ("combo selectcb choice %s at %d %d \n", choice, box->currow, box->curcol);
|
||||
XbaeMatrixSetCell (box->parent, box->currow, box->curcol, choice);
|
||||
SET (&(cell->cell), choice);
|
||||
XtFree (choice);
|
||||
|
@ -64,7 +64,7 @@ void xaccInitBasicRegister (BasicRegister *reg)
|
||||
header = xaccMallocCellBlock (1, MAX_COLS);
|
||||
reg->header = header;
|
||||
|
||||
cell = (BasicCell *) xaccMallocDateCell();
|
||||
cell = xaccMallocTextCell();
|
||||
cell->width = 11;
|
||||
xaccAddCell (header, cell, 0, DATE_CELL_C);
|
||||
xaccSetBasicCellValue (cell, DATE_STR);
|
||||
@ -84,22 +84,22 @@ void xaccInitBasicRegister (BasicRegister *reg)
|
||||
xaccAddCell (header, cell, 0, DESC_CELL_C);
|
||||
xaccSetBasicCellValue (cell, DESC_STR);
|
||||
|
||||
cell = xaccMallocRecnCell();
|
||||
cell = xaccMallocTextCell();
|
||||
cell->width = 1;
|
||||
xaccAddCell (header, cell, 0, RECN_CELL_C);
|
||||
xaccSetBasicCellValue (cell, "R");
|
||||
|
||||
cell = (BasicCell *) xaccMallocPriceCell();
|
||||
cell = xaccMallocTextCell();
|
||||
cell->width = 9;
|
||||
xaccAddCell (header, cell, 0, CRED_CELL_C);
|
||||
xaccSetBasicCellValue (cell, CREDIT_STR);
|
||||
|
||||
cell = (BasicCell *) xaccMallocPriceCell();
|
||||
cell = xaccMallocTextCell();
|
||||
cell->width = 9;
|
||||
xaccAddCell (header, cell, 0, DEBT_CELL_C);
|
||||
xaccSetBasicCellValue (cell, DEBIT_STR);
|
||||
|
||||
cell = (BasicCell *) xaccMallocPriceCell();
|
||||
cell = xaccMallocTextCell();
|
||||
cell->width = 9;
|
||||
xaccAddCell (header, cell, 0, BALN_CELL_C);
|
||||
xaccSetBasicCellValue (cell, BALN_STR);
|
||||
|
@ -330,11 +330,6 @@ void xaccMoveCursor (Table *table, int virt_row, int virt_col)
|
||||
int iphys,jphys;
|
||||
BasicCell *cell;
|
||||
|
||||
printf ("move cursor from %d %d to %d %d \n",
|
||||
table->current_cursor_row,
|
||||
table->current_cursor_col,
|
||||
virt_row, virt_col);
|
||||
|
||||
/* call the callback, allowing the app to commit any changes */
|
||||
if (table->move_cursor) {
|
||||
(table->move_cursor) (table, table->client_data);
|
||||
@ -383,7 +378,21 @@ void xaccMoveCursorGUI (Table *table, int virt_row, int virt_col)
|
||||
table->current_cursor_col = virt_col;
|
||||
table->cursor->user_data = NULL;
|
||||
|
||||
if ((0 > virt_row) || (0 > virt_col)) return;
|
||||
if ((0 > virt_row) || (0 > virt_col)) {
|
||||
/* if the location is invalid, then we should take this
|
||||
* as a command to unmap the cursor gui. So do it .. */
|
||||
for (i=0; i<table->tile_height; i++) {
|
||||
for (j=0; j<table->tile_width; j++) {
|
||||
cell = table->cursor->cells[i][j];
|
||||
if (cell) {
|
||||
if (cell->move) {
|
||||
(cell->move) (cell, -1, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (virt_row >= table->num_rows) return;
|
||||
if (virt_col >= table->num_cols) return;
|
||||
|
||||
@ -1016,6 +1025,11 @@ xaccCreateTable (Table *table, Widget parent, char * name)
|
||||
void
|
||||
xaccRefreshTableGUI (Table * table)
|
||||
{
|
||||
{int i,j;
|
||||
printf (" refresh %d %d \n", table->num_phys_rows,table->num_phys_cols);
|
||||
for (i=0; i<table->num_phys_rows; i++) {
|
||||
printf ("cell %d %s \n", i, table->entries[i][3]);
|
||||
}}
|
||||
XtVaSetValues (table->table_widget, XmNrows, table->num_phys_rows,
|
||||
XmNcolumns, table->num_phys_cols,
|
||||
XmNcells, table->entries,
|
||||
|
Loading…
Reference in New Issue
Block a user