GnuCash c935c2f+
Loading...
Searching...
No Matches
Files | Data Structures | Macros | Typedefs | Enumerations | Functions

A "Cell" is an active object which is designed to read a specific kind of user input. More...

Files

file  basiccell.h
 
file  cell-factory.h
 
file  checkboxcell.h
 
file  combocell.h
 
file  datecell.h
 
file  doclinkcell.h
 
file  formulacell.h
 
file  numcell.h
 
file  pricecell.h
 
file  quickfillcell.h
 
file  recncell.h
 

Data Structures

struct  BasicCell
 The BasicCell class provides an abstract base class defining the handling of the editing of a cell of a table. More...
 
struct  CheckboxCell
 The CheckboxCell object implements a cell handler that will toggle between yes and no values when clicked upon by the mouse. More...
 
struct  ComboCell
 The ComboCell object implements a cell handler with a "combination-box" pull-down menu in it. More...
 
struct  CompletionCell
 The CompletionCell object implements a cell handler with a "combination-box" pull-down menu in it. More...
 
struct  DateCell
 The DateCell object implements a date handling cell. More...
 
struct  Doclinkcell
 The Doclinkcell object implements a cell handler that will cycle through a series of single-character values when clicked upon by the mouse and will return a glyph if font can show it. More...
 
struct  FormulaCell
 The FormulaCell is a register-table cell which can contain a formula involving numbers, formula markup and strings denoting either functions or variables. More...
 
struct  NumCell
 The NumCell object implements a number handling cell. More...
 
struct  PriceCell
 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. More...
 
struct  QuickFillCell
 The QuickFillCell implements a text cell with quick-fill capabilities. More...
 
struct  RecnCell
 The RecnCell object implements a cell handler that will cycle through a series of single-character values when clicked upon by the mouse. More...
 

Macros

#define GLYPH_PAPERCLIP   "\360\237\223\216"
 
#define GLYPH_LINK   "\360\237\224\227"
 

Typedefs

typedef BasicCell *(* CellCreateFunc) (void)
 
typedef void(* CellSetValueFunc) (BasicCell *cell, const char *new_value)
 
typedef gboolean(* CellEnterFunc) (BasicCell *cell, int *cursor_position, int *start_selection, int *end_selection)
 
typedef void(* CellModifyVerifyFunc) (BasicCell *cell, const char *add_str, int add_str_len, const char *new_value, int new_value_len, int *cursor_position, int *start_selection, int *end_selection)
 
typedef gboolean(* CellDirectUpdateFunc) (BasicCell *cell, int *cursor_position, int *start_selection, int *end_selection, gpointer gui_data)
 
typedef void(* CellLeaveFunc) (BasicCell *cell)
 
typedef void(* CellRealizeFunc) (BasicCell *cell, gpointer gui_handle)
 
typedef void(* CellMoveFunc) (BasicCell *cell)
 
typedef void(* CellDestroyFunc) (BasicCell *cell)
 
typedef const char *(* DoclinkcellStringGetter) (char flag)
 
typedef gboolean(* DoclinkcellConfirm) (char old_flag, gpointer data)
 
typedef const char *(* RecnCellStringGetter) (char flag)
 
typedef gboolean(* RecnCellConfirm) (char old_flag, gpointer data)
 

Enumerations

enum  CellAlignment { CELL_ALIGN_RIGHT , CELL_ALIGN_CENTER , CELL_ALIGN_LEFT }
 

Functions

gboolean gnc_cell_name_equal (const char *cell_name_1, const char *cell_name_2)
 
BasicCell * gnc_basic_cell_new (void)
 
void gnc_basic_cell_init (BasicCell *bcell)
 
void gnc_basic_cell_destroy (BasicCell *bcell)
 
void gnc_basic_cell_set_name (BasicCell *cell, const char *name)
 
gboolean gnc_basic_cell_has_name (BasicCell *cell, const char *name)
 
void gnc_basic_cell_set_type_name (BasicCell *cell, const gchar *type_name)
 
gboolean gnc_basic_cell_has_type_name (BasicCell *cell, const gchar *type_name)
 
void gnc_basic_cell_set_sample_text (BasicCell *cell, const char *sample_text)
 
void gnc_basic_cell_set_alignment (BasicCell *cell, CellAlignment alignment)
 
void gnc_basic_cell_set_expandable (BasicCell *cell, gboolean expandable)
 
void gnc_basic_cell_set_span (BasicCell *cell, gboolean span)
 
const char * gnc_basic_cell_get_value (BasicCell *cell)
 
void gnc_basic_cell_set_value (BasicCell *bcell, const char *value)
 
gboolean gnc_basic_cell_get_changed (BasicCell *cell)
 
gboolean gnc_basic_cell_get_conditionally_changed (BasicCell *cell)
 
void gnc_basic_cell_set_changed (BasicCell *cell, gboolean changed)
 
void gnc_basic_cell_set_conditionally_changed (BasicCell *cell, gboolean changed)
 
void gnc_basic_cell_set_value_internal (BasicCell *bcell, const char *value)
 
char * gnc_basic_cell_validate (BasicCell *bcell, GNCPrintAmountInfo print_info, const char *change, const char *newval, const char *toks, gint *cursor_position)
 
CellFactory * gnc_cell_factory_new (void)
 
void gnc_cell_factory_destroy (CellFactory *cf)
 
void gnc_cell_factory_add_cell_type (CellFactory *cf, const char *cell_type_name, CellCreateFunc cell_creator)
 
BasicCell * gnc_cell_factory_make_cell (CellFactory *cf, const char *cell_type_name)
 
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)
 
BasicCell * gnc_combo_cell_new (void)
 
void gnc_combo_cell_init (ComboCell *cell)
 
void gnc_combo_cell_set_value (ComboCell *cell, const char *value)
 
void gnc_combo_cell_clear_menu (ComboCell *cell)
 
void gnc_combo_cell_add_menu_item (ComboCell *cell, const char *menustr)
 Add a menu item to the list.
 
void gnc_combo_cell_add_account_menu_item (ComboCell *cell, char *menustr)
 Add a 'account name' menu item to the list.
 
void gnc_combo_cell_set_sort_enabled (ComboCell *cell, gboolean enabled)
 Enable sorting of the menu item's contents.
 
void gnc_combo_cell_set_strict (ComboCell *cell, gboolean strict)
 Determines whether the cell will accept strings not in the menu.
 
void gnc_combo_cell_set_complete_char (ComboCell *cell, gunichar complete_char)
 Sets a character used for special completion processing.
 
void gnc_combo_cell_add_ignore_string (ComboCell *cell, const char *ignore_string)
 Add a string to a list of strings which, if the cell has that value, will cause the cell to be uneditable on 'enter'.
 
void gnc_combo_cell_set_autosize (ComboCell *cell, gboolean autosize)
 Determines whether the popup list autosizes itself or uses all available space.
 
void gnc_combo_cell_use_quickfill_cache (ComboCell *cell, QuickFill *shared_qf)
 Tell the combocell to use a shared QuickFill object.
 
void gnc_combo_cell_use_list_store_cache (ComboCell *cell, gpointer data)
 
BasicCell * gnc_completion_cell_new (void)
 
void gnc_completion_cell_init (CompletionCell *cell)
 
void gnc_completion_cell_set_value (CompletionCell *cell, const char *value)
 
void gnc_completion_cell_clear_menu (CompletionCell *cell)
 
void gnc_completion_cell_add_menu_item (CompletionCell *cell, const char *menustr)
 Add a menu item to the hash table list.
 
void gnc_completion_cell_set_sort_enabled (CompletionCell *cell, gboolean enabled)
 Enable sorting of the menu item's contents.
 
void gnc_completion_cell_set_strict (CompletionCell *cell, gboolean strict)
 Determines whether the cell will accept strings not in the menu.
 
void gnc_completion_cell_set_autosize (CompletionCell *cell, gboolean autosize)
 Determines whether the popup list autosizes itself or uses all available space.
 
void gnc_completion_cell_reverse_sort (CompletionCell *cell, gboolean is_reversed)
 Register the sort direction.
 
BasicCell * gnc_date_cell_new (void)
 installs a callback to handle date recording
 
