diff options
Diffstat (limited to 'column.c')
-rw-r--r-- | column.c | 67 |
1 files changed, 66 insertions, 1 deletions
@@ -1,7 +1,7 @@ /* column.c * Routines for handling column preferences * - * $Id: column.c,v 1.17 1999/07/22 16:03:51 gram Exp $ + * $Id: column.c,v 1.18 1999/07/22 21:14:13 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -170,6 +170,71 @@ get_column_format_matches(gboolean *fmt_list, gint format) { } } +/* Returns the longest possible width for a particular column type */ +/* XXX - this is somewhat fragile; we should probably generate */ +/* the summary lines for all the packets first, and compute the */ +/* maximum column width as the maximum string width of all the */ +/* values in that column. */ +gint +get_column_width(gint format, GdkFont *font) { + switch (format) { + case COL_NUMBER: + return (gdk_string_width(font, "0") * 7); + break; + case COL_CLS_TIME: + if (timestamp_type == ABSOLUTE) + return (gdk_string_width(font, "00:00:00.000000")); + else + return (gdk_string_width(font, "0000.000000")); + break; + case COL_ABS_TIME: + return (gdk_string_width(font, "00:00:00.000000")); + break; + case COL_REL_TIME: + case COL_DELTA_TIME: + return (gdk_string_width(font, "0000.000000")); + 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: + return (gdk_string_width(font, "00000000.000000000000")); /* IPX-style */ + break; + 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: + return (gdk_string_width(font, "0") * 6); + break; + case COL_PROTOCOL: + return (gdk_string_width(font, "NBNS (UDP)")); + break; + case COL_PACKET_LENGTH: + return (gdk_string_width(font, "0") * 6); + break; + default: /* COL_INFO */ + return (gdk_string_width(font, "Source port: kerberos-master " + "Destination port: kerberos-master")); + break; + } +} + #define TIME_DEF 0 #define TIME_REL 1 #define TIME_ABS 2 |