heraia/trunk/libheraia/data_type.c File Reference

#include <libheraia.h>

Include dependency graph for data_type.c:

Go to the source code of this file.

Functions

static gboolean delete_data_type_window_event (GtkWidget *widget, GdkEvent *event, gpointer data)
static void destroy_data_type_window (GtkWidget *widget, GdkEvent *event, gpointer data)
static void dt_ok_button_clicked (GtkWidget *widget, gpointer data)
static void dt_cancel_button_clicked (GtkWidget *widget, gpointer data)
static void connect_data_type_signals (heraia_window_t *main_window)
static void set_spinbutton_max_range (heraia_window_t *main_window)
static void close_data_type_window (heraia_window_t *main_window)
static void destroy_container_widget (treatment_container_t *tment_c, gboolean all)
static treatment_container_tnew_treatment_container (heraia_window_t *main_window)
static void create_treatment_container_widget (heraia_window_t *main_window, treatment_container_t *tment_c)
static guchar * print_bin_to_hex (GtkWidget *entry, GList *values_list)
static void add_treatment_container_widget (GtkWidget *widget, gpointer data)
static void remove_treatment_container_widget (GtkWidget *widget, gpointer data)
static void cb_changed_in_treatment_container_widget (GtkWidget *widget, gpointer data)
data_type_tnew_data_type (gchar *name, guint size)
void free_data_type (data_type_t *a_data_type)
data_type_tcopy_data_type_struct (heraia_window_t *main_window, data_type_t *a_data_type)
static void fill_treatment_combobox (GtkWidget *tment_list, GList *available_list)
static void set_active_text_item (GtkWidget *combo_box, gchar *name)
static GList * find_treatment_container_from_widget (GList *container_list, GtkWidget *widget)
static guchar * update_treatment_container_list_entries (GList *tment_c_list, GList *values_list)
void create_ud_data_interpretor_widgets (heraia_window_t *main_window, data_type_t *a_data_type)
void show_data_type_window (heraia_window_t *main_window, data_type_t *a_data_type)
static void refresh_one_ud_data_interpretor (data_type_t *a_data_type, value_t *a_value)
void refresh_all_ud_data_interpretor (heraia_window_t *main_window, guint endianness)
void refresh_hex_datas_entry (heraia_window_t *main_window)
void fill_data_type_widgets (heraia_window_t *main_window, data_type_t *a_data_type)
GList * is_data_type_name_already_used (GList *data_type_list, gchar *name)
static void dt_size_spinbutton_value_changed (GtkWidget *widget, gpointer data)
static void dt_name_entry_leave_notify_event (GtkWidget *widget, GdkEventCrossing *event, gpointer data)
void data_type_init_interface (heraia_window_t *main_window)


Function Documentation

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

Adds a treatment container widget when (+) button is clicked TODO : determine which treatment it is (where the + button was clicked) and insert the new one just after it (need to do the same in the list)

Definition at line 294 of file data_type.c.

References treatment_container_t::container_box, create_treatment_container_widget(), heraia_window_t::current_data_type, new_treatment_container(), refresh_hex_datas_entry(), and data_type_t::treatment_c_list.

Referenced by new_treatment_container().

Here is the call graph for this function:

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

Called when a change is done in the treatment list combobox. Affects the new treatment to the treatment_container.

Definition at line 398 of file data_type.c.

References heraia_window_t::available_treatment_list, copy_treatment(), heraia_window_t::current_data_type, find_treatment(), find_treatment_container_from_widget(), refresh_hex_datas_entry(), treatment_container_t::tment_list, treatment_container_t::treatment, and data_type_t::treatment_c_list.

Referenced by new_treatment_container().

Here is the call graph for this function:

static void close_data_type_window ( heraia_window_t main_window  )  [static]

Called when the data_type_window is closed

Last box stuff : I do not know if this is really usefull !!

Definition at line 887 of file data_type.c.

References heraia_window_t::current_data_type, destroy_container_widget(), heraia_get_widget(), xml_t::main, data_type_t::treatment_c_list, and heraia_window_t::xmls.

