00001 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ 00002 /* 00003 types.h 00004 types.h - all data types and pieces of common declarations 00005 00006 (C) Copyright 2006 - 2008 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 00025 #ifndef _HERAIA_TYPES_H_ 00026 #define _HERAIA_TYPES_H_ 00027 00028 /* I have some problems under windows if #ifdef statement is activated */ 00029 00030 /* #ifdef HAVE_CONFIG_H */ 00031 #include "config.h" 00032 /* #endif */ /* HAVE_CONFIG_H */ 00033 00034 00044 #include <stdio.h> 00045 #include <stdlib.h> 00046 #include <string.h> 00047 #include <time.h> 00048 #include <unistd.h> 00049 #include <sys/types.h> 00050 #include <sys/stat.h> 00051 #include <getopt.h> 00052 00053 #include <glib/gstdio.h> 00054 #include <glade/glade.h> 00055 #include <gmodule.h> 00056 00057 #include <gtkhex/gtkhex.h> 00058 00059 #include <libheraia.h> 00060 00061 typedef HexDocument Heraia_Document; 00062 typedef GtkHex Heraia_Hex; 00063 typedef gint HERAIA_ERROR; 00064 00069 typedef gint RefreshType; 00070 #define HERAIA_REFRESH_NOTHING 0 00071 #define HERAIA_REFRESH_NEW_FILE 1 00072 #define HERAIA_REFRESH_CURSOR_MOVE 2 00073 00077 typedef struct 00078 { 00079 /* Current Hexwidget that we want data to be interpreted */ 00080 GtkWidget *current_hexwidget; /* we may want to move this from here to heraia_window_t structure */ 00081 GtkWidget *diw; /* data interpretor window */ 00082 00083 /* gboolean window_displayed; says whether the window is displayed or not */ 00084 gint tab_displayed; /* keeps the last displayed tab's number before closing */ 00085 00086 } data_window_t; 00087 00088 /* Treatment Stuff (if one wants to add new data types) */ 00089 typedef GList *(* TreatmentDoFunc) (GList *); /* Treatment function called while operating the treatment */ 00090 typedef void (* TreatmentInitFunc) (gpointer); /* Treatment init function */ 00091 typedef void (* TreatmentDelFunc) (gpointer); /* Treatment delete function */ 00092 typedef gpointer (*TreatmentCopyFunc) (gpointer); /* Treatment copy function that have to copy internal 00093 structures (widgets and all stuff in it) */ 00097 typedef struct 00098 { 00099 gchar *name; /* Treatment name */ 00100 TreatmentDoFunc do_it; /* Treatment function that manages the whole treatment (interface + treatment itself) */ 00101 TreatmentInitFunc init; /* inits the interface */ 00102 TreatmentDelFunc kill; /* kills the treatment itself */ 00103 TreatmentCopyFunc copy; /* Copy the gpointer data sub structure of the treatment itself */ 00104 gpointer data; /* Generic treatment data. Each instantiated treatment may have it's own */ 00105 } treatment_t; 00106 00110 typedef struct 00111 { 00112 GtkWidget *container_box; /* Upper box containing the whole stuff */ 00113 GtkWidget *button_box; /* Right part of the hbox. Contains "-", GtkEntry, "+" */ 00114 GtkWidget *combo_box; /* Left box where we have the combobox */ 00115 GtkWidget *tment_list; /* Combobox containning the treatment list */ 00116 GtkWidget *result; /* The GtkEntry in the vbox */ 00117 GtkWidget *moins; /* "-" button */ 00118 GtkWidget *plus; /* "+" button */ 00119 treatment_t *treatment; /* Selected treatment */ 00120 } treatment_container_t; 00121 00131 typedef struct 00132 { 00133 gchar *name; /* Name of the data type */ 00134 guint size; /* size of the data type (here we may limit size entry, eg <= 16 for example) */ 00135 GList *treatment_c_list; /* Treatments containers to be applied (in the list order) to the data 00136 (treatment_container_t *) */ 00137 GtkWidget *di_label; /* label for the data_interpretor window */ 00138 GtkWidget *di_entry; /* entry for the data interpretor window */ 00139 } data_type_t; 00140 00145 typedef struct 00146 { 00147 GladeXML *main; /* the main interface xml description */ 00148 } xml_t; 00149 00150 00151 00157 typedef struct 00158 { 00159 gint x; 00160 gint y; 00161 gboolean displayed; 00162 } window_prop_t; 00163 00167 typedef struct 00168 { 00169 window_prop_t *about_box; 00170 window_prop_t *data_interpretor; /* data interpretor window */ 00171 window_prop_t *log_box; 00172 window_prop_t *main_dialog; 00173 window_prop_t *plugin_list; /* plugin description window */ 00174 window_prop_t *ldt; /* list data types window */ 00175 } all_window_prop_t; 00176 00181 typedef struct 00182 { 00183 gboolean debug; /* Used to tell the program wether we want to display debug messages or not */ 00184 gchar *filename; /* this could (should) be a list of filenames !!! */ 00185 Heraia_Document *current_doc; /* We may want to group this with current_hexwidget in a specific struct */ 00186 xml_t *xmls; /* All the xmls used in the program, loaded at running time */ 00187 data_window_t *current_DW; /* data_interpretor pointer */ 00188 GList *location_list; /* this is the location list where we store some paths */ 00189 GList *plugins_list; /* A list of plugins */ 00190 GList *data_type_list; /* A list of data types */ 00191 data_type_t *current_data_type; /* data type that is being edited */ 00192 GList *available_treatment_list;/* Available treatments that can be used by the user in the data type window */ 00193 RefreshType event; /* Tells what is happening */ 00194 all_window_prop_t *win_prop; /* Keeps window properties */ 00195 gchar *pref_filename; /* user preference file file name */ 00196 gchar *pref_pathname; /* user preference file path name */ 00197 } heraia_window_t; 00198 00199 #include "data_interpretor.h" 00200 #include "ghex_heraia_interface.h" 00201 #include "heraia.h" 00202 #include "heraia_errors.h" 00203 #include "heraia_io.h" 00204 #include "heraia_ui.h" 00205 #include "log.h" 00206 #include "plugin.h" 00207 #include "plugin_list.h" 00208 #include "list_data_types.h" 00209 #include "data_type.h" 00210 #include "treatments.h" 00211 00212 #endif /* _HERAIA_TYPES_H_ */