X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;ds=sidebyside;f=lttv%2Fmodules%2Fgui%2Flttvwindow%2Flttvwindow%2Fcallbacks.c;h=7c113118ac79b0bd58d410a0900e5dff97e27b70;hb=1167062fa9bd8dc2a698106b7d58f63ea6c99a8c;hp=401bb79c0b952cd43236882a839ab3ac3a2492d5;hpb=861fbe5f8862cd3797aecef4ab6903700a8aa837;p=lttv.git diff --git a/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c b/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c index 401bb79c..7c113118 100644 --- a/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c +++ b/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c @@ -226,7 +226,6 @@ void insert_viewer(GtkWidget* widget, lttvwindow_viewer_constructor constructor) int SetTraceset(Tab * tab, LttvTraceset *traceset) { - guint i; TimeInterval time_span; TimeWindow new_time_window; LttTime new_current_time; @@ -283,9 +282,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; @@ -712,7 +709,7 @@ void open_traceset(GtkWidget * widget, gpointer user_data) gboolean lttvwindow_process_pending_requests(Tab *tab) { - #ifdef BABEL_CLEANUP +#ifdef BABEL_CLEANUP LttvTracesetContext *tsc; LttvTracefileContext *tfc; GSList *list_in = NULL; @@ -989,11 +986,12 @@ gboolean lttvwindow_process_pending_requests(Tab *tab) /* Process the traceset with only state hooks */ #ifdef DEBUG seek_count = -#endif + lttv_process_traceset_middle(tsc, ltt_time_infinite, G_MAXUINT, events_request->start_position); +#endif g_assert(lttv_traceset_context_ctx_pos_compare(tsc, events_request->start_position) == 0); @@ -1502,8 +1500,8 @@ gboolean lttvwindow_process_pending_requests(Tab *tab) static gboolean live_trace_update_handler(Tab *tab) { - unsigned int updated_count; #ifdef BABEL_CLEANUP + unsigned int updated_count; LttvTracesetContext *tsc = LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context); TimeInterval initial_time_span = tsc->time_span; TimeInterval updated_time_span; @@ -1543,7 +1541,7 @@ live_trace_update_handler(Tab *tab) static void lttvwindow_add_trace(Tab *tab, LttvTrace *trace_v) { - #ifdef BABEL_CLEANUP +#ifdef BABEL_CLEANUP LttvTraceset *traceset = tab->traceset_info->traceset; guint i; guint num_traces = lttv_traceset_number(traceset); @@ -1615,7 +1613,7 @@ static void lttvwindow_add_trace(Tab *tab, LttvTrace *trace_v) void add_trace(GtkWidget * widget, gpointer user_data) { - LttvTraceset * traceset; + LttvTraceset * traceset = NULL; const char * path; char abs_path[PATH_MAX]; gint id; @@ -1634,10 +1632,27 @@ void add_trace(GtkWidget * widget, gpointer user_data) ptab = (LttvPluginTab *)g_object_get_data(G_OBJECT(page), "Tab_Plugin"); tab = ptab->tab; } +//TODO fdeslauriers 2012-07-06: Remove this popup when we support multiple traces + traceset = lttvwindow_get_traceset(tab); + if(traceset != NULL && lttv_traceset_number(traceset) > 0){ + GtkWidget *dialogue = + gtk_message_dialog_new( + GTK_WINDOW(gtk_widget_get_toplevel(widget)), + GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_OK, + "Loading multiple traces is not supported at the moment."); + gtk_dialog_run(GTK_DIALOG(dialogue)); + gtk_widget_destroy(dialogue); + return; + } + /* Create a new traceset*/ traceset = lttv_traceset_new(); /* File open dialog management */ - GtkWidget *extra_live_button; +#ifdef BABEL_CLEANUP + GtkWidget *extra_live_button; +#endif //babel_cleanup GtkFileChooser * file_chooser = GTK_FILE_CHOOSER( gtk_file_chooser_dialog_new ("Select a trace", @@ -1646,12 +1661,12 @@ void add_trace(GtkWidget * widget, gpointer user_data) GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL)); - +#ifdef BABEL_CLEANUP /* Button to indicate the opening of a live trace */ extra_live_button = gtk_check_button_new_with_mnemonic ("Trace is live (currently being writen)"); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (extra_live_button), FALSE); gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (file_chooser), extra_live_button); - +#endif //babel_cleanup gtk_file_chooser_set_show_hidden (file_chooser, TRUE); if(remember_trace_dir[0] != '\0') gtk_file_chooser_set_filename(file_chooser, remember_trace_dir); @@ -1727,7 +1742,7 @@ void add_trace(GtkWidget * widget, gpointer user_data) void remove_trace(GtkWidget *widget, gpointer user_data) { - #ifdef BABEL_CLEANUP +#ifdef BABEL_CLEANUP LttTrace *trace; LttvTrace * trace_v; LttvTraceset * traceset; @@ -2069,7 +2084,7 @@ void save_as(GtkWidget * widget, gpointer user_data) void zoom(GtkWidget * widget, double size) { - #ifdef BABEL_CLEANUP +#ifdef BABEL_CLEANUP TimeInterval time_span; TimeWindow new_time_window; LttTime current_time, time_delta; @@ -3349,34 +3364,26 @@ void current_time_change_manager (Tab *tab, tab->current_time_manager_lock = FALSE; } -void current_position_change_manager(Tab *tab, - LttvTracesetPosition *pos) +void current_position_change_manager(Tab *tab, LttvTracesetPosition *pos) { - #ifdef BABEL_CLEANUP - LttvTracesetContext *tsc = - LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context); - int retval; - - retval= lttv_process_traceset_seek_position(tsc, pos); - g_assert_cmpint(retval, ==, 0); - LttTime new_time = lttv_traceset_context_position_get_time(pos); + lttv_traceset_seek_to_position( pos); + + LttTime new_time = lttv_traceset_position_get_time(pos); /* Put the context in a state coherent position */ - lttv_state_traceset_seek_time_closest((LttvTracesetState*)tsc, ltt_time_zero); - +#ifdef BABEL_CLEANUP + lttv_state_traceset_seek_time_closest((LttvTracesetState*)tsc, ltt_time_zero); +#endif /* BABEL_CLEANUP */ current_time_change_manager(tab, new_time); set_current_position(tab, pos); - #endif /* BABEL_CLEANUP */ } 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 +3411,15 @@ 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 +3446,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 +3461,6 @@ 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 +3468,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 +3490,7 @@ void scroll_value_changed_cb(GtkWidget *scrollbar, time_change_manager(tab, new_time_window); + #if 0 //time_window = tab->time_window; @@ -3515,7 +3519,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 */ + }