From: dagenais Date: Fri, 16 Apr 2004 18:52:30 +0000 (+0000) Subject: Adjust the includes now that some paths have changed X-Git-Tag: v0.12.20~2987 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=0c56e138e63986d8a8c0d7fc3e2c7230a020289e;p=lttv.git Adjust the includes now that some paths have changed git-svn-id: http://ltt.polymtl.ca/svn@502 04897980-b3bd-0310-b5e0-8ef037075253 --- diff --git a/ltt/branches/poly/Makefile.am b/ltt/branches/poly/Makefile.am index 0dbabeb2..c249bbff 100644 --- a/ltt/branches/poly/Makefile.am +++ b/ltt/branches/poly/Makefile.am @@ -1,6 +1,6 @@ # WARNING : ltt must come before lttv, so that the traceread library is # up to date -SUBDIRS = ltt include lttv lttd +SUBDIRS = ltt lttv lttd diff --git a/ltt/branches/poly/configure.in b/ltt/branches/poly/configure.in index f245ffd3..638a52b7 100644 --- a/ltt/branches/poly/configure.in +++ b/ltt/branches/poly/configure.in @@ -77,10 +77,13 @@ lttlibdir="${libdir}/ltt" AC_SUBST(lttlibdir) +top_lttvdir="\$(top_srcdir)/lttv" +AC_SUBST(top_lttvdir) + top_guidir="\$(top_srcdir)/lttv/modules/gui" AC_SUBST(top_guidir) -DEFAULT_INCLUDES="-I\$(top_guidir) -I\$(top_srcdir)" +DEFAULT_INCLUDES="-I\$(top_srcdir) -I\$(top_lttvdir) -I\$(top_guidir)" AC_SUBST(DEFAULT_INCLUDES) #CPPFLAGS="${GLIB_CFLAGS}" diff --git a/ltt/branches/poly/lttv/Makefile.am b/ltt/branches/poly/lttv/Makefile.am index 9f26d16e..8370b90a 100644 --- a/ltt/branches/poly/lttv/Makefile.am +++ b/ltt/branches/poly/lttv/Makefile.am @@ -1,4 +1,4 @@ # WARNING : modules must be done at the end, so modules can dynamically link # themselves to libraries compiled here but not installed in the system. -SUBDIRS = main modules +SUBDIRS = lttv modules diff --git a/ltt/branches/poly/lttv/lttv/processTrace.c b/ltt/branches/poly/lttv/lttv/processTrace.c deleted file mode 100644 index 30f2da07..00000000 --- a/ltt/branches/poly/lttv/lttv/processTrace.c +++ /dev/null @@ -1,840 +0,0 @@ -/* This file is part of the Linux Trace Toolkit viewer - * Copyright (C) 2003-2004 Michel Dagenais - * - * 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 -#include -#include -#include -#include - -void lttv_context_init(LttvTracesetContext *self, LttvTraceset *ts) -{ - LTTV_TRACESET_CONTEXT_GET_CLASS(self)->init(self, ts); -} - - -void lttv_context_fini(LttvTracesetContext *self) -{ - LTTV_TRACESET_CONTEXT_GET_CLASS(self)->fini(self); -} - - -LttvTracesetContext * -lttv_context_new_traceset_context(LttvTracesetContext *self) -{ - return LTTV_TRACESET_CONTEXT_GET_CLASS(self)->new_traceset_context(self); -} - - - - -LttvTraceContext * -lttv_context_new_trace_context(LttvTracesetContext *self) -{ - return LTTV_TRACESET_CONTEXT_GET_CLASS(self)->new_trace_context(self); -} - - -LttvTracefileContext * -lttv_context_new_tracefile_context(LttvTracesetContext *self) -{ - return LTTV_TRACESET_CONTEXT_GET_CLASS(self)->new_tracefile_context(self); -} - -/**************************************************************************** - * lttv_traceset_context_compute_time_span - * - * Keep the Time_Span is sync with on the fly addition and removal of traces - * in a trace set. It must be called each time a trace is added/removed from - * the traceset. It could be more efficient to call it only once a bunch - * of traces are loaded, but the calculation is not long, so it's not - * critical. - * - * Author : Xang Xiu Yang - * Imported from gtkTraceSet.c by Mathieu Desnoyers - ***************************************************************************/ -static void lttv_traceset_context_compute_time_span( - LttvTracesetContext *self, - TimeInterval *Time_Span) -{ - LttvTraceset * traceset = self->ts; - int numTraces = lttv_traceset_number(traceset); - int i; - LttTime s, e; - LttvTraceContext *tc; - LttTrace * trace; - - Time_Span->startTime.tv_sec = 0; - Time_Span->startTime.tv_nsec = 0; - Time_Span->endTime.tv_sec = 0; - Time_Span->endTime.tv_nsec = 0; - - for(i=0; itraces[i]; - trace = tc->t; - - ltt_trace_time_span_get(trace, &s, &e); - - if(i==0){ - Time_Span->startTime = s; - Time_Span->endTime = e; - }else{ - if(s.tv_sec < Time_Span->startTime.tv_sec || - (s.tv_sec == Time_Span->startTime.tv_sec - && s.tv_nsec < Time_Span->startTime.tv_nsec)) - Time_Span->startTime = s; - if(e.tv_sec > Time_Span->endTime.tv_sec || - (e.tv_sec == Time_Span->endTime.tv_sec && - e.tv_nsec > Time_Span->endTime.tv_nsec)) - Time_Span->endTime = e; - } - } -} - - -static void -init(LttvTracesetContext *self, LttvTraceset *ts) -{ - guint i, j, nb_trace, nb_control, nb_per_cpu, nb_tracefile; - - LttvTraceContext *tc; - - LttvTracefileContext *tfc; - - LttTime null_time = {0, 0}; - - nb_trace = lttv_traceset_number(ts); - self->ts = ts; - self->traces = g_new(LttvTraceContext *, nb_trace); - self->before = lttv_hooks_new(); - self->after = lttv_hooks_new(); - self->a = g_object_new(LTTV_ATTRIBUTE_TYPE, NULL); - self->ts_a = lttv_traceset_attribute(ts); - for(i = 0 ; i < nb_trace ; i++) { - tc = LTTV_TRACESET_CONTEXT_GET_CLASS(self)->new_trace_context(self); - self->traces[i] = tc; - - tc->ts_context = self; - tc->index = i; - tc->vt = lttv_traceset_get(ts, i); - tc->t = lttv_trace(tc->vt); - tc->check = lttv_hooks_new(); - tc->before = lttv_hooks_new(); - tc->after = lttv_hooks_new(); - tc->a = g_object_new(LTTV_ATTRIBUTE_TYPE, NULL); - tc->t_a = lttv_trace_attribute(tc->vt); - nb_control = ltt_trace_control_tracefile_number(tc->t); - nb_per_cpu = ltt_trace_per_cpu_tracefile_number(tc->t); - nb_tracefile = nb_control + nb_per_cpu; - tc->tracefiles = g_new(LttvTracefileContext *, nb_tracefile); - - for(j = 0 ; j < nb_tracefile ; j++) { - tfc = LTTV_TRACESET_CONTEXT_GET_CLASS(self)->new_tracefile_context(self); - tc->tracefiles[j] = tfc; - tfc->index = j; - - if(j < nb_control) { - tfc->control = TRUE; - tfc->tf = ltt_trace_control_tracefile_get(tc->t, j); - } - else { - tfc->control = FALSE; - tfc->tf = ltt_trace_per_cpu_tracefile_get(tc->t, j - nb_control); - } - tfc->t_context = tc; - tfc->check = lttv_hooks_new(); - tfc->before = lttv_hooks_new(); - tfc->after = lttv_hooks_new(); - tfc->check_event = lttv_hooks_new(); - tfc->before_event = lttv_hooks_new(); - tfc->before_event_by_id = lttv_hooks_by_id_new(); - tfc->after_event = lttv_hooks_new(); - tfc->after_event_by_id = lttv_hooks_by_id_new(); - tfc->a = g_object_new(LTTV_ATTRIBUTE_TYPE, NULL); - } - } - lttv_process_traceset_seek_time(self, null_time); - /*CHECK why dynamically allocate the time span... and the casing is wroNg*/ - self->Time_Span = g_new(TimeInterval,1); - lttv_traceset_context_compute_time_span(self, self->Time_Span); -} - - -void fini(LttvTracesetContext *self) -{ - guint i, j, nb_trace, nb_tracefile; - - LttvTraceContext *tc; - - LttvTracefileContext *tfc; - - LttvTraceset *ts = self->ts; - - g_free(self->Time_Span); - - lttv_hooks_destroy(self->before); - lttv_hooks_destroy(self->after); - //FIXME : segfault - g_object_unref(self->a); - - nb_trace = lttv_traceset_number(ts); - - for(i = 0 ; i < nb_trace ; i++) { - tc = self->traces[i]; - - lttv_hooks_destroy(tc->check); - lttv_hooks_destroy(tc->before); - lttv_hooks_destroy(tc->after); - g_object_unref(tc->a); - - nb_tracefile = ltt_trace_control_tracefile_number(tc->t) + - ltt_trace_per_cpu_tracefile_number(tc->t); - - for(j = 0 ; j < nb_tracefile ; j++) { - tfc = tc->tracefiles[j]; - lttv_hooks_destroy(tfc->check); - lttv_hooks_destroy(tfc->before); - lttv_hooks_destroy(tfc->after); - lttv_hooks_destroy(tfc->check_event); - lttv_hooks_destroy(tfc->before_event); - lttv_hooks_by_id_destroy(tfc->before_event_by_id); - lttv_hooks_destroy(tfc->after_event); - lttv_hooks_by_id_destroy(tfc->after_event_by_id); - g_object_unref(tfc->a); - g_object_unref(tfc); - } - g_free(tc->tracefiles); - g_object_unref(tc); - } - g_free(self->traces); -} - - -void lttv_traceset_context_add_hooks(LttvTracesetContext *self, - LttvHooks *before_traceset, - LttvHooks *after_traceset, - LttvHooks *check_trace, - LttvHooks *before_trace, - LttvHooks *after_trace, - LttvHooks *check_tracefile, - LttvHooks *before_tracefile, - LttvHooks *after_tracefile, - LttvHooks *check_event, - LttvHooks *before_event, - LttvHooks *after_event) -{ - LttvTraceset *ts = self->ts; - - guint i, j, nb_trace, nb_tracefile; - - LttvTraceContext *tc; - - LttvTracefileContext *tfc; - - void *hook_data; - - lttv_hooks_add_list(self->before, before_traceset); - lttv_hooks_add_list(self->after, after_traceset); - nb_trace = lttv_traceset_number(ts); - - for(i = 0 ; i < nb_trace ; i++) { - tc = self->traces[i]; - lttv_hooks_add_list(tc->check, check_trace); - lttv_hooks_add_list(tc->before, before_trace); - lttv_hooks_add_list(tc->after, after_trace); - nb_tracefile = ltt_trace_control_tracefile_number(tc->t) + - ltt_trace_per_cpu_tracefile_number(tc->t); - - for(j = 0 ; j < nb_tracefile ; j++) { - tfc = tc->tracefiles[j]; - lttv_hooks_add_list(tfc->check, check_tracefile); - lttv_hooks_add_list(tfc->before, before_tracefile); - lttv_hooks_add_list(tfc->after, after_tracefile); - lttv_hooks_add_list(tfc->check_event, check_event); - lttv_hooks_add_list(tfc->before_event, before_event); - lttv_hooks_add_list(tfc->after_event, after_event); - } - } -} - - -void lttv_traceset_context_remove_hooks(LttvTracesetContext *self, - LttvHooks *before_traceset, - LttvHooks *after_traceset, - LttvHooks *check_trace, - LttvHooks *before_trace, - LttvHooks *after_trace, - LttvHooks *check_tracefile, - LttvHooks *before_tracefile, - LttvHooks *after_tracefile, - LttvHooks *check_event, - LttvHooks *before_event, - LttvHooks *after_event) -{ - LttvTraceset *ts = self->ts; - - guint i, j, nb_trace, nb_tracefile; - - LttvTraceContext *tc; - - LttvTracefileContext *tfc; - - void *hook_data; - - lttv_hooks_remove_list(self->before, before_traceset); - lttv_hooks_remove_list(self->after, after_traceset); - nb_trace = lttv_traceset_number(ts); - - for(i = 0 ; i < nb_trace ; i++) { - tc = self->traces[i]; - lttv_hooks_remove_list(tc->check, check_trace); - lttv_hooks_remove_list(tc->before, before_trace); - lttv_hooks_remove_list(tc->after, after_trace); - nb_tracefile = ltt_trace_control_tracefile_number(tc->t) + - ltt_trace_per_cpu_tracefile_number(tc->t); - - for(j = 0 ; j < nb_tracefile ; j++) { - tfc = tc->tracefiles[j]; - lttv_hooks_remove_list(tfc->check, check_tracefile); - lttv_hooks_remove_list(tfc->before, before_tracefile); - lttv_hooks_remove_list(tfc->after, after_tracefile); - lttv_hooks_remove_list(tfc->check_event, check_event); - lttv_hooks_remove_list(tfc->before_event, before_event); - lttv_hooks_remove_list(tfc->after_event, after_event); - } - } -} - -void lttv_trace_context_add_hooks(LttvTraceContext *tc, - LttvHooks *check_trace, - LttvHooks *before_trace, - LttvHooks *after_trace) -{ - lttv_hooks_add_list(tc->check, check_trace); - lttv_hooks_add_list(tc->before, before_trace); - lttv_hooks_add_list(tc->after, after_trace); -} - -void lttv_trace_context_remove_hooks(LttvTraceContext *tc, - LttvHooks *check_trace, - LttvHooks *before_trace, - LttvHooks *after_trace) -{ - lttv_hooks_remove_list(tc->check, check_trace); - lttv_hooks_remove_list(tc->before, before_trace); - lttv_hooks_remove_list(tc->after, after_trace); -} - -void lttv_tracefile_context_add_hooks(LttvTracefileContext *tfc, - LttvHooks *check_tracefile, - LttvHooks *before_tracefile, - LttvHooks *after_tracefile, - LttvHooks *check_event, - LttvHooks *before_event, - LttvHooks *after_event) -{ - lttv_hooks_add_list(tfc->check, check_tracefile); - lttv_hooks_add_list(tfc->before, before_tracefile); - lttv_hooks_add_list(tfc->after, after_tracefile); - lttv_hooks_add_list(tfc->check_event, check_event); - lttv_hooks_add_list(tfc->before_event, before_event); - lttv_hooks_add_list(tfc->after_event, after_event); -} - -void lttv_tracefile_context_remove_hooks(LttvTracefileContext *tfc, - LttvHooks *check_tracefile, - LttvHooks *before_tracefile, - LttvHooks *after_tracefile, - LttvHooks *check_event, - LttvHooks *before_event, - LttvHooks *after_event) -{ - lttv_hooks_remove_list(tfc->check, check_tracefile); - lttv_hooks_remove_list(tfc->before, before_tracefile); - lttv_hooks_remove_list(tfc->after, after_tracefile); - lttv_hooks_remove_list(tfc->check_event, check_event); - lttv_hooks_remove_list(tfc->before_event, before_event); - lttv_hooks_remove_list(tfc->after_event, after_event); -} - -void lttv_tracefile_context_add_hooks_by_id(LttvTracefileContext *tfc, - unsigned i, - LttvHooks *before_event_by_id, - LttvHooks *after_event_by_id) -{ - LttvHooks * h; - h = lttv_hooks_by_id_find(tfc->before_event_by_id, i); - lttv_hooks_add_list(h, before_event_by_id); - h = lttv_hooks_by_id_find(tfc->after_event_by_id, i); - lttv_hooks_add_list(h, after_event_by_id); -} - -void lttv_tracefile_context_remove_hooks_by_id(LttvTracefileContext *tfc, - unsigned i) -{ - lttv_hooks_by_id_remove(tfc->before_event_by_id, i); - lttv_hooks_by_id_remove(tfc->after_event_by_id, i); -} - -static LttvTracesetContext * -new_traceset_context(LttvTracesetContext *self) -{ - return g_object_new(LTTV_TRACESET_CONTEXT_TYPE, NULL); -} - - -static LttvTraceContext * -new_trace_context(LttvTracesetContext *self) -{ - return g_object_new(LTTV_TRACE_CONTEXT_TYPE, NULL); -} - - -static LttvTracefileContext * -new_tracefile_context(LttvTracesetContext *self) -{ - return g_object_new(LTTV_TRACEFILE_CONTEXT_TYPE, NULL); -} - - -static void -traceset_context_instance_init (GTypeInstance *instance, gpointer g_class) -{ - /* Be careful of anything which would not work well with shallow copies */ -} - - -static void -traceset_context_finalize (LttvTracesetContext *self) -{ - G_OBJECT_CLASS(g_type_class_peek(g_type_parent(LTTV_TRACESET_CONTEXT_TYPE))) - ->finalize(G_OBJECT(self)); -} - - -static void -traceset_context_class_init (LttvTracesetContextClass *klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS(klass); - - gobject_class->finalize = (void (*)(GObject *self))traceset_context_finalize; - klass->init = init; - klass->fini = fini; - klass->new_traceset_context = new_traceset_context; - klass->new_trace_context = new_trace_context; - klass->new_tracefile_context = new_tracefile_context; -} - - -GType -lttv_traceset_context_get_type(void) -{ - static GType type = 0; - if (type == 0) { - static const GTypeInfo info = { - sizeof (LttvTracesetContextClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) traceset_context_class_init, /* class_init */ - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (LttvTracesetContext), - 0, /* n_preallocs */ - (GInstanceInitFunc) traceset_context_instance_init /* instance_init */ - }; - - type = g_type_register_static (G_TYPE_OBJECT, "LttvTracesetContextType", - &info, 0); - } - return type; -} - - -static void -trace_context_instance_init (GTypeInstance *instance, gpointer g_class) -{ - /* Be careful of anything which would not work well with shallow copies */ -} - - -static void -trace_context_finalize (LttvTraceContext *self) -{ - G_OBJECT_CLASS(g_type_class_peek(g_type_parent(LTTV_TRACE_CONTEXT_TYPE)))-> - finalize(G_OBJECT(self)); -} - - -static void -trace_context_class_init (LttvTraceContextClass *klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS(klass); - - gobject_class->finalize = (void (*)(GObject *self)) trace_context_finalize; -} - - -GType -lttv_trace_context_get_type(void) -{ - static GType type = 0; - if (type == 0) { - static const GTypeInfo info = { - sizeof (LttvTraceContextClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) trace_context_class_init, /* class_init */ - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (LttvTraceContext), - 0, /* n_preallocs */ - (GInstanceInitFunc) trace_context_instance_init /* instance_init */ - }; - - type = g_type_register_static (G_TYPE_OBJECT, "LttvTraceContextType", - &info, 0); - } - return type; -} - - -static void -tracefile_context_instance_init (GTypeInstance *instance, gpointer g_class) -{ - /* Be careful of anything which would not work well with shallow copies */ -} - - -static void -tracefile_context_finalize (LttvTracefileContext *self) -{ - G_OBJECT_CLASS(g_type_class_peek(g_type_parent(LTTV_TRACEFILE_CONTEXT_TYPE))) - ->finalize(G_OBJECT(self)); -} - - -static void -tracefile_context_class_init (LttvTracefileContextClass *klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS(klass); - - gobject_class->finalize = (void (*)(GObject *self))tracefile_context_finalize; -} - - -GType -lttv_tracefile_context_get_type(void) -{ - static GType type = 0; - if (type == 0) { - static const GTypeInfo info = { - sizeof (LttvTracefileContextClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) tracefile_context_class_init, /* class_init */ - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (LttvTracefileContext), - 0, /* n_preallocs */ - (GInstanceInitFunc) tracefile_context_instance_init /* instance_init */ - }; - - type = g_type_register_static (G_TYPE_OBJECT, "LttvTracefileContextType", - &info, 0); - } - return type; -} - - -gint compare_tracefile(gconstpointer a, gconstpointer b) -{ - gint comparison; - - LttvTracefileContext *trace_a = (LttvTracefileContext *)a; - - LttvTracefileContext *trace_b = (LttvTracefileContext *)b; - - if(trace_a == trace_b) return 0; - comparison = ltt_time_compare(trace_a->timestamp, trace_b->timestamp); - if(comparison != 0) return comparison; - if(trace_a->index < trace_b->index) return -1; - else if(trace_a->index > trace_b->index) return 1; - if(trace_a->t_context->index < trace_b->t_context->index) return -1; - else if(trace_a->t_context->index > trace_b->t_context->index) return 1; - g_assert(FALSE); -} - - -gboolean get_first(gpointer key, gpointer value, gpointer user_data) { - *((LttvTracefileContext **)user_data) = (LttvTracefileContext *)value; - return TRUE; -} - - -void lttv_process_traceset_begin(LttvTracesetContext *self, LttTime end) -{ - guint i, j, nbi, nb_tracefile; - - LttvTraceContext *tc; - - LttvTracefileContext *tfc; - - /* Call all before_traceset, before_trace, and before_tracefile hooks. - For all qualifying tracefiles, seek to the start time, create a context, - read one event and insert in the pqueue based on the event time. */ - - lttv_hooks_call(self->before, self); - nbi = lttv_traceset_number(self->ts); - self->pqueue = g_tree_new(compare_tracefile); - - for(i = 0 ; i < nbi ; i++) { - tc = self->traces[i]; - - if(!lttv_hooks_call_check(tc->check, tc)) { - lttv_hooks_call(tc->before, tc); - nb_tracefile = ltt_trace_control_tracefile_number(tc->t) + - ltt_trace_per_cpu_tracefile_number(tc->t); - - for(j = 0 ; j < nb_tracefile ; j++) { - tfc = tc->tracefiles[j]; - - if(!lttv_hooks_call_check(tfc->check, tfc)) { - lttv_hooks_call(tfc->before, tfc); - - if(tfc->e != NULL) { - if(tfc->timestamp.tv_sec < end.tv_sec || - (tfc->timestamp.tv_sec == end.tv_sec && - tfc->timestamp.tv_nsec <= end.tv_nsec)) { - g_tree_insert(self->pqueue, tfc, tfc); - } - } - } - } - } - } -} - - -guint lttv_process_traceset_middle(LttvTracesetContext *self, LttTime end, - unsigned nb_events) -{ - GTree *pqueue = self->pqueue; - - guint id; - - LttvTraceContext *tc; - - LttvTracefileContext *tfc; - - LttEvent *event; - - unsigned count = 0; - - LttTime previous_timestamp = {0, 0}; - - /* Get the next event from the pqueue, call its hooks, - reinsert in the pqueue the following event from the same tracefile - unless the tracefile is finished or the event is later than the - start time. */ - - while(TRUE) { - tfc = NULL; - g_tree_foreach(pqueue, get_first, &tfc); - if(tfc == NULL) return count; - - /* Have we reached the maximum number of events specified? However, - continue for all the events with the same time stamp (CHECK?). Then, - empty the queue and break from the loop. */ - - if(count >= nb_events && - ltt_time_compare(tfc->timestamp, previous_timestamp) != 0) - return count; - - previous_timestamp = tfc->timestamp; - - - /* Get the tracefile with an event for the smallest time found. If two - or more tracefiles have events for the same time, hope that lookup - and remove are consistent. */ - - g_tree_remove(pqueue, tfc); - count++; - - if(!lttv_hooks_call(tfc->check_event, tfc)) { - id = ltt_event_eventtype_id(tfc->e); - lttv_hooks_call(lttv_hooks_by_id_get(tfc->before_event_by_id, id), tfc); - lttv_hooks_call(tfc->before_event, tfc); - lttv_hooks_call(lttv_hooks_by_id_get(tfc->after_event_by_id, id), tfc); - lttv_hooks_call(tfc->after_event, tfc); - } - - event = ltt_tracefile_read(tfc->tf); - if(event != NULL) { - tfc->e = event; - tfc->timestamp = ltt_event_time(event); - if(tfc->timestamp.tv_sec < end.tv_sec || - (tfc->timestamp.tv_sec == end.tv_sec && tfc->timestamp.tv_nsec <= end.tv_nsec)) - g_tree_insert(pqueue, tfc, tfc); - } - } -} - - -void lttv_process_traceset_end(LttvTracesetContext *self) -{ - guint i, j, nbi, nb_tracefile; - - LttvTraceContext *tc; - - LttvTracefileContext *tfc; - - /* Call all after_traceset, after_trace, and after_tracefile hooks. */ - - nbi = lttv_traceset_number(self->ts); - - for(i = 0 ; i < nbi ; i++) { - tc = self->traces[i]; - - /* The check hooks are called again to avoid memorizing the results - obtained at the beginning. CHECK if it poses a problem */ - - if(!lttv_hooks_call_check(tc->check, tc)) { - nb_tracefile = ltt_trace_control_tracefile_number(tc->t) + - ltt_trace_per_cpu_tracefile_number(tc->t); - - for(j = 0 ; j < nb_tracefile ; j++) { - tfc = tc->tracefiles[j]; - - if(!lttv_hooks_call_check(tfc->check, tfc)) { - lttv_hooks_call(tfc->after, tfc); - } - } - lttv_hooks_call(tc->after, tc); - } - } - lttv_hooks_call(self->after, self); - - /* Empty and free the pqueue */ - - while(TRUE){ - tfc = NULL; - g_tree_foreach(self->pqueue, get_first, &tfc); - if(tfc == NULL) break; - g_tree_remove(self->pqueue, &(tfc->timestamp)); - } - g_tree_destroy(self->pqueue); -} - - -void lttv_process_traceset(LttvTracesetContext *self, LttTime end, - unsigned nb_events) -{ - lttv_process_traceset_begin(self, end); - lttv_process_traceset_middle(self, end, nb_events); - lttv_process_traceset_end(self); -} - - -void lttv_process_trace_seek_time(LttvTraceContext *self, LttTime start) -{ - guint i, nb_tracefile; - - LttvTracefileContext *tfc; - - LttEvent *event; - - nb_tracefile = ltt_trace_control_tracefile_number(self->t) + - ltt_trace_per_cpu_tracefile_number(self->t); - - for(i = 0 ; i < nb_tracefile ; i++) { - tfc = self->tracefiles[i]; - ltt_tracefile_seek_time(tfc->tf, start); - event = ltt_tracefile_read(tfc->tf); - tfc->e = event; - if(event != NULL) tfc->timestamp = ltt_event_time(event); - } -} - - -void lttv_process_traceset_seek_time(LttvTracesetContext *self, LttTime start) -{ - guint i, nb_trace; - - LttvTraceContext *tc; - - nb_trace = lttv_traceset_number(self->ts); - for(i = 0 ; i < nb_trace ; i++) { - tc = self->traces[i]; - lttv_process_trace_seek_time(tc, start); - } -} - - -static LttField * -find_field(LttEventType *et, const char *field) -{ - LttType *t; - - LttField *f; - - guint i, nb; - - char *name; - - if(field == NULL) return NULL; - - f = ltt_eventtype_field(et); - t = ltt_eventtype_type(et); - g_assert(ltt_type_class(t) == LTT_STRUCT); - nb = ltt_type_member_number(t); - for(i = 0 ; i < nb ; i++) { - ltt_type_member_type(t, i, &name); - if(strcmp(name, field) == 0) break; - } - g_assert(i < nb); - return ltt_field_member(f, i); -} - - -void -lttv_trace_find_hook(LttTrace *t, char *facility, char *event_type, - char *field1, char *field2, char *field3, LttvHook h, LttvTraceHook *th) -{ - LttFacility *f; - - LttEventType *et; - - guint nb, pos, i; - - char *name; - - nb = ltt_trace_facility_find(t, facility, &pos); - if(nb < 1) g_error("No %s facility", facility); - f = ltt_trace_facility_get(t, pos); - et = ltt_facility_eventtype_get_by_name(f, event_type); - if(et == NULL) g_error("Event %s does not exist", event_type); - - th->h = h; - th->id = ltt_eventtype_id(et); - th->f1 = find_field(et, field1); - th->f2 = find_field(et, field2); - th->f3 = find_field(et, field3); -} - - diff --git a/ltt/branches/poly/lttv/lttv/tracecontext.c b/ltt/branches/poly/lttv/lttv/tracecontext.c new file mode 100644 index 00000000..30f2da07 --- /dev/null +++ b/ltt/branches/poly/lttv/lttv/tracecontext.c @@ -0,0 +1,840 @@ +/* This file is part of the Linux Trace Toolkit viewer + * Copyright (C) 2003-2004 Michel Dagenais + * + * 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 +#include +#include +#include +#include + +void lttv_context_init(LttvTracesetContext *self, LttvTraceset *ts) +{ + LTTV_TRACESET_CONTEXT_GET_CLASS(self)->init(self, ts); +} + + +void lttv_context_fini(LttvTracesetContext *self) +{ + LTTV_TRACESET_CONTEXT_GET_CLASS(self)->fini(self); +} + + +LttvTracesetContext * +lttv_context_new_traceset_context(LttvTracesetContext *self) +{ + return LTTV_TRACESET_CONTEXT_GET_CLASS(self)->new_traceset_context(self); +} + + + + +LttvTraceContext * +lttv_context_new_trace_context(LttvTracesetContext *self) +{ + return LTTV_TRACESET_CONTEXT_GET_CLASS(self)->new_trace_context(self); +} + + +LttvTracefileContext * +lttv_context_new_tracefile_context(LttvTracesetContext *self) +{ + return LTTV_TRACESET_CONTEXT_GET_CLASS(self)->new_tracefile_context(self); +} + +/**************************************************************************** + * lttv_traceset_context_compute_time_span + * + * Keep the Time_Span is sync with on the fly addition and removal of traces + * in a trace set. It must be called each time a trace is added/removed from + * the traceset. It could be more efficient to call it only once a bunch + * of traces are loaded, but the calculation is not long, so it's not + * critical. + * + * Author : Xang Xiu Yang + * Imported from gtkTraceSet.c by Mathieu Desnoyers + ***************************************************************************/ +static void lttv_traceset_context_compute_time_span( + LttvTracesetContext *self, + TimeInterval *Time_Span) +{ + LttvTraceset * traceset = self->ts; + int numTraces = lttv_traceset_number(traceset); + int i; + LttTime s, e; + LttvTraceContext *tc; + LttTrace * trace; + + Time_Span->startTime.tv_sec = 0; + Time_Span->startTime.tv_nsec = 0; + Time_Span->endTime.tv_sec = 0; + Time_Span->endTime.tv_nsec = 0; + + for(i=0; itraces[i]; + trace = tc->t; + + ltt_trace_time_span_get(trace, &s, &e); + + if(i==0){ + Time_Span->startTime = s; + Time_Span->endTime = e; + }else{ + if(s.tv_sec < Time_Span->startTime.tv_sec || + (s.tv_sec == Time_Span->startTime.tv_sec + && s.tv_nsec < Time_Span->startTime.tv_nsec)) + Time_Span->startTime = s; + if(e.tv_sec > Time_Span->endTime.tv_sec || + (e.tv_sec == Time_Span->endTime.tv_sec && + e.tv_nsec > Time_Span->endTime.tv_nsec)) + Time_Span->endTime = e; + } + } +} + + +static void +init(LttvTracesetContext *self, LttvTraceset *ts) +{ + guint i, j, nb_trace, nb_control, nb_per_cpu, nb_tracefile; + + LttvTraceContext *tc; + + LttvTracefileContext *tfc; + + LttTime null_time = {0, 0}; + + nb_trace = lttv_traceset_number(ts); + self->ts = ts; + self->traces = g_new(LttvTraceContext *, nb_trace); + self->before = lttv_hooks_new(); + self->after = lttv_hooks_new(); + self->a = g_object_new(LTTV_ATTRIBUTE_TYPE, NULL); + self->ts_a = lttv_traceset_attribute(ts); + for(i = 0 ; i < nb_trace ; i++) { + tc = LTTV_TRACESET_CONTEXT_GET_CLASS(self)->new_trace_context(self); + self->traces[i] = tc; + + tc->ts_context = self; + tc->index = i; + tc->vt = lttv_traceset_get(ts, i); + tc->t = lttv_trace(tc->vt); + tc->check = lttv_hooks_new(); + tc->before = lttv_hooks_new(); + tc->after = lttv_hooks_new(); + tc->a = g_object_new(LTTV_ATTRIBUTE_TYPE, NULL); + tc->t_a = lttv_trace_attribute(tc->vt); + nb_control = ltt_trace_control_tracefile_number(tc->t); + nb_per_cpu = ltt_trace_per_cpu_tracefile_number(tc->t); + nb_tracefile = nb_control + nb_per_cpu; + tc->tracefiles = g_new(LttvTracefileContext *, nb_tracefile); + + for(j = 0 ; j < nb_tracefile ; j++) { + tfc = LTTV_TRACESET_CONTEXT_GET_CLASS(self)->new_tracefile_context(self); + tc->tracefiles[j] = tfc; + tfc->index = j; + + if(j < nb_control) { + tfc->control = TRUE; + tfc->tf = ltt_trace_control_tracefile_get(tc->t, j); + } + else { + tfc->control = FALSE; + tfc->tf = ltt_trace_per_cpu_tracefile_get(tc->t, j - nb_control); + } + tfc->t_context = tc; + tfc->check = lttv_hooks_new(); + tfc->before = lttv_hooks_new(); + tfc->after = lttv_hooks_new(); + tfc->check_event = lttv_hooks_new(); + tfc->before_event = lttv_hooks_new(); + tfc->before_event_by_id = lttv_hooks_by_id_new(); + tfc->after_event = lttv_hooks_new(); + tfc->after_event_by_id = lttv_hooks_by_id_new(); + tfc->a = g_object_new(LTTV_ATTRIBUTE_TYPE, NULL); + } + } + lttv_process_traceset_seek_time(self, null_time); + /*CHECK why dynamically allocate the time span... and the casing is wroNg*/ + self->Time_Span = g_new(TimeInterval,1); + lttv_traceset_context_compute_time_span(self, self->Time_Span); +} + + +void fini(LttvTracesetContext *self) +{ + guint i, j, nb_trace, nb_tracefile; + + LttvTraceContext *tc; + + LttvTracefileContext *tfc; + + LttvTraceset *ts = self->ts; + + g_free(self->Time_Span); + + lttv_hooks_destroy(self->before); + lttv_hooks_destroy(self->after); + //FIXME : segfault + g_object_unref(self->a); + + nb_trace = lttv_traceset_number(ts); + + for(i = 0 ; i < nb_trace ; i++) { + tc = self->traces[i]; + + lttv_hooks_destroy(tc->check); + lttv_hooks_destroy(tc->before); + lttv_hooks_destroy(tc->after); + g_object_unref(tc->a); + + nb_tracefile = ltt_trace_control_tracefile_number(tc->t) + + ltt_trace_per_cpu_tracefile_number(tc->t); + + for(j = 0 ; j < nb_tracefile ; j++) { + tfc = tc->tracefiles[j]; + lttv_hooks_destroy(tfc->check); + lttv_hooks_destroy(tfc->before); + lttv_hooks_destroy(tfc->after); + lttv_hooks_destroy(tfc->check_event); + lttv_hooks_destroy(tfc->before_event); + lttv_hooks_by_id_destroy(tfc->before_event_by_id); + lttv_hooks_destroy(tfc->after_event); + lttv_hooks_by_id_destroy(tfc->after_event_by_id); + g_object_unref(tfc->a); + g_object_unref(tfc); + } + g_free(tc->tracefiles); + g_object_unref(tc); + } + g_free(self->traces); +} + + +void lttv_traceset_context_add_hooks(LttvTracesetContext *self, + LttvHooks *before_traceset, + LttvHooks *after_traceset, + LttvHooks *check_trace, + LttvHooks *before_trace, + LttvHooks *after_trace, + LttvHooks *check_tracefile, + LttvHooks *before_tracefile, + LttvHooks *after_tracefile, + LttvHooks *check_event, + LttvHooks *before_event, + LttvHooks *after_event) +{ + LttvTraceset *ts = self->ts; + + guint i, j, nb_trace, nb_tracefile; + + LttvTraceContext *tc; + + LttvTracefileContext *tfc; + + void *hook_data; + + lttv_hooks_add_list(self->before, before_traceset); + lttv_hooks_add_list(self->after, after_traceset); + nb_trace = lttv_traceset_number(ts); + + for(i = 0 ; i < nb_trace ; i++) { + tc = self->traces[i]; + lttv_hooks_add_list(tc->check, check_trace); + lttv_hooks_add_list(tc->before, before_trace); + lttv_hooks_add_list(tc->after, after_trace); + nb_tracefile = ltt_trace_control_tracefile_number(tc->t) + + ltt_trace_per_cpu_tracefile_number(tc->t); + + for(j = 0 ; j < nb_tracefile ; j++) { + tfc = tc->tracefiles[j]; + lttv_hooks_add_list(tfc->check, check_tracefile); + lttv_hooks_add_list(tfc->before, before_tracefile); + lttv_hooks_add_list(tfc->after, after_tracefile); + lttv_hooks_add_list(tfc->check_event, check_event); + lttv_hooks_add_list(tfc->before_event, before_event); + lttv_hooks_add_list(tfc->after_event, after_event); + } + } +} + + +void lttv_traceset_context_remove_hooks(LttvTracesetContext *self, + LttvHooks *before_traceset, + LttvHooks *after_traceset, + LttvHooks *check_trace, + LttvHooks *before_trace, + LttvHooks *after_trace, + LttvHooks *check_tracefile, + LttvHooks *before_tracefile, + LttvHooks *after_tracefile, + LttvHooks *check_event, + LttvHooks *before_event, + LttvHooks *after_event) +{ + LttvTraceset *ts = self->ts; + + guint i, j, nb_trace, nb_tracefile; + + LttvTraceContext *tc; + + LttvTracefileContext *tfc; + + void *hook_data; + + lttv_hooks_remove_list(self->before, before_traceset); + lttv_hooks_remove_list(self->after, after_traceset); + nb_trace = lttv_traceset_number(ts); + + for(i = 0 ; i < nb_trace ; i++) { + tc = self->traces[i]; + lttv_hooks_remove_list(tc->check, check_trace); + lttv_hooks_remove_list(tc->before, before_trace); + lttv_hooks_remove_list(tc->after, after_trace); + nb_tracefile = ltt_trace_control_tracefile_number(tc->t) + + ltt_trace_per_cpu_tracefile_number(tc->t); + + for(j = 0 ; j < nb_tracefile ; j++) { + tfc = tc->tracefiles[j]; + lttv_hooks_remove_list(tfc->check, check_tracefile); + lttv_hooks_remove_list(tfc->before, before_tracefile); + lttv_hooks_remove_list(tfc->after, after_tracefile); + lttv_hooks_remove_list(tfc->check_event, check_event); + lttv_hooks_remove_list(tfc->before_event, before_event); + lttv_hooks_remove_list(tfc->after_event, after_event); + } + } +} + +void lttv_trace_context_add_hooks(LttvTraceContext *tc, + LttvHooks *check_trace, + LttvHooks *before_trace, + LttvHooks *after_trace) +{ + lttv_hooks_add_list(tc->check, check_trace); + lttv_hooks_add_list(tc->before, before_trace); + lttv_hooks_add_list(tc->after, after_trace); +} + +void lttv_trace_context_remove_hooks(LttvTraceContext *tc, + LttvHooks *check_trace, + LttvHooks *before_trace, + LttvHooks *after_trace) +{ + lttv_hooks_remove_list(tc->check, check_trace); + lttv_hooks_remove_list(tc->before, before_trace); + lttv_hooks_remove_list(tc->after, after_trace); +} + +void lttv_tracefile_context_add_hooks(LttvTracefileContext *tfc, + LttvHooks *check_tracefile, + LttvHooks *before_tracefile, + LttvHooks *after_tracefile, + LttvHooks *check_event, + LttvHooks *before_event, + LttvHooks *after_event) +{ + lttv_hooks_add_list(tfc->check, check_tracefile); + lttv_hooks_add_list(tfc->before, before_tracefile); + lttv_hooks_add_list(tfc->after, after_tracefile); + lttv_hooks_add_list(tfc->check_event, check_event); + lttv_hooks_add_list(tfc->before_event, before_event); + lttv_hooks_add_list(tfc->after_event, after_event); +} + +void lttv_tracefile_context_remove_hooks(LttvTracefileContext *tfc, + LttvHooks *check_tracefile, + LttvHooks *before_tracefile, + LttvHooks *after_tracefile, + LttvHooks *check_event, + LttvHooks *before_event, + LttvHooks *after_event) +{ + lttv_hooks_remove_list(tfc->check, check_tracefile); + lttv_hooks_remove_list(tfc->before, before_tracefile); + lttv_hooks_remove_list(tfc->after, after_tracefile); + lttv_hooks_remove_list(tfc->check_event, check_event); + lttv_hooks_remove_list(tfc->before_event, before_event); + lttv_hooks_remove_list(tfc->after_event, after_event); +} + +void lttv_tracefile_context_add_hooks_by_id(LttvTracefileContext *tfc, + unsigned i, + LttvHooks *before_event_by_id, + LttvHooks *after_event_by_id) +{ + LttvHooks * h; + h = lttv_hooks_by_id_find(tfc->before_event_by_id, i); + lttv_hooks_add_list(h, before_event_by_id); + h = lttv_hooks_by_id_find(tfc->after_event_by_id, i); + lttv_hooks_add_list(h, after_event_by_id); +} + +void lttv_tracefile_context_remove_hooks_by_id(LttvTracefileContext *tfc, + unsigned i) +{ + lttv_hooks_by_id_remove(tfc->before_event_by_id, i); + lttv_hooks_by_id_remove(tfc->after_event_by_id, i); +} + +static LttvTracesetContext * +new_traceset_context(LttvTracesetContext *self) +{ + return g_object_new(LTTV_TRACESET_CONTEXT_TYPE, NULL); +} + + +static LttvTraceContext * +new_trace_context(LttvTracesetContext *self) +{ + return g_object_new(LTTV_TRACE_CONTEXT_TYPE, NULL); +} + + +static LttvTracefileContext * +new_tracefile_context(LttvTracesetContext *self) +{ + return g_object_new(LTTV_TRACEFILE_CONTEXT_TYPE, NULL); +} + + +static void +traceset_context_instance_init (GTypeInstance *instance, gpointer g_class) +{ + /* Be careful of anything which would not work well with shallow copies */ +} + + +static void +traceset_context_finalize (LttvTracesetContext *self) +{ + G_OBJECT_CLASS(g_type_class_peek(g_type_parent(LTTV_TRACESET_CONTEXT_TYPE))) + ->finalize(G_OBJECT(self)); +} + + +static void +traceset_context_class_init (LttvTracesetContextClass *klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS(klass); + + gobject_class->finalize = (void (*)(GObject *self))traceset_context_finalize; + klass->init = init; + klass->fini = fini; + klass->new_traceset_context = new_traceset_context; + klass->new_trace_context = new_trace_context; + klass->new_tracefile_context = new_tracefile_context; +} + + +GType +lttv_traceset_context_get_type(void) +{ + static GType type = 0; + if (type == 0) { + static const GTypeInfo info = { + sizeof (LttvTracesetContextClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) traceset_context_class_init, /* class_init */ + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (LttvTracesetContext), + 0, /* n_preallocs */ + (GInstanceInitFunc) traceset_context_instance_init /* instance_init */ + }; + + type = g_type_register_static (G_TYPE_OBJECT, "LttvTracesetContextType", + &info, 0); + } + return type; +} + + +static void +trace_context_instance_init (GTypeInstance *instance, gpointer g_class) +{ + /* Be careful of anything which would not work well with shallow copies */ +} + + +static void +trace_context_finalize (LttvTraceContext *self) +{ + G_OBJECT_CLASS(g_type_class_peek(g_type_parent(LTTV_TRACE_CONTEXT_TYPE)))-> + finalize(G_OBJECT(self)); +} + + +static void +trace_context_class_init (LttvTraceContextClass *klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS(klass); + + gobject_class->finalize = (void (*)(GObject *self)) trace_context_finalize; +} + + +GType +lttv_trace_context_get_type(void) +{ + static GType type = 0; + if (type == 0) { + static const GTypeInfo info = { + sizeof (LttvTraceContextClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) trace_context_class_init, /* class_init */ + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (LttvTraceContext), + 0, /* n_preallocs */ + (GInstanceInitFunc) trace_context_instance_init /* instance_init */ + }; + + type = g_type_register_static (G_TYPE_OBJECT, "LttvTraceContextType", + &info, 0); + } + return type; +} + + +static void +tracefile_context_instance_init (GTypeInstance *instance, gpointer g_class) +{ + /* Be careful of anything which would not work well with shallow copies */ +} + + +static void +tracefile_context_finalize (LttvTracefileContext *self) +{ + G_OBJECT_CLASS(g_type_class_peek(g_type_parent(LTTV_TRACEFILE_CONTEXT_TYPE))) + ->finalize(G_OBJECT(self)); +} + + +static void +tracefile_context_class_init (LttvTracefileContextClass *klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS(klass); + + gobject_class->finalize = (void (*)(GObject *self))tracefile_context_finalize; +} + + +GType +lttv_tracefile_context_get_type(void) +{ + static GType type = 0; + if (type == 0) { + static const GTypeInfo info = { + sizeof (LttvTracefileContextClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) tracefile_context_class_init, /* class_init */ + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (LttvTracefileContext), + 0, /* n_preallocs */ + (GInstanceInitFunc) tracefile_context_instance_init /* instance_init */ + }; + + type = g_type_register_static (G_TYPE_OBJECT, "LttvTracefileContextType", + &info, 0); + } + return type; +} + + +gint compare_tracefile(gconstpointer a, gconstpointer b) +{ + gint comparison; + + LttvTracefileContext *trace_a = (LttvTracefileContext *)a; + + LttvTracefileContext *trace_b = (LttvTracefileContext *)b; + + if(trace_a == trace_b) return 0; + comparison = ltt_time_compare(trace_a->timestamp, trace_b->timestamp); + if(comparison != 0) return comparison; + if(trace_a->index < trace_b->index) return -1; + else if(trace_a->index > trace_b->index) return 1; + if(trace_a->t_context->index < trace_b->t_context->index) return -1; + else if(trace_a->t_context->index > trace_b->t_context->index) return 1; + g_assert(FALSE); +} + + +gboolean get_first(gpointer key, gpointer value, gpointer user_data) { + *((LttvTracefileContext **)user_data) = (LttvTracefileContext *)value; + return TRUE; +} + + +void lttv_process_traceset_begin(LttvTracesetContext *self, LttTime end) +{ + guint i, j, nbi, nb_tracefile; + + LttvTraceContext *tc; + + LttvTracefileContext *tfc; + + /* Call all before_traceset, before_trace, and before_tracefile hooks. + For all qualifying tracefiles, seek to the start time, create a context, + read one event and insert in the pqueue based on the event time. */ + + lttv_hooks_call(self->before, self); + nbi = lttv_traceset_number(self->ts); + self->pqueue = g_tree_new(compare_tracefile); + + for(i = 0 ; i < nbi ; i++) { + tc = self->traces[i]; + + if(!lttv_hooks_call_check(tc->check, tc)) { + lttv_hooks_call(tc->before, tc); + nb_tracefile = ltt_trace_control_tracefile_number(tc->t) + + ltt_trace_per_cpu_tracefile_number(tc->t); + + for(j = 0 ; j < nb_tracefile ; j++) { + tfc = tc->tracefiles[j]; + + if(!lttv_hooks_call_check(tfc->check, tfc)) { + lttv_hooks_call(tfc->before, tfc); + + if(tfc->e != NULL) { + if(tfc->timestamp.tv_sec < end.tv_sec || + (tfc->timestamp.tv_sec == end.tv_sec && + tfc->timestamp.tv_nsec <= end.tv_nsec)) { + g_tree_insert(self->pqueue, tfc, tfc); + } + } + } + } + } + } +} + + +guint lttv_process_traceset_middle(LttvTracesetContext *self, LttTime end, + unsigned nb_events) +{ + GTree *pqueue = self->pqueue; + + guint id; + + LttvTraceContext *tc; + + LttvTracefileContext *tfc; + + LttEvent *event; + + unsigned count = 0; + + LttTime previous_timestamp = {0, 0}; + + /* Get the next event from the pqueue, call its hooks, + reinsert in the pqueue the following event from the same tracefile + unless the tracefile is finished or the event is later than the + start time. */ + + while(TRUE) { + tfc = NULL; + g_tree_foreach(pqueue, get_first, &tfc); + if(tfc == NULL) return count; + + /* Have we reached the maximum number of events specified? However, + continue for all the events with the same time stamp (CHECK?). Then, + empty the queue and break from the loop. */ + + if(count >= nb_events && + ltt_time_compare(tfc->timestamp, previous_timestamp) != 0) + return count; + + previous_timestamp = tfc->timestamp; + + + /* Get the tracefile with an event for the smallest time found. If two + or more tracefiles have events for the same time, hope that lookup + and remove are consistent. */ + + g_tree_remove(pqueue, tfc); + count++; + + if(!lttv_hooks_call(tfc->check_event, tfc)) { + id = ltt_event_eventtype_id(tfc->e); + lttv_hooks_call(lttv_hooks_by_id_get(tfc->before_event_by_id, id), tfc); + lttv_hooks_call(tfc->before_event, tfc); + lttv_hooks_call(lttv_hooks_by_id_get(tfc->after_event_by_id, id), tfc); + lttv_hooks_call(tfc->after_event, tfc); + } + + event = ltt_tracefile_read(tfc->tf); + if(event != NULL) { + tfc->e = event; + tfc->timestamp = ltt_event_time(event); + if(tfc->timestamp.tv_sec < end.tv_sec || + (tfc->timestamp.tv_sec == end.tv_sec && tfc->timestamp.tv_nsec <= end.tv_nsec)) + g_tree_insert(pqueue, tfc, tfc); + } + } +} + + +void lttv_process_traceset_end(LttvTracesetContext *self) +{ + guint i, j, nbi, nb_tracefile; + + LttvTraceContext *tc; + + LttvTracefileContext *tfc; + + /* Call all after_traceset, after_trace, and after_tracefile hooks. */ + + nbi = lttv_traceset_number(self->ts); + + for(i = 0 ; i < nbi ; i++) { + tc = self->traces[i]; + + /* The check hooks are called again to avoid memorizing the results + obtained at the beginning. CHECK if it poses a problem */ + + if(!lttv_hooks_call_check(tc->check, tc)) { + nb_tracefile = ltt_trace_control_tracefile_number(tc->t) + + ltt_trace_per_cpu_tracefile_number(tc->t); + + for(j = 0 ; j < nb_tracefile ; j++) { + tfc = tc->tracefiles[j]; + + if(!lttv_hooks_call_check(tfc->check, tfc)) { + lttv_hooks_call(tfc->after, tfc); + } + } + lttv_hooks_call(tc->after, tc); + } + } + lttv_hooks_call(self->after, self); + + /* Empty and free the pqueue */ + + while(TRUE){ + tfc = NULL; + g_tree_foreach(self->pqueue, get_first, &tfc); + if(tfc == NULL) break; + g_tree_remove(self->pqueue, &(tfc->timestamp)); + } + g_tree_destroy(self->pqueue); +} + + +void lttv_process_traceset(LttvTracesetContext *self, LttTime end, + unsigned nb_events) +{ + lttv_process_traceset_begin(self, end); + lttv_process_traceset_middle(self, end, nb_events); + lttv_process_traceset_end(self); +} + + +void lttv_process_trace_seek_time(LttvTraceContext *self, LttTime start) +{ + guint i, nb_tracefile; + + LttvTracefileContext *tfc; + + LttEvent *event; + + nb_tracefile = ltt_trace_control_tracefile_number(self->t) + + ltt_trace_per_cpu_tracefile_number(self->t); + + for(i = 0 ; i < nb_tracefile ; i++) { + tfc = self->tracefiles[i]; + ltt_tracefile_seek_time(tfc->tf, start); + event = ltt_tracefile_read(tfc->tf); + tfc->e = event; + if(event != NULL) tfc->timestamp = ltt_event_time(event); + } +} + + +void lttv_process_traceset_seek_time(LttvTracesetContext *self, LttTime start) +{ + guint i, nb_trace; + + LttvTraceContext *tc; + + nb_trace = lttv_traceset_number(self->ts); + for(i = 0 ; i < nb_trace ; i++) { + tc = self->traces[i]; + lttv_process_trace_seek_time(tc, start); + } +} + + +static LttField * +find_field(LttEventType *et, const char *field) +{ + LttType *t; + + LttField *f; + + guint i, nb; + + char *name; + + if(field == NULL) return NULL; + + f = ltt_eventtype_field(et); + t = ltt_eventtype_type(et); + g_assert(ltt_type_class(t) == LTT_STRUCT); + nb = ltt_type_member_number(t); + for(i = 0 ; i < nb ; i++) { + ltt_type_member_type(t, i, &name); + if(strcmp(name, field) == 0) break; + } + g_assert(i < nb); + return ltt_field_member(f, i); +} + + +void +lttv_trace_find_hook(LttTrace *t, char *facility, char *event_type, + char *field1, char *field2, char *field3, LttvHook h, LttvTraceHook *th) +{ + LttFacility *f; + + LttEventType *et; + + guint nb, pos, i; + + char *name; + + nb = ltt_trace_facility_find(t, facility, &pos); + if(nb < 1) g_error("No %s facility", facility); + f = ltt_trace_facility_get(t, pos); + et = ltt_facility_eventtype_get_by_name(f, event_type); + if(et == NULL) g_error("Event %s does not exist", event_type); + + th->h = h; + th->id = ltt_eventtype_id(et); + th->f1 = find_field(et, field1); + th->f2 = find_field(et, field2); + th->f3 = find_field(et, field3); +} + + diff --git a/ltt/branches/poly/lttv/modules/gui/Makefile.am b/ltt/branches/poly/lttv/modules/gui/Makefile.am index bcbf41b8..7b3fd205 100644 --- a/ltt/branches/poly/lttv/modules/gui/Makefile.am +++ b/ltt/branches/poly/lttv/modules/gui/Makefile.am @@ -6,5 +6,5 @@ # WARNING : subdirs order is important : mainWin depends on API -SUBDIRS = mainlib main icons controlflow detailedevents statistics +SUBDIRS = lttvgui lttvwindow controlflow detailedevents statistics diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/Makefile.am b/ltt/branches/poly/lttv/modules/gui/controlflow/Makefile.am index 2ec98b80..6938e2ff 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/Makefile.am +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/Makefile.am @@ -36,3 +36,6 @@ libguicontrolflow_la_SOURCES = module.c eventhooks.c cfv.c processlist.c\ noinst_HEADERS = eventhooks.h cfv.h cfv-private.h processlist.h\ drawing.h drawitem.h + +EXTRA_DIST = \ + hGuiControlFlowInsert.xpm \ No newline at end of file diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/cfv.h b/ltt/branches/poly/lttv/modules/gui/controlflow/cfv.h index 30015c36..928936d5 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/cfv.h +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/cfv.h @@ -22,8 +22,8 @@ #define _CFV_H #include -#include -#include +#include +#include #include "processlist.h" typedef struct _ControlFlowData ControlFlowData; diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c b/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c index 7f4ee2f4..bc2297ca 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include "drawing.h" diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c b/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c index 8b990961..38748bed 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c @@ -38,9 +38,9 @@ #include #include -#include +#include #include -#include +#include #include "eventhooks.h" diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.h b/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.h index fdb9edd0..134307bd 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.h +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.h @@ -27,7 +27,7 @@ #define _EVENT_HOOKS_H #include -#include +#include #include #include "processlist.h" diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/hGuiControlFlowInsert.xpm b/ltt/branches/poly/lttv/modules/gui/controlflow/hGuiControlFlowInsert.xpm new file mode 100644 index 00000000..db4b7275 --- /dev/null +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/hGuiControlFlowInsert.xpm @@ -0,0 +1,28 @@ +/* XPM */ +static char * hGuiControlFlowInsert_xpm[] = { +"22 22 3 1", +" c None", +". c #0DF904", +"+ c #F90404", +" ", +" . ", +" .. ", +" ... ", +" .... ", +" ... ", +" .. ", +" . ", +" ", +"++++++++++............", +"++++++++++............", +" ", +" ++++++ ", +" ++++++ ", +" ++++++ ", +" ++++++ ", +" ++++++ ", +" ++++++ ", +" ", +"..........++++++++++++", +"..........++++++++++++", +" "}; diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/module.c b/ltt/branches/poly/lttv/modules/gui/controlflow/module.c index 69694d6f..5b9751d5 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/module.c +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/module.c @@ -40,12 +40,12 @@ #include #include #include -#include +#include #include "cfv.h" #include "eventhooks.h" -#include "../icons/hGuiControlFlowInsert.xpm" +#include "hGuiControlFlowInsert.xpm" static LttvModule *Main_Win_Module; diff --git a/ltt/branches/poly/lttv/modules/gui/detailedevents/Makefile.am b/ltt/branches/poly/lttv/modules/gui/detailedevents/Makefile.am index b5808cc3..527db859 100644 --- a/ltt/branches/poly/lttv/modules/gui/detailedevents/Makefile.am +++ b/ltt/branches/poly/lttv/modules/gui/detailedevents/Makefile.am @@ -35,3 +35,5 @@ libguievents_la_LDFLAGS = -module libguievents_la_SOURCES = events.c noinst_HEADERS = gtkrbtree.h gtktreeprivate.h +EXTRA_DIST = \ + hGuiEventsInsert.xpm \ No newline at end of file diff --git a/ltt/branches/poly/lttv/modules/gui/detailedevents/events.c b/ltt/branches/poly/lttv/modules/gui/detailedevents/events.c index 51d51aa1..2b2ceaad 100644 --- a/ltt/branches/poly/lttv/modules/gui/detailedevents/events.c +++ b/ltt/branches/poly/lttv/modules/gui/detailedevents/events.c @@ -45,7 +45,7 @@ #include #include -#include +#include #include #include #include @@ -58,7 +58,7 @@ //#include "mw_api.h" #include "gtktreeprivate.h" -#include "../icons/hGuiEventsInsert.xpm" +#include "hGuiEventsInsert.xpm" static LttvHooks *before_event; diff --git a/ltt/branches/poly/lttv/modules/gui/detailedevents/hGuiEventsInsert.xpm b/ltt/branches/poly/lttv/modules/gui/detailedevents/hGuiEventsInsert.xpm new file mode 100644 index 00000000..159209bf --- /dev/null +++ b/ltt/branches/poly/lttv/modules/gui/detailedevents/hGuiEventsInsert.xpm @@ -0,0 +1,230 @@ +/* XPM */ +static char * hGuiEventsInsert_xpm[] = { +"22 22 205 2", +" c None", +". c #3995E5", +"+ c #449DE8", +"@ c #4BA0EA", +"# c #479BE7", +"$ c #4395E5", +"% c #3F8FE2", +"& c #3A89E0", +"* c #3683DD", +"= c #327DDB", +"- c #2D77D8", +"; c #2971D6", +"> c #246BD3", +", c #2065D1", +"' c #1B5FCE", +") c #1759CC", +"! c #1253C9", +"~ c #0E4DC7", +"{ c #0A47C4", +"] c #0742C2", +"^ c #053FBF", +"/ c #0238B2", +"( c #0032A4", +"_ c #8BCFFF", +": c #84C9FF", +"< c #7DC1FF", +"[ c #75BAFF", +"} c #6DB2FF", +"| c #65AAFF", +"1 c #5DA1FF", +"2 c #5499FF", +"3 c #4B90FF", +"4 c #4287FF", +"5 c #397FFF", +"6 c #3076FF", +"7 c #276DFF", +"8 c #1E64FF", +"9 c #155BFF", +"0 c #0C52FF", +"a c #044AFF", +"b c #0349FF", +"c c #0340F1", +"d c #0032AB", +"e c #4DA3EC", +"f c #84C8FF", +"g c #7EC2FF", +"h c #77BBFF", +"i c #70B4FF", +"j c #68ADFF", +"k c #60A5FF", +"l c #589DFF", +"m c #5095FF", +"n c #488DFF", +"o c #3F84FF", +"p c #367BFF", +"q c #2D73FF", +"r c #246AFF", +"s c #1C61FF", +"t c #1358FF", +"u c #0A4FFF", +"v c #0343F6", +"w c #0132B1", +"x c #5BA8EB", +"y c #BFE1FF", +"z c #BCDEFF", +"A c #B9DBFF", +"B c #B5D7FF", +"C c #B1D4FF", +"D c #AED0FF", +"E c #AACCFF", +"F c #A6C8FF", +"G c #A2C4FF", +"H c #9DC0FF", +"I c #99BCFF", +"J c #95B8FF", +"K c #90B3FF", +"L c #8CAFFF", +"M c #87AAFF", +"N c #82A5FE", +"O c #7FA2FE", +"P c #7EA1FD", +"Q c #7DA0FD", +"R c #7A9AF5", +"S c #1D48B3", +"T c #6AAFEB", +"U c #FFFFFF", +"V c #FEFEFF", +"W c #FDFDFE", +"X c #FBFBFC", +"Y c #F9F9FB", +"Z c #F7F7FA", +"` c #F6F6F9", +" . c #F0EFF4", +".. c #385EB5", +"+. c #69AEEA", +"@. c #F4F4F8", +"#. c #EEEDF3", +"$. c #385DB4", +"%. c #69ACE9", +"&. c #848484", +"*. c #7F7F7F", +"=. c #808080", +"-. c #7E7E7F", +";. c #7D7D7E", +">. c #7C7C7D", +",. c #7B7B7D", +"'. c #7B7B7C", +"). c #7A7A7C", +"!. c #F2F2F7", +"~. c #ECEBF2", +"{. c #375CB4", +"]. c #68AAE8", +"^. c #FBFBFD", +"/. c #F1F1F6", +"(. c #E9E9F0", +"_. c #365BB3", +":. c #67A9E7", +"<. c #F8F8FB", +"[. c #F3F3F7", +"}. c #EFEFF5", +"|. c #E7E7EE", +"1. c #355AB2", +"2. c #66A7E6", +"3. c #858585", +"4. c #7C7C7E", +"5. c #79797B", +"6. c #78787B", +"7. c #7B7B7E", +"8. c #EDEDF4", +"9. c #E5E5ED", +"0. c #3459B2", +"a. c #65A6E5", +"b. c #F9F9FC", +"c. c #ECECF3", +"d. c #E3E3EC", +"e. c #3358B1", +"f. c #64A5E4", +"g. c #F6F6FA", +"h. c #EAEAF2", +"i. c #E1E1EA", +"j. c #3358B0", +"k. c #63A3E3", +"l. c #8D8D8D", +"m. c #8A8A8C", +"n. c #77777A", +"o. c #76767A", +"p. c #767679", +"q. c #808085", +"r. c #E8E8F1", +"s. c #DFDFE9", +"t. c #3257B0", +"u. c #62A2E2", +"v. c #FAFAFC", +"w. c #F4F4F9", +"x. c #EEEEF4", +"y. c #E7E7F0", +"z. c #DEDDE8", +"A. c #62A0E1", +"B. c #E5E5EF", +"C. c #DCDCE7", +"D. c #619FE1", +"E. c #8A8A8B", +"F. c #87878A", +"G. c #757579", +"H. c #747478", +"I. c #737378", +"J. c #7E7E83", +"K. c #E3E3EE", +"L. c #DBDBE6", +"M. c #609DDF", +"N. c #F3F3F8", +"O. c #F1F1F7", +"P. c #E2E2ED", +"Q. c #DAD9E6", +"R. c #5E9ADE", +"S. c #FAFAFB", +"T. c #F9F9FA", +"U. c #F7F6F9", +"V. c #F5F4F7", +"W. c #F2F2F6", +"X. c #F1F0F5", +"Y. c #EFEEF3", +"Z. c #EDECF2", +"`. c #EBEAF1", +" + c #E9E8EF", +".+ c #E7E6EE", +"++ c #E4E4ED", +"@+ c #E3E2EB", +"#+ c #E1E0EA", +"$+ c #D4D3E0", +"%+ c #357FD4", +"&+ c #5791D7", +"*+ c #548CD4", +"=+ c #5188D1", +"-+ c #4E83CE", +";+ c #4B7ECA", +">+ c #487AC7", +",+ c #4575C4", +"'+ c #4271C1", +")+ c #406CBE", +"!+ c #3D68BB", +"~+ c #3A63B8", +"{+ c #375FB5", +"]+ c #345AB2", +"^+ c #0C3BA7", +" ", +". + @ # $ % & * = - ; > , ' ) ! ~ { ] ^ / ( ", +"+ _ : < [ } | 1 2 3 4 5 6 7 8 9 0 a b b c d ", +"e f g h i j k l m n o p q r s t u b b b v w ", +"x y z A B C D E F G H I J K L M N O P Q R S ", +"T U U U U U U U U U U U U U V W X Y Z ` ...", +"+.U U U U U U U U U U U U V W X Y Z ` @.#.$.", +"%.U U &.*.*.*.U U =.=.*.*.-.;.>.,.'.).!.~.{.", +"].U U U U U U U U U U V W ^.Y Z ` @.!./.(._.", +":.U U U U U U U U U V W ^.Y <.` @.[./.}.|.1.", +"2.U U 3.*.*.*.U U *.=.;.4.>.'.).5.6.7.8.9.0.", +"a.U U U U U U U U W ^.b.<.` @.[./.}.8.c.d.e.", +"f.U U U U U U U W ^.b.<.g.@.[./.}.8.c.h.i.j.", +"k.U U *.*.*.l.W ^.4.m.,.).5.6.n.o.p.q.r.s.t.", +"u.U U U U U W ^.v.<.g.w.[./.}.x.c.h.r.y.z.t.", +"A.U U U U W ^.v.<.g.w.[./.}.x.c.h.r.y.B.C.t.", +"D.U U *.-.;.E.<.g.).F.6.n.n.p.G.H.I.J.K.L.t.", +"M.U U W ^.v.<.g.w.N.O.}.x.c.h.r.y.B.K.P.Q.t.", +"R.S.T.U.V.W.X.Y.Z.`. +.+++@+#+s.z.C.L.Q.$+t.", +"%+&+*+=+-+;+>+,+'+)+!+~+{+]+t.t.t.t.t.t.t.^+", +" ", +" "}; diff --git a/ltt/branches/poly/lttv/modules/gui/icons/Makefile.am b/ltt/branches/poly/lttv/modules/gui/icons/Makefile.am deleted file mode 100644 index 2363c363..00000000 --- a/ltt/branches/poly/lttv/modules/gui/icons/Makefile.am +++ /dev/null @@ -1,30 +0,0 @@ -# This file is part of the Linux Trace Toolkit viewer -# Copyright (C) 2003-2004 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. - - - -# -# Makefile for LTT New generation user interface. -# -# Created by Mathieu Desnoyers on May 6, 2003 -# - -EXTRA_DIST = \ - hGuiControlFlowInsert.xpm\ - hGuiEventsInsert.xpm\ - hGuiStatisticInsert.xpm - diff --git a/ltt/branches/poly/lttv/modules/gui/icons/hGuiControlFlowInsert.xpm b/ltt/branches/poly/lttv/modules/gui/icons/hGuiControlFlowInsert.xpm deleted file mode 100644 index db4b7275..00000000 --- a/ltt/branches/poly/lttv/modules/gui/icons/hGuiControlFlowInsert.xpm +++ /dev/null @@ -1,28 +0,0 @@ -/* XPM */ -static char * hGuiControlFlowInsert_xpm[] = { -"22 22 3 1", -" c None", -". c #0DF904", -"+ c #F90404", -" ", -" . ", -" .. ", -" ... ", -" .... ", -" ... ", -" .. ", -" . ", -" ", -"++++++++++............", -"++++++++++............", -" ", -" ++++++ ", -" ++++++ ", -" ++++++ ", -" ++++++ ", -" ++++++ ", -" ++++++ ", -" ", -"..........++++++++++++", -"..........++++++++++++", -" "}; diff --git a/ltt/branches/poly/lttv/modules/gui/icons/hGuiEventsInsert.xpm b/ltt/branches/poly/lttv/modules/gui/icons/hGuiEventsInsert.xpm deleted file mode 100644 index 159209bf..00000000 --- a/ltt/branches/poly/lttv/modules/gui/icons/hGuiEventsInsert.xpm +++ /dev/null @@ -1,230 +0,0 @@ -/* XPM */ -static char * hGuiEventsInsert_xpm[] = { -"22 22 205 2", -" c None", -". c #3995E5", -"+ c #449DE8", -"@ c #4BA0EA", -"# c #479BE7", -"$ c #4395E5", -"% c #3F8FE2", -"& c #3A89E0", -"* c #3683DD", -"= c #327DDB", -"- c #2D77D8", -"; c #2971D6", -"> c #246BD3", -", c #2065D1", -"' c #1B5FCE", -") c #1759CC", -"! c #1253C9", -"~ c #0E4DC7", -"{ c #0A47C4", -"] c #0742C2", -"^ c #053FBF", -"/ c #0238B2", -"( c #0032A4", -"_ c #8BCFFF", -": c #84C9FF", -"< c #7DC1FF", -"[ c #75BAFF", -"} c #6DB2FF", -"| c #65AAFF", -"1 c #5DA1FF", -"2 c #5499FF", -"3 c #4B90FF", -"4 c #4287FF", -"5 c #397FFF", -"6 c #3076FF", -"7 c #276DFF", -"8 c #1E64FF", -"9 c #155BFF", -"0 c #0C52FF", -"a c #044AFF", -"b c #0349FF", -"c c #0340F1", -"d c #0032AB", -"e c #4DA3EC", -"f c #84C8FF", -"g c #7EC2FF", -"h c #77BBFF", -"i c #70B4FF", -"j c #68ADFF", -"k c #60A5FF", -"l c #589DFF", -"m c #5095FF", -"n c #488DFF", -"o c #3F84FF", -"p c #367BFF", -"q c #2D73FF", -"r c #246AFF", -"s c #1C61FF", -"t c #1358FF", -"u c #0A4FFF", -"v c #0343F6", -"w c #0132B1", -"x c #5BA8EB", -"y c #BFE1FF", -"z c #BCDEFF", -"A c #B9DBFF", -"B c #B5D7FF", -"C c #B1D4FF", -"D c #AED0FF", -"E c #AACCFF", -"F c #A6C8FF", -"G c #A2C4FF", -"H c #9DC0FF", -"I c #99BCFF", -"J c #95B8FF", -"K c #90B3FF", -"L c #8CAFFF", -"M c #87AAFF", -"N c #82A5FE", -"O c #7FA2FE", -"P c #7EA1FD", -"Q c #7DA0FD", -"R c #7A9AF5", -"S c #1D48B3", -"T c #6AAFEB", -"U c #FFFFFF", -"V c #FEFEFF", -"W c #FDFDFE", -"X c #FBFBFC", -"Y c #F9F9FB", -"Z c #F7F7FA", -"` c #F6F6F9", -" . c #F0EFF4", -".. c #385EB5", -"+. c #69AEEA", -"@. c #F4F4F8", -"#. c #EEEDF3", -"$. c #385DB4", -"%. c #69ACE9", -"&. c #848484", -"*. c #7F7F7F", -"=. c #808080", -"-. c #7E7E7F", -";. c #7D7D7E", -">. c #7C7C7D", -",. c #7B7B7D", -"'. c #7B7B7C", -"). c #7A7A7C", -"!. c #F2F2F7", -"~. c #ECEBF2", -"{. c #375CB4", -"]. c #68AAE8", -"^. c #FBFBFD", -"/. c #F1F1F6", -"(. c #E9E9F0", -"_. c #365BB3", -":. c #67A9E7", -"<. c #F8F8FB", -"[. c #F3F3F7", -"}. c #EFEFF5", -"|. c #E7E7EE", -"1. c #355AB2", -"2. c #66A7E6", -"3. c #858585", -"4. c #7C7C7E", -"5. c #79797B", -"6. c #78787B", -"7. c #7B7B7E", -"8. c #EDEDF4", -"9. c #E5E5ED", -"0. c #3459B2", -"a. c #65A6E5", -"b. c #F9F9FC", -"c. c #ECECF3", -"d. c #E3E3EC", -"e. c #3358B1", -"f. c #64A5E4", -"g. c #F6F6FA", -"h. c #EAEAF2", -"i. c #E1E1EA", -"j. c #3358B0", -"k. c #63A3E3", -"l. c #8D8D8D", -"m. c #8A8A8C", -"n. c #77777A", -"o. c #76767A", -"p. c #767679", -"q. c #808085", -"r. c #E8E8F1", -"s. c #DFDFE9", -"t. c #3257B0", -"u. c #62A2E2", -"v. c #FAFAFC", -"w. c #F4F4F9", -"x. c #EEEEF4", -"y. c #E7E7F0", -"z. c #DEDDE8", -"A. c #62A0E1", -"B. c #E5E5EF", -"C. c #DCDCE7", -"D. c #619FE1", -"E. c #8A8A8B", -"F. c #87878A", -"G. c #757579", -"H. c #747478", -"I. c #737378", -"J. c #7E7E83", -"K. c #E3E3EE", -"L. c #DBDBE6", -"M. c #609DDF", -"N. c #F3F3F8", -"O. c #F1F1F7", -"P. c #E2E2ED", -"Q. c #DAD9E6", -"R. c #5E9ADE", -"S. c #FAFAFB", -"T. c #F9F9FA", -"U. c #F7F6F9", -"V. c #F5F4F7", -"W. c #F2F2F6", -"X. c #F1F0F5", -"Y. c #EFEEF3", -"Z. c #EDECF2", -"`. c #EBEAF1", -" + c #E9E8EF", -".+ c #E7E6EE", -"++ c #E4E4ED", -"@+ c #E3E2EB", -"#+ c #E1E0EA", -"$+ c #D4D3E0", -"%+ c #357FD4", -"&+ c #5791D7", -"*+ c #548CD4", -"=+ c #5188D1", -"-+ c #4E83CE", -";+ c #4B7ECA", -">+ c #487AC7", -",+ c #4575C4", -"'+ c #4271C1", -")+ c #406CBE", -"!+ c #3D68BB", -"~+ c #3A63B8", -"{+ c #375FB5", -"]+ c #345AB2", -"^+ c #0C3BA7", -" ", -". + @ # $ % & * = - ; > , ' ) ! ~ { ] ^ / ( ", -"+ _ : < [ } | 1 2 3 4 5 6 7 8 9 0 a b b c d ", -"e f g h i j k l m n o p q r s t u b b b v w ", -"x y z A B C D E F G H I J K L M N O P Q R S ", -"T U U U U U U U U U U U U U V W X Y Z ` ...", -"+.U U U U U U U U U U U U V W X Y Z ` @.#.$.", -"%.U U &.*.*.*.U U =.=.*.*.-.;.>.,.'.).!.~.{.", -"].U U U U U U U U U U V W ^.Y Z ` @.!./.(._.", -":.U U U U U U U U U V W ^.Y <.` @.[./.}.|.1.", -"2.U U 3.*.*.*.U U *.=.;.4.>.'.).5.6.7.8.9.0.", -"a.U U U U U U U U W ^.b.<.` @.[./.}.8.c.d.e.", -"f.U U U U U U U W ^.b.<.g.@.[./.}.8.c.h.i.j.", -"k.U U *.*.*.l.W ^.4.m.,.).5.6.n.o.p.q.r.s.t.", -"u.U U U U U W ^.v.<.g.w.[./.}.x.c.h.r.y.z.t.", -"A.U U U U W ^.v.<.g.w.[./.}.x.c.h.r.y.B.C.t.", -"D.U U *.-.;.E.<.g.).F.6.n.n.p.G.H.I.J.K.L.t.", -"M.U U W ^.v.<.g.w.N.O.}.x.c.h.r.y.B.K.P.Q.t.", -"R.S.T.U.V.W.X.Y.Z.`. +.+++@+#+s.z.C.L.Q.$+t.", -"%+&+*+=+-+;+>+,+'+)+!+~+{+]+t.t.t.t.t.t.t.^+", -" ", -" "}; diff --git a/ltt/branches/poly/lttv/modules/gui/icons/hGuiStatisticInsert.xpm b/ltt/branches/poly/lttv/modules/gui/icons/hGuiStatisticInsert.xpm deleted file mode 100644 index 1a78b4de..00000000 --- a/ltt/branches/poly/lttv/modules/gui/icons/hGuiStatisticInsert.xpm +++ /dev/null @@ -1,27 +0,0 @@ -/* XPM */ -static char * hGuiStatisticInsert_xpm[] = { -"22 22 2 1", -" c None", -". c #800080", -" ", -" ", -" ", -" .............. ", -" .... ... ", -" .... . ", -" .... . ", -" .... ", -" .... ", -" .... ", -" .... ", -" ... ", -" ... ", -" ... ", -" ... ", -" ... ", -" ... . ", -" ... . ", -" ... ... ", -" .............. ", -" ", -" "}; diff --git a/ltt/branches/poly/lttv/modules/gui/lttvgui/Makefile.am b/ltt/branches/poly/lttv/modules/gui/lttvgui/Makefile.am new file mode 100644 index 00000000..4562409b --- /dev/null +++ b/ltt/branches/poly/lttv/modules/gui/lttvgui/Makefile.am @@ -0,0 +1,28 @@ +# +# Makefile for LTT New generation user interface : plugins. +# +# Created by Mathieu Desnoyers on May 6, 2003 +# + +libdir = ${lttvlibdir} + +AM_CFLAGS = $(GLIB_CFLAGS) +AM_CFLAGS += $(GTK_CFLAGS) +LIBS += $(GLIB_LIBS) +LIBS += $(GTK_LIBS) + +lib_LTLIBRARIES = libmainwinapi.la +libmainwinapi_la_SOURCES = toolbar.c menu.c gtktraceset.c +#libmainwinapi_la_LDFLAGS = -L${top_srcdir}/lttv/modules/gui/API -lcustomBox + +lttvguiinclude_HEADERS = \ + common.h\ + gtkdirsel.h\ + gtkmultivpaned.h\ + gtktraceset.h\ + lttvfilter.h\ + mainwindow.h\ + menu.h\ + toolbar.h + +EXTRA_DIST = diff --git a/ltt/branches/poly/lttv/modules/gui/lttvgui/common.h b/ltt/branches/poly/lttv/modules/gui/lttvgui/common.h new file mode 100644 index 00000000..5ec75179 --- /dev/null +++ b/ltt/branches/poly/lttv/modules/gui/lttvgui/common.h @@ -0,0 +1,43 @@ +/* This file is part of the Linux Trace Toolkit viewer + * Copyright (C) 2003-2004 Xiangxiu Yang + * + * 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 COMMON_H +#define COMMON_H + +#include +#include +#include +#include + +#define MAX_NUMBER_EVENT "MAX_NUMBER_EVENT" +#define TRACESET_TIME_SPAN "TRACESET_TIME_SPAN" + +typedef struct _MainWindow MainWindow; +typedef struct _Tab Tab; + +/* constructor of the viewer */ +typedef GtkWidget * (*lttv_constructor)(MainWindow * main_window, + LttvTracesetSelector * s, char *key); +typedef lttv_constructor view_constructor; + +typedef struct _TimeWindow { + LttTime start_time; + LttTime time_width; +} TimeWindow; + +#endif // COMMON_H diff --git a/ltt/branches/poly/lttv/modules/gui/lttvgui/gtkdirsel.h b/ltt/branches/poly/lttv/modules/gui/lttvgui/gtkdirsel.h new file mode 100644 index 00000000..103ced2d --- /dev/null +++ b/ltt/branches/poly/lttv/modules/gui/lttvgui/gtkdirsel.h @@ -0,0 +1,115 @@ +/* This file is part of the Linux Trace Toolkit viewer + * Copyright (C) 2003-2004 Xiangxiu Yang + * + * 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 __GTK_DIR_SEL_H__ +#define __GTK_DIR_SEL_H__ + + +#include +#include + + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +#define GTK_TYPE_DIR_SELECTION (gtk_dir_selection_get_type ()) +#define GTK_DIR_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_DIR_SELECTION, GtkDirSelection)) +#define GTK_DIR_SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_DIR_SELECTION, GtkDirSelectionClass)) +#define GTK_IS_DIR_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_DIR_SELECTION)) +#define GTK_IS_DIR_SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_DIR_SELECTION)) +#define GTK_DIR_SELECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_DIR_SELECTION, GtkDirSelectionClass)) + + +typedef struct _GtkDirSelection GtkDirSelection; +typedef struct _GtkDirSelectionClass GtkDirSelectionClass; + +struct _GtkDirSelection +{ + GtkDialog parent_instance; + + GtkWidget *dir_list; + GtkWidget *file_list; + GtkWidget *selection_entry; + GtkWidget *selection_text; + GtkWidget *main_vbox; + GtkWidget *ok_button; + GtkWidget *cancel_button; + GtkWidget *help_button; + GtkWidget *history_pulldown; + GtkWidget *history_menu; + GList *history_list; + GtkWidget *fileop_dialog; + GtkWidget *fileop_entry; + gchar *fileop_file; + gpointer cmpl_state; + + GtkWidget *fileop_c_dir; + GtkWidget *fileop_del_file; + GtkWidget *fileop_ren_file; + + GtkWidget *button_area; + GtkWidget *action_area; + + GPtrArray *selected_names; + gchar *last_selected; +}; + +struct _GtkDirSelectionClass +{ + GtkDialogClass parent_class; + + /* Padding for future expansion */ + void (*_gtk_reserved1) (void); + void (*_gtk_reserved2) (void); + void (*_gtk_reserved3) (void); + void (*_gtk_reserved4) (void); +}; + + +GType gtk_dir_selection_get_type (void) G_GNUC_CONST; +GtkWidget* gtk_dir_selection_new (const gchar *title); +void gtk_dir_selection_set_filename (GtkDirSelection *filesel, + const gchar *filename); +/* This function returns the selected filename in the C runtime's + * multibyte string encoding, which may or may not be the same as that + * used by GDK (UTF-8). To convert to UTF-8, call g_filename_to_utf8(). + * The returned string points to a statically allocated buffer and + * should be copied away. + */ +G_CONST_RETURN gchar* gtk_dir_selection_get_filename (GtkDirSelection *filesel); + +void gtk_dir_selection_complete (GtkDirSelection *filesel, + const gchar *pattern); +void gtk_dir_selection_show_fileop_buttons (GtkDirSelection *filesel); +void gtk_dir_selection_hide_fileop_buttons (GtkDirSelection *filesel); + +gchar** gtk_dir_selection_get_selections (GtkDirSelection *filesel); +const gchar * gtk_dir_selection_get_dir (GtkDirSelection *filesel); +void gtk_dir_selection_set_select_multiple (GtkDirSelection *filesel, + gboolean select_multiple); +gboolean gtk_dir_selection_get_select_multiple (GtkDirSelection *filesel); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* __GTK_DIR_SEL_H__ */ diff --git a/ltt/branches/poly/lttv/modules/gui/lttvgui/gtkmultivpaned.h b/ltt/branches/poly/lttv/modules/gui/lttvgui/gtkmultivpaned.h new file mode 100644 index 00000000..f6ab2e49 --- /dev/null +++ b/ltt/branches/poly/lttv/modules/gui/lttvgui/gtkmultivpaned.h @@ -0,0 +1,92 @@ + +/* This file is part of the Linux Trace Toolkit viewer + * Copyright (C) 2003-2004 Xiangxiu Yang + * + * 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 __GTK_MULTI_VPANED_H__ +#define __GTK_MULTI_VPANED_H__ + + +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +#define GTK_TYPE_MULTI_VPANED (gtk_multi_vpaned_get_type ()) +#define GTK_MULTI_VPANED(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_MULTI_VPANED, GtkMultiVPaned)) +#define GTK_MULTI_VPANED_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_MULTI_VPANED, GtkMultiVPanedClass)) +#define GTK_IS_MULTI_VPANED(obj ) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_MULTI_VPANED)) +#define GTK_IS_MULTI_VPANED_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MULTI_VPANED)) +#define GTK_MULTI_VPANED_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_MULTI_VPANED, GtkMultiVPanedClass)) + + +typedef struct _GtkMultiVPaned GtkMultiVPaned; +typedef struct _GtkMultiVPanedClass GtkMultiVPanedClass; + +struct _GtkMultiVPaned +{ + GtkPaned container; + + /*< public >*/ + GtkPaned * first_pane; + GtkPaned * last_pane; + GtkPaned * focused_pane; + GtkPaned * iter; + guint num_children; + + GtkWidget * vbox; + // GtkWidget * scrollWindow; + // GtkWidget * viewport; + GtkWidget * hscrollbar; + GtkAdjustment *hadjust; + MainWindow * mw; +}; + +struct _GtkMultiVPanedClass +{ + GtkPanedClass parent_class; +}; + + +GType gtk_multi_vpaned_get_type (void) G_GNUC_CONST; +GtkWidget* gtk_multi_vpaned_new (void); + +void gtk_multi_vpaned_set_focus (GtkWidget * widget, gpointer user_data); +void gtk_multi_vpaned_widget_add(GtkMultiVPaned * multi_vpaned, GtkWidget * widget1); +void gtk_multi_vpaned_widget_delete(GtkMultiVPaned * multi_vpaned); +void gtk_multi_vpaned_widget_move_up(GtkMultiVPaned * multi_vpaned); +void gtk_multi_vpaned_widget_move_down(GtkMultiVPaned * multi_vpaned); +void gtk_multi_vpaned_set_adjust(GtkMultiVPaned * multi_vpaned, gboolean first_time); +void gtk_multi_vpaned_set_data(GtkMultiVPaned * multi_vpaned, char * key, gpointer value); +gpointer gtk_multi_vpaned_get_data(GtkMultiVPaned * multi_vpaned, char * key); +GtkWidget * gtk_multi_vpaned_get_widget(GtkMultiVPaned * multi_vpaned); +GtkWidget * gtk_multi_vpaned_get_first_widget(GtkMultiVPaned * multi_vpaned); +GtkWidget * gtk_multi_vpaned_get_next_widget(GtkMultiVPaned * multi_vpaned); +void gtk_multi_vpaned_set_scroll_value(GtkMultiVPaned * multi_vpaned, double value); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* __GTK_MULTI_VPANED_H__ */ diff --git a/ltt/branches/poly/lttv/modules/gui/lttvgui/gtktraceset.c b/ltt/branches/poly/lttv/modules/gui/lttvgui/gtktraceset.c new file mode 100644 index 00000000..e82d4c0d --- /dev/null +++ b/ltt/branches/poly/lttv/modules/gui/lttvgui/gtktraceset.c @@ -0,0 +1,807 @@ +/* This file is part of the Linux Trace Toolkit viewer + * Copyright (C) 2003-2004 XangXiu Yang + * + * 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. + */ + +/*! \file gtktraceset.h + * \brief API used by the graphical viewers to interact with their top window. + * + * Main window (gui module) is the place to contain and display viewers. + * Viewers (lttv plugins) interacte with main window through this API and + * events sent by gtk. + * This header file should be included in each graphic module. + * This library is used by graphical modules to interact with the + * tracesetWindow. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +/** + * Internal function parts + */ + +/** + * Function to set/update traceset for the viewers + * @param main_win main window + * @param traceset traceset of the main window. + */ + +void 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)); + tmp = (LttvHooks*)*(value.v_pointer); + if(tmp == NULL)return; + lttv_hooks_call(tmp,traceset); +} + + +/** + * Function to set/update filter for the viewers + * @param main_win main window + * @param filter filter of the main window. + */ + +void 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)); + tmp = (LttvHooks*)*(value.v_pointer); + + if(tmp == NULL)return; + lttv_hooks_call(tmp,filter); +} + + + +/** + * API parts + */ + +/** + * Function to register a view constructor so that main window can generate + * a toolbar item for the viewer in order to generate a new instance easily. + * It will be called by init function of the module. + * @param ButtonPixmap image shown on the toolbar item. + * @param tooltip tooltip of the toolbar item. + * @param view_constructor constructor of the viewer. + */ + +void toolbar_item_reg(char ** pixmap, char *tooltip, lttv_constructor view_constructor) +{ + LttvIAttribute *attributes_global = LTTV_IATTRIBUTE(lttv_global_attributes()); + LttvToolbars * toolbar; + LttvAttributeValue value; + + g_assert(lttv_iattribute_find_by_path(attributes_global, + "viewers/toolbar", LTTV_POINTER, &value)); + toolbar = (LttvToolbars*)*(value.v_pointer); + + if(toolbar == NULL){ + toolbar = lttv_toolbars_new(); + *(value.v_pointer) = toolbar; + } + lttv_toolbars_add(toolbar, view_constructor, tooltip, pixmap); +} + + +/** + * Function to unregister the viewer's constructor, release the space + * occupied by pixmap, tooltip and constructor of the viewer. + * It will be called when a module is unloaded. + * @param view_constructor constructor of the viewer which is used as + * a reference to find out where the pixmap and tooltip are. + */ + +void toolbar_item_unreg(lttv_constructor view_constructor) +{ + LttvIAttribute *attributes_global = LTTV_IATTRIBUTE(lttv_global_attributes()); + LttvToolbars * toolbar; + LttvAttributeValue value; + + g_assert(lttv_iattribute_find_by_path(attributes_global, + "viewers/toolbar", LTTV_POINTER, &value)); + toolbar = (LttvToolbars*)*(value.v_pointer); + + main_window_remove_toolbar_item(view_constructor); + + lttv_toolbars_remove(toolbar, view_constructor); +} + + +/** + * Function to register a view constructor so that main window can generate + * a menu item for the viewer in order to generate a new instance easily. + * It will be called by init function of the module. + * @param menu_path path of the menu item. + * @param menu_text text of the menu item. + * @param view_constructor constructor of the viewer. + */ + +void menu_item_reg(char *menu_path, char *menu_text, lttv_constructor view_constructor) +{ + LttvIAttribute *attributes_global = LTTV_IATTRIBUTE(lttv_global_attributes()); + LttvMenus * menu; + LttvAttributeValue value; + + g_assert(lttv_iattribute_find_by_path(attributes_global, + "viewers/menu", LTTV_POINTER, &value)); + menu = (LttvMenus*)*(value.v_pointer); + + if(menu == NULL){ + menu = lttv_menus_new(); + *(value.v_pointer) = menu; + } + lttv_menus_add(menu, view_constructor, menu_path, menu_text); +} + +/** + * Function to unregister the viewer's constructor, release the space + * occupied by menu_path, menu_text and constructor of the viewer. + * It will be called when a module is unloaded. + * @param view_constructor constructor of the viewer which is used as + * a reference to find out where the menu_path and menu_text are. + */ + +void menu_item_unreg(lttv_constructor view_constructor) +{ + LttvIAttribute *attributes_global = LTTV_IATTRIBUTE(lttv_global_attributes()); + LttvMenus * menu; + LttvAttributeValue value; + + g_assert(lttv_iattribute_find_by_path(attributes_global, + "viewers/menu", LTTV_POINTER, &value)); + menu = (LttvMenus*)*(value.v_pointer); + + main_window_remove_menu_item(view_constructor); + + 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) +{ + LttvAttributeValue value; + LttvHooks * tmp; + 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){ + tmp = lttv_hooks_new(); + *(value.v_pointer) = tmp; + } + lttv_hooks_add(tmp, hook,hook_data); +} + + +/** + * 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) +{ + LttvAttributeValue value; + LttvHooks * tmp; + 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_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) +{ + 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){ + tmp = lttv_hooks_new(); + *(value.v_pointer) = tmp; + } + lttv_hooks_add(tmp, hook, hook_data); +} + + +/** + * 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) +{ + 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_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) +{ + LttvAttributeValue value; + LttvHooks * tmp; + g_assert(lttv_iattribute_find_by_path(main_win->attributes, + "hooks/updatefilter", LTTV_POINTER, &value)); + tmp = (LttvHooks*)*(value.v_pointer); + if(tmp == NULL){ + tmp = lttv_hooks_new(); + *(value.v_pointer) = tmp; + } + lttv_hooks_add(tmp, hook, hook_data); +} + + +/** + * 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) +{ + LttvAttributeValue value; + LttvHooks * tmp; + g_assert(lttv_iattribute_find_by_path(main_win->attributes, + "hooks/updatefilter", LTTV_POINTER, &value)); + tmp = (LttvHooks*)*(value.v_pointer); + if(tmp == NULL) return; + lttv_hooks_remove_data(tmp, hook, hook_data); +} + + +/** + * 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) +{ + LttvAttributeValue value; + LttvHooks * tmp; + 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){ + tmp = lttv_hooks_new(); + *(value.v_pointer) = tmp; + } + lttv_hooks_add(tmp, hook, hook_data); +} + + +/** + * 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) +{ + LttvAttributeValue value; + LttvHooks * tmp; + 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_remove_data(tmp, hook, hook_data); +} + + +/** + * 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. + * @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) +{ + 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){ + tmp = lttv_hooks_new(); + *(value.v_pointer) = tmp; + } + lttv_hooks_add(tmp, hook, hook_data); +} + + +/** + * 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) +{ + 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_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) +{ + LttvAttributeValue value; + LttvHooks * tmp; + g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes, + "hooks/hpanedividor", LTTV_POINTER, &value)); + tmp = (LttvHooks*)*(value.v_pointer); + if(tmp == NULL){ + tmp = lttv_hooks_new(); + *(value.v_pointer) = tmp; + } + lttv_hooks_add(tmp, hook, hook_data); +} + + +/** + * Function to unregister a viewer's hook function which is used to + * set/update hpane's dividor 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_dividor(LttvHook hook, gpointer hook_data, + MainWindow *main_win) +{ + LttvAttributeValue value; + LttvHooks * tmp; + g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes, + "hooks/hpanedividor", LTTV_POINTER, &value)); + tmp = (LttvHooks*)*(value.v_pointer); + if(tmp == NULL) return; + lttv_hooks_remove_data(tmp, hook, hook_data); +} + + +/** + * Function to set the position of the hpane's dividor (viewer). + * It will be called by a viewer's signal handle associated with + * the motion_notify_event event/signal + * @param main_win the main window the viewer belongs to. + * @param position position of the hpane's dividor. + */ + +void set_hpane_dividor(MainWindow *main_win, gint position) +{ + LttvAttributeValue value; + LttvHooks * tmp; + g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes, + "hooks/hpanedividor", LTTV_POINTER, &value)); + tmp = (LttvHooks*)*(value.v_pointer); + if(tmp == NULL) return; + lttv_hooks_call(tmp, &position); +} + + +/** + * Function to process traceset. It will call lttv_process_trace, + * each view will call this api to get events. + * @param main_win the main window the viewer belongs to. + * @param start the start time of the first event to be processed. + * @param end the end time of the last event to be processed. + */ + +void process_traceset_api(MainWindow *main_win, LttTime start, + LttTime end, unsigned maxNumEvents) +{ + lttv_process_traceset_seek_time( + LTTV_TRACESET_CONTEXT(main_win->current_tab->traceset_info-> + traceset_context), + start); + lttv_process_traceset( + LTTV_TRACESET_CONTEXT(main_win->current_tab->traceset_info-> + traceset_context), + end, + maxNumEvents); +} + +/** + * Function to add hooks into the context of a traceset, + * before reading events from traceset, viewer will call this api to + * register hooks + * @param main_win the main window the viewer belongs to. + * @param LttvHooks hooks to be registered. + */ + +void context_add_hooks_api(MainWindow *main_win , + LttvHooks *before_traceset, + LttvHooks *after_traceset, + LttvHooks *check_trace, + LttvHooks *before_trace, + LttvHooks *after_trace, + LttvHooks *check_tracefile, + LttvHooks *before_tracefile, + LttvHooks *after_tracefile, + LttvHooks *check_event, + LttvHooks *before_event, + LttvHooks *after_event) +{ + LttvTracesetContext * tsc = + LTTV_TRACESET_CONTEXT(main_win->current_tab->traceset_info-> + traceset_context); + lttv_traceset_context_add_hooks(tsc,before_traceset,after_traceset, + check_trace,before_trace,after_trace, + check_tracefile,before_tracefile,after_tracefile, + check_event,before_event, after_event); +} + + +/** + * Function to remove hooks from the context of a traceset, + * before reading events from traceset, viewer will call this api to + * unregister hooks + * @param main_win the main window the viewer belongs to. + * @param LttvHooks hooks to be registered. + */ + +void context_remove_hooks_api(MainWindow *main_win , + LttvHooks *before_traceset, + LttvHooks *after_traceset, + LttvHooks *check_trace, + LttvHooks *before_trace, + LttvHooks *after_trace, + LttvHooks *check_tracefile, + LttvHooks *before_tracefile, + LttvHooks *after_tracefile, + LttvHooks *check_event, + LttvHooks *before_event, + LttvHooks *after_event) +{ + LttvTracesetContext * tsc = + LTTV_TRACESET_CONTEXT(main_win->current_tab->traceset_info->traceset_context); + lttv_traceset_context_remove_hooks(tsc,before_traceset,after_traceset, + check_trace,before_trace,after_trace, + check_tracefile,before_tracefile,after_tracefile, + check_event,before_event, after_event); +} + + +/** + * Function to add/remove event hooks for state + * @param main_win the main window the viewer belongs to. + */ + +void state_add_event_hooks_api(MainWindow *main_win ) +{ + lttv_state_add_event_hooks( + (LttvTracesetState*)main_win->current_tab->traceset_info->traceset_context); +} + +void state_remove_event_hooks_api(MainWindow *main_win ) +{ + lttv_state_remove_event_hooks( + (LttvTracesetState*)main_win->current_tab->traceset_info->traceset_context); +} + + +/** + * Function to add/remove event hooks for stats + * @param main_win the main window the viewer belongs to. + */ + +void stats_add_event_hooks_api(MainWindow *main_win ) +{ + lttv_stats_add_event_hooks( + (LttvTracesetStats*)main_win->current_tab->traceset_info->traceset_context); +} + +void stats_remove_event_hooks_api(MainWindow *main_win ) +{ + lttv_stats_remove_event_hooks( + (LttvTracesetStats*)main_win->current_tab->traceset_info->traceset_context); +} + +/** + * Function to get the stats of the traceset + * @param main_win the main window the viewer belongs to. + */ + +LttvTracesetStats* get_traceset_stats_api(MainWindow *main_win) +{ + return main_win->current_tab->traceset_info->traceset_context; +} + + +LttvTracesetContext* get_traceset_context(MainWindow *main_win) +{ + return (LttvTracesetContext*)main_win->current_tab->traceset_info->traceset_context; +} diff --git a/ltt/branches/poly/lttv/modules/gui/lttvgui/gtktraceset.h b/ltt/branches/poly/lttv/modules/gui/lttvgui/gtktraceset.h new file mode 100644 index 00000000..a0b08f2b --- /dev/null +++ b/ltt/branches/poly/lttv/modules/gui/lttvgui/gtktraceset.h @@ -0,0 +1,476 @@ +/* This file is part of the Linux Trace Toolkit viewer + * Copyright (C) 2003-2004 Xiangxiu Yang + * + * 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. + */ + +/* +CHECK Rename to viewer.h + +Things that can happen to a viewer: + +update_time_window +update_current_time +update_traceset +update_filter +show_viewer +update_dividor +?? Reshape, damage ?? + +Things that a viewer can do: + +update_status +set_time_window +set_current_time +update_traceset? +update_filter? +show_viewer? +set_focused_pane +set_hpane_dividor +*/ + + + + +/*! \file gtktraceset.h + * \brief API used by the graphical viewers to interact with their top window. + * + * Main window (gui module) is the place to contain and display viewers. + * Viewers (lttv plugins) interacte with main window through this API and + * events sent by gtk. + * This header file should be included in each graphic module. + * This library is used by graphical modules to interact with the + * tracesetWindow. + * + */ + +#include +#include +#include +#include +#include + +/** + * Function to register a view constructor so that main window can generate + * a toolbar item for the viewer in order to generate a new instance easily. + * It will be called by init function of the module. + * @param ButtonPixmap image shown on the toolbar item. + * @param tooltip tooltip of the toolbar item. + * @param view_constructor constructor of the viewer. + */ + +void toolbar_item_reg(char ** pixmap, char *tooltip, lttv_constructor view_constructor); + + +/** + * Function to unregister the viewer's constructor, release the space + * occupied by pixmap, tooltip and constructor of the viewer. + * It will be called when a module is unloaded. + * @param view_constructor constructor of the viewer which is used as + * a reference to find out where the pixmap and tooltip are. + */ + +void toolbar_item_unreg(lttv_constructor view_constructor); + + +/** + * Function to register a view constructor so that main window can generate + * a menu item for the viewer in order to generate a new instance easily. + * It will be called by init function of the module. + * @param menu_path path of the menu item. + * @param menu_text text of the menu item. + * @param view_constructor constructor of the viewer. + */ + +void menu_item_reg(char *menu_path, char *menu_text, lttv_constructor view_constructor); + + +/** + * Function to unregister the viewer's constructor, release the space + * occupied by menu_path, menu_text and constructor of the viewer. + * It will be called when a module is unloaded. + * @param view_constructor constructor of the viewer which is used as + * a reference to find out where the menu_path and menu_text are. + */ + +void menu_item_unreg(lttv_constructor 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 window of the current tab. + * It will be called by a viewer's hook function to update the + * time window 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); + + +/** + * 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); + +/** + * 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); + + +/** + * 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); + + +/** + * 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. Takes a TimeInterval* as call_data. + * @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); + + +/** + * 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. Takes a TimeInterval as call_data. + * @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); + + +/** + * 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); + + +/** + * 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); + + +/** + * 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); + + +/** + * 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); + + +/** + * 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); + + +/** + * 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); + + +/** + * 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); + + +/** + * 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. + * @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); + + +/** + * 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); + + +/** + * 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); + + +/** + * 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); + + +/** + * 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); + + +/** + * Function to unregister a viewer's hook function which is used to + * set/update hpane's dividor 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_dividor(LttvHook hook, gpointer hook_data, + MainWindow *main_win); + + +/** + * Function to set the position of the hpane's dividor (viewer). + * It will be called by a viewer's signal handle associated with + * the motion_notify_event event/signal + * @param main_win the main window the viewer belongs to. + * @param position position of the hpane's dividor. + */ + +void set_hpane_dividor(MainWindow *main_win, gint position); + + +/* +CHECK These functions really should not appear here. Directr calls would +be OK unless there is a linker problem. +*/ +/** + * Function to process traceset. It will call lttv_process_trace, + * each view will call this api to get events. + * @param main_win the main window the viewer belongs to. + * @param start the start time of the first event to be processed. + * @param end the end time of the last event to be processed. + */ + +void process_traceset_api(MainWindow *main_win, LttTime start, + LttTime end, unsigned maxNumEvents); + + +/** + * Function to add hooks into the context of a traceset, + * before reading events from traceset, viewer will call this api to + * register hooks + * @param main_win the main window the viewer belongs to. + * @param LttvHooks hooks to be registered. + */ + +void context_add_hooks_api(MainWindow *main_win , + LttvHooks *before_traceset, + LttvHooks *after_traceset, + LttvHooks *check_trace, + LttvHooks *before_trace, + LttvHooks *after_trace, + LttvHooks *check_tracefile, + LttvHooks *before_tracefile, + LttvHooks *after_tracefile, + LttvHooks *check_event, + LttvHooks *before_event, + LttvHooks *after_event); + + +/** + * Function to remove hooks from the context of a traceset, + * before reading events from traceset, viewer will call this api to + * unregister hooks + * @param main_win the main window the viewer belongs to. + * @param LttvHooks hooks to be registered. + */ + +void context_remove_hooks_api(MainWindow *main_win , + LttvHooks *before_traceset, + LttvHooks *after_traceset, + LttvHooks *check_trace, + LttvHooks *before_trace, + LttvHooks *after_trace, + LttvHooks *check_tracefile, + LttvHooks *before_tracefile, + LttvHooks *after_tracefile, + LttvHooks *check_event, + LttvHooks *before_event, + LttvHooks *after_event); + + +/** + * Function to get the life span of the traceset + * @param main_win the main window the viewer belongs to. + * @param start start time of the traceset. + * @param end end time of the traceset. + */ + +void get_traceset_time_span(MainWindow *main_win, TimeInterval *time_span); + + +/** + * Function to add/remove event hooks for state + * @param main_win the main window the viewer belongs to. + */ + +void state_add_event_hooks_api(MainWindow *main_win ); +void state_remove_event_hooks_api(MainWindow *main_win ); + + +/** + * Function to add/remove event hooks for stats + * @param main_win the main window the viewer belongs to. + */ + +void stats_add_event_hooks_api(MainWindow *main_win ); +void stats_remove_event_hooks_api(MainWindow *main_win ); + + +/** + * Function to get the stats of the traceset + * @param main_win the main window the viewer belongs to. + */ + +LttvTracesetStats* get_traceset_stats_api(MainWindow *main_win); + +LttvTracesetContext* get_traceset_context(MainWindow *main_win); diff --git a/ltt/branches/poly/lttv/modules/gui/lttvgui/lttvfilter.h b/ltt/branches/poly/lttv/modules/gui/lttvgui/lttvfilter.h new file mode 100644 index 00000000..f2dab415 --- /dev/null +++ b/ltt/branches/poly/lttv/modules/gui/lttvgui/lttvfilter.h @@ -0,0 +1,89 @@ +/* This file is part of the Linux Trace Toolkit viewer + * Copyright (C) 2003-2004 Xiangxiu Yang + * + * 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_FILTER_H +#define LTTV_FILTER_H + +#include + + +typedef struct _LttvTracesetSelector LttvTracesetSelector; +typedef struct _LttvTraceSelector LttvTraceSelector; +typedef struct _LttvTracefileSelector LttvTracefileSelector; +typedef struct _LttvEventtypeSelector LttvEventtypeSelector; + + +LttvTracesetSelector *lttv_traceset_selector_new(char * name); +LttvTraceSelector *lttv_trace_selector_new(LttTrace *t); +LttvTracefileSelector *lttv_tracefile_selector_new(LttTracefile *t); +LttvEventtypeSelector *lttv_eventtype_selector_new(LttEventType * et); +void lttv_traceset_selector_destroy(LttvTracesetSelector *s); +void lttv_trace_selector_destroy(LttvTraceSelector *t); +void lttv_tracefile_selector_destroy(LttvTracefileSelector *t); +void lttv_eventtype_selector_destroy(LttvEventtypeSelector *t); + + +void lttv_traceset_selector_trace_add(LttvTracesetSelector *s, + LttvTraceSelector *t); +unsigned lttv_traceset_selector_trace_number(LttvTracesetSelector *s); +LttvTraceSelector *lttv_traceset_selector_trace_get(LttvTracesetSelector *s, + unsigned i); +void lttv_traceset_selector_trace_remove(LttvTracesetSelector *s, + unsigned i); + + +void lttv_trace_selector_tracefile_add(LttvTraceSelector *s, + LttvTracefileSelector *t); +unsigned lttv_trace_selector_tracefile_number(LttvTraceSelector *s); +LttvTracefileSelector *lttv_trace_selector_tracefile_get(LttvTraceSelector *s, + unsigned i); +void lttv_trace_selector_tracefile_remove(LttvTraceSelector *s, unsigned i); + +void lttv_trace_selector_eventtype_add(LttvTraceSelector *s, + LttvEventtypeSelector *et); +unsigned lttv_trace_selector_eventtype_number(LttvTraceSelector *s); +LttvEventtypeSelector *lttv_trace_selector_eventtype_get(LttvTraceSelector *s, + unsigned i); +void lttv_trace_selector_eventtype_remove(LttvTraceSelector *s, unsigned i); + + +void lttv_tracefile_selector_eventtype_add(LttvTracefileSelector *s, + LttvEventtypeSelector *et); +unsigned lttv_tracefile_selector_eventtype_number(LttvTracefileSelector *s); +LttvEventtypeSelector *lttv_tracefile_selector_eventtype_get(LttvTracefileSelector *s, + unsigned i); +void lttv_tracefile_selector_eventtype_remove(LttvTracefileSelector *s, unsigned i); + + +void lttv_trace_selector_set_selected(LttvTraceSelector *s, gboolean g); +void lttv_tracefile_selector_set_selected(LttvTracefileSelector *s, gboolean g); +void lttv_eventtype_selector_set_selected(LttvEventtypeSelector *s, gboolean g); +gboolean lttv_trace_selector_get_selected(LttvTraceSelector *s); +gboolean lttv_tracefile_selector_get_selected(LttvTracefileSelector *s); +gboolean lttv_eventtype_selector_get_selected(LttvEventtypeSelector *s); +char * lttv_traceset_selector_get_name(LttvTracesetSelector *s); +char * lttv_trace_selector_get_name(LttvTraceSelector *s); +char * lttv_tracefile_selector_get_name(LttvTracefileSelector *s); +char * lttv_eventtype_selector_get_name(LttvEventtypeSelector *s); + +LttvEventtypeSelector * lttv_eventtype_selector_clone(LttvEventtypeSelector * s); +void lttv_eventtype_selector_copy(LttvTraceSelector *s, LttvTracefileSelector *d); + + +#endif // LTTV_FILTER_H + diff --git a/ltt/branches/poly/lttv/modules/gui/lttvgui/mainwindow.h b/ltt/branches/poly/lttv/modules/gui/lttvgui/mainwindow.h new file mode 100644 index 00000000..cf0925c4 --- /dev/null +++ b/ltt/branches/poly/lttv/modules/gui/lttvgui/mainwindow.h @@ -0,0 +1,100 @@ +/* This file is part of the Linux Trace Toolkit viewer + * Copyright (C) 2003-2004 Xiangxiu Yang + * + * 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 _MAIN_WINDOW_ +#define _MAIN_WINDOW_ + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +typedef struct _TracesetInfo { + //FIXME? TracesetContext and stats in same or different variable ? + LttvTracesetStats * traceset_context; + LttvTraceset * traceset; +} TracesetInfo ; + + +struct _MainWindow{ + GtkWidget* mwindow; /* Main Window */ + int window_width; + + /* Status bar information */ + // guint MainSBarContextID; /* Context ID of main status bar */ + // guint BegTimeSBarContextID; /* Context ID of BegTime status bar */ + // guint EndTimeSBarContextID; /* Context ID of EndTime status bar */ + + /* Child windows */ + //openTracesetWindow* OpenTracesetWindow;/* Window to get prof and proc file*/ + //viewTimeFrameWindow* ViewTimeFrameWindow;/*Window to select time frame */ + //gotoEventWindow* GotoEventWindow; /*search for event description*/ + //openFilterWindow* OpenFilterWindow; /* Open a filter selection window */ + GtkWidget* help_contents;/* Window to display help contents */ + GtkWidget* about_box; /* Window about information */ + + // lttv_trace_filter * filter; /* trace filter associated with the window */ + + /* Attributes for trace reading hooks local to the main window */ + LttvIAttribute * attributes; + + Tab * tab; + Tab * current_tab; + + GHashTable * hash_menu_item; + GHashTable * hash_toolbar_item; +}; + + +struct _Tab{ + GtkWidget * label; + GtkMultiVPaned * multi_vpaned; + + // startTime is the left of the visible area. Corresponds to the scrollbar + // value. + // Time_Width is a zoom dependant value (corresponding to page size) + TimeWindow time_window; + + // The current time is the time selected in the visible area by the user, + // not the scrollbar value. + LttTime current_time; + LttvIAttribute * attributes; + + struct _Tab * next; + MainWindow * mw; + + /* Traceset related information */ + TracesetInfo * traceset_info; +}; + +/** + * Remove menu and toolbar item when a module unloaded + */ +void main_window_remove_menu_item(lttv_constructor view_constructor); +void main_window_remove_toolbar_item(lttv_constructor view_constructor); + +#endif /* _MAIN_WINDOW_ */ + + diff --git a/ltt/branches/poly/lttv/modules/gui/lttvgui/menu.c b/ltt/branches/poly/lttv/modules/gui/lttvgui/menu.c new file mode 100644 index 00000000..827f843b --- /dev/null +++ b/ltt/branches/poly/lttv/modules/gui/lttvgui/menu.c @@ -0,0 +1,68 @@ +/* This file is part of the Linux Trace Toolkit viewer + * Copyright (C) 2003-2004 XangXiu Yang + * + * 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 +#include + + +inline LttvMenus *lttv_menus_new() { + return g_array_new(FALSE, FALSE, sizeof(lttv_menu_closure)); +} + +/* MD: delete elements of the array also, but don't free pointed addresses + * (functions). + */ +inline void lttv_menus_destroy(LttvMenus *h) { + g_debug("lttv_menus_destroy()"); + g_array_free(h, TRUE); +} + +inline void lttv_menus_add(LttvMenus *h, lttv_constructor f, char* menuPath, char* menuText) +{ + lttv_menu_closure c; + + /* if h is null, do nothing, or popup a warning message */ + if(h == NULL)return; + + c.con = f; + c.menuPath = menuPath; + c.menuText = menuText; + g_array_append_val(h,c); +} + +gboolean lttv_menus_remove(LttvMenus *h, lttv_constructor f) +{ + lttv_menu_closure * tmp; + gint i; + for(i=0;ilen;i++){ + tmp = & g_array_index(h, lttv_menu_closure, i); + if(tmp->con == f)break; + } + if(ilen){ + g_array_remove_index(h, i); + return TRUE; + }else return FALSE; + +} + +unsigned lttv_menus_number(LttvMenus *h) +{ + return h->len; +} + + diff --git a/ltt/branches/poly/lttv/modules/gui/lttvgui/menu.h b/ltt/branches/poly/lttv/modules/gui/lttvgui/menu.h new file mode 100644 index 00000000..d08572c5 --- /dev/null +++ b/ltt/branches/poly/lttv/modules/gui/lttvgui/menu.h @@ -0,0 +1,47 @@ +/* This file is part of the Linux Trace Toolkit viewer + * Copyright (C) 2003-2004 Xiangxiu Yang + * + * 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 MENU_H +#define MENU_H + +#include + +/* constructor of the viewer */ +//typedef GtkWidget* (*lttv_constructor)(void * main_window); + + +typedef GArray LttvMenus; + +typedef struct _lttv_menu_closure { + lttv_constructor con; + char * menuPath; + char * menuText; +} lttv_menu_closure; + + +LttvMenus *lttv_menus_new(); + +void lttv_menus_destroy(LttvMenus *h); + +void lttv_menus_add(LttvMenus *h, lttv_constructor f, char* menuPath, char * menuText); + +gboolean lttv_menus_remove(LttvMenus *h, lttv_constructor f); + +unsigned lttv_menus_number(LttvMenus *h); + +#endif // MENU_H diff --git a/ltt/branches/poly/lttv/modules/gui/lttvgui/toolbar.c b/ltt/branches/poly/lttv/modules/gui/lttvgui/toolbar.c new file mode 100644 index 00000000..cfb4dda0 --- /dev/null +++ b/ltt/branches/poly/lttv/modules/gui/lttvgui/toolbar.c @@ -0,0 +1,67 @@ +/* This file is part of the Linux Trace Toolkit viewer + * Copyright (C) 2003-2004 XangXiu Yang + * + * 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 +#include + + +inline LttvToolbars *lttv_toolbars_new() { + return g_array_new(FALSE, FALSE, sizeof(lttv_toolbar_closure)); +} + +/* MD: delete elements of the array also, but don't free pointed addresses + * (functions). + */ +inline void lttv_toolbars_destroy(LttvToolbars *h) { + g_debug("lttv_toolbars_destroy"); + g_array_free(h, TRUE); +} + +inline void lttv_toolbars_add(LttvToolbars *h, lttv_constructor f, char* tooltip, char ** pixmap) +{ + lttv_toolbar_closure c; + + /* if h is null, do nothing, or popup a warning message */ + if(h == NULL)return; + + c.con = f; + c.tooltip = tooltip; + c.pixmap = pixmap; + g_array_append_val(h,c); +} + +gboolean lttv_toolbars_remove(LttvToolbars *h, lttv_constructor f) +{ + lttv_toolbar_closure * tmp; + gint i; + for(i=0;ilen;i++){ + tmp = & g_array_index(h, lttv_toolbar_closure, i); + if(tmp->con == f)break; + } + if(ilen){ + g_array_remove_index(h, i); + return TRUE; + }else return FALSE; +} + +unsigned lttv_toolbars_number(LttvToolbars *h) +{ + return h->len; +} + + diff --git a/ltt/branches/poly/lttv/modules/gui/lttvgui/toolbar.h b/ltt/branches/poly/lttv/modules/gui/lttvgui/toolbar.h new file mode 100644 index 00000000..8a8815ad --- /dev/null +++ b/ltt/branches/poly/lttv/modules/gui/lttvgui/toolbar.h @@ -0,0 +1,46 @@ +/* This file is part of the Linux Trace Toolkit viewer + * Copyright (C) 2003-2004 Xiangxiu Yang + * + * 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 TOOLBAR_H +#define TOOLBAR_H + +#include + +/* constructor of the viewer */ +//typedef GtkWidget* (*lttv_constructor)(void * main_window); + + +typedef GArray LttvToolbars; + +typedef struct _lttv_toolbar_closure { + lttv_constructor con; + char * tooltip; + char ** pixmap; +} lttv_toolbar_closure; + +LttvToolbars *lttv_toolbars_new(); + +void lttv_toolbars_destroy(LttvToolbars *h); + +void lttv_toolbars_add(LttvToolbars *h, lttv_constructor f, char* tooltip, char ** pixmap); + +gboolean lttv_toolbars_remove(LttvToolbars *h, lttv_constructor f); + +unsigned lttv_toolbars_number(LttvToolbars *h); + +#endif // TOOLBAR_H diff --git a/ltt/branches/poly/lttv/modules/gui/main/Makefile.am b/ltt/branches/poly/lttv/modules/gui/main/Makefile.am index 687919f3..7e90b8f2 100644 --- a/ltt/branches/poly/lttv/modules/gui/main/Makefile.am +++ b/ltt/branches/poly/lttv/modules/gui/main/Makefile.am @@ -1,10 +1,6 @@ ## Process this file with automake to produce Makefile.in -SUBDIRS = src - -EXTRA_DIST = \ - mainwin.glade \ - mainwin.gladep +SUBDIRS = src glade install-data-local: @$(NORMAL_INSTALL) diff --git a/ltt/branches/poly/lttv/modules/gui/main/glade/Makefile.am b/ltt/branches/poly/lttv/modules/gui/main/glade/Makefile.am new file mode 100644 index 00000000..c375abfa --- /dev/null +++ b/ltt/branches/poly/lttv/modules/gui/main/glade/Makefile.am @@ -0,0 +1,5 @@ +## Process this file with automake to produce Makefile.in + +EXTRA_DIST = \ + mainwin.glade \ + mainwin.gladep diff --git a/ltt/branches/poly/lttv/modules/gui/main/glade/lttvwindow.glade b/ltt/branches/poly/lttv/modules/gui/main/glade/lttvwindow.glade new file mode 100644 index 00000000..0d4cd97d --- /dev/null +++ b/ltt/branches/poly/lttv/modules/gui/main/glade/lttvwindow.glade @@ -0,0 +1,760 @@ + + + + + + + 100 + 50 + True + Main window + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + 600 + 400 + True + False + + + + + True + False + 0 + + + + True + False + 0 + + + + True + + + + True + _File + True + + + + + + + True + New + True + + + + + + + True + Empty trace set + True + + + + + + + True + Clone trace set + True + + + + + + + True + + + + + + True + Tab + True + + + + + + + + + + + True + Open + True + + + + + + + True + Close + True + + + + + + + True + Close Tab + True + + + + + + + True + + + + + + True + Add Trace + True + + + + + + + True + Remove Trace + True + + + + + + + True + Save + True + + + + + + + True + Save As + True + + + + + + + True + + + + + + True + Quit + True + + + + + + + + + + + True + _Edit + True + + + + + + + True + gtk-cut + True + + + + + + + True + gtk-copy + True + + + + + + + True + gtk-paste + True + + + + + + + True + gtk-delete + True + + + + + + + + + + + True + _View + True + + + + + + + True + Zoom in + True + + + + + + + True + Zoom out + True + + + + + + + True + Zoom extended + True + + + + + + + True + + + + + + True + Go to time + True + + + + + + + True + Show time frame + True + + + + + + + + + + + True + Tools + True + + + + + + + True + Move viewer up + True + + + + + + + True + Move viewer down + True + + + + + + + True + Remove viewer + True + + + + + + + True + + + + + + True + Insert viewer test + True + + + + + + + + + + + True + Plugins + True + + + + + + + True + Load module + True + + + + + + + True + Unload module + True + + + + + + + True + Add module search path + True + + + + + + + + + + + True + Options + True + + + + + + + True + Color + True + + + + + + + True + + + + + + True + Filter + True + + + + + + + True + Save configuration + True + + + + + + + + + + 0 + False + False + + + + + + True + + + + True + _Help + True + + + + + + + True + Content + True + + + + + + + True + + + + + + True + About... + True + + + + + + + + + + 0 + False + False + GTK_PACK_END + + + + + 0 + False + False + + + + + + True + GTK_ORIENTATION_HORIZONTAL + GTK_TOOLBAR_ICONS + True + + + + 1 + True + New window with empty trace set + + True + filenew.png + + + + + + + 1 + True + open a trace set + + True + fileopen.png + + + + + + + 1 + True + Add a trace + + True + edit_add_22.png + + + + + + + 1 + True + Remove a trace + + True + edit_remove_22.png + + + + + + + 1 + True + save the current trace set + + True + filesave.png + + + + + + + 1 + True + save as + + True + filesaveas.png + + + + + + + 1 + True + Zoom in + + True + stock_zoom_in_24.png + True + + + + True + + + + + + 1 + True + Zoom out + + True + stock_zoom_out_24.png + + + + + + + 1 + True + Zoom extended + + True + stock_zoom_fit_24.png + + + + + + + 1 + True + Go to time + + True + gtk-jump-to.png + + + + + + + 1 + True + Show time frame + + True + mini-display.xpm + + + + + + + 1 + True + Move up current viewer + + True + 1uparrow.png + True + + + + True + + + + + + 1 + True + Move down current viewer + + True + 1downarrow.png + + + + + + + 1 + True + Delete current viewer + + True + remove.png + + + + + + 0 + False + False + + + + + + True + GTK_ORIENTATION_HORIZONTAL + GTK_TOOLBAR_BOTH + True + + + + + + + 0 + False + False + + + + + + True + True + True + True + GTK_POS_TOP + False + False + + + + + + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + tab + + + + + 0 + True + True + + + + + + True + True + + + 0 + False + False + + + + + + + diff --git a/ltt/branches/poly/lttv/modules/gui/main/glade/lttvwindow.gladep b/ltt/branches/poly/lttv/modules/gui/main/glade/lttvwindow.gladep new file mode 100644 index 00000000..31586846 --- /dev/null +++ b/ltt/branches/poly/lttv/modules/gui/main/glade/lttvwindow.gladep @@ -0,0 +1,11 @@ + + + + + MainWin + mainwin + FALSE + FALSE + FALSE + FALSE + diff --git a/ltt/branches/poly/lttv/modules/gui/main/mainwin.glade b/ltt/branches/poly/lttv/modules/gui/main/mainwin.glade deleted file mode 100644 index 0d4cd97d..00000000 --- a/ltt/branches/poly/lttv/modules/gui/main/mainwin.glade +++ /dev/null @@ -1,760 +0,0 @@ - - - - - - - 100 - 50 - True - Main window - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - 600 - 400 - True - False - - - - - True - False - 0 - - - - True - False - 0 - - - - True - - - - True - _File - True - - - - - - - True - New - True - - - - - - - True - Empty trace set - True - - - - - - - True - Clone trace set - True - - - - - - - True - - - - - - True - Tab - True - - - - - - - - - - - True - Open - True - - - - - - - True - Close - True - - - - - - - True - Close Tab - True - - - - - - - True - - - - - - True - Add Trace - True - - - - - - - True - Remove Trace - True - - - - - - - True - Save - True - - - - - - - True - Save As - True - - - - - - - True - - - - - - True - Quit - True - - - - - - - - - - - True - _Edit - True - - - - - - - True - gtk-cut - True - - - - - - - True - gtk-copy - True - - - - - - - True - gtk-paste - True - - - - - - - True - gtk-delete - True - - - - - - - - - - - True - _View - True - - - - - - - True - Zoom in - True - - - - - - - True - Zoom out - True - - - - - - - True - Zoom extended - True - - - - - - - True - - - - - - True - Go to time - True - - - - - - - True - Show time frame - True - - - - - - - - - - - True - Tools - True - - - - - - - True - Move viewer up - True - - - - - - - True - Move viewer down - True - - - - - - - True - Remove viewer - True - - - - - - - True - - - - - - True - Insert viewer test - True - - - - - - - - - - - True - Plugins - True - - - - - - - True - Load module - True - - - - - - - True - Unload module - True - - - - - - - True - Add module search path - True - - - - - - - - - - - True - Options - True - - - - - - - True - Color - True - - - - - - - True - - - - - - True - Filter - True - - - - - - - True - Save configuration - True - - - - - - - - - - 0 - False - False - - - - - - True - - - - True - _Help - True - - - - - - - True - Content - True - - - - - - - True - - - - - - True - About... - True - - - - - - - - - - 0 - False - False - GTK_PACK_END - - - - - 0 - False - False - - - - - - True - GTK_ORIENTATION_HORIZONTAL - GTK_TOOLBAR_ICONS - True - - - - 1 - True - New window with empty trace set - - True - filenew.png - - - - - - - 1 - True - open a trace set - - True - fileopen.png - - - - - - - 1 - True - Add a trace - - True - edit_add_22.png - - - - - - - 1 - True - Remove a trace - - True - edit_remove_22.png - - - - - - - 1 - True - save the current trace set - - True - filesave.png - - - - - - - 1 - True - save as - - True - filesaveas.png - - - - - - - 1 - True - Zoom in - - True - stock_zoom_in_24.png - True - - - - True - - - - - - 1 - True - Zoom out - - True - stock_zoom_out_24.png - - - - - - - 1 - True - Zoom extended - - True - stock_zoom_fit_24.png - - - - - - - 1 - True - Go to time - - True - gtk-jump-to.png - - - - - - - 1 - True - Show time frame - - True - mini-display.xpm - - - - - - - 1 - True - Move up current viewer - - True - 1uparrow.png - True - - - - True - - - - - - 1 - True - Move down current viewer - - True - 1downarrow.png - - - - - - - 1 - True - Delete current viewer - - True - remove.png - - - - - - 0 - False - False - - - - - - True - GTK_ORIENTATION_HORIZONTAL - GTK_TOOLBAR_BOTH - True - - - - - - - 0 - False - False - - - - - - True - True - True - True - GTK_POS_TOP - False - False - - - - - - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - tab - - - - - 0 - True - True - - - - - - True - True - - - 0 - False - False - - - - - - - diff --git a/ltt/branches/poly/lttv/modules/gui/main/mainwin.gladep b/ltt/branches/poly/lttv/modules/gui/main/mainwin.gladep deleted file mode 100644 index 31586846..00000000 --- a/ltt/branches/poly/lttv/modules/gui/main/mainwin.gladep +++ /dev/null @@ -1,11 +0,0 @@ - - - - - MainWin - mainwin - FALSE - FALSE - FALSE - FALSE - diff --git a/ltt/branches/poly/lttv/modules/gui/main/src/callbacks.c b/ltt/branches/poly/lttv/modules/gui/main/src/callbacks.c index 8bc265ce..76890d15 100644 --- a/ltt/branches/poly/lttv/modules/gui/main/src/callbacks.c +++ b/ltt/branches/poly/lttv/modules/gui/main/src/callbacks.c @@ -26,14 +26,14 @@ #include "interface.h" #include "support.h" #include -#include -#include -#include -#include +#include +#include +#include +#include #include -#include +#include #include -#include +#include #include #include diff --git a/ltt/branches/poly/lttv/modules/gui/main/src/callbacks.h b/ltt/branches/poly/lttv/modules/gui/main/src/callbacks.h index c9166bda..2ec6b0bf 100644 --- a/ltt/branches/poly/lttv/modules/gui/main/src/callbacks.h +++ b/ltt/branches/poly/lttv/modules/gui/main/src/callbacks.h @@ -17,8 +17,8 @@ */ #include -#include -#include +#include +#include /* internal functions */ diff --git a/ltt/branches/poly/lttv/modules/gui/main/src/gtkdirsel.c b/ltt/branches/poly/lttv/modules/gui/main/src/gtkdirsel.c index e17ed4c8..138d9750 100644 --- a/ltt/branches/poly/lttv/modules/gui/main/src/gtkdirsel.c +++ b/ltt/branches/poly/lttv/modules/gui/main/src/gtkdirsel.c @@ -49,7 +49,7 @@ #include "gdk/gdkkeysyms.h" #include -#include +#include #define _(A) A #define WANT_HPANED 1 diff --git a/ltt/branches/poly/lttv/modules/gui/main/src/gtkmultivpaned.c b/ltt/branches/poly/lttv/modules/gui/main/src/gtkmultivpaned.c index 6ce5eb97..6bf873a4 100644 --- a/ltt/branches/poly/lttv/modules/gui/main/src/gtkmultivpaned.c +++ b/ltt/branches/poly/lttv/modules/gui/main/src/gtkmultivpaned.c @@ -18,10 +18,10 @@ #include -#include +#include //#include "gtkintl.h" -#include -#include +#include +#include static void gtk_multi_vpaned_class_init (GtkMultiVPanedClass *klass); static void gtk_multi_vpaned_init (GtkMultiVPaned *multi_vpaned); diff --git a/ltt/branches/poly/lttv/modules/gui/main/src/init_module.c b/ltt/branches/poly/lttv/modules/gui/main/src/init_module.c index c1fcf1fc..31fb5923 100644 --- a/ltt/branches/poly/lttv/modules/gui/main/src/init_module.c +++ b/ltt/branches/poly/lttv/modules/gui/main/src/init_module.c @@ -35,12 +35,12 @@ #include #include #include -#include -#include +#include +#include #include "interface.h" #include "support.h" -#include +#include #include "callbacks.h" #include diff --git a/ltt/branches/poly/lttv/modules/gui/main/src/lttvfilter.c b/ltt/branches/poly/lttv/modules/gui/main/src/lttvfilter.c index 71262722..e81e82ab 100644 --- a/ltt/branches/poly/lttv/modules/gui/main/src/lttvfilter.c +++ b/ltt/branches/poly/lttv/modules/gui/main/src/lttvfilter.c @@ -17,7 +17,7 @@ */ -#include +#include #include #include #include diff --git a/ltt/branches/poly/lttv/modules/gui/main/src/main.c b/ltt/branches/poly/lttv/modules/gui/main/src/main.c index 46044437..854839f5 100644 --- a/ltt/branches/poly/lttv/modules/gui/main/src/main.c +++ b/ltt/branches/poly/lttv/modules/gui/main/src/main.c @@ -12,7 +12,7 @@ #include "interface.h" #include "support.h" -#include +#include #include "callbacks.h" /* global variable */ diff --git a/ltt/branches/poly/lttv/modules/gui/mainlib/Makefile.am b/ltt/branches/poly/lttv/modules/gui/mainlib/Makefile.am deleted file mode 100644 index 4562409b..00000000 --- a/ltt/branches/poly/lttv/modules/gui/mainlib/Makefile.am +++ /dev/null @@ -1,28 +0,0 @@ -# -# Makefile for LTT New generation user interface : plugins. -# -# Created by Mathieu Desnoyers on May 6, 2003 -# - -libdir = ${lttvlibdir} - -AM_CFLAGS = $(GLIB_CFLAGS) -AM_CFLAGS += $(GTK_CFLAGS) -LIBS += $(GLIB_LIBS) -LIBS += $(GTK_LIBS) - -lib_LTLIBRARIES = libmainwinapi.la -libmainwinapi_la_SOURCES = toolbar.c menu.c gtktraceset.c -#libmainwinapi_la_LDFLAGS = -L${top_srcdir}/lttv/modules/gui/API -lcustomBox - -lttvguiinclude_HEADERS = \ - common.h\ - gtkdirsel.h\ - gtkmultivpaned.h\ - gtktraceset.h\ - lttvfilter.h\ - mainwindow.h\ - menu.h\ - toolbar.h - -EXTRA_DIST = diff --git a/ltt/branches/poly/lttv/modules/gui/mainlib/common.h b/ltt/branches/poly/lttv/modules/gui/mainlib/common.h deleted file mode 100644 index a3e557f3..00000000 --- a/ltt/branches/poly/lttv/modules/gui/mainlib/common.h +++ /dev/null @@ -1,43 +0,0 @@ -/* This file is part of the Linux Trace Toolkit viewer - * Copyright (C) 2003-2004 Xiangxiu Yang - * - * 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 COMMON_H -#define COMMON_H - -#include -#include -#include -#include - -#define MAX_NUMBER_EVENT "MAX_NUMBER_EVENT" -#define TRACESET_TIME_SPAN "TRACESET_TIME_SPAN" - -typedef struct _MainWindow MainWindow; -typedef struct _Tab Tab; - -/* constructor of the viewer */ -typedef GtkWidget * (*lttv_constructor)(MainWindow * main_window, - LttvTracesetSelector * s, char *key); -typedef lttv_constructor view_constructor; - -typedef struct _TimeWindow { - LttTime start_time; - LttTime time_width; -} TimeWindow; - -#endif // COMMON_H diff --git a/ltt/branches/poly/lttv/modules/gui/mainlib/gtkdirsel.h b/ltt/branches/poly/lttv/modules/gui/mainlib/gtkdirsel.h deleted file mode 100644 index 103ced2d..00000000 --- a/ltt/branches/poly/lttv/modules/gui/mainlib/gtkdirsel.h +++ /dev/null @@ -1,115 +0,0 @@ -/* This file is part of the Linux Trace Toolkit viewer - * Copyright (C) 2003-2004 Xiangxiu Yang - * - * 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 __GTK_DIR_SEL_H__ -#define __GTK_DIR_SEL_H__ - - -#include -#include - - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - - -#define GTK_TYPE_DIR_SELECTION (gtk_dir_selection_get_type ()) -#define GTK_DIR_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_DIR_SELECTION, GtkDirSelection)) -#define GTK_DIR_SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_DIR_SELECTION, GtkDirSelectionClass)) -#define GTK_IS_DIR_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_DIR_SELECTION)) -#define GTK_IS_DIR_SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_DIR_SELECTION)) -#define GTK_DIR_SELECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_DIR_SELECTION, GtkDirSelectionClass)) - - -typedef struct _GtkDirSelection GtkDirSelection; -typedef struct _GtkDirSelectionClass GtkDirSelectionClass; - -struct _GtkDirSelection -{ - GtkDialog parent_instance; - - GtkWidget *dir_list; - GtkWidget *file_list; - GtkWidget *selection_entry; - GtkWidget *selection_text; - GtkWidget *main_vbox; - GtkWidget *ok_button; - GtkWidget *cancel_button; - GtkWidget *help_button; - GtkWidget *history_pulldown; - GtkWidget *history_menu; - GList *history_list; - GtkWidget *fileop_dialog; - GtkWidget *fileop_entry; - gchar *fileop_file; - gpointer cmpl_state; - - GtkWidget *fileop_c_dir; - GtkWidget *fileop_del_file; - GtkWidget *fileop_ren_file; - - GtkWidget *button_area; - GtkWidget *action_area; - - GPtrArray *selected_names; - gchar *last_selected; -}; - -struct _GtkDirSelectionClass -{ - GtkDialogClass parent_class; - - /* Padding for future expansion */ - void (*_gtk_reserved1) (void); - void (*_gtk_reserved2) (void); - void (*_gtk_reserved3) (void); - void (*_gtk_reserved4) (void); -}; - - -GType gtk_dir_selection_get_type (void) G_GNUC_CONST; -GtkWidget* gtk_dir_selection_new (const gchar *title); -void gtk_dir_selection_set_filename (GtkDirSelection *filesel, - const gchar *filename); -/* This function returns the selected filename in the C runtime's - * multibyte string encoding, which may or may not be the same as that - * used by GDK (UTF-8). To convert to UTF-8, call g_filename_to_utf8(). - * The returned string points to a statically allocated buffer and - * should be copied away. - */ -G_CONST_RETURN gchar* gtk_dir_selection_get_filename (GtkDirSelection *filesel); - -void gtk_dir_selection_complete (GtkDirSelection *filesel, - const gchar *pattern); -void gtk_dir_selection_show_fileop_buttons (GtkDirSelection *filesel); -void gtk_dir_selection_hide_fileop_buttons (GtkDirSelection *filesel); - -gchar** gtk_dir_selection_get_selections (GtkDirSelection *filesel); -const gchar * gtk_dir_selection_get_dir (GtkDirSelection *filesel); -void gtk_dir_selection_set_select_multiple (GtkDirSelection *filesel, - gboolean select_multiple); -gboolean gtk_dir_selection_get_select_multiple (GtkDirSelection *filesel); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __GTK_DIR_SEL_H__ */ diff --git a/ltt/branches/poly/lttv/modules/gui/mainlib/gtkmultivpaned.h b/ltt/branches/poly/lttv/modules/gui/mainlib/gtkmultivpaned.h deleted file mode 100644 index ff8334e2..00000000 --- a/ltt/branches/poly/lttv/modules/gui/mainlib/gtkmultivpaned.h +++ /dev/null @@ -1,92 +0,0 @@ - -/* This file is part of the Linux Trace Toolkit viewer - * Copyright (C) 2003-2004 Xiangxiu Yang - * - * 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 __GTK_MULTI_VPANED_H__ -#define __GTK_MULTI_VPANED_H__ - - -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - - -#define GTK_TYPE_MULTI_VPANED (gtk_multi_vpaned_get_type ()) -#define GTK_MULTI_VPANED(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_MULTI_VPANED, GtkMultiVPaned)) -#define GTK_MULTI_VPANED_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_MULTI_VPANED, GtkMultiVPanedClass)) -#define GTK_IS_MULTI_VPANED(obj ) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_MULTI_VPANED)) -#define GTK_IS_MULTI_VPANED_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MULTI_VPANED)) -#define GTK_MULTI_VPANED_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_MULTI_VPANED, GtkMultiVPanedClass)) - - -typedef struct _GtkMultiVPaned GtkMultiVPaned; -typedef struct _GtkMultiVPanedClass GtkMultiVPanedClass; - -struct _GtkMultiVPaned -{ - GtkPaned container; - - /*< public >*/ - GtkPaned * first_pane; - GtkPaned * last_pane; - GtkPaned * focused_pane; - GtkPaned * iter; - guint num_children; - - GtkWidget * vbox; - // GtkWidget * scrollWindow; - // GtkWidget * viewport; - GtkWidget * hscrollbar; - GtkAdjustment *hadjust; - MainWindow * mw; -}; - -struct _GtkMultiVPanedClass -{ - GtkPanedClass parent_class; -}; - - -GType gtk_multi_vpaned_get_type (void) G_GNUC_CONST; -GtkWidget* gtk_multi_vpaned_new (void); - -void gtk_multi_vpaned_set_focus (GtkWidget * widget, gpointer user_data); -void gtk_multi_vpaned_widget_add(GtkMultiVPaned * multi_vpaned, GtkWidget * widget1); -void gtk_multi_vpaned_widget_delete(GtkMultiVPaned * multi_vpaned); -void gtk_multi_vpaned_widget_move_up(GtkMultiVPaned * multi_vpaned); -void gtk_multi_vpaned_widget_move_down(GtkMultiVPaned * multi_vpaned); -void gtk_multi_vpaned_set_adjust(GtkMultiVPaned * multi_vpaned, gboolean first_time); -void gtk_multi_vpaned_set_data(GtkMultiVPaned * multi_vpaned, char * key, gpointer value); -gpointer gtk_multi_vpaned_get_data(GtkMultiVPaned * multi_vpaned, char * key); -GtkWidget * gtk_multi_vpaned_get_widget(GtkMultiVPaned * multi_vpaned); -GtkWidget * gtk_multi_vpaned_get_first_widget(GtkMultiVPaned * multi_vpaned); -GtkWidget * gtk_multi_vpaned_get_next_widget(GtkMultiVPaned * multi_vpaned); -void gtk_multi_vpaned_set_scroll_value(GtkMultiVPaned * multi_vpaned, double value); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __GTK_MULTI_VPANED_H__ */ diff --git a/ltt/branches/poly/lttv/modules/gui/mainlib/gtktraceset.c b/ltt/branches/poly/lttv/modules/gui/mainlib/gtktraceset.c deleted file mode 100644 index 772583f9..00000000 --- a/ltt/branches/poly/lttv/modules/gui/mainlib/gtktraceset.c +++ /dev/null @@ -1,807 +0,0 @@ -/* This file is part of the Linux Trace Toolkit viewer - * Copyright (C) 2003-2004 XangXiu Yang - * - * 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. - */ - -/*! \file gtktraceset.h - * \brief API used by the graphical viewers to interact with their top window. - * - * Main window (gui module) is the place to contain and display viewers. - * Viewers (lttv plugins) interacte with main window through this API and - * events sent by gtk. - * This header file should be included in each graphic module. - * This library is used by graphical modules to interact with the - * tracesetWindow. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -/** - * Internal function parts - */ - -/** - * Function to set/update traceset for the viewers - * @param main_win main window - * @param traceset traceset of the main window. - */ - -void 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)); - tmp = (LttvHooks*)*(value.v_pointer); - if(tmp == NULL)return; - lttv_hooks_call(tmp,traceset); -} - - -/** - * Function to set/update filter for the viewers - * @param main_win main window - * @param filter filter of the main window. - */ - -void 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)); - tmp = (LttvHooks*)*(value.v_pointer); - - if(tmp == NULL)return; - lttv_hooks_call(tmp,filter); -} - - - -/** - * API parts - */ - -/** - * Function to register a view constructor so that main window can generate - * a toolbar item for the viewer in order to generate a new instance easily. - * It will be called by init function of the module. - * @param ButtonPixmap image shown on the toolbar item. - * @param tooltip tooltip of the toolbar item. - * @param view_constructor constructor of the viewer. - */ - -void toolbar_item_reg(char ** pixmap, char *tooltip, lttv_constructor view_constructor) -{ - LttvIAttribute *attributes_global = LTTV_IATTRIBUTE(lttv_global_attributes()); - LttvToolbars * toolbar; - LttvAttributeValue value; - - g_assert(lttv_iattribute_find_by_path(attributes_global, - "viewers/toolbar", LTTV_POINTER, &value)); - toolbar = (LttvToolbars*)*(value.v_pointer); - - if(toolbar == NULL){ - toolbar = lttv_toolbars_new(); - *(value.v_pointer) = toolbar; - } - lttv_toolbars_add(toolbar, view_constructor, tooltip, pixmap); -} - - -/** - * Function to unregister the viewer's constructor, release the space - * occupied by pixmap, tooltip and constructor of the viewer. - * It will be called when a module is unloaded. - * @param view_constructor constructor of the viewer which is used as - * a reference to find out where the pixmap and tooltip are. - */ - -void toolbar_item_unreg(lttv_constructor view_constructor) -{ - LttvIAttribute *attributes_global = LTTV_IATTRIBUTE(lttv_global_attributes()); - LttvToolbars * toolbar; - LttvAttributeValue value; - - g_assert(lttv_iattribute_find_by_path(attributes_global, - "viewers/toolbar", LTTV_POINTER, &value)); - toolbar = (LttvToolbars*)*(value.v_pointer); - - main_window_remove_toolbar_item(view_constructor); - - lttv_toolbars_remove(toolbar, view_constructor); -} - - -/** - * Function to register a view constructor so that main window can generate - * a menu item for the viewer in order to generate a new instance easily. - * It will be called by init function of the module. - * @param menu_path path of the menu item. - * @param menu_text text of the menu item. - * @param view_constructor constructor of the viewer. - */ - -void menu_item_reg(char *menu_path, char *menu_text, lttv_constructor view_constructor) -{ - LttvIAttribute *attributes_global = LTTV_IATTRIBUTE(lttv_global_attributes()); - LttvMenus * menu; - LttvAttributeValue value; - - g_assert(lttv_iattribute_find_by_path(attributes_global, - "viewers/menu", LTTV_POINTER, &value)); - menu = (LttvMenus*)*(value.v_pointer); - - if(menu == NULL){ - menu = lttv_menus_new(); - *(value.v_pointer) = menu; - } - lttv_menus_add(menu, view_constructor, menu_path, menu_text); -} - -/** - * Function to unregister the viewer's constructor, release the space - * occupied by menu_path, menu_text and constructor of the viewer. - * It will be called when a module is unloaded. - * @param view_constructor constructor of the viewer which is used as - * a reference to find out where the menu_path and menu_text are. - */ - -void menu_item_unreg(lttv_constructor view_constructor) -{ - LttvIAttribute *attributes_global = LTTV_IATTRIBUTE(lttv_global_attributes()); - LttvMenus * menu; - LttvAttributeValue value; - - g_assert(lttv_iattribute_find_by_path(attributes_global, - "viewers/menu", LTTV_POINTER, &value)); - menu = (LttvMenus*)*(value.v_pointer); - - main_window_remove_menu_item(view_constructor); - - 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) -{ - LttvAttributeValue value; - LttvHooks * tmp; - 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){ - tmp = lttv_hooks_new(); - *(value.v_pointer) = tmp; - } - lttv_hooks_add(tmp, hook,hook_data); -} - - -/** - * 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) -{ - LttvAttributeValue value; - LttvHooks * tmp; - 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_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) -{ - 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){ - tmp = lttv_hooks_new(); - *(value.v_pointer) = tmp; - } - lttv_hooks_add(tmp, hook, hook_data); -} - - -/** - * 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) -{ - 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_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) -{ - LttvAttributeValue value; - LttvHooks * tmp; - g_assert(lttv_iattribute_find_by_path(main_win->attributes, - "hooks/updatefilter", LTTV_POINTER, &value)); - tmp = (LttvHooks*)*(value.v_pointer); - if(tmp == NULL){ - tmp = lttv_hooks_new(); - *(value.v_pointer) = tmp; - } - lttv_hooks_add(tmp, hook, hook_data); -} - - -/** - * 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) -{ - LttvAttributeValue value; - LttvHooks * tmp; - g_assert(lttv_iattribute_find_by_path(main_win->attributes, - "hooks/updatefilter", LTTV_POINTER, &value)); - tmp = (LttvHooks*)*(value.v_pointer); - if(tmp == NULL) return; - lttv_hooks_remove_data(tmp, hook, hook_data); -} - - -/** - * 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) -{ - LttvAttributeValue value; - LttvHooks * tmp; - 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){ - tmp = lttv_hooks_new(); - *(value.v_pointer) = tmp; - } - lttv_hooks_add(tmp, hook, hook_data); -} - - -/** - * 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) -{ - LttvAttributeValue value; - LttvHooks * tmp; - 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_remove_data(tmp, hook, hook_data); -} - - -/** - * 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. - * @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) -{ - 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){ - tmp = lttv_hooks_new(); - *(value.v_pointer) = tmp; - } - lttv_hooks_add(tmp, hook, hook_data); -} - - -/** - * 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) -{ - 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_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) -{ - LttvAttributeValue value; - LttvHooks * tmp; - g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes, - "hooks/hpanedividor", LTTV_POINTER, &value)); - tmp = (LttvHooks*)*(value.v_pointer); - if(tmp == NULL){ - tmp = lttv_hooks_new(); - *(value.v_pointer) = tmp; - } - lttv_hooks_add(tmp, hook, hook_data); -} - - -/** - * Function to unregister a viewer's hook function which is used to - * set/update hpane's dividor 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_dividor(LttvHook hook, gpointer hook_data, - MainWindow *main_win) -{ - LttvAttributeValue value; - LttvHooks * tmp; - g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes, - "hooks/hpanedividor", LTTV_POINTER, &value)); - tmp = (LttvHooks*)*(value.v_pointer); - if(tmp == NULL) return; - lttv_hooks_remove_data(tmp, hook, hook_data); -} - - -/** - * Function to set the position of the hpane's dividor (viewer). - * It will be called by a viewer's signal handle associated with - * the motion_notify_event event/signal - * @param main_win the main window the viewer belongs to. - * @param position position of the hpane's dividor. - */ - -void set_hpane_dividor(MainWindow *main_win, gint position) -{ - LttvAttributeValue value; - LttvHooks * tmp; - g_assert(lttv_iattribute_find_by_path(main_win->current_tab->attributes, - "hooks/hpanedividor", LTTV_POINTER, &value)); - tmp = (LttvHooks*)*(value.v_pointer); - if(tmp == NULL) return; - lttv_hooks_call(tmp, &position); -} - - -/** - * Function to process traceset. It will call lttv_process_trace, - * each view will call this api to get events. - * @param main_win the main window the viewer belongs to. - * @param start the start time of the first event to be processed. - * @param end the end time of the last event to be processed. - */ - -void process_traceset_api(MainWindow *main_win, LttTime start, - LttTime end, unsigned maxNumEvents) -{ - lttv_process_traceset_seek_time( - LTTV_TRACESET_CONTEXT(main_win->current_tab->traceset_info-> - traceset_context), - start); - lttv_process_traceset( - LTTV_TRACESET_CONTEXT(main_win->current_tab->traceset_info-> - traceset_context), - end, - maxNumEvents); -} - -/** - * Function to add hooks into the context of a traceset, - * before reading events from traceset, viewer will call this api to - * register hooks - * @param main_win the main window the viewer belongs to. - * @param LttvHooks hooks to be registered. - */ - -void context_add_hooks_api(MainWindow *main_win , - LttvHooks *before_traceset, - LttvHooks *after_traceset, - LttvHooks *check_trace, - LttvHooks *before_trace, - LttvHooks *after_trace, - LttvHooks *check_tracefile, - LttvHooks *before_tracefile, - LttvHooks *after_tracefile, - LttvHooks *check_event, - LttvHooks *before_event, - LttvHooks *after_event) -{ - LttvTracesetContext * tsc = - LTTV_TRACESET_CONTEXT(main_win->current_tab->traceset_info-> - traceset_context); - lttv_traceset_context_add_hooks(tsc,before_traceset,after_traceset, - check_trace,before_trace,after_trace, - check_tracefile,before_tracefile,after_tracefile, - check_event,before_event, after_event); -} - - -/** - * Function to remove hooks from the context of a traceset, - * before reading events from traceset, viewer will call this api to - * unregister hooks - * @param main_win the main window the viewer belongs to. - * @param LttvHooks hooks to be registered. - */ - -void context_remove_hooks_api(MainWindow *main_win , - LttvHooks *before_traceset, - LttvHooks *after_traceset, - LttvHooks *check_trace, - LttvHooks *before_trace, - LttvHooks *after_trace, - LttvHooks *check_tracefile, - LttvHooks *before_tracefile, - LttvHooks *after_tracefile, - LttvHooks *check_event, - LttvHooks *before_event, - LttvHooks *after_event) -{ - LttvTracesetContext * tsc = - LTTV_TRACESET_CONTEXT(main_win->current_tab->traceset_info->traceset_context); - lttv_traceset_context_remove_hooks(tsc,before_traceset,after_traceset, - check_trace,before_trace,after_trace, - check_tracefile,before_tracefile,after_tracefile, - check_event,before_event, after_event); -} - - -/** - * Function to add/remove event hooks for state - * @param main_win the main window the viewer belongs to. - */ - -void state_add_event_hooks_api(MainWindow *main_win ) -{ - lttv_state_add_event_hooks( - (LttvTracesetState*)main_win->current_tab->traceset_info->traceset_context); -} - -void state_remove_event_hooks_api(MainWindow *main_win ) -{ - lttv_state_remove_event_hooks( - (LttvTracesetState*)main_win->current_tab->traceset_info->traceset_context); -} - - -/** - * Function to add/remove event hooks for stats - * @param main_win the main window the viewer belongs to. - */ - -void stats_add_event_hooks_api(MainWindow *main_win ) -{ - lttv_stats_add_event_hooks( - (LttvTracesetStats*)main_win->current_tab->traceset_info->traceset_context); -} - -void stats_remove_event_hooks_api(MainWindow *main_win ) -{ - lttv_stats_remove_event_hooks( - (LttvTracesetStats*)main_win->current_tab->traceset_info->traceset_context); -} - -/** - * Function to get the stats of the traceset - * @param main_win the main window the viewer belongs to. - */ - -LttvTracesetStats* get_traceset_stats_api(MainWindow *main_win) -{ - return main_win->current_tab->traceset_info->traceset_context; -} - - -LttvTracesetContext* get_traceset_context(MainWindow *main_win) -{ - return (LttvTracesetContext*)main_win->current_tab->traceset_info->traceset_context; -} diff --git a/ltt/branches/poly/lttv/modules/gui/mainlib/gtktraceset.h b/ltt/branches/poly/lttv/modules/gui/mainlib/gtktraceset.h deleted file mode 100644 index 19035482..00000000 --- a/ltt/branches/poly/lttv/modules/gui/mainlib/gtktraceset.h +++ /dev/null @@ -1,476 +0,0 @@ -/* This file is part of the Linux Trace Toolkit viewer - * Copyright (C) 2003-2004 Xiangxiu Yang - * - * 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. - */ - -/* -CHECK Rename to viewer.h - -Things that can happen to a viewer: - -update_time_window -update_current_time -update_traceset -update_filter -show_viewer -update_dividor -?? Reshape, damage ?? - -Things that a viewer can do: - -update_status -set_time_window -set_current_time -update_traceset? -update_filter? -show_viewer? -set_focused_pane -set_hpane_dividor -*/ - - - - -/*! \file gtktraceset.h - * \brief API used by the graphical viewers to interact with their top window. - * - * Main window (gui module) is the place to contain and display viewers. - * Viewers (lttv plugins) interacte with main window through this API and - * events sent by gtk. - * This header file should be included in each graphic module. - * This library is used by graphical modules to interact with the - * tracesetWindow. - * - */ - -#include -#include -#include -#include -#include - -/** - * Function to register a view constructor so that main window can generate - * a toolbar item for the viewer in order to generate a new instance easily. - * It will be called by init function of the module. - * @param ButtonPixmap image shown on the toolbar item. - * @param tooltip tooltip of the toolbar item. - * @param view_constructor constructor of the viewer. - */ - -void toolbar_item_reg(char ** pixmap, char *tooltip, lttv_constructor view_constructor); - - -/** - * Function to unregister the viewer's constructor, release the space - * occupied by pixmap, tooltip and constructor of the viewer. - * It will be called when a module is unloaded. - * @param view_constructor constructor of the viewer which is used as - * a reference to find out where the pixmap and tooltip are. - */ - -void toolbar_item_unreg(lttv_constructor view_constructor); - - -/** - * Function to register a view constructor so that main window can generate - * a menu item for the viewer in order to generate a new instance easily. - * It will be called by init function of the module. - * @param menu_path path of the menu item. - * @param menu_text text of the menu item. - * @param view_constructor constructor of the viewer. - */ - -void menu_item_reg(char *menu_path, char *menu_text, lttv_constructor view_constructor); - - -/** - * Function to unregister the viewer's constructor, release the space - * occupied by menu_path, menu_text and constructor of the viewer. - * It will be called when a module is unloaded. - * @param view_constructor constructor of the viewer which is used as - * a reference to find out where the menu_path and menu_text are. - */ - -void menu_item_unreg(lttv_constructor 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 window of the current tab. - * It will be called by a viewer's hook function to update the - * time window 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); - - -/** - * 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); - -/** - * 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); - - -/** - * 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); - - -/** - * 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. Takes a TimeInterval* as call_data. - * @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); - - -/** - * 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. Takes a TimeInterval as call_data. - * @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); - - -/** - * 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); - - -/** - * 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); - - -/** - * 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); - - -/** - * 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); - - -/** - * 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); - - -/** - * 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); - - -/** - * 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); - - -/** - * 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. - * @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); - - -/** - * 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); - - -/** - * 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); - - -/** - * 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); - - -/** - * 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); - - -/** - * Function to unregister a viewer's hook function which is used to - * set/update hpane's dividor 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_dividor(LttvHook hook, gpointer hook_data, - MainWindow *main_win); - - -/** - * Function to set the position of the hpane's dividor (viewer). - * It will be called by a viewer's signal handle associated with - * the motion_notify_event event/signal - * @param main_win the main window the viewer belongs to. - * @param position position of the hpane's dividor. - */ - -void set_hpane_dividor(MainWindow *main_win, gint position); - - -/* -CHECK These functions really should not appear here. Directr calls would -be OK unless there is a linker problem. -*/ -/** - * Function to process traceset. It will call lttv_process_trace, - * each view will call this api to get events. - * @param main_win the main window the viewer belongs to. - * @param start the start time of the first event to be processed. - * @param end the end time of the last event to be processed. - */ - -void process_traceset_api(MainWindow *main_win, LttTime start, - LttTime end, unsigned maxNumEvents); - - -/** - * Function to add hooks into the context of a traceset, - * before reading events from traceset, viewer will call this api to - * register hooks - * @param main_win the main window the viewer belongs to. - * @param LttvHooks hooks to be registered. - */ - -void context_add_hooks_api(MainWindow *main_win , - LttvHooks *before_traceset, - LttvHooks *after_traceset, - LttvHooks *check_trace, - LttvHooks *before_trace, - LttvHooks *after_trace, - LttvHooks *check_tracefile, - LttvHooks *before_tracefile, - LttvHooks *after_tracefile, - LttvHooks *check_event, - LttvHooks *before_event, - LttvHooks *after_event); - - -/** - * Function to remove hooks from the context of a traceset, - * before reading events from traceset, viewer will call this api to - * unregister hooks - * @param main_win the main window the viewer belongs to. - * @param LttvHooks hooks to be registered. - */ - -void context_remove_hooks_api(MainWindow *main_win , - LttvHooks *before_traceset, - LttvHooks *after_traceset, - LttvHooks *check_trace, - LttvHooks *before_trace, - LttvHooks *after_trace, - LttvHooks *check_tracefile, - LttvHooks *before_tracefile, - LttvHooks *after_tracefile, - LttvHooks *check_event, - LttvHooks *before_event, - LttvHooks *after_event); - - -/** - * Function to get the life span of the traceset - * @param main_win the main window the viewer belongs to. - * @param start start time of the traceset. - * @param end end time of the traceset. - */ - -void get_traceset_time_span(MainWindow *main_win, TimeInterval *time_span); - - -/** - * Function to add/remove event hooks for state - * @param main_win the main window the viewer belongs to. - */ - -void state_add_event_hooks_api(MainWindow *main_win ); -void state_remove_event_hooks_api(MainWindow *main_win ); - - -/** - * Function to add/remove event hooks for stats - * @param main_win the main window the viewer belongs to. - */ - -void stats_add_event_hooks_api(MainWindow *main_win ); -void stats_remove_event_hooks_api(MainWindow *main_win ); - - -/** - * Function to get the stats of the traceset - * @param main_win the main window the viewer belongs to. - */ - -LttvTracesetStats* get_traceset_stats_api(MainWindow *main_win); - -LttvTracesetContext* get_traceset_context(MainWindow *main_win); diff --git a/ltt/branches/poly/lttv/modules/gui/mainlib/lttvfilter.h b/ltt/branches/poly/lttv/modules/gui/mainlib/lttvfilter.h deleted file mode 100644 index f2dab415..00000000 --- a/ltt/branches/poly/lttv/modules/gui/mainlib/lttvfilter.h +++ /dev/null @@ -1,89 +0,0 @@ -/* This file is part of the Linux Trace Toolkit viewer - * Copyright (C) 2003-2004 Xiangxiu Yang - * - * 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_FILTER_H -#define LTTV_FILTER_H - -#include - - -typedef struct _LttvTracesetSelector LttvTracesetSelector; -typedef struct _LttvTraceSelector LttvTraceSelector; -typedef struct _LttvTracefileSelector LttvTracefileSelector; -typedef struct _LttvEventtypeSelector LttvEventtypeSelector; - - -LttvTracesetSelector *lttv_traceset_selector_new(char * name); -LttvTraceSelector *lttv_trace_selector_new(LttTrace *t); -LttvTracefileSelector *lttv_tracefile_selector_new(LttTracefile *t); -LttvEventtypeSelector *lttv_eventtype_selector_new(LttEventType * et); -void lttv_traceset_selector_destroy(LttvTracesetSelector *s); -void lttv_trace_selector_destroy(LttvTraceSelector *t); -void lttv_tracefile_selector_destroy(LttvTracefileSelector *t); -void lttv_eventtype_selector_destroy(LttvEventtypeSelector *t); - - -void lttv_traceset_selector_trace_add(LttvTracesetSelector *s, - LttvTraceSelector *t); -unsigned lttv_traceset_selector_trace_number(LttvTracesetSelector *s); -LttvTraceSelector *lttv_traceset_selector_trace_get(LttvTracesetSelector *s, - unsigned i); -void lttv_traceset_selector_trace_remove(LttvTracesetSelector *s, - unsigned i); - - -void lttv_trace_selector_tracefile_add(LttvTraceSelector *s, - LttvTracefileSelector *t); -unsigned lttv_trace_selector_tracefile_number(LttvTraceSelector *s); -LttvTracefileSelector *lttv_trace_selector_tracefile_get(LttvTraceSelector *s, - unsigned i); -void lttv_trace_selector_tracefile_remove(LttvTraceSelector *s, unsigned i); - -void lttv_trace_selector_eventtype_add(LttvTraceSelector *s, - LttvEventtypeSelector *et); -unsigned lttv_trace_selector_eventtype_number(LttvTraceSelector *s); -LttvEventtypeSelector *lttv_trace_selector_eventtype_get(LttvTraceSelector *s, - unsigned i); -void lttv_trace_selector_eventtype_remove(LttvTraceSelector *s, unsigned i); - - -void lttv_tracefile_selector_eventtype_add(LttvTracefileSelector *s, - LttvEventtypeSelector *et); -unsigned lttv_tracefile_selector_eventtype_number(LttvTracefileSelector *s); -LttvEventtypeSelector *lttv_tracefile_selector_eventtype_get(LttvTracefileSelector *s, - unsigned i); -void lttv_tracefile_selector_eventtype_remove(LttvTracefileSelector *s, unsigned i); - - -void lttv_trace_selector_set_selected(LttvTraceSelector *s, gboolean g); -void lttv_tracefile_selector_set_selected(LttvTracefileSelector *s, gboolean g); -void lttv_eventtype_selector_set_selected(LttvEventtypeSelector *s, gboolean g); -gboolean lttv_trace_selector_get_selected(LttvTraceSelector *s); -gboolean lttv_tracefile_selector_get_selected(LttvTracefileSelector *s); -gboolean lttv_eventtype_selector_get_selected(LttvEventtypeSelector *s); -char * lttv_traceset_selector_get_name(LttvTracesetSelector *s); -char * lttv_trace_selector_get_name(LttvTraceSelector *s); -char * lttv_tracefile_selector_get_name(LttvTracefileSelector *s); -char * lttv_eventtype_selector_get_name(LttvEventtypeSelector *s); - -LttvEventtypeSelector * lttv_eventtype_selector_clone(LttvEventtypeSelector * s); -void lttv_eventtype_selector_copy(LttvTraceSelector *s, LttvTracefileSelector *d); - - -#endif // LTTV_FILTER_H - diff --git a/ltt/branches/poly/lttv/modules/gui/mainlib/mainwindow.h b/ltt/branches/poly/lttv/modules/gui/mainlib/mainwindow.h deleted file mode 100644 index 8ef8defb..00000000 --- a/ltt/branches/poly/lttv/modules/gui/mainlib/mainwindow.h +++ /dev/null @@ -1,100 +0,0 @@ -/* This file is part of the Linux Trace Toolkit viewer - * Copyright (C) 2003-2004 Xiangxiu Yang - * - * 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 _MAIN_WINDOW_ -#define _MAIN_WINDOW_ - -#include - -#include -#include -#include -#include - -#include -#include -#include -#include - -typedef struct _TracesetInfo { - //FIXME? TracesetContext and stats in same or different variable ? - LttvTracesetStats * traceset_context; - LttvTraceset * traceset; -} TracesetInfo ; - - -struct _MainWindow{ - GtkWidget* mwindow; /* Main Window */ - int window_width; - - /* Status bar information */ - // guint MainSBarContextID; /* Context ID of main status bar */ - // guint BegTimeSBarContextID; /* Context ID of BegTime status bar */ - // guint EndTimeSBarContextID; /* Context ID of EndTime status bar */ - - /* Child windows */ - //openTracesetWindow* OpenTracesetWindow;/* Window to get prof and proc file*/ - //viewTimeFrameWindow* ViewTimeFrameWindow;/*Window to select time frame */ - //gotoEventWindow* GotoEventWindow; /*search for event description*/ - //openFilterWindow* OpenFilterWindow; /* Open a filter selection window */ - GtkWidget* help_contents;/* Window to display help contents */ - GtkWidget* about_box; /* Window about information */ - - // lttv_trace_filter * filter; /* trace filter associated with the window */ - - /* Attributes for trace reading hooks local to the main window */ - LttvIAttribute * attributes; - - Tab * tab; - Tab * current_tab; - - GHashTable * hash_menu_item; - GHashTable * hash_toolbar_item; -}; - - -struct _Tab{ - GtkWidget * label; - GtkMultiVPaned * multi_vpaned; - - // startTime is the left of the visible area. Corresponds to the scrollbar - // value. - // Time_Width is a zoom dependant value (corresponding to page size) - TimeWindow time_window; - - // The current time is the time selected in the visible area by the user, - // not the scrollbar value. - LttTime current_time; - LttvIAttribute * attributes; - - struct _Tab * next; - MainWindow * mw; - - /* Traceset related information */ - TracesetInfo * traceset_info; -}; - -/** - * Remove menu and toolbar item when a module unloaded - */ -void main_window_remove_menu_item(lttv_constructor view_constructor); -void main_window_remove_toolbar_item(lttv_constructor view_constructor); - -#endif /* _MAIN_WINDOW_ */ - - diff --git a/ltt/branches/poly/lttv/modules/gui/mainlib/menu.c b/ltt/branches/poly/lttv/modules/gui/mainlib/menu.c deleted file mode 100644 index 22dcd016..00000000 --- a/ltt/branches/poly/lttv/modules/gui/mainlib/menu.c +++ /dev/null @@ -1,68 +0,0 @@ -/* This file is part of the Linux Trace Toolkit viewer - * Copyright (C) 2003-2004 XangXiu Yang - * - * 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 -#include - - -inline LttvMenus *lttv_menus_new() { - return g_array_new(FALSE, FALSE, sizeof(lttv_menu_closure)); -} - -/* MD: delete elements of the array also, but don't free pointed addresses - * (functions). - */ -inline void lttv_menus_destroy(LttvMenus *h) { - g_debug("lttv_menus_destroy()"); - g_array_free(h, TRUE); -} - -inline void lttv_menus_add(LttvMenus *h, lttv_constructor f, char* menuPath, char* menuText) -{ - lttv_menu_closure c; - - /* if h is null, do nothing, or popup a warning message */ - if(h == NULL)return; - - c.con = f; - c.menuPath = menuPath; - c.menuText = menuText; - g_array_append_val(h,c); -} - -gboolean lttv_menus_remove(LttvMenus *h, lttv_constructor f) -{ - lttv_menu_closure * tmp; - gint i; - for(i=0;ilen;i++){ - tmp = & g_array_index(h, lttv_menu_closure, i); - if(tmp->con == f)break; - } - if(ilen){ - g_array_remove_index(h, i); - return TRUE; - }else return FALSE; - -} - -unsigned lttv_menus_number(LttvMenus *h) -{ - return h->len; -} - - diff --git a/ltt/branches/poly/lttv/modules/gui/mainlib/menu.h b/ltt/branches/poly/lttv/modules/gui/mainlib/menu.h deleted file mode 100644 index ec20c099..00000000 --- a/ltt/branches/poly/lttv/modules/gui/mainlib/menu.h +++ /dev/null @@ -1,47 +0,0 @@ -/* This file is part of the Linux Trace Toolkit viewer - * Copyright (C) 2003-2004 Xiangxiu Yang - * - * 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 MENU_H -#define MENU_H - -#include - -/* constructor of the viewer */ -//typedef GtkWidget* (*lttv_constructor)(void * main_window); - - -typedef GArray LttvMenus; - -typedef struct _lttv_menu_closure { - lttv_constructor con; - char * menuPath; - char * menuText; -} lttv_menu_closure; - - -LttvMenus *lttv_menus_new(); - -void lttv_menus_destroy(LttvMenus *h); - -void lttv_menus_add(LttvMenus *h, lttv_constructor f, char* menuPath, char * menuText); - -gboolean lttv_menus_remove(LttvMenus *h, lttv_constructor f); - -unsigned lttv_menus_number(LttvMenus *h); - -#endif // MENU_H diff --git a/ltt/branches/poly/lttv/modules/gui/mainlib/toolbar.c b/ltt/branches/poly/lttv/modules/gui/mainlib/toolbar.c deleted file mode 100644 index cacd8d8d..00000000 --- a/ltt/branches/poly/lttv/modules/gui/mainlib/toolbar.c +++ /dev/null @@ -1,67 +0,0 @@ -/* This file is part of the Linux Trace Toolkit viewer - * Copyright (C) 2003-2004 XangXiu Yang - * - * 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 -#include - - -inline LttvToolbars *lttv_toolbars_new() { - return g_array_new(FALSE, FALSE, sizeof(lttv_toolbar_closure)); -} - -/* MD: delete elements of the array also, but don't free pointed addresses - * (functions). - */ -inline void lttv_toolbars_destroy(LttvToolbars *h) { - g_debug("lttv_toolbars_destroy"); - g_array_free(h, TRUE); -} - -inline void lttv_toolbars_add(LttvToolbars *h, lttv_constructor f, char* tooltip, char ** pixmap) -{ - lttv_toolbar_closure c; - - /* if h is null, do nothing, or popup a warning message */ - if(h == NULL)return; - - c.con = f; - c.tooltip = tooltip; - c.pixmap = pixmap; - g_array_append_val(h,c); -} - -gboolean lttv_toolbars_remove(LttvToolbars *h, lttv_constructor f) -{ - lttv_toolbar_closure * tmp; - gint i; - for(i=0;ilen;i++){ - tmp = & g_array_index(h, lttv_toolbar_closure, i); - if(tmp->con == f)break; - } - if(ilen){ - g_array_remove_index(h, i); - return TRUE; - }else return FALSE; -} - -unsigned lttv_toolbars_number(LttvToolbars *h) -{ - return h->len; -} - - diff --git a/ltt/branches/poly/lttv/modules/gui/mainlib/toolbar.h b/ltt/branches/poly/lttv/modules/gui/mainlib/toolbar.h deleted file mode 100644 index af12d937..00000000 --- a/ltt/branches/poly/lttv/modules/gui/mainlib/toolbar.h +++ /dev/null @@ -1,46 +0,0 @@ -/* This file is part of the Linux Trace Toolkit viewer - * Copyright (C) 2003-2004 Xiangxiu Yang - * - * 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 TOOLBAR_H -#define TOOLBAR_H - -#include - -/* constructor of the viewer */ -//typedef GtkWidget* (*lttv_constructor)(void * main_window); - - -typedef GArray LttvToolbars; - -typedef struct _lttv_toolbar_closure { - lttv_constructor con; - char * tooltip; - char ** pixmap; -} lttv_toolbar_closure; - -LttvToolbars *lttv_toolbars_new(); - -void lttv_toolbars_destroy(LttvToolbars *h); - -void lttv_toolbars_add(LttvToolbars *h, lttv_constructor f, char* tooltip, char ** pixmap); - -gboolean lttv_toolbars_remove(LttvToolbars *h, lttv_constructor f); - -unsigned lttv_toolbars_number(LttvToolbars *h); - -#endif // TOOLBAR_H diff --git a/ltt/branches/poly/lttv/modules/gui/statistics/Makefile.am b/ltt/branches/poly/lttv/modules/gui/statistics/Makefile.am index 602621ba..f15a5b9f 100644 --- a/ltt/branches/poly/lttv/modules/gui/statistics/Makefile.am +++ b/ltt/branches/poly/lttv/modules/gui/statistics/Makefile.am @@ -14,3 +14,6 @@ libdir = ${lttvplugindir} lib_LTLIBRARIES = libguistatistics.la libguistatistics_la_LDFLAGS = -module libguistatistics_la_SOURCES = statistics.c + +EXTRA_DIST = \ + hGuiStatisticInsert.xpm \ No newline at end of file diff --git a/ltt/branches/poly/lttv/modules/gui/statistics/hGuiStatisticInsert.xpm b/ltt/branches/poly/lttv/modules/gui/statistics/hGuiStatisticInsert.xpm new file mode 100644 index 00000000..1a78b4de --- /dev/null +++ b/ltt/branches/poly/lttv/modules/gui/statistics/hGuiStatisticInsert.xpm @@ -0,0 +1,27 @@ +/* XPM */ +static char * hGuiStatisticInsert_xpm[] = { +"22 22 2 1", +" c None", +". c #800080", +" ", +" ", +" ", +" .............. ", +" .... ... ", +" .... . ", +" .... . ", +" .... ", +" .... ", +" .... ", +" .... ", +" ... ", +" ... ", +" ... ", +" ... ", +" ... ", +" ... . ", +" ... . ", +" ... ... ", +" .............. ", +" ", +" "}; diff --git a/ltt/branches/poly/lttv/modules/gui/statistics/statistics.c b/ltt/branches/poly/lttv/modules/gui/statistics/statistics.c index 92cee3cc..d1726c00 100644 --- a/ltt/branches/poly/lttv/modules/gui/statistics/statistics.c +++ b/ltt/branches/poly/lttv/modules/gui/statistics/statistics.c @@ -22,10 +22,10 @@ #include #include -#include +#include #include #include -#include +#include #include #include @@ -36,7 +36,7 @@ #include -#include "../icons/hGuiStatisticInsert.xpm" +#include "hGuiStatisticInsert.xpm" #define PATH_LENGTH 256 /* CHECK */