data_type.c File Reference

This file must not be edited unless you know what you are doing : the main maintainer wants to destroy it in a near future ! More...

#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)
 Called when the data type window is killed or closed.
static void destroy_data_type_window (GtkWidget *widget, GdkEvent *event, gpointer data)
 Called when the data type window is killed or closed.
static void dt_ok_button_clicked (GtkWidget *widget, gpointer data)
 The user clicks "Ok" button.
static void dt_cancel_button_clicked (GtkWidget *widget, gpointer data)
 The user clicks "Cancel" button.
static void connect_data_type_signals (heraia_window_t *main_window)
 Connects data_type's window signals.
static void set_spinbutton_max_range (heraia_window_t *main_window)
 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.
static void close_data_type_window (heraia_window_t *main_window)
 Called when the data_type_window is closed.
static void destroy_container_widget (treatment_container_t *tment_c, gboolean all)
 Retrieves informations from the data_type window widgets Currently UNUSED.
static treatment_container_tnew_treatment_container (heraia_window_t *main_window)
 Create a new empty treatment container Needs main_window structure to fill the combobox with available treatments.
static void create_treatment_container_widget (heraia_window_t *main_window, treatment_container_t *tment_c)
 Packs the container widget to the main window widgets via "dt_treatment_vbox".
static guchar * print_bin_to_hex (GtkWidget *entry, GList *values_list)
 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.
static void add_treatment_container_widget (GtkWidget *widget, gpointer data)
 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).
static void remove_treatment_container_widget (GtkWidget *widget, gpointer data)
 Removes a treatment container widget when (-) button is clicked.
static void cb_changed_in_treatment_container_widget (GtkWidget *widget, gpointer data)
 Called when a change is done in the treatment list combobox.
data_type_tnew_data_type (gchar *name, guint size)
 Returns a new data_type filled with name and size values.
void free_data_type (data_type_t *a_data_type)
 Frees the memory of a particular data_type.
data_type_tcopy_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.
static void fill_treatment_combobox (GtkWidget *tment_list, GList *available_list)
 Fills the treatment combobox with the available treatment list names Set the active element on nothing (no active element).
static void set_active_text_item (GtkWidget *combo_box, gchar *name)
 Tries to set the named "name" active item of the combobox list.
static GList * find_treatment_container_from_widget (GList *container_list, GtkWidget *widget)
 Finds the container which contains the specified widget.
static guchar * update_treatment_container_list_entries (GList *tment_c_list, GList *values_list)
 Updates the treatment_container list entries.
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.
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.
static void refresh_one_ud_data_interpretor (data_type_t *a_data_type, value_t *a_value)
 Refreshes one user defined data type when the cursor is moved in the gtkhex structure.
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'.
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.
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.
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.
static void dt_size_spinbutton_value_changed (GtkWidget *widget, gpointer data)
 When the user changes the size of the data that will be used to construct a new type.
static void dt_name_entry_leave_notify_event (GtkWidget *widget, GdkEventCrossing *event, gpointer data)
 When the user leaves the name entry Gets the name entry if any and puts it in the current_data_type structure.
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.


Detailed Description

This file must not be edited unless you know what you are doing : the main maintainer wants to destroy it in a near future !

Definition in file data_type.c.


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 299 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:

Here is the caller 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 403 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:

Here is the caller 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 893 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:

Here is the caller graph for this function:

static void connect_data_type_signals ( heraia_window_t main_window  )  [static]

Connects data_type's window signals.

Definition at line 1059 of file data_type.c.

References delete_data_type_window_event(), destroy_data_type_window(), dt_cancel_button_clicked(), dt_name_entry_leave_notify_event(), dt_ok_button_clicked(), dt_size_spinbutton_value_changed(), heraia_get_widget(), xml_t::main, and heraia_window_t::xmls.

Referenced by data_type_init_interface().

Here is the call graph for this function:

Here is the caller graph for this function:

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 101 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:

Here is the caller 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 277 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:

Here is the caller 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 440 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:

Here is the caller 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 1097 of file data_type.c.

References connect_data_type_signals().

Referenced by load_heraia_ui().

Here is the call graph for this function:

Here is the caller 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 803 of file data_type.c.

References close_data_type_window().

Referenced by connect_data_type_signals().

Here is the call graph for this function:

Here is the caller 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 852 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:

Here is the caller 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 816 of file data_type.c.

References close_data_type_window().

Referenced by connect_data_type_signals().

Here is the call graph for this function:

Here is the caller graph for this function:

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

The user clicks "Cancel" button.

Definition at line 987 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:

Here is the caller 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 1035 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:

Here is the caller 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 928 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:

Here is the caller 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 1006 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:

Here is the caller 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 730 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:

Here is the caller 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 172 of file data_type.c.

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

Referenced by new_treatment_container().

Here is the caller graph for this function:

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

Finds the container which contains the specified widget.

Definition at line 325 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().

Here is the caller graph for this function:

void free_data_type ( data_type_t a_data_type  ) 

Frees the memory of a particular data_type.

Definition at line 82 of file data_type.c.

References data_type_t::name.

Referenced by dt_ok_button_clicked(), and ldt_remove_button_clicked().

Here is the caller graph for this function:

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 770 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().

Here is the caller graph for this function:

data_type_t* new_data_type ( gchar *  name,
guint  size 
)

Returns a new data_type filled with name and size values.

Definition at line 54 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().

Here is the caller graph for this function:

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 519 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().

Here is the caller graph for this function:

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 607 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.

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 658 of file data_type.c.

References heraia_window_t::current_data_type, heraia_window_t::current_doc, heraia_window_t::current_DW, data_type_t::di_entry, ghex_get_data(), H_DI_LITTLE_ENDIAN, heraia_get_widget(), doc_t::hex_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:

Here is the caller 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 572 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:

Here is the caller 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 350 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:

Here is the caller 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 194 of file data_type.c.

Referenced by create_treatment_container_widget().

Here is the caller graph for this function:

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 142 of file data_type.c.

References heraia_window_t::current_doc, DT_SPIN_MAX, DT_SPIN_MIN, ghex_file_size(), heraia_get_widget(), doc_t::hex_widget, xml_t::main, and heraia_window_t::xmls.

Referenced by show_data_type_window().

Here is the call graph for this function:

Here is the caller 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 468 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:

Here is the caller 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 377 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:

Here is the caller graph for this function:


Generated on Tue Jun 30 23:18:18 2009 for Heraia by  doxygen 1.5.8