Options.cpp 60 KB

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