Graham Bloice's patch to support inverse video rather than boldface

highlighting of the bytes, in the hex dump window, corresponding to a
selected field.

Also, make "remember_ptree_widget()" static, as it's not used outside
"gtk/proto_draw.c".

svn path=/trunk/; revision=2399
This commit is contained in:
Guy Harris 2000-09-08 09:50:08 +00:00
parent 0653c5b18b
commit b85ddbe885
11 changed files with 274 additions and 81 deletions

View File

@ -306,6 +306,9 @@ Graham Bloice <graham.bloice@trihedral.com> {
Win32 Makefile improvements
Support for "Update list of packets in real time" during capture
on Win32
Support for inverse video rather than boldface highlighting of
the bytes, in the hex dump window, corresponding to a selected
field
}
Ralf Schneider <ralf.schneider@alcatel.se> {

View File

@ -513,6 +513,8 @@ the rest of the list or tree without changing the selection
until you press the space bar. If the selection bar has a "select"
behavior, the arrow keys will move the selection bar and change
the selection to the new item in the packet list or protocol tree.
The highlight method in the hex dump display for the selected protocol
item can be set to use either inverse video, or bold characters.
=item Fonts

5
file.c
View File

@ -1,7 +1,7 @@
/* file.c
* File I/O routines
*
* $Id: file.c,v 1.213 2000/09/07 05:33:49 gram Exp $
* $Id: file.c,v 1.214 2000/09/08 09:49:17 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -1557,7 +1557,8 @@ select_packet(capture_file *cf, int row)
clear_tree_and_hex_views();
proto_tree_draw(cf->protocol_tree, tree_view);
packet_hex_print(GTK_TEXT(byte_view), cf->pd, cf->current_frame->cap_len,
-1, -1, cf->current_frame->flags.encoding);
-1, -1, cf->current_frame->flags.encoding,
prefs.gui_hex_dump_highlight_style);
/* A packet is selected. */
set_menus_for_selected_packet(TRUE);

View File

@ -1,7 +1,7 @@
/* gui_prefs.c
* Dialog box for GUI preferences
*
* $Id: gui_prefs.c,v 1.16 2000/08/24 03:16:47 gram Exp $
* $Id: gui_prefs.c,v 1.17 2000/09/08 09:50:01 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -61,6 +61,7 @@ static void fetch_colors(void);
#define PTREE_SEL_BROWSE_KEY "ptree_sel_browse"
#define PTREE_LINE_STYLE_KEY "ptree_line_style"
#define PTREE_EXPANDER_STYLE_KEY "ptree_expander_style"
#define HEX_DUMP_HIGHLIGHT_STYLE_KEY "hex_dump_highlight_style"
#define FONT_DIALOG_PTR_KEY "font_dialog_ptr"
#define FONT_CALLER_PTR_KEY "font_caller_ptr"
@ -97,6 +98,12 @@ static const enum_val expander_style_vals[] = {
{ NULL, 0 }
};
static const enum_val highlight_style_vals[] = {
{ "Bold", 0 },
{ "Inverse", 1 },
{ NULL, 0 }
};
/* Set to FALSE initially; set to TRUE if the user ever hits "OK" on
the "Colors..." dialog, so that we know that they (probably) changed
colors, and therefore that the "apply" function needs to recolor
@ -119,7 +126,7 @@ gui_prefs_show(void)
font_changed = FALSE;
/* Main vertical box */
main_vb = gtk_vbox_new(FALSE, 5);
main_vb = gtk_vbox_new(FALSE, 7);
gtk_container_border_width( GTK_CONTAINER(main_vb), 5 );
/* Main table */
@ -153,11 +160,16 @@ gui_prefs_show(void)
"Protocol-tree expander style:", expander_style_vals,
prefs.gui_ptree_expander_style);
/* Hex Dump highlight style */
create_option_menu(main_vb, HEX_DUMP_HIGHLIGHT_STYLE_KEY, main_tb, 5,
"Hex dump highlight style:", highlight_style_vals,
prefs.gui_hex_dump_highlight_style);
/* "Font..." button - click to open a font selection dialog box. */
font_bt = gtk_button_new_with_label("Font...");
gtk_signal_connect(GTK_OBJECT(font_bt), "clicked",
GTK_SIGNAL_FUNC(font_browse_cb), NULL);
gtk_table_attach_defaults( GTK_TABLE(main_tb), font_bt, 1, 2, 5, 6 );
gtk_table_attach_defaults( GTK_TABLE(main_tb), font_bt, 1, 2, 6, 7 );
/* "Colors..." button - click to open a color selection dialog box. */
color_bt = gtk_button_new_with_label("Colors...");
@ -362,6 +374,9 @@ gui_prefs_fetch(GtkWidget *w)
prefs.gui_ptree_expander_style = fetch_enum_value(
gtk_object_get_data(GTK_OBJECT(w), PTREE_EXPANDER_STYLE_KEY),
expander_style_vals);
prefs.gui_hex_dump_highlight_style = fetch_enum_value(
gtk_object_get_data(GTK_OBJECT(w), HEX_DUMP_HIGHLIGHT_STYLE_KEY),
highlight_style_vals);
if (colors_changed)
fetch_colors();
@ -386,6 +401,7 @@ gui_prefs_apply(GtkWidget *w)
set_ptree_sel_browse_all(prefs.gui_ptree_sel_browse);
set_ptree_line_style_all(prefs.gui_ptree_line_style);
set_ptree_expander_style_all(prefs.gui_ptree_expander_style);
set_hex_dump_highlight_style_all(prefs.gui_hex_dump_highlight_style);
if (colors_changed)
update_marked_frames();
if (font != NULL) {

View File

@ -1,6 +1,6 @@
/* main.c
*
* $Id: main.c,v 1.153 2000/08/23 21:05:11 deniel Exp $
* $Id: main.c,v 1.154 2000/09/08 09:50:03 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -573,7 +573,8 @@ tree_view_select_row_cb(GtkCTree *ctree, GList *node, gint column, gpointer user
}
packet_hex_print(GTK_TEXT(byte_view), cfile.pd, cfile.current_frame->cap_len,
finfo->start, finfo->length, cfile.current_frame->flags.encoding);
finfo->start, finfo->length, cfile.current_frame->flags.encoding,
prefs.gui_hex_dump_highlight_style);
}
static void
@ -583,7 +584,8 @@ tree_view_unselect_row_cb(GtkCTree *ctree, GList *node, gint column, gpointer us
finfo_selected = NULL;
set_menus_for_selected_tree_row(FALSE);
packet_hex_print(GTK_TEXT(byte_view), cfile.pd, cfile.current_frame->cap_len,
-1, -1, cfile.current_frame->flags.encoding);
-1, -1, cfile.current_frame->flags.encoding,
prefs.gui_hex_dump_highlight_style);
}
void collapse_all_cb(GtkWidget *widget, gpointer data) {

View File

@ -3,7 +3,7 @@
*
* Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com>
*
* $Id: packet_win.c,v 1.12 2000/08/21 08:09:13 guy Exp $
* $Id: packet_win.c,v 1.13 2000/09/08 09:50:06 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -80,6 +80,7 @@ struct PacketWinData {
GtkWidget *tree_view;
GtkWidget *bv_scrollw;
GtkWidget *byte_view;
field_info *finfo_selected;
};
/* List of all the packet-detail windows popped up. */
@ -195,8 +196,10 @@ create_new_window ( char *Title, gint tv_size, gint bv_size){
/* draw the protocol tree & print hex data */
proto_tree_draw(DataPtr->protocol_tree, tree_view);
packet_hex_print( GTK_TEXT(byte_view), DataPtr->pd,
DataPtr->cap_len, -1, -1, DataPtr->encoding);
DataPtr->cap_len, -1, -1, DataPtr->encoding,
prefs.gui_hex_dump_highlight_style);
DataPtr->finfo_selected = NULL;
gtk_widget_show(main_w);
}
@ -225,11 +228,11 @@ new_tree_view_select_row_cb(GtkCTree *ctree, GList *node, gint column,
finfo = gtk_ctree_node_get_row_data( ctree, GTK_CTREE_NODE(node) );
if (!finfo) return;
finfo_selected = finfo;
DataPtr->finfo_selected = finfo;
packet_hex_print(GTK_TEXT(DataPtr->byte_view), DataPtr->pd,
DataPtr->cap_len, finfo->start, finfo->length,
DataPtr->encoding);
DataPtr->encoding, prefs.gui_hex_dump_highlight_style);
}
@ -243,8 +246,10 @@ new_tree_view_unselect_row_cb(GtkCTree *ctree, GList *node, gint column,
struct PacketWinData *DataPtr = (struct PacketWinData*)user_data;
DataPtr->finfo_selected = NULL;
packet_hex_print(GTK_TEXT(DataPtr->byte_view), DataPtr->pd,
DataPtr->cap_len, -1, -1, DataPtr->encoding);
DataPtr->cap_len, -1, -1, DataPtr->encoding,
prefs.gui_hex_dump_highlight_style);
}
/* Functions called from elsewhere to act on all popup packet windows. */
@ -265,3 +270,19 @@ destroy_packet_wins(void)
gtk_widget_destroy(DataPtr->main);
}
}
static void
set_hex_dump_highlight_style_cb(gpointer data, gpointer user_data)
{
struct PacketWinData *DataPtr = (struct PacketWinData *)data;
set_hex_dump_highlight_style(DataPtr->byte_view,
DataPtr->finfo_selected, *(gint *)user_data);
}
/* Set the hex dump highlight style of all the popup packet windows. */
void
set_hex_dump_highlight_style_packet_wins(gboolean style)
{
g_list_foreach(detail_windows, set_hex_dump_highlight_style_cb, &style);
}

View File

@ -3,7 +3,7 @@
*
* Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com>
*
* $Id: packet_win.h,v 1.4 2000/08/21 08:09:14 guy Exp $
* $Id: packet_win.h,v 1.5 2000/09/08 09:50:07 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -28,5 +28,6 @@
#define __PACKET_WIN_H__
extern void new_window_cb(GtkWidget *w);
void set_hex_dump_highlight_style_packet_wins(gboolean style);
#endif

View File

@ -1,7 +1,7 @@
/* gtkpacket.c
/* proto_draw.c
* Routines for GTK+ packet display
*
* $Id: proto_draw.c,v 1.18 2000/08/21 08:09:16 guy Exp $
* $Id: proto_draw.c,v 1.19 2000/09/08 09:50:07 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -47,6 +47,7 @@
#include "prefs.h"
#include "proto_draw.h"
#include "packet_win.h"
#include "gtkglobals.h"
#define BYTE_VIEW_WIDTH 16
@ -57,6 +58,27 @@ extern GdkFont *m_r_font, *m_b_font;
static void
proto_tree_draw_node(GNode *node, gpointer data);
/* Set the highlight style of a given byte view window. */
void
set_hex_dump_highlight_style(GtkWidget *bv, field_info *finfo, gboolean style)
{
if (finfo != NULL) {
packet_hex_print(GTK_TEXT(bv), cfile.pd, cfile.current_frame->cap_len,
finfo->start, finfo->length,
cfile.current_frame->flags.encoding, style);
} else {
packet_hex_print(GTK_TEXT(bv), cfile.pd, cfile.current_frame->cap_len,
-1, -1, cfile.current_frame->flags.encoding, style);
}
}
void
set_hex_dump_highlight_style_all(gboolean style)
{
set_hex_dump_highlight_style(byte_view, finfo_selected, style);
set_hex_dump_highlight_style_packet_wins(style);
}
void
create_byte_view(gint bv_size, GtkWidget *pane, GtkWidget **byte_view_p,
GtkWidget **bv_scrollw_p, int pos)
@ -86,12 +108,15 @@ create_byte_view(gint bv_size, GtkWidget *pane, GtkWidget **byte_view_p,
void
packet_hex_print(GtkText *bv, guint8 *pd, gint len, gint bstart, gint blen,
char_enc encoding) {
char_enc encoding, gboolean style) {
gint i = 0, j, k, cur;
guchar line[128], hexchars[] = "0123456789abcdef", c = '\0';
GdkFont *cur_font, *new_font;
gint bend = -1;
GdkColor *fg, *bg;
gboolean reverse, newreverse;
/* Freeze the text for faster display */
gtk_text_freeze(bv);
@ -111,68 +136,175 @@ packet_hex_print(GtkText *bv, guint8 *pd, gint len, gint bstart, gint blen,
while (i < len) {
/* Print the line number */
sprintf(line, "%04x ", i);
gtk_text_insert(bv, m_r_font, NULL, NULL, line, -1);
/* Do we start in bold? */
cur_font = (i >= bstart && i < bend) ? m_b_font : m_r_font;
j = i;
k = i + BYTE_VIEW_WIDTH;
cur = 0;
/* Print the hex bit */
while (i < k) {
if (i < len) {
line[cur++] = hexchars[(pd[i] & 0xf0) >> 4];
line[cur++] = hexchars[pd[i] & 0x0f];
} else {
line[cur++] = ' '; line[cur++] = ' ';
/* Display with inverse video ? */
if (style) {
gtk_text_insert(bv, m_r_font, &BLACK, &WHITE, line, -1);
/* Do we start in reverse? */
reverse = i >= bstart && i < bend;
fg = reverse ? &WHITE : &BLACK;
bg = reverse ? &BLACK : &WHITE;
j = i;
k = i + BYTE_VIEW_WIDTH;
cur = 0;
/* Print the hex bit */
while (i < k) {
if (i < len) {
line[cur++] = hexchars[(pd[i] & 0xf0) >> 4];
line[cur++] = hexchars[pd[i] & 0x0f];
} else {
line[cur++] = ' '; line[cur++] = ' ';
}
i++;
newreverse = i >= bstart && i < bend;
/* Have we gone from reverse to plain? */
if (reverse && (reverse != newreverse)) {
gtk_text_insert(bv, m_r_font, fg, bg, line, cur);
fg = &BLACK;
bg = &WHITE;
cur = 0;
}
/* Inter byte space if not at end of line */
if (i < k) {
line[cur++] = ' ';
/* insert a space every BYTE_VIEW_SEP bytes */
if( ( i % BYTE_VIEW_SEP ) == 0 ) {
line[cur++] = ' ';
}
}
/* Have we gone from plain to reversed? */
if (!reverse && (reverse != newreverse)) {
gtk_text_insert(bv, m_r_font, fg, bg, line, cur);
fg = &WHITE;
bg = &BLACK;
cur = 0;
}
reverse = newreverse;
}
/* Print remaining part of line */
gtk_text_insert(bv, m_r_font, fg, bg, line, cur);
cur = 0;
/* Print some space at the end of the line */
line[cur++] = ' '; line[cur++] = ' '; line[cur++] = ' ';
gtk_text_insert(bv, m_r_font, &BLACK, &WHITE, line, cur);
cur = 0;
/* Print the ASCII bit */
i = j;
/* Do we start in reverse? */
reverse = i >= bstart && i < bend;
fg = reverse ? &WHITE : &BLACK;
bg = reverse ? &BLACK : &WHITE;
while (i < k) {
if (i < len) {
if (encoding == CHAR_ASCII) {
c = pd[i];
}
else if (encoding == CHAR_EBCDIC) {
c = EBCDIC_to_ASCII1(pd[i]);
}
else {
g_assert_not_reached();
}
line[cur++] = (isprint(c)) ? c : '.';
} else {
line[cur++] = ' ';
}
i++;
newreverse = i >= bstart && i < bend;
/* Have we gone from reverse to plain? */
if (reverse && (reverse != newreverse)) {
gtk_text_insert(bv, m_r_font, fg, bg, line, cur);
fg = &BLACK;
bg = &WHITE;
cur = 0;
}
if (i < k) {
/* insert a space every BYTE_VIEW_SEP bytes */
if( ( i % BYTE_VIEW_SEP ) == 0 ) {
line[cur++] = ' ';
}
}
/* Have we gone from plain to reversed? */
if (!reverse && (reverse != newreverse)) {
gtk_text_insert(bv, m_r_font, fg, bg, line, cur);
fg = &WHITE;
bg = &BLACK;
cur = 0;
}
reverse = newreverse;
}
/* Print remaining part of line */
gtk_text_insert(bv, m_r_font, fg, bg, line, cur);
cur = 0;
line[cur++] = '\n';
line[cur] = '\0';
gtk_text_insert(bv, m_r_font, &BLACK, &WHITE, line, -1);
}
else {
gtk_text_insert(bv, m_r_font, NULL, NULL, line, -1);
/* Do we start in bold? */
cur_font = (i >= bstart && i < bend) ? m_b_font : m_r_font;
j = i;
k = i + BYTE_VIEW_WIDTH;
cur = 0;
/* Print the hex bit */
while (i < k) {
if (i < len) {
line[cur++] = hexchars[(pd[i] & 0xf0) >> 4];
line[cur++] = hexchars[pd[i] & 0x0f];
} else {
line[cur++] = ' '; line[cur++] = ' ';
}
line[cur++] = ' ';
i++;
/* insert a space every BYTE_VIEW_SEP bytes */
if( ( i % BYTE_VIEW_SEP ) == 0 ) line[cur++] = ' ';
/* Did we cross a bold/plain boundary? */
new_font = (i >= bstart && i < bend) ? m_b_font : m_r_font;
if (cur_font != new_font) {
gtk_text_insert(bv, cur_font, NULL, NULL, line, cur);
cur_font = new_font;
cur = 0;
}
}
line[cur++] = ' ';
i++;
/* insert a space every BYTE_VIEW_SEP bytes */
if( ( i % BYTE_VIEW_SEP ) == 0 ) line[cur++] = ' ';
/* Did we cross a bold/plain boundary? */
new_font = (i >= bstart && i < bend) ? m_b_font : m_r_font;
if (cur_font != new_font) {
gtk_text_insert(bv, cur_font, NULL, NULL, line, cur);
cur_font = new_font;
cur = 0;
}
}
line[cur++] = ' ';
gtk_text_insert(bv, cur_font, NULL, NULL, line, cur);
gtk_text_insert(bv, cur_font, NULL, NULL, line, cur);
cur = 0;
i = j;
/* Print the ASCII bit */
cur_font = (i >= bstart && i < bend) ? m_b_font : m_r_font;
while (i < k) {
if (i < len) {
if (encoding == CHAR_ASCII) {
c = pd[i];
}
else if (encoding == CHAR_EBCDIC) {
c = EBCDIC_to_ASCII1(pd[i]);
}
else {
g_assert_not_reached();
}
line[cur++] = (isprint(c)) ? c : '.';
} else {
line[cur++] = ' ';
}
i++;
/* insert a space every BYTE_VIEW_SEP bytes */
if( ( i % BYTE_VIEW_SEP ) == 0 ) line[cur++] = ' ';
/* Did we cross a bold/plain boundary? */
new_font = (i >= bstart && i < bend) ? m_b_font : m_r_font;
if (cur_font != new_font) {
gtk_text_insert(bv, cur_font, NULL, NULL, line, cur);
cur_font = new_font;
cur = 0;
cur = 0;
i = j;
/* Print the ASCII bit */
cur_font = (i >= bstart && i < bend) ? m_b_font : m_r_font;
while (i < k) {
if (i < len) {
if (encoding == CHAR_ASCII) {
c = pd[i];
}
else if (encoding == CHAR_EBCDIC) {
c = EBCDIC_to_ASCII1(pd[i]);
}
else {
g_assert_not_reached();
}
line[cur++] = (isprint(c)) ? c : '.';
} else {
line[cur++] = ' ';
}
i++;
/* insert a space every BYTE_VIEW_SEP bytes */
if( ( i % BYTE_VIEW_SEP ) == 0 ) line[cur++] = ' ';
/* Did we cross a bold/plain boundary? */
new_font = (i >= bstart && i < bend) ? m_b_font : m_r_font;
if (cur_font != new_font) {
gtk_text_insert(bv, cur_font, NULL, NULL, line, cur);
cur_font = new_font;
cur = 0;
}
}
line[cur++] = '\n';
line[cur] = '\0';
gtk_text_insert(bv, cur_font, NULL, NULL, line, -1);
}
line[cur++] = '\n';
line[cur] = '\0';
gtk_text_insert(bv, cur_font, NULL, NULL, line, -1);
}
/* scroll text into position */
@ -197,7 +329,7 @@ static GList *ptree_widgets;
/* Add a protocol tree widget to the list of protocol tree widgets. */
static void forget_ptree_widget(GtkWidget *ptreew, gpointer data);
void
static void
remember_ptree_widget(GtkWidget *ptreew)
{
ptree_widgets = g_list_append(ptree_widgets, ptreew);
@ -208,7 +340,7 @@ remember_ptree_widget(GtkWidget *ptreew)
GTK_SIGNAL_FUNC(forget_ptree_widget), NULL);
}
/* Remove a scrolled window from the list of scrolled windows. */
/* Remove a protocol tree widget from the list of protocol tree widgets. */
static void
forget_ptree_widget(GtkWidget *ptreew, gpointer data)
{

View File

@ -1,7 +1,7 @@
/* gtkpacket.h
* Definitions for GTK+ packet display structures and routines
*
* $Id: proto_draw.h,v 1.7 2000/08/21 08:09:16 guy Exp $
* $Id: proto_draw.h,v 1.8 2000/09/08 09:50:08 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -27,9 +27,12 @@
#ifndef __GTKPACKET_H__
#define __GTKPACKET_H__
void set_hex_dump_highlight_style(GtkWidget *bv, field_info *finfo,
gboolean style);
void set_hex_dump_highlight_style_all(gboolean);
void create_byte_view(gint bv_size, GtkWidget *pane, GtkWidget **byte_view_p,
GtkWidget **bv_scrollw_p, int pos);
void packet_hex_print(GtkText *, guint8 *, gint, gint, gint, char_enc);
void packet_hex_print(GtkText *, guint8 *, gint, gint, gint, char_enc, gboolean);
#define E_TREEINFO_FIELD_INFO_KEY "tree_info_finfo"
@ -39,7 +42,6 @@ void proto_tree_draw(proto_tree *protocol_tree, GtkWidget *tree_view);
void expand_all_tree(proto_tree *protocol_tree, GtkWidget *tree_view);
void collapse_all_tree(proto_tree *protocol_tree, GtkWidget *tree_view);
void remember_ptree_widget(GtkWidget *);
void set_ptree_sel_browse_all(gboolean);
void set_ptree_line_style_all(gint style);
void set_ptree_expander_style_all(gint style);

14
prefs.c
View File

@ -1,7 +1,7 @@
/* prefs.c
* Routines for handling preferences
*
* $Id: prefs.c,v 1.39 2000/08/21 21:24:03 deniel Exp $
* $Id: prefs.c,v 1.40 2000/09/08 09:49:20 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -79,6 +79,8 @@ gchar *gui_ptree_line_style_text[] =
gchar *gui_ptree_expander_style_text[] =
{ "NONE", "SQUARE", "TRIANGLE", "CIRCULAR", NULL };
gchar *gui_hex_dump_highlight_style_text[] =
{ "BOLD", "INVERSE", NULL };
/*
* List of modules with preference settings.
@ -527,6 +529,7 @@ read_prefs(int *gpf_errno_return, char **gpf_path_return,
prefs.gui_ptree_sel_browse = FALSE;
prefs.gui_ptree_line_style = 0;
prefs.gui_ptree_expander_style = 1;
prefs.gui_hex_dump_highlight_style = 1;
#ifdef WIN32
prefs.gui_font_name = g_strdup("-*-lucida console-medium-r-*-*-*-100-*-*-*-*-*-*");
#else
@ -753,6 +756,7 @@ prefs_set_pref(char *prefarg)
#define PRS_GUI_PTREE_SEL_BROWSE "gui.protocol_tree_sel_browse"
#define PRS_GUI_PTREE_LINE_STYLE "gui.protocol_tree_line_style"
#define PRS_GUI_PTREE_EXPANDER_STYLE "gui.protocol_tree_expander_style"
#define PRS_GUI_HEX_DUMP_HIGHLIGHT_STYLE "gui.hex_dump_highlight_style"
#define PRS_GUI_FONT_NAME "gui.font_name"
#define PRS_GUI_MARKED_FG "gui.marked_frame.fg"
#define PRS_GUI_MARKED_BG "gui.marked_frame.bg"
@ -870,6 +874,9 @@ set_pref(gchar *pref_name, gchar *value)
} else if (strcmp(pref_name, PRS_GUI_PTREE_EXPANDER_STYLE) == 0) {
prefs.gui_ptree_expander_style =
find_index_from_string_array(value, gui_ptree_expander_style_text, 1);
} else if (strcmp(pref_name, PRS_GUI_HEX_DUMP_HIGHLIGHT_STYLE) == 0) {
prefs.gui_hex_dump_highlight_style =
find_index_from_string_array(value, gui_hex_dump_highlight_style_text, 1);
} else if (strcmp(pref_name, PRS_GUI_FONT_NAME) == 0) {
if (prefs.gui_font_name != NULL)
g_free(prefs.gui_font_name);
@ -1135,6 +1142,10 @@ write_prefs(char **pf_path_return)
fprintf(pf, PRS_GUI_PTREE_EXPANDER_STYLE ": %s\n",
gui_ptree_expander_style_text[prefs.gui_ptree_expander_style]);
fprintf(pf, "\n# Hex dump highlight style. One of: BOLD, INVERSE\n");
fprintf(pf, PRS_GUI_HEX_DUMP_HIGHLIGHT_STYLE ": %s\n",
gui_hex_dump_highlight_style_text[prefs.gui_hex_dump_highlight_style]);
fprintf(pf, "\n# Font name for packet list, protocol tree, and hex dump panes.\n");
fprintf(pf, PRS_GUI_FONT_NAME ": %s\n", prefs.gui_font_name);
@ -1189,6 +1200,7 @@ copy_prefs(e_prefs *dest, e_prefs *src)
dest->gui_ptree_sel_browse = src->gui_ptree_sel_browse;
dest->gui_ptree_line_style = src->gui_ptree_line_style;
dest->gui_ptree_expander_style = src->gui_ptree_expander_style;
dest->gui_hex_dump_highlight_style = src->gui_hex_dump_highlight_style;
dest->gui_font_name = g_strdup(src->gui_font_name);
dest->gui_marked_fg = src->gui_marked_fg;
dest->gui_marked_bg = src->gui_marked_bg;

View File

@ -1,7 +1,7 @@
/* prefs.h
* Definitions for preference handling routines
*
* $Id: prefs.h,v 1.23 2000/08/21 21:24:04 deniel Exp $
* $Id: prefs.h,v 1.24 2000/09/08 09:49:21 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -46,6 +46,7 @@ typedef struct _e_prefs {
gboolean gui_ptree_sel_browse;
gint gui_ptree_line_style;
gint gui_ptree_expander_style;
gboolean gui_hex_dump_highlight_style;
gchar *gui_font_name;
GdkColor gui_marked_fg;
GdkColor gui_marked_bg;