Progress.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. //----------------------------------------------------------------------------
  2. #ifndef ProgressH
  3. #define ProgressH
  4. //----------------------------------------------------------------------------
  5. #include "PathLabel.hpp"
  6. #include <System.Classes.hpp>
  7. #include <Vcl.ComCtrls.hpp>
  8. #include <Vcl.Controls.hpp>
  9. #include <Vcl.ExtCtrls.hpp>
  10. #include <Vcl.StdCtrls.hpp>
  11. //----------------------------------------------------------------------------
  12. #include <FileOperationProgress.h>
  13. #include <Vcl.Menus.hpp>
  14. #include "PngImageList.hpp"
  15. #include <Vcl.Imaging.pngimage.hpp>
  16. #include <Vcl.ImgList.hpp>
  17. //----------------------------------------------------------------------------
  18. #include <GUITools.h>
  19. #include "TB2Dock.hpp"
  20. #include "TB2Item.hpp"
  21. #include "TB2Toolbar.hpp"
  22. #include "TBX.hpp"
  23. #include "TB2ExtItems.hpp"
  24. #include "TBXExtItems.hpp"
  25. #include <Vcl.AppEvnts.hpp>
  26. #include <list>
  27. //----------------------------------------------------------------------------
  28. class TProgressForm : public TForm
  29. {
  30. __published:
  31. TPanel *MainPanel;
  32. TLabel *PathLabel;
  33. TPathLabel *FileLabel;
  34. TLabel *TargetLabel;
  35. TPathLabel *TargetPathLabel;
  36. TProgressBar *OperationProgress;
  37. TPanel *TransferPanel;
  38. TLabel *Label3;
  39. TLabel *TimeElapsedLabel;
  40. TLabel *StartTimeLabelLabel;
  41. TLabel *StartTimeLabel;
  42. TLabel *Label4;
  43. TLabel *BytesTransferredLabel;
  44. TLabel *Label12;
  45. TLabel *CPSLabel;
  46. TProgressBar *FileProgress;
  47. TTimer *UpdateTimer;
  48. TLabel *TimeLeftLabelLabel;
  49. TLabel *TimeLeftLabel;
  50. TPaintBox *AnimationPaintBox;
  51. TPngImageList *ImageList;
  52. TPanel *ToolbarPanel;
  53. TTBXDock *Dock;
  54. TTBXToolbar *Toolbar;
  55. TTBXItem *CancelItem;
  56. TTBXItem *MinimizeItem;
  57. TTBXItem *MoveToQueueItem;
  58. TTBXSubmenuItem *CycleOnceDoneItem;
  59. TTBXItem *IdleOnceDoneItem;
  60. TTBXItem *DisconnectOnceDoneItem;
  61. TTBXItem *SuspendOnceDoneItem;
  62. TTBXItem *ShutDownOnceDoneItem;
  63. TTBXComboBoxItem *SpeedComboBoxItem;
  64. TPanel *ComponentsPanel;
  65. TPngImageList *ImageList120;
  66. TPngImageList *ImageList144;
  67. TPngImageList *ImageList192;
  68. TApplicationEvents *ApplicationEvents;
  69. TTBXItem *SkipItem;
  70. void __fastcall UpdateTimerTimer(TObject *Sender);
  71. void __fastcall FormShow(TObject *Sender);
  72. void __fastcall FormHide(TObject *Sender);
  73. void __fastcall CancelItemClick(TObject *Sender);
  74. void __fastcall MinimizeItemClick(TObject *Sender);
  75. void __fastcall MoveToQueueItemClick(TObject *Sender);
  76. void __fastcall OnceDoneItemClick(TObject *Sender);
  77. void __fastcall CycleOnceDoneItemClick(TObject *Sender);
  78. void __fastcall SpeedComboBoxItemAcceptText(TObject *Sender, UnicodeString &NewText,
  79. bool &Accept);
  80. void __fastcall SpeedComboBoxItemItemClick(TObject *Sender);
  81. void __fastcall SpeedComboBoxItemAdjustImageIndex(TTBXComboBoxItem *Sender, const UnicodeString AText,
  82. int AIndex, int &ImageIndex);
  83. void __fastcall ApplicationModalBegin(TObject * Sender);
  84. void __fastcall SpeedComboBoxItemClick(TObject *Sender);
  85. void __fastcall SkipItemClick(TObject *Sender);
  86. private:
  87. TCancelStatus FCancel;
  88. bool FPendingSkip;
  89. bool FMoveToQueue;
  90. TFileOperationProgressType FData;
  91. bool FDataGot;
  92. bool FDataReceived;
  93. TFileOperation FLastOperation;
  94. TOperationSide FLastSide;
  95. bool FLastTotalSizeSet;
  96. bool FMinimizedByMe;
  97. int FUpdateCounter;
  98. bool FAsciiTransferChanged;
  99. bool FResumeStatusChanged;
  100. void * FShowAsModalStorage;
  101. bool FDeleteLocalToRecycleBin;
  102. bool FDeleteRemoteToRecycleBin;
  103. bool FReadOnly;
  104. unsigned long FCPSLimit;
  105. TDateTime FStarted;
  106. int FSinceLastUpdate;
  107. bool FModalBeginHooked;
  108. int FModalLevel;
  109. TFrameAnimation FFrameAnimation;
  110. typedef BiDiMap<TOnceDoneOperation, TTBCustomItem *> TOnceDoneItems;
  111. TOnceDoneItems FOnceDoneItems;
  112. bool FAllowSkip;
  113. TSynchronizeProgress * FSynchronizeProgress;
  114. UnicodeString FProgressStr;
  115. int FWheelDelta;
  116. void __fastcall SetOnceDoneOperation(TOnceDoneOperation value);
  117. TTBCustomItem * __fastcall CurrentOnceDoneItem();
  118. TOnceDoneOperation __fastcall GetOnceDoneOperation();
  119. void __fastcall SetOnceDoneItem(TTBCustomItem * Item);
  120. void __fastcall SetAllowMinimize(bool value);
  121. bool __fastcall GetAllowMinimize();
  122. void __fastcall SetReadOnly(bool value);
  123. void __fastcall GlobalMinimize(TObject * Sender);
  124. UnicodeString __fastcall ItemSpeed(const UnicodeString & Text, TTBXComboBoxItem * Item);
  125. void __fastcall CMDialogKey(TCMDialogKey & Message);
  126. protected:
  127. void __fastcall CancelOperation();
  128. void __fastcall UpdateControls();
  129. void __fastcall ResetOnceDoneOperation();
  130. bool __fastcall ReceiveData(bool Force, int ModalLevelOffset);
  131. void __fastcall Minimize(TObject * Sender);
  132. virtual void __fastcall Dispatch(void * Message);
  133. void __fastcall SetCancelLower(TCancelStatus ACancel);
  134. DYNAMIC void __fastcall MouseWheelHandler(TMessage & Message);
  135. INTERFACE_HOOK;
  136. public:
  137. static UnicodeString __fastcall ProgressStr(
  138. const TSynchronizeProgress * SynchronizeProgress, const TFileOperationProgressType * ProgressData);
  139. virtual __fastcall TProgressForm(
  140. TComponent * AOwner, bool AllowMoveToQueue, bool AllowSkip, TSynchronizeProgress * SynchronizeProgress);
  141. virtual __fastcall ~TProgressForm();
  142. void __fastcall SetProgressData(TFileOperationProgressType & AData);
  143. void __fastcall ClearCancel();
  144. UnicodeString __fastcall ProgressStr();
  145. __property TCancelStatus Cancel = { read = FCancel };
  146. __property bool MoveToQueue = { read = FMoveToQueue };
  147. __property TOnceDoneOperation OnceDoneOperation = { read=GetOnceDoneOperation, write=SetOnceDoneOperation };
  148. __property bool AllowMinimize = { read=GetAllowMinimize, write=SetAllowMinimize };
  149. __property bool DeleteLocalToRecycleBin = { read=FDeleteLocalToRecycleBin, write=FDeleteLocalToRecycleBin };
  150. __property bool DeleteRemoteToRecycleBin = { read=FDeleteRemoteToRecycleBin, write=FDeleteRemoteToRecycleBin };
  151. __property bool ReadOnly = { read=FReadOnly, write=SetReadOnly };
  152. __property TSynchronizeProgress * SynchronizeProgress = { read = FSynchronizeProgress };
  153. };
  154. //----------------------------------------------------------------------------
  155. #endif