mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
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:
parent
598fbe8743
commit
a639f7e1f0
@ -145,7 +145,7 @@ xaccLedgerDisplaySimple (Account *account)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return xaccLedgerDisplayGeneral (account, NULL, reg_type, REG_SINGLE_LINE);
|
||||
return xaccLedgerDisplayGeneral (account, NULL, reg_type, REG_STYLE_LEDGER);
|
||||
}
|
||||
|
||||
static GList *
|
||||
@ -236,7 +236,7 @@ xaccLedgerDisplayAccGroup (Account *account)
|
||||
}
|
||||
|
||||
ledger_display = xaccLedgerDisplayGeneral (account, accounts, ledger_type,
|
||||
REG_SINGLE_LINE);
|
||||
REG_STYLE_LEDGER);
|
||||
|
||||
g_list_free (accounts);
|
||||
|
||||
@ -406,7 +406,7 @@ xaccLedgerDisplayGeneral (Account *lead_account, GList *accounts,
|
||||
|
||||
/* xaccMallocSplitRegister will malloc & initialize the register,
|
||||
* but will not do the gui init */
|
||||
regData->ledger = xaccMallocSplitRegister (type, style,
|
||||
regData->ledger = xaccMallocSplitRegister (type, style, FALSE,
|
||||
xaccSRGetEntryHandler,
|
||||
xaccSRGetFGColorHandler,
|
||||
xaccSRGetBGColorHandler,
|
||||
|
@ -297,7 +297,7 @@ xaccSRGetParent(SplitRegister *reg)
|
||||
if (info->get_parent == NULL)
|
||||
return NULL;
|
||||
|
||||
return (info->get_parent)(info->user_data);
|
||||
return info->get_parent(info->user_data);
|
||||
}
|
||||
|
||||
void
|
||||
@ -307,7 +307,7 @@ xaccSRSetData(SplitRegister *reg, void *user_data,
|
||||
{
|
||||
SRInfo *info = xaccSRGetInfo(reg);
|
||||
|
||||
assert(reg != NULL);
|
||||
g_return_if_fail (reg != NULL);
|
||||
|
||||
info->user_data = user_data;
|
||||
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
|
||||
* 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_split;
|
||||
CursorClass new_class;
|
||||
gboolean do_refresh;
|
||||
gboolean saved;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
info->hint_set_by_traverse = FALSE;
|
||||
|
||||
/* commit the contents of the cursor into the database */
|
||||
saved = xaccSRSaveRegEntry (reg, old_trans != new_trans);
|
||||
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
|
||||
* and show the new. */
|
||||
if (((REG_SINGLE_DYNAMIC == reg->style) ||
|
||||
(REG_DOUBLE_DYNAMIC == reg->style) ||
|
||||
(REG_MULTI_LINE == reg->style)) &&
|
||||
if (((REG_STYLE_AUTO_LEDGER == reg->style) ||
|
||||
(REG_STYLE_JOURNAL == reg->style)) &&
|
||||
(old_trans_split != new_trans_split))
|
||||
{
|
||||
xaccSRSetTransVisible (reg, old_trans_split_loc, FALSE,
|
||||
REG_MULTI_LINE == reg->style);
|
||||
VirtualCellLocation vc_loc;
|
||||
|
||||
xaccSRSetTransVisible (reg, new_virt_loc.vcell_loc, TRUE,
|
||||
REG_MULTI_LINE == reg->style);
|
||||
vc_loc = old_trans_split_loc;
|
||||
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_split = new_split;
|
||||
info->cursor_hint_trans_split = new_trans_split;
|
||||
info->cursor_hint_cursor_class = new_class;
|
||||
|
||||
info->hint_set_by_traverse = FALSE;
|
||||
|
||||
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,
|
||||
@ -1380,7 +1417,6 @@ xaccSRGetSplitVirtLoc (SplitRegister *reg, Split *split,
|
||||
Table *table;
|
||||
int v_row;
|
||||
int v_col;
|
||||
Split *s;
|
||||
|
||||
if ((reg == NULL) || (split == NULL))
|
||||
return FALSE;
|
||||
@ -1394,8 +1430,17 @@ xaccSRGetSplitVirtLoc (SplitRegister *reg, Split *split,
|
||||
for (v_col = 0; v_col < table->num_virt_cols; 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)
|
||||
{
|
||||
@ -3197,8 +3242,8 @@ xaccSRGetBGColorHandler (VirtualLocation virt_loc, gpointer user_data)
|
||||
case CURSOR_TYPE_HEADER:
|
||||
return reg_colors.header_bg_color;
|
||||
|
||||
case CURSOR_TYPE_TRANS:
|
||||
case CURSOR_TYPE_SINGLE:
|
||||
case CURSOR_TYPE_SINGLE_JOURNAL:
|
||||
case CURSOR_TYPE_SINGLE_LEDGER:
|
||||
if (is_current)
|
||||
return vcell->start_primary_color ?
|
||||
reg_colors.primary_active_bg_color :
|
||||
@ -3207,7 +3252,8 @@ xaccSRGetBGColorHandler (VirtualLocation virt_loc, gpointer user_data)
|
||||
return vcell->start_primary_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 (reg_colors.double_alternate_virt)
|
||||
@ -3250,6 +3296,7 @@ sr_add_transaction (SplitRegister *reg,
|
||||
CellBlock *lead_cursor,
|
||||
gboolean visible_splits,
|
||||
gboolean start_primary_color,
|
||||
gboolean add_blank,
|
||||
Split *find_split,
|
||||
CursorClass find_class,
|
||||
int *new_split_row,
|
||||
@ -3262,13 +3309,13 @@ sr_add_transaction (SplitRegister *reg,
|
||||
CellBlock *lead_cursor,
|
||||
gboolean visible_splits,
|
||||
gboolean start_primary_color,
|
||||
gboolean add_blank,
|
||||
Split *find_split,
|
||||
CursorClass find_class,
|
||||
int *new_split_row,
|
||||
VirtualCellLocation *vcell_loc)
|
||||
{
|
||||
Split *secondary;
|
||||
int i = 0;
|
||||
GList *node;
|
||||
|
||||
if (split == find_split)
|
||||
*new_split_row = vcell_loc->virt_row;
|
||||
@ -3277,25 +3324,24 @@ sr_add_transaction (SplitRegister *reg,
|
||||
TRUE, start_primary_color, *vcell_loc);
|
||||
vcell_loc->virt_row++;
|
||||
|
||||
do
|
||||
for (node = xaccTransGetSplitList (trans); node; node = node->next)
|
||||
{
|
||||
secondary = xaccTransGetSplit (trans, i++);
|
||||
if (secondary == NULL)
|
||||
break;
|
||||
Split *secondary = node->data;
|
||||
|
||||
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,
|
||||
xaccSplitGetGUID (secondary),
|
||||
visible_splits, TRUE, *vcell_loc);
|
||||
vcell_loc->virt_row++;
|
||||
}
|
||||
} while (TRUE);
|
||||
gnc_table_set_vcell (reg->table, reg->cursor_split,
|
||||
xaccSplitGetGUID (secondary),
|
||||
visible_splits, TRUE, *vcell_loc);
|
||||
vcell_loc->virt_row++;
|
||||
}
|
||||
|
||||
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);
|
||||
vcell_loc->virt_row++;
|
||||
}
|
||||
@ -3357,17 +3403,10 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist,
|
||||
|
||||
table = reg->table;
|
||||
|
||||
multi_line = (REG_MULTI_LINE == reg->style);
|
||||
dynamic = ((REG_SINGLE_DYNAMIC == reg->style) ||
|
||||
(REG_DOUBLE_DYNAMIC == reg->style));
|
||||
multi_line = (reg->style == REG_STYLE_JOURNAL);
|
||||
dynamic = (reg->style == REG_STYLE_AUTO_LEDGER);
|
||||
|
||||
if ((REG_SINGLE_LINE == reg->style) ||
|
||||
(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;
|
||||
lead_cursor = sr_get_lead_cursor (reg);
|
||||
|
||||
/* figure out where we are going to. */
|
||||
find_trans = info->cursor_hint_trans;
|
||||
@ -3407,7 +3446,7 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist,
|
||||
/* make sure that the header is loaded */
|
||||
vcell_loc.virt_row = 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++;
|
||||
|
||||
/* 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;
|
||||
|
||||
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);
|
||||
|
||||
if (!multi_line)
|
||||
@ -3496,8 +3535,8 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist,
|
||||
new_trans_split_row = vcell_loc.virt_row;
|
||||
|
||||
sr_add_transaction (reg, trans, split, lead_cursor, multi_line,
|
||||
start_primary_color, find_split, find_class,
|
||||
&new_split_row, &vcell_loc);
|
||||
start_primary_color, info->blank_split_edited,
|
||||
find_split, find_class, &new_split_row, &vcell_loc);
|
||||
|
||||
/* resize the table to the sizes we just counted above */
|
||||
/* 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_loc.vcell_loc);
|
||||
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);
|
||||
}
|
||||
else
|
||||
save_loc = trans_split_loc;
|
||||
|
||||
|
@ -1992,6 +1992,14 @@ xaccTransGetSplit (Transaction *trans, int i)
|
||||
return g_list_nth_data (trans->splits, i);
|
||||
}
|
||||
|
||||
GList *
|
||||
xaccTransGetSplitList (Transaction *trans)
|
||||
{
|
||||
if (!trans) return NULL;
|
||||
|
||||
return trans->splits;
|
||||
}
|
||||
|
||||
const char *
|
||||
xaccTransGetNum (Transaction *trans)
|
||||
{
|
||||
|
@ -203,6 +203,10 @@ void xaccSplitDestroy (Split *split);
|
||||
*/
|
||||
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,
|
||||
* and the date field.
|
||||
*/
|
||||
|
@ -500,7 +500,7 @@ gnc_ui_find_transactions_dialog_ok_cb(GtkButton * button,
|
||||
new_ledger = TRUE;
|
||||
ftd->ledger = xaccLedgerDisplayGeneral(NULL, NULL,
|
||||
SEARCH_LEDGER,
|
||||
REG_SINGLE_LINE);
|
||||
REG_STYLE_JOURNAL);
|
||||
xaccFreeQuery(ftd->ledger->query);
|
||||
}
|
||||
|
||||
|
@ -261,23 +261,19 @@ gnc_register_jump_to_split_amount(RegWindow *regData, Split *split)
|
||||
static SplitRegisterStyle
|
||||
gnc_get_default_register_style()
|
||||
{
|
||||
SplitRegisterStyle new_style = REG_SINGLE_LINE;
|
||||
SplitRegisterStyle new_style = REG_STYLE_LEDGER;
|
||||
char *style_string;
|
||||
|
||||
style_string = gnc_lookup_multichoice_option("Register",
|
||||
"Default Register Mode",
|
||||
"single_line");
|
||||
"ledger");
|
||||
|
||||
if (safe_strcmp(style_string, "single_line") == 0)
|
||||
new_style = REG_SINGLE_LINE;
|
||||
else if (safe_strcmp(style_string, "double_line") == 0)
|
||||
new_style = REG_DOUBLE_LINE;
|
||||
else if (safe_strcmp(style_string, "multi_line") == 0)
|
||||
new_style = REG_MULTI_LINE;
|
||||
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 (safe_strcmp(style_string, "ledger") == 0)
|
||||
new_style = REG_STYLE_LEDGER;
|
||||
else if (safe_strcmp(style_string, "auto_ledger") == 0)
|
||||
new_style = REG_STYLE_AUTO_LEDGER;
|
||||
else if (safe_strcmp(style_string, "journal") == 0)
|
||||
new_style = REG_STYLE_JOURNAL;
|
||||
|
||||
if (style_string != NULL)
|
||||
free(style_string);
|
||||
@ -294,53 +290,54 @@ gnc_register_change_style(RegWindow *regData, SplitRegisterStyle style)
|
||||
if (style == reg->style)
|
||||
return;
|
||||
|
||||
xaccConfigSplitRegister(reg, reg->type, style);
|
||||
xaccConfigSplitRegister(reg, reg->type, style, reg->use_double_line);
|
||||
|
||||
regData->ledger->dirty = 1;
|
||||
xaccLedgerDisplayRefresh(regData->ledger);
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_register_style_single_cb(GtkWidget *w, gpointer data)
|
||||
gnc_register_style_ledger_cb(GtkWidget *w, gpointer data)
|
||||
{
|
||||
RegWindow *regData = data;
|
||||
|
||||
gnc_register_change_style(regData, REG_SINGLE_LINE);
|
||||
gnc_register_change_style(regData, REG_STYLE_LEDGER);
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_register_style_double_cb(GtkWidget *w, gpointer data)
|
||||
gnc_register_style_auto_ledger_cb(GtkWidget *w, gpointer data)
|
||||
{
|
||||
RegWindow *regData = data;
|
||||
|
||||
gnc_register_change_style(regData, REG_DOUBLE_LINE);
|
||||
gnc_register_change_style(regData, REG_STYLE_AUTO_LEDGER);
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_register_style_multi_cb(GtkWidget *w, gpointer data)
|
||||
gnc_register_style_journal_cb(GtkWidget *w, gpointer data)
|
||||
{
|
||||
RegWindow *regData = data;
|
||||
|
||||
gnc_register_change_style(regData, REG_MULTI_LINE);
|
||||
gnc_register_change_style(regData, REG_STYLE_JOURNAL);
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_register_style_auto_single_cb(GtkWidget *w, gpointer data)
|
||||
gnc_register_double_line_cb (GtkWidget *w, gpointer 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
|
||||
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)
|
||||
return;
|
||||
|
||||
switch(sort_code)
|
||||
switch (sort_code)
|
||||
{
|
||||
case BY_STANDARD:
|
||||
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[] =
|
||||
{
|
||||
GNOMEUIINFO_RADIOITEM_DATA(N_("Single Line"),
|
||||
N_("Show transactions on single lines"),
|
||||
gnc_register_style_single_cb, NULL, NULL),
|
||||
GNOMEUIINFO_RADIOITEM_DATA(N_("Double Line"),
|
||||
N_("Show transactions on two lines with "
|
||||
"more information"),
|
||||
gnc_register_style_double_cb, NULL, NULL),
|
||||
GNOMEUIINFO_RADIOITEM_DATA(N_("Multi Line"),
|
||||
N_("Show transactions on multiple lines with "
|
||||
"one line for each split"),
|
||||
gnc_register_style_multi_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_RADIOITEM_DATA(N_("Ledger"),
|
||||
N_("Show transactions on one or two lines"),
|
||||
gnc_register_style_ledger_cb, NULL, NULL),
|
||||
GNOMEUIINFO_RADIOITEM_DATA(N_("Auto Ledger"),
|
||||
N_("Show transactions on one or two lines and "
|
||||
"expand the current transaction"),
|
||||
gnc_register_style_auto_ledger_cb, NULL, NULL),
|
||||
GNOMEUIINFO_RADIOITEM_DATA(N_("Journal"),
|
||||
N_("Show expanded transactions with all "
|
||||
"splits"),
|
||||
gnc_register_style_journal_cb, NULL, NULL),
|
||||
GNOMEUIINFO_END
|
||||
};
|
||||
|
||||
static GnomeUIInfo style_menu[] =
|
||||
{
|
||||
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
|
||||
};
|
||||
|
||||
@ -1396,21 +1390,15 @@ gnc_register_create_menu_bar(RegWindow *regData, GtkWidget *statusbar)
|
||||
switch (gnc_get_default_register_style())
|
||||
{
|
||||
default:
|
||||
case REG_SINGLE_LINE:
|
||||
case REG_STYLE_LEDGER:
|
||||
index = 0;
|
||||
break;
|
||||
case REG_DOUBLE_LINE:
|
||||
case REG_STYLE_AUTO_LEDGER:
|
||||
index = 1;
|
||||
break;
|
||||
case REG_MULTI_LINE:
|
||||
case REG_STYLE_JOURNAL:
|
||||
index = 2;
|
||||
break;
|
||||
case REG_SINGLE_DYNAMIC:
|
||||
index = 3;
|
||||
break;
|
||||
case REG_DOUBLE_DYNAMIC:
|
||||
index = 4;
|
||||
break;
|
||||
}
|
||||
|
||||
widget = style_list[index].widget;
|
||||
@ -1515,7 +1503,7 @@ gnc_register_record_cb(GnucashRegister *reg, gpointer data)
|
||||
SplitRegister *sr = regData->ledger->ledger;
|
||||
SplitRegisterStyle style = sr->style;
|
||||
|
||||
if ((style == REG_SINGLE_LINE) || (style == REG_DOUBLE_LINE))
|
||||
if (style == REG_STYLE_LEDGER)
|
||||
{
|
||||
Split *blank_split;
|
||||
|
||||
@ -1748,9 +1736,18 @@ regWindowLedger(xaccLedgerDisplay *ledger)
|
||||
popup, regData);
|
||||
}
|
||||
|
||||
/* be sure to initialize the gui elements associated with the cursor */
|
||||
xaccConfigSplitRegister(ledger->ledger, ledger->type,
|
||||
gnc_get_default_register_style());
|
||||
{
|
||||
gboolean use_double_line;
|
||||
|
||||
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 */
|
||||
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
|
||||
* mode, we just delete the whole transaction, kerblooie */
|
||||
if ((xaccTransCountSplits(trans) <= 2) &&
|
||||
((style == REG_SINGLE_LINE) || (style == REG_DOUBLE_LINE)))
|
||||
if ((xaccTransCountSplits(trans) <= 2) && (style == REG_STYLE_LEDGER))
|
||||
{
|
||||
const char *message = _("Are you sure you want to delete the current "
|
||||
"transaction?");
|
||||
|
@ -68,15 +68,15 @@ static guint register_signals[LAST_SIGNAL];
|
||||
|
||||
|
||||
void
|
||||
gnucash_sheet_set_cursor (GnucashSheet *sheet, CellBlock *cursor,
|
||||
CursorType cursor_type)
|
||||
gnucash_sheet_set_cursor (GnucashSheet *sheet, CellBlock *cursor)
|
||||
{
|
||||
g_return_if_fail (sheet != NULL);
|
||||
g_return_if_fail (GNUCASH_IS_SHEET (sheet));
|
||||
g_return_if_fail (cursor_type >= 0);
|
||||
g_return_if_fail (cursor_type < NUM_CURSOR_TYPES);
|
||||
g_return_if_fail (cursor != NULL);
|
||||
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
|
||||
|
@ -168,8 +168,7 @@ void gnucash_sheet_compute_visible_range (GnucashSheet *sheet);
|
||||
void gnucash_sheet_make_cell_visible (GnucashSheet *sheet,
|
||||
VirtualLocation virt_loc);
|
||||
|
||||
void gnucash_sheet_set_cursor (GnucashSheet *sheet, CellBlock *cursor,
|
||||
CursorType cursor_type);
|
||||
void gnucash_sheet_set_cursor (GnucashSheet *sheet, CellBlock *cursor);
|
||||
|
||||
void gnucash_sheet_update_adjustments (GnucashSheet *sheet);
|
||||
|
||||
|
@ -50,13 +50,14 @@ style_get_key (SheetBlockStyle *style)
|
||||
{
|
||||
switch (style->cursor_type) {
|
||||
case CURSOR_TYPE_HEADER:
|
||||
case CURSOR_TYPE_SINGLE:
|
||||
case CURSOR_TYPE_TRANS:
|
||||
case CURSOR_TYPE_SINGLE_LEDGER:
|
||||
case CURSOR_TYPE_SINGLE_JOURNAL:
|
||||
case CURSOR_TYPE_SPLIT:
|
||||
return "singles";
|
||||
break;
|
||||
|
||||
case CURSOR_TYPE_DOUBLE:
|
||||
case CURSOR_TYPE_DOUBLE_LEDGER:
|
||||
case CURSOR_TYPE_DOUBLE_JOURNAL:
|
||||
return "doubles";
|
||||
break;
|
||||
|
||||
|
@ -100,27 +100,31 @@ static char *cell_sample_strings[] =
|
||||
N_("sample:Expenses:Automobile:Gasoline"+7), /* mxfrm cell */
|
||||
};
|
||||
|
||||
#define DATE_CELL_ALIGN CELL_ALIGN_RIGHT
|
||||
#define NUM_CELL_ALIGN CELL_ALIGN_LEFT
|
||||
#define ACTN_CELL_ALIGN CELL_ALIGN_LEFT
|
||||
#define XFRM_CELL_ALIGN CELL_ALIGN_RIGHT
|
||||
#define MXFRM_CELL_ALIGN CELL_ALIGN_RIGHT
|
||||
#define XTO_CELL_ALIGN CELL_ALIGN_RIGHT
|
||||
#define DESC_CELL_ALIGN CELL_ALIGN_LEFT
|
||||
#define MEMO_CELL_ALIGN CELL_ALIGN_LEFT
|
||||
#define RECN_CELL_ALIGN CELL_ALIGN_CENTER
|
||||
#define DEBT_CELL_ALIGN CELL_ALIGN_RIGHT
|
||||
#define CRED_CELL_ALIGN CELL_ALIGN_RIGHT
|
||||
#define PRIC_CELL_ALIGN CELL_ALIGN_RIGHT
|
||||
#define SHRS_CELL_ALIGN CELL_ALIGN_RIGHT
|
||||
#define SHRBALN_CELL_ALIGN CELL_ALIGN_RIGHT
|
||||
#define BALN_CELL_ALIGN CELL_ALIGN_RIGHT
|
||||
static CellAlignment cell_alignments[] =
|
||||
{
|
||||
CELL_ALIGN_RIGHT, /* date cell */
|
||||
CELL_ALIGN_LEFT, /* num cell */
|
||||
CELL_ALIGN_LEFT, /* desc cell */
|
||||
CELL_ALIGN_CENTER, /* recn cell */
|
||||
CELL_ALIGN_RIGHT, /* share balance cell */
|
||||
CELL_ALIGN_RIGHT, /* balance cell */
|
||||
CELL_ALIGN_LEFT, /* action cell */
|
||||
CELL_ALIGN_RIGHT, /* xfrm cell */
|
||||
CELL_ALIGN_RIGHT, /* xto cell */
|
||||
CELL_ALIGN_LEFT, /* memo cell */
|
||||
CELL_ALIGN_RIGHT, /* credit cell */
|
||||
CELL_ALIGN_RIGHT, /* debit cell */
|
||||
CELL_ALIGN_RIGHT, /* price cell */
|
||||
CELL_ALIGN_RIGHT, /* shares cell */
|
||||
CELL_ALIGN_RIGHT, /* mxfrm cell */
|
||||
};
|
||||
|
||||
|
||||
static void
|
||||
xaccInitSplitRegister (SplitRegister *reg,
|
||||
SplitRegisterType type,
|
||||
SplitRegisterStyle style,
|
||||
gboolean use_double_line,
|
||||
TableGetEntryHandler entry_handler,
|
||||
TableGetFGColorHandler fg_color_handler,
|
||||
TableGetBGColorHandler bg_color_handler,
|
||||
@ -297,47 +301,61 @@ configAction (SplitRegister *reg)
|
||||
|
||||
/* ============================================== */
|
||||
|
||||
#define SET(NAME,col,row,handler) \
|
||||
{ \
|
||||
BasicCell *hcell; \
|
||||
hcell = reg->header_cells[NAME##_CELL]; \
|
||||
\
|
||||
if ((0<=row) && (0<=col)) { \
|
||||
CellBlockCell *cb_cell; \
|
||||
\
|
||||
cb_cell = gnc_cellblock_get_cell (curs, row, col); \
|
||||
\
|
||||
cb_cell->cell = (handler); \
|
||||
cb_cell->cell_type = NAME##_CELL; \
|
||||
cb_cell->label = g_strdup (hcell->value); \
|
||||
cb_cell->sample_text = \
|
||||
g_strdup (_(cell_sample_strings[NAME##_CELL])); \
|
||||
cb_cell->alignment = NAME##_CELL_ALIGN; \
|
||||
cb_cell->expandable = \
|
||||
((handler) == (BasicCell *) reg->descCell); \
|
||||
cb_cell->span = \
|
||||
((handler) == (BasicCell *) reg->memoCell); \
|
||||
\
|
||||
cb_cell = gnc_cellblock_get_cell (header, row, col); \
|
||||
if (cb_cell && (curs == reg->single_cursor)) { \
|
||||
cb_cell->cell = hcell; \
|
||||
cb_cell->cell_type = NAME##_CELL; \
|
||||
cb_cell->label = g_strdup (hcell->value); \
|
||||
cb_cell->sample_text = \
|
||||
g_strdup (_(cell_sample_strings[NAME##_CELL])); \
|
||||
cb_cell->alignment = NAME##_CELL_ALIGN; \
|
||||
cb_cell->expandable = \
|
||||
((handler) == (BasicCell *) reg->descCell); \
|
||||
cb_cell->span = \
|
||||
((handler) == (BasicCell *) reg->memoCell); \
|
||||
} \
|
||||
} \
|
||||
static void
|
||||
set_cell (SplitRegister *reg, CellBlock *cursor,
|
||||
CellType cell_type, short row, short col)
|
||||
{
|
||||
CellBlockCell *cb_cell;
|
||||
BasicCell *hcell;
|
||||
|
||||
hcell = reg->header_cells[cell_type];
|
||||
|
||||
cb_cell = gnc_cellblock_get_cell (cursor, row, col);
|
||||
|
||||
cb_cell->cell = reg->cells[cell_type];
|
||||
cb_cell->cell_type = cell_type;
|
||||
cb_cell->label = g_strdup (hcell->value);
|
||||
cb_cell->sample_text = g_strdup (_(cell_sample_strings[cell_type]));
|
||||
cb_cell->alignment = cell_alignments[cell_type];
|
||||
cb_cell->expandable = reg->cells[cell_type] == (BasicCell *) reg->descCell;
|
||||
cb_cell->span = reg->cells[cell_type] == (BasicCell *) reg->memoCell;
|
||||
|
||||
cb_cell = gnc_cellblock_get_cell (reg->cursor_header, row, col);
|
||||
|
||||
if (cb_cell && (cursor == reg->cursor_ledger_single))
|
||||
{
|
||||
cb_cell->cell = reg->cells[cell_type];
|
||||
cb_cell->cell_type = cell_type;
|
||||
cb_cell->label = g_strdup (hcell->value);
|
||||
cb_cell->sample_text = g_strdup (_(cell_sample_strings[cell_type]));
|
||||
cb_cell->alignment = cell_alignments[cell_type];
|
||||
cb_cell->expandable =
|
||||
reg->cells[cell_type] == (BasicCell *) reg->descCell;
|
||||
cb_cell->span = reg->cells[cell_type] == (BasicCell *) reg->memoCell;
|
||||
}
|
||||
}
|
||||
|
||||
/* SET_CELL macro initializes cells in the register */
|
||||
|
||||
#define SET_CELL(NAME,CN,col,row) { \
|
||||
SET (NAME, col, row, &(reg->CN##Cell->cell)); \
|
||||
#define SET_CELL(NAME,col,row) { \
|
||||
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
|
||||
configLayout (SplitRegister *reg)
|
||||
{
|
||||
CellBlock *curs, *header;
|
||||
CellBlock *curs;
|
||||
int i;
|
||||
|
||||
/* define header for macros */
|
||||
header = reg->header;
|
||||
|
||||
/* 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;
|
||||
|
||||
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 = 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 = 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 = 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 = 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 = 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;
|
||||
}
|
||||
|
||||
@ -386,44 +407,42 @@ configLayout (SplitRegister *reg)
|
||||
case EXPENSE_REGISTER:
|
||||
case EQUITY_REGISTER:
|
||||
{
|
||||
curs = reg->double_cursor;
|
||||
SET_CELL (DATE, date, 0, 0);
|
||||
SET_CELL (NUM, num, 1, 0);
|
||||
SET_CELL (DESC, desc, 2, 0);
|
||||
SET_CELL (MXFRM, mxfrm, 3, 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->cursor_ledger_single;
|
||||
SET_CELL (DATE, 0, 0);
|
||||
SET_CELL (NUM, 1, 0);
|
||||
SET_CELL (DESC, 2, 0);
|
||||
SET_CELL (MXFRM, 3, 0);
|
||||
SET_CELL (RECN, 4, 0);
|
||||
SET_CELL (DEBT, 5, 0);
|
||||
SET_CELL (CRED, 6, 0);
|
||||
SET_CELL (BALN, 7, 0);
|
||||
|
||||
SET_CELL (ACTN, action, 1, 1);
|
||||
SET_CELL (MEMO, memo, 2, 1);
|
||||
curs = reg->cursor_ledger_double;
|
||||
copy_cursor_row (reg, curs, reg->cursor_ledger_single, 0);
|
||||
|
||||
curs = reg->trans_cursor;
|
||||
SET_CELL (DATE, date, 0, 0);
|
||||
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);
|
||||
SET_CELL (ACTN, 1, 1);
|
||||
SET_CELL (MEMO, 2, 1);
|
||||
|
||||
curs = reg->split_cursor;
|
||||
SET_CELL (ACTN, action, 1, 0);
|
||||
SET_CELL (MEMO, memo, 2, 0);
|
||||
SET_CELL (XFRM, xfrm, 3, 0);
|
||||
SET_CELL (DEBT, debit, 5, 0);
|
||||
SET_CELL (CRED, credit, 6, 0);
|
||||
curs = reg->cursor_journal_single;
|
||||
SET_CELL (DATE, 0, 0);
|
||||
SET_CELL (NUM, 1, 0);
|
||||
SET_CELL (DESC, 2, 0);
|
||||
SET_CELL (RECN, 4, 0);
|
||||
SET_CELL (DEBT, 5, 0);
|
||||
SET_CELL (CRED, 6, 0);
|
||||
SET_CELL (BALN, 7, 0);
|
||||
|
||||
curs = reg->single_cursor;
|
||||
SET_CELL (DATE, date, 0, 0);
|
||||
SET_CELL (NUM, num, 1, 0);
|
||||
SET_CELL (DESC, desc, 2, 0);
|
||||
SET_CELL (MXFRM, mxfrm, 3, 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->cursor_journal_double;
|
||||
copy_cursor_row (reg, curs, reg->cursor_journal_single, 0);
|
||||
|
||||
SET_CELL (MEMO, 2, 1);
|
||||
|
||||
curs = reg->cursor_split;
|
||||
SET_CELL (ACTN, 1, 0);
|
||||
SET_CELL (MEMO, 2, 0);
|
||||
SET_CELL (XFRM, 3, 0);
|
||||
SET_CELL (DEBT, 5, 0);
|
||||
SET_CELL (CRED, 6, 0);
|
||||
|
||||
break;
|
||||
}
|
||||
@ -433,44 +452,42 @@ configLayout (SplitRegister *reg)
|
||||
case GENERAL_LEDGER:
|
||||
case SEARCH_LEDGER:
|
||||
{
|
||||
curs = reg->double_cursor;
|
||||
SET_CELL (DATE, date, 0, 0);
|
||||
SET_CELL (NUM, num, 1, 0);
|
||||
SET_CELL (DESC, desc, 2, 0);
|
||||
SET_CELL (XTO, xto, 3, 0);
|
||||
SET_CELL (MXFRM, mxfrm, 4, 0);
|
||||
SET_CELL (RECN, recn, 5, 0);
|
||||
SET_CELL (DEBT, debit, 6, 0);
|
||||
SET_CELL (CRED, credit, 7, 0);
|
||||
curs = reg->cursor_ledger_single;
|
||||
SET_CELL (DATE, 0, 0);
|
||||
SET_CELL (NUM, 1, 0);
|
||||
SET_CELL (DESC, 2, 0);
|
||||
SET_CELL (XTO, 3, 0);
|
||||
SET_CELL (MXFRM, 4, 0);
|
||||
SET_CELL (RECN, 5, 0);
|
||||
SET_CELL (DEBT, 6, 0);
|
||||
SET_CELL (CRED, 7, 0);
|
||||
|
||||
SET_CELL (ACTN, action, 1, 1);
|
||||
SET_CELL (MEMO, memo, 2, 1);
|
||||
curs = reg->cursor_ledger_double;
|
||||
copy_cursor_row (reg, curs, reg->cursor_ledger_single, 0);
|
||||
|
||||
curs = reg->trans_cursor;
|
||||
SET_CELL (DATE, date, 0, 0);
|
||||
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);
|
||||
SET_CELL (ACTN, 1, 1);
|
||||
SET_CELL (MEMO, 2, 1);
|
||||
|
||||
curs = reg->split_cursor;
|
||||
SET_CELL (ACTN, action, 1, 0);
|
||||
SET_CELL (MEMO, memo, 2, 0);
|
||||
SET_CELL (XFRM, xfrm, 4, 0);
|
||||
SET_CELL (DEBT, debit, 6, 0);
|
||||
SET_CELL (CRED, credit, 7, 0);
|
||||
curs = reg->cursor_journal_single;
|
||||
SET_CELL (DATE, 0, 0);
|
||||
SET_CELL (NUM, 1, 0);
|
||||
SET_CELL (DESC, 2, 0);
|
||||
SET_CELL (XTO, 3, 0);
|
||||
SET_CELL (RECN, 5, 0);
|
||||
SET_CELL (DEBT, 6, 0);
|
||||
SET_CELL (CRED, 7, 0);
|
||||
|
||||
curs = reg->single_cursor;
|
||||
SET_CELL (DATE, date, 0, 0);
|
||||
SET_CELL (NUM, num, 1, 0);
|
||||
SET_CELL (DESC, desc, 2, 0);
|
||||
SET_CELL (XTO, xto, 3, 0);
|
||||
SET_CELL (MXFRM, mxfrm, 4, 0);
|
||||
SET_CELL (RECN, recn, 5, 0);
|
||||
SET_CELL (DEBT, debit, 6, 0);
|
||||
SET_CELL (CRED, credit, 7, 0);
|
||||
curs = reg->cursor_journal_double;
|
||||
copy_cursor_row (reg, curs, reg->cursor_journal_single, 0);
|
||||
|
||||
SET_CELL (MEMO, 2, 1);
|
||||
|
||||
curs = reg->cursor_split;
|
||||
SET_CELL (ACTN, 1, 0);
|
||||
SET_CELL (MEMO, 2, 0);
|
||||
SET_CELL (XFRM, 4, 0);
|
||||
SET_CELL (DEBT, 6, 0);
|
||||
SET_CELL (CRED, 7, 0);
|
||||
|
||||
break;
|
||||
}
|
||||
@ -479,53 +496,48 @@ configLayout (SplitRegister *reg)
|
||||
case STOCK_REGISTER:
|
||||
case CURRENCY_REGISTER:
|
||||
{
|
||||
curs = reg->double_cursor;
|
||||
SET_CELL (DATE, date, 0, 0);
|
||||
SET_CELL (NUM, num, 1, 0);
|
||||
SET_CELL (DESC, desc, 2, 0);
|
||||
SET_CELL (MXFRM, mxfrm, 3, 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->cursor_ledger_single;
|
||||
SET_CELL (DATE, 0, 0);
|
||||
SET_CELL (NUM, 1, 0);
|
||||
SET_CELL (DESC, 2, 0);
|
||||
SET_CELL (MXFRM, 3, 0);
|
||||
SET_CELL (RECN, 4, 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);
|
||||
|
||||
SET_CELL (ACTN, action, 1, 1);
|
||||
SET_CELL (MEMO, memo, 2, 1);
|
||||
curs = reg->cursor_ledger_double;
|
||||
copy_cursor_row (reg, curs, reg->cursor_ledger_single, 0);
|
||||
|
||||
curs = reg->trans_cursor;
|
||||
SET_CELL (DATE, date, 0, 0);
|
||||
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);
|
||||
SET_CELL (ACTN, 1, 1);
|
||||
SET_CELL (MEMO, 2, 1);
|
||||
|
||||
curs = reg->split_cursor;
|
||||
SET_CELL (ACTN, action, 1, 0);
|
||||
SET_CELL (MEMO, memo, 2, 0);
|
||||
SET_CELL (XFRM, xfrm, 3, 0);
|
||||
SET_CELL (DEBT, debit, 7, 0);
|
||||
SET_CELL (CRED, credit, 8, 0);
|
||||
curs = reg->cursor_journal_single;
|
||||
SET_CELL (DATE, 0, 0);
|
||||
SET_CELL (NUM, 1, 0);
|
||||
SET_CELL (DESC, 2, 0);
|
||||
SET_CELL (RECN, 4, 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;
|
||||
SET_CELL (DATE, date, 0, 0);
|
||||
SET_CELL (NUM, num, 1, 0);
|
||||
SET_CELL (DESC, desc, 2, 0);
|
||||
SET_CELL (MXFRM, mxfrm, 3, 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->cursor_journal_double;
|
||||
copy_cursor_row (reg, curs, reg->cursor_journal_single, 0);
|
||||
|
||||
SET_CELL (MEMO, 2, 1);
|
||||
|
||||
curs = reg->cursor_split;
|
||||
SET_CELL (ACTN, 1, 0);
|
||||
SET_CELL (MEMO, 2, 0);
|
||||
SET_CELL (XFRM, 3, 0);
|
||||
SET_CELL (DEBT, 7, 0);
|
||||
SET_CELL (CRED, 8, 0);
|
||||
|
||||
break;
|
||||
}
|
||||
@ -533,53 +545,48 @@ configLayout (SplitRegister *reg)
|
||||
/* --------------------------------------------------------- */
|
||||
case PORTFOLIO_LEDGER:
|
||||
{
|
||||
curs = reg->double_cursor;
|
||||
SET_CELL (DATE, date, 0, 0);
|
||||
SET_CELL (NUM, num, 1, 0);
|
||||
SET_CELL (DESC, desc, 2, 0);
|
||||
SET_CELL (XTO, xto, 3, 0);
|
||||
SET_CELL (MXFRM, mxfrm, 4, 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->cursor_ledger_single;
|
||||
SET_CELL (DATE, 0, 0);
|
||||
SET_CELL (NUM, 1, 0);
|
||||
SET_CELL (DESC, 2, 0);
|
||||
SET_CELL (XTO, 3, 0);
|
||||
SET_CELL (MXFRM, 4, 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);
|
||||
|
||||
SET_CELL (ACTN, action, 1, 1);
|
||||
SET_CELL (MEMO, memo, 2, 1);
|
||||
curs = reg->cursor_ledger_double;
|
||||
copy_cursor_row (reg, curs, reg->cursor_ledger_single, 0);
|
||||
|
||||
curs = reg->trans_cursor;
|
||||
SET_CELL (DATE, date, 0, 0);
|
||||
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);
|
||||
SET_CELL (ACTN, 1, 1);
|
||||
SET_CELL (MEMO, 2, 1);
|
||||
|
||||
curs = reg->split_cursor;
|
||||
SET_CELL (ACTN, action, 1, 0);
|
||||
SET_CELL (MEMO, memo, 2, 0);
|
||||
SET_CELL (XFRM, xfrm, 4, 0);
|
||||
SET_CELL (DEBT, debit, 8, 0);
|
||||
SET_CELL (CRED, credit, 9, 0);
|
||||
curs = reg->cursor_journal_single;
|
||||
SET_CELL (DATE, 0, 0);
|
||||
SET_CELL (NUM, 1, 0);
|
||||
SET_CELL (DESC, 2, 0);
|
||||
SET_CELL (XTO, 3, 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;
|
||||
SET_CELL (DATE, date, 0, 0);
|
||||
SET_CELL (NUM, num, 1, 0);
|
||||
SET_CELL (DESC, desc, 2, 0);
|
||||
SET_CELL (XTO, xto, 3, 0);
|
||||
SET_CELL (MXFRM, mxfrm, 4, 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->cursor_journal_double;
|
||||
copy_cursor_row (reg, curs, reg->cursor_journal_single, 0);
|
||||
|
||||
SET_CELL (MEMO, 2, 1);
|
||||
|
||||
curs = reg->cursor_split;
|
||||
SET_CELL (ACTN, 1, 0);
|
||||
SET_CELL (MEMO, 2, 0);
|
||||
SET_CELL (XFRM, 4, 0);
|
||||
SET_CELL (DEBT, 8, 0);
|
||||
SET_CELL (CRED, 9, 0);
|
||||
|
||||
break;
|
||||
}
|
||||
@ -596,6 +603,7 @@ configLayout (SplitRegister *reg)
|
||||
SplitRegister *
|
||||
xaccMallocSplitRegister (SplitRegisterType type,
|
||||
SplitRegisterStyle style,
|
||||
gboolean use_double_line,
|
||||
TableGetEntryHandler entry_handler,
|
||||
TableGetFGColorHandler fg_color_handler,
|
||||
TableGetBGColorHandler bg_color_handler,
|
||||
@ -607,7 +615,7 @@ xaccMallocSplitRegister (SplitRegisterType type,
|
||||
|
||||
reg = g_new0(SplitRegister, 1);
|
||||
|
||||
xaccInitSplitRegister (reg, type, style,
|
||||
xaccInitSplitRegister (reg, type, style, use_double_line,
|
||||
entry_handler, fg_color_handler, bg_color_handler,
|
||||
allocator, deallocator, copy);
|
||||
|
||||
@ -621,7 +629,8 @@ mallocCursors (SplitRegister *reg)
|
||||
{
|
||||
int num_cols;
|
||||
|
||||
switch (reg->type) {
|
||||
switch (reg->type)
|
||||
{
|
||||
case BANK_REGISTER:
|
||||
case CASH_REGISTER:
|
||||
case ASSET_REGISTER:
|
||||
@ -654,33 +663,35 @@ mallocCursors (SplitRegister *reg)
|
||||
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 */
|
||||
reg->single_cursor = gnc_cellblock_new (1, num_cols, CURSOR_TYPE_SINGLE);
|
||||
reg->double_cursor = gnc_cellblock_new (2, num_cols, CURSOR_TYPE_DOUBLE);
|
||||
/* cursors used in ledger mode */
|
||||
reg->cursor_ledger_single =
|
||||
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 */
|
||||
reg->trans_cursor = gnc_cellblock_new (1, num_cols, CURSOR_TYPE_TRANS);
|
||||
reg->split_cursor = gnc_cellblock_new (1, num_cols, CURSOR_TYPE_SPLIT);
|
||||
/* cursors used for journal mode */
|
||||
reg->cursor_journal_single =
|
||||
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) \
|
||||
{ \
|
||||
BasicCell *hcell; \
|
||||
hcell = xaccMallocTextCell(); \
|
||||
reg->header_cells[NAME##_CELL] = hcell; \
|
||||
}
|
||||
|
||||
#define NEW(CN,TYPE) \
|
||||
#define NEW(NAME, CN, TYPE) \
|
||||
reg->CN##Cell = xaccMalloc##TYPE##Cell(); \
|
||||
reg->cells[NAME##_CELL] = (BasicCell *) reg->CN##Cell;
|
||||
|
||||
static void
|
||||
xaccInitSplitRegister (SplitRegister *reg,
|
||||
SplitRegisterType type,
|
||||
SplitRegisterStyle style,
|
||||
gboolean use_double_line,
|
||||
TableGetEntryHandler entry_handler,
|
||||
TableGetFGColorHandler fg_color_handler,
|
||||
TableGetBGColorHandler bg_color_handler,
|
||||
@ -693,8 +704,10 @@ xaccInitSplitRegister (SplitRegister *reg,
|
||||
reg->table = NULL;
|
||||
reg->user_data = NULL;
|
||||
reg->destroy = NULL;
|
||||
|
||||
reg->type = type;
|
||||
reg->style = style;
|
||||
reg->use_double_line = use_double_line;
|
||||
|
||||
/* --------------------------- */
|
||||
/* define the number of columns in the display, malloc the cursors */
|
||||
@ -702,42 +715,34 @@ xaccInitSplitRegister (SplitRegister *reg,
|
||||
|
||||
/* --------------------------- */
|
||||
/* malloc the header (label) cells */
|
||||
HDR (DATE);
|
||||
HDR (NUM);
|
||||
HDR (ACTN);
|
||||
HDR (XFRM);
|
||||
HDR (MXFRM);
|
||||
HDR (XTO);
|
||||
HDR (DESC);
|
||||
HDR (MEMO);
|
||||
HDR (RECN);
|
||||
HDR (CRED);
|
||||
HDR (DEBT);
|
||||
HDR (PRIC);
|
||||
HDR (SHRS);
|
||||
HDR (SHRBALN);
|
||||
HDR (BALN);
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < CELL_TYPE_COUNT; i++)
|
||||
reg->header_cells[i] = xaccMallocTextCell ();
|
||||
}
|
||||
|
||||
/* --------------------------- */
|
||||
/* malloc the workhorse cells */
|
||||
|
||||
NEW (null, Basic);
|
||||
NEW (date, Date);
|
||||
NEW (num, Num);
|
||||
NEW (desc, QuickFill);
|
||||
NEW (recn, Recn);
|
||||
NEW (shrbaln, Price);
|
||||
NEW (balance, Price);
|
||||
reg->nullCell = xaccMallocBasicCell ();
|
||||
|
||||
NEW (xfrm, Combo);
|
||||
NEW (mxfrm, Combo);
|
||||
NEW (xto, Combo);
|
||||
NEW (action, Combo);
|
||||
NEW (memo, QuickFill);
|
||||
NEW (credit, Price);
|
||||
NEW (debit, Price);
|
||||
NEW (price, Price);
|
||||
NEW (shares, Price);
|
||||
NEW (DATE, date, Date);
|
||||
NEW (NUM, num, Num);
|
||||
NEW (DESC, desc, QuickFill);
|
||||
NEW (RECN, recn, Recn);
|
||||
NEW (SHRBALN, shrbaln, Price);
|
||||
NEW (BALN, balance, Price);
|
||||
|
||||
NEW (XFRM, xfrm, Combo);
|
||||
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
|
||||
@ -849,7 +854,8 @@ xaccInitSplitRegister (SplitRegister *reg,
|
||||
{
|
||||
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 */
|
||||
@ -861,8 +867,8 @@ xaccInitSplitRegister (SplitRegister *reg,
|
||||
vloc.phys_row_offset = 0;
|
||||
vloc.phys_col_offset = 0;
|
||||
|
||||
gnc_table_set_vcell (table, reg->single_cursor, NULL, TRUE, TRUE,
|
||||
vloc.vcell_loc);
|
||||
gnc_table_set_vcell (table, reg->cursor_ledger_single,
|
||||
NULL, TRUE, TRUE, vloc.vcell_loc);
|
||||
gnc_table_move_cursor (table, vloc);
|
||||
}
|
||||
|
||||
@ -874,19 +880,22 @@ xaccInitSplitRegister (SplitRegister *reg,
|
||||
void
|
||||
xaccConfigSplitRegister (SplitRegister *reg,
|
||||
SplitRegisterType newtype,
|
||||
SplitRegisterStyle newstyle)
|
||||
SplitRegisterStyle newstyle,
|
||||
gboolean use_double_line)
|
||||
{
|
||||
if (!reg) return;
|
||||
|
||||
reg->type = newtype;
|
||||
reg->style = newstyle;
|
||||
reg->use_double_line = use_double_line;
|
||||
|
||||
/* Make sure that any GUI elements associated with this reconfig
|
||||
* are properly initialized. */
|
||||
gnc_table_create_cursor (reg->table, reg->single_cursor);
|
||||
gnc_table_create_cursor (reg->table, reg->double_cursor);
|
||||
gnc_table_create_cursor (reg->table, reg->trans_cursor);
|
||||
gnc_table_create_cursor (reg->table, reg->split_cursor);
|
||||
gnc_table_create_cursor (reg->table, reg->cursor_ledger_single);
|
||||
gnc_table_create_cursor (reg->table, reg->cursor_ledger_double);
|
||||
gnc_table_create_cursor (reg->table, reg->cursor_journal_single);
|
||||
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);
|
||||
reg->table = NULL;
|
||||
|
||||
gnc_cellblock_destroy (reg->header);
|
||||
gnc_cellblock_destroy (reg->single_cursor);
|
||||
gnc_cellblock_destroy (reg->double_cursor);
|
||||
gnc_cellblock_destroy (reg->trans_cursor);
|
||||
gnc_cellblock_destroy (reg->split_cursor);
|
||||
gnc_cellblock_destroy (reg->cursor_header);
|
||||
gnc_cellblock_destroy (reg->cursor_ledger_single);
|
||||
gnc_cellblock_destroy (reg->cursor_ledger_double);
|
||||
gnc_cellblock_destroy (reg->cursor_journal_single);
|
||||
gnc_cellblock_destroy (reg->cursor_journal_double);
|
||||
gnc_cellblock_destroy (reg->cursor_split);
|
||||
|
||||
reg->header = NULL;
|
||||
reg->single_cursor = NULL;
|
||||
reg->double_cursor = NULL;
|
||||
reg->trans_cursor = NULL;
|
||||
reg->split_cursor = NULL;
|
||||
reg->cursor_header = NULL;
|
||||
reg->cursor_ledger_single = NULL;
|
||||
reg->cursor_ledger_double = NULL;
|
||||
reg->cursor_journal_single = NULL;
|
||||
reg->cursor_journal_double = NULL;
|
||||
reg->cursor_split = NULL;
|
||||
|
||||
xaccDestroyDateCell (reg->dateCell);
|
||||
xaccDestroyNumCell (reg->numCell);
|
||||
@ -1021,12 +1032,13 @@ sr_cellblock_cursor_class(SplitRegister *reg, CellBlock *cursor)
|
||||
if (cursor == NULL)
|
||||
return CURSOR_CLASS_NONE;
|
||||
|
||||
if ((cursor == reg->single_cursor) ||
|
||||
(cursor == reg->double_cursor) ||
|
||||
(cursor == reg->trans_cursor))
|
||||
if ((cursor == reg->cursor_ledger_single) ||
|
||||
(cursor == reg->cursor_ledger_double) ||
|
||||
(cursor == reg->cursor_journal_single) ||
|
||||
(cursor == reg->cursor_journal_double))
|
||||
return CURSOR_CLASS_TRANS;
|
||||
|
||||
if (cursor == reg->split_cursor)
|
||||
if (cursor == reg->cursor_split)
|
||||
return CURSOR_CLASS_SPLIT;
|
||||
|
||||
return CURSOR_CLASS_NONE;
|
||||
|
@ -52,26 +52,26 @@
|
||||
#include "recncell.h"
|
||||
#include "table-allgui.h"
|
||||
|
||||
/* defined register types */
|
||||
/* "registers" are single-account display windows.
|
||||
/* defined register types.
|
||||
* "registers" are single-account display windows.
|
||||
* "ledgers" are multiple-account display windows */
|
||||
typedef enum
|
||||
{
|
||||
BANK_REGISTER = 1,
|
||||
CASH_REGISTER = 2,
|
||||
ASSET_REGISTER = 3,
|
||||
CREDIT_REGISTER = 4,
|
||||
LIABILITY_REGISTER = 5,
|
||||
INCOME_REGISTER = 6,
|
||||
EXPENSE_REGISTER = 7,
|
||||
EQUITY_REGISTER = 8,
|
||||
STOCK_REGISTER = 9,
|
||||
CURRENCY_REGISTER = 10,
|
||||
BANK_REGISTER,
|
||||
CASH_REGISTER,
|
||||
ASSET_REGISTER,
|
||||
CREDIT_REGISTER,
|
||||
LIABILITY_REGISTER,
|
||||
INCOME_REGISTER,
|
||||
EXPENSE_REGISTER,
|
||||
EQUITY_REGISTER,
|
||||
STOCK_REGISTER,
|
||||
CURRENCY_REGISTER,
|
||||
|
||||
GENERAL_LEDGER = 11,
|
||||
INCOME_LEDGER = 12,
|
||||
PORTFOLIO_LEDGER = 13,
|
||||
SEARCH_LEDGER = 14
|
||||
GENERAL_LEDGER,
|
||||
INCOME_LEDGER,
|
||||
PORTFOLIO_LEDGER,
|
||||
SEARCH_LEDGER
|
||||
} SplitRegisterType;
|
||||
|
||||
/* These values are used to identify the cells in the register. */
|
||||
@ -93,10 +93,7 @@ typedef enum
|
||||
DEBT_CELL,
|
||||
PRIC_CELL,
|
||||
SHRS_CELL,
|
||||
|
||||
/* MXFRM is the "mirrored" transfer-from account */
|
||||
MXFRM_CELL,
|
||||
|
||||
MXFRM_CELL, /* MXFRM is the "mirrored" transfer-from account */
|
||||
CELL_TYPE_COUNT
|
||||
} CellType;
|
||||
|
||||
@ -112,11 +109,9 @@ typedef enum
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
REG_SINGLE_LINE = 1,
|
||||
REG_DOUBLE_LINE = 2,
|
||||
REG_MULTI_LINE = 3,
|
||||
REG_SINGLE_DYNAMIC = 4,
|
||||
REG_DOUBLE_DYNAMIC = 5
|
||||
REG_STYLE_LEDGER,
|
||||
REG_STYLE_AUTO_LEDGER,
|
||||
REG_STYLE_JOURNAL
|
||||
} SplitRegisterStyle;
|
||||
|
||||
/* modified flags -- indicate which cell values have been modified by user */
|
||||
@ -125,7 +120,6 @@ typedef enum
|
||||
#define MOD_NUM 0x0002
|
||||
#define MOD_DESC 0x0004
|
||||
#define MOD_RECN 0x0008
|
||||
|
||||
#define MOD_ACTN 0x0010
|
||||
#define MOD_XFRM 0x0020
|
||||
#define MOD_MXFRM 0x0040
|
||||
@ -134,8 +128,7 @@ typedef enum
|
||||
#define MOD_AMNT 0x0200
|
||||
#define MOD_PRIC 0x0400
|
||||
#define MOD_SHRS 0x0800
|
||||
#define MOD_NEW 0x1000
|
||||
#define MOD_ALL 0x1fff
|
||||
#define MOD_ALL 0xffff
|
||||
|
||||
/* Types of cursors */
|
||||
typedef enum
|
||||
@ -150,9 +143,10 @@ typedef enum
|
||||
{
|
||||
CURSOR_TYPE_NONE = -1,
|
||||
CURSOR_TYPE_HEADER,
|
||||
CURSOR_TYPE_SINGLE,
|
||||
CURSOR_TYPE_DOUBLE,
|
||||
CURSOR_TYPE_TRANS,
|
||||
CURSOR_TYPE_SINGLE_LEDGER,
|
||||
CURSOR_TYPE_DOUBLE_LEDGER,
|
||||
CURSOR_TYPE_SINGLE_JOURNAL,
|
||||
CURSOR_TYPE_DOUBLE_JOURNAL,
|
||||
CURSOR_TYPE_SPLIT,
|
||||
NUM_CURSOR_TYPES
|
||||
} CursorType;
|
||||
@ -167,12 +161,15 @@ struct _SplitRegister
|
||||
/* the table itself that implements the underlying GUI. */
|
||||
Table * table;
|
||||
|
||||
/* the cursors that define the currently edited row */
|
||||
CellBlock * single_cursor;
|
||||
CellBlock * double_cursor;
|
||||
CellBlock * trans_cursor;
|
||||
CellBlock * split_cursor;
|
||||
CellBlock * header;
|
||||
/* the cursors that define the register structure */
|
||||
CellBlock * cursor_header;
|
||||
CellBlock * cursor_ledger_single;
|
||||
CellBlock * cursor_ledger_double;
|
||||
CellBlock * cursor_journal_single;
|
||||
CellBlock * cursor_journal_double;
|
||||
CellBlock * cursor_split;
|
||||
|
||||
BasicCell * nullCell;
|
||||
|
||||
DateCell * dateCell;
|
||||
NumCell * numCell;
|
||||
@ -180,24 +177,24 @@ struct _SplitRegister
|
||||
RecnCell * recnCell; /* main transaction line reconcile */
|
||||
PriceCell * shrbalnCell;
|
||||
PriceCell * balanceCell;
|
||||
BasicCell * nullCell;
|
||||
|
||||
ComboCell * actionCell;
|
||||
ComboCell * xfrmCell;
|
||||
ComboCell * mxfrmCell;
|
||||
ComboCell * xtoCell;
|
||||
QuickFillCell * memoCell;
|
||||
PriceCell * creditCell;
|
||||
PriceCell * debitCell;
|
||||
PriceCell * priceCell;
|
||||
PriceCell * sharesCell;
|
||||
ComboCell * mxfrmCell;
|
||||
|
||||
SplitRegisterType type;
|
||||
SplitRegisterStyle style;
|
||||
gboolean use_double_line;
|
||||
|
||||
/* some private data; outsiders should not access this */
|
||||
|
||||
BasicCell *header_cells[CELL_TYPE_COUNT];
|
||||
BasicCell *cells[CELL_TYPE_COUNT];
|
||||
|
||||
/* user_data allows users of this object to hang
|
||||
* private data onto it */
|
||||
@ -217,6 +214,7 @@ void xaccSplitRegisterSetCreditStringGetter(SRStringGetter getter);
|
||||
SplitRegister *
|
||||
xaccMallocSplitRegister (SplitRegisterType type,
|
||||
SplitRegisterStyle style,
|
||||
gboolean use_double_line,
|
||||
TableGetEntryHandler entry_handler,
|
||||
TableGetFGColorHandler fg_color_handler,
|
||||
TableGetBGColorHandler bg_color_handler,
|
||||
@ -226,7 +224,8 @@ xaccMallocSplitRegister (SplitRegisterType type,
|
||||
|
||||
void xaccConfigSplitRegister (SplitRegister *reg,
|
||||
SplitRegisterType type,
|
||||
SplitRegisterStyle style);
|
||||
SplitRegisterStyle style,
|
||||
gboolean use_double_line);
|
||||
|
||||
void xaccDestroySplitRegister (SplitRegister *reg);
|
||||
|
||||
|
@ -865,11 +865,9 @@ gnc_table_enter_update(Table *table,
|
||||
|
||||
/* ==================================================== */
|
||||
|
||||
const char *
|
||||
gnc_table_leave_update(Table *table,
|
||||
VirtualLocation virt_loc)
|
||||
void
|
||||
gnc_table_leave_update(Table *table, VirtualLocation virt_loc)
|
||||
{
|
||||
const char *retval;
|
||||
gboolean changed = FALSE;
|
||||
CellLeaveFunc leave;
|
||||
CellBlockCell *cb_cell;
|
||||
@ -893,6 +891,9 @@ gnc_table_leave_update(Table *table,
|
||||
|
||||
/* OK, if there is a callback for this cell, call it */
|
||||
cb_cell = gnc_cellblock_get_cell (cb, cell_row, cell_col);
|
||||
if (!cb_cell || !cb_cell->cell)
|
||||
return;
|
||||
|
||||
cell = cb_cell->cell;
|
||||
leave = cell->leave_cell;
|
||||
|
||||
@ -912,15 +913,6 @@ gnc_table_leave_update(Table *table,
|
||||
|
||||
g_free (old_value);
|
||||
}
|
||||
|
||||
if (changed)
|
||||
retval = cell->value;
|
||||
else
|
||||
retval = NULL;
|
||||
|
||||
LEAVE("return %s\n", retval);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* ==================================================== */
|
||||
|
@ -355,8 +355,7 @@ gboolean gnc_table_enter_update(Table *table,
|
||||
int *start_selection,
|
||||
int *end_selection);
|
||||
|
||||
const char * gnc_table_leave_update(Table *table,
|
||||
VirtualLocation virt_loc);
|
||||
void gnc_table_leave_update(Table *table, VirtualLocation virt_loc);
|
||||
|
||||
const char * gnc_table_modify_update(Table *table,
|
||||
VirtualLocation virt_loc,
|
||||
|
@ -125,15 +125,12 @@ gnc_table_init_gui (gncUIWidget widget, void *data)
|
||||
|
||||
/* config the cell-block styles */
|
||||
|
||||
gnucash_sheet_set_cursor (sheet, sr->header, CURSOR_TYPE_HEADER);
|
||||
gnucash_sheet_set_cursor (sheet, sr->single_cursor,
|
||||
CURSOR_TYPE_SINGLE);
|
||||
gnucash_sheet_set_cursor (sheet, sr->double_cursor,
|
||||
CURSOR_TYPE_DOUBLE);
|
||||
gnucash_sheet_set_cursor (sheet, sr->trans_cursor,
|
||||
CURSOR_TYPE_TRANS);
|
||||
gnucash_sheet_set_cursor (sheet, sr->split_cursor,
|
||||
CURSOR_TYPE_SPLIT);
|
||||
gnucash_sheet_set_cursor (sheet, sr->cursor_header);
|
||||
gnucash_sheet_set_cursor (sheet, sr->cursor_ledger_single);
|
||||
gnucash_sheet_set_cursor (sheet, sr->cursor_ledger_double);
|
||||
gnucash_sheet_set_cursor (sheet, sr->cursor_journal_single);
|
||||
gnucash_sheet_set_cursor (sheet, sr->cursor_journal_double);
|
||||
gnucash_sheet_set_cursor (sheet, sr->cursor_split);
|
||||
|
||||
for (i = 0; i < CELL_TYPE_COUNT; i++)
|
||||
header_widths[i] = -1;
|
||||
@ -156,7 +153,7 @@ gnc_table_init_gui (gncUIWidget widget, void *data)
|
||||
name = gh_scm2newstr(gh_car (assoc), NULL);
|
||||
ctype = xaccSplitRegisterGetCellTypeFromName (name);
|
||||
if (name)
|
||||
free((void *)name);
|
||||
free(name);
|
||||
|
||||
if (ctype == NO_CELL)
|
||||
continue;
|
||||
|
@ -202,19 +202,19 @@ the account instead of opening a register." #f))
|
||||
|
||||
(gnc:register-configuration-option
|
||||
(gnc:make-multichoice-option
|
||||
"Register" "Default Register Mode"
|
||||
"a" "Choose the default mode for register windows"
|
||||
'single_line
|
||||
(list #(single_line "Single Line" "Show transactions on single lines")
|
||||
#(double_line "Double Line"
|
||||
"Show transactions on two lines with more information")
|
||||
#(multi_line "Multi Line"
|
||||
"Show transactions on multiple lines with one line for each split in the transaction")
|
||||
#(auto_single "Auto Single"
|
||||
"Single line mode with a multi-line cursor")
|
||||
#(auto_double "Auto Double"
|
||||
"Double line mode with a multi-line cursor")
|
||||
)))
|
||||
"Register" "Default Register Style"
|
||||
"a" "Default style for register windows"
|
||||
'ledger
|
||||
(list #(ledger "Ledger" "Show transactions on one or two lines")
|
||||
#(auto_ledger "Auto Ledger"
|
||||
"Show transactions on one or two lines and expand the current transaction")
|
||||
#(journal "Journal"
|
||||
"Show expanded transactions with all splits"))))
|
||||
|
||||
(gnc:register-configuration-option
|
||||
(gnc:make-simple-boolean-option
|
||||
"Register" "Double Line Mode"
|
||||
"aa" "Show two lines of information for each transaction" #f))
|
||||
|
||||
(gnc:register-configuration-option
|
||||
(gnc:make-simple-boolean-option
|
||||
|
Loading…
Reference in New Issue
Block a user