mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
misc bug fixes
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@491 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
b18939af63
commit
7bfa951302
28
src/Ledger.c
28
src/Ledger.c
@ -97,6 +97,7 @@ xaccSaveRegEntry (BasicRegister *reg)
|
|||||||
if (!split) return;
|
if (!split) return;
|
||||||
trans = (Transaction *) (split->parent);
|
trans = (Transaction *) (split->parent);
|
||||||
|
|
||||||
|
printf ("saving %s \n", trans->description);
|
||||||
/* copy the contents from the cursor to the split */
|
/* copy the contents from the cursor to the split */
|
||||||
xaccTransSetDate (trans, reg->dateCell->date.tm_mday,
|
xaccTransSetDate (trans, reg->dateCell->date.tm_mday,
|
||||||
reg->dateCell->date.tm_mon+1,
|
reg->dateCell->date.tm_mon+1,
|
||||||
@ -108,13 +109,15 @@ xaccSaveRegEntry (BasicRegister *reg)
|
|||||||
xaccSplitSetAction (split, reg->actionCell->cell.value);
|
xaccSplitSetAction (split, reg->actionCell->cell.value);
|
||||||
xaccSplitSetReconcile (split, reg->recnCell->value[0]);
|
xaccSplitSetReconcile (split, reg->recnCell->value[0]);
|
||||||
|
|
||||||
/* hack alert -- do transfers */
|
/* if the user changed thw value of the xfrm cell,
|
||||||
|
* then move the far end oof the split to the new location.
|
||||||
|
*/
|
||||||
xfr = GetPeerAccName (split);
|
xfr = GetPeerAccName (split);
|
||||||
if (strcmp (xfr, reg->xfrmCell->cell.value) &&
|
if (strcmp (xfr, reg->xfrmCell->cell.value) &&
|
||||||
strcmp (SPLIT_STR, reg->xfrmCell->cell.value)) {
|
strcmp (SPLIT_STR, reg->xfrmCell->cell.value)) {
|
||||||
Split *peer_split;
|
Split *peer_split;
|
||||||
|
|
||||||
|
printf ("xfr from %s to %x \n", xfr, reg->xfrmCell->cell.value);
|
||||||
peer_split = GetPeerSplit (split);
|
peer_split = GetPeerSplit (split);
|
||||||
if (peer_split) {
|
if (peer_split) {
|
||||||
acc = (Account *) (peer_split->acc);
|
acc = (Account *) (peer_split->acc);
|
||||||
@ -153,7 +156,7 @@ xaccLoadRegEntry (BasicRegister *reg, Split *split)
|
|||||||
trans->date.year);
|
trans->date.year);
|
||||||
|
|
||||||
xaccSetBasicCellValue (reg->numCell, trans->num);
|
xaccSetBasicCellValue (reg->numCell, trans->num);
|
||||||
xaccSetBasicCellValue (&(reg->actionCell->cell), split->action);
|
xaccSetComboCellValue (reg->actionCell, split->action);
|
||||||
xaccSetQuickFillCellValue (reg->descCell, trans->description);
|
xaccSetQuickFillCellValue (reg->descCell, trans->description);
|
||||||
xaccSetBasicCellValue (reg->memoCell, split->memo);
|
xaccSetBasicCellValue (reg->memoCell, split->memo);
|
||||||
|
|
||||||
@ -162,9 +165,8 @@ xaccLoadRegEntry (BasicRegister *reg, Split *split)
|
|||||||
xaccSetBasicCellValue (reg->recnCell, buff);
|
xaccSetBasicCellValue (reg->recnCell, buff);
|
||||||
|
|
||||||
/* the transfer account */
|
/* the transfer account */
|
||||||
/* hack alert -- this is incorrect for splits in general */
|
|
||||||
accname = GetPeerAccName (split);
|
accname = GetPeerAccName (split);
|
||||||
xaccSetBasicCellValue (&(reg->xfrmCell->cell), accname);
|
xaccSetComboCellValue (reg->xfrmCell, accname);
|
||||||
|
|
||||||
xaccSetDebCredCellValue (reg->debitCell,
|
xaccSetDebCredCellValue (reg->debitCell,
|
||||||
reg->creditCell, split->damount);
|
reg->creditCell, split->damount);
|
||||||
@ -217,14 +219,14 @@ xaccLoadRegister (BasicRegister *reg, Split **slist)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ======================================================== */
|
/* ======================================================== */
|
||||||
|
/* walk account tree recursively, pulling out all the names */
|
||||||
|
|
||||||
void xaccLoadXferCell (ComboCell *cell, AccountGroup *grp)
|
static void
|
||||||
|
LoadXferCell (ComboCell *cell, AccountGroup *grp)
|
||||||
{
|
{
|
||||||
Account * acc;
|
Account * acc;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
xaccAddComboCellMenuItem (cell, SPLIT_STR);
|
|
||||||
|
|
||||||
if (!grp) return;
|
if (!grp) return;
|
||||||
|
|
||||||
/* build the xfer menu out of account names */
|
/* build the xfer menu out of account names */
|
||||||
@ -233,10 +235,18 @@ void xaccLoadXferCell (ComboCell *cell, AccountGroup *grp)
|
|||||||
acc = getAccount (grp, n);
|
acc = getAccount (grp, n);
|
||||||
while (acc) {
|
while (acc) {
|
||||||
xaccAddComboCellMenuItem (cell, acc->accountName);
|
xaccAddComboCellMenuItem (cell, acc->accountName);
|
||||||
xaccLoadXferCell (cell, acc->children);
|
LoadXferCell (cell, acc->children);
|
||||||
n++;
|
n++;
|
||||||
acc = getAccount (grp, n);
|
acc = getAccount (grp, n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ======================================================== */
|
||||||
|
|
||||||
|
void xaccLoadXferCell (ComboCell *cell, AccountGroup *grp)
|
||||||
|
{
|
||||||
|
xaccAddComboCellMenuItem (cell, SPLIT_STR);
|
||||||
|
LoadXferCell (cell, grp);
|
||||||
|
}
|
||||||
|
|
||||||
/* ======================= end of file =================== */
|
/* ======================= end of file =================== */
|
||||||
|
@ -87,6 +87,34 @@ xaccAddComboCellMenuItem (ComboCell *cell, char * menustr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* =============================================== */
|
||||||
|
/* not only do we set the cell contents, but we
|
||||||
|
* make the gui reflect the right value too.
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
xaccSetComboCellValue (ComboCell *cell, const char * str)
|
||||||
|
{
|
||||||
|
PopBox * box;
|
||||||
|
|
||||||
|
xaccSetBasicCellValue (&(cell->cell), str);
|
||||||
|
box = (PopBox *) (cell->cell.gui_private);
|
||||||
|
|
||||||
|
if (str) {
|
||||||
|
if (0x0 != str[0]) {
|
||||||
|
XmString choosen;
|
||||||
|
/* convert String to XmString ... arghhh */
|
||||||
|
choosen = XmCvtCTToXmString ((char *) str);
|
||||||
|
XmComboBoxSelectItem (box->combobox, choosen, False);
|
||||||
|
XmStringFree (choosen);
|
||||||
|
} else {
|
||||||
|
XmComboBoxClearItemSelection (box->combobox);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
XmComboBoxClearItemSelection (box->combobox);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* =============================================== */
|
/* =============================================== */
|
||||||
|
|
||||||
static
|
static
|
||||||
@ -323,6 +351,7 @@ static void selectCB (Widget w, XtPointer cd, XtPointer cb )
|
|||||||
|
|
||||||
XbaeMatrixSetCell (box->parent, box->currow, box->curcol, choice);
|
XbaeMatrixSetCell (box->parent, box->currow, box->curcol, choice);
|
||||||
xaccSetBasicCellValue (&(cell->cell), choice);
|
xaccSetBasicCellValue (&(cell->cell), choice);
|
||||||
|
printf ("celectcb choice %s \n", choice);
|
||||||
XtFree (choice);
|
XtFree (choice);
|
||||||
|
|
||||||
/* a diffeent way of getting the user's selection ... */
|
/* a diffeent way of getting the user's selection ... */
|
||||||
|
@ -22,6 +22,7 @@ typedef struct _ComboCell {
|
|||||||
|
|
||||||
ComboCell * xaccMallocComboCell (void);
|
ComboCell * xaccMallocComboCell (void);
|
||||||
void xaccInitComboCell (ComboCell *);
|
void xaccInitComboCell (ComboCell *);
|
||||||
|
void xaccSetComboCellValue (ComboCell *, const char *);
|
||||||
|
|
||||||
void xaccAddComboCellMenuItem (ComboCell *, char * menustr);
|
void xaccAddComboCellMenuItem (ComboCell *, char * menustr);
|
||||||
|
|
||||||
|
@ -330,6 +330,11 @@ void xaccMoveCursor (Table *table, int virt_row, int virt_col)
|
|||||||
int iphys,jphys;
|
int iphys,jphys;
|
||||||
BasicCell *cell;
|
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 */
|
/* call the callback, allowing the app to commit any changes */
|
||||||
if (table->move_cursor) {
|
if (table->move_cursor) {
|
||||||
(table->move_cursor) (table, table->client_data);
|
(table->move_cursor) (table, table->client_data);
|
||||||
@ -462,6 +467,11 @@ verifyCursorPosition (Table *table, int phys_row, int phys_col)
|
|||||||
if ((virt_row != table->current_cursor_row) ||
|
if ((virt_row != table->current_cursor_row) ||
|
||||||
(virt_col != table->current_cursor_col)) {
|
(virt_col != table->current_cursor_col)) {
|
||||||
|
|
||||||
|
printf ("verify cursor bad cur %d %d new %d %d \n",
|
||||||
|
table->current_cursor_row,
|
||||||
|
table->current_cursor_col,
|
||||||
|
virt_row, virt_col);
|
||||||
|
|
||||||
/* before leaving, the current virtual position,
|
/* before leaving, the current virtual position,
|
||||||
* commit any aedits that have been accumulated
|
* commit any aedits that have been accumulated
|
||||||
* in the cursor */
|
* in the cursor */
|
||||||
@ -664,6 +674,11 @@ enterCB (Widget mw, XtPointer cd, XtPointer cb)
|
|||||||
cbs->doit = False;
|
cbs->doit = False;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* record this position as the cell that will be
|
||||||
|
* traversed out of if a traverse even happens */
|
||||||
|
table->prev_phys_traverse_row = row;
|
||||||
|
table->prev_phys_traverse_col = col;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ==================================================== */
|
/* ==================================================== */
|
||||||
@ -828,7 +843,7 @@ traverseCB (Widget mw, XtPointer cd, XtPointer cb)
|
|||||||
row = cbs->row;
|
row = cbs->row;
|
||||||
col = cbs->column;
|
col = cbs->column;
|
||||||
|
|
||||||
verifyCursorPosition (table, row, col);
|
printf ("traverse from %d %d %s %d\n", row, col, cbs->param, cbs->qparam);
|
||||||
|
|
||||||
/* If the quark is zero, then it is likely that we are
|
/* If the quark is zero, then it is likely that we are
|
||||||
* here because we traversed out of a cell that had a
|
* here because we traversed out of a cell that had a
|
||||||
@ -851,10 +866,13 @@ traverseCB (Widget mw, XtPointer cd, XtPointer cb)
|
|||||||
cbs->qparam = QRight;
|
cbs->qparam = QRight;
|
||||||
row = table->prev_phys_traverse_row;
|
row = table->prev_phys_traverse_row;
|
||||||
col = table->prev_phys_traverse_col;
|
col = table->prev_phys_traverse_col;
|
||||||
|
printf ("null quark emulate rows %d %d \n", row, col);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
verifyCursorPosition (table, row, col);
|
||||||
|
|
||||||
/* compute the cell location */
|
/* compute the cell location */
|
||||||
rel_row = row - table->num_header_rows;
|
rel_row = row - table->num_header_rows;
|
||||||
rel_col = col;
|
rel_col = col;
|
||||||
@ -886,6 +904,11 @@ traverseCB (Widget mw, XtPointer cd, XtPointer cb)
|
|||||||
|
|
||||||
table->prev_phys_traverse_row = cbs->next_row;
|
table->prev_phys_traverse_row = cbs->next_row;
|
||||||
table->prev_phys_traverse_col = cbs->next_column;
|
table->prev_phys_traverse_col = cbs->next_column;
|
||||||
|
|
||||||
|
printf ("traverse all said & done %d %d \n",
|
||||||
|
table->prev_phys_traverse_row,
|
||||||
|
table->prev_phys_traverse_col);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user