trace add/remove time fixes
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Sun, 4 Sep 2005 18:56:17 +0000 (18:56 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Sun, 4 Sep 2005 18:56:17 +0000 (18:56 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@1117 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/lttv/modules/gui/detailedevents/events.c
ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c

index 5a674589ecce0c30cad0439a17f4af9f0044c411..c6a9be968f15cf08e3611ef0f2b740eb39ca677d 100644 (file)
@@ -1226,7 +1226,23 @@ gboolean traceset_changed(void * hook_data, void * call_data)
 
   end = ltt_time_sub(time_span.end_time, time_span.start_time);
   event_viewer_data->vadjust_c->upper = ltt_time_to_double(end);
-  g_signal_emit_by_name(event_viewer_data->vadjust_c, "value-changed");
+
+  /* Reset the positions */
+  lttv_traceset_context_position_destroy(
+      event_viewer_data->currently_selected_position);
+  lttv_traceset_context_position_destroy(
+      event_viewer_data->first_event);
+  lttv_traceset_context_position_destroy(
+      event_viewer_data->last_event);
+  event_viewer_data->currently_selected_position =
+    lttv_traceset_context_position_new(tsc);
+  event_viewer_data->first_event =
+    lttv_traceset_context_position_new(tsc);
+  event_viewer_data->last_event =
+    lttv_traceset_context_position_new(tsc);
+
+  get_events(event_viewer_data->vadjust_c->value, event_viewer_data);
   //  event_viewer_data->vadjust_c->value = 0;
 
   return FALSE;
@@ -1240,7 +1256,7 @@ gboolean filter_changed(void * hook_data, void * call_data)
 
   event_viewer_data->main_win_filter = 
     (LttvFilter*)call_data;
-  g_signal_emit_by_name(event_viewer_data->vadjust_c, "value-changed");
+  get_events(event_viewer_data->vadjust_c->value, event_viewer_data);
 
   return FALSE;
 }
index 481b939f3e14062ee40f738833ea7735c55cf723..17b7f9ef986c9b2ed1387a2ccd50bdce23a1e1aa 100644 (file)
@@ -408,8 +408,8 @@ int SetTraceset(Tab * tab, LttvTraceset *traceset)
   LttvTracesetContext *tsc =
         LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context);
   TimeInterval time_span = tsc->time_span;
-  TimeWindow new_time_window;
-  LttTime new_current_time;
+  TimeWindow new_time_window = tab->time_window;
+  LttTime new_current_time = tab->current_time;
 
   /* Set the tab's time window and current time if
    * out of bounds */
@@ -423,7 +423,9 @@ int SetTraceset(Tab * tab, LttvTraceset *traceset)
     LttTime tmp_time;
     
     if(ltt_time_compare(lttvwindow_default_time_width,
-          ltt_time_sub(time_span.end_time, time_span.start_time)) < 0)
+          ltt_time_sub(time_span.end_time, time_span.start_time)) < 0
+        ||
+       ltt_time_compare(time_span.end_time, time_span.start_time) == 0)
       tmp_time = lttvwindow_default_time_width;
     else
       tmp_time = time_span.end_time;
@@ -433,13 +435,9 @@ int SetTraceset(Tab * tab, LttvTraceset *traceset)
     new_time_window.end_time = ltt_time_add(new_time_window.start_time,
                                             new_time_window.time_width) ;
   }
-  time_change_manager(tab, new_time_window);
-  current_time_change_manager(tab, new_current_time);
 
-  //FIXME : we delete the filter tree, when it should be updated.
-  lttv_filter_destroy(tab->filter);
-  tab->filter = NULL;
-  
 #if 0
   /* Set scrollbar */
   GtkAdjustment *adjustment = gtk_range_get_adjustment(GTK_RANGE(tab->scrollbar));
@@ -502,6 +500,12 @@ int SetTraceset(Tab * tab, LttvTraceset *traceset)
   if(tmp == NULL) retval = 1;
   else lttv_hooks_call(tmp,traceset);
 
+  time_change_manager(tab, new_time_window);
+  current_time_change_manager(tab, new_current_time);
+
+  if(tab->filter)
+    lttv_filter_update(tab->filter);
  
   return retval;
 }
@@ -1787,7 +1791,7 @@ void remove_trace(GtkWidget *widget, gpointer user_data)
   for(i = 0; i < nb_trace; i++){
     trace_v = lttv_traceset_get(tab->traceset_info->traceset, i);
     trace = lttv_trace(trace_v);
-    name[i] = ltt_trace_name(trace);
+    name[i] = g_quark_to_string(ltt_trace_name(trace));
   }
 
   remove_trace_name = get_remove_trace(name, nb_trace);
@@ -4123,18 +4127,10 @@ Tab* create_tab(MainWindow * mw, Tab *copy_tab,
     /* We can clone the filter, as we copy the trace set also */
     /* The filter must always be in sync with the trace set */
     tab->filter = lttv_filter_clone(copy_tab->filter);
-    tab->time_window = copy_tab->time_window;
-    tab->current_time = copy_tab->current_time;
   } else {
     tab->traceset_info->traceset = lttv_traceset_new();
     tab->filter = NULL;
-    tab->time_window.start_time = ltt_time_zero;
-    tab->time_window.time_width = lttvwindow_default_time_width;
-    tab->time_window.end_time = ltt_time_add(tab->time_window.start_time,
-        tab->time_window.time_width);
-    tab->current_time = ltt_time_zero;
   }
-
 #ifdef DEBUG
   lttv_attribute_write_xml(
       lttv_traceset_attribute(tab->traceset_info->traceset),
@@ -4197,6 +4193,11 @@ Tab* create_tab(MainWindow * mw, Tab *copy_tab,
                      TRUE, /* expand */
                      TRUE, /* Give the extra space to the child */
                      0);    /* No padding */
+  
+//  if(copy_tab) {
+//    tab->time_window = copy_tab->time_window;
+//    tab->current_time = copy_tab->current_time;
+//  }
 
   /* Create the timebar */
   {
@@ -4440,6 +4441,25 @@ Tab* create_tab(MainWindow * mw, Tab *copy_tab,
   // always show : not if(g_list_length(list)>1)
   gtk_notebook_set_show_tabs(notebook, TRUE);
  
+  if(copy_tab) {
+    lttvwindow_report_time_window(tab, copy_tab->time_window);
+    lttvwindow_report_current_time(tab, copy_tab->current_time);
+  } else {
+    TimeWindow time_window;
+
+    time_window.start_time = ltt_time_zero;
+    time_window.end_time = ltt_time_add(time_window.start_time,
+        lttvwindow_default_time_width);
+    time_window.time_width = lttvwindow_default_time_width;
+    time_window.time_width_double = ltt_time_to_double(time_window.time_width);
+
+    lttvwindow_report_time_window(tab, time_window);
+    lttvwindow_report_current_time(tab, ltt_time_zero);
+  }
+  LttvTraceset *traceset = tab->traceset_info->traceset;
+  SetTraceset(tab, traceset);
+
   return tab;
 }
 
This page took 0.031293 seconds and 4 git commands to generate.