diff options
Diffstat (limited to 'src/dialogs')
-rw-r--r-- | src/dialogs/Makefile.am | 1 | ||||
-rw-r--r-- | src/dialogs/about.c | 128 | ||||
-rw-r--r-- | src/dialogs/about.h | 37 | ||||
-rw-r--r-- | src/dialogs/plugins.h | 6 |
4 files changed, 169 insertions, 3 deletions
diff --git a/src/dialogs/Makefile.am b/src/dialogs/Makefile.am index 2970d0a..289e5a5 100644 --- a/src/dialogs/Makefile.am +++ b/src/dialogs/Makefile.am @@ -2,6 +2,7 @@ lib_LIBRARIES = libdialogs.a libdialogs_a_SOURCES = \ + about.h about.c \ binparts.h binparts.c \ export.h export.c \ plugins.h plugins.c diff --git a/src/dialogs/about.c b/src/dialogs/about.c new file mode 100644 index 0000000..4f34a2c --- /dev/null +++ b/src/dialogs/about.c @@ -0,0 +1,128 @@ + +/* OpenIDA - Outil d'analyse de fichiers binaires + * about.h - boîte de dialogue d'information sur le programme + * + * Copyright (C) 2010 Cyrille Bagard + * + * This file is part of OpenIDA. + * + * OpenIDA is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * OpenIDA is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar. If not, see <http://www.gnu.org/licenses/>. + */ + + +#include "about.h" + + +#include <math.h> +#include <stdio.h> + + +#include "../gtkext/easygtk.h" +#include "../gtkext/support.h" +#include "../../revision.h" + + + +#define _(str) str + + + +/****************************************************************************** +* * +* Paramètres : parent = fenêtre parente à surpasser. * +* * +* Description : Construit la fenêtre de sélection des sections. * +* * +* Retour : Adresse de la fenêtre mise en place. * +* * +* Remarques : - * +* * +******************************************************************************/ + +GtkWidget *create_about_dialog(GtkWindow *parent) +{ + GtkWidget *result; /* Fenêtre à renvoyer */ + GtkStyle *style; /* Style associé à la fenêtre */ + GtkWidget *fixed; /* Support global */ + gchar *filename; /* Chemin d'accès au fichier */ + GtkWidget *image; /* Image chargée */ + unsigned int revision; /* Numéro de révision */ + unsigned int i; /* Boucle de parcours */ + unsigned int level; /* Unité la plus importante */ + char buffer[16]; /* Nom d'image à forger */ + GtkWidget *label; /* Etiquette inférieure */ + + result = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_widget_set_size_request(result, 350, 430); + gtk_container_set_border_width(GTK_CONTAINER(result), 0); + gtk_window_set_title(GTK_WINDOW(result), _("About")); + gtk_window_set_transient_for(GTK_WINDOW(result), parent); + gtk_window_set_default_size(GTK_WINDOW(result), 350, 430); + gtk_window_set_type_hint(GTK_WINDOW(result), GDK_WINDOW_TYPE_HINT_DIALOG); + + style = gtk_widget_get_style(result); + gtk_widget_modify_bg(result, GTK_STATE_NORMAL, &style->black); + + fixed = gtk_fixed_new(); + gtk_widget_show(fixed); + gtk_container_add(GTK_CONTAINER(result), fixed); + + /* Images principales */ + + filename = find_pixmap_file("openida.png"); + image = qck_create_image(NULL, NULL, filename); + gtk_fixed_put(GTK_FIXED(fixed), image, 10, 10); + gtk_widget_set_size_request(image, 330, 300); + + filename = find_pixmap_file("openida_text.png"); + image = qck_create_image(NULL, NULL, filename); + gtk_fixed_put(GTK_FIXED(fixed), image, 85, 330); + gtk_widget_set_size_request(image, 179, 36); + + /* Numéro de révision */ + + filename = find_pixmap_file("revision.png"); + image = qck_create_image(NULL, NULL, filename); + gtk_fixed_put(GTK_FIXED(fixed), image, 172, 360); + gtk_widget_set_size_request(image, 14, 18); + + revision = REVISION; + + for (i = 0; revision > 0; i++) + { + level = log(revision) / log(10); + level = pow(10, level); + + snprintf(buffer, 16, "revision_%u.png", revision / level); + + filename = find_pixmap_file(buffer); + image = qck_create_image(NULL, NULL, filename); + gtk_fixed_put(GTK_FIXED(fixed), image, 186 + i * 14, 360); + gtk_widget_set_size_request(image, 14, 18); + + revision %= level; + + } + + /* Copyright */ + + label = qck_create_label(NULL, NULL, "<span fgcolor='white'>Copyright (C) 2008-2010 Cyrille Bagard</span>"); + gtk_misc_set_alignment(GTK_MISC(label), 0.5, 0.5); + gtk_label_set_use_markup(GTK_LABEL(label), TRUE); + gtk_fixed_put(GTK_FIXED(fixed), label, 0, 400); + gtk_widget_set_size_request(label, 350, 20); + + return result; + +} diff --git a/src/dialogs/about.h b/src/dialogs/about.h new file mode 100644 index 0000000..6d934d7 --- /dev/null +++ b/src/dialogs/about.h @@ -0,0 +1,37 @@ + +/* OpenIDA - Outil d'analyse de fichiers binaires + * about.h - prototypes pour la boîte de dialogue d'information sur le programme + * + * Copyright (C) 2010 Cyrille Bagard + * + * This file is part of OpenIDA. + * + * OpenIDA is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * OpenIDA is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar. If not, see <http://www.gnu.org/licenses/>. + */ + + +#ifndef _DIALOGS_ABOUT_H +#define _DIALOGS_ABOUT_H + + +#include <gtk/gtk.h> + + + +/* Construit la fenêtre d'informations sur le logiciel. */ +GtkWidget *create_about_dialog(GtkWindow *); + + + +#endif /* _DIALOGS_ABOUT_H */ diff --git a/src/dialogs/plugins.h b/src/dialogs/plugins.h index 5de15ca..f0ea164 100644 --- a/src/dialogs/plugins.h +++ b/src/dialogs/plugins.h @@ -21,8 +21,8 @@ */ -#ifndef _DIALOGS_SECTIONS_H -#define _DIALOGS_SECTIONS_H +#ifndef _DIALOGS_PLUGINS_H +#define _DIALOGS_PLUGINS_H #include <gtk/gtk.h> @@ -37,4 +37,4 @@ GtkWidget *create_plugins_selection_dialog(GOpenidaBinary *, GtkWindow *); -#endif /* _DLG_SECTIONS_H */ +#endif /* _DIALOGS_PLUGINS_H */ |