SIFReport.pas 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. unit SIFReport;
  2. interface
  3. uses
  4. Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  5. Dialogs, StdCtrls, ExtCtrls, JvExExtCtrls, JvShape, JvExForms,
  6. JvCustomItemViewer, JvOwnerDrawViewer, JvComponent, JvPanel,
  7. JvExControls, JvLabel;
  8. type
  9. TfrmSIFReport = class(TForm)
  10. Label1: TLabel;
  11. lblCurrentFile: TJvLabel;
  12. Label4: TLabel;
  13. Label5: TLabel;
  14. Label3: TLabel;
  15. Label2: TLabel;
  16. chkKeepReportOpened: TCheckBox;
  17. lblMatchFound: TJvLabel;
  18. lblScannedLines: TJvLabel;
  19. lblScannedFiles: TJvLabel;
  20. lblSkippedFiles: TJvLabel;
  21. procedure FormPaint(Sender: TObject);
  22. procedure FormShow(Sender: TObject);
  23. procedure chkKeepReportOpenedClick(Sender: TObject);
  24. private
  25. { Private declarations }
  26. FCurrentFile: String;
  27. FMatchFound: Integer;
  28. FScannedLines: Integer;
  29. FScannedFiles: Integer;
  30. FSkippedFiles: Integer;
  31. procedure UpdateUI;
  32. procedure SetCurrentFile(FileName: String);
  33. procedure SetMatchFound(Count: Integer);
  34. procedure SetScannedLines(Count: Integer);
  35. procedure SetScannedFiles(Count: Integer);
  36. procedure SetSkippedFiles(Count: Integer);
  37. public
  38. { Public declarations }
  39. procedure ResetReport;
  40. property CurrentFile: String read FCurrentFile write SetCurrentFile;
  41. property MatchFound: Integer read FMatchFound write SetMatchFound;
  42. property ScannedLines: Integer read FScannedLines write SetScannedLines;
  43. property ScannedFiles: Integer read FScannedFiles write SetScannedFiles;
  44. property SkippedFiles: Integer read FSkippedFiles write SetSkippedFiles;
  45. end;
  46. var
  47. frmSIFReport: TfrmSIFReport;
  48. implementation
  49. uses Main;
  50. {$R *.dfm}
  51. procedure TfrmSIFReport.ResetReport;
  52. begin
  53. FCurrentFile := '[None]';
  54. FMatchFound := 0;
  55. FScannedLines := 0;
  56. FScannedFiles := 0;
  57. FSkippedFiles := 0;
  58. UpdateUI;
  59. end;
  60. procedure TfrmSIFReport.UpdateUI;
  61. var
  62. pRect: TRect;
  63. begin
  64. // Initialize stuff...
  65. lblCurrentFile.Caption := FCurrentFile;
  66. lblMatchFound.Caption := IntToStr(FMatchFound);
  67. lblScannedLines.Caption := IntToStr(FScannedLines);
  68. lblScannedFiles.Caption := IntToStr(FScannedFiles);
  69. lblSkippedFiles.Caption := IntToStr(FSkippedFiles);
  70. Self.Canvas.Brush.Color := clInactiveCaption;
  71. // Draw the frame rectangle to add some style
  72. pRect := lblCurrentFile.BoundsRect;
  73. InflateRect(pRect, 2, 1);
  74. Self.Canvas.FrameRect(pRect);
  75. pRect := lblMatchFound.BoundsRect;
  76. InflateRect(pRect, 2, 1);
  77. Self.Canvas.FrameRect(pRect);
  78. pRect := lblScannedLines.BoundsRect;
  79. InflateRect(pRect, 2, 1);
  80. Self.Canvas.FrameRect(pRect);
  81. pRect := lblScannedFiles.BoundsRect;
  82. InflateRect(pRect, 2, 1);
  83. Self.Canvas.FrameRect(pRect);
  84. pRect := lblSkippedFiles.BoundsRect;
  85. InflateRect(pRect, 2, 1);
  86. Self.Canvas.FrameRect(pRect);
  87. Application.ProcessMessages;
  88. end;
  89. procedure TfrmSIFReport.SetCurrentFile(FileName: String);
  90. begin
  91. FCurrentFile := FileName;
  92. UpdateUI;
  93. end;
  94. procedure TfrmSIFReport.SetMatchFound(Count: Integer);
  95. begin
  96. FMatchFound := Count;
  97. UpdateUI;
  98. end;
  99. procedure TfrmSIFReport.SetScannedLines(Count: Integer);
  100. begin
  101. FScannedLines := Count;
  102. UpdateUI;
  103. end;
  104. procedure TfrmSIFReport.SetScannedFiles(Count: Integer);
  105. begin
  106. FScannedFiles := Count;
  107. UpdateUI;
  108. end;
  109. procedure TfrmSIFReport.SetSkippedFiles(Count: Integer);
  110. begin
  111. FSkippedFiles := Count;
  112. UpdateUI;
  113. end;
  114. procedure TfrmSIFReport.FormPaint(Sender: TObject);
  115. begin
  116. UpdateUI;
  117. end;
  118. procedure TfrmSIFReport.FormShow(Sender: TObject);
  119. begin
  120. chkKeepReportOpened.Checked := KeepSIFWindowOpened;
  121. end;
  122. procedure TfrmSIFReport.chkKeepReportOpenedClick(Sender: TObject);
  123. begin
  124. KeepSIFWindowOpened := chkKeepReportOpened.Checked;
  125. end;
  126. end.