summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2009-11-05 10:16:49 +0000
committerStig Bjørlykke <stig@bjorlykke.org>2009-11-05 10:16:49 +0000
commit7c5f1b80ac3ea7e4dc5fc71215771695df99dfba (patch)
treeebeb70ad05293c57d1089a69d10721d39601fcbc /gtk
parentd0ad8bcdcffd04d5c1a080b73ac6077b53009ebb (diff)
downloadwireshark-7c5f1b80ac3ea7e4dc5fc71215771695df99dfba.tar.gz
Introduce packet bytes bit view.
svn path=/trunk/; revision=30832
Diffstat (limited to 'gtk')
-rw-r--r--gtk/font_utils.c4
-rw-r--r--gtk/keys.h2
-rw-r--r--gtk/main.c4
-rw-r--r--gtk/main_proto_draw.c246
-rw-r--r--gtk/main_proto_draw.h9
-rw-r--r--gtk/menus.c49
-rw-r--r--gtk/packet_win.c10
-rw-r--r--gtk/packet_win.h4
-rw-r--r--gtk/prefs_gui.c6
-rw-r--r--gtk/prefs_layout.c8
-rw-r--r--gtk/recent.c12
-rw-r--r--gtk/recent.h1
12 files changed, 259 insertions, 96 deletions
diff --git a/gtk/font_utils.c b/gtk/font_utils.c
index 3d0cb29204..50e4a5db4a 100644
--- a/gtk/font_utils.c
+++ b/gtk/font_utils.c
@@ -287,8 +287,8 @@ user_font_apply(void) {
old_b_font = m_b_font;
set_fonts(new_r_font, new_b_font);
- /* Redraw the hex dump windows. */
- redraw_hex_dump_all();
+ /* Redraw the packet bytes windows. */
+ redraw_packet_bytes_all();
/* Redraw the "Follow TCP Stream" windows. */
follow_tcp_redraw_all();
diff --git a/gtk/keys.h b/gtk/keys.h
index 2cada4618c..178053fb8c 100644
--- a/gtk/keys.h
+++ b/gtk/keys.h
@@ -45,7 +45,7 @@
#define PM_MENU_LIST_KEY "popup_menu_menu_list"
#define PM_PACKET_LIST_KEY "popup_menu_packet_list"
#define PM_TREE_VIEW_KEY "popup_menu_tree_view"
-#define PM_HEXDUMP_KEY "popup_menu_hexdump"
+#define PM_BYTES_VIEW_KEY "popup_menu_bytes_view"
#define E_TB_MAIN_KEY "toolbar_main"
#define E_TB_FILTER_KEY "toolbar_filter"
diff --git a/gtk/main.c b/gtk/main.c
index e7550ce963..7629de5c47 100644
--- a/gtk/main.c
+++ b/gtk/main.c
@@ -1534,7 +1534,7 @@ main_cf_cb_packet_selected(gpointer data)
{
capture_file *cf = data;
- /* Display the GUI protocol tree and hex dump.
+ /* Display the GUI protocol tree and packet bytes.
XXX - why do we dump core if we call "proto_tree_draw()"
before calling "add_byte_views()"? */
add_main_byte_views(cf->edt);
@@ -3342,7 +3342,7 @@ create_main_window (gint pl_size, gint tv_size, gint bv_size, e_prefs *prefs)
gtk_widget_show(byte_nb_ptr);
g_signal_connect(byte_nb_ptr, "button_press_event", G_CALLBACK(popup_menu_handler),
- g_object_get_data(G_OBJECT(popup_menu_object), PM_HEXDUMP_KEY));
+ g_object_get_data(G_OBJECT(popup_menu_object), PM_BYTES_VIEW_KEY));
/* Panes for the packet list, tree, and byte view */
main_pane_v1 = gtk_vpaned_new();
diff --git a/gtk/main_proto_draw.c b/gtk/main_proto_draw.c
index bb8b5e3ea0..eb87200fd1 100644
--- a/gtk/main_proto_draw.c
+++ b/gtk/main_proto_draw.c
@@ -70,6 +70,7 @@
#include "gtk/main.h"
#include "gtk/menus.h"
#include "gtk/main_proto_draw.h"
+#include "gtk/recent.h"
#if _WIN32
#include <gdk/gdkwin32.h>
@@ -81,6 +82,8 @@
#define BYTE_VIEW_WIDTH 16
#define BYTE_VIEW_SEP 8
+#define BIT_VIEW_WIDTH 8
+
#define E_BYTE_VIEW_TREE_PTR "byte_view_tree_ptr"
#define E_BYTE_VIEW_TREE_VIEW_PTR "byte_view_tree_view_ptr"
#define E_BYTE_VIEW_NDIGITS_KEY "byte_view_ndigits"
@@ -158,7 +161,7 @@ set_notebook_page(GtkWidget *nb_ptr, tvbuff_t *tvb)
/* Redraw a given byte view window. */
void
-redraw_hex_dump(GtkWidget *nb, frame_data *fd, field_info *finfo)
+redraw_packet_bytes(GtkWidget *nb, frame_data *fd, field_info *finfo)
{
GtkWidget *bv;
const guint8 *data;
@@ -174,12 +177,12 @@ redraw_hex_dump(GtkWidget *nb, frame_data *fd, field_info *finfo)
/* Redraw all byte view windows. */
void
-redraw_hex_dump_all(void)
+redraw_packet_bytes_all(void)
{
if (cfile.current_frame != NULL)
- redraw_hex_dump( byte_nb_ptr, cfile.current_frame, cfile.finfo_selected);
+ redraw_packet_bytes( byte_nb_ptr, cfile.current_frame, cfile.finfo_selected);
- redraw_hex_dump_packet_wins();
+ redraw_packet_bytes_packet_wins();
/* XXX - this is a hack, to workaround a bug in GTK2.x!
when changing the font size, even refilling of the corresponding
@@ -238,6 +241,7 @@ collapse_tree(GtkTreeView *tree_view, GtkTreeIter *iter,
#define MAX_OFFSET_LEN 8 /* max length of hex offset of bytes */
#define BYTES_PER_LINE 16 /* max byte values in a line */
+#define BITS_PER_LINE 8 /* max bit values in a line */
#define HEX_DUMP_LEN (BYTES_PER_LINE*3 + 1)
/* max number of characters hex dump takes -
2 digits plus trailing blank
@@ -262,6 +266,11 @@ byte_num(int offset, int start_point)
{
return (offset - start_point) / 3;
}
+static int
+bit_num(int offset, int start_point)
+{
+ return (offset - start_point) / 9;
+}
struct field_lookup_info {
field_info *fi;
@@ -296,23 +305,10 @@ GtkTreePath *tree_find_by_field_info(GtkTreeView *tree_view, field_info *finfo)
return gtk_tree_model_get_path(model, &fli.iter);
}
-/* If the user selected a certain byte in the byte view, try to find
- * the item in the GUI proto_tree that corresponds to that byte, and:
- *
- * if we succeed, select it, and return TRUE;
- * if we fail, return FALSE. */
-gboolean
-byte_view_select(GtkWidget *widget, GdkEventButton *event)
+static gboolean
+hex_view_get_byte(guint ndigits, int row, int column)
{
- proto_tree *tree;
- GtkTreeView *tree_view;
- GtkTextView *bv = GTK_TEXT_VIEW(widget);
- gint x, y;
- GtkTextIter iter;
- int row, column;
int byte;
- tvbuff_t *tvb;
- guint ndigits;
int digits_start_1;
int digits_end_1;
int digits_start_2;
@@ -323,12 +319,6 @@ byte_view_select(GtkWidget *widget, GdkEventButton *event)
int text_end_2;
/*
- * Get the number of digits of offset being displayed, and
- * compute the columns of various parts of the display.
- */
- ndigits = GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(bv), E_BYTE_VIEW_NDIGITS_KEY));
-
- /*
* The column of the first hex digit in the first half.
* That starts after "ndigits" digits of offset and two
* separating blanks.
@@ -368,18 +358,14 @@ byte_view_select(GtkWidget *widget, GdkEventButton *event)
* The column of the last "text dump" character in the first half.
* There are BYTES_PER_LINE/2 bytes displayed in the first
* half; there is 1 character per byte.
- *
- * Then subtract 1 to get the last column of the first half
- * rather than the first column after the first half.
*/
- text_end_1 = text_start_1 + BYTES_PER_LINE/2 - 1;
+ text_end_1 = text_start_1 + BYTES_PER_LINE/2;
/*
* The column of the first "text dump" character in the second half.
- * Add back the 1 to get the first column after the first half,
- * and then add 1 for the separating blank between the halves.
+ * Add 1 for the separating blank between the halves.
*/
- text_start_2 = text_end_1 + 2;
+ text_start_2 = text_end_1 + 1;
/*
* The column of the last "text dump" character in second half.
@@ -388,36 +374,18 @@ byte_view_select(GtkWidget *widget, GdkEventButton *event)
*/
text_end_2 = text_start_2 + BYTES_PER_LINE/2 - 1;
- tree = g_object_get_data(G_OBJECT(widget), E_BYTE_VIEW_TREE_PTR);
- if (tree == NULL) {
- /*
- * Somebody clicked on the dummy byte view; do nothing.
- */
- return FALSE;
- }
- tree_view = GTK_TREE_VIEW(g_object_get_data(G_OBJECT(widget),
- E_BYTE_VIEW_TREE_VIEW_PTR));
-
- /* get the row/column selected */
- gtk_text_view_window_to_buffer_coords(bv,
- gtk_text_view_get_window_type(bv, event->window),
- (gint) event->x, (gint) event->y, &x, &y);
- gtk_text_view_get_iter_at_location(bv, &iter, x, y);
- row = gtk_text_iter_get_line(&iter);
- column = gtk_text_iter_get_line_offset(&iter);
-
/* Given the column and row, determine which byte offset
* the user clicked on. */
if (column >= digits_start_1 && column <= digits_end_1) {
byte = byte_num(column, digits_start_1);
if (byte == -1) {
- return FALSE;
+ return byte;
}
}
else if (column >= digits_start_2 && column <= digits_end_2) {
byte = byte_num(column, digits_start_2);
if (byte == -1) {
- return FALSE;
+ return byte;
}
byte += 8;
}
@@ -430,11 +398,133 @@ byte_view_select(GtkWidget *widget, GdkEventButton *event)
else {
/* The user didn't select a hex digit or
* text-dump character. */
- return FALSE;
+ return -1;
+ }
+
+ /* Add the number of bytes from the previous rows. */
+ byte += row * BYTES_PER_LINE;
+
+ return byte;
+}
+
+static int
+bit_view_get_byte(guint ndigits, int row, int column)
+{
+ int byte;
+ int digits_start;
+ int digits_end;
+ int text_start;
+ int text_end;
+
+ /*
+ * The column of the first bit digit.
+ * That starts after "ndigits" digits of offset and two
+ * separating blanks.
+ */
+ digits_start = ndigits + 2;
+
+ /*
+ * The column of the last bit digit.
+ * There are BITS_PER_LINE bytes displayed; there are
+ * 8 characters per byte, plus a separating blank
+ * after all but the last byte's characters.
+ */
+ digits_end = digits_start + (BITS_PER_LINE)*8 +
+ (BITS_PER_LINE - 1);
+
+ /*
+ * The column of the first "text dump" character.
+ * Add 3 for the 3 separating blanks between the bit and text dump.
+ */
+ text_start = digits_end + 3;
+
+ /*
+ * The column of the last "text dump" character.
+ * There are BITS_PER_LINE bytes displayed; there is 1 character per byte.
+ *
+ * Then subtract 1 to get the last column.
+ */
+ text_end = text_start + BITS_PER_LINE - 1;
+
+ /* Given the column and row, determine which byte offset
+ * the user clicked on. */
+ if (column >= digits_start && column <= digits_end) {
+ byte = bit_num(column, digits_start);
+ if (byte == -1) {
+ return byte;
+ }
+ }
+ else if (column >= text_start && column <= text_end) {
+ byte = column - text_start;
+ }
+ else {
+ /* The user didn't select a hex digit or
+ * text-dump character. */
+ return -1;
}
/* Add the number of bytes from the previous rows. */
- byte += row * 16;
+ byte += row * BITS_PER_LINE;
+
+ return byte;
+}
+
+/* If the user selected a certain byte in the byte view, try to find
+ * the item in the GUI proto_tree that corresponds to that byte, and:
+ *
+ * if we succeed, select it, and return TRUE;
+ * if we fail, return FALSE. */
+gboolean
+byte_view_select(GtkWidget *widget, GdkEventButton *event)
+{
+ GtkTextView *bv = GTK_TEXT_VIEW(widget);
+ proto_tree *tree;
+ GtkTreeView *tree_view;
+ GtkTextIter iter;
+ int row, column;
+ guint ndigits;
+ gint x, y;
+ int byte;
+ tvbuff_t *tvb;
+
+ tree = g_object_get_data(G_OBJECT(widget), E_BYTE_VIEW_TREE_PTR);
+ if (tree == NULL) {
+ /*
+ * Somebody clicked on the dummy byte view; do nothing.
+ */
+ return FALSE;
+ }
+ tree_view = GTK_TREE_VIEW(g_object_get_data(G_OBJECT(widget),
+ E_BYTE_VIEW_TREE_VIEW_PTR));
+
+ /* get the row/column selected */
+ gtk_text_view_window_to_buffer_coords(bv,
+ gtk_text_view_get_window_type(bv, event->window),
+ (gint) event->x, (gint) event->y, &x, &y);
+ gtk_text_view_get_iter_at_location(bv, &iter, x, y);
+ row = gtk_text_iter_get_line(&iter);
+ column = gtk_text_iter_get_line_offset(&iter);
+
+ /*
+ * Get the number of digits of offset being displayed, and
+ * compute the byte position in the buffer.
+ */
+ ndigits = GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(bv), E_BYTE_VIEW_NDIGITS_KEY));
+
+ switch (recent.gui_bytes_view) {
+ case BYTES_HEX:
+ byte = hex_view_get_byte(ndigits, row, column);
+ break;
+ case BYTES_BITS:
+ byte = bit_view_get_byte(ndigits, row, column);
+ break;
+ default:
+ g_assert_not_reached();
+ }
+
+ if (byte == -1) {
+ return FALSE;
+ }
/* Get the data source tvbuff */
tvb = g_object_get_data(G_OBJECT(widget), E_BYTE_VIEW_TVBUFF_KEY);
@@ -600,7 +690,7 @@ add_byte_tab(GtkWidget *byte_nb, const char *name, tvbuff_t *tvb,
g_signal_connect(byte_view, "show", G_CALLBACK(byte_view_realize_cb), NULL);
g_signal_connect(byte_view, "button_press_event", G_CALLBACK(byte_view_button_press_cb),
- g_object_get_data(G_OBJECT(popup_menu_object), PM_HEXDUMP_KEY));
+ g_object_get_data(G_OBJECT(popup_menu_object), PM_BYTES_VIEW_KEY));
g_object_set_data(G_OBJECT(byte_view), E_BYTE_VIEW_TREE_PTR, tree);
g_object_set_data(G_OBJECT(byte_view), E_BYTE_VIEW_TREE_VIEW_PTR, tree_view);
@@ -1023,7 +1113,7 @@ static void
packet_hex_print_common(GtkWidget *bv, const guint8 *pd, int len, int bstart,
int bend, int astart, int aend, int encoding)
{
- int i = 0, j, k, cur;
+ int i = 0, j, k = 0, cur;
guchar line[MAX_LINES_LEN + 1];
static guchar hexchars[16] = {
'0', '1', '2', '3', '4', '5', '6', '7',
@@ -1149,7 +1239,16 @@ packet_hex_print_common(GtkWidget *bv, const guint8 *pd, int len, int bstart,
/* Do we start in reverse? */
reverse = (i >= bstart && i < bend) || (i >= astart && i < aend);
j = i;
- k = i + BYTE_VIEW_WIDTH;
+ switch (recent.gui_bytes_view) {
+ case BYTES_HEX:
+ k = i + BYTE_VIEW_WIDTH;
+ break;
+ case BYTES_BITS:
+ k = i + BIT_VIEW_WIDTH;
+ break;
+ default:
+ g_assert_not_reached();
+ }
if (reverse) {
gtk_text_buffer_insert_with_tags_by_name(buf, &iter, line, cur,
"plain", NULL);
@@ -1158,10 +1257,31 @@ packet_hex_print_common(GtkWidget *bv, const guint8 *pd, int len, int bstart,
/* Print the hex bit */
while (i < k) {
if (i < len) {
- line[cur++] = hexchars[(pd[i] & 0xf0) >> 4];
- line[cur++] = hexchars[pd[i] & 0x0f];
+ switch (recent.gui_bytes_view) {
+ case BYTES_HEX:
+ line[cur++] = hexchars[(pd[i] & 0xf0) >> 4];
+ line[cur++] = hexchars[pd[i] & 0x0f];
+ break;
+ case BYTES_BITS:
+ line[cur++] = (pd[i] & 0x80) ? '1' : '0';
+ line[cur++] = (pd[i] & 0x40) ? '1' : '0';
+ line[cur++] = (pd[i] & 0x20) ? '1' : '0';
+ line[cur++] = (pd[i] & 0x10) ? '1' : '0';
+ line[cur++] = (pd[i] & 0x08) ? '1' : '0';
+ line[cur++] = (pd[i] & 0x04) ? '1' : '0';
+ line[cur++] = (pd[i] & 0x02) ? '1' : '0';
+ line[cur++] = (pd[i] & 0x01) ? '1' : '0';
+ break;
+ default:
+ g_assert_not_reached();
+ }
} else {
line[cur++] = ' '; line[cur++] = ' ';
+ if (recent.gui_bytes_view == BYTES_BITS) {
+ line[cur++] = ' '; line[cur++] = ' ';
+ line[cur++] = ' '; line[cur++] = ' ';
+ line[cur++] = ' '; line[cur++] = ' ';
+ }
}
i++;
newreverse = (i >= bstart && i < bend) || (i >= astart && i < aend);
@@ -1787,3 +1907,11 @@ clear_tree_and_hex_views(void)
gtk_tree_store_clear(GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(tree_view))));
}
+void
+select_bytes_view (GtkWidget *w _U_, gpointer data _U_, gint view)
+{
+ if (recent.gui_bytes_view != view) {
+ recent.gui_bytes_view = view;
+ redraw_packet_bytes_all();
+ }
+}
diff --git a/gtk/main_proto_draw.h b/gtk/main_proto_draw.h
index 96b4fda7e9..55c5cebca6 100644
--- a/gtk/main_proto_draw.h
+++ b/gtk/main_proto_draw.h
@@ -74,10 +74,10 @@ extern void set_notebook_page(GtkWidget *nb_ptr, tvbuff_t *tvb);
* @param fd selected frame
* @param finfo selected field_info
*/
-extern void redraw_hex_dump(GtkWidget *nb_ptr, frame_data *fd, field_info *finfo);
+extern void redraw_packet_bytes(GtkWidget *nb_ptr, frame_data *fd, field_info *finfo);
/** Redraw all byte view windows. */
-extern void redraw_hex_dump_all(void);
+extern void redraw_packet_bytes_all(void);
/** Create a new byte view (packet details pane).
*
@@ -221,6 +221,11 @@ extern gboolean tree_view_select(GtkWidget *widget, GdkEventButton *event);
*/
extern void set_ptree_sel_browse_all(gboolean val);
+typedef enum {
+ BYTES_HEX,
+ BYTES_BITS
+} bytes_view_type;
+extern void select_bytes_view (GtkWidget *widget, gpointer data, gint view);
/** init the expert colors */
extern void proto_draw_colors_init(void);
diff --git a/gtk/menus.c b/gtk/menus.c
index e4d8edacd6..4c1870f2ec 100644
--- a/gtk/menus.c
+++ b/gtk/menus.c
@@ -1069,12 +1069,18 @@ static GtkItemFactoryEntry tree_view_menu_items[] =
{"/_Go to Corresponding Packet", NULL, GTK_MENU_FUNC(goto_framenum_cb), 0, NULL, NULL,}
};
+static GtkItemFactoryEntry bytes_menu_items[] =
+{
+ {"/Hex View", NULL, GTK_MENU_FUNC(select_bytes_view), BYTES_HEX, "<RadioItem>", NULL,},
+ {"/Bits View", NULL, GTK_MENU_FUNC(select_bytes_view), BYTES_BITS, "/Hex View", NULL,}
+};
+
static int initialize = TRUE;
static GtkItemFactory *main_menu_factory = NULL;
static GtkItemFactory *packet_list_menu_factory = NULL;
static GtkItemFactory *tree_view_menu_factory = NULL;
-static GtkItemFactory *hexdump_menu_factory = NULL;
+static GtkItemFactory *bytes_menu_factory = NULL;
static GSList *popup_menu_list = NULL;
@@ -1209,10 +1215,11 @@ menus_init(void) {
* We provide our own empty menu to suppress the default pop-up menu
* for text widgets.
*/
- hexdump_menu_factory = gtk_item_factory_new(GTK_TYPE_MENU, "<main>", NULL);
- g_object_set_data(G_OBJECT(popup_menu_object), PM_HEXDUMP_KEY,
- hexdump_menu_factory->widget);
- popup_menu_list = g_slist_append((GSList *)popup_menu_list, hexdump_menu_factory);
+ bytes_menu_factory = gtk_item_factory_new(GTK_TYPE_MENU, "<main>", NULL);
+ gtk_item_factory_create_items_ac(bytes_menu_factory, sizeof(bytes_menu_items)/sizeof(bytes_menu_items[0]), bytes_menu_items, popup_menu_object, 2);
+ g_object_set_data(G_OBJECT(popup_menu_object), PM_BYTES_VIEW_KEY,
+ bytes_menu_factory->widget);
+ popup_menu_list = g_slist_append((GSList *)popup_menu_list, bytes_menu_factory);
/* main */
main_menu_factory = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<main>", grp);
@@ -2282,6 +2289,18 @@ menu_recent_read_finished(void) {
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
menu_colorize_changed(recent.packet_list_colorize);
+
+ switch (recent.gui_bytes_view) {
+ case BYTES_HEX:
+ menu = gtk_item_factory_get_widget(bytes_menu_factory, "/Hex View");
+ break;
+ case BYTES_BITS:
+ menu = gtk_item_factory_get_widget(bytes_menu_factory, "/Bits View");
+ break;
+ default:
+ g_assert_not_reached();
+ }
+ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), TRUE);
}
@@ -2333,11 +2352,6 @@ popup_menu_handler(GtkWidget *widget, GdkEvent *event, gpointer data)
tree_view_select(widget, (GdkEventButton *) event);
}
- /* Check if we are on byte_view object */
- if(widget == get_notebook_bv_ptr(byte_nb_ptr)) {
- byte_view_select(widget, (GdkEventButton *) event);
- }
-
/* context menu handler */
if(event->type == GDK_BUTTON_PRESS) {
event_button = (GdkEventButton *) event;
@@ -2345,16 +2359,19 @@ popup_menu_handler(GtkWidget *widget, GdkEvent *event, gpointer data)
/* To qoute the "Gdk Event Structures" doc:
* "Normally button 1 is the left mouse button, 2 is the middle button, and 3 is the right button" */
if(event_button->button == 3) {
- /* No popup window in the byte view */
- if(widget != get_notebook_bv_ptr(byte_nb_ptr)) {
- gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL,
- event_button->button,
- event_button->time);
- }
+ gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL,
+ event_button->button,
+ event_button->time);
g_signal_stop_emission_by_name(widget, "button_press_event");
return TRUE;
}
}
+
+ /* Check if we are on byte_view object */
+ if(widget == get_notebook_bv_ptr(byte_nb_ptr)) {
+ byte_view_select(widget, (GdkEventButton *) event);
+ }
+
/* GDK_2BUTTON_PRESS is a doubleclick -> expand/collapse tree row */
/* GTK version 1 seems to be doing this automatically */
if (widget == tree_view && event->type == GDK_2BUTTON_PRESS) {
diff --git a/gtk/packet_win.c b/gtk/packet_win.c
index 559dfbe534..6c9e6ca092 100644
--- a/gtk/packet_win.c
+++ b/gtk/packet_win.c
@@ -293,16 +293,16 @@ destroy_packet_wins(void)
}
static void
-redraw_hex_dump_cb(gpointer data, gpointer user_data _U_)
+redraw_packet_bytes_cb(gpointer data, gpointer user_data _U_)
{
struct PacketWinData *DataPtr = (struct PacketWinData *)data;
- redraw_hex_dump(DataPtr->bv_nb_ptr, DataPtr->frame, DataPtr->finfo_selected);
+ redraw_packet_bytes(DataPtr->bv_nb_ptr, DataPtr->frame, DataPtr->finfo_selected);
}
-/* Redraw the hex dump part of all the popup packet windows. */
+/* Redraw the packet bytes part of all the popup packet windows. */
void
-redraw_hex_dump_packet_wins(void)
+redraw_packet_bytes_packet_wins(void)
{
- g_list_foreach(detail_windows, redraw_hex_dump_cb, NULL);
+ g_list_foreach(detail_windows, redraw_packet_bytes_cb, NULL);
}
diff --git a/gtk/packet_win.h b/gtk/packet_win.h
index d018f588a5..ce42b10e57 100644
--- a/gtk/packet_win.h
+++ b/gtk/packet_win.h
@@ -41,7 +41,7 @@ extern void new_window_cb(GtkWidget *widget);
*/
void destroy_packet_wins(void);
-/** Redraw the hex dump panes of all packet windows. */
-void redraw_hex_dump_packet_wins(void);
+/** Redraw the packet bytes panes of all packet windows. */
+void redraw_packet_bytes_packet_wins(void);
#endif
diff --git a/gtk/prefs_gui.c b/gtk/prefs_gui.c
index b04d86bf8d..2136328414 100644
--- a/gtk/prefs_gui.c
+++ b/gtk/prefs_gui.c
@@ -470,7 +470,7 @@ gui_prefs_apply(GtkWidget *w _U_ , gboolean redissect)
#endif
if (font_changed) {
- /* This redraws the hex dump windows. */
+ /* This redraws the packet bytes windows. */
switch (user_font_apply()) {
case FA_SUCCESS:
@@ -492,10 +492,10 @@ gui_prefs_apply(GtkWidget *w _U_ , gboolean redissect)
break;
}
} else if (!redissect) {
- /* Redraw the hex dump windows, in case the
+ /* Redraw the packet bytes windows, in case the
highlight style changed, only if we aren't redissecting the whole file.
XXX - do it only if the highlight style *did* change. */
- redraw_hex_dump_all();
+ redraw_packet_bytes_all();
}
/* Redraw the help window(s). */
diff --git a/gtk/prefs_layout.c b/gtk/prefs_layout.c
index 3dbe8f1f79..b11d700f1a 100644
--- a/gtk/prefs_layout.c
+++ b/gtk/prefs_layout.c
@@ -105,7 +105,7 @@ static GtkWidget *layout_content_radio_vbox(GtkWidget *main_vb, GtkTooltips *too
radio_pbytes_rb = gtk_radio_button_new_with_mnemonic_from_widget(GTK_RADIO_BUTTON(radio_none_rb), "Packet Bytes");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio_pbytes_rb), content == layout_pane_content_pbytes);
- gtk_tooltips_set_tip (tooltips, radio_pbytes_rb, "Put the packet bytes hexdump in this pane.", NULL);
+ gtk_tooltips_set_tip (tooltips, radio_pbytes_rb, "Put the packet bytes dump in this pane.", NULL);
gtk_container_add(GTK_CONTAINER(radio_vb), radio_pbytes_rb);
g_object_set_data(G_OBJECT(radio_vb), LAYOUT_NONE_RB_KEY, radio_none_rb);
@@ -402,10 +402,10 @@ layout_prefs_show(void)
altern_colors_vals, prefs.gui_altern_colors);
g_object_set_data(G_OBJECT(main_vb), ALTERN_COLORS_KEY, altern_colors_om);
- /* Hex Dump highlight style */
+ /* Packet Bytes Dump highlight style */
highlight_style_om = create_preference_option_menu(main_tb, pos++,
- "Hex display highlight style:",
- "Select the style in which the hex dump will be displayed.",
+ "Packet bytes highlight style:",
+ "Select the style in which the packet bytes dump will be displayed.",
highlight_style_vals, prefs.gui_hex_dump_highlight_style);
g_object_set_data(G_OBJECT(main_vb), HEX_DUMP_HIGHLIGHT_STYLE_KEY, highlight_style_om);
diff --git a/gtk/recent.c b/gtk/recent.c
index d7856c66ed..a8802658d9 100644
--- a/gtk/recent.c
+++ b/gtk/recent.c
@@ -71,6 +71,7 @@
#define RECENT_GUI_TIME_FORMAT "gui.time_format"
#define RECENT_GUI_TIME_PRECISION "gui.time_precision"
#define RECENT_GUI_ZOOM_LEVEL "gui.zoom_level"
+#define RECENT_GUI_BYTES_VIEW "gui.bytes_view"
#define RECENT_GUI_GEOMETRY_MAIN_X "gui.geometry_main_x"
#define RECENT_GUI_GEOMETRY_MAIN_Y "gui.geometry_main_y"
#define RECENT_GUI_GEOMETRY_MAIN_WIDTH "gui.geometry_main_width"
@@ -362,6 +363,11 @@ write_profile_recent(void)
fprintf(rf, RECENT_GUI_ZOOM_LEVEL ": %d\n",
recent.gui_zoom_level);
+ fprintf(rf, "\n# Bytes view.\n");
+ fprintf(rf, "# A decimal number.\n");
+ fprintf(rf, RECENT_GUI_BYTES_VIEW ": %d\n",
+ recent.gui_bytes_view);
+
fprintf(rf, "\n# Main window upper (or leftmost) pane size.\n");
fprintf(rf, "# Decimal number.\n");
if (recent.gui_geometry_main_upper_pane != 0) {
@@ -602,6 +608,11 @@ read_set_recent_pair_static(gchar *key, gchar *value, void *private_data _U_)
if (p == value || *p != '\0')
return PREFS_SET_SYNTAX_ERR; /* number was bad */
recent.gui_zoom_level = num;
+ } else if (strcmp(key, RECENT_GUI_BYTES_VIEW) == 0) {
+ num = strtol(value, &p, 0);
+ if (p == value || *p != '\0')
+ return PREFS_SET_SYNTAX_ERR; /* number was bad */
+ recent.gui_bytes_view = num;
} else if (strcmp(key, RECENT_GUI_GEOMETRY_MAIN_MAXIMIZED) == 0) {
if (g_ascii_strcasecmp(value, "true") == 0) {
recent.gui_geometry_main_maximized = TRUE;
@@ -832,6 +843,7 @@ recent_read_profile_static(char **rf_path_return, int *rf_errno_return)
recent.gui_time_format = TS_RELATIVE;
recent.gui_time_precision = TS_PREC_AUTO;
recent.gui_zoom_level = 0;
+ recent.gui_bytes_view = 0;
/* pane size of zero will autodetect */
recent.gui_geometry_main_upper_pane = 0;
diff --git a/gtk/recent.h b/gtk/recent.h
index df6ceb459e..36b368ac1d 100644
--- a/gtk/recent.h
+++ b/gtk/recent.h
@@ -59,6 +59,7 @@ typedef struct recent_settings_tag {
gint gui_time_format;
gint gui_time_precision;
gint gui_zoom_level;
+ gint gui_bytes_view;
gint gui_geometry_main_x;
gint gui_geometry_main_y;