summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Deniel <laurent.deniel@free.fr>1999-09-19 15:54:54 +0000
committerLaurent Deniel <laurent.deniel@free.fr>1999-09-19 15:54:54 +0000
commit3bd68e680b0819a7620f20c7f96a539a50ab79cb (patch)
tree2a94512f6b98bc4be0f58f265ecc9fc93335a090
parent2cbdb02208b34fd4fde50a58b2b59eecab7456cd (diff)
downloadwireshark-3bd68e680b0819a7620f20c7f96a539a50ab79cb.tar.gz
Added "Automatic scrolling in live capture".
This display option is disabled by default. svn path=/trunk/; revision=691
-rw-r--r--display.c19
-rw-r--r--file.c14
-rw-r--r--globals.h3
3 files changed, 28 insertions, 8 deletions
diff --git a/display.c b/display.c
index 96d48d8a72..31903218b8 100644
--- a/display.c
+++ b/display.c
@@ -1,7 +1,7 @@
/* display.c
* Routines for packet display windows
*
- * $Id: display.c,v 1.9 1999/07/13 02:52:48 gram Exp $
+ * $Id: display.c,v 1.10 1999/09/19 15:54:54 deniel Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -80,6 +80,7 @@
#include "packet.h"
#include "file.h"
#include "display.h"
+#include "globals.h"
extern capture_file cf;
extern GtkWidget *packet_list;
@@ -88,6 +89,7 @@ extern GtkWidget *packet_list;
#define E_DISPLAY_TIME_ABS_KEY "display_time_abs"
#define E_DISPLAY_TIME_REL_KEY "display_time_rel"
#define E_DISPLAY_TIME_DELTA_KEY "display_time_delta"
+#define E_DISPLAY_AUTO_SCROLL_KEY "display_auto_scroll"
static void display_opt_ok_cb(GtkWidget *, gpointer);
static void display_opt_apply_cb(GtkWidget *, gpointer);
@@ -153,6 +155,13 @@ display_opt_cb(GtkWidget *w, gpointer d) {
button);
gtk_box_pack_start(GTK_BOX(main_vb), button, TRUE, TRUE, 0);
gtk_widget_show(button);
+
+ button = gtk_check_button_new_with_label("Automatic scrolling in live capture");
+ gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), auto_scroll_live);
+ gtk_object_set_data(GTK_OBJECT(display_opt_w), E_DISPLAY_AUTO_SCROLL_KEY,
+ button);
+ gtk_box_pack_start(GTK_BOX(main_vb), button, TRUE, TRUE, 0);
+ gtk_widget_show(button);
/* Button row: OK, Apply, and Cancel buttons */
bbox = gtk_hbutton_box_new();
@@ -206,6 +215,10 @@ display_opt_ok_cb(GtkWidget *ok_bt, gpointer parent_w) {
if (GTK_TOGGLE_BUTTON (button)->active)
timestamp_type = DELTA;
+ button = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w),
+ E_DISPLAY_AUTO_SCROLL_KEY);
+ auto_scroll_live = (GTK_TOGGLE_BUTTON (button)->active);
+
gtk_widget_destroy(GTK_WIDGET(parent_w));
display_opt_window_active = FALSE;
@@ -231,6 +244,10 @@ display_opt_apply_cb(GtkWidget *ok_bt, gpointer parent_w) {
if (GTK_TOGGLE_BUTTON (button)->active)
timestamp_type = DELTA;
+ button = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w),
+ E_DISPLAY_AUTO_SCROLL_KEY);
+ auto_scroll_live = (GTK_TOGGLE_BUTTON (button)->active);
+
change_time_formats(&cf);
}
diff --git a/file.c b/file.c
index 9ed9000861..ea2a3a8c09 100644
--- a/file.c
+++ b/file.c
@@ -1,7 +1,7 @@
/* file.c
* File I/O routines
*
- * $Id: file.c,v 1.92 1999/09/13 23:45:22 guy Exp $
+ * $Id: file.c,v 1.93 1999/09/19 15:54:54 deniel Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -87,6 +87,7 @@ extern int sync_mode;
extern int sync_pipe[];
guint cap_input_id;
+gboolean auto_scroll_live = FALSE;
static guint32 firstsec, firstusec;
static guint32 prevsec, prevusec;
@@ -310,6 +311,9 @@ cap_file_input_cb (gpointer data, gint source, GdkInputCondition condition) {
wtap_loop(cf->wth, 0, wtap_dispatch_cb, (u_char *) cf, &err);
thaw_clist(cf);
+ if (auto_scroll_live)
+ gtk_clist_moveto(GTK_CLIST(packet_list),
+ cf->plist_end->row, -1, 1.0, 1.0);
wtap_close(cf->wth);
cf->wth = NULL;
@@ -318,9 +322,7 @@ cap_file_input_cb (gpointer data, gint source, GdkInputCondition condition) {
set_menu_sensitivity("/File/Save As...", TRUE);
set_menu_sensitivity("/File/Print...", TRUE);
set_menu_sensitivity("/File/Reload", TRUE);
-#ifdef HAVE_LIBPCAP
set_menu_sensitivity("/Capture/Start...", TRUE);
-#endif
set_menu_sensitivity("/Tools/Summary", TRUE);
gtk_statusbar_push(GTK_STATUSBAR(info_bar), file_ctx, " File: <none>");
return;
@@ -350,6 +352,8 @@ cap_file_input_cb (gpointer data, gint source, GdkInputCondition condition) {
/* XXX - do something if this fails? */
wtap_loop(cf->wth, to_read, wtap_dispatch_cb, (u_char *) cf, &err);
gtk_clist_thaw(GTK_CLIST(packet_list));
+ if (auto_scroll_live)
+ gtk_clist_moveto(GTK_CLIST(packet_list), cf->plist_end->row, -1, 1.0, 1.0);
/* restore pipe handler */
cap_input_id = gtk_input_add_full (sync_pipe[0],
@@ -370,9 +374,7 @@ tail_cap_file(char *fname, capture_file *cf) {
set_menu_sensitivity("/File/Open...", FALSE);
set_menu_sensitivity("/Display/Options...", TRUE);
-#ifdef HAVE_LIBPCAP
set_menu_sensitivity("/Capture/Start...", FALSE);
-#endif
for (i = 0; i < cf->cinfo.num_cols; i++) {
if (get_column_resize_type(cf->cinfo.col_fmt[i]) == RESIZE_LIVE)
@@ -401,7 +403,7 @@ tail_cap_file(char *fname, capture_file *cf) {
}
return err;
}
-#endif
+#endif /* HAVE_LIBPCAP */
/* To do: Add check_col checks to the col_add* routines */
diff --git a/globals.h b/globals.h
index 352281c1db..7bf742bd9f 100644
--- a/globals.h
+++ b/globals.h
@@ -1,7 +1,7 @@
/* globals.h
* Global defines, etc.
*
- * $Id: globals.h,v 1.4 1999/09/12 14:34:18 deniel Exp $
+ * $Id: globals.h,v 1.5 1999/09/19 15:54:53 deniel Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -91,6 +91,7 @@ extern gchar *ethereal_path;
extern gchar *medium_font;
extern gchar *bold_font;
extern gchar *last_open_dir;
+extern gboolean auto_scroll_live;
extern ts_type timestamp_type;