[mcrux] r154 committed - Woohooo !! MCrux Ubuntu is now showing GTK window as provided by the "...

2 views
Skip to first unread message

codesite...@google.com

unread,
Nov 1, 2009, 8:43:27 AM11/1/09
to mcru...@googlegroups.com
Revision: 154
Author: mital.d.vora
Date: Sun Nov 1 05:42:59 2009
Log: Woohooo !! MCrux Ubuntu is now showing GTK window as provided by
the "mcruxspec" file !! Yo !!

#--This line, and those below, will be ignored--

M src/include/mcrux/MCrux.h
M src/lib/MCrux.cpp
M src/lib/window/MCruxWindowManager.cpp
M src/lib/window/MCruxWindowManager.h
M src/lib/window/Makefile.am
M src/lib/Makefile.am
M src/configure.in
M src/bin/Makefile.am
M src/bin/mcrux_linux.cpp

http://code.google.com/p/mcrux/source/detail?r=154

Modified:
/trunk/src/bin/Makefile.am
/trunk/src/bin/mcrux_linux.cpp
/trunk/src/configure.in
/trunk/src/include/mcrux/MCrux.h
/trunk/src/lib/MCrux.cpp
/trunk/src/lib/Makefile.am
/trunk/src/lib/window/MCruxWindowManager.cpp
/trunk/src/lib/window/MCruxWindowManager.h
/trunk/src/lib/window/Makefile.am

=======================================
--- /trunk/src/bin/Makefile.am Tue Oct 20 20:49:40 2009
+++ /trunk/src/bin/Makefile.am Sun Nov 1 05:42:59 2009
@@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in

-INCLUDES = -I@top_srcdir@/lib
+INCLUDES = -I@top_srcdir@/include

RM_CLEAN = rm -rf

@@ -8,6 +8,10 @@

bin_PROGRAMS = mcrux_linux

+#noinst_PROGRAMS= gtklauncher
+
mcrux_linux_SOURCES = mcrux_linux.cpp
mcrux_linux_LDADD = @LDADDS@

+#gtklauncher_SOURCES = gtklauncher.cpp
+#gtklauncher_LDADD = @LDADDS@
=======================================
--- /trunk/src/bin/mcrux_linux.cpp Tue Oct 20 20:49:40 2009
+++ /trunk/src/bin/mcrux_linux.cpp Sun Nov 1 05:42:59 2009
@@ -2,8 +2,11 @@

using namespace std;

+#include<mcrux/MCrux.h>
+
int main(int argc, char **argv)
{
- cout << "Hello World !!" << endl;
+ MCrux mcrux;
+ mcrux.InitializeAndRunWith("/home/mital/test.mcruxspec", argc, argv);
return 0;
}
=======================================
--- /trunk/src/configure.in Sun Nov 1 00:06:50 2009
+++ /trunk/src/configure.in Sun Nov 1 05:42:59 2009
@@ -29,6 +29,7 @@
SUBDIRS="$SUBDIRS bin"
LDADDS="../lib/libmcrux_common.la"
LDADDS="$LDADDS ../lib/window/libmcrux_window.la"
+LDADDS="$LDADDS ../lib/abstract/libmcrux_abstract.la"
AC_SUBST(SUBDIRS)
AC_SUBST(LDADDS)
dnl Checks for programs.
@@ -65,6 +66,7 @@
AC_OUTPUT(include/Makefile
include/mcrux/Makefile
lib/Makefile
+lib/abstract/Makefile
lib/window/Makefile
bin/Makefile
Makefile)
=======================================
--- /trunk/src/include/mcrux/MCrux.h Sun Nov 1 00:06:50 2009
+++ /trunk/src/include/mcrux/MCrux.h Sun Nov 1 05:42:59 2009
@@ -34,16 +34,24 @@

class MCRUX_API MCrux
{
- void Initialize();
-
- void UnInitialize();
-
-public:
-
- MCrux();
- ~MCrux();
-
- bool InitializeAndRunWith(const string & mcruxAppConfigFileName);
+ void Initialize(
+#ifndef WIN32
+ int argc, char **argv
+#endif
+ );
+
+ void UnInitialize();
+
+ public:
+
+ MCrux();
+ ~MCrux();
+
+ bool InitializeAndRunWith(const string & mcruxAppConfigFileName
+#ifndef WIN32
+ , int argc, char **argv
+#endif
+ );
};

#endif // _MCRUX_H_
=======================================
--- /trunk/src/lib/MCrux.cpp Sun Nov 1 04:45:19 2009
+++ /trunk/src/lib/MCrux.cpp Sun Nov 1 05:42:59 2009
@@ -30,32 +30,33 @@
#include <shlwapi.h>
#include <wininet.h>

