GnuCash 2.4.99
split-register-p.h
00001 /********************************************************************\
00002  * split-register-p.h -- private split register declarations        *
00003  *                                                                  *
00004  * This program is free software; you can redistribute it and/or    *
00005  * modify it under the terms of the GNU General Public License as   *
00006  * published by the Free Software Foundation; either version 2 of   *
00007  * the License, or (at your option) any later version.              *
00008  *                                                                  *
00009  * This program is distributed in the hope that it will be useful,  *
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of   *
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    *
00012  * GNU General Public License for more details.                     *
00013  *                                                                  *
00014  * You should have received a copy of the GNU General Public License*
00015  * along with this program; if not, contact:                        *
00016  *                                                                  *
00017  * Free Software Foundation           Voice:  +1-617-542-5942       *
00018  * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652       *
00019  * Boston, MA  02110-1301,  USA       gnu@gnu.org                   *
00020  *                                                                  *
00021 \********************************************************************/
00022 
00023 #ifndef SPLIT_REGISTER_P_H
00024 #define SPLIT_REGISTER_P_H
00025 
00026 #include "split-register.h"
00027 
00028 
00029 #define SPLIT_TRANS_STR _("-- Split Transaction --")
00030 #define STOCK_SPLIT_STR _("-- Stock Split --")
00031 
00032 #define ACTION_BUY_STR  _("Buy")
00033 #define ACTION_SELL_STR _("Sell")
00034 struct sr_info
00035 {
00036     /* The blank split at the bottom of the register */
00037     GncGUID blank_split_guid;
00038 
00039     /* The currently open transaction, if any */
00040     GncGUID pending_trans_guid;
00041 
00042     /* A transaction used to remember where to put the cursor */
00043     Transaction *cursor_hint_trans;
00044 
00045     /* A split used to remember where to put the cursor */
00046     Split *cursor_hint_split;
00047 
00048     /* A split used to remember where to put the cursor */
00049     Split *cursor_hint_trans_split;
00050 
00051     /* Used to remember where to put the cursor */
00052     CursorClass cursor_hint_cursor_class;
00053 
00054     /* If the hints were set by the traverse callback */
00055     gboolean hint_set_by_traverse;
00056 
00057     /* If traverse is to the newly created split */
00058     gboolean traverse_to_new;
00059 
00060     /* A flag indicating if the last traversal was 'exact'.
00061      * See table-allgui.[ch] for details. */
00062     gboolean exact_traversal;
00063 
00064     /* Indicates that the current transaction is expanded
00065      * in ledger mode. Meaningless in other modes. */
00066     gboolean trans_expanded;
00067 
00068     /* set to TRUE after register is loaded */
00069     gboolean reg_loaded;
00070 
00071     /* flag indicating whether full refresh is ok */
00072     gboolean full_refresh;
00073 
00074     /* The default account where new splits are added */
00075     GncGUID default_account;
00076 
00077     /* The last date recorded in the blank split */
00078     time_t last_date_entered;
00079 
00080     /* true if the current blank split has been edited and commited */
00081     gboolean blank_split_edited;
00082 
00083     /* true if the demarcation between 'past' and 'future' transactions
00084      * should be visible */
00085     gboolean show_present_divider;
00086 
00087     /* true if we are loading the register for the first time */
00088     gboolean first_pass;
00089 
00090     /* true if the user has already confirmed changes of a reconciled
00091      * split */
00092     gboolean change_confirmed;
00093 
00094     /* true if the exchange rate has been reset on the current split */
00095     gboolean rate_reset;
00096 
00097     /* account on the current split when the exchange rate was last set */
00098     Account *rate_account;
00099 
00100     /* User data for users of SplitRegisters */
00101     gpointer user_data;
00102 
00103     /* hook to get parent widget */
00104     SRGetParentCallback get_parent;
00105 
00106     /* flag indicating a template register */
00107     gboolean template;
00108 
00109     /* The template account which template transaction should belong to */
00110     GncGUID template_account;
00111 
00112     /* configured strings for debit/credit headers */
00113     char *debit_str;
00114     char *credit_str;
00115     char *tdebit_str;
00116     char *tcredit_str;
00117 
00118     /* true if the account separator has changed */
00119     gboolean separator_changed;
00120 };
00121 
00122 
00123 SRInfo * gnc_split_register_get_info (SplitRegister *reg);
00124 
00125 GtkWidget *gnc_split_register_get_parent (SplitRegister *reg);
00126 
00127 Split * gnc_split_register_get_split (SplitRegister *reg,
00128                                       VirtualCellLocation vcell_loc);
00129 
00130 Account * gnc_split_register_get_default_account (SplitRegister *reg);
00131 
00132 Transaction * gnc_split_register_get_trans (SplitRegister *reg,
00133         VirtualCellLocation vcell_loc);
00134 
00135 Split *
00136 gnc_split_register_get_trans_split (SplitRegister *reg,
00137                                     VirtualCellLocation vcell_loc,
00138                                     VirtualCellLocation *trans_split_loc);
00139 
00140 gboolean gnc_split_register_find_split (SplitRegister *reg,
00141                                         Transaction *trans, Split *trans_split,
00142                                         Split *split, CursorClass cursor_class,
00143                                         VirtualCellLocation *vcell_loc);
00144 
00145 void gnc_split_register_show_trans (SplitRegister *reg,
00146                                     VirtualCellLocation start_loc);
00147 
00148 // Set the visibility of the split rows belonging to a transaction located at
00149 // vcell_loc.
00150 //
00151 // If only_blank_split is TRUE, only the row used for entering an
00152 // additional split is affected. Despite the name, this should not be confused
00153 // with the "blank split" row used for entering the first split of a brand-new
00154 // transaction. Instead, here it only refers to rows not tied to any split at
00155 // all, such as those created for entering new splits on old transactions or
00156 // the 2nd through nth split on brand-new transactions.
00157 void gnc_split_register_set_trans_visible (SplitRegister *reg,
00158         VirtualCellLocation vcell_loc,
00159         gboolean visible,
00160         gboolean only_blank_split);
00161 
00162 void gnc_split_register_set_cell_fractions (SplitRegister *reg, Split *split);
00163 
00164 CellBlock * gnc_split_register_get_passive_cursor (SplitRegister *reg);
00165 CellBlock * gnc_split_register_get_active_cursor (SplitRegister *reg);
00166 
00167 void gnc_split_register_set_last_num (SplitRegister *reg, const char *num);
00168 
00169 Account * gnc_split_register_get_account_by_name(
00170     SplitRegister *reg, BasicCell * cell, const char *name);
00171 Account * gnc_split_register_get_account (SplitRegister *reg,
00172         const char *cell_name);
00173 
00174 gboolean gnc_split_register_recn_cell_confirm (char old_flag, gpointer data);
00175 
00176 gboolean gnc_split_register_check_cell (SplitRegister *reg,
00177                                         const char *cell_name);
00178 
00179 CursorClass gnc_split_register_cursor_name_to_class (const char *cursor_name);
00180 
00181 gnc_numeric gnc_split_register_debcred_cell_value (SplitRegister *reg);
00182 
00183 /* Determine if we need to perform any conversion on the splits in this
00184  * transaction, and if so, what conversion we need
00185  */
00186 gboolean gnc_split_reg_has_rate_cell (SplitRegisterType type);
00187 gboolean gnc_split_register_split_needs_amount(
00188     SplitRegister *reg, Split *split);
00189 gboolean gnc_split_register_needs_conv_rate(
00190     SplitRegister *reg, Transaction *txn, Account *acc);
00191 
00192 #endif
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines