diff options
author | Stephen Fisher <steve@stephen-fisher.com> | 2006-12-11 20:09:04 +0000 |
---|---|---|
committer | Stephen Fisher <steve@stephen-fisher.com> | 2006-12-11 20:09:04 +0000 |
commit | 41c5011f5bdc89c097b5026bd3e46dfe2bb60282 (patch) | |
tree | 9acc071303468be7ca7b6775d41afdcb1ef3ed85 /epan | |
parent | fdfd0be5bdb28eea8765e354e9d6b0d9015bc160 (diff) | |
download | wireshark-41c5011f5bdc89c097b5026bd3e46dfe2bb60282.tar.gz |
Add a new function to build column widths based not only on the max
width that is hard-coded in get_column_longest_string(), but also on the
width of the user specified title of the column (in case it is wider.)
svn path=/trunk/; revision=20117
Diffstat (limited to 'epan')
-rw-r--r-- | epan/column.c | 12 | ||||
-rw-r--r-- | epan/column.h | 1 |
2 files changed, 13 insertions, 0 deletions
diff --git a/epan/column.c b/epan/column.c index 789f3ecc54..85fe8212a5 100644 --- a/epan/column.c +++ b/epan/column.c @@ -415,6 +415,18 @@ get_timestamp_column_longest_string(gint type, gint precision) return ""; } +/* Returns the longer string of the column title or the hard-coded width of + * its contents for building the packet list layout. */ +const gchar * +get_column_width_string(gint format, gint col) +{ + if(strlen(get_column_longest_string(format)) > + strlen(get_column_title(col))) + return get_column_longest_string(format); + else + return get_column_title(col); +} + /* Returns a string representing the longest possible value for a particular column type. diff --git a/epan/column.h b/epan/column.h index 621fac03dc..e17bd626aa 100644 --- a/epan/column.h +++ b/epan/column.h @@ -36,6 +36,7 @@ gint get_column_format(gint); void get_column_format_matches(gboolean *, gint); gint get_column_format_from_str(gchar *); gchar *get_column_title(gint); +const gchar *get_column_width_string(gint, gint); const char *get_column_longest_string(gint); gint get_column_char_width(gint format); |