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 void | close_one_document (heraia_struct_t *main_struct, doc_t *closing_doc, gint index) |
Closes one document in heraia. | |
static gboolean | close_a_project (heraia_struct_t *main_struct, gchar *question) |
Closes all documents and saves preferences if the users wants to close the documents. | |
static gboolean | close_heraia (heraia_struct_t *main_struct) |
Before closing heraia we need to do few things. | |
static void | on_projects_close_activate (GtkWidget *widget, gpointer data) |
Closes an entire project. | |
static void | on_projects_open_activate (GtkWidget *widget, gpointer data) |
Opens a project from a file : closes all documents an imports new ones . | |
static void | on_projects_save_as_activate (GtkWidget *widget, gpointer data) |
Saves a project in a new file (does not close the project itself). | |
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 | on_find_activate (GtkWidget *widget, gpointer data) |
Find, Search menu. | |
void | on_fr_activate (GtkWidget *widget, gpointer data) |
Find and replace, Search menu. | |
void | on_fdft_activate (GtkWidget *widget, gpointer data) |
Find data from type, Search 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, gchar *notebook_name, GtkWidget *to_find) |
Searches in a 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 opened 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_window_event (GtkWidget *widget, GdkEvent *event, gpointer data) |
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, gboolean multiple, gchar *message) |
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. | |
GtkWidget * | find_label_from_hbox (GtkWidget *hbox) |
Tries to find the label contained in the hbox. | |
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. | |
GtkWidget * | create_tab_close_button (heraia_struct_t *main_struct, GtkWidget *tab_label, void *signal_handler) |
Creates an hbox containning a cross button (in order to close the tab) and a label (from tab_label). | |
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 172 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 364 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 380 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 351 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 2523 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, on_close_activate(), and heraia_struct_t::xmls.
Referenced by load_file_to_analyse(), and on_new_activate().
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 2015 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_a_project | ( | heraia_struct_t * | main_struct, | |
gchar * | question | |||
) | [static] |
Closes all documents and saves preferences if the users wants to close the documents.
main_struct | : main_struct | |
question | a const gchar * string to be displayed when an unsaved document is found. This should ask the user what to do. |
< 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
< The document to be closed
Definition at line 2241 of file heraia_ui.c.
References close_one_document(), heraia_struct_t::current_doc, heraia_struct_t::documents, free_preference_struct(), grey_main_widgets(), heraia_get_widget(), xml_t::main, heraia_struct_t::prefs, record_all_dialog_box_positions(), refresh_event_handler(), save_preferences(), unsaved_documents(), update_main_window_name(), and heraia_struct_t::xmls.
Referenced by close_heraia(), and on_projects_close_activate().
static gboolean close_heraia | ( | heraia_struct_t * | main_struct | ) | [static] |
Before closing heraia we need to do few things.
main_struct | : main_struct |
Definition at line 2313 of file heraia_ui.c.
References close_a_project().
Referenced by on_quit_activate().
static void close_one_document | ( | heraia_struct_t * | main_struct, | |
doc_t * | closing_doc, | |||
gint | index | |||
) | [static] |
Closes one document in heraia.
Does not do any updates of the interface.
main_struct | : main structure | |
closing_doc | : the doc_t * document to be closed | |
index | : the index in the array of documents of the closing_doc document |
< Notenook on the main window
Definition at line 886 of file heraia_ui.c.
References close_doc_t(), heraia_struct_t::documents, heraia_get_widget(), xml_t::main, rw_remove_all_tabs(), and heraia_struct_t::xmls.
Referenced by close_a_project(), and on_close_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 1721 of file heraia_ui.c.
References refresh_event_handler().
Referenced by heraia_hex_document_new(), and on_new_activate().
GtkWidget* create_tab_close_button | ( | heraia_struct_t * | main_struct, | |
GtkWidget * | tab_label, | |||
void * | signal_handler | |||
) |
Creates an hbox containning a cross button (in order to close the tab) and a label (from tab_label).
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 | |
signal_handler | : the signal to connect to when the close button is clicked. |
< used for hbox creation in the tabs
< Closing button
Definition at line 2495 of file heraia_ui.c.
Referenced by add_gtk_tree_view_to_result_notebook(), and 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 1200 of file heraia_ui.c.
References heraia_get_widget(), xml_t::main, and heraia_struct_t::xmls.
Referenced by connect_data_interpretor_signals().
gboolean delete_main_window_event | ( | GtkWidget * | widget, | |
GdkEvent * | event, | |||
gpointer | data | |||
) |
Definition at line 1183 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 2197 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 1217 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 1233 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().
GtkWidget* find_label_from_hbox | ( | GtkWidget * | hbox | ) |
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 1463 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, | |
gchar * | notebook_name, | |||
GtkWidget * | to_find | |||
) |
Searches in a notebook's tabs for a particular widget and returns the number of the corresponding tab if it exists, -1 otherwise.
main_struct | : main structure | |
notebbok_name | : the name of the notebook in the 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 744 of file heraia_ui.c.
References heraia_get_widget(), xml_t::main, and heraia_struct_t::xmls.
Referenced by on_close_activate(), and rw_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 1601 of file heraia_ui.c.
References heraia_get_widget().
Referenced by close_a_project(), init_heraia_interface(), load_file_to_analyse(), on_close_activate(), and on_new_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 2060 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 2088 of file heraia_ui.c.
References gtk_radio_button_get_active().
Referenced by di_get_endianness(), and goto_dialog_ok().
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 2105 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 2174 of file heraia_ui.c.
Referenced by a_propos_activate(), add_default_tabs(), add_entry_to_plugins_menu(), add_gtk_tree_view_to_result_notebook(), add_new_tab_in_main_window(), close_a_project(), close_one_document(), 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(), fdft_prev_next_bt_clicked(), fdft_window_close(), fdft_window_connect_signal(), fdft_window_init_widgets(), fdft_window_show(), find_replace_add_ghex_widget(), find_tab_number_from_widget(), find_window_close(), find_window_connect_signal(), find_window_show(), fr_window_close(), fr_window_connect_signal(), fr_window_show(), goto_dialog_canceled(), goto_dialog_connect_signal(), goto_dialog_ok(), 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_mp_files_filenames(), load_mpwp_preferences(), log_window_connect_signals(), log_window_init_interface(), logw_close_clicked(), main_pref_window_connect_signals(), mw_cmi_plw_toggle(), mw_cmi_show_logw_toggle(), my_log(), on_close_activate(), on_DIMenu_activate(), on_goto_activate(), on_mp_tb_display_bt_toggled(), on_mp_tb_fp_bt_toggled(), on_preferences_activate(), on_projects_open_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(), result_window_close(), result_window_connect_signal(), result_window_show(), run(), rw_on_close_activate(), rw_remove_all_tabs(), save_mp_files_filenames(), save_mpwp_preferences(), scroll_down_textview(), select_a_file_to_save(), select_file_to_load(), set_notebook_tab_label_color(), set_notebook_tab_name(), set_statw_button_state(), 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(), tree_selection_changed(), 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 1732 of file heraia_ui.c.
References a_propos_activate(), a_propos_close(), a_propos_delete(), a_propos_response(), delete_main_window_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_fdft_activate(), on_find_activate(), on_fr_activate(), on_goto_activate(), on_new_activate(), on_open_activate(), on_paste_activate(), on_preferences_activate(), on_projects_close_activate(), on_projects_open_activate(), on_projects_save_as_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 1650 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 2326 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 2349 of file heraia_ui.c.
References all_window_prop_t::about_box, heraia_struct_t::current_doc, all_window_prop_t::data_interpretor, window_prop_t::displayed, all_window_prop_t::fdft_window, all_window_prop_t::find_window, all_window_prop_t::fr_window, all_window_prop_t::goto_window, window_prop_t::height, heraia_get_widget(), init_one_cmi_window_state(), all_window_prop_t::log_box, xml_t::main, all_window_prop_t::main_dialog, all_window_prop_t::main_pref_window, on_DIMenu_activate(), all_window_prop_t::plugin_list, all_window_prop_t::result_window, 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(), and on_projects_open_activate().
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 2136 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 2151 of file heraia_ui.c.
References heraia_get_widget().
Referenced by heraia_hex_document_new(), on_new_activate(), 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 2039 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 1869 of file heraia_ui.c.
References data_interpretor_init_interface(), heraia_struct_t::debug, fdft_window_init_interface(), find_window_init_interface(), fr_window_init_interface(), goto_dialog_init_interface(), heraia_ui_connect_signals(), load_heraia_xml(), load_preferences(), log_window_init_interface(), main_pref_window_init_interface(), heraia_struct_t::prefs, and result_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 1685 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 1271 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 193 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(), mw_cmi_show_logw_toggle(), on_DIMenu_activate(), on_preferences_activate(), result_window_show(), and show_hide_widget().
void on_close_activate | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Closes an opened 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 913 of file heraia_ui.c.
References close_one_document(), 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 add_new_tab_in_main_window(), 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 503 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 486 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 469 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 1106 of file heraia_ui.c.
References heraia_struct_t::current_DW, all_window_prop_t::data_interpretor, 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(), and init_window_states().
void on_fdft_activate | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Find data from type, Search menu.
widget | : the widget that issued the signal | |
data | : user data MUST be heraia_struct_t *main_struct main structure |
Definition at line 568 of file heraia_ui.c.
References heraia_struct_t::current_doc, and fdft_window_show().
Referenced by heraia_ui_connect_signals().
void on_find_activate | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Find, Search menu.
widget | : the widget that issued the signal | |
data | : user data MUST be heraia_struct_t *main_struct main structure |
Definition at line 536 of file heraia_ui.c.
References heraia_struct_t::current_doc, and find_window_show().
Referenced by heraia_ui_connect_signals().
void on_fr_activate | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Find and replace, Search menu.
widget | : the widget that issued the signal | |
data | : user data MUST be heraia_struct_t *main_struct main structure |
Definition at line 552 of file heraia_ui.c.
References heraia_struct_t::current_doc, and fr_window_show().
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 77 of file heraia_ui.c.
References add_new_tab_in_main_window(), connect_cursor_moved_signal(), heraia_struct_t::current_doc, heraia_struct_t::documents, heraia_struct_t::event, grey_main_widgets(), HERAIA_REFRESH_NEW_FILE, doc_t::hex_widget, is_toggle_button_activated(), log_message(), xml_t::main, new_doc_t(), refresh_event_handler(), set_notebook_tab_label_color(), update_main_window_name(), and heraia_struct_t::xmls.
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 704 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 519 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 135 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().
static void on_projects_close_activate | ( | GtkWidget * | widget, | |
gpointer | data | |||
) | [static] |
Closes an entire project.
widget | : the widget that issued the signal | |
data | : user data MUST be heraia_struct_t *main_struct main structure |
Definition at line 808 of file heraia_ui.c.
References close_a_project().
Referenced by heraia_ui_connect_signals(), and on_projects_open_activate().
static void on_projects_open_activate | ( | GtkWidget * | widget, | |
gpointer | data | |||
) | [static] |
Opens a project from a file : closes all documents an imports new ones .
..
widget | : the widget that issued the signal | |
data | : user data MUST be heraia_struct_t *main_struct main structure |
Definition at line 848 of file heraia_ui.c.
References heraia_get_widget(), init_preference_struct(), init_window_states(), load_preferences(), log_message(), xml_t::main, on_projects_close_activate(), heraia_struct_t::prefs, select_file_to_load(), and heraia_struct_t::xmls.
Referenced by heraia_ui_connect_signals().
static void on_projects_save_as_activate | ( | GtkWidget * | widget, | |
gpointer | data | |||
) | [static] |
Saves a project in a new file (does not close the project itself).
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 824 of file heraia_ui.c.
References free_preference_struct(), init_preference_struct(), heraia_struct_t::prefs, save_preferences(), and select_a_file_to_save().
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 57 of file heraia_ui.c.
References close_heraia().
Referenced by delete_main_window_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 433 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 1027 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 1057 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 1155 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 394 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 250 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, all_window_prop_t::find_window, all_window_prop_t::fr_window, all_window_prop_t::goto_window, 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(), all_window_prop_t::result_window, heraia_struct_t::win_prop, and heraia_struct_t::xmls.
Referenced by close_a_project().
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 331 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 313 of file heraia_ui.c.
References window_prop_t::displayed, and record_dialog_box_position().
Referenced by logw_close_clicked(), mw_cmi_plw_toggle(), mw_cmi_show_logw_toggle(), on_DIMenu_activate(), plw_close_clicked(), pref_window_delete(), record_and_hide_about_box(), result_window_close(), 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 223 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 675 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 close_a_project(), connect_cursor_moved_signal(), file_notebook_tab_changed(), on_close_activate(), on_cut_activate(), on_delete_activate(), on_new_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 587 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 1386 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_projects_save_as_activate(), and on_save_as_activate().
GSList* select_file_to_load | ( | heraia_struct_t * | main_struct, | |
gboolean | multiple, | |||
gchar * | message | |||
) |
This function does open a file selector dialog box and returns the selected filename.
main_struct | : main structure | |
multiple | : to say wether we want multiple selection be possible or not | |
message | : the message to print in the title's dialog box |
< A parent window (we use main_struct)
< list of selected (if any) filenames to be openned
We want the file selection path to be the one of the current opened file if any !
Definition at line 1333 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(), and on_projects_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 155 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 1550 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_new_activate(), 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 1506 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 1311 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 2574 of file heraia_ui.c.
References move_and_show_dialog_box(), and record_and_hide_dialog_box().
Referenced by fdft_window_close(), fdft_window_show(), find_window_close(), find_window_show(), fr_window_close(), fr_window_show(), goto_dialog_canceled(), on_goto_activate(), 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 2212 of file heraia_ui.c.
References heraia_struct_t::documents, and doc_t::modified.
Referenced by close_a_project().
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 1434 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 close_a_project(), file_notebook_tab_changed(), load_file_to_analyse(), on_close_activate(), on_new_activate(), and on_save_as_activate().