stat.c File Reference

does some basic statistics on the file and displays them in a numerical or graphical way (histograms : 1D and 2D) More...

#include "stat.h"
#include <libheraia.h>
Include dependency graph for stat.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

static void stat_window_connect_signals (heraia_plugin_t *plugin)
 Connects all the signals to the correct functions.
static void statw_close_clicked (GtkWidget *widget, gpointer data)
 What to do when the window is closed.
static void destroy_stat_window (GtkWidget *widget, GdkEvent *event, gpointer data)
 Closes stat window.
static void statw_save_as_clicked (GtkWidget *widget, gpointer data)
 What to do when the save as button is clicked.
static void statw_export_to_csv_clicked (GtkWidget *widget, gpointer data)
 What to do when "export to csv" button is clicked.
static void statw_export_to_gnuplot_clicked (GtkWidget *widget, gpointer data)
 What to do when "export to gnuplot" button is clicked.
static void statw_export_to_pcv_clicked (GtkWidget *widget, gpointer data)
 What to do when "export to pcv" button is clicked.
static gchar * stat_select_file_to_save (const gchar *window_text, stat_t *extra)
 Selecting the file filename where to save the file.
static void histo_radiobutton_toggled (GtkWidget *widget, gpointer data)
 What to do when the user chooses a 1D or 2D histo.
static gboolean delete_stat_window_event (GtkWidget *widget, GdkEvent *event, gpointer data)
 Usefull functions for the stat plugin those may be included in an another .c source file ?!
static void realize_some_numerical_stat (heraia_struct_t *main_struct, heraia_plugin_t *plugin)
 Do some stats on the selected file (entire file is used).
static void init_stats_histos (heraia_plugin_t *plugin)
 Inits the histograms.
static void set_statw_button_state (GtkBuilder *xml, gboolean sensitive)
 Sets stat window's button's sensitive property.
static void populate_stats_histos (heraia_struct_t *main_struct, heraia_plugin_t *plugin)
 Populates the histograms.
static void calc_infos_histo_1D (stat_t *extra)
 Seeks the histo1D struct to find the maximum value.
static void calc_infos_histo_2D (stat_t *extra)
 Seeks the histo2D struct to find the maximum value.
static void init_stats_pixbufs (stat_t *extra)
 Inits the image buffers.
static void make_pixbufs_from_histos (stat_t *extra)
 Makes the pixbufs from the histograms values.
static void plot_in_pixbuf (GdkPixbuf *pixbuf, gint64 x, gint64 y, guchar red, guchar green, guchar blue, guchar alpha)
 Prints a pixel in the corresponding pixbuf.
static void do_pixbuf_1D_from_histo1D (stat_t *extra)
 Fills the pixbuf with the corresponding data from the histo1D struct.
static void do_pixbuf_2D_from_histo2D (stat_t *extra, guint max_2D)
 Fills the pixbuf with the corresponding data from the histo2D struct It is really hard to make something very visible (to make colors look really different between to height values).
heraia_plugin_theraia_plugin_init (heraia_plugin_t *plugin)
 Initialisation plugin function called when the plugin is loaded (some sort of pre-init).
void init (heraia_struct_t *main_struct)
 The real init function of the plugin (called at init time).
void quit (void)
 Normaly this is called when the plugin is unloaded One may wait it's entire life for this to be called !! ;).
void run (GtkWidget *widget, gpointer data)
 This function is called via a signal handler when the menu entry is toggled.
void refresh (heraia_struct_t *main_struct, void *data)
 The refresh function is called when a new file is loaded or when the cursor is moved Here we want to refresh the plugin only if a new file is loaded AND if the plugin is already displayed (running).
static gchar * transform_time_t_to_gchar (time_t *a_time)
 Do format a date form a time_t value.
static void line_in_pixbuf (GdkPixbuf *pixbuf, gint64 x, gint64 y)
 Prints a line of pixels in the corresponding pixbuf (1D histo).

Detailed Description

does some basic statistics on the file and displays them in a numerical or graphical way (histograms : 1D and 2D)

Definition in file stat.c.


Function Documentation

static void calc_infos_histo_1D ( stat_t extra  )  [static]

Seeks the histo1D struct to find the maximum value.

Definition at line 868 of file stat.c.

References stat_t::histo1D, stat_t::infos_1D, histo_infos_t::max, histo_infos_t::mean, histo_infos_t::min, and histo_infos_t::nb_val.

Referenced by make_pixbufs_from_histos().

Here is the caller graph for this function:

static void calc_infos_histo_2D ( stat_t extra  )  [static]

Seeks the histo2D struct to find the maximum value.

Definition at line 908 of file stat.c.

