1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-12-23 07:48:50 -05:00

Merge branch 'master' of ssh://villavu.com:54367/simba

This commit is contained in:
Merlijn Wajer 2010-03-31 00:25:01 +02:00
commit 9302dc7de7
3 changed files with 136 additions and 88 deletions

View File

@ -32,6 +32,7 @@ uses
v_ideCodeInsight, v_ideCodeParser, CastaliaPasLexTypes, CastaliaSimplePasPar, SynEditHighlighter;
const
ecCodeCompletion = ecUserFirst;
ecCodeHints = ecUserFirst + 1;
type
TScriptState = (ss_None,ss_Running,ss_Paused,ss_Stopping);
{
@ -256,13 +257,17 @@ var
mp: TCodeInsight;
ms: TMemoryStream;
ItemList, InsertList: TStringList;
sp, ep: Integer;
sp, ep,bcc,cc,bck: Integer;
p: TPoint;
s, Filter: string;
Attri: TSynHighlighterAttributes;
d: TDeclaration;
dd: TDeclaration;
begin
if (Command = ecCodeCompletion) and ((not SynEdit.GetHighlighterAttriAtRowCol(SynEdit.CaretXY, s, Attri)) or (Attri.Name = 'Identifier')) then
if ((not SynEdit.GetHighlighterAttriAtRowCol(SynEdit.CaretXY, s, Attri)) or (Attri.Name = 'Identifier')) then
begin
if (Command = ecCodeCompletion) then
begin;
{form1.FunctionListShown(True);
with form1.frmFunctionList do
if editSearchList.CanFocus then
@ -337,8 +342,60 @@ begin
ItemList.Free;
InsertList.Free;
end;
end;
end else
if command = ecCodeHints then
begin
mp := TCodeInsight.Create;
mp.OnMessage := @form1.OnCCMessage;
mp.OnFindInclude := @form1.OnCCFindInclude;
ms := TMemoryStream.Create;
synedit.Lines.SaveToStream(ms);
try
Synedit.GetWordBoundsAtRowCol(Synedit.CaretXY, sp, ep);
mp.Run(ms, nil, Synedit.SelStart + (ep - Synedit.CaretX) - 1);
//mp.Position := Synedit.SelStart + (ep - Synedit.CaretX) - 1;
bcc := 1;
bck := 0;
cc := 0;
s := mp.GetExpressionAtPos(bcc, bck, cc, True);
if (s <> '') then
Delete(s, Length(s), 1);
d := mp.FindVarBase(s);
dd := nil;
while (d <> nil) and (d <> dd) and (d.Owner <> nil) and (not ((d is TciProcedureDeclaration) or (d.Owner is TciProcedureDeclaration))) do
begin
dd := d;
d := d.Owner.Items.GetFirstItemOfClass(TciTypeKind);
if (d <> nil) then
begin
d := TciTypeKind(d).GetRealType;
if (d is TciReturnType) then
d := d.Owner;
end;
if (d <> nil) and (d.Owner <> nil) and (not ((d is TciProcedureDeclaration) or (d.Owner is TciProcedureDeclaration))) then
d := mp.FindVarBase(d.CleanText)
else
Break;
end;
if (d <> nil) and (d <> dd) and (d.Owner <> nil) and ((d is TciProcedureDeclaration) or (d.Owner is TciProcedureDeclaration)) then
begin
if (not (d is TciProcedureDeclaration)) and (d.Owner is TciProcedureDeclaration) then
d := d.Owner;
if (TciProcedureDeclaration(d).SynParams <> '') then
formWriteln(TciProcedureDeclaration(d).SynParams)
else
FormWriteln('<no parameters expected>');
end;
finally
FreeAndNil(ms);
FreeAndNil(mp);
end;
end;
end;
if Form1.CodeCompletionForm.Visible then
case Command of
ecDeleteChar, ecDeleteWord, ecDeleteEOL:
@ -522,6 +579,7 @@ begin
MarkCaret.IgnoreKeywords := true;
end;
AddKey(SynEdit,ecCodeCompletion,VK_SPACE,[ssCtrl]);
AddKey(SynEdit,ecCodeHints,VK_SPACE,[ssCtrl,ssShift]);
// TSynPasSyn(SynEdit.Highlighter).NestedComments:= false; Does not work :(
end;

View File

@ -40,13 +40,13 @@ uses
colourpicker, framescript, windowselector, lcltype, ActnList,
SynExportHTML, SynEditKeyCmds, SynEditHighlighter,
SynEditMarkupHighAll, LMessages, Buttons,mmisc,
stringutil,mufasatypesutil,mufasabase,
stringutil,mufasatypesutil,mufasabase, v_ideCodeParser,
about, framefunctionlist, ocr, updateform, simbasettings, psextension, virtualextension,
extensionmanager, settingssandbox, v_ideCodeInsight, CastaliaPasLexTypes,
CastaliaSimplePasPar, v_AutoCompleteForm, PSDump;
const
SimbaVersion = 590;
SimbaVersion = 600;
type
@ -2213,17 +2213,8 @@ begin
end;
procedure TForm1.ButtonTrayClick(Sender: TObject);
{var
ms : TMemoryStream;
fs : TFileStream;}
begin
{
fs := TFileStream.Create('c:\remake\fonts.tar.bz2',fmOpenRead);
ms := DecompressBZip2(fs);
fs.free;
UnTar(ms,'c:\remake\fonttest\',true);
ms.free;}
Form1.Hide;
self.hide;
end;
procedure TForm1.PageControl1Changing(Sender: TObject; var AllowChange: Boolean

View File

@ -864,17 +864,16 @@ begin
a := GetParamDeclarations;
for i := Low(a) to High(a) do
begin
if (fItems[i] is TciConstParameter) then
if (a[i] is TciConstParameter) then
s := 'const '
else if (fItems[i] is TciOutParameter) then
else if (a[i] is TciOutParameter) then
s := 'out '
else if (fItems[i] is TciInParameter) then
else if (a[i] is TciInParameter) then
s := 'in '
else if (fItems[i] is TciVarParameter) then
else if (a[i] is TciVarParameter) then
s := 'var '
else
s := '';
d := a[i].Items.GetFirstItemOfClass(TciParameterType);
if (d <> nil) then
t := ': ' + d.ShortText