From Didieer Gautheron:

Don't show progress bar for quick "Find Frame" searches
	Add "Find Next" and "Find Previous" to repeat searches

Add documentation for "Find Next" and "Find Previous".

svn path=/trunk/; revision=5378
This commit is contained in:
Guy Harris 2002-05-03 21:55:15 +00:00
parent 7aba39031e
commit 71f8208bf9
6 changed files with 71 additions and 11 deletions

View File

@ -1149,6 +1149,8 @@ Didier Gautheron <dgautheron[AT]magic.fr> {
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 <csypbw[AT]comp.leeds.ac.uk> {

View File

@ -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

26
file.c
View File

@ -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 <gerald@ethereal.com>
@ -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) {

View File

@ -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 <gerald@ethereal.com>
@ -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);
}

View File

@ -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 <gerald@zing.org>
@ -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 */

View File

@ -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 <gerald@ethereal.com>
@ -117,6 +117,8 @@ static GtkItemFactoryEntry menu_items[] =
{"/Edit/<separator>", NULL, NULL, 0, "<Separator>"},
#endif
{"/Edit/_Find Frame...", "<control>F", GTK_MENU_FUNC(find_frame_cb), 0, NULL},
{"/Edit/Find _Next", "<control>N", GTK_MENU_FUNC(find_next_cb), 0, NULL},
{"/Edit/Find _Previous", "<control>B", GTK_MENU_FUNC(find_previous_cb), 0, NULL},
{"/Edit/_Go To Frame...", "<control>G", GTK_MENU_FUNC(goto_frame_cb), 0, NULL},
{"/Edit/<separator>", NULL, NULL, 0, "<Separator>"},
{"/Edit/_Mark Frame", "<control>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);