📄 editer.cpp
字号:
// Editer.cpp : implementation file
//
#include "stdafx.h"
#include "CDPlayer.h"
#include "Editer.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CEditer dialog
CEditer::CEditer(CWnd* pParent /*=NULL*/)
: CDialog(CEditer::IDD, pParent)
{
//{{AFX_DATA_INIT(CEditer)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CEditer::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CEditer)
DDX_Control(pDX, IDC_LIST2, m_List2);
DDX_Control(pDX, IDC_LIST1, m_List1);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CEditer, CDialog)
//{{AFX_MSG_MAP(CEditer)
ON_BN_CLICKED(IDC_ADD, OnAdd)
ON_BN_CLICKED(IDC_ADD_ALL, OnAddAll)
ON_BN_CLICKED(IDC_DELETE, OnDelete)
ON_BN_CLICKED(IDC_DELETE_ALL, OnDeleteAll)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CEditer message handlers
void CEditer::OnAdd()
{
// TODO: Add your control notification handler code here
int Index = m_List1.GetCurSel();
if(Index != LB_ERR)
{
CString str;
m_List1.GetText(Index, str);
if(m_List2.FindString(-1, str) == LB_ERR)
{
m_List2.AddString(str);
m_PlayList.Add(Index + 1);
}
}
}
void CEditer::OnAddAll()
{
// TODO: Add your control notification handler code here
if(m_List2.GetCount() != m_TotalNum)
{
m_List2.ResetContent();
m_PlayList.RemoveAll();
for(int i = 0; i < m_TotalNum; i++)
{
CString str;
str.Format("曲目 %d", i+1);
m_List2.AddString(str);
m_PlayList.Add(i + 1);
}
}
}
void CEditer::OnDelete()
{
// TODO: Add your control notification handler code here
int Index = m_List2.GetCurSel();
if(Index != LB_ERR)
{
if(m_List2.DeleteString(Index) != LB_ERR)
m_PlayList.RemoveAt(Index);
}
}
void CEditer::OnDeleteAll()
{
// TODO: Add your control notification handler code here
m_PlayList.RemoveAll();
m_List2.ResetContent();
}
BOOL CEditer::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
for(int i = 0; i < m_TotalNum; i++)
{
CString str;
m_PlayList.Add(i + 1);
str.Format("曲目 %d", i + 1);
m_List1.AddString(str);
m_List2.AddString(str);
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -