diff --git a/AUTHORS b/AUTHORS index d9fb7fcb58..d038707ef8 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1149,6 +1149,8 @@ Didier Gautheron { Appletalk Transaction Protocol, Appletalk Stream Protocol, and Appletalk Filing Protocol support "frame.marked" field set on marked frames + Don't show progress bar for quick "Find Frame" searches + Add "Find Next" and "Find Previous" to repeat searches } Phil Williams { diff --git a/doc/ethereal.pod.template b/doc/ethereal.pod.template index 379c5127df..611f722da1 100644 --- a/doc/ethereal.pod.template +++ b/doc/ethereal.pod.template @@ -313,7 +313,19 @@ Exit the application. Search forward or backward, starting with the currently selected packet (or the most recently selected packet, if no packet is selected), for a -packet matching a given display filter. +packet matching a given display filter expression. + +=item Edit:Find Next + +Search forward, starting with the currently selected packet +(or the most recently selected packet, if no packet is selected), for a +packet matching the filter from the previous search. + +=item Edit:Find Previous + +Search backward, starting with the currently selected packet (or the +most recently selected packet, if no packet is selected), for a packet +matching the filter from the previous search. =item Edit:Go To Frame diff --git a/file.c b/file.c index 108976ba92..b27be80881 100644 --- a/file.c +++ b/file.c @@ -1,7 +1,7 @@ /* file.c * File I/O routines * - * $Id: file.c,v 1.271 2002/05/03 03:24:45 guy Exp $ + * $Id: file.c,v 1.272 2002/05/03 21:55:12 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -1392,7 +1392,7 @@ find_packet(capture_file *cf, dfilter_t *sfcode) frame_data *start_fd; frame_data *fdata; frame_data *new_fd = NULL; - progdlg_t *progbar; + progdlg_t *progbar = NULL; gboolean stop_flag; guint32 progbar_quantum; guint32 progbar_nextstep; @@ -1410,14 +1410,18 @@ find_packet(capture_file *cf, dfilter_t *sfcode) count = 0; fdata = start_fd; - /* Update the progress bar when it gets to this value. */ - progbar_nextstep = 0; + /* Update the progress bar when it gets to this value. We start at + 20, not 0, so that we don't get a progress bar until we've + checked at least that many frames, so that a very quick search + doesn't pop up and immediately destroy a progress bar. + + XXX - should use a timer? Like 50 ms. */ + progbar_nextstep = 20; /* When we reach the value that triggers a progress bar update, bump that value by this amount. */ progbar_quantum = cf->count/N_PROGBAR_UPDATES; stop_flag = FALSE; - progbar = create_progress_dlg("Searching", "Cancel", &stop_flag); fdata = start_fd; for (;;) { @@ -1432,6 +1436,12 @@ find_packet(capture_file *cf, dfilter_t *sfcode) */ g_assert(cf->count > 0); + /* Create the progress bar if it doesn't exist; we don't create it + immediately, so that we don't have it appear and immediately + disappear if the search is quick. */ + if (progbar == NULL) + progbar = create_progress_dlg("Searching", "Cancel", &stop_flag); + update_progress_dlg(progbar, (gfloat) count / cf->count); progbar_nextstep += progbar_quantum; @@ -1483,8 +1493,10 @@ find_packet(capture_file *cf, dfilter_t *sfcode) } } - /* We're done scanning the packets; destroy the progress bar. */ - destroy_progress_dlg(progbar); + /* We're done scanning the packets; destroy the progress bar, if + we created it. */ + if (progbar != NULL) + destroy_progress_dlg(progbar); } if (new_fd != NULL) { diff --git a/gtk/find_dlg.c b/gtk/find_dlg.c index 35bc25ae4c..8404d7e99e 100644 --- a/gtk/find_dlg.c +++ b/gtk/find_dlg.c @@ -1,7 +1,7 @@ /* find_dlg.c * Routines for "find frame" window * - * $Id: find_dlg.c,v 1.21 2002/03/05 11:55:59 guy Exp $ + * $Id: find_dlg.c,v 1.22 2002/05/03 21:55:14 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -252,3 +252,31 @@ find_frame_destroy_cb(GtkWidget *win, gpointer user_data _U_) /* Note that we no longer have a "Find Frame" dialog box. */ find_frame_w = NULL; } + +static void +find_previous_next(GtkWidget *w, gpointer d, gboolean sens) +{ + dfilter_t *sfcode; + + if (cfile.sfilter) { + if (!dfilter_compile(cfile.sfilter, &sfcode)) + return; + if (sfcode == NULL) + return; + cfile.sbackward = sens; + find_packet(&cfile, sfcode); + } else + find_frame_cb(w, d); +} + +void +find_next_cb(GtkWidget *w , gpointer d) +{ + find_previous_next(w, d, FALSE); +} + +void +find_previous_cb(GtkWidget *w , gpointer d) +{ + find_previous_next(w, d, TRUE); +} diff --git a/gtk/find_dlg.h b/gtk/find_dlg.h index dd7518b018..b2bfc5bc85 100644 --- a/gtk/find_dlg.h +++ b/gtk/find_dlg.h @@ -1,7 +1,7 @@ /* find_dlg.h * Definitions for "find frame" window * - * $Id: find_dlg.h,v 1.1 1999/11/06 06:27:09 guy Exp $ + * $Id: find_dlg.h,v 1.2 2002/05/03 21:55:15 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -27,5 +27,7 @@ #define __FIND_DLG_H__ void find_frame_cb(GtkWidget *, gpointer); +void find_next_cb(GtkWidget *, gpointer); +void find_previous_cb(GtkWidget *, gpointer); #endif /* find_dlg.h */ diff --git a/gtk/menu.c b/gtk/menu.c index cb542145c3..bcc6a10308 100644 --- a/gtk/menu.c +++ b/gtk/menu.c @@ -1,7 +1,7 @@ /* menu.c * Menu routines * - * $Id: menu.c,v 1.62 2002/01/21 07:37:41 guy Exp $ + * $Id: menu.c,v 1.63 2002/05/03 21:55:15 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -117,6 +117,8 @@ static GtkItemFactoryEntry menu_items[] = {"/Edit/", NULL, NULL, 0, ""}, #endif {"/Edit/_Find Frame...", "F", GTK_MENU_FUNC(find_frame_cb), 0, NULL}, + {"/Edit/Find _Next", "N", GTK_MENU_FUNC(find_next_cb), 0, NULL}, + {"/Edit/Find _Previous", "B", GTK_MENU_FUNC(find_previous_cb), 0, NULL}, {"/Edit/_Go To Frame...", "G", GTK_MENU_FUNC(goto_frame_cb), 0, NULL}, {"/Edit/", NULL, NULL, 0, ""}, {"/Edit/_Mark Frame", "M", GTK_MENU_FUNC(mark_frame_cb), 0, NULL}, @@ -465,6 +467,8 @@ set_menus_for_captured_packets(gboolean have_captured_packets) { set_menu_sensitivity("/File/Print...", have_captured_packets); set_menu_sensitivity("/Edit/Find Frame...", have_captured_packets); + set_menu_sensitivity("/Edit/Find Next", have_captured_packets); + set_menu_sensitivity("/Edit/Find Previous", have_captured_packets); set_menu_sensitivity("/Edit/Go To Frame...", have_captured_packets); set_menu_sensitivity("/Display/Colorize Display...", have_captured_packets); set_menu_sensitivity("/Tools/Summary", have_captured_packets);