}
-void lttv_library_path_add(char *name)
+void lttv_library_path_add(const char *name)
{
g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "Add library path %s", name);
g_ptr_array_add(library_paths,(char*)g_strdup(name));
}
-void lttv_library_path_remove(char *name)
+void lttv_library_path_remove(const char *name)
{
guint i;
/* Add or remove directory names to the library search path */
-void lttv_library_path_add(char *name);
+void lttv_library_path_add(const char *name);
-void lttv_library_path_remove(char *name);
+void lttv_library_path_remove(const char *name);
/* List the directory names in the library search path */
GtkAdjustment *v_adjust ;
/* Shown events information */
- TimeWindow time_window;
- LttTime current_time;
+// TimeWindow time_window;
+// LttTime current_time;
//guint currently_Selected_Event ;
guint number_of_process;
static void control_flow_grab_focus(GtkWidget *widget, gpointer data){
ControlFlowData * control_flow_data = (ControlFlowData *)data;
MainWindow * mw = control_flow_data->mw;
- set_focused_pane(mw, gtk_widget_get_parent(control_flow_data->scrolled_window));
+ lttvwindow_report_focus(mw, gtk_widget_get_parent(control_flow_data->scrolled_window));
}
//ProcessList_destroy(control_flow_data->process_list);
if(control_flow_data->mw != NULL)
{
- unreg_update_time_window(update_time_window_hook,
- control_flow_data,
- control_flow_data->mw);
+ lttvwindow_unregister_time_window_notify(control_flow_data->mw,
+ update_time_window_hook,
+ control_flow_data);
- unreg_update_current_time(update_current_time_hook,
- control_flow_data,
- control_flow_data->mw);
+ lttvwindow_unregister_current_time_notify(control_flow_data->mw,
+ update_current_time_hook,
+ control_flow_data);
}
g_info("CFV.c : guicontrolflow_destructor, %p", control_flow_data);
g_slist_remove(g_control_flow_data_list,control_flow_data);
return control_flow_data->process_list ;
}
-TimeWindow *guicontrolflow_get_time_window(ControlFlowData *control_flow_data)
-{
- return &control_flow_data->time_window;
-}
-LttTime *guicontrolflow_get_current_time(ControlFlowData *control_flow_data)
-{
- return &control_flow_data->current_time;
-}
-
guicontrolflow_destructor(ControlFlowData *control_flow_data);
GtkWidget *guicontrolflow_get_widget(ControlFlowData *control_flow_data);
ProcessList *guicontrolflow_get_process_list(ControlFlowData *control_flow_data);
-TimeWindow *guicontrolflow_get_time_window(ControlFlowData *control_flow_data);
-LttTime *guicontrolflow_get_current_time(ControlFlowData *control_flow_data);
#endif // _CFV_H
{
if(width < 0) return ;
if(height < 0) return ;
+
+ const TimeWindow *time_window = lttvwindow_get_time_window(drawing->control_flow_data->mw);
+
ControlFlowData *control_flow_data =
(ControlFlowData*)g_object_get_data(
- G_OBJECT(
- drawing->drawing_area),
- "control_flow_data");
+ G_OBJECT(drawing->drawing_area), "control_flow_data");
LttTime start, end;
- LttTime window_end = ltt_time_add(control_flow_data->time_window.time_width,
- control_flow_data->time_window.start_time);
+ LttTime window_end = ltt_time_add(time_window->time_width,
+ time_window->start_time);
g_debug("req : window_end : %u, %u", window_end.tv_sec,
- window_end.tv_nsec);
+ window_end.tv_nsec);
- g_debug("req : time width : %u, %u", control_flow_data->time_window.time_width.tv_sec,
- control_flow_data->time_window.time_width.tv_nsec);
+ g_debug("req : time width : %u, %u", time_window->time_width.tv_sec,
+ time_window->time_width.tv_nsec);
g_debug("x is : %i, x+width is : %i", x, x+width);
convert_pixels_to_time(drawing->drawing_area->allocation.width, x,
- &control_flow_data->time_window.start_time,
- &window_end,
+ time_window->start_time,
+ window_end,
&start);
convert_pixels_to_time(drawing->drawing_area->allocation.width, x + width,
- &control_flow_data->time_window.start_time,
- &window_end,
+ time_window->start_time,
+ window_end,
&end);
LttvTracesetContext * tsc =
- get_traceset_context(control_flow_data->mw);
+ lttvwindow_get_traceset_context(control_flow_data->mw);
LttvTracesetState * tss =
(LttvTracesetState*)tsc;
- //send_test_process(
- //guicontrolflow_get_process_list(drawing->control_flow_data),
- //drawing);
- //send_test_drawing(
- //guicontrolflow_get_process_list(drawing->control_flow_data),
- //drawing, *pixmap, x, y, width, height);
-
// Let's call processTrace() !!
EventRequest event_request; // Variable freed at the end of the function.
event_request.control_flow_data = control_flow_data;
* has updated the time interval before this configure gets
* executed.
*/
- get_time_window(drawing->control_flow_data->mw,
- &drawing->control_flow_data->time_window);
+ //lttvwindow_get_time_window(drawing->control_flow_data->mw,
+ // &drawing->control_flow_data->time_window);
/* New pixmap, size of the configure event */
//GdkPixmap *pixmap = gdk_pixmap_new(widget->window,
expose_event( GtkWidget *widget, GdkEventExpose *event, gpointer user_data )
{
Drawing_t *drawing = (Drawing_t*)user_data;
+ const TimeWindow *time_window = lttvwindow_get_time_window(drawing->control_flow_data->mw);
+ const LttTime* current_time =
+ lttvwindow_get_current_time(drawing->control_flow_data->mw);
+
ControlFlowData *control_flow_data =
(ControlFlowData*)g_object_get_data(
G_OBJECT(widget),
g_debug("drawing expose event");
guint x=0;
- LttTime* current_time =
- guicontrolflow_get_current_time(control_flow_data);
- LttTime window_end = ltt_time_add(control_flow_data->time_window.time_width,
- control_flow_data->time_window.start_time);
+ LttTime window_end = ltt_time_add(time_window->time_width,
+ time_window->start_time);
convert_time_to_pixels(
- control_flow_data->time_window.start_time,
+ time_window->start_time,
window_end,
*current_time,
widget->allocation.width,
G_OBJECT(widget),
"control_flow_data");
Drawing_t *drawing = control_flow_data->drawing;
-
+ const TimeWindow *time_window = lttvwindow_get_time_window(drawing->control_flow_data->mw);
g_debug("click");
if(event->button == 1)
{
LttTime time;
- LttTime window_end = ltt_time_add(control_flow_data->time_window.time_width,
- control_flow_data->time_window.start_time);
+ LttTime window_end = ltt_time_add(time_window->time_width,
+ time_window->start_time);
/* left mouse button click */
g_debug("x click is : %f", event->x);
convert_pixels_to_time(widget->allocation.width, (guint)event->x,
- &control_flow_data->time_window.start_time,
- &window_end,
+ time_window->start_time,
+ window_end,
&time);
- set_current_time(control_flow_data->mw, &time);
+ lttvwindow_report_current_time(control_flow_data->mw, &time);
}
- set_focused_pane(control_flow_data->mw, gtk_widget_get_parent(control_flow_data->scrolled_window));
+ lttvwindow_report_focus(control_flow_data->mw, gtk_widget_get_parent(control_flow_data->scrolled_window));
return FALSE;
}
void convert_pixels_to_time(
gint width,
guint x,
- LttTime *window_time_begin,
- LttTime *window_time_end,
+ LttTime window_time_begin,
+ LttTime window_time_end,
LttTime *time)
{
LttTime window_time_interval;
- window_time_interval = ltt_time_sub(*window_time_end,
- *window_time_begin);
+ window_time_interval = ltt_time_sub(window_time_end,
+ window_time_begin);
*time = ltt_time_mul(window_time_interval, (x/(float)width));
- *time = ltt_time_add(*window_time_begin, *time);
+ *time = ltt_time_add(window_time_begin, *time);
}
expose_ruler( GtkWidget *widget, GdkEventExpose *event, gpointer user_data )
{
Drawing_t *drawing = (Drawing_t*)user_data;
-
+ const TimeWindow *time_window = lttvwindow_get_time_window(drawing->control_flow_data->mw);
gchar text[255];
PangoContext *context;
GdkColor background = { 0, 0xffff, 0xffff, 0xffff };
LttTime window_end =
- ltt_time_add(drawing->control_flow_data->time_window.time_width,
- drawing->control_flow_data->time_window.start_time);
+ ltt_time_add(time_window->time_width,
+ time_window->start_time);
LttTime half_width =
- ltt_time_div(drawing->control_flow_data->time_window.time_width,2.0);
+ ltt_time_div(time_window->time_width,2.0);
LttTime window_middle =
ltt_time_add(half_width,
- drawing->control_flow_data->time_window.start_time);
+ time_window->start_time);
g_debug("ruler expose event");
gdk_draw_rectangle (drawing->ruler->window,
snprintf(text, 255, "%lus\n%luns",
- drawing->control_flow_data->time_window.start_time.tv_sec,
- drawing->control_flow_data->time_window.start_time.tv_nsec);
+ time_window->start_time.tv_sec,
+ time_window->start_time.tv_nsec);
layout = gtk_widget_create_pango_layout(drawing->drawing_area, NULL);
void convert_pixels_to_time(
gint width,
guint x,
- LttTime *window_time_begin,
- LttTime *window_time_end,
+ LttTime window_time_begin,
+ LttTime window_time_end,
LttTime *time);
void convert_time_to_pixels(
ControlFlowData *control_flow_data = guicontrolflow() ;
control_flow_data->mw = mw;
- TimeWindow *time_window = guicontrolflow_get_time_window(control_flow_data);
- time_window->start_time.tv_sec = 0;
- time_window->start_time.tv_nsec = 0;
- time_window->time_width.tv_sec = 0;
- time_window->time_width.tv_nsec = 0;
-
- LttTime *current_time = guicontrolflow_get_current_time(control_flow_data);
- current_time->tv_sec = 0;
- current_time->tv_nsec = 0;
- //g_debug("time width1 : %u",time_window->time_width);
-
- get_time_window(mw,
- time_window);
- get_current_time(mw,
- current_time);
-
//g_debug("time width2 : %u",time_window->time_width);
// Unreg done in the GuiControlFlow_Destructor
- reg_update_time_window(update_time_window_hook, control_flow_data,
- mw);
- reg_update_current_time(update_current_time_hook, control_flow_data,
- mw);
+ lttvwindow_register_time_window_notify(mw,
+ update_time_window_hook,
+ control_flow_data);
+ lttvwindow_register_current_time_notify(mw,
+ update_current_time_hook,
+ control_flow_data);
return guicontrolflow_get_widget(control_flow_data) ;
}
e = tfc->e;
LttTime evtime = ltt_event_time(e);
- TimeWindow *time_window =
- guicontrolflow_get_time_window(control_flow_data);
+ const TimeWindow *time_window =
+ lttvwindow_get_time_window(control_flow_data->mw);
LttTime end_time = ltt_time_add(time_window->start_time,
time_window->time_width);
LttTime time = ltt_event_time(e);
- LttTime window_end = ltt_time_add(control_flow_data->time_window.time_width,
- control_flow_data->time_window.start_time);
+ LttTime window_end = ltt_time_add(time_window->time_width,
+ time_window->start_time);
convert_time_to_pixels(
- control_flow_data->time_window.start_time,
+ time_window->start_time,
window_end,
time,
width,
e = tfc->e;
LttTime evtime = ltt_event_time(e);
- TimeWindow *time_window =
- guicontrolflow_get_time_window(control_flow_data);
+ const TimeWindow *time_window =
+ lttvwindow_get_time_window(control_flow_data->mw);
LttTime end_time = ltt_time_add(time_window->start_time,
time_window->time_width);
//LttTime time = ltt_event_time(e);
- //LttTime window_end = ltt_time_add(control_flow_data->time_window.time_width,
- // control_flow_data->time_window.start_time);
+ //LttTime window_end = ltt_time_add(time_window->time_width,
+ // time_window->start_time);
//convert_time_to_pixels(
- // control_flow_data->time_window.start_time,
+ // time_window->start_time,
// window_end,
// time,
// width,
gint update_time_window_hook(void *hook_data, void *call_data)
{
ControlFlowData *control_flow_data = (ControlFlowData*) hook_data;
+ const TimeWindowNotifyData *time_window_nofify_data =
+ ((const TimeWindowNotifyData *)call_data);
+
TimeWindow *old_time_window =
- guicontrolflow_get_time_window(control_flow_data);
- TimeWindow *new_time_window = ((TimeWindow*)call_data);
+ time_window_nofify_data->old_time_window;
+ TimeWindow *new_time_window =
+ time_window_nofify_data->new_time_window;
/* Update the ruler */
drawing_update_ruler(control_flow_data->drawing,
x, 0,
-1, -1);
- *old_time_window = *new_time_window;
+ //*old_time_window = *new_time_window;
/* Clean the data request background */
gdk_draw_rectangle (control_flow_data->drawing->pixmap,
} else {
g_info("scrolling far");
/* Cannot reuse any part of the screen : far jump */
- *old_time_window = *new_time_window;
+ //*old_time_window = *new_time_window;
gdk_draw_rectangle (control_flow_data->drawing->pixmap,
/* Different scale (zoom) */
g_info("zoom");
- *old_time_window = *new_time_window;
+ //*old_time_window = *new_time_window;
gdk_draw_rectangle (control_flow_data->drawing->pixmap,
control_flow_data->drawing->drawing_area->style->black_gc,
{
ControlFlowData *control_flow_data = (ControlFlowData*)hook_data;
- LttTime* current_time =
- guicontrolflow_get_current_time(control_flow_data);
- *current_time = *((LttTime*)call_data);
+ LttTime current_time = *((LttTime*)call_data);
- TimeWindow time_window;
+ const TimeWindow *time_window =
+ lttvwindow_get_time_window(control_flow_data->mw);
- LttTime time_begin = control_flow_data->time_window.start_time;
- LttTime width = control_flow_data->time_window.time_width;
+ LttTime time_begin = time_window->start_time;
+ LttTime width = time_window->time_width;
LttTime half_width = ltt_time_div(width,2.0);
LttTime time_end = ltt_time_add(time_begin, width);
LttvTracesetContext * tsc =
- get_traceset_context(control_flow_data->mw);
+ lttvwindow_get_traceset_context(control_flow_data->mw);
LttTime trace_start = tsc->Time_Span->startTime;
LttTime trace_end = tsc->Time_Span->endTime;
- g_info("New current time HOOK : %u, %u", current_time->tv_sec,
- current_time->tv_nsec);
+ g_info("New current time HOOK : %u, %u", current_time.tv_sec,
+ current_time.tv_nsec);
* at one end of the trace. */
- if(ltt_time_compare(*current_time, time_begin) == -1)
+ if(ltt_time_compare(current_time, time_begin) == -1)
{
- if(ltt_time_compare(*current_time,
+ TimeWindow new_time_window;
+
+ if(ltt_time_compare(current_time,
ltt_time_add(trace_start,half_width)) == -1)
time_begin = trace_start;
else
- time_begin = ltt_time_sub(*current_time,half_width);
+ time_begin = ltt_time_sub(current_time,half_width);
- time_window.start_time = time_begin;
- time_window.time_width = width;
+ new_time_window.start_time = time_begin;
+ new_time_window.time_width = width;
- set_time_window(control_flow_data->mw, &time_window);
+ lttvwindow_report_time_window(control_flow_data->mw, &new_time_window);
}
- else if(ltt_time_compare(*current_time, time_end) == 1)
+ else if(ltt_time_compare(current_time, time_end) == 1)
{
- if(ltt_time_compare(*current_time, ltt_time_sub(trace_end, half_width)) == 1)
+ TimeWindow new_time_window;
+
+ if(ltt_time_compare(current_time, ltt_time_sub(trace_end, half_width)) == 1)
time_begin = ltt_time_sub(trace_end,width);
else
- time_begin = ltt_time_sub(*current_time,half_width);
+ time_begin = ltt_time_sub(current_time,half_width);
- time_window.start_time = time_begin;
- time_window.time_width = width;
+ new_time_window.start_time = time_begin;
+ new_time_window.time_width = width;
- set_time_window(control_flow_data->mw, &time_window);
+ lttvwindow_report_time_window(control_flow_data->mw, &new_time_window);
}
gtk_widget_queue_draw(control_flow_data->drawing->drawing_area);
typedef struct _EventViewerData {
MainWindow * mw;
- TimeWindow time_window;
- LttTime current_time;
+ //TimeWindow time_window;
+// LttTime current_time;
LttvHooks * before_event_hooks;
gboolean append; //prepend or append item
GQueue * raw_trace_data_queue_tmp; //tmp buf to contain raw data
unsigned current_event_index;
double previous_value; //value of the slide
- TimeInterval time_span;
+// TimeInterval time_span;
unsigned start_event_index; //the first event shown in the window
unsigned end_event_index; //the last event shown in the window
unsigned size; //maxi number of events loaded when instance the viewer
RawTraceData * data;
event_viewer_data->mw = parent_window;
- get_time_window(event_viewer_data->mw, &event_viewer_data->time_window);
- get_current_time(event_viewer_data->mw, &event_viewer_data->current_time);
event_viewer_data->before_event_hooks = lttv_hooks_new();
lttv_hooks_add(event_viewer_data->before_event_hooks, parse_event, event_viewer_data);
event_viewer_data->raw_trace_data_queue = g_queue_new();
event_viewer_data->raw_trace_data_queue_tmp = g_queue_new();
- reg_update_time_window(update_time_window,event_viewer_data, event_viewer_data->mw);
- reg_update_current_time(update_current_time,event_viewer_data, event_viewer_data->mw);
- reg_show_viewer(show_event_detail,event_viewer_data, event_viewer_data->mw);
- reg_update_traceset(traceset_changed,event_viewer_data, event_viewer_data->mw);
+ lttvwindow_register_time_window_notify(event_viewer_data->mw,
+ update_time_window, event_viewer_data);
+ lttvwindow_register_current_time_notify(event_viewer_data->mw,
+ update_current_time,event_viewer_data);
+ lttvwindow_register_show(event_viewer_data->mw,
+ show_event_detail,event_viewer_data);
+ lttvwindow_register_traceset_notify(event_viewer_data->mw,
+ traceset_changed,event_viewer_data);
event_viewer_data->scroll_win = gtk_scrolled_window_new (NULL, NULL);
- gtk_widget_show ( event_viewer_data->scroll_win);
- gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(event_viewer_data->scroll_win),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER);
+ gtk_widget_show (event_viewer_data->scroll_win);
+ gtk_scrolled_window_set_policy(
+ GTK_SCROLLED_WINDOW(event_viewer_data->scroll_win),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER);
/* TEST DATA, TO BE READ FROM THE TRACE */
event_viewer_data->currently_selected_event = FALSE ;
/* Create a model for storing the data list */
event_viewer_data->store_m = gtk_list_store_new (
- N_COLUMNS, /* Total number of columns */
- G_TYPE_INT, /* CPUID */
- G_TYPE_STRING, /* Event */
- G_TYPE_UINT64, /* Time */
- G_TYPE_INT, /* PID */
- G_TYPE_INT, /* Entry length */
- G_TYPE_STRING); /* Event's description */
+ N_COLUMNS, /* Total number of columns */
+ G_TYPE_INT, /* CPUID */
+ G_TYPE_STRING, /* Event */
+ G_TYPE_UINT64, /* Time */
+ G_TYPE_INT, /* PID */
+ G_TYPE_INT, /* Entry length */
+ G_TYPE_STRING); /* Event's description */
/* Create the viewer widget for the columned list */
- event_viewer_data->tree_v = gtk_tree_view_new_with_model (GTK_TREE_MODEL (event_viewer_data->store_m));
+ event_viewer_data->tree_v =
+ gtk_tree_view_new_with_model (GTK_TREE_MODEL (event_viewer_data->store_m));
g_signal_connect (G_OBJECT (event_viewer_data->tree_v), "size-allocate",
G_CALLBACK (tree_v_size_allocate_cb),
event_viewer_data->num_visible_events = 1;
//get the life span of the traceset and set the upper of the scroll bar
- get_traceset_time_span(event_viewer_data->mw, &event_viewer_data->time_span);
+ const TimeInterval *time_span =
+ lttvwindow_get_time_span(event_viewer_data->mw);
- start = ltt_time_sub(event_viewer_data->time_span.endTime, event_viewer_data->time_span.startTime);
- event_viewer_data->vadjust_c->upper = ltt_time_to_double(start) * NANOSECONDS_PER_SECOND;
+ start = ltt_time_sub(time_span->endTime, time_span->startTime);
+ event_viewer_data->vadjust_c->upper =
+ ltt_time_to_double(start) * NANOSECONDS_PER_SECOND;
event_viewer_data->append = TRUE;
g_object_set_data(
G_OBJECT(event_viewer_data->hbox_v),
TRACESET_TIME_SPAN,
- &event_viewer_data->time_span);
+ time_span);
*/
event_viewer_data->filter_key = g_strdup(key);
g_object_set_data(
{
event_viewer_data->selected_event = TRUE;
event_viewer_data->currently_selected_event =
- event_viewer_data->first_event + indices[0];
+ event_viewer_data->first_event + indices[0];
} else {
event_viewer_data->selected_event = FALSE;
-void tree_v_move_cursor_cb (GtkWidget *widget, GtkMovementStep arg1, gint arg2, gpointer data)
+void tree_v_move_cursor_cb (GtkWidget *widget,
+ GtkMovementStep arg1,
+ gint arg2,
+ gpointer data)
{
GtkTreePath *path; // = gtk_tree_path_new();
gint *indices;
gdouble value;
EventViewerData *event_viewer_data = (EventViewerData*)data;
- gtk_tree_view_get_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), &path, NULL);
+ gtk_tree_view_get_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v),
+ &path, NULL);
if(path == NULL)
- {
- /* No prior cursor, put it at beginning of page and let the execution do */
- path = gtk_tree_path_new_from_indices(0, -1);
- gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), path, NULL, FALSE);
- }
-
+ {
+ /* No prior cursor, put it at beginning of page
+ * and let the execution do */
+ path = gtk_tree_path_new_from_indices(0, -1);
+ gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v),
+ path, NULL, FALSE);
+ }
+
indices = gtk_tree_path_get_indices(path);
value = gtk_adjustment_get_value(event_viewer_data->vadjust_c);
if(arg1 == GTK_MOVEMENT_DISPLAY_LINES)
- {
- /* Move one line */
- if(arg2 == 1)
{
- /* move one line down */
- if(indices[0] == event_viewer_data->num_visible_events - 1)
+ /* Move one line */
+ if(arg2 == 1)
+ {
+ /* move one line down */
+ if(indices[0] == event_viewer_data->num_visible_events - 1)
{
if(value + event_viewer_data->num_visible_events <=
- event_viewer_data->number_of_events -1)
- {
- event_viewer_data->currently_selected_event += 1;
- // gtk_adjustment_set_value(event_viewer_data->vadjust_c, value+1);
- //gtk_tree_path_free(path);
- //path = gtk_tree_path_new_from_indices(event_viewer_data->num_visible_events-1, -1);
- //gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), path, NULL, FALSE);
- g_signal_stop_emission_by_name(G_OBJECT(widget), "move-cursor");
- }
+ event_viewer_data->number_of_events -1)
+ {
+ event_viewer_data->currently_selected_event += 1;
+ // gtk_adjustment_set_value(event_viewer_data->vadjust_c, value+1);
+ //gtk_tree_path_free(path);
+ //path = gtk_tree_path_new_from_indices(event_viewer_data->num_visible_events-1, -1);
+ //gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), path, NULL, FALSE);
+ g_signal_stop_emission_by_name(G_OBJECT(widget), "move-cursor");
+ }
}
- } else {
- /* Move one line up */
- if(indices[0] == 0)
+ } else {
+ /* Move one line up */
+ if(indices[0] == 0)
{
if(value - 1 >= 0 )
- {
- event_viewer_data->currently_selected_event -= 1;
- // gtk_adjustment_set_value(event_viewer_data->vadjust_c, value-1);
- //gtk_tree_path_free(path);
- //path = gtk_tree_path_new_from_indices(0, -1);
- //gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), path, NULL, FALSE);
- g_signal_stop_emission_by_name(G_OBJECT(widget), "move-cursor");
- }
-
+ {
+ event_viewer_data->currently_selected_event -= 1;
+ // gtk_adjustment_set_value(event_viewer_data->vadjust_c, value-1);
+ //gtk_tree_path_free(path);
+ //path = gtk_tree_path_new_from_indices(0, -1);
+ //gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), path, NULL, FALSE);
+ g_signal_stop_emission_by_name(G_OBJECT(widget), "move-cursor");
+ }
}
- }
-
}
+ }
if(arg1 == GTK_MOVEMENT_PAGES)
- {
- /* Move one page */
- if(arg2 == 1)
{
- if(event_viewer_data->num_visible_events == 1)
- value += 1 ;
- /* move one page down */
- if(value + event_viewer_data->num_visible_events-1 <=
- event_viewer_data->number_of_events )
+ /* Move one page */
+ if(arg2 == 1)
+ {
+ if(event_viewer_data->num_visible_events == 1)
+ value += 1 ;
+ /* move one page down */
+ if(value + event_viewer_data->num_visible_events-1 <=
+ event_viewer_data->number_of_events )
{
- event_viewer_data->currently_selected_event += event_viewer_data->num_visible_events-1;
+ event_viewer_data->currently_selected_event +=
+ event_viewer_data->num_visible_events-1;
// gtk_adjustment_set_value(event_viewer_data->vadjust_c,
// value+(event_viewer_data->num_visible_events-1));
//gtk_tree_path_free(path);
//gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), path, NULL, FALSE);
g_signal_stop_emission_by_name(G_OBJECT(widget), "move-cursor");
}
- } else {
- /* Move one page up */
- if(event_viewer_data->num_visible_events == 1)
- value -= 1 ;
+ } else {
+ /* Move one page up */
+ if(event_viewer_data->num_visible_events == 1)
+ value -= 1 ;
- if(indices[0] < event_viewer_data->num_visible_events - 2 )
+ if(indices[0] < event_viewer_data->num_visible_events - 2 )
{
if(value - (event_viewer_data->num_visible_events-1) >= 0)
- {
- event_viewer_data->currently_selected_event -= event_viewer_data->num_visible_events-1;
+ {
+ event_viewer_data->currently_selected_event -=
+ event_viewer_data->num_visible_events-1;
- // gtk_adjustment_set_value(event_viewer_data->vadjust_c,
- // value-(event_viewer_data->num_visible_events-1));
- //gtk_tree_path_free(path);
- //path = gtk_tree_path_new_from_indices(0, -1);
- //gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), path, NULL, FALSE);
- g_signal_stop_emission_by_name(G_OBJECT(widget), "move-cursor");
+ // gtk_adjustment_set_value(event_viewer_data->vadjust_c,
+ // value-(event_viewer_data->num_visible_events-1));
+ //gtk_tree_path_free(path);
+ //path = gtk_tree_path_new_from_indices(0, -1);
+ //gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), path, NULL, FALSE);
+ g_signal_stop_emission_by_name(G_OBJECT(widget), "move-cursor");
- } else {
- /* Go to first Event */
- event_viewer_data->currently_selected_event == 0 ;
- // gtk_adjustment_set_value(event_viewer_data->vadjust_c,
- // 0);
- //gtk_tree_path_free(path);
- //path = gtk_tree_path_new_from_indices(0, -1);
- //gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), path, NULL, FALSE);
- g_signal_stop_emission_by_name(G_OBJECT(widget), "move-cursor");
+ } else {
+ /* Go to first Event */
+ event_viewer_data->currently_selected_event == 0 ;
+ // gtk_adjustment_set_value(event_viewer_data->vadjust_c,
+ // 0);
+ //gtk_tree_path_free(path);
+ //path = gtk_tree_path_new_from_indices(0, -1);
+ //gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), path, NULL, FALSE);
+ g_signal_stop_emission_by_name(G_OBJECT(widget), "move-cursor");
- }
+ }
}
-
- }
-
}
+ }
if(arg1 == GTK_MOVEMENT_BUFFER_ENDS)
- {
- /* Move to the ends of the buffer */
- if(arg2 == 1)
{
- /* move end of buffer */
- event_viewer_data->currently_selected_event = event_viewer_data->number_of_events-1 ;
- // gtk_adjustment_set_value(event_viewer_data->vadjust_c,
- // event_viewer_data->number_of_events -
- // event_viewer_data->num_visible_events);
- //gtk_tree_path_free(path);
- //path = gtk_tree_path_new_from_indices(event_viewer_data->num_visible_events-1, -1);
- //gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), path, NULL, FALSE);
- g_signal_stop_emission_by_name(G_OBJECT(widget), "move-cursor");
- } else {
- /* Move beginning of buffer */
- event_viewer_data->currently_selected_event = 0 ;
- // gtk_adjustment_set_value(event_viewer_data->vadjust_c, 0);
+ /* Move to the ends of the buffer */
+ if(arg2 == 1)
+ {
+ /* move end of buffer */
+ event_viewer_data->currently_selected_event =
+ event_viewer_data->number_of_events-1 ;
+ // gtk_adjustment_set_value(event_viewer_data->vadjust_c,
+ // event_viewer_data->number_of_events -
+ // event_viewer_data->num_visible_events);
//gtk_tree_path_free(path);
- //path = gtk_tree_path_new_from_indices(0, -1);
+ //path = gtk_tree_path_new_from_indices(event_viewer_data->num_visible_events-1, -1);
//gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), path, NULL, FALSE);
- g_signal_stop_emission_by_name(G_OBJECT(widget), "move-cursor");
- }
-
+ g_signal_stop_emission_by_name(G_OBJECT(widget), "move-cursor");
+ } else {
+ /* Move beginning of buffer */
+ event_viewer_data->currently_selected_event = 0 ;
+ // gtk_adjustment_set_value(event_viewer_data->vadjust_c, 0);
+ //gtk_tree_path_free(path);
+ //path = gtk_tree_path_new_from_indices(0, -1);
+ //gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), path, NULL, FALSE);
+ g_signal_stop_emission_by_name(G_OBJECT(widget), "move-cursor");
}
-
+ }
gtk_tree_path_free(path);
}
void tree_v_cursor_changed_cb (GtkWidget *widget, gpointer data)
{
EventViewerData *event_viewer_data = (EventViewerData*) data;
+ const LttTime* current_time =
+ lttvwindow_get_current_time(event_viewer_data->mw);
LttTime ltt_time;
guint64 time;
GtkTreeIter iter;
ltt_time.tv_sec = time / NANOSECONDS_PER_SECOND;
ltt_time.tv_nsec = time % NANOSECONDS_PER_SECOND;
- if(ltt_time.tv_sec != event_viewer_data->current_time.tv_sec ||
- ltt_time.tv_nsec != event_viewer_data->current_time.tv_nsec){
+ if(ltt_time.tv_sec != current_time->tv_sec ||
+ ltt_time.tv_nsec != current_time->tv_nsec){
event_viewer_data->current_time_updated = TRUE;
- set_current_time(event_viewer_data->mw,<t_time);
+ lttvwindow_report_current_time(event_viewer_data->mw,<t_time);
}
}else{
g_warning("Can not get iter\n");
exact_num_visible = ( alloc->height -
TREE_VIEW_HEADER_HEIGHT (GTK_TREE_VIEW(event_viewer_data->tree_v)) )
- / (double)cell_height ;
+ / (double)cell_height ;
event_viewer_data->num_visible_events = ceil(exact_num_visible) ;
gboolean show_event_detail(void * hook_data, void * call_data)
{
EventViewerData *event_viewer_data = (EventViewerData*) hook_data;
- LttvTracesetContext * tsc = get_traceset_context(event_viewer_data->mw);
+ LttvTracesetContext * tsc = lttvwindow_get_traceset_context(event_viewer_data->mw);
if(event_viewer_data->raw_trace_data_queue_tmp->length == 0 &&
event_viewer_data->raw_trace_data_queue->length == 0){
GdkWindow * win;
GdkCursor * new;
GtkWidget* widget = gtk_widget_get_parent(event_viewer_data->hbox_v);
-
+ const TimeInterval *time_span =
+ lttvwindow_get_time_span(event_viewer_data->mw);
+
if(widget){
new = gdk_cursor_new(GDK_X_CURSOR);
win = gtk_widget_get_parent_window(widget);
end.tv_sec = G_MAXULONG;
end.tv_nsec = G_MAXULONG;
time = ltt_time_from_double(time_value / NANOSECONDS_PER_SECOND);
- start = ltt_time_add(event_viewer_data->time_span.startTime, time);
+ start = ltt_time_add(time_span->startTime, time);
event_viewer_data->previous_value = time_value;
get_events(event_viewer_data, start, end, RESERVE_SMALL_SIZE,&size);
if(size < list_height && size > 0){
if(first){
raw_data = (RawTraceData*)g_list_nth_data(first,event_number);
if(!raw_data) raw_data = (RawTraceData*)g_list_nth_data(first,0);
- time = ltt_time_sub(raw_data->time, event_viewer_data->time_span.startTime);
+ time = ltt_time_sub(raw_data->time, time_span->startTime);
event_viewer_data->vadjust_c->value = ltt_time_to_double(time) * NANOSECONDS_PER_SECOND;
g_signal_stop_emission_by_name(G_OBJECT(event_viewer_data->vadjust_c), "value-changed");
event_viewer_data->previous_value = event_viewer_data->vadjust_c->value;
g_queue_free(event_viewer_data->raw_trace_data_queue);
g_queue_free(event_viewer_data->raw_trace_data_queue_tmp);
- unreg_update_time_window(update_time_window,event_viewer_data, event_viewer_data->mw);
- unreg_update_current_time(update_current_time,event_viewer_data, event_viewer_data->mw);
- unreg_show_viewer(show_event_detail,event_viewer_data, event_viewer_data->mw);
- unreg_update_traceset(traceset_changed,event_viewer_data, event_viewer_data->mw);
+ lttvwindow_unregister_time_window_notify(event_viewer_data->mw,
+ update_time_window, event_viewer_data);
+ lttvwindow_unregister_current_time_notify(event_viewer_data->mw,
+ update_current_time, event_viewer_data);
+ lttvwindow_unregister_show(event_viewer_data->mw,
+ show_event_detail, event_viewer_data);
+ lttvwindow_unregister_traceset_notify(event_viewer_data->mw,
+ traceset_changed, event_viewer_data);
g_free(event_viewer_data->filter_key);
g_event_viewer_data_list = g_slist_remove(g_event_viewer_data_list, event_viewer_data);
gboolean update_time_window(void * hook_data, void * call_data)
{
EventViewerData *event_viewer_data = (EventViewerData*) hook_data;
- LttvTracesetContext * tsc = get_traceset_context(event_viewer_data->mw);
+ const TimeWindowNotifyData *time_window_notify_data;
+ LttvTracesetContext * tsc = lttvwindow_get_traceset_context(event_viewer_data->mw);
if(event_viewer_data->shown == FALSE){
- event_viewer_data->time_window = *(TimeWindow*)call_data;
+ //event_viewer_data->time_window = *(TimeWindow*)call_data;
add_context_hooks(event_viewer_data, tsc);
}
gboolean update_current_time(void * hook_data, void * call_data)
{
EventViewerData *event_viewer_data = (EventViewerData*) hook_data;
- event_viewer_data->current_time = *(LttTime*)call_data;
- guint64 nsec = event_viewer_data->current_time.tv_sec * NANOSECONDS_PER_SECOND
- + event_viewer_data->current_time.tv_nsec;
+ const LttTime * current_time = (LttTime*)call_data;
+ guint64 nsec = current_time->tv_sec * NANOSECONDS_PER_SECOND
+ + current_time->tv_nsec;
GtkTreeIter iter;
guint64 time;
int count = -1;
char str_path[64];
int i, j;
LttTime t;
+ const TimeInterval *time_span =
+ lttvwindow_get_time_span(event_viewer_data->mw);
if(!event_viewer_data->raw_trace_data_queue->head) return FALSE;
data1 = (RawTraceData*)g_list_nth_data(list,event_viewer_data->raw_trace_data_queue->length-1);
//the event is in the buffer
- if(ltt_time_compare(data->time, event_viewer_data->current_time)<=0 &&
- ltt_time_compare(data1->time, event_viewer_data->current_time)>=0){
+ if(ltt_time_compare(data->time, *current_time)<=0 &&
+ ltt_time_compare(data1->time, *current_time)>=0){
for(i=0;i<event_viewer_data->raw_trace_data_queue->length;i++){
data = (RawTraceData*)g_list_nth_data(list,i);
- if(ltt_time_compare(data->time, event_viewer_data->current_time) < 0){
+ if(ltt_time_compare(data->time, *current_time) < 0){
count++;
continue;
}
j = count;
count = 0;
}
- t = ltt_time_sub(data->time, event_viewer_data->time_span.startTime);
+ t = ltt_time_sub(data->time, time_span->startTime);
event_viewer_data->vadjust_c->value = ltt_time_to_double(t) * NANOSECONDS_PER_SECOND;
g_signal_stop_emission_by_name(G_OBJECT(event_viewer_data->vadjust_c), "value-changed");
event_viewer_data->previous_value = event_viewer_data->vadjust_c->value;
insert_data_into_model(event_viewer_data,j, j+event_viewer_data->num_visible_events);
}else{//the event is not in the buffer
- LttTime start = ltt_time_sub(event_viewer_data->current_time, event_viewer_data->time_span.startTime);
+ LttTime start = ltt_time_sub(*current_time, time_span->startTime);
double position = ltt_time_to_double(start) * NANOSECONDS_PER_SECOND;
gtk_adjustment_set_value(event_viewer_data->vadjust_c, position);
}
gboolean traceset_changed(void * hook_data, void * call_data)
{
EventViewerData *event_viewer_data = (EventViewerData*) hook_data;
+ const TimeInterval *time_span =
+ lttvwindow_get_time_span(event_viewer_data->mw);
LttTime start;
-
remove_all_items_from_queue(event_viewer_data->raw_trace_data_queue);
gtk_list_store_clear(event_viewer_data->store_m);
event_viewer_data->shown = FALSE;
event_viewer_data->append = TRUE;
- get_traceset_time_span(event_viewer_data->mw, &event_viewer_data->time_span);
- start = ltt_time_sub(event_viewer_data->time_span.endTime, event_viewer_data->time_span.startTime);
+ start = ltt_time_sub(time_span->endTime, time_span->startTime);
event_viewer_data->vadjust_c->upper = ltt_time_to_double(start) * NANOSECONDS_PER_SECOND;
// event_viewer_data->vadjust_c->value = 0;
void tree_v_grab_focus(GtkWidget *widget, gpointer data){
EventViewerData *event_viewer_data = (EventViewerData *)data;
MainWindow * mw = event_viewer_data->mw;
- set_focused_pane(mw, gtk_widget_get_parent(event_viewer_data->hbox_v));
+ lttvwindow_report_focus(mw, gtk_widget_get_parent(event_viewer_data->hbox_v));
}
void update_raw_data_array(EventViewerData* event_viewer_data, unsigned size)
LttTime end,unsigned max_num_events, unsigned * real_num_events)
{
int size;
- LttvTracesetContext * tsc = get_traceset_context(event_viewer_data->mw);
+ LttvTracesetContext * tsc = lttvwindow_get_traceset_context(event_viewer_data->mw);
add_context_hooks(event_viewer_data,tsc);
static void init() {
/* Register the toolbar insert button */
- toolbar_item_reg(hGuiEventsInsert_xpm, "Insert Event Viewer", h_gui_events);
+ lttvwindow_register_toolbar(hGuiEventsInsert_xpm, "Insert Event Viewer", h_gui_events);
/* Register the menu item insert entry */
- menu_item_reg("/", "Insert Event Viewer", h_gui_events);
+ lttvwindow_register_menu("/", "Insert Event Viewer", h_gui_events);
}
}
/* Unregister the toolbar insert button */
- toolbar_item_unreg(h_gui_events);
+ lttvwindow_unregister_toolbar(h_gui_events);
/* Unregister the menu item insert entry */
- menu_item_unreg(h_gui_events);
+ lttvwindow_unregister_menu(h_gui_events);
}
redraw_viewer(mw_data,&time_window);
set_current_time(mw_data,&(mw_data->current_tab->current_time));
if(time_interval){
- set_time_window(mw_data,&t);
+ lttvwindow_report_time_window(mw_data,&t);
}
}
}
GdkCursor * new;
GtkWidget* widget;
LttvTracesetContext *tsc =
- LTTV_TRACESET_CONTEXT(main_win->current_tab->traceset_info->
+ LTTV_TRACESET_CONTEXT(mw_data->current_tab->traceset_info->
traceset_context);
//set the cursor to be X shape, indicating that the computer is busy in doing its job
gdk_window_unstick(win);
//update time window of each viewer, let viewer insert hooks needed by process_traceset
- set_time_window(mw_data, time_window);
+ lttvwindow_report_time_window(mw_data, time_window);
max_nb_events = get_max_event_number(mw_data);
* main windows
*/
-void main_window_remove_menu_item(lttv_constructor constructor)
+void main_window_remove_menu_item(lttvwindow_viewer_constructor constructor)
{
int i;
LttvMenus * menu;
}
-void main_window_remove_toolbar_item(lttv_constructor constructor)
+void main_window_remove_toolbar_item(lttvwindow_viewer_constructor constructor)
{
int i;
LttvToolbars * toolbar;
if(ltt_time_compare(time,time_window.time_width) < 0){
time_window.time_width = time;
}
- set_time_window(multi_vpaned->mw, &time_window);
+ lttvwindow_report_time_window(multi_vpaned->mw, &time_window);
}
* Function to set/update traceset for the viewers
* @param main_win main window
* @param traceset traceset of the main window.
+ * return value :
+ * -1 : error
+ * 0 : traceset updated
+ * 1 : no traceset hooks to update; not an error.
*/
-void SetTraceset(MainWindow * main_win, gpointer traceset)
+int SetTraceset(MainWindow * main_win, gpointer traceset)
{
LttvHooks * tmp;
LttvAttributeValue value;
- g_assert(lttv_iattribute_find_by_path(main_win->attributes,
- "hooks/updatetraceset", LTTV_POINTER, &value));
+ if( lttv_iattribute_find_by_path(main_win->attributes,
+ "hooks/updatetraceset", LTTV_POINTER, &value) != 0)
+ return -1;
+
tmp = (LttvHooks*)*(value.v_pointer);
- if(tmp == NULL)return;
+ if(tmp == NULL) return 1;
+
lttv_hooks_call(tmp,traceset);
+
+ return 0;
}
* Function to set/update filter for the viewers
* @param main_win main window
* @param filter filter of the main window.
+ * return value :
+ * -1 : error
+ * 0 : filters updated
+ * 1 : no filter hooks to update; not an error.
*/
-void SetFilter(MainWindow * main_win, gpointer filter)
+int SetFilter(MainWindow * main_win, gpointer filter)
{
LttvHooks * tmp;
LttvAttributeValue value;
- g_assert(lttv_iattribute_find_by_path(main_win->attributes,
- "hooks/updatefilter", LTTV_POINTER, &value));
+ if(lttv_iattribute_find_by_path(main_win->attributes,
+ "hooks/updatefilter", LTTV_POINTER, &value) != 0)
+ return -1;
+
tmp = (LttvHooks*)*(value.v_pointer);
- if(tmp == NULL)return;
+ if(tmp == NULL) return 1;
lttv_hooks_call(tmp,filter);
+
+ return 0;
+}
+
+/**
+ * Function to redraw each viewer belonging to the current tab
+ * @param main_win the main window the viewer belongs to.
+ */
+
+void update_traceset(MainWindow * main_win)
+{
+ LttvAttributeValue value;
+ LttvHooks * tmp;
+ g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
+ "hooks/updatetraceset", LTTV_POINTER, &value));
+ tmp = (LttvHooks*)*(value.v_pointer);
+ if(tmp == NULL) return;
+ lttv_hooks_call(tmp, NULL);
+}
+
+
+
+/**
+ * Function to show each viewer in the current tab.
+ * It will be called by main window after it called process_traceset
+ * @param main_win the main window the viewer belongs to.
+ */
+
+void show_viewer(MainWindow *main_win)
+{
+ LttvAttributeValue value;
+ LttvHooks * tmp;
+ g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
+ "hooks/showviewer", LTTV_POINTER, &value));
+ tmp = (LttvHooks*)*(value.v_pointer);
+ if(tmp == NULL) return;
+ lttv_hooks_call(tmp, NULL);
}
+
/**
* API parts
*/
* @param view_constructor constructor of the viewer.
*/
-void lttvwindow_viewer_register_toolbar_item(char ** pixmap, char *tooltip, lttvwindow_viewer_constructor view_constructor)
+void lttvwindow_register_toolbar(char ** pixmap, char *tooltip, lttvwindow_viewer_constructor view_constructor)
{
LttvIAttribute *attributes_global = LTTV_IATTRIBUTE(lttv_global_attributes());
LttvToolbars * toolbar;
"viewers/toolbar", LTTV_POINTER, &value));
toolbar = (LttvToolbars*)*(value.v_pointer);
- if(toolbar == NULL){
+ if(toolbar == NULL){
toolbar = lttv_toolbars_new();
*(value.v_pointer) = toolbar;
}
* a reference to find out where the pixmap and tooltip are.
*/
-void lttvwindow_viewer_unregister_toolbar_item(lttvwindow_viewer_constructor view_constructor)
+void lttvwindow_unregister_toolbar(lttvwindow_viewer_constructor view_constructor)
{
LttvIAttribute *attributes_global = LTTV_IATTRIBUTE(lttv_global_attributes());
LttvToolbars * toolbar;
* @param view_constructor constructor of the viewer.
*/
-void menu_item_reg(char *menu_path, char *menu_text, lttvwindow_viewer_constructor view_constructor)
+void lttvwindow_register_menu(char *menu_path, char *menu_text, lttvwindow_viewer_constructor view_constructor)
{
LttvIAttribute *attributes_global = LTTV_IATTRIBUTE(lttv_global_attributes());
LttvMenus * menu;
* a reference to find out where the menu_path and menu_text are.
*/
-void menu_item_unreg(lttvwindow_viewer_constructor view_constructor)
+void lttvwindow_unregister_menu(lttvwindow_viewer_constructor view_constructor)
{
LttvIAttribute *attributes_global = LTTV_IATTRIBUTE(lttv_global_attributes());
LttvMenus * menu;
lttv_menus_remove(menu, view_constructor);
}
-
-/**
- * Update the status bar whenever something changed in the viewer.
- * @param main_win the main window the viewer belongs to.
- * @param info the message which will be shown in the status bar.
- */
-
-void update_status(MainWindow *main_win, char *info)
-{
-}
-
-
-/**
- * Function to get the current time interval shown on the current tab.
- * It will be called by a viewer's hook function to update the
- * shown time interval of the viewer and also be called by the constructor
- * of the viewer.
- * @param main_win the main window the viewer belongs to.
- * @param time_interval a pointer where time interval will be stored.
- */
-
-void get_time_window(MainWindow *main_win, TimeWindow *time_window)
-{
- //time_window->start_time = main_win->current_tab->time_window.start_time;
- //time_window->time_width = main_win->current_tab->time_window.time_width;
- *time_window = main_win->current_tab->time_window;
-}
-
-/**
- * Function to get the current time interval of the current traceset.
- * It will be called by a viewer's hook function to update the
- * time interval of the viewer and also be called by the constructor
- * of the viewer.
- * @param main_win the main window the viewer belongs to.
- * @param time_interval a pointer where time interval will be stored.
- */
-
-void get_traceset_time_span(MainWindow *main_win, TimeInterval *time_interval)
-{
- //time_window->start_time = main_win->current_tab->time_window.start_time;
- //time_window->time_width = main_win->current_tab->time_window.time_width;
- *time_interval = *(LTTV_TRACESET_CONTEXT(main_win->current_tab->traceset_info->
- traceset_context)->Time_Span);
-}
-
-
-
-/**
- * Function to set the time interval of the current tab.
- * It will be called by a viewer's signal handle associated with
- * the move_slider signal
- * @param main_win the main window the viewer belongs to.
- * @param time_interval a pointer where time interval is stored.
- */
-
-void set_time_window(MainWindow *main_win, TimeWindow *time_window)
-{
- LttvAttributeValue value;
- LttvHooks * tmp;
- main_win->current_tab->time_window = *time_window;
- gtk_multi_vpaned_set_scroll_value(main_win->current_tab->multi_vpaned,
- ltt_time_to_double(time_window->start_time)
- * NANOSECONDS_PER_SECOND );
- g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
- "hooks/updatetimewindow", LTTV_POINTER, &value));
- tmp = (LttvHooks*)*(value.v_pointer);
- if(tmp == NULL) return;
- lttv_hooks_call(tmp, time_window);
-}
-
-
-/**
- * Function to get the current time/event of the current tab.
- * It will be called by a viewer's hook function to update the
- * current time/event of the viewer.
- * @param main_win the main window the viewer belongs to.
- * @param time a pointer where time will be stored.
- */
-
-void get_current_time(MainWindow *main_win, LttTime *time)
-{
- time = &main_win->current_tab->current_time;
-}
-
-
-/**
- * Function to set the current time/event of the current tab.
- * It will be called by a viewer's signal handle associated with
- * the button-release-event signal
- * @param main_win the main window the viewer belongs to.
- * @param time a pointer where time is stored.
- */
-
-void set_current_time(MainWindow *main_win, LttTime *time)
-{
- LttvAttributeValue value;
- LttvHooks * tmp;
- main_win->current_tab->current_time = *time;
- g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
- "hooks/updatecurrenttime", LTTV_POINTER, &value));
- tmp = (LttvHooks*)*(value.v_pointer);
-
- if(tmp == NULL)return;
- lttv_hooks_call(tmp, time);
-}
-
-
-/**
- * Function to get the traceset from the current tab.
- * It will be called by the constructor of the viewer and also be
- * called by a hook funtion of the viewer to update its traceset.
- * @param main_win the main window the viewer belongs to.
- * @param traceset a pointer to a traceset.
- */
-/*
-void get_traceset(MainWindow *main_win, Traceset *traceset)
-{
-}
-*/
-
-/**
- * Function to get the filter of the current tab.
- * It will be called by the constructor of the viewer and also be
- * called by a hook funtion of the viewer to update its filter.
- * @param main_win, the main window the viewer belongs to.
- * @param filter, a pointer to a filter.
- */
-/*
-void get_filter(MainWindow *main_win, Filter *filter)
-{
-}
-*/
-
/**
* Function to register a hook function for a viewer to set/update its
* time interval.
- * It will be called by the constructor of the viewer.
* @param hook hook function of the viewer.
* @param hook_data hook data associated with the hook function.
* @param main_win the main window the viewer belongs to.
*/
-
-void reg_update_time_window(LttvHook hook, gpointer hook_data,
- MainWindow * main_win)
+void lttvwindow_register_time_window_notify(MainWindow * main_win,
+ LttvHook hook, gpointer hook_data)
{
LttvAttributeValue value;
LttvHooks * tmp;
/**
* Function to unregister a viewer's hook function which is used to
* set/update the time interval of the viewer.
- * It will be called by the destructor of the viewer.
* @param hook hook function of the viewer.
* @param hook_data hook data associated with the hook function.
* @param main_win the main window the viewer belongs to.
*/
-void unreg_update_time_window(LttvHook hook, gpointer hook_data,
- MainWindow * main_win)
+void lttvwindow_unregister_time_window_notify(MainWindow * main_win,
+ LttvHook hook, gpointer hook_data)
{
LttvAttributeValue value;
LttvHooks * tmp;
lttv_hooks_remove_data(tmp, hook, hook_data);
}
-
/**
* Function to register a hook function for a viewer to set/update its
* traceset.
- * It will be called by the constructor of the viewer.
* @param hook hook function of the viewer.
* @param hook_data hook data associated with the hook function.
* @param main_win the main window the viewer belongs to.
*/
-void reg_update_traceset(LttvHook hook, gpointer hook_data,
- MainWindow * main_win)
+void lttvwindow_register_traceset_notify(MainWindow * main_win,
+ LttvHook hook, gpointer hook_data)
{
LttvAttributeValue value;
LttvHooks * tmp;
/**
* Function to unregister a viewer's hook function which is used to
* set/update the traceset of the viewer.
- * It will be called by the destructor of the viewer.
* @param hook hook function of the viewer.
* @param hook_data hook data associated with the hook function.
* @param main_win the main window the viewer belongs to.
*/
-void unreg_update_traceset(LttvHook hook, gpointer hook_data,
- MainWindow * main_win)
+void lttvwindow_unregister_traceset_notify(MainWindow * main_win,
+ LttvHook hook, gpointer hook_data)
{
LttvAttributeValue value;
LttvHooks * tmp;
lttv_hooks_remove_data(tmp, hook, hook_data);
}
-
-/**
- * Function to redraw each viewer belonging to the current tab
- * @param main_win the main window the viewer belongs to.
- */
-
-void update_traceset(MainWindow * main_win)
-{
- LttvAttributeValue value;
- LttvHooks * tmp;
- g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
- "hooks/updatetraceset", LTTV_POINTER, &value));
- tmp = (LttvHooks*)*(value.v_pointer);
- if(tmp == NULL) return;
- lttv_hooks_call(tmp, NULL);
-}
-
-
/**
* Function to register a hook function for a viewer to set/update its
* filter.
- * It will be called by the constructor of the viewer.
* @param hook hook function of the viewer.
* @param hook_data hook data associated with the hook function.
* @param main_win the main window the viewer belongs to.
*/
-void reg_update_filter(LttvHook hook, gpointer hook_data,
- MainWindow *main_win)
+void lttvwindow_register_filter_notify(MainWindow *main_win,
+ LttvHook hook, gpointer hook_data)
{
LttvAttributeValue value;
LttvHooks * tmp;
/**
* Function to unregister a viewer's hook function which is used to
* set/update the filter of the viewer.
- * It will be called by the destructor of the viewer.
* @param hook hook function of the viewer.
* @param hook_data hook data associated with the hook function.
* @param main_win the main window the viewer belongs to.
*/
-void unreg_update_filter(LttvHook hook, gpointer hook_data,
- MainWindow * main_win)
+void lttvwindow_unregister_filter_notify(LttvHook hook, gpointer hook_data,
+ MainWindow * main_win)
{
LttvAttributeValue value;
LttvHooks * tmp;
/**
* Function to register a hook function for a viewer to set/update its
* current time.
- * It will be called by the constructor of the viewer.
* @param hook hook function of the viewer.
* @param hook_data hook data associated with the hook function.
* @param main_win the main window the viewer belongs to.
*/
-void reg_update_current_time(LttvHook hook, gpointer hook_data,
- MainWindow *main_win)
+void lttvwindow_register_current_time_notify(MainWindow *main_win,
+ LttvHook hook, gpointer hook_data)
{
LttvAttributeValue value;
LttvHooks * tmp;
/**
* Function to unregister a viewer's hook function which is used to
* set/update the current time of the viewer.
- * It will be called by the destructor of the viewer.
* @param hook hook function of the viewer.
* @param hook_data hook data associated with the hook function.
* @param main_win the main window the viewer belongs to.
*/
-void unreg_update_current_time(LttvHook hook, gpointer hook_data,
- MainWindow * main_win)
+void lttvwindow_unregister_current_time_notify(MainWindow * main_win,
+ LttvHook hook, gpointer hook_data)
{
LttvAttributeValue value;
LttvHooks * tmp;
/**
* Function to register a hook function for a viewer to show
- *the content of the viewer.
- * It will be called by the constructor of the viewer.
+ * the content of the viewer.
* @param hook hook function of the viewer.
* @param hook_data hook data associated with the hook function.
* @param main_win the main window the viewer belongs to.
*/
-void reg_show_viewer(LttvHook hook, gpointer hook_data,
- MainWindow *main_win)
+void lttvwindow_register_show(MainWindow *main_win,
+ LttvHook hook, gpointer hook_data)
{
LttvAttributeValue value;
LttvHooks * tmp;
/**
* Function to unregister a viewer's hook function which is used to
* show the content of the viewer..
- * It will be called by the destructor of the viewer.
* @param hook hook function of the viewer.
* @param hook_data hook data associated with the hook function.
* @param main_win the main window the viewer belongs to.
*/
-void unreg_show_viewer(LttvHook hook, gpointer hook_data,
- MainWindow * main_win)
+void lttvwindow_unregister_show(MainWindow * main_win,
+ LttvHook hook, gpointer hook_data)
{
LttvAttributeValue value;
LttvHooks * tmp;
lttv_hooks_remove_data(tmp, hook, hook_data);
}
-
-/**
- * Function to show each viewer in the current tab.
- * It will be called by main window after it called process_traceset
- * @param main_win the main window the viewer belongs to.
- */
-
-void show_viewer(MainWindow *main_win)
-{
- LttvAttributeValue value;
- LttvHooks * tmp;
- g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
- "hooks/showviewer", LTTV_POINTER, &value));
- tmp = (LttvHooks*)*(value.v_pointer);
- if(tmp == NULL) return;
- lttv_hooks_call(tmp, NULL);
-}
-
-
-/**
- * Function to set the focused pane (viewer).
- * It will be called by a viewer's signal handle associated with
- * the grab_focus signal
- * @param main_win the main window the viewer belongs to.
- * @param paned a pointer to a pane where the viewer is contained.
- */
-
-void set_focused_pane(MainWindow *main_win, gpointer paned)
-{
- gtk_multi_vpaned_set_focus((GtkWidget*)main_win->current_tab->multi_vpaned,paned);
-}
-
-
/**
* Function to register a hook function for a viewer to set/update the
* dividor of the hpane.
- * It will be called by the constructor of the viewer.
* @param hook hook function of the viewer.
* @param hook_data hook data associated with the hook function.
* @param main_win the main window the viewer belongs to.
*/
-void reg_update_dividor(LttvHook hook, gpointer hook_data,
- MainWindow *main_win)
+void lttvwindow_register_dividor(MainWindow *main_win,
+ LttvHook hook, gpointer hook_data)
{
LttvAttributeValue value;
LttvHooks * tmp;
* @param main_win the main window the viewer belongs to.
*/
-void unreg_update_dividor(LttvHook hook, gpointer hook_data,
- MainWindow *main_win)
+void lttvwindow_unregister_dividor(MainWindow *main_win,
+ LttvHook hook, gpointer hook_data)
{
LttvAttributeValue value;
LttvHooks * tmp;
}
+/**
+ * Update the status bar whenever something changed in the viewer.
+ * @param main_win the main window the viewer belongs to.
+ * @param info the message which will be shown in the status bar.
+ */
+
+void lttvwindow_report_status(MainWindow *main_win, char *info)
+{
+ //FIXME
+ g_warning("update_status not implemented in viewer.c");
+}
+
+/**
+ * Function to set the time interval of the current tab.
+ * It will be called by a viewer's signal handle associated with
+ * the move_slider signal
+ * @param main_win the main window the viewer belongs to.
+ * @param time_interval a pointer where time interval is stored.
+ */
+
+void lttvwindow_report_time_window(MainWindow *main_win,
+ TimeWindow *time_window)
+{
+ LttvAttributeValue value;
+ LttvHooks * tmp;
+
+ TimeWindowNotifyData time_window_notify_data;
+ TimeWindow old_time_window = main_win->current_tab->time_window;
+ time_window_notify_data.old_time_window = &old_time_window;
+ main_win->current_tab->time_window = *time_window;
+ time_window_notify_data.new_time_window =
+ &(main_win->current_tab->time_window);
+
+ gtk_multi_vpaned_set_scroll_value(main_win->current_tab->multi_vpaned,
+ ltt_time_to_double(time_window->start_time)
+ * NANOSECONDS_PER_SECOND );
+ g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
+ "hooks/updatetimewindow", LTTV_POINTER, &value));
+ tmp = (LttvHooks*)*(value.v_pointer);
+ if(tmp == NULL) return;
+ lttv_hooks_call(tmp, &time_window_notify_data);
+}
+
+/**
+ * Function to set the current time/event of the current tab.
+ * It will be called by a viewer's signal handle associated with
+ * the button-release-event signal
+ * @param main_win the main window the viewer belongs to.
+ * @param time a pointer where time is stored.
+ */
+
+void lttvwindow_report_current_time(MainWindow *main_win, LttTime *time)
+{
+ LttvAttributeValue value;
+ LttvHooks * tmp;
+ main_win->current_tab->current_time = *time;
+ g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes,
+ "hooks/updatecurrenttime", LTTV_POINTER, &value));
+ tmp = (LttvHooks*)*(value.v_pointer);
+
+ if(tmp == NULL)return;
+ lttv_hooks_call(tmp, time);
+}
+
/**
* Function to set the position of the hpane's dividor (viewer).
* It will be called by a viewer's signal handle associated with
* @param position position of the hpane's dividor.
*/
-void set_hpane_dividor(MainWindow *main_win, gint position)
+void lttvwindow_report_dividor(MainWindow *main_win, gint position)
{
LttvAttributeValue value;
LttvHooks * tmp;
lttv_hooks_call(tmp, &position);
}
+/**
+ * Function to set the focused pane (viewer).
+ * It will be called by a viewer's signal handle associated with
+ * the grab_focus signal
+ * @param main_win the main window the viewer belongs to.
+ * @param paned a pointer to a pane where the viewer is contained.
+ */
+
+void lttvwindow_report_focus(MainWindow *main_win, gpointer paned)
+{
+ gtk_multi_vpaned_set_focus((GtkWidget*)main_win->current_tab->multi_vpaned,paned);
+}
+
+
+
+/**
+ * Function to get the current time interval of the current traceset.
+ * It will be called by a viewer's hook function to update the
+ * time interval of the viewer and also be called by the constructor
+ * of the viewer.
+ * @param main_win the main window the viewer belongs to.
+ * @param time_interval a pointer where time interval will be stored.
+ */
+
+const TimeInterval *lttvwindow_get_time_span(MainWindow *main_win)
+{
+ //time_window->start_time = main_win->current_tab->time_window.start_time;
+ //time_window->time_width = main_win->current_tab->time_window.time_width;
+ return (LTTV_TRACESET_CONTEXT(main_win->current_tab->traceset_info->
+ traceset_context)->Time_Span);
+}
+
+
+
+/**
+ * Function to get the current time interval shown on the current tab.
+ * It will be called by a viewer's hook function to update the
+ * shown time interval of the viewer and also be called by the constructor
+ * of the viewer.
+ * @param main_win the main window the viewer belongs to.
+ * @param time_interval a pointer where time interval will be stored.
+ */
+
+const TimeWindow *lttvwindow_get_time_window(MainWindow *main_win)
+{
+ //time_window->start_time = main_win->current_tab->time_window.start_time;
+ //time_window->time_width = main_win->current_tab->time_window.time_width;
+ return &(main_win->current_tab->time_window);
+
+}
+
+
+/**
+ * Function to get the current time/event of the current tab.
+ * It will be called by a viewer's hook function to update the
+ * current time/event of the viewer.
+ * @param main_win the main window the viewer belongs to.
+ * @param time a pointer where time will be stored.
+ */
+
+const LttTime *lttvwindow_get_current_time(MainWindow *main_win)
+{
+ return &(main_win->current_tab->current_time);
+}
+
+
+/**
+ * Function to get the traceset from the current tab.
+ * It will be called by the constructor of the viewer and also be
+ * called by a hook funtion of the viewer to update its traceset.
+ * @param main_win the main window the viewer belongs to.
+ * @param traceset a pointer to a traceset.
+ */
+const LttvTraceset *lttvwindow_get_traceset(MainWindow *main_win)
+{
+ return main_win->current_tab->traceset_info->traceset;
+}
+
+/**
+ * Function to get the filter of the current tab.
+ * It will be called by the constructor of the viewer and also be
+ * called by a hook funtion of the viewer to update its filter.
+ * @param main_win, the main window the viewer belongs to.
+ * @param filter, a pointer to a filter.
+ */
+const lttv_filter *lttvwindow_get_filter(MainWindow *main_win)
+{
+ //FIXME
+ g_warning("lttvwindow_get_filter not implemented in viewer.c");
+}
+
+
/**
* Function to get the stats of the traceset
* @param main_win the main window the viewer belongs to.
*/
-LttvTracesetStats* get_traceset_stats(MainWindow *main_win)
+LttvTracesetStats* lttvwindow_get_traceset_stats(MainWindow *main_win)
{
return main_win->current_tab->traceset_info->traceset_context;
}
-LttvTracesetContext* get_traceset_context(MainWindow *main_win)
+LttvTracesetContext* lttvwindow_get_traceset_context(MainWindow *main_win)
{
return (LttvTracesetContext*)main_win->current_tab->traceset_info->traceset_context;
}
Things that a viewer can do:
update_status
-set_time_window
+lttvwindow_report_time_window
set_current_time
-update_traceset?
-update_filter?
-show_viewer?
+update_traceset -> not actually
+update_filter -> not actually
+show_viewer -> makes no sense.
set_focused_pane
set_hpane_dividor
*/
#include <lttv/hook.h>
#include <lttvwindow/common.h>
#include <lttv/stats.h>
-#include <lttv/filter.h>
+//FIXME (not ready yet) #include <lttv/filter.h>
/**
* Function to register a view constructor so that main window can generate
* @param view_constructor constructor of the viewer.
*/
-void lttvwindow_viewer_register_toolbar(char ** pixmap, char *tooltip, lttvwindow_viewer_constructor view_constructor);
+void lttvwindow_register_toolbar(char ** pixmap, char *tooltip, lttvwindow_viewer_constructor view_constructor);
/**
* a reference to find out where the pixmap and tooltip are.
*/
-void lttvwindow_viewer_unregister_toolbar(lttvwindow_viewer_constructor view_constructor);
+void lttvwindow_unregister_toolbar(lttvwindow_viewer_constructor view_constructor);
/**
* @param view_constructor constructor of the viewer.
*/
-void lttvwindow_viewer_register_menu(char *menu_path, char *menu_text, lttvwindow_viewer_constructor view_constructor);
+void lttvwindow_register_menu(char *menu_path, char *menu_text, lttvwindow_viewer_constructor view_constructor);
/**
* a reference to find out where the menu_path and menu_text are.
*/
-void lttvwindow_viewer_unregister_menu(lttvwindow_viewer_constructor view_constructor);
+void lttvwindow_unregister_menu(lttvwindow_viewer_constructor view_constructor);
/**
* @param main_win the main window the viewer belongs to.
*/
-void lttvwindow_viewer_register_time_window_notify(MainWindow * main_win,
+typedef struct _TimeWindowNotifyData {
+ TimeWindow *new_time_window;
+ TimeWindow *old_time_window;
+} TimeWindowNotifyData;
+
+void lttvwindow_register_time_window_notify(MainWindow * main_win,
LttvHook hook, gpointer hook_data);
* @param main_win the main window the viewer belongs to.
*/
-void lttvwindow_viewer_unregister_time_window_notify(MainWindow * main_win,
+void lttvwindow_unregister_time_window_notify(MainWindow * main_win,
LttvHook hook, gpointer hook_data);
* @param main_win the main window the viewer belongs to.
*/
-void lttvwindow_viewer_register_traceset_notify(MainWindow * main_win,
+void lttvwindow_register_traceset_notify(MainWindow * main_win,
LttvHook hook, gpointer hook_data);
* @param main_win the main window the viewer belongs to.
*/
-void lttvwindow_viewer_unregister_traceset_notify(MainWindow * main_win,
+void lttvwindow_unregister_traceset_notify(MainWindow * main_win,
LttvHook hook, gpointer hook_data);
* @param main_win the main window the viewer belongs to.
*/
-void lttvwindow_viewer_register_filter_notify(MainWindow *main_win,
+void lttvwindow_register_filter_notify(MainWindow *main_win,
LttvHook hook, gpointer hook_data);
* @param main_win the main window the viewer belongs to.
*/
-void lttvwindow_viewer_unregister_filter_notify(LttvHook hook, gpointer hook_data,
+void lttvwindow_unregister_filter_notify(LttvHook hook, gpointer hook_data,
MainWindow * main_win);
* @param main_win the main window the viewer belongs to.
*/
-void lttvwindow_viewer_register_current_time_notify(MainWindow *main_win,
+void lttvwindow_register_current_time_notify(MainWindow *main_win,
LttvHook hook, gpointer hook_data);
* @param main_win the main window the viewer belongs to.
*/
-void lttvwindow_viewer_unregister_current_time_notify(MainWindow * main_win,
+void lttvwindow_unregister_current_time_notify(MainWindow * main_win,
LttvHook hook, gpointer hook_data);
* @param main_win the main window the viewer belongs to.
*/
-void lttvwindow_viewer_register_show(MainWindow *main_win,
+void lttvwindow_register_show(MainWindow *main_win,
LttvHook hook, gpointer hook_data);
* @param main_win the main window the viewer belongs to.
*/
-void lttvwindow_viewer_unregister_show(MainWindow * main_win,
+void lttvwindow_unregister_show(MainWindow * main_win,
LttvHook hook, gpointer hook_data);
+/**
+ * Function to register a hook function for a viewer to set/update the
+ * dividor of the hpane. It provides a way to make the horizontal
+ * dividors of all the viewers linked together.
+ * @param hook hook function of the viewer.
+ * @param hook_data hook data associated with the hook function.
+ * @param main_win the main window the viewer belongs to.
+ */
+void lttvwindow_register_dividor(MainWindow *main_win,
+ LttvHook hook, gpointer hook_data);
+/**
+ * Function to unregister a viewer's hook function which is used to
+ * set/update hpane's dividor of the viewer.
+ * @param hook hook function of the viewer.
+ * @param hook_data hook data associated with the hook function.
+ * @param main_win the main window the viewer belongs to.
+ */
+
+void lttvwindow_unregister_dividor(MainWindow *main_win,
+ LttvHook hook, gpointer hook_data);
* @param info the message which will be shown in the status bar.
*/
-void lttvwindow_viewer_report_status(MainWindow *main_win, char *info);
+void lttvwindow_report_status(MainWindow *main_win, char *info);
/**
* @param time_interval a pointer where time interval is stored.
*/
-void lttvwindow_viewer_report_time_window(MainWindow *main_win, TimeWindow *time_window);
+void lttvwindow_report_time_window(MainWindow *main_win, TimeWindow *time_window);
/**
* Function to set the current time/event of the current tab.
* @param time a pointer where time is stored.
*/
-void lttvwindow_viewer_report_current_time(MainWindow *main_win, LttTime *time);
+void lttvwindow_report_current_time(MainWindow *main_win, LttTime *time);
/**
* @param position position of the hpane's dividor.
*/
-void lttvwindow_viewer_report_dividor(MainWindow *main_win, gint position);
-
-/**
- * Function to redraw each viewer belonging to the current tab, when a traceset
- * change has been made by the viewer.
- * @param main_win the main window the viewer belongs to.
- */
-// FIXME : should never be directly changed by a viewer.
-//void lttvwindow_viewer_report_traceset(MainWindow * main_win);
-
-
-/**
- * Function to show each viewer in the current tab.
- * It will be called by main window after it called process_traceset
- * @param main_win the main window the viewer belongs to.
- */
-//FIXME : not an API function, belongs to the main window.
-//void lttvwindow_viewer_report_show(MainWindow *main_win);
-
+void lttvwindow_report_dividor(MainWindow *main_win, gint position);
/**
* Function to set the focused pane (viewer).
* @param paned a pointer to a pane where the viewer is contained.
*/
//FIXME : can we do this through normal GTK signals ?
-//void set_focused_pane(MainWindow *main_win, gpointer paned);
-
-
-/**
- * Function to register a hook function for a viewer to set/update the
- * dividor of the hpane. It provides a way to make the horizontal
- * dividors of all the viewers linked together.
- * @param hook hook function of the viewer.
- * @param hook_data hook data associated with the hook function.
- * @param main_win the main window the viewer belongs to.
- */
-
-void lttvwindow_viewer_register_dividor(MainWindow *main_win,
- LttvHook hook, gpointer hook_data);
-
-
-/**
- * Function to unregister a viewer's hook function which is used to
- * set/update hpane's dividor of the viewer.
- * @param hook hook function of the viewer.
- * @param hook_data hook data associated with the hook function.
- * @param main_win the main window the viewer belongs to.
- */
-
-void lttvwindow_viewer_unregister_dividor(MainWindow *main_win,
- LttvHook hook, gpointer hook_data);
-
+void lttvwindow_report_focus(MainWindow *main_win, gpointer paned);
/**
* Function to get the life span of the traceset
* @param end end time of the traceset.
*/
-const TimeInterval *lttvwindow_viewer_get_time_span(MainWindow *main_win);
+const TimeInterval *lttvwindow_get_time_span(MainWindow *main_win);
/**
* Function to get the current time window of the current tab.
* @param time_interval a pointer where time interval will be stored.
*/
-const TimeWindow *lttvwindow_viewer_get_time_window(MainWindow *main_win);
+const TimeWindow *lttvwindow_get_time_window(MainWindow *main_win);
/**
* @param time a pointer where time will be stored.
*/
-const LttTime *lttvwindow_viewer_get_current_time(MainWindow *main_win);
+const LttTime *lttvwindow_get_current_time(MainWindow *main_win);
/**
* Function to get the traceset from the current tab.
* @param traceset a pointer to a traceset.
*/
-const LttvTraceset *lttvwindow_viewer_get_traceset(MainWindow *main_win);
+const LttvTraceset *lttvwindow_get_traceset(MainWindow *main_win);
/**
* @param filter, a pointer to a filter.
*/
-const lttv_filter *lttvwindow_viewer_get_filter(MainWindow *main_win);
+//FIXME
+typedef void lttv_filter;
+//FIXME
+const lttv_filter *lttvwindow_get_filter(MainWindow *main_win);
/**
* Function to get the stats of the traceset
+ * It must be non const so the viewer can modify it. //FIXME really ?
+ * @param main_win the main window the viewer belongs to.
+ */
+
+LttvTracesetStats* lttvwindow_get_traceset_stats(MainWindow *main_win);
+
+/**
+ * Function to get the context of the traceset
+ * It must be non const so the viewer can add and remove hooks from it.
* @param main_win the main window the viewer belongs to.
*/
-LttvTracesetStats* lttvwindow_viewer_get_traceset_stats(MainWindow *main_win);
-LttvTracesetContext* lttvwindow_viewer_get_traceset_context(MainWindow *main_win);
+LttvTracesetContext* lttvwindow_get_traceset_context(MainWindow *main_win);
gboolean calculate_stats;
int size;
- TimeInterval time_span;
+ //TimeInterval time_span;
gboolean shown; //indicate if the statistic is shown or not
char * filter_key;
gui_statistic_free(StatisticViewerData *statistic_viewer_data)
{
if(statistic_viewer_data){
- unreg_update_time_window(statistic_update_time_window,statistic_viewer_data, statistic_viewer_data->mw);
- unreg_show_viewer(statistic_show_viewer,statistic_viewer_data, statistic_viewer_data->mw);
- unreg_update_traceset(statistic_traceset_changed,statistic_viewer_data, statistic_viewer_data->mw);
+ lttvwindow_unregister_time_window_notify(statistic_viewer_data->mw,
+ statistic_update_time_window,statistic_viewer_data);
+ lttvwindow_unregister_show(statistic_viewer_data->mw,
+ statistic_show_viewer,statistic_viewer_data);
+ lttvwindow_unregister_traceset_notify(statistic_viewer_data->mw,
+ statistic_traceset_changed,statistic_viewer_data);
g_hash_table_destroy(statistic_viewer_data->statistic_hash);
g_free(statistic_viewer_data->filter_key);
StatisticViewerData* statistic_viewer_data = g_new(StatisticViewerData,1);
statistic_viewer_data->mw = parent_window;
- statistic_viewer_data->stats = get_traceset_stats(statistic_viewer_data->mw);
+ statistic_viewer_data->stats =
+ lttvwindow_get_traceset_stats(statistic_viewer_data->mw);
statistic_viewer_data->calculate_stats = statistic_insert_traceset_stats((void *)statistic_viewer_data->stats);
- reg_update_time_window(statistic_update_time_window,statistic_viewer_data, statistic_viewer_data->mw);
- reg_show_viewer(statistic_show_viewer,statistic_viewer_data, statistic_viewer_data->mw);
- reg_update_traceset(statistic_traceset_changed,statistic_viewer_data, statistic_viewer_data->mw);
+ lttvwindow_register_time_window_notify(statistic_viewer_data->mw,
+ statistic_update_time_window,statistic_viewer_data);
+ lttvwindow_register_show(statistic_viewer_data->mw,
+ statistic_show_viewer,statistic_viewer_data);
+ lttvwindow_register_traceset_notify(statistic_viewer_data->mw,
+ statistic_traceset_changed,statistic_viewer_data);
- statistic_viewer_data->statistic_hash = g_hash_table_new_full(g_str_hash, g_str_equal,
- statistic_destroy_hash_key,
- statistic_destroy_hash_data);
+ statistic_viewer_data->statistic_hash = g_hash_table_new_full(g_str_hash,
+ g_str_equal,
+ statistic_destroy_hash_key,
+ statistic_destroy_hash_data);
statistic_viewer_data->hpaned_v = gtk_hpaned_new();
statistic_viewer_data->store_m = gtk_tree_store_new (N_COLUMNS, G_TYPE_STRING);
- statistic_viewer_data->tree_v = gtk_tree_view_new_with_model (GTK_TREE_MODEL (statistic_viewer_data->store_m));
+ statistic_viewer_data->tree_v =
+ gtk_tree_view_new_with_model (
+ GTK_TREE_MODEL (statistic_viewer_data->store_m));
g_object_unref (G_OBJECT (statistic_viewer_data->store_m));
g_signal_connect (G_OBJECT (statistic_viewer_data->tree_v), "grab-focus",
gtk_widget_show(statistic_viewer_data->text_v);
gtk_widget_show(statistic_viewer_data->hpaned_v);
- //get the life span of the traceset and set the upper of the scroll bar
- get_traceset_time_span(statistic_viewer_data->mw, &statistic_viewer_data->time_span);
-
statistic_viewer_data->shown = FALSE;
statistic_viewer_data->filter_key = g_strdup(key);
g_object_set_data(
G_OBJECT(statistic_viewer_data->hpaned_v),
statistic_viewer_data->filter_key,
s);
-
+ /*
g_object_set_data(
G_OBJECT(statistic_viewer_data->hpaned_v),
TRACESET_TIME_SPAN,
&statistic_viewer_data->time_span);
-
+ */
+
if(statistic_viewer_data->calculate_stats){
//if(lttv_stats_load_statistics(statistic_viewer_data->stats))
// statistic_viewer_data->calculate_stats = FALSE;
{
StatisticViewerData *statistic_viewer_data = (StatisticViewerData *)data;
MainWindow * mw = statistic_viewer_data->mw;
- set_focused_pane(mw, gtk_widget_get_parent(statistic_viewer_data->hpaned_v));
+ lttvwindow_report_focus(mw, gtk_widget_get_parent(statistic_viewer_data->hpaned_v));
}
static void
gboolean statistic_update_time_window(void * hook_data, void * call_data)
{
StatisticViewerData *statistic_viewer_data = (StatisticViewerData*) hook_data;
- LttvTracesetContext * tsc = get_traceset_context(statistic_viewer_data->mw);
+ LttvTracesetContext * tsc =
+ lttvwindow_get_traceset_context(statistic_viewer_data->mw);
//if statistic is already calculated, do nothing
if(!statistic_viewer_data->calculate_stats){
gboolean statistic_show_viewer(void * hook_data, void * call_data)
{
StatisticViewerData *statistic_viewer_data = (StatisticViewerData*) hook_data;
- LttvTracesetContext * tsc = get_traceset_context(statistic_viewer_data->mw);
+ LttvTracesetContext * tsc =
+ lttvwindow_get_traceset_context(statistic_viewer_data->mw);
if(statistic_viewer_data->shown == FALSE){
statistic_viewer_data->shown = TRUE;
}
}
- lttv_stats_add_event_hooks(tsc);
+ lttv_stats_add_event_hooks(LTTV_TRACESET_STATS(tsc));
}
}
}
- lttv_stats_remove_event_hooks(tsc);
+ lttv_stats_remove_event_hooks(LTTV_TRACESET_STATS(tsc));
}
statistic_traceset = g_ptr_array_new ();
/* Register the toolbar insert button */
- toolbar_item_reg(hGuiStatisticInsert_xpm, "Insert Statistic Viewer", h_gui_statistic);
+ lttvwindow_register_toolbar(hGuiStatisticInsert_xpm, "Insert Statistic Viewer", h_gui_statistic);
/* Register the menu item insert entry */
- menu_item_reg("/", "Insert Statistic Viewer", h_gui_statistic);
+ lttvwindow_register_menu("/", "Insert Statistic Viewer", h_gui_statistic);
}
g_ptr_array_free (statistic_traceset, TRUE);
/* Unregister the toolbar insert button */
- toolbar_item_unreg(h_gui_statistic);
+ lttvwindow_unregister_toolbar(h_gui_statistic);
/* Unregister the menu item insert entry */
- menu_item_unreg(h_gui_statistic);
+ lttvwindow_unregister_menu(h_gui_statistic);
}