OptionsGeneral.cpp 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655
  1. // OptionsGeneral.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "CP_Main.h"
  5. #include "OptionsGeneral.h"
  6. #include "InternetUpdate.h"
  7. #include <io.h>
  8. #include <Mmsystem.h> //play sound
  9. #include "Path.h"
  10. #include "AdvGeneral.h"
  11. #include "DimWnd.h"
  12. #include "HyperLink.h"
  13. using namespace nsPath;
  14. #define DEFAULT_THEME _T("(Ditto)")
  15. #ifdef _DEBUG
  16. #define new DEBUG_NEW
  17. #undef THIS_FILE
  18. static char THIS_FILE[] = __FILE__;
  19. #endif
  20. /////////////////////////////////////////////////////////////////////////////
  21. // COptionsGeneral property page
  22. IMPLEMENT_DYNCREATE(COptionsGeneral, CPropertyPage)
  23. COptionsGeneral::COptionsGeneral() : CPropertyPage(COptionsGeneral::IDD)
  24. {
  25. m_csTitle = theApp.m_Language.GetString("GeneralTitle", "General");
  26. m_psp.pszTitle = m_csTitle;
  27. m_psp.dwFlags |= PSP_USETITLE;
  28. memset(&m_LogFont, 0, sizeof(LOGFONT));
  29. //{{AFX_DATA_INIT(COptionsGeneral)
  30. //}}AFX_DATA_INIT
  31. }
  32. COptionsGeneral::~COptionsGeneral()
  33. {
  34. }
  35. void COptionsGeneral::DoDataExchange(CDataExchange* pDX)
  36. {
  37. CPropertyPage::DoDataExchange(pDX);
  38. //{{AFX_DATA_MAP(COptionsGeneral)
  39. //DDX_Control(pDX, IDC_ENSURE, m_EnsureConnected);
  40. // DDX_Control(pDX, IDC_EDIT_SAVE_DELAY, m_SaveDelay);
  41. DDX_Control(pDX, IDC_COMBO_LANGUAGE, m_cbLanguage);
  42. DDX_Control(pDX, IDC_PATH, m_ePath);
  43. DDX_Control(pDX, IDC_EXPIRE_AFTER, m_eExpireAfter);
  44. DDX_Control(pDX, IDC_MAX_SAVED_COPIES, m_eMaxSavedCopies);
  45. DDX_Control(pDX, IDC_EXPIRE, m_btExpire);
  46. DDX_Control(pDX, IDC_START_ON_STARTUP, m_btRunOnStartup);
  47. DDX_Control(pDX, IDC_EDIT_APP_COPY_INCLUDE, m_copyAppInclude);
  48. DDX_Control(pDX, IDC_EDIT_APP_COPY_EXCLUDE, m_copyAppExclude);
  49. DDX_Control(pDX, IDC_MAXIMUM, m_btMaximumCheck);
  50. //}}AFX_DATA_MAP
  51. DDX_Control(pDX, IDC_COMBO_THEME, m_cbTheme);
  52. DDX_Control(pDX, IDC_BUTTON_FONT, m_btFont);
  53. DDX_Control(pDX, IDC_BUTTON_DEFAULT_FAULT, m_btDefaultButton);
  54. DDX_Control(pDX, IDC_COMBO_POPUP_POSITION, m_popupPositionCombo);
  55. DDX_Control(pDX, IDC_MFCLINK_ENV_VAR, m_envVarLink);
  56. }
  57. BEGIN_MESSAGE_MAP(COptionsGeneral, CPropertyPage)
  58. //{{AFX_MSG_MAP(COptionsGeneral)
  59. ON_BN_CLICKED(IDC_GET_PATH, OnGetPath)
  60. ON_BN_CLICKED(IDC_BUTTON_ABOUT, OnButtonAbout)
  61. //}}AFX_MSG_MAP
  62. ON_BN_CLICKED(IDC_BUTTON_ADVANCED, &COptionsGeneral::OnBnClickedButtonAdvanced)
  63. ON_WM_CTLCOLOR()
  64. ON_BN_CLICKED(IDC_BUTTON_THEME, &COptionsGeneral::OnBnClickedButtonTheme)
  65. ON_BN_CLICKED(IDC_BUTTON_DEFAULT_FAULT, &COptionsGeneral::OnBnClickedButtonDefaultFault)
  66. ON_BN_CLICKED(IDC_BUTTON_FONT, &COptionsGeneral::OnBnClickedButtonFont)
  67. ON_EN_CHANGE(IDC_PATH, &COptionsGeneral::OnEnChangePath)
  68. END_MESSAGE_MAP()
  69. /////////////////////////////////////////////////////////////////////////////
  70. // COptionsGeneral message handlers
  71. BOOL COptionsGeneral::OnInitDialog()
  72. {
  73. CPropertyPage::OnInitDialog();
  74. CString url = _T("https://sourceforge.net/p/ditto-cp/wiki/EnvironmentVariables/");
  75. /*m_envVarLink.SetURL(_T("\"") + url);
  76. m_envVarLink.SetFontSize(-9);*/
  77. m_brush.CreateSolidBrush(RGB(251, 251, 251));
  78. m_pParent = (COptionsSheet *)GetParent();
  79. #ifndef _DEBUG
  80. if (CGetSetOptions::GetIsWindowsApp())
  81. {
  82. m_btRunOnStartup.SetCheck(BST_CHECKED);
  83. GetDlgItem(IDC_START_ON_STARTUP)->EnableWindow(FALSE);
  84. }
  85. else
  86. {
  87. m_btRunOnStartup.SetCheck(CGetSetOptions::GetRunOnStartUp());
  88. }
  89. #endif
  90. m_btMaximumCheck.SetCheck(CGetSetOptions::GetCheckForMaxEntries());
  91. m_btExpire.SetCheck(CGetSetOptions::GetCheckForExpiredEntries());
  92. m_eExpireAfter.SetNumber(CGetSetOptions::GetExpiredEntries());
  93. m_eMaxSavedCopies.SetNumber(CGetSetOptions::GetMaxEntries());
  94. if(CGetSetOptions::GetDisableExpireClipsConfig())
  95. {
  96. m_btMaximumCheck.EnableWindow(FALSE);
  97. m_btExpire.EnableWindow(FALSE);
  98. m_eExpireAfter.EnableWindow(FALSE);
  99. m_eMaxSavedCopies.EnableWindow(FALSE);
  100. }
  101. m_copyAppInclude.SetWindowText(g_Opt.GetCopyAppInclude());
  102. m_copyAppExclude.SetWindowText(g_Opt.GetCopyAppExclude());
  103. CString csPath = CGetSetOptions::GetDBPath(false);
  104. m_ePath.SetWindowText(csPath);
  105. CGetSetOptions::GetFont(m_LogFont);
  106. CString cs;
  107. cs.Format(_T("Font - %s (%d)"), m_LogFont.lfFaceName, GetFontSize(m_hWnd, m_LogFont));
  108. m_btFont.SetWindowText(cs);
  109. FillThemes();
  110. FillLanguages();
  111. int caretPos = m_popupPositionCombo.AddString(_T("At Caret"));
  112. m_popupPositionCombo.SetItemData(caretPos, POS_AT_CARET);
  113. int cursorPos = m_popupPositionCombo.AddString(_T("At Cursor"));
  114. m_popupPositionCombo.SetItemData(cursorPos, POS_AT_CURSOR);
  115. int prevPos = m_popupPositionCombo.AddString(_T("At Previous Position"));
  116. m_popupPositionCombo.SetItemData(prevPos, POS_AT_PREVIOUS);
  117. switch (CGetSetOptions::GetQuickPastePosition())
  118. {
  119. case POS_AT_CARET:
  120. m_popupPositionCombo.SetCurSel(caretPos);
  121. break;
  122. case POS_AT_CURSOR:
  123. m_popupPositionCombo.SetCurSel(cursorPos);
  124. break;
  125. case POS_AT_PREVIOUS:
  126. m_popupPositionCombo.SetCurSel(prevPos);
  127. break;
  128. default:
  129. m_popupPositionCombo.SetCurSel(cursorPos);
  130. }
  131. UpdateData(FALSE);
  132. theApp.m_Language.UpdateOptionGeneral(this);
  133. OnEnChangePath();
  134. return TRUE;
  135. }
  136. #define NO_MATCH -2
  137. #define FOUND_MATCH -1
  138. void COptionsGeneral::FillLanguages()
  139. {
  140. CString csFile = CGetSetOptions::GetPath(PATH_LANGUAGE);
  141. csFile += "*.xml";
  142. CString csLanguage = CGetSetOptions::GetLanguageFile();
  143. CFileFind find;
  144. BOOL bCont = find.FindFile(csFile);
  145. int nEnglishIndex = NO_MATCH;
  146. while(bCont)
  147. {
  148. bCont = find.FindNextFile();
  149. int nIndex = m_cbLanguage.AddString(find.GetFileTitle());
  150. if(find.GetFileTitle() == csLanguage)
  151. {
  152. nEnglishIndex = -1;
  153. m_cbLanguage.SetCurSel(nIndex);
  154. }
  155. else if(find.GetFileTitle() == _T("English"))
  156. {
  157. if(nEnglishIndex == NO_MATCH)
  158. nEnglishIndex = nIndex;
  159. }
  160. }
  161. if(nEnglishIndex >= 0)
  162. {
  163. m_cbLanguage.SetCurSel(nEnglishIndex);
  164. }
  165. }
  166. BOOL COptionsGeneral::OnApply()
  167. {
  168. UpdateData();
  169. #ifndef _DEBUG
  170. if (CGetSetOptions::GetIsWindowsApp() == FALSE)
  171. {
  172. CGetSetOptions::SetRunOnStartUp(m_btRunOnStartup.GetCheck());
  173. }
  174. #endif
  175. CGetSetOptions::SetCheckForMaxEntries(m_btMaximumCheck.GetCheck());
  176. CGetSetOptions::SetCheckForExpiredEntries(m_btExpire.GetCheck());
  177. CGetSetOptions::SetMaxEntries(m_eMaxSavedCopies.GetNumber());
  178. CGetSetOptions::SetExpiredEntries(m_eExpireAfter.GetNumber());
  179. CString stringVal;
  180. m_copyAppInclude.GetWindowText(stringVal);
  181. g_Opt.SetCopyAppInclude(stringVal);
  182. m_copyAppExclude.GetWindowText(stringVal);
  183. g_Opt.SetCopyAppExclude(stringVal);
  184. CString csLanguage;
  185. if(m_cbLanguage.GetCurSel() >= 0)
  186. {
  187. m_cbLanguage.GetLBText(m_cbLanguage.GetCurSel(), csLanguage);
  188. g_Opt.SetLanguageFile(csLanguage);
  189. }
  190. if(csLanguage.IsEmpty() == FALSE)
  191. {
  192. if(!theApp.m_Language.LoadLanguageFile(csLanguage))
  193. {
  194. CString cs;
  195. cs.Format(_T("Error loading language file - %s - \n\n%s"), csLanguage, theApp.m_Language.m_csLastError);
  196. MessageBox(cs, _T("Ditto"), MB_OK);
  197. }
  198. }
  199. CString toSavePath;
  200. m_ePath.GetWindowText(toSavePath);
  201. CString resolvedPath = CGetSetOptions::ResolvePath(toSavePath);
  202. bool bOpenNewDatabase = false;
  203. if(resolvedPath.IsEmpty() == FALSE)
  204. {
  205. if(FileExists(resolvedPath) == FALSE)
  206. {
  207. CString cs;
  208. cs.Format(_T("The database %s does not exist.\n\nCreate a new database?"), resolvedPath);
  209. if(MessageBox(cs, _T("Ditto"), MB_YESNO) == IDYES)
  210. {
  211. // -- create a new one
  212. if(CreateDB(resolvedPath))
  213. {
  214. bOpenNewDatabase = true;
  215. }
  216. else
  217. MessageBox(_T("Error Creating Database"));
  218. }
  219. else
  220. return FALSE;
  221. }
  222. else
  223. {
  224. if(ValidDB(resolvedPath) == FALSE)
  225. {
  226. MessageBox(_T("Invalid Database"), _T("Ditto"), MB_OK);
  227. m_ePath.SetFocus();
  228. return FALSE;
  229. }
  230. else
  231. {
  232. bOpenNewDatabase = true;
  233. }
  234. }
  235. if(bOpenNewDatabase)
  236. {
  237. CGetSetOptions::SetDBPath(toSavePath);
  238. if(OpenDatabase(resolvedPath) == FALSE)
  239. {
  240. MessageBox(_T("Error Opening new database"), _T("Ditto"), MB_OK);
  241. m_ePath.SetFocus();
  242. return FALSE;
  243. }
  244. else
  245. {
  246. theApp.RefreshView();
  247. }
  248. }
  249. }
  250. CGetSetOptions::SetQuickPastePosition((int)m_popupPositionCombo.GetItemData(m_popupPositionCombo.GetCurSel()));
  251. if (m_LogFont.lfWeight != 0)
  252. {
  253. CGetSetOptions::SetFont(m_LogFont);
  254. }
  255. CString currentTheme = g_Opt.GetTheme();
  256. CString csTheme = _T("");
  257. if (m_cbTheme.GetCurSel() >= 0)
  258. {
  259. if (m_cbTheme.GetItemData(m_cbTheme.GetCurSel()) == 1)
  260. {
  261. m_cbTheme.GetLBText(m_cbTheme.GetCurSel(), csTheme);
  262. g_Opt.SetTheme(csTheme);
  263. }
  264. else
  265. {
  266. g_Opt.SetTheme("");
  267. }
  268. }
  269. else
  270. {
  271. g_Opt.SetTheme("");
  272. }
  273. if (currentTheme != csTheme)
  274. {
  275. m_pParent->m_themeChanged = TRUE;
  276. }
  277. return CPropertyPage::OnApply();
  278. }
  279. BOOL COptionsGeneral::OnSetActive()
  280. {
  281. return CPropertyPage::OnSetActive();
  282. }
  283. //void COptionsGeneral::OnSetDbPath()
  284. //{
  285. // if(m_btSetDatabasePath.GetCheck() == BST_CHECKED)
  286. // {
  287. // m_ePath.EnableWindow(TRUE);
  288. // m_btGetPath.EnableWindow(TRUE);
  289. // }
  290. // else
  291. // {
  292. // m_ePath.EnableWindow(FALSE);
  293. // m_btGetPath.EnableWindow(FALSE);
  294. // }
  295. //}
  296. void COptionsGeneral::OnGetPath()
  297. {
  298. OPENFILENAME FileName;
  299. TCHAR szFileName[400];
  300. TCHAR szDir[400];
  301. memset(&FileName, 0, sizeof(FileName));
  302. memset(szFileName, 0, sizeof(szFileName));
  303. memset(&szDir, 0, sizeof(szDir));
  304. FileName.lStructSize = sizeof(FileName);
  305. FileName.lpstrTitle = _T("Open Database");
  306. FileName.Flags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR;
  307. FileName.nMaxFile = 400;
  308. FileName.lpstrFile = szFileName;
  309. FileName.lpstrInitialDir = szDir;
  310. FileName.lpstrFilter = _T("Ditto Databases (*.db; *.mdb)\0*.db;*.mdb\0\0");
  311. FileName.lpstrDefExt = _T("db");
  312. FileName.hwndOwner = m_hWnd;
  313. if(GetOpenFileName(&FileName) == 0)
  314. return;
  315. CString csPath(FileName.lpstrFile);
  316. if(FileExists(csPath))
  317. {
  318. if(ValidDB(csPath) == FALSE)
  319. {
  320. MessageBox(_T("Invalid Database"), _T("Ditto"), MB_OK);
  321. m_ePath.SetFocus();
  322. }
  323. else
  324. {
  325. m_ePath.SetWindowText(csPath);
  326. }
  327. }
  328. else
  329. {
  330. m_ePath.SetWindowText(csPath);
  331. }
  332. }
  333. void COptionsGeneral::OnButtonAbout()
  334. {
  335. CDimWnd dim(this->GetParent());
  336. CMultiLanguage Lang;
  337. CString csLanguage;
  338. m_cbLanguage.GetLBText(m_cbLanguage.GetCurSel(), csLanguage);
  339. Lang.SetOnlyGetHeader(true);
  340. if(Lang.LoadLanguageFile(csLanguage))
  341. {
  342. CString csMessage;
  343. csMessage.Format(_T("Language - %s\n")
  344. _T("Version - %d\n")
  345. _T("Author - %s\n")
  346. _T("Notes - %s"), csLanguage,
  347. Lang.GetVersion(),
  348. Lang.GetAuthor(),
  349. Lang.GetNotes());
  350. MessageBox(csMessage, _T("Ditto"), MB_OK);
  351. }
  352. else
  353. {
  354. CString csError;
  355. csError.Format(_T("Error loading language file - %s - reason = "), csLanguage, Lang.m_csLastError);
  356. MessageBox(csError, _T("Ditto"), MB_OK);
  357. }
  358. }
  359. void COptionsGeneral::OnBnClickedButtonAdvanced()
  360. {
  361. CDimWnd dim(this->GetParent());
  362. CAdvGeneral adv(this);
  363. adv.DoModal();
  364. }
  365. HBRUSH COptionsGeneral::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
  366. {
  367. HBRUSH hbr = CPropertyPage::OnCtlColor(pDC, pWnd, nCtlColor);
  368. switch(nCtlColor)
  369. {
  370. case CTLCOLOR_DLG: // dialog
  371. case CTLCOLOR_STATIC: // static, checkbox, read-only edit, etc.
  372. //pDC->SetBkColor(RGB(251, 251, 251));
  373. //hbr = m_brush;
  374. break;
  375. }
  376. return hbr;
  377. }
  378. void COptionsGeneral::FillThemes()
  379. {
  380. CString csFile = CGetSetOptions::GetPath(PATH_THEMES);
  381. csFile += "*.xml";
  382. CString csTheme = CGetSetOptions::GetTheme();
  383. m_cbTheme.Clear();
  384. int windowsSettingIndex = m_cbTheme.AddString(_T("(Follow windows light/dark themes)"));
  385. m_cbTheme.SetItemData(windowsSettingIndex, 0);
  386. CFileFind find;
  387. BOOL bCont = find.FindFile(csFile);
  388. bool bSetCurSel = false;
  389. while (bCont)
  390. {
  391. bCont = find.FindNextFile();
  392. CTheme theme;
  393. if (theme.Load(find.GetFileTitle(), true, false))
  394. {
  395. if (theme.FileVersion() >= 2 && theme.FileVersion() < 100)
  396. {
  397. int nIndex = m_cbTheme.AddString(find.GetFileTitle());
  398. m_cbTheme.SetItemData(nIndex, 1);
  399. if (find.GetFileTitle() == csTheme)
  400. {
  401. m_cbTheme.SetCurSel(nIndex);
  402. bSetCurSel = true;
  403. }
  404. }
  405. }
  406. }
  407. int nIndex = m_cbTheme.AddString(DEFAULT_THEME);
  408. m_cbTheme.SetItemData(nIndex, 1);
  409. if (csTheme == DEFAULT_THEME)
  410. {
  411. m_cbTheme.SetCurSel(nIndex);
  412. bSetCurSel = true;
  413. }
  414. if (bSetCurSel == false)
  415. {
  416. int count = m_cbTheme.GetCount();
  417. for (int i = 0; i < count; i++)
  418. {
  419. if (m_cbTheme.GetItemData(i) == 0)
  420. {
  421. m_cbTheme.SetCurSel(i);
  422. break;
  423. }
  424. }
  425. }
  426. }
  427. void COptionsGeneral::OnBnClickedButtonTheme()
  428. {
  429. CDimWnd dim(this->GetParent());
  430. CTheme theme;
  431. CString csTheme;
  432. m_cbTheme.GetLBText(m_cbTheme.GetCurSel(), csTheme);
  433. if (m_cbTheme.GetItemData(m_cbTheme.GetCurSel()) == 0)
  434. return;
  435. if (csTheme == DEFAULT_THEME)
  436. return;
  437. if (theme.Load(csTheme, true, false))
  438. {
  439. CString csMessage;
  440. csMessage.Format(_T("Theme - %s\n")
  441. _T("Version - %d\n")
  442. _T("Author - %s\n")
  443. _T("Notes - %s"), csTheme,
  444. theme.FileVersion(),
  445. theme.Author(),
  446. theme.Notes());
  447. MessageBox(csMessage, _T("Ditto"), MB_OK);
  448. }
  449. else
  450. {
  451. CString csError;
  452. csError.Format(_T("Error loading theme file - %s - reason = "), csTheme, theme.LastError());
  453. MessageBox(csError, _T("Ditto"), MB_OK);
  454. }
  455. }
  456. void COptionsGeneral::OnBnClickedButtonDefaultFault()
  457. {
  458. memset(&m_LogFont, 0, sizeof(m_LogFont));
  459. m_LogFont.lfHeight = -13;
  460. m_LogFont.lfWeight = 400;
  461. m_LogFont.lfCharSet = 1;
  462. STRCPY(m_LogFont.lfFaceName, _T("Segoe UI"));
  463. CString cs;
  464. cs.Format(_T("Font - %s (%d)"), m_LogFont.lfFaceName, GetFontSize(m_hWnd, m_LogFont));
  465. m_btFont.SetWindowText(cs);
  466. }
  467. int COptionsGeneral::GetFontSize(HWND hWnd, const LOGFONT& lf)
  468. {
  469. int nFontSize = 0;
  470. HDC hDC = ::GetWindowDC(hWnd);
  471. if (lf.lfHeight < 0)
  472. {
  473. nFontSize = -::MulDiv(lf.lfHeight, 72, ::GetDeviceCaps(hDC, LOGPIXELSY));
  474. }
  475. else
  476. {
  477. TEXTMETRIC tm;
  478. ::ZeroMemory(&tm, sizeof(TEXTMETRIC));
  479. ::GetTextMetrics(hDC, &tm);
  480. nFontSize = ::MulDiv(lf.lfHeight - tm.tmInternalLeading, 72, ::GetDeviceCaps(hDC, LOGPIXELSY));
  481. }
  482. ::ReleaseDC(hWnd, hDC);
  483. return nFontSize;
  484. }
  485. void COptionsGeneral::OnBnClickedButtonFont()
  486. {
  487. CFontDialog dlg(&m_LogFont, (CF_TTONLY | CF_SCREENFONTS), 0, this);
  488. if (dlg.DoModal() == IDOK)
  489. {
  490. memcpy(&m_LogFont, dlg.m_cf.lpLogFont, sizeof(LOGFONT));
  491. CString cs;
  492. cs.Format(_T("Font - %s (%d)"), m_LogFont.lfFaceName, GetFontSize(m_hWnd, m_LogFont));
  493. m_btFont.SetWindowText(cs);
  494. }
  495. }
  496. //void COptionsGeneral::OnNMClickSyslinkEnvVarInfo(NMHDR *pNMHDR, LRESULT *pResult)
  497. //{
  498. // CString url = _T("https:////sourceforge.net//p//ditto-cp//wiki//EnvironmentVariables//");
  499. //
  500. // CHyperLink::GotoURL(url, SW_SHOW);
  501. //
  502. // *pResult = 0;
  503. //}
  504. //
  505. //
  506. //void COptionsGeneral::OnEnChangePath()
  507. //{
  508. // // TODO: If this is a RICHEDIT control, the control will not
  509. // // send this notification unless you override the CPropertyPage::OnInitDialog()
  510. // // function and call CRichEditCtrl().SetEventMask()
  511. // // with the ENM_CHANGE flag ORed into the mask.
  512. //
  513. // // TODO: Add your control notification handler code here
  514. //}
  515. void COptionsGeneral::OnEnChangePath()
  516. {
  517. // TODO: If this is a RICHEDIT control, the control will not
  518. // send this notification unless you override the CPropertyPage::OnInitDialog()
  519. // function and call CRichEditCtrl().SetEventMask()
  520. // with the ENM_CHANGE flag ORed into the mask.
  521. // TODO: Add your control notification handler code here
  522. CString toSavePath;
  523. m_ePath.GetWindowText(toSavePath);
  524. if (toSavePath.Find(_T("%")) >= 0)
  525. {
  526. CString resolvedPath = CGetSetOptions::ResolvePath(toSavePath);
  527. m_envVarLink.SetWindowText(resolvedPath);
  528. }
  529. else
  530. {
  531. m_envVarLink.SetWindowText(_T("Environment Variables"));
  532. }
  533. }