StephaneLenclud@8: // DisplayTestDlg.cpp : implementation file StephaneLenclud@8: // StephaneLenclud@8: StephaneLenclud@8: #include "stdafx.h" StephaneLenclud@8: #include "DisplayTest.h" StephaneLenclud@8: #include "DisplayTestDlg.h" StephaneLenclud@8: StephaneLenclud@8: #ifdef _DEBUG StephaneLenclud@8: #define new DEBUG_NEW StephaneLenclud@8: #endif StephaneLenclud@8: StephaneLenclud@8: static WCHAR staticCh=1; StephaneLenclud@8: StephaneLenclud@8: // CAboutDlg dialog used for App About StephaneLenclud@8: StephaneLenclud@8: class CAboutDlg : public CDialog StephaneLenclud@8: { StephaneLenclud@8: public: StephaneLenclud@8: CAboutDlg(); StephaneLenclud@8: StephaneLenclud@8: // Dialog Data StephaneLenclud@8: enum { IDD = IDD_ABOUTBOX }; StephaneLenclud@8: StephaneLenclud@8: protected: StephaneLenclud@8: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support StephaneLenclud@8: StephaneLenclud@8: // Implementation StephaneLenclud@8: protected: StephaneLenclud@8: DECLARE_MESSAGE_MAP() StephaneLenclud@8: }; StephaneLenclud@8: StephaneLenclud@8: CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) StephaneLenclud@8: { StephaneLenclud@8: } StephaneLenclud@8: StephaneLenclud@8: void CAboutDlg::DoDataExchange(CDataExchange* pDX) StephaneLenclud@8: { StephaneLenclud@8: CDialog::DoDataExchange(pDX); StephaneLenclud@8: } StephaneLenclud@8: StephaneLenclud@8: BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) StephaneLenclud@8: END_MESSAGE_MAP() StephaneLenclud@8: StephaneLenclud@8: StephaneLenclud@8: // CDisplayTestDlg dialog StephaneLenclud@8: StephaneLenclud@8: CDisplayTestDlg::CDisplayTestDlg(CWnd* pParent /*=NULL*/) StephaneLenclud@8: : CDialog(CDisplayTestDlg::IDD, pParent) StephaneLenclud@8: { StephaneLenclud@8: m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); StephaneLenclud@8: StephaneLenclud@8: m_strLine1 = _T(""); StephaneLenclud@8: m_strLine2 = _T(""); StephaneLenclud@8: m_strLine3 = _T(""); StephaneLenclud@8: StephaneLenclud@8: m_uEqTimer = 0; StephaneLenclud@8: m_uEqTimer2 = 0; StephaneLenclud@8: m_bVfdConnected = FALSE; StephaneLenclud@8: m_bLcdConnected = FALSE; StephaneLenclud@8: } StephaneLenclud@8: StephaneLenclud@8: void CDisplayTestDlg::DoDataExchange(CDataExchange* pDX) StephaneLenclud@8: { StephaneLenclud@8: CDialog::DoDataExchange(pDX); StephaneLenclud@8: StephaneLenclud@8: DDX_Text(pDX, IDC_EDIT1, m_strLine1); StephaneLenclud@8: DDX_Text(pDX, IDC_EDIT2, m_strLine2); StephaneLenclud@8: DDX_Text(pDX, IDC_EDIT3, m_strLine3); StephaneLenclud@8: } StephaneLenclud@8: StephaneLenclud@8: BEGIN_MESSAGE_MAP(CDisplayTestDlg, CDialog) StephaneLenclud@8: ON_WM_SYSCOMMAND() StephaneLenclud@8: ON_WM_PAINT() StephaneLenclud@8: ON_WM_QUERYDRAGICON() StephaneLenclud@8: ON_WM_DESTROY() StephaneLenclud@8: ON_WM_TIMER() StephaneLenclud@8: //}}AFX_MSG_MAP StephaneLenclud@8: ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButtonInit) StephaneLenclud@8: ON_BN_CLICKED(IDC_BUTTON2, OnBnClickedButtonVfdSendText) StephaneLenclud@8: ON_BN_CLICKED(IDC_BUTTON3, OnBnClickedButtonVfdRandomEq) StephaneLenclud@8: ON_BN_CLICKED(IDC_BUTTON4, OnBnClickedButtonLcdSendText) StephaneLenclud@8: ON_BN_CLICKED(IDC_BUTTON5, OnBnClickedButtonLcdRandomEq) StephaneLenclud@8: StephaneLenclud@8: ON_BN_CLICKED(IDC_ORANGE1, OnLcdOrangeIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_ORANGE2, OnLcdOrangeIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_ORANGE3, OnLcdOrangeIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_ORANGE4, OnLcdOrangeIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_ORANGE5, OnLcdOrangeIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_ORANGE6, OnLcdOrangeIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_ORANGE7, OnLcdOrangeIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_ORANGE8, OnLcdOrangeIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_ORANGE0, OnLcdOrangeIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_MUSIC, OnLcdMediaTypeIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_MOVIE, OnLcdMediaTypeIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_PHOTO, OnLcdMediaTypeIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_CD, OnLcdMediaTypeIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_TV, OnLcdMediaTypeIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_WEBCASTING, OnLcdMediaTypeIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_NEWS, OnLcdMediaTypeIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_SPK_L, OnLcdSpeakerIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_SPK_C, OnLcdSpeakerIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_SPK_R, OnLcdSpeakerIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_SPK_SL, OnLcdSpeakerIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_SPK_LFE, OnLcdSpeakerIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_SPK_SR, OnLcdSpeakerIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_SPK_RL, OnLcdSpeakerIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_SPK_SPDIF, OnLcdSpeakerIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_SPK_RR, OnLcdSpeakerIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_AV_MPG, OnLcdVideoCodecIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_AV_DIVX, OnLcdVideoCodecIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_AV_XVID, OnLcdVideoCodecIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_AV_WMV, OnLcdVideoCodecIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_AV_MPA, OnLcdVideoCodecIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_AV_AC3, OnLcdVideoCodecIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_AV_DTS, OnLcdVideoCodecIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_AV_WMA, OnLcdVideoCodecIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_A_MP3, OnLcdAudioCodecIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_A_OGG, OnLcdAudioCodecIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_A_WMA, OnLcdAudioCodecIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_A_WAV, OnLcdAudioCodecIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_AR_SRC, OnLcdAspectRatioIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_AR_FIT, OnLcdAspectRatioIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_AR_TV, OnLcdAspectRatioIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_AR_HDTV, OnLcdAspectRatioIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_AR_SCR1, OnLcdAspectRatioIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_AR_SCR2, OnLcdAspectRatioIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_REPEAT, OnLcdEtcIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_SHUFFLE, OnLcdEtcIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_ALARM, OnLcdEtcIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_REC, OnLcdEtcIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_VOL, OnLcdEtcIcon) StephaneLenclud@8: ON_BN_CLICKED(IDC_TIME, OnLcdEtcIcon) StephaneLenclud@8: ON_WM_HSCROLL() StephaneLenclud@8: StephaneLenclud@8: ON_MESSAGE(WM_DSP_PLUGIN_NOTIFY, OnDisplayPluginNotify) StephaneLenclud@8: ON_BN_CLICKED(IDC_BUTTON6, &CDisplayTestDlg::OnBnClickedScrollChar) StephaneLenclud@8: ON_BN_CLICKED(IDC_BUTTON7, &CDisplayTestDlg::OnBnClickedNextChar) StephaneLenclud@8: ON_BN_CLICKED(IDC_BUTTON8, &CDisplayTestDlg::OnBnClickedPreviousChar) StephaneLenclud@8: END_MESSAGE_MAP() StephaneLenclud@8: StephaneLenclud@8: StephaneLenclud@8: StephaneLenclud@8: StephaneLenclud@8: // CDisplayTestDlg message handlers StephaneLenclud@8: StephaneLenclud@8: BOOL CDisplayTestDlg::OnInitDialog() StephaneLenclud@8: { StephaneLenclud@8: CDialog::OnInitDialog(); StephaneLenclud@8: StephaneLenclud@8: // Add "About..." menu item to system menu. StephaneLenclud@8: StephaneLenclud@8: // IDM_ABOUTBOX must be in the system command range. StephaneLenclud@8: ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); StephaneLenclud@8: ASSERT(IDM_ABOUTBOX < 0xF000); StephaneLenclud@8: StephaneLenclud@8: CMenu* pSysMenu = GetSystemMenu(FALSE); StephaneLenclud@8: if (pSysMenu != NULL) StephaneLenclud@8: { StephaneLenclud@8: CString strAboutMenu; StephaneLenclud@8: strAboutMenu.LoadString(IDS_ABOUTBOX); StephaneLenclud@8: if (!strAboutMenu.IsEmpty()) StephaneLenclud@8: { StephaneLenclud@8: pSysMenu->AppendMenu(MF_SEPARATOR); StephaneLenclud@8: pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); StephaneLenclud@8: } StephaneLenclud@8: } StephaneLenclud@8: StephaneLenclud@8: // Set the icon for this dialog. The framework does this automatically StephaneLenclud@8: // when the application's main window is not a dialog StephaneLenclud@8: SetIcon(m_hIcon, TRUE); // Set big icon StephaneLenclud@8: SetIcon(m_hIcon, FALSE); // Set small icon StephaneLenclud@8: StephaneLenclud@8: // TODO: Add extra initialization here StephaneLenclud@8: m_strLine1 = _T("SoundGraph, Inc."); StephaneLenclud@8: m_strLine2 = _T("iMON Display API"); StephaneLenclud@8: m_strLine3 = _T("SoundGraph, Inc. iMON Display API"); StephaneLenclud@8: StephaneLenclud@8: UpdateControlUI(); StephaneLenclud@8: StephaneLenclud@8: CSliderCtrl* pSliderCtrl = (CSliderCtrl*)GetDlgItem(IDC_SLIDER1); StephaneLenclud@8: if(pSliderCtrl) StephaneLenclud@8: { StephaneLenclud@8: pSliderCtrl->SetRange(0, 100); StephaneLenclud@8: pSliderCtrl->SetPos(0); StephaneLenclud@8: } StephaneLenclud@8: StephaneLenclud@8: UpdateData(FALSE); StephaneLenclud@8: StephaneLenclud@8: return TRUE; // return TRUE unless you set the focus to a control StephaneLenclud@8: } StephaneLenclud@8: StephaneLenclud@8: void CDisplayTestDlg::OnSysCommand(UINT nID, LPARAM lParam) StephaneLenclud@8: { StephaneLenclud@8: if ((nID & 0xFFF0) == IDM_ABOUTBOX) StephaneLenclud@8: { StephaneLenclud@8: CAboutDlg dlgAbout; StephaneLenclud@8: dlgAbout.DoModal(); StephaneLenclud@8: } StephaneLenclud@8: else StephaneLenclud@8: { StephaneLenclud@8: CDialog::OnSysCommand(nID, lParam); StephaneLenclud@8: } StephaneLenclud@8: } StephaneLenclud@8: StephaneLenclud@8: // If you add a minimize button to your dialog, you will need the code below StephaneLenclud@8: // to draw the icon. For MFC applications using the document/view model, StephaneLenclud@8: // this is automatically done for you by the framework. StephaneLenclud@8: StephaneLenclud@8: void CDisplayTestDlg::OnPaint() StephaneLenclud@8: { StephaneLenclud@8: if (IsIconic()) StephaneLenclud@8: { StephaneLenclud@8: CPaintDC dc(this); // device context for painting StephaneLenclud@8: StephaneLenclud@8: SendMessage(WM_ICONERASEBKGND, reinterpret_cast(dc.GetSafeHdc()), 0); StephaneLenclud@8: StephaneLenclud@8: // Center icon in client rectangle StephaneLenclud@8: int cxIcon = GetSystemMetrics(SM_CXICON); StephaneLenclud@8: int cyIcon = GetSystemMetrics(SM_CYICON); StephaneLenclud@8: CRect rect; StephaneLenclud@8: GetClientRect(&rect); StephaneLenclud@8: int x = (rect.Width() - cxIcon + 1) / 2; StephaneLenclud@8: int y = (rect.Height() - cyIcon + 1) / 2; StephaneLenclud@8: StephaneLenclud@8: // Draw the icon StephaneLenclud@8: dc.DrawIcon(x, y, m_hIcon); StephaneLenclud@8: } StephaneLenclud@8: else StephaneLenclud@8: { StephaneLenclud@8: CDialog::OnPaint(); StephaneLenclud@8: } StephaneLenclud@8: } StephaneLenclud@8: StephaneLenclud@8: // The system calls this function to obtain the cursor to display while the user drags StephaneLenclud@8: // the minimized window. StephaneLenclud@8: HCURSOR CDisplayTestDlg::OnQueryDragIcon() StephaneLenclud@8: { StephaneLenclud@8: return static_cast(m_hIcon); StephaneLenclud@8: } StephaneLenclud@8: StephaneLenclud@8: void CDisplayTestDlg::OnDestroy() StephaneLenclud@8: { StephaneLenclud@8: CDialog::OnDestroy(); StephaneLenclud@8: StephaneLenclud@8: IMON_Display_Uninit(); StephaneLenclud@8: } StephaneLenclud@8: StephaneLenclud@8: void CDisplayTestDlg::OnTimer(UINT nIDEvent) StephaneLenclud@8: { StephaneLenclud@8: if(nIDEvent == 101) StephaneLenclud@8: { StephaneLenclud@8: StephaneLenclud@8: DSPEQDATA eqData; StephaneLenclud@8: for(int i=0; i<16;i++) StephaneLenclud@8: { StephaneLenclud@8: eqData.BandData[i] = rand()%100; StephaneLenclud@8: } StephaneLenclud@8: IMON_Display_SetVfdEqData(&eqData); StephaneLenclud@8: } StephaneLenclud@8: else if(nIDEvent == 102) StephaneLenclud@8: { StephaneLenclud@8: DSPEQDATA eqDataL; StephaneLenclud@8: DSPEQDATA eqDataR; StephaneLenclud@8: for(int i=0; i<16;i++) StephaneLenclud@8: { StephaneLenclud@8: eqDataL.BandData[i] = rand()%100; StephaneLenclud@8: eqDataR.BandData[i] = rand()%100; StephaneLenclud@8: } StephaneLenclud@8: IMON_Display_SetLcdEqData(&eqDataL, &eqDataR); StephaneLenclud@8: } StephaneLenclud@8: else if (nIDEvent == 103) StephaneLenclud@8: { StephaneLenclud@8: //Char scroll StephaneLenclud@8: WCHAR myStr[17]; StephaneLenclud@8: StephaneLenclud@8: WCHAR myCh=staticCh; StephaneLenclud@8: StephaneLenclud@8: for (int i=0;i<16;i++) StephaneLenclud@8: { StephaneLenclud@8: myStr[i]=myCh; StephaneLenclud@8: myCh++; StephaneLenclud@8: } StephaneLenclud@8: StephaneLenclud@8: staticCh++; StephaneLenclud@8: myStr[16]=0; StephaneLenclud@8: // StephaneLenclud@8: //myCh--; StephaneLenclud@8: StephaneLenclud@8: CString counter; StephaneLenclud@8: counter.Format(TEXT("%d - %d"),myStr[0],myStr[15]); StephaneLenclud@8: StephaneLenclud@8: IMON_Display_SetVfdText(myStr, (LPCTSTR)counter); StephaneLenclud@8: StephaneLenclud@8: } StephaneLenclud@8: StephaneLenclud@8: CDialog::OnTimer(nIDEvent); StephaneLenclud@8: } StephaneLenclud@8: StephaneLenclud@8: StephaneLenclud@8: void CDisplayTestDlg::OnBnClickedButtonInit() StephaneLenclud@8: { StephaneLenclud@8: if(IMON_Display_IsInited() != DSP_S_INITED) Init(); StephaneLenclud@8: else Uninit(); StephaneLenclud@8: } StephaneLenclud@8: StephaneLenclud@8: void CDisplayTestDlg::OnBnClickedButtonVfdSendText() StephaneLenclud@8: { StephaneLenclud@8: UpdateData(TRUE); StephaneLenclud@8: IMON_Display_SetVfdText((LPCTSTR)m_strLine1, (LPCTSTR)m_strLine2); StephaneLenclud@8: } StephaneLenclud@8: StephaneLenclud@8: void CDisplayTestDlg::OnBnClickedButtonVfdRandomEq() StephaneLenclud@8: { StephaneLenclud@8: if(m_uEqTimer) StephaneLenclud@8: { StephaneLenclud@8: KillTimer(101); m_uEqTimer = 0; StephaneLenclud@8: GetDlgItem(IDC_BUTTON3)->SetWindowText(_T("Start Random EQ")); StephaneLenclud@8: } StephaneLenclud@8: else StephaneLenclud@8: { StephaneLenclud@8: m_uEqTimer = SetTimer(101, 100, NULL); StephaneLenclud@8: GetDlgItem(IDC_BUTTON3)->SetWindowText(_T("Stop Random EQ")); StephaneLenclud@8: } StephaneLenclud@8: } StephaneLenclud@8: StephaneLenclud@8: void CDisplayTestDlg::OnBnClickedScrollChar() StephaneLenclud@8: { StephaneLenclud@8: if(m_uEqTimer) StephaneLenclud@8: { StephaneLenclud@8: KillTimer(103); m_uEqTimer = 0; StephaneLenclud@8: GetDlgItem(IDC_BUTTON6)->SetWindowText(_T("Start Scroll Char")); StephaneLenclud@8: } StephaneLenclud@8: else StephaneLenclud@8: { StephaneLenclud@8: m_uEqTimer = SetTimer(103, 500, NULL); StephaneLenclud@8: GetDlgItem(IDC_BUTTON6)->SetWindowText(_T("Stop Scroll Char")); StephaneLenclud@8: } StephaneLenclud@8: } StephaneLenclud@8: StephaneLenclud@8: void CDisplayTestDlg::OnBnClickedNextChar() StephaneLenclud@8: { StephaneLenclud@8: //staticCh++; StephaneLenclud@8: OnTimer(103); StephaneLenclud@8: } StephaneLenclud@8: StephaneLenclud@8: void CDisplayTestDlg::OnBnClickedPreviousChar() StephaneLenclud@8: { StephaneLenclud@8: staticCh-=2; StephaneLenclud@8: OnTimer(103); StephaneLenclud@8: } StephaneLenclud@8: StephaneLenclud@8: StephaneLenclud@8: StephaneLenclud@8: void CDisplayTestDlg::OnBnClickedButtonLcdSendText() StephaneLenclud@8: { StephaneLenclud@8: UpdateData(TRUE); StephaneLenclud@8: IMON_Display_SetLcdText((LPCTSTR)m_strLine3); StephaneLenclud@8: } StephaneLenclud@8: StephaneLenclud@8: void CDisplayTestDlg::OnBnClickedButtonLcdRandomEq() StephaneLenclud@8: { StephaneLenclud@8: if(m_uEqTimer2) StephaneLenclud@8: { StephaneLenclud@8: KillTimer(102); m_uEqTimer2 = 0; StephaneLenclud@8: GetDlgItem(IDC_BUTTON5)->SetWindowText(_T("Start Random EQ")); StephaneLenclud@8: } StephaneLenclud@8: else StephaneLenclud@8: { StephaneLenclud@8: m_uEqTimer2 = SetTimer(102, 40, NULL); StephaneLenclud@8: GetDlgItem(IDC_BUTTON5)->SetWindowText(_T("Stop Random EQ")); StephaneLenclud@8: } StephaneLenclud@8: } StephaneLenclud@8: StephaneLenclud@8: void CDisplayTestDlg::OnLcdOrangeIcon() StephaneLenclud@8: { StephaneLenclud@8: BYTE data[2]; StephaneLenclud@8: memset(data, 0, sizeof(BYTE)*2); StephaneLenclud@8: StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_ORANGE1))->GetCheck()) data[0] |= 0x80; StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_ORANGE2))->GetCheck()) data[0] |= 0x40; StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_ORANGE3))->GetCheck()) data[0] |= 0x20; StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_ORANGE4))->GetCheck()) data[0] |= 0x10; StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_ORANGE5))->GetCheck()) data[0] |= 0x08; StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_ORANGE6))->GetCheck()) data[0] |= 0x04; StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_ORANGE7))->GetCheck()) data[0] |= 0x02; StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_ORANGE8))->GetCheck()) data[0] |= 0x01; StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_ORANGE0))->GetCheck()) data[1] |= 0x80; StephaneLenclud@8: StephaneLenclud@8: IMON_Display_SetLcdOrangeIcon(data[0], data[1]); StephaneLenclud@8: } StephaneLenclud@8: StephaneLenclud@8: void CDisplayTestDlg::OnLcdMediaTypeIcon() StephaneLenclud@8: { StephaneLenclud@8: BYTE data = 0; StephaneLenclud@8: StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_MUSIC))->GetCheck()) data |= 0x80; StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_MOVIE))->GetCheck()) data |= 0x40; StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_PHOTO))->GetCheck()) data |= 0x20; StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_CD))->GetCheck()) data |= 0x10; StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_TV))->GetCheck()) data |= 0x08; StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_WEBCASTING))->GetCheck()) data |= 0x04; StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_NEWS))->GetCheck()) data |= 0x02; StephaneLenclud@8: StephaneLenclud@8: IMON_Display_SetLcdMediaTypeIcon(data); StephaneLenclud@8: } StephaneLenclud@8: StephaneLenclud@8: void CDisplayTestDlg::OnLcdSpeakerIcon() StephaneLenclud@8: { StephaneLenclud@8: BYTE data[2]; StephaneLenclud@8: memset(data, 0, sizeof(BYTE)*2); StephaneLenclud@8: StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_SPK_L))->GetCheck()) data[0] |= 0x80; StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_SPK_C))->GetCheck()) data[0] |= 0x40; StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_SPK_R))->GetCheck()) data[0] |= 0x20; StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_SPK_SL))->GetCheck()) data[0] |= 0x10; StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_SPK_LFE))->GetCheck()) data[0] |= 0x08; StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_SPK_SR))->GetCheck()) data[0] |= 0x04; StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_SPK_RL))->GetCheck()) data[0] |= 0x02; StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_SPK_SPDIF))->GetCheck()) data[0] |= 0x01; StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_SPK_RR))->GetCheck()) data[1] |= 0x80; StephaneLenclud@8: StephaneLenclud@8: IMON_Display_SetLcdSpeakerIcon(data[0], data[1]); StephaneLenclud@8: } StephaneLenclud@8: StephaneLenclud@8: void CDisplayTestDlg::OnLcdVideoCodecIcon() StephaneLenclud@8: { StephaneLenclud@8: BYTE data = 0; StephaneLenclud@8: StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_AV_MPG))->GetCheck()) data |= 0x80; StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_AV_DIVX))->GetCheck()) data |= 0x40; StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_AV_XVID))->GetCheck()) data |= 0x20; StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_AV_WMV))->GetCheck()) data |= 0x10; StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_AV_MPA))->GetCheck()) data |= 0x08; StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_AV_AC3))->GetCheck()) data |= 0x04; StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_AV_DTS))->GetCheck()) data |= 0x02; StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_AV_WMA))->GetCheck()) data |= 0x01; StephaneLenclud@8: StephaneLenclud@8: IMON_Display_SetLcdVideoCodecIcon(data); StephaneLenclud@8: } StephaneLenclud@8: StephaneLenclud@8: void CDisplayTestDlg::OnLcdAudioCodecIcon() StephaneLenclud@8: { StephaneLenclud@8: BYTE data = 0; StephaneLenclud@8: StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_A_MP3))->GetCheck()) data |= 0x80; StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_A_OGG))->GetCheck()) data |= 0x40; StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_A_WMA))->GetCheck()) data |= 0x20; StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_A_WAV))->GetCheck()) data |= 0x10; StephaneLenclud@8: StephaneLenclud@8: IMON_Display_SetLcdAudioCodecIcon(data); StephaneLenclud@8: } StephaneLenclud@8: StephaneLenclud@8: void CDisplayTestDlg::OnLcdAspectRatioIcon() StephaneLenclud@8: { StephaneLenclud@8: BYTE data = 0; StephaneLenclud@8: StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_AR_SRC))->GetCheck()) data |= 0x80; StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_AR_FIT))->GetCheck()) data |= 0x40; StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_AR_TV))->GetCheck()) data |= 0x20; StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_AR_HDTV))->GetCheck()) data |= 0x10; StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_AR_SCR1))->GetCheck()) data |= 0x08; StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_AR_SCR2))->GetCheck()) data |= 0x04; StephaneLenclud@8: StephaneLenclud@8: IMON_Display_SetLcdAspectRatioIcon(data); StephaneLenclud@8: } StephaneLenclud@8: StephaneLenclud@8: void CDisplayTestDlg::OnLcdEtcIcon() StephaneLenclud@8: { StephaneLenclud@8: BYTE data = 0; StephaneLenclud@8: StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_REPEAT))->GetCheck()) data |= 0x80; StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_SHUFFLE))->GetCheck()) data |= 0x40; StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_ALARM))->GetCheck()) data |= 0x20; StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_REC))->GetCheck()) data |= 0x10; StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_VOL))->GetCheck()) data |= 0x08; StephaneLenclud@8: if(((CButton*)GetDlgItem(IDC_TIME))->GetCheck()) data |= 0x04; StephaneLenclud@8: StephaneLenclud@8: IMON_Display_SetLcdEtcIcon(data); StephaneLenclud@8: } StephaneLenclud@8: StephaneLenclud@8: void CDisplayTestDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) StephaneLenclud@8: { StephaneLenclud@8: CSliderCtrl* pSliderCtrl = (CSliderCtrl*)GetDlgItem(IDC_SLIDER1); StephaneLenclud@8: if( pSliderCtrl && pSliderCtrl->GetSafeHwnd() && StephaneLenclud@8: pScrollBar && pScrollBar->GetSafeHwnd() == pSliderCtrl->GetSafeHwnd() ) StephaneLenclud@8: { StephaneLenclud@8: IMON_Display_SetLcdProgress(pSliderCtrl->GetPos(), 100); StephaneLenclud@8: } StephaneLenclud@8: CDialog::OnHScroll(nSBCode, nPos, pScrollBar); StephaneLenclud@8: } StephaneLenclud@8: StephaneLenclud@8: LRESULT CDisplayTestDlg::OnDisplayPluginNotify(WPARAM wParam, LPARAM lParam) StephaneLenclud@8: { StephaneLenclud@8: if(!GetSafeHwnd() || !IsWindow(GetSafeHwnd())) return 0; StephaneLenclud@8: StephaneLenclud@8: switch(wParam) StephaneLenclud@8: { StephaneLenclud@8: case DSPNM_PLUGIN_SUCCEED: StephaneLenclud@8: case DSPNM_IMON_RESTARTED: StephaneLenclud@8: case DSPNM_HW_CONNECTED: StephaneLenclud@8: { StephaneLenclud@8: GetDlgItem(IDC_BUTTON1)->EnableWindow(TRUE); StephaneLenclud@8: m_bVfdConnected = FALSE; StephaneLenclud@8: m_bLcdConnected = FALSE; StephaneLenclud@8: if((lParam & DSPN_DSP_VFD) == DSPN_DSP_VFD) m_bVfdConnected = TRUE; StephaneLenclud@8: if((lParam & DSPN_DSP_LCD) == DSPN_DSP_LCD) m_bLcdConnected = TRUE; StephaneLenclud@8: UpdateControlUI(); StephaneLenclud@8: StephaneLenclud@8: DisplayPluginMessage(wParam, FALSE); StephaneLenclud@8: } StephaneLenclud@8: break; StephaneLenclud@8: StephaneLenclud@8: case DSPNM_PLUGIN_FAILED: StephaneLenclud@8: case DSPNM_HW_DISCONNECTED: StephaneLenclud@8: case DSPNM_IMON_CLOSED: StephaneLenclud@8: { StephaneLenclud@8: GetDlgItem(IDC_BUTTON1)->EnableWindow(TRUE); StephaneLenclud@8: m_bVfdConnected = FALSE; StephaneLenclud@8: m_bLcdConnected = FALSE; StephaneLenclud@8: UpdateControlUI(); StephaneLenclud@8: StephaneLenclud@8: DisplayPluginMessage(lParam, TRUE); StephaneLenclud@8: } StephaneLenclud@8: break; StephaneLenclud@8: StephaneLenclud@8: case DSPNM_LCD_TEXT_SCROLL_DONE: StephaneLenclud@8: { StephaneLenclud@8: TRACE(_T("LCD Text Scroll Finished.\n")); StephaneLenclud@8: } StephaneLenclud@8: break; StephaneLenclud@8: } StephaneLenclud@8: return 0; StephaneLenclud@8: } StephaneLenclud@8: StephaneLenclud@8: void CDisplayTestDlg::Init() StephaneLenclud@8: { StephaneLenclud@8: Uninit(); StephaneLenclud@8: StephaneLenclud@8: IMON_Display_Init(this->GetSafeHwnd(), WM_DSP_PLUGIN_NOTIFY); StephaneLenclud@8: GetDlgItem(IDC_BUTTON1)->EnableWindow(FALSE); StephaneLenclud@8: } StephaneLenclud@8: StephaneLenclud@8: void CDisplayTestDlg::Uninit() StephaneLenclud@8: { StephaneLenclud@8: IMON_Display_Uninit(); StephaneLenclud@8: StephaneLenclud@8: m_bVfdConnected = FALSE; StephaneLenclud@8: m_bLcdConnected = FALSE; StephaneLenclud@8: StephaneLenclud@8: for(int i=IDC_ORANGE1;i<=IDC_AR_SCR2;i++) StephaneLenclud@8: { StephaneLenclud@8: if(GetDlgItem(i)) StephaneLenclud@8: ((CButton*)GetDlgItem(i))->SetCheck(FALSE); StephaneLenclud@8: } StephaneLenclud@8: CSliderCtrl* pSliderCtrl = (CSliderCtrl*)GetDlgItem(IDC_SLIDER1); StephaneLenclud@8: if(pSliderCtrl) pSliderCtrl->SetPos(0); StephaneLenclud@8: StephaneLenclud@8: UpdateControlUI(); StephaneLenclud@8: } StephaneLenclud@8: StephaneLenclud@8: void CDisplayTestDlg::DisplayPluginMessage(UINT uErrCode, BOOL bError) StephaneLenclud@8: { StephaneLenclud@8: CString strErrMsg = _T(""); StephaneLenclud@8: StephaneLenclud@8: if(bError) StephaneLenclud@8: { StephaneLenclud@8: switch(uErrCode) StephaneLenclud@8: { StephaneLenclud@8: case DSPN_ERR_IN_USED: strErrMsg = _T("Display Plug-in is Already Used by Other Application."); break; StephaneLenclud@8: case DSPN_ERR_HW_DISCONNECTED: strErrMsg = _T("iMON HW is Not Connected."); break; StephaneLenclud@8: case DSPN_ERR_NOT_SUPPORTED_HW: strErrMsg = _T("The Connected iMON HW doesn't Support Display Plug-in."); break; StephaneLenclud@8: case DSPN_ERR_PLUGIN_DISABLED: strErrMsg = _T("Display Plug-in Mode Option is Disabled."); break; StephaneLenclud@8: case DSPN_ERR_IMON_NO_REPLY: strErrMsg = _T("The Latest iMON is Not Installed or iMON Not Running."); break; StephaneLenclud@8: case DSPN_ERR_UNKNOWN: strErrMsg = _T("Unknown Failure."); break; StephaneLenclud@8: } StephaneLenclud@8: } StephaneLenclud@8: else StephaneLenclud@8: { StephaneLenclud@8: switch(uErrCode) StephaneLenclud@8: { StephaneLenclud@8: case DSPNM_PLUGIN_SUCCEED: strErrMsg = _T("Plug-in Mode Inited Successfully."); break; StephaneLenclud@8: case DSPNM_IMON_RESTARTED: strErrMsg = _T("iMON Started and Plug-in Mode Inited."); break; StephaneLenclud@8: case DSPNM_HW_CONNECTED: strErrMsg = _T("iMON HW Connected and Plug-in Mode Inited."); break; StephaneLenclud@8: } StephaneLenclud@8: } StephaneLenclud@8: GetDlgItem(IDC_STATIC_INFO)->SetWindowText((LPCTSTR)strErrMsg); StephaneLenclud@8: } StephaneLenclud@8: StephaneLenclud@8: void CDisplayTestDlg::UpdateControlUI() StephaneLenclud@8: { StephaneLenclud@8: GetDlgItem(IDC_STATIC_INFO)->SetWindowText(_T("")); StephaneLenclud@8: StephaneLenclud@8: if(IMON_Display_IsInited() != DSP_S_INITED) GetDlgItem(IDC_BUTTON1)->SetWindowText(_T("Init Plug-in")); StephaneLenclud@8: else GetDlgItem(IDC_BUTTON1)->SetWindowText(_T("Uninit Plug-in")); StephaneLenclud@8: StephaneLenclud@8: for(int i=IDC_EDIT1;i<=IDC_BUTTON3;i++) StephaneLenclud@8: { StephaneLenclud@8: if(GetDlgItem(i)) StephaneLenclud@8: GetDlgItem(i)->EnableWindow(m_bVfdConnected); StephaneLenclud@8: } StephaneLenclud@8: for(int i=IDC_BUTTON6;i<=IDC_BUTTON8;i++) StephaneLenclud@8: { StephaneLenclud@8: if(GetDlgItem(i)) StephaneLenclud@8: GetDlgItem(i)->EnableWindow(m_bVfdConnected); StephaneLenclud@8: } StephaneLenclud@8: for(int i=IDC_EDIT3;i<=IDC_SLIDER1;i++) StephaneLenclud@8: { StephaneLenclud@8: if(GetDlgItem(i)) StephaneLenclud@8: GetDlgItem(i)->EnableWindow(m_bLcdConnected); StephaneLenclud@8: } StephaneLenclud@8: } StephaneLenclud@8: StephaneLenclud@8: StephaneLenclud@8: