GnuCash  4.12-68-g5dc52459a1+
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  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. More...
 
void gnc_combo_cell_add_account_menu_item (ComboCell *cell, char *menustr)
 Add a 'account name' menu item to the list. More...
 
void gnc_combo_cell_set_sort_enabled (ComboCell *cell, gboolean enabled)
 Enable sorting of the menu item's contents. More...
 
void gnc_combo_cell_set_strict (ComboCell *cell, gboolean strict)
 Determines whether the cell will accept strings not in the menu. More...
 
void gnc_combo_cell_set_complete_char (ComboCell *cell, gunichar complete_char)
 Sets a character used for special completion processing. More...
 
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'. More...
 
void gnc_combo_cell_set_autosize (ComboCell *cell, gboolean autosize)
 Determines whether the popup list autosizes itself or uses all available space. More...
 
void gnc_combo_cell_use_quickfill_cache (ComboCell *cell, QuickFill *shared_qf)
 Tell the combocell to use a shared QuickFill object. More...
 
void gnc_combo_cell_use_list_store_cache (ComboCell *cell, gpointer data)
 
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. More...
 
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. More...
 
void gnc_date_cell_commit (DateCell *cell)
 Commits any pending changes to the value of the cell. More...
 
void gnc_date_cell_get_date (DateCell *cell, time64 *time, gboolean warn)
 Set a time64 to the value in the DateCell. More...
 
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 More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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).

Function Documentation

◆ 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 462 of file combocell-gnome.c.

463 {
464  PopBox* box;
465 
466  if (cell == NULL)
467  return;
468  if (menustr == NULL)
469  return;
470 
471  box = cell->cell.gui_private;
472 
473  if (box->item_list != NULL)
474  {
475  block_list_signals (cell);
476 
477  gnc_item_list_append (box->item_list, menustr);
478  if (cell->cell.value)
479  {
480  gchar* menu_copy = g_strdup (menustr);
481  gchar* value_copy = g_strdup (cell->cell.value);
482  g_strdelimit (menu_copy, "-:/\\.", ' ');
483  g_strdelimit (value_copy, "-:/\\.", ' ');
484  if (strcmp (menu_copy, value_copy) == 0)
485  {
486  gnc_combo_cell_set_value (cell, menustr);
487  gnc_item_list_select (box->item_list, menustr);
488  }
489  g_free (value_copy);
490  g_free (menu_copy);
491  }
492  unblock_list_signals (cell);
493  }
494 
495  /* If we're going to be using a pre-fab quickfill,
496  * then don't fill it in here */
497  if (FALSE == box->use_quickfill_cache)
498  {
499  gnc_quickfill_insert (box->qf, menustr, QUICKFILL_ALPHA);
500  }
501 }
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 1096 of file combocell-gnome.c.

1098 {
1099  PopBox* box;
1100 
1101  if (cell == NULL)
1102  return;
1103 
1104  if (!ignore_string)
1105  return;
1106 
1107  box = cell->cell.gui_private;
1108 
1109  box->ignore_strings = g_list_prepend (box->ignore_strings,
1110  g_strdup (ignore_string));
1111 }

◆ 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 423 of file combocell-gnome.c.

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

1115 {
1116  PopBox* box;
1117 
1118  if (!cell)
1119  return;
1120 
1121  box = cell->cell.gui_private;
1122  if (!box)
1123  return;
1124 
1125  box->autosize = autosize;
1126 }

◆ 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 1083 of file combocell-gnome.c.

1084 {
1085  PopBox* box;
1086 
1087  if (cell == NULL)
1088  return;
1089 
1090  box = cell->cell.gui_private;
1091 
1092  box->complete_char = complete_char;
1093 }

◆ 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 348 of file combocell-gnome.c.

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

◆ 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 1070 of file combocell-gnome.c.

1071 {
1072  PopBox* box;
1073 
1074  if (cell == NULL)
1075  return;
1076 
1077  box = cell->cell.gui_private;
1078 
1079  box->strict = strict;
1080 }

◆ 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 397 of file combocell-gnome.c.

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

◆ 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 461 of file datecell-gnome.c.

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

◆ 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 720 of file datecell-gnome.c.

721 {
722  PopBox *box = cell->cell.gui_private;
723  if (!cell || !time)
724  return;
725 
726  gnc_parse_date (&(box->date), cell->cell.value, warn);
727  *time = gnc_mktime (&box->date);
728 }
time64 gnc_mktime(struct tm *time)
calculate seconds from the epoch given a time struct
Definition: gnc-date.cpp:230

◆ 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 405 of file datecell-gnome.c.

406 {
407  PopBox *box = cell->cell.gui_private;
408  struct tm dada;
409  char buff[DATE_BUF];
410 
411  dada.tm_mday = day;
412  dada.tm_mon = mon - 1;
413  dada.tm_year = year - 1900;
414 
415  gnc_tm_set_day_start(&dada);
416  gnc_mktime (&dada);
417 
418  box->date.tm_mday = dada.tm_mday;
419  box->date.tm_mon = dada.tm_mon;
420  box->date.tm_year = dada.tm_year;
421 
422  qof_print_date_dmy_buff (buff, MAX_DATE_LENGTH, dada.tm_mday, dada.tm_mon + 1, dada.tm_year + 1900);
423 
424  gnc_basic_cell_set_value_internal (&cell->cell, buff);
425 
426  if (!box->date_picker)
427  return;
428 
429  block_picker_signals (cell);
430  gnc_date_picker_set_date (box->date_picker, day, mon - 1, year);
431  unblock_picker_signals (cell);
432 }
size_t qof_print_date_dmy_buff(gchar *buff, size_t buflen, int day, int month, int year)
qof_print_date_dmy_buff Convert a date as day / month / year integers into a localized string represe...
time64 gnc_mktime(struct tm *time)
calculate seconds from the epoch given a time struct
Definition: gnc-date.cpp:230
#define MAX_DATE_LENGTH
The maximum length of a string created by the date printers.
Definition: gnc-date.h:114

◆ 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 435 of file datecell-gnome.c.

436 {
437  PopBox *box = cell->cell.gui_private;
438  char buff[DATE_BUF];
439 
440  gnc_localtime_r (&secs, &(box->date));
441 
443  box->date.tm_mday,
444  box->date.tm_mon + 1,
445  box->date.tm_year + 1900);
446 
447  gnc_basic_cell_set_value_internal (&cell->cell, buff);
448 
449  if (!box->date_picker)
450  return;
451 
452  block_picker_signals (cell);
453  gnc_date_picker_set_date (box->date_picker,
454  box->date.tm_mday,
455  box->date.tm_mon,
456  box->date.tm_year + 1900);
457  unblock_picker_signals (cell);
458 }
size_t qof_print_date_dmy_buff(gchar *buff, size_t buflen, int day, int month, int year)
qof_print_date_dmy_buff Convert a date as day / month / year integers into a localized string represe...
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:117
#define MAX_DATE_LENGTH
The maximum length of a string created by the date printers.
Definition: gnc-date.h:114

◆ 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_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:55

◆ 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 }
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.
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_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:54

◆ 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 350 of file quickfillcell.c.

351 {
352  g_assert(cell);
353  g_assert(shared_qf);
354 
355  if (!cell->use_quickfill_cache)
356  {
357  cell->use_quickfill_cache = TRUE;
358  gnc_quickfill_destroy (cell->qf);
359  }
360  cell->qf = shared_qf;
361 }
gboolean use_quickfill_cache
original string entered in original case
Definition: quickfillcell.h:53

◆ 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 default_flag
Automatic flag selection order.
Definition: recncell.h:55
char * valid_flags
The actual flag value.
Definition: recncell.h:53