CustomWinConfiguration.h 6.8 KB

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