#include <limits.h> // for PATH_MAX
#include <stdlib.h>
+#include <ctype.h>
+#include <string.h>
+#include <stdlib.h>
#include <gtk/gtk.h>
#include <lttv/module.h>
#include <lttv/iattribute.h>
#include <lttv/stats.h>
+#include <lttv/filter.h>
#include <lttvwindow/mainwindow.h>
#include <lttvwindow/mainwindow-private.h>
#include <lttvwindow/menu.h>
#include <lttvwindow/toolbar.h>
#include <lttvwindow/lttvwindow.h>
#include <lttvwindow/lttvwindowtraces.h>
-#include <lttvwindow/gtkdirsel.h>
-#include <lttvwindow/lttvfilter.h>
-#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 ;
MainWindow * get_window_data_struct(GtkWidget * widget);
-char * get_load_module(char ** load_module_name, int nb_module);
-char * get_unload_module(char ** loaded_module_name, int nb_module);
-char * get_remove_trace(char ** all_trace_name, int nb_trace);
-char * get_selection(char ** all_name, int nb, char *title, char * column_title);
-gboolean get_filter_selection(LttvTracesetSelector *s, char *title, char * column_title);
+char * get_load_module(MainWindow *mw,
+ char ** load_module_name, int nb_module);
+char * get_unload_module(MainWindow *mw,
+ char ** loaded_module_name, int nb_module);
+char * get_remove_trace(MainWindow *mw, char ** all_trace_name, int nb_trace);
+char * get_selection(MainWindow *mw,
+ char ** all_name, int nb, char *title, char * column_title);
Tab* create_tab(MainWindow * mw, Tab *copy_tab,
GtkNotebook * notebook, char * label);
static void insert_viewer(GtkWidget* widget, lttvwindow_viewer_constructor constructor);
-void update_filter(LttvTracesetSelector *s, GtkTreeStore *store );
-
-void checkbox_changed(GtkTreeView *treeview,
- GtkTreePath *arg1,
- GtkTreeViewColumn *arg2,
- gpointer user_data);
-void remove_trace_from_traceset_selector(GtkWidget * paned, unsigned i);
-void add_trace_into_traceset_selector(GtkWidget * paned, LttTrace * trace);
-Tab *create_new_tab(GtkWidget* widget, gpointer user_data);
-LttvTracesetSelector * construct_traceset_selector(LttvTraceset * traceset);
+Tab *create_new_tab(GtkWidget* widget, gpointer user_data);
static gboolean lttvwindow_process_pending_requests(Tab *tab);
N_COLUMNS
};
-/* Construct a selector(filter), which will be associated with a viewer,
- * and provides an interface for user to select interested events and traces
- */
+/* Pasting routines */
-LttvTracesetSelector * construct_traceset_selector(LttvTraceset * traceset)
+static void MEventBox1a_receive(GtkClipboard *clipboard,
+ const gchar *text,
+ gpointer data)
{
- LttvTracesetSelector * s;
- LttvTraceSelector * trace;
- LttvTracefileSelector * tracefile;
- LttvEventtypeSelector * eventtype;
- int i, j, k, m;
- int nb_trace, nb_tracefile, nb_control, nb_per_cpu, nb_facility, nb_event;
- LttvTrace * trace_v;
- LttTrace * t;
- LttTracefile *tf;
- LttFacility * fac;
- LttEventType * et;
-
- s = lttv_traceset_selector_new(lttv_traceset_name(traceset));
- nb_trace = lttv_traceset_number(traceset);
- for(i=0;i<nb_trace;i++){
- trace_v = lttv_traceset_get(traceset, i);
- t = lttv_trace(trace_v);
- trace = lttv_trace_selector_new(t);
- lttv_traceset_selector_trace_add(s, trace);
-
- nb_facility = ltt_trace_facility_number(t);
- for(k=0;k<nb_facility;k++){
- fac = ltt_trace_facility_get(t,k);
- nb_event = (int) ltt_facility_eventtype_number(fac);
- for(m=0;m<nb_event;m++){
- et = ltt_facility_eventtype_get(fac,m);
- eventtype = lttv_eventtype_selector_new(et);
- lttv_trace_selector_eventtype_add(trace, eventtype);
- }
- }
+ if(text == NULL) return;
+ Tab *tab = (Tab *)data;
+ gchar buffer[CLIP_BUF];
+ gchar *ptr = buffer, *ptr_ssec, *ptr_snsec, *ptr_esec, *ptr_ensec;
+
+ strncpy(buffer, text, CLIP_BUF);
+
+ /* start */
+ while(!isdigit(*ptr) && ptr < buffer+CLIP_BUF-1) ptr++;
+ /* remove leading junk */
+ ptr_ssec = ptr;
+ while(isdigit(*ptr) && ptr < buffer+CLIP_BUF-1) ptr++;
+ /* read all the first number */
+ *ptr = '\0';
+ ptr++;
+
+ while(!isdigit(*ptr) && ptr < buffer+CLIP_BUF-1) ptr++;
+ /* remove leading junk */
+ ptr_snsec = ptr;
+ while(isdigit(*ptr) && ptr < buffer+CLIP_BUF-1) ptr++;
+ /* read all the first number */
+ *ptr = '\0';
+
+ /* end */
+ while(!isdigit(*ptr) && ptr < buffer+CLIP_BUF-1) ptr++;
+ /* remove leading junk */
+ ptr_esec = ptr;
+ while(isdigit(*ptr) && ptr < buffer+CLIP_BUF-1) ptr++;
+ /* read all the first number */
+ *ptr = '\0';
+ ptr++;
+
+ while(!isdigit(*ptr) && ptr < buffer+CLIP_BUF-1) ptr++;
+ /* remove leading junk */
+ ptr_ensec = ptr;
+ while(isdigit(*ptr) && ptr < buffer+CLIP_BUF-1) ptr++;
+ /* read all the first number */
+ *ptr = '\0';
+
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(tab->MEntry1),
+ (double)strtoul(ptr_ssec, NULL, 10));
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(tab->MEntry2),
+ (double)strtoul(ptr_snsec, NULL, 10));
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(tab->MEntry3),
+ (double)strtoul(ptr_esec, NULL, 10));
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(tab->MEntry4),
+ (double)strtoul(ptr_ensec, NULL, 10));
+}
- nb_control = ltt_trace_control_tracefile_number(t);
- nb_per_cpu = ltt_trace_per_cpu_tracefile_number(t);
- nb_tracefile = nb_control + nb_per_cpu;
+static gboolean on_MEventBox1a_paste(GtkWidget *widget, GdkEventButton *event,
+ gpointer data)
+{
+ Tab *tab = (Tab*)data;
- for(j = 0 ; j < nb_tracefile ; j++) {
- if(j < nb_control)
- tf = ltt_trace_control_tracefile_get(t, j);
- else
- tf = ltt_trace_per_cpu_tracefile_get(t, j - nb_control);
- tracefile = lttv_tracefile_selector_new(tf);
- lttv_trace_selector_tracefile_add(trace, tracefile);
- lttv_eventtype_selector_copy(trace, tracefile);
- }
- }
- return s;
+ GtkClipboard *clip = gtk_clipboard_get_for_display(gdk_display_get_default(),
+ GDK_SELECTION_PRIMARY);
+ gtk_clipboard_request_text(clip,
+ (GtkClipboardTextReceivedFunc)MEventBox1a_receive,
+ (gpointer)tab);
+ return 0;
+}
+
+
+/* Start */
+static void MEventBox1b_receive(GtkClipboard *clipboard,
+ const gchar *text,
+ gpointer data)
+{
+ if(text == NULL) return;
+ Tab *tab = (Tab *)data;
+ gchar buffer[CLIP_BUF];
+ gchar *ptr = buffer, *ptr_sec, *ptr_nsec;
+
+ strncpy(buffer, text, CLIP_BUF);
+
+ while(!isdigit(*ptr) && ptr < buffer+CLIP_BUF-1) ptr++;
+ /* remove leading junk */
+ ptr_sec = ptr;
+ while(isdigit(*ptr) && ptr < buffer+CLIP_BUF-1) ptr++;
+ /* read all the first number */
+ *ptr = '\0';
+ ptr++;
+
+ while(!isdigit(*ptr) && ptr < buffer+CLIP_BUF-1) ptr++;
+ /* remove leading junk */
+ ptr_nsec = ptr;
+ while(isdigit(*ptr) && ptr < buffer+CLIP_BUF-1) ptr++;
+ /* read all the first number */
+ *ptr = '\0';
+
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(tab->MEntry1),
+ (double)strtoul(ptr_sec, NULL, 10));
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(tab->MEntry2),
+ (double)strtoul(ptr_nsec, NULL, 10));
+}
+
+/* Start */
+static gboolean on_MEventBox1b_paste(GtkWidget *widget, GdkEventButton *event,
+ gpointer data)
+{
+ Tab *tab = (Tab*)data;
+
+ GtkClipboard *clip = gtk_clipboard_get_for_display(gdk_display_get_default(),
+ GDK_SELECTION_PRIMARY);
+ gtk_clipboard_request_text(clip,
+ (GtkClipboardTextReceivedFunc)MEventBox1b_receive,
+ (gpointer)tab);
+ return 0;
+}
+
+/* End */
+static void MEventBox3b_receive(GtkClipboard *clipboard,
+ const gchar *text,
+ gpointer data)
+{
+ if(text == NULL) return;
+ Tab *tab = (Tab *)data;
+ gchar buffer[CLIP_BUF];
+ gchar *ptr = buffer, *ptr_sec, *ptr_nsec;
+
+ strncpy(buffer, text, CLIP_BUF);
+
+ while(!isdigit(*ptr) && ptr < buffer+CLIP_BUF-1) ptr++;
+ /* remove leading junk */
+ ptr_sec = ptr;
+ while(isdigit(*ptr) && ptr < buffer+CLIP_BUF-1) ptr++;
+ /* read all the first number */
+ *ptr = '\0';
+ ptr++;
+
+ while(!isdigit(*ptr) && ptr < buffer+CLIP_BUF-1) ptr++;
+ /* remove leading junk */
+ ptr_nsec = ptr;
+ while(isdigit(*ptr) && ptr < buffer+CLIP_BUF-1) ptr++;
+ /* read all the first number */
+ *ptr = '\0';
+
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(tab->MEntry3),
+ (double)strtoul(ptr_sec, NULL, 10));
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(tab->MEntry4),
+ (double)strtoul(ptr_nsec, NULL, 10));
+}
+
+/* End */
+static gboolean on_MEventBox3b_paste(GtkWidget *widget, GdkEventButton *event,
+ gpointer data)
+{
+ Tab *tab = (Tab*)data;
+
+ GtkClipboard *clip = gtk_clipboard_get_for_display(gdk_display_get_default(),
+ GDK_SELECTION_PRIMARY);
+ gtk_clipboard_request_text(clip,
+ (GtkClipboardTextReceivedFunc)MEventBox3b_receive,
+ (gpointer)tab);
+ return 0;
+}
+
+/* Current */
+static void MEventBox5b_receive(GtkClipboard *clipboard,
+ const gchar *text,
+ gpointer data)
+{
+ if(text == NULL) return;
+ Tab *tab = (Tab *)data;
+ gchar buffer[CLIP_BUF];
+ gchar *ptr = buffer, *ptr_sec, *ptr_nsec;
+
+ strncpy(buffer, text, CLIP_BUF);
+
+ while(!isdigit(*ptr) && ptr < buffer+CLIP_BUF-1) ptr++;
+ /* remove leading junk */
+ ptr_sec = ptr;
+ while(isdigit(*ptr) && ptr < buffer+CLIP_BUF-1) ptr++;
+ /* read all the first number */
+ *ptr = '\0';
+ ptr++;
+
+ while(!isdigit(*ptr) && ptr < buffer+CLIP_BUF-1) ptr++;
+ /* remove leading junk */
+ ptr_nsec = ptr;
+ while(isdigit(*ptr) && ptr < buffer+CLIP_BUF-1) ptr++;
+ /* read all the first number */
+ *ptr = '\0';
+
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(tab->MEntry5),
+ (double)strtoul(ptr_sec, NULL, 10));
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(tab->MEntry6),
+ (double)strtoul(ptr_nsec, NULL, 10));
+}
+
+/* Current */
+static gboolean on_MEventBox5b_paste(GtkWidget *widget, GdkEventButton *event,
+ gpointer data)
+{
+ Tab *tab = (Tab*)data;
+
+ GtkClipboard *clip = gtk_clipboard_get_for_display(gdk_display_get_default(),
+ GDK_SELECTION_PRIMARY);
+ gtk_clipboard_request_text(clip,
+ (GtkClipboardTextReceivedFunc)MEventBox5b_receive,
+ (gpointer)tab);
+ return 0;
+}
+
+/* Interval */
+static void MEventBox8_receive(GtkClipboard *clipboard,
+ const gchar *text,
+ gpointer data)
+{
+ if(text == NULL) return;
+ Tab *tab = (Tab *)data;
+ gchar buffer[CLIP_BUF];
+ gchar *ptr = buffer, *ptr_sec, *ptr_nsec;
+
+ strncpy(buffer, text, CLIP_BUF);
+
+ while(!isdigit(*ptr) && ptr < buffer+CLIP_BUF-1) ptr++;
+ /* remove leading junk */
+ ptr_sec = ptr;
+ while(isdigit(*ptr) && ptr < buffer+CLIP_BUF-1) ptr++;
+ /* read all the first number */
+ *ptr = '\0';
+ ptr++;
+
+ while(!isdigit(*ptr) && ptr < buffer+CLIP_BUF-1) ptr++;
+ /* remove leading junk */
+ ptr_nsec = ptr;
+ while(isdigit(*ptr) && ptr < buffer+CLIP_BUF-1) ptr++;
+ /* read all the first number */
+ *ptr = '\0';
+
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(tab->MEntry7),
+ (double)strtoul(ptr_sec, NULL, 10));
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(tab->MEntry8),
+ (double)strtoul(ptr_nsec, NULL, 10));
+}
+
+/* Interval */
+static gboolean on_MEventBox8_paste(GtkWidget *widget, GdkEventButton *event,
+ gpointer data)
+{
+ Tab *tab = (Tab*)data;
+
+ GtkClipboard *clip = gtk_clipboard_get_for_display(gdk_display_get_default(),
+ GDK_SELECTION_PRIMARY);
+ gtk_clipboard_request_text(clip,
+ (GtkClipboardTextReceivedFunc)MEventBox8_receive,
+ (gpointer)tab);
+ return 0;
}
static gboolean viewer_grab_focus(GtkWidget *widget, GdkEventButton *event,
gpointer data)
{
- GtkWidget *viewer_container = GTK_WIDGET(data);
+ GtkWidget *viewer = GTK_WIDGET(data);
+ GtkWidget *viewer_container = gtk_widget_get_parent(viewer);
g_debug("FOCUS GRABBED");
- g_object_set_data(G_OBJECT(viewer_container), "focused_viewer", widget);
+ g_object_set_data(G_OBJECT(viewer_container), "focused_viewer", viewer);
+ return 0;
+}
+
+
+static void connect_focus_recursive(GtkWidget *widget,
+ GtkWidget *viewer)
+{
+ if(GTK_IS_CONTAINER(widget)) {
+ gtk_container_forall(GTK_CONTAINER(widget),
+ (GtkCallback)connect_focus_recursive,
+ viewer);
+
+ }
+ if(GTK_IS_TREE_VIEW(widget)) {
+ gtk_tree_view_set_headers_clickable(GTK_TREE_VIEW(widget), TRUE);
+ }
+ gtk_widget_add_events(widget, GDK_BUTTON_PRESS_MASK);
+ g_signal_connect (G_OBJECT(widget),
+ "button-press-event",
+ G_CALLBACK (viewer_grab_focus),
+ (gpointer)viewer);
+}
+
+/* Stop all the processings and call gtk_main_quit() */
+static void mainwindow_quit()
+{
+ lttvwindowtraces_unregister_requests(g_quark_from_string("stats"));
+ lttvwindowtraces_unregister_requests(g_quark_from_string("state"));
+ lttvwindowtraces_unregister_computation_hooks(g_quark_from_string("stats"));
+ lttvwindowtraces_unregister_computation_hooks(g_quark_from_string("state"));
+
+ gtk_main_quit();
}
void
insert_viewer_wrap(GtkWidget *menuitem, gpointer user_data)
{
- guint val = 20;
-
insert_viewer((GtkWidget*)menuitem, (lttvwindow_viewer_constructor)user_data);
- // selected_hook(&val);
}
MainWindow * mw_data = get_window_data_struct(widget);
GtkWidget * notebook = lookup_widget(widget, "MNotebook");
GtkWidget * viewer;
- LttvTracesetSelector * s;
TimeInterval * time_interval;
GtkWidget *page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook),
gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook)));
viewer_container = tab->viewer_container;
- s = construct_traceset_selector(tab->traceset_info->traceset);
- viewer = (GtkWidget*)constructor(tab, s, "Traceset_Selector");
+ viewer = (GtkWidget*)constructor(tab);
if(viewer)
{
//gtk_multivpaned_widget_add(GTK_MULTIVPANED(multivpaned), viewer);
TRUE,
0);
- g_signal_connect (G_OBJECT(viewer),
- "button-press-event",
- G_CALLBACK (viewer_grab_focus),
- (gpointer)viewer_container);
-
- // We unref here, because it is now referenced by the viewer_container!
- // not for a box ... g_object_unref(G_OBJECT(viewer));
-
- // The viewer will show itself when it receives a show notify
- // So we call the show notify hooks here. It will
- // typically add hooks for reading, we call process trace, and the
- // end of reading hook will call gtk_widget_show and unregister the
- // hooks.
- // Note that show notify gets the time_requested through the call_data.
- //show_viewer(mw_data);
- // in expose now call_pending_read_hooks(mw_data);
+ /* We want to connect the viewer_grab_focus to EVERY
+ * child of this widget. The little trick is to get each child
+ * of each GTK_CONTAINER, even subchildren.
+ */
+ connect_focus_recursive(viewer, viewer);
}
}
int SetTraceset(Tab * tab, LttvTraceset *traceset)
{
- LttvHooks * tmp;
- LttvAttributeValue value;
- gint retval = 0;
+ LttvTracesetContext *tsc =
+ LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context);
+ TimeInterval time_span = tsc->time_span;
+ TimeWindow new_time_window = tab->time_window;
+ LttTime new_current_time = tab->current_time;
-
- g_assert( lttv_iattribute_find_by_path(tab->attributes,
- "hooks/updatetraceset", LTTV_POINTER, &value));
+ /* Set the tab's time window and current time if
+ * out of bounds */
+ if(ltt_time_compare(tab->time_window.start_time, time_span.start_time) < 0
+ || ltt_time_compare(tab->time_window.end_time,
+ time_span.end_time) > 0) {
+ new_time_window.start_time = time_span.start_time;
+
+ new_current_time = time_span.start_time;
+
+ 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_compare(time_span.end_time, time_span.start_time) == 0)
+ tmp_time = lttvwindow_default_time_width;
+ else
+ tmp_time = time_span.end_time;
- tmp = (LttvHooks*)*(value.v_pointer);
- if(tmp == NULL) retval = 1;
- else lttv_hooks_call(tmp,traceset);
+ 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) ;
+ }
+
+#if 0
/* Set scrollbar */
- LttvTracesetContext *tsc =
- LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context);
- TimeInterval time_span = tsc->time_span;
GtkAdjustment *adjustment = gtk_range_get_adjustment(GTK_RANGE(tab->scrollbar));
+ LttTime upper = ltt_time_sub(time_span.end_time, time_span.start_time);
g_object_set(G_OBJECT(adjustment),
"lower",
- ltt_time_to_double(time_span.start_time)
- * NANOSECONDS_PER_SECOND, /* lower */
+ 0.0, /* lower */
"upper",
- ltt_time_to_double(time_span.end_time)
+ ltt_time_to_double(upper)
* NANOSECONDS_PER_SECOND, /* upper */
"step_increment",
ltt_time_to_double(tab->time_window.time_width)
g_object_set(G_OBJECT(adjustment),
"value",
- ltt_time_to_double(tab->time_window.start_time)
- * NANOSECONDS_PER_SECOND, /* value */
+ ltt_time_to_double(
+ ltt_time_sub(tab->time_window.start_time, time_span.start_time))
+ * NANOSECONDS_PER_SECOND, /* value */
NULL);
gtk_adjustment_value_changed(adjustment);
+
+ /* set the time bar. The value callbacks will change their nsec themself */
+ /* start seconds */
+ gtk_spin_button_set_range(GTK_SPIN_BUTTON(tab->MEntry1),
+ (double)time_span.start_time.tv_sec,
+ (double)time_span.end_time.tv_sec);
+
+ /* end seconds */
+ gtk_spin_button_set_range(GTK_SPIN_BUTTON(tab->MEntry3),
+ (double)time_span.start_time.tv_sec,
+ (double)time_span.end_time.tv_sec);
+
+ /* current seconds */
+ gtk_spin_button_set_range(GTK_SPIN_BUTTON(tab->MEntry5),
+ (double)time_span.start_time.tv_sec,
+ (double)time_span.end_time.tv_sec);
+#endif //0
+ /* Finally, call the update hooks of the viewers */
+ LttvHooks * tmp;
+ LttvAttributeValue value;
+ gint retval = 0;
+
+
+ g_assert( lttv_iattribute_find_by_path(tab->attributes,
+ "hooks/updatetraceset", LTTV_POINTER, &value));
+
+ tmp = (LttvHooks*)*(value.v_pointer);
+ 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;
}
* 0 : filters updated
* 1 : no filter hooks to update; not an error.
*/
-
+#if 0
int SetFilter(Tab * tab, gpointer filter)
{
LttvHooks * tmp;
return 0;
}
-
+#endif //0
/**
mw = lookup_widget(widget, "MWindow");
if(mw == NULL){
- g_printf("Main window does not exist\n");
+ g_info("Main window does not exist\n");
return NULL;
}
mw_data = (MainWindow *) g_object_get_data(G_OBJECT(mw),"main_window_data");
if(mw_data == NULL){
- g_printf("Main window data does not exist\n");
+ g_warning("Main window data does not exist\n");
return NULL;
}
return mw_data;
MainWindow * parent = get_window_data_struct(widget);
if(clone){
- g_printf("Clone : use the same traceset\n");
+ g_info("Clone : use the same traceset\n");
construct_main_window(parent);
}else{
- g_printf("Empty : traceset is set to NULL\n");
+ g_info("Empty : traceset is set to NULL\n");
construct_main_window(NULL);
}
}
+/* Get the currently focused viewer.
+ * If no viewer is focused, use the first one.
+ *
+ * If no viewer available, return NULL.
+ */
GtkWidget *viewer_container_focus(GtkWidget *container)
{
GtkWidget *widget;
widget = (GtkWidget*)g_object_get_data(G_OBJECT(container),
- "focused_viewer");
+ "focused_viewer");
- if(widget == NULL) g_debug("no widget focused");
+ if(widget == NULL) {
+ g_debug("no widget focused");
+ GList *children = gtk_container_get_children(GTK_CONTAINER(container));
+
+ if(children != NULL)
+ widget = GTK_WIDGET(children->data);
+ g_object_set_data(G_OBJECT(container),
+ "focused_viewer",
+ widget);
+ }
+
return widget;
if(child == NULL) return -1;
gint pos;
- GValue value = { 0, };
+ GValue value;
+ memset(&value, 0, sizeof(GValue));
g_value_init(&value, G_TYPE_INT);
gtk_container_child_get_property(GTK_CONTAINER(container),
child,
gtk_file_selection_hide_fileop_buttons(file_selector);
+ gtk_window_set_transient_for(GTK_WINDOW(file_selector),
+ GTK_WINDOW(mw_data->mwindow));
+
id = gtk_dialog_run(GTK_DIALOG(file_selector));
switch(id){
case GTK_RESPONSE_ACCEPT:
case GTK_RESPONSE_OK:
dir = gtk_file_selection_get_selections (file_selector);
traceset = lttv_traceset_load(dir[0]);
- g_printf("Open a trace set %s\n", dir[0]);
+ g_info("Open a trace set %s\n", dir[0]);
//Not finished yet
g_strfreev(dir);
case GTK_RESPONSE_REJECT:
}
-static void events_request_free(EventsRequest *events_request)
-{
- if(events_request == NULL) return;
-
- if(events_request->start_position != NULL)
- lttv_traceset_context_position_destroy(events_request->start_position);
- if(events_request->end_position != NULL)
- lttv_traceset_context_position_destroy(events_request->end_position);
- if(events_request->before_chunk_traceset != NULL)
- lttv_hooks_destroy(events_request->before_chunk_traceset);
- if(events_request->before_chunk_trace != NULL)
- lttv_hooks_destroy(events_request->before_chunk_trace);
- if(events_request->before_chunk_tracefile != NULL)
- lttv_hooks_destroy(events_request->before_chunk_tracefile);
- if(events_request->event != NULL)
- lttv_hooks_destroy(events_request->event);
- if(events_request->event_by_id != NULL)
- lttv_hooks_by_id_destroy(events_request->event_by_id);
- if(events_request->after_chunk_tracefile != NULL)
- lttv_hooks_destroy(events_request->after_chunk_tracefile);
- if(events_request->after_chunk_trace != NULL)
- lttv_hooks_destroy(events_request->after_chunk_trace);
- if(events_request->after_chunk_traceset != NULL)
- lttv_hooks_destroy(events_request->after_chunk_traceset);
- if(events_request->before_request != NULL)
- lttv_hooks_destroy(events_request->before_request);
- if(events_request->after_request != NULL)
- lttv_hooks_destroy(events_request->after_request);
-
- g_free(events_request);
-}
-
-
-
/* lttvwindow_process_pending_requests
*
* This internal function gets called by g_idle, taking care of the pending
gboolean lttvwindow_process_pending_requests(Tab *tab)
{
- unsigned max_nb_events;
- GdkWindow * win;
- GdkCursor * new;
GtkWidget* widget;
LttvTracesetContext *tsc;
LttvTracefileContext *tfc;
}
/* 0.2 Seek tracefiles positions to context position */
+ //g_assert(lttv_process_traceset_seek_position(tsc, sync_position) == 0);
lttv_process_traceset_synchronize_tracefiles(tsc);
-
+
/* Events processing algorithm implementation */
+ /* Warning : the gtk_events_pending takes a LOT of cpu time. So what we do
+ * instead is to leave the control to GTK and take it back.
+ */
/* A. Servicing loop */
- while( (g_slist_length(list_in) != 0 || g_slist_length(list_out) != 0)) {
- /* && !gtk_events_pending() ) */
-
+ //while( (g_slist_length(list_in) != 0 || g_slist_length(list_out) != 0)) {
+ if((g_slist_length(list_in) != 0 || g_slist_length(list_out) != 0)) {
+ /* Servicing */
/* 1. If list_in is empty (need a seek) */
if( g_slist_length(list_in) == 0 ) {
ltime = g_slist_append(ltime, g_slist_nth_data(list_out, 0));
for(iter=g_slist_nth(list_out,1);iter!=NULL;iter=g_slist_next(iter)) {
/* Find all time requests with the lowest start time in list_out */
- guint index_ltime = g_array_index(ltime, guint, 0);
EventsRequest *event_request_ltime = (EventsRequest*)g_slist_nth_data(ltime, 0);
EventsRequest *event_request_list_out = (EventsRequest*)iter->data;
lttv_process_traceset_middle(tsc,
events_request->start_time,
G_MAXUINT, NULL);
+#ifdef DEBUG
+ g_assert(seek_count < LTTV_STATE_SAVE_INTERVAL);
+#endif //DEBUG
} else {
LttTime pos_time;
+ LttvTracefileContext *tfc =
+ lttv_traceset_context_get_current_tfc(tsc);
/* Else, the first request in list_in is a position request */
/* If first req in list_in pos != current pos */
g_assert(events_request->start_position != NULL);
events_request->start_position).tv_sec,
lttv_traceset_context_position_get_time(
events_request->start_position).tv_nsec);
-
- g_debug("SEEK POS context time : %lu, %lu",
- lttv_traceset_context_get_current_tfc(tsc)->timestamp.tv_sec,
- lttv_traceset_context_get_current_tfc(tsc)->timestamp.tv_nsec);
+
+ if(tfc) {
+ g_debug("SEEK POS context time : %lu, %lu",
+ tfc->timestamp.tv_sec,
+ tfc->timestamp.tv_nsec);
+ } else {
+ g_debug("SEEK POS context time : %lu, %lu",
+ ltt_time_infinite.tv_sec,
+ ltt_time_infinite.tv_nsec);
+ }
g_assert(events_request->start_position != NULL);
if(lttv_traceset_context_ctx_pos_compare(tsc,
events_request->start_position) != 0) {
/* 1.3.2 call before chunk
* 1.3.3 events hooks added
*/
- lttv_process_traceset_begin(tsc, events_request->before_chunk_traceset,
- events_request->before_chunk_trace,
- events_request->before_chunk_tracefile,
- events_request->event,
- events_request->event_by_id);
+ if(events_request->trace == -1)
+ lttv_process_traceset_begin(tsc,
+ events_request->before_chunk_traceset,
+ events_request->before_chunk_trace,
+ events_request->before_chunk_tracefile,
+ events_request->event,
+ events_request->event_by_id);
+ else {
+ guint nb_trace = lttv_traceset_number(tsc->ts);
+ g_assert((guint)events_request->trace < nb_trace &&
+ events_request->trace > -1);
+ LttvTraceContext *tc = tsc->traces[events_request->trace];
+
+ lttv_hooks_call(events_request->before_chunk_traceset, tsc);
+
+ lttv_trace_context_add_hooks(tc,
+ events_request->before_chunk_trace,
+ events_request->before_chunk_tracefile,
+ events_request->event,
+ events_request->event_by_id);
+ }
}
}
} else {
/* - Call before chunk
* - events hooks added
*/
- lttv_process_traceset_begin(tsc, events_request->before_chunk_traceset,
+ if(events_request->trace == -1)
+ lttv_process_traceset_begin(tsc,
+ events_request->before_chunk_traceset,
+ events_request->before_chunk_trace,
+ events_request->before_chunk_tracefile,
+ events_request->event,
+ events_request->event_by_id);
+ else {
+ guint nb_trace = lttv_traceset_number(tsc->ts);
+ g_assert((guint)events_request->trace < nb_trace &&
+ events_request->trace > -1);
+ LttvTraceContext *tc = tsc->traces[events_request->trace];
+
+ lttv_hooks_call(events_request->before_chunk_traceset, tsc);
+
+ lttv_trace_context_add_hooks(tc,
events_request->before_chunk_trace,
events_request->before_chunk_tracefile,
events_request->event,
events_request->event_by_id);
+ }
iter = g_slist_next(iter);
}
/* call before chunk
* events hooks added
*/
- lttv_process_traceset_begin(tsc, events_request->before_chunk_traceset,
- events_request->before_chunk_trace,
- events_request->before_chunk_tracefile,
- events_request->event,
- events_request->event_by_id);
+ if(events_request->trace == -1)
+ lttv_process_traceset_begin(tsc,
+ events_request->before_chunk_traceset,
+ events_request->before_chunk_trace,
+ events_request->before_chunk_tracefile,
+ events_request->event,
+ events_request->event_by_id);
+ else {
+ guint nb_trace = lttv_traceset_number(tsc->ts);
+ g_assert((guint)events_request->trace < nb_trace &&
+ events_request->trace > -1);
+ LttvTraceContext *tc = tsc->traces[events_request->trace];
+
+ lttv_hooks_call(events_request->before_chunk_traceset, tsc);
+
+ lttv_trace_context_add_hooks(tc,
+ events_request->before_chunk_trace,
+ events_request->before_chunk_tracefile,
+ events_request->event,
+ events_request->event_by_id);
}
-
+
+
+ }
+
/* Go to next */
if(remove)
{
{
/* 4. Call process traceset middle */
- g_debug("Calling process traceset middle with %p, %lu sec %lu nsec, %lu nb ev, %p end pos", tsc, end_time.tv_sec, end_time.tv_nsec, end_nb_events, end_position);
+ g_debug("Calling process traceset middle with %p, %lu sec %lu nsec, %u nb ev, %p end pos", tsc, end_time.tv_sec, end_time.tv_nsec, end_nb_events, end_position);
count = lttv_process_traceset_middle(tsc, end_time, end_nb_events, end_position);
tfc = lttv_traceset_context_get_current_tfc(tsc);
- g_debug("Context time after middle : %lu, %lu", tfc->timestamp.tv_sec,
+ if(tfc != NULL)
+ g_debug("Context time after middle : %lu, %lu", tfc->timestamp.tv_sec,
tfc->timestamp.tv_nsec);
+ else
+ g_debug("End of trace reached after middle.");
}
{
/* - Remove events hooks for req
* - Call end chunk for req
*/
- lttv_process_traceset_end(tsc, events_request->after_chunk_traceset,
+
+ if(events_request->trace == -1)
+ lttv_process_traceset_end(tsc,
+ events_request->after_chunk_traceset,
+ events_request->after_chunk_trace,
+ events_request->after_chunk_tracefile,
+ events_request->event,
+ events_request->event_by_id);
+
+ else {
+ guint nb_trace = lttv_traceset_number(tsc->ts);
+ g_assert(events_request->trace < nb_trace &&
+ events_request->trace > -1);
+ LttvTraceContext *tc = tsc->traces[events_request->trace];
+
+ lttv_trace_context_remove_hooks(tc,
events_request->after_chunk_trace,
events_request->after_chunk_tracefile,
events_request->event,
events_request->event_by_id);
+ lttv_hooks_call(events_request->after_chunk_traceset, tsc);
+
+
+ }
+
/* - Call end request for req */
lttv_hooks_call(events_request->after_request, (gpointer)tsc);
/* - Remove events hooks for req
* - Call end chunk for req
*/
- lttv_process_traceset_end(tsc, events_request->after_chunk_traceset,
+ if(events_request->trace == -1)
+ lttv_process_traceset_end(tsc,
+ events_request->after_chunk_traceset,
events_request->after_chunk_trace,
events_request->after_chunk_tracefile,
events_request->event,
events_request->event_by_id);
+ else {
+ guint nb_trace = lttv_traceset_number(tsc->ts);
+ g_assert(events_request->trace < nb_trace &&
+ events_request->trace > -1);
+ LttvTraceContext *tc = tsc->traces[events_request->trace];
+
+ lttv_trace_context_remove_hooks(tc,
+ events_request->after_chunk_trace,
+ events_request->after_chunk_tracefile,
+ events_request->event,
+ events_request->event_by_id);
+
+ lttv_hooks_call(events_request->after_chunk_traceset, tsc);
+ }
+
/* - req.num -= count */
g_assert(events_request->num_events >= count);
events_request->num_events -= count;
}
}
}
-
- if(gtk_events_pending()) break;
}
+ /* End of removed servicing loop : leave control to GTK instead. */
+ // if(gtk_events_pending()) break;
+ //}
/* B. When interrupted between chunks */
/* 1.1. Use current postition as start position */
if(events_request->start_position != NULL)
lttv_traceset_context_position_destroy(events_request->start_position);
- events_request->start_position = lttv_traceset_context_position_new();
+ events_request->start_position = lttv_traceset_context_position_new(tsc);
lttv_traceset_context_position_save(tsc, events_request->start_position);
/* 1.2. Remove start time */
- events_request->start_time.tv_sec = G_MAXUINT;
- events_request->start_time.tv_nsec = G_MAXUINT;
+ events_request->start_time = ltt_time_infinite;
/* 1.3. Move from list_in to list_out */
remove = TRUE;
}
-
/* C Unlock Traces */
{
- //lttv_process_traceset_get_sync_data(tsc);
+ lttv_process_traceset_get_sync_data(tsc);
+ //lttv_traceset_context_position_save(tsc, sync_position);
guint iter_trace;
lttvwindowtraces_unlock(trace_v);
}
}
-
#if 0
//set the cursor back to normal
gdk_window_set_cursor(win, NULL);
#undef list_out
-/* add_trace_into_traceset_selector, each instance of a viewer has an associated
- * selector (filter), when a trace is added into traceset, the selector should
- * reflect the change. The function is used to update the selector
- */
-#if 0
-void add_trace_into_traceset_selector(GtkWidget * paned, LttTrace * t)
-{
- int j, k, m, nb_tracefile, nb_control, nb_per_cpu, nb_facility, nb_event;
- LttvTracesetSelector * s;
- LttvTraceSelector * trace;
- LttvTracefileSelector * tracefile;
- LttvEventtypeSelector * eventtype;
- LttTracefile * tf;
- GtkWidget * w;
- LttFacility * fac;
- LttEventType * et;
-
- w = gtk_multivpaned_get_first_widget(GTK_MULTIVPANED(paned));
- while(w){
- s = g_object_get_data(G_OBJECT(w), "Traceset_Selector");
-
- if(s){
- trace = lttv_trace_selector_new(t);
- lttv_traceset_selector_trace_add(s, trace);
-
- nb_facility = ltt_trace_facility_number(t);
- for(k=0;k<nb_facility;k++){
- fac = ltt_trace_facility_get(t,k);
- nb_event = (int) ltt_facility_eventtype_number(fac);
- for(m=0;m<nb_event;m++){
- et = ltt_facility_eventtype_get(fac,m);
- eventtype = lttv_eventtype_selector_new(et);
- lttv_trace_selector_eventtype_add(trace, eventtype);
- }
- }
-
- nb_control = ltt_trace_control_tracefile_number(t);
- nb_per_cpu = ltt_trace_per_cpu_tracefile_number(t);
- nb_tracefile = nb_control + nb_per_cpu;
-
- for(j = 0 ; j < nb_tracefile ; j++) {
- if(j < nb_control)
- tf = ltt_trace_control_tracefile_get(t, j);
- else
- tf = ltt_trace_per_cpu_tracefile_get(t, j - nb_control);
- tracefile = lttv_tracefile_selector_new(tf);
- lttv_trace_selector_tracefile_add(trace, tracefile);
- lttv_eventtype_selector_copy(trace, tracefile);
- }
- }else g_warning("Module does not support filtering\n");
-
- w = gtk_multivpaned_get_next_widget(GTK_MULTIVPANED(paned));
- }
-}
-#endif //0
-
static void lttvwindow_add_trace(Tab *tab, LttvTrace *trace_v)
{
LttvTraceset *traceset = tab->traceset_info->traceset;
traceset_context),
traceset);
- /* Set the tab's time window and current time if
- * out of bounds */
- TimeInterval time_span =
- LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context)->time_span;
- if(ltt_time_compare(tab->time_window.start_time, time_span.start_time) < 0
- || ltt_time_compare( ltt_time_add(tab->time_window.start_time,
- tab->time_window.time_width),
- time_span.end_time) > 0) {
- tab->time_window.start_time =
- LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context)->
- time_span.start_time;
- tab->current_time =
- LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context)->
- time_span.start_time;
-
- LttTime tmp_time;
- if(DEFAULT_TIME_WIDTH_S <
- LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context)->
- time_span.end_time.tv_sec)
- tmp_time.tv_sec = DEFAULT_TIME_WIDTH_S;
- else
- tmp_time.tv_sec =
- LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context)->
- time_span.end_time.tv_sec;
- tmp_time.tv_nsec = 0;
- tab->time_window.time_width = tmp_time ;
-
- }
-
//add state update hooks
lttv_state_add_event_hooks(
(LttvTracesetState*)tab->traceset_info->traceset_context);
const char * dir;
char abs_path[PATH_MAX];
gint id;
- gint i;
MainWindow * mw_data = get_window_data_struct(widget);
GtkWidget * notebook = lookup_widget(widget, "MNotebook");
tab = (Tab *)g_object_get_data(G_OBJECT(page), "Tab_Info");
}
- GtkDirSelection * file_selector = (GtkDirSelection *)gtk_dir_selection_new("Select a trace");
- gtk_dir_selection_hide_fileop_buttons(file_selector);
+ //GtkDirSelection * file_selector = (GtkDirSelection *)gtk_dir_selection_new("Select a trace");
+ GtkFileSelection * file_selector = (GtkFileSelection *)gtk_file_selection_new("Select a trace");
+ gtk_widget_hide( (file_selector)->file_list->parent) ;
+ gtk_file_selection_hide_fileop_buttons(file_selector);
+ gtk_window_set_transient_for(GTK_WINDOW(file_selector),
+ GTK_WINDOW(mw_data->mwindow));
if(remember_trace_dir[0] != '\0')
- gtk_dir_selection_set_filename(file_selector, remember_trace_dir);
+ gtk_file_selection_set_filename(file_selector, remember_trace_dir);
id = gtk_dialog_run(GTK_DIALOG(file_selector));
switch(id){
case GTK_RESPONSE_ACCEPT:
case GTK_RESPONSE_OK:
- dir = gtk_dir_selection_get_dir (file_selector);
+ dir = gtk_file_selection_get_filename (file_selector);
strncpy(remember_trace_dir, dir, PATH_MAX);
+ strncat(remember_trace_dir, "/", PATH_MAX);
if(!dir || strlen(dir) == 0){
gtk_widget_destroy((GtkWidget*)file_selector);
break;
trace = ltt_trace_open(abs_path);
if(trace == NULL) {
g_warning("cannot open trace %s", abs_path);
+
+ 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,
+ "Cannot open trace : maybe you should enter in the trace "
+ "directory to select it ?");
+ gtk_dialog_run(GTK_DIALOG(dialogue));
+ gtk_widget_destroy(dialogue);
+
} else {
trace_v = lttv_trace_new(trace);
lttvwindowtraces_add_trace(trace_v);
}
}
-
-/* remove_trace_into_traceset_selector, each instance of a viewer has an associated
- * selector (filter), when a trace is remove from traceset, the selector should
- * reflect the change. The function is used to update the selector
- */
-#if 0
-void remove_trace_from_traceset_selector(GtkWidget * paned, unsigned i)
-{
- LttvTracesetSelector * s;
- LttvTraceSelector * t;
- GtkWidget * w;
-
- w = gtk_multivpaned_get_first_widget(GTK_MULTIVPANED(paned));
- while(w){
- s = g_object_get_data(G_OBJECT(w), "Traceset_Selector");
- if(s){
- t = lttv_traceset_selector_trace_get(s,i);
- lttv_traceset_selector_trace_remove(s, i);
- lttv_trace_selector_destroy(t);
- }g_warning("Module dose not support filtering\n");
- w = gtk_multivpaned_get_next_widget(GTK_MULTIVPANED(paned));
- }
-}
-#endif //0
-
/* remove_trace removes a trace from the current traceset if all viewers in
* the current tab are not interested in the trace. It first displays a
* dialogue, which shows all traces in the current traceset, to let user choose
* it will remove the trace, recreate the traceset_contex,
* and redraws all the viewer of the current tab. If there is on trace in the
* current traceset, it will delete all viewers of the current tab
+ *
+ * It destroys the filter tree. FIXME... we should request for an update
+ * instead.
*/
-// MD : no filter version.
void remove_trace(GtkWidget *widget, gpointer user_data)
{
LttTrace *trace;
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);
+ remove_trace_name = get_remove_trace(mw_data, name, nb_trace);
if(remove_trace_name){
trace_v = lttv_traceset_get(traceset, index);
- if(lttv_trace_get_ref_number(trace_v) <= 2) {
- /* ref 2 : traceset, local */
- lttvwindowtraces_remove_trace(trace_v);
- ltt_trace_close(lttv_trace(trace_v));
- }
-
lttv_traceset_remove(traceset, index);
lttv_trace_unref(trace_v); // Remove local reference
- if(!lttv_trace_get_ref_number(trace_v))
- lttv_trace_destroy(trace_v);
+ if(lttv_trace_get_ref_number(trace_v) <= 1) {
+ /* ref 1 : lttvwindowtraces only*/
+ ltt_trace_close(lttv_trace(trace_v));
+ /* lttvwindowtraces_remove_trace takes care of destroying
+ * the traceset linked with the trace_v and also of destroying
+ * the trace_v at the same time.
+ */
+ lttvwindowtraces_remove_trace(trace_v);
+ }
tab->traceset_info->traceset_context =
g_object_new(LTTV_TRACESET_STATS_TYPE, NULL);
void save(GtkWidget * widget, gpointer user_data)
{
- g_printf("Save\n");
+ g_info("Save\n");
}
void save_as(GtkWidget * widget, gpointer user_data)
{
- g_printf("Save as\n");
+ g_info("Save as\n");
}
{
TimeInterval time_span;
TimeWindow new_time_window;
- LttTime current_time, time_delta, time_s, time_e, time_tmp;
+ LttTime current_time, time_delta;
MainWindow * mw_data = get_window_data_struct(widget);
LttvTracesetContext *tsc;
GtkWidget * notebook = lookup_widget(widget, "MNotebook");
if(size == 0){
new_time_window.start_time = time_span.start_time;
new_time_window.time_width = time_delta;
+ new_time_window.time_width_double = ltt_time_to_double(time_delta);
+ new_time_window.end_time = ltt_time_add(new_time_window.start_time,
+ new_time_window.time_width) ;
}else{
new_time_window.time_width = ltt_time_div(new_time_window.time_width, size);
+ new_time_window.time_width_double =
+ ltt_time_to_double(new_time_window.time_width);
if(ltt_time_compare(new_time_window.time_width,time_delta) > 0)
{ /* Case where zoom out is bigger than trace length */
new_time_window.start_time = time_span.start_time;
new_time_window.time_width = time_delta;
+ new_time_window.time_width_double = ltt_time_to_double(time_delta);
+ new_time_window.end_time = ltt_time_add(new_time_window.start_time,
+ new_time_window.time_width) ;
}
else
{
/* Center the image on the current time */
new_time_window.start_time =
- ltt_time_sub(current_time, ltt_time_div(new_time_window.time_width, 2.0));
+ ltt_time_sub(current_time,
+ ltt_time_from_double(new_time_window.time_width_double/2.0));
+ new_time_window.end_time = ltt_time_add(new_time_window.start_time,
+ new_time_window.time_width) ;
/* If on borders, don't fall off */
- if(ltt_time_compare(new_time_window.start_time, time_span.start_time) <0)
+ if(ltt_time_compare(new_time_window.start_time, time_span.start_time) <0
+ || ltt_time_compare(new_time_window.start_time, time_span.end_time) >0)
{
new_time_window.start_time = time_span.start_time;
+ new_time_window.end_time = ltt_time_add(new_time_window.start_time,
+ new_time_window.time_width) ;
}
else
{
- if(ltt_time_compare(
- ltt_time_add(new_time_window.start_time, new_time_window.time_width),
- time_span.end_time) > 0)
+ if(ltt_time_compare(new_time_window.end_time,
+ time_span.end_time) > 0
+ || ltt_time_compare(new_time_window.end_time,
+ time_span.start_time) < 0)
{
new_time_window.start_time =
ltt_time_sub(time_span.end_time, new_time_window.time_width);
+
+ new_time_window.end_time = ltt_time_add(new_time_window.start_time,
+ new_time_window.time_width) ;
}
}
}
+ }
- //time_tmp = ltt_time_div(new_time_window.time_width, 2);
- //if(ltt_time_compare(current_time, time_tmp) < 0){
- // time_s = time_span->startTime;
- //} else {
- // time_s = ltt_time_sub(current_time,time_tmp);
- //}
- //time_e = ltt_time_add(current_time,time_tmp);
- //if(ltt_time_compare(time_span->startTime, time_s) > 0){
- // time_s = time_span->startTime;
- //}else if(ltt_time_compare(time_span->endTime, time_e) < 0){
- // time_e = time_span->endTime;
- // time_s = ltt_time_sub(time_e,new_time_window.time_width);
- //}
- //new_time_window.start_time = time_s;
- }
-
- //lttvwindow_report_time_window(mw_data, &new_time_window);
- //call_pending_read_hooks(mw_data);
-
- //lttvwindow_report_current_time(mw_data,&(tab->current_time));
- //set_time_window(tab, &new_time_window);
- // in expose now call_pending_read_hooks(mw_data);
- //gtk_multi_vpaned_set_adjust(tab->multi_vpaned, &new_time_window, FALSE);
- //
- //
-
- if( ltt_time_to_double(new_time_window.time_width)
- * NANOSECONDS_PER_SECOND
- / SCROLL_STEP_PER_PAGE/* step increment */
- +
- ltt_time_to_double(new_time_window.start_time)
- * NANOSECONDS_PER_SECOND /* page size */
- ==
- ltt_time_to_double(new_time_window.start_time)
- * NANOSECONDS_PER_SECOND /* page size */
- ) {
- g_warning("Can not zoom that far due to scrollbar precision");
- } else if(
- ltt_time_compare(
- ltt_time_from_double(
- ltt_time_to_double(new_time_window.time_width)
- /SCROLL_STEP_PER_PAGE ),
- ltt_time_zero)
- == 0 ) {
- g_warning("Can not zoom that far due to time nanosecond precision");
+ if(ltt_time_compare(new_time_window.time_width, ltt_time_zero) == 0) {
+ g_warning("Zoom more than 1 ns impossible");
} else {
- /* Set scrollbar */
- GtkAdjustment *adjustment = gtk_range_get_adjustment(GTK_RANGE(tab->scrollbar));
-
- g_object_set(G_OBJECT(adjustment),
- //"value",
- //ltt_time_to_double(new_time_window.start_time)
- // * NANOSECONDS_PER_SECOND, /* value */
- "lower",
- ltt_time_to_double(time_span.start_time)
- * NANOSECONDS_PER_SECOND, /* lower */
- "upper",
- ltt_time_to_double(time_span.end_time)
- * NANOSECONDS_PER_SECOND, /* upper */
- "step_increment",
- ltt_time_to_double(new_time_window.time_width)
- / SCROLL_STEP_PER_PAGE
- * NANOSECONDS_PER_SECOND, /* step increment */
- "page_increment",
- ltt_time_to_double(new_time_window.time_width)
- * NANOSECONDS_PER_SECOND, /* page increment */
- "page_size",
- ltt_time_to_double(new_time_window.time_width)
- * NANOSECONDS_PER_SECOND, /* page size */
- NULL);
- gtk_adjustment_changed(adjustment);
- //gtk_range_set_adjustment(GTK_RANGE(tab->scrollbar), adjustment);
- //gtk_adjustment_value_changed(adjustment);
- g_object_set(G_OBJECT(adjustment),
- "value",
- ltt_time_to_double(new_time_window.start_time)
- * NANOSECONDS_PER_SECOND, /* value */
- NULL);
- gtk_adjustment_value_changed(adjustment);
-
-
- //g_object_set(G_OBJECT(adjustment),
- // "value",
- // ltt_time_to_double(time_window->start_time)
- // * NANOSECONDS_PER_SECOND, /* value */
- // NULL);
- /* Note : the set value will call set_time_window if scrollbar value changed
- */
- //gtk_adjustment_set_value(adjustment,
- // ltt_time_to_double(new_time_window.start_time)
- // * NANOSECONDS_PER_SECOND);
+ time_change_manager(tab, new_time_window);
}
}
void go_to_time(GtkWidget * widget, gpointer user_data)
{
- g_printf("Go to time\n");
+ g_info("Go to time\n");
}
void show_time_frame(GtkWidget * widget, gpointer user_data)
{
- g_printf("Show time frame\n");
+ g_info("Show time frame\n");
}
GtkNotebook * notebook = (GtkNotebook *)lookup_widget(widget, "MNotebook");
if(notebook == NULL){
- g_printf("Notebook does not exist\n");
+ g_info("Notebook does not exist\n");
return NULL;
}
GtkWidget *page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook),
strcpy(label,"Page");
if(get_label(mw_data, label,"Get the name of the tab","Please input tab's name"))
return (create_tab (mw_data, copy_tab, notebook, label));
+ else
+ return NULL;
}
void
MainWindow * mw_data = get_window_data_struct(widget);
notebook = lookup_widget(widget, "MNotebook");
if(notebook == NULL){
- g_printf("Notebook does not exist\n");
+ g_info("Notebook does not exist\n");
return;
}
gint page_num;
GtkWidget *notebook = lookup_widget(widget, "MNotebook");
if(notebook == NULL){
- g_printf("Notebook does not exist\n");
+ g_info("Notebook does not exist\n");
return;
}
on_quit_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
- gtk_main_quit ();
+ mainwindow_quit();
}
on_cut_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
- g_printf("Cut\n");
+ g_info("Cut\n");
}
on_copy_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
- g_printf("Copye\n");
+ g_info("Copye\n");
}
on_paste_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
- g_printf("Paste\n");
+ g_info("Paste\n");
}
on_delete_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
- g_printf("Delete\n");
+ g_info("Delete\n");
}
delete_viewer((GtkWidget*)menuitem, user_data);
}
-#if 0
void
-on_trace_filter_activate (GtkMenuItem *menuitem,
+on_trace_facility_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
- MainWindow * mw_data = get_window_data_struct((GtkWidget*)menuitem);
- LttvTracesetSelector * s;
- GtkWidget * w;
- GtkWidget * notebook = lookup_widget(GTK_WIDGET(menuitem), "MNotebook");
-
- GtkWidget *page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook),
- gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook)));
- Tab *tab;
-
- if(!page) {
- return;
- } else {
- tab = (Tab *)g_object_get_data(G_OBJECT(page), "Tab_Info");
- }
-
- w = gtk_multivpaned_get_widget(GTK_MULTIVPANED(tab->multivpaned));
-
- s = g_object_get_data(G_OBJECT(w), "Traceset_Selector");
- if(!s){
- g_printf("There is no viewer yet\n");
- return;
- }
- if(get_filter_selection(s, "Configure trace and tracefile filter", "Select traces and tracefiles")){
- //FIXME report filter change
- //update_traceset(mw_data);
- //call_pending_read_hooks(mw_data);
- //lttvwindow_report_current_time(mw_data,&(tab->current_time));
- }
-}
-#endif //0
-
-void
-on_trace_facility_activate (GtkMenuItem *menuitem,
- gpointer user_data)
-{
- g_printf("Trace facility selector: %s\n");
-}
+ g_info("Trace facility selector: %s\n");
+}
/* Dispaly a file selection dialogue to let user select a library, then call
g_ptr_array_add(name, path);
}
- load_module_path = get_selection((char **)(name->pdata), name->len,
+ load_module_path = get_selection(mw_data,
+ (char **)(name->pdata), name->len,
"Select a library path", "Library paths");
if(load_module_path != NULL)
strncpy(load_module_path_alter, load_module_path, PATH_MAX-1); // -1 for /
gtk_file_selection_set_filename(file_selector, load_module_path_alter);
gtk_file_selection_hide_fileop_buttons(file_selector);
+ gtk_window_set_transient_for(GTK_WINDOW(file_selector),
+ GTK_WINDOW(mw_data->mwindow));
+
str[0] = '\0';
id = gtk_dialog_run(GTK_DIALOG(file_selector));
switch(id){
lttv_module_require(str1, &error);
#endif //0
lttv_library_load(str1, &error);
- if(error != NULL) g_warning(error->message);
- else g_printf("Load library: %s\n", str);
+ if(error != NULL) g_warning("%s", error->message);
+ else g_info("Load library: %s\n", str);
g_strfreev(dir);
case GTK_RESPONSE_REJECT:
case GTK_RESPONSE_CANCEL:
{
MainWindow * mw_data = get_window_data_struct((GtkWidget*)menuitem);
- LttvLibrary *library;
- {
- GPtrArray *name;
- guint nb,i;
- gchar *lib_name;
- name = g_ptr_array_new();
- nb = lttv_library_number();
- LttvLibraryInfo *lib_info = g_new(LttvLibraryInfo,nb);
- /* ask for the library name */
+ LttvLibrary *library = NULL;
+
+ GPtrArray *name;
+ guint nb,i;
+ gchar *lib_name;
+ name = g_ptr_array_new();
+ nb = lttv_library_number();
+ LttvLibraryInfo *lib_info = g_new(LttvLibraryInfo,nb);
+ /* ask for the library name */
+ for(i=0;i<nb;i++){
+ LttvLibrary *iter_lib = lttv_library_get(i);
+ lttv_library_info(iter_lib, &lib_info[i]);
+
+ gchar *path = lib_info[i].name;
+ g_ptr_array_add(name, path);
+ }
+ lib_name = get_selection(mw_data, (char **)(name->pdata), name->len,
+ "Select a library", "Libraries");
+ if(lib_name != NULL) {
for(i=0;i<nb;i++){
- LttvLibrary *iter_lib = lttv_library_get(i);
- lttv_library_info(iter_lib, &lib_info[i]);
-
- gchar *path = lib_info[i].name;
- g_ptr_array_add(name, lib_info[i].name);
- }
- lib_name = get_selection((char **)(name->pdata), name->len,
- "Select a library", "Libraries");
- if(lib_name != NULL) {
- for(i=0;i<nb;i++){
- if(strcmp(lib_name, lib_info[i].name) == 0) {
- library = lttv_library_get(i);
- break;
- }
+ if(strcmp(lib_name, lib_info[i].name) == 0) {
+ library = lttv_library_get(i);
+ break;
}
}
- g_ptr_array_free(name, TRUE);
- g_free(lib_info);
-
- if(lib_name == NULL) return;
}
-
- lttv_library_unload(library);
+ g_ptr_array_free(name, TRUE);
+ g_free(lib_info);
+
+ if(lib_name == NULL) return;
+
+ if(library != NULL) lttv_library_unload(library);
}
GError *error = NULL;
MainWindow * mw_data = get_window_data_struct((GtkWidget*)menuitem);
- LttvLibrary *library;
+ LttvLibrary *library = NULL;
{
GPtrArray *name;
guint nb,i;
gchar *path = lib_info[i].name;
g_ptr_array_add(name, path);
}
- lib_name = get_selection((char **)(name->pdata), name->len,
+ lib_name = get_selection(mw_data,(char **)(name->pdata), name->len,
"Select a library", "Libraries");
if(lib_name != NULL) {
for(i=0;i<nb;i++){
GPtrArray *name;
guint nb,i;
gchar *module_name;
+ nb = lttv_library_module_number(library);
LttvModuleInfo *module_info = g_new(LttvModuleInfo,nb);
name = g_ptr_array_new();
- nb = lttv_library_module_number(library);
/* ask for the module name */
for(i=0;i<nb;i++){
gchar *path = module_info[i].name;
g_ptr_array_add(name, path);
}
- module_name = get_selection((char **)(name->pdata), name->len,
+ module_name = get_selection(mw_data, (char **)(name->pdata), name->len,
"Select a module", "Modules");
if(module_name != NULL) {
for(i=0;i<nb;i++){
}
lttv_module_require(module_name_out, &error);
- if(error != NULL) g_warning(error->message);
- else g_printf("Load module: %s\n", module_name_out);
+ if(error != NULL) g_warning("%s", error->message);
+ else g_info("Load module: %s", module_name_out);
#if 0
#endif //0
lttv_library_load(str1, &error);
if(error != NULL) g_warning(error->message);
- else g_printf("Load library: %s\n", str);
+ else g_info("Load library: %s\n", str);
g_strfreev(dir);
case GTK_RESPONSE_REJECT:
case GTK_RESPONSE_CANCEL:
gchar *path = lib_info[i].name;
g_ptr_array_add(name, path);
}
- lib_name = get_selection((char **)(name->pdata), name->len,
+ lib_name = get_selection(mw_data, (char **)(name->pdata), name->len,
"Select a library", "Libraries");
if(lib_name != NULL) {
for(i=0;i<nb;i++){
if(lib_name == NULL) return;
}
- LttvModule *module;
+ LttvModule *module = NULL;
{
/* Ask for the module to load : list modules in the selected lib */
GPtrArray *name;
gchar *path = module_info[i].name;
if(module_info[i].use_count > 0) g_ptr_array_add(name, path);
}
- module_name = get_selection((char **)(name->pdata), name->len,
+ module_name = get_selection(mw_data, (char **)(name->pdata), name->len,
"Select a module", "Modules");
if(module_name != NULL) {
for(i=0;i<nb;i++){
LttvModuleInfo module_info;
lttv_module_info(module, &module_info);
- g_printf("Release module: %s\n", module_info.name);
+ g_info("Release module: %s\n", module_info.name);
lttv_module_release(module);
}
on_add_library_search_path_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
- GtkDirSelection * file_selector = (GtkDirSelection *)gtk_dir_selection_new("Select library path");
+ MainWindow * mw_data = get_window_data_struct((GtkWidget*)menuitem);
+ //GtkDirSelection * file_selector = (GtkDirSelection *)gtk_dir_selection_new("Select library path");
+ GtkFileSelection * file_selector = (GtkFileSelection *)gtk_file_selection_new("Select a trace");
+ gtk_widget_hide( (file_selector)->file_list->parent) ;
+
+ gtk_window_set_transient_for(GTK_WINDOW(file_selector),
+ GTK_WINDOW(mw_data->mwindow));
+
const char * dir;
gint id;
- MainWindow * mw_data = get_window_data_struct((GtkWidget*)menuitem);
if(remember_plugins_dir[0] != '\0')
- gtk_dir_selection_set_filename(file_selector, remember_plugins_dir);
+ gtk_file_selection_set_filename(file_selector, remember_plugins_dir);
id = gtk_dialog_run(GTK_DIALOG(file_selector));
switch(id){
case GTK_RESPONSE_ACCEPT:
case GTK_RESPONSE_OK:
- dir = gtk_dir_selection_get_dir (file_selector);
+ dir = gtk_file_selection_get_filename (file_selector);
strncpy(remember_plugins_dir,dir,PATH_MAX);
strncat(remember_plugins_dir,"/",PATH_MAX);
lttv_library_path_add(dir);
gchar *path = lttv_library_path_get(i);
g_ptr_array_add(name, path);
}
- lib_path = get_selection((char **)(name->pdata), name->len,
+ lib_path = get_selection(mw_data, (char **)(name->pdata), name->len,
"Select a library path", "Library paths");
g_ptr_array_free(name, TRUE);
on_color_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
- g_printf("Color\n");
+ g_info("Color\n");
}
void
-on_filter_activate (GtkMenuItem *menuitem,
+on_save_configuration_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
- g_printf("Filter\n");
+ g_info("Save configuration\n");
}
void
-on_save_configuration_activate (GtkMenuItem *menuitem,
+on_content_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
- g_printf("Save configuration\n");
+ g_info("Content\n");
}
-void
-on_content_activate (GtkMenuItem *menuitem,
+static void
+on_about_close_activate (GtkButton *button,
gpointer user_data)
{
- g_printf("Content\n");
-}
+ GtkWidget *about_widget = GTK_WIDGET(user_data);
+ gtk_widget_destroy(about_widget);
+}
void
on_about_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
- g_printf("About...\n");
+ MainWindow *main_window = get_window_data_struct(GTK_WIDGET(menuitem));
+ GtkWidget *window_widget = main_window->mwindow;
+ GtkWidget *about_widget = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ GtkWindow *about_window = GTK_WINDOW(about_widget);
+ gint window_width, window_height;
+
+ gtk_window_set_title(about_window, "About Linux Trace Toolkit");
+
+ gtk_window_set_resizable(about_window, FALSE);
+ gtk_window_set_transient_for(GTK_WINDOW(window_widget), about_window);
+ gtk_window_set_destroy_with_parent(about_window, TRUE);
+ gtk_window_set_modal(about_window, FALSE);
+
+ /* Put the about window at the center of the screen */
+ gtk_window_get_size(about_window, &window_width, &window_height);
+ gtk_window_move (about_window,
+ (gdk_screen_width() - window_width)/2,
+ (gdk_screen_height() - window_height)/2);
+
+ GtkWidget *vbox = gtk_vbox_new(FALSE, 1);
+
+ gtk_container_add(GTK_CONTAINER(about_widget), vbox);
+
+
+ /* Text to show */
+ GtkWidget *label1 = gtk_label_new("");
+ gtk_misc_set_padding(GTK_MISC(label1), 10, 20);
+ gtk_label_set_markup(GTK_LABEL(label1), "\
+<big>Linux Trace Toolkit</big>");
+ gtk_label_set_justify(GTK_LABEL(label1), GTK_JUSTIFY_CENTER);
+
+ GtkWidget *label2 = gtk_label_new("");
+ gtk_misc_set_padding(GTK_MISC(label2), 10, 20);
+ gtk_label_set_markup(GTK_LABEL(label2), "\
+Contributors :\n\
+\n\
+Michel Dagenais (New trace format, lttv main)\n\
+Mathieu Desnoyers (Kernel Tracer, Directory structure, build with automake/conf,\n\
+ lttv gui, control flow view, gui cooperative trace reading\n\
+ scheduler with interruptible foreground and background\n\
+ computation, detailed event list (rewrite), trace reading\n\
+ library (rewrite))\n\
+Benoit Des Ligneris, Eric Clement (Cluster adaptation, work in progress)\n\
+Xang-Xiu Yang (new trace reading library and converter, lttv gui, \n\
+ detailed event list and statistics view)\n\
+Tom Zanussi (RelayFS)\n\
+\n\
+Strongly inspired from the original Linux Trace Toolkit Visualizer made by\n\
+Karim Yaghmour");
+
+ GtkWidget *label3 = gtk_label_new("");
+ gtk_label_set_markup(GTK_LABEL(label3), "\
+Linux Trace Toolkit Viewer, Copyright (C) 2004\n\
+ Michel Dagenais\n\
+ Mathieu Desnoyers\n\
+ Xang-Xiu Yang\n\
+Linux Trace Toolkit comes with ABSOLUTELY NO WARRANTY.\n\
+This is free software, and you are welcome to redistribute it\n\
+under certain conditions. See COPYING for details.");
+ gtk_misc_set_padding(GTK_MISC(label3), 10, 20);
+
+ gtk_box_pack_start_defaults(GTK_BOX(vbox), label1);
+ gtk_box_pack_start_defaults(GTK_BOX(vbox), label2);
+ gtk_box_pack_start_defaults(GTK_BOX(vbox), label3);
+
+ GtkWidget *hbox = gtk_hbox_new(TRUE, 0);
+ gtk_box_pack_end(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
+ GtkWidget *close_button = gtk_button_new_with_mnemonic("_Close");
+ gtk_box_pack_end(GTK_BOX(hbox), close_button, FALSE, FALSE, 0);
+ gtk_container_set_border_width(GTK_CONTAINER(close_button), 20);
+
+ g_signal_connect(G_OBJECT(close_button), "clicked",
+ G_CALLBACK(on_about_close_activate),
+ (gpointer)about_widget);
+
+ gtk_widget_show_all(about_widget);
}
g_object_unref(main_window->attributes);
g_main_window_list = g_slist_remove(g_main_window_list, main_window);
- g_printf("There are now : %d windows\n",g_slist_length(g_main_window_list));
+ g_info("There are now : %d windows\n",g_slist_length(g_main_window_list));
if(g_slist_length(g_main_window_list) == 0)
- gtk_main_quit ();
+ mainwindow_quit();
}
gboolean
gpointer user_data)
{
MainWindow * mw_data = get_window_data_struct((GtkWidget*)widget);
- float width = event->width;
- TimeWindow time_win;
- double ratio;
- TimeInterval *time_span;
- LttTime time;
// MD : removed time width modification upon resizing of the main window.
// The viewers will redraw themselves completely, without time interval
}
-void scroll_value_changed_cb(GtkWidget *scrollbar,
- gpointer user_data)
+void time_change_manager (Tab *tab,
+ TimeWindow new_time_window)
{
- Tab *tab = (Tab *)user_data;
- TimeWindow time_window;
- TimeInterval *time_span;
- LttTime time;
- GtkAdjustment *adjust = gtk_range_get_adjustment(GTK_RANGE(scrollbar));
- gdouble value = gtk_adjustment_get_value(adjust);
- gdouble upper, lower, ratio, page_size;
- LttvTracesetContext * tsc =
- LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context);
+ /* Only one source of time change */
+ if(tab->time_manager_lock == TRUE) return;
- //time_window = tab->time_window;
+ tab->time_manager_lock = TRUE;
- time_span = &tsc->time_span ;
- lower = adjust->lower;
- upper = adjust->upper;
- ratio = (value - lower) / (upper - lower);
- g_critical("lower %lu, upper %lu, value %lu, ratio %lu", lower, upper, value, ratio);
-
- //time = ltt_time_sub(time_span->end_time, time_span->start_time);
- //time = ltt_time_mul(time, (float)ratio);
- //time = ltt_time_add(time_span->start_time, time);
- time = ltt_time_from_double(value/NANOSECONDS_PER_SECOND);
+ LttvTracesetContext *tsc = LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context);
+ TimeInterval time_span = tsc->time_span;
+ LttTime start_time = new_time_window.start_time;
+ LttTime end_time = new_time_window.end_time;
+ LttTime time_width = new_time_window.time_width;
- time_window.start_time = time;
+ g_assert(ltt_time_compare(start_time, end_time) < 0);
- page_size = adjust->page_size;
+ /* Set scrollbar */
+ GtkAdjustment *adjustment = gtk_range_get_adjustment(GTK_RANGE(tab->scrollbar));
+ LttTime upper = ltt_time_sub(time_span.end_time, time_span.start_time);
+#if 0
+ gtk_range_set_increments(GTK_RANGE(tab->scrollbar),
+ ltt_time_to_double(new_time_window.time_width)
+ / SCROLL_STEP_PER_PAGE
+ * NANOSECONDS_PER_SECOND, /* step increment */
+ ltt_time_to_double(new_time_window.time_width)
+ * NANOSECONDS_PER_SECOND); /* page increment */
+ gtk_range_set_range(GTK_RANGE(tab->scrollbar),
+ 0.0, /* lower */
+ ltt_time_to_double(upper)
+ * NANOSECONDS_PER_SECOND); /* upper */
+#endif //0
+ g_object_set(G_OBJECT(adjustment),
+ "lower",
+ 0.0, /* lower */
+ "upper",
+ ltt_time_to_double(upper), /* upper */
+ "step_increment",
+ new_time_window.time_width_double
+ / SCROLL_STEP_PER_PAGE, /* step increment */
+ "page_increment",
+ new_time_window.time_width_double,
+ /* page increment */
+ "page_size",
+ new_time_window.time_width_double, /* page size */
+ NULL);
+ gtk_adjustment_changed(adjustment);
- time_window.time_width =
- ltt_time_from_double(page_size/NANOSECONDS_PER_SECOND);
- //time = ltt_time_sub(time_span->end_time, time);
- //if(ltt_time_compare(time,time_window.time_width) < 0){
- // time_window.time_width = time;
- //}
+ // g_object_set(G_OBJECT(adjustment),
+ // "value",
+ // ltt_time_to_double(
+ // ltt_time_sub(start_time, time_span.start_time))
+ // , /* value */
+ // NULL);
+ //gtk_adjustment_value_changed(adjustment);
+ gtk_range_set_value(GTK_RANGE(tab->scrollbar),
+ ltt_time_to_double(
+ ltt_time_sub(start_time, time_span.start_time)) /* value */);
+
+ /* set the time bar. */
+ /* start seconds */
+ gtk_spin_button_set_range(GTK_SPIN_BUTTON(tab->MEntry1),
+ (double)time_span.start_time.tv_sec,
+ (double)time_span.end_time.tv_sec);
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(tab->MEntry1),
+ (double)start_time.tv_sec);
+
+ /* start nanoseconds */
+ if(start_time.tv_sec == time_span.start_time.tv_sec) {
+ /* can be both beginning and end at the same time. */
+ if(start_time.tv_sec == time_span.end_time.tv_sec) {
+ /* If we are at the end, max nsec to end.. -1 (not zero length) */
+ gtk_spin_button_set_range(GTK_SPIN_BUTTON(tab->MEntry2),
+ (double)time_span.start_time.tv_nsec,
+ (double)time_span.end_time.tv_nsec-1);
+ } else {
+ gtk_spin_button_set_range(GTK_SPIN_BUTTON(tab->MEntry2),
+ (double)time_span.start_time.tv_nsec,
+ (double)NANOSECONDS_PER_SECOND-1);
+ }
+ } else if(start_time.tv_sec == time_span.end_time.tv_sec) {
+ /* If we are at the end, max nsec to end.. -1 (not zero length) */
+ gtk_spin_button_set_range(GTK_SPIN_BUTTON(tab->MEntry2),
+ 0.0,
+ (double)time_span.end_time.tv_nsec-1);
+ } else /* anywhere else */
+ gtk_spin_button_set_range(GTK_SPIN_BUTTON(tab->MEntry2),
+ 0.0,
+ (double)NANOSECONDS_PER_SECOND-1);
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(tab->MEntry2),
+ (double)start_time.tv_nsec);
+
+ /* end seconds */
+ gtk_spin_button_set_range(GTK_SPIN_BUTTON(tab->MEntry3),
+ (double)time_span.start_time.tv_sec,
+ (double)time_span.end_time.tv_sec);
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(tab->MEntry3),
+ (double)end_time.tv_sec);
+
+ /* end nanoseconds */
+ if(end_time.tv_sec == time_span.start_time.tv_sec) {
+ /* can be both beginning and end at the same time. */
+ if(end_time.tv_sec == time_span.end_time.tv_sec) {
+ /* If we are at the end, max nsec to end.. */
+ gtk_spin_button_set_range(GTK_SPIN_BUTTON(tab->MEntry4),
+ (double)time_span.start_time.tv_nsec+1,
+ (double)time_span.end_time.tv_nsec);
+ } else {
+ gtk_spin_button_set_range(GTK_SPIN_BUTTON(tab->MEntry4),
+ (double)time_span.start_time.tv_nsec+1,
+ (double)NANOSECONDS_PER_SECOND-1);
+ }
+ }
+ else if(end_time.tv_sec == time_span.end_time.tv_sec) {
+ /* If we are at the end, max nsec to end.. */
+ gtk_spin_button_set_range(GTK_SPIN_BUTTON(tab->MEntry4),
+ 0.0,
+ (double)time_span.end_time.tv_nsec);
+ }
+ else /* anywhere else */
+ gtk_spin_button_set_range(GTK_SPIN_BUTTON(tab->MEntry4),
+ 0.0,
+ (double)NANOSECONDS_PER_SECOND-1);
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(tab->MEntry4),
+ (double)end_time.tv_nsec);
+
+ /* width seconds */
+ if(time_width.tv_nsec == 0) {
+ gtk_spin_button_set_range(GTK_SPIN_BUTTON(tab->MEntry7),
+ (double)1,
+ (double)upper.tv_sec);
+ } else {
+ gtk_spin_button_set_range(GTK_SPIN_BUTTON(tab->MEntry7),
+ (double)0,
+ (double)upper.tv_sec);
+ }
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(tab->MEntry7),
+ (double)time_width.tv_sec);
+
+ /* width nanoseconds */
+ if(time_width.tv_sec == upper.tv_sec) {
+ if(time_width.tv_sec == 0) {
+ gtk_spin_button_set_range(GTK_SPIN_BUTTON(tab->MEntry8),
+ (double)1,
+ (double)upper.tv_nsec);
+ } else {
+ gtk_spin_button_set_range(GTK_SPIN_BUTTON(tab->MEntry8),
+ (double)0,
+ (double)upper.tv_nsec);
+ }
+ }
+ else if(time_width.tv_sec == 0) {
+ gtk_spin_button_set_range(GTK_SPIN_BUTTON(tab->MEntry8),
+ 1.0,
+ (double)upper.tv_nsec);
+ }
+ else /* anywhere else */
+ gtk_spin_button_set_range(GTK_SPIN_BUTTON(tab->MEntry8),
+ 0.0,
+ (double)NANOSECONDS_PER_SECOND-1);
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(tab->MEntry8),
+ (double)time_width.tv_nsec);
/* call viewer hooks for new time window */
- set_time_window(tab, &time_window);
+ set_time_window(tab, &new_time_window);
+ tab->time_manager_lock = FALSE;
}
-/* callback function to check or uncheck the check box (filter)
+/* value changed for frame start s
+ *
+ * Check time span : if ns is out of range, clip it the nearest good value.
*/
-
-void checkbox_changed(GtkTreeView *treeview,
- GtkTreePath *arg1,
- GtkTreeViewColumn *arg2,
- gpointer user_data)
+void
+on_MEntry1_value_changed (GtkSpinButton *spinbutton,
+ gpointer user_data)
{
- GtkTreeStore * store = (GtkTreeStore *)gtk_tree_view_get_model (treeview);
- GtkTreeIter iter;
- gboolean value;
+ Tab *tab =(Tab *)user_data;
+ LttvTracesetContext * tsc =
+ LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context);
+ TimeInterval time_span = tsc->time_span;
+ gint value = gtk_spin_button_get_value_as_int(spinbutton);
- if (gtk_tree_model_get_iter ((GtkTreeModel *)store, &iter, arg1)){
- gtk_tree_model_get ((GtkTreeModel *)store, &iter, CHECKBOX_COLUMN, &value, -1);
- value = value? FALSE : TRUE;
- gtk_tree_store_set (GTK_TREE_STORE (store), &iter, CHECKBOX_COLUMN, value, -1);
- }
-
-}
+ TimeWindow new_time_window = tab->time_window;
+
+ LttTime end_time = new_time_window.end_time;
+ new_time_window.start_time.tv_sec = value;
-/* According to user's selection, update selector(filter)
- */
+ /* start nanoseconds */
+ if(new_time_window.start_time.tv_sec == time_span.start_time.tv_sec) {
+ if(new_time_window.start_time.tv_sec == time_span.end_time.tv_sec) {
+ if(new_time_window.start_time.tv_nsec > time_span.end_time.tv_nsec)
+ new_time_window.start_time.tv_nsec = time_span.end_time.tv_nsec-1;
+ if(new_time_window.start_time.tv_nsec < time_span.start_time.tv_nsec)
+ new_time_window.start_time.tv_nsec = time_span.start_time.tv_nsec;
+ } else {
+ if(new_time_window.start_time.tv_nsec < time_span.start_time.tv_nsec)
+ new_time_window.start_time.tv_nsec = time_span.start_time.tv_nsec;
+ }
+ }
+ else if(new_time_window.start_time.tv_sec == time_span.end_time.tv_sec) {
+ if(new_time_window.start_time.tv_nsec > time_span.end_time.tv_nsec)
+ new_time_window.start_time.tv_nsec = time_span.end_time.tv_nsec-1;
+ }
-void update_filter(LttvTracesetSelector *s, GtkTreeStore *store )
-{
- GtkTreeIter iter, child_iter, child_iter1, child_iter2;
- int i, j, k, nb_eventtype;
- LttvTraceSelector * trace;
- LttvTracefileSelector * tracefile;
- LttvEventtypeSelector * eventtype;
- gboolean value, value1, value2;
-
- if(gtk_tree_model_get_iter_first((GtkTreeModel*)store, &iter)){
- i = 0;
- do{
- trace = lttv_traceset_selector_trace_get(s, i);
- nb_eventtype = lttv_trace_selector_eventtype_number(trace);
- gtk_tree_model_get ((GtkTreeModel*)store, &iter, CHECKBOX_COLUMN, &value,-1);
- if(value){
- j = 0;
- if(gtk_tree_model_iter_children ((GtkTreeModel*)store, &child_iter, &iter)){
- do{
- if(j<1){//eventtype selector for trace
- gtk_tree_model_get ((GtkTreeModel*)store, &child_iter, CHECKBOX_COLUMN, &value2,-1);
- if(value2){
- k=0;
- if(gtk_tree_model_iter_children ((GtkTreeModel*)store, &child_iter1, &child_iter)){
- do{
- eventtype = lttv_trace_selector_eventtype_get(trace,k);
- gtk_tree_model_get ((GtkTreeModel*)store, &child_iter1, CHECKBOX_COLUMN, &value2,-1);
- lttv_eventtype_selector_set_selected(eventtype,value2);
- k++;
- }while(gtk_tree_model_iter_next((GtkTreeModel*)store, &child_iter1));
- }
- }
- }else{ //tracefile selector
- tracefile = lttv_trace_selector_tracefile_get(trace, j - 1);
- gtk_tree_model_get ((GtkTreeModel*)store, &child_iter, CHECKBOX_COLUMN, &value1,-1);
- lttv_tracefile_selector_set_selected(tracefile,value1);
- if(value1){
- gtk_tree_model_iter_children((GtkTreeModel*)store, &child_iter1, &child_iter); //eventtype selector
- gtk_tree_model_get ((GtkTreeModel*)store, &child_iter1, CHECKBOX_COLUMN, &value2,-1);
- if(value2){
- k = 0;
- if(gtk_tree_model_iter_children ((GtkTreeModel*)store, &child_iter2, &child_iter1)){
- do{//eventtype selector for tracefile
- eventtype = lttv_tracefile_selector_eventtype_get(tracefile,k);
- gtk_tree_model_get ((GtkTreeModel*)store, &child_iter2, CHECKBOX_COLUMN, &value2,-1);
- lttv_eventtype_selector_set_selected(eventtype,value2);
- k++;
- }while(gtk_tree_model_iter_next((GtkTreeModel*)store, &child_iter2));
- }
- }
- }
- }
- j++;
- }while(gtk_tree_model_iter_next((GtkTreeModel*)store, &child_iter));
- }
- }
- lttv_trace_selector_set_selected(trace,value);
- i++;
- }while(gtk_tree_model_iter_next((GtkTreeModel*)store, &iter));
+ if(ltt_time_compare(new_time_window.start_time, end_time) >= 0) {
+ /* Then, we must push back end time : keep the same time width
+ * if possible, else end traceset time */
+ end_time = LTT_TIME_MIN(ltt_time_add(new_time_window.start_time,
+ new_time_window.time_width),
+ time_span.end_time);
}
+
+ /* Fix the time width to fit start time and end time */
+ new_time_window.time_width = ltt_time_sub(end_time,
+ new_time_window.start_time);
+ new_time_window.time_width_double =
+ ltt_time_to_double(new_time_window.time_width);
+
+ new_time_window.end_time = end_time;
+
+ time_change_manager(tab, new_time_window);
+
}
+void
+on_MEntry2_value_changed (GtkSpinButton *spinbutton,
+ gpointer user_data)
+{
+ Tab *tab =(Tab *)user_data;
+ LttvTracesetContext * tsc =
+ LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context);
+ TimeInterval time_span = tsc->time_span;
+ gint value = gtk_spin_button_get_value_as_int(spinbutton);
+
+ TimeWindow new_time_window = tab->time_window;
+
+ LttTime end_time = new_time_window.end_time;
-/* Display a dialogue showing all eventtypes and traces, let user to select the interested
- * eventtypes, tracefiles and traces (filter)
- */
+ new_time_window.start_time.tv_nsec = value;
-gboolean get_filter_selection(LttvTracesetSelector *s,char *title, char * column_title)
+ if(ltt_time_compare(new_time_window.start_time, end_time) >= 0) {
+ /* Then, we must push back end time : keep the same time width
+ * if possible, else end traceset time */
+ end_time = LTT_TIME_MIN(ltt_time_add(new_time_window.start_time,
+ new_time_window.time_width),
+ time_span.end_time);
+ }
+
+ /* Fix the time width to fit start time and end time */
+ new_time_window.time_width = ltt_time_sub(end_time,
+ new_time_window.start_time);
+ new_time_window.time_width_double =
+ ltt_time_to_double(new_time_window.time_width);
+
+ new_time_window.end_time = end_time;
+
+ time_change_manager(tab, new_time_window);
+
+}
+
+void
+on_MEntry3_value_changed (GtkSpinButton *spinbutton,
+ gpointer user_data)
{
- GtkWidget * dialogue;
- GtkTreeStore * store;
- GtkWidget * tree;
- GtkWidget * scroll_win;
- GtkCellRenderer * renderer;
- GtkTreeViewColumn * column;
- GtkTreeIter iter, child_iter, child_iter1, child_iter2;
- int i, j, k, id, nb_trace, nb_tracefile, nb_eventtype;
- LttvTraceSelector * trace;
- LttvTracefileSelector * tracefile;
- LttvEventtypeSelector * eventtype;
- char * name;
- gboolean checked;
+ Tab *tab =(Tab *)user_data;
+ LttvTracesetContext * tsc =
+ LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context);
+ TimeInterval time_span = tsc->time_span;
+ gint value = gtk_spin_button_get_value_as_int(spinbutton);
- dialogue = gtk_dialog_new_with_buttons(title,
- NULL,
- GTK_DIALOG_MODAL,
- GTK_STOCK_OK,GTK_RESPONSE_ACCEPT,
- GTK_STOCK_CANCEL,GTK_RESPONSE_REJECT,
- NULL);
- gtk_window_set_default_size((GtkWindow*)dialogue, 300, 500);
+ TimeWindow new_time_window = tab->time_window;
+
+ LttTime end_time = new_time_window.end_time;
- store = gtk_tree_store_new (TOTAL_COLUMNS, G_TYPE_BOOLEAN, G_TYPE_STRING);
- tree = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));
- g_object_unref (G_OBJECT (store));
- g_signal_connect (G_OBJECT (tree), "row-activated",
- G_CALLBACK (checkbox_changed),
- NULL);
+ end_time.tv_sec = value;
+ /* end nanoseconds */
+ if(end_time.tv_sec == time_span.start_time.tv_sec) {
+ if(end_time.tv_sec == time_span.end_time.tv_sec) {
+ if(end_time.tv_nsec > time_span.end_time.tv_nsec)
+ end_time.tv_nsec = time_span.end_time.tv_nsec;
+ if(end_time.tv_nsec < time_span.start_time.tv_nsec)
+ end_time.tv_nsec = time_span.start_time.tv_nsec+1;
+ } else {
+ if(end_time.tv_nsec < time_span.start_time.tv_nsec)
+ end_time.tv_nsec = time_span.start_time.tv_nsec+1;
+ }
+ }
+ else if(end_time.tv_sec == time_span.end_time.tv_sec) {
+ if(end_time.tv_nsec > time_span.end_time.tv_nsec)
+ end_time.tv_nsec = time_span.end_time.tv_nsec;
+ }
- renderer = gtk_cell_renderer_toggle_new ();
- gtk_cell_renderer_toggle_set_radio((GtkCellRendererToggle *)renderer, FALSE);
+ if(ltt_time_compare(new_time_window.start_time, end_time) >= 0) {
+ /* Then, we must push front start time : keep the same time width
+ * if possible, else end traceset time */
+ new_time_window.start_time = LTT_TIME_MAX(
+ ltt_time_sub(end_time,
+ new_time_window.time_width),
+ time_span.start_time);
+ }
- g_object_set (G_OBJECT (renderer),"activatable", TRUE, NULL);
+ /* Fix the time width to fit start time and end time */
+ new_time_window.time_width = ltt_time_sub(end_time,
+ new_time_window.start_time);
+ new_time_window.time_width_double =
+ ltt_time_to_double(new_time_window.time_width);
- column = gtk_tree_view_column_new_with_attributes ("Checkbox",
- renderer,
- "active", CHECKBOX_COLUMN,
- NULL);
- gtk_tree_view_column_set_alignment (column, 0.5);
- gtk_tree_view_column_set_fixed_width (column, 20);
- gtk_tree_view_append_column (GTK_TREE_VIEW (tree), column);
+ new_time_window.end_time = end_time;
+
+ time_change_manager(tab, new_time_window);
- renderer = gtk_cell_renderer_text_new ();
- column = gtk_tree_view_column_new_with_attributes (column_title,
- renderer,
- "text", NAME_COLUMN,
- NULL);
- gtk_tree_view_column_set_alignment (column, 0.0);
- gtk_tree_view_append_column (GTK_TREE_VIEW (tree), column);
- gtk_tree_view_set_headers_visible(GTK_TREE_VIEW (tree), FALSE);
+}
- scroll_win = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll_win),
- GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC);
- gtk_container_add (GTK_CONTAINER (scroll_win), tree);
+void
+on_MEntry4_value_changed (GtkSpinButton *spinbutton,
+ gpointer user_data)
+{
+ Tab *tab =(Tab *)user_data;
+ LttvTracesetContext * tsc =
+ LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context);
+ TimeInterval time_span = tsc->time_span;
+ gint value = gtk_spin_button_get_value_as_int(spinbutton);
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialogue)->vbox), scroll_win,TRUE, TRUE,0);
+ TimeWindow new_time_window = tab->time_window;
+
+ LttTime end_time = new_time_window.end_time;
+
+ end_time.tv_nsec = value;
- gtk_widget_show(scroll_win);
- gtk_widget_show(tree);
+ if(ltt_time_compare(new_time_window.start_time, end_time) >= 0) {
+ /* Then, we must push front start time : keep the same time width
+ * if possible, else end traceset time */
+ new_time_window.start_time = LTT_TIME_MAX(
+ ltt_time_sub(end_time,
+ new_time_window.time_width),
+ time_span.start_time);
+ }
+
+ /* Fix the time width to fit start time and end time */
+ new_time_window.time_width = ltt_time_sub(end_time,
+ new_time_window.start_time);
+ new_time_window.time_width_double =
+ ltt_time_to_double(new_time_window.time_width);
+ new_time_window.end_time = end_time;
+
+ time_change_manager(tab, new_time_window);
+
+}
+
+/* value changed for time frame interval s
+ *
+ * Check time span : if ns is out of range, clip it the nearest good value.
+ */
+void
+on_MEntry7_value_changed (GtkSpinButton *spinbutton,
+ gpointer user_data)
+{
+ Tab *tab =(Tab *)user_data;
+ LttvTracesetContext * tsc =
+ LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context);
+ TimeInterval time_span = tsc->time_span;
+ gint value = gtk_spin_button_get_value_as_int(spinbutton);
+ LttTime current_time, time_delta;
+ TimeWindow new_time_window = tab->time_window;
+ current_time = tab->current_time;
- nb_trace = lttv_traceset_selector_trace_number(s);
- for(i=0;i<nb_trace;i++){
- trace = lttv_traceset_selector_trace_get(s, i);
- name = lttv_trace_selector_get_name(trace);
- gtk_tree_store_append (store, &iter, NULL);
- checked = lttv_trace_selector_get_selected(trace);
- gtk_tree_store_set (store, &iter,
- CHECKBOX_COLUMN,checked,
- NAME_COLUMN,name,
- -1);
-
- gtk_tree_store_append (store, &child_iter, &iter);
- gtk_tree_store_set (store, &child_iter,
- CHECKBOX_COLUMN, checked,
- NAME_COLUMN,"eventtype",
- -1);
-
- nb_eventtype = lttv_trace_selector_eventtype_number(trace);
- for(j=0;j<nb_eventtype;j++){
- eventtype = lttv_trace_selector_eventtype_get(trace,j);
- name = lttv_eventtype_selector_get_name(eventtype);
- checked = lttv_eventtype_selector_get_selected(eventtype);
- gtk_tree_store_append (store, &child_iter1, &child_iter);
- gtk_tree_store_set (store, &child_iter1,
- CHECKBOX_COLUMN, checked,
- NAME_COLUMN,name,
- -1);
+ time_delta = ltt_time_sub(time_span.end_time,time_span.start_time);
+ new_time_window.time_width.tv_sec = value;
+ new_time_window.time_width_double =
+ ltt_time_to_double(new_time_window.time_width);
+ if(ltt_time_compare(new_time_window.time_width,time_delta) > 0)
+ { /* Case where zoom out is bigger than trace length */
+ new_time_window.start_time = time_span.start_time;
+ new_time_window.time_width = time_delta;
+ new_time_window.time_width_double = ltt_time_to_double(time_delta);
+ new_time_window.end_time = ltt_time_add(new_time_window.start_time,
+ new_time_window.time_width) ;
+ }
+ else
+ {
+ /* Center the image on the current time */
+ new_time_window.start_time =
+ ltt_time_sub(current_time,
+ ltt_time_from_double(new_time_window.time_width_double/2.0));
+ new_time_window.end_time = ltt_time_add(new_time_window.start_time,
+ new_time_window.time_width) ;
+ /* If on borders, don't fall off */
+ if(ltt_time_compare(new_time_window.start_time, time_span.start_time) <0
+ || ltt_time_compare(new_time_window.start_time, time_span.end_time) >0)
+ {
+ new_time_window.start_time = time_span.start_time;
+ new_time_window.end_time = ltt_time_add(new_time_window.start_time,
+ new_time_window.time_width) ;
}
+ else
+ {
+ if(ltt_time_compare(new_time_window.end_time,
+ time_span.end_time) > 0
+ || ltt_time_compare(new_time_window.end_time,
+ time_span.start_time) < 0)
+ {
+ new_time_window.start_time =
+ ltt_time_sub(time_span.end_time, new_time_window.time_width);
- nb_tracefile = lttv_trace_selector_tracefile_number(trace);
- for(j=0;j<nb_tracefile;j++){
- tracefile = lttv_trace_selector_tracefile_get(trace, j);
- name = lttv_tracefile_selector_get_name(tracefile);
- gtk_tree_store_append (store, &child_iter, &iter);
- checked = lttv_tracefile_selector_get_selected(tracefile);
- gtk_tree_store_set (store, &child_iter,
- CHECKBOX_COLUMN, checked,
- NAME_COLUMN,name,
- -1);
-
- gtk_tree_store_append (store, &child_iter1, &child_iter);
- gtk_tree_store_set (store, &child_iter1,
- CHECKBOX_COLUMN, checked,
- NAME_COLUMN,"eventtype",
- -1);
+ new_time_window.end_time = ltt_time_add(new_time_window.start_time,
+ new_time_window.time_width) ;
+ }
+ }
- for(k=0;k<nb_eventtype;k++){
- eventtype = lttv_tracefile_selector_eventtype_get(tracefile,k);
- name = lttv_eventtype_selector_get_name(eventtype);
- checked = lttv_eventtype_selector_get_selected(eventtype);
- gtk_tree_store_append (store, &child_iter2, &child_iter1);
- gtk_tree_store_set (store, &child_iter2,
- CHECKBOX_COLUMN, checked,
- NAME_COLUMN,name,
- -1);
+ }
+
+ if(ltt_time_compare(new_time_window.time_width, ltt_time_zero) == 0) {
+ g_warning("Zoom more than 1 ns impossible");
+ } else {
+ time_change_manager(tab, new_time_window);
+ }
+}
+
+void
+on_MEntry8_value_changed (GtkSpinButton *spinbutton,
+ gpointer user_data)
+{
+ Tab *tab =(Tab *)user_data;
+ LttvTracesetContext * tsc =
+ LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context);
+ TimeInterval time_span = tsc->time_span;
+ gint value = gtk_spin_button_get_value_as_int(spinbutton);
+ LttTime current_time, time_delta;
+ TimeWindow new_time_window = tab->time_window;
+ current_time = tab->current_time;
+
+ time_delta = ltt_time_sub(time_span.end_time,time_span.start_time);
+ new_time_window.time_width.tv_nsec = value;
+ new_time_window.time_width_double =
+ ltt_time_to_double(new_time_window.time_width);
+ if(ltt_time_compare(new_time_window.time_width,time_delta) > 0)
+ { /* Case where zoom out is bigger than trace length */
+ new_time_window.start_time = time_span.start_time;
+ new_time_window.time_width = time_delta;
+ new_time_window.time_width_double = ltt_time_to_double(time_delta);
+ new_time_window.end_time = ltt_time_add(new_time_window.start_time,
+ new_time_window.time_width) ;
+ }
+ else
+ {
+ /* Center the image on the current time */
+ new_time_window.start_time =
+ ltt_time_sub(current_time,
+ ltt_time_from_double(new_time_window.time_width_double/2.0));
+ new_time_window.end_time = ltt_time_add(new_time_window.start_time,
+ new_time_window.time_width) ;
+ /* If on borders, don't fall off */
+ if(ltt_time_compare(new_time_window.start_time, time_span.start_time) <0
+ || ltt_time_compare(new_time_window.start_time, time_span.end_time) >0)
+ {
+ new_time_window.start_time = time_span.start_time;
+ new_time_window.end_time = ltt_time_add(new_time_window.start_time,
+ new_time_window.time_width) ;
+ }
+ else
+ {
+ if(ltt_time_compare(new_time_window.end_time,
+ time_span.end_time) > 0
+ || ltt_time_compare(new_time_window.end_time,
+ time_span.start_time) < 0)
+ {
+ new_time_window.start_time =
+ ltt_time_sub(time_span.end_time, new_time_window.time_width);
+
+ new_time_window.end_time = ltt_time_add(new_time_window.start_time,
+ new_time_window.time_width) ;
}
}
+
}
- id = gtk_dialog_run(GTK_DIALOG(dialogue));
- switch(id){
- case GTK_RESPONSE_ACCEPT:
- case GTK_RESPONSE_OK:
- update_filter(s, store);
- gtk_widget_destroy(dialogue);
- return TRUE;
- case GTK_RESPONSE_REJECT:
- case GTK_RESPONSE_CANCEL:
- default:
- gtk_widget_destroy(dialogue);
- break;
+ if(ltt_time_compare(new_time_window.time_width, ltt_time_zero) == 0) {
+ g_warning("Zoom more than 1 ns impossible");
+ } else {
+ time_change_manager(tab, new_time_window);
}
- return FALSE;
}
+
+void current_time_change_manager (Tab *tab,
+ LttTime new_current_time)
+{
+ /* Only one source of time change */
+ if(tab->current_time_manager_lock == TRUE) return;
+
+ tab->current_time_manager_lock = TRUE;
+
+ LttvTracesetContext *tsc = LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context);
+ TimeInterval time_span = tsc->time_span;
+
+ /* current seconds */
+ gtk_spin_button_set_range(GTK_SPIN_BUTTON(tab->MEntry5),
+ (double)time_span.start_time.tv_sec,
+ (double)time_span.end_time.tv_sec);
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(tab->MEntry5),
+ (double)new_current_time.tv_sec);
+
+
+ /* start nanoseconds */
+ if(new_current_time.tv_sec == time_span.start_time.tv_sec) {
+ /* can be both beginning and end at the same time. */
+ if(new_current_time.tv_sec == time_span.end_time.tv_sec) {
+ /* If we are at the end, max nsec to end.. */
+ gtk_spin_button_set_range(GTK_SPIN_BUTTON(tab->MEntry6),
+ (double)time_span.start_time.tv_nsec,
+ (double)time_span.end_time.tv_nsec);
+ } else {
+ gtk_spin_button_set_range(GTK_SPIN_BUTTON(tab->MEntry6),
+ (double)time_span.start_time.tv_nsec,
+ (double)NANOSECONDS_PER_SECOND-1);
+ }
+ } else if(new_current_time.tv_sec == time_span.end_time.tv_sec) {
+ /* If we are at the end, max nsec to end.. */
+ gtk_spin_button_set_range(GTK_SPIN_BUTTON(tab->MEntry6),
+ 0.0,
+ (double)time_span.end_time.tv_nsec);
+ } else /* anywhere else */
+ gtk_spin_button_set_range(GTK_SPIN_BUTTON(tab->MEntry6),
+ 0.0,
+ (double)NANOSECONDS_PER_SECOND-1);
+
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(tab->MEntry6),
+ (double)new_current_time.tv_nsec);
+
+ set_current_time(tab, &new_current_time);
+
+ tab->current_time_manager_lock = FALSE;
+}
+
+void current_position_change_manager(Tab *tab,
+ LttvTracesetContextPosition *pos)
+{
+ LttvTracesetContext *tsc =
+ LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context);
+ TimeInterval time_span = tsc->time_span;
+
+ g_assert(lttv_process_traceset_seek_position(tsc, pos) == 0);
+ LttTime new_time = lttv_traceset_context_position_get_time(pos);
+ /* Put the context in a state coherent position */
+ lttv_state_traceset_seek_time_closest((LttvTracesetState*)tsc, ltt_time_zero);
+
+ current_time_change_manager(tab, new_time);
+
+ set_current_position(tab, pos);
+}
+
+
+void
+on_MEntry5_value_changed (GtkSpinButton *spinbutton,
+ gpointer user_data)
+{
+ Tab *tab = (Tab*)user_data;
+ LttvTracesetContext * tsc =
+ LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context);
+ TimeInterval time_span = tsc->time_span;
+ gint value = gtk_spin_button_get_value_as_int(spinbutton);
+ LttTime new_current_time = tab->current_time;
+ new_current_time.tv_sec = value;
+
+ /* current nanoseconds */
+ if(new_current_time.tv_sec == time_span.start_time.tv_sec) {
+ if(new_current_time.tv_sec == time_span.end_time.tv_sec) {
+ if(new_current_time.tv_nsec > time_span.end_time.tv_nsec)
+ new_current_time.tv_nsec = time_span.end_time.tv_nsec;
+ if(new_current_time.tv_nsec < time_span.start_time.tv_nsec)
+ new_current_time.tv_nsec = time_span.start_time.tv_nsec;
+ } else {
+ if(new_current_time.tv_nsec < time_span.start_time.tv_nsec)
+ new_current_time.tv_nsec = time_span.start_time.tv_nsec;
+ }
+ }
+ else if(new_current_time.tv_sec == time_span.end_time.tv_sec) {
+ if(new_current_time.tv_nsec > time_span.end_time.tv_nsec)
+ new_current_time.tv_nsec = time_span.end_time.tv_nsec;
+ }
+
+ current_time_change_manager(tab, new_current_time);
+}
+
+void
+on_MEntry6_value_changed (GtkSpinButton *spinbutton,
+ gpointer user_data)
+{
+ Tab *tab = (Tab*)user_data;
+ gint value = gtk_spin_button_get_value_as_int(spinbutton);
+ LttTime new_current_time = tab->current_time;
+ new_current_time.tv_nsec = value;
+
+ current_time_change_manager(tab, new_current_time);
+}
+
+
+void scroll_value_changed_cb(GtkWidget *scrollbar,
+ gpointer user_data)
+{
+ Tab *tab = (Tab *)user_data;
+ TimeWindow new_time_window;
+ LttTime time;
+ GtkAdjustment *adjust = gtk_range_get_adjustment(GTK_RANGE(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;
+
+ time = ltt_time_add(ltt_time_from_double(value),
+ time_span.start_time);
+
+ new_time_window.start_time = time;
+
+ page_size = adjust->page_size;
+
+ new_time_window.time_width =
+ ltt_time_from_double(page_size);
+
+ new_time_window.time_width_double =
+ page_size;
+
+ 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);
+#if 0
+ //time_window = tab->time_window;
+
+ lower = adjust->lower;
+ upper = adjust->upper;
+ ratio = (value - lower) / (upper - lower);
+ g_info("lower %lu, upper %lu, value %lu, ratio %lu", lower, upper, value, ratio);
+
+ //time = ltt_time_sub(time_span->end_time, time_span->start_time);
+ //time = ltt_time_mul(time, (float)ratio);
+ //time = ltt_time_add(time_span->start_time, time);
+ time = ltt_time_add(ltt_time_from_double(value),
+ time_span.start_time);
+
+ time_window.start_time = time;
+
+ page_size = adjust->page_size;
+
+ time_window.time_width =
+ ltt_time_from_double(page_size);
+ //time = ltt_time_sub(time_span.end_time, time);
+ //if(ltt_time_compare(time,time_window.time_width) < 0){
+ // time_window.time_width = time;
+ //}
+
+ /* call viewer hooks for new time window */
+ set_time_window(tab, &time_window);
+#endif //0
+}
+
+
+/* Display a dialogue showing all eventtypes and traces, let user to select the interested
+ * eventtypes, tracefiles and traces (filter)
+ */
+
/* Select a trace which will be removed from traceset
*/
-char * get_remove_trace(char ** all_trace_name, int nb_trace)
+char * get_remove_trace(MainWindow *mw_data,
+ char ** all_trace_name, int nb_trace)
{
- return get_selection(all_trace_name, nb_trace,
+ return get_selection(mw_data, all_trace_name, nb_trace,
"Select a trace", "Trace pathname");
}
/* Select a module which will be loaded
*/
-char * get_load_module(char ** load_module_name, int nb_module)
+char * get_load_module(MainWindow *mw_data,
+ char ** load_module_name, int nb_module)
{
- return get_selection(load_module_name, nb_module,
+ return get_selection(mw_data, load_module_name, nb_module,
"Select a module to load", "Module name");
}
/* Select a module which will be unloaded
*/
-char * get_unload_module(char ** loaded_module_name, int nb_module)
+char * get_unload_module(MainWindow *mw_data,
+ char ** loaded_module_name, int nb_module)
{
- return get_selection(loaded_module_name, nb_module,
+ return get_selection(mw_data, loaded_module_name, nb_module,
"Select a module to unload", "Module name");
}
* select one of them
*/
-char * get_selection(char ** loaded_module_name, int nb_module,
- char *title, char * column_title)
+char * get_selection(MainWindow *mw_data,
+ char ** loaded_module_name, int nb_module,
+ char *title, char * column_title)
{
GtkWidget * dialogue;
GtkWidget * scroll_win;
GTK_STOCK_CANCEL,GTK_RESPONSE_REJECT,
NULL);
gtk_window_set_default_size((GtkWindow*)dialogue, 500, 200);
+ gtk_window_set_transient_for(GTK_WINDOW(dialogue),
+ GTK_WINDOW(mw_data->mwindow));
scroll_win = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_show ( scroll_win);
}
id = gtk_dialog_run(GTK_DIALOG(dialogue));
+ GtkTreeModel **store_model = (GtkTreeModel**)&store;
switch(id){
case GTK_RESPONSE_ACCEPT:
case GTK_RESPONSE_OK:
- if (gtk_tree_selection_get_selected (select, (GtkTreeModel**)&store, &iter)){
+ if (gtk_tree_selection_get_selected (select, store_model, &iter)){
gtk_tree_model_get ((GtkTreeModel*)store, &iter, MODULE_COLUMN, &unload_module_name, -1);
}
case GTK_RESPONSE_REJECT:
void add_all_menu_toolbar_constructors(MainWindow * mw, gpointer user_data)
{
- int i;
+ guint i;
GdkPixbuf *pixbuf;
lttvwindow_viewer_constructor constructor;
LttvMenus * global_menu, * instance_menu;
/* Create a main window
*/
-void construct_main_window(MainWindow * parent)
+MainWindow *construct_main_window(MainWindow * parent)
{
g_debug("construct_main_window()");
GtkWidget * new_window; /* New generated main window */
// Add the object's information to the module's array
g_main_window_list = g_slist_append(g_main_window_list, new_m_window);
-
new_window = create_MWindow();
gtk_widget_show (new_window);
//create a default tab
notebook = (GtkNotebook *)lookup_widget(new_m_window->mwindow, "MNotebook");
if(notebook == NULL){
- g_printf("Notebook does not exist\n");
- return;
+ g_info("Notebook does not exist\n");
+ /* FIXME : destroy partially created widgets */
+ g_free(new_m_window);
+ return NULL;
}
- gtk_notebook_popup_enable (GTK_NOTEBOOK(notebook));
+ //gtk_notebook_popup_enable (GTK_NOTEBOOK(notebook));
//for now there is no name field in LttvTraceset structure
//Use "Traceset" as the label for the default tab
if(parent) {
new_tab = create_tab(new_m_window, parent_tab, notebook, "Traceset");
} else {
new_tab = create_tab(new_m_window, NULL, notebook, "Traceset");
- /* First window, use command line trace */
- if(g_init_trace != NULL){
- lttvwindow_add_trace(new_tab,
- g_init_trace);
+ }
+
+ /* Insert default viewers */
+ {
+ LttvAttributeType type;
+ LttvAttributeName name;
+ LttvAttributeValue value;
+ LttvAttribute *attribute;
+
+ LttvIAttribute *attributes_global =
+ LTTV_IATTRIBUTE(lttv_global_attributes());
+
+ g_assert(attribute =
+ LTTV_ATTRIBUTE(lttv_iattribute_find_subdir(
+ LTTV_IATTRIBUTE(attributes_global),
+ LTTV_VIEWER_CONSTRUCTORS)));
+
+ name = g_quark_from_string("guievents");
+ type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(attribute),
+ name, &value);
+ if(type == LTTV_POINTER) {
+ lttvwindow_viewer_constructor viewer_constructor =
+ (lttvwindow_viewer_constructor)*value.v_pointer;
+ insert_viewer(new_window, viewer_constructor);
+ }
+
+ name = g_quark_from_string("guicontrolflow");
+ type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(attribute),
+ name, &value);
+ if(type == LTTV_POINTER) {
+ lttvwindow_viewer_constructor viewer_constructor =
+ (lttvwindow_viewer_constructor)*value.v_pointer;
+ insert_viewer(new_window, viewer_constructor);
+ }
- LttvTraceset *traceset = new_tab->traceset_info->traceset;
- SetTraceset(new_tab, traceset);
+ name = g_quark_from_string("guistatistics");
+ type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(attribute),
+ name, &value);
+ if(type == LTTV_POINTER) {
+ lttvwindow_viewer_constructor viewer_constructor =
+ (lttvwindow_viewer_constructor)*value.v_pointer;
+ insert_viewer(new_window, viewer_constructor);
}
}
- g_printf("There are now : %d windows\n",g_slist_length(g_main_window_list));
+ g_info("There are now : %d windows\n",g_slist_length(g_main_window_list));
+
+ return new_m_window;
}
* destroy the tab
*/
-void tab_destructor(Tab * tab_instance)
+void tab_destructor(Tab * tab)
{
int i, nb, ref_count;
LttvTrace * trace;
- if(tab_instance->attributes)
- g_object_unref(tab_instance->attributes);
+ gtk_object_destroy(GTK_OBJECT(tab->tooltips));
+
+ if(tab->attributes)
+ g_object_unref(tab->attributes);
- if(tab_instance->interrupted_state)
- g_object_unref(tab_instance->interrupted_state);
+ if(tab->interrupted_state)
+ g_object_unref(tab->interrupted_state);
- if(tab_instance->traceset_info->traceset_context != NULL){
+ if(tab->traceset_info->traceset_context != NULL){
//remove state update hooks
lttv_state_remove_event_hooks(
- (LttvTracesetState*)tab_instance->traceset_info->
+ (LttvTracesetState*)tab->traceset_info->
traceset_context);
- lttv_context_fini(LTTV_TRACESET_CONTEXT(tab_instance->traceset_info->
+ lttv_context_fini(LTTV_TRACESET_CONTEXT(tab->traceset_info->
traceset_context));
- g_object_unref(tab_instance->traceset_info->traceset_context);
+ g_object_unref(tab->traceset_info->traceset_context);
}
- if(tab_instance->traceset_info->traceset != NULL) {
- nb = lttv_traceset_number(tab_instance->traceset_info->traceset);
+ if(tab->traceset_info->traceset != NULL) {
+ nb = lttv_traceset_number(tab->traceset_info->traceset);
for(i = 0 ; i < nb ; i++) {
- trace = lttv_traceset_get(tab_instance->traceset_info->traceset, i);
+ trace = lttv_traceset_get(tab->traceset_info->traceset, i);
ref_count = lttv_trace_get_ref_number(trace);
if(ref_count <= 1){
ltt_trace_close(lttv_trace(trace));
}
}
- }
- lttv_traceset_destroy(tab_instance->traceset_info->traceset);
+ }
+ lttv_filter_destroy(tab->filter);
+ lttv_traceset_destroy(tab->traceset_info->traceset);
/* Remove the idle events requests processing function of the tab */
- g_idle_remove_by_data(tab_instance);
+ g_idle_remove_by_data(tab);
- g_slist_free(tab_instance->events_requests);
- g_free(tab_instance->traceset_info);
- g_free(tab_instance);
+ g_slist_free(tab->events_requests);
+ g_free(tab->traceset_info);
+ g_free(tab);
}
{
GList * list;
Tab * tab;
- LttTime tmp_time;
//create a new tab data structure
tab = g_new(Tab,1);
if(copy_tab) {
tab->traceset_info->traceset =
lttv_traceset_copy(copy_tab->traceset_info->traceset);
+
+ /* Copy the previous tab's filter */
+ /* 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;
}
-
-//FIXME : this is g_debug level
+#ifdef DEBUG
lttv_attribute_write_xml(
lttv_traceset_attribute(tab->traceset_info->traceset),
stdout,
0, 4);
fflush(stdout);
+#endif //DEBUG
+ tab->time_manager_lock = FALSE;
+ tab->current_time_manager_lock = FALSE;
//FIXME copy not implemented in lower level
tab->traceset_info->traceset_context =
(LttvTracesetState*)tab->traceset_info->traceset_context);
//determine the current_time and time_window of the tab
+#if 0
if(copy_tab != NULL){
tab->time_window = copy_tab->time_window;
tab->current_time = copy_tab->current_time;
LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context)->
time_span.start_time.tv_nsec;
}
+#endif //0
tab->attributes = LTTV_IATTRIBUTE(g_object_new(LTTV_ATTRIBUTE_TYPE, NULL));
tab->interrupted_state = g_object_new(LTTV_ATTRIBUTE_TYPE, NULL);
- tab->vbox = gtk_vbox_new(FALSE, 0);
- tab->viewer_container = gtk_vbox_new(TRUE, 0);
+ tab->vbox = gtk_vbox_new(FALSE, 2);
+ tab->viewer_container = gtk_vbox_new(TRUE, 2);
tab->scrollbar = gtk_hscrollbar_new(NULL);
//tab->multivpaned = gtk_multi_vpaned_new();
-
+
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 */
+ {
+ tab->MTimebar = gtk_hbox_new(FALSE, 2);
+ gtk_widget_show(tab->MTimebar);
+ tab->tooltips = gtk_tooltips_new();
+
+ tab->MEventBox1a = gtk_event_box_new();
+ gtk_widget_show(tab->MEventBox1a);
+ gtk_tooltips_set_tip(tab->tooltips, tab->MEventBox1a,
+ "Paste Start and End Times Here", "");
+ tab->MText1a = gtk_label_new("Time Frame ");
+ gtk_widget_show(tab->MText1a);
+ gtk_container_add(GTK_CONTAINER(tab->MEventBox1a), tab->MText1a);
+ tab->MEventBox1b = gtk_event_box_new();
+ gtk_widget_show(tab->MEventBox1b);
+ gtk_tooltips_set_tip(tab->tooltips, tab->MEventBox1b,
+ "Paste Start Time Here", "");
+ tab->MText1b = gtk_label_new("start: ");
+ gtk_widget_show(tab->MText1b);
+ gtk_container_add(GTK_CONTAINER(tab->MEventBox1b), tab->MText1b);
+ tab->MText2 = gtk_label_new("s");
+ gtk_widget_show(tab->MText2);
+ tab->MText3a = gtk_label_new("ns");
+ gtk_widget_show(tab->MText3a);
+
+ tab->MEventBox3b = gtk_event_box_new();
+ gtk_widget_show(tab->MEventBox3b);
+ gtk_tooltips_set_tip(tab->tooltips, tab->MEventBox3b,
+ "Paste End Time Here", "");
+ tab->MText3b = gtk_label_new("end:");
+ gtk_widget_show(tab->MText3b);
+ gtk_container_add(GTK_CONTAINER(tab->MEventBox3b), tab->MText3b);
+ tab->MText4 = gtk_label_new("s");
+ gtk_widget_show(tab->MText4);
+ tab->MText5a = gtk_label_new("ns");
+ gtk_widget_show(tab->MText5a);
+
+ tab->MEventBox8 = gtk_event_box_new();
+ gtk_widget_show(tab->MEventBox8);
+ gtk_tooltips_set_tip(tab->tooltips, tab->MEventBox8,
+ "Paste Time Interval here", "");
+ tab->MText8 = gtk_label_new("Time Interval:");
+ gtk_widget_show(tab->MText8);
+ gtk_container_add(GTK_CONTAINER(tab->MEventBox8), tab->MText8);
+ tab->MText9 = gtk_label_new("s");
+ gtk_widget_show(tab->MText9);
+ tab->MText10 = gtk_label_new("ns");
+ gtk_widget_show(tab->MText10);
+
+ tab->MEventBox5b = gtk_event_box_new();
+ gtk_widget_show(tab->MEventBox5b);
+ gtk_tooltips_set_tip(tab->tooltips, tab->MEventBox5b,
+ "Paste Current Time Here", "");
+ tab->MText5b = gtk_label_new("Current Time:");
+ gtk_widget_show(tab->MText5b);
+ gtk_container_add(GTK_CONTAINER(tab->MEventBox5b), tab->MText5b);
+ tab->MText6 = gtk_label_new("s");
+ gtk_widget_show(tab->MText6);
+ tab->MText7 = gtk_label_new("ns");
+ gtk_widget_show(tab->MText7);
+
+ tab->MEntry1 = gtk_spin_button_new_with_range(0.0, 1.0, 1.0);
+ gtk_spin_button_set_digits(GTK_SPIN_BUTTON(tab->MEntry1),0);
+ gtk_spin_button_set_snap_to_ticks(GTK_SPIN_BUTTON(tab->MEntry1),TRUE);
+ gtk_widget_show(tab->MEntry1);
+ tab->MEntry2 = gtk_spin_button_new_with_range(0.0, 1.0, 1.0);
+ gtk_spin_button_set_digits(GTK_SPIN_BUTTON(tab->MEntry2),0);
+ gtk_spin_button_set_snap_to_ticks(GTK_SPIN_BUTTON(tab->MEntry2),TRUE);
+ gtk_widget_show(tab->MEntry2);
+ tab->MEntry3 = gtk_spin_button_new_with_range(0.0, 1.0, 1.0);
+ gtk_spin_button_set_digits(GTK_SPIN_BUTTON(tab->MEntry3),0);
+ gtk_spin_button_set_snap_to_ticks(GTK_SPIN_BUTTON(tab->MEntry3),TRUE);
+ gtk_widget_show(tab->MEntry3);
+ tab->MEntry4 = gtk_spin_button_new_with_range(0.0, 1.0, 1.0);
+ gtk_spin_button_set_digits(GTK_SPIN_BUTTON(tab->MEntry4),0);
+ gtk_spin_button_set_snap_to_ticks(GTK_SPIN_BUTTON(tab->MEntry4),TRUE);
+ gtk_widget_show(tab->MEntry4);
+ tab->MEntry5 = gtk_spin_button_new_with_range(0.0, 1.0, 1.0);
+ gtk_spin_button_set_digits(GTK_SPIN_BUTTON(tab->MEntry5),0);
+ gtk_spin_button_set_snap_to_ticks(GTK_SPIN_BUTTON(tab->MEntry5),TRUE);
+ gtk_widget_show(tab->MEntry5);
+ tab->MEntry6 = gtk_spin_button_new_with_range(0.0, 1.0, 1.0);
+ gtk_spin_button_set_digits(GTK_SPIN_BUTTON(tab->MEntry6),0);
+ gtk_spin_button_set_snap_to_ticks(GTK_SPIN_BUTTON(tab->MEntry6),TRUE);
+ gtk_widget_show(tab->MEntry6);
+ tab->MEntry7 = gtk_spin_button_new_with_range(0.0, 1.0, 1.0);
+ gtk_spin_button_set_digits(GTK_SPIN_BUTTON(tab->MEntry7),0);
+ gtk_spin_button_set_snap_to_ticks(GTK_SPIN_BUTTON(tab->MEntry7),TRUE);
+ gtk_widget_show(tab->MEntry7);
+ tab->MEntry8 = gtk_spin_button_new_with_range(0.0, 1.0, 1.0);
+ gtk_spin_button_set_digits(GTK_SPIN_BUTTON(tab->MEntry8),0);
+ gtk_spin_button_set_snap_to_ticks(GTK_SPIN_BUTTON(tab->MEntry8),TRUE);
+ gtk_widget_show(tab->MEntry8);
+
+ GtkWidget *temp_widget;
+
+ gtk_box_pack_start (GTK_BOX (tab->MTimebar), tab->MEventBox1a, FALSE,
+ FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (tab->MTimebar), tab->MEventBox1b, FALSE,
+ FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (tab->MTimebar), tab->MEntry1, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (tab->MTimebar), tab->MText2, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (tab->MTimebar), tab->MEntry2, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (tab->MTimebar), tab->MText3a, FALSE, FALSE, 0);
+ temp_widget = gtk_vseparator_new();
+ gtk_widget_show(temp_widget);
+ gtk_box_pack_start (GTK_BOX (tab->MTimebar), temp_widget, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (tab->MTimebar), tab->MEventBox3b, FALSE,
+ FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (tab->MTimebar), tab->MEntry3, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (tab->MTimebar), tab->MText4, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (tab->MTimebar), tab->MEntry4, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (tab->MTimebar), tab->MText5a, FALSE, FALSE, 0);
+ temp_widget = gtk_vseparator_new();
+ gtk_widget_show(temp_widget);
+ gtk_box_pack_start (GTK_BOX (tab->MTimebar), temp_widget, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (tab->MTimebar), tab->MEventBox8, FALSE,
+ FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (tab->MTimebar), tab->MEntry7, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (tab->MTimebar), tab->MText9, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (tab->MTimebar), tab->MEntry8, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (tab->MTimebar), tab->MText10, FALSE, FALSE, 0);
+
+ temp_widget = gtk_vseparator_new();
+ gtk_widget_show(temp_widget);
+ gtk_box_pack_end (GTK_BOX (tab->MTimebar), tab->MText7, FALSE, FALSE, 0);
+ gtk_box_pack_end (GTK_BOX (tab->MTimebar), tab->MEntry6, FALSE, FALSE, 0);
+ gtk_box_pack_end (GTK_BOX (tab->MTimebar), tab->MText6, FALSE, FALSE, 0);
+ gtk_box_pack_end (GTK_BOX (tab->MTimebar), tab->MEntry5, FALSE, FALSE, 0);
+ gtk_box_pack_end (GTK_BOX (tab->MTimebar), tab->MEventBox5b, FALSE,
+ FALSE, 0);
+ gtk_box_pack_end (GTK_BOX (tab->MTimebar), temp_widget, FALSE, FALSE, 0);
+
+
+ //GtkWidget *test = gtk_button_new_with_label("drop");
+ //gtk_button_set_relief(GTK_BUTTON(test), GTK_RELIEF_NONE);
+ //gtk_widget_show(test);
+ //gtk_box_pack_end(GTK_BOX (tab->MTimebar), test, FALSE, FALSE, 0);
+ //gtk_widget_add_events(tab->MText1, GDK_ALL_EVENTS_MASK);//GDK_BUTTON_PRESS_MASK);
+ /*GtkWidget *event_box = gtk_event_box_new();
+ gtk_widget_show(event_box);
+ gtk_tooltips_set_tip(tooltips, event_box,
+ "Paste Current Time Here", "");
+ gtk_box_pack_end(GTK_BOX (tab->MTimebar), event_box, FALSE, FALSE, 0);
+ GtkWidget *test = gtk_label_new("drop");
+ gtk_container_add(GTK_CONTAINER(event_box), test);
+ gtk_widget_show(test);
+ g_signal_connect (G_OBJECT(event_box),
+ "button-press-event",
+ G_CALLBACK (on_MText1_paste),
+ (gpointer)tab);
+*/
+
+ g_signal_connect (G_OBJECT(tab->MEventBox1a),
+ "button-press-event",
+ G_CALLBACK (on_MEventBox1a_paste),
+ (gpointer)tab);
+
+ g_signal_connect (G_OBJECT(tab->MEventBox1b),
+ "button-press-event",
+ G_CALLBACK (on_MEventBox1b_paste),
+ (gpointer)tab);
+ g_signal_connect (G_OBJECT(tab->MEventBox3b),
+ "button-press-event",
+ G_CALLBACK (on_MEventBox3b_paste),
+ (gpointer)tab);
+ g_signal_connect (G_OBJECT(tab->MEventBox5b),
+ "button-press-event",
+ G_CALLBACK (on_MEventBox5b_paste),
+ (gpointer)tab);
+ g_signal_connect (G_OBJECT(tab->MEventBox8),
+ "button-press-event",
+ G_CALLBACK (on_MEventBox8_paste),
+ (gpointer)tab);
+ }
+
gtk_box_pack_end(GTK_BOX(tab->vbox),
tab->scrollbar,
FALSE, /* Do not expand */
FALSE, /* Fill has no effect here (expand false) */
0); /* No padding */
-
+
+ gtk_box_pack_end(GTK_BOX(tab->vbox),
+ tab->MTimebar,
+ FALSE, /* Do not expand */
+ FALSE, /* Fill has no effect here (expand false) */
+ 0); /* No padding */
+
g_object_set_data(G_OBJECT(tab->viewer_container), "focused_viewer", NULL);
g_signal_connect(G_OBJECT(tab->scrollbar), "value-changed",
G_CALLBACK(scroll_value_changed_cb), tab);
+
+ g_signal_connect ((gpointer) tab->MEntry1, "value-changed",
+ G_CALLBACK (on_MEntry1_value_changed),
+ tab);
+ g_signal_connect ((gpointer) tab->MEntry2, "value-changed",
+ G_CALLBACK (on_MEntry2_value_changed),
+ tab);
+ g_signal_connect ((gpointer) tab->MEntry3, "value-changed",
+ G_CALLBACK (on_MEntry3_value_changed),
+ tab);
+ g_signal_connect ((gpointer) tab->MEntry4, "value-changed",
+ G_CALLBACK (on_MEntry4_value_changed),
+ tab);
+ g_signal_connect ((gpointer) tab->MEntry5, "value-changed",
+ G_CALLBACK (on_MEntry5_value_changed),
+ tab);
+ g_signal_connect ((gpointer) tab->MEntry6, "value-changed",
+ G_CALLBACK (on_MEntry6_value_changed),
+ tab);
+ g_signal_connect ((gpointer) tab->MEntry7, "value-changed",
+ G_CALLBACK (on_MEntry7_value_changed),
+ tab);
+ g_signal_connect ((gpointer) tab->MEntry8, "value-changed",
+ G_CALLBACK (on_MEntry8_value_changed),
+ tab);
+
//g_signal_connect(G_OBJECT(tab->scrollbar), "changed",
// G_CALLBACK(scroll_value_changed_cb), 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;
}
return ( lttvwindow_process_pending_requests(tab) );
}
+
+void create_main_window_with_trace(const gchar *path)
+{
+ if(path == NULL) return;
+
+ /* Create window */
+ MainWindow *mw = construct_main_window(NULL);
+ GtkWidget *widget = mw->mwindow;
+
+ GtkWidget * notebook = lookup_widget(widget, "MNotebook");
+ GtkWidget *page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook),
+ gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook)));
+ Tab *tab;
+
+ if(!page) {
+ tab = create_new_tab(widget, NULL);
+ } else {
+ tab = (Tab *)g_object_get_data(G_OBJECT(page), "Tab_Info");
+ }
+
+ /* Add trace */
+ gchar abs_path[PATH_MAX];
+ LttvTrace *trace_v;
+ LttTrace *trace;
+
+ get_absolute_pathname(path, abs_path);
+ trace_v = lttvwindowtraces_get_trace_by_name(abs_path);
+ if(trace_v == NULL) {
+ trace = ltt_trace_open(abs_path);
+ if(trace == NULL) {
+ g_warning("cannot open trace %s", abs_path);
+
+ 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,
+ "Cannot open trace : maybe you should enter in the directory"
+ "to select it ?");
+ gtk_dialog_run(GTK_DIALOG(dialogue));
+ gtk_widget_destroy(dialogue);
+ } else {
+ trace_v = lttv_trace_new(trace);
+ lttvwindowtraces_add_trace(trace_v);
+ lttvwindow_add_trace(tab, trace_v);
+ }
+ } else {
+ lttvwindow_add_trace(tab, trace_v);
+ }
+
+ LttvTraceset *traceset;
+
+ traceset = tab->traceset_info->traceset;
+ SetTraceset(tab, traceset);
+}
+