// MusicInfoDlg.cpp : implementation file // #include "stdafx.h" #include "MusicInfoDlg.h" #include // CMusicInfoDlg dialog IMPLEMENT_DYNAMIC(CMusicInfoDlg, CDialog) CMusicInfoDlg::CMusicInfoDlg(CWnd* pParent /*=NULL*/) : CDialog(CMusicInfoDlg::IDD, pParent) { } CMusicInfoDlg::~CMusicInfoDlg() { DestroyWindow(); } void CMusicInfoDlg::Resize() { CRect rcClient; GetClientRect(rcClient); if (m_wndPlayingFrame.GetSafeHwnd()) m_wndPlayingFrame.SetWindowPos(NULL, 0, 0, rcClient.Width()-(m_rcClient.Width()-m_rcPlayingFrame.Width()), rcClient.Height()-(m_rcClient.Height()-m_rcPlayingFrame.Height()), SWP_NOZORDER | SWP_NOMOVE); if (m_wndPlaying.GetSafeHwnd()) { m_wndPlaying.SetWindowPos(NULL, 0, 0, rcClient.Width()-(m_rcClient.Width()-m_rcPlaying.Width()), rcClient.Height()-(m_rcClient.Height()-m_rcPlaying.Height()), SWP_NOZORDER | SWP_NOMOVE); // Delete all of the columns. int nColumnCount=m_wndPlaying.GetHeaderCtrl()->GetItemCount(); for (int i=0;iGetSystem()->GetIMusicSystem(); if (pMusicSystem && IsWindowVisible()) { SMusicSystemStatus *pStatus=pMusicSystem->GetStatus(); if (pStatus) { m_wndPlaying.DeleteAllItems(); if (pStatus->bPlaying) m_wndStreaming.SetWindowText("Yes"); else m_wndStreaming.SetWindowText("No"); m_wndTheme.SetWindowText(pStatus->sTheme.c_str()); m_wndMood.SetWindowText(pStatus->sMood.c_str()); LVITEM ItemInfo; ItemInfo.mask=LVIF_TEXT | LVIF_STATE; ItemInfo.state=0; ItemInfo.stateMask=0xffffffff; ItemInfo.iImage=0; for (TPatternStatusVecIt It=pStatus->m_vecPlayingPatterns.begin();It!=pStatus->m_vecPlayingPatterns.end();++It) { SPlayingPatternsStatus &PatternStatus=(*It); char sText[16]; ItemInfo.iItem=m_wndPlaying.GetItemCount(); ItemInfo.iSubItem=0; switch (PatternStatus.nLayer) { case MUSICLAYER_MAIN: strcpy(sText, "Main"); break; case MUSICLAYER_RHYTHMIC: strcpy(sText, "Rhyt"); break; case MUSICLAYER_INCIDENTAL: strcpy(sText, "Inci"); break; default: strcpy(sText, "Unkn"); break; } ItemInfo.pszText=sText; int nItem=m_wndPlaying.InsertItem(&ItemInfo); m_wndPlaying.SetItemText(nItem, 1, PatternStatus.sName.c_str()); sprintf(sText, "%03d", PatternStatus.nVolume); m_wndPlaying.SetItemText(nItem, 2, sText); } } } } CDialog::OnTimer(nIDEvent); } void CMusicInfoDlg::OnSizing(UINT fwSide, LPRECT pRect) { CDialog::OnSizing(fwSide, pRect); Resize(); } void CMusicInfoDlg::OnSize(UINT nType, int cx, int cy) { CDialog::OnSize(nType, cx, cy); Resize(); }