the editor unindents now on pressing }. have fun!
- fixed bugs... lalala - updated debug-list - fixed comment-bug - now final edition... - updated captions - fixed configs-bug (configs weren't uploaded during FTP installations)
This commit is contained in:
parent
8f06e36d04
commit
bc66a93fcf
|
@ -115,7 +115,7 @@ AutoIncBuild=1
|
||||||
MajorVer=2
|
MajorVer=2
|
||||||
MinorVer=1
|
MinorVer=1
|
||||||
Release=0
|
Release=0
|
||||||
Build=2
|
Build=6
|
||||||
Debug=0
|
Debug=0
|
||||||
PreRelease=0
|
PreRelease=0
|
||||||
Special=0
|
Special=0
|
||||||
|
@ -126,7 +126,7 @@ CodePage=1252
|
||||||
[Version Info Keys]
|
[Version Info Keys]
|
||||||
CompanyName=AMX Mod X
|
CompanyName=AMX Mod X
|
||||||
FileDescription=Final
|
FileDescription=Final
|
||||||
FileVersion=2.1.0.2
|
FileVersion=2.1.0.6
|
||||||
InternalName=
|
InternalName=
|
||||||
LegalCopyright=
|
LegalCopyright=
|
||||||
LegalTrademarks=
|
LegalTrademarks=
|
||||||
|
|
Binary file not shown.
|
@ -1569,7 +1569,7 @@ object frmMain: TfrmMain
|
||||||
CommentStreamEnd = '*/'
|
CommentStreamEnd = '*/'
|
||||||
NumStyleBits = 5
|
NumStyleBits = 5
|
||||||
end>
|
end>
|
||||||
LanguageManager.SelectedLanguage = 'SMALL'
|
LanguageManager.SelectedLanguage = 'null'
|
||||||
FoldDrawFlags = [sciBelowIfNotExpanded]
|
FoldDrawFlags = [sciBelowIfNotExpanded]
|
||||||
KeyCommands = <
|
KeyCommands = <
|
||||||
item
|
item
|
||||||
|
|
|
@ -995,9 +995,36 @@ begin
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrmMain.acIdenterExecute(Sender: TObject);
|
procedure TfrmMain.acIdenterExecute(Sender: TObject);
|
||||||
|
function GetMatchingBrace(eString: String): Integer;
|
||||||
|
var a, b,c : integer;
|
||||||
|
begin
|
||||||
|
Result := 0;
|
||||||
|
if Length(eString) < 1 then exit;
|
||||||
|
|
||||||
|
b := 0;
|
||||||
|
c := 0;
|
||||||
|
|
||||||
|
for a := 1 to Length(eString) do begin
|
||||||
|
if eString[a] = '(' then begin
|
||||||
|
b := b +1;
|
||||||
|
c := 1;
|
||||||
|
end
|
||||||
|
else if eString[a] = ')' then begin
|
||||||
|
b := b -1;
|
||||||
|
c := 1;
|
||||||
|
end;
|
||||||
|
|
||||||
|
if (b = 0) and (c = 1) then begin
|
||||||
|
Result := a;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
var eStr: TStringList;
|
var eStr: TStringList;
|
||||||
i, k: integer;
|
i, k: integer;
|
||||||
eIdent, eTempIdent: Integer;
|
eIdent, eTempIdent: Integer;
|
||||||
|
eString: String;
|
||||||
begin
|
begin
|
||||||
Screen.Cursor := crHourGlass;
|
Screen.Cursor := crHourGlass;
|
||||||
sciEditor.Enabled := False;
|
sciEditor.Enabled := False;
|
||||||
|
@ -1007,32 +1034,48 @@ begin
|
||||||
for i := 0 to sciEditor.Lines.Count -1 do begin
|
for i := 0 to sciEditor.Lines.Count -1 do begin
|
||||||
eStr.Add(TrimLeft(sciEditor.Lines[i]));
|
eStr.Add(TrimLeft(sciEditor.Lines[i]));
|
||||||
// Remove strings and comments virtually because they could include brackets
|
// Remove strings and comments virtually because they could include brackets
|
||||||
if CountChars(eStr[i], '"') <> 0 then begin
|
Caption := Format('AMXX-Edit v2 - Preparing (%s of %s lines)', [IntToStr(i+1), IntToStr(sciEditor.Lines.Count)]);
|
||||||
Caption := Format('AMXX-Edit v2 - Preparing (%s of %s lines)', [IntToStr(i+1), IntToStr(sciEditor.Lines.Count)]);
|
while CountChars(eStr[i], '"') > 1 do
|
||||||
while CountChars(eStr[i], '"') > 1 do
|
eStr[i] := StringReplace(eStr[i], '"' + Between(eStr[i], '"', '"') + '"', '', [rfReplaceAll]);
|
||||||
eStr[i] := StringReplace(eStr[i], '"' + Between(eStr[i], '"', '"') + '"', '', [rfReplaceAll]);
|
if (Pos('/*', eStr[i]) = 1) or (Pos('*', eStr[i]) = 1) or (Pos('*/', eStr[i]) = 1) then
|
||||||
if (Pos('/*', eStr[i]) = 1) or (Pos('*', eStr[i]) = 1) or (Pos('*/', eStr[i]) = 1) then
|
eStr[i] := '';
|
||||||
eStr[i] := '';
|
if Pos('//', eStr[i]) <> 0 then
|
||||||
if Pos('//', eStr[i]) <> 0 then
|
eStr[i] := Copy(eStr[i], 1, Pos('//', eStr[i]) -2);
|
||||||
eStr[i] := Copy(eStr[i], 1, Pos('//', eStr[i]) -2);
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
for i := 0 to eStr.Count -1 do begin
|
for i := 0 to eStr.Count -1 do begin
|
||||||
if CountChars(eStr[i], '{') <> CountChars(eStr[i], '}') then
|
if CountChars(eStr[i], '{') <> CountChars(eStr[i], '}') then
|
||||||
eIdent := eIdent - CountChars(eStr[i], '}');
|
eIdent := eIdent - CountChars(eStr[i], '}');
|
||||||
|
|
||||||
sciEditor.Lines[i] := TrimLeft(sciEditor.Lines[i]);
|
sciEditor.Lines[i] := TrimLeft(sciEditor.Lines[i]);
|
||||||
|
|
||||||
for k := 1 to eIdent + eTempIdent do
|
for k := 1 to eIdent + eTempIdent do
|
||||||
sciEditor.Lines[i] := ' ' + sciEditor.Lines[i];
|
sciEditor.Lines[i] := ' ' + sciEditor.Lines[i];
|
||||||
if eTempIdent <> 0 then
|
if eTempIdent <> 0 then
|
||||||
eTempIdent := eTempIdent -1;
|
eTempIdent := eTempIdent -1;
|
||||||
|
|
||||||
|
if (Pos('if', eStr[i]) = 1) and (Pos('{', eStr[i]) = 0) and (Length(eStr[i]) > 3) then begin
|
||||||
|
eString := eStr[i];
|
||||||
|
Delete(eString, 1, 2);
|
||||||
|
if eString[1] <> Trim(eString)[1] then begin
|
||||||
|
eString := Trim(eString);
|
||||||
|
if GetMatchingBrace(eString) = Length(eString) then
|
||||||
|
eTempIdent := eTempIdent +1;
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else if (Pos('else', eStr[i]) = 1) and (Pos('{', eStr[i]) = 0) and (Length(eStr[i]) > 3) then begin
|
||||||
|
eString := eStr[i];
|
||||||
|
Delete(eString, 1, 2);
|
||||||
|
if eString[1] <> Trim(eString)[1] then begin
|
||||||
|
eString := Trim(eString);
|
||||||
|
if GetMatchingBrace(eString) = Length(eString) then
|
||||||
|
eTempIdent := eTempIdent +1;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
if CountChars(eStr[i], '{') <> CountChars(eStr[i], '}') then
|
if CountChars(eStr[i], '{') <> CountChars(eStr[i], '}') then
|
||||||
eIdent := eIdent + CountChars(eStr[i], '{');
|
eIdent := eIdent + CountChars(eStr[i], '{');
|
||||||
|
|
||||||
if (Pos('if', eStr[i]) = 1) and (Pos('{', eStr[i]) = 0) then
|
|
||||||
eTempIdent := eTempIdent +1
|
|
||||||
else if (Pos('else', eStr[i]) = 1) and (Pos('{', eStr[i]) = 0) then
|
|
||||||
eTempIdent := eTempIdent +1;
|
|
||||||
Caption := Format('AMXX-Edit v2 - Setting indents (%s of %s lines)', [IntToStr(i+1), IntToStr(sciEditor.Lines.Count)]);
|
Caption := Format('AMXX-Edit v2 - Setting indents (%s of %s lines)', [IntToStr(i+1), IntToStr(sciEditor.Lines.Count)]);
|
||||||
end;
|
end;
|
||||||
Sleep(350);
|
Sleep(350);
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user