Ethereal-dev: Re: [Ethereal-dev] select field in 2nd pane (tree), 3rd pane (hex dump) rescroll

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

From: Gilbert Ramirez <gram@xxxxxxxxxx>
Date: Thu, 21 Dec 2000 11:56:50 -0500
On Thu, Dec 21, 2000 at 11:22:39AM -0500, Rich_Hall@xxxxxxxxxx wrote:
> Hi,
> 
> 4 items:
> 
> 1) This is a nit in the grand scheme of things here but it would help me
> with my decode work ;-)
> 
> I am using ethereal 0.8.14.1 on win2k. When I am digging into a packet's
> detail and working through the tree breakout it would be helpful if the hex
> dump pane would rescroll so that the beginning of the selected/highlighted
> hex data was at or near the top line in the displayed data. Currently it
> seems to be rescrolling such that the bottom of the selected hexdata is
> scrolled up so that it is displayed at or near the bottom line of visible
> data.
> 
> I have compiled my own version so if someone finds a quick and easy, change
> this (diffs) I can try them out.

This diff works for me on win2k. I don't want to check it in until I get
some comments from other Ethereal developers; I really don't know why
+4 and -6 are good constants for messing with pixels in GDK. I'd hate
to further this little hack by adding another arbitrary constant to the code.
But, it should be good enough to last until we come up with the
right solution.

--gilbert
Index: proto_draw.c
===================================================================
RCS file: /usr/local/cvsroot/ethereal/gtk/proto_draw.c,v
retrieving revision 1.23
diff -u -r1.23 proto_draw.c
--- proto_draw.c	2000/11/22 04:07:00	1.23
+++ proto_draw.c	2000/12/21 16:54:52
@@ -318,7 +318,11 @@
     linenum = bstart / BYTE_VIEW_WIDTH;
 
     /* need to change to some way of getting that offset instead of +4 */
+#ifdef WIN32
+    lineheight = gdk_string_height(m_b_font, "0") - 6;
+#else
     lineheight = gdk_string_height(m_b_font, "0") + 4;
+#endif
     scrollval = MIN(linenum * lineheight,bv->vadj->upper - bv->vadj->page_size);
 
     gtk_adjustment_set_value(bv->vadj, scrollval);