AC_PREREQ(2.57)
AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)
#AC_WITH_LTDL # not needed ?
-AM_INIT_AUTOMAKE(LinuxTraceToolkitViewer,0.8.62-03102006)
+AM_INIT_AUTOMAKE(LinuxTraceToolkitViewer,0.8.63-10102006)
AM_CONFIG_HEADER(config.h)
AM_PROG_LIBTOOL
g_message("Running test 9 : seek_forward and seek_backward");
lttv_process_traceset_seek_time(tsc, ltt_time_zero);
- count = lttv_process_traceset_seek_n_forward(tsc, 500, NULL, NULL, NULL);
+ count = lttv_process_traceset_seek_n_forward(tsc, 500, NULL, NULL, NULL, NULL, NULL);
g_assert(count == 500);
lttv_traceset_context_position_save(tsc, saved_pos);
t0 = get_time();
- count = lttv_process_traceset_seek_n_forward(tsc, 150000, NULL, NULL, NULL);
+ count = lttv_process_traceset_seek_n_forward(tsc, 150000, NULL, NULL, NULL, NULL, NULL);
t1 = get_time();
g_message("Seek forward 150000 events in %g seconds", t1 - t0);
g_assert(count == 150000);
t0 = get_time();
count = lttv_process_traceset_seek_n_backward(tsc, 150000,
seek_back_default_offset, lttv_process_traceset_seek_time, NULL,
- NULL, NULL);
+ NULL, NULL, NULL, NULL);
t1 = get_time();
g_message("Seek backward 150000 events in %g seconds", t1 - t0);
g_assert(count == 150000);
g_warning("Problem with seek_n ! Positions differ. (1)");
}
- lttv_process_traceset_seek_n_forward(tsc, 500, NULL, NULL, NULL);
+ lttv_process_traceset_seek_n_forward(tsc, 500, NULL, NULL, NULL, NULL, NULL);
lttv_traceset_context_position_save(tsc, saved_pos);
- lttv_process_traceset_seek_n_forward(tsc, 15000, NULL, NULL, NULL);
+ lttv_process_traceset_seek_n_forward(tsc, 15000, NULL, NULL, NULL, NULL, NULL);
lttv_process_traceset_seek_n_backward(tsc, 15005,
seek_back_default_offset, lttv_process_traceset_seek_time, NULL,
- NULL, NULL);
- lttv_process_traceset_seek_n_forward(tsc, 5, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL);
+ lttv_process_traceset_seek_n_forward(tsc, 5, NULL, NULL, NULL, NULL, NULL);
if(lttv_traceset_context_ctx_pos_compare(tsc, saved_pos)) {
g_warning("Problem with seek_n ! Positions differ. (2)");
}
lttv_process_traceset_seek_time(tsc, ltt_time_infinite);
- count = lttv_process_traceset_seek_n_forward(tsc, 15000, NULL, NULL, NULL);
+ count = lttv_process_traceset_seek_n_forward(tsc, 15000, NULL, NULL, NULL, NULL, NULL);
if(count > 0)
g_warning("Problem with seek_n ! Forward at end of traceset.");
t0 = get_time();
lttv_process_traceset_seek_n_backward(tsc, 300,
seek_back_default_offset, lttv_process_traceset_seek_time, NULL,
- NULL, NULL);
+ NULL, NULL, NULL, NULL);
t1 = get_time();
g_message("Seek backward 300 events in %g seconds", t1 - t0);
- count = lttv_process_traceset_seek_n_forward(tsc, 299, NULL, NULL, NULL);
- count = lttv_process_traceset_seek_n_forward(tsc, 1, NULL, NULL, NULL);
+ count = lttv_process_traceset_seek_n_forward(tsc, 299, NULL, NULL, NULL, NULL, NULL);
+ count = lttv_process_traceset_seek_n_forward(tsc, 1, NULL, NULL, NULL, NULL, NULL);
if(lttv_traceset_context_ctx_pos_compare(tsc, saved_pos)) {
g_warning("Problem with seek_n ! Positions differ. (4)");
t0 = get_time();
lttv_process_traceset_seek_n_backward(tsc, 10,
seek_back_default_offset, lttv_process_traceset_seek_time, NULL,
- NULL, NULL);
+ NULL, NULL, NULL, NULL);
t1 = get_time();
g_message("Seek backward 10 events in %g seconds", t1 - t0);
t0 = get_time();
- count = lttv_process_traceset_seek_n_forward(tsc, 10, NULL, NULL, NULL);
+ count = lttv_process_traceset_seek_n_forward(tsc, 10, NULL, NULL, NULL, NULL, NULL);
t1 = get_time();
g_message("Seek forward 10 events in %g seconds", t1 - t0);
lttv_traceset_context_position_save(tsc, saved_pos);
lttv_process_traceset_seek_n_backward(tsc, 301,
seek_back_default_offset, lttv_process_traceset_seek_time, NULL,
- NULL, NULL);
- count = lttv_process_traceset_seek_n_forward(tsc, 299, NULL, NULL, NULL);
- count = lttv_process_traceset_seek_n_forward(tsc, 1, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL);
+ count = lttv_process_traceset_seek_n_forward(tsc, 299, NULL, NULL, NULL, NULL, NULL);
+ count = lttv_process_traceset_seek_n_forward(tsc, 1, NULL, NULL, NULL, NULL, NULL);
if(lttv_traceset_context_ctx_pos_compare(tsc, saved_pos) == 0) {
g_warning("Problem with seek_n ! Positions _should_ differ. (5)");
/* Try a seek by closest time : Hint : try this one with and without states
* computed. */
lttv_process_traceset_seek_time(tsc, ltt_time_zero);
- count = lttv_process_traceset_seek_n_forward(tsc, 200000, NULL, NULL, NULL);
+ count = lttv_process_traceset_seek_n_forward(tsc, 200000, NULL, NULL, NULL, NULL, NULL);
lttv_traceset_context_position_save(tsc, saved_pos);
t0 = get_time();
lttv_process_traceset_seek_n_backward(tsc, 100301,
seek_back_default_offset,
(seek_time_fct)lttv_state_traceset_seek_time_closest, NULL,
- NULL, NULL);
+ NULL, NULL, NULL, NULL);
t1 = get_time();
g_message("Seek backward 100301 events (with seek closest) in %g seconds",
t1 - t0);
- count = lttv_process_traceset_seek_n_forward(tsc, 100301, NULL, NULL, NULL);
+ count = lttv_process_traceset_seek_n_forward(tsc, 100301, NULL, NULL, NULL, NULL, NULL);
if(lttv_traceset_context_ctx_pos_compare(tsc, saved_pos)) {
g_warning("Problem with seek_n with state seek time! Positions differ. (6)");
lttv_traceset_context_position_new(tsc);
lttv_process_traceset_seek_time(tsc, ltt_time_zero);
- lttv_process_traceset_seek_n_forward(tsc, 200000, NULL, NULL, NULL);
+ lttv_process_traceset_seek_n_forward(tsc, 200000, NULL, NULL, NULL, NULL, NULL);
lttv_traceset_context_position_save(tsc, saved_pos);
if(lttv_traceset_context_ctx_pos_compare(tsc, saved_pos) != 0)
g_critical("Error in seek position. (1)");
lttv_process_traceset_seek_time(tsc, ltt_time_infinite);
lttv_process_traceset_seek_n_backward(tsc, 500,
seek_back_default_offset, lttv_process_traceset_seek_time, NULL,
- NULL, NULL);
+ NULL, NULL, NULL, NULL);
lttv_traceset_context_position_save(tsc, saved_pos);
if(lttv_traceset_context_ctx_pos_compare(tsc, saved_pos) != 0)
guint events_found;
guint n; /* number of events requested */
GPtrArray *array; /* array of LttvTracesetContextPositions pointers */
- LttvFilter *filter;
+ LttvFilter *filter1;
+ LttvFilter *filter2;
+ LttvFilter *filter3;
check_handler *check;
gboolean *stop_flag;
guint raw_event_count;
if(sd->check && sd->check(sd->raw_event_count, sd->stop_flag)) return TRUE;
sd->raw_event_count++;
- if(sd->filter != NULL && sd->filter->head != NULL) {
- if(!lttv_filter_tree_parse(sd->filter->head,
+ if(sd->filter1 != NULL && sd->filter1->head != NULL &&
+ !lttv_filter_tree_parse(sd->filter1->head,
ltt_tracefile_get_event(tfc->tf),
tfc->tf,
tfc->t_context->t,
- tfc))
- return FALSE;
+ tfc)) {
+ return FALSE;
}
-
+ if(sd->filter2 != NULL && sd->filter2->head != NULL &&
+ !lttv_filter_tree_parse(sd->filter2->head,
+ ltt_tracefile_get_event(tfc->tf),
+ tfc->tf,
+ tfc->t_context->t,
+ tfc)) {
+ return FALSE;
+ }
+ if(sd->filter3 != NULL && sd->filter3->head != NULL &&
+ !lttv_filter_tree_parse(sd->filter3->head,
+ ltt_tracefile_get_event(tfc->tf),
+ tfc->tf,
+ tfc->t_context->t,
+ tfc)) {
+ return FALSE;
+ }
+
pos = (LttvTracesetContextPosition*)g_ptr_array_index (sd->array,
sd->first_event);
guint lttv_process_traceset_seek_n_backward(LttvTracesetContext *self,
guint n, LttTime first_offset,
seek_time_fct time_seeker,
- LttvFilter *filter,
check_handler *check,
- gboolean *stop_flag)
+ gboolean *stop_flag,
+ LttvFilter *filter1,
+ LttvFilter *filter2,
+ LttvFilter *filter3)
{
if(lttv_traceset_number(self->ts) == 0) return 0;
g_assert(ltt_time_compare(first_offset, ltt_time_zero) != 0);
sd.first_event = 0;
sd.events_found = 0;
sd.array = g_ptr_array_sized_new(n);
- sd.filter = filter;
+ sd.filter1 = filter1;
+ sd.filter2 = filter2;
+ sd.filter3 = filter3;
sd.n = n;
sd.check = check;
sd.stop_flag = stop_flag;
struct seek_forward_data {
guint event_count; /* event counter */
guint n; /* requested number of events to jump over */
- LttvFilter *filter;
+ LttvFilter *filter1;
+ LttvFilter *filter2;
+ LttvFilter *filter3;
check_handler *check;
gboolean *stop_flag;
guint raw_event_count; /* event counter */
if(sd->check && sd->check(sd->raw_event_count, sd->stop_flag)) return TRUE;
sd->raw_event_count++;
- if(sd->filter == NULL || lttv_filter_tree_parse(sd->filter->head,
+ if(sd->filter1 != NULL && sd->filter1->head != NULL &&
+ !lttv_filter_tree_parse(sd->filter1->head,
ltt_tracefile_get_event(tfc->tf),
tfc->tf,
tfc->t_context->t,
tfc)) {
- sd->event_count++;
- if(sd->event_count >= sd->n)
- return TRUE;
+ return FALSE;
}
- return FALSE;
+ if(sd->filter2 != NULL && sd->filter2->head != NULL &&
+ !lttv_filter_tree_parse(sd->filter2->head,
+ ltt_tracefile_get_event(tfc->tf),
+ tfc->tf,
+ tfc->t_context->t,
+ tfc)) {
+ return FALSE;
+ }
+ if(sd->filter3 != NULL && sd->filter3->head != NULL &&
+ !lttv_filter_tree_parse(sd->filter3->head,
+ ltt_tracefile_get_event(tfc->tf),
+ tfc->tf,
+ tfc->t_context->t,
+ tfc)) {
+ return FALSE;
+ }
+
+ sd->event_count++;
+ if(sd->event_count >= sd->n)
+ return TRUE;
}
/* Seek back n events forward from the current position (1 to n)
* returns : the number of events jumped over (may be less than requested if end
* of traceset reached) */
guint lttv_process_traceset_seek_n_forward(LttvTracesetContext *self,
- guint n, LttvFilter *filter,
+ guint n,
check_handler *check,
- gboolean *stop_flag)
+ gboolean *stop_flag,
+ LttvFilter *filter1,
+ LttvFilter *filter2,
+ LttvFilter *filter3)
{
struct seek_forward_data sd;
sd.event_count = 0;
sd.n = n;
- sd.filter = filter;
+ sd.filter1 = filter1;
+ sd.filter2 = filter2;
+ sd.filter3 = filter3;
sd.check = check;
sd.stop_flag = stop_flag;
sd.raw_event_count = 0;
guint lttv_process_traceset_seek_n_forward(LttvTracesetContext *self,
guint n,
- LttvFilter *filter,
check_handler *check,
- gboolean *stop_flag);
+ gboolean *stop_flag,
+ LttvFilter *filter1,
+ LttvFilter *filter2,
+ LttvFilter *filter3);
typedef void (*seek_time_fct)(LttvTracesetContext *self, LttTime start);
/* If first_offset is ltt_time_zero, it will choose a default value */
guint n,
LttTime first_offset,
seek_time_fct,
- LttvFilter *filter,
check_handler *check,
- gboolean *stop_flag);
+ gboolean *stop_flag,
+ LttvFilter *filter1,
+ LttvFilter *filter2,
+ LttvFilter *filter3);
#endif // PROCESSTRACE_H
lib_LTLIBRARIES = libguievents.la
libguievents_la_LDFLAGS = -module
-libguievents_la_SOURCES = events.c
+libguievents_la_SOURCES = events.c lttv_plugin_evd.c
+
+noinst_HEADERS = lttv_plugin_evd.h events.h
EXTRA_DIST = \
hGuiEventsInsert.xpm
#include <lttvwindow/lttvwindow.h>
#include <lttvwindow/lttvwindowtraces.h>
#include <lttvwindow/lttv_plugin_tab.h>
+#include <lttvwindow/support.h>
+#include "lttv_plugin_evd.h"
+#include "events.h"
#include "hGuiEventsInsert.xpm"
#define g_info(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format)
SCROLL_NONE
} ScrollDirection;
-typedef struct _EventViewerData {
-
- Tab * tab;
- LttvPluginTab *ptab;
- LttvHooks * event_hooks;
-
- /* previous value is used to determine if it is a page up/down or
- * step up/down, in which case we move of a certain amount of events (one or
- * the number of events shown on the screen) instead of changing begin time.
- */
- double previous_value;
-
- //scroll window containing Tree View
- GtkWidget * scroll_win;
-
- /* Model containing list data */
- GtkListStore *store_m;
-
- GPtrArray *pos; /* Array of LttvTracesetContextPosition * */
-
- GtkWidget *top_widget;
- GtkWidget *hbox_v;
- /* Widget to display the data in a columned list */
- GtkWidget *tree_v;
- GtkAdjustment *vtree_adjust_c ;
- GtkWidget *button; /* a button of the header, used to get the header_height */
- gint header_height;
-
- /* Vertical scrollbar and its adjustment */
- GtkWidget *vscroll_vc;
- GtkAdjustment *vadjust_c;
-
- /* Selection handler */
- GtkTreeSelection *select_c;
-
- gint num_visible_events;
-
- LttvTracesetContextPosition *currently_selected_position;
- gboolean update_cursor; /* Speed optimisation : do not update cursor when
- unnecessary */
- gboolean report_position; /* do not report position when in current_time
- update */
-
- LttvTracesetContextPosition *first_event; /* Time of the first event shown */
- LttvTracesetContextPosition *last_event; /* Time of the first event shown */
-
- LttvTracesetContextPosition *current_time_get_first;
-
- LttvFilter *main_win_filter;
-
- gint background_info_waiting;
-
- guint32 last_tree_update_time; /* To filter out repeat keys */
-
- guint num_events; /* Number of events processed */
-
-} EventViewerData ;
-
/** hook functions for update time interval, current time ... */
gboolean update_current_time(void * hook_data, void * call_data);
gboolean update_current_position(void * hook_data, void * call_data);
//! Event Viewer's constructor
EventViewerData *gui_events(LttvPluginTab *ptab);
//! Event Viewer's destructor
-void gui_events_destructor(EventViewerData *event_viewer_data);
-void gui_events_free(EventViewerData *event_viewer_data);
+void gui_events_destructor(gpointer data);
+void gui_events_free(gpointer data);
static gboolean
header_size_allocate(GtkWidget *widget,
static void tree_v_cursor_changed_cb (GtkWidget *widget, gpointer data);
static void tree_v_move_cursor_cb (GtkWidget *widget, GtkMovementStep arg1,
gint arg2, gpointer data);
+static void filter_button (GtkToolButton *toolbutton,
+ gpointer user_data);
static gboolean tree_v_scroll_handler (GtkWidget *widget, GdkEventScroll *event, gpointer data);
static gboolean key_handler(GtkWidget *widget, GdkEventKey *event,
gpointer user_data);
-static gint redraw_notify(void *hook_data, void *call_data);
-
static void get_events(double time, EventViewerData *event_viewer_data);
int event_hook(void *hook_data, void *call_data);
LttTime end;
GtkTreeViewColumn *column;
GtkCellRenderer *renderer;
- EventViewerData* event_viewer_data = g_new(EventViewerData,1) ;
+ EventViewerData* event_viewer_data = g_new(EventViewerData,1);
+ LttvPluginEVD *plugin_evd = g_object_new(LTTV_TYPE_PLUGIN_EVD, NULL);
+ plugin_evd->evd = event_viewer_data;
Tab *tab = ptab->tab;
event_viewer_data->tab = tab;
event_viewer_data->ptab = ptab;
+ GtkWidget *tmp_toolbar_icon;
LttvTracesetContext * tsc =
lttvwindow_get_traceset_context(event_viewer_data->tab);
lttvwindow_register_filter_notify(tab,
filter_changed, event_viewer_data);
lttvwindow_register_redraw_notify(tab,
- redraw_notify, event_viewer_data);
+ evd_redraw_notify, event_viewer_data);
event_viewer_data->scroll_win = gtk_scrolled_window_new (NULL, NULL);
G_CALLBACK(tree_v_scroll_handler),
event_viewer_data);
+
+
// Use on each column!
//gtk_tree_view_column_set_sizing(event_viewer_data->tree_v,
//GTK_TREE_VIEW_COLUMN_FIXED);
event_viewer_data->hbox_v = gtk_hbox_new(0, 0);
event_viewer_data->top_widget = event_viewer_data->hbox_v;
+ plugin_evd->parent.top_widget = event_viewer_data->hbox_v;
+
+ event_viewer_data->toolbar = gtk_toolbar_new();
+ gtk_toolbar_set_orientation(GTK_TOOLBAR(event_viewer_data->toolbar),
+ GTK_ORIENTATION_VERTICAL);
+
+ tmp_toolbar_icon = create_pixmap (main_window_get_widget(tab),
+ "guifilter16x16.png");
+ gtk_widget_show(tmp_toolbar_icon);
+ event_viewer_data->button_filter = gtk_tool_button_new(tmp_toolbar_icon,
+ "Filter");
+ g_signal_connect (G_OBJECT(event_viewer_data->button_filter),
+ "clicked",
+ G_CALLBACK (filter_button),
+ (gpointer)plugin_evd);
+ gtk_toolbar_insert(GTK_TOOLBAR(event_viewer_data->toolbar),
+ event_viewer_data->button_filter,
+ 0);
+ gtk_toolbar_set_style(GTK_TOOLBAR(event_viewer_data->toolbar),
+ GTK_TOOLBAR_ICONS);
+ gtk_box_pack_start(GTK_BOX(event_viewer_data->hbox_v),
+ event_viewer_data->toolbar, FALSE, FALSE, 0);
+ event_viewer_data->filter = NULL;
+
gtk_box_pack_start(GTK_BOX(event_viewer_data->hbox_v),
event_viewer_data->scroll_win, TRUE, TRUE, 0);
event_viewer_data->vadjust_c->page_size = 2.0;
// event_viewer_data->vtree_adjust_c->upper;
/* Raw event trace */
+ gtk_widget_show(GTK_WIDGET(event_viewer_data->button_filter));
+ gtk_widget_show(event_viewer_data->toolbar);
gtk_widget_show(event_viewer_data->hbox_v);
gtk_widget_show(event_viewer_data->tree_v);
gtk_widget_show(event_viewer_data->vscroll_vc);
/* Add the object's information to the module's array */
g_event_viewer_data_list = g_slist_append(g_event_viewer_data_list,
- event_viewer_data);
+ plugin_evd);
event_viewer_data->num_visible_events = 1;
//
g_object_set_data_full(
G_OBJECT(event_viewer_data->hbox_v),
- "event_viewer_data",
- event_viewer_data,
+ "plugin_data",
+ plugin_evd,
(GDestroyNotify)gui_events_free);
+
+ g_object_set_data(
+ G_OBJECT(event_viewer_data->hbox_v),
+ "event_viewer_data",
+ event_viewer_data);
event_viewer_data->background_info_waiting = 0;
if(event_viewer_data->background_info_waiting == 0) {
g_message("event viewer : background computation data ready.");
- redraw_notify(event_viewer_data, NULL);
+ evd_redraw_notify(event_viewer_data, NULL);
}
return 0;
#endif //0
}
+static void filter_button (GtkToolButton *toolbutton,
+ gpointer user_data)
+{
+ LttvPluginEVD *plugin_evd = (LttvPluginEVD*)user_data;
+ LttvAttribute *attribute;
+ LttvAttributeValue value;
+ gboolean ret;
+ g_printf("Filter button clicked\n");
+
+ attribute = LTTV_ATTRIBUTE(lttv_iattribute_find_subdir(
+ LTTV_IATTRIBUTE(lttv_global_attributes()),
+ LTTV_VIEWER_CONSTRUCTORS));
+ g_assert(attribute);
+
+ ret = lttv_iattribute_find_by_path(LTTV_IATTRIBUTE(attribute),
+ "guifilter", LTTV_POINTER, &value);
+ g_assert(ret);
+ lttvwindow_viewer_constructor constructor =
+ (lttvwindow_viewer_constructor)*(value.v_pointer);
+ if(constructor) constructor(&plugin_evd->parent);
+ else g_warning("Filter module not loaded.");
+
+ //FIXME : viewer returned.
+}
gboolean tree_v_scroll_handler (GtkWidget *widget, GdkEventScroll *event, gpointer data)
{
if(relative_position > 0) {
guint count;
count += lttv_process_traceset_seek_n_forward(tsc, relative_position,
- event_viewer_data->main_win_filter, events_check_handler,
- &event_viewer_data->tab->stop_foreground);
+ events_check_handler,
+ &event_viewer_data->tab->stop_foreground,
+ event_viewer_data->main_win_filter,
+ event_viewer_data->filter, NULL);
} else if(relative_position < 0) {
guint count;
abs(relative_position),
time_diff,
(seek_time_fct)lttv_state_traceset_seek_time_closest,
- event_viewer_data->main_win_filter,
events_check_handler,
- &event_viewer_data->tab->stop_foreground);
+ &event_viewer_data->tab->stop_foreground,
+ event_viewer_data->main_win_filter,
+ event_viewer_data->filter, NULL);
} /* else 0 : do nothing : we are already at the beginning position */
lttv_traceset_context_position_destroy(pos);
}
-
int event_hook(void *hook_data, void *call_data)
{
EventViewerData *event_viewer_data = (EventViewerData*)hook_data;
tfc->t_context->t,tfc))
return FALSE;
+ filter = event_viewer_data->filter;
+ if(filter != NULL && filter->head != NULL)
+ if(!lttv_filter_tree_parse(filter->head,e,tfc->tf,
+ tfc->t_context->t,tfc))
+ return FALSE;
+
+
LttFacility *facility = ltt_event_facility(e);
LttEventType *event_type = ltt_event_eventtype(e);
LttTime time = ltt_event_time(e);
tfc->t_context->t,tfc))
return FALSE;
+ filter = event_viewer_data->filter;
+ if(filter != NULL && filter->head != NULL)
+ if(!lttv_filter_tree_parse(filter->head,e,tfc->tf,
+ tfc->t_context->t,tfc))
+ return FALSE;
+
lttv_traceset_context_position_save(tfc->t_context->ts_context,
event_viewer_data->current_time_get_first);
return TRUE;
}
-gint redraw_notify(void *hook_data, void *call_data)
+gint evd_redraw_notify(void *hook_data, void *call_data)
{
EventViewerData *event_viewer_data = (EventViewerData*) hook_data;
return 0;
}
-void gui_events_free(EventViewerData *event_viewer_data)
+void gui_events_free(gpointer data)
{
- Tab *tab = event_viewer_data->tab;
+ LttvPluginEVD *plugin_evd = (LttvPluginEVD*)data;
+ Tab *tab = plugin_evd->evd->tab;
+ EventViewerData *event_viewer_data = plugin_evd->evd;
guint i;
- if(event_viewer_data){
+ lttv_filter_destroy(plugin_evd->evd->filter);
+
+ if(tab != NULL){
lttv_hooks_remove(event_viewer_data->event_hooks,event_hook);
lttv_hooks_destroy(event_viewer_data->event_hooks);
lttvwindow_unregister_filter_notify(tab,
filter_changed, event_viewer_data);
lttvwindow_unregister_redraw_notify(tab,
- redraw_notify, event_viewer_data);
-
- lttvwindowtraces_background_notify_remove(event_viewer_data);
+ evd_redraw_notify, event_viewer_data);
- g_event_viewer_data_list = g_slist_remove(g_event_viewer_data_list,
- event_viewer_data);
- g_free(event_viewer_data);
}
+ lttvwindowtraces_background_notify_remove(event_viewer_data);
+
+ g_event_viewer_data_list = g_slist_remove(g_event_viewer_data_list,
+ event_viewer_data);
+ //g_free(event_viewer_data);
+ g_object_unref(plugin_evd);
}
-void gui_events_destructor(EventViewerData *event_viewer_data)
+void gui_events_destructor(gpointer data)
{
+ LttvPluginEVD *plugin_evd = (LttvPluginEVD*)data;
/* May already been done by GTK window closing */
- if(GTK_IS_WIDGET(event_viewer_data->hbox_v)){
- gtk_widget_destroy(event_viewer_data->hbox_v);
+ if(GTK_IS_WIDGET(plugin_evd->parent.top_widget)){
+ gtk_widget_destroy(plugin_evd->parent.top_widget);
}
}
void event_destroy_walk(gpointer data, gpointer user_data)
{
- gui_events_destructor((EventViewerData*)data);
+ gui_events_destructor((LttvPluginEVD*)data);
}
/**
--- /dev/null
+#ifndef _EVENTS_H
+#define _EVENTS_H
+
+#include <lttvwindow/lttvwindow.h>
+#include <lttvwindow/lttv_plugin_tab.h>
+
+typedef struct _EventViewerData EventViewerData;
+
+struct _EventViewerData {
+
+ Tab * tab;
+ LttvPluginTab *ptab;
+ LttvHooks * event_hooks;
+
+ /* previous value is used to determine if it is a page up/down or
+ * step up/down, in which case we move of a certain amount of events (one or
+ * the number of events shown on the screen) instead of changing begin time.
+ */
+ double previous_value;
+
+ //scroll window containing Tree View
+ GtkWidget * scroll_win;
+
+ /* Model containing list data */
+ GtkListStore *store_m;
+
+ GPtrArray *pos; /* Array of LttvTracesetContextPosition * */
+
+ GtkWidget *top_widget;
+ GtkWidget *hbox_v;
+ /* Widget to display the data in a columned list */
+ GtkWidget *tree_v;
+ GtkAdjustment *vtree_adjust_c ;
+ GtkWidget *button; /* a button of the header, used to get the header_height */
+ gint header_height;
+
+ /* Vertical scrollbar and its adjustment */
+ GtkWidget *vscroll_vc;
+ GtkAdjustment *vadjust_c;
+
+ /* Selection handler */
+ GtkTreeSelection *select_c;
+
+ gint num_visible_events;
+
+ LttvTracesetContextPosition *currently_selected_position;
+ gboolean update_cursor; /* Speed optimisation : do not update cursor when
+ unnecessary */
+ gboolean report_position; /* do not report position when in current_time
+ update */
+
+ LttvTracesetContextPosition *first_event; /* Time of the first event shown */
+ LttvTracesetContextPosition *last_event; /* Time of the first event shown */
+
+ LttvTracesetContextPosition *current_time_get_first;
+
+ LttvFilter *main_win_filter;
+
+ gint background_info_waiting;
+
+ guint32 last_tree_update_time; /* To filter out repeat keys */
+
+ guint num_events; /* Number of events processed */
+
+ LttvFilter *filter;
+ GtkWidget *toolbar;
+ GtkToolItem *button_filter;
+
+};
+
+extern gint evd_redraw_notify(void *hook_data, void *call_data);
+
+#endif //EVENTS_H
--- /dev/null
+/* This file is part of the Linux Trace Toolkit viewer
+ * Copyright (C) 2006 Mathieu Desnoyers
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA.
+ */
+
+
+#include "lttv_plugin_evd.h"
+#include <lttvwindow/lttvwindow.h>
+#include "events.h"
+
+/*
+ * forward definitions
+ */
+
+/*
+ * Implementation
+ */
+
+static void evd_update_filter(LttvPlugin *parent, LttvFilter *filter)
+{
+ LttvPluginEVD *self = LTTV_PLUGIN_EVD(parent);
+ g_message("In EVD update filter.");
+ lttv_filter_destroy(self->evd->filter);
+ self->evd->filter = filter;
+ evd_redraw_notify(self->evd, NULL);
+}
+
+
+static void
+lttv_plugin_evd_class_init (LttvPluginEVDClass *klass)
+{
+ LttvPluginClass *parent_klass;
+ parent_klass = &klass->parent;
+ parent_klass->update_filter = evd_update_filter;
+ g_type_class_add_private (klass, sizeof (EventViewerData));
+}
+
+
+static void
+lttv_plugin_evd_init (GTypeInstance *instance, gpointer g_class)
+{
+ LttvPluginEVD *self = LTTV_PLUGIN_EVD (instance);
+ self->evd = G_TYPE_INSTANCE_GET_PRIVATE (self,
+ LTTV_TYPE_PLUGIN_EVD, EventViewerData);
+}
+
+
+GType
+lttv_plugin_evd_get_type (void)
+{
+ static GType type = 0;
+ if (type == 0) {
+ static const GTypeInfo info = {
+ sizeof (LttvPluginEVDClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ lttv_plugin_evd_class_init, /* class_init */
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (LttvPluginEVD),
+ 0, /* n_preallocs */
+ lttv_plugin_evd_init /* instance_init */
+ };
+ type = g_type_register_static (G_TYPE_OBJECT,
+ "LttvPluginEVDType",
+ &info, 0);
+ }
+ return type;
+}
+
+
--- /dev/null
+/* This file is part of the Linux Trace Toolkit viewer
+ * Copyright (C) 2006 Mathieu Desnoyers
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA.
+ */
+
+#ifndef LTTV_PLUGIN_EVD_H
+#define LTTV_PLUGIN_EVD_H
+
+#include <lttvwindow/lttv_plugin.h>
+#include <lttvwindow/mainwindow-private.h>
+#include "events.h"
+
+/*
+ * Type macros.
+ */
+
+#define LTTV_TYPE_PLUGIN_EVD (lttv_plugin_evd_get_type ())
+#define LTTV_PLUGIN_EVD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LTTV_TYPE_PLUGIN_EVD, LttvPluginEVD))
+#define LTTV_PLUGIN_EVD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), LTTV_TYPE_PLUGIN_EVD, LttvPluginEVDClass))
+#define LTTV_IS_PLUGIN_EVD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LTTV_TYPE_PLUGIN_EVD))
+#define LTTV_IS_PLUGIN_EVD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LTTV_TYPE_PLUGIN_EVD))
+#define LTTV_PLUGIN_EVD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), LTTV_TYPE_PLUGIN_EVD, LttvPluginEVDClass))
+
+typedef struct _LttvPluginEVD LttvPluginEVD;
+typedef struct _LttvPluginEVDClass LttvPluginEVDClass;
+
+struct _LttvPluginEVD {
+ LttvPlugin parent;
+
+ /* instance members */
+ EventViewerData *evd;
+
+ /* private */
+};
+
+struct _LttvPluginEVDClass {
+ LttvPluginClass parent;
+
+ /* class members */
+};
+
+/* used by LTTV_PLUGIN_TAB_TYPE */
+GType lttv_plugin_evd_get_type (void);
+
+/*
+ * Method definitions.
+ */
+
+
+#endif