aboutsummaryrefslogtreecommitdiffstats
path: root/column.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>1999-07-22 21:14:13 +0000
committerGuy Harris <guy@alum.mit.edu>1999-07-22 21:14:13 +0000
commitde459d1426cc27341dcf681cf5b35c27c9a5732a (patch)
treec208613b2cc84d2f42f671682aa475b095a439be /column.c
parent0e7a2d905adb67f334d3bdc3cc5139ee2fabef04 (diff)
Revert to static sizing of columns.
svn path=/trunk/; revision=377
Diffstat (limited to 'column.c')
-rw-r--r--column.c67
1 files changed, 66 insertions, 1 deletions
diff --git a/column.c b/column.c
index 783ed1e8ab..77cfc7cc97 100644
--- a/column.c
+++ b/column.c
@@ -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