[grisbi-cvs] [SCM] grisbi branch, pbiava_graph_tools, updated. upstream_version_0_9_4-37-g886cff2

Pierre Biava nobody at users.sourceforge.net
Tue Sep 27 22:19:41 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  886cff23f45e91748c3c5e25a1a08bc54285cab4 (commit)
       via  7e4ecf79d4ababf86c259b5fbf935cc7ee742ca6 (commit)
       via  27c4987b6d1c2ffbec164d8f1e23012f7524971f (commit)
      from  dadc7019c0a1dbefb00b8f076a3ba5ceb3ad1e93 (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 886cff23f45e91748c3c5e25a1a08bc54285cab4
Merge: dadc701 7e4ecf7
Author: pbiava <pierre.biava at nerim.net>
Date:   Tue Sep 27 22:19:04 2011 +0200

    Merge branch 'master' into pbiava_graph_tools

-----------------------------------------------------------------------

Changes:
diff --git a/src/bet_graph.c b/src/bet_graph.c
index ac4fec3..cddbfb8 100644
--- a/src/bet_graph.c
+++ b/src/bet_graph.c
@@ -675,7 +675,11 @@ gboolean bet_graph_populate_lines_by_forecast_data ( struct_bet_graph_data *self
         gchar **tab_libelle_axe_x;
         gdouble *tab_Y = self -> tab_Y;
         gdouble montant = 0.;
+        GDate *first_date;
+        GDate *last_date;
+        GDate *date_courante;
         GDateDay day_courant;
+        gint nbre_iterations;
 
         tab_libelle_axe_x = &libelle_axe_x;
 
@@ -686,6 +690,8 @@ gboolean bet_graph_populate_lines_by_forecast_data ( struct_bet_graph_data *self
             GValue date_value = {0,};
             GDate *date;
             GDateDay day;
+            gint diff_jours;
+            gint i;
 
             gtk_tree_model_get_value ( model,
                         &iter,
@@ -694,7 +700,6 @@ gboolean bet_graph_populate_lines_by_forecast_data ( struct_bet_graph_data *self
             gtk_tree_model_get ( GTK_TREE_MODEL( model ),
                         &iter,
                         SPP_ESTIMATE_TREE_AMOUNT_COLUMN, &amount,
-                        SPP_ESTIMATE_TREE_DATE_COLUMN, &str_date,
                         -1 );
             date = g_value_get_boxed ( &date_value );
 
@@ -702,33 +707,72 @@ gboolean bet_graph_populate_lines_by_forecast_data ( struct_bet_graph_data *self
 
             if ( self -> nbre_elemnts == 0 )
             {
+                /* on ajoute 1 jour pour passer au 1er du mois */
                 g_date_add_days ( date, 1 );
+
+                /* on calcule le nombre maxi d'itération pour une année */
+                first_date = gsb_date_copy ( date );
+                last_date = gsb_date_copy ( date );
+                g_date_add_years ( last_date, 1 );
+                nbre_iterations = g_date_days_between ( first_date, last_date );
+
+                date_courante = gsb_date_copy ( date );
                 day_courant = g_date_get_day ( date );
+
+                str_date = gsb_format_gdate ( date_courante );
                 strncpy ( &libelle_axe_x[self -> nbre_elemnts * TAILLE_MAX_LIBELLE], str_date, TAILLE_MAX_LIBELLE );
+
                 self -> nbre_elemnts++;
+                g_free ( str_date );
+                g_date_free ( first_date );
+                g_date_free ( last_date );
             }
             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 );
-                    tab_Y[self->nbre_elemnts-1] = prev_montant;
-
+                    /* nombre de jours manquants */
+                    diff_jours = g_date_days_between ( date_courante, date );
+                    for ( i = diff_jours; i > 0; i-- )
+                    {
+                        g_date_add_days ( date_courante, 1 );
+                        str_date = gsb_format_gdate ( date_courante );
+
+                        strncpy ( &libelle_axe_x[self -> nbre_elemnts * TAILLE_MAX_LIBELLE],
+                                    str_date, TAILLE_MAX_LIBELLE );
+                        tab_Y[self->nbre_elemnts-1] = prev_montant;
+                        self -> nbre_elemnts++;
+
+                        /* on dépasse d'un jour pour obtenir le solde du dernier jour */
+                        if ( self -> nbre_elemnts > nbre_iterations )
+                        {
+                            self -> nbre_elemnts = nbre_iterations + 1;
+                            break;
+                        }
+
+                        g_free ( str_date );
+                    }
                     day_courant = day;
-                    self -> nbre_elemnts++;
                 }
             }
-
             prev_montant = montant;
 
-            if ( self -> nbre_elemnts >= MAX_POINTS_GRAPHIQUE )
+            if ( self -> nbre_elemnts > nbre_iterations )
+            {
+                self -> nbre_elemnts = nbre_iterations;
+                dialogue_hint ( _("You can not exceed one year of visualization"), _("Overflow") );
+
                 break;
+            }
+
         }
         while ( gtk_tree_model_iter_next ( GTK_TREE_MODEL ( model ), &iter ) );
 
         tab_Y[self->nbre_elemnts-1] = prev_montant;
 
+        g_date_free ( date_courante );
+
         return TRUE;
     }
 
diff --git a/src/bet_graph.h b/src/bet_graph.h
index 7c42d46..4fc1e1a 100644
--- a/src/bet_graph.h
+++ b/src/bet_graph.h
@@ -16,7 +16,7 @@
 /* Definition du maximum de segments par camembert */
 #define MAX_SEGMENT_CAMEMBERT 30
 /* Definition du maximum de segments par camembert */
-#define MAX_POINTS_GRAPHIQUE 300
+#define MAX_POINTS_GRAPHIQUE 370
 
 /* Definition de la taille maximum d'un libelle */
 #define TAILLE_MAX_LIBELLE 50
diff --git a/src/main.c b/src/main.c
index 74a0d3e..9539c8d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -152,6 +152,11 @@ int main ( int argc, char **argv )
     gsb_locale_shutdown ( );
     gsb_dirs_shutdown ( );
 
+#ifdef HAVE_GOFFICE
+    /* liberation libgoffice */
+    libgoffice_shutdown ( );
+#endif
+
 #if GSB_GMEMPROFILE
     g_mem_profile();
 #endif
@@ -191,8 +196,8 @@ void main_linux ( int argc, char **argv )
 #ifdef HAVE_GOFFICE
     /* initialisation libgoffice */
     libgoffice_init ( );
-	/* Initialize plugins manager */
-	go_plugins_init (NULL, NULL, NULL, NULL, TRUE, GO_TYPE_PLUGIN_LOADER_MODULE);
+    /* Initialize plugins manager */
+    go_plugins_init (NULL, NULL, NULL, NULL, TRUE, GO_TYPE_PLUGIN_LOADER_MODULE);
 #endif
 
     /* on commence par détourner le signal SIGSEGV */
@@ -227,11 +232,6 @@ void main_linux ( int argc, char **argv )
 
     /* sauvegarde les raccourcis claviers */
     gtk_accel_map_save ( C_PATH_CONFIG_ACCELS ( ) );
-
-#ifdef HAVE_GOFFICE
-    /* liberation libgoffice */
-    libgoffice_shutdown ( );
-#endif
 }
 
 