void gnc_date_cell_set_value (DateCell *cell, int day, int mon, int year)
 Accepts a numeric date and sets the contents of the date cell to that value.
 
void gnc_date_cell_set_value_secs (DateCell *cell, time64 secs)
 Sets the contents of the cell with seconds before or since the Unix epoch.
 
void gnc_date_cell_commit (DateCell *cell)
 Commits any pending changes to the value of the cell.
 
void gnc_date_cell_get_date (DateCell *cell, time64 *time, gboolean warn)
 Set a time64 to the value in the DateCell.
 
BasicCell * gnc_doclink_cell_new (void)
 
void gnc_doclink_cell_set_flag (Doclinkcell *cell, char flag)
 
char gnc_doclink_cell_get_flag (Doclinkcell *cell)
 
void gnc_doclink_cell_set_confirm_cb (Doclinkcell *cell, DoclinkcellConfirm confirm_cb, gpointer data)
 
void gnc_doclink_cell_set_string_getter (Doclinkcell *cell, DoclinkcellStringGetter getter)
 
void gnc_doclink_cell_set_valid_flags (Doclinkcell *cell, const char *flags, char default_flag)
 note that
 
void gnc_doclink_cell_set_flag_order (Doclinkcell *cell, const char *flags)
 
void gnc_doclink_cell_set_read_only (Doclinkcell *cell, gboolean read_only)
 
void gnc_doclink_cell_set_use_glyphs (Doclinkcell *cell)
 
gboolean gnc_doclink_get_use_glyphs (Doclinkcell *cell)
 
const char * gnc_doclink_get_glyph_from_flag (char link_flag)
 
BasicCell * gnc_formula_cell_new (void)
 
void gnc_formula_cell_set_value (FormulaCell *fc, const char *newVal)
 
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)
 
BasicCell * gnc_price_cell_new (void)
 installs a callback to handle price recording
 
gnc_numeric gnc_price_cell_get_value (PriceCell *cell)
 return the value of a price cell
 
gboolean gnc_price_cell_set_value (PriceCell *cell, gnc_numeric amount)
 updates amount, returns TRUE if string representation actually changed
 
void gnc_price_cell_set_fraction (PriceCell *cell, int fraction)
 Sets the fraction used for rounding.
 
void gnc_price_cell_blank (PriceCell *cell)
 Sets the cell as blank, regardless of the blank_zero value.
 
void gnc_price_cell_set_blank_zero (PriceCell *cell, gboolean blank_zero)
 determines whether 0 values are left blank or printed.
 
void gnc_price_cell_set_print_info (PriceCell *cell, GNCPrintAmountInfo print_info)
 set the printing context of the price cell
 
void gnc_price_cell_set_debt_credit_value (PriceCell *debit, PriceCell *credit, gnc_numeric amount)
 updates two cells; the deb cell if amt is negative, the credit cell if amount is positive, and makes the other cell blank.
 
BasicCell * gnc_quickfill_cell_new (void)
 
void gnc_quickfill_cell_set_value (QuickFillCell *cell, const char *value)
 sets the current cell value to the indicated string, simultaneously adding the string to the quick-fill tree.
 
void gnc_quickfill_cell_set_sort (QuickFillCell *cell, QuickFillSort sort)
 
void gnc_quickfill_cell_add_completion (QuickFillCell *cell, const char *completion)
 
void gnc_quickfill_cell_use_quickfill_cache (QuickFillCell *cell, QuickFill *shared_qf)
 Lets the cell use the given shared quickfill object instead of the one it owns internally.
 
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_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_valid_flags (RecnCell *cell, const char *flags, char default_flag)
 note that chars is copied into the RecnCell directly, but remains the "property" of the caller.
 
void gnc_recn_cell_set_flag_order (RecnCell *cell, const char *flags)
 
void gnc_recn_cell_set_read_only (RecnCell *cell, gboolean read_only)
 

Detailed Description

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).

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).

Macro Definition Documentation

◆ GLYPH_LINK

#define GLYPH_LINK   "\360\237\224\227"

Definition at line 47 of file doclinkcell.h.

◆ GLYPH_PAPERCLIP

#define GLYPH_PAPERCLIP   "\360\237\223\216"

Definition at line 46 of file doclinkcell.h.

Typedef Documentation

◆ CellCreateFunc

typedef BasicCell *(* CellCreateFunc) (void)

Definition at line 172 of file basiccell.h.

◆ CellDestroyFunc

typedef void(* CellDestroyFunc) (BasicCell *cell)

Definition at line 203 of file basiccell.h.

◆ CellDirectUpdateFunc

typedef gboolean(* CellDirectUpdateFunc) (BasicCell *cell, int *cursor_position, int *start_selection, int *end_selection, gpointer gui_data)

Definition at line 191 of file basiccell.h.

◆ CellEnterFunc

typedef gboolean(* CellEnterFunc) (BasicCell *cell, int *cursor_position, int *start_selection, int *end_selection)

Definition at line 177 of file basiccell.h.

◆ CellLeaveFunc

typedef void(* CellLeaveFunc) (BasicCell *cell)

Definition at line 197 of file basiccell.h.

◆ CellModifyVerifyFunc

typedef void(* CellModifyVerifyFunc) (BasicCell *cell, const char *add_str, int add_str_len, const char *new_value, int new_value_len, int *cursor_position, int *start_selection, int *end_selection)

Definition at line 182 of file basiccell.h.

◆ CellMoveFunc

typedef void(* CellMoveFunc) (BasicCell *cell)

Definition at line 201 of file basiccell.h.

◆ CellRealizeFunc

typedef void(* CellRealizeFunc) (BasicCell *cell, gpointer gui_handle)

Definition at line 199 of file basiccell.h.

◆ CellSetValueFunc

typedef void(* CellSetValueFunc) (BasicCell *cell, const char *new_value)

Definition at line 174 of file basiccell.h.

◆ DoclinkcellConfirm

typedef gboolean(* DoclinkcellConfirm) (char old_flag, gpointer data)

Definition at line 50 of file doclinkcell.h.

◆ DoclinkcellStringGetter

typedef const char *(* DoclinkcellStringGetter) (char flag)

Definition at line 49 of file doclinkcell.h.

◆ RecnCellConfirm

typedef gboolean(* RecnCellConfirm) (char old_flag, gpointer data)

Definition at line 45 of file recncell.h.

◆ RecnCellStringGetter

typedef const char *(* RecnCellStringGetter) (char flag)

Definition at line 44 of file recncell.h.

Enumeration Type Documentation

◆ CellAlignment

enum CellAlignment

Definition at line 205 of file basiccell.h.

206{
207 CELL_ALIGN_RIGHT,
208 CELL_ALIGN_CENTER,
209 CELL_ALIGN_LEFT
210} CellAlignment;

Function Documentation

◆ gnc_basic_cell_destroy()

void gnc_basic_cell_destroy ( BasicCell *  bcell)

Definition at line 127 of file basiccell.c.

128{
129 ENTER(" ");
130 if (cell->destroy)
131 cell->destroy (cell);
132
133 /* give any gui elements a chance to clean up */
134 if (cell->gui_destroy)
135 (*(cell->gui_destroy)) (cell);
136
137 /* free up data strings */
138 g_free (cell->value);
139 cell->value = NULL;
140
141 /* help prevent access to freed memory */
142 gnc_basic_cell_clear (cell);
143
144 /* free the object itself */
145 g_free (cell);
146 LEAVE(" ");
147}
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition qoflog.h:282
#define ENTER(format, args...)
Print a function entry debugging message.
Definition qoflog.h:272

◆ gnc_basic_cell_get_changed()

gboolean gnc_basic_cell_get_changed ( BasicCell *  cell)

Definition at line 250 of file basiccell.c.

251{
252 if (!cell) return FALSE;
253
254 return cell->changed;
255}

◆ gnc_basic_cell_get_conditionally_changed()

gboolean gnc_basic_cell_get_conditionally_changed ( BasicCell *  cell)

Definition at line 258 of file basiccell.c.

259{
260 if (!cell) return FALSE;
261
262 return cell->conditionally_changed;
263}

