SynchronizeChecklist.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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. public:
  88. __fastcall TSynchronizeChecklistDialog(TComponent * AOwner,
  89. TSynchronizeMode Mode, int Params, const UnicodeString LocalDirectory,
  90. const UnicodeString RemoteDirectory, TCustomCommandMenuEvent OnCustomCommandMenu);
  91. virtual __fastcall ~TSynchronizeChecklistDialog();
  92. bool __fastcall Execute(TSynchronizeChecklist * Checklist);
  93. protected:
  94. bool FFormRestored;
  95. TSynchronizeChecklist * FChecklist;
  96. TSynchronizeMode FMode;
  97. int FParams;
  98. UnicodeString FLocalDirectory;
  99. UnicodeString FRemoteDirectory;
  100. TWndMethod FOrigListViewWindowProc;
  101. int FTotals[1 + TSynchronizeChecklist::ActionCount];
  102. int FChecked[1 + TSynchronizeChecklist::ActionCount];
  103. __int64 FCheckedSize[1 + TSynchronizeChecklist::ActionCount];
  104. TListItem * FChangingItem;
  105. bool FChangingItemChecked;
  106. bool FChangingItemIgnore;
  107. bool FChangingItemMass;
  108. UnicodeString FGeneralHint;
  109. TCustomCommandMenuEvent FOnCustomCommandMenu;
  110. typedef std::map<const TSynchronizeChecklist::TItem *, TSynchronizeChecklist::TAction> TActions;
  111. TActions FActions;
  112. void __fastcall UpdateControls();
  113. virtual void __fastcall CreateParams(TCreateParams & Params);
  114. void __fastcall LoadItem(TListItem * Item);
  115. void __fastcall LoadList();
  116. void __fastcall ListViewWindowProc(TMessage & Message);
  117. int __fastcall PanelAt(int X);
  118. void __fastcall CheckAll(bool Check);
  119. void __fastcall Check(bool Check);
  120. TListItem * __fastcall SelectAll(bool Select, int Action = 0,
  121. bool OnlyTheAction = true);
  122. bool __fastcall IsItemSizeIrrelevant(TSynchronizeChecklist::TAction Action);
  123. __int64 __fastcall GetItemSize(const TSynchronizeChecklist::TItem * Item);
  124. void __fastcall UpdateStatusBarSize();
  125. int __fastcall PanelCount();
  126. inline const TSynchronizeChecklist::TItem * GetChecklistItem(TListItem * Item);
  127. TSynchronizeChecklist::TAction & GetChecklistItemAction(
  128. const TSynchronizeChecklist::TItem * ChecklistItem);
  129. void __fastcall AddSubItem(TListItem * Item, int & Index, const UnicodeString & S);
  130. TRect __fastcall GetColumnHeaderRect(int Index);
  131. virtual void __fastcall Dispatch(void * Message);
  132. void __fastcall UpdateImages();
  133. void __fastcall CMDpiChanged(TMessage & Message);
  134. bool __fastcall GetWindowParams(UnicodeString & WindowParams);
  135. static int __fastcall CompareNumber(__int64 Value1, __int64 Value2);
  136. };
  137. //----------------------------------------------------------------------------
  138. #endif