-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuFrmNewTexture.pas
More file actions
98 lines (81 loc) · 2.81 KB
/
uFrmNewTexture.pas
File metadata and controls
98 lines (81 loc) · 2.81 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
unit uFrmNewTexture;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, JvExMask, JvSpin, Vcl.Mask, Vcl.ExtCtrls,
uEditorLoader, uEditor.Strings;
type
TfrmNewTexture = class(TForm)
GroupBox1: TGroupBox;
edtPackage: TLabeledEdit;
edtGroup: TLabeledEdit;
edtTexName: TLabeledEdit;
se_TexWidth: TJvSpinEdit;
se_TexHeight: TJvSpinEdit;
Label1: TLabel;
Label2: TLabel;
btnCreate: TButton;
btnCancel: TButton;
cmbTextureClass: TComboBox;
Label3: TLabel;
procedure btnCancelClick(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure btnCreateClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmNewTexture: TfrmNewTexture;
NameCounter: Integer;
implementation
{$R *.dfm}
uses uFrmTextures;
procedure TfrmNewTexture.btnCancelClick(Sender: TObject);
begin
Close();
end;
procedure TfrmNewTexture.btnCreateClick(Sender: TObject);
begin
ServerCmd('TEXTURE NEW' +
' NAME=' + AnsiQuotedStr(edtTexName.Text, '"') +
' CLASS=' + cmbTextureClass.Items[cmbTextureClass.ItemIndex] +
' GROUP=' + edtGroup.Text +
' USIZE=' + se_TexWidth.Text + // Value.ToString +
' VSIZE=' + se_TexHeight.Text + //Value.ToString +
' PACKAGE=' + AnsiQuotedStr(edtPackage.Text, '"'));
frmTextures.TexScrollbarChange(frmTextures); // update browser window
Close();
end;
procedure TfrmNewTexture.FormActivate(Sender: TObject);
var
S, T: string;
begin
// Increment UniqueCount and update the TexName
Inc(NameCounter);
edtTexName.Text := 'MyTex' + IntToStr(NameCounter);
// Set TexSet from frmTexBrowser, with a default value
edtPackage.Text := frmTextures.cmbPackages.Items[frmTextures.cmbPackages.ItemIndex];
if edtPackage.Text = AllString then
edtPackage.Text := 'MyTextures';
// Set TexGroup from frmTexBrowser, with a default value
edtGroup.Text := frmTextures.cmbGroups.Items[frmTextures.cmbGroups.ItemIndex];
if edtGroup.Text = AllString then
edtGroup.Text := 'None';
// Populate TexClass with available texture classes
cmbTextureClass.Clear;
S := ServerGetProp('Class', 'GetChildren Class=Texture Concrete=1');
T := ExtractString(S);
while T <> '' do
begin
cmbTextureClass.Items.Add(T);
if UpperCase(T) = 'FIRETEXTURE' then
cmbTextureClass.ItemIndex := cmbTextureClass.Items.Count - 1;
T := ExtractString(S);
end;
// Set a default index if nothing is selected
if cmbTextureClass.ItemIndex < 0 then
cmbTextureClass.ItemIndex := 0;
end;
end.