mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Added currency editor widget.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@2370 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
7011321677
commit
7567cbc990
16
ChangeLog
16
ChangeLog
@ -1,3 +1,19 @@
|
||||
2000-05-23 Dave Peticolas <peticola@cs.ucdavis.edu>
|
||||
|
||||
* src/scm/options.scm: add a currency option type.
|
||||
|
||||
* src/gnome/dialog-options.c: add support for currency options.
|
||||
|
||||
* src/gnome/dialog-utils.c (gnc_ui_account_field_box_create): used
|
||||
the new currency editor widget.
|
||||
|
||||
* src/gnome/gnc-currency-edit.c: new widget for picking currencies.
|
||||
|
||||
2000-05-22 Dave Peticolas <peticola@cs.ucdavis.edu>
|
||||
|
||||
* src/guile/guile-util.c (gnc_depend): new function to access the
|
||||
gnc:depend guile function.
|
||||
|
||||
2000-05-21 Dave Peticolas <peticola@cs.ucdavis.edu>
|
||||
|
||||
* src/gnome/window-reconcile.c: use share balances when
|
||||
|
@ -68,7 +68,7 @@ GNOME_SRCS := top-level.c window-main.c window-register.c window-adjust.c \
|
||||
dialog-options.c dialog-filebox.c dialog-transfer.c \
|
||||
dialog-add.c dialog-edit.c dialog-utils.c \
|
||||
extensions.c query-user.c reconcile-list.c \
|
||||
window-report.c gnc-dateedit.c \
|
||||
window-report.c gnc-dateedit.c gnc-currency-edit.c \
|
||||
dialog-qif-import.c glade-gnc-dialogs.c gnc-datedelta.c \
|
||||
dialog-account-picker.c print-session.c file-history.c \
|
||||
dialog-print-check.c dialog-find-transactions.c
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "gnc-helpers.h"
|
||||
#include "account-tree.h"
|
||||
#include "gnc-dateedit.h"
|
||||
#include "gnc-currency-edit.h"
|
||||
#include "global-options.h"
|
||||
#include "query-user.h"
|
||||
#include "window-help.h"
|
||||
@ -91,6 +92,18 @@ gnc_option_set_ui_value(GNCOption *option, gboolean use_default)
|
||||
else
|
||||
bad_value = TRUE;
|
||||
}
|
||||
else if (safe_strcmp(type, "currency") == 0)
|
||||
{
|
||||
if (gh_string_p(value))
|
||||
{
|
||||
char *string = gh_scm2newstr(value, NULL);
|
||||
gnc_currency_edit_set_currency(GNC_CURRENCY_EDIT(option->widget),
|
||||
string);
|
||||
free(string);
|
||||
}
|
||||
else
|
||||
bad_value = TRUE;
|
||||
}
|
||||
else if (safe_strcmp(type, "multichoice") == 0)
|
||||
{
|
||||
int index;
|
||||
@ -241,6 +254,16 @@ gnc_option_get_ui_value(GNCOption *option)
|
||||
result = gh_str02scm(string);
|
||||
g_free(string);
|
||||
}
|
||||
else if (safe_strcmp(type, "currency") == 0)
|
||||
{
|
||||
GtkEditable *editable;
|
||||
char * string;
|
||||
|
||||
editable = GTK_EDITABLE(GTK_COMBO(option->widget)->entry);
|
||||
string = gtk_editable_get_chars(editable, 0, -1);
|
||||
result = gh_str02scm(string);
|
||||
g_free(string);
|
||||
}
|
||||
else if (safe_strcmp(type, "multichoice") == 0)
|
||||
{
|
||||
gpointer _index;
|
||||
@ -797,6 +820,35 @@ gnc_option_set_ui_widget(GNCOption *option,
|
||||
gnc_option_create_default_button(option, tooltips),
|
||||
FALSE, FALSE, 0);
|
||||
}
|
||||
else if (safe_strcmp(type, "currency") == 0)
|
||||
{
|
||||
GtkWidget *label;
|
||||
gchar *colon_name;
|
||||
|
||||
colon_name = g_strconcat(name, ":", NULL);
|
||||
label = gtk_label_new(colon_name);
|
||||
gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5);
|
||||
g_free(colon_name);
|
||||
|
||||
enclosing = gtk_hbox_new(FALSE, 5);
|
||||
value = gnc_currency_edit_new();
|
||||
|
||||
option->widget = value;
|
||||
gnc_option_set_ui_value(option, FALSE);
|
||||
|
||||
if (documentation != NULL)
|
||||
gtk_tooltips_set_tip(tooltips, GTK_COMBO(value)->entry,
|
||||
documentation, NULL);
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(GTK_COMBO(value)->entry), "changed",
|
||||
GTK_SIGNAL_FUNC(gnc_option_changed_cb), option);
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(enclosing), label, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(enclosing), value, FALSE, FALSE, 0);
|
||||
gtk_box_pack_end(GTK_BOX(enclosing),
|
||||
gnc_option_create_default_button(option, tooltips),
|
||||
FALSE, FALSE, 0);
|
||||
}
|
||||
else if (safe_strcmp(type, "multichoice") == 0)
|
||||
{
|
||||
GtkWidget *label;
|
||||
|
@ -28,9 +28,10 @@
|
||||
#include "account-tree.h"
|
||||
#include "dialog-utils.h"
|
||||
#include "global-options.h"
|
||||
#include "gnc-currency-edit.h"
|
||||
#include "messages.h"
|
||||
#include "util.h"
|
||||
#include "EuroUtils.h"
|
||||
#include "util.h"
|
||||
|
||||
|
||||
/* This static indicates the debugging module that this .o belongs to. */
|
||||
@ -166,8 +167,8 @@ gnc_ui_account_field_box_create(AccountEditInfo * info,
|
||||
gtk_box_pack_start(GTK_BOX(vbox), widget, TRUE, TRUE, 0);
|
||||
gtk_widget_show(widget);
|
||||
|
||||
widget = gtk_entry_new();
|
||||
info->currency_entry = GTK_EDITABLE(widget);
|
||||
widget = gnc_currency_edit_new();
|
||||
info->currency_entry = GTK_EDITABLE(GTK_COMBO(widget)->entry);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), widget, TRUE, TRUE, 0);
|
||||
gtk_widget_show(widget);
|
||||
|
||||
|
@ -43,6 +43,7 @@ struct _AccountEditInfo
|
||||
GtkEditable * notes_entry;
|
||||
|
||||
GtkOptionMenu * source_menu;
|
||||
|
||||
gint source;
|
||||
};
|
||||
|
||||
|
283
src/gnome/gnc-currency-edit.c
Normal file
283
src/gnome/gnc-currency-edit.c
Normal file
@ -0,0 +1,283 @@
|
||||
/*
|
||||
* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation
|
||||
* All rights reserved.
|
||||
*
|
||||
* Gnucash is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public License
|
||||
* as published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* Gnucash is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, contact:
|
||||
*
|
||||
* Free Software Foundation Voice: +1-617-542-5942
|
||||
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652
|
||||
* Boston, MA 02111-1307, USA gnu@gnu.org
|
||||
*
|
||||
*/
|
||||
/*
|
||||
@NOTATION@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Currency editor widget
|
||||
*
|
||||
* Authors: Dave Peticolas <dave@krondo.com>
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "gnc-currency-edit.h"
|
||||
#include "guile-util.h"
|
||||
#include "messages.h"
|
||||
|
||||
|
||||
static void gnc_currency_edit_init (GNCCurrencyEdit *gce);
|
||||
static void gnc_currency_edit_class_init (GNCCurrencyEditClass *class);
|
||||
static void gnc_currency_edit_destroy (GtkObject *object);
|
||||
|
||||
static GtkComboClass *parent_class;
|
||||
|
||||
/**
|
||||
* gnc_currency_edit_get_type:
|
||||
*
|
||||
* Returns the GtkType for the GNCCurrencyEdit widget
|
||||
*/
|
||||
guint
|
||||
gnc_currency_edit_get_type (void)
|
||||
{
|
||||
static guint currency_edit_type = 0;
|
||||
|
||||
if (!currency_edit_type){
|
||||
GtkTypeInfo currency_edit_info = {
|
||||
"GNCCurrencyEdit",
|
||||
sizeof (GNCCurrencyEdit),
|
||||
sizeof (GNCCurrencyEditClass),
|
||||
(GtkClassInitFunc) gnc_currency_edit_class_init,
|
||||
(GtkObjectInitFunc) gnc_currency_edit_init,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
currency_edit_type = gtk_type_unique (gtk_combo_get_type (),
|
||||
¤cy_edit_info);
|
||||
}
|
||||
|
||||
return currency_edit_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_currency_edit_class_init (GNCCurrencyEditClass *class)
|
||||
{
|
||||
GtkObjectClass *object_class = (GtkObjectClass *) class;
|
||||
|
||||
object_class = (GtkObjectClass*) class;
|
||||
|
||||
parent_class = gtk_type_class (gtk_combo_get_type ());
|
||||
|
||||
object_class->destroy = gnc_currency_edit_destroy;
|
||||
}
|
||||
|
||||
static void
|
||||
insert_text_cb(GtkEditable *editable, gchar *new_text, gint new_text_length,
|
||||
gint *position, gpointer user_data)
|
||||
{
|
||||
gint i;
|
||||
|
||||
for (i = 0; i < new_text_length; i++)
|
||||
{
|
||||
if (!isalpha(new_text[i]))
|
||||
{
|
||||
gtk_signal_emit_stop_by_name(GTK_OBJECT(editable),
|
||||
"insert_text");
|
||||
return;
|
||||
}
|
||||
|
||||
new_text[i] = toupper(new_text[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_currency_edit_init (GNCCurrencyEdit *gce)
|
||||
{
|
||||
GtkTooltips *tooltips;
|
||||
|
||||
gtk_combo_set_use_arrows_always(GTK_COMBO(gce), TRUE);
|
||||
gtk_combo_set_value_in_list(GTK_COMBO(gce), TRUE, TRUE);
|
||||
gtk_combo_disable_activate(GTK_COMBO(gce));
|
||||
|
||||
gtk_entry_set_max_length(GTK_ENTRY(GTK_COMBO(gce)->entry), 3);
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(GTK_COMBO(gce)->entry),
|
||||
"insert_text", insert_text_cb, NULL);
|
||||
|
||||
tooltips = gtk_tooltips_new();
|
||||
gtk_tooltips_set_tip(GTK_TOOLTIPS(tooltips),
|
||||
GTK_COMBO(gce)->entry,
|
||||
TOOLTIP_CURRENCY, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_currency_edit_destroy (GtkObject *object)
|
||||
{
|
||||
g_return_if_fail (object != NULL);
|
||||
g_return_if_fail (GNC_IS_CURRENCY_EDIT (object));
|
||||
|
||||
if (GTK_OBJECT_CLASS (parent_class)->destroy)
|
||||
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
|
||||
}
|
||||
|
||||
static void
|
||||
add_item(GNCCurrencyEdit *gce, const char *code, const char *desc)
|
||||
{
|
||||
GtkWidget *item;
|
||||
GtkWidget *label;
|
||||
char *string;
|
||||
|
||||
item = gtk_list_item_new();
|
||||
|
||||
string = g_strconcat(desc, " (", code, ")", NULL);
|
||||
|
||||
label = gtk_label_new(string);
|
||||
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
|
||||
g_free(string);
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(item), label);
|
||||
|
||||
gtk_widget_show_all(item);
|
||||
|
||||
gtk_combo_set_item_string(GTK_COMBO(gce), GTK_ITEM (item), code);
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(GTK_COMBO(gce)->list), item);
|
||||
}
|
||||
|
||||
static int
|
||||
currency_compare(gconstpointer a, gconstpointer b)
|
||||
{
|
||||
return strcoll(a, b);
|
||||
}
|
||||
|
||||
static void
|
||||
destroy_hash_node(gpointer key, gpointer value, gpointer data)
|
||||
{
|
||||
free(key);
|
||||
free(value);
|
||||
}
|
||||
|
||||
static void
|
||||
fill_currencies(GNCCurrencyEdit *gce)
|
||||
{
|
||||
GHashTable *table;
|
||||
GList *list = NULL;
|
||||
GList *node;
|
||||
SCM currencies;
|
||||
SCM item;
|
||||
|
||||
table = g_hash_table_new(g_str_hash, g_str_equal);
|
||||
|
||||
gnc_depend("currencies.scm");
|
||||
|
||||
currencies = gh_eval_str("gnc:*currencies*");
|
||||
|
||||
while (gh_list_p(currencies) && !gh_null_p(currencies))
|
||||
{
|
||||
char *code;
|
||||
char *desc;
|
||||
SCM value;
|
||||
|
||||
item = gh_car(currencies);
|
||||
currencies = gh_cdr(currencies);
|
||||
|
||||
if (!gh_pair_p(item))
|
||||
continue;
|
||||
|
||||
value = gh_car(item);
|
||||
if (!gh_string_p(value))
|
||||
continue;
|
||||
|
||||
code = gh_scm2newstr(value, NULL);
|
||||
if (code == NULL)
|
||||
continue;
|
||||
|
||||
value = gh_cdr(item);
|
||||
if (!gh_string_p(value))
|
||||
{
|
||||
free(code);
|
||||
continue;
|
||||
}
|
||||
|
||||
desc = gh_scm2newstr(value, NULL);
|
||||
if (desc == NULL)
|
||||
{
|
||||
free(code);
|
||||
continue;
|
||||
}
|
||||
|
||||
g_hash_table_insert(table, desc, code);
|
||||
list = g_list_prepend(list, desc);
|
||||
}
|
||||
|
||||
list = g_list_reverse(list);
|
||||
list = g_list_sort(list, currency_compare);
|
||||
|
||||
for (node = list; node != NULL; node = node->next)
|
||||
add_item(gce, g_hash_table_lookup(table, node->data),
|
||||
node->data);
|
||||
|
||||
g_hash_table_foreach(table, destroy_hash_node, NULL);
|
||||
g_hash_table_destroy(table);
|
||||
|
||||
g_list_free(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* gnc_currency_edit_new:
|
||||
*
|
||||
* Creates a new GNCCurrencyEdit widget which can be used to provide
|
||||
* an easy way to enter ISO currency codes.
|
||||
*
|
||||
* Returns a GNCCurrencyEdit widget.
|
||||
*/
|
||||
GtkWidget *
|
||||
gnc_currency_edit_new ()
|
||||
{
|
||||
GNCCurrencyEdit *gce;
|
||||
|
||||
gce = gtk_type_new (gnc_currency_edit_get_type ());
|
||||
|
||||
fill_currencies (gce);
|
||||
|
||||
return GTK_WIDGET (gce);
|
||||
}
|
||||
|
||||
/**
|
||||
* gnc_currency_edit_new:
|
||||
* @gce: the currency editor widget
|
||||
* @currency: the currency code to select
|
||||
*
|
||||
* Sets the currency value of the widget to a particular currency.
|
||||
*
|
||||
* Returns nothing.
|
||||
*/
|
||||
void
|
||||
gnc_currency_edit_set_currency (GNCCurrencyEdit *gce, const gchar *currency)
|
||||
{
|
||||
g_return_if_fail(gce != NULL);
|
||||
g_return_if_fail(GNC_IS_CURRENCY_EDIT(gce));
|
||||
|
||||
gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(gce)->entry), currency);
|
||||
}
|
||||
|
||||
/*
|
||||
Local Variables:
|
||||
c-basic-offset: 8
|
||||
End:
|
||||
*/
|
65
src/gnome/gnc-currency-edit.h
Normal file
65
src/gnome/gnc-currency-edit.h
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (C) 2000 Free Software Foundation
|
||||
* All rights reserved.
|
||||
*
|
||||
* Dave Peticolas <dave@krondo.com>
|
||||
*
|
||||
* GnuCash is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* Gnucash is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, contact:
|
||||
*
|
||||
* Free Software Foundation Voice: +1-617-542-5942
|
||||
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652
|
||||
* Boston, MA 02111-1307, USA gnu@gnu.org
|
||||
*
|
||||
*/
|
||||
/*
|
||||
@NOTATION@
|
||||
*/
|
||||
|
||||
#ifndef __GNC_CURRENCY_EDIT_H_
|
||||
#define __GNC_CURRENCY_EDIT_H_ 1
|
||||
|
||||
#include <gnome.h>
|
||||
|
||||
BEGIN_GNOME_DECLS
|
||||
|
||||
|
||||
#define GNC_CURRENCY_EDIT(obj) GTK_CHECK_CAST (obj, gnc_currency_edit_get_type(), GNCCurrencyEdit)
|
||||
#define GNC_CURRENCY_EDIT_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gnc_currency_edit_get_type(), GNCCurrencyEditClass)
|
||||
#define GNC_IS_CURRENCY_EDIT(obj) GTK_CHECK_TYPE (obj, gnc_currency_edit_get_type ())
|
||||
|
||||
typedef struct {
|
||||
GtkCombo combo;
|
||||
} GNCCurrencyEdit;
|
||||
|
||||
typedef struct {
|
||||
GtkComboClass parent_class;
|
||||
} GNCCurrencyEditClass;
|
||||
|
||||
guint gnc_currency_edit_get_type (void);
|
||||
|
||||
GtkWidget *gnc_currency_edit_new (void);
|
||||
|
||||
void gnc_currency_edit_set_currency (GNCCurrencyEdit *gce,
|
||||
const gchar *currency);
|
||||
|
||||
|
||||
END_GNOME_DECLS
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
Local Variables:
|
||||
c-basic-offset: 8
|
||||
End:
|
||||
*/
|
@ -195,6 +195,8 @@
|
||||
#define TOOLTIP_CLOSE_REG _(TOOLTIP_CLOSE_REG_N)
|
||||
#define TOOLTIP_COPY_TRANS_N N_("Copy the selected transaction")
|
||||
#define TOOLTIP_COPY_TRANS _(TOOLTIP_COPY_TRANS_N)
|
||||
#define TOOLTIP_CURRENCY _("Enter a 3-letter ISO currency code such " \
|
||||
"as USD (US Dollars)")
|
||||
#define TOOLTIP_CUT_TRANS_N N_("Cut the selected transaction")
|
||||
#define TOOLTIP_CUT_TRANS _(TOOLTIP_CUT_TRANS_N)
|
||||
#define TOOLTIP_DATE_RANGE_N N_("Set the date range of this register")
|
||||
|
193
src/scm/currencies.scm
Normal file
193
src/scm/currencies.scm
Normal file
@ -0,0 +1,193 @@
|
||||
;; A table of ISO currency codes and their long descriptions
|
||||
;; of usage by country. Some currencies are used in more than
|
||||
;; one country, hence some codes have multiple long descriptions.
|
||||
|
||||
(gnc:support "currencies.scm")
|
||||
|
||||
(if (not (defined? 'gnc:*currencies*))
|
||||
(define gnc:*currencies*
|
||||
(list
|
||||
'( "AFA" . "Afghanistan Afghani" )
|
||||
'( "ALL" . "Albanian Lek" )
|
||||
'( "DZD" . "Algerian Dinar" )
|
||||
'( "ADF" . "Andorran Franc" )
|
||||
'( "ADP" . "Andorran Peseta" )
|
||||
'( "AON" . "Angolan New Kwanza" )
|
||||
'( "ARA" . "Argentine Austral" )
|
||||
'( "ARS" . "Argentine Peso" )
|
||||
'( "AWG" . "Aruban Florin" )
|
||||
'( "AUD" . "Australian Dollar" )
|
||||
'( "ATS" . "Austrian Schilling" )
|
||||
'( "BSD" . "Bahamian Dollar" )
|
||||
'( "BHD" . "Bahraini Dinar" )
|
||||
'( "BDT" . "Bangladeshi Taka" )
|
||||
'( "BBD" . "Barbados Dollar" )
|
||||
'( "BEF" . "Belgian Franc" )
|
||||
'( "BZD" . "Belize Dollar" )
|
||||
'( "XOF" . "Benin Franc" )
|
||||
'( "BMD" . "Bermudian Dollar" )
|
||||
'( "BTN" . "Bhutan Ngultrum" )
|
||||
'( "BOB" . "Bolivian Boliviano" )
|
||||
'( "BWP" . "Botswana Pula" )
|
||||
'( "BRC" . "Brazilian Cruzeiro" )
|
||||
'( "BRL" . "Brazilian Real" )
|
||||
'( "GBP" . "British Pound" )
|
||||
'( "BND" . "Brunei Dollar" )
|
||||
'( "BGL" . "Bulgarian Lev" )
|
||||
'( "XOF" . "Burkino Faso Franc" )
|
||||
'( "BIF" . "Burundi Franc" )
|
||||
'( "XAF" . "Cameroon Franc" )
|
||||
'( "CAD" . "Canadian Dollar" )
|
||||
'( "CVE" . "Cape Verde Escudo" )
|
||||
'( "KYD" . "Cayman Islands Dollar" )
|
||||
'( "XAF" . "Central African Republic Franc" )
|
||||
'( "XAF" . "Chad Franc" )
|
||||
'( "CLP" . "Chilean Peso" )
|
||||
'( "CNY" . "Chinese Yuan Renminbi" )
|
||||
'( "COP" . "Colombian Peso" )
|
||||
'( "KMF" . "Comoros Franc" )
|
||||
'( "XAF" . "Congo Franc" )
|
||||
'( "CRC" . "Costa Rican Colon" )
|
||||
'( "HRK" . "Croatian Kuna" )
|
||||
'( "CUP" . "Cuban Peso" )
|
||||
'( "CYP" . "Cyprus Pound" )
|
||||
'( "CSK" . "Czech Koruna" )
|
||||
'( "DKK" . "Danish Krone" )
|
||||
'( "DJF" . "Djibouti Franc" )
|
||||
'( "DOP" . "Dominican Peso" )
|
||||
'( "NLG" . "Dutch Guilder" )
|
||||
'( "ECS" . "Ecuador Sucre" )
|
||||
'( "EGP" . "Egyptian Pound" )
|
||||
'( "SVC" . "El Salvador Colon" )
|
||||
'( "XAF" . "Equatorial Guinea Franc" )
|
||||
'( "EEK" . "Estonian Kroon" )
|
||||
'( "ETB" . "Ethiopian Birr" )
|
||||
'( "EUR" . "Euro" )
|
||||
'( "FKP" . "Falkland Islands Pound" )
|
||||
'( "FJD" . "Fiji Dollar" )
|
||||
'( "FIM" . "Finnish Markka" )
|
||||
'( "FRF" . "French Franc" )
|
||||
'( "XAF" . "Gabon Franc" )
|
||||
'( "GMD" . "Gambian Dalasi" )
|
||||
'( "DEM" . "German Mark" )
|
||||
'( "GHC" . "Ghanaian Cedi" )
|
||||
'( "GIP" . "Gibraltar Pound" )
|
||||
'( "GRD" . "Greek Drachma" )
|
||||
'( "GTQ" . "Guatemalan Quetzal" )
|
||||
'( "GNF" . "Guinea Franc" )
|
||||
'( "GWP" . "Guinea-Bissau Peso" )
|
||||
'( "GYD" . "Guyanan Dollar" )
|
||||
'( "HTG" . "Haitian Gourde" )
|
||||
'( "HNL" . "Honduran Lempira" )
|
||||
'( "HKD" . "Hong Kong Dollar" )
|
||||
'( "HUF" . "Hungarian Forint" )
|
||||
'( "ISK" . "Iceland Krona" )
|
||||
'( "INR" . "Indian Rupee" )
|
||||
'( "IDR" . "Indonesian Rupiah" )
|
||||
'( "IRR" . "Iranian Rial" )
|
||||
'( "IQD" . "Iraqi Dinar" )
|
||||
'( "IEP" . "Irish Punt" )
|
||||
'( "ILS" . "Israeli New Shekel" )
|
||||
'( "ITL" . "Italian Lira" )
|
||||
'( "XOF" . "Ivory Coast Franc" )
|
||||
'( "JMD" . "Jamaican Dollar" )
|
||||
'( "JPY" . "Japanese Yen" )
|
||||
'( "JOD" . "Jordanian Dinar" )
|
||||
'( "KHR" . "Kampuchean (Cambodian) Riel" )
|
||||
'( "KZT" . "Kazakhstan Tenge" )
|
||||
'( "KES" . "Kenyan Schilling" )
|
||||
'( "KRW" . "Korean Won" )
|
||||
'( "KWD" . "Kuwaiti Dinar" )
|
||||
'( "LAK" . "Lao Kip" )
|
||||
'( "LVL" . "Latvian Lats" )
|
||||
'( "LBP" . "Lebanese Pound" )
|
||||
'( "LSL" . "Lesotho Loti" )
|
||||
'( "LRD" . "Liberian Dollar" )
|
||||
'( "LYD" . "Libyan Dinar" )
|
||||
'( "LTL" . "Lithuanian Litas" )
|
||||
'( "LUF" . "Luxembourg Franc" )
|
||||
'( "MOP" . "Macau Pataca" )
|
||||
'( "MGF" . "Malagasy Franc" )
|
||||
'( "MWK" . "Malawi Kwacha" )
|
||||
'( "MYR" . "Malaysian Ringgit" )
|
||||
'( "MVR" . "Maldive Rufiyaa" )
|
||||
'( "XOF" . "Mali Republic Franc" )
|
||||
'( "MTL" . "Maltese Lira" )
|
||||
'( "MRO" . "Mauritanian Ouguiya" )
|
||||
'( "MUR" . "Mauritius Rupee" )
|
||||
'( "MXP" . "Mexican Peso" )
|
||||
'( "MNT" . "Mongolian Tugrik" )
|
||||
'( "MAD" . "Moroccan Dirham" )
|
||||
'( "MZM" . "Mozambique Metical" )
|
||||
'( "MMK" . "Myanmar Kyat" )
|
||||
'( "NAD" . "Namibian Dollar" )
|
||||
'( "NPR" . "Nepalese Rupee" )
|
||||
'( "ANG" . "Netherlands Antillian Guilder" )
|
||||
'( "NZD" . "New Zealand Dollar" )
|
||||
'( "NIO" . "Nicaraguan Cordoba Oro" )
|
||||
'( "XOF" . "Niger Republic Franc" )
|
||||
'( "NGN" . "Nigerian Naira" )
|
||||
'( "KPW" . "North Korean Won" )
|
||||
'( "NOK" . "Norwegian Kroner" )
|
||||
'( "OMR" . "Omani Rial" )
|
||||
'( "PKR" . "Pakistan Rupee" )
|
||||
'( "PAB" . "Panamanian Balboa" )
|
||||
'( "PGK" . "Papua New Guinea Kina" )
|
||||
'( "PYG" . "Paraguay Guarani" )
|
||||
'( "PEN" . "Peruvian Nuevo Sol" )
|
||||
'( "PHP" . "Philippine Peso" )
|
||||
'( "PLZ" . "Polish Zloty" )
|
||||
'( "PTE" . "Portuguese Escudo" )
|
||||
'( "QAR" . "Qatari Rial" )
|
||||
'( "ROL" . "Romanian Leu" )
|
||||
'( "RUB" . "Russian Rouble" )
|
||||
'( "WST" . "Samoan Tala" )
|
||||
'( "STD" . "Sao Tome and Principe Dobra" )
|
||||
'( "SAR" . "Saudi Riyal" )
|
||||
'( "XOF" . "Senegal Franc" )
|
||||
'( "SCR" . "Seychelles Rupee" )
|
||||
'( "SLL" . "Sierra Leone Leone" )
|
||||
'( "SGD" . "Singapore Dollar" )
|
||||
'( "SKK" . "Slovak Koruna" )
|
||||
'( "SIT" . "Slovenian Tolar" )
|
||||
'( "SBD" . "Solomon Islands Dollar" )
|
||||
'( "SOS" . "Somali Schilling" )
|
||||
'( "ZAR" . "South African Rand" )
|
||||
'( "ESP" . "Spanish Peseta" )
|
||||
'( "LKR" . "Sri Lanka Rupee" )
|
||||
'( "SHP" . "St. Helena Pound" )
|
||||
'( "SDD" . "Sudanese Dinar" )
|
||||
'( "SDP" . "Sudanese Pound" )
|
||||
'( "SRG" . "Suriname Guilder" )
|
||||
'( "SZL" . "Swaziland Lilangeni" )
|
||||
'( "SEK" . "Swedish Krona" )
|
||||
'( "CHF" . "Swiss Franc" )
|
||||
'( "SYP" . "Syrian Pound" )
|
||||
'( "TWD" . "Taiwan Dollar" )
|
||||
'( "TZS" . "Tanzanian Schilling" )
|
||||
'( "THB" . "Thai Baht" )
|
||||
'( "XOF" . "Togo Republic Franc" )
|
||||
'( "TOP" . "Tongan Pa'anga" )
|
||||
'( "TTD" . "Trinidad and Tobago Dollar" )
|
||||
'( "TND" . "Tunisian Dinar" )
|
||||
'( "TRL" . "Turkish Lira" )
|
||||
'( "USD" . "US Dollar" )
|
||||
'( "UGS" . "Uganda Shilling" )
|
||||
'( "UAG" . "Ukraine Hryvnia" )
|
||||
'( "UAK" . "Ukraine Karbovanets" )
|
||||
'( "AED" . "United Arab Emirates Dirham" )
|
||||
'( "UYP" . "Uruguayan Peso" )
|
||||
'( "VUV" . "Vanuatu Vatu" )
|
||||
'( "VEB" . "Venezuelan Bolivar" )
|
||||
'( "VND" . "Vietnamese Dong" )
|
||||
'( "YUN" . "Yugoslav Dinar" )
|
||||
'( "ZMK" . "Zambian Kwacha" )
|
||||
'( "ZWD" . "Zimbabwe Dollar" )
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(define (gnc:add-currency currency description)
|
||||
(set! gnc:*currencies*
|
||||
(cons (cons currency description)
|
||||
gnc:*currencies*)))
|
@ -129,6 +129,28 @@
|
||||
(else (list #f "string-option: not a string"))))
|
||||
#f #f )))
|
||||
|
||||
;; currency options use a specialized widget for entering currencies
|
||||
;; in the GUI implementation. Currencies must be 3-letter ISO codes
|
||||
;; represented as strings.
|
||||
(define (gnc:make-currency-option
|
||||
section
|
||||
name
|
||||
sort-tag
|
||||
documentation-string
|
||||
default-value)
|
||||
(let* ((value default-value)
|
||||
(value->string (lambda () (gnc:value->string value))))
|
||||
(gnc:make-option
|
||||
section name sort-tag 'currency documentation-string
|
||||
(lambda () value)
|
||||
(lambda (x) (set! value x))
|
||||
(lambda () default-value)
|
||||
(gnc:restore-form-generator value->string)
|
||||
(lambda (x)
|
||||
(cond ((string? x)(list #t x))
|
||||
(else (list #f "currency-option: not a currency code"))))
|
||||
#f #f )))
|
||||
|
||||
(define (gnc:make-simple-boolean-option
|
||||
section
|
||||
name
|
||||
|
@ -179,7 +179,7 @@ the account instead of opening a register." #f))
|
||||
; #(locale "Locale" "Take from system locale"))))
|
||||
|
||||
(gnc:register-configuration-option
|
||||
(gnc:make-string-option
|
||||
(gnc:make-currency-option
|
||||
"International" "Default Currency"
|
||||
"b" "Default Currency For New Accounts"
|
||||
(gnc:locale-default-currency)))
|
||||
|
Loading…
Reference in New Issue
Block a user