Auto size COL_NUMBER, COL_PACKET_LENGTH and COL_CUMULATIVE_BYTES
svn path=/trunk/; revision=29778
This commit is contained in:
parent
1ce02f035d
commit
33b8efd375
|
@ -138,7 +138,7 @@ void nstime_sum(nstime_t *sum, const nstime_t *a, const nstime_t *b)
|
|||
* a < b : < 0
|
||||
*/
|
||||
|
||||
int nstime_cmp (nstime_t *a, const nstime_t *b )
|
||||
int nstime_cmp (const nstime_t *a, const nstime_t *b )
|
||||
{
|
||||
if (a->secs == b->secs) {
|
||||
return a->nsecs - b->nsecs;
|
||||
|
|
|
@ -78,7 +78,7 @@ extern void nstime_sum(nstime_t *sum, const nstime_t *b, const nstime_t *a );
|
|||
* a = b : 0
|
||||
* a < b : < 0
|
||||
*/
|
||||
extern int nstime_cmp(nstime_t *a, const nstime_t *b );
|
||||
extern int nstime_cmp (const nstime_t *a, const nstime_t *b );
|
||||
|
||||
/* converts nstime to double, time base is milli seconds */
|
||||
extern double nstime_to_msec(const nstime_t *nstime);
|
||||
|
|
|
@ -41,8 +41,9 @@
|
|||
#include "ui_util.h"
|
||||
|
||||
#include <epan/epan_dissect.h>
|
||||
#include "epan/column_info.h"
|
||||
#include "epan/column.h"
|
||||
#include <epan/column_info.h>
|
||||
#include <epan/column.h>
|
||||
#include <epan/nstime.h>
|
||||
|
||||
#include "color.h"
|
||||
#include "color_filters.h"
|
||||
|
@ -1125,13 +1126,86 @@ packet_list_get_widest_column_string(PacketList *packet_list, gint col)
|
|||
return "";
|
||||
|
||||
if (col_based_on_frame_data(&cfile.cinfo, col)) {
|
||||
/* TODO: Calculate according to column */
|
||||
PacketListRecord *record;
|
||||
guint vis_idx;
|
||||
|
||||
guint32 widest_column_val = 0;
|
||||
nstime_t widest_column_time;
|
||||
|
||||
nstime_set_zero(&widest_column_time);
|
||||
|
||||
for(vis_idx = 0; vis_idx < PACKET_LIST_RECORD_COUNT(packet_list->visible_rows); ++vis_idx) {
|
||||
record = PACKET_LIST_RECORD_GET(packet_list->visible_rows, vis_idx);
|
||||
switch (cfile.cinfo.col_fmt[col]) {
|
||||
|
||||
case COL_NUMBER:
|
||||
if (record->fdata->num > widest_column_val)
|
||||
widest_column_val = record->fdata->num;
|
||||
break;
|
||||
case COL_PACKET_LENGTH:
|
||||
if (record->fdata->pkt_len > widest_column_val)
|
||||
widest_column_val = record->fdata->pkt_len;
|
||||
break;
|
||||
case COL_CUMULATIVE_BYTES:
|
||||
if (record->fdata->cum_bytes > widest_column_val)
|
||||
widest_column_val = record->fdata->cum_bytes;
|
||||
break;
|
||||
case COL_ABS_TIME:
|
||||
if (nstime_cmp(&record->fdata->abs_ts, &widest_column_time))
|
||||
widest_column_time = record->fdata->abs_ts;
|
||||
break;
|
||||
case COL_REL_TIME:
|
||||
if (nstime_cmp(&record->fdata->rel_ts, &widest_column_time))
|
||||
widest_column_time = record->fdata->rel_ts;
|
||||
break;
|
||||
case COL_DELTA_TIME:
|
||||
if (nstime_cmp(&record->fdata->del_cap_ts, &widest_column_time))
|
||||
widest_column_time = record->fdata->del_cap_ts;
|
||||
break;
|
||||
case COL_DELTA_TIME_DIS:
|
||||
if (nstime_cmp(&record->fdata->del_dis_ts, &widest_column_time))
|
||||
widest_column_time = record->fdata->del_dis_ts;
|
||||
break;
|
||||
|
||||
case COL_CLS_TIME:
|
||||
case COL_ABS_DATE_TIME:
|
||||
/* TODO: Implement */
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
switch (cfile.cinfo.col_fmt[col]) {
|
||||
|
||||
case COL_NUMBER:
|
||||
case COL_PACKET_LENGTH:
|
||||
case COL_CUMULATIVE_BYTES:
|
||||
return ep_strdup_printf("%u", widest_column_val);
|
||||
|
||||
case COL_ABS_TIME:
|
||||
case COL_REL_TIME:
|
||||
case COL_DELTA_TIME:
|
||||
case COL_DELTA_TIME_DIS:
|
||||
/* TODO: Implement */
|
||||
return get_column_width_string(get_column_format(col), col);
|
||||
|
||||
case COL_CLS_TIME:
|
||||
case COL_ABS_DATE_TIME:
|
||||
/* TODO: Implement */
|
||||
return get_column_width_string(get_column_format(col), col);
|
||||
|
||||
default:
|
||||
g_assert_not_reached();
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else {
|
||||
PacketListRecord *record;
|
||||
guint vis_idx;
|
||||
guint widest_column_idx = 0;
|
||||
|
||||
gchar *widest_column_str = NULL;
|
||||
guint widest_column_len = 0;
|
||||
|
||||
if (!packet_list->columnized)
|
||||
|
@ -1140,14 +1214,12 @@ packet_list_get_widest_column_string(PacketList *packet_list, gint col)
|
|||
for(vis_idx = 0; vis_idx < PACKET_LIST_RECORD_COUNT(packet_list->visible_rows); ++vis_idx) {
|
||||
record = PACKET_LIST_RECORD_GET(packet_list->visible_rows, vis_idx);
|
||||
if (record->fdata->col_text_len[col] > widest_column_len) {
|
||||
widest_column_idx = vis_idx;
|
||||
widest_column_str = record->fdata->col_text[col];
|
||||
widest_column_len = record->fdata->col_text_len[col];
|
||||
}
|
||||
}
|
||||
|
||||
g_assert(widest_column_idx < PACKET_LIST_RECORD_COUNT(packet_list->visible_rows));
|
||||
record = PACKET_LIST_RECORD_GET(packet_list->visible_rows, widest_column_idx);
|
||||
return record->fdata->col_text[col];
|
||||
return widest_column_str;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue