Files
gjm 164968b62e chore
把非utf8-bom编码的cpp/h文件改为 utf8 bom 编码, msvc识别utf8编码时,如果不是bom格式的,会使用当前cp_oem来解码.
2026-10-04 00:04:20 +08:00

123 lines
2.7 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// SpaceNameDlg.cpp : implementation file
//
#include "stdafx.h"
#include "resource.h"
#include "SpaceNameDlg.h"
#include "SpaceNameClassDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
BOOL GetSpaceNames(XStringList &lstSpaceNames);
/////////////////////////////////////////////////////////////////////////////
// CSpaceNameDlg dialog
static const TCHAR *sMsgPrompt[]={
#include "SpaceNameDlg.hpp"
};
CSpaceNameDlg::CSpaceNameDlg(CWnd* pParent /*=NULL*/)
: GlwCAcUiDialog(CSpaceNameDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CSpaceNameDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CSpaceNameDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSpaceNameDlg)
DDX_Control(pDX, IDC_SPACENAME_LIST, m_spaceNameList);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSpaceNameDlg, GlwCAcUiDialog)
//{{AFX_MSG_MAP(CSpaceNameDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSpaceNameDlg message handlers
BOOL CSpaceNameDlg::OnInitDialog()
{
CDialog::OnInitDialog();
XStringList lstNames;
GetSpaceNames(lstNames);
XString str(65535);
for(int i=0; i<lstNames.Length(); i++)
str << lstNames[i] << _T("\r\n");
m_spaceNameList.SetWindowText(str);
//SetSel(0,0);
//m_spaceNameList.ReplaceSel(str);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
// lgh modify 101119,spacenam.txt文件格式进行了调整,使用新的机制,原先的代码无法使用
/*
void CSpaceNameDlg::OnOK()
{
XString sFile(256);
if (!FindFile(_T("spacenam.txt"), sFile)) {
return;
//sFile << g_sAppPath << _T("spacenam.txt");
}
CString csText;
m_spaceNameList.GetWindowText(csText);
#if (ADS>15)
std::
#endif
ofstream out(sFile);
if (!out) {
XString sMsg(256);
sMsg << _T("不能写文件'") << sFile << _T("'");
MessageBox(sMsg, _T("提示"), IDOK);
return;
} else {
out << (const char *)_AS(csText);
}
CDialog::OnOK();
}
*/
void CSpaceNameDlg::OnOK()
{
XString sFile(256);
if (FindFile(_T("spacenam.txt"), sFile))
{
CSpaceFileOperator *pFileBase = new CSpaceFileOperator(sFile);
CSpaceDataTable newDataTable, oldDataTable;
if (pFileBase->ReadFile(oldDataTable))
{
CString sText;
m_spaceNameList.GetWindowText(sText);
CStringArray aryName;
pFileBase->SplitString(sText, aryName);
for (int i = 0; i < aryName.GetSize(); i++)
{
newDataTable.AddName(oldDataTable.GetNameType(aryName[i]), aryName[i]);
}
pFileBase->WriteFile(newDataTable);
}
delete pFileBase;
pFileBase = NULL;
}
CDialog::OnOK();
return;
}