This repository was archived by the owner on Jan 23, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUnit7.pas
More file actions
192 lines (175 loc) · 4.94 KB
/
Unit7.pas
File metadata and controls
192 lines (175 loc) · 4.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
unit Unit7;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Spin, Unit1, Buttons, LevelEngine;
type
TPictureForm = class(TForm)
ComboBox1: TComboBox;
ComboBox2: TComboBox;
ComboBox3: TComboBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
SpinEdit1: TSpinEdit;
Label5: TLabel;
ComboBox4: TComboBox;
Image1: TImage;
ScrollBox1: TScrollBox;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
procedure ComboBox1Change(Sender: TObject);
procedure ComboBox2Change(Sender: TObject);
procedure ComboBox3Change(Sender: TObject);
procedure SaveToPicture(var pic:TEPicture);
procedure LoadFromPicture(pic:TEPicture);
procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure FormDeactivate(Sender: TObject);
procedure ReloadLGR;
procedure FormShow(Sender: TObject);
private
{ Private declarations }
// LastLgr:string[16];
public
{ Public declarations }
// Pic: ^TEPicture;
end;
var
PictureForm: TPictureForm;
implementation
uses DXDraws, DIB;
{$R *.dfm}
procedure TPictureForm.ComboBox1Change(Sender: TObject);
var
b:TBitmap;
begin
if (ComboBox1.Text<>'') then begin
b:=Level.PC[Level.SearchPic(ComboBox1.Text)].Image.Bmp;
Image1.Picture.Bitmap.Width:=b.Width;
Image1.Picture.Bitmap.Height:=b.Height;
Image1.Canvas.Brush.Color:=clWhite;
Image1.Canvas.FillRect(Image1.ClientRect);
Image1.Canvas.Draw(0,0,b);
Image1.Proportional:=true;
Image1.Transparent:=true;
Image1.Picture.Bitmap.TransparentColor:=b.Canvas.Pixels[0,0];
if Sender<>nil then
with Level.PC[Level.SearchPic(ComboBox1.Text)] do begin
{Image1.Picture.Bitmap.Width:=Image.Bmp.Width;
Image1.Picture.Bitmap.Height:=Image.Bmp.Height;
Image1.Canvas.Draw(0,0,Image.Bmp);}
SpinEdit1.Value:=Distance;
ComboBox4.ItemIndex:=Clipping;
end;
ComboBox2.ItemIndex:=-1;
ComboBox3.ItemIndex:=-1;
end
end;
procedure TPictureForm.ComboBox2Change(Sender: TObject);
begin
if (ComboBox2.Text<>'') then begin
Image1.Transparent:=false;
if ComboBox3.ItemIndex<0 then begin
ComboBox3.ItemIndex:=0;
ComboBox3Change(Sender);
exit;
end;
if Sender<>nil then
with Level.PC[Level.SearchPic(ComboBox2.Text)],Image do begin
Image1.Canvas.Brush.Bitmap:=Bmp;
SpinEdit1.Value:=Distance;
ComboBox4.ItemIndex:=Clipping;
end;
Image1.Canvas.FillRect(Image1.Canvas.ClipRect);
ComboBox1.ItemIndex:=-1;
end
end;
procedure TPictureForm.ComboBox3Change(Sender: TObject);
var
i:integer;
begin
if (ComboBox3.Text<>'') then begin
Image1.Proportional:=true;
Image1.Transparent:=false;
if ComboBox2.ItemIndex<0 then begin
ComboBox2.ItemIndex:=0;
end;
ComboBox2Change(Sender);
i:=Level.SearchPic(ComboBox3.Text);
Image1.Picture.Bitmap.Width:=Level.PC[i].Width;
Image1.Picture.Bitmap.Height:=Level.PC[i].Height;
ComboBox1.ItemIndex:=-1;
end
end;
procedure TPictureForm.LoadFromPicture(pic: TEPicture);
begin
// if ComboBox1.Items.Count=0 then ReloadLGR;
ComboBox1.ItemIndex:=ComboBox1.Items.IndexOf(pic.Name);
ComboBox2.ItemIndex:=ComboBox2.Items.IndexOf(pic.Texture);
ComboBox3.ItemIndex:=ComboBox3.Items.IndexOf(pic.Mask);
ComboBox1Change(nil);
ComboBox2Change(nil);
ComboBox3Change(nil);
SpinEdit1.Value:=pic.Distance;
ComboBox4.ItemIndex:=pic.Clipping;
end;
procedure TPictureForm.SaveToPicture(var pic: TEPicture);
begin
pic.Name:=ComboBox1.Text;
pic.Texture:=ComboBox2.Text;
pic.Mask:=ComboBox3.Text;
pic.Distance:=SpinEdit1.Value;
pic.Clipping:=ComboBox4.ItemIndex;
end;
procedure TPictureForm.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key=VK_ESCAPE then Close;
end;
procedure TPictureForm.FormDeactivate(Sender: TObject);
begin
ModalResult:=mrCancel;
Close;
end;
procedure TPictureForm.ReloadLGR;
var
i:integer;
c1,c2,c3:integer;
begin
c1:=ComboBox1.ItemIndex;
c2:=ComboBox2.ItemIndex;
c3:=ComboBox3.ItemIndex;
ComboBox1.Clear;
ComboBox2.Clear;
ComboBox3.Clear;
for i:=0 to High(Level.PC) do with Level.PC[i] do
case tip of
ptPicture:ComboBox1.AddItem(Name,nil);
ptTexture:ComboBox2.AddItem(Name,nil);
ptMask:ComboBox3.AddItem(Name,nil);
end;
if (ComboBox1.ItemIndex<0) and (ComboBox2.ItemIndex<0) then begin
Image1.Picture.Bitmap.Width:=0;
Image1.Picture.Bitmap.Height:=0;
end;
ComboBox1.Sorted:=true;
ComboBox2.Sorted:=true;
ComboBox3.Sorted:=true;
ComboBox1.ItemIndex:=c1;
ComboBox2.ItemIndex:=c2;
ComboBox3.ItemIndex:=c3;
ComboBox1Change(nil);
ComboBox3Change(nil);
end;
procedure TPictureForm.FormShow(Sender: TObject);
begin
ReloadLGR;
if (ComboBox4.ItemIndex<0) then ComboBox4.ItemIndex:=0;
if (ComboBox1.ItemIndex<0) and (ComboBox2.ItemIndex<0) and (ComboBox3.ItemIndex<0) then begin
ComboBox1.ItemIndex:=0;
ComboBox1Change(Sender);
end;
end;
end.