mirror of
https://github.com/moparisthebest/Simba
synced 2024-11-25 10:42:20 -05:00
Made sure you can't open files that don't exist in function list (for libraries), also added IS_INCLUDE to the parser.
This commit is contained in:
parent
9eef7669c6
commit
7c49e4b9f7
@ -94,15 +94,14 @@ begin
|
|||||||
FillThread := nil;
|
FillThread := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFunctionListFrame.FrameEndDock(Sender, Target: TObject; X, Y: Integer
|
procedure TFunctionListFrame.FrameEndDock(Sender, Target: TObject; X, Y: Integer);
|
||||||
);
|
|
||||||
begin
|
begin
|
||||||
if Target is TPanel then
|
if (Target is TPanel) then
|
||||||
begin
|
begin
|
||||||
SimbaForm.SplitterFunctionList.Visible := true;
|
SimbaForm.SplitterFunctionList.Visible := true;
|
||||||
CloseButton.Visible:= true;
|
CloseButton.Visible:= true;
|
||||||
end
|
end
|
||||||
else if Target is TCustomDockForm then
|
else if (Target is TCustomDockForm) then
|
||||||
begin
|
begin
|
||||||
TCustomDockForm(Target).Caption := 'Functionlist';
|
TCustomDockForm(Target).Caption := 'Functionlist';
|
||||||
TCustomDockForm(Target).OnClose := @DockFormOnClose;
|
TCustomDockForm(Target).OnClose := @DockFormOnClose;
|
||||||
@ -120,30 +119,25 @@ begin
|
|||||||
Node := FilterTree.Selected
|
Node := FilterTree.Selected
|
||||||
else
|
else
|
||||||
node := FunctionList.Selected;
|
node := FunctionList.Selected;
|
||||||
if node<> nil then
|
|
||||||
if node.Level > 0 then
|
if (node<> nil) and (node.Level > 0) and (node.Data <> nil) then
|
||||||
if node.Data <> nil then
|
if InCodeCompletion then
|
||||||
if InCodeCompletion then
|
begin
|
||||||
|
SimbaForm.CurrScript.SynEdit.InsertTextAtCaret( GetMethodName(PMethodInfo(node.Data)^.MethodStr,true));
|
||||||
|
SimbaForm.RefreshTab;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
MethodInfo := PMethodInfo(node.Data)^;
|
||||||
|
if (DraggingNode = node) and (MethodInfo.BeginPos > 0) then
|
||||||
|
if (MethodInfo.Filename <> nil) and ((MethodInfo.Filename = '') xor FileExistsUTF8(MethodInfo.Filename)) then
|
||||||
begin
|
begin
|
||||||
SimbaForm.CurrScript.SynEdit.InsertTextAtCaret( GetMethodName(PMethodInfo(node.Data)^.MethodStr,true));
|
if (MethodInfo.Filename <> '') then
|
||||||
SimbaForm.RefreshTab;
|
SimbaForm.LoadScriptFile(MethodInfo.Filename,true,true);
|
||||||
end
|
SimbaForm.CurrScript.SynEdit.SelStart := MethodInfo.BeginPos + 1;
|
||||||
else
|
SimbaForm.CurrScript.SynEdit.SelEnd := MethodInfo.EndPos + 1;
|
||||||
begin
|
|
||||||
MethodInfo := PMethodInfo(node.Data)^;
|
|
||||||
if DraggingNode = node then
|
|
||||||
if (MethodInfo.BeginPos > 0) then
|
|
||||||
begin;
|
|
||||||
if MethodInfo.Filename <> nil then
|
|
||||||
if MethodInfo.Filename <> '' then
|
|
||||||
begin;
|
|
||||||
// Writeln(MethodInfo.filename);
|
|
||||||
SimbaForm.LoadScriptFile(MethodInfo.Filename,true,true);
|
|
||||||
end;
|
|
||||||
SimbaForm.CurrScript.SynEdit.SelStart := MethodInfo.BeginPos + 1;
|
|
||||||
SimbaForm.CurrScript.SynEdit.SelEnd := MethodInfo.EndPos + 1;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFunctionListFrame.FunctionListDeletion(Sender: TObject;
|
procedure TFunctionListFrame.FunctionListDeletion(Sender: TObject;
|
||||||
|
@ -652,9 +652,13 @@ end;
|
|||||||
function TPSThread.RequireFile(Sender: TObject;
|
function TPSThread.RequireFile(Sender: TObject;
|
||||||
const OriginFileName: String; var FileName, OutPut: string): Boolean;
|
const OriginFileName: String; var FileName, OutPut: string): Boolean;
|
||||||
begin
|
begin
|
||||||
Result:= LoadFile(OriginFileName,FileName,OutPut);
|
Result := LoadFile(OriginFileName,FileName,OutPut);
|
||||||
|
|
||||||
if Result then
|
if Result then
|
||||||
Output := '{$DEFINE IS_INCLUDE}'+LineEnding+Output+LineEnding+'{$UNDEF IS_INCLUDE}';
|
Output :=
|
||||||
|
'{$IFNDEF IS_INCLUDE}{$DEFINE IS_INCLUDE}{$DEFINE __REMOVE_IS_INCLUDE}{$ENDIF}' + LineEnding +
|
||||||
|
Output + LineEnding +
|
||||||
|
'{$IFDEF __REMOVE_IS_INCLUDE}{$UNDEF IS_INCLUDE}{$ENDIF}';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure SIRegister_Mufasa(cl: TPSPascalCompiler);
|
procedure SIRegister_Mufasa(cl: TPSPascalCompiler);
|
||||||
|
@ -180,7 +180,15 @@ begin
|
|||||||
begin
|
begin
|
||||||
Assign(ci);
|
Assign(ci);
|
||||||
//Lexer.CloneDefinesFrom(ci.Lexer);
|
//Lexer.CloneDefinesFrom(ci.Lexer);
|
||||||
|
|
||||||
|
if (ci.Lexer.Defines.IndexOf('IS_INCLUDE') < 0) then
|
||||||
|
i := ci.Lexer.Defines.Add('IS_INCLUDE')
|
||||||
|
else
|
||||||
|
i := -1;
|
||||||
Run;
|
Run;
|
||||||
|
if (i > -1) then
|
||||||
|
ci.Lexer.Defines.Delete(i);
|
||||||
|
|
||||||
//DefinesOut := Lexer.SaveDefines; Weird bug, so moved out of the with statement
|
//DefinesOut := Lexer.SaveDefines; Weird bug, so moved out of the with statement
|
||||||
ci.Lexer.CloneDefinesFrom(Lexer);
|
ci.Lexer.CloneDefinesFrom(Lexer);
|
||||||
end;
|
end;
|
||||||
@ -274,7 +282,7 @@ end;
|
|||||||
procedure TCodeInsight.OnInclude(Sender: TmwBasePasLex);
|
procedure TCodeInsight.OnInclude(Sender: TmwBasePasLex);
|
||||||
var
|
var
|
||||||
Param: string;
|
Param: string;
|
||||||
i: Integer;
|
i, p: Integer;
|
||||||
begin
|
begin
|
||||||
Param := Sender.DirectiveParamOriginal;
|
Param := Sender.DirectiveParamOriginal;
|
||||||
{$IFDEF FPC}
|
{$IFDEF FPC}
|
||||||
@ -284,14 +292,16 @@ begin
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
if (not Sender.IsJunk) and (Param <> '') then
|
if (not Sender.IsJunk) and (Param <> '') then
|
||||||
begin
|
begin
|
||||||
if (Pos('loaddll', LowerCase(Sender.Token)) <= 3) then
|
p := Pos('loaddll', LowerCase(Sender.Token));
|
||||||
|
if (p > 0) and (p <= 3) then
|
||||||
begin
|
begin
|
||||||
if LoadLibrary(Param) then
|
if LoadLibrary(Param) then
|
||||||
Param := '';
|
Param := '';
|
||||||
end
|
end
|
||||||
else if FindInclude(Param) then
|
else if FindInclude(Param) then
|
||||||
begin
|
begin
|
||||||
if (Pos('include_once', LowerCase(Sender.Token)) <= 3) then
|
p := Pos('include_once', LowerCase(Sender.Token));
|
||||||
|
if (p > 0) and (p <= 3) then
|
||||||
for i := High(fIncludes) downto 0 do
|
for i := High(fIncludes) downto 0 do
|
||||||
if (fIncludes[i].FileName = Param) then
|
if (fIncludes[i].FileName = Param) then
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user