Synchronize.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. //---------------------------------------------------------------------------
  2. #ifndef SynchronizeH
  3. #define SynchronizeH
  4. //---------------------------------------------------------------------------
  5. #include <Classes.hpp>
  6. #include <Controls.hpp>
  7. #include <StdCtrls.hpp>
  8. #include <Forms.hpp>
  9. #include <HistoryComboBox.hpp>
  10. #include <WinInterface.h>
  11. #include "GrayedCheckBox.hpp"
  12. #include <ComCtrls.hpp>
  13. #include <ExtCtrls.hpp>
  14. #include <Vcl.Imaging.pngimage.hpp>
  15. #include <Vcl.Menus.hpp>
  16. //---------------------------------------------------------------------------
  17. struct TLogItemData;
  18. //---------------------------------------------------------------------------
  19. class TSynchronizeDialog : public TForm
  20. {
  21. __published:
  22. TGroupBox *DirectoriesGroup;
  23. TButton *StopButton;
  24. TButton *CancelButton;
  25. TLabel *LocalDirectoryLabel;
  26. TLabel *RemoteDirectoryLabel;
  27. THistoryComboBox *RemoteDirectoryEdit;
  28. THistoryComboBox *LocalDirectoryEdit;
  29. TGroupBox *OptionsGroup;
  30. TCheckBox *SynchronizeDeleteCheck;
  31. TButton *LocalDirectoryBrowseButton;
  32. TCheckBox *SaveSettingsCheck;
  33. TCheckBox *SynchronizeExistingOnlyCheck;
  34. TButton *StartButton;
  35. TButton *MinimizeButton;
  36. TButton *TransferSettingsButton;
  37. TCheckBox *SynchronizeRecursiveCheck;
  38. TGrayedCheckBox *SynchronizeSynchronizeCheck;
  39. TGroupBox *CopyParamGroup;
  40. TLabel *CopyParamLabel;
  41. TButton *HelpButton;
  42. TCheckBox *SynchronizeSelectedOnlyCheck;
  43. TPanel *LogPanel;
  44. TListView *LogView;
  45. TImage *Image;
  46. TCheckBox *ContinueOnErrorCheck;
  47. TPopupMenu *MinimizeMenu;
  48. TMenuItem *Minimize1;
  49. TMenuItem *MinimizetoTray1;
  50. void __fastcall ControlChange(TObject *Sender);
  51. void __fastcall LocalDirectoryBrowseButtonClick(TObject *Sender);
  52. void __fastcall TransferSettingsButtonClick(TObject *Sender);
  53. void __fastcall StartButtonClick(TObject *Sender);
  54. void __fastcall StopButtonClick(TObject *Sender);
  55. void __fastcall MinimizeButtonClick(TObject *Sender);
  56. void __fastcall FormShow(TObject *Sender);
  57. void __fastcall FormCloseQuery(TObject *Sender, bool &CanClose);
  58. void __fastcall CopyParamGroupContextPopup(TObject *Sender,
  59. TPoint &MousePos, bool &Handled);
  60. void __fastcall CopyParamGroupClick(TObject *Sender);
  61. void __fastcall HelpButtonClick(TObject *Sender);
  62. void __fastcall LogViewKeyDown(TObject *Sender, WORD &Key,
  63. TShiftState Shift);
  64. void __fastcall FormKeyDown(TObject *Sender, WORD &Key,
  65. TShiftState Shift);
  66. void __fastcall TransferSettingsButtonDropDownClick(TObject *Sender);
  67. void __fastcall LogViewCustomDrawItem(TCustomListView *Sender, TListItem *Item,
  68. TCustomDrawState State, bool &DefaultDraw);
  69. void __fastcall LogViewDeletion(TObject *Sender, TListItem *Item);
  70. void __fastcall LogViewDblClick(TObject *Sender);
  71. void __fastcall Minimize1Click(TObject *Sender);
  72. void __fastcall MinimizetoTray1Click(TObject *Sender);
  73. void __fastcall MinimizeButtonDropDownClick(TObject *Sender);
  74. private:
  75. TSynchronizeParamType FParams;
  76. TSynchronizeStartStopEvent FOnStartStop;
  77. TGetSynchronizeOptionsEvent FOnGetOptions;
  78. int FOptions;
  79. int FCopyParamAttrs;
  80. bool FSynchronizing;
  81. bool FMinimizedByMe;
  82. bool FAbort;
  83. bool FClose;
  84. bool FStartImmediately;
  85. TCopyParamType FCopyParams;
  86. TPopupMenu * FPresetsMenu;
  87. UnicodeString FPreset;
  88. TSynchronizeOptions * FSynchronizeOptions;
  89. TFeedSynchronizeError * FOnFeedSynchronizeError;
  90. static const MaxLogItems;
  91. void __fastcall SetParams(const TSynchronizeParamType& value);
  92. TSynchronizeParamType __fastcall GetParams();
  93. void __fastcall SetSaveSettings(bool value);
  94. bool __fastcall GetSaveSettings();
  95. void __fastcall SetCopyParams(const TCopyParamType & value);
  96. TCopyParamType __fastcall GetCopyParams();
  97. void __fastcall SetOptions(int value);
  98. protected:
  99. void __fastcall DoStartStop(bool Start, bool Synchronize);
  100. void __fastcall DoAbort(TObject * Sender, bool Close);
  101. void __fastcall DoLogInternal(TSynchronizeLogEntry Entry, const UnicodeString & Message,
  102. TStrings * MoreMessages, TQueryType Type, const UnicodeString & HelpKeyword);
  103. void __fastcall DoLog(TSynchronizeController * Controller, TSynchronizeLogEntry Entry,
  104. const UnicodeString Message);
  105. void __fastcall OnlyStop();
  106. void __fastcall Stop();
  107. virtual void __fastcall Dispatch(void * Message);
  108. void __fastcall CopyParamClick(TObject * Sender);
  109. void __fastcall ClearLog();
  110. void __fastcall CopyLog();
  111. int __fastcall ActualCopyParamAttrs();
  112. void __fastcall GlobalMinimize(TObject * Sender);
  113. void __fastcall CopyParamListPopup(TRect R, int AdditionalOptions);
  114. void __fastcall FeedSynchronizeError(
  115. const UnicodeString & Message, TStrings * MoreMessages, TQueryType Type,
  116. const UnicodeString & HelpKeyword);
  117. TLogItemData * __fastcall GetLogItemData(TListItem * Item);
  118. void __fastcall Minimize(TObject * Sender);
  119. public:
  120. __fastcall TSynchronizeDialog(TComponent * Owner);
  121. void __fastcall Init(TSynchronizeStartStopEvent OnStartStop,
  122. TGetSynchronizeOptionsEvent OnGetOptions,
  123. TFeedSynchronizeError & OnFeedSynchronizeError, bool StartImmediately);
  124. virtual __fastcall ~TSynchronizeDialog();
  125. bool __fastcall Execute();
  126. __property TSynchronizeParamType Params = { read = GetParams, write = SetParams };
  127. __property bool SaveSettings = { read = GetSaveSettings, write = SetSaveSettings };
  128. __property int Options = { read = FOptions, write = SetOptions };
  129. __property int CopyParamAttrs = { read = FCopyParamAttrs, write = FCopyParamAttrs };
  130. __property TCopyParamType CopyParams = { read = GetCopyParams, write = SetCopyParams };
  131. protected:
  132. void __fastcall UpdateControls();
  133. };
  134. //---------------------------------------------------------------------------
  135. #endif