◆ gnc_basic_cell_get_value()

const char * gnc_basic_cell_get_value ( BasicCell *  cell)

Definition at line 224 of file basiccell.c.

225{
226 g_return_val_if_fail (cell != NULL, NULL);
227
228 return cell->value;
229}

◆ gnc_basic_cell_has_name()

gboolean gnc_basic_cell_has_name ( BasicCell *  cell,
const char *  name 
)

Definition at line 160 of file basiccell.c.

161{
162 if (!cell) return FALSE;
163 if (!name) return FALSE;
164 if (!cell->cell_name) return FALSE;
165
166 return (strcmp (name, cell->cell_name) == 0);
167}

◆ gnc_basic_cell_has_type_name()

gboolean gnc_basic_cell_has_type_name ( BasicCell *  cell,
const gchar *  type_name 
)

Definition at line 181 of file basiccell.c.

182{
183 if (!cell) return FALSE;
184 if (!type_name) return FALSE;
185 if (!cell->cell_type_name) return FALSE;
186
187 return (g_strcmp0 (type_name, cell->cell_type_name));
188}

◆ gnc_basic_cell_init()

void gnc_basic_cell_init ( BasicCell *  bcell)

Definition at line 116 of file basiccell.c.

117{
118 gnc_basic_cell_clear (cell);
119
120 cell->gui_realize = gnc_basic_cell_gui_realize;
121 cell->gui_destroy = gnc_basic_cell_gui_destroy;
122
123 cell->value = g_strdup ("");
124}

◆ gnc_basic_cell_new()

BasicCell * gnc_basic_cell_new ( void  )

Definition at line 74 of file basiccell.c.

75{
76 BasicCell * cell;
77
78 cell = g_new0 (BasicCell, 1);
79
80 gnc_basic_cell_init (cell);
81
82 return cell;
83}

◆ gnc_basic_cell_set_alignment()

void gnc_basic_cell_set_alignment ( BasicCell *  cell,
CellAlignment  alignment 
)

Definition at line 202 of file basiccell.c.

204{
205 if (!cell) return;
206 cell->alignment = alignment;
207}

◆ gnc_basic_cell_set_changed()

void gnc_basic_cell_set_changed ( BasicCell *  cell,
gboolean  changed 
)

Definition at line 266 of file basiccell.c.

267{
268 if (!cell) return;
269
270 cell->changed = changed;
271}

◆ gnc_basic_cell_set_conditionally_changed()

void gnc_basic_cell_set_conditionally_changed ( BasicCell *  cell,
gboolean  changed 
)

Definition at line 274 of file basiccell.c.

275{
276 if (!cell) return;
277
278 cell->conditionally_changed = changed;
279}

◆ gnc_basic_cell_set_expandable()

void gnc_basic_cell_set_expandable ( BasicCell *  cell,
gboolean  expandable 
)

Definition at line 210 of file basiccell.c.

211{
212 if (!cell) return;
213 cell->expandable = expandable;
214}

◆ gnc_basic_cell_set_name()

void gnc_basic_cell_set_name ( BasicCell *  cell,
const char *  name 
)

Definition at line 150 of file basiccell.c.

151{
152 if (!cell) return;
153 if (cell->cell_name == name) return;
154
155 g_free (cell->cell_name);
156 cell->cell_name = g_strdup (name);
157}

◆ gnc_basic_cell_set_sample_text()

void gnc_basic_cell_set_sample_text ( BasicCell *  cell,
const char *  sample_text 
)

Definition at line 191 of file basiccell.c.

193{
194 if (!cell) return;
195 if (cell->sample_text == sample_text) return;
196
197 g_free (cell->sample_text);
198 cell->sample_text = g_strdup (sample_text);
199}

◆ gnc_basic_cell_set_span()

void gnc_basic_cell_set_span ( BasicCell *  cell,
gboolean  span 
)

Definition at line 217 of file basiccell.c.

218{
219 if (!cell) return;
220 cell->span = span;
221}

◆ gnc_basic_cell_set_type_name()

void gnc_basic_cell_set_type_name ( BasicCell *  cell,
const gchar *  type_name 
)

Definition at line 171 of file basiccell.c.

172{
173 if (!cell) return;
174 if (cell->cell_type_name == type_name) return;
175
176 g_free (cell->cell_type_name);
177 cell->cell_type_name = g_strdup(type_name);
178}

◆ gnc_basic_cell_set_value()

void gnc_basic_cell_set_value ( BasicCell *  bcell,
const char *  value 
)

Definition at line 232 of file basiccell.c.

233{
234 CellSetValueFunc cb;
235
236 cb = cell->set_value;
237 if (cb)
238 {
239 /* avoid recursion by disabling the
240 * callback while it's being called. */
241 cell->set_value = NULL;
242 cb (cell, val);
243 cell->set_value = cb;
244 }
245 else
246 gnc_basic_cell_set_value_internal (cell, val);
247}

◆ gnc_basic_cell_set_value_internal()

void gnc_basic_cell_set_value_internal ( BasicCell *  bcell,
const char *  value 
)

Definition at line 282 of file basiccell.c.

283{
284 if (value == NULL)
285 value = "";
286
287 /* If the caller tries to set the value with our own value then do
288 * nothing because we have no work to do (or, at least, all the work
289 * will result in the status-quo, so why do anything?) See bug
290 * #103174 and the description in the changelog on 2003-09-04.
291 */
292 if (cell->value == value)
293 return;
294
295 g_free (cell->value);
296 cell->value = g_strdup (value);
297 cell->value_chars = g_utf8_strlen(value, -1);
298}

◆ gnc_basic_cell_validate()

char * gnc_basic_cell_validate ( BasicCell *  bcell,
GNCPrintAmountInfo  print_info,
const char *  change,
const char *  newval,
const char *  toks,
gint *  cursor_position 
)

Definition at line 301 of file basiccell.c.

304{
305 struct lconv *lc = gnc_localeconv ();
306 gunichar decimal_point;
307 gunichar thousands_sep;
308 const char *symbol = NULL;
309 char *tokens;
310
311 if (print_info.monetary)
312 {
313 const gnc_commodity *comm = print_info.commodity;
314
315 decimal_point = g_utf8_get_char (lc->mon_decimal_point);
316 thousands_sep = g_utf8_get_char (lc->mon_thousands_sep);
317
318 if (comm)
319 symbol = gnc_commodity_get_nice_symbol (comm);
320 else
322
323 tokens = g_strconcat (toks, symbol, NULL);
324 }
325 else
326 {
327 decimal_point = g_utf8_get_char (lc->decimal_point);
328 thousands_sep = g_utf8_get_char (lc->thousands_sep);
329
330 tokens = g_strdup (toks);
331 }
332
333 for (const char *c = change; c && *c; c = g_utf8_next_char (c))
334 {
335 gunichar uc = g_utf8_get_char (c);
336 if (!g_unichar_isdigit (uc) &&
337 !g_unichar_isspace (uc) &&
338 !g_unichar_isalpha (uc) &&
339 (decimal_point != uc) &&
340 (thousands_sep != uc) &&
341 (g_utf8_strchr (tokens, -1, uc) == NULL))
342 {
343 g_free (tokens);
344 return NULL;
345 }
346 }
347 g_free (tokens);
348
349 gnc_filter_text_set_cursor_position (newval, symbol, cursor_position);
350
351 return gnc_filter_text_for_currency_symbol (newval, symbol);
352}
const char * gnc_commodity_get_nice_symbol(const gnc_commodity *cm)
Retrieve a symbol for the specified commodity, suitable for display to the user.
char * gnc_filter_text_for_currency_symbol(const char *incoming_text, const char *symbol)
Returns the incoming text removed of a currency symbol.
gnc_commodity * gnc_default_currency(void)
Return the default currency set by the user.

◆ gnc_cell_factory_add_cell_type()

void gnc_cell_factory_add_cell_type ( CellFactory *  cf,
const char *  cell_type_name,
CellCreateFunc  cell_creator 
)

Definition at line 77 of file cell-factory.c.

