Beginning of integration of mainWin and main program
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Tue, 26 Aug 2003 20:19:24 +0000 (20:19 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Tue, 26 Aug 2003 20:19:24 +0000 (20:19 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@198 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/lttv/modules/gui/mainWin/src/Makefile.am
ltt/branches/poly/lttv/modules/gui/mainWin/src/init_module.c [new file with mode: 0644]
ltt/branches/poly/lttv/modules/gui/mainWin/src/mainwin

index e1eddbf29e6c40fd1acddfeb5f8edeb383ada855..71788097633039e27be62ec5668993706ce78ea9 100644 (file)
@@ -6,14 +6,16 @@ INCLUDES = \
        @PACKAGE_CFLAGS@ \
        $(DEFAULT_INCLUDES)
 
-bin_PROGRAMS = mainwin
+#bin_PROGRAMS = mainwin
+lib_LTLIBRARIES = libmainwin.la
 
-mainwin_SOURCES = \
-       main.c \
+libmainwin_la_LDFLAGS = -module
+libmainwin_la_SOURCES = \
+       init_module.c \
        support.c support.h \
        interface.c interface.h \
        callbacks.c callbacks.h \
        gtkcustom.c gtkcustom.h
 
-mainwin_LDADD = @PACKAGE_LIBS@ $(INTLLIBS)
+libmainwin_la_LIBADD = @PACKAGE_LIBS@ $(INTLLIBS)
 
diff --git a/ltt/branches/poly/lttv/modules/gui/mainWin/src/init_module.c b/ltt/branches/poly/lttv/modules/gui/mainWin/src/init_module.c
new file mode 100644 (file)
index 0000000..2d86698
--- /dev/null
@@ -0,0 +1,172 @@
+/*
+ * Initial main.c file generated by Glade. Edit as required.
+ * Glade will not overwrite this file.
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <gtk/gtk.h>
+
+#include <lttv/module.h>
+#include <lttv/hook.h>
+#include <lttv/lttv.h>
+
+
+#include "interface.h"
+#include "support.h"
+#include "mainWindow.h"
+#include "callbacks.h"
+
+/* global variable */
+systemView * gSysView;
+
+typedef view_constructor (* constructor)();
+constructor get_constructor = NULL;
+typedef void (*call_Event_Selected_Hook)(void * call_data);
+call_Event_Selected_Hook selected_hook = NULL;
+GModule *gm;
+view_constructor gConstructor = NULL;
+
+int Window_Creation_Hook(void *hook_data, void *call_data);
+
+/*****************************************************************************
+ *                 Functions for module loading/unloading                    *
+ *****************************************************************************/
+/**
+ * plugin's init function
+ *
+ * This function initializes the GUI.
+ */
+
+typedef struct _WindowCreationData {
+       int argc;
+       char ** argv;
+} WindowCreationData;
+
+G_MODULE_EXPORT void init(LttvModule *self, int argc, char *argv[]) {
+
+       LttvAttributeValue value;
+       WindowCreationData *Window_Creation_Data = g_new(WindowCreationData, 1);
+       
+       Window_Creation_Data->argc = argc;
+       Window_Creation_Data->argv = argv;
+
+       
+       lttv_iattribute_find_by_path(LTTV_IATTRIBUTE(lttv_global_attributes()),
+                       "/hooks/main/before",   LTTV_POINTER, &value);
+
+       lttv_hooks_add(*(value.v_pointer), Window_Creation_Hook, Window_Creation_Data);
+
+}
+
+int Window_Creation_Hook(void *hook_data, void *call_data)
+{
+  GModule *gm;
+  GtkWidget * ToolMenuTitle_menu, *insert_view;
+  GtkWidget *window1;
+  mainWindow * mw = g_new(mainWindow, 1);
+  gSysView = g_new(systemView, 1);
+       WindowCreationData *Window_Creation_Data = (WindowCreationData*)call_data;
+
+       g_critical("GUI init()");
+#ifdef ENABLE_NLS
+  bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
+  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+  textdomain (GETTEXT_PACKAGE);
+#endif
+
+  gtk_set_locale ();
+  gtk_init (&(Window_Creation_Data->argc), &(Window_Creation_Data->argv));
+
+  add_pixmap_directory (PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps");
+  add_pixmap_directory ("pixmaps");
+
+  /*
+   * The following code was added by Glade to create one of each component
+   * (except popup menus), just so that you see something after building
+   * the project. Delete any components that you don't want shown initially.
+   */
+  window1 = create_MWindow ();
+  gtk_widget_show (window1);
+
+  mw->MWindow = window1;
+  mw->SystemView = gSysView;
+  mw->Tab = NULL;
+  mw->CurrentTab = NULL;
+  //  mw->Attributes = lttv_attributes_new();
+
+  //test
+
+  gm = g_module_open("/home1/yangxx/poly/lttv/modules/libguiEvents.la",0);
+  printf("Main : the address of gm : %d\n", gm);
+  if(!g_module_symbol(gm, "get_constructor", (gpointer)&get_constructor)){
+    g_error("can not get constructor\n");
+  }  
+  if(!g_module_symbol(gm, "call_Event_Selected_Hook", (gpointer)&selected_hook)){
+    g_error("can not get selected hook\n");
+  }  
+
+  gConstructor = get_constructor();
+  ToolMenuTitle_menu = lookup_widget(mw->MWindow,"ToolMenuTitle_menu");
+  insert_view = gtk_menu_item_new_with_mnemonic ("insert_view");
+  gtk_widget_show (insert_view);
+  gtk_container_add (GTK_CONTAINER (ToolMenuTitle_menu), insert_view);
+  g_signal_connect ((gpointer) insert_view, "activate",
+                    G_CALLBACK (insertViewTest),
+                    NULL);  
+  //end
+
+  gSysView->EventDB = NULL;
+  gSysView->SystemInfo = NULL;
+  gSysView->Options  = NULL;
+  gSysView->Window = mw;
+  gSysView->Next = NULL;
+
+  g_object_set_data(G_OBJECT(window1), "systemView", (gpointer)gSysView);
+  g_object_set_data(G_OBJECT(window1), "mainWindow", (gpointer)mw);
+
+  gtk_main ();
+}
+
+void destroy_walk(gpointer data, gpointer user_data)
+{
+       //GuiControlFlow_Destructor((ControlFlowData*)data);
+}
+
+
+
+/**
+ * plugin's destroy function
+ *
+ * This function releases the memory reserved by the module and unregisters
+ * everything that has been registered in the gtkTraceSet API.
+ */
+G_MODULE_EXPORT void destroy() {
+
+       WindowCreationData *Window_Creation_Data;
+       LttvAttributeValue value;
+
+       g_critical("GUI destroy()");
+       //int i;
+
+       //ControlFlowData *Control_Flow_Data;
+       
+
+       //g_slist_foreach(sControl_Flow_Data_List, destroy_walk, NULL );
+
+       lttv_iattribute_find_by_path(LTTV_IATTRIBUTE(lttv_global_attributes()),
+                       "/hooks/main/before",   LTTV_POINTER, &value);
+
+       Window_Creation_Data = lttv_hooks_remove(*(value.v_pointer),
+                                                                                                                                                                        Window_Creation_Hook);
+
+       g_free(Window_Creation_Data);
+
+
+}
+
+
+
+
index be37e4ea3bb7d809cc19e242aa2e8fc75cf38a78..8d5d7dc8df95d18f8654161dc338a5aa76e8375a 100755 (executable)
Binary files a/ltt/branches/poly/lttv/modules/gui/mainWin/src/mainwin and b/ltt/branches/poly/lttv/modules/gui/mainWin/src/mainwin differ
This page took 0.027302 seconds and 4 git commands to generate.