From c46519c856ab26d16378a3984814cda3b86af160 Mon Sep 17 00:00:00 2001 From: yangxx Date: Fri, 26 Sep 2003 16:55:15 +0000 Subject: [PATCH] common box as the top level of container to contain widgets of the module git-svn-id: http://ltt.polymtl.ca/svn@251 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt/branches/poly/lttv/modules/Makefile.am | 6 ++- ltt/branches/poly/lttv/modules/guiEvents.c | 46 ++++++++++++++++++---- 2 files changed, 43 insertions(+), 9 deletions(-) diff --git a/ltt/branches/poly/lttv/modules/Makefile.am b/ltt/branches/poly/lttv/modules/Makefile.am index ae914c9c..0dd00c4b 100644 --- a/ltt/branches/poly/lttv/modules/Makefile.am +++ b/ltt/branches/poly/lttv/modules/Makefile.am @@ -9,10 +9,12 @@ SUBDIRS = gui AM_CFLAGS = $(GLIB_CFLAGS) AM_CFLAGS += $(GTK_CFLAGS) LIBS += $(GLIB_LIBS) -LIBS += $(GTK_LIBS) -Lgui/API -lmainWinApi +LIBS += $(GTK_LIBS) -Lgui/API -lmainWinApi -lcustomBox libdir = ${lttvplugindir} -lib_LTLIBRARIES = libguiEvents.la +lib_LTLIBRARIES = libguiEvents.la libguiControlFlow.la libguiEvents_la_LDFLAGS = -module libguiEvents_la_SOURCES = guiEvents.c +libguiControlFlow_la_LDFLAGS = -module +libguiControlFlow_la_SOURCES = guiControlFlow.c diff --git a/ltt/branches/poly/lttv/modules/guiEvents.c b/ltt/branches/poly/lttv/modules/guiEvents.c index a5e42f10..64c39269 100644 --- a/ltt/branches/poly/lttv/modules/guiEvents.c +++ b/ltt/branches/poly/lttv/modules/guiEvents.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -59,6 +60,7 @@ gboolean updateTimeInterval(void * hook_data, void * call_data); 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; @@ -98,6 +100,7 @@ typedef struct _EventViewerData { 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; @@ -196,7 +199,9 @@ G_MODULE_EXPORT void destroy() { g_critical("GUI Event Viewer destroy()"); g_slist_foreach(sEvent_Viewer_Data_List, destroy_walk, NULL ); - + + g_slist_free(sEvent_Viewer_Data_List); + /* Unregister the toolbar insert button */ ToolbarItemUnreg(hGuiEvents); @@ -231,7 +236,7 @@ hGuiEvents(mainWindow * pmParentWindow) EventViewerData* Event_Viewer_Data = GuiEvents(pmParentWindow) ; if(Event_Viewer_Data) - return Event_Viewer_Data->HBox_V ; + return Event_Viewer_Data->instance_container; else return NULL; } @@ -380,8 +385,10 @@ GuiEvents(mainWindow *pmParentWindow) 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); @@ -407,6 +414,7 @@ GuiEvents(mainWindow *pmParentWindow) // 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); @@ -1109,8 +1117,8 @@ GuiEvents_Destructor(EventViewerData *Event_Viewer_Data) guint index; /* May already been done by GTK window closing */ - if(GTK_IS_WIDGET(Event_Viewer_Data->HBox_V)) - gtk_widget_destroy(Event_Viewer_Data->HBox_V); + if(GTK_IS_WIDGET(Event_Viewer_Data->instance_container)) + gtk_widget_destroy(Event_Viewer_Data->instance_container); /* Destroy the Tree View */ //gtk_widget_destroy(Event_Viewer_Data->Tree_V); @@ -1119,7 +1127,16 @@ GuiEvents_Destructor(EventViewerData *Event_Viewer_Data) //gtk_list_store_clear(Event_Viewer_Data->Store_M); //gtk_widget_destroy(GTK_WIDGET(Event_Viewer_Data->Store_M)); - g_slist_remove(sEvent_Viewer_Data_List,Event_Viewer_Data); + lttv_hooks_remove(Event_Viewer_Data->before_event_hooks,parse_event); + lttv_hooks_destroy(Event_Viewer_Data->before_event_hooks); + + remove_all_items_from_queue (Event_Viewer_Data->raw_trace_data_queue); + g_queue_free(Event_Viewer_Data->raw_trace_data_queue); + g_queue_free(Event_Viewer_Data->raw_trace_data_queue_tmp); + + UnregUpdateTimeInterval(updateTimeInterval,Event_Viewer_Data, Event_Viewer_Data->mw); + UnregUpdateCurrentTime(updateCurrentTime,Event_Viewer_Data, Event_Viewer_Data->mw); + g_free(Event_Viewer_Data); } @@ -1193,14 +1210,14 @@ gboolean updateCurrentTime(void * hook_data, void * call_data) } // Event_Selected_Hook(Event_Viewer_Data, &count); } - + return FALSE; } 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->HBox_V)); + SetFocusedPane(mw, gtk_widget_get_parent(Event_Viewer_Data->instance_container)); } void get_events(EventViewerData* Event_Viewer_Data, LttTime start, @@ -1465,6 +1482,21 @@ void remove_all_items_from_queue(GQueue *q) } } +void remove_instance(GtkCustomHBox * box){ + int i; + EventViewerData *Event_Viewer_Data ; + + for(i=0;iinstance_container){ + sEvent_Viewer_Data_List = g_slist_remove(sEvent_Viewer_Data_List, Event_Viewer_Data); + break; + } + } +} + + + /* Imported code from LTT 0.9.6pre2 tracevisualizer */ -- 2.34.1