OptionsGeneral.cpp 15 KB

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