- Upgraded Code-Inspector

- Now checks language strings
  - New design
  - Better parsing
  - Displays actions
- Added function: can't load files twice
- Updated Code-Explorer
  - now faster
  - fixed a few small bugs
  - now keeps selection
- Updated Settings-Dialog
- Fixed output bug (showed sometimes huge numbers as line numbers)
- Fixed design bug (displayed wrong plugin data on start)
- Fixed small bug in the color dialog
- Fixed small start bug (didn't show real plugin data on startup)
- Added restore function
- Fixed code-explorer bug (didn't recognize @-functions)
- Fixed highlight bug (had problems with ^" and ^ in strings)
- Fixed potential crash bug
- Fixed another highlight bug
- Fixed aother code-explorer bug...
- Added 2 settings (for auto-complete and calltips)
- Added SCM_SETTINGS_REMOVEPAGE-message
- Fixed SCM_SETTINGS_CREATEPAGE bug
This commit is contained in:
Christian Hammacher 2005-10-07 21:52:48 +00:00
parent 76b6510a27
commit c3450df360
21 changed files with 2173 additions and 1192 deletions

View File

@ -113,9 +113,9 @@ RootDir=C:\Programme\Borland\Delphi7\Bin\
IncludeVerInfo=1
AutoIncBuild=1
MajorVer=1
MinorVer=2
MinorVer=3
Release=0
Build=4
Build=9
Debug=0
PreRelease=0
Special=0
@ -126,7 +126,7 @@ CodePage=1252
[Version Info Keys]
CompanyName=AMX Mod X Dev Team
FileDescription=
FileVersion=1.2.0.4
FileVersion=1.3.0.9
InternalName=
LegalCopyright=
LegalTrademarks=

View File

@ -10,7 +10,6 @@ uses
SysUtils,
SciLexerMemo,
JvInspector,
UnitfrmMain in 'UnitfrmMain.pas' {frmMain},
UnitMainTools in 'UnitMainTools.pas',
UnitfrmSettings in 'UnitfrmSettings.pas' {frmSettings},
@ -61,6 +60,7 @@ begin
for i := 1 to ParamCount do
SendStudioMsg(SCM_LOADFILE, ParamStr(i), 0);
end;
SetForegroundWindow(FindWindow('TfrmMain', 'AMXX-Studio'));
exit;
end;
Application.Initialize;
@ -70,6 +70,9 @@ begin
Application.CreateForm(TfrmSettings, frmSettings);
Application.OnMessage := frmMain.OnMessage;
Application.OnShortCut := frmMain.OnShortCut;
frmMain.sciEditor.Lines[5] := '#define PLUGIN "' + frmSettings.txtDefaultName.Text + '"';
frmMain.sciEditor.Lines[6] := '#define VERSION "' + frmSettings.txtDefaultVersion.Text + '"';
frmMain.sciEditor.Lines[7] := '#define AUTHOR "' + frmSettings.txtDefaultAuthor.Text + '"';
frmMain.sciPropertyLoader.FileName := ExtractFilePath(ParamStr(0)) + 'config\Editor.sci';
if FileExists(frmMain.sciPropertyLoader.FileName) then
@ -129,7 +132,7 @@ begin
ActivateProjects(0, False); // Started := True is already set here
PAWNProjects.Activate(PAWNProjects.Count -1, False, False);
end;
UpdateCI;
UpdateCI(frmMain.sciEditor.GetCurrentLineNumber);
Application.CreateForm(TfrmSelectColor, frmSelectColor);
Application.CreateForm(TfrmInfo, frmInfo);

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -4,7 +4,7 @@ interface
uses
Classes, Forms, SysUtils, ComCtrls, Windows, ScintillaLanguageManager,
Dialogs, CommCtrl;
Dialogs, CommCtrl, madExcept;
type
TCodeExplorerUpdater = class(TThread)
@ -19,14 +19,16 @@ type
eVariables: TStringList;
eCode: TStringList;
eAutoComplete, eCallTips, eKeywords: String;
eAutoComplete, eCallTips, eKeywords: string;
protected
procedure Execute; override;
procedure GetCode;
procedure SetValuesPawn;
end;
function GetNode(eText: string): TTreeNode;
implementation
uses UnitfrmMain, UnitLanguages, UnitMainTools, UnitCodeUtils,
@ -85,14 +87,15 @@ begin
end;
end;
except
// GABEN
if FindWindow(nil, 'Delphi 7') <> 0 then // This is "Debug Mode"
madExcept.HandleException;
end;
end;
Sleep(1000);
end
else
Sleep(50);
until (Application.Terminated);
until not Started;
eCode.Free;
eConstants.Free;
@ -113,13 +116,12 @@ begin
eCode.Assign(frmMain.sciEditor.Lines);
end;
procedure TCodeExplorerUpdater.SetValuesPawn;
function GetNode(eText: String): TTreeNode;
function GetNode(eText: string): TTreeNode;
var i: integer;
begin
Result := nil;
for i := 0 to frmMain.trvExplorer.Items.Count -1 do begin
for i := 0 to frmMain.trvExplorer.Items.Count - 1 do begin
if (frmMain.trvExplorer.Items[i].Text = eText) then begin
if (frmMain.trvExplorer.Items[i].ImageIndex = 42) or (frmMain.trvExplorer.Items[i].ImageIndex = 43) then begin
Result := frmMain.trvExplorer.Items[i];
@ -129,196 +131,221 @@ begin
end;
end;
procedure TCodeExplorerUpdater.SetValuesPawn;
var exConstants, exDefined, exIncluded, exMethods, exDefault, exEvents,
exStocks, exNatives, exForwards, exVariables, exCVars: Boolean;
i, eSelStart, eSelLength: integer;
LineMaxSubord: integer;
eStr: TStringList;
eScrollPosX, eScrollPosY: Integer;
exStocks, exNatives, exForwards, exVariables, exCVars: Boolean;
i, eSelStart, eSelLength: integer;
LineMaxSubord: integer;
eStr: TStringList;
eScrollPosX, eScrollPosY: Integer;
eTempNode: TTreeNode;
eSelected: Integer;
begin
if Application.Terminated then exit;
if frmMain.trvExplorer.Items.Count = 0 then exit;
if Assigned(frmMain.trvExplorer.Selected) then
eSelected := frmMain.trvExplorer.Selected.AbsoluteIndex
else
eSelected := -1;
frmMain.trvExplorer.Items.BeginUpdate;
eScrollPosX := GetScrollPos(frmMain.trvExplorer.Handle, SB_HORZ);
eScrollPosY := GetScrollPos(frmMain.trvExplorer.Handle, SB_VERT);
try
eScrollPosX := GetScrollPos(frmMain.trvExplorer.Handle, SB_HORZ);
eScrollPosY := GetScrollPos(frmMain.trvExplorer.Handle, SB_VERT);
// Get Expanded-State and delete children
with GetNode('Constants') do begin
exConstants := Expanded;
DeleteChildren;
end;
with GetNode('CVars') do begin
exCVars := Expanded;
DeleteChildren;
end;
with GetNode('Defined') do begin
exDefined := Expanded;
DeleteChildren;
end;
with GetNode('Included') do begin
exIncluded := Expanded;
DeleteChildren;
end;
with GetNode('Default') do begin
exDefault := Expanded;
DeleteChildren;
end;
with GetNode('Events') do begin
exEvents := Expanded;
DeleteChildren;
end;
with GetNode('Stocks') do begin
exStocks := Expanded;
DeleteChildren;
end;
with GetNode('Methods') do begin
exMethods := Expanded;
DeleteChildren;
end;
with GetNode('Natives') do begin
exNatives := Expanded;
DeleteChildren;
end;
with GetNode('Forwards') do begin
exForwards := Expanded;
DeleteChildren;
end;
with GetNode('Variables') do begin
exVariables := Expanded;
DeleteChildren;
end;
with GetNode('Constants') do begin
exConstants := Expanded;
DeleteChildren;
end;
with GetNode('CVars') do begin
exCVars := Expanded;
DeleteChildren;
end;
with GetNode('Defined') do begin
exDefined := Expanded;
DeleteChildren;
end;
with GetNode('Included') do begin
exIncluded := Expanded;
DeleteChildren;
end;
with GetNode('Default') do begin
exDefault := Expanded;
DeleteChildren;
end;
with GetNode('Events') do begin
exEvents := Expanded;
DeleteChildren;
end;
with GetNode('Stocks') do begin
exStocks := Expanded;
DeleteChildren;
end;
with GetNode('Methods') do begin
exMethods := Expanded;
DeleteChildren;
end;
with GetNode('Natives') do begin
exNatives := Expanded;
DeleteChildren;
end;
with GetNode('Forwards') do begin
exForwards := Expanded;
DeleteChildren;
end;
with GetNode('Variables') do begin
exVariables := Expanded;
DeleteChildren;
end;
// Create new children
with frmMain.trvExplorer.Items.AddChild(GetNode('Defined'), 'CVars') do begin
ImageIndex := 42;
SelectedIndex := 42;
end;
with frmMain.trvExplorer.Items.AddChild(GetNode('Methods'), 'Default') do begin
ImageIndex := 42;
SelectedIndex := 42;
end;
with frmMain.trvExplorer.Items.AddChild(GetNode('Methods'), 'Events') do begin
ImageIndex := 42;
SelectedIndex := 42;
end;
with frmMain.trvExplorer.Items.AddChild(GetNode('Methods'), 'Stocks') do begin
ImageIndex := 42;
SelectedIndex := 42;
end;
with frmMain.trvExplorer.Items.AddChild(GetNode('Defined'), 'CVars') do begin
ImageIndex := 42;
SelectedIndex := 42;
end;
with frmMain.trvExplorer.Items.AddChild(GetNode('Methods'), 'Default') do begin
ImageIndex := 42;
SelectedIndex := 42;
end;
with frmMain.trvExplorer.Items.AddChild(GetNode('Methods'), 'Events') do begin
ImageIndex := 42;
SelectedIndex := 42;
end;
with frmMain.trvExplorer.Items.AddChild(GetNode('Methods'), 'Stocks') do begin
ImageIndex := 42;
SelectedIndex := 42;
end;
for i := 0 to eConstants.Count -1 do begin
with frmMain.trvExplorer.Items.AddChildObject(GetNode('Constants'), eConstants[i], Pointer(eConstants.Objects[i])) do begin
ImageIndex := 48;
SelectedIndex := 48;
eTempNode := GetNode('Constants');
for i := 0 to eConstants.Count - 1 do begin
with frmMain.trvExplorer.Items.AddChildObject(eTempNode, eConstants[i], Pointer(eConstants.Objects[i])) do begin
ImageIndex := 48;
SelectedIndex := 48;
end;
end;
end;
for i := 0 to eDefined.Count -1 do begin
with frmMain.trvExplorer.Items.AddChildObject(GetNode('Defined'), eDefined[i], Pointer(eDefined.Objects[i])) do begin
ImageIndex := 48;
SelectedIndex := 48;
eTempNode := GetNode('Defined');
for i := 0 to eDefined.Count - 1 do begin
with frmMain.trvExplorer.Items.AddChildObject(eTempNode, eDefined[i], Pointer(eDefined.Objects[i])) do begin
ImageIndex := 48;
SelectedIndex := 48;
end;
end;
end;
for i := 0 to eCVars.Count -1 do begin
with frmMain.trvExplorer.Items.AddChildObject(GetNode('CVars'), eCVars[i], Pointer(eCVars.Objects[i])) do begin
ImageIndex := 35;
SelectedIndex := 35;
eTempNode := GetNode('CVars');
for i := 0 to eCVars.Count - 1 do begin
with frmMain.trvExplorer.Items.AddChildObject(eTempNode, eCVars[i], Pointer(eCVars.Objects[i])) do begin
ImageIndex := 35;
SelectedIndex := 35;
end;
end;
end;
// Sort items
eIncluded.Sort;
eMethodsDefault.Sort;
eMethodsEvents.Sort;
eStocks.Sort;
eNatives.Sort;
eForwards.Sort;
eVariables.Sort;
eIncluded.Sort;
eMethodsDefault.Sort;
eMethodsEvents.Sort;
eStocks.Sort;
eNatives.Sort;
eForwards.Sort;
eVariables.Sort;
// Add items
for i := 0 to eIncluded.Count -1 do begin
with frmMain.trvExplorer.Items.AddChildObject(GetNode('Included'), eIncluded[i], Pointer(eIncluded.Objects[i])) do begin
ImageIndex := 34;
SelectedIndex := 34;
eTempNode := GetNode('Included');
for i := 0 to eIncluded.Count - 1 do begin
with frmMain.trvExplorer.Items.AddChildObject(eTempNode, eIncluded[i], Pointer(eIncluded.Objects[i])) do begin
ImageIndex := 34;
SelectedIndex := 34;
end;
end;
end;
for i := 0 to eMethodsDefault.Count -1 do begin
with frmMain.trvExplorer.Items.AddChildObject(GetNode('Default'), eMethodsDefault[i], Pointer(eMethodsDefault.Objects[i])) do begin
ImageIndex := 12;
SelectedIndex := 12;
eTempNode := GetNode('Default');
for i := 0 to eMethodsDefault.Count - 1 do begin
with frmMain.trvExplorer.Items.AddChildObject(eTempNode, eMethodsDefault[i], Pointer(eMethodsDefault.Objects[i])) do begin
ImageIndex := 12;
SelectedIndex := 12;
end;
end;
end;
for i := 0 to eMethodsEvents.Count -1 do begin
with frmMain.trvExplorer.Items.AddChildObject(GetNode('Events'), eMethodsEvents[i], Pointer(eMethodsEvents.Objects[i])) do begin
ImageIndex := 47;
SelectedIndex := 47;
eTempNode := GetNode('Events');
for i := 0 to eMethodsEvents.Count - 1 do begin
with frmMain.trvExplorer.Items.AddChildObject(eTempNode, eMethodsEvents[i], Pointer(eMethodsEvents.Objects[i])) do begin
ImageIndex := 47;
SelectedIndex := 47;
end;
end;
end;
for i := 0 to eStocks.Count -1 do begin
with frmMain.trvExplorer.Items.AddChildObject(GetNode('Stocks'), eStocks[i], Pointer(eStocks.Objects[i])) do begin
ImageIndex := 12;
SelectedIndex := 12;
eTempNode := GetNode('Stocks');
for i := 0 to eStocks.Count - 1 do begin
with frmMain.trvExplorer.Items.AddChildObject(eTempNode, eStocks[i], Pointer(eStocks.Objects[i])) do begin
ImageIndex := 12;
SelectedIndex := 12;
end;
end;
end;
for i := 0 to eNatives.Count -1 do begin
with frmMain.trvExplorer.Items.AddChildObject(GetNode('Natives'), eNatives[i], Pointer(eNatives.Objects[i])) do begin
ImageIndex := 47;
SelectedIndex := 47;
eTempNode := GetNode('Natives');
for i := 0 to eNatives.Count - 1 do begin
with frmMain.trvExplorer.Items.AddChildObject(eTempNode, eNatives[i], Pointer(eNatives.Objects[i])) do begin
ImageIndex := 47;
SelectedIndex := 47;
end;
end;
end;
for i := 0 to eForwards.Count -1 do begin
with frmMain.trvExplorer.Items.AddChildObject(GetNode('Forwards'), eForwards[i], Pointer(eForwards.Objects[i])) do begin
ImageIndex := 47;
SelectedIndex := 47;
eTempNode := GetNode('Forwards');
for i := 0 to eForwards.Count - 1 do begin
with frmMain.trvExplorer.Items.AddChildObject(eTempNode, eForwards[i], Pointer(eForwards.Objects[i])) do begin
ImageIndex := 47;
SelectedIndex := 47;
end;
end;
end;
for i := 0 to eVariables.Count -1 do begin
with frmMain.trvExplorer.Items.AddChildObject(GetNode('Variables'), eVariables[i], Pointer(eVariables.Objects[i])) do begin
ImageIndex := 35;
SelectedIndex := 35;
eTempNode := GetNode('Variables');
for i := 0 to eVariables.Count - 1 do begin
with frmMain.trvExplorer.Items.AddChildObject(eTempNode, eVariables[i], Pointer(eVariables.Objects[i])) do begin
ImageIndex := 35;
SelectedIndex := 35;
end;
end;
end;
GetNode('Constants').Expanded := exConstants;
GetNode('Defined').Expanded := exDefined;
GetNode('CVars').Expanded := exCVars;
GetNode('Included').Expanded := exIncluded;
GetNode('Methods').Expanded := exMethods;
GetNode('Default').Expanded := exDefault;
GetNode('Events').Expanded := exEvents;
GetNode('Stocks').Expanded := exStocks;
GetNode('Natives').Expanded := exNatives;
GetNode('Forwards').Expanded := exForwards;
GetNode('Variables').Expanded := exVariables;
GetNode('Constants').Expanded := exConstants;
GetNode('Defined').Expanded := exDefined;
GetNode('CVars').Expanded := exCVars;
GetNode('Included').Expanded := exIncluded;
GetNode('Methods').Expanded := exMethods;
GetNode('Default').Expanded := exDefault;
GetNode('Events').Expanded := exEvents;
GetNode('Stocks').Expanded := exStocks;
GetNode('Natives').Expanded := exNatives;
GetNode('Forwards').Expanded := exForwards;
GetNode('Variables').Expanded := exVariables;
SetScrollPos(frmMain.trvExplorer.Handle, SB_HORZ, eScrollPosX, False);
SetScrollPos(frmMain.trvExplorer.Handle, SB_VERT, eScrollPosY, False);
SetScrollPos(frmMain.trvExplorer.Handle, SB_HORZ, eScrollPosX, False);
SetScrollPos(frmMain.trvExplorer.Handle, SB_VERT, eScrollPosY, False);
if eSelected <> -1 then
frmMain.trvExplorer.Items[eSelected].Selected := True;
except
// well, yes.
end;
frmMain.trvExplorer.Items.EndUpdate;
if (not frmMain.pnlLoading.Visible) and (not frmMain.sciEditor.AutoCActive) and (not frmMain.sciEditor.CallTipActive) then begin
frmMain.sciAutoComplete.AStrings.Text := eAutoComplete;
for i := frmMain.sciAutoComplete.AStrings.Count -1 downto 0 do begin
for i := frmMain.sciAutoComplete.AStrings.Count - 1 downto 0 do begin
if Length(Trim(frmMain.sciAutoComplete.AStrings[i])) <= 1 then
frmMain.sciAutoComplete.AStrings.Delete(i);
end;
frmMain.sciCallTips.ApiStrings.Text := eCallTips;
for i := frmMain.sciCallTips.ApiStrings.Count -1 downto 0 do begin
for i := frmMain.sciCallTips.ApiStrings.Count - 1 downto 0 do begin
if Length(Trim(frmMain.sciCallTips.ApiStrings[i])) <= 1 then
frmMain.sciCallTips.ApiStrings.Delete(i);
end;
with TSciKeywords(TSciLangItem(frmMain.sciEditor.LanguageManager.LanguageList.Find('Pawn').Keywords.Items[1])) do begin
eStr := TStringList.Create;
for i := 0 to frmMain.sciEditor.Lines.Count -1 do begin
for i := 0 to frmMain.sciEditor.Lines.Count - 1 do begin
if not frmMain.sciEditor.GetFoldExpanded(i) then
eStr.Add(IntToStr(i));
end;
Keywords.Text := eKeywords;
frmMain.sciEditor.LanguageManager.Update;
for i := 0 to frmMain.sciEditor.Lines.Count -1 do begin
for i := 0 to frmMain.sciEditor.Lines.Count - 1 do begin
if eStr.IndexOf(IntToStr(i)) <> -1 then begin
LineMaxSubord := frmMain.sciEditor.GetLastChild(i, -1);
frmMain.sciEditor.SetFoldExpanded(i, False);
if LineMaxSubord > i then
frmMain.sciEditor.HideLines(i+1, LineMaxSubord);
frmMain.sciEditor.HideLines(i + 1, LineMaxSubord);
end;
end;
@ -330,3 +357,4 @@ begin
end;
end.

File diff suppressed because it is too large Load Diff

View File

@ -5,6 +5,7 @@ interface
uses SysUtils, Classes, Forms, Controls, Windows, ScintillaLanguageManager,
RichEdit, ComCtrls, JvInspector;
function PosBack(eSubStr, eStr: String): Integer;
function IsAtStart(eSubStr, eStr: String; AllowFunctions: Boolean = True): Boolean;
function GetIndents(Line: Integer = -1): String;
function GetStyleAt(ePos: Integer): TSciStyle;
@ -12,10 +13,10 @@ function LineFromPos(ePos: Integer): Integer;
function RemoveSemicolon(eStr: String): String;
procedure IndentCode;
procedure UnindentCode;
function Between(eText, eFirst, eSecond: String): String;
function Between(eText, eFirst, eSecond: String; eSecondBack: Boolean = False): String;
procedure Delay(eTime: Integer);
function CountChars(eIn: String; eChar: Char): Integer;
function RemoveStringsAndComments(eLine: String; eRemoveStrings: Boolean): String;
function RemoveStringsAndComments(eLine: String; eRemoveStrings: Boolean; eRemoveComments: Boolean): String;
function GetMatchingBrace(eString: String): Integer;
function GetColoredLine(eLine: Integer): String;
@ -26,6 +27,15 @@ implementation
uses UnitfrmMain, UnitMainTools, UnitLanguages, UnitfrmIRCPaster;
function PosBack(eSubStr, eStr: String): Integer;
begin
Result := 0;
if Pos(eSubStr, eStr) <> 0 then begin
while Pos(eSubStr, Copy(eStr, Result +1, Length(eStr))) <> 0 do
Inc(Result, 1);
end;
end;
function IsAtStart(eSubStr, eStr: String; AllowFunctions: Boolean = True): Boolean;
begin
eStr := LowerCase(Trim(StringReplace(eStr, #9, #32, [rfReplaceAll])));
@ -70,14 +80,12 @@ begin
else if eBits = 7 then
eStyleNo := eStyleNo and $7f //Strip away the indicators (1 bit)
else if eBits = 6 then
eStyleNo := eStyleNo and $3f; //Strip away the indicators (2 bits)
eStyleNo := eStyleNo and $3f; //Strip away the indicators (2 bits)
if eStyleNo <> 32 then begin
with frmMain.sciEditor.LanguageManager.LanguageList.Find(ActiveDoc.Highlighter).Styles do begin
for i := 0 to Count -1 do begin
if TSciStyle(Items[i]).StyleNumber = eStyleNo then
Result := TSciStyle(Items[i]);
end;
with frmMain.sciEditor.LanguageManager.LanguageList.Find(ActiveDoc.Highlighter).Styles do begin
for i := 0 to Count -1 do begin
if TSciStyle(Items[i]).StyleNumber = eStyleNo then
Result := TSciStyle(Items[i]);
end;
end;
end;
@ -113,14 +121,14 @@ end;
procedure IndentCode;
var eStr: TStringList;
i, k: integer;
eIdent, eTempIdent: Integer;
eIndent, eTempIndent: Integer;
eString: String;
begin
Screen.Cursor := crHourGlass;
frmMain.sciEditor.Enabled := False;
eStr := TStringList.Create;
eIdent := 0;
eTempIdent := 0;
eIndent := 0;
eTempIndent := 0;
Cancel := False;
ShowProgress(False);
@ -134,18 +142,18 @@ begin
// Remove strings and comments virtually because they could include brackets
frmMain.pbLoading.Position := i;
SetProgressStatus('Indenting Code...');
eStr[i] := RemoveStringsAndComments(eStr[i], True);
eStr[i] := RemoveStringsAndComments(eStr[i], True, True);
end;
for i := 0 to eStr.Count -1 do begin
if CountChars(eStr[i], '{') <> CountChars(eStr[i], '}') then
eIdent := eIdent - CountChars(eStr[i], '}');
eIndent := eIndent - CountChars(eStr[i], '}');
frmMain.sciEditor.Lines[i] := TrimLeft(frmMain.sciEditor.Lines[i]);
for k := 1 to eIdent + eTempIdent do
for k := 1 to eIndent + eTempIndent do
frmMain.sciEditor.Lines[i] := ' ' + frmMain.sciEditor.Lines[i];
if eTempIdent <> 0 then
eTempIdent := eTempIdent -1;
if eTempIndent <> 0 then
eTempIndent := eTempIndent -1;
if (IsAtStart('if', eStr[i], True)) and (Pos('{', eStr[i]) = 0) and (Length(eStr[i]) > 3) then begin
eString := eStr[i];
@ -153,7 +161,7 @@ begin
if (eString[1] <> Trim(eString)[1]) or (eString[1] = '(') then begin
eString := Trim(eString);
if GetMatchingBrace(eString) = Length(eString) then
eTempIdent := eTempIdent +1;
eTempIndent := eTempIndent +1;
end;
end
else if (IsAtStart('for', eStr[i], True)) and (Pos('{', eStr[i]) = 0) and (Length(eStr[i]) > 4) then begin
@ -162,16 +170,16 @@ begin
if (eString[1] <> Trim(eString)[1]) or (eString[1] = '(') then begin
eString := Trim(eString);
if GetMatchingBrace(eString) = Length(eString) then
eTempIdent := eTempIdent +1;
eTempIndent := eTempIndent +1;
end;
end
else if (IsAtStart('else', eStr[i], False)) and (Pos('{', eStr[i]) = 0) and (Length(eStr[i]) > 5) then begin
else if (IsAtStart('else', eStr[i], False)) and (Pos('{', eStr[i]) = 0) then begin
eString := eStr[i];
Delete(eString, 1, 4);
if eString[1] <> Trim(eString)[1] then begin
eString := Trim(eString);
if GetMatchingBrace(eString) = Length(eString) then
eTempIdent := eTempIdent +1;
eTempIndent := eTempIndent +1;
end;
end
else if (Pos('{', eStr[i]) = 0) and (Length(eStr[i]) > 6) then begin
@ -181,7 +189,7 @@ begin
if (eString[1] <> Trim(eString)[1]) or (eString[1] = '(') then begin
eString := Trim(eString);
if GetMatchingBrace(eString) = Length(eString) then
eTempIdent := eTempIdent +1;
eTempIndent := eTempIndent +1;
end;
end;
end;
@ -193,7 +201,7 @@ begin
if eString[1] <> Trim(eString)[1] then begin
eString := Trim(eString);
if GetMatchingBrace(eString) = Length(eString) then
eTempIdent := eTempIdent +1;
eTempIndent := eTempIndent +1;
end;
end;
end
@ -203,12 +211,12 @@ begin
if eString[1] <> Trim(eString)[1] then begin
eString := Trim(eString);
if GetMatchingBrace(eString) = Length(eString) then
eTempIdent := eTempIdent +1;
eTempIndent := eTempIndent +1;
end;
end;
if CountChars(eStr[i], '{') <> CountChars(eStr[i], '}') then
eIdent := eIdent + CountChars(eStr[i], '{');
eIndent := eIndent + CountChars(eStr[i], '{');
frmMain.pbLoading.Position := frmMain.sciEditor.Lines.Count + i -1;
SetProgressStatus('Indenting Code...');
@ -249,18 +257,20 @@ begin
Screen.Cursor := crDefault;
end;
function RemoveStringsAndComments(eLine: String; eRemoveStrings: Boolean): String;
function RemoveStringsAndComments(eLine: String; eRemoveStrings: Boolean; eRemoveComments: Boolean): String;
begin
// Remove comments
if (Pos(GetCurrLang.CommentBoxStart, eLine) = 1) or (Pos(GetCurrLang.CommentBoxMiddle, eLine) = 1) or (Pos(GetCurrLang.CommentBoxEnd, eLine) = 1) or (Pos(GetCurrLang.CommentBlock, eLine) = 1) then
eLine := '';
if Pos(GetCurrLang.CommentBlock, eLine) <> 0 then
eLine := Copy(eLine, 1, Pos('//', eLine) -2);
if (Pos(GetCurrLang.CommentStreamStart, eLine) < Pos(GetCurrLang.CommentStreamEnd, eLine)) and (Pos(GetCurrLang.CommentStreamStart, eLine) <> 0) then
eLine := StringReplace(eLine, GetCurrLang.CommentStreamStart + Between(eLine, GetCurrLang.CommentStreamStart, GetCurrLang.CommentStreamEnd) + GetCurrLang.CommentStreamEnd, '', [rfReplaceAll]); // maybe not the best method, but simple and quite easy
if eRemoveComments then begin
if (Pos(GetCurrLang.CommentBoxStart, eLine) = 1) or (Pos(GetCurrLang.CommentBoxMiddle, eLine) = 1) or (Pos(GetCurrLang.CommentBoxEnd, eLine) = 1) or (Pos(GetCurrLang.CommentBlock, eLine) = 1) then
eLine := '';
if Pos(GetCurrLang.CommentBlock, eLine) <> 0 then
eLine := Copy(eLine, 1, Pos('//', eLine) -2);
if (Pos(GetCurrLang.CommentStreamStart, eLine) < Pos(GetCurrLang.CommentStreamEnd, eLine)) and (Pos(GetCurrLang.CommentStreamStart, eLine) <> 0) then
eLine := StringReplace(eLine, GetCurrLang.CommentStreamStart + Between(eLine, GetCurrLang.CommentStreamStart, GetCurrLang.CommentStreamEnd) + GetCurrLang.CommentStreamEnd, '', [rfReplaceAll]); // maybe not the best method, but simple and quite easy
end;
// Remove quotes
if eRemoveStrings then begin
while CountChars(eLine, '"') > 1 do
while Between(eLine, '"', '"') <> '' do
eLine := StringReplace(eLine, '"' + Between(eLine, '"', '"') + '"', '', [rfReplaceAll]);
end;
@ -290,17 +300,22 @@ begin
end;
end;
function Between(eText, eFirst, eSecond: String): String;
function Between(eText, eFirst, eSecond: String; eSecondBack: Boolean = False): 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);
Result := '';
if Pos(eFirst, eText) = PosBack(eSecond, eText) then exit;
if Pos(eFirst, eText) = 0 then exit;
if PosBack(eSecond, eText) < Pos(eFirst, eText) then exit;
eTemp := eText;
Delete(eTemp, 1, Pos(eFirst, eText) + Length(eFirst) - 1);
if eSecondBack then
Delete(eTemp, PosBack(eSecond, eTemp), Length(eTemp))
else
Delete(eTemp, Pos(eSecond, eTemp), Length(eTemp));
Result := eTemp;
end;
Result := eTemp;
end;
function GetMatchingBrace(eString: String): Integer;

View File

@ -81,7 +81,12 @@ begin
if Pos(LowerCase(FileName), LowerCase(eLineStr)) = 1 then begin
Delete(eLineStr, 1, Length(FileName));
if IsNumeric(Between(eLineStr, '(', ')')) then
eLine := StrToInt(Between(eLineStr, '(', ')'));
eLine := StrToInt(Between(eLineStr, '(', ')'))
else begin
eTemp := Between(eLineStr, '(', ')');
eTemp := Copy(eTemp, 1, Pos(#32, eTemp) -1);
eLine := StrToInt(eTemp)
end;
eTemp := Between(eLineStr, ':', ':');

View File

@ -80,6 +80,9 @@ var lInvalidFile: String;
lNoCPP: String;
lInvalidChannel: String;
lResetShortcuts: String;
lSelectLanguageDir: String;
lFailedCreateBak: String;
lAskRestore: String;
procedure ResetToEnglish;
@ -163,6 +166,9 @@ begin
lNoCPP := 'Sorry, the C++ IDE is not enabled.';
lInvalidChannel := 'Invalid channel.';
lResetShortcuts := 'Warning: The shortcut reset would immediately take affect. Reset anyway?';
lSelectLanguageDir := 'Please select the directory of all dictionary files (default "%datadir%/lang"):';
lFailedCreateBak := 'Error creating file backup.';
lAskRestore := 'Do you want to restore the old file backup?';
end;
end.

View File

@ -65,7 +65,7 @@ function GetCIItemByValue(eValue: String; eParent: TJvCustomInspectorItem = nil)
function FindSettingsNode(eText: String; eParent: TTreeNode = nil): TTreeNode;
procedure LoadPlugins;
function GetAllIncludeFiles: TStringArray;
function GetAllIncludeFiles(eMask: String): TStringArray;
function GetCurrLang(FileName: String = ''): TSciLangItem;
procedure FillCodeExplorer(Lang: String);
function IEInstalled: Boolean;
@ -289,23 +289,36 @@ begin
ePConfig.Destroy;
end;
function GetAllIncludeFiles: TStringArray;
function GetAllIncludeFiles(eMask: String): TStringArray;
var eSearchRec: TSearchRec;
eStr: TStringList;
i: integer;
begin
if Between(eMask, '<', '>') <> '' then
eMask := Between(eMask, '<', '>', True)
else if Between(eMask, '"', '"') <> '' then
eMask := Between(eMask, '"', '"', True);
eStr := TStringList.Create;
if GetAMXXDir(False) <> '' then begin
if FindFirst(GetAMXXDir(False) + 'scripting\include\*.inc', faAnyFile, eSearchRec) = 0 then begin
repeat
if (eSearchRec.Name[1] <> '.') and (eSearchRec.Attr and faDirectory <> faDirectory) then
eStr.Add(eSearchRec.Name);
if (eSearchRec.Name[1] <> '.') and (eSearchRec.Attr and faDirectory <> faDirectory) then begin
if ExtractFileExt(eMask) <> '' then
eStr.Add(eSearchRec.Name)
else
eStr.Add(ChangeFileExt(eSearchRec.Name, ''));
end;
until (FindNext(eSearchRec) <> 0);
end;
if FindFirst(GetAMXXDir(False) + 'scripting\*.inc', faAnyFile, eSearchRec) = 0 then begin
repeat
if (eSearchRec.Name[1] <> '.') and (eSearchRec.Attr and faDirectory <> faDirectory) then
eStr.Add(eSearchRec.Name);
if (eSearchRec.Name[1] <> '.') and (eSearchRec.Attr and faDirectory <> faDirectory) then begin
if ExtractFileExt(eMask) <> '' then
eStr.Add(eSearchRec.Name)
else
eStr.Add(ChangeFileExt(eSearchRec.Name, ''));
end;
until (FindNext(eSearchRec) <> 0);
end;
end;
@ -313,8 +326,12 @@ begin
if (not ActiveDoc.Untitled) then begin
if FindFirst(GetAMXXDir(False) + 'scripting\include\*.inc', faAnyFile, eSearchRec) = 0 then begin
repeat
if (eSearchRec.Name[1] <> '.') and (eSearchRec.Attr and faDirectory <> faDirectory) then
eStr.Add(eSearchRec.Name);
if (eSearchRec.Name[1] <> '.') and (eSearchRec.Attr and faDirectory <> faDirectory) then begin
if ExtractFileExt(eMask) <> '' then
eStr.Add(eSearchRec.Name)
else
eStr.Add(ChangeFileExt(eSearchRec.Name, ''));
end;
until (FindNext(eSearchRec) <> 0);
end;
end;
@ -608,7 +625,9 @@ begin
frmSettings.chkAutoCloseBraces.Checked := frmMain.sciEditor.AutoCloseBraces;
frmSettings.chkAutoCloseQuotes.Checked := frmMain.sciEditor.AutoCloseQuotes;
frmSettings.chkWordWrap.Checked := frmMain.sciEditor.WordWrap = sciWrap;
frmSettings.chkAutoIndent.Checked := eConfig.ReadBool('Editor', 'Auto-Indent', True);
frmSettings.chkMakeBaks.Checked := eConfig.ReadBool('Editor', 'MakeBaks', True);
frmSettings.chkDontLoadFilesTwice.Checked := eConfig.ReadBool('Editor', 'DontLoadFilesTwice', True);
frmSettings.chkAutoIndent.Checked := eConfig.ReadBool('Editor', 'Auto-Indent', True);
frmAutoIndent.chkIndentOpeningBrace.Checked := eConfig.ReadBool('Editor', 'IndentOpeningBrace', True);
frmAutoIndent.chkUnindentPressingClosingBrace.Checked := eConfig.ReadBool('Editor', 'UnindentClosingBrace', True);
frmAutoIndent.chkUnindentLine.Checked := eConfig.ReadBool('Editor', 'UnindentEmptyLine', False);
@ -637,6 +656,10 @@ begin
frmMain.sciEditor.AutoCloseQuotes := frmSettings.chkAutoCloseQuotes.Checked;
frmMain.sciEditor.BraceHilite := frmSettings.chkHighlightBraces.Checked;
frmMain.sciEditor.ClearUndoAfterSave := frmSettings.chkClearUndoAfterSave.Checked;
frmSettings.chkDisableAC.Checked := eConfig.ReadBool('Editor', 'Disable_AC', False);
frmSettings.chkDisableCT.Checked := eConfig.ReadBool('Editor', 'Disable_CT', False);
frmMain.sciAutoComplete.Disabled := frmSettings.chkDisableAC.Checked;
frmMain.sciCallTips.Disabled := frmSettings.chkDisableCT.Checked;
{ Shortcuts }
frmSettings.lvShortcuts.Items.BeginUpdate;
try
@ -711,6 +734,7 @@ begin
eCPUSpeed := frmSettings.sldSpeed.Value
else
eCPUSpeed := 1; // otherwise the program would hang up
frmSettings.txtLangDir.Text := IncludeTrailingPathDelimiter(eConfig.ReadString('Misc', 'LangDir', ''));
frmSettings.chkShowStatusbar.Checked := eConfig.ReadBool('Misc', 'ShowStatusbar', True);
frmMain.sbStatus.Visible := frmSettings.chkShowStatusbar.Checked;
end;
@ -811,6 +835,18 @@ begin
Cancel := False;
ShowProgress(True);
if (FileExists(FFileName)) and (frmSettings.chkMakeBaks.Checked) then begin
try
CopyFile(PChar(FFileName), PChar(FFileName + '.bak'), False);
SetFileAttributes(PChar(FFileName + '.bak'), faHidden);
if ActiveDoc = Self then
frmMain.mnuRestoreBackup.Enabled := True;
except
MessageBox(Application.Handle, PChar(lFailedCreateBak), PChar(Application.Title), MB_ICONERROR);
frmMain.mnuRestoreBackup.Enabled := False;
end;
end;
try
AssignFile(F, FFilename);
Rewrite(F);
@ -958,6 +994,7 @@ begin
frmMain.sciEditor.SelLength := Document.SelLength;
frmMain.sciEditor.LineScroll(0, (0 - frmMain.sciEditor.GetFirstVisibleLine) + Document.TopLine);
end;
frmMain.mnuRestoreBackup.Enabled := (FileExists(Document.FileName + '.bak')) and (not Document.Untitled);
Screen.Cursor := crDefault;
Plugin_DocChange(Document.Index, Document.FileName, Document.Highlighter, RestoreCaret, False);
end;
@ -1069,6 +1106,16 @@ begin
exit;
end;
if frmSettings.chkDontLoadFilesTwice.Checked then begin
for i := 0 to Count -1 do begin
if AnsiSameText(TDocument(Items[i]).FileName, AFilename) then begin
Result := i;
Activate(i, True);
exit;
end;
end;
end;
if Assigned(ActiveDoc) then begin
ActiveDoc.Code := frmMain.sciEditor.Lines.Text; // saving is fast, but loading is usually slow because of code-folding...
ActiveDoc.Highlighter := frmMain.sciEditor.LanguageManager.SelectedLanguage;

View File

@ -157,6 +157,7 @@ const SCM_SHOWPROGRESS = WM_USER + $100;
SCM_PLUGIN_LOAD = WM_USER + $119;
SCM_PLUGIN_UNLOAD = WM_USER + $120;
SCM_SETTINGS_CREATEPAGE = WM_USER + $121;
SCM_SETTINGS_REMOVEPAGE = WM_USER + $194;
SCM_CODEINSPECTOR_CLEAR = WM_USER + $122;
SCM_CODEINSPECTOR_ADD = WM_USER + $123;
SCM_CODEINSPECTOR_ADDCOMBO = WM_USER + $124;

View File

@ -25,8 +25,8 @@ type TPawnParseResult = class
procedure DestroyResult;
end;
function ParseCodePawn(eCode: TStringList; FileName: String; IsRecursive: Boolean = False): TPawnParseResult;
function UpdateIncPath(eInput: String): String;
function ParseCodePawn(eCode: TStringList; FileName: string; IsRecursive: Boolean = False): TPawnParseResult;
function UpdateIncPath(eInput: string): string;
var eCPUSpeed: Integer = 1;
@ -37,7 +37,7 @@ uses UnitCodeExplorerUpdater, UnitCodeUtils, UnitfrmSettings,
var eLookedUpIncluded: TStringList;
function UpdateIncPath(eInput: String): String;
function UpdateIncPath(eInput: string): string;
begin
eInput := StringReplace(Trim(eInput), '/', '\', [rfReplaceAll]);
if FileExists(ExtractFilePath(frmSettings.txtPawnCompilerPath.Text) + eInput + '.inc') then
@ -50,15 +50,15 @@ begin
Result := '';
end;
function ParseCodePawn(eCode: TStringList; FileName: String; IsRecursive: Boolean = False): TPawnParseResult;
function ParseCodePawn(eCode: TStringList; FileName: string; IsRecursive: Boolean = False): TPawnParseResult;
var i, k: integer;
eString, eTemp, eBackup: string;
eStr, ePreEvents: TStringList;
eStartLine, eBracesOpen: Integer;
eTimeToSleep: Integer;
eAddingEnum: Integer;
eTempResult: TPawnParseResult;
eProcedureAdded: Boolean;
eString, eTemp, eBackup: string;
eStr, ePreEvents: TStringList;
eStartLine, eBracesOpen: Integer;
eTimeToSleep: Integer;
eAddingEnum: Integer;
eTempResult: TPawnParseResult;
eProcedureAdded: Boolean;
begin
Result := TPawnParseResult.Create;
if not IsRecursive then
@ -74,9 +74,9 @@ begin
for i := 0 to eCode.Count - 1 do begin
if (Application.Terminated) or (not Started) or (frmMain.pnlLoading.Visible) or (not frmMain.trvExplorer.Visible) then exit;
eString := RemoveStringsAndComments(Trim(eCode[i]), True);
eString := RemoveStringsAndComments(Trim(eCode[i]), True, True);
eBackup := Trim(eCode[i]);
eProcedureAdded := False;
Inc(eTimeToSleep, 1);
@ -86,34 +86,36 @@ begin
end;
{ Constants and Variables }
if (IsAtStart('new', eString)) and (eBracesOpen = 0) and (not IsRecursive) then begin // const or variable
Delete(eString, 1, 4);
eString := Trim(eString);
// we don't need braces so delete them...
while (CountChars(eString, '{') <> 0) and (CountChars(eString, '}') <> 0) and (Pos('{', eString) < Pos('}', eString)) do
eString := StringReplace(eString, '{' + Between(eString, '{', '}') + '}', '', [rfReplaceAll]);
while (CountChars(eString, '[') <> 0) and (CountChars(eString, ']') <> 0) and (Pos('[', eString) < Pos(']', eString)) do
eString := StringReplace(eString, '[' + Between(eString, '[', ']') + ']', '', [rfReplaceAll]);
// done? okay, split all items if there are more than one; and if not, it's okay...
eStr.Text := StringReplace(eString, ',', #13, [rfReplaceAll]);
for k := 0 to eStr.Count - 1 do begin
if (Trim(eStr[k]) <> '') and (eStr[k] <> '}') then begin
eTemp := Trim(RemoveSemicolon(eStr[k]));
if (IsAtStart('new', eString, False)) or (IsAtStart('stock', eString, False)) then begin // const or variable
if (eBracesOpen = 0) and (not IsRecursive) and (Pos('(', eString) = Pos(')', eString)) then begin
Delete(eString, 1, Pos(#32, eString));
eString := Trim(eString);
// we don't need braces so delete them...
while (CountChars(eString, '{') <> 0) and (CountChars(eString, '}') <> 0) and (Pos('{', eString) < Pos('}', eString)) do
eString := StringReplace(eString, '{' + Between(eString, '{', '}') + '}', '', [rfReplaceAll]);
while (CountChars(eString, '[') <> 0) and (CountChars(eString, ']') <> 0) and (Pos('[', eString) < Pos(']', eString)) do
eString := StringReplace(eString, '[' + Between(eString, '[', ']') + ']', '', [rfReplaceAll]);
// done? okay, split all items if there are more than one; and if not, it's okay...
eStr.Text := StringReplace(eString, ',', #13, [rfReplaceAll]);
for k := 0 to eStr.Count - 1 do begin
if (Trim(eStr[k]) <> '') and (eStr[k] <> '}') then begin
eTemp := Trim(RemoveSemicolon(eStr[k]));
if Pos(':', eTemp) <> 0 then
eTemp := Copy(eTemp, Pos(':', eTemp) + 1, Length(eTemp));
if Pos(':', eTemp) <> 0 then
eTemp := Copy(eTemp, Pos(':', eTemp) + 1, Length(eTemp));
if Pos('=', eTemp) <> 0 then begin // constant
Result.Constants.AddObject(Copy(eTemp, 1, Pos('=', eTemp) - 1), TObject(i));
Result.AutoComplete.Add(Copy(eTemp, 1, Pos('=', eTemp) - 1));
end
else begin // variable
Result.Variables.AddObject(eTemp, TObject(i));
Result.AutoComplete.Add(eTemp);
if Pos('=', eTemp) <> 0 then begin // constant
Result.Constants.AddObject(Copy(eTemp, 1, Pos('=', eTemp) - 1), TObject(i));
Result.AutoComplete.Add(Copy(eTemp, 1, Pos('=', eTemp) - 1));
end
else begin // variable
Result.Variables.AddObject(eTemp, TObject(i));
Result.AutoComplete.Add(eTemp);
end;
end;
end;
eString := RemoveStringsAndComments(Trim(eCode[i]), True, True);
end;
eString := RemoveStringsAndComments(Trim(eCode[i]), True);
end
{ Included }
else if (IsAtStart('#include', eBackup)) then begin
@ -206,77 +208,89 @@ begin
end;
{ <- Enums }
end;
if (Pos('}', eString) <> 0) and (not IsAtStart('new', Trim(eCode[eStartLine]))) then begin
if (Pos('}', eString) <> 0) then begin
{ Enums -> }
if eAddingEnum <> 0 then
eAddingEnum := 0;
{ <- Enums }
if (eBracesOpen = 0) and (Length(Trim(eCode[eStartLine])) > 1) then begin
eTemp := Trim(RemoveSemicolon(Trim(eCode[eStartLine])));
if eTemp[Length(eTemp)] = '{' then
eTemp := Trim(Copy(eTemp, 1, Length(eTemp) -1));
{ <- Enums }
if (eStartLine <> -1) then begin
if (eBracesOpen = 0) and (not IsAtStart('new', Trim(eCode[eStartLine]))) then begin
if Trim(RemoveStringsAndComments(eCode[eStartLine], True, True)) = '{' then
eStartLine := eStartLine - 1;
eTemp := Trim(RemoveSemicolon(Trim(eCode[eStartLine])));
// Analyze type
k := 0;
if IsAtStart('public', eTemp) then
k := 1
else if IsAtStart('stock', eTemp) then
k := 2
else if IsAtStart('native', eTemp) then
k := 3
else if IsAtStart('forward', eTemp) then
k := 4
else if Pos('enum', LowerCase(eTemp)) = 1 then // no method
k := 5;
k := 0;
if IsAtStart('public', eTemp) then
k := 1
else if IsAtStart('stock', eTemp) then
k := 2
else if IsAtStart('native', eTemp) then
k := 3
else if IsAtStart('forward', eTemp) then
k := 4
else if Pos('enum', LowerCase(eTemp)) = 1 then // no method
k := 5;
// Remove type
if (Pos(#32, eTemp) <> 0) and (Pos(#32, eTemp) < Pos('(', eTemp)) then
eTemp := Copy(eCode[eStartLine], Pos(#32, eCode[eStartLine]) + 1, Length(eCode[eStartLine]))
else if (Pos(#9, eTemp) <> 0) and (Pos(#9, eTemp) < Pos('(', eTemp)) then
eTemp := Copy(eTemp, Pos(#9, eTemp) + 1, Length(eTemp));
// Remove return-type
if (Pos(':', eTemp) <> 0) and (Pos(':', eTemp) < Pos('(', eTemp)) then
Delete(eTemp, 1, Pos(':', eTemp));
if Pos('operator', eTemp) = 1 then
k := 6;
if k < 5 then
Result.CallTips.Add(eTemp + '-> ' + FileName);
// Copy function-name
if Pos('(', eTemp) <> 0 then
eTemp := Copy(eTemp, 1, Pos('(', eTemp) - 1);
eTemp := Trim(eTemp);
if k < 5 then begin
Result.AutoComplete.Add(eTemp);
Result.HighlightKeywords.Add(eTemp);
end;
if eTemp <> '' then begin
case k of
0: begin
if not IsRecursive then
Result.MethodsDefault.AddObject(eTemp, TObject(eStartLine)); // Default Method
end;
1: begin
k := ePreEvents.IndexOf(eTemp);
if k <> -1 then begin
Result.Events.AddObject(eTemp, ePreEvents.Objects[k]);
ePreEvents.Delete(k);
end
else
Result.MethodsDefault.AddObject(eTemp, TObject(eStartLine));
end;
2: Result.Stocks.AddObject(eTemp, TObject(eStartLine));
3: Result.Natives.AddObject(eTemp, TObject(eStartLine));
4: Result.Forwards.AddObject(eTemp, TObject(eStartLine));
if Pos('@', eTemp) = 1 then begin
eTemp := Copy(eTemp, 2, Length(eTemp));
k := 1;
end
else begin
if (Pos(#32, eTemp) <> 0) and (Pos(#32, eTemp) < Pos('(', eTemp)) then
eTemp := Copy(eCode[eStartLine], Pos(#32, eCode[eStartLine]) + 1, Length(eCode[eStartLine]))
else if (Pos(#9, eTemp) <> 0) and (Pos(#9, eTemp) < Pos('(', eTemp)) then
eTemp := Copy(eTemp, Pos(#9, eTemp) + 1, Length(eTemp));
end;
if eTemp[Length(eTemp)] = '{' then
eTemp := Trim(Copy(eTemp, 1, Length(eTemp) - 1));
// Remove return-type
if (Pos(':', eTemp) <> 0) and (Pos(':', eTemp) < Pos('(', eTemp)) then
Delete(eTemp, 1, Pos(':', eTemp));
if Pos('operator', eTemp) = 1 then
k := 6;
if k < 5 then
Result.CallTips.Add(eTemp + '-> ' + FileName);
// Copy function-name
if Pos('(', eTemp) <> 0 then
eTemp := Copy(eTemp, 1, Pos('(', eTemp) - 1);
eTemp := Trim(eTemp);
if k < 5 then begin
Result.AutoComplete.Add(eTemp);
Result.HighlightKeywords.Add(eTemp);
end;
if eTemp <> '' then begin
case k of
0: begin
if not IsRecursive then
Result.MethodsDefault.AddObject(eTemp, TObject(eStartLine)); // Default Method
end;
1: begin
k := ePreEvents.IndexOf(eTemp);
if k <> -1 then begin
Result.Events.AddObject(eTemp, ePreEvents.Objects[k]);
ePreEvents.Delete(k);
end
else
Result.MethodsDefault.AddObject(eTemp, TObject(eStartLine));
end;
2: Result.Stocks.AddObject(eTemp, TObject(eStartLine));
3: Result.Natives.AddObject(eTemp, TObject(eStartLine));
4: Result.Forwards.AddObject(eTemp, TObject(eStartLine));
end;
end;
eStartLine := -1;
eBracesOpen := 0;
end;
eStartLine := -1;
eBracesOpen := 0;
end;
end
else if (eAddingEnum = 2) and (Pos('enum', LowerCase(eString)) <> 1) then begin
@ -301,10 +315,11 @@ begin
{ Functions (2) }
if (IsAtStart('forward', eString)) or (IsAtStart('public', eString)) or (IsAtStart('native', eString)) or (IsAtStart('stock', eString)) then begin
if (not eProcedureAdded) and (Pos('(', eString) <> 0) then begin
eTemp := Trim(RemoveSemicolon(eString));
if (not eProcedureAdded) and (Pos('(', eString) <> 0) and (Pos(')', eString) <> 0) then begin
eTemp := StringReplace(Trim(eBackup), #9, #32, [rfReplaceAll]);
eTemp := Trim(RemoveSemicolon(eTemp));
if eTemp[Length(eTemp)] = '{' then
eTemp := Trim(Copy(eTemp, 1, Length(eTemp) -1));
eTemp := Trim(Copy(eTemp, 1, Length(eTemp) - 1));
// Remove type
if (Pos(#32, eTemp) <> 0) and (Pos(#32, eTemp) < Pos('(', eTemp)) then
@ -317,11 +332,11 @@ begin
if (Pos('enum', eTemp) = Pos('operator', eTemp)) and (Pos('enum', eTemp) = 0) then
Result.CallTips.Add(eTemp + '-> ' + FileName);
// Copy function-name
if Pos('(', eTemp) <> 0 then
eTemp := Copy(eTemp, 1, Pos('(', eTemp) - 1);
eTemp := Trim(eTemp);
eTemp := Copy(eTemp, 1, Pos('(', eTemp) - 1);
eTemp := Trim(eTemp);
if (Pos('enum', eTemp) = Pos('operator', eTemp)) and (Pos('enum', eTemp) = 0) then begin
Result.AutoComplete.Add(eTemp);
@ -348,7 +363,7 @@ begin
Result.MethodsDefault.AddObject(eTemp, TObject(i));
end;
end;
end;
end;
end;
ePreEvents.Free;
eStr.Free;
@ -390,7 +405,7 @@ begin
MethodsDefault.Free;
Natives.Free;
Stocks.Free;
Variables.Free;
Variables.Free;
Free;
end;
@ -405,3 +420,4 @@ finalization
end.

View File

@ -178,10 +178,16 @@ procedure TfrmHudMsgGenerator.cmdSelectColorClick(Sender: TObject);
begin
frmSelectColor.chkDefault1.Enabled := False;
frmSelectColor.chkDefault2.Enabled := False;
frmSelectColor.chkNone1.Enabled := False;
frmSelectColor.chkNone2.Enabled := False;
ShowColorDialog(CurrColor, imgColor);
lblHudMsg.Font.Color := CurrColor;
frmSelectColor.chkDefault1.Enabled := True;
frmSelectColor.chkDefault2.Enabled := True;
frmSelectColor.chkNone1.Enabled := True;
frmSelectColor.chkNone2.Enabled := True;
end;
procedure TfrmHudMsgGenerator.txtTextChange(Sender: TObject);
@ -189,7 +195,7 @@ begin
if txtText.Text = '' then
lblHudMsg.Caption := 'Custom Hudmessage'
else
lblHudMsg.Caption := stringReplace(txtText.Text, '\n', #13, [rfReplaceAll]);
lblHudMsg.Caption := StringReplace(txtText.Text, '\n', #13, [rfReplaceAll]);
if chkXCenter.Checked then
CenterX;

Binary file not shown.

View File

@ -1,6 +1,6 @@
object frmMain: TfrmMain
Left = 284
Top = 290
Left = 257
Top = 302
Width = 888
Height = 640
Caption = 'AMXX-Studio'
@ -455,6 +455,13 @@ object frmMain: TfrmMain
OnClick = mnuPasterClick
CaptionW = 'IRC Paster'
end
object mnuRestoreBackup: TSpTBXItem
Enabled = False
ImageIndex = 46
Images = ilImages
OnClick = mnuRestoreBackupClick
CaptionW = 'Restore from backup'
end
object sepTools3: TSpTBXSeparatorItem
end
object mnuSettings: TSpTBXItem
@ -714,7 +721,7 @@ object frmMain: TfrmMain
Align = alRight
end
object splRight: TSplitter
Left = 701
Left = 669
Top = 23
Height = 472
Align = alRight
@ -722,7 +729,7 @@ object frmMain: TfrmMain
object pnlParent: TPanel
Left = 3
Top = 23
Width = 698
Width = 666
Height = 472
Align = alClient
BevelOuter = bvNone
@ -730,7 +737,7 @@ object frmMain: TfrmMain
object splOutput: TSplitter
Left = 0
Top = 387
Width = 698
Width = 666
Height = 3
Cursor = crVSplit
Align = alBottom
@ -739,7 +746,7 @@ object frmMain: TfrmMain
object sciEditor: TScintilla
Left = 0
Top = 0
Width = 698
Width = 666
Height = 387
Color = clWhite
Font.Charset = DEFAULT_CHARSET
@ -818,7 +825,7 @@ object frmMain: TfrmMain
WordChars = '_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
ControlCharSymbol = #0
BraceHilite = True
Folding = [foldFold, foldComment, foldPreprocessor, foldCommentPython, foldAtElse, foldHTML, foldHTMLPreProcessor]
Folding = [foldFold, foldCompact, foldComment, foldPreprocessor, foldCommentPython, foldAtElse, foldHTML, foldHTMLPreProcessor]
FoldMarkerType = sciMarkBox
LanguageManager.LanguageList = <
item
@ -4001,7 +4008,7 @@ object frmMain: TfrmMain
object lstOutput: TListBox
Left = 0
Top = 390
Width = 698
Width = 666
Height = 82
Align = alBottom
ItemHeight = 13
@ -4062,9 +4069,9 @@ object frmMain: TfrmMain
end
end
object tcTools: TSpTBXTabControl
Left = 704
Left = 672
Top = 23
Width = 173
Width = 205
Height = 472
Align = alRight
ActiveTabIndex = 0
@ -4086,13 +4093,13 @@ object frmMain: TfrmMain
object tsNotes: TSpTBXTabSheet
Left = 0
Top = 0
Width = 173
Width = 205
Height = 449
Caption = 'Notes'
ImageIndex = -1
TabItem = 'tiNotes'
object imgRight4: TImage
Left = 170
Left = 202
Top = 26
Width = 1
Height = 421
@ -4101,14 +4108,14 @@ object frmMain: TfrmMain
object imgBottom4: TImage
Left = 2
Top = 447
Width = 169
Width = 201
Height = 2
Align = alBottom
end
object imgTop4: TImage
Left = 2
Top = 24
Width = 169
Width = 201
Height = 2
Align = alTop
end
@ -4122,7 +4129,7 @@ object frmMain: TfrmMain
object tbxNotes: TSpTBXToolbar
Left = 2
Top = 2
Width = 169
Width = 201
Height = 22
Align = alTop
Caption = 'tbxNotes'
@ -4162,7 +4169,7 @@ object frmMain: TfrmMain
object rtfNotes: TRichEdit
Left = 3
Top = 26
Width = 167
Width = 199
Height = 421
Align = alClient
TabOrder = 1
@ -4173,7 +4180,7 @@ object frmMain: TfrmMain
object tsExplorer: TSpTBXTabSheet
Left = 0
Top = 0
Width = 173
Width = 205
Height = 449
Caption = 'Code-Tools'
ImageIndex = -1
@ -4181,7 +4188,7 @@ object frmMain: TfrmMain
object spcBottom2: TImage
Left = 0
Top = 447
Width = 173
Width = 205
Height = 2
Align = alBottom
end
@ -4193,7 +4200,7 @@ object frmMain: TfrmMain
Align = alLeft
end
object spcRight2: TImage
Left = 170
Left = 202
Top = 0
Width = 3
Height = 447
@ -4202,21 +4209,21 @@ object frmMain: TfrmMain
object pnlDock: TSpTBXMultiDock
Left = 3
Top = 0
Width = 167
Width = 199
Height = 447
Position = dpxClient
object pnlCodeExplorer: TSpTBXDockablePanel
Left = 0
Top = 0
Caption = 'Code-Explorer'
DockedWidth = 163
DockedWidth = 195
DockPos = 0
TabOrder = 0
OnVisibleChanged = pnlCodeExplorerVisibleChanged
object trvExplorer: TTreeView
Left = 0
Top = 26
Width = 163
Width = 195
Height = 186
Align = alClient
Images = ilImages
@ -4224,6 +4231,7 @@ object frmMain: TfrmMain
ReadOnly = True
SortType = stBoth
TabOrder = 1
OnClick = trvExplorerClick
OnCollapsed = trvExplorerCollapsed
OnDblClick = trvExplorerDblClick
OnExpanded = trvExplorerExpanded
@ -4247,17 +4255,17 @@ object frmMain: TfrmMain
Left = 0
Top = 216
Caption = 'Code-Inspector'
DockedWidth = 163
DockedWidth = 195
DockPos = 216
TabOrder = 1
OnVisibleChanged = pnlCodeInspectorVisibleChanged
object jviCode: TJvInspector
Left = 0
Top = 26
Width = 163
Width = 195
Height = 185
Align = alClient
Divider = 80
Divider = 110
ItemHeight = 16
Painter = JvInspectorDotNETPainter
OnItemValueChanged = jviCodeItemValueChanged
@ -7564,7 +7572,7 @@ object frmMain: TfrmMain
end
end
object JvInspectorDotNETPainter: TJvInspectorDotNETPainter
DrawNameEndEllipsis = False
DrawNameEndEllipsis = True
Left = 662
Top = 36
end

File diff suppressed because it is too large Load Diff

View File

@ -42,24 +42,26 @@ object frmSettings: TfrmSettings
000000FFFFFFFFFFFFFFFF040000000200000008436F6D70696C65722A000000
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF040000000000000011436F6D70696C65
722053657474696E67732C000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0500
0000000000001348616C662D4C696665204469726563746F727926000000FFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFF03000000000000000D436F64652D536E6970
706574731C0000000100000001000000FFFFFFFFFFFFFFFF0600000002000000
0346545021000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0600000000000000
0853657474696E67731E000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF070000
00000000000550726F787921000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF08
0000000000000008506C75672D496E731D000000FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFF0900000000000000044D697363}
0000000000001348616C662D4C696665204469726563746F7279230000000100
000001000000FFFFFFFFFFFFFFFF0A000000020000000A436F64652D546F6F6C
7321000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0A00000000000000085365
7474696E677326000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF030000000000
00000D436F64652D536E6970706574731C0000000100000001000000FFFFFFFF
FFFFFFFF06000000020000000346545021000000FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFF06000000000000000853657474696E67731E000000FFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFF07000000000000000550726F787921000000FFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFF080000000000000008506C75672D496E731D000000
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0900000000000000044D697363}
Items.Links = {
0D00000000000000000000000100000002000000040000000400000005000000
030000000600000006000000070000000800000009000000}
0F00000000000000000000000100000002000000040000000400000005000000
0A0000000A000000030000000600000006000000070000000800000009000000}
end
object jplSettings: TJvPageList
Left = 135
Top = 0
Width = 353
Height = 260
ActivePage = jspHighlighter
ActivePage = jspTools
PropagateEnable = False
Align = alClient
OnChange = jplSettingsChange
@ -355,35 +357,35 @@ object frmSettings: TfrmSettings
Caption = 'Tools'
object bvlTools1: TBevel
Left = 4
Top = 68
Top = 90
Width = 347
Height = 3
Shape = bsTopLine
end
object lblCodeFolding: TLabel
Left = 6
Top = 142
Top = 158
Width = 67
Height = 13
Caption = 'Code-Folding:'
end
object lblCaret: TLabel
Left = 6
Top = 76
Top = 96
Width = 31
Height = 13
Caption = 'Caret:'
end
object lblAutoIndent: TLabel
Left = 194
Top = 142
Top = 158
Width = 63
Height = 13
Caption = 'Auto-Indent:'
end
object chkHighlightBraces: TFlatCheckBox
Left = 6
Top = 26
Top = 22
Width = 95
Height = 17
Caption = 'Highlight braces'
@ -392,7 +394,7 @@ object frmSettings: TfrmSettings
end
object chkAutoCloseBraces: TFlatCheckBox
Left = 176
Top = 4
Top = 6
Width = 107
Height = 17
Caption = 'Auto-Close braces'
@ -401,7 +403,7 @@ object frmSettings: TfrmSettings
end
object chkAutoCloseQuotes: TFlatCheckBox
Left = 176
Top = 24
Top = 22
Width = 107
Height = 17
Caption = 'Auto-Close quotes'
@ -410,7 +412,7 @@ object frmSettings: TfrmSettings
end
object chkClearUndoAfterSave: TFlatCheckBox
Left = 6
Top = 46
Top = 38
Width = 125
Height = 17
Caption = 'Clear Undo after save'
@ -419,7 +421,7 @@ object frmSettings: TfrmSettings
end
object chkWordWrap: TFlatCheckBox
Left = 176
Top = 44
Top = 38
Width = 173
Height = 17
Caption = 'Word-Wrap (not recommended)'
@ -428,7 +430,7 @@ object frmSettings: TfrmSettings
end
object pnlCodeFolding: TPanel
Left = 6
Top = 158
Top = 174
Width = 183
Height = 49
BevelOuter = bvLowered
@ -461,7 +463,7 @@ object frmSettings: TfrmSettings
end
object pnlCaret: TPanel
Left = 6
Top = 92
Top = 112
Width = 343
Height = 43
BevelOuter = bvLowered
@ -563,7 +565,7 @@ object frmSettings: TfrmSettings
end
object pnlAutoIndent: TPanel
Left = 194
Top = 158
Top = 174
Width = 155
Height = 49
BevelOuter = bvLowered
@ -591,6 +593,42 @@ object frmSettings: TfrmSettings
OnClick = cmdAdvancedAutoIndentClick
end
end
object chkDontLoadFilesTwice: TFlatCheckBox
Left = 6
Top = 54
Width = 157
Height = 17
Caption = 'Don'#39't allow to load files twice'
TabOrder = 9
TabStop = True
end
object chkMakeBaks: TFlatCheckBox
Left = 176
Top = 54
Width = 151
Height = 17
Caption = 'Create BAK-file for each file'
TabOrder = 10
TabStop = True
end
object chkDisableAC: TFlatCheckBox
Left = 6
Top = 70
Width = 127
Height = 17
Caption = 'Disable Auto-Complete'
TabOrder = 11
TabStop = True
end
object chkDisableCT: TFlatCheckBox
Left = 176
Top = 70
Width = 97
Height = 15
Caption = 'Disable Call-Tips'
TabOrder = 12
TabStop = True
end
end
object jspShortcuts: TJvStandardPage
Left = 0
@ -1480,7 +1518,7 @@ object frmSettings: TfrmSettings
end
object chkShowStatusbar: TFlatCheckBox
Left = 8
Top = 214
Top = 146
Width = 93
Height = 17
Caption = 'Show Statusbar'
@ -1528,13 +1566,34 @@ object frmSettings: TfrmSettings
TabOrder = 2
end
end
end
object jspCTSettings: TJvStandardPage
Left = 0
Top = 25
Width = 353
Height = 235
Caption = 'Settings'
object lblCodeExplorer: TLabel
Left = 6
Top = 6
Width = 73
Height = 13
Caption = 'Code-Explorer:'
end
object lblCodeInspector: TLabel
Left = 6
Top = 94
Width = 79
Height = 13
Caption = 'Code-Inspector:'
end
object pnlPCSpeed: TPanel
Left = 8
Top = 146
Width = 337
Left = 6
Top = 22
Width = 341
Height = 67
BevelOuter = bvLowered
TabOrder = 3
TabOrder = 0
object lblCPUSpeed: TLabel
Left = 4
Top = 4
@ -1550,14 +1609,14 @@ object frmSettings: TfrmSettings
Caption = 'Slow'
end
object lblAverage: TLabel
Left = 131
Left = 133
Top = 48
Width = 41
Height = 13
Caption = 'Average'
end
object lblFast: TLabel
Left = 308
Left = 314
Top = 48
Width = 21
Height = 13
@ -1566,7 +1625,7 @@ object frmSettings: TfrmSettings
object sldSpeed: TJvxSlider
Left = 4
Top = 18
Width = 325
Width = 331
Height = 31
Increment = 2
MinValue = 1
@ -1575,6 +1634,42 @@ object frmSettings: TfrmSettings
Value = 5
end
end
object pnlCodeInspector: TPanel
Left = 6
Top = 112
Width = 341
Height = 47
BevelOuter = bvLowered
TabOrder = 1
object lblLangDir: TLabel
Left = 4
Top = 4
Width = 143
Height = 13
Caption = 'Directory of all language files:'
end
object cmdBrowseLangDir: TFlatButton
Left = 306
Top = 20
Width = 29
Height = 19
ColorFocused = 16245198
ColorDown = 16245198
ColorHighLight = 8623776
ColorShadow = 8623776
Caption = '...'
TabOrder = 0
OnClick = cmdBrowseLangDirClick
end
object txtLangDir: TFlatEdit
Left = 4
Top = 20
Width = 297
Height = 19
ColorFlat = clWhite
TabOrder = 1
end
end
end
object lblCurrSetting: TLabel
Left = 0

View File

@ -159,12 +159,6 @@ type
lblProxyHost: TLabel;
cboProxy: TFlatComboBox;
lblProxy: TLabel;
pnlPCSpeed: TPanel;
lblCPUSpeed: TLabel;
sldSpeed: TJvxSlider;
lblSlow: TLabel;
lblAverage: TLabel;
lblFast: TLabel;
jspHalfLife: TJvStandardPage;
pnlHLExecutable: TPanel;
lblHLExec: TLabel;
@ -182,6 +176,23 @@ type
cmdBrowseAMXXDir: TFlatButton;
cmdResetShortcuts: TFlatButton;
txtShortcut: TFlatEdit;
jspCTSettings: TJvStandardPage;
pnlPCSpeed: TPanel;
lblCPUSpeed: TLabel;
lblSlow: TLabel;
lblAverage: TLabel;
lblFast: TLabel;
sldSpeed: TJvxSlider;
lblCodeExplorer: TLabel;
lblCodeInspector: TLabel;
pnlCodeInspector: TPanel;
cmdBrowseLangDir: TFlatButton;
txtLangDir: TFlatEdit;
lblLangDir: TLabel;
chkDontLoadFilesTwice: TFlatCheckBox;
chkMakeBaks: TFlatCheckBox;
chkDisableAC: TFlatCheckBox;
chkDisableCT: TFlatCheckBox;
procedure jplSettingsChange(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
@ -243,6 +254,7 @@ type
procedure txtShortcutKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure cboFontChange(Sender: TObject);
procedure cmdBrowseLangDirClick(Sender: TObject);
public
Foreground, Background: TColor;
CaretFore, CaretBack: TColor;
@ -979,4 +991,11 @@ begin
TSciStyle(TSciLangItem(frmMain.sciEditor.LanguageManager.LanguageList.Items[cboLanguage.ItemIndex]).Styles.Items[lstStyles.ItemIndex]).FontName := cboFont.Text;
end;
procedure TfrmSettings.cmdBrowseLangDirClick(Sender: TObject);
var eStr: String;
begin
if SelectDirectory(lSelectLanguageDir, ExtractFilePath(txtLangDir.Text), eStr) then
txtLangDir.Text := eStr;
end;
end.

View File

@ -7,6 +7,7 @@ del .\*.~dfm
del .\*.~dpr
del .\*.map
del .\*.drc
del .\bugreport.txt
del .\plugins\*.~xfm
del .\plugins\*.~pas
del .\plugins\*.dcu