Skip to content

Commit 1cd5bca

Browse files
committed
Add functional to AI
1 parent b8ea9cb commit 1cd5bca

7 files changed

Lines changed: 100 additions & 62 deletions

File tree

src/AI.pas

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
unit AI;
2+
3+
4+
interface
5+
6+
uses
7+
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
8+
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.Grids, Vcl.StdCtrls;
9+
10+
procedure AIVarDesc(var StringGrid1: TStringGrid; var j:integer; var shift:byte; var currvar:string);
11+
procedure AIProcDesc(var StringGrid1: TStringGrid;var j: integer; var curr:string);
12+
implementation
13+
14+
procedure AIProcDesc(var StringGrid1: TStringGrid;var j: integer; var curr:string);
15+
begin
16+
if pos('CLICK', AnsiUpperCase(curr)) > 0 then
17+
StringGrid1.Cells[1,j] := 'Îáðàáîòêà êëèêà';
18+
if pos('RESIZE', AnsiUpperCase(curr)) > 0 then
19+
StringGrid1.Cells[1,j] := 'Îáðàáîòêà èçìåíåíèÿ ðàçìåðà';
20+
if pos('FORMCREATE', AnsiUpperCase(curr)) > 0 then
21+
StringGrid1.Cells[1,j] := 'Ñîáûòèå ïðè ñîçäàíèè ôîðìû';
22+
if pos('MOUSE', AnsiUpperCase(curr)) > 0 then
23+
StringGrid1.Cells[1,j] := 'Îáðàáîòêà íàæàòèå ìûøè';
24+
if ((pos('FILE', AnsiUpperCase(curr)) > 0)
25+
and
26+
(pos('READ', AnsiUpperCase(curr)) > 0)) then
27+
StringGrid1.Cells[1,j] := '×òåíèå ôàéëà';
28+
29+
if ((pos('FILE', AnsiUpperCase(curr)) > 0)
30+
and
31+
(pos('SAVE', AnsiUpperCase(curr)) > 0)) then
32+
StringGrid1.Cells[1,j] := 'Ñîõðàíåíèå ôàéëà';
33+
34+
if ((pos('LIST', AnsiUpperCase(curr)) > 0)
35+
and
36+
(pos('CREATE', AnsiUpperCase(curr)) > 0)) then
37+
StringGrid1.Cells[1,j] := 'Ñîçäàíèå ñïèñêà';
38+
if ((pos('LIST', AnsiUpperCase(curr)) > 0)
39+
and
40+
(pos('INSERT', AnsiUpperCase(curr)) > 0)) then
41+
StringGrid1.Cells[1,j] := 'Âñòàâèòü ýëåìåíò â ñïèñîê';
42+
end;
43+
44+
procedure AIVarDesc(var StringGrid1: TStringGrid; var j:integer; var shift:byte; var currvar:string);
45+
begin
46+
if trim(AnsiLowerCase(currvar)) = 'sender' then
47+
StringGrid1.Cells[4,j + shift] := 'Îáúåêò, êîòîðûé ñãåíåðèðîâàë ñîáûòèå';
48+
if trim(AnsiLowerCase(currvar)) = 'name' then
49+
StringGrid1.Cells[4,j + shift] := 'Èìÿ'
50+
else if pos('name', AnsiLowerCase(currvar)) > 0 then
51+
StringGrid1.Cells[4,j + shift] := 'Íàçâàíèå';
52+
53+
if pos('head', AnsiLowerCase(currvar)) > 0 then
54+
StringGrid1.Cells[4,j + shift] := 'Ãîëîâà';
55+
if pos('fio', AnsiLowerCase(currvar)) > 0 then
56+
StringGrid1.Cells[4,j + shift] := 'ÔÈÎ';
57+
if pos('width', AnsiLowerCase(currvar)) > 0 then
58+
StringGrid1.Cells[4,j + shift] := 'Øèðèíà';
59+
if pos('height', AnsiLowerCase(currvar)) > 0 then
60+
StringGrid1.Cells[4,j + shift] := 'Âûñîòà';
61+
if (pos('temp', AnsiLowerCase(currvar)) > 0) or (pos('tmp', AnsiLowerCase(currvar)) > 0) then
62+
StringGrid1.Cells[4,j + shift] := 'Âðåìåííàÿ ïåðåìåííàÿ';
63+
if pos('curr', AnsiLowerCase(currvar)) > 0 then
64+
StringGrid1.Cells[4,j + shift] := 'Òåêóùåå çíà÷åíèå';
65+
if pos('flag', AnsiLowerCase(currvar)) > 0 then
66+
StringGrid1.Cells[4,j + shift] := 'Ôëàã';
67+
if pos('col', AnsiLowerCase(currvar)) > 0 then
68+
StringGrid1.Cells[4,j + shift] := 'Êîëîíêà';
69+
if pos('row', AnsiLowerCase(currvar)) > 0 then
70+
StringGrid1.Cells[4,j + shift] := 'Ñòðîêà';
71+
if pos('state', AnsiLowerCase(currvar)) > 0 then
72+
StringGrid1.Cells[4,j + shift] := 'Ñòàòóñ';
73+
if pos('action', AnsiLowerCase(currvar)) > 0 then
74+
StringGrid1.Cells[4,j + shift] := 'ñîáûòèå';
75+
if (pos('grid', AnsiLowerCase(currvar)) > 0 ) or (pos('stringgrid', AnsiLowerCase(currvar))>0) then
76+
StringGrid1.Cells[4,j + shift] := 'òàáëèöà';
77+
78+
if pos('rect', AnsiLowerCase(currvar)) > 0 then
79+
StringGrid1.Cells[4,j + shift] := 'ïðÿìîóãîëüíèê';
80+
if (pos('inp', AnsiLowerCase(currvar))>0) or (pos('input', AnsiLowerCase(currvar)) > 0 )then
81+
StringGrid1.Cells[4,j + shift] := 'ââîä';
82+
if (pos('button', AnsiLowerCase(currvar))) or (pos('btn', AnsiLowerCase(currvar)))> 0 then
83+
StringGrid1.Cells[4,j + shift] := 'êíîïêà';
84+
if pos('min', AnsiLowerCase(currvar)) > 0 then
85+
StringGrid1.Cells[4,j + shift] := 'ìèíèìàëüíûé';
86+
if (pos('max', AnsiLowerCase(currvar)) > 0) then
87+
StringGrid1.Cells[4,j + shift] := 'ìàêñèìàëüíûé';
88+
end;
89+
90+
end.
23.9 KB
Binary file not shown.

src/Win32/Debug/AI.dcu

5.97 KB
Binary file not shown.
26.5 KB
Binary file not shown.

src/Win32/Debug/genTable.dcu

-3.51 KB
Binary file not shown.

src/genTable.dfm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ object TableGenForm: TTableGenForm
22
Left = 0
33
Top = 0
44
Caption = #1043#1077#1085#1077#1088#1072#1094#1080#1103' '#1090#1072#1073#1083#1080#1094#1099' '#1087#1086#1076#1087#1088#1086#1075#1088#1072#1084#1084
5-
ClientHeight = 329
5+
ClientHeight = 309
66
ClientWidth = 715
77
Color = clBtnFace
88
Font.Charset = DEFAULT_CHARSET
@@ -3127,7 +3127,7 @@ object TableGenForm: TTableGenForm
31273127
end
31283128
object pnlBottom: TPanel
31293129
Left = 0
3130-
Top = 248
3130+
Top = 228
31313131
Width = 715
31323132
Height = 81
31333133
Align = alBottom
@@ -3137,15 +3137,15 @@ object TableGenForm: TTableGenForm
31373137
ParentBackground = False
31383138
ParentCtl3D = False
31393139
TabOrder = 2
3140-
object btnToWord: TButton
3140+
object btnToExcel: TButton
31413141
Left = 362
31423142
Top = 0
31433143
Width = 353
31443144
Height = 81
31453145
Align = alCustom
31463146
Caption = #1074' Word'
31473147
TabOrder = 0
3148-
OnClick = btnToWordClick
3148+
OnClick = btnToExcelClick
31493149
end
31503150
object btnGenTable: TButton
31513151
Left = 0

src/genTable.pas

Lines changed: 6 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ interface
66
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
77
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.Grids, Vcl.StdCtrls,ComObj, pngimage,
88
Vcl.ExtCtrls, Vcl.Menus, ShellAPI,SplashScreen, IdHTTP, IdBaseComponent,
9-
IdComponent, IdTCPConnection, IdTCPClient, NewVersion;
9+
IdComponent, IdTCPConnection, IdTCPClient, NewVersion, AI;
1010

1111
type
1212
TTableGenForm = class(TForm)
1313
memoInpCode: TMemo;
1414
StringGrid1: TStringGrid;
15-
btnToWord: TButton;
15+
btnToExcel: TButton;
1616
btnGenTable: TButton;
1717
pnlBottom: TPanel;
1818
SaveDialog1: TSaveDialog;
@@ -24,7 +24,7 @@ TTableGenForm = class(TForm)
2424
mnToExcel: TMenuItem;
2525
ImgIntro: TImage;
2626
IdHTTP1: TIdHTTP;
27-
procedure btnToWordClick(Sender: TObject);
27+
procedure btnToExcelClick(Sender: TObject);
2828
procedure btnGenTableClick(Sender: TObject);
2929
procedure FormCreate(Sender: TObject);
3030
procedure FormCanResize(Sender: TObject; var NewWidth, NewHeight: Integer;
@@ -83,7 +83,7 @@ procedure TTableGenForm.mnToExcelClick(Sender: TObject);
8383
btnToExcel.Click;
8484
end;
8585

86-
procedure TTableGenForm.btnToWordClick(Sender: TObject);
86+
procedure TTableGenForm.btnToExcelClick(Sender: TObject);
8787
var
8888
Word,WordTable: variant;
8989
Col, Row: Integer;
@@ -267,34 +267,7 @@ procedure TTableGenForm.btnGenTableClick(Sender: TObject);
267267

268268
StringGrid1.Cells[3,j + shift] := currvar;
269269

270-
if trim(AnsiLowerCase(currvar)) = 'sender' then
271-
StringGrid1.Cells[4,j + shift] := 'Îáúåêò, êîòîðûé ñãåíåðèðîâàë ñîáûòèå';
272-
if trim(AnsiLowerCase(currvar)) = 'name' then
273-
StringGrid1.Cells[4,j + shift] := 'Èìÿ'
274-
else if pos('name', AnsiLowerCase(currvar)) > 0 then
275-
StringGrid1.Cells[4,j + shift] := 'Íàçâàíèå';
276-
277-
if pos('head', AnsiLowerCase(currvar)) > 0 then
278-
StringGrid1.Cells[4,j + shift] := 'Ãîëîâà';
279-
if pos('fio', AnsiLowerCase(currvar)) > 0 then
280-
StringGrid1.Cells[4,j + shift] := 'ÔÈÎ';
281-
if pos('width', AnsiLowerCase(currvar)) > 0 then
282-
StringGrid1.Cells[4,j + shift] := 'Øèðèíà';
283-
if pos('height', AnsiLowerCase(currvar)) > 0 then
284-
StringGrid1.Cells[4,j + shift] := 'Âûñîòà';
285-
if (pos('temp', AnsiLowerCase(currvar)) > 0) or (pos('tmp', AnsiLowerCase(currvar)) > 0) then
286-
StringGrid1.Cells[4,j + shift] := 'Âðåìåííàÿ ïåðåìåííàÿ';
287-
if pos('curr', AnsiLowerCase(currvar)) > 0 then
288-
StringGrid1.Cells[4,j + shift] := 'Òåêóùåå çíà÷åíèå';
289-
if pos('flag', AnsiLowerCase(currvar)) > 0 then
290-
StringGrid1.Cells[4,j + shift] := 'Ôëàã';
291-
if pos('col', AnsiLowerCase(currvar)) > 0 then
292-
StringGrid1.Cells[4,j + shift] := 'Êîëîíêà';
293-
if pos('row', AnsiLowerCase(currvar)) > 0 then
294-
StringGrid1.Cells[4,j + shift] := 'Ñòðîêà';
295-
if pos('state', AnsiLowerCase(currvar)) > 0 then
296-
StringGrid1.Cells[4,j + shift] := 'Ñòàòóñ';
297-
270+
AIVarDesc(StringGrid1, j, shift, currvar);
298271

299272
if variable[k] = ':' then
300273
begin
@@ -328,32 +301,7 @@ procedure TTableGenForm.btnGenTableClick(Sender: TObject);
328301
//StringGrid1.Cells[3,j] := variable;
329302

330303

331-
if pos('CLICK', AnsiUpperCase(curr)) > 0 then
332-
StringGrid1.Cells[1,j] := 'Îáðàáîòêà êëèêà';
333-
if pos('RESIZE', AnsiUpperCase(curr)) > 0 then
334-
StringGrid1.Cells[1,j] := 'Îáðàáîòêà èçìåíåíèÿ ðàçìåðà';
335-
if pos('FORMCREATE', AnsiUpperCase(curr)) > 0 then
336-
StringGrid1.Cells[1,j] := 'Ñîáûòèå ïðè ñîçäàíèè ôîðìû';
337-
if pos('MOUSE', AnsiUpperCase(curr)) > 0 then
338-
StringGrid1.Cells[1,j] := 'Îáðàáîòêà íàæàòèå ìûøè';
339-
if ((pos('FILE', AnsiUpperCase(curr)) > 0)
340-
and
341-
(pos('READ', AnsiUpperCase(curr)) > 0)) then
342-
StringGrid1.Cells[1,j] := '×òåíèå ôàéëà';
343-
344-
if ((pos('FILE', AnsiUpperCase(curr)) > 0)
345-
and
346-
(pos('SAVE', AnsiUpperCase(curr)) > 0)) then
347-
StringGrid1.Cells[1,j] := 'Ñîõðàíåíèå ôàéëà';
348-
349-
if ((pos('LIST', AnsiUpperCase(curr)) > 0)
350-
and
351-
(pos('CREATE', AnsiUpperCase(curr)) > 0)) then
352-
StringGrid1.Cells[1,j] := 'Ñîçäàíèå ñïèñêà';
353-
if ((pos('LIST', AnsiUpperCase(curr)) > 0)
354-
and
355-
(pos('INSERT', AnsiUpperCase(curr)) > 0)) then
356-
StringGrid1.Cells[1,j] := 'Âñòàâèòü ýëåìåíò â ñïèñîê';
304+
AIProcDesc(StringGrid1, j, curr);
357305

358306
k := 1;
359307
tmp := #0;

0 commit comments

Comments
 (0)