80{
81 CellRecord *cr;
82
83 g_return_if_fail (cell_type_name != NULL);
84 g_return_if_fail (cell_creator != NULL);
85
86 cr = g_hash_table_lookup (cf->cell_table, cell_type_name);
87
88 if (cr)
89 {
90 g_hash_table_remove (cf->cell_table, cell_type_name);
91 g_free (cr->cell_type_name);
92 }
93 else
94 cr = g_new0 (CellRecord, 1);
95
96 cr->cell_type_name = g_strdup (cell_type_name);
97 cr->creator = cell_creator;
98
99 g_hash_table_insert (cf->cell_table, cr->cell_type_name, cr);
100}

◆ gnc_cell_factory_destroy()

void gnc_cell_factory_destroy ( CellFactory *  cf)

Definition at line 67 of file cell-factory.c.

68{
69 if (!cf) return;
70
71 g_hash_table_foreach (cf->cell_table, cell_table_destroy_helper, NULL);
72
73 g_free (cf);
74}

◆ gnc_cell_factory_make_cell()

BasicCell * gnc_cell_factory_make_cell ( CellFactory *  cf,
const char *  cell_type_name 
)

Definition at line 103 of file cell-factory.c.

104{
105 CellRecord *cr;
106
107 g_return_val_if_fail (cf != NULL, NULL);
108 g_return_val_if_fail (cell_type_name != NULL, NULL);
109
110 cr = g_hash_table_lookup (cf->cell_table, cell_type_name);
111 g_return_val_if_fail (cr != NULL, NULL);
112
113 return cr->creator ();
114}

◆ gnc_cell_factory_new()

CellFactory * gnc_cell_factory_new ( void  )

Definition at line 46 of file cell-factory.c.

47{
48 CellFactory *cf;
49
50 cf = g_new0 (CellFactory, 1);
51
52 cf->cell_table = g_hash_table_new (g_str_hash, g_str_equal);
53
54 return cf;
55}

◆ gnc_cell_name_equal()

gboolean gnc_cell_name_equal ( const char *  cell_name_1,
const char *  cell_name_2 
)

Definition at line 51 of file basiccell.c.

53{
54 return (g_strcmp0 (cell_name_1, cell_name_2) == 0);
55}

◆ gnc_checkbox_cell_get_flag()

gboolean gnc_checkbox_cell_get_flag ( CheckboxCell cell)

Definition at line 107 of file checkboxcell.c.

108{
109 g_return_val_if_fail (cell != NULL, '\0');
110
111 return cell->flag;
112}

◆ gnc_checkbox_cell_get_string()

const char * gnc_checkbox_cell_get_string ( gboolean  flag)

Definition at line 116 of file checkboxcell.c.

117{
118#ifndef MAC_INTEGRATION
119 const char* checked = UNICODE_CHECKMARK;
120#else
121 const char* checked = "X";
122#endif
123 return (flag ? checked : " ");
124}

◆ gnc_checkbox_cell_new()

BasicCell * gnc_checkbox_cell_new ( void  )

Definition at line 82 of file checkboxcell.c.

83{
84 CheckboxCell * cell;
85
86 cell = g_new0 (CheckboxCell, 1);
87
88 gnc_checkbox_cell_init (cell);
89
90 return &cell->cell;
91}
The CheckboxCell object implements a cell handler that will toggle between yes and no values when cli...

◆ gnc_checkbox_cell_set_flag()

void gnc_checkbox_cell_set_flag ( CheckboxCell cell,
gboolean  flag 
)

Definition at line 94 of file checkboxcell.c.

95{
96 const char *string;
97
98 g_return_if_fail (cell != NULL);
99
100 cell->flag = flag;
101 string = gnc_checkbox_cell_get_string (flag);
102
103 gnc_basic_cell_set_value_internal (&cell->cell, string);
104}

◆ gnc_combo_cell_add_account_menu_item()

void gnc_combo_cell_add_account_menu_item ( ComboCell cell,
char *  menustr 
)

Add a 'account name' menu item to the list.

When testing for equality with the currently selected item, this function will ignore the characters normally used to separate account names.

Definition at line 463 of file combocell-gnome.c.

464{
465 PopBox* box;
466
467 if (cell == NULL)
468 return;
469 if (menustr == NULL)
470 return;
471
472 box = cell->cell.gui_private;
473
474 if (box->item_list != NULL)
475 {
476 block_list_signals (cell);
477
478 gnc_item_list_append (box->item_list, menustr);
479 if (cell->cell.value)
480 {
481 gchar* menu_copy = g_strdup (menustr);
482 gchar* value_copy = g_strdup (cell->cell.value);
483 g_strdelimit (menu_copy, "-:/\\.", ' ');
484 g_strdelimit (value_copy, "-:/\\.", ' ');
485 if (strcmp (menu_copy, value_copy) == 0)
486 {
487 gnc_combo_cell_set_value (cell, menustr);
488 gnc_item_list_select (box->item_list, menustr);
489 }
490 g_free (value_copy);
491 g_free (menu_copy);
492 }
493 unblock_list_signals (cell);
494 }
495
496 /* If we're going to be using a pre-fab quickfill,
497 * then don't fill it in here */
498 if (FALSE == box->use_quickfill_cache)
499 {
500 gnc_quickfill_insert (box->qf, menustr, QUICKFILL_ALPHA);
501 }
502}
void gnc_quickfill_insert(QuickFill *qf, const char *text, QuickFillSort sort)
Add the string "text" to the collection of searchable strings.
Definition QuickFill.c:229

◆ gnc_combo_cell_add_ignore_string()

void gnc_combo_cell_add_ignore_string ( ComboCell cell,
const char *  ignore_string 
)

Add a string to a list of strings which, if the cell has that value, will cause the cell to be uneditable on 'enter'.

Definition at line 1131 of file combocell-gnome.c.

1133{
1134 PopBox* box;
1135
1136 if (cell == NULL)
1137 return;
1138
1139 if (!ignore_string)
1140 return;
1141
1142 box = cell->cell.gui_private;
1143
1144 box->ignore_strings = g_list_prepend (box->ignore_strings,
1145 g_strdup (ignore_string));
1146}

◆ gnc_combo_cell_add_menu_item()

void gnc_combo_cell_add_menu_item ( ComboCell cell,
const char *  menustr 
)

Add a menu item to the list.

Definition at line 424 of file combocell-gnome.c.

425{
426 PopBox* box;
427
428 if (cell == NULL)
429 return;
430 if (menustr == NULL)
431 return;
432
433 box = cell->cell.gui_private;
434
435 if (box->item_list != NULL)
436 {
437 block_list_signals (cell);
438
439 gnc_item_list_append (box->item_list, menustr);
440 if (cell->cell.value &&
441 (strcmp (menustr, cell->cell.value) == 0))
442 gnc_item_list_select (box->item_list, menustr);
443
444 unblock_list_signals (cell);
445 }
446 else
447 {
448 GtkTreeIter iter;
449
450 gtk_list_store_append (box->tmp_store, &iter);
451 gtk_list_store_set (box->tmp_store, &iter, 0, menustr, -1);
452 }
453
454 /* If we're going to be using a pre-fab quickfill,
455 * then don't fill it in here */
456 if (FALSE == box->use_quickfill_cache)
457 {
458 gnc_quickfill_insert (box->qf, menustr, QUICKFILL_ALPHA);
459 }
460}

◆ gnc_combo_cell_clear_menu()

void gnc_combo_cell_clear_menu ( ComboCell cell)

Definition at line 366 of file combocell-gnome.c.

367{
368 PopBox* box;
369
370 if (cell == NULL)
371 return;
372
373 box = cell->cell.gui_private;
374 if (box == NULL)
375 return;
376
377 /* Don't destroy the qf if its not ours to destroy */
378 if (FALSE == box->use_quickfill_cache)
379 {
380 gnc_quickfill_destroy (box->qf);
381 box->qf = gnc_quickfill_new();
382 }
383
384 if (box->item_list != NULL)
385 {
386 block_list_signals (cell);
387
388 gnc_item_list_clear (box->item_list);
389 gnc_item_edit_hide_popup (box->item_edit);
390 box->list_popped = FALSE;
391 unblock_list_signals (cell);
392 }
393 else
394 gtk_list_store_clear (box->tmp_store);
395}

◆ gnc_combo_cell_init()

void gnc_combo_cell_init ( ComboCell cell)

Definition at line 133 of file combocell-gnome.c.

134{
135 PopBox* box;
136
137 gnc_basic_cell_init (& (cell->cell));
138
139 cell->cell.is_popup = TRUE;
140
141 cell->cell.destroy = gnc_combo_cell_destroy;
142
143 cell->cell.gui_realize = gnc_combo_cell_gui_realize;
144 cell->cell.gui_destroy = gnc_combo_cell_gui_destroy;
145
146 box = g_new0 (PopBox, 1);
147
148 box->sheet = NULL;
149 box->item_edit = NULL;
150 box->item_list = NULL;
151 box->tmp_store = gtk_list_store_new (1, G_TYPE_STRING);
152 box->signals_connected = FALSE;
153 box->list_popped = FALSE;
154 box->autosize = FALSE;
155
156 cell->cell.gui_private = box;
157
158 box->qf = gnc_quickfill_new();
159 box->use_quickfill_cache = FALSE;
160
161 box->in_list_select = FALSE;
162
163 box->strict = TRUE;
164
165 box->complete_char = '\0';
166
167 box->ignore_strings = NULL;
168}

◆ gnc_combo_cell_new()

BasicCell * gnc_combo_cell_new ( void  )

Definition at line 119 of file combocell-gnome.c.

120{
121 ComboCell* cell;
122
123 g_once (&auto_pop_init_once, gnc_combo_cell_autopop_init, NULL);
124
125 cell = g_new0 (ComboCell, 1);
126
127 gnc_combo_cell_init (cell);
128
129 return &cell->cell;
130}
The ComboCell object implements a cell handler with a "combination-box" pull-down menu in it.
Definition combocell.h:53

◆ gnc_combo_cell_set_autosize()

void gnc_combo_cell_set_autosize ( ComboCell cell,
gboolean  autosize 
)

Determines whether the popup list autosizes itself or uses all available space.

FALSE by default.

Definition at line 1149 of file combocell-gnome.c.

1150{
1151 PopBox* box;
1152
1153 if (!cell)
1154 return;
1155
1156 box = cell->cell.gui_private;
1157 if (!box)
1158 return;
1159
1160 box->autosize = autosize;
1161}

◆ gnc_combo_cell_set_complete_char()

void gnc_combo_cell_set_complete_char ( ComboCell cell,
gunichar  complete_char 
)

Sets a character used for special completion processing.

Definition at line 1118 of file combocell-gnome.c.

1119{
1120 PopBox* box;
1121
1122 if (cell == NULL)
1123 return;
1124
1125 box = cell->cell.gui_private;
1126
1127 box->complete_char = complete_char;
1128}

◆ gnc_combo_cell_set_sort_enabled()

void gnc_combo_cell_set_sort_enabled ( ComboCell cell,
gboolean  enabled 
)

Enable sorting of the menu item's contents.

Loading the item is much faster with sorting disabled.

Definition at line 349 of file combocell-gnome.c.

350{
351 PopBox* box;
352
353 if (cell == NULL)
354 return;
355
356 box = cell->cell.gui_private;
357 if (box->item_list == NULL)
358 return;
359
360 block_list_signals (cell);
361 gnc_item_list_set_sort_column (box->item_list, 0);
362 unblock_list_signals (cell);
363}

◆ gnc_combo_cell_set_strict()

void gnc_combo_cell_set_strict ( ComboCell cell,
gboolean  strict 
)

Determines whether the cell will accept strings not in the menu.

Defaults to strict, i.e., only menu items are accepted.

Definition at line 1105 of file combocell-gnome.c.

1106{
1107 PopBox* box;
1108
1109 if (cell == NULL)
1110 return;
1111
1112 box = cell->cell.gui_private;
1113
1114 box->strict = strict;
1115}

◆ gnc_combo_cell_set_value()

void gnc_combo_cell_set_value ( ComboCell cell,
const char *  value 
)

Definition at line 505 of file combocell-gnome.c.

506{
507 gnc_basic_cell_set_value (&cell->cell, str);
508}

◆ gnc_combo_cell_use_list_store_cache()

void gnc_combo_cell_use_list_store_cache ( ComboCell cell,
gpointer  data 
)

Definition at line 416 of file combocell-gnome.c.

417{
418 if (cell == NULL) return;
419
420 cell->shared_store = data;
421}

◆ gnc_combo_cell_use_quickfill_cache()

void gnc_combo_cell_use_quickfill_cache ( ComboCell cell,
QuickFill *  shared_qf 
)

Tell the combocell to use a shared QuickFill object.

Using this routine can dramatically improve performance when creating combocells with a large number of entries. For example, users with thousands of accounts are complaining about 10-second register startup times, of which 98% of the cpu is spent building the multi-thousand entry quickfill. When a shared quickfill is specified, the combo-cell will not add to nor delete the quickfill; it is the users resonsibility to manage the quickfill object. The combocell will not make a copy of the quickfill.

Definition at line 398 of file combocell-gnome.c.

399{
400 PopBox* box;
401
402 if (cell == NULL) return;
403
404 box = cell->cell.gui_private;
405 if (NULL == box) return;
406
407 if (FALSE == box->use_quickfill_cache)
408 {
409 box->use_quickfill_cache = TRUE;
410 gnc_quickfill_destroy (box->qf);
411 }
412 box->qf = shared_qf;
413}

◆ gnc_completion_cell_add_menu_item()

void gnc_completion_cell_add_menu_item ( CompletionCell cell,
const char *  menustr 
)

Add a menu item to the hash table list.

Definition at line 466 of file completioncell-gnome.c.

468{
469 if (!cell || !menustr)
470 return;
471
472 PopBox* box = cell->cell.gui_private;
473
474 if (box->item_hash)
475 {
476 gpointer value = g_hash_table_lookup (box->item_hash, menustr);
477 gboolean update = FALSE;
478 if (value)
479 {
480 if (!box->register_is_reversed)
481 update = TRUE;
482 }
483 else
484 update = TRUE;
485
486 if (update)
487 {
488 g_hash_table_insert (box->item_hash, g_strdup (menustr),
489 GINT_TO_POINTER(box->occurrence));
490 }
491 box->occurrence++;
492 }
493}

◆ gnc_completion_cell_clear_menu()

void gnc_completion_cell_clear_menu ( CompletionCell cell)

Definition at line 448 of file completioncell-gnome.c.

449{
450 if (!cell)
451 return;
452
453 PopBox* box = cell->cell.gui_private;
454 if (!box)
455 return;
456
457 if (box->item_list)
458 {
459 g_hash_table_remove_all (box->item_hash);
460 item_store_clear (cell);
461 box->occurrence = 0;
462 }
463}

◆ gnc_completion_cell_init()

void gnc_completion_cell_init ( CompletionCell cell)

Definition at line 106 of file completioncell-gnome.c.

107{
108 gnc_basic_cell_init (& (cell->cell));
109
110 cell->cell.is_popup = TRUE;
111
112 cell->cell.destroy = gnc_completion_cell_destroy;
113
114 cell->cell.gui_realize = gnc_completion_cell_gui_realize;
115 cell->cell.gui_destroy = gnc_completion_cell_gui_destroy;
116
117 PopBox* box = g_new0 (PopBox, 1);
118
119 box->sheet = NULL;
120 box->item_edit = NULL;
121 box->item_list = NULL;
122 box->item_store = NULL;
123
124 box->signals_connected = FALSE;
125 box->list_popped = FALSE;
126 box->autosize = FALSE;
127 box->register_is_reversed = FALSE;
128
129 box->sort_enabled = FALSE;
130
131 cell->cell.gui_private = box;
132
133 box->strict = FALSE;
134 box->in_list_select = FALSE;
135 box->occurrence = 0;
136
137 box->item_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
138}

◆ gnc_completion_cell_new()

BasicCell * gnc_completion_cell_new ( void  )

Definition at line 98 of file completioncell-gnome.c.

99{
100 CompletionCell* cell = g_new0 (CompletionCell, 1);
101 gnc_completion_cell_init (cell);
102 return &cell->cell;
103}
The CompletionCell object implements a cell handler with a "combination-box" pull-down menu in it.

