This file has all the functions to manage heraia's ui
#include <libheraia.h>
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 :
| |
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. | |
static GtkWidget * | create_tab_close_button (heraia_struct_t *main_struct, GtkWidget *tab_label) |
Creates a label an a button to add into a tab from main window's notebook. | |
static GtkWidget * | find_label_from_hbox (GtkWidget *hbox) |
Tries to find the label contained in the hbox. | |
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_undo_activate (GtkWidget *widget, gpointer data) |
Undo, edit menu. | |
void | on_redo_activate (GtkWidget *widget, gpointer data) |
Redo, edit menu. | |
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. | |
gint | find_tab_number_from_widget (heraia_struct_t *main_struct, GtkWidget *to_find) |
Searches main notebook's tabs for a particular widget and returns the number of the corresponding tab if it exists, -1 otherwise. | |
void | on_close_activate (GtkWidget *widget, gpointer data) |
Closes an openned 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_window_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 *xml, gboolean greyed) |
Hides or grey all widgets that needs an open file when boolean greyed is TRUE. | |
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 :
| |
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_button) |
gets the active radio button from a radio group | |
void | gtk_radio_button_set_active (GtkRadioButton *radio_button) |
Sets the radio button active. | |
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_window (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. |
This file has all the functions to manage heraia's ui
Definition in file heraia_ui.c.
void a_propos_activate | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Shows apropos's dialog box.
widget | : the widget that issued the signal | |
data | : user data MUST be heraia_struct_t *main_struct main structure |
Definition at line 126 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().
void a_propos_close | ( | GtkWidget * | widget, | |
gpointer | data | |||
) | [static] |
To close the A propos dialog box.
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 302 of file heraia_ui.c.
References record_and_hide_about_box().
Referenced by heraia_ui_connect_signals().
gboolean a_propos_delete | ( | GtkWidget * | widget, | |
GdkEvent * | event, | |||
gpointer | data | |||
) | [static] |
To close the A propos dialog box.
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 |
Definition at line 318 of file heraia_ui.c.
References record_and_hide_about_box().
Referenced by heraia_ui_connect_signals().
void a_propos_response | ( | GtkWidget * | widget, | |
gint | response, | |||
gpointer | data | |||
) | [static] |
To close the A propos dialog box (with the "close" button).
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 289 of file heraia_ui.c.
References record_and_hide_about_box().
Referenced by heraia_ui_connect_signals().
void add_new_tab_in_main_window | ( | heraia_struct_t * | main_struct, | |
doc_t * | doc | |||
) |
Adds a new tab to the main window in file's notebook.
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
<menu's label
< new tab's index
< markup text
< menu markup text
< used for hbox creation in the tabs
Definition at line 2116 of file heraia_ui.c.
References create_tab_close_button(), heraia_struct_t::current_doc, doc_t_document_get_filename(), heraia_get_widget(), doc_t::hex_widget, xml_t::main, and heraia_struct_t::xmls.
Referenced by load_file_to_analyse().
void add_text_to_textview | ( | GtkTextView * | textview, | |
const char * | format, | |||
... | ||||
) |
adds a text to a textview
textview | : the textview where to add text | |
format | : printf style format | |
... | : a va_list arguments to fit format (as with printf) |
Definition at line 1714 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().
static gboolean close_heraia | ( | heraia_struct_t * | main_struct | ) | [static] |
Before closing heraia we need to do few things.
main_struct | : main_struct |
< if there is any unsaved documents
< By default we want to quit
< The dialog box
< parent widget for the dialog box
< result from the dialog box
Definition at line 1938 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().
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.
main_struct | : main structure | |
hex_widget | : the hex_widget we want to connect the signal to |
Definition at line 1512 of file heraia_ui.c.
References refresh_event_handler().
Referenced by heraia_hex_document_new().
static GtkWidget * create_tab_close_button | ( | heraia_struct_t * | main_struct, | |
GtkWidget * | tab_label | |||
) | [static] |
Creates a label an a button to add into a tab from main window's notebook.
main_struct | : main structure | |
tab_label | : a GtkWidget that is the label we want to add to the tab |
< used for hbox creation in the tabs
< Closing button
Definition at line 2087 of file heraia_ui.c.
References on_close_activate().
Referenced by add_new_tab_in_main_window().
gboolean delete_dt_window_event | ( | GtkWidget * | widget, | |
GdkEvent * | event, | |||
gpointer | data | |||
) |
call back function for the data interpretor window destruction
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 1000 of file heraia_ui.c.
References heraia_get_widget(), xml_t::main, and heraia_struct_t::xmls.
Referenced by connect_data_interpretor_signals().
delete_main_struct_event | ( | GtkWidget * | widget, | |
GdkEvent * | event, | |||
gpointer | data | |||
) |
When the user destroys or delete the main window.
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 983 of file heraia_ui.c.
References on_quit_activate().
Referenced by heraia_ui_connect_signals().
void destroy_a_single_widget | ( | GtkWidget * | widget | ) |
Destroys a single widget if it exists.
widget | : the widget to destroy |
Definition at line 1896 of file heraia_ui.c.
void destroy_dt_window | ( | GtkWidget * | widget, | |
GdkEvent * | event, | |||
gpointer | data | |||
) |
call back function for the data interpretor window destruction
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 1017 of file heraia_ui.c.
References heraia_get_widget(), xml_t::main, and heraia_struct_t::xmls.
Referenced by connect_data_interpretor_signals().
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).
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 1033 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_window_name().
Referenced by heraia_ui_connect_signals().
static GtkWidget * find_label_from_hbox | ( | GtkWidget * | hbox | ) | [static] |
Tries to find the label contained in the hbox.
hbox | : the hbox widget containing one GtkLabel |
< List of children in hbox widget
Definition at line 1266 of file heraia_ui.c.
Referenced by set_notebook_tab_label_color(), and set_notebook_tab_name().
gint find_tab_number_from_widget | ( | heraia_struct_t * | main_struct, | |
GtkWidget * | to_find | |||
) |
Searches main notebook's tabs for a particular widget and returns the number of the corresponding tab if it exists, -1 otherwise.
main_struct | : main structure | |
to_find | : a GtkWidget that we want to find in the main notebook tabs |
< Notenook on the main window
< pages on the notebook
< tab label GtkWidget (hbox + others)
< Number of pages in the notebook
< True when the widget has been found
< Children from the tab label
Definition at line 640 of file heraia_ui.c.
References heraia_get_widget(), xml_t::main, and heraia_struct_t::xmls.
Referenced by on_close_activate().
void grey_main_widgets | ( | GtkBuilder * | xml, | |
gboolean | greyed | |||
) |
Hides or grey all widgets that needs an open file when boolean greyed is TRUE.
Also sets the current page of the notebook to the first one.
xml | : GtkBuilder XML main structure | |
greyed | : boolean (TRUE to hide an grey widgets) |
Definition at line 1404 of file heraia_ui.c.
References heraia_get_widget().
Referenced by init_heraia_interface(), load_file_to_analyse(), and on_close_activate().
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.
group | : A group of GtkRadioButtons |
Definition at line 1759 of file heraia_ui.c.
Referenced by gtk_radio_button_get_active_from_widget().
GtkWidget * gtk_radio_button_get_active_from_widget | ( | GtkRadioButton * | radio_group_member | ) |
gets the active radio button from a radio group
radio_button | : GtkRadioButton to get radio group from |
Definition at line 1787 of file heraia_ui.c.
References gtk_radio_button_get_active().
Referenced by di_get_endianness().
void gtk_radio_button_set_active | ( | GtkRadioButton * | radio_button | ) |
Sets the radio button active.
radio_button | : The GtkRadioButton to be active within it's group |
Definition at line 1804 of file heraia_ui.c.
Referenced by di_set_endianness().
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 ;-)
xml | : A GtkBuilder XML definition | |
widget_name | : an existing widget name in the GtkBuilder definition |
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 1873 of file heraia_ui.c.
Referenced by a_propos_activate(), add_default_tabs(), add_entry_to_plugins_menu(), add_new_tab_in_main_window(), close_heraia(), connect_data_interpretor_signals(), data_interpretor_init_interface(), delete_dt_window_event(), destroy_dt_window(), di_get_endianness(), di_get_selected_tab(), di_get_stream_size(), di_set_endianness(), di_set_selected_tab(), di_set_stream_size(), find_tab_number_from_widget(), grey_main_widgets(), heraia_ui_connect_signals(), histo_radiobutton_toggled(), init(), init_heraia_interface(), init_plugin_name_tv(), init_window_states(), is_toggle_button_activated(), 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_close_activate(), on_DIMenu_activate(), on_mp_tb_display_bt_toggled(), on_mp_tb_fp_bt_toggled(), on_preferences_activate(), on_redo_activate(), on_undo_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_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(), and update_main_window_name().
static void heraia_ui_connect_signals | ( | heraia_struct_t * | main_struct | ) | [static] |
Connect the signals at the interface.
main_struct | : main structure |
Definition at line 1523 of file heraia_ui.c.
References a_propos_activate(), a_propos_close(), a_propos_delete(), a_propos_response(), delete_main_struct_event(), file_notebook_tab_changed(), heraia_get_widget(), xml_t::main, on_close_activate(), on_copy_activate(), on_cut_activate(), on_delete_activate(), on_DIMenu_activate(), on_new_activate(), on_open_activate(), on_paste_activate(), on_preferences_activate(), on_quit_activate(), on_redo_activate(), on_save_activate(), on_save_as_activate(), on_tests_menu_activate(), on_undo_activate(), and heraia_struct_t::xmls.
Referenced by load_heraia_ui().
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.
main_struct | : main structure |
Definition at line 1445 of file heraia_ui.c.
References heraia_struct_t::current_doc, grey_main_widgets(), heraia_get_widget(), init_window_states(), xml_t::main, refresh_file_labels(), and heraia_struct_t::xmls.
Referenced by main().
void init_one_cmi_window_state | ( | GtkWidget * | dialog_box, | |
GtkWidget * | cmi, | |||
window_prop_t * | dialog_prop | |||
) | [static] |
init one cmi window based state
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 1993 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().
init_window_states | ( | heraia_struct_t * | main_struct | ) |
Inits all windows states (positions, displayed, and so on.
..)
main_struct | : main structure |
Definition at line 2016 of file heraia_ui.c.
References all_window_prop_t::about_box, all_window_prop_t::data_interpretor, window_prop_t::displayed, window_prop_t::height, heraia_get_widget(), init_one_cmi_window_state(), 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, set_a_propos_properties(), window_prop_t::width, heraia_struct_t::win_prop, window_prop_t::x, heraia_struct_t::xmls, and window_prop_t::y.
Referenced by init_heraia_interface().
gboolean is_cmi_checked | ( | GtkWidget * | check_menu_item | ) |
Tells whether a GtkCheckMenuItem is Checked or not.
check_menu_item | : a GtkCheckMenuItem to verify |
Definition at line 1835 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
main_xml | : a GtkBuilder XML definition | |
check_button | : the name of an existing check_button within the GtkBuilder definition |
Definition at line 1850 of file heraia_ui.c.
References heraia_get_widget().
Referenced by heraia_hex_document_new(), refresh_file_labels(), save_mp_display_preferences_options(), and save_mp_file_preferences_options().
kill_text_from_textview | ( | GtkTextView * | textview | ) |
Kills the text from a textview.
textview | : the textview to kill the text from |
Definition at line 1738 of file heraia_ui.c.
Referenced by plw_refresh_clicked(), pn_treeview_selection_changed_cb(), and realize_some_numerical_stat().
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 :
main_struct | : main structure |
Definition at line 1623 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().
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 :
main_struct | : main structure |
Definition at line 1480 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().
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 !
filename | : relative notation filename from which to extract an absolute path |
Definition at line 1072 of file heraia_ui.c.
Referenced by set_the_working_directory().
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.
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 147 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().
void on_close_activate | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Closes an openned file.
widget | : the widget that issued the signal | |
data | : user data MUST be heraia_struct_t *main_struct main structure |
< Current document to close in heraia
< To iterate over the array of documents
< Notenook on the main window
< The dialog box
< parent widget for the dialog box
< result from the dialog box
< Says wheter the document that we are trying to close is the current one or not
Definition at line 704 of file heraia_ui.c.
References close_doc_t(), heraia_struct_t::current_doc, doc_t_document_get_filename(), heraia_struct_t::documents, find_tab_number_from_widget(), grey_main_widgets(), heraia_get_widget(), log_message(), xml_t::main, doc_t::modified, refresh_event_handler(), update_main_window_name(), and heraia_struct_t::xmls.
Referenced by create_tab_close_button(), and heraia_ui_connect_signals().
void on_copy_activate | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Copy, edit menu.
widget | : the widget that issued the signal | |
data | : user data MUST be heraia_struct_t *main_struct main structure |
Definition at line 447 of file heraia_ui.c.
References heraia_struct_t::current_doc, and doc_t::hex_widget.
Referenced by heraia_ui_connect_signals().
void on_cut_activate | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Cut, edit menu.
widget | : the widget that issued the signal | |
data | : user data MUST be heraia_struct_t *main_struct main structure |
Definition at line 428 of file heraia_ui.c.
References heraia_struct_t::current_doc, doc_t::hex_widget, and refresh_event_handler().
Referenced by heraia_ui_connect_signals().
void on_delete_activate | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Delete, edit menu.
widget | : the widget that issued the signal | |
data | : user data MUST be heraia_struct_t *main_struct main structure |
Definition at line 409 of file heraia_ui.c.
References heraia_struct_t::current_doc, doc_t::hex_widget, and refresh_event_handler().
Referenced by heraia_ui_connect_signals().
void on_DIMenu_activate | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
This handles the menuitem "Data Interpretor" that shows or hides the data interpretor window.
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 906 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().
void on_new_activate | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
New, file menu.
widget | : the widget that issued the signal | |
data | : user data MUST be heraia_struct_t *main_struct main structure |
Definition at line 68 of file heraia_ui.c.
References log_message().
Referenced by heraia_ui_connect_signals().
void on_open_activate | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
This handles the menuitem "Ouvrir" to open a file.
widget | : the widget that issued the signal | |
data | : user data MUST be heraia_struct_t *main_struct main structure |
Definition at line 601 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().
void on_paste_activate | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Paste, edit menu.
widget | : the widget that issued the signal | |
data | : user data MUST be heraia_struct_t *main_struct main structure |
Definition at line 465 of file heraia_ui.c.
References heraia_struct_t::current_doc, doc_t::hex_widget, and refresh_event_handler().
Referenced by heraia_ui_connect_signals().
void on_preferences_activate | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Preferences, file menu : Displays the preference window (as a modal window).
widget | : the widget that issued the signal | |
data | : user data MUST be heraia_struct_t *main_struct main structure |
Definition at line 83 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().
void on_quit_activate | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Quit, file menu.
widget | : the widget that issued the signal | |
data | : user data MUST be heraia_struct_t *main_struct main structure |
Definition at line 48 of file heraia_ui.c.
References close_heraia().
Referenced by delete_main_struct_event(), and heraia_ui_connect_signals().
void on_redo_activate | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Redo, edit menu.
widget | : the widget that issued the signal | |
data | : user data MUST be heraia_struct_t *main_struct main structure |
Definition at line 371 of file heraia_ui.c.
References heraia_struct_t::current_doc, heraia_get_widget(), doc_t::hex_doc, xml_t::main, doc_t::modified, set_notebook_tab_label_color(), and heraia_struct_t::xmls.
Referenced by heraia_ui_connect_signals().
void on_save_activate | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Here we attemp to save the edited file.
widget | : the widget that issued the signal | |
data | : user data MUST be heraia_struct_t *main_struct main structure |
Definition at line 827 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().
void on_save_as_activate | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
This handle the save_as menu entry (here the filename changes).
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 857 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_window_name().
Referenced by heraia_ui_connect_signals().
void on_tests_menu_activate | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Called when tests submenu is activated.
widget | : the widget that issued the signal | |
data | : user data MUST be heraia_struct_t *main_struct main structure |
Definition at line 955 of file heraia_ui.c.
References log_message(), and tests_ui().
Referenced by heraia_ui_connect_signals().
void on_undo_activate | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Undo, edit menu.
widget | : the widget that issued the signal | |
data | : user data MUST be heraia_struct_t *main_struct main structure |
Definition at line 332 of file heraia_ui.c.
References heraia_struct_t::current_doc, heraia_get_widget(), doc_t::hex_doc, xml_t::main, doc_t::modified, set_notebook_tab_label_color(), and heraia_struct_t::xmls.
Referenced by heraia_ui_connect_signals().
void record_all_dialog_box_positions | ( | heraia_struct_t * | main_struct | ) |
Records all the positions of the displayed windows.
[in,out] | main_struct | : main structure |
Definition at line 204 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().
static void record_and_hide_about_box | ( | heraia_struct_t * | main_struct | ) | [static] |
Record position and hide about dialog box.
[in,out] | main_struct | : main structure |
Definition at line 269 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().
void record_and_hide_dialog_box | ( | GtkWidget * | dialog_box, | |
window_prop_t * | dialog_prop | |||
) |
Record position and hide a dialog box.
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 251 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().
void record_dialog_box_position | ( | GtkWidget * | dialog_box, | |
window_prop_t * | dialog_prop | |||
) |
Records one dialog position.
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 177 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().
void refresh_event_handler | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
This function is here to ensure that everything will be refreshed upon a signal event.
widget | : the widget that issued the signal | |
data | : user data MUST be heraia_struct_t *main_struct main structure |
Definition at line 572 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(), on_close_activate(), on_cut_activate(), on_delete_activate(), on_open_activate(), and on_paste_activate().
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.
main_struct | : main structure |
Definition at line 484 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().
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.
main_struct | : main structure |
< A parent window (we use main_struct)
Definition at line 1190 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().
GSList* select_file_to_load | ( | heraia_struct_t * | main_struct | ) |
This function does open a file selector dialog box and returns the selected filename.
main_struct | : main structure |
< 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 1132 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().
static void set_a_propos_properties | ( | GtkWidget * | about_dialog | ) | [static] |
Sets name and version in the dialog box.
about_dialog | the widget that contain all the about box |
Definition at line 103 of file heraia_ui.c.
References PACKAGE_NAME, and PACKAGE_VERSION.
Referenced by a_propos_activate(), and init_window_states().
void set_notebook_tab_label_color | ( | heraia_struct_t * | main_struct, | |
gboolean | color | |||
) |
Set the style for the label.
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 |
< file notebook in main window
< Current page for the file notebook
< tab's label
< menu tab's label
< container that has the label and the button
< index of the current tab displayed
< markup text
< label's text
Definition at line 1353 of file heraia_ui.c.
References heraia_struct_t::current_doc, find_label_from_hbox(), heraia_get_widget(), log_message(), xml_t::main, and heraia_struct_t::xmls.
Referenced by on_redo_activate(), on_save_activate(), on_undo_activate(), and refresh_file_labels().
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)
main_struct | : main structure |
< file notebook in main window
< Current page for the file notebook
< container that has the label and the button
< tab's label
< corresponding tab's document
< index of the current tab displayed
< markup text
Definition at line 1309 of file heraia_ui.c.
References heraia_struct_t::current_doc, doc_t_document_get_filename(), heraia_struct_t::documents, find_label_from_hbox(), heraia_get_widget(), xml_t::main, and heraia_struct_t::xmls.
Referenced by on_save_as_activate().
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)
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 1112 of file heraia_ui.c.
References make_absolute_path().
Referenced by select_a_file_to_save(), and select_file_to_load().
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.
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 2167 of file heraia_ui.c.
References move_and_show_dialog_box(), and record_and_hide_dialog_box().
Referenced by run(), and statw_close_clicked().
static gboolean unsaved_documents | ( | heraia_struct_t * | main_struct | ) | [static] |
Verify if we can safely close everything.
main_struct | : main structure |
Definition at line 1911 of file heraia_ui.c.
References heraia_struct_t::documents, and doc_t::modified.
Referenced by close_heraia().
void update_main_window_name | ( | heraia_struct_t * | main_struct | ) |
Update main window heraia's name to reflect the current edited file.
main_struct | : main structure |
Definition at line 1238 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(), on_close_activate(), and on_save_as_activate().