Rework the register styles. Use a general-ledger approach for displaying

expanded transactions.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3153 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas 2000-11-16 22:40:46 +00:00
parent 598fbe8743
commit a639f7e1f0
15 changed files with 543 additions and 493 deletions

View File

@ -145,7 +145,7 @@ xaccLedgerDisplaySimple (Account *account)
return NULL; return NULL;
} }
return xaccLedgerDisplayGeneral (account, NULL, reg_type, REG_SINGLE_LINE); return xaccLedgerDisplayGeneral (account, NULL, reg_type, REG_STYLE_LEDGER);
} }
static GList * static GList *
@ -236,7 +236,7 @@ xaccLedgerDisplayAccGroup (Account *account)
} }
ledger_display = xaccLedgerDisplayGeneral (account, accounts, ledger_type, ledger_display = xaccLedgerDisplayGeneral (account, accounts, ledger_type,
REG_SINGLE_LINE); REG_STYLE_LEDGER);
g_list_free (accounts); g_list_free (accounts);
@ -406,7 +406,7 @@ xaccLedgerDisplayGeneral (Account *lead_account, GList *accounts,
/* xaccMallocSplitRegister will malloc & initialize the register, /* xaccMallocSplitRegister will malloc & initialize the register,
* but will not do the gui init */ * but will not do the gui init */
regData->ledger = xaccMallocSplitRegister (type, style, regData->ledger = xaccMallocSplitRegister (type, style, FALSE,
xaccSRGetEntryHandler, xaccSRGetEntryHandler,
xaccSRGetFGColorHandler, xaccSRGetFGColorHandler,
xaccSRGetBGColorHandler, xaccSRGetBGColorHandler,

View File

@ -297,7 +297,7 @@ xaccSRGetParent(SplitRegister *reg)
if (info->get_parent == NULL) if (info->get_parent == NULL)
return NULL; return NULL;
return (info->get_parent)(info->user_data); return info->get_parent(info->user_data);
} }
void void
@ -307,7 +307,7 @@ xaccSRSetData(SplitRegister *reg, void *user_data,
{ {
SRInfo *info = xaccSRGetInfo(reg); SRInfo *info = xaccSRGetInfo(reg);
assert(reg != NULL); g_return_if_fail (reg != NULL);
info->user_data = user_data; info->user_data = user_data;
info->get_parent = get_parent; info->get_parent = get_parent;
@ -689,6 +689,26 @@ sr_set_cell_fractions (SplitRegister *reg, Split *split)
} }
} }
static CellBlock *
sr_get_lead_cursor (SplitRegister *reg)
{
switch (reg->style)
{
case REG_STYLE_LEDGER:
case REG_STYLE_AUTO_LEDGER:
return reg->use_double_line ?
reg->cursor_ledger_double : reg->cursor_ledger_single;
case REG_STYLE_JOURNAL:
return reg->use_double_line ?
reg->cursor_journal_double : reg->cursor_journal_single;
}
PWARN ("bad register style");
return NULL;
}
/* ======================================================== */ /* ======================================================== */
/* This callback gets called when the user clicks on the gui /* This callback gets called when the user clicks on the gui
* in such a way as to leave the current virtual cursor, and * in such a way as to leave the current virtual cursor, and
@ -723,6 +743,7 @@ LedgerMoveCursor (Table *table, VirtualLocation *p_new_virt_loc)
Split *new_trans_split; Split *new_trans_split;
Split *new_split; Split *new_split;
CursorClass new_class; CursorClass new_class;
gboolean do_refresh;
gboolean saved; gboolean saved;
PINFO ("start callback %d %d \n", PINFO ("start callback %d %d \n",
@ -754,6 +775,8 @@ LedgerMoveCursor (Table *table, VirtualLocation *p_new_virt_loc)
new_class = info->cursor_hint_cursor_class; new_class = info->cursor_hint_cursor_class;
} }
info->hint_set_by_traverse = FALSE;
/* commit the contents of the cursor into the database */ /* commit the contents of the cursor into the database */
saved = xaccSRSaveRegEntry (reg, old_trans != new_trans); saved = xaccSRSaveRegEntry (reg, old_trans != new_trans);
if ((pending_trans != NULL) && if ((pending_trans != NULL) &&
@ -813,28 +836,42 @@ LedgerMoveCursor (Table *table, VirtualLocation *p_new_virt_loc)
/* in the mult-line and dynamic modes, we need to hide the old /* in the mult-line and dynamic modes, we need to hide the old
* and show the new. */ * and show the new. */
if (((REG_SINGLE_DYNAMIC == reg->style) || if (((REG_STYLE_AUTO_LEDGER == reg->style) ||
(REG_DOUBLE_DYNAMIC == reg->style) || (REG_STYLE_JOURNAL == reg->style)) &&
(REG_MULTI_LINE == reg->style)) &&
(old_trans_split != new_trans_split)) (old_trans_split != new_trans_split))
{ {
xaccSRSetTransVisible (reg, old_trans_split_loc, FALSE, VirtualCellLocation vc_loc;
REG_MULTI_LINE == reg->style);
xaccSRSetTransVisible (reg, new_virt_loc.vcell_loc, TRUE, vc_loc = old_trans_split_loc;
REG_MULTI_LINE == reg->style); gnc_table_set_virt_cell_cursor (table, vc_loc,
sr_get_lead_cursor (reg));
xaccSRSetTransVisible (reg, vc_loc, FALSE,
reg->style == REG_STYLE_JOURNAL);
gnc_table_refresh_gui (reg->table); xaccSRGetTransSplit (reg, new_virt_loc.vcell_loc, &vc_loc);
gnc_table_set_virt_cell_cursor (table, vc_loc,
reg->use_double_line ?
reg->cursor_journal_double :
reg->cursor_journal_single);
xaccSRSetTransVisible (reg, vc_loc, TRUE,
reg->style == REG_STYLE_JOURNAL);
gnc_table_find_close_valid_cell (table, p_new_virt_loc, FALSE);
do_refresh = TRUE;
} }
else
do_refresh = FALSE;
info->cursor_hint_trans = new_trans; info->cursor_hint_trans = new_trans;
info->cursor_hint_split = new_split; info->cursor_hint_split = new_split;
info->cursor_hint_trans_split = new_trans_split; info->cursor_hint_trans_split = new_trans_split;
info->cursor_hint_cursor_class = new_class; info->cursor_hint_cursor_class = new_class;
info->hint_set_by_traverse = FALSE;
sr_set_cell_fractions (reg, new_split); sr_set_cell_fractions (reg, new_split);
if (do_refresh)
gnc_table_refresh_gui (reg->table);
} }
/* This function determines if auto-completion is appropriate and, /* This function determines if auto-completion is appropriate and,
@ -1380,7 +1417,6 @@ xaccSRGetSplitVirtLoc (SplitRegister *reg, Split *split,
Table *table; Table *table;
int v_row; int v_row;
int v_col; int v_col;
Split *s;
if ((reg == NULL) || (split == NULL)) if ((reg == NULL) || (split == NULL))
return FALSE; return FALSE;
@ -1394,8 +1430,17 @@ xaccSRGetSplitVirtLoc (SplitRegister *reg, Split *split,
for (v_col = 0; v_col < table->num_virt_cols; v_col++) for (v_col = 0; v_col < table->num_virt_cols; v_col++)
{ {
VirtualCellLocation vc_loc = { v_row, v_col }; VirtualCellLocation vc_loc = { v_row, v_col };
VirtualCell *vcell;
Split *s;
s = sr_get_split (reg, vc_loc); vcell = gnc_table_get_virtual_cell (table, vc_loc);
if (vcell == NULL)
continue;
if (!vcell->visible)
continue;
s = xaccSplitLookup (vcell->vcell_data);
if (s == split) if (s == split)
{ {
@ -3197,8 +3242,8 @@ xaccSRGetBGColorHandler (VirtualLocation virt_loc, gpointer user_data)
case CURSOR_TYPE_HEADER: case CURSOR_TYPE_HEADER:
return reg_colors.header_bg_color; return reg_colors.header_bg_color;
case CURSOR_TYPE_TRANS: case CURSOR_TYPE_SINGLE_JOURNAL:
case CURSOR_TYPE_SINGLE: case CURSOR_TYPE_SINGLE_LEDGER:
if (is_current) if (is_current)
return vcell->start_primary_color ? return vcell->start_primary_color ?
reg_colors.primary_active_bg_color : reg_colors.primary_active_bg_color :
@ -3207,7 +3252,8 @@ xaccSRGetBGColorHandler (VirtualLocation virt_loc, gpointer user_data)
return vcell->start_primary_color ? return vcell->start_primary_color ?
reg_colors.primary_bg_color : reg_colors.secondary_bg_color; reg_colors.primary_bg_color : reg_colors.secondary_bg_color;
case CURSOR_TYPE_DOUBLE: case CURSOR_TYPE_DOUBLE_LEDGER:
case CURSOR_TYPE_DOUBLE_JOURNAL:
if (is_current) if (is_current)
{ {
if (reg_colors.double_alternate_virt) if (reg_colors.double_alternate_virt)
@ -3250,6 +3296,7 @@ sr_add_transaction (SplitRegister *reg,
CellBlock *lead_cursor, CellBlock *lead_cursor,
gboolean visible_splits, gboolean visible_splits,
gboolean start_primary_color, gboolean start_primary_color,
gboolean add_blank,
Split *find_split, Split *find_split,
CursorClass find_class, CursorClass find_class,
int *new_split_row, int *new_split_row,
@ -3262,13 +3309,13 @@ sr_add_transaction (SplitRegister *reg,
CellBlock *lead_cursor, CellBlock *lead_cursor,
gboolean visible_splits, gboolean visible_splits,
gboolean start_primary_color, gboolean start_primary_color,
gboolean add_blank,
Split *find_split, Split *find_split,
CursorClass find_class, CursorClass find_class,
int *new_split_row, int *new_split_row,
VirtualCellLocation *vcell_loc) VirtualCellLocation *vcell_loc)
{ {
Split *secondary; GList *node;
int i = 0;
if (split == find_split) if (split == find_split)
*new_split_row = vcell_loc->virt_row; *new_split_row = vcell_loc->virt_row;
@ -3277,25 +3324,24 @@ sr_add_transaction (SplitRegister *reg,
TRUE, start_primary_color, *vcell_loc); TRUE, start_primary_color, *vcell_loc);
vcell_loc->virt_row++; vcell_loc->virt_row++;
do for (node = xaccTransGetSplitList (trans); node; node = node->next)
{ {
secondary = xaccTransGetSplit (trans, i++); Split *secondary = node->data;
if (secondary == NULL)
break;
if (secondary != split) if (secondary == find_split && find_class == CURSOR_CLASS_SPLIT)
{ *new_split_row = vcell_loc->virt_row;
if (secondary == find_split && find_class == CURSOR_CLASS_SPLIT)
*new_split_row = vcell_loc->virt_row;
gnc_table_set_vcell (reg->table, reg->split_cursor, gnc_table_set_vcell (reg->table, reg->cursor_split,
xaccSplitGetGUID (secondary), xaccSplitGetGUID (secondary),
visible_splits, TRUE, *vcell_loc); visible_splits, TRUE, *vcell_loc);
vcell_loc->virt_row++; vcell_loc->virt_row++;
} }
} while (TRUE);
gnc_table_set_vcell (reg->table, reg->split_cursor, if (!add_blank)
return;
/* Add blank transaction split */
gnc_table_set_vcell (reg->table, reg->cursor_split,
xaccSplitGetGUID (NULL), FALSE, TRUE, *vcell_loc); xaccSplitGetGUID (NULL), FALSE, TRUE, *vcell_loc);
vcell_loc->virt_row++; vcell_loc->virt_row++;
} }
@ -3357,17 +3403,10 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist,
table = reg->table; table = reg->table;
multi_line = (REG_MULTI_LINE == reg->style); multi_line = (reg->style == REG_STYLE_JOURNAL);
dynamic = ((REG_SINGLE_DYNAMIC == reg->style) || dynamic = (reg->style == REG_STYLE_AUTO_LEDGER);
(REG_DOUBLE_DYNAMIC == reg->style));
if ((REG_SINGLE_LINE == reg->style) || lead_cursor = sr_get_lead_cursor (reg);
(REG_SINGLE_DYNAMIC == reg->style))
lead_cursor = reg->single_cursor;
else if (REG_MULTI_LINE == reg->style)
lead_cursor = reg->trans_cursor;
else
lead_cursor = reg->double_cursor;
/* figure out where we are going to. */ /* figure out where we are going to. */
find_trans = info->cursor_hint_trans; find_trans = info->cursor_hint_trans;
@ -3407,7 +3446,7 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist,
/* make sure that the header is loaded */ /* make sure that the header is loaded */
vcell_loc.virt_row = 0; vcell_loc.virt_row = 0;
vcell_loc.virt_col = 0; vcell_loc.virt_col = 0;
gnc_table_set_vcell (table, reg->header, NULL, TRUE, TRUE, vcell_loc); gnc_table_set_vcell (table, reg->cursor_header, NULL, TRUE, TRUE, vcell_loc);
vcell_loc.virt_row++; vcell_loc.virt_row++;
/* get the current time and reset the dividing row */ /* get the current time and reset the dividing row */
@ -3476,7 +3515,7 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist,
new_trans_split_row = vcell_loc.virt_row; new_trans_split_row = vcell_loc.virt_row;
sr_add_transaction (reg, trans, split, lead_cursor, multi_line, sr_add_transaction (reg, trans, split, lead_cursor, multi_line,
start_primary_color, find_split, find_class, start_primary_color, TRUE, find_split, find_class,
&new_split_row, &vcell_loc); &new_split_row, &vcell_loc);
if (!multi_line) if (!multi_line)
@ -3496,8 +3535,8 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist,
new_trans_split_row = vcell_loc.virt_row; new_trans_split_row = vcell_loc.virt_row;
sr_add_transaction (reg, trans, split, lead_cursor, multi_line, sr_add_transaction (reg, trans, split, lead_cursor, multi_line,
start_primary_color, find_split, find_class, start_primary_color, info->blank_split_edited,
&new_split_row, &vcell_loc); find_split, find_class, &new_split_row, &vcell_loc);
/* resize the table to the sizes we just counted above */ /* resize the table to the sizes we just counted above */
/* num_virt_cols is always one. */ /* num_virt_cols is always one. */
@ -3520,7 +3559,11 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist,
trans_split = xaccSRGetTransSplit (reg, save_loc.vcell_loc, trans_split = xaccSRGetTransSplit (reg, save_loc.vcell_loc,
&trans_split_loc.vcell_loc); &trans_split_loc.vcell_loc);
if (dynamic || multi_line) if (dynamic || multi_line)
{
gnc_table_set_virt_cell_cursor (table, trans_split_loc.vcell_loc,
reg->cursor_journal_single);
xaccSRSetTransVisible (reg, trans_split_loc.vcell_loc, TRUE, multi_line); xaccSRSetTransVisible (reg, trans_split_loc.vcell_loc, TRUE, multi_line);
}
else else
save_loc = trans_split_loc; save_loc = trans_split_loc;

