SynchronizeChecklist.h 8.3 KB

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