Merge branch 'maint'

This commit is contained in:
Mike Alexander 2015-10-21 15:18:34 -04:00
commit 49cd682665
62 changed files with 1051 additions and 825 deletions

1
.gitignore vendored
View File

@ -255,3 +255,4 @@ DerivedData/
*.mode2v3
*.perspectivev3
xcuserdata/
messages.mo

View File

@ -192,7 +192,7 @@
<gnc:account version="2.0.0">
<act:name>VAT</act:name>
<act:id type="new">3352145930e40b21fee20532ad07501b</act:id>
<act:type>EXPENSE</act:type>
<act:type>LIABILITY</act:type>
<act:commodity>
<cmdty:space>ISO4217</cmdty:space>
<cmdty:id>GBP</cmdty:id>
@ -214,7 +214,7 @@
<gnc:account version="2.0.0">
<act:name>Input</act:name>
<act:id type="new">d3fda498135dbfca02febf0fbe379069</act:id>
<act:type>EXPENSE</act:type>
<act:type>ASSSET</act:type>
<act:commodity>
<cmdty:space>ISO4217</cmdty:space>
<cmdty:id>GBP</cmdty:id>
@ -226,7 +226,7 @@
<gnc:account version="2.0.0">
<act:name>Output</act:name>
<act:id type="new">a46d9e9624070fcd2427973a4c725ed6</act:id>
<act:type>EXPENSE</act:type>
<act:type>LIABILITY</act:type>
<act:commodity>
<cmdty:space>ISO4217</cmdty:space>
<cmdty:id>GBP</cmdty:id>
@ -244,7 +244,7 @@
<gnc:account version="2.0.0">
<act:name>EC</act:name>
<act:id type="new">37d726ec68d451d098496b7f5513f6f8</act:id>
<act:type>EXPENSE</act:type>
<act:type>LIABILITY</act:type>
<act:commodity>
<cmdty:space>ISO4217</cmdty:space>
<cmdty:id>GBP</cmdty:id>
@ -256,7 +256,7 @@
<gnc:account version="2.0.0">
<act:name>Sales</act:name>
<act:id type="new">61bdfc571cdbf2259d99078fe75527a4</act:id>
<act:type>EXPENSE</act:type>
<act:type>LIABILITY</act:type>
<act:commodity>
<cmdty:space>ISO4217</cmdty:space>
<cmdty:id>GBP</cmdty:id>

View File

@ -5,26 +5,6 @@
* gfec stands for 'guile fancy error catching'.
* This code is in the public domain.
*/
/********************************************************************\
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, contact: *
* *
* Free Software Foundation Voice: +1-617-542-5942 *
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
* Boston, MA 02110-1301, USA gnu@gnu.org *
* *
\********************************************************************/
#include <assert.h>
#include <string.h>
@ -261,4 +241,3 @@ gfec_try_load(gchar *fn)
}
return FALSE;
}

View File

@ -5,26 +5,6 @@
* gfec stands for 'guile fancy error catching'.
* This code is in the public domain.
*/
/********************************************************************\
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, contact: *
* *
* Free Software Foundation Voice: +1-617-542-5942 *
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
* Boston, MA 02110-1301, USA gnu@gnu.org *
* *
\********************************************************************/
#ifndef GFEC_H
#define GFEC_H

View File

@ -203,7 +203,7 @@ write_price( GNCPrice* p, gpointer data )
g_return_val_if_fail( p != NULL, FALSE );
g_return_val_if_fail( data != NULL, FALSE );
if ( s->is_ok && gnc_price_get_source(p) == PRICE_SOURCE_INVOICE)
if ( s->is_ok && gnc_price_get_source(p) != PRICE_SOURCE_INVOICE)
{
s->is_ok = save_price( s->be, QOF_INSTANCE(p) );
}

View File

@ -28,7 +28,13 @@
#include "gncEntry.h"
#include "gncOrder.h"
#include "table-allgui.h"
/** @ingroup Register
* @addtogroup BusinessRegister Business Register
* @brief A specialized register for Accounts Payable and Accounts Receivable.
* @{
*/
/** @file gncEntryLedger.h
*/
typedef enum
{
GNC_ENTRY_ORDER_NONE = -1, //Force clang to use int representation of enum.
@ -72,31 +78,31 @@ typedef enum
typedef struct GncEntryLedger_s GncEntryLedger;
/** Prototypes ***************************************************/
/* Prototypes ***************************************************/
/* Create and return a new GncEntry Ledger */
/** Create and return a new GncEntry Ledger */
GncEntryLedger * gnc_entry_ledger_new (QofBook *book, GncEntryLedgerType type);
/* Set the default order for this ledger */
/** Set the default order for this ledger */
void gnc_entry_ledger_set_default_order (GncEntryLedger *ledger,
GncOrder *order);
/* Set the default invoice for this ledger */
/** Set the default invoice for this ledger */
void gnc_entry_ledger_set_default_invoice (GncEntryLedger *ledger,
GncInvoice *invoice);
/* Destroy the GncEntry Ledger */
/** Destroy the GncEntry Ledger */
void gnc_entry_ledger_destroy (GncEntryLedger *ledger);
/* Returns the Entry where the cursor is currently located. */
/** Returns the Entry where the cursor is currently located. */
GncEntry * gnc_entry_ledger_get_current_entry (GncEntryLedger *ledger);
/* Copy GncEntry information from the list to the rows of the Ledger. */
/** Copy GncEntry information from the list to the rows of the Ledger. */
void gnc_entry_ledger_load (GncEntryLedger *ledger, GList *entry_list);
void gnc_entry_ledger_display_refresh (GncEntryLedger *ledger);
/* Get the Table */
/** Get the Table */
Table * gnc_entry_ledger_get_table (GncEntryLedger *ledger);
void gnc_entry_ledger_set_parent (GncEntryLedger *ledger, GtkWidget *parent);
@ -107,10 +113,10 @@ gboolean gnc_entry_ledger_changed (GncEntryLedger *ledger);
void gnc_entry_ledger_cancel_cursor_changes (GncEntryLedger *ledger);
/* This will act just like hitting 'return' to record an entry */
/** This will act just like hitting 'return' to record an entry */
gboolean gnc_entry_ledger_commit_entry (GncEntryLedger *ledger);
/* This will ask the user if they really want to make a change */
/** This will ask the user if they really want to make a change */
gboolean gnc_entry_ledger_check_close (GtkWidget *parent, GncEntryLedger *ledger);
void gnc_entry_ledger_reset_query (GncEntryLedger *ledger);
@ -147,5 +153,5 @@ void gnc_entry_ledger_move_current_entry_updown (GncEntryLedger *ledger,
QofQuery * gnc_entry_ledger_get_query (GncEntryLedger *ledger);
void gnc_entry_ledger_set_prefs_group (GncEntryLedger *ledger, const gchar *string);
/** @} */
#endif /* GNC_ENTRY_LEDGER_H */

View File

@ -25,7 +25,12 @@
#define GNC_ENTRY_LEDGER_CONTROL_H
#include "gncEntryLedger.h"
/** @ingroup Register
* @addtogroup BusinessRegister
* @{
*/
/** @file gncEntryLedgerControl.h
*/
TableControl * gnc_entry_ledger_control_new (void);
/** @} */
#endif /* GNC_ENTRY_LEDGER_CONTROL_H */

View File

@ -25,7 +25,12 @@
#define GNC_ENTRY_LEDGER_LAYOUT_H
#include "gncEntryLedger.h"
/** @ingroup Register
* @addtogroup BusinessRegister
* @{
*/
/** @file gncEntryLedgerLayout.h
*/
TableLayout * gnc_entry_ledger_layout_new (GncEntryLedger *ledger);
/** @} */
#endif /* GNC_ENTRY_LEDGER_LAYOUT_H */

View File

@ -25,7 +25,12 @@
#define GNC_ENTRY_LEDGER_MODEL_H
#include "gncEntryLedger.h"
/** @ingroup Register
* @addtogroup BusinessRegister
* @{
*/
/** @file gncEntryLedgerModel.h
*/
TableModel * gnc_entry_ledger_model_new (GncEntryLedgerType type);
/** @} */
#endif /* GNC_ENTRY_LEDGER_MODEL_H */

View File

@ -27,20 +27,25 @@
#include "qof.h"
#include "table-allgui.h"
#include "gncEntryLedger.h"
/** @ingroup Register
* @addtogroup BusinessRegister
* @{
*/
/** @file gncEntryLedgerP.h
*/
struct GncEntryLedger_s
{
GncGUID blank_entry_guid;
gboolean blank_entry_edited;
gboolean traverse_to_new;
gboolean loading; /* To keep from recursing from events */
gboolean full_refresh; /* Is a full refresh ok? */
gint component_id; /* To register for events */
gboolean loading; /** To keep from recursing from events */
gboolean full_refresh; /** Is a full refresh ok? */
gint component_id; /** To register for events */
GDate last_date_entered;
GncEntry * hint_entry; /* A Hint for where to display */
GncEntry * hint_entry; /** A Hint for where to display */
GtkWidget * parent;
QofBook * book;
@ -51,8 +56,8 @@ struct GncEntryLedger_s
GncEntryLedgerType type;
gboolean is_cust_doc; /* is this document customer or vendor related ? */
gboolean is_credit_note; /* is this an invoice (or a bill)? */
gboolean is_cust_doc; /** is this document customer or vendor related ? */
gboolean is_credit_note; /** is this an invoice (or a bill)? */
const gchar * prefs_group;
};
@ -88,5 +93,5 @@ void gnc_entry_ledger_display_fini (GncEntryLedger *ledger);
void gnc_entry_ledger_compute_value (GncEntryLedger *ledger,
gnc_numeric *value,
gnc_numeric *tax_value);
/** @} */
#endif /* GNC_ENTRY_LEDGERP_H */

View File

@ -1846,3 +1846,10 @@ GENERATE_LEGEND = YES
# the various graphs.
DOT_CLEANUP = YES
# GObject code frequently hides the definition of structs in private headers and
# typedefs them in public declarations. TYPEDEF_HIDES_STRUCT prevents leaking
# the private names into the documentation.
TYPEDEF_HIDES_STRUCT = YES

View File

@ -91,7 +91,7 @@ TransScrubOrphansFast (Transaction *trans, Account *root)
gnc_commodity_get_mnemonic (trans->common_currency),
NULL);
orph = xaccScrubUtilityGetOrMakeAccount (root, trans->common_currency,
accname, ACCT_TYPE_BANK, FALSE);
accname, ACCT_TYPE_BANK, FALSE);
g_free (accname);
if (!orph) continue;
@ -233,7 +233,7 @@ xaccSplitScrub (Split *split)
/* If the account doesn't have a commodity,
* we should attempt to fix that first.
*/
*/
acc_commodity = xaccAccountGetCommodity(account);
if (!acc_commodity)
{
@ -322,7 +322,7 @@ get_balance_split (Transaction *trans, Account *root, Account *account,
gchar *accname;
if (!account ||
!gnc_commodity_equiv (commodity, xaccAccountGetCommodity(account)))
!gnc_commodity_equiv (commodity, xaccAccountGetCommodity(account)))
{
if (!root)
{
@ -337,7 +337,7 @@ get_balance_split (Transaction *trans, Account *root, Account *account,
accname = g_strconcat (_("Imbalance"), "-",
gnc_commodity_get_mnemonic (commodity), NULL);
account = xaccScrubUtilityGetOrMakeAccount (root, commodity,
accname, ACCT_TYPE_BANK, FALSE);
accname, ACCT_TYPE_BANK, FALSE);
g_free (accname);
if (!account)
{
@ -391,16 +391,16 @@ get_trading_split (Transaction *trans, Account *root,
account has no currency. Instead look for the Income placeholder account
and use its currency. */
default_currency = xaccAccountGetCommodity(gnc_account_lookup_by_name(root,
_("Income")));
_("Income")));
if (! default_currency)
{
default_currency = commodity;
}
trading_account = xaccScrubUtilityGetOrMakeAccount (root,
default_currency,
_("Trading"),
ACCT_TYPE_TRADING, TRUE);
default_currency,
_("Trading"),
ACCT_TYPE_TRADING, TRUE);
if (!trading_account)
{
PERR ("Can't get trading account");
@ -408,9 +408,9 @@ get_trading_split (Transaction *trans, Account *root,
}
ns_account = xaccScrubUtilityGetOrMakeAccount (trading_account,
default_currency,
gnc_commodity_get_namespace(commodity),
ACCT_TYPE_TRADING, TRUE);
default_currency,
gnc_commodity_get_namespace(commodity),
ACCT_TYPE_TRADING, TRUE);
if (!ns_account)
{
PERR ("Can't get namespace account");
@ -418,8 +418,8 @@ get_trading_split (Transaction *trans, Account *root,
}
account = xaccScrubUtilityGetOrMakeAccount (ns_account, commodity,
gnc_commodity_get_mnemonic(commodity),
ACCT_TYPE_TRADING, FALSE);
gnc_commodity_get_mnemonic(commodity),
ACCT_TYPE_TRADING, FALSE);
if (!account)
{
PERR ("Can't get commodity account");
@ -471,7 +471,7 @@ find_trading_split (Transaction *trans, Account *root,
}
ns_account = gnc_account_lookup_by_name (trading_account,
gnc_commodity_get_namespace(commodity));
gnc_commodity_get_namespace(commodity));
if (!ns_account)
{
return NULL;
@ -510,8 +510,8 @@ add_balance_split (Transaction *trans, gnc_numeric imbalance,
old_value = xaccSplitGetValue (balance_split);
/* Note: We have to round for the commodity's fraction, NOT any
* already existing denominator (bug #104343), because either one
* of the denominators might already be reduced. */
* already existing denominator (bug #104343), because either one
* of the denominators might already be reduced. */
new_value = gnc_numeric_sub (old_value, imbalance,
gnc_commodity_get_fraction(currency),
GNC_HOW_RND_ROUND_HALF_UP);
@ -528,11 +528,255 @@ add_balance_split (Transaction *trans, gnc_numeric imbalance,
xaccTransCommitEdit (trans);
}
/* Balance a transaction without trading accounts. */
static void
gnc_transaction_balance_no_trading (Transaction *trans, Account *root,
Account *account)
{
gnc_numeric imbalance = xaccTransGetImbalanceValue (trans);
/* Make the value sum to zero */
if (! gnc_numeric_zero_p (imbalance))
{
PINFO ("Value unbalanced transaction");
add_balance_split (trans, imbalance, root, account);
}
}
/** If there are existing trading splits, adjust the price or exchange
rate in each of them to agree with the non-trading splits for the
same commodity. If there are multiple non-trading splits for the
same commodity in the transaction this will use the exchange rate in
the last such split. This shouldn't happen, and if it does then there's
not much we can do about it anyway.
While we're at it, compute the value imbalance ignoring existing
trading splits. */
static gnc_numeric
gnc_transaction_adjust_trading_splits (Transaction* trans, Account *root)
{
GList* splits;
gnc_numeric imbalance = gnc_numeric_zero();
for (splits = trans->splits; splits; splits = splits->next)
{
Split *split = splits->data;
Split *balance_split = NULL;
gnc_numeric value, amount;
gnc_commodity *commodity, *txn_curr = xaccTransGetCurrency (trans);
if (! xaccTransStillHasSplit (trans, split)) continue;
commodity = xaccAccountGetCommodity (xaccSplitGetAccount(split));
if (!commodity)
{
PERR("Split has no commodity");
continue;
}
balance_split = find_trading_split (trans, root, commodity);
if (balance_split != split)
/* this is not a trading split */
imbalance = gnc_numeric_add(imbalance, xaccSplitGetValue (split),
GNC_DENOM_AUTO, GNC_HOW_DENOM_EXACT);
/* Ignore splits where value or amount is zero */
value = xaccSplitGetValue (split);
amount = xaccSplitGetAmount (split);
if (gnc_numeric_zero_p(amount) || gnc_numeric_zero_p(value))
continue;
if (balance_split && balance_split != split)
{
gnc_numeric convrate = gnc_numeric_div (amount, value,
GNC_DENOM_AUTO, GNC_HOW_DENOM_REDUCE);
gnc_numeric old_value, new_value;
old_value = xaccSplitGetValue(balance_split);
new_value = gnc_numeric_div (xaccSplitGetAmount(balance_split),
convrate,
gnc_commodity_get_fraction(txn_curr),
GNC_HOW_RND_ROUND_HALF_UP);
if (! gnc_numeric_equal (old_value, new_value))
{
xaccTransBeginEdit (trans);
xaccSplitSetValue (balance_split, new_value);
xaccSplitScrub (balance_split);
xaccTransCommitEdit (trans);
}
}
}
return imbalance;
}
static gnc_numeric
gnc_transaction_get_commodity_imbalance (Transaction *trans,
gnc_commodity *commodity)
{
/* Find the value imbalance in this commodity */
gnc_numeric val_imbalance = gnc_numeric_zero();
GList *splits = NULL;
for (splits = trans->splits; splits; splits = splits->next)
{
Split *split = splits->data;
gnc_commodity *split_commodity =
xaccAccountGetCommodity(xaccSplitGetAccount(split));
if (xaccTransStillHasSplit (trans, split) &&
gnc_commodity_equal (commodity, split_commodity))
val_imbalance = gnc_numeric_add (val_imbalance,
xaccSplitGetValue (split),
GNC_DENOM_AUTO,
GNC_HOW_DENOM_EXACT);
}
return val_imbalance;
}
static void
gnc_transaction_balance_trading (Transaction *trans, Account *root)
{
MonetaryList *imbal_list;
MonetaryList *imbalance_commod;
Split *balance_split = NULL;
/* If the transaction is balanced, nothing more to do */
imbal_list = xaccTransGetImbalance (trans);
if (!imbal_list)
{
LEAVE("transaction is balanced");
return;
}
PINFO ("Currency unbalanced transaction");
for (imbalance_commod = imbal_list; imbalance_commod;
imbalance_commod = imbalance_commod->next)
{
gnc_monetary *imbal_mon = imbalance_commod->data;
gnc_commodity *commodity;
gnc_numeric old_amount, new_amount;
gnc_numeric old_value, new_value, val_imbalance;
Account *account = NULL;
const gnc_commodity *txn_curr = xaccTransGetCurrency (trans);
commodity = gnc_monetary_commodity (*imbal_mon);
balance_split = get_trading_split(trans, root, commodity);
if (!balance_split)
{
/* Error already logged */
gnc_monetary_list_free(imbal_list);
LEAVE("");
return;
}
account = xaccSplitGetAccount(balance_split);
if (! gnc_commodity_equal (txn_curr, commodity))
{
gnc_transaction_get_commodity_imbalance (trans, commodity);
}
xaccTransBeginEdit (trans);
old_amount = xaccSplitGetAmount (balance_split);
new_amount = gnc_numeric_sub (old_amount, gnc_monetary_value(*imbal_mon),
gnc_commodity_get_fraction(commodity),
GNC_HOW_RND_ROUND_HALF_UP);
xaccSplitSetAmount (balance_split, new_amount);
if (gnc_commodity_equal (txn_curr, commodity))
{
/* Imbalance commodity is the transaction currency, value in the
split must be the same as the amount */
xaccSplitSetValue (balance_split, new_amount);
}
else
{
old_value = xaccSplitGetValue (balance_split);
new_value = gnc_numeric_sub (old_value, val_imbalance,
gnc_commodity_get_fraction(txn_curr),
GNC_HOW_RND_ROUND_HALF_UP);
xaccSplitSetValue (balance_split, new_value);
}
xaccSplitScrub (balance_split);
xaccTransCommitEdit (trans);
}
gnc_monetary_list_free(imbal_list);
}
/** Balance the transaction by adding more trading splits. This shouldn't
* ordinarily be necessary.
* @param trans the transaction to balance
* @param root the root account
*/
static void
gnc_transaction_balance_trading_more_splits (Transaction *trans, Account *root)
{
/* Copy the split list so we don't see the splits we're adding */
GList *splits_dup = g_list_copy(trans->splits), *splits = NULL;
const gnc_commodity *txn_curr = xaccTransGetCurrency (trans);
for (splits = splits_dup; splits; splits = splits->next)
{
Split *split = splits->data;
if (! xaccTransStillHasSplit(trans, split)) continue;
if (!gnc_numeric_zero_p(xaccSplitGetValue(split)) &&
gnc_numeric_zero_p(xaccSplitGetAmount(split)))
{
gnc_commodity *commodity;
gnc_numeric old_value, new_value;
Split *balance_split;
Account *account = NULL;
commodity = xaccAccountGetCommodity(xaccSplitGetAccount(split));
if (!commodity)
{
PERR("Split has no commodity");
continue;
}
balance_split = get_trading_split(trans, root, commodity);
if (!balance_split)
{
/* Error already logged */
LEAVE("");
return;
}
account = xaccSplitGetAccount(balance_split);
xaccTransBeginEdit (trans);
old_value = xaccSplitGetValue (balance_split);
new_value = gnc_numeric_sub (old_value, xaccSplitGetValue(split),
gnc_commodity_get_fraction(txn_curr),
GNC_HOW_RND_ROUND_HALF_UP);
xaccSplitSetValue (balance_split, new_value);
/* Don't change the balance split's amount since the amount
is zero in the split we're working on */
xaccSplitScrub (balance_split);
xaccTransCommitEdit (trans);
}
}
g_list_free(splits_dup);
}
/** Correct transaction imbalances.
* @param trans The Transaction
* @param root The (hidden) root account, for the book default currency.
* @param account The account whose currency in which to balance.
*/
void
xaccTransScrubImbalance (Transaction *trans, Account *root,
Account *account)
{
const gnc_commodity *currency;
gnc_numeric imbalance;
if (!trans) return;
@ -548,233 +792,38 @@ xaccTransScrubImbalance (Transaction *trans, Account *root,
return;
}
currency = xaccTransGetCurrency (trans);
if (! xaccTransUseTradingAccounts (trans))
{
gnc_numeric imbalance;
/* Make the value sum to zero */
imbalance = xaccTransGetImbalanceValue (trans);
if (! gnc_numeric_zero_p (imbalance))
{
PINFO ("Value unbalanced transaction");
add_balance_split (trans, imbalance, root, account);
}
gnc_transaction_balance_no_trading (trans, root, account);
LEAVE ("transaction balanced, no trading accounts");
return;
}
else
imbalance = gnc_transaction_adjust_trading_splits (trans, root);
/* Balance the value, ignoring existing trading splits */
if (! gnc_numeric_zero_p (imbalance))
{
MonetaryList *imbal_list;
MonetaryList *imbalance_commod;
GList *splits;
gnc_numeric imbalance;
Split *balance_split = NULL;
PINFO ("Value unbalanced transaction");
/* If there are existing trading splits, adjust the price or exchange
rate in each of them to agree with the non-trading splits for the
same commodity. If there are multiple non-trading splits for the
same commodity in the transaction this will use the exchange rate in
the last such split. This shouldn't happen, and if it does then there's
not much we can do about it anyway.
While we're at it, compute the value imbalance ignoring existing
trading splits. */
imbalance = gnc_numeric_zero();
for (splits = trans->splits; splits; splits = splits->next)
{
Split *split = splits->data;
gnc_numeric value, amount;
gnc_commodity *commodity;
if (! xaccTransStillHasSplit (trans, split)) continue;
commodity = xaccAccountGetCommodity (xaccSplitGetAccount(split));
if (!commodity)
{
PERR("Split has no commodity");
continue;
}
balance_split = find_trading_split (trans, root, commodity);
if (balance_split != split)
/* this is not a trading split */
imbalance = gnc_numeric_add(imbalance, xaccSplitGetValue (split),
GNC_DENOM_AUTO, GNC_HOW_DENOM_EXACT);
/* Ignore splits where value or amount is zero */
value = xaccSplitGetValue (split);
amount = xaccSplitGetAmount (split);
if (gnc_numeric_zero_p(amount) || gnc_numeric_zero_p(value))
continue;
if (balance_split && balance_split != split)
{
gnc_numeric convrate = gnc_numeric_div (amount, value,
GNC_DENOM_AUTO, GNC_HOW_DENOM_REDUCE);
gnc_numeric old_value, new_value;
old_value = xaccSplitGetValue(balance_split);
new_value = gnc_numeric_div (xaccSplitGetAmount(balance_split),
convrate,
gnc_commodity_get_fraction(currency),
GNC_HOW_RND_ROUND_HALF_UP);
if (! gnc_numeric_equal (old_value, new_value))
{
xaccTransBeginEdit (trans);
xaccSplitSetValue (balance_split, new_value);
xaccSplitScrub (balance_split);
xaccTransCommitEdit (trans);
}
}
}
/* Balance the value, ignoring existing trading splits */
if (! gnc_numeric_zero_p (imbalance))
{
PINFO ("Value unbalanced transaction");
add_balance_split (trans, imbalance, root, account);
}
/* If the transaction is balanced, nothing more to do */
imbal_list = xaccTransGetImbalance (trans);
if (!imbal_list)
{
LEAVE("transaction is balanced");
return;
}
PINFO ("Currency unbalanced transaction");
for (imbalance_commod = imbal_list; imbalance_commod;
imbalance_commod = imbalance_commod->next)
{
gnc_monetary *imbal_mon = imbalance_commod->data;
gnc_commodity *commodity;
gnc_numeric old_amount, new_amount;
gnc_numeric old_value, new_value, val_imbalance;
GList *splits;
commodity = gnc_monetary_commodity (*imbal_mon);
balance_split = get_trading_split(trans, root, commodity);
if (!balance_split)
{
/* Error already logged */
gnc_monetary_list_free(imbal_list);
LEAVE("");
return;
}
account = xaccSplitGetAccount(balance_split);
if (! gnc_commodity_equal (currency, commodity))
{
/* Find the value imbalance in this commodity */
val_imbalance = gnc_numeric_zero();
for (splits = trans->splits; splits; splits = splits->next)
{
Split *split = splits->data;
if (xaccTransStillHasSplit (trans, split) &&
gnc_commodity_equal (commodity,
xaccAccountGetCommodity(xaccSplitGetAccount(split))))
val_imbalance = gnc_numeric_add (val_imbalance, xaccSplitGetValue (split),
GNC_DENOM_AUTO, GNC_HOW_DENOM_EXACT);
}
}
xaccTransBeginEdit (trans);
old_amount = xaccSplitGetAmount (balance_split);
new_amount = gnc_numeric_sub (old_amount, gnc_monetary_value(*imbal_mon),
gnc_commodity_get_fraction(commodity),
GNC_HOW_RND_ROUND_HALF_UP);
xaccSplitSetAmount (balance_split, new_amount);
if (gnc_commodity_equal (currency, commodity))
{
/* Imbalance commodity is the transaction currency, value in the
split must be the same as the amount */
xaccSplitSetValue (balance_split, new_amount);
}
else
{
old_value = xaccSplitGetValue (balance_split);
new_value = gnc_numeric_sub (old_value, val_imbalance,
gnc_commodity_get_fraction(currency),
GNC_HOW_RND_ROUND_HALF_UP);
xaccSplitSetValue (balance_split, new_value);
}
xaccSplitScrub (balance_split);
xaccTransCommitEdit (trans);
}
gnc_monetary_list_free(imbal_list);
if (!gnc_numeric_zero_p(xaccTransGetImbalanceValue(trans)))
{
/* This is probably because there are splits with zero amount
and non-zero value. These are usually realized gain/loss
splits. Add a reversing split for each of them to balance
the value. */
/* Copy the split list so we don't see the splits we're adding */
GList *splits_dup = g_list_copy(trans->splits);
for (splits = splits_dup; splits; splits = splits->next)
{
Split *split = splits->data;
if (! xaccTransStillHasSplit(trans, split)) continue;
if (!gnc_numeric_zero_p(xaccSplitGetValue(split)) &&
gnc_numeric_zero_p(xaccSplitGetAmount(split)))
{
gnc_commodity *commodity;
gnc_numeric old_value, new_value;
commodity = xaccAccountGetCommodity(xaccSplitGetAccount(split));
if (!commodity)
{
PERR("Split has no commodity");
continue;
}
balance_split = get_trading_split(trans, root, commodity);
if (!balance_split)
{
/* Error already logged */
gnc_monetary_list_free(imbal_list);
LEAVE("");
return;
}
account = xaccSplitGetAccount(balance_split);
xaccTransBeginEdit (trans);
old_value = xaccSplitGetValue (balance_split);
new_value = gnc_numeric_sub (old_value, xaccSplitGetValue(split),
gnc_commodity_get_fraction(currency),
GNC_HOW_RND_ROUND_HALF_UP);
xaccSplitSetValue (balance_split, new_value);
/* Don't change the balance split's amount since the amount
is zero in the split we're working on */
xaccSplitScrub (balance_split);
xaccTransCommitEdit (trans);
}
}
g_list_free(splits_dup);
if (!gnc_numeric_zero_p(xaccTransGetImbalanceValue(trans)))
PERR("Balancing currencies unbalanced value");
}
add_balance_split (trans, imbalance, root, account);
}
LEAVE ("()");
gnc_transaction_balance_trading (trans, root);
if (gnc_numeric_zero_p(xaccTransGetImbalanceValue(trans)))
{
LEAVE ("()");
return;
}
/* If the transaction is still not balanced, it's probably because there
are splits with zero amount and non-zero value. These are usually
realized gain/loss splits. Add a reversing split for each of them to
balance the value. */
gnc_transaction_balance_trading_more_splits (trans, root);
if (!gnc_numeric_zero_p(xaccTransGetImbalanceValue(trans)))
PERR("Balancing currencies unbalanced value");
}
/* ================================================================ */
@ -880,7 +929,7 @@ xaccTransFindOldCommonCurrency (Transaction *trans, QofBook *book)
if (retval && !gnc_commodity_is_currency(retval))
retval = NULL;
return retval;
}
@ -900,7 +949,7 @@ commodity_equal (gconstpointer a, gconstpointer b)
CommodityCount *cc = (CommodityCount*)a;
gnc_commodity *com = (gnc_commodity*)b;
if ( cc == NULL || cc->commodity == NULL ||
!GNC_IS_COMMODITY( cc->commodity ) ) return -1;
!GNC_IS_COMMODITY( cc->commodity ) ) return -1;
if ( com == NULL || !GNC_IS_COMMODITY( com ) ) return 1;
if ( gnc_commodity_equal(cc->commodity, com) )
return 0;
@ -912,15 +961,15 @@ commodity_compare( gconstpointer a, gconstpointer b)
{
CommodityCount *ca = (CommodityCount*)a, *cb = (CommodityCount*)b;
if (ca == NULL || ca->commodity == NULL ||
!GNC_IS_COMMODITY( ca->commodity ) )
!GNC_IS_COMMODITY( ca->commodity ) )
{
if (cb == NULL || cb->commodity == NULL ||
!GNC_IS_COMMODITY( cb->commodity ) )
!GNC_IS_COMMODITY( cb->commodity ) )
return 0;
return -1;
}
if (cb == NULL || cb->commodity == NULL ||
!GNC_IS_COMMODITY( cb->commodity ) )
!GNC_IS_COMMODITY( cb->commodity ) )
return 1;
if (ca->count == cb->count)
return 0;
@ -949,14 +998,14 @@ xaccTransFindCommonCurrency (Transaction *trans, QofBook *book)
g_return_val_if_fail (book, NULL);
/* Find the most commonly used currency among the splits. If a given split
is in a non-currency commodity, then look for an ancestor account in a
is in a non-currency commodity, then look for an ancestor account in a
currency, but prefer currencies used directly in splits. Ignore trading
account splits in this whole process, they don't add any value to this algorithm. */
for (node = trans->splits; node; node = node->next)
{
Split *s = node->data;
unsigned int curr_weight;
if (s == NULL || s->acc == NULL) continue;
if (xaccAccountGetType(s->acc) == ACCT_TYPE_TRADING) continue;
com_scratch = xaccAccountGetCommodity(s->acc);
@ -1102,14 +1151,14 @@ xaccTransScrubCurrency (Transaction *trans)
xaccTransCommitEdit (trans);
}
/*else
{
{
PINFO ("Ok: Split '%s' Amount %s %s, value %s %s",
xaccSplitGetMemo (sp),
gnc_num_dbg_to_string (amount),
gnc_commodity_get_mnemonic (currency),
gnc_num_dbg_to_string (value),
gnc_commodity_get_mnemonic (acc_currency));
}*/
}*/
}
}

View File

@ -1022,6 +1022,7 @@ gnc_option_account_select_all_cb(GtkWidget *widget, gpointer data)
GtkTreeSelection *selection;
tree_view = GNC_TREE_VIEW_ACCOUNT(gnc_option_get_gtk_widget (option));
gtk_tree_view_expand_all(GTK_TREE_VIEW(tree_view));
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree_view));
gtk_tree_selection_select_all(selection);
gnc_option_changed_widget_cb(widget, option);
@ -1045,14 +1046,15 @@ gnc_option_account_select_children_cb(GtkWidget *widget, gpointer data)
{
GNCOption *option = data;
GncTreeViewAccount *tree_view;
Account *account;
GList *acct_list = NULL, *acct_iter = NULL;
tree_view = GNC_TREE_VIEW_ACCOUNT(gnc_option_get_gtk_widget (option));
account = gnc_tree_view_account_get_cursor_account(tree_view);
if (!account)
return;
acct_list = gnc_tree_view_account_get_selected_accounts (tree_view);
gnc_tree_view_account_select_subaccounts(tree_view, account);
for (acct_iter = acct_list; acct_iter; acct_iter = acct_iter->next)
gnc_tree_view_account_select_subaccounts (tree_view, acct_iter->data);
g_list_free (acct_list);
}
static GtkWidget *

View File

@ -31,6 +31,12 @@
#include "gnc-tree-view-split-reg.h"
G_BEGIN_DECLS
/** @ingroup Register
* @addtogroup Register2
* @{
*/
/** @file gnc-tree-control-split-reg.h
*/
/*****************************************************************************/
@ -120,7 +126,7 @@ void gnc_tree_control_split_reg_paste_trans (GncTreeViewSplitReg *view);
void gnc_tree_control_auto_complete (GncTreeViewSplitReg *view, Transaction *trans, const gchar *new_text);
/*****************************************************************************/
/** @} */
G_END_DECLS
#endif /* __GNC_TREE_CONTROL_SPLIT_REG_H */

View File

