Fixed some bugs in the menu generator

Fixed bug in the AutoUpdate function
This commit is contained in:
Christian Hammacher 2005-11-06 14:52:50 +00:00
parent a66f13fc91
commit 78b35d80ee
8 changed files with 74 additions and 36 deletions

View File

@ -115,7 +115,7 @@ AutoIncBuild=1
MajorVer=1
MinorVer=3
Release=0
Build=21
Build=25
Debug=0
PreRelease=0
Special=0
@ -126,7 +126,7 @@ CodePage=1252
[Version Info Keys]
CompanyName=AMX Mod X Dev Team
FileDescription=
FileVersion=1.3.0.21
FileVersion=1.3.0.25
InternalName=
LegalCopyright=
LegalTrademarks=

Binary file not shown.

Binary file not shown.

View File

@ -344,7 +344,7 @@ begin
eStr.Add('public ShowMenu' + frmMenuGenerator.txtMenuName.Text + '(id, position) {');
if frmMenuGenerator.chkAddComment.Checked then
eStr.Add(' // Menu stuff //');
eStr.Add(' if (position < 0) { return 0; }');
eStr.Add(' if (position < 0) { return 0 }-/*');
eStr.Add(' ');
eStr.Add(' new i, k');
eStr.Add(' new MenuBody[255]');
@ -397,7 +397,7 @@ begin
eStr.Add(' else {');
eStr.Add(' format(MenuBody[Len], (255-Len), "^n%s", position ? "\w' + eBackText + '" : "\w' + eExitText + '")');
eStr.Add(' }');
eStr.Add(' show_menu(id, Keys, MenuBody, -1)');
eStr.Add(' show_menu(id, Keys, MenuBody, -1, "' + frmMenuGenerator.txtMenuName.Text + '")');
eStr.Add(' return 0');
eStr.Add('}');
eStr.Add('');

View File

@ -75,11 +75,16 @@ begin
for i := 0 to eCode.Count - 1 do begin
if (Application.Terminated) or (not Started) or (frmMain.pnlLoading.Visible) or (not frmMain.trvExplorer.Visible) then exit;
if Pos('get_user_button', eCode[i]) <> 0 then
eCActive := eCActive;
eString := RemoveStringsAndComments(Trim(eCode[i]), True, True);
if (Pos('/*', eString) = 1) or (Pos('*/', eString) <> 0) then begin
eCActive := (Pos('/*', eString) = 1);
continue;
if Pos('*/', eString) < Pos('/*', eString) then
continue
else
eCActive := False;
end;
if eCActive then
continue;
@ -123,9 +128,9 @@ begin
end;
end;
eString := RemoveStringsAndComments(Trim(eCode[i]), True, True);
end;
continue;
end;
end;
{ Included }
if (IsAtStart('#include', eBackup)) then begin
eString := StringReplace(eBackup, '/', '\', [rfReplaceAll]);

View File

@ -2,7 +2,7 @@ object frmMain: TfrmMain
Left = 257
Top = 302
Width = 888
Height = 641
Height = 646
Caption = 'AMXX-Studio'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
@ -661,7 +661,7 @@ object frmMain: TfrmMain
Left = 0
Top = 72
Width = 880
Height = 519
Height = 524
Align = alClient
ActiveTabIndex = 0
TabPosition = ttpBottom
@ -692,7 +692,7 @@ object frmMain: TfrmMain
Left = 0
Top = 0
Width = 880
Height = 496
Height = 501
Align = alClient
ActiveTabIndex = 0
ThemeType = tttTBX
@ -708,33 +708,33 @@ object frmMain: TfrmMain
Left = 0
Top = 23
Width = 3
Height = 473
Height = 478
Align = alLeft
end
object spcRight1: TImage
Left = 877
Top = 23
Width = 3
Height = 473
Height = 478
Align = alRight
end
object splRight: TSplitter
Left = 669
Top = 23
Height = 473
Height = 478
Align = alRight
end
object pnlParent: TPanel
Left = 3
Top = 23
Width = 666
Height = 473
Height = 478
Align = alClient
BevelOuter = bvNone
TabOrder = 1
object splOutput: TSplitter
Left = 0
Top = 388
Top = 393
Width = 666
Height = 3
Cursor = crVSplit
@ -745,7 +745,7 @@ object frmMain: TfrmMain
Left = 0
Top = 0
Width = 666
Height = 388
Height = 393
Color = clWhite
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
@ -4238,7 +4238,7 @@ object frmMain: TfrmMain
end
object lstOutput: TListBox
Left = 0
Top = 391
Top = 396
Width = 666
Height = 82
Align = alBottom
@ -4303,7 +4303,7 @@ object frmMain: TfrmMain
Left = 672
Top = 23
Width = 205
Height = 473
Height = 478
Align = alRight
ActiveTabIndex = 0
TabPosition = ttpBottom
@ -4325,7 +4325,7 @@ object frmMain: TfrmMain
Left = 0
Top = 0
Width = 205
Height = 450
Height = 455
Caption = 'Notes'
ImageIndex = -1
TabItem = 'tiNotes'
@ -4333,12 +4333,12 @@ object frmMain: TfrmMain
Left = 202
Top = 26
Width = 1
Height = 422
Height = 427
Align = alRight
end
object imgBottom4: TImage
Left = 2
Top = 448
Top = 453
Width = 201
Height = 2
Align = alBottom
@ -4354,7 +4354,7 @@ object frmMain: TfrmMain
Left = 2
Top = 26
Width = 1
Height = 422
Height = 427
Align = alLeft
end
object tbxNotes: TSpTBXToolbar
@ -4400,7 +4400,7 @@ object frmMain: TfrmMain
Left = 3
Top = 26
Width = 199
Height = 422
Height = 427
Align = alClient
TabOrder = 1
OnKeyDown = rtfNotesKeyDown
@ -4411,13 +4411,13 @@ object frmMain: TfrmMain
Left = 0
Top = 0
Width = 205
Height = 450
Height = 455
Caption = 'Code-Tools'
ImageIndex = -1
TabItem = 'tiTools'
object spcBottom2: TImage
Left = 2
Top = 448
Top = 453
Width = 201
Height = 2
Align = alBottom
@ -4426,21 +4426,21 @@ object frmMain: TfrmMain
Left = 2
Top = 2
Width = 3
Height = 446
Height = 451
Align = alLeft
end
object spcRight2: TImage
Left = 200
Top = 2
Width = 3
Height = 446
Height = 451
Align = alRight
end
object pnlDock: TSpTBXMultiDock
Left = 5
Top = 2
Width = 195
Height = 446
Height = 451
Position = dpxClient
object pnlCodeExplorer: TSpTBXDockablePanel
Left = 0
@ -4454,7 +4454,7 @@ object frmMain: TfrmMain
Left = 0
Top = 26
Width = 191
Height = 185
Height = 188
Align = alClient
Images = ilImages
Indent = 19
@ -4483,17 +4483,17 @@ object frmMain: TfrmMain
end
object pnlCodeInspector: TSpTBXDockablePanel
Left = 0
Top = 215
Top = 218
Caption = 'Code-Inspector'
DockedWidth = 191
DockPos = 215
DockPos = 218
TabOrder = 1
OnVisibleChanged = pnlCodeInspectorVisibleChanged
object jviCode: TJvInspector
Left = 0
Top = 26
Width = 191
Height = 185
Height = 187
Align = alClient
Divider = 110
ItemHeight = 16
@ -4508,7 +4508,7 @@ object frmMain: TfrmMain
end
object sbStatus: TSpTBXStatusBar
Left = 0
Top = 591
Top = 596
Width = 880
Height = 23
object mnuFilename: TSpTBXRightAlignSpacerItem

View File

@ -148,9 +148,13 @@ end;
procedure TfrmMenuGenerator.cmdBackClick(Sender: TObject);
begin
if jplMain.ActivePage = jspOldMenuAdd2 then
jplMain.ActivePage := jspOldMenuAdd1
else begin
jplMain.ActivePageIndex := 0;
lblState.Caption := 'Menu Generator';
end;
end;
procedure TfrmMenuGenerator.cmdNextClick(Sender: TObject);
begin
@ -239,7 +243,8 @@ begin
end;
procedure TfrmMenuGenerator.cmdOldNext1Click(Sender: TObject);
var i: integer;
var i, k: integer;
a, b: integer;
begin
if Trim(rtfMenu.Text) = '' then begin
MessageBox(Handle, 'The menu is empty!', PChar(Application.Title), MB_ICONERROR);
@ -250,6 +255,28 @@ begin
for i := 0 to rtfMenu.Lines.Count -1 do begin
if IsNumeric(Copy(rtfMenu.Lines[i], 1, 1)) then
txtKeys.Text := txtKeys.Text + rtfMenu.Lines[i][1];
if lblHelp.Visible then begin
try
if Pos('$players(', LowerCase(rtfMenu.Lines[i])) = 1 then begin
a := StrToInt(Trim(Between(rtfMenu.Lines[i], '$players(', ',')));
b := StrToInt(Trim(Between(rtfMenu.Lines[i], '$players(' + IntToStr(a) + ',', ',')));
for k := a to b do
txtKeys.Text := txtKeys.Text + IntToStr(k);
end;
if Pos('$next(', LowerCase(rtfMenu.Lines[i])) = 1 then begin
a := StrToInt(Trim(Between(rtfMenu.Lines[i], '$next(', ',')));
txtKeys.Text := txtKeys.Text + IntToStr(a);
end;
if Pos('$exitorback(', LowerCase(rtfMenu.Lines[i])) = 1 then begin
a := StrToInt(Trim(Between(rtfMenu.Lines[i], '$exitorback(', ',')));
txtKeys.Text := txtKeys.Text + IntToStr(a);
end;
except
MessageBox(Handle, PChar('Invalid menu.'), PChar(Application.Title), MB_ICONERROR);
end;
end;
end;
jplMain.ActivePageIndex := 3;
end;
@ -287,7 +314,13 @@ begin
rtfMenu.SelText := 'Kick player' + #13 + #13;
rtfMenu.SelStart := Length(rtfMenu.Lines.Text);
rtfMenu.SelAttributes.Color := clWhite;
rtfMenu.SelText := '$players(1,8,%n. %v)' + #13 + '$next(9,9. Next)' + '$exitorback(0,0. Exit,0. Back)';
rtfMenu.SelText := #13 + '$players(1,8,%n. %v)';
rtfMenu.SelStart := Length(rtfMenu.Lines.Text);
rtfMenu.SelAttributes.Color := clWhite;
rtfMenu.SelText := #13 + #13 + '$next(9,9. Next)';
rtfMenu.SelStart := Length(rtfMenu.Lines.Text);
rtfMenu.SelAttributes.Color := clWhite;
rtfMenu.SelText := #13 + '$exitorback(0,0. Exit,0. Back)';
rtfMenu.SelStart := 0;
end;
end;