SynchronizeChecklist.h 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. //----------------------------------------------------------------------------
  2. #ifndef SynchronizeChecklistH
  3. #define SynchronizeChecklistH
  4. //----------------------------------------------------------------------------
  5. #include "IEListView.hpp"
  6. #include "NortonLikeListView.hpp"
  7. #include <System.Classes.hpp>
  8. #include <Vcl.ComCtrls.hpp>
  9. #include <Vcl.Controls.hpp>
  10. #include <Vcl.ExtCtrls.hpp>
  11. #include <Vcl.ImgList.hpp>
  12. #include <Vcl.Menus.hpp>
  13. #include <Vcl.StdCtrls.hpp>
  14. #include "PngImageList.hpp"
  15. //----------------------------------------------------------------------------
  16. #include <Terminal.h>
  17. #include <System.Actions.hpp>
  18. #include <Vcl.ActnList.hpp>
  19. //----------------------------------------------------------------------------
  20. class TSynchronizeChecklistDialog : public TForm
  21. {
  22. __published:
  23. TPanel * Panel;
  24. TIEListView *ListView;
  25. TStatusBar *StatusBar;
  26. TPngImageList *ActionImages;
  27. TButton *OkButton;
  28. TButton *CancelButton;
  29. TButton *CheckAllButton;
  30. TButton *UncheckAllButton;
  31. TButton *CheckButton;
  32. TButton *UncheckButton;
  33. TPopupMenu *ListViewPopupMenu;
  34. TMenuItem *CheckItem;
  35. TMenuItem *UncheckItem;
  36. TMenuItem *N1;
  37. TMenuItem *SelectAllItem;
  38. TTimer *UpdateTimer;
  39. TButton *HelpButton;
  40. TButton *CustomCommandsButton2;
  41. TActionList *ActionList;
  42. TAction *CheckAction;
  43. TAction *UncheckAction;
  44. TAction *CheckAllAction;
  45. TAction *UncheckAllAction;
  46. TAction *SelectAllAction;
  47. TAction *CustomCommandsAction;
  48. TMenuItem *N2;
  49. TButton *ReverseButton;
  50. TAction *ReverseAction;
  51. TMenuItem *ReverseItem;
  52. TPngImageList *ActionImages120;
  53. TPngImageList *ActionImages144;
  54. TPngImageList *ActionImages192;
  55. TAction *CalculateSizeAction;
  56. TMenuItem *Calculate1;
  57. TButton *CalculateSizeButton;
  58. TAction *CalculateSizeAllAction;
  59. TAction *MoveAction;
  60. TButton *MoveButton;
  61. TMenuItem *MoveItem;
  62. TAction *CheckDirectoryAction;
  63. TAction *UncheckDirectoryAction;
  64. TMenuItem *N3;
  65. TMenuItem *CheckAllFilesinThisDirectory1;
  66. TMenuItem *UncheckAllActionsinThisDirectory1;
  67. TAction *BrowseLocalAction;
  68. TAction *BrowseRemoteAction;
  69. TMenuItem *BrowseLocalDirectory1;
  70. TMenuItem *BrowseLocalDirectory2;
  71. void __fastcall HelpButtonClick(TObject * Sender);
  72. void __fastcall FormShow(TObject * Sender);
  73. void __fastcall StatusBarDrawPanel(TStatusBar *StatusBar,
  74. TStatusPanel *Panel, const TRect &Rect);
  75. void __fastcall ListViewChange(TObject *Sender, TListItem *Item,
  76. TItemChange Change);
  77. void __fastcall ListViewChanging(TObject *Sender, TListItem *Item,
  78. TItemChange Change, bool &AllowChange);
  79. void __fastcall CheckAllActionExecute(TObject *Sender);
  80. void __fastcall CheckActionExecute(TObject *Sender);
  81. void __fastcall ListViewSelectItem(TObject *Sender, TListItem *Item,
  82. bool Selected);
  83. void __fastcall UpdateTimerTimer(TObject *Sender);
  84. void __fastcall SelectAllActionExecute(TObject *Sender);
  85. void __fastcall StatusBarMouseDown(TObject *Sender, TMouseButton Button,
  86. TShiftState Shift, int X, int Y);
  87. void __fastcall ListViewCompare(TObject *Sender, TListItem *Item1,
  88. TListItem *Item2, int Data, int &Compare);
  89. void __fastcall ListViewSecondaryColumnHeader(TCustomIEListView *Sender,
  90. int Index, int &SecondaryColumn);
  91. void __fastcall ListViewContextPopup(TObject *Sender, TPoint &MousePos,
  92. bool &Handled);
  93. void __fastcall CustomCommandsActionExecute(TObject *Sender);
  94. void __fastcall ListViewAdvancedCustomDrawSubItem(TCustomListView *Sender, TListItem *Item,
  95. int SubItem, TCustomDrawState State, TCustomDrawStage Stage, bool &DefaultDraw);
  96. void __fastcall StatusBarResize(TObject *Sender);
  97. void __fastcall UncheckActionExecute(TObject *Sender);
  98. void __fastcall UncheckAllActionExecute(TObject *Sender);
  99. void __fastcall ReverseActionExecute(TObject *Sender);
  100. void __fastcall ListViewClick(TObject *Sender);
  101. void __fastcall OkButtonClick(TObject *Sender);
  102. void __fastcall CalculateSizeActionExecute(TObject *Sender);
  103. void __fastcall CalculateSizeAllActionExecute(TObject *Sender);
  104. void __fastcall MoveActionExecute(TObject *Sender);
  105. void __fastcall CheckDirectoryActionExecute(TObject *Sender);
  106. void __fastcall UncheckDirectoryActionExecute(TObject *Sender);
  107. void __fastcall BrowseLocalActionExecute(TObject *Sender);
  108. void __fastcall BrowseRemoteActionExecute(TObject *Sender);
  109. void __fastcall ListViewRecreate(TObject *Sender);
  110. public:
  111. __fastcall TSynchronizeChecklistDialog(
  112. TComponent * AOwner, TSynchronizeMode Mode, int Params,
  113. const UnicodeString & LocalDirectory, const UnicodeString & RemoteDirectory,
  114. TCustomCommandMenuEvent OnCustomCommandMenu, TFullSynchronizeEvent OnSynchronize,
  115. TSynchronizeChecklistCalculateSize OnSynchronizeChecklistCalculateSize, TSynchronizeMoveEvent OnSynchronizeMove,
  116. TSynchronizeBrowseEvent OnSynchronizeBrowse, void * Token);
  117. virtual __fastcall ~TSynchronizeChecklistDialog();
  118. bool __fastcall Execute(TSynchronizeChecklist * Checklist);
  119. protected:
  120. bool FFormRestored;
  121. TSynchronizeChecklist * FChecklist;
  122. TSynchronizeMode FMode;
  123. int FParams;
  124. UnicodeString FLocalDirectory;
  125. UnicodeString FRemoteDirectory;
  126. TWndMethod FOrigListViewWindowProc;
  127. TWndMethod FOrigStatusBarWindowProc;
  128. int FTotals[1 + TSynchronizeChecklist::ActionCount];
  129. int FChecked[1 + TSynchronizeChecklist::ActionCount];
  130. __int64 FCheckedSize[1 + TSynchronizeChecklist::ActionCount];
  131. TListItem * FChangingItem;
  132. bool FChangingItemChecked;
  133. bool FChangingItemIgnore;
  134. bool FChangingItemMass;
  135. TCustomCommandMenuEvent FOnCustomCommandMenu;
  136. TSynchronizeChecklistCalculateSize FOnSynchronizeChecklistCalculateSize;
  137. TSynchronizeMoveEvent FOnSynchronizeMove;
  138. TSynchronizeBrowseEvent FOnSynchronizeBrowse;
  139. typedef std::map<const TSynchronizeChecklist::TItem *, TSynchronizeChecklist::TAction> TActions;
  140. TActions FActions;
  141. TFullSynchronizeEvent FOnSynchronize;
  142. void * FToken;
  143. bool FSynchronizing;
  144. std::unique_ptr<Exception> FException;
  145. std::map<const TSynchronizeChecklist::TItem *, TListItem *> FChecklistToListViewMap;
  146. void __fastcall UpdateControls();
  147. void __fastcall UpdateCaption();
  148. virtual void __fastcall CreateParams(TCreateParams & Params);
  149. void __fastcall LoadItem(TListItem * Item);
  150. void __fastcall LoadList();
  151. void __fastcall ListViewWindowProc(TMessage & Message);
  152. void __fastcall StatusBarWindowProc(TMessage & Message);
  153. int __fastcall PanelAt(int X);
  154. void __fastcall CheckAll(bool Check);
  155. void __fastcall Check(bool Check);
  156. TListItem * __fastcall SelectAll(bool Select, int Action = 0,
  157. bool OnlyTheAction = true);
  158. void __fastcall UpdateStatusBarSize();
  159. int __fastcall PanelCount();
  160. inline const TSynchronizeChecklist::TItem * GetChecklistItem(TListItem * Item);
  161. TSynchronizeChecklist::TAction & GetChecklistItemAction(
  162. const TSynchronizeChecklist::TItem * ChecklistItem);
  163. void __fastcall AddSubItem(TListItem * Item, int & Index, const UnicodeString & S);
  164. TRect __fastcall GetColumnHeaderRect(int Index);
  165. virtual void __fastcall Dispatch(void * Message);
  166. void __fastcall UpdateImages();
  167. void __fastcall CMDpiChanged(TMessage & Message);
  168. bool __fastcall GetWindowParams(UnicodeString & WindowParams);
  169. void __fastcall ProcessedItem(void * Token, const TSynchronizeChecklist::TItem * ChecklistItem);
  170. void __fastcall UpdatedSynchronizationChecklistItems(const TSynchronizeChecklist::TItemList & Items);
  171. void __fastcall CountItemSize(const TSynchronizeChecklist::TItem * ChecklistItem, int Factor);
  172. void __fastcall CountItem(const TSynchronizeChecklist::TItem * ChecklistItem, int Factor);
  173. void __fastcall CountItemTotal(const TSynchronizeChecklist::TItem * ChecklistItem, int Factor);
  174. typedef std::pair<const TSynchronizeChecklist::TItem *, const TSynchronizeChecklist::TItem *> TSynchronizeMoveItems;
  175. TSynchronizeMoveItems __fastcall GetMoveItems();
  176. void __fastcall DeleteItem(TListItem * Item);
  177. void __fastcall CheckDirectory(bool Check);
  178. void __fastcall DoBrowse(TOperationSide Side);
  179. void __fastcall ListViewHintShow(TCMHintShow & HintShow);
  180. void __fastcall StatusBarHintShow(TCMHintShow & HintShow);
  181. DYNAMIC void __fastcall KeyDown(Word & Key, TShiftState Shift);
  182. };
  183. //----------------------------------------------------------------------------
  184. #endif