◆ gnc_completion_cell_reverse_sort()

void gnc_completion_cell_reverse_sort ( CompletionCell cell,
gboolean  is_reversed 
)

Register the sort direction.

Used to determine in what order the completion should present the list. FALSE by default

Definition at line 820 of file completioncell-gnome.c.

821{
822 if (!cell)
823 return;
824
825 PopBox* box = cell->cell.gui_private;
826
827 if (is_reversed != box->register_is_reversed)
828 {
829 gnc_completion_cell_clear_menu (cell);
830 box->register_is_reversed = is_reversed;
831 box->occurrence = 0;
832 }
833}

◆ gnc_completion_cell_set_autosize()

void gnc_completion_cell_set_autosize ( CompletionCell cell,
gboolean  autosize 
)

Determines whether the popup list autosizes itself or uses all available space.

FALSE by default.

Definition at line 1065 of file completioncell-gnome.c.

1066{
1067 if (!cell)
1068 return;
1069
1070 PopBox* box = cell->cell.gui_private;
1071 if (!box)
1072 return;
1073
1074 box->autosize = autosize;
1075}

◆ gnc_completion_cell_set_sort_enabled()

void gnc_completion_cell_set_sort_enabled ( CompletionCell cell,
gboolean  enabled 
)

Enable sorting of the menu item's contents.

Definition at line 394 of file completioncell-gnome.c.

396{
397 if (!cell)
398 return;
399
400 PopBox* box = cell->cell.gui_private;
401 box->sort_enabled = enabled;
402}

◆ gnc_completion_cell_set_strict()

void gnc_completion_cell_set_strict ( CompletionCell cell,
gboolean  strict 
)

Determines whether the cell will accept strings not in the menu.

Defaults to strict, i.e., only menu items are accepted.

Definition at line 1052 of file completioncell-gnome.c.

1053{
1054 if (!cell)
1055 return;
1056
1057 PopBox* box = cell->cell.gui_private;
1058 if (!box)
1059 return;
1060
1061 box->strict = strict;
1062}

◆ gnc_completion_cell_set_value()

void gnc_completion_cell_set_value ( CompletionCell cell,
const char *  value 
)

Definition at line 496 of file completioncell-gnome.c.

497{
498 if (!cell || !str)
499 return;
500
501 gnc_basic_cell_set_value (&cell->cell, str);
502}

◆ gnc_date_cell_commit()

void gnc_date_cell_commit ( DateCell cell)

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.

Definition at line 462 of file datecell-gnome.c.

463{
464 PopBox *box = cell->cell.gui_private;
465 char buff[DATE_BUF];
466
467 if (!cell)
468 return;
469
470 gnc_parse_date (&(box->date), cell->cell.value, FALSE);
471
472 qof_print_date_dmy_buff (buff, MAX_DATE_LENGTH,
473 box->date.tm_mday,
474 box->date.tm_mon + 1,
475 box->date.tm_year + 1900);
476
477 gnc_basic_cell_set_value_internal (&cell->cell, buff);
478
479 if (!box->date_picker)
480 return;
481
482 block_picker_signals (cell);
483 gnc_date_picker_set_date (box->date_picker,
484 box->date.tm_mday,
485 box->date.tm_mon,
486 box->date.tm_year + 1900);
487 unblock_picker_signals (cell);
488}
#define MAX_DATE_LENGTH
The maximum length of a string created by the date printers.
Definition gnc-date.h:108

◆ gnc_date_cell_get_date()

void gnc_date_cell_get_date ( DateCell cell,
time64 time,
gboolean  warn 
)

Set a time64 to the value in the DateCell.

Parameters
cellThe DateCell
timeA time64* to which the function will write the time.
warnWhether to warn of parse errors or silently change to a valid one.

Definition at line 737 of file datecell-gnome.c.

738{
739 PopBox *box = cell->cell.gui_private;
740 if (!cell || !time)
741 return;
742
743 gnc_parse_date (&(box->date), cell->cell.value, warn);
744 *time = gnc_mktime (&box->date);
745}
time64 gnc_mktime(struct tm *time)
calculate seconds from the epoch given a time struct
Definition gnc-date.cpp:219

◆ gnc_date_cell_new()

BasicCell * gnc_date_cell_new ( void  )

installs a callback to handle date recording

Definition at line 241 of file datecell-gnome.c.

242{
243 DateCell *cell;
244
245 cell = g_new0 (DateCell, 1);
246
247 gnc_date_cell_init (cell);
248
249 return &cell->cell;
250}
The DateCell object implements a date handling cell.
Definition datecell.h:92

◆ gnc_date_cell_set_value()

void gnc_date_cell_set_value ( DateCell cell,
int  day,
int  mon,
int  year 
)

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.

Parameters
cellThe DateCell to set
dayThe day of the month, 1..31
monthThe month of the year, 1..12
yearThe year, 4 digits, common era

Definition at line 406 of file datecell-gnome.c.

407{
408 PopBox *box = cell->cell.gui_private;
409 struct tm dada;
410 char buff[DATE_BUF];
411
412 dada.tm_mday = day;
413 dada.tm_mon = mon - 1;
414 dada.tm_year = year - 1900;
415
416 gnc_tm_set_day_start(&dada);
417 gnc_mktime (&dada);
418
419 box->date.tm_mday = dada.tm_mday;
420 box->date.tm_mon = dada.tm_mon;
421 box->date.tm_year = dada.tm_year;
422
423 qof_print_date_dmy_buff (buff, MAX_DATE_LENGTH, dada.tm_mday, dada.tm_mon + 1, dada.tm_year + 1900);
424
425 gnc_basic_cell_set_value_internal (&cell->cell, buff);
426
427 if (!box->date_picker)
428 return;
429
430 block_picker_signals (cell);
431 gnc_date_picker_set_date (box->date_picker, day, mon - 1, year);
432 unblock_picker_signals (cell);
433}

◆ gnc_date_cell_set_value_secs()

void gnc_date_cell_set_value_secs ( DateCell cell,
time64  secs 
)

Sets the contents of the cell with seconds before or since the Unix epoch.

Parameters
cellThe DateCell to set
secsSeconds before or since the Unix epoch, 1 January 1970 CE.

Definition at line 436 of file datecell-gnome.c.

437{
438 PopBox *box = cell->cell.gui_private;
439 char buff[DATE_BUF];
440
441 gnc_localtime_r (&secs, &(box->date));
442
443 qof_print_date_dmy_buff (buff, MAX_DATE_LENGTH,
444 box->date.tm_mday,
445 box->date.tm_mon + 1,
446 box->date.tm_year + 1900);
447
448 gnc_basic_cell_set_value_internal (&cell->cell, buff);
449
450 if (!box->date_picker)
451 return;
452
453 block_picker_signals (cell);
454 gnc_date_picker_set_date (box->date_picker,
455 box->date.tm_mday,
456 box->date.tm_mon,
457 box->date.tm_year + 1900);
458 unblock_picker_signals (cell);
459}
struct tm * gnc_localtime_r(const time64 *secs, struct tm *time)
fill out a time struct from a 64-bit time value adjusted for the current time zone.
Definition gnc-date.cpp:115

◆ gnc_doclink_cell_get_flag()

char gnc_doclink_cell_get_flag ( Doclinkcell cell)

Definition at line 209 of file doclinkcell.c.

210{
211 g_return_val_if_fail (cell != NULL, '\0');
212
213 return cell->flag;
214}

◆ gnc_doclink_cell_new()

BasicCell * gnc_doclink_cell_new ( void  )

Definition at line 159 of file doclinkcell.c.

160{
161 Doclinkcell * cell;
162
163 cell = g_new0 (Doclinkcell, 1);
164
165 gnc_doclink_cell_init (cell);
166
167 return &cell->cell;
168}
The Doclinkcell object implements a cell handler that will cycle through a series of single-character...
Definition doclinkcell.h:53

◆ gnc_doclink_cell_set_confirm_cb()

void gnc_doclink_cell_set_confirm_cb ( Doclinkcell cell,
DoclinkcellConfirm  confirm_cb,
gpointer  data 
)

Definition at line 226 of file doclinkcell.c.

228{
229 g_return_if_fail (cell != NULL);
230
231 cell->confirm_cb = confirm_cb;
232 cell->confirm_data = data;
233}

◆ gnc_doclink_cell_set_flag()

void gnc_doclink_cell_set_flag ( Doclinkcell cell,
char  flag 
)

Definition at line 196 of file doclinkcell.c.

197{
198 const char *string;
199
200 g_return_if_fail (cell != NULL);
201
202 cell->flag = flag;
203 string = gnc_doclink_cell_get_string (cell, flag);
204
205 gnc_basic_cell_set_value_internal (&cell->cell, string);
206}

◆ gnc_doclink_cell_set_flag_order()

void gnc_doclink_cell_set_flag_order ( Doclinkcell cell,
const char *  flags 
)

Definition at line 247 of file doclinkcell.c.

248{
249 g_return_if_fail (cell != NULL);
250 g_return_if_fail (flags != NULL);
251
252 cell->flag_order = (char *)flags;
253}
char * flag_order
The list of valid flags.
Definition doclinkcell.h:59

◆ gnc_doclink_cell_set_read_only()

void gnc_doclink_cell_set_read_only ( Doclinkcell cell,
gboolean  read_only 
)

Definition at line 256 of file doclinkcell.c.

257{
258 g_return_if_fail (cell != NULL);
259
260 cell->read_only = read_only;
261}

◆ gnc_doclink_cell_set_string_getter()

void gnc_doclink_cell_set_string_getter ( Doclinkcell cell,
DoclinkcellStringGetter  getter 
)

Definition at line 217 of file doclinkcell.c.

219{
220 g_return_if_fail (cell != NULL);
221
222 cell->get_string = get_string;
223}
DoclinkcellStringGetter get_string
Default flag for unknown user input.
Definition doclinkcell.h:62

◆ gnc_doclink_cell_set_use_glyphs()

void gnc_doclink_cell_set_use_glyphs ( Doclinkcell cell)

Definition at line 264 of file doclinkcell.c.

265{
266#ifdef MAC_INTEGRATION
267 cell->use_glyphs = FALSE;
268#else
269 gboolean use_glyphs = TRUE;
270 gchar *test_text;
271 GtkWidget *label;
272 PangoLayout *test_layout;
273 gint count;
274
275 g_return_if_fail (cell != NULL);
276
277 label = gtk_label_new (NULL);
278 test_text = g_strconcat (GLYPH_LINK, ",", GLYPH_PAPERCLIP, NULL);
279 test_layout = gtk_widget_create_pango_layout (GTK_WIDGET (label), test_text);
280
281 pango_layout_set_text (test_layout, test_text, strlen (test_text));
282
283 count = pango_layout_get_unknown_glyphs_count (test_layout);
284
285 if (count != 0)
286 use_glyphs = FALSE;
287
288 g_object_unref (test_layout);
289 g_free (test_text);
290
291 cell->use_glyphs = use_glyphs;
292#endif
293}

◆ gnc_doclink_cell_set_valid_flags()

void gnc_doclink_cell_set_valid_flags ( Doclinkcell cell,
const char *  flags,
char  default_flag 
)

note that

Parameters
flagsis 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 Doclinkcell objects that use the same set of flags.

Definition at line 236 of file doclinkcell.c.

238{
239 g_return_if_fail (cell != NULL);
240 g_return_if_fail (flags != NULL);
241
242 cell->valid_flags = (char *)flags;
243 cell->default_flag = default_flag;
244}
char * valid_flags
The actual flag value.
Definition doclinkcell.h:58
char default_flag
Automatic flag selection order.
Definition doclinkcell.h:60

◆ gnc_doclink_get_glyph_from_flag()

const char * gnc_doclink_get_glyph_from_flag ( char  link_flag)

Definition at line 53 of file doclinkcell.c.

54{
55 switch (link_flag)
56 {
57 case WLINK:
58 return GLYPH_LINK;
59 case FLINK:
60 return GLYPH_PAPERCLIP;
61 default:
62 return " ";
63 }
64}

◆ gnc_doclink_get_use_glyphs()

gboolean gnc_doclink_get_use_glyphs ( Doclinkcell cell)

Definition at line 78 of file doclinkcell.c.

79{
80 return cell->use_glyphs;
81}

◆ gnc_formula_cell_new()

BasicCell * gnc_formula_cell_new ( void  )

Definition at line 63 of file formulacell.c.

64{
65 FormulaCell *fc = g_new0( FormulaCell, 1 );
66 gnc_formula_cell_init( fc );
67 return &fc->cell;
68}
The FormulaCell is a register-table cell which can contain a formula involving numbers,...
Definition formulacell.h:43

◆ gnc_formula_cell_set_value()

void gnc_formula_cell_set_value ( FormulaCell fc,
const char *  newVal 
)

Definition at line 85 of file formulacell.c.

87{
88 DEBUG("got value [%s]", newVal);
89 gnc_formula_cell_set_value_internal( &fc->cell, newVal );
90}
#define DEBUG(format, args...)
Print a debugging message.
Definition qoflog.h:264

◆ gnc_num_cell_new()

BasicCell * gnc_num_cell_new ( void  )

Definition at line 178 of file numcell.c.

179{
180 NumCell *cell;
181
182 cell = g_new0 (NumCell, 1);
183
184 gnc_num_cell_init (cell);
185
186 return &cell->cell;
187}
The NumCell object implements a number handling cell.
Definition numcell.h:40

◆ gnc_num_cell_set_last_num()

gboolean gnc_num_cell_set_last_num ( NumCell cell,
const char *  str 
)

Definition at line 215 of file numcell.c.

216{
217 long int number;
218
219 if (!cell)
220 return FALSE;
221
222 if (gnc_parse_num (str, &number))
223 {
224 cell->next_num = number + 1;
225 cell->next_num_set = TRUE;
226 return TRUE;
227 }
228
229 return FALSE;
230}

◆ gnc_num_cell_set_value()

void gnc_num_cell_set_value ( NumCell cell,
const char *  str 
)

Definition at line 206 of file numcell.c.

207{
208 if (!cell)
209 return;
210
211 gnc_num_cell_set_value_internal (&cell->cell, str);
212}

◆ gnc_price_cell_blank()

void gnc_price_cell_blank ( PriceCell cell)

Sets the cell as blank, regardless of the blank_zero value.

Definition at line 251 of file pricecell.c.

252{
253 if (cell == NULL)
254 return;
255
256 cell->amount = gnc_numeric_zero ();
257 cell->need_to_parse = FALSE;
258
259 gnc_basic_cell_set_value_internal (&cell->cell, "");
260}
gboolean need_to_parse
amount printing context
Definition pricecell.h:61

◆ gnc_price_cell_get_value()

gnc_numeric gnc_price_cell_get_value ( PriceCell cell)

return the value of a price cell

Definition at line 208 of file pricecell.c.

209{
210 if (cell == NULL)
211 return gnc_numeric_zero ();
212
213 gnc_price_cell_parse (cell, FALSE);
214
215 return cell->amount;
216}

◆ gnc_price_cell_new()

BasicCell * gnc_price_cell_new ( void  )

installs a callback to handle price recording

Definition at line 168 of file pricecell.c.

169{
170 PriceCell *cell;
171
172 cell = g_new0 (PriceCell, 1);
173
174 gnc_price_cell_init (cell);
175
176 return &cell->cell;
177}
The PriceCell object implements a cell handler that stores a single double-precision value,...
Definition pricecell.h:55

◆ gnc_price_cell_set_blank_zero()

void gnc_price_cell_set_blank_zero ( PriceCell cell,
gboolean  blank_zero 
)

determines whether 0 values are left blank or printed.

defaults to true.

Definition at line 263 of file pricecell.c.

264{
265 if (cell == NULL)
266 return;
267
268 cell->blank_zero = blank_zero;
269}
gboolean blank_zero
fraction used for rounding, if 0 no rounding
Definition pricecell.h:59

◆ gnc_price_cell_set_debt_credit_value()

void gnc_price_cell_set_debt_credit_value ( PriceCell debit,
PriceCell credit,
gnc_numeric  amount 
)

