CustomWinConfiguration.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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. //---------------------------------------------------------------------------
  20. #define C(Property) (Property != rhc.Property) ||
  21. struct TSynchronizeChecklistConfiguration
  22. {
  23. UnicodeString WindowParams;
  24. UnicodeString ListParams;
  25. bool __fastcall operator !=(TSynchronizeChecklistConfiguration & rhc)
  26. { return C(WindowParams) C(ListParams) 0; };
  27. };
  28. typedef TSynchronizeChecklistConfiguration TFindFileConfiguration;
  29. //---------------------------------------------------------------------------
  30. struct TConsoleWinConfiguration
  31. {
  32. UnicodeString WindowSize;
  33. bool __fastcall operator !=(TConsoleWinConfiguration & rhc)
  34. { return C(WindowSize) 0; };
  35. };
  36. //---------------------------------------------------------------------------
  37. enum TIncrementalSearch { isOff = -1, isNameStartOnly, isName, isAll };
  38. //---------------------------------------------------------------------------
  39. struct TLoginDialogConfiguration : public TConsoleWinConfiguration
  40. {
  41. TIncrementalSearch SiteSearch;
  42. bool __fastcall operator !=(TLoginDialogConfiguration & rhc)
  43. { return (TConsoleWinConfiguration::operator !=(rhc)) || C(SiteSearch) 0; };
  44. };
  45. //---------------------------------------------------------------------------
  46. class TCustomWinConfiguration : public TGUIConfiguration
  47. {
  48. static const int MaxHistoryCount = 50;
  49. private:
  50. TInterface FInterface;
  51. TInterface FAppliedInterface;
  52. TStringList * FHistory;
  53. TStrings * FEmptyHistory;
  54. TSynchronizeChecklistConfiguration FSynchronizeChecklist;
  55. TFindFileConfiguration FFindFile;
  56. TConsoleWinConfiguration FConsoleWin;
  57. TLoginDialogConfiguration FLoginDialog;
  58. TInterface FDefaultInterface;
  59. bool FCanApplyInterfaceImmediately;
  60. bool FConfirmExitOnCompletion;
  61. bool FSynchronizeSummary;
  62. UnicodeString FSessionColors;
  63. UnicodeString FFontColors;
  64. bool FCopyShortCutHintShown;
  65. bool FHttpForWebDAV;
  66. TNotifyEvent FOnMasterPasswordRecrypt;
  67. UnicodeString FDefaultFixedWidthFontName;
  68. int FDefaultFixedWidthFontSize;
  69. void __fastcall SetInterface(TInterface value);
  70. void __fastcall SetHistory(const UnicodeString Index, TStrings * value);
  71. TStrings * __fastcall GetHistory(const UnicodeString Index);
  72. void __fastcall SetSynchronizeChecklist(TSynchronizeChecklistConfiguration value);
  73. void __fastcall SetFindFile(TFindFileConfiguration value);
  74. void __fastcall SetConsoleWin(TConsoleWinConfiguration value);
  75. void __fastcall SetLoginDialog(TLoginDialogConfiguration value);
  76. void __fastcall SetConfirmExitOnCompletion(bool value);
  77. void __fastcall SetSynchronizeSummary(bool value);
  78. UnicodeString __fastcall GetDefaultFixedWidthFontName();
  79. int __fastcall GetDefaultFixedWidthFontSize();
  80. protected:
  81. virtual void __fastcall SaveData(THierarchicalStorage * Storage, bool All);
  82. virtual void __fastcall LoadData(THierarchicalStorage * Storage);
  83. virtual void __fastcall LoadAdmin(THierarchicalStorage * Storage);
  84. virtual void __fastcall Saved();
  85. void __fastcall ClearHistory();
  86. virtual void __fastcall DefaultHistory();
  87. void __fastcall RecryptPasswords(TStrings * RecryptPasswordErrors);
  88. virtual bool __fastcall GetUseMasterPassword() = 0;
  89. UnicodeString __fastcall FormatDefaultWindowParams(int Width, int Height);
  90. UnicodeString __fastcall FormatDefaultWindowSize(int Width, int Height);
  91. public:
  92. __fastcall TCustomWinConfiguration();
  93. virtual __fastcall ~TCustomWinConfiguration();
  94. virtual void __fastcall Default();
  95. virtual void __fastcall AskForMasterPasswordIfNotSet() = 0;
  96. void __fastcall AskForMasterPasswordIfNotSetAndNeededToPersistSessionData(TSessionData * SessionData);
  97. static UnicodeString __fastcall GetValidHistoryKey(UnicodeString Key);
  98. __property TInterface Interface = { read = FInterface, write = SetInterface };
  99. __property TInterface AppliedInterface = { read = FAppliedInterface, write = FAppliedInterface };
  100. __property bool CanApplyInterfaceImmediately = { read = FCanApplyInterfaceImmediately, write = FCanApplyInterfaceImmediately };
  101. __property TStrings * History[UnicodeString Name] = { read = GetHistory, write = SetHistory };
  102. __property TSynchronizeChecklistConfiguration SynchronizeChecklist = { read = FSynchronizeChecklist, write = SetSynchronizeChecklist };
  103. __property TFindFileConfiguration FindFile = { read = FFindFile, write = SetFindFile };
  104. __property TConsoleWinConfiguration ConsoleWin = { read = FConsoleWin, write = SetConsoleWin };
  105. __property TLoginDialogConfiguration LoginDialog = { read = FLoginDialog, write = SetLoginDialog };
  106. __property bool ConfirmExitOnCompletion = { read=FConfirmExitOnCompletion, write=SetConfirmExitOnCompletion };
  107. __property bool SynchronizeSummary = { read = FSynchronizeSummary, write = SetSynchronizeSummary };
  108. __property UnicodeString SessionColors = { read=FSessionColors, write=FSessionColors };
  109. __property UnicodeString FontColors = { read=FFontColors, write=FFontColors };
  110. __property bool CopyShortCutHintShown = { read=FCopyShortCutHintShown, write=FCopyShortCutHintShown };
  111. __property bool UseMasterPassword = { read = GetUseMasterPassword };
  112. __property bool HttpForWebDAV = { read = FHttpForWebDAV, write = FHttpForWebDAV };
  113. __property TNotifyEvent OnMasterPasswordRecrypt = { read = FOnMasterPasswordRecrypt, write = FOnMasterPasswordRecrypt };
  114. __property UnicodeString DefaultFixedWidthFontName = { read = GetDefaultFixedWidthFontName };
  115. __property int DefaultFixedWidthFontSize = { read = GetDefaultFixedWidthFontSize };
  116. };
  117. //---------------------------------------------------------------------------
  118. extern TCustomWinConfiguration * CustomWinConfiguration;
  119. //---------------------------------------------------------------------------
  120. #endif