Progress.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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 *TopProgress;
  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 *BottomProgress;
  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. bool FLastTotalSizeSet;
  95. bool FMinimizedByMe;
  96. int FUpdateCounter;
  97. bool FAsciiTransferChanged;
  98. bool FResumeStatusChanged;
  99. void * FShowAsModalStorage;
  100. bool FDeleteToRecycleBin;
  101. bool FReadOnly;
  102. unsigned long FCPSLimit;
  103. TProgressBar * FOperationProgress;
  104. TProgressBar * FFileProgress;
  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. void __fastcall SetOnceDoneOperation(TOnceDoneOperation value);
  113. TTBCustomItem * __fastcall CurrentOnceDoneItem();
  114. TOnceDoneOperation __fastcall GetOnceDoneOperation();
  115. void __fastcall SetOnceDoneItem(TTBCustomItem * Item);
  116. void __fastcall SetAllowMinimize(bool value);
  117. bool __fastcall GetAllowMinimize();
  118. void __fastcall SetReadOnly(bool value);
  119. void __fastcall GlobalMinimize(TObject * Sender);
  120. UnicodeString __fastcall ItemSpeed(const UnicodeString & Text, TTBXComboBoxItem * Item);
  121. void __fastcall CMDialogKey(TCMDialogKey & Message);
  122. protected:
  123. void __fastcall CancelOperation();
  124. void __fastcall UpdateControls();
  125. void __fastcall ResetOnceDoneOperation();
  126. bool __fastcall ReceiveData(bool Force, int ModalLevelOffset);
  127. void __fastcall Minimize(TObject * Sender);
  128. virtual void __fastcall Dispatch(void * Message);
  129. void __fastcall SetCancelLower(TCancelStatus ACancel);
  130. static bool __fastcall IsIndeterminateOperation(TFileOperation Operation);
  131. public:
  132. static UnicodeString __fastcall ProgressStr(TFileOperationProgressType * ProgressData);
  133. virtual __fastcall TProgressForm(TComponent * AOwner, bool AllowMoveToQueue, bool AllowSkip);
  134. virtual __fastcall ~TProgressForm();
  135. void __fastcall SetProgressData(TFileOperationProgressType & AData);
  136. void __fastcall ClearCancel();
  137. __property TCancelStatus Cancel = { read = FCancel };
  138. __property bool MoveToQueue = { read = FMoveToQueue };
  139. __property TOnceDoneOperation OnceDoneOperation = { read=GetOnceDoneOperation, write=SetOnceDoneOperation };
  140. __property bool AllowMinimize = { read=GetAllowMinimize, write=SetAllowMinimize };
  141. __property bool DeleteToRecycleBin = { read=FDeleteToRecycleBin, write=FDeleteToRecycleBin };
  142. __property bool ReadOnly = { read=FReadOnly, write=SetReadOnly };
  143. };
  144. //----------------------------------------------------------------------------
  145. #endif