Ethereal-dev: Re: [ethereal-dev] Hex dump reverse video

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

Date Next Thread Next
From: Gilbert Ramirez <gram@xxxxxxxxxx>
Date: Thu, 01 Jun 2000 00:14:02 -0500
On Mon, May 29, 2000 at 09:11:06AM +0100, Graham Bloice wrote:
> Attached is a patch that changes the behaviour of the hex (and ASCII) dump
> to show the selected portion of the string in reverse video instead of bold
> characters.  This improves the display on win32, as the bold characters are
> wider than the medium ones.
> 
> It's a straight replacement for the existing medium/bold font highlighting.
> I haven't incorporated any option to switch behaviour, or removed the
> ability to set the font's from the command line.
> 
> Have a look and let me know if you think it's worth proceeding with, and
> I'll do another patch to either remove the font stuff, or add a command line
> switch, which I would like to default to on for Win32.

I like it. I think it will be very useful on Windows, and perhaps even on
Unix, if it's a user-selectable behavior.

One comment:

Index: gtk/proto_draw.c
===================================================================
RCS file: /cvsroot/ethereal/gtk/proto_draw.c,v
retrieving revision 1.17
diff -u -w -r1.17 proto_draw.c
--- proto_draw.c	2000/04/27 20:39:21	1.17
+++ proto_draw.c	2000/05/25 22:53:21
@@ -89,9 +89,17 @@
 		char_enc encoding) {
   gint     i = 0, j, k, cur;
   guchar   line[128], hexchars[] = "0123456789abcdef", c = '\0';
-  GdkFont *cur_font, *new_font;
   gint	   bend = -1;
 
+  GdkColor *black, *white, *fg, *bg;
+  gboolean reverse, newreverse;
+
+  /* Get some colors */
+  black = g_new(GdkColor, 1);
+  white = g_new(GdkColor, 1);
+  gdk_color_black(gdk_colormap_get_system(), black);
+  gdk_color_white(gdk_colormap_get_system(), white);


You may want to allocate and set black and white once at the beginning of
the program, and not allocate/set/free them for each packet_hex_print().

--gilbert