📄 setdlg.cpp
字号:
// SetDlg.cpp : implementation file
//
#include "stdafx.h"
#include "CodeManager.h"
#include "SetDlg.h"
#include "MainFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSetDlg dialog
CSetDlg::CSetDlg(CWnd* pParent /*=NULL*/)
: CDialog(CSetDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CSetDlg)
m_bSystemIcon = FALSE;
m_chClose = FALSE;
m_chMini = FALSE;
m_stSysfile = _T("");
m_etOwnfile = _T("");
m_bLeftStyle = FALSE;
//}}AFX_DATA_INIT
}
void CSetDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSetDlg)
DDX_Control(pDX, IDC_SETLIST, m_ctrlSetList);
DDX_Control(pDX, IDC_CHCLOSE, m_ctrlClose);
DDX_Control(pDX, IDC_CHMINI, m_ctrlMini);
DDX_Check(pDX, IDC_SYSTEMICON, m_bSystemIcon);
DDX_Check(pDX, IDC_CHCLOSE, m_chClose);
DDX_Check(pDX, IDC_CHMINI, m_chMini);
DDX_Text(pDX, IDC_SYSFILE, m_stSysfile);
DDX_Text(pDX, IDC_OWNFILE, m_etOwnfile);
DDX_Check(pDX, IDC_DATASTYLE, m_bLeftStyle);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSetDlg, CDialog)
//{{AFX_MSG_MAP(CSetDlg)
ON_BN_CLICKED(IDC_SYSTEMICON, OnSystemicon)
ON_WM_SHOWWINDOW()
ON_BN_CLICKED(IDC_DATASTYLE, OnDatastyle)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSetDlg message handlers
void CSetDlg::OnSystemicon()
{
// TODO: Add your control notification handler code here
HICON hIcon = AfxGetApp()->LoadIcon(IDI_ICON1);
CMainFrame *pFrame = (CMainFrame*)AfxGetApp()->GetMainWnd();
m_bSystemIcon = !m_bSystemIcon;
if(m_bSystemIcon)
{
pFrame->m_tIcon.ShowIcon();
m_ctrlClose.EnableWindow();
m_ctrlMini.EnableWindow();
}
else
{
pFrame->m_tIcon.HideIcon();
m_ctrlClose.EnableWindow(FALSE);
m_ctrlMini.EnableWindow(FALSE);
}
UpdateData(FALSE);
pFrame->m_bIcon = m_bSystemIcon;
}
BOOL CSetDlg::OnInitDialog()
{
CDialog::OnInitDialog();
m_ctrlSetList.AddString("常规");
m_bSystemIcon = FALSE;
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CSetDlg::OnOK()
{
// TODO: Add extra validation here
UpdateData();
CMainFrame *pFrame = (CMainFrame*)AfxGetApp()->GetMainWnd();
pFrame->m_bClose = m_chClose;
pFrame->m_bMini = m_chMini;
// pFrame->m_bStyle = m_bLeftStyle;
//对文件过滤的处理
m_etOwnfile.TrimLeft();
m_etOwnfile.TrimRight();
if(!m_etOwnfile.IsEmpty())
{
CString str = m_etOwnfile;
int num = 0, i, j = 0, k = 9;
for(i = 0; i < m_etOwnfile.GetLength(); i++)
if(m_etOwnfile.GetAt(i) == ';')
num++;
if(m_etOwnfile.GetAt(m_etOwnfile.GetLength() - 1) != ';')
num++;
pFrame->NewFileExp = new CString[9 + num];
for(i = 0; i < 9; i++)
pFrame->NewFileExp[i] = FileExp[i];
for(i = 0; i < m_etOwnfile.GetLength(); i++)
{
if(m_etOwnfile.GetAt(i) == ' ')
continue;
if(m_etOwnfile.GetAt(i) == ';')
{
str.SetAt(j, '\0');
if(str.GetLength() != 0)
{
pFrame->NewFileExp[k] = str;
k++;
j = 0;
}
continue;
}
str.SetAt(j, m_etOwnfile.GetAt(i));
j++;
}
if(m_etOwnfile.GetAt(m_etOwnfile.GetLength() - 1) != ';')
{
str.SetAt(j, '\0');
pFrame->NewFileExp[k] = str;
}
pFrame->m_nFileNum = 9 + num;
}
else
pFrame->m_nFileNum = 9;
CDialog::OnOK();
}
void CSetDlg::OnShowWindow(BOOL bShow, UINT nStatus)
{
CDialog::OnShowWindow(bShow, nStatus);
CMainFrame *pFrame = (CMainFrame*)AfxGetApp()->GetMainWnd();
m_bSystemIcon = pFrame->m_bIcon;
m_chClose = pFrame->m_bClose;
m_chMini = pFrame->m_bMini;
m_bLeftStyle = pFrame->m_bStyle;
m_stSysfile += "(";
int i;
for(i = 0; i < 9; i++)
{
m_stSysfile += FileExp[i];
if(i != 8)
m_stSysfile += ";";
}
m_stSysfile += ")";
// m_etOwnfile.Empty();
if(pFrame->m_nFileNum > 9)
{
char *p, *t;
p = new char[pFrame->NewFileExp[9].GetLength()];
strcpy(p, pFrame->NewFileExp[9].GetBuffer(pFrame->NewFileExp[9].GetLength()));
strcat(p, ";");
for(i = 10; i < pFrame->m_nFileNum; i++)
{
t = pFrame->NewFileExp[i].GetBuffer(pFrame->NewFileExp[i].GetLength());
strcat(p, t);
strcat(p, ";");
}
m_etOwnfile = p;
delete []p;
}
UpdateData(FALSE);
}
void CSetDlg::OnDatastyle()
{
CMainFrame *pFrame = (CMainFrame*)AfxGetApp()->GetMainWnd();
m_bLeftStyle = !m_bLeftStyle;
if(m_bLeftStyle)
{
pFrame->m_TabCtrl.SetStyle(TCS_UP);
pFrame->m_TabCtrl.UpdateWindow();
}
else
{
pFrame->m_TabCtrl.SetStyle(TCS_DOWN);
pFrame->m_TabCtrl.UpdateWindow();
}
UpdateData(FALSE);
pFrame->m_bStyle = m_bLeftStyle;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -