- Updated Calltips
- Fixed bugs in register plugin function - Added "Autocomplete Check", allows you to customize autocomplete items - Added a new dialog (the parameter info dialog) to the loadinfo record/struct - Added a new unit called UnitACCheck.pas
This commit is contained in:
parent
778c2080b0
commit
23fb93a3cc
|
@ -115,7 +115,7 @@ AutoIncBuild=1
|
|||
MajorVer=1
|
||||
MinorVer=3
|
||||
Release=0
|
||||
Build=30
|
||||
Build=31
|
||||
Debug=0
|
||||
PreRelease=0
|
||||
Special=0
|
||||
|
@ -126,7 +126,7 @@ CodePage=1252
|
|||
[Version Info Keys]
|
||||
CompanyName=AMX Mod X Dev Team
|
||||
FileDescription=
|
||||
FileVersion=1.3.0.30
|
||||
FileVersion=1.3.0.31
|
||||
InternalName=
|
||||
LegalCopyright=
|
||||
LegalTrademarks=
|
||||
|
|
|
@ -37,7 +37,9 @@ uses
|
|||
UnitfrmConnGen in 'UnitfrmConnGen.pas' {frmConnGen},
|
||||
UnitPlugins in 'UnitPlugins.pas',
|
||||
UnitfrmIRCPaster in 'UnitfrmIRCPaster.pas' {frmIRCPaster},
|
||||
MyEditFileClasses in 'MyEditFileClasses.pas';
|
||||
MyEditFileClasses in 'MyEditFileClasses.pas',
|
||||
UnitfrmParamEdit in 'UnitfrmParamEdit.pas' {frmParamEdit},
|
||||
UnitACCheck in 'UnitACCheck.pas';
|
||||
|
||||
{ Used components:
|
||||
- JVCL 3.0
|
||||
|
@ -67,6 +69,7 @@ begin
|
|||
Application.CreateForm(TfrmMain, frmMain);
|
||||
Application.CreateForm(TfrmAutoIndent, frmAutoIndent);
|
||||
Application.CreateForm(TfrmSettings, frmSettings);
|
||||
Application.CreateForm(TfrmParamEdit, frmParamEdit);
|
||||
Application.OnMessage := frmMain.OnMessage;
|
||||
Application.OnShortCut := frmMain.OnShortCut;
|
||||
frmMain.sciEditor.Lines[5] := '#define PLUGIN "' + frmSettings.txtDefaultName.Text + '"';
|
||||
|
|
Binary file not shown.
Binary file not shown.
269
editor/studio/UnitACCheck.pas
Normal file
269
editor/studio/UnitACCheck.pas
Normal file
|
@ -0,0 +1,269 @@
|
|||
unit UnitACCheck;
|
||||
// collection component written by Jens Schumann and MaxHub (maximov)
|
||||
|
||||
interface
|
||||
|
||||
Uses SysUtils, Classes;
|
||||
|
||||
type
|
||||
|
||||
TJsCollection = class(TCollection)
|
||||
private
|
||||
FCollectionname : String;
|
||||
procedure SetCollectionname(const Value: String);
|
||||
public
|
||||
procedure AfterConstruction; override;
|
||||
procedure Assign(Source : TPersistent); override;
|
||||
procedure SaveToFile(const Filename : TFilename);
|
||||
procedure SaveToStream(Stream : TStream); virtual;
|
||||
procedure LoadFromFile(const Filename : TFilename);
|
||||
procedure LoadFromStream(Stream : TStream); virtual;
|
||||
published
|
||||
property Collectionname : String read FCollectionname write SetCollectionname;
|
||||
end;
|
||||
|
||||
TmxJsCollection = class(TJsCollection)
|
||||
private
|
||||
FBinary : Boolean;
|
||||
public
|
||||
procedure LoadFromStream(aStream: TStream); override;
|
||||
procedure SaveToStream(aStream: TStream); override;
|
||||
property Binary : Boolean read FBinary write FBinary;
|
||||
published
|
||||
property Collectionname stored false;
|
||||
end;
|
||||
|
||||
|
||||
TWriterExt = class(TWriter)
|
||||
public
|
||||
procedure WriteCollectionProperties(Value : TCollection);
|
||||
end;
|
||||
|
||||
TReaderExt = class(TReader)
|
||||
public
|
||||
procedure ReadCollectionProperties(Value: TCollection);
|
||||
end;
|
||||
|
||||
TACFunction = class(TCollectionItem)
|
||||
private
|
||||
FName: String;
|
||||
FItems: TStringList;
|
||||
published
|
||||
property Name: String read FName write FName;
|
||||
property Items: TStringList read FItems write FItems;
|
||||
public
|
||||
constructor Create(ACollection: TCollection); override;
|
||||
destructor Destroy; override;
|
||||
end;
|
||||
|
||||
|
||||
var eACList: TmxJsCollection;
|
||||
|
||||
implementation
|
||||
|
||||
uses TypInfo;
|
||||
|
||||
const
|
||||
iFilerBufferSize = 4096;
|
||||
FilerSignatureEx: array[1..4] of Char = 'TPF0';
|
||||
cInvalidName = ' is not a valid CollectionName!';
|
||||
|
||||
{ TJsCollection }
|
||||
|
||||
procedure TJsCollection.AfterConstruction;
|
||||
begin
|
||||
inherited;
|
||||
FCollectionname := copy(className,2,length(className)-1)
|
||||
end;
|
||||
|
||||
procedure TJsCollection.Assign(Source: TPersistent);
|
||||
begin
|
||||
If Source is TJsCollection then
|
||||
FCollectionname:=TJsCollection(Source).Collectionname;
|
||||
inherited Assign(Source);
|
||||
end;
|
||||
|
||||
procedure TJsCollection.LoadFromFile(const Filename: TFilename);
|
||||
var
|
||||
FileStream : TFileStream;
|
||||
begin
|
||||
Clear;
|
||||
FileStream:=TFileStream.Create(Filename,fmOpenRead);
|
||||
Try
|
||||
LoadFromStream(FileStream);
|
||||
Finally
|
||||
FileStream.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJsCollection.LoadFromStream(Stream: TStream);
|
||||
var
|
||||
Reader : TReaderExt;
|
||||
begin
|
||||
Reader:=TReaderExt.Create(Stream,iFilerBufferSize);
|
||||
Try
|
||||
Reader.ReadCollectionProperties(Self);
|
||||
Finally
|
||||
Reader.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJsCollection.SaveToFile(const Filename: TFilename);
|
||||
var
|
||||
FileStream : TFileStream;
|
||||
begin
|
||||
FileStream:=TFileStream.Create(Filename,fmCreate);
|
||||
Try
|
||||
SaveToStream(FileStream);
|
||||
Finally
|
||||
FileStream.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJsCollection.SaveToStream(Stream: TStream);
|
||||
var
|
||||
Writer : TWriterExt;
|
||||
begin
|
||||
Writer:=TWriterExt.Create(Stream,iFilerBufferSize);
|
||||
Try
|
||||
Writer.WriteCollectionProperties(Self);
|
||||
Writer.WriteListEnd;
|
||||
Finally
|
||||
Writer.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJsCollection.SetCollectionname(const Value: String);
|
||||
begin
|
||||
if not IsValidIdent(Value)
|
||||
then raise exception.Create(#39+Value+#39+cInValidName)
|
||||
else FCollectionname := Value;
|
||||
end;
|
||||
|
||||
{ TWriterExt }
|
||||
|
||||
|
||||
procedure TWriterExt.WriteCollectionProperties(Value: TCollection);
|
||||
begin
|
||||
WriteProperties(Value);
|
||||
WriteStr('items');
|
||||
inherited WriteCollection(Value);
|
||||
end;
|
||||
|
||||
{ TReaderExt }
|
||||
|
||||
procedure TReaderExt.ReadCollectionProperties(Value: TCollection);
|
||||
var propName:string;
|
||||
oldPos:integer;
|
||||
begin
|
||||
while not EndOfList do
|
||||
begin
|
||||
oldPos := Position;
|
||||
propName := ReadStr;
|
||||
if propName = 'items' then
|
||||
begin
|
||||
ReadValue;
|
||||
inherited ReadCollection(Value);
|
||||
end else begin
|
||||
Position := oldPos;
|
||||
ReadProperty(value);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
{ TmxJsCollection }
|
||||
|
||||
procedure TmxJsCollection.LoadFromStream(aStream: TStream);
|
||||
var Reader : TReaderExt;
|
||||
StreamInner : TStream;
|
||||
format : TStreamOriginalFormat;
|
||||
oldPos : Int64;
|
||||
SigBuffer : array[1..4] of Char;
|
||||
begin
|
||||
// automatisch feststellen ob binär oder text
|
||||
oldPos := aStream.Position;
|
||||
aStream.ReadBuffer(SigBuffer[1],sizeOf(SigBuffer));
|
||||
FBinary := SigBuffer = FilerSignatureEx;
|
||||
aStream.Position := oldPos;
|
||||
|
||||
if FBinary
|
||||
then StreamInner := aStream
|
||||
else StreamInner := TMemoryStream.Create;
|
||||
|
||||
try
|
||||
if not FBinary then
|
||||
begin
|
||||
format := sofBinary;
|
||||
ObjectTextToBinary(aStream,StreamInner,format);
|
||||
StreamInner.Position := 0;
|
||||
end;
|
||||
|
||||
Reader := TReaderExt.Create(StreamInner,iFilerBufferSize);
|
||||
try
|
||||
Reader.ReadSignature;
|
||||
Reader.ReadStr; // ClassName
|
||||
FCollectionname := Reader.ReadStr; // Collectionname
|
||||
|
||||
Reader.ReadCollectionProperties(self);
|
||||
|
||||
Reader.ReadListEnd;
|
||||
Reader.ReadListEnd;
|
||||
finally
|
||||
Reader.Free;
|
||||
end;
|
||||
finally
|
||||
if not FBinary then StreamInner.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure TmxJsCollection.SaveToStream(aStream: TStream);
|
||||
var Writer : TWriterExt;
|
||||
StreamInner : TStream;
|
||||
format : TStreamOriginalFormat;
|
||||
begin
|
||||
if FBinary
|
||||
then StreamInner := aStream
|
||||
else StreamInner := TMemoryStream.Create;
|
||||
|
||||
try
|
||||
Writer := TWriterExt.Create(StreamInner,iFilerBufferSize);
|
||||
try
|
||||
Writer.WriteSignature;
|
||||
Writer.WriteStr(ClassName);
|
||||
Writer.WriteStr(Collectionname);
|
||||
|
||||
Writer.WriteCollectionProperties(self);
|
||||
|
||||
Writer.WriteListEnd;
|
||||
Writer.WriteListEnd;
|
||||
finally
|
||||
Writer.Free;
|
||||
end;
|
||||
if not FBinary then
|
||||
begin
|
||||
StreamInner.Position := 0;
|
||||
format := sofText;
|
||||
ObjectBinaryToText(StreamInner,aStream,format);
|
||||
end;
|
||||
finally
|
||||
if not FBinary then StreamInner.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TACFunction }
|
||||
|
||||
constructor TACFunction.Create(ACollection: TCollection);
|
||||
begin
|
||||
inherited;
|
||||
FItems := TStringList.Create;
|
||||
end;
|
||||
|
||||
destructor TACFunction.Destroy;
|
||||
begin
|
||||
FItems.Free;
|
||||
inherited;
|
||||
end;
|
||||
|
||||
end.
|
|
@ -668,6 +668,7 @@ begin
|
|||
frmSettings.chkDisableCT.Checked := eConfig.ReadBool('Editor', 'Disable_CT', False);
|
||||
frmMain.sciAutoComplete.Disabled := frmSettings.chkDisableAC.Checked;
|
||||
frmMain.sciCallTips.Disabled := frmSettings.chkDisableCT.Checked;
|
||||
frmSettings.chkAutoHideCT.Checked := eConfig.ReadBool('Editor', 'AutoHideCT', True);
|
||||
{ Shortcuts }
|
||||
frmSettings.lvShortcuts.Items.BeginUpdate;
|
||||
try
|
||||
|
|
|
@ -57,6 +57,7 @@ type TLoadInfo = record
|
|||
hSelectColor: HWND;
|
||||
hSettings: HWND;
|
||||
hSocketsTerminal: HWND;
|
||||
hParamEdit: HWND;
|
||||
{ Important Control Handles }
|
||||
hOutput: HWND;
|
||||
hCodeExplorer: HWND;
|
||||
|
@ -248,7 +249,8 @@ uses UnitfrmSettings, UnitMainTools, UnitfrmAllFilesForm,
|
|||
UnitfrmReplace, UnitfrmSearch, UnitfrmSelectColor,
|
||||
UnitfrmSocketsTerminal, UnitLanguages,UnitCodeExplorerUpdater,
|
||||
UnitCodeInspector, UnitCodeSnippets, UnitCodeUtils, UnitCompile,
|
||||
UnitfrmIRCPaster, UnitMenuGenerators, UnitReadThread, UnitTextAnalyze;
|
||||
UnitfrmIRCPaster, UnitMenuGenerators, UnitReadThread, UnitTextAnalyze,
|
||||
UnitfrmParamEdit;
|
||||
|
||||
function LoadPlugin(ListItem: TListItem): Boolean;
|
||||
var eLoadInfo: TLoadInfo;
|
||||
|
@ -280,6 +282,7 @@ begin
|
|||
hSelectColor := frmSelectColor.Handle;
|
||||
hSettings := frmSettings.Handle;
|
||||
hSocketsTerminal := frmSocketsTerminal.Handle;
|
||||
hParamEdit := frmParamEdit.Handle;
|
||||
{ Important Control Handles }
|
||||
hOutput := frmMain.lstOutput.Handle;
|
||||
hCodeExplorer := frmMain.trvExplorer.Handle;
|
||||
|
|
|
@ -189,7 +189,7 @@ begin
|
|||
if (IsAtStart('#define', eString)) then begin
|
||||
eString := Copy(eString, 8, Length(eString));
|
||||
eString := Trim(eString);
|
||||
Result.CallTips.Add(eString + '-> ' + FileName);
|
||||
Result.CallTips.Add(eString + '-> ' + FileName + ', defined constant');
|
||||
if Pos(#32, eString) <> 0 then
|
||||
eString := Copy(eString, 1, Pos(#32, eString) - 1);
|
||||
if Pos(' ', eString) <> 0 then
|
||||
|
@ -273,8 +273,15 @@ begin
|
|||
if Pos('operator', eTemp) = 1 then
|
||||
k := 6;
|
||||
|
||||
if k < 5 then
|
||||
Result.CallTips.Add(eTemp + '-> ' + FileName);
|
||||
if k < 5 then begin
|
||||
case k of
|
||||
0: Result.CallTips.Add(eTemp + '-> ' + FileName + ', function');
|
||||
1: Result.CallTips.Add(eTemp + '-> ' + FileName + ', public function');
|
||||
2: Result.CallTips.Add(eTemp + '-> ' + FileName + ', stock');
|
||||
3: Result.CallTips.Add(eTemp + '-> ' + FileName + ', native');
|
||||
4: Result.CallTips.Add(eTemp + '-> ' + FileName + ', forward');
|
||||
end;
|
||||
end;
|
||||
// Copy function-name
|
||||
if Pos('(', eTemp) <> 0 then
|
||||
eTemp := Copy(eTemp, 1, Pos('(', eTemp) - 1);
|
||||
|
@ -354,7 +361,7 @@ begin
|
|||
Delete(eTemp, 1, Pos(':', eTemp));
|
||||
|
||||
if (Pos('enum', eTemp) = Pos('operator', eTemp)) and (Pos('enum', eTemp) = 0) then
|
||||
Result.CallTips.Add(eTemp + '-> ' + FileName);
|
||||
Result.CallTips.Add(eTemp + '-> ' + FileName + ', ' + Trim(Copy(eString, 1, Pos(#32, eString) -1)));
|
||||
|
||||
// Copy function-name
|
||||
if Pos('(', eTemp) <> 0 then
|
||||
|
|
|
@ -407,7 +407,7 @@ uses UnitfrmSettings, UnitMainTools, UnitLanguages, UnitfrmInfo,
|
|||
UnitfrmHudMsgGenerator, UnitCompile, UnitfrmAutoIndent,
|
||||
UnitfrmHTMLPreview, UnitCodeInspector, UnitfrmMOTDGen,
|
||||
UnitfrmMenuGenerator, UnitfrmClose, UnitPlugins, UnitfrmConnGen,
|
||||
UnitMenuGenerators, UnitfrmIRCPaster, MyEditFileClasses;
|
||||
UnitMenuGenerators, UnitfrmIRCPaster, MyEditFileClasses, UnitACCheck;
|
||||
|
||||
{$R *.dfm}
|
||||
|
||||
|
@ -512,6 +512,9 @@ begin
|
|||
CopyFile(PChar(ExtractFilePath(ParamStr(0)) + 'config\C++.csl'), PChar(ExtractFilePath(ParamStr(0)) + 'config\C++.bak'), False);
|
||||
CopyFile(PChar(ExtractFilePath(ParamStr(0)) + 'config\Other.csl'), PChar(ExtractFilePath(ParamStr(0)) + 'config\Other.bak'), False);
|
||||
eModified := ActiveDoc.Modified;
|
||||
frmSettings.lstFunctions.Clear;
|
||||
for i := 0 to eACList.Count -1 do
|
||||
frmSettings.lstFunctions.Items.Add(TACFunction(eACList.Items[i]).Name);
|
||||
|
||||
if frmSettings.ShowModal = mrOk then begin
|
||||
{ Shortcuts }
|
||||
|
@ -554,6 +557,7 @@ begin
|
|||
eConfig.WriteBool('Editor', 'UnindentEmptyLine', frmAutoIndent.chkUnindentLine.Checked);
|
||||
eConfig.WriteBool('Editor', 'Disable_AC', frmSettings.chkDisableAC.Checked);
|
||||
eConfig.WriteBool('Editor', 'Disable_CT', frmSettings.chkDisableCT.Checked);
|
||||
eConfig.WriteBool('Editor', 'AutoHideCT', frmSettings.chkAutoHideCT.Checked);
|
||||
if frmSettings.chkAUDisable.Checked then
|
||||
eConfig.WriteString('Editor', 'AutoDisable', frmSettings.txtAUDisable.Text)
|
||||
else
|
||||
|
@ -598,6 +602,7 @@ begin
|
|||
eConfig.WriteInteger('Misc', 'CPUSpeed', frmSettings.sldSpeed.Value);
|
||||
eConfig.WriteString('Misc', 'LangDir', frmSettings.txtLangDir.Text);
|
||||
eConfig.WriteBool('Misc', 'ShowStatusbar', frmSettings.chkShowStatusbar.Checked);
|
||||
eACList.SaveToFile(ExtractFilePath(ParamStr(0)) + 'config\ACList.cfg');
|
||||
end
|
||||
else begin
|
||||
{ Restore Code-Snippets }
|
||||
|
@ -607,6 +612,7 @@ begin
|
|||
CopyFile(PChar(ExtractFilePath(ParamStr(0)) + 'config\Pawn.bak'), PChar(ExtractFilePath(ParamStr(0)) + 'config\Pawn.csl'), False);
|
||||
CopyFile(PChar(ExtractFilePath(ParamStr(0)) + 'config\C++.bak'), PChar(ExtractFilePath(ParamStr(0)) + 'config\C++.csl'), False);
|
||||
CopyFile(PChar(ExtractFilePath(ParamStr(0)) + 'config\Other.bak'), PChar(ExtractFilePath(ParamStr(0)) + 'config\Other.csl'), False);
|
||||
eACList.LoadFromFile(ExtractFilePath(ParamStr(0)) + 'config\ACList.cfg');
|
||||
end;
|
||||
|
||||
if mnuPawn.Checked then
|
||||
|
@ -1616,6 +1622,7 @@ begin
|
|||
|
||||
eSavedFiles.SaveToFile(ExtractFilePath(ParamStr(0)) + 'config\Cache.cfg');
|
||||
eSavedFiles.Free;
|
||||
eACList.Free;
|
||||
|
||||
Started := False;
|
||||
end;
|
||||
|
@ -1884,7 +1891,7 @@ procedure TfrmMain.mnuRegisterPluginsIniWebClick(Sender: TObject);
|
|||
var a, b: integer;
|
||||
begin
|
||||
if Length(eLine) > 0 then begin
|
||||
b := 0;
|
||||
b := Length(eLine) +1;
|
||||
for a := 1 to Length(eLine) - 1 do begin
|
||||
if (eLine[a] = ';') or (eLine[a] = '/') then begin
|
||||
b := a;
|
||||
|
@ -1913,7 +1920,8 @@ begin
|
|||
|
||||
try
|
||||
IdFTP.ChangeDir(frmSettings.txtDefaultDir.Text + 'configs/');
|
||||
IdFTP.Get('plugins.ini', ExtractFilePath(ParamStr(0)) + 'plugins.ini');
|
||||
IdFTP.TransferType := ftASCII;
|
||||
IdFTP.Get('plugins.ini', ExtractFilePath(ParamStr(0)) + 'plugins.ini', True);
|
||||
except
|
||||
Screen.Cursor := crDefault;
|
||||
MessageBox(Handle, PChar(lFailedUpdatePluginsIni), PChar(Application.Title), MB_ICONERROR);
|
||||
|
@ -1936,6 +1944,7 @@ begin
|
|||
if eFound then begin
|
||||
Screen.Cursor := crDefault;
|
||||
MessageBox(Handle, PChar(lAlreadyRegistered), PChar(Application.Title), MB_ICONINFORMATION);
|
||||
IdFTP.Disconnect;
|
||||
exit;
|
||||
end
|
||||
else begin
|
||||
|
@ -1945,7 +1954,6 @@ begin
|
|||
eStr.Free;
|
||||
|
||||
try
|
||||
IdFTP.TransferType := ftASCII;
|
||||
IdFTP.Put(ExtractFilePath(ParamStr(0)) + 'plugins.ini', 'plugins.ini');
|
||||
IdFTP.Disconnect;
|
||||
MessageBox(Handle, PChar(lSuccessfulRegistered), PChar(Application.Title), MB_ICONINFORMATION);
|
||||
|
@ -1960,7 +1968,25 @@ end;
|
|||
procedure TfrmMain.sciAutoCompleteBeforeShow(Sender: TObject;
|
||||
const Position: Integer; ListToDisplay: TStrings;
|
||||
var CancelDisplay: Boolean);
|
||||
function GetFunctionPos: Integer;
|
||||
var eStr: String;
|
||||
i: integer;
|
||||
begin
|
||||
Result := 0;
|
||||
eStr := StringReplace(sciEditor.Lines[sciEditor.GetCurrentLineNumber], '^"', '', [rfReplaceAll]);
|
||||
while Between(eStr, '"', '"') <> '' do
|
||||
eStr := StringReplace(eStr, Between(eStr, '"', '"'), '', [rfReplaceAll]);
|
||||
while Between(eStr, '{', '}') <> '' do
|
||||
eStr := StringReplace(eStr, Between(eStr, '"', '"'), '', [rfReplaceAll]);
|
||||
for i := 0 to Length(eStr) -1 do begin
|
||||
if eStr[i] = ',' then
|
||||
Result := Result +1;
|
||||
end;
|
||||
end;
|
||||
|
||||
var eCurrStyle: Integer;
|
||||
eFunction: String;
|
||||
i: integer;
|
||||
begin
|
||||
if not Plugin_AutoCompleteShow(ListToDisplay.GetText) then begin
|
||||
CancelDisplay := True;
|
||||
|
@ -1970,11 +1996,29 @@ begin
|
|||
if (Started) and (Assigned(GetStyleAt(sciEditor.SelStart))) then begin
|
||||
eCurrStyle := GetStyleAt(sciEditor.SelStart).StyleNumber;
|
||||
|
||||
|
||||
if (ActiveDoc.Highlighter = 'Pawn') or (ActiveDoc.Highlighter = 'C++') then begin
|
||||
CancelDisplay := (eCurrStyle = 12) or (eCurrStyle = 1) or (eCurrStyle = 2) or (eCurrStyle = 3) or (eCurrStyle = 15);
|
||||
CancelDisplay := (CancelDisplay) or (Pos('#', Trim(sciEditor.Lines[sciEditor.GetCurrentLineNumber])) = 1);
|
||||
CancelDisplay := (CancelDisplay) or (IsAtStart('new', sciEditor.Lines[sciEditor.GetCurrentLineNumber], False));
|
||||
eFunction := '';
|
||||
for i := 0 to jviCode.Root.Count -1 do begin
|
||||
if jviCode.Root.Items[i].DisplayName = 'Function Call' then begin
|
||||
eFunction := jviCode.Root.Items[i].Items[0].DisplayValue;
|
||||
break;
|
||||
end;
|
||||
end;
|
||||
if eFunction <> '' then begin
|
||||
eFunction := LowerCase(Trim(eFunction));
|
||||
for i := 0 to eACList.Count -1 do begin
|
||||
if eFunction = LowerCase(Trim(TACFunction(eACList.Items[i]).Name)) then begin
|
||||
if TACFunction(eACList.Items[i]).Items.Count > GetFunctionPos then begin
|
||||
ListToDisplay.Text := StringReplace(TACFunction(eACList.Items[i]).Items[GetFunctionPos], '; ', #13, [rfReplaceAll]);
|
||||
break;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end
|
||||
else if (eCurrStyle = 11) or (eCurrStyle = 10) or (eCurrStyle = 9) or (eCurrStyle = 8) or (eCurrStyle = 5) or (eCurrStyle = 4) or (eCurrStyle = 0) or (eCurrStyle >= 34) then
|
||||
CancelDisplay := False
|
||||
else
|
||||
CancelDisplay := True;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
@ -2109,8 +2153,46 @@ end;
|
|||
procedure TfrmMain.sciCallTipsBeforeShow(Sender: TObject;
|
||||
const Position: Integer; ListToDisplay: TStrings;
|
||||
var CancelDisplay: Boolean);
|
||||
function GetFunctionPos: Integer;
|
||||
var eStr: String;
|
||||
i: integer;
|
||||
begin
|
||||
Result := 0;
|
||||
eStr := StringReplace(sciEditor.Lines[sciEditor.GetCurrentLineNumber], '^"', '', [rfReplaceAll]);
|
||||
while Between(eStr, '"', '"') <> '' do
|
||||
eStr := StringReplace(eStr, Between(eStr, '"', '"'), '', [rfReplaceAll]);
|
||||
while Between(eStr, '{', '}') <> '' do
|
||||
eStr := StringReplace(eStr, Between(eStr, '"', '"'), '', [rfReplaceAll]);
|
||||
for i := 0 to Length(eStr) -1 do begin
|
||||
if eStr[i] = ',' then
|
||||
Result := Result +1;
|
||||
end;
|
||||
end;
|
||||
|
||||
var i: integer;
|
||||
eFunction: String;
|
||||
begin
|
||||
CancelDisplay := not Plugin_CallTipShow(ListToDisplay.GetText);
|
||||
if (frmSettings.chkAutoHideCT.Checked) and (jviCode.Root.Items[0].DisplayName = 'Function Call') then begin
|
||||
for i := 0 to jviCode.Root.Count -1 do begin
|
||||
if jviCode.Root.Items[i].DisplayName = 'Function Call' then begin
|
||||
eFunction := jviCode.Root.Items[i].Items[0].DisplayValue;
|
||||
break;
|
||||
end;
|
||||
end;
|
||||
|
||||
if eFunction <> '' then begin
|
||||
eFunction := LowerCase(Trim(eFunction));
|
||||
for i := 0 to eACList.Count -1 do begin
|
||||
if eFunction = LowerCase(Trim(TACFunction(eACList.Items[i]).Name)) then begin
|
||||
if TACFunction(eACList.Items[i]).Items.Count > GetFunctionPos then begin
|
||||
CancelDisplay := True;
|
||||
break;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmMain.sciEditorCallTipClick(Sender: TObject;
|
||||
|
@ -2878,8 +2960,12 @@ begin
|
|||
end;
|
||||
|
||||
procedure TfrmMain.FormCreate(Sender: TObject);
|
||||
var i: integer;
|
||||
begin
|
||||
sciEditor.StreamClass := TSciMyStream;
|
||||
eACList := TmxJsCollection.Create(TACFunction);
|
||||
eACList.Collectionname := 'Autocomplete_List';
|
||||
eACList.LoadFromFile(ExtractFilePath(ParamStr(0)) + 'config\ACList.cfg');
|
||||
end;
|
||||
|
||||
end.
|
||||
|
|
BIN
editor/studio/UnitfrmParamEdit.dfm
Normal file
BIN
editor/studio/UnitfrmParamEdit.dfm
Normal file
Binary file not shown.
27
editor/studio/UnitfrmParamEdit.pas
Normal file
27
editor/studio/UnitfrmParamEdit.pas
Normal file
|
@ -0,0 +1,27 @@
|
|||
unit UnitfrmParamEdit;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
SysUtils, Windows, Messages, Classes, Graphics, Controls,
|
||||
StdCtrls, ExtCtrls, Forms, TBXDkPanels, SpTBXDkPanels, mbTBXMemo,
|
||||
SpTBXEditors;
|
||||
|
||||
type
|
||||
TfrmParamEdit = class(TForm)
|
||||
txtInformation: TmbTBXMemo;
|
||||
cmdOk: TSpTBXButton;
|
||||
cmdCancel: TSpTBXButton;
|
||||
lblFunction: TLabel;
|
||||
txtFunction: TSpTBXEdit;
|
||||
lblItems: TLabel;
|
||||
end;
|
||||
|
||||
var
|
||||
frmParamEdit: TfrmParamEdit;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.DFM}
|
||||
|
||||
end.
|
|
@ -95,7 +95,7 @@ function RemComments(eLine: String): String;
|
|||
var a, b: integer;
|
||||
begin
|
||||
if Length(eLine) > 0 then begin
|
||||
b := 0;
|
||||
b := Length(eLine) +1;
|
||||
for a := 1 to Length(eLine) -1 do begin
|
||||
if (eLine[a] = ';') or (eLine[a] = '/') then begin
|
||||
b := a;
|
||||
|
|
|
@ -4,7 +4,7 @@ object frmSettings: TfrmSettings
|
|||
BorderStyle = bsDialog
|
||||
Caption = 'AMXX-Studio - Settings'
|
||||
ClientHeight = 297
|
||||
ClientWidth = 488
|
||||
ClientWidth = 504
|
||||
Color = clBtnFace
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
|
@ -21,7 +21,7 @@ object frmSettings: TfrmSettings
|
|||
object trvSettings: TJvSettingsTreeView
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 135
|
||||
Width = 153
|
||||
Height = 260
|
||||
AutoExpand = False
|
||||
ShowButtons = True
|
||||
|
@ -43,25 +43,28 @@ object frmSettings: TfrmSettings
|
|||
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF040000000000000011436F6D70696C65
|
||||
722053657474696E67732C000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0500
|
||||
0000000000001348616C662D4C696665204469726563746F7279230000000100
|
||||
000001000000FFFFFFFFFFFFFFFF0A000000020000000A436F64652D546F6F6C
|
||||
000001000000FFFFFFFFFFFFFFFF0A000000030000000A436F64652D546F6F6C
|
||||
7321000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0A00000000000000085365
|
||||
7474696E677326000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF030000000000
|
||||
00000D436F64652D536E6970706574731C0000000100000001000000FFFFFFFF
|
||||
FFFFFFFF06000000020000000346545021000000FFFFFFFFFFFFFFFFFFFFFFFF
|
||||
FFFFFFFF06000000000000000853657474696E67731E000000FFFFFFFFFFFFFF
|
||||
FFFFFFFFFFFFFFFFFF07000000000000000550726F787921000000FFFFFFFFFF
|
||||
FFFFFFFFFFFFFFFFFFFFFF080000000000000008506C75672D496E731D000000
|
||||
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0900000000000000044D697363}
|
||||
00000D436F64652D536E6970706574732B000000FFFFFFFFFFFFFFFFFFFFFFFF
|
||||
FFFFFFFF0B00000000000000124175746F636F6D706C65746520436865636B1C
|
||||
0000000100000001000000FFFFFFFFFFFFFFFF06000000020000000346545021
|
||||
000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF06000000000000000853657474
|
||||
696E67731E000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0700000000000000
|
||||
0550726F787921000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF080000000000
|
||||
000008506C75672D496E731D000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF09
|
||||
00000000000000044D697363}
|
||||
Items.Links = {
|
||||
0F00000000000000000000000100000002000000040000000400000005000000
|
||||
0A0000000A000000030000000600000006000000070000000800000009000000}
|
||||
1000000000000000000000000100000002000000040000000400000005000000
|
||||
0A0000000A000000030000000B00000006000000060000000700000008000000
|
||||
09000000}
|
||||
end
|
||||
object jplSettings: TJvPageList
|
||||
Left = 135
|
||||
Left = 153
|
||||
Top = 0
|
||||
Width = 353
|
||||
Width = 351
|
||||
Height = 260
|
||||
ActivePage = jspFTP
|
||||
ActivePage = jspCTSettings
|
||||
PropagateEnable = False
|
||||
Align = alClient
|
||||
OnChange = jplSettingsChange
|
||||
|
@ -69,7 +72,7 @@ object frmSettings: TfrmSettings
|
|||
object jspHighlighter: TJvStandardPage
|
||||
Left = 0
|
||||
Top = 25
|
||||
Width = 353
|
||||
Width = 351
|
||||
Height = 235
|
||||
Caption = 'Highlighter'
|
||||
object lblStyles: TLabel
|
||||
|
@ -107,7 +110,7 @@ object frmSettings: TfrmSettings
|
|||
Height = 21
|
||||
Style = csDropDownList
|
||||
Color = clWindow
|
||||
ItemHeight = 0
|
||||
ItemHeight = 13
|
||||
TabOrder = 0
|
||||
ItemIndex = -1
|
||||
OnChange = cboLanguageChange
|
||||
|
@ -352,7 +355,7 @@ object frmSettings: TfrmSettings
|
|||
object jspTools: TJvStandardPage
|
||||
Left = 0
|
||||
Top = 25
|
||||
Width = 353
|
||||
Width = 351
|
||||
Height = 235
|
||||
Caption = 'Tools'
|
||||
object bvlTools1: TBevel
|
||||
|
@ -633,7 +636,7 @@ object frmSettings: TfrmSettings
|
|||
object jspShortcuts: TJvStandardPage
|
||||
Left = 0
|
||||
Top = 25
|
||||
Width = 353
|
||||
Width = 351
|
||||
Height = 235
|
||||
Caption = 'Shortcuts'
|
||||
object shpShortcuts: TShape
|
||||
|
@ -709,7 +712,7 @@ object frmSettings: TfrmSettings
|
|||
object jspCodeSnippets: TJvStandardPage
|
||||
Left = 0
|
||||
Top = 25
|
||||
Width = 353
|
||||
Width = 351
|
||||
Height = 235
|
||||
Caption = 'Code-Snippets'
|
||||
object ftcCodeSnippets: TFlatTabControl
|
||||
|
@ -790,7 +793,7 @@ object frmSettings: TfrmSettings
|
|||
object jspCompiler: TJvStandardPage
|
||||
Left = 0
|
||||
Top = 25
|
||||
Width = 353
|
||||
Width = 351
|
||||
Height = 235
|
||||
Caption = 'Compiler'
|
||||
object lblPAWN: TLabel
|
||||
|
@ -986,7 +989,7 @@ object frmSettings: TfrmSettings
|
|||
object jspHalfLife: TJvStandardPage
|
||||
Left = 0
|
||||
Top = 25
|
||||
Width = 353
|
||||
Width = 351
|
||||
Height = 235
|
||||
Caption = 'Half-Life Directory'
|
||||
object pnlHLExecutable: TPanel
|
||||
|
@ -1072,7 +1075,7 @@ object frmSettings: TfrmSettings
|
|||
object jspFTP: TJvStandardPage
|
||||
Left = 0
|
||||
Top = 25
|
||||
Width = 353
|
||||
Width = 351
|
||||
Height = 235
|
||||
Caption = 'Settings'
|
||||
object lblFTPData: TLabel
|
||||
|
@ -1235,7 +1238,7 @@ object frmSettings: TfrmSettings
|
|||
object jspProxy: TJvStandardPage
|
||||
Left = 0
|
||||
Top = 25
|
||||
Width = 353
|
||||
Width = 351
|
||||
Height = 235
|
||||
Caption = 'Proxy'
|
||||
object pnlProxy: TPanel
|
||||
|
@ -1354,7 +1357,7 @@ object frmSettings: TfrmSettings
|
|||
object jspPlugIns: TJvStandardPage
|
||||
Left = 0
|
||||
Top = 25
|
||||
Width = 353
|
||||
Width = 351
|
||||
Height = 235
|
||||
Caption = 'Plug-Ins'
|
||||
object shpPlugins: TShape
|
||||
|
@ -1450,7 +1453,7 @@ object frmSettings: TfrmSettings
|
|||
object jspMisc: TJvStandardPage
|
||||
Left = 0
|
||||
Top = 25
|
||||
Width = 353
|
||||
Width = 351
|
||||
Height = 235
|
||||
Caption = 'Misc'
|
||||
object pnlDefaultNewPluginValues: TPanel
|
||||
|
@ -1570,7 +1573,7 @@ object frmSettings: TfrmSettings
|
|||
object jspCTSettings: TJvStandardPage
|
||||
Left = 0
|
||||
Top = 25
|
||||
Width = 353
|
||||
Width = 351
|
||||
Height = 235
|
||||
Caption = 'Settings'
|
||||
object lblCodeExplorer: TLabel
|
||||
|
@ -1695,11 +1698,134 @@ object frmSettings: TfrmSettings
|
|||
Text = '1500'
|
||||
OnExit = txtAUDisableExit
|
||||
end
|
||||
object chkAutoHideCT: TFlatCheckBox
|
||||
Left = 8
|
||||
Top = 184
|
||||
Width = 287
|
||||
Height = 17
|
||||
Caption = 'Hide calltip if function parameters have been customized'
|
||||
TabOrder = 4
|
||||
TabStop = True
|
||||
end
|
||||
end
|
||||
object jspAutocompleteCheck: TJvStandardPage
|
||||
Left = 0
|
||||
Top = 25
|
||||
Width = 351
|
||||
Height = 235
|
||||
Caption = 'Autocomplete Check'
|
||||
object shpFunctions: TShape
|
||||
Left = 6
|
||||
Top = 32
|
||||
Width = 121
|
||||
Height = 175
|
||||
Pen.Color = 8623776
|
||||
end
|
||||
object shpParams: TShape
|
||||
Left = 132
|
||||
Top = 30
|
||||
Width = 215
|
||||
Height = 177
|
||||
Pen.Color = 8623776
|
||||
end
|
||||
object lstFunctions: TListBox
|
||||
Left = 7
|
||||
Top = 33
|
||||
Width = 119
|
||||
Height = 173
|
||||
BorderStyle = bsNone
|
||||
ItemHeight = 13
|
||||
TabOrder = 1
|
||||
OnClick = lstFunctionsClick
|
||||
end
|
||||
object txtSearch: TFlatEdit
|
||||
Left = 6
|
||||
Top = 8
|
||||
Width = 121
|
||||
Height = 19
|
||||
ColorFlat = clWhite
|
||||
TabOrder = 0
|
||||
OnChange = txtSearchChange
|
||||
end
|
||||
object lvParams: TListView
|
||||
Left = 134
|
||||
Top = 31
|
||||
Width = 211
|
||||
Height = 174
|
||||
BorderStyle = bsNone
|
||||
Columns = <
|
||||
item
|
||||
Caption = 'Param'
|
||||
Width = 45
|
||||
end
|
||||
item
|
||||
Caption = 'Auto-Complete items'
|
||||
Width = 400
|
||||
end>
|
||||
ColumnClick = False
|
||||
FlatScrollBars = True
|
||||
RowSelect = True
|
||||
TabOrder = 2
|
||||
ViewStyle = vsReport
|
||||
OnDblClick = lvParamsDblClick
|
||||
end
|
||||
object cmdAddParam: TFlatButton
|
||||
Left = 132
|
||||
Top = 211
|
||||
Width = 137
|
||||
Height = 18
|
||||
ColorFocused = 16245198
|
||||
ColorDown = 16245198
|
||||
ColorHighLight = 8623776
|
||||
ColorShadow = 8623776
|
||||
Caption = 'Add parameter information'
|
||||
TabOrder = 5
|
||||
OnClick = cmdAddParamClick
|
||||
end
|
||||
object cmdRemParam: TFlatButton
|
||||
Left = 274
|
||||
Top = 211
|
||||
Width = 73
|
||||
Height = 18
|
||||
ColorFocused = 16245198
|
||||
ColorDown = 16245198
|
||||
ColorHighLight = 8623776
|
||||
ColorShadow = 8623776
|
||||
Caption = 'Delete'
|
||||
TabOrder = 6
|
||||
OnClick = cmdRemParamClick
|
||||
end
|
||||
object cmdAddFunction: TFlatButton
|
||||
Left = 6
|
||||
Top = 211
|
||||
Width = 73
|
||||
Height = 18
|
||||
ColorFocused = 16245198
|
||||
ColorDown = 16245198
|
||||
ColorHighLight = 8623776
|
||||
ColorShadow = 8623776
|
||||
Caption = 'Add function'
|
||||
TabOrder = 3
|
||||
OnClick = cmdAddFunctionClick
|
||||
end
|
||||
object cmdRemFunction: TFlatButton
|
||||
Left = 82
|
||||
Top = 211
|
||||
Width = 45
|
||||
Height = 18
|
||||
ColorFocused = 16245198
|
||||
ColorDown = 16245198
|
||||
ColorHighLight = 8623776
|
||||
ColorShadow = 8623776
|
||||
Caption = 'Delete'
|
||||
TabOrder = 4
|
||||
OnClick = cmdRemFunctionClick
|
||||
end
|
||||
end
|
||||
object lblCurrSetting: TLabel
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 353
|
||||
Width = 351
|
||||
Height = 25
|
||||
Align = alTop
|
||||
Alignment = taCenter
|
||||
|
@ -1716,7 +1842,7 @@ object frmSettings: TfrmSettings
|
|||
object pnlControls: TPanel
|
||||
Left = 0
|
||||
Top = 260
|
||||
Width = 488
|
||||
Width = 504
|
||||
Height = 37
|
||||
Align = alBottom
|
||||
BevelOuter = bvNone
|
||||
|
@ -1724,13 +1850,13 @@ object frmSettings: TfrmSettings
|
|||
object bvlControls: TBevel
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 488
|
||||
Width = 504
|
||||
Height = 3
|
||||
Align = alTop
|
||||
Shape = bsTopLine
|
||||
end
|
||||
object cmdOK: TFlatButton
|
||||
Left = 386
|
||||
Left = 416
|
||||
Top = 7
|
||||
Width = 85
|
||||
Height = 25
|
||||
|
@ -1743,7 +1869,7 @@ object frmSettings: TfrmSettings
|
|||
TabOrder = 0
|
||||
end
|
||||
object cmdCancel: TFlatButton
|
||||
Left = 296
|
||||
Left = 326
|
||||
Top = 7
|
||||
Width = 85
|
||||
Height = 25
|
||||
|
|
|
@ -195,6 +195,17 @@ type
|
|||
chkDisableCT: TFlatCheckBox;
|
||||
chkAUDisable: TFlatCheckBox;
|
||||
txtAUDisable: TFlatEdit;
|
||||
jspAutocompleteCheck: TJvStandardPage;
|
||||
shpFunctions: TShape;
|
||||
lstFunctions: TListBox;
|
||||
txtSearch: TFlatEdit;
|
||||
lvParams: TListView;
|
||||
shpParams: TShape;
|
||||
cmdAddParam: TFlatButton;
|
||||
cmdRemParam: TFlatButton;
|
||||
cmdAddFunction: TFlatButton;
|
||||
cmdRemFunction: TFlatButton;
|
||||
chkAutoHideCT: TFlatCheckBox;
|
||||
procedure jplSettingsChange(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
|
@ -258,6 +269,13 @@ type
|
|||
procedure cboFontChange(Sender: TObject);
|
||||
procedure cmdBrowseLangDirClick(Sender: TObject);
|
||||
procedure txtAUDisableExit(Sender: TObject);
|
||||
procedure txtSearchChange(Sender: TObject);
|
||||
procedure cmdRemFunctionClick(Sender: TObject);
|
||||
procedure cmdAddParamClick(Sender: TObject);
|
||||
procedure cmdRemParamClick(Sender: TObject);
|
||||
procedure lvParamsDblClick(Sender: TObject);
|
||||
procedure cmdAddFunctionClick(Sender: TObject);
|
||||
procedure lstFunctionsClick(Sender: TObject);
|
||||
public
|
||||
Foreground, Background: TColor;
|
||||
CaretFore, CaretBack: TColor;
|
||||
|
@ -276,7 +294,8 @@ var
|
|||
implementation
|
||||
|
||||
uses UnitMainTools, UnitfrmMain, UnitfrmSelectColor, UnitLanguages,
|
||||
UnitCodeSnippets, UnitfrmAutoIndent, UnitPlugins;
|
||||
UnitCodeSnippets, UnitfrmAutoIndent, UnitPlugins, UnitfrmParamEdit,
|
||||
UnitACCheck;
|
||||
|
||||
{$R *.DFM}
|
||||
|
||||
|
@ -1011,4 +1030,106 @@ begin
|
|||
txtAUDisable.Text := '1500';
|
||||
end;
|
||||
|
||||
procedure TfrmSettings.txtSearchChange(Sender: TObject);
|
||||
var i: integer;
|
||||
begin
|
||||
for i := 0 to lstFunctions.Items.Count -1 do begin
|
||||
if Pos(LowerCase(Trim(lstFunctions.Items[i])), LowerCase(Trim(txtSearch.Text))) = 1 then begin
|
||||
lstFunctions.ItemIndex := i;
|
||||
break;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmSettings.cmdRemFunctionClick(Sender: TObject);
|
||||
var i: integer;
|
||||
begin
|
||||
if lstFunctions.ItemIndex <> -1 then begin
|
||||
eACList.Delete(lstFunctions.ItemIndex);
|
||||
i := lstFunctions.ItemIndex;
|
||||
lstFunctions.DeleteSelected;
|
||||
if i <> 0 then
|
||||
lstFunctions.ItemIndex := i-1;
|
||||
lstFunctionsClick(Self);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmSettings.cmdAddParamClick(Sender: TObject);
|
||||
begin
|
||||
if lstFunctions.ItemIndex = -1 then exit;
|
||||
|
||||
frmParamEdit.txtFunction.Text := lstFunctions.Items[lstFunctions.ItemIndex];
|
||||
frmParamEdit.txtInformation.Clear;
|
||||
frmParamEdit.Caption := 'Add parameter';
|
||||
if frmParamEdit.ShowModal = mrOk then begin
|
||||
with lvParams.Items.Add do begin
|
||||
Caption := IntToStr(lvParams.Items.Count);
|
||||
SubItems.Add(StringReplace(frmParamEdit.txtInformation.Text, #13#10, '; ', [rfReplaceAll]));
|
||||
end;
|
||||
lstFunctions.Items[lstFunctions.ItemIndex] := frmParamEdit.txtFunction.Text;
|
||||
|
||||
with TACFunction(eACList.Items[lstFunctions.ItemIndex]) do begin
|
||||
Name := lstFunctions.Items[lstFunctions.ItemIndex];
|
||||
Items.Add(StringReplace(frmParamEdit.txtInformation.Text, #13#10, '; ', [rfReplaceAll]));
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmSettings.cmdRemParamClick(Sender: TObject);
|
||||
var i: integer;
|
||||
begin
|
||||
if (lstFunctions.ItemIndex <> -1) and (lvParams.Items.Count <> 0) then begin
|
||||
TACFunction(eACList.Items[lstFunctions.ItemIndex]).Items.Delete(lvParams.ItemIndex);
|
||||
lvParams.DeleteSelected;
|
||||
for i := 0 to lvParams.Items.Count -1 do
|
||||
lvParams.Items[i].Caption := IntToStr(i+1);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmSettings.lvParamsDblClick(Sender: TObject);
|
||||
begin
|
||||
frmParamEdit.Caption := 'Edit parameter information';
|
||||
if (lstFunctions.ItemIndex <> -1) and (Assigned(lvParams.Selected)) then begin
|
||||
frmParamEdit.txtInformation.Text := lvParams.Selected.SubItems[0];
|
||||
if frmParamEdit.ShowModal = mrOk then begin
|
||||
lvParams.Selected.SubItems[0] := StringReplace(frmParamEdit.txtInformation.Lines.Text, #13#10, '; ', [rfReplaceAll]);
|
||||
|
||||
with TACFunction(eACList.Items[lstFunctions.ItemIndex]) do begin
|
||||
Name := lstFunctions.Items[lstFunctions.ItemIndex];
|
||||
Items[lvParams.ItemIndex] := StringReplace(frmParamEdit.txtInformation.Text, #13#10, '; ', [rfReplaceAll]);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmSettings.cmdAddFunctionClick(Sender: TObject);
|
||||
begin
|
||||
frmParamEdit.txtFunction.Clear;
|
||||
frmParamEdit.txtInformation.Clear;
|
||||
frmParamEdit.txtInformation.Enabled := False;
|
||||
frmParamEdit.lblItems.Enabled := False;
|
||||
frmParamEdit.Caption := 'Add function';
|
||||
if frmParamEdit.ShowModal = mrOk then begin
|
||||
lstFunctions.ItemIndex := lstFunctions.Items.Add(frmParamEdit.txtFunction.Text);
|
||||
TACFunction(eACList.Add).Name := frmParamEdit.txtFunction.Text;
|
||||
lstFunctionsClick(Self);
|
||||
end;
|
||||
frmParamEdit.txtInformation.Enabled := True;
|
||||
frmParamEdit.lblItems.Enabled := True;
|
||||
end;
|
||||
|
||||
procedure TfrmSettings.lstFunctionsClick(Sender: TObject);
|
||||
var i: integer;
|
||||
begin
|
||||
lvParams.Clear;
|
||||
if lstFunctions.ItemIndex <> -1 then begin
|
||||
for i := 0 to TACFunction(eACList.Items[lstFunctions.ItemIndex]).Items.Count -1 do begin
|
||||
with lvParams.Items.Add do begin
|
||||
Caption := IntToStr(i+1);
|
||||
SubItems.Add(TACFunction(eACList.Items[lstFunctions.ItemIndex]).Items[i]);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
|
Loading…
Reference in New Issue
Block a user