Referenced by delete_data_type_window_event(), destroy_data_type_window(), dt_cancel_button_clicked(), and dt_ok_button_clicked().

Here is the call graph for this function:

static void connect_data_type_signals ( heraia_window_t main_window  )  [static]

data_type_t* copy_data_type_struct ( heraia_window_t main_window,
data_type_t a_data_type 
)

Copies the data_type_t structure in a new one, that may be freely freed after use. main_window needed to fill the combobox widget with available treatment list

Here we do not copy the widgets as they will be created on the fly. We copy the list and the treatments

Definition at line 96 of file data_type.c.

References copy_treatment(), create_ud_data_interpretor_widgets(), data_type_t::di_label, data_type_t::name, new_data_type(), new_treatment_container(), data_type_t::size, treatment_container_t::treatment, and data_type_t::treatment_c_list.

Referenced by ldt_edit_button_clicked().

Here is the call graph for this function:

static void create_treatment_container_widget ( heraia_window_t main_window,
treatment_container_t tment_c 
) [static]

Packs the container widget to the main window widgets via "dt_treatment_vbox".

Definition at line 272 of file data_type.c.

References treatment_container_t::container_box, DT_BOX_PADDING, heraia_get_widget(), treatment_t::init, xml_t::main, treatment_t::name, set_active_text_item(), treatment_container_t::tment_list, treatment_container_t::treatment, and heraia_window_t::xmls.

Referenced by add_treatment_container_widget(), and show_data_type_window().

Here is the call graph for this function:

void create_ud_data_interpretor_widgets ( heraia_window_t main_window,
data_type_t a_data_type 
)

Creates new user defined widgets for the data interpretor window.

Definition at line 435 of file data_type.c.

References data_type_t::di_entry, data_type_t::di_label, DT_BOX_PADDING, heraia_get_widget(), xml_t::main, and heraia_window_t::xmls.

Referenced by copy_data_type_struct(), dt_ok_button_clicked(), and ldt_add_button_clicked().

Here is the call graph for this function:

void data_type_init_interface ( heraia_window_t main_window  ) 

Inits the data type window with default values Should be called only once Here we may load a specific file where the user data types are saved

Definition at line 1091 of file data_type.c.

References connect_data_type_signals().

Referenced by load_heraia_ui().

Here is the call graph for this function:

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

Called when the data type window is killed or closed

Definition at line 797 of file data_type.c.

References close_data_type_window().

Referenced by connect_data_type_signals().

Here is the call graph for this function:

static void destroy_container_widget ( treatment_container_t tment_c,
gboolean  all 
) [static]

Retrieves informations from the data_type window widgets Currently UNUSED Destroys a container Widget. If all is true it destroys everything even the treatment and such. If all is false it destroys only the widget part.

Definition at line 846 of file data_type.c.

References treatment_container_t::button_box, treatment_container_t::combo_box, treatment_container_t::container_box, destroy_a_single_widget(), treatment_t::kill, treatment_container_t::moins, treatment_container_t::plus, treatment_container_t::result, treatment_container_t::tment_list, and treatment_container_t::treatment.

Referenced by close_data_type_window(), and remove_treatment_container_widget().

Here is the call graph for this function:

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

Called when the data type window is killed or closed

Definition at line 810 of file data_type.c.

References close_data_type_window().

Referenced by connect_data_type_signals().

Here is the call graph for this function:

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

The user clicks "Cancel" button

Definition at line 981 of file data_type.c.

References close_data_type_window(), heraia_window_t::current_data_type, destroy_a_single_widget(), data_type_t::di_entry, and data_type_t::di_label.

Referenced by connect_data_type_signals().

Here is the call graph for this function:

static void dt_name_entry_leave_notify_event ( GtkWidget *  widget,
GdkEventCrossing *  event,
gpointer  data 
) [static]

When the user leaves the name entry Gets the name entry if any and puts it in the current_data_type structure.

Definition at line 1029 of file data_type.c.

References heraia_window_t::current_data_type, heraia_get_widget(), xml_t::main, data_type_t::name, and heraia_window_t::xmls.

Referenced by connect_data_type_signals().

Here is the call graph for this function:

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

The user clicks "Ok" button

The name does not exists, we want to add it to the treeview and to the list structure (the user clicked add(+) in the list window or edited the name)

The name is already in use, we assume that we are in editing mode and we simply replace the old data_type_t structure by the new one !

Definition at line 922 of file data_type.c.

References add_data_type_name_to_treeview(), close_data_type_window(), create_ud_data_interpretor_widgets(), heraia_window_t::current_data_type, heraia_window_t::data_type_list, destroy_a_single_widget(), data_type_t::di_entry, data_type_t::di_label, free_data_type(), is_data_type_name_already_used(), log_message(), data_type_t::name, and refresh_hex_datas_entry().

Referenced by connect_data_type_signals().

Here is the call graph for this function:

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

When the user changes the size of the data that will be used to construct a new type

Definition at line 1000 of file data_type.c.

References heraia_window_t::current_data_type, DT_SPIN_MAX, DT_SPIN_MIN, heraia_get_widget(), xml_t::main, refresh_hex_datas_entry(), data_type_t::size, and heraia_window_t::xmls.

Referenced by connect_data_type_signals().

Here is the call graph for this function:

void fill_data_type_widgets ( heraia_window_t main_window,
data_type_t a_data_type 
)

Clears data_type window's widgets and sets to default values. Currently UNUSED Fills the data_type window's widgets with values taken from the data_type_list structure

Definition at line 724 of file data_type.c.

References heraia_get_widget(), xml_t::main, data_type_t::name, refresh_hex_datas_entry(), data_type_t::size, and heraia_window_t::xmls.

Referenced by show_data_type_window().

Here is the call graph for this function:

static void fill_treatment_combobox ( GtkWidget *  tment_list,
GList *  available_list 
) [static]

Fills the treatment combobox with the available treatment list names Set the active element on nothing (no active element)

Definition at line 167 of file data_type.c.

References treatment_t::data, and treatment_t::name.

Referenced by new_treatment_container().

static GList* find_treatment_container_from_widget ( GList *  container_list,
GtkWidget *  widget 
) [static]

Finds the container which contains the specified widget

Definition at line 320 of file data_type.c.

References treatment_container_t::moins, and treatment_container_t::tment_list.

Referenced by cb_changed_in_treatment_container_widget(), and remove_treatment_container_widget().

void free_data_type ( data_type_t a_data_type  ) 

Frees the memory of a particular data_type

Definition at line 77 of file data_type.c.

References data_type_t::name.

Referenced by dt_ok_button_clicked(), and ldt_remove_button_clicked().

GList* is_data_type_name_already_used ( GList *  data_type_list,
gchar *  name 
)

Says wether name "name" is already in use in "data_type_list" list and returns NULL if not or the list that contains the data_type_t where name was found

Definition at line 764 of file data_type.c.

References data_type_t::name.

Referenced by dt_ok_button_clicked(), ldt_edit_button_clicked(), and ldt_remove_button_clicked().

data_type_t* new_data_type ( gchar *  name,
guint  size 
)

Returns a new data_type filled with name and size values

Definition at line 49 of file data_type.c.

References data_type_t::di_entry, data_type_t::di_label, data_type_t::name, and data_type_t::size.

Referenced by copy_data_type_struct(), and ldt_add_button_clicked().

static treatment_container_t * new_treatment_container ( heraia_window_t main_window  )  [static]

static guchar * print_bin_to_hex ( GtkWidget *  entry,
GList *  values_list 
) [static]

Prints "length" "bin_datas" in an hexa form to the entry widget named "widget_name" TODO : add some specific representation options such as space between characters

Definition at line 514 of file data_type.c.

References value_t::bytes, and value_t::length.

Referenced by refresh_hex_datas_entry(), refresh_one_ud_data_interpretor(), and update_treatment_container_list_entries().

void refresh_all_ud_data_interpretor ( heraia_window_t main_window,
guint  endianness 
)

Refreshes all the user data defined types (called when the cursor is moved) Interpretation is done following the endianness 'endianness'

Definition at line 602 of file data_type.c.

