|
GnuCash c935c2f+
|
Files | |
| file | gnc-ui-util.h |
| utility functions for the GnuCash UI | |
Data Structures | |
| struct | GNCPrintAmountInfo |
Macros | |
| #define | GNC_PREFS_GROUP_OPEN_SAVE "dialogs.open-save" |
| #define | GNC_PREFS_GROUP_EXPORT "dialogs.export-accounts" |
| #define | GNC_PREFS_GROUP_REPORT "dialogs.report" |
| #define | GNC_PREF_AUTO_DECIMAL_POINT "auto-decimal-point" |
| #define | GNC_PREF_AUTO_DECIMAL_PLACES "auto-decimal-places" |
| #define | WLINK 'w' |
| #define | FLINK 'f' |
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. | |
| 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. | |
| 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. | |
| 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. | |
| const char * | gnc_get_doclink_flag_order (void) |
| Get a string containing document link flag order. | |
| const char * | gnc_get_doclink_str (char link_flag) |
| Get a string representing the document link type. | |
| 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. | |
| gnc_commodity * | gnc_locale_default_currency (void) |
| Returns the default currency of the current locale. | |
| gnc_commodity * | gnc_default_currency (void) |
| Return the default currency set by the user. | |
| 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. | |
| gnc_commodity * | gnc_default_report_currency (void) |
| Return the default currency for use in reports, as set by the user. | |
| 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. | |
| int | xaccSPrintAmount (char *buf, gnc_numeric val, GNCPrintAmountInfo info) |
| Make a string representation of a gnc_numeric. | |
| 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. | |
| 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. | |
| gboolean | xaccParseAmountImport (const char *in_str, gboolean monetary, gnc_numeric *result, char **endstr, gboolean skip) |
| Similar to xaccParseAmount, but with two differences. | |
| 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. | |
| const char * | gnc_print_amount_with_bidi_ltr_isolate (gnc_numeric val, GNCPrintAmountInfo info) |
| Make a string representation of a gnc_numeric. | |
| char * | gnc_wrap_text_with_bidi_ltr_isolate (const char *text) |
| This function helps with GTK's use of 'Unicode Bidirectional Text Algorithm'. | |
| void | gnc_ui_util_init (void) |
| void | gnc_ui_util_remove_registered_prefs (void) |
| char * | gnc_filter_text_for_bidi_marks (const char *incoming_text) |
| Returns the incoming text with Unicode bidi control characters removed. | |
| char * | gnc_filter_text_for_control_chars (const char *incoming_text) |
| Returns the incoming text removed of control characters. | |
| 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. | |
| char * | gnc_filter_text_for_currency_symbol (const char *incoming_text, const char *symbol) |
| Returns the incoming text removed of a currency symbol. | |
| 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. | |
| gchar * | gnc_list_formatter (GList *strings) |
| This function takes a GList of char*, and uses locale-sensitive list formatter. | |
| #define FLINK 'f' |
Definition at line 155 of file gnc-ui-util.h.
| #define GNC_PREF_AUTO_DECIMAL_PLACES "auto-decimal-places" |
Definition at line 63 of file gnc-ui-util.h.
| #define GNC_PREF_AUTO_DECIMAL_POINT "auto-decimal-point" |
Definition at line 62 of file gnc-ui-util.h.
| #define GNC_PREFS_GROUP_EXPORT "dialogs.export-accounts" |
Definition at line 60 of file gnc-ui-util.h.
| #define GNC_PREFS_GROUP_OPEN_SAVE "dialogs.open-save" |
Definition at line 59 of file gnc-ui-util.h.
| #define GNC_PREFS_GROUP_REPORT "dialogs.report" |
Definition at line 61 of file gnc-ui-util.h.
| #define WLINK 'w' |
Definition at line 154 of file gnc-ui-util.h.
| typedef QofSession *(* QofSessionCB) (void) |
Definition at line 47 of file gnc-ui-util.h.
| enum GNCEquityType |
Definition at line 177 of file gnc-ui-util.h.
| gboolean gnc_account_create_opening_balance | ( | Account * | account, |
| gnc_numeric | balance, | ||
| time64 | date, | ||
| QofBook * | book | ||
| ) |
Definition at line 667 of file gnc-ui-util.cpp.
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 449 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 789 of file gnc-ui-util.cpp.
| GNCPrintAmountInfo gnc_account_print_info | ( | const Account * | account, |
| gboolean | use_symbol | ||
| ) |
Definition at line 956 of file gnc-ui-util.cpp.
| 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.
Definition at line 4709 of file gnc-main-window.cpp.
| GNCPrintAmountInfo gnc_commodity_print_info | ( | const gnc_commodity * | commodity, |
| gboolean | use_symbol | ||
| ) |
Definition at line 886 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 782 of file gnc-ui-util.cpp.
| GNCPrintAmountInfo gnc_default_price_print_info | ( | const gnc_commodity * | curr | ) |
Definition at line 1060 of file gnc-ui-util.cpp.
| GNCPrintAmountInfo gnc_default_print_info | ( | gboolean | use_symbol | ) |
Definition at line 834 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 818 of file gnc-ui-util.cpp.
| GNCPrintAmountInfo gnc_default_share_print_info | ( | void | ) |
Definition at line 997 of file gnc-ui-util.cpp.
| char * gnc_filter_text_for_bidi_marks | ( | const char * | incoming_text | ) |
Returns the incoming text with Unicode bidi control characters removed.
Strips directional marks (U+200E, U+200F), embedding/override codes (U+202A–U+202E), isolate codes (U+2066–U+2069) and the Arabic letter mark (U+061C) that GnuCash inserts for RTL display, so that values copied to the clipboard are clean plain text.
| incoming_text | The text to filter (may be NULL) |
Definition at line 2158 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 2190 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 2292 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 2271 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 |
| Account * gnc_find_or_create_equity_account | ( | Account * | root, |
| GNCEquityType | equity_type, | ||
| gnc_commodity * | currency | ||
| ) |
Definition at line 564 of file gnc-ui-util.cpp.
| 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 439 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 429 of file gnc-ui-util.cpp.
| QofBook * gnc_get_current_book | ( | void | ) |
Definition at line 208 of file gnc-ui-util.cpp.
| const char * gnc_get_current_book_tax_name | ( | void | ) |
Definition at line 328 of file gnc-ui-util.cpp.
| const char * gnc_get_current_book_tax_type | ( | void | ) |
Definition at line 371 of file gnc-ui-util.cpp.
| gnc_commodity_table * gnc_get_current_commodities | ( | void | ) |
Definition at line 421 of file gnc-ui-util.cpp.
| Account * gnc_get_current_root_account | ( | void | ) |
Definition at line 415 of file gnc-ui-util.cpp.
| char * gnc_get_default_directory | ( | const char * | section | ) |
Definition at line 186 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 541 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 517 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 534 of file gnc-ui-util.cpp.
| const char * gnc_get_reconcile_flag_order | ( | void | ) |
Definition at line 510 of file gnc-ui-util.cpp.
| const char * gnc_get_reconcile_str | ( | char | reconciled_flag | ) |
Definition at line 469 of file gnc-ui-util.cpp.
| const char * gnc_get_reconcile_valid_flags | ( | void | ) |
| GNCPrintAmountInfo gnc_integral_print_info | ( | void | ) |
Definition at line 1067 of file gnc-ui-util.cpp.
| gboolean gnc_is_new_book | ( | void | ) |
Definition at line 222 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 2317 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 737 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 724 of file gnc-ui-util.cpp.
| GNCPrintAmountInfo gnc_price_print_info | ( | const gnc_commodity * | curr, |
| gboolean | use_symbol | ||
| ) |
Definition at line 1026 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 1447 of file gnc-ui-util.cpp.
| gboolean gnc_reverse_balance | ( | const Account * | account | ) |
Definition at line 160 of file gnc-ui-util.cpp.
| void gnc_set_current_book_tax_name_type | ( | gboolean | name_changed, |
| const char * | tax_name, | ||
| gboolean | type_changed, | ||
| const char * | tax_type | ||
| ) |
Definition at line 234 of file gnc-ui-util.cpp.
| void gnc_set_default_directory | ( | const char * | section, |
| const char * | directory | ||
| ) |
Definition at line 202 of file gnc-ui-util.cpp.
| void gnc_set_use_equity_type_opening_balance_account | ( | QofBook * | book | ) |
Definition at line 180 of file gnc-ui-util.cpp.
| GNCPrintAmountInfo gnc_share_print_info_places | ( | int | decplaces | ) |
Definition at line 1013 of file gnc-ui-util.cpp.
| GNCPrintAmountInfo gnc_split_amount_print_info | ( | Split * | split, |
| gboolean | use_symbol | ||
| ) |
Definition at line 964 of file gnc-ui-util.cpp.
| void gnc_ui_util_init | ( | void | ) |
Definition at line 2083 of file gnc-ui-util.cpp.
| void gnc_ui_util_remove_registered_prefs | ( | void | ) |
Definition at line 2116 of file gnc-ui-util.cpp.
| gboolean gnc_using_equity_type_opening_balance_account | ( | QofBook * | book | ) |
Definition at line 175 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 1488 of file gnc-ui-util.cpp.
| char * numeric_to_words | ( | gnc_numeric | val | ) |
Definition at line 1641 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 2015 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 2033 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 2045 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 2023 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 1434 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 1307 of file gnc-ui-util.cpp.