fix detailed event list behavior
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Wed, 11 Oct 2006 18:04:57 +0000 (18:04 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Wed, 11 Oct 2006 18:04:57 +0000 (18:04 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@2194 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/configure.in
ltt/branches/poly/lttv/lttv/batchtest.c
ltt/branches/poly/lttv/lttv/tracecontext.c
ltt/branches/poly/lttv/lttv/tracecontext.h
ltt/branches/poly/lttv/modules/gui/detailedevents/events.c
ltt/branches/poly/lttv/modules/gui/detailedevents/events.h
ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/interface.c

index 2cf664c66ea17aba0344fbff60081f11d39dea4e..3c797808400f4cca1c749e82b191c4b7a377c07d 100644 (file)
@@ -23,7 +23,7 @@
 AC_PREREQ(2.57)
 AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)
 #AC_WITH_LTDL  # not needed ?
-AM_INIT_AUTOMAKE(LinuxTraceToolkitViewer,0.8.63-10102006)
+AM_INIT_AUTOMAKE(LinuxTraceToolkitViewer,0.8.64-11102006)
 AM_CONFIG_HEADER(config.h)
 AM_PROG_LIBTOOL
 
index 865a4cb9e8184641eb7e315c6a1e6b27e208060e..7b26ac6b1b9c14333ad6e2d6a17f5da1f7acc32b 100644 (file)
@@ -661,18 +661,18 @@ static gboolean process_traceset(void __UNUSED__ *hook_data,
     g_message("Running test 9 : seek_forward and seek_backward");
     lttv_process_traceset_seek_time(tsc, ltt_time_zero);
 
-    count = lttv_process_traceset_seek_n_forward(tsc, 500, NULL, NULL, NULL, NULL, NULL);
+    count = lttv_process_traceset_seek_n_forward(tsc, 500, NULL, NULL, NULL, NULL, NULL, NULL);
     g_assert(count == 500);
     lttv_traceset_context_position_save(tsc, saved_pos);
     t0 = get_time();
-    count = lttv_process_traceset_seek_n_forward(tsc, 150000, NULL, NULL, NULL, NULL, NULL);
+    count = lttv_process_traceset_seek_n_forward(tsc, 150000, NULL, NULL, NULL, NULL, NULL, NULL);
     t1 = get_time();
     g_message("Seek forward 150000 events in %g seconds", t1 - t0);
     g_assert(count == 150000);
     t0 = get_time();
     count = lttv_process_traceset_seek_n_backward(tsc, 150000,
         seek_back_default_offset, lttv_process_traceset_seek_time, NULL,
-        NULL, NULL, NULL, NULL);
+        NULL, NULL, NULL, NULL, NULL);
     t1 = get_time();
     g_message("Seek backward 150000 events in %g seconds", t1 - t0);
     g_assert(count == 150000);
@@ -680,20 +680,20 @@ static gboolean process_traceset(void __UNUSED__ *hook_data,
       g_warning("Problem with seek_n ! Positions differ. (1)");
     }
     
-    lttv_process_traceset_seek_n_forward(tsc, 500, NULL, NULL, NULL, NULL, NULL);
+    lttv_process_traceset_seek_n_forward(tsc, 500, NULL, NULL, NULL, NULL, NULL, NULL);
     lttv_traceset_context_position_save(tsc, saved_pos);
-    lttv_process_traceset_seek_n_forward(tsc, 15000, NULL, NULL, NULL, NULL, NULL);
+    lttv_process_traceset_seek_n_forward(tsc, 15000, NULL, NULL, NULL, NULL, NULL, NULL);
     lttv_process_traceset_seek_n_backward(tsc, 15005,
         seek_back_default_offset, lttv_process_traceset_seek_time, NULL,
-        NULL, NULL, NULL, NULL);
-    lttv_process_traceset_seek_n_forward(tsc, 5, NULL, NULL, NULL, NULL, NULL);
+        NULL, NULL, NULL, NULL, NULL);
+    lttv_process_traceset_seek_n_forward(tsc, 5, NULL, NULL, NULL, NULL, NULL, NULL);
     if(lttv_traceset_context_ctx_pos_compare(tsc, saved_pos)) {
       g_warning("Problem with seek_n ! Positions differ. (2)");
     }
     
     lttv_process_traceset_seek_time(tsc, ltt_time_infinite);
     
-    count = lttv_process_traceset_seek_n_forward(tsc, 15000, NULL, NULL, NULL, NULL, NULL);
+    count = lttv_process_traceset_seek_n_forward(tsc, 15000, NULL, NULL, NULL, NULL, NULL, NULL);
     if(count > 0)
       g_warning("Problem with seek_n ! Forward at end of traceset.");
     
@@ -703,11 +703,11 @@ static gboolean process_traceset(void __UNUSED__ *hook_data,
     t0 = get_time();
     lttv_process_traceset_seek_n_backward(tsc, 300,
         seek_back_default_offset, lttv_process_traceset_seek_time, NULL,
-        NULL, NULL, NULL, NULL);
+        NULL, NULL, NULL, NULL, NULL);
     t1 = get_time();
     g_message("Seek backward 300 events in %g seconds", t1 - t0);
-    count = lttv_process_traceset_seek_n_forward(tsc, 299, NULL, NULL, NULL, NULL, NULL);
-    count = lttv_process_traceset_seek_n_forward(tsc, 1, NULL, NULL, NULL, NULL, NULL);
+    count = lttv_process_traceset_seek_n_forward(tsc, 299, NULL, NULL, NULL, NULL, NULL, NULL);
+    count = lttv_process_traceset_seek_n_forward(tsc, 1, NULL, NULL, NULL, NULL, NULL, NULL);
 
     if(lttv_traceset_context_ctx_pos_compare(tsc, saved_pos)) {
       g_warning("Problem with seek_n ! Positions differ. (4)");
@@ -717,11 +717,11 @@ static gboolean process_traceset(void __UNUSED__ *hook_data,
     t0 = get_time();
     lttv_process_traceset_seek_n_backward(tsc, 10,
         seek_back_default_offset, lttv_process_traceset_seek_time, NULL,
-        NULL, NULL, NULL, NULL);
+        NULL, NULL, NULL, NULL, NULL);
     t1 = get_time();
     g_message("Seek backward 10 events in %g seconds", t1 - t0);
     t0 = get_time();
-    count = lttv_process_traceset_seek_n_forward(tsc, 10, NULL, NULL, NULL, NULL, NULL);
+    count = lttv_process_traceset_seek_n_forward(tsc, 10, NULL, NULL, NULL, NULL, NULL, NULL);
     t1 = get_time();
     g_message("Seek forward 10 events in %g seconds", t1 - t0);
 
@@ -732,9 +732,9 @@ static gboolean process_traceset(void __UNUSED__ *hook_data,
     lttv_traceset_context_position_save(tsc, saved_pos);
     lttv_process_traceset_seek_n_backward(tsc, 301,
         seek_back_default_offset, lttv_process_traceset_seek_time, NULL,
-        NULL, NULL, NULL, NULL);
-    count = lttv_process_traceset_seek_n_forward(tsc, 299, NULL, NULL, NULL, NULL, NULL);
-    count = lttv_process_traceset_seek_n_forward(tsc, 1, NULL, NULL, NULL, NULL, NULL);
+        NULL, NULL, NULL, NULL, NULL);
+    count = lttv_process_traceset_seek_n_forward(tsc, 299, NULL, NULL, NULL, NULL, NULL, NULL);
+    count = lttv_process_traceset_seek_n_forward(tsc, 1, NULL, NULL, NULL, NULL, NULL, NULL);
 
     if(lttv_traceset_context_ctx_pos_compare(tsc, saved_pos) == 0) {
       g_warning("Problem with seek_n ! Positions _should_ differ. (5)");
@@ -743,17 +743,17 @@ static gboolean process_traceset(void __UNUSED__ *hook_data,
     /* Try a seek by closest time : Hint : try this one with and without states
      * computed. */
     lttv_process_traceset_seek_time(tsc, ltt_time_zero);
-    count = lttv_process_traceset_seek_n_forward(tsc, 200000, NULL, NULL, NULL, NULL, NULL);
+    count = lttv_process_traceset_seek_n_forward(tsc, 200000, NULL, NULL, NULL, NULL, NULL, NULL);
     lttv_traceset_context_position_save(tsc, saved_pos);
     t0 = get_time();
     lttv_process_traceset_seek_n_backward(tsc, 100301,
         seek_back_default_offset,
         (seek_time_fct)lttv_state_traceset_seek_time_closest, NULL,
-        NULL, NULL, NULL, NULL);
+        NULL, NULL, NULL, NULL, NULL);
     t1 = get_time();
     g_message("Seek backward 100301 events (with seek closest) in %g seconds",
                 t1 - t0);
-    count = lttv_process_traceset_seek_n_forward(tsc, 100301, NULL, NULL, NULL, NULL, NULL);
+    count = lttv_process_traceset_seek_n_forward(tsc, 100301, NULL, NULL, NULL, NULL, NULL, NULL);
     
     if(lttv_traceset_context_ctx_pos_compare(tsc, saved_pos)) {
       g_warning("Problem with seek_n with state seek time! Positions differ. (6)");
@@ -769,7 +769,7 @@ static gboolean process_traceset(void __UNUSED__ *hook_data,
       lttv_traceset_context_position_new(tsc);
 
     lttv_process_traceset_seek_time(tsc, ltt_time_zero);
-    lttv_process_traceset_seek_n_forward(tsc, 200000, NULL, NULL, NULL, NULL, NULL);
+    lttv_process_traceset_seek_n_forward(tsc, 200000, NULL, NULL, NULL, NULL, NULL, NULL);
     lttv_traceset_context_position_save(tsc, saved_pos);
     if(lttv_traceset_context_ctx_pos_compare(tsc, saved_pos) != 0)
       g_critical("Error in seek position. (1)");
@@ -777,7 +777,7 @@ static gboolean process_traceset(void __UNUSED__ *hook_data,
     lttv_process_traceset_seek_time(tsc, ltt_time_infinite);
     lttv_process_traceset_seek_n_backward(tsc, 500,
         seek_back_default_offset, lttv_process_traceset_seek_time, NULL,
-        NULL, NULL, NULL, NULL);
+        NULL, NULL, NULL, NULL, NULL);
     lttv_traceset_context_position_save(tsc, saved_pos);
 
     if(lttv_traceset_context_ctx_pos_compare(tsc, saved_pos) != 0)
index f98f812c3db1043b61f33ad1b5e12a1a19769e45..ca7f4ea414c9370b4d7e4a33cb541b1ea72c380c 100644 (file)
@@ -1340,6 +1340,7 @@ struct seek_back_data {
   LttvFilter *filter1;
   LttvFilter *filter2;
   LttvFilter *filter3;
+  gpointer data;
   check_handler *check;
   gboolean *stop_flag;
   guint raw_event_count;
@@ -1352,7 +1353,8 @@ static gint seek_back_event_hook(void *hook_data, void* call_data)
   LttvTracesetContext *tsc = tfc->t_context->ts_context;
   LttvTracesetContextPosition *pos;
 
-  if(sd->check && sd->check(sd->raw_event_count, sd->stop_flag)) return TRUE;
+  if(sd->check && sd->check(sd->raw_event_count, sd->stop_flag, sd->data))
+    return TRUE;
   sd->raw_event_count++;
 
   if(sd->filter1 != NULL && sd->filter1->head != NULL && 
@@ -1426,7 +1428,8 @@ guint lttv_process_traceset_seek_n_backward(LttvTracesetContext *self,
                                             gboolean *stop_flag,
                                            LttvFilter *filter1,
                                            LttvFilter *filter2,
-                                           LttvFilter *filter3)
+                                           LttvFilter *filter3,
+                                           gpointer data)
 {
   if(lttv_traceset_number(self->ts) == 0) return 0;
   g_assert(ltt_time_compare(first_offset, ltt_time_zero) != 0);
@@ -1450,6 +1453,7 @@ guint lttv_process_traceset_seek_n_backward(LttvTracesetContext *self,
   sd.filter1 = filter1;
   sd.filter2 = filter2;
   sd.filter3 = filter3;
+  sd.data = data;
   sd.n = n;
   sd.check = check;
   sd.stop_flag = stop_flag;
@@ -1562,6 +1566,7 @@ struct seek_forward_data {
   LttvFilter *filter1;
   LttvFilter *filter2;
   LttvFilter *filter3;
+  gpointer data;
   check_handler *check;
   gboolean *stop_flag;
   guint raw_event_count;  /* event counter */
@@ -1572,7 +1577,8 @@ static gint seek_forward_event_hook(void *hook_data, void* call_data)
   struct seek_forward_data *sd = (struct seek_forward_data*)hook_data;
   LttvTracefileContext *tfc = (LttvTracefileContext*)call_data;
 
-  if(sd->check && sd->check(sd->raw_event_count, sd->stop_flag)) return TRUE;
+  if(sd->check && sd->check(sd->raw_event_count, sd->stop_flag, sd->data))
+    return TRUE;
   sd->raw_event_count++;
 
   if(sd->filter1 != NULL && sd->filter1->head != NULL && 
@@ -1621,7 +1627,8 @@ guint lttv_process_traceset_seek_n_forward(LttvTracesetContext *self,
                                           gboolean *stop_flag,
                                          LttvFilter *filter1,
                                          LttvFilter *filter2,
-                                         LttvFilter *filter3)
+                                         LttvFilter *filter3,
+                                         gpointer data)
 {
   struct seek_forward_data sd;
   sd.event_count = 0;
@@ -1629,6 +1636,7 @@ guint lttv_process_traceset_seek_n_forward(LttvTracesetContext *self,
   sd.filter1 = filter1;
   sd.filter2 = filter2;
   sd.filter3 = filter3;
+  sd.data = data;
   sd.check = check;
   sd.stop_flag = stop_flag;
   sd.raw_event_count = 0;
index 70993e7a693c8ed4570bb918f297cad921360b34..1336160be970e70fbb17fb54d635a184bf8e2898 100644 (file)
@@ -352,7 +352,7 @@ void lttv_process_traceset_get_sync_data(LttvTracesetContext *tsc);
 
 static const LttTime seek_back_default_offset = { 1, 0 };
 
-typedef gboolean check_handler(guint count, gboolean *stop_flag);
+typedef gboolean check_handler(guint count, gboolean *stop_flag, gpointer data);
 
 guint lttv_process_traceset_seek_n_forward(LttvTracesetContext *self,
                                            guint n,
@@ -360,7 +360,8 @@ guint lttv_process_traceset_seek_n_forward(LttvTracesetContext *self,
                                           gboolean *stop_flag,
                                           LttvFilter *filter1,
                                           LttvFilter *filter2,
-                                          LttvFilter *filter3);
+                                          LttvFilter *filter3,
+                                          gpointer data);
 typedef void (*seek_time_fct)(LttvTracesetContext *self, LttTime start);
 
 /* If first_offset is ltt_time_zero, it will choose a default value */
@@ -372,7 +373,8 @@ guint lttv_process_traceset_seek_n_backward(LttvTracesetContext *self,
                                            gboolean *stop_flag,
                                            LttvFilter *filter1,
                                            LttvFilter *filter2,
-                                           LttvFilter *filter3);
+                                           LttvFilter *filter3,
+                                           gpointer data);
 
 
 #endif // PROCESSTRACE_H
index 2e123ad6ea4b0388bad64df41fa46a268e59bc64..5350ab45115c6b3f25a8c8d486fc2092b1dda75c 100644 (file)
@@ -237,6 +237,8 @@ gui_events(LttvPluginTab *ptab)
 
   event_viewer_data->last_tree_update_time = 0;
 
+  event_viewer_data->init_done = 0;
+
   /* Create a model for storing the data list */
   event_viewer_data->store_m = gtk_list_store_new (
     N_COLUMNS,      /* Total number of columns     */
@@ -460,6 +462,9 @@ gui_events(LttvPluginTab *ptab)
   event_viewer_data->previous_value = 0;
   event_viewer_data->vadjust_c->lower = 0.0;
     //event_viewer_data->vadjust_c->upper = event_viewer_data->number_of_events;
+  LttTime time = lttvwindow_get_current_time(tab);
+  time = ltt_time_sub(time, tsc->time_span.start_time);
+  event_viewer_data->vadjust_c->value = ltt_time_to_double(time);
   event_viewer_data->vadjust_c->value = 0.0;
   event_viewer_data->vadjust_c->step_increment = 1.0;
   event_viewer_data->vadjust_c->page_increment = 2.0;
@@ -505,9 +510,9 @@ gui_events(LttvPluginTab *ptab)
   
   event_viewer_data->background_info_waiting = 0;
 
+
   request_background_data(event_viewer_data);
   
-
   return event_viewer_data;
 }
 
@@ -1101,6 +1106,7 @@ static void tree_selection_changed_cb (GtkTreeSelection *selection,
 {
   g_debug("tree sel changed cb");
   EventViewerData *event_viewer_data = (EventViewerData*) data;
+
 #if 0
     /* Set the cursor to currently selected event */
   GtkTreeModel* model = GTK_TREE_MODEL(event_viewer_data->store_m);
@@ -1229,14 +1235,15 @@ void tree_v_size_allocate_cb (GtkWidget *widget, GtkAllocation *alloc, gpointer
     floor(exact_num_visible);
 */
  
-  g_debug("size allocate : last_num_visible_events : %d,\
-           num_visible_events : %d",
-           last_num_visible_events,
-           event_viewer_data->num_visible_events);
-  if(event_viewer_data->num_visible_events != last_num_visible_events)
-    {
+  g_debug("size allocate %p : last_num_visible_events : %d",
+           event_viewer_data, last_num_visible_events);
+  g_debug("num_visible_events : %d, value %lu",
+           event_viewer_data->num_visible_events,
+          event_viewer_data->vadjust_c->value);
+
+  if(event_viewer_data->num_visible_events != last_num_visible_events) {
       get_events(event_viewer_data->vadjust_c->value, event_viewer_data);
-    }
+  }
   
 
 }
@@ -1280,10 +1287,23 @@ gboolean show_event_detail(void * hook_data, void * call_data)
 }
 #endif //0
 
-static gboolean events_check_handler(guint count, gboolean *stop_flag)
+static gboolean events_check_handler(guint count, gboolean *stop_flag,
+  gpointer data)
 {
+  EventViewerData *evd = (EventViewerData*)data;
   if(count % CHECK_GDK_INTERVAL == 0) {
-    gtk_main_iteration_do(FALSE);
+    GdkEvent *event;
+    GtkWidget *widget;
+    while((event = gdk_event_get()) != NULL) {
+        widget = gtk_get_event_widget(event);
+        if(widget == 
+         lookup_widget(main_window_get_widget(evd->tab),
+             "StopProcessingButton")) {
+          gtk_main_do_event(event);
+         gdk_window_process_all_updates();
+       }
+        gdk_event_free(event);
+    }
     if(*stop_flag)
       return TRUE;
     else
@@ -1410,7 +1430,7 @@ static void get_events(double new_value, EventViewerData *event_viewer_data)
           events_check_handler,
           &event_viewer_data->tab->stop_foreground,
           event_viewer_data->main_win_filter,
-          event_viewer_data->filter, NULL);
+          event_viewer_data->filter, NULL, event_viewer_data);
     } else if(relative_position < 0) {
       guint count;
       
@@ -1430,7 +1450,7 @@ static void get_events(double new_value, EventViewerData *event_viewer_data)
          events_check_handler,
          &event_viewer_data->tab->stop_foreground,
           event_viewer_data->main_win_filter,
-          event_viewer_data->filter, NULL);
+          event_viewer_data->filter, NULL, event_viewer_data);
     } /* else 0 : do nothing : we are already at the beginning position */
 
     lttv_traceset_context_position_destroy(pos);
@@ -1525,7 +1545,19 @@ int event_hook(void *hook_data, void *call_data)
   LttEvent *e = ltt_tracefile_get_event(tfc->tf);
 
   if(event_viewer_data->num_events % CHECK_GDK_INTERVAL == 0) {
-    gtk_main_iteration_do(FALSE);
+    GdkEvent *event;
+    GtkWidget *widget;
+    while((event = gdk_event_get()) != NULL) {
+        widget = gtk_get_event_widget(event);
+        if(widget == 
+         lookup_widget(main_window_get_widget(event_viewer_data->tab),
+             "StopProcessingButton")) {
+          gtk_main_do_event(event);
+         gdk_window_process_all_updates();
+       }
+        gdk_event_free(event);
+    }
+    //gtk_main_iteration_do(FALSE);
     if(event_viewer_data->tab->stop_foreground)
       return TRUE;
   }
index 43818c0d4617195d8425535b6f2b8de5f0e899e5..93b0df2e9968cfbec7c955643fd9463b1c5f1ed9 100644 (file)
@@ -66,6 +66,7 @@ struct _EventViewerData {
   GtkWidget *toolbar;
   GtkToolItem *button_filter;
 
+  guint init_done;
 };
 
 extern gint evd_redraw_notify(void *hook_data, void *call_data);
index 55044a05726d72dfe8e99d12a946c386f6113e04..007b33e6f632df5aeecf7b22f2349a3ae1805b08 100644 (file)
@@ -529,6 +529,7 @@ create_MWindow (void)
   gtk_label_set_use_underline (GTK_LABEL (((GtkToolbarChild*) (g_list_last (GTK_TOOLBAR (MToolbar1)->children)->data))->label), TRUE);
   gtk_widget_show (tlbStopProcessing);
   gtk_container_set_border_width (GTK_CONTAINER (tlbStopProcessing), 1);
+  GLADE_HOOKUP_OBJECT (MWindow, tlbStopProcessing, "StopProcessingButton");
 
 
   gtk_toolbar_append_space (GTK_TOOLBAR (MToolbar1));
This page took 0.030743 seconds and 4 git commands to generate.