SynchronizeChecklist.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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. void __fastcall HelpButtonClick(TObject * Sender);
  56. void __fastcall FormShow(TObject * Sender);
  57. void __fastcall StatusBarDrawPanel(TStatusBar *StatusBar,
  58. TStatusPanel *Panel, const TRect &Rect);
  59. void __fastcall StatusBarMouseMove(TObject *Sender, TShiftState Shift,
  60. int X, int Y);
  61. void __fastcall ListViewChange(TObject *Sender, TListItem *Item,
  62. TItemChange Change);
  63. void __fastcall ListViewChanging(TObject *Sender, TListItem *Item,
  64. TItemChange Change, bool &AllowChange);
  65. void __fastcall CheckAllActionExecute(TObject *Sender);
  66. void __fastcall CheckActionExecute(TObject *Sender);
  67. void __fastcall ListViewSelectItem(TObject *Sender, TListItem *Item,
  68. bool Selected);
  69. void __fastcall UpdateTimerTimer(TObject *Sender);
  70. void __fastcall SelectAllActionExecute(TObject *Sender);
  71. void __fastcall StatusBarMouseDown(TObject *Sender, TMouseButton Button,
  72. TShiftState Shift, int X, int Y);
  73. void __fastcall ListViewCompare(TObject *Sender, TListItem *Item1,
  74. TListItem *Item2, int Data, int &Compare);
  75. void __fastcall ListViewSecondaryColumnHeader(TCustomIEListView *Sender,
  76. int Index, int &SecondaryColumn);
  77. void __fastcall ListViewContextPopup(TObject *Sender, TPoint &MousePos,
  78. bool &Handled);
  79. void __fastcall CustomCommandsActionExecute(TObject *Sender);
  80. void __fastcall ListViewAdvancedCustomDrawSubItem(TCustomListView *Sender, TListItem *Item,
  81. int SubItem, TCustomDrawState State, TCustomDrawStage Stage, bool &DefaultDraw);
  82. void __fastcall StatusBarResize(TObject *Sender);
  83. void __fastcall UncheckActionExecute(TObject *Sender);
  84. void __fastcall UncheckAllActionExecute(TObject *Sender);
  85. void __fastcall ReverseActionExecute(TObject *Sender);
  86. void __fastcall ListViewClick(TObject *Sender);
  87. void __fastcall OkButtonClick(TObject *Sender);
  88. public:
  89. __fastcall TSynchronizeChecklistDialog(TComponent * AOwner,
  90. TSynchronizeMode Mode, int Params, const UnicodeString LocalDirectory,
  91. const UnicodeString RemoteDirectory, TCustomCommandMenuEvent OnCustomCommandMenu,
  92. TFullSynchronizeEvent OnSynchronize, void * Token);
  93. virtual __fastcall ~TSynchronizeChecklistDialog();
  94. bool __fastcall Execute(TSynchronizeChecklist * Checklist);
  95. protected:
  96. bool FFormRestored;
  97. TSynchronizeChecklist * FChecklist;
  98. TSynchronizeMode FMode;
  99. int FParams;
  100. UnicodeString FLocalDirectory;
  101. UnicodeString FRemoteDirectory;
  102. TWndMethod FOrigListViewWindowProc;
  103. int FTotals[1 + TSynchronizeChecklist::ActionCount];
  104. int FChecked[1 + TSynchronizeChecklist::ActionCount];
  105. __int64 FCheckedSize[1 + TSynchronizeChecklist::ActionCount];
  106. TListItem * FChangingItem;
  107. bool FChangingItemChecked;
  108. bool FChangingItemIgnore;
  109. bool FChangingItemMass;
  110. UnicodeString FGeneralHint;
  111. TCustomCommandMenuEvent FOnCustomCommandMenu;
  112. typedef std::map<const TSynchronizeChecklist::TItem *, TSynchronizeChecklist::TAction> TActions;
  113. TActions FActions;
  114. TFullSynchronizeEvent FOnSynchronize;
  115. void * FToken;
  116. typedef std::map<const void *, TListItem *> TTokens;
  117. TTokens FTokens;
  118. bool FSynchronizing;
  119. std::unique_ptr<Exception> FException;
  120. void __fastcall UpdateControls();
  121. virtual void __fastcall CreateParams(TCreateParams & Params);
  122. void __fastcall LoadItem(TListItem * Item);
  123. void __fastcall LoadList();
  124. void __fastcall ListViewWindowProc(TMessage & Message);
  125. int __fastcall PanelAt(int X);
  126. void __fastcall CheckAll(bool Check);
  127. void __fastcall Check(bool Check);
  128. TListItem * __fastcall SelectAll(bool Select, int Action = 0,
  129. bool OnlyTheAction = true);
  130. bool __fastcall IsItemSizeIrrelevant(TSynchronizeChecklist::TAction Action);
  131. __int64 __fastcall GetItemSize(const TSynchronizeChecklist::TItem * Item);
  132. void __fastcall UpdateStatusBarSize();
  133. int __fastcall PanelCount();
  134. inline const TSynchronizeChecklist::TItem * GetChecklistItem(TListItem * Item);
  135. TSynchronizeChecklist::TAction & GetChecklistItemAction(
  136. const TSynchronizeChecklist::TItem * ChecklistItem);
  137. void __fastcall AddSubItem(TListItem * Item, int & Index, const UnicodeString & S);
  138. TRect __fastcall GetColumnHeaderRect(int Index);
  139. virtual void __fastcall Dispatch(void * Message);
  140. void __fastcall UpdateImages();
  141. void __fastcall CMDpiChanged(TMessage & Message);
  142. bool __fastcall GetWindowParams(UnicodeString & WindowParams);
  143. void __fastcall ProcessedItem(const void * Token);
  144. static int __fastcall CompareNumber(__int64 Value1, __int64 Value2);
  145. };
  146. //----------------------------------------------------------------------------
  147. #endif