summaryrefslogtreecommitdiff
path: root/src/glibext/generators/hex.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/glibext/generators/hex.c')
-rw-r--r--src/glibext/generators/hex.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/glibext/generators/hex.c b/src/glibext/generators/hex.c
index 9285e00..7de2d6b 100644
--- a/src/glibext/generators/hex.c
+++ b/src/glibext/generators/hex.c
@@ -45,6 +45,7 @@ struct _GHexGenerator
GBinContent *content; /* Contenu à représenter */
gint left_start; /* Abscisse des impressions */
+ gint padding; /* Bourrage supplémentaire */
phys_t bytes_per_line; /* Nombre d'octets par ligne */
@@ -347,7 +348,7 @@ static void g_hex_generator_compute_cursor(const GHexGenerator *generator, gint
}
else
{
- x -= (bytes_width + COL_MARGIN);
+ x -= (bytes_width + COL_MARGIN + generator->padding + COL_MARGIN);
phys += (x / class->char_width);
@@ -571,6 +572,7 @@ GBinContent *g_hex_generator_get_content(const GHexGenerator *generator)
* Paramètres : generator = générateur à ajuster. *
* left = position de départ à gauche pour le texte. *
* show_pos = affichage des positions sur la gauche ? *
+* padding = bourrage entre les colonnes de brut et ASCII. *
* width = largeur maximale disponible. *
* *
* Description : Ajuste la génération à une nouvelle largeur de rendu. *
@@ -581,7 +583,7 @@ GBinContent *g_hex_generator_get_content(const GHexGenerator *generator)
* *
******************************************************************************/
-bool g_hex_generator_auto_fit(GHexGenerator *generator, gint left, bool show_pos, gint width)
+bool g_hex_generator_auto_fit(GHexGenerator *generator, gint left, bool show_pos, gint padding, gint width)
{
bool result; /* Bilan à faire remonter */
GHexGeneratorClass *class; /* Accès aux informations */
@@ -592,16 +594,14 @@ bool g_hex_generator_auto_fit(GHexGenerator *generator, gint left, bool show_pos
class = G_HEX_GENERATOR_GET_CLASS(generator);
generator->left_start = left;
+ generator->padding = padding;
if (show_pos)
generator->left_start += class->addr_width + COL_MARGIN;
for (i = 4; ; i += 4)
{
- requested = left;
-
- if (show_pos)
- requested += class->addr_width + COL_MARGIN;
+ requested = generator->left_start;
block_count = (i / 4);
@@ -609,7 +609,11 @@ bool g_hex_generator_auto_fit(GHexGenerator *generator, gint left, bool show_pos
requested += (block_count > 1 ? block_count - 1 : 0) * class->sep_width;
requested += COL_MARGIN;
+ requested += padding;
+ requested += COL_MARGIN;
+
requested += i * class->char_width;
+ requested += COL_MARGIN;
/* Limite atteinte ? */
if (requested > width)