View File

@ -1992,6 +1992,14 @@ xaccTransGetSplit (Transaction *trans, int i)
return g_list_nth_data (trans->splits, i); return g_list_nth_data (trans->splits, i);
} }
GList *
xaccTransGetSplitList (Transaction *trans)
{
if (!trans) return NULL;
return trans->splits;
}
const char * const char *
xaccTransGetNum (Transaction *trans) xaccTransGetNum (Transaction *trans)
{ {

View File

@ -203,6 +203,10 @@ void xaccSplitDestroy (Split *split);
*/ */
Split * xaccTransGetSplit (Transaction *trans, int i); Split * xaccTransGetSplit (Transaction *trans, int i);
/* The xaccTransGetSplitList() method returns a GList of the splits
* in a transaction. This list must not be modified. */
GList * xaccTransGetSplitList (Transaction *trans);
/* These routines return the Num (or ID field), the description, /* These routines return the Num (or ID field), the description,
* and the date field. * and the date field.
*/ */

View File

@ -500,7 +500,7 @@ gnc_ui_find_transactions_dialog_ok_cb(GtkButton * button,
new_ledger = TRUE; new_ledger = TRUE;
ftd->ledger = xaccLedgerDisplayGeneral(NULL, NULL, ftd->ledger = xaccLedgerDisplayGeneral(NULL, NULL,
SEARCH_LEDGER, SEARCH_LEDGER,
REG_SINGLE_LINE); REG_STYLE_JOURNAL);
xaccFreeQuery(ftd->ledger->query); xaccFreeQuery(ftd->ledger->query);
} }

View File

@ -261,23 +261,19 @@ gnc_register_jump_to_split_amount(RegWindow *regData, Split *split)
static SplitRegisterStyle static SplitRegisterStyle
gnc_get_default_register_style() gnc_get_default_register_style()
{ {
SplitRegisterStyle new_style = REG_SINGLE_LINE; SplitRegisterStyle new_style = REG_STYLE_LEDGER;
char *style_string; char *style_string;
style_string = gnc_lookup_multichoice_option("Register", style_string = gnc_lookup_multichoice_option("Register",
"Default Register Mode", "Default Register Mode",
"single_line"); "ledger");
if (safe_strcmp(style_string, "single_line") == 0) if (safe_strcmp(style_string, "ledger") == 0)
new_style = REG_SINGLE_LINE; new_style = REG_STYLE_LEDGER;
else if (safe_strcmp(style_string, "double_line") == 0) else if (safe_strcmp(style_string, "auto_ledger") == 0)
new_style = REG_DOUBLE_LINE; new_style = REG_STYLE_AUTO_LEDGER;
else if (safe_strcmp(style_string, "multi_line") == 0) else if (safe_strcmp(style_string, "journal") == 0)
new_style = REG_MULTI_LINE; new_style = REG_STYLE_JOURNAL;
else if (safe_strcmp(style_string, "auto_single") == 0)
new_style = REG_SINGLE_DYNAMIC;
else if (safe_strcmp(style_string, "auto_double") == 0)
new_style = REG_DOUBLE_DYNAMIC;
if (style_string != NULL) if (style_string != NULL)
free(style_string); free(style_string);
@ -294,53 +290,54 @@ gnc_register_change_style(RegWindow *regData, SplitRegisterStyle style)
if (style == reg->style) if (style == reg->style)
return; return;
xaccConfigSplitRegister(reg, reg->type, style); xaccConfigSplitRegister(reg, reg->type, style, reg->use_double_line);
regData->ledger->dirty = 1; regData->ledger->dirty = 1;
xaccLedgerDisplayRefresh(regData->ledger); xaccLedgerDisplayRefresh(regData->ledger);
} }
static void static void
gnc_register_style_single_cb(GtkWidget *w, gpointer data) gnc_register_style_ledger_cb(GtkWidget *w, gpointer data)
{ {
RegWindow *regData = data; RegWindow *regData = data;
gnc_register_change_style(regData, REG_SINGLE_LINE); gnc_register_change_style(regData, REG_STYLE_LEDGER);
} }
static void static void
gnc_register_style_double_cb(GtkWidget *w, gpointer data) gnc_register_style_auto_ledger_cb(GtkWidget *w, gpointer data)
{ {
RegWindow *regData = data; RegWindow *regData = data;
gnc_register_change_style(regData, REG_DOUBLE_LINE); gnc_register_change_style(regData, REG_STYLE_AUTO_LEDGER);
} }
static void static void
gnc_register_style_multi_cb(GtkWidget *w, gpointer data) gnc_register_style_journal_cb(GtkWidget *w, gpointer data)
{ {
RegWindow *regData = data; RegWindow *regData = data;
gnc_register_change_style(regData, REG_MULTI_LINE); gnc_register_change_style(regData, REG_STYLE_JOURNAL);
} }
static void static void
gnc_register_style_auto_single_cb(GtkWidget *w, gpointer data) gnc_register_double_line_cb (GtkWidget *w, gpointer data)
{ {
RegWindow *regData = data; RegWindow *regData = data;
SplitRegister *reg = regData->ledger->ledger;
gboolean use_double_line;
gnc_register_change_style(regData, REG_SINGLE_DYNAMIC); use_double_line = GTK_CHECK_MENU_ITEM(w)->active;
if (use_double_line == reg->use_double_line)
return;
xaccConfigSplitRegister(reg, reg->type, reg->style, use_double_line);
regData->ledger->dirty = 1;
xaccLedgerDisplayRefresh(regData->ledger);
} }
static void
gnc_register_style_auto_double_cb(GtkWidget *w, gpointer data)
{
RegWindow *regData = data;
gnc_register_change_style(regData, REG_DOUBLE_DYNAMIC);
}
static void static void
gnc_register_sort(RegWindow *regData, sort_type_t sort_code) gnc_register_sort(RegWindow *regData, sort_type_t sort_code)
{ {
@ -350,7 +347,7 @@ gnc_register_sort(RegWindow *regData, sort_type_t sort_code)
if (regData->sort_type == sort_code) if (regData->sort_type == sort_code)
return; return;
switch(sort_code) switch (sort_code)
{ {
case BY_STANDARD: case BY_STANDARD:
xaccQuerySetSortOrder(query, BY_STANDARD, BY_NONE, BY_NONE); xaccQuerySetSortOrder(query, BY_STANDARD, BY_NONE, BY_NONE);
@ -1100,31 +1097,28 @@ gnc_register_create_menu_bar(RegWindow *regData, GtkWidget *statusbar)
static GnomeUIInfo style_list[] = static GnomeUIInfo style_list[] =
{ {
GNOMEUIINFO_RADIOITEM_DATA(N_("Single Line"), GNOMEUIINFO_RADIOITEM_DATA(N_("Ledger"),
N_("Show transactions on single lines"), N_("Show transactions on one or two lines"),
gnc_register_style_single_cb, NULL, NULL), gnc_register_style_ledger_cb, NULL, NULL),
GNOMEUIINFO_RADIOITEM_DATA(N_("Double Line"), GNOMEUIINFO_RADIOITEM_DATA(N_("Auto Ledger"),
N_("Show transactions on two lines with " N_("Show transactions on one or two lines and "
"more information"), "expand the current transaction"),
gnc_register_style_double_cb, NULL, NULL), gnc_register_style_auto_ledger_cb, NULL, NULL),
GNOMEUIINFO_RADIOITEM_DATA(N_("Multi Line"), GNOMEUIINFO_RADIOITEM_DATA(N_("Journal"),
N_("Show transactions on multiple lines with " N_("Show expanded transactions with all "
"one line for each split"), "splits"),
gnc_register_style_multi_cb, NULL, NULL), gnc_register_style_journal_cb, NULL, NULL),
GNOMEUIINFO_RADIOITEM_DATA(N_("Auto Single"),
N_("Single line mode with a multi-line cursor"),
gnc_register_style_auto_single_cb,
NULL, NULL),
GNOMEUIINFO_RADIOITEM_DATA(N_("Auto Double"),
N_("Double line mode with a multi-line cursor"),
gnc_register_style_auto_double_cb,
NULL, NULL),
GNOMEUIINFO_END GNOMEUIINFO_END
}; };
static GnomeUIInfo style_menu[] = static GnomeUIInfo style_menu[] =
{ {
GNOMEUIINFO_RADIOLIST(style_list), GNOMEUIINFO_RADIOLIST(style_list),
GNOMEUIINFO_SEPARATOR,
GNOMEUIINFO_TOGGLEITEM(N_("Double Line"),
N_("Show two lines of information for each "
"transaction"),
gnc_register_double_line_cb, NULL),
GNOMEUIINFO_END GNOMEUIINFO_END
}; };
@ -1396,21 +1390,15 @@ gnc_register_create_menu_bar(RegWindow *regData, GtkWidget *statusbar)
switch (gnc_get_default_register_style()) switch (gnc_get_default_register_style())
{ {
default: default:
case REG_SINGLE_LINE: case REG_STYLE_LEDGER:
index = 0; index = 0;
break; break;
case REG_DOUBLE_LINE: case REG_STYLE_AUTO_LEDGER:
index = 1; index = 1;
break; break;
case REG_MULTI_LINE: case REG_STYLE_JOURNAL:
index = 2; index = 2;
break; break;
case REG_SINGLE_DYNAMIC:
index = 3;
break;
case REG_DOUBLE_DYNAMIC:
index = 4;
break;
} }
widget = style_list[index].widget; widget = style_list[index].widget;
@ -1515,7 +1503,7 @@ gnc_register_record_cb(GnucashRegister *reg, gpointer data)
SplitRegister *sr = regData->ledger->ledger; SplitRegister *sr = regData->ledger->ledger;
SplitRegisterStyle style = sr->style; SplitRegisterStyle style = sr->style;
if ((style == REG_SINGLE_LINE) || (style == REG_DOUBLE_LINE)) if (style == REG_STYLE_LEDGER)
{ {
Split *blank_split; Split *blank_split;
@ -1748,9 +1736,18 @@ regWindowLedger(xaccLedgerDisplay *ledger)
popup, regData); popup, regData);
} }
/* be sure to initialize the gui elements associated with the cursor */ {
xaccConfigSplitRegister(ledger->ledger, ledger->type, gboolean use_double_line;
gnc_get_default_register_style());
use_double_line = gnc_lookup_boolean_option("Register",
"Double Line Mode",
FALSE);
/* be sure to initialize the gui elements associated with the cursor */
xaccConfigSplitRegister(ledger->ledger, ledger->type,
gnc_get_default_register_style(),
use_double_line);
}
/* Allow grow, allow shrink, auto-shrink */ /* Allow grow, allow shrink, auto-shrink */
gtk_window_set_policy(GTK_WINDOW(register_window), TRUE, TRUE, TRUE); gtk_window_set_policy(GTK_WINDOW(register_window), TRUE, TRUE, TRUE);
@ -2400,8 +2397,7 @@ deleteCB(GtkWidget *widget, gpointer data)
/* On a transaction cursor with 2 or fewer splits in single or double /* On a transaction cursor with 2 or fewer splits in single or double
* mode, we just delete the whole transaction, kerblooie */ * mode, we just delete the whole transaction, kerblooie */
if ((xaccTransCountSplits(trans) <= 2) && if ((xaccTransCountSplits(trans) <= 2) && (style == REG_STYLE_LEDGER))
((style == REG_SINGLE_LINE) || (style == REG_DOUBLE_LINE)))
{ {
const char *message = _("Are you sure you want to delete the current " const char *message = _("Are you sure you want to delete the current "
"transaction?"); "transaction?");

View File

@ -68,15 +68,15 @@ static guint register_signals[LAST_SIGNAL];
void void
gnucash_sheet_set_cursor (GnucashSheet *sheet, CellBlock *cursor, gnucash_sheet_set_cursor (GnucashSheet *sheet, CellBlock *cursor)
CursorType cursor_type)
{ {
g_return_if_fail (sheet != NULL); g_return_if_fail (sheet != NULL);
g_return_if_fail (GNUCASH_IS_SHEET (sheet)); g_return_if_fail (GNUCASH_IS_SHEET (sheet));
g_return_if_fail (cursor_type >= 0); g_return_if_fail (cursor != NULL);
g_return_if_fail (cursor_type < NUM_CURSOR_TYPES); g_return_if_fail (cursor->cursor_type >= 0);
g_return_if_fail (cursor->cursor_type < NUM_CURSOR_TYPES);
sheet->cursors[cursor_type] = cursor; sheet->cursors[cursor->cursor_type] = cursor;
} }
void void

View File

@ -168,8 +168,7 @@ void gnucash_sheet_compute_visible_range (GnucashSheet *sheet);
void gnucash_sheet_make_cell_visible (GnucashSheet *sheet, void gnucash_sheet_make_cell_visible (GnucashSheet *sheet,
VirtualLocation virt_loc); VirtualLocation virt_loc);
void gnucash_sheet_set_cursor (GnucashSheet *sheet, CellBlock *cursor, void gnucash_sheet_set_cursor (GnucashSheet *sheet, CellBlock *cursor);
CursorType cursor_type);
void gnucash_sheet_update_adjustments (GnucashSheet *sheet); void gnucash_sheet_update_adjustments (GnucashSheet *sheet);

View File

@ -50,13 +50,14 @@ style_get_key (SheetBlockStyle *style)
{ {
switch (style->cursor_type) { switch (style->cursor_type) {
case CURSOR_TYPE_HEADER: case CURSOR_TYPE_HEADER:
case CURSOR_TYPE_SINGLE: case CURSOR_TYPE_SINGLE_LEDGER:
case CURSOR_TYPE_TRANS: case CURSOR_TYPE_SINGLE_JOURNAL:
case CURSOR_TYPE_SPLIT: case CURSOR_TYPE_SPLIT:
return "singles"; return "singles";
break; break;
case CURSOR_TYPE_DOUBLE: case CURSOR_TYPE_DOUBLE_LEDGER:
case CURSOR_TYPE_DOUBLE_JOURNAL:
return "doubles"; return "doubles";
break; break;

View File

@ -100,27 +100,31 @@ static char *cell_sample_strings[] =
N_("sample:Expenses:Automobile:Gasoline"+7), /* mxfrm cell */ N_("sample:Expenses:Automobile:Gasoline"+7), /* mxfrm cell */
}; };
#define DATE_CELL_ALIGN CELL_ALIGN_RIGHT static CellAlignment cell_alignments[] =
#define NUM_CELL_ALIGN CELL_ALIGN_LEFT {
#define ACTN_CELL_ALIGN CELL_ALIGN_LEFT CELL_ALIGN_RIGHT, /* date cell */
#define XFRM_CELL_ALIGN CELL_ALIGN_RIGHT CELL_ALIGN_LEFT, /* num cell */
#define MXFRM_CELL_ALIGN CELL_ALIGN_RIGHT CELL_ALIGN_LEFT, /* desc cell */
#define XTO_CELL_ALIGN CELL_ALIGN_RIGHT CELL_ALIGN_CENTER, /* recn cell */
#define DESC_CELL_ALIGN CELL_ALIGN_LEFT CELL_ALIGN_RIGHT, /* share balance cell */
#define MEMO_CELL_ALIGN CELL_ALIGN_LEFT CELL_ALIGN_RIGHT, /* balance cell */
#define RECN_CELL_ALIGN CELL_ALIGN_CENTER CELL_ALIGN_LEFT, /* action cell */
#define DEBT_CELL_ALIGN CELL_ALIGN_RIGHT CELL_ALIGN_RIGHT, /* xfrm cell */
#define CRED_CELL_ALIGN CELL_ALIGN_RIGHT CELL_ALIGN_RIGHT, /* xto cell */
#define PRIC_CELL_ALIGN CELL_ALIGN_RIGHT CELL_ALIGN_LEFT, /* memo cell */
#define SHRS_CELL_ALIGN CELL_ALIGN_RIGHT CELL_ALIGN_RIGHT, /* credit cell */
#define SHRBALN_CELL_ALIGN CELL_ALIGN_RIGHT CELL_ALIGN_RIGHT, /* debit cell */
#define BALN_CELL_ALIGN CELL_ALIGN_RIGHT CELL_ALIGN_RIGHT, /* price cell */
CELL_ALIGN_RIGHT, /* shares cell */
CELL_ALIGN_RIGHT, /* mxfrm cell */
};
static void static void
xaccInitSplitRegister (SplitRegister *reg, xaccInitSplitRegister (SplitRegister *reg,
SplitRegisterType type, SplitRegisterType type,
SplitRegisterStyle style, SplitRegisterStyle style,
gboolean use_double_line,
TableGetEntryHandler entry_handler, TableGetEntryHandler entry_handler,
TableGetFGColorHandler fg_color_handler, TableGetFGColorHandler fg_color_handler,
TableGetBGColorHandler bg_color_handler, TableGetBGColorHandler bg_color_handler,
@ -297,47 +301,61 @@ configAction (SplitRegister *reg)
/* ============================================== */ /* ============================================== */
#define SET(NAME,col,row,handler) \ static void
{ \ set_cell (SplitRegister *reg, CellBlock *cursor,
BasicCell *hcell; \ CellType cell_type, short row, short col)
hcell = reg->header_cells[NAME##_CELL]; \ {
\ CellBlockCell *cb_cell;
if ((0<=row) && (0<=col)) { \ BasicCell *hcell;
CellBlockCell *cb_cell; \
\ hcell = reg->header_cells[cell_type];
cb_cell = gnc_cellblock_get_cell (curs, row, col); \
\ cb_cell = gnc_cellblock_get_cell (cursor, row, col);
cb_cell->cell = (handler); \
cb_cell->cell_type = NAME##_CELL; \ cb_cell->cell = reg->cells[cell_type];
cb_cell->label = g_strdup (hcell->value); \ cb_cell->cell_type = cell_type;
cb_cell->sample_text = \ cb_cell->label = g_strdup (hcell->value);
g_strdup (_(cell_sample_strings[NAME##_CELL])); \ cb_cell->sample_text = g_strdup (_(cell_sample_strings[cell_type]));
cb_cell->alignment = NAME##_CELL_ALIGN; \ cb_cell->alignment = cell_alignments[cell_type];
cb_cell->expandable = \ cb_cell->expandable = reg->cells[cell_type] == (BasicCell *) reg->descCell;
((handler) == (BasicCell *) reg->descCell); \ cb_cell->span = reg->cells[cell_type] == (BasicCell *) reg->memoCell;
cb_cell->span = \
((handler) == (BasicCell *) reg->memoCell); \ cb_cell = gnc_cellblock_get_cell (reg->cursor_header, row, col);
\
cb_cell = gnc_cellblock_get_cell (header, row, col); \ if (cb_cell && (cursor == reg->cursor_ledger_single))
if (cb_cell && (curs == reg->single_cursor)) { \ {
cb_cell->cell = hcell; \ cb_cell->cell = reg->cells[cell_type];
cb_cell->cell_type = NAME##_CELL; \ cb_cell->cell_type = cell_type;
cb_cell->label = g_strdup (hcell->value); \ cb_cell->label = g_strdup (hcell->value);
cb_cell->sample_text = \ cb_cell->sample_text = g_strdup (_(cell_sample_strings[cell_type]));
g_strdup (_(cell_sample_strings[NAME##_CELL])); \ cb_cell->alignment = cell_alignments[cell_type];
cb_cell->alignment = NAME##_CELL_ALIGN; \ cb_cell->expandable =
cb_cell->expandable = \ reg->cells[cell_type] == (BasicCell *) reg->descCell;
((handler) == (BasicCell *) reg->descCell); \ cb_cell->span = reg->cells[cell_type] == (BasicCell *) reg->memoCell;
cb_cell->span = \ }
((handler) == (BasicCell *) reg->memoCell); \
} \
} \
} }
/* SET_CELL macro initializes cells in the register */ /* SET_CELL macro initializes cells in the register */
#define SET_CELL(NAME,CN,col,row) { \ #define SET_CELL(NAME,col,row) { \
SET (NAME, col, row, &(reg->CN##Cell->cell)); \ set_cell (reg, curs, NAME##_CELL, row, col); \
}
static void
copy_cursor_row (SplitRegister *reg, CellBlock *to, CellBlock *from, int row)
{
int col;
for (col = 0; col < from->num_cols; col++)
{
CellBlockCell *cb_cell;
cb_cell = gnc_cellblock_get_cell (from, row, col);
if (cb_cell->cell_type < 0)
continue;
set_cell (reg, to, cb_cell->cell_type, row, col);
}
} }
/* ============================================== */ /* ============================================== */
@ -345,33 +363,36 @@ configAction (SplitRegister *reg)
static void static void
configLayout (SplitRegister *reg) configLayout (SplitRegister *reg)
{ {
CellBlock *curs, *header; CellBlock *curs;
int i; int i;
/* define header for macros */
header = reg->header;
/* fill things up with null cells */ /* fill things up with null cells */
for (i=0; i < header->num_cols; i++) for (i = 0; i < reg->cursor_header->num_cols; i++)
{ {
CellBlockCell *cb_cell; CellBlockCell *cb_cell;
cb_cell = gnc_cellblock_get_cell (header, 0, i); cb_cell = gnc_cellblock_get_cell (reg->cursor_header, 0, i);
cb_cell->cell = reg->nullCell; cb_cell->cell = reg->nullCell;
cb_cell = gnc_cellblock_get_cell (reg->split_cursor, 0, i); cb_cell = gnc_cellblock_get_cell (reg->cursor_ledger_single, 0, i);
cb_cell->cell = reg->nullCell; cb_cell->cell = reg->nullCell;
cb_cell = gnc_cellblock_get_cell (reg->trans_cursor, 0, i); cb_cell = gnc_cellblock_get_cell (reg->cursor_ledger_double, 0, i);
cb_cell->cell = reg->nullCell; cb_cell->cell = reg->nullCell;
cb_cell = gnc_cellblock_get_cell (reg->single_cursor, 0, i); cb_cell = gnc_cellblock_get_cell (reg->cursor_ledger_double, 1, i);
cb_cell->cell = reg->nullCell; cb_cell->cell = reg->nullCell;
cb_cell = gnc_cellblock_get_cell (reg->double_cursor, 0, i); cb_cell = gnc_cellblock_get_cell (reg->cursor_journal_single, 0, i);
cb_cell->cell = reg->nullCell; cb_cell->cell = reg->nullCell;
cb_cell = gnc_cellblock_get_cell (reg->double_cursor, 1, i); cb_cell = gnc_cellblock_get_cell (reg->cursor_journal_double, 0, i);
cb_cell->cell = reg->nullCell;
cb_cell = gnc_cellblock_get_cell (reg->cursor_journal_double, 1, i);
cb_cell->cell = reg->nullCell;
cb_cell = gnc_cellblock_get_cell (reg->cursor_split, 0, i);
cb_cell->cell = reg->nullCell; cb_cell->cell = reg->nullCell;
} }
@ -386,44 +407,42 @@ configLayout (SplitRegister *reg)
case EXPENSE_REGISTER: case EXPENSE_REGISTER:
case EQUITY_REGISTER: case EQUITY_REGISTER:
{ {
curs = reg->double_cursor; curs = reg->cursor_ledger_single;
SET_CELL (DATE, date, 0, 0); SET_CELL (DATE, 0, 0);
SET_CELL (NUM, num, 1, 0); SET_CELL (NUM, 1, 0);
SET_CELL (DESC, desc, 2, 0); SET_CELL (DESC, 2, 0);
SET_CELL (MXFRM, mxfrm, 3, 0); SET_CELL (MXFRM, 3, 0);
SET_CELL (RECN, recn, 4, 0); SET_CELL (RECN, 4, 0);
SET_CELL (DEBT, debit, 5, 0); SET_CELL (DEBT, 5, 0);
SET_CELL (CRED, credit, 6, 0); SET_CELL (CRED, 6, 0);
SET_CELL (BALN, balance, 7, 0); SET_CELL (BALN, 7, 0);
SET_CELL (ACTN, action, 1, 1); curs = reg->cursor_ledger_double;
SET_CELL (MEMO, memo, 2, 1); copy_cursor_row (reg, curs, reg->cursor_ledger_single, 0);
curs = reg->trans_cursor; SET_CELL (ACTN, 1, 1);
SET_CELL (DATE, date, 0, 0); SET_CELL (MEMO, 2, 1);
SET_CELL (NUM, num, 1, 0);
SET_CELL (DESC, desc, 2, 0);
SET_CELL (RECN, recn, 4, 0);
SET_CELL (DEBT, debit, 5, 0);
SET_CELL (CRED, credit, 6, 0);
SET_CELL (BALN, balance, 7, 0);
curs = reg->split_cursor; curs = reg->cursor_journal_single;
SET_CELL (ACTN, action, 1, 0); SET_CELL (DATE, 0, 0);
SET_CELL (MEMO, memo, 2, 0); SET_CELL (NUM, 1, 0);
SET_CELL (XFRM, xfrm, 3, 0); SET_CELL (DESC, 2, 0);
SET_CELL (DEBT, debit, 5, 0); SET_CELL (RECN, 4, 0);
SET_CELL (CRED, credit, 6, 0); SET_CELL (DEBT, 5, 0);
SET_CELL (CRED, 6, 0);
SET_CELL (BALN, 7, 0);
curs = reg->single_cursor; curs = reg->cursor_journal_double;
SET_CELL (DATE, date, 0, 0); copy_cursor_row (reg, curs, reg->cursor_journal_single, 0);
SET_CELL (NUM, num, 1, 0);
SET_CELL (DESC, desc, 2, 0); SET_CELL (MEMO, 2, 1);
SET_CELL (MXFRM, mxfrm, 3, 0);
SET_CELL (RECN, recn, 4, 0); curs = reg->cursor_split;
SET_CELL (DEBT, debit, 5, 0); SET_CELL (ACTN, 1, 0);
SET_CELL (CRED, credit, 6, 0); SET_CELL (MEMO, 2, 0);
SET_CELL (BALN, balance, 7, 0); SET_CELL (XFRM, 3, 0);
SET_CELL (DEBT, 5, 0);
SET_CELL (CRED, 6, 0);
break; break;
} }
@ -433,44 +452,42 @@ configLayout (SplitRegister *reg)
case GENERAL_LEDGER: case GENERAL_LEDGER:
case SEARCH_LEDGER: case SEARCH_LEDGER:
{ {
curs = reg->double_cursor; curs = reg->cursor_ledger_single;
SET_CELL (DATE, date, 0, 0); SET_CELL (DATE, 0, 0);
SET_CELL (NUM, num, 1, 0); SET_CELL (NUM, 1, 0);
SET_CELL (DESC, desc, 2, 0); SET_CELL (DESC, 2, 0);
SET_CELL (XTO, xto, 3, 0); SET_CELL (XTO, 3, 0);
SET_CELL (MXFRM, mxfrm, 4, 0); SET_CELL (MXFRM, 4, 0);
SET_CELL (RECN, recn, 5, 0); SET_CELL (RECN, 5, 0);
SET_CELL (DEBT, debit, 6, 0); SET_CELL (DEBT, 6, 0);
SET_CELL (CRED, credit, 7, 0); SET_CELL (CRED, 7, 0);
SET_CELL (ACTN, action, 1, 1); curs = reg->cursor_ledger_double;
SET_CELL (MEMO, memo, 2, 1); copy_cursor_row (reg, curs, reg->cursor_ledger_single, 0);
curs = reg->trans_cursor; SET_CELL (ACTN, 1, 1);
SET_CELL (DATE, date, 0, 0); SET_CELL (MEMO, 2, 1);
SET_CELL (NUM, num, 1, 0);
SET_CELL (DESC, desc, 2, 0);
SET_CELL (XTO, mxfrm, 3, 0);
SET_CELL (RECN, recn, 5, 0);
SET_CELL (DEBT, debit, 6, 0);
SET_CELL (CRED, credit, 7, 0);
curs = reg->split_cursor; curs = reg->cursor_journal_single;
SET_CELL (ACTN, action, 1, 0); SET_CELL (DATE, 0, 0);
SET_CELL (MEMO, memo, 2, 0); SET_CELL (NUM, 1, 0);
SET_CELL (XFRM, xfrm, 4, 0); SET_CELL (DESC, 2, 0);
SET_CELL (DEBT, debit, 6, 0); SET_CELL (XTO, 3, 0);
SET_CELL (CRED, credit, 7, 0); SET_CELL (RECN, 5, 0);
SET_CELL (DEBT, 6, 0);
SET_CELL (CRED, 7, 0);
curs = reg->single_cursor; curs = reg->cursor_journal_double;
SET_CELL (DATE, date, 0, 0); copy_cursor_row (reg, curs, reg->cursor_journal_single, 0);
SET_CELL (NUM, num, 1, 0);
SET_CELL (DESC, desc, 2, 0); SET_CELL (MEMO, 2, 1);
SET_CELL (XTO, xto, 3, 0);
SET_CELL (MXFRM, mxfrm, 4, 0); curs = reg->cursor_split;
SET_CELL (RECN, recn, 5, 0); SET_CELL (ACTN, 1, 0);
SET_CELL (DEBT, debit, 6, 0); SET_CELL (MEMO, 2, 0);
SET_CELL (CRED, credit, 7, 0); SET_CELL (XFRM, 4, 0);
SET_CELL (DEBT, 6, 0);
SET_CELL (CRED, 7, 0);
break; break;
} }
@ -479,53 +496,48 @@ configLayout (SplitRegister *reg)
case STOCK_REGISTER: case STOCK_REGISTER:
case CURRENCY_REGISTER: case CURRENCY_REGISTER:
{ {
curs = reg->double_cursor; curs = reg->cursor_ledger_single;
SET_CELL (DATE, date, 0, 0); SET_CELL (DATE, 0, 0);
SET_CELL (NUM, num, 1, 0); SET_CELL (NUM, 1, 0);
SET_CELL (DESC, desc, 2, 0); SET_CELL (DESC, 2, 0);
SET_CELL (MXFRM, mxfrm, 3, 0); SET_CELL (MXFRM, 3, 0);
SET_CELL (RECN, recn, 4, 0); SET_CELL (RECN, 4, 0);
SET_CELL (SHRS, shares, 5, 0); SET_CELL (SHRS, 5, 0);
SET_CELL (PRIC, price, 6, 0); SET_CELL (PRIC, 6, 0);
SET_CELL (DEBT, debit, 7, 0); SET_CELL (DEBT, 7, 0);
SET_CELL (CRED, credit, 8, 0); SET_CELL (CRED, 8, 0);
SET_CELL (SHRBALN, shrbaln, 9, 0); SET_CELL (SHRBALN, 9, 0);
SET_CELL (BALN, balance, 10, 0); SET_CELL (BALN, 10, 0);
SET_CELL (ACTN, action, 1, 1); curs = reg->cursor_ledger_double;
SET_CELL (MEMO, memo, 2, 1); copy_cursor_row (reg, curs, reg->cursor_ledger_single, 0);
curs = reg->trans_cursor; SET_CELL (ACTN, 1, 1);
SET_CELL (DATE, date, 0, 0); SET_CELL (MEMO, 2, 1);
SET_CELL (NUM, num, 1, 0);
SET_CELL (DESC, desc, 2, 0);
SET_CELL (RECN, recn, 4, 0);
SET_CELL (SHRS, shares, 5, 0);
SET_CELL (PRIC, price, 6, 0);
SET_CELL (DEBT, debit, 7, 0);
SET_CELL (CRED, credit, 8, 0);
SET_CELL (SHRBALN, shrbaln, 9, 0);
SET_CELL (BALN, balance, 10, 0);
curs = reg->split_cursor; curs = reg->cursor_journal_single;
SET_CELL (ACTN, action, 1, 0); SET_CELL (DATE, 0, 0);
SET_CELL (MEMO, memo, 2, 0); SET_CELL (NUM, 1, 0);
SET_CELL (XFRM, xfrm, 3, 0); SET_CELL (DESC, 2, 0);
SET_CELL (DEBT, debit, 7, 0); SET_CELL (RECN, 4, 0);
SET_CELL (CRED, credit, 8, 0); SET_CELL (SHRS, 5, 0);
SET_CELL (PRIC, 6, 0);
SET_CELL (DEBT, 7, 0);
SET_CELL (CRED, 8, 0);
SET_CELL (SHRBALN, 9, 0);
SET_CELL (BALN, 10, 0);
curs = reg->single_cursor; curs = reg->cursor_journal_double;
SET_CELL (DATE, date, 0, 0); copy_cursor_row (reg, curs, reg->cursor_journal_single, 0);
SET_CELL (NUM, num, 1, 0);
SET_CELL (DESC, desc, 2, 0); SET_CELL (MEMO, 2, 1);
SET_CELL (MXFRM, mxfrm, 3, 0);
SET_CELL (RECN, recn, 4, 0); curs = reg->cursor_split;
SET_CELL (SHRS, shares, 5, 0); SET_CELL (ACTN, 1, 0);
SET_CELL (PRIC, price, 6, 0); SET_CELL (MEMO, 2, 0);
SET_CELL (DEBT, debit, 7, 0); SET_CELL (XFRM, 3, 0);
SET_CELL (CRED, credit, 8, 0); SET_CELL (DEBT, 7, 0);
SET_CELL (SHRBALN, shrbaln, 9, 0); SET_CELL (CRED, 8, 0);
SET_CELL (BALN, balance, 10, 0);
break; break;
} }
@ -533,53 +545,48 @@ configLayout (SplitRegister *reg)
/* --------------------------------------------------------- */ /* --------------------------------------------------------- */
case PORTFOLIO_LEDGER: case PORTFOLIO_LEDGER:
{ {
curs = reg->double_cursor; curs = reg->cursor_ledger_single;
SET_CELL (DATE, date, 0, 0); SET_CELL (DATE, 0, 0);
SET_CELL (NUM, num, 1, 0); SET_CELL (NUM, 1, 0);
SET_CELL (DESC, desc, 2, 0); SET_CELL (DESC, 2, 0);
SET_CELL (XTO, xto, 3, 0); SET_CELL (XTO, 3, 0);
SET_CELL (MXFRM, mxfrm, 4, 0); SET_CELL (MXFRM, 4, 0);
SET_CELL (RECN, recn, 5, 0); SET_CELL (RECN, 5, 0);
SET_CELL (SHRS, shares, 6, 0); SET_CELL (SHRS, 6, 0);
SET_CELL (PRIC, price, 7, 0); SET_CELL (PRIC, 7, 0);
SET_CELL (DEBT, debit, 8, 0); SET_CELL (DEBT, 8, 0);
SET_CELL (CRED, credit, 9, 0); SET_CELL (CRED, 9, 0);
SET_CELL (SHRBALN, shrbaln, 10, 0); SET_CELL (SHRBALN, 10, 0);
SET_CELL (ACTN, action, 1, 1); curs = reg->cursor_ledger_double;
SET_CELL (MEMO, memo, 2, 1); copy_cursor_row (reg, curs, reg->cursor_ledger_single, 0);
curs = reg->trans_cursor; SET_CELL (ACTN, 1, 1);
SET_CELL (DATE, date, 0, 0); SET_CELL (MEMO, 2, 1);
SET_CELL (NUM, num, 1, 0);
SET_CELL (DESC, desc, 2, 0);
SET_CELL (XTO, mxfrm, 3, 0);
SET_CELL (RECN, recn, 5, 0);
SET_CELL (SHRS, shares, 6, 0);
SET_CELL (PRIC, price, 7, 0);
SET_CELL (DEBT, debit, 8, 0);
SET_CELL (CRED, credit, 9, 0);
SET_CELL (SHRBALN, shrbaln, 10, 0);
curs = reg->split_cursor; curs = reg->cursor_journal_single;
SET_CELL (ACTN, action, 1, 0); SET_CELL (DATE, 0, 0);
SET_CELL (MEMO, memo, 2, 0); SET_CELL (NUM, 1, 0);
SET_CELL (XFRM, xfrm, 4, 0); SET_CELL (DESC, 2, 0);
SET_CELL (DEBT, debit, 8, 0); SET_CELL (XTO, 3, 0);
SET_CELL (CRED, credit, 9, 0); SET_CELL (RECN, 5, 0);
SET_CELL (SHRS, 6, 0);
SET_CELL (PRIC, 7, 0);
SET_CELL (DEBT, 8, 0);
SET_CELL (CRED, 9, 0);
SET_CELL (SHRBALN, 10, 0);
curs = reg->single_cursor; curs = reg->cursor_journal_double;
SET_CELL (DATE, date, 0, 0); copy_cursor_row (reg, curs, reg->cursor_journal_single, 0);
SET_CELL (NUM, num, 1, 0);
SET_CELL (DESC, desc, 2, 0); SET_CELL (MEMO, 2, 1);
SET_CELL (XTO, xto, 3, 0);
SET_CELL (MXFRM, mxfrm, 4, 0); curs = reg->cursor_split;
SET_CELL (RECN, recn, 5, 0); SET_CELL (ACTN, 1, 0);
SET_CELL (SHRS, shares, 6, 0); SET_CELL (MEMO, 2, 0);
SET_CELL (PRIC, price, 7, 0); SET_CELL (XFRM, 4, 0);
SET_CELL (DEBT, debit, 8, 0); SET_CELL (DEBT, 8, 0);
SET_CELL (CRED, credit, 9, 0); SET_CELL (CRED, 9, 0);
SET_CELL (SHRBALN, shrbaln, 10, 0);
break; break;
} }
@ -596,6 +603,7 @@ configLayout (SplitRegister *reg)
SplitRegister * SplitRegister *
xaccMallocSplitRegister (SplitRegisterType type, xaccMallocSplitRegister (SplitRegisterType type,
SplitRegisterStyle style, SplitRegisterStyle style,
gboolean use_double_line,
TableGetEntryHandler entry_handler, TableGetEntryHandler entry_handler,
TableGetFGColorHandler fg_color_handler, TableGetFGColorHandler fg_color_handler,
TableGetBGColorHandler bg_color_handler, TableGetBGColorHandler bg_color_handler,
@ -607,7 +615,7 @@ xaccMallocSplitRegister (SplitRegisterType type,
reg = g_new0(SplitRegister, 1); reg = g_new0(SplitRegister, 1);
xaccInitSplitRegister (reg, type, style, xaccInitSplitRegister (reg, type, style, use_double_line,
entry_handler, fg_color_handler, bg_color_handler, entry_handler, fg_color_handler, bg_color_handler,
allocator, deallocator, copy); allocator, deallocator, copy);
@ -621,7 +629,8 @@ mallocCursors (SplitRegister *reg)
{ {
int num_cols; int num_cols;
switch (reg->type) { switch (reg->type)
{
case BANK_REGISTER: case BANK_REGISTER:
case CASH_REGISTER: case CASH_REGISTER:
case ASSET_REGISTER: case ASSET_REGISTER:
@ -654,33 +663,35 @@ mallocCursors (SplitRegister *reg)
return; return;
} }
reg->header = gnc_cellblock_new (1, num_cols, CURSOR_TYPE_HEADER); reg->cursor_header = gnc_cellblock_new (1, num_cols, CURSOR_TYPE_HEADER);
/* cursors used in the single & double line displays */ /* cursors used in ledger mode */
reg->single_cursor = gnc_cellblock_new (1, num_cols, CURSOR_TYPE_SINGLE); reg->cursor_ledger_single =
reg->double_cursor = gnc_cellblock_new (2, num_cols, CURSOR_TYPE_DOUBLE); gnc_cellblock_new (1, num_cols, CURSOR_TYPE_SINGLE_LEDGER);
reg->cursor_ledger_double =
gnc_cellblock_new (2, num_cols, CURSOR_TYPE_DOUBLE_LEDGER);
/* the two cursors used for multi-line and dynamic displays */ /* cursors used for journal mode */
reg->trans_cursor = gnc_cellblock_new (1, num_cols, CURSOR_TYPE_TRANS); reg->cursor_journal_single =
reg->split_cursor = gnc_cellblock_new (1, num_cols, CURSOR_TYPE_SPLIT); gnc_cellblock_new (1, num_cols, CURSOR_TYPE_SINGLE_JOURNAL);
reg->cursor_journal_double =
gnc_cellblock_new (2, num_cols, CURSOR_TYPE_DOUBLE_JOURNAL);
reg->cursor_split =
gnc_cellblock_new (1, num_cols, CURSOR_TYPE_SPLIT);
} }
/* ============================================== */ /* ============================================== */
#define HDR(NAME) \ #define NEW(NAME, CN, TYPE) \
{ \
BasicCell *hcell; \
hcell = xaccMallocTextCell(); \
reg->header_cells[NAME##_CELL] = hcell; \
}
#define NEW(CN,TYPE) \
reg->CN##Cell = xaccMalloc##TYPE##Cell(); \ reg->CN##Cell = xaccMalloc##TYPE##Cell(); \
reg->cells[NAME##_CELL] = (BasicCell *) reg->CN##Cell;
static void static void
xaccInitSplitRegister (SplitRegister *reg, xaccInitSplitRegister (SplitRegister *reg,
SplitRegisterType type, SplitRegisterType type,
SplitRegisterStyle style, SplitRegisterStyle style,
gboolean use_double_line,
TableGetEntryHandler entry_handler, TableGetEntryHandler entry_handler,
TableGetFGColorHandler fg_color_handler, TableGetFGColorHandler fg_color_handler,
TableGetBGColorHandler bg_color_handler, TableGetBGColorHandler bg_color_handler,
@ -693,8 +704,10 @@ xaccInitSplitRegister (SplitRegister *reg,
reg->table = NULL; reg->table = NULL;
reg->user_data = NULL; reg->user_data = NULL;
reg->destroy = NULL; reg->destroy = NULL;
reg->type = type; reg->type = type;
reg->style = style; reg->style = style;
reg->use_double_line = use_double_line;
/* --------------------------- */ /* --------------------------- */
/* define the number of columns in the display, malloc the cursors */ /* define the number of columns in the display, malloc the cursors */
@ -702,42 +715,34 @@ xaccInitSplitRegister (SplitRegister *reg,
/* --------------------------- */ /* --------------------------- */
/* malloc the header (label) cells */ /* malloc the header (label) cells */
HDR (DATE); {
HDR (NUM); int i;
HDR (ACTN);
HDR (XFRM); for (i = 0; i < CELL_TYPE_COUNT; i++)
HDR (MXFRM); reg->header_cells[i] = xaccMallocTextCell ();
HDR (XTO); }
HDR (DESC);
HDR (MEMO);
HDR (RECN);
HDR (CRED);
HDR (DEBT);
HDR (PRIC);
HDR (SHRS);
HDR (SHRBALN);
HDR (BALN);
/* --------------------------- */ /* --------------------------- */
/* malloc the workhorse cells */ /* malloc the workhorse cells */
NEW (null, Basic); reg->nullCell = xaccMallocBasicCell ();
NEW (date, Date);
NEW (num, Num);
NEW (desc, QuickFill);
NEW (recn, Recn);
NEW (shrbaln, Price);
NEW (balance, Price);
NEW (xfrm, Combo); NEW (DATE, date, Date);
NEW (mxfrm, Combo); NEW (NUM, num, Num);
NEW (xto, Combo); NEW (DESC, desc, QuickFill);
NEW (action, Combo); NEW (RECN, recn, Recn);
NEW (memo, QuickFill); NEW (SHRBALN, shrbaln, Price);
NEW (credit, Price); NEW (BALN, balance, Price);
NEW (debit, Price);
NEW (price, Price); NEW (XFRM, xfrm, Combo);
NEW (shares, Price); NEW (MXFRM, mxfrm, Combo);
NEW (XTO, xto, Combo);
NEW (ACTN, action, Combo);
NEW (MEMO, memo, QuickFill);
NEW (CRED, credit, Price);
NEW (DEBT, debit, Price);
NEW (PRIC, price, Price);
NEW (SHRS, shares, Price);
/* --------------------------- */ /* --------------------------- */
/* configLabels merely puts strings into the label cells /* configLabels merely puts strings into the label cells
@ -849,7 +854,8 @@ xaccInitSplitRegister (SplitRegister *reg,
{ {
VirtualCellLocation vcell_loc = { 0, 0 }; VirtualCellLocation vcell_loc = { 0, 0 };
gnc_table_set_vcell (table, reg->header, NULL, TRUE, TRUE, vcell_loc); gnc_table_set_vcell (table, reg->cursor_header,
NULL, TRUE, TRUE, vcell_loc);
} }
/* Set up first and only initial row */ /* Set up first and only initial row */
@ -861,8 +867,8 @@ xaccInitSplitRegister (SplitRegister *reg,
vloc.phys_row_offset = 0; vloc.phys_row_offset = 0;
vloc.phys_col_offset = 0; vloc.phys_col_offset = 0;
gnc_table_set_vcell (table, reg->single_cursor, NULL, TRUE, TRUE, gnc_table_set_vcell (table, reg->cursor_ledger_single,
vloc.vcell_loc); NULL, TRUE, TRUE, vloc.vcell_loc);
gnc_table_move_cursor (table, vloc); gnc_table_move_cursor (table, vloc);
} }
@ -874,19 +880,22 @@ xaccInitSplitRegister (SplitRegister *reg,
void void
xaccConfigSplitRegister (SplitRegister *reg, xaccConfigSplitRegister (SplitRegister *reg,
SplitRegisterType newtype, SplitRegisterType newtype,
SplitRegisterStyle newstyle) SplitRegisterStyle newstyle,
gboolean use_double_line)
{ {
if (!reg) return; if (!reg) return;
reg->type = newtype; reg->type = newtype;
reg->style = newstyle; reg->style = newstyle;
reg->use_double_line = use_double_line;
/* Make sure that any GUI elements associated with this reconfig /* Make sure that any GUI elements associated with this reconfig
* are properly initialized. */ * are properly initialized. */
gnc_table_create_cursor (reg->table, reg->single_cursor); gnc_table_create_cursor (reg->table, reg->cursor_ledger_single);
gnc_table_create_cursor (reg->table, reg->double_cursor); gnc_table_create_cursor (reg->table, reg->cursor_ledger_double);
gnc_table_create_cursor (reg->table, reg->trans_cursor); gnc_table_create_cursor (reg->table, reg->cursor_journal_single);
gnc_table_create_cursor (reg->table, reg->split_cursor); gnc_table_create_cursor (reg->table, reg->cursor_journal_double);
gnc_table_create_cursor (reg->table, reg->cursor_split);
} }
/* ============================================== */ /* ============================================== */
@ -906,17 +915,19 @@ xaccDestroySplitRegister (SplitRegister *reg)
gnc_table_destroy (reg->table); gnc_table_destroy (reg->table);
reg->table = NULL; reg->table = NULL;
gnc_cellblock_destroy (reg->header); gnc_cellblock_destroy (reg->cursor_header);
gnc_cellblock_destroy (reg->single_cursor); gnc_cellblock_destroy (reg->cursor_ledger_single);
gnc_cellblock_destroy (reg->double_cursor); gnc_cellblock_destroy (reg->cursor_ledger_double);
gnc_cellblock_destroy (reg->trans_cursor); gnc_cellblock_destroy (reg->cursor_journal_single);
gnc_cellblock_destroy (reg->split_cursor); gnc_cellblock_destroy (reg->cursor_journal_double);
gnc_cellblock_destroy (reg->cursor_split);
reg->header = NULL; reg->cursor_header = NULL;
reg->single_cursor = NULL; reg->cursor_ledger_single = NULL;
reg->double_cursor = NULL; reg->cursor_ledger_double = NULL;
reg->trans_cursor = NULL; reg->cursor_journal_single = NULL;
reg->split_cursor = NULL; reg->cursor_journal_double = NULL;
reg->cursor_split = NULL;
xaccDestroyDateCell (reg->dateCell); xaccDestroyDateCell (reg->dateCell);
xaccDestroyNumCell (reg->numCell); xaccDestroyNumCell (reg->numCell);
@ -1021,12 +1032,13 @@ sr_cellblock_cursor_class(SplitRegister *reg, CellBlock *cursor)
if (cursor == NULL) if (cursor == NULL)
return CURSOR_CLASS_NONE; return CURSOR_CLASS_NONE;
if ((cursor == reg->single_cursor) || if ((cursor == reg->cursor_ledger_single) ||
(cursor == reg->double_cursor) || (cursor == reg->cursor_ledger_double) ||
(cursor == reg->trans_cursor)) (cursor == reg->cursor_journal_single) ||
(cursor == reg->cursor_journal_double))
return CURSOR_CLASS_TRANS; return CURSOR_CLASS_TRANS;
if (cursor == reg->split_cursor) if (cursor == reg->cursor_split)
return CURSOR_CLASS_SPLIT; return CURSOR_CLASS_SPLIT;
return CURSOR_CLASS_NONE; return CURSOR_CLASS_NONE;

View File

@ -52,26 +52,26 @@
#include "recncell.h" #include "recncell.h"
#include "table-allgui.h" #include "table-allgui.h"
/* defined register types */ /* defined register types.
/* "registers" are single-account display windows. * "registers" are single-account display windows.
* "ledgers" are multiple-account display windows */ * "ledgers" are multiple-account display windows */
typedef enum typedef enum
{ {
BANK_REGISTER = 1, BANK_REGISTER,
CASH_REGISTER = 2, CASH_REGISTER,
ASSET_REGISTER = 3, ASSET_REGISTER,
CREDIT_REGISTER = 4, CREDIT_REGISTER,
LIABILITY_REGISTER = 5, LIABILITY_REGISTER,
INCOME_REGISTER = 6, INCOME_REGISTER,
EXPENSE_REGISTER = 7, EXPENSE_REGISTER,
EQUITY_REGISTER = 8, EQUITY_REGISTER,
STOCK_REGISTER = 9, STOCK_REGISTER,
CURRENCY_REGISTER = 10, CURRENCY_REGISTER,
GENERAL_LEDGER = 11, GENERAL_LEDGER,
INCOME_LEDGER = 12, INCOME_LEDGER,
PORTFOLIO_LEDGER = 13, PORTFOLIO_LEDGER,
SEARCH_LEDGER = 14 SEARCH_LEDGER
} SplitRegisterType; } SplitRegisterType;
/* These values are used to identify the cells in the register. */ /* These values are used to identify the cells in the register. */
@ -93,10 +93,7 @@ typedef enum
DEBT_CELL, DEBT_CELL,
PRIC_CELL, PRIC_CELL,
SHRS_CELL, SHRS_CELL,
MXFRM_CELL, /* MXFRM is the "mirrored" transfer-from account */
/* MXFRM is the "mirrored" transfer-from account */
MXFRM_CELL,
CELL_TYPE_COUNT CELL_TYPE_COUNT
} CellType; } CellType;
@ -112,11 +109,9 @@ typedef enum
*/ */
typedef enum typedef enum
{ {
REG_SINGLE_LINE = 1, REG_STYLE_LEDGER,
REG_DOUBLE_LINE = 2, REG_STYLE_AUTO_LEDGER,
REG_MULTI_LINE = 3, REG_STYLE_JOURNAL
REG_SINGLE_DYNAMIC = 4,
REG_DOUBLE_DYNAMIC = 5
} SplitRegisterStyle; } SplitRegisterStyle;
/* modified flags -- indicate which cell values have been modified by user */ /* modified flags -- indicate which cell values have been modified by user */
@ -125,7 +120,6 @@ typedef enum
#define MOD_NUM 0x0002 #define MOD_NUM 0x0002
#define MOD_DESC 0x0004 #define MOD_DESC 0x0004
#define MOD_RECN 0x0008 #define MOD_RECN 0x0008
#define MOD_ACTN 0x0010 #define MOD_ACTN 0x0010
#define MOD_XFRM 0x0020 #define MOD_XFRM 0x0020
#define MOD_MXFRM 0x0040 #define MOD_MXFRM 0x0040
@ -134,8 +128,7 @@ typedef enum
#define MOD_AMNT 0x0200 #define MOD_AMNT 0x0200
#define MOD_PRIC 0x0400 #define MOD_PRIC 0x0400
#define MOD_SHRS 0x0800 #define MOD_SHRS 0x0800
#define MOD_NEW 0x1000 #define MOD_ALL 0xffff
#define MOD_ALL 0x1fff
/* Types of cursors */ /* Types of cursors */
typedef enum typedef enum
@ -150,9 +143,10 @@ typedef enum
{ {
CURSOR_TYPE_NONE = -1, CURSOR_TYPE_NONE = -1,
CURSOR_TYPE_HEADER, CURSOR_TYPE_HEADER,
CURSOR_TYPE_SINGLE, CURSOR_TYPE_SINGLE_LEDGER,
CURSOR_TYPE_DOUBLE, CURSOR_TYPE_DOUBLE_LEDGER,
CURSOR_TYPE_TRANS, CURSOR_TYPE_SINGLE_JOURNAL,
CURSOR_TYPE_DOUBLE_JOURNAL,
CURSOR_TYPE_SPLIT, CURSOR_TYPE_SPLIT,
NUM_CURSOR_TYPES NUM_CURSOR_TYPES
} CursorType; } CursorType;
@ -167,12 +161,15 @@ struct _SplitRegister
/* the table itself that implements the underlying GUI. */ /* the table itself that implements the underlying GUI. */
Table * table; Table * table;
/* the cursors that define the currently edited row */ /* the cursors that define the register structure */
CellBlock * single_cursor; CellBlock * cursor_header;
CellBlock * double_cursor; CellBlock * cursor_ledger_single;
CellBlock * trans_cursor; CellBlock * cursor_ledger_double;
CellBlock * split_cursor; CellBlock * cursor_journal_single;
CellBlock * header; CellBlock * cursor_journal_double;
CellBlock * cursor_split;
BasicCell * nullCell;
DateCell * dateCell; DateCell * dateCell;
NumCell * numCell; NumCell * numCell;
@ -180,24 +177,24 @@ struct _SplitRegister
RecnCell * recnCell; /* main transaction line reconcile */ RecnCell * recnCell; /* main transaction line reconcile */
PriceCell * shrbalnCell; PriceCell * shrbalnCell;
PriceCell * balanceCell; PriceCell * balanceCell;
BasicCell * nullCell;
ComboCell * actionCell; ComboCell * actionCell;
ComboCell * xfrmCell; ComboCell * xfrmCell;
ComboCell * mxfrmCell;
ComboCell * xtoCell; ComboCell * xtoCell;
QuickFillCell * memoCell; QuickFillCell * memoCell;
PriceCell * creditCell; PriceCell * creditCell;
PriceCell * debitCell; PriceCell * debitCell;
PriceCell * priceCell; PriceCell * priceCell;
PriceCell * sharesCell; PriceCell * sharesCell;
ComboCell * mxfrmCell;
SplitRegisterType type; SplitRegisterType type;
SplitRegisterStyle style; SplitRegisterStyle style;
gboolean use_double_line;
/* some private data; outsiders should not access this */ /* some private data; outsiders should not access this */
BasicCell *header_cells[CELL_TYPE_COUNT]; BasicCell *header_cells[CELL_TYPE_COUNT];
BasicCell *cells[CELL_TYPE_COUNT];
/* user_data allows users of this object to hang /* user_data allows users of this object to hang
* private data onto it */ * private data onto it */
@ -217,6 +214,7 @@ void xaccSplitRegisterSetCreditStringGetter(SRStringGetter getter);
SplitRegister * SplitRegister *
xaccMallocSplitRegister (SplitRegisterType type, xaccMallocSplitRegister (SplitRegisterType type,
SplitRegisterStyle style, SplitRegisterStyle style,
gboolean use_double_line,
TableGetEntryHandler entry_handler, TableGetEntryHandler entry_handler,
TableGetFGColorHandler fg_color_handler, TableGetFGColorHandler fg_color_handler,
TableGetBGColorHandler bg_color_handler, TableGetBGColorHandler bg_color_handler,
@ -226,7 +224,8 @@ xaccMallocSplitRegister (SplitRegisterType type,
void xaccConfigSplitRegister (SplitRegister *reg, void xaccConfigSplitRegister (SplitRegister *reg,
SplitRegisterType type, SplitRegisterType type,
SplitRegisterStyle style); SplitRegisterStyle style,
gboolean use_double_line);
void xaccDestroySplitRegister (SplitRegister *reg); void xaccDestroySplitRegister (SplitRegister *reg);

View File

@ -865,11 +865,9 @@ gnc_table_enter_update(Table *table,
/* ==================================================== */ /* ==================================================== */
const char * void
gnc_table_leave_update(Table *table, gnc_table_leave_update(Table *table, VirtualLocation virt_loc)
VirtualLocation virt_loc)
{ {
const char *retval;
gboolean changed = FALSE; gboolean changed = FALSE;
CellLeaveFunc leave; CellLeaveFunc leave;
CellBlockCell *cb_cell; CellBlockCell *cb_cell;
@ -893,6 +891,9 @@ gnc_table_leave_update(Table *table,
/* OK, if there is a callback for this cell, call it */ /* OK, if there is a callback for this cell, call it */
cb_cell = gnc_cellblock_get_cell (cb, cell_row, cell_col); cb_cell = gnc_cellblock_get_cell (cb, cell_row, cell_col);
if (!cb_cell || !cb_cell->cell)
return;
cell = cb_cell->cell; cell = cb_cell->cell;
leave = cell->leave_cell; leave = cell->leave_cell;
@ -912,15 +913,6 @@ gnc_table_leave_update(Table *table,
g_free (old_value); g_free (old_value);
} }
if (changed)
retval = cell->value;
else
retval = NULL;
LEAVE("return %s\n", retval);
return retval;
} }
/* ==================================================== */ /* ==================================================== */

View File

@ -355,8 +355,7 @@ gboolean gnc_table_enter_update(Table *table,
int *start_selection, int *start_selection,
int *end_selection); int *end_selection);
const char * gnc_table_leave_update(Table *table, void gnc_table_leave_update(Table *table, VirtualLocation virt_loc);
VirtualLocation virt_loc);
const char * gnc_table_modify_update(Table *table, const char * gnc_table_modify_update(Table *table,
VirtualLocation virt_loc, VirtualLocation virt_loc,

View File

@ -125,15 +125,12 @@ gnc_table_init_gui (gncUIWidget widget, void *data)
/* config the cell-block styles */ /* config the cell-block styles */
gnucash_sheet_set_cursor (sheet, sr->header, CURSOR_TYPE_HEADER); gnucash_sheet_set_cursor (sheet, sr->cursor_header);
gnucash_sheet_set_cursor (sheet, sr->single_cursor, gnucash_sheet_set_cursor (sheet, sr->cursor_ledger_single);
CURSOR_TYPE_SINGLE); gnucash_sheet_set_cursor (sheet, sr->cursor_ledger_double);
gnucash_sheet_set_cursor (sheet, sr->double_cursor, gnucash_sheet_set_cursor (sheet, sr->cursor_journal_single);
CURSOR_TYPE_DOUBLE); gnucash_sheet_set_cursor (sheet, sr->cursor_journal_double);
gnucash_sheet_set_cursor (sheet, sr->trans_cursor, gnucash_sheet_set_cursor (sheet, sr->cursor_split);
CURSOR_TYPE_TRANS);
gnucash_sheet_set_cursor (sheet, sr->split_cursor,
CURSOR_TYPE_SPLIT);
for (i = 0; i < CELL_TYPE_COUNT; i++) for (i = 0; i < CELL_TYPE_COUNT; i++)
header_widths[i] = -1; header_widths[i] = -1;
@ -156,7 +153,7 @@ gnc_table_init_gui (gncUIWidget widget, void *data)
name = gh_scm2newstr(gh_car (assoc), NULL); name = gh_scm2newstr(gh_car (assoc), NULL);
ctype = xaccSplitRegisterGetCellTypeFromName (name); ctype = xaccSplitRegisterGetCellTypeFromName (name);
if (name) if (name)
free((void *)name); free(name);
if (ctype == NO_CELL) if (ctype == NO_CELL)
continue; continue;

View File

@ -202,19 +202,19 @@ the account instead of opening a register." #f))
(gnc:register-configuration-option (gnc:register-configuration-option
(gnc:make-multichoice-option (gnc:make-multichoice-option
"Register" "Default Register Mode" "Register" "Default Register Style"
"a" "Choose the default mode for register windows" "a" "Default style for register windows"
'single_line 'ledger
(list #(single_line "Single Line" "Show transactions on single lines") (list #(ledger "Ledger" "Show transactions on one or two lines")
#(double_line "Double Line" #(auto_ledger "Auto Ledger"
"Show transactions on two lines with more information") "Show transactions on one or two lines and expand the current transaction")
#(multi_line "Multi Line" #(journal "Journal"
"Show transactions on multiple lines with one line for each split in the transaction") "Show expanded transactions with all splits"))))
#(auto_single "Auto Single"
"Single line mode with a multi-line cursor") (gnc:register-configuration-option
#(auto_double "Auto Double" (gnc:make-simple-boolean-option
"Double line mode with a multi-line cursor") "Register" "Double Line Mode"
))) "aa" "Show two lines of information for each transaction" #f))
(gnc:register-configuration-option (gnc:register-configuration-option
(gnc:make-simple-boolean-option (gnc:make-simple-boolean-option