diff options
-rw-r--r-- | column.c | 67 | ||||
-rw-r--r-- | column.h | 9 | ||||
-rw-r--r-- | epan/column-utils.c | 3 | ||||
-rw-r--r-- | epan/column_info.h | 3 | ||||
-rw-r--r-- | file.c | 63 | ||||
-rw-r--r-- | gtk/main.c | 19 | ||||
-rw-r--r-- | gtk/packet_list.c | 23 | ||||
-rw-r--r-- | ui_util.h | 5 |
8 files changed, 25 insertions, 167 deletions
@@ -1,7 +1,7 @@ /* column.c * Routines for handling column preferences * - * $Id: column.c,v 1.43 2003/09/03 10:49:01 sahlberg Exp $ + * $Id: column.c,v 1.44 2003/12/09 06:48:38 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -258,7 +258,7 @@ get_column_longest_string(gint format) return "000000"; break; case COL_PROTOCOL: - return "NetBIOS"; /* not the longest, but the longest is too long */ + return "Protocol"; /* not the longest, but the longest is too long */ break; case COL_PACKET_LENGTH: return "000000"; @@ -297,69 +297,6 @@ get_column_char_width(gint format) return strlen(get_column_longest_string(format)); } -enum col_resize_type -get_column_resize_type(gint format) { - switch (format) { - case COL_NUMBER: - case COL_CLS_TIME: - case COL_ABS_TIME: - case COL_ABS_DATE_TIME: - case COL_REL_TIME: - case COL_DELTA_TIME: - case COL_DEF_SRC_PORT: - case COL_RES_SRC_PORT: - case COL_UNRES_SRC_PORT: - case COL_DEF_DST_PORT: - case COL_RES_DST_PORT: - case COL_UNRES_DST_PORT: - case COL_PROTOCOL: - case COL_PACKET_LENGTH: - case COL_CULMULATIVE_BYTES: - case COL_IF_DIR: - case COL_CIRCUIT_ID: - /* We don't want these to resize during a live capture, as that - gets in the way of trying to look at the data while it's being - captured. */ - return (RESIZE_AUTO); - break; - case COL_DEF_SRC: - case COL_RES_SRC: - case COL_UNRES_SRC: - case COL_DEF_DL_SRC: - case COL_RES_DL_SRC: - case COL_UNRES_DL_SRC: - case COL_DEF_NET_SRC: - case COL_RES_NET_SRC: - case COL_UNRES_NET_SRC: - case COL_DEF_DST: - case COL_RES_DST: - case COL_UNRES_DST: - case COL_DEF_DL_DST: - case COL_RES_DL_DST: - case COL_UNRES_DL_DST: - case COL_DEF_NET_DST: - case COL_RES_NET_DST: - case COL_UNRES_NET_DST: - case COL_OXID: - case COL_RXID: - case COL_SRCIDX: - case COL_DSTIDX: - case COL_VSAN: - /* We don't want these to resize dynamically; if they get resolved - to names, those names could be very long, and auto-resizing - columns showing those names may leave too little room for - other columns such as the "Info" column. */ - return (RESIZE_MANUAL); - break; - default: /* COL_INFO */ - /* We want this to resize dynamically, even during a live capture, - because otherewise you won't be able to see all that's in - it. */ - return (RESIZE_LIVE); - break; - } -} - #define TIME_DEF 0 #define TIME_REL 1 #define TIME_ABS 2 @@ -1,7 +1,7 @@ /* column.h * Definitions for column handling routines * - * $Id: column.h,v 1.9 2002/08/28 21:00:06 jmayer Exp $ + * $Id: column.h,v 1.10 2003/12/09 06:48:38 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -31,18 +31,11 @@ typedef struct _fmt_data { gchar *fmt; } fmt_data; -enum col_resize_type { - RESIZE_AUTO, /* Automatically resize */ - RESIZE_LIVE, /* Automatically resize even during live capture */ - RESIZE_MANUAL /* Don't automatically resize */ -}; - gchar *col_format_to_string(gint); gchar *col_format_desc(gint); gint get_column_format(gint); void get_column_format_matches(gboolean *, gint); gint get_column_format_from_str(gchar *); -enum col_resize_type get_column_resize_type(gint); gchar *get_column_title(gint); char *get_column_longest_string(gint); gint get_column_char_width(gint format); diff --git a/epan/column-utils.c b/epan/column-utils.c index 59e8f2e120..cebe7eb42d 100644 --- a/epan/column-utils.c +++ b/epan/column-utils.c @@ -1,7 +1,7 @@ /* column-utils.c * Routines for column utilities. * - * $Id: column-utils.c,v 1.40 2003/12/02 23:14:31 guy Exp $ + * $Id: column-utils.c,v 1.41 2003/12/09 06:48:39 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -57,7 +57,6 @@ col_setup(column_info *col_info, gint num_cols) col_info->fmt_matx = (gboolean **) g_malloc(sizeof(gboolean *) * num_cols); col_info->col_first = (int *) g_malloc(sizeof(int) * (NUM_COL_FMTS)); col_info->col_last = (int *) g_malloc(sizeof(int) * (NUM_COL_FMTS)); - col_info->col_width = (gint *) g_malloc(sizeof(gint) * num_cols); col_info->col_title = (gchar **) g_malloc(sizeof(gchar *) * num_cols); col_info->col_data = (gchar **) g_malloc(sizeof(gchar *) * num_cols); col_info->col_buf = (gchar **) g_malloc(sizeof(gchar *) * num_cols); diff --git a/epan/column_info.h b/epan/column_info.h index 48332f8194..790211c556 100644 --- a/epan/column_info.h +++ b/epan/column_info.h @@ -1,7 +1,7 @@ /* column.h * Definitions for column structures and routines * - * $Id: column_info.h,v 1.10 2003/12/02 23:14:31 guy Exp $ + * $Id: column_info.h,v 1.11 2003/12/09 06:48:39 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -36,7 +36,6 @@ typedef struct _column_info { gboolean **fmt_matx; /* Specifies which formats apply to a column */ gint *col_first; /* First column number with a given format */ gint *col_last; /* Last column number with a given format */ - gint *col_width; /* Column widths to use during a "-S" capture */ gchar **col_title; /* Column titles */ gchar **col_data; /* Column data */ gchar **col_buf; /* Buffer into which to copy data for column */ @@ -1,7 +1,7 @@ /* file.c * File I/O routines * - * $Id: file.c,v 1.327 2003/12/06 04:05:02 guy Exp $ + * $Id: file.c,v 1.328 2003/12/09 06:48:38 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -113,9 +113,6 @@ static gboolean find_packet(capture_file *cf, gboolean (*match_function)(capture_file *, frame_data *, void *), void *criterion); -static void freeze_plist(capture_file *cf); -static void thaw_plist(capture_file *cf); - static char *file_rename_error_message(int err); static char *file_close_error_message(int err); static gboolean copy_binary_file(char *from_filename, char *to_filename); @@ -361,7 +358,7 @@ cf_read(capture_file *cf, int *err) #define O_BINARY 0 #endif - freeze_plist(cf); + packet_list_freeze(); stop_flag = FALSE; g_get_current_time(&start_time); @@ -441,7 +438,7 @@ cf_read(capture_file *cf, int *err) cf->lnk_t = wtap_file_encap(cf->wth); cf->current_frame = cf->first_displayed; - thaw_plist(cf); + packet_list_thaw(); statusbar_pop_file_msg(); set_display_filename(cf); @@ -502,7 +499,6 @@ int cf_start_tail(char *fname, gboolean is_tempfile, capture_file *cf) { int err; - int i; err = cf_open(fname, is_tempfile, cf); if (err == 0) { @@ -514,16 +510,6 @@ cf_start_tail(char *fname, gboolean is_tempfile, capture_file *cf) packets (yes, I know, we don't have any *yet*). */ set_menus_for_captured_packets(TRUE); - for (i = 0; i < cf->cinfo.num_cols; i++) { - if (get_column_resize_type(cf->cinfo.col_fmt[i]) == RESIZE_LIVE) - packet_list_set_column_auto_resize(i, TRUE); - else { - packet_list_set_column_auto_resize(i, FALSE); - packet_list_set_column_width(i, cf->cinfo.col_width[i]); - packet_list_set_column_resizeable(i, TRUE); - } - } - statusbar_push_file_msg(" <live capture in progress>"); } return err; @@ -598,7 +584,7 @@ cf_finish_tail(capture_file *cf, int *err) return READ_ABORTED; } - thaw_plist(cf); + packet_list_thaw(); if (auto_scroll_live && cf->plist_end != NULL) /* XXX - this cheats and looks inside the packet list to find the final row number. */ @@ -1502,7 +1488,7 @@ change_time_formats(capture_file *cf) /* Freeze the packet list while we redo it, so we don't get any screen updates while it happens. */ - freeze_plist(cf); + packet_list_freeze(); /* Update the progress bar when it gets to this value. */ cf->progbar_nextstep = 0; @@ -1624,7 +1610,7 @@ change_time_formats(capture_file *cf) } /* Unfreeze the packet list. */ - thaw_plist(cf); + packet_list_thaw(); } typedef struct { @@ -2233,43 +2219,6 @@ unmark_frame(capture_file *cf, frame_data *frame) cf->marked_count--; } -static void -freeze_plist(capture_file *cf) -{ - int i; - - /* Make the column sizes static, so they don't adjust while - we're reading the capture file (freezing the clist doesn't - seem to suffice). */ - for (i = 0; i < cf->cinfo.num_cols; i++) - packet_list_set_column_auto_resize(i, FALSE); - packet_list_freeze(); -} - -static void -thaw_plist(capture_file *cf) -{ - int i; - - for (i = 0; i < cf->cinfo.num_cols; i++) { - if (get_column_resize_type(cf->cinfo.col_fmt[i]) == RESIZE_MANUAL) { - /* Set this column's width to the appropriate value. */ - packet_list_set_column_width(i, cf->cinfo.col_width[i]); - } else { - /* Make this column's size dynamic, so that it adjusts to the - appropriate size. */ - packet_list_set_column_auto_resize(i, TRUE); - } - } - packet_list_thaw(); - - /* Hopefully, the columns have now gotten their appropriate sizes; - make them resizeable - a column that auto-resizes cannot be - resized by the user, and *vice versa*. */ - for (i = 0; i < cf->cinfo.num_cols; i++) - packet_list_set_column_resizeable(i, TRUE); -} - /* * Save a capture to a file, in a particular format, saving either * all packets, all currently-displayed packets, or all marked packets. diff --git a/gtk/main.c b/gtk/main.c index db1504bc51..3396d7e054 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -1,6 +1,6 @@ /* main.c * - * $Id: main.c,v 1.337 2003/12/07 09:43:53 oabad Exp $ + * $Id: main.c,v 1.338 2003/12/09 06:48:40 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -1101,6 +1101,7 @@ set_plist_font(PangoFontDescription *font) #endif { int i; + gint col_width; #if GTK_MAJOR_VERSION < 2 GtkStyle *style; @@ -1116,19 +1117,19 @@ set_plist_font(PangoFontDescription *font) gtk_widget_modify_font(packet_list, font); #endif - /* Compute static column sizes to use during a "-S" capture, so that - the columns don't resize during a live capture. */ + /* Compute default column sizes. */ for (i = 0; i < cfile.cinfo.num_cols; i++) { #if GTK_MAJOR_VERSION < 2 - cfile.cinfo.col_width[i] = gdk_string_width(font, + col_width = gdk_string_width(font, get_column_longest_string(get_column_format(i))); #else layout = gtk_widget_create_pango_layout(packet_list, get_column_longest_string(get_column_format(i))); - pango_layout_get_pixel_size(layout, &cfile.cinfo.col_width[i], - NULL); + pango_layout_get_pixel_size(layout, &col_width, NULL); g_object_unref(G_OBJECT(layout)); #endif + gtk_clist_set_column_width(GTK_CLIST(packet_list), i, + col_width); } } @@ -2930,8 +2931,10 @@ create_main_window (gint pl_size, gint tv_size, gint bv_size, e_prefs *prefs) SIGNAL_CONNECT(packet_list, "select-row", packet_list_select_cb, NULL); SIGNAL_CONNECT(packet_list, "unselect-row", packet_list_unselect_cb, NULL); for (i = 0; i < cfile.cinfo.num_cols; i++) { - if (get_column_resize_type(cfile.cinfo.col_fmt[i]) != RESIZE_MANUAL) - gtk_clist_set_column_auto_resize(GTK_CLIST(packet_list), i, TRUE); + /* Columns do not automatically resize, but are resizeable by + the user. */ + gtk_clist_set_column_auto_resize(GTK_CLIST(packet_list), i, FALSE); + gtk_clist_set_column_resizeable(GTK_CLIST(packet_list), i, TRUE); /* Right-justify the packet number column. */ if (cfile.cinfo.col_fmt[i] == COL_NUMBER) diff --git a/gtk/packet_list.c b/gtk/packet_list.c index a38251de05..38efaf5aeb 100644 --- a/gtk/packet_list.c +++ b/gtk/packet_list.c @@ -1,7 +1,7 @@ /* packet_list.c * packet list related functions 2002 Olivier Abad * - * $Id: packet_list.c,v 1.6 2003/12/06 04:05:02 guy Exp $ + * $Id: packet_list.c,v 1.7 2003/12/09 06:48:40 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -62,25 +62,6 @@ packet_list_select_row(gint row) } void -packet_list_set_column_auto_resize(gint column, gboolean auto_resize) -{ - gtk_clist_set_column_auto_resize(GTK_CLIST(packet_list), column, - auto_resize); -} - -void -packet_list_set_column_resizeable(gint column, gboolean resizeable) -{ - gtk_clist_set_column_resizeable(GTK_CLIST(packet_list), column, resizeable); -} - -void -packet_list_set_column_width(gint column, gint width) -{ - gtk_clist_set_column_width(GTK_CLIST(packet_list), column, width); -} - -void packet_list_moveto_end(void) { gtk_clist_moveto(GTK_CLIST(packet_list), @@ -146,7 +127,7 @@ packet_list_set_cls_time_width(gint column) pango_layout_get_pixel_size(layout, &width, NULL); g_object_unref(G_OBJECT(layout)); #endif - packet_list_set_column_width(column, width); + gtk_clist_set_column_width(GTK_CLIST(packet_list), column, width); } gpointer @@ -1,7 +1,7 @@ /* ui_util.h * Definitions for UI utility routines * - * $Id: ui_util.h,v 1.13 2003/12/06 04:05:02 guy Exp $ + * $Id: ui_util.h,v 1.14 2003/12/09 06:48:38 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -37,9 +37,6 @@ void packet_list_clear(void); void packet_list_freeze(void); void packet_list_thaw(void); void packet_list_select_row(gint); -void packet_list_set_column_auto_resize(gint, gboolean); -void packet_list_set_column_resizeable(gint, gboolean); -void packet_list_set_column_width(gint, gint); void packet_list_moveto_end(void); gint packet_list_append(gchar *text[], gpointer data); void packet_list_set_colors(gint, color_t *, color_t *); |