mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Use expression parser widgets in the financial calculator.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3017 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
76b4649d32
commit
728a68fc6d
@ -4,6 +4,7 @@
|
||||
po/pseudo-source.c
|
||||
po/guile_strings.txt
|
||||
src/gnome/dialog-account-picker.c
|
||||
src/gnome/dialog-fincalc.c
|
||||
src/gnome/dialog-qif-import.c
|
||||
src/gnome/glade-gnc-dialogs.c
|
||||
src/gnome/print-session.c
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "finvar.h"
|
||||
#include "finproto.h"
|
||||
#include "glade-gnc-dialogs.h"
|
||||
#include "gnc-amount-edit.h"
|
||||
#include "gnc-dateedit.h"
|
||||
#include "query-user.h"
|
||||
#include "messages.h"
|
||||
@ -53,7 +54,7 @@ struct _FinCalcDialog
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
|
||||
GtkWidget *entries[NUM_FIN_CALC_VALUES];
|
||||
GtkWidget *amounts[NUM_FIN_CALC_VALUES];
|
||||
|
||||
GtkWidget *compounding_menu;
|
||||
GtkWidget *payment_menu;
|
||||
@ -61,6 +62,8 @@ struct _FinCalcDialog
|
||||
GtkWidget *end_of_period_radio;
|
||||
GtkWidget *discrete_compounding_radio;
|
||||
|
||||
GtkWidget *payment_total_label;
|
||||
|
||||
financial_info financial_info;
|
||||
|
||||
GList *calc_buttons;
|
||||
@ -116,6 +119,7 @@ fi_to_gui(FinCalcDialog *fcd)
|
||||
{
|
||||
char string[1024];
|
||||
struct lconv *lc;
|
||||
double total;
|
||||
int i;
|
||||
|
||||
if (fcd == NULL)
|
||||
@ -124,19 +128,23 @@ fi_to_gui(FinCalcDialog *fcd)
|
||||
lc = gnc_localeconv();
|
||||
|
||||
snprintf(string, sizeof(string), "%u", fcd->financial_info.npp);
|
||||
gtk_entry_set_text(GTK_ENTRY(fcd->entries[PAYMENT_PERIODS]), string);
|
||||
gtk_entry_set_text(GTK_ENTRY(fcd->amounts[PAYMENT_PERIODS]), string);
|
||||
|
||||
xaccSPrintAmount(string, fcd->financial_info.ir, PRTNMN, NULL);
|
||||
gtk_entry_set_text(GTK_ENTRY(fcd->entries[INTEREST_RATE]), string);
|
||||
gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT(fcd->amounts[INTEREST_RATE]),
|
||||
fcd->financial_info.ir);
|
||||
|
||||
xaccSPrintAmount(string, fcd->financial_info.pv, 0, NULL);
|
||||
gtk_entry_set_text(GTK_ENTRY(fcd->entries[PRESENT_VALUE]), string);
|
||||
gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT(fcd->amounts[PRESENT_VALUE]),
|
||||
fcd->financial_info.pv);
|
||||
|
||||
xaccSPrintAmount(string, fcd->financial_info.pmt, 0, NULL);
|
||||
gtk_entry_set_text(GTK_ENTRY(fcd->entries[PERIODIC_PAYMENT]), string);
|
||||
gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT(fcd->amounts[PERIODIC_PAYMENT]),
|
||||
fcd->financial_info.pmt);
|
||||
|
||||
xaccSPrintAmount(string, -fcd->financial_info.fv, 0, NULL);
|
||||
gtk_entry_set_text(GTK_ENTRY(fcd->entries[FUTURE_VALUE]), string);
|
||||
gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT(fcd->amounts[FUTURE_VALUE]),
|
||||
-fcd->financial_info.fv);
|
||||
|
||||
total = fcd->financial_info.npp * fcd->financial_info.pmt;
|
||||
xaccSPrintAmount (string, total, PRTSEP, NULL);
|
||||
gtk_label_set_text (GTK_LABEL(fcd->payment_total_label), string);
|
||||
|
||||
i = normalize_period(&fcd->financial_info.CF);
|
||||
gtk_option_menu_set_history(GTK_OPTION_MENU(fcd->compounding_menu), i);
|
||||
@ -166,21 +174,21 @@ gui_to_fi(FinCalcDialog *fcd)
|
||||
|
||||
lc = gnc_localeconv();
|
||||
|
||||
string = gtk_entry_get_text(GTK_ENTRY(fcd->entries[PAYMENT_PERIODS]));
|
||||
string = gtk_entry_get_text(GTK_ENTRY(fcd->amounts[PAYMENT_PERIODS]));
|
||||
fcd->financial_info.npp = strtol(string, NULL, 10);
|
||||
|
||||
string = gtk_entry_get_text(GTK_ENTRY(fcd->entries[INTEREST_RATE]));
|
||||
xaccParseAmount(string, FALSE, &fcd->financial_info.ir, NULL);
|
||||
fcd->financial_info.ir =
|
||||
gnc_amount_edit_get_amount(GNC_AMOUNT_EDIT(fcd->amounts[INTEREST_RATE]));
|
||||
|
||||
string = gtk_entry_get_text(GTK_ENTRY(fcd->entries[PRESENT_VALUE]));
|
||||
xaccParseAmount(string, TRUE, &fcd->financial_info.pv, NULL);
|
||||
fcd->financial_info.pv =
|
||||
gnc_amount_edit_get_amount(GNC_AMOUNT_EDIT(fcd->amounts[PRESENT_VALUE]));
|
||||
|
||||
string = gtk_entry_get_text(GTK_ENTRY(fcd->entries[PERIODIC_PAYMENT]));
|
||||
xaccParseAmount(string, TRUE, &fcd->financial_info.pmt, NULL);
|
||||
fcd->financial_info.pmt =
|
||||
gnc_amount_edit_get_amount(GNC_AMOUNT_EDIT(fcd->amounts[PERIODIC_PAYMENT]));
|
||||
|
||||
string = gtk_entry_get_text(GTK_ENTRY(fcd->entries[FUTURE_VALUE]));
|
||||
if (xaccParseAmount(string, TRUE, &fcd->financial_info.fv, NULL))
|
||||
fcd->financial_info.fv = -fcd->financial_info.fv;
|
||||
fcd->financial_info.fv =
|
||||
gnc_amount_edit_get_amount(GNC_AMOUNT_EDIT(fcd->amounts[FUTURE_VALUE]));
|
||||
fcd->financial_info.fv = -fcd->financial_info.fv;
|
||||
|
||||
i = gnc_option_menu_get_active(fcd->compounding_menu);
|
||||
fcd->financial_info.CF = periods[i];
|
||||
@ -270,11 +278,17 @@ close_button_clicked(GtkButton *button, FinCalcDialog *fcd)
|
||||
}
|
||||
|
||||
static void
|
||||
fincalc_clear_clicked(GtkButton *button, GtkEntry *entry)
|
||||
fincalc_entry_clear_clicked(GtkButton *button, GtkEntry *entry)
|
||||
{
|
||||
gtk_entry_set_text(GTK_ENTRY(entry), "");
|
||||
}
|
||||
|
||||
static void
|
||||
fincalc_amount_clear_clicked(GtkButton *button, GNCAmountEdit *edit)
|
||||
{
|
||||
gtk_entry_set_text(GTK_ENTRY (edit->amount_entry), "");
|
||||
}
|
||||
|
||||
static void
|
||||
init_fi(FinCalcDialog *fcd)
|
||||
{
|
||||
@ -299,10 +313,13 @@ init_fi(FinCalcDialog *fcd)
|
||||
}
|
||||
|
||||
/* Determine whether the value can be calculated. If it can, return
|
||||
* NULL. Otherwise, return a string describing the reason. */
|
||||
* NULL. Otherwise, return a string describing the reason and the offending
|
||||
* entry in error_item. */
|
||||
static const char *
|
||||
can_calc_value(FinCalcDialog *fcd, FinCalcValue value)
|
||||
can_calc_value(FinCalcDialog *fcd, FinCalcValue value, int *error_item)
|
||||
{
|
||||
const char *missing = _("You must enter values for the other quantities.");
|
||||
const char *bad_exp = _("You must enter a valid expression.");
|
||||
unsigned int uvalue;
|
||||
const char *string;
|
||||
double dvalue;
|
||||
@ -311,13 +328,32 @@ can_calc_value(FinCalcDialog *fcd, FinCalcValue value)
|
||||
if (fcd == NULL)
|
||||
return NULL;
|
||||
|
||||
string = gtk_entry_get_text(GTK_ENTRY(fcd->amounts[PAYMENT_PERIODS]));
|
||||
if ((string == NULL) || (*string == '\0'))
|
||||
{
|
||||
*error_item = PAYMENT_PERIODS;
|
||||
return missing;
|
||||
}
|
||||
|
||||
/* Check for missing values */
|
||||
for (i = 0; i < NUM_FIN_CALC_VALUES; i++)
|
||||
for (i = 1; i < NUM_FIN_CALC_VALUES; i++)
|
||||
if (i != value)
|
||||
{
|
||||
string = gtk_entry_get_text(GTK_ENTRY(fcd->entries[i]));
|
||||
GtkWidget *entry;
|
||||
|
||||
entry = GNC_AMOUNT_EDIT (fcd->amounts[i])->amount_entry;
|
||||
string = gtk_entry_get_text(GTK_ENTRY(entry));
|
||||
if ((string == NULL) || (*string == '\0'))
|
||||
return CALC_MISSING_MSG;
|
||||
{
|
||||
*error_item = i;
|
||||
return missing;
|
||||
}
|
||||
|
||||
if (!gnc_amount_edit_evaluate (GNC_AMOUNT_EDIT (fcd->amounts[i])))
|
||||
{
|
||||
*error_item = i;
|
||||
return bad_exp;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check for zero interest */
|
||||
@ -327,11 +363,13 @@ can_calc_value(FinCalcDialog *fcd, FinCalcValue value)
|
||||
case PRESENT_VALUE:
|
||||
case PERIODIC_PAYMENT:
|
||||
case FUTURE_VALUE:
|
||||
string = gtk_entry_get_text(GTK_ENTRY(fcd->entries[INTEREST_RATE]));
|
||||
dvalue = 0.0;
|
||||
xaccParseAmount(string, FALSE, &dvalue, NULL);
|
||||
dvalue = gnc_amount_edit_get_amount
|
||||
(GNC_AMOUNT_EDIT (fcd->amounts[INTEREST_RATE]));
|
||||
if (DEQ(dvalue, 0.0))
|
||||
return CALC_INTEREST_MSG;
|
||||
{
|
||||
*error_item = INTEREST_RATE;
|
||||
return _("The interest rate cannot be zero.");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -344,10 +382,13 @@ can_calc_value(FinCalcDialog *fcd, FinCalcValue value)
|
||||
case PRESENT_VALUE:
|
||||
case PERIODIC_PAYMENT:
|
||||
case FUTURE_VALUE:
|
||||
string = gtk_entry_get_text(GTK_ENTRY(fcd->entries[PAYMENT_PERIODS]));
|
||||
string = gtk_entry_get_text(GTK_ENTRY(fcd->amounts[PAYMENT_PERIODS]));
|
||||
uvalue = strtol(string, NULL, 10);
|
||||
if (uvalue == 0)
|
||||
return CALC_PAYMENTS_MSG;
|
||||
{
|
||||
*error_item = PAYMENT_PERIODS;
|
||||
return _("The number of payments cannot be zero.");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -360,14 +401,22 @@ static void
|
||||
calc_value(FinCalcDialog *fcd, FinCalcValue value)
|
||||
{
|
||||
const char *string;
|
||||
int error_item = 0;
|
||||
|
||||
if (fcd == NULL)
|
||||
return;
|
||||
|
||||
string = can_calc_value(fcd, value);
|
||||
string = can_calc_value(fcd, value, &error_item);
|
||||
if (string != NULL)
|
||||
{
|
||||
GtkWidget *entry;
|
||||
|
||||
gnc_error_dialog_parented(GTK_WINDOW(fcd->dialog), string);
|
||||
if (error_item == 0)
|
||||
entry = fcd->amounts[0];
|
||||
else
|
||||
entry = GNC_AMOUNT_EDIT (fcd->amounts[error_item])->amount_entry;
|
||||
gtk_widget_grab_focus (entry);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -436,7 +485,10 @@ gnc_ui_fincalc_dialog_create(void)
|
||||
FinCalcDialog *fcd;
|
||||
GtkObject *fcdo;
|
||||
GtkWidget *button;
|
||||
GtkWidget *entry;
|
||||
GtkWidget *menu;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *edit;
|
||||
|
||||
fcd = g_new0(FinCalcDialog, 1);
|
||||
|
||||
@ -445,31 +497,68 @@ gnc_ui_fincalc_dialog_create(void)
|
||||
gtk_signal_connect(fcdo, "destroy",
|
||||
GTK_SIGNAL_FUNC(fincalc_dialog_destroy), fcd);
|
||||
|
||||
fcd->entries[PAYMENT_PERIODS] = gtk_object_get_data(fcdo,
|
||||
"payment_periods_entry");
|
||||
gtk_signal_connect(GTK_OBJECT(fcd->entries[PAYMENT_PERIODS]), "changed",
|
||||
|
||||
entry = gtk_object_get_data(fcdo, "payment_periods_entry");
|
||||
fcd->amounts[PAYMENT_PERIODS] = entry;
|
||||
gtk_signal_connect(GTK_OBJECT(entry), "changed",
|
||||
GTK_SIGNAL_FUNC(fincalc_entry_changed), fcd);
|
||||
|
||||
fcd->entries[INTEREST_RATE] = gtk_object_get_data(fcdo,
|
||||
"interest_rate_entry");
|
||||
gtk_signal_connect(GTK_OBJECT(fcd->entries[INTEREST_RATE]), "changed",
|
||||
|
||||
edit = gnc_amount_edit_new();
|
||||
gnc_amount_edit_set_evaluate_on_enter (GNC_AMOUNT_EDIT (edit), TRUE);
|
||||
fcd->amounts[INTEREST_RATE] = edit;
|
||||
gtk_widget_show (edit);
|
||||
|
||||
hbox = gtk_object_get_data(fcdo, "interest_rate_hbox");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), edit, TRUE, TRUE, 0);
|
||||
|
||||
entry = GNC_AMOUNT_EDIT (edit)->amount_entry;
|
||||
gtk_signal_connect(GTK_OBJECT(entry), "changed",
|
||||
GTK_SIGNAL_FUNC(fincalc_entry_changed), fcd);
|
||||
|
||||
fcd->entries[PRESENT_VALUE] = gtk_object_get_data(fcdo,
|
||||
"present_value_entry");
|
||||
gtk_signal_connect(GTK_OBJECT(fcd->entries[PRESENT_VALUE]), "changed",
|
||||
|
||||
edit = gnc_amount_edit_new();
|
||||
gnc_amount_edit_set_evaluate_on_enter (GNC_AMOUNT_EDIT (edit), TRUE);
|
||||
gnc_amount_edit_set_print_flags (GNC_AMOUNT_EDIT(edit), PRTSEP);
|
||||
fcd->amounts[PRESENT_VALUE] = edit;
|
||||
gtk_widget_show (edit);
|
||||
|
||||
hbox = gtk_object_get_data(fcdo, "present_value_hbox");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), edit, TRUE, TRUE, 0);
|
||||
|
||||
entry = GNC_AMOUNT_EDIT (edit)->amount_entry;
|
||||
gtk_signal_connect(GTK_OBJECT(entry), "changed",
|
||||
GTK_SIGNAL_FUNC(fincalc_entry_changed), fcd);
|
||||
|
||||
fcd->entries[PERIODIC_PAYMENT] =
|
||||
gtk_object_get_data(fcdo, "periodic_payment_entry");
|
||||
gtk_signal_connect(GTK_OBJECT(fcd->entries[PERIODIC_PAYMENT]), "changed",
|
||||
|
||||
edit = gnc_amount_edit_new();
|
||||
gnc_amount_edit_set_evaluate_on_enter (GNC_AMOUNT_EDIT (edit), TRUE);
|
||||
gnc_amount_edit_set_print_flags (GNC_AMOUNT_EDIT(edit), PRTSEP);
|
||||
fcd->amounts[PERIODIC_PAYMENT] = edit;
|
||||
gtk_widget_show (edit);
|
||||
|
||||
hbox = gtk_object_get_data(fcdo, "periodic_payment_hbox");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), edit, TRUE, TRUE, 0);
|
||||
|
||||
entry = GNC_AMOUNT_EDIT (edit)->amount_entry;
|
||||
gtk_signal_connect(GTK_OBJECT(entry), "changed",
|
||||
GTK_SIGNAL_FUNC(fincalc_entry_changed), fcd);
|
||||
|
||||
fcd->entries[FUTURE_VALUE] = gtk_object_get_data(fcdo,
|
||||
"future_value_entry");
|
||||
gtk_signal_connect(GTK_OBJECT(fcd->entries[FUTURE_VALUE]), "changed",
|
||||
|
||||
edit = gnc_amount_edit_new();
|
||||
gnc_amount_edit_set_evaluate_on_enter (GNC_AMOUNT_EDIT (edit), TRUE);
|
||||
gnc_amount_edit_set_print_flags (GNC_AMOUNT_EDIT(edit), PRTSEP);
|
||||
fcd->amounts[FUTURE_VALUE] = edit;
|
||||
gtk_widget_show (edit);
|
||||
|
||||
hbox = gtk_object_get_data(fcdo, "future_value_hbox");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), edit, TRUE, TRUE, 0);
|
||||
|
||||
entry = GNC_AMOUNT_EDIT (edit)->amount_entry;
|
||||
gtk_signal_connect(GTK_OBJECT(entry), "changed",
|
||||
GTK_SIGNAL_FUNC(fincalc_entry_changed), fcd);
|
||||
|
||||
|
||||
button = gtk_object_get_data(fcdo, "payment_periods_calc_button");
|
||||
fcd->calc_buttons = g_list_prepend(fcd->calc_buttons, button);
|
||||
gtk_signal_connect(GTK_OBJECT(button), "clicked",
|
||||
@ -497,28 +586,28 @@ gnc_ui_fincalc_dialog_create(void)
|
||||
|
||||
button = gtk_object_get_data(fcdo, "payment_periods_clear_button");
|
||||
gtk_signal_connect(GTK_OBJECT(button), "clicked",
|
||||
GTK_SIGNAL_FUNC(fincalc_clear_clicked),
|
||||
fcd->entries[PAYMENT_PERIODS]);
|
||||
GTK_SIGNAL_FUNC(fincalc_entry_clear_clicked),
|
||||
fcd->amounts[PAYMENT_PERIODS]);
|
||||
|
||||
button = gtk_object_get_data(fcdo, "interest_rate_clear_button");
|
||||
gtk_signal_connect(GTK_OBJECT(button), "clicked",
|
||||
GTK_SIGNAL_FUNC(fincalc_clear_clicked),
|
||||
fcd->entries[INTEREST_RATE]);
|
||||
GTK_SIGNAL_FUNC(fincalc_amount_clear_clicked),
|
||||
fcd->amounts[INTEREST_RATE]);
|
||||
|
||||
button = gtk_object_get_data(fcdo, "present_value_clear_button");
|
||||
gtk_signal_connect(GTK_OBJECT(button), "clicked",
|
||||
GTK_SIGNAL_FUNC(fincalc_clear_clicked),
|
||||
fcd->entries[PRESENT_VALUE]);
|
||||
GTK_SIGNAL_FUNC(fincalc_amount_clear_clicked),
|
||||
fcd->amounts[PRESENT_VALUE]);
|
||||
|
||||
button = gtk_object_get_data(fcdo, "periodic_payment_clear_button");
|
||||
gtk_signal_connect(GTK_OBJECT(button), "clicked",
|
||||
GTK_SIGNAL_FUNC(fincalc_clear_clicked),
|
||||
fcd->entries[PERIODIC_PAYMENT]);
|
||||
GTK_SIGNAL_FUNC(fincalc_amount_clear_clicked),
|
||||
fcd->amounts[PERIODIC_PAYMENT]);
|
||||
|
||||
button = gtk_object_get_data(fcdo, "future_value_clear_button");
|
||||
gtk_signal_connect(GTK_OBJECT(button), "clicked",
|
||||
GTK_SIGNAL_FUNC(fincalc_clear_clicked),
|
||||
fcd->entries[FUTURE_VALUE]);
|
||||
GTK_SIGNAL_FUNC(fincalc_amount_clear_clicked),
|
||||
fcd->amounts[FUTURE_VALUE]);
|
||||
|
||||
menu = gtk_object_get_data(fcdo, "compounding_menu");
|
||||
fcd->compounding_menu = menu;
|
||||
@ -546,13 +635,15 @@ gnc_ui_fincalc_dialog_create(void)
|
||||
gtk_signal_connect(GTK_OBJECT(button), "clicked",
|
||||
GTK_SIGNAL_FUNC(close_button_clicked), fcd);
|
||||
|
||||
fcd->payment_total_label = gtk_object_get_data (fcdo, "payment_total_label");
|
||||
|
||||
init_fi(fcd);
|
||||
|
||||
fi_to_gui(fcd);
|
||||
|
||||
fincalc_allow_calc(fcd, FALSE);
|
||||
|
||||
gtk_widget_grab_focus(fcd->entries[PAYMENT_PERIODS]);
|
||||
gtk_widget_grab_focus(fcd->amounts[PAYMENT_PERIODS]);
|
||||
|
||||
gtk_widget_show(fcd->dialog);
|
||||
|
||||
|
@ -3208,25 +3208,25 @@ create_Financial_Calculator_Dialog (void)
|
||||
GtkWidget *label799;
|
||||
GtkWidget *interest_rate_clear_button;
|
||||
GtkWidget *interest_rate_calc_button;
|
||||
GtkWidget *interest_rate_entry;
|
||||
GtkWidget *interest_rate_hbox;
|
||||
GtkWidget *vbox68;
|
||||
GtkWidget *hbox56;
|
||||
GtkWidget *label800;
|
||||
GtkWidget *present_value_clear_button;
|
||||
GtkWidget *present_value_calc_button;
|
||||
GtkWidget *present_value_entry;
|
||||
GtkWidget *present_value_hbox;
|
||||
GtkWidget *vbox69;
|
||||
GtkWidget *hbox57;
|
||||
GtkWidget *label801;
|
||||
GtkWidget *periodic_payment_clear_button;
|
||||
GtkWidget *periodic_payment_calc_button;
|
||||
GtkWidget *periodic_payment_entry;
|
||||
GtkWidget *periodic_payment_hbox;
|
||||
GtkWidget *vbox70;
|
||||
GtkWidget *hbox58;
|
||||
GtkWidget *label802;
|
||||
GtkWidget *future_value_clear_button;
|
||||
GtkWidget *future_value_calc_button;
|
||||
GtkWidget *future_value_entry;
|
||||
GtkWidget *future_value_hbox;
|
||||
GtkWidget *frame27;
|
||||
GtkWidget *vbox65;
|
||||
GtkWidget *hbox51;
|
||||
@ -3247,8 +3247,11 @@ create_Financial_Calculator_Dialog (void)
|
||||
GSList *compouding_group_group = NULL;
|
||||
GtkWidget *discrete_compounding_radio;
|
||||
GtkWidget *radiobutton6;
|
||||
GtkWidget *hseparator1;
|
||||
GtkWidget *hbox76;
|
||||
GtkWidget *label819;
|
||||
GtkWidget *payment_total_label;
|
||||
GtkWidget *dialog_action_area10;
|
||||
GtkWidget *schedule_button;
|
||||
GtkWidget *close_button;
|
||||
GtkTooltips *tooltips;
|
||||
|
||||
@ -3368,12 +3371,12 @@ create_Financial_Calculator_Dialog (void)
|
||||
gtk_widget_show (interest_rate_calc_button);
|
||||
gtk_box_pack_end (GTK_BOX (hbox55), interest_rate_calc_button, FALSE, FALSE, 0);
|
||||
|
||||
interest_rate_entry = gtk_entry_new ();
|
||||
gtk_widget_ref (interest_rate_entry);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Financial_Calculator_Dialog), "interest_rate_entry", interest_rate_entry,
|
||||
interest_rate_hbox = gtk_hbox_new (FALSE, 0);
|
||||
gtk_widget_ref (interest_rate_hbox);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Financial_Calculator_Dialog), "interest_rate_hbox", interest_rate_hbox,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (interest_rate_entry);
|
||||
gtk_box_pack_start (GTK_BOX (vbox67), interest_rate_entry, FALSE, FALSE, 0);
|
||||
gtk_widget_show (interest_rate_hbox);
|
||||
gtk_box_pack_start (GTK_BOX (vbox67), interest_rate_hbox, FALSE, FALSE, 0);
|
||||
|
||||
vbox68 = gtk_vbox_new (FALSE, 2);
|
||||
gtk_widget_ref (vbox68);
|
||||
@ -3413,12 +3416,12 @@ create_Financial_Calculator_Dialog (void)
|
||||
gtk_widget_show (present_value_calc_button);
|
||||
gtk_box_pack_end (GTK_BOX (hbox56), present_value_calc_button, FALSE, FALSE, 0);
|
||||
|
||||
present_value_entry = gtk_entry_new ();
|
||||
gtk_widget_ref (present_value_entry);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Financial_Calculator_Dialog), "present_value_entry", present_value_entry,
|
||||
present_value_hbox = gtk_hbox_new (FALSE, 0);
|
||||
gtk_widget_ref (present_value_hbox);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Financial_Calculator_Dialog), "present_value_hbox", present_value_hbox,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (present_value_entry);
|
||||
gtk_box_pack_start (GTK_BOX (vbox68), present_value_entry, FALSE, FALSE, 0);
|
||||
gtk_widget_show (present_value_hbox);
|
||||
gtk_box_pack_start (GTK_BOX (vbox68), present_value_hbox, FALSE, FALSE, 0);
|
||||
|
||||
vbox69 = gtk_vbox_new (FALSE, 2);
|
||||
gtk_widget_ref (vbox69);
|
||||
@ -3458,12 +3461,12 @@ create_Financial_Calculator_Dialog (void)
|
||||
gtk_widget_show (periodic_payment_calc_button);
|
||||
gtk_box_pack_end (GTK_BOX (hbox57), periodic_payment_calc_button, FALSE, FALSE, 0);
|
||||
|
||||
periodic_payment_entry = gtk_entry_new ();
|
||||
gtk_widget_ref (periodic_payment_entry);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Financial_Calculator_Dialog), "periodic_payment_entry", periodic_payment_entry,
|
||||
periodic_payment_hbox = gtk_hbox_new (FALSE, 0);
|
||||
gtk_widget_ref (periodic_payment_hbox);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Financial_Calculator_Dialog), "periodic_payment_hbox", periodic_payment_hbox,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (periodic_payment_entry);
|
||||
gtk_box_pack_start (GTK_BOX (vbox69), periodic_payment_entry, FALSE, FALSE, 0);
|
||||
gtk_widget_show (periodic_payment_hbox);
|
||||
gtk_box_pack_start (GTK_BOX (vbox69), periodic_payment_hbox, FALSE, FALSE, 0);
|
||||
|
||||
vbox70 = gtk_vbox_new (FALSE, 2);
|
||||
gtk_widget_ref (vbox70);
|
||||
@ -3503,12 +3506,12 @@ create_Financial_Calculator_Dialog (void)
|
||||
gtk_widget_show (future_value_calc_button);
|
||||
gtk_box_pack_end (GTK_BOX (hbox58), future_value_calc_button, FALSE, FALSE, 0);
|
||||
|
||||
future_value_entry = gtk_entry_new ();
|
||||
gtk_widget_ref (future_value_entry);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Financial_Calculator_Dialog), "future_value_entry", future_value_entry,
|
||||
future_value_hbox = gtk_hbox_new (FALSE, 0);
|
||||
gtk_widget_ref (future_value_hbox);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Financial_Calculator_Dialog), "future_value_hbox", future_value_hbox,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (future_value_entry);
|
||||
gtk_box_pack_start (GTK_BOX (vbox70), future_value_entry, FALSE, FALSE, 0);
|
||||
gtk_widget_show (future_value_hbox);
|
||||
gtk_box_pack_start (GTK_BOX (vbox70), future_value_hbox, FALSE, FALSE, 0);
|
||||
|
||||
frame27 = gtk_frame_new (NULL);
|
||||
gtk_widget_ref (frame27);
|
||||
@ -3518,7 +3521,7 @@ create_Financial_Calculator_Dialog (void)
|
||||
gtk_box_pack_start (GTK_BOX (hbox54), frame27, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (frame27), 3);
|
||||
|
||||
vbox65 = gtk_vbox_new (TRUE, 10);
|
||||
vbox65 = gtk_vbox_new (FALSE, 12);
|
||||
gtk_widget_ref (vbox65);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Financial_Calculator_Dialog), "vbox65", vbox65,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
@ -3678,7 +3681,7 @@ create_Financial_Calculator_Dialog (void)
|
||||
gtk_object_set_data_full (GTK_OBJECT (Financial_Calculator_Dialog), "vbox72", vbox72,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (vbox72);
|
||||
gtk_box_pack_start (GTK_BOX (vbox65), vbox72, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox65), vbox72, FALSE, FALSE, 0);
|
||||
|
||||
discrete_compounding_radio = gtk_radio_button_new_with_label (compouding_group_group, _("Discrete Compounding"));
|
||||
compouding_group_group = gtk_radio_button_group (GTK_RADIO_BUTTON (discrete_compounding_radio));
|
||||
@ -3697,20 +3700,41 @@ create_Financial_Calculator_Dialog (void)
|
||||
gtk_widget_show (radiobutton6);
|
||||
gtk_box_pack_start (GTK_BOX (vbox72), radiobutton6, FALSE, FALSE, 0);
|
||||
|
||||
hseparator1 = gtk_hseparator_new ();
|
||||
gtk_widget_ref (hseparator1);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Financial_Calculator_Dialog), "hseparator1", hseparator1,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (hseparator1);
|
||||
gtk_box_pack_start (GTK_BOX (vbox65), hseparator1, FALSE, FALSE, 0);
|
||||
|
||||
hbox76 = gtk_hbox_new (FALSE, 3);
|
||||
gtk_widget_ref (hbox76);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Financial_Calculator_Dialog), "hbox76", hbox76,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (hbox76);
|
||||
gtk_box_pack_start (GTK_BOX (vbox65), hbox76, FALSE, FALSE, 10);
|
||||
|
||||
label819 = gtk_label_new (_("Payment Total:"));
|
||||
gtk_widget_ref (label819);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Financial_Calculator_Dialog), "label819", label819,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (label819);
|
||||
gtk_box_pack_start (GTK_BOX (hbox76), label819, FALSE, FALSE, 0);
|
||||
gtk_misc_set_alignment (GTK_MISC (label819), 1, 0.5);
|
||||
|
||||
payment_total_label = gtk_label_new (_("total"));
|
||||
gtk_widget_ref (payment_total_label);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Financial_Calculator_Dialog), "payment_total_label", payment_total_label,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (payment_total_label);
|
||||
gtk_box_pack_start (GTK_BOX (hbox76), payment_total_label, FALSE, FALSE, 0);
|
||||
|
||||
dialog_action_area10 = GNOME_DIALOG (Financial_Calculator_Dialog)->action_area;
|
||||
gtk_object_set_data (GTK_OBJECT (Financial_Calculator_Dialog), "dialog_action_area10", dialog_action_area10);
|
||||
gtk_widget_show (dialog_action_area10);
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area10), GTK_BUTTONBOX_END);
|
||||
gtk_button_box_set_spacing (GTK_BUTTON_BOX (dialog_action_area10), 8);
|
||||
|
||||
gnome_dialog_append_button (GNOME_DIALOG (Financial_Calculator_Dialog), _("Schedule"));
|
||||
schedule_button = g_list_last (GNOME_DIALOG (Financial_Calculator_Dialog)->buttons)->data;
|
||||
gtk_widget_ref (schedule_button);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Financial_Calculator_Dialog), "schedule_button", schedule_button,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (schedule_button);
|
||||
GTK_WIDGET_SET_FLAGS (schedule_button, GTK_CAN_DEFAULT);
|
||||
|
||||
gnome_dialog_append_button (GNOME_DIALOG (Financial_Calculator_Dialog), GNOME_STOCK_BUTTON_CLOSE);
|
||||
close_button = g_list_last (GNOME_DIALOG (Financial_Calculator_Dialog)->buttons)->data;
|
||||
gtk_widget_ref (close_button);
|
||||
|
@ -4820,14 +4820,6 @@ Contingency
|
||||
<pack>GTK_PACK_END</pack>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkButton</class>
|
||||
<name>schedule_button</name>
|
||||
<can_default>True</can_default>
|
||||
<can_focus>True</can_focus>
|
||||
<label>Schedule</label>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkButton</class>
|
||||
<name>close_button</name>
|
||||
@ -5018,18 +5010,19 @@ Contingency
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkEntry</class>
|
||||
<name>interest_rate_entry</name>
|
||||
<can_focus>True</can_focus>
|
||||
<editable>True</editable>
|
||||
<text_visible>True</text_visible>
|
||||
<text_max_length>0</text_max_length>
|
||||
<text></text>
|
||||
<class>GtkHBox</class>
|
||||
<name>interest_rate_hbox</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>Placeholder</class>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
@ -5101,18 +5094,19 @@ Contingency
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkEntry</class>
|
||||
<name>present_value_entry</name>
|
||||
<can_focus>True</can_focus>
|
||||
<editable>True</editable>
|
||||
<text_visible>True</text_visible>
|
||||
<text_max_length>0</text_max_length>
|
||||
<text></text>
|
||||
<class>GtkHBox</class>
|
||||
<name>present_value_hbox</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>Placeholder</class>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
@ -5184,18 +5178,19 @@ Contingency
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkEntry</class>
|
||||
<name>periodic_payment_entry</name>
|
||||
<can_focus>True</can_focus>
|
||||
<editable>True</editable>
|
||||
<text_visible>True</text_visible>
|
||||
<text_max_length>0</text_max_length>
|
||||
<text></text>
|
||||
<class>GtkHBox</class>
|
||||
<name>periodic_payment_hbox</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>Placeholder</class>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
@ -5267,18 +5262,19 @@ Contingency
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkEntry</class>
|
||||
<name>future_value_entry</name>
|
||||
<can_focus>True</can_focus>
|
||||
<editable>True</editable>
|
||||
<text_visible>True</text_visible>
|
||||
<text_max_length>0</text_max_length>
|
||||
<text></text>
|
||||
<class>GtkHBox</class>
|
||||
<name>future_value_hbox</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>Placeholder</class>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
@ -5300,8 +5296,8 @@ Contingency
|
||||
<class>GtkVBox</class>
|
||||
<name>vbox65</name>
|
||||
<border_width>5</border_width>
|
||||
<homogeneous>True</homogeneous>
|
||||
<spacing>10</spacing>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>12</spacing>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
@ -5470,8 +5466,8 @@ Daily (365)
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
@ -5504,6 +5500,62 @@ Daily (365)
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkHSeparator</class>
|
||||
<name>hseparator1</name>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox76</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>3</spacing>
|
||||
<child>
|
||||
<padding>10</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label819</name>
|
||||
<label>Payment Total:</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>1</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>payment_total_label</name>
|
||||
<label>total</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
@ -83,9 +83,6 @@
|
||||
"choose an account to reconcile.\n")
|
||||
#define AMOUNT_NUM_MSG _("The amount must be a number.")
|
||||
#define BALANCE_NUM_MSG _("The balance must be a number.")
|
||||
#define CALC_INTEREST_MSG _("The interest rate cannot be zero.")
|
||||
#define CALC_MISSING_MSG _("You must enter values for the other quantities.")
|
||||
#define CALC_PAYMENTS_MSG _("The number of payments cannot be zero.")
|
||||
#define CHANGE_RECN_MSG _("Do you really want to mark this transaction "\
|
||||
"not reconciled?\nDoing so might make future "\
|
||||
"reconciliation difficult!")
|
||||
|
Loading…
Reference in New Issue
Block a user