Fixed memory leak

Updated Modified-Event (now only one parameter [the modified text])
This commit is contained in:
Christian Hammacher 2005-09-07 22:20:28 +00:00
parent 80048eba61
commit 7c21deb0f2
10 changed files with 155 additions and 85 deletions

View File

@ -60,6 +60,7 @@ begin
if Plugin_UpdateCodeExplorer(GetCurrLang.Name, ActiveDoc.FileName, frmMain.tsMain.Items[frmMain.tsMain.ActiveTabIndex].Caption, True) then begin if Plugin_UpdateCodeExplorer(GetCurrLang.Name, ActiveDoc.FileName, frmMain.tsMain.Items[frmMain.tsMain.ActiveTabIndex].Caption, True) then begin
try try
if (frmMain.tsMain.ActiveTabIndex = 0) then begin if (frmMain.tsMain.ActiveTabIndex = 0) then begin
if Plugin_UpdateCodeExplorer(GetCurrLang.Name, ActiveDoc.FileName, frmMain.tsMain.Items[frmMain.tsMain.ActiveTabIndex].Caption, True) then begin
// analyze code // analyze code
with ParseCodePAWN(eCode, ExtractFileName(ActiveDoc.FileName)) do begin with ParseCodePAWN(eCode, ExtractFileName(ActiveDoc.FileName)) do begin
eConstants.Assign(Constants); eConstants.Assign(Constants);
@ -82,8 +83,9 @@ begin
// apply changes // apply changes
Synchronize(SetValuesPAWN); Synchronize(SetValuesPAWN);
end; end;
end;
except except
// GABEM // GABEN
end; end;
end; end;
Sleep(1000); Sleep(1000);

View File

