Massive reorganization attempt - part 2

Moved old/defunct/unofficial modules out of trunk
This commit is contained in:
Scott Ehlert
2007-03-13 19:45:19 +00:00
parent 54186736c8
commit ab53914351
134 changed files with 0 additions and 42663 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 766 B

View File

@ -1,38 +0,0 @@
-$A8
-$B-
-$C+
-$D+
-$E-
-$F-
-$G+
-$H+
-$I+
-$J-
-$K-
-$L+
-$M-
-$N+
-$O+
-$P+
-$Q-
-$R-
-$S-
-$T-
-$U-
-$V+
-$W-
-$X+
-$YD
-$Z1
-cg
-AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
-H+
-W+
-M
-$M16384,1048576
-K$00400000
-LE"c:\programme\borland\delphi7\Projects\Bpl"
-LN"c:\programme\borland\delphi7\Projects\Bpl"
-w-UNSAFE_TYPE
-w-UNSAFE_CODE
-w-UNSAFE_CAST

View File

@ -1,136 +0,0 @@
[FileVersion]
Version=7.0
[Compiler]
A=8
B=0
C=1
D=1
E=0
F=0
G=1
H=1
I=1
J=0
K=0
L=1
M=0
N=1
O=1
P=1
Q=0
R=0
S=0
T=0
U=0
V=1
W=0
X=1
Y=1
Z=1
ShowHints=1
ShowWarnings=1
UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
NamespacePrefix=
SymbolDeprecated=1
SymbolLibrary=1
SymbolPlatform=1
UnitLibrary=1
UnitPlatform=1
UnitDeprecated=1
HResultCompat=1
HidingMember=1
HiddenVirtual=1
Garbage=1
BoundsError=1
ZeroNilCompat=1
StringConstTruncated=1
ForLoopVarVarPar=1
TypedConstVarPar=1
AsgToTypedConst=1
CaseLabelRange=1
ForVariable=1
ConstructingAbstract=1
ComparisonFalse=1
ComparisonTrue=1
ComparingSignedUnsigned=1
CombiningSignedUnsigned=1
UnsupportedConstruct=1
FileOpen=1
FileOpenUnitSrc=1
BadGlobalSymbol=1
DuplicateConstructorDestructor=1
InvalidDirective=1
PackageNoLink=1
PackageThreadVar=1
ImplicitImport=1
HPPEMITIgnored=1
NoRetVal=1
UseBeforeDef=1
ForLoopVarUndef=1
UnitNameMismatch=1
NoCFGFileFound=1
MessageDirective=1
ImplicitVariants=1
UnicodeToLocale=1
LocaleToUnicode=1
ImagebaseMultiple=1
SuspiciousTypecast=1
PrivatePropAccessor=1
UnsafeType=0
UnsafeCode=0
UnsafeCast=0
[Linker]
MapFile=0
OutputObjs=0
ConsoleApp=1
DebugInfo=0
RemoteSymbols=0
MinStackSize=16384
MaxStackSize=1048576
ImageBase=4194304
ExeDescription=
[Directories]
OutputDir=
UnitOutputDir=
PackageDLLOutputDir=
PackageDCPOutputDir=
SearchPath=
Packages=vcl;rtl;vclx;vclie;xmlrtl;inetdbbde;inet;inetdbxpress;VclSmp;dbrtl;dbexpress;vcldb;dsnap;dbxcds;inetdb;bdertl;vcldbx;adortl;teeui;teedb;tee;ibxpress;visualclx;visualdbclx;vclactnband;vclshlctrls;IntrawebDB_50_70;Intraweb_50_70;Rave50CLX;Rave50VCL;dclOffice2k;JvStdCtrlsD7R;JvAppFrmD7R;JvCoreD7R;JvBandsD7R;JvBDED7R;JvDBD7R;JvDlgsD7R;JvCmpD7R;JvCryptD7R;JvCtrlsD7R;JvCustomD7R;JvDockingD7R;JvDotNetCtrlsD7R;JvEDID7R;qrpt;JvGlobusD7R;JvHMID7R;JvInspectorD7R;JvInterpreterD7R;JvJansD7R;JvManagedThreadsD7R;JvMMD7R;JvNetD7R;JvPageCompsD7R;JvPluginD7R;JvPrintPreviewD7R;JvSystemD7R;JvTimeFrameworkD7R;JvUIBD7R;JvValidatorsD7R;JvWizardD7R;JvXPCtrlsD7R;Indy70;FlatStyle_D5;CrossKylix;DJcl;DelphiX_for7
Conditionals=
DebugSourceDirs=
UsePackages=0
[Parameters]
RunParams=
HostApplication=
Launcher=
UseLauncher=0
DebugCWD=
[Language]
ActiveLang=
ProjectLang=
RootDir=
[Version Info]
IncludeVerInfo=1
AutoIncBuild=1
MajorVer=2
MinorVer=1
Release=0
Build=6
Debug=0
PreRelease=0
Special=0
Private=0
DLL=0
Locale=1031
CodePage=1252
[Version Info Keys]
CompanyName=AMX Mod X
FileDescription=Final
FileVersion=2.1.0.6
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=AMXX-Edit v2
ProductVersion=2.1.0.0
Comments=

View File

@ -1,76 +0,0 @@
program AMXX_Edit_v2;
{
AMXX-Edit v2
Editor for AMX Mod X scripts, coded by Basic-Master
<20> by AMX Mod X Development Team
This application uses the following components:
DelphiSci: delphisci.sourceforge.net (based on Scintilla library: scintilla.sourceforge.net)
FlatStyle by Maik Porkert (found on www.torry.net)
GlyFX Icons: www.glyfx.com (using GlyFX Icon Pack of Delphi 2005 PE)
Modified CorelButton (see CorelButton.pas, original by ConquerWare)
Indy 9 Socket Components: www.indyproject.org
[JEDI component library, only necersarry for Exception Dialog (jvcl.sourceforge.net)]
AMXX-Edit v2 is published under GNU General Public License and comes
with ABSOLUTELY NO WARRANTY (see GPL.txt for more information)
}
//{$DEFINE EXCEPTION_DEBUG} // Remove comments only when you want to trace exceptions
uses
Forms,
Windows,
Classes,
SysUtils,
UnitfrmMain in 'UnitfrmMain.pas' {frmMain},
UnitfrmOptions in 'UnitfrmOptions.pas' {frmSettings},
UnitfrmDebug in 'UnitfrmDebug.pas' {frmDebug},
UnitFunc in 'UnitFunc.pas',
UnitfrmAbout in 'UnitfrmAbout.pas' {frmAbout},
UnitfrmGoToLine in 'UnitfrmGoToLine.pas' {frmGoToLine},
UnitfrmSaveDialog in 'UnitfrmSaveDialog.pas' {frmSaveDialog},
UnitTextAnalyze in 'UnitTextAnalyze.pas',
UnitfrmMenuMaker in 'UnitfrmMenuMaker.pas' {frmMenuMaker},
UnitAddMenu in 'UnitAddMenu.pas',
UnitfrmSelectMenu in 'UnitfrmSelectMenu.pas' {frmSelectMenu},
UnitHowToMakePlayerMenu in 'UnitHowToMakePlayerMenu.pas' {frmHowToMakePlayerMenu},
UnitfrmSockets in 'UnitfrmSockets.pas' {frmSocketTerminal},
UnitReadThread in 'UnitReadThread.pas',
UnitfrmLoopGenerator in 'UnitfrmLoopGenerator.pas' {frmLoopGenerator},
UnitfrmExceptionHandler in 'UnitfrmExceptionHandler.pas' {ExceptionDialog};
{$R *.res}
var i: integer;
begin
if (FindWindow('TfrmMain', 'AMXX-Edit v2') <> 0) then begin // Don't allow 2 starts...
for i := 1 to ParamCount do begin
if FileExists(ParamStr(i)) then
SendOpen(ParamStr(i)); // ... and send open message to the other app
end;
ShowWindow(FindWindow('TfrmMain', 'AMXX-Edit v2'), SW_SHOW);
SetForegroundWindow(FindWindow('TfrmMain', 'AMXX-Edit v2'));
exit;
end;
Application.Initialize;
Application.Title := 'AMXX-Edit v2';
Application.CreateForm(TfrmMain, frmMain);
Application.CreateForm(TfrmSettings, frmSettings);
Application.CreateForm(TfrmDebug, frmDebug);
Application.CreateForm(TfrmAbout, frmAbout);
Application.CreateForm(TfrmGoToLine, frmGoToLine);
Application.CreateForm(TfrmSaveDialog, frmSaveDialog);
Application.CreateForm(TfrmMenuMaker, frmMenuMaker);
Application.CreateForm(TfrmSelectMenu, frmSelectMenu);
Application.CreateForm(TfrmHowToMakePlayerMenu, frmHowToMakePlayerMenu);
Application.CreateForm(TfrmSocketTerminal, frmSocketTerminal);
Application.CreateForm(TfrmLoopGenerator, frmLoopGenerator);
Load;
Apply;
Application.Run;
end.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,300 +0,0 @@
(**
* TCorelButton v1.0
* ---------------------------------------------------------------------------
* A standard TButton which mimic the buttons used in the new Corel products
* (e.g. WordPerfect Suite and Corel Photopaint).
*
* Copyright 1998, Peter Theill. All Rights Reserved.
*
* This component can be freely used and distributed in commercial and private
* environments, provied this notice is not modified in any way and there is
* no charge for it other than nomial handling fees. Contact me directly for
* modifications to this agreement.
* ----------------------------------------------------------------------------
* Feel free to contact me if you have any questions, comments or suggestions
* at peter@conquerware.dk
*
* The latest version will always be available on the web at:
* http://www.conquerware.dk/delphi/
*
* See CorelButton.txt for notes, known issues and revision history.
* ----------------------------------------------------------------------------
* Last modified: September 6, 1998
* ----------------------------------------------------------------------------
*)
unit CorelButton;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TCorelButton = class(TButton)
private
FCanvas: TCanvas;
IsFocused: Boolean;
FIsMouseOver: Boolean;
FCanSelect: Boolean;
procedure CNMeasureItem(var Msg: TWMMeasureItem); message CN_MEASUREITEM;
procedure CNDrawItem(var Msg: TWMDrawItem); message CN_DRAWITEM;
procedure CMFontChanged(var Message: TMessage); message CM_FONTCHANGED;
procedure CMEnabledChanged(var Message: TMessage); message CM_ENABLEDCHANGED;
procedure WMLButtonDblClk(var Message: TWMLButtonDblClk); message WM_LBUTTONDBLCLK;
procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER;
procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE;
procedure DrawItem(const DrawItemStruct: TDrawItemStruct);
procedure SetCanSelect(const Value: Boolean);
protected
procedure CreateParams(var Params: TCreateParams); override;
procedure SetButtonStyle(ADefault: Boolean); override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
property CanSelect: Boolean read FCanSelect write SetCanSelect default True;
end;
procedure Register;
implementation
constructor TCorelButton.Create(AOwner: TComponent);
begin
{ Do standard stuff }
inherited Create(AOwner);
FCanvas := TCanvas.Create;
FIsMouseOver := False;
{ Set width and height of button }
Width := 75;
Height := 23;
end;
destructor TCorelButton.Destroy;
begin
FCanvas.Free;
inherited Destroy;
end;
procedure TCorelButton.CMMouseEnter(var Message: TMessage);
begin
if (not FIsMouseOver) then
Invalidate;
end;
procedure TCorelButton.CMMouseLeave(var Message: TMessage);
begin
if (FIsMouseOver) then
Invalidate;
end;
procedure TCorelButton.CNMeasureItem(var Msg: TWMMeasureItem);
begin
with Msg.MeasureItemStruct^ do begin
itemWidth := Width;
itemHeight := Height;
end;
Msg.Result := 1;
end;
procedure TCorelButton.CNDrawItem(var Msg: TWMDrawItem);
begin
DrawItem(Msg.DrawItemStruct^);
Msg.Result := 1;
end;
procedure TCorelButton.DrawItem(const DrawItemStruct: TDrawItemStruct);
var
IsDown, IsDefault: Boolean;
R: TRect;
// Flags: Longint;
CursorPos: TPoint;
BtnRect: TRect;
begin
FCanvas.Handle := DrawItemStruct.hDC;
try
R := ClientRect;
with DrawItemStruct do begin
IsDown := (itemState and ODS_SELECTED) <> 0;
IsDefault := (itemState and ODS_FOCUS) <> 0;
end;
GetCursorPos(CursorPos);
BtnRect.TopLeft := Parent.ClientToScreen(Point(Left, Top));
BtnRect.BottomRight := Parent.ClientToScreen(Point(Left + Width,
Top + Height));
FIsMouseOver := PtInRect(BtnRect, CursorPos);
// Flags := DFCS_BUTTONPUSH or DFCS_ADJUSTRECT;
// if IsDown then Flags := Flags or DFCS_PUSHED;
// if DrawItemStruct.itemState and ODS_DISABLED <> 0 then
// Flags := Flags or DFCS_INACTIVE;
FCanvas.Brush.Color := clBtnFace;
if {(csDesigning in ComponentState) OR} (IsDefault) or (FCanSelect) and (IsFocused) then begin
FCanvas.Pen.Color := clWindowText;
FCanvas.Pen.Width := 1;
FCanvas.Brush.Style := bsSolid;
FCanvas.Rectangle(R.Left, R.Top, R.Right, R.Bottom);
InflateRect(R, -1, -1);
end;
FCanvas.FillRect(R);
if (csDesigning in ComponentState) OR (FIsMouseOver) then begin
FCanvas.Pen.Color := clWindowText;
FCanvas.MoveTo(R.Right-1, R.Top);
FCanvas.LineTo(R.Right-1, R.Bottom-1);
FCanvas.LineTo(R.Left-1, R.Bottom-1);
FCanvas.Pen.Color := clBtnHighlight;
FCanvas.MoveTo(R.Left, R.Bottom-2);
FCanvas.LineTo(R.Left, R.Top);
FCanvas.LineTo(R.Right-1, R.Top);
FCanvas.Pen.Color := clBtnShadow;
FCanvas.MoveTo(R.Right-2, R.Top+1);
FCanvas.LineTo(R.Right-2, R.Bottom-2);
FCanvas.LineTo(R.Left, R.Bottom-2);
end else begin
FCanvas.Pen.Color := clBtnHighlight;
FCanvas.Pen.Width := 1;
FCanvas.MoveTo(R.Left, R.Bottom-2);
FCanvas.LineTo(R.Left, R.Top);
FCanvas.LineTo(R.Right-1, R.Top);
FCanvas.Pen.Color := clBtnShadow;
FCanvas.LineTo(R.Right-1, R.Bottom-1);
FCanvas.LineTo(R.Left-1, R.Bottom-1);
end;
if {(csDesigning in ComponentState) OR} (IsDown) then begin
FCanvas.Brush.Color := clBtnFace;
FCanvas.FillRect(R);
FCanvas.Pen.Color := clBtnShadow;
FCanvas.Pen.Width := 1;
FCanvas.MoveTo(R.Left, R.Bottom-2);
FCanvas.LineTo(R.Left, R.Top);
FCanvas.LineTo(R.Right-1, R.Top);
FCanvas.Pen.Color := clBtnHighlight;
FCanvas.LineTo(R.Right-1, R.Bottom-1);
FCanvas.LineTo(R.Left-1, R.Bottom-1);
end;
if {(csDesigning in ComponentState) OR} (IsFocused) and (IsDefault) and (FCanSelect) then begin
InflateRect(R, -3, -3);
FCanvas.Pen.Color := clWindowFrame;
FCanvas.Brush.Color := clBtnFace;
DrawFocusRect(FCanvas.Handle, R);
end;
if (IsDown) then
OffsetRect(R, 1, 1);
{ Draw caption of button }
with FCanvas do begin
FCanvas.Font := Self.Font;
Brush.Style := bsClear;
Font.Color := clBtnText;
if Enabled or ((DrawItemStruct.itemState and ODS_DISABLED) = 0) then begin
DrawText(Handle, PChar(Caption), Length(Caption), R, DT_CENTER or
DT_VCENTER or DT_SINGLELINE);
end else begin
OffsetRect(R, 1, 1);
Font.Color := clBtnHighlight;
DrawText(Handle, PChar(Caption), Length(Caption), R, DT_CENTER or
DT_VCENTER or DT_SINGLELINE);
OffsetRect(R, -1, -1);
Font.Color := clBtnShadow;
DrawText(Handle, PChar(Caption), Length(Caption), R, DT_CENTER or
DT_VCENTER or DT_SINGLELINE);
end;
end;
finally
FCanvas.Handle := 0;
end;
end;
procedure TCorelButton.CMFontChanged(var Message: TMessage);
begin
inherited;
Invalidate;
end;
procedure TCorelButton.CMEnabledChanged(var Message: TMessage);
begin
inherited;
Invalidate;
end;
procedure TCorelButton.WMLButtonDblClk(var Message: TWMLButtonDblClk);
begin
Perform(WM_LBUTTONDOWN, Message.Keys, Longint(Message.Pos));
end;
procedure TCorelButton.SetButtonStyle(ADefault: Boolean);
begin
if ADefault <> IsFocused then begin
IsFocused := ADefault;
Refresh;
end;
end;
procedure TCorelButton.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
Params.Style := Params.Style OR BS_OWNERDRAW;
end;
procedure Register;
begin
RegisterComponents('Standard', [TCorelButton]);
end;
procedure TCorelButton.SetCanSelect(const Value: Boolean);
begin
FCanSelect := Value;
Repaint;
end;
end.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

View File

@ -1,436 +0,0 @@
unit UnitAddMenu;
interface
uses SysUtils, Classes, Graphics, Dialogs, Windows;
function AddMenu: Boolean;
function AddPlayerMenu: Boolean;
function GetFirst(eStart: String; eSearchMain: Boolean): Integer;
function GetLast(eStart: String; eSearchMain: Boolean): Integer;
function AddIfDoesntExist(eInclude: String): Boolean;
implementation
uses UnitfrmMenuMaker, UnitfrmMain, UnitTextAnalyze, UnitFunc;
{ Normal Menu }
function AddMenu: Boolean;
var eColoredMenu, DefinedKeys: String;
i: integer;
eStr: TStringList;
begin
Result := GetFirst('public Show' + frmMenuMaker.txtMenuName.Text, True) = -1;
if not Result then
exit;
eStr := TStringList.Create;
{ Transform text }
eColoredMenu := frmMenuMaker.GetColoredMenu;
if frmMenuMaker.chkAppendOnlyMenuText.Checked then begin
frmMain.sciEditor.Lines.Add('// Created menu: ' + eColoredMenu);
exit;
end;
{ Add functions }
eStr.Add(Format('public Show%s(id) {', [frmMenuMaker.txtMenuName.Text]));
eStr.Add(' show_menu(id, Keys' + frmMenuMaker.txtMenuName.Text + ', "' + eColoredMenu + '", -1, "' + frmMenuMaker.txtMenuName.Text + '")');
if frmMenuMaker.chkAddComment.Checked then
eStr[eStr.Count -1] := eStr[eStr.Count -1] + ' // Display menu';
eStr.Add('}');
eStr.Add('');
eStr.Add('public Pressed' + frmMenuMaker.txtMenuName.Text + '(id, key) {');
if frmMenuMaker.chkAddComment.Checked then begin
eStr.Add(' /* Menu:');
for i := 0 to frmMenuMaker.rtfEditor.Lines.Count -1 do
eStr.Add(' * ' + frmMenuMaker.rtfEditor.Lines[i]);
eStr.Add(' */');
eStr.Add('');
end;
eStr.Add(' switch (key) {');
DefinedKeys := '';
for i := 1 to Length(frmMenuMaker.txtKeys.Text) do begin
if frmMenuMaker.txtKeys.Text[i] = '0' then begin
DefinedKeys := DefinedKeys + '|(1<<9)';
if frmMenuMaker.chkAddComment.Checked then
eStr.Add(' case 9: { // 0')
else
eStr.Add(' case 9: {');
eStr.Add(' ');
eStr.Add(' }');
end
else begin
DefinedKeys := DefinedKeys + '|(1<<' + IntToStr(StrToInt(frmMenuMaker.txtKeys.Text[i]) -1) + ')';
if frmMenuMaker.chkAddComment.Checked then
eStr.Add(' case ' + IntToStr(StrToInt(frmMenuMaker.txtKeys.Text[i]) -1) + ': { // ' + frmMenuMaker.txtKeys.Text[i])
else
eStr.Add(' case ' + IntToStr(StrToInt(frmMenuMaker.txtKeys.Text[i]) -1) + ': {');
eStr.Add(' ');
eStr.Add(' }');
end;
end;
Delete(DefinedKeys, 1, 1);
if frmMenuMaker.chkAddComment.Checked then
DefinedKeys := DefinedKeys + ' // Keys: ' + frmMenuMaker.txtKeys.Text;
eStr.Add(' }');
eStr.Add('}');
// Insert
AddIfDoesntExist('amxmodx');
i := GetFirst('#define', True) +2;
if i = 1 then
i := GetFirst('#include', True) +2;
if i = 1 then
i := 0;
frmMain.sciEditor.Lines.Insert(i, Format('#define Keys%s %s', [frmMenuMaker.txtMenuName.Text, DefinedKeys]));
frmMain.sciEditor.Lines.Text := frmMain.sciEditor.Lines.Text + #13 + eStr.Text;
if frmMenuMaker.chkRegisterMenuCommand.Checked then begin
i := GetFirst('register_plugin', True) +2;
if i = 1 then
i := GetFirst('public plugin_init()', True) +2;
if i = 1 then begin
eStr.Clear;
eStr.Add('public plugin_init() {');
eStr.Add(' register_menucmd(register_menuid("' + frmMenuMaker.txtMenuName.Text + '"), Keys' + frmMenuMaker.txtMenuName.Text + ', "Pressed' + frmMenuMaker.txtMenuName.Text + '")');
eStr.Add('}');
frmMain.sciEditor.Lines.Insert(GetFirst('#define', True) +2, '');
frmMain.sciEditor.Lines.Insert(GetFirst('#define', True) +3, eStr.Text);
end
else
frmMain.sciEditor.Lines.Insert(i, ' register_menucmd(register_menuid("' + frmMenuMaker.txtMenuName.Text + '"), Keys' + frmMenuMaker.txtMenuName.Text + ', "Pressed' + frmMenuMaker.txtMenuName.Text + '")');
end;
frmMain.SetModified;
eStr.Free;
UpdateList(frmMain.sciEditor.Lines.Text);
end;
{ Player Menu }
function AddPlayerMenu: Boolean;
function PrepareItem(eItem: String; eDisabled: Boolean): String; // Remove colors etc.
begin
eItem := StringReplace(eItem, '\w', '', [rfReplaceAll, rfIgnoreCase]);
eItem := StringReplace(eItem, '\y', '', [rfReplaceAll, rfIgnoreCase]);
eItem := StringReplace(eItem, '\r', '', [rfReplaceAll, rfIgnoreCase]);
eItem := StringReplace(eItem, '\d', '', [rfReplaceAll, rfIgnoreCase]);
eItem := StringReplace(eItem, '%n', '%i', [rfIgnoreCase]);
eItem := StringReplace(eItem, '%v', '%s', [rfIgnoreCase]);
if eDisabled then
eItem := '\d' + eItem
else
eItem := '\w' + eItem;
Result := eItem + '^n';
end;
var i: integer;
eStr: TStringList;
ePlayersFrom, ePlayersTo: Integer; // Players
ePlayerFormat: String;
eNext, eExit: Integer; // Next and Back/Exit
eNextText, eBackText, eExitText: String;
eCurLineIndex: Integer; // Current ..
eCurLine: String; // .. line
DefinedKeys: String; // Action Keys
begin
Result := GetFirst('public Show' + frmMenuMaker.txtMenu.Text, True) = -1;
if not Result then begin
MessageBox(frmMenuMaker.Handle, 'Menu already exists. Please choose another name.', 'Warning', MB_ICONWARNING);
exit;
end;
{
Kick player
$players(1,8,%n. %v)
$next(9,9. Next)
$exitorback(0, 0. Exit, 0. Back)
}
eCurLine := frmMenuMaker.rtfEditor.Lines[0];
eCurLineIndex := 0;
eNext := -1;
eExit := -1;
eStr := TStringList.Create;
// Prepare Values
try
{ Players }
eCurLineIndex := GetFirst('$players', False);
eCurLine := frmMenuMaker.rtfEditor.Lines[eCurLineIndex];
ePlayersFrom := StrToInt(Between(LowerCase(Trim(eCurLine)), '$players(', ','));
ePlayersTo := StrToInt(Between(Trim(LowerCase(eCurLine)), ',', ','));
while CountChars(eCurLine, ',') > 1 do
Delete(eCurLine, 1, 1);
ePlayerFormat := Between(LowerCase(eCurLine), ',', ')');
{ Next }
if GetFirst('$next', False) <> -1 then begin
eCurLineIndex := GetFirst('$next', False);
eCurLine := frmMenuMaker.rtfEditor.Lines[eCurLineIndex];
eNext := StrToInt(Trim(Between(eCurLine, '(', ',')));
eNextText := Between(eCurLine, ',', ')');
end;
{ Exit or Back }
if GetFirst('$exitorback', False) <> -1 then begin
eCurLineIndex := GetFirst('$exitorback', False);
eCurLine := frmMenuMaker.rtfEditor.Lines[eCurLineIndex];
eExit := StrToInt(Trim(Between(eCurLine, '(', ',')));
eExitText := Between(eCurLine, ',', ',');
while CountChars(eCurLine, ',') > 1 do
Delete(eCurLine, 1, 1);
eBackText := Between(eCurLine, ',', ')');
end;
except
MessageBox(frmMenuMaker.Handle, PChar(Format('Syntax error at line %s: ' + #13 + '%s', [IntToStr(eCurLineIndex +1), frmMenuMaker.rtfEditor.Lines[eCurLineIndex]])), 'Error', MB_ICONERROR);
Result := False;
exit;
end;
// Check Keys
{ Players }
if (ePlayersFrom < 0) or (ePlayersFrom > ePlayersTo) then begin
MessageBox(frmMenuMaker.Handle, 'Invalid start key (players)', 'Warning', MB_ICONWARNING);
Result := False;
exit;
end;
if (ePlayersTo < 0) or (ePlayersTo > 9) then begin
MessageBox(frmMenuMaker.Handle, 'Invalid stop key (players)', 'Warning', MB_ICONWARNING);
Result := False;
exit;
end;
{ Next, Exit and Custom keys}
eCurLine := '';
for i := ePlayersFrom to ePlayersTo do
eCurLine := eCurLine + IntToStr(i);
if Pos(IntToStr(eNext), eCurLine) > 0 then begin
MessageBox(frmMenuMaker.Handle, PChar(Format('"Next" key already in use (%s). Delete it or choose another one and try again.', [IntToStr(eNext)])), 'Warning', MB_ICONWARNING);
Result := False;
exit;
end;
if Pos(IntToStr(eExit), eCurLine) > 0 then begin
MessageBox(frmMenuMaker.Handle, PChar(Format('"Exit" key already in use (%s). Delete it or choose another one and try again.', [IntToStr(eExit)])), 'Warning', MB_ICONWARNING);
Result := False;
exit;
end;
eCurLine := eCurLine + IntToStr(eNext);
eCurLine := eCurLine + IntToStr(eExit);
// Insert Code
try
{ Includes }
AddIfDoesntExist('amxmodx');
AddIfDoesntExist('amxmisc');
{ Define Keys }
DefinedKeys := '';
if Length(eCurLine) <> 0 then begin
for i := 1 to Length(eCurLine) do begin
if eCurLine[i] = '0' then
DefinedKeys := DefinedKeys + '|(1<<9)'
else begin
eCurLine[i] := IntToStr(StrToInt(eCurLine[i]) -1)[1];
DefinedKeys := DefinedKeys + '|(1<<' + eCurLine[i] + ')';
end;
end;
Delete(DefinedKeys, 1, 1);
end;
i := GetLast('#define', True) +2;
if i = 1 then
i := GetLast('#include', True) +2;
if i = 1 then
i := 0;
frmMain.sciEditor.Lines.Insert(i, Format('#define Keys%s %s', [frmMenuMaker.txtMenu.Text, DefinedKeys]));
frmMain.sciEditor.Lines.Insert(i +1, 'new MenuPos' + frmMenuMaker.txtMenu.Text);
frmMain.sciEditor.Lines.Insert(i +2, 'new MenuPlayers' + frmMenuMAker.txtMenu.Text + '[32]');
{ Register }
i := GetFirst('register_plugin', True) +2;
if i = 1 then
i := GetFirst('public plugin_init()', True) +2;
if i = 1 then begin
eStr.Clear;
eStr.Add('public plugin_init() {');
eStr.Add(' register_menucmd(register_menuid("' + frmMenuMaker.txtMenu.Text + '"), Keys' + frmMenuMaker.txtMenu.Text + ', "Pressed' + frmMenuMaker.txtMenu.Text + '")');
eStr.Add('}');
frmMain.sciEditor.Lines.Insert(GetFirst('#define', True) +2, '');
frmMain.sciEditor.Lines.Insert(GetFirst('#define', True) +3, eStr.Text);
end
else
frmMain.sciEditor.Lines.Insert(i, ' register_menucmd(register_menuid("' + frmMenuMaker.txtMenu.Text + '"), Keys' + frmMenuMaker.txtMenu.Text + ', "Pressed' + frmMenuMaker.txtMenu.Text + '")');
{ Show Menu Functions (thx to xeroblood for code example) }
eStr.Clear;
eStr.Add('public Show' + frmMenuMaker.txtMenu.Text + '(id) {');
eStr.Add(' ShowMenu' + frmMenuMaker.txtMenu.Text + '(id, MenuPos' + frmMenuMaker.txtMenu.Text + ' = 0)');
eStr.Add(' return PLUGIN_HANDLED');
eStr.Add('}');
eStr.Add('');
eStr.Add('public ShowMenu' + frmMenuMaker.txtMenu.Text + '(id, position) {');
if frmMenuMaker.chkComments.Checked then
eStr.Add(' // Menu stuff //');
eStr.Add(' if (position < 0) { return 0; }');
eStr.Add(' ');
eStr.Add(' new i, k');
eStr.Add(' new MenuBody[255]');
eStr.Add(' new CurrentKey = ' + IntToStr(ePlayersFrom -1));
eStr.Add(' new Start = position * ' + IntToStr(ePlayersTo - ePlayersFrom));
eStr.Add(' new Num');
eStr.Add(' new UserName[32]');
eStr.Add(' ');
eStr.Add(' get_players(MenuPlayers' + frmMenuMaker.txtMenu.Text + ', Num)');
eStr.Add(' if (Start >= Num) { Start = position = MenuPos' + frmMenuMaker.txtMenu.Text + ' = 0; }');
eCurLine := frmMenuMaker.GetColoredMenu;
eCurLine := Copy(eCurLine, 1, Pos('$players', eCurLine) -3);
Insert('\R%d/%d^n\w', eCurLine, Pos('^n', eCurLine));
eStr.Add(' new Len = format(MenuBody, 255, "' + eCurLine + '", position+1, (Num / ' + IntToStr(ePlayersTo - ePlayersFrom) + ' + ((Num % ' + IntToStr(ePlayersTo - ePlayersFrom) + ') ? 1 : 0 )) )');
eStr.Add(' new End = Start + ' + IntToStr(ePlayersTo - ePlayersFrom));
if eExit = 0 then
eStr.Add(' new Keys = (1<<9)')
else
eStr.Add(' new Keys = (1<<' + IntToStr(eExit -1) + ')');
eStr.Add(' if (End > Num) { End = Num; }');
eStr.Add(' ');
eStr.Add(' for(i=Start;i<End;i++) {');
eStr.Add(' k = MenuPlayers' + frmMenuMaker.txtMenu.Text + '[i]');
eStr.Add(' get_user_name(k, UserName, 31)');
// Any conditions?
if (frmMenuMaker.chkImmunity.Checked) and (frmMenuMaker.chkAlive.Checked) then
eStr.Add(' if ((get_user_flags(k) & ADMIN_IMMUNITY) || !is_user_alive(k)) {')
else if (frmMenuMaker.chkImmunity.Checked) then
eStr.Add(' if (get_user_flags(k) & ADMIN_IMMUNITY) {')
else if (frmMenuMaker.chkAlive.Checked) then
eStr.Add(' if (!is_user_alive(k)) {');
if (frmMenuMaker.chkImmunity.Checked) or (frmMenuMaker.chkAlive.Checked) then begin
eStr.Add(' CurrentKey++');
eStr.Add(' Len += format(MenuBody[Len], (255-Len), "' + PrepareItem(ePlayerFormat, True) + '", CurrentKey, UserName)');
eStr.Add(' }');
eStr.Add(' else {');
eStr.Add(' Keys |= (1<<CurrentKey++)');
eStr.Add(' Len += format(MenuBody[Len], (255-Len), "' + PrepareItem(ePlayerFormat, False) + '", CurrentKey, UserName)');
eStr.Add(' }');
end
else begin
eStr.Add(' Keys |= (i<<CurrentKey++)');
eStr.Add(' Len += format(MenuBody[Len], (255-Len), "' + PrepareItem(ePlayerFormat, False) + '", CurrentKey, UserName)');
end;
eStr.Add(' }');
eStr.Add(' if (End != Num) {');
eStr.Add(' format(MenuBody[Len], (255-Len), "^n\w' + eNextText + '^n%s", position ? "\w' + eBackText + '" : "\w' + eExitText + '")');
eStr.Add(' Keys |= (1<<' + IntToStr(eNext -1) + ')');
eStr.Add(' }');
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(' return 0');
eStr.Add('}');
eStr.Add('');
eStr.Add('public Pressed' + frmMenuMaker.txtMenu.Text + '(id, key) {');
eStr.Add(' switch (key) {');
if frmMenuMaker.chkComments.Checked then begin
if eNext <> 0 then
eStr.Add(' case ' + IntToStr(eNext -1) + ': ShowMenu' + frmMenuMaker.txtMenu.Text + '(id, ++MenuPos' + frmMenuMaker.txtMenu.Text + ') // More Option')
else
eStr.Add(' case 9: ShowMenu' + frmMenuMaker.txtMenu.Text + '(id, ++MenuPos' + frmMenuMaker.txtMenu.Text + ') // More Option');
if eExit <> 0 then
eStr.Add(' case ' + IntToStr(eExit -1) + ': ShowMenu' + frmMenuMaker.txtMenu.Text + '(id, --MenuPos' + frmMenuMaker.txtMenu.Text + ') // Back Option')
else
eStr.Add(' case 9: ShowMenu' + frmMenuMaker.txtMenu.Text + '(id, --MenuPos' + frmMenuMaker.txtMenu.Text + ') // Back Option');
end
else begin
if eNext <> 0 then
eStr.Add(' case ' + IntToStr(eNext -1) + ': ShowMenu' + frmMenuMaker.txtMenu.Text + '(id, ++MenuPos' + frmMenuMaker.txtMenu.Text + ')')
else
eStr.Add(' case 9: ShowMenu' + frmMenuMaker.txtMenu.Text + '(id, ++MenuPos' + frmMenuMaker.txtMenu.Text + ')');
if eExit <> 0 then
eStr.Add(' case ' + IntToStr(eExit -1) + ': ShowMenu' + frmMenuMaker.txtMenu.Text + '(id, --MenuPos' + frmMenuMaker.txtMenu.Text + ')')
else
eStr.Add(' case 9: ShowMenu' + frmMenuMaker.txtMenu.Text + '(id, --MenuPos' + frmMenuMaker.txtMenu.Text + ')');
end;
eStr.Add(' default: {');
if frmMenuMaker.chkComments.Checked then
eStr.Add(' // Get User ID and Username');
eStr.Add(' new PlayerID = MenuPlayers' + frmMenuMaker.txtMenu.Text + '[MenuPos' + frmMenuMaker.txtMenu.Text + ' * ' + IntToStr(ePlayersTo - ePlayersFrom) + ' + key]');
eStr.Add(' new UserName[32]');
eStr.Add(' get_user_name(PlayerID, UserName, 31)');
if frmMenuMaker.chkComments.Checked then
eStr.Add(' // Do actions here')
else
eStr.Add(' ');
eStr.Add(' }');
eStr.Add(' }');
eStr.Add(' return PLUGIN_HANDLED');
eStr.Add('}');
frmMain.sciEditor.Lines.Text := frmMain.sciEditor.Lines.Text + #13 + eStr.Text;
except
MessageBox(frmMenuMaker.Handle, PChar('An error occured while inserting code!'), 'Warning', MB_ICONWARNING);
end;
frmMain.SetModified;
eStr.Free;
end;
{ Functions }
function GetFirst(eStart: String; eSearchMain: Boolean): Integer;
var i: integer;
begin
eStart := LowerCase(Trim(eStart));
Result := -1;
if eSearchMain then begin
for i := 0 to frmMain.sciEditor.Lines.Count -1 do begin
if Pos(eStart, LowerCase(Trim(frmMain.sciEditor.Lines[i]))) = 1 then begin
Result := i;
exit;
end;
end;
end
else begin
for i := 0 to frmMenuMaker.rtfEditor.Lines.Count -1 do begin
if Pos(eStart, LowerCase(Trim(frmMenuMaker.rtfEditor.Lines[i]))) = 1 then begin
Result := i;
exit;
end;
end;
end;
end;
function GetLast(eStart: String; eSearchMain: Boolean): Integer;
var i: integer;
begin
eStart := LowerCase(Trim(eStart));
Result := -1;
if eSearchMain then begin
for i := 0 to frmMain.sciEditor.Lines.Count -1 do begin
if Pos(eStart, LowerCase(Trim(frmMain.sciEditor.Lines[i]))) = 1 then
Result := i;
end;
end
else begin
for i := 0 to frmMenuMaker.rtfEditor.Lines.Count -1 do begin
if Pos(eStart, LowerCase(Trim(frmMenuMaker.rtfEditor.Lines[i]))) = 1 then
Result := i;
end;
end;
end;
function AddIfDoesntExist(eInclude: String): Boolean;
var i: integer;
eLine: String;
begin
Result := True;
eInclude := RemoveSpaces(LowerCase(eInclude));
for i := 0 to frmMain.sciEditor.Lines.Count -1 do begin
eLine := LowerCase(RemoveSpaces(frmMain.sciEditor.Lines[i]));
eLine := StringReplace(eLine, '<', '', [rfReplaceAll]);
eLine := StringReplace(eLine, '>', '', [rfReplaceAll]);
eLine := StringReplace(eLine, '"', '', [rfReplaceAll]);
if eLine = '#include' + eInclude then begin
Result := False;
exit;
end;
end;
i := GetLast('#include', True);
if i = -1 then
i := 0;
frmMain.sciEditor.Lines.Insert(i, '#include <' + eInclude + '>');
end;
end.

View File

@ -1,656 +0,0 @@
unit UnitFunc;
interface
uses SysUtils, Classes, IniFiles, Graphics, ScintillaLanguageManager,
Windows, Messages, SciLexerMod, tlhelp32, Controls, Forms, SciDocuments;
procedure Delay(eTime: Integer);
function CountChars(eIn: String; eChar: Char): Integer;
function Between(eText, eFirst, eSecond: String): String;
procedure SendOpen(eFile: String);
procedure Load;
procedure Save;
procedure Apply;
function GetConsoleOutput(const Command: String): Boolean;
procedure KillIt(dwProcID: DWORD);
function GetProcID(sProcName: String): Integer;
procedure DoCompile;
function ShowSaveDialog(Caption, SaveCaption, CloseCaption: String): Boolean;
procedure AppendFileExt;
function RemoveSpaces(eInput: String): String;
var eErrorLine: Integer;
eHints, eWarnings, eErrors: Integer;
implementation
uses UnitfrmMain, UnitfrmOptions, UnitfrmAbout,
UnitfrmDebug, UnitfrmSaveDialog;
procedure Delay(eTime: Integer);
var i: integer;
begin
for i := 1 to eTime do begin
Sleep(1);
Application.ProcessMessages;
end;
end;
function CountChars(eIn: String; eChar: Char): Integer;
var i: integer;
begin
Result := 0;
if Length(eIn) <> 0 then begin
for i := 1 to Length(eIn) do begin
if eIn[i] = eChar then
Inc(Result, 1);
end;
end;
end;
function Between(eText, eFirst, eSecond: String): String;
var eTemp: String;
begin
if (Pos(eFirst, eText) = 0) or (Pos(eSecond, eText) = 0) then
Result := ''
else begin
eTemp := eText;
Delete(eTemp, 1, Pos(eFirst, eText) + Length(eFirst) - 1);
Delete(eTemp, Pos(eSecond, eTemp), Length(eTemp));
Result := eTemp;
end;
end;
procedure SendOpen(eFile: String);
var HTargetWnd: HWND;
ACopyDataStruct: TCopyDataStruct;
begin
with ACopyDataStruct do
begin
dwData := 0;
cbData := Length(eFile) + 1;
lpData := PChar(eFile);
end;
HTargetWnd := FindWindow('TfrmMain', 'AMXX-Edit v2');
if HTargetWnd <> 0 then
SendMessage(HTargetWnd, WM_COPYDATA, 0, LongInt(@ACopyDataStruct));
end;
procedure Load;
var eFile: TIniFile;
begin
if not FileExists(ExtractFilePath(ParamStr(0)) + 'Config.ini') then
exit;
eFile := TIniFile.Create(ExtractFilePath(ParamStr(0)) + 'Config.ini');
with frmSettings do begin
{ Editor }
cboFoldingStyle.ItemIndex := eFile.ReadInteger('Editor', 'FoldingStyle', 0);
chkAutoComplete.Checked := eFile.ReadBool('Editor', 'Auto-Complete', True);
chkHints.Checked := eFile.ReadBool('Editor', 'Hints', True);
chkHighlighting.Checked := eFile.ReadBool('Editor', 'Highlighting', True);
chkAutoIndent.Checked := eFile.ReadBool('Editor', 'AutoIndent', True);
chkBrackets.Checked := eFile.ReadBool('Editor', 'HighlightBrackets', True);
{ Directories }
txtAMXXPath.Text := eFile.ReadString('Directories', 'AMXX', '');
txtHalfLife.Text := eFile.ReadString('Directories', 'Half-Life', '');
txtSave.Text := eFile.ReadString('Directories', 'SaveTarget', '');
{ Colors }
cboComments.Selected := eFile.ReadInteger('Colors', 'Comments', clGreen);
cboDirectives.Selected := eFile.ReadInteger('Colors', 'Directives', clTeal);
cboOperators.Selected := eFile.ReadInteger('Colors', 'Operators', clNavy);
cboStrings.Selected := eFile.ReadInteger('Colors', 'Strings', clBlue);
cboKeywords.Selected := eFile.ReadInteger('Colors', 'Keywords', clRed);
cboActiveLine.Selected := eFile.ReadInteger('Colors', 'ActiveLine', $00FFE6E6);
{ FTP }
txtHost.Text := eFile.ReadString('FTP', 'Host', '');
txtPort.Text := IntToStr(eFile.ReadInteger('FTP', 'Port', 21));
txtUser.Text := eFile.ReadString('FTP', 'Username', '');
txtPassword.Text := eFile.ReadString('FTP', 'Password', '');
txtStandardDir.Text := eFile.ReadString('FTP', 'DefaultDir', '\');
{ View }
cboCodeExplorer.ItemIndex := eFile.ReadInteger('View', 'ShowCodeExplorer', 0);
chkStatusbar.Checked := eFile.ReadBool('View', 'Statusbar', True);
{ Char completer }
frmSettings.chkAutoCloseBrackets.Checked := eFile.ReadBool('CharCompleter', 'AutoCloseBrackets', False);
frmSettings.chkAutoCloseQuotes.Checked := eFile.ReadBool('CharCompleter', 'AutoCloseQuotes', False);
{ Compiler Output }
if eFile.ReadBool('View', 'CompileOutputInWindow', True) then
frmSettings.optWindow.Checked := True
else
frmSettings.optList.Checked := True;
{ Misc }
chkReload.Checked := eFile.ReadBool('Misc', 'AutoReload', True);
chkAutoAddPlugins.Checked := eFile.ReadBool('Misc', 'AutoAdd', True);
end;
eFile.Free;
end;
procedure Save;
var eFile: TIniFile;
begin
eFile := TIniFile.Create(ExtractFilePath(ParamStr(0)) + 'Config.ini');
with frmSettings do begin
{ Editor }
eFile.WriteInteger('Editor', 'FoldingStyle', cboFoldingStyle.ItemIndex);
eFile.WriteBool('Editor', 'Auto-Complete', chkAutoComplete.Checked);
eFile.WriteBool('Editor', 'Hints', chkHints.Checked);
eFile.WriteBool('Editor', 'Highlighting', chkHighlighting.Checked);
eFile.WriteBool('Editor', 'AutoIndent', chkAutoIndent.Checked);
eFile.WriteBool('Editor', 'HighlightBrackets', chkBrackets.Checked);
{ Directories }
eFile.WriteString('Directories', 'AMXX', txtAMXXPath.Text);
eFile.WriteString('Directories', 'Half-Life', txtHalfLife.Text);
eFile.WriteString('Directories', 'SaveTarget', txtSave.Text);
{ Colors }
eFile.WriteInteger('Colors', 'Comments', cboComments.Selected);
eFile.WriteInteger('Colors', 'Directives', cboDirectives.Selected);
eFile.WriteInteger('Colors', 'Operators', cboOperators.Selected);
eFile.WriteInteger('Colors', 'Strings', cboStrings.Selected);
eFile.WriteInteger('Colors', 'Keywords', cboKeywords.Selected);
eFile.WriteInteger('Colors', 'ActiveLine', cboActiveLine.Selected);
{ FTP }
eFile.WriteString('FTP', 'Host', txtHost.Text);
eFile.WriteString('FTP', 'Port', txtPort.Text);
eFile.WriteString('FTP', 'Username', txtUser.Text);
eFile.WriteString('FTP', 'Password', txtPassword.Text);
eFile.WriteString('FTP', 'DefaultDir', txtStandardDir.Text);
{ View }
eFile.WriteInteger('View', 'ShowCodeExplorer', cboCodeExplorer.ItemIndex);
eFile.WriteBool('View', 'Statusbar', chkStatusbar.Checked);
{ Char completer }
eFile.WriteBool('CharCompleter', 'AutoCloseBrackets', frmSettings.chkAutoCloseBrackets.Checked);
eFile.WriteBool('CharCompleter', 'AutoCloseQuotes', frmSettings.chkAutoCloseQuotes.Checked);
{ Compiler Output }
eFile.WriteBool('View', 'CompileOutputInWindow', frmSettings.optWindow.Checked);
{ Misc }
eFile.WriteBool('Misc', 'AutoReload', chkReload.Checked);
eFile.WriteBool('Misc', 'AutoAdd', chkAutoAddPlugins.Checked);
end;
eFile.Free;
end;
procedure Apply;
function PathComplete(eInput: String): String;
var eBackup: String;
begin
if Trim(eInput) = '' then
exit;
eBackup := eInput;
while Length(eInput) > 1 do
Delete(eInput, 1, 1);
if eInput <> '\' then
Result := eBackup + '\'
else
Result := eBackup;
end;
begin
with frmMain do begin
{ Folding }
case frmSettings.cboFoldingStyle.ItemIndex of
0: sciEditor.FoldMarkerType := sciMarkArrows;
1: sciEditor.FoldMarkerType := sciMarkBox;
2: sciEditor.FoldMarkerType := sciMarkCircle;
3: sciEditor.FoldMarkerType := sciMarkPlusMinus;
end;
if frmSettings.cboFoldingStyle.ItemIndex = 4 then
sciEditor.Folding := sciEditor.Folding - [foldFold]
else
sciEditor.Folding := sciEditor.Folding + [foldFold];
{ Auto Complete }
sacComplete.Disabled := not frmSettings.chkAutoComplete.Checked;
{ Hints }
cltEditor.Disabled := not frmSettings.chkHints.Checked;
{ Colors }
with sciEditor.LanguageManager.LanguageList.Find('SMALL').Styles do begin
TSciStyle(Items[0]).ForeColor := frmSettings.cboComments.Selected;
TSciStyle(Items[1]).ForeColor := frmSettings.cboDirectives.Selected;
TSciStyle(Items[2]).ForeColor := frmSettings.cboOperators.Selected;
TSciStyle(Items[3]).ForeColor := frmSettings.cboStrings.Selected;
TSciStyle(Items[4]).ForeColor := frmSettings.cboKeywords.Selected;
TSciStyle(Items[5]).ForeColor := frmSettings.cboComments.Selected;
TSciStyle(Items[6]).ForeColor := TSciStyle(Items[2]).ForeColor;
TSciStyle(Items[7]).ForeColor := frmSettings.cboComments.Selected;
TSciStyle(Items[8]).ForeColor := frmSettings.cboComments.Selected;
end;
frmMain.sciEditor.Caret.LineBackColor := frmSettings.cboActiveLine.Selected;
if frmSettings.chkHighlighting.Checked then
frmMain.sciEditor.LanguageManager.SelectedLanguage := 'SMALL'
else
frmMain.sciEditor.LanguageManager.SelectedLanguage := 'null';
{ Check directories }
frmSettings.txtAMXXPath.Text := PathComplete(frmSettings.txtAMXXPath.Text);
frmSettings.txtSave.Text := PathComplete(frmSettings.txtSave.Text);
{ View }
case frmSettings.cboCodeExplorer.ItemIndex of
0: begin
frmMain.splFunctions.Visible := True;
frmMain.pnlFunctions.Visible := True;
frmMain.pnlFunctions.Width := 150;
frmMain.pnlSpacerLeft.Cursor := crDefault;
end;
1: begin
frmMain.splFunctions.Visible := False;
frmMain.pnlFunctions.Visible := True;
frmMain.pnlFunctions.Width := 5;
frmMain.pnlSpacerLeft.Cursor := crHSplit;
end;
2: begin
frmMain.pnlFunctions.Visible := False;
frmMain.splFunctions.Visible := False;
frmMain.pnlSpacerLeft.Cursor := crDefault;
end;
end;
frmMain.sbInfo.Visible := frmSettings.chkStatusbar.Checked;
frmMain.sciEditor.BraceHilite := frmSettings.chkBrackets.Checked;
{ Char completer }
frmMain.sciEditor.AutoCloseBraces := frmSettings.chkAutoCloseBrackets.Checked;
frmMain.sciEditor.AutoCloseQuotes := frmSettings.chkAutoCloseQuotes.Checked;
end;
end;
procedure DoAdd(eStream: TMemoryStream);
var eStr: TStringList;
i: integer;
eErrLine: Integer;
eType, eBackup, eTemp: String;
begin
eStr := TStringList.Create;
eStr.LoadFromStream(eStream);
eHints := 0;
eWarnings := 0;
eErrors := 0;
eType := '';
eErrorLine := -1;
for i := 2 to eStr.Count -1 do begin
try
if eStr[i] <> '' then begin
if (Pos(': fatal error', eStr[i]) <> 0) or (Pos(': error', eStr[i]) <> 0) or (Pos(': warning', eStr[i]) <> 0) or (Pos(': hint', eStr[i]) <> 0) then begin
eBackup := eStr[i];
if (Pos(': fatal error', eStr[i]) <> 0) or (Pos(': error', eStr[i]) <> 0) then begin
Inc(eErrors, 1);
eType := 'Error';
end
else if Pos(': warning', eStr[i]) <> 0 then begin
Inc(eWarnings, 1);
eType := 'Warning';
end
else if Pos(': hint', eStr[i]) <> 0 then begin
Inc(eHints, 1);
eType := 'Hint';
end;
eErrLine := -1;
while (Pos('(', eStr[i]) <> 1) and (Length(eStr[i]) > 0) do
eStr[i] := Copy(eStr[i], 2, Length(eStr[i]));
try
eTemp := Copy(eStr[i], 2, Pos(')', eStr[i]) -2);
if Pos(#32, eTemp) <> 0 then
eTemp := Copy(eTemp, 1, Pos(#32, eTemp) -1);
eErrLine := StrToInt(eTemp);
if (eErrorLine = -1) and (eType = 'Error') then
eErrorLine := eErrLine;
except
if (eErrorLine = -1) and (eType = 'Error') then
eErrorLine := frmMain.sciEditor.Lines.Count -1;
end;
eStr[i] := Copy(eStr[i], 3, Length(eStr[i]));
while (Pos(':', eStr[i]) > 3) and (Length(eStr[i]) > 0) do
eStr[i] := Copy(eStr[i], 2, Length(eStr[i]));
eStr[i] := Copy(eStr[i], 4, Length(eStr[i]));
eStr[i] := Copy(eStr[i], Pos(':', eStr[i]) +2, Length(eStr[i]));
if Pos(': fatal error', eBackup) <> 0 then
eStr[i] := 'Fatal error: ' + eStr[i]
else if eStr[i] = '' then
eStr[i] := eBackup
else
eStr[i] := eType + ': ' + eStr[i] + ' on line ' + IntToStr(eErrLine);
if frmSettings.optWindow.Checked then begin
frmDebug.lblErrors.Caption := ' Errors: ' + IntToStr(eErrors);
frmDebug.lblWarnings.Caption := ' Warnings: ' + IntToStr(eWarnings);
frmDebug.lblHints.Caption := ' Hints: ' + IntToStr(eHints);
end;
end
else if (eStr[i] = 'Done.') or (Pos(' Error', eStr[i]) <> 0) or (Pos(' Warning', eStr[i]) <> 0) or (Pos(' Hint', eStr[i]) <> 0) then begin
if frmSettings.optWindow.Checked then begin
if eErrors <> 0 then
frmDebug.lblStatus.Caption := ' Done. There are errors.'
else if eWarnings <> 0 then
frmDebug.lblStatus.Caption := ' Done. There are warnings.'
else if eHints <> 0 then
frmDebug.lblStatus.Caption := ' Done. There are hints.'
else
frmDebug.lblStatus.Caption := ' Done.';
frmDebug.lblStatus.Font.Style := [fsBold];
end
else begin
if eErrors <> 0 then
frmMain.lvDebug.Items.Add.Caption := 'Done. There are errors.'
else if eWarnings <> 0 then
frmMain.lvDebug.Items.Add.Caption := 'Done. There are warnings.'
else if eHints <> 0 then
frmMain.lvDebug.Items.Add.Caption := 'Done. There are hints.'
else
frmMain.lvDebug.Items.Add.Caption := 'Done.';
if eErrorLine <> -1 then
frmMain.ShowErrorLine;
eStr.Free;
exit;
end;
end;
if frmSettings.optWindow.Checked then begin
frmDebug.lstOutput.Items.Add(eStr[i]);
frmDebug.lstOutput.ItemIndex := frmDebug.lstOutput.Items.Count -1;
frmDebug.Repaint;
end
else begin
frmMain.lvDebug.Items.Add.Caption := eStr[i];
frmMain.lvDebug.ItemIndex := frmDebug.lstOutput.Items.Count -1;
frmMain.Repaint;
end;
end;
except
// nothing
end;
end;
eStr.Free;
end;
function GetConsoleOutput(const Command: String): Boolean;
var
StartupInfo: TStartupInfo;
ProcessInfo: TProcessInformation;
SecurityAttr: TSecurityAttributes;
PipeOutputRead: THandle;
PipeOutputWrite: THandle;
PipeErrorsRead: THandle;
PipeErrorsWrite: THandle;
Succeed: Boolean;
Buffer: array [0..255] of Char;
NumberOfBytesRead: DWORD;
Stream: TMemoryStream;
begin
frmDebug.Compiling := True;
FillChar(ProcessInfo, SizeOf(TProcessInformation), 0);
FillChar(SecurityAttr, SizeOf(TSecurityAttributes), 0);
SecurityAttr.nLength := SizeOf(SecurityAttr);
SecurityAttr.bInheritHandle := True;
SecurityAttr.lpSecurityDescriptor := nil;
CreatePipe(PipeOutputRead, PipeOutputWrite, @SecurityAttr, 0);
CreatePipe(PipeErrorsRead, PipeErrorsWrite, @SecurityAttr, 0);
FillChar(StartupInfo, SizeOf(TStartupInfo), 0);
StartupInfo.cb:=SizeOf(StartupInfo);
StartupInfo.hStdInput := 0;
StartupInfo.hStdOutput := PipeOutputWrite;
StartupInfo.hStdError := PipeErrorsWrite;
StartupInfo.wShowWindow := SW_HIDE;
StartupInfo.dwFlags := STARTF_USESHOWWINDOW or STARTF_USESTDHANDLES;
if CreateProcess(nil, PChar(command), nil, nil, true,
CREATE_DEFAULT_ERROR_MODE or CREATE_NEW_CONSOLE or NORMAL_PRIORITY_CLASS, nil, nil,
StartupInfo, ProcessInfo) then begin
Result := True;
CloseHandle(PipeOutputWrite);
CloseHandle(PipeErrorsWrite);
Stream := TMemoryStream.Create;
try
while True do begin
Succeed := ReadFile(PipeOutputRead, Buffer, 255, NumberOfBytesRead, nil);
if not Succeed then Break;
Stream.Write(Buffer, NumberOfBytesRead);
end;
Stream.Position := 0;
DoAdd(Stream);
finally
Stream.Free;
end;
CloseHandle(PipeOutputRead);
try
while True do
begin
Succeed := ReadFile(PipeErrorsRead, Buffer, 255, NumberOfBytesRead, nil);
if not Succeed then Break;
end;
finally
end;
CloseHandle(PipeErrorsRead);
WaitForSingleObject(ProcessInfo.hProcess, INFINITE);
CloseHandle(ProcessInfo.hProcess);
end
else
begin
Result := False;
CloseHandle(PipeOutputRead);
CloseHandle(PipeOutputWrite);
CloseHandle(PipeErrorsRead);
CloseHandle(PipeErrorsWrite);
end;
frmDebug.Compiling := False;
end;
procedure KillIt(dwProcID: DWORD);
var
hProcess : Cardinal;
begin
hProcess := OpenProcess(SYNCHRONIZE or PROCESS_TERMINATE, False, dwProcID);
TerminateProcess(hProcess, 0);
end;
function GetProcID(sProcName: String): Integer;
var
hProcSnap: THandle;
pe32: TProcessEntry32;
begin
result := -1;
hProcSnap := CreateToolHelp32SnapShot(TH32CS_SNAPPROCESS, 0);
if hProcSnap = INVALID_HANDLE_VALUE then exit;
pe32.dwSize := SizeOf(ProcessEntry32);
if Process32First(hProcSnap, pe32) = true then
while Process32Next(hProcSnap, pe32) = true do
begin
if pos(sProcName, pe32.szExeFile) <> 0 then
result := pe32.th32ProcessID;
end;
end;
procedure DoCompile;
var eStr: TStringList;
i: integer;
eFound: Boolean;
begin
if (FileExists(frmSettings.txtAMXXPath.Text + 'scripting\amxxsc.exe')) and (FileExists(frmSettings.txtAMXXPath.Text + 'configs\plugins.ini')) then begin
if frmMain.dtcEditor.ActiveDocument.IsUntitled then begin
if DirectoryExists(frmSettings.txtSave.Text) then
frmMain.sdSave.InitialDir := frmSettings.txtSave.Text;
if frmMain.sdSave.Execute then begin
try
AppendFileExt;
frmMain.dtcEditor.ActiveDocument.Modified := False;
frmMain.dtcEditor.ActiveDocument.FileName := frmMain.sdSave.FileName;
frmMain.sciEditor.SaveToFile(frmMain.dtcEditor.ActiveDocument.FileName);
except
// :F
end;
end
else
exit;
end
else
frmMain.acSave.Execute;
Screen.Cursor := crHourGlass;
if frmSettings.chkAutoAddPlugins.Checked then begin
eStr := TStringList.Create;
eStr.LoadFromFile(frmSettings.txtAMXXPath.Text + 'configs\plugins.ini');
eFound := False;
for i := 0 to eStr.Count -1 do begin
if Pos(ChangeFileExt(ExtractFileName(frmMain.dtcEditor.ActiveDocument.FileName), '.amxx'), TrimLeft(eStr[i])) = 1 then
eFound := True;
end;
if not eFound then begin
eStr.Add(ChangeFileExt(ExtractFileName(frmMain.dtcEditor.ActiveDocument.FileName), '.amxx'));
eStr.SaveToFile(frmSettings.txtAMXXPath.Text + 'configs\plugins.ini');
end;
eStr.Free;
end;
try
frmMain.atbToolBar.RecreateControls;
except
// :F
end;
if frmSettings.optWindow.Checked then begin
frmDebug.lblFile.Caption := ' File: ' + ExtractFileName(frmMain.dtcEditor.ActiveDocument.FileName);
frmDebug.lblStatus.Font.Style := [];
frmDebug.lblStatus.Caption := ' Status: Compiling...';
frmDebug.lblHints.Caption := ' Hints: 0';
frmDebug.lblWarnings.Caption := ' Warnings: 0';
frmDebug.lblErrors.Caption := ' Errors: 0';
frmDebug.lstOutput.Items.Text := 'Compiler Output:';
frmDebug.Show;
frmDebug.Repaint;
end
else begin
frmMain.lvDebug.Clear;
frmMain.lvDebug.Items.Add.Caption := 'Compiling ' + ExtractFileName(frmMain.dtcEditor.ActiveDocument.FileName) + '...';
frmMain.lvDebug.Visible := True;
frmMain.Repaint;
end;
GetConsoleOutput(frmSettings.txtAMXXPath.Text + 'scripting\amxxsc.exe ' +
'"' + frmMain.dtcEditor.ActiveDocument.FileName + '" ' +
'"-o' + frmSettings.txtAMXXPath.Text + 'plugins\' + ChangeFileExt(ExtractFileName(frmMain.dtcEditor.ActiveDocument.FileName), '.amxx') + '"');
Screen.Cursor := crDefault;
end
else
MessageBox(frmMain.Handle, 'Couldn''t find amxxsc.exe or plugins.ini. Check your settings and try again.', 'Error', MB_ICONERROR);
end;
function ShowSaveDialog(Caption, SaveCaption, CloseCaption: String): Boolean;
function TabByName(eName: String): TSciDoc;
var i: integer;
begin
Result := nil;
for i := 0 to frmMain.dtcEditor.Count -1 do begin
if frmMain.dtcEditor.Tabs[i] = eName then
Result := frmMain.dtcEditor.Document[i];
end;
end;
var i: integer;
eStr: TStringList;
begin
eStr := TStringList.Create;
frmSaveDialog.Caption := Caption;
frmSaveDialog.SaveCaption := SaveCaption;
frmSaveDialog.CloseCaption := CloseCaption;
frmSaveDialog.cmdSave.Caption := CloseCaption;
frmSaveDialog.lstFiles.Clear;
for i := 0 to frmMain.dtcEditor.Tabs.Count -1 do begin
if (frmMain.dtcEditor.Document[i].Modified) then
frmSaveDialog.lstFiles.Items.Add(frmMain.dtcEditor.Tabs[i])
else if (frmMain.dtcEditor.Document[i].IsUntitled) then
frmSaveDialog.lstFiles.Items.Add(frmMain.dtcEditor.Tabs[i]);
end;
if (frmMain.dtcEditor.Tabs.Count = 1) and (frmMain.sciEditor.Lines.Text = '') then
frmSaveDialog.lstFiles.Clear;
if frmSaveDialog.lstFiles.Items.Count = 0 then begin
Result := True;
if frmSettings.chkReload.Checked then begin
for i := 0 to frmMain.dtcEditor.Tabs.Count -1 do begin
if not frmMain.dtcEditor.Document[i].IsUntitled then
eStr.Add(frmMain.dtcEditor.Document[i].FileName);
end;
eStr.SaveToFile(ExtractFilePath(ParamStr(0)) + 'Files.ini');
end;
eStr.Free;
exit;
end;
for i := 0 to frmSaveDialog.lstFiles.Items.Count -1 do begin
if Pos('&', frmSaveDialog.lstFiles.Items[i]) = 1 then
frmSaveDialog.lstFiles.Items[i] := Copy(frmSaveDialog.lstFiles.Items[i], 2, Length(frmSaveDialog.lstFiles.Items[i]));
end;
if frmSaveDialog.ShowModal = mrOk then begin
for i := 0 to frmSaveDialog.lstFiles.Items.Count -1 do begin
if frmSaveDialog.lstFiles.Checked[i] then begin
if (TabByName(frmSaveDialog.lstFiles.Items[i]).IsUntitled) then begin
frmMain.sdSave.Title := Format('Save %s (Tab %s)', [TabByName(frmSaveDialog.lstFiles.Items[i]).FileName, IntToStr(TabByName(frmSaveDialog.lstFiles.Items[i]).Index +1)]);
if frmMain.sdSave.Execute then begin
AppendFileExt;
frmMain.dtcEditor.Activate(TabByName(frmSaveDialog.lstFiles.Items[i]).Index);
frmMain.sciEditor.SaveToFile(frmMain.sdSave.FileName);
frmMain.dtcEditor.ActiveDocument.FileName := frmMain.sdSave.FileName;
frmMain.SetSaved;
frmMain.sbInfo.Panels[1].Text := '';
end
else begin
frmMain.sdSave.Title := 'Save...';
eStr.Free;
Result := False;
exit;
end;
frmMain.sdSave.Title := 'Save...';
end
else begin
frmMain.dtcEditor.Activate(TabByName(frmSaveDialog.lstFiles.Items[i]).Index);
frmMain.sciEditor.SaveToFile(TabByName(frmSaveDialog.lstFiles.Items[i]).FileName);
frmMain.dtcEditor.ActiveDocument.Modified := False;
frmMain.SetSaved;
frmMain.sbInfo.Panels[1].Text := '';
end;
end;
end;
for i := 0 to frmMain.dtcEditor.Tabs.Count -1 do begin
if (not frmMain.dtcEditor.Document[i].IsUntitled) and (not frmMain.dtcEditor.Document[i].Modified) then
eStr.Add(frmMain.dtcEditor.Document[i].FileName);
end;
if frmSettings.chkReload.Checked then
eStr.SaveToFile(ExtractFilePath(ParamStr(0)) + 'Files.ini');
Result := True;
end
else
Result := False;
eStr.Free;
end;
procedure AppendFileExt;
var eExt: String;
begin
eExt := LowerCase(ExtractFileExt(frmMain.sdSave.FileName));
if (frmMain.sdSave.FilterIndex = 1) and (eExt <> '.sma') then
frmMain.sdSave.FileName := frmMain.sdSave.FileName + '.sma'
else if (frmMain.sdSave.FilterIndex = 2) and (eExt <> '.inc') then
frmMain.sdSave.FileName := frmMain.sdSave.FileName + '.inc';
end;
function RemoveSpaces(eInput: String): String;
begin
eInput := StringReplace(eInput, ' ', '', [rfReplaceAll]);
eInput := StringReplace(eInput, ' ', '', [rfReplaceAll]);
Result := eInput;
end;
end.

View File

@ -1,24 +0,0 @@
unit UnitHowToMakePlayerMenu;
interface
uses
SysUtils, Windows, Messages, Classes, Graphics, Controls,
StdCtrls, ExtCtrls, Forms, CorelButton;
type
TfrmHowToMakePlayerMenu = class(TForm)
lblHowTo: TLabel;
txtTutorial: TMemo;
cmdOK: TCorelButton;
cmdExample: TCorelButton;
end;
var
frmHowToMakePlayerMenu: TfrmHowToMakePlayerMenu;
implementation
{$R *.DFM}
end.

View File

@ -1,60 +0,0 @@
unit UnitReadThread;
interface
uses
Classes, SysUtils, Graphics;
type
TReadThread = class(TThread)
public
ReadTCP: Boolean;
protected
Read: String;
procedure Execute; override;
procedure AddRead;
end;
implementation
uses UnitfrmSockets;
{ TReadThread }
procedure TReadThread.AddRead;
begin
frmSocketTerminal.OnRead(Read);
end;
procedure TReadThread.Execute;
begin
if ReadTCP then begin
frmSocketTerminal.IdTCPClient.ReadTimeout := 50;
repeat
try
Read := frmSocketTerminal.IdTCPClient.ReadLn;
Synchronize(AddRead);
except
// nothing
end;
until (Terminated) or (not frmSocketTerminal.IdTCPClient.Connected);
end
else begin
frmSocketTerminal.IdUDPClient.ReceiveTimeout := 50;
repeat
try
Read := frmSocketTerminal.IdUDPClient.ReceiveString;
if Read <> '' then
Synchronize(AddRead);
except
// nothing
end;
until (Terminated) or (not frmSocketTerminal.IdUDPClient.Active);
end;
Free;
Read := 'fu@u';
Synchronize(AddRead);
end;
end.

View File

@ -1,205 +0,0 @@
unit UnitTextAnalyze; // Unit for analyzing code for code explorer, auto
// complete and call tips
interface
uses SysUtils, Classes, ComCtrls, Windows, Forms, Messages, ScintillaLanguageManager;
procedure UpdateList(Code: String);
procedure AddAutoComplete(eAdd: String; AddCallTip: Boolean);
var eExpand1, eExpand2, eExpand3, eExpand4, eExpand5: Boolean;
implementation
uses UnitfrmMain, UnitFunc;
procedure UpdateList(Code: String);
var i, k: integer;
eStr, eStr2: TStringList;
eEndVariables: Boolean;
eParent1, eParent2, eParent3, eParent4, eParent5: TTreeNode;
eBracketsOpen, eStartLine: Integer;
eTemp: String;
begin
eStr := TStringList.Create;
eStr2 := TStringList.Create;
eStr.Text := Code;
frmMain.sacComplete.AStrings.Text := frmMain.StdAutoComplete;
frmMain.cltEditor.ApiStrings.Text := frmMain.StdCallTips;
frmMain.trvFunctions.Items.BeginUpdate;
for i := 0 to 4 do
frmMain.trvFunctions.Items[i].DeleteChildren;
for i := eStr.Count -1 downto 0 do begin
eStr[i] := TrimLeft(eStr[i]);
if (Pos('//', eStr[i]) > 0) then
eStr[i] := Copy(eStr[i], 1, Pos('//', eStr[i]) -2);
if (Pos('/*', eStr[i]) > 0) then
eStr[i] := Copy(eStr[i], 1, Pos('/*', eStr[i]) -2);
if (Pos('*', eStr[i]) = 1) then
eStr.Delete(i);
if (Pos('*/', eStr[i]) > 0) then
eStr[i] := Copy(eStr[i], 1, Pos('*/', eStr[i]) -2);
end;
eEndVariables := False;
eBracketsOpen := -1;
eStartLine := -1;
eParent1 := frmMain.trvFunctions.Items[3];
eParent2 := frmMain.trvFunctions.Items[1];
eParent3 := frmMain.trvFunctions.Items[4];
eParent4 := frmMain.trvFunctions.Items[0];
eParent5 := frmMain.trvFunctions.Items[2];
for i := 0 to eStr.Count -1 do begin
// Included:
if Pos('#include', LowerCase(eStr[i])) = 1 then begin
if (ExtractFileExt(Between(eStr[i], '<', '>')) = '') and (ExtractFileExt(Between(eStr[i], '"', '"')) = '') then begin
if Pos('<', eStr[i]) > 0 then
frmMain.trvFunctions.Items.AddChild(eParent1, Between(eStr[i], '<', '>') + '.inc')
else
frmMain.trvFunctions.Items.AddChild(eParent1, Between(eStr[i], '"', '"') + '.inc');
end
else begin
if Pos('<', eStr[i]) > 0 then
frmMain.trvFunctions.Items.AddChild(eParent1, Between(eStr[i], '<', '>'))
else
frmMain.trvFunctions.Items.AddChild(eParent1, Between(eStr[i], '"', '"'));
end;
end;
// Defined
if Pos('#define', LowerCase(eStr[i])) = 1 then begin
eStr[i] := Copy(eStr[i], 8, Length(eStr[i]));
if Pos(#32, eStr[i]) <> 0 then begin
frmMain.trvFunctions.Items.AddChild(eParent2, Copy(TrimLeft(eStr[i]), 1, Pos(#32, TrimLeft(eStr[i])) -1));
AddAutoComplete(Copy(TrimLeft(eStr[i]), 1, Pos(#32, TrimLeft(eStr[i])) -1), False);
end
else begin
frmMain.trvFunctions.Items.AddChild(eParent2, TrimLeft(eStr[i]));
AddAutoComplete(TrimLeft(eStr[i]), False);
end;
end;
// Variables and constants
if not eEndVariables then begin
if Pos('new', LowerCase(eStr[i])) = 1 then begin
if Pos(',', eStr[i]) > 0 then begin
eStr2.Text := StringReplace(Trim(Copy(eStr[i], 4, Length(eStr[i]))), ',', #13, [rfReplaceAll]);
for k := 0 to eStr2.Count -1 do begin
if Pos('=', eStr[i]) = 0 then
frmMain.trvFunctions.Items.AddChild(eParent3, Trim(eStr2[k]))
else
frmMain.trvFunctions.Items.AddChild(eParent4, Trim(eStr2[k]));
AddAutoComplete(Trim(eStr2[k]), False);
end;
end
else if Pos('{', Trim(eStr[i])) = Length(Trim(eStr[i])) then begin
if Pos('=', eStr[i]) = 0 then
frmMain.trvFunctions.Items.AddChild(eParent3, TrimLeft(Copy(eStr[i], 4, Length(eStr[i]))) + ' Array }')
else
frmMain.trvFunctions.Items.AddChild(eParent4, TrimLeft(Copy(eStr[i], 4, Length(eStr[i]))) + ' Array }');
AddAutoComplete(Trim(Copy(eStr[i], 1, Pos('{', eStr[i]) -1)), False);
end
else begin
if Pos('=', eStr[i]) = 0 then
frmMain.trvFunctions.Items.AddChild(eParent3, TrimLeft(Copy(eStr[i], 4, Length(eStr[i]))))
else
frmMain.trvFunctions.Items.AddChild(eParent4, TrimLeft(Copy(eStr[i], 4, Length(eStr[i]))));
AddAutoComplete(TrimLeft(Copy(eStr[i], 4, Length(eStr[i]))), False);
end;
end;
end;
// Functions
if (Pos('forward', LowerCase(eStr[i])) = 1) or (Pos('public', LowerCase(eStr[i])) = 1) or (Pos('native', LowerCase(eStr[i])) = 1) or (Pos('stock', LowerCase(eStr[i])) = 1) then begin
eBracketsOpen := 0;
eEndVariables := True;
if ((Pos('{', eStr[i]) = 0)) or (Pos('{', eStr[i]) <> 0) and (Pos('}', eStr[i]) <> 0) then begin
eTemp := Copy(eStr[i], 1, Pos(#32, eStr[i]));
frmMain.FunctionType.Add(eTemp);
frmMain.trvFunctions.Items.AddChild(eParent5, Copy(eStr[i], Pos(#32, eStr[i]) +1, Length(eStr[i])));
AddAutoComplete(Copy(eStr[i], Pos(#32, eStr[i]) +1, Length(eStr[i])), True);
end;
end;
if Pos('{', eStr[i]) <> 0 then begin
if eStartLine = -1 then
eStartLine := i;
Inc(eBracketsOpen, 1);
end;
if Pos('}', eStr[i]) <> 0 then begin
Inc(eBracketsOpen, -1);
if (eBracketsOpen = 0) then begin
eStr[eStartLine] := StringReplace(eStr[eStartLine], '{', '', [rfReplaceAll]);
eStr[eStartLine] := TrimRight(eStr[eStartLine]);
if (Pos(#32, eStr[eStartLine]) <> 0) and (Pos(#32, eStr[eStartLine]) < Pos('(', eStr[eStartLine])) then
eTemp := Copy(eStr[eStartLine], 1, Pos(#32, eStr[eStartLine]))
else
eTemp := '';
frmMain.FunctionType.Add(eTemp);
frmMain.trvFunctions.Items.AddChild(eParent5, Copy(eStr[eStartLine], Pos(#32, eStr[eStartLine]) +1, Length(eStr[eStartLine])));
AddAutoComplete(Copy(eStr[eStartLine], Pos(#32, eStr[eStartLine]) +1, Length(eStr[eStartLine])), True);
eStartLine := -1;
eBracketsOpen := -2;
end;
end;
end;
for i := frmMain.trvFunctions.Items.Count -1 downto 0 do begin
if Assigned(frmMain.trvFunctions.Items[i].Parent) then begin
frmMain.trvFunctions.Items[i].ImageIndex := 20;
frmMain.trvFunctions.Items[i].SelectedIndex := 20;
end
else begin
frmMain.trvFunctions.Items[i].ImageIndex := 18;
frmMain.trvFunctions.Items[i].SelectedIndex := 18;
end;
if frmMain.trvFunctions.Items[i].Text = '' then // Remove empty items
frmMain.trvFunctions.Items.Delete(frmMain.trvFunctions.Items[i]);
end;
eStr.Free;
eStr2.Free;
frmMain.trvFunctions.Items.AlphaSort(True);
frmMain.trvFunctions.FullExpand;
if not eExpand1 then
eParent1.Collapse(False);
if not eExpand2 then
eParent2.Collapse(False);
if not eExpand3 then
eParent3.Collapse(False);
if not eExpand4 then
eParent4.Collapse(False);
if not eExpand5 then
eParent5.Collapse(False);
frmMain.trvFunctions.Perform(WM_VSCROLL, SB_TOP, 0);
frmMain.trvFunctions.Items.EndUpdate;
Application.ProcessMessages;
end;
procedure AddAutoComplete(eAdd: String; AddCallTip: Boolean);
function AlreadyAdded: Boolean;
var i: integer;
eTemp: String;
begin
Result := False;
eTemp := Trim(eAdd);
for i := 0 to frmMain.sacComplete.AStrings.Count -1 do begin
if Trim(frmMain.sacComplete.AStrings[i]) = eAdd then
Result := True;
if Trim(frmMain.sacComplete.AStrings[i] + '()') = eAdd then
Result := True;
end;
end;
begin
if not AlreadyAdded then begin
if Pos('(', eAdd) <> 0 then
frmMain.sacComplete.AStrings.Add(Copy(eAdd, 1, Pos('(', eAdd) -1))
else
frmMain.sacComplete.AStrings.Add(eAdd);
if AddCallTip then
frmMain.cltEditor.ApiStrings.Add(eAdd);
end;
end;
end.

Binary file not shown.

View File

@ -1,32 +0,0 @@
unit UnitfrmAbout;
interface
uses
SysUtils, Windows, Messages, Classes, Graphics, Controls,
StdCtrls, ExtCtrls, Forms, ShellAPI, TFlatSpeedButtonUnit;
type
TfrmAbout = class(TForm)
pnlInfo: TPanel;
imgAMXX: TImage;
lblCopyright: TLabel;
lblComments: TLabel;
lblCoder: TLabel;
FlatSpeedButton1: TFlatSpeedButton;
procedure imgAMXXClick(Sender: TObject);
end;
var
frmAbout: TfrmAbout;
implementation
{$R *.DFM}
procedure TfrmAbout.imgAMXXClick(Sender: TObject);
begin
ShellExecute(Handle, 'open', 'http://www.amxmodx.org/', nil, nil, SW_SHOW);
end;
end.

Binary file not shown.

View File

@ -1,91 +0,0 @@
unit UnitfrmDebug;
interface
uses
SysUtils, Windows, Messages, Classes, Graphics, Controls,
StdCtrls, ExtCtrls, Forms;
type
TfrmDebug = class(TForm)
cmdMore: TButton;
pnlCompile: TPanel;
lblFile: TStaticText;
lblStatus: TStaticText;
lblHints: TStaticText;
lblWarnings: TStaticText;
lblErrors: TStaticText;
cmdCancelOkay: TButton;
bvlDelimeter: TBevel;
lstOutput: TListBox;
procedure cmdMoreClick(Sender: TObject);
procedure cmdCancelOkayClick(Sender: TObject);
procedure lstOutputDblClick(Sender: TObject);
private
FCompiling: Boolean;
procedure SetCompiling(const Value: Boolean);
public
property Compiling: Boolean read FCompiling write SetCompiling;
end;
var
frmDebug: TfrmDebug;
const DEFAULT_HEIGHT = 165;
MAX_HEIGHT = 277;
implementation
uses UnitfrmMain, UnitFunc, UnitfrmOptions;
{$R *.DFM}
procedure TfrmDebug.cmdMoreClick(Sender: TObject);
begin
if Height = DEFAULT_HEIGHT then begin
Height := MAX_HEIGHT;
cmdMore.Caption := '<< Compiler Output';
end
else begin
Height := DEFAULT_HEIGHT;
cmdMore.Caption := 'Compiler Output >>';
end;
end;
procedure TfrmDebug.SetCompiling(const Value: Boolean);
begin
FCompiling := Value;
if Value then
cmdCancelOkay.Caption := 'Cancel'
else
cmdCancelOkay.Caption := 'Close';
end;
procedure TfrmDebug.cmdCancelOkayClick(Sender: TObject);
var i: integer;
begin
if Compiling then begin
i := GetProcId('amxxsc.exe');
if i <> -1 then
KillIt(i);
Compiling := False;
end
else begin
Hide;
frmMain.Show;
end;
end;
procedure TfrmDebug.lstOutputDblClick(Sender: TObject);
begin
if lstOutput.ItemIndex <> -1 then begin
if Pos('Warning', lstOutput.Items[lstOutput.ItemIndex]) = 1 then
MessageBox(Handle, PChar(lstOutput.Items[lstOutput.ItemIndex]), 'Warning', MB_ICONWARNING)
else if Pos('Error', lstOutput.Items[lstOutput.ItemIndex]) = 1 then
MessageBox(Handle, PChar(lstOutput.Items[lstOutput.ItemIndex]), 'Error', MB_ICONERROR)
else
MessageBox(Handle, PChar(lstOutput.Items[lstOutput.ItemIndex]), 'Information', MB_ICONINFORMATION)
end;
end;
end.

View File

@ -1,99 +0,0 @@
object ExceptionDialog: TExceptionDialog
Left = 363
Top = 284
ActiveControl = OkBtn
AutoScroll = False
BorderIcons = [biSystemMenu]
Caption = 'Exception-Handler ONLY FOR DESIGN'
ClientHeight = 255
ClientWidth = 432
Color = clBtnFace
Constraints.MinWidth = 200
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
KeyPreview = True
OldCreateOrder = False
Position = poScreenCenter
ShowHint = True
OnCreate = FormCreate
OnDestroy = FormDestroy
OnKeyDown = FormKeyDown
OnPaint = FormPaint
OnResize = FormResize
OnShow = FormShow
DesignSize = (
432
255)
PixelsPerInch = 96
TextHeight = 13
object Bevel1: TBevel
Left = 3
Top = 91
Width = 428
Height = 9
Anchors = [akLeft, akTop, akRight]
Shape = bsTopLine
end
object OkBtn: TButton
Left = 352
Top = 4
Width = 75
Height = 25
Anchors = [akTop, akRight]
Caption = '&OK'
Default = True
ModalResult = 1
TabOrder = 1
end
object DetailsMemo: TMemo
Left = 4
Top = 101
Width = 424
Height = 150
Anchors = [akLeft, akTop, akRight, akBottom]
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Courier New'
Font.Style = []
ParentColor = True
ParentFont = False
ReadOnly = True
ScrollBars = ssBoth
TabOrder = 3
WantReturns = False
WordWrap = False
end
object DetailsBtn: TButton
Left = 352
Top = 60
Width = 75
Height = 25
Hint = 'Show or hide additional information|'
Anchors = [akTop, akRight]
Caption = '&Details'
Enabled = False
TabOrder = 2
OnClick = DetailsBtnClick
end
object TextLabel: TMemo
Left = 56
Top = 8
Width = 281
Height = 75
Hint = 'Use Ctrl+C to copy the report to the clipboard'
Anchors = [akLeft, akTop, akRight]
BorderStyle = bsNone
Ctl3D = True
Lines.Strings = (
'TextLabel')
ParentColor = True
ParentCtl3D = False
ReadOnly = True
TabOrder = 0
WantReturns = False
end
end

View File

@ -1,742 +0,0 @@
{**************************************************************************************************}
{ }
{ Project JEDI Code Library (JCL) }
{ }
{ The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); }
{ you may not use this file except in compliance with the License. You may obtain a copy of the }
{ License at http://www.mozilla.org/MPL/ }
{ }
{ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF }
{ ANY KIND, either express or implied. See the License for the specific language governing rights }
{ and limitations under the License. }
{ }
{ The Original Code is ExceptDlg.pas. }
{ }
{ The Initial Developer of the Original Code is documented in the accompanying }
{ help file JCL.chm. Portions created by these individuals are Copyright (C) of these individuals. }
{ }
{**************************************************************************************************}
{ }
{ Sample Application exception dialog replacement }
{ }
{ Last modified: April 1, 2003 }
{ }
{**************************************************************************************************}
unit UnitfrmExceptionHandler;
{$I jcl.inc}
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls, JclDebug;
const
UM_CREATEDETAILS = WM_USER + $100;
ReportToLogEnabled = $00000001; // TExceptionDialog.Tag property
DisableTextScrollbar = $00000002; // TExceptionDialog.Tag property
type
TSimpleExceptionLog = class (TObject)
private
FLogFileHandle: THandle;
FLogFileName: string;
FLogWasEmpty: Boolean;
function GetLogOpen: Boolean;
protected
function CreateDefaultFileName: string;
public
constructor Create(const ALogFileName: string = '');
destructor Destroy; override;
procedure CloseLog;
procedure OpenLog;
procedure Write(const Text: string; Indent: Integer = 0); overload;
procedure Write(Strings: TStrings; Indent: Integer = 0); overload;
procedure WriteStamp(SeparatorLen: Integer = 0);
property LogFileName: string read FLogFileName;
property LogOpen: Boolean read GetLogOpen;
end;
TExcDialogSystemInfo = (siStackList, siOsInfo, siModuleList, siActiveControls);
TExcDialogSystemInfos = set of TExcDialogSystemInfo;
TExceptionDialog = class(TForm)
OkBtn: TButton;
DetailsMemo: TMemo;
DetailsBtn: TButton;
Bevel1: TBevel;
TextLabel: TMemo;
procedure FormPaint(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure DetailsBtnClick(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure FormDestroy(Sender: TObject);
procedure FormResize(Sender: TObject);
private
FDetailsVisible: Boolean;
FIsMainThead: Boolean;
FLastActiveControl: TWinControl;
FNonDetailsHeight: Integer;
FFullHeight: Integer;
FSimpleLog: TSimpleExceptionLog;
procedure CreateDetails;
function GetReportAsText: string;
procedure ReportToLog;
procedure SetDetailsVisible(const Value: Boolean);
procedure UMCreateDetails(var Message: TMessage); message UM_CREATEDETAILS;
protected
procedure AfterCreateDetails; dynamic;
procedure BeforeCreateDetails; dynamic;
procedure CreateDetailInfo; dynamic;
procedure CreateReport(const SystemInfo: TExcDialogSystemInfos);
function ReportMaxColumns: Integer; virtual;
function ReportNewBlockDelimiterChar: Char; virtual;
procedure NextDetailBlock;
procedure UpdateTextLabelScrollbars;
public
procedure CopyReportToClipboard;
class procedure ExceptionHandler(Sender: TObject; E: Exception);
class procedure ExceptionThreadHandler(Thread: TJclDebugThread);
class procedure ShowException(E: Exception; Thread: TJclDebugThread);
property DetailsVisible: Boolean read FDetailsVisible write SetDetailsVisible;
property ReportAsText: string read GetReportAsText;
property SimpleLog: TSimpleExceptionLog read FSimpleLog;
end;
TExceptionDialogClass = class of TExceptionDialog;
var
ExceptionDialogClass: TExceptionDialogClass = TExceptionDialog;
implementation
{$R *.DFM}
uses
ClipBrd, Math,
JclBase, JclFileUtils, JclHookExcept, JclPeImage, JclStrings, JclSysInfo, JclSysUtils;
resourcestring
RsAppError = '%s - application error';
RsExceptionClass = 'Exception class: %s';
RsExceptionAddr = 'Exception address: %p';
RsStackList = 'Stack list, generated %s';
RsModulesList = 'List of loaded modules:';
RsOSVersion = 'System : %s %s, Version: %d.%d, Build: %x, "%s"';
RsProcessor = 'Processor: %s, %s, %d MHz %s%s';
RsScreenRes = 'Display : %dx%d pixels, %d bpp';
RsActiveControl = 'Active Controls hierarchy:';
RsThread = 'Thread: %s';
RsMissingVersionInfo = '(no version info)';
var
ExceptionDialog: TExceptionDialog;
//==================================================================================================
// Helper routines
//==================================================================================================
function GetBPP: Integer;
var
DC: HDC;
begin
DC := GetDC(0);
Result := GetDeviceCaps(DC, BITSPIXEL) * GetDeviceCaps(DC, PLANES);
ReleaseDC(0, DC);
end;
//--------------------------------------------------------------------------------------------------
function SortModulesListByAddressCompare(List: TStringList; Index1, Index2: Integer): Integer;
begin
Result := Integer(List.Objects[Index1]) - Integer(List.Objects[Index2]);
end;
//==================================================================================================
// TApplication.HandleException method code hooking for exceptions from DLLs
//==================================================================================================
// We need to catch the last line of TApplication.HandleException method:
// [...]
// end else
// SysUtils.ShowException(ExceptObject, ExceptAddr);
// end;
procedure HookShowException(ExceptObject: TObject; ExceptAddr: Pointer);
begin
if JclValidateModuleAddress(ExceptAddr) and (ExceptObject.InstanceSize >= Exception.InstanceSize) then
TExceptionDialog.ExceptionHandler(nil, Exception(ExceptObject))
else
SysUtils.ShowException(ExceptObject, ExceptAddr);
end;
//--------------------------------------------------------------------------------------------------
function HookTApplicationHandleException: Boolean;
const
CallOffset = $86;
CallOffsetDebug = $94;
type
PCALLInstruction = ^TCALLInstruction;
TCALLInstruction = packed record
Call: Byte;
Address: Integer;
end;
var
TApplicationHandleExceptionAddr, SysUtilsShowExceptionAddr: Pointer;
CALLInstruction: TCALLInstruction;
CallAddress: Pointer;
NW: DWORD;
function CheckAddressForOffset(Offset: Cardinal): Boolean;
begin
try
CallAddress := Pointer(Cardinal(TApplicationHandleExceptionAddr) + Offset);
CALLInstruction.Call := $E8;
Result := PCALLInstruction(CallAddress)^.Call = CALLInstruction.Call;
if Result then
begin
if IsCompiledWithPackages then
Result := PeMapImgResolvePackageThunk(Pointer(Integer(CallAddress) + Integer(PCALLInstruction(CallAddress)^.Address) + SizeOf(CALLInstruction))) = SysUtilsShowExceptionAddr
else
Result := PCALLInstruction(CallAddress)^.Address = Integer(SysUtilsShowExceptionAddr) - Integer(CallAddress) - SizeOf(CALLInstruction);
end;
except
Result := False;
end;
end;
begin
TApplicationHandleExceptionAddr := PeMapImgResolvePackageThunk(@TApplication.HandleException);
SysUtilsShowExceptionAddr := PeMapImgResolvePackageThunk(@SysUtils.ShowException);
Result := CheckAddressForOffset(CallOffset) or CheckAddressForOffset(CallOffsetDebug);
if Result then
begin
CALLInstruction.Address := Integer(@HookShowException) - Integer(CallAddress) - SizeOf(CALLInstruction);
Result := WriteProcessMemory(GetCurrentProcess, CallAddress, @CALLInstruction, SizeOf(CALLInstruction), NW);
if Result then
FlushInstructionCache(GetCurrentProcess, CallAddress, SizeOf(CALLInstruction));
end;
end;
//==================================================================================================
// TSimpleExceptionLog
//==================================================================================================
procedure TSimpleExceptionLog.CloseLog;
begin
if LogOpen then
begin
CloseHandle(FLogFileHandle);
FLogFileHandle := INVALID_HANDLE_VALUE;
FLogWasEmpty := False;
end;
end;
//--------------------------------------------------------------------------------------------------
constructor TSimpleExceptionLog.Create(const ALogFileName: string);
begin
if ALogFileName = '' then
FLogFileName := CreateDefaultFileName
else
FLogFileName := ALogFileName;
FLogFileHandle := INVALID_HANDLE_VALUE;
end;
//--------------------------------------------------------------------------------------------------
function TSimpleExceptionLog.CreateDefaultFileName: string;
begin
Result := PathExtractFileDirFixed(ParamStr(0)) + PathExtractFileNameNoExt(ParamStr(0)) + '_Err.log';
end;
//--------------------------------------------------------------------------------------------------
destructor TSimpleExceptionLog.Destroy;
begin
CloseLog;
inherited;
end;
//--------------------------------------------------------------------------------------------------
function TSimpleExceptionLog.GetLogOpen: Boolean;
begin
Result := FLogFileHandle <> INVALID_HANDLE_VALUE;
end;
//--------------------------------------------------------------------------------------------------
procedure TSimpleExceptionLog.OpenLog;
begin
if not LogOpen then
begin
FLogFileHandle := CreateFile(PChar(FLogFileName), GENERIC_WRITE, FILE_SHARE_READ, nil,
OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
if LogOpen then
FLogWasEmpty := SetFilePointer(FLogFileHandle, 0, nil, FILE_END) = 0;
end
else
FLogWasEmpty := False;
end;
//--------------------------------------------------------------------------------------------------
procedure TSimpleExceptionLog.Write(const Text: string; Indent: Integer);
var
S: string;
SL: TStringList;
I: Integer;
begin
if LogOpen then
begin
SL := TStringList.Create;
try
SL.Text := Text;
for I := 0 to SL.Count - 1 do
begin
S := StringOfChar(' ', Indent) + StrEnsureSuffix(AnsiCrLf, TrimRight(SL[I]));
FileWrite(Integer(FLogFileHandle), Pointer(S)^, Length(S));
end;
finally
SL.Free;
end;
end;
end;
//--------------------------------------------------------------------------------------------------
procedure TSimpleExceptionLog.Write(Strings: TStrings; Indent: Integer);
var
I: Integer;
begin
for I := 0 to Strings.Count - 1 do
Write(Strings[I], Indent);
end;
//--------------------------------------------------------------------------------------------------
procedure TSimpleExceptionLog.WriteStamp(SeparatorLen: Integer);
begin
if SeparatorLen = 0 then
SeparatorLen := 100;
SeparatorLen := Max(SeparatorLen, 20);
OpenLog;
if not FLogWasEmpty then
Write(AnsiCrLf);
Write(StrRepeat('=', SeparatorLen));
Write(Format('= %-*s =', [SeparatorLen - 4, DateTimeToStr(Now)]));
Write(StrRepeat('=', SeparatorLen));
end;
//==================================================================================================
// Exception dialog
//==================================================================================================
var
ExceptionShowing: Boolean;
{ TExceptionDialog }
procedure TExceptionDialog.AfterCreateDetails;
begin
end;
//--------------------------------------------------------------------------------------------------
procedure TExceptionDialog.BeforeCreateDetails;
begin
end;
//--------------------------------------------------------------------------------------------------
procedure TExceptionDialog.CopyReportToClipboard;
begin
ClipBoard.AsText := ReportAsText;
end;
//--------------------------------------------------------------------------------------------------
procedure TExceptionDialog.CreateDetailInfo;
begin
CreateReport([siStackList, siOsInfo, siModuleList, siActiveControls]);
end;
//--------------------------------------------------------------------------------------------------
procedure TExceptionDialog.CreateDetails;
begin
Screen.Cursor := crHourGlass;
DetailsMemo.Lines.BeginUpdate;
try
CreateDetailInfo;
ReportToLog;
DetailsMemo.SelStart := 0;
SendMessage(DetailsMemo.Handle, EM_SCROLLCARET, 0, 0);
AfterCreateDetails;
finally
DetailsMemo.Lines.EndUpdate;
OkBtn.Enabled := True;
DetailsBtn.Enabled := True;
OkBtn.SetFocus;
Screen.Cursor := crDefault;
end;
end;
//--------------------------------------------------------------------------------------------------
procedure TExceptionDialog.CreateReport(const SystemInfo: TExcDialogSystemInfos);
const
MMXText: array[Boolean] of PChar = ('', 'MMX');
FDIVText: array[Boolean] of PChar = (' [FDIV Bug]', '');
var
SL: TStringList;
I: Integer;
ModuleName: TFileName;
CpuInfo: TCpuInfo;
C: TWinControl;
NtHeaders: PImageNtHeaders;
ModuleBase: Cardinal;
ImageBaseStr: string;
StackList: TJclStackInfoList;
begin
SL := TStringList.Create;
try
// Stack list
if siStackList in SystemInfo then
begin
StackList := JclLastExceptStackList;
if Assigned(StackList) then
begin
DetailsMemo.Lines.Add(Format(RsStackList, [DateTimeToStr(StackList.TimeStamp)]));
StackList.AddToStrings(DetailsMemo.Lines, False, True, True);
NextDetailBlock;
end;
end;
// System and OS information
if siOsInfo in SystemInfo then
begin
DetailsMemo.Lines.Add(Format(RsOSVersion, [GetWindowsVersionString, NtProductTypeString,
Win32MajorVersion, Win32MinorVersion, Win32BuildNumber, Win32CSDVersion]));
GetCpuInfo(CpuInfo);
with CpuInfo do
DetailsMemo.Lines.Add(Format(RsProcessor, [Manufacturer, CpuName,
RoundFrequency(FrequencyInfo.NormFreq),
MMXText[MMX], FDIVText[IsFDIVOK]]));
DetailsMemo.Lines.Add(Format(RsScreenRes, [Screen.Width, Screen.Height, GetBPP]));
NextDetailBlock;
end;
// Modules list
if (siModuleList in SystemInfo) and LoadedModulesList(SL, GetCurrentProcessId) then
begin
DetailsMemo.Lines.Add(RsModulesList);
SL.CustomSort(SortModulesListByAddressCompare);
for I := 0 to SL.Count - 1 do
begin
ModuleName := SL[I];
ModuleBase := Cardinal(SL.Objects[I]);
DetailsMemo.Lines.Add(Format('[%.8x] %s', [ModuleBase, ModuleName]));
NtHeaders := PeMapImgNtHeaders(Pointer(ModuleBase));
if (NtHeaders <> nil) and (NtHeaders^.OptionalHeader.ImageBase <> ModuleBase) then
ImageBaseStr := Format('<%.8x> ', [NtHeaders^.OptionalHeader.ImageBase])
else
ImageBaseStr := StrRepeat(' ', 11);
if VersionResourceAvailable(ModuleName) then
with TJclFileVersionInfo.Create(ModuleName) do
try
DetailsMemo.Lines.Add(ImageBaseStr + BinFileVersion + ' - ' + FileVersion);
if FileDescription <> '' then
DetailsMemo.Lines.Add(StrRepeat(' ', 11) + FileDescription);
finally
Free;
end
else
DetailsMemo.Lines.Add(ImageBaseStr + RsMissingVersionInfo);
end;
NextDetailBlock;
end;
// Active controls
if (siActiveControls in SystemInfo) and (FLastActiveControl <> nil) then
begin
DetailsMemo.Lines.Add(RsActiveControl);
C := FLastActiveControl;
while C <> nil do
begin
DetailsMemo.Lines.Add(Format('%s "%s"', [C.ClassName, C.Name]));
C := C.Parent;
end;
NextDetailBlock;
end;
finally
SL.Free;
end;
end;
//--------------------------------------------------------------------------------------------------
procedure TExceptionDialog.DetailsBtnClick(Sender: TObject);
begin
DetailsVisible := not DetailsVisible;
end;
//--------------------------------------------------------------------------------------------------
class procedure TExceptionDialog.ExceptionHandler(Sender: TObject; E: Exception);
begin
if ExceptionShowing then
Application.ShowException(E)
else
begin
ExceptionShowing := True;
try
ShowException(E, nil);
finally
ExceptionShowing := False;
end;
end;
end;
//--------------------------------------------------------------------------------------------------
class procedure TExceptionDialog.ExceptionThreadHandler(Thread: TJclDebugThread);
begin
if ExceptionShowing then
Application.ShowException(Thread.SyncException)
else
begin
ExceptionShowing := True;
try
ShowException(Thread.SyncException, Thread);
finally
ExceptionShowing := False;
end;
end;
end;
//--------------------------------------------------------------------------------------------------
procedure TExceptionDialog.FormCreate(Sender: TObject);
begin
FSimpleLog := TSimpleExceptionLog.Create;
FFullHeight := ClientHeight;
DetailsVisible := False;
Caption := Format(RsAppError, [Application.Title]);
end;
//--------------------------------------------------------------------------------------------------
procedure TExceptionDialog.FormDestroy(Sender: TObject);
begin
FreeAndNil(FSimpleLog);
end;
//--------------------------------------------------------------------------------------------------
procedure TExceptionDialog.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
if (Key = Ord('C')) and (ssCtrl in Shift) then
begin
CopyReportToClipboard;
MessageBeep(MB_OK);
end;
end;
//--------------------------------------------------------------------------------------------------
procedure TExceptionDialog.FormPaint(Sender: TObject);
begin
DrawIcon(Canvas.Handle, TextLabel.Left - GetSystemMetrics(SM_CXICON) - 15,
TextLabel.Top, LoadIcon(0, IDI_ERROR));
end;
//--------------------------------------------------------------------------------------------------
procedure TExceptionDialog.FormResize(Sender: TObject);
begin
UpdateTextLabelScrollbars;
end;
//--------------------------------------------------------------------------------------------------
procedure TExceptionDialog.FormShow(Sender: TObject);
begin
BeforeCreateDetails;
MessageBeep(MB_ICONERROR);
if FIsMainThead and (GetWindowThreadProcessId(Handle, nil) = MainThreadID) then
PostMessage(Handle, UM_CREATEDETAILS, 0, 0)
else
CreateDetails;
end;
//--------------------------------------------------------------------------------------------------
function TExceptionDialog.GetReportAsText: string;
begin
Result := StrEnsureSuffix(AnsiCrLf, TextLabel.Text) + AnsiCrLf + DetailsMemo.Text;
end;
//--------------------------------------------------------------------------------------------------
procedure TExceptionDialog.NextDetailBlock;
begin
DetailsMemo.Lines.Add(StrRepeat(ReportNewBlockDelimiterChar, ReportMaxColumns));
end;
//--------------------------------------------------------------------------------------------------
function TExceptionDialog.ReportMaxColumns: Integer;
begin
Result := 100;
end;
//--------------------------------------------------------------------------------------------------
function TExceptionDialog.ReportNewBlockDelimiterChar: Char;
begin
Result := '-';
end;
//--------------------------------------------------------------------------------------------------
procedure TExceptionDialog.ReportToLog;
begin
if Tag and ReportToLogEnabled <> 0 then
begin
FSimpleLog.WriteStamp(ReportMaxColumns);
try
FSimpleLog.Write(ReportAsText);
finally
FSimpleLog.CloseLog;
end;
end;
end;
//--------------------------------------------------------------------------------------------------
procedure TExceptionDialog.SetDetailsVisible(const Value: Boolean);
var
DetailsCaption: string;
begin
FDetailsVisible := Value;
DetailsCaption := Trim(StrRemoveChars(DetailsBtn.Caption, ['<', '>']));
if Value then
begin
Constraints.MinHeight := FNonDetailsHeight + 100;
Constraints.MaxHeight := Screen.Height;
DetailsCaption := '<< ' + DetailsCaption;
ClientHeight := FFullHeight;
DetailsMemo.Height := FFullHeight - DetailsMemo.Top - 3;
end
else
begin
FFullHeight := ClientHeight;
DetailsCaption := DetailsCaption + ' >>';
if FNonDetailsHeight = 0 then
begin
ClientHeight := Bevel1.Top;
FNonDetailsHeight := Height;
end
else
Height := FNonDetailsHeight;
Constraints.MinHeight := FNonDetailsHeight;
Constraints.MaxHeight := FNonDetailsHeight
end;
DetailsBtn.Caption := DetailsCaption;
DetailsMemo.Enabled := Value;
end;
//--------------------------------------------------------------------------------------------------
class procedure TExceptionDialog.ShowException(E: Exception; Thread: TJclDebugThread);
begin
if ExceptionDialog = nil then
ExceptionDialog := ExceptionDialogClass.Create(Application);
try
with ExceptionDialog do
begin
FIsMainThead := (GetCurrentThreadId = MainThreadID);
FLastActiveControl := Screen.ActiveControl;
TextLabel.Text := AdjustLineBreaks(StrEnsureSuffix('.', E.Message));
UpdateTextLabelScrollbars;
DetailsMemo.Lines.Add(Format(RsExceptionClass, [E.ClassName]));
if Thread = nil then
DetailsMemo.Lines.Add(Format(RsExceptionAddr, [ExceptAddr]))
else
DetailsMemo.Lines.Add(Format(RsThread, [Thread.ThreadInfo]));
NextDetailBlock;
ShowModal;
end;
finally
FreeAndNil(ExceptionDialog);
end;
end;
//--------------------------------------------------------------------------------------------------
procedure TExceptionDialog.UMCreateDetails(var Message: TMessage);
begin
Update;
CreateDetails;
end;
//--------------------------------------------------------------------------------------------------
procedure TExceptionDialog.UpdateTextLabelScrollbars;
begin
if Tag and DisableTextScrollbar = 0 then
begin
Canvas.Font := TextLabel.Font;
if TextLabel.Lines.Count * Canvas.TextHeight('Wg') > TextLabel.ClientHeight then
TextLabel.ScrollBars := ssVertical
else
TextLabel.ScrollBars := ssNone;
end;
end;
//==================================================================================================
// Exception handler initialization code
//==================================================================================================
procedure InitializeHandler;
begin
JclStackTrackingOptions := JclStackTrackingOptions + [stRawMode];
{$IFNDEF HOOK_DLL_EXCEPTIONS}
JclStackTrackingOptions := JclStackTrackingOptions + [stStaticModuleList];
{$ENDIF HOOK_DLL_EXCEPTIONS}
JclDebugThreadList.OnSyncException := TExceptionDialog.ExceptionThreadHandler;
JclStartExceptionTracking;
{$IFDEF HOOK_DLL_EXCEPTIONS}
if HookTApplicationHandleException then
JclTrackExceptionsFromLibraries;
{$ENDIF HOOK_DLL_EXCEPTIONS}
Application.OnException := TExceptionDialog.ExceptionHandler;
end;
//--------------------------------------------------------------------------------------------------
procedure UnInitializeHandler;
begin
Application.OnException := nil;
JclDebugThreadList.OnSyncException := nil;
JclUnhookExceptions;
JclStopExceptionTracking;
end;
//--------------------------------------------------------------------------------------------------
initialization
{$IFDEF EXCEPTION_DEBUG}
InitializeHandler;
{$ENDIF}
finalization
{$IFDEF EXCEPTION_DEBUG}
UnInitializeHandler;
{$ENDIF}
end.

Binary file not shown.

View File

@ -1,48 +0,0 @@
unit UnitfrmGoToLine;
interface
uses
SysUtils, Windows, Messages, Classes, Graphics, Controls,
StdCtrls, ExtCtrls, Forms, TFlatSpeedButtonUnit, TFlatEditUnit;
type
TfrmGoToLine = class(TForm)
lblInfo: TLabel;
txtLine: TFlatEdit;
cmdOK: TFlatSpeedButton;
cmdCancel: TFlatSpeedButton;
procedure cmdOKClick(Sender: TObject);
procedure txtLineKeyPress(Sender: TObject; var Key: Char);
end;
var
frmGoToLine: TfrmGoToLine;
implementation
uses UnitfrmMain;
{$R *.DFM}
procedure TfrmGoToLine.cmdOKClick(Sender: TObject);
begin
try
if (StrToInt(txtLine.Text) < 0) or (StrToInt(txtLine.Text) > frmMain.sciEditor.Lines.Count) then
raise Exception.Create('Invalid Line')
else
ModalResult := mrOK;
except
MessageBox(Handle, 'Invalid value. Check the entered line and press OK again.', 'Error', MB_ICONERROR);
end;
end;
procedure TfrmGoToLine.txtLineKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then begin
cmdOk.Click;
Key := #0;
end;
end;
end.

View File

@ -1,66 +0,0 @@
unit UnitfrmLoopGenerator;
interface
uses
SysUtils, Windows, Messages, Classes, Graphics, Controls,
StdCtrls, ExtCtrls, Forms, TFlatRadioButtonUnit, TFlatEditUnit,
TFlatButtonUnit;
type
TfrmLoopGenerator = class(TForm)
optWhile: TFlatRadioButton;
pnlWhileCondition: TPanel;
lblWhileCondition: TLabel;
txtWhileCondition: TFlatEdit;
optFor: TFlatRadioButton;
pnlForLoop: TPanel;
lblForVariable: TLabel;
txtVariable: TFlatEdit;
lblForCondition: TLabel;
txtForCondition: TFlatEdit;
Label1: TLabel;
txtForAction: TFlatEdit;
cmdGenerate: TFlatButton;
procedure txtVariableKeyPress(Sender: TObject; var Key: Char);
procedure txtWhileConditionKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure cmdGenerateClick(Sender: TObject);
end;
var
frmLoopGenerator: TfrmLoopGenerator;
implementation
{$R *.DFM}
procedure TfrmLoopGenerator.txtVariableKeyPress(Sender: TObject;
var Key: Char);
begin
if Key = #32 then
Key := #0;
end;
procedure TfrmLoopGenerator.txtWhileConditionKeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
if Key = 13 then
cmdGenerate.Click;
end;
procedure TfrmLoopGenerator.cmdGenerateClick(Sender: TObject);
begin
if (txtWhileCondition.Text = '') and (optWhile.Checked) then
MessageBox(Handle, 'You forgot to enter the while condition', 'Warning', MB_ICONWARNING)
else if (optFor.Checked) then begin
if (txtVariable.Text = '') or (txtForCondition.Text = '') or (txtForAction.Text = '') then
MessageBox(Handle, 'You must fill out each field to generate a FOR-loop.', 'Warning', MB_ICONWARNING)
else
ModalResult := mrOk;
end
else
ModalResult := mrOk;
end;
end.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -1,461 +0,0 @@
unit UnitfrmMenuMaker;
interface
uses
SysUtils, Windows, Messages, Classes, Graphics, Controls,
StdCtrls, ExtCtrls, Forms, TFlatMemoUnit, XPStyleActnCtrls, ActnList,
ActnMan, ToolWin, ActnCtrls, ComCtrls, CorelButton, ImgList,
TFlatEditUnit, TFlatCheckBoxUnit;
type
TfrmMenuMaker = class(TForm)
pnlButtons: TPanel;
cmdCancel: TCorelButton;
ilButtons: TImageList;
amButtons: TActionManager;
acPaste: TAction;
acCopy: TAction;
acCut: TAction;
acClear: TAction;
acMenu: TAction;
acGrey: TAction;
acRed: TAction;
acWhite: TAction;
acYellow: TAction;
cmdNext: TCorelButton;
nbkPages: TNotebook;
atbButtons: TActionToolBar;
rtfEditor: TRichEdit;
pnlSettings: TPanel;
chkRegisterMenuCommand: TFlatCheckBox;
chkAddComment: TFlatCheckBox;
txtKeys: TFlatEdit;
lblKeys: TLabel;
bvlSpace: TBevel;
lblSettings: TLabel;
lblName: TLabel;
txtMenuName: TFlatEdit;
txtTime: TFlatEdit;
chkUseTime: TFlatCheckBox;
chkAppendOnlyMenuText: TFlatCheckBox;
lblNote: TLabel;
lblSettingsPlayers: TLabel;
pnlSettingsPlayers: TPanel;
lblMenu: TLabel;
txtMenu: TFlatEdit;
lblHelp: TLabel;
chkAlive: TFlatCheckBox;
bvlSpace2: TBevel;
chkRegister: TFlatCheckBox;
chkComments: TFlatCheckBox;
chkImmunity: TFlatCheckBox;
procedure acCopyExecute(Sender: TObject);
procedure acCutExecute(Sender: TObject);
procedure acPasteExecute(Sender: TObject);
procedure acClearExecute(Sender: TObject);
procedure acYellowExecute(Sender: TObject);
procedure acWhiteExecute(Sender: TObject);
procedure acRedExecute(Sender: TObject);
procedure acGreyExecute(Sender: TObject);
procedure txtKeysChange(Sender: TObject);
procedure cmdCancelClick(Sender: TObject);
procedure cmdNextClick(Sender: TObject);
procedure rtfEditorKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure rtfEditorKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure rtfEditorMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure rtfEditorMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure chkUseTimeClick(Sender: TObject);
procedure txtMenuNameKeyPress(Sender: TObject; var Key: Char);
procedure chkAppendOnlyMenuTextClick(Sender: TObject);
procedure txtTimeChange(Sender: TObject);
procedure rtfEditorChange(Sender: TObject);
procedure acMenuExecute(Sender: TObject);
procedure lblHelpMouseEnter(Sender: TObject);
procedure lblHelpMouseLeave(Sender: TObject);
procedure lblHelpClick(Sender: TObject);
private
Editing: Boolean;
FDefaultMenu: Boolean;
procedure SetDefaultMenu(const Value: Boolean);
public
property DefaultMenu: Boolean read FDefaultMenu write SetDefaultMenu;
function GetColoredMenu: String;
procedure SetButton(Action: TAction);
procedure UpdateCurColor;
procedure Reset;
end;
var
frmMenuMaker: TfrmMenuMaker;
implementation
uses UnitAddMenu, UnitfrmSelectMenu, UnitfrmMain, UnitHowToMakePlayerMenu;
{$R *.DFM}
procedure TfrmMenuMaker.acCopyExecute(Sender: TObject);
begin
rtfEditor.CopyToClipboard;
end;
procedure TfrmMenuMaker.acCutExecute(Sender: TObject);
begin
rtfEditor.CutToClipboard;
end;
procedure TfrmMenuMaker.acPasteExecute(Sender: TObject);
begin
rtfEditor.PasteFromClipboard;
end;
procedure TfrmMenuMaker.acClearExecute(Sender: TObject);
begin
rtfEditor.Clear;
rtfEditor.SelAttributes.Color := clWhite;
UpdateCurColor;
end;
procedure TfrmMenuMaker.acYellowExecute(Sender: TObject);
begin
rtfEditor.SelAttributes.Color := clYellow;
SetButton(acYellow);
end;
procedure TfrmMenuMaker.acWhiteExecute(Sender: TObject);
begin
rtfEditor.SelAttributes.Color := clWhite;
SetButton(acWhite);
end;
procedure TfrmMenuMaker.acRedExecute(Sender: TObject);
begin
rtfEditor.SelAttributes.Color := clRed;
SetButton(acRed);
end;
procedure TfrmMenuMaker.acGreyExecute(Sender: TObject);
begin
rtfEditor.SelAttributes.Color := clGray;
SetButton(acGrey);
end;
procedure TfrmMenuMaker.SetButton(Action: TAction);
begin
if Action <> acYellow then
acYellow.Checked := False;
if Action <> acWhite then
acWhite.Checked := False;
if Action <> acRed then
acRed.Checked := False;
if Action <> acGrey then
acGrey.Checked := False;
Action.Checked := True;
end;
procedure TfrmMenuMaker.txtKeysChange(Sender: TObject);
begin
try
StrToInt(Trim((Sender As TFlatEdit).Text));
except
if Sender = txtKeys then begin
(Sender As TFlatEdit).Text := '1';
SysUtils.Beep;
end
else
(Sender As TFlatEdit).Text := '';
end;
end;
procedure TfrmMenuMaker.cmdCancelClick(Sender: TObject);
begin
if nbkPages.PageIndex = 0 then
ModalResult := mrCancel
else begin
nbkPages.PageIndex := 0;
if not DefaultMenu then begin
lblNote.Visible := True;
lblHelp.Visible := True;
end;
cmdCancel.Caption := 'Cancel';
cmdNext.Caption := '&Next >';
end;
end;
procedure TfrmMenuMaker.cmdNextClick(Sender: TObject);
function IsNumeric(eChar: Char): Boolean;
begin
Result := Pos(eChar, '0123456789') <> 0;
end;
var i: integer;
eColoredMenu: String;
begin
if Editing then begin
eColoredMenu := GetColoredMenu;
frmMain.sciEditor.Lines[frmSelectMenu.eLines[frmSelectMenu.GetItemIndex]] := StringReplace(frmMain.sciEditor.Lines[frmSelectMenu.eLines[frmSelectMenu.GetItemIndex]], '"' + frmSelectMenu.eMenuStr[frmSelectMenu.GetItemIndex] + '"', '"' + eColoredMenu + '"', []);
Editing := False;
ModalResult := mrOk;
end
else if nbkPages.PageIndex = 0 then begin // Editor
if DefaultMenu then begin
txtKeys.Text := '0';
for i := 0 to rtfEditor.Lines.Count -1 do begin
if Length(rtfEditor.Lines[i]) <> 0 then begin
if IsNumeric(rtfEditor.Lines[i][1]) then
txtKeys.Text := txtKeys.Text + rtfEditor.Lines[i][1];
end;
end;
if Length(txtKeys.Text) <> 1 then
txtKeys.Text := Copy(txtKeys.Text, 2, Length(txtKeys.Text));
nbkPages.PageIndex := 1;
end
else begin
if Pos('$players', LowerCase(rtfEditor.Lines.Text)) = 0 then begin
MessageBox(Handle, 'You forgot to set the players.', 'Warning', MB_ICONWARNING);
exit;
end;
if (Pos('$next', LowerCase(rtfEditor.Lines.Text)) = 0) and (Pos('$back', LowerCase(rtfEditor.Lines.Text)) = 0) then
MessageBox(Handle, 'You should set a "Next" and a "Back" key.', 'Warning', MB_ICONWARNING)
else if Pos('$next', LowerCase(rtfEditor.Lines.Text)) = 0 then
MessageBox(Handle, 'You should set a "Next"-key.', 'Warning', MB_ICONWARNING)
else if Pos('$exitorback', LowerCase(rtfEditor.Lines.Text)) = 0 then
MessageBox(Handle, 'You should set a "Back"-key.', 'Warning', MB_ICONWARNING);
nbkPages.PageIndex := 2;
end;
cmdCancel.Caption := '< &Back';
cmdNext.Caption := 'Finish';
end
else if nbkPages.PageIndex = 1 then begin // Default finish
if (txtMenuName.Text = '') and (not chkAppendOnlyMenuText.Checked) then
MessageBox(Handle, 'Invalid menu name.', 'Warning', MB_ICONWARNING)
else begin
Screen.Cursor := crHourGlass;
if AddMenu then
ModalResult := mrOk
else
MessageBox(Handle, 'Menu already exists. Please choose another name.', 'Warning', MB_ICONWARNING);
Screen.Cursor := crDefault;
end;
end
else begin // Player finish
if (txtMenu.Text = '') then
MessageBox(Handle, 'Invalid menu name.', 'Warning', MB_ICONWARNING)
else begin
if AddPlayerMenu then
ModalResult := mrOk;
Screen.Cursor := crDefault;
end;
end;
lblNote.Visible := False;
lblHelp.Visible := False;
end;
procedure TfrmMenuMaker.UpdateCurColor;
begin
case rtfEditor.SelAttributes.Color of
clYellow: SetButton(acYellow);
clWhite: SetButton(acWhite);
clRed: SetButton(acRed);
clGray: SetButton(acGrey);
end;
atbButtons.RecreateControls;
end;
procedure TfrmMenuMaker.rtfEditorKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
UpdateCurColor;
end;
procedure TfrmMenuMaker.rtfEditorKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
UpdateCurColor;
end;
procedure TfrmMenuMaker.rtfEditorMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
UpdateCurColor;
end;
procedure TfrmMenuMaker.rtfEditorMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
UpdateCurColor;
end;
procedure TfrmMenuMaker.chkUseTimeClick(Sender: TObject);
begin
txtTime.Enabled := chkUseTime.Checked;
if not chkUseTime.Checked then
txtTime.Text := '-1';
end;
procedure TfrmMenuMaker.txtMenuNameKeyPress(Sender: TObject;
var Key: Char);
begin
if Key = #32 then
Key := #0;
end;
procedure TfrmMenuMaker.chkAppendOnlyMenuTextClick(Sender: TObject);
begin
lblKeys.Enabled := not chkAppendOnlyMenuText.Checked;
txtKeys.Enabled := not chkAppendOnlyMenuText.Checked;
chkAddComment.Enabled := not chkAppendOnlyMenuText.Checked;
chkRegisterMenuCommand.Enabled := not chkAppendOnlyMenuText.Checked;
chkUseTime.Enabled := not chkAppendOnlyMenuText.Checked;
txtTime.Enabled := not chkAppendOnlyMenuText.Checked;
lblName.Enabled := not chkAppendOnlyMenuText.Checked;
txtMenuName.Enabled := not chkAppendOnlyMenuText.Checked;
end;
procedure TfrmMenuMaker.txtTimeChange(Sender: TObject);
begin
try
if StrToInt(txtTime.Text) < -1 then begin
txtTime.Text := '-1';
SysUtils.Beep;
end;
except
txtTime.Text := '1000';
SysUtils.Beep;
end;
end;
procedure TfrmMenuMaker.rtfEditorChange(Sender: TObject);
begin
cmdNext.Enabled := rtfEditor.Text <> '';
end;
procedure TfrmMenuMaker.SetDefaultMenu(const Value: Boolean);
begin
FDefaultMenu := Value;
lblNote.Visible := not Value;
lblHelp.Visible := not Value;
acMenu.Enabled := Value;
Editing := False;
if Value then
Caption := 'Menu Maker'
else
Caption := 'Player Menu Maker';
end;
procedure TfrmMenuMaker.acMenuExecute(Sender: TObject);
var eTemp: String;
begin
if frmSelectMenu.ShowModal = mrOk then begin
atbButtons.RecreateControls;
if frmSelectMenu.GetItemIndex = -1 then
frmSelectMenu.lstMenu.Selected[0] := True;
DefaultMenu := True;
Editing := True;
rtfEditor.Clear;
rtfEditor.SelAttributes.Color := clWhite;
eTemp := frmSelectMenu.eMenuStr[frmSelectMenu.GetItemIndex];
if eTemp <> '' then begin
while Length(eTemp) <> 0 do begin
if eTemp[1] = '\' then begin
if Length(eTemp) <> 1 then begin
case LowerCase(eTemp[2])[1] of
'w': rtfEditor.SelAttributes.Color := clWhite;
'r': rtfEditor.SelAttributes.Color := clRed;
'd': rtfEditor.SelAttributes.Color := clGray;
'y': rtfEditor.SelAttributes.Color := clYellow;
end;
end;
Delete(eTemp, 1, 2);
end
else if Copy(eTemp, 1, 2) = '^n' then begin
rtfEditor.SelText := #13#10;
Delete(eTemp, 1, 2);
end
else begin
rtfEditor.SelText := eTemp[1];
Delete(eTemp, 1, 1);
end;
end;
end;
cmdNext.Caption := 'Finish edit';
end
else
atbButtons.RecreateControls;
end;
function TfrmMenuMaker.GetColoredMenu: String;
var i: integer;
eCurColor: TColor;
begin
eCurColor := clWhite;
Result := '';
for i := 0 to Length(rtfEditor.Lines.Text) -1 do begin
rtfEditor.SelStart := i;
if rtfEditor.SelAttributes.Color <> eCurColor then begin
eCurColor := rtfEditor.SelAttributes.Color;
case eCurColor of
clWhite : Result := Result + '\w';
clYellow: Result := Result + '\y';
clRed : Result := Result + '\r';
clGray : Result := Result + '\d';
end;
end;
Result := Result + rtfEditor.Lines.Text[i+1];
end;
rtfEditor.SelStart := 0;
Result := StringReplace(Result, #13, '^n', [rfReplaceAll]);
Result := StringReplace(Result, #10, '', [rfReplaceAll]);
end;
procedure TfrmMenuMaker.Reset;
begin
rtfEditor.Clear;
rtfEditor.SelAttributes.Color := clWhite;
txtKeys.Text := '1';
txtMenu.Clear;
txtMenuName.Clear;
UpdateCurColor;
end;
procedure TfrmMenuMaker.lblHelpMouseEnter(Sender: TObject);
begin
lblHelp.Font.Color := clBlue;
lblHelp.Font.Style := [fsUnderline];
end;
procedure TfrmMenuMaker.lblHelpMouseLeave(Sender: TObject);
begin
lblHelp.Font.Color := clWindowText;
lblHelp.Font.Style := [];
end;
procedure TfrmMenuMaker.lblHelpClick(Sender: TObject);
procedure Append(eText: String);
begin
rtfEditor.SelText := eText + #13#10;
rtfEditor.SelStart := Length(rtfEditor.Lines.Text);
end;
begin
if frmHowToMakePlayerMenu.ShowModal = mrYes then begin
rtfEditor.Clear;
rtfEditor.SelAttributes.Color := clYellow;
Append('Kick player');
Append('');
rtfEditor.SelAttributes.Color := clWhite;
Append('$players(1,8,%n. %v)');
Append('$next(9,9. Next)');
Append('');
Append('$exitorback(0,0. Exit,0. Back)');
end;
end;
end.

Binary file not shown.

View File

@ -1,156 +0,0 @@
unit UnitfrmOptions;
interface
uses
SysUtils, Windows, Messages, Classes, Graphics, Controls,
StdCtrls, ExtCtrls, Forms, ComCtrls, TFlatEditUnit,
TFlatSpeedButtonUnit, TFlatCheckBoxUnit, TFlatComboBoxUnit, FileCtrl,
TFlatTabControlUnit, TFlatRadioButtonUnit, Dialogs;
type
TfrmSettings = class(TForm)
lblSettings: TLabel;
cmdClose: TFlatSpeedButton;
odHalfLife: TOpenDialog;
ftcPages: TFlatTabControl;
nbkPages: TNotebook;
pnlHighlighter: TPanel;
lblComments: TLabel;
lblDirectives: TLabel;
lblOperators: TLabel;
lblStrings: TLabel;
lblKeywords: TLabel;
lblActiveLine: TLabel;
cboComments: TColorBox;
cboDirectives: TColorBox;
cboOperators: TColorBox;
cboStrings: TColorBox;
cboKeywords: TColorBox;
cboActiveLine: TColorBox;
pnlGeneralSettings: TPanel;
lblAMXX: TLabel;
cmdBrowseAMXX: TFlatSpeedButton;
cmdBrowseHalfLife: TFlatSpeedButton;
lblHalfLife: TLabel;
cmdBrowseSave: TFlatSpeedButton;
lblSave: TLabel;
txtAMXXPath: TFlatEdit;
txtHalfLife: TFlatEdit;
txtSave: TFlatEdit;
pnlGeneral: TPanel;
lblFoldingStyle: TLabel;
chkAutoComplete: TFlatCheckBox;
chkHighlighting: TFlatCheckBox;
cboFoldingStyle: TFlatComboBox;
chkHints: TFlatCheckBox;
chkAutoIndent: TFlatCheckBox;
chkBrackets: TFlatCheckBox;
lblHighlighter: TLabel;
lblEditor: TLabel;
lblDirectories: TLabel;
lblCompilerSettings: TLabel;
lblFTP: TLabel;
lblMisc: TLabel;
lblView: TLabel;
pnlCharCompleter: TPanel;
chkAutoCloseBrackets: TFlatCheckBox;
chkAutoCloseQuotes: TFlatCheckBox;
pnlCompilerSettings: TPanel;
optWindow: TFlatRadioButton;
optList: TFlatRadioButton;
pnlFTP: TPanel;
lblHost: TLabel;
lblPort: TLabel;
lblUser: TLabel;
lblPassword: TLabel;
lblStandardDir: TLabel;
cmdCheckFTP: TFlatSpeedButton;
txtHost: TFlatEdit;
txtPort: TFlatEdit;
txtUser: TFlatEdit;
txtPassword: TFlatEdit;
txtStandardDir: TFlatEdit;
pnlMisc: TPanel;
chkReload: TFlatCheckBox;
chkAutoAddPlugins: TFlatCheckBox;
pnlView: TPanel;
lblCodeExplorer: TLabel;
cboCodeExplorer: TFlatComboBox;
chkStatusbar: TFlatCheckBox;
lblCharCompleter: TLabel;
procedure cmdBrowseAMXXClick(Sender: TObject);
procedure cmdBrowseHalfLifeClick(Sender: TObject);
procedure cmdBrowseSaveClick(Sender: TObject);
procedure chkAutoAddPluginsMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ftcPagesTabChanged(Sender: TObject);
procedure cmdCheckFTPClick(Sender: TObject);
end;
var
frmSettings: TfrmSettings;
implementation
uses UnitfrmMain;
{$R *.DFM}
procedure TfrmSettings.cmdBrowseAMXXClick(Sender: TObject);
var eDir: String;
begin
if SelectDirectory('Please select your AMXX directory:', 'C:', eDir) then
txtAMXXPath.Text := eDir;
end;
procedure TfrmSettings.cmdBrowseHalfLifeClick(Sender: TObject);
begin
if odHalfLife.Execute then
txtHalfLife.Text := odHalfLife.FileName;
end;
procedure TfrmSettings.cmdBrowseSaveClick(Sender: TObject);
var eDir: String;
begin
if SelectDirectory('Please select the directory where your files shall be saved:', 'C:', eDir) then
txtSave.Text := eDir;
end;
procedure TfrmSettings.chkAutoAddPluginsMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if (chkAutoAddPlugins.Checked) and (Button = mbLeft) then
MessageBox(Handle, 'Notice: This function works only with plugins which are saved in $AMXXDIR$\scripting.', 'Information', MB_ICONINFORMATION);
end;
procedure TfrmSettings.ftcPagesTabChanged(Sender: TObject);
begin
nbkPages.PageIndex := ftcPages.ActiveTab;
end;
procedure TfrmSettings.cmdCheckFTPClick(Sender: TObject);
begin
try
with frmMain.IdFTP do begin
Host := txtHost.Text;
Port := StrToInt(txtPort.Text);
Username := txtUser.Text;
Password := txtPassword.Text;
try
Connect;
ChangeDir(txtStandardDir.Text);
MessageBox(Handle, 'Test successfully done!', 'Information', MB_ICONINFORMATION)
except
on E: Exception do
MessageBox(Handle, PChar(E.Message), 'Error', MB_ICONWARNING);
end;
if Connected then
Disconnect;
end;
except
MessageBox(Handle, 'Invalid FTP port.', 'Warning', MB_ICONWARNING);
end;
end;
end.

Binary file not shown.

View File

@ -1,41 +0,0 @@
unit UnitfrmSaveDialog;
interface
uses
SysUtils, Windows, Messages, Classes, Graphics, Controls,
StdCtrls, ExtCtrls, Forms, CheckLst, TFlatSpeedButtonUnit;
type
TfrmSaveDialog = class(TForm)
lstFiles: TCheckListBox;
shpFiles: TShape;
cmdSave: TFlatSpeedButton;
cmdCancel: TFlatSpeedButton;
lblInfo: TLabel;
procedure lstFilesClickCheck(Sender: TObject);
public
SaveCaption: String;
CloseCaption: String;
end;
var
frmSaveDialog: TfrmSaveDialog;
implementation
{$R *.DFM}
procedure TfrmSaveDialog.lstFilesClickCheck(Sender: TObject);
var i: integer;
begin
for i := 0 to lstFiles.Items.Count -1 do begin
if lstFiles.Checked[i] then begin
cmdSave.Caption := SaveCaption;
exit;
end;
end;
cmdSave.Caption := CloseCaption;
end;
end.

Binary file not shown.

View File

@ -1,80 +0,0 @@
unit UnitfrmSelectMenu;
interface
uses
SysUtils, Windows, Messages, Classes, Graphics, Controls,
StdCtrls, ExtCtrls, Forms, CorelButton, TFlatListBoxUnit;
type
TfrmSelectMenu = class(TForm)
cmdOK: TCorelButton;
cmdCancel: TCorelButton;
lblSelect: TLabel;
lstMenu: TFlatListBox;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormShow(Sender: TObject);
public
eMenuStr: TStringList;
eLines: array of Integer;
function GetItemIndex: Integer;
end;
var
frmSelectMenu: TfrmSelectMenu;
implementation
uses UnitfrmMenuMaker, UnitfrmMain, UnitAddMenu, UnitFunc, UnitTextAnalyze;
{$R *.DFM}
procedure TfrmSelectMenu.FormCreate(Sender: TObject);
begin
eMenuStr := TStringList.Create;
end;
procedure TfrmSelectMenu.FormDestroy(Sender: TObject);
begin
eMenuStr.Free;
end;
procedure TfrmSelectMenu.FormShow(Sender: TObject);
var i: integer;
eTemp: String;
begin
eMenuStr.Clear;
lstMenu.Items.Clear;
SetLength(eLines, 0);
for i := 0 to frmMain.sciEditor.Lines.Count -1 do begin
if Pos('show_menu', Trim(LowerCase(frmMain.sciEditor.Lines[i]))) = 1 then begin
SetLength(eLines, eMenuStr.Count +1);
eLines[eMenuStr.Count] := i;
eTemp := frmMain.sciEditor.Lines[i];
if CountChars(frmMain.sciEditor.Lines[i], '"') >= 4 then begin
eMenuStr.Add(Between(eTemp, '"', '"'));
while CountChars(eTemp, '"') > 2 do
Delete(eTemp, 1, 1);
lstMenu.Items.Add(Between(eTemp, '"', '"'));
end
else begin
eMenuStr.Add(Between(eTemp, '"', '"'));
lstMenu.Items.Add(Format('Unknown Menu on line %s', [IntToStr(i)]));
end;
end;
end;
cmdOK.Enabled := lstMenu.Items.Count <> 0;
end;
function TfrmSelectMenu.GetItemIndex: Integer;
var i: integer;
begin
Result := -1;
for i := 0 to lstMenu.Items.Count -1 do begin
if lstMenu.Selected[i] then
Result := i;
end;
end;
end.

View File

@ -1,191 +0,0 @@
object frmSocketTerminal: TfrmSocketTerminal
Left = 192
Top = 110
ActiveControl = rtfEnter
BorderStyle = bsDialog
Caption = 'Socket Terminal'
ClientHeight = 230
ClientWidth = 324
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
FormStyle = fsStayOnTop
OldCreateOrder = False
Position = poMainFormCenter
OnClose = FormClose
PixelsPerInch = 96
TextHeight = 13
object pnlSettings: TPanel
Left = 0
Top = 141
Width = 324
Height = 89
Align = alBottom
BevelOuter = bvNone
TabOrder = 2
object lblStatusCaption: TLabel
Left = 2
Top = 72
Width = 35
Height = 13
Caption = 'Status:'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = False
end
object lblStatus: TLabel
Left = 40
Top = 72
Width = 69
Height = 13
Caption = 'not connected'
Font.Charset = DEFAULT_CHARSET
Font.Color = clRed
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = False
end
object lblSettings: TLabel
Left = 4
Top = 6
Width = 43
Height = 13
Caption = 'Settings:'
end
object pnlSettings2: TPanel
Left = 4
Top = 24
Width = 311
Height = 41
BevelOuter = bvLowered
TabOrder = 0
object lblHost: TLabel
Left = 4
Top = 3
Width = 26
Height = 13
Caption = 'Host:'
end
object lblPort: TLabel
Left = 130
Top = 3
Width = 24
Height = 13
Caption = 'Port:'
end
object txtHost: TFlatEdit
Left = 4
Top = 17
Width = 121
Height = 19
ColorFlat = clBtnFace
ParentColor = True
TabOrder = 0
end
object txtPort: TFlatEdit
Left = 130
Top = 17
Width = 39
Height = 19
ColorFlat = clBtnFace
ParentColor = True
TabOrder = 1
Text = '1'
OnChange = txtPortChange
end
object optUDP: TFlatRadioButton
Left = 176
Top = 20
Width = 39
Height = 17
Caption = 'UDP'
TabOrder = 3
OnClick = optTCPClick
end
object optTCP: TFlatRadioButton
Left = 176
Top = 4
Width = 35
Height = 15
Caption = 'TCP'
Checked = True
TabOrder = 2
TabStop = True
OnClick = optTCPClick
end
object cmdConnect: TFlatButton
Left = 224
Top = 10
Width = 77
Height = 21
ColorHighLight = 8623776
ColorShadow = 8623776
Caption = 'Connect'
TabOrder = 4
OnClick = cmdConnectClick
end
end
end
object rtfEnter: TRichEdit
Left = 0
Top = 121
Width = 324
Height = 20
Align = alBottom
TabOrder = 1
WantReturns = False
OnKeyPress = rtfEnterKeyPress
end
object rtfReceived: TRichEdit
Left = 0
Top = 0
Width = 324
Height = 121
Align = alClient
ScrollBars = ssVertical
TabOrder = 0
end
object IdTCPClient: TIdTCPClient
MaxLineAction = maSplit
OnDisconnected = IdTCPClientDisconnected
OnConnected = IdTCPClientConnected
Port = 0
Left = 4
Top = 4
end
object IdUDPClient: TIdUDPClient
OnStatus = IdUDPClientStatus
Port = 0
Left = 4
Top = 34
end
object alCopyPaste: TActionList
Left = 4
Top = 64
object acCopy: TAction
Caption = 'Copy'
ShortCut = 16451
OnExecute = acCopyExecute
end
object acPaste: TAction
Caption = 'Paste'
ShortCut = 16470
OnExecute = acPasteExecute
end
object acUndo: TAction
Caption = 'Undo'
OnExecute = acUndoExecute
end
object acSelectAll: TAction
Caption = 'Select all'
OnExecute = acSelectAllExecute
end
end
end

View File

@ -1,259 +0,0 @@
unit UnitfrmSockets;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, ComCtrls, TFlatEditUnit,
TFlatRadioButtonUnit, TFlatButtonUnit, IdUDPBase, IdUDPClient,
IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, UnitReadThread,
ActnList;
type
TfrmSocketTerminal = class(TForm)
pnlSettings: TPanel;
rtfEnter: TRichEdit;
rtfReceived: TRichEdit;
lblStatusCaption: TLabel;
lblStatus: TLabel;
lblSettings: TLabel;
pnlSettings2: TPanel;
lblHost: TLabel;
txtHost: TFlatEdit;
txtPort: TFlatEdit;
lblPort: TLabel;
optUDP: TFlatRadioButton;
optTCP: TFlatRadioButton;
cmdConnect: TFlatButton;
IdTCPClient: TIdTCPClient;
IdUDPClient: TIdUDPClient;
alCopyPaste: TActionList;
acCopy: TAction;
acPaste: TAction;
acUndo: TAction;
acSelectAll: TAction;
procedure txtPortChange(Sender: TObject);
procedure cmdConnectClick(Sender: TObject);
procedure optTCPClick(Sender: TObject);
procedure IdTCPClientConnected(Sender: TObject);
procedure IdTCPClientDisconnected(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure rtfEnterKeyPress(Sender: TObject; var Key: Char);
procedure IdUDPClientStatus(ASender: TObject; const AStatus: TIdStatus;
const AStatusText: String);
procedure acCopyExecute(Sender: TObject);
procedure acPasteExecute(Sender: TObject);
procedure acUndoExecute(Sender: TObject);
procedure acSelectAllExecute(Sender: TObject);
private
ReadThread: TReadThread;
public
procedure Append(eText: String; eColor: TColor = clBlack);
procedure SetStatus(eStatus: String; eColor: TColor);
procedure OnRead(eRead: String);
procedure EnableControls(eValue: Boolean);
end;
var
frmSocketTerminal: TfrmSocketTerminal;
implementation
{$R *.dfm}
procedure TfrmSocketTerminal.Append(eText: String; eColor: TColor);
begin
eText := Format('[%s] %s', [TimeToStr(Time), eText]);
rtfReceived.SelStart := Length(rtfReceived.Lines.Text);
rtfReceived.SelAttributes.Color := eColor;
rtfReceived.SelText := eText + #13#10;
rtfReceived.Perform(WM_VSCROLL, SB_BOTTOM, 0);
end;
procedure TfrmSocketTerminal.OnRead(eRead: String);
begin
Append(eRead, clWindowText);
end;
procedure TfrmSocketTerminal.SetStatus(eStatus: String; eColor: TColor);
begin
lblStatus.Caption := eStatus;
lblStatus.Font.Color := eColor;
end;
procedure TfrmSocketTerminal.txtPortChange(Sender: TObject);
begin
try
StrToInt(txtPort.Text);
except
txtPort.Text := '1';
end;
end;
procedure TfrmSocketTerminal.cmdConnectClick(Sender: TObject);
begin
if Tag = 0 then begin
if optTCP.Checked then begin
IdTCPClient.Host := txtHost.Text;
IdTCPClient.Port := StrToInt(txtPort.Text);
EnableControls(False);
Append('Connecting to ' + txtHost.Text + ':' + txtPort.Text + '...', clHighlight);
try
IdTCPClient.Connect;
ReadThread := TReadThread.Create(True);
ReadThread.ReadTCP := True;
ReadThread.Resume;
except
on E: Exception do begin
MessageBox(Handle, PChar('Couldn''t connect to server:' + #13 + E.Message), 'Warning', MB_ICONWARNING);
EnableControls(True);
end;
end;
end
else begin
IdUDPClient.Host := txtHost.Text;
IdUDPClient.Port := StrToInt(txtPort.Text);
EnableControls(False);
try
IdUDPClient.Active := True;
ReadThread := TReadThread.Create(True);
ReadThread.ReadTCP := False;
ReadThread.Resume;
SetStatus('socket active', clGreen);
Append('Opened socket to ' + txtHost.Text + ':' + txtPort.Text + '!', clGreen);
except
on E: Exception do begin
MessageBox(Handle, PChar('Couldn''t activate socket:' + #13 + E.Message), 'Warning', MB_ICONWARNING);
EnableControls(True);
end;
end;
end;
end
else begin
if optTCP.Checked then begin
Screen.Cursor := crHourGlass;
IdTCPClient.Disconnect;
ReadThread.Terminate;
while Tag <> 0 do begin
Sleep(5);
Application.ProcessMessages;
end;
Screen.Cursor := crDefault;
end
else begin
Screen.Cursor := crHourGlass;
IdUDPClient.Active := False;
ReadThread.Terminate;
EnableControls(True);
SetStatus('socket inactive', clRed);
Append('Closed socket to ' + txtHost.Text + ':' + txtPort.Text + '!', clRed);
Screen.Cursor := crDefault;
end;
end;
end;
procedure TfrmSocketTerminal.optTCPClick(Sender: TObject);
begin
if optTCP.Checked then begin
if not IdTCPClient.Connected then
SetStatus('not connected', clRed);
end
else begin
if not IdUDPClient.Active then
SetStatus('socket inactive', clRed);
end;
end;
procedure TfrmSocketTerminal.EnableControls(eValue: Boolean);
begin
txtHost.Enabled := eValue;
txtPort.Enabled := eValue;
lblHost.Enabled := eValue;
lblPort.Enabled := eValue;
optTCP.Enabled := eValue;
optUDP.Enabled := eValue;
if eValue then begin
cmdConnect.Caption := 'Connect';
Tag := 0;
end
else begin
cmdConnect.Caption := 'Disconnect';
Tag := 1;
end;
end;
procedure TfrmSocketTerminal.IdTCPClientConnected(Sender: TObject);
begin
Append('Established connection to ' + txtHost.Text + ':' + txtPort.Text, clGreen);
SetStatus('connected', clGreen);
end;
procedure TfrmSocketTerminal.IdTCPClientDisconnected(Sender: TObject);
begin
Append('Disconnected from ' + txtHost.Text + ':' + txtPort.Text, clMaroon);
EnableControls(True);
SetStatus('not connected', clRed);
end;
procedure TfrmSocketTerminal.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
if Tag = 1 then
cmdConnect.Click;
end;
procedure TfrmSocketTerminal.rtfEnterKeyPress(Sender: TObject;
var Key: Char);
begin
if Tag = 1 then begin
if (Key = #13) and (rtfEnter.Text <> '') then begin
if IdTCPClient.Connected then
IdTCPClient.WriteLn(rtfEnter.Text)
else
IdUDPClient.Send(rtfEnter.Text);
Append(rtfEnter.Text, clNavy);
rtfEnter.Clear;
Key := #0;
end;
end;
end;
procedure TfrmSocketTerminal.IdUDPClientStatus(ASender: TObject;
const AStatus: TIdStatus; const AStatusText: String);
begin
Append(AStatusText, clGray);
end;
procedure TfrmSocketTerminal.acCopyExecute(Sender: TObject);
begin
if (ActiveControl is TRichEdit) then
TRichEdit(ActiveControl).CopyToClipboard;
if (ActiveControl is TFlatEdit) then
TFlatEdit(ActiveControl).CopyToClipboard;
end;
procedure TfrmSocketTerminal.acPasteExecute(Sender: TObject);
begin
if (ActiveControl is TRichEdit) then
TRichEdit(ActiveControl).PasteFromClipboard;
if (ActiveControl is TFlatEdit) then
TFlatEdit(ActiveControl).PasteFromClipboard;
end;
procedure TfrmSocketTerminal.acUndoExecute(Sender: TObject);
begin
if (ActiveControl is TRichEdit) then
TRichEdit(ActiveControl).Undo;
if (ActiveControl is TFlatEdit) then
TFlatEdit(ActiveControl).Undo;
end;
procedure TfrmSocketTerminal.acSelectAllExecute(Sender: TObject);
begin
if (ActiveControl is TRichEdit) then
TRichEdit(ActiveControl).SelectAll;
if (ActiveControl is TFlatEdit) then
TFlatEdit(ActiveControl).SelectAll;
end;
end.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -1,11 +0,0 @@
del .\*.~pas
del .\*.dcu
del .\*.~ddp
del .\*.ddp
del .\*.~dpr
del .\*.~dfm
del .\*.~dpr
del .\*.map
del .\*.drc
del .\*.~xfm
upx AMXX_Edit_v2.exe

View File

@ -1,281 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.