CustomWinConfiguration.h 4.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. //---------------------------------------------------------------------------
  2. #ifndef CustomWinConfigurationH
  3. #define CustomWinConfigurationH
  4. //---------------------------------------------------------------------------
  5. #include "GUIConfiguration.h"
  6. #define WM_WINSCP_USER (WM_USER + 0x2000)
  7. #define WM_LOCALE_CHANGE (WM_WINSCP_USER + 1)
  8. // WM_USER_STOP = WM_WINSCP_USER + 2 (in forms/Synchronize.cpp)
  9. // WM_INTERUPT_IDLE = WM_WINSCP_USER + 3 (in windows/ConsoleRunner.cpp)
  10. // WM_COMPONENT_HIDE = WM_WINSCP_USER + 4 (forms/CustomScpExplorer.cpp)
  11. // WM_TRAY_ICON = WM_WINSCP_USER + 5 (forms/CustomScpExplorer.cpp)
  12. // WM_LOG_UPDATE = WM_WINSCP_USER + 6 (components/LogMemo.cpp)
  13. //---------------------------------------------------------------------------
  14. #define C(Property) (Property != rhc.Property) ||
  15. struct TSynchronizeChecklistConfiguration
  16. {
  17. UnicodeString WindowParams;
  18. UnicodeString ListParams;
  19. bool __fastcall operator !=(TSynchronizeChecklistConfiguration & rhc)
  20. { return C(WindowParams) C(ListParams) 0; };
  21. };
  22. typedef TSynchronizeChecklistConfiguration TFindFileConfiguration;
  23. //---------------------------------------------------------------------------
  24. struct TConsoleWinConfiguration
  25. {
  26. UnicodeString WindowSize;
  27. bool __fastcall operator !=(TConsoleWinConfiguration & rhc)
  28. { return C(WindowSize) 0; };
  29. };
  30. //---------------------------------------------------------------------------
  31. class TCustomWinConfiguration : public TGUIConfiguration
  32. {
  33. static const int MaxHistoryCount = 50;
  34. private:
  35. TLogView FLogView;
  36. TInterface FInterface;
  37. bool FShowAdvancedLoginOptions;
  38. TStringList * FHistory;
  39. TStrings * FEmptyHistory;
  40. TSynchronizeChecklistConfiguration FSynchronizeChecklist;
  41. TFindFileConfiguration FFindFile;
  42. TConsoleWinConfiguration FConsoleWin;
  43. TInterface FDefaultInterface;
  44. bool FDefaultShowAdvancedLoginOptions;
  45. bool FConfirmExitOnCompletion;
  46. bool FOperationProgressOnTop;
  47. TNotifyEvent FOnMasterPasswordRecrypt;
  48. void __fastcall SetInterface(TInterface value);
  49. void __fastcall SetLogView(TLogView value);
  50. void __fastcall SetShowAdvancedLoginOptions(bool value);
  51. void __fastcall SetHistory(const UnicodeString Index, TStrings * value);
  52. TStrings * __fastcall GetHistory(const UnicodeString Index);
  53. void __fastcall SetSynchronizeChecklist(TSynchronizeChecklistConfiguration value);
  54. void __fastcall SetFindFile(TFindFileConfiguration value);
  55. void __fastcall SetConsoleWin(TConsoleWinConfiguration value);
  56. void __fastcall SetConfirmExitOnCompletion(bool value);
  57. protected:
  58. virtual void __fastcall SaveData(THierarchicalStorage * Storage, bool All);
  59. virtual void __fastcall LoadData(THierarchicalStorage * Storage);
  60. virtual void __fastcall LoadAdmin(THierarchicalStorage * Storage);
  61. virtual void __fastcall Saved();
  62. void __fastcall ClearHistory();
  63. void __fastcall DefaultHistory();
  64. void __fastcall RecryptPasswords();
  65. virtual bool __fastcall GetUseMasterPassword() = 0;
  66. public:
  67. __fastcall TCustomWinConfiguration();
  68. virtual __fastcall ~TCustomWinConfiguration();
  69. virtual void __fastcall Default();
  70. virtual void __fastcall AskForMasterPasswordIfNotSet() = 0;
  71. __property TLogView LogView = { read = FLogView, write = SetLogView };
  72. __property TInterface Interface = { read = FInterface, write = SetInterface };
  73. __property bool ShowAdvancedLoginOptions = { read = FShowAdvancedLoginOptions, write = SetShowAdvancedLoginOptions};
  74. __property TStrings * History[UnicodeString Name] = { read = GetHistory, write = SetHistory };
  75. __property TSynchronizeChecklistConfiguration SynchronizeChecklist = { read = FSynchronizeChecklist, write = SetSynchronizeChecklist };
  76. __property TFindFileConfiguration FindFile = { read = FFindFile, write = SetFindFile };
  77. __property TConsoleWinConfiguration ConsoleWin = { read = FConsoleWin, write = SetConsoleWin };
  78. __property bool ConfirmExitOnCompletion = { read=FConfirmExitOnCompletion, write=SetConfirmExitOnCompletion };
  79. __property bool OperationProgressOnTop = { read=FOperationProgressOnTop, write=FOperationProgressOnTop };
  80. __property bool UseMasterPassword = { read = GetUseMasterPassword };
  81. __property TNotifyEvent OnMasterPasswordRecrypt = { read = FOnMasterPasswordRecrypt, write = FOnMasterPasswordRecrypt };
  82. };
  83. //---------------------------------------------------------------------------
  84. #define CustomWinConfiguration \
  85. (dynamic_cast<TCustomWinConfiguration *>(Configuration))
  86. //---------------------------------------------------------------------------
  87. #endif