summaryrefslogtreecommitdiff
path: root/Bus/Ivy/IvySynchroWnd.cxx
diff options
context:
space:
mode:
authorfcolin2007-02-01 13:29:31 +0000
committerfcolin2007-02-01 13:29:31 +0000
commitafe2e7dfc1388cad991e8d38dda7d648c137aa52 (patch)
tree92bf63d2b2b34a805927aa294c7c51912638f66a /Bus/Ivy/IvySynchroWnd.cxx
parent0be65f8a110ee9bf5da9c93e0bd5b5b62b3bad0c (diff)
parent04c263c314499e38d64af9d4a1aa5e2b8d9d5ead (diff)
downloadivy-cplusplus-afe2e7dfc1388cad991e8d38dda7d648c137aa52.zip
ivy-cplusplus-afe2e7dfc1388cad991e8d38dda7d648c137aa52.tar.gz
ivy-cplusplus-afe2e7dfc1388cad991e8d38dda7d648c137aa52.tar.bz2
ivy-cplusplus-afe2e7dfc1388cad991e8d38dda7d648c137aa52.tar.xz
modif struct svnwindows@3001
Diffstat (limited to 'Bus/Ivy/IvySynchroWnd.cxx')
-rw-r--r--Bus/Ivy/IvySynchroWnd.cxx243
1 files changed, 0 insertions, 243 deletions
diff --git a/Bus/Ivy/IvySynchroWnd.cxx b/Bus/Ivy/IvySynchroWnd.cxx
deleted file mode 100644
index 2109a61..0000000
--- a/Bus/Ivy/IvySynchroWnd.cxx
+++ /dev/null
@@ -1,243 +0,0 @@
-// SynchroWnd.cpp : implementation file
-//
-
-#include "IvyStdAfx.h"
-
-
-#include "IvySynchroWnd.h"
-
-
-#define WM_IVY_CB WM_USER + 1001
-
-
-IvySynchroWnd* IvySynchronousCallback::m_synchro = NULL;
-IvySynchroWnd* IvySynchroWnd::m_synchro = NULL;
-
-/////////////////////////////////////////////////////////////////////////////
-// IvySynchroWnd
-
-IvySynchroWnd::IvySynchroWnd()
-{
- m_hWnd = NULL;
- m_synchro = this;
-
- WNDCLASS wc;
-
- // Fill in the window class structure with parameters
- // that describe the main window.
-
- wc.style = 0; // noredraw if size changes
- wc.lpfnWndProc = WindowProc; // points to window procedure
- wc.cbClsExtra = 0; // no extra class memory
- wc.cbWndExtra = 0; // no extra window memory
- wc.hInstance = 0; // handle to instance
- wc.hIcon = NULL; // predefined app. icon
- wc.hCursor = NULL; // predefined arrow
- wc.hbrBackground = 0; // white background brush
- wc.lpszMenuName = NULL; // no menu
- wc.lpszClassName = TEXT("IvySynchroClass"); // name of window class
-
- // Register the window class.
-
- if ( ! RegisterClass(&wc) )
- {
- TRACE("Warning: unable to create Ivy Synchro notify window!\n");
- //AfxThrowResourceException();
- }
-
- // Create the syncrho window.
- m_hWnd = CreateWindowEx(0, TEXT("IvySynchroClass"), TEXT("Ivy Synchro Notification Sink"),
- WS_OVERLAPPED, 0, 0, 0, 0, NULL , NULL, NULL, NULL);
- if (!m_hWnd)
- {
- TRACE("Warning: unable to create Ivy Synchro notify window!\n");
- //AfxThrowResourceException();
- }
- InitializeCriticalSection( &m_CritSection );
-
-}
-IvySynchroWnd::~IvySynchroWnd()
-{
-}
-
-
-LRESULT CALLBACK IvySynchroWnd::WindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
-{
- switch ( uMsg )
- {
- case WM_IVY_CB:
- m_synchro->OnIvyCB( wParam, lParam );
- break;
- //
- // Process other messages.
- //
-
- default:
- return DefWindowProc(hwnd, uMsg, wParam, lParam);
- }
- return 0;
-}
-
-
-
-
-/////////////////////////////////////////////////////////////////////////////
-// IvySynchroWnd message handlers
-
-
-LRESULT IvySynchroWnd::OnIvyCB(WPARAM wParam, LPARAM lParam)
-{
- IvySynchronousCallbackList::iterator iter;
- EnterCriticalSection( &m_CritSection );
-
- for ( iter = callbacklist.begin(); iter != callbacklist.end(); )
- {
- IvySynchronousCallback *param = *iter++;
- param->CallCallback();
- delete param;
- }
- callbacklist.clear();
- LeaveCriticalSection( &m_CritSection );
- return 0L;
-}
-void IvySynchroWnd::PostIvyCB( IvySynchronousCallback *cb )
-{
- EnterCriticalSection( &m_CritSection );
- if ( m_synchro->callbacklist.empty() )
- ASSERT(PostMessage(m_synchro->m_hWnd, WM_IVY_CB, 0, 0 ));
- m_synchro->callbacklist.push_back( cb );
- LeaveCriticalSection( &m_CritSection );
-}
-//
-//
-IvySynchronousMessageCallback::IvySynchronousMessageCallback( IvyMessageCallback *cb )
-{
- target = cb;
- app = 0;
- argc = 0;
- argv = 0;
-}
-IvySynchronousMessageCallback::~IvySynchronousMessageCallback()
-{
- //delete target;
- for( int i = 0; i < argc ; i++ )
- {
- delete argv[i];
- }
- if ( argv ) delete argv;
-}
-void IvySynchronousMessageCallback::OnMessage(IvyApplication *app, int argc, const char **argv )
-{
- static int msg_count = 0;
- // duplicate on the Message Queue
- IvySynchronousMessageCallback *param = new IvySynchronousMessageCallback(target);
- param->app = app;
- param->argc = argc;
- param->argv = new char*[argc];
- for( int i = 0; i < argc ; i++ )
- {
-#ifdef UNDER_CE
- param->argv[i] = _strdup( argv[i]);
-#else
- param->argv[i] = _strdup( argv[i]);
-#endif
- }
-// TRACE( "IvySynchronousMessageCallback::OnMessage msg count %d\n",wParam);
- m_synchro->PostIvyCB( param );
-
-}
-void IvySynchronousMessageCallback::CallCallback()
-{
- target->OnMessage( app, argc, (const char **) argv );
- for( int i = 0; i < argc ; i++ )
- delete argv[i];
- delete argv;
-}
-
-
-IvySynchronousApplicationCallback::IvySynchronousApplicationCallback( IvyApplicationCallback *cb )
-{
- target = cb;
-}
-void IvySynchronousApplicationCallback::OnApplicationConnected( IvyApplication *app)
-{
- // duplicate on the Message Queue
- IvySynchronousApplicationCallback *param = new IvySynchronousApplicationCallback(target);
- param->type = CONNECTED_CB;
- param->app = app;
- m_synchro->PostIvyCB( param );
-}
-
-void IvySynchronousApplicationCallback::OnApplicationDisconnected( IvyApplication *app)
-{
- // duplicate on the Message Queue
- IvySynchronousApplicationCallback *param = new IvySynchronousApplicationCallback(target);
- param->type = DISCONNECTED_CB;
- param->app = app;
- m_synchro->PostIvyCB( param );
-}
-void IvySynchronousApplicationCallback::CallCallback()
-{
- switch ( type )
- {
- case CONNECTED_CB:
- target->OnApplicationConnected( app );
- break;
- case DISCONNECTED_CB:
- target->OnApplicationDisconnected( app );
- break;
- }
-}
-
-
-IvySynchronousBindingCallback::IvySynchronousBindingCallback( IvyBindingCallback *cb )
-{
- target = cb;
-}
-void IvySynchronousBindingCallback::OnAddBind( IvyApplication *app, int id, const char *regexp)
-{
- // duplicate on the Message Queue
- IvySynchronousBindingCallback *param = new IvySynchronousBindingCallback(target);
- param->type = ADD_CB;
- param->app = app;
- param->id = id;
- param->regexp = _strdup(regexp);
- m_synchro->PostIvyCB( param );
-}
-
-void IvySynchronousBindingCallback::OnRemoveBind( IvyApplication *app, int id, const char *regexp)
-{
- // duplicate on the Message Queue
- IvySynchronousBindingCallback *param = new IvySynchronousBindingCallback(target);
- param->type = REMOVE_CB;
- param->app = app;
- param->id = id;
- param->regexp = _strdup(regexp);
- m_synchro->PostIvyCB( param );
-}
-void IvySynchronousBindingCallback::OnFilterBind( IvyApplication *app, int id, const char *regexp)
-{
- // duplicate on the Message Queue
- IvySynchronousBindingCallback *param = new IvySynchronousBindingCallback(target);
- param->type = FILTER_CB;
- param->app = app;
- param->id = id;
- param->regexp = _strdup(regexp);
- m_synchro->PostIvyCB( param );
-}
-void IvySynchronousBindingCallback::CallCallback()
-{
- switch ( type )
- {
- case ADD_CB:
- target->OnAddBind( app, id, regexp );
- break;
- case REMOVE_CB:
- target->OnRemoveBind( app, id, regexp );
- break;
- case FILTER_CB:
- target->OnFilterBind( app, id, regexp );
- break;
- }
- delete regexp;
-} \ No newline at end of file