heraia_ui.c File Reference

This file has all the functions to manage heraia's ui

More...

#include <libheraia.h>
Include dependency graph for heraia_ui.c:

Go to the source code of this file.

Functions

static void set_a_propos_properties (GtkWidget *about_dialog)
 Sets name and version in the dialog box.
static gboolean load_heraia_xml (heraia_struct_t *main_struct)
 Loads the GtkBuilder xml files that describes the heraia project tries the following paths in that order :

  • /etc/heraia/heraia.gtkbuilder
  • /home/[user]/.heraia/heraia.gtkbuilder
  • PWD/heraia.gtkbuilder.

static void heraia_ui_connect_signals (heraia_struct_t *main_struct)
 Connect the signals at the interface.
static void record_and_hide_about_box (heraia_struct_t *main_struct)
 Record position and hide about dialog box.
static gboolean unsaved_documents (heraia_struct_t *main_struct)
 Verify if we can safely close everything.
static gboolean close_heraia (heraia_struct_t *main_struct)
 Before closing heraia we need to do few things.
void on_quit_activate (GtkWidget *widget, gpointer data)
 Quit, file menu.
void on_new_activate (GtkWidget *widget, gpointer data)
 New, file menu.
void on_preferences_activate (GtkWidget *widget, gpointer data)
 Preferences, file menu : Displays the preference window (as a modal window).
void a_propos_activate (GtkWidget *widget, gpointer data)
 Shows apropos's dialog box.
void move_and_show_dialog_box (GtkWidget *dialog_box, window_prop_t *dialog_prop)
 Move the dialog box to the wanted position, shows it and says it in the displayed prop.
void record_dialog_box_position (GtkWidget *dialog_box, window_prop_t *dialog_prop)
 Records one dialog position.
void record_all_dialog_box_positions (heraia_struct_t *main_struct)
 Records all the positions of the displayed windows.
void record_and_hide_dialog_box (GtkWidget *dialog_box, window_prop_t *dialog_prop)
 Record position and hide a dialog box.
static void a_propos_response (GtkWidget *widget, gint response, gpointer data)
 To close the A propos dialog box (with the "close" button).
static void a_propos_close (GtkWidget *widget, gpointer data)
 To close the A propos dialog box.
static gboolean a_propos_delete (GtkWidget *widget, GdkEvent *event, gpointer data)
 To close the A propos dialog box.
void on_delete_activate (GtkWidget *widget, gpointer data)
 Delete, edit menu.
void on_cut_activate (GtkWidget *widget, gpointer data)
 Cut, edit menu.
void on_copy_activate (GtkWidget *widget, gpointer data)
 Copy, edit menu.
void on_paste_activate (GtkWidget *widget, gpointer data)
 Paste, edit menu.
void refresh_file_labels (heraia_struct_t *main_struct)
 This function is refreshing the labels on the main window in order to reflect cursor position, selected positions and total selected size.
void refresh_event_handler (GtkWidget *widget, gpointer data)
 This function is here to ensure that everything will be refreshed upon a signal event.
void on_open_activate (GtkWidget *widget, gpointer data)
 This handles the menuitem "Ouvrir" to open a file.
void on_save_activate (GtkWidget *widget, gpointer data)
 Here we attemp to save the edited file.
void on_save_as_activate (GtkWidget *widget, gpointer data)
 This handle the save_as menu entry (here the filename changes).
void on_DIMenu_activate (GtkWidget *widget, gpointer data)
 This handles the menuitem "Data Interpretor" that shows or hides the data interpretor window.
void on_tests_menu_activate (GtkWidget *widget, gpointer data)
 Called when tests submenu is activated.
gboolean delete_main_struct_event (GtkWidget *widget, GdkEvent *event, gpointer data)
 When the user destroys or delete the main window.
gboolean delete_dt_window_event (GtkWidget *widget, GdkEvent *event, gpointer data)
 call back function for the data interpretor window destruction
void destroy_dt_window (GtkWidget *widget, GdkEvent *event, gpointer data)
 call back function for the data interpretor window destruction
gboolean file_notebook_tab_changed (GtkNotebook *notebook, GtkNotebookPage *page, gint tab_num, gpointer data)
 What to do when a change occurs in tabs (user selected a particular tab.
static gchar * make_absolute_path (gchar *filename)
 Returns an absolute path to the filename the string should be freed when no longer needed very UGLy !
void set_the_working_directory (GtkFileChooser *file_chooser, gchar *filename)
 Sets the working directory for the file chooser to the directory of the filename (even if filename is a relative filename such as .
GSList * select_file_to_load (heraia_struct_t *main_struct)
 This function does open a file selector dialog box and returns the selected filename.
gchar * select_a_file_to_save (heraia_struct_t *main_struct)
 This function opens a dialog box that allow one to choose a file name to the file which is about to be saved.
void update_main_struct_name (heraia_struct_t *main_struct)
 Update main window heraia's name to reflect the current edited file.
void set_notebook_tab_name (heraia_struct_t *main_struct)
 Sets notebook's tab's name.
void set_notebook_tab_label_color (heraia_struct_t *main_struct, gboolean color)
 Set the style for the label.
void grey_main_widgets (GtkBuilder *main, gboolean greyed)
 Hides or grey all widgets that needs an open file when boolean show is FALSE.
void init_heraia_interface (heraia_struct_t *main_struct)
 Here we might init some call backs and menu options and display the interface (main && sub-windows) This function should be called only once at main program's init time.
void connect_cursor_moved_signal (heraia_struct_t *main_struct, GtkWidget *hex_widget)
 Connects the signal that the cursor has moved to the refreshing function.
int load_heraia_ui (heraia_struct_t *main_struct)
 Loads, if possible, the gtkbuilder xml file and then connects the signals and inits the following windows :

  • log window
  • data_interpretor window
  • list data types.

void add_text_to_textview (GtkTextView *textview, const char *format,...)
 adds a text to a textview
void kill_text_from_textview (GtkTextView *textview)
 Kills the text from a textview.
GtkWidget * gtk_radio_button_get_active (GSList *group)
 Try to find the active radio button widget in a group This does not take into account inconsistant states returns the first active radio button otherwise NULL.
GtkWidget * gtk_radio_button_get_active_from_widget (GtkRadioButton *radio_group_member)
 gets the active radio button from a radio group
gboolean is_cmi_checked (GtkWidget *check_menu_item)
 Tells whether a GtkCheckMenuItem is Checked or not.
gboolean is_toggle_button_activated (GtkBuilder *main_xml, gchar *check_button)
 returns the state of a named check button contained in the GtkBuilder XML description
GtkWidget * heraia_get_widget (GtkBuilder *xml, gchar *widget_name)
 This is a wrapper to the GtkBuilder xml get widget.
void destroy_a_single_widget (GtkWidget *widget)
 Destroys a single widget if it exists.
static void init_one_cmi_window_state (GtkWidget *dialog_box, GtkWidget *cmi, window_prop_t *dialog_prop)
 init one cmi window based state
void init_window_states (heraia_struct_t *main_struct)
 Inits all windows states (positions, displayed, and so on.
void add_new_tab_in_main_struct (heraia_struct_t *main_struct, doc_t *doc)
 Adds a new tab to the main window in file's notebook.
void show_hide_widget (GtkWidget *widget, gboolean show, window_prop_t *win_prop)
 To help plugins to deal with widgets, shows or hide a specific widget.

Detailed Description

This file has all the functions to manage heraia's ui

Definition in file heraia_ui.c.


Function Documentation

void a_propos_activate ( GtkWidget *  widget,
gpointer  data 
)

Shows apropos's dialog box.

Parameters:
widget : the widget that issued the signal
data : user data MUST be heraia_struct_t *main_struct main structure

Definition at line 125 of file heraia_ui.c.

References all_window_prop_t::about_box, heraia_get_widget(), xml_t::main, move_and_show_dialog_box(), set_a_propos_properties(), heraia_struct_t::win_prop, and heraia_struct_t::xmls.

Referenced by heraia_ui_connect_signals().

Here is the call graph for this function:

Here is the caller graph for this function:

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

To close the A propos dialog box.

Parameters:
widget : calling widget (may be NULL as we don't use this)
data : MUST be heraia_struct_t *main_struct main structure

Definition at line 301 of file heraia_ui.c.

References record_and_hide_about_box().

Referenced by heraia_ui_connect_signals().

Here is the call graph for this function:

Here is the caller graph for this function:

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

To close the A propos dialog box.

Parameters:
widget : calling widget (may be NULL as we don't use this)
event : event associated (may be NULL as we don't use this)
data : MUST be heraia_struct_t *main_struct main structure
Returns:
returns TRUE in order to allow other functions to do something with that event.

Definition at line 317 of file heraia_ui.c.

References record_and_hide_about_box().

Referenced by heraia_ui_connect_signals().

Here is the call graph for this function:

Here is the caller graph for this function:

void a_propos_response ( GtkWidget *  widget,
gint  response,
gpointer  data 
) [static]

To close the A propos dialog box (with the "close" button).

Parameters:
widget : calling widget (may be NULL as we don't use this)
response : may be whatever you want as we neither use this !
data : MUST be heraia_struct_t *main_struct main structure

Definition at line 288 of file heraia_ui.c.

References record_and_hide_about_box().

Referenced by heraia_ui_connect_signals().

Here is the call graph for this function:

Here is the caller graph for this function:

void add_new_tab_in_main_struct ( heraia_struct_t main_struct,
doc_t doc 
)

Adds a new tab to the main window in file's notebook.

Parameters:
main_struct : main structure
doc : the new document that will be related to the tab

< used for vbox creation

< file_notebook from heraia.gtkbuilder

< tab's label

< new tab's index

Definition at line 1686 of file heraia_ui.c.

References heraia_struct_t::current_doc, heraia_get_widget(), doc_t::hex_widget, xml_t::main, and heraia_struct_t::xmls.

Referenced by load_file_to_analyse().

Here is the call graph for this function:

Here is the caller graph for this function:

void add_text_to_textview ( GtkTextView *  textview,
const char *  format,
  ... 
)

adds a text to a textview

Parameters:
textview : the textview where to add text
format : printf style format
... : a va_list arguments to fit format (as with printf)

Definition at line 1341 of file heraia_ui.c.

Referenced by print_plugin_basics(), print_plugin_extra_structure(), print_plugin_filter_structure(), print_plugin_functions(), print_plugin_info_structure(), print_plugin_interface(), print_plugin_state(), and realize_some_numerical_stat().

Here is the caller graph for this function:

static gboolean close_heraia ( heraia_struct_t main_struct  )  [static]

Before closing heraia we need to do few things.

Parameters:
main_struct : main_struct
Returns:
TRUE if we can safely quit heraia, FALSE otherwise

Definition at line 1533 of file heraia_ui.c.

References heraia_get_widget(), xml_t::main, record_all_dialog_box_positions(), save_preferences(), unsaved_documents(), and heraia_struct_t::xmls.

Referenced by on_quit_activate().

Here is the call graph for this function:

Here is the caller graph for this function:

void connect_cursor_moved_signal ( heraia_struct_t main_struct,
GtkWidget *  hex_widget 
)

Connects the signal that the cursor has moved to the refreshing function.

Parameters:
main_struct : main structure
hex_widget : the hex_widget we want to connect the signal to

Definition at line 1151 of file heraia_ui.c.

References refresh_event_handler().

Referenced by heraia_hex_document_new().

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean delete_dt_window_event ( GtkWidget *  widget,
GdkEvent *  event,
gpointer  data 
)

call back function for the data interpretor window destruction

Parameters:
widget : calling widget (may be NULL as we don't use this here)
event : event associated (may be NULL as we don't use this here)
data : MUST be heraia_struct_t *main_struct main structure and not NULL

Definition at line 721 of file heraia_ui.c.

References heraia_get_widget(), xml_t::main, and heraia_struct_t::xmls.

Referenced by connect_data_interpretor_signals().

Here is the call graph for this function:

Here is the caller graph for this function:

delete_main_struct_event ( GtkWidget *  widget,
GdkEvent *  event,
gpointer  data 
)

When the user destroys or delete the main window.

Parameters:
widget : calling widget
event : event associated (may be NULL as we don't use this here)
data : MUST be heraia_struct_t *main_struct main structure

Definition at line 705 of file heraia_ui.c.

References on_quit_activate().

Referenced by heraia_ui_connect_signals().

Here is the call graph for this function:

Here is the caller graph for this function:

void destroy_a_single_widget ( GtkWidget *  widget  ) 

Destroys a single widget if it exists.

Parameters:
widget : the widget to destroy

Definition at line 1491 of file heraia_ui.c.

void destroy_dt_window ( GtkWidget *  widget,
GdkEvent *  event,
gpointer  data 
)

call back function for the data interpretor window destruction

Parameters:
widget : calling widget (may be NULL as we don't use this here)
event : event associated (may be NULL as we don't use this here)
data : MUST be heraia_struct_t *main_struct main structure and not NULL

Definition at line 738 of file heraia_ui.c.

References heraia_get_widget(), xml_t::main, and heraia_struct_t::xmls.

Referenced by connect_data_interpretor_signals().

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean file_notebook_tab_changed ( GtkNotebook *  notebook,
GtkNotebookPage *  page,
gint  tab_num,
gpointer  data 
)

What to do when a change occurs in tabs (user selected a particular tab.

Parameters:
notebook : the widget that issued this signal
page : the new current page
tab_num : index of this page
data : MUST be heraia_struct_t *main_struct !

Definition at line 754 of file heraia_ui.c.

References heraia_struct_t::current_doc, heraia_struct_t::documents, heraia_struct_t::event, HERAIA_REFRESH_NOTHING, HERAIA_REFRESH_TAB_CHANGED, refresh_event_handler(), and update_main_struct_name().

Referenced by heraia_ui_connect_signals().

Here is the call graph for this function:

Here is the caller graph for this function:

void grey_main_widgets ( GtkBuilder *  main,
gboolean  greyed 
)

Hides or grey all widgets that needs an open file when boolean show is FALSE.

Parameters:
main : main GtkBuilder XML structure
greyed : boolean (TRUE to hide an grey widgets)

Definition at line 1056 of file heraia_ui.c.

References heraia_get_widget().

Referenced by init_heraia_interface(), and load_file_to_analyse().

Here is the call graph for this function:

Here is the caller graph for this function:

GtkWidget * gtk_radio_button_get_active ( GSList *  group  ) 

Try to find the active radio button widget in a group This does not take into account inconsistant states returns the first active radio button otherwise NULL.

Parameters:
group : A group of GtkRadioButtons
Returns:
returns the active widget if any (NULL if none)

Definition at line 1386 of file heraia_ui.c.

Referenced by gtk_radio_button_get_active_from_widget().

Here is the caller graph for this function:

GtkWidget * gtk_radio_button_get_active_from_widget ( GtkRadioButton *  radio_group_member  ) 

gets the active radio button from a radio group

Parameters:
radio_group_member : widget to get radio group from
Returns:
the active GtkRadioButton within the group from radio_group_member

Definition at line 1410 of file heraia_ui.c.

References gtk_radio_button_get_active().

Referenced by which_endianness().

Here is the call graph for this function:

Here is the caller graph for this function:

GtkWidget * heraia_get_widget ( GtkBuilder *  xml,
gchar *  widget_name 
)

This is a wrapper to the GtkBuilder xml get widget.

It is intended to simplify the developpers lives if they have to choose or propose other means to do the same thing than libglade (say, for example, GtkBuilder ;-)

Parameters:
xml : A GtkBuilder XML definition
widget_name : an existing widget name in the GtkBuilder definition
Returns:
returns the widget itself if it exists in the definition file (NULL otherwise)

For debug purposes only (very verbose as this function is the main used) fprintf(stdout, "Getting Widget named %s\n", widget_name);

Definition at line 1468 of file heraia_ui.c.

Referenced by a_propos_activate(), add_default_tabs(), add_entry_to_plugins_menu(), add_new_tab_in_main_struct(), close_data_interpretor_window(), close_heraia(), connect_data_interpretor_signals(), data_interpretor_init_interface(), delete_dt_window_event(), destroy_dt_window(), grey_main_widgets(), heraia_ui_connect_signals(), histo_radiobutton_toggled(), init(), init_plugin_name_tv(), init_window_states(), is_toggle_button_activated(), load_di_preferences(), load_mp_display_preferences_options(), load_mp_file_preferences_options(), load_mpwp_preferences(), log_window_connect_signals(), log_window_init_interface(), logw_close_clicked(), main_pref_window_connect_signals(), mw_cmi_plw_toggle(), my_log(), on_DIMenu_activate(), on_mp_tb_display_bt_toggled(), on_mp_tb_fp_bt_toggled(), on_preferences_activate(), plugin_list_window_connect_signals(), plw_close_clicked(), plw_refresh_clicked(), pn_treeview_selection_changed_cb(), populate_stats_histos(), pref_window_delete(), realize_some_numerical_stat(), record_all_dialog_box_positions(), record_and_hide_about_box(), refresh_file_labels(), run(), save_di_preferences(), save_mpwp_preferences(), select_a_file_to_save(), select_file_to_load(), set_notebook_tab_label_color(), set_notebook_tab_name(), set_statw_button_state(), show_hide_log_window(), stat_window_connect_signals(), statw_close_clicked(), statw_export_to_csv_clicked(), statw_export_to_gnuplot_clicked(), statw_export_to_pcv_clicked(), statw_save_as_clicked(), update_main_struct_name(), which_endianness(), and which_stream_size().

Here is the caller graph for this function:

static void heraia_ui_connect_signals ( heraia_struct_t main_struct  )  [static]
void init_heraia_interface ( heraia_struct_t main_struct  ) 

Here we might init some call backs and menu options and display the interface (main && sub-windows) This function should be called only once at main program's init time.

Parameters:
main_struct : main structure

Definition at line 1088 of file heraia_ui.c.

References heraia_struct_t::current_doc, grey_main_widgets(), init_window_states(), xml_t::main, refresh_file_labels(), and heraia_struct_t::xmls.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

void init_one_cmi_window_state ( GtkWidget *  dialog_box,
GtkWidget *  cmi,
window_prop_t dialog_prop 
) [static]

init one cmi window based state

Parameters:
dialog_box : the window or dialog box we want to init its state
cmi : corresponding check menu item
dialog_prop : corresponding window properties (should be initialized and not NULL)

Definition at line 1594 of file heraia_ui.c.

References window_prop_t::displayed, window_prop_t::height, window_prop_t::width, window_prop_t::x, and window_prop_t::y.

Referenced by init_window_states().

Here is the caller graph for this function:

init_window_states ( heraia_struct_t main_struct  ) 
gboolean is_cmi_checked ( GtkWidget *  check_menu_item  ) 

Tells whether a GtkCheckMenuItem is Checked or not.

Parameters:
check_menu_item : a GtkCheckMenuItem to verify
Returns:
returns TRUE if the Check Manu Item is checked, FALSE otherwise

Definition at line 1429 of file heraia_ui.c.

gboolean is_toggle_button_activated ( GtkBuilder *  main_xml,
gchar *  check_button 
)

returns the state of a named check button contained in the GtkBuilder XML description

Parameters:
main_xml : a GtkBuilder XML definition
check_button : the name of an existing check_button within the GtkBuilder definition
Returns:
TRUE if the button is activated / toggled , FALSE otherwise

Definition at line 1444 of file heraia_ui.c.

References heraia_get_widget().

Referenced by refresh_file_labels(), save_mp_display_preferences_options(), and save_mp_file_preferences_options().

Here is the call graph for this function:

Here is the caller graph for this function:

kill_text_from_textview ( GtkTextView *  textview  ) 

Kills the text from a textview.

Parameters:
textview : the textview to kill the text from

Definition at line 1365 of file heraia_ui.c.

Referenced by plw_refresh_clicked(), pn_treeview_selection_changed_cb(), and realize_some_numerical_stat().

Here is the caller graph for this function:

int load_heraia_ui ( heraia_struct_t main_struct  ) 

Loads, if possible, the gtkbuilder xml file and then connects the signals and inits the following windows :

  • log window
  • data_interpretor window
  • list data types.

Parameters:
main_struct : main structure
Returns:
TRUE if load_heraia_xml suceeded, FALSE otherwise
Todo:
add more return values to init functions to detect any error while initializing the ui

Definition at line 1250 of file heraia_ui.c.

References data_interpretor_init_interface(), heraia_struct_t::debug, heraia_ui_connect_signals(), load_heraia_xml(), load_preference_file(), load_preferences(), log_window_init_interface(), and main_pref_window_init_interface().

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

static gboolean load_heraia_xml ( heraia_struct_t main_struct  )  [static]

Loads the GtkBuilder xml files that describes the heraia project tries the following paths in that order :

  • /etc/heraia/heraia.gtkbuilder
  • /home/[user]/.heraia/heraia.gtkbuilder
  • PWD/heraia.gtkbuilder.

Parameters:
main_struct : main structure
Returns:
TRUE if everything went ok, FALSE otherwise

Definition at line 1119 of file heraia_ui.c.

References load_xml_file(), heraia_struct_t::location_list, xml_t::main, and heraia_struct_t::xmls.

Referenced by load_heraia_ui().

Here is the call graph for this function:

Here is the caller graph for this function:

static gchar * make_absolute_path ( gchar *  filename  )  [static]

Returns an absolute path to the filename the string should be freed when no longer needed very UGLy !

Todo:
do something without any system calls !!!
Parameters:
filename : relative notation filename from which to extract an absolute path
Returns:
returns a string with the absolute path which should be freed when no longer needed

Definition at line 785 of file heraia_ui.c.

Referenced by set_the_working_directory().

Here is the caller graph for this function:

void move_and_show_dialog_box ( GtkWidget *  dialog_box,
window_prop_t dialog_prop 
)

Move the dialog box to the wanted position, shows it and says it in the displayed prop.

Parameters:
dialog_box : the dialog box we want to move and show
dialog_prop : window_prop_t properties structure corresponding to the dialog box

Definition at line 146 of file heraia_ui.c.

References window_prop_t::displayed, window_prop_t::height, window_prop_t::width, window_prop_t::x, and window_prop_t::y.

Referenced by a_propos_activate(), mw_cmi_plw_toggle(), on_DIMenu_activate(), on_preferences_activate(), show_hide_log_window(), and show_hide_widget().

Here is the caller graph for this function:

void on_copy_activate ( GtkWidget *  widget,
gpointer  data 
)

Copy, edit menu.

Warning:
Not yet implemented
Todo:
Write a usefull function here :)
Parameters:
widget : the widget that issued the signal
data : user data MUST be heraia_struct_t *main_struct main structure

Definition at line 366 of file heraia_ui.c.

References log_message().

Referenced by heraia_ui_connect_signals().

Here is the call graph for this function:

Here is the caller graph for this function:

void on_cut_activate ( GtkWidget *  widget,
gpointer  data 
)

Cut, edit menu.

Warning:
Not yet implemented
Todo:
Write a usefull function here :)
Parameters:
widget : the widget that issued the signal
data : user data MUST be heraia_struct_t *main_struct main structure

Definition at line 350 of file heraia_ui.c.

References log_message().

Referenced by heraia_ui_connect_signals().

Here is the call graph for this function:

Here is the caller graph for this function:

void on_delete_activate ( GtkWidget *  widget,
gpointer  data 
)

Delete, edit menu.

Warning:
Not yet implemented
Todo:
Write a usefull function here :)
Parameters:
widget : the widget that issued the signal
data : user data MUST be heraia_struct_t *main_struct main structure

Definition at line 334 of file heraia_ui.c.

References log_message().

Referenced by heraia_ui_connect_signals().

Here is the call graph for this function:

Here is the caller graph for this function:

void on_DIMenu_activate ( GtkWidget *  widget,
gpointer  data 
)

This handles the menuitem "Data Interpretor" that shows or hides the data interpretor window.

Parameters:
widget : the widget that issued the signal
data : user data MUST be heraia_struct_t *main_struct main structure

< data_window structure for data interpretor

< data interpretor's notebook

Definition at line 628 of file heraia_ui.c.

References heraia_struct_t::current_DW, all_window_prop_t::data_interpretor, window_prop_t::displayed, data_window_t::diw, heraia_get_widget(), xml_t::main, move_and_show_dialog_box(), record_and_hide_dialog_box(), refresh_data_interpretor_window(), data_window_t::tab_displayed, heraia_struct_t::win_prop, and heraia_struct_t::xmls.

Referenced by heraia_ui_connect_signals().

Here is the call graph for this function:

Here is the caller graph for this function:

void on_new_activate ( GtkWidget *  widget,
gpointer  data 
)

New, file menu.

Parameters:
widget : the widget that issued the signal
data : user data MUST be heraia_struct_t *main_struct main structure

Definition at line 67 of file heraia_ui.c.

References log_message().

Referenced by heraia_ui_connect_signals().

Here is the call graph for this function:

Here is the caller graph for this function:

void on_open_activate ( GtkWidget *  widget,
gpointer  data 
)

This handles the menuitem "Ouvrir" to open a file.

Warning:
This function is not thread safe (do not use in a thread)
Todo:
try to put some mutexes on main_struct->event to make this thread safe some way
Parameters:
widget : the widget that issued the signal
data : user data MUST be heraia_struct_t *main_struct main structure

Definition at line 510 of file heraia_ui.c.

References heraia_struct_t::current_doc, heraia_struct_t::event, HERAIA_REFRESH_NEW_FILE, doc_t::hex_widget, load_file_to_analyse(), refresh_event_handler(), and select_file_to_load().

Referenced by heraia_ui_connect_signals().

Here is the call graph for this function:

Here is the caller graph for this function:

void on_paste_activate ( GtkWidget *  widget,
gpointer  data 
)

Paste, edit menu.

Warning:
Not yet implemented
Todo:
Write a usefull function here :)
Parameters:
widget : the widget that issued the signal
data : user data MUST be heraia_struct_t *main_struct main structure

Definition at line 382 of file heraia_ui.c.

References log_message().

Referenced by heraia_ui_connect_signals().

Here is the call graph for this function:

Here is the caller graph for this function:

void on_preferences_activate ( GtkWidget *  widget,
gpointer  data 
)

Preferences, file menu : Displays the preference window (as a modal window).

Parameters:
widget : the widget that issued the signal
data : user data MUST be heraia_struct_t *main_struct main structure

Definition at line 82 of file heraia_ui.c.

References heraia_get_widget(), xml_t::main, all_window_prop_t::main_pref_window, move_and_show_dialog_box(), heraia_struct_t::win_prop, and heraia_struct_t::xmls.

Referenced by heraia_ui_connect_signals().

Here is the call graph for this function:

Here is the caller graph for this function:

void on_quit_activate ( GtkWidget *  widget,
gpointer  data 
)

Quit, file menu.

Parameters:
widget : the widget that issued the signal
data : user data MUST be heraia_struct_t *main_struct main structure

Definition at line 47 of file heraia_ui.c.

References close_heraia().

Referenced by delete_main_struct_event(), and heraia_ui_connect_signals().

Here is the call graph for this function:

Here is the caller graph for this function:

void on_save_activate ( GtkWidget *  widget,
gpointer  data 
)

Here we attemp to save the edited file.

Todo:
be more accurate on error (error type, message and filename) returns we should return something at least ...
Parameters:
widget : the widget that issued the signal
data : user data MUST be heraia_struct_t *main_struct main structure

Definition at line 549 of file heraia_ui.c.

References heraia_struct_t::current_doc, doc_t_document_get_filename(), heraia_hex_document_save(), HERAIA_NOERR, log_message(), doc_t::modified, and set_notebook_tab_label_color().

Referenced by heraia_ui_connect_signals().

Here is the call graph for this function:

Here is the caller graph for this function:

void on_save_as_activate ( GtkWidget *  widget,
gpointer  data 
)

This handle the save_as menu entry (here the filename changes).

Parameters:
widget : the widget that issued the signal
data : user data MUST be heraia_struct_t *main_struct main structure

< Auto malloc'ed, do not free

Definition at line 579 of file heraia_ui.c.

References heraia_struct_t::current_doc, doc_t_document_get_filename(), HERAIA_CANCELLED, heraia_hex_document_save_as(), HERAIA_NOERR, log_message(), doc_t::modified, select_a_file_to_save(), set_notebook_tab_name(), and update_main_struct_name().

Referenced by heraia_ui_connect_signals().

Here is the call graph for this function:

Here is the caller graph for this function:

void on_tests_menu_activate ( GtkWidget *  widget,
gpointer  data 
)

Called when tests submenu is activated.

Parameters:
widget : the widget that issued the signal
data : user data MUST be heraia_struct_t *main_struct main structure

Definition at line 677 of file heraia_ui.c.

References log_message(), and tests_ui().

Referenced by heraia_ui_connect_signals().

Here is the call graph for this function:

Here is the caller graph for this function:

void record_all_dialog_box_positions ( heraia_struct_t main_struct  ) 

Records all the positions of the displayed windows.

Parameters:
[in,out] main_struct : main structure

Definition at line 203 of file heraia_ui.c.

References all_window_prop_t::about_box, heraia_struct_t::current_DW, all_window_prop_t::data_interpretor, data_window_t::diw, heraia_get_widget(), all_window_prop_t::ldt, all_window_prop_t::log_box, xml_t::main, all_window_prop_t::main_dialog, all_window_prop_t::main_pref_window, all_window_prop_t::plugin_list, record_dialog_box_position(), heraia_struct_t::win_prop, and heraia_struct_t::xmls.

Referenced by close_heraia().

Here is the call graph for this function:

Here is the caller graph for this function:

static void record_and_hide_about_box ( heraia_struct_t main_struct  )  [static]

Record position and hide about dialog box.

Parameters:
[in,out] main_struct : main structure

Definition at line 268 of file heraia_ui.c.

References all_window_prop_t::about_box, heraia_get_widget(), xml_t::main, record_and_hide_dialog_box(), heraia_struct_t::win_prop, and heraia_struct_t::xmls.

Referenced by a_propos_close(), a_propos_delete(), and a_propos_response().

Here is the call graph for this function:

Here is the caller graph for this function:

void record_and_hide_dialog_box ( GtkWidget *  dialog_box,
window_prop_t dialog_prop 
)

Record position and hide a dialog box.

Parameters:
dialog_box : the dialog box we want to record its position and then hide
dialog_prop : window_prop_t properties structure corresponding to the dialog box

Definition at line 250 of file heraia_ui.c.

References window_prop_t::displayed, and record_dialog_box_position().

Referenced by mw_cmi_plw_toggle(), on_DIMenu_activate(), plw_close_clicked(), pref_window_delete(), record_and_hide_about_box(), show_hide_log_window(), and show_hide_widget().

Here is the call graph for this function:

Here is the caller graph for this function:

void record_dialog_box_position ( GtkWidget *  dialog_box,
window_prop_t dialog_prop 
)

Records one dialog position.

Parameters:
dialog_box : a dialog box from which we want to record the position
[in,out] dialog_prop : window_prop_t properties structure corresponding to the dialog box

Definition at line 176 of file heraia_ui.c.

References window_prop_t::displayed, window_prop_t::height, window_prop_t::width, WPT_DEFAULT_HEIGHT, WPT_DEFAULT_WIDTH, window_prop_t::x, and window_prop_t::y.

Referenced by record_all_dialog_box_positions(), and record_and_hide_dialog_box().

Here is the caller graph for this function:

void refresh_event_handler ( GtkWidget *  widget,
gpointer  data 
)

This function is here to ensure that everything will be refreshed upon a signal event.

Warning:
This function is not thread safe (do not use in a thread)
Todo:
try to put some mutexes on main_struct->event to make this thread safe some way
Parameters:
widget : the widget that issued the signal
data : user data MUST be heraia_struct_t *main_struct main structure

Definition at line 481 of file heraia_ui.c.

References heraia_struct_t::event, HERAIA_REFRESH_CURSOR_MOVE, HERAIA_REFRESH_NOTHING, refresh_all_plugins(), refresh_data_interpretor_window(), and refresh_file_labels().

Referenced by connect_cursor_moved_signal(), file_notebook_tab_changed(), and on_open_activate().

Here is the call graph for this function:

Here is the caller graph for this function:

void refresh_file_labels ( heraia_struct_t main_struct  ) 

This function is refreshing the labels on the main window in order to reflect cursor position, selected positions and total selected size.

It is also used to refresh the file label on the tab.

Parameters:
main_struct : main structure

Definition at line 397 of file heraia_ui.c.

References heraia_struct_t::current_doc, selection_t::end, ghex_file_size(), ghex_get_cursor_position(), ghex_get_selection(), heraia_get_widget(), doc_t::hex_doc, doc_t::hex_widget, is_toggle_button_activated(), xml_t::main, doc_t::modified, set_notebook_tab_label_color(), selection_t::start, and heraia_struct_t::xmls.

Referenced by init_heraia_interface(), on_mp_thousand_bt_toggled(), and refresh_event_handler().

Here is the call graph for this function:

Here is the caller graph for this function:

gchar * select_a_file_to_save ( heraia_struct_t main_struct  ) 

This function opens a dialog box that allow one to choose a file name to the file which is about to be saved.

Parameters:
main_struct : main structure
Returns:
returns complete filename (path and filename)

< A parent window (we use main_struct)

Definition at line 903 of file heraia_ui.c.

References heraia_struct_t::current_doc, doc_t_document_get_filename(), heraia_get_widget(), xml_t::main, set_the_working_directory(), and heraia_struct_t::xmls.

Referenced by on_save_as_activate().

Here is the call graph for this function:

Here is the caller graph for this function:

GSList* select_file_to_load ( heraia_struct_t main_struct  ) 

This function does open a file selector dialog box and returns the selected filename.

Parameters:
main_struct : main structure
Returns:
returns a list of filenames to be loaded (if any)

< A parent window (we use main_struct)

< list of selected (if any) filenames to be openned

for the moment we do not want to retrieve multiples selections but this could be a valuable thing in the future

We want the file selection path to be the one of the previous openned file if any !

Definition at line 845 of file heraia_ui.c.

References heraia_struct_t::current_doc, doc_t_document_get_filename(), heraia_get_widget(), xml_t::main, set_the_working_directory(), and heraia_struct_t::xmls.

Referenced by on_open_activate().

Here is the call graph for this function:

Here is the caller graph for this function:

static void set_a_propos_properties ( GtkWidget *  about_dialog  )  [static]

Sets name and version in the dialog box.

Parameters:
about_dialog the widget that contain all the about box

Definition at line 102 of file heraia_ui.c.

References PACKAGE_NAME, and PACKAGE_VERSION.

Referenced by a_propos_activate(), and init_window_states().

Here is the caller graph for this function:

void set_notebook_tab_label_color ( heraia_struct_t main_struct,
gboolean  color 
)

Set the style for the label.

Parameters:
main_struct : main structure
color : If color is TRUE sets the color for the file tab's label If not, then sets it to default

Definition at line 1015 of file heraia_ui.c.

References heraia_struct_t::current_doc, heraia_get_widget(), log_message(), xml_t::main, and heraia_struct_t::xmls.

Referenced by on_save_activate(), and refresh_file_labels().

Here is the call graph for this function:

Here is the caller graph for this function:

void set_notebook_tab_name ( heraia_struct_t main_struct  ) 

Sets notebook's tab's name.

This function should only be called when a new filename was set (open and save as functions)

Parameters:
main_struct : main structure

Definition at line 976 of file heraia_ui.c.

References heraia_struct_t::current_doc, doc_t_document_get_filename(), heraia_struct_t::documents, heraia_get_widget(), xml_t::main, and heraia_struct_t::xmls.

Referenced by load_file_to_analyse(), and on_save_as_activate().

Here is the call graph for this function:

Here is the caller graph for this function:

void set_the_working_directory ( GtkFileChooser *  file_chooser,
gchar *  filename 
)

Sets the working directory for the file chooser to the directory of the filename (even if filename is a relative filename such as .

./docs/test_file)

Parameters:
file_chooser : An initialized GtkFileChooser
filename : a filename (one previously openned)

< directory where we want to be, at first, in the file chooser

Definition at line 825 of file heraia_ui.c.

References make_absolute_path().

Referenced by select_a_file_to_save(), and select_file_to_load().

Here is the call graph for this function:

Here is the caller graph for this function:

void show_hide_widget ( GtkWidget *  widget,
gboolean  show,
window_prop_t win_prop 
)

To help plugins to deal with widgets, shows or hide a specific widget.

Parameters:
widget : the widget to show or hide
show : what to do : TRUE to show the widget, FALSE to hide it
win_prop : window properties.

Definition at line 1713 of file heraia_ui.c.

References move_and_show_dialog_box(), and record_and_hide_dialog_box().

Referenced by run(), and statw_close_clicked().

Here is the call graph for this function:

Here is the caller graph for this function:

static gboolean unsaved_documents ( heraia_struct_t main_struct  )  [static]

Verify if we can safely close everything.

Parameters:
main_struct : main structure
Returns:
a boolean which is TRUE if unsaved documents still exists and FALSE otherwise

Definition at line 1506 of file heraia_ui.c.

References heraia_struct_t::documents, and doc_t::modified.

Referenced by close_heraia().

Here is the caller graph for this function:

void update_main_struct_name ( heraia_struct_t main_struct  ) 

Update main window heraia's name to reflect the current edited file.

Parameters:
main_struct : main structure

Definition at line 952 of file heraia_ui.c.

References heraia_struct_t::current_doc, doc_t_document_get_filename(), heraia_get_widget(), xml_t::main, and heraia_struct_t::xmls.

Referenced by file_notebook_tab_changed(), load_file_to_analyse(), and on_save_as_activate().

Here is the call graph for this function:

Here is the caller graph for this function:

Generated on Tue May 11 18:46:40 2010 for Heraia by  doxygen 1.6.3