diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2019-03-11 19:47:05 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2019-03-11 19:47:05 (GMT) |
commit | 0a190905f31d7c395e1b26efe3abe443687429e5 (patch) | |
tree | b359fe59b6cbfb2cf40181ec0f1fdb24f17b5682 /src/gui/dialogs/prefs_fgraph.c | |
parent | d53249c8021270a4070181d032da33e129c36e9f (diff) |
Defined new config parameters for the edge colors.
Diffstat (limited to 'src/gui/dialogs/prefs_fgraph.c')
-rw-r--r-- | src/gui/dialogs/prefs_fgraph.c | 196 |
1 files changed, 196 insertions, 0 deletions
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 + +} |