Synchronize.h 6.5 KB

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