diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2024-06-04 10:34:24 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2024-06-04 10:36:13 (GMT) |
commit | 4218b6e8f87893a31c292dbb32c328b81e18ec61 (patch) | |
tree | aa2e56259aef63dde37fa93e80dc02eb0b512906 /src/glibext/options/hex.c | |
parent | 20e004389791cce24682a426a183a665247e2920 (diff) |
Define rendering options for content views.
Diffstat (limited to 'src/glibext/options/hex.c')
-rw-r--r-- | src/glibext/options/hex.c | 169 |
1 files changed, 169 insertions, 0 deletions
diff --git a/src/glibext/options/hex.c b/src/glibext/options/hex.c new file mode 100644 index 0000000..5804a57 --- /dev/null +++ b/src/glibext/options/hex.c @@ -0,0 +1,169 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * hex.c - options de rendus de code héxadécimal + * + * Copyright (C) 2024 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 "hex.h" + + +#include <assert.h> + + +#include <i18n.h> + + +#include "hex-int.h" + + + +/* Initialise la classe des options pour le rendu d'hexadécimal. */ +static void g_hex_options_class_init(GHexOptionsClass *); + +/* Initialise une instance d'options pour le rendu d'hexa. */ +static void g_hex_options_init(GHexOptions *); + +/* Supprime toutes les références externes. */ +static void g_hex_options_dispose(GHexOptions *); + +/* Procède à la libération totale de la mémoire. */ +static void g_hex_options_finalize(GHexOptions *); + + + +/* Indique le type défini pour une ligne de représentation. */ +G_DEFINE_TYPE(GHexOptions, g_hex_options, G_TYPE_DISPLAY_OPTIONS); + + +/****************************************************************************** +* * +* Paramètres : klass = classe à initialiser. * +* * +* Description : Initialise la classe des options pour le rendu d'hexadécimal.* +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void g_hex_options_class_init(GHexOptionsClass *klass) +{ + GObjectClass *object; /* Autre version de la classe */ + + object = G_OBJECT_CLASS(klass); + + object->dispose = (GObjectFinalizeFunc/* ! */)g_hex_options_dispose; + object->finalize = (GObjectFinalizeFunc)g_hex_options_finalize; + +} + + +/****************************************************************************** +* * +* Paramètres : options = instance à initialiser. * +* * +* Description : Initialise une instance d'options pour le rendu d'hexa. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void g_hex_options_init(GHexOptions *options) +{ +#ifndef NDEBUG + bool status; /* Bilan d'un appel */ +#endif + +#ifndef NDEBUG + status = g_display_options_create(G_DISPLAY_OPTIONS(options), +#else + g_display_options_create(G_DISPLAY_OPTIONS(options), +#endif + (const char *[]) { _("Offset") }, + (const bool []) { true }, + 1); + + assert(status); + +} + + +/****************************************************************************** +* * +* Paramètres : options = instance d'objet GLib à traiter. * +* * +* Description : Supprime toutes les références externes. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void g_hex_options_dispose(GHexOptions *options) +{ + G_OBJECT_CLASS(g_hex_options_parent_class)->dispose(G_OBJECT(options)); + +} + + +/****************************************************************************** +* * +* Paramètres : options = instance d'objet GLib à traiter. * +* * +* Description : Procède à la libération totale de la mémoire. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void g_hex_options_finalize(GHexOptions *options) +{ + G_OBJECT_CLASS(g_hex_options_parent_class)->finalize(G_OBJECT(options)); + +} + + +/****************************************************************************** +* * +* Paramètres : - * +* * +* Description : Crée un groupe d'options pour le rendu d'hexadécimal. * +* * +* Retour : Adresse de la structure mise en place. * +* * +* Remarques : - * +* * +******************************************************************************/ + +GHexOptions *g_hex_options_new(void) +{ + GHexOptions *result; /* Structure à retourner */ + + result = g_object_new(G_TYPE_HEX_OPTIONS, NULL); + + return result; + +} |