References heraia_window_t::current_DW, heraia_window_t::data_type_list, data_type_t::di_entry, ghex_get_data(), new_value_t(), refresh_one_ud_data_interpretor(), and data_type_t::size.

Referenced by refresh_data_interpretor_window().

Here is the call graph for this function:

void refresh_hex_datas_entry ( heraia_window_t main_window  ) 

Refreshes the "hex_datas_entry" which displays the hex datas extracted from the hexwidget at the cursor position. Endianness is Little Endian for now, we may, at a later time let the user choose its endianness it also places the spin widget value in the current_data_type structure.

Definition at line 653 of file data_type.c.

References heraia_window_t::current_data_type, heraia_window_t::current_DW, data_window_t::current_hexwidget, data_type_t::di_entry, ghex_get_data(), H_DI_LITTLE_ENDIAN, heraia_get_widget(), xml_t::main, new_value_t(), print_bin_to_hex(), data_type_t::size, data_type_t::treatment_c_list, update_treatment_container_list_entries(), and heraia_window_t::xmls.

Referenced by add_treatment_container_widget(), cb_changed_in_treatment_container_widget(), dt_ok_button_clicked(), dt_size_spinbutton_value_changed(), fill_data_type_widgets(), and remove_treatment_container_widget().

Here is the call graph for this function:

static void refresh_one_ud_data_interpretor ( data_type_t a_data_type,
value_t a_value 
) [static]

Refreshes one user defined data type when the cursor is moved in the gtkhex structure.

Definition at line 567 of file data_type.c.

References data_type_t::di_entry, treatment_t::do_it, print_bin_to_hex(), treatment_container_t::treatment, and data_type_t::treatment_c_list.

Referenced by refresh_all_ud_data_interpretor().

Here is the call graph for this function:

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

Removes a treatment container widget when (-) button is clicked

Definition at line 345 of file data_type.c.

References heraia_window_t::current_data_type, destroy_container_widget(), find_treatment_container_from_widget(), refresh_hex_datas_entry(), and data_type_t::treatment_c_list.

Referenced by new_treatment_container().

Here is the call graph for this function:

static void set_active_text_item ( GtkWidget *  combo_box,
gchar *  name 
) [static]

Tries to set the named "name" active item of the combobox list.

Definition at line 189 of file data_type.c.

Referenced by create_treatment_container_widget().

static void set_spinbutton_max_range ( heraia_window_t main_window  )  [static]

Sets the maximum range of the spinbutton on the Data type Window (usefull when we're next to the file's end) This is done to ensure that the spinbutton always represent an exact and valid size

Definition at line 137 of file data_type.c.

References heraia_window_t::current_DW, data_window_t::current_hexwidget, DT_SPIN_MAX, DT_SPIN_MIN, ghex_file_size(), heraia_get_widget(), xml_t::main, and heraia_window_t::xmls.

Referenced by show_data_type_window().

Here is the call graph for this function:

void show_data_type_window ( heraia_window_t main_window,
data_type_t a_data_type 
)

This constructs, fills and shows the data_type window First I thought doing things with libglade here, but it seems very hard. Same thing applies for GtkBuilder. I think I'll get more flexibility with widgets created on the fly

Definition at line 463 of file data_type.c.

References treatment_container_t::container_box, create_treatment_container_widget(), fill_data_type_widgets(), heraia_get_widget(), log_message(), xml_t::main, new_treatment_container(), set_spinbutton_max_range(), data_type_t::treatment_c_list, and heraia_window_t::xmls.

Referenced by ldt_add_button_clicked(), and ldt_edit_button_clicked().

Here is the call graph for this function:

static guchar* update_treatment_container_list_entries ( GList *  tment_c_list,
GList *  values_list 
) [static]

Updates the treatment_container list entries

Definition at line 372 of file data_type.c.

References treatment_t::do_it, print_bin_to_hex(), treatment_container_t::result, and treatment_container_t::treatment.

Referenced by refresh_hex_datas_entry().

Here is the call graph for this function:


Generated on Sat Jan 17 20:57:23 2009 for Heraia by  doxygen 1.5.6