📄 settingdlg.cpp
字号:
// SettingDlg.cpp : implementation file
//
#include "stdafx.h"
#include "resourceeditor.h"
#include "SettingDlg.h"
#include "FileDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSettingDlg dialog
CSettingDlg::CSettingDlg(CWnd* pParent /*=NULL*/)
: CDialog(CSettingDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CSettingDlg)
m_strAnimFile = _T("mmi_anim.h");
m_strFontFile = _T("mmi_font.h");
m_strImgFile = _T("mmi_image.h");
m_strRingFile = _T("mmi_ring.h");
m_strTextFile = _T("mmi_text.h");
//}}AFX_DATA_INIT
}
void CSettingDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSettingDlg)
DDX_Text(pDX, IDC_EDT_ANIM, m_strAnimFile);
DDX_Text(pDX, IDC_EDT_FONT, m_strFontFile);
DDX_Text(pDX, IDC_EDT_IMG, m_strImgFile);
DDX_Text(pDX, IDC_EDT_RING, m_strRingFile);
DDX_Text(pDX, IDC_EDT_TEXT, m_strTextFile);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSettingDlg, CDialog)
//{{AFX_MSG_MAP(CSettingDlg)
ON_BN_CLICKED(IDC_BTN_BROWSE_IMG, OnBtnBrowseImg)
ON_BN_CLICKED(IDC_BTN_BROWSE_ANIM, OnBtnBrowseAnim)
ON_BN_CLICKED(IDC_BTN_BROWSE_RING, OnBtnBrowseRing)
ON_BN_CLICKED(IDC_BTN_BROWSE_TEXT, OnBtnBrowseText)
ON_BN_CLICKED(IDC_BTN_BROWSE_FONT, OnBtnBrowseFont)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSettingDlg message handlers
BOOL CSettingDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
if( !g_theApp.IsSuperUser() )
{
CWnd * pWnd = GetDlgItem(IDC_EDT_IMG);
pWnd->EnableWindow(FALSE);
pWnd = GetDlgItem(IDC_BTN_BROWSE_IMG);
pWnd->EnableWindow(FALSE);
pWnd = GetDlgItem(IDC_EDT_ANIM);
pWnd->EnableWindow(FALSE);
pWnd = GetDlgItem(IDC_BTN_BROWSE_ANIM);
pWnd->EnableWindow(FALSE);
pWnd = GetDlgItem(IDC_EDT_RING);
pWnd->EnableWindow(FALSE);
pWnd = GetDlgItem(IDC_BTN_BROWSE_RING);
pWnd->EnableWindow(FALSE);
pWnd = GetDlgItem(IDC_EDT_TEXT);
pWnd->EnableWindow(FALSE);
pWnd = GetDlgItem(IDC_BTN_BROWSE_TEXT);
pWnd->EnableWindow(FALSE);
pWnd = GetDlgItem(IDC_EDT_FONT);
pWnd->EnableWindow(FALSE);
pWnd = GetDlgItem(IDC_BTN_BROWSE_FONT);
pWnd->EnableWindow(FALSE);
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CSettingDlg::OnOK()
{
// TODO: Add extra validation here
UpdateData();
if( m_strImgFile.IsEmpty() || m_strAnimFile.IsEmpty() ||
m_strRingFile.IsEmpty() || m_strTextFile.IsEmpty() ||
m_strFontFile.IsEmpty() )
{
//alexye 允许file name 为空,有的模块可能不存在某些资源
//AfxMessageBox(_T("File's name isn't empty!"));
//return;
}
CDialog::OnOK();
}
void CSettingDlg::OnBtnBrowseImg()
{
// TODO: Add your control notification handler code here
CFileDlg dlg(FALSE);
dlg.SetFileExt(_T(".h"));
dlg.SetFileFilter(_T("c header files (*.h)|*.h|All Files (*.*)|*.*||"));
CString strFile = dlg.GetPathName();
if( !strFile.IsEmpty() )
{
m_strImgFile = strFile;
UpdateData(FALSE);
}
}
void CSettingDlg::OnBtnBrowseAnim()
{
// TODO: Add your control notification handler code here
CFileDlg dlg(FALSE);
dlg.SetFileExt(_T(".h"));
dlg.SetFileFilter(_T("c header files (*.h)|*.h|All Files (*.*)|*.*||"));
CString strFile = dlg.GetPathName();
if( !strFile.IsEmpty() )
{
m_strAnimFile = strFile;
UpdateData(FALSE);
}
}
void CSettingDlg::OnBtnBrowseRing()
{
// TODO: Add your control notification handler code here
CFileDlg dlg(FALSE);
dlg.SetFileExt(_T(".h"));
dlg.SetFileFilter(_T("c header files (*.h)|*.h|All Files (*.*)|*.*||"));
CString strFile = dlg.GetPathName();
if( !strFile.IsEmpty() )
{
m_strRingFile = strFile;
UpdateData(FALSE);
}
}
void CSettingDlg::OnBtnBrowseText()
{
// TODO: Add your control notification handler code here
CFileDlg dlg(FALSE);
dlg.SetFileExt(_T(".h"));
dlg.SetFileFilter(_T("c header files (*.h)|*.h|All Files (*.*)|*.*||"));
CString strFile = dlg.GetPathName();
if( !strFile.IsEmpty() )
{
m_strTextFile = strFile;
UpdateData(FALSE);
}
}
void CSettingDlg::OnBtnBrowseFont()
{
// TODO: Add your control notification handler code here
CFileDlg dlg(FALSE);
dlg.SetFileExt(_T(".h"));
dlg.SetFileFilter(_T("c header files (*.h)|*.h|All Files (*.*)|*.*||"));
CString strFile = dlg.GetPathName();
if( !strFile.IsEmpty() )
{
m_strFontFile = strFile;
UpdateData(FALSE);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -