2026-10-04 00:04:20 +08:00
|
|
|
|
// SpaceNameDlg.cpp : implementation file
|
2026-09-28 15:28:50 +08:00
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
#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
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// lgh modify 101119,spacenam.txt文件格式进行了调整,使用新的机制,原先的代码无法使用
|
2026-09-28 15:28:50 +08:00
|
|
|
|
/*
|
|
|
|
|
|
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);
|
2026-10-04 00:04:20 +08:00
|
|
|
|
sMsg << _T("不能写文件'") << sFile << _T("'");
|
|
|
|
|
|
MessageBox(sMsg, _T("提示"), IDOK);
|
2026-09-28 15:28:50 +08:00
|
|
|
|
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;
|
|
|
|
|
|
}
|