From 96b784c956f7f266987e03a573a58fdb8e4c3fb3 Mon Sep 17 00:00:00 2001 From: fcolin Date: Thu, 1 Feb 2007 13:10:34 +0000 Subject: Utilisateur : Fcolin Date : 29/07/99 Heure : 16:46 Archivé dans $/Bus/Test (vss 5) --- IvyProbe/IvyProbeDlg.cpp | 71 ++++++++++++++++++++++++++++++------------------ 1 file changed, 44 insertions(+), 27 deletions(-) (limited to 'IvyProbe') diff --git a/IvyProbe/IvyProbeDlg.cpp b/IvyProbe/IvyProbeDlg.cpp index 998c5dc..c37ee48 100644 --- a/IvyProbe/IvyProbeDlg.cpp +++ b/IvyProbe/IvyProbeDlg.cpp @@ -71,7 +71,7 @@ CTestDlg::CTestDlg(CWnd* pParent /*=NULL*/) // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); - + bus = NULL; } void CTestDlg::DoDataExchange(CDataExchange* pDX) @@ -100,6 +100,7 @@ BEGIN_MESSAGE_MAP(CTestDlg, CDialog) ON_BN_CLICKED(IDC_START, OnStart) ON_WM_VSCROLL() ON_EN_VSCROLL(IDC_MSG, OnVscrollMsg) + ON_WM_CLOSE() //}}AFX_MSG_MAP END_MESSAGE_MAP() @@ -134,16 +135,6 @@ BOOL CTestDlg::OnInitDialog() SetIcon(m_hIcon, FALSE); // Set small icon // TODO: Add extra initialization here - bus = new Ivy( "TEST NT","TEST NT READY",this); - - bus->BindMsg("^MIDICS10:fader([0-7]) value=([0-9]+)", BUS_CALLBACK_OF(CTestDlg, FaderCallback)); - bus->BindMsg("^MIDICS10:knob([0-5]) value=([0-9]+)", BUS_CALLBACK_OF(CTestDlg, FaderCallback)); - bus->BindMsg("(.*)", BUS_CALLBACK_OF(CTestDlg, IvyCallback )); - - //bus->BindMsg("^S( A=([0-9]+))?( B=([0-9]+))?",cb); - m_busnumber = bus->GetDomain( m_busnumber ); - UpdateData(FALSE); - m_slider0.SetRange( 0, 127); m_slider1.SetRange( 0, 127); m_slider2.SetRange( 0, 127); @@ -161,6 +152,18 @@ BOOL CTestDlg::OnInitDialog() m_slider5.SetWindowText( "MIDICS10:fader5 value=" ); m_slider6.SetWindowText( "MIDICS10:fader6 value=" ); m_slider7.SetWindowText( "MIDICS10:fader7 value=" ); + + bus = new Ivy( "TEST NT","TEST NT READY",this); + + bus->BindMsg("^MIDICS10:fader([0-7]) value=([0-9]+)", BUS_CALLBACK_OF(CTestDlg, FaderCallback)); + bus->BindMsg("^MIDICS10:knob([0-5]) value=([0-9]+)", BUS_CALLBACK_OF(CTestDlg, FaderCallback)); + bus->BindMsg("(.*)", BUS_CALLBACK_OF(CTestDlg, IvyCallback )); + + //bus->BindMsg("^S( A=([0-9]+))?( B=([0-9]+))?",cb); + m_busnumber = bus->GetDomain( m_busnumber ); + UpdateData(FALSE); + + return TRUE; // return TRUE unless you set the focus to a control } @@ -228,26 +231,18 @@ void CTestDlg::IvyCallback(IvyApplication *app, int argc, const char **argv) int i; CString text; TRACE(" Called function args:"); - m_text.SetSel( -1, -1, FALSE ); text.Format("Ivy callback %d args\r\n",argc ); - m_text.ReplaceSel( text ); + WriteMessage( text ); for ( i = 0; i < argc; i++ ) { - m_text.SetSel( -1, -1, FALSE ); text.Format("Ivy callback arg%d '%s'\r\n",i, argv[i] ); - m_text.ReplaceSel( text ); + WriteMessage( text ); TRACE(" '%s'",argv[i]); } TRACE("\n"); } -void CTestDlg::OnOK() -{ - // TODO: Add extra validation here - delete bus; - CDialog::OnOK(); -} void CTestDlg::FaderCallback(IvyApplication *app, int argc, const char **argv) { @@ -286,7 +281,7 @@ if ( argc != 2 ) m_slider7.SetPos( value ); break; } -UpdateData(FALSE); +//UpdateData(FALSE); } @@ -298,18 +293,20 @@ TRACE("Direct Msg Receive %d, %s\n",id,arg ); void CTestDlg::OnApplicationConnected(IvyApplication *app) { CString text; - m_text.SetSel( -1, -1, FALSE ); text.Format("Application: %s ready\r\n",(LPCSTR)(app->GetName()) ); - m_text.ReplaceSel( text ); + WriteMessage( text ); } void CTestDlg::OnApplicationDisconnected(IvyApplication *app) { CString text; - m_text.SetSel( -1, -1, FALSE ); text.Format("Application: %s bye\r\n",(LPCSTR)(app->GetName()) ); + WriteMessage( text ); +} +void CTestDlg::WriteMessage(const CString & text) +{ + m_text.SetSel( -1, -1, FALSE ); m_text.ReplaceSel( text ); } - void CTestDlg::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) { // TODO: Add your message handler code here and/or call default @@ -336,7 +333,27 @@ void CTestDlg::OnVscrollMsg() { buffer[len] = '\0'; TRACE("IDC MSG Scroll %d len= %d %s\n",line,len, buffer); - bus->SendMsg( buffer ); + int count = bus->SendMsg( buffer ); + CString mess; + mess.Format("Sending %d message %s\r\n",count,buffer); + WriteMessage( mess ); } } } + +void CTestDlg::OnClose() +{ + // TODO: Add your message handler code here and/or call default + TRACE ( "Quitting\n"); + if (bus) delete bus; + + CDialog::OnClose(); +} + +void CTestDlg::OnOK() +{ + // TODO: Add extra validation here + TRACE ( "Quitting\n"); + if (bus) delete bus; + CDialog::OnOK(); +} -- cgit v1.1