Subversion Repositories autosfx

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 daniel-mar 1
unit MsgUnit;
2
(************************************************************************
3
 Copyright (C) 2009, 2010  by Russell J. Peters, Roger Aelbrecht,
4
      Eric W. Engler and Chris Vleghert.
5
 
6
   This file is part of TZipMaster Version 1.9.
7
 
8
    TZipMaster is free software: you can redistribute it and/or modify
9
    it under the terms of the GNU Lesser General Public License as published by
10
    the Free Software Foundation, either version 3 of the License, or
11
    (at your option) any later version.
12
 
13
    TZipMaster is distributed in the hope that it will be useful,
14
    but WITHOUT ANY WARRANTY; without even the implied warranty of
15
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
    GNU Lesser General Public License for more details.
17
 
18
    You should have received a copy of the GNU Lesser General Public License
19
    along with TZipMaster.  If not, see <http://www.gnu.org/licenses/>.
20
 
21
    contact: problems@delphizip.org (include ZipMaster in the subject).
22
    updates: http://www.delphizip.org
23
    DelphiZip maillist subscribe at http://www.freelists.org/list/delphizip
24
************************************************************************)
25
 
26
 
27
interface
28
 
29
uses
30
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
31
  StdCtrls, ExtCtrls, ComCtrls;
32
 
33
type
34
  TMsgform = class( TForm )
35
    Panel1:          TPanel;
36
    Panel2:          TPanel;
37
    DismissBut:      TButton;
38
    CancelBut:       TButton;
39
    FileBeingZipped: TLabel;
40
    ProgressBar1:    TProgressBar;
41
    StatusBar1:      TStatusBar;
42
    Memo1: TMemo;
43
 
44
    procedure DismissButClick( Sender: TObject );
45
    procedure CancelButClick( Sender: TObject );
46
    procedure FormCreate( Sender: TObject );
47
    procedure FormResize( Sender: TObject );
48
 
49
  public
50
    { Public declarations }
51
    FormInitialWidth: Integer;
52
 
53
    ProgressBar2: TProgressBar;
54
  end;
55
 
56
var
57
  Msgform: TMsgform;
58
 
59
implementation
60
 
61
uses main;
62
 
63
{$R *.DFM}
64
 
65
procedure TMsgform.DismissButClick( Sender: TObject );
66
begin
67
   Hide;
68
end;
69
 
70
procedure TMsgform.CancelButClick( Sender: TObject );
71
begin
72
//   if (MainForm.ZipMaster1.ZipBusy or MainForm.ZipMaster1.UnzBusy) then
73
   if MainForm.ZipMaster1.Busy then
74
      MainForm.ZipMaster1.Cancel := True
75
   else
76
      Hide; { nothing to cancel - assume user wants to close msg window }
77
end;
78
 
79
procedure TMsgform.FormCreate( Sender: TObject );
80
begin
81
   ProgressBar2 := TProgressBar.Create( StatusBar1 );   // Parent will delete it.
82
 
83
   {$IfDef VER120}
84
   ProgressBar1.Smooth := True;
85
   {$EndIf}
86
   with ProgressBar2 do
87
   begin
88
      Parent  := StatusBar1;
89
      Top     := 2;
90
      Left    := StatusBar1.Left + StatusBar1.Panels.Items[0].Width +
91
                 StatusBar1.Panels.Items[1].Width + 2;
92
      Height  := StatusBar1.Height - 2;
93
      Min     := 1;
94
      Max     := 10001;
95
      {$IfDef VER120}
96
      Smooth  := True;
97
      {$EndIf}
98
   end;
99
   FormInitialWidth := MsgForm.Width;
100
end;
101
 
102
procedure TMsgform.FormResize( Sender: TObject );
103
begin
104
   ProgressBar2.Width := StatusBar1.Width - StatusBar1.Panels.Items[0].Width -
105
                         StatusBar1.Panels.Items[1].Width - 18;
106
   ProgressBar1.Width := 177 + (MsgForm.Width - FormInitialWidth);
107
end;
108
 
109
end.
110