1870 lines
44 KiB
C++
1870 lines
44 KiB
C++
// DictConfig.cpp : 实现文件
|
|
//
|
|
#include "stdafx.h"
|
|
#include "resource.h"
|
|
#include "TchInitSet1Dlg.h"
|
|
#include "TchInitSet2Dlg.h"
|
|
#include "XMLTreeFileDlg.h"
|
|
#include "ImportXMLDocDlg.h"
|
|
#include "TArchSettingEditTools.h"
|
|
#include "htmlhelp.h"
|
|
WDict g_dictCfg;
|
|
const TCHAR *c_szName = _T("name");
|
|
const TCHAR *c_szComment = _T("comment");
|
|
const TCHAR *c_szOptions = _T("options");
|
|
const TCHAR *c_szCatalog = _T("目录");
|
|
const TCHAR *c_szLemma = _T("选项");
|
|
const TCHAR *c_szTDWord = _T("上华词库");
|
|
#ifndef TARCH_SETTING_MSG_UPDATA
|
|
#define TARCH_SETTING_MSG_UPDATA WM_USER+102
|
|
#define TARCH_SETTING_MSG_BUTTONSTATION WM_USER+103
|
|
#endif
|
|
|
|
extern BOOL g_bCancel;
|
|
extern TARCH_IMPEXP BOOL g_bAutoLTScale; //是否自动设置线型比例
|
|
extern TARCH_IMPEXP double g_nLtPScale; //图纸空间自动线型
|
|
extern TARCH_IMPEXP double g_nLtMScale;//模型空间自动线型
|
|
|
|
/////////////////////////////////////////////////
|
|
// TDictRowData
|
|
class TDictRowData : public WRowData
|
|
{
|
|
public:
|
|
int nType;
|
|
DualList<CString > lstStr;
|
|
};
|
|
|
|
//////////////////////////////////////////////////
|
|
// TDictGrid
|
|
class CDictConfigChild;
|
|
class TDictGrid : public WDGrid
|
|
{
|
|
public:
|
|
TDictGrid();
|
|
void SetModified(bool bModified = false);
|
|
bool IsModified();
|
|
void DictToGrid(WDict *pDict);
|
|
void GridToDict(WDict *pDict);
|
|
virtual void OnCellComboString(WDGridCell&cell,CComboBox&combo);
|
|
virtual bool OnBeforeEdit(WDGridCell&cell,bool &bModified);
|
|
virtual bool OnModified(WDGridCell&cell,CString &text);
|
|
virtual bool OnBeforeInsertChild(WDGridTreeRow&row,long iChild,WDGridTreeRow*&pChild);//将插入一子行
|
|
virtual void OnInsertRow(WDGridRow&row);
|
|
|
|
// add by xly on 110408 截获鼠标滚轴
|
|
BOOL PreTranslateMessage(MSG* pMsg);
|
|
protected:
|
|
bool m_bModified;
|
|
int GetTypeIndex(CString szType);
|
|
void DictToTreeRow(WDict *pDict, WDGridTreeRow *pRow);
|
|
void DictToRow(WDict *pDict, WDGridTreeRow *pRow);
|
|
void TreeRowToDict(WDGridTreeRow &row, WDict *pDict);
|
|
void RowToDict(WDGridTreeRow &row, WDict *pDict);
|
|
};
|
|
|
|
TDictGrid::TDictGrid()
|
|
:WDGrid(true), m_bModified(false)
|
|
{
|
|
}
|
|
void TDictGrid::SetModified(bool bModified)
|
|
{
|
|
m_bModified = bModified;
|
|
}
|
|
|
|
bool TDictGrid::IsModified()
|
|
{
|
|
return m_bModified;
|
|
}
|
|
|
|
int TDictGrid::GetTypeIndex(CString szType)
|
|
{
|
|
if (szType == _T("布尔型"))
|
|
return TYPE_WBoolItem;
|
|
else if (szType == _T("字符型"))
|
|
return TYPE_WCharItem;
|
|
else if (szType == _T("整型"))
|
|
return TYPE_WLongItem;
|
|
else if (szType == _T("浮点型"))
|
|
return TYPE_WDoubleItem;
|
|
else if (szType == _T("字符串型"))
|
|
return TYPE_WCStringItem;
|
|
else if (szType == _T("选择型"))
|
|
return TYPE_WSelectItem;
|
|
else
|
|
return -1;
|
|
}
|
|
|
|
void TDictGrid::DictToTreeRow(WDict *pDict, WDGridTreeRow *pRow)
|
|
{
|
|
if (pDict == NULL || pRow == NULL)
|
|
return;
|
|
|
|
CString szName = pDict->m_sName;
|
|
CString szDesc = pDict->m_sDesc;
|
|
if (GetColNum() > 0)
|
|
(*pRow)[0].SetText(szName);
|
|
|
|
if (!IsModified())
|
|
{
|
|
if (GetColNum() > 2)
|
|
(*pRow)[2].SetText(szDesc);
|
|
}
|
|
else
|
|
{
|
|
if (GetColNum() > 3)
|
|
(*pRow)[3].SetText(szDesc);
|
|
}
|
|
|
|
if (pDict->GetDataNum() == 0)// 空集合
|
|
{
|
|
WDGridTreeRow *pNewRow = new WDGridTreeRow(pRow);
|
|
TDictRowData *pData = new TDictRowData;
|
|
pNewRow->SetExtendData(pData);
|
|
pRow->AppendChild(pNewRow);
|
|
}
|
|
for(pDict->MoveToFirst(); !pDict->IsOut(); pDict->MoveToNext())
|
|
{
|
|
WDict *pCurDict = (WDict*)pDict->GetCurData();
|
|
if (pCurDict == NULL)
|
|
continue;
|
|
|
|
WDGridTreeRow *pNewRow = new WDGridTreeRow(pRow);
|
|
TDictRowData *pData = new TDictRowData;
|
|
pData->nType = pCurDict->GetType();
|
|
pNewRow->SetExtendData(pData);
|
|
pRow->AppendChild(pNewRow);
|
|
if (pCurDict->GetType() == TYPE_WDict)
|
|
DictToTreeRow(pCurDict, pNewRow);
|
|
else
|
|
DictToRow(pCurDict, pNewRow);
|
|
}
|
|
}
|
|
|
|
void TDictGrid::DictToRow(WDict *pDict, WDGridTreeRow *pRow)
|
|
{
|
|
if (pDict == NULL || pRow == NULL)
|
|
return;
|
|
|
|
CString szName = pDict->m_sName;
|
|
int nType = pDict->GetType();
|
|
CString szValue, szType;
|
|
CString szDesc = pDict->m_sDesc;
|
|
if (szName == _T("文字距基线默认系数"))
|
|
{
|
|
int i = 100;
|
|
}
|
|
if (nType == TYPE_WBoolItem)
|
|
{
|
|
WBoolItem *pItem = (WBoolItem*)pDict;
|
|
szValue = (pItem->m_data) ? _T("是") : _T("否");
|
|
szType = _T("布尔型");
|
|
}
|
|
else if (nType == TYPE_WCharItem)
|
|
{
|
|
WCharItem *pItem = (WCharItem*)pDict;
|
|
szValue.Format(_T("%c"), pItem->m_data);
|
|
szType = _T("字符型");
|
|
}
|
|
else if (nType == TYPE_WLongItem)
|
|
{
|
|
WLongItem *pItem = (WLongItem*)pDict;
|
|
szValue.Format(_T("%d"), pItem->m_data);
|
|
szType = _T("整型");
|
|
}
|
|
else if (nType == TYPE_WDoubleItem)
|
|
{
|
|
WDoubleItem *pItem = (WDoubleItem*)pDict;
|
|
szValue.Format(_T("%lg"), pItem->m_data);
|
|
szType = _T("浮点型");
|
|
}
|
|
else if (nType == TYPE_WCStringItem)
|
|
{
|
|
WCStringItem *pItem = (WCStringItem*)pDict;
|
|
szValue = pItem->m_data;
|
|
szType = _T("字符串型");
|
|
}
|
|
else if (nType == TYPE_WSelectItem)
|
|
{
|
|
TDictRowData *pData = (TDictRowData *)pRow->GetExtendData();
|
|
if (pData == NULL)
|
|
{
|
|
pData = new TDictRowData;
|
|
pData->nType = TYPE_WSelectItem;
|
|
pRow->SetExtendData(pData);
|
|
}
|
|
pData->lstStr.Clear();
|
|
|
|
WSelectItem *pItem = (WSelectItem*)pDict;
|
|
szValue = pItem->GetSelString();
|
|
szType = _T("选择型");
|
|
for(pItem->MoveToFirst(); !pItem->IsOut(); pItem->MoveToNext())
|
|
{
|
|
CString szStr = pItem->GetCurData();
|
|
pData->lstStr.AddTail(szStr);
|
|
}
|
|
}
|
|
|
|
if (!IsModified())
|
|
{
|
|
if (GetColNum() > 2)
|
|
{
|
|
(*pRow)[0].SetText(szName);
|
|
(*pRow)[1].SetText(szValue);
|
|
(*pRow)[2].SetText(szDesc);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (GetColNum() > 3)
|
|
{
|
|
(*pRow)[0].SetText(szName);
|
|
(*pRow)[1].SetText(szValue);
|
|
(*pRow)[2].SetText(szType);
|
|
(*pRow)[3].SetText(szDesc);
|
|
}
|
|
}
|
|
}
|
|
|
|
void TDictGrid::DictToGrid(WDict *pDict)
|
|
{
|
|
if (pDict == NULL)
|
|
return;
|
|
|
|
for(pDict->MoveToFirst(); !pDict->IsOut(); pDict->MoveToNext())
|
|
{
|
|
WDict *pCurDict = (WDict*)pDict->GetCurData();
|
|
if (pCurDict == NULL)
|
|
continue;
|
|
|
|
WDGridTreeRow *pNewRow = new WDGridTreeRow(*this);
|
|
TDictRowData *pData = new TDictRowData;
|
|
pData->nType = pCurDict->GetType();
|
|
pNewRow->SetExtendData(pData);
|
|
AppendRow(pNewRow);
|
|
if (pCurDict->GetType() == TYPE_WDict)
|
|
DictToTreeRow(pCurDict, pNewRow);
|
|
else
|
|
DictToRow(pCurDict, pNewRow);
|
|
}
|
|
Arrange();
|
|
}
|
|
|
|
void TDictGrid::TreeRowToDict(WDGridTreeRow &row, WDict *pDict)
|
|
{
|
|
TDictRowData *pData = (TDictRowData*)row.GetExtendData();
|
|
if (pData == NULL)
|
|
return;
|
|
|
|
CString szName;
|
|
if (GetColNum() > 0)
|
|
szName = row[0].GetText();
|
|
if (szName == _T(""))
|
|
return;
|
|
|
|
CString szDesc;
|
|
if (!IsModified())
|
|
{
|
|
if (GetColNum() > 2)
|
|
szDesc = row[2].GetText();
|
|
}
|
|
else
|
|
{
|
|
if (GetColNum() > 3)
|
|
szDesc = row[3].GetText();
|
|
}
|
|
|
|
WDict *pNewDict = new WDict(szName, szDesc);
|
|
if (!pDict->AppendItem(pNewDict))
|
|
{
|
|
delete pNewDict;
|
|
return;
|
|
}
|
|
for(long i=0; i<row.GetChildNum(); i++)
|
|
{
|
|
WDGridTreeRow &rowChild = row.GetChild(i);
|
|
if (rowChild.IsParentRow())
|
|
TreeRowToDict(rowChild, pNewDict);
|
|
else
|
|
RowToDict(rowChild, pNewDict);
|
|
}
|
|
}
|
|
|
|
void TDictGrid::RowToDict(WDGridTreeRow &row, WDict *pDict)
|
|
{
|
|
TDictRowData *pData = (TDictRowData*)row.GetExtendData();
|
|
if (pData == NULL)
|
|
return;
|
|
|
|
CString szName = row[0].GetText();
|
|
if (szName == _T(""))
|
|
return;
|
|
|
|
if (szName == _T("文字距基线默认系数"))
|
|
{
|
|
int i = 100;
|
|
}
|
|
CString szValue = row[1].GetText();
|
|
CString szDesc;
|
|
if (!IsModified())
|
|
szDesc = row[2].GetText();
|
|
else
|
|
szDesc = row[3].GetText();
|
|
|
|
int nType = pData->nType;
|
|
if (nType == TYPE_WBoolItem)
|
|
{
|
|
WBoolItem *pItem = new WBoolItem;
|
|
pItem->m_sName = szName;
|
|
pItem->m_sDesc = szDesc;
|
|
pItem->m_data = (szValue == _T("是")) ? true : false;
|
|
if (!pDict->AppendItem(pItem))
|
|
delete pItem;
|
|
}
|
|
else if (nType == TYPE_WCharItem)
|
|
{
|
|
WCharItem *pItem = new WCharItem;
|
|
pItem->m_sName = szName;
|
|
pItem->m_sDesc = szDesc;
|
|
// 2010-3-15 16:46 wubo
|
|
// 移植Geo
|
|
// 错误:从wchar_t转换到char
|
|
pItem->m_data = szValue.GetAt(0);
|
|
if (!pDict->AppendItem(pItem))
|
|
delete pItem;
|
|
}
|
|
else if (nType == TYPE_WLongItem)
|
|
{
|
|
WLongItem *pItem = new WLongItem;
|
|
pItem->m_sName = szName;
|
|
pItem->m_sDesc = szDesc;
|
|
pItem->m_data = _ttoi(szValue);
|
|
if (!pDict->AppendItem(pItem))
|
|
delete pItem;
|
|
}
|
|
else if (nType == TYPE_WDoubleItem)
|
|
{
|
|
WDoubleItem *pItem = new WDoubleItem;
|
|
pItem->m_sName = szName;
|
|
pItem->m_sDesc = szDesc;
|
|
pItem->m_data = _tstof(szValue);
|
|
if (!pDict->AppendItem(pItem))
|
|
delete pItem;
|
|
}
|
|
else if (nType == TYPE_WCStringItem)
|
|
{
|
|
WCStringItem *pItem = new WCStringItem;
|
|
pItem->m_sName = szName;
|
|
pItem->m_sDesc = szDesc;
|
|
pItem->m_data = szValue;
|
|
if (!pDict->AppendItem(pItem))
|
|
delete pItem;
|
|
}
|
|
else if (nType == TYPE_WSelectItem)
|
|
{
|
|
WSelectItem *pItem = new WSelectItem;
|
|
pItem->m_sName = szName;
|
|
pItem->m_sDesc = szDesc;
|
|
for(pData->lstStr.MoveToFirst(); !pData->lstStr.IsOut(); pData->lstStr.MoveToNext())
|
|
{
|
|
CString szStr = pData->lstStr.GetCurData();
|
|
pItem->AddTail(szStr);
|
|
if (szStr == szValue)
|
|
pItem->m_data = pData->lstStr.GetCur();
|
|
}
|
|
if (!pDict->AppendItem(pItem))
|
|
delete pItem;
|
|
}
|
|
}
|
|
|
|
void TDictGrid::GridToDict(WDict *pDict)
|
|
{
|
|
for(int i=0; i<GetRowNum(); i++)
|
|
{
|
|
WDGridTreeRow &row = (WDGridTreeRow &)GetRow(i);
|
|
if (row.IsChildRow())
|
|
continue;
|
|
|
|
if (row.IsParentRow())
|
|
TreeRowToDict(row, pDict);
|
|
else
|
|
RowToDict(row, pDict);
|
|
}
|
|
}
|
|
|
|
void TDictGrid::OnCellComboString(WDGridCell&cell,CComboBox&combo)
|
|
{
|
|
if (cell.GetColIndex()==2)
|
|
{
|
|
combo.AddString(_T("整型"));
|
|
combo.AddString(_T("浮点型"));
|
|
combo.AddString(_T("字符型"));
|
|
combo.AddString(_T("字符串型"));
|
|
combo.AddString(_T("布尔型"));
|
|
combo.AddString(_T("选择型"));
|
|
}
|
|
else if (cell.GetColIndex()==1)
|
|
{
|
|
WDGridRow &row = cell.GetRow();
|
|
TDictRowData *pData = (TDictRowData*)row.GetExtendData();
|
|
if (pData == NULL)
|
|
return;
|
|
|
|
if (pData->nType == TYPE_WBoolItem)
|
|
{
|
|
combo.AddString(_T("是"));
|
|
combo.AddString(_T("否"));
|
|
}
|
|
else if (pData->nType == TYPE_WSelectItem)
|
|
{
|
|
for(pData->lstStr.MoveToFirst(); !pData->lstStr.IsOut(); pData->lstStr.MoveToNext())
|
|
combo.AddString(pData->lstStr.GetCurData());
|
|
}
|
|
}
|
|
}
|
|
|
|
bool TDictGrid::OnBeforeEdit(WDGridCell&cell,bool &bModified)
|
|
{
|
|
WDGridRow &row = cell.GetRow();
|
|
if (row.IsParentRow())
|
|
{
|
|
int indexCol = cell.GetColIndex();
|
|
if (indexCol == 1)
|
|
return false;
|
|
if (IsModified() && indexCol == 2)
|
|
return false;
|
|
}
|
|
if (cell.GetColIndex()==1)
|
|
{
|
|
TDictRowData *pData = (TDictRowData*)row.GetExtendData();
|
|
if (pData == NULL)
|
|
return false;
|
|
|
|
if (pData->nType == TYPE_WBoolItem)
|
|
{
|
|
cell.GetCol().SetComboSel(true);
|
|
}
|
|
else if (pData->nType == TYPE_WSelectItem)
|
|
{
|
|
if (IsModified())
|
|
cell.GetCol().SetComboEdit(true);
|
|
else
|
|
cell.GetCol().SetComboSel(true);
|
|
}
|
|
else
|
|
{
|
|
if (cell.GetCol().IsComboEdit())
|
|
cell.GetCol().SetComboEdit(false);
|
|
else if (cell.GetCol().IsComboSel())
|
|
cell.GetCol().SetComboSel(false);
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
bool TDictGrid::OnModified(WDGridCell&cell,CString &text)
|
|
{
|
|
CString szText = cell.GetText();
|
|
if (szText == text)
|
|
return false;
|
|
|
|
WDGridRow &row = cell.GetRow();
|
|
int nCol = cell.GetColIndex();
|
|
if (nCol == 1)
|
|
{
|
|
TDictRowData *pData = (TDictRowData*)row.GetExtendData();
|
|
if (pData == NULL)
|
|
return false;
|
|
if (pData->nType == TYPE_WSelectItem)
|
|
{
|
|
if (text.Find( _T(","))>=0)
|
|
{
|
|
DualList<CString > buf;
|
|
TCHAR seps[] = _T(",");
|
|
TCHAR *token = _tcstok((LPTSTR)(LPCTSTR)text, seps);
|
|
while(token != NULL)
|
|
{
|
|
buf.AddTail(token);
|
|
token = _tcstok(NULL, seps);
|
|
}
|
|
|
|
if (buf.GetLength()>0)
|
|
{
|
|
text=buf.GetAt(0);
|
|
|
|
pData->lstStr.Clear();
|
|
pData->lstStr.Conbine(buf);
|
|
}
|
|
}
|
|
}
|
|
GetParent()->GetParent()->SendMessage(TARCH_SETTING_MSG_BUTTONSTATION);
|
|
}
|
|
else if (nCol == 2)
|
|
{
|
|
TDictRowData *pData = (TDictRowData*)row.GetExtendData();
|
|
if (pData != NULL)
|
|
pData->nType = GetTypeIndex(text);
|
|
|
|
if (text == _T("整型"))
|
|
row[1].SetText(_T("0"));
|
|
else if (text == _T("布尔型"))
|
|
row[1].SetText(_T("是"));
|
|
else if (text == _T("选择型"))
|
|
{
|
|
TDictRowData *pData = (TDictRowData*)row.GetExtendData();
|
|
if (pData != NULL && pData->lstStr.GetLength() > 0)
|
|
row[1].SetText(pData->lstStr[0]);
|
|
else
|
|
row[1].SetText(_T(""));
|
|
}
|
|
else
|
|
row[1].SetText(_T(""));
|
|
|
|
row[1].Refresh();
|
|
GetParent()->GetParent()->SendMessage(TARCH_SETTING_MSG_BUTTONSTATION);
|
|
}
|
|
return true;
|
|
}
|
|
|
|
bool TDictGrid::OnBeforeInsertChild(WDGridTreeRow&row,long iChild,WDGridTreeRow*&pChild)
|
|
{
|
|
row[1].SetText(_T(""));
|
|
if (IsModified())
|
|
row[2].SetText(_T(""));
|
|
return true;
|
|
}
|
|
|
|
void TDictGrid::OnInsertRow(WDGridRow&row)
|
|
{
|
|
if (!IsModified())
|
|
return;
|
|
TDictRowData *pData = (TDictRowData *)row.GetExtendData();
|
|
if (pData == NULL)
|
|
{
|
|
pData = new TDictRowData;
|
|
row.SetExtendData(pData);
|
|
}
|
|
if (row.IsParentRow())
|
|
{
|
|
pData->nType = 0;
|
|
WDGridTreeRow *pRowChild = (WDGridTreeRow *)&row;
|
|
for(long i=0; i<pRowChild->GetChildNum(); i++)
|
|
{
|
|
WDGridTreeRow &rowChild = pRowChild->GetChild(i);
|
|
TDictRowData *pDataChild = (TDictRowData *)rowChild.GetExtendData();
|
|
if (pDataChild == NULL)
|
|
{
|
|
pDataChild = new TDictRowData;
|
|
rowChild.SetExtendData(pDataChild);
|
|
}
|
|
CString szType = rowChild[2].GetText();
|
|
if (szType == _T(""))
|
|
{
|
|
pDataChild->nType = 3;
|
|
rowChild[1].SetText(_T("0"));
|
|
rowChild[2].SetText(_T("整型"));
|
|
}
|
|
else
|
|
pDataChild->nType = GetTypeIndex(szType);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
CString szType = row[2].GetText();
|
|
if (szType == _T(""))
|
|
{
|
|
pData->nType = 3;
|
|
row[1].SetText(_T("0"));
|
|
row[2].SetText(_T("整型"));
|
|
}
|
|
else
|
|
pData->nType = GetTypeIndex(szType);
|
|
}
|
|
GetParent()->GetParent()->SendMessage(TARCH_SETTING_MSG_BUTTONSTATION);
|
|
OnDataChanged();
|
|
}
|
|
|
|
// add by xly on 110408 截获鼠标滚轴消息
|
|
BOOL TDictGrid::PreTranslateMessage(MSG* pMsg)
|
|
{
|
|
if (pMsg->message == WM_MOUSEWHEEL)
|
|
{
|
|
int zDelta = (int)pMsg->wParam;
|
|
if (zDelta < 0)
|
|
OnVScroll(SB_LINEDOWN, 0, NULL);
|
|
else
|
|
OnVScroll(SB_LINEUP, 0, NULL);
|
|
}
|
|
|
|
return WDGrid::PreTranslateMessage(pMsg);
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////
|
|
// CDictConfig 对话框
|
|
class CDictConfig : public GlwCAcUiDialog
|
|
{
|
|
DECLARE_DYNAMIC(CDictConfig)
|
|
|
|
public:
|
|
CDictConfig(CWnd* pParent = NULL, bool bModified = false); // 标准构造函数
|
|
virtual ~CDictConfig();
|
|
|
|
// 对话框数据
|
|
enum { IDD = IDD_DICT_CONFIG };
|
|
TDictGrid m_grid;
|
|
|
|
protected:
|
|
void InitGrid();
|
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
|
|
virtual BOOL OnInitDialog();
|
|
afx_msg void OnSize(UINT nType, int cx, int cy);
|
|
afx_msg void OnDestroy();
|
|
afx_msg void OnClickRetDefalut();// [3/11/2008 nsh]
|
|
DECLARE_MESSAGE_MAP()
|
|
};
|
|
|
|
IMPLEMENT_DYNAMIC(CDictConfig, GlwCAcUiDialog)
|
|
CDictConfig::CDictConfig(CWnd* pParent, bool bModified)
|
|
: GlwCAcUiDialog(CDictConfig::IDD, pParent)
|
|
{
|
|
m_grid.SetModified(bModified);
|
|
}
|
|
|
|
CDictConfig::~CDictConfig()
|
|
{
|
|
}
|
|
|
|
void CDictConfig::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CDictConfig, GlwCAcUiDialog)
|
|
ON_WM_SIZE()
|
|
ON_WM_DESTROY()
|
|
ON_BN_CLICKED(IDC_RETDEFAULT,OnClickRetDefalut)
|
|
END_MESSAGE_MAP()
|
|
|
|
|
|
// CDictConfig 消息处理程序
|
|
// [3/11/2008 nsh]
|
|
//---------------------begin------------------------
|
|
void DictConfig();
|
|
void CDictConfig::OnClickRetDefalut()
|
|
{
|
|
XString sFullFileDef;
|
|
if (!FindFile(_T("config.def"), sFullFileDef))
|
|
{
|
|
AfxMessageBox(_T("\n找不到'config.def'文件!"));
|
|
return;
|
|
}
|
|
WDict defDict;
|
|
defDict.ReadFile(sFullFileDef);
|
|
m_grid.Clear();
|
|
m_grid.DictToGrid(&defDict);
|
|
return;
|
|
}
|
|
//----------------------end-------------------------
|
|
BOOL CDictConfig::OnInitDialog()
|
|
{
|
|
CDialog::OnInitDialog();
|
|
InitGrid();
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
void CDictConfig::OnSize(UINT nType, int cx, int cy)
|
|
{
|
|
CDialog::OnSize(nType, cx, cy);
|
|
|
|
if (nType==SIZE_MINIMIZED)
|
|
return;
|
|
m_grid.MoveWindow(0,0,cx,cy-20);
|
|
m_grid.RecalcLayout();
|
|
m_grid.FitLastCol();
|
|
|
|
CWnd*pButton=GetDlgItem(IDOK);
|
|
if (pButton!=NULL)
|
|
{
|
|
CRect rect;
|
|
pButton->GetWindowRect(rect);
|
|
ScreenToClient(rect);
|
|
rect.top=cy-rect.Height()-10;
|
|
rect.bottom=cy-10;
|
|
pButton->MoveWindow(rect);
|
|
}
|
|
pButton=GetDlgItem(IDCANCEL);
|
|
if (pButton!=NULL)
|
|
{
|
|
CRect rect;
|
|
pButton->GetWindowRect(rect);
|
|
ScreenToClient(rect);
|
|
rect.top=cy-rect.Height()-10;
|
|
rect.bottom=cy-10;
|
|
pButton->MoveWindow(rect);
|
|
}
|
|
pButton = GetDlgItem(IDC_RETDEFAULT);
|
|
if (pButton)
|
|
{
|
|
CRect rect;
|
|
pButton->GetWindowRect(rect);
|
|
ScreenToClient(rect);
|
|
rect.top=cy-rect.Height()-10;
|
|
rect.bottom=cy-10;
|
|
pButton->MoveWindow(rect);
|
|
|
|
}
|
|
}
|
|
|
|
void CDictConfig::OnDestroy()
|
|
{
|
|
g_dictCfg.Clear();
|
|
m_grid.GridToDict(&g_dictCfg);
|
|
CDialog::OnDestroy();
|
|
}
|
|
|
|
void CDictConfig::InitGrid()
|
|
{
|
|
m_grid.Clear();
|
|
m_grid.SetTreeLine();
|
|
m_grid.SetColFixLength();
|
|
m_grid.SetColPosFix();
|
|
m_grid.SetSortEnable(false);
|
|
m_grid.AppendCol(_T("类型\\项"),220);
|
|
m_grid.AppendCol(_T("值"),100);
|
|
m_grid.AppendCol(_T("描述"),200);
|
|
|
|
if (!m_grid.IsModified())
|
|
{
|
|
m_grid.GetCol(0).SetReadOnly();
|
|
m_grid.GetCol(0).SetTextColor(RGB(10,20,160));
|
|
m_grid.GetCol(2).SetReadOnly();
|
|
m_grid.GetCol(2).SetBackColor(GetSysColor(COLOR_3DFACE));
|
|
m_grid.SetRowPosFix(true);
|
|
m_grid.SetRowFixLength(true);
|
|
m_grid.SetNoAppendButton(true);
|
|
}
|
|
else
|
|
{
|
|
m_grid.InsertCol(2,_T("类型"),80);
|
|
m_grid.GetCol(2).SetComboSel();
|
|
}
|
|
|
|
m_grid.Create(this, IDC_GRID);
|
|
m_grid.FitLastCol();
|
|
m_grid.DictToGrid(&g_dictCfg);
|
|
}
|
|
|
|
////////////////////////////////////////////////////
|
|
// 2010-3-15 16:47 wubo
|
|
// TARCH_IMPEXP XString GetFullCmdName(const TCHAR *szName);
|
|
#define CFG_VER _T("1")//当前配置版本
|
|
// command
|
|
void DictConfig()
|
|
{
|
|
XString sFullFileDef;
|
|
if (!FindFile(_T("config.def"), sFullFileDef))
|
|
{
|
|
AfxMessageBox(_T("\n找不到'config.def'文件!"));
|
|
return;
|
|
}
|
|
|
|
XString sFullFile;
|
|
if (!FindFile(_T("config.ini"), sFullFile))
|
|
{
|
|
AfxMessageBox(_T("\n找不到'config.ini'文件!"));
|
|
return;
|
|
}
|
|
|
|
WDict dictCur;
|
|
g_dictCfg.ReadFile(sFullFileDef);//读入标配
|
|
dictCur.ReadFile(sFullFile);//读入当前配置
|
|
if (dictCur.m_sDesc!=g_dictCfg.m_sDesc)//配置版本不同
|
|
g_dictCfg.CopyData(dictCur);//将当前配置尽量复制过来
|
|
else
|
|
{
|
|
g_dictCfg.Clear();
|
|
g_dictCfg.Conbine(dictCur);//直接使用当前配置
|
|
}
|
|
|
|
CAcModuleResourceOverride vTemp;
|
|
CDictConfig dlg(NULL);
|
|
if (dlg.DoModal()==IDOK)
|
|
{
|
|
g_dictCfg.WriteFile(sFullFile);//写入ini
|
|
XString sCmd=GetFullCmdName(_T("TLoadConfig"));
|
|
acedCommand(RTSTR,sCmd,RTNONE);
|
|
}
|
|
g_dictCfg.Clear();
|
|
}
|
|
|
|
void DictConfigCtl()
|
|
{
|
|
XString sFullFile;
|
|
if (!FindFile(_T("config.def"), sFullFile))
|
|
{
|
|
AfxMessageBox(_T("\n找不到'config.def'文件!"));
|
|
return;
|
|
}
|
|
g_dictCfg.ReadFile(sFullFile);
|
|
CAcModuleResourceOverride vTemp;
|
|
CDictConfig dlg(NULL, true);
|
|
if (dlg.DoModal()==IDOK)
|
|
{
|
|
g_dictCfg.m_sName = _T("系统参数配置");
|
|
g_dictCfg.m_sDesc = CFG_VER;
|
|
g_dictCfg.WriteFile(sFullFile);//写入def
|
|
}
|
|
g_dictCfg.Clear();
|
|
}
|
|
/////////////////////////////////////////////////////
|
|
class CDictConfigChild : public CAcUiTabChildDialog
|
|
{
|
|
DECLARE_DYNAMIC(CDictConfigChild)
|
|
|
|
public:
|
|
CDictConfigChild(CWnd* pParent = NULL, bool bModified = false); // 标准构造函数
|
|
virtual ~CDictConfigChild();
|
|
|
|
// 对话框数据
|
|
enum { IDD = IDD_DICTCONFIG_CHILD };
|
|
TDictGrid m_grid;
|
|
XString m_sFilePath;//配置文件路径
|
|
void BeforeGrid();
|
|
void InitGrid();
|
|
void RetDefault();
|
|
void UpdataSet3Data(const Array<CXMLNodeInfoEx> &aryNodeInfo);
|
|
void ApplySetData();
|
|
protected:
|
|
|
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
|
|
virtual BOOL OnInitDialog();
|
|
afx_msg void OnSize(UINT nType, int cx, int cy);
|
|
afx_msg void OnDestroy();
|
|
afx_msg LRESULT OnReUpdataDlg(WPARAM w,LPARAM l);
|
|
|
|
DECLARE_MESSAGE_MAP()
|
|
int GetIndex(const CXMLNodeInfoEx &data);
|
|
int GetSubStrNumInStr(const CString &str,const CString strSub)//得到子串在原字符串中的位置定义尽适用于 “asd sd fg” 中查询asd等以空格分界
|
|
{
|
|
CString strTem;
|
|
CStringArray arystr;
|
|
int nPos = str.Find(_T(" "),0);
|
|
int nStart = 0;
|
|
while (nPos!=-1)
|
|
{
|
|
int nNum = nPos-nStart;
|
|
strTem = str.Mid(nStart,nNum);
|
|
arystr.Add(strTem);
|
|
nStart = nPos+1;
|
|
nPos = str.Find(_T(" "),nPos+1);
|
|
}
|
|
int nSize = str.GetLength();
|
|
if (nStart-1<nSize-1)
|
|
{
|
|
strTem = str.Mid(nStart,nSize-nStart);
|
|
arystr.Add(strTem);
|
|
}
|
|
// Zyu modify on 100722,支持64位
|
|
//int nLen = arystr.GetSize();
|
|
INT_PTR nLen = arystr.GetSize();
|
|
int i =0;
|
|
for (;i<nLen;i++)
|
|
{
|
|
CString strTest = arystr.GetAt(i);
|
|
if (strSub==strTest)
|
|
{
|
|
return i;
|
|
}
|
|
}
|
|
return -1;//没有匹配的
|
|
}
|
|
};
|
|
IMPLEMENT_DYNAMIC(CDictConfigChild, CAcUiTabChildDialog)
|
|
CDictConfigChild::CDictConfigChild(CWnd* pParent, bool bModified)
|
|
: CAcUiTabChildDialog(pParent)
|
|
{
|
|
m_grid.SetModified(bModified);
|
|
}
|
|
|
|
CDictConfigChild::~CDictConfigChild()
|
|
{
|
|
}
|
|
|
|
void CDictConfigChild::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CAcUiTabChildDialog::DoDataExchange(pDX);
|
|
}
|
|
|
|
BEGIN_MESSAGE_MAP(CDictConfigChild, CAcUiTabChildDialog)
|
|
ON_WM_SIZE()
|
|
ON_WM_DESTROY()
|
|
ON_MESSAGE(TARCH_SETTING_MSG_UPDATA,OnReUpdataDlg)
|
|
END_MESSAGE_MAP()
|
|
|
|
LRESULT CDictConfigChild::OnReUpdataDlg(WPARAM w,LPARAM l)
|
|
{
|
|
RetDefault();
|
|
UpdateData(FALSE);
|
|
return 0;
|
|
}
|
|
|
|
void CDictConfigChild::RetDefault()
|
|
{
|
|
XString sFullFileDef;
|
|
if (!FindFile(_T("config.def"), sFullFileDef))
|
|
{
|
|
AfxMessageBox(_T("\n找不到'config.def'文件!"));
|
|
return;
|
|
}
|
|
|
|
XString sFullFile;
|
|
if (!FindFile(_T("config.ini"), sFullFile))
|
|
{
|
|
AfxMessageBox(_T("\n找不到'config.ini'文件!"));
|
|
return;
|
|
}
|
|
m_sFilePath = sFullFile;
|
|
WDict dictCur,dictCfg;
|
|
dictCfg.ReadFile(sFullFileDef);//读入标配
|
|
dictCur.ReadFile(sFullFile);//读入当前配置
|
|
if (dictCur.m_sDesc!=dictCfg.m_sDesc)//配置版本不同
|
|
dictCfg.CopyData(dictCur);//将当前配置尽量复制过来
|
|
else
|
|
{
|
|
dictCfg.Clear();
|
|
dictCfg.Conbine(dictCur);//直接使用当前配置
|
|
}
|
|
m_grid.Clear();
|
|
m_grid.DictToGrid(&dictCfg);
|
|
UpdateData(FALSE);
|
|
return;
|
|
}
|
|
|
|
void CDictConfigChild::ApplySetData()
|
|
{
|
|
g_dictCfg.Clear();
|
|
m_grid.GridToDict(&g_dictCfg);
|
|
if (m_sFilePath!=_T(""))
|
|
{
|
|
g_dictCfg.WriteFile(m_sFilePath);
|
|
XString sCmd=GetFullCmdName(_T("TLoadConfig"));
|
|
acedCommand(RTSTR,sCmd,RTNONE);
|
|
|
|
//add by xlc on 090805 线型比例确定后立即生效
|
|
if (g_bAutoLTScale)
|
|
{
|
|
int nTileMode=0;
|
|
VERIFY(xg_getvar(_T("TILEMODE"), &nTileMode)==RTNORM);
|
|
double ltscale=nTileMode? g_nLtMScale : g_nLtPScale;
|
|
xg_setvar(_T("LTSCALE"), ltscale);
|
|
}
|
|
}
|
|
}
|
|
//----------------------end-------------------------
|
|
BOOL CDictConfigChild::OnInitDialog()
|
|
{
|
|
CAcUiTabChildDialog::OnInitDialog();
|
|
InitGrid();
|
|
CRect rect;
|
|
GetClientRect(rect);
|
|
m_grid.MoveWindow(0,0,rect.right,rect.bottom);
|
|
m_grid.RecalcLayout();
|
|
m_grid.FitLastCol();
|
|
return TRUE;
|
|
}
|
|
|
|
void CDictConfigChild::OnSize(UINT nType, int cx, int cy)
|
|
{
|
|
|
|
CDialog::OnSize(nType, cx, cy);
|
|
if (nType==SIZE_MINIMIZED)
|
|
return;
|
|
m_grid.MoveWindow(0,0,cx,cy);
|
|
m_grid.RecalcLayout();
|
|
m_grid.FitLastCol();
|
|
|
|
CWnd*pButton=GetDlgItem(IDOK);
|
|
if (pButton!=NULL)
|
|
{
|
|
CRect rect;
|
|
pButton->GetWindowRect(rect);
|
|
ScreenToClient(rect);
|
|
rect.top=cy-rect.Height()-10;
|
|
rect.bottom=cy-10;
|
|
pButton->MoveWindow(rect);
|
|
}
|
|
pButton=GetDlgItem(IDCANCEL);
|
|
if (pButton!=NULL)
|
|
{
|
|
CRect rect;
|
|
pButton->GetWindowRect(rect);
|
|
ScreenToClient(rect);
|
|
rect.top=cy-rect.Height()-10;
|
|
rect.bottom=cy-10;
|
|
pButton->MoveWindow(rect);
|
|
}
|
|
}
|
|
|
|
void CDictConfigChild::OnDestroy()
|
|
{
|
|
//add by xlc on 090804 cancel时不保存数据
|
|
if (g_bCancel)
|
|
{
|
|
if (m_sFilePath!=_T(""))
|
|
{
|
|
g_dictCfg.WriteFile(m_sFilePath);
|
|
}
|
|
CDialog::OnDestroy();
|
|
return;
|
|
}
|
|
|
|
g_dictCfg.Clear();
|
|
m_grid.GridToDict(&g_dictCfg);
|
|
if (m_sFilePath!=_T(""))
|
|
{
|
|
g_dictCfg.WriteFile(m_sFilePath);
|
|
}
|
|
CDialog::OnDestroy();
|
|
}
|
|
void CDictConfigChild::BeforeGrid()
|
|
{
|
|
XString sFullFileDef;
|
|
if (!FindFile(_T("config.def"), sFullFileDef))
|
|
{
|
|
AfxMessageBox(_T("\n找不到'config.def'文件!"));
|
|
return;
|
|
}
|
|
|
|
XString sFullFile;
|
|
if (!FindFile(_T("config.ini"), sFullFile))
|
|
{
|
|
AfxMessageBox(_T("\n找不到'config.ini'文件!"));
|
|
return;
|
|
}
|
|
m_sFilePath = sFullFile;
|
|
WDict dictCur;
|
|
g_dictCfg.ReadFile(sFullFileDef);//读入标配
|
|
dictCur.ReadFile(sFullFile);//读入当前配置
|
|
if (dictCur.m_sDesc!=g_dictCfg.m_sDesc)//配置版本不同
|
|
g_dictCfg.CopyData(dictCur);//将当前配置尽量复制过来
|
|
else
|
|
{
|
|
g_dictCfg.Clear();
|
|
g_dictCfg.Conbine(dictCur);//直接使用当前配置
|
|
}
|
|
}
|
|
void CDictConfigChild::InitGrid()
|
|
{
|
|
BeforeGrid();
|
|
m_grid.Clear();
|
|
int oldColNum=m_grid.GetColNum();
|
|
for(int i=oldColNum-1;i>-1;i--)
|
|
{
|
|
m_grid.DelCol(i);
|
|
}
|
|
m_grid.SetTreeLine();
|
|
m_grid.SetColFixLength();
|
|
m_grid.SetColPosFix();
|
|
m_grid.SetSortEnable(false);
|
|
m_grid.AppendCol(_T("类型\\项"),220);
|
|
m_grid.AppendCol(_T("值"),100);
|
|
m_grid.AppendCol(_T("描述"),200);
|
|
|
|
if (!m_grid.IsModified())
|
|
{
|
|
m_grid.GetCol(0).SetReadOnly();
|
|
m_grid.GetCol(0).SetTextColor(RGB(10,20,160));
|
|
m_grid.GetCol(2).SetReadOnly();
|
|
m_grid.GetCol(2).SetBackColor(GetSysColor(COLOR_3DFACE));
|
|
m_grid.SetRowPosFix(true);
|
|
m_grid.SetRowFixLength(true);
|
|
m_grid.SetNoAppendButton(true);
|
|
}
|
|
else
|
|
{
|
|
m_grid.InsertCol(2,_T("类型"),80);
|
|
m_grid.GetCol(2).SetComboSel();
|
|
}
|
|
|
|
m_grid.Create(this, IDC_GRID);
|
|
m_grid.FitLastCol();
|
|
m_grid.DictToGrid(&g_dictCfg);
|
|
}
|
|
|
|
class COption : public CAcUiTabMainDialog
|
|
{
|
|
DECLARE_DYNAMIC(COption)
|
|
public:
|
|
COption(CWnd* parent);
|
|
enum { IDD = IDD_OPTION };
|
|
|
|
CTchInitSet1Dlg m_pageInitSet1;
|
|
//CTchInitSet2Dlg m_pageInitSet2;
|
|
CDictConfigChild m_pageInitSet3;
|
|
CAcUiTab m_tab;
|
|
static int s_nPage;
|
|
CRect m_Rect;
|
|
int m_nDistToBottom;
|
|
int m_nDistToTop;
|
|
public:
|
|
virtual BOOL OnInitDialog();
|
|
virtual void DoDataExchange(CDataExchange* pDX);
|
|
|
|
protected:
|
|
afx_msg void OnDestroy();
|
|
afx_msg void OnLabel();
|
|
afx_msg void OnClose();
|
|
afx_msg void OnClickRetDefalut();
|
|
afx_msg void OnClickImport();
|
|
afx_msg void OnClickExport();
|
|
afx_msg LRESULT OnUpdataApplyButton(WPARAM w,LPARAM l);// 更新对话框
|
|
afx_msg void OnBnClickedOptionHelp();
|
|
afx_msg void OnBnClickedRetApply();
|
|
afx_msg void OnSize(UINT nType, int cx, int cy);
|
|
afx_msg void OnTcnSelchangeOptionTab(NMHDR *pNMHDR, LRESULT *pResult);
|
|
virtual void OnCancel();
|
|
DECLARE_MESSAGE_MAP()
|
|
//应用设置
|
|
void ApplySet();
|
|
void ModifyWindowSize(CWnd *pWnd,int cx, int cy);
|
|
void ModifyWindowPos(CWnd *pWnd,int cx, int cy);
|
|
void SetTabPos(int cx, int cy);
|
|
};
|
|
int COption::s_nPage=0;
|
|
IMPLEMENT_DYNAMIC(COption, CAcUiTabMainDialog)
|
|
COption::COption(CWnd* parent):CAcUiTabMainDialog(COption::IDD,parent)
|
|
{
|
|
g_bCancel = FALSE;
|
|
}
|
|
void COption::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CAcUiTabMainDialog::DoDataExchange(pDX);
|
|
DDX_Control(pDX, IDC_OPTION_TAB, m_tab);
|
|
}
|
|
|
|
BEGIN_MESSAGE_MAP(COption, CAcUiTabMainDialog)
|
|
ON_BN_CLICKED(IDC_RET_DEFAULT,OnClickRetDefalut)
|
|
ON_BN_CLICKED(IDC_IMPORT,OnClickImport)
|
|
ON_BN_CLICKED(IDC_EXPORT,OnClickExport)
|
|
ON_WM_CLOSE()
|
|
ON_WM_DESTROY()
|
|
ON_BN_CLICKED(IDC_OPTION_HELP, COption::OnBnClickedOptionHelp)
|
|
ON_BN_CLICKED(IDC_RET_APPLY, COption::OnBnClickedRetApply)
|
|
ON_MESSAGE(TARCH_SETTING_MSG_BUTTONSTATION,OnUpdataApplyButton)
|
|
ON_WM_SIZE()
|
|
ON_NOTIFY(TCN_SELCHANGE, IDC_OPTION_TAB, COption::OnTcnSelchangeOptionTab)
|
|
END_MESSAGE_MAP()
|
|
|
|
void COption::OnTcnSelchangeOptionTab(NMHDR *pNMHDR, LRESULT *pResult)
|
|
{
|
|
// TODO: 在此添加控件通知处理程序代码
|
|
int nIndex = m_tab.GetActiveTab();
|
|
if (nIndex==0||nIndex>0)
|
|
{
|
|
CAdUiTabChildDialog *pDlg = NULL;
|
|
pDlg = m_tab.GetDialogPointer (nIndex);
|
|
CRect rect; //获取控件变化前大小
|
|
HWND hwnd;
|
|
hwnd = pDlg->GetSafeHwnd();
|
|
if (hwnd)
|
|
{
|
|
hwnd = m_tab.GetSafeHwnd();
|
|
if (hwnd)
|
|
{
|
|
m_tab.GetWindowRect(rect);
|
|
ScreenToClient(&rect);
|
|
rect.top = rect.top+20;
|
|
pDlg->MoveWindow(rect);
|
|
}
|
|
}
|
|
}
|
|
*pResult = 0;
|
|
}
|
|
|
|
void COption::ModifyWindowPos(CWnd *pWnd,int cx, int cy)
|
|
{
|
|
CRect rect; //获取控件变化前大小
|
|
HWND hwnd;
|
|
hwnd = pWnd->GetSafeHwnd();
|
|
if (hwnd)
|
|
{
|
|
pWnd->GetWindowRect(rect);
|
|
ScreenToClient(&rect);
|
|
int height=rect.Height();
|
|
rect.bottom=cy-m_nDistToBottom;
|
|
rect.top=rect.bottom-height;
|
|
pWnd->MoveWindow(rect);
|
|
}
|
|
}
|
|
void COption::ModifyWindowSize(CWnd *pWnd,int cx, int cy)
|
|
{
|
|
CRect rect; //获取控件变化前大小
|
|
HWND hwnd;
|
|
hwnd = pWnd->GetSafeHwnd();
|
|
if (hwnd)
|
|
{
|
|
pWnd->GetWindowRect(&rect);
|
|
ScreenToClient(&rect);
|
|
rect.left=rect.left*cx/m_Rect.Width();/////调整控件大小
|
|
rect.right=rect.right*cx/m_Rect.Width();
|
|
rect.top=rect.top*cy/m_Rect.Height();
|
|
rect.bottom=rect.bottom*cy/m_Rect.Height();
|
|
pWnd->MoveWindow(rect);
|
|
}
|
|
}
|
|
|
|
void COption::SetTabPos(int cx, int cy)
|
|
{
|
|
CRect rect; //获取控件变化前大小
|
|
HWND hwnd;
|
|
hwnd = m_tab.GetSafeHwnd();
|
|
if (hwnd)
|
|
{
|
|
m_tab.GetWindowRect(&rect);
|
|
ScreenToClient(&rect);
|
|
rect.top=m_nDistToTop;
|
|
m_tab.MoveWindow(rect);
|
|
}
|
|
}
|
|
|
|
void COption::OnSize(UINT nType, int cx, int cy)
|
|
{
|
|
CAcUiTabMainDialog::OnSize(nType,cx,cy);
|
|
CRect rect; //获取控件变化前大小
|
|
int nIndex = m_tab.GetActiveTab();
|
|
if (nIndex < 0) return;
|
|
HWND hwnd;
|
|
|
|
hwnd = GetDlgItem(IDC_RET_DEFAULT)->GetSafeHwnd();
|
|
if (hwnd)
|
|
{
|
|
CRect rectB,rectParent;
|
|
GetDlgItem(IDC_RET_DEFAULT)->GetClientRect(rectB);
|
|
int nLen = rectB.Width();
|
|
int nH = rectB.Height();
|
|
GetClientRect(rectParent);
|
|
rectB.left = rectParent.left+10;
|
|
rectB.top = rectParent.bottom-30;
|
|
rectB.right = rectB.left+nLen;
|
|
rectB.bottom = rectB.top+nH;
|
|
GetDlgItem(IDC_RET_DEFAULT)->MoveWindow(rectB);
|
|
}
|
|
hwnd = GetDlgItem(IDC_EXPORT)->GetSafeHwnd();
|
|
if (hwnd)
|
|
{
|
|
CRect rectB,rectParent;
|
|
GetDlgItem(IDC_EXPORT)->GetClientRect(rectB);
|
|
int nLen = rectB.Width();
|
|
int nH = rectB.Height();
|
|
GetClientRect(rectParent);
|
|
rectB.left = rectParent.left+20+nLen;
|
|
rectB.top = rectParent.bottom-30;
|
|
rectB.right = rectB.left+nLen;
|
|
rectB.bottom = rectB.top+nH;
|
|
GetDlgItem(IDC_EXPORT)->MoveWindow(rectB);
|
|
}
|
|
hwnd = GetDlgItem(IDC_IMPORT)->GetSafeHwnd();
|
|
if (hwnd)
|
|
{
|
|
CRect rectB,rectParent;
|
|
GetDlgItem(IDC_IMPORT)->GetClientRect(rectB);
|
|
int nLen = rectB.Width();
|
|
int nH = rectB.Height();
|
|
GetClientRect(rectParent);
|
|
rectB.left = rectParent.left+30+2*nLen;
|
|
rectB.top = rectParent.bottom-30;
|
|
rectB.right = rectB.left+nLen;
|
|
rectB.bottom = rectB.top+nH;
|
|
GetDlgItem(IDC_IMPORT)->MoveWindow(rectB);
|
|
}
|
|
hwnd = GetDlgItem(IDOK)->GetSafeHwnd();
|
|
if (hwnd)
|
|
{
|
|
CRect rectB,rectParent;
|
|
GetDlgItem(IDOK)->GetClientRect(rectB);
|
|
int nLen = rectB.Width();
|
|
int nH = rectB.Height();
|
|
GetClientRect(rectParent);
|
|
rectB.left = rectParent.left+50+3*nLen;
|
|
rectB.top = rectParent.bottom-30;
|
|
rectB.right = rectB.left+nLen;
|
|
rectB.bottom = rectB.top+nH;
|
|
GetDlgItem(IDOK)->MoveWindow(rectB);
|
|
}
|
|
hwnd = GetDlgItem(IDCANCEL)->GetSafeHwnd();
|
|
if (hwnd)
|
|
{
|
|
CRect rectB,rectParent;
|
|
GetDlgItem(IDCANCEL)->GetClientRect(rectB);
|
|
int nLen = rectB.Width();
|
|
int nH = rectB.Height();
|
|
GetClientRect(rectParent);
|
|
rectB.left = rectParent.left+60+4*nLen;
|
|
rectB.top = rectParent.bottom-30;
|
|
rectB.right = rectB.left+nLen;
|
|
rectB.bottom = rectB.top+nH;
|
|
GetDlgItem(IDCANCEL)->MoveWindow(rectB);
|
|
}
|
|
hwnd = GetDlgItem(IDC_RET_APPLY)->GetSafeHwnd();
|
|
if (hwnd)
|
|
{
|
|
CRect rectB,rectParent;
|
|
GetDlgItem(IDC_RET_APPLY)->GetClientRect(rectB);
|
|
int nLen = rectB.Width();
|
|
int nH = rectB.Height();
|
|
GetClientRect(rectParent);
|
|
rectB.left = rectParent.left+70+5*nLen;
|
|
rectB.top = rectParent.bottom-30;
|
|
rectB.right = rectB.left+nLen;
|
|
rectB.bottom = rectB.top+nH;
|
|
GetDlgItem(IDC_RET_APPLY)->MoveWindow(rectB);
|
|
}
|
|
hwnd = GetDlgItem(IDC_OPTION_HELP)->GetSafeHwnd();
|
|
if (hwnd)
|
|
{
|
|
CRect rectB,rectParent;
|
|
GetDlgItem(IDC_OPTION_HELP)->GetClientRect(rectB);
|
|
int nLen = rectB.Width();
|
|
int nH = rectB.Height();
|
|
GetClientRect(rectParent);
|
|
rectB.left = rectParent.left+80+6*nLen;
|
|
rectB.top = rectParent.bottom-30;
|
|
rectB.right = rectB.left+nLen;
|
|
rectB.bottom = rectB.top+nH;
|
|
GetDlgItem(IDC_OPTION_HELP)->MoveWindow(rectB);
|
|
}
|
|
|
|
CAdUiTabChildDialog *pDlg = m_tab.GetDialogPointer (nIndex);
|
|
hwnd = pDlg->GetSafeHwnd();
|
|
if (hwnd)
|
|
{
|
|
CRect rectdlg;
|
|
GetClientRect(rectdlg);
|
|
|
|
hwnd = m_tab.GetSafeHwnd();
|
|
if (hwnd)
|
|
{
|
|
GetClientRect(rect);
|
|
rect.left = rect.left+20;
|
|
rect.right = rect.right-20;
|
|
rect.top = rect.top+10;
|
|
rect.bottom = rect.bottom - 50;
|
|
m_tab.MoveWindow(rect);
|
|
m_tab.GetWindowRect(rect);
|
|
ScreenToClient(&rect);
|
|
rect.top = rect.top+20;
|
|
rect.left = rect.left+5;
|
|
rect.right = rect.right-5;
|
|
rect.bottom = rect.bottom-5;
|
|
pDlg->MoveWindow(rect);
|
|
}
|
|
}
|
|
|
|
m_Rect.right=cx;
|
|
m_Rect.bottom=cy;
|
|
Invalidate(TRUE);
|
|
}
|
|
LRESULT COption::OnUpdataApplyButton(WPARAM w,LPARAM l)
|
|
{
|
|
CButton *pButton = (CButton*)GetDlgItem(IDC_RET_APPLY);
|
|
pButton->EnableWindow(TRUE);
|
|
return 0;
|
|
}
|
|
BOOL COption::OnInitDialog()
|
|
{
|
|
BOOL bResult = CAcUiTabMainDialog::OnInitDialog();
|
|
|
|
SetAcadTabPointer(&m_tab);
|
|
AddTab(0, _T("基本设定"), CTchInitSet1Dlg::IDD, &m_pageInitSet1);
|
|
//AddTab(1, _T("加粗填充"),CTchInitSet2Dlg::IDD , &m_pageInitSet2);
|
|
AddTab(2, _T("高级选项"),CDictConfigChild::IDD , &m_pageInitSet3);
|
|
m_tab.SetActiveTab(s_nPage);
|
|
GetClientRect(m_Rect);
|
|
CRect rect1,rectMe,rect2;
|
|
GetDlgItem(IDC_RET_DEFAULT)->GetWindowRect(rect1);
|
|
GetDlgItem(IDC_OPTION_TAB)->GetWindowRect(rect2);
|
|
GetWindowRect(rectMe);
|
|
m_nDistToBottom=rectMe.bottom-rect1.bottom;
|
|
m_nDistToTop = rect2.top-rectMe.top;
|
|
HWND hwnd;
|
|
hwnd = GetDlgItem(IDC_RET_DEFAULT)->GetSafeHwnd();
|
|
if (hwnd)
|
|
{
|
|
CRect rectB,rectParent;
|
|
GetDlgItem(IDC_RET_DEFAULT)->GetWindowRect(rectB);
|
|
ScreenToClient(rectB);
|
|
int nLen = rectB.Width();
|
|
int nH = rectB.Height();
|
|
GetClientRect(rectParent);
|
|
rectB.left = rectParent.left+10;
|
|
rectB.top = rectParent.bottom-30;
|
|
rectB.right = rectB.left+nLen;
|
|
rectB.bottom = rectB.top+nH;
|
|
GetDlgItem(IDC_RET_DEFAULT)->MoveWindow(rectB);
|
|
}
|
|
hwnd = GetDlgItem(IDC_EXPORT)->GetSafeHwnd();
|
|
if (hwnd)
|
|
{
|
|
CRect rectB,rectParent;
|
|
GetDlgItem(IDC_EXPORT)->GetClientRect(rectB);
|
|
int nLen = rectB.Width();
|
|
int nH = rectB.Height();
|
|
GetClientRect(rectParent);
|
|
rectB.left = rectParent.left+20+nLen;
|
|
rectB.top = rectParent.bottom-30;
|
|
rectB.right = rectB.left+nLen;
|
|
rectB.bottom = rectB.top+nH;
|
|
GetDlgItem(IDC_EXPORT)->MoveWindow(rectB);
|
|
}
|
|
hwnd = GetDlgItem(IDC_IMPORT)->GetSafeHwnd();
|
|
if (hwnd)
|
|
{
|
|
CRect rectB,rectParent;
|
|
GetDlgItem(IDC_IMPORT)->GetClientRect(rectB);
|
|
int nLen = rectB.Width();
|
|
int nH = rectB.Height();
|
|
GetClientRect(rectParent);
|
|
rectB.left = rectParent.left+30+2*nLen;
|
|
rectB.top = rectParent.bottom-30;
|
|
rectB.right = rectB.left+nLen;
|
|
rectB.bottom = rectB.top+nH;
|
|
GetDlgItem(IDC_IMPORT)->MoveWindow(rectB);
|
|
}
|
|
hwnd = GetDlgItem(IDOK)->GetSafeHwnd();
|
|
if (hwnd)
|
|
{
|
|
CRect rectB,rectParent;
|
|
GetDlgItem(IDOK)->GetClientRect(rectB);
|
|
int nLen = rectB.Width();
|
|
int nH = rectB.Height();
|
|
GetClientRect(rectParent);
|
|
rectB.left = rectParent.left+50+3*nLen;
|
|
rectB.top = rectParent.bottom-30;
|
|
rectB.right = rectB.left+nLen;
|
|
rectB.bottom = rectB.top+nH;
|
|
GetDlgItem(IDOK)->MoveWindow(rectB);
|
|
}
|
|
hwnd = GetDlgItem(IDCANCEL)->GetSafeHwnd();
|
|
if (hwnd)
|
|
{
|
|
CRect rectB,rectParent;
|
|
GetDlgItem(IDCANCEL)->GetClientRect(rectB);
|
|
int nLen = rectB.Width();
|
|
int nH = rectB.Height();
|
|
GetClientRect(rectParent);
|
|
rectB.left = rectParent.left+60+4*nLen;
|
|
rectB.top = rectParent.bottom-30;
|
|
rectB.right = rectB.left+nLen;
|
|
rectB.bottom = rectB.top+nH;
|
|
GetDlgItem(IDCANCEL)->MoveWindow(rectB);
|
|
}
|
|
hwnd = GetDlgItem(IDC_RET_APPLY)->GetSafeHwnd();
|
|
if (hwnd)
|
|
{
|
|
CRect rectB,rectParent;
|
|
GetDlgItem(IDC_RET_APPLY)->GetClientRect(rectB);
|
|
int nLen = rectB.Width();
|
|
int nH = rectB.Height();
|
|
GetClientRect(rectParent);
|
|
rectB.left = rectParent.left+70+5*nLen;
|
|
rectB.top = rectParent.bottom-30;
|
|
rectB.right = rectB.left+nLen;
|
|
rectB.bottom = rectB.top+nH;
|
|
GetDlgItem(IDC_RET_APPLY)->MoveWindow(rectB);
|
|
}
|
|
hwnd = GetDlgItem(IDC_OPTION_HELP)->GetSafeHwnd();
|
|
if (hwnd)
|
|
{
|
|
CRect rectB,rectParent;
|
|
GetDlgItem(IDC_OPTION_HELP)->GetClientRect(rectB);
|
|
int nLen = rectB.Width();
|
|
int nH = rectB.Height();
|
|
GetClientRect(rectParent);
|
|
rectB.left = rectParent.left+80+6*nLen;
|
|
rectB.top = rectParent.bottom-30;
|
|
rectB.right = rectB.left+nLen;
|
|
rectB.bottom = rectB.top+nH;
|
|
GetDlgItem(IDC_OPTION_HELP)->MoveWindow(rectB);
|
|
}
|
|
return bResult;
|
|
}
|
|
void COption::OnClickRetDefalut()
|
|
{
|
|
XString fullFile;
|
|
if (!FindFile(_T("TOptionsDef.xml"), fullFile))
|
|
{
|
|
MessageBox(_T("对不起,没有发现TOptionsDef.xml文件!"));
|
|
return;
|
|
}
|
|
CString strPath = fullFile;
|
|
CXMLDOMFile *pXMLDoc = new CXMLDOMFile;
|
|
if (pXMLDoc->IsFileExist(strPath))
|
|
{
|
|
if (pXMLDoc->Open(strPath))
|
|
{
|
|
int nIndex = m_tab.GetActiveTab();
|
|
CAdUiTabChildDialog *pDlg = NULL;
|
|
pDlg = m_tab.GetDialogPointer (nIndex);
|
|
CString strPageNmae;
|
|
if (nIndex==0)
|
|
{
|
|
strPageNmae = _T("基本设定");
|
|
}
|
|
else if (nIndex==1)
|
|
{
|
|
strPageNmae = _T("墙柱加粗填充");
|
|
}
|
|
else
|
|
{
|
|
strPageNmae = _T("高级选项");
|
|
}
|
|
CImportXMLDocDlg importDlg(pXMLDoc,strPageNmae,1);
|
|
if (importDlg.DoModal()==IDOK)
|
|
{
|
|
CTArchSettingEditTools setEditTool;
|
|
setEditTool.SetXMLDoc(pXMLDoc);
|
|
setEditTool.ImportAllTArchSettingData(importDlg.m_treeXmlDoc.m_mapData);
|
|
pDlg->SendMessage(TARCH_SETTING_MSG_UPDATA);
|
|
HWND hWnd;
|
|
//其他窗口为创建则不发送消息
|
|
switch (nIndex)
|
|
{
|
|
case 0:
|
|
{
|
|
pDlg = m_tab.GetDialogPointer (1);;
|
|
hWnd = pDlg->GetSafeHwnd();
|
|
if (hWnd!=NULL)
|
|
{
|
|
pDlg->SendMessage(TARCH_SETTING_MSG_UPDATA);
|
|
}
|
|
pDlg = m_tab.GetDialogPointer (2);
|
|
hWnd = pDlg->GetSafeHwnd();
|
|
if (hWnd!=NULL)
|
|
{
|
|
pDlg->SendMessage(TARCH_SETTING_MSG_UPDATA);
|
|
}
|
|
}
|
|
break;
|
|
case 1:
|
|
{
|
|
pDlg = m_tab.GetDialogPointer (0);;
|
|
hWnd = pDlg->GetSafeHwnd();
|
|
if (hWnd)
|
|
{
|
|
pDlg->SendMessage(TARCH_SETTING_MSG_UPDATA);
|
|
}
|
|
pDlg = m_tab.GetDialogPointer(2);
|
|
hWnd = pDlg->GetSafeHwnd();
|
|
if (hWnd)
|
|
{
|
|
pDlg->SendMessage(TARCH_SETTING_MSG_UPDATA);
|
|
}
|
|
}
|
|
break;
|
|
case 2:
|
|
{
|
|
pDlg = m_tab.GetDialogPointer (0);;
|
|
hWnd = pDlg->GetSafeHwnd();
|
|
if (hWnd)
|
|
{
|
|
pDlg->SendMessage(TARCH_SETTING_MSG_UPDATA);
|
|
}
|
|
pDlg = m_tab.GetDialogPointer (1);;
|
|
hWnd = pDlg->GetSafeHwnd();
|
|
if (hWnd)
|
|
{
|
|
pDlg->SendMessage(TARCH_SETTING_MSG_UPDATA);
|
|
}
|
|
}
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
ApplySet();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
// Zyu modify on 100726,支持64位
|
|
#ifndef _WIN64
|
|
MessageBox(_T("打开XML文档失败!请安装MSXML4.0SP2组件"));
|
|
#else
|
|
MessageBox(_T("打开XML文档失败!请安装MSXML6.0组件"));
|
|
#endif
|
|
}
|
|
}
|
|
delete pXMLDoc;
|
|
}
|
|
|
|
void COption::OnClickImport()
|
|
{
|
|
CFileDialog dlg(TRUE,
|
|
NULL, // no default extension
|
|
NULL, // ..or file name
|
|
OFN_HIDEREADONLY|OFN_ALLOWMULTISELECT,
|
|
_T("xml Files (*.xml)|*.xml||"));
|
|
if (dlg.DoModal()==IDOK)
|
|
{
|
|
CString strPath = dlg.GetPathName();
|
|
CXMLDOMFile *pXMLDoc = new CXMLDOMFile;
|
|
if (pXMLDoc->IsFileExist(strPath))
|
|
{
|
|
if (!pXMLDoc->Open(strPath))
|
|
{
|
|
delete pXMLDoc;
|
|
pXMLDoc = NULL;
|
|
// Zyu modify on 100726,支持64位
|
|
#ifndef _WIN64
|
|
MessageBox(_T("打开XML文档失败!请安装MSXML4.0SP2组件"));
|
|
#else
|
|
MessageBox(_T("打开XML文档失败!请安装MSXML6.0组件"));
|
|
#endif
|
|
return;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
delete pXMLDoc;
|
|
pXMLDoc = NULL;
|
|
MessageBox(_T("xml文件不存在"));
|
|
return;
|
|
}
|
|
CXMLDOMNodePtr pRoot = pXMLDoc->GetRoot();
|
|
CString strAttriName = pRoot->GetAttributeName();
|
|
CString strAttriValue = pRoot->GetAttributeValue(strAttriName);
|
|
if (strAttriValue !=_T("上华软件设置"))
|
|
{
|
|
delete pXMLDoc;
|
|
pXMLDoc = NULL;
|
|
MessageBox(_T("该文件不是上华设置文件"));
|
|
return;
|
|
}
|
|
int nIndex = m_tab.GetActiveTab();
|
|
CAdUiTabChildDialog *pDlg = NULL;
|
|
pDlg = m_tab.GetDialogPointer (nIndex);
|
|
CString strPageName;
|
|
if (nIndex==0)
|
|
{
|
|
strPageName = _T("基本设定");
|
|
}
|
|
else if (nIndex==1)
|
|
{
|
|
strPageName = _T("墙柱加粗填充");
|
|
}
|
|
else
|
|
{
|
|
strPageName = _T("高级选项");
|
|
}
|
|
CImportXMLDocDlg importDlg(pXMLDoc,strPageName);
|
|
if (importDlg.DoModal()==IDOK)
|
|
{
|
|
CTArchSettingEditTools setEditTool;
|
|
setEditTool.SetXMLDoc(pXMLDoc);
|
|
setEditTool.ImportAllTArchSettingData(importDlg.m_treeXmlDoc.m_mapData);
|
|
pDlg->SendMessage(TARCH_SETTING_MSG_UPDATA);
|
|
HWND hWnd;
|
|
//其他窗口为创建则不发送消息
|
|
switch (nIndex)
|
|
{
|
|
case 0:
|
|
{
|
|
pDlg = m_tab.GetDialogPointer (1);;
|
|
hWnd = pDlg->GetSafeHwnd();
|
|
if (hWnd!=NULL)
|
|
{
|
|
pDlg->SendMessage(TARCH_SETTING_MSG_UPDATA);
|
|
}
|
|
pDlg = m_tab.GetDialogPointer (2);
|
|
hWnd = pDlg->GetSafeHwnd();
|
|
if (hWnd!=NULL)
|
|
{
|
|
pDlg->SendMessage(TARCH_SETTING_MSG_UPDATA);
|
|
}
|
|
}
|
|
break;
|
|
case 1:
|
|
{
|
|
pDlg = m_tab.GetDialogPointer (0);;
|
|
hWnd = pDlg->GetSafeHwnd();
|
|
if (hWnd)
|
|
{
|
|
pDlg->SendMessage(TARCH_SETTING_MSG_UPDATA);
|
|
}
|
|
pDlg = m_tab.GetDialogPointer(2);
|
|
hWnd = pDlg->GetSafeHwnd();
|
|
if (hWnd)
|
|
{
|
|
pDlg->SendMessage(TARCH_SETTING_MSG_UPDATA);
|
|
}
|
|
}
|
|
break;
|
|
case 2:
|
|
{
|
|
pDlg = m_tab.GetDialogPointer (0);;
|
|
hWnd = pDlg->GetSafeHwnd();
|
|
if (hWnd)
|
|
{
|
|
pDlg->SendMessage(TARCH_SETTING_MSG_UPDATA);
|
|
}
|
|
pDlg = m_tab.GetDialogPointer (1);;
|
|
hWnd = pDlg->GetSafeHwnd();
|
|
if (hWnd)
|
|
{
|
|
pDlg->SendMessage(TARCH_SETTING_MSG_UPDATA);
|
|
}
|
|
}
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
ApplySet();
|
|
}
|
|
delete pXMLDoc;
|
|
}
|
|
}
|
|
void COption::OnClickExport()
|
|
{
|
|
CFileDialog dlg(FALSE, _T("xml"), _T("上华配置.xml"), OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT
|
|
, _T("xml文档(*.xml)|*.xml||"));
|
|
|
|
if (dlg.DoModal() != IDOK)
|
|
return;
|
|
CString strPath = dlg.GetPathName();
|
|
CXMLDOMFile *pXMLDoc = new CXMLDOMFile;
|
|
CTArchSettingEditTools setTool;
|
|
setTool.SetXMLDoc(pXMLDoc);
|
|
if (!setTool.ExportTArchSettingData(strPath))
|
|
{
|
|
// Zyu modify on 100726,支持64位
|
|
#ifndef _WIN64
|
|
MessageBox(_T("创建XML文档失败!请安装MSXML4.0SP2组件"));
|
|
#else
|
|
MessageBox(_T("创建XML文档失败!请安装MSXML6.0组件"));
|
|
#endif
|
|
}
|
|
|
|
pXMLDoc->Save();
|
|
delete pXMLDoc;
|
|
}
|
|
void COption::OnClose()
|
|
{
|
|
g_bCancel = TRUE;
|
|
CAcUiTabMainDialog::OnClose();
|
|
}
|
|
void COption::OnDestroy()
|
|
{
|
|
s_nPage = m_tab.GetActiveTab();
|
|
CAcUiTabMainDialog::OnDestroy();
|
|
}
|
|
void COption::OnCancel()
|
|
{
|
|
g_bCancel=TRUE;
|
|
CAcUiTabMainDialog::OnCancel();
|
|
}
|
|
void COption::OnBnClickedOptionHelp()
|
|
{
|
|
XString sTchIni;
|
|
CString csHelpFile;
|
|
if (FindFile(_T("tch.ini"), sTchIni))
|
|
{
|
|
INI_struct *inis=NULL;
|
|
if (CT_get_INIs(sTchIni, _T("Product"), &inis))
|
|
{
|
|
TCHAR *pHelpFile=CT_get_INI2(inis, _T("HelpFile"));
|
|
if (pHelpFile)
|
|
csHelpFile=pHelpFile;
|
|
CT_free_INIs(inis);
|
|
}
|
|
}
|
|
XString sFile;
|
|
if (FindFile((const TCHAR *)csHelpFile, sFile))
|
|
{
|
|
CString csHelpKey;
|
|
GetWindowText(csHelpKey);
|
|
HH_AKLINK link;
|
|
link.cbStruct = sizeof(HH_AKLINK) ;
|
|
link.fReserved = FALSE ;
|
|
link.pszKeywords = csHelpKey;
|
|
link.pszUrl = NULL ;
|
|
link.pszMsgText = NULL ;
|
|
link.pszMsgTitle = NULL ;
|
|
link.pszWindow = NULL ;
|
|
link.fIndexOnFail = TRUE ;
|
|
::HtmlHelp(NULL,(LPCTSTR)sFile,HH_DISPLAY_TOPIC ,NULL);
|
|
//Zyu modify on 100722,支持64位
|
|
//::HtmlHelp(NULL,(LPCTSTR)sFile,HH_KEYWORD_LOOKUP ,(DWORD)&link);
|
|
//::HtmlHelp(NULL,(LPCTSTR)sFile,HH_DISPLAY_INDEX ,(DWORD)(const TCHAR *)csHelpKey);
|
|
::HtmlHelp(NULL,(LPCTSTR)sFile,HH_KEYWORD_LOOKUP ,(DWORD_PTR)&link);
|
|
::HtmlHelp(NULL,(LPCTSTR)sFile,HH_DISPLAY_INDEX ,(DWORD_PTR)(const TCHAR *)csHelpKey);
|
|
}
|
|
}
|
|
|
|
void COption::OnBnClickedRetApply()
|
|
{
|
|
ApplySet();
|
|
acedCommand(RTSTR, _T("REGEN"), RTNONE);
|
|
CButton *pButton = (CButton*)GetDlgItem(IDC_RET_APPLY);
|
|
pButton->EnableWindow(FALSE);
|
|
}
|
|
|
|
void COption::ApplySet()
|
|
{
|
|
m_pageInitSet1.UpdateGlobal();
|
|
//m_pageInitSet2.UpdateGlobal();
|
|
m_pageInitSet3.ApplySetData();
|
|
// XString sCmd=GetFullCmdName(_T("TLoadConfig"));
|
|
// acedCommand(RTSTR,sCmd,RTNONE);
|
|
}
|
|
|
|
void Option()
|
|
{
|
|
XString sFullFileDef;
|
|
if (!FindFile(_T("config.def"), sFullFileDef))
|
|
{
|
|
AfxMessageBox(_T("\n找不到'config.def'文件!"));
|
|
return;
|
|
}
|
|
|
|
XString sFullFile;
|
|
if (!FindFile(_T("config.ini"), sFullFile))
|
|
{
|
|
AfxMessageBox(_T("\n找不到'config.ini'文件!"));
|
|
return;
|
|
}
|
|
|
|
WDict dictCur;
|
|
g_dictCfg.ReadFile(sFullFileDef);//读入标配
|
|
dictCur.ReadFile(sFullFile);//读入当前配置
|
|
if (dictCur.m_sDesc!=g_dictCfg.m_sDesc)//配置版本不同
|
|
g_dictCfg.CopyData(dictCur);//将当前配置尽量复制过来
|
|
else
|
|
{
|
|
g_dictCfg.Clear();
|
|
g_dictCfg.Conbine(dictCur);//直接使用当前配置
|
|
}
|
|
|
|
CAcModuleResourceOverride vTmp;
|
|
COption dlg(acedGetAcadFrame());
|
|
|
|
if (dlg.DoModal()==IDOK)
|
|
{
|
|
g_dictCfg.WriteFile(sFullFile);//写入ini
|
|
XString sCmd=GetFullCmdName(_T("TLoadConfig"));
|
|
acedCommand(RTSTR,sCmd,RTNONE);
|
|
acedCommand(RTSTR, _T("REGEN"), RTNONE);
|
|
|
|
//add by xlc on 090805 线型比例确定后立即生效
|
|
if (g_bAutoLTScale)
|
|
{
|
|
int nTileMode=0;
|
|
VERIFY(xg_getvar(_T("TILEMODE"), &nTileMode)==RTNORM);
|
|
double ltscale=nTileMode? g_nLtMScale : g_nLtPScale;
|
|
xg_setvar(_T("LTSCALE"), ltscale);
|
|
}
|
|
}
|
|
|
|
g_dictCfg.Clear();
|
|
}
|
|
|