X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Flttv%2Fmodules%2Fgui%2Flttvwindow%2Flttvwindow%2Fcallbacks.c;h=d3eb158b941ba5e450d1dd06b78270d6847eb51a;hb=d0724d16c130ef79c8402d7ea94c128771cbc519;hp=22fe64137a274aa96078fb617d3cb6d9c61327d1;hpb=a998b781c5e28cb4a364ce09cd99dc1d3dbf6a06;p=lttv.git diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c index 22fe6413..d3eb158b 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c @@ -49,7 +49,7 @@ #include -#define DEFAULT_TIME_WIDTH_S 1 +static LttTime lttvwindow_default_time_width = { 1, 0 }; #define CLIP_BUF 256 // size of clipboard buffer extern LttvTrace *g_init_trace ; @@ -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 */ @@ -421,24 +421,23 @@ int SetTraceset(Tab * tab, LttvTraceset *traceset) new_current_time = time_span.start_time; LttTime tmp_time; - - if(DEFAULT_TIME_WIDTH_S < time_span.end_time.tv_sec) - tmp_time.tv_sec = DEFAULT_TIME_WIDTH_S; + + if(ltt_time_compare(lttvwindow_default_time_width, + 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.tv_sec = time_span.end_time.tv_sec; - tmp_time.tv_nsec = 0; + tmp_time = time_span.end_time; + new_time_window.time_width = tmp_time ; new_time_window.time_width_double = ltt_time_to_double(tmp_time); 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)); @@ -501,7 +500,9 @@ 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); + return retval; } @@ -1786,7 +1787,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); @@ -4122,12 +4123,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); - } else { tab->traceset_info->traceset = lttv_traceset_new(); tab->filter = NULL; } - #ifdef DEBUG lttv_attribute_write_xml( lttv_traceset_attribute(tab->traceset_info->traceset), @@ -4184,16 +4183,17 @@ Tab* create_tab(MainWindow * mw, Tab *copy_tab, tab->viewer_container = gtk_vbox_new(TRUE, 2); tab->scrollbar = gtk_hscrollbar_new(NULL); //tab->multivpaned = gtk_multi_vpaned_new(); - tab->time_window.start_time = ltt_time_zero; - tab->time_window.end_time = ltt_time_zero; - tab->time_window.time_width = ltt_time_zero; - tab->current_time = ltt_time_zero; - + gtk_box_pack_start(GTK_BOX(tab->vbox), tab->viewer_container, 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 */ { @@ -4437,6 +4437,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; }