From 576ad2b67bced04bde83de91f5e647af868c5fd4 Mon Sep 17 00:00:00 2001 From: fcolin Date: Fri, 12 Mar 2010 16:41:08 +0000 Subject: mise en conformité des messages ping /pong Correction pb a la fermeture d'ivy --- IvyProbe/IvyProbeDlg.cpp | 45 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 4 deletions(-) (limited to 'IvyProbe/IvyProbeDlg.cpp') diff --git a/IvyProbe/IvyProbeDlg.cpp b/IvyProbe/IvyProbeDlg.cpp index ef7bff8..35a9fe3 100644 --- a/IvyProbe/IvyProbeDlg.cpp +++ b/IvyProbe/IvyProbeDlg.cpp @@ -58,6 +58,7 @@ void CIvyProbeDlg::DoDataExchange(CDataExchange* pDX) DDX_Control(pDX, IDC_REGEXP, m_expr); DDX_Control(pDX, IDC_MSG, m_msg); DDX_Text(pDX, IDC_BUSNUMBER, m_busnumber); + DDX_Control(pDX, IDC_CLIENT_LIST, m_clients ); //}}AFX_DATA_MAP } @@ -74,6 +75,7 @@ BEGIN_MESSAGE_MAP(CIvyProbeDlg, MyDialog) //}}AFX_MSG_MAP ON_COMMAND(ID_FILE_SAVEBINDINGS, &CIvyProbeDlg::OnFileSavebindings) ON_COMMAND(ID_FILE_LOADBINDINGS, &CIvyProbeDlg::OnFileLoadbindings) + ON_LBN_DBLCLK(IDC_CLIENT_LIST, &CIvyProbeDlg::OnLbnDblclkClientList) END_MESSAGE_MAP() @@ -136,7 +138,10 @@ BOOL CIvyProbeDlg::OnInitDialog() << item ( IDC_BUSNUMBER, GREEDY ) << item ( IDC_START, NORESIZE ) ) - << item ( IDC_TEXT, GREEDY ) + << ( pane( HORIZONTAL, GREEDY ) + << item ( IDC_CLIENT_LIST, ABSOLUTE_HORZ ) + << item ( IDC_TEXT, GREEDY ) + ) << ( pane( HORIZONTAL, ABSOLUTE_VERT ) << item( IDC_STATIC_MSG, NORESIZE ) << item( IDC_MSG, GREEDY ) @@ -160,7 +165,7 @@ BOOL CIvyProbeDlg::OnInitDialog() // Set Argument from Command Line m_busnumber = cmd.m_busNumber; - bus = new Ivy( "IvyProbe Windows","IvyProbe Windows Ready",this,FALSE); + bus = new Ivy( "IvyProbeWindows","IvyProbeWindows Ready",this,FALSE); bus->SetBindCallback( this ); // bus->BindMsg("(.*)", BUS_CALLBACK_OF(CTestDlg, IvyCallback )); @@ -232,11 +237,25 @@ TRACE(TEXT("Direct Msg Receive %d, %s\n"),id,arg ); void CIvyProbeDlg::OnApplicationConnected(IvyApplication *app) { - WriteMessage( "Application: %s ready",(LPCSTR)(app->GetName()) ); + LPCSTR name = (LPCSTR)(app->GetName()); + WriteMessage( "Application: %s ready", name ); + int idx = m_clients.AddString( name ); + m_clients.SetItemDataPtr( idx, app ); } void CIvyProbeDlg::OnApplicationDisconnected(IvyApplication *app) { - WriteMessage( "Application: %s bye",(LPCSTR)(app->GetName()) ); + LPCSTR name = (LPCSTR)(app->GetName()); + WriteMessage( "Application: %s bye", name ); + int nb = m_clients.GetCount(); + for( int idx = 0; idx < nb ; idx++) + { + IvyApplication * appToRemove = (IvyApplication * )m_clients.GetItemDataPtr( idx ); + if ( appToRemove == app ) + { + m_clients.DeleteString( idx ); + break; + } + } } void CIvyProbeDlg::OnAddBind (IvyApplication *app, int id, const char * regexp) @@ -392,3 +411,21 @@ void CIvyProbeDlg::OnFileSavebindings() } #endif } + +void CIvyProbeDlg::OnLbnDblclkClientList() +{ + IvyApplication *app; + int nCount = m_clients.GetSelCount(); + if ( nCount > 0 ) + { + int* selected = new int[ nCount ]; + + int nb = m_clients.GetSelItems(nCount, selected ); + for( int idx = 0; idx < nb ; idx++) + { + app = (IvyApplication * )m_clients.GetItemDataPtr( selected[idx] ); + bus->SendDieMsg( app ); + } + delete [] selected; + } +} -- cgit v1.1