From: Francis Deslauriers Date: Mon, 11 Jun 2012 14:08:49 +0000 (-0400) Subject: Implements scrollbar in main window X-Git-Tag: v1.5-beta1~67 X-Git-Url: http://git.liburcu.org/?p=lttv.git;a=commitdiff_plain;h=9aaa78dc9323698c4c44e5aaa24322d0c9e26dab Implements scrollbar in main window Signed-off-by: Francis Deslauriers Signed-off-by: Yannick Brosseau --- diff --git a/lttv/lttv/traceset.c b/lttv/lttv/traceset.c index 0a55ae43..ae7c1a16 100644 --- a/lttv/lttv/traceset.c +++ b/lttv/lttv/traceset.c @@ -528,7 +528,19 @@ guint64 lttv_traceset_get_timestamp_end(LttvTraceset *traceset) } } return timestamp_max; - +} + +/* + * lttv_traceset_get_time_span : return a TimeInterval representing the + * minimum timestamp dans le maximum timestamp of the traceset. + * + */ +TimeInterval lttv_traceset_get_time_span(LttvTraceset *ts) +{ + TimeInterval time_span; + time_span.start_time =ltt_time_from_uint64( lttv_traceset_get_timestamp_begin(ts)); + time_span.end_time = ltt_time_from_uint64(lttv_traceset_get_timestamp_end(ts)); + return time_span; } const char *lttv_traceset_get_name_from_event(LttvEvent *event) diff --git a/lttv/lttv/traceset.h b/lttv/lttv/traceset.h index 6af2e39c..6d4cedaf 100644 --- a/lttv/lttv/traceset.h +++ b/lttv/lttv/traceset.h @@ -23,6 +23,7 @@ #include #include #include +#include #include /* A traceset is a set of traces to be analyzed together. */ @@ -122,6 +123,8 @@ guint lttv_traceset_get_cpuid_from_event(LttvEvent *event); guint64 lttv_traceset_get_timestamp_begin(LttvTraceset *traceset); /* Returns the maximum timestamp of the traces in the traceset */ guint64 lttv_traceset_get_timestamp_end(LttvTraceset *traceset); +/* Returns a TimeInterval struct that represents the min and max of the traceset */ +TimeInterval lttv_traceset_get_time_span(LttvTraceset *traceset); const char *lttv_traceset_get_name_from_event(LttvEvent *event); diff --git a/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c b/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c index 401bb79c..34bce0a9 100644 --- a/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c +++ b/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c @@ -283,9 +283,7 @@ int SetTraceset(Tab * tab, LttvTraceset *traceset) } #endif /*BABEL_CLEANUP*/ - - time_span.start_time =ltt_time_from_uint64( lttv_traceset_get_timestamp_begin(traceset)); - time_span.end_time = ltt_time_from_uint64(lttv_traceset_get_timestamp_end(traceset)); + time_span = lttv_traceset_get_time_span(traceset); tab->traceset_info->traceset = traceset; @@ -3372,11 +3370,10 @@ void current_position_change_manager(Tab *tab, static void on_timebar_starttime_changed(Timebar *timebar, gpointer user_data) { - #ifdef BABEL_CLEANUP + Tab *tab = (Tab *)user_data; - LttvTracesetContext * tsc = - LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context); - TimeInterval time_span = tsc->time_span; + LttvTraceset * ts =tab->traceset_info->traceset; + TimeInterval time_span = lttv_traceset_get_time_span(ts); TimeWindow new_time_window = tab->time_window; new_time_window.start_time = timebar_get_start_time(timebar); @@ -3404,17 +3401,16 @@ static void on_timebar_starttime_changed(Timebar *timebar, /* Notify the time_manager */ time_change_manager(tab, new_time_window); -#endif /* BABEL_CLEANUP */ + } static void on_timebar_endtime_changed(Timebar *timebar, gpointer user_data) { - #ifdef BABEL_CLEANUP + Tab *tab = (Tab *)user_data; - LttvTracesetContext * tsc = - LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context); - TimeInterval time_span = tsc->time_span; + LttvTraceset * ts =tab->traceset_info->traceset; + TimeInterval time_span = lttv_traceset_get_time_span(ts); TimeWindow new_time_window = tab->time_window; @@ -3441,8 +3437,7 @@ static void on_timebar_endtime_changed(Timebar *timebar, new_time_window.end_time = end_time; /* Notify the time_manager */ - time_change_manager(tab, new_time_window); - #endif /* BABEL_CLEANUP*/ + time_change_manager(tab, new_time_window); } static void on_timebar_currenttime_changed(Timebar *timebar, gpointer user_data) @@ -3457,7 +3452,7 @@ static void on_timebar_currenttime_changed(Timebar *timebar, void scroll_value_changed_cb(GtkWidget *scrollbar, gpointer user_data) { - #ifdef BABEL_CLEANUP + Tab *tab = (Tab *)user_data; TimeWindow new_time_window; LttTime time; @@ -3465,9 +3460,9 @@ void scroll_value_changed_cb(GtkWidget *scrollbar, gdouble value = gtk_adjustment_get_value(adjust); // gdouble upper, lower, ratio, page_size; gdouble page_size; - LttvTracesetContext * tsc = - LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context); - TimeInterval time_span = tsc->time_span; + + LttvTraceset * ts = tab->traceset_info->traceset; + TimeInterval time_span = lttv_traceset_get_time_span(ts); time = ltt_time_add(ltt_time_from_double(value), time_span.start_time); @@ -3487,6 +3482,7 @@ void scroll_value_changed_cb(GtkWidget *scrollbar, time_change_manager(tab, new_time_window); + #if 0 //time_window = tab->time_window; @@ -3515,7 +3511,7 @@ void scroll_value_changed_cb(GtkWidget *scrollbar, /* call viewer hooks for new time window */ set_time_window(tab, &time_window); #endif //0 -#endif /* BABEL_CLEANUP */ + }