diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/params.c | 3 | ||||
-rw-r--r-- | src/core/params.h | 1 | ||||
-rw-r--r-- | src/glibext/generators/hex.c | 36 |
3 files changed, 37 insertions, 3 deletions
diff --git a/src/core/params.c b/src/core/params.c index 4e89e2c..109593d 100644 --- a/src/core/params.c +++ b/src/core/params.c @@ -86,6 +86,9 @@ bool load_main_config_parameters(void) param = g_generic_config_create_param(config, MPK_TOOLTIP_MAX_STRINGS, CPT_INTEGER, 5); if (param == NULL) return false; + param = g_generic_config_create_param(config, MPK_HEX_UPPER_CASE, CPT_BOOLEAN, true); + if (param == NULL) return false; + param = g_generic_config_create_param(config, MPK_LINK_DEFAULT, CPT_COLOR, ((GdkRGBA []) { { 0, 0, 0, 1.0 } })); if (param == NULL) return false; diff --git a/src/core/params.h b/src/core/params.h index b2c72c9..6c4c062 100644 --- a/src/core/params.h +++ b/src/core/params.h @@ -47,6 +47,7 @@ #define MPK_SELECTION_LINE "gui.editor.views.selection_line" #define MPK_TOOLTIP_MAX_CALLS "gui.editor.views.tooltip_max_calls" #define MPK_TOOLTIP_MAX_STRINGS "gui.editor.views.tooltip_max_strings" +#define MPK_HEX_UPPER_CASE "gui.editor.views.hex.upper_case" #define MPK_LINK_DEFAULT "gui.editor.graph.link.default" #define MPK_LINK_BRANCH_TRUE "gui.editor.graph.link.branch_true" #define MPK_LINK_BRANCH_FALSE "gui.editor.graph.link.branch_false" diff --git a/src/glibext/generators/hex.c b/src/glibext/generators/hex.c index 744ca89..ab473b1 100644 --- a/src/glibext/generators/hex.c +++ b/src/glibext/generators/hex.c @@ -32,6 +32,7 @@ #include "../gbufferline.h" #include "../linegen-int.h" #include "../linesegment.h" +#include "../../core/params.h" @@ -442,6 +443,13 @@ static BufferLineFlags g_hex_generator_get_flags(const GHexGenerator *generator, static void g_hex_generator_print(GHexGenerator *generator, GBufferLine *line, size_t index, size_t repeat) { + GGenConfig *config; /* Configuration à consulter */ + bool upper_case; /* Casse des données en hexa */ +#ifndef NDEBUG + bool status; /* Bilan de la consultation */ +#endif + const char *hexa; /* Chaîne à considérer #0 */ + const char *ff; /* Chaîne à considérer #1 */ vmpa2t pos; /* Position définie à la volée */ phys_t got; /* Quantité affichable */ const bin_t *raw; /* Accès direct et brut */ @@ -449,8 +457,30 @@ static void g_hex_generator_print(GHexGenerator *generator, GBufferLine *line, s bin_t byte; /* Copie pour confort */ char tmp[2]; /* Représentation d'un octet */ - //static const char hexa[] = "0123456789abcdef"; - static const char hexa[] = "0123456789ABCDEF"; + static const char hexa_lower[] = "0123456789abcdef"; + static const char hexa_upper[] = "0123456789ABCDEF"; + static const char ff_lower[] = "ff"; + static const char ff_upper[] = "FF"; + + config = get_main_configuration(); + +#ifndef NDEBUG + status = g_generic_config_get_value(config, MPK_HEX_UPPER_CASE, &upper_case); + assert(status); +#else + g_generic_config_get_value(config, MPK_HEX_UPPER_CASE, &upper_case); +#endif + + if (upper_case) + { + hexa = hexa_upper; + ff = ff_upper; + } + else + { + hexa = hexa_lower; + ff = ff_lower; + } /* Position physique */ @@ -487,7 +517,7 @@ static void g_hex_generator_print(GHexGenerator *generator, GBufferLine *line, s g_buffer_line_append_text(line, BLC_BINARY, "00", 2, RTT_RAW_NULL, NULL); else if (byte == 0xff) - g_buffer_line_append_text(line, BLC_BINARY, "ff", 2, RTT_RAW_FULL, NULL); + g_buffer_line_append_text(line, BLC_BINARY, ff, 2, RTT_RAW_FULL, NULL); else { |