Options.cpp 74 KB

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