Options.cpp 76 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121
  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. #include "Shared/Tokenizer.h"
  11. #include <set>
  12. #include <Wincrypt.h>
  13. using namespace nsPath;
  14. UINT WritePrivateProfileInt(LPCTSTR lpAppName, LPCTSTR lpKeyName, INT nValue, LPCTSTR lpFileName)
  15. {
  16. // Locals
  17. TCHAR szBuff[25];
  18. // Format
  19. SPRINTF(szBuff, _T("%d"), nValue);
  20. // Write
  21. return WritePrivateProfileString(lpAppName, lpKeyName, szBuff, lpFileName);
  22. }
  23. long CGetSetOptions::m_nLinesPerRow;
  24. BOOL CGetSetOptions::m_bUseCtrlNumAccel;
  25. BOOL CGetSetOptions::m_bAllowDuplicates;
  26. BOOL CGetSetOptions::m_bUpdateTimeOnPaste;
  27. BOOL CGetSetOptions::m_bSaveMultiPaste;
  28. BOOL CGetSetOptions::m_bShowPersistent;
  29. long CGetSetOptions::m_bDescTextSize;
  30. BOOL CGetSetOptions::m_bDescShowLeadingWhiteSpace;
  31. BOOL CGetSetOptions::m_bAllwaysShowDescription;
  32. long CGetSetOptions::m_bDoubleClickingOnCaptionDoes;
  33. BOOL CGetSetOptions::m_bPrompForNewGroupName;
  34. BOOL CGetSetOptions::m_bSendPasteOnFirstTenHotKeys;
  35. CSendClients CGetSetOptions::m_SendClients[MAX_SEND_CLIENTS];
  36. long CGetSetOptions::m_lAutoSendClientCount;
  37. CString CGetSetOptions::m_csIPListToPutOnClipboard;
  38. BOOL CGetSetOptions::m_bLogSendReceiveErrors;
  39. BOOL CGetSetOptions::m_HideDittoOnHotKeyIfAlreadyShown;
  40. long CGetSetOptions::m_lPort;
  41. BOOL CGetSetOptions::m_bDrawThumbnail;
  42. BOOL CGetSetOptions::m_bDrawCopiedColorCode;
  43. BOOL CGetSetOptions::m_centerWindowBelowCursorOrCaret;
  44. BOOL CGetSetOptions::m_bFastThumbnailMode;
  45. CStringA CGetSetOptions::m_csPassword;
  46. BOOL CGetSetOptions::m_bDrawRTF;
  47. BOOL CGetSetOptions::m_bMultiPasteReverse;
  48. CString CGetSetOptions::m_csPlaySoundOnCopy;
  49. CStringArray CGetSetOptions::m_csNetworkPasswordArray;
  50. BOOL CGetSetOptions::m_bSendPasteMessageAfterSelection;
  51. BOOL CGetSetOptions::m_bFindAsYouType;
  52. BOOL CGetSetOptions::m_bEnsureEntireWindowCanBeSeen;
  53. BOOL CGetSetOptions::m_bShowAllClipsInMainList;
  54. long CGetSetOptions::m_lMaxClipSizeInBytes;
  55. DWORD CGetSetOptions::m_dwSaveClipDelay;
  56. long CGetSetOptions::m_lProcessDrawClipboardDelay;
  57. BOOL CGetSetOptions::m_bEnableDebugLogging;
  58. BOOL CGetSetOptions::m_bEnsureConnectToClipboard;
  59. BOOL CGetSetOptions::m_outputDebugStringLogging;
  60. bool CGetSetOptions::m_bInConversion = false;
  61. bool CGetSetOptions::m_bFromIni = false;
  62. bool CGetSetOptions::m_portable = false;
  63. bool CGetSetOptions::m_windowsApp = false;
  64. bool CGetSetOptions::m_chocolateyApp = false;
  65. CString CGetSetOptions::m_csIniFileName;
  66. __int64 CGetSetOptions::nLastDbWriteTime = 0;
  67. CTheme CGetSetOptions::m_Theme;
  68. BOOL CGetSetOptions::m_showScrollBar = false;
  69. BOOL CGetSetOptions::m_bShowAlwaysOnTopWarning = TRUE;
  70. CRegExFilterHelper CGetSetOptions::m_regexHelper;
  71. CString CGetSetOptions::m_ignoreAnnoyingCFDIB = "";
  72. CChaiScriptXml CGetSetOptions::m_copyScripts;
  73. CChaiScriptXml CGetSetOptions::m_pasteScripts;
  74. long CGetSetOptions::m_tooltipTimeout;
  75. BOOL CGetSetOptions::m_cleanRTFBeforeDrawing = TRUE;
  76. int CGetSetOptions::m_doubleKeyStrokeTimeout = 350;
  77. int CGetSetOptions::m_firstTenHotKeysStart = 1;
  78. int CGetSetOptions::m_firstTenHotKeysFontSize = 5;
  79. BOOL CGetSetOptions::m_moveSelectionOnOpenHotkey = TRUE;
  80. BOOL CGetSetOptions::m_allowBackToBackDuplicates = FALSE;
  81. BOOL CGetSetOptions::m_maintainSearchView = FALSE;
  82. CString CGetSetOptions::m_tempDragFileName = "";
  83. CTime CGetSetOptions::m_tempDragFileNameSetTime;
  84. BOOL CGetSetOptions::m_refreshViewAfterPasting = TRUE;
  85. BOOL CGetSetOptions::m_supportAllTypes = FALSE;
  86. CGetSetOptions::CGetSetOptions()
  87. {
  88. //DATA_BLOB DataIn;
  89. //DATA_BLOB DataOut;
  90. //DATA_BLOB DataVerify;
  91. //BYTE* pbDataInput = (BYTE*)"Hello world of data protection.";
  92. //DWORD cbDataInput = strlen((char*)pbDataInput) + 1;
  93. //DataIn.pbData = pbDataInput;
  94. //DataIn.cbData = cbDataInput;
  95. //CRYPTPROTECT_PROMPTSTRUCT PromptStruct;
  96. //LPWSTR pDescrOut = NULL;
  97. //CRYPTPROTECT_LOCAL_MACHINE
  98. ////-------------------------------------------------------------------
  99. //// Begin processing.
  100. //printf("The data to be encrypted is: %s\n", pbDataInput);
  101. ////-------------------------------------------------------------------
  102. //// Initialize PromptStruct.
  103. ////ZeroMemory(&PromptStruct, sizeof(PromptStruct));
  104. ////PromptStruct.cbSize = sizeof(PromptStruct);
  105. ////PromptStruct.dwPromptFlags = CRYPTPROTECT_PROMPT_ON_PROTECT;
  106. ////PromptStruct.szPrompt = L"This is a user prompt.";
  107. ////-------------------------------------------------------------------
  108. //// Begin protect phase.
  109. //if (CryptProtectData(
  110. // &DataIn,
  111. // L"This is the description string.", // A description string.
  112. // NULL, // Optional entropy
  113. // // not used.
  114. // NULL, // Reserved.
  115. // NULL, // Pass a PromptStruct.
  116. // 0,
  117. // &DataOut))
  118. //{
  119. // printf("The encryption phase worked. \n");
  120. //}
  121. //else
  122. //{
  123. // //MyHandleError("Encryption error!");
  124. //}
  125. //if (CryptUnprotectData(
  126. // &DataOut,
  127. // &pDescrOut,
  128. // NULL, // Optional entropy
  129. // NULL, // Reserved
  130. // NULL, // Optional PromptStruct
  131. // 0,
  132. // &DataVerify))
  133. //{
  134. // printf("The decrypted data is: %s\n", DataVerify.pbData);
  135. // printf("The description of the data was: %S\n", pDescrOut);
  136. //}
  137. //else
  138. //{
  139. // //MyHandleError("Decryption error!");
  140. //}
  141. ////-------------------------------------------------------------------
  142. //// At this point, memcmp could be used to compare DataIn.pbData and
  143. //// DataVerify.pbDate for equality. If the two functions worked
  144. //// correctly, the two byte strings are identical.
  145. ////-------------------------------------------------------------------
  146. //// Clean up.
  147. //LocalFree(pDescrOut);
  148. //LocalFree(DataOut.pbData);
  149. //LocalFree(DataVerify.pbData);
  150. // End of main
  151. }
  152. CGetSetOptions::~CGetSetOptions()
  153. {
  154. }
  155. void CGetSetOptions::LoadSettings()
  156. {
  157. CString exeDir = CGetSetOptions::GetExeFileName();
  158. exeDir = GetFilePath(exeDir);
  159. FIX_CSTRING_PATH(exeDir);
  160. CString windowsAppFile = exeDir + _T("WindowsApp");
  161. CString chocolateyAppFile = exeDir + _T("chocolatey");
  162. if (FileExists(windowsAppFile))
  163. {
  164. m_windowsApp = true;
  165. m_bFromIni = true;
  166. //always use the ini file in the app data folder for windows store
  167. m_csIniFileName = GetIniFileName(false);
  168. }
  169. else if (FileExists(chocolateyAppFile))
  170. {
  171. m_chocolateyApp = true;
  172. m_bFromIni = true;
  173. //always use the ini file in the app data folder for chocolatey portable
  174. m_csIniFileName = GetIniFileName(false);
  175. }
  176. else
  177. {
  178. m_csIniFileName = GetIniFileName(true);
  179. CString portable = GetFilePath(m_csIniFileName);
  180. portable += _T("portable");
  181. if (FileExists(portable))
  182. {
  183. m_portable = true;
  184. }
  185. //first check if ini file is in app directory
  186. if (m_portable || FileExists(m_csIniFileName))
  187. {
  188. m_bFromIni = true;
  189. }
  190. else
  191. {
  192. //next check if it's in app data
  193. m_csIniFileName = GetIniFileName(false);
  194. if (FileExists(m_csIniFileName))
  195. {
  196. m_bFromIni = true;
  197. }
  198. }
  199. }
  200. if(m_bFromIni)
  201. {
  202. CString csPath = GetFilePath(m_csIniFileName);
  203. if(FileExists(csPath) == FALSE)
  204. CreateDirectory(csPath, NULL);
  205. //create the ini file as unicode, this way we can save unicode string to the ini file
  206. //http://www.codeproject.com/Articles/9071/Using-Unicode-in-INI-files
  207. CreateIniFile(m_csIniFileName);
  208. }
  209. /*CString cs = GetDBPath();
  210. SetDBPath(_T("some path"));
  211. CString cs2 = GetDBPath();*/
  212. GetSetCurrentDirectory();
  213. //First time we run, set some defaults
  214. if (GetDBPath() == _T("") &&
  215. GetTotalCopyCount() == 0)
  216. {
  217. SetCheckForMaxEntries(TRUE);
  218. SetSimpleTextSearch(TRUE);
  219. }
  220. m_nLinesPerRow = GetLinesPerRow();
  221. m_bUseCtrlNumAccel = GetUseCtrlNumForFirstTenHotKeys();
  222. m_bAllowDuplicates = GetAllowDuplicates();
  223. m_bUpdateTimeOnPaste = GetUpdateTimeOnPaste();
  224. m_bSaveMultiPaste = GetSaveMultiPaste();
  225. m_bShowPersistent = GetShowPersistent();
  226. m_bDescTextSize = GetDescTextSize();
  227. m_bDescShowLeadingWhiteSpace = GetDescShowLeadingWhiteSpace();
  228. m_bAllwaysShowDescription = GetAllwaysShowDescription();
  229. m_bDoubleClickingOnCaptionDoes = GetDoubleClickingOnCaptionDoes();
  230. m_bPrompForNewGroupName = GetPrompForNewGroupName();
  231. m_bSendPasteOnFirstTenHotKeys = GetSendPasteOnFirstTenHotKeys();
  232. m_csIPListToPutOnClipboard = GetListToPutOnClipboard();
  233. m_bLogSendReceiveErrors = GetLogSendReceiveErrors();
  234. m_HideDittoOnHotKeyIfAlreadyShown = GetHideDittoOnHotKeyIfAlreadyShown();
  235. m_lPort = GetPort();
  236. m_bDrawThumbnail = GetDrawThumbnail();
  237. m_bDrawCopiedColorCode = GetDrawCopiedColorCode();
  238. m_centerWindowBelowCursorOrCaret = GetCenterWindowBelowCursorOrCaret();
  239. m_bFastThumbnailMode = GetFastThumbnailMode();
  240. m_csPassword = GetNetworkPassword();
  241. m_bDrawRTF = GetDrawRTF();
  242. m_bMultiPasteReverse = GetMultiPasteReverse();
  243. m_csPlaySoundOnCopy = GetPlaySoundOnCopy();
  244. m_bSendPasteMessageAfterSelection = GetSendPasteAfterSelection();
  245. m_bFindAsYouType = GetFindAsYouType();
  246. m_bEnsureEntireWindowCanBeSeen = GetEnsureEntireWindowCanBeSeen();
  247. m_bShowAllClipsInMainList = GetShowAllClipsInMainList();
  248. m_lMaxClipSizeInBytes = GetMaxClipSizeInBytes();
  249. m_dwSaveClipDelay = GetSaveClipDelay();
  250. m_lProcessDrawClipboardDelay = GetProcessDrawClipboardDelay();
  251. m_bEnableDebugLogging = GetEnableDebugLogging();
  252. m_outputDebugStringLogging = GetEnableOutputDebugStringLogging();
  253. m_bEnsureConnectToClipboard = GetEnsureConnectToClipboard();
  254. m_showScrollBar = GetShowScrollBar();
  255. m_bShowAlwaysOnTopWarning = GetShowAlwaysOnTopWarning();
  256. m_ignoreAnnoyingCFDIB = GetIgnoreAnnoyingCFDIB();
  257. m_doubleKeyStrokeTimeout = GetDoubleKeyStrokeTimeout();
  258. m_firstTenHotKeysStart = GetFirstTenHotKeysStart();
  259. m_firstTenHotKeysFontSize = GetFirstTenHotKeysFontSize();
  260. m_moveSelectionOnOpenHotkey = GetMoveSelectionOnOpenHotkey();
  261. m_allowBackToBackDuplicates = GetAllowBackToBackDuplicates();
  262. m_maintainSearchView = GetMaintainSearchView();
  263. GetExtraNetworkPassword(true);
  264. for(int i = 0; i < MAX_SEND_CLIENTS; i++)
  265. {
  266. GetSendClients(i);
  267. }
  268. for (int i = 0; i < MAX_REGEX_FILTERS; i++)
  269. {
  270. CRegExFilterData data;
  271. data.m_regEx = GetRegexFilter(i);
  272. data.m_processFilters = GetRegexFilterByProcessName(i);
  273. m_regexHelper.Add(i, data);
  274. }
  275. GetClientSendCount();
  276. m_Theme.Load(GetTheme());
  277. m_copyScripts.Load(GetCopyScriptsXml());
  278. if (m_copyScripts.m_assignedGuidOnLoad)
  279. {
  280. SetCopyScriptsXml(m_copyScripts.Save());
  281. }
  282. m_pasteScripts.Load(GetPasteScriptsXml());
  283. if (m_pasteScripts.m_assignedGuidOnLoad)
  284. {
  285. SetPasteScriptsXml(m_pasteScripts.Save());
  286. }
  287. m_tooltipTimeout = GetToolTipTimeout();
  288. }
  289. void CGetSetOptions::CreateIniFile(CString path)
  290. {
  291. if (!::PathFileExists(path))
  292. {
  293. // UTF16-LE BOM(FFFE)
  294. WORD wBOM = 0xFEFF;
  295. DWORD NumberOfBytesWritten;
  296. HANDLE hFile = ::CreateFile(path, GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
  297. ::WriteFile(hFile, &wBOM, sizeof(WORD), &NumberOfBytesWritten, NULL);
  298. //LPTSTR pszSectionB = _T("[StringTable]"); // section name with bracket
  299. //::WriteFile(hFile, pszSectionB, (_tcslen(pszSectionB) + 1)*(sizeof(TCHAR)), &NumberOfBytesWritten, NULL);
  300. ::CloseHandle(hFile);
  301. }
  302. }
  303. void CGetSetOptions::ConverSettingsToIni()
  304. {
  305. m_bInConversion = true;
  306. CSize sz;
  307. CPoint pt;
  308. GetQuickPasteSize(sz);
  309. SetQuickPasteSize(sz);
  310. GetQuickPastePoint(pt);
  311. SetQuickPastePoint(pt);
  312. SetShowIconInSysTray(GetShowIconInSysTray());
  313. SetRunOnStartUp(GetRunOnStartUp());
  314. SetEnableTransparency(GetEnableTransparency());
  315. SetTransparencyPercent(GetTransparencyPercent());
  316. SetLinesPerRow(GetLinesPerRow());
  317. SetQuickPastePosition(GetQuickPastePosition());
  318. SetCopyGap(GetCopyGap());
  319. SetDBPath(GetDBPath());
  320. SetCheckForMaxEntries(GetCheckForMaxEntries());
  321. SetCheckForExpiredEntries(GetCheckForExpiredEntries());
  322. SetMaxEntries(GetMaxEntries());
  323. SetExpiredEntries(GetExpiredEntries());
  324. SetTripCopyCount(GetTripCopyCount());
  325. SetTripPasteCount(GetTripPasteCount());
  326. SetTripDate(GetTripDate());
  327. SetTotalCopyCount(GetTotalCopyCount());
  328. SetTotalPasteCount(GetTotalPasteCount());
  329. SetTotalDate(GetTotalDate());
  330. SetUpdateFilePath(GetUpdateFilePath());
  331. SetUpdateInstallPath(GetUpdateInstallPath());
  332. SetLastUpdate(GetLastUpdate());
  333. SetCheckForUpdates(GetCheckForUpdates());
  334. SetUseCtrlNumForFirstTenHotKeys(GetUseCtrlNumForFirstTenHotKeys());
  335. SetAllowDuplicates(GetAllowDuplicates());
  336. SetUpdateTimeOnPaste(GetUpdateTimeOnPaste());
  337. SetSaveMultiPaste(GetSaveMultiPaste());
  338. SetShowPersistent(GetShowPersistent());
  339. SetShowTextForFirstTenHotKeys(GetShowTextForFirstTenHotKeys());
  340. SetMainHWND(GetMainHWND());
  341. SetCaptionPos(GetCaptionPos());
  342. SetAutoHide(GetAutoHide());
  343. SetDescTextSize(GetDescTextSize());
  344. SetDescShowLeadingWhiteSpace(GetDescShowLeadingWhiteSpace());
  345. SetAllwaysShowDescription(GetAllwaysShowDescription());
  346. SetDoubleClickingOnCaptionDoes(GetDoubleClickingOnCaptionDoes());
  347. SetPrompForNewGroupName(GetPrompForNewGroupName());
  348. SetSendPasteOnFirstTenHotKeys(GetSendPasteOnFirstTenHotKeys());
  349. for(int i = 0; i < MAX_SEND_CLIENTS; i++)
  350. {
  351. GetSendClients(i);
  352. SetSendClients(m_SendClients[i], i);
  353. }
  354. SetListToPutOnClipboard(GetListToPutOnClipboard());
  355. SetLogSendReceiveErrors(GetLogSendReceiveErrors());
  356. SetHideDittoOnHotKeyIfAlreadyShown(GetHideDittoOnHotKeyIfAlreadyShown());
  357. SetPort(GetPort());
  358. SetDisableRecieve(GetDisableRecieve());
  359. LOGFONT font;
  360. GetFont(font);
  361. SetFont(font);
  362. SetDrawThumbnail(GetDrawThumbnail());
  363. CStringA PassA = GetNetworkPassword();
  364. CString PassW = PassA;
  365. SetNetworkPassword(PassW);
  366. SetDrawRTF(GetDrawRTF());
  367. SetMultiPasteReverse(GetMultiPasteReverse());
  368. SetPlaySoundOnCopy(GetPlaySoundOnCopy());
  369. SetSendPasteAfterSelection(GetSendPasteAfterSelection());
  370. SetFindAsYouType(GetFindAsYouType());
  371. SetEnsureEntireWindowCanBeSeen(GetEnsureEntireWindowCanBeSeen());
  372. SetShowAllClipsInMainList(GetShowAllClipsInMainList());
  373. SetExtraNetworkPassword(GetExtraNetworkPassword(false));
  374. SetMaxClipSizeInBytes(GetMaxClipSizeInBytes());
  375. SetLanguageFile(GetLanguageFile());
  376. SetSaveClipDelay(GetSaveClipDelay());
  377. SetProcessDrawClipboardDelay(GetProcessDrawClipboardDelay());
  378. SetEnableDebugLogging(GetEnableDebugLogging());
  379. SetEnsureConnectToClipboard(GetEnsureConnectToClipboard());
  380. SetPromptWhenDeletingClips(GetPromptWhenDeletingClips());
  381. SetLastImportDir(GetLastImportDir());
  382. SetLastExportDir(GetLastExportDir());
  383. SetUpdateDescWhenSavingClip(GetUpdateDescWhenSavingClip());
  384. m_bInConversion = false;
  385. }
  386. CString CGetSetOptions::GetIniFileName(bool bLocalIniFile)
  387. {
  388. CString csPath = _T("c:\\program files\\Ditto\\");
  389. if(bLocalIniFile)
  390. {
  391. csPath = GetFilePath(GetExeFileName());
  392. }
  393. else
  394. {
  395. csPath = GetAppDataPath();
  396. }
  397. csPath += "Ditto.Settings";
  398. return csPath;
  399. }
  400. CString CGetSetOptions::GetAppDataPath()
  401. {
  402. CString csPath;
  403. LPMALLOC pMalloc;
  404. if (GetIsWindowsApp())
  405. {
  406. if (SUCCEEDED(::SHGetMalloc(&pMalloc)))
  407. {
  408. LPITEMIDLIST pidlPrograms;
  409. SHGetSpecialFolderLocation(NULL, CSIDL_LOCAL_APPDATA, &pidlPrograms);
  410. TCHAR string[MAX_PATH];
  411. SHGetPathFromIDList(pidlPrograms, string);
  412. pMalloc->Free(pidlPrograms);
  413. pMalloc->Release();
  414. csPath = string;
  415. }
  416. FIX_CSTRING_PATH(csPath);
  417. csPath += "Ditto_WindowsApp\\";
  418. }
  419. else if (GetIsChocolateyApp())
  420. {
  421. if (SUCCEEDED(::SHGetMalloc(&pMalloc)))
  422. {
  423. LPITEMIDLIST pidlPrograms;
  424. SHGetSpecialFolderLocation(NULL, CSIDL_LOCAL_APPDATA, &pidlPrograms);
  425. TCHAR string[MAX_PATH];
  426. SHGetPathFromIDList(pidlPrograms, string);
  427. pMalloc->Free(pidlPrograms);
  428. pMalloc->Release();
  429. csPath = string;
  430. }
  431. FIX_CSTRING_PATH(csPath);
  432. csPath += "Ditto_ChocolateyApp\\";
  433. }
  434. else
  435. {
  436. if (SUCCEEDED(::SHGetMalloc(&pMalloc)))
  437. {
  438. LPITEMIDLIST pidlPrograms;
  439. SHGetSpecialFolderLocation(NULL, CSIDL_APPDATA, &pidlPrograms);
  440. TCHAR string[MAX_PATH];
  441. SHGetPathFromIDList(pidlPrograms, string);
  442. pMalloc->Free(pidlPrograms);
  443. pMalloc->Release();
  444. csPath = string;
  445. }
  446. FIX_CSTRING_PATH(csPath);
  447. csPath += "Ditto\\";
  448. }
  449. return csPath;
  450. }
  451. CString CGetSetOptions::GetTempFilePath()
  452. {
  453. CString csPath;
  454. wchar_t wchPath[MAX_PATH];
  455. if (GetTempPathW(MAX_PATH, wchPath))
  456. {
  457. csPath = wchPath;
  458. csPath += _T("Ditto\\");
  459. CreateDirectory(csPath, NULL);
  460. }
  461. return csPath;
  462. }
  463. long CGetSetOptions::GetResolutionProfileLong(CString csName, long lDefaultValue, CString csNewPath)
  464. {
  465. CString resName;
  466. resName.Format(_T("(%dx%d)_%s"), GetScreenWidth(), GetScreenHeight(), csName);
  467. long value = GetProfileLong(resName, INT_MIN, csNewPath);
  468. if(value == INT_MIN)
  469. {
  470. value = GetProfileLong(csName, lDefaultValue, csNewPath);
  471. }
  472. return value;
  473. }
  474. BOOL CGetSetOptions::SetResolutionProfileLong(CString csName, long lValue)
  475. {
  476. CString resName;
  477. resName.Format(_T("(%dx%d)_%s"), GetScreenWidth(), GetScreenHeight(), csName);
  478. return SetProfileLong(resName, lValue);
  479. }
  480. long CGetSetOptions::GetProfileLong(CString csName, long lDefaultValue, CString csNewPath)
  481. {
  482. if(m_bFromIni && !m_bInConversion)
  483. {
  484. CString csApp(_T("Ditto"));
  485. if(csNewPath.IsEmpty() == FALSE)
  486. {
  487. csApp = csNewPath;
  488. }
  489. return GetPrivateProfileInt(csApp, csName, lDefaultValue, m_csIniFileName);
  490. }
  491. CString csPath(_T(REG_PATH));
  492. if(csNewPath.IsEmpty() == FALSE)
  493. {
  494. csPath += "\\" + csNewPath;
  495. }
  496. HKEY hkKey;
  497. long lResult = RegOpenKeyEx(HKEY_CURRENT_USER, csPath, NULL, KEY_READ, &hkKey);
  498. if(lResult != ERROR_SUCCESS)
  499. return lDefaultValue;
  500. DWORD buffer;
  501. DWORD len = sizeof(buffer);
  502. DWORD type;
  503. lResult = ::RegQueryValueEx(hkKey, csName, 0, &type, (LPBYTE)&buffer, &len);
  504. RegCloseKey(hkKey);
  505. if(lResult == ERROR_SUCCESS)
  506. return (long)buffer;
  507. return lDefaultValue;
  508. }
  509. CString CGetSetOptions::GetProfileString(CString csName, CString csDefault, CString csNewPath, int maxSize)
  510. {
  511. CString returnString;
  512. DWORD dwBufLen = 0;
  513. if(m_bFromIni && !m_bInConversion)
  514. {
  515. CString csApp(_T("Ditto"));
  516. if(csNewPath.IsEmpty() == FALSE)
  517. {
  518. csApp = csNewPath;
  519. }
  520. bool doBreak = false;
  521. dwBufLen = 10000;
  522. bool setMaxSize = false;
  523. while (true)
  524. {
  525. if (maxSize > -1 && maxSize < dwBufLen)
  526. {
  527. dwBufLen = maxSize;
  528. setMaxSize = true;
  529. }
  530. TCHAR *szString = new TCHAR[dwBufLen];
  531. ZeroMemory(szString, dwBufLen);
  532. DWORD readLength = GetPrivateProfileString(csApp, csName, csDefault, szString, dwBufLen, m_csIniFileName);
  533. if (setMaxSize ||
  534. readLength < (dwBufLen - 1))
  535. {
  536. returnString = szString;
  537. doBreak = true; //delay break so we can delete the string
  538. }
  539. delete[] szString;
  540. dwBufLen = dwBufLen * 2;
  541. if (doBreak)
  542. {
  543. break;
  544. }
  545. }
  546. return returnString;
  547. }
  548. CString csPath(_T(REG_PATH));
  549. if(csNewPath.IsEmpty() == FALSE)
  550. {
  551. csPath += "\\" + csNewPath;
  552. }
  553. HKEY hkKey;
  554. long lResult = RegOpenKeyEx(HKEY_CURRENT_USER, csPath, NULL, KEY_READ, &hkKey);
  555. if (lResult == ERROR_SUCCESS)
  556. {
  557. lResult = ::RegQueryValueEx(hkKey, csName, NULL, NULL, NULL, &dwBufLen);
  558. if (lResult == ERROR_SUCCESS &&
  559. dwBufLen > 0)
  560. {
  561. if (maxSize > -1 && maxSize < dwBufLen)
  562. {
  563. dwBufLen = maxSize;
  564. }
  565. dwBufLen++;
  566. TCHAR *szString = new TCHAR[dwBufLen];
  567. ZeroMemory(szString, dwBufLen);
  568. lResult = ::RegQueryValueEx(hkKey, csName, NULL, NULL, (LPBYTE)szString, &dwBufLen);
  569. returnString = szString;
  570. delete[] szString;
  571. }
  572. RegCloseKey(hkKey);
  573. }
  574. if(lResult != ERROR_SUCCESS)
  575. return csDefault;
  576. return returnString;
  577. }
  578. BOOL CGetSetOptions::SetProfileLong(CString csName, long lValue)
  579. {
  580. if(m_bFromIni)
  581. {
  582. return WritePrivateProfileInt(_T("Ditto"), csName, lValue, m_csIniFileName);
  583. }
  584. HKEY hkKey;
  585. DWORD dWord;
  586. long lResult = RegCreateKeyEx(HKEY_CURRENT_USER, _T(REG_PATH), NULL,
  587. NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS,
  588. NULL, &hkKey, &dWord);
  589. if(lResult != ERROR_SUCCESS)
  590. return FALSE;
  591. DWORD val = (DWORD)lValue;
  592. lResult = ::RegSetValueEx(hkKey, csName, 0, REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
  593. RegCloseKey(hkKey);
  594. return lResult == ERROR_SUCCESS;
  595. }
  596. BOOL CGetSetOptions::SetProfileString(CString csName, CString csValue)
  597. {
  598. if(m_bFromIni)
  599. {
  600. return WritePrivateProfileString(_T("Ditto"), csName, csValue, m_csIniFileName);
  601. }
  602. HKEY hkKey;
  603. DWORD dWord;
  604. long lResult = RegCreateKeyEx(HKEY_CURRENT_USER, _T(REG_PATH), NULL,
  605. NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS,
  606. NULL, &hkKey, &dWord);
  607. if(lResult != ERROR_SUCCESS)
  608. return FALSE;
  609. ::RegSetValueEx(hkKey, csName, NULL, REG_SZ,
  610. (BYTE*)(LPCTSTR)csValue, csValue.GetLength()*sizeof(TCHAR));
  611. RegCloseKey(hkKey);
  612. return lResult == ERROR_SUCCESS;
  613. }
  614. BOOL CGetSetOptions::SetProfileData(CString csName, LPVOID lpData, DWORD dwLength)
  615. {
  616. if(m_bFromIni)
  617. {
  618. ASSERT(!"SetProfileData not supported in .ini settings");
  619. return FALSE;
  620. }
  621. HKEY hkKey;
  622. DWORD dWord;
  623. long lResult = RegCreateKeyEx(HKEY_CURRENT_USER, _T(REG_PATH), NULL,
  624. NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS,
  625. NULL, &hkKey, &dWord);
  626. if(lResult != ERROR_SUCCESS)
  627. return FALSE;
  628. ::RegSetValueEx(hkKey, csName, NULL, REG_BINARY,
  629. (BYTE*)lpData, dwLength);
  630. RegCloseKey(hkKey);
  631. return lResult == ERROR_SUCCESS;
  632. }
  633. BOOL CGetSetOptions::GetProfileFont(CString csSection, LOGFONT &font)
  634. {
  635. font.lfHeight = GetPrivateProfileInt(csSection, _T("Height"), 0, m_csIniFileName);
  636. font.lfWidth = GetPrivateProfileInt(csSection, _T("Width"), 0, m_csIniFileName);
  637. font.lfEscapement = GetPrivateProfileInt(csSection, _T("Escapement"), 0, m_csIniFileName);
  638. font.lfOrientation = GetPrivateProfileInt(csSection, _T("Orientation"), 0, m_csIniFileName);
  639. font.lfWeight = GetPrivateProfileInt(csSection, _T("Weight"), 0, m_csIniFileName);
  640. font.lfItalic = GetPrivateProfileInt(csSection, _T("Italic"), 0, m_csIniFileName);
  641. font.lfUnderline = GetPrivateProfileInt(csSection, _T("Underline"), 0, m_csIniFileName);
  642. font.lfStrikeOut = GetPrivateProfileInt(csSection, _T("StrikeOut"), 0, m_csIniFileName);
  643. font.lfCharSet = GetPrivateProfileInt(csSection, _T("CharSet"), 0, m_csIniFileName);
  644. font.lfOutPrecision = GetPrivateProfileInt(csSection, _T("OutPrecision"), 0, m_csIniFileName);
  645. font.lfClipPrecision = GetPrivateProfileInt(csSection, _T("ClipPrecision"), 0, m_csIniFileName);
  646. font.lfQuality = GetPrivateProfileInt(csSection, _T("Quality"), 0, m_csIniFileName);
  647. font.lfPitchAndFamily = GetPrivateProfileInt(csSection, _T("PitchAndFamily"), 0, m_csIniFileName);
  648. GetPrivateProfileString(csSection, _T("FaceName"), _T(""), font.lfFaceName, sizeof(font.lfFaceName), m_csIniFileName);
  649. return TRUE;
  650. }
  651. BOOL CGetSetOptions::SetProfileFont(CString csSection, LOGFONT &font)
  652. {
  653. WritePrivateProfileInt(csSection, _T("Height"), font.lfHeight, m_csIniFileName);
  654. WritePrivateProfileInt(csSection, _T("Width"), font.lfWidth, m_csIniFileName);
  655. WritePrivateProfileInt(csSection, _T("Escapement"), font.lfEscapement, m_csIniFileName);
  656. WritePrivateProfileInt(csSection, _T("Orientation"), font.lfOrientation, m_csIniFileName);
  657. WritePrivateProfileInt(csSection, _T("Weight"), font.lfWeight, m_csIniFileName);
  658. WritePrivateProfileInt(csSection, _T("Italic"), font.lfItalic, m_csIniFileName);
  659. WritePrivateProfileInt(csSection, _T("Underline"), font.lfUnderline, m_csIniFileName);
  660. WritePrivateProfileInt(csSection, _T("StrikeOut"), font.lfStrikeOut, m_csIniFileName);
  661. WritePrivateProfileInt(csSection, _T("CharSet"), font.lfCharSet, m_csIniFileName);
  662. WritePrivateProfileInt(csSection, _T("OutPrecision"), font.lfOutPrecision, m_csIniFileName);
  663. WritePrivateProfileInt(csSection, _T("ClipPrecision"), font.lfClipPrecision, m_csIniFileName);
  664. WritePrivateProfileInt(csSection, _T("Quality"), font.lfQuality, m_csIniFileName);
  665. WritePrivateProfileInt(csSection, _T("PitchAndFamily"), font.lfPitchAndFamily, m_csIniFileName);
  666. WritePrivateProfileString(csSection, _T("FaceName"), font.lfFaceName, m_csIniFileName);
  667. return TRUE;
  668. }
  669. LPVOID CGetSetOptions::GetProfileData(CString csName, DWORD &dwLength)
  670. {
  671. if(m_bFromIni && !m_bInConversion)
  672. {
  673. ASSERT(!"GetProfileData not supported in .ini settings");
  674. return NULL;
  675. }
  676. HKEY hkKey;
  677. long lResult = RegOpenKeyEx(HKEY_CURRENT_USER, _T(REG_PATH),
  678. NULL, KEY_READ, &hkKey);
  679. lResult = ::RegQueryValueEx(hkKey , csName, NULL, NULL, NULL, &dwLength);
  680. if(lResult != ERROR_SUCCESS)
  681. return NULL;
  682. LPVOID lpVoid = new BYTE[dwLength];
  683. lResult = ::RegQueryValueEx(hkKey , csName, NULL, NULL, (LPBYTE)lpVoid, &dwLength);
  684. RegCloseKey(hkKey);
  685. if(lResult != ERROR_SUCCESS)
  686. return NULL;
  687. return lpVoid;
  688. }
  689. BOOL CGetSetOptions::GetShowIconInSysTray()
  690. {
  691. return GetProfileLong("ShowIconInSystemTray", TRUE);
  692. }
  693. BOOL CGetSetOptions::SetShowIconInSysTray(BOOL bShow)
  694. {
  695. return SetProfileLong("ShowIconInSystemTray", bShow);
  696. }
  697. BOOL CGetSetOptions::SetEnableTransparency(BOOL bCheck)
  698. {
  699. return SetProfileLong("EnableTransparency", bCheck);
  700. }
  701. BOOL CGetSetOptions::GetEnableTransparency()
  702. {
  703. return GetProfileLong("EnableTransparency", FALSE);
  704. }
  705. BOOL CGetSetOptions::SetTransparencyPercent(long lPercent)
  706. {
  707. if(lPercent > OPACITY_MAX)
  708. lPercent = OPACITY_MAX;
  709. if(lPercent < 0)
  710. lPercent = 0;
  711. return SetProfileLong("TransparencyPercent", lPercent);
  712. }
  713. long CGetSetOptions::GetTransparencyPercent()
  714. {
  715. long lValue = GetProfileLong("TransparencyPercent", 14);
  716. if(lValue > OPACITY_MAX) lValue = OPACITY_MAX;
  717. if(lValue < 0) lValue = 0;
  718. return lValue;
  719. }
  720. BOOL CGetSetOptions::SetLinesPerRow(long lLines)
  721. {
  722. m_nLinesPerRow = lLines;
  723. return SetProfileLong("LinesPerRow", lLines);
  724. }
  725. long CGetSetOptions::GetLinesPerRow()
  726. {
  727. return GetProfileLong("LinesPerRow", 2);
  728. }
  729. BOOL CGetSetOptions::GetRunOnStartUp()
  730. {
  731. HKEY hkRun;
  732. LONG nResult = RegOpenKeyEx(HKEY_CURRENT_USER,
  733. _T("Software\\Microsoft\\Windows\\CurrentVersion\\Run"),
  734. NULL, KEY_READ, &hkRun);
  735. if(nResult != ERROR_SUCCESS)
  736. return FALSE;
  737. nResult = RegQueryValueEx(hkRun, GetAppName(), NULL, NULL, NULL, NULL);
  738. RegCloseKey(hkRun);
  739. return nResult == ERROR_SUCCESS;
  740. }
  741. void CGetSetOptions::SetRunOnStartUp(BOOL bRun)
  742. {
  743. HKEY hkRun;
  744. LONG nResult = RegOpenKeyEx(HKEY_CURRENT_USER,
  745. _T("Software\\Microsoft\\Windows\\CurrentVersion\\Run"),
  746. NULL, KEY_ALL_ACCESS, &hkRun);
  747. if(nResult != ERROR_SUCCESS)
  748. return;
  749. if(bRun)
  750. {
  751. CString sExeName = GetExeFileName();
  752. ::RegSetValueEx(hkRun, GetAppName(), NULL, REG_SZ,
  753. (BYTE*)(LPCTSTR)sExeName, sExeName.GetLength()*sizeof(TCHAR));
  754. }
  755. else
  756. {
  757. ::RegDeleteValue(hkRun, GetAppName());
  758. }
  759. ::RegCloseKey(hkRun);
  760. }
  761. CString CGetSetOptions::GetExeFileName()
  762. {
  763. CString sExeName;
  764. GetModuleFileName(NULL, sExeName.GetBuffer(_MAX_PATH),_MAX_PATH);
  765. sExeName.ReleaseBuffer();
  766. return sExeName;
  767. }
  768. CString CGetSetOptions::GetAppName()
  769. {
  770. return "Ditto";
  771. }
  772. BOOL CGetSetOptions::SetQuickPastePosition(long lPosition)
  773. {
  774. return SetProfileLong("ShowQuickPastePosition", lPosition);
  775. }
  776. long CGetSetOptions::GetQuickPastePosition()
  777. {
  778. return GetProfileLong("ShowQuickPastePosition", POS_AT_CARET);
  779. }
  780. BOOL CGetSetOptions::SetQuickPasteSize(CSize size)
  781. {
  782. BOOL bRet = SetResolutionProfileLong("QuickPasteCX", size.cx);
  783. bRet = SetResolutionProfileLong("QuickPasteCY", size.cy);
  784. return bRet;
  785. }
  786. void CGetSetOptions::GetQuickPasteSize(CSize &size)
  787. {
  788. size.cx = GetResolutionProfileLong("QuickPasteCX", 300);
  789. size.cy = GetResolutionProfileLong("QuickPasteCY", 300);
  790. if(size.cx <= 0 && size.cy <= 0)
  791. {
  792. size.cx = 300;
  793. size.cy = 300;
  794. }
  795. }
  796. BOOL CGetSetOptions::SetQuickPastePoint(CPoint point)
  797. {
  798. BOOL bRet = SetResolutionProfileLong("QuickPasteX", point.x);
  799. bRet = SetResolutionProfileLong("QuickPasteY", point.y);
  800. return bRet;
  801. }
  802. void CGetSetOptions::GetQuickPastePoint(CPoint &point)
  803. {
  804. point.x = GetResolutionProfileLong("QuickPasteX", 300);
  805. point.y = GetResolutionProfileLong("QuickPasteY", 300);
  806. }
  807. long CGetSetOptions::GetCopyGap()
  808. {
  809. return GetProfileLong("CopyGap", 150);
  810. }
  811. void CGetSetOptions::SetCopyGap(long lGap)
  812. {
  813. SetProfileLong("CopyGap", lGap);
  814. }
  815. BOOL CGetSetOptions::SetDBPathOld(CString csPath)
  816. {
  817. return SetProfileString("DBPath", csPath);
  818. }
  819. CString CGetSetOptions::GetDBPathOld()
  820. {
  821. return GetProfileString("DBPath", "");
  822. }
  823. BOOL CGetSetOptions::SetDBPath(CString csPath)
  824. {
  825. return SetProfileString("DBPath3", csPath);
  826. }
  827. CString CGetSetOptions::ResolvePath(CString path)
  828. {
  829. CString dest;
  830. int newSize = max(path.GetLength() * 10, 1000);
  831. //path = _T("some string %COMPUTERNAME% test");
  832. ExpandEnvironmentStrings(path, dest.GetBuffer(newSize), newSize);
  833. dest.ReleaseBuffer();
  834. return dest;
  835. }
  836. CString CGetSetOptions::GetDBPath(bool resolvePath)
  837. {
  838. CString csDBPath;
  839. csDBPath = GetProfileString("DBPath3", "");
  840. if (resolvePath)
  841. {
  842. csDBPath = ResolvePath(csDBPath);
  843. }
  844. return csDBPath;
  845. }
  846. void CGetSetOptions::SetCheckForMaxEntries(BOOL bVal)
  847. {
  848. SetProfileLong("CheckForMaxEntries", bVal);
  849. }
  850. BOOL CGetSetOptions::GetCheckForMaxEntries()
  851. {
  852. BOOL bDefault = FALSE;
  853. if(GetIsPortableDitto())
  854. bDefault = TRUE;
  855. return GetProfileLong("CheckForMaxEntries", bDefault);
  856. }
  857. void CGetSetOptions::SetCheckForExpiredEntries(BOOL bVal)
  858. {
  859. SetProfileLong("CheckForExpiredEntries", bVal);
  860. }
  861. BOOL CGetSetOptions::GetCheckForExpiredEntries()
  862. {
  863. return GetProfileLong("CheckForExpiredEntries", FALSE);
  864. }
  865. void CGetSetOptions::SetMaxEntries(long lVal)
  866. {
  867. SetProfileLong("MaxEntries", lVal);
  868. }
  869. long CGetSetOptions::GetMaxEntries()
  870. {
  871. long lMax = 500;
  872. if(GetIsPortableDitto())
  873. lMax = 100;
  874. return GetProfileLong("MaxEntries", lMax);
  875. }
  876. void CGetSetOptions::SetExpiredEntries(long lVal)
  877. {
  878. SetProfileLong("ExpiredEntries", lVal);
  879. }
  880. long CGetSetOptions::GetExpiredEntries()
  881. {
  882. return GetProfileLong("ExpiredEntries", 5);
  883. }
  884. void CGetSetOptions::SetTripCopyCount(long lVal)
  885. {
  886. // negative means a relative offset
  887. if(lVal < 0)
  888. lVal = GetTripCopyCount() - lVal; // add the absolute value
  889. if(GetTripDate() == 0)
  890. SetTripDate(-1);
  891. SetProfileLong("TripCopies", lVal);
  892. }
  893. long CGetSetOptions::GetTripCopyCount()
  894. {
  895. return GetProfileLong("TripCopies", 0);
  896. }
  897. void CGetSetOptions::SetTripPasteCount(long lVal)
  898. {
  899. // negative means a relative offset
  900. if(lVal < 0)
  901. lVal = GetTripPasteCount() - lVal; // add the absolute value
  902. if(GetTripDate() == 0)
  903. SetTripDate(-1);
  904. SetProfileLong("TripPastes", lVal);
  905. }
  906. long CGetSetOptions::GetTripPasteCount()
  907. {
  908. return GetProfileLong("TripPastes", 0);
  909. }
  910. void CGetSetOptions::SetTripDate(long lDate)
  911. {
  912. if(lDate == -1)
  913. lDate = (long)CTime::GetCurrentTime().GetTime();
  914. SetProfileLong("TripDate", lDate);
  915. }
  916. long CGetSetOptions::GetTripDate()
  917. {
  918. return GetProfileLong("TripDate", 0);
  919. }
  920. void CGetSetOptions::SetTotalCopyCount(long lVal)
  921. {
  922. // negative means a relative offset
  923. if(lVal < 0)
  924. lVal = GetTotalCopyCount() - lVal; // add the absolute value
  925. if(GetTotalDate() == 0)
  926. SetTotalDate(-1);
  927. SetProfileLong("TotalCopies", lVal);
  928. }
  929. long CGetSetOptions::GetTotalCopyCount()
  930. {
  931. return GetProfileLong("TotalCopies", 0);
  932. }
  933. void CGetSetOptions::SetTotalPasteCount(long lVal)
  934. {
  935. // negative means a relative offset
  936. if(lVal < 0)
  937. lVal = GetTotalPasteCount() - lVal; // add the absolute value
  938. if(GetTotalDate() == 0)
  939. SetTotalDate(-1);
  940. SetProfileLong("TotalPastes", lVal);
  941. }
  942. long CGetSetOptions::GetTotalPasteCount()
  943. {
  944. return GetProfileLong("TotalPastes", 0);
  945. }
  946. void CGetSetOptions::SetTotalDate(long lDate)
  947. {
  948. if(lDate == -1)
  949. lDate = (long)CTime::GetCurrentTime().GetTime();
  950. SetProfileLong("TotalDate", lDate);
  951. }
  952. long CGetSetOptions::GetTotalDate()
  953. {
  954. return GetProfileLong("TotalDate", 0);
  955. }
  956. CString CGetSetOptions::GetUpdateFilePath()
  957. {
  958. return GetProfileString("UpdateFilePath", "");
  959. }
  960. BOOL CGetSetOptions::SetUpdateFilePath(CString cs)
  961. {
  962. return SetProfileString("UpdateFilePath", cs);
  963. }
  964. CString CGetSetOptions::GetUpdateInstallPath()
  965. {
  966. return GetProfileString("UpdateInstallPath", "");
  967. }
  968. BOOL CGetSetOptions::SetUpdateInstallPath(CString cs)
  969. {
  970. return SetProfileString("UpdateInstallPath", cs);
  971. }
  972. long CGetSetOptions::GetLastUpdate()
  973. {
  974. return GetProfileLong("LastUpdateDay", 0);
  975. }
  976. long CGetSetOptions::SetLastUpdate(long lValue)
  977. {
  978. return SetProfileLong("LastUpdateDay", lValue);
  979. }
  980. BOOL CGetSetOptions::GetCheckForUpdates()
  981. {
  982. return GetProfileLong("CheckForUpdates", TRUE);
  983. }
  984. BOOL CGetSetOptions::SetCheckForUpdates(BOOL bCheck)
  985. {
  986. return SetProfileLong("CheckForUpdates", bCheck);
  987. }
  988. void CGetSetOptions::SetUseCtrlNumForFirstTenHotKeys(BOOL bVal)
  989. {
  990. SetProfileLong("UseCtrlNumForFirstTenHotKeys", bVal);
  991. m_bUseCtrlNumAccel = bVal;
  992. }
  993. BOOL CGetSetOptions::GetUseCtrlNumForFirstTenHotKeys()
  994. {
  995. return GetProfileLong("UseCtrlNumForFirstTenHotKeys", 0);
  996. }
  997. void CGetSetOptions::SetAllowDuplicates(BOOL bVal)
  998. {
  999. SetProfileLong("AllowDuplicates", bVal);
  1000. m_bAllowDuplicates = bVal;
  1001. }
  1002. BOOL CGetSetOptions::GetAllowDuplicates()
  1003. {
  1004. return GetProfileLong("AllowDuplicates", 0);
  1005. }
  1006. void CGetSetOptions::SetUpdateTimeOnPaste(BOOL bVal)
  1007. {
  1008. SetProfileLong("UpdateTimeOnPaste", bVal);
  1009. m_bUpdateTimeOnPaste = bVal;
  1010. }
  1011. BOOL CGetSetOptions::GetUpdateTimeOnPaste()
  1012. {
  1013. return GetProfileLong("UpdateTimeOnPaste", TRUE);
  1014. }
  1015. void CGetSetOptions::SetSaveMultiPaste(BOOL bVal)
  1016. {
  1017. SetProfileLong("SaveMultiPaste", bVal);
  1018. m_bSaveMultiPaste = bVal;
  1019. }
  1020. BOOL CGetSetOptions::GetSaveMultiPaste()
  1021. {
  1022. return GetProfileLong("SaveMultiPaste", 0);
  1023. }
  1024. void CGetSetOptions::SetShowPersistent(BOOL bVal)
  1025. {
  1026. SetProfileLong("ShowPersistent", bVal);
  1027. m_bShowPersistent = bVal;
  1028. }
  1029. BOOL CGetSetOptions::GetShowPersistent()
  1030. {
  1031. return GetProfileLong("ShowPersistent", 0);
  1032. }
  1033. void CGetSetOptions::SetShowTextForFirstTenHotKeys(BOOL bVal)
  1034. {
  1035. SetProfileLong("ShowTextForFirstTenHotKeys", bVal);
  1036. }
  1037. BOOL CGetSetOptions::GetShowTextForFirstTenHotKeys()
  1038. {
  1039. return GetProfileLong("ShowTextForFirstTenHotKeys", TRUE);
  1040. }
  1041. void CGetSetOptions::SetMainHWND(long lhWnd)
  1042. {
  1043. SetProfileLong("MainhWnd", lhWnd);
  1044. }
  1045. long CGetSetOptions::GetMainHWND()
  1046. {
  1047. return GetProfileLong("MainhWnd", 0);
  1048. }
  1049. void CGetSetOptions::SetCaptionPos(long lPos)
  1050. {
  1051. SetProfileLong("CaptionPos", lPos);
  1052. }
  1053. long CGetSetOptions::GetCaptionPos()
  1054. {
  1055. return GetProfileLong("CaptionPos", CAPTION_RIGHT);
  1056. }
  1057. void CGetSetOptions::SetAutoHide(BOOL bAutoHide)
  1058. {
  1059. SetProfileLong("AutoHide", bAutoHide);
  1060. }
  1061. BOOL CGetSetOptions::GetAutoHide()
  1062. {
  1063. return GetProfileLong("AutoHide", FALSE);
  1064. }
  1065. void CGetSetOptions::SetDescTextSize(long lSize)
  1066. {
  1067. SetProfileLong("DescTextSize", lSize);
  1068. m_bDescTextSize = lSize;
  1069. }
  1070. long CGetSetOptions::GetDescTextSize()
  1071. {
  1072. return GetProfileLong("DescTextSize", 500);
  1073. }
  1074. void CGetSetOptions::SetDescShowLeadingWhiteSpace(BOOL bVal)
  1075. {
  1076. SetProfileLong("DescShowLeadingWhiteSpace", bVal);
  1077. m_bDescShowLeadingWhiteSpace = bVal;
  1078. }
  1079. BOOL CGetSetOptions::GetDescShowLeadingWhiteSpace()
  1080. {
  1081. return GetProfileLong("DescShowLeadingWhiteSpace", FALSE);
  1082. }
  1083. void CGetSetOptions::SetAllwaysShowDescription(long bShow)
  1084. {
  1085. SetProfileLong("AllwaysShowDescription", bShow);
  1086. m_bAllwaysShowDescription = bShow;
  1087. }
  1088. BOOL CGetSetOptions::GetAllwaysShowDescription()
  1089. {
  1090. return GetProfileLong("AllwaysShowDescription", FALSE);
  1091. }
  1092. void CGetSetOptions::SetDoubleClickingOnCaptionDoes(long lOption)
  1093. {
  1094. SetProfileLong("DoubleClickingOnCaptionDoes", lOption);
  1095. m_bDoubleClickingOnCaptionDoes = lOption;
  1096. }
  1097. long CGetSetOptions::GetDoubleClickingOnCaptionDoes()
  1098. {
  1099. return GetProfileLong("DoubleClickingOnCaptionDoes", TOGGLES_ALLWAYS_ON_TOP);
  1100. }
  1101. void CGetSetOptions::SetPrompForNewGroupName(BOOL bOption)
  1102. {
  1103. SetProfileLong("PrompForNewGroupName", bOption);
  1104. m_bPrompForNewGroupName = bOption;
  1105. }
  1106. BOOL CGetSetOptions::GetPrompForNewGroupName()
  1107. {
  1108. return GetProfileLong("PrompForNewGroupName", TRUE);
  1109. }
  1110. void CGetSetOptions::SetSendPasteOnFirstTenHotKeys(BOOL bOption)
  1111. {
  1112. SetProfileLong("SendPasteOnFirstTenHotKeys", bOption);
  1113. m_bSendPasteOnFirstTenHotKeys = bOption;
  1114. }
  1115. BOOL CGetSetOptions::GetSendPasteOnFirstTenHotKeys()
  1116. {
  1117. return GetProfileLong("SendPasteOnFirstTenHotKeys", TRUE);
  1118. }
  1119. void CGetSetOptions::SetSendClients(CSendClients Client, int nPos)
  1120. {
  1121. CString cs;
  1122. cs.Format(_T("sendclient_ip_%d"), nPos);
  1123. SetProfileString(cs, Client.csIP);
  1124. cs.Format(_T("sendclient_autosend_%d"), nPos);
  1125. SetProfileLong(cs, Client.bSendAll);
  1126. cs.Format(_T("sendclient_description_%d"), nPos);
  1127. SetProfileString(cs, Client.csDescription);
  1128. Client.bShownFirstError = m_SendClients[nPos].bShownFirstError;
  1129. m_SendClients[nPos] = Client;
  1130. }
  1131. CSendClients CGetSetOptions::GetSendClients(int nPos)
  1132. {
  1133. CSendClients Client;
  1134. CString cs;
  1135. cs.Format(_T("sendclient_ip_%d"), nPos);
  1136. Client.csIP = GetProfileString(cs, "");
  1137. cs.Format(_T("sendclient_autosend_%d"), nPos);
  1138. Client.bSendAll = GetProfileLong(cs, FALSE);
  1139. cs.Format(_T("sendclient_description_%d"), nPos);
  1140. Client.csDescription = GetProfileString(cs, "");
  1141. m_SendClients[nPos] = Client;
  1142. return Client;
  1143. }
  1144. void CGetSetOptions::GetClientSendCount()
  1145. {
  1146. m_lAutoSendClientCount = 0;
  1147. for(int i = 0; i < MAX_SEND_CLIENTS; i++)
  1148. {
  1149. if(m_SendClients[i].csIP.GetLength() > 0)
  1150. {
  1151. if(m_SendClients[i].bSendAll)
  1152. m_lAutoSendClientCount++;
  1153. }
  1154. }
  1155. }
  1156. CString CGetSetOptions::GetListToPutOnClipboard()
  1157. {
  1158. CString cs = GetProfileString("ListToPutOnClipboard", "");
  1159. cs.MakeUpper();
  1160. return cs;
  1161. }
  1162. BOOL CGetSetOptions::SetListToPutOnClipboard(CString cs)
  1163. {
  1164. cs.MakeUpper();
  1165. m_csIPListToPutOnClipboard = cs;
  1166. return SetProfileString("ListToPutOnClipboard", cs);
  1167. }
  1168. void CGetSetOptions::SetLogSendReceiveErrors(BOOL bOption)
  1169. {
  1170. m_bLogSendReceiveErrors = bOption;
  1171. SetProfileLong("LogSendReceiveErrors", bOption);
  1172. }
  1173. BOOL CGetSetOptions::GetLogSendReceiveErrors()
  1174. {
  1175. return GetProfileLong("LogSendReceiveErrors", FALSE);
  1176. }
  1177. BOOL CGetSetOptions::GetHideDittoOnHotKeyIfAlreadyShown()
  1178. {
  1179. return GetProfileLong("HideDittoOnHotKeyIfAlreadyShown", TRUE);
  1180. }
  1181. void CGetSetOptions::SetHideDittoOnHotKeyIfAlreadyShown(BOOL bVal)
  1182. {
  1183. m_HideDittoOnHotKeyIfAlreadyShown = bVal;
  1184. SetProfileLong("HideDittoOnHotKeyIfAlreadyShown", bVal);
  1185. }
  1186. void CGetSetOptions::SetPort(long lPort)
  1187. {
  1188. m_lPort = lPort;
  1189. SetProfileLong("SendRecvPort", lPort);
  1190. }
  1191. long CGetSetOptions::GetPort()
  1192. {
  1193. return GetProfileLong("SendRecvPort", 23443);
  1194. }
  1195. BOOL CGetSetOptions::GetDisableRecieve()
  1196. {
  1197. BOOL bDefault = FALSE;
  1198. if(GetIsPortableDitto())
  1199. bDefault = TRUE;
  1200. if(GetIsWindowsApp())
  1201. bDefault = TRUE;
  1202. return GetProfileLong("DisableRecieve", bDefault);
  1203. }
  1204. void CGetSetOptions::SetDisableRecieve(BOOL bVal)
  1205. {
  1206. SetProfileLong("DisableRecieve", bVal);
  1207. }
  1208. BOOL CGetSetOptions::GetFont(LOGFONT &font)
  1209. {
  1210. if(m_bFromIni && !m_bInConversion)
  1211. {
  1212. GetProfileFont("DisplayFont6", font);
  1213. //Return true if there is a font name
  1214. //other wise load the default font below
  1215. if(font.lfFaceName[0] != 0)
  1216. {
  1217. return TRUE;
  1218. }
  1219. }
  1220. else
  1221. {
  1222. DWORD dwLength = 0;
  1223. LPVOID lpVoid = GetProfileData("DisplayFont6", dwLength);
  1224. if(lpVoid)
  1225. {
  1226. if(sizeof(font) == dwLength)
  1227. {
  1228. memcpy(&font, lpVoid, dwLength);
  1229. delete[] lpVoid;
  1230. lpVoid = NULL;
  1231. return TRUE;
  1232. }
  1233. else
  1234. {
  1235. ASSERT(!"invalid font struct size");
  1236. }
  1237. delete[] lpVoid;
  1238. lpVoid = NULL;
  1239. }
  1240. }
  1241. ZeroMemory(&font, sizeof(font));
  1242. font.lfHeight = -13;
  1243. font.lfWeight = 400;
  1244. font.lfCharSet = 1;
  1245. STRCPY(font.lfFaceName, _T("Segoe UI"));
  1246. return TRUE;
  1247. }
  1248. void CGetSetOptions::SetFont(LOGFONT &font)
  1249. {
  1250. if(m_bFromIni)
  1251. {
  1252. SetProfileFont("DisplayFont6", font);
  1253. }
  1254. else
  1255. {
  1256. SetProfileData("DisplayFont6", &font, sizeof(LOGFONT));
  1257. }
  1258. }
  1259. void CGetSetOptions::SetDrawThumbnail(long bDraw)
  1260. {
  1261. SetProfileLong("DrawThumbnail", bDraw);
  1262. m_bDrawThumbnail = bDraw;
  1263. }
  1264. BOOL CGetSetOptions::GetDrawThumbnail()
  1265. {
  1266. BOOL bDrawThumbnails = TRUE;
  1267. return GetProfileLong("DrawThumbnail", bDrawThumbnails);
  1268. }
  1269. void CGetSetOptions::SetFastThumbnailMode(BOOL thumbnailDrawMode)
  1270. {
  1271. SetProfileLong("FastThumbnailMode", thumbnailDrawMode);
  1272. m_bFastThumbnailMode = thumbnailDrawMode;
  1273. }
  1274. BOOL CGetSetOptions::GetFastThumbnailMode()
  1275. {
  1276. return GetProfileLong("FastThumbnailMode", TRUE);
  1277. }
  1278. void CGetSetOptions::SetExtraNetworkPassword(CString csPassword)
  1279. {
  1280. SetProfileString("NetworkExtraPassword", csPassword);
  1281. }
  1282. CString CGetSetOptions::GetExtraNetworkPassword(bool bFillArray)
  1283. {
  1284. CString cs = GetProfileString("NetworkExtraPassword", "");
  1285. if(bFillArray)
  1286. {
  1287. m_csNetworkPasswordArray.RemoveAll();
  1288. TCHAR seps[] = _T(",");
  1289. TCHAR *token;
  1290. TCHAR *pString = cs.GetBuffer(cs.GetLength());
  1291. /* Establish string and get the first token: */
  1292. token = STRTOK(pString, seps);
  1293. while(token != NULL)
  1294. {
  1295. CString cs(token);
  1296. cs.TrimLeft();
  1297. cs.TrimRight();
  1298. m_csNetworkPasswordArray.Add(cs);
  1299. // Get next token
  1300. token = STRTOK(NULL, seps);
  1301. }
  1302. cs.ReleaseBuffer();
  1303. }
  1304. return cs;
  1305. }
  1306. void CGetSetOptions::SetNetworkPassword(CString csPassword)
  1307. {
  1308. m_csPassword = CTextConvert::UnicodeToUTF8(csPassword);
  1309. SetProfileString("NetworkStringPassword", csPassword);
  1310. }
  1311. CStringA CGetSetOptions::GetNetworkPassword()
  1312. {
  1313. CString cs = GetProfileString("NetworkStringPassword", "LetMeIn");
  1314. CStringA csReturn = CTextConvert::UnicodeToUTF8(cs);
  1315. return csReturn;
  1316. }
  1317. void CGetSetOptions::SetDrawRTF(long bDraw)
  1318. {
  1319. SetProfileLong("DrawRTF", bDraw);
  1320. m_bDrawRTF = bDraw;
  1321. }
  1322. BOOL CGetSetOptions::GetDrawRTF()
  1323. {
  1324. return GetProfileLong("DrawRTF", FALSE);
  1325. }
  1326. void CGetSetOptions::SetMultiPasteReverse(BOOL bVal)
  1327. {
  1328. SetProfileLong("MultiPasteReverse", bVal);
  1329. m_bMultiPasteReverse = bVal;
  1330. }
  1331. BOOL CGetSetOptions::GetMultiPasteReverse()
  1332. {
  1333. return GetProfileLong("MultiPasteReverse", TRUE);
  1334. }
  1335. void CGetSetOptions::SetPlaySoundOnCopy(CString cs)
  1336. {
  1337. m_csPlaySoundOnCopy = cs;
  1338. SetProfileString("PlaySoundOnCopy", cs);
  1339. }
  1340. CString CGetSetOptions::GetPlaySoundOnCopy()
  1341. {
  1342. return GetProfileString("PlaySoundOnCopy", "");
  1343. }
  1344. void CGetSetOptions::SetSendPasteAfterSelection(BOOL bVal)
  1345. {
  1346. m_bSendPasteMessageAfterSelection = bVal;
  1347. SetProfileLong("SendPasteMessageAfterSelection", bVal);
  1348. }
  1349. BOOL CGetSetOptions::GetSendPasteAfterSelection()
  1350. {
  1351. return GetProfileLong("SendPasteMessageAfterSelection", TRUE);
  1352. }
  1353. void CGetSetOptions::SetFindAsYouType(BOOL bVal)
  1354. {
  1355. m_bFindAsYouType = bVal;
  1356. SetProfileLong("FindAsYouType", bVal);
  1357. }
  1358. BOOL CGetSetOptions::GetFindAsYouType()
  1359. {
  1360. return GetProfileLong("FindAsYouType", TRUE);
  1361. }
  1362. void CGetSetOptions::SetEnsureEntireWindowCanBeSeen(BOOL bVal)
  1363. {
  1364. m_bEnsureEntireWindowCanBeSeen = bVal;
  1365. SetProfileLong("EnsureEntireWindowCanBeSeen", bVal);
  1366. }
  1367. BOOL CGetSetOptions::GetEnsureEntireWindowCanBeSeen()
  1368. {
  1369. return GetProfileLong("EnsureEntireWindowCanBeSeen", TRUE);
  1370. }
  1371. void CGetSetOptions::SetShowAllClipsInMainList(BOOL bVal)
  1372. {
  1373. m_bShowAllClipsInMainList = bVal;
  1374. SetProfileLong("ShowAllClipsInMainList", bVal);
  1375. }
  1376. BOOL CGetSetOptions::GetShowAllClipsInMainList()
  1377. {
  1378. return GetProfileLong("ShowAllClipsInMainList", TRUE);
  1379. }
  1380. long CGetSetOptions::GetMaxClipSizeInBytes()
  1381. {
  1382. return GetProfileLong("MaxClipSizeInBytes", 0);
  1383. }
  1384. void CGetSetOptions::SetMaxClipSizeInBytes(long lSize)
  1385. {
  1386. m_lMaxClipSizeInBytes = lSize;
  1387. SetProfileLong("MaxClipSizeInBytes", lSize);
  1388. }
  1389. CString CGetSetOptions::GetLanguageFile()
  1390. {
  1391. return GetProfileString("LanguageFile", "");
  1392. }
  1393. void CGetSetOptions::SetLanguageFile(CString csLanguage)
  1394. {
  1395. SetProfileString("LanguageFile", csLanguage);
  1396. }
  1397. ULONG CGetSetOptions::GetSaveClipDelay()
  1398. {
  1399. return (ULONG)GetProfileLong("SaveClipDelay", 500);
  1400. }
  1401. void CGetSetOptions::SetSaveClipDelay(DWORD dwDelay)
  1402. {
  1403. m_dwSaveClipDelay = dwDelay;
  1404. SetProfileLong("SaveClipDelay", dwDelay);
  1405. }
  1406. long CGetSetOptions::GetProcessDrawClipboardDelay()
  1407. {
  1408. return GetProfileLong("ProcessDrawClipboardDelay", 100);
  1409. }
  1410. void CGetSetOptions::SetProcessDrawClipboardDelay(long lDelay)
  1411. {
  1412. m_lProcessDrawClipboardDelay = lDelay;
  1413. SetProfileLong("ProcessDrawClipboardDelay", lDelay);
  1414. }
  1415. BOOL CGetSetOptions::GetEnableDebugLogging()
  1416. {
  1417. return GetProfileLong("EnableDebugLogging", FALSE);
  1418. }
  1419. void CGetSetOptions::SetEnableDebugLogging(BOOL bEnable)
  1420. {
  1421. m_bEnableDebugLogging = bEnable;
  1422. SetProfileLong("EnableDebugLogging", bEnable);
  1423. }
  1424. BOOL CGetSetOptions::GetEnableOutputDebugStringLogging()
  1425. {
  1426. return GetProfileLong("EnableOutputDebugStringLogging", FALSE);
  1427. }
  1428. void CGetSetOptions::SetEnableOutputDebugStringLogging(BOOL bEnable)
  1429. {
  1430. m_outputDebugStringLogging = bEnable;
  1431. SetProfileLong("EnableOutputDebugStringLogging", bEnable);
  1432. }
  1433. BOOL CGetSetOptions::GetEnsureConnectToClipboard()
  1434. {
  1435. return GetProfileLong("EnsureConnected2", FALSE);
  1436. }
  1437. void CGetSetOptions::SetEnsureConnectToClipboard(BOOL bSet)
  1438. {
  1439. m_bEnsureConnectToClipboard = bSet;
  1440. SetProfileLong("EnsureConnected2", bSet);
  1441. }
  1442. BOOL CGetSetOptions::GetPromptWhenDeletingClips()
  1443. {
  1444. return GetProfileLong("PromptWhenDeletingClips", TRUE);
  1445. }
  1446. void CGetSetOptions::SetPromptWhenDeletingClips(BOOL bSet)
  1447. {
  1448. SetProfileLong("PromptWhenDeletingClips", bSet);
  1449. }
  1450. CString CGetSetOptions::GetLastImportDir()
  1451. {
  1452. return GetProfileString("LastImportDir", "");
  1453. }
  1454. void CGetSetOptions::SetLastImportDir(CString csDir)
  1455. {
  1456. SetProfileString("LastImportDir", csDir);
  1457. }
  1458. CString CGetSetOptions::GetLastExportDir()
  1459. {
  1460. return GetProfileString("LastExportDir", "");
  1461. }
  1462. void CGetSetOptions::SetLastExportDir(CString csDir)
  1463. {
  1464. SetProfileString("LastExportDir", csDir);
  1465. }
  1466. BOOL CGetSetOptions::GetUpdateDescWhenSavingClip()
  1467. {
  1468. return GetProfileLong("UpdateDescWhenSaving", TRUE);
  1469. }
  1470. void CGetSetOptions::SetUpdateDescWhenSavingClip(BOOL bSet)
  1471. {
  1472. SetProfileLong("UpdateDescWhenSaving", bSet);
  1473. }
  1474. CString CGetSetOptions::GetPath(long lPathID)
  1475. {
  1476. CString csDir = CGetSetOptions::GetExeFileName();
  1477. csDir = GetFilePath(csDir);
  1478. FIX_CSTRING_PATH(csDir);
  1479. //U3_APP_DATA_PATH - <U3_DEVICE_PATH>\System\Apps\{app_unique_id}\Data
  1480. //U3_HOST_EXEC_PATH - %APPDATA%\U3\{device_serial_number}\{app_unique_id}\Exec
  1481. //U3_DEVICE_EXEC_PATH - <U3_DEVICE_PATH>\System\Apps\{app_unique_id}\Exec
  1482. switch(lPathID)
  1483. {
  1484. case PATH_HELP:
  1485. csDir += "Help\\";
  1486. break;
  1487. case PATH_LANGUAGE:
  1488. csDir += "language\\";
  1489. break;
  1490. case PATH_THEMES:
  1491. csDir += "Themes\\";
  1492. break;
  1493. case PATH_LOG_FILE:if(CGetSetOptions::GetIsPortableDitto() == false)
  1494. csDir = GetAppDataPath();
  1495. break;
  1496. case PATH_ADDINS:
  1497. csDir += "Addins\\";
  1498. break;
  1499. case PATH_REMOTE_FILES:
  1500. if (CGetSetOptions::GetIsPortableDitto() == false)
  1501. {
  1502. csDir = GetTempFilePath();
  1503. }
  1504. csDir += "ReceivedFiles\\";
  1505. break;
  1506. case PATH_DRAG_FILES:
  1507. if (CGetSetOptions::GetIsPortableDitto() == false)
  1508. {
  1509. csDir = GetTempFilePath();
  1510. }
  1511. csDir += "DragFiles\\";
  1512. break;
  1513. case PATH_CLIP_DIFF:
  1514. if (CGetSetOptions::GetIsPortableDitto() == false)
  1515. {
  1516. csDir = GetTempFilePath();
  1517. }
  1518. csDir += _T("ClipCompare\\");
  1519. break;
  1520. case PATH_RESTORE_TEMP:
  1521. if (CGetSetOptions::GetIsPortableDitto() == false)
  1522. {
  1523. csDir = GetTempFilePath();
  1524. }
  1525. csDir += _T("RestoreDb\\");
  1526. break;
  1527. case PATH_EDIT_CLIPS:
  1528. if (CGetSetOptions::GetIsPortableDitto() == false)
  1529. {
  1530. csDir = GetTempFilePath();
  1531. }
  1532. csDir += _T("EditClips\\");
  1533. break;
  1534. }
  1535. CreateDirectory(csDir, NULL);
  1536. return csDir;
  1537. }
  1538. long CGetSetOptions::GetDittoRestoreClipboardDelay()
  1539. {
  1540. return GetProfileLong("RestoreClipboardDelay", 750);
  1541. }
  1542. void CGetSetOptions::SetDittoRestoreClipboardDelay(long lDelay)
  1543. {
  1544. SetProfileLong("RestoreClipboardDelay", lDelay);
  1545. }
  1546. void CGetSetOptions::GetCopyBufferItem(int nPos, CCopyBufferItem &Item)
  1547. {
  1548. Item.m_lCopyHotKey = GetProfileLong(StrF(_T("CopyBufferCopyHotKey_%d"), nPos), 0);
  1549. Item.m_lPasteHotKey = GetProfileLong(StrF(_T("CopyBufferPasteHotKey_%d"), nPos), 0);
  1550. Item.m_lCutHotKey = GetProfileLong(StrF(_T("CopyBufferCutHotKey_%d"), nPos), 0);
  1551. Item.m_bPlaySoundOnCopy = GetProfileLong(StrF(_T("CopyBufferPlaySound_%d"), nPos), 0);
  1552. }
  1553. void CGetSetOptions::SetCopyBufferItem(int nPos, CCopyBufferItem &Item)
  1554. {
  1555. SetProfileLong(StrF(_T("CopyBufferCopyHotKey_%d"), nPos), Item.m_lCopyHotKey);
  1556. SetProfileLong(StrF(_T("CopyBufferPasteHotKey_%d"), nPos), Item.m_lPasteHotKey);
  1557. SetProfileLong(StrF(_T("CopyBufferCutHotKey_%d"), nPos), Item.m_lCutHotKey);
  1558. SetProfileLong(StrF(_T("CopyBufferPlaySound_%d"), nPos), Item.m_bPlaySoundOnCopy);
  1559. }
  1560. CString CGetSetOptions::GetMultiPasteSeparator(bool bConvertToLineFeeds)
  1561. {
  1562. CString csSep = GetProfileString(_T("MultiPasteSeparator"), _T("[LF]"));
  1563. if(bConvertToLineFeeds)
  1564. {
  1565. CString csLineFeed(_T("\r\n"));
  1566. csSep.Replace(_T("[LF]"), csLineFeed);
  1567. csSep.Replace(_T("[lf]"), csLineFeed);
  1568. }
  1569. return csSep;
  1570. }
  1571. void CGetSetOptions::SetMultiPasteSeparator(CString csSep)
  1572. {
  1573. SetProfileString(_T("MultiPasteSeparator"), csSep);
  1574. }
  1575. BOOL CGetSetOptions::GetSetCurrentDirectory()
  1576. {
  1577. if(m_portable)
  1578. {
  1579. CString csExePath = GetFilePath(GetExeFileName());
  1580. FIX_CSTRING_PATH(csExePath);
  1581. ::SetCurrentDirectory(csExePath);
  1582. }
  1583. return m_portable == true;
  1584. }
  1585. bool CGetSetOptions::GetIsPortableDitto()
  1586. {
  1587. return m_portable;
  1588. }
  1589. bool CGetSetOptions::GetIsWindowsApp()
  1590. {
  1591. return m_windowsApp;
  1592. }
  1593. bool CGetSetOptions::GetIsChocolateyApp()
  1594. {
  1595. return m_chocolateyApp;
  1596. }
  1597. CString CGetSetOptions::GetPasteString(CString csAppName)
  1598. {
  1599. CString csString = GetProfileString(csAppName, _T(""), _T("PasteStrings"));
  1600. if (csString.IsEmpty())
  1601. {
  1602. return GetDefaultPasteString();
  1603. }
  1604. return csString;
  1605. }
  1606. CString CGetSetOptions::GetDefaultPasteString()
  1607. {
  1608. //ascii value for v
  1609. //for other language keyboards v gets converted to something else so send the base ascii value
  1610. return GetProfileString(_T("DefaultPasteString"), _T("^{VKEY86}"));
  1611. }
  1612. void CGetSetOptions::SetDefaultPasteString(CString val)
  1613. {
  1614. SetProfileString(_T("DefaultPasteString"), val);
  1615. }
  1616. CString CGetSetOptions::GetCopyString(CString csAppName)
  1617. {
  1618. CString csString = GetProfileString(csAppName, _T(""), _T("CopyStrings"));
  1619. if(csString.IsEmpty())
  1620. return GetDefaultCopyString();
  1621. return csString;
  1622. }
  1623. CString CGetSetOptions::GetDefaultCopyString()
  1624. {
  1625. //ascii value for c
  1626. //for other language keyboards c gets converted to something else so send the base ascii value
  1627. return GetProfileString(_T("DefaultCopyString"), _T("^{VKEY67}"));
  1628. }
  1629. void CGetSetOptions::SetDefaultCopyString(CString val)
  1630. {
  1631. SetProfileString(_T("DefaultCopyString"), val);
  1632. }
  1633. CString CGetSetOptions::GetCutString(CString csAppName)
  1634. {
  1635. CString csString = GetProfileString(csAppName, _T(""), _T("CutStrings"));
  1636. if(csString.IsEmpty())
  1637. return GetDefaultCutString();
  1638. return csString;
  1639. }
  1640. CString CGetSetOptions::GetDefaultCutString()
  1641. {
  1642. //ascii value for x
  1643. //for other language keyboards x gets converted to something else so send the base ascii value
  1644. return GetProfileString(_T("DefaultCutString"), _T("^{VKEY88}"));
  1645. }
  1646. void CGetSetOptions::SetDefaultCutString(CString val)
  1647. {
  1648. SetProfileString(_T("DefaultCutString"), val);
  1649. }
  1650. BOOL CGetSetOptions::GetEditWordWrap()
  1651. {
  1652. return GetProfileLong(_T("EditWordWrap"), TRUE);
  1653. }
  1654. void CGetSetOptions::SetEditWordWrap(BOOL bSet)
  1655. {
  1656. SetProfileLong(_T("EditWordWrap"), bSet);
  1657. }
  1658. void CGetSetOptions::SetAllowFriends(BOOL val)
  1659. {
  1660. SetProfileLong("AllowFriends", val);
  1661. }
  1662. bool CGetSetOptions::GetAllowFriends()
  1663. {
  1664. return (GetProfileLong("AllowFriends", TRUE) == TRUE);
  1665. }
  1666. long CGetSetOptions::GetAutoMaxDelay()
  1667. {
  1668. return GetProfileLong(_T("AutoMaxDelaySeconds"), 2);
  1669. }
  1670. void CGetSetOptions::SetAutoMaxDelay(long lDelay)
  1671. {
  1672. SetProfileLong(_T("AutoMaxDelaySeconds"), lDelay);
  1673. }
  1674. void CGetSetOptions::SetTheme(CString csTheme)
  1675. {
  1676. SetProfileString(_T("Theme2"), csTheme);
  1677. }
  1678. CString CGetSetOptions::GetTheme()
  1679. {
  1680. return GetProfileString(_T("Theme2"), "");
  1681. }
  1682. long CGetSetOptions::GetKeyStateWaitTimerCount()
  1683. {
  1684. return GetProfileLong(_T("KeyStateWaitTimerCount"), 20);
  1685. }
  1686. long CGetSetOptions::GetKeyStatePasteDelay()
  1687. {
  1688. return GetProfileLong(_T("KeyStatePasteDelay"), 200);
  1689. }
  1690. DWORD CGetSetOptions::GetDittoHotKey()
  1691. {
  1692. return (DWORD)GetProfileLong(_T("DittoHotKey"), 704);
  1693. }
  1694. DWORD CGetSetOptions::SendKeysDelay()
  1695. {
  1696. return (DWORD)GetProfileLong(_T("SendKeysDelay"), 100);
  1697. }
  1698. void CGetSetOptions::SetSendKeysDelay(DWORD val)
  1699. {
  1700. SetProfileLong(_T("SendKeysDelay"), val);
  1701. }
  1702. DWORD CGetSetOptions::RealSendKeysDelay()
  1703. {
  1704. return (DWORD)GetProfileLong(_T("RealSendKeysDelay"), 10);
  1705. }
  1706. void CGetSetOptions::SetRealSendKeysDelay(DWORD val)
  1707. {
  1708. SetProfileLong(_T("RealSendKeysDelay"), val);
  1709. }
  1710. DWORD CGetSetOptions::WaitForActiveWndTimeout()
  1711. {
  1712. return (DWORD)GetProfileLong(_T("WaitForActiveWndTimeout"), 500);
  1713. }
  1714. DWORD CGetSetOptions::FocusChangedDelay()
  1715. {
  1716. return (DWORD)GetProfileLong(_T("FocusChangedDelay"), 100);
  1717. }
  1718. DWORD CGetSetOptions::FocusWndTimerTimeout()
  1719. {
  1720. return (DWORD)GetProfileLong(_T("FocusWndTimerTimeout"), 2000);
  1721. }
  1722. BOOL CGetSetOptions::GetConnectedToClipboard()
  1723. {
  1724. return GetProfileLong("ConnectedToClipboard", TRUE);
  1725. }
  1726. void CGetSetOptions::SetConnectedToClipboard(BOOL val)
  1727. {
  1728. SetProfileLong("ConnectedToClipboard", val);
  1729. }
  1730. DWORD CGetSetOptions::GetTextOnlyRestoreDelay()
  1731. {
  1732. return (DWORD)GetProfileLong(_T("TextOnlyRestoreDelay"), 2000);
  1733. }
  1734. DWORD CGetSetOptions::GetTextOnlyPasteDelay()
  1735. {
  1736. return (DWORD)GetProfileLong(_T("TextOnlyPasteDelay"), 0);
  1737. }
  1738. BOOL CGetSetOptions::GetSetFocusToApp(CString csAppName)
  1739. {
  1740. CString focusCheck;
  1741. focusCheck = "SetFocus_";
  1742. focusCheck += csAppName;
  1743. return GetProfileLong(focusCheck, FALSE);
  1744. }
  1745. DWORD CGetSetOptions::SelectedIndex()
  1746. {
  1747. return (DWORD)GetProfileLong(_T("SelectedIndex"), 0);
  1748. }
  1749. void CGetSetOptions::SetSelectedIndex(int val)
  1750. {
  1751. SetProfileLong(_T("SelectedIndex"), val);
  1752. }
  1753. void CGetSetOptions::SetCopyAppInclude(CString csAppName)
  1754. {
  1755. SetProfileString(_T("CopyAppInclude"), csAppName);
  1756. }
  1757. CString CGetSetOptions::GetCopyAppInclude()
  1758. {
  1759. CString includeApp = GetProfileString(_T("CopyAppInclude"), "*");
  1760. if(includeApp == "")
  1761. {
  1762. includeApp = "*";
  1763. }
  1764. return includeApp;
  1765. }
  1766. void CGetSetOptions::SetCopyAppExclude(CString csAppName)
  1767. {
  1768. SetProfileString(_T("CopyAppExclude"), csAppName);
  1769. }
  1770. CString CGetSetOptions::GetCopyAppExclude()
  1771. {
  1772. return GetProfileString(_T("CopyAppExclude"), "");
  1773. }
  1774. CString CGetSetOptions::GetCopyAppSeparator()
  1775. {
  1776. return GetProfileString(_T("CopyAppSeparator"), ";");
  1777. }
  1778. DWORD CGetSetOptions::GetNoFormatsRetryDelay()
  1779. {
  1780. return GetProfileLong(_T("NoFormatsRetryDelay"), 200);
  1781. }
  1782. DWORD CGetSetOptions::GetMainDeletesDeleteCount()
  1783. {
  1784. return GetProfileLong(_T("MainDeletesDeleteCount"), 100);
  1785. }
  1786. DWORD CGetSetOptions::GetIdleSecondsBeforeDelete()
  1787. {
  1788. return GetProfileLong(_T("IdleSecondsBeforeDelete"), 60*10);
  1789. }
  1790. DWORD CGetSetOptions::GetDbTimeout()
  1791. {
  1792. return GetProfileLong(_T("DbTimeout"), 5000);
  1793. }
  1794. DWORD CGetSetOptions::GetFunnyTickCountAdjustment()
  1795. {
  1796. return GetProfileLong(_T("FunnyTickCountAdjustment"), 300001);
  1797. }
  1798. DWORD CGetSetOptions::GetMinIdleTimeBeforeTrackFocus()
  1799. {
  1800. return GetProfileLong(_T("MinIdleTimeBeforeTrackFocus"), 100);
  1801. }
  1802. DWORD CGetSetOptions::GetTimeBeforeExpandWindow()
  1803. {
  1804. return GetProfileLong(_T("TimeBeforeExpandWindow"), 250);
  1805. }
  1806. DWORD CGetSetOptions::GetUseGuiThreadInfoForFocus()
  1807. {
  1808. return GetProfileLong(_T("UseGuiThreadInfoForFocus"), 1);
  1809. }
  1810. void CGetSetOptions::SetSearchDescription(BOOL val)
  1811. {
  1812. SetProfileLong(_T("SearchDescription"), val);
  1813. }
  1814. BOOL CGetSetOptions::GetSearchDescription()
  1815. {
  1816. return GetProfileLong(_T("SearchDescription"), 1);
  1817. }
  1818. void CGetSetOptions::SetSearchFullText(BOOL val)
  1819. {
  1820. SetProfileLong(_T("SearchFullText"), val);
  1821. }
  1822. BOOL CGetSetOptions::GetSearchFullText()
  1823. {
  1824. return GetProfileLong(_T("SearchFullText"), 0);
  1825. }
  1826. void CGetSetOptions::SetSearchQuickPaste(BOOL val)
  1827. {
  1828. SetProfileLong(_T("SearchQuickPaste"), val);
  1829. }
  1830. BOOL CGetSetOptions::GetSearchQuickPaste()
  1831. {
  1832. return GetProfileLong(_T("SearchQuickPaste"), 0);
  1833. }
  1834. void CGetSetOptions::SetSimpleTextSearch(BOOL val)
  1835. {
  1836. SetProfileLong(_T("SimpleTextSearch"), val);
  1837. }
  1838. BOOL CGetSetOptions::GetSimpleTextSearch()
  1839. {
  1840. return GetProfileLong(_T("SimpleTextSearch"), 0);
  1841. }
  1842. void CGetSetOptions::SetRegExTextSearch(BOOL val)
  1843. {
  1844. SetProfileLong(_T("RegExTextSearch"), val);
  1845. }
  1846. BOOL CGetSetOptions::GetRegExTextSearch()
  1847. {
  1848. return GetProfileLong(_T("RegExTextSearch"), 0);
  1849. }
  1850. void CGetSetOptions::SetMoveClipsOnGlobal10(BOOL val)
  1851. {
  1852. SetProfileLong(_T("MoveClipsOnGlobal10"), val);
  1853. }
  1854. BOOL CGetSetOptions::GetMoveClipsOnGlobal10()
  1855. {
  1856. return GetProfileLong(_T("MoveClipsOnGlobal10"), 0);
  1857. }
  1858. void CGetSetOptions::SetShowScrollBar(BOOL val)
  1859. {
  1860. m_showScrollBar = val;
  1861. SetProfileLong(_T("ShowScrollBar"), val);
  1862. }
  1863. BOOL CGetSetOptions::GetShowScrollBar()
  1864. {
  1865. return GetProfileLong(_T("ShowScrollBar"), 0);
  1866. }
  1867. void CGetSetOptions::SetPasteAsAdmin(BOOL val)
  1868. {
  1869. SetProfileLong(_T("PasteAsAdmin"), val);
  1870. }
  1871. BOOL CGetSetOptions::GetPasteAsAdmin()
  1872. {
  1873. return GetProfileLong(_T("PasteAsAdmin"), 1);
  1874. }
  1875. void CGetSetOptions::SetRememberDescPos(BOOL val)
  1876. {
  1877. SetProfileLong(_T("RememberDescPos"), val);
  1878. }
  1879. BOOL CGetSetOptions::GetRememberDescPos()
  1880. {
  1881. return GetProfileLong(_T("RememberDescPos"), FALSE);
  1882. }
  1883. void CGetSetOptions::SetSizeDescWindowToContent(BOOL val)
  1884. {
  1885. SetProfileLong(_T("SizeDescWindowToContent"), val);
  1886. }
  1887. BOOL CGetSetOptions::GetSizeDescWindowToContent()
  1888. {
  1889. return GetProfileLong(_T("SizeDescWindowToContent"), TRUE);
  1890. }
  1891. void CGetSetOptions::SetScaleImagesToDescWindow(BOOL val)
  1892. {
  1893. SetProfileLong(_T("ScaleImagesToDescWindow"), val);
  1894. }
  1895. BOOL CGetSetOptions::GetScaleImagesToDescWindow()
  1896. {
  1897. return GetProfileLong(_T("ScaleImagesToDescWindow"), TRUE);
  1898. }
  1899. void CGetSetOptions::SetDescWndPoint(CPoint point)
  1900. {
  1901. SetResolutionProfileLong("DescWndX", point.x);
  1902. SetResolutionProfileLong("DescWndY", point.y);
  1903. }
  1904. void CGetSetOptions::GetDescWndPoint(CPoint &point)
  1905. {
  1906. point.x = GetResolutionProfileLong("DescWndX", 100);
  1907. point.y = GetResolutionProfileLong("DescWndY", 100);
  1908. }
  1909. void CGetSetOptions::GetDescWndSize(CSize &size)
  1910. {
  1911. size.cx = GetResolutionProfileLong("DescWndCX", 300);
  1912. size.cy = GetResolutionProfileLong("DescWndCY", 300);
  1913. if(size.cx <= 0 && size.cy <= 0)
  1914. {
  1915. size.cx = 300;
  1916. size.cy = 300;
  1917. }
  1918. }
  1919. void CGetSetOptions::SetDescWndSize(CSize size)
  1920. {
  1921. SetResolutionProfileLong("DescWndCX", size.cx);
  1922. SetResolutionProfileLong("DescWndCY", size.cy);
  1923. }
  1924. void CGetSetOptions::SetShowInTaskBar(BOOL val)
  1925. {
  1926. SetProfileLong(_T("ShowInTaskBar"), val);
  1927. }
  1928. BOOL CGetSetOptions::GetShowInTaskBar()
  1929. {
  1930. return GetProfileLong(_T("ShowInTaskBar"), FALSE);
  1931. }
  1932. void CGetSetOptions::SetDiffApp(CString val)
  1933. {
  1934. SetProfileString(_T("DiffApp"), val);
  1935. }
  1936. CString CGetSetOptions::GetDiffApp()
  1937. {
  1938. return GetProfileString(_T("DiffApp"), _T(""));
  1939. }
  1940. void CGetSetOptions::SetQRCodeBorderPixels(int val)
  1941. {
  1942. SetProfileLong(_T("QRCodeBorderPixels"), val);
  1943. }
  1944. int CGetSetOptions::GetQRCodeBorderPixels()
  1945. {
  1946. return GetProfileLong(_T("QRCodeBorderPixels"), 30);
  1947. }
  1948. CString CGetSetOptions::GetTranslateUrl()
  1949. {
  1950. return GetProfileString(_T("TranslateUrl"), _T("https://translate.google.com/?text=%s"));
  1951. }
  1952. void CGetSetOptions::SetNetworkReadTimeoutMS(int val)
  1953. {
  1954. SetProfileLong(_T("NetworkReadTimeoutMS"), val);
  1955. }
  1956. int CGetSetOptions::GetNetworkReadTimeoutMS()
  1957. {
  1958. return GetProfileLong(_T("NetworkReadTimeoutMS"), 30000);
  1959. }
  1960. void CGetSetOptions::SetRequestFilesUsingIP(int val)
  1961. {
  1962. SetProfileLong(_T("RequestFilesUsingIP"), val);
  1963. }
  1964. int CGetSetOptions::GetRequestFilesUsingIP()
  1965. {
  1966. return GetProfileLong(_T("RequestFilesUsingIP"), 0);
  1967. }
  1968. int CGetSetOptions::ReadRandomFileInterval()
  1969. {
  1970. return GetProfileLong(_T("ReadRandomFileInterval"), 60);
  1971. }
  1972. int CGetSetOptions::ReadRandomFileIdleMin()
  1973. {
  1974. return GetProfileLong(_T("ReadRandomFileIdleMin"), 30);
  1975. }
  1976. BOOL CGetSetOptions::GetShowGroupsInMainList()
  1977. {
  1978. return GetProfileLong(_T("ShowGroupsInMainList"), 0);
  1979. }
  1980. void CGetSetOptions::SetShowGroupsInMainList(BOOL val)
  1981. {
  1982. SetProfileLong(_T("ShowGroupsInMainList"), val);
  1983. }
  1984. void CGetSetOptions::SetGroupDoubleClickTimeMS(int val)
  1985. {
  1986. SetProfileLong(_T("GroupDoubleClickTimeMS"), val);
  1987. }
  1988. int CGetSetOptions::GetGroupDoubleClickTimeMS()
  1989. {
  1990. return GetProfileLong(_T("GroupDoubleClickTimeMS"), 500);
  1991. }
  1992. void CGetSetOptions::SetSaveToGroupTimeoutMS(int val)
  1993. {
  1994. SetProfileLong(_T("SaveToGroupTimeoutMS"), val);
  1995. }
  1996. int CGetSetOptions::GetSaveToGroupTimeoutMS()
  1997. {
  1998. return GetProfileLong(_T("SaveToGroupTimeoutMS"), 1000);
  1999. }
  2000. void CGetSetOptions::SetCopyReasonTimeoutMS(int val)
  2001. {
  2002. SetProfileLong(_T("CopyReasonTimeoutMS"), val);
  2003. }
  2004. int CGetSetOptions::GetCopyReasonTimeoutMS()
  2005. {
  2006. return GetProfileLong(_T("CopyReasonTimeoutMS"), 1000);
  2007. }
  2008. void CGetSetOptions::SetWindowsResumeDelayReOpenDbMS(int val)
  2009. {
  2010. SetProfileLong(_T("WindowsResumeDelayReOpenDbMS"), val);
  2011. }
  2012. int CGetSetOptions::GetWindowsResumeDelayReOpenDbMS()
  2013. {
  2014. return GetProfileLong(_T("WindowsResumeDelayReOpenDbMS"), 2000);
  2015. }
  2016. BOOL CGetSetOptions::GetShowMsgWndOnCopyToGroup()
  2017. {
  2018. return GetProfileLong(_T("ShowMsgWndOnCopyToGroup"), TRUE);
  2019. }
  2020. void CGetSetOptions::SetShowMsgWndOnCopyToGroup(BOOL val)
  2021. {
  2022. SetProfileLong(_T("ShowMsgWndOnCopyToGroup"), val);
  2023. }
  2024. int CGetSetOptions::GetActionShortCutA(DWORD action, int pos, CString refData)
  2025. {
  2026. CString actionText;
  2027. if (refData != _T(""))
  2028. {
  2029. actionText.Format(_T("QP_ShortCut_%d_%s_%d_A"), action, refData, pos);
  2030. }
  2031. else
  2032. {
  2033. actionText.Format(_T("QP_ShortCut_%d_%d_A"), action, pos);
  2034. }
  2035. int ret = GetProfileLong(actionText, -1);
  2036. if (ret == -1)
  2037. {
  2038. ret = ActionEnums::GetDefaultShortCutKeyA((ActionEnums::ActionEnumValues)action, pos);
  2039. }
  2040. return ret;
  2041. }
  2042. void CGetSetOptions::SetActionShortCutA(int action, DWORD shortcut, int pos, CString refData)
  2043. {
  2044. CString actionText;
  2045. if (refData != _T(""))
  2046. {
  2047. actionText.Format(_T("QP_ShortCut_%d_%s_%d_A"), action, refData, pos);
  2048. }
  2049. else
  2050. {
  2051. actionText.Format(_T("QP_ShortCut_%d_%d_A"), action, pos);
  2052. }
  2053. SetProfileLong(actionText, shortcut);
  2054. }
  2055. int CGetSetOptions::GetActionShortCutB(DWORD action, int pos, CString refData)
  2056. {
  2057. CString actionText;
  2058. if (refData != _T(""))
  2059. {
  2060. actionText.Format(_T("QP_ShortCut_%d_%s_%d_B"), action, refData, pos);
  2061. }
  2062. else
  2063. {
  2064. actionText.Format(_T("QP_ShortCut_%d_%d_B"), action, pos);
  2065. }
  2066. int ret = GetProfileLong(actionText, -1);
  2067. if (ret == -1)
  2068. {
  2069. ret = ActionEnums::GetDefaultShortCutKeyB((ActionEnums::ActionEnumValues)action, pos);
  2070. }
  2071. return ret;
  2072. }
  2073. void CGetSetOptions::SetActionShortCutB(int action, DWORD shortcut, int pos, CString refData)
  2074. {
  2075. CString actionText;
  2076. if (refData != _T(""))
  2077. {
  2078. actionText.Format(_T("QP_ShortCut_%d_%s_%d_B"), action, refData, pos);
  2079. }
  2080. else
  2081. {
  2082. actionText.Format(_T("QP_ShortCut_%d_%d_B"), action, pos);
  2083. }
  2084. SetProfileLong(actionText, shortcut);
  2085. }
  2086. BOOL CGetSetOptions::GetShowAlwaysOnTopWarning()
  2087. {
  2088. return GetProfileLong(_T("ShowAlwaysOnTopWarning"), TRUE);
  2089. }
  2090. void CGetSetOptions::SetShowAlwaysOnTopWarning(BOOL show)
  2091. {
  2092. m_bShowAlwaysOnTopWarning = show;
  2093. SetProfileLong(_T("ShowAlwaysOnTopWarning"), show);
  2094. }
  2095. BOOL CGetSetOptions::GetUseIPFromAccept()
  2096. {
  2097. return GetProfileLong(_T("UseIPFromAccept"), TRUE);
  2098. }
  2099. void CGetSetOptions::SetUseIPFromAccept(BOOL useAccept)
  2100. {
  2101. SetProfileLong(_T("UseIPFromAccept"), useAccept);
  2102. }
  2103. int CGetSetOptions::GetDragId()
  2104. {
  2105. return GetProfileLong(_T("DragId"), 1);
  2106. }
  2107. void CGetSetOptions::SetDragId(int id)
  2108. {
  2109. SetProfileLong(_T("DragId"), id);
  2110. }
  2111. BOOL CGetSetOptions::GetShowIfClipWasPasted()
  2112. {
  2113. return GetProfileLong(_T("ShowIfClipWasPasted"), TRUE);
  2114. }
  2115. void CGetSetOptions::SetShowIfClipWasPasted(BOOL val)
  2116. {
  2117. SetProfileLong(_T("ShowIfClipWasPasted"), val);
  2118. }
  2119. int CGetSetOptions::GetLastGroupToggle()
  2120. {
  2121. return GetProfileLong(_T("LastGroupToggle"), -2);
  2122. }
  2123. void CGetSetOptions::SetLastGroupToggle(int val)
  2124. {
  2125. SetProfileLong(_T("LastGroupToggle"), val);
  2126. }
  2127. BOOL CGetSetOptions::GetMouseClickHidesDescription()
  2128. {
  2129. return GetProfileLong(_T("MouseClickHidesDescription"), TRUE);
  2130. }
  2131. void CGetSetOptions::SetMouseClickHidesDescription(int val)
  2132. {
  2133. SetProfileLong(_T("MouseClickHidesDescription"), val);
  2134. }
  2135. BOOL CGetSetOptions::GetWrapDescriptionText()
  2136. {
  2137. return GetProfileLong(_T("WrapDescriptionText"), FALSE);
  2138. }
  2139. void CGetSetOptions::SetWrapDescriptionText(int val)
  2140. {
  2141. SetProfileLong(_T("WrapDescriptionText"), val);
  2142. }
  2143. BOOL CGetSetOptions::GetUseUISelectedGroupForLastTenCopies()
  2144. {
  2145. return GetProfileLong(_T("UseUISelectedGroupForLastTenCopies"), FALSE);
  2146. }
  2147. void CGetSetOptions::SetUseUISelectedGroupForLastTenCopies(int val)
  2148. {
  2149. SetProfileLong(_T("UseUISelectedGroupForLastTenCopies"), val);
  2150. }
  2151. int CGetSetOptions::GetDelayRenderLockout()
  2152. {
  2153. return GetProfileLong(_T("DelayRenderLockout"), 1000);
  2154. }
  2155. void CGetSetOptions::SetDelayRenderLockout(int val)
  2156. {
  2157. SetProfileLong(_T("DelayRenderLockout"), val);
  2158. }
  2159. BOOL CGetSetOptions::GetAdjustClipsForCRC()
  2160. {
  2161. return GetProfileLong(_T("AdjustClipsForCRC"), TRUE);
  2162. }
  2163. void CGetSetOptions::SetAdjustClipsForCRC(int val)
  2164. {
  2165. SetProfileLong(_T("AdjustClipsForCRC"), val);
  2166. }
  2167. BOOL CGetSetOptions::GetCheckMd5OnFileTransfers()
  2168. {
  2169. return GetProfileLong(_T("CheckMd5OnFileTransfers"), TRUE);
  2170. }
  2171. void CGetSetOptions::SetCheckMd5OnFileTransfers(int val)
  2172. {
  2173. SetProfileLong(_T("CheckMd5OnFileTransfers"), val);
  2174. }
  2175. int CGetSetOptions::GetBalloonTimeout()
  2176. {
  2177. return GetProfileLong(_T("BalloonTimeout"), 2500);
  2178. }
  2179. void CGetSetOptions::SetBalloonTimeout(int val)
  2180. {
  2181. SetProfileLong(_T("BalloonTimeout"), val);
  2182. }
  2183. void CGetSetOptions::SetCustomSendToList(CString val)
  2184. {
  2185. SetProfileString(_T("CustomSendToList2"), val);
  2186. }
  2187. CString CGetSetOptions::GetCustomSendToList()
  2188. {
  2189. return GetProfileString("CustomSendToList2", "");
  2190. }
  2191. int CGetSetOptions::GetMaxFileContentsSize()
  2192. {
  2193. return GetProfileLong(_T("MaxFileContentsSize"), 64000000);
  2194. }
  2195. void CGetSetOptions::SetMaxFileContentsSize(int val)
  2196. {
  2197. SetProfileLong(_T("MaxFileContentsSize"), val);
  2198. }
  2199. int CGetSetOptions::GetErrorMsgPopupTimeout()
  2200. {
  2201. return GetProfileLong(_T("ErrorMsgPopupTimeout"), 3500);
  2202. }
  2203. void CGetSetOptions::SetErrorMsgPopupTimeout(int val)
  2204. {
  2205. SetProfileLong(_T("ErrorMsgPopupTimeout"), val);
  2206. }
  2207. void CGetSetOptions::SetRegexFilter(CString val, int pos)
  2208. {
  2209. CString cs;
  2210. cs.Format(_T("RegexFilter_%d"), pos);
  2211. m_regexHelper.SetRegEx(pos, std::wstring(val));
  2212. SetProfileString(cs, val);
  2213. }
  2214. CString CGetSetOptions::GetRegexFilter(int pos)
  2215. {
  2216. CString cs;
  2217. cs.Format(_T("RegexFilter_%d"), pos);
  2218. return GetProfileString(cs, "");
  2219. }
  2220. void CGetSetOptions::SetRegexFilterByProcessName(CString val, int pos)
  2221. {
  2222. CString cs;
  2223. cs.Format(_T("RegexFilterByProcessName_%d"), pos);
  2224. m_regexHelper.SetProcessFilter(pos, val);
  2225. SetProfileString(cs, val);
  2226. }
  2227. CString CGetSetOptions::GetRegexFilterByProcessName(int pos)
  2228. {
  2229. CString cs;
  2230. cs.Format(_T("RegexFilterByProcessName_%d"), pos);
  2231. return GetProfileString(cs, "");
  2232. }
  2233. BOOL CGetSetOptions::GetOpenToGroupByActiveExe()
  2234. {
  2235. return GetProfileLong(_T("OpenToGroupByActiveExe"), FALSE);
  2236. }
  2237. void CGetSetOptions::SetOpenToGroupByActiveExe(int val)
  2238. {
  2239. SetProfileLong(_T("OpenToGroupByActiveExe"), val);
  2240. }
  2241. BOOL CGetSetOptions::GetShowStartupMessage()
  2242. {
  2243. return GetProfileLong(_T("ShowStartupMessage"), TRUE);
  2244. }
  2245. void CGetSetOptions::SetShowStartupMessage(int val)
  2246. {
  2247. SetProfileLong(_T("ShowStartupMessage"), val);
  2248. }
  2249. CString CGetSetOptions::GetCopyScriptsXml()
  2250. {
  2251. return GetProfileString("CopyScriptsXml", "");
  2252. }
  2253. void CGetSetOptions::SetCopyScriptsXml(CString val)
  2254. {
  2255. m_copyScripts.Load(val);
  2256. SetProfileString(_T("CopyScriptsXml"), val);
  2257. }
  2258. CString CGetSetOptions::GetPasteScriptsXml()
  2259. {
  2260. return GetProfileString("PasteScriptsXml", "");
  2261. }
  2262. void CGetSetOptions::SetPasteScriptsXml(CString val)
  2263. {
  2264. m_pasteScripts.Load(val);
  2265. SetProfileString(_T("PasteScriptsXml"), val);
  2266. }
  2267. long CGetSetOptions::GetToolTipTimeout()
  2268. {
  2269. return GetProfileLong("ToolTipTimeout", -1);
  2270. }
  2271. void CGetSetOptions::SetToolTipTimeout(long val)
  2272. {
  2273. m_tooltipTimeout = val;
  2274. SetProfileLong("ToolTipTimeout", val);
  2275. }
  2276. CString CGetSetOptions::GetPastSearchXml()
  2277. {
  2278. //max this out at 1000, this should be more than the allowed length in SymbolEdit.cpp
  2279. //had reports of this being really large and causing memory issues, this will prevent us from this
  2280. return GetProfileString("PastSearchXml", "", "", 1000);
  2281. }
  2282. void CGetSetOptions::SetPastSearchXml(CString val)
  2283. {
  2284. SetProfileString(_T("PastSearchXml"), val);
  2285. }
  2286. BOOL CGetSetOptions::GetShowMsgWhenReceivingManualSentClip()
  2287. {
  2288. return GetProfileLong("ShowMsgWhenReceivingManualSentClip", TRUE);
  2289. }
  2290. void CGetSetOptions::SetShowMsgWhenReceivingManualSentClip(BOOL val)
  2291. {
  2292. SetProfileLong("ShowMsgWhenReceivingManualSentClip", val);
  2293. }
  2294. BOOL CGetSetOptions::GetCleanRTFBeforeDrawing()
  2295. {
  2296. return GetProfileLong("CleanRTFBeforeDrawing", TRUE);
  2297. }
  2298. void CGetSetOptions::SetCleanRTFBeforeDrawing(BOOL val)
  2299. {
  2300. m_cleanRTFBeforeDrawing = true;
  2301. SetProfileLong("CleanRTFBeforeDrawing", val);
  2302. }
  2303. BOOL CGetSetOptions::GetDisableExpireClipsConfig()
  2304. {
  2305. return GetProfileLong("DisableExpireClipsConfig", FALSE);
  2306. }
  2307. void CGetSetOptions::SetDisableExpireClipsConfig(BOOL val)
  2308. {
  2309. SetProfileLong("DisableExpireClipsConfig", val);
  2310. }
  2311. BOOL CGetSetOptions::GetRevertToTopLevelGroup()
  2312. {
  2313. return GetProfileLong("RevertToTopLevelGroup", FALSE);
  2314. }
  2315. void CGetSetOptions::SetRevertToTopLevelGroup(BOOL val)
  2316. {
  2317. SetProfileLong("RevertToTopLevelGroup", val);
  2318. }
  2319. BOOL CGetSetOptions::GetUpdateClipOrderOnCtrlC()
  2320. {
  2321. return GetProfileLong("UpdateClipOrderOnCtrlC", FALSE);
  2322. }
  2323. void CGetSetOptions::SetUpdateClipOrderOnCtrlC(BOOL val)
  2324. {
  2325. SetProfileLong("UpdateClipOrderOnCtrlC", val);
  2326. }
  2327. int CGetSetOptions::GetMaxToolTipLines()
  2328. {
  2329. return GetProfileLong("MaxToolTipLines", 30);
  2330. }
  2331. void CGetSetOptions::SetMaxToolTipLines(int val)
  2332. {
  2333. SetProfileLong("MaxToolTipLines", val);
  2334. }
  2335. int CGetSetOptions::GetMaxToolTipCharacters()
  2336. {
  2337. return GetProfileLong("MaxToolTipCharacters", 1000);
  2338. }
  2339. void CGetSetOptions::SetMaxToolTipCharacters(int val)
  2340. {
  2341. SetProfileLong("MaxToolTipCharacters", val);
  2342. }
  2343. int CGetSetOptions::GetDoubleKeyStrokeTimeout()
  2344. {
  2345. return GetProfileLong("DoubleKeyStrokeTimeout", 350);
  2346. }
  2347. void CGetSetOptions::SetDoubleKeyStrokeTimeout(int val)
  2348. {
  2349. m_doubleKeyStrokeTimeout = val;
  2350. SetProfileLong("DoubleKeyStrokeTimeout", val);
  2351. }
  2352. int CGetSetOptions::GetFirstTenHotKeysStart()
  2353. {
  2354. return GetProfileLong("FirstTenHotKeysStart", 1);
  2355. }
  2356. void CGetSetOptions::SetFirstTenHotKeysStart(int val)
  2357. {
  2358. m_firstTenHotKeysStart = val;
  2359. SetProfileLong("FirstTenHotKeysStart", val);
  2360. }
  2361. int CGetSetOptions::GetFirstTenHotKeysFontSize()
  2362. {
  2363. return GetProfileLong("FirstTenHotKeysFontSize", 5);
  2364. }
  2365. void CGetSetOptions::SetFirstTenHotKeysFontSize(int val)
  2366. {
  2367. m_firstTenHotKeysFontSize = val;
  2368. SetProfileLong("FirstTenHotKeysFontSize", val);
  2369. }
  2370. BOOL CGetSetOptions::GetAddCFHDROP_OnDrag()
  2371. {
  2372. return GetProfileLong(_T("AddCFHDROP_OnDrag"), TRUE);
  2373. }
  2374. void CGetSetOptions::SetAddCFHDROP_OnDrag(BOOL val)
  2375. {
  2376. SetProfileLong(_T("AddCFHDROP_OnDrag"), val);
  2377. }
  2378. int CGetSetOptions::GetCopyAndSveDelay()
  2379. {
  2380. return GetProfileLong("CopyAndSveDelay", 1000);
  2381. }
  2382. void CGetSetOptions::SetCopyAndSveDelay(int val)
  2383. {
  2384. SetProfileLong("CopyAndSveDelay", val);
  2385. }
  2386. int CGetSetOptions::GetEditorDefaultFontSize()
  2387. {
  2388. return GetProfileLong("EditorDefaultFontSize", 14);
  2389. }
  2390. void CGetSetOptions::SetEditorDefaultFontSize(int val)
  2391. {
  2392. SetProfileLong("EditorDefaultFontSize", val);
  2393. }
  2394. BOOL CGetSetOptions::GetMoveSelectionOnOpenHotkey()
  2395. {
  2396. return GetProfileLong("MoveSelectionOnOpenHotkey", TRUE);
  2397. }
  2398. void CGetSetOptions::SetMoveSelectionOnOpenHotkey(BOOL val)
  2399. {
  2400. m_moveSelectionOnOpenHotkey = val;
  2401. SetProfileLong("MoveSelectionOnOpenHotkey", val);
  2402. }
  2403. BOOL CGetSetOptions::GetAllowBackToBackDuplicates()
  2404. {
  2405. return GetProfileLong("AllowBackToBackDuplicates", FALSE);
  2406. }
  2407. void CGetSetOptions::SetAllowBackToBackDuplicates(BOOL val)
  2408. {
  2409. m_allowBackToBackDuplicates = val;
  2410. SetProfileLong("AllowBackToBackDuplicates", val);
  2411. }
  2412. BOOL CGetSetOptions::GetMaintainSearchView()
  2413. {
  2414. return GetProfileLong("MaintainSearchView", FALSE);
  2415. }
  2416. void CGetSetOptions::SetMaintainSearchView(BOOL val)
  2417. {
  2418. m_maintainSearchView = val;
  2419. SetProfileLong("MaintainSearchView", val);
  2420. }
  2421. CString CGetSetOptions::GetNetworkBindIPAddress()
  2422. {
  2423. return GetProfileString("NetworkBindIPAddress", "*");
  2424. }
  2425. void CGetSetOptions::SetNetworkBindIPAddress(CString val)
  2426. {
  2427. SetProfileString("NetworkBindIPAddress", val);
  2428. }
  2429. CString CGetSetOptions::GetTempDragFileName()
  2430. {
  2431. auto diff = CTime::GetCurrentTime() - m_tempDragFileNameSetTime;
  2432. if (diff.GetTotalSeconds() < 60 * 2)
  2433. {
  2434. return m_tempDragFileName;
  2435. }
  2436. return _T("");
  2437. }
  2438. void CGetSetOptions::SetTempDragFileName(CString val)
  2439. {
  2440. m_tempDragFileName = val;
  2441. m_tempDragFileNameSetTime = CTime::GetCurrentTime();
  2442. }
  2443. BOOL CGetSetOptions::GetRefreshViewAfterPasting()
  2444. {
  2445. return GetProfileLong("RefreshViewAfterPasting", FALSE);
  2446. }
  2447. void CGetSetOptions::SetRefreshViewAfterPasting(BOOL val)
  2448. {
  2449. m_refreshViewAfterPasting = val;
  2450. SetProfileLong("RefreshViewAfterPasting", val);
  2451. }
  2452. CString CGetSetOptions::GetSlugifySeparator()
  2453. {
  2454. return GetProfileString("SlugifySeparator", _T("-"));
  2455. }
  2456. void CGetSetOptions::SetSlugifySeparator(CString val)
  2457. {
  2458. SetProfileString("SlugifySeparator", val);
  2459. }
  2460. BOOL CGetSetOptions::GetSupportAllTypes()
  2461. {
  2462. return GetProfileLong("SupportAllTypes", FALSE);
  2463. }
  2464. void CGetSetOptions::SetSupportAllTypes(BOOL val)
  2465. {
  2466. m_refreshViewAfterPasting = val;
  2467. SetProfileLong("SupportAllTypes", val);
  2468. }
  2469. CString CGetSetOptions::GetIgnoreAnnoyingCFDIB(BOOL useCache)
  2470. {
  2471. if (useCache)
  2472. return m_ignoreAnnoyingCFDIB;
  2473. else
  2474. return GetProfileString("IgnoreAnnoyingCFDIB", _T(""));
  2475. }
  2476. void CGetSetOptions::SetIgnoreAnnoyingCFDIB(CString val)
  2477. {
  2478. m_ignoreAnnoyingCFDIB = val;
  2479. SetProfileString("IgnoreAnnoyingCFDIB", val);
  2480. }
  2481. set<CString> CGetSetOptions::GetIgnoreAnnoyingCFDIBSet(BOOL useCache)
  2482. {
  2483. CString rawString = CGetSetOptions::GetIgnoreAnnoyingCFDIB(useCache);
  2484. set<CString> processSet;
  2485. CTokenizer token(rawString, _T(";"));
  2486. CString process;
  2487. while (token.Next(process))
  2488. {
  2489. if (process == "")
  2490. continue;
  2491. processSet.insert(process.MakeLower());
  2492. }
  2493. return processSet;
  2494. }
  2495. BOOL CGetSetOptions::GetRegexCaseInsensitive()
  2496. {
  2497. return GetProfileLong("RegexCaseInsensitive", TRUE);
  2498. }
  2499. void CGetSetOptions::SetRegexCaseInsensitive(BOOL val)
  2500. {
  2501. SetProfileLong("RegexCaseInsensitive", val);
  2502. }
  2503. void CGetSetOptions::SetDrawCopiedColorCode(long bDraw)
  2504. {
  2505. SetProfileLong("DrawCopiedColorCode", bDraw);
  2506. m_bDrawCopiedColorCode = bDraw;
  2507. }
  2508. BOOL CGetSetOptions::GetDrawCopiedColorCode()
  2509. {
  2510. BOOL drawCopiedColorCode = TRUE;
  2511. return GetProfileLong("DrawCopiedColorCode", drawCopiedColorCode);
  2512. }
  2513. void CGetSetOptions::SetCenterWindowBelowCursorOrCaret(BOOL center)
  2514. {
  2515. SetProfileLong("CenterWindowBelowCursorOrCaret", center);
  2516. m_centerWindowBelowCursorOrCaret = center;
  2517. }
  2518. BOOL CGetSetOptions::GetCenterWindowBelowCursorOrCaret()
  2519. {
  2520. BOOL centerWindowBelowCursorOrCaret = FALSE;
  2521. return GetProfileLong("CenterWindowBelowCursorOrCaret", centerWindowBelowCursorOrCaret);
  2522. }
  2523. BOOL CGetSetOptions::SetTextEditorPath(CString path)
  2524. {
  2525. return SetProfileString("TextEditorPath", path);
  2526. }
  2527. CString CGetSetOptions::GetTextEditorPath()
  2528. {
  2529. return GetProfileString("TextEditorPath", _T(""));
  2530. }
  2531. BOOL CGetSetOptions::SetRTFEditorPath(CString path)
  2532. {
  2533. return SetProfileString("RTFEditorPath", path);
  2534. }
  2535. CString CGetSetOptions::GetRTFEditorPath()
  2536. {
  2537. return GetProfileString("RTFEditorPath", _T(""));
  2538. }
  2539. BOOL CGetSetOptions::SetQRCodeUrl(CString path)
  2540. {
  2541. return SetProfileString("QRCodeUrl", path);
  2542. }
  2543. CString CGetSetOptions::GetQRCodeUrl()
  2544. {
  2545. auto defaultUrl = _T("https://zxing.org/w/chart?cht=qr&chs=500x500&chl=");
  2546. auto url = GetProfileString("QRCodeUrl", defaultUrl);
  2547. if (url == _T(""))
  2548. {
  2549. url = defaultUrl;
  2550. }
  2551. return url;
  2552. }