From 55184eaa3682f704ddb9e2da63cd14bc0a62b7a3 Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Mon, 18 Feb 2019 18:45:39 +0100 Subject: Prepared room for an incoming preferences dialog box. --- src/gui/dialogs/Makefile.am | 2 + src/gui/dialogs/gresource.xml | 1 + src/gui/dialogs/identity.c | 2 +- src/gui/dialogs/identity.h | 2 +- src/gui/dialogs/preferences.c | 93 ++++++++++++++ src/gui/dialogs/preferences.h | 37 ++++++ src/gui/dialogs/preferences.ui | 283 +++++++++++++++++++++++++++++++++++++++++ src/gui/menus/Makefile.am | 2 +- src/gui/menus/menubar.c | 10 +- src/gui/menus/options.c | 144 +++++++++++++++++++++ src/gui/menus/options.h | 41 ++++++ src/gui/menus/tools.c | 104 --------------- src/gui/menus/tools.h | 41 ------ 13 files changed, 609 insertions(+), 153 deletions(-) create mode 100644 src/gui/dialogs/preferences.c create mode 100644 src/gui/dialogs/preferences.h create mode 100644 src/gui/dialogs/preferences.ui create mode 100644 src/gui/menus/options.c create mode 100644 src/gui/menus/options.h delete mode 100644 src/gui/menus/tools.c delete mode 100644 src/gui/menus/tools.h diff --git a/src/gui/dialogs/Makefile.am b/src/gui/dialogs/Makefile.am index 35dfb0a..755ddbd 100644 --- a/src/gui/dialogs/Makefile.am +++ b/src/gui/dialogs/Makefile.am @@ -6,6 +6,7 @@ noinst_LTLIBRARIES = libguidialogs.la UI_FILES = \ bookmark.ui \ identity.ui \ + preferences.ui \ storage.ui libguidialogs_la_SOURCES = \ @@ -16,6 +17,7 @@ libguidialogs_la_SOURCES = \ gotox.h gotox.c \ identity.h identity.c \ plugins.h plugins.c \ + preferences.h preferences.c \ resources.h resources.c \ storage.h storage.c diff --git a/src/gui/dialogs/gresource.xml b/src/gui/dialogs/gresource.xml index e44045c..b6e3c32 100644 --- a/src/gui/dialogs/gresource.xml +++ b/src/gui/dialogs/gresource.xml @@ -3,6 +3,7 @@ bookmark.ui identity.ui + preferences.ui storage.ui diff --git a/src/gui/dialogs/identity.c b/src/gui/dialogs/identity.c index 9e3cfd7..5f51bc0 100644 --- a/src/gui/dialogs/identity.c +++ b/src/gui/dialogs/identity.c @@ -45,7 +45,7 @@ static void update_identity(GtkButton *button, GtkBuilder *); * Paramètres : parent = fenêtre principale de l'éditeur. * * outb = constructeur à détruire après usage. [OUT] * * * -* Description : Propose une édition des informations conernant l'utilisateur.* +* Description : Propose une édition d'informations concernant l'utilisateur. * * * * Retour : Adresse de la fenêtre mise en place. * * * diff --git a/src/gui/dialogs/identity.h b/src/gui/dialogs/identity.h index 99c0ca6..8d51c4d 100644 --- a/src/gui/dialogs/identity.h +++ b/src/gui/dialogs/identity.h @@ -29,7 +29,7 @@ -/* Propose une édition des informations conernant l'utilisateur. */ +/* Propose une édition d'informations concernant l'utilisateur. */ GtkWidget *create_identity_dialog(GtkWindow *, GtkBuilder **); diff --git a/src/gui/dialogs/preferences.c b/src/gui/dialogs/preferences.c new file mode 100644 index 0000000..dcb4cc7 --- /dev/null +++ b/src/gui/dialogs/preferences.c @@ -0,0 +1,93 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * preferences.c - (re)définition de l'identité de l'utilisateur + * + * Copyright (C) 2017 Cyrille Bagard + * + * This file is part of Chrysalide. + * + * Chrysalide 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. + * + * Chrysalide 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 Chrysalide. If not, see . + */ + + +#include "preferences.h" + + +#include + + + +/* Eléments de la liste de sections */ +typedef enum _PrefListItem +{ + PLI_TITLE, /* Etiquette de la section */ + PLI_PANEL, /* Panneau graphique associé */ + +} PrefListItem; + + + +/****************************************************************************** +* * +* Paramètres : parent = fenêtre principale de l'éditeur. * +* outb = constructeur à détruire après usage. [OUT] * +* * +* Description : Propose une boîte de dialogue pour la configuration générale.* +* * +* Retour : Adresse de la fenêtre mise en place. * +* * +* Remarques : - * +* * +******************************************************************************/ + +GtkWidget *create_preferences_dialog(GtkWindow *parent, GtkBuilder **outb) +{ + GtkWidget *result; /* Fenêtre à renvoyer */ + GtkBuilder *builder; /* Constructeur utilisé */ + GtkTreeStore *store; /* Arborescence des sections */ + GtkTreeIter iter; /* Point d'insertion */ + + builder = gtk_builder_new_from_resource("/org/chrysalide/gui/dialogs/preferences.ui"); + *outb = builder; + + result = GTK_WIDGET(gtk_builder_get_object(builder, "window")); + + gtk_window_set_transient_for(GTK_WINDOW(result), parent); + + /* Intégration des différentes sections */ + + store = GTK_TREE_STORE(gtk_builder_get_object(builder, "pref_list")); + + gtk_tree_store_append(store, &iter, NULL); + + gtk_tree_store_set(store, &iter, + PLI_TITLE, _("Colored labels"), + PLI_PANEL, gtk_builder_get_object(builder, "colored_labels_panel"), + -1); + + /* Mise à jour de l'interface */ + + /* Connexion des signaux */ + + /* + gtk_builder_add_callback_symbols(builder, + "update_preferences", G_CALLBACK(update_preferences), + NULL); + */ + + gtk_builder_connect_signals(builder, builder); + + return result; + +} diff --git a/src/gui/dialogs/preferences.h b/src/gui/dialogs/preferences.h new file mode 100644 index 0000000..a608dc3 --- /dev/null +++ b/src/gui/dialogs/preferences.h @@ -0,0 +1,37 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * preferences.h - prototypes pour la (re)définition de l'identité de l'utilisateur + * + * Copyright (C) 2017 Cyrille Bagard + * + * This file is part of Chrysalide. + * + * Chrysalide 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. + * + * Chrysalide 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 Chrysalide. If not, see . + */ + + +#ifndef _GUI_DIALOGS_PREFERENCES_H +#define _GUI_DIALOGS_PREFERENCES_H + + +#include + + + +/* Propose une boîte de dialogue pour la configuration générale. */ +GtkWidget *create_preferences_dialog(GtkWindow *, GtkBuilder **); + + + +#endif /* _GUI_DIALOGS_PREFERENCES_H */ diff --git a/src/gui/dialogs/preferences.ui b/src/gui/dialogs/preferences.ui new file mode 100644 index 0000000..2760399 --- /dev/null +++ b/src/gui/dialogs/preferences.ui @@ -0,0 +1,283 @@ + + + + + + + + + + + + global colored labels + + + colored labels for symbols + + + colored labels for basic blocks + + + + + + + + + + + + + False + General preferences + True + 800 + 500 + dialog + + + False + vertical + 2 + + + False + 8 + 8 + 8 + 8 + end + + + gtk-cancel + True + True + True + True + + + True + True + 0 + + + + + gtk-apply + True + True + True + True + + + True + True + 1 + + + + + False + False + 0 + + + + + True + True + 200 + True + + + True + True + 8 + 8 + 8 + in + + + True + True + pref_list + False + + + + + + column + + + + 0 + + + + + + + + + False + True + + + + + True + False + 8 + 8 + 8 + + + True + False + vertical + 8 + + + True + False + 8 + + + True + False + Specify: + + + False + True + 0 + + + + + True + False + colored_label_types + + + + 0 + + + + + True + True + 1 + + + + + False + True + 0 + + + + + True + False + 8 + + + True + True + in + + + True + True + + + + + + + + True + True + 0 + + + + + True + False + vertical + icons + False + 4 + + + True + False + True + list-add + + + False + True + + + + + True + False + True + list-remove + + + False + True + + + + + False + True + 1 + + + + + True + True + 1 + + + + + page0 + page0 + + + + + True + True + + + + + True + True + 1 + + + + + + button1 + button2 + + + + + + diff --git a/src/gui/menus/Makefile.am b/src/gui/menus/Makefile.am index d1e1564..49214e1 100644 --- a/src/gui/menus/Makefile.am +++ b/src/gui/menus/Makefile.am @@ -8,9 +8,9 @@ libguimenus_la_SOURCES = \ file.h file.c \ help.h help.c \ menubar.h menubar.c \ + options.h options.c \ plugins.h plugins.c \ project.h project.c \ - tools.h tools.c \ view.h view.c libguimenus_la_LDFLAGS = diff --git a/src/gui/menus/menubar.c b/src/gui/menus/menubar.c index 863ac54..886387c 100644 --- a/src/gui/menus/menubar.c +++ b/src/gui/menus/menubar.c @@ -30,9 +30,9 @@ #include "edition.h" #include "file.h" #include "help.h" +#include "options.h" #include "plugins.h" #include "project.h" -#include "tools.h" #include "view.h" #include "../editem-int.h" @@ -49,7 +49,7 @@ struct _GMenuBar GtkWidget *project; /* Menu "Projet" */ GtkWidget *binary; /* Menu "Binaire" */ GtkWidget *debug; /* Menu "Débogage" */ - GtkWidget *tools; /* Menu "Outils" */ + GtkWidget *options; /* Menu "Options" */ GtkWidget *plugins; /* Menu "Greffons" */ GtkWidget *help; /* Menu "Aide" */ @@ -246,10 +246,10 @@ GEditorItem *g_menu_bar_new(GObject *ref) result->debug = build_menu_debug(ref); gtk_container_add(GTK_CONTAINER(item->widget), result->debug); - /* Outils */ + /* Options */ - result->tools = build_menu_tools(ref, result); - gtk_container_add(GTK_CONTAINER(item->widget), result->tools); + result->options = build_menu_options(ref, result); + gtk_container_add(GTK_CONTAINER(item->widget), result->options); /* Greffons */ diff --git a/src/gui/menus/options.c b/src/gui/menus/options.c new file mode 100644 index 0000000..3702d42 --- /dev/null +++ b/src/gui/menus/options.c @@ -0,0 +1,144 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * options.c - gestion du menu 'Options' + * + * Copyright (C) 2019 Cyrille Bagard + * + * This binary is part of Chrysalide. + * + * Chrysalide 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. + * + * Chrysalide 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + +#include "options.h" + + +#include + + +#include "../editem-int.h" +#include "../dialogs/identity.h" +#include "../dialogs/preferences.h" +#include "../../gtkext/easygtk.h" + + + +/* Réagit au menu "Options -> Préférences". */ +static void mcb_options_preferences(GtkMenuItem *, GMenuBar *); + +/* Réagit au menu "Options -> Identité". */ +static void mcb_options_identity(GtkMenuItem *, GMenuBar *); + + + +/****************************************************************************** +* * +* Paramètres : ref = espace de référencement global. * +* bar = barre de menu parente. * +* * +* Description : Construit le menu "Options". * +* * +* Retour : Panneau de menus mis en place. * +* * +* Remarques : - * +* * +******************************************************************************/ + +GtkWidget *build_menu_options(GObject *ref, GMenuBar *bar) +{ + GtkWidget *result; /* Support à retourner */ + GtkWidget *menubar; /* Support pour éléments */ + GtkWidget *submenuitem; /* Sous-élément de menu */ + + result = gtk_menu_item_new_with_mnemonic(_("_Options")); + gtk_widget_show(result); + + menubar = qck_create_menu(GTK_MENU_ITEM(result)); + + submenuitem = qck_create_menu_item(ref, "mnu_options_preferences", _("Preferences"), + G_CALLBACK(mcb_options_preferences), bar); + gtk_container_add(GTK_CONTAINER(menubar), submenuitem); + + submenuitem = qck_create_menu_item(ref, "mnu_options_identity", _("Identity"), + G_CALLBACK(mcb_options_identity), bar); + gtk_container_add(GTK_CONTAINER(menubar), submenuitem); + + return result; + +} + + +/****************************************************************************** +* * +* Paramètres : menuitem = élément de menu sélectionné. * +* bar = barre de menu parente. * +* * +* Description : Réagit au menu "Options -> Préférences". * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void mcb_options_preferences(GtkMenuItem *menuitem, GMenuBar *bar) +{ + GObject *ref; /* Espace de référencements */ + GtkBuilder *builder; /* Constructeur utilisé */ + GtkWidget *dialog; /* Boîte de dialogue à montrer */ + + ref = g_editor_item_get_global_ref(G_EDITOR_ITEM(bar)); + + dialog = create_preferences_dialog(GTK_WINDOW(ref), &builder); + + gtk_dialog_run(GTK_DIALOG(dialog)); + + gtk_widget_destroy(dialog); + + g_object_unref(G_OBJECT(builder)); + +} + + +/****************************************************************************** +* * +* Paramètres : menuitem = élément de menu sélectionné. * +* bar = barre de menu parente. * +* * +* Description : Réagit au menu "Options -> Identité". * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void mcb_options_identity(GtkMenuItem *menuitem, GMenuBar *bar) +{ + GObject *ref; /* Espace de référencements */ + GtkBuilder *builder; /* Constructeur utilisé */ + GtkWidget *dialog; /* Boîte de dialogue à montrer */ + + ref = g_editor_item_get_global_ref(G_EDITOR_ITEM(bar)); + + dialog = create_identity_dialog(GTK_WINDOW(ref), &builder); + + gtk_dialog_run(GTK_DIALOG(dialog)); + + gtk_widget_destroy(dialog); + + g_object_unref(G_OBJECT(builder)); + +} diff --git a/src/gui/menus/options.h b/src/gui/menus/options.h new file mode 100644 index 0000000..f73d659 --- /dev/null +++ b/src/gui/menus/options.h @@ -0,0 +1,41 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * options.h - prototypes pour la gestion du menu 'Options' + * + * Copyright (C) 2019 Cyrille Bagard + * + * This binary is part of Chrysalide. + * + * Chrysalide 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. + * + * Chrysalide 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + +#ifndef _GUI_MENUS_OPTIONS_H +#define _GUI_MENUS_OPTIONS_H + + +#include + + +#include "menubar.h" + + + +/* Construit le menu "Options". */ +GtkWidget *build_menu_options(GObject *, GMenuBar *); + + + +#endif /* _GUI_MENUS_OPTIONS_H */ diff --git a/src/gui/menus/tools.c b/src/gui/menus/tools.c deleted file mode 100644 index d606c02..0000000 --- a/src/gui/menus/tools.c +++ /dev/null @@ -1,104 +0,0 @@ - -/* Chrysalide - Outil d'analyse de fichiers binaires - * tools.c - gestion du menu 'Outils' - * - * Copyright (C) 2017 Cyrille Bagard - * - * This binary is part of Chrysalide. - * - * Chrysalide 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. - * - * Chrysalide 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 this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - -#include "tools.h" - - -#include - - -#include "../editem-int.h" -#include "../dialogs/identity.h" -#include "../../gtkext/easygtk.h" - - - -/* Réagit au menu "Outils -> Identité". */ -static void mcb_tools_identity(GtkMenuItem *, GMenuBar *); - - - -/****************************************************************************** -* * -* Paramètres : ref = espace de référencement global. * -* bar = barre de menu parente. * -* * -* Description : Construit le menu "Outils". * -* * -* Retour : Panneau de menus mis en place. * -* * -* Remarques : - * -* * -******************************************************************************/ - -GtkWidget *build_menu_tools(GObject *ref, GMenuBar *bar) -{ - GtkWidget *result; /* Support à retourner */ - GtkWidget *menubar; /* Support pour éléments */ - GtkWidget *submenuitem; /* Sous-élément de menu */ - - result = gtk_menu_item_new_with_mnemonic(_("_Tools")); - gtk_widget_show(result); - - menubar = qck_create_menu(GTK_MENU_ITEM(result)); - - submenuitem = qck_create_menu_item(ref, "mnu_tools_identity", _("Identity"), - G_CALLBACK(mcb_tools_identity), bar); - gtk_container_add(GTK_CONTAINER(menubar), submenuitem); - - return result; - -} - - -/****************************************************************************** -* * -* Paramètres : menuitem = élément de menu sélectionné. * -* bar = barre de menu parente. * -* * -* Description : Réagit au menu "Outils -> Identité". * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static void mcb_tools_identity(GtkMenuItem *menuitem, GMenuBar *bar) -{ - GObject *ref; /* Espace de référencements */ - GtkBuilder *builder; /* Constructeur utilisé */ - GtkWidget *dialog; /* Boîte de dialogue à montrer */ - - ref = g_editor_item_get_global_ref(G_EDITOR_ITEM(bar)); - - dialog = create_identity_dialog(GTK_WINDOW(ref), &builder); - - gtk_dialog_run(GTK_DIALOG(dialog)); - - gtk_widget_destroy(dialog); - - g_object_unref(G_OBJECT(builder)); - -} diff --git a/src/gui/menus/tools.h b/src/gui/menus/tools.h deleted file mode 100644 index 441e46d..0000000 --- a/src/gui/menus/tools.h +++ /dev/null @@ -1,41 +0,0 @@ - -/* Chrysalide - Outil d'analyse de fichiers binaires - * tools.h - prototypes pour la gestion du menu 'Outils' - * - * Copyright (C) 2017 Cyrille Bagard - * - * This binary is part of Chrysalide. - * - * Chrysalide 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. - * - * Chrysalide 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 this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - -#ifndef _GUI_MENUS_TOOLS_H -#define _GUI_MENUS_TOOLS_H - - -#include - - -#include "menubar.h" - - - -/* Construit le menu "Outils". */ -GtkWidget *build_menu_tools(GObject *, GMenuBar *); - - - -#endif /* _GUI_MENUS_TOOLS_H */ -- cgit v0.11.2-87-g4458