CustomWinConfiguration.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. //---------------------------------------------------------------------------
  2. #ifndef CustomWinConfigurationH
  3. #define CustomWinConfigurationH
  4. //---------------------------------------------------------------------------
  5. #include "GUIConfiguration.h"
  6. #define WM_WINSCP_USER (WM_USER + 0x2000)
  7. // WM_USER_STOP = WM_WINSCP_USER + 2 (in forms/Synchronize.cpp)
  8. // WM_INTERUPT_IDLE = WM_WINSCP_USER + 3 (in windows/ConsoleRunner.cpp)
  9. // WM_COMPONENT_HIDE = WM_WINSCP_USER + 4 (forms/CustomScpExplorer.cpp)
  10. // WM_TRAY_ICON = WM_WINSCP_USER + 5 (forms/CustomScpExplorer.cpp)
  11. // WM_WINSCP_USER + 6 was WM_LOG_UPDATE
  12. #define WM_MANAGES_CAPTION (WM_WINSCP_USER + 7)
  13. #define WM_WANTS_MOUSEWHEEL (WM_WINSCP_USER + 8)
  14. #define WM_CAN_DISPLAY_UPDATES (WM_WINSCP_USER + 9)
  15. // CM_DPICHANGED + 10 (packages/my/PasTools.pas)
  16. #define WM_WANTS_MOUSEWHEEL_INACTIVE (WM_WINSCP_USER + 11)
  17. #define WM_WANTS_SCREEN_TIPS (WM_WINSCP_USER + 12)
  18. // WM_USER_SHCHANGENOTIFY + 13 (packages/filemng/DriveView.pas)
  19. // WM_PASTE_FILES + 14 (forms/CustomScpExplorer.cpp)
  20. //---------------------------------------------------------------------------
  21. #define C(Property) (Property != rhc.Property) ||
  22. struct TSynchronizeChecklistConfiguration
  23. {
  24. UnicodeString WindowParams;
  25. UnicodeString ListParams;
  26. bool __fastcall operator !=(TSynchronizeChecklistConfiguration & rhc)
  27. { return C(WindowParams) C(ListParams) 0; };
  28. };
  29. typedef TSynchronizeChecklistConfiguration TFindFileConfiguration;
  30. //---------------------------------------------------------------------------
  31. struct TConsoleWinConfiguration
  32. {
  33. UnicodeString WindowSize;
  34. bool __fastcall operator !=(TConsoleWinConfiguration & rhc)
  35. { return C(WindowSize) 0; };
  36. };
  37. //---------------------------------------------------------------------------
  38. enum TIncrementalSearch { isOff = -1, isNameStartOnly, isName, isAll };
  39. //---------------------------------------------------------------------------
  40. struct TLoginDialogConfiguration : public TConsoleWinConfiguration
  41. {
  42. TIncrementalSearch SiteSearch;
  43. bool __fastcall operator !=(TLoginDialogConfiguration & rhc)
  44. { return (TConsoleWinConfiguration::operator !=(rhc)) || C(SiteSearch) 0; };
  45. };
  46. //---------------------------------------------------------------------------
  47. class TCustomWinConfiguration : public TGUIConfiguration
  48. {
  49. static const int MaxHistoryCount = 50;
  50. private:
  51. TInterface FInterface;
  52. TInterface FAppliedInterface;
  53. TStringList * FHistory;
  54. TStrings * FEmptyHistory;
  55. TSynchronizeChecklistConfiguration FSynchronizeChecklist;
  56. TFindFileConfiguration FFindFile;
  57. TConsoleWinConfiguration FConsoleWin;
  58. TLoginDialogConfiguration FLoginDialog;
  59. TInterface FDefaultInterface;
  60. bool FCanApplyInterfaceImmediately;
  61. bool FConfirmExitOnCompletion;
  62. bool FSynchronizeSummary;
  63. UnicodeString FSessionColors;
  64. UnicodeString FFontColors;
  65. bool FCopyShortCutHintShown;
  66. bool FHttpForWebDAV;
  67. TNotifyEvent FOnMasterPasswordRecrypt;
  68. UnicodeString FDefaultFixedWidthFontName;
  69. int FDefaultFixedWidthFontSize;
  70. void __fastcall SetInterface(TInterface value);
  71. void __fastcall SetHistory(const UnicodeString Index, TStrings * value);
  72. TStrings * __fastcall GetHistory(const UnicodeString Index);
  73. void __fastcall SetSynchronizeChecklist(TSynchronizeChecklistConfiguration value);
  74. void __fastcall SetFindFile(TFindFileConfiguration value);
  75. void __fastcall SetConsoleWin(TConsoleWinConfiguration value);
  76. void __fastcall SetLoginDialog(TLoginDialogConfiguration value);
  77. void __fastcall SetConfirmExitOnCompletion(bool value);
  78. void __fastcall SetSynchronizeSummary(bool value);
  79. UnicodeString __fastcall GetDefaultFixedWidthFontName();
  80. int __fastcall GetDefaultFixedWidthFontSize();
  81. protected:
  82. virtual void __fastcall SaveData(THierarchicalStorage * Storage, bool All);
  83. virtual void __fastcall LoadData(THierarchicalStorage * Storage);
  84. virtual void __fastcall LoadAdmin(THierarchicalStorage * Storage);
  85. virtual void __fastcall Saved();
  86. void __fastcall ClearHistory();
  87. virtual void __fastcall DefaultHistory();
  88. void __fastcall RecryptPasswords(TStrings * RecryptPasswordErrors);
  89. virtual bool __fastcall GetUseMasterPassword() = 0;
  90. UnicodeString __fastcall FormatDefaultWindowParams(int Width, int Height);
  91. UnicodeString __fastcall FormatDefaultWindowSize(int Width, int Height);
  92. public:
  93. __fastcall TCustomWinConfiguration();
  94. virtual __fastcall ~TCustomWinConfiguration();
  95. virtual void __fastcall Default();
  96. virtual void __fastcall AskForMasterPasswordIfNotSet() = 0;
  97. void __fastcall AskForMasterPasswordIfNotSetAndNeededToPersistSessionData(TSessionData * SessionData);
  98. static UnicodeString __fastcall GetValidHistoryKey(UnicodeString Key);
  99. __property TInterface Interface = { read = FInterface, write = SetInterface };
  100. __property TInterface AppliedInterface = { read = FAppliedInterface, write = FAppliedInterface };
  101. __property bool CanApplyInterfaceImmediately = { read = FCanApplyInterfaceImmediately, write = FCanApplyInterfaceImmediately };
  102. __property TStrings * History[UnicodeString Name] = { read = GetHistory, write = SetHistory };
  103. __property TSynchronizeChecklistConfiguration SynchronizeChecklist = { read = FSynchronizeChecklist, write = SetSynchronizeChecklist };
  104. __property TFindFileConfiguration FindFile = { read = FFindFile, write = SetFindFile };
  105. __property TConsoleWinConfiguration ConsoleWin = { read = FConsoleWin, write = SetConsoleWin };
  106. __property TLoginDialogConfiguration LoginDialog = { read = FLoginDialog, write = SetLoginDialog };
  107. __property bool ConfirmExitOnCompletion = { read=FConfirmExitOnCompletion, write=SetConfirmExitOnCompletion };
  108. __property bool SynchronizeSummary = { read = FSynchronizeSummary, write = SetSynchronizeSummary };
  109. __property UnicodeString SessionColors = { read=FSessionColors, write=FSessionColors };
  110. __property UnicodeString FontColors = { read=FFontColors, write=FFontColors };
  111. __property bool CopyShortCutHintShown = { read=FCopyShortCutHintShown, write=FCopyShortCutHintShown };
  112. __property bool UseMasterPassword = { read = GetUseMasterPassword };
  113. __property bool HttpForWebDAV = { read = FHttpForWebDAV, write = FHttpForWebDAV };
  114. __property TNotifyEvent OnMasterPasswordRecrypt = { read = FOnMasterPasswordRecrypt, write = FOnMasterPasswordRecrypt };
  115. __property UnicodeString DefaultFixedWidthFontName = { read = GetDefaultFixedWidthFontName };
  116. __property int DefaultFixedWidthFontSize = { read = GetDefaultFixedWidthFontSize };
  117. };
  118. //---------------------------------------------------------------------------
  119. extern TCustomWinConfiguration * CustomWinConfiguration;
  120. //---------------------------------------------------------------------------
  121. #endif