Options.cpp 59 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466
  1. #include "stdafx.h"
  2. #include "Options.h"
  3. #include "AlphaBlend.h"
  4. #include "Misc.h"
  5. #include "shared/TextConvert.h"
  6. #include "sqlite\CppSQLite3.h"
  7. #include "Path.h"
  8. #include "CP_Main.h"
  9. #include "ActionEnums.h"
  10. using namespace nsPath;
  11. UINT WritePrivateProfileInt(LPCTSTR lpAppName, LPCTSTR lpKeyName, INT nValue, LPCTSTR lpFileName)
  12. {
  13. // Locals
  14. TCHAR szBuff[25];
  15. // Format
  16. SPRINTF(szBuff, _T("%d"), nValue);
  17. // Write
  18. return WritePrivateProfileString(lpAppName, lpKeyName, szBuff, lpFileName);
  19. }
  20. long CGetSetOptions::m_nLinesPerRow;
  21. BOOL CGetSetOptions::m_bUseCtrlNumAccel;
  22. BOOL CGetSetOptions::m_bAllowDuplicates;
  23. BOOL CGetSetOptions::m_bUpdateTimeOnPaste;
  24. BOOL CGetSetOptions::m_bSaveMultiPaste;
  25. BOOL CGetSetOptions::m_bShowPersistent;
  26. long CGetSetOptions::m_bDescTextSize;
  27. BOOL CGetSetOptions::m_bDescShowLeadingWhiteSpace;
  28. BOOL CGetSetOptions::m_bAllwaysShowDescription;
  29. long CGetSetOptions::m_bDoubleClickingOnCaptionDoes;
  30. BOOL CGetSetOptions::m_bPrompForNewGroupName;
  31. BOOL CGetSetOptions::m_bSendPasteOnFirstTenHotKeys;
  32. CSendClients CGetSetOptions::m_SendClients[MAX_SEND_CLIENTS];
  33. long CGetSetOptions::m_lAutoSendClientCount;
  34. CString CGetSetOptions::m_csIPListToPutOnClipboard;
  35. BOOL CGetSetOptions::m_bLogSendReceiveErrors;
  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_bInConversion = false;
  55. bool CGetSetOptions::m_bFromIni = false;
  56. bool CGetSetOptions::m_portable = false;
  57. bool CGetSetOptions::m_windowsApp = false;
  58. CString CGetSetOptions::m_csIniFileName;
  59. __int64 CGetSetOptions::nLastDbWriteTime = 0;
  60. CTheme CGetSetOptions::m_Theme;
  61. BOOL CGetSetOptions::m_showScrollBar = false;
  62. CGetSetOptions g_Opt;
  63. BOOL CGetSetOptions::m_bShowAlwaysOnTopWarning = TRUE;
  64. CGetSetOptions::CGetSetOptions()
  65. {
  66. }
  67. CGetSetOptions::~CGetSetOptions()
  68. {
  69. }
  70. void CGetSetOptions::LoadSettings()
  71. {
  72. CString exeDir = CGetSetOptions::GetExeFileName();
  73. exeDir = GetFilePath(exeDir);
  74. FIX_CSTRING_PATH(exeDir);
  75. CString windowsAppFile = exeDir += _T("WindowsApp");
  76. if (FileExists(windowsAppFile))
  77. {
  78. m_windowsApp = true;
  79. m_bFromIni = true;
  80. //always use the ini file in the app data folder for windows store
  81. m_csIniFileName = GetIniFileName(false);
  82. }
  83. else
  84. {
  85. m_csIniFileName = GetIniFileName(true);
  86. CString portable = GetFilePath(m_csIniFileName);
  87. portable += _T("portable");
  88. if (FileExists(portable))
  89. {
  90. m_portable = true;
  91. }
  92. //first check if ini file is in app directory
  93. if (m_portable || FileExists(m_csIniFileName))
  94. {
  95. m_bFromIni = true;
  96. }
  97. else
  98. {
  99. //next check if it's in app data
  100. m_csIniFileName = GetIniFileName(false);
  101. if (FileExists(m_csIniFileName))
  102. {
  103. m_bFromIni = true;
  104. }
  105. }
  106. }
  107. if(m_bFromIni)
  108. {
  109. CString csPath = GetFilePath(m_csIniFileName);
  110. if(FileExists(csPath) == FALSE)
  111. CreateDirectory(csPath, NULL);
  112. //create the ini file as unicode, this way we can save unicode string to the ini file
  113. //http://www.codeproject.com/Articles/9071/Using-Unicode-in-INI-files
  114. CreateIniFile(m_csIniFileName);
  115. }
  116. /*CString cs = GetDBPath();
  117. SetDBPath(_T("some path"));
  118. CString cs2 = GetDBPath();*/
  119. GetSetCurrentDirectory();
  120. //First time we run, set some defaults
  121. if (GetDBPath() == _T("") &&
  122. GetTotalCopyCount() == 0)
  123. {
  124. SetCheckForMaxEntries(TRUE);
  125. SetSimpleTextSearch(TRUE);
  126. }
  127. m_nLinesPerRow = GetLinesPerRow();
  128. m_bUseCtrlNumAccel = GetUseCtrlNumForFirstTenHotKeys();
  129. m_bAllowDuplicates = GetAllowDuplicates();
  130. m_bUpdateTimeOnPaste = GetUpdateTimeOnPaste();
  131. m_bSaveMultiPaste = GetSaveMultiPaste();
  132. m_bShowPersistent = GetShowPersistent();
  133. m_bDescTextSize = GetDescTextSize();
  134. m_bDescShowLeadingWhiteSpace = GetDescShowLeadingWhiteSpace();
  135. m_bAllwaysShowDescription = GetAllwaysShowDescription();
  136. m_bDoubleClickingOnCaptionDoes = GetDoubleClickingOnCaptionDoes();
  137. m_bPrompForNewGroupName = GetPrompForNewGroupName();
  138. m_bSendPasteOnFirstTenHotKeys = GetSendPasteOnFirstTenHotKeys();
  139. m_csIPListToPutOnClipboard = GetListToPutOnClipboard();
  140. m_bLogSendReceiveErrors = GetLogSendReceiveErrors();
  141. m_HideDittoOnHotKeyIfAlreadyShown = GetHideDittoOnHotKeyIfAlreadyShown();
  142. m_lPort = GetPort();
  143. m_bDrawThumbnail = GetDrawThumbnail();
  144. m_csPassword = GetNetworkPassword();
  145. m_bDrawRTF = GetDrawRTF();
  146. m_bMultiPasteReverse = GetMultiPasteReverse();
  147. m_csPlaySoundOnCopy = GetPlaySoundOnCopy();
  148. m_bSendPasteMessageAfterSelection = GetSendPasteAfterSelection();
  149. m_bFindAsYouType = GetFindAsYouType();
  150. m_bEnsureEntireWindowCanBeSeen = GetEnsureEntireWindowCanBeSeen();
  151. m_bShowAllClipsInMainList = GetShowAllClipsInMainList();
  152. m_lMaxClipSizeInBytes = GetMaxClipSizeInBytes();
  153. m_dwSaveClipDelay = GetSaveClipDelay();
  154. m_lProcessDrawClipboardDelay = GetProcessDrawClipboardDelay();
  155. m_bEnableDebugLogging = GetEnableDebugLogging();
  156. m_bEnsureConnectToClipboard = GetEnsureConnectToClipboard();
  157. m_bOutputDebugString = false;
  158. m_showScrollBar = GetShowScrollBar();
  159. m_bShowAlwaysOnTopWarning = GetShowAlwaysOnTopWarning();
  160. GetExtraNetworkPassword(true);
  161. for(int i = 0; i < MAX_SEND_CLIENTS; i++)
  162. {
  163. GetSendClients(i);
  164. }
  165. GetClientSendCount();
  166. m_Theme.Load(GetTheme());
  167. }
  168. void CGetSetOptions::CreateIniFile(CString path)
  169. {
  170. if (!::PathFileExists(path))
  171. {
  172. // UTF16-LE BOM(FFFE)
  173. WORD wBOM = 0xFEFF;
  174. DWORD NumberOfBytesWritten;
  175. HANDLE hFile = ::CreateFile(path, GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
  176. ::WriteFile(hFile, &wBOM, sizeof(WORD), &NumberOfBytesWritten, NULL);
  177. //LPTSTR pszSectionB = _T("[StringTable]"); // section name with bracket
  178. //::WriteFile(hFile, pszSectionB, (_tcslen(pszSectionB) + 1)*(sizeof(TCHAR)), &NumberOfBytesWritten, NULL);
  179. ::CloseHandle(hFile);
  180. }
  181. }
  182. void CGetSetOptions::ConverSettingsToIni()
  183. {
  184. m_bInConversion = true;
  185. CSize sz;
  186. CPoint pt;
  187. GetQuickPasteSize(sz);
  188. SetQuickPasteSize(sz);
  189. GetQuickPastePoint(pt);
  190. SetQuickPastePoint(pt);
  191. GetEditWndSize(sz);
  192. SetEditWndSize(sz);
  193. GetEditWndPoint(pt);
  194. SetEditWndPoint(pt);
  195. SetShowIconInSysTray(GetShowIconInSysTray());
  196. SetRunOnStartUp(GetRunOnStartUp());
  197. SetEnableTransparency(GetEnableTransparency());
  198. SetTransparencyPercent(GetTransparencyPercent());
  199. SetLinesPerRow(GetLinesPerRow());
  200. SetQuickPastePosition(GetQuickPastePosition());
  201. SetCopyGap(GetCopyGap());
  202. SetDBPath(GetDBPath());
  203. SetCheckForMaxEntries(GetCheckForMaxEntries());
  204. SetCheckForExpiredEntries(GetCheckForExpiredEntries());
  205. SetMaxEntries(GetMaxEntries());
  206. SetExpiredEntries(GetExpiredEntries());
  207. SetTripCopyCount(GetTripCopyCount());
  208. SetTripPasteCount(GetTripPasteCount());
  209. SetTripDate(GetTripDate());
  210. SetTotalCopyCount(GetTotalCopyCount());
  211. SetTotalPasteCount(GetTotalPasteCount());
  212. SetTotalDate(GetTotalDate());
  213. SetUpdateFilePath(GetUpdateFilePath());
  214. SetUpdateInstallPath(GetUpdateInstallPath());
  215. SetLastUpdate(GetLastUpdate());
  216. SetCheckForUpdates(GetCheckForUpdates());
  217. SetUseCtrlNumForFirstTenHotKeys(GetUseCtrlNumForFirstTenHotKeys());
  218. SetAllowDuplicates(GetAllowDuplicates());
  219. SetUpdateTimeOnPaste(GetUpdateTimeOnPaste());
  220. SetSaveMultiPaste(GetSaveMultiPaste());
  221. SetShowPersistent(GetShowPersistent());
  222. SetShowTextForFirstTenHotKeys(GetShowTextForFirstTenHotKeys());
  223. SetMainHWND(GetMainHWND());
  224. SetCaptionPos(GetCaptionPos());
  225. SetAutoHide(GetAutoHide());
  226. SetDescTextSize(GetDescTextSize());
  227. SetDescShowLeadingWhiteSpace(GetDescShowLeadingWhiteSpace());
  228. SetAllwaysShowDescription(GetAllwaysShowDescription());
  229. SetDoubleClickingOnCaptionDoes(GetDoubleClickingOnCaptionDoes());
  230. SetPrompForNewGroupName(GetPrompForNewGroupName());
  231. SetSendPasteOnFirstTenHotKeys(GetSendPasteOnFirstTenHotKeys());
  232. for(int i = 0; i < MAX_SEND_CLIENTS; i++)
  233. {
  234. GetSendClients(i);
  235. SetSendClients(m_SendClients[i], i);
  236. }
  237. SetListToPutOnClipboard(GetListToPutOnClipboard());
  238. SetLogSendReceiveErrors(GetLogSendReceiveErrors());
  239. SetHideDittoOnHotKeyIfAlreadyShown(GetHideDittoOnHotKeyIfAlreadyShown());
  240. SetPort(GetPort());
  241. SetDisableRecieve(GetDisableRecieve());
  242. LOGFONT font;
  243. GetFont(font);
  244. SetFont(font);
  245. SetDrawThumbnail(GetDrawThumbnail());
  246. CStringA PassA = GetNetworkPassword();
  247. CString PassW = PassA;
  248. SetNetworkPassword(PassW);
  249. SetDrawRTF(GetDrawRTF());
  250. SetMultiPasteReverse(GetMultiPasteReverse());
  251. SetPlaySoundOnCopy(GetPlaySoundOnCopy());
  252. SetSendPasteAfterSelection(GetSendPasteAfterSelection());
  253. SetFindAsYouType(GetFindAsYouType());
  254. SetEnsureEntireWindowCanBeSeen(GetEnsureEntireWindowCanBeSeen());
  255. SetShowAllClipsInMainList(GetShowAllClipsInMainList());
  256. SetExtraNetworkPassword(GetExtraNetworkPassword(false));
  257. SetMaxClipSizeInBytes(GetMaxClipSizeInBytes());
  258. SetLanguageFile(GetLanguageFile());
  259. SetSaveClipDelay(GetSaveClipDelay());
  260. SetProcessDrawClipboardDelay(GetProcessDrawClipboardDelay());
  261. SetEnableDebugLogging(GetEnableDebugLogging());
  262. SetEnsureConnectToClipboard(GetEnsureConnectToClipboard());
  263. SetPromptWhenDeletingClips(GetPromptWhenDeletingClips());
  264. SetLastImportDir(GetLastImportDir());
  265. SetLastExportDir(GetLastExportDir());
  266. SetUpdateDescWhenSavingClip(GetUpdateDescWhenSavingClip());
  267. m_bInConversion = false;
  268. }
  269. CString CGetSetOptions::GetIniFileName(bool bLocalIniFile)
  270. {
  271. CString csPath = _T("c:\\program files\\Ditto\\");
  272. if(bLocalIniFile)
  273. {
  274. csPath = GetFilePath(GetExeFileName());
  275. }
  276. else
  277. {
  278. csPath = GetAppDataPath();
  279. }
  280. csPath += "Ditto.Settings";
  281. return csPath;
  282. }
  283. CString CGetSetOptions::GetAppDataPath()
  284. {
  285. CString csPath;
  286. LPMALLOC pMalloc;
  287. if (GetIsWindowsApp())
  288. {
  289. if (SUCCEEDED(::SHGetMalloc(&pMalloc)))
  290. {
  291. LPITEMIDLIST pidlPrograms;
  292. SHGetSpecialFolderLocation(NULL, CSIDL_LOCAL_APPDATA, &pidlPrograms);
  293. TCHAR string[MAX_PATH];
  294. SHGetPathFromIDList(pidlPrograms, string);
  295. pMalloc->Free(pidlPrograms);
  296. pMalloc->Release();
  297. csPath = string;
  298. }
  299. FIX_CSTRING_PATH(csPath);
  300. csPath += "Ditto_WindowsApp\\";
  301. }
  302. else
  303. {
  304. if (SUCCEEDED(::SHGetMalloc(&pMalloc)))
  305. {
  306. LPITEMIDLIST pidlPrograms;
  307. SHGetSpecialFolderLocation(NULL, CSIDL_APPDATA, &pidlPrograms);
  308. TCHAR string[MAX_PATH];
  309. SHGetPathFromIDList(pidlPrograms, string);
  310. pMalloc->Free(pidlPrograms);
  311. pMalloc->Release();
  312. csPath = string;
  313. }
  314. FIX_CSTRING_PATH(csPath);
  315. csPath += "Ditto\\";
  316. }
  317. return csPath;
  318. }
  319. CString CGetSetOptions::GetTempFilePath()
  320. {
  321. CString csPath;
  322. wchar_t wchPath[MAX_PATH];
  323. if (GetTempPathW(MAX_PATH, wchPath))
  324. {
  325. csPath = wchPath;
  326. csPath += _T("Ditto\\");
  327. CreateDirectory(csPath, NULL);
  328. }
  329. return csPath;
  330. }
  331. long CGetSetOptions::GetResolutionProfileLong(CString csName, long lDefaultValue, CString csNewPath)
  332. {
  333. CString resName;
  334. resName.Format(_T("(%dx%d)_%s"), GetScreenWidth(), GetScreenHeight(), csName);
  335. long value = GetProfileLong(resName, INT_MIN, csNewPath);
  336. if(value == INT_MIN)
  337. {
  338. value = GetProfileLong(csName, lDefaultValue, csNewPath);
  339. }
  340. return value;
  341. }
  342. BOOL CGetSetOptions::SetResolutionProfileLong(CString csName, long lValue)
  343. {
  344. CString resName;
  345. resName.Format(_T("(%dx%d)_%s"), GetScreenWidth(), GetScreenHeight(), csName);
  346. return SetProfileLong(resName, lValue);
  347. }
  348. long CGetSetOptions::GetProfileLong(CString csName, long lDefaultValue, CString csNewPath)
  349. {
  350. if(m_bFromIni && !m_bInConversion)
  351. {
  352. CString csApp(_T("Ditto"));
  353. if(csNewPath.IsEmpty() == FALSE)
  354. {
  355. csApp = csNewPath;
  356. }
  357. return GetPrivateProfileInt(csApp, csName, lDefaultValue, m_csIniFileName);
  358. }
  359. CString csPath(_T(REG_PATH));
  360. if(csNewPath.IsEmpty() == FALSE)
  361. {
  362. csPath += "\\" + csNewPath;
  363. }
  364. HKEY hkKey;
  365. long lResult = RegOpenKeyEx(HKEY_CURRENT_USER, csPath, NULL, KEY_READ, &hkKey);
  366. if(lResult != ERROR_SUCCESS)
  367. return lDefaultValue;
  368. DWORD buffer;
  369. DWORD len = sizeof(buffer);
  370. DWORD type;
  371. lResult = ::RegQueryValueEx(hkKey, csName, 0, &type, (LPBYTE)&buffer, &len);
  372. RegCloseKey(hkKey);
  373. if(lResult == ERROR_SUCCESS)
  374. return (long)buffer;
  375. return lDefaultValue;
  376. }
  377. CString CGetSetOptions::GetProfileString(CString csName, CString csDefault, CString csNewPath)
  378. {
  379. if(m_bFromIni && !m_bInConversion)
  380. {
  381. CString csApp(_T("Ditto"));
  382. if(csNewPath.IsEmpty() == FALSE)
  383. {
  384. csApp = csNewPath;
  385. }
  386. TCHAR cString[MAX_PATH];
  387. GetPrivateProfileString(csApp, csName, csDefault, cString, sizeof(cString), m_csIniFileName);
  388. return cString;
  389. }
  390. CString csPath(_T(REG_PATH));
  391. if(csNewPath.IsEmpty() == FALSE)
  392. {
  393. csPath += "\\" + csNewPath;
  394. }
  395. HKEY hkKey;
  396. long lResult = RegOpenKeyEx(HKEY_CURRENT_USER, csPath, NULL, KEY_READ, &hkKey);
  397. TCHAR szString[256];
  398. ZeroMemory(szString, sizeof(szString));
  399. DWORD dwBufLen = 256;
  400. lResult = ::RegQueryValueEx(hkKey , csName, NULL, NULL, (LPBYTE)szString, &dwBufLen);
  401. RegCloseKey(hkKey);
  402. if(lResult != ERROR_SUCCESS)
  403. return csDefault;
  404. return szString;
  405. }
  406. BOOL CGetSetOptions::SetProfileLong(CString csName, long lValue)
  407. {
  408. if(m_bFromIni)
  409. {
  410. return WritePrivateProfileInt(_T("Ditto"), csName, lValue, m_csIniFileName);
  411. }
  412. HKEY hkKey;
  413. DWORD dWord;
  414. long lResult = RegCreateKeyEx(HKEY_CURRENT_USER, _T(REG_PATH), NULL,
  415. NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS,
  416. NULL, &hkKey, &dWord);
  417. if(lResult != ERROR_SUCCESS)
  418. return FALSE;
  419. DWORD val = (DWORD)lValue;
  420. lResult = ::RegSetValueEx(hkKey, csName, 0, REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
  421. RegCloseKey(hkKey);
  422. return lResult == ERROR_SUCCESS;
  423. }
  424. BOOL CGetSetOptions::SetProfileString(CString csName, CString csValue)
  425. {
  426. if(m_bFromIni)
  427. {
  428. return WritePrivateProfileString(_T("Ditto"), csName, csValue, m_csIniFileName);
  429. }
  430. HKEY hkKey;
  431. DWORD dWord;
  432. long lResult = RegCreateKeyEx(HKEY_CURRENT_USER, _T(REG_PATH), NULL,
  433. NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS,
  434. NULL, &hkKey, &dWord);
  435. if(lResult != ERROR_SUCCESS)
  436. return FALSE;
  437. ::RegSetValueEx(hkKey, csName, NULL, REG_SZ,
  438. (BYTE*)(LPCTSTR)csValue, csValue.GetLength()*sizeof(TCHAR));
  439. RegCloseKey(hkKey);
  440. return lResult == ERROR_SUCCESS;
  441. }
  442. BOOL CGetSetOptions::SetProfileData(CString csName, LPVOID lpData, DWORD dwLength)
  443. {
  444. if(m_bFromIni)
  445. {
  446. ASSERT(!"SetProfileData not supported in .ini settings");
  447. return FALSE;
  448. }
  449. HKEY hkKey;
  450. DWORD dWord;
  451. long lResult = RegCreateKeyEx(HKEY_CURRENT_USER, _T(REG_PATH), NULL,
  452. NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS,
  453. NULL, &hkKey, &dWord);
  454. if(lResult != ERROR_SUCCESS)
  455. return FALSE;
  456. ::RegSetValueEx(hkKey, csName, NULL, REG_BINARY,
  457. (BYTE*)lpData, dwLength);
  458. RegCloseKey(hkKey);
  459. return lResult == ERROR_SUCCESS;
  460. }
  461. BOOL CGetSetOptions::GetProfileFont(CString csSection, LOGFONT &font)
  462. {
  463. font.lfHeight = GetPrivateProfileInt(csSection, _T("Height"), 0, m_csIniFileName);
  464. font.lfWidth = GetPrivateProfileInt(csSection, _T("Width"), 0, m_csIniFileName);
  465. font.lfEscapement = GetPrivateProfileInt(csSection, _T("Escapement"), 0, m_csIniFileName);
  466. font.lfOrientation = GetPrivateProfileInt(csSection, _T("Orientation"), 0, m_csIniFileName);
  467. font.lfWeight = GetPrivateProfileInt(csSection, _T("Weight"), 0, m_csIniFileName);
  468. font.lfItalic = GetPrivateProfileInt(csSection, _T("Italic"), 0, m_csIniFileName);
  469. font.lfUnderline = GetPrivateProfileInt(csSection, _T("Underline"), 0, m_csIniFileName);
  470. font.lfStrikeOut = GetPrivateProfileInt(csSection, _T("StrikeOut"), 0, m_csIniFileName);
  471. font.lfCharSet = GetPrivateProfileInt(csSection, _T("CharSet"), 0, m_csIniFileName);
  472. font.lfOutPrecision = GetPrivateProfileInt(csSection, _T("OutPrecision"), 0, m_csIniFileName);
  473. font.lfClipPrecision = GetPrivateProfileInt(csSection, _T("ClipPrecision"), 0, m_csIniFileName);
  474. font.lfQuality = GetPrivateProfileInt(csSection, _T("Quality"), 0, m_csIniFileName);
  475. font.lfPitchAndFamily = GetPrivateProfileInt(csSection, _T("PitchAndFamily"), 0, m_csIniFileName);
  476. GetPrivateProfileString(csSection, _T("FaceName"), _T(""), font.lfFaceName, sizeof(font.lfFaceName), m_csIniFileName);
  477. return TRUE;
  478. }
  479. BOOL CGetSetOptions::SetProfileFont(CString csSection, LOGFONT &font)
  480. {
  481. WritePrivateProfileInt(csSection, _T("Height"), font.lfHeight, m_csIniFileName);
  482. WritePrivateProfileInt(csSection, _T("Width"), font.lfWidth, m_csIniFileName);
  483. WritePrivateProfileInt(csSection, _T("Escapement"), font.lfEscapement, m_csIniFileName);
  484. WritePrivateProfileInt(csSection, _T("Orientation"), font.lfOrientation, m_csIniFileName);
  485. WritePrivateProfileInt(csSection, _T("Weight"), font.lfWeight, m_csIniFileName);
  486. WritePrivateProfileInt(csSection, _T("Italic"), font.lfItalic, m_csIniFileName);
  487. WritePrivateProfileInt(csSection, _T("Underline"), font.lfUnderline, m_csIniFileName);
  488. WritePrivateProfileInt(csSection, _T("StrikeOut"), font.lfStrikeOut, m_csIniFileName);
  489. WritePrivateProfileInt(csSection, _T("CharSet"), font.lfCharSet, m_csIniFileName);
  490. WritePrivateProfileInt(csSection, _T("OutPrecision"), font.lfOutPrecision, m_csIniFileName);
  491. WritePrivateProfileInt(csSection, _T("ClipPrecision"), font.lfClipPrecision, m_csIniFileName);
  492. WritePrivateProfileInt(csSection, _T("Quality"), font.lfQuality, m_csIniFileName);
  493. WritePrivateProfileInt(csSection, _T("PitchAndFamily"), font.lfPitchAndFamily, m_csIniFileName);
  494. WritePrivateProfileString(csSection, _T("FaceName"), font.lfFaceName, m_csIniFileName);
  495. return TRUE;
  496. }
  497. LPVOID CGetSetOptions::GetProfileData(CString csName, DWORD &dwLength)
  498. {
  499. if(m_bFromIni && !m_bInConversion)
  500. {
  501. ASSERT(!"GetProfileData not supported in .ini settings");
  502. return NULL;
  503. }
  504. HKEY hkKey;
  505. long lResult = RegOpenKeyEx(HKEY_CURRENT_USER, _T(REG_PATH),
  506. NULL, KEY_READ, &hkKey);
  507. lResult = ::RegQueryValueEx(hkKey , csName, NULL, NULL, NULL, &dwLength);
  508. if(lResult != ERROR_SUCCESS)
  509. return NULL;
  510. LPVOID lpVoid = new BYTE[dwLength];
  511. lResult = ::RegQueryValueEx(hkKey , csName, NULL, NULL, (LPBYTE)lpVoid, &dwLength);
  512. RegCloseKey(hkKey);
  513. if(lResult != ERROR_SUCCESS)
  514. return NULL;
  515. return lpVoid;
  516. }
  517. BOOL CGetSetOptions::GetShowIconInSysTray()
  518. {
  519. return GetProfileLong("ShowIconInSystemTray", TRUE);
  520. }
  521. BOOL CGetSetOptions::SetShowIconInSysTray(BOOL bShow)
  522. {
  523. return SetProfileLong("ShowIconInSystemTray", bShow);
  524. }
  525. BOOL CGetSetOptions::SetEnableTransparency(BOOL bCheck)
  526. {
  527. return SetProfileLong("EnableTransparency", bCheck);
  528. }
  529. BOOL CGetSetOptions::GetEnableTransparency()
  530. {
  531. return GetProfileLong("EnableTransparency", FALSE);
  532. }
  533. BOOL CGetSetOptions::SetTransparencyPercent(long lPercent)
  534. {
  535. if(lPercent > OPACITY_MAX)
  536. lPercent = OPACITY_MAX;
  537. if(lPercent < 0)
  538. lPercent = 0;
  539. return SetProfileLong("TransparencyPercent", lPercent);
  540. }
  541. long CGetSetOptions::GetTransparencyPercent()
  542. {
  543. long lValue = GetProfileLong("TransparencyPercent", 14);
  544. if(lValue > OPACITY_MAX) lValue = OPACITY_MAX;
  545. if(lValue < 0) lValue = 0;
  546. return lValue;
  547. }
  548. BOOL CGetSetOptions::SetLinesPerRow(long lLines)
  549. {
  550. m_nLinesPerRow = lLines;
  551. return SetProfileLong("LinesPerRow", lLines);
  552. }
  553. long CGetSetOptions::GetLinesPerRow()
  554. {
  555. return GetProfileLong("LinesPerRow", 2);
  556. }
  557. BOOL CGetSetOptions::GetRunOnStartUp()
  558. {
  559. HKEY hkRun;
  560. LONG nResult = RegOpenKeyEx(HKEY_CURRENT_USER,
  561. _T("Software\\Microsoft\\Windows\\CurrentVersion\\Run"),
  562. NULL, KEY_READ, &hkRun);
  563. if(nResult != ERROR_SUCCESS)
  564. return FALSE;
  565. nResult = RegQueryValueEx(hkRun, GetAppName(), NULL, NULL, NULL, NULL);
  566. RegCloseKey(hkRun);
  567. return nResult == ERROR_SUCCESS;
  568. }
  569. void CGetSetOptions::SetRunOnStartUp(BOOL bRun)
  570. {
  571. HKEY hkRun;
  572. LONG nResult = RegOpenKeyEx(HKEY_CURRENT_USER,
  573. _T("Software\\Microsoft\\Windows\\CurrentVersion\\Run"),
  574. NULL, KEY_ALL_ACCESS, &hkRun);
  575. if(nResult != ERROR_SUCCESS)
  576. return;
  577. if(bRun)
  578. {
  579. CString sExeName = GetExeFileName();
  580. ::RegSetValueEx(hkRun, GetAppName(), NULL, REG_SZ,
  581. (BYTE*)(LPCTSTR)sExeName, sExeName.GetLength()*sizeof(TCHAR));
  582. }
  583. else
  584. {
  585. ::RegDeleteValue(hkRun, GetAppName());
  586. }
  587. ::RegCloseKey(hkRun);
  588. }
  589. CString CGetSetOptions::GetExeFileName()
  590. {
  591. CString sExeName;
  592. GetModuleFileName(NULL, sExeName.GetBuffer(_MAX_PATH),_MAX_PATH);
  593. sExeName.ReleaseBuffer();
  594. return sExeName;
  595. }
  596. CString CGetSetOptions::GetAppName()
  597. {
  598. return "Ditto";
  599. }
  600. BOOL CGetSetOptions::SetQuickPastePosition(long lPosition)
  601. {
  602. return SetProfileLong("ShowQuickPastePosition", lPosition);
  603. }
  604. long CGetSetOptions::GetQuickPastePosition()
  605. {
  606. return GetProfileLong("ShowQuickPastePosition", POS_AT_CURSOR);
  607. }
  608. BOOL CGetSetOptions::SetQuickPasteSize(CSize size)
  609. {
  610. BOOL bRet = SetResolutionProfileLong("QuickPasteCX", size.cx);
  611. bRet = SetResolutionProfileLong("QuickPasteCY", size.cy);
  612. return bRet;
  613. }
  614. void CGetSetOptions::GetQuickPasteSize(CSize &size)
  615. {
  616. size.cx = GetResolutionProfileLong("QuickPasteCX", 300);
  617. size.cy = GetResolutionProfileLong("QuickPasteCY", 300);
  618. if(size.cx <= 0 && size.cy <= 0)
  619. {
  620. size.cx = 300;
  621. size.cy = 300;
  622. }
  623. }
  624. BOOL CGetSetOptions::SetQuickPastePoint(CPoint point)
  625. {
  626. BOOL bRet = SetResolutionProfileLong("QuickPasteX", point.x);
  627. bRet = SetResolutionProfileLong("QuickPasteY", point.y);
  628. return bRet;
  629. }
  630. void CGetSetOptions::GetQuickPastePoint(CPoint &point)
  631. {
  632. point.x = GetResolutionProfileLong("QuickPasteX", 300);
  633. point.y = GetResolutionProfileLong("QuickPasteY", 300);
  634. if(point.x <= 0 && point.y <= 0)
  635. {
  636. point.x = 300;
  637. point.y = 300;
  638. }
  639. }
  640. BOOL CGetSetOptions::SetEditWndSize(CSize size)
  641. {
  642. BOOL bRet = SetResolutionProfileLong("EditWndCX", size.cx);
  643. bRet = SetResolutionProfileLong("EditWndCY", size.cy);
  644. return bRet;
  645. }
  646. void CGetSetOptions::GetEditWndSize(CSize &size)
  647. {
  648. size.cx = GetResolutionProfileLong("EditWndCX", 600);
  649. size.cy = GetResolutionProfileLong("EditWndCY", 600);
  650. if(size.cx <= 0 && size.cy <= 0)
  651. {
  652. size.cx = 600;
  653. size.cy = 600;
  654. }
  655. }
  656. BOOL CGetSetOptions::SetEditWndPoint(CPoint point)
  657. {
  658. BOOL bRet = SetResolutionProfileLong("EditWndX", point.x);
  659. bRet = SetResolutionProfileLong("EditWndY", point.y);
  660. return bRet;
  661. }
  662. void CGetSetOptions::GetEditWndPoint(CPoint &point)
  663. {
  664. point.x = GetResolutionProfileLong("EditWndX", 100);
  665. point.y = GetResolutionProfileLong("EditWndY", 100);
  666. if(point.x <= 0 && point.y <= 0)
  667. {
  668. point.x = 100;
  669. point.y = 100;
  670. }
  671. }
  672. long CGetSetOptions::GetCopyGap()
  673. {
  674. return GetProfileLong("CopyGap", 150);
  675. }
  676. void CGetSetOptions::SetCopyGap(long lGap)
  677. {
  678. SetProfileLong("CopyGap", lGap);
  679. }
  680. BOOL CGetSetOptions::SetDBPathOld(CString csPath)
  681. {
  682. return SetProfileString("DBPath", csPath);
  683. }
  684. CString CGetSetOptions::GetDBPathOld()
  685. {
  686. return GetProfileString("DBPath", "");
  687. }
  688. BOOL CGetSetOptions::SetDBPath(CString csPath)
  689. {
  690. return SetProfileString("DBPath3", csPath);
  691. }
  692. CString CGetSetOptions::GetDBPath()
  693. {
  694. CString csDBPath;
  695. csDBPath = GetProfileString("DBPath3", "");
  696. return csDBPath;
  697. }
  698. void CGetSetOptions::SetCheckForMaxEntries(BOOL bVal)
  699. {
  700. SetProfileLong("CheckForMaxEntries", bVal);
  701. }
  702. BOOL CGetSetOptions::GetCheckForMaxEntries()
  703. {
  704. BOOL bDefault = FALSE;
  705. if(GetIsPortableDitto())
  706. bDefault = TRUE;
  707. return GetProfileLong("CheckForMaxEntries", bDefault);
  708. }
  709. void CGetSetOptions::SetCheckForExpiredEntries(BOOL bVal)
  710. {
  711. SetProfileLong("CheckForExpiredEntries", bVal);
  712. }
  713. BOOL CGetSetOptions::GetCheckForExpiredEntries()
  714. {
  715. return GetProfileLong("CheckForExpiredEntries", FALSE);
  716. }
  717. void CGetSetOptions::SetMaxEntries(long lVal)
  718. {
  719. SetProfileLong("MaxEntries", lVal);
  720. }
  721. long CGetSetOptions::GetMaxEntries()
  722. {
  723. long lMax = 500;
  724. if(GetIsPortableDitto())
  725. lMax = 100;
  726. return GetProfileLong("MaxEntries", lMax);
  727. }
  728. void CGetSetOptions::SetExpiredEntries(long lVal)
  729. {
  730. SetProfileLong("ExpiredEntries", lVal);
  731. }
  732. long CGetSetOptions::GetExpiredEntries()
  733. {
  734. return GetProfileLong("ExpiredEntries", 5);
  735. }
  736. void CGetSetOptions::SetTripCopyCount(long lVal)
  737. {
  738. // negative means a relative offset
  739. if(lVal < 0)
  740. lVal = GetTripCopyCount() - lVal; // add the absolute value
  741. if(GetTripDate() == 0)
  742. SetTripDate(-1);
  743. SetProfileLong("TripCopies", lVal);
  744. }
  745. long CGetSetOptions::GetTripCopyCount()
  746. {
  747. return GetProfileLong("TripCopies", 0);
  748. }
  749. void CGetSetOptions::SetTripPasteCount(long lVal)
  750. {
  751. // negative means a relative offset
  752. if(lVal < 0)
  753. lVal = GetTripPasteCount() - lVal; // add the absolute value
  754. if(GetTripDate() == 0)
  755. SetTripDate(-1);
  756. SetProfileLong("TripPastes", lVal);
  757. }
  758. long CGetSetOptions::GetTripPasteCount()
  759. {
  760. return GetProfileLong("TripPastes", 0);
  761. }
  762. void CGetSetOptions::SetTripDate(long lDate)
  763. {
  764. if(lDate == -1)
  765. lDate = (long)CTime::GetCurrentTime().GetTime();
  766. SetProfileLong("TripDate", lDate);
  767. }
  768. long CGetSetOptions::GetTripDate()
  769. {
  770. return GetProfileLong("TripDate", 0);
  771. }
  772. void CGetSetOptions::SetTotalCopyCount(long lVal)
  773. {
  774. // negative means a relative offset
  775. if(lVal < 0)
  776. lVal = GetTotalCopyCount() - lVal; // add the absolute value
  777. if(GetTotalDate() == 0)
  778. SetTotalDate(-1);
  779. SetProfileLong("TotalCopies", lVal);
  780. }
  781. long CGetSetOptions::GetTotalCopyCount()
  782. {
  783. return GetProfileLong("TotalCopies", 0);
  784. }
  785. void CGetSetOptions::SetTotalPasteCount(long lVal)
  786. {
  787. // negative means a relative offset
  788. if(lVal < 0)
  789. lVal = GetTotalPasteCount() - lVal; // add the absolute value
  790. if(GetTotalDate() == 0)
  791. SetTotalDate(-1);
  792. SetProfileLong("TotalPastes", lVal);
  793. }
  794. long CGetSetOptions::GetTotalPasteCount()
  795. {
  796. return GetProfileLong("TotalPastes", 0);
  797. }
  798. void CGetSetOptions::SetTotalDate(long lDate)
  799. {
  800. if(lDate == -1)
  801. lDate = (long)CTime::GetCurrentTime().GetTime();
  802. SetProfileLong("TotalDate", lDate);
  803. }
  804. long CGetSetOptions::GetTotalDate()
  805. {
  806. return GetProfileLong("TotalDate", 0);
  807. }
  808. CString CGetSetOptions::GetUpdateFilePath()
  809. {
  810. return GetProfileString("UpdateFilePath", "");
  811. }
  812. BOOL CGetSetOptions::SetUpdateFilePath(CString cs)
  813. {
  814. return SetProfileString("UpdateFilePath", cs);
  815. }
  816. CString CGetSetOptions::GetUpdateInstallPath()
  817. {
  818. return GetProfileString("UpdateInstallPath", "");
  819. }
  820. BOOL CGetSetOptions::SetUpdateInstallPath(CString cs)
  821. {
  822. return SetProfileString("UpdateInstallPath", cs);
  823. }
  824. long CGetSetOptions::GetLastUpdate()
  825. {
  826. return GetProfileLong("LastUpdateDay", 0);
  827. }
  828. long CGetSetOptions::SetLastUpdate(long lValue)
  829. {
  830. return SetProfileLong("LastUpdateDay", lValue);
  831. }
  832. BOOL CGetSetOptions::GetCheckForUpdates()
  833. {
  834. return GetProfileLong("CheckForUpdates", TRUE);
  835. }
  836. BOOL CGetSetOptions::SetCheckForUpdates(BOOL bCheck)
  837. {
  838. return SetProfileLong("CheckForUpdates", bCheck);
  839. }
  840. void CGetSetOptions::SetUseCtrlNumForFirstTenHotKeys(BOOL bVal)
  841. {
  842. SetProfileLong("UseCtrlNumForFirstTenHotKeys", bVal);
  843. m_bUseCtrlNumAccel = bVal;
  844. }
  845. BOOL CGetSetOptions::GetUseCtrlNumForFirstTenHotKeys()
  846. {
  847. return GetProfileLong("UseCtrlNumForFirstTenHotKeys", 0);
  848. }
  849. void CGetSetOptions::SetAllowDuplicates(BOOL bVal)
  850. {
  851. SetProfileLong("AllowDuplicates", bVal);
  852. m_bAllowDuplicates = bVal;
  853. }
  854. BOOL CGetSetOptions::GetAllowDuplicates()
  855. {
  856. return GetProfileLong("AllowDuplicates", 0);
  857. }
  858. void CGetSetOptions::SetUpdateTimeOnPaste(BOOL bVal)
  859. {
  860. SetProfileLong("UpdateTimeOnPaste", bVal);
  861. m_bUpdateTimeOnPaste = bVal;
  862. }
  863. BOOL CGetSetOptions::GetUpdateTimeOnPaste()
  864. {
  865. return GetProfileLong("UpdateTimeOnPaste", TRUE);
  866. }
  867. void CGetSetOptions::SetSaveMultiPaste(BOOL bVal)
  868. {
  869. SetProfileLong("SaveMultiPaste", bVal);
  870. m_bSaveMultiPaste = bVal;
  871. }
  872. BOOL CGetSetOptions::GetSaveMultiPaste()
  873. {
  874. return GetProfileLong("SaveMultiPaste", 0);
  875. }
  876. void CGetSetOptions::SetShowPersistent(BOOL bVal)
  877. {
  878. SetProfileLong("ShowPersistent", bVal);
  879. m_bShowPersistent = bVal;
  880. }
  881. BOOL CGetSetOptions::GetShowPersistent()
  882. {
  883. return GetProfileLong("ShowPersistent", 0);
  884. }
  885. void CGetSetOptions::SetShowTextForFirstTenHotKeys(BOOL bVal)
  886. {
  887. SetProfileLong("ShowTextForFirstTenHotKeys", bVal);
  888. }
  889. BOOL CGetSetOptions::GetShowTextForFirstTenHotKeys()
  890. {
  891. return GetProfileLong("ShowTextForFirstTenHotKeys", TRUE);
  892. }
  893. void CGetSetOptions::SetMainHWND(long lhWnd)
  894. {
  895. SetProfileLong("MainhWnd", lhWnd);
  896. }
  897. BOOL CGetSetOptions::GetMainHWND()
  898. {
  899. return GetProfileLong("MainhWnd", 0);
  900. }
  901. void CGetSetOptions::SetCaptionPos(long lPos)
  902. {
  903. SetProfileLong("CaptionPos", lPos);
  904. }
  905. long CGetSetOptions::GetCaptionPos()
  906. {
  907. return GetProfileLong("CaptionPos", CAPTION_RIGHT);
  908. }
  909. void CGetSetOptions::SetAutoHide(BOOL bAutoHide)
  910. {
  911. SetProfileLong("AutoHide", bAutoHide);
  912. }
  913. BOOL CGetSetOptions::GetAutoHide()
  914. {
  915. return GetProfileLong("AutoHide", FALSE);
  916. }
  917. void CGetSetOptions::SetDescTextSize(long lSize)
  918. {
  919. SetProfileLong("DescTextSize", lSize);
  920. m_bDescTextSize = lSize;
  921. }
  922. long CGetSetOptions::GetDescTextSize()
  923. {
  924. return GetProfileLong("DescTextSize", 500);
  925. }
  926. void CGetSetOptions::SetDescShowLeadingWhiteSpace(BOOL bVal)
  927. {
  928. SetProfileLong("DescShowLeadingWhiteSpace", bVal);
  929. m_bDescShowLeadingWhiteSpace = bVal;
  930. }
  931. BOOL CGetSetOptions::GetDescShowLeadingWhiteSpace()
  932. {
  933. return GetProfileLong("DescShowLeadingWhiteSpace", FALSE);
  934. }
  935. void CGetSetOptions::SetAllwaysShowDescription(long bShow)
  936. {
  937. SetProfileLong("AllwaysShowDescription", bShow);
  938. m_bAllwaysShowDescription = bShow;
  939. }
  940. BOOL CGetSetOptions::GetAllwaysShowDescription()
  941. {
  942. return GetProfileLong("AllwaysShowDescription", FALSE);
  943. }
  944. void CGetSetOptions::SetDoubleClickingOnCaptionDoes(long lOption)
  945. {
  946. SetProfileLong("DoubleClickingOnCaptionDoes", lOption);
  947. m_bDoubleClickingOnCaptionDoes = lOption;
  948. }
  949. long CGetSetOptions::GetDoubleClickingOnCaptionDoes()
  950. {
  951. return GetProfileLong("DoubleClickingOnCaptionDoes", TOGGLES_ALLWAYS_ON_TOP);
  952. }
  953. void CGetSetOptions::SetPrompForNewGroupName(BOOL bOption)
  954. {
  955. SetProfileLong("PrompForNewGroupName", bOption);
  956. m_bPrompForNewGroupName = bOption;
  957. }
  958. BOOL CGetSetOptions::GetPrompForNewGroupName()
  959. {
  960. return GetProfileLong("PrompForNewGroupName", TRUE);
  961. }
  962. void CGetSetOptions::SetSendPasteOnFirstTenHotKeys(BOOL bOption)
  963. {
  964. SetProfileLong("SendPasteOnFirstTenHotKeys", bOption);
  965. m_bSendPasteOnFirstTenHotKeys = bOption;
  966. }
  967. BOOL CGetSetOptions::GetSendPasteOnFirstTenHotKeys()
  968. {
  969. return GetProfileLong("SendPasteOnFirstTenHotKeys", TRUE);
  970. }
  971. void CGetSetOptions::SetSendClients(CSendClients Client, int nPos)
  972. {
  973. CString cs;
  974. cs.Format(_T("sendclient_ip_%d"), nPos);
  975. SetProfileString(cs, Client.csIP);
  976. cs.Format(_T("sendclient_autosend_%d"), nPos);
  977. SetProfileLong(cs, Client.bSendAll);
  978. cs.Format(_T("sendclient_description_%d"), nPos);
  979. SetProfileString(cs, Client.csDescription);
  980. Client.bShownFirstError = m_SendClients[nPos].bShownFirstError;
  981. m_SendClients[nPos] = Client;
  982. }
  983. CSendClients CGetSetOptions::GetSendClients(int nPos)
  984. {
  985. CSendClients Client;
  986. CString cs;
  987. cs.Format(_T("sendclient_ip_%d"), nPos);
  988. Client.csIP = GetProfileString(cs, "");
  989. cs.Format(_T("sendclient_autosend_%d"), nPos);
  990. Client.bSendAll = GetProfileLong(cs, FALSE);
  991. cs.Format(_T("sendclient_description_%d"), nPos);
  992. Client.csDescription = GetProfileString(cs, "");
  993. m_SendClients[nPos] = Client;
  994. return Client;
  995. }
  996. void CGetSetOptions::GetClientSendCount()
  997. {
  998. m_lAutoSendClientCount = 0;
  999. for(int i = 0; i < MAX_SEND_CLIENTS; i++)
  1000. {
  1001. if(m_SendClients[i].csIP.GetLength() > 0)
  1002. {
  1003. if(m_SendClients[i].bSendAll)
  1004. m_lAutoSendClientCount++;
  1005. }
  1006. }
  1007. }
  1008. CString CGetSetOptions::GetListToPutOnClipboard()
  1009. {
  1010. CString cs = GetProfileString("ListToPutOnClipboard", "");
  1011. cs.MakeUpper();
  1012. return cs;
  1013. }
  1014. BOOL CGetSetOptions::SetListToPutOnClipboard(CString cs)
  1015. {
  1016. cs.MakeUpper();
  1017. m_csIPListToPutOnClipboard = cs;
  1018. return SetProfileString("ListToPutOnClipboard", cs);
  1019. }
  1020. void CGetSetOptions::SetLogSendReceiveErrors(BOOL bOption)
  1021. {
  1022. m_bLogSendReceiveErrors = bOption;
  1023. SetProfileLong("LogSendReceiveErrors", bOption);
  1024. }
  1025. BOOL CGetSetOptions::GetLogSendReceiveErrors()
  1026. {
  1027. return GetProfileLong("LogSendReceiveErrors", FALSE);
  1028. }
  1029. BOOL CGetSetOptions::GetHideDittoOnHotKeyIfAlreadyShown()
  1030. {
  1031. return GetProfileLong("HideDittoOnHotKeyIfAlreadyShown", TRUE);
  1032. }
  1033. void CGetSetOptions::SetHideDittoOnHotKeyIfAlreadyShown(BOOL bVal)
  1034. {
  1035. m_HideDittoOnHotKeyIfAlreadyShown = bVal;
  1036. SetProfileLong("HideDittoOnHotKeyIfAlreadyShown", bVal);
  1037. }
  1038. void CGetSetOptions::SetPort(long lPort)
  1039. {
  1040. m_lPort = lPort;
  1041. SetProfileLong("SendRecvPort", lPort);
  1042. }
  1043. long CGetSetOptions::GetPort()
  1044. {
  1045. return GetProfileLong("SendRecvPort", 23443);
  1046. }
  1047. BOOL CGetSetOptions::GetDisableRecieve()
  1048. {
  1049. BOOL bDefault = FALSE;
  1050. if(GetIsPortableDitto())
  1051. bDefault = TRUE;
  1052. if(GetIsWindowsApp())
  1053. bDefault = TRUE;
  1054. return GetProfileLong("DisableRecieve", bDefault);
  1055. }
  1056. void CGetSetOptions::SetDisableRecieve(BOOL bVal)
  1057. {
  1058. SetProfileLong("DisableRecieve", bVal);
  1059. }
  1060. BOOL CGetSetOptions::GetFont(LOGFONT &font)
  1061. {
  1062. if(m_bFromIni && !m_bInConversion)
  1063. {
  1064. GetProfileFont("DisplayFont5", font);
  1065. //Return true if there is a font name
  1066. //other wise load the default font below
  1067. if(font.lfFaceName[0] != 0)
  1068. {
  1069. return TRUE;
  1070. }
  1071. }
  1072. else
  1073. {
  1074. DWORD dwLength = 0;
  1075. LPVOID lpVoid = GetProfileData("DisplayFont5", dwLength);
  1076. if(lpVoid)
  1077. {
  1078. if(sizeof(font) == dwLength)
  1079. {
  1080. memcpy(&font, lpVoid, dwLength);
  1081. delete[] lpVoid;
  1082. lpVoid = NULL;
  1083. return TRUE;
  1084. }
  1085. else
  1086. {
  1087. ASSERT(!"invalid font struct size");
  1088. }
  1089. delete[] lpVoid;
  1090. lpVoid = NULL;
  1091. }
  1092. }
  1093. ZeroMemory(&font, sizeof(font));
  1094. font.lfHeight = -theApp.m_metrics.PointsToPixels(10);
  1095. font.lfWeight = 400;
  1096. font.lfCharSet = 1;
  1097. STRCPY(font.lfFaceName, _T("Segoe UI"));
  1098. return TRUE;
  1099. }
  1100. void CGetSetOptions::SetFont(LOGFONT &font)
  1101. {
  1102. if(m_bFromIni)
  1103. {
  1104. SetProfileFont("DisplayFont5", font);
  1105. }
  1106. else
  1107. {
  1108. SetProfileData("DisplayFont5", &font, sizeof(LOGFONT));
  1109. }
  1110. }
  1111. void CGetSetOptions::SetDrawThumbnail(long bDraw)
  1112. {
  1113. SetProfileLong("DrawThumbnail", bDraw);
  1114. m_bDrawThumbnail = bDraw;
  1115. }
  1116. BOOL CGetSetOptions::GetDrawThumbnail()
  1117. {
  1118. BOOL bDrawThumbnails = TRUE;
  1119. return GetProfileLong("DrawThumbnail", bDrawThumbnails);
  1120. }
  1121. void CGetSetOptions::SetExtraNetworkPassword(CString csPassword)
  1122. {
  1123. SetProfileString("NetworkExtraPassword", csPassword);
  1124. }
  1125. CString CGetSetOptions::GetExtraNetworkPassword(bool bFillArray)
  1126. {
  1127. CString cs = GetProfileString("NetworkExtraPassword", "");
  1128. if(bFillArray)
  1129. {
  1130. m_csNetworkPasswordArray.RemoveAll();
  1131. TCHAR seps[] = _T(",");
  1132. TCHAR *token;
  1133. TCHAR *pString = cs.GetBuffer(cs.GetLength());
  1134. /* Establish string and get the first token: */
  1135. token = STRTOK(pString, seps);
  1136. while(token != NULL)
  1137. {
  1138. CString cs(token);
  1139. cs.TrimLeft();
  1140. cs.TrimRight();
  1141. m_csNetworkPasswordArray.Add(cs);
  1142. // Get next token
  1143. token = STRTOK(NULL, seps);
  1144. }
  1145. cs.ReleaseBuffer();
  1146. }
  1147. return cs;
  1148. }
  1149. void CGetSetOptions::SetNetworkPassword(CString csPassword)
  1150. {
  1151. CTextConvert Con;
  1152. Con.ConvertToUTF8(csPassword, m_csPassword);
  1153. SetProfileString("NetworkStringPassword", csPassword);
  1154. }
  1155. CStringA CGetSetOptions::GetNetworkPassword()
  1156. {
  1157. CString cs = GetProfileString("NetworkStringPassword", "LetMeIn");
  1158. CTextConvert Con;
  1159. CStringA csReturn;
  1160. Con.ConvertToUTF8(cs, csReturn);
  1161. return csReturn;
  1162. }
  1163. void CGetSetOptions::SetDrawRTF(long bDraw)
  1164. {
  1165. SetProfileLong("DrawRTF", bDraw);
  1166. m_bDrawRTF = bDraw;
  1167. }
  1168. BOOL CGetSetOptions::GetDrawRTF()
  1169. {
  1170. return GetProfileLong("DrawRTF", FALSE);
  1171. }
  1172. void CGetSetOptions::SetMultiPasteReverse(BOOL bVal)
  1173. {
  1174. SetProfileLong("MultiPasteReverse", bVal);
  1175. m_bMultiPasteReverse = bVal;
  1176. }
  1177. BOOL CGetSetOptions::GetMultiPasteReverse()
  1178. {
  1179. return GetProfileLong("MultiPasteReverse", TRUE);
  1180. }
  1181. void CGetSetOptions::SetPlaySoundOnCopy(CString cs)
  1182. {
  1183. m_csPlaySoundOnCopy = cs;
  1184. SetProfileString("PlaySoundOnCopy", cs);
  1185. }
  1186. CString CGetSetOptions::GetPlaySoundOnCopy()
  1187. {
  1188. return GetProfileString("PlaySoundOnCopy", "");
  1189. }
  1190. void CGetSetOptions::SetSendPasteAfterSelection(BOOL bVal)
  1191. {
  1192. m_bSendPasteMessageAfterSelection = bVal;
  1193. SetProfileLong("SendPasteMessageAfterSelection", bVal);
  1194. }
  1195. BOOL CGetSetOptions::GetSendPasteAfterSelection()
  1196. {
  1197. return GetProfileLong("SendPasteMessageAfterSelection", TRUE);
  1198. }
  1199. void CGetSetOptions::SetFindAsYouType(BOOL bVal)
  1200. {
  1201. m_bFindAsYouType = bVal;
  1202. SetProfileLong("FindAsYouType", bVal);
  1203. }
  1204. BOOL CGetSetOptions::GetFindAsYouType()
  1205. {
  1206. return GetProfileLong("FindAsYouType", TRUE);
  1207. }
  1208. void CGetSetOptions::SetEnsureEntireWindowCanBeSeen(BOOL bVal)
  1209. {
  1210. m_bEnsureEntireWindowCanBeSeen = bVal;
  1211. SetProfileLong("EnsureEntireWindowCanBeSeen", bVal);
  1212. }
  1213. BOOL CGetSetOptions::GetEnsureEntireWindowCanBeSeen()
  1214. {
  1215. return GetProfileLong("EnsureEntireWindowCanBeSeen", TRUE);
  1216. }
  1217. void CGetSetOptions::SetShowAllClipsInMainList(BOOL bVal)
  1218. {
  1219. m_bShowAllClipsInMainList = bVal;
  1220. SetProfileLong("ShowAllClipsInMainList", bVal);
  1221. }
  1222. BOOL CGetSetOptions::GetShowAllClipsInMainList()
  1223. {
  1224. return GetProfileLong("ShowAllClipsInMainList", TRUE);
  1225. }
  1226. long CGetSetOptions::GetMaxClipSizeInBytes()
  1227. {
  1228. return GetProfileLong("MaxClipSizeInBytes", 0);
  1229. }
  1230. void CGetSetOptions::SetMaxClipSizeInBytes(long lSize)
  1231. {
  1232. m_lMaxClipSizeInBytes = lSize;
  1233. SetProfileLong("MaxClipSizeInBytes", lSize);
  1234. }
  1235. CString CGetSetOptions::GetLanguageFile()
  1236. {
  1237. return GetProfileString("LanguageFile", "");
  1238. }
  1239. void CGetSetOptions::SetLanguageFile(CString csLanguage)
  1240. {
  1241. SetProfileString("LanguageFile", csLanguage);
  1242. }
  1243. ULONG CGetSetOptions::GetSaveClipDelay()
  1244. {
  1245. return (ULONG)GetProfileLong("SaveClipDelay", 500);
  1246. }
  1247. void CGetSetOptions::SetSaveClipDelay(DWORD dwDelay)
  1248. {
  1249. m_dwSaveClipDelay = dwDelay;
  1250. SetProfileLong("SaveClipDelay", dwDelay);
  1251. }
  1252. long CGetSetOptions::GetProcessDrawClipboardDelay()
  1253. {
  1254. return GetProfileLong("ProcessDrawClipboardDelay", 100);
  1255. }
  1256. void CGetSetOptions::SetProcessDrawClipboardDelay(long lDelay)
  1257. {
  1258. m_lProcessDrawClipboardDelay = lDelay;
  1259. SetProfileLong("ProcessDrawClipboardDelay", lDelay);
  1260. }
  1261. BOOL CGetSetOptions::GetEnableDebugLogging()
  1262. {
  1263. return GetProfileLong("EnableDebugLogging", FALSE);
  1264. }
  1265. void CGetSetOptions::SetEnableDebugLogging(BOOL bEnable)
  1266. {
  1267. m_bEnableDebugLogging = bEnable;
  1268. SetProfileLong("EnableDebugLogging", bEnable);
  1269. }
  1270. BOOL CGetSetOptions::GetEnsureConnectToClipboard()
  1271. {
  1272. return GetProfileLong("EnsureConnected2", FALSE);
  1273. }
  1274. void CGetSetOptions::SetEnsureConnectToClipboard(BOOL bSet)
  1275. {
  1276. m_bEnsureConnectToClipboard = bSet;
  1277. SetProfileLong("EnsureConnected2", bSet);
  1278. }
  1279. BOOL CGetSetOptions::GetPromptWhenDeletingClips()
  1280. {
  1281. return GetProfileLong("PromptWhenDeletingClips", TRUE);
  1282. }
  1283. void CGetSetOptions::SetPromptWhenDeletingClips(BOOL bSet)
  1284. {
  1285. SetProfileLong("PromptWhenDeletingClips", bSet);
  1286. }
  1287. CString CGetSetOptions::GetLastImportDir()
  1288. {
  1289. return GetProfileString("LastImportDir", "");
  1290. }
  1291. void CGetSetOptions::SetLastImportDir(CString csDir)
  1292. {
  1293. SetProfileString("LastImportDir", csDir);
  1294. }
  1295. CString CGetSetOptions::GetLastExportDir()
  1296. {
  1297. return GetProfileString("LastExportDir", "");
  1298. }
  1299. void CGetSetOptions::SetLastExportDir(CString csDir)
  1300. {
  1301. SetProfileString("LastExportDir", csDir);
  1302. }
  1303. BOOL CGetSetOptions::GetUpdateDescWhenSavingClip()
  1304. {
  1305. return GetProfileLong("UpdateDescWhenSaving", TRUE);
  1306. }
  1307. void CGetSetOptions::SetUpdateDescWhenSavingClip(BOOL bSet)
  1308. {
  1309. SetProfileLong("UpdateDescWhenSaving", bSet);
  1310. }
  1311. CString CGetSetOptions::GetPath(long lPathID)
  1312. {
  1313. CString csDir = CGetSetOptions::GetExeFileName();
  1314. csDir = GetFilePath(csDir);
  1315. FIX_CSTRING_PATH(csDir);
  1316. //U3_APP_DATA_PATH - <U3_DEVICE_PATH>\System\Apps\{app_unique_id}\Data
  1317. //U3_HOST_EXEC_PATH - %APPDATA%\U3\{device_serial_number}\{app_unique_id}\Exec
  1318. //U3_DEVICE_EXEC_PATH - <U3_DEVICE_PATH>\System\Apps\{app_unique_id}\Exec
  1319. switch(lPathID)
  1320. {
  1321. case PATH_HELP:
  1322. csDir += "Help\\";
  1323. break;
  1324. case PATH_LANGUAGE:
  1325. csDir += "language\\";
  1326. break;
  1327. case PATH_THEMES:
  1328. csDir += "Themes\\";
  1329. break;
  1330. case PATH_LOG_FILE:if(CGetSetOptions::GetIsPortableDitto() == false)
  1331. csDir = GetAppDataPath();
  1332. break;
  1333. case PATH_UPDATE_FILE:
  1334. //same path as the executable
  1335. break;
  1336. case PATH_DATABASE:
  1337. break;
  1338. case PATH_INI:
  1339. break;
  1340. case PATH_U3_HWND_INI:
  1341. break;
  1342. case PATH_ADDINS:
  1343. csDir += "Addins\\";
  1344. break;
  1345. case PATH_REMOTE_FILES:
  1346. if (CGetSetOptions::GetIsPortableDitto() == false)
  1347. {
  1348. csDir = GetTempFilePath();
  1349. }
  1350. csDir += "ReceivedFiles\\";
  1351. break;
  1352. case PATH_DRAG_FILES:
  1353. if (CGetSetOptions::GetIsPortableDitto() == false)
  1354. {
  1355. csDir = GetTempFilePath();
  1356. }
  1357. csDir += "DragFiles\\";
  1358. break;
  1359. case PATH_CLIP_DIFF:
  1360. if (CGetSetOptions::GetIsPortableDitto() == false)
  1361. {
  1362. csDir = GetTempFilePath();
  1363. }
  1364. csDir += _T("ClipCompare\\");
  1365. break;
  1366. }
  1367. CreateDirectory(csDir, NULL);
  1368. return csDir;
  1369. }
  1370. void CGetSetOptions::WriteU3Hwnd(HWND hWnd)
  1371. {
  1372. CString csIniFile = GetPath(PATH_U3_HWND_INI);
  1373. csIniFile += _T("DittohWnd.ini");
  1374. WritePrivateProfileInt(_T("Ditto"), _T("MainhWnd"), (int)hWnd, csIniFile);
  1375. }
  1376. long CGetSetOptions::GetDittoRestoreClipboardDelay()
  1377. {
  1378. return GetProfileLong("RestoreClipboardDelay", 750);
  1379. }
  1380. void CGetSetOptions::SetDittoRestoreClipboardDelay(long lDelay)
  1381. {
  1382. SetProfileLong("RestoreClipboardDelay", lDelay);
  1383. }
  1384. void CGetSetOptions::GetCopyBufferItem(int nPos, CCopyBufferItem &Item)
  1385. {
  1386. Item.m_lCopyHotKey = GetProfileLong(StrF(_T("CopyBufferCopyHotKey_%d"), nPos), 0);
  1387. Item.m_lPasteHotKey = GetProfileLong(StrF(_T("CopyBufferPasteHotKey_%d"), nPos), 0);
  1388. Item.m_lCutHotKey = GetProfileLong(StrF(_T("CopyBufferCutHotKey_%d"), nPos), 0);
  1389. Item.m_bPlaySoundOnCopy = GetProfileLong(StrF(_T("CopyBufferPlaySound_%d"), nPos), 0);
  1390. }
  1391. void CGetSetOptions::SetCopyBufferItem(int nPos, CCopyBufferItem &Item)
  1392. {
  1393. SetProfileLong(StrF(_T("CopyBufferCopyHotKey_%d"), nPos), Item.m_lCopyHotKey);
  1394. SetProfileLong(StrF(_T("CopyBufferPasteHotKey_%d"), nPos), Item.m_lPasteHotKey);
  1395. SetProfileLong(StrF(_T("CopyBufferCutHotKey_%d"), nPos), Item.m_lCutHotKey);
  1396. SetProfileLong(StrF(_T("CopyBufferPlaySound_%d"), nPos), Item.m_bPlaySoundOnCopy);
  1397. }
  1398. CString CGetSetOptions::GetMultiPasteSeparator(bool bConvertToLineFeeds)
  1399. {
  1400. CString csSep = GetProfileString(_T("MultiPasteSeparator"), _T("[LF]"));
  1401. if(bConvertToLineFeeds)
  1402. {
  1403. CString csLineFeed(_T("\r\n"));
  1404. csSep.Replace(_T("[LF]"), csLineFeed);
  1405. csSep.Replace(_T("[lf]"), csLineFeed);
  1406. }
  1407. return csSep;
  1408. }
  1409. void CGetSetOptions::SetMultiPasteSeparator(CString csSep)
  1410. {
  1411. SetProfileString(_T("MultiPasteSeparator"), csSep);
  1412. }
  1413. BOOL CGetSetOptions::GetSetCurrentDirectory()
  1414. {
  1415. if(m_portable)
  1416. {
  1417. CString csExePath = GetFilePath(GetExeFileName());
  1418. FIX_CSTRING_PATH(csExePath);
  1419. ::SetCurrentDirectory(csExePath);
  1420. }
  1421. return m_portable == true;
  1422. }
  1423. bool CGetSetOptions::GetIsPortableDitto()
  1424. {
  1425. return m_portable;
  1426. }
  1427. bool CGetSetOptions::GetIsWindowsApp()
  1428. {
  1429. return m_windowsApp;
  1430. }
  1431. CString CGetSetOptions::GetPasteString(CString csAppName)
  1432. {
  1433. CString csString = GetProfileString(csAppName, _T(""), _T("PasteStrings"));
  1434. if(csString.IsEmpty())
  1435. return GetDefaultPasteString();
  1436. return csString;
  1437. }
  1438. CString CGetSetOptions::GetDefaultPasteString()
  1439. {
  1440. //ascii value for v
  1441. //for other language keyboards v gets converted to something else so send the base ascii value
  1442. return GetProfileString(_T("DefaultPasteString"), _T("^{VKEY86}"));
  1443. }
  1444. CString CGetSetOptions::GetCopyString(CString csAppName)
  1445. {
  1446. CString csString = GetProfileString(csAppName, _T(""), _T("CopyStrings"));
  1447. if(csString.IsEmpty())
  1448. return GetDefaultCopyString();
  1449. return csString;
  1450. }
  1451. CString CGetSetOptions::GetDefaultCopyString()
  1452. {
  1453. //ascii value for c
  1454. //for other language keyboards c gets converted to something else so send the base ascii value
  1455. return GetProfileString(_T("DefaultCopyString"), _T("^{VKEY67}"));
  1456. }
  1457. CString CGetSetOptions::GetCutString(CString csAppName)
  1458. {
  1459. CString csString = GetProfileString(csAppName, _T(""), _T("CutStrings"));
  1460. if(csString.IsEmpty())
  1461. return GetDefaultCutString();
  1462. return csString;
  1463. }
  1464. CString CGetSetOptions::GetDefaultCutString()
  1465. {
  1466. //ascii value for x
  1467. //for other language keyboards x gets converted to something else so send the base ascii value
  1468. return GetProfileString(_T("DefaultCutString"), _T("^{VKEY88}"));
  1469. }
  1470. BOOL CGetSetOptions::GetEditWordWrap()
  1471. {
  1472. return GetProfileLong(_T("EditWordWrap"), TRUE);
  1473. }
  1474. void CGetSetOptions::SetEditWordWrap(BOOL bSet)
  1475. {
  1476. SetProfileLong(_T("EditWordWrap"), bSet);
  1477. }
  1478. bool CGetSetOptions::GetAllowFriends()
  1479. {
  1480. return (GetProfileLong("AllowFriends", TRUE) == TRUE);
  1481. }
  1482. long CGetSetOptions::GetAutoMaxDelay()
  1483. {
  1484. return GetProfileLong(_T("AutoMaxDelaySeconds"), 2);
  1485. }
  1486. void CGetSetOptions::SetAutoMaxDelay(long lDelay)
  1487. {
  1488. SetProfileLong(_T("AutoMaxDelaySeconds"), lDelay);
  1489. }
  1490. void CGetSetOptions::SetTheme(CString csTheme)
  1491. {
  1492. SetProfileString(_T("Theme2"), csTheme);
  1493. }
  1494. CString CGetSetOptions::GetTheme()
  1495. {
  1496. return GetProfileString(_T("Theme2"), "");
  1497. }
  1498. long CGetSetOptions::GetKeyStateWaitTimerCount()
  1499. {
  1500. return GetProfileLong(_T("KeyStateWaitTimerCount"), 20);
  1501. }
  1502. long CGetSetOptions::GetKeyStatePasteDelay()
  1503. {
  1504. return GetProfileLong(_T("KeyStatePasteDelay"), 200);
  1505. }
  1506. DWORD CGetSetOptions::GetDittoHotKey()
  1507. {
  1508. return (DWORD)GetProfileLong(_T("DittoHotKey"), 704);
  1509. }
  1510. DWORD CGetSetOptions::SendKeysDelay()
  1511. {
  1512. return (DWORD)GetProfileLong(_T("SendKeysDelay"), 50);
  1513. }
  1514. DWORD CGetSetOptions::WaitForActiveWndTimeout()
  1515. {
  1516. return (DWORD)GetProfileLong(_T("WaitForActiveWndTimeout"), 100);
  1517. }
  1518. DWORD CGetSetOptions::FocusChangedDelay()
  1519. {
  1520. return (DWORD)GetProfileLong(_T("FocusChangedDelay"), 100);
  1521. }
  1522. DWORD CGetSetOptions::FocusWndTimerTimeout()
  1523. {
  1524. return (DWORD)GetProfileLong(_T("FocusWndTimerTimeout"), 2000);
  1525. }
  1526. BOOL CGetSetOptions::GetConnectedToClipboard()
  1527. {
  1528. return GetProfileLong("ConnectedToClipboard", TRUE);
  1529. }
  1530. void CGetSetOptions::SetConnectedToClipboard(BOOL val)
  1531. {
  1532. SetProfileLong("ConnectedToClipboard", val);
  1533. }
  1534. DWORD CGetSetOptions::GetTextOnlyRestoreDelay()
  1535. {
  1536. return (DWORD)GetProfileLong(_T("TextOnlyRestoreDelay"), 2000);
  1537. }
  1538. DWORD CGetSetOptions::GetTextOnlyPasteDelay()
  1539. {
  1540. return (DWORD)GetProfileLong(_T("TextOnlyPasteDelay"), 0);
  1541. }
  1542. BOOL CGetSetOptions::GetSetFocusToApp(CString csAppName)
  1543. {
  1544. CString focusCheck;
  1545. focusCheck = "SetFocus_";
  1546. focusCheck += csAppName;
  1547. return GetProfileLong(focusCheck, FALSE);
  1548. }
  1549. DWORD CGetSetOptions::SelectedIndex()
  1550. {
  1551. return (DWORD)GetProfileLong(_T("SelectedIndex"), 0);
  1552. }
  1553. void CGetSetOptions::SetCopyAppInclude(CString csAppName)
  1554. {
  1555. SetProfileString(_T("CopyAppInclude"), csAppName);
  1556. }
  1557. CString CGetSetOptions::GetCopyAppInclude()
  1558. {
  1559. CString includeApp = GetProfileString(_T("CopyAppInclude"), "*");
  1560. if(includeApp == "")
  1561. {
  1562. includeApp = "*";
  1563. }
  1564. return includeApp;
  1565. }
  1566. void CGetSetOptions::SetCopyAppExclude(CString csAppName)
  1567. {
  1568. SetProfileString(_T("CopyAppExclude"), csAppName);
  1569. }
  1570. CString CGetSetOptions::GetCopyAppExclude()
  1571. {
  1572. return GetProfileString(_T("CopyAppExclude"), "");
  1573. }
  1574. CString CGetSetOptions::GetCopyAppSeparator()
  1575. {
  1576. return GetProfileString(_T("CopyAppSeparator"), ";");
  1577. }
  1578. DWORD CGetSetOptions::GetNoFormatsRetryDelay()
  1579. {
  1580. return GetProfileLong(_T("NoFormatsRetryDelay"), 200);
  1581. }
  1582. DWORD CGetSetOptions::GetMainDeletesDeleteCount()
  1583. {
  1584. return GetProfileLong(_T("MainDeletesDeleteCount"), 100);
  1585. }
  1586. DWORD CGetSetOptions::GetIdleSecondsBeforeDelete()
  1587. {
  1588. return GetProfileLong(_T("IdleSecondsBeforeDelete"), 60*10);
  1589. }
  1590. DWORD CGetSetOptions::GetDbTimeout()
  1591. {
  1592. return GetProfileLong(_T("DbTimeout"), 5000);
  1593. }
  1594. DWORD CGetSetOptions::GetFunnyTickCountAdjustment()
  1595. {
  1596. return GetProfileLong(_T("FunnyTickCountAdjustment"), 300001);
  1597. }
  1598. DWORD CGetSetOptions::GetMinIdleTimeBeforeTrackFocus()
  1599. {
  1600. return GetProfileLong(_T("MinIdleTimeBeforeTrackFocus"), 100);
  1601. }
  1602. DWORD CGetSetOptions::GetTimeBeforeExpandWindow()
  1603. {
  1604. return GetProfileLong(_T("TimeBeforeExpandWindow"), 250);
  1605. }
  1606. DWORD CGetSetOptions::GetUseGuiThreadInfoForFocus()
  1607. {
  1608. return GetProfileLong(_T("UseGuiThreadInfoForFocus"), 1);
  1609. }
  1610. void CGetSetOptions::SetSearchDescription(BOOL val)
  1611. {
  1612. SetProfileLong(_T("SearchDescription"), val);
  1613. }
  1614. BOOL CGetSetOptions::GetSearchDescription()
  1615. {
  1616. return GetProfileLong(_T("SearchDescription"), 1);
  1617. }
  1618. void CGetSetOptions::SetSearchFullText(BOOL val)
  1619. {
  1620. SetProfileLong(_T("SearchFullText"), val);
  1621. }
  1622. BOOL CGetSetOptions::GetSearchFullText()
  1623. {
  1624. return GetProfileLong(_T("SearchFullText"), 0);
  1625. }
  1626. void CGetSetOptions::SetSearchQuickPaste(BOOL val)
  1627. {
  1628. SetProfileLong(_T("SearchQuickPaste"), val);
  1629. }
  1630. BOOL CGetSetOptions::GetSearchQuickPaste()
  1631. {
  1632. return GetProfileLong(_T("SearchQuickPaste"), 0);
  1633. }
  1634. void CGetSetOptions::SetSimpleTextSearch(BOOL val)
  1635. {
  1636. SetProfileLong(_T("SimpleTextSearch"), val);
  1637. }
  1638. BOOL CGetSetOptions::GetSimpleTextSearch()
  1639. {
  1640. return GetProfileLong(_T("SimpleTextSearch"), 0);
  1641. }
  1642. void CGetSetOptions::SetRegExTextSearch(BOOL val)
  1643. {
  1644. SetProfileLong(_T("RegExTextSearch"), val);
  1645. }
  1646. BOOL CGetSetOptions::GetRegExTextSearch()
  1647. {
  1648. return GetProfileLong(_T("RegExTextSearch"), 0);
  1649. }
  1650. void CGetSetOptions::SetMoveClipsOnGlobal10(BOOL val)
  1651. {
  1652. SetProfileLong(_T("MoveClipsOnGlobal10"), val);
  1653. }
  1654. BOOL CGetSetOptions::GetMoveClipsOnGlobal10()
  1655. {
  1656. return GetProfileLong(_T("MoveClipsOnGlobal10"), 0);
  1657. }
  1658. void CGetSetOptions::SetShowScrollBar(BOOL val)
  1659. {
  1660. m_showScrollBar = val;
  1661. SetProfileLong(_T("ShowScrollBar"), val);
  1662. }
  1663. BOOL CGetSetOptions::GetShowScrollBar()
  1664. {
  1665. return GetProfileLong(_T("ShowScrollBar"), 0);
  1666. }
  1667. void CGetSetOptions::SetPasteAsAdmin(BOOL val)
  1668. {
  1669. SetProfileLong(_T("PasteAsAdmin"), val);
  1670. }
  1671. BOOL CGetSetOptions::GetPasteAsAdmin()
  1672. {
  1673. return GetProfileLong(_T("PasteAsAdmin"), 1);
  1674. }
  1675. void CGetSetOptions::SetRememberDescPos(BOOL val)
  1676. {
  1677. SetProfileLong(_T("RememberDescPos"), val);
  1678. }
  1679. BOOL CGetSetOptions::GetRememberDescPos()
  1680. {
  1681. return GetProfileLong(_T("RememberDescPos"), FALSE);
  1682. }
  1683. void CGetSetOptions::SetSizeDescWindowToContent(BOOL val)
  1684. {
  1685. SetProfileLong(_T("SizeDescWindowToContent"), val);
  1686. }
  1687. BOOL CGetSetOptions::GetSizeDescWindowToContent()
  1688. {
  1689. return GetProfileLong(_T("SizeDescWindowToContent"), TRUE);
  1690. }
  1691. void CGetSetOptions::SetScaleImagesToDescWindow(BOOL val)
  1692. {
  1693. SetProfileLong(_T("ScaleImagesToDescWindow"), val);
  1694. }
  1695. BOOL CGetSetOptions::GetScaleImagesToDescWindow()
  1696. {
  1697. return GetProfileLong(_T("ScaleImagesToDescWindow"), TRUE);
  1698. }
  1699. void CGetSetOptions::SetDescWndPoint(CPoint point)
  1700. {
  1701. SetResolutionProfileLong("DescWndX", point.x);
  1702. SetResolutionProfileLong("DescWndY", point.y);
  1703. }
  1704. void CGetSetOptions::GetDescWndPoint(CPoint &point)
  1705. {
  1706. point.x = GetResolutionProfileLong("DescWndX", 100);
  1707. point.y = GetResolutionProfileLong("DescWndY", 100);
  1708. }
  1709. void CGetSetOptions::GetDescWndSize(CSize &size)
  1710. {
  1711. size.cx = GetResolutionProfileLong("DescWndCX", 300);
  1712. size.cy = GetResolutionProfileLong("DescWndCY", 300);
  1713. if(size.cx <= 0 && size.cy <= 0)
  1714. {
  1715. size.cx = 300;
  1716. size.cy = 300;
  1717. }
  1718. }
  1719. void CGetSetOptions::SetDescWndSize(CSize size)
  1720. {
  1721. SetResolutionProfileLong("DescWndCX", size.cx);
  1722. SetResolutionProfileLong("DescWndCY", size.cy);
  1723. }
  1724. void CGetSetOptions::SetShowInTaskBar(BOOL val)
  1725. {
  1726. SetProfileLong(_T("ShowInTaskBar"), val);
  1727. }
  1728. BOOL CGetSetOptions::GetShowInTaskBar()
  1729. {
  1730. return GetProfileLong(_T("ShowInTaskBar"), FALSE);
  1731. }
  1732. void CGetSetOptions::SetDiffApp(CString val)
  1733. {
  1734. SetProfileString(_T("DiffApp"), val);
  1735. }
  1736. CString CGetSetOptions::GetDiffApp()
  1737. {
  1738. return GetProfileString(_T("DiffApp"), _T(""));
  1739. }
  1740. void CGetSetOptions::SetQRCodeBorderPixels(int val)
  1741. {
  1742. SetProfileLong(_T("QRCodeBorderPixels"), val);
  1743. }
  1744. int CGetSetOptions::GetQRCodeBorderPixels()
  1745. {
  1746. return GetProfileLong(_T("QRCodeBorderPixels"), 30);
  1747. }
  1748. CString CGetSetOptions::GetTranslateUrl()
  1749. {
  1750. return GetProfileString(_T("TranslateUrl"), _T("https://translate.google.com/?tl=en#auto/en/%s"));
  1751. }
  1752. void CGetSetOptions::SetNetworkReadTimeoutMS(int val)
  1753. {
  1754. SetProfileLong(_T("NetworkReadTimeoutMS"), val);
  1755. }
  1756. int CGetSetOptions::GetNetworkReadTimeoutMS()
  1757. {
  1758. return GetProfileLong(_T("NetworkReadTimeoutMS"), 30000);
  1759. }
  1760. void CGetSetOptions::SetRequestFilesUsingIP(int val)
  1761. {
  1762. SetProfileLong(_T("RequestFilesUsingIP"), val);
  1763. }
  1764. int CGetSetOptions::GetRequestFilesUsingIP()
  1765. {
  1766. return GetProfileLong(_T("RequestFilesUsingIP"), 0);
  1767. }
  1768. int CGetSetOptions::ReadRandomFileInterval()
  1769. {
  1770. return GetProfileLong(_T("ReadRandomFileInterval"), 60);
  1771. }
  1772. int CGetSetOptions::ReadRandomFileIdleMin()
  1773. {
  1774. return GetProfileLong(_T("ReadRandomFileIdleMin"), 30);
  1775. }
  1776. BOOL CGetSetOptions::GetShowGroupsInMainList()
  1777. {
  1778. return GetProfileLong(_T("ShowGroupsInMainList"), 0);
  1779. }
  1780. void CGetSetOptions::SetShowGroupsInMainList(BOOL val)
  1781. {
  1782. SetProfileLong(_T("ShowGroupsInMainList"), val);
  1783. }
  1784. void CGetSetOptions::SetGroupDoubleClickTimeMS(int val)
  1785. {
  1786. SetProfileLong(_T("GroupDoubleClickTimeMS"), val);
  1787. }
  1788. int CGetSetOptions::GetGroupDoubleClickTimeMS()
  1789. {
  1790. return GetProfileLong(_T("GroupDoubleClickTimeMS"), 500);
  1791. }
  1792. void CGetSetOptions::SetSaveToGroupTimeoutMS(int val)
  1793. {
  1794. SetProfileLong(_T("SaveToGroupTimeoutMS"), val);
  1795. }
  1796. int CGetSetOptions::GetSaveToGroupTimeoutMS()
  1797. {
  1798. return GetProfileLong(_T("SaveToGroupTimeoutMS"), 1000);
  1799. }
  1800. void CGetSetOptions::SetCopyReasonTimeoutMS(int val)
  1801. {
  1802. SetProfileLong(_T("CopyReasonTimeoutMS"), val);
  1803. }
  1804. int CGetSetOptions::GetCopyReasonTimeoutMS()
  1805. {
  1806. return GetProfileLong(_T("CopyReasonTimeoutMS"), 1000);
  1807. }
  1808. void CGetSetOptions::SetWindowsResumeDelayReOpenDbMS(int val)
  1809. {
  1810. SetProfileLong(_T("WindowsResumeDelayReOpenDbMS"), val);
  1811. }
  1812. int CGetSetOptions::GetWindowsResumeDelayReOpenDbMS()
  1813. {
  1814. return GetProfileLong(_T("WindowsResumeDelayReOpenDbMS"), 2000);
  1815. }
  1816. BOOL CGetSetOptions::GetShowMsgWndOnCopyToGroup()
  1817. {
  1818. return GetProfileLong(_T("ShowMsgWndOnCopyToGroup"), TRUE);
  1819. }
  1820. void CGetSetOptions::SetShowMsgWndOnCopyToGroup(BOOL val)
  1821. {
  1822. SetProfileLong(_T("ShowMsgWndOnCopyToGroup"), val);
  1823. }
  1824. int CGetSetOptions::GetActionShortCutA(DWORD action, int pos)
  1825. {
  1826. CString actionText;
  1827. actionText.Format(_T("QP_ShortCut_%d_%d_A"), action, pos);
  1828. int ret = GetProfileLong(actionText, -1);
  1829. if (ret == -1)
  1830. {
  1831. ret = ActionEnums::GetDefaultShortCutKeyA((ActionEnums::ActionEnumValues)action, pos);
  1832. }
  1833. return ret;
  1834. }
  1835. void CGetSetOptions::SetActionShortCutA(int action, DWORD shortcut, int pos)
  1836. {
  1837. CString actionText;
  1838. actionText.Format(_T("QP_ShortCut_%d_%d_A"), action, pos);
  1839. SetProfileLong(actionText, shortcut);
  1840. }
  1841. int CGetSetOptions::GetActionShortCutB(DWORD action, int pos)
  1842. {
  1843. CString actionText;
  1844. actionText.Format(_T("QP_ShortCut_%d_%d_B"), action, pos);
  1845. int ret = GetProfileLong(actionText, -1);
  1846. if (ret == -1)
  1847. {
  1848. ret = ActionEnums::GetDefaultShortCutKeyB((ActionEnums::ActionEnumValues)action, pos);
  1849. }
  1850. return ret;
  1851. }
  1852. void CGetSetOptions::SetActionShortCutB(int action, DWORD shortcut, int pos)
  1853. {
  1854. CString actionText;
  1855. actionText.Format(_T("QP_ShortCut_%d_%d_B"), action, pos);
  1856. SetProfileLong(actionText, shortcut);
  1857. }
  1858. BOOL CGetSetOptions::GetShowAlwaysOnTopWarning()
  1859. {
  1860. return GetProfileLong(_T("ShowAlwaysOnTopWarning"), TRUE);
  1861. }
  1862. void CGetSetOptions::SetShowAlwaysOnTopWarning(BOOL show)
  1863. {
  1864. m_bShowAlwaysOnTopWarning = show;
  1865. SetProfileLong(_T("ShowAlwaysOnTopWarning"), show);
  1866. }
  1867. BOOL CGetSetOptions::GetUseIPFromAccept()
  1868. {
  1869. return GetProfileLong(_T("UseIPFromAccept"), TRUE);
  1870. }
  1871. void CGetSetOptions::SetUseIPFromAccept(BOOL useAccept)
  1872. {
  1873. SetProfileLong(_T("UseIPFromAccept"), useAccept);
  1874. }
  1875. int CGetSetOptions::GetDragId()
  1876. {
  1877. return GetProfileLong(_T("DragId"), 1);
  1878. }
  1879. void CGetSetOptions::SetDragId(int id)
  1880. {
  1881. SetProfileLong(_T("DragId"), id);
  1882. }
  1883. BOOL CGetSetOptions::GetShowIfClipWasPasted()
  1884. {
  1885. return GetProfileLong(_T("ShowIfClipWasPasted"), TRUE);
  1886. }
  1887. void CGetSetOptions::SetShowIfClipWasPasted(BOOL val)
  1888. {
  1889. SetProfileLong(_T("ShowIfClipWasPasted"), val);
  1890. }
  1891. int CGetSetOptions::GetLastGroupToggle()
  1892. {
  1893. return GetProfileLong(_T("LastGroupToggle"), -2);
  1894. }
  1895. void CGetSetOptions::SetLastGroupToggle(int val)
  1896. {
  1897. SetProfileLong(_T("LastGroupToggle"), val);
  1898. }
  1899. BOOL CGetSetOptions::GetMouseClickHidesDescription()
  1900. {
  1901. return GetProfileLong(_T("MouseClickHidesDescription"), TRUE);
  1902. }
  1903. void CGetSetOptions::SetMouseClickHidesDescription(int val)
  1904. {
  1905. SetProfileLong(_T("MouseClickHidesDescription"), val);
  1906. }
  1907. BOOL CGetSetOptions::GetWrapDescriptionText()
  1908. {
  1909. return GetProfileLong(_T("WrapDescriptionText"), FALSE);
  1910. }
  1911. void CGetSetOptions::SetWrapDescriptionText(int val)
  1912. {
  1913. SetProfileLong(_T("WrapDescriptionText"), val);
  1914. }
  1915. BOOL CGetSetOptions::GetUseUISelectedGroupForLastTenCopies()
  1916. {
  1917. return GetProfileLong(_T("UseUISelectedGroupForLastTenCopies"), FALSE);
  1918. }
  1919. void CGetSetOptions::SetUseUISelectedGroupForLastTenCopies(int val)
  1920. {
  1921. SetProfileLong(_T("UseUISelectedGroupForLastTenCopies"), val);
  1922. }
  1923. int CGetSetOptions::GetDelayRenderLockout()
  1924. {
  1925. return GetProfileLong(_T("DelayRenderLockout"), 1000);
  1926. }
  1927. void CGetSetOptions::SetDelayRenderLockout(int val)
  1928. {
  1929. SetProfileLong(_T("DelayRenderLockout"), val);
  1930. }
  1931. BOOL CGetSetOptions::GetAdjustClipsForCRC()
  1932. {
  1933. return GetProfileLong(_T("AdjustClipsForCRC"), TRUE);
  1934. }
  1935. void CGetSetOptions::SetAdjustClipsForCRC(int val)
  1936. {
  1937. SetProfileLong(_T("AdjustClipsForCRC"), val);
  1938. }
  1939. BOOL CGetSetOptions::GetCheckMd5OnFileTransfers()
  1940. {
  1941. return GetProfileLong(_T("CheckMd5OnFileTransfers"), TRUE);
  1942. }
  1943. void CGetSetOptions::SetCheckMd5OnFileTransfers(int val)
  1944. {
  1945. SetProfileLong(_T("CheckMd5OnFileTransfers"), val);
  1946. }
  1947. int CGetSetOptions::GetBalloonTimeout()
  1948. {
  1949. return GetProfileLong(_T("BalloonTimeout"), 2500);
  1950. }
  1951. void CGetSetOptions::SetBalloonTimeout(int val)
  1952. {
  1953. SetProfileLong(_T("BalloonTimeout"), val);
  1954. }
  1955. void CGetSetOptions::SetCustomSendToList(CString val)
  1956. {
  1957. SetProfileString(_T("CustomSendToList"), val);
  1958. }
  1959. CString CGetSetOptions::GetCustomSendToList()
  1960. {
  1961. return GetProfileString("CustomSendToList", "");
  1962. }
  1963. int CGetSetOptions::GetMaxFileContentsSize()
  1964. {
  1965. return GetProfileLong(_T("MaxFileContentsSize"), 64000000);
  1966. }
  1967. void CGetSetOptions::SetMaxFileContentsSize(int val)
  1968. {
  1969. SetProfileLong(_T("MaxFileContentsSize"), val);
  1970. }
  1971. int CGetSetOptions::GetErrorMsgPopupTimeout()
  1972. {
  1973. return GetProfileLong(_T("ErrorMsgPopupTimeout"), 3500);
  1974. }
  1975. void CGetSetOptions::SetErrorMsgPopupTimeout(int val)
  1976. {
  1977. SetProfileLong(_T("ErrorMsgPopupTimeout"), val);
  1978. }
  1979. void CGetSetOptions::SetRegexFilter(CString val, int pos)
  1980. {
  1981. CString cs;
  1982. cs.Format(_T("RegexFilter_%d"), pos);
  1983. SetProfileString(cs, val);
  1984. }
  1985. CString CGetSetOptions::GetRegexFilter(int pos)
  1986. {
  1987. CString cs;
  1988. cs.Format(_T("RegexFilter_%d"), pos);
  1989. return GetProfileString(cs, "");
  1990. }
  1991. void CGetSetOptions::SetRegexFilterByProcessName(CString val, int pos)
  1992. {
  1993. CString cs;
  1994. cs.Format(_T("RegexFilterByProcessName_%d"), pos);
  1995. SetProfileString(cs, val);
  1996. }
  1997. CString CGetSetOptions::GetRegexFilterByProcessName(int pos)
  1998. {
  1999. CString cs;
  2000. cs.Format(_T("RegexFilterByProcessName_%d"), pos);
  2001. return GetProfileString(cs, "*");
  2002. }