Options.cpp 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836
  1. #include "stdafx.h"
  2. #include "Options.h"
  3. #include "AlphaBlend.h"
  4. #include "Misc.h"
  5. #include "TextConvert.h"
  6. #include "sqlite\CppSQLite3.h"
  7. #include "Path.h"
  8. using namespace nsPath;
  9. UINT WritePrivateProfileInt(LPCTSTR lpAppName, LPCTSTR lpKeyName, INT nValue, LPCTSTR lpFileName)
  10. {
  11. // Locals
  12. TCHAR szBuff[25];
  13. // Format
  14. SPRINTF(szBuff, _T("%d"), nValue);
  15. // Write
  16. return WritePrivateProfileString(lpAppName, lpKeyName, szBuff, lpFileName);
  17. }
  18. long CGetSetOptions::m_nLinesPerRow;
  19. BOOL CGetSetOptions::m_bUseCtrlNumAccel;
  20. BOOL CGetSetOptions::m_bAllowDuplicates;
  21. BOOL CGetSetOptions::m_bUpdateTimeOnPaste;
  22. BOOL CGetSetOptions::m_bSaveMultiPaste;
  23. BOOL CGetSetOptions::m_bShowPersistent;
  24. BOOL CGetSetOptions::m_bHistoryStartTop;
  25. long CGetSetOptions::m_bDescTextSize;
  26. BOOL CGetSetOptions::m_bDescShowLeadingWhiteSpace;
  27. BOOL CGetSetOptions::m_bAllwaysShowDescription;
  28. long CGetSetOptions::m_bDoubleClickingOnCaptionDoes;
  29. BOOL CGetSetOptions::m_bPrompForNewGroupName;
  30. BOOL CGetSetOptions::m_bSendPasteOnFirstTenHotKeys;
  31. CSendClients CGetSetOptions::m_SendClients[MAX_SEND_CLIENTS];
  32. long CGetSetOptions::m_lAutoSendClientCount;
  33. CString CGetSetOptions::m_csIPListToPutOnClipboard;
  34. BOOL CGetSetOptions::m_bLogSendReceiveErrors;
  35. BOOL CGetSetOptions::m_bUseHookDllForFocus;
  36. BOOL CGetSetOptions::m_HideDittoOnHotKeyIfAlreadyShown;
  37. long CGetSetOptions::m_lPort;
  38. BOOL CGetSetOptions::m_bDrawThumbnail;
  39. CStringA CGetSetOptions::m_csPassword;
  40. BOOL CGetSetOptions::m_bDrawRTF;
  41. BOOL CGetSetOptions::m_bMultiPasteReverse;
  42. CString CGetSetOptions::m_csPlaySoundOnCopy;
  43. CStringArray CGetSetOptions::m_csNetworkPasswordArray;
  44. BOOL CGetSetOptions::m_bSendPasteMessageAfterSelection;
  45. BOOL CGetSetOptions::m_bFindAsYouType;
  46. BOOL CGetSetOptions::m_bEnsureEntireWindowCanBeSeen;
  47. BOOL CGetSetOptions::m_bShowAllClipsInMainList;
  48. long CGetSetOptions::m_lMaxClipSizeInBytes;
  49. DWORD CGetSetOptions::m_dwSaveClipDelay;
  50. long CGetSetOptions::m_lProcessDrawClipboardDelay;
  51. BOOL CGetSetOptions::m_bEnableDebugLogging;
  52. BOOL CGetSetOptions::m_bEnsureConnectToClipboard;
  53. bool CGetSetOptions::m_bOutputDebugString;
  54. bool CGetSetOptions::m_bU3 = false;
  55. bool CGetSetOptions::m_bInConversion = false;
  56. bool CGetSetOptions::m_bFromIni = false;
  57. CString CGetSetOptions::m_csIniFileName;
  58. __int64 CGetSetOptions::nLastDbWriteTime = 0;
  59. bool CGetSetOptions::m_bGroupWndPinned = true;
  60. CGetSetOptions g_Opt;
  61. CGetSetOptions::CGetSetOptions()
  62. {
  63. }
  64. CGetSetOptions::~CGetSetOptions()
  65. {
  66. }
  67. void CGetSetOptions::LoadSettings()
  68. {
  69. m_csIniFileName = GetIniFileName(false);
  70. if(m_bU3)
  71. {
  72. m_bFromIni = true;
  73. }
  74. else
  75. {
  76. //First check to see if they have an ini file in my docs&settings - ditto
  77. if(FileExists(m_csIniFileName))
  78. {
  79. m_bFromIni = true;
  80. }
  81. else
  82. {
  83. //next check if they have an ini file in the application directory
  84. m_csIniFileName = GetIniFileName(true);
  85. if(FileExists(m_csIniFileName))
  86. {
  87. m_bFromIni = true;
  88. }
  89. }
  90. }
  91. GetSetCurrentDirectory();
  92. m_nLinesPerRow = GetLinesPerRow();
  93. m_bUseCtrlNumAccel = GetUseCtrlNumForFirstTenHotKeys();
  94. m_bAllowDuplicates = GetAllowDuplicates();
  95. m_bUpdateTimeOnPaste = GetUpdateTimeOnPaste();
  96. m_bSaveMultiPaste = GetSaveMultiPaste();
  97. m_bShowPersistent = GetShowPersistent();
  98. m_bHistoryStartTop = GetHistoryStartTop();
  99. m_bDescTextSize = GetDescTextSize();
  100. m_bDescShowLeadingWhiteSpace = GetDescShowLeadingWhiteSpace();
  101. m_bAllwaysShowDescription = GetAllwaysShowDescription();
  102. m_bDoubleClickingOnCaptionDoes = GetDoubleClickingOnCaptionDoes();
  103. m_bPrompForNewGroupName = GetPrompForNewGroupName();
  104. m_bSendPasteOnFirstTenHotKeys = GetSendPasteOnFirstTenHotKeys();
  105. m_csIPListToPutOnClipboard = GetListToPutOnClipboard();
  106. m_bLogSendReceiveErrors = GetLogSendReceiveErrors();
  107. //If running from U3 then we can't use the hook dll because we are unable
  108. //to delete the hook dll, it's loaded by other processes
  109. if(m_bU3)
  110. m_bUseHookDllForFocus = GetProfileLong("UseHookDllForFocus", FALSE);
  111. else
  112. m_bUseHookDllForFocus = GetProfileLong("UseHookDllForFocus", TRUE);
  113. m_HideDittoOnHotKeyIfAlreadyShown = GetHideDittoOnHotKeyIfAlreadyShown();
  114. m_lPort = GetPort();
  115. m_bDrawThumbnail = GetDrawThumbnail();
  116. m_csPassword = GetNetworkPassword();
  117. m_bDrawRTF = GetDrawRTF();
  118. m_bMultiPasteReverse = GetMultiPasteReverse();
  119. m_csPlaySoundOnCopy = GetPlaySoundOnCopy();
  120. m_bSendPasteMessageAfterSelection = GetSendPasteAfterSelection();
  121. m_bFindAsYouType = GetFindAsYouType();
  122. m_bEnsureEntireWindowCanBeSeen = GetEnsureEntireWindowCanBeSeen();
  123. m_bShowAllClipsInMainList = GetShowAllClipsInMainList();
  124. m_lMaxClipSizeInBytes = GetMaxClipSizeInBytes();
  125. m_dwSaveClipDelay = GetSaveClipDelay();
  126. m_lProcessDrawClipboardDelay = GetProcessDrawClipboardDelay();
  127. m_bEnableDebugLogging = GetEnableDebugLogging();
  128. m_bEnsureConnectToClipboard = GetEnsureConnectToClipboard();
  129. m_bOutputDebugString = false;
  130. m_bGroupWndPinned = GetGroupWndPinned();
  131. GetExtraNetworkPassword(true);
  132. #ifdef _DEBUG
  133. m_bUseHookDllForFocus = FALSE;
  134. #endif
  135. for(int i = 0; i < MAX_SEND_CLIENTS; i++)
  136. {
  137. GetSendClients(i);
  138. }
  139. GetClientSendCount();
  140. //If running from a U3 device and no language file as been asigned
  141. //then use the language defined by the U3 launcher
  142. if(m_bU3)
  143. {
  144. CString csLanguage = GetLanguageFile();
  145. if(csLanguage.IsEmpty())
  146. {
  147. CString csLanguage = GETENV(_T("U3_ENV_LANGUAGE"));
  148. long lLanguage = ATOI(csLanguage);
  149. csLanguage.Empty();
  150. switch(lLanguage)
  151. {
  152. case 1036: //French
  153. csLanguage = _T("Français");
  154. break;
  155. case 1040: //Italian
  156. csLanguage = _T("Italiano");
  157. break;
  158. case 1031: //German
  159. csLanguage = _T("German");
  160. break;
  161. case 3082: //German
  162. csLanguage = _T("Español");
  163. break;
  164. }
  165. if(csLanguage.IsEmpty() == FALSE)
  166. {
  167. SetLanguageFile(csLanguage);
  168. }
  169. }
  170. }
  171. }
  172. void CGetSetOptions::ConverSettingsToIni()
  173. {
  174. m_bInConversion = true;
  175. CSize sz;
  176. CPoint pt;
  177. GetQuickPasteSize(sz);
  178. SetQuickPasteSize(sz);
  179. GetQuickPastePoint(pt);
  180. SetQuickPastePoint(pt);
  181. GetEditWndSize(sz);
  182. SetEditWndSize(sz);
  183. GetEditWndPoint(pt);
  184. SetEditWndPoint(pt);
  185. SetShowIconInSysTray(GetShowIconInSysTray());
  186. SetRunOnStartUp(GetRunOnStartUp());
  187. SetEnableTransparency(GetEnableTransparency());
  188. SetTransparencyPercent(GetTransparencyPercent());
  189. SetLinesPerRow(GetLinesPerRow());
  190. SetQuickPastePosition(GetQuickPastePosition());
  191. SetCopyGap(GetCopyGap());
  192. SetDBPath(GetDBPath());
  193. SetCheckForMaxEntries(GetCheckForMaxEntries());
  194. SetCheckForExpiredEntries(GetCheckForExpiredEntries());
  195. SetMaxEntries(GetMaxEntries());
  196. SetExpiredEntries(GetExpiredEntries());
  197. SetTripCopyCount(GetTripCopyCount());
  198. SetTripPasteCount(GetTripPasteCount());
  199. SetTripDate(GetTripDate());
  200. SetTotalCopyCount(GetTotalCopyCount());
  201. SetTotalPasteCount(GetTotalPasteCount());
  202. SetTotalDate(GetTotalDate());
  203. SetUpdateFilePath(GetUpdateFilePath());
  204. SetUpdateInstallPath(GetUpdateInstallPath());
  205. SetLastUpdate(GetLastUpdate());
  206. SetCheckForUpdates(GetCheckForUpdates());
  207. SetUseCtrlNumForFirstTenHotKeys(GetUseCtrlNumForFirstTenHotKeys());
  208. SetAllowDuplicates(GetAllowDuplicates());
  209. SetUpdateTimeOnPaste(GetUpdateTimeOnPaste());
  210. SetSaveMultiPaste(GetSaveMultiPaste());
  211. SetShowPersistent(GetShowPersistent());
  212. SetHistoryStartTop(GetHistoryStartTop());
  213. SetShowTextForFirstTenHotKeys(GetShowTextForFirstTenHotKeys());
  214. SetMainHWND(GetMainHWND());
  215. SetCaptionPos(GetCaptionPos());
  216. SetAutoHide(GetAutoHide());
  217. SetDescTextSize(GetDescTextSize());
  218. SetDescShowLeadingWhiteSpace(GetDescShowLeadingWhiteSpace());
  219. SetAllwaysShowDescription(GetAllwaysShowDescription());
  220. SetDoubleClickingOnCaptionDoes(GetDoubleClickingOnCaptionDoes());
  221. SetPrompForNewGroupName(GetPrompForNewGroupName());
  222. SetSendPasteOnFirstTenHotKeys(GetSendPasteOnFirstTenHotKeys());
  223. for(int i = 0; i < MAX_SEND_CLIENTS; i++)
  224. {
  225. GetSendClients(i);
  226. SetSendClients(m_SendClients[i], i);
  227. }
  228. SetListToPutOnClipboard(GetListToPutOnClipboard());
  229. SetLogSendReceiveErrors(GetLogSendReceiveErrors());
  230. SetHideDittoOnHotKeyIfAlreadyShown(GetHideDittoOnHotKeyIfAlreadyShown());
  231. SetPort(GetPort());
  232. SetDisableRecieve(GetDisableRecieve());
  233. LOGFONT font;
  234. GetFont(font);
  235. SetFont(font);
  236. SetDrawThumbnail(GetDrawThumbnail());
  237. CStringA PassA = GetNetworkPassword();
  238. CString PassW = PassA;
  239. SetNetworkPassword(PassW);
  240. SetDrawRTF(GetDrawRTF());
  241. SetMultiPasteReverse(GetMultiPasteReverse());
  242. SetPlaySoundOnCopy(GetPlaySoundOnCopy());
  243. SetSendPasteAfterSelection(GetSendPasteAfterSelection());
  244. SetFindAsYouType(GetFindAsYouType());
  245. SetEnsureEntireWindowCanBeSeen(GetEnsureEntireWindowCanBeSeen());
  246. SetShowAllClipsInMainList(GetShowAllClipsInMainList());
  247. SetExtraNetworkPassword(GetExtraNetworkPassword(false));
  248. SetMaxClipSizeInBytes(GetMaxClipSizeInBytes());
  249. SetLanguageFile(GetLanguageFile());
  250. SetSaveClipDelay(GetSaveClipDelay());
  251. SetProcessDrawClipboardDelay(GetProcessDrawClipboardDelay());
  252. SetEnableDebugLogging(GetEnableDebugLogging());
  253. SetEnsureConnectToClipboard(GetEnsureConnectToClipboard());
  254. SetPromptWhenDeletingClips(GetPromptWhenDeletingClips());
  255. SetLastImportDir(GetLastImportDir());
  256. SetLastExportDir(GetLastExportDir());
  257. SetUpdateDescWhenSavingClip(GetUpdateDescWhenSavingClip());
  258. m_bInConversion = false;
  259. }
  260. CString CGetSetOptions::GetIniFileName(bool bLocalIniFile)
  261. {
  262. CString csPath = _T("c:\\program files\\Ditto\\");
  263. if(m_bU3)
  264. {
  265. csPath = CGetSetOptions::GetPath(PATH_INI);
  266. }
  267. else
  268. {
  269. if(bLocalIniFile)
  270. {
  271. csPath = GetFilePath(GetExeFileName());
  272. }
  273. else
  274. {
  275. LPMALLOC pMalloc;
  276. if(SUCCEEDED(::SHGetMalloc(&pMalloc)))
  277. {
  278. LPITEMIDLIST pidlPrograms;
  279. SHGetSpecialFolderLocation(NULL, CSIDL_APPDATA, &pidlPrograms);
  280. TCHAR string[MAX_PATH];
  281. SHGetPathFromIDList(pidlPrograms, string);
  282. pMalloc->Free(pidlPrograms);
  283. pMalloc->Release();
  284. csPath = string;
  285. }
  286. FIX_CSTRING_PATH(csPath);
  287. csPath += "Ditto\\";
  288. }
  289. }
  290. if(FileExists(csPath) == FALSE)
  291. CreateDirectory(csPath, NULL);
  292. csPath = csPath + "Ditto.Settings";
  293. return csPath;
  294. }
  295. long CGetSetOptions::GetProfileLong(CString csName, long lDefaultValue, CString csNewPath)
  296. {
  297. if(m_bFromIni && !m_bInConversion)
  298. {
  299. CString csApp(_T("Ditto"));
  300. if(csNewPath.IsEmpty() == FALSE)
  301. {
  302. csApp += "-" + csNewPath;
  303. }
  304. return GetPrivateProfileInt(csApp, csName, lDefaultValue, m_csIniFileName);
  305. }
  306. CString csPath(_T(REG_PATH));
  307. if(csNewPath.IsEmpty() == FALSE)
  308. {
  309. csPath += "\\" + csNewPath;
  310. }
  311. HKEY hkKey;
  312. long lResult = RegOpenKeyEx(HKEY_CURRENT_USER, csPath, NULL, KEY_READ, &hkKey);
  313. if(lResult != ERROR_SUCCESS)
  314. return lDefaultValue;
  315. DWORD buffer;
  316. DWORD len = sizeof(buffer);
  317. DWORD type;
  318. lResult = ::RegQueryValueEx(hkKey, csName, 0, &type, (LPBYTE)&buffer, &len);
  319. RegCloseKey(hkKey);
  320. if(lResult == ERROR_SUCCESS)
  321. return (long)buffer;
  322. return lDefaultValue;
  323. }
  324. CString CGetSetOptions::GetProfileString(CString csName, CString csDefault, CString csNewPath)
  325. {
  326. if(m_bFromIni && !m_bInConversion)
  327. {
  328. CString csApp(_T("Ditto"));
  329. if(csNewPath.IsEmpty() == FALSE)
  330. {
  331. csApp += "-" + csNewPath;
  332. }
  333. TCHAR cString[MAX_PATH];
  334. GetPrivateProfileString(csApp, csName, csDefault, cString, sizeof(cString), m_csIniFileName);
  335. return cString;
  336. }
  337. CString csPath(_T(REG_PATH));
  338. if(csNewPath.IsEmpty() == FALSE)
  339. {
  340. csPath += "\\" + csNewPath;
  341. }
  342. HKEY hkKey;
  343. long lResult = RegOpenKeyEx(HKEY_CURRENT_USER, csPath, NULL, KEY_READ, &hkKey);
  344. TCHAR szString[256];
  345. ZeroMemory(szString, sizeof(szString));
  346. DWORD dwBufLen = 256;
  347. lResult = ::RegQueryValueEx(hkKey , csName, NULL, NULL, (LPBYTE)szString, &dwBufLen);
  348. RegCloseKey(hkKey);
  349. if(lResult != ERROR_SUCCESS)
  350. return csDefault;
  351. return szString;
  352. }
  353. BOOL CGetSetOptions::SetProfileLong(CString csName, long lValue)
  354. {
  355. if(m_bFromIni)
  356. {
  357. return WritePrivateProfileInt(_T("Ditto"), csName, lValue, m_csIniFileName);
  358. }
  359. HKEY hkKey;
  360. DWORD dWord;
  361. long lResult = RegCreateKeyEx(HKEY_CURRENT_USER, _T(REG_PATH), NULL,
  362. NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS,
  363. NULL, &hkKey, &dWord);
  364. if(lResult != ERROR_SUCCESS)
  365. return FALSE;
  366. DWORD val = (DWORD)lValue;
  367. lResult = ::RegSetValueEx(hkKey, csName, 0, REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
  368. RegCloseKey(hkKey);
  369. return lResult == ERROR_SUCCESS;
  370. }
  371. BOOL CGetSetOptions::SetProfileString(CString csName, CString csValue)
  372. {
  373. if(m_bFromIni)
  374. {
  375. return WritePrivateProfileString(_T("Ditto"), csName, csValue, m_csIniFileName);
  376. }
  377. HKEY hkKey;
  378. DWORD dWord;
  379. long lResult = RegCreateKeyEx(HKEY_CURRENT_USER, _T(REG_PATH), NULL,
  380. NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS,
  381. NULL, &hkKey, &dWord);
  382. if(lResult != ERROR_SUCCESS)
  383. return FALSE;
  384. ::RegSetValueEx(hkKey, csName, NULL, REG_SZ,
  385. (BYTE*)(LPCTSTR)csValue, csValue.GetLength()*sizeof(TCHAR));
  386. RegCloseKey(hkKey);
  387. return lResult == ERROR_SUCCESS;
  388. }
  389. BOOL CGetSetOptions::SetProfileData(CString csName, LPVOID lpData, DWORD dwLength)
  390. {
  391. if(m_bFromIni)
  392. {
  393. ASSERT(!"SetProfileData not supported in .ini settings");
  394. return FALSE;
  395. }
  396. HKEY hkKey;
  397. DWORD dWord;
  398. long lResult = RegCreateKeyEx(HKEY_CURRENT_USER, _T(REG_PATH), NULL,
  399. NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS,
  400. NULL, &hkKey, &dWord);
  401. if(lResult != ERROR_SUCCESS)
  402. return FALSE;
  403. ::RegSetValueEx(hkKey, csName, NULL, REG_BINARY,
  404. (BYTE*)lpData, dwLength);
  405. RegCloseKey(hkKey);
  406. return lResult == ERROR_SUCCESS;
  407. }
  408. BOOL CGetSetOptions::GetProfileFont(CString csSection, LOGFONT &font)
  409. {
  410. font.lfHeight = GetPrivateProfileInt(csSection, _T("Height"), 0, m_csIniFileName);
  411. font.lfWidth = GetPrivateProfileInt(csSection, _T("Width"), 0, m_csIniFileName);
  412. font.lfEscapement = GetPrivateProfileInt(csSection, _T("Escapement"), 0, m_csIniFileName);
  413. font.lfOrientation = GetPrivateProfileInt(csSection, _T("Orientation"), 0, m_csIniFileName);
  414. font.lfWeight = GetPrivateProfileInt(csSection, _T("Weight"), 0, m_csIniFileName);
  415. font.lfItalic = GetPrivateProfileInt(csSection, _T("Italic"), 0, m_csIniFileName);
  416. font.lfUnderline = GetPrivateProfileInt(csSection, _T("Underline"), 0, m_csIniFileName);
  417. font.lfStrikeOut = GetPrivateProfileInt(csSection, _T("StrikeOut"), 0, m_csIniFileName);
  418. font.lfCharSet = GetPrivateProfileInt(csSection, _T("CharSet"), 0, m_csIniFileName);
  419. font.lfOutPrecision = GetPrivateProfileInt(csSection, _T("OutPrecision"), 0, m_csIniFileName);
  420. font.lfClipPrecision = GetPrivateProfileInt(csSection, _T("ClipPrecision"), 0, m_csIniFileName);
  421. font.lfQuality = GetPrivateProfileInt(csSection, _T("Quality"), 0, m_csIniFileName);
  422. font.lfPitchAndFamily = GetPrivateProfileInt(csSection, _T("PitchAndFamily"), 0, m_csIniFileName);
  423. GetPrivateProfileString(csSection, _T("FaceName"), _T(""), font.lfFaceName, sizeof(font.lfFaceName), m_csIniFileName);
  424. return TRUE;
  425. }
  426. BOOL CGetSetOptions::SetProfileFont(CString csSection, LOGFONT &font)
  427. {
  428. WritePrivateProfileInt(csSection, _T("Height"), font.lfHeight, m_csIniFileName);
  429. WritePrivateProfileInt(csSection, _T("Width"), font.lfWidth, m_csIniFileName);
  430. WritePrivateProfileInt(csSection, _T("Escapement"), font.lfEscapement, m_csIniFileName);
  431. WritePrivateProfileInt(csSection, _T("Orientation"), font.lfOrientation, m_csIniFileName);
  432. WritePrivateProfileInt(csSection, _T("Weight"), font.lfWeight, m_csIniFileName);
  433. WritePrivateProfileInt(csSection, _T("Italic"), font.lfItalic, m_csIniFileName);
  434. WritePrivateProfileInt(csSection, _T("Underline"), font.lfUnderline, m_csIniFileName);
  435. WritePrivateProfileInt(csSection, _T("StrikeOut"), font.lfStrikeOut, m_csIniFileName);
  436. WritePrivateProfileInt(csSection, _T("CharSet"), font.lfCharSet, m_csIniFileName);
  437. WritePrivateProfileInt(csSection, _T("OutPrecision"), font.lfOutPrecision, m_csIniFileName);
  438. WritePrivateProfileInt(csSection, _T("ClipPrecision"), font.lfClipPrecision, m_csIniFileName);
  439. WritePrivateProfileInt(csSection, _T("Quality"), font.lfQuality, m_csIniFileName);
  440. WritePrivateProfileInt(csSection, _T("PitchAndFamily"), font.lfPitchAndFamily, m_csIniFileName);
  441. WritePrivateProfileString(csSection, _T("FaceName"), font.lfFaceName, m_csIniFileName);
  442. return TRUE;
  443. }
  444. LPVOID CGetSetOptions::GetProfileData(CString csName, DWORD &dwLength)
  445. {
  446. if(m_bFromIni && !m_bInConversion)
  447. {
  448. ASSERT(!"GetProfileData not supported in .ini settings");
  449. return NULL;
  450. }
  451. HKEY hkKey;
  452. long lResult = RegOpenKeyEx(HKEY_CURRENT_USER, _T(REG_PATH),
  453. NULL, KEY_READ, &hkKey);
  454. lResult = ::RegQueryValueEx(hkKey , csName, NULL, NULL, NULL, &dwLength);
  455. if(lResult != ERROR_SUCCESS)
  456. return NULL;
  457. LPVOID lpVoid = new BYTE[dwLength];
  458. lResult = ::RegQueryValueEx(hkKey , csName, NULL, NULL, (LPBYTE)lpVoid, &dwLength);
  459. RegCloseKey(hkKey);
  460. if(lResult != ERROR_SUCCESS)
  461. return NULL;
  462. return lpVoid;
  463. }
  464. BOOL CGetSetOptions::GetShowIconInSysTray()
  465. {
  466. return GetProfileLong("ShowIconInSystemTray", TRUE);
  467. }
  468. BOOL CGetSetOptions::SetShowIconInSysTray(BOOL bShow)
  469. {
  470. return SetProfileLong("ShowIconInSystemTray", bShow);
  471. }
  472. BOOL CGetSetOptions::SetEnableTransparency(BOOL bCheck)
  473. {
  474. return SetProfileLong("EnableTransparency", bCheck);
  475. }
  476. BOOL CGetSetOptions::GetEnableTransparency()
  477. {
  478. return GetProfileLong("EnableTransparency", FALSE);
  479. }
  480. BOOL CGetSetOptions::SetTransparencyPercent(long lPercent)
  481. {
  482. #ifdef AFTER_98
  483. if(lPercent > OPACITY_MAX)
  484. lPercent = OPACITY_MAX;
  485. if(lPercent < 0)
  486. lPercent = 0;
  487. return SetProfileLong("TransparencyPercent", lPercent);
  488. #endif
  489. return FALSE;
  490. }
  491. long CGetSetOptions::GetTransparencyPercent()
  492. {
  493. #ifdef AFTER_98
  494. long lValue = GetProfileLong("TransparencyPercent", 14);
  495. if(lValue > OPACITY_MAX) lValue = OPACITY_MAX;
  496. if(lValue < 0) lValue = 0;
  497. return lValue;
  498. #endif
  499. return 0;
  500. }
  501. BOOL CGetSetOptions::SetLinesPerRow(long lLines)
  502. {
  503. m_nLinesPerRow = lLines;
  504. return SetProfileLong("LinesPerRow", lLines);
  505. }
  506. long CGetSetOptions::GetLinesPerRow()
  507. {
  508. return GetProfileLong("LinesPerRow", 2);
  509. }
  510. BOOL CGetSetOptions::GetRunOnStartUp()
  511. {
  512. HKEY hkRun;
  513. LONG nResult = RegOpenKeyEx(HKEY_CURRENT_USER,
  514. _T("Software\\Microsoft\\Windows\\CurrentVersion\\Run"),
  515. NULL, KEY_READ, &hkRun);
  516. if(nResult != ERROR_SUCCESS)
  517. return FALSE;
  518. nResult = RegQueryValueEx(hkRun, GetAppName(), NULL, NULL, NULL, NULL);
  519. RegCloseKey(hkRun);
  520. return nResult == ERROR_SUCCESS;
  521. }
  522. void CGetSetOptions::SetRunOnStartUp(BOOL bRun)
  523. {
  524. //Can't set auto run when running from U3 device
  525. if(m_bU3)
  526. return;
  527. if(bRun == GetRunOnStartUp())
  528. return;
  529. HKEY hkRun;
  530. LONG nResult = RegOpenKeyEx(HKEY_CURRENT_USER,
  531. _T("Software\\Microsoft\\Windows\\CurrentVersion\\Run"),
  532. NULL, KEY_ALL_ACCESS, &hkRun);
  533. if(nResult != ERROR_SUCCESS)
  534. return;
  535. if(bRun)
  536. {
  537. CString sExeName = GetExeFileName();
  538. ::RegSetValueEx(hkRun, GetAppName(), NULL, REG_SZ,
  539. (BYTE*)(LPCTSTR)sExeName, sExeName.GetLength()*sizeof(TCHAR));
  540. }
  541. else
  542. {
  543. ::RegDeleteValue(hkRun, GetAppName());
  544. }
  545. ::RegCloseKey(hkRun);
  546. }
  547. CString CGetSetOptions::GetExeFileName()
  548. {
  549. CString sExeName;
  550. GetModuleFileName(NULL, sExeName.GetBuffer(_MAX_PATH),_MAX_PATH);
  551. sExeName.ReleaseBuffer();
  552. return sExeName;
  553. }
  554. CString CGetSetOptions::GetAppName()
  555. {
  556. return "Ditto";
  557. }
  558. BOOL CGetSetOptions::SetQuickPastePosition(long lPosition)
  559. {
  560. return SetProfileLong("ShowQuickPastePosition", lPosition);
  561. }
  562. long CGetSetOptions::GetQuickPastePosition()
  563. {
  564. return GetProfileLong("ShowQuickPastePosition", POS_AT_PREVIOUS);
  565. }
  566. BOOL CGetSetOptions::SetQuickPasteSize(CSize size)
  567. {
  568. BOOL bRet = SetProfileLong("QuickPasteCX", size.cx);
  569. bRet = SetProfileLong("QuickPasteCY", size.cy);
  570. return bRet;
  571. }
  572. void CGetSetOptions::GetQuickPasteSize(CSize &size)
  573. {
  574. size.cx = GetProfileLong("QuickPasteCX", 300);
  575. size.cy = GetProfileLong("QuickPasteCY", 300);
  576. if(size.cx <= 0 && size.cy <= 0)
  577. {
  578. size.cx = 300;
  579. size.cy = 300;
  580. }
  581. }
  582. BOOL CGetSetOptions::SetQuickPastePoint(CPoint point)
  583. {
  584. BOOL bRet = SetProfileLong("QuickPasteX", point.x);
  585. bRet = SetProfileLong("QuickPasteY", point.y);
  586. return bRet;
  587. }
  588. void CGetSetOptions::GetQuickPastePoint(CPoint &point)
  589. {
  590. point.x = GetProfileLong("QuickPasteX", 300);
  591. point.y = GetProfileLong("QuickPasteY", 300);
  592. if(point.x <= 0 && point.y <= 0)
  593. {
  594. point.x = 300;
  595. point.y = 300;
  596. }
  597. }
  598. BOOL CGetSetOptions::SetEditWndSize(CSize size)
  599. {
  600. BOOL bRet = SetProfileLong("EditWndCX", size.cx);
  601. bRet = SetProfileLong("EditWndCY", size.cy);
  602. return bRet;
  603. }
  604. void CGetSetOptions::GetEditWndSize(CSize &size)
  605. {
  606. size.cx = GetProfileLong("EditWndCX", 600);
  607. size.cy = GetProfileLong("EditWndCY", 600);
  608. if(size.cx <= 0 && size.cy <= 0)
  609. {
  610. size.cx = 600;
  611. size.cy = 600;
  612. }
  613. }
  614. BOOL CGetSetOptions::SetEditWndPoint(CPoint point)
  615. {
  616. BOOL bRet = SetProfileLong("EditWndX", point.x);
  617. bRet = SetProfileLong("EditWndY", point.y);
  618. return bRet;
  619. }
  620. void CGetSetOptions::GetEditWndPoint(CPoint &point)
  621. {
  622. point.x = GetProfileLong("EditWndX", 100);
  623. point.y = GetProfileLong("EditWndY", 100);
  624. if(point.x <= 0 && point.y <= 0)
  625. {
  626. point.x = 100;
  627. point.y = 100;
  628. }
  629. }
  630. long CGetSetOptions::GetCopyGap()
  631. {
  632. return GetProfileLong("CopyGap", 150);
  633. }
  634. void CGetSetOptions::SetCopyGap(long lGap)
  635. {
  636. SetProfileLong("CopyGap", lGap);
  637. }
  638. BOOL CGetSetOptions::SetDBPathOld(CString csPath)
  639. {
  640. return SetProfileString("DBPath", csPath);
  641. }
  642. CString CGetSetOptions::GetDBPathOld()
  643. {
  644. return GetProfileString("DBPath", "");
  645. }
  646. BOOL CGetSetOptions::SetDBPath(CString csPath)
  647. {
  648. return SetProfileString("DBPath3", csPath);
  649. }
  650. CString CGetSetOptions::GetDBPath()
  651. {
  652. CString csDBPath;
  653. if(m_bU3)
  654. {
  655. csDBPath = GetProfileString("DBPath3", "");
  656. if(csDBPath.IsEmpty())
  657. {
  658. csDBPath = GetDefaultDBName();
  659. }
  660. CPath ExistingPath(csDBPath);
  661. csDBPath = CGetSetOptions::GetPath(PATH_DATABASE);
  662. csDBPath += ExistingPath.GetName();
  663. }
  664. else
  665. {
  666. csDBPath = GetProfileString("DBPath3", "");
  667. }
  668. return csDBPath;
  669. }
  670. void CGetSetOptions::SetCheckForMaxEntries(BOOL bVal)
  671. {
  672. SetProfileLong("CheckForMaxEntries", bVal);
  673. }
  674. BOOL CGetSetOptions::GetCheckForMaxEntries()
  675. {
  676. BOOL bDefault = FALSE;
  677. if(m_bU3)
  678. bDefault = TRUE;
  679. return GetProfileLong("CheckForMaxEntries", bDefault);
  680. }
  681. void CGetSetOptions::SetCheckForExpiredEntries(BOOL bVal)
  682. {
  683. SetProfileLong("CheckForExpiredEntries", bVal);
  684. }
  685. BOOL CGetSetOptions::GetCheckForExpiredEntries()
  686. {
  687. return GetProfileLong("CheckForExpiredEntries", FALSE);
  688. }
  689. void CGetSetOptions::SetMaxEntries(long lVal)
  690. {
  691. SetProfileLong("MaxEntries", lVal);
  692. }
  693. long CGetSetOptions::GetMaxEntries()
  694. {
  695. long lMax = 500;
  696. if(m_bU3)
  697. lMax = 75;
  698. return GetProfileLong("MaxEntries", lMax);
  699. }
  700. void CGetSetOptions::SetExpiredEntries(long lVal)
  701. {
  702. SetProfileLong("ExpiredEntries", lVal);
  703. }
  704. long CGetSetOptions::GetExpiredEntries()
  705. {
  706. return GetProfileLong("ExpiredEntries", 5);
  707. }
  708. void CGetSetOptions::SetTripCopyCount(long lVal)
  709. {
  710. // negative means a relative offset
  711. if(lVal < 0)
  712. lVal = GetTripCopyCount() - lVal; // add the absolute value
  713. if(GetTripDate() == 0)
  714. SetTripDate(-1);
  715. SetProfileLong("TripCopies", lVal);
  716. }
  717. long CGetSetOptions::GetTripCopyCount()
  718. {
  719. return GetProfileLong("TripCopies", 0);
  720. }
  721. void CGetSetOptions::SetTripPasteCount(long lVal)
  722. {
  723. // negative means a relative offset
  724. if(lVal < 0)
  725. lVal = GetTripPasteCount() - lVal; // add the absolute value
  726. if(GetTripDate() == 0)
  727. SetTripDate(-1);
  728. SetProfileLong("TripPastes", lVal);
  729. }
  730. long CGetSetOptions::GetTripPasteCount()
  731. {
  732. return GetProfileLong("TripPastes", 0);
  733. }
  734. void CGetSetOptions::SetTripDate(long lDate)
  735. {
  736. if(lDate == -1)
  737. lDate = (long)CTime::GetCurrentTime().GetTime();
  738. SetProfileLong("TripDate", lDate);
  739. }
  740. long CGetSetOptions::GetTripDate()
  741. {
  742. return GetProfileLong("TripDate", 0);
  743. }
  744. void CGetSetOptions::SetTotalCopyCount(long lVal)
  745. {
  746. // negative means a relative offset
  747. if(lVal < 0)
  748. lVal = GetTotalCopyCount() - lVal; // add the absolute value
  749. if(GetTotalDate() == 0)
  750. SetTotalDate(-1);
  751. SetProfileLong("TotalCopies", lVal);
  752. }
  753. long CGetSetOptions::GetTotalCopyCount()
  754. {
  755. return GetProfileLong("TotalCopies", 0);
  756. }
  757. void CGetSetOptions::SetTotalPasteCount(long lVal)
  758. {
  759. // negative means a relative offset
  760. if(lVal < 0)
  761. lVal = GetTotalPasteCount() - lVal; // add the absolute value
  762. if(GetTotalDate() == 0)
  763. SetTotalDate(-1);
  764. SetProfileLong("TotalPastes", lVal);
  765. }
  766. long CGetSetOptions::GetTotalPasteCount()
  767. {
  768. return GetProfileLong("TotalPastes", 0);
  769. }
  770. void CGetSetOptions::SetTotalDate(long lDate)
  771. {
  772. if(lDate == -1)
  773. lDate = (long)CTime::GetCurrentTime().GetTime();
  774. SetProfileLong("TotalDate", lDate);
  775. }
  776. long CGetSetOptions::GetTotalDate()
  777. {
  778. return GetProfileLong("TotalDate", 0);
  779. }
  780. CString CGetSetOptions::GetUpdateFilePath()
  781. {
  782. return GetProfileString("UpdateFilePath", "");
  783. }
  784. BOOL CGetSetOptions::SetUpdateFilePath(CString cs)
  785. {
  786. return SetProfileString("UpdateFilePath", cs);
  787. }
  788. CString CGetSetOptions::GetUpdateInstallPath()
  789. {
  790. return GetProfileString("UpdateInstallPath", "");
  791. }
  792. BOOL CGetSetOptions::SetUpdateInstallPath(CString cs)
  793. {
  794. return SetProfileString("UpdateInstallPath", cs);
  795. }
  796. long CGetSetOptions::GetLastUpdate()
  797. {
  798. return GetProfileLong("LastUpdateDay", 0);
  799. }
  800. long CGetSetOptions::SetLastUpdate(long lValue)
  801. {
  802. return SetProfileLong("LastUpdateDay", lValue);
  803. }
  804. BOOL CGetSetOptions::GetCheckForUpdates()
  805. {
  806. return GetProfileLong("CheckForUpdates", TRUE);
  807. }
  808. BOOL CGetSetOptions::SetCheckForUpdates(BOOL bCheck)
  809. {
  810. return SetProfileLong("CheckForUpdates", bCheck);
  811. }
  812. void CGetSetOptions::SetUseCtrlNumForFirstTenHotKeys(BOOL bVal)
  813. {
  814. SetProfileLong("UseCtrlNumForFirstTenHotKeys", bVal);
  815. m_bUseCtrlNumAccel = bVal;
  816. }
  817. BOOL CGetSetOptions::GetUseCtrlNumForFirstTenHotKeys()
  818. {
  819. return GetProfileLong("UseCtrlNumForFirstTenHotKeys", 0);
  820. }
  821. void CGetSetOptions::SetAllowDuplicates(BOOL bVal)
  822. {
  823. SetProfileLong("AllowDuplicates", bVal);
  824. m_bAllowDuplicates = bVal;
  825. }
  826. BOOL CGetSetOptions::GetAllowDuplicates()
  827. {
  828. return GetProfileLong("AllowDuplicates", 0);
  829. }
  830. void CGetSetOptions::SetUpdateTimeOnPaste(BOOL bVal)
  831. {
  832. SetProfileLong("UpdateTimeOnPaste", bVal);
  833. m_bUpdateTimeOnPaste = bVal;
  834. }
  835. BOOL CGetSetOptions::GetUpdateTimeOnPaste()
  836. {
  837. return GetProfileLong("UpdateTimeOnPaste", TRUE);
  838. }
  839. void CGetSetOptions::SetSaveMultiPaste(BOOL bVal)
  840. {
  841. SetProfileLong("SaveMultiPaste", bVal);
  842. m_bSaveMultiPaste = bVal;
  843. }
  844. BOOL CGetSetOptions::GetSaveMultiPaste()
  845. {
  846. return GetProfileLong("SaveMultiPaste", 0);
  847. }
  848. void CGetSetOptions::SetShowPersistent(BOOL bVal)
  849. {
  850. SetProfileLong("ShowPersistent", bVal);
  851. m_bShowPersistent = bVal;
  852. }
  853. BOOL CGetSetOptions::GetShowPersistent()
  854. {
  855. return GetProfileLong("ShowPersistent", 0);
  856. }
  857. void CGetSetOptions::SetHistoryStartTop(BOOL bVal)
  858. {
  859. SetProfileLong("HistoryStartTop", bVal);
  860. m_bHistoryStartTop = bVal;
  861. }
  862. BOOL CGetSetOptions::GetHistoryStartTop()
  863. {
  864. return GetProfileLong("HistoryStartTop", TRUE);
  865. }
  866. void CGetSetOptions::SetShowTextForFirstTenHotKeys(BOOL bVal)
  867. {
  868. SetProfileLong("ShowTextForFirstTenHotKeys", bVal);
  869. }
  870. BOOL CGetSetOptions::GetShowTextForFirstTenHotKeys()
  871. {
  872. return GetProfileLong("ShowTextForFirstTenHotKeys", TRUE);
  873. }
  874. void CGetSetOptions::SetMainHWND(long lhWnd)
  875. {
  876. SetProfileLong("MainhWnd", lhWnd);
  877. }
  878. BOOL CGetSetOptions::GetMainHWND()
  879. {
  880. return GetProfileLong("MainhWnd", 0);
  881. }
  882. void CGetSetOptions::SetCaptionPos(long lPos)
  883. {
  884. SetProfileLong("CaptionPos", lPos);
  885. }
  886. long CGetSetOptions::GetCaptionPos()
  887. {
  888. return GetProfileLong("CaptionPos", CAPTION_RIGHT);
  889. }
  890. void CGetSetOptions::SetAutoHide(BOOL bAutoHide)
  891. {
  892. SetProfileLong("AutoHide", bAutoHide);
  893. }
  894. BOOL CGetSetOptions::GetAutoHide()
  895. {
  896. return GetProfileLong("AutoHide", FALSE);
  897. }
  898. void CGetSetOptions::SetDescTextSize(long lSize)
  899. {
  900. SetProfileLong("DescTextSize", lSize);
  901. m_bDescTextSize = lSize;
  902. }
  903. long CGetSetOptions::GetDescTextSize()
  904. {
  905. return GetProfileLong("DescTextSize", 500);
  906. }
  907. void CGetSetOptions::SetDescShowLeadingWhiteSpace(BOOL bVal)
  908. {
  909. SetProfileLong("DescShowLeadingWhiteSpace", bVal);
  910. m_bDescShowLeadingWhiteSpace = bVal;
  911. }
  912. BOOL CGetSetOptions::GetDescShowLeadingWhiteSpace()
  913. {
  914. return GetProfileLong("DescShowLeadingWhiteSpace", FALSE);
  915. }
  916. void CGetSetOptions::SetAllwaysShowDescription(long bShow)
  917. {
  918. SetProfileLong("AllwaysShowDescription", bShow);
  919. m_bAllwaysShowDescription = bShow;
  920. }
  921. BOOL CGetSetOptions::GetAllwaysShowDescription()
  922. {
  923. return GetProfileLong("AllwaysShowDescription", FALSE);
  924. }
  925. void CGetSetOptions::SetDoubleClickingOnCaptionDoes(long lOption)
  926. {
  927. SetProfileLong("DoubleClickingOnCaptionDoes", lOption);
  928. m_bDoubleClickingOnCaptionDoes = lOption;
  929. }
  930. long CGetSetOptions::GetDoubleClickingOnCaptionDoes()
  931. {
  932. return GetProfileLong("DoubleClickingOnCaptionDoes", TOGGLES_ALLWAYS_ON_TOP);
  933. }
  934. void CGetSetOptions::SetPrompForNewGroupName(BOOL bOption)
  935. {
  936. SetProfileLong("PrompForNewGroupName", bOption);
  937. m_bPrompForNewGroupName = bOption;
  938. }
  939. BOOL CGetSetOptions::GetPrompForNewGroupName()
  940. {
  941. return GetProfileLong("PrompForNewGroupName", TRUE);
  942. }
  943. void CGetSetOptions::SetSendPasteOnFirstTenHotKeys(BOOL bOption)
  944. {
  945. SetProfileLong("SendPasteOnFirstTenHotKeys", bOption);
  946. m_bSendPasteOnFirstTenHotKeys = bOption;
  947. }
  948. BOOL CGetSetOptions::GetSendPasteOnFirstTenHotKeys()
  949. {
  950. return GetProfileLong("SendPasteOnFirstTenHotKeys", TRUE);
  951. }
  952. void CGetSetOptions::SetSendClients(CSendClients Client, int nPos)
  953. {
  954. CString cs;
  955. cs.Format(_T("sendclient_ip_%d"), nPos);
  956. SetProfileString(cs, Client.csIP);
  957. cs.Format(_T("sendclient_autosend_%d"), nPos);
  958. SetProfileLong(cs, Client.bSendAll);
  959. cs.Format(_T("sendclient_description_%d"), nPos);
  960. SetProfileString(cs, Client.csDescription);
  961. Client.bShownFirstError = m_SendClients[nPos].bShownFirstError;
  962. m_SendClients[nPos] = Client;
  963. }
  964. CSendClients CGetSetOptions::GetSendClients(int nPos)
  965. {
  966. CSendClients Client;
  967. CString cs;
  968. cs.Format(_T("sendclient_ip_%d"), nPos);
  969. Client.csIP = GetProfileString(cs, "");
  970. cs.Format(_T("sendclient_autosend_%d"), nPos);
  971. Client.bSendAll = GetProfileLong(cs, FALSE);
  972. cs.Format(_T("sendclient_description_%d"), nPos);
  973. Client.csDescription = GetProfileString(cs, "");
  974. m_SendClients[nPos] = Client;
  975. return Client;
  976. }
  977. void CGetSetOptions::GetClientSendCount()
  978. {
  979. m_lAutoSendClientCount = 0;
  980. for(int i = 0; i < MAX_SEND_CLIENTS; i++)
  981. {
  982. if(m_SendClients[i].csIP.GetLength() > 0)
  983. {
  984. if(m_SendClients[i].bSendAll)
  985. m_lAutoSendClientCount++;
  986. }
  987. }
  988. }
  989. CString CGetSetOptions::GetListToPutOnClipboard()
  990. {
  991. CString cs = GetProfileString("ListToPutOnClipboard", "");
  992. cs.MakeUpper();
  993. return cs;
  994. }
  995. BOOL CGetSetOptions::SetListToPutOnClipboard(CString cs)
  996. {
  997. cs.MakeUpper();
  998. m_csIPListToPutOnClipboard = cs;
  999. return SetProfileString("ListToPutOnClipboard", cs);
  1000. }
  1001. void CGetSetOptions::SetLogSendReceiveErrors(BOOL bOption)
  1002. {
  1003. m_bLogSendReceiveErrors = bOption;
  1004. SetProfileLong("LogSendReceiveErrors", bOption);
  1005. }
  1006. BOOL CGetSetOptions::GetLogSendReceiveErrors()
  1007. {
  1008. return GetProfileLong("LogSendReceiveErrors", FALSE);
  1009. }
  1010. BOOL CGetSetOptions::GetHideDittoOnHotKeyIfAlreadyShown()
  1011. {
  1012. return GetProfileLong("HideDittoOnHotKeyIfAlreadyShown", TRUE);
  1013. }
  1014. void CGetSetOptions::SetHideDittoOnHotKeyIfAlreadyShown(BOOL bVal)
  1015. {
  1016. m_HideDittoOnHotKeyIfAlreadyShown = bVal;
  1017. SetProfileLong("HideDittoOnHotKeyIfAlreadyShown", bVal);
  1018. }
  1019. void CGetSetOptions::SetPort(long lPort)
  1020. {
  1021. m_lPort = lPort;
  1022. SetProfileLong("SendRecvPort", lPort);
  1023. }
  1024. long CGetSetOptions::GetPort()
  1025. {
  1026. return GetProfileLong("SendRecvPort", 23443);
  1027. }
  1028. BOOL CGetSetOptions::GetDisableRecieve()
  1029. {
  1030. BOOL bDefault = FALSE;
  1031. if(m_bU3)
  1032. bDefault = TRUE;
  1033. return GetProfileLong("DisableRecieve", bDefault);
  1034. }
  1035. void CGetSetOptions::SetDisableRecieve(BOOL bVal)
  1036. {
  1037. SetProfileLong("DisableRecieve", bVal);
  1038. }
  1039. BOOL CGetSetOptions::GetFont(LOGFONT &font)
  1040. {
  1041. if(m_bFromIni && !m_bInConversion)
  1042. {
  1043. GetProfileFont("DisplayFont", font);
  1044. //Return true if there is a font name
  1045. //other wise load the default font below
  1046. if(font.lfFaceName[0] != 0)
  1047. {
  1048. return TRUE;
  1049. }
  1050. }
  1051. else
  1052. {
  1053. DWORD dwLength = 0;
  1054. #ifdef _UNICODE
  1055. LPVOID lpVoid = GetProfileData("DisplayFont3", dwLength);
  1056. #else
  1057. LPVOID lpVoid = GetProfileData("DisplayFont", dwLength);
  1058. #endif
  1059. if(lpVoid)
  1060. {
  1061. if(sizeof(font) == dwLength)
  1062. {
  1063. memcpy(&font, lpVoid, dwLength);
  1064. delete[] lpVoid;
  1065. lpVoid = NULL;
  1066. return TRUE;
  1067. }
  1068. else
  1069. {
  1070. ASSERT(!"invalid font struct size");
  1071. }
  1072. delete[] lpVoid;
  1073. lpVoid = NULL;
  1074. }
  1075. }
  1076. ZeroMemory(&font, sizeof(font));
  1077. font.lfHeight = -11;
  1078. font.lfWeight = 400;
  1079. font.lfCharSet = 1;
  1080. STRCPY(font.lfFaceName, _T("@Arial Unicode MS"));
  1081. return TRUE;
  1082. }
  1083. void CGetSetOptions::SetFont(LOGFONT &font)
  1084. {
  1085. if(m_bFromIni)
  1086. {
  1087. SetProfileFont("DisplayFont", font);
  1088. }
  1089. else
  1090. {
  1091. #ifdef _UNICODE
  1092. CString csParam = "DisplayFont3";
  1093. #else
  1094. CString csParam = "DisplayFont";
  1095. #endif
  1096. SetProfileData(csParam, &font, sizeof(LOGFONT));
  1097. }
  1098. }
  1099. void CGetSetOptions::SetDrawThumbnail(long bDraw)
  1100. {
  1101. SetProfileLong("DrawThumbnail", bDraw);
  1102. m_bDrawThumbnail = bDraw;
  1103. }
  1104. BOOL CGetSetOptions::GetDrawThumbnail()
  1105. {
  1106. BOOL bDrawThumbnails = TRUE;
  1107. if(g_Opt.m_bU3)
  1108. bDrawThumbnails = FALSE;
  1109. return GetProfileLong("DrawThumbnail", bDrawThumbnails);
  1110. }
  1111. void CGetSetOptions::SetExtraNetworkPassword(CString csPassword)
  1112. {
  1113. SetProfileString("NetworkExtraPassword", csPassword);
  1114. }
  1115. CString CGetSetOptions::GetExtraNetworkPassword(bool bFillArray)
  1116. {
  1117. CString cs = GetProfileString("NetworkExtraPassword", "");
  1118. if(bFillArray)
  1119. {
  1120. m_csNetworkPasswordArray.RemoveAll();
  1121. TCHAR seps[] = _T(",");
  1122. TCHAR *token;
  1123. TCHAR *pString = cs.GetBuffer(cs.GetLength());
  1124. /* Establish string and get the first token: */
  1125. token = STRTOK(pString, seps);
  1126. while(token != NULL)
  1127. {
  1128. CString cs(token);
  1129. cs.TrimLeft();
  1130. cs.TrimRight();
  1131. m_csNetworkPasswordArray.Add(cs);
  1132. // Get next token
  1133. token = STRTOK(NULL, seps);
  1134. }
  1135. cs.ReleaseBuffer();
  1136. }
  1137. return cs;
  1138. }
  1139. void CGetSetOptions::SetNetworkPassword(CString csPassword)
  1140. {
  1141. CTextConvert Con;
  1142. Con.ConvertToUTF8(csPassword, m_csPassword);
  1143. SetProfileString("NetworkStringPassword", csPassword);
  1144. }
  1145. CStringA CGetSetOptions::GetNetworkPassword()
  1146. {
  1147. CString cs = GetProfileString("NetworkStringPassword", "LetMeIn");
  1148. CTextConvert Con;
  1149. CStringA csReturn;
  1150. Con.ConvertToUTF8(cs, csReturn);
  1151. return csReturn;
  1152. }
  1153. void CGetSetOptions::SetDrawRTF(long bDraw)
  1154. {
  1155. SetProfileLong("DrawRTF", bDraw);
  1156. m_bDrawRTF = bDraw;
  1157. }
  1158. BOOL CGetSetOptions::GetDrawRTF()
  1159. {
  1160. return GetProfileLong("DrawRTF", FALSE);
  1161. }
  1162. void CGetSetOptions::SetMultiPasteReverse(BOOL bVal)
  1163. {
  1164. SetProfileLong("MultiPasteReverse", bVal);
  1165. m_bMultiPasteReverse = bVal;
  1166. }
  1167. BOOL CGetSetOptions::GetMultiPasteReverse()
  1168. {
  1169. return GetProfileLong("MultiPasteReverse", TRUE);
  1170. }
  1171. void CGetSetOptions::SetPlaySoundOnCopy(CString cs)
  1172. {
  1173. m_csPlaySoundOnCopy = cs;
  1174. SetProfileString("PlaySoundOnCopy", cs);
  1175. }
  1176. CString CGetSetOptions::GetPlaySoundOnCopy()
  1177. {
  1178. return GetProfileString("PlaySoundOnCopy", "");
  1179. }
  1180. void CGetSetOptions::SetSendPasteAfterSelection(BOOL bVal)
  1181. {
  1182. m_bSendPasteMessageAfterSelection = bVal;
  1183. SetProfileLong("SendPasteMessageAfterSelection", bVal);
  1184. }
  1185. BOOL CGetSetOptions::GetSendPasteAfterSelection()
  1186. {
  1187. return GetProfileLong("SendPasteMessageAfterSelection", TRUE);
  1188. }
  1189. void CGetSetOptions::SetFindAsYouType(BOOL bVal)
  1190. {
  1191. m_bFindAsYouType = bVal;
  1192. SetProfileLong("FindAsYouType", bVal);
  1193. }
  1194. BOOL CGetSetOptions::GetFindAsYouType()
  1195. {
  1196. return GetProfileLong("FindAsYouType", TRUE);
  1197. }
  1198. void CGetSetOptions::SetEnsureEntireWindowCanBeSeen(BOOL bVal)
  1199. {
  1200. m_bEnsureEntireWindowCanBeSeen = bVal;
  1201. SetProfileLong("EnsureEntireWindowCanBeSeen", bVal);
  1202. }
  1203. BOOL CGetSetOptions::GetEnsureEntireWindowCanBeSeen()
  1204. {
  1205. return GetProfileLong("EnsureEntireWindowCanBeSeen", TRUE);
  1206. }
  1207. void CGetSetOptions::SetShowAllClipsInMainList(BOOL bVal)
  1208. {
  1209. m_bShowAllClipsInMainList = bVal;
  1210. SetProfileLong("ShowAllClipsInMainList", bVal);
  1211. }
  1212. BOOL CGetSetOptions::GetShowAllClipsInMainList()
  1213. {
  1214. return GetProfileLong("ShowAllClipsInMainList", TRUE);
  1215. }
  1216. long CGetSetOptions::GetMaxClipSizeInBytes()
  1217. {
  1218. return GetProfileLong("MaxClipSizeInBytes", 0);
  1219. }
  1220. void CGetSetOptions::SetMaxClipSizeInBytes(long lSize)
  1221. {
  1222. m_lMaxClipSizeInBytes = lSize;
  1223. SetProfileLong("MaxClipSizeInBytes", lSize);
  1224. }
  1225. CString CGetSetOptions::GetLanguageFile()
  1226. {
  1227. return GetProfileString("LanguageFile", "");
  1228. }
  1229. void CGetSetOptions::SetLanguageFile(CString csLanguage)
  1230. {
  1231. SetProfileString("LanguageFile", csLanguage);
  1232. }
  1233. ULONG CGetSetOptions::GetSaveClipDelay()
  1234. {
  1235. return (ULONG)GetProfileLong("SaveClipDelay", 500);
  1236. }
  1237. void CGetSetOptions::SetSaveClipDelay(DWORD dwDelay)
  1238. {
  1239. m_dwSaveClipDelay = dwDelay;
  1240. SetProfileLong("SaveClipDelay", dwDelay);
  1241. }
  1242. long CGetSetOptions::GetProcessDrawClipboardDelay()
  1243. {
  1244. return GetProfileLong("ProcessDrawClipboardDelay", 100);
  1245. }
  1246. void CGetSetOptions::SetProcessDrawClipboardDelay(long lDelay)
  1247. {
  1248. m_lProcessDrawClipboardDelay = lDelay;
  1249. SetProfileLong("ProcessDrawClipboardDelay", lDelay);
  1250. }
  1251. BOOL CGetSetOptions::GetEnableDebugLogging()
  1252. {
  1253. return GetProfileLong("EnableDebugLogging", FALSE);
  1254. }
  1255. void CGetSetOptions::SetEnableDebugLogging(BOOL bEnable)
  1256. {
  1257. m_bEnableDebugLogging = bEnable;
  1258. SetProfileLong("EnableDebugLogging", bEnable);
  1259. }
  1260. BOOL CGetSetOptions::GetEnsureConnectToClipboard()
  1261. {
  1262. return GetProfileLong("EnsureConnected", TRUE);
  1263. }
  1264. void CGetSetOptions::SetEnsureConnectToClipboard(BOOL bSet)
  1265. {
  1266. m_bEnsureConnectToClipboard = bSet;
  1267. SetProfileLong("EnsureConnected", bSet);
  1268. }
  1269. BOOL CGetSetOptions::GetPromptWhenDeletingClips()
  1270. {
  1271. return GetProfileLong("PromptWhenDeletingClips", TRUE);
  1272. }
  1273. void CGetSetOptions::SetPromptWhenDeletingClips(BOOL bSet)
  1274. {
  1275. SetProfileLong("PromptWhenDeletingClips", bSet);
  1276. }
  1277. CString CGetSetOptions::GetLastImportDir()
  1278. {
  1279. return GetProfileString("LastImportDir", "");
  1280. }
  1281. void CGetSetOptions::SetLastImportDir(CString csDir)
  1282. {
  1283. SetProfileString("LastImportDir", csDir);
  1284. }
  1285. CString CGetSetOptions::GetLastExportDir()
  1286. {
  1287. return GetProfileString("LastExportDir", "");
  1288. }
  1289. void CGetSetOptions::SetLastExportDir(CString csDir)
  1290. {
  1291. SetProfileString("LastExportDir", csDir);
  1292. }
  1293. BOOL CGetSetOptions::GetUpdateDescWhenSavingClip()
  1294. {
  1295. return GetProfileLong("UpdateDescWhenSaving", TRUE);
  1296. }
  1297. void CGetSetOptions::SetUpdateDescWhenSavingClip(BOOL bSet)
  1298. {
  1299. SetProfileLong("UpdateDescWhenSaving", bSet);
  1300. }
  1301. CString CGetSetOptions::GetPath(long lPathID)
  1302. {
  1303. CString csDir = CGetSetOptions::GetExeFileName();
  1304. csDir = GetFilePath(csDir);
  1305. FIX_CSTRING_PATH(csDir);
  1306. //U3_APP_DATA_PATH - <U3_DEVICE_PATH>\System\Apps\{app_unique_id}\Data
  1307. //U3_HOST_EXEC_PATH - %APPDATA%\U3\{device_serial_number}\{app_unique_id}\Exec
  1308. //U3_DEVICE_EXEC_PATH - <U3_DEVICE_PATH>\System\Apps\{app_unique_id}\Exec
  1309. switch(lPathID)
  1310. {
  1311. case PATH_HELP:
  1312. if(m_bU3)
  1313. {
  1314. csDir = GETENV(_T("U3_DEVICE_EXEC_PATH"));
  1315. FIX_CSTRING_PATH(csDir);
  1316. }
  1317. csDir += "Help\\";
  1318. break;
  1319. case PATH_LANGUAGE:
  1320. if(m_bU3)
  1321. {
  1322. csDir = GETENV(_T("U3_DEVICE_EXEC_PATH"));
  1323. FIX_CSTRING_PATH(csDir);
  1324. }
  1325. csDir += "language\\";
  1326. break;
  1327. case PATH_REMOTE_FILES:
  1328. if(m_bU3)
  1329. {
  1330. csDir = GETENV(_T("U3_HOST_EXEC_PATH"));
  1331. FIX_CSTRING_PATH(csDir);
  1332. }
  1333. csDir += "ReceivedFiles\\";
  1334. break;
  1335. case PATH_LOG_FILE:
  1336. if(m_bU3)
  1337. {
  1338. csDir = GETENV(_T("U3_HOST_EXEC_PATH"));
  1339. FIX_CSTRING_PATH(csDir);
  1340. }
  1341. break;
  1342. case PATH_UPDATE_FILE:
  1343. //same path as the executable
  1344. break;
  1345. case PATH_DATABASE:
  1346. if(m_bU3)
  1347. {
  1348. csDir = GETENV(_T("U3_APP_DATA_PATH"));
  1349. FIX_CSTRING_PATH(csDir);
  1350. }
  1351. break;
  1352. case PATH_INI:
  1353. if(m_bU3)
  1354. {
  1355. csDir = GETENV(_T("U3_APP_DATA_PATH"));
  1356. FIX_CSTRING_PATH(csDir);
  1357. }
  1358. break;
  1359. case PATH_U3_HWND_INI:
  1360. if(m_bU3)
  1361. {
  1362. csDir = GETENV(_T("U3_HOST_EXEC_PATH"));
  1363. FIX_CSTRING_PATH(csDir);
  1364. }
  1365. break;
  1366. }
  1367. return csDir;
  1368. }
  1369. void CGetSetOptions::WriteU3Hwnd(HWND hWnd)
  1370. {
  1371. CString csIniFile = GetPath(PATH_U3_HWND_INI);
  1372. csIniFile += _T("DittohWnd.ini");
  1373. WritePrivateProfileInt(_T("Ditto"), _T("MainhWnd"), (int)hWnd, csIniFile);
  1374. }
  1375. long CGetSetOptions::GetDittoRestoreClipboardDelay()
  1376. {
  1377. return GetProfileLong("RestoreClipboardDelay", 750);
  1378. }
  1379. void CGetSetOptions::SetDittoRestoreClipboardDelay(long lDelay)
  1380. {
  1381. SetProfileLong("RestoreClipboardDelay", lDelay);
  1382. }
  1383. void CGetSetOptions::GetCopyBufferItem(int nPos, CCopyBufferItem &Item)
  1384. {
  1385. Item.m_lCopyHotKey = GetProfileLong(StrF(_T("CopyBufferCopyHotKey_%d"), nPos), 0);
  1386. Item.m_lPasteHotKey = GetProfileLong(StrF(_T("CopyBufferPasteHotKey_%d"), nPos), 0);
  1387. Item.m_lCutHotKey = GetProfileLong(StrF(_T("CopyBufferCutHotKey_%d"), nPos), 0);
  1388. Item.m_bPlaySoundOnCopy = GetProfileLong(StrF(_T("CopyBufferPlaySound_%d"), nPos), 0);
  1389. }
  1390. void CGetSetOptions::SetCopyBufferItem(int nPos, CCopyBufferItem &Item)
  1391. {
  1392. SetProfileLong(StrF(_T("CopyBufferCopyHotKey_%d"), nPos), Item.m_lCopyHotKey);
  1393. SetProfileLong(StrF(_T("CopyBufferPasteHotKey_%d"), nPos), Item.m_lPasteHotKey);
  1394. SetProfileLong(StrF(_T("CopyBufferCutHotKey_%d"), nPos), Item.m_lCutHotKey);
  1395. SetProfileLong(StrF(_T("CopyBufferPlaySound_%d"), nPos), Item.m_bPlaySoundOnCopy);
  1396. }
  1397. CString CGetSetOptions::GetMultiPasteSeparator(bool bConvertToLineFeeds)
  1398. {
  1399. CString csSep = GetProfileString(_T("MultiPasteSeparator"), _T("[LF]"));
  1400. if(bConvertToLineFeeds)
  1401. {
  1402. CString csLineFeed(_T("\r\n"));
  1403. csSep.Replace(_T("[LF]"), csLineFeed);
  1404. csSep.Replace(_T("[lf]"), csLineFeed);
  1405. }
  1406. return csSep;
  1407. }
  1408. void CGetSetOptions::SetMultiPasteSeparator(CString csSep)
  1409. {
  1410. SetProfileString(_T("MultiPasteSeparator"), csSep);
  1411. }
  1412. BOOL CGetSetOptions::GetSetCurrentDirectory()
  1413. {
  1414. BOOL bRet = GetProfileLong(_T("SetCurrentDirectory"), FALSE);
  1415. if(bRet)
  1416. {
  1417. CString csExePath = GetFilePath(GetExeFileName());
  1418. FIX_CSTRING_PATH(csExePath);
  1419. ::SetCurrentDirectory(csExePath);
  1420. }
  1421. return bRet;
  1422. }
  1423. bool CGetSetOptions::GetIsPortableDitto()
  1424. {
  1425. return GetProfileLong(_T("Portable"), FALSE) == TRUE;
  1426. }
  1427. BOOL CGetSetOptions::GetEditWordWrap()
  1428. {
  1429. return GetProfileLong(_T("EditWordWrap"), TRUE);
  1430. }
  1431. void CGetSetOptions::SetEditWordWrap(BOOL bSet)
  1432. {
  1433. SetProfileLong(_T("EditWordWrap"), bSet);
  1434. }
  1435. BOOL CGetSetOptions::SetGroupWndSize(CSize size)
  1436. {
  1437. BOOL bRet = SetProfileLong("GroupWndCX", size.cx);
  1438. bRet = SetProfileLong("GroupWndCY", size.cy);
  1439. return bRet;
  1440. }
  1441. void CGetSetOptions::GetGroupWndSize(CSize &size)
  1442. {
  1443. size.cx = GetProfileLong("GroupWndCX", 0);
  1444. size.cy = GetProfileLong("GroupWndCY", 0);
  1445. }
  1446. BOOL CGetSetOptions::SetGroupWndPoint(CPoint point)
  1447. {
  1448. BOOL bRet = SetProfileLong("GroupWndX", point.x);
  1449. bRet = SetProfileLong("GroupWndY", point.y);
  1450. return bRet;
  1451. }
  1452. void CGetSetOptions::GetGroupWndPoint(CPoint &point)
  1453. {
  1454. point.x = GetProfileLong("GroupWndX", 0);
  1455. point.y = GetProfileLong("GroupWndY", 0);
  1456. }
  1457. int CGetSetOptions::GetGroupWndTransparency()
  1458. {
  1459. return GetProfileLong("GroupWndTrans", 0);
  1460. }
  1461. void CGetSetOptions::SetGroupWndTransparency(int nTrans)
  1462. {
  1463. SetProfileLong("GroupWndTrans", nTrans);
  1464. }
  1465. bool CGetSetOptions::GetGroupWndPinned()
  1466. {
  1467. return (GetProfileLong("GroupWndPinned", TRUE) == TRUE);
  1468. }
  1469. void CGetSetOptions::SetGroupWndPinned(bool bSet)
  1470. {
  1471. m_bGroupWndPinned = (bSet == TRUE);
  1472. SetProfileLong("GroupWndPinned", bSet);
  1473. }
  1474. bool CGetSetOptions::GetAllowFriends()
  1475. {
  1476. return (GetProfileLong("AllowFriends", TRUE) == TRUE);
  1477. }
  1478. CString CGetSetOptions::GetPasteString(CString csAppName)
  1479. {
  1480. CString csPasteString = GetProfileString(csAppName, _T(""), _T("PasteStrings"));
  1481. if(csPasteString.IsEmpty())
  1482. return GetDefaultPasteString();
  1483. return csPasteString;
  1484. }
  1485. CString CGetSetOptions::GetDefaultPasteString()
  1486. {
  1487. return GetProfileString(_T("DefaultPasteString"), _T("^v"));
  1488. }
  1489. CString CGetSetOptions::GetCopyString(CString csAppName)
  1490. {
  1491. CString csCopyString = GetProfileString(csAppName, _T(""), _T("CopyStrings"));
  1492. if(csCopyString.IsEmpty())
  1493. return GetDefaultCopyString();
  1494. return csCopyString;
  1495. }
  1496. CString CGetSetOptions::GetDefaultCopyString()
  1497. {
  1498. return GetProfileString(_T("DefaultCopyString"), _T("^c"));
  1499. }