[grisbi-cvs] [SCM] grisbi branch, pbiava_graph_tools, updated. upstream_version_0_9_4-22-g2130df9
Pierre Biava
nobody at users.sourceforge.net
Mon Sep 26 20:12:28 CEST 2011
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "grisbi".
The branch, pbiava_graph_tools has been updated
via 2130df9fbb5db14c5ab285382a7db6308f2f452f (commit)
via 56337effd60d2d670a745440d0b1f704bf06bb8a (commit)
via 7bbb4cab2c195090605fb37328ada146f88fb4db (commit)
from 538c9c9ccaf4b85c7dfe62886c29deb621990a04 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 2130df9fbb5db14c5ab285382a7db6308f2f452f
Author: pbiava <pierre.biava at nerim.net>
Date: Mon Sep 26 19:32:28 2011 +0200
adding a column balance_amount in the model of historical data for the graphs
commit 56337effd60d2d670a745440d0b1f704bf06bb8a
Author: pbiava <pierre.biava at nerim.net>
Date: Mon Sep 26 19:31:43 2011 +0200
adding a conversion function of a gdouble to a formatted chain with currency
commit 7bbb4cab2c195090605fb37328ada146f88fb4db
Author: pbiava <pierre.biava at nerim.net>
Date: Mon Sep 26 10:05:34 2011 +0200
add preferences for the bar graph
-----------------------------------------------------------------------
Changes:
diff --git a/src/bet_data.h b/src/bet_data.h
index b4e2bfa..1b3d9bc 100644
--- a/src/bet_data.h
+++ b/src/bet_data.h
@@ -113,6 +113,7 @@ enum bet_historical_data_columns {
SPP_HISTORICAL_DESC_COLUMN,
SPP_HISTORICAL_CURRENT_COLUMN, /* Accumulation of the current year */
SPP_HISTORICAL_BALANCE_COLUMN,
+ SPP_HISTORICAL_BALANCE_AMOUNT, /* balance column without currency */
SPP_HISTORICAL_AVERAGE_COLUMN,
SPP_HISTORICAL_AVERAGE_AMOUNT, /* average column without currency */
SPP_HISTORICAL_RETAINED_COLUMN,
diff --git a/src/bet_graph.c b/src/bet_graph.c
index ab640a5..8d44a77 100644
--- a/src/bet_graph.c
+++ b/src/bet_graph.c
@@ -1,7 +1,7 @@
/* ************************************************************************** */
/* */
/* Copyright (C) 2011 Pierre Biava (grisbi at pierre.biava.name) */
-/* 2011 Guillaume Verger */
+/* 2011 Guillaume Verger (guillaume.verger at laposte.net) */
/* http://www.grisbi.org */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -44,6 +44,7 @@
#include "structures.h"
#include "utils_gtkbuilder.h"
#include "utils_dates.h"
+#include "utils_real.h"
#include "utils_str.h"
#include "erreur.h"
/*END_INCLUDE*/
@@ -51,15 +52,18 @@
typedef struct _struct_bet_graph_data struct_bet_graph_data;
typedef struct _struct_bet_graph_button struct_bet_graph_button;
-
+typedef struct _struct_bet_graph_prefs struct_bet_graph_prefs;
struct _struct_bet_graph_data
{
GtkTreeView *tree_view;
+ GtkNotebook *notebook;
gint account_number;
/* Données pour le graphique */
GtkWidget *widget;
+ GogChart *chart;
+ GogPlot *plot;
gchar *title;
gchar *service_id; /* définit le type de graphique */
gboolean is_legend;
@@ -70,9 +74,11 @@ struct _struct_bet_graph_data
/* données pour les histogrammes et XY */
gdouble tab_X[MAX_POINTS_GRAPHIQUE];
gdouble tab_Y[MAX_POINTS_GRAPHIQUE];
+ gboolean valid_data;
/* données pour les camemberts */
- gint type_infos; /* 0 type crédit ou < 0, 1 type débit ou >= 0, -1 tous types */
+ gint type_infos; /* 0 type crédit ou < 0, 1 type débit ou >= 0, -1 tous types */
+ gdouble montant; /* montant annuel toutes catégories. sert au calculde pourcentage */
gchar tab_libelle[MAX_POINTS_GRAPHIQUE][TAILLE_MAX_LIBELLE];
gchar **tab_vue_libelle;
@@ -92,11 +98,27 @@ struct _struct_bet_graph_button
};
+struct _struct_bet_graph_prefs
+{
+ gint major_tick_out; /* TRUE par défaut */
+ gint major_tick_in; /* FALSE par défaut */
+ gint major_tick_labeled; /* affichage des libellés de l'axe X. TRUE par défaut*/
+ gint position; /* position de l'axe des X. Croisé par défaut*/
+ gint cross_entry; /* position du croisement avec l'axe Y. 0 par défaut */
+ gint degrees; /* rotation des étiquettes de l'axe X en degrés. 90° par défaut */
+ gint espacement; /* espace entre deux barres */
+ gint recouvrement; /* les étiquettes sont cachées par les barres par défaut */
+};
+
+
/*START_STATIC*/
static gboolean bet_graph_affiche_camemberts ( struct_bet_graph_data *self );
static gboolean bet_graph_affiche_XY_line ( struct_bet_graph_data *self );
-static void bet_graph_create_graph_widget ( struct_bet_graph_data *self );
+static GogPlot *bet_graph_create_graph_page ( struct_bet_graph_data *self,
+ gboolean add_page );
static void bet_graph_create_pie_canvas ( struct_bet_graph_data *self );
+static GtkWidget *bet_graph_create_line_preferences ( struct_bet_graph_data *self );
+static void bet_graph_create_prefs_page ( struct_bet_graph_data *self );
static GtkWidget *bet_graph_get_canvas ( void );
static gboolean bet_graph_initialise_builder ( void );
static gboolean bet_graph_populate_lines_by_forecast_data ( struct_bet_graph_data *self );
@@ -106,16 +128,25 @@ static void bet_graph_popup_choix_graph_activate ( GtkMenuItem *menuitem,
static gboolean bet_graph_popup_choix_graph_menu ( GtkWidget *button,
GdkEventButton *event,
GList *liste );
+static void bet_graph_rotation_changed ( GORotationSel *rotation,
+ int angle,
+ struct_bet_graph_data *self );
+static void bet_graph_toggle_button_changed ( GtkToggleButton *togglebutton,
+ struct_bet_graph_data *self );
+static void bet_graph_update_graph ( struct_bet_graph_data *self );
static void struct_free_bet_graph_button ( struct_bet_graph_button *self );
static struct_bet_graph_button *struct_initialise_bet_graph_button ( void );
static void struct_free_bet_graph_data ( struct_bet_graph_data *self );
static struct_bet_graph_data *struct_initialise_bet_graph_data ( void );
+static void struct_free_bet_graph_prefs ( struct_bet_graph_prefs *self );
+static struct_bet_graph_prefs *struct_initialise_bet_graph_prefs ( void );
/*END_STATIC*/
/*START_EXTERN*/
/*END_EXTERN*/
static GtkBuilder *bet_graph_builder = NULL;
+static struct_bet_graph_prefs *prefs_lines = NULL;
/**
@@ -144,12 +175,98 @@ gboolean bet_graph_initialise_builder ( void )
*
*
*
+ */
+gboolean bet_graph_on_motion ( GtkWidget *event_box,
+ GdkEventMotion *event,
+ struct_bet_graph_data *self )
+{
+ GogRenderer *rend = NULL;
+ GogView *graph_view = NULL;
+ GogView *view = NULL;
+ GogChartMap *map = NULL;
+ GogSeries *series;
+ gchar *buf = NULL;
+ gint index;
+
+ rend = go_graph_widget_get_renderer ( GO_GRAPH_WIDGET ( self->widget ) );
+ g_object_get ( G_OBJECT ( rend ), "view", &graph_view, NULL );
+ view = gog_view_find_child_view ( graph_view, GOG_OBJECT ( self->plot ) );
+
+ if ( strcmp ( self->service_id, "GogBarColPlot" ) == 0 )
+ {
+ index = gog_plot_view_get_data_at_point ( GOG_PLOT_VIEW ( view ), event->x, event->y, &series );
+
+ if ( index == -1 )
+ buf = NULL;
+ else
+ buf = g_strdup_printf ("date %s : solde %s", self->tab_vue_libelle[index],
+ utils_real_get_string_with_currency_from_double (
+ self->tab_Y[index], self->account_number ) );
+ }
+
+ else if ( strcmp ( self->service_id, "GogLinePlot") == 0 )
+ {
+ GogAxis *x_axis, *y_axis;
+
+ x_axis = GOG_AXIS ( gog_object_get_child_by_name ( GOG_OBJECT ( self->chart ), "X-Axis" ) );
+ y_axis = GOG_AXIS ( gog_object_get_child_by_name ( GOG_OBJECT ( self->chart ), "Y-Axis" ) );
+
+ map = gog_chart_map_new ( self->chart, &(view->allocation), x_axis, y_axis, NULL, FALSE );
+
+ if (gog_chart_map_is_valid ( map )
+ &&
+ event->x >= view->allocation.x && event->x < view->allocation.x + view->allocation.w
+ &&
+ event->y >= view->allocation.y && event->y < view->allocation.y + view->allocation.h )
+ {
+ GogAxisMap *x_map;
+
+ x_map = gog_chart_map_get_axis_map (map, 0);
+ index = (gint) gog_axis_map_from_view (x_map, event->x);
+
+ buf = g_strdup_printf ("date %s : solde %s", self->tab_vue_libelle[index-1],
+ utils_real_get_string_with_currency_from_double (
+ self->tab_Y[index-1], self->account_number ) );
+ }
+ else
+ buf = NULL;
+ }
+ else if ( strcmp ( self->service_id, "GogPiePlot" ) == 0 )
+ {
+
+ index = gog_plot_view_get_data_at_point ( GOG_PLOT_VIEW ( view ), event->x, event->y, &series );
+ if ( index == -1 )
+ buf = NULL;
+ else
+ buf = g_strdup_printf ("%s : %s (%.2f%%)", self->tab_vue_libelle[index],
+ utils_real_get_string_with_currency_from_double (
+ self->tab_Y[index], self->account_number ),
+ ( 100*self->tab_Y[index]/self->montant ) );
+ }
+
+ if ( buf )
+ {
+ gtk_widget_set_tooltip_text ( GTK_WIDGET ( self->widget ), buf );
+ g_free ( buf );
+ }
+ else
+ gtk_widget_set_tooltip_text ( GTK_WIDGET ( self->widget ), "" );
+
+ return TRUE;
+}
+
+
+/**
+ * Création de la page pour le graphique initialisée
+ *
+ *
*
* */
-void bet_graph_create_graph_widget ( struct_bet_graph_data *self )
+GogPlot *bet_graph_create_graph_page ( struct_bet_graph_data *self,
+ gboolean add_page )
{
+ GtkWidget *child;
GtkWidget *w;
- GogChart *chart;
GogGraph *graph;
GogLabel *label;
GogPlot *plot;
@@ -157,8 +274,24 @@ void bet_graph_create_graph_widget ( struct_bet_graph_data *self )
GOData *data;
PangoFontDescription *desc;
- /* Set the graph widget */
- w = self->widget;
+ devel_debug_int (add_page);
+ if ( add_page )
+ {
+ /* Set the new page */
+ child = gtk_vbox_new (FALSE, 0);
+ gtk_notebook_prepend_page ( self->notebook, child, gtk_label_new ( _("Graph") ) );
+ }
+ else
+ child = gtk_notebook_get_nth_page ( GTK_NOTEBOOK ( self->notebook ), 0 );
+
+ /* Set the graph widget */
+ w = go_graph_widget_new ( NULL );
+ g_signal_connect ( G_OBJECT ( w ),
+ "motion-notify-event",
+ G_CALLBACK ( bet_graph_on_motion ), self );
+ gtk_box_pack_end ( GTK_BOX ( child ), w, TRUE, TRUE, 0 );
+
+ self->widget = w;
/* Get the embedded graph */
graph = go_graph_widget_get_graph ( GO_GRAPH_WIDGET ( w ) );
@@ -178,15 +311,34 @@ void bet_graph_create_graph_widget ( struct_bet_graph_data *self )
}
/* Get the chart created by the widget initialization */
- chart = go_graph_widget_get_chart ( GO_GRAPH_WIDGET ( w ) );
+ self->chart = go_graph_widget_get_chart ( GO_GRAPH_WIDGET ( w ) );
/* Create a pie plot and add it to the chart */
plot = ( GogPlot *) gog_plot_new_by_name ( self->service_id );
- gog_object_add_by_name ( GOG_OBJECT ( chart ), "Plot", GOG_OBJECT ( plot ) );
+ gog_object_add_by_name ( GOG_OBJECT ( self->chart ), "Plot", GOG_OBJECT ( plot ) );
/* Add a legend to the chart */
if ( self->is_legend )
- gog_object_add_by_name ( GOG_OBJECT ( chart ), "Legend", NULL);
+ gog_object_add_by_name ( GOG_OBJECT ( self->chart ), "Legend", NULL);
+
+ return plot;
+}
+
+
+/**
+ * Création de la page des préférences pour le graphique si nécessaire.
+ *
+ *
+ *
+ * */
+void bet_graph_create_prefs_page ( struct_bet_graph_data *self )
+{
+ GtkWidget *child;
+ GtkWidget *label;
+
+ label = gtk_label_new ( _("Options") );
+ child = bet_graph_create_line_preferences ( self );
+ gtk_notebook_append_page ( GTK_NOTEBOOK ( self->notebook ), child, label );
}
@@ -200,7 +352,7 @@ void bet_graph_sectors_graph_new ( GtkWidget *button, GtkTreeView *tree_view )
{
GtkWidget *dialog;
GtkWidget *label;
- GtkWidget *sw_canvas;
+ GtkWidget *notebook;
GtkWidget *box_pie;
gchar *title;
gint result;
@@ -217,16 +369,12 @@ void bet_graph_sectors_graph_new ( GtkWidget *button, GtkTreeView *tree_view )
/* Création de la fenêtre de dialogue pour le graph */
dialog = GTK_WIDGET ( gtk_builder_get_object ( bet_graph_builder, "bet_graph_dialog" ) );
gtk_window_set_transient_for ( GTK_WINDOW ( dialog ), GTK_WINDOW ( run.window ) );
- gtk_widget_set_usize ( dialog, PAGE_WIDTH+30, PAGE_HEIGHT+70 );
+ gtk_widget_set_size_request ( dialog, PAGE_WIDTH+30, PAGE_HEIGHT+70 );
gtk_signal_connect ( GTK_OBJECT ( dialog ),
"destroy",
GTK_SIGNAL_FUNC ( gtk_widget_destroy ),
NULL);
- sw_canvas = GTK_WIDGET ( gtk_builder_get_object ( bet_graph_builder, "sw_canvas" ) );
- box_pie = GTK_WIDGET ( gtk_builder_get_object ( bet_graph_builder, "box_pie" ) );
- gtk_scrolled_window_add_with_viewport ( GTK_SCROLLED_WINDOW ( sw_canvas ), box_pie );
-
/* set the title */
label = GTK_WIDGET ( g_object_get_data ( G_OBJECT ( tree_view ), "label_title") );
title = make_pango_attribut ( "weight=\"bold\" size=\"x-large\"",
@@ -236,49 +384,60 @@ void bet_graph_sectors_graph_new ( GtkWidget *button, GtkTreeView *tree_view )
gtk_label_set_markup ( GTK_LABEL ( label ), title );
g_free ( title );
- /* initialisation des structures de données */
- account_number = gsb_gui_navigation_get_current_account ( );
+ /* initialise les pages pour les graphiques ligne et barre */
+ notebook = GTK_WIDGET ( gtk_builder_get_object ( bet_graph_builder, "notebook" ) );
+ gtk_notebook_set_show_tabs ( GTK_NOTEBOOK ( notebook ), FALSE );
- /* Set the graph for credit */
- self_credit = struct_initialise_bet_graph_data ( );
- self_credit->tree_view = tree_view;
- self_credit->account_number = account_number;
- self_credit->type_infos = 0;
- self_credit->title = g_strdup ( _("Credit") );
- self_credit->service_id = g_strdup ( "GogPiePlot" );
- self_credit->is_legend = TRUE;
+ box_pie = GTK_WIDGET ( gtk_builder_get_object ( bet_graph_builder, "box_pie" ) );
+ gtk_notebook_append_page ( GTK_NOTEBOOK ( notebook ), box_pie, gtk_label_new ( _("Graph") ) );
- self_credit->widget = go_graph_widget_new ( NULL );
- bet_graph_create_graph_widget ( self_credit );
- gtk_box_pack_start ( GTK_BOX ( box_pie ), self_credit->widget, TRUE, TRUE, 0 );
+ /* initialisation des structures de données */
+ account_number = gsb_gui_navigation_get_current_account ( );
/* Set the graph for debit */
self_debit = struct_initialise_bet_graph_data ( );
+ self_debit->notebook = GTK_NOTEBOOK ( notebook );
self_debit->tree_view = tree_view;
self_debit->account_number = account_number;
self_debit->type_infos = 1;
- self_debit->title = g_strdup ( _("Debit") );
+ self_debit->title = g_strdup ( _("Expenses") );
self_debit->service_id = g_strdup ( "GogPiePlot" );
self_debit->is_legend = TRUE;
- self_debit->widget = go_graph_widget_new ( NULL );
- bet_graph_create_graph_widget ( self_debit );
- gtk_box_pack_start ( GTK_BOX ( box_pie ), self_debit->widget, TRUE, TRUE, 0 );
+ self_debit->plot = bet_graph_create_graph_page ( self_debit, FALSE );
- /* populate and show the data for credit */
- result = bet_graph_populate_sectors_by_hist_data ( self_credit );
- if ( ! result )
+ /* populate the data for debit */
+ if ( self_debit->valid_data == FALSE )
+ self_debit->valid_data = bet_graph_populate_sectors_by_hist_data ( self_debit );
+ if ( !self_debit->valid_data )
return;
- result = bet_graph_affiche_camemberts ( self_credit );
- if ( ! result )
+
+ /* show the data for debit */
+ result = bet_graph_affiche_camemberts ( self_debit );
+ if ( !result )
return;
- /* populate and show the data for debit */
- result = bet_graph_populate_sectors_by_hist_data ( self_debit );
- if ( ! result )
+ /* Set the graph for credit */
+ self_credit = struct_initialise_bet_graph_data ( );
+ self_credit->notebook = GTK_NOTEBOOK ( notebook );
+ self_credit->tree_view = tree_view;
+ self_credit->account_number = account_number;
+ self_credit->type_infos = 0;
+ self_credit->title = g_strdup ( _("Incomes") );
+ self_credit->service_id = g_strdup ( "GogPiePlot" );
+ self_credit->is_legend = TRUE;
+
+ self_credit->plot = bet_graph_create_graph_page ( self_credit, FALSE );
+
+ /* populate the data for credit */
+ if ( self_credit->valid_data == FALSE )
+ self_credit->valid_data = bet_graph_populate_sectors_by_hist_data ( self_credit );
+ if ( !self_credit->valid_data )
return;
- result = bet_graph_affiche_camemberts ( self_debit );
- if ( ! result )
+
+ /* show the data for credit */
+ result = bet_graph_affiche_camemberts ( self_credit );
+ if ( !result )
return;
gtk_widget_show_all ( dialog );
@@ -333,7 +492,7 @@ gboolean bet_graph_populate_sectors_by_hist_data ( struct_bet_graph_data *self )
gtk_tree_model_get ( GTK_TREE_MODEL( model ),
&iter,
SPP_HISTORICAL_DESC_COLUMN, &desc,
- SPP_HISTORICAL_RETAINED_AMOUNT, &amount,
+ SPP_HISTORICAL_BALANCE_AMOUNT, &amount,
SPP_HISTORICAL_DIV_NUMBER, &div,
-1 );
@@ -343,6 +502,7 @@ gboolean bet_graph_populate_sectors_by_hist_data ( struct_bet_graph_data *self )
strncpy ( &libelle_division[self -> nbre_elemnts * TAILLE_MAX_LIBELLE], desc, TAILLE_MAX_LIBELLE );
tab_montant_division[self -> nbre_elemnts] = utils_str_strtod ( ( amount == NULL) ? "0" : amount, NULL );
+ self->montant += tab_montant_division[self -> nbre_elemnts];
self -> nbre_elemnts++;
}
@@ -367,15 +527,13 @@ gboolean bet_graph_populate_sectors_by_hist_data ( struct_bet_graph_data *self )
* */
gboolean bet_graph_affiche_camemberts ( struct_bet_graph_data *self )
{
- GogChart *chart;
- GogObject *cur_plot;
+ GogPlot *cur_plot;
GogSeries *series;
GOData *data;
GError * error = NULL;
/* Afficher les montants des divisions de type débit dans le camembert */
- chart = go_graph_widget_get_chart ( GO_GRAPH_WIDGET ( self -> widget ) );
- cur_plot = gog_object_get_child_by_name ( GOG_OBJECT ( chart ), "Plot" );
+ cur_plot = self->plot;
gog_plot_clear_series ( GOG_PLOT ( cur_plot ) );
series = GOG_SERIES ( gog_plot_new_series ( GOG_PLOT ( cur_plot ) ) );
@@ -414,8 +572,6 @@ void bet_graph_line_graph_new ( GtkWidget *button, GtkTreeView *tree_view )
{
GtkWidget *dialog;
GtkWidget *label;
- GtkWidget *sw_canvas;
- GtkWidget *box_line;
gchar *title;
gchar *service_id;
gint result;
@@ -429,6 +585,9 @@ void bet_graph_line_graph_new ( GtkWidget *button, GtkTreeView *tree_view )
return;
/* initialisation des structures de données */
+ if ( prefs_lines == NULL )
+ prefs_lines = struct_initialise_bet_graph_prefs ( );
+
account_number = gsb_gui_navigation_get_current_account ( );
service_id = g_object_get_data ( G_OBJECT ( button ), "service_id" );
@@ -440,16 +599,12 @@ void bet_graph_line_graph_new ( GtkWidget *button, GtkTreeView *tree_view )
/* Création de la fenêtre de dialogue pour le graph */
dialog = GTK_WIDGET ( gtk_builder_get_object ( bet_graph_builder, "bet_graph_dialog" ) );
gtk_window_set_transient_for ( GTK_WINDOW ( dialog ), GTK_WINDOW ( run.window ) );
- gtk_widget_set_usize ( dialog, PAGE_WIDTH+30, PAGE_HEIGHT+70 );
+ gtk_widget_set_size_request ( dialog, PAGE_WIDTH+30, PAGE_HEIGHT+70 );
gtk_signal_connect ( GTK_OBJECT ( dialog ),
"destroy",
GTK_SIGNAL_FUNC ( gtk_widget_destroy ),
NULL);
- sw_canvas = GTK_WIDGET ( gtk_builder_get_object ( bet_graph_builder, "sw_canvas" ) );
- box_line = GTK_WIDGET ( gtk_builder_get_object ( bet_graph_builder, "box_line" ) );
- gtk_scrolled_window_add_with_viewport ( GTK_SCROLLED_WINDOW ( sw_canvas ), box_line );
-
/* set the title */
label = GTK_WIDGET ( g_object_get_data ( G_OBJECT ( tree_view ), "label_title") );
title = make_pango_attribut ( "weight=\"bold\" size=\"x-large\"",
@@ -459,20 +614,34 @@ void bet_graph_line_graph_new ( GtkWidget *button, GtkTreeView *tree_view )
gtk_label_set_markup ( GTK_LABEL ( label ), title );
g_free ( title );
- /* Set the graph for credit */
- self->widget = go_graph_widget_new ( NULL );
- bet_graph_create_graph_widget ( self );
- gtk_box_pack_start ( GTK_BOX ( box_line ), self->widget, TRUE, TRUE, 0 );
+ /* initialise les pages pour les graphiques ligne et barre */
+ self->notebook = GTK_NOTEBOOK ( gtk_builder_get_object ( bet_graph_builder, "notebook" ) );
+
+ /* set the graphique page */
+ self->plot = bet_graph_create_graph_page ( self, TRUE );
+
+ /* set the preferences page */
+ bet_graph_create_prefs_page ( self );
+
+ /* populate data */
+ self->valid_data = bet_graph_populate_lines_by_forecast_data ( self );
+ if ( !self->valid_data )
+ return;
+
+ /* affiche les données */
+ result = bet_graph_affiche_XY_line ( self );
+ if ( !result )
+ return;
- bet_graph_populate_lines_by_forecast_data ( self );
- bet_graph_affiche_XY_line ( self );
gtk_widget_show_all ( dialog );
+ gtk_notebook_set_current_page ( self->notebook, 0 );
result = gtk_dialog_run ( GTK_DIALOG ( dialog ) );
/* free the data */
struct_free_bet_graph_data ( self );
g_object_unref ( G_OBJECT ( bet_graph_builder ) );
+
gtk_widget_destroy ( dialog );
}
@@ -487,6 +656,7 @@ gboolean bet_graph_populate_lines_by_forecast_data ( struct_bet_graph_data *self
{
GtkTreeModel *model = NULL;
GtkTreeIter iter;
+ gdouble prev_montant;
model = gtk_tree_view_get_model ( GTK_TREE_VIEW ( self -> tree_view ) );
if ( model == NULL )
@@ -496,12 +666,9 @@ gboolean bet_graph_populate_lines_by_forecast_data ( struct_bet_graph_data *self
{
gchar *libelle_axe_x = self -> tab_libelle[0];
gchar **tab_libelle_axe_x;
-/* gdouble *tab_X = self -> tab_X; */
gdouble *tab_Y = self -> tab_Y;
gdouble montant = 0.;
- GDateMonth mois_courant;
-
-/* gint x_axis = 0; */
+ GDateDay day_courant;
tab_libelle_axe_x = &libelle_axe_x;
@@ -511,7 +678,7 @@ gboolean bet_graph_populate_lines_by_forecast_data ( struct_bet_graph_data *self
gchar *str_date;
GValue date_value = {0,};
GDate *date;
-/* GDateMonth mois; */
+ GDateDay day;
gtk_tree_model_get_value ( model,
&iter,
@@ -525,40 +692,36 @@ gboolean bet_graph_populate_lines_by_forecast_data ( struct_bet_graph_data *self
date = g_value_get_boxed ( &date_value );
montant += (gdouble) utils_str_strtod ( ( amount == NULL) ? "0" : amount, NULL );
- tab_Y[self->nbre_elemnts] = montant;
if ( self -> nbre_elemnts == 0 )
{
g_date_add_days ( date, 1 );
- mois_courant = g_date_get_month ( date );
+ day_courant = g_date_get_day ( date );
strncpy ( &libelle_axe_x[self -> nbre_elemnts * TAILLE_MAX_LIBELLE], str_date, TAILLE_MAX_LIBELLE );
+ self -> nbre_elemnts++;
}
else
{
-/* mois = g_date_get_month ( date );
- * if ( mois == mois_courant )
- * {
- * strncpy ( &libelle_axe_x[self -> nbre_elemnts * TAILLE_MAX_LIBELLE], "", TAILLE_MAX_LIBELLE );
- * }
- * else
- * {
- */
+ day = g_date_get_day ( date );
+ if ( day != day_courant )
+ {
strncpy ( &libelle_axe_x[self -> nbre_elemnts * TAILLE_MAX_LIBELLE], str_date, TAILLE_MAX_LIBELLE );
- mois_courant = g_date_get_month ( date );
-/* printf ("self -> nbre_elemnts = %d\tdate_value = %s date_texte = %s x = %d y = %.2f\n",
- * self -> nbre_elemnts, gsb_format_gdate (date), str_date, (gint) tab_X[self->nbre_elemnts], tab_Y[self->nbre_elemnts]);
- */
+ tab_Y[self->nbre_elemnts-1] = prev_montant;
-/* } */
+ day_courant = day;
+ self -> nbre_elemnts++;
+ }
}
- self -> nbre_elemnts++;
+ prev_montant = montant;
if ( self -> nbre_elemnts >= MAX_POINTS_GRAPHIQUE )
break;
}
while ( gtk_tree_model_iter_next ( GTK_TREE_MODEL ( model ), &iter ) );
+ tab_Y[self->nbre_elemnts-1] = prev_montant;
+
return TRUE;
}
@@ -574,16 +737,53 @@ gboolean bet_graph_populate_lines_by_forecast_data ( struct_bet_graph_data *self
* */
gboolean bet_graph_affiche_XY_line ( struct_bet_graph_data *self )
{
- GogChart *chart;
- GogObject *cur_plot;
+ GogPlot *cur_plot;
GogSeries *series;
GOData *data;
- GError * error = NULL;
+ GOStyle *style;
+ GogObject *axis;
+ GError *error = NULL;
+ gchar *position;
+
+ devel_debug (NULL);
/* Afficher données dans le graphique */
- chart = go_graph_widget_get_chart ( GO_GRAPH_WIDGET ( self->widget ) );
- cur_plot = gog_object_get_child_by_name ( GOG_OBJECT ( chart ), "Plot" );
+ cur_plot = self->plot;
+
+ /* on met en vertical les libellés de l'axe X */
+ axis = gog_object_get_child_by_name ( GOG_OBJECT ( self->chart ), "X-Axis" );
+
+ style = go_styled_object_get_style ( GO_STYLED_OBJECT ( axis ) );
+ go_style_set_text_angle ( style, prefs_lines->degrees );
+
+ /* on positionne l'axe des x sur le 0 par défaut */
+ switch ( prefs_lines->position )
+ {
+ case 0:
+ position = "low";
+ break;
+ case 1:
+ position = "high";
+ break;
+ case 2:
+ position = "cross";
+ break;
+ default :
+ position = "cross";
+ }
+ g_object_set ( G_OBJECT ( axis ),
+ "pos-str", position,
+ "cross-axis-id", gog_object_get_id ( GOG_OBJECT ( axis ) ),
+ NULL );
+
+ g_object_set ( G_OBJECT ( axis ),
+ "major-tick-in", prefs_lines->major_tick_in,
+ "major-tick-out", prefs_lines->major_tick_out,
+ "major-tick-labeled", prefs_lines->major_tick_labeled,
+ NULL);
+
+ /* on met à jour les données à afficher */
series = GOG_SERIES ( gog_plot_new_series ( GOG_PLOT ( cur_plot ) ) );
data = go_data_vector_str_new ( (const char * const*) self -> tab_vue_libelle, self -> nbre_elemnts, NULL );
@@ -777,6 +977,182 @@ void bet_graph_popup_choix_graph_activate ( GtkMenuItem *menuitem,
/**
+ * Création de la page de préférences pour les graphiques lignes
+ *
+ *
+ *
+ * */
+GtkWidget *bet_graph_create_line_preferences ( struct_bet_graph_data *self )
+{
+ GtkWidget *box_prefs_line;
+ GtkWidget *rot_align;
+ GtkWidget *widget;
+ GtkWidget *button_1;
+ GtkWidget *button_2;
+ GtkWidget *button_3;
+ GtkWidget *rotation;
+
+ box_prefs_line = GTK_WIDGET ( gtk_builder_get_object ( bet_graph_builder, "box_prefs_line") );
+ rot_align = GTK_WIDGET ( gtk_builder_get_object ( bet_graph_builder, "rot_align") );
+
+ /* configure les options d'affichage de l'axe X */
+ widget = GTK_WIDGET ( gtk_builder_get_object ( bet_graph_builder, "major-tick-out" ) );
+ if ( prefs_lines->major_tick_out )
+ gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( widget ), prefs_lines->major_tick_out );
+
+ g_object_set_data ( G_OBJECT ( widget ), "rang", GINT_TO_POINTER ( 0 ) );
+ g_signal_connect ( widget,
+ "toggled",
+ G_CALLBACK ( bet_graph_toggle_button_changed ),
+ self );
+
+ widget = GTK_WIDGET ( gtk_builder_get_object ( bet_graph_builder, "major-tick-in" ) );
+ if ( prefs_lines->major_tick_in )
+ gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( widget ), prefs_lines->major_tick_in );
+
+ g_object_set_data ( G_OBJECT ( widget ), "rang", GINT_TO_POINTER ( 1 ) );
+ g_signal_connect ( widget,
+ "toggled",
+ G_CALLBACK ( bet_graph_toggle_button_changed ),
+ self );
+
+ widget = GTK_WIDGET ( gtk_builder_get_object ( bet_graph_builder, "major-tick-labeled" ) );
+ if ( prefs_lines->major_tick_labeled )
+ gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( widget ), prefs_lines->major_tick_labeled );
+
+ g_object_set_data ( G_OBJECT ( widget ), "rang", GINT_TO_POINTER ( 2 ) );
+ g_signal_connect ( widget,
+ "toggled",
+ G_CALLBACK ( bet_graph_toggle_button_changed ),
+ self );
+
+ /* Configuration de la position de l'axe des X */
+ button_1 = GTK_WIDGET ( gtk_builder_get_object ( bet_graph_builder, "axis_low" ) );
+ if ( prefs_lines->position == 0 )
+ gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( button_1 ), TRUE );
+
+ g_object_set_data ( G_OBJECT ( button_1 ), "rang", GINT_TO_POINTER ( 3 ) );
+ button_2 = GTK_WIDGET ( gtk_builder_get_object ( bet_graph_builder, "axis_high" ) );
+ if ( prefs_lines->position == 1 )
+ gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON (button_2 ), TRUE );
+
+ g_object_set_data ( G_OBJECT ( button_2 ), "rang", GINT_TO_POINTER ( 4 ) );
+ button_3 = GTK_WIDGET ( gtk_builder_get_object ( bet_graph_builder, "axis_cross" ) );
+ if ( prefs_lines->position == 2 )
+ gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( button_3 ), TRUE );
+
+ g_object_set_data ( G_OBJECT ( button_3 ), "rang", GINT_TO_POINTER ( 5 ) );
+
+ /* set the signal */
+ g_signal_connect ( button_1,
+ "toggled",
+ G_CALLBACK ( bet_graph_toggle_button_changed ),
+ self );
+
+ g_signal_connect ( button_2,
+ "toggled",
+ G_CALLBACK ( bet_graph_toggle_button_changed ),
+ self );
+
+ g_signal_connect ( button_3,
+ "toggled",
+ G_CALLBACK ( bet_graph_toggle_button_changed ),
+ self );
+
+ /* configure l'orientation des étiquettes de l'axe X */
+ rotation = go_rotation_sel_new ( );
+ go_rotation_sel_set_rotation (GO_ROTATION_SEL ( rotation ), prefs_lines->degrees );
+ g_signal_connect ( G_OBJECT ( rotation ),
+ "rotation-changed",
+ G_CALLBACK ( bet_graph_rotation_changed ),
+ self );
+
+ gtk_container_add ( GTK_CONTAINER ( rot_align ), rotation );
+
+ return box_prefs_line;
+}
+
+
+/**
+ *
+ *
+ *
+ *
+ * */
+void bet_graph_toggle_button_changed ( GtkToggleButton *togglebutton,
+ struct_bet_graph_data *self )
+{
+ gint rang;
+ gboolean active;
+
+ active = gtk_toggle_button_get_active ( togglebutton );
+
+ rang = GPOINTER_TO_INT ( g_object_get_data ( G_OBJECT ( togglebutton ), "rang" ) );
+
+ switch ( rang )
+ {
+ case 0:
+ prefs_lines->major_tick_out = active;
+ break;
+ case 1:
+ prefs_lines->major_tick_in = active;
+ break;
+ case 2:
+ prefs_lines->major_tick_labeled = active;
+ break;
+ case 3:
+ prefs_lines->position = 0;
+ break;
+ case 4:
+ prefs_lines->position = 1;
+ break;
+ case 5:
+ prefs_lines->position = 2;
+ break;
+ }
+
+ /* on met à jour le graph */
+ bet_graph_update_graph ( self );
+}
+
+
+/**
+ *
+ *
+ *
+ *
+ * */
+void bet_graph_rotation_changed ( GORotationSel *rotation,
+ int angle,
+ struct_bet_graph_data *self )
+{
+ prefs_lines->degrees = angle;
+
+ /* on met à jour le graph */
+ bet_graph_update_graph ( self );
+}
+
+
+/**
+ *
+ *
+ *
+ *
+ * */
+void bet_graph_update_graph ( struct_bet_graph_data *self )
+{
+ devel_debug (NULL);
+
+ gtk_notebook_remove_page ( self->notebook, 0 );
+
+ self->plot = bet_graph_create_graph_page ( self, TRUE );
+ gtk_widget_show_all ( GTK_WIDGET ( self->notebook ) );
+
+ bet_graph_affiche_XY_line ( self );
+}
+
+
+/**
*
*
*
@@ -826,6 +1202,12 @@ struct_bet_graph_data *struct_initialise_bet_graph_data ( void )
}
+/**
+ *
+ *
+ *
+ *
+ * */
void struct_free_bet_graph_data ( struct_bet_graph_data *self )
{
g_free ( self->title );
@@ -842,6 +1224,39 @@ void struct_free_bet_graph_data ( struct_bet_graph_data *self )
*
*
* */
+struct_bet_graph_prefs *struct_initialise_bet_graph_prefs ( void )
+{
+ struct_bet_graph_prefs *self;
+
+ self = g_new0 ( struct_bet_graph_prefs, 1 );
+
+ self->major_tick_out = TRUE;
+ self->major_tick_labeled = TRUE;
+ self->position = 2;
+ self->degrees = 90;
+
+ return self;
+}
+
+
+/**
+ *
+ *
+ *
+ *
+ * */
+void struct_free_bet_graph_prefs ( struct_bet_graph_prefs *self )
+{
+ g_free ( self );
+}
+
+
+/**
+ *
+ *
+ *
+ *
+ * */
void bet_graph_free_builder ( void )
{
g_object_unref ( G_OBJECT ( bet_graph_builder ) );
diff --git a/src/bet_hist.c b/src/bet_hist.c
index da48d28..c5ea6aa 100644
--- a/src/bet_hist.c
+++ b/src/bet_hist.c
@@ -517,8 +517,9 @@ GtkWidget *bet_historical_get_data_tree_view ( GtkWidget *container )
tree_model = gtk_tree_store_new ( SPP_HISTORICAL_NUM_COLUMNS,
G_TYPE_BOOLEAN, /* SPP_HISTORICAL_SELECT_COLUMN */
G_TYPE_STRING, /* SPP_HISTORICAL_DESC_COLUMN */
- G_TYPE_STRING, /* SPP_HISTORICAL_CURRENT_COLUMN */
+ G_TYPE_STRING, /* SPP_HISTORICAL_CURRENT_COLUMN */
G_TYPE_STRING, /* SPP_HISTORICAL_BALANCE_COLUMN */
+ G_TYPE_STRING, /* SPP_HISTORICAL_BALANCE_AMOUNT */
G_TYPE_STRING, /* SPP_HISTORICAL_AVERAGE_COLUMN */
G_TYPE_STRING, /* SPP_HISTORICAL_AVERAGE_AMOUNT */
G_TYPE_STRING, /* SPP_HISTORICAL_RETAINED_COLUMN */
@@ -830,6 +831,7 @@ void bet_historical_populate_div_model ( gpointer key,
gpointer sub_key, sub_value;
gchar *div_name = NULL;
gchar *str_balance;
+ gchar *str_balance_amount;
gchar *str_average;
gchar *str_amount;
gchar *str_retained = NULL;
@@ -857,6 +859,8 @@ void bet_historical_populate_div_model ( gpointer key,
model = gtk_tree_view_get_model ( tree_view );
+ str_balance_amount = gsb_real_safe_real_to_string ( sbr->current_balance,
+ gsb_data_currency_get_floating_point ( currency_number ) );
str_balance = utils_real_get_string_with_currency ( sbr -> current_balance, currency_number, TRUE );
average = gsb_real_div ( sbr -> current_balance, period );
str_amount = gsb_real_safe_real_to_string ( average,
@@ -871,6 +875,7 @@ void bet_historical_populate_div_model ( gpointer key,
SPP_HISTORICAL_DESC_COLUMN, div_name,
SPP_HISTORICAL_CURRENT_COLUMN, str_current_fyear,
SPP_HISTORICAL_BALANCE_COLUMN, str_balance,
+ SPP_HISTORICAL_BALANCE_AMOUNT, str_balance_amount,
SPP_HISTORICAL_AVERAGE_COLUMN, str_average,
SPP_HISTORICAL_AVERAGE_AMOUNT, str_amount,
SPP_HISTORICAL_RETAINED_AMOUNT, str_amount,
@@ -902,6 +907,8 @@ void bet_historical_populate_div_model ( gpointer key,
}
/* printf ("division = %d div_name = %s\n", div_number, div_name); */
g_free ( div_name );
+ g_free ( str_balance );
+ g_free ( str_balance_amount );
g_free ( str_average );
g_free ( str_amount );
g_free ( str_current_fyear );
@@ -933,7 +940,9 @@ void bet_historical_populate_div_model ( gpointer key,
g_strfreev ( tab_str );
}
- str_balance = utils_real_get_string_with_currency ( sub_sbr -> current_balance,
+ str_balance_amount = gsb_real_safe_real_to_string ( sub_sbr->current_balance,
+ gsb_data_currency_get_floating_point ( currency_number ) );
+ str_balance = utils_real_get_string_with_currency ( sub_sbr -> current_balance,
currency_number, TRUE );
average = gsb_real_div ( sub_sbr -> current_balance, period );
str_amount = gsb_real_safe_real_to_string ( average,
@@ -949,6 +958,7 @@ void bet_historical_populate_div_model ( gpointer key,
SPP_HISTORICAL_DESC_COLUMN, div_name,
SPP_HISTORICAL_CURRENT_COLUMN, str_current_fyear,
SPP_HISTORICAL_BALANCE_COLUMN, str_balance,
+ SPP_HISTORICAL_BALANCE_AMOUNT, str_balance_amount,
SPP_HISTORICAL_AVERAGE_COLUMN, str_average,
SPP_HISTORICAL_AVERAGE_AMOUNT, str_amount,
SPP_HISTORICAL_RETAINED_AMOUNT, str_amount,
@@ -999,6 +1009,7 @@ void bet_historical_populate_div_model ( gpointer key,
}
g_free ( div_name );
g_free ( str_balance );
+ g_free ( str_balance_amount );
g_free ( str_average );
g_free ( str_amount );
g_free ( str_current_fyear );
diff --git a/src/ui/bet_graph.ui b/src/ui/bet_graph.ui
index 76d0be3..c4d33e5 100644
--- a/src/ui/bet_graph.ui
+++ b/src/ui/bet_graph.ui
@@ -1,22 +1,66 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy project-wide -->
+ <object class="GtkAdjustment" id="adjustment1">
+ <property name="upper">500</property>
+ <property name="step_increment">10</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkArrow" id="arrow">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="arrow_type">down</property>
+ <property name="shadow_type">etched-out</property>
+ </object>
<object class="GtkDialog" id="bet_graph_dialog">
+ <property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="type_hint">normal</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
- <property name="orientation">vertical</property>
+ <property name="can_focus">False</property>
<property name="spacing">2</property>
+ <child internal-child="action_area">
+ <object class="GtkHButtonBox" id="dialog-action_area1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="layout_style">end</property>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <object class="GtkButton" id="button1">
+ <property name="label">gtk-close</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
<child>
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
- <property name="orientation">vertical</property>
+ <property name="can_focus">False</property>
<child>
<object class="GtkLabel" id="label_canvas">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
@@ -26,38 +70,320 @@
</packing>
</child>
<child>
- <object class="GtkScrolledWindow" id="sw_canvas">
+ <object class="GtkVBox" id="box_canvas">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hscrollbar_policy">automatic</property>
- <property name="vscrollbar_policy">automatic</property>
+ <property name="can_focus">False</property>
+ <property name="homogeneous">True</property>
<child>
- <placeholder/>
+ <object class="GtkNotebook" id="notebook">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
</child>
</object>
<packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="padding">10</property>
<property name="position">1</property>
</packing>
</child>
- <child internal-child="action_area">
- <object class="GtkHButtonBox" id="dialog-action_area1">
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="0">button1</action-widget>
+ </action-widgets>
+ </object>
+ <object class="GtkVBox" id="box_pie">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <object class="GtkVBox" id="box_prefs_line">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes"><b>Options for the X axis</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">5</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHSeparator" id="hseparator1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="box_options">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkVBox" id="axis_base_pref_box">
<property name="visible">True</property>
- <property name="layout_style">end</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">12</property>
+ <property name="spacing">12</property>
<child>
- <placeholder/>
+ <object class="GtkHBox" id="hbox3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">24</property>
+ <child>
+ <object class="GtkVBox" id="major_tick_box">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes"><b>Major ticks</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkAlignment" id="alignment12">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="top_padding">6</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkVBox" id="vbox13">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkCheckButton" id="major-tick-out">
+ <property name="label" translatable="yes">_Outside</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_underline">True</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="major-tick-in">
+ <property name="label" translatable="yes">_Inside</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="major-tick-labeled">
+ <property name="label" translatable="yes">_Show Labels</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_underline">True</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
</child>
<child>
- <object class="GtkButton" id="button1">
- <property name="label">gtk-close</property>
+ <object class="GtkVBox" id="position_box">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel" id="label5">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes"><b>Position</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkAlignment" id="alignment14">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="top_padding">6</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkVBox" id="vbox19">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkVBox" id="cross_box">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkRadioButton" id="axis_low">
+ <property name="label" translatable="yes">_Low</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkRadioButton" id="axis_high">
+ <property name="label" translatable="yes">_High</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">axis_low</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkAlignment" id="alignment15">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <child>
+ <object class="GtkRadioButton" id="axis_cross">
+ <property name="label" translatable="yes">Crosses the Y axis at 0</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">axis_low</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">False</property>
@@ -67,52 +393,192 @@
</child>
</object>
<packing>
- <property name="expand">False</property>
- <property name="pack_type">end</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
+ <child>
+ <object class="GtkVSeparator" id="vseparator1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkAlignment" id="rot_align">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="yalign">0</property>
+ <property name="yscale">0</property>
+ <property name="top_padding">12</property>
+ <property name="left_padding">12</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
</object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
</child>
- <action-widgets>
- <action-widget response="0">button1</action-widget>
- </action-widgets>
- </object>
- <object class="GtkVBox" id="box_pie">
- <property name="visible">True</property>
- <property name="orientation">vertical</property>
- <property name="homogeneous">True</property>
<child>
- <placeholder/>
+ <object class="GtkHSeparator" id="hseparator2">
+ <property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ </packing>
</child>
<child>
- <placeholder/>
+ <object class="GtkLabel" id="label2">
+ <property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
+ <property name="label" translatable="yes"><b>Options for the columns</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">4</property>
+ </packing>
</child>
- </object>
- <object class="GtkVBox" id="box_line">
- <property name="visible">True</property>
- <property name="orientation">vertical</property>
<child>
- <placeholder/>
+ <object class="GtkHSeparator" id="hseparator3">
+ <property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">5</property>
+ </packing>
</child>
<child>
- <placeholder/>
+ <object class="GtkAlignment" id="alignment1">
+ <property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
+ <property name="xscale">0</property>
+ <child>
+ <object class="GtkTable" id="gog_barcol_prefs">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">12</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">3</property>
+ <property name="column_spacing">12</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label61">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes">_Gap:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">gap_spinner</property>
+ </object>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label63">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">%</property>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="gap_spinner">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">•</property>
+ <property name="invisible_char_set">True</property>
+ <property name="primary_icon_activatable">False</property>
+ <property name="secondary_icon_activatable">False</property>
+ <property name="primary_icon_sensitive">True</property>
+ <property name="secondary_icon_sensitive">True</property>
+ <property name="adjustment">adjustment1</property>
+ <property name="climb_rate">10</property>
+ <property name="snap_to_ticks">True</property>
+ <property name="numeric">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="before-grid">
+ <property name="label" translatable="yes">_Display the grids above the plot</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="right_attach">3</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options"></property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">6</property>
+ </packing>
</child>
</object>
<object class="GtkHBox" id="button_menu_box">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="has_tooltip">True</property>
<child>
<object class="GtkVBox" id="box_button">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes">Display the data graph</property>
- <property name="orientation">vertical</property>
<child>
<placeholder/>
</child>
</object>
<packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
@@ -123,18 +589,16 @@
<property name="receives_default">False</property>
<property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes">Select the chart type</property>
+ <property name="use_action_appearance">False</property>
<property name="image">arrow</property>
<property name="relief">none</property>
<property name="draw_indicator">False</property>
</object>
<packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
- <object class="GtkArrow" id="arrow">
- <property name="visible">True</property>
- <property name="arrow_type">down</property>
- <property name="shadow_type">etched-out</property>
- </object>
</interface>
diff --git a/src/utils_real.c b/src/utils_real.c
index 0184eee..5f280a8 100644
--- a/src/utils_real.c
+++ b/src/utils_real.c
@@ -24,12 +24,12 @@
#endif
#include "include.h"
-#include "gsb_data_currency.h"
-#include "gsb_locale.h"
+/*START_INCLUDE*/
#include "utils_real.h"
-
-
+#include "gsb_data_currency.h"
+#include "gsb_locale.h"
+/*END_INCLUDE*/
/*START_EXTERN*/
extern gsb_real error_real;
@@ -132,3 +132,30 @@ gsb_real utils_real_get_from_string ( const gchar *string )
return result;
}
+
+
+/**
+ * Retourne le gdouble formaté comme dans la fonction source.
+ * Le symbole de la monnaie est présent par défaut.
+ *
+ * \param number Number to format.
+ * \param account_number
+ *
+ * \return A newly allocated string of the number
+ * */
+gchar *utils_real_get_string_with_currency_from_double ( gdouble number,
+ gint account_number )
+{
+ gint currency_number;
+ gsb_real real;
+
+ currency_number = gsb_data_account_get_currency ( account_number );
+ real = gsb_real_double_to_real ( number );
+
+ return utils_real_get_string_with_currency ( real, currency_number, TRUE );
+}
+
+
+/* Local Variables: */
+/* c-basic-offset: 4 */
+/* End: */
diff --git a/src/utils_real.h b/src/utils_real.h
index 36b8c0b..5345a9b 100644
--- a/src/utils_real.h
+++ b/src/utils_real.h
@@ -10,6 +10,9 @@ gchar *utils_real_get_string_with_currency ( gsb_real number,
gint currency_number,
gboolean show_symbol );
+gchar *utils_real_get_string_with_currency_from_double ( gdouble number,
+ gint account_number );
+
gsb_real utils_real_get_from_string ( const gchar *string );
#endif
hooks/post-receive
--
grisbi
More information about the cvs
mailing list