WinConfiguration.h 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747
  1. //---------------------------------------------------------------------------
  2. #ifndef WinConfigurationH
  3. #define WinConfigurationH
  4. //---------------------------------------------------------------------------
  5. #include "CustomWinConfiguration.h"
  6. #include "CustomDirView.hpp"
  7. //---------------------------------------------------------------------------
  8. enum TEditor { edInternal, edExternal, edOpen };
  9. enum TGenerateUrlCodeTarget { guctUrl, guctScript, guctAssembly };
  10. enum TScriptFormat { sfScriptFile, sfBatchFile, sfCommandLine };
  11. //---------------------------------------------------------------------------
  12. #define C(Property) (Property != rhc.Property) ||
  13. struct TScpExplorerConfiguration {
  14. UnicodeString WindowParams;
  15. UnicodeString DirViewParams;
  16. UnicodeString ToolbarsLayout;
  17. bool SessionsTabs;
  18. bool StatusBar;
  19. UnicodeString LastLocalTargetDirectory;
  20. int ViewStyle;
  21. bool ShowFullAddress;
  22. bool DriveView;
  23. int DriveViewWidth;
  24. int DriveViewWidthPixelsPerInch;
  25. bool __fastcall operator !=(TScpExplorerConfiguration & rhc)
  26. { return C(WindowParams) C(DirViewParams) C(ToolbarsLayout)
  27. C(SessionsTabs) C(StatusBar)
  28. C(LastLocalTargetDirectory) C(ViewStyle) C(ShowFullAddress)
  29. C(DriveView) C(DriveViewWidth) C(DriveViewWidthPixelsPerInch) 0; };
  30. };
  31. //---------------------------------------------------------------------------
  32. struct TScpCommanderPanelConfiguration {
  33. UnicodeString DirViewParams;
  34. bool StatusBar;
  35. bool DriveView;
  36. int DriveViewHeight;
  37. int DriveViewHeightPixelsPerInch;
  38. int DriveViewWidth;
  39. int DriveViewWidthPixelsPerInch;
  40. bool __fastcall operator !=(TScpCommanderPanelConfiguration & rhc)
  41. { return C(DirViewParams) C(StatusBar)
  42. C(DriveView) C(DriveViewHeight) C(DriveViewHeightPixelsPerInch)
  43. C(DriveViewWidth) C(DriveViewWidthPixelsPerInch) 0; };
  44. };
  45. //---------------------------------------------------------------------------
  46. struct TScpCommanderConfiguration {
  47. UnicodeString WindowParams;
  48. double LocalPanelWidth;
  49. UnicodeString ToolbarsLayout;
  50. bool SessionsTabs;
  51. bool StatusBar;
  52. TOperationSide CurrentPanel;
  53. TNortonLikeMode NortonLikeMode;
  54. bool PreserveLocalDirectory;
  55. TScpCommanderPanelConfiguration LocalPanel;
  56. TScpCommanderPanelConfiguration RemotePanel;
  57. bool CompareByTime;
  58. bool CompareBySize;
  59. bool SwappedPanels;
  60. bool TreeOnLeft;
  61. bool ExplorerKeyboardShortcuts;
  62. bool SystemContextMenu;
  63. bool __fastcall operator !=(TScpCommanderConfiguration & rhc)
  64. { return C(WindowParams) C(LocalPanelWidth) C(ToolbarsLayout)
  65. C(SessionsTabs) C(StatusBar)
  66. C(LocalPanel) C(RemotePanel) C(CurrentPanel)
  67. C(NortonLikeMode) C(PreserveLocalDirectory)
  68. C(CompareBySize) C(CompareByTime) C(SwappedPanels)
  69. C(TreeOnLeft) C(ExplorerKeyboardShortcuts) C(SystemContextMenu) 0; };
  70. TCompareCriterias __fastcall CompareCriterias()
  71. {
  72. TCompareCriterias Criterias;
  73. if (CompareByTime)
  74. {
  75. Criterias << ccTime;
  76. }
  77. if (CompareBySize)
  78. {
  79. Criterias << ccSize;
  80. }
  81. return Criterias;
  82. }
  83. };
  84. //---------------------------------------------------------------------------
  85. struct TFontConfiguration
  86. {
  87. UnicodeString FontName;
  88. int FontSize;
  89. int FontCharset;
  90. int FontStyle;
  91. __fastcall TFontConfiguration()
  92. {
  93. FontSize = 0;
  94. FontCharset = DEFAULT_CHARSET;
  95. FontStyle = 0;
  96. }
  97. // keep in sync with SameFont
  98. bool __fastcall operator !=(const TFontConfiguration & rhc)
  99. { return !SameText(FontName, rhc.FontName) || C(FontSize)
  100. C(FontCharset) C(FontStyle) 0; };
  101. };
  102. //---------------------------------------------------------------------------
  103. struct TEditorConfiguration {
  104. TFontConfiguration Font;
  105. TColor FontColor;
  106. TColor BackgroundColor;
  107. bool WordWrap;
  108. UnicodeString FindText;
  109. UnicodeString ReplaceText;
  110. bool FindMatchCase;
  111. bool FindWholeWord;
  112. bool FindDown;
  113. unsigned int TabSize;
  114. unsigned int MaxEditors;
  115. unsigned int EarlyClose;
  116. bool SDIShellEditor;
  117. UnicodeString WindowParams;
  118. int Encoding;
  119. bool WarnOnEncodingFallback;
  120. bool WarnOrLargeFileSize;
  121. bool __fastcall operator !=(TEditorConfiguration & rhc)
  122. { return C(Font) C(FontColor) C(BackgroundColor) C(WordWrap) C(FindText) C(ReplaceText)
  123. C(FindMatchCase) C(FindWholeWord) C(FindDown) C(TabSize)
  124. C(MaxEditors) C(EarlyClose) C(SDIShellEditor) C(WindowParams)
  125. C(Encoding) C(WarnOnEncodingFallback) C(WarnOrLargeFileSize) 0; };
  126. };
  127. //---------------------------------------------------------------------------
  128. enum TQueueViewShow { qvShow, qvHideWhenEmpty, qvHide };
  129. struct TQueueViewConfiguration {
  130. int Height;
  131. int HeightPixelsPerInch;
  132. UnicodeString Layout;
  133. TQueueViewShow Show;
  134. TQueueViewShow LastHideShow;
  135. bool ToolBar;
  136. bool Label;
  137. bool __fastcall operator !=(TQueueViewConfiguration & rhc)
  138. { return C(Height) C(HeightPixelsPerInch) C(Layout) C(Show) C(LastHideShow) C(ToolBar) C(Label) 0; };
  139. };
  140. //---------------------------------------------------------------------------
  141. struct TUpdatesData
  142. {
  143. int ForVersion;
  144. int Version;
  145. UnicodeString Message;
  146. bool Critical;
  147. UnicodeString Release;
  148. bool Disabled;
  149. UnicodeString Url;
  150. UnicodeString UrlButton;
  151. UnicodeString NewsUrl;
  152. TSize NewsSize;
  153. UnicodeString DownloadUrl;
  154. __int64 DownloadSize;
  155. UnicodeString DownloadSha256;
  156. UnicodeString AuthenticationError;
  157. bool OpenGettingStarted;
  158. UnicodeString DownloadingUrl;
  159. TSize TipsSize;
  160. UnicodeString TipsUrl;
  161. UnicodeString Tips;
  162. int TipsIntervalDays;
  163. int TipsIntervalRuns;
  164. bool __fastcall operator !=(TUpdatesData & rhc)
  165. { return C(ForVersion) C(Version) C(Message) C(Critical) C(Release)
  166. C(Disabled) C(Url) C(UrlButton) C(NewsUrl) C(NewsSize)
  167. C(DownloadUrl) C(DownloadSize) C(DownloadSha256) C(AuthenticationError)
  168. C(OpenGettingStarted) C(DownloadingUrl)
  169. C(TipsSize) C(TipsUrl) C(Tips) C(TipsIntervalDays) C(TipsIntervalRuns) 0; };
  170. void Reset()
  171. {
  172. ForVersion = 0;
  173. Version = 0;
  174. Message = L"";
  175. Critical = false;
  176. Release = L"";
  177. Disabled = false;
  178. Url = L"";
  179. UrlButton = L"";
  180. NewsUrl = L"";
  181. NewsSize = TSize();
  182. DownloadUrl = L"";
  183. DownloadSize = 0;
  184. DownloadSha256 = L"";
  185. AuthenticationError = L"";
  186. OpenGettingStarted = false;
  187. DownloadingUrl = L"";
  188. TipsSize = TSize();
  189. TipsUrl = L"";
  190. Tips = L"";
  191. TipsIntervalDays = 7;
  192. TipsIntervalRuns = 5;
  193. }
  194. };
  195. //---------------------------------------------------------------------------
  196. enum TConnectionType { ctDirect, ctAuto, ctProxy };
  197. //---------------------------------------------------------------------------
  198. struct TUpdatesConfiguration
  199. {
  200. TDateTime Period;
  201. TDateTime LastCheck;
  202. TConnectionType ConnectionType;
  203. UnicodeString ProxyHost;
  204. int ProxyPort;
  205. TAutoSwitch BetaVersions;
  206. bool ShowOnStartup;
  207. UnicodeString AuthenticationEmail;
  208. bool HaveResults;
  209. bool ShownResults;
  210. UnicodeString DotNetVersion;
  211. UnicodeString ConsoleVersion;
  212. TUpdatesData Results;
  213. bool __fastcall operator !=(TUpdatesConfiguration & rhc)
  214. { return C(Period) C(LastCheck) C(ConnectionType) C(ProxyHost) C(ProxyPort)
  215. C(BetaVersions) C(ShowOnStartup) C(AuthenticationEmail)
  216. C(HaveResults) C(ShownResults) C(DotNetVersion)
  217. C(ConsoleVersion) C(Results) 0; };
  218. bool __fastcall HaveValidResultsForVersion(int CompoundVersion)
  219. {
  220. return
  221. HaveResults &&
  222. (double(Period) > 0) &&
  223. (Results.ForVersion == CompoundVersion);
  224. }
  225. };
  226. //---------------------------------------------------------------------------
  227. struct TEditorData
  228. {
  229. __fastcall TEditorData();
  230. __fastcall TEditorData(const TEditorData & Source);
  231. TFileMasks FileMask;
  232. TEditor Editor;
  233. UnicodeString ExternalEditor;
  234. bool ExternalEditorText;
  235. bool SDIExternalEditor;
  236. bool DetectMDIExternalEditor;
  237. bool __fastcall operator ==(const TEditorData & rhd) const;
  238. void __fastcall DecideExternalEditorText();
  239. static bool __fastcall DecideExternalEditorText(UnicodeString ExternalEditor);
  240. };
  241. //---------------------------------------------------------------------------
  242. #undef C
  243. //---------------------------------------------------------------------------
  244. class TEditorPreferences
  245. {
  246. public:
  247. __fastcall TEditorPreferences();
  248. __fastcall TEditorPreferences(const TEditorData & Data);
  249. bool __fastcall Matches(const UnicodeString FileName, bool Local,
  250. const TFileMasks::TParams & Params) const;
  251. void __fastcall Load(THierarchicalStorage * Storage, bool Legacy);
  252. void __fastcall Save(THierarchicalStorage * Storage) const;
  253. void __fastcall LegacyDefaults();
  254. UnicodeString __fastcall ExtractExternalEditorName() const;
  255. static UnicodeString __fastcall GetDefaultExternalEditor();
  256. bool __fastcall operator ==(const TEditorPreferences & rhp) const;
  257. __property const TEditorData * Data = { read = GetConstData };
  258. __property UnicodeString Name = { read = GetName };
  259. TEditorData * __fastcall GetData();
  260. private:
  261. TEditorData FData;
  262. mutable UnicodeString FName;
  263. UnicodeString __fastcall GetName() const;
  264. const TEditorData * __fastcall GetConstData() const { return &FData; };
  265. };
  266. //---------------------------------------------------------------------------
  267. class TEditorList
  268. {
  269. public:
  270. __fastcall TEditorList();
  271. virtual __fastcall ~TEditorList();
  272. const TEditorPreferences * __fastcall Find(const UnicodeString FileName,
  273. bool Local, const TFileMasks::TParams & Params) const;
  274. void __fastcall Load(THierarchicalStorage * Storage);
  275. void __fastcall Save(THierarchicalStorage * Storage) const;
  276. TEditorList & __fastcall operator=(const TEditorList & rhl);
  277. bool __fastcall operator==(const TEditorList & rhl) const;
  278. void __fastcall Clear();
  279. void __fastcall Add(TEditorPreferences * Editor);
  280. void __fastcall Insert(int Index, TEditorPreferences * Editor);
  281. void __fastcall Change(int Index, TEditorPreferences * Editor);
  282. void __fastcall Move(int CurIndex, int NewIndex);
  283. void __fastcall Delete(int Index);
  284. void __fastcall Saved();
  285. bool __fastcall IsDefaultList() const;
  286. __property int Count = { read = GetCount };
  287. __property const TEditorPreferences * Editors[int Index] = { read = GetEditor };
  288. __property bool Modified = { read = FModified };
  289. private:
  290. TList * FEditors;
  291. bool FModified;
  292. int __fastcall GetCount() const;
  293. void __fastcall Init();
  294. void __fastcall Modify();
  295. const TEditorPreferences * __fastcall GetEditor(int Index) const;
  296. };
  297. //---------------------------------------------------------------------------
  298. class TBookmarks;
  299. class TBookmarkList;
  300. class TCustomCommandList;
  301. enum TPathInCaption { picShort, picFull, picNone };
  302. // constants must be compatible with legacy CopyOnDoubleClick
  303. enum TDoubleClickAction { dcaOpen = 0, dcaCopy = 1, dcaEdit = 2 };
  304. //---------------------------------------------------------------------------
  305. typedef void __fastcall (__closure *TMasterPasswordPromptEvent)();
  306. //---------------------------------------------------------------------------
  307. class TWinConfiguration : public TCustomWinConfiguration
  308. {
  309. private:
  310. UnicodeString FAutoStartSession;
  311. TDoubleClickAction FDoubleClickAction;
  312. bool FCopyOnDoubleClickConfirmation;
  313. bool FDDAllowMove;
  314. bool FDDAllowMoveInit;
  315. TAutoSwitch FDDTransferConfirmation;
  316. bool FDeleteToRecycleBin;
  317. bool FDimmHiddenFiles;
  318. bool FRenameWholeName;
  319. bool FLogWindowOnStartup;
  320. UnicodeString FLogWindowParams;
  321. TScpCommanderConfiguration FScpCommander;
  322. TScpExplorerConfiguration FScpExplorer;
  323. bool FSelectDirectories;
  324. UnicodeString FSelectMask;
  325. bool FShowHiddenFiles;
  326. TFormatBytesStyle FFormatSizeBytes;
  327. bool FShowInaccesibleDirectories;
  328. bool FConfirmTransferring;
  329. bool FConfirmDeleting;
  330. bool FConfirmRecycling;
  331. bool FUseLocationProfiles;
  332. bool FUseSharedBookmarks;
  333. UnicodeString FDDTemporaryDirectory;
  334. bool FDDWarnLackOfTempSpace;
  335. bool FDDExtEnabled;
  336. int FDDExtInstalled;
  337. int FDDExtTimeout;
  338. bool FConfirmClosingSession;
  339. double FDDWarnLackOfTempSpaceRatio;
  340. UnicodeString FTemporarySessionFile;
  341. UnicodeString FTemporaryKeyFile;
  342. TBookmarks * FBookmarks;
  343. TCustomCommandList * FCustomCommandList;
  344. bool FCustomCommandsDefaults;
  345. TEditorConfiguration FEditor;
  346. TQueueViewConfiguration FQueueView;
  347. bool FEnableQueueByDefault;
  348. bool FEmbeddedSessions;
  349. bool FExpertMode;
  350. bool FDisableOpenEdit;
  351. bool FDefaultDirIsHome;
  352. int FDDDeleteDelay;
  353. bool FTemporaryDirectoryAppendSession;
  354. bool FTemporaryDirectoryAppendPath;
  355. bool FTemporaryDirectoryDeterministic;
  356. bool FTemporaryDirectoryCleanup;
  357. bool FConfirmTemporaryDirectoryCleanup;
  358. UnicodeString FDefaultTranslationFile;
  359. UnicodeString FInvalidDefaultTranslationMessage;
  360. bool FPreservePanelState;
  361. UnicodeString FTheme;
  362. UnicodeString FLastStoredSession;
  363. UnicodeString FLastWorkspace;
  364. bool FAutoSaveWorkspace;
  365. bool FAutoSaveWorkspacePasswords;
  366. UnicodeString FAutoWorkspace;
  367. TPathInCaption FPathInCaption;
  368. bool FMinimizeToTray;
  369. bool FMinimizeToTrayOnce;
  370. bool FBalloonNotifications;
  371. unsigned int FNotificationsTimeout;
  372. unsigned int FNotificationsStickTime;
  373. TUpdatesConfiguration FUpdates;
  374. UnicodeString FVersionHistory;
  375. bool FCopyParamAutoSelectNotice;
  376. bool FLockToolbars;
  377. bool FSelectiveToolbarText;
  378. TEditorList * FEditorList;
  379. TEditorPreferences * FLegacyEditor;
  380. UnicodeString FDefaultKeyFile;
  381. bool FAutoOpenInPutty;
  382. TDateTime FDefaultUpdatesPeriod;
  383. bool FRefreshRemotePanel;
  384. TDateTime FRefreshRemotePanelInterval;
  385. TFontConfiguration FPanelFont;
  386. bool FFullRowSelect;
  387. bool FOfferedEditorAutoConfig;
  388. bool FUseMasterPassword;
  389. UnicodeString FPlainMasterPasswordEncrypt;
  390. UnicodeString FPlainMasterPasswordDecrypt;
  391. UnicodeString FMasterPasswordVerifier;
  392. TMasterPasswordPromptEvent FOnMasterPasswordPrompt;
  393. UnicodeString FOpenedStoredSessionFolders;
  394. bool FAutoImportedFromPuttyOrFilezilla;
  395. int FGenerateUrlComponents;
  396. TGenerateUrlCodeTarget FGenerateUrlCodeTarget;
  397. TScriptFormat FGenerateUrlScriptFormat;
  398. TAssemblyLanguage FGenerateUrlAssemblyLanguage;
  399. bool FExternalSessionInExistingInstance;
  400. bool FKeepOpenWhenNoSession;
  401. bool FLocalIconsByExt;
  402. bool FShowTips;
  403. UnicodeString FTipsSeen;
  404. TDateTime FTipsShown;
  405. int FRunsSinceLastTip;
  406. int FDontDecryptPasswords;
  407. int FMasterPasswordSession;
  408. bool FMasterPasswordSessionAsked;
  409. std::unique_ptr<TFont> FSystemIconFont;
  410. void __fastcall SetDoubleClickAction(TDoubleClickAction value);
  411. void __fastcall SetCopyOnDoubleClickConfirmation(bool value);
  412. void __fastcall SetDDAllowMove(bool value);
  413. void __fastcall SetDDAllowMoveInit(bool value);
  414. void __fastcall SetDDTransferConfirmation(TAutoSwitch value);
  415. void __fastcall SetDeleteToRecycleBin(bool value);
  416. void __fastcall SetDimmHiddenFiles(bool value);
  417. void __fastcall SetRenameWholeName(bool value);
  418. void __fastcall SetLogWindowOnStartup(bool value);
  419. void __fastcall SetLogWindowParams(UnicodeString value);
  420. void __fastcall SetScpCommander(TScpCommanderConfiguration value);
  421. void __fastcall SetScpExplorer(TScpExplorerConfiguration value);
  422. void __fastcall SetSelectDirectories(bool value);
  423. void __fastcall SetShowHiddenFiles(bool value);
  424. void __fastcall SetFormatSizeBytes(TFormatBytesStyle value);
  425. void __fastcall SetShowInaccesibleDirectories(bool value);
  426. void __fastcall SetConfirmTransferring(bool value);
  427. void __fastcall SetConfirmDeleting(bool value);
  428. void __fastcall SetConfirmRecycling(bool value);
  429. void __fastcall SetUseLocationProfiles(bool value);
  430. void __fastcall SetUseSharedBookmarks(bool value);
  431. void __fastcall SetDDTemporaryDirectory(UnicodeString value);
  432. void __fastcall SetDDWarnLackOfTempSpace(bool value);
  433. void __fastcall SetDDExtEnabled(bool value);
  434. void __fastcall SetDDExtTimeout(int value);
  435. void __fastcall SetConfirmClosingSession(bool value);
  436. void __fastcall SetDDWarnLackOfTempSpaceRatio(double value);
  437. void __fastcall SetBookmarks(UnicodeString Key, TBookmarkList * value);
  438. TBookmarkList * __fastcall GetBookmarks(UnicodeString Key);
  439. void __fastcall SetSharedBookmarks(TBookmarkList * value);
  440. TBookmarkList * __fastcall GetSharedBookmarks();
  441. void __fastcall SetAutoStartSession(UnicodeString value);
  442. void __fastcall SetExpertMode(bool value);
  443. void __fastcall SetDefaultDirIsHome(bool value);
  444. void __fastcall SetEditor(TEditorConfiguration value);
  445. void __fastcall SetQueueView(TQueueViewConfiguration value);
  446. void __fastcall SetEnableQueueByDefault(bool value);
  447. void __fastcall SetCustomCommandList(TCustomCommandList * value);
  448. void __fastcall SetTemporaryDirectoryAppendSession(bool value);
  449. void __fastcall SetTemporaryDirectoryAppendPath(bool value);
  450. void __fastcall SetTemporaryDirectoryDeterministic(bool value);
  451. void __fastcall SetTemporaryDirectoryCleanup(bool value);
  452. void __fastcall SetConfirmTemporaryDirectoryCleanup(bool value);
  453. void __fastcall SetPreservePanelState(bool value);
  454. void __fastcall SetTheme(UnicodeString value);
  455. void __fastcall SetLastStoredSession(UnicodeString value);
  456. void __fastcall SetAutoSaveWorkspace(bool value);
  457. void __fastcall SetAutoSaveWorkspacePasswords(bool value);
  458. void __fastcall SetAutoWorkspace(UnicodeString value);
  459. void __fastcall SetPathInCaption(TPathInCaption value);
  460. void __fastcall SetMinimizeToTray(bool value);
  461. bool __fastcall GetMinimizeToTray();
  462. void __fastcall SetBalloonNotifications(bool value);
  463. void __fastcall SetNotificationsTimeout(unsigned int value);
  464. void __fastcall SetNotificationsStickTime(unsigned int value);
  465. void __fastcall SetCopyParamAutoSelectNotice(bool value);
  466. TUpdatesConfiguration __fastcall GetUpdates();
  467. void __fastcall SetUpdates(TUpdatesConfiguration value);
  468. void __fastcall SetVersionHistory(UnicodeString value);
  469. void __fastcall SetLockToolbars(bool value);
  470. void __fastcall SetSelectiveToolbarText(bool value);
  471. const TEditorList * __fastcall GetEditorList();
  472. void __fastcall SetEditorList(const TEditorList * value);
  473. void __fastcall SetAutoOpenInPutty(bool value);
  474. void __fastcall SetRefreshRemotePanel(bool value);
  475. void __fastcall SetRefreshRemotePanelInterval(TDateTime value);
  476. void __fastcall SetPanelFont(const TFontConfiguration & value);
  477. void __fastcall SetFullRowSelect(bool value);
  478. void __fastcall SetOfferedEditorAutoConfig(bool value);
  479. void __fastcall SetLastMonitor(int value);
  480. int __fastcall GetLastMonitor();
  481. void __fastcall SetOpenedStoredSessionFolders(UnicodeString value);
  482. void __fastcall SetAutoImportedFromPuttyOrFilezilla(bool value);
  483. void __fastcall SetGenerateUrlComponents(int value);
  484. void __fastcall SetGenerateUrlCodeTarget(TGenerateUrlCodeTarget value);
  485. void __fastcall SetGenerateUrlScriptFormat(TScriptFormat value);
  486. void __fastcall SetGenerateUrlAssemblyLanguage(TAssemblyLanguage value);
  487. void __fastcall SetExternalSessionInExistingInstance(bool value);
  488. void __fastcall SetKeepOpenWhenNoSession(bool value);
  489. void __fastcall SetLocalIconsByExt(bool value);
  490. void __fastcall SetShowTips(bool value);
  491. void __fastcall SetTipsSeen(UnicodeString value);
  492. void __fastcall SetTipsShown(TDateTime value);
  493. void __fastcall SetRunsSinceLastTip(int value);
  494. bool __fastcall GetHonorDrivePolicy();
  495. void __fastcall SetHonorDrivePolicy(bool value);
  496. bool __fastcall GetIsBeta();
  497. TFont * __fastcall GetSystemIconFont();
  498. bool __fastcall GetDDExtInstalled();
  499. void __fastcall AddVersionToHistory();
  500. bool __fastcall GetAnyBetaInVersionHistory();
  501. void __fastcall PurgePassword(UnicodeString & Password);
  502. void __fastcall UpdateEntryInJumpList(
  503. bool Session, const UnicodeString & Name, bool Add);
  504. TStringList * __fastcall LoadJumpList(THierarchicalStorage * Storage,
  505. UnicodeString Name);
  506. void __fastcall SaveJumpList(THierarchicalStorage * Storage,
  507. UnicodeString Name, TStringList * List);
  508. void __fastcall TrimJumpList(TStringList * List);
  509. void __fastcall UpdateSystemIconFont();
  510. void __fastcall UpdateIconFont();
  511. protected:
  512. virtual TStorage __fastcall GetStorage();
  513. virtual void __fastcall SaveData(THierarchicalStorage * Storage, bool All);
  514. virtual void __fastcall LoadData(THierarchicalStorage * Storage);
  515. virtual void __fastcall LoadFrom(THierarchicalStorage * Storage);
  516. virtual void __fastcall LoadAdmin(THierarchicalStorage * Storage);
  517. virtual void __fastcall CopyData(THierarchicalStorage * Source, THierarchicalStorage * Target);
  518. virtual UnicodeString __fastcall GetDefaultKeyFile();
  519. virtual void __fastcall Saved();
  520. void __fastcall RecryptPasswords(TStrings * RecryptPasswordErrors);
  521. virtual bool __fastcall GetUseMasterPassword();
  522. bool __fastcall SameStringLists(TStrings * Strings1, TStrings * Strings2);
  523. virtual HINSTANCE __fastcall LoadNewResourceModule(LCID Locale,
  524. UnicodeString & FileName);
  525. virtual LCID __fastcall GetLocale();
  526. void __fastcall CheckTranslationVersion(const UnicodeString FileName,
  527. bool InternalLocaleOnError);
  528. virtual void __fastcall DefaultLocalized();
  529. bool __fastcall DetectRegistryStorage(HKEY RootKey);
  530. bool __fastcall CanWriteToStorage();
  531. bool __fastcall DoIsBeta(const UnicodeString & ReleaseType);
  532. void __fastcall AskForMasterPassword();
  533. public:
  534. __fastcall TWinConfiguration();
  535. virtual __fastcall ~TWinConfiguration();
  536. virtual void __fastcall Default();
  537. void __fastcall ClearTemporaryLoginData();
  538. virtual THierarchicalStorage * CreateScpStorage(bool & SessionList);
  539. UnicodeString __fastcall TemporaryDir(bool Mask = false);
  540. TStrings * __fastcall FindTemporaryFolders();
  541. void __fastcall CleanupTemporaryFolders(TStrings * Folders = NULL);
  542. UnicodeString __fastcall ExpandedTemporaryDirectory();
  543. void __fastcall CheckDefaultTranslation();
  544. const TEditorPreferences * __fastcall DefaultEditorForFile(
  545. const UnicodeString FileName, bool Local, const TFileMasks::TParams & MaskParams);
  546. virtual UnicodeString __fastcall DecryptPassword(RawByteString Password, UnicodeString Key);
  547. virtual RawByteString __fastcall StronglyRecryptPassword(RawByteString Password, UnicodeString Key);
  548. void __fastcall SetMasterPassword(UnicodeString value);
  549. void __fastcall ChangeMasterPassword(UnicodeString value, TStrings * RecryptPasswordErrors);
  550. bool __fastcall ValidateMasterPassword(UnicodeString value);
  551. void __fastcall ClearMasterPassword(TStrings * RecryptPasswordErrors);
  552. void __fastcall BeginMasterPasswordSession();
  553. void __fastcall EndMasterPasswordSession();
  554. virtual void __fastcall AskForMasterPasswordIfNotSet();
  555. void __fastcall AddSessionToJumpList(UnicodeString SessionName);
  556. void __fastcall DeleteSessionFromJumpList(UnicodeString SessionName);
  557. void __fastcall AddWorkspaceToJumpList(UnicodeString Workspace);
  558. void __fastcall DeleteWorkspaceFromJumpList(UnicodeString Workspace);
  559. void __fastcall UpdateJumpList();
  560. virtual void __fastcall UpdateStaticUsage();
  561. void __fastcall MinimizeToTrayOnce();
  562. static void __fastcall RestoreFont(const TFontConfiguration & Configuration, TFont * Font);
  563. static void __fastcall StoreFont(TFont * Font, TFontConfiguration & Configuration);
  564. __property TScpCommanderConfiguration ScpCommander = { read = FScpCommander, write = SetScpCommander };
  565. __property TScpExplorerConfiguration ScpExplorer = { read = FScpExplorer, write = SetScpExplorer };
  566. __property bool SelectDirectories = { read = FSelectDirectories, write = SetSelectDirectories };
  567. __property UnicodeString SelectMask = { read = FSelectMask, write = FSelectMask };
  568. __property bool ShowHiddenFiles = { read = FShowHiddenFiles, write = SetShowHiddenFiles };
  569. __property TFormatBytesStyle FormatSizeBytes = { read = FFormatSizeBytes, write = SetFormatSizeBytes };
  570. __property bool ShowInaccesibleDirectories = { read = FShowInaccesibleDirectories, write = SetShowInaccesibleDirectories };
  571. __property TEditorConfiguration Editor = { read = FEditor, write = SetEditor };
  572. __property TQueueViewConfiguration QueueView = { read = FQueueView, write = SetQueueView };
  573. __property bool EnableQueueByDefault = { read = FEnableQueueByDefault, write = SetEnableQueueByDefault };
  574. __property TUpdatesConfiguration Updates = { read = GetUpdates, write = SetUpdates };
  575. __property UnicodeString VersionHistory = { read = FVersionHistory, write = SetVersionHistory };
  576. __property bool AnyBetaInVersionHistory = { read = GetAnyBetaInVersionHistory };
  577. __property bool IsBeta = { read = GetIsBeta };
  578. __property UnicodeString AutoStartSession = { read = FAutoStartSession, write = SetAutoStartSession };
  579. __property TDoubleClickAction DoubleClickAction = { read = FDoubleClickAction, write = SetDoubleClickAction };
  580. __property bool CopyOnDoubleClickConfirmation = { read = FCopyOnDoubleClickConfirmation, write = SetCopyOnDoubleClickConfirmation };
  581. __property bool DDAllowMove = { read = FDDAllowMove, write = SetDDAllowMove };
  582. __property bool DDAllowMoveInit = { read = FDDAllowMoveInit, write = SetDDAllowMoveInit };
  583. __property TAutoSwitch DDTransferConfirmation = { read = FDDTransferConfirmation, write = SetDDTransferConfirmation };
  584. __property bool LogWindowOnStartup = { read = FLogWindowOnStartup, write = SetLogWindowOnStartup };
  585. __property bool DeleteToRecycleBin = { read = FDeleteToRecycleBin, write = SetDeleteToRecycleBin };
  586. __property bool DimmHiddenFiles = { read = FDimmHiddenFiles, write = SetDimmHiddenFiles };
  587. __property bool RenameWholeName = { read = FRenameWholeName, write = SetRenameWholeName };
  588. __property UnicodeString LogWindowParams = { read = FLogWindowParams, write = SetLogWindowParams };
  589. __property bool ConfirmTransferring = { read = FConfirmTransferring, write = SetConfirmTransferring};
  590. __property bool ConfirmDeleting = { read = FConfirmDeleting, write = SetConfirmDeleting};
  591. __property bool ConfirmRecycling = { read = FConfirmRecycling, write = SetConfirmRecycling};
  592. __property bool UseLocationProfiles = { read = FUseLocationProfiles, write = SetUseLocationProfiles};
  593. __property bool UseSharedBookmarks = { read = FUseSharedBookmarks, write = SetUseSharedBookmarks};
  594. __property UnicodeString DDTemporaryDirectory = { read=FDDTemporaryDirectory, write=SetDDTemporaryDirectory };
  595. __property bool DDWarnLackOfTempSpace = { read=FDDWarnLackOfTempSpace, write=SetDDWarnLackOfTempSpace };
  596. __property bool DDExtEnabled = { read=FDDExtEnabled, write=SetDDExtEnabled };
  597. __property bool DDExtInstalled = { read=GetDDExtInstalled };
  598. __property int DDExtTimeout = { read=FDDExtTimeout, write=SetDDExtTimeout };
  599. __property bool ConfirmClosingSession = { read=FConfirmClosingSession, write=SetConfirmClosingSession };
  600. __property double DDWarnLackOfTempSpaceRatio = { read=FDDWarnLackOfTempSpaceRatio, write=SetDDWarnLackOfTempSpaceRatio };
  601. __property TBookmarkList * Bookmarks[UnicodeString Key] = { read = GetBookmarks, write = SetBookmarks };
  602. __property TBookmarkList * SharedBookmarks = { read = GetSharedBookmarks, write = SetSharedBookmarks };
  603. __property bool EmbeddedSessions = { read = FEmbeddedSessions };
  604. __property bool ExpertMode = { read = FExpertMode, write = SetExpertMode };
  605. __property bool DefaultDirIsHome = { read = FDefaultDirIsHome, write = SetDefaultDirIsHome };
  606. __property bool DisableOpenEdit = { read = FDisableOpenEdit };
  607. __property TCustomCommandList * CustomCommandList = { read = FCustomCommandList, write = SetCustomCommandList };
  608. __property int DDDeleteDelay = { read = FDDDeleteDelay };
  609. __property bool TemporaryDirectoryAppendSession = { read = FTemporaryDirectoryAppendSession, write = SetTemporaryDirectoryAppendSession };
  610. __property bool TemporaryDirectoryAppendPath = { read = FTemporaryDirectoryAppendPath, write = SetTemporaryDirectoryAppendPath };
  611. __property bool TemporaryDirectoryDeterministic = { read = FTemporaryDirectoryDeterministic, write = SetTemporaryDirectoryDeterministic };
  612. __property bool TemporaryDirectoryCleanup = { read = FTemporaryDirectoryCleanup, write = SetTemporaryDirectoryCleanup };
  613. __property bool ConfirmTemporaryDirectoryCleanup = { read = FConfirmTemporaryDirectoryCleanup, write = SetConfirmTemporaryDirectoryCleanup };
  614. __property bool PreservePanelState = { read = FPreservePanelState, write = SetPreservePanelState };
  615. __property UnicodeString Theme = { read = FTheme, write = SetTheme };
  616. __property UnicodeString LastStoredSession = { read = FLastStoredSession, write = SetLastStoredSession };
  617. __property UnicodeString LastWorkspace = { read = FLastWorkspace, write = FLastWorkspace };
  618. __property bool AutoSaveWorkspace = { read = FAutoSaveWorkspace, write = SetAutoSaveWorkspace };
  619. __property bool AutoSaveWorkspacePasswords = { read = FAutoSaveWorkspacePasswords, write = SetAutoSaveWorkspacePasswords };
  620. __property UnicodeString AutoWorkspace = { read = FAutoWorkspace, write = SetAutoWorkspace };
  621. __property TPathInCaption PathInCaption = { read = FPathInCaption, write = SetPathInCaption };
  622. __property bool MinimizeToTray = { read = GetMinimizeToTray, write = SetMinimizeToTray };
  623. __property bool BalloonNotifications = { read = FBalloonNotifications, write = SetBalloonNotifications };
  624. __property unsigned int NotificationsTimeout = { read = FNotificationsTimeout, write = SetNotificationsTimeout };
  625. __property unsigned int NotificationsStickTime = { read = FNotificationsStickTime, write = SetNotificationsStickTime };
  626. __property UnicodeString DefaultTranslationFile = { read = FDefaultTranslationFile };
  627. __property bool CopyParamAutoSelectNotice = { read = FCopyParamAutoSelectNotice, write = SetCopyParamAutoSelectNotice };
  628. __property bool LockToolbars = { read = FLockToolbars, write = SetLockToolbars };
  629. __property bool SelectiveToolbarText = { read = FSelectiveToolbarText, write = SetSelectiveToolbarText };
  630. __property bool AutoOpenInPutty = { read = FAutoOpenInPutty, write = SetAutoOpenInPutty };
  631. __property bool RefreshRemotePanel = { read = FRefreshRemotePanel, write = SetRefreshRemotePanel };
  632. __property TDateTime RefreshRemotePanelInterval = { read = FRefreshRemotePanelInterval, write = SetRefreshRemotePanelInterval };
  633. __property TFontConfiguration PanelFont = { read = FPanelFont, write = SetPanelFont };
  634. __property bool FullRowSelect = { read = FFullRowSelect, write = SetFullRowSelect };
  635. __property bool OfferedEditorAutoConfig = { read = FOfferedEditorAutoConfig, write = SetOfferedEditorAutoConfig };
  636. __property int LastMonitor = { read = GetLastMonitor, write = SetLastMonitor };
  637. __property const TEditorList * EditorList = { read = GetEditorList, write = SetEditorList };
  638. __property UnicodeString DefaultKeyFile = { read = GetDefaultKeyFile, write = FDefaultKeyFile };
  639. __property UnicodeString OpenedStoredSessionFolders = { read = FOpenedStoredSessionFolders, write = SetOpenedStoredSessionFolders };
  640. __property bool AutoImportedFromPuttyOrFilezilla = { read = FAutoImportedFromPuttyOrFilezilla, write = SetAutoImportedFromPuttyOrFilezilla };
  641. __property int GenerateUrlComponents = { read = FGenerateUrlComponents, write = SetGenerateUrlComponents };
  642. __property TGenerateUrlCodeTarget GenerateUrlCodeTarget = { read = FGenerateUrlCodeTarget, write = SetGenerateUrlCodeTarget };
  643. __property TScriptFormat GenerateUrlScriptFormat = { read = FGenerateUrlScriptFormat, write = SetGenerateUrlScriptFormat };
  644. __property TAssemblyLanguage GenerateUrlAssemblyLanguage = { read = FGenerateUrlAssemblyLanguage, write = SetGenerateUrlAssemblyLanguage };
  645. __property bool ExternalSessionInExistingInstance = { read = FExternalSessionInExistingInstance, write = SetExternalSessionInExistingInstance };
  646. __property bool KeepOpenWhenNoSession = { read = FKeepOpenWhenNoSession, write = SetKeepOpenWhenNoSession };
  647. __property bool LocalIconsByExt = { read = FLocalIconsByExt, write = SetLocalIconsByExt };
  648. __property bool ShowTips = { read = FShowTips, write = SetShowTips };
  649. __property UnicodeString TipsSeen = { read = FTipsSeen, write = SetTipsSeen };
  650. __property TDateTime TipsShown = { read = FTipsShown, write = SetTipsShown };
  651. __property int RunsSinceLastTip = { read = FRunsSinceLastTip, write = SetRunsSinceLastTip };
  652. __property bool HonorDrivePolicy = { read = GetHonorDrivePolicy, write = SetHonorDrivePolicy };
  653. __property TMasterPasswordPromptEvent OnMasterPasswordPrompt = { read = FOnMasterPasswordPrompt, write = FOnMasterPasswordPrompt };
  654. __property TFont * SystemIconFont = { read = GetSystemIconFont };
  655. };
  656. //---------------------------------------------------------------------------
  657. class TCustomCommandType
  658. {
  659. public:
  660. __fastcall TCustomCommandType();
  661. __fastcall TCustomCommandType(const TCustomCommandType & Other);
  662. TCustomCommandType & operator=(const TCustomCommandType & Other);
  663. bool __fastcall Equals(const TCustomCommandType * Other) const;
  664. __property UnicodeString Name = { read = FName, write = FName };
  665. __property UnicodeString Command = { read = FCommand, write = FCommand };
  666. __property int Params = { read = FParams, write = FParams };
  667. __property TShortCut ShortCut = { read = FShortCut, write = FShortCut };
  668. private:
  669. UnicodeString FName;
  670. UnicodeString FCommand;
  671. int FParams;
  672. TShortCut FShortCut;
  673. };
  674. //---------------------------------------------------------------------------
  675. class TCustomCommandList
  676. {
  677. public:
  678. __fastcall TCustomCommandList();
  679. __fastcall ~TCustomCommandList();
  680. void __fastcall Load(THierarchicalStorage * Storage);
  681. void __fastcall Save(THierarchicalStorage * Storage);
  682. void __fastcall Reset();
  683. void __fastcall Modify();
  684. void __fastcall Clear();
  685. void __fastcall Add(const UnicodeString Name, const UnicodeString Command, int Params);
  686. void __fastcall Add(TCustomCommandType * Command);
  687. void __fastcall Insert(int Index, TCustomCommandType * Command);
  688. void __fastcall Change(int Index, TCustomCommandType * Command);
  689. void __fastcall Move(int CurIndex, int NewIndex);
  690. void __fastcall Delete(int Index);
  691. const TCustomCommandType * Find(const UnicodeString Name) const;
  692. const TCustomCommandType * Find(TShortCut ShortCut) const;
  693. bool __fastcall Equals(const TCustomCommandList * Other) const;
  694. void __fastcall Assign(const TCustomCommandList * Other);
  695. void __fastcall ShortCuts(TShortCuts & ShortCuts) const;
  696. __property bool Modified = { read = FModified };
  697. __property int Count = { read = GetCount };
  698. __property const TCustomCommandType * Commands[int Index] = { read = GetConstCommand };
  699. private:
  700. bool FModified;
  701. TList * FCommands;
  702. int __fastcall GetCount() const;
  703. const TCustomCommandType * __fastcall GetConstCommand(int Index) const;
  704. TCustomCommandType * __fastcall GetCommand(int Index);
  705. };
  706. //---------------------------------------------------------------------------
  707. extern TWinConfiguration * WinConfiguration;
  708. //---------------------------------------------------------------------------
  709. #endif