mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Merge Jean Laroche's '797006_subaccounts' into maint.
This commit is contained in:
commit
2bdc936695
@ -451,7 +451,7 @@ gnc_tree_model_split_reg_dispose (GObject *object)
|
||||
/* Create a new tree model */
|
||||
GncTreeModelSplitReg *
|
||||
gnc_tree_model_split_reg_new (SplitRegisterType2 reg_type, SplitRegisterStyle2 style,
|
||||
gboolean use_double_line, gboolean is_template)
|
||||
gboolean use_double_line, gboolean is_template, gboolean mismatched_commodities)
|
||||
{
|
||||
GncTreeModelSplitReg *model;
|
||||
GncTreeModelSplitRegPrivate *priv;
|
||||
@ -469,6 +469,7 @@ gnc_tree_model_split_reg_new (SplitRegisterType2 reg_type, SplitRegisterStyle2 s
|
||||
model->style = style;
|
||||
model->use_double_line = use_double_line;
|
||||
model->is_template = is_template;
|
||||
model->mismatched_commodities = mismatched_commodities;
|
||||
|
||||
model->sort_col = 1;
|
||||
model->sort_depth = 1;
|
||||
|
@ -144,6 +144,7 @@ typedef struct
|
||||
gboolean use_double_line; /**<FIXME ? As above, whether to use two lines per transaction */
|
||||
|
||||
gboolean is_template; /**< Are we using a template */
|
||||
gboolean mismatched_commodities; /**< Are there different commodities */
|
||||
|
||||
gint sort_depth; /**< This is the row the sort direction is based on. */
|
||||
gint sort_col; /**< This is the column the sort direction is based on. */
|
||||
@ -201,7 +202,7 @@ GType gnc_tree_model_split_reg_get_type (void);
|
||||
/** Create new model and set options for register. */
|
||||
GncTreeModelSplitReg *
|
||||
gnc_tree_model_split_reg_new (SplitRegisterType2 reg_type, SplitRegisterStyle2 style,
|
||||
gboolean use_double_line, gboolean is_template);
|
||||
gboolean use_double_line, gboolean is_template, gboolean mismatched_commodities);
|
||||
|
||||
/** Load the model from a slist and set default account for register. */
|
||||
void gnc_tree_model_split_reg_load (GncTreeModelSplitReg *model, GList * slist, Account *default_account);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -559,6 +559,15 @@ typedef struct GncPluginPageRegister2Private
|
||||
|
||||
static GObjectClass *parent_class = NULL;
|
||||
|
||||
static gpointer
|
||||
gnc_plug_page_register_check_commodity(Account *account, void* usr_data)
|
||||
{
|
||||
// Check that account's commodity matches the commodity in usr_data
|
||||
gnc_commodity* com0 = (gnc_commodity*) usr_data;
|
||||
gnc_commodity* com1 = xaccAccountGetCommodity(account);
|
||||
return gnc_commodity_equal(com1, com0) ? NULL : com1;
|
||||
}
|
||||
|
||||
/************************************************************/
|
||||
/* Implementation */
|
||||
/************************************************************/
|
||||
@ -630,6 +639,8 @@ gnc_plugin_page_register2_new (Account *account, gboolean subaccounts)
|
||||
GNCLedgerDisplay2 *ledger;
|
||||
GncPluginPage *page;
|
||||
GncPluginPageRegister2Private *priv;
|
||||
gnc_commodity* com0;
|
||||
gnc_commodity* com1;
|
||||
|
||||
/*################## Added for Reg2 #################*/
|
||||
const GList *item;
|
||||
@ -657,9 +668,10 @@ gnc_plugin_page_register2_new (Account *account, gboolean subaccounts)
|
||||
}
|
||||
}
|
||||
/*################## Added for Reg2 #################*/
|
||||
|
||||
com0 = gnc_account_get_currency_or_parent(account);
|
||||
com1 = gnc_account_foreach_descendant_until(account,gnc_plug_page_register_check_commodity,com0);
|
||||
if (subaccounts)
|
||||
ledger = gnc_ledger_display2_subaccounts (account);
|
||||
ledger = gnc_ledger_display2_subaccounts (account,com1!=NULL);
|
||||
else
|
||||
ledger = gnc_ledger_display2_simple (account);
|
||||
|
||||
|
@ -2619,27 +2619,38 @@ gnc_split_reg_determine_read_only( GNCSplitReg *gsr )
|
||||
{
|
||||
dialog_args *args;
|
||||
char *string = NULL;
|
||||
switch (gnc_split_reg_get_placeholder(gsr))
|
||||
reg = gnc_ledger_display_get_split_register( gsr->ledger );
|
||||
if(reg->mismatched_commodities)
|
||||
{
|
||||
case PLACEHOLDER_NONE:
|
||||
/* stay as false. */
|
||||
return;
|
||||
string = _("This account may not be edited because its"
|
||||
" subaccounts have mismatched commodities or currencies."
|
||||
"You need to open each account individually to "
|
||||
"edit transactions.");
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (gnc_split_reg_get_placeholder(gsr))
|
||||
{
|
||||
case PLACEHOLDER_NONE:
|
||||
/* stay as false. */
|
||||
return;
|
||||
|
||||
case PLACEHOLDER_THIS:
|
||||
string = _("This account may not be edited. If you want "
|
||||
"to edit transactions in this register, please "
|
||||
"open the account options and turn off the "
|
||||
"placeholder checkbox.");
|
||||
break;
|
||||
case PLACEHOLDER_THIS:
|
||||
string = _("This account may not be edited. If you want "
|
||||
"to edit transactions in this register, please "
|
||||
"open the account options and turn off the "
|
||||
"placeholder checkbox.");
|
||||
break;
|
||||
|
||||
default:
|
||||
string = _("One of the sub-accounts selected may not be "
|
||||
"edited. If you want to edit transactions in "
|
||||
"this register, please open the sub-account "
|
||||
"options and turn off the placeholder checkbox. "
|
||||
"You may also open an individual account instead "
|
||||
"of a set of accounts.");
|
||||
break;
|
||||
default:
|
||||
string = _("One of the sub-accounts selected may not be "
|
||||
"edited. If you want to edit transactions in "
|
||||
"this register, please open the sub-account "
|
||||
"options and turn off the placeholder checkbox. "
|
||||
"You may also open an individual account instead "
|
||||
"of a set of accounts.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
gsr->read_only = TRUE;
|
||||
/* Put up a warning dialog */
|
||||
|
@ -57,11 +57,11 @@ struct gnc_ledger_display
|
||||
{
|
||||
GncGUID leader;
|
||||
|
||||
Query *query;
|
||||
Query* query;
|
||||
|
||||
GNCLedgerDisplayType ld_type;
|
||||
|
||||
SplitRegister *reg;
|
||||
SplitRegister* reg;
|
||||
|
||||
gboolean loading;
|
||||
gboolean use_double_line_default;
|
||||
@ -70,7 +70,7 @@ struct gnc_ledger_display
|
||||
GNCLedgerDisplayGetParent get_parent;
|
||||
|
||||
gpointer user_data;
|
||||
|
||||
|
||||
gint number_of_subaccounts;
|
||||
|
||||
gint component_id;
|
||||
@ -82,34 +82,35 @@ static QofLogModule log_module = GNC_MOD_LEDGER;
|
||||
|
||||
|
||||
/** Declarations ****************************************************/
|
||||
static GNCLedgerDisplay *
|
||||
gnc_ledger_display_internal (Account *lead_account, Query *q,
|
||||
static GNCLedgerDisplay*
|
||||
gnc_ledger_display_internal (Account* lead_account, Query* q,
|
||||
GNCLedgerDisplayType ld_type,
|
||||
SplitRegisterType reg_type,
|
||||
SplitRegisterStyle style,
|
||||
gboolean use_double_line,
|
||||
gboolean is_template);
|
||||
gboolean is_template,
|
||||
gboolean mismatched_commodities);
|
||||
|
||||
static void gnc_ledger_display_refresh_internal (GNCLedgerDisplay *ld,
|
||||
GList *splits);
|
||||
static void gnc_ledger_display_refresh_internal (GNCLedgerDisplay* ld,
|
||||
GList* splits);
|
||||
|
||||
static void gnc_ledger_display_make_query (GNCLedgerDisplay *ld,
|
||||
gint limit,
|
||||
SplitRegisterType type);
|
||||
static void gnc_ledger_display_make_query (GNCLedgerDisplay* ld,
|
||||
gint limit,
|
||||
SplitRegisterType type);
|
||||
|
||||
/** Implementations *************************************************/
|
||||
|
||||
Account *
|
||||
gnc_ledger_display_leader (GNCLedgerDisplay *ld)
|
||||
Account*
|
||||
gnc_ledger_display_leader (GNCLedgerDisplay* ld)
|
||||
{
|
||||
if (!ld)
|
||||
return NULL;
|
||||
|
||||
return xaccAccountLookup (&ld->leader, gnc_get_current_book ());
|
||||
return xaccAccountLookup (&ld->leader, gnc_get_current_book());
|
||||
}
|
||||
|
||||
GNCLedgerDisplayType
|
||||
gnc_ledger_display_type (GNCLedgerDisplay *ld)
|
||||
gnc_ledger_display_type (GNCLedgerDisplay* ld)
|
||||
{
|
||||
if (!ld)
|
||||
return -1;
|
||||
@ -118,7 +119,7 @@ gnc_ledger_display_type (GNCLedgerDisplay *ld)
|
||||
}
|
||||
|
||||
void
|
||||
gnc_ledger_display_set_user_data (GNCLedgerDisplay *ld, gpointer user_data)
|
||||
gnc_ledger_display_set_user_data (GNCLedgerDisplay* ld, gpointer user_data)
|
||||
{
|
||||
if (!ld)
|
||||
return;
|
||||
@ -127,7 +128,7 @@ gnc_ledger_display_set_user_data (GNCLedgerDisplay *ld, gpointer user_data)
|
||||
}
|
||||
|
||||
gpointer
|
||||
gnc_ledger_display_get_user_data (GNCLedgerDisplay *ld)
|
||||
gnc_ledger_display_get_user_data (GNCLedgerDisplay* ld)
|
||||
{
|
||||
if (!ld)
|
||||
return NULL;
|
||||
@ -136,7 +137,7 @@ gnc_ledger_display_get_user_data (GNCLedgerDisplay *ld)
|
||||
}
|
||||
|
||||
void
|
||||
gnc_ledger_display_set_handlers (GNCLedgerDisplay *ld,
|
||||
gnc_ledger_display_set_handlers (GNCLedgerDisplay* ld,
|
||||
GNCLedgerDisplayDestroy destroy,
|
||||
GNCLedgerDisplayGetParent get_parent)
|
||||
{
|
||||
@ -147,8 +148,8 @@ gnc_ledger_display_set_handlers (GNCLedgerDisplay *ld,
|
||||
ld->get_parent = get_parent;
|
||||
}
|
||||
|
||||
SplitRegister *
|
||||
gnc_ledger_display_get_split_register (GNCLedgerDisplay *ld)
|
||||
SplitRegister*
|
||||
gnc_ledger_display_get_split_register (GNCLedgerDisplay* ld)
|
||||
{
|
||||
if (!ld)
|
||||
return NULL;
|
||||
@ -156,8 +157,8 @@ gnc_ledger_display_get_split_register (GNCLedgerDisplay *ld)
|
||||
return ld->reg;
|
||||
}
|
||||
|
||||
Query *
|
||||
gnc_ledger_display_get_query (GNCLedgerDisplay *ld)
|
||||
Query*
|
||||
gnc_ledger_display_get_query (GNCLedgerDisplay* ld)
|
||||
{
|
||||
if (!ld)
|
||||
return NULL;
|
||||
@ -168,8 +169,8 @@ gnc_ledger_display_get_query (GNCLedgerDisplay *ld)
|
||||
static gboolean
|
||||
find_by_leader (gpointer find_data, gpointer user_data)
|
||||
{
|
||||
Account *account = find_data;
|
||||
GNCLedgerDisplay *ld = user_data;
|
||||
Account* account = find_data;
|
||||
GNCLedgerDisplay* ld = user_data;
|
||||
|
||||
if (!account || !ld)
|
||||
return FALSE;
|
||||
@ -180,8 +181,8 @@ find_by_leader (gpointer find_data, gpointer user_data)
|
||||
static gboolean
|
||||
find_by_query (gpointer find_data, gpointer user_data)
|
||||
{
|
||||
Query *q = find_data;
|
||||
GNCLedgerDisplay *ld = user_data;
|
||||
Query* q = find_data;
|
||||
GNCLedgerDisplay* ld = user_data;
|
||||
|
||||
if (!q || !ld)
|
||||
return FALSE;
|
||||
@ -192,8 +193,8 @@ find_by_query (gpointer find_data, gpointer user_data)
|
||||
static gboolean
|
||||
find_by_reg (gpointer find_data, gpointer user_data)
|
||||
{
|
||||
SplitRegister *reg = find_data;
|
||||
GNCLedgerDisplay *ld = user_data;
|
||||
SplitRegister* reg = find_data;
|
||||
GNCLedgerDisplay* ld = user_data;
|
||||
|
||||
if (!reg || !ld)
|
||||
return FALSE;
|
||||
@ -217,13 +218,13 @@ gnc_get_default_register_style (GNCAccountType type)
|
||||
}
|
||||
|
||||
static gpointer
|
||||
look_for_portfolio_cb (Account *account, gpointer data)
|
||||
look_for_portfolio_cb (Account* account, gpointer data)
|
||||
{
|
||||
return xaccAccountIsPriced(account) ? (gpointer) PORTFOLIO_LEDGER : NULL;
|
||||
return xaccAccountIsPriced (account) ? (gpointer) PORTFOLIO_LEDGER : NULL;
|
||||
}
|
||||
|
||||
static SplitRegisterType
|
||||
gnc_get_reg_type (Account *leader, GNCLedgerDisplayType ld_type)
|
||||
gnc_get_reg_type (Account* leader, GNCLedgerDisplayType ld_type)
|
||||
{
|
||||
GNCAccountType account_type;
|
||||
SplitRegisterType reg_type;
|
||||
@ -305,7 +306,8 @@ gnc_get_reg_type (Account *leader, GNCLedgerDisplayType ld_type)
|
||||
gpointer ret;
|
||||
reg_type = GENERAL_JOURNAL;
|
||||
|
||||
ret = gnc_account_foreach_descendant_until(leader, look_for_portfolio_cb, NULL);
|
||||
ret = gnc_account_foreach_descendant_until (leader, look_for_portfolio_cb,
|
||||
NULL);
|
||||
if (ret) reg_type = PORTFOLIO_LEDGER;
|
||||
break;
|
||||
}
|
||||
@ -338,22 +340,23 @@ gnc_get_reg_type (Account *leader, GNCLedgerDisplayType ld_type)
|
||||
/* Returns a boolean of whether this display should be single or double lined
|
||||
* mode by default */
|
||||
gboolean
|
||||
gnc_ledger_display_default_double_line (GNCLedgerDisplay *gld)
|
||||
gnc_ledger_display_default_double_line (GNCLedgerDisplay* gld)
|
||||
{
|
||||
return (gld->use_double_line_default ||
|
||||
gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL_REGISTER, GNC_PREF_DOUBLE_LINE_MODE));
|
||||
gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL_REGISTER,
|
||||
GNC_PREF_DOUBLE_LINE_MODE));
|
||||
}
|
||||
|
||||
/* Opens up a register window to display a single account */
|
||||
GNCLedgerDisplay *
|
||||
gnc_ledger_display_simple (Account *account)
|
||||
GNCLedgerDisplay*
|
||||
gnc_ledger_display_simple (Account* account)
|
||||
{
|
||||
SplitRegisterType reg_type;
|
||||
GNCAccountType acc_type = xaccAccountGetType (account);
|
||||
gboolean use_double_line;
|
||||
GNCLedgerDisplay *ld;
|
||||
GNCLedgerDisplay* ld;
|
||||
|
||||
ENTER("account=%p", account);
|
||||
ENTER ("account=%p", account);
|
||||
|
||||
switch (acc_type)
|
||||
{
|
||||
@ -369,43 +372,44 @@ gnc_ledger_display_simple (Account *account)
|
||||
reg_type = gnc_get_reg_type (account, LD_SINGLE);
|
||||
|
||||
ld = gnc_ledger_display_internal (account, NULL, LD_SINGLE, reg_type,
|
||||
gnc_get_default_register_style(acc_type),
|
||||
use_double_line, FALSE);
|
||||
LEAVE("%p", ld);
|
||||
gnc_get_default_register_style (acc_type),
|
||||
use_double_line, FALSE, FALSE);
|
||||
LEAVE ("%p", ld);
|
||||
return ld;
|
||||
}
|
||||
|
||||
/* Opens up a register window to display an account, and all of its
|
||||
* children, in the same window */
|
||||
GNCLedgerDisplay *
|
||||
gnc_ledger_display_subaccounts (Account *account)
|
||||
GNCLedgerDisplay*
|
||||
gnc_ledger_display_subaccounts (Account* account,
|
||||
gboolean mismatched_commodities)
|
||||
{
|
||||
SplitRegisterType reg_type;
|
||||
GNCLedgerDisplay *ld;
|
||||
GNCLedgerDisplay* ld;
|
||||
|
||||
ENTER("account=%p", account);
|
||||
ENTER ("account=%p", account);
|
||||
|
||||
reg_type = gnc_get_reg_type (account, LD_SUBACCOUNT);
|
||||
|
||||
ld = gnc_ledger_display_internal (account, NULL, LD_SUBACCOUNT,
|
||||
reg_type, REG_STYLE_JOURNAL, FALSE,
|
||||
FALSE);
|
||||
LEAVE("%p", ld);
|
||||
FALSE, mismatched_commodities);
|
||||
LEAVE ("%p", ld);
|
||||
return ld;
|
||||
}
|
||||
|
||||
/* Opens up a general journal window. */
|
||||
GNCLedgerDisplay *
|
||||
GNCLedgerDisplay*
|
||||
gnc_ledger_display_gl (void)
|
||||
{
|
||||
Query *query;
|
||||
Query* query;
|
||||
time64 start;
|
||||
struct tm tm;
|
||||
GNCLedgerDisplay *ld;
|
||||
GNCLedgerDisplay* ld;
|
||||
|
||||
ENTER(" ");
|
||||
ENTER (" ");
|
||||
|
||||
query = qof_query_create_for(GNC_ID_SPLIT);
|
||||
query = qof_query_create_for (GNC_ID_SPLIT);
|
||||
|
||||
qof_query_set_book (query, gnc_get_current_book());
|
||||
|
||||
@ -416,21 +420,21 @@ gnc_ledger_display_gl (void)
|
||||
* See Gnome Bug 86302.
|
||||
* -- jsled */
|
||||
{
|
||||
Account *tRoot;
|
||||
GList *al;
|
||||
Account* tRoot;
|
||||
GList* al;
|
||||
|
||||
tRoot = gnc_book_get_template_root( gnc_get_current_book() );
|
||||
al = gnc_account_get_descendants( tRoot );
|
||||
tRoot = gnc_book_get_template_root (gnc_get_current_book());
|
||||
al = gnc_account_get_descendants (tRoot);
|
||||
|
||||
if (g_list_length(al) != 0)
|
||||
xaccQueryAddAccountMatch( query, al, QOF_GUID_MATCH_NONE, QOF_QUERY_AND );
|
||||
if (g_list_length (al) != 0)
|
||||
xaccQueryAddAccountMatch (query, al, QOF_GUID_MATCH_NONE, QOF_QUERY_AND);
|
||||
|
||||
g_list_free (al);
|
||||
al = NULL;
|
||||
tRoot = NULL;
|
||||
}
|
||||
|
||||
gnc_tm_get_today_start(&tm);
|
||||
gnc_tm_get_today_start (&tm);
|
||||
tm.tm_mon--; /* Default the register to the last month's worth of transactions. */
|
||||
start = gnc_mktime (&tm);
|
||||
xaccQueryAddDateMatchTT (query,
|
||||
@ -439,8 +443,8 @@ gnc_ledger_display_gl (void)
|
||||
QOF_QUERY_AND);
|
||||
|
||||
ld = gnc_ledger_display_internal (NULL, query, LD_GL, GENERAL_JOURNAL,
|
||||
REG_STYLE_JOURNAL, FALSE, FALSE);
|
||||
LEAVE("%p", ld);
|
||||
REG_STYLE_JOURNAL, FALSE, FALSE, FALSE);
|
||||
LEAVE ("%p", ld);
|
||||
return ld;
|
||||
}
|
||||
|
||||
@ -452,31 +456,31 @@ gnc_ledger_display_gl (void)
|
||||
* scheduled transaction. That's right. The stringified GncGUID of the SX is
|
||||
* the name of the SX'es template account.
|
||||
**/
|
||||
GNCLedgerDisplay *
|
||||
gnc_ledger_display_template_gl (char *id)
|
||||
GNCLedgerDisplay*
|
||||
gnc_ledger_display_template_gl (char* id)
|
||||
{
|
||||
QofBook *book;
|
||||
Query *q;
|
||||
GNCLedgerDisplay *ld;
|
||||
SplitRegister *sr;
|
||||
Account *root, *acct;
|
||||
QofBook* book;
|
||||
Query* q;
|
||||
GNCLedgerDisplay* ld;
|
||||
SplitRegister* sr;
|
||||
Account* root, *acct;
|
||||
gboolean isTemplateModeTrue;
|
||||
|
||||
ENTER("id=%s", id ? id : "(null)");
|
||||
ENTER ("id=%s", id ? id : "(null)");
|
||||
|
||||
acct = NULL;
|
||||
isTemplateModeTrue = TRUE;
|
||||
|
||||
q = qof_query_create_for(GNC_ID_SPLIT);
|
||||
q = qof_query_create_for (GNC_ID_SPLIT);
|
||||
|
||||
book = gnc_get_current_book ();
|
||||
book = gnc_get_current_book();
|
||||
qof_query_set_book (q, book);
|
||||
|
||||
if ( id != NULL )
|
||||
if (id != NULL)
|
||||
{
|
||||
root = gnc_book_get_template_root (book);
|
||||
acct = gnc_account_lookup_by_name(root, id);
|
||||
g_assert( acct );
|
||||
acct = gnc_account_lookup_by_name (root, id);
|
||||
g_assert (acct);
|
||||
xaccQueryAddSingleAccountMatch (q, acct, QOF_QUERY_AND);
|
||||
}
|
||||
|
||||
@ -484,41 +488,42 @@ gnc_ledger_display_template_gl (char *id)
|
||||
SEARCH_LEDGER,
|
||||
REG_STYLE_JOURNAL,
|
||||
FALSE,
|
||||
isTemplateModeTrue);
|
||||
isTemplateModeTrue,
|
||||
FALSE);
|
||||
|
||||
sr = gnc_ledger_display_get_split_register (ld);
|
||||
if ( acct )
|
||||
if (acct)
|
||||
{
|
||||
gnc_split_register_set_template_account (sr, acct);
|
||||
}
|
||||
|
||||
LEAVE("%p", ld);
|
||||
LEAVE ("%p", ld);
|
||||
return ld;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gnc_ledger_display_get_parent( GNCLedgerDisplay *ld )
|
||||
GtkWidget*
|
||||
gnc_ledger_display_get_parent (GNCLedgerDisplay* ld)
|
||||
{
|
||||
if ( ld == NULL )
|
||||
if (ld == NULL)
|
||||
return NULL;
|
||||
|
||||
if ( ld->get_parent == NULL )
|
||||
if (ld->get_parent == NULL)
|
||||
return NULL;
|
||||
|
||||
return ld->get_parent( ld );
|
||||
return ld->get_parent (ld);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
gnc_ledger_display_parent (void *user_data)
|
||||
static GtkWidget*
|
||||
gnc_ledger_display_parent (void* user_data)
|
||||
{
|
||||
GNCLedgerDisplay *ld = user_data;
|
||||
return gnc_ledger_display_get_parent( ld );
|
||||
GNCLedgerDisplay* ld = user_data;
|
||||
return gnc_ledger_display_get_parent (ld);
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_ledger_display_set_watches (GNCLedgerDisplay *ld, GList *splits)
|
||||
gnc_ledger_display_set_watches (GNCLedgerDisplay* ld, GList* splits)
|
||||
{
|
||||
GList *node;
|
||||
GList* node;
|
||||
|
||||
gnc_gui_component_clear_watches (ld->component_id);
|
||||
|
||||
@ -529,8 +534,8 @@ gnc_ledger_display_set_watches (GNCLedgerDisplay *ld, GList *splits)
|
||||
|
||||
for (node = splits; node; node = node->next)
|
||||
{
|
||||
Split *split = node->data;
|
||||
Transaction *trans = xaccSplitGetParent (split);
|
||||
Split* split = node->data;
|
||||
Transaction* trans = xaccSplitGetParent (split);
|
||||
|
||||
gnc_gui_component_watch_entity (ld->component_id,
|
||||
xaccTransGetGUID (trans),
|
||||
@ -539,18 +544,18 @@ gnc_ledger_display_set_watches (GNCLedgerDisplay *ld, GList *splits)
|
||||
}
|
||||
|
||||
static void
|
||||
refresh_handler (GHashTable *changes, gpointer user_data)
|
||||
refresh_handler (GHashTable* changes, gpointer user_data)
|
||||
{
|
||||
GNCLedgerDisplay *ld = user_data;
|
||||
const EventInfo *info;
|
||||
GNCLedgerDisplay* ld = user_data;
|
||||
const EventInfo* info;
|
||||
gboolean has_leader;
|
||||
GList *splits;
|
||||
GList* splits;
|
||||
|
||||
ENTER("changes=%p, user_data=%p", changes, user_data);
|
||||
ENTER ("changes=%p, user_data=%p", changes, user_data);
|
||||
|
||||
if (ld->loading)
|
||||
{
|
||||
LEAVE("already loading");
|
||||
LEAVE ("already loading");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -558,11 +563,11 @@ refresh_handler (GHashTable *changes, gpointer user_data)
|
||||
|
||||
if (has_leader)
|
||||
{
|
||||
Account *leader = gnc_ledger_display_leader (ld);
|
||||
Account* leader = gnc_ledger_display_leader (ld);
|
||||
if (!leader)
|
||||
{
|
||||
gnc_close_gui_component (ld->component_id);
|
||||
LEAVE("no leader");
|
||||
LEAVE ("no leader");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -573,7 +578,7 @@ refresh_handler (GHashTable *changes, gpointer user_data)
|
||||
if (info && (info->event_mask & QOF_EVENT_DESTROY))
|
||||
{
|
||||
gnc_close_gui_component (ld->component_id);
|
||||
LEAVE("destroy");
|
||||
LEAVE ("destroy");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -582,13 +587,13 @@ refresh_handler (GHashTable *changes, gpointer user_data)
|
||||
* of subaccounts, if not recreate the query. */
|
||||
if (ld->ld_type == LD_SUBACCOUNT)
|
||||
{
|
||||
Account *leader = gnc_ledger_display_leader (ld);
|
||||
GList *accounts = gnc_account_get_descendants (leader);
|
||||
Account* leader = gnc_ledger_display_leader (ld);
|
||||
GList* accounts = gnc_account_get_descendants (leader);
|
||||
|
||||
if (g_list_length (accounts) != ld->number_of_subaccounts)
|
||||
gnc_ledger_display_make_query (ld,
|
||||
gnc_prefs_get_float(GNC_PREFS_GROUP_GENERAL_REGISTER, GNC_PREF_MAX_TRANS),
|
||||
gnc_get_reg_type (leader, ld->ld_type));
|
||||
gnc_prefs_get_float (GNC_PREFS_GROUP_GENERAL_REGISTER, GNC_PREF_MAX_TRANS),
|
||||
gnc_get_reg_type (leader, ld->ld_type));
|
||||
|
||||
g_list_free (accounts);
|
||||
}
|
||||
@ -603,13 +608,13 @@ refresh_handler (GHashTable *changes, gpointer user_data)
|
||||
gnc_ledger_display_set_watches (ld, splits);
|
||||
|
||||
gnc_ledger_display_refresh_internal (ld, splits);
|
||||
LEAVE(" ");
|
||||
LEAVE (" ");
|
||||
}
|
||||
|
||||
static void
|
||||
close_handler (gpointer user_data)
|
||||
{
|
||||
GNCLedgerDisplay *ld = user_data;
|
||||
GNCLedgerDisplay* ld = user_data;
|
||||
|
||||
if (!ld)
|
||||
return;
|
||||
@ -630,12 +635,12 @@ close_handler (gpointer user_data)
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_ledger_display_make_query (GNCLedgerDisplay *ld,
|
||||
gnc_ledger_display_make_query (GNCLedgerDisplay* ld,
|
||||
gint limit,
|
||||
SplitRegisterType type)
|
||||
{
|
||||
Account *leader;
|
||||
GList *accounts;
|
||||
Account* leader;
|
||||
GList* accounts;
|
||||
|
||||
if (!ld)
|
||||
return;
|
||||
@ -655,7 +660,7 @@ gnc_ledger_display_make_query (GNCLedgerDisplay *ld,
|
||||
}
|
||||
|
||||
qof_query_destroy (ld->query);
|
||||
ld->query = qof_query_create_for(GNC_ID_SPLIT);
|
||||
ld->query = qof_query_create_for (GNC_ID_SPLIT);
|
||||
|
||||
/* This is a bit of a hack. The number of splits should be
|
||||
* configurable, or maybe we should go back a time range instead
|
||||
@ -668,8 +673,8 @@ gnc_ledger_display_make_query (GNCLedgerDisplay *ld,
|
||||
|
||||
leader = gnc_ledger_display_leader (ld);
|
||||
|
||||
/* if this is a subaccount ledger, record the number of
|
||||
* subaccounts so we can determine if the query needs
|
||||
/* if this is a subaccount ledger, record the number of
|
||||
* subaccounts so we can determine if the query needs
|
||||
* recreating on a refresh. */
|
||||
if (ld->ld_type == LD_SUBACCOUNT)
|
||||
{
|
||||
@ -688,32 +693,33 @@ gnc_ledger_display_make_query (GNCLedgerDisplay *ld,
|
||||
}
|
||||
|
||||
/* Opens up a ledger window for an arbitrary query. */
|
||||
GNCLedgerDisplay *
|
||||
gnc_ledger_display_query (Query *query, SplitRegisterType type,
|
||||
GNCLedgerDisplay*
|
||||
gnc_ledger_display_query (Query* query, SplitRegisterType type,
|
||||
SplitRegisterStyle style)
|
||||
{
|
||||
GNCLedgerDisplay *ld;
|
||||
GNCLedgerDisplay* ld;
|
||||
|
||||
ENTER("query=%p", query);
|
||||
ENTER ("query=%p", query);
|
||||
|
||||
ld = gnc_ledger_display_internal (NULL, query, LD_GL, type, style,
|
||||
FALSE, FALSE);
|
||||
LEAVE("%p", ld);
|
||||
FALSE, FALSE, FALSE);
|
||||
LEAVE ("%p", ld);
|
||||
return ld;
|
||||
}
|
||||
|
||||
static GNCLedgerDisplay *
|
||||
gnc_ledger_display_internal (Account *lead_account, Query *q,
|
||||
static GNCLedgerDisplay*
|
||||
gnc_ledger_display_internal (Account* lead_account, Query* q,
|
||||
GNCLedgerDisplayType ld_type,
|
||||
SplitRegisterType reg_type,
|
||||
SplitRegisterStyle style,
|
||||
gboolean use_double_line,
|
||||
gboolean is_template )
|
||||
gboolean is_template,
|
||||
gboolean mismatched_commodities)
|
||||
{
|
||||
GNCLedgerDisplay *ld;
|
||||
GNCLedgerDisplay* ld;
|
||||
gint limit;
|
||||
const char *klass;
|
||||
GList *splits;
|
||||
const char* klass;
|
||||
GList* splits;
|
||||
|
||||
switch (ld_type)
|
||||
{
|
||||
@ -791,7 +797,8 @@ gnc_ledger_display_internal (Account *lead_account, Query *q,
|
||||
ld->get_parent = NULL;
|
||||
ld->user_data = NULL;
|
||||
|
||||
limit = gnc_prefs_get_float(GNC_PREFS_GROUP_GENERAL_REGISTER, GNC_PREF_MAX_TRANS);
|
||||
limit = gnc_prefs_get_float (GNC_PREFS_GROUP_GENERAL_REGISTER,
|
||||
GNC_PREF_MAX_TRANS);
|
||||
|
||||
/* set up the query filter */
|
||||
if (q)
|
||||
@ -800,16 +807,17 @@ gnc_ledger_display_internal (Account *lead_account, Query *q,
|
||||
gnc_ledger_display_make_query (ld, limit, reg_type);
|
||||
|
||||
ld->component_id = gnc_register_gui_component (klass,
|
||||
refresh_handler,
|
||||
close_handler, ld);
|
||||
refresh_handler,
|
||||
close_handler, ld);
|
||||
|
||||
/******************************************************************\
|
||||
* The main register window itself *
|
||||
\******************************************************************/
|
||||
|
||||
ld->use_double_line_default = use_double_line;
|
||||
|
||||
ld->reg = gnc_split_register_new (reg_type, style, use_double_line,
|
||||
is_template);
|
||||
is_template, mismatched_commodities);
|
||||
|
||||
gnc_split_register_set_data (ld->reg, ld, gnc_ledger_display_parent);
|
||||
|
||||
@ -823,7 +831,7 @@ gnc_ledger_display_internal (Account *lead_account, Query *q,
|
||||
}
|
||||
|
||||
void
|
||||
gnc_ledger_display_set_query (GNCLedgerDisplay *ledger_display, Query *q)
|
||||
gnc_ledger_display_set_query (GNCLedgerDisplay* ledger_display, Query* q)
|
||||
{
|
||||
if (!ledger_display || !q)
|
||||
return;
|
||||
@ -834,8 +842,8 @@ gnc_ledger_display_set_query (GNCLedgerDisplay *ledger_display, Query *q)
|
||||
ledger_display->query = qof_query_copy (q);
|
||||
}
|
||||
|
||||
GNCLedgerDisplay *
|
||||
gnc_ledger_display_find_by_query (Query *q)
|
||||
GNCLedgerDisplay*
|
||||
gnc_ledger_display_find_by_query (Query* q)
|
||||
{
|
||||
if (!q)
|
||||
return NULL;
|
||||
@ -848,7 +856,7 @@ gnc_ledger_display_find_by_query (Query *q)
|
||||
\********************************************************************/
|
||||
|
||||
static void
|
||||
gnc_ledger_display_refresh_internal (GNCLedgerDisplay *ld, GList *splits)
|
||||
gnc_ledger_display_refresh_internal (GNCLedgerDisplay* ld, GList* splits)
|
||||
{
|
||||
if (!ld || ld->loading)
|
||||
return;
|
||||
@ -865,30 +873,30 @@ gnc_ledger_display_refresh_internal (GNCLedgerDisplay *ld, GList *splits)
|
||||
}
|
||||
|
||||
void
|
||||
gnc_ledger_display_refresh (GNCLedgerDisplay *ld)
|
||||
gnc_ledger_display_refresh (GNCLedgerDisplay* ld)
|
||||
{
|
||||
ENTER("ld=%p", ld);
|
||||
ENTER ("ld=%p", ld);
|
||||
|
||||
if (!ld)
|
||||
{
|
||||
LEAVE("no display");
|
||||
LEAVE ("no display");
|
||||
return;
|
||||
}
|
||||
|
||||
if (ld->loading)
|
||||
{
|
||||
LEAVE("already loading");
|
||||
LEAVE ("already loading");
|
||||
return;
|
||||
}
|
||||
|
||||
gnc_ledger_display_refresh_internal (ld, qof_query_run (ld->query));
|
||||
LEAVE(" ");
|
||||
LEAVE (" ");
|
||||
}
|
||||
|
||||
void
|
||||
gnc_ledger_display_refresh_by_split_register (SplitRegister *reg)
|
||||
gnc_ledger_display_refresh_by_split_register (SplitRegister* reg)
|
||||
{
|
||||
GNCLedgerDisplay *ld;
|
||||
GNCLedgerDisplay* ld;
|
||||
|
||||
if (!reg)
|
||||
return;
|
||||
@ -918,7 +926,7 @@ gnc_ledger_display_refresh_by_split_register (SplitRegister *reg)
|
||||
}
|
||||
|
||||
ld = gnc_find_first_gui_component (REGISTER_TEMPLATE_CM_CLASS,
|
||||
find_by_reg, reg );
|
||||
find_by_reg, reg);
|
||||
if (ld)
|
||||
{
|
||||
gnc_ledger_display_refresh (ld);
|
||||
@ -926,7 +934,7 @@ gnc_ledger_display_refresh_by_split_register (SplitRegister *reg)
|
||||
}
|
||||
|
||||
void
|
||||
gnc_ledger_display_close (GNCLedgerDisplay *ld)
|
||||
gnc_ledger_display_close (GNCLedgerDisplay* ld)
|
||||
{
|
||||
if (!ld)
|
||||
return;
|
||||
|
@ -46,10 +46,10 @@
|
||||
* displaying the results of a Query. It also stores the Query. */
|
||||
typedef struct gnc_ledger_display GNCLedgerDisplay;
|
||||
|
||||
typedef void (*GNCLedgerDisplayDestroy) (GNCLedgerDisplay *ld);
|
||||
typedef GtkWidget *(*GNCLedgerDisplayGetParent) (GNCLedgerDisplay *ld);
|
||||
typedef void (*GNCLedgerDisplaySetHelp) (GNCLedgerDisplay *ld,
|
||||
const char *help_str);
|
||||
typedef void (*GNCLedgerDisplayDestroy) (GNCLedgerDisplay* ld);
|
||||
typedef GtkWidget* (*GNCLedgerDisplayGetParent) (GNCLedgerDisplay* ld);
|
||||
typedef void (*GNCLedgerDisplaySetHelp) (GNCLedgerDisplay* ld,
|
||||
const char* help_str);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
@ -60,35 +60,36 @@ typedef enum
|
||||
|
||||
|
||||
/** returns the 'lead' account of a ledger display, or NULL if none. */
|
||||
Account * gnc_ledger_display_leader (GNCLedgerDisplay *ld);
|
||||
Account* gnc_ledger_display_leader (GNCLedgerDisplay* ld);
|
||||
|
||||
GNCLedgerDisplayType gnc_ledger_display_type (GNCLedgerDisplay *ld);
|
||||
GNCLedgerDisplayType gnc_ledger_display_type (GNCLedgerDisplay* ld);
|
||||
|
||||
/** get and set the user data associated with the ledger */
|
||||
void gnc_ledger_display_set_user_data (GNCLedgerDisplay *ld,
|
||||
void gnc_ledger_display_set_user_data (GNCLedgerDisplay* ld,
|
||||
gpointer user_data);
|
||||
gpointer gnc_ledger_display_get_user_data (GNCLedgerDisplay *ld);
|
||||
gpointer gnc_ledger_display_get_user_data (GNCLedgerDisplay* ld);
|
||||
|
||||
/** set the handlers used by the ledger display */
|
||||
void gnc_ledger_display_set_handlers (GNCLedgerDisplay *ld,
|
||||
void gnc_ledger_display_set_handlers (GNCLedgerDisplay* ld,
|
||||
GNCLedgerDisplayDestroy destroy,
|
||||
GNCLedgerDisplayGetParent get_parent);
|
||||
|
||||
/** Returns the parent of a given ledger display */
|
||||
GtkWidget *gnc_ledger_display_get_parent( GNCLedgerDisplay *ld );
|
||||
GtkWidget* gnc_ledger_display_get_parent (GNCLedgerDisplay* ld);
|
||||
|
||||
/** return the split register associated with a ledger display */
|
||||
SplitRegister * gnc_ledger_display_get_split_register (GNCLedgerDisplay *ld);
|
||||
SplitRegister* gnc_ledger_display_get_split_register (GNCLedgerDisplay* ld);
|
||||
|
||||
/** opens up a register window to display a single account */
|
||||
GNCLedgerDisplay * gnc_ledger_display_simple (Account *account);
|
||||
GNCLedgerDisplay* gnc_ledger_display_simple (Account* account);
|
||||
|
||||
/** opens up a register window to display the parent account and all of
|
||||
* its children. */
|
||||
GNCLedgerDisplay * gnc_ledger_display_subaccounts (Account *account);
|
||||
GNCLedgerDisplay* gnc_ledger_display_subaccounts (Account* account,
|
||||
gboolean mismatched_commodities);
|
||||
|
||||
/** opens up a general ledger window */
|
||||
GNCLedgerDisplay * gnc_ledger_display_gl (void);
|
||||
GNCLedgerDisplay* gnc_ledger_display_gl (void);
|
||||
|
||||
/**
|
||||
* Displays a template ledger.
|
||||
@ -97,34 +98,34 @@ GNCLedgerDisplay * gnc_ledger_display_gl (void);
|
||||
* Really, requires a GList of scheduled transactions and kvp-frame
|
||||
* data.
|
||||
**/
|
||||
GNCLedgerDisplay * gnc_ledger_display_template_gl (char *id);
|
||||
GNCLedgerDisplay* gnc_ledger_display_template_gl (char* id);
|
||||
|
||||
/** display a general ledger for an arbitrary query */
|
||||
GNCLedgerDisplay * gnc_ledger_display_query (Query *query,
|
||||
SplitRegisterType type,
|
||||
SplitRegisterStyle style);
|
||||
GNCLedgerDisplay* gnc_ledger_display_query (Query* query,
|
||||
SplitRegisterType type,
|
||||
SplitRegisterStyle style);
|
||||
|
||||
/** Set the query used for a register. */
|
||||
void gnc_ledger_display_set_query (GNCLedgerDisplay *ledger_display,
|
||||
Query *q);
|
||||
void gnc_ledger_display_set_query (GNCLedgerDisplay* ledger_display,
|
||||
Query* q);
|
||||
|
||||
/** return the query associated with a ledger */
|
||||
Query * gnc_ledger_display_get_query (GNCLedgerDisplay *ld);
|
||||
Query* gnc_ledger_display_get_query (GNCLedgerDisplay* ld);
|
||||
|
||||
/** If the given ledger display still exists, return it. Otherwise,
|
||||
* return NULL */
|
||||
GNCLedgerDisplay * gnc_ledger_display_find_by_query (Query *q);
|
||||
GNCLedgerDisplay* gnc_ledger_display_find_by_query (Query* q);
|
||||
|
||||
/** redisplay/redraw only the indicated window. Both routines do same
|
||||
* thing, they differ only by the argument they take. */
|
||||
void gnc_ledger_display_refresh (GNCLedgerDisplay * ledger_display);
|
||||
void gnc_ledger_display_refresh_by_split_register (SplitRegister *reg);
|
||||
void gnc_ledger_display_refresh (GNCLedgerDisplay* ledger_display);
|
||||
void gnc_ledger_display_refresh_by_split_register (SplitRegister* reg);
|
||||
|
||||
/** close the window */
|
||||
void gnc_ledger_display_close (GNCLedgerDisplay * ledger_display);
|
||||
void gnc_ledger_display_close (GNCLedgerDisplay* ledger_display);
|
||||
|
||||
/** Returns a boolean of whether this display should be single or double lined
|
||||
* mode by default */
|
||||
gboolean gnc_ledger_display_default_double_line (GNCLedgerDisplay *gld);
|
||||
gboolean gnc_ledger_display_default_double_line (GNCLedgerDisplay* gld);
|
||||
|
||||
#endif
|
||||
|
@ -93,7 +93,8 @@ gnc_ledger_display2_internal (Account *lead_account, Query *q,
|
||||
SplitRegisterType2 reg_type,
|
||||
SplitRegisterStyle2 style,
|
||||
gboolean use_double_line,
|
||||
gboolean is_template);
|
||||
gboolean is_template,
|
||||
gboolean mismatched_commodities);
|
||||
|
||||
static void gnc_ledger_display2_refresh_internal (GNCLedgerDisplay2 *ld, GList *splits);
|
||||
|
||||
@ -373,7 +374,7 @@ gnc_ledger_display2_simple (Account *account)
|
||||
|
||||
ld = gnc_ledger_display2_internal (account, NULL, LD2_SINGLE, reg_type,
|
||||
gnc_get_default_register_style(acc_type),
|
||||
use_double_line, FALSE);
|
||||
use_double_line, FALSE, FALSE);
|
||||
LEAVE("%p", ld);
|
||||
return ld;
|
||||
}
|
||||
@ -381,7 +382,7 @@ gnc_ledger_display2_simple (Account *account)
|
||||
/* Opens up a register window to display an account, and all of its
|
||||
* children, in the same window */
|
||||
GNCLedgerDisplay2 *
|
||||
gnc_ledger_display2_subaccounts (Account *account)
|
||||
gnc_ledger_display2_subaccounts (Account *account, gboolean mismatched_commodities)
|
||||
{
|
||||
SplitRegisterType2 reg_type;
|
||||
GNCLedgerDisplay2 *ld;
|
||||
@ -392,7 +393,7 @@ gnc_ledger_display2_subaccounts (Account *account)
|
||||
|
||||
ld = gnc_ledger_display2_internal (account, NULL, LD2_SUBACCOUNT,
|
||||
reg_type, REG2_STYLE_JOURNAL, FALSE,
|
||||
FALSE);
|
||||
FALSE,mismatched_commodities);
|
||||
LEAVE("%p", ld);
|
||||
return ld;
|
||||
}
|
||||
@ -442,7 +443,7 @@ gnc_ledger_display2_gl (void)
|
||||
QOF_QUERY_AND);
|
||||
|
||||
ld = gnc_ledger_display2_internal (NULL, query, LD2_GL, GENERAL_JOURNAL2,
|
||||
REG2_STYLE_JOURNAL, FALSE, FALSE);
|
||||
REG2_STYLE_JOURNAL, FALSE, FALSE, FALSE);
|
||||
LEAVE("%p", ld);
|
||||
return ld;
|
||||
}
|
||||
@ -487,7 +488,8 @@ gnc_ledger_display2_template_gl (char *id)
|
||||
SEARCH_LEDGER2,
|
||||
REG2_STYLE_JOURNAL,
|
||||
FALSE,
|
||||
isTemplateModeTrue);
|
||||
isTemplateModeTrue,
|
||||
FALSE);
|
||||
|
||||
|
||||
model = gnc_ledger_display2_get_split_model_register (ld);
|
||||
@ -689,7 +691,7 @@ gnc_ledger_display2_query (Query *query, SplitRegisterType2 type,
|
||||
ENTER("query=%p", query);
|
||||
|
||||
ld = gnc_ledger_display2_internal (NULL, query, LD2_GL, type, style,
|
||||
FALSE, FALSE);
|
||||
FALSE, FALSE, FALSE);
|
||||
LEAVE("%p", ld);
|
||||
return ld;
|
||||
}
|
||||
@ -700,7 +702,8 @@ gnc_ledger_display2_internal (Account *lead_account, Query *q,
|
||||
SplitRegisterType2 reg_type,
|
||||
SplitRegisterStyle2 style,
|
||||
gboolean use_double_line,
|
||||
gboolean is_template )
|
||||
gboolean is_template,
|
||||
gboolean mismatched_commodities)
|
||||
{
|
||||
GNCLedgerDisplay2 *ld;
|
||||
gint limit;
|
||||
@ -806,7 +809,8 @@ gnc_ledger_display2_internal (Account *lead_account, Query *q,
|
||||
|
||||
ld->use_double_line_default = use_double_line;
|
||||
|
||||
ld->model = gnc_tree_model_split_reg_new (reg_type, style, use_double_line, is_template);
|
||||
// JEAN: add mismatched_commodities
|
||||
ld->model = gnc_tree_model_split_reg_new (reg_type, style, use_double_line, is_template, mismatched_commodities);
|
||||
|
||||
gnc_tree_model_split_reg_set_data (ld->model, ld, gnc_ledger_display2_parent);
|
||||
gnc_tree_model_split_reg_set_display (ld->model, display_subaccounts, is_gl);
|
||||
|
@ -99,7 +99,7 @@ GNCLedgerDisplay2 * gnc_ledger_display2_simple (Account *account);
|
||||
|
||||
/** opens up a register window to display the parent account and all of
|
||||
* its children. */
|
||||
GNCLedgerDisplay2 * gnc_ledger_display2_subaccounts (Account *account);
|
||||
GNCLedgerDisplay2 * gnc_ledger_display2_subaccounts (Account *account, gboolean mismatched_commodities);
|
||||
|
||||
/** opens up a general ledger window */
|
||||
GNCLedgerDisplay2 * gnc_ledger_display2_gl (void);
|
||||
|
@ -35,15 +35,15 @@ static QofLogModule log_module = GNC_MOD_REGISTER;
|
||||
|
||||
|
||||
static void
|
||||
gnc_register_add_cell (TableLayout *layout,
|
||||
const char *cell_name,
|
||||
const char *cell_type_name,
|
||||
const char *sample_text,
|
||||
gnc_register_add_cell (TableLayout* layout,
|
||||
const char* cell_name,
|
||||
const char* cell_type_name,
|
||||
const char* sample_text,
|
||||
CellAlignment alignment,
|
||||
gboolean expandable,
|
||||
gboolean span)
|
||||
{
|
||||
BasicCell *cell;
|
||||
BasicCell* cell;
|
||||
|
||||
g_return_if_fail (layout != NULL);
|
||||
g_return_if_fail (cell_type_name != NULL);
|
||||
@ -61,13 +61,13 @@ gnc_register_add_cell (TableLayout *layout,
|
||||
}
|
||||
|
||||
static void
|
||||
copy_cursor_row (TableLayout *layout, CellBlock *to, CellBlock *from, int row)
|
||||
copy_cursor_row (TableLayout* layout, CellBlock* to, CellBlock* from, int row)
|
||||
{
|
||||
int col;
|
||||
|
||||
for (col = 0; col < from->num_cols; col++)
|
||||
{
|
||||
BasicCell *cell;
|
||||
BasicCell* cell;
|
||||
|
||||
cell = gnc_cellblock_get_cell (from, row, col);
|
||||
if (!cell || !cell->cell_name)
|
||||
@ -78,10 +78,10 @@ copy_cursor_row (TableLayout *layout, CellBlock *to, CellBlock *from, int row)
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_split_register_set_cells (SplitRegister *reg, TableLayout *layout)
|
||||
gnc_split_register_set_cells (SplitRegister* reg, TableLayout* layout)
|
||||
{
|
||||
CellBlock *curs;
|
||||
CellBlock *curs_last;
|
||||
CellBlock* curs;
|
||||
CellBlock* curs_last;
|
||||
|
||||
switch (reg->type)
|
||||
{
|
||||
@ -291,8 +291,16 @@ gnc_split_register_set_cells (SplitRegister *reg, TableLayout *layout)
|
||||
{
|
||||
gnc_table_layout_set_cell (layout, curs, DEBT_CELL, 0, 5);
|
||||
gnc_table_layout_set_cell (layout, curs, CRED_CELL, 0, 6);
|
||||
gnc_table_layout_set_cell (layout, curs, RBALN_CELL, 0, 7);
|
||||
gnc_table_layout_set_cell (layout, curs, RATE_CELL, 0, 8);
|
||||
if (!reg->mismatched_commodities)
|
||||
{
|
||||
gnc_table_layout_set_cell (layout, curs, RBALN_CELL, 0, 7);
|
||||
gnc_table_layout_set_cell (layout, curs, RATE_CELL, 0, 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Don't display the balance if there are mismatched commodities
|
||||
gnc_table_layout_set_cell (layout, curs, RATE_CELL, 0, 7);
|
||||
}
|
||||
}
|
||||
|
||||
curs_last = curs;
|
||||
@ -328,8 +336,16 @@ gnc_split_register_set_cells (SplitRegister *reg, TableLayout *layout)
|
||||
gnc_table_layout_set_cell (layout, curs, RATE_CELL, 0, 7);
|
||||
else
|
||||
{
|
||||
gnc_table_layout_set_cell (layout, curs, RBALN_CELL, 0, 7);
|
||||
gnc_table_layout_set_cell (layout, curs, RATE_CELL, 0, 8);
|
||||
if (!reg->mismatched_commodities)
|
||||
{
|
||||
gnc_table_layout_set_cell (layout, curs, RBALN_CELL, 0, 7);
|
||||
gnc_table_layout_set_cell (layout, curs, RATE_CELL, 0, 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Don't display the balance if there are mismatched commodities
|
||||
gnc_table_layout_set_cell (layout, curs, RATE_CELL, 0, 7);
|
||||
}
|
||||
}
|
||||
|
||||
curs_last = curs;
|
||||
@ -549,10 +565,10 @@ gnc_split_register_set_cells (SplitRegister *reg, TableLayout *layout)
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_split_register_layout_add_cursors (SplitRegister *reg,
|
||||
TableLayout *layout)
|
||||
gnc_split_register_layout_add_cursors (SplitRegister* reg,
|
||||
TableLayout* layout)
|
||||
{
|
||||
CellBlock *cursor;
|
||||
CellBlock* cursor;
|
||||
int num_cols;
|
||||
|
||||
switch (reg->type)
|
||||
@ -577,7 +593,7 @@ gnc_split_register_layout_add_cursors (SplitRegister *reg,
|
||||
case INCOME_LEDGER:
|
||||
case GENERAL_JOURNAL:
|
||||
case SEARCH_LEDGER:
|
||||
if (reg->is_template)
|
||||
if (reg->is_template || reg->mismatched_commodities)
|
||||
num_cols = 8;
|
||||
else
|
||||
num_cols = 9;
|
||||
@ -593,7 +609,7 @@ gnc_split_register_layout_add_cursors (SplitRegister *reg,
|
||||
break;
|
||||
|
||||
default:
|
||||
PERR("Bad register type");
|
||||
PERR ("Bad register type");
|
||||
g_assert (FALSE);
|
||||
return;
|
||||
}
|
||||
@ -628,8 +644,8 @@ gnc_split_register_layout_add_cursors (SplitRegister *reg,
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
TableLayout *layout)
|
||||
gnc_split_register_layout_add_cells (SplitRegister* reg,
|
||||
TableLayout* layout)
|
||||
{
|
||||
gnc_register_add_cell (layout,
|
||||
DATE_CELL,
|
||||
@ -637,7 +653,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
/* Translators: The 'sample:' items are
|
||||
strings which are not displayed, but only
|
||||
used to estimate widths. */
|
||||
C_("sample", "22/02/2000"),
|
||||
C_ ("sample", "22/02/2000"),
|
||||
CELL_ALIGN_RIGHT,
|
||||
FALSE,
|
||||
FALSE);
|
||||
@ -645,7 +661,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
DDUE_CELL,
|
||||
DATE_CELL_TYPE_NAME,
|
||||
C_("sample", "22/02/2000"),
|
||||
C_ ("sample", "22/02/2000"),
|
||||
CELL_ALIGN_RIGHT,
|
||||
FALSE,
|
||||
FALSE);
|
||||
@ -656,7 +672,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
/* Translators: The 'sample' items are
|
||||
strings which are not displayed, but only
|
||||
used to estimate widths. */
|
||||
C_("sample", "99999"),
|
||||
C_ ("sample", "99999"),
|
||||
CELL_ALIGN_LEFT,
|
||||
FALSE,
|
||||
FALSE);
|
||||
@ -664,7 +680,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
TNUM_CELL,
|
||||
BASIC_CELL_TYPE_NAME,
|
||||
C_("sample", "99999"),
|
||||
C_ ("sample", "99999"),
|
||||
CELL_ALIGN_LEFT,
|
||||
FALSE,
|
||||
FALSE);
|
||||
@ -672,7 +688,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
DESC_CELL,
|
||||
QUICKFILL_CELL_TYPE_NAME,
|
||||
C_("sample", "Description of a transaction"),
|
||||
C_ ("sample", "Description of a transaction"),
|
||||
CELL_ALIGN_LEFT,
|
||||
TRUE,
|
||||
FALSE);
|
||||
@ -688,7 +704,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
RECN_CELL,
|
||||
RECN_CELL_TYPE_NAME,
|
||||
C_("Column header for 'Reconciled'", "R"),
|
||||
C_ ("Column header for 'Reconciled'", "R"),
|
||||
CELL_ALIGN_CENTER,
|
||||
FALSE,
|
||||
FALSE);
|
||||
@ -696,7 +712,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
ASSOC_CELL,
|
||||
RECN_CELL_TYPE_NAME,
|
||||
C_("Column header for 'Associate'", "A"),
|
||||
C_ ("Column header for 'Associate'", "A"),
|
||||
CELL_ALIGN_CENTER,
|
||||
FALSE,
|
||||
FALSE);
|
||||
@ -704,7 +720,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
BALN_CELL,
|
||||
PRICE_CELL_TYPE_NAME,
|
||||
C_("sample", "999,999.000"),
|
||||
C_ ("sample", "999,999.000"),
|
||||
CELL_ALIGN_RIGHT,
|
||||
FALSE,
|
||||
FALSE);
|
||||
@ -712,7 +728,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
XFRM_CELL,
|
||||
COMBO_CELL_TYPE_NAME,
|
||||
_("Transfer"),
|
||||
_ ("Transfer"),
|
||||
CELL_ALIGN_RIGHT,
|
||||
FALSE,
|
||||
FALSE);
|
||||
@ -720,7 +736,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
MXFRM_CELL,
|
||||
COMBO_CELL_TYPE_NAME,
|
||||
C_("sample", "Expenses:Automobile:Gasoline"),
|
||||
C_ ("sample", "Expenses:Automobile:Gasoline"),
|
||||
CELL_ALIGN_RIGHT,
|
||||
FALSE,
|
||||
FALSE);
|
||||
@ -728,7 +744,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
ACTN_CELL,
|
||||
COMBO_CELL_TYPE_NAME,
|
||||
C_("sample", "Expenses:Automobile:Gasoline"),
|
||||
C_ ("sample", "Expenses:Automobile:Gasoline"),
|
||||
CELL_ALIGN_RIGHT,
|
||||
FALSE,
|
||||
FALSE);
|
||||
@ -736,7 +752,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
MEMO_CELL,
|
||||
QUICKFILL_CELL_TYPE_NAME,
|
||||
C_("sample", "Memo field sample text string"),
|
||||
C_ ("sample", "Memo field sample text string"),
|
||||
CELL_ALIGN_LEFT,
|
||||
TRUE,
|
||||
FALSE);
|
||||
@ -744,7 +760,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
DEBT_CELL,
|
||||
PRICE_CELL_TYPE_NAME,
|
||||
C_("sample", "999,999.000"),
|
||||
C_ ("sample", "999,999.000"),
|
||||
CELL_ALIGN_RIGHT,
|
||||
FALSE,
|
||||
FALSE);
|
||||
@ -752,7 +768,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
CRED_CELL,
|
||||
PRICE_CELL_TYPE_NAME,
|
||||
C_("sample", "999,999.000"),
|
||||
C_ ("sample", "999,999.000"),
|
||||
CELL_ALIGN_RIGHT,
|
||||
FALSE,
|
||||
FALSE);
|
||||
@ -760,7 +776,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
SHRS_CELL,
|
||||
PRICE_CELL_TYPE_NAME,
|
||||
C_("sample", "999,999.000"),
|
||||
C_ ("sample", "999,999.000"),
|
||||
CELL_ALIGN_RIGHT,
|
||||
FALSE,
|
||||
FALSE);
|
||||
@ -770,7 +786,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
PRIC_CELL,
|
||||
PRICE_CELL_TYPE_NAME,
|
||||
C_("sample", "999,999.000"),
|
||||
C_ ("sample", "999,999.000"),
|
||||
CELL_ALIGN_RIGHT,
|
||||
FALSE,
|
||||
FALSE);
|
||||
@ -778,7 +794,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
TDEBT_CELL,
|
||||
PRICE_CELL_TYPE_NAME,
|
||||
C_("sample", "999,999.000"),
|
||||
C_ ("sample", "999,999.000"),
|
||||
CELL_ALIGN_RIGHT,
|
||||
FALSE,
|
||||
FALSE);
|
||||
@ -786,7 +802,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
TCRED_CELL,
|
||||
PRICE_CELL_TYPE_NAME,
|
||||
C_("sample", "999,999.000"),
|
||||
C_ ("sample", "999,999.000"),
|
||||
CELL_ALIGN_RIGHT,
|
||||
FALSE,
|
||||
FALSE);
|
||||
@ -794,7 +810,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
TSHRS_CELL,
|
||||
PRICE_CELL_TYPE_NAME,
|
||||
C_("sample", "999,999.000"),
|
||||
C_ ("sample", "999,999.000"),
|
||||
CELL_ALIGN_RIGHT,
|
||||
FALSE,
|
||||
FALSE);
|
||||
@ -802,7 +818,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
TBALN_CELL,
|
||||
PRICE_CELL_TYPE_NAME,
|
||||
C_("sample", "999,999.000"),
|
||||
C_ ("sample", "999,999.000"),
|
||||
CELL_ALIGN_RIGHT,
|
||||
FALSE,
|
||||
FALSE);
|
||||
@ -810,7 +826,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
TYPE_CELL,
|
||||
RECN_CELL_TYPE_NAME,
|
||||
C_("Column header for 'Type'", "T"),
|
||||
C_ ("Column header for 'Type'", "T"),
|
||||
CELL_ALIGN_CENTER,
|
||||
FALSE,
|
||||
FALSE);
|
||||
@ -818,7 +834,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
NOTES_CELL,
|
||||
QUICKFILL_CELL_TYPE_NAME,
|
||||
C_("sample", "Notes field sample text string"),
|
||||
C_ ("sample", "Notes field sample text string"),
|
||||
CELL_ALIGN_LEFT,
|
||||
FALSE,
|
||||
TRUE);
|
||||
@ -826,7 +842,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
VNOTES_CELL,
|
||||
BASIC_CELL_TYPE_NAME,
|
||||
C_("sample", "No Particular Reason"),
|
||||
C_ ("sample", "No Particular Reason"),
|
||||
CELL_ALIGN_RIGHT,
|
||||
FALSE,
|
||||
TRUE);
|
||||
@ -834,7 +850,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
FCRED_CELL,
|
||||
FORMULA_CELL_TYPE_NAME,
|
||||
C_("sample", "(x + 0.33 * y + (x+y) )"),
|
||||
C_ ("sample", "(x + 0.33 * y + (x+y) )"),
|
||||
CELL_ALIGN_LEFT,
|
||||
FALSE,
|
||||
FALSE);
|
||||
@ -842,7 +858,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
FDEBT_CELL,
|
||||
FORMULA_CELL_TYPE_NAME,
|
||||
C_("sample", "(x + 0.33 * y + (x+y) )"),
|
||||
C_ ("sample", "(x + 0.33 * y + (x+y) )"),
|
||||
CELL_ALIGN_LEFT,
|
||||
FALSE,
|
||||
FALSE);
|
||||
@ -850,19 +866,19 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
|
||||
gnc_register_add_cell (layout,
|
||||
RBALN_CELL,
|
||||
PRICE_CELL_TYPE_NAME,
|
||||
C_("sample", "999,999.000"),
|
||||
C_ ("sample", "999,999.000"),
|
||||
CELL_ALIGN_RIGHT,
|
||||
FALSE,
|
||||
FALSE);
|
||||
|
||||
}
|
||||
|
||||
TableLayout *
|
||||
gnc_split_register_layout_new (SplitRegister *reg)
|
||||
TableLayout*
|
||||
gnc_split_register_layout_new (SplitRegister* reg)
|
||||
{
|
||||
TableLayout *layout;
|
||||
TableLayout* layout;
|
||||
|
||||
layout = gnc_table_layout_new ();
|
||||
layout = gnc_table_layout_new();
|
||||
|
||||
gnc_split_register_layout_add_cells (reg, layout);
|
||||
gnc_split_register_layout_add_cursors (reg, layout);
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -240,7 +240,7 @@ typedef struct sr_info SRInfo;
|
||||
/** @brief The type, style and table for the register. */
|
||||
struct split_register
|
||||
{
|
||||
Table * table; /**< The table itself that implements the underlying GUI. */
|
||||
Table* table; /**< The table itself that implements the underlying GUI. */
|
||||
|
||||
SplitRegisterType type;
|
||||
SplitRegisterStyle style;
|
||||
@ -254,14 +254,17 @@ struct split_register
|
||||
|
||||
gboolean is_template;
|
||||
gboolean do_auto_complete; /**< whether to use auto-completion */
|
||||
gboolean mismatched_commodities; /**< indicates the register includes transactions in
|
||||
mismatched commodities */
|
||||
|
||||
SplitList *unrecn_splits; /**< list of splits to unreconcile after transaction edit */
|
||||
SplitList*
|
||||
unrecn_splits; /**< list of splits to unreconcile after transaction edit */
|
||||
|
||||
SRInfo * sr_info; /**< private data; outsiders should not access this */
|
||||
SRInfo* sr_info; /**< private data; outsiders should not access this */
|
||||
};
|
||||
|
||||
/** Callback function type */
|
||||
typedef GtkWidget *(*SRGetParentCallback) (gpointer user_data);
|
||||
typedef GtkWidget* (*SRGetParentCallback) (gpointer user_data);
|
||||
|
||||
|
||||
/* Prototypes ******************************************************/
|
||||
@ -279,16 +282,17 @@ typedef GtkWidget *(*SRGetParentCallback) (gpointer user_data);
|
||||
*
|
||||
* @return a newly created ::SplitRegister
|
||||
*/
|
||||
SplitRegister * gnc_split_register_new (SplitRegisterType type,
|
||||
SplitRegisterStyle style,
|
||||
gboolean use_double_line,
|
||||
gboolean is_template);
|
||||
SplitRegister* gnc_split_register_new (SplitRegisterType type,
|
||||
SplitRegisterStyle style,
|
||||
gboolean use_double_line,
|
||||
gboolean is_template,
|
||||
gboolean mismatched_commodities);
|
||||
|
||||
/** Destroys a split register.
|
||||
*
|
||||
* @param reg a ::SplitRegister
|
||||
*/
|
||||
void gnc_split_register_destroy (SplitRegister *reg);
|
||||
void gnc_split_register_destroy (SplitRegister* reg);
|
||||
|
||||
/** Sets a split register's type, style or line use.
|
||||
*
|
||||
@ -301,7 +305,7 @@ void gnc_split_register_destroy (SplitRegister *reg);
|
||||
* @param use_double_line @c TRUE to show two lines for transactions,
|
||||
* @c FALSE for one
|
||||
*/
|
||||
void gnc_split_register_config (SplitRegister *reg,
|
||||
void gnc_split_register_config (SplitRegister* reg,
|
||||
SplitRegisterType type,
|
||||
SplitRegisterStyle style,
|
||||
gboolean use_double_line);
|
||||
@ -312,8 +316,8 @@ void gnc_split_register_config (SplitRegister *reg,
|
||||
*
|
||||
* @param do_auto_complete @c TRUE to use auto-completion, @c FALSE otherwise
|
||||
*/
|
||||
void gnc_split_register_set_auto_complete(SplitRegister *reg,
|
||||
gboolean do_auto_complete);
|
||||
void gnc_split_register_set_auto_complete (SplitRegister* reg,
|
||||
gboolean do_auto_complete);
|
||||
|
||||
/** Sets whether a register window is "read only".
|
||||
*
|
||||
@ -321,7 +325,7 @@ void gnc_split_register_set_auto_complete(SplitRegister *reg,
|
||||
*
|
||||
* @param read_only @c TRUE to use "read only" mode, @c FALSE otherwise
|
||||
*/
|
||||
void gnc_split_register_set_read_only (SplitRegister *reg, gboolean read_only);
|
||||
void gnc_split_register_set_read_only (SplitRegister* reg, gboolean read_only);
|
||||
|
||||
|
||||
/** Set the template account for use in a template register.
|
||||
@ -330,11 +334,11 @@ void gnc_split_register_set_read_only (SplitRegister *reg, gboolean read_only);
|
||||
*
|
||||
* @param template_account the account to use for the template
|
||||
*/
|
||||
void gnc_split_register_set_template_account (SplitRegister *reg,
|
||||
Account *template_account);
|
||||
void gnc_split_register_set_template_account (SplitRegister* reg,
|
||||
Account* template_account);
|
||||
|
||||
/** Sets the user data and callback hooks for the register. */
|
||||
void gnc_split_register_set_data (SplitRegister *reg, gpointer user_data,
|
||||
void gnc_split_register_set_data (SplitRegister* reg, gpointer user_data,
|
||||
SRGetParentCallback get_parent);
|
||||
|
||||
/** Returns the class of a register's current cursor.
|
||||
@ -343,7 +347,7 @@ void gnc_split_register_set_data (SplitRegister *reg, gpointer user_data,
|
||||
*
|
||||
* @return the ::CursorClass of the current cursor
|
||||
*/
|
||||
CursorClass gnc_split_register_get_current_cursor_class (SplitRegister *reg);
|
||||
CursorClass gnc_split_register_get_current_cursor_class (SplitRegister* reg);
|
||||
|
||||
/** Returns the class of the cursor at the given virtual cell location.
|
||||
*
|
||||
@ -354,7 +358,7 @@ CursorClass gnc_split_register_get_current_cursor_class (SplitRegister *reg);
|
||||
* @return the ::CursorClass of the cursor at @a vcell_loc
|
||||
*/
|
||||
CursorClass gnc_split_register_get_cursor_class
|
||||
(SplitRegister *reg,
|
||||
(SplitRegister* reg,
|
||||
VirtualCellLocation vcell_loc);
|
||||
|
||||
/** Gets the transaction at the current cursor location, which may be on
|
||||
@ -364,7 +368,7 @@ CursorClass gnc_split_register_get_cursor_class
|
||||
*
|
||||
* @return the ::Transaction at the cursor location, or @c NULL
|
||||
*/
|
||||
Transaction * gnc_split_register_get_current_trans (SplitRegister *reg);
|
||||
Transaction* gnc_split_register_get_current_trans (SplitRegister* reg);
|
||||
|
||||
/** Gets the anchoring split of the transaction at the current cursor location,
|
||||
* which may be on the transaction itself or on any of its splits.
|
||||
@ -376,9 +380,9 @@ Transaction * gnc_split_register_get_current_trans (SplitRegister *reg);
|
||||
*
|
||||
* @return the anchoring ::Split of the transaction
|
||||
*/
|
||||
Split *
|
||||
gnc_split_register_get_current_trans_split (SplitRegister *reg,
|
||||
VirtualCellLocation *vcell_loc);
|
||||
Split*
|
||||
gnc_split_register_get_current_trans_split (SplitRegister* reg,
|
||||
VirtualCellLocation* vcell_loc);
|
||||
|
||||
/** Returns the split at which the cursor is currently located.
|
||||
*
|
||||
@ -387,7 +391,7 @@ gnc_split_register_get_current_trans_split (SplitRegister *reg,
|
||||
* @return the ::Split at the cursor location, or the anchoring split
|
||||
* if the cursor is currently on a transaction
|
||||
*/
|
||||
Split * gnc_split_register_get_current_split (SplitRegister *reg);
|
||||
Split* gnc_split_register_get_current_split (SplitRegister* reg);
|
||||
|
||||
/** Gets the blank split for a register.
|
||||
*
|
||||
@ -396,7 +400,7 @@ Split * gnc_split_register_get_current_split (SplitRegister *reg);
|
||||
* @return the ::Split used as the blank split, or @c NULL if
|
||||
* there currently isn't one
|
||||
*/
|
||||
Split * gnc_split_register_get_blank_split (SplitRegister *reg);
|
||||
Split* gnc_split_register_get_blank_split (SplitRegister* reg);
|
||||
|
||||
/** Searches the split register for a given split.
|
||||
* The search begins from the bottom row and works backwards. The location
|
||||
@ -413,8 +417,8 @@ Split * gnc_split_register_get_blank_split (SplitRegister *reg);
|
||||
* at @a vcell_loc, @c FALSE otherwise
|
||||
*/
|
||||
gboolean
|
||||
gnc_split_register_get_split_virt_loc (SplitRegister *reg, Split *split,
|
||||
VirtualCellLocation *vcell_loc);
|
||||
gnc_split_register_get_split_virt_loc (SplitRegister* reg, Split* split,
|
||||
VirtualCellLocation* vcell_loc);
|
||||
|
||||
/** Searches the split register for the given split and determines the
|
||||
* location of either its credit (if non-zero) or debit cell.
|
||||
@ -429,58 +433,59 @@ gnc_split_register_get_split_virt_loc (SplitRegister *reg, Split *split,
|
||||
* at @a virt_loc, @c FALSE otherwise
|
||||
*/
|
||||
gboolean
|
||||
gnc_split_register_get_split_amount_virt_loc (SplitRegister *reg, Split *split,
|
||||
VirtualLocation *virt_loc);
|
||||
gnc_split_register_get_split_amount_virt_loc (SplitRegister* reg, Split* split,
|
||||
VirtualLocation* virt_loc);
|
||||
|
||||
/** Duplicates either the current transaction or the current split
|
||||
* depending on the register mode and cursor position. Returns the
|
||||
* split just created, or the 'main' split of the transaction just
|
||||
* created, or NULL if nothing happened. */
|
||||
Split * gnc_split_register_duplicate_current (SplitRegister *reg);
|
||||
Split* gnc_split_register_duplicate_current (SplitRegister* reg);
|
||||
|
||||
/** Makes a copy of the current entity, either a split or a
|
||||
* transaction, so that it can be pasted later. */
|
||||
void gnc_split_register_copy_current (SplitRegister *reg);
|
||||
void gnc_split_register_copy_current (SplitRegister* reg);
|
||||
|
||||
/** Equivalent to copying the current entity and the deleting it with
|
||||
* the appropriate delete method. */
|
||||
void gnc_split_register_cut_current (SplitRegister *reg);
|
||||
void gnc_split_register_cut_current (SplitRegister* reg);
|
||||
|
||||
/** Pastes a previous copied entity onto the current entity, but only
|
||||
* if the copied and current entity have the same type. */
|
||||
void gnc_split_register_paste_current (SplitRegister *reg);
|
||||
void gnc_split_register_paste_current (SplitRegister* reg);
|
||||
|
||||
/** Deletes the split associated with the current cursor, if both are
|
||||
* non-NULL. Deleting the blank split just clears cursor values. */
|
||||
void gnc_split_register_delete_current_split (SplitRegister *reg);
|
||||
void gnc_split_register_delete_current_split (SplitRegister* reg);
|
||||
|
||||
/** Deletes the transaction associated with the current cursor, if both
|
||||
* are non-NULL. */
|
||||
void gnc_split_register_delete_current_trans (SplitRegister *reg);
|
||||
void gnc_split_register_delete_current_trans (SplitRegister* reg);
|
||||
|
||||
/** Voids the transaction associated with the current cursor, if
|
||||
* non-NULL. */
|
||||
void gnc_split_register_void_current_trans (SplitRegister *reg,
|
||||
const char *reason);
|
||||
void gnc_split_register_void_current_trans (SplitRegister* reg,
|
||||
const char* reason);
|
||||
|
||||
/** Unvoids the transaction associated with the current cursor, if
|
||||
* non-NULL. */
|
||||
void gnc_split_register_unvoid_current_trans (SplitRegister *reg);
|
||||
void gnc_split_register_unvoid_current_trans (SplitRegister* reg);
|
||||
|
||||
/** Deletes the non-transaction splits associated with the current
|
||||
* cursor, if both are non-NULL. */
|
||||
void gnc_split_register_empty_current_trans_except_split (SplitRegister *reg, Split *split);
|
||||
void gnc_split_register_empty_current_trans (SplitRegister *reg);
|
||||
void gnc_split_register_empty_current_trans_except_split (SplitRegister* reg,
|
||||
Split* split);
|
||||
void gnc_split_register_empty_current_trans (SplitRegister* reg);
|
||||
|
||||
/** Cancels any changes made to the current cursor, reloads the cursor
|
||||
* from the engine, reloads the table from the cursor, and updates
|
||||
* the GUI. The change flags are cleared. */
|
||||
void gnc_split_register_cancel_cursor_split_changes (SplitRegister *reg);
|
||||
void gnc_split_register_cancel_cursor_split_changes (SplitRegister* reg);
|
||||
|
||||
/** Cancels any changes made to the current pending transaction,
|
||||
* reloads the table from the engine, and updates the GUI. The
|
||||
* change flags are cleared. */
|
||||
void gnc_split_register_cancel_cursor_trans_changes (SplitRegister *reg);
|
||||
void gnc_split_register_cancel_cursor_trans_changes (SplitRegister* reg);
|
||||
|
||||
/** Populates the rows of a register.
|
||||
*
|
||||
@ -499,8 +504,8 @@ void gnc_split_register_cancel_cursor_trans_changes (SplitRegister *reg);
|
||||
*
|
||||
* @param default_account an account to provide defaults for the blank split
|
||||
*/
|
||||
void gnc_split_register_load (SplitRegister *reg, GList * slist,
|
||||
Account *default_account);
|
||||
void gnc_split_register_load (SplitRegister* reg, GList* slist,
|
||||
Account* default_account);
|
||||
|
||||
/** Copy the contents of the current cursor to a split. The split and
|
||||
* transaction that are updated are the ones associated with the
|
||||
@ -509,44 +514,45 @@ void gnc_split_register_load (SplitRegister *reg, GList * slist,
|
||||
* blank transaction, and the do_commit flag is set, a refresh will
|
||||
* result in a new blank transaction. The method returns TRUE if
|
||||
* something was changed. */
|
||||
gboolean gnc_split_register_save (SplitRegister *reg, gboolean do_commit);
|
||||
gboolean gnc_split_register_save (SplitRegister* reg, gboolean do_commit);
|
||||
|
||||
/** Causes a redraw of the register window associated with reg. */
|
||||
void gnc_split_register_redraw (SplitRegister *reg);
|
||||
void gnc_split_register_redraw (SplitRegister* reg);
|
||||
|
||||
/** Returns TRUE if the register has changed cells. */
|
||||
gboolean gnc_split_register_changed (SplitRegister *reg);
|
||||
gboolean gnc_split_register_changed (SplitRegister* reg);
|
||||
|
||||
/** If TRUE, visually indicate the demarcation between splits with post
|
||||
* dates prior to the present, and after. This will only make sense if
|
||||
* the splits are ordered primarily by post date. */
|
||||
void gnc_split_register_show_present_divider (SplitRegister *reg,
|
||||
gboolean show_present);
|
||||
void gnc_split_register_show_present_divider (SplitRegister* reg,
|
||||
gboolean show_present);
|
||||
|
||||
/** Expand the current transaction if it is collapsed. */
|
||||
void gnc_split_register_expand_current_trans (SplitRegister *reg,
|
||||
gboolean expand);
|
||||
void gnc_split_register_expand_current_trans (SplitRegister* reg,
|
||||
gboolean expand);
|
||||
|
||||
/** Mark the current transaction as collapsed, and do callbacks. */
|
||||
void gnc_split_register_collapse_current_trans (SplitRegister *reg);
|
||||
void gnc_split_register_collapse_current_trans (SplitRegister* reg);
|
||||
|
||||
/** Return TRUE if current trans is expanded and style is REG_STYLE_LEDGER. */
|
||||
gboolean gnc_split_register_current_trans_expanded (SplitRegister *reg);
|
||||
gboolean gnc_split_register_current_trans_expanded (SplitRegister* reg);
|
||||
|
||||
/** Return the debit string used in the register. */
|
||||
const char * gnc_split_register_get_debit_string (SplitRegister *reg);
|
||||
const char* gnc_split_register_get_debit_string (SplitRegister* reg);
|
||||
|
||||
/** Return the credit string used in the register. */
|
||||
const char * gnc_split_register_get_credit_string (SplitRegister *reg);
|
||||
const char* gnc_split_register_get_credit_string (SplitRegister* reg);
|
||||
|
||||
/** Return TRUE if split is the blank_split. */
|
||||
gboolean gnc_split_register_is_blank_split (SplitRegister *reg, Split *split);
|
||||
gboolean gnc_split_register_is_blank_split (SplitRegister* reg, Split* split);
|
||||
|
||||
/** Change the blank_split reference from pointing to split to another
|
||||
* split of the transaction. This is used when deleting a split after an
|
||||
* autocomplete as the blank_split reference will be pointing to one of
|
||||
* the splits so it does not cancel the whole transaction */
|
||||
void gnc_split_register_change_blank_split_ref (SplitRegister *reg, Split *split);
|
||||
void gnc_split_register_change_blank_split_ref (SplitRegister* reg,
|
||||
Split* split);
|
||||
|
||||
/** Pop up the exchange-rate dialog, maybe, for the current split.
|
||||
* If force_dialog is TRUE, the forces the dialog to be called.
|
||||
@ -554,11 +560,11 @@ void gnc_split_register_change_blank_split_ref (SplitRegister *reg, Split *split
|
||||
* Return FALSE in all other cases (meaning "move on")
|
||||
*/
|
||||
gboolean
|
||||
gnc_split_register_handle_exchange (SplitRegister *reg, gboolean force_dialog);
|
||||
gnc_split_register_handle_exchange (SplitRegister* reg, gboolean force_dialog);
|
||||
|
||||
/* returns TRUE if begin_edit was aborted */
|
||||
gboolean
|
||||
gnc_split_register_begin_edit_or_warn(SRInfo *info, Transaction *trans);
|
||||
gnc_split_register_begin_edit_or_warn (SRInfo* info, Transaction* trans);
|
||||
|
||||
/** @} */
|
||||
/** @} */
|
||||
@ -566,10 +572,10 @@ gnc_split_register_begin_edit_or_warn(SRInfo *info, Transaction *trans);
|
||||
/* -------------------------------------------------------------- */
|
||||
|
||||
/** Private function -- outsiders must not use this */
|
||||
gboolean gnc_split_register_full_refresh_ok (SplitRegister *reg);
|
||||
gboolean gnc_split_register_full_refresh_ok (SplitRegister* reg);
|
||||
|
||||
/** Private function -- outsiders must not use this */
|
||||
void gnc_copy_trans_onto_trans (Transaction *from, Transaction *to,
|
||||
void gnc_copy_trans_onto_trans (Transaction* from, Transaction* to,
|
||||
gboolean use_cut_semantics,
|
||||
gboolean do_commit);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user