Added "Automatic scrolling in live capture".
authordeniel <deniel@f5534014-38df-0310-8fa8-9805f1628bb7>
Sun, 19 Sep 1999 15:54:54 +0000 (15:54 +0000)
committerdeniel <deniel@f5534014-38df-0310-8fa8-9805f1628bb7>
Sun, 19 Sep 1999 15:54:54 +0000 (15:54 +0000)
This display option is disabled by default.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@691 f5534014-38df-0310-8fa8-9805f1628bb7

display.c
file.c
globals.h

index 96d48d8a72a0d7da398a95b7336855f4c51fb5cf..31903218b8b8acffbcb3d6456652541aa1c1b268 100644 (file)
--- 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 9ed9000861a43cfcbd8f75e7b2473451feaf8882..ea2a3a8c09f7089073a5e4089b12f6e5b746c88b 100644 (file)
--- 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 */
 
index 352281c1db9e9e968564a5c43bf55f7ab16dcbe5..7bf742bd9fbeb4ac7a3161c18d1afb493c45c131 100644 (file)
--- 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;