mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 17:19:22 +02:00
identifier completion: basically working, still hidden
git-svn-id: trunk@1984 -
This commit is contained in:
parent
8e7c84ff70
commit
8349a42be9
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -198,6 +198,7 @@ ide/projectdefs.pas svneol=native#text/pascal
|
||||
ide/projectopts.lrs svneol=native#text/pascal
|
||||
ide/projectopts.pp svneol=native#text/pascal
|
||||
ide/runparamsopts.pas svneol=native#text/pascal
|
||||
ide/sourceeditprocs.pas svneol=native#text/pascal
|
||||
ide/splash.lrs svneol=native#text/pascal
|
||||
ide/splash.pp svneol=native#text/pascal
|
||||
ide/sysvaruseroverridedlg.pas svneol=native#text/pascal
|
||||
|
106
ide/sourceeditprocs.pas
Normal file
106
ide/sourceeditprocs.pas
Normal file
@ -0,0 +1,106 @@
|
||||
{
|
||||
/***************************************************************************
|
||||
SourceEditProcs.pas
|
||||
-------------------
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* This source is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This code is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* General Public License for more details. *
|
||||
* *
|
||||
* A copy of the GNU General Public License is available on the World *
|
||||
* Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
|
||||
* obtain it by writing to the Free Software Foundation, *
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
Support functions and types for the source editor.
|
||||
|
||||
}
|
||||
unit SourceEditProcs;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, BasicCodeTools, CodeTree, CodeToolManager,
|
||||
IdentCompletionTool, GraphType, Graphics, EditorOptions,
|
||||
SynEdit, SynCompletion;
|
||||
|
||||
type
|
||||
TCompletionType = (
|
||||
ctNone, ctWordCompletion, ctTemplateCompletion, ctIdentCompletion);
|
||||
|
||||
procedure PaintCompletionItem(const AKey: string; ACanvas: TCanvas;
|
||||
X, Y: integer; ItemSelected: boolean; Index: integer;
|
||||
aCompletion : TSynCompletion; CurrentCompletionType: TCompletionType);
|
||||
|
||||
implementation
|
||||
|
||||
procedure PaintCompletionItem(const AKey: string; ACanvas: TCanvas;
|
||||
X, Y: integer; ItemSelected: boolean; Index: integer;
|
||||
aCompletion : TSynCompletion; CurrentCompletionType: TCompletionType);
|
||||
var
|
||||
i: Integer;
|
||||
s: string;
|
||||
IdentItem: TIdentifierListItem;
|
||||
begin
|
||||
with ACanvas do begin
|
||||
if CurrentCompletionType=ctIdentCompletion then begin
|
||||
// draw
|
||||
IdentItem:=CodeToolBoss.IdentifierList.FilteredItems[Index];
|
||||
if IdentItem=nil then begin
|
||||
TextOut(x+1, y, 'PaintCompletionItem: BUG in codetools');
|
||||
exit;
|
||||
end;
|
||||
s:=GetIdentifier(IdentItem.Identifier);
|
||||
TextOut(x+1,y,s);
|
||||
|
||||
end else begin
|
||||
// parse AKey for text and style
|
||||
i := 1;
|
||||
while i <= Length(AKey) do begin
|
||||
case AKey[i] of
|
||||
#1, #2:
|
||||
begin
|
||||
// set color
|
||||
Font.Color := (Ord(AKey[i + 3]) shl 8 + Ord(AKey[i + 2])) shl 8
|
||||
+ Ord(AKey[i + 1]);
|
||||
inc(i, 4);
|
||||
end;
|
||||
#3:
|
||||
begin
|
||||
// set style
|
||||
case AKey[i + 1] of
|
||||
'B': Font.Style := Font.Style + [fsBold];
|
||||
'b': Font.Style := Font.Style - [fsBold];
|
||||
'U': Font.Style := Font.Style + [fsUnderline];
|
||||
'u': Font.Style := Font.Style - [fsUnderline];
|
||||
'I': Font.Style := Font.Style + [fsItalic];
|
||||
'i': Font.Style := Font.Style - [fsItalic];
|
||||
end;
|
||||
inc(i, 2);
|
||||
end;
|
||||
else
|
||||
TextOut(x+1, y, AKey[i]);
|
||||
x := x + TextWidth(AKey[i]);
|
||||
inc(i);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -2682,7 +2682,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
{$Else}
|
||||
Writeln('WARNING: [TgtkObject.SetColor] NOT Support under Win32 GTK')
|
||||
Writeln('WARNING: [TgtkObject.SetColor] NOT supported under Win32 GTK')
|
||||
{$EndIf}
|
||||
end;
|
||||
|
||||
@ -6824,6 +6824,9 @@ end;
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.315 2002/12/29 18:13:38 mattias
|
||||
identifier completion: basically working, still hidden
|
||||
|
||||
Revision 1.314 2002/12/28 21:44:51 mattias
|
||||
further cleanup
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user