+++ /dev/null
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#ifndef __GTK_CUSTOM_HBOX_H__
-#define __GTK_CUSTOM_HBOX_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkbox.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_TYPE_CUSTOM_HBOX (gtk_custom_hbox_get_type ())
-#define GTK_CUSTOM_HBOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CUSTOM_HBOX, GtkCustomHBox))
-#define GTK_CUSTOM_HBOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CUSTOM_HBOX, GtkCustomHBoxClass))
-#define GTK_IS_CUSTOM_HBOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CUSTOM_HBOX))
-#define GTK_IS_CUSTOM_HBOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CUSTOM_HBOX))
-#define GTK_CUSTOM_HBOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CUSTOM_HBOX, GtkCustomHBoxClass))
-
-
-typedef struct _GtkCustomHBox GtkCustomHBox;
-typedef struct _GtkCustomHBoxClass GtkCustomHBoxClass;
-
-typedef void (*remove_func)(GtkCustomHBox * hbox);
-
-struct _GtkCustomHBox
-{
- GtkBox box;
- remove_func remove_item;
-};
-
-struct _GtkCustomHBoxClass
-{
- GtkBoxClass parent_class;
-};
-
-
-GType gtk_custom_hbox_get_type (void) G_GNUC_CONST;
-GtkWidget* gtk_custom_hbox_new (gboolean homogeneous,
- gint spacing,
- remove_func remove);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_CUSTOM_HBOX_H__ */
+++ /dev/null
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include <lttv/gtkcustomhbox.h>
-
-
-static void gtk_custom_hbox_class_init (GtkCustomHBoxClass *klass);
-static void gtk_custom_hbox_init (GtkCustomHBox *box);
-static void gtk_custom_hbox_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void gtk_custom_hbox_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-
-
-GType
-gtk_custom_hbox_get_type (void)
-{
- static GType hbox_type = 0;
-
- if (!hbox_type)
- {
- static const GTypeInfo hbox_info =
- {
- sizeof (GtkCustomHBoxClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) gtk_custom_hbox_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GtkCustomHBox),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gtk_custom_hbox_init,
- };
-
- hbox_type = g_type_register_static (GTK_TYPE_BOX, "GtkCustomHBox",
- &hbox_info, 0);
- }
-
- return hbox_type;
-}
-
-static void
-gtk_custom_hbox_finalize (GObject *object)
-{
- GtkCustomHBox * hbox = GTK_CUSTOM_HBOX (object);
-
- hbox->remove_item(hbox);
-
- G_OBJECT_CLASS(g_type_class_peek_parent(GTK_CUSTOM_HBOX_GET_CLASS(hbox)))->finalize(G_OBJECT(object));
-}
-
-static void
-gtk_custom_hbox_class_init (GtkCustomHBoxClass *class)
-{
- GtkWidgetClass *widget_class;
- GObjectClass *gobject_class = G_OBJECT_CLASS(class);
-
- gobject_class->finalize = gtk_custom_hbox_finalize;
-
- widget_class = (GtkWidgetClass*) class;
-
- widget_class->size_request = gtk_custom_hbox_size_request;
- widget_class->size_allocate = gtk_custom_hbox_size_allocate;
-}
-
-static void
-gtk_custom_hbox_init (GtkCustomHBox *hbox)
-{
-}
-
-GtkWidget*
-gtk_custom_hbox_new (gboolean homogeneous,
- gint spacing,
- remove_func remove)
-{
- GtkCustomHBox *hbox;
-
- hbox = g_object_new (GTK_TYPE_CUSTOM_HBOX, NULL);
- hbox->remove_item = remove;
-
- GTK_BOX (hbox)->spacing = spacing;
- GTK_BOX (hbox)->homogeneous = homogeneous ? TRUE : FALSE;
-
- return GTK_WIDGET (hbox);
-}
-
-static void
-gtk_custom_hbox_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GtkBox *box;
- GtkBoxChild *child;
- GList *children;
- gint nvis_children;
- gint width;
-
- box = GTK_BOX (widget);
- requisition->width = 0;
- requisition->height = 0;
- nvis_children = 0;
-
- children = box->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_WIDGET_VISIBLE (child->widget))
- {
- GtkRequisition child_requisition;
-
- gtk_widget_size_request (child->widget, &child_requisition);
-
- if (box->homogeneous)
- {
- width = child_requisition.width + child->padding * 2;
- requisition->width = MAX (requisition->width, width);
- }
- else
- {
- requisition->width += child_requisition.width + child->padding * 2;
- }
-
- requisition->height = MAX (requisition->height, child_requisition.height);
-
- nvis_children += 1;
- }
- }
-
- if (nvis_children > 0)
- {
- if (box->homogeneous)
- requisition->width *= nvis_children;
- requisition->width += (nvis_children - 1) * box->spacing;
- }
-
- requisition->width += GTK_CONTAINER (box)->border_width * 2;
- requisition->height += GTK_CONTAINER (box)->border_width * 2;
-}
-
-static void
-gtk_custom_hbox_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkBox *box;
- GtkBoxChild *child;
- GList *children;
- GtkAllocation child_allocation;
- gint nvis_children;
- gint nexpand_children;
- gint child_width;
- gint width;
- gint extra;
- gint x;
- GtkTextDirection direction;
-
- box = GTK_BOX (widget);
- widget->allocation = *allocation;
-
- direction = gtk_widget_get_direction (widget);
-
- nvis_children = 0;
- nexpand_children = 0;
- children = box->children;
-
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_WIDGET_VISIBLE (child->widget))
- {
- nvis_children += 1;
- if (child->expand)
- nexpand_children += 1;
- }
- }
-
- if (nvis_children > 0)
- {
- if (box->homogeneous)
- {
- width = (allocation->width -
- GTK_CONTAINER (box)->border_width * 2 -
- (nvis_children - 1) * box->spacing);
- extra = width / nvis_children;
- }
- else if (nexpand_children > 0)
- {
- width = (gint) allocation->width - (gint) widget->requisition.width;
- extra = width / nexpand_children;
- }
- else
- {
- width = 0;
- extra = 0;
- }
-
- x = allocation->x + GTK_CONTAINER (box)->border_width;
- child_allocation.y = allocation->y + GTK_CONTAINER (box)->border_width;
- child_allocation.height = MAX (1, (gint) allocation->height - (gint) GTK_CONTAINER (box)->border_width * 2);
-
- children = box->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if ((child->pack == GTK_PACK_START) && GTK_WIDGET_VISIBLE (child->widget))
- {
- if (box->homogeneous)
- {
- if (nvis_children == 1)
- child_width = width;
- else
- child_width = extra;
-
- nvis_children -= 1;
- width -= extra;
- }
- else
- {
- GtkRequisition child_requisition;
-
- gtk_widget_get_child_requisition (child->widget, &child_requisition);
-
- child_width = child_requisition.width + child->padding * 2;
-
- if (child->expand)
- {
- if (nexpand_children == 1)
- child_width += width;
- else
- child_width += extra;
-
- nexpand_children -= 1;
- width -= extra;
- }
- }
-
- if (child->fill)
- {
- child_allocation.width = MAX (1, (gint) child_width - (gint) child->padding * 2);
- child_allocation.x = x + child->padding;
- }
- else
- {
- GtkRequisition child_requisition;
-
- gtk_widget_get_child_requisition (child->widget, &child_requisition);
- child_allocation.width = child_requisition.width;
- child_allocation.x = x + (child_width - child_allocation.width) / 2;
- }
-
- if (direction == GTK_TEXT_DIR_RTL)
- child_allocation.x = allocation->x + allocation->width - (child_allocation.x - allocation->x) - child_allocation.width;
-
- gtk_widget_size_allocate (child->widget, &child_allocation);
-
- x += child_width + box->spacing;
- }
- }
-
- x = allocation->x + allocation->width - GTK_CONTAINER (box)->border_width;
-
- children = box->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if ((child->pack == GTK_PACK_END) && GTK_WIDGET_VISIBLE (child->widget))
- {
- GtkRequisition child_requisition;
- gtk_widget_get_child_requisition (child->widget, &child_requisition);
-
- if (box->homogeneous)
- {
- if (nvis_children == 1)
- child_width = width;
- else
- child_width = extra;
-
- nvis_children -= 1;
- width -= extra;
- }
- else
- {
- child_width = child_requisition.width + child->padding * 2;
-
- if (child->expand)
- {
- if (nexpand_children == 1)
- child_width += width;
- else
- child_width += extra;
-
- nexpand_children -= 1;
- width -= extra;
- }
- }
-
- if (child->fill)
- {
- child_allocation.width = MAX (1, (gint)child_width - (gint)child->padding * 2);
- child_allocation.x = x + child->padding - child_width;
- }
- else
- {
- child_allocation.width = child_requisition.width;
- child_allocation.x = x + (child_width - child_allocation.width) / 2 - child_width;
- }
-
- if (direction == GTK_TEXT_DIR_RTL)
- child_allocation.x = allocation->x + allocation->width - (child_allocation.x - allocation->x) - child_allocation.width;
-
- gtk_widget_size_allocate (child->widget, &child_allocation);
-
- x -= (child_width + box->spacing);
- }
- }
- }
-}
#include <lttv/module.h>
#include <lttv/hook.h>
#include <lttv/gtkTraceSet.h>
-#include <lttv/gtkcustomhbox.h>
#include <lttv/processTrace.h>
#include <lttv/state.h>
#include <ltt/ltt.h>
gboolean updateCurrentTime(void * hook_data, void * call_data);
void remove_item_from_queue(GQueue * q, gboolean fromHead);
void remove_all_items_from_queue(GQueue * q);
-void remove_instance(GtkCustomHBox * box);
typedef struct _RawTraceData{
unsigned cpu_id;
LttTime trace_end;
unsigned start_event_index; //the first event shown in the window
unsigned end_event_index; //the last event shown in the window
- GtkWidget * instance_container; //box to contain all widgets
//scroll window containing Tree View
GtkWidget * Scroll_Win;
EventViewerData *GuiEvents(mainWindow *pmParentWindow);
//! Event Viewer's destructor
void GuiEvents_Destructor(EventViewerData *Event_Viewer_Data);
+void GuiEvents_free(EventViewerData *Event_Viewer_Data);
static int Event_Selected_Hook(void *hook_data, void *call_data);
EventViewerData* Event_Viewer_Data = GuiEvents(pmParentWindow) ;
if(Event_Viewer_Data)
- return Event_Viewer_Data->instance_container;
+ return Event_Viewer_Data->HBox_V;
else return NULL;
}
gtk_container_add (GTK_CONTAINER (Event_Viewer_Data->Scroll_Win), Event_Viewer_Data->Tree_V);
- Event_Viewer_Data->instance_container = gtk_custom_hbox_new(0, 0, remove_instance);
Event_Viewer_Data->HBox_V = gtk_hbox_new(0, 0);
gtk_box_pack_start(GTK_BOX(Event_Viewer_Data->HBox_V), Event_Viewer_Data->Scroll_Win, TRUE, TRUE, 0);
- gtk_box_pack_start(GTK_BOX(Event_Viewer_Data->instance_container), Event_Viewer_Data->HBox_V, TRUE, TRUE, 0);
/* Create vertical scrollbar and pack it */
Event_Viewer_Data->VScroll_VC = gtk_vscrollbar_new(NULL);
// Event_Viewer_Data->VTree_Adjust_C->upper;
g_critical("value : %u",Event_Viewer_Data->VTree_Adjust_C->upper);
/* Raw event trace */
- gtk_widget_show(Event_Viewer_Data->instance_container);
gtk_widget_show(Event_Viewer_Data->HBox_V);
gtk_widget_show(Event_Viewer_Data->Tree_V);
gtk_widget_show(Event_Viewer_Data->VScroll_VC);
/* Set the Selected Event */
// Tree_V_set_cursor(Event_Viewer_Data);
+
+
+ g_object_set_data_full(
+ G_OBJECT(Event_Viewer_Data->HBox_V),
+ "Event_Viewer_Data",
+ Event_Viewer_Data,
+ (GDestroyNotify)GuiEvents_free);
return Event_Viewer_Data;
}
UnregUpdateTimeInterval(updateTimeInterval,Event_Viewer_Data, Event_Viewer_Data->mw);
UnregUpdateCurrentTime(updateCurrentTime,Event_Viewer_Data, Event_Viewer_Data->mw);
+ sEvent_Viewer_Data_List = g_slist_remove(sEvent_Viewer_Data_List, Event_Viewer_Data);
+ g_warning("Delete Event data\n");
g_free(Event_Viewer_Data);
}
guint index;
/* May already been done by GTK window closing */
- if(GTK_IS_WIDGET(Event_Viewer_Data->instance_container))
- gtk_widget_destroy(Event_Viewer_Data->instance_container);
+ if(GTK_IS_WIDGET(Event_Viewer_Data->HBox_V))
+ gtk_widget_destroy(Event_Viewer_Data->HBox_V);
/* Destroy the Tree View */
//gtk_widget_destroy(Event_Viewer_Data->Tree_V);
//gtk_list_store_clear(Event_Viewer_Data->Store_M);
//gtk_widget_destroy(GTK_WIDGET(Event_Viewer_Data->Store_M));
+ g_warning("Delete Event data from destroy\n");
GuiEvents_free(Event_Viewer_Data);
}
void Tree_V_grab_focus(GtkWidget *widget, gpointer data){
EventViewerData *Event_Viewer_Data = (EventViewerData *)data;
mainWindow * mw = Event_Viewer_Data->mw;
- SetFocusedPane(mw, gtk_widget_get_parent(Event_Viewer_Data->instance_container));
+ SetFocusedPane(mw, gtk_widget_get_parent(Event_Viewer_Data->HBox_V));
}
void get_events(EventViewerData* Event_Viewer_Data, LttTime start,
}
}
-void remove_instance(GtkCustomHBox * box){
- int i;
- EventViewerData *Event_Viewer_Data ;
-
- for(i=0;i<g_slist_length(sEvent_Viewer_Data_List);i++){
- Event_Viewer_Data = (EventViewerData *)g_slist_nth_data(sEvent_Viewer_Data_List, i);
- if((void*)box == (void*)Event_Viewer_Data->instance_container){
- sEvent_Viewer_Data_List = g_slist_remove(sEvent_Viewer_Data_List, Event_Viewer_Data);
- GuiEvents_free(Event_Viewer_Data);
- break;
- }
- }
-}
-