Options.cpp 61 KB

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