/* OpenIDA - Outil d'analyse de fichiers binaires
* about.h - boîte de dialogue d'information sur le programme
*
* Copyright (C) 2010-2012 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 .
*/
#include "about.h"
#include
#include
#include
#include "../gtkext/easygtk.h"
#include "../gtkext/support.h"
#include "../../revision.h"
/******************************************************************************
* *
* 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 */
GdkRGBA color; /* Couleur de fond noire */
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 max; /* Nbre. de boucles à effectuer*/
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);
gdk_rgba_parse(&color, "black");
gtk_widget_override_background_color(GTK_WIDGET(result), GTK_STATE_FLAG_NORMAL, &color);
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("chrysalide_text.png");
image = qck_create_image(NULL, NULL, filename);
gtk_fixed_put(GTK_FIXED(fixed), image, 48, 324);
gtk_widget_set_size_request(image, 253, 42);
/* 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, 149, 360);
gtk_widget_set_size_request(image, 14, 18);
revision = REVISION;
max = log(revision) / log(10);
for (i = 0; i <= max; i++)
{
level = pow(10, max - i);
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, 163 + i * 14, 360);
gtk_widget_set_size_request(image, 14, 18);
revision %= level;
}
/* Copyright */
label = qck_create_label(NULL, NULL, "Copyright (C) 2008-2012 Cyrille Bagard");
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;
}