00001 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ 00002 /* 00003 libheraia.h 00004 Heraia's library header 00005 00006 (C) Copyright 2008 Sébastien Tricaud, Olivier Delhomme 00007 e-mail : heraia@delhomme.org 00008 URL : http://heraia.tuxfamily.org 00009 00010 This program is free software; you can redistribute it and/or modify 00011 it under the terms of the GNU General Public License as published by 00012 the Free Software Foundation; either version 2, or (at your option) 00013 any later version. 00014 00015 This program is distributed in the hope that it will be useful, 00016 but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 GNU General Public License for more details. 00019 00020 You should have received a copy of the GNU General Public License 00021 along with this program; if not, write to the Free Software 00022 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 00023 00024 #ifndef _LIBHERAIA_H_ 00025 #define _LIBHERAIA_H_ 00026 00027 #include <stdio.h> 00028 #include <stdlib.h> 00029 #include <string.h> 00030 #include <time.h> 00031 #include <unistd.h> 00032 #include <sys/types.h> 00033 #include <sys/stat.h> 00034 #include <getopt.h> 00035 00036 #include <glib.h> 00037 #include <glib/gstdio.h> 00038 #include <glade/glade.h> 00039 #include <gmodule.h> 00040 00041 #include <gtkhex/gtkhex.h> 00042 00043 typedef HexDocument Heraia_Document; 00044 typedef GtkHex Heraia_Hex; 00045 typedef gint HERAIA_ERROR; 00046 00051 typedef gint RefreshType; 00052 #define HERAIA_REFRESH_NOTHING 0 00053 #define HERAIA_REFRESH_NEW_FILE 1 00054 #define HERAIA_REFRESH_CURSOR_MOVE 2 00055 00059 typedef struct 00060 { 00061 /* Current Hexwidget that we want data to be interpreted */ 00062 GtkWidget *current_hexwidget; /* we may want to move this from here to heraia_window_t structure */ 00063 GtkWidget *diw; /* data interpretor window */ 00064 00065 /* gboolean window_displayed; says whether the window is displayed or not */ 00066 gint tab_displayed; /* keeps the last displayed tab's number before closing */ 00067 00068 } data_window_t; 00069 00070 /* Treatment Stuff (if one wants to add new data types) */ 00071 typedef GList *(* TreatmentDoFunc) (GList *); /* Treatment function called while operating the treatment */ 00072 typedef void (* TreatmentInitFunc) (gpointer); /* Treatment init function */ 00073 typedef void (* TreatmentDelFunc) (gpointer); /* Treatment delete function */ 00074 typedef gpointer (*TreatmentCopyFunc) (gpointer); /* Treatment copy function that have to copy internal 00075 structures (widgets and all stuff in it) */ 00079 typedef struct 00080 { 00081 gchar *name; /* Treatment name */ 00082 TreatmentDoFunc do_it; /* Treatment function that manages the whole treatment (interface + treatment itself) */ 00083 TreatmentInitFunc init; /* inits the interface */ 00084 TreatmentDelFunc kill; /* kills the treatment itself */ 00085 TreatmentCopyFunc copy; /* Copy the gpointer data sub structure of the treatment itself */ 00086 gpointer data; /* Generic treatment data. Each instantiated treatment may have it's own */ 00087 } treatment_t; 00088 00092 typedef struct 00093 { 00094 GtkWidget *container_box; /* Upper box containing the whole stuff */ 00095 GtkWidget *button_box; /* Right part of the hbox. Contains "-", GtkEntry, "+" */ 00096 GtkWidget *combo_box; /* Left box where we have the combobox */ 00097 GtkWidget *tment_list; /* Combobox containning the treatment list */ 00098 GtkWidget *result; /* The GtkEntry in the vbox */ 00099 GtkWidget *moins; /* "-" button */ 00100 GtkWidget *plus; /* "+" button */ 00101 treatment_t *treatment; /* Selected treatment */ 00102 } treatment_container_t; 00103 00113 typedef struct 00114 { 00115 gchar *name; /* Name of the data type */ 00116 guint size; /* size of the data type (here we may limit size entry, eg <= 16 for example) */ 00117 GList *treatment_c_list; /* Treatments containers to be applied (in the list order) to the data 00118 (treatment_container_t *) */ 00119 GtkWidget *di_label; /* label for the data_interpretor window */ 00120 GtkWidget *di_entry; /* entry for the data interpretor window */ 00121 } data_type_t; 00122 00123 00128 typedef struct 00129 { 00130 GladeXML *main; /* the main interface xml description */ 00131 } xml_t; 00132 00138 typedef struct 00139 { 00140 gint x; 00141 gint y; 00142 gboolean displayed; 00143 } window_prop_t; 00144 00148 typedef struct 00149 { 00150 window_prop_t *about_box; 00151 window_prop_t *data_interpretor; /* data interpretor window */ 00152 window_prop_t *log_box; 00153 window_prop_t *main_dialog; 00154 window_prop_t *plugin_list; /* plugin description window */ 00155 window_prop_t *ldt; /* list data types window */ 00156 window_prop_t *main_pref_window; /* main preference window */ 00157 } all_window_prop_t; 00158 00162 typedef struct 00163 { 00164 gchar *filename; /* user preference file file name */ 00165 gchar *pathname; /* user preference file path name */ 00166 GKeyFile *file; /* preference file contents */ 00167 } prefs_t; 00168 00173 typedef struct 00174 { 00175 gboolean debug; /* Used to tell the program wether we want to display debug messages or not */ 00176 gchar *filename; /* this could (should) be a list of filenames !!! */ 00177 Heraia_Document *current_doc; /* We may want to group this with current_hexwidget in a specific struct */ 00178 xml_t *xmls; /* All the xmls used in the program, loaded at running time */ 00179 data_window_t *current_DW; /* data_interpretor pointer */ 00180 GList *location_list; /* this is the location list where we store some paths */ 00181 GList *plugins_list; /* A list of plugins */ 00182 GList *data_type_list; /* A list of data types */ 00183 data_type_t *current_data_type; /* data type that is being edited */ 00184 GList *available_treatment_list;/* Available treatments that can be used by the user in the data type window */ 00185 RefreshType event; /* Tells what is happening */ 00186 all_window_prop_t *win_prop; /* Keeps window properties */ 00187 prefs_t *prefs; /* All datas related to main preferences */ 00188 } heraia_window_t; 00189 00190 #include "config.h" 00191 #include "data_interpretor.h" 00192 #include "data_type.h" 00193 #include "decode.h" 00194 #include "ghex_heraia_interface.h" 00195 #include "heraia_errors.h" 00196 #include "heraia_io.h" 00197 #include "heraia_ui.h" 00198 #include "list_data_types.h" 00199 #include "log.h" 00200 #include "main_pref_window.h" 00201 #include "plugin.h" 00202 #include "plugin_list.h" 00203 #include "treatments.h" 00204 #include "user_prefs.h" 00205 00206 extern int libheraia_test(void); 00207 00208 /* Python specific */ 00209 extern void libheraia_initialize(void); 00210 extern void libheraia_finalize(void); 00211 00212 #endif /* _LIBHERAIA_H_ */