-#include "window/MCruxWin32Window.h"
-
#ifdef _MANAGED
#pragma managed(push, off)
#endif

BOOL APIENTRY DllMain( HMODULE hModule,
- DWORD ul_reason_for_call,
- LPVOID lpReserved
- )
-{
- switch (ul_reason_for_call)
- {
- case DLL_PROCESS_ATTACH:
- case DLL_THREAD_ATTACH:
- case DLL_THREAD_DETACH:
- case DLL_PROCESS_DETACH:
- break;
- }
- return TRUE;
+ DWORD ul_reason_for_call,
+ LPVOID lpReserved
+ )
+{
+ switch (ul_reason_for_call)
+ {
+ case DLL_PROCESS_ATTACH:
+ case DLL_THREAD_ATTACH:
+ case DLL_THREAD_DETACH:
+ case DLL_PROCESS_DETACH:
+ break;
+ }
+ return TRUE;
}

#ifdef _MANAGED
#pragma managed(pop)
#endif

+
+#else // for linux
+#include <gtk/gtk.h>
#endif

MCrux::MCrux()
@@ -65,83 +66,109 @@

MCrux::~MCrux()
{
- return;
}

-void MCrux::Initialize()
+void MCrux::Initialize(
+#ifndef WIN32
+ int argc, char **argv
+#endif
+ )
{
#ifdef WIN32
- // Initialize Common controls
- INITCOMMONCONTROLSEX InitCtrlEx;
-
- InitCtrlEx.dwSize = sizeof(INITCOMMONCONTROLSEX);
- InitCtrlEx.dwICC = 0x00004000; //ICC_STANDARD_CLASSES;
- InitCommonControlsEx(&InitCtrlEx);
-
- MCruxWin32Window::initWindowClass(GetModuleHandle(NULL));
-
- // Init COM
- OleInitialize(NULL);
+ // Initialize Common controls
+ INITCOMMONCONTROLSEX InitCtrlEx;
+
+ InitCtrlEx.dwSize = sizeof(INITCOMMONCONTROLSEX);
+ InitCtrlEx.dwICC = 0x00004000; //ICC_STANDARD_CLASSES;
+ InitCommonControlsEx(&InitCtrlEx);
+
+ MCruxWindow::initWindowClass(GetModuleHandle(NULL));
+
+ // Init COM
+ OleInitialize(NULL);
+#else
+ gtk_init (&argc, &argv);
+ if (!g_thread_supported ())
+ g_thread_init (NULL);
+
#endif
}

void MCrux::UnInitialize()
{
#ifdef WIN32
- // Shut down COM.
- OleUninitialize();
- MCruxWin32Window::unInitWindowClass(GetModuleHandle(NULL));
+ // Shut down COM.
+ OleUninitialize();
+ MCruxWindow::unInitWindowClass(GetModuleHandle(NULL));
#endif
}