@@ -263,8 +263,8 @@ void main_mac_osx ( int argc, char **argv )
 #ifdef HAVE_GOFFICE
     /* initialisation libgoffice */
     libgoffice_init ( );
-	/* Initialize plugins manager */
-	go_plugins_init (NULL, NULL, NULL, NULL, TRUE, GO_TYPE_PLUGIN_LOADER_MODULE);
+    /* Initialize plugins manager */
+    go_plugins_init (NULL, NULL, NULL, NULL, TRUE, GO_TYPE_PLUGIN_LOADER_MODULE);
 #endif
 
     /* init the app */
@@ -347,11 +347,6 @@ void main_mac_osx ( int argc, char **argv )
 
     g_object_unref ( theApp );
 
-#ifdef HAVE_GOFFICE
-    /* liberation libgoffice */
-    libgoffice_shutdown ( );
-#endif
-
 #endif /* GTKOSXAPPLICATION */
 }
 
@@ -389,6 +384,13 @@ void main_win_32 (  int argc, char **argv )
 
     gsb_locale_init ( );
 
+#ifdef HAVE_GOFFICE
+    /* initialisation libgoffice */
+    libgoffice_init ( );
+    /* Initialize plugins manager */
+    go_plugins_init (NULL, NULL, NULL, NULL, TRUE, GO_TYPE_PLUGIN_LOADER_MODULE);
+#endif
+
     gtk_init ( &argc, &argv );
 
     win32_parse_gtkrc ( "gtkrc" );


hooks/post-receive
-- 
grisbi


More information about the cvs mailing list