aboutsummaryrefslogtreecommitdiffstats
path: root/column.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>1999-09-12 06:11:51 +0000
committerGuy Harris <guy@alum.mit.edu>1999-09-12 06:11:51 +0000
commit55dff94484c61dce121553db3e0b0a709b7fa89b (patch)
tree54d4019a09a818e5bb4040336fd2a36bd0e9a2f3 /column.c
parent0041a76bfcd5098595c7991001b09665a36943cd (diff)
Add summary-vs-detail radio buttons to the print dialog box; detail
prints the protocol tree, and summary prints the fields in the summary clist, with a header line at the beginning of the printout. Print only packets selected by the current packet filter. Just have "ARP" and "RARP" in the "Protocol" field for ARP packets; whether it's a request or a reply can be seen in the "Info" field. Add to the "Frame" section of the protocol tree the time between the current packet and the previous displayed packet, and the packet number. Have FT_RELATIVE_TIME fields be a "struct timeval", and display them as seconds and fractional seconds (we didn't have any fields of that type, and that type of time fits the delta time above). Add an FT_DOUBLE field type (although we don't yet have anything using it). svn path=/trunk/; revision=666
Diffstat (limited to 'column.c')
-rw-r--r--column.c67
1 files changed, 42 insertions, 25 deletions
diff --git a/column.c b/column.c
index a654ed5dbd..b7ea2d6da6 100644
--- a/column.c
+++ b/column.c
@@ -1,7 +1,7 @@
/* column.c
* Routines for handling column preferences
*
- * $Id: column.c,v 1.23 1999/09/10 07:09:35 guy Exp $
+ * $Id: column.c,v 1.24 1999/09/12 06:11:34 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -168,35 +168,27 @@ get_column_format_matches(gboolean *fmt_list, gint format) {
}
}
-/* Returns the longest possible width for a particular column type.
-
- Except for the COL...SRC and COL...DST columns, these are used
- only when a capture is being displayed while it's taking place;
- they are arguably somewhat fragile, as changes to the code that
- generates them don't cause these widths to change, but that's
- probably not too big a problem, given that the sizes are
- recomputed based on the actual data in the columns when the capture
- is done, and given that the width for COL...SRC and COL...DST columns
- is somewhat arbitrary in any case. We should probably clean
- that up eventually, though. */
-gint
-get_column_width(gint format, GdkFont *font) {
+/* Returns a string representing the longest possible value for a
+ particular column type. */
+static char *
+get_column_longest_string(gint format)
+{
switch (format) {
case COL_NUMBER:
- return (gdk_string_width(font, "0") * 7);
+ return "0000000";
break;
case COL_CLS_TIME:
if (timestamp_type == ABSOLUTE)
- return (gdk_string_width(font, "00:00:00.000000"));
+ return "00:00:00.000000";
else
- return (gdk_string_width(font, "0000.000000"));
+ return "0000.000000";
break;
case COL_ABS_TIME:
- return (gdk_string_width(font, "00:00:00.000000"));
+ return "00:00:00.000000";
break;
case COL_REL_TIME:
case COL_DELTA_TIME:
- return (gdk_string_width(font, "0000.000000"));
+ return "0000.000000";
break;
case COL_DEF_SRC:
case COL_RES_SRC:
@@ -216,7 +208,7 @@ get_column_width(gint format, GdkFont *font) {
case COL_DEF_NET_DST:
case COL_RES_NET_DST:
case COL_UNRES_NET_DST:
- return (gdk_string_width(font, "00000000.000000000000")); /* IPX-style */
+ return "00000000.000000000000"; /* IPX-style */
break;
case COL_DEF_SRC_PORT:
case COL_RES_SRC_PORT:
@@ -224,21 +216,46 @@ get_column_width(gint format, GdkFont *font) {
case COL_DEF_DST_PORT:
case COL_RES_DST_PORT:
case COL_UNRES_DST_PORT:
- return (gdk_string_width(font, "0") * 6);
+ return "000000";
break;
case COL_PROTOCOL:
- return (gdk_string_width(font, "NBNS (UDP)"));
+ return "NBNS (UDP)";
break;
case COL_PACKET_LENGTH:
- return (gdk_string_width(font, "0") * 6);
+ return "000000";
break;
default: /* COL_INFO */
- return (gdk_string_width(font, "Source port: kerberos-master "
- "Destination port: kerberos-master"));
+ return "Source port: kerberos-master Destination port: kerberos-master";
break;
}
}
+/* Returns the longest possible width, using the specified font,
+ for a particular column type.
+
+ Except for the COL...SRC and COL...DST columns, these are used
+ only when a capture is being displayed while it's taking place;
+ they are arguably somewhat fragile, as changes to the code that
+ generates them don't cause these widths to change, but that's
+ probably not too big a problem, given that the sizes are
+ recomputed based on the actual data in the columns when the capture
+ is done, and given that the width for COL...SRC and COL...DST columns
+ is somewhat arbitrary in any case. We should probably clean
+ that up eventually, though. */
+gint
+get_column_width(gint format, GdkFont *font)
+{
+ return (gdk_string_width(font, get_column_longest_string(format)));
+}
+
+/* Returns the longest possible width, in characters, for a particular
+ column type. */
+gint
+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) {