* @return The widget created.
*/
ControlFlowData *
-guicontrolflow(void)
+guicontrolflow(Tab *tab)
{
GtkWidget *process_list_widget, *drawing_widget, *drawing_area;
ControlFlowData* control_flow_data = g_new(ControlFlowData,1) ;
+ control_flow_data->tab = tab;
+
control_flow_data->v_adjust =
GTK_ADJUSTMENT(gtk_adjustment_new( 0.0, /* Value */
0.0, /* Lower */
} ;
/* Control Flow Data constructor */
-ControlFlowData *guicontrolflow(void);
+ControlFlowData *guicontrolflow(Tab *tab);
void
guicontrolflow_destructor_full(ControlFlowData *control_flow_data);
void
if(width < 0) return ;
if(height < 0) return ;
+
Tab *tab = drawing->control_flow_data->tab;
TimeWindow time_window =
lttvwindow_get_time_window(tab);
drawing->alloc_height = drawing->height + EXTRA_ALLOC;
update_pixmap_size(drawing->control_flow_data->process_list,
drawing->alloc_width);
+ update_index_to_pixmap(drawing->control_flow_data->process_list);
}
//drawing->height = widget->allocation.height;
(ControlFlowData*)g_object_get_data(
G_OBJECT(widget),
"control_flow_data");
+#if 0
if(unlikely(drawing->gc == NULL)) {
drawing->gc = gdk_gc_new(drawing->drawing_area->window);
gdk_gc_copy(drawing->gc, drawing->drawing_area->style->black_gc);
}
-
+#endif //0
TimeWindow time_window =
lttvwindow_get_time_window(control_flow_data->tab);
LttTime current_time =
event->area.width, event->area.height);
#endif //0
drawing->height = processlist_get_height(control_flow_data->process_list);
+#if 0
copy_pixmap_to_screen(control_flow_data->process_list,
widget->window,
widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
event->area.x, event->area.y,
event->area.width, event->area.height);
+#endif //0
+ copy_pixmap_to_screen(control_flow_data->process_list,
+ widget->window,
+ drawing->gc,
+ event->area.x, event->area.y,
+ event->area.width, event->area.height);
/* Erase the dotted lines left.. */
drawing->width,
&cursor_x);
-
+#if 0
if(drawing->dotted_gc == NULL) {
drawing->dotted_gc = gdk_gc_new(drawing->drawing_area->window);
dash_list,
2);
}
+#endif //0
gint height_tot = MAX(widget->allocation.height, drawing->height);
gdk_draw_line(widget->window,
drawing->dotted_gc,
drawing->pango_layout =
gtk_widget_create_pango_layout(drawing->drawing_area, NULL);
- drawing->dotted_gc = NULL;
-
drawing->height = 1;
drawing->width = 1;
drawing->depth = 0;
gdk_colormap_alloc_colors(colormap, drawing_colors, NUM_COLORS, FALSE,
TRUE, success);
+ drawing->gc =
+ gdk_gc_new(GDK_DRAWABLE(main_window_get_widget(control_flow_data->tab)->window));
+ drawing->dotted_gc =
+ gdk_gc_new(GDK_DRAWABLE(main_window_get_widget(control_flow_data->tab)->window));
+
+ gdk_gc_copy(drawing->gc,
+ main_window_get_widget(control_flow_data->tab)->style->black_gc);
+ gdk_gc_copy(drawing->dotted_gc,
+ main_window_get_widget(control_flow_data->tab)->style->white_gc);
+
+ gint8 dash_list[] = { 1, 2 };
+ gdk_gc_set_line_attributes(drawing->dotted_gc,
+ 1,
+ GDK_LINE_ON_OFF_DASH,
+ GDK_CAP_BUTT,
+ GDK_JOIN_MITER);
+ gdk_gc_set_dashes(drawing->dotted_gc,
+ 0,
+ dash_list,
+ 2);
+
+ drawing->ruler_gc_butt =
+ gdk_gc_new(GDK_DRAWABLE(main_window_get_widget(control_flow_data->tab)->window));
+ gdk_gc_copy(drawing->ruler_gc_butt,
+ main_window_get_widget(control_flow_data->tab)->style->black_gc);
+ drawing->ruler_gc_round =
+ gdk_gc_new(GDK_DRAWABLE(main_window_get_widget(control_flow_data->tab)->window));
+ gdk_gc_copy(drawing->ruler_gc_round,
+ main_window_get_widget(control_flow_data->tab)->style->black_gc);
+
+
+ gdk_gc_set_line_attributes(drawing->ruler_gc_butt,
+ 2,
+ GDK_LINE_SOLID,
+ GDK_CAP_BUTT,
+ GDK_JOIN_MITER);
+
+ gdk_gc_set_line_attributes(drawing->ruler_gc_round,
+ 2,
+ GDK_LINE_SOLID,
+ GDK_CAP_ROUND,
+ GDK_JOIN_ROUND);
+
+
return drawing;
}
g_free(drawing->pango_layout);
if(drawing->dotted_gc != NULL) gdk_gc_unref(drawing->dotted_gc);
+ if(drawing->ruler_gc_butt != NULL) gdk_gc_unref(drawing->ruler_gc_butt);
+ if(drawing->ruler_gc_round != NULL) gdk_gc_unref(drawing->ruler_gc_round);
+
g_free(drawing);
g_info("drawing_destroy end");
}
event->area.width,
event->area.height);
- GdkGC *gc = gdk_gc_new(drawing->ruler->window);
- gdk_gc_copy(gc, drawing->ruler->style->black_gc);
- gdk_gc_set_line_attributes(gc,
- 2,
- GDK_LINE_SOLID,
- GDK_CAP_BUTT,
- GDK_JOIN_MITER);
gdk_draw_line (drawing->ruler->window,
- gc,
+ drawing->ruler_gc_butt,
event->area.x, 1,
event->area.x + event->area.width, 1);
global_width += ink_rect.width;
gdk_draw_layout_with_colors(drawing->ruler->window,
- gc,
+ drawing->ruler_gc_butt,
0,
6,
layout, &foreground, &background);
- gdk_gc_set_line_attributes(gc,
- 2,
- GDK_LINE_SOLID,
- GDK_CAP_ROUND,
- GDK_JOIN_ROUND);
-
gdk_draw_line (drawing->ruler->window,
- gc,
+ drawing->ruler_gc_round,
1, 1,
1, 7);
if(global_width <= drawing->ruler->allocation.width)
{
gdk_draw_layout_with_colors(drawing->ruler->window,
- gc,
+ drawing->ruler_gc_butt,
drawing->ruler->allocation.width - ink_rect.width,
6,
layout, &foreground, &background);
- gdk_gc_set_line_attributes(gc,
- 2,
- GDK_LINE_SOLID,
- GDK_CAP_ROUND,
- GDK_JOIN_ROUND);
-
gdk_draw_line (drawing->ruler->window,
- gc,
+ drawing->ruler_gc_butt,
drawing->ruler->allocation.width-1, 1,
drawing->ruler->allocation.width-1, 7);
}
if(global_width <= drawing->ruler->allocation.width)
{
gdk_draw_layout_with_colors(drawing->ruler->window,
- gc,
+ drawing->ruler_gc_butt,
(drawing->ruler->allocation.width - ink_rect.width)/2,
6,
layout, &foreground, &background);
- gdk_gc_set_line_attributes(gc,
- 2,
- GDK_LINE_SOLID,
- GDK_CAP_ROUND,
- GDK_JOIN_ROUND);
-
gdk_draw_line (drawing->ruler->window,
- gc,
+ drawing->ruler_gc_butt,
drawing->ruler->allocation.width/2, 1,
drawing->ruler->allocation.width/2, 7);
}
- gdk_gc_unref(gc);
g_object_unref(layout);
return FALSE;
LttTime last_start;
GdkGC *dotted_gc;
GdkGC *gc;
+ GdkGC *ruler_gc_butt;
+ GdkGC *ruler_gc_round;
/* Position of the horizontal selector, -1 for none */
gint horizontal_sel;
h_guicontrolflow(Tab *tab)
{
g_info("h_guicontrolflow, %p", tab);
- ControlFlowData *control_flow_data = guicontrolflow() ;
+ ControlFlowData *control_flow_data = guicontrolflow(tab) ;
control_flow_data->tab = tab;
ControlFlowData *control_flow_data = (ControlFlowData*) hook_data;
Drawing_t *drawing = control_flow_data->drawing;
+ if(unlikely(drawing->gc == NULL)) {
+ return FALSE;
+ }
+ if(drawing->dotted_gc == NULL) {
+ return FALSE;
+ }
drawing_clear(control_flow_data->drawing);
processlist_clear(control_flow_data->process_list);
g_assert(i<process_list->index_to_pixmap->len);
/* Render the pixmap to the screen */
GdkPixmap *pixmap =
- (GdkPixmap*)g_ptr_array_index(process_list->index_to_pixmap, i);
+ //(GdkPixmap*)g_ptr_array_index(process_list->index_to_pixmap, i);
+ GDK_PIXMAP(g_ptr_array_index(process_list->index_to_pixmap, i));
gdk_draw_drawable (dest,
gc,
new_tab = create_tab(new_m_window, parent_tab, notebook, "Traceset");
} else {
new_tab = create_tab(new_m_window, NULL, notebook, "Traceset");
- /* First window, use command line trace */
- if(g_init_trace != NULL){
- lttvwindow_add_trace(new_tab,
- g_init_trace);
+ }
+ /* Insert default viewers */
+ {
+ LttvAttributeType type;
+ LttvAttributeName name;
+ LttvAttributeValue value;
+ LttvAttribute *attribute;
+
+ LttvIAttribute *attributes_global =
+ LTTV_IATTRIBUTE(lttv_global_attributes());
+
+ g_assert(attribute =
+ LTTV_ATTRIBUTE(lttv_iattribute_find_subdir(
+ LTTV_IATTRIBUTE(attributes_global),
+ LTTV_VIEWER_CONSTRUCTORS)));
+
+ name = g_quark_from_string("guievents");
+ type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(attribute),
+ name, &value);
+ if(type == LTTV_POINTER) {
+ lttvwindow_viewer_constructor viewer_constructor =
+ (lttvwindow_viewer_constructor)*value.v_pointer;
+ insert_viewer(new_window, viewer_constructor);
}
- LttvTraceset *traceset = new_tab->traceset_info->traceset;
- SetTraceset(new_tab, traceset);
- /* Insert default viewers */
- {
- LttvAttributeType type;
- LttvAttributeName name;
- LttvAttributeValue value;
- LttvAttribute *attribute;
-
- LttvIAttribute *attributes_global =
- LTTV_IATTRIBUTE(lttv_global_attributes());
-
- g_assert(attribute =
- LTTV_ATTRIBUTE(lttv_iattribute_find_subdir(
- LTTV_IATTRIBUTE(attributes_global),
- LTTV_VIEWER_CONSTRUCTORS)));
-
- name = g_quark_from_string("guievents");
- type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(attribute),
- name, &value);
- if(type == LTTV_POINTER) {
- lttvwindow_viewer_constructor viewer_constructor =
- (lttvwindow_viewer_constructor)*value.v_pointer;
- insert_viewer(new_window, viewer_constructor);
- }
-
- name = g_quark_from_string("guicontrolflow");
- type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(attribute),
- name, &value);
- if(type == LTTV_POINTER) {
- lttvwindow_viewer_constructor viewer_constructor =
- (lttvwindow_viewer_constructor)*value.v_pointer;
- insert_viewer(new_window, viewer_constructor);
- }
-
- name = g_quark_from_string("guistatistics");
- type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(attribute),
- name, &value);
- if(type == LTTV_POINTER) {
- lttvwindow_viewer_constructor viewer_constructor =
- (lttvwindow_viewer_constructor)*value.v_pointer;
- insert_viewer(new_window, viewer_constructor);
- }
+ name = g_quark_from_string("guicontrolflow");
+ type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(attribute),
+ name, &value);
+ if(type == LTTV_POINTER) {
+ lttvwindow_viewer_constructor viewer_constructor =
+ (lttvwindow_viewer_constructor)*value.v_pointer;
+ insert_viewer(new_window, viewer_constructor);
+ }
+ name = g_quark_from_string("guistatistics");
+ type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(attribute),
+ name, &value);
+ if(type == LTTV_POINTER) {
+ lttvwindow_viewer_constructor viewer_constructor =
+ (lttvwindow_viewer_constructor)*value.v_pointer;
+ insert_viewer(new_window, viewer_constructor);
}
}
*main_hooks;
/* Initial trace from command line */
-LttvTrace *g_init_trace = NULL;
+//LttvTrace *g_init_trace = NULL;
static char *a_trace;
+static char g_init_trace[PATH_MAX] = "";
void lttv_trace_option(void *hook_data)
{
LttTrace *trace;
- gchar abs_path[PATH_MAX];
-
- get_absolute_pathname(a_trace, abs_path);
- g_init_trace = lttvwindowtraces_get_trace_by_name(abs_path);
- if(g_init_trace == NULL) {
- trace = ltt_trace_open(abs_path);
- if(trace == NULL) {
- g_warning("cannot open trace %s", abs_path);
- } else {
- g_init_trace = lttv_trace_new(trace);
- lttvwindowtraces_add_trace(g_init_trace);
- }
- }
+
+ get_absolute_pathname(a_trace, g_init_trace);
}
/*****************************************************************************
add_pixmap_directory ("pixmaps");
add_pixmap_directory ("../modules/gui/main/pixmaps");
- construct_main_window(NULL);
+ /* First window, use command line trace */
+ if(strcmp(g_init_trace, "") != 0){
+ create_main_window_with_trace(g_init_trace);
+ } else {
+ construct_main_window(NULL);
+ }
gtk_main ();
#include <utmp.h>
#include <sys/wait.h>
#include <sys/poll.h>
+#include <errno.h>
#define MAX_ARGS_LEN PATH_MAX * 10
g_info("Waiting for child exit...");
ret = waitpid(pid, &status, 0);
-
- if(WIFEXITED(status))
- if(WEXITSTATUS(status) != 0) {
- retval = WEXITSTATUS(status);
- g_warning("An error occured in the su command : %s",
- strerror(retval));
- }
+
+ if(ret == -1) {
+ g_warning("An error occured in wait : %s",
+ strerror(errno));
+ } else {
+ if(WIFEXITED(status))
+ if(WEXITSTATUS(status) != 0) {
+ retval = WEXITSTATUS(status);
+ g_warning("An error occured in the su command : %s",
+ strerror(retval));
+ }
+ }
g_info("Child exited.");