summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-03-11 19:47:05 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-03-11 19:47:05 (GMT)
commit0a190905f31d7c395e1b26efe3abe443687429e5 (patch)
treeb359fe59b6cbfb2cf40181ec0f1fdb24f17b5682 /src/gui
parentd53249c8021270a4070181d032da33e129c36e9f (diff)
Defined new config parameters for the edge colors.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/dialogs/Makefile.am4
-rw-r--r--src/gui/dialogs/gresource.xml2
-rw-r--r--src/gui/dialogs/preferences.c270
-rw-r--r--src/gui/dialogs/preferences.ui145
-rw-r--r--src/gui/dialogs/prefs_fgraph.c196
-rw-r--r--src/gui/dialogs/prefs_fgraph.h46
-rw-r--r--src/gui/dialogs/prefs_fgraph.ui150
-rw-r--r--src/gui/dialogs/prefs_labels.c102
-rw-r--r--src/gui/dialogs/prefs_labels.h46
-rw-r--r--src/gui/dialogs/prefs_labels.ui150
-rw-r--r--src/gui/panels/regedit.c11
11 files changed, 976 insertions, 146 deletions
diff --git a/src/gui/dialogs/Makefile.am b/src/gui/dialogs/Makefile.am
index 755ddbd..869fa7a 100644
--- a/src/gui/dialogs/Makefile.am
+++ b/src/gui/dialogs/Makefile.am
@@ -7,6 +7,8 @@ UI_FILES = \
bookmark.ui \
identity.ui \
preferences.ui \
+ prefs_fgraph.ui \
+ prefs_labels.ui \
storage.ui
libguidialogs_la_SOURCES = \
@@ -18,6 +20,8 @@ libguidialogs_la_SOURCES = \
identity.h identity.c \
plugins.h plugins.c \
preferences.h preferences.c \
+ prefs_fgraph.h prefs_fgraph.c \
+ prefs_labels.h prefs_labels.c \
resources.h resources.c \
storage.h storage.c
diff --git a/src/gui/dialogs/gresource.xml b/src/gui/dialogs/gresource.xml
index b6e3c32..ff606ba 100644
--- a/src/gui/dialogs/gresource.xml
+++ b/src/gui/dialogs/gresource.xml
@@ -4,6 +4,8 @@
<file compressed="true">bookmark.ui</file>
<file compressed="true">identity.ui</file>
<file compressed="true">preferences.ui</file>
+ <file compressed="true">prefs_fgraph.ui</file>
+ <file compressed="true">prefs_labels.ui</file>
<file compressed="true">storage.ui</file>
</gresource>
</gresources>
diff --git a/src/gui/dialogs/preferences.c b/src/gui/dialogs/preferences.c
index dcb4cc7..8fd1961 100644
--- a/src/gui/dialogs/preferences.c
+++ b/src/gui/dialogs/preferences.c
@@ -27,6 +27,92 @@
#include <i18n.h>
+#include "prefs_fgraph.h"
+#include "prefs_labels.h"
+#include "../../core/params.h"
+
+
+
+/* Constructeur de panneau de paramétrage */
+typedef GtkWidget * (* prefs_panel_creation_cb) (GtkBuilder **);
+
+/* Chargement de la configuration */
+typedef void (* prefs_config_update_cb) (GtkBuilder *, GGenConfig *);
+
+/* Description d'un noeud de préférences */
+typedef struct _pref_node_desc_t
+{
+ prefs_panel_creation_cb create; /* Procédure de création */
+ prefs_config_update_cb load; /* Procédure de chargement */
+ prefs_config_update_cb store; /* Procédure d'enregistrement */
+
+ const char *name; /* Désignation interne */
+ const char *title; /* Désignation humaine */
+
+ GtkBuilder *builder; /* Constructeur GTK */
+ GtkWidget *panel; /* Panneau GTK */
+
+ struct _pref_node_desc_t *children; /* Sous-arborescence */
+
+} pref_node_desc_t;
+
+
+#define PREF_NODE_NULL_ENTRY { .title = NULL }
+
+
+/* Liste des paramétrages à afficher */
+static pref_node_desc_t _prefs_nodes[] = {
+
+ {
+ .create = NULL,
+
+ .title = "Analysis",
+
+ .children = (pref_node_desc_t []){
+
+ {
+ .create = create_labels_preferences,
+ .load = load_labels_configuration,
+ .store = store_labels_configuration,
+
+ .name = "labels",
+ .title = "Colored labels",
+
+ },
+
+ PREF_NODE_NULL_ENTRY
+
+ }
+
+ },
+
+ {
+ .create = NULL,
+
+ .title = "Editor",
+
+ .children = (pref_node_desc_t []){
+
+ {
+ .create = create_fgraph_preferences,
+ .load = load_fgraph_configuration,
+ .store = store_fgraph_configuration,
+
+ .name = "fgraph",
+ .title = "Function graph",
+
+ },
+
+ PREF_NODE_NULL_ENTRY
+
+ }
+
+ },
+
+ PREF_NODE_NULL_ENTRY
+
+};
+
/* Eléments de la liste de sections */
typedef enum _PrefListItem
@@ -37,6 +123,71 @@ typedef enum _PrefListItem
} PrefListItem;
+/* Ajoute un panneau de paramétrage à la boîte de dialogue. */
+static void add_preferences_node(GtkTreeStore *, GtkTreeIter *, GGenConfig *, GtkStack *, pref_node_desc_t *);
+
+/* Affiche le panneau correspondant au noeud sélectionné. */
+static void on_prefs_selection_changed(GtkTreeSelection *, GtkBuilder *);
+
+/* Lance la sauvegarde d'éléments de paramétrage. */
+static void store_preferences_node(GGenConfig *, pref_node_desc_t *);
+
+/* Sauvegarde l'ensemble des paramètres de configuration. */
+static void on_prefs_apply_button_clicked(GtkButton *, GtkBuilder *);
+
+
+
+/******************************************************************************
+* *
+* Paramètres : store = arborescence des sections à compléter. *
+* parent = point d'insertion du parent. *
+* config = configuration globale à charger. *
+* stack = pile de composants GTK à constituer. *
+* node = noeud de description courant à traiter. *
+* *
+* Description : Ajoute un panneau de paramétrage à la boîte de dialogue. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void add_preferences_node(GtkTreeStore *store, GtkTreeIter *parent, GGenConfig *config, GtkStack *stack, pref_node_desc_t *node)
+{
+ GtkTreeIter iter; /* Point d'insertion */
+ pref_node_desc_t *child; /* Sous-élément à traiter */
+
+ if (node->create == NULL)
+ {
+ node->builder = NULL;
+ node->panel = NULL;
+ }
+ else
+ {
+ node->panel = node->create(&node->builder);
+
+ node->load(node->builder, config);
+
+ gtk_widget_show(node->panel);
+
+ gtk_stack_add_named(stack, node->panel, node->name);
+
+ }
+
+ gtk_tree_store_append(store, &iter, parent);
+
+ gtk_tree_store_set(store, &iter,
+ PLI_TITLE, _(node->title),
+ PLI_PANEL, node->panel,
+ -1);
+
+ if (node->children != NULL)
+ for (child = node->children; child->title != NULL; child++)
+ add_preferences_node(store, &iter, config, stack, child);
+
+}
+
/******************************************************************************
* *
@@ -55,8 +206,11 @@ GtkWidget *create_preferences_dialog(GtkWindow *parent, GtkBuilder **outb)
{
GtkWidget *result; /* Fenêtre à renvoyer */
GtkBuilder *builder; /* Constructeur utilisé */
+ GGenConfig *config; /* Configuration globale */
+ GtkStack *stack; /* Pile à mettre à jour */
GtkTreeStore *store; /* Arborescence des sections */
- GtkTreeIter iter; /* Point d'insertion */
+ pref_node_desc_t *iter; /* Boucle de parcours */
+ GtkTreeView *treeview; /* Arborescence principale */
builder = gtk_builder_new_from_resource("/org/chrysalide/gui/dialogs/preferences.ui");
*outb = builder;
@@ -67,27 +221,123 @@ GtkWidget *create_preferences_dialog(GtkWindow *parent, GtkBuilder **outb)
/* Intégration des différentes sections */
+ config = get_main_configuration();
+
+ stack = GTK_STACK(gtk_builder_get_object(builder, "stack"));
+
store = GTK_TREE_STORE(gtk_builder_get_object(builder, "pref_list"));
- gtk_tree_store_append(store, &iter, NULL);
+ for (iter = _prefs_nodes; iter->title != NULL; iter++)
+ add_preferences_node(store, NULL, config, stack, iter);
- gtk_tree_store_set(store, &iter,
- PLI_TITLE, _("Colored labels"),
- PLI_PANEL, gtk_builder_get_object(builder, "colored_labels_panel"),
- -1);
+ treeview = GTK_TREE_VIEW(gtk_builder_get_object(builder, "treeview"));
- /* Mise à jour de l'interface */
+ gtk_tree_view_expand_all(treeview);
/* Connexion des signaux */
- /*
gtk_builder_add_callback_symbols(builder,
- "update_preferences", G_CALLBACK(update_preferences),
+ "on_prefs_selection_changed", G_CALLBACK(on_prefs_selection_changed),
+ "on_prefs_apply_button_clicked", G_CALLBACK(on_prefs_apply_button_clicked),
NULL);
- */
gtk_builder_connect_signals(builder, builder);
return result;
}
+
+
+/******************************************************************************
+* *
+* Paramètres : selection = sélection courante de l'arborescence des options.*
+* builder = constructeur GTK avec toutes les références. *
+* *
+* Description : Affiche le panneau correspondant au noeud sélectionné. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void on_prefs_selection_changed(GtkTreeSelection *selection, GtkBuilder *builder)
+{
+ GtkTreeModel *model; /* Gestionnaire de données */
+ GtkTreeIter iter; /* Position courante */
+ GtkWidget *panel; /* Panneau à mettre en avant */
+ GtkStack *stack; /* Pile à mettre à jour */
+
+ if (gtk_tree_selection_get_selected(selection, &model, &iter))
+ {
+ gtk_tree_model_get(model, &iter, PLI_PANEL, &panel, -1);
+
+ stack = GTK_STACK(gtk_builder_get_object(builder, "stack"));
+
+ if (panel == NULL)
+ gtk_stack_set_visible_child_name(stack, "empty");
+
+ else
+ {
+ gtk_stack_set_visible_child(stack, panel);
+
+ g_object_unref(G_OBJECT(panel));
+
+ }
+
+ }
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : config = configuration globale à actualiser. *
+* node = noeud de description courant à traiter. *
+* *
+* Description : Lance la sauvegarde d'éléments de paramétrage. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void store_preferences_node(GGenConfig *config, pref_node_desc_t *node)
+{
+ pref_node_desc_t *child; /* Sous-élément à traiter */
+
+ if (node->create != NULL)
+ node->store(node->builder, config);
+
+ if (node->children != NULL)
+ for (child = node->children; child->title != NULL; child++)
+ store_preferences_node(config, child);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : button = bouton GTK à l'origine de l'opération. *
+* builder = constructeur GTK avec toutes les références. *
+* *
+* Description : Sauvegarde l'ensemble des paramètres de configuration. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void on_prefs_apply_button_clicked(GtkButton *button, GtkBuilder *builder)
+{
+ GGenConfig *config; /* Configuration globale */
+ pref_node_desc_t *iter; /* Boucle de parcours */
+
+ config = get_main_configuration();
+
+ for (iter = _prefs_nodes; iter->title != NULL; iter++)
+ store_preferences_node(config, iter);
+
+}
diff --git a/src/gui/dialogs/preferences.ui b/src/gui/dialogs/preferences.ui
index 2760399..251ef46 100644
--- a/src/gui/dialogs/preferences.ui
+++ b/src/gui/dialogs/preferences.ui
@@ -2,23 +2,6 @@
<!-- Generated with glade 3.21.0 -->
<interface>
<requires lib="gtk+" version="3.20"/>
- <object class="GtkListStore" id="colored_label_types">
- <columns>
- <!-- column-name name -->
- <column type="gchararray"/>
- </columns>
- <data>
- <row>
- <col id="0" translatable="yes">global colored labels</col>
- </row>
- <row>
- <col id="0" translatable="yes">colored labels for symbols</col>
- </row>
- <row>
- <col id="0" translatable="yes">colored labels for basic blocks</col>
- </row>
- </data>
- </object>
<object class="GtkTreeStore" id="pref_list">
<columns>
<!-- column-name title -->
@@ -68,6 +51,7 @@
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
+ <signal name="clicked" handler="on_prefs_apply_button_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
@@ -97,13 +81,15 @@
<property name="margin_top">8</property>
<property name="shadow_type">in</property>
<child>
- <object class="GtkTreeView">
+ <object class="GtkTreeView" id="treeview">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="model">pref_list</property>
<property name="headers_visible">False</property>
<child internal-child="selection">
- <object class="GtkTreeSelection"/>
+ <object class="GtkTreeSelection">
+ <signal name="changed" handler="on_prefs_selection_changed" swapped="no"/>
+ </object>
</child>
<child>
<object class="GtkTreeViewColumn">
@@ -125,136 +111,23 @@
</packing>
</child>
<child>
- <object class="GtkStack">
+ <object class="GtkStack" id="stack">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">8</property>
<property name="margin_right">8</property>
<property name="margin_top">8</property>
<child>
- <object class="GtkBox" id="colored_labels_panel">
+ <object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
- <property name="spacing">8</property>
<child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">8</property>
- <child>
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Specify:</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkComboBox" id="colored_labels_combo">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="model">colored_label_types</property>
- <child>
- <object class="GtkCellRendererText"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">8</property>
- <child>
- <object class="GtkScrolledWindow">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="shadow_type">in</property>
- <child>
- <object class="GtkTreeView">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <child internal-child="selection">
- <object class="GtkTreeSelection"/>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkToolbar">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="orientation">vertical</property>
- <property name="toolbar_style">icons</property>
- <property name="show_arrow">False</property>
- <property name="icon_size">4</property>
- <child>
- <object class="GtkToolButton" id="colored_label_add">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="use_underline">True</property>
- <property name="icon_name">list-add</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
- </child>
- <child>
- <object class="GtkToolButton" id="colored_label_remove">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="use_underline">True</property>
- <property name="icon_name">list-remove</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
+ <placeholder/>
</child>
</object>
<packing>
- <property name="name">page0</property>
- <property name="title" translatable="yes">page0</property>
+ <property name="name">empty</property>
</packing>
</child>
</object>
diff --git a/src/gui/dialogs/prefs_fgraph.c b/src/gui/dialogs/prefs_fgraph.c
new file mode 100644
index 0000000..919647e
--- /dev/null
+++ b/src/gui/dialogs/prefs_fgraph.c
@@ -0,0 +1,196 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * prefs_fgraph.c - options relatives aux graphiques de fonction
+ *
+ * Copyright (C) 2019 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 <http://www.gnu.org/licenses/>.
+ */
+
+
+#include "prefs_fgraph.h"
+
+
+#include <assert.h>
+
+
+#include "../../core/params.h"
+
+
+
+/******************************************************************************
+* *
+* Paramètres : builder = constructeur à détruire après usage. [OUT] *
+* *
+* Description : Met en place un panneau de paramétrage pour graphiques. *
+* *
+* Retour : Adresse du composant GTK prêt à emploi. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GtkWidget *create_fgraph_preferences(GtkBuilder **builder)
+{
+ GtkWidget *result; /* Fenêtre à renvoyer */
+
+ *builder = gtk_builder_new_from_resource("/org/chrysalide/gui/dialogs/prefs_fgraph.ui");
+
+ result = GTK_WIDGET(gtk_builder_get_object(*builder, "panel"));
+
+ g_object_ref(G_OBJECT(result));
+
+ gtk_widget_unparent(result);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : builder = constructeur contenant les références du dialogue. *
+* config = configuration globale à consulter. *
+* *
+* Description : Charge la configuration des paramétrages pour graphiques. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void load_fgraph_configuration(GtkBuilder *builder, GGenConfig *config)
+{
+ GdkRGBA color; /* Couleur de lien définie */
+#ifndef NDEBUG
+ bool status; /* Validité d'une couleur */
+#endif
+ GtkColorChooser *chooser; /* Bouton de sélection */
+
+#ifndef NDEBUG
+ status = g_generic_config_get_value(config, MPK_LINK_DEFAULT, &color);
+ assert(status);
+#else
+ g_generic_config_get_value(config, MPK_LINK_DEFAULT, &color);
+#endif
+
+ chooser = GTK_COLOR_CHOOSER(gtk_builder_get_object(builder, "def_button"));
+
+ gtk_color_chooser_set_rgba(chooser, &color);
+
+#ifndef NDEBUG
+ status = g_generic_config_get_value(config, MPK_LINK_BRANCH_TRUE, &color);
+ assert(status);
+#else
+ g_generic_config_get_value(config, MPK_LINK_BRANCH_TRUE, &color);
+#endif
+
+ chooser = GTK_COLOR_CHOOSER(gtk_builder_get_object(builder, "true_button"));
+
+ gtk_color_chooser_set_rgba(chooser, &color);
+
+#ifndef NDEBUG
+ status = g_generic_config_get_value(config, MPK_LINK_BRANCH_FALSE, &color);
+ assert(status);
+#else
+ g_generic_config_get_value(config, MPK_LINK_BRANCH_FALSE, &color);
+#endif
+
+ chooser = GTK_COLOR_CHOOSER(gtk_builder_get_object(builder, "false_button"));
+
+ gtk_color_chooser_set_rgba(chooser, &color);
+
+#ifndef NDEBUG
+ status = g_generic_config_get_value(config, MPK_LINK_LOOP, &color);
+ assert(status);
+#else
+ g_generic_config_get_value(config, MPK_LINK_LOOP, &color);
+#endif
+
+ chooser = GTK_COLOR_CHOOSER(gtk_builder_get_object(builder, "loop_button"));
+
+ gtk_color_chooser_set_rgba(chooser, &color);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : builder = constructeur contenant les références du dialogue. *
+* config = configuration globale à consulter. *
+* *
+* Description : Sauvegarde la configuration des paramétrages pour graphiques.*
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void store_fgraph_configuration(GtkBuilder *builder, GGenConfig *config)
+{
+ GtkColorChooser *chooser; /* Bouton de sélection */
+ GdkRGBA color; /* Couleur de lien définie */
+#ifndef NDEBUG
+ bool status; /* Validité d'une couleur */
+#endif
+
+ chooser = GTK_COLOR_CHOOSER(gtk_builder_get_object(builder, "def_button"));
+
+ gtk_color_chooser_get_rgba(chooser, &color);
+
+#ifndef NDEBUG
+ status = g_generic_config_set_value(config, MPK_LINK_DEFAULT, &color);
+ assert(status);
+#else
+ g_generic_config_set_value(config, MPK_LINK_DEFAULT, &color);
+#endif
+
+ chooser = GTK_COLOR_CHOOSER(gtk_builder_get_object(builder, "true_button"));
+
+ gtk_color_chooser_get_rgba(chooser, &color);
+
+#ifndef NDEBUG
+ status = g_generic_config_set_value(config, MPK_LINK_BRANCH_TRUE, &color);
+ assert(status);
+#else
+ g_generic_config_set_value(config, MPK_LINK_BRANCH_TRUE, &color);
+#endif
+
+ chooser = GTK_COLOR_CHOOSER(gtk_builder_get_object(builder, "false_button"));
+
+ gtk_color_chooser_get_rgba(chooser, &color);
+
+#ifndef NDEBUG
+ status = g_generic_config_set_value(config, MPK_LINK_BRANCH_FALSE, &color);
+ assert(status);
+#else
+ g_generic_config_set_value(config, MPK_LINK_BRANCH_FALSE, &color);
+#endif
+
+ chooser = GTK_COLOR_CHOOSER(gtk_builder_get_object(builder, "loop_button"));
+
+ gtk_color_chooser_get_rgba(chooser, &color);
+
+#ifndef NDEBUG
+ status = g_generic_config_set_value(config, MPK_LINK_LOOP, &color);
+ assert(status);
+#else
+ g_generic_config_set_value(config, MPK_LINK_LOOP, &color);
+#endif
+
+}
diff --git a/src/gui/dialogs/prefs_fgraph.h b/src/gui/dialogs/prefs_fgraph.h
new file mode 100644
index 0000000..7d3b153
--- /dev/null
+++ b/src/gui/dialogs/prefs_fgraph.h
@@ -0,0 +1,46 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * prefs_fgraph.h - prototypes pour les options relatives aux graphiques de fonction
+ *
+ * Copyright (C) 2019 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 <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _GUI_DIALOGS_PREFS_FGRAPH_H
+#define _GUI_DIALOGS_PREFS_FGRAPH_H
+
+
+#include <gtk/gtk.h>
+
+
+#include "../../glibext/configuration.h"
+
+
+
+/* Met en place un panneau de paramétrage pour graphiques. */
+GtkWidget *create_fgraph_preferences(GtkBuilder **);
+
+/* Charge la configuration des paramétrages pour graphiques. */
+void load_fgraph_configuration(GtkBuilder *, GGenConfig *);
+
+/* Sauvegarde la configuration des paramétrages pour graphiques. */
+void store_fgraph_configuration(GtkBuilder *, GGenConfig *);
+
+
+
+#endif /* _GUI_DIALOGS_PREFS_FGRAPH_H */
diff --git a/src/gui/dialogs/prefs_fgraph.ui b/src/gui/dialogs/prefs_fgraph.ui
new file mode 100644
index 0000000..6f981cd
--- /dev/null
+++ b/src/gui/dialogs/prefs_fgraph.ui
@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.21.0 -->
+<interface>
+ <requires lib="gtk+" version="3.20"/>
+ <object class="GtkOffscreenWindow">
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkBox" id="panel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkFrame">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkAlignment">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkGrid">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="column_spacing">8</property>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Default link:</property>
+ <property name="xalign">1</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkColorButton" id="def_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Conditional branching (true):</property>
+ <property name="xalign">1</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Conditional branching (false):</property>
+ <property name="xalign">1</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Loop link:</property>
+ <property name="xalign">1</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkColorButton" id="true_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkColorButton" id="false_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkColorButton" id="loop_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">3</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Colors</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+</interface>
diff --git a/src/gui/dialogs/prefs_labels.c b/src/gui/dialogs/prefs_labels.c
new file mode 100644
index 0000000..51d012c
--- /dev/null
+++ b/src/gui/dialogs/prefs_labels.c
@@ -0,0 +1,102 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * prefs_labels.c - paramètres des étiquettes colorées
+ *
+ * Copyright (C) 2019 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 <http://www.gnu.org/licenses/>.
+ */
+
+
+#include "prefs_labels.h"
+
+
+
+/******************************************************************************
+* *
+* Paramètres : builder = constructeur à détruire après usage. [OUT] *
+* *
+* Description : Met en place un panneau de paramétrage d'étiquettes colorées.*
+* *
+* Retour : Adresse du composant GTK prêt à emploi. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GtkWidget *create_labels_preferences(GtkBuilder **builder)
+{
+ GtkWidget *result; /* Fenêtre à renvoyer */
+
+ *builder = gtk_builder_new_from_resource("/org/chrysalide/gui/dialogs/prefs_labels.ui");
+
+ result = GTK_WIDGET(gtk_builder_get_object(*builder, "panel"));
+
+ g_object_ref(G_OBJECT(result));
+
+ gtk_widget_unparent(result);
+
+ /* Connexion des signaux */
+
+ /*
+ gtk_builder_add_callback_symbols(builder,
+ "update_preferences", G_CALLBACK(update_preferences),
+ NULL);
+ */
+
+ gtk_builder_connect_signals(*builder, *builder);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : builder = constructeur contenant les références du dialogue. *
+* config = configuration globale à consulter. *
+* *
+* Description : Charge la configuration des paramétrages pour étiquettes. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void load_labels_configuration(GtkBuilder *builder, GGenConfig *config)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : builder = constructeur contenant les références du dialogue. *
+* config = configuration globale à consulter. *
+* *
+* Description : Sauvegarde la configuration des paramétrages pour étiquettes.*
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void store_labels_configuration(GtkBuilder *builder, GGenConfig *config)
+{
+
+}
diff --git a/src/gui/dialogs/prefs_labels.h b/src/gui/dialogs/prefs_labels.h
new file mode 100644
index 0000000..91ab1ab
--- /dev/null
+++ b/src/gui/dialogs/prefs_labels.h
@@ -0,0 +1,46 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * prefs_labels.h - prototypes pour les paramètres des étiquettes colorées
+ *
+ * Copyright (C) 2019 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 <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _GUI_DIALOGS_PREFS_LABELS_H
+#define _GUI_DIALOGS_PREFS_LABELS_H
+
+
+#include <gtk/gtk.h>
+
+
+#include "../../glibext/configuration.h"
+
+
+
+/* Met en place un panneau de paramétrage d'étiquettes colorées. */
+GtkWidget *create_labels_preferences(GtkBuilder **);
+
+/* Charge la configuration des paramétrages pour étiquettes. */
+void load_labels_configuration(GtkBuilder *, GGenConfig *);
+
+/* Sauvegarde la configuration des paramétrages pour étiquettes. */
+void store_labels_configuration(GtkBuilder *, GGenConfig *);
+
+
+
+#endif /* _GUI_DIALOGS_PREFS_LABELS_H */
diff --git a/src/gui/dialogs/prefs_labels.ui b/src/gui/dialogs/prefs_labels.ui
new file mode 100644
index 0000000..9bdbec6
--- /dev/null
+++ b/src/gui/dialogs/prefs_labels.ui
@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.21.0 -->
+<interface>
+ <requires lib="gtk+" version="3.20"/>
+ <object class="GtkOffscreenWindow">
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkBox" id="panel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">8</property>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">8</property>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Specify:</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="colored_labels_combo">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="model">colored_label_types</property>
+ <child>
+ <object class="GtkCellRendererText"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">8</property>
+ <child>
+ <object class="GtkScrolledWindow">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection"/>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToolbar">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="toolbar_style">icons</property>
+ <property name="show_arrow">False</property>
+ <property name="icon_size">4</property>
+ <child>
+ <object class="GtkToolButton" id="colored_label_add">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="use_underline">True</property>
+ <property name="icon_name">list-add</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToolButton" id="colored_label_remove">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="use_underline">True</property>
+ <property name="icon_name">list-remove</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <object class="GtkListStore" id="colored_label_types">
+ <columns>
+ <!-- column-name name -->
+ <column type="gchararray"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0" translatable="yes">global colored labels</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">colored labels for symbols</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">colored labels for basic blocks</col>
+ </row>
+ </data>
+ </object>
+</interface>
diff --git a/src/gui/panels/regedit.c b/src/gui/panels/regedit.c
index 8ecc99b..db98f28 100644
--- a/src/gui/panels/regedit.c
+++ b/src/gui/panels/regedit.c
@@ -400,6 +400,10 @@ static void reload_config_into_treeview(GRegeditPanel *panel, GGenConfig *config
type_desc = _("String");
break;
+ case CPT_COLOR:
+ type_desc = _("Color");
+ break;
+
default:
type_desc = _("<Unknown type>");
break;
@@ -536,6 +540,10 @@ static void update_config_param_value(GtkListStore *store, GtkTreeIter *iter)
desc = (string != NULL ? string : "");
break;
+ case CPT_COLOR:
+ desc = "<color>";
+ break;
+
default:
assert(false);
desc = "???";
@@ -723,6 +731,9 @@ static void on_param_value_edited(GtkCellRendererText *renderer, gchar *path, gc
g_config_param_set_value(param, new);
break;
+ case CPT_COLOR:
+ break;
+
default:
assert(false);
goto opve_bad_value;