Optimized finding current row from cfile.current_frame.
svn path=/trunk/; revision=26804
This commit is contained in:
parent
bfd1d4e42b
commit
5498ec1dce
1
cfile.h
1
cfile.h
@ -82,6 +82,7 @@ typedef struct _capture_file {
|
||||
frame_data *last_displayed; /* Last frame displayed */
|
||||
column_info cinfo; /* Column formatting information */
|
||||
frame_data *current_frame; /* Frame data for current frame */
|
||||
gint current_row; /* Row number for current frame */
|
||||
epan_dissect_t *edt; /* Protocol dissection for currently selected packet */
|
||||
field_info *finfo_selected; /* Field info for currently selected field */
|
||||
struct ph_stats_s* pstats; /* accumulated stats (reset on redisplay in GUI)*/
|
||||
|
5
file.c
5
file.c
@ -349,6 +349,7 @@ cf_reset_state(capture_file *cf)
|
||||
|
||||
/* No frame selected, no field in that frame selected. */
|
||||
cf->current_frame = NULL;
|
||||
cf->current_row = 0;
|
||||
cf->finfo_selected = NULL;
|
||||
|
||||
/* Clear the packet list. */
|
||||
@ -566,6 +567,8 @@ cf_read(capture_file *cf)
|
||||
cf->lnk_t = wtap_file_encap(cf->wth);
|
||||
|
||||
cf->current_frame = cf->first_displayed;
|
||||
cf->current_row = 0;
|
||||
|
||||
packet_list_thaw();
|
||||
|
||||
cf_callback_invoke(cf_cb_file_read_finished, cf);
|
||||
@ -3342,6 +3345,7 @@ cf_select_packet(capture_file *cf, int row)
|
||||
|
||||
/* Record that this frame is the current frame. */
|
||||
cf->current_frame = fdata;
|
||||
cf->current_row = row;
|
||||
|
||||
/* Create the logical protocol tree. */
|
||||
if (cf->edt != NULL) {
|
||||
@ -3371,6 +3375,7 @@ cf_unselect_packet(capture_file *cf)
|
||||
|
||||
/* No packet is selected. */
|
||||
cf->current_frame = NULL;
|
||||
cf->current_row = 0;
|
||||
|
||||
cf_callback_invoke(cf_cb_packet_unselected, cf);
|
||||
|
||||
|
@ -524,10 +524,8 @@ static void reftime_answered_cb(gpointer dialog _U_, gint btn, gpointer data _U_
|
||||
}
|
||||
|
||||
if (cfile.current_frame) {
|
||||
/* XXX hum, should better have a "cfile->current_row" here ... */
|
||||
set_frame_reftime(!cfile.current_frame->flags.ref_time,
|
||||
cfile.current_frame,
|
||||
packet_list_find_row_from_data(cfile.current_frame));
|
||||
cfile.current_frame, cfile.current_row);
|
||||
}
|
||||
}
|
||||
|
||||
@ -548,10 +546,8 @@ reftime_frame_cb(GtkWidget *w _U_, gpointer data _U_, REFTIME_ACTION_E action)
|
||||
simple_dialog_primary_start(), simple_dialog_primary_end());
|
||||
simple_dialog_set_cb(reftime_dialog, reftime_answered_cb, NULL);
|
||||
} else {
|
||||
/* XXX hum, should better have a "cfile->current_row" here ... */
|
||||
set_frame_reftime(!cfile.current_frame->flags.ref_time,
|
||||
cfile.current_frame,
|
||||
packet_list_find_row_from_data(cfile.current_frame));
|
||||
cfile.current_frame, cfile.current_row);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -268,8 +268,7 @@ packet_list_select_cb(GtkWidget *w _U_, gint row, gint col _U_, GdkEventButton *
|
||||
frame_data *fdata;
|
||||
|
||||
/* Check if already selected */
|
||||
if (cfile.current_frame &&
|
||||
(gtk_clist_find_row_from_data(GTK_CLIST(packet_list), cfile.current_frame) == row))
|
||||
if (cfile.current_frame && cfile.current_row == row)
|
||||
return;
|
||||
|
||||
/* Remove the hex display tabbed pages */
|
||||
@ -330,11 +329,8 @@ static void mark_frames_ready(void) {
|
||||
|
||||
void packet_list_mark_frame_cb(GtkWidget *w _U_, gpointer data _U_) {
|
||||
if (cfile.current_frame) {
|
||||
/* XXX hum, should better have a "cfile->current_row" here ... */
|
||||
set_frame_mark(!cfile.current_frame->flags.marked,
|
||||
cfile.current_frame,
|
||||
gtk_clist_find_row_from_data(GTK_CLIST(packet_list),
|
||||
cfile.current_frame));
|
||||
cfile.current_frame, cfile.current_row);
|
||||
mark_frames_ready();
|
||||
}
|
||||
}
|
||||
@ -934,36 +930,32 @@ packet_list_get_sort_column(void)
|
||||
|
||||
void packet_list_copy_summary_cb(GtkWidget * w _U_, gpointer data _U_, copy_summary_type copy_type)
|
||||
{
|
||||
gint row;
|
||||
gint col;
|
||||
gchar* celltext = NULL;
|
||||
GString* text;
|
||||
|
||||
if(CS_CSV == copy_type) {
|
||||
text = g_string_new("\"");
|
||||
} else {
|
||||
text = g_string_new("");
|
||||
}
|
||||
if(CS_CSV == copy_type) {
|
||||
text = g_string_new("\"");
|
||||
} else {
|
||||
text = g_string_new("");
|
||||
}
|
||||
|
||||
if (cfile.current_frame) {
|
||||
/* XXX hum, should better have a "cfile->current_row" here ... */
|
||||
row = gtk_clist_find_row_from_data(GTK_CLIST(packet_list),
|
||||
cfile.current_frame);
|
||||
for(col = 0; col < cfile.cinfo.num_cols; ++col) {
|
||||
if(col != 0) {
|
||||
if(CS_CSV == copy_type) {
|
||||
g_string_append(text,"\",\"");
|
||||
} else {
|
||||
g_string_append_c(text, '\t');
|
||||
}
|
||||
if(CS_CSV == copy_type) {
|
||||
g_string_append(text,"\",\"");
|
||||
} else {
|
||||
g_string_append_c(text, '\t');
|
||||
}
|
||||
}
|
||||
if(0 != gtk_clist_get_text(GTK_CLIST(packet_list),row,col,&celltext)) {
|
||||
if(0 != gtk_clist_get_text(GTK_CLIST(packet_list),cfile.current_row,col,&celltext)) {
|
||||
g_string_append(text,celltext);
|
||||
}
|
||||
}
|
||||
if(CS_CSV == copy_type) {
|
||||
g_string_append_c(text,'"');
|
||||
}
|
||||
if(CS_CSV == copy_type) {
|
||||
g_string_append_c(text,'"');
|
||||
}
|
||||
copy_to_clipboard(text);
|
||||
}
|
||||
g_string_free(text,TRUE);
|
||||
|
Loading…
x
Reference in New Issue
Block a user