[grisbi-cvs] grisbi/src balance_estimate_tab.c, 1.49, 1.50 fenetre_principale.c, 1.126, 1.127 gsb_calendar_entry.c, 1.29, 1.30 gsb_data_account.c, 1.97, 1.98 gsb_data_account.h, 1.40, 1.41 gsb_file_load.c, 1.209, 1.210 gsb_file_save.c, 1.155, 1.156 navigation.c, 1.138, 1.139 traitement_variables.c, 1.188, 1.189
Pierre Biava
pbiava at users.sourceforge.net
Sat Mar 6 23:34:15 CET 2010
- Previous message: [grisbi-cvs] grisbi/po cs.po, 1.96, 1.97 da.po, 1.102, 1.103 de.po, 1.176, 1.177 el.po, 1.66, 1.67 eo.po, 1.59, 1.60 es.po, 1.171, 1.172 fa.po, 1.89, 1.90 fr.po, 1.235, 1.236 grisbi.pot, 1.137, 1.138 he.po, 1.95, 1.96 it.po, 1.95, 1.96 nl.po, 1.94, 1.95 pl.po, 1.100, 1.101 pt_BR.po, 1.97, 1.98 ro.po, 1.96, 1.97 ru.po, 1.94, 1.95 zh_CN.po, 1.90, 1.91
- Next message: [grisbi-cvs] grisbi/po cs.po, 1.97, 1.98 da.po, 1.103, 1.104 de.po, 1.177, 1.178 el.po, 1.67, 1.68 eo.po, 1.60, 1.61 es.po, 1.172, 1.173 fa.po, 1.90, 1.91 fr.po, 1.236, 1.237 grisbi.pot, 1.138, 1.139 he.po, 1.96, 1.97 it.po, 1.96, 1.97 nl.po, 1.95, 1.96 pl.po, 1.101, 1.102 pt_BR.po, 1.98, 1.99 ro.po, 1.97, 1.98 ru.po, 1.95, 1.96 zh_CN.po, 1.91, 1.92
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/grisbi/grisbi/src
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv26400/src
Modified Files:
balance_estimate_tab.c fenetre_principale.c
gsb_calendar_entry.c gsb_data_account.c gsb_data_account.h
gsb_file_load.c gsb_file_save.c navigation.c
traitement_variables.c
Log Message:
Corrections for the budget estimate
Index: traitement_variables.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/traitement_variables.c,v
retrieving revision 1.188
retrieving revision 1.189
diff -u -d -r1.188 -r1.189
--- traitement_variables.c 20 Feb 2010 08:54:00 -0000 1.188
+++ traitement_variables.c 6 Mar 2010 22:34:13 -0000 1.189
@@ -128,6 +128,7 @@
GdkColor couleur_bleue;
GdkColor couleur_jaune;
+GdkColor couleur_division;
GSList *liste_labels_titres_colonnes_liste_ope = NULL;
@@ -503,10 +504,14 @@
couleur_bleue.pixel = 1;
- couleur_jaune.red =40000;
- couleur_jaune.green =40000;
+ couleur_jaune.red = 50535;
+ couleur_jaune.green = 65535;
couleur_jaune.blue = 0;
couleur_jaune.pixel = 1;
+
+ couleur_division.red =64550;
+ couleur_division.green =65535;
+ couleur_division.blue = 33466;
}
/*****************************************************************************************************/
Index: gsb_file_save.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file_save.c,v
retrieving revision 1.155
retrieving revision 1.156
diff -u -d -r1.155 -r1.156
--- gsb_file_save.c 3 Mar 2010 22:21:49 -0000 1.155
+++ gsb_file_save.c 6 Mar 2010 22:34:13 -0000 1.156
@@ -1013,7 +1013,7 @@
mini_auto = gsb_real_save_real_to_string (
gsb_data_account_get_mini_balance_authorized ( account_number ), 2 );
- /* now we can fill the file content */
+ /* now we can fill the file content */
new_string = g_markup_printf_escaped ( "\t<Account\n"
"\t\tName=\"%s\"\n"
"\t\tId=\"%s\"\n"
@@ -1046,7 +1046,13 @@
"\t\tForm_columns_number=\"%d\"\n"
"\t\tForm_lines_number=\"%d\"\n"
"\t\tForm_organization=\"%s\"\n"
- "\t\tForm_columns_width=\"%s\" />\n",
+ "\t\tForm_columns_width=\"%s\"\n"
+ "\t\tBet_Ddte=\"%d\"\n"
+ "\t\tBet_start_date=\"%s\"\n"
+ "\t\tBet_Nbre=\"%d\"\n"
+ "\t\tBet_UT=\"%d\"\n"
+ "\t\tBet_SD=\"%d\"\n"
+ "\t\tBet_Fi=\"%d\" />\n",
my_safe_null_str(gsb_data_account_get_name (account_number)),
my_safe_null_str(gsb_data_account_get_id (account_number)),
account_number,
@@ -1078,7 +1084,14 @@
gsb_data_form_get_nb_columns (account_number),
gsb_data_form_get_nb_rows (account_number),
my_safe_null_str(form_organization),
- my_safe_null_str(form_columns_width) );
+ my_safe_null_str(form_columns_width),
+ gsb_data_account_get_bet_deb_period ( account_number ),
+ my_safe_null_str ( gsb_format_gdate_safe (
+ gsb_data_account_get_bet_start_date ( account_number ) ) ),
+ gsb_data_account_get_bet_months ( account_number ),
+ gsb_data_account_get_bet_spin_range ( account_number ),
+ gsb_data_account_get_bet_hist_data ( account_number ),
+ gsb_data_account_get_bet_hist_fyear ( account_number ) );
g_free (sort_list);
g_free (sort_kind_column);
Index: navigation.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/navigation.c,v
retrieving revision 1.138
retrieving revision 1.139
diff -u -d -r1.138 -r1.139
--- navigation.c 4 Mar 2010 18:36:07 -0000 1.138
+++ navigation.c 6 Mar 2010 22:34:13 -0000 1.139
@@ -1166,12 +1166,13 @@
case 1:
gsb_form_set_expander_visible (FALSE, FALSE );
break;
+#ifdef ENABLE_BALANCE_ESTIMATE
case 2:
case 3:
gsb_form_set_expander_visible (FALSE, FALSE );
bet_array_update_estimate_tab ( );
break;
-
+#endif /* ENABLE_BALANCE_ESTIMATE */
}
gsb_form_show ( FALSE );
Index: gsb_calendar_entry.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_calendar_entry.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- gsb_calendar_entry.c 29 Nov 2009 18:53:39 -0000 1.29
+++ gsb_calendar_entry.c 6 Mar 2010 22:34:12 -0000 1.30
@@ -122,21 +122,19 @@
if (!entry
||
!GTK_IS_ENTRY (entry))
- return FALSE;
+ return FALSE;
if (!date
||
!g_date_valid (date))
{
- gtk_entry_set_text ( GTK_ENTRY (entry),
- "" );
- return FALSE;
+ gtk_entry_set_text ( GTK_ENTRY (entry), "" );
+ return FALSE;
}
- string = gsb_format_gdate (date);
- gtk_entry_set_text ( GTK_ENTRY (entry),
- string );
- g_free (string);
+ string = gsb_format_gdate ( date );
+ gtk_entry_set_text ( GTK_ENTRY ( entry ), string );
+ g_free ( string );
return TRUE;
}
Index: gsb_data_account.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_account.c,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -d -r1.97 -r1.98
--- gsb_data_account.c 1 Mar 2010 22:22:53 -0000 1.97
+++ gsb_data_account.c 6 Mar 2010 22:34:12 -0000 1.98
@@ -114,6 +114,14 @@
/** @name struct of the form's organization */
gpointer form_organization;
+
+ /** @name bet data */
+ GDate *bet_start_date; /* date de début */
+ gint bet_deb_period; /* définition de la période 1 = premier jour du mois, 2 date jour */
+ gint bet_spin_range; /* echelle de la période 0 = mois 1 = années */
+ gint bet_months; /* nombre de mois ou d'années */
+ gint bet_hist_data; /* origine des données catégories ou IB */
+ gint bet_hist_fyear; /* numéro d'exercice */
} struct_account;
@@ -2687,7 +2695,7 @@
/**
- * Calculates the balance at the date today.
+ * Calculates the balance at the date today for the bet module.
* Excludes future transactions.
*
*
@@ -2753,3 +2761,257 @@
return gsb_real_add ( current_balance, current_balance_later );
}
+
+
+/**
+ *
+ *
+ *
+ * */
+GDate *gsb_data_account_get_bet_start_date ( gint account_number )
+{
+ GDate *date = NULL;
+ struct_account *account;
+
+ account = gsb_data_account_get_structure ( account_number );
+
+ if (!account )
+ return 0;
+
+ date = account -> bet_start_date;
+
+ if ( date && g_date_valid ( date ) )
+ return gsb_date_copy ( date );
+ else
+ {
+ date = gdate_today ( );
+ if ( etat.bet_deb_period == 1 )
+ g_date_set_day ( date, 1 );
+
+ return date;
+ }
+}
+
+
+/**
+ *
+ *
+ *
+ * */
+gboolean gsb_data_account_set_bet_start_date ( gint account_number, const GDate *date )
+{
+ struct_account *account;
+
+ account = gsb_data_account_get_structure ( account_number );
+
+ if (!account )
+ return FALSE;
+
+ if ( date && g_date_valid ( date ) )
+ {
+ account -> bet_start_date = gsb_date_copy ( date );
+ return TRUE;
+ }
+ else
+ {
+ GDate *date_new;
+
+ date_new = gdate_today ( );
+ if ( etat.bet_deb_period == 1 )
+ g_date_set_day ( date_new, 1 );
+ account -> bet_start_date = date_new;
+ return FALSE;
+ }
+}
+
+
+/**
+ *
+ *
+ *
+ * */
+gint gsb_data_account_get_bet_spin_range ( gint account_number )
+{
+ struct_account *account;
+
+ account = gsb_data_account_get_structure ( account_number );
+
+ if (!account )
+ return 0;
+
+ return account -> bet_spin_range;
+}
+
+
+/**
+ *
+ *
+ *
+ * */
+gboolean gsb_data_account_set_bet_spin_range ( gint account_number, gint spin_range )
+{
+ struct_account *account;
+
+ account = gsb_data_account_get_structure ( account_number );
+
+ if (!account )
+ return FALSE;
+
+ account -> bet_spin_range = spin_range;
+
+ return TRUE;
+}
+
+
+/**
+ *
+ *
+ *
+ * */
+gint gsb_data_account_get_bet_months ( gint account_number )
+{
+ struct_account *account;
+
+ account = gsb_data_account_get_structure ( account_number );
+
+ if (!account )
+ return 0;
+
+ return account -> bet_months;
+}
+
+
+/**
+ *
+ *
+ *
+ * */
+gboolean gsb_data_account_set_bet_months ( gint account_number, gint months )
+{
+ struct_account *account;
+
+ account = gsb_data_account_get_structure ( account_number );
+
+ if (!account )
+ return FALSE;
+
+ account -> bet_months = months;
+
+ return TRUE;
+}
+
+
+/**
+ *
+ *
+ *
+ * */
+gint gsb_data_account_get_bet_hist_data ( gint account_number )
+{
+ struct_account *account;
+
+ account = gsb_data_account_get_structure ( account_number );
+
+ if (!account )
+ return 0;
+
+ return account -> bet_hist_data;
+}
+
+
+/**
+ *
+ *
+ *
+ * */
+gboolean gsb_data_account_set_bet_hist_data ( gint account_number, gint hist_data )
+{
+ struct_account *account;
+
+ account = gsb_data_account_get_structure ( account_number );
+
+ if (!account )
+ return FALSE;
+
+ account -> bet_hist_data = hist_data;
+
+ return TRUE;
+}
+
+
+/**
+ *
+ *
+ *
+ * */
+gint gsb_data_account_get_bet_hist_fyear ( gint account_number )
+{
+ struct_account *account;
+
+ account = gsb_data_account_get_structure ( account_number );
+
+ if (!account )
+ return 0;
+
+ return account -> bet_hist_fyear;
+}
+
+
+/**
+ *
+ *
+ *
+ * */
+gboolean gsb_data_account_set_bet_hist_fyear ( gint account_number, gint hist_fyear )
+{
+ struct_account *account;
+
+ account = gsb_data_account_get_structure ( account_number );
+
+ if (!account )
+ return FALSE;
+
+ account -> bet_hist_fyear = hist_fyear;
+
+ return TRUE;
+}
+
+
+/**
+ *
+ *
+ *
+ * */
+gint gsb_data_account_get_bet_deb_period ( gint account_number )
+{
+ struct_account *account;
+
+ account = gsb_data_account_get_structure ( account_number );
+
+ if (!account )
+ return 0;
+
+ return account -> bet_deb_period;
+}
+
+
+/**
+ *
+ *
+ *
+ * */
+gboolean gsb_data_account_set_bet_deb_period ( gint account_number, gint deb_period )
+{
+ struct_account *account;
+
+ account = gsb_data_account_get_structure ( account_number );
+
+ if (!account )
+ return FALSE;
+
+ account -> bet_deb_period = deb_period;
+
+ return TRUE;
+}
+
+
Index: gsb_file_load.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file_load.c,v
retrieving revision 1.209
retrieving revision 1.210
diff -u -d -r1.209 -r1.210
--- gsb_file_load.c 3 Mar 2010 22:21:49 -0000 1.209
+++ gsb_file_load.c 6 Mar 2010 22:34:12 -0000 1.210
@@ -1720,6 +1720,54 @@
continue;
}
+ if ( !strcmp ( attribute_names[i], "Bet_Ddte" ))
+ {
+ gsb_data_account_set_bet_deb_period ( account_number,
+ utils_str_atoi ( attribute_values[i] ) );
+ i++;
+ continue;
+ }
+
+ if ( !strcmp ( attribute_names[i], "Bet_start_date" ))
+ {
+ gsb_data_account_set_bet_start_date ( account_number,
+ gsb_parse_date_string_safe ( attribute_values[i] ) );
+ i++;
+ continue;
+ }
+
+ if ( !strcmp ( attribute_names[i], "Bet_Nbre" ))
+ {
+ gsb_data_account_set_bet_months ( account_number,
+ utils_str_atoi ( attribute_values[i] ) );
+ i++;
+ continue;
+ }
+
+ if ( !strcmp ( attribute_names[i], "Bet_UT" ))
+ {
+ gsb_data_account_set_bet_spin_range ( account_number,
+ utils_str_atoi ( attribute_values[i] ) );
+ i++;
+ continue;
+ }
+
+ if ( !strcmp ( attribute_names[i], "Bet_SD" ))
+ {
+ gsb_data_account_set_bet_hist_data ( account_number,
+ utils_str_atoi ( attribute_values[i] ) );
+ i++;
+ continue;
+ }
+
+ if ( !strcmp ( attribute_names[i], "Bet_Fi" ))
+ {
+ gsb_data_account_set_bet_hist_fyear ( account_number,
+ utils_str_atoi ( attribute_values[i] ) );
+ i++;
+ continue;
+ }
+
/* normally, shouldn't come here */
i++;
}
Index: balance_estimate_tab.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_tab.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- balance_estimate_tab.c 5 Mar 2010 22:18:55 -0000 1.49
+++ balance_estimate_tab.c 6 Mar 2010 22:34:12 -0000 1.50
@@ -46,6 +46,7 @@
#include "./utils_dates.h"
#include "./gsb_data_account.h"
#include "./gsb_data_budget.h"
+#include "./gsb_calendar_entry.h"
#include "./gsb_data_category.h"
#include "./gsb_data_fyear.h"
#include "./gsb_data_payee.h"
@@ -76,6 +77,9 @@
GtkTreeIter *itera,
GtkTreeIter *iterb,
gpointer user_data );
+static gboolean bet_array_entry_key_press ( GtkWidget *entry,
+ GdkEventKey *ev,
+ gpointer data );
static void bet_array_list_add_substract_menu ( GtkWidget *menu_item,
GtkTreeSelection *tree_selection );
static gboolean bet_array_list_button_press ( GtkWidget *tree_view,
@@ -83,6 +87,7 @@
static void bet_array_list_context_menu ( GtkWidget *tree_view );
static void bet_array_list_redo_menu ( GtkWidget *menu_item,
GtkTreeSelection *tree_selection );
+static gboolean bet_array_list_set_background_color ( GtkWidget *tree_view );
static void bet_array_list_update_balance ( GtkTreeModel *model );
static void bet_array_refresh_scheduled_data ( GtkTreeModel *tab_model,
gint selected_account,
@@ -92,6 +97,9 @@
gint selected_account,
GDate *date_min,
GDate *date_max );
+static gboolean bet_array_start_date_focus_out ( GtkWidget *entry,
+ GdkEventFocus *ev,
+ gpointer data );
static gboolean bet_array_update_average_column (GtkTreeModel *model,
GtkTreePath *path,
GtkTreeIter *iter,
@@ -101,19 +109,16 @@
/*START_EXTERN*/
extern gboolean balances_with_scheduled;
extern gchar* bet_duration_array[];
+extern GdkColor couleur_fond[0];
+extern GdkColor couleur_division;
extern GtkWidget *notebook_general;
extern gsb_real null_real;
extern GtkWidget *window;
/*END_EXTERN*/
-enum bet_account_tree_columns {
- SPP_ACCOUNT_TREE_NUM_COLUMN,
- SPP_ACCOUNT_TREE_NAME_COLUMN,
- SPP_ACCOUNT_TREE_NUM_COLUMNS
-};
-
enum bet_estimation_tree_columns {
SPP_ESTIMATE_TREE_SELECT_COLUMN, /* select column for the balance */
+ SPP_ESTIMATE_TREE_DIVISION_COLUMN,
SPP_ESTIMATE_TREE_DATE_COLUMN,
SPP_ESTIMATE_TREE_DESC_COLUMN,
SPP_ESTIMATE_TREE_DEBIT_COLUMN,
@@ -122,6 +127,7 @@
SPP_ESTIMATE_TREE_SORT_DATE_COLUMN,
SPP_ESTIMATE_TREE_AMOUNT_COLUMN, /* the amount without currency */
SPP_ESTIMATE_TREE_BALANCE_COLOR,
+ SPP_ESTIMATE_TREE_BACKGROUND_COLOR,
SPP_ESTIMATE_TREE_NUM_COLUMNS
};
@@ -268,7 +274,7 @@
gchar *str_amount;
gchar *title;
gchar *tmp_str;
- gint selected_account;
+ gint account_nb;
GDate *date_init;
GDate *date_min;
GDate *date_max;
@@ -281,28 +287,32 @@
tmp_range = initialise_struct_bet_range ( );
/* find the selected account */
- selected_account = gsb_gui_navigation_get_current_account ( );
+ account_nb = gsb_gui_navigation_get_current_account ( );
- if ( selected_account == -1 )
+ if ( account_nb == -1 )
return;
/* calculate date_min and date_max with user choice */
- date_min = gdate_today ();
- if ( etat.bet_deb_period == 1 )
- g_date_set_day ( date_min, 1 );
+ date_min = gsb_data_account_get_bet_start_date ( account_nb );
date_init = gsb_date_copy ( date_min );
g_date_subtract_days ( date_init, 1 );
- date_max = gdate_today ();
+ date_max = gsb_date_copy ( date_min );
- if ( etat.bet_end_period == 1 )
+ if ( g_date_get_day ( date_min ) == 1 )
{
g_date_add_months (date_max, etat.bet_months - 1 );
date_max = gsb_date_get_last_day_of_month ( date_max );
}
else
+ {
g_date_add_months (date_max, etat.bet_months );
+ g_date_subtract_days ( date_max, 1 );
+ }
+
+ widget = g_object_get_data ( G_OBJECT ( notebook ), "initial_date");
+ gsb_calendar_entry_set_date ( widget, date_min );
str_date_init = gsb_format_gdate ( date_init );
str_date_min = gsb_format_gdate ( date_min );
@@ -316,22 +326,21 @@
* in the future in the account. So we need to calculate the balance
* of today */
current_balance = gsb_data_account_calculate_current_day_balance (
- selected_account, date_min );
+ account_nb, date_min );
str_amount = gsb_real_save_real_to_string ( current_balance, 2 );
str_current_balance = gsb_real_get_string_with_currency ( current_balance,
- gsb_data_account_get_currency ( selected_account ), TRUE );
+ gsb_data_account_get_currency ( account_nb ), TRUE );
if ( current_balance.mantissa < 0 )
color_str = "red";
else
color_str = NULL;
-
/* set the titles of tabs module budget */
title = g_strdup_printf (
_("Balance estimate of the account \"%s\" from %s to %s"),
- gsb_data_account_get_name ( selected_account ),
+ gsb_data_account_get_name ( account_nb ),
str_date_min, str_date_max );
widget = GTK_WIDGET ( g_object_get_data ( G_OBJECT ( notebook ), "bet_array_title") );
@@ -340,13 +349,11 @@
title = g_strdup_printf (
_("Please select the data source for the account: \"%s\""),
- gsb_data_account_get_name (
- gsb_gui_navigation_get_current_account ( ) ) );
+ gsb_data_account_get_name ( account_nb ) );
widget = GTK_WIDGET ( g_object_get_data ( G_OBJECT ( notebook ), "bet_hist_title") );
gtk_label_set_markup ( GTK_LABEL ( widget ), title );
g_free ( title );
-
/* clear the model */
tree_view = g_object_get_data ( G_OBJECT ( notebook ), "bet_estimate_treeview" );
tree_model = gtk_tree_view_get_model ( GTK_TREE_VIEW ( tree_view ) );
@@ -363,6 +370,7 @@
SPP_ESTIMATE_TREE_BALANCE_COLUMN, str_current_balance,
SPP_ESTIMATE_TREE_AMOUNT_COLUMN, str_amount,
SPP_ESTIMATE_TREE_BALANCE_COLOR, color_str,
+ SPP_ESTIMATE_TREE_BACKGROUND_COLOR, &couleur_fond[0],
-1);
g_value_unset ( &date_value );
@@ -378,17 +386,18 @@
/* search transactions of the account which are in the period */
bet_array_refresh_transactions_data ( tree_model,
- selected_account,
+ account_nb,
date_min,
date_max );
/* for each schedulded operation */
bet_array_refresh_scheduled_data ( tree_model,
- selected_account,
+ account_nb,
date_min,
date_max );
g_free ( date_min );
+ g_free ( date_init );
g_free ( date_max );
/* Calculate the balance column */
@@ -397,6 +406,8 @@
gtk_tree_model_foreach ( GTK_TREE_MODEL ( tree_model ),
bet_array_update_average_column, tmp_range );
+
+ bet_array_list_set_background_color ( tree_view );
}
@@ -410,6 +421,7 @@
{
GtkWidget *notebook;
GtkWidget *widget = NULL;
+ GtkWidget *initial_date = NULL;
GtkWidget *vbox;
GtkWidget *hbox;
GtkWidget *align;
@@ -419,6 +431,7 @@
GtkWidget *scrolled_window;
GtkWidget *tree_view;
GtkTreeStore *tree_model;
+ GtkTreeModel *sortable;
GtkCellRenderer *cell;
GtkTreeViewColumn *column;
gint iduration;
@@ -442,6 +455,7 @@
gtk_container_add ( GTK_CONTAINER ( align ), hbox );
label = gtk_label_new ( _("Duration estimation") );
+ gtk_misc_set_padding ( GTK_MISC (label), 5, 0 );
gtk_box_pack_start( GTK_BOX ( hbox ), label, FALSE, FALSE, 5);
if ( etat.bet_spin_range == 0 )
@@ -449,12 +463,14 @@
spin_button = gtk_spin_button_new_with_range ( 1.0, 240.0, 1.0);
gtk_spin_button_set_value ( GTK_SPIN_BUTTON ( spin_button ),
(gdouble) etat.bet_months );
+ gtk_widget_grab_focus ( spin_button );
}
else
{
spin_button = gtk_spin_button_new_with_range ( 1.0, 20.0, 1.0 );
gtk_spin_button_set_value ( GTK_SPIN_BUTTON ( spin_button ),
(gdouble) ( etat.bet_months / 12 ) );
+ gtk_widget_grab_focus ( spin_button );
}
gtk_widget_set_name ( spin_button, "spin_button" );
@@ -491,6 +507,22 @@
widget );
gtk_box_pack_start ( GTK_BOX ( hbox ), spin_button, FALSE, FALSE, 0 );
+ label = gtk_label_new ( COLON ( _("Start date" ) ) );
+ gtk_misc_set_padding ( GTK_MISC (label), 5, 0 );
+ gtk_box_pack_start ( GTK_BOX (hbox), label, FALSE, FALSE, 0 );
+
+ initial_date = gsb_calendar_entry_new ( FALSE );
+ g_signal_connect ( G_OBJECT ( initial_date ),
+ "focus-out-event",
+ G_CALLBACK ( bet_array_start_date_focus_out ),
+ NULL );
+ g_signal_connect ( G_OBJECT ( initial_date ),
+ "key-press-event",
+ G_CALLBACK ( bet_array_entry_key_press ),
+ NULL );
+ g_object_set_data ( G_OBJECT ( notebook ), "initial_date", initial_date );
+ gtk_box_pack_start ( GTK_BOX (hbox), initial_date, FALSE, FALSE, 0 );
+
/* create the estimate treeview */
tree_view = gtk_tree_view_new ( );
gtk_tree_view_set_rules_hint ( GTK_TREE_VIEW ( tree_view ), TRUE );
@@ -498,19 +530,23 @@
/* create the model */
tree_model = gtk_tree_store_new ( SPP_ESTIMATE_TREE_NUM_COLUMNS,
- G_TYPE_BOOLEAN, /*SPP_ESTIMATE_TREE_SELECT_COLUMN */
- G_TYPE_STRING, /* SPP_ESTIMATE_TREE_DATE_COLUMN */
- G_TYPE_STRING, /* SPP_ESTIMATE_TREE_DESC_COLUMN */
- G_TYPE_STRING, /* SPP_ESTIMATE_TREE_DEBIT_COLUMN */
- G_TYPE_STRING, /* SPP_ESTIMATE_TREE_CREDIT_COLUMN */
- G_TYPE_STRING, /* SPP_ESTIMATE_TREE_BALANCE_COLUMN */
- G_TYPE_DATE, /* SPP_ESTIMATE_TREE_SORT_DATE_COLUMN */
- G_TYPE_STRING, /* SPP_ESTIMATE_TREE_AMOUNT_COLUMN */
- G_TYPE_STRING );/*SPP_ESTIMATE_TREE_BALANCE_COLOR */
+ G_TYPE_BOOLEAN, /* SPP_ESTIMATE_TREE_SELECT_COLUMN */
+ G_TYPE_BOOLEAN, /* SPP_ESTIMATE_TREE_DIVISION_COLUMN */
+ G_TYPE_STRING, /* SPP_ESTIMATE_TREE_DATE_COLUMN */
+ G_TYPE_STRING, /* SPP_ESTIMATE_TREE_DESC_COLUMN */
+ G_TYPE_STRING, /* SPP_ESTIMATE_TREE_DEBIT_COLUMN */
+ G_TYPE_STRING, /* SPP_ESTIMATE_TREE_CREDIT_COLUMN */
+ G_TYPE_STRING, /* SPP_ESTIMATE_TREE_BALANCE_COLUMN */
+ G_TYPE_DATE, /* SPP_ESTIMATE_TREE_SORT_DATE_COLUMN */
+ G_TYPE_STRING, /* SPP_ESTIMATE_TREE_AMOUNT_COLUMN */
+ G_TYPE_STRING, /* SPP_ESTIMATE_TREE_BALANCE_COLOR */
+ GDK_TYPE_COLOR ); /* SPP_ESTIMATE_TREE_BACKGROUND_COLOR */
+
gtk_tree_view_set_model ( GTK_TREE_VIEW ( tree_view ), GTK_TREE_MODEL ( tree_model ) );
g_object_unref ( G_OBJECT ( tree_model ) );
/* sort by date */
+ sortable = gtk_tree_model_sort_new_with_model ( GTK_TREE_MODEL ( tree_model ) );
gtk_tree_sortable_set_sort_func ( GTK_TREE_SORTABLE ( tree_model ),
SPP_ESTIMATE_TREE_SORT_DATE_COLUMN,
(GtkTreeIterCompareFunc) bet_array_date_sort_function,
@@ -532,7 +568,8 @@
column = gtk_tree_view_column_new_with_attributes (
_("Date"), cell,
"text", SPP_ESTIMATE_TREE_DATE_COLUMN,
- NULL);
+ "cell-background-gdk", SPP_ESTIMATE_TREE_BACKGROUND_COLOR,
+ NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view),
GTK_TREE_VIEW_COLUMN(column));
gtk_tree_view_column_set_min_width(GTK_TREE_VIEW_COLUMN(column), 150);
@@ -540,9 +577,10 @@
/* Description column */
cell = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes (
- _("Description"), cell,
- "text", SPP_ESTIMATE_TREE_DESC_COLUMN,
- NULL);
+ _("Description"), cell,
+ "text", SPP_ESTIMATE_TREE_DESC_COLUMN,
+ "cell-background-gdk", SPP_ESTIMATE_TREE_BACKGROUND_COLOR,
+ NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view),
GTK_TREE_VIEW_COLUMN(column));
gtk_tree_view_column_set_min_width(column, 300);
@@ -551,9 +589,10 @@
/* Debit column */
cell = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes (
- _("Debit"), cell,
- "text", SPP_ESTIMATE_TREE_DEBIT_COLUMN,
- NULL);
+ _("Debit"), cell,
+ "text", SPP_ESTIMATE_TREE_DEBIT_COLUMN,
+ "cell-background-gdk", SPP_ESTIMATE_TREE_BACKGROUND_COLOR,
+ NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view),
GTK_TREE_VIEW_COLUMN(column));
gtk_tree_view_column_set_min_width(column, 140);
@@ -565,9 +604,10 @@
cell = gtk_cell_renderer_text_new ();
g_object_set(G_OBJECT(GTK_CELL_RENDERER(cell)), "xalign", 1.0, NULL );
column = gtk_tree_view_column_new_with_attributes (
- _("Credit"), cell,
- "text", SPP_ESTIMATE_TREE_CREDIT_COLUMN,
- NULL);
+ _("Credit"), cell,
+ "text", SPP_ESTIMATE_TREE_CREDIT_COLUMN,
+ "cell-background-gdk", SPP_ESTIMATE_TREE_BACKGROUND_COLOR,
+ NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view),
GTK_TREE_VIEW_COLUMN(column));
gtk_tree_view_column_set_min_width(column, 140);
@@ -581,6 +621,7 @@
_("Balance"), cell,
"text", SPP_ESTIMATE_TREE_BALANCE_COLUMN,
"foreground", SPP_ESTIMATE_TREE_BALANCE_COLOR,
+ "cell-background-gdk", SPP_ESTIMATE_TREE_BACKGROUND_COLOR,
NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view),
GTK_TREE_VIEW_COLUMN(column));
@@ -723,6 +764,7 @@
SPP_ESTIMATE_TREE_SORT_DATE_COLUMN,
&date_value );
gtk_tree_store_set ( GTK_TREE_STORE ( tab_model ), &iter,
+ SPP_ESTIMATE_TREE_DIVISION_COLUMN, FALSE,
SPP_ESTIMATE_TREE_DATE_COLUMN, str_date,
SPP_ESTIMATE_TREE_DESC_COLUMN, str_description,
SPP_ESTIMATE_TREE_DEBIT_COLUMN, str_debit,
@@ -811,7 +853,7 @@
{
if ( g_date_compare ( date, date_jour ) > 1 )
continue;
- else
+ else if ( g_date_get_month ( date ) >= g_date_get_month ( date_jour ) )
bet_array_adjust_hist_data ( div_number, sub_div_nb, amount, tab_model );
}
@@ -855,6 +897,7 @@
SPP_ESTIMATE_TREE_SORT_DATE_COLUMN,
&date_value );
gtk_tree_store_set ( GTK_TREE_STORE ( tab_model ), &iter,
+ SPP_ESTIMATE_TREE_DIVISION_COLUMN, FALSE,
SPP_ESTIMATE_TREE_DATE_COLUMN, str_date,
SPP_ESTIMATE_TREE_DESC_COLUMN, str_description,
SPP_ESTIMATE_TREE_DEBIT_COLUMN, str_debit,
@@ -887,6 +930,7 @@
{
GtkTreeIter tab_iter;
GDate *date;
+ GDate *date_jour;
GValue date_value = {0, };
gchar *str_date;
gchar *str_description;
@@ -899,8 +943,9 @@
gsb_real amount;
//~ devel_debug (NULL);
+ date_jour = gdate_today ( );
date = gsb_date_get_last_day_of_month ( date_min );
-
+
/* initialise les données de la ligne insérée */
gtk_tree_model_get ( GTK_TREE_MODEL ( model ), iter,
SPP_HISTORICAL_DESC_COLUMN, &str_description,
@@ -929,7 +974,9 @@
if ( g_date_compare ( date, date_max ) > 0 )
break;
- if ( g_date_compare ( date, date_min ) < 0 )
+ if ( g_date_compare ( date, date_min ) < 0
+ ||
+ g_date_get_month ( date ) < g_date_get_month ( date_jour ) )
{
g_date_add_months ( date, 1 );
continue;
@@ -951,6 +998,7 @@
SPP_ESTIMATE_TREE_SORT_DATE_COLUMN,
&date_value );
gtk_tree_store_set ( GTK_TREE_STORE ( tab_model ), &tab_iter,
+ SPP_ESTIMATE_TREE_DIVISION_COLUMN, TRUE,
SPP_ESTIMATE_TREE_DATE_COLUMN, str_date,
SPP_ESTIMATE_TREE_DESC_COLUMN, str_description,
SPP_ESTIMATE_TREE_DEBIT_COLUMN, str_debit,
@@ -1231,6 +1279,109 @@
*
*
* */
+gboolean bet_array_entry_key_press ( GtkWidget *entry,
+ GdkEventKey *ev,
+ gpointer data )
+{
+ gint account_nb;
+ GDate *date;
+
+ switch ( ev -> keyval )
+ {
+ case GDK_Escape :
+ account_nb = gsb_gui_navigation_get_current_account ( );
+ date = gsb_data_account_get_bet_start_date ( account_nb );
+ gtk_entry_set_text ( GTK_ENTRY ( entry ),
+ gsb_format_gdate ( date ) );
+ break;
+ case GDK_KP_Enter :
+ case GDK_Return :
+ bet_array_start_date_focus_out ( entry, NULL, data );
+ break;
+ }
+
+ return FALSE;
+}
+/**
+ *
+ *
+ *
+ *
+ * */
+gboolean bet_array_start_date_focus_out ( GtkWidget *entry,
+ GdkEventFocus *ev,
+ gpointer data )
+{
+ gint account_nb;
+ GDate *date;
+
+ gtk_editable_select_region ( GTK_EDITABLE ( entry ), 0, 0 );
+ account_nb = gsb_gui_navigation_get_current_account ( );
+ date = gsb_parse_date_string ( gtk_entry_get_text ( GTK_ENTRY ( entry ) ) );
+ gsb_data_account_set_bet_start_date ( account_nb, date );
+
+ if ( etat.modification_fichier == 0 )
+ modification_fichier ( TRUE );
+
+ bet_array_refresh_estimate_tab ( );
+
+ return FALSE;
+}
+
+
+/**
+ * set the background colors of the list
+ *
+ * \param tree_view
+ *
+ * \return FALSE
+ * */
+gboolean bet_array_list_set_background_color ( GtkWidget *tree_view )
+{
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+
+ devel_debug (NULL);
+
+ if ( !tree_view )
+ return FALSE;
+
+ model = gtk_tree_view_get_model ( GTK_TREE_VIEW ( tree_view ));
+
+
+
+ if ( gtk_tree_model_get_iter_first ( GTK_TREE_MODEL ( model ), &iter ) )
+ {
+ gint div = 0;
+ gint current_color = 0;
+
+ do
+ {
+ gtk_tree_model_get ( GTK_TREE_MODEL ( model ),
+ &iter,
+ SPP_ESTIMATE_TREE_DIVISION_COLUMN, &div,
+ -1 );
+ if ( div == 0 )
+ {
+ gtk_tree_store_set ( GTK_TREE_STORE ( model ),
+ &iter,
+ SPP_ESTIMATE_TREE_BACKGROUND_COLOR, &couleur_fond[current_color],
+ -1 );
+ current_color = !current_color;
+ }
+ else
+ gtk_tree_store_set ( GTK_TREE_STORE ( model ),
+ &iter,
+ SPP_ESTIMATE_TREE_BACKGROUND_COLOR, &couleur_division,
+ -1 );
+ }
+ while ( gtk_tree_model_iter_next ( GTK_TREE_MODEL ( model ), &iter ) );
+ }
+
+ return FALSE;
+}
+
+
/* Local Variables: */
/* c-basic-offset: 4 */
/* End: */
Index: fenetre_principale.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/fenetre_principale.c,v
retrieving revision 1.126
retrieving revision 1.127
diff -u -d -r1.126 -r1.127
--- fenetre_principale.c 4 Mar 2010 18:36:07 -0000 1.126
+++ fenetre_principale.c 6 Mar 2010 22:34:12 -0000 1.127
@@ -314,12 +314,13 @@
case 1:
gsb_form_set_expander_visible (FALSE, FALSE );
break;
+#ifdef ENABLE_BALANCE_ESTIMATE
case 2:
case 3:
gsb_form_set_expander_visible (FALSE, FALSE );
bet_array_update_estimate_tab ( );
break;
-
+#endif /* ENABLE_BALANCE_ESTIMATE */
}
return ( FALSE );
}
Index: gsb_data_account.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_account.h,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- gsb_data_account.h 18 Jan 2010 19:13:40 -0000 1.40
+++ gsb_data_account.h 6 Mar 2010 22:34:12 -0000 1.41
@@ -42,6 +42,12 @@
gchar *gsb_data_account_get_bank_account_key ( gint account_number );
gchar *gsb_data_account_get_bank_account_number ( gint account_number );
gchar *gsb_data_account_get_bank_branch_code ( gint account_number );
+gint gsb_data_account_get_bet_deb_period ( gint account_number );
+gint gsb_data_account_get_bet_hist_data ( gint account_number );
+gint gsb_data_account_get_bet_hist_fyear ( gint account_number );
+gint gsb_data_account_get_bet_months ( gint account_number );
+gint gsb_data_account_get_bet_spin_range ( gint account_number );
+GDate *gsb_data_account_get_bet_start_date ( gint account_number );
gint gsb_data_account_get_closed_account ( gint account_number );
gchar *gsb_data_account_get_comment ( gint account_number );
gint gsb_data_account_get_currency ( gint account_number );
@@ -93,6 +99,12 @@
const gchar *bank_account_number );
gboolean gsb_data_account_set_bank_branch_code ( gint account_number,
const gchar *bank_branch_code );
+gboolean gsb_data_account_set_bet_deb_period ( gint account_number, gint deb_period );
+gboolean gsb_data_account_set_bet_hist_data ( gint account_number, gint hist_data );
+gboolean gsb_data_account_set_bet_hist_fyear ( gint account_number, gint hist_fyear );
+gboolean gsb_data_account_set_bet_months ( gint account_number, gint months );
+gboolean gsb_data_account_set_bet_spin_range ( gint account_number, gint spin_range );
+gboolean gsb_data_account_set_bet_start_date ( gint account_number, const GDate *date );
gboolean gsb_data_account_set_closed_account ( gint account_number,
gint closed_account );
gboolean gsb_data_account_set_comment ( gint account_number,
- Previous message: [grisbi-cvs] grisbi/po cs.po, 1.96, 1.97 da.po, 1.102, 1.103 de.po, 1.176, 1.177 el.po, 1.66, 1.67 eo.po, 1.59, 1.60 es.po, 1.171, 1.172 fa.po, 1.89, 1.90 fr.po, 1.235, 1.236 grisbi.pot, 1.137, 1.138 he.po, 1.95, 1.96 it.po, 1.95, 1.96 nl.po, 1.94, 1.95 pl.po, 1.100, 1.101 pt_BR.po, 1.97, 1.98 ro.po, 1.96, 1.97 ru.po, 1.94, 1.95 zh_CN.po, 1.90, 1.91
- Next message: [grisbi-cvs] grisbi/po cs.po, 1.97, 1.98 da.po, 1.103, 1.104 de.po, 1.177, 1.178 el.po, 1.67, 1.68 eo.po, 1.60, 1.61 es.po, 1.172, 1.173 fa.po, 1.90, 1.91 fr.po, 1.236, 1.237 grisbi.pot, 1.138, 1.139 he.po, 1.96, 1.97 it.po, 1.96, 1.97 nl.po, 1.95, 1.96 pl.po, 1.101, 1.102 pt_BR.po, 1.98, 1.99 ro.po, 1.97, 1.98 ru.po, 1.95, 1.96 zh_CN.po, 1.91, 1.92
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the cvs
mailing list