gnucash maint: Multiple changes pushed
John Ralls
jralls at code.gnucash.org
Tue Oct 13 20:19:05 EDT 2015
Updated via https://github.com/Gnucash/gnucash/commit/0e229ec4 (commit)
via https://github.com/Gnucash/gnucash/commit/afad45ea (commit)
via https://github.com/Gnucash/gnucash/commit/f94522a5 (commit)
via https://github.com/Gnucash/gnucash/commit/61973a83 (commit)
via https://github.com/Gnucash/gnucash/commit/734ecce3 (commit)
from https://github.com/Gnucash/gnucash/commit/0baf078b (commit)
commit 0e229ec48c3c5e9a9bbdc899ffe644969e80c5a9
Author: John Ralls <jralls at ceridwen.us>
Date: Tue Oct 13 17:18:12 2015 -0700
Add messages.mo to gitignore.
diff --git a/.gitignore b/.gitignore
index a7551c8..3b294c1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -255,3 +255,4 @@ DerivedData/
*.mode2v3
*.perspectivev3
xcuserdata/
+messages.mo
commit afad45ea3c3166667e818281ba8bd1aeb14e9228
Author: John Ralls <jralls at ceridwen.us>
Date: Tue Oct 13 17:17:24 2015 -0700
Add all register classes and such to Doxygen documentation.
Ensuring that the relevant information from src/doc/design is included.
diff --git a/src/gnome/gnc-plugin-page-register.c b/src/gnome/gnc-plugin-page-register.c
index 269cb90..5ad77b0 100644
--- a/src/gnome/gnc-plugin-page-register.c
+++ b/src/gnome/gnc-plugin-page-register.c
@@ -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)
diff --git a/src/register/ledger-core/gnc-ledger-display.h b/src/register/ledger-core/gnc-ledger-display.h
index a66bef3..743df08 100644
--- a/src/register/ledger-core/gnc-ledger-display.h
+++ b/src/register/ledger-core/gnc-ledger-display.h
@@ -33,10 +33,15 @@
#include "SchedXaction.h"
#include "Transaction.h"
-
-/** Definitions *****************************************************/
-
-/* The GNCLedgerDisplay struct describes a single register/ledger
+/** @ingroup Register
+ * @addtogroup Gnome
+ * @{
+ */
+/** @file gnc-ledger-display.h
+ * @brief Public declarations for GncLedgerDisplay class.
+ */
+
+/** @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 ledger 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 ledger 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);
diff --git a/src/register/ledger-core/split-register-control.c b/src/register/ledger-core/split-register-control.c
index b4b1d04..793c956 100644
--- a/src/register/ledger-core/split-register-control.c
+++ b/src/register/ledger-core/split-register-control.c
@@ -1287,8 +1287,8 @@ gnc_split_register_xfer_dialog(SplitRegister *reg, Transaction *txn,
return xfer;
}
-/** Check 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
diff --git a/src/register/ledger-core/split-register-control.h b/src/register/ledger-core/split-register-control.h
index d1bd6ef..fd23b27 100644
--- a/src/register/ledger-core/split-register-control.h
+++ b/src/register/ledger-core/split-register-control.h
@@ -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
diff --git a/src/register/ledger-core/split-register-model-save.h b/src/register/ledger-core/split-register-model-save.h
index df2f5ae..e0dd411 100644
--- a/src/register/ledger-core/split-register-model-save.h
+++ b/src/register/ledger-core/split-register-model-save.h
@@ -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
diff --git a/src/register/ledger-core/split-register-model.h b/src/register/ledger-core/split-register-model.h
index 1f264c4..1dee393 100644
--- a/src/register/ledger-core/split-register-model.h
+++ b/src/register/ledger-core/split-register-model.h
@@ -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
diff --git a/src/register/ledger-core/split-register-p.h b/src/register/ledger-core/split-register-p.h
index 0f107ff..9822e00 100644
--- a/src/register/ledger-core/split-register-p.h
+++ b/src/register/ledger-core/split-register-p.h
@@ -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
diff --git a/src/register/ledger-core/split-register.h b/src/register/ledger-core/split-register.h
index 6c7cd44..013d572 100644
--- a/src/register/ledger-core/split-register.h
+++ b/src/register/ledger-core/split-register.h
@@ -19,6 +19,14 @@
* Boston, MA 02110-1301, USA gnu at 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.
- *
- * @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.
- *
- * 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.
- *
- * @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.
- *
+ * 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.)
+ *
+ * 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.
+ *
+ * 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.
+ * @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.
- *
- * 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.
+ *
+ * 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.
*
* @{
*/
@@ -135,15 +137,6 @@
* @brief API for checkbook register display area
* @author Copyright (C) 1998-2000 Linas Vepstas <linas at 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 */
diff --git a/src/register/register-core/basiccell.h b/src/register/register-core/basiccell.h
index 6f287e8..eae9420 100644
--- a/src/register/register-core/basiccell.h
+++ b/src/register/register-core/basiccell.h
@@ -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 at 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 */
-
- /* general hook for gui-private data */
- gpointer gui_private;
+ 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 */
+
+ 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 */
diff --git a/src/register/register-core/cell-factory.h b/src/register/register-core/cell-factory.h
index fa140f3..278ca77 100644
--- a/src/register/register-core/cell-factory.h
+++ b/src/register/register-core/cell-factory.h
@@ -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
diff --git a/src/register/register-core/cellblock.h b/src/register/register-core/cellblock.h
index 345d88a..6a276b9 100644
--- a/src/register/register-core/cellblock.h
+++ b/src/register/register-core/cellblock.h
@@ -19,14 +19,18 @@
* Boston, MA 02110-1301, USA gnu at 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
@@ -99,4 +103,3 @@ void gnc_cellblock_clear_changes (CellBlock *cursor);
#endif
/** @} */
/** @} */
-/** @} */
diff --git a/src/register/register-core/checkboxcell.h b/src/register/register-core/checkboxcell.h
index fae3020..20673d8 100644
--- a/src/register/register-core/checkboxcell.h
+++ b/src/register/register-core/checkboxcell.h
@@ -19,13 +19,11 @@
* Boston, MA 02110-1301, USA gnu at 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
diff --git a/src/register/register-core/combocell.h b/src/register/register-core/combocell.h
index 1490b55..e04171b 100644
--- a/src/register/register-core/combocell.h
+++ b/src/register/register-core/combocell.h
@@ -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
diff --git a/src/register/register-core/datecell.h b/src/register/register-core/datecell.h
index 0593560..0f72b58 100644
--- a/src/register/register-core/datecell.h
+++ b/src/register/register-core/datecell.h
@@ -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 at 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
diff --git a/src/register/register-core/formulacell.h b/src/register/register-core/formulacell.h
index 1d2a242..058e006 100644
--- a/src/register/register-core/formulacell.h
+++ b/src/register/register-core/formulacell.h
@@ -19,18 +19,15 @@
* Boston, MA 02110-1301, USA gnu at 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 at asynchronous.org>
- **/
+ */
+ /* Copyright (c) 2002 Joshua Sled <jsled at 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 ---------------------- */
-
diff --git a/src/register/register-core/gtable.h b/src/register/register-core/gtable.h
index e74f10b..b46e149 100644
--- a/src/register/register-core/gtable.h
+++ b/src/register/register-core/gtable.h
@@ -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
diff --git a/src/register/register-core/numcell.h b/src/register/register-core/numcell.h
index b25fd0d..dd62d3f 100644
--- a/src/register/register-core/numcell.h
+++ b/src/register/register-core/numcell.h
@@ -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 at 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
diff --git a/src/register/register-core/pricecell.h b/src/register/register-core/pricecell.h
index 10c4bb2..47025ec 100644
--- a/src/register/register-core/pricecell.h
+++ b/src/register/register-core/pricecell.h
@@ -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 at 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
diff --git a/src/register/register-core/quickfillcell.h b/src/register/register-core/quickfillcell.h
index e5e8023..71cfebd 100644
--- a/src/register/register-core/quickfillcell.h
+++ b/src/register/register-core/quickfillcell.h
@@ -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
diff --git a/src/register/register-core/recncell.h b/src/register/register-core/recncell.h
index 27b6ba7..7017b9c 100644
--- a/src/register/register-core/recncell.h
+++ b/src/register/register-core/recncell.h
@@ -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
-
diff --git a/src/register/register-core/register-common.h b/src/register/register-core/register-common.h
index adbf3f0..6d1990a 100644
--- a/src/register/register-core/register-common.h
+++ b/src/register/register-core/register-common.h
@@ -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.
diff --git a/src/register/register-core/table-allgui.h b/src/register/register-core/table-allgui.h
index 2738738..d96c8fc 100644
--- a/src/register/register-core/table-allgui.h
+++ b/src/register/register-core/table-allgui.h
@@ -19,15 +19,39 @@
* Boston, MA 02110-1301, USA gnu at 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 */
/** @} */
/** @} */
-/** @} */
diff --git a/src/register/register-core/table-control.h b/src/register/register-core/table-control.h
index 75be76f..2600915 100644
--- a/src/register/register-core/table-control.h
+++ b/src/register/register-core/table-control.h
@@ -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
diff --git a/src/register/register-core/table-layout.h b/src/register/register-core/table-layout.h
index 7f69aff..80a45d5 100644
--- a/src/register/register-core/table-layout.h
+++ b/src/register/register-core/table-layout.h
@@ -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
diff --git a/src/register/register-core/table-model.h b/src/register/register-core/table-model.h
index b36d930..502474f 100644
--- a/src/register/register-core/table-model.h
+++ b/src/register/register-core/table-model.h
@@ -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,
@@ -243,5 +247,5 @@ TableSaveHandler gnc_table_model_get_pre_save_handler
(TableModel *model);
TableSaveHandler gnc_table_model_get_post_save_handler
(TableModel *model);
-
+/** @} */
#endif
diff --git a/src/register/register-gnome/formulacell-gnome.h b/src/register/register-gnome/formulacell-gnome.h
index 91e0591..45563b2 100644
--- a/src/register/register-gnome/formulacell-gnome.h
+++ b/src/register/register-gnome/formulacell-gnome.h
@@ -17,15 +17,18 @@
* Boston, MA 02110-1301, USA gnu at 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 */
diff --git a/src/register/register-gnome/gnucash-color.h b/src/register/register-gnome/gnucash-color.h
index 2c54f54..dcd9f6c 100644
--- a/src/register/register-gnome/gnucash-color.h
+++ b/src/register/register-gnome/gnucash-color.h
@@ -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 */
diff --git a/src/register/register-gnome/gnucash-cursor.h b/src/register/register-gnome/gnucash-cursor.h
index e11821d..d3b1f4b 100644
--- a/src/register/register-gnome/gnucash-cursor.h
+++ b/src/register/register-gnome/gnucash-cursor.h
@@ -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 */
-
-
diff --git a/src/register/register-gnome/gnucash-date-picker.h b/src/register/register-gnome/gnucash-date-picker.h
index 563f1b6..175c000 100644
--- a/src/register/register-gnome/gnucash-date-picker.h
+++ b/src/register/register-gnome/gnucash-date-picker.h
@@ -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 */
diff --git a/src/register/register-gnome/gnucash-grid.h b/src/register/register-gnome/gnucash-grid.h
index 87d1620..8efdcdd 100644
--- a/src/register/register-gnome/gnucash-grid.h
+++ b/src/register/register-gnome/gnucash-grid.h
@@ -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 */
-
-
diff --git a/src/register/register-gnome/gnucash-header.h b/src/register/register-gnome/gnucash-header.h
index fa2091a..cb94f41 100644
--- a/src/register/register-gnome/gnucash-header.h
+++ b/src/register/register-gnome/gnucash-header.h
@@ -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 */
-
diff --git a/src/register/register-gnome/gnucash-item-edit.h b/src/register/register-gnome/gnucash-item-edit.h
index 3439bda..4c310ff 100644
--- a/src/register/register-gnome/gnucash-item-edit.h
+++ b/src/register/register-gnome/gnucash-item-edit.h
@@ -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 */
-
-
diff --git a/src/register/register-gnome/gnucash-item-list.h b/src/register/register-gnome/gnucash-item-list.h
index cae23a1..d14fb8d 100644
--- a/src/register/register-gnome/gnucash-item-list.h
+++ b/src/register/register-gnome/gnucash-item-list.h
@@ -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 */
-
-
diff --git a/src/register/register-gnome/gnucash-scrolled-window.h b/src/register/register-gnome/gnucash-scrolled-window.h
index f578096..6426f35 100644
--- a/src/register/register-gnome/gnucash-scrolled-window.h
+++ b/src/register/register-gnome/gnucash-scrolled-window.h
@@ -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 */
diff --git a/src/register/register-gnome/gnucash-sheet.h b/src/register/register-gnome/gnucash-sheet.h
index aed092a..4eea17e 100644
--- a/src/register/register-gnome/gnucash-sheet.h
+++ b/src/register/register-gnome/gnucash-sheet.h
@@ -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
-
diff --git a/src/register/register-gnome/gnucash-sheetP.h b/src/register/register-gnome/gnucash-sheetP.h
index 6b64f6e..5d355be 100644
--- a/src/register/register-gnome/gnucash-sheetP.h
+++ b/src/register/register-gnome/gnucash-sheetP.h
@@ -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
-
diff --git a/src/register/register-gnome/gnucash-style.h b/src/register/register-gnome/gnucash-style.h
index 71e1344..8b143c2 100644
--- a/src/register/register-gnome/gnucash-style.h
+++ b/src/register/register-gnome/gnucash-style.h
@@ -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
-
-
commit f94522a5678652d384fa15bff9b8bfd43f4428ce
Author: John Ralls <jralls at ceridwen.us>
Date: Tue Oct 13 17:14:51 2015 -0700
Doxygen: Silence obsolete parameter warnings and suppress private struct names.
diff --git a/src/doc/doxygen.cfg.in b/src/doc/doxygen.cfg.in
index 0907011..3c752a7 100644
--- a/src/doc/doxygen.cfg.in
+++ b/src/doc/doxygen.cfg.in
@@ -1460,18 +1460,6 @@ GENERATE_XML = NO
XML_OUTPUT = xml
-# The XML_SCHEMA tag can be used to specify an XML schema,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_SCHEMA =
-
-# The XML_DTD tag can be used to specify an XML DTD,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_DTD =
-
# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
# dump the program listings (including syntax highlighting
# and cross-referencing information) to the XML output. Note that
@@ -1856,3 +1844,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
+
commit 61973a8302aa9dc339c702d07d5dee66f79e7200
Author: John Ralls <jralls at ceridwen.us>
Date: Sun Oct 11 21:49:53 2015 -0700
Some extract-function refactors to xaccTransScrubImbalance.
diff --git a/src/engine/Scrub.c b/src/engine/Scrub.c
index 6b2b4ba..c82b353 100644
--- a/src/engine/Scrub.c
+++ b/src/engine/Scrub.c
@@ -90,7 +90,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;
@@ -232,7 +232,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)
{
@@ -321,7 +321,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)
{
@@ -336,7 +336,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)
{
@@ -390,16 +390,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");
@@ -407,9 +407,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");
@@ -417,8 +417,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");
@@ -470,7 +470,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;
@@ -509,8 +509,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);
@@ -527,253 +527,302 @@ add_balance_split (Transaction *trans, gnc_numeric imbalance,
xaccTransCommitEdit (trans);
}
-void
-xaccTransScrubImbalance (Transaction *trans, Account *root,
- Account *account)
+/* Balance a transaction without trading accounts. */
+static void
+gnc_transaction_balance_no_trading (Transaction *trans, Account *root,
+ Account *account)
{
- const gnc_commodity *currency;
-
- if (!trans) return;
-
- ENTER ("()");
+ gnc_numeric imbalance = xaccTransGetImbalanceValue (trans);
- /* Must look for orphan splits even if there is no imbalance. */
- xaccTransScrubSplits (trans);
-
- /* Return immediately if things are balanced. */
- if (xaccTransIsBalanced (trans))
+ /* Make the value sum to zero */
+ if (! gnc_numeric_zero_p (imbalance))
{
- LEAVE ("transaction is balanced");
- return;
- }
+ PINFO ("Value unbalanced transaction");
- currency = xaccTransGetCurrency (trans);
+ add_balance_split (trans, imbalance, root, account);
+ }
- if (! xaccTransUseTradingAccounts (trans))
+}
+/** 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)
{
- gnc_numeric imbalance;
+ Split *split = splits->data;
+ Split *balance_split = NULL;
+ gnc_numeric value, amount;
+ gnc_commodity *commodity, *txn_curr = xaccTransGetCurrency (trans);
- /* Make the value sum to zero */
- imbalance = xaccTransGetImbalanceValue (trans);
- if (! gnc_numeric_zero_p (imbalance))
+ if (! xaccTransStillHasSplit (trans, split)) continue;
+
+ commodity = xaccAccountGetCommodity (xaccSplitGetAccount(split));
+ if (!commodity)
{
- PINFO ("Value unbalanced transaction");
+ 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);
- add_balance_split (trans, imbalance, root, account);
+ /* 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);
+ }
}
}
- else
+ 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)
{
- MonetaryList *imbal_list;
- MonetaryList *imbalance_commod;
- GList *splits;
- gnc_numeric imbalance;
- Split *balance_split = NULL;
+ 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;
+ }
- /* 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.
+ PINFO ("Currency unbalanced transaction");
- While we're at it, compute the value imbalance ignoring existing
- trading splits. */
+ 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);
- imbalance = gnc_numeric_zero();
+ commodity = gnc_monetary_commodity (*imbal_mon);
- for (splits = trans->splits; splits; splits = splits->next)
+ balance_split = get_trading_split(trans, root, commodity);
+ if (!balance_split)
{
- Split *split = splits->data;
- gnc_numeric value, amount;
- gnc_commodity *commodity;
+ /* Error already logged */
+ gnc_monetary_list_free(imbal_list);
+ LEAVE("");
+ return;
+ }
- if (! xaccTransStillHasSplit (trans, split)) continue;
+ account = xaccSplitGetAccount(balance_split);
- commodity = xaccAccountGetCommodity (xaccSplitGetAccount(split));
- if (!commodity)
- {
- PERR("Split has no commodity");
- continue;
- }
+ if (! gnc_commodity_equal (txn_curr, commodity))
+ {
+ gnc_transaction_get_commodity_imbalance (trans, commodity);
+ }
- balance_split = find_trading_split (trans, root, commodity);
+ xaccTransBeginEdit (trans);
- if (balance_split != split)
- /* this is not a trading split */
- imbalance = gnc_numeric_add(imbalance, xaccSplitGetValue (split),
- GNC_DENOM_AUTO, GNC_HOW_DENOM_EXACT);
+ 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);
- /* 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;
+ xaccSplitSetAmount (balance_split, new_amount);
- 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);
- }
- }
+ 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);
}
-
- /* Balance the value, ignoring existing trading splits */
- if (! gnc_numeric_zero_p (imbalance))
+ else
{
- PINFO ("Value unbalanced transaction");
+ 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);
- add_balance_split (trans, imbalance, root, account);
+ xaccSplitSetValue (balance_split, new_value);
}
- /* If the transaction is balanced, nothing more to do */
- imbal_list = xaccTransGetImbalance (trans);
- if (!imbal_list)
- {
- LEAVE("transaction is balanced");
- return;
- }
+ xaccSplitScrub (balance_split);
+ xaccTransCommitEdit (trans);
+ }
- PINFO ("Currency unbalanced transaction");
+ gnc_monetary_list_free(imbal_list);
+}
- for (imbalance_commod = imbal_list; imbalance_commod;
- imbalance_commod = imbalance_commod->next)
+/** 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_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);
+ 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 */
- 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);
+ 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);
- 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);
- }
+ /* 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);
}
+ }
- gnc_monetary_list_free(imbal_list);
+ g_list_free(splits_dup);
+}
- 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);
- }
- }
+/** 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.
+ */
- g_list_free(splits_dup);
+void
+xaccTransScrubImbalance (Transaction *trans, Account *root,
+ Account *account)
+{
+ gnc_numeric imbalance;
- if (!gnc_numeric_zero_p(xaccTransGetImbalanceValue(trans)))
- PERR("Balancing currencies unbalanced value");
- }
+ if (!trans) return;
+
+ ENTER ("()");
+
+ /* Must look for orphan splits even if there is no imbalance. */
+ xaccTransScrubSplits (trans);
+
+ /* Return immediately if things are balanced. */
+ if (xaccTransIsBalanced (trans))
+ {
+ LEAVE ("transaction is balanced");
+ return;
}
- LEAVE ("()");
+
+ if (! xaccTransUseTradingAccounts (trans))
+ {
+ gnc_transaction_balance_no_trading (trans, root, account);
+ LEAVE ("transaction balanced, no trading accounts");
+ return;
+ }
+
+ imbalance = gnc_transaction_adjust_trading_splits (trans, root);
+
+ /* Balance the value, ignoring existing trading splits */
+ if (! gnc_numeric_zero_p (imbalance))
+ {
+ PINFO ("Value unbalanced transaction");
+
+ add_balance_split (trans, imbalance, root, account);
+ }
+
+ 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");
+
}
/* ================================================================ */
@@ -879,7 +928,7 @@ xaccTransFindOldCommonCurrency (Transaction *trans, QofBook *book)
if (retval && !gnc_commodity_is_currency(retval))
retval = NULL;
-
+
return retval;
}
@@ -899,7 +948,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;
@@ -911,15 +960,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;
@@ -948,14 +997,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);
@@ -1101,14 +1150,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));
- }*/
+ }*/
}
}
commit 734ecce36d02a9beeadf1cf5f7a148129f08e8d4
Author: John Ralls <jralls at ceridwen.us>
Date: Sun Oct 11 15:15:07 2015 -0700
Delete unused function gnc-_split_reg_handle_exchange_cb.
diff --git a/src/gnome/gnc-split-reg.c b/src/gnome/gnc-split-reg.c
index 0ffb765..f6219b8 100644
--- a/src/gnome/gnc-split-reg.c
+++ b/src/gnome/gnc-split-reg.c
@@ -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 );
@@ -391,7 +389,7 @@ gsr_create_table( GNCSplitReg *gsr )
gchar *state_section;
const GncGUID * guid;
Account * account;
-
+
account = gnc_ledger_display_leader(gsr->ledger);
guid = xaccAccountGetGUID(account);
state_section = g_strconcat (STATE_SECTION_REG_PREFIX, " ", (gchar*)guid_to_string (guid), NULL);
@@ -1894,7 +1892,7 @@ gnc_split_reg_sort_notes_cb(GtkWidget *w, gpointer data)
}
-void
+void
gnc_split_reg_set_sort_reversed(GNCSplitReg *gsr, gboolean rev)
{
Query *query = gnc_ledger_display_get_query( gsr->ledger );
@@ -1902,16 +1900,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)
{
diff --git a/src/register/ledger-core/split-register-control.c b/src/register/ledger-core/split-register-control.c
index 23b22fb..b4b1d04 100644
--- a/src/register/ledger-core/split-register-control.c
+++ b/src/register/ledger-core/split-register-control.c
@@ -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.
+/** Check to see if we need to determine an exchange rate.
* If we need to determine an exchange rate, then pop up the dialog.
* 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)
Summary of changes:
.gitignore | 1 +
src/doc/doxygen.cfg.in | 19 +-
src/engine/Scrub.c | 485 ++++++++++++---------
src/gnome/gnc-plugin-page-register.c | 10 +-
src/gnome/gnc-split-reg.c | 16 +-
src/register/ledger-core/gnc-ledger-display.h | 43 +-
src/register/ledger-core/split-register-control.c | 13 +-
src/register/ledger-core/split-register-control.h | 8 +-
.../ledger-core/split-register-model-save.h | 9 +-
src/register/ledger-core/split-register-model.h | 9 +-
src/register/ledger-core/split-register-p.h | 82 ++--
src/register/ledger-core/split-register.h | 174 ++++----
src/register/register-core/basiccell.h | 56 ++-
src/register/register-core/cell-factory.h | 6 +-
src/register/register-core/cellblock.h | 19 +-
src/register/register-core/checkboxcell.h | 14 +-
src/register/register-core/combocell.h | 5 +-
src/register/register-core/datecell.h | 65 +--
src/register/register-core/formulacell.h | 22 +-
src/register/register-core/gtable.h | 20 +-
src/register/register-core/numcell.h | 17 +-
src/register/register-core/pricecell.h | 48 +-
src/register/register-core/quickfillcell.h | 45 +-
src/register/register-core/recncell.h | 49 +--
src/register/register-core/register-common.h | 4 +-
src/register/register-core/table-allgui.h | 118 ++---
src/register/register-core/table-control.h | 5 +
src/register/register-core/table-layout.h | 7 +-
src/register/register-core/table-model.h | 6 +-
src/register/register-gnome/formulacell-gnome.h | 13 +-
src/register/register-gnome/gnucash-color.h | 11 +-
src/register/register-gnome/gnucash-cursor.h | 12 +-
src/register/register-gnome/gnucash-date-picker.h | 10 +-
src/register/register-gnome/gnucash-grid.h | 11 +-
src/register/register-gnome/gnucash-header.h | 11 +-
src/register/register-gnome/gnucash-item-edit.h | 12 +-
src/register/register-gnome/gnucash-item-list.h | 12 +-
.../register-gnome/gnucash-scrolled-window.h | 11 +-
src/register/register-gnome/gnucash-sheet.h | 20 +-
src/register/register-gnome/gnucash-sheetP.h | 21 +-
src/register/register-gnome/gnucash-style.h | 12 +-
41 files changed, 848 insertions(+), 683 deletions(-)
More information about the gnucash-changes
mailing list