-bool MCrux::InitializeAndRunWith(const string & mcruxAppConfigFileName)
-{
- bool bRet = false;
- Initialize();
-
- // parse the given configuration file
- MCruxSpecParser parser;
- parser.parse(mcruxAppConfigFileName);
-
- list<MCruxWindowConfiguration*> mcruxWindowConfigs;
- parser.getWindowConfigList(mcruxWindowConfigs);
-
- list<wstring> plugins;
- parser.getPlugins(plugins);
+
+bool MCrux::InitializeAndRunWith(const string & mcruxAppConfigFileName
+#ifndef WIN32
+ , int argc, char **argv
+#endif
+ )
+{
+ bool bRet = false;
+ Initialize(
+#ifndef WIN32
+ argc, argv
+#endif
+ );
+
+ // parse the given configuration file
+ MCruxSpecParser parser;
+ parser.parse(mcruxAppConfigFileName);
+
+ list<MCruxWindowConfiguration*> mcruxWindowConfigs;
+ parser.getWindowConfigList(mcruxWindowConfigs);
+
+ list<wstring> plugins;
+ parser.getPlugins(plugins);
+
#ifdef WIN32
- MCruxPluginManager pluginManager(plugins);
- MCruxWindowManager windowManager(mcruxWindowConfigs, &pluginManager);
+ MCruxPluginManager pluginManager(plugins);
#endif

- if(mcruxWindowConfigs.size())
- {
+ MCruxWindowManager windowManager(mcruxWindowConfigs
#ifdef WIN32
- HACCEL hAccelTable = NULL;// LoadAccelerators(::GetModuleHandle(NULL),
MAKEINTRESOURCE(IDC_blah));
-
- MSG msg;
- // Main message loop:
- while (GetMessage(&msg, NULL, 0, 0))
- {
- if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
- {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- }
- bRet = true;
+ , &pluginManager
+#endif
+ );
+
+ if(mcruxWindowConfigs.size())
+ {
+#ifdef WIN32
+ HACCEL hAccelTable = NULL;// LoadAccelerators(::GetModuleHandle(NULL),
MAKEINTRESOURCE(IDC_blah));
+
+ MSG msg;
+ // Main message loop:
+ while (GetMessage(&msg, NULL, 0, 0))
+ {
+ if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
+ {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
+ }
+ bRet = true;
+#else // for linux
+ gtk_main();
+
#endif
- }
- else
- {
+ }
+ else
+ {
#ifdef WIN32
- ::MessageBoxA(0, "mcruxspec file does not have any windows\n you can
refer documentation at
http://code.google.com/p/mcrux/wiki/MCruxSpecFile", "error", MB_OK);
+ ::MessageBoxA(0, "mcruxspec file does not have any windows\n you can
refer documentation at
http://code.google.com/p/mcrux/wiki/MCruxSpecFile", "error", MB_OK);
#else
- cout << "error: mcruxspec file does not have any windows" << endl
+ cout << "error: mcruxspec file does not have any windows" << endl
<< "you can refer documentation at
http://code.google.com/p/mcrux/wiki/MCruxSpecFile" << endl;
#endif
- }
-
- UnInitialize();
- return bRet;
-}
+ }
+
+ UnInitialize();
+ return bRet;
+}
=======================================
--- /trunk/src/lib/Makefile.am Sun Nov 1 00:06:50 2009
+++ /trunk/src/lib/Makefile.am Sun Nov 1 05:42:59 2009
@@ -2,7 +2,7 @@

INCLUDES = -I@top_srcdir@/lib -I@top_srcdir@/include

-SUBDIRS = window
+SUBDIRS = abstract window

noinst_HEADERS=MCruxSpecParser.h

=======================================
--- /trunk/src/lib/window/MCruxWindowManager.cpp Sun Nov 1 04:45:19 2009
+++ /trunk/src/lib/window/MCruxWindowManager.cpp Sun Nov 1 05:42:59 2009
@@ -17,7 +17,12 @@
* @author: Mital Vora.
**/
#include "MCruxWindowManager.h"
+
+#ifdef WIN32
#include <window/MCruxWin32Window.h>
+#else
+#include <window/MCruxGTKWindow.h>
+#endif

MCruxWindowManager::MCruxWindowManager(const
list<MCruxWindowConfiguration*> & _windowConfigurations
#ifdef WIN32
@@ -35,14 +40,17 @@
oIter++)
{
MCruxWindowConfiguration * mainWindowConfig = *oIter;
+ MCruxWindow * newWindow = NULL;
+
#ifdef WIN32
- MCruxWindow * newWindow = new MCruxWin32Window(mainWindowConfig,
pluginManager, this);
+ newWindow = new MCruxWin32Window(mainWindowConfig, pluginManager, this);
+#else
+ newWindow = new MCruxGTKWindow(mainWindowConfig);
+#endif
+
newWindow->ShowWindow();
newWindow->UpdateWindow();
windows.push_back(newWindow);
-#else
- //MCruxWindow * newWindow =
-#endif
}
}
}
=======================================
--- /trunk/src/lib/window/MCruxWindowManager.h Sun Nov 1 04:45:19 2009
+++ /trunk/src/lib/window/MCruxWindowManager.h Sun Nov 1 05:42:59 2009
@@ -22,7 +22,10 @@

#include <list>
#include <abstract/MCruxWindow.h>
+
+#ifdef WIN32
#include <plugin/MCruxPluginManager.h>
+#endif

class MCruxWindowManager
{
=======================================
--- /trunk/src/lib/window/Makefile.am Sun Nov 1 03:39:34 2009
+++ /trunk/src/lib/window/Makefile.am Sun Nov 1 05:42:59 2009
@@ -6,11 +6,13 @@

noinst_HEADERS = \
MCruxWindowConfiguration.h \
+ MCruxGTKWindow.h \
MCruxWindowManager.h

lib_LTLIBRARIES = libmcrux_window.la

libmcrux_window_la_SOURCES = \
MCruxWindowConfiguration.cpp \
+ MCruxGTKWindow.cpp \
MCruxWindowManager.cpp

Reply all
Reply to author
Forward
0 new messages