GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
split-register-p.h
1 /********************************************************************\
2  * split-register-p.h -- private split register declarations *
3  * *
4  * This program is free software; you can redistribute it and/or *
5  * modify it under the terms of the GNU General Public License as *
6  * published by the Free Software Foundation; either version 2 of *
7  * the License, or (at your option) any later version. *
8  * *
9  * This program is distributed in the hope that it will be useful, *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12  * GNU General Public License for more details. *
13  * *
14  * You should have received a copy of the GNU General Public License*
15  * along with this program; if not, contact: *
16  * *
17  * Free Software Foundation Voice: +1-617-542-5942 *
18  * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
19  * Boston, MA 02110-1301, USA [email protected] *
20  * *
21 \********************************************************************/
22 
23 #ifndef SPLIT_REGISTER_P_H
24 #define SPLIT_REGISTER_P_H
25 
26 #include "split-register.h"
27 
28 
29 #define SPLIT_TRANS_STR _("-- Split Transaction --")
30 #define STOCK_SPLIT_STR _("-- Stock Split --")
31 
32 #define ACTION_BUY_STR _("Buy")
33 #define ACTION_SELL_STR _("Sell")
34 
35 typedef enum {
36  RATE_RESET_NOT_REQD = 0,
37  RATE_RESET_REQD = 1,
38  RATE_RESET_DONE = 2
39 } RateReset_t;
40 
41 struct sr_info
42 {
43  /* The blank split at the bottom of the register */
44  GncGUID blank_split_guid;
45 
46  /* The currently open transaction, if any */
47  GncGUID pending_trans_guid;
48 
49  /* A transaction used to remember where to put the cursor */
50  Transaction *cursor_hint_trans;
51 
52  /* A split used to remember where to put the cursor */
53  Split *cursor_hint_split;
54 
55  /* A split used to remember where to put the cursor */
56  Split *cursor_hint_trans_split;
57 
58  /* Used to remember where to put the cursor */
59  CursorClass cursor_hint_cursor_class;
60 
61  /* If the hints were set by the traverse callback */
62  gboolean hint_set_by_traverse;
63 
64  /* If traverse is to the newly created split */
65  gboolean traverse_to_new;
66 
67  /* A flag indicating if the last traversal was 'exact'.
68  * See table-allgui.[ch] for details. */
69  gboolean exact_traversal;
70 
71  /* Indicates that the current transaction is expanded
72  * in ledger mode. Meaningless in other modes. */
73  gboolean trans_expanded;
74 
75  /* set to TRUE after register is loaded */
76  gboolean reg_loaded;
77 
78  /* flag indicating whether full refresh is ok */
79  gboolean full_refresh;
80 
81  /* The default account where new splits are added */
82  GncGUID default_account;
83 
84  /* The last date recorded in the blank split */
85  time64 last_date_entered;
86 
87  /* true if the current blank split has been edited and commited */
88  gboolean blank_split_edited;
89 
90  /* true if the demarcation between 'past' and 'future' transactions
91  * should be visible */
92  gboolean show_present_divider;
93 
94  /* true if we are loading the register for the first time */
95  gboolean first_pass;
96 
97  /* true if the user has already confirmed changes of a reconciled
98  * split */
99  gboolean change_confirmed;
100 
101  /* RATE_RESET_NOT_REQD => No exchange rate dialog needed for current split
102  * RATE_RESET_REQD => Need new exchange rate for current split
103  * RATE_RESET_DONE => Already got a new exchange rate for current split
104  */
105  RateReset_t rate_reset;
106 
107  /* true if the transaction being edited was auto-filled */
108  gboolean auto_complete;
109 
110  /* account on the current split when the exchange rate was last set */
111  Account *rate_account;
112 
113  /* User data for users of SplitRegisters */
114  gpointer user_data;
115 
116  /* hook to get parent widget */
117  SRGetParentCallback get_parent;
118 
119  /* The template account which template transaction should belong to */
120  GncGUID template_account;
121 
122  /* configured strings for debit/credit headers */
123  char *debit_str;
124  char *credit_str;
125  char *tdebit_str;
126  char *tcredit_str;
127 
128  /* true if the account separator has changed */
129  gboolean separator_changed;
130 };
131 
132 
133 SRInfo * gnc_split_register_get_info (SplitRegister *reg);
134 
135 GtkWidget *gnc_split_register_get_parent (SplitRegister *reg);
136 
137 Split * gnc_split_register_get_split (SplitRegister *reg,
138  VirtualCellLocation vcell_loc);
139 
140 Account * gnc_split_register_get_default_account (SplitRegister *reg);
141 
142 Transaction * gnc_split_register_get_trans (SplitRegister *reg,
143  VirtualCellLocation vcell_loc);
144 
145 Split *
146 gnc_split_register_get_trans_split (SplitRegister *reg,
147  VirtualCellLocation vcell_loc,
148  VirtualCellLocation *trans_split_loc);
149 
150 gboolean gnc_split_register_find_split (SplitRegister *reg,
151  Transaction *trans, Split *trans_split,
152  Split *split, CursorClass cursor_class,
153  VirtualCellLocation *vcell_loc);
154 
155 void gnc_split_register_show_trans (SplitRegister *reg,
156  VirtualCellLocation start_loc);
157 
158 // Set the visibility of the split rows belonging to a transaction located at
159 // vcell_loc.
160 //
161 // If only_blank_split is TRUE, only the row used for entering an
162 // additional split is affected. Despite the name, this should not be confused
163 // with the "blank split" row used for entering the first split of a brand-new
164 // transaction. Instead, here it only refers to rows not tied to any split at
165 // all, such as those created for entering new splits on old transactions or
166 // the 2nd through nth split on brand-new transactions.
167 void gnc_split_register_set_trans_visible (SplitRegister *reg,
168  VirtualCellLocation vcell_loc,
169  gboolean visible,
170  gboolean only_blank_split);
171 
172 void gnc_split_register_set_cell_fractions (SplitRegister *reg, Split *split);
173 
174 CellBlock * gnc_split_register_get_passive_cursor (SplitRegister *reg);
175 CellBlock * gnc_split_register_get_active_cursor (SplitRegister *reg);
176 
177 void gnc_split_register_set_last_num (SplitRegister *reg, const char *num);
178 
179 Account * gnc_split_register_get_account_by_name(
180  SplitRegister *reg, BasicCell * cell, const char *name);
181 Account * gnc_split_register_get_account (SplitRegister *reg,
182  const char *cell_name);
183 
184 gboolean gnc_split_register_recn_cell_confirm (char old_flag, gpointer data);
185 
186 gboolean gnc_split_register_check_cell (SplitRegister *reg,
187  const char *cell_name);
188 
189 CursorClass gnc_split_register_cursor_name_to_class (const char *cursor_name);
190 
191 gnc_numeric gnc_split_register_debcred_cell_value (SplitRegister *reg);
192 
193 /* Determine if we need to perform any conversion on the splits in this
194  * transaction, and if so, what conversion we need
195  */
196 gboolean gnc_split_reg_has_rate_cell (SplitRegisterType type);
197 gboolean gnc_split_register_split_needs_amount(
198  SplitRegister *reg, Split *split);
199 gboolean gnc_split_register_needs_conv_rate(
200  SplitRegister *reg, Transaction *txn, Account *acc);
201 
202 #endif
The type, style and table for the register.
SplitRegisterType
Register types.
Definition: guid.h:65
GtkWidget *(* SRGetParentCallback)(gpointer user_data)
API for checkbook register display area.
CursorClass
Definition: SplitP.h:71
gint64 time64
Definition: gnc-date.h:83