Move recn cell to split line in journal mode.

Fix some recn cell behavior.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3220 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas
2000-12-01 09:00:28 +00:00
parent 335e018b60
commit 59e5d721af
4 changed files with 57 additions and 14 deletions

View File

@@ -761,6 +761,7 @@ LedgerMoveCursor (Table *table, VirtualLocation *p_new_virt_loc)
Split *new_split;
CursorClass new_class;
CursorClass old_class;
gboolean exact_traversal;
gboolean do_refresh;
gboolean saved;
@@ -773,6 +774,8 @@ LedgerMoveCursor (Table *table, VirtualLocation *p_new_virt_loc)
old_trans_split = xaccSRGetCurrentTransSplit (reg, &old_trans_split_loc);
old_class = xaccSplitRegisterGetCurrentCursorClass (reg);
exact_traversal = info->exact_traversal;
if (info->traverse_to_new)
{
if (old_class == CURSOR_CLASS_SPLIT)
@@ -854,8 +857,7 @@ LedgerMoveCursor (Table *table, VirtualLocation *p_new_virt_loc)
new_class = info->cursor_hint_cursor_class;
}
gnc_table_find_close_valid_cell (table, &new_virt_loc,
info->exact_traversal);
gnc_table_find_close_valid_cell (table, &new_virt_loc, exact_traversal);
*p_new_virt_loc = new_virt_loc;
@@ -891,7 +893,7 @@ LedgerMoveCursor (Table *table, VirtualLocation *p_new_virt_loc)
xaccSRSetTransVisible (reg, vc_loc, TRUE,
reg->style == REG_STYLE_JOURNAL);
gnc_table_find_close_valid_cell (table, p_new_virt_loc, FALSE);
gnc_table_find_close_valid_cell (table, p_new_virt_loc, exact_traversal);
do_refresh = TRUE;
}

View File

@@ -36,9 +36,10 @@
#include <time.h>
#include "basiccell.h"
#include "recncell.h"
#include "gnc-engine-util.h"
#include "gnc-ui.h"
#include "messages.h"
#include "recncell.h"
/* hack alert -- I am uncomfortable with including engine
* stuff here; all code in this directory should really be
@@ -50,11 +51,14 @@
static RecnCellStringGetter string_getter = NULL;
/* This static indicates the debugging module that this .o belongs to. */
static short module = MOD_REGISTER;
/* ================================================ */
static const char *
RecnCellGetString(char reconciled_flag)
RecnCellGetString (char reconciled_flag)
{
static char str[2] = { 0, 0 };
@@ -117,6 +121,41 @@ xaccMallocRecnCell (void)
/* ================================================ */
/* assumes we are given the untranslated form */
static void
RecnSetValue (BasicCell *_cell, const char *value)
{
RecnCell *cell = (RecnCell *) _cell;
char flag;
if (!value || *value == '\0')
{
cell->reconciled_flag = NREC;
g_free (_cell->value);
_cell->value = g_strdup ("");
return;
}
switch (*value)
{
case NREC:
case CREC:
case YREC:
case FREC:
flag = *value;
break;
default:
PWARN ("unexpected recn flag");
flag = NREC;
break;
}
xaccRecnCellSetFlag (cell, flag);
}
/* ================================================ */
void
xaccInitRecnCell (RecnCell *cell)
{
@@ -125,6 +164,7 @@ xaccInitRecnCell (RecnCell *cell)
xaccRecnCellSetFlag(cell, NREC);
cell->cell.enter_cell = RecnEnter;
cell->cell.set_value = RecnSetValue;
}
/* ================================================ */
@@ -146,7 +186,8 @@ xaccRecnCellSetFlag (RecnCell *cell, char reconciled_flag)
string = RecnCellGetString(reconciled_flag);
xaccSetBasicCellValue(&cell->cell, string);
g_free (cell->cell.value);
cell->cell.value = g_strdup (string);
}
/* ================================================ */

View File

@@ -50,11 +50,11 @@ typedef struct _RecnCell
} RecnCell;
RecnCell * xaccMallocRecnCell (void);
void xaccInitRecnCell (RecnCell *);
void xaccDestroyRecnCell (RecnCell *);
void xaccInitRecnCell (RecnCell *cell);
void xaccDestroyRecnCell (RecnCell *cell);
void xaccRecnCellSetFlag (RecnCell *, char reconciled_flag);
char xaccRecnCellGetFlag (RecnCell *);
void xaccRecnCellSetFlag (RecnCell *cell, char reconciled_flag);
char xaccRecnCellGetFlag (RecnCell *cell);
void xaccRecnCellSetStringGetter (RecnCellStringGetter getter);

View File

@@ -447,7 +447,6 @@ configLayout (SplitRegister *reg)
set_cell (reg, curs, DATE_CELL, 0, 0);
set_cell (reg, curs, NUM_CELL, 0, 1);
set_cell (reg, curs, DESC_CELL, 0, 2);
set_cell (reg, curs, RECN_CELL, 0, 4);
set_cell (reg, curs, TDEBT_CELL, 0, 5);
set_cell (reg, curs, TCRED_CELL, 0, 6);
set_cell (reg, curs, TBALN_CELL, 0, 7);
@@ -461,6 +460,7 @@ configLayout (SplitRegister *reg)
set_cell (reg, curs, ACTN_CELL, 0, 1);
set_cell (reg, curs, MEMO_CELL, 0, 2);
set_cell (reg, curs, XFRM_CELL, 0, 3);
set_cell (reg, curs, RECN_CELL, 0, 4);
set_cell (reg, curs, DEBT_CELL, 0, 5);
set_cell (reg, curs, CRED_CELL, 0, 6);
@@ -493,7 +493,6 @@ configLayout (SplitRegister *reg)
set_cell (reg, curs, NUM_CELL, 0, 1);
set_cell (reg, curs, DESC_CELL, 0, 2);
set_cell (reg, curs, XTO_CELL, 0, 3);
set_cell (reg, curs, RECN_CELL, 0, 5);
set_cell (reg, curs, TDEBT_CELL, 0, 6);
set_cell (reg, curs, TCRED_CELL, 0, 7);
@@ -506,6 +505,7 @@ configLayout (SplitRegister *reg)
set_cell (reg, curs, ACTN_CELL, 0, 1);
set_cell (reg, curs, MEMO_CELL, 0, 2);
set_cell (reg, curs, XFRM_CELL, 0, 4);
set_cell (reg, curs, RECN_CELL, 0, 5);
set_cell (reg, curs, DEBT_CELL, 0, 6);
set_cell (reg, curs, CRED_CELL, 0, 7);
@@ -539,7 +539,6 @@ configLayout (SplitRegister *reg)
set_cell (reg, curs, DATE_CELL, 0, 0);
set_cell (reg, curs, NUM_CELL, 0, 1);
set_cell (reg, curs, DESC_CELL, 0, 2);
set_cell (reg, curs, RECN_CELL, 0, 4);
set_cell (reg, curs, TSHRS_CELL, 0, 5);
set_cell (reg, curs, TDEBT_CELL, 0, 7);
set_cell (reg, curs, TCRED_CELL, 0, 8);
@@ -555,6 +554,7 @@ configLayout (SplitRegister *reg)
set_cell (reg, curs, ACTN_CELL, 0, 1);
set_cell (reg, curs, MEMO_CELL, 0, 2);
set_cell (reg, curs, XFRM_CELL, 0, 3);
set_cell (reg, curs, RECN_CELL, 0, 4);
set_cell (reg, curs, SHRS_CELL, 0, 5);
set_cell (reg, curs, PRIC_CELL, 0, 6);
set_cell (reg, curs, DEBT_CELL, 0, 7);
@@ -589,7 +589,6 @@ configLayout (SplitRegister *reg)
set_cell (reg, curs, NUM_CELL, 0, 1);
set_cell (reg, curs, DESC_CELL, 0, 2);
set_cell (reg, curs, XTO_CELL, 0, 3);
set_cell (reg, curs, RECN_CELL, 0, 5);
set_cell (reg, curs, TSHRS_CELL, 0, 6);
set_cell (reg, curs, TDEBT_CELL, 0, 8);
set_cell (reg, curs, TCRED_CELL, 0, 9);
@@ -603,6 +602,7 @@ configLayout (SplitRegister *reg)
set_cell (reg, curs, ACTN_CELL, 0, 1);
set_cell (reg, curs, MEMO_CELL, 0, 2);
set_cell (reg, curs, XFRM_CELL, 0, 4);
set_cell (reg, curs, RECN_CELL, 0, 5);
set_cell (reg, curs, SHRS_CELL, 0, 6);
set_cell (reg, curs, PRIC_CELL, 0, 7);
set_cell (reg, curs, DEBT_CELL, 0, 8);