Options.cpp 70 KB

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