Heraia  0.1.8
result_window.c File Reference

Manage results coming from functions such as find, find a data from type, and so on. More...

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

Go to the source code of this file.

Functions

static gboolean delete_result_window_event (GtkWidget *widget, GdkEvent *event, gpointer data)
 Call back function for the result window destruction. More...
 
static void destroy_result_window_event (GtkWidget *widget, GdkEvent *event, gpointer data)
 Call back function for the result window destruction. More...
 
static void result_window_close (GtkWidget *widget, gpointer data)
 Close button has been clicked we want to hide the window. More...
 
static void result_window_connect_signal (heraia_struct_t *main_struct)
 Signal connections for the result window. More...
 
static void tree_selection_changed (GtkTreeSelection *selection, gpointer data)
 Function called upon selection change. More...
 
static void rw_on_close_activate (GtkWidget *widget, gpointer data)
 Closes a result tab. More...
 
static void determine_pos_and_buffer_size (guint64 *pos, guint *buffer_size, guint size, guint64 file_size)
 Calculates the position and the associated buffer size in order that the text searched for will be centered in the results. More...
 
static void add_gtk_tree_view_to_result_notebook (heraia_struct_t *main_struct, GtkListStore *lstore, guchar *label_text, doc_t *doc)
 Add one tab to the result window's notebook with a gtk_tree_view in it. More...
 
static void menu_result_toggle (GtkWidget *widget, gpointer data)
 The Check menu item for the result window. More...
 
void result_window_show (GtkWidget *widget, gpointer data)
 Show result window. More...
 
void result_window_init_interface (heraia_struct_t *main_struct)
 Inits all the things in the result window (signal and such) More...
 
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. More...
 
static void rw_on_notebook_switch_page (GtkNotebook *notebook, GtkWidget *page, guint page_num, gpointer data)
 Function called when the user switches the pages from the notebook. More...
 
void rw_remove_all_tabs (heraia_struct_t *main_struct, doc_t *doc)
 Remove all tabs from the result window that correspond to the specified document. More...
 

Detailed Description

Manage results coming from functions such as find, find a data from type, and so on.

Definition in file result_window.c.

Function Documentation

static void add_gtk_tree_view_to_result_notebook ( heraia_struct_t main_struct,
GtkListStore *  lstore,
guchar *  label_text,
doc_t doc 
)
static

Add one tab to the result window's notebook with a gtk_tree_view in it.

Parameters
main_struct: main structure of heraia
lstore: the populated list store (for the tree view)
label_text: the text for the label of the tab
doc: the document from which the search was done

< used for vbox creation

< the scrolled window

< result_notebook from heraia.gtkbuilder

< the tree view

< tab's label

< the hbox that will receive the close button

< a rennderer for the cells

< columns to be added to the treeview

< selection to the treeview

< new tab's index

< markup text

< menu markup text (menu in the notebook)

<menu's label (notebook's menu)

< filename of the document from where the search took place

Definition at line 243 of file result_window.c.

References create_tab_close_button(), doc_t_document_get_filename(), heraia_get_widget(), xml_t::main, R_LS_ASCII, R_LS_HEX, R_LS_N, R_LS_POS, rw_on_close_activate(), tree_selection_changed(), and heraia_struct_t::xmls.

Referenced by rw_add_one_tab_from_find_all_bt().

Here is the call graph for this function:

Here is the caller graph for this function:

static gboolean delete_result_window_event ( GtkWidget *  widget,
GdkEvent *  event,
gpointer  data 
)
static

Call back function for the result window destruction.

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

Definition at line 85 of file result_window.c.

References result_window_close().

Referenced by result_window_connect_signal().

Here is the call graph for this function:

Here is the caller graph for this function:

static void destroy_result_window_event ( GtkWidget *  widget,
GdkEvent *  event,
gpointer  data 
)
static

Call back function for the result window destruction.

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

Definition at line 99 of file result_window.c.

References result_window_close().

Referenced by result_window_connect_signal().

Here is the call graph for this function:

Here is the caller graph for this function:

static void determine_pos_and_buffer_size ( guint64 *  pos,
guint *  buffer_size,
guint  size,
guint64  file_size 
)
static

Calculates the position and the associated buffer size in order that the text searched for will be centered in the results.