@ -34,7 +34,12 @@
G_BEGIN_DECLS
/** @ingroup Register
* @addtogroup Register2
* @{
*/
/** @file gnc-tree-model-split-reg.h
*/
/* type macros */
#define GNC_TYPE_TREE_MODEL_SPLIT_REG (gnc_tree_model_split_reg_get_type ())
#define GNC_TREE_MODEL_SPLIT_REG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_TREE_MODEL_SPLIT_REG, GncTreeModelSplitReg))
@ -128,7 +133,7 @@ typedef enum
typedef struct GncTreeModelSplitRegPrivate GncTreeModelSplitRegPrivate;
/** The instance data structure for an account tree model. */
typedef struct
typedef struct
{
GncTreeModel gnc_tree_model; /**< The parent object data. */
GncTreeModelSplitRegPrivate *priv;
@ -145,8 +150,8 @@ typedef struct
GtkSortType sort_direction; /**< This is the direction of sort */
gboolean use_accounting_labels; /**< whether to use accounting Labels */
gboolean separator_changed; /**< whether the separator has changed */
gboolean alt_colors_by_txn; /**< whether to use alternative colors by transaction */
gboolean separator_changed; /**< whether the separator has changed */
gboolean alt_colors_by_txn; /**< whether to use alternative colors by transaction */
gboolean use_theme_colors; /**< whether to use theme colors */
gboolean read_only; /**< register is read only */
@ -325,7 +330,7 @@ Split * gnc_tree_model_split_reg_trans_get_split_equal_to_ancestor (const Transa
gint gnc_tree_model_split_reg_sort_iter_compare_func (GtkTreeModel *tm, GtkTreeIter *a, GtkTreeIter *b, gpointer user_data);
/*****************************************************************************/
/** @} */
G_END_DECLS
#endif /* __GNC_TREE_MODEL_SPLIT_REG_H */

View File

@ -31,7 +31,12 @@
#include "gnc-tree-view-split-reg.h"
G_BEGIN_DECLS
/** @ingroup Register
* @addtogroup Register2
* @{
*/
/** @file gnc-tree-util-split-reg.h
*/
/*****************************************************************************/
@ -83,7 +88,7 @@ gnc_numeric gnc_tree_util_get_rate_for (GncTreeViewSplitReg *view, Transaction *
Split *split, gboolean is_blank);
/*****************************************************************************/
/** @} */
G_END_DECLS
#endif /* __GNC_TREE_UTIL_SPLIT_REG_H */

View File

@ -35,7 +35,12 @@
#include "gnc-ui-util.h"
G_BEGIN_DECLS
/** @ingroup Register
* @addtogroup Register2
* @{
*/
/** @file gnc-tree-view-split-reg.h
*/
#define GNC_TYPE_TREE_VIEW_SPLIT_REG (gnc_tree_view_split_reg_get_type ())
#define GNC_TREE_VIEW_SPLIT_REG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_TREE_VIEW_SPLIT_REG, GncTreeViewSplitReg))
#define GNC_TREE_VIEW_SPLIT_REG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_TREE_VIEW_SPLIT_REG, GncTreeViewSplitRegClass))
@ -181,7 +186,7 @@ void gnc_tree_view_split_reg_cancel_edit (GncTreeViewSplitReg *view, gboolean re
void gnc_tree_view_split_reg_finish_edit (GncTreeViewSplitReg *view);
/** @} */
G_END_DECLS
#endif /* __GNC_TREE_VIEW_SPLIT_REG_H */

View File

@ -1,6 +1,5 @@
/* Copyright (C) 2005, Chris Shoemaker <c.shoemaker@cox.net>
* This file is free software. See COPYING for details. */
/********************************************************************\
/********************************************************************\
* Copyright (C) 2005, Chris Shoemaker <c.shoemaker@cox.net> *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *

View File

@ -1965,7 +1965,7 @@ gnc_plugin_page_register_sort_order_save_cb (GtkToggleButton *button,
void
gnc_plugin_page_register_sort_order_reverse_cb (GtkToggleButton *button,
GncPluginPageRegister *page)
{
GncPluginPageRegisterPrivate *priv;
@ -2738,7 +2738,7 @@ gnc_plugin_page_register_cmd_print_check (GtkAction *action,
gnc_ui_print_check_dialog_create(plugin_page, splits);
g_list_free(splits);
}
}
}
}
}
else if (ledger_type == LD_GL && reg->type == SEARCH_LEDGER)
@ -3089,9 +3089,9 @@ gnc_plugin_page_register_cmd_view_sort_by (GtkAction *action,
button = GTK_WIDGET(gtk_builder_get_object (builder, "sort_save"));
if (priv->sd.save_order == TRUE)
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
/* Set the button for the current reverse_order order */
button = GTK_WIDGET(gtk_builder_get_object (builder, "sort_reverse"));
button = GTK_WIDGET(gtk_builder_get_object (builder, "sort_reverse"));
if(priv->sd.reverse_order == TRUE)
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
@ -3573,6 +3573,8 @@ gnc_plugin_page_register_cmd_expand_transaction (GtkToggleAction *action,
LEAVE(" ");
}
/** Callback for "Edit Exchange Rate" menu item.
*/
static void
gnc_plugin_page_register_cmd_exchange_rate (GtkAction *action,
GncPluginPageRegister *plugin_page)

View File

@ -22,16 +22,6 @@
* Boston, MA 02110-1301, USA gnu@gnu.org *
**********************************************************************/
/** @addtogroup ContentPlugins
@{ */
/** @addtogroup Register2Plugin Register2 Page
@{ */
/** @file gnc-plugin-page-register.h
@brief Functions providing a register page for the GnuCash UI
@author Copyright (C) 2003 Jan Arne Petersen <jpetersen@uni-bonn.de>
@author Copyright (C) 2003 David Hampton <hampton@employees.org>
*/
#ifndef __GNC_PLUGIN_PAGE_REGISTER2_H
#define __GNC_PLUGIN_PAGE_REGISTER2_H
@ -43,7 +33,12 @@
#include "gnc-split-reg2.h"
G_BEGIN_DECLS
/** @ingroup Register
* @addtogroup Register2
* @{
*/
/** @file gnc-plugin-page-register2.h
*/
/* type macros */
#define GNC_TYPE_PLUGIN_PAGE_REGISTER2 (gnc_plugin_page_register2_get_type ())
#define GNC_PLUGIN_PAGE_REGISTER2(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_PLUGIN_PAGE_REGISTER2, GncPluginPageRegister2))
@ -153,7 +148,5 @@ gnc_plugin_page_register2_get_account (GncPluginPageRegister2 *page);
G_END_DECLS
/** @} */
/** @} */
#endif /* __GNC_PLUGIN_PAGE_REGISTER2_H */

View File

@ -28,7 +28,12 @@
#include "gnc-plugin.h"
G_BEGIN_DECLS
/** @ingroup Register
* @addtogroup Register2
* @{
*/
/** @file gnc-plugin-register2.h
*/
/* type macros */
#define GNC_TYPE_PLUGIN_REGISTER2 (gnc_plugin_register2_get_type ())
#define GNC_PLUGIN_REGISTER2(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_PLUGIN_REGISTER2, GncPluginRegister2))
@ -56,5 +61,6 @@ GType gnc_plugin_register2_get_type (void);
GncPlugin *gnc_plugin_register2_new (void);
G_END_DECLS
/** @} */
#endif /* __GNC_PLUGIN_REGISTER2_H */

View File

@ -164,8 +164,6 @@ void gnc_split_reg_size_allocate( GtkWidget *widget,
gpointer user_data );
void gnc_split_reg_handle_exchange_cb (GtkWidget *w, gpointer data);
static void gnc_split_reg_class_init( GNCSplitRegClass *klass );
static void gnc_split_reg_init( GNCSplitReg *gsr );
static void gnc_split_reg_init2( GNCSplitReg *gsr );
@ -1893,16 +1891,6 @@ gnc_split_reg_set_sort_reversed(GNCSplitReg *gsr, gboolean rev)
gnc_ledger_display_refresh( gsr->ledger );
}
void
gnc_split_reg_handle_exchange_cb (GtkWidget *w, gpointer data)
{
GNCSplitReg *gsr = data;
SplitRegister *reg = gnc_ledger_display_get_split_register (gsr->ledger);
/* XXX Ignore the return value -- we don't care if this succeeds */
(void)gnc_split_register_handle_exchange (reg, TRUE);
}
static void
gnc_split_reg_record (GNCSplitReg *gsr)
{

View File

@ -33,7 +33,12 @@
#include "gnc-ledger-display2.h"
#include "gnc-split-reg.h"
#include "gnc-tree-view-split-reg.h"
/** @ingroup Register
* @addtogroup Register2
* @{
*/
/** @file gnc-split-reg2.h
*/
#define GNC_SPLIT_REG2(obj) G_TYPE_CHECK_INSTANCE_CAST( obj, gnc_split_reg2_get_type(), GNCSplitReg2 )
#define GNC_SPLIT_REG2_CLASS(klass) G_TYPE_CHECK_CLASS_CAST( klass, gnc_split_reg2_get_type(), GNCSplitReg2Class )
#define IS_GNC_SPLIT_REG2(obj) G_TYPE_CHECK_INSTANCE_TYPE( obj, gnc_split_reg2_get_type() )
@ -154,5 +159,5 @@ void gnc_split_reg2_balancing_entry (GNCSplitReg2 *gsr, Account *account,
void gnc_split_reg2_set_moved_cb (GNCSplitReg2 *gsr, GFunc cb, gpointer cb_data);
/** @} */
#endif /* GNC_SPLIT_REG2_H */

View File

@ -1,8 +1,6 @@
/* The following is code copied from Gnumeric 1.7.8 licensed under the
* GNU General Public License version 2 and/or version 3. It is from the file
* gnumeric/src/gui-util.c, and it has been modified slightly to work
* within GnuCash. */
/********************************************************************\
* The following is code copied from Gnumeric 1.7.8 src/gui-util.c, *
* and it has been modified slightly to work within GnuCash. *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *

View File

@ -419,8 +419,8 @@
(let ((retval '()))
(if (or (not (string? date-string))
(not (> (string-length date-string) 0)))
(set! retval possible-formats))
(let ((match (regexp-exec qif-date-compiled-rexp date-string)))
(set! retval possible-formats)
(let ((match (regexp-exec qif-date-compiled-rexp date-string)))
(if match
(if (match:substring match 1)
(set! retval (parse-check-date-format match possible-formats))
@ -442,7 +442,8 @@
(memq 'm-d-y possible-formats))
(set! res2 (parse-check-date-format date-mdy possible-formats)))
(set! retval (append res1 res2))))))
(set! retval (append res1 res2)))))))
retval))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -33,10 +33,15 @@
#include "SchedXaction.h"
#include "Transaction.h"
/** @ingroup Register
* @addtogroup Gnome
* @{
*/
/** @file gnc-ledger-display.h
* @brief Public declarations for GncLedgerDisplay class.
*/
/** Definitions *****************************************************/
/* The GNCLedgerDisplay struct describes a single register/ledger
/** @brief The GNCLedgerDisplay struct describes a single register/ledger
* instance. It has a SplitRegister specially configured for
* displaying the results of a Query. It also stores the Query. */
typedef struct gnc_ledger_display GNCLedgerDisplay;
@ -54,19 +59,17 @@ typedef enum
} GNCLedgerDisplayType;
/** Prototypes ******************************************************/
/* returns the 'lead' account of a ledger display, or NULL if none. */
/** returns the 'lead' account of a ledger display, or NULL if none. */
Account * gnc_ledger_display_leader (GNCLedgerDisplay *ld);
GNCLedgerDisplayType gnc_ledger_display_type (GNCLedgerDisplay *ld);
/* get and set the user data associated with the ledger */
/** get and set the user data associated with the ledger */
void gnc_ledger_display_set_user_data (GNCLedgerDisplay *ld,
gpointer user_data);
gpointer gnc_ledger_display_get_user_data (GNCLedgerDisplay *ld);
/* set the handlers used by the ledger display */
/** set the handlers used by the ledger display */
void gnc_ledger_display_set_handlers (GNCLedgerDisplay *ld,
GNCLedgerDisplayDestroy destroy,
GNCLedgerDisplayGetParent get_parent);
@ -74,17 +77,17 @@ void gnc_ledger_display_set_handlers (GNCLedgerDisplay *ld,
/** Returns the parent of a given ledger display */
GtkWidget *gnc_ledger_display_get_parent( GNCLedgerDisplay *ld );
/* return the split register associated with a ledger display */
/** return the split register associated with a ledger display */
SplitRegister * gnc_ledger_display_get_split_register (GNCLedgerDisplay *ld);
/* opens up a register window to display a single account */
/** opens up a register window to display a single account */
GNCLedgerDisplay * gnc_ledger_display_simple (Account *account);
/* opens up a register window to display the parent account and all of
/** opens up a register window to display the parent account and all of
* its children. */
GNCLedgerDisplay * gnc_ledger_display_subaccounts (Account *account);
/* opens up a general journal window */
/** opens up a general ledger window */
GNCLedgerDisplay * gnc_ledger_display_gl (void);
/**
@ -96,31 +99,31 @@ GNCLedgerDisplay * gnc_ledger_display_gl (void);
**/
GNCLedgerDisplay * gnc_ledger_display_template_gl (char *id);
/* display a general journal for an arbitrary query */
/** display a general ledger for an arbitrary query */
GNCLedgerDisplay * gnc_ledger_display_query (Query *query,
SplitRegisterType type,
SplitRegisterStyle style);
/* Set the query used for a register. */
/** Set the query used for a register. */
void gnc_ledger_display_set_query (GNCLedgerDisplay *ledger_display,
Query *q);
/* return the query associated with a ledger */
/** return the query associated with a ledger */
Query * gnc_ledger_display_get_query (GNCLedgerDisplay *ld);
/* If the given ledger display still exists, return it. Otherwise,
/** If the given ledger display still exists, return it. Otherwise,
* return NULL */
GNCLedgerDisplay * gnc_ledger_display_find_by_query (Query *q);
/* redisplay/redraw only the indicated window. Both routines do same
/** 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);
/* close the window */
/** close the window */
void gnc_ledger_display_close (GNCLedgerDisplay * ledger_display);
/* Returns a boolean of whether this display should be single or double lined
/** 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);

View File

@ -31,16 +31,24 @@
#include "Account.h"
#include "Query.h"
#include "split-register.h"
#include "split-register.h"
#include "SchedXaction.h"
#include "Transaction.h"
#include "gnc-tree-model-split-reg.h"
#include "gnc-tree-view-split-reg.h"
/** Definitions *****************************************************/
/** @ingroup Register
* @addtogroup Register2
* @brief Register2 is a reimplementation of the original Register with new
* classes based on GtkListView.
* @{
*/
/** @file gnc-ledger-display2.h
* @brief Public declarations for GncLedgerDisplay2 class.
*/
/* The GNCLedgerDisplay2 struct describes a single register/ledger
/**@brief Defines a single register/ledger
* instance. It has a SplitRegister specially configured for
* displaying the results of a Query. It also stores the Query. */
typedef struct gnc_ledger_display2 GNCLedgerDisplay2;
@ -59,24 +67,22 @@ typedef enum
} GNCLedgerDisplay2Type;
/** Prototypes ******************************************************/
/* returns the 'lead' account of a ledger display, or NULL if none. */
/** returns the 'lead' account of a ledger display, or NULL if none. */
Account * gnc_ledger_display2_leader (GNCLedgerDisplay2 *ld);
GNCLedgerDisplay2Type gnc_ledger_display2_type (GNCLedgerDisplay2 *ld);
/* get and set the user data associated with the ledger */
/** get and set the user data associated with the ledger */
void gnc_ledger_display2_set_user_data (GNCLedgerDisplay2 *ld,
gpointer user_data);
gpointer gnc_ledger_display2_get_user_data (GNCLedgerDisplay2 *ld);
/* set the handlers used by the ledger display */
/** set the handlers used by the ledger display */
void gnc_ledger_display2_set_handlers (GNCLedgerDisplay2 *ld,
GNCLedgerDisplay2Destroy destroy,
GNCLedgerDisplay2GetParent get_parent);
/* Set and Get the tree view used by the ledger display */
/** Set and Get the tree view used by the ledger display */
void gnc_ledger_display2_set_split_view_register (GNCLedgerDisplay2 *ld, GncTreeViewSplitReg *view);
GncTreeViewSplitReg * gnc_ledger_display2_get_split_view_register (GNCLedgerDisplay2 *ld);
@ -85,17 +91,17 @@ void gnc_ledger_display2_set_split_view_refresh (GNCLedgerDisplay2 *ld, gboolean
/** Returns the parent of a given ledger display */
GtkWidget *gnc_ledger_display2_get_parent( GNCLedgerDisplay2 *ld );
/* return the split register associated with a ledger display */
/** return the split register associated with a ledger display */
GncTreeModelSplitReg * gnc_ledger_display2_get_split_model_register (GNCLedgerDisplay2 *ld);
/* opens up a register window to display a single account */
/** opens up a register window to display a single account */
GNCLedgerDisplay2 * gnc_ledger_display2_simple (Account *account);
/* opens up a register window to display the parent account and all of
/** opens up a register window to display the parent account and all of
* its children. */
GNCLedgerDisplay2 * gnc_ledger_display2_subaccounts (Account *account);
/* opens up a general journal window */
/** opens up a general ledger window */
GNCLedgerDisplay2 * gnc_ledger_display2_gl (void);
/**
@ -107,37 +113,37 @@ GNCLedgerDisplay2 * gnc_ledger_display2_gl (void);
**/
GNCLedgerDisplay2 * gnc_ledger_display2_template_gl (char *id);
/* display a general journal for an arbitrary query */
/** display a general ledger for an arbitrary query */
GNCLedgerDisplay2 * gnc_ledger_display2_query (Query *query,
SplitRegisterType2 type,
SplitRegisterStyle2 style);
/* Set the query used for a register. */
/** Set the query used for a register. */
void gnc_ledger_display2_set_query (GNCLedgerDisplay2 *ledger_display,
Query *q);
/* return the query associated with a ledger */
/** return the query associated with a ledger */
Query * gnc_ledger_display2_get_query (GNCLedgerDisplay2 *ld);
/* If the given ledger display still exists, return it. Otherwise,
/** If the given ledger display still exists, return it. Otherwise,
* return NULL */
GNCLedgerDisplay2 * gnc_ledger_display2_find_by_query (Query *q);
/* redisplay/redraw only the indicated window. Both routines do same
/** redisplay/redraw only the indicated window. Both routines do same
* thing, they differ only by the argument they take. */
void gnc_ledger_display2_refresh (GNCLedgerDisplay2 * ledger_display);
void gnc_ledger_display2_refresh_by_split_register (GncTreeModelSplitReg *model);
/* This is used to load the register for the schedule */
/** This is used to load the register for the schedule */
void gnc_ledger_display2_refresh_sched (GNCLedgerDisplay2 *ld, GList *splits);
/* Refilter the register */
/** Refilter the register */
void gnc_ledger_display2_refilter (GNCLedgerDisplay2 *ld);
/* close the window */
/** close the window */
void gnc_ledger_display2_close (GNCLedgerDisplay2 * ledger_display);
/* Returns a boolean of whether this display should be single or double lined
/** Returns a boolean of whether this display should be single or double lined
* mode by default */
gboolean gnc_ledger_display2_default_double_line (GNCLedgerDisplay2 *gld);

View File

@ -250,7 +250,7 @@ gnc_split_register_check_debcred (SplitRegister *reg,
}
}
}
return TRUE;
}
@ -302,7 +302,7 @@ gnc_split_register_check_account (SplitRegister *reg,
cell->cell.value);
if (!new_acct)
return FALSE;
split = gnc_split_register_get_current_split(reg);
gnc_split_register_set_cell_fractions (reg, split);
@ -1151,7 +1151,7 @@ gnc_split_register_check_cell (SplitRegister *reg, const char *cell_name)
LEAVE("account check failed");
return FALSE;
}
/* See if we are leaving a debit or credit cell */
if (!gnc_split_register_check_debcred (reg, cell_name))
{
@ -1287,10 +1287,13 @@ gnc_split_register_xfer_dialog(SplitRegister *reg, Transaction *txn,
return xfer;
}
/* This function checks to see if we need to determine an exchange rate.
* If we need to determine an exchange rate, then pop up the dialog.
/** If needed display the transfer dialog to get a price/exchange rate and
* adjust the price cell accordingly.
* If the dialog does not complete successfully, then return TRUE.
* Return FALSE in all other cases (meaning "move on")
* @param reg the register to operate on
* @param force_dialog pop a dialog even if we don't think we need it.
* @return whether more handling is required.
*/
gboolean
gnc_split_register_handle_exchange (SplitRegister *reg, gboolean force_dialog)

View File

@ -24,7 +24,13 @@
#define SPLIT_REGISTER_CONTROL_H
#include "table-control.h"
/** @addtogroup SplitRegister
* @{
*/
/** @file split-register-control.h
* @brief TableControl specialized for the SplitRegister.*/
/** Create a new TableControl specialized for the SplitRegister. */
TableControl * gnc_split_register_control_new (void);
/** @} */
#endif

View File

@ -26,7 +26,13 @@
#include "Transaction.h"
#include "table-model.h"
/** @addtogroup SplitRegister
* @{
*/
/** @file split-register-model-save.h
* @brief Save handlers for the SplitRegister Model and Template SplitRegister
* model.
*/
void gnc_split_register_model_add_save_handlers (TableModel *model);
void gnc_template_register_model_add_save_handlers (TableModel *model);
@ -38,4 +44,5 @@ SRSaveData * gnc_split_register_save_data_new (Transaction *trans,
void gnc_split_register_save_data_destroy (SRSaveData *sd);
/** @} */
#endif

View File

@ -24,8 +24,13 @@
#define SPLIT_REGISTER_MODEL_H
#include "table-model.h"
/** @addtogroup SplitRegister
* @{
*/
/** @file split-register-model.h
* @brief TableModels specialized for SplitRegister and template SplitRegister.
*/
TableModel * gnc_split_register_model_new (void);
TableModel * gnc_template_register_model_new (void);
/* @} */
#endif

View File

@ -25,6 +25,12 @@
#include "split-register.h"
/** @addtogroup SplitRegister
* @{
*/
/** @file split-register-p.h
* @brief private declarations for SplitRegister
*/
#define SPLIT_TRANS_STR _("-- Split Transaction --")
#define STOCK_SPLIT_STR _("-- Stock Split --")
@ -40,92 +46,92 @@ typedef enum {
struct sr_info
{
/* The blank split at the bottom of the register */
/** The blank split at the bottom of the register */
GncGUID blank_split_guid;
/* The currently open transaction, if any */
/** The currently open transaction, if any */
GncGUID pending_trans_guid;
/* A transaction used to remember where to put the cursor */
/** A transaction used to remember where to put the cursor */
Transaction *cursor_hint_trans;
/* A split used to remember where to put the cursor */
/** A split used to remember where to put the cursor */
Split *cursor_hint_split;
/* A split used to remember where to put the cursor */
/** A split used to remember where to put the cursor */
Split *cursor_hint_trans_split;
/* Used to remember where to put the cursor */
/** Used to remember where to put the cursor */
CursorClass cursor_hint_cursor_class;
/* If the hints were set by the traverse callback */
/** If the hints were set by the traverse callback */
gboolean hint_set_by_traverse;
/* If traverse is to the newly created split */
/** If traverse is to the newly created split */
gboolean traverse_to_new;
/* A flag indicating if the last traversal was 'exact'.
/** A flag indicating if the last traversal was 'exact'.
* See table-allgui.[ch] for details. */
gboolean exact_traversal;
/* Indicates that the current transaction is expanded
/** Indicates that the current transaction is expanded
* in ledger mode. Meaningless in other modes. */
gboolean trans_expanded;
/* set to TRUE after register is loaded */
/** set to TRUE after register is loaded */
gboolean reg_loaded;
/* flag indicating whether full refresh is ok */
/** flag indicating whether full refresh is ok */
gboolean full_refresh;
/* The default account where new splits are added */
/** The default account where new splits are added */
GncGUID default_account;
/* The last date recorded in the blank split */
/** The last date recorded in the blank split */
time64 last_date_entered;
/* true if the current blank split has been edited and commited */
/** true if the current blank split has been edited and commited */
gboolean blank_split_edited;
/* true if the demarcation between 'past' and 'future' transactions
/** true if the demarcation between 'past' and 'future' transactions
* should be visible */
gboolean show_present_divider;
/* true if we are loading the register for the first time */
/** true if we are loading the register for the first time */
gboolean first_pass;
/* true if the user has already confirmed changes of a reconciled
/** true if the user has already confirmed changes of a reconciled
* split */
gboolean change_confirmed;
/* RATE_RESET_NOT_REQD => No exchange rate dialog needed for current split
/** RATE_RESET_NOT_REQD => No exchange rate dialog needed for current split
* RATE_RESET_REQD => Need new exchange rate for current split
* RATE_RESET_DONE => Already got a new exchange rate for current split
*/
RateReset_t rate_reset;
/* true if the transaction being edited was auto-filled */
/** true if the transaction being edited was auto-filled */
gboolean auto_complete;
/* account on the current split when the exchange rate was last set */
/** account on the current split when the exchange rate was last set */
Account *rate_account;
/* User data for users of SplitRegisters */
/** User data for users of SplitRegisters */
gpointer user_data;
/* hook to get parent widget */
/** hook to get parent widget */
SRGetParentCallback get_parent;
/* The template account which template transaction should belong to */
/** The template account which template transaction should belong to */
GncGUID template_account;
/* configured strings for debit/credit headers */
/** configured strings for debit/credit headers */
char *debit_str;
char *credit_str;
char *tdebit_str;
char *tcredit_str;
/* true if the account separator has changed */
/** true if the account separator has changed */
gboolean separator_changed;
};
@ -155,15 +161,16 @@ gboolean gnc_split_register_find_split (SplitRegister *reg,
void gnc_split_register_show_trans (SplitRegister *reg,
VirtualCellLocation start_loc);
// Set the visibility of the split rows belonging to a transaction located at
// vcell_loc.
//
// If only_blank_split is TRUE, only the row used for entering an
// additional split is affected. Despite the name, this should not be confused
// with the "blank split" row used for entering the first split of a brand-new
// transaction. Instead, here it only refers to rows not tied to any split at
// all, such as those created for entering new splits on old transactions or
// the 2nd through nth split on brand-new transactions.
/** Set the visibility of the split rows belonging to a transaction located at
* vcell_loc.
*
* If only_blank_split is TRUE, only the row used for entering an
* additional split is affected. Despite the name, this should not be confused
* with the "blank split" row used for entering the first split of a brand-new
* transaction. Instead, here it only refers to rows not tied to any split at
* all, such as those created for entering new splits on old transactions or
* the 2nd through nth split on brand-new transactions.
*/
void gnc_split_register_set_trans_visible (SplitRegister *reg,
VirtualCellLocation vcell_loc,
gboolean visible,
@ -190,7 +197,7 @@ CursorClass gnc_split_register_cursor_name_to_class (const char *cursor_name);
gnc_numeric gnc_split_register_debcred_cell_value (SplitRegister *reg);
/* Determine if we need to perform any conversion on the splits in this
/** Determine if we need to perform any conversion on the splits in this
* transaction, and if so, what conversion we need
*/
gboolean gnc_split_reg_has_rate_cell (SplitRegisterType type);
@ -199,4 +206,5 @@ gboolean gnc_split_register_split_needs_amount(
gboolean gnc_split_register_needs_conv_rate(
SplitRegister *reg, Transaction *txn, Account *acc);
/** @} */
#endif

View File

@ -19,6 +19,14 @@
* Boston, MA 02110-1301, USA gnu@gnu.org *
* *
\********************************************************************/
#ifndef SPLIT_REGISTER_H
#define SPLIT_REGISTER_H
#include <glib.h>
#include "Transaction.h"
#include "table-allgui.h"
/** @addtogroup GUI
* @{
*/
@ -27,80 +35,75 @@
*/
/** @addtogroup SplitRegister Split Register
* @brief GnuCash-specific ledger and journal displays based on
* @ref RegisterCore.
* RegisterCore.
*
* @details The split register is a spreadsheet-like area that looks like
* a checkbook register. It displays transactions and allows the user to
* edit them in-place. The register does @b not contain any of the other
* window decorations that one might want to have for a free standing window
* (e.g. menubars, * toolbars, etc.)
* @details The split register is a spreadsheet-like area that looks like
* a checkbook register. It displays transactions and allows the user to
* edit them in-place. The register does @b not contain any of the other
* window decorations that one might want to have for a free standing window
* (e.g. menubars, * toolbars, etc.)
*
* The layout of the register is configurable. There's a broad
* variety of cell types to choose from: date cells that know
* how to parse dates, price cells that know how to parse prices,
* etc. These cells can be laid out in any column; even a multi-row
* layout is supported. The name "split register" is derived from
* the fact that this register can display multiple rows of
* transaction splits underneath a transaction title/summary row.
* The layout of the register is configurable. There's a broad
* variety of cell types to choose from: date cells that know
* how to parse dates, price cells that know how to parse prices,
* etc. These cells can be laid out in any column; even a multi-row
* layout is supported. The name "split register" is derived from
* the fact that this register can display multiple rows of
* transaction splits underneath a transaction title/summary row.
*
* An area for entering new transactions is provided at the bottom of
* the register.
* An area for entering new transactions is provided at the bottom of
* the register.
*
* All user input to the register is handled by the 'cursor', which
* is mapped onto one of the displayed rows.
* All user input to the register is handled by the 'cursor', which
* is mapped onto one of the displayed rows.
*
* @par Design Notes.
* @{
* Some notes about the "blank split":@n
* Q: What is the "blank split"?@n
* A: A new, empty split appended to the bottom of the ledger
* window. The blank split provides an area where the user
* can type in new split/transaction info.
* The "blank split" is treated in a special way for a number
* of reasons:
* - it must always appear as the bottom-most split
* in the Ledger window,
* - it must be committed if the user edits it, and
* a new blank split must be created.
* - it must be deleted when the ledger window is closed.
*
* To implement the above, the register "user_data" is used
* to store an SRInfo structure containing the blank split.
* @}
*
* @par Some notes on Commit/Rollback:
* @{
* There's an engine component and a gui component to the commit/rollback
* scheme. On the engine side, one must always call BeginEdit()
* before starting to edit a transaction. When you think you're done,
* you can call CommitEdit() to commit the changes, or RollbackEdit() to
* go back to how things were before you started the edit. Think of it as
* a one-shot mega-undo for that transaction.
*
* Note that the query engine uses the original values, not the currently
* edited values, when performing a sort. This allows your to e.g. edit
* the date without having the transaction hop around in the gui while you
* do it.
*
* On the gui side, commits are now performed on a per-transaction basis,
* rather than a per-split (per-journal-entry) basis. This means that
* if you have a transaction with a lot of splits in it, you can edit them
* all you want without having to commit one before moving to the next.
* @par Design Notes.
* Some notes about the "blank split":@n
* Q: What is the "blank split"?@n
* A: A new, empty split appended to the bottom of the ledger
* window. The blank split provides an area where the user
* can type in new split/transaction info.
* The "blank split" is treated in a special way for a number
* of reasons:
* - it must always appear as the bottom-most split
* in the Ledger window,
* - it must be committed if the user edits it, and
* a new blank split must be created.
* - it must be deleted when the ledger window is closed.
* @par
* To implement the above, the register "user_data" is used
* to store an SRInfo structure containing the blank split.
*
* @par Some notes on Commit/Rollback:
* There's an engine component and a gui component to the commit/rollback
* scheme. On the engine side, one must always call BeginEdit()
* before starting to edit a transaction. When you think you're done,
* you can call CommitEdit() to commit the changes, or RollbackEdit() to
* go back to how things were before you started the edit. Think of it as
* a one-shot mega-undo for that transaction.
* @par
* Note that the query engine uses the original values, not the currently
* edited values, when performing a sort. This allows your to e.g. edit
* the date without having the transaction hop around in the gui while you
* do it.
* @par
* On the gui side, commits are now performed on a per-transaction basis,
* rather than a per-split (per-journal-entry) basis. This means that
* if you have a transaction with a lot of splits in it, you can edit them
* all you want without having to commit one before moving to the next.
* @par
* Similarly, the "cancel" button will now undo the changes to all of the
* lines in the transaction display, not just to one line (one split) at a
* time.
* @}
*
*
* @par Some notes on Reloads & Redraws:
* @{
* Reloads and redraws tend to be heavyweight. We try to use change flags
* as much as possible in this code, but imagine the following scenario:
*
* @par
* Create two bank accounts. Transfer money from one to the other.
* Open two registers, showing each account. Change the amount in one window.
* Note that the other window also redraws, to show the new correct amount.
*
* @par
* Since you changed an amount value, potentially *all* displayed
* balances change in *both* register windows (as well as the ledger
* balance in the main window). Three or more windows may be involved
@ -108,26 +111,25 @@
* entering a paycheck (or correcting a typo in an old paycheck).
* Changing a date might even cause all entries in all three windows
* to be re-ordered.
*
* @par
* The only thing I can think of is a bit stored with every table
* entry, stating 'this entry has changed since lst time, redraw it'.
* But that still doesn't avoid the overhead of reloading the table
* from the engine.
* @}
*
* The Register itself is independent of GnuCash, and is designed
* so that it can be used with other applications.
* The Ledger is an adaptation of the Register for use by GnuCash.
* The Ledger sets up an explicit visual layout, putting certain
* types of cells in specific locations (e.g. date on left, summary
* in middle, value at right), and hooks up these cells to
* the various GnuCash financial objects.
* The Register itself is independent of GnuCash, and is designed
* so that it can be used with other applications.
* The Ledger is an adaptation of the Register for use by GnuCash.
* The Ledger sets up an explicit visual layout, putting certain
* types of cells in specific locations (e.g. date on left, summary
* in middle, value at right), and hooks up these cells to
* the various GnuCash financial objects.
*
* This code is also theoretically independent of the actual GUI
* toolkit/widget-set (it once worked with both Motif and Gnome).
* The actual GUI-toolkit specific code is supposed to be in a
* GUI portability layer. Over the years, some gnome-isms may
* have snuck in; these should also be cleaned up.
* This code is also theoretically independent of the actual GUI
* toolkit/widget-set (it once worked with both Motif and Gnome).
* The actual GUI-toolkit specific code is supposed to be in a
* GUI portability layer. Over the years, some gnome-isms may
* have snuck in; these should also be cleaned up.
*
* @{
*/
@ -135,15 +137,6 @@
* @brief API for checkbook register display area
* @author Copyright (C) 1998-2000 Linas Vepstas <linas@linas.org>
*/
/** @{ */
#ifndef SPLIT_REGISTER_H
#define SPLIT_REGISTER_H
#include <glib.h>
#include "Transaction.h"
#include "table-allgui.h"
/** @brief Register types
*
@ -556,7 +549,6 @@ gnc_split_register_begin_edit_or_warn(SRInfo *info, Transaction *trans);
/** @} */
/** @} */
/** @} */
/** @} */
/* -------------------------------------------------------------- */
/** Private function -- outsiders must not use this */

View File

@ -20,12 +20,30 @@
* *
\********************************************************************/
/*
* FILE:
* basiccell.h
/** @addtogroup RegisterCore Register Core
* @{
* @addtogroup Cell Cell
* @brief A "Cell" is an active object which is designed to read a specific kind
* of user input. A Cell object has callbacks that are called when the
* user enters the cell (e.g. by mouse-clicking on a cell in a table, or
* tabbing into it), when the user attempts to modify text in the cell
* (e.g. by typing in it), and when the user leaves the cell (e.g. by
* mouse-clicking elsewhere, or tabbing away).
*
* FUNCTION:
* The BasicCell class provides an abstract base class
* Special-purpose cells can be created by "inheriting" from the basic
* cell object. Thus, there are special-purpose cells for handling dates,
* pull-down menus, text fields with auto-completion from a list of
* alternatives, monetary amounts, etc.
*
* Cells implementations may or may not contain GUI code. Cells which
* require only that text be displayed are completely "GUI-independent",
* that is, they depend on the underlying table to display the text. Cells
* which require additional GUI elements (such as pull-down menus) must
* implement the proper GUI handling on their own (using, e.g., GTK).
* @{
* @file basiccell.h
* @struct basic_cell
* @brief The BasicCell class provides an abstract base class
* defining the handling of the editing of a cell of a table.
* Classes that provide the actual handling for different
* cell types should inherit from this class.
@ -130,8 +148,8 @@
*
* The gui_private member may be used by the derived class to
* store any additional GUI-specific data.
*
* HISTORY:
*/
/* HISTORY:
* Copyright (c) 1998 Linas Vepstas
* Copyright (c) 2000 Dave Peticolas <dave@krondo.com>
*/
@ -190,11 +208,11 @@ struct basic_cell
{
char * cell_name;
gchar *cell_type_name;
char * value; /* current value */
guint value_chars; /* number of characters in value */
char * value; /** current value */
guint value_chars; /** number of characters in value */
gboolean changed; /* true if value modified */
gboolean conditionally_changed; /* true if value modified conditionally */
gboolean changed; /** true if value modified */
gboolean conditionally_changed; /** true if value modified conditionally */
/* "virtual", overloaded methods */
CellSetValueFunc set_value;
@ -212,14 +230,13 @@ struct basic_cell
CellDestroyFunc gui_destroy;
/* GUI information */
char *sample_text; /* sample text for sizing purposes */
CellAlignment alignment; /* horizontal alignment in column */
gboolean expandable; /* can fill with extra space */
gboolean span; /* can span multiple columns */
gboolean is_popup; /* is a popup widget */
char *sample_text; /** sample text for sizing purposes */
CellAlignment alignment; /** horizontal alignment in column */
gboolean expandable; /** can fill with extra space */
gboolean span; /** can span multiple columns */
gboolean is_popup; /** is a popup widget */
/* general hook for gui-private data */
gpointer gui_private;
gpointer gui_private; /** general hook for gui-private data */
};
@ -260,4 +277,5 @@ void gnc_basic_cell_set_conditionally_changed (BasicCell *cell,
void gnc_basic_cell_set_value_internal (BasicCell *bcell,
const char *value);
/** @} @} */
#endif /* BASIC_CELL_H */

View File

@ -25,7 +25,10 @@
#define CELL_FACTORY_H
#include "basiccell.h"
/** @addtogroup Cell Cell
* @{
* @file cell-factory.h
*/
typedef struct cell_factory CellFactory;
CellFactory * gnc_cell_factory_new (void);
@ -38,4 +41,5 @@ void gnc_cell_factory_add_cell_type (CellFactory *cf,
BasicCell * gnc_cell_factory_make_cell (CellFactory *cf,
const char *cell_type_name);
/** @} @} */
#endif

View File

@ -19,14 +19,18 @@
* Boston, MA 02110-1301, USA gnu@gnu.org *
* *
\********************************************************************/
/** @addtogroup GUI
* @{
*/
/** @addtogroup Register Registers, Ledgers and Journals
* @{
*/
/** @addtogroup RegisterCore Register Core
* @{
* @{
* @addtogroup Cellblock Cellblock
* @brief A "Cellblock" is an array of active cells. The cells are laid out in
* rows and columns. The cellblock serves as a convenient container for
* organizing active cells in an array. Through the mechanism of Cursors
* (defined below), it allows a group of cells to be treated as a single
* transactional entity. That is, the cursor/cellblock allows all edits to a
* groups of cells to be simultaneously committed or rejected by underlying
* engines. This makes it appropriate for use as a GUI for
* transaction-processing applications with two-phase commit requirements.
* @{
*/
/** @file cellblock.h
* @brief Declarations for the CellBlock object
@ -60,14 +64,40 @@ typedef struct
} CellBlock;
/** Create a new CellBlock on the heap.
* @param rows Number of rows.
* @param cols Number of columns.
* @param cursor_name A string name for the CellBlock. It will be copied with a
* new string on the heap.
* @return a newly-allocated CellBlock which should be deleted with
* gnc_cellblock_destroy.
*/
CellBlock * gnc_cellblock_new (int rows, int cols, const char *cursor_name);
/** Delete a CellBlock and its Cells.
* @param cellblock The CellBlock to destroy.
*/
void gnc_cellblock_destroy (CellBlock *cellblock);
/** Add a cell to the CellBlock at the specified coordinates. The CellBlock
* takes ownership of the Cell. If there's already a Cell at the location it
* will be leaked, so callers shoud first call gnc_cellblock_get_cell() and
* delete the result if it's not NULL.
* @param cellblock The CellBlock
* @param row The row at which to add the cell
* @param col The column at which to add the cell
* @param cell The cell to place at the coordinates.
*/
void gnc_cellblock_set_cell (CellBlock *cellblock,
int row, int col,
BasicCell *cell);
/** Retrieve the Cell at the specified coordinates.
* @param cellblock The CellBlock
* @param row The row of the requested Cell
* @param col The column of the requested Cell
* @return A pointer to the requested Cell.
*/
BasicCell * gnc_cellblock_get_cell (CellBlock *cellblock,
int row, int col);
@ -90,13 +120,19 @@ BasicCell * gnc_cellblock_get_cell_by_name(CellBlock *cellblock,
const char *cell_name,
int *row, int *col);
/* Return number of changed cells. */
/** Return number of changed cells.
* @param cursor The cellblock to query
* @param include_conditional If TRUE counts conditionally-changed cells
* @return The number of changed cells found.
*/
int gnc_cellblock_changed (CellBlock *cursor,
gboolean include_conditional);
/** Sets all cells in the cellblock to not changed.
* @param cursor The cellblock.
*/
void gnc_cellblock_clear_changes (CellBlock *cursor);
#endif
/** @} */
/** @} */
/** @} */

View File

@ -19,13 +19,11 @@
* Boston, MA 02110-1301, USA gnu@gnu.org *
* *
\********************************************************************/
/*
* FILE:
* checkboxcell.h
*
* FUNCTION:
* The CheckboxCell object implements a cell handler
/** @addtogroup Cell Cell
* @{
* @file checkboxcell.h
* @struct CheckboxCell
* @brief The CheckboxCell object implements a cell handler
* that will toggle between yes and no values when clicked upon by the mouse.
*
* HISTORY:
@ -52,5 +50,5 @@ BasicCell * gnc_checkbox_cell_new (void);
void gnc_checkbox_cell_set_flag (CheckboxCell *cell, gboolean flag);
gboolean gnc_checkbox_cell_get_flag (CheckboxCell *cell);
const char* gnc_checkbox_cell_get_string (gboolean flag);
/** @} */
#endif

View File

@ -20,8 +20,10 @@
* *
\********************************************************************/
/**
/** @addtogroup Cell Cell
* @{
* @file combocell.h
* @struct ComboCell
* @brief The ComboCell object implements a cell handler with a
* "combination-box" pull-down menu in it.
*
@ -99,4 +101,5 @@ void gnc_combo_cell_use_quickfill_cache (ComboCell *cell, QuickFill *shared_qf);
void gnc_combo_cell_use_list_store_cache (ComboCell * cell, gpointer data);
/** @} */
#endif

View File

@ -20,12 +20,11 @@
* *
\********************************************************************/
/*
* FILE:
* datecell.h
*
* FUNCTION:
* The DateCell object implements a date handling cell. It
/** @addtogroup Cell Cell
* @{
* @file datecell.h
* @struct DateCell
* @brief The DateCell object implements a date handling cell. It
* is able to display dates in several formats, it is also
* able to accept date input, and also supports a number of accelerator
* keys.
@ -69,22 +68,6 @@
*
*
* METHODS:
* The xaccSetDateCellValue() method accepts a numeric date and
* sets the contents of the date cell to that value. The
* value day, month, year should follow the regular written
* conventions, i.e. day==(1..31), mon==(1..12), year==4 digits
*
* The xaccCommitDateCell() method commits any pending changes to the
* value of the cell. That is, it will take the cells current string
* value, and parse it into a month-day-year value.
*
* Why is this needed? Basically, while the user is typing into the
* cell, we do not even try to parse the date, lest we confuse things
* royally. Normally, when the user leaves this cell, and moves to
* another, we parse the date and print it nicely and cleanly into
* the cell. But it can happen that we want to get the accurate contents
* of the date cell before we've left it, e.g. if the user has clicked
* on the "commit" button. This is the routine to call for that.
*
* HISTORY:
* Copyright (c) 1998, 1999, 2000 Linas Vepstas <linas@linas.org>
@ -100,23 +83,53 @@
#include "qof.h"
typedef struct date_cell
typedef struct
{
BasicCell cell;
} DateCell;
/* installs a callback to handle date recording */
/** installs a callback to handle date recording */
BasicCell * gnc_date_cell_new (void);
/* days are 1-31, mon is 1-12, year 1900 == 1900 */
/** Accepts a numeric date and sets the contents of the date cell to that value.
* The value day, month, year should follow the regular written conventions.
* @param cell The DateCell to set
* @param day The day of the month, 1..31
* @param month The month of the year, 1..12
* @param year The year, 4 digits, common era
*/
void gnc_date_cell_set_value (DateCell *cell,
int day, int mon, int year);
/** Sets the contents of the cell with seconds before or since the Unix epoch.
* @param cell The DateCell to set
* @param secs Seconds before or since the Unix epoch, 1 January 1970 CE.
*/
void gnc_date_cell_set_value_secs (DateCell *cell, time64 secs);
/** Commits any pending changes to the value of the cell. That is, it will take
* the cells current string value, and parse it into a month-day-year value.
*
* Why is this needed? Basically, while the user is typing into the cell, we do
* not even try to parse the date, lest we confuse things royally. Normally,
* when the user leaves this cell, and moves to another, we parse the date and
* print it nicely and cleanly into the cell. But it can happen that we want to
* get the accurate contents of the date cell before we've left it, e.g. if the
* user has clicked on the "commit" button. This is the routine to call for
* that.
*/
void gnc_date_cell_commit (DateCell *cell);
/** Set a Timespec to the value in the DateCell.
* @param cell The DateCell
* @param ts A Timespec* to which the function will write the date.
*/
void gnc_date_cell_get_date (DateCell *cell, Timespec *ts);
void gnc_date_cell_get_date_gdate (DateCell *cell, GDate *date);
/** Timespec to the value in the DateCell.
* @param cell The DateCell
* @param date A GDate* into which the functino will write the date.
*/
void gnc_date_cell_get_date_gdate (DateCell *cell, GDate *date);
/** @} */
#endif

View File

@ -19,18 +19,15 @@
* Boston, MA 02110-1301, USA gnu@gnu.org *
\********************************************************************/
/**
* FILE:
* formulacell.h
*
* FUNCTION:
*
* The FormulaCell is a register-table cell which can contain a formula
/** @addtogroup Cell Cell
* @{
* @file formulacell.h
* @struct FormulaCell
* @brief The FormulaCell is a register-table cell which can contain a formula
* involving numbers, formula markup and strings denoting either functions or
* variables.
*
* Copyright (c) 2002 Joshua Sled <jsled@asynchronous.org>
**/
*/
/* Copyright (c) 2002 Joshua Sled <jsled@asynchronous.org> */
#ifndef FORMULA_CELL_H
#define FORMULA_CELL_H
@ -42,7 +39,7 @@
#include "basiccell.h"
#include "qof.h"
typedef struct _FormulaCell
typedef struct
{
BasicCell cell;
@ -57,8 +54,7 @@ typedef struct _FormulaCell
BasicCell* gnc_formula_cell_new (void);
void gnc_formula_cell_set_value( FormulaCell *fc, const char *newVal );
/** @} */
#endif /* FORMULA_CELL_H */
/* --------------- end of file ---------------------- */

View File

@ -25,11 +25,12 @@
#include <glib.h>
/* This is the API for GTables, a datatype for 2-dimensional tables
/** @addtogroup Table Table
* @{
* @file gtable.h
* This is the API for GTables, a datatype for 2-dimensional tables
* with automatic resizing and memory management.
*
* HACK ALERT -- this thing should proably become a part of glib (??)
*/
typedef struct GTable GTable;
@ -38,7 +39,7 @@ typedef void (*g_table_entry_constructor) (gpointer entry, gpointer user_data);
typedef void (*g_table_entry_destroyer) (gpointer entry, gpointer user_data);
/* Create a new table with the given entry constructor and destroyer.
/** Create a new table with the given entry constructor and destroyer.
* Both functions must be given. They are used to initialize the table
* entries and free unneeded memory when resizing and destroying. */
GTable * g_table_new (guint entry_size,
@ -46,14 +47,14 @@ GTable * g_table_new (guint entry_size,
g_table_entry_destroyer destroyer,
gpointer user_data);
/* Free the table and all associated table elements. */
/** Free the table and all associated table elements. */
void g_table_destroy (GTable *gtable);
/* Return the element at the given row and column. If the coordinates
/** Return the element at the given row and column. If the coordinates
* are out-of-bounds, return NULL */
gpointer g_table_index (GTable *gtable, int row, int col);
/* Resize the table, allocating and deallocating extra table
/** Resize the table, allocating and deallocating extra table
* members if needed. The relationship between table members
* before and after resizing is undefined, except in the case
* where the number of rows changes, but not the number of
@ -61,10 +62,11 @@ gpointer g_table_index (GTable *gtable, int row, int col);
* first. */
void g_table_resize (GTable *gtable, int rows, int cols);
/* Return the number of table rows. */
/** Return the number of table rows. */
int g_table_rows (GTable *gtable);
/* Return the number of table columns. */
/** Return the number of table columns. */
int g_table_cols (GTable *gtable);
/** @} */
#endif

View File

@ -20,15 +20,14 @@
* *
\********************************************************************/
/*
* FILE:
* numcell.h
*
* FUNCTION:
* The NumCell object implements a number handling cell. It
/** @addtogroup Cell Cell
* @{
* @file numcell.h
* @struct NumCell
* @brief The NumCell object implements a number handling cell. It
* supports a number of accelerator keys for number entry.
*
* HISTORY:
*/
/* HISTORY:
* Copyright (c) 2000 Dave Peticolas <dave@krondo.com>
*/
@ -48,5 +47,5 @@ BasicCell * gnc_num_cell_new (void);
void gnc_num_cell_set_value (NumCell *cell, const char *str);
gboolean gnc_num_cell_set_last_num (NumCell *cell, const char *str);
/** @} */
#endif

View File

@ -20,12 +20,11 @@
* *
\********************************************************************/
/*
* FILE:
* pricecell.h
*
* FUNCTION:
* The PriceCell object implements a cell handler that stores
/** @addtogroup Cell Cell
* @{
* @file pricecell.h
* @struct PriceCell
* @brief The PriceCell object implements a cell handler that stores
* a single double-precision value, and has the smarts to
* display it as a price/amount as well as accepting monetary
* or general numeric input.
@ -34,8 +33,8 @@
*
* On output, it will display negative values in red text.
* hack alert -- the actual color (red) should be user configurable.
*
* HISTORY:
*/
/* HISTORY:
* Copyright (c) 1998, 1999, 2000 Linas Vepstas
* Copyright (c) 2000 Dave Peticolas <dave@krondo.com>
* Copyright (c) 2001 Free Software Foundation
@ -51,47 +50,42 @@
typedef struct
{
BasicCell cell;
gnc_numeric amount; /* the amount associated with this cell */
int fraction; /* fraction used for rounding, if 0 no rounding */
gboolean blank_zero; /* controls printing of zero values */
GNCPrintAmountInfo print_info; /* amount printing context */
gboolean need_to_parse; /* internal */
gnc_numeric amount; /** the amount associated with this cell */
int fraction; /** fraction used for rounding, if 0 no rounding */
gboolean blank_zero; /** controls printing of zero values */
GNCPrintAmountInfo print_info; /** amount printing context */
gboolean need_to_parse; /** internal */
} PriceCell;
/* installs a callback to handle price recording */
/** installs a callback to handle price recording */
BasicCell * gnc_price_cell_new (void);
/* return the value of a price cell */
/** return the value of a price cell */
gnc_numeric gnc_price_cell_get_value (PriceCell *cell);
/* updates amount, returns TRUE if string representation
/** updates amount, returns TRUE if string representation
* actually changed */
gboolean gnc_price_cell_set_value (PriceCell *cell, gnc_numeric amount);
/* Sets the fraction used for rounding. If 0, no rounding is performed. */
/** Sets the fraction used for rounding. If 0, no rounding is performed. */
void gnc_price_cell_set_fraction (PriceCell *cell, int fraction);
/* Sets the cell as blank, regardless of the blank_zero value */
/** Sets the cell as blank, regardless of the blank_zero value */
void gnc_price_cell_blank (PriceCell *cell);
/* determines whether 0 values are left blank or printed.
/** determines whether 0 values are left blank or printed.
* defaults to true. */
void gnc_price_cell_set_blank_zero (PriceCell *cell,
gboolean blank_zero);
/* set the printing context of the price cell */
/** set the printing context of the price cell */
void gnc_price_cell_set_print_info (PriceCell *cell,
GNCPrintAmountInfo print_info);
/* updates two cells; the deb cell if amt is negative, the credit cell
/** updates two cells; the deb cell if amt is negative, the credit cell
* if amount is positive, and makes the other cell blank. */
void gnc_price_cell_set_debt_credit_value (PriceCell *debit,
PriceCell *credit,
gnc_numeric amount);
/** @} */
#endif

View File

@ -20,26 +20,19 @@
* *
\********************************************************************/
/*
* FILE:
* quickfillcell.h
*
* FUNCTION:
* The QuickFillCell implements a text cell with quick-fill
/** @addtogroup Cell Cell
* @{
* @file quickfillcell.h
* @struct QuickFillCell
* @brief The QuickFillCell implements a text cell with quick-fill
* capabilities. By "quick fill" we mean a cell that will
* automatically sentence-complete the entry after the user
* typed a sufficient number of letters to identify a unique
* entry.
*
* On the output side, this is just a plain text cell.
*
* METHODS:
* The xaccSetQuickFillCellValue() method sets the
* current cell value to the indicated string,
* simultaneously adding the string to the quick-fill
* tree.
*
* HISTORY:
*/
/* HISTORY:
* Copyright (c) 1997, 1998 Linas Vepstas
* Copyright (c) 2000 Dave Peticolas
*/
@ -53,31 +46,31 @@
typedef struct
{
BasicCell cell;
QuickFill *qf; /* quickfill-tree handled by this cell */
QuickFillSort sort; /* determines order of strings matched.
* default is QUICKFILL_LIFO. */
char *original; /* original string entered in original case */
gboolean use_quickfill_cache; /* If TRUE, we don't own the qf */
QuickFill *qf; /** quickfill-tree handled by this cell */
QuickFillSort sort; /** determines order of strings matched.
* default is QUICKFILL_LIFO. */
char *original; /** original string entered in original case */
gboolean use_quickfill_cache; /** If TRUE, we don't own the qf */
} QuickFillCell;
BasicCell * gnc_quickfill_cell_new (void);
/** sets the current cell value to the indicated string, simultaneously adding
* the string to the quick-fill tree.
*/
void gnc_quickfill_cell_set_value (QuickFillCell *cell,
const char *value);
const char *value);
void gnc_quickfill_cell_set_sort (QuickFillCell *cell,
QuickFillSort sort);
QuickFillSort sort);
void gnc_quickfill_cell_add_completion (QuickFillCell *cell,
const char *completion);
const char *completion);
/** Lets the cell use the given shared quickfill object instead of the
* one it owns internally. The cell will not delete the shared
* quickfill upon destruction. */
void
gnc_quickfill_cell_use_quickfill_cache (QuickFillCell *cell, QuickFill *shared_qf);
/** @} */
#endif

View File

@ -20,16 +20,15 @@
* *
\********************************************************************/
/*
* FILE:
* recncell.h
*
* FUNCTION:
* The RecnCell object implements a cell handler
/** @addtogroup Cell Cell
* @{
* @file recncell.h
* @struct RecnCell
* @brief The RecnCell object implements a cell handler
* that will cycle through a series of single-character
* values when clicked upon by the mouse.
*
* HISTORY:
*/
/* HISTORY:
* Copyright (c) 1998 Linas Vepstas
* Copyright (c) 2000 Dave Peticolas
* Copyright (c) 2001 Derek Atkins
@ -49,11 +48,11 @@ typedef struct
{
BasicCell cell;
char flag; /* The actual flag value */
char flag; /** The actual flag value */
char * valid_flags; /* The list of valid flags */
char * flag_order; /* Automatic flag selection order */
char default_flag; /* Default flag for unknown user input */
char * valid_flags; /** The list of valid flags */
char * flag_order; /** Automatic flag selection order */
char default_flag; /** Default flag for unknown user input */
RecnCellStringGetter get_string;
RecnCellConfirm confirm_cb;
@ -62,27 +61,25 @@ typedef struct
BasicCell * gnc_recn_cell_new (void);
void gnc_recn_cell_set_flag (RecnCell *cell, char flag);
char gnc_recn_cell_get_flag (RecnCell *cell);
void gnc_recn_cell_set_flag (RecnCell *cell, char flag);
char gnc_recn_cell_get_flag (RecnCell *cell);
void gnc_recn_cell_set_confirm_cb (RecnCell *cell,
RecnCellConfirm confirm_cb,
gpointer data);
void gnc_recn_cell_set_confirm_cb (RecnCell *cell,
RecnCellConfirm confirm_cb,
gpointer data);
void gnc_recn_cell_set_string_getter (RecnCell *cell,
RecnCellStringGetter getter);
void gnc_recn_cell_set_string_getter (RecnCell *cell,
RecnCellStringGetter getter);
/*
* note that chars is copied into the RecnCell directly, but remains
/** note that chars is copied into the RecnCell directly, but remains
* the "property" of the caller. The caller must maintain the chars
* pointer, and the caller must setup a mechanism to 'free' the chars
* pointer. The rationale is that you may have many RecnCell objects
* that use the same set of flags -- this saves you an alloc/free for
* each cell. - warlord 2001-11-28
*/
void gnc_recn_cell_set_valid_flags (RecnCell *cell, const char *flags,
char default_flag);
void gnc_recn_cell_set_flag_order (RecnCell *cell, const char *flags);
void gnc_recn_cell_set_valid_flags (RecnCell *cell, const char *flags,
char default_flag);
void gnc_recn_cell_set_flag_order (RecnCell *cell, const char *flags);
/** @} */
#endif

View File

@ -79,7 +79,7 @@ void gnc_register_add_cell_type (const char *cell_type_name,
BasicCell * gnc_register_make_cell (const char *cell_type_name);
/* The VirtualCellLocation structure contains the virtual
/** The VirtualCellLocation structure contains the virtual
* location of a virtual cell.
*/
typedef struct _VirtualCellLocation VirtualCellLocation;
@ -94,7 +94,7 @@ gboolean virt_cell_loc_equal (VirtualCellLocation vcl1,
VirtualCellLocation vcl2);
/* The VirtualLocation structure contains the virtual
/** The VirtualLocation structure contains the virtual
* location of a physical cell.
*
* There is one instance of Locator for each physical cell.

View File

@ -19,15 +19,39 @@
* Boston, MA 02110-1301, USA gnu@gnu.org *
* *
\********************************************************************/
/** @addtogroup GUI
* @{
*/
/** @addtogroup Register Registers, Ledgers and Journals
* @{
*/
/** @addtogroup RegisterCore Register Core
* @{
*/
/** @addtogroup Table Table
* @brief The "Table" is a displayed matrix. The table
* is a complex object; it is @b not merely a @ref Cellblock. The table provides
* all of the GUI infrastructure for displaying a row-column matrix of strings.
*
* The table provides one very important function for minimizing memory usage
* for large matrixes - the notion of a "Cursor". The cursor is a @ref Cellblock
* (an array of active cells) that is moved to the location that the user is
* currently editing. The cursor "virtualizes" @ref Cell functions; that is, it
* makes it seem to the user as if all cells in the table are active, when in
* fact the only cell that actually needs to be active is the one that the user
* is currently editing.
*
* The table design allows multiple cursors to be defined. When a user enters a
* cell, the appropriate cursor is positioned within the table. Cursors cannot
* overlap: any given cell can be mapped to at most one cursor. Multiple-cursor
* support allows tables to be designed that have a non-uniform layout. For
* example, the multiple-cursor support can be used to define a tree structure
* of headings and sub-headings, where the layout/format of the heading is
* different from the sub-headings. A financial example is a table which lists
* splits underneath their parent transaction. This is very different from a
* checkbook register, where all entries are uniform, and can be handled with a
* single repeated cursor.
*
* Users of the table must provide a TableView object which provides an API the
* table uses to obtain information about the data it is displaying such as
* strings, colors, etc. Thus, the table represents the non-GUI portion of the
* View object in the Model-View-Controller paradigm.
* @{
*/
/** @file table-allgui.h
* @brief Declarations for the Table object
* @author Copyright (c) 1998,1999,2000 Linas Vepstas
@ -43,8 +67,6 @@
* - Tab-traversing mechanism so that operator can tab in a
* predefined order between cells.
*
* Please see src/doc/design/gnucash-design.info for additional information.
*
* This implements the gui-independent parts of the table
* infrastructure. Additional, GUI-dependent parts are implemented
* in table-gnome.c.
@ -106,15 +128,15 @@ physical row 11 virtual row 9 B
#include "table-layout.h"
#include "table-model.h"
/* The VirtualCell structure holds information about each virtual cell. */
/** holds information about each virtual cell. */
typedef struct
{
CellBlock *cellblock; /* Array of physical cells */
gpointer vcell_data; /* Used by higher-level code */
CellBlock *cellblock; /** Array of physical cells */
gpointer vcell_data; /** Used by higher-level code */
/* flags */
unsigned int visible : 1; /* visible in the GUI */
unsigned int start_primary_color : 1; /* color usage flag */
unsigned int visible : 1; /** visible in the GUI */
unsigned int start_primary_color : 1; /** color usage flag */
} VirtualCell;
typedef struct table Table;
@ -189,7 +211,7 @@ typedef enum
/* Alternative color tables to use for the register.
/** Alternative color tables to use for the register.
* The colors in this array are ordered according to the RegisterColor Enum
* Be careful to respect this order !
*/
@ -243,7 +265,7 @@ static const guint32 reg_colors_gtkrc [] =
};
/* Set the default gui handlers used by new tables. */
/** Set the default gui handlers used by new tables. */
void gnc_table_set_default_gui_handlers (TableGUIHandlers *gui_handlers);
/* Functions to create and destroy Tables. */
@ -273,8 +295,8 @@ gboolean gnc_table_get_current_cell_location (Table *table,
VirtualLocation *virt_loc);
/* This function checks the given location and returns true
* if it is out of bounds of the table. */
/** checks the given location and returns true if it is out of bounds of the
* table. */
gboolean gnc_table_virtual_cell_out_of_bounds (Table *table,
VirtualCellLocation vcell_loc);
@ -282,9 +304,8 @@ gboolean gnc_table_virtual_location_in_header (Table *table,
VirtualLocation virt_loc);
/* This function returns the virtual cell associated with a particular
* virtual location. If the location is out of bounds, NULL is *
* returned. */
/** returns the virtual cell associated with a particular virtual location. If
* the location is out of bounds, NULL is * returned. */
VirtualCell * gnc_table_get_virtual_cell (Table *table,
VirtualCellLocation vcell_loc);
@ -326,88 +347,84 @@ gboolean gnc_table_get_cell_location (Table *table,
void gnc_table_save_cells (Table *table, gpointer save_data);
/* Return the virtual cell of the header */
/** Return the virtual cell of the header */
VirtualCell * gnc_table_get_header_cell (Table *table);
/* The gnc_table_set_size() method will resize the table to the
/** The gnc_table_set_size() method will resize the table to the
* indicated dimensions. */
void gnc_table_set_size (Table * table, int virt_rows, int virt_cols);
/* Indicate what handler should be used for a given virtual block */
/** Indicate what handler should be used for a given virtual block */
void gnc_table_set_vcell (Table *table, CellBlock *cursor,
gconstpointer vcell_data,
gboolean visible,
gboolean start_primary_color,
VirtualCellLocation vcell_loc);
/* Set the virtual cell data for a particular location. */
/** Set the virtual cell data for a particular location. */
void gnc_table_set_virt_cell_data (Table *table,
VirtualCellLocation vcell_loc,
gconstpointer vcell_data);
/* Set the visibility flag for a particular location. */
/** Set the visibility flag for a particular location. */
void gnc_table_set_virt_cell_visible (Table *table,
VirtualCellLocation vcell_loc,
gboolean visible);
/* Set the cellblock handler for a virtual cell. */
/** Set the cellblock handler for a virtual cell. */
void gnc_table_set_virt_cell_cursor (Table *table,
VirtualCellLocation vcell_loc,
CellBlock *cursor);
/* The gnc_table_move_cursor() method will move the cursor (but not
* the cursor GUI) to the indicated location. This function is
* useful when loading the table from the cursor: data can be loaded
* into the cursor, then committed to the table, all without the
* annoying screen flashing associated with GUI redraw. */
/** will move the cursor (but not the cursor GUI) to the indicated
* location. This function is useful when loading the table from the cursor:
* data can be loaded into the cursor, then committed to the table, all
* without the annoying screen flashing associated with GUI redraw. */
void gnc_table_move_cursor (Table *table, VirtualLocation virt_loc);
/* The gnc_table_move_cursor_gui() method will move the cursor and its
* GUI to the indicated location. Through a series of callbacks, all
* GUI elements get repositioned. */
/** will move the cursor and its GUI to the indicated location. Through a series
* of callbacks, all GUI elements get repositioned. */
void gnc_table_move_cursor_gui (Table *table, VirtualLocation virt_loc);
/* The gnc_table_verify_cursor_position() method checks the location
* of the cursor with respect to a virtual location position, and if
* the resulting virtual location has changed, repositions the
* cursor and gui to the new position. Returns true if the cell
* cursor was repositioned. */
/** checks the location of the cursor with respect to a virtual location
* position, and if the resulting virtual location has changed, repositions
* the cursor and gui to the new position. Returns true if the cell cursor was
* repositioned. */
gboolean gnc_table_verify_cursor_position (Table *table,
VirtualLocation virt_loc);
/* The gnc_table_get_vcell_data() method returns the virtual cell data
* associated with a cursor located at the given virtual coords, or
* NULL if the coords are out of bounds. */
/** returns the virtual cell data associated with a cursor located at the given
* virtual coords, or NULL if the coords are out of bounds. */
gpointer gnc_table_get_vcell_data (Table *table,
VirtualCellLocation vcell_loc);
/* Find a close valid cell. If exact_cell is true, cells that must
* be explicitly selected by the user (as opposed to just tabbing
* into), are considered valid cells. */
/** Find a close valid cell. If exact_cell is true, cells that must
* be explicitly selected by the user (as opposed to just tabbing
* into), are considered valid cells. */
gboolean gnc_table_find_close_valid_cell (Table *table,
VirtualLocation *virt_loc,
gboolean exact_cell);
/** UI-specific functions *******************************/
/* Initialize the GUI from a table */
/** Initialize the GUI from a table */
void gnc_table_init_gui (GtkWidget *widget, gchar * state_section);
void gnc_table_realize_gui (Table *table);
/* Refresh the current cursor gui */
/** Refresh the current cursor gui */
void gnc_table_refresh_current_cursor_gui (Table * table,
gboolean do_scroll);
/* Refresh the whole GUI from the table. */
/** Refresh the whole GUI from the table. */
void gnc_table_refresh_gui (Table *table, gboolean do_scroll);
/* Try to show the whole range in the register. */
/** Try to show the whole range in the register. */
void gnc_table_show_range (Table *table,
VirtualCellLocation start_loc,
VirtualCellLocation end_loc);
/* Refresh the cursor in the given location. If do_scroll is TRUE,
/** Refresh the cursor in the given location. If do_scroll is TRUE,
* scroll the register so the location is in view. */
void gnc_table_refresh_cursor_gui (Table * table,
VirtualCellLocation vcell_loc,
@ -480,4 +497,3 @@ gboolean gnc_table_traverse_update(Table *table,
#endif /* TABLE_ALLGUI_H */
/** @} */
/** @} */
/** @} */

View File

@ -25,6 +25,10 @@
#include "register-common.h"
/** @addtogroup Table Table
* @{
* @file table-control.h
*/
typedef enum
{
GNC_TABLE_TRAVERSE_POINTER,
@ -61,4 +65,5 @@ void gnc_table_control_destroy (TableControl *control);
void gnc_table_control_allow_move (TableControl *control,
gboolean allow_move);
/** @} */
#endif

View File

@ -28,7 +28,10 @@
#include "basiccell.h"
#include "cellblock.h"
/** @addtogroup Table Table
* @{
* @file table-layout.h
*/
/** Standard Cursor Names ********************************************/
#define CURSOR_HEADER "cursor-header"
@ -79,5 +82,5 @@ void gnc_table_layout_save_cursor (TableLayout *layout,
void gnc_table_layout_restore_cursor (TableLayout *layout,
CellBlock *cursor,
CursorBuffer *buffer);
/** @} */
#endif

View File

@ -30,6 +30,10 @@
#include "basiccell.h"
#include "register-common.h"
/** @addtogroup Table Table
* @{
* @file table-model.h
*/
typedef enum
{
XACC_CELL_ALLOW_NONE = 0,
@ -246,5 +250,5 @@ TableSaveHandler gnc_table_model_get_pre_save_handler
(TableModel *model);
TableSaveHandler gnc_table_model_get_post_save_handler
(TableModel *model);
/** @} */
#endif

View File

@ -17,15 +17,18 @@
* Boston, MA 02110-1301, USA gnu@gnu.org *
* *
\********************************************************************/
/* formulacell-gnome.h
*
* Implements gnome dependent formula cell functions.
/** @ingroup Register
* @{
* @addtogroup Gnome
* @{
*/
/** @file formulacell-gnome.h
* @brief Implements gnome dependent formula cell functions.
*/
#ifndef FORMULACELL_GNOME_H
#define FORMULACELL_GNOME_H
BasicCell * gnc_formula_cell_gnome_new( void );
/** @} */
#endif /* !FORMULACELL_GNOME_H */

View File

@ -25,9 +25,16 @@
#include <gdk/gdk.h>
/** @ingroup Register
* @addtogroup Gnome
* @{
*/
/** @file gnucash-color.h
* @brief Wrap GdkColor for use in Register Gnome classes.
*/
void gnucash_color_init (void);
/* Return the pixel value for the given red, green and blue */
/** Return the pixel value for the given red, green and blue */
gulong gnucash_color_alloc (gushort red, gushort green, gushort blue);
void gnucash_color_alloc_name (const char *name, GdkColor *color);
void gnucash_color_alloc_gdk (GdkColor *color);
@ -35,5 +42,5 @@ GdkColor *gnucash_color_argb_to_gdk (guint32 argb);
extern GdkColor gn_white, gn_light_gray, gn_dark_gray;
extern GdkColor gn_black, gn_blue, gn_red, gn_yellow;
/** @} */
#endif /* GNUCASH_COLOR_H */

View File

@ -25,7 +25,13 @@
#include "gnucash-sheet.h"
#include <libgnomecanvas/libgnomecanvas.h>
/** @ingroup Register
* @addtogroup Gnome
* @{
*/
/** @file gnucash-cursor.h
* @brief Public declarations for GnucashCursor class
*/
#define GNUCASH_TYPE_CURSOR (gnucash_cursor_get_type ())
#define GNUCASH_CURSOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNUCASH_TYPE_CURSOR, GnucashCursor))
#define GNUCASH_CURSOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GNUCASH_TYPE_CURSOR, GnucashCursorClass))
@ -103,7 +109,5 @@ void gnucash_cursor_set_style (GnucashCursor *cursor, SheetBlockStyle *style);
void gnucash_cursor_configure (GnucashCursor *cursor);
/** @} */
#endif /* GNUCASH_CURSOR_H */

View File

@ -24,7 +24,13 @@
#define GNUCASH_DATE_PICKER_H
#include <libgnomecanvas/libgnomecanvas.h>
/** @ingroup Register
* @addtogroup Gnome
* @{
*/
/** @file gnucash-date-picker.h
* @brief Public declarations for GncDatePicker class
*/
#define GNC_DATE_PICKER(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), gnc_date_picker_get_type (), GNCDatePicker)
#define GNC_DATE_PICKER_CLASS(k) G_TYPE_CHECK_CLASS_CAST((k), gnc_date_picker_get_type (), GNCDatePickerClass)
#define IS_GNC_DATE_PICKER(o) G_TYPE_CHECK_INSTANCE_TYPE((o), gnc_date_picker_get_type ())
@ -62,5 +68,5 @@ typedef struct
} GNCDatePickerClass;
/** @} */
#endif /* GNUCASH_DATE_PICKER_H */

View File

@ -24,6 +24,13 @@
#include "table-allgui.h"
#include "gnucash-sheet.h"
/** @ingroup Register
* @addtogroup Gnome
* @{
*/
/** @file gnucash-grid.h
* @brief GnucashGrid declarations
*/
#define GNUCASH_TYPE_GRID (gnucash_grid_get_type ())
#define GNUCASH_GRID(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GNUCASH_TYPE_GRID, GnucashGrid))
@ -42,7 +49,5 @@ gboolean gnucash_grid_find_loc_by_pixel (GnucashGrid *grid, gint x, gint y,
void gnucash_draw_hatching (GdkDrawable *drawable, GdkGC *gc,
int x, int y, int width, int height);
/** @} */
#endif /* GNUCASH_GRID_H */

View File

@ -21,7 +21,13 @@
#ifndef GNUCASH_HEADER_H
#define GNUCASH_HEADER_H
/** @ingroup Register
* @addtogroup Gnome
* @{
*/
/** @file gnucash-header.h
* @brief Public declarations for GnucashHeader class
*/
#define GNC_TYPE_HEADER (gnc_header_get_type ())
#define GNC_HEADER(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GNC_TYPE_HEADER, GncHeader))
#define GNC_HEADER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GNC_TYPE_HEADER, GncHeaderClass))
@ -68,6 +74,5 @@ void gnc_header_request_redraw (GncHeader *header);
void gnc_header_set_header_rows (GncHeader *header,
int num_phys_rows);
/** @} */
#endif /* GNUCASH_HEADER_H */

View File

@ -25,7 +25,13 @@
#include "gnucash-date-picker.h"
#include "gnucash-item-list.h"
#include "gnucash-sheet.h"
/** @ingroup Register
* @addtogroup Gnome
* @{
*/
/** @file gnucash-item-edit.h
* @brief Public declarations for GncItemEdit class
*/
#define GNC_TYPE_ITEM_EDIT (gnc_item_edit_get_type ())
#define GNC_ITEM_EDIT(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GNC_TYPE_ITEM_EDIT, GncItemEdit))
#define GNC_ITEM_EDIT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GNC_TYPE_ITEM_EDIT, GncItemEditClass))
@ -154,7 +160,5 @@ void gnc_item_edit_focus_in (GncItemEdit *item_edit);
void gnc_item_edit_focus_out (GncItemEdit *item_edit);
void gnc_item_edit_reset_offset (GncItemEdit *item_edit);
/** @} */
#endif /* GNUCASH_ITEM_EDIT_H */

View File

@ -24,7 +24,13 @@
#define GNUCASH_ITEM_LIST_H
#include <libgnomecanvas/libgnomecanvas.h>
/** @ingroup Register
* @addtogroup Gnome
* @{
*/
/** @file gnucash-item-list.h
* @brief Public Declarations for GncItemList class
*/
#define GNC_TYPE_ITEM_LIST (gnc_item_list_get_type ())
#define GNC_ITEM_LIST(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GNC_TYPE_ITEM_LIST, GncItemList))
#define GNC_ITEM_LIST_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GNC_TYPE_ITEM_LIST, GncItemListClass))
@ -79,7 +85,5 @@ void gnc_item_list_show_selected (GncItemList *item_list);
int gnc_item_list_autosize (GncItemList *item_list);
/** @} */
#endif /* GNUCASH_ITEM_LIST_H */

View File

@ -25,7 +25,14 @@
#define GNC_SCROLLED_WINDOW_H
#include <gtk/gtk.h>
/** @ingroup Register
* @addtogroup Gnome
* @{
* @brief Gtk+-2 widgets for displaying SplitRegister components.
*/
/** @file gnucash-scrolled-window.h
* @brief Public declarations for GncScrolledWindow class
*/
G_BEGIN_DECLS
#define GNC_TYPE_SCROLLED_WINDOW (gnc_scrolled_window_get_type ())
@ -50,5 +57,5 @@ GType gnc_scrolled_window_get_type (void);
GtkWidget *gnc_scrolled_window_new (void);
G_END_DECLS
/** @} */
#endif /* GNC_SCROLLED_WINDOW_H */

View File

@ -25,6 +25,13 @@
#include <gtk/gtk.h>
#include "split-register-model.h"
#include "table-allgui.h"
/** @ingroup Register
* @addtogroup Gnome
* @{
*/
/** @file gnucash-sheet.h
* @brief Public declarations of GnucashSheet class.
*/
#define CELL_VPADDING 2
#define CELL_HPADDING 5
@ -51,13 +58,13 @@ typedef struct _GnucashRegisterClass GnucashRegisterClass;
typedef struct
{
/* The style for this block */
/** The style for this block */
SheetBlockStyle *style;
gint origin_x; /* x origin of block */
gint origin_y; /* y origin of block */
gint origin_x; /** x origin of block */
gint origin_y; /** y origin of block */
gboolean visible; /* is block visible */
gboolean visible; /** is block visible */
} SheetBlock;
@ -70,7 +77,7 @@ void gnucash_sheet_recompute_block_offsets (GnucashSheet *sheet);
GType gnucash_register_get_type (void);
/* this already has scrollbars attached */
/** this already has scrollbars attached */
GtkWidget *gnucash_register_new (Table *table);
SheetBlock *gnucash_sheet_get_block (GnucashSheet *sheet,
@ -140,6 +147,5 @@ void gnucash_register_set_moved_cb (GnucashRegister *reg,
GnucashSheet *gnucash_register_get_sheet (GnucashRegister *reg);
GdkColor *get_gtkrc_color (GnucashSheet *sheet, RegisterColor field_type);
/** @} */
#endif

View File

@ -26,8 +26,13 @@
#include "gnucash-item-edit.h"
#include <libgnomecanvas/libgnomecanvas.h>
/** Type Definitions ***************************************************/
/** @ingroup Register
* @addtogroup Gnome
* @{
*/
/** @file gnucash-sheetP.h
* @brief Private declarations for GnucashSheet class.
*/
struct _GnucashSheet
{
@ -101,11 +106,11 @@ struct _GnucashSheet
/* IMContext */
GtkIMContext *im_context;
gint preedit_length; /* num of bytes */
gint preedit_char_length; /* num of chars in UTF-8 */
gint preedit_start_position; /* save preedit start position *
gint preedit_length; /** num of bytes */
gint preedit_char_length; /** num of chars in UTF-8 */
gint preedit_start_position; /** save preedit start position *
* combined with selection start */
gint preedit_cursor_position; /* save preedit cursor position */
gint preedit_cursor_position; /** save preedit cursor position */
gint preedit_selection_length;
PangoAttrList *preedit_attrs;
gboolean need_im_reset;
@ -149,12 +154,10 @@ struct _GnucashRegisterClass
};
/** Accessor functions *************************************************/
GncItemEdit *gnucash_sheet_get_item_edit (GnucashSheet *sheet);
//Table *gnucash_sheet_get_table (GnucashSheet *sheet);
//gint gnucash_sheet_get_num_virt_rows (GnucashSheet *sheet);
//gint gnucash_sheet_get_num_virt_cols (GnucashSheet *sheet);
/** @} */
#endif

View File

@ -22,7 +22,13 @@
#define GNUCASH_STYLE_H
#include "gnucash-sheet.h"
/** @ingroup Register
* @addtogroup Gnome
* @{
*/
/** @file gnucash-style.h
* @brief Styling functions for RegisterGnome.
*/
typedef struct
{
gint pixel_height;
@ -123,7 +129,5 @@ void gnucash_sheet_get_header_widths (GnucashSheet *sheet,
GNCHeaderWidths widths);
void gnucash_sheet_set_header_widths (GnucashSheet *sheet,
GNCHeaderWidths widths);
/** @} */
#endif