GnuCash
5.6-150-g038405b370+
|
Files | |
file | gnc-ui-util.h |
utility functions for the GnuCash UI | |
Data Structures | |
struct | GNCPrintAmountInfo |
Typedefs | |
typedef QofSession *(* | QofSessionCB) (void) |
Enumerations | |
enum | GNCEquityType { EQUITY_OPENING_BALANCE, EQUITY_RETAINED_EARNINGS, NUM_EQUITY_TYPES } |
Functions | |
char * | gnc_normalize_account_separator (const char *separator) |
gboolean | gnc_reverse_balance (const Account *account) |
void | gnc_set_use_equity_type_opening_balance_account (QofBook *book) |
gboolean | gnc_using_equity_type_opening_balance_account (QofBook *book) |
char * | gnc_get_default_directory (const char *section) |
void | gnc_set_default_directory (const char *section, const char *directory) |
QofBook * | gnc_get_current_book (void) |
gboolean | gnc_is_new_book (void) |
void | gnc_set_current_book_tax_name_type (gboolean name_changed, const char *tax_name, gboolean type_changed, const char *tax_type) |
const char * | gnc_get_current_book_tax_name (void) |
const char * | gnc_get_current_book_tax_type (void) |
void | gnc_book_option_num_field_source_change_cb (gboolean num_action) |
Calls gnc_book_option_num_field_source_change to initiate registered callbacks when num_field_source book option changes so that registers/reports can update themselves; sets feature flag. | |
Account * | gnc_get_current_root_account (void) |
gnc_commodity_table * | gnc_get_current_commodities (void) |
char * | gnc_get_account_name_for_register (const Account *account) |
Get either the full name of the account or the simple name, depending on the configuration parameter general/register/show_leaf_account_names. More... | |
Account * | gnc_account_lookup_for_register (const Account *base_account, const char *name) |
Retrieve the account matching the given name starting from the descendants of base_account. More... | |
char * | gnc_get_account_name_for_split_register (const Account *account, gboolean show_leaf_accounts) |
Get either the full name of the account or the simple name, depending on the show_leaf_accounts. More... | |
const char * | gnc_get_reconcile_str (char reconciled_flag) |
const char * | gnc_get_reconcile_valid_flags (void) |
const char * | gnc_get_reconcile_flag_order (void) |
const char * | gnc_get_doclink_valid_flags (void) |
Get a string containing documentation link valid flags. More... | |
const char * | gnc_get_doclink_flag_order (void) |
Get a string containing document link flag order. More... | |
const char * | gnc_get_doclink_str (char link_flag) |
Get a string representing the document link type. More... | |
Account * | gnc_find_or_create_equity_account (Account *root, GNCEquityType equity_type, gnc_commodity *currency) |
gboolean | gnc_account_create_opening_balance (Account *account, gnc_numeric balance, time64 date, QofBook *book) |
gnc_commodity * | gnc_locale_default_currency_nodefault (void) |
Returns the default currency of the current locale, or NULL if no sensible currency could be identified from the locale. More... | |
gnc_commodity * | gnc_locale_default_currency (void) |
Returns the default currency of the current locale. More... | |
gnc_commodity * | gnc_default_currency (void) |
Return the default currency set by the user. More... | |
gnc_commodity * | gnc_account_or_default_currency (const Account *account, gboolean *currency_from_account_found) |
Returns a gnc_commodity that is a currency, suitable for being a Transaction's currency. More... | |
gnc_commodity * | gnc_default_report_currency (void) |
Return the default currency for use in reports, as set by the user. More... | |
GNCPrintAmountInfo | gnc_default_print_info (gboolean use_symbol) |
GNCPrintAmountInfo | gnc_commodity_print_info (const gnc_commodity *commodity, gboolean use_symbol) |
GNCPrintAmountInfo | gnc_account_print_info (const Account *account, gboolean use_symbol) |
GNCPrintAmountInfo | gnc_split_amount_print_info (Split *split, gboolean use_symbol) |
GNCPrintAmountInfo | gnc_price_print_info (const gnc_commodity *curr, gboolean use_symbol) |
GNCPrintAmountInfo | gnc_share_print_info_places (int decplaces) |
GNCPrintAmountInfo | gnc_default_share_print_info (void) |
GNCPrintAmountInfo | gnc_default_price_print_info (const gnc_commodity *curr) |
GNCPrintAmountInfo | gnc_integral_print_info (void) |
const char * | xaccPrintAmount (gnc_numeric val, GNCPrintAmountInfo info) |
Make a string representation of a gnc_numeric. More... | |
int | xaccSPrintAmount (char *buf, gnc_numeric val, GNCPrintAmountInfo info) |
Make a string representation of a gnc_numeric. More... | |
const char * | printable_value (gdouble val, gint denom) |
char * | number_to_words (gdouble val, gint64 denom) |
char * | numeric_to_words (gnc_numeric val) |
gboolean | xaccParseAmount (const char *in_str, gboolean monetary, gnc_numeric *result, char **endstr) |
Parses in_str to obtain a numeric result. More... | |
gboolean | xaccParseAmountExtended (const char *in_str, gboolean monetary, gunichar negative_sign, gunichar decimal_point, gunichar group_separator, const char *ignore_list, gnc_numeric *result, char **endstr) |
Converts a string to a gnc_numeric. More... | |
gboolean | xaccParseAmountImport (const char *in_str, gboolean monetary, gnc_numeric *result, char **endstr, gboolean skip) |
Similar to xaccParseAmount, but with two differences. More... | |
gboolean | xaccParseAmountExtImport (const char *in_str, gboolean monetary, gunichar negative_sign, gunichar decimal_point, gunichar group_separator, const char *ignore_list, gnc_numeric *result, char **endstr) |
Similar to xaccParseAmountExtended, but will not automatically set a decimal point, regardless of what the user has set for this option. More... | |
const char * | gnc_print_amount_with_bidi_ltr_isolate (gnc_numeric val, GNCPrintAmountInfo info) |
Make a string representation of a gnc_numeric. More... | |
char * | gnc_wrap_text_with_bidi_ltr_isolate (const char *text) |
This function helps with GTK's use of 'Unicode Bidirectional Text Algorithm'. More... | |
void | gnc_ui_util_init (void) |
void | gnc_ui_util_remove_registered_prefs (void) |
char * | gnc_filter_text_for_control_chars (const char *incoming_text) |
Returns the incoming text removed of control characters. More... | |
void | gnc_filter_text_set_cursor_position (const char *incoming_text, const char *symbol, int *zcursor_position) |
Updates cursor_position after removal of currency symbols. More... | |
char * | gnc_filter_text_for_currency_symbol (const char *incoming_text, const char *symbol) |
Returns the incoming text removed of a currency symbol. More... | |
char * | gnc_filter_text_for_currency_commodity (const gnc_commodity *comm, const char *incoming_text, const char **symbol) |
Returns the incoming text removed of currency symbol. More... | |
gchar * | gnc_list_formatter (GList *strings) |
This function takes a GList of char*, and uses locale-sensitive list formatter. More... | |
Retrieve the account matching the given name starting from the descendants of base_account.
name is either considered to be the name of the leaf in the account tree or to be the full account path, depending on the configuration parameter general.register/show_leaf_account_names.
base_account | The account to start the search at. |
name | The name to search for. |
Definition at line 447 of file gnc-ui-util.cpp.
gnc_commodity* gnc_account_or_default_currency | ( | const Account * | account, |
gboolean * | currency_from_account_found | ||
) |
Returns a gnc_commodity that is a currency, suitable for being a Transaction's currency.
The gnc_commodity is taken either from the current account, or from the next parent account that has a gnc_commodity that is a currency, or from gnc_default_currency().
If the given account or any of its parent account have a commodity that is a currency, it is returned and the gboolean currency_from_account_found is set to TRUE (if non-NULL). If neither this account nor any of its parent accounts have such a commodity, gnc_default_currency() is returned and the gboolean currency_from_account_found is set to FALSE (if non-NULL). This can be used to show an appropriate warning message.
If account is NULL, gnc_default_currency() is returned and currency_from_account_found is set to FALSE.
account | The account where the currency should be looked up. May be NULL. |
currency_from_account_found | A gboolean pointer that takes the output argument of whether the returned currency was found in the account. May be NULL. |
Definition at line 787 of file gnc-ui-util.cpp.
gnc_commodity* gnc_default_currency | ( | void | ) |
Return the default currency set by the user.
If the user's preference is invalid, then this routine will return the default currency for the user's locale.
Definition at line 780 of file gnc-ui-util.cpp.
gnc_commodity* gnc_default_report_currency | ( | void | ) |
Return the default currency for use in reports, as set by the user.
If the user's preference is invalid, then this routine will return the default currency for the user's locale.
Definition at line 816 of file gnc-ui-util.cpp.
char* gnc_filter_text_for_control_chars | ( | const char * | incoming_text | ) |
Returns the incoming text removed of control characters.
incoming_text | The text to filter |
Definition at line 2161 of file gnc-ui-util.cpp.
char* gnc_filter_text_for_currency_commodity | ( | const gnc_commodity * | comm, |
const char * | incoming_text, | ||
const char ** | symbol | ||
) |
Returns the incoming text removed of currency symbol.
comm | commodity of entry if known |
incoming_text | The text to filter |
symbol | return the symbol used |
Definition at line 2263 of file gnc-ui-util.cpp.
char* gnc_filter_text_for_currency_symbol | ( | const char * | incoming_text, |
const char * | symbol | ||
) |
Returns the incoming text removed of a currency symbol.
incoming_text | The text to filter |
symbol | to remove |
cursor_position | the position of cursor in the incoming text |
Definition at line 2242 of file gnc-ui-util.cpp.
void gnc_filter_text_set_cursor_position | ( | const char * | incoming_text, |
const char * | symbol, | ||
int * | zcursor_position | ||
) |
Updates cursor_position after removal of currency symbols.
incoming_text | The text to filter |
symbol | to remove |
cursor_position | the position of cursor in the incoming text |
char* gnc_get_account_name_for_register | ( | const Account * | account | ) |
Get either the full name of the account or the simple name, depending on the configuration parameter general/register/show_leaf_account_names.
account | The account to retrieve the name for. |
Definition at line 437 of file gnc-ui-util.cpp.
char* gnc_get_account_name_for_split_register | ( | const Account * | account, |
gboolean | show_leaf_accounts | ||
) |
Get either the full name of the account or the simple name, depending on the show_leaf_accounts.
account | The account to retrieve the name for. |
show_leaf_accounts | Whether the full name will be returned. |
Definition at line 427 of file gnc-ui-util.cpp.
const char* gnc_get_doclink_flag_order | ( | void | ) |
Get a string containing document link flag order.
Definition at line 539 of file gnc-ui-util.cpp.
const char* gnc_get_doclink_str | ( | char | link_flag | ) |
Get a string representing the document link type.
link_flag | The flag to convert into a string |
Definition at line 515 of file gnc-ui-util.cpp.
const char* gnc_get_doclink_valid_flags | ( | void | ) |
Get a string containing documentation link valid flags.
Definition at line 532 of file gnc-ui-util.cpp.
gchar* gnc_list_formatter | ( | GList * | strings | ) |
This function takes a GList of char*, and uses locale-sensitive list formatter.
strings | The GList* of char*. |
Definition at line 2288 of file gnc-ui-util.cpp.
gnc_commodity* gnc_locale_default_currency | ( | void | ) |
Returns the default currency of the current locale.
WATCH OUT: If no currency could be identified from the locale, this one returns "USD", but this will have nothing to do with the actual locale.
Definition at line 735 of file gnc-ui-util.cpp.
gnc_commodity* gnc_locale_default_currency_nodefault | ( | void | ) |
Returns the default currency of the current locale, or NULL if no sensible currency could be identified from the locale.
Definition at line 722 of file gnc-ui-util.cpp.
const char* gnc_print_amount_with_bidi_ltr_isolate | ( | gnc_numeric | val, |
GNCPrintAmountInfo | info | ||
) |
Make a string representation of a gnc_numeric.
Warning, the gnc_numeric is not checked for validity and the returned char* may point to random garbage.
This is the same as xaccPrintAmount but wraps the output with BiDi left to right isolate if a symbol is displayed.
Definition at line 1444 of file gnc-ui-util.cpp.
char* gnc_wrap_text_with_bidi_ltr_isolate | ( | const char * | text | ) |
This function helps with GTK's use of 'Unicode Bidirectional Text Algorithm'.
To keep the format of the text, this function wraps the text with a BiDi isolate charatcter and a BiDi closing character.
This helps with monetary values in RTL languages that display the currency symbol.
Definition at line 1485 of file gnc-ui-util.cpp.
gboolean xaccParseAmount | ( | const char * | in_str, |
gboolean | monetary, | ||
gnc_numeric * | result, | ||
char ** | endstr | ||
) |
Parses in_str to obtain a numeric result.
The routine will parse as much of in_str as it can to obtain a single number. The number is parsed using the current locale information and the 'monetary' flag. The routine will return TRUE if it successfully parsed a number and FALSE otherwise. If TRUE is returned and result is non-NULL, the value of the parsed number is stored in *result. If FALSE is returned, *result is unchanged. If TRUE is returned and endstr is non-NULL, the location of the first character in in_str not used by the parser will be returned in *endstr. If FALSE is returned and endstr is non-NULL, *endstr will point to in_str.
Definition at line 2012 of file gnc-ui-util.cpp.
gboolean xaccParseAmountExtended | ( | const char * | in_str, |
gboolean | monetary, | ||
gunichar | negative_sign, | ||
gunichar | decimal_point, | ||
gunichar | group_separator, | ||
const char * | ignore_list, | ||
gnc_numeric * | result, | ||
char ** | endstr | ||
) |
Converts a string to a gnc_numeric.
The caller must provide all the locale-specific information.
ignore_list is a list of characters that are completely ignored while processing the input string. If ignore_list is NULL, nothing is ignored.
Definition at line 2030 of file gnc-ui-util.cpp.
gboolean xaccParseAmountExtImport | ( | const char * | in_str, |
gboolean | monetary, | ||
gunichar | negative_sign, | ||
gunichar | decimal_point, | ||
gunichar | group_separator, | ||
const char * | ignore_list, | ||
gnc_numeric * | result, | ||
char ** | endstr | ||
) |
Similar to xaccParseAmountExtended, but will not automatically set a decimal point, regardless of what the user has set for this option.
Primarily meant for cases where numbers are coming into gnucash that are not typed in by the user (like via csv import).
Definition at line 2042 of file gnc-ui-util.cpp.
gboolean xaccParseAmountImport | ( | const char * | in_str, |
gboolean | monetary, | ||
gnc_numeric * | result, | ||
char ** | endstr, | ||
gboolean | skip | ||
) |
Similar to xaccParseAmount, but with two differences.
Definition at line 2020 of file gnc-ui-util.cpp.
const char* xaccPrintAmount | ( | gnc_numeric | val, |
GNCPrintAmountInfo | info | ||
) |
Make a string representation of a gnc_numeric.
Warning, the gnc_numeric is not checked for validity and the returned char* may point to random garbage.
Definition at line 1431 of file gnc-ui-util.cpp.
int xaccSPrintAmount | ( | char * | bufp, |
gnc_numeric | val, | ||
GNCPrintAmountInfo | info | ||
) |
Make a string representation of a gnc_numeric.
Warning, the gnc_numeric is not checked for validity and the contents of the buffer will be unchanged. It is up to the calling function to ensure that buf is large enough for the results.
bufp | Should be at least 64 chars. |
Definition at line 1304 of file gnc-ui-util.cpp.