Parameters
pos: Must be the position of the searched text, is returned as the position where we will extract the text
buffer_size: is returned as the total buffer size (the extracted text will be buffer_size + 1 in size)
size: size of the string searched for (in bytes)
file_size: size of the file (to verify that we are still in the limits

Definition at line 172 of file result_window.c.

Referenced by rw_add_one_tab_from_find_all_bt().

Here is the caller graph for this function:

static void menu_result_toggle ( GtkWidget *  widget,
gpointer  data 
)
static

The Check menu item for the result window.

Parameters
widget: the widget that issued the signal (here the menu_result check menu item
data: user data, MUST be main_struct main structure

Definition at line 423 of file result_window.c.

References result_window_close(), and result_window_show().

Referenced by result_window_connect_signal().

Here is the call graph for this function:

Here is the caller graph for this function:

static void result_window_close ( GtkWidget *  widget,
gpointer  data 
)
static

Close button has been clicked we want to hide the window.

Parameters
widget: calling widget
data: MUST be heraia_struct_t *main_struct main structure and not NULL

< result window itself

Definition at line 110 of file result_window.c.

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

Referenced by delete_result_window_event(), destroy_result_window_event(), menu_result_toggle(), and result_window_connect_signal().

Here is the call graph for this function:

Here is the caller graph for this function:

static void result_window_connect_signal ( heraia_struct_t main_struct)
static

Signal connections for the result window.

Parameters
main_struct: heraia's main structure

Definition at line 495 of file result_window.c.

References delete_result_window_event(), destroy_result_window_event(), heraia_get_widget(), xml_t::main, menu_result_toggle(), result_window_close(), rw_on_notebook_switch_page(), and heraia_struct_t::xmls.

Referenced by result_window_init_interface().

Here is the call graph for this function:

Here is the caller graph for this function:

void result_window_init_interface ( heraia_struct_t main_struct)

Inits all the things in the result window (signal and such)

Parameters
main_struct: heraia's main structure

Definition at line 70 of file result_window.c.

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

Referenced by load_heraia_ui().

Here is the call graph for this function:

Here is the caller graph for this function:

void result_window_show ( GtkWidget *  widget,
gpointer  data 
)

Show result window.

Parameters
widget: the widget that issued the signal (may be NULL as we do not use it).
data: user data MUST be heraia_struct_t *main_struct main structure

< result window itself

Definition at line 52 of file result_window.c.

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

Referenced by menu_result_toggle(), and rw_add_one_tab_from_find_all_bt().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
main_struct: main structure of heraia
all_pos: A GArray of all found positions
size: size of the string searched for (in bytes)
text: the text for the label of the newly created tab. If NULL, a text is guessed from the last found position and the text found

< List store that will contain results

< a calculated position to center the search string

< real position

< size of the file during the search (should not change)

< Current document on which we want to do the search

< endianness as selected in the data interpretor window

< buffer size (bigger than size in order to display

some byte before and after the results)

< the ascii buffer

< the hex buffer

< text label

 Endianness by default (we want the search to be flat) -> However this may

be modified if someone asks for

Definition at line 352 of file result_window.c.

References add_gtk_tree_view_to_result_notebook(), heraia_struct_t::current_doc, determine_pos_and_buffer_size(), ghex_file_size(), ghex_get_data_to_ascii(), ghex_get_data_to_hex(), H_DI_LITTLE_ENDIAN, doc_t::hex_widget, log_message(), R_LS_ASCII, R_LS_HEX, R_LS_N, R_LS_N_COLUMNS, R_LS_POS, result_window_show(), and heraia_struct_t::results.

Referenced by fdft_search_direction(), and find_all_bt_clicked().

Here is the call graph for this function:

Here is the caller graph for this function:

static void rw_on_close_activate ( GtkWidget *  widget,
gpointer  data 
)
static

Closes a result tab.

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

< result_notebook from heraia.gtkbuilder

< index of the tab (and thus from the array)

Definition at line 219 of file result_window.c.

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

Referenced by add_gtk_tree_view_to_result_notebook().

Here is the call graph for this function:

Here is the caller graph for this function:

static void rw_on_notebook_switch_page ( GtkNotebook *  notebook,
GtkWidget *  page,
guint  page_num,
gpointer  data 
)
static

Function called when the user switches the pages from the notebook.

Here we unselect the selection if any. This is to let the user be able to select again the first row if there is only one row in the treeview.

Parameters
notebook result window's notebook object which received the signal.
page the new current page
page_num the index of the page (the new one)
data :userdata, MUST be main_struct main structure

The list of the widgets in the page

The selection (if any) to be unselected

Definition at line 448 of file result_window.c.

References log_message().

Referenced by result_window_connect_signal().

Here is the call graph for this function:

Here is the caller graph for this function:

void rw_remove_all_tabs ( heraia_struct_t main_struct,
doc_t doc 
)

Remove all tabs from the result window that correspond to the specified document.

Parameters
main_struct: heraia's main structure
doc: the document beeing close in main window's notebook

< total len of result array

< result_notebook from heraia.gtkbuilder

< Value to compare with doc

Definition at line 524 of file result_window.c.

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

Referenced by close_one_document().

Here is the call graph for this function:

Here is the caller graph for this function:

static void tree_selection_changed ( GtkTreeSelection *  selection,
gpointer  data 
)
static

Function called upon selection change.

Changes the cursor position to the right place (should also change to the right document).

Parameters
selection: the selection that changed
data: user data MUST be main program's structure

Definition at line 130 of file result_window.c.

References ghex_set_cursor_position(), heraia_get_widget(), doc_t::hex_widget, log_message(), xml_t::main, R_LS_POS, heraia_struct_t::results, and heraia_struct_t::xmls.

Referenced by add_gtk_tree_view_to_result_notebook().

Here is the call graph for this function:

Here is the caller graph for this function: