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 MajorVer=1
MinorVer=3 MinorVer=3
Release=0 Release=0
Build=21 Build=25
Debug=0 Debug=0
PreRelease=0 PreRelease=0
Special=0 Special=0
@ -126,7 +126,7 @@ CodePage=1252
[Version Info Keys] [Version Info Keys]
CompanyName=AMX Mod X Dev Team CompanyName=AMX Mod X Dev Team
FileDescription= FileDescription=
FileVersion=1.3.0.21 FileVersion=1.3.0.25
InternalName= InternalName=
LegalCopyright= LegalCopyright=
LegalTrademarks= 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) {'); eStr.Add('public ShowMenu' + frmMenuGenerator.txtMenuName.Text + '(id, position) {');
if frmMenuGenerator.chkAddComment.Checked then if frmMenuGenerator.chkAddComment.Checked then
eStr.Add(' // Menu stuff //'); eStr.Add(' // Menu stuff //');
eStr.Add(' if (position < 0) { return 0; }'); eStr.Add(' if (position < 0) { return 0 }-/*');
eStr.Add(' '); eStr.Add(' ');
eStr.Add(' new i, k'); eStr.Add(' new i, k');
eStr.Add(' new MenuBody[255]'); eStr.Add(' new MenuBody[255]');
@ -397,7 +397,7 @@ begin
eStr.Add(' else {'); eStr.Add(' else {');
eStr.Add(' format(MenuBody[Len], (255-Len), "^n%s", position ? "\w' + eBackText + '" : "\w' + eExitText + '")'); eStr.Add(' format(MenuBody[Len], (255-Len), "^n%s", position ? "\w' + eBackText + '" : "\w' + eExitText + '")');
eStr.Add(' }'); 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(' return 0');
eStr.Add('}'); eStr.Add('}');
eStr.Add(''); eStr.Add('');

View File

@ -75,11 +75,16 @@ begin
for i := 0 to eCode.Count - 1 do 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 (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); eString := RemoveStringsAndComments(Trim(eCode[i]), True, True);
if (Pos('/*', eString) = 1) or (Pos('*/', eString) <> 0) then begin if (Pos('/*', eString) = 1) or (Pos('*/', eString) <> 0) then begin
eCActive := (Pos('/*', eString) = 1); eCActive := (Pos('/*', eString) = 1);
continue; if Pos('*/', eString) < Pos('/*', eString) then
continue
else
eCActive := False;
end; end;
if eCActive then if eCActive then
continue; continue;
@ -123,8 +128,8 @@ begin
end; end;
end; end;
eString := RemoveStringsAndComments(Trim(eCode[i]), True, True); eString := RemoveStringsAndComments(Trim(eCode[i]), True, True);
continue;
end; end;
continue;
end; end;
{ Included } { Included }
if (IsAtStart('#include', eBackup)) then begin if (IsAtStart('#include', eBackup)) then begin

View File

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

View File

@ -148,8 +148,12 @@ end;
procedure TfrmMenuGenerator.cmdBackClick(Sender: TObject); procedure TfrmMenuGenerator.cmdBackClick(Sender: TObject);
begin begin
jplMain.ActivePageIndex := 0; if jplMain.ActivePage = jspOldMenuAdd2 then
lblState.Caption := 'Menu Generator'; jplMain.ActivePage := jspOldMenuAdd1
else begin
jplMain.ActivePageIndex := 0;
lblState.Caption := 'Menu Generator';
end;
end; end;
procedure TfrmMenuGenerator.cmdNextClick(Sender: TObject); procedure TfrmMenuGenerator.cmdNextClick(Sender: TObject);
@ -239,7 +243,8 @@ begin
end; end;
procedure TfrmMenuGenerator.cmdOldNext1Click(Sender: TObject); procedure TfrmMenuGenerator.cmdOldNext1Click(Sender: TObject);
var i: integer; var i, k: integer;
a, b: integer;
begin begin
if Trim(rtfMenu.Text) = '' then begin if Trim(rtfMenu.Text) = '' then begin
MessageBox(Handle, 'The menu is empty!', PChar(Application.Title), MB_ICONERROR); 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 for i := 0 to rtfMenu.Lines.Count -1 do begin
if IsNumeric(Copy(rtfMenu.Lines[i], 1, 1)) then if IsNumeric(Copy(rtfMenu.Lines[i], 1, 1)) then
txtKeys.Text := txtKeys.Text + rtfMenu.Lines[i][1]; 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; end;
jplMain.ActivePageIndex := 3; jplMain.ActivePageIndex := 3;
end; end;
@ -287,7 +314,13 @@ begin
rtfMenu.SelText := 'Kick player' + #13 + #13; rtfMenu.SelText := 'Kick player' + #13 + #13;
rtfMenu.SelStart := Length(rtfMenu.Lines.Text); rtfMenu.SelStart := Length(rtfMenu.Lines.Text);
rtfMenu.SelAttributes.Color := clWhite; 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; rtfMenu.SelStart := 0;
end; end;
end; end;