find_replace_window.c

Go to the documentation of this file.
00001 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
00002 /*
00003   find_replace_window.c
00004   find_replace_window.c - Windows used to find text and find and replace text in
00005                           the opened hex documents.
00006 
00007 
00008   (C) Copyright 2010 Olivier Delhomme
00009   e-mail : heraia@delhomme.org
00010   URL    : http://heraia.tuxfamily.org
00011 
00012   This program is free software; you can redistribute it and/or modify
00013   it under the terms of the GNU General Public License as published by
00014   the Free Software Foundation; either version 2, or  (at your option)
00015   any later version.
00016 
00017   This program is distributed in the hope that it will be useful,
00018   but WITHOUT ANY WARRANTY;  without even the implied warranty of
00019   MERCHANTABILITY  or  FITNESS FOR A PARTICULAR PURPOSE.  See the
00020   GNU General Public License for more details.
00021 
00022   You should have received a copy of the GNU General Public License
00023   along with this program; if not, write to the Free Software
00024   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00025 */
00026 /**
00027  * @file find_replace_window.c
00028  * Windows used to find text and find and replace text in the opened hex
00029  * documents.
00030  */
00031 #include <libheraia.h>
00032 
00033 /*** common stuff ***/
00034 static guchar *fr_get_search_string(heraia_struct_t * main_struct, doc_t *doc, guint *buffer_size);
00035 static doc_t *create_find_or_replace_doc_t(void);
00036 static void find_replace_add_ghex_widget(xml_t *xmls, gchar *widget_name, doc_t *entry);
00037 static void fr_search_forward(heraia_struct_t *main_struct, doc_t *search_doc, goffset offset);
00038 
00039 /*** find window ***/
00040 static gboolean delete_find_window_event(GtkWidget *widget, GdkEvent  *event, gpointer data);
00041 static void destroy_find_window_event(GtkWidget *widget, GdkEvent  *event, gpointer data);
00042 static void find_window_close(GtkWidget *widget, gpointer data);
00043 static void find_window_connect_signal(heraia_struct_t *main_struct);
00044 static void find_all_bt_clicked(GtkWidget *widget, gpointer data);
00045 static void find_next_bt_clicked(GtkWidget *widget, gpointer data);
00046 static void find_prev_bt_clicked(GtkWidget *widget, gpointer data);
00047 
00048 /*** find and replace window ***/
00049 static gboolean delete_fr_window_event(GtkWidget *widget, GdkEvent  *event, gpointer data);
00050 static void destroy_fr_window_event(GtkWidget *widget, GdkEvent  *event, gpointer data);
00051 static void fr_window_close(GtkWidget *widget, gpointer data);
00052 static void fr_window_connect_signal(heraia_struct_t *main_struct);
00053 static void fr_search_bt_clicked(GtkWidget *widget, gpointer data);
00054 static void fr_replace_bt_clicked(GtkWidget *widget, gpointer data);
00055 static void fr_replace_search_bt_clicked(GtkWidget *widget, gpointer data);
00056 static goffset fr_replace_data(heraia_struct_t *main_struct);
00057 
00058 
00059 /**
00060  * Show find window
00061  * @param widget : the widget that issued the signal
00062  * @param data : user data MUST be heraia_struct_t *main_struct main structure
00063  */
00064 void find_window_show(GtkWidget *widget, gpointer data)
00065 {
00066     heraia_struct_t *main_struct = (heraia_struct_t *) data;
00067     GtkWidget *window = NULL;      /**< find window */
00068 
00069     if (main_struct != NULL && main_struct->current_doc != NULL)
00070         {
00071             window = heraia_get_widget(main_struct->xmls->main, "find_window");
00072             show_hide_widget(window, TRUE, main_struct->win_prop->find_window);
00073         }
00074 }
00075 
00076 
00077 /**
00078  * Call back function for the find window destruction
00079  * @param widget : calling widget (may be NULL as we don't use this here)
00080  * @param event : event associated (may be NULL as we don't use this here)
00081  * @param data :  MUST be heraia_struct_t *main_struct main structure
00082  */
00083 static gboolean delete_find_window_event(GtkWidget *widget, GdkEvent  *event, gpointer data)
00084 {
00085     find_window_close(widget, data);
00086 
00087     return TRUE;
00088 }
00089 
00090 
00091 /**
00092  * Call back function for the find window destruction
00093  * @param widget : calling widget (may be NULL as we don't use this here)
00094  * @param event : event associated (may be NULL as we don't use this here)
00095  * @param data : user data - MUST be heraia_struct_t *main_struct main structure and not NULL
00096  */
00097 static void destroy_find_window_event(GtkWidget *widget, GdkEvent  *event, gpointer data)
00098 {
00099     find_window_close(widget, data);
00100 }
00101 
00102 
00103 /**
00104  * Close button has been clicked we want to hide the window
00105  * @param widget : calling widget (may be NULL as we don't use this here)
00106  * @param data : MUST be heraia_struct_t *main_struct main structure and not NULL
00107  */
00108 static void find_window_close(GtkWidget *widget, gpointer data)
00109 {
00110     heraia_struct_t *main_struct = (heraia_struct_t *) data;
00111     GtkWidget *window = NULL;     /**< find window */
00112 
00113     if (main_struct != NULL)
00114         {
00115             window = heraia_get_widget(main_struct->xmls->main, "find_window");
00116             show_hide_widget(window, FALSE, main_struct->win_prop->find_window);
00117         }
00118 
00119 }
00120 
00121 
00122 /**
00123  * Tries to find, in the document, what the user entered in the GtkHex entry in
00124  * the find window (forward from the current position)
00125  * @param widget : calling widget (may be NULL as we don't use this here)
00126  * @param data : MUST be heraia_struct_t *main_struct main structure and not NULL
00127  */
00128 static void find_next_bt_clicked(GtkWidget *widget, gpointer data)
00129 {
00130     heraia_struct_t *main_struct = (heraia_struct_t *) data;
00131 
00132     if (main_struct != NULL && main_struct->find_doc != NULL)
00133         {
00134             fr_search_forward(main_struct, main_struct->find_doc, 0);
00135         }
00136 }
00137 
00138 
00139 /**
00140  * Tries to find, in the document, what the user entered in the GtkHex entry in
00141  * the find window (backward from the current position)
00142  * @param widget : calling widget (may be NULL as we don't use this here)
00143  * @param data : MUST be heraia_struct_t *main_struct main structure and not NULL
00144  */
00145 static void find_prev_bt_clicked(GtkWidget *widget, gpointer data)
00146 {
00147     heraia_struct_t *main_struct = (heraia_struct_t *) data;
00148     guchar *buffer = NULL;     /**< Buffer that contains the search string             */
00149     doc_t *current_doc = NULL; /**< Current doc where we want to search for the string */
00150     gboolean result = FALSE;
00151     guint64 position = 0;
00152     guint buffer_size = 0;
00153 
00154     if (main_struct != NULL)
00155         {
00156             buffer = fr_get_search_string(main_struct, main_struct->find_doc, &buffer_size);
00157 
00158             if (buffer != NULL)
00159                 {
00160                     current_doc = main_struct->current_doc;
00161                     position = ghex_get_cursor_position(current_doc->hex_widget) + 1 ;
00162                     result = ghex_find_backward(current_doc, buffer, buffer_size, &position);
00163 
00164                     if (result == TRUE)
00165                         {
00166                             ghex_set_cursor_position(current_doc->hex_widget, position);
00167                         }
00168                 }
00169         }
00170 }
00171 
00172 
00173 /**
00174  * Tries to find, in the document, what the user entered in the GtkHex entry in
00175  * the find window (all positions from 0)
00176  * @param widget : calling widget (may be NULL as we don't use this here)
00177  * @param data : MUST be heraia_struct_t *main_struct main structure and not NULL
00178  */
00179 static void find_all_bt_clicked(GtkWidget *widget, gpointer data)
00180 {
00181     heraia_struct_t *main_struct = (heraia_struct_t *) data;
00182     guchar *buffer = NULL;     /**< Buffer that contains the search string             */
00183     doc_t *current_doc = NULL; /**< Current doc where we want to search for the string */
00184     gboolean result = FALSE;
00185     guint64 position = 0;
00186     guint buffer_size = 0;
00187     GArray *all_pos = NULL;    /**< All positions of the searched string               */
00188 
00189     if (main_struct != NULL)
00190         {
00191             buffer = fr_get_search_string(main_struct, main_struct->find_doc, &buffer_size);
00192 
00193             if (buffer != NULL)
00194                 {
00195                     all_pos = g_array_new(TRUE, TRUE, sizeof(guint64));
00196                     current_doc = main_struct->current_doc;
00197                     position = 0;
00198                     result = ghex_find_forward(current_doc, buffer, buffer_size, &position);
00199 
00200                     while (result == TRUE)
00201                         {
00202                             all_pos = g_array_append_val(all_pos, position);
00203                             result = ghex_find_forward(current_doc, buffer, buffer_size, &position);
00204                         }
00205                 }
00206         }
00207 
00208     if (all_pos != NULL)
00209         {
00210             rw_add_one_tab_from_find_all_bt(main_struct, all_pos, buffer_size);
00211             g_array_free(all_pos, TRUE);
00212         }
00213 }
00214 
00215 
00216 /**
00217  * Signal connections for the find window
00218  * @param main_struct : heraia's main structure
00219  */
00220 static void find_window_connect_signal(heraia_struct_t *main_struct)
00221 {
00222     /* Close button */
00223     g_signal_connect(G_OBJECT(heraia_get_widget(main_struct->xmls->main, "find_close_bt")), "clicked",
00224                      G_CALLBACK(find_window_close), main_struct);
00225 
00226     /* Next button */
00227     g_signal_connect(G_OBJECT(heraia_get_widget(main_struct->xmls->main, "find_next_bt")), "clicked",
00228                      G_CALLBACK(find_next_bt_clicked), main_struct);
00229 
00230     /* Prev button */
00231     g_signal_connect(G_OBJECT(heraia_get_widget(main_struct->xmls->main, "find_prev_bt")), "clicked",
00232                      G_CALLBACK(find_prev_bt_clicked), main_struct);
00233 
00234     /* Find all button */
00235     g_signal_connect(G_OBJECT(heraia_get_widget(main_struct->xmls->main, "find_all_bt")), "clicked",
00236                      G_CALLBACK(find_all_bt_clicked), main_struct);
00237 
00238     /* When result window is killed or destroyed */
00239     g_signal_connect(G_OBJECT(heraia_get_widget(main_struct->xmls->main, "result_window")), "delete_event",
00240                      G_CALLBACK(delete_find_window_event), main_struct);
00241 
00242     g_signal_connect(G_OBJECT(heraia_get_widget(main_struct->xmls->main, "result_window")), "destroy",
00243                      G_CALLBACK(destroy_find_window_event), main_struct);
00244 }
00245 
00246 
00247 /**
00248  * Inits all the things in the find window (signal and such)
00249  * @param main_struct : heraia's main structure
00250  */
00251 void find_window_init_interface(heraia_struct_t * main_struct)
00252 {
00253 
00254     if (main_struct != NULL && main_struct->xmls != NULL && main_struct->xmls->main != NULL)
00255         {
00256             find_window_connect_signal(main_struct);
00257 
00258             main_struct->find_doc = create_find_or_replace_doc_t();
00259 
00260             if (main_struct->find_doc != NULL)
00261                 {
00262                    find_replace_add_ghex_widget(main_struct->xmls, "find_al", main_struct->find_doc);
00263                 }
00264         }
00265 }
00266 
00267 
00268 /******************************************************************************/
00269 /******************************* common stuff *********************************/
00270 /******************************************************************************/
00271 
00272 /**
00273  * Gets the string from the document doc
00274  * @param main_struct : main structure, needed here to compute endianness
00275  * @param doc : the document (HexDocument and HexWidget) used to defined the
00276  *              search string
00277  * @return a newly allocated guchar string that may be g_free'ed when no longer
00278  *         needed
00279  */
00280 static guchar *fr_get_search_string(heraia_struct_t * main_struct, doc_t *doc, guint *buffer_size)
00281 {
00282     guint size = 0;          /**< size of the search string (we hope that this value is small) */
00283     guchar *buffer = NULL;   /**< buffer for the search string                                 */
00284     guint endianness = 0;    /**< endianness as selected in data interpretor's window          */
00285     gboolean result = FALSE;
00286 
00287 
00288     size = ghex_file_size(GTK_HEX(doc->hex_widget));
00289 
00290     if (size > 0 && size < 4096)  /* Here fixes some limits ! */
00291         {
00292             buffer = (guchar *) g_malloc0(sizeof(guchar) * size);
00293             endianness = which_endianness(main_struct);
00294             result = ghex_get_data_position(doc->hex_widget, 0, size, endianness, buffer);
00295 
00296             if (result == TRUE)
00297                 {
00298                     *buffer_size = size;
00299                     return buffer;
00300                 }
00301             else
00302                 {
00303                     *buffer_size = 0;
00304                     return NULL;
00305                 }
00306         }
00307     else
00308         {
00309             *buffer_size = 0;
00310             return NULL;
00311         }
00312 }
00313 
00314 
00315 /**
00316  * Creates the HexDocument and the GtkHex widget with the right properties and
00317  * Fills a doc_t structure with them.
00318  * @return a newly allocated doc_t structure with HexDocument and GtkHex widget
00319  *         correctly configured to fit in the find and find and replace windows
00320  */
00321 static doc_t *create_find_or_replace_doc_t(void)
00322 {
00323     Heraia_Document *find_hex_doc = NULL;
00324     GtkWidget *find_hex_widget = NULL;
00325 
00326     find_hex_doc = hex_document_new();
00327 
00328     if (find_hex_doc != NULL)
00329         {
00330             /* creating a new view to this new document */
00331             find_hex_widget = hex_document_add_view(find_hex_doc);
00332 
00333             /* Sets some options : no offests, insert mode and 4 lines of 16 chars */
00334             gtk_hex_show_offsets(GTK_HEX(find_hex_widget), FALSE);
00335             gtk_hex_set_insert_mode(GTK_HEX(find_hex_widget), TRUE);
00336             gtk_hex_set_geometry(GTK_HEX(find_hex_widget), 16, 4);
00337 
00338             /* joining those two new structures in one */
00339             return new_doc_t(find_hex_doc, find_hex_widget);
00340         }
00341     else
00342         {
00343             return NULL;
00344         }
00345 }
00346 
00347 
00348 /**
00349  * Adds the GtkHex widget to the right frame
00350  * @param xmls : xmls structure
00351  * @param widget_name : the widget that will receive the GtkHex widget (a frame)
00352  * @param entry : the doc_t structure that contains document and gtkhex widget
00353  *                used as an entry field
00354  */
00355 static void find_replace_add_ghex_widget(xml_t *xmls, gchar *widget_name, doc_t *entry)
00356 {
00357     GtkWidget *al = NULL;
00358 
00359     al = heraia_get_widget(xmls->main, widget_name);
00360     gtk_container_add(GTK_CONTAINER(al), entry->hex_widget);
00361     gtk_container_set_border_width(GTK_CONTAINER(al), 3);
00362 
00363 
00364 }
00365 
00366 
00367 /**
00368  * Searches the string entered in the search document in the current one (from
00369  * the currenty position + offset) in the main window.
00370  * @param main_struct : heraia's main structure
00371  * @param search_doc : the document used to enter the searched string
00372  * @param offset : the offset from the current position to begin the search.
00373  */
00374 static void fr_search_forward(heraia_struct_t *main_struct, doc_t *search_doc, goffset offset)
00375 {
00376     guchar *buffer = NULL;     /**< Buffer that contains the search string             */
00377     doc_t *current_doc = NULL; /**< Current doc where we want to search for the string */
00378     gboolean result = FALSE;
00379     guint64 position = 0;
00380     guint buffer_size = 0;
00381 
00382     buffer = fr_get_search_string(main_struct, search_doc, &buffer_size);
00383 
00384     if (buffer != NULL)
00385         {
00386             current_doc = main_struct->current_doc;
00387             position = ghex_get_cursor_position(current_doc->hex_widget);
00388             position = position + offset;
00389             result = ghex_find_forward(current_doc, buffer, buffer_size, &position);
00390 
00391             if (result == TRUE)
00392                 {
00393                     ghex_set_cursor_position(current_doc->hex_widget, position);
00394                 }
00395         }
00396 }
00397 
00398 
00399 /******************************************************************************/
00400 /************************** find and replace window ***************************/
00401 /******************************************************************************/
00402 
00403 
00404 /**
00405  * Show find and replace window
00406  * @param widget : the widget that issued the signal
00407  * @param data : user data MUST be heraia_struct_t *main_struct main structure
00408  */
00409 void fr_window_show(GtkWidget *widget, gpointer data)
00410 {
00411     heraia_struct_t *main_struct = (heraia_struct_t *) data;
00412     GtkWidget *window = NULL;      /**< find window */
00413 
00414     if (main_struct != NULL && main_struct->current_doc != NULL)
00415         {
00416             window = heraia_get_widget(main_struct->xmls->main, "fr_window");
00417             show_hide_widget(window, TRUE, main_struct->win_prop->fr_window);
00418         }
00419 }
00420 
00421 
00422 /**
00423  * Call back function for the find and replace window destruction
00424  * @param widget : calling widget (may be NULL as we don't use this here)
00425  * @param event : event associated (may be NULL as we don't use this here)
00426  * @param data :  MUST be heraia_struct_t *main_struct main structure
00427  */
00428 static gboolean delete_fr_window_event(GtkWidget *widget, GdkEvent  *event, gpointer data)
00429 {
00430     fr_window_close(widget, data);
00431 
00432     return TRUE;
00433 }
00434 
00435 
00436 /**
00437  * Call back function for the find and replace window destruction
00438  * @param widget : calling widget (may be NULL as we don't use this here)
00439  * @param event : event associated (may be NULL as we don't use this here)
00440  * @param data : user data - MUST be heraia_struct_t *main_struct main structure and not NULL
00441  */
00442 static void destroy_fr_window_event(GtkWidget *widget, GdkEvent  *event, gpointer data)
00443 {
00444     fr_window_close(widget, data);
00445 }
00446 
00447 
00448 /**
00449  * Close button has been clicked we want to hide the window
00450  * @param widget : calling widget (may be NULL as we don't use this here)
00451  * @param data : MUST be heraia_struct_t *main_struct main structure and not NULL
00452  */
00453 static void fr_window_close(GtkWidget *widget, gpointer data)
00454 {
00455     heraia_struct_t *main_struct = (heraia_struct_t *) data;
00456      GtkWidget *window = NULL;     /**< find window */
00457 
00458     if (main_struct != NULL)
00459         {
00460              window = heraia_get_widget(main_struct->xmls->main, "fr_window");
00461              show_hide_widget(window, FALSE, main_struct->win_prop->fr_window);
00462         }
00463 }
00464 
00465 
00466 /**
00467  * Signal connections for the find and replace window
00468  * @param main_struct : heraia's main structure
00469  */
00470 static void fr_window_connect_signal(heraia_struct_t *main_struct)
00471 {
00472     /* Close button */
00473     g_signal_connect(G_OBJECT(heraia_get_widget(main_struct->xmls->main, "fr_close_bt")), "clicked",
00474                      G_CALLBACK(fr_window_close), main_struct);
00475 
00476     /* When result window is killed or destroyed */
00477     g_signal_connect(G_OBJECT(heraia_get_widget(main_struct->xmls->main, "fr_window")), "delete_event",
00478                      G_CALLBACK(delete_fr_window_event), main_struct);
00479 
00480     g_signal_connect(G_OBJECT(heraia_get_widget(main_struct->xmls->main, "fr_window")), "destroy",
00481                      G_CALLBACK(destroy_fr_window_event), main_struct);
00482 
00483     /* Search button */
00484     g_signal_connect(G_OBJECT(heraia_get_widget(main_struct->xmls->main, "fr_find_bt")), "clicked",
00485                      G_CALLBACK(fr_search_bt_clicked), main_struct);
00486 
00487     /* Replace button */
00488     g_signal_connect(G_OBJECT(heraia_get_widget(main_struct->xmls->main, "fr_replace_bt")), "clicked",
00489                      G_CALLBACK(fr_replace_bt_clicked), main_struct);
00490 
00491     /* Replace and search button */
00492     g_signal_connect(G_OBJECT(heraia_get_widget(main_struct->xmls->main, "fr_replace_search_bt")), "clicked",
00493                      G_CALLBACK(fr_replace_search_bt_clicked), main_struct);
00494 }
00495 
00496 
00497 /**
00498  * Tries to find, in the document, what the user entered in the GtkHex entry in
00499  * the fr window in the find hexwidget (forward from the current position)
00500  * @param widget : calling widget (may be NULL as we don't use this here)
00501  * @param data : MUST be heraia_struct_t *main_struct main structure and not NULL
00502  */
00503 static void fr_search_bt_clicked(GtkWidget *widget, gpointer data)
00504 {
00505     heraia_struct_t *main_struct = (heraia_struct_t *) data;
00506 
00507     if (main_struct != NULL && main_struct->fr_find_doc != NULL)
00508         {
00509            fr_search_forward(main_struct, main_struct->fr_find_doc, 0);
00510         }
00511 }
00512 
00513 
00514 /**
00515  * Tries to replace, in the document, what the user entered in the GtkHex entry
00516  * in the fr window in the find hexwidget by what the user entered in the
00517  * replace entry in that same window and then goes to the next position (if any)
00518  * @param widget : calling widget (may be NULL as we don't use this here)
00519  * @param data : MUST be heraia_struct_t *main_struct main structure and not NULL
00520  */
00521 static void fr_replace_search_bt_clicked(GtkWidget *widget, gpointer data)
00522 {
00523     heraia_struct_t *main_struct = (heraia_struct_t *) data;
00524     goffset offset = 0;
00525 
00526     if (main_struct != NULL && main_struct->fr_find_doc != NULL)
00527         {
00528             offset = fr_replace_data(main_struct);
00529             fprintf(stdout, "offset : %ld\n", offset);
00530             fr_search_forward(main_struct, main_struct->fr_find_doc, offset);
00531         }
00532 }
00533 
00534 /**
00535  * Tries to replace, in the document, what the user entered in the GtkHex entry
00536  * in the fr window in the find hexwidget by what the user entered in the
00537  * replace entry in that same window
00538  * @param main_struct : main structure
00539  * @return a goffset that indicates the length difference between the length of
00540  *         the replaced data and the length of the inserted data
00541  */
00542 static goffset fr_replace_data(heraia_struct_t *main_struct)
00543 {
00544     guchar *buffer = NULL;     /**< Buffer that contains the search string             */
00545     guchar *rep_buffer = NULL; /**< Buffer that contains the replace string            */
00546     doc_t *current_doc = NULL; /**< Current doc where we want to search for the string */
00547     guint buffer_size = 0;     /**< Size of the searched string                        */
00548     guint rep_buf_size = 0;    /**< Size of the replace string                         */
00549     guint64 position = 0;      /**< Current position in the current document !         */
00550     goffset length = 0;        /**< length of the result of that replace               */
00551 
00552     if (main_struct != NULL && main_struct->current_doc != NULL && main_struct->fr_find_doc != NULL && main_struct->fr_replace_doc != NULL)
00553         {
00554             current_doc = main_struct->current_doc;
00555             buffer = fr_get_search_string(main_struct, main_struct->fr_find_doc, &buffer_size);
00556             rep_buffer = fr_get_search_string(main_struct, main_struct->fr_replace_doc, &rep_buf_size);
00557             position = ghex_get_cursor_position(current_doc->hex_widget);
00558             if (ghex_compare_data(current_doc, buffer, buffer_size, position) == 0)
00559                 {
00560                     /* The strings are equal and can be replaced in the current document */
00561                     ghex_set_data(current_doc, position, buffer_size, rep_buf_size, rep_buffer);
00562                     length = (goffset) rep_buf_size - buffer_size;
00563                     return length;
00564                 }
00565             else
00566                 {
00567                     return length;
00568                 }
00569         }
00570     else
00571         {
00572             return length;
00573         }
00574 }
00575 
00576 
00577 /**
00578  * @param widget : calling widget (may be NULL as we don't use this here)
00579  * @param data : MUST be heraia_struct_t *main_struct main structure and not NULL
00580  */
00581 static void fr_replace_bt_clicked(GtkWidget *widget, gpointer data)
00582 {
00583     heraia_struct_t *main_struct = (heraia_struct_t *) data;
00584     goffset offset = 0;
00585 
00586     offset = fr_replace_data(main_struct);
00587 }
00588 
00589 
00590 /**
00591  * Inits all the things in the find and replace window (signal and such)
00592  * @param main_struct : heraia's main structure
00593  */
00594 void fr_window_init_interface(heraia_struct_t * main_struct)
00595 {
00596 
00597       if (main_struct != NULL && main_struct->xmls != NULL && main_struct->xmls->main != NULL)
00598         {
00599             fr_window_connect_signal(main_struct);
00600 
00601             /* Creating a new hex document */
00602             main_struct->fr_find_doc = create_find_or_replace_doc_t();
00603             main_struct->fr_replace_doc = create_find_or_replace_doc_t();
00604 
00605             if (main_struct->fr_replace_doc != NULL && main_struct->fr_find_doc != NULL)
00606                 {
00607                     find_replace_add_ghex_widget(main_struct->xmls, "fr_find_al", main_struct->fr_find_doc);
00608                     find_replace_add_ghex_widget(main_struct->xmls, "fr_replace_al", main_struct->fr_replace_doc);
00609                 }
00610 
00611         }
00612 }
Generated on Sat Oct 30 18:31:55 2010 for Heraia by  doxygen 1.6.3