Draw_Context->Current->modify_over->x,
Draw_Context->Current->modify_over->y,
Properties->size, Properties->size, 0, 360*64);
+ g_critical("I draw arc over, x: %i, y: %i", Draw_Context->Current->modify_over->x, Draw_Context->Current->modify_over->y);
Draw_Context->Current->modify_over->x += Properties->size;
-
break;
case MIDDLE:
gdk_draw_arc(Draw_Context->drawable, Draw_Context->gc,
* draw a line or background.
*
*/
+
+
struct _DrawContext {
GdkDrawable *drawable;
GdkGC *gc;
DrawInfo *Previous;
};
-struct _DrawInfo {
- ItemInfo *over;
- ItemInfo *middle;
- ItemInfo *under;
-
- ItemInfo *modify_over;
- ItemInfo *modify_middle;
- ItemInfo *modify_under;
-};
-
/* LttvExecutionState is accessible through the LttvTracefileState. Is has
* a pointer to the LttvProcessState which points to the top of stack
* execution state : LttvExecutionState *state.
* LttvTracefileContext, it gives the LttEvent structure, which is needed
* to get facility name and event name.
*/
-struct _ItemInfo {
- gint x, y;
+struct _DrawInfo {
+ ItemInfo *over;
+ ItemInfo *middle;
+ ItemInfo *under;
+
+ ItemInfo *modify_over;
+ ItemInfo *modify_middle;
+ ItemInfo *modify_under;
LttvTraceState *ts;
LttvTracefileState *tfs;
};
+struct _ItemInfo {
+ gint x, y;
+};
+
/*
* Structure used to keep information about icons.
*/
g_critical("x is : %i, x+width is : %i", x, x+width);
- convert_pixels_to_time(width, x,
+ convert_pixels_to_time(Drawing->Drawing_Area_V->allocation.width, x,
&control_flow_data->Time_Window.start_time,
&window_end,
&start);
- convert_pixels_to_time(width, x + width,
+ convert_pixels_to_time(Drawing->Drawing_Area_V->allocation.width, x + width,
&control_flow_data->Time_Window.start_time,
&window_end,
&end);
event_request.time_end.tv_nsec);
LttvHooks *event = lttv_hooks_new();
+ state_add_event_hooks_api(control_flow_data->Parent_Window);
lttv_hooks_add(event, draw_event_hook, &event_request);
lttv_process_traceset_seek_time(tsc, start);
lttv_traceset_context_remove_hooks(tsc, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, event, NULL);
+ state_remove_event_hooks_api(control_flow_data->Parent_Window);
lttv_hooks_destroy(event);
}
0, 0,
-1, -1);
+ if (Drawing->Pixmap)
+ gdk_pixmap_unref(Drawing->Pixmap);
+
+ Drawing->Pixmap = Pixmap;
+
/* Request data for missing space */
g_critical("missing data");
drawing_data_request(Drawing, &Pixmap, Drawing->width, 0,
- if (Drawing->Pixmap)
- gdk_pixmap_unref(Drawing->Pixmap);
-
- Drawing->Pixmap = Pixmap;
Drawing->width = widget->allocation.width;
Drawing->height = widget->allocation.height;
LttTime window_time_begin,
LttTime window_time_end,
LttTime time,
- int width,
+ gint width,
guint *x);
#endif // _DRAWING_H
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <glib.h>
+#include <assert.h>
//#include <pango/pango.h>
+#include <ltt/event.h>
+
#include <lttv/hook.h>
#include <lttv/common.h>
+#include <lttv/state.h>
+
#include "Event_Hooks.h"
#include "CFV.h"
#include "Drawing.h"
#include "CFV-private.h"
+
#define MAX_PATH_LEN 256
//FIXME : remove this include when tests finished.
DrawInfo current, previous;
ItemInfo over, middle, under, modify_over, modify_middle, modify_under;
- int i,j;
+ int i=0,j=0;
- for(i=0; i<1024;i=i+15)
+ //for(i=0; i<1024;i=i+15)
{
- for(j=0;j<768;j=j+15)
+ // for(j=0;j<768;j=j+15)
{
over.x = i;
over.y = j;
- over.ts = NULL;
- over.tfs = NULL;
current.modify_over = &over;
}
+#ifdef NOTUSE
/* NOTE : no drawing data should be sent there, since the drawing widget
* has not been initialized */
void send_test_drawing(ProcessList *Process_List,
Process_List->Test_Process_Sent = TRUE;
}
-
+#endif//NOTUSE
/**
int draw_event_hook(void *hook_data, void *call_data)
{
EventRequest *Event_Request = (EventRequest*)hook_data;
-
+ ControlFlowData *control_flow_data = Event_Request->Control_Flow_Data;
//static int i=0;
//i++;
//g_critical("%i", i);
-
- /* Text dumping if the information */
- GString *string = g_string_new("");;
- gboolean field_names = TRUE, state = TRUE;
- LttvTracefileContext *tfc = (LttvTracefileContext *)call_data;
+ LttvTracefileContext *tfc = (LttvTracefileContext *)call_data;
LttvTracefileState *tfs = (LttvTracefileState *)call_data;
LttEvent *e;
-
e = tfc->e;
+ /* Temp dump */
+#ifdef DONTSHOW
+ GString *string = g_string_new("");;
+ gboolean field_names = TRUE, state = TRUE;
+
lttv_event_to_string(e, tfc->tf, string, TRUE, field_names, tfs);
g_string_append_printf(string,"\n");
g_string_free(string, TRUE);
/* End of text dump */
-
+#endif //DONTSHOW
/* Add process to process list (if not present) and get drawing "y" from
* process position */
guint pid = tfs->process->pid;
LttTime birth = tfs->process->creation_time;
- guint y = 0, height = 0;
+ guint y = 0, height = 0, pl_height = 0;
+ HashedProcessData *Hashed_Process_Data = NULL;
+
ProcessList *process_list =
guicontrolflow_get_process_list(Event_Request->Control_Flow_Data);
pid,
&birth,
&y,
- &height) == 1)
+ &height,
+ &Hashed_Process_Data) == 1)
{
/* Process not present */
processlist_add(process_list,
pid,
&birth,
- &y);
+ &pl_height,
+ &Hashed_Process_Data);
drawing_insert_square( Event_Request->Control_Flow_Data->Drawing, y, height);
}
-
+
/* Find pixels corresponding to time of the event. If the time does
* not fit in the window, show a warning, not supposed to happend. */
-
+ guint x = 0;
+ guint width = control_flow_data->Drawing->Drawing_Area_V->allocation.width;
- /* Finally, draw what represents the event. */
+ LttTime time = ltt_event_time(e);
+
+ LttTime window_end = ltt_time_add(control_flow_data->Time_Window.time_width,
+ control_flow_data->Time_Window.start_time);
+
+
+ convert_time_to_pixels(
+ control_flow_data->Time_Window.start_time,
+ window_end,
+ time,
+ width,
+ &x);
+ assert(x <= width);
+ /* Finally, draw what represents the event. */
+
+ GdkColor color = { 0, 0xffff, 0x0000, 0x0000 };
+ PropertiesArc prop_arc;
+ prop_arc.color = &color;
+ prop_arc.size = 10;
+ prop_arc.filled = TRUE;
+ prop_arc.position = OVER;
+ DrawContext *draw_context = Hashed_Process_Data->draw_context;
+ draw_context->Current->modify_over->x = x;
+ g_critical("x should be %i", x);
+ draw_context->Current->modify_over->y = y;
+ g_critical("y should be %i", y);
+ draw_context->drawable = control_flow_data->Drawing->Pixmap;
+ GtkWidget *widget = control_flow_data->Drawing->Drawing_Area_V;
+ //draw_context->gc = widget->style->fg_gc[GTK_WIDGET_STATE (widget)];
+ draw_context->gc = widget->style->black_gc;
+
+ draw_arc((void*)&prop_arc, (void*)draw_context);
+ //test_draw_item(control_flow_data->Drawing, control_flow_data->Drawing->Pixmap);
return 0;
}
#include <gtk/gtk.h>
#include <glib.h>
#include "Process_List.h"
-
+#include "Draw_Item.h"
/*****************************************************************************
* Methods to synchronize process list *
int processlist_add( ProcessList *Process_List,
guint pid,
LttTime *birth,
- guint *height)
+ guint *height,
+ HashedProcessData **pmHashed_Process_Data)
{
GtkTreeIter iter ;
ProcessInfo *Process_Info = g_new(ProcessInfo, 1);
- GtkTreeRowReference *RowRef;
-
+ HashedProcessData *Hashed_Process_Data = g_new(HashedProcessData, 1);
+ *pmHashed_Process_Data = Hashed_Process_Data;
+
Process_Info->pid = pid;
Process_Info->birth = *birth;
+ Hashed_Process_Data->draw_context = g_new(DrawContext, 1);
+ Hashed_Process_Data->draw_context->drawable = NULL;
+ Hashed_Process_Data->draw_context->gc = NULL;
+ Hashed_Process_Data->draw_context->Current = g_new(DrawInfo,1);
+ Hashed_Process_Data->draw_context->Current->over = g_new(ItemInfo,1);
+ Hashed_Process_Data->draw_context->Current->over->x = -1;
+ Hashed_Process_Data->draw_context->Current->over->y = -1;
+ Hashed_Process_Data->draw_context->Current->middle = g_new(ItemInfo,1);
+ Hashed_Process_Data->draw_context->Current->middle->x = -1;
+ Hashed_Process_Data->draw_context->Current->middle->y = -1;
+ Hashed_Process_Data->draw_context->Current->under = g_new(ItemInfo,1);
+ Hashed_Process_Data->draw_context->Current->under->x = -1;
+ Hashed_Process_Data->draw_context->Current->under->y = -1;
+ Hashed_Process_Data->draw_context->Current->modify_over = g_new(ItemInfo,1);
+ Hashed_Process_Data->draw_context->Current->modify_over->x = -1;
+ Hashed_Process_Data->draw_context->Current->modify_over->y = -1;
+ Hashed_Process_Data->draw_context->Current->modify_middle = g_new(ItemInfo,1);
+ Hashed_Process_Data->draw_context->Current->modify_middle->x = -1;
+ Hashed_Process_Data->draw_context->Current->modify_middle->y = -1;
+ Hashed_Process_Data->draw_context->Current->modify_under = g_new(ItemInfo,1);
+ Hashed_Process_Data->draw_context->Current->modify_under->x = -1;
+ Hashed_Process_Data->draw_context->Current->modify_under->y = -1;
+ Hashed_Process_Data->draw_context->Current->ts = NULL;
+ Hashed_Process_Data->draw_context->Current->tfs = NULL;
+ Hashed_Process_Data->draw_context->Previous = g_new(DrawInfo,1);
+ Hashed_Process_Data->draw_context->Previous->over = g_new(ItemInfo,1);
+ Hashed_Process_Data->draw_context->Previous->over->x = -1;
+ Hashed_Process_Data->draw_context->Previous->over->y = -1;
+ Hashed_Process_Data->draw_context->Previous->middle = g_new(ItemInfo,1);
+ Hashed_Process_Data->draw_context->Previous->middle->x = -1;
+ Hashed_Process_Data->draw_context->Previous->middle->y = -1;
+ Hashed_Process_Data->draw_context->Previous->under = g_new(ItemInfo,1);
+ Hashed_Process_Data->draw_context->Previous->under->x = -1;
+ Hashed_Process_Data->draw_context->Previous->under->y = -1;
+ Hashed_Process_Data->draw_context->Previous->modify_over = g_new(ItemInfo,1);
+ Hashed_Process_Data->draw_context->Previous->modify_over->x = -1;
+ Hashed_Process_Data->draw_context->Previous->modify_over->y = -1;
+ Hashed_Process_Data->draw_context->Previous->modify_middle = g_new(ItemInfo,1);
+ Hashed_Process_Data->draw_context->Previous->modify_middle->x = -1;
+ Hashed_Process_Data->draw_context->Previous->modify_middle->y = -1;
+ Hashed_Process_Data->draw_context->Previous->modify_under = g_new(ItemInfo,1);
+ Hashed_Process_Data->draw_context->Previous->modify_under->x = -1;
+ Hashed_Process_Data->draw_context->Previous->modify_under->y = -1;
+ Hashed_Process_Data->draw_context->Previous->ts = NULL;
+ Hashed_Process_Data->draw_context->Previous->tfs = NULL;
+
/* Add a new row to the model */
gtk_list_store_append ( Process_List->Store_M, &iter);
//g_critical ( "iter before : %s", gtk_tree_path_to_string (
BIRTH_S_COLUMN, birth->tv_sec,
BIRTH_NS_COLUMN, birth->tv_nsec,
-1);
- RowRef = gtk_tree_row_reference_new (
+ Hashed_Process_Data->RowRef = gtk_tree_row_reference_new (
GTK_TREE_MODEL(Process_List->Store_M),
gtk_tree_model_get_path(
GTK_TREE_MODEL(Process_List->Store_M),
&iter));
-
g_hash_table_insert( Process_List->Process_Hash,
(gpointer)Process_Info,
- (gpointer)RowRef);
+ (gpointer)Hashed_Process_Data);
//g_critical ( "iter after : %s", gtk_tree_path_to_string (
// gtk_tree_model_get_path (
{
ProcessInfo Process_Info;
gint *path_indices;
- GtkTreeRowReference *got_RowRef;
+ HashedProcessData *Hashed_Process_Data;
GtkTreeIter iter;
Process_Info.pid = pid;
Process_Info.birth = *birth;
- if(got_RowRef =
- (GtkTreeRowReference*)g_hash_table_lookup(
+
+ if(Hashed_Process_Data =
+ (HashedProcessData*)g_hash_table_lookup(
Process_List->Process_Hash,
&Process_Info))
{
GTK_TREE_MODEL(Process_List->Store_M),
&iter,
gtk_tree_row_reference_get_path(
- (GtkTreeRowReference*)got_RowRef)
+ (GtkTreeRowReference*)Hashed_Process_Data->RowRef)
);
gtk_list_store_remove (Process_List->Store_M, &iter);
-
+
+ g_free(Hashed_Process_Data->draw_context->Previous->modify_under);
+ g_free(Hashed_Process_Data->draw_context->Previous->modify_middle);
+ g_free(Hashed_Process_Data->draw_context->Previous->modify_over);
+ g_free(Hashed_Process_Data->draw_context->Previous->under);
+ g_free(Hashed_Process_Data->draw_context->Previous->middle);
+ g_free(Hashed_Process_Data->draw_context->Previous->over);
+ g_free(Hashed_Process_Data->draw_context->Previous);
+ g_free(Hashed_Process_Data->draw_context->Current->modify_under);
+ g_free(Hashed_Process_Data->draw_context->Current->modify_middle);
+ g_free(Hashed_Process_Data->draw_context->Current->modify_over);
+ g_free(Hashed_Process_Data->draw_context->Current->under);
+ g_free(Hashed_Process_Data->draw_context->Current->middle);
+ g_free(Hashed_Process_Data->draw_context->Current->over);
+ g_free(Hashed_Process_Data->draw_context->Current);
+ g_free(Hashed_Process_Data->draw_context);
+ g_free(Hashed_Process_Data);
+
g_hash_table_remove(Process_List->Process_Hash,
&Process_Info);
gint processlist_get_process_pixels( ProcessList *Process_List,
guint pid, LttTime *birth,
guint *y,
- guint *height)
+ guint *height,
+ HashedProcessData **pmHashed_Process_Data)
{
ProcessInfo Process_Info;
gint *path_indices;
- GtkTreeRowReference *got_RowRef;
GtkTreePath *tree_path;
+ HashedProcessData *Hashed_Process_Data = NULL;
Process_Info.pid = pid;
Process_Info.birth = *birth;
- if(got_RowRef =
- (GtkTreeRowReference*)g_hash_table_lookup(
+ if(Hashed_Process_Data =
+ (HashedProcessData*)g_hash_table_lookup(
Process_List->Process_Hash,
&Process_Info))
{
tree_path = gtk_tree_row_reference_get_path(
- (GtkTreeRowReference*)got_RowRef);
+ Hashed_Process_Data->RowRef);
path_indices = gtk_tree_path_get_indices (tree_path);
- gtk_tree_path_free(tree_path);
*height = get_cell_height(
GTK_TREE_VIEW(Process_List->Process_List_VC));
*y = *height * path_indices[0];
-
+ g_critical("inside, y is %i", *y);
+ *pmHashed_Process_Data = Hashed_Process_Data;
return 0;
} else {
+ *pmHashed_Process_Data = Hashed_Process_Data;
return 1;
}
-
-
}
#include <gtk/gtk.h>
#include <lttv/state.h>
#include <ltt/ltt.h>
+#include "Draw_Item.h"
/* The process list
*
} ProcessInfo;
+typedef struct _HashedProcessData {
+
+ GtkTreeRowReference *RowRef;
+ DrawContext *draw_context;
-
+} HashedProcessData;
+
struct _ProcessList {
GtkWidget *Process_List_VC;
// out : success (0) and height
int processlist_add(ProcessList *Process_List, guint pid, LttTime *birth,
- guint *height);
+ guint *height, HashedProcessData **Hashed_Process_Data);
// out : success (0) and height
int processlist_remove(ProcessList *Process_List, guint pid, LttTime *birth);
// Returns 0 on success
gint processlist_get_process_pixels(ProcessList *Process_List,
guint pid, LttTime *birth,
- guint *y, guint *height);
+ guint *y, guint *height,
+ HashedProcessData **Hashed_Process_Data);
#endif // _PROCESS_LIST_H