492 lines
13 KiB
C++
492 lines
13 KiB
C++
#if !defined _OPTIONSHEET_H__
|
|
#define _OPTIONSHEET_H__
|
|
|
|
#if _MSC_VER > 1000
|
|
#pragma once
|
|
#endif // _MSC_VER > 1000
|
|
#define IDC_BUTTONIMPORTOPTION 6000
|
|
#define IDC_BUTTONEXPORTOPTION 6001
|
|
#define IDC_BUTTONDEFULTOPTION 6002
|
|
#define IDC_BUTTONDAPPLY 6003
|
|
#ifndef TARCH_SETTING_MSG_UPDATA
|
|
#define TARCH_SETTING_MSG_UPDATA WM_USER+102
|
|
#define TARCH_SETTING_MSG_BUTTONSTATION WM_USER+103
|
|
#define TARCH_SETTING_MSG_BUTTONOK WM_USER+104
|
|
#endif
|
|
#include "wdgrid.h"
|
|
#include "btnsticon.h"
|
|
#include "resource.h"
|
|
#include "fontpropertypage.h"
|
|
#include "UserOpreatorSet.h"
|
|
#include "ImportXMLDocDlg.h"
|
|
#include "adui.h"
|
|
#include "acui.h"
|
|
class CCommandDlg;
|
|
class CToolbarData ;
|
|
struct CBlockStruct;
|
|
|
|
class CScreenMenuPage:public CAcUiTabChildDialog
|
|
{
|
|
DECLARE_DYNAMIC(CScreenMenuPage)
|
|
public:
|
|
int m_iMenuType;
|
|
enum { IDD = IDD_SCREENMENU_PAGE };
|
|
BOOL m_bLimitHeight;
|
|
BOOL m_bAutoOpenFirst;
|
|
BOOL m_bScrollBar;
|
|
BOOL m_bScreenMenu;//add by fxj 080925
|
|
//add by xlc on 071019
|
|
BOOL m_bModified;
|
|
BOOL m_bPreview;
|
|
CInPlaceEdit m_cBkCol1;
|
|
CInPlaceEdit m_cBkCol2;
|
|
CInPlaceEdit m_cBkCol3;
|
|
CInPlaceEdit m_cBkCol4;
|
|
|
|
int m_nMenuBKColor1;
|
|
int m_nMenuBKColor2;
|
|
int m_nMenuBKColor3;
|
|
int m_nMenuBKColor4;
|
|
BOOL m_bChecked;
|
|
public:
|
|
CScreenMenuPage(CWnd* pParent = NULL);
|
|
virtual BOOL OnInitDialog();
|
|
virtual void DoDataExchange(CDataExchange*pDX);
|
|
void ApplySet();
|
|
void LoadMenu();
|
|
// void UpdataScreenMenuData(const Array<CXMLNodeInfoEx> &aryData);
|
|
//add by xlc on 071019
|
|
afx_msg void OnBkColor1();
|
|
afx_msg void OnBkColor2();
|
|
afx_msg void OnBkColor3();
|
|
afx_msg void OnBkColor4();
|
|
afx_msg void OnButtonPreview();
|
|
afx_msg void OnButtonDefault();
|
|
afx_msg void OnStnClickedMenu();
|
|
afx_msg LRESULT OnReUpdataDlg(WPARAM w,LPARAM l);// 更新对话框
|
|
afx_msg void OnBnClickedRadio1();
|
|
afx_msg void OnBnClickedRadio2();
|
|
afx_msg void OnBnClickedScrollBar();
|
|
afx_msg void OnBnClickedOpenFirst();
|
|
DECLARE_MESSAGE_MAP()
|
|
//public:
|
|
void SetDataToWin();
|
|
};
|
|
////////////////////////////////////////////////
|
|
class TKeyMap
|
|
{
|
|
public:
|
|
CString sKey;
|
|
CString sCommand;
|
|
CString sNote;
|
|
|
|
bool operator>(const TKeyMap&map)const{return sCommand>map.sCommand;}
|
|
bool operator<(const TKeyMap&map)const{return map.sCommand>sCommand;}
|
|
};
|
|
////////////////////////////////////////////////
|
|
class TKeyMapTable : public TKeyMaps,public DualList<TKeyMap>
|
|
{
|
|
public:
|
|
virtual BOOL Key2Command(CString&sCommand)const;
|
|
BOOL ReadShortCutKey();
|
|
BOOL WriteShortCutKey();
|
|
};
|
|
|
|
/////////////////////////////////////
|
|
class CCommandDlg : public GlwCAcUiDialog
|
|
{
|
|
// Construction
|
|
public:
|
|
CCommandDlg(CWnd* pParent = NULL);
|
|
|
|
// Dialog Data
|
|
//{{AFX_DATA(CCommandDlg)
|
|
enum { IDD = IDD_DIALOG_CMD };
|
|
CListCtrl m_listCmd;
|
|
CListBox m_listType;
|
|
CListCtrl m_listMenu;
|
|
//}}AFX_DATA
|
|
|
|
int m_iType;
|
|
CString m_csCmd;
|
|
CString m_strCnName;
|
|
XStringList m_lstType;
|
|
DList<CToolbarData> m_lstToolbarData;
|
|
XString m_xsDllFile, m_xsDbfFile;
|
|
CImageList m_imageCmd;
|
|
|
|
BOOL m_bClick;
|
|
void ResetMenuTip();
|
|
void ResetCmdTip();
|
|
void GetCurrentCmd();
|
|
void ResetListCmd();
|
|
// Overrides
|
|
// ClassWizard generated virtual function overrides
|
|
//{{AFX_VIRTUAL(CCommandDlg)
|
|
protected:
|
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
|
//}}AFX_VIRTUAL
|
|
|
|
// Implementation
|
|
protected:
|
|
|
|
// Generated message map functions
|
|
//{{AFX_MSG(CCommandDlg)
|
|
// NOTE: the ClassWizard will add member functions here
|
|
virtual BOOL OnInitDialog();
|
|
virtual void OnOK();
|
|
afx_msg void OnItemchangedListMenu(NMHDR* pNMHDR, LRESULT* pResult);
|
|
afx_msg void OnItemchangedListCmd(NMHDR* pNMHDR, LRESULT* pResult);
|
|
afx_msg void OnClickListMenu(NMHDR* pNMHDR, LRESULT* pResult);
|
|
afx_msg void OnDblClkListCmd(NMHDR* pNMHDR, LRESULT* pResult);
|
|
afx_msg void OnSelchangeListType();
|
|
//}}AFX_MSG
|
|
DECLARE_MESSAGE_MAP()
|
|
};
|
|
//add by xlc on 071018
|
|
class CPgpStruck
|
|
{
|
|
public:
|
|
CString m_strType;
|
|
CString m_strCmd;
|
|
};
|
|
//add by xlc on 071018
|
|
class CCommandPgpDlg : public GlwCAcUiDialog
|
|
{
|
|
// Construction
|
|
public:
|
|
CCommandPgpDlg(CWnd* pParent = NULL);
|
|
|
|
// Dialog Data
|
|
//{{AFX_DATA(CCommandPgpDlg)
|
|
enum { IDD = IDD_DIALOG_PGP };
|
|
CListBox m_listCmd;
|
|
CListBox m_listType;
|
|
//}}AFX_DATA
|
|
|
|
CString m_strCmd;
|
|
CString m_strType;
|
|
CStringArray m_strTypeArray;
|
|
Array<CPgpStruck> m_lstPgpCmd;
|
|
XString m_xsAcadPgp;
|
|
|
|
void ResetListCmd();
|
|
// Overrides
|
|
// ClassWizard generated virtual function overrides
|
|
//{{AFX_VIRTUAL(CCommandPgpDlg)
|
|
protected:
|
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
|
//}}AFX_VIRTUAL
|
|
|
|
// Implementation
|
|
protected:
|
|
|
|
// Generated message map functions
|
|
//{{AFX_MSG(CCommandPgpDlg)
|
|
// NOTE: the ClassWizard will add member functions here
|
|
virtual BOOL OnInitDialog();
|
|
virtual void OnOK();
|
|
afx_msg void OnDblclkListCmd();
|
|
afx_msg void OnSelchangeListType();
|
|
//}}AFX_MSG
|
|
DECLARE_MESSAGE_MAP()
|
|
};
|
|
|
|
////////////////////////////////////////////////
|
|
//class CShortCutKeyPage;
|
|
class TKeyGrid : public WDGrid
|
|
{
|
|
public:
|
|
bool BeModefy(){return m_bModified;}
|
|
virtual bool OnModified(WDGridCell &cell, CString &text)
|
|
{
|
|
if (cell.GetColIndex()==0)
|
|
{
|
|
text.MakeLower();
|
|
text=text.Left(1);
|
|
|
|
if (text.IsEmpty() || (text.Compare(_T(" ")) == 0))
|
|
{
|
|
int ret = MessageBox(_T("您确定要使用空格作为快捷方式?"), NULL, MB_YESNO | MB_ICONWARNING);
|
|
if (ret == IDNO)
|
|
return false;
|
|
text = _T(" ");
|
|
}
|
|
|
|
for(MoveToFirst(); !IsOut(); MoveToNext())
|
|
{
|
|
WDGridRow *pRow = CurRow();
|
|
CString szKey = (*pRow)[0].GetText();
|
|
if (cell.GetColIndex()==0&&text == szKey&&szKey!=_T(""))
|
|
{
|
|
MessageBox(XString(_T("快捷键'%s'已经被使用,请选择其它键!"), text));
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
GetParent()->SendMessage(TARCH_SETTING_MSG_BUTTONSTATION);
|
|
return true;
|
|
}
|
|
|
|
//add by xlc on 070924
|
|
virtual bool OnCellButtonDown(WDGridCell&cell,CString&res)
|
|
{
|
|
if (cell.GetColIndex() == 1)
|
|
{
|
|
CString strItem=cell.GetText();
|
|
CAcModuleResourceOverride vTemp;
|
|
CCommandDlg dlg;
|
|
dlg.m_strCnName=strItem;
|
|
if (dlg.DoModal() == IDOK)
|
|
{
|
|
res = dlg.m_csCmd;
|
|
|
|
if (res.IsEmpty())
|
|
return false;
|
|
|
|
WDGridRow &row=cell.GetRow();
|
|
row[cell.GetColIndex()+1].SetText(dlg.m_strCnName);
|
|
row[cell.GetColIndex()+1].Refresh();
|
|
OnDataChanged();
|
|
|
|
AutoCloseCell(1);
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
|
|
}
|
|
};
|
|
|
|
class WDGridPgp : public WDGrid
|
|
{
|
|
public:
|
|
WDGridPgp();
|
|
virtual bool OnBeforeInsertRow(long i,WDGridRow*&pNewRow);//将插入一行
|
|
virtual bool OnBeforeInsertChild(WDGridTreeRow&row,long iChild,WDGridTreeRow*&pChild);//将插入一子行
|
|
virtual void OnEndDeleteRow();//删除行结束
|
|
virtual bool OnModified(WDGridCell&cell,CString &text);//单元内容将改变为text,返回值代表是否确定
|
|
virtual bool OnBeforeEdit(WDGridCell&cell,bool &bModified);
|
|
virtual bool OnCellButtonDown(WDGridCell&cell,CString&res);
|
|
virtual void OnRClickRow(WDGridRow&row,CPoint point); //右键菜单
|
|
|
|
afx_msg void OnAddTree();
|
|
DECLARE_MESSAGE_MAP()
|
|
|
|
};
|
|
////////////////////////////////////////////////
|
|
// CShortCutKeyPage 对话框
|
|
|
|
class CShortCutKeyPage : public CAcUiTabChildDialog
|
|
{
|
|
DECLARE_DYNAMIC(CShortCutKeyPage)
|
|
|
|
public:
|
|
CShortCutKeyPage(CWnd* pParent = NULL);
|
|
void WriteShortCutKey();
|
|
void ApplyShortCutKey();
|
|
// 对话框数据
|
|
enum { IDD = IDD_SHORTCUTKEY_PAGE };
|
|
BOOL m_bEnable;
|
|
BOOL m_bChecked;
|
|
protected:
|
|
TKeyGrid m_grid;
|
|
WDGridPgp m_treePgp;
|
|
DList<CToolbarData> m_lstToolbarData;
|
|
int m_nRaidoTg;
|
|
CStringArray m_strNoteArray; //记录文件中的注释及外部命令
|
|
public:
|
|
bool BGridModify(){return m_grid.BeModefy();}
|
|
virtual BOOL OnInitDialog();
|
|
virtual void DoDataExchange(CDataExchange*pDX);
|
|
void InitGrid();
|
|
void InitGridTree();
|
|
void ReadPgp();
|
|
void WritePgp();
|
|
void UpdateShortCutKeyPage();
|
|
XString m_xsAcadPgp;
|
|
// Generated message map functions
|
|
//{{AFX_MSG(CShortCutKeyPage)
|
|
afx_msg void OnRadioTG();
|
|
afx_msg void OnRadioACAD();
|
|
afx_msg void OnButtonTree();
|
|
afx_msg void OnButtonRow();
|
|
afx_msg void OnButtonDel();
|
|
afx_msg LRESULT OnReUpdataDlg(WPARAM w,LPARAM l);// 更新对话框
|
|
afx_msg void OnBnClickedEnable();
|
|
afx_msg LRESULT OnUpdataApplyButton(WPARAM w,LPARAM l);
|
|
//}}AFX_MSG
|
|
DECLARE_MESSAGE_MAP()
|
|
protected:
|
|
virtual void OnOK();
|
|
};
|
|
|
|
|
|
struct CBlockStruct {
|
|
CString m_csTKName;
|
|
CString m_csRecord;
|
|
CString m_csDesName;
|
|
};
|
|
|
|
class CToolbarData
|
|
{
|
|
public:
|
|
CToolbarData(const TCHAR* szType, const TCHAR* szCmd, const TCHAR* szName,
|
|
const TCHAR* szDescribe, const TCHAR* szIcon, int iHit)
|
|
{ m_csType = szType; m_csCmd = szCmd;
|
|
m_csName = szName; m_csDescribe = szDescribe;
|
|
m_csIcon = szIcon; m_iHit = iHit;
|
|
};
|
|
virtual ~CToolbarData(){}
|
|
CString m_csType, m_csCmd, m_csName, m_csDescribe, m_csIcon;
|
|
int m_iHit;
|
|
static int SortByItem(const CToolbarData *, const CToolbarData *);
|
|
|
|
};
|
|
|
|
inline int IntCmp(const int *i, const int *j)
|
|
{
|
|
if (*i < *j)
|
|
return -1;
|
|
else if (*i > *j)
|
|
return 1;
|
|
else
|
|
return 0;
|
|
}
|
|
|
|
inline int CToolbarData::SortByItem(const CToolbarData *p1, const CToolbarData *p2)
|
|
{
|
|
CToolbarData *pp1 = (CToolbarData *)p1,
|
|
*pp2 = (CToolbarData *)p2;
|
|
return IntCmp(&pp1->m_iHit, &pp2->m_iHit);
|
|
}
|
|
|
|
|
|
class CSetToolbarPage : public CAcUiTabChildDialog
|
|
{
|
|
DECLARE_DYNAMIC(CSetToolbarPage)
|
|
// Construction
|
|
public:
|
|
CSetToolbarPage(CWnd* pParent = NULL); // standard constructor
|
|
|
|
// Dialog Data
|
|
//{{AFX_DATA(CSetToolbarPage)
|
|
enum { IDD = IDD_TOOLBAR_PAGE };
|
|
BOOL m_bChecked;
|
|
CIconButton m_butHelp;
|
|
CListCtrl m_listToolbar;
|
|
CListCtrl m_listMenu;
|
|
CComboBox m_comboType;
|
|
int m_iType;
|
|
CString m_csAlias;
|
|
CString m_csCmd;
|
|
//}}AFX_DATA
|
|
DList<CToolbarData> m_lstToolbarData;
|
|
DList<CBlockStruct> m_lstAlias;
|
|
XStringList m_lstType;
|
|
BOOL m_bModifyAlias;
|
|
BOOL m_bInit;
|
|
XString m_xsDllFile, m_xsDbfFile, m_xsAcadPgp;
|
|
|
|
//add by xlc on 071015
|
|
HICON m_hIcon;
|
|
CListCtrl* m_pDragList; //Which ListCtrl we are dragging FROM
|
|
CListCtrl* m_pDropList; //Which ListCtrl we are dropping ON
|
|
CImageList* m_pDragImage; //For creating and managing the drag-image
|
|
BOOL m_bDragging; //T during a drag operation
|
|
int m_nDragIndex; //Index of selected item in the List we are dragging FROM
|
|
int m_nDropIndex; //Index at which to drop item in the List we are dropping ON
|
|
CWnd* m_pDropWnd; //Pointer to window we are dropping on (will be cast to CListCtrl* type)
|
|
BOOL m_bModified; //是否修改
|
|
CStringArray m_strSelectItem;//记录选中项的字符串数组
|
|
void AdjustToolbar();
|
|
void DropItemOnList(CListCtrl* pDragList, CListCtrl* pDropList);
|
|
|
|
|
|
void CreateToolbars();
|
|
void UpdateListTooBar(const CStringArray& aryStrName);
|
|
void ApplySetToolBar();
|
|
// Overrides
|
|
// ClassWizard generated virtual function overrides
|
|
//{{AFX_VIRTUAL(CSetToolbarPage)
|
|
protected:
|
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
|
//}}AFX_VIRTUAL
|
|
|
|
// Implementation
|
|
protected:
|
|
const TCHAR* GetAlias(const TCHAR* szCmd);
|
|
void ResetListMenu();
|
|
void ResetListToolbar();
|
|
void ReReadFile();
|
|
void ReadPgp();
|
|
void WritePgp();
|
|
void RemoveIten(int nIndex);
|
|
CImageList m_imageMenu, m_imageToolbar;
|
|
// Generated message map functions
|
|
//{{AFX_MSG(CSetToolbarPage)
|
|
virtual BOOL OnInitDialog();
|
|
afx_msg void OnButAdd();
|
|
afx_msg void OnButRemove();
|
|
afx_msg void OnSelchangeComboType();
|
|
afx_msg void OnDestroy();
|
|
virtual void OnOK();
|
|
afx_msg void OnDblclkListMenu(NMHDR* pNMHDR, LRESULT* pResult);
|
|
afx_msg void OnDblclkListToolbar(NMHDR* pNMHDR, LRESULT* pResult);
|
|
afx_msg void OnButtonUp();
|
|
afx_msg void OnButtonDown();
|
|
afx_msg void OnItemchangedListMenu(NMHDR* pNMHDR, LRESULT* pResult);
|
|
afx_msg void OnButModify();
|
|
afx_msg LRESULT OnReUpdataDlg(WPARAM w,LPARAM l);// 更新对话框
|
|
afx_msg LRESULT OnReOK(WPARAM w,LPARAM l);// 更新对话框
|
|
//add by xlc on 071015
|
|
afx_msg HCURSOR OnQueryDragIcon();
|
|
afx_msg void OnBegindragList(NMHDR* pNMHDR, LRESULT* pResult);
|
|
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
|
|
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
|
|
|
|
//}}AFX_MSG
|
|
DECLARE_MESSAGE_MAP()
|
|
};
|
|
|
|
// COptionSheet
|
|
|
|
class COptionSheet : public CAcUiTabMainDialog
|
|
{
|
|
DECLARE_DYNAMIC(COptionSheet)
|
|
|
|
public:
|
|
COptionSheet(CWnd* pParentWnd = NULL);
|
|
enum { IDD = IDD_SELFOPTION };
|
|
virtual ~COptionSheet();
|
|
virtual BOOL OnInitDialog();
|
|
virtual void DoDataExchange(CDataExchange* pDX);
|
|
afx_msg void OnDestroy();
|
|
virtual void OnOK();
|
|
afx_msg void OnCommandHelp();
|
|
afx_msg void OnClickImportOption();
|
|
afx_msg void OnClickExportOption();
|
|
afx_msg void OnClickDefaultOption();
|
|
afx_msg void OnClickApply();
|
|
afx_msg LRESULT OnUpdataApplyButton(WPARAM w,LPARAM l);// 更新对话框
|
|
virtual void OnCancel();
|
|
CFontPropertyPage m_FontDlgPage;
|
|
CSetToolbarPage m_pageToolBar;
|
|
CShortCutKeyPage m_pageShortCutKey;
|
|
CScreenMenuPage m_pageScreenMenu;
|
|
CUserOpreatorSet m_pageUserOperator;
|
|
CAcUiTab m_tab;
|
|
static int c_iSelectPage;
|
|
CButton m_btnDefault;
|
|
CButton m_btnImport;
|
|
CButton m_btnExport;
|
|
CButton m_btnApply;
|
|
DECLARE_MESSAGE_MAP()
|
|
//应用数据
|
|
void ApplyData(int nIndex);
|
|
public:
|
|
};
|
|
|
|
|
|
|
|
#endif |