References stat_t::histo2D, stat_t::infos_2D, histo_infos_t::max, histo_infos_t::mean, histo_infos_t::min, and histo_infos_t::nb_val.

Referenced by make_pixbufs_from_histos().

Here is the caller graph for this function:

static gboolean delete_stat_window_event ( GtkWidget *  widget,
GdkEvent *  event,
gpointer  data 
) [static]

Usefull functions for the stat plugin those may be included in an another .c source file ?!

Closes stat window

Parameters:
widget : the widget which called this function
event : the event that issued the signal (unused here)
data : user data, MUST be heraia_plugin_t *plugin
Returns:
resturns always FALSE (does not propagate the signal)

Definition at line 254 of file stat.c.

References statw_close_clicked().

Referenced by stat_window_connect_signals().

Here is the call graph for this function:

Here is the caller graph for this function:

static void destroy_stat_window ( GtkWidget *  widget,
GdkEvent *  event,
gpointer  data 
) [static]

Closes stat window.

Parameters:
widget : the widget which called this function
event : the event that issued the signal (unused here)
data : user data, MUST be heraia_plugin_t *plugin

Definition at line 269 of file stat.c.

References statw_close_clicked().

Referenced by stat_window_connect_signals().

Here is the call graph for this function:

Here is the caller graph for this function:

static void do_pixbuf_1D_from_histo1D ( stat_t extra  )  [static]

Fills the pixbuf with the corresponding data from the histo1D struct.

Definition at line 1040 of file stat.c.

References stat_t::histo1D, stat_t::infos_1D, line_in_pixbuf(), histo_infos_t::max, and stat_t::pixbuf_1D.

Referenced by make_pixbufs_from_histos().

Here is the call graph for this function:

Here is the caller graph for this function:

static void do_pixbuf_2D_from_histo2D ( stat_t extra,
guint  max_2D 
) [static]

Fills the pixbuf with the corresponding data from the histo2D struct It is really hard to make something very visible (to make colors look really different between to height values).

Definition at line 1064 of file stat.c.

References stat_t::histo2D, stat_t::infos_2D, histo_infos_t::max, histo_infos_t::mean, histo_infos_t::min, stat_t::pixbuf_2D, and plot_in_pixbuf().

Referenced by make_pixbufs_from_histos().

Here is the call graph for this function:

Here is the caller graph for this function:

heraia_plugin_t* heraia_plugin_init ( heraia_plugin_t plugin  ) 
static void histo_radiobutton_toggled ( GtkWidget *  widget,
gpointer  data 
) [static]

What to do when the user chooses a 1D or 2D histo.

Parameters:
widget : the widget which called this function (unused here)
data : user data, MUST be heraia_plugin_t *plugin

Definition at line 632 of file stat.c.

References heraia_plugin_t::extra, heraia_get_widget(), stat_t::pixbuf_1D, stat_t::pixbuf_2D, and heraia_plugin_t::xml.

Referenced by stat_window_connect_signals().

Here is the call graph for this function:

Here is the caller graph for this function:

void init ( heraia_struct_t main_struct  ) 

The real init function of the plugin (called at init time).

The plugin interface functions.

Parameters:
main_struct : main structure

Definition at line 117 of file stat.c.

References plugin_info_t::author, heraia_plugin_t::cmi_entry, window_prop_t::displayed, find_plugin_by_name(), heraia_get_widget(), heraia_plugin_t::info, load_plugin_xml(), log_message(), plugin_info_t::name, PLUGIN_NAME, heraia_struct_t::plugins_list, set_statw_button_state(), stat_window_connect_signals(), heraia_plugin_t::win_prop, and heraia_plugin_t::xml.

Referenced by heraia_plugin_init().

Here is the call graph for this function:

Here is the caller graph for this function:

static void init_stats_histos ( heraia_plugin_t plugin  )  [static]

Inits the histograms.

Definition at line 802 of file stat.c.

References heraia_plugin_t::extra, stat_t::histo1D, and stat_t::histo2D.

Referenced by populate_stats_histos().

Here is the caller graph for this function:

static void init_stats_pixbufs ( stat_t extra  )  [static]

Inits the image buffers.

Definition at line 952 of file stat.c.

References stat_t::pixbuf_1D, and stat_t::pixbuf_2D.

Referenced by make_pixbufs_from_histos().

Here is the caller graph for this function:

static void line_in_pixbuf ( GdkPixbuf *  pixbuf,
gint64  x,
gint64  y 
) [static]

Prints a line of pixels in the corresponding pixbuf (1D histo).

Definition at line 1010 of file stat.c.

Referenced by do_pixbuf_1D_from_histo1D().

Here is the caller graph for this function:

static void make_pixbufs_from_histos ( stat_t extra  )  [static]

Makes the pixbufs from the histograms values.

Definition at line 969 of file stat.c.

References calc_infos_histo_1D(), calc_infos_histo_2D(), do_pixbuf_1D_from_histo1D(), do_pixbuf_2D_from_histo2D(), stat_t::infos_1D, stat_t::infos_2D, init_stats_pixbufs(), and histo_infos_t::max.

Referenced by populate_stats_histos().

Here is the call graph for this function:

Here is the caller graph for this function:

static void plot_in_pixbuf ( GdkPixbuf *  pixbuf,
gint64  x,
gint64  y,
guchar  red,
guchar  green,
guchar  blue,
guchar  alpha 
) [static]

Prints a pixel in the corresponding pixbuf.

Definition at line 990 of file stat.c.

Referenced by do_pixbuf_2D_from_histo2D().

Here is the caller graph for this function:

static void populate_stats_histos ( heraia_struct_t main_struct,
heraia_plugin_t plugin 
) [static]

Populates the histograms.

Definition at line 822 of file stat.c.

References heraia_struct_t::current_doc, heraia_plugin_t::extra, ghex_file_size(), heraia_get_widget(), doc_t::hex_widget, stat_t::histo1D, stat_t::histo2D, init_stats_histos(), make_pixbufs_from_histos(), stat_t::pixbuf_1D, stat_t::pixbuf_2D, and heraia_plugin_t::xml.

Referenced by realize_some_numerical_stat().

Here is the call graph for this function:

Here is the caller graph for this function:

void quit ( void   ) 

Normaly this is called when the plugin is unloaded One may wait it's entire life for this to be called !! ;).

When the application exits.

Definition at line 161 of file stat.c.

References PLUGIN_NAME.

Referenced by heraia_plugin_init().

Here is the caller graph for this function:

static void realize_some_numerical_stat ( heraia_struct_t main_struct,
heraia_plugin_t plugin 
) [static]

Do some stats on the selected file (entire file is used).

Parameters:
main_struct : main structure from heraia
plugin : main plugin structure (the plugin itself in fact)

< used for date printing

Definition at line 733 of file stat.c.

References add_text_to_textview(), heraia_struct_t::current_doc, doc_t_document_get_filename(), heraia_plugin_t::extra, heraia_get_widget(), stat_t::infos_1D, stat_t::infos_2D, kill_text_from_textview(), log_message(), histo_infos_t::max, histo_infos_t::mean, histo_infos_t::min, histo_infos_t::nb_val, populate_stats_histos(), transform_time_t_to_gchar(), and heraia_plugin_t::xml.

Referenced by run().

Here is the call graph for this function:

Here is the caller graph for this function:

void refresh ( heraia_struct_t main_struct,
void *  data 
)

The refresh function is called when a new file is loaded or when the cursor is moved Here we want to refresh the plugin only if a new file is loaded AND if the plugin is already displayed (running).

Called every refresh time (New file & cursor move).

Parameters:
main_struct : main structure
data : user data (the plugin itself) MUST be heraia_plugin_t *plugin structure

Definition at line 226 of file stat.c.

References heraia_struct_t::event, HERAIA_REFRESH_NEW_FILE, HERAIA_REFRESH_TAB_CHANGED, heraia_plugin_t::run_proc, set_statw_button_state(), and heraia_plugin_t::xml.

Referenced by heraia_plugin_init().

Here is the call graph for this function:

Here is the caller graph for this function:

void run ( GtkWidget *  widget,
gpointer  data 
)

This function is called via a signal handler when the menu entry is toggled.

To run anything everytime the plugin is called.

Parameters:
widget : widget which called the function (unused)
data : user data for the plugin, here MUST be heraia_struct_t * main structure

Definition at line 173 of file stat.c.

References heraia_plugin_t::cmi_entry, find_plugin_by_name(), heraia_get_widget(), PLUGIN_NAME, PLUGIN_STATE_NONE, PLUGIN_STATE_RUNNING, heraia_struct_t::plugins_list, realize_some_numerical_stat(), show_hide_widget(), heraia_plugin_t::state, heraia_plugin_t::win_prop, and heraia_plugin_t::xml.

Referenced by heraia_plugin_init().

Here is the call graph for this function:

Here is the caller graph for this function:

static void set_statw_button_state ( GtkBuilder *  xml,
gboolean  sensitive 
) [static]

Sets stat window's button's sensitive property.

Parameters:
xml : The plugin's xml description
sensitive : whether the buttons are greyed (FALSE) or not (TRUE)

Definition at line 206 of file stat.c.

References heraia_get_widget().

Referenced by init(), and refresh().

Here is the call graph for this function:

Here is the caller graph for this function:

static gchar * stat_select_file_to_save ( const gchar *  window_text,
stat_t extra 
) [static]

Selecting the file filename where to save the file.

Parameters:
window_text : text to be displayed in the selection window
Returns:
returns the new filename where to save a file

Definition at line 328 of file stat.c.

References stat_t::dirname.

Referenced by statw_export_to_csv_clicked(), statw_export_to_gnuplot_clicked(), statw_export_to_pcv_clicked(), and statw_save_as_clicked().

Here is the caller graph for this function:

static void stat_window_connect_signals ( heraia_plugin_t plugin  )  [static]

Connects all the signals to the correct functions.

Parameters:
plugin : main plugin structure

Definition at line 660 of file stat.c.

References delete_stat_window_event(), destroy_stat_window(), heraia_get_widget(), histo_radiobutton_toggled(), statw_close_clicked(), statw_export_to_csv_clicked(), statw_export_to_gnuplot_clicked(), statw_export_to_pcv_clicked(), statw_save_as_clicked(), and heraia_plugin_t::xml.

Referenced by init().

Here is the call graph for this function:

Here is the caller graph for this function:

static void statw_close_clicked ( GtkWidget *  widget,
gpointer  data 
) [static]

What to do when the window is closed.

Parameters:
widget : the widget which called this function (unused here)
data : user data, MUST be heraia_plugin_t *plugin

Definition at line 280 of file stat.c.

References heraia_plugin_t::cmi_entry, heraia_get_widget(), show_hide_widget(), heraia_plugin_t::win_prop, and heraia_plugin_t::xml.

Referenced by delete_stat_window_event(), destroy_stat_window(), and stat_window_connect_signals().

Here is the call graph for this function:

Here is the caller graph for this function:

static void statw_export_to_csv_clicked ( GtkWidget *  widget,
gpointer  data 
) [static]

What to do when "export to csv" button is clicked.

Parameters:
widget : the widget which called this function
data : user data, MUST be heraia_plugin_t *plugin

Definition at line 385 of file stat.c.

References heraia_plugin_t::extra, heraia_get_widget(), stat_t::histo1D, stat_t::histo2D, stat_select_file_to_save(), and heraia_plugin_t::xml.

Referenced by stat_window_connect_signals().

Here is the call graph for this function:

Here is the caller graph for this function:

static void statw_export_to_gnuplot_clicked ( GtkWidget *  widget,
gpointer  data 
) [static]

What to do when "export to gnuplot" button is clicked.

Parameters:
widget : the widget which called this function
data : user data, MUST be heraia_plugin_t *plugin

<

Todo:
we might add here the name of the file being edited

<

Todo:
we might add here the name of the file being edited

Definition at line 454 of file stat.c.

References heraia_plugin_t::extra, heraia_get_widget(), stat_t::histo1D, stat_t::histo2D, stat_select_file_to_save(), and heraia_plugin_t::xml.

Referenced by stat_window_connect_signals().

Here is the call graph for this function:

Here is the caller graph for this function:

static void statw_export_to_pcv_clicked ( GtkWidget *  widget,
gpointer  data 
) [static]

What to do when "export to pcv" button is clicked.

Parameters:
widget : the widget which called this function
data : user data, MUST be heraia_plugin_t *plugin

Definition at line 536 of file stat.c.

References heraia_plugin_t::extra, heraia_get_widget(), stat_t::histo1D, stat_t::histo2D, stat_t::infos_2D, histo_infos_t::max, histo_infos_t::min, stat_select_file_to_save(), and heraia_plugin_t::xml.

Referenced by stat_window_connect_signals().

Here is the call graph for this function:

Here is the caller graph for this function:

static void statw_save_as_clicked ( GtkWidget *  widget,
gpointer  data 
) [static]

What to do when the save as button is clicked.

Parameters:
widget : the widget which called this function (unused here)
data : user data, MUST be heraia_plugin_t *plugin

Definition at line 297 of file stat.c.

References heraia_plugin_t::extra, heraia_get_widget(), stat_select_file_to_save(), and heraia_plugin_t::xml.

Referenced by stat_window_connect_signals().

Here is the call graph for this function:

Here is the caller graph for this function:

static gchar* transform_time_t_to_gchar ( time_t *  a_time  )  [static]

Do format a date form a time_t value.

Parameters:
time_t value
Returns:
a gchar which represents the value as a date

Definition at line 705 of file stat.c.

Referenced by realize_some_numerical_stat().

Here is the caller graph for this function:

Generated on Mon May 2 21:06:21 2011 for Heraia by  doxygen 1.6.3