updates two cells; the deb cell if amt is negative, the credit cell if amount is positive, and makes the other cell blank.

Definition at line 281 of file pricecell.c.

284{
285 /* debits are positive, credits are negative */
286 if (gnc_numeric_positive_p (amount))
287 {
288 gnc_price_cell_set_value (debit, amount);
289 gnc_price_cell_set_value (credit, gnc_numeric_zero ());
290 }
291 else
292 {
293 gnc_price_cell_set_value (debit, gnc_numeric_zero ());
294 gnc_price_cell_set_value (credit, gnc_numeric_neg (amount));
295 }
296}
gboolean gnc_price_cell_set_value(PriceCell *cell, gnc_numeric amount)
updates amount, returns TRUE if string representation actually changed
Definition pricecell.c:219
gnc_numeric gnc_numeric_neg(gnc_numeric a)
Returns a newly created gnc_numeric that is the negative of the given gnc_numeric value.
gboolean gnc_numeric_positive_p(gnc_numeric a)
Returns 1 if a > 0, otherwise returns 0.

◆ gnc_price_cell_set_fraction()

void gnc_price_cell_set_fraction ( PriceCell cell,
int  fraction 
)

Sets the fraction used for rounding.

If 0, no rounding is performed.

Definition at line 242 of file pricecell.c.

243{
244 if (cell == NULL)
245 return;
246
247 cell->fraction = ABS (fraction);
248}
int fraction
the amount associated with this cell
Definition pricecell.h:58

◆ gnc_price_cell_set_print_info()

void gnc_price_cell_set_print_info ( PriceCell cell,
GNCPrintAmountInfo  print_info 
)

set the printing context of the price cell

Definition at line 272 of file pricecell.c.

273{
274 if (cell == NULL)
275 return;
276
277 cell->print_info = print_info;
278}
GNCPrintAmountInfo print_info
controls printing of zero values
Definition pricecell.h:60

◆ gnc_price_cell_set_value()

gboolean gnc_price_cell_set_value ( PriceCell cell,
gnc_numeric  amount 
)

updates amount, returns TRUE if string representation actually changed

Definition at line 219 of file pricecell.c.

220{
221 const char *buff;
222
223 if (cell == NULL)
224 return FALSE;
225
226 if (cell->fraction > 0)
227 amount = gnc_numeric_convert (amount, cell->fraction, GNC_HOW_RND_ROUND_HALF_UP);
228
229 cell->amount = amount;
230 buff = gnc_price_cell_print_value (cell);
231 cell->need_to_parse = FALSE;
232
233 if (g_strcmp0 (buff, cell->cell.value) == 0)
234 return FALSE;
235
236 gnc_basic_cell_set_value_internal (&cell->cell, buff);
237
238 return TRUE;
239}

◆ gnc_quickfill_cell_add_completion()

void gnc_quickfill_cell_add_completion ( QuickFillCell cell,
const char *  completion 
)

Definition at line 337 of file quickfillcell.c.

338{
339 if (cell == NULL)
340 return;
341
342 gnc_quickfill_insert (cell->qf, completion, cell->sort);
343}
QuickFillSort sort
quickfill-tree handled by this cell

◆ gnc_quickfill_cell_new()

BasicCell * gnc_quickfill_cell_new ( void  )

Definition at line 292 of file quickfillcell.c.

293{
294 QuickFillCell *cell;
295
296 cell = g_new0 (QuickFillCell, 1);
297
298 gnc_quickfill_cell_init (cell);
299
300 return &cell->cell;
301}
The QuickFillCell implements a text cell with quick-fill capabilities.

◆ gnc_quickfill_cell_set_sort()

void gnc_quickfill_cell_set_sort ( QuickFillCell cell,
QuickFillSort  sort 
)

Definition at line 314 of file quickfillcell.c.

315{
316 if (cell == NULL)
317 return;
318
319 cell->sort = sort;
320}

◆ gnc_quickfill_cell_set_value()

void gnc_quickfill_cell_set_value ( QuickFillCell cell,
const char *  value 
)

sets the current cell value to the indicated string, simultaneously adding the string to the quick-fill tree.

Definition at line 304 of file quickfillcell.c.

305{
306 if (cell == NULL)
307 return;
308
309 gnc_basic_cell_set_value_internal (&cell->cell, value);
310 gnc_quickfill_insert (cell->qf, value, cell->sort);
311}

◆ gnc_quickfill_cell_use_quickfill_cache()

void gnc_quickfill_cell_use_quickfill_cache ( QuickFillCell cell,
QuickFill *  shared_qf 
)

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.

Definition at line 346 of file quickfillcell.c.

347{
348 g_assert(cell);
349 g_assert(shared_qf);
350
351 if (!cell->use_quickfill_cache)
352 {
353 cell->use_quickfill_cache = TRUE;
354 gnc_quickfill_destroy (cell->qf);
355 }
356 cell->qf = shared_qf;
357}
gboolean use_quickfill_cache
original string entered in original case

◆ gnc_recn_cell_get_flag()

char gnc_recn_cell_get_flag ( RecnCell cell)

Definition at line 170 of file recncell.c.

171{
172 g_return_val_if_fail (cell != NULL, '\0');
173
174 return cell->flag;
175}

◆ gnc_recn_cell_new()

BasicCell * gnc_recn_cell_new ( void  )

Definition at line 124 of file recncell.c.

125{
126 RecnCell * cell;
127
128 cell = g_new0 (RecnCell, 1);
129
130 gnc_recn_cell_init (cell);
131
132 return &cell->cell;
133}
The RecnCell object implements a cell handler that will cycle through a series of single-character va...
Definition recncell.h:48

◆ gnc_recn_cell_set_confirm_cb()

void gnc_recn_cell_set_confirm_cb ( RecnCell cell,
RecnCellConfirm  confirm_cb,
gpointer  data 
)

Definition at line 186 of file recncell.c.

188{
189 g_return_if_fail (cell != NULL);
190
191 cell->confirm_cb = confirm_cb;
192 cell->confirm_data = data;
193}

◆ gnc_recn_cell_set_flag()

void gnc_recn_cell_set_flag ( RecnCell cell,
char  flag 
)

Definition at line 157 of file recncell.c.

158{
159 const char *string;
160
161 g_return_if_fail (cell != NULL);
162
163 cell->flag = flag;
164 string = gnc_recn_cell_get_string (cell, flag);
165
166 gnc_basic_cell_set_value_internal (&cell->cell, string);
167}

◆ gnc_recn_cell_set_flag_order()

void gnc_recn_cell_set_flag_order ( RecnCell cell,
const char *  flags 
)

Definition at line 207 of file recncell.c.

208{
209 g_return_if_fail (cell != NULL);
210 g_return_if_fail (flags != NULL);
211
212 cell->flag_order = (char *)flags;
213}
char * flag_order
The list of valid flags.
Definition recncell.h:54

◆ gnc_recn_cell_set_read_only()

void gnc_recn_cell_set_read_only ( RecnCell cell,
gboolean  read_only 
)

Definition at line 216 of file recncell.c.

217{
218 g_return_if_fail (cell != NULL);
219 cell->read_only = read_only;
220}

◆ gnc_recn_cell_set_string_getter()

void gnc_recn_cell_set_string_getter ( RecnCell cell,
RecnCellStringGetter  getter 
)

Definition at line 178 of file recncell.c.

180{
181 g_return_if_fail (cell != NULL);
182 cell->get_string = get_string;
183}
RecnCellStringGetter get_string
Default flag for unknown user input.
Definition recncell.h:57

◆ gnc_recn_cell_set_valid_flags()

void gnc_recn_cell_set_valid_flags ( RecnCell cell,
const char *  flags,
char  default_flag 
)

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

Definition at line 196 of file recncell.c.

198{
199 g_return_if_fail (cell != NULL);
200 g_return_if_fail (flags != NULL);
201
202 cell->valid_flags = (char *)flags;
203 cell->default_flag = default_flag;
204}
char * valid_flags
The actual flag value.
Definition recncell.h:53
char default_flag
Automatic flag selection order.
Definition recncell.h:55