summaryrefslogtreecommitdiff
path: root/gtk/proto_draw.c
diff options
context:
space:
mode:
authorStephen Fisher <steve@stephen-fisher.com>2006-11-14 22:35:22 +0000
committerStephen Fisher <steve@stephen-fisher.com>2006-11-14 22:35:22 +0000
commit90303fb17f8bb45b6955c80856907cdfeb87cd86 (patch)
tree91af0265b418e44db60f65011b22c56b72a6fb07 /gtk/proto_draw.c
parentdd26a7021b0101cbfa469f1a752464740a2f99e7 (diff)
downloadwireshark-90303fb17f8bb45b6955c80856907cdfeb87cd86.tar.gz
New feature to automatically highlight the field found when doing a find.
This works for both string and hex searches. This resolves feature request bug #776. svn path=/trunk/; revision=19897
Diffstat (limited to 'gtk/proto_draw.c')
-rw-r--r--gtk/proto_draw.c33
1 files changed, 28 insertions, 5 deletions
diff --git a/gtk/proto_draw.c b/gtk/proto_draw.c
index cd0c047de7..f7221e50f5 100644
--- a/gtk/proto_draw.c
+++ b/gtk/proto_draw.c
@@ -386,15 +386,10 @@ byte_view_select(GtkWidget *widget, GdkEventButton *event)
GtkText *bv = GTK_TEXT(widget);
#else
GtkTreeView *tree_view;
- GtkTreeModel *model;
- GtkTreePath *first_path, *path;
- GtkTreeIter parent;
GtkTextView *bv = GTK_TEXT_VIEW(widget);
gint x, y;
GtkTextIter iter;
- struct field_lookup_info fli;
#endif
- field_info *finfo;
int row, column;
int byte;
tvbuff_t *tvb;
@@ -546,6 +541,34 @@ byte_view_select(GtkWidget *widget, GdkEventButton *event)
/* Get the data source tvbuff */
tvb = OBJECT_GET_DATA(widget, E_BYTE_VIEW_TVBUFF_KEY);
+#if GTK_MAJOR_VERSION < 2
+ return highlight_field(tvb, byte, ctree, tree);
+#else
+ return highlight_field(tvb, byte, tree_view, tree);
+#endif
+}
+
+/* This highlights the field in the proto tree that is at position byte */
+#if GTK_MAJOR_VERSION < 2
+gboolean
+highlight_field(tvbuff_t *tvb, gint byte, GtkCTree *ctree,
+ proto_tree *tree)
+#else
+gboolean
+highlight_field(tvbuff_t *tvb, gint byte, GtkTreeView *tree_view,
+ proto_tree *tree)
+#endif
+{
+#if GTK_MAJOR_VERSION < 2
+ GtkCTreeNode *node, *parent;
+#else
+ GtkTreeModel *model;
+ GtkTreePath *first_path, *path;
+ GtkTreeIter parent;
+ struct field_lookup_info fli;
+#endif
+ field_info *finfo;
+
/* Find the finfo that corresponds to our byte. */
finfo = proto_find_field_from_offset(tree, byte, tvb);