74 GtkWidget *window = NULL;
76 if (main_struct != NULL && main_struct->
current_doc != NULL)
118 GtkWidget *window = NULL;
120 if (main_struct != NULL)
139 if (main_struct != NULL && main_struct->
find_doc != NULL)
155 guchar *buffer = NULL;
156 doc_t *current_doc = NULL;
157 gboolean result = FALSE;
158 guint64 position = 0;
159 guint buffer_size = 0;
161 if (main_struct != NULL)
189 guchar *buffer = NULL;
190 doc_t *current_doc = NULL;
191 gboolean result = FALSE;
192 guint64 position = 0;
193 guint buffer_size = 0;
194 GArray *all_pos = NULL;
196 if (main_struct != NULL)
202 all_pos = g_array_new(TRUE, TRUE,
sizeof(guint64));
207 while (result == TRUE)
209 all_pos = g_array_append_val(all_pos, position);
218 g_array_free(all_pos, TRUE);
261 if (main_struct != NULL && main_struct->
xmls != NULL && main_struct->
xmls->
main != NULL)
290 guchar *buffer = NULL;
291 guint endianness = 0;
292 gboolean result = FALSE;
297 if (size > 0 && size < 4096)
299 buffer = (guchar *) g_malloc0(
sizeof(guchar) * size);
331 GtkWidget *find_hex_widget = NULL;
333 find_hex_doc = hex_document_new();
335 if (find_hex_doc != NULL)
338 find_hex_widget = hex_document_add_view(find_hex_doc);
341 gtk_hex_show_offsets(GTK_HEX(find_hex_widget), FALSE);
342 gtk_hex_set_insert_mode(GTK_HEX(find_hex_widget), TRUE);
343 gtk_hex_set_geometry(GTK_HEX(find_hex_widget), 16, 4);
346 return new_doc_t(find_hex_doc, find_hex_widget);
364 GtkWidget *al = NULL;
367 gtk_container_add(GTK_CONTAINER(al), entry->
hex_widget);
368 gtk_container_set_border_width(GTK_CONTAINER(al), 3);
381 guchar *buffer = NULL;
382 doc_t *current_doc = NULL;
383 gboolean result = FALSE;
384 guint64 position = 0;
385 guint buffer_size = 0;
393 position = position + offset;
417 GtkWidget *window = NULL;
419 if (main_struct != NULL && main_struct->
current_doc != NULL)
461 GtkWidget *window = NULL;
463 if (main_struct != NULL)
512 if (main_struct != NULL && main_struct->
fr_find_doc != NULL)
531 if (main_struct != NULL && main_struct->
fr_find_doc != NULL)
550 guchar *buffer = NULL;
551 guchar *rep_buffer = NULL;
552 doc_t *current_doc = NULL;
553 guint buffer_size = 0;
554 guint rep_buf_size = 0;
555 guint64 position = 0;
567 ghex_set_data(current_doc, position, buffer_size, rep_buf_size, rep_buffer);
568 length = (goffset) rep_buf_size - buffer_size;
603 if (main_struct != NULL && main_struct->
xmls != NULL && main_struct->
xmls->
main != NULL)
633 GtkWidget *cb = NULL;
634 GtkWidget *label = NULL;
637 const gchar *text = NULL;
639 if (main_struct != NULL)
647 text = gtk_label_get_text(GTK_LABEL(label));
649 #if GTK_MAJOR_VERSION == 2
650 #if GTK_MINOR_VERSION >= 24
651 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(cb), text);
653 #if GTK_MINOR_VERSION <= 23
654 gtk_combo_box_append_text(GTK_COMBO_BOX(cb), text);
657 #if GTK_MAJOR_VERSION > 2
658 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(cb), text);
673 GtkWidget *window = NULL;
675 if (main_struct != NULL && main_struct->
current_doc != NULL)
717 GtkWidget *window = NULL;
719 if (main_struct != NULL)
744 if (cat_index >= 0 && typ_index >= 0 && fea_index >= 0)
746 tab = g_ptr_array_index(main_struct->
current_DW->
tabs, cat_index);
749 decod = g_ptr_array_index(tab->
rows, typ_index);
753 return g_ptr_array_index(decod->
decode_array, fea_index);
783 doc_t *current_doc = NULL;
784 gboolean result = FALSE;
785 guint64 position = 0;
786 guint endianness = 0;
787 guint stream_size = 0;
788 GArray *all_pos = NULL;
804 result =
ghex_find_decode(direction, current_doc, decode_struct->
func, decode_parameters, data_size, buffer, &position);
806 log_message(main_struct, G_LOG_LEVEL_DEBUG,
"endianness : %d ; stream_size : %d - result : %d", endianness, stream_size, result);
815 all_pos = g_array_new(TRUE, TRUE,
sizeof(guint64));
820 log_message(main_struct, G_LOG_LEVEL_DEBUG,
"endianness : %d ; stream_size : %d - result : %d", endianness, stream_size, result);
822 while (result == TRUE)
824 all_pos = g_array_append_val(all_pos, position);
831 g_array_free(all_pos, TRUE);
836 g_free(decode_parameters);
852 GtkWidget *cb = NULL;
854 const gchar *buffer = NULL;
856 GtkWidget *button = NULL;
858 if (main_struct != NULL && main_struct->
current_doc != NULL && main_struct->
current_DW != NULL && main_struct->
fdft != NULL)
861 cat_index = gtk_combo_box_get_active(GTK_COMBO_BOX(cb));
864 typ_index = gtk_combo_box_get_active(GTK_COMBO_BOX(cb));
867 fea_index = gtk_combo_box_get_active(GTK_COMBO_BOX(cb));
869 decode_struct =
get_decode_struct(main_struct, cat_index, typ_index, fea_index, &data_size);
871 buffer = gtk_entry_buffer_get_text(gtk_entry_get_buffer(GTK_ENTRY(
heraia_get_widget(main_struct->
xmls->
main,
"fdft_value_entry"))));
873 log_message(main_struct, G_LOG_LEVEL_DEBUG,
"cat : %d, typ : %d, fea : %d - decode_struct : %p , data_size : %d ; buffer : %s", cat_index, typ_index, fea_index, decode_struct, data_size, buffer);
875 if (decode_struct != NULL && buffer != NULL && data_size > 0)
879 if (widget == button)
886 if (widget == button)
941 GtkWidget *cb = NULL;
944 GtkWidget *label = NULL;
945 const gchar *text = NULL;
946 GtkTreeModel *model = NULL;
948 if (main_struct != NULL && main_struct->
fdft != NULL)
952 index = gtk_combo_box_get_active(GTK_COMBO_BOX(cb));
958 model = gtk_combo_box_get_model(GTK_COMBO_BOX(cb));
959 gtk_list_store_clear(GTK_LIST_STORE(model));
962 for (i = 0; i < tab->
nb_rows; i++)
964 decod = g_ptr_array_index(tab->
rows, i);
965 label = decod->
label;
966 text = gtk_label_get_text(GTK_LABEL(label));
968 #if GTK_MAJOR_VERSION == 2
969 #if GTK_MINOR_VERSION >= 24
970 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(cb), text);
972 #if GTK_MINOR_VERSION <= 23
973 gtk_combo_box_append_text(GTK_COMBO_BOX(cb), text);
976 #if GTK_MAJOR_VERSION > 2
977 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(cb), text);
984 model = gtk_combo_box_get_model(GTK_COMBO_BOX(cb));
985 gtk_list_store_clear(GTK_LIST_STORE(model));
989 for (i = 1; i < tab->
nb_cols; i++)
991 label = g_ptr_array_index(tab->
col_labels, i);
992 text = gtk_label_get_text(GTK_LABEL(label));
994 #if GTK_MAJOR_VERSION == 2
995 #if GTK_MINOR_VERSION >= 24
996 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(cb), text);
998 #if GTK_MINOR_VERSION <= 23
999 gtk_combo_box_append_text(GTK_COMBO_BOX(cb), text);
1002 #if GTK_MAJOR_VERSION > 2
1003 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(cb), text);
1017 GtkWidget *vbox = NULL;
1019 if (main_struct != NULL && main_struct->
fdft == NULL)
1023 #if GTK_MAJOR_VERSION == 2
1024 #if GTK_MINOR_VERSION >= 24
1026 fdft->
type_cb = gtk_combo_box_text_new();
1029 #if GTK_MINOR_VERSION <= 23
1031 fdft->
type_cb = gtk_combo_box_new_text();
1036 #if GTK_MAJOR_VERSION > 2
1038 fdft->
type_cb = gtk_combo_box_text_new();
1042 main_struct->
fdft = fdft;
1045 gtk_box_pack_end(GTK_BOX(vbox), fdft->
category_cb, FALSE, FALSE, 0);
1048 gtk_box_pack_end(GTK_BOX(vbox), fdft->
type_cb, FALSE, FALSE, 0);
1051 gtk_box_pack_end(GTK_BOX(vbox), fdft->
feature_cb, FALSE, FALSE, 0);
1054 g_signal_connect(G_OBJECT(fdft->
category_cb),
"changed",
1073 if (main_struct != NULL && main_struct->
xmls != NULL && main_struct->
xmls->
main != NULL)
window_prop_t * find_window
find window
This is the main structure.
void find_window_init_interface(heraia_struct_t *main_struct)
Inits all the things in the find window (signal and such)
gboolean ghex_find_backward(doc_t *doc, guchar *search_buffer, guint buffer_size, guint64 *position)
Wrapper to the hex_document_find_backward function Tries to find search_buffer in doc...
doc_t * fr_find_doc
find and replace window, find document and hexwidget
#define HERAIA_FIND_ALL
When one wants to do a global search in th whole document.
static void destroy_fr_window_event(GtkWidget *widget, GdkEvent *event, gpointer data)
Call back function for the find and replace window destruction.
GtkWidget * feature_cb
ComboBox Widget for the type of the data in the category.
static void find_all_bt_clicked(GtkWidget *widget, gpointer data)
Tries to find, in the document, what the user entered in the GtkHex entry in the find window (all pos...
static void fdft_window_connect_signal(heraia_struct_t *main_struct)
Signal connections for the find data from type window.
Tabulation structure to be used in the GtkNoteBook of data_interpretor's window.
static void fdft_window_close(GtkWidget *widget, gpointer data)
Close button has been clicked we want to hide the window.
window_prop_t * fr_window
find and replace window
static void find_replace_add_ghex_widget(xml_t *xmls, gchar *widget_name, doc_t *entry)
Adds the GtkHex widget to the right frame.
void log_message(heraia_struct_t *main_struct, GLogLevelFlags log_level, const char *format,...)
A function that helps logging a message a the specified level.
GtkWidget * type_cb
ComboBox Widget for the category of the search.
static void fdft_prev_next_bt_clicked(GtkWidget *widget, gpointer data)
Searches data from the selected type (if any) in the current document (if any) and returns the result...
gint ghex_compare_data(doc_t *doc, guchar *string, guint buffer_size, guint64 position)
Wrapper to the hex_document_compare_data function Compares data from string to the one contained in d...
gboolean ghex_get_data_position(GtkWidget *hex_widget, guint64 pos, guint length, guint endianness, guchar *c)
Gets the data from the hexwidget, a wrapper to the ghex_memcpy function.
static void destroy_find_window_event(GtkWidget *widget, GdkEvent *event, gpointer data)
Call back function for the find window destruction.
static gboolean delete_fdft_window_event(GtkWidget *widget, GdkEvent *event, gpointer data)
Call back function for the find data from type window destruction.
static gboolean delete_fr_window_event(GtkWidget *widget, GdkEvent *event, gpointer data)
Call back function for the find and replace window destruction.
void fdft_window_init_interface(heraia_struct_t *main_struct)
Inits all the things in the find data from type window (signal and such)
static gboolean delete_find_window_event(GtkWidget *widget, GdkEvent *event, gpointer data)
Call back function for the find window destruction.
guint data_size
size of what we may decode
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.
DecodeFunc func
a function to decode into something
guint nb_rows
number of rows in this tab - this is automatically updated
all_window_prop_t * win_prop
Keeps window properties.
guint64 ghex_file_size(Heraia_Hex *gh)
Returns the file size of an opened Heraia_Hex document.
GtkWidget * label
label for this tab
window_prop_t * fdft_window
find data from type window
static void find_next_bt_clicked(GtkWidget *widget, gpointer data)
Tries to find, in the document, what the user entered in the GtkHex entry in the find window (forward...
static guchar * fr_get_search_string(heraia_struct_t *main_struct, doc_t *doc, guint *buffer_size)
Gets the string from the document doc.
fdft_t * fdft
Keeps comboboxes created for the fdft window.
Proposal for a structure that will group all informations about a single document.
static void fdft_search_direction(heraia_struct_t *main_struct, gint direction, decode_t *decode_struct, gint data_size, gchar *buffer)
Searches the string entered in the search document in the current one (from the currenty position + o...
void fdft_window_show(GtkWidget *widget, gpointer data)
Show find data from type window.
void rw_add_one_tab_from_find_all_bt(heraia_struct_t *main_struct, GArray *all_pos, guint size, guchar *text)
Add one tab for the results from the find all button.
xml_t * xmls
All the xmls used in the program, loaded at running time.
static void fr_replace_bt_clicked(GtkWidget *widget, gpointer data)
void fr_window_init_interface(heraia_struct_t *main_struct)
Inits all the things in the find and replace window (signal and such)
guint which_stream_size(heraia_struct_t *main_struct)
returns stream size as selected in the spin button
static void fr_window_connect_signal(heraia_struct_t *main_struct)
Signal connections for the find and replace window.
void find_window_show(GtkWidget *widget, gpointer data)
Show find window.
void ghex_set_data(doc_t *doc, guint64 position, guint rep_len, guint len, guchar *data)
Wrapper to the hex_document_set_data function.
void fr_window_show(GtkWidget *widget, gpointer data)
Show find and replace window.
static void fr_replace_search_bt_clicked(GtkWidget *widget, gpointer data)
Tries to replace, in the document, what the user entered in the GtkHex entry in the fr window in the ...
Basic way to associate a decode function and an entry that will receive the result.
GtkWidget * hex_widget
hexwidget corresponding to the document
static void fr_window_close(GtkWidget *widget, gpointer data)
Close button has been clicked we want to hide the window.
decode_parameters_t * new_decode_parameters_t(guint endianness, guint stream_size)
Make an new decode_parameters_t in order to pass to the functions.
static void fdft_window_populate_category_cb(heraia_struct_t *main_struct)
GtkBuilder * main
the main interface xml description
static doc_t * create_find_or_replace_doc_t(void)
Creates the HexDocument and the GtkHex widget with the right properties and Fills a doc_t structure w...
GPtrArray * decode_array
Pointer Array of decode_t functions and corresponding entries.
gboolean ghex_find_decode(gint direction, doc_t *doc, DecodeFunc decode_it, decode_parameters_t *decode_parameters, guint data_size, gchar *search_buffer, guint64 *position)
Wrappers to the functions that will do the search (here it has nothing to do with ghex in fact)...
guint64 ghex_get_cursor_position(GtkWidget *hex_widget)
Retrieves the cursor's position from the current hexwidget.
static void find_window_close(GtkWidget *widget, gpointer data)
Close button has been clicked we want to hide the window.
data_window_t * current_DW
data_interpretor pointer
HexDocument Heraia_Document
Abstract layer this may be usefull if we decide to leave Heraia_Hex and use something else ! ...
GPtrArray * tabs
an array of tabs displayed in data interpretor's notebook (tab_t)
GPtrArray * col_labels
array of GtkWidgets of columns labels
GtkWidget * label
label for these decoding functions
This file contains all the definitions and includes all other .h files.
Structure that contains all the xml definitions loaded at running time using GtkBuilder.
void ghex_set_cursor_position(GtkWidget *hex_widget, guint64 position)
Sets the cursor at the defined position in the hexwidget.
static void find_prev_bt_clicked(GtkWidget *widget, gpointer data)
Tries to find, in the document, what the user entered in the GtkHex entry in the find window (backwar...
guint nb_tabs
keeps Number of tabs in the GPtrArray
doc_t * current_doc
This is a pointer to the current edited document.
GtkWidget * heraia_get_widget(GtkBuilder *xml, gchar *widget_name)
This is a wrapper to the GtkBuilder xml get widget.
static decode_t * get_decode_struct(heraia_struct_t *main_struct, gint cat_index, gint typ_index, gint fea_index, guint *data_size)
return the decode structure that corresponds to the indexes from category, type and feature as stated...
static void find_window_connect_signal(heraia_struct_t *main_struct)
Signal connections for the find window.
static void fr_search_forward(heraia_struct_t *main_struct, doc_t *search_doc, goffset offset)
Searches the string entered in the search document in the current one (from the currenty position + o...
doc_t * find_doc
find document and hexwidget for find window
static void destroy_fdft_window_event(GtkWidget *widget, GdkEvent *event, gpointer data)
Call back function for the find data from type window destruction.
static void fr_search_bt_clicked(GtkWidget *widget, gpointer data)
Tries to find, in the document, what the user entered in the GtkHex entry in the fr window in the fin...
gboolean ghex_find_forward(doc_t *doc, guchar *search_buffer, guint buffer_size, guint64 *position)
Wrapper to the hex_document_find_forward function Tries to find search_buffer in doc.
Basic way to have as many as we want decoding functions corresponding to one label.
static void fdft_category_cb_changed(GtkWidget *widget, gpointer data)
Fills the type ComboBox with the right values.
#define HERAIA_FIND_FORWARD
When one wants to do a search in the forward direction.
doc_t * new_doc_t(Heraia_Document *hex_doc, GtkWidget *hex_widget)
Inits a doc_t structure.
static goffset fr_replace_data(heraia_struct_t *main_struct)
Tries to replace, in the document, what the user entered in the GtkHex entry in the fr window in the ...
doc_t * fr_replace_doc
find and replace window, replace document and hexwidget
Used to pass decoding options to the functions.
guint which_endianness(heraia_struct_t *main_struct)
Determines which endianness is selected that is to say which radio button is active in the window...
GPtrArray * rows
array of pointers to decode_generic_t variables.
#define HERAIA_FIND_BACKWARD
When one wants to do a search in the backward direction.
static fdft_t * fdft_window_init_widgets(heraia_struct_t *main_struct)
Inits the fdft structure and adds the widgets to the window.
guint nb_cols
number of columns in this tab - this MUST NOT change in any way