DynamicProPage.cpp 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. // DynamicProPage.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. //#include <afxtempl.h>
  5. #include "IDE.h"
  6. #include "DrawObj.h"
  7. #include "DynamicProPage.h"
  8. #include "DynColorDlg.h"
  9. #include "ActionDlg.h"
  10. #include "SelectVariantDlg.h"
  11. #ifdef _DEBUG
  12. #define new DEBUG_NEW
  13. #undef THIS_FILE
  14. static char THIS_FILE[] = __FILE__;
  15. #endif
  16. //const CString actionType[] =
  17. //{
  18. // g_strControl, g_strSet, g_strAdjust, g_strPictureLink, g_strExit, g_strExLink
  19. //};
  20. /////////////////////////////////////////////////////////////////////////////
  21. // CDynamicProPage property page
  22. IMPLEMENT_DYNCREATE(CDynamicProPage, CPropertyPage)
  23. CDynamicProPage::CDynamicProPage() : CPropertyPage(CDynamicProPage::IDD)
  24. {
  25. //{{AFX_DATA_INIT(CDynamicProPage)
  26. m_bVertiSize = FALSE;
  27. m_bVertiPos = FALSE;
  28. m_bOnMove = FALSE;
  29. m_bLineColor = FALSE;
  30. m_bHorizSize = FALSE;
  31. m_bHorizPos = FALSE;
  32. m_bForeColor = FALSE;
  33. m_bOnButtonUp = FALSE;
  34. m_bOnButtonDown = FALSE;
  35. m_bBackColor = FALSE;
  36. m_strHoriPos = _T("");
  37. m_strHoriSize = _T("");
  38. m_strVertiPos = _T("");
  39. m_strVertiSize = _T("");
  40. m_nHorAlign = -1;
  41. m_nVerAlign = -1;
  42. m_arrayActionType[0] = g_strControl;
  43. m_arrayActionType[1] = g_strSet;
  44. m_arrayActionType[2] = g_strAdjust;
  45. m_arrayActionType[3] = g_strPictureLink;
  46. m_arrayActionType[4] = g_strExit;
  47. m_arrayActionType[5] = g_strExLink;
  48. m_arrayActionType[6] = g_strTestAlarm;
  49. m_arrayActionType[7] = g_strAlarmRed;
  50. m_arrayActionType[8] = g_strNoticeRed;
  51. m_arrayActionType[9] = g_strDeviceLog;
  52. m_arrayActionType[10] = g_strSystemLog;
  53. m_arrayActionType[11] = g_strVarManage;
  54. m_arrayActionType[12] = g_strUserManage;
  55. m_arrayActionType[13] = g_strPwdManage;
  56. m_arrayActionType[14] = g_strFirstPage;
  57. m_arrayActionType[15] = g_strNativageTree;
  58. //}}AFX_DATA_INIT
  59. }
  60. CDynamicProPage::~CDynamicProPage()
  61. {
  62. }
  63. void CDynamicProPage::DoDataExchange(CDataExchange* pDX)
  64. {
  65. CPropertyPage::DoDataExchange(pDX);
  66. //{{AFX_DATA_MAP(CDynamicProPage)
  67. DDX_Check(pDX, IDC_CHECKVERTISIZE, m_bVertiSize);
  68. DDX_Check(pDX, IDC_CHECKVERTIPOSITION, m_bVertiPos);
  69. DDX_Check(pDX, IDC_CHECKMOUSEMOVE, m_bOnMove);
  70. DDX_Check(pDX, IDC_CHECKLINECOLOR, m_bLineColor);
  71. DDX_Check(pDX, IDC_CHECKHORIZSIZE, m_bHorizSize);
  72. DDX_Check(pDX, IDC_CHECKHORIZPOSITION, m_bHorizPos);
  73. DDX_Check(pDX, IDC_CHECKFORECOLOR, m_bForeColor);
  74. DDX_Check(pDX, IDC_CHECKBUTTONUP, m_bOnButtonUp);
  75. DDX_Check(pDX, IDC_CHECKBUTTONDOWN, m_bOnButtonDown);
  76. DDX_Check(pDX, IDC_CHECKBACKCOLOR, m_bBackColor);
  77. DDX_Text(pDX, IDC_HORIPOSITION, m_strHoriPos);
  78. DDX_Text(pDX, IDC_HORISIZE, m_strHoriSize);
  79. DDX_Text(pDX, IDC_VERTIPOSITION, m_strVertiPos);
  80. DDX_Text(pDX, IDC_VERTISIZE, m_strVertiSize);
  81. DDX_Radio(pDX, IDC_HORALIGN, m_nHorAlign);
  82. DDX_Radio(pDX, IDC_VERALIGN, m_nVerAlign);
  83. //}}AFX_DATA_MAP
  84. }
  85. BEGIN_MESSAGE_MAP(CDynamicProPage, CPropertyPage)
  86. //{{AFX_MSG_MAP(CDynamicProPage)
  87. ON_BN_CLICKED(IDC_SETFORECOLOR, OnSetforecolor)
  88. ON_BN_CLICKED(IDC_SETLINECOLOR, OnSetlinecolor)
  89. ON_BN_CLICKED(IDC_SETBACKCOLOR, OnSetbackcolor)
  90. ON_BN_CLICKED(IDC_SETBUTTONDOWN, OnSetbuttondown)
  91. ON_BN_CLICKED(IDC_SETBUTTONUP, OnSetbuttonup)
  92. ON_BN_CLICKED(IDC_SETMOUSEMOVE, OnSetmousemove)
  93. ON_BN_CLICKED(IDC_HSIZECONEDIT, OnHsizeconedit)
  94. ON_BN_CLICKED(IDC_VSIZECONEDIT, OnVsizeconedit)
  95. ON_BN_CLICKED(IDC_HPOSCONEDIT, OnHposconedit)
  96. ON_BN_CLICKED(IDC_VPOSCONEDIT, OnVposconedit)
  97. //}}AFX_MSG_MAP
  98. END_MESSAGE_MAP()
  99. /////////////////////////////////////////////////////////////////////////////
  100. // CDynamicProPage message handlers
  101. void CDynamicProPage::OnSetforecolor()
  102. {
  103. CDynColorDlg dlg;
  104. dlg.m_clr = m_clrForeColor;
  105. dlg.m_strCon = m_strForeColorCondition;
  106. if (dlg.DoModal() == IDOK)
  107. {
  108. m_clrForeColor = dlg.m_clr;
  109. m_strForeColorCondition = dlg.m_strCon;
  110. }
  111. }
  112. void CDynamicProPage::OnSetlinecolor()
  113. {
  114. CDynColorDlg dlg;
  115. dlg.m_clr = m_clrLineColor;
  116. dlg.m_strCon = m_strFLineColorCondition;
  117. if (dlg.DoModal() == IDOK)
  118. {
  119. m_clrLineColor = dlg.m_clr;
  120. m_strFLineColorCondition = dlg.m_strCon;
  121. }
  122. }
  123. void CDynamicProPage::OnSetbackcolor()
  124. {
  125. CDynColorDlg dlg;
  126. dlg.m_clr = m_clrBackColor;
  127. dlg.m_strCon = m_strBackColorCondition;
  128. if (dlg.DoModal() == IDOK)
  129. {
  130. m_clrBackColor = dlg.m_clr;
  131. m_strBackColorCondition = dlg.m_strCon;
  132. }
  133. }
  134. void CDynamicProPage::OnSetbuttondown()
  135. {
  136. CActionDlg dlg;
  137. dlg.m_strActionType = m_arrayActionType[m_downAction.m_nActionType];
  138. dlg.m_strActionValue = m_downAction.m_strActionValue;
  139. dlg.m_strVariant = m_downAction.m_strVariant;
  140. //dlg.m_strPicPath = m_downAction.m_strPicPath;
  141. char picDir[_MAX_PATH] = {0};
  142. strcpy(picDir, g_strDirectory);
  143. strcat(picDir, "\\");
  144. strcat(picDir, _PICTUREDIR);
  145. strcat(picDir, m_downAction.m_strVariant);
  146. dlg.m_strPicPath = picDir;
  147. if (dlg.DoModal() == IDOK)
  148. {
  149. for (int i = 0; i<16; i++)
  150. {
  151. if ( m_arrayActionType[i] == dlg.m_strActionType )
  152. {
  153. m_downAction.m_nActionType = i;
  154. break;
  155. }
  156. }
  157. m_downAction.m_strActionValue = dlg.m_strActionValue;
  158. m_downAction.m_strVariant = dlg.m_strVariant;
  159. m_downAction.m_strPicPath = dlg.m_strPicPath;
  160. }
  161. }
  162. void CDynamicProPage::OnSetbuttonup()
  163. {
  164. CActionDlg dlg;
  165. dlg.m_strActionType = m_arrayActionType[m_upAction.m_nActionType];
  166. dlg.m_strActionValue = m_upAction.m_strActionValue;
  167. dlg.m_strVariant = m_upAction.m_strVariant;
  168. //dlg.m_strPicPath = m_upAction.m_strPicPath;
  169. char picDir[_MAX_PATH] = {0};
  170. strcpy(picDir, g_strDirectory);
  171. strcat(picDir, "\\");
  172. strcat(picDir, _PICTUREDIR);
  173. strcat(picDir, m_downAction.m_strVariant);
  174. dlg.m_strPicPath = picDir;
  175. if (dlg.DoModal() == IDOK)
  176. {
  177. for (int i = 0; i<16; i++)
  178. {
  179. if ( m_arrayActionType[i] == dlg.m_strActionType )
  180. {
  181. m_upAction.m_nActionType = i;
  182. }
  183. }
  184. m_upAction.m_strActionValue = dlg.m_strActionValue;
  185. m_upAction.m_strVariant = dlg.m_strVariant;
  186. m_upAction.m_strPicPath = dlg.m_strPicPath;
  187. }
  188. }
  189. void CDynamicProPage::OnSetmousemove()
  190. {
  191. CActionDlg dlg;
  192. dlg.m_strActionType = m_arrayActionType[m_moveAction.m_nActionType];
  193. dlg.m_strActionValue = m_moveAction.m_strActionValue;
  194. dlg.m_strVariant = m_moveAction.m_strVariant;
  195. //dlg.m_strPicPath = m_moveAction.m_strPicPath;
  196. char picDir[_MAX_PATH] = {0};
  197. strcpy(picDir, g_strDirectory);
  198. strcat(picDir, "\\");
  199. strcat(picDir, _PICTUREDIR);
  200. strcat(picDir, m_downAction.m_strVariant);
  201. dlg.m_strPicPath = picDir;
  202. if (dlg.DoModal() == IDOK)
  203. {
  204. for (int i = 0; i<16; i++)
  205. {
  206. if ( m_arrayActionType[i] == dlg.m_strActionType )
  207. {
  208. m_moveAction.m_nActionType = i;
  209. }
  210. }
  211. m_moveAction.m_strActionValue = dlg.m_strActionValue;
  212. m_moveAction.m_strVariant = dlg.m_strVariant;
  213. m_moveAction.m_strPicPath = dlg.m_strPicPath;
  214. }
  215. }
  216. void CDynamicProPage::OnHsizeconedit()
  217. {
  218. CFormatEditDlg dlg;
  219. dlg.m_strFormat = m_strHoriSize;
  220. if ( dlg.DoModal() == IDOK )
  221. {
  222. m_strHoriSize = dlg.m_strFormat;
  223. UpdateData(false);
  224. }
  225. }
  226. void CDynamicProPage::OnVsizeconedit()
  227. {
  228. CFormatEditDlg dlg;
  229. dlg.m_strFormat = m_strVertiSize;
  230. if ( dlg.DoModal() == IDOK )
  231. {
  232. m_strVertiSize = dlg.m_strFormat;
  233. UpdateData(false);
  234. }
  235. }
  236. void CDynamicProPage::OnHposconedit()
  237. {
  238. CFormatEditDlg dlg;
  239. dlg.m_strFormat = m_strHoriPos;
  240. if ( dlg.DoModal() == IDOK )
  241. {
  242. m_strHoriPos = dlg.m_strFormat;
  243. UpdateData(false);
  244. }
  245. }
  246. void CDynamicProPage::OnVposconedit()
  247. {
  248. CFormatEditDlg dlg;
  249. dlg.m_strFormat = m_strVertiPos;
  250. if ( dlg.DoModal() == IDOK )
  251. {
  252. m_strVertiPos = dlg.m_strFormat;
  253. UpdateData(false);
  254. }
  255. }