@ -28,21 +28,22 @@ type
TStringWrapper = class(TObject) TStringWrapper = class(TObject)
public public
Value: string; Value: string;
constructor Create(const AValue: string); constructor Create(const AValue: string); reintroduce;
end; end;
TSTLWrapper = class(TObject) TSTLWrapper = class(TObject)
public public
STL: TSelectionTextList; STL: TSelectionTextList;
Value: String; Value: String;
constructor Create(const ASTL: TSelectionTextList; const AValue: String); constructor Create(const ASTL: TSelectionTextList; const AValue: String); reintroduce;
destructor Destroy; reintroduce;
end; end;
function AddField(eName, eCategory, eValue: String): TJvCustomInspectorItem; function AddField(eName, eCategory, eValue: String): TJvCustomInspectorItem;
function AddCombo(eName, eCategory, eValue: String; eValues: array of string): TJvCustomInspectorItem; function AddCombo(eName, eCategory, eValue: String; eValues: array of string): TJvCustomInspectorItem;
procedure UpdateCI; procedure UpdateCI;
procedure UpdateCI_PAWN; procedure UpdateCI_Pawn;
var eFormatSettings: String; var eFormatSettings: String;
eAllIncluded: TStringArray; eAllIncluded: TStringArray;
@ -211,12 +212,12 @@ begin
if not Plugin_UpdateCodeInspector(GetCurrLang.Name, ActiveDoc.FileName, frmMain.tsMain.Items[frmMain.tsMain.ActiveTabIndex].Caption, True) then exit; if not Plugin_UpdateCodeInspector(GetCurrLang.Name, ActiveDoc.FileName, frmMain.tsMain.Items[frmMain.tsMain.ActiveTabIndex].Caption, True) then exit;
if GetCurrLang.Name = 'Pawn' then begin if GetCurrLang.Name = 'Pawn' then begin
UpdateCI_PAWN; UpdateCI_Pawn;
Plugin_UpdateCodeInspector(GetCurrLang.Name, ActiveDoc.FileName, frmMain.tsMain.Items[frmMain.tsMain.ActiveTabIndex].Caption, False); Plugin_UpdateCodeInspector(GetCurrLang.Name, ActiveDoc.FileName, frmMain.tsMain.Items[frmMain.tsMain.ActiveTabIndex].Caption, False);
end; end;
end; end;
procedure UpdateCI_PAWN; procedure UpdateCI_Pawn;
procedure HideBracesAndStrings(var eStr: String); procedure HideBracesAndStrings(var eStr: String);
begin begin
while Between(eStr, '{', '}') <> '' do begin while Between(eStr, '{', '}') <> '' do begin
@ -393,8 +394,9 @@ begin
else else
AddField('', 'No information available.', ''); AddField('', 'No information available.', '');
end; end;
eStr.Free;
eBraceTexts.Free; eBraceTexts.Free;
SetLength(eAllIncluded, 0);
eStr.Free;
end; end;
{ TSTLWrapper } { TSTLWrapper }
@ -404,6 +406,13 @@ constructor TSTLWrapper.Create(const ASTL: TSelectionTextList;
begin begin
STL := ASTL; STL := ASTL;
Value := AValue; Value := AValue;
inherited Create;
end;
destructor TSTLWrapper.Destroy;
begin
STL.Free;
inherited;
end; end;
initialization initialization

View File

@ -25,7 +25,7 @@ begin
Result := StringReplace(Result, #2, #13#10, [rfReplaceAll]); Result := StringReplace(Result, #2, #13#10, [rfReplaceAll]);
end; end;
end; end;
eFile.Free; eFile.Destroy;
end; end;
function GetSnippetList(Lang: String): TStringList; function GetSnippetList(Lang: String): TStringList;
@ -48,7 +48,7 @@ begin
eFile.LoadFromFile(ExtractFilePath(ParamStr(0)) + 'config\' + Lang + '.csl'); // ... .csl = CodeSnippetList eFile.LoadFromFile(ExtractFilePath(ParamStr(0)) + 'config\' + Lang + '.csl'); // ... .csl = CodeSnippetList
eFile.Add(Ident + #1 + Code); eFile.Add(Ident + #1 + Code);
eFile.SaveToFile(ExtractFilePath(ParamStr(0)) + 'config\' + Lang + '.csl'); // ... .csl = CodeSnippetList eFile.SaveToFile(ExtractFilePath(ParamStr(0)) + 'config\' + Lang + '.csl'); // ... .csl = CodeSnippetList
eFile.Free; eFile.Destroy;
end; end;
procedure DelSnippet(Lang, Ident: String); procedure DelSnippet(Lang, Ident: String);
@ -62,7 +62,7 @@ begin
eFile.Delete(i); eFile.Delete(i);
end; end;
eFile.SaveToFile(ExtractFilePath(ParamStr(0)) + 'config\' + Lang + '.csl'); // ... .csl = CodeSnippetList eFile.SaveToFile(ExtractFilePath(ParamStr(0)) + 'config\' + Lang + '.csl'); // ... .csl = CodeSnippetList
eFile.Free; eFile.Destroy;
end; end;
procedure SetSnippet(Lang, Ident, Code: String); procedure SetSnippet(Lang, Ident, Code: String);
@ -78,7 +78,7 @@ begin
if Pos(Ident + #1, eFile[i]) = 1 then begin if Pos(Ident + #1, eFile[i]) = 1 then begin
eFile[i] := Ident + #1 + Code; eFile[i] := Ident + #1 + Code;
eFile.SaveToFile(ExtractFilePath(ParamStr(0)) + 'config\' + Lang + '.csl'); // ... .csl = CodeSnippetList eFile.SaveToFile(ExtractFilePath(ParamStr(0)) + 'config\' + Lang + '.csl'); // ... .csl = CodeSnippetList
eFile.Free; eFile.Destroy;
exit; exit;
end; end;
@ -86,7 +86,7 @@ begin
{ else... } { else... }
eFile.Add(Ident + #1 + Code); eFile.Add(Ident + #1 + Code);
eFile.SaveToFile(ExtractFilePath(ParamStr(0)) + 'config\' + Lang + '.csl'); // ... .csl = CodeSnippetList eFile.SaveToFile(ExtractFilePath(ParamStr(0)) + 'config\' + Lang + '.csl'); // ... .csl = CodeSnippetList
eFile.Free; eFile.Destroy;
end; end;
end. end.

View File

@ -93,7 +93,7 @@ function GetAllDirs: TStringList;
procedure SetProxySettings; procedure SetProxySettings;
function TryConnect: Integer; function TryConnect: Integer;
var PAWNProjects: TDocCollection; var PawnProjects: TDocCollection;
CPPProjects: TDocCollection; CPPProjects: TDocCollection;
OtherProjects: TDocCollection; OtherProjects: TDocCollection;
@ -113,7 +113,7 @@ uses UnitfrmMain, UnitfrmSettings, UnitLanguages, UnitfrmSelectColor,
function GetCat: String; function GetCat: String;
begin begin
if frmMain.mnuPAWN.Checked then if frmMain.mnuPawn.Checked then
Result := 'Pawn' Result := 'Pawn'
else if frmMain.mnuCPP.Checked then else if frmMain.mnuCPP.Checked then
Result := 'C++' Result := 'C++'
@ -286,7 +286,7 @@ begin
end; end;
until FindNext(eRec) <> 0; until FindNext(eRec) <> 0;
end; end;
ePConfig.Free; ePConfig.Destroy;
end; end;
function GetAllIncludeFiles: TStringArray; function GetAllIncludeFiles: TStringArray;
@ -323,7 +323,7 @@ begin
for i := 0 to eStr.Count -1 do for i := 0 to eStr.Count -1 do
Result[i] := eStr[i]; Result[i] := eStr[i];
eStr.Free; eStr.Destroy;
end; end;
@ -407,8 +407,8 @@ begin
if Started then begin if Started then begin
if ListenServer then if ListenServer then
Result := frmSettings.txtAMXXDir.Text Result := frmSettings.txtAMXXDir.Text
else if Length(frmSettings.txtPAWNCompilerPath.Text) > 8 then else if Length(frmSettings.txtPawnCompilerPath.Text) > 8 then
Result := IncludeTrailingPathDelimiter(Copy(ExtractFilePath(frmSettings.txtPAWNCompilerPath.Text), 1, Length(ExtractFilePath(frmSettings.txtPAWNCompilerPath.Text)) - 10)) Result := IncludeTrailingPathDelimiter(Copy(ExtractFilePath(frmSettings.txtPawnCompilerPath.Text), 1, Length(ExtractFilePath(frmSettings.txtPawnCompilerPath.Text)) - 10))
else else
Result := ''; Result := '';
end end
@ -420,7 +420,7 @@ function CloseDocument(eDocument: TDocument; SaveActiveDoc: Boolean = False): Bo
var Collection: TDocCollection; var Collection: TDocCollection;
begin begin
case frmMain.tsMain.ActiveTabIndex of case frmMain.tsMain.ActiveTabIndex of
0: Collection := PAWNProjects; 0: Collection := PawnProjects;
1: Collection := CPPProjects; 1: Collection := CPPProjects;
else Collection := OtherProjects; else Collection := OtherProjects;
end; end;
@ -463,7 +463,7 @@ procedure LoadCodeSnippets(Lang: String);
var i: integer; var i: integer;
CSItem: TSpTBXItem; CSItem: TSpTBXItem;
begin begin
for i := frmMain.tbxCodeSnippets.Items.Count -1 downto 5 do for i := frmMain.tbxCodeSnippets.Items.Count -1 downto 6 do
frmMain.tbxCodeSnippets.Items.Delete(i); frmMain.tbxCodeSnippets.Items.Delete(i);
with GetSnippetList(Lang) do begin with GetSnippetList(Lang) do begin
@ -542,7 +542,7 @@ begin
// no save here, it saves when another tab is being activated... // no save here, it saves when another tab is being activated...
case Index of case Index of
0: Collection := PAWNProjects; // PAWN 0: Collection := PawnProjects; // Pawn
1: Collection := CPPProjects; // C++ 1: Collection := CPPProjects; // C++
else Collection := OtherProjects; // Other else Collection := OtherProjects; // Other
end; end;
@ -640,7 +640,7 @@ begin
frmSettings.lvShortcuts.Clear; frmSettings.lvShortcuts.Clear;
for i := 0 to frmMain.sciEditor.KeyCommands.Count - 1 do begin for i := 0 to frmMain.sciEditor.KeyCommands.Count - 1 do begin
KeyCommand := frmMain.sciEditor.KeyCommands.Items[i] as TSciKeyCommand; KeyCommand := frmMain.sciEditor.KeyCommands.Items[i] as TSciKeyCommand;
Ident:= 'Unknown'; Ident := 'Unknown';
IntToIdent(KeyCommand.Command, Ident, Sci_KeyboardCommandMap); IntToIdent(KeyCommand.Command, Ident, Sci_KeyboardCommandMap);
if Ident <> 'No Command' then begin // Important for Control Chars, the user mustn't change the values for it... if Ident <> 'No Command' then begin // Important for Control Chars, the user mustn't change the values for it...
Item := frmSettings.lvShortcuts.Items.Add; Item := frmSettings.lvShortcuts.Items.Add;
@ -676,11 +676,11 @@ begin
SetProxySettings; SetProxySettings;
{ Compiler } { Compiler }
frmSettings.txtPAWNCompilerPath.Text := eConfig.ReadString('Pawn-Compiler', 'Path', ''); frmSettings.txtPawnCompilerPath.Text := eConfig.ReadString('Pawn-Compiler', 'Path', '');
frmSettings.txtPAWNArgs.Text := eConfig.ReadString('Pawn-Compiler', 'Args', ''); frmSettings.txtPawnArgs.Text := eConfig.ReadString('Pawn-Compiler', 'Args', '');
frmSettings.txtPAWNOutput.Text := IncludeTrailingPathDelimiter(eConfig.ReadString('Pawn-Compiler', 'DefaultOutput', '')); frmSettings.txtPawnOutput.Text := IncludeTrailingPathDelimiter(eConfig.ReadString('Pawn-Compiler', 'DefaultOutput', ''));
if frmSettings.txtPAWNOutput.Text = '\' then if frmSettings.txtPawnOutput.Text = '\' then
frmSettings.txtPAWNOutput.Text := ''; frmSettings.txtPawnOutput.Text := '';
frmSettings.txtCPPCompilerPath.Text := eConfig.ReadString('CPP-Compiler', 'Path', ''); frmSettings.txtCPPCompilerPath.Text := eConfig.ReadString('CPP-Compiler', 'Path', '');
frmSettings.txtCPPCompilerArguments.Text := eConfig.ReadString('CPP-Compiler', 'Args', ''); frmSettings.txtCPPCompilerArguments.Text := eConfig.ReadString('CPP-Compiler', 'Args', '');
frmSettings.txtCPPOutput.Text := IncludeTrailingPathDelimiter(eConfig.ReadString('CPP-Compiler', 'DefaultOutput', '')); frmSettings.txtCPPOutput.Text := IncludeTrailingPathDelimiter(eConfig.ReadString('CPP-Compiler', 'DefaultOutput', ''));
@ -715,7 +715,7 @@ end;
procedure SelectLanguage(Lang: String); procedure SelectLanguage(Lang: String);
begin begin
frmMain.sciEditor.LanguageManager.SelectedLanguage := Lang; frmMain.sciEditor.LanguageManager.SelectedLanguage := Lang;
frmMain.mnuHPAWN.Checked := Lang = 'Pawn'; frmMain.mnuHPawn.Checked := Lang = 'Pawn';
frmMain.mnuHCPP.Checked := Lang = 'C++'; frmMain.mnuHCPP.Checked := Lang = 'C++';
frmMain.mnuHHTML.Checked := Lang = 'HTML'; frmMain.mnuHHTML.Checked := Lang = 'HTML';
frmMain.mnuHSQL.Checked := Lang = 'SQL'; frmMain.mnuHSQL.Checked := Lang = 'SQL';
@ -790,8 +790,8 @@ end;
destructor TDocument.Destroy; destructor TDocument.Destroy;
begin begin
FCode.Destroy;
inherited Destroy; inherited Destroy;
FCode.Free;
end; end;
function TDocument.Save: Boolean; function TDocument.Save: Boolean;
@ -872,7 +872,7 @@ begin
sLines.Add(sNotes); sLines.Add(sNotes);
end; end;
sLines.SaveToFile(ExtractFilePath(ParamStr(0)) + 'config\Notes.dat'); sLines.SaveToFile(ExtractFilePath(ParamStr(0)) + 'config\Notes.dat');
sLines.Free; sLines.Destroy;
end; end;
FModified := False; FModified := False;
@ -1021,7 +1021,7 @@ var Collection: TDocCollection;
i: integer; i: integer;
begin begin
case frmMain.tsMain.ActiveTabIndex of case frmMain.tsMain.ActiveTabIndex of
0: Collection := PAWNProjects; 0: Collection := PawnProjects;
1: Collection := CPPProjects; 1: Collection := CPPProjects;
else Collection := OtherProjects; else Collection := OtherProjects;
end; end;
@ -1152,7 +1152,7 @@ begin
end; end;
end; end;
eLines.Free; eLines.Destroy;
end; end;
end; end;
Screen.Cursor := crDefault; Screen.Cursor := crDefault;
@ -1275,15 +1275,15 @@ end;
initialization initialization
PAWNProjects := TDocCollection.Create('Pawn'); PawnProjects := TDocCollection.Create('Pawn');
CPPProjects := TDocCollection.Create('C++'); CPPProjects := TDocCollection.Create('C++');
OtherProjects := TDocCollection.Create('null'); OtherProjects := TDocCollection.Create('null');
CurrProjects := 0; CurrProjects := 0;
ActiveDoc := PAWNProjects.ActiveDocument; ActiveDoc := PawnProjects.ActiveDocument;
finalization finalization
PAWNProjects.Free; PawnProjects.Free;
CPPProjects.Free; CPPProjects.Free;
OtherProjects.Free; OtherProjects.Free;

View File

@ -18,7 +18,7 @@ type TCodeSnippetClick = function (pTitle, pCategory: PChar; pCode: PChar): Inte
TCustomItemClick = function (pCaption: PChar): Integer; cdecl; TCustomItemClick = function (pCaption: PChar): Integer; cdecl;
TThemeChanged = function (pTheme: PChar): Integer; cdecl; TThemeChanged = function (pTheme: PChar): Integer; cdecl;
TModified = function (pModifiedText: PChar; pText: PChar): Integer; cdecl; TModified = function (pModifiedText: PChar): Integer; cdecl;
TKeyPress = function (pKey: PChar): Integer; cdecl; TKeyPress = function (pKey: PChar): Integer; cdecl;
TEditorClick = function: Integer; cdecl; TEditorClick = function: Integer; cdecl;
TUpdateSel = function (pSelStart, pSelLength, pFirstVisibleLine: Integer): Integer; cdecl; TUpdateSel = function (pSelStart, pSelLength, pFirstVisibleLine: Integer): Integer; cdecl;
@ -89,7 +89,7 @@ function Plugin_ShowHelp(HelpType: Integer): Boolean;
function Plugin_CustomItemClick(Caption: String): Boolean; function Plugin_CustomItemClick(Caption: String): Boolean;
function Plugin_ThemeChange(Theme: String): Boolean; function Plugin_ThemeChange(Theme: String): Boolean;
function Plugin_Modified(Modified, Text: PChar): Boolean; function Plugin_Modified(ModifiedStr: PAnsiChar): Boolean;
function Plugin_KeyPress(Key: Char): Boolean; function Plugin_KeyPress(Key: Char): Boolean;
function Plugin_EditorClick(DoubleClick: Boolean): Boolean; function Plugin_EditorClick(DoubleClick: Boolean): Boolean;
function Plugin_UpdateSel(SelStart, SelLength, FirstVisibleLine: Integer): Boolean; function Plugin_UpdateSel(SelStart, SelLength, FirstVisibleLine: Integer): Boolean;
@ -382,6 +382,8 @@ begin
end; end;
end; end;
end; end;
SetLength(Handles, 0);
Handles := nil;
end; end;
function Plugin_FileLoad(Filename: String; Loading: Boolean): Boolean; function Plugin_FileLoad(Filename: String; Loading: Boolean): Boolean;
@ -408,6 +410,8 @@ begin
end; end;
end; end;
end; end;
SetLength(Handles, 0);
Handles := nil;
end; end;
function Plugin_FileSave(Filename: String; Saving: Boolean): Boolean; function Plugin_FileSave(Filename: String; Saving: Boolean): Boolean;
@ -434,6 +438,8 @@ begin
end; end;
end; end;
end; end;
SetLength(Handles, 0);
Handles := nil;
end; end;
function Plugin_DocChange(Index: Integer; Filename, Highlighter: String; RestoreCaret, Changing: Boolean): Boolean; function Plugin_DocChange(Index: Integer; Filename, Highlighter: String; RestoreCaret, Changing: Boolean): Boolean;
@ -460,6 +466,8 @@ begin
end; end;
end; end;
end; end;
SetLength(Handles, 0);
Handles := nil;
end; end;
function Plugin_ProjectsChange(OldIndex, NewIndex: Integer; Changing: Boolean): Boolean; function Plugin_ProjectsChange(OldIndex, NewIndex: Integer; Changing: Boolean): Boolean;
@ -486,6 +494,8 @@ begin
end; end;
end; end;
end; end;
SetLength(Handles, 0);
Handles := nil;
end; end;
function Plugin_CreateNewFile(Item: Byte; Creating: Boolean): Boolean; function Plugin_CreateNewFile(Item: Byte; Creating: Boolean): Boolean;
@ -512,6 +522,8 @@ begin
end; end;
end; end;
end; end;
SetLength(Handles, 0);
Handles := nil;
end; end;
function Plugin_Search(SearchList, Selected: String; Displaying, SearchAgain: Boolean; CaseSensivity, WholeWords, SearchFromCaret, SelectedOnly, RegEx, Forward: Boolean): Boolean; function Plugin_Search(SearchList, Selected: String; Displaying, SearchAgain: Boolean; CaseSensivity, WholeWords, SearchFromCaret, SelectedOnly, RegEx, Forward: Boolean): Boolean;
@ -540,6 +552,8 @@ begin
end; end;
end; end;
end; end;
SetLength(Handles, 0);
Handles := nil;
end; end;
function Plugin_SearchReplace(Expression, Replace, ExpList, RepList: String; CaseSensivity, WholeWords, SearchFromCaret, SelectedOnly, RegEx, Forward: Boolean): Boolean; function Plugin_SearchReplace(Expression, Replace, ExpList, RepList: String; CaseSensivity, WholeWords, SearchFromCaret, SelectedOnly, RegEx, Forward: Boolean): Boolean;
@ -563,6 +577,8 @@ begin
end; end;
end; end;
end; end;
SetLength(Handles, 0);
Handles := nil;
end; end;
function Plugin_VisibleControlChange(Control: Integer; Show: Boolean): Boolean; function Plugin_VisibleControlChange(Control: Integer; Show: Boolean): Boolean;
@ -586,6 +602,8 @@ begin
end; end;
end; end;
end; end;
SetLength(Handles, 0);
Handles := nil;
end; end;
function Plugin_Compile(CompileType: Integer; Lang, Filename: String; Compiling: Boolean): Boolean; function Plugin_Compile(CompileType: Integer; Lang, Filename: String; Compiling: Boolean): Boolean;
@ -612,6 +630,8 @@ begin
end; end;
end; end;
end; end;
SetLength(Handles, 0);
Handles := nil;
end; end;
function Plugin_ShowHelp(HelpType: Integer): Boolean; function Plugin_ShowHelp(HelpType: Integer): Boolean;
@ -635,6 +655,8 @@ begin
end; end;
end; end;
end; end;
SetLength(Handles, 0);
Handles := nil;
end; end;
function Plugin_CustomItemClick(Caption: String): Boolean; function Plugin_CustomItemClick(Caption: String): Boolean;
@ -658,6 +680,8 @@ begin
end; end;
end; end;
end; end;
SetLength(Handles, 0);
Handles := nil;
end; end;
function Plugin_ThemeChange(Theme: String): Boolean; function Plugin_ThemeChange(Theme: String): Boolean;
@ -681,9 +705,11 @@ begin
end; end;
end; end;
end; end;
SetLength(Handles, 0);
Handles := nil;
end; end;
function Plugin_Modified(Modified, Text: PChar): Boolean; function Plugin_Modified(ModifiedStr: PAnsiChar): Boolean;
var Func: TModified; var Func: TModified;
i: integer; i: integer;
Handles: TIntegerArray; Handles: TIntegerArray;
@ -695,7 +721,7 @@ begin
@Func := GetProcAddress(Handles[i], 'Modified'); @Func := GetProcAddress(Handles[i], 'Modified');
if @Func <> nil then begin if @Func <> nil then begin
case Func(Modified, Text) of case Func(ModifiedStr) of
PLUGIN_HANDLED: Result := False; PLUGIN_HANDLED: Result := False;
PLUGIN_STOP: begin PLUGIN_STOP: begin
Result := False; Result := False;
@ -704,6 +730,8 @@ begin
end; end;
end; end;
end; end;
SetLength(Handles, 0);
Handles := nil;
end; end;
function Plugin_KeyPress(Key: Char): Boolean; function Plugin_KeyPress(Key: Char): Boolean;
@ -727,6 +755,8 @@ begin
end; end;
end; end;
end; end;
SetLength(Handles, 0);
Handles := nil;
end; end;
function Plugin_EditorClick(DoubleClick: Boolean): Boolean; function Plugin_EditorClick(DoubleClick: Boolean): Boolean;
@ -753,6 +783,8 @@ begin
end; end;
end; end;
end; end;
SetLength(Handles, 0);
Handles := nil;
end; end;
function Plugin_UpdateSel(SelStart, SelLength, FirstVisibleLine: Integer): Boolean; function Plugin_UpdateSel(SelStart, SelLength, FirstVisibleLine: Integer): Boolean;
@ -776,6 +808,8 @@ begin
end; end;
end; end;
end; end;
SetLength(Handles, 0);
Handles := nil;
end; end;
function Plugin_CallTipShow(List: PChar): Boolean; function Plugin_CallTipShow(List: PChar): Boolean;
@ -799,6 +833,8 @@ begin
end; end;
end; end;
end; end;
SetLength(Handles, 0);
Handles := nil;
end; end;
function Plugin_CallTipClick(Position: Integer): Boolean; function Plugin_CallTipClick(Position: Integer): Boolean;
@ -822,6 +858,8 @@ begin
end; end;
end; end;
end; end;
SetLength(Handles, 0);
Handles := nil;
end; end;
function Plugin_AutoCompleteShow(List: PChar): Boolean; function Plugin_AutoCompleteShow(List: PChar): Boolean;
@ -845,6 +883,8 @@ begin
end; end;
end; end;
end; end;
SetLength(Handles, 0);
Handles := nil;
end; end;
function Plugin_AutoCompleteSelect(Text: PChar): Boolean; function Plugin_AutoCompleteSelect(Text: PChar): Boolean;
@ -868,6 +908,8 @@ begin
end; end;
end; end;
end; end;
SetLength(Handles, 0);
Handles := nil;
end; end;
function Plugin_AppMsg(hwnd: HWND; Message: Integer; wParam, lParam: Integer; time: Integer; pt: TPoint): Boolean; function Plugin_AppMsg(hwnd: HWND; Message: Integer; wParam, lParam: Integer; time: Integer; pt: TPoint): Boolean;
@ -891,6 +933,8 @@ begin
end; end;
end; end;
end; end;
SetLength(Handles, 0);
Handles := nil;
end; end;
function Plugin_UpdateCodeExplorer(Lang, Filename, CurrProjects: String; Updating: Boolean): Boolean; function Plugin_UpdateCodeExplorer(Lang, Filename, CurrProjects: String; Updating: Boolean): Boolean;
@ -917,6 +961,8 @@ begin
end; end;
end; end;
end; end;
SetLength(Handles, 0);
Handles := nil;
end; end;
function Plugin_UpdateCodeInspector(Lang, Filename, CurrProjects: String; Updating: Boolean): Boolean; function Plugin_UpdateCodeInspector(Lang, Filename, CurrProjects: String; Updating: Boolean): Boolean;
@ -943,6 +989,8 @@ begin
end; end;
end; end;
end; end;
SetLength(Handles, 0);
Handles := nil;
end; end;
function Plugin_OutputDblClick(ItemIndex: Integer): Boolean; function Plugin_OutputDblClick(ItemIndex: Integer): Boolean;
@ -966,6 +1014,8 @@ begin
end; end;
end; end;
end; end;
SetLength(Handles, 0);
Handles := nil;
end; end;
function Plugin_OutputPopup(ItemIndex: Integer): Boolean; function Plugin_OutputPopup(ItemIndex: Integer): Boolean;
@ -989,6 +1039,8 @@ begin
end; end;
end; end;
end; end;
SetLength(Handles, 0);
Handles := nil;
end; end;
end. end.

View File

@ -113,9 +113,7 @@ begin
eString := RemoveStringsAndComments(Trim(eCode[i]), True); eString := RemoveStringsAndComments(Trim(eCode[i]), True);
end end
{ Included } { Included }
else if (IsAtStart('#include', Trim(eCode[i]), False)) then begin else if (IsAtStart('#include', eString)) then begin
eString := Trim(eCode[i]);
if Between(eString, '<', '>') <> '' then begin if Between(eString, '<', '>') <> '' then begin
eString := Between(eString, '<', '>'); eString := Between(eString, '<', '>');
if ExtractFileExt(eString) <> '' then if ExtractFileExt(eString) <> '' then
@ -141,6 +139,7 @@ begin
if (eString <> '') and (FileExists(eTemp)) then begin if (eString <> '') and (FileExists(eTemp)) then begin
// Load code and parse // Load code and parse
eTempResult := nil;
try try
eStr.LoadFromFile(eTemp); eStr.LoadFromFile(eTemp);
if Application.Terminated then exit; if Application.Terminated then exit;
@ -150,11 +149,11 @@ begin
Result.CallTips.AddStrings(eTempResult.CallTips); Result.CallTips.AddStrings(eTempResult.CallTips);
Result.HighlightKeywords.AddStrings(eTempResult.HighlightKeywords); Result.HighlightKeywords.AddStrings(eTempResult.HighlightKeywords);
// free // free
eTempResult.DestroyResult;
eTempResult := nil;
except except
// mmmm.. burger // mmmm.. burger
end; end;
if Assigned(eTempResult) then
eTempResult.DestroyResult;
// wait // wait
Sleep(20); Sleep(20);
end; end;
@ -166,8 +165,8 @@ begin
Result.CVars.AddObject(Between(eString, '"', '"'), TObject(i)); Result.CVars.AddObject(Between(eString, '"', '"'), TObject(i));
end end
{ Defined } { Defined }
else if (IsAtStart('#define', Trim(eCode[i]))) then begin else if (IsAtStart('#define', eString)) then begin
eString := Copy(Trim(eCode[i]), 8, Length(Trim(eCode[i]))); eString := Copy(eString, 8, Length(eString));
eString := Trim(eString); eString := Trim(eString);
Result.CallTips.Add(eString + '-> ' + FileName); Result.CallTips.Add(eString + '-> ' + FileName);
if Pos(#32, eString) <> 0 then if Pos(#32, eString) <> 0 then
@ -179,8 +178,8 @@ begin
end end
{ Events (Part 1) } { Events (Part 1) }
else if (IsAtStart('register_event(', eString)) and (not IsRecursive) then begin else if (IsAtStart('register_event(', eString)) and (not IsRecursive) then begin
if CountChars(Trim(eCode[i]), '"') >= 4 then begin if CountChars(eString, '"') >= 4 then begin
eTemp := StringReplace(Trim(eCode[i]), '"' + Between(Trim(eCode[i]), '"', '"') + '"', '', []); eTemp := StringReplace(eString, '"' + Between(eString, '"', '"') + '"', '', []);
ePreEvents.Add(Between(eString, '"', '"')); ePreEvents.Add(Between(eString, '"', '"'));
end; end;
end; end;
@ -403,4 +402,3 @@ finalization
end. end.

View File

@ -1,6 +1,6 @@
object frmMain: TfrmMain object frmMain: TfrmMain
Left = 237 Left = 224
Top = 236 Top = 293
Width = 888 Width = 888
Height = 640 Height = 640
Caption = 'AMXX-Studio' Caption = 'AMXX-Studio'
@ -579,7 +579,7 @@ object frmMain: TfrmMain
object mnuCodeSnippets: TSpTBXRightAlignSpacerItem object mnuCodeSnippets: TSpTBXRightAlignSpacerItem
CaptionW = 'Code-Snippets:' CaptionW = 'Code-Snippets:'
end end
object mnuPAWN: TSpTBXItem object mnuPawn: TSpTBXItem
AutoCheck = True AutoCheck = True
Checked = True Checked = True
OnClick = OnCodeSnippetSelect OnClick = OnCodeSnippetSelect

View File

@ -114,7 +114,7 @@ type
mnuTCompile: TSpTBXItem; mnuTCompile: TSpTBXItem;
tbxCodeSnippets: TSpTBXToolbar; tbxCodeSnippets: TSpTBXToolbar;
mnuCodeSnippets: TSpTBXRightAlignSpacerItem; mnuCodeSnippets: TSpTBXRightAlignSpacerItem;
mnuPAWN: TSpTBXItem; mnuPawn: TSpTBXItem;
mnuCPP: TSpTBXItem; mnuCPP: TSpTBXItem;
sepCodeSnippets: TSpTBXSeparatorItem; sepCodeSnippets: TSpTBXSeparatorItem;
tbxEdit: TSpTBXToolbar; tbxEdit: TSpTBXToolbar;
@ -639,6 +639,15 @@ begin
CopyFile(PChar(ExtractFilePath(ParamStr(0)) + 'config\Other.bak'), PChar(ExtractFilePath(ParamStr(0)) + 'config\Other.csl'), False); CopyFile(PChar(ExtractFilePath(ParamStr(0)) + 'config\Other.bak'), PChar(ExtractFilePath(ParamStr(0)) + 'config\Other.csl'), False);
end; end;
if mnuPawn.Checked then
LoadCodeSnippets('Pawn')
else if mnuCPP.Checked then
LoadCodeSnippets('C++')
else if mnuHTML.Checked then
LoadCodeSnippets('HTML')
else
LoadCodeSnippets('Other');
DeleteFile(ExtractFilePath(ParamStr(0)) + 'config\PAWN.bak'); DeleteFile(ExtractFilePath(ParamStr(0)) + 'config\PAWN.bak');
DeleteFile(ExtractFilePath(ParamStr(0)) + 'config\C++.bak'); DeleteFile(ExtractFilePath(ParamStr(0)) + 'config\C++.bak');
DeleteFile(ExtractFilePath(ParamStr(0)) + 'config\Other.bak'); DeleteFile(ExtractFilePath(ParamStr(0)) + 'config\Other.bak');
@ -1544,7 +1553,7 @@ begin
frmClose.trvFiles.Items.AddChild(eRoot, IntToStr(i +1) + '. ' + ExtractFileName(TDocument(PAWNProjects.Items[i]).FileName)); frmClose.trvFiles.Items.AddChild(eRoot, IntToStr(i +1) + '. ' + ExtractFileName(TDocument(PAWNProjects.Items[i]).FileName));
end; end;
if eRoot.Count = 0 then if eRoot.Count = 0 then
eRoot.Free eRoot.Destroy
else else
eRoot.Expand(False); eRoot.Expand(False);
{ C++ Projects } { C++ Projects }
@ -1554,7 +1563,7 @@ begin
frmClose.trvFiles.Items.AddChild(eRoot, IntToStr(i +1) + '. ' + ExtractFileName(TDocument(CPPProjects.Items[i]).FileName)); frmClose.trvFiles.Items.AddChild(eRoot, IntToStr(i +1) + '. ' + ExtractFileName(TDocument(CPPProjects.Items[i]).FileName));
end; end;
if eRoot.Count = 0 then if eRoot.Count = 0 then
eRoot.Free eRoot.Destroy
else else
eRoot.Expand(False); eRoot.Expand(False);
{ Other Projects } { Other Projects }
@ -1564,7 +1573,7 @@ begin
frmClose.trvFiles.Items.AddChild(eRoot, IntToStr(i +1) + '. ' + ExtractFileName(TDocument(OtherProjects.Items[i]).FileName)); frmClose.trvFiles.Items.AddChild(eRoot, IntToStr(i +1) + '. ' + ExtractFileName(TDocument(OtherProjects.Items[i]).FileName));
end; end;
if eRoot.Count = 0 then if eRoot.Count = 0 then
eRoot.Free eRoot.Destroy
else else
eRoot.Expand(False); eRoot.Expand(False);
@ -1689,7 +1698,7 @@ begin
end; end;
end; end;
eSavedFiles.SaveToFile(ExtractFilePath(ParamStr(0)) + 'config\Cache.cfg'); eSavedFiles.SaveToFile(ExtractFilePath(ParamStr(0)) + 'config\Cache.cfg');
eSavedFiles.Free; eSavedFiles.Destroy;
end; end;
procedure TfrmMain.trvExplorerDblClick(Sender: TObject); procedure TfrmMain.trvExplorerDblClick(Sender: TObject);
@ -1947,7 +1956,7 @@ begin
MessageBox(Handle, PChar(lSuccessfulRegistered), PChar(Application.Title), MB_ICONINFORMATION); MessageBox(Handle, PChar(lSuccessfulRegistered), PChar(Application.Title), MB_ICONINFORMATION);
end; end;
eStr.Free; eStr.Destroy;
end; end;
end; end;
@ -2015,7 +2024,7 @@ begin
Screen.Cursor := crDefault; Screen.Cursor := crDefault;
MessageBox(Handle, PChar(lSuccessfulRegistered), PChar(Application.Title), MB_ICONINFORMATION); MessageBox(Handle, PChar(lSuccessfulRegistered), PChar(Application.Title), MB_ICONINFORMATION);
end; end;
eStr.Free; eStr.Destroy;
try try
IdFTP.TransferType := ftASCII; IdFTP.TransferType := ftASCII;
@ -2058,7 +2067,7 @@ begin
for i := 0 to eStr.Count -1 do for i := 0 to eStr.Count -1 do
eStr[i] := '"' + eStr[i] + '\n" +'; eStr[i] := '"' + eStr[i] + '\n" +';
frmMOTDGen.txtMOTD.Lines.Assign(eStr); frmMOTDGen.txtMOTD.Lines.Assign(eStr);
eStr.Free; eStr.Destroy;
frmMOTDGen.ShowModal; frmMOTDGen.ShowModal;
end end
@ -2242,7 +2251,7 @@ procedure TfrmMain.sciEditorModified(Sender: TObject; const position,
foldLevelNow, foldLevelPrev: Integer); foldLevelNow, foldLevelPrev: Integer);
begin begin
if Started then if Started then
Plugin_Modified(text, sciEditor.Lines.GetText); Plugin_Modified(text);
end; end;
procedure TfrmMain.sciEditorDblClick(Sender: TObject); procedure TfrmMain.sciEditorDblClick(Sender: TObject);
@ -2426,7 +2435,7 @@ begin
Msg.Result := ilImages.Add(eBMP, nil) Msg.Result := ilImages.Add(eBMP, nil)
else else
Msg.Result := ilImages.AddMasked(eBMP, eIntData); Msg.Result := ilImages.AddMasked(eBMP, eIntData);
eBMP.Free; eBMP.Destroy;
end; end;
SCM_MENU_ADDITEM: begin SCM_MENU_ADDITEM: begin
if Pos('->', eData) <> 0 then begin if Pos('->', eData) <> 0 then begin
@ -2538,7 +2547,7 @@ begin
AddField(eStr[0], eStr[1], eStr[2]) AddField(eStr[0], eStr[1], eStr[2])
else else
Msg.Result := 0; Msg.Result := 0;
eStr.Free; eStr.Destroy;
end; end;
SCM_CODEINSPECTOR_ADDCOMBO: begin SCM_CODEINSPECTOR_ADDCOMBO: begin
eStr := TStringList.Create; eStr := TStringList.Create;
@ -2551,7 +2560,7 @@ begin
end end
else else
Msg.Result := 0; Msg.Result := 0;
eStr.Free; eStr.Destroy;
end; end;
SCM_CODEINSPECTOR_SETVALUE: begin SCM_CODEINSPECTOR_SETVALUE: begin
eStr := TStringList.Create; eStr := TStringList.Create;

View File

@ -59,7 +59,7 @@ object frmSettings: TfrmSettings
Top = 0 Top = 0
Width = 353 Width = 353
Height = 260 Height = 260
ActivePage = jspShortcuts ActivePage = jspHighlighter
PropagateEnable = False PropagateEnable = False
Align = alClient Align = alClient
OnChange = jplSettingsChange OnChange = jplSettingsChange

View File

@ -765,7 +765,7 @@ begin
end; end;
if trvDirectories.Items.Count <> 0 then if trvDirectories.Items.Count <> 0 then
trvDirectories.Items.Item[0].Expand(True); trvDirectories.Items.Item[0].Expand(True);
eStr.Free; eStr.Destroy;
// ... scan for directories ... // ... scan for directories ...
with GetAllDirs do begin with GetAllDirs do begin