MG: fixed class method completion

git-svn-id: trunk@1490 -
This commit is contained in:
lazarus 2002-03-09 11:55:13 +00:00
parent 373525fbe5
commit 0d735a6f89
5 changed files with 62 additions and 22 deletions

View File

@ -968,7 +968,8 @@ writeln('TCodeCompletionCodeTool.CreateMissingProcBodies Gather existing method
if (ProcCode='') then begin if (ProcCode='') then begin
ANode:=TCodeTreeNodeExtension(MissingNode.Data).Node; ANode:=TCodeTreeNodeExtension(MissingNode.Data).Node;
if (ANode<>nil) and (ANode.Desc=ctnProcedure) then begin if (ANode<>nil) and (ANode.Desc=ctnProcedure) then begin
ProcCode:=ExtractProcHead(ANode,[phpWithStart,phpAddClassname, ProcCode:=ExtractProcHead(ANode,[phpWithStart,
phpWithoutClassKeyword,phpAddClassname,
phpWithParameterNames,phpWithResultType,phpWithVarModifiers]); phpWithParameterNames,phpWithResultType,phpWithVarModifiers]);
end; end;
end; end;

View File

@ -74,6 +74,7 @@ type
TProcHeadAttribute = ( TProcHeadAttribute = (
phpWithStart, // proc keyword e.g. 'function', 'class procedure' phpWithStart, // proc keyword e.g. 'function', 'class procedure'
phpWithoutClassKeyword,// without 'class' proc keyword
phpAddClassname, // extract/add 'ClassName.' phpAddClassname, // extract/add 'ClassName.'
phpWithoutClassName, // skip classname phpWithoutClassName, // skip classname
phpWithoutName, // skip function name phpWithoutName, // skip function name
@ -2964,7 +2965,8 @@ begin
ExtractNextAtom(false,Attr); ExtractNextAtom(false,Attr);
// read procedure start keyword // read procedure start keyword
if (UpAtomIs('CLASS') or UpAtomIs('STATIC')) then if (UpAtomIs('CLASS') or UpAtomIs('STATIC')) then
ExtractNextAtom(phpWithStart in Attr,Attr); ExtractNextAtom((phpWithStart in Attr)
and not (phpWithoutClassKeyword in Attr),Attr);
if (UpAtomIs('PROCEDURE')) or (UpAtomIs('FUNCTION')) if (UpAtomIs('PROCEDURE')) or (UpAtomIs('FUNCTION'))
or (UpAtomIs('CONSTRUCTOR')) or (UpAtomIs('DESTRUCTOR')) or (UpAtomIs('CONSTRUCTOR')) or (UpAtomIs('DESTRUCTOR'))
or (UpAtomIs('OPERATOR')) then or (UpAtomIs('OPERATOR')) then

View File

@ -221,6 +221,7 @@ type
procedure AssignPicture(Source: TPicture); procedure AssignPicture(Source: TPicture);
procedure AssignToBitmap(Dest: TBitmap); procedure AssignToBitmap(Dest: TBitmap);
procedure AssignToPixmap(Dest: TPixmap); procedure AssignToPixmap(Dest: TPixmap);
procedure AssignToIcon(Dest: TIcon);
//procedure AssignToMetafile(Dest: TMetafile); //procedure AssignToMetafile(Dest: TMetafile);
procedure AssignToPicture(Dest: TPicture); procedure AssignToPicture(Dest: TPicture);
function GetAsText: string; function GetAsText: string;
@ -405,6 +406,9 @@ end.
{ {
$Log$ $Log$
Revision 1.7 2002/03/09 11:55:13 lazarus
MG: fixed class method completion
Revision 1.6 2002/02/03 00:24:00 lazarus Revision 1.6 2002/02/03 00:24:00 lazarus
TPanel implemented. TPanel implemented.
Basic graphic primitives split into GraphType package, so that we can Basic graphic primitives split into GraphType package, so that we can
@ -426,4 +430,4 @@ end.
Revision 1.1 2000/07/13 10:28:23 michael Revision 1.1 2000/07/13 10:28:23 michael
+ Initial import + Initial import
} }

View File

@ -263,6 +263,7 @@ type
FTransparent: Boolean; FTransparent: Boolean;
FOnChange: TNotifyEvent; FOnChange: TNotifyEvent;
FOnProgress: TProgressEvent; FOnProgress: TProgressEvent;
FPaletteModified: Boolean;
procedure SetModified(Value: Boolean); procedure SetModified(Value: Boolean);
protected protected
procedure Changed(Sender: TObject); virtual; procedure Changed(Sender: TObject); virtual;
@ -291,10 +292,11 @@ type
property Empty: Boolean read GetEmpty; property Empty: Boolean read GetEmpty;
property Height: Integer read GetHeight write SetHeight; property Height: Integer read GetHeight write SetHeight;
property Modified: Boolean read FModified write SetModified; property Modified: Boolean read FModified write SetModified;
property Transparent: Boolean read GetTransparent write SetTransparent; property PaletteModified: Boolean read FPaletteModified write FPaletteModified;
property Width: Integer read GetWidth write SetWidth;
property OnChange: TNotifyEvent read FOnChange write FOnChange; property OnChange: TNotifyEvent read FOnChange write FOnChange;
property OnProgress: TProgressEvent read FOnProgress write FOnProgress; property OnProgress: TProgressEvent read FOnProgress write FOnProgress;
property Transparent: Boolean read GetTransparent write SetTransparent;
property Width: Integer read GetWidth write SetWidth;
end; end;
TGraphicClass = class of TGraphic; TGraphicClass = class of TGraphic;
@ -305,10 +307,20 @@ type
polymorphic. For example, if the TPicture is holding an Icon, you can polymorphic. For example, if the TPicture is holding an Icon, you can
LoadFromFile a bitmap file, where if the class is TIcon you could only read LoadFromFile a bitmap file, where if the class is TIcon you could only read
.ICO files. .ICO files.
LoadFromFile - Reads a picture from disk. The TGraphic class created
determined by the file extension of the file. If the file extension is LoadFromFile - Reads a picture from disk. The TGraphic class created
determined by the file extension of the file. If the file extension is
not recognized an exception is generated. not recognized an exception is generated.
SaveToFile - Writes the picture to disk. SaveToFile - Writes the picture to disk.
LoadFromClipboardFormat - ToDo: Reads the picture from the handle provided in
the given clipboard format. If the format is not supported, an
exception is generated.
SaveToClipboardFormats - ToDo: Allocates a global handle and writes the picture
in its native clipboard format (CF_BITMAP for bitmaps, CF_METAFILE
for metafiles, etc.). Formats will contain the formats written.
Returns the number of clipboard items written to the array pointed to
by Formats and Datas or would be written if either Formats or Datas are
nil.
SupportsClipboardFormat - Returns true if the given clipboard format SupportsClipboardFormat - Returns true if the given clipboard format
is supported by LoadFromClipboardFormat. is supported by LoadFromClipboardFormat.
Assign - Copys the contents of the given TPicture. Used most often in Assign - Copys the contents of the given TPicture. Used most often in
@ -325,10 +337,10 @@ type
Graphic - The TGraphic object contained by the TPicture Graphic - The TGraphic object contained by the TPicture
Bitmap - Returns a bitmap. If the contents is not already a bitmap, the Bitmap - Returns a bitmap. If the contents is not already a bitmap, the
contents are thrown away and a blank bitmap is returned. contents are thrown away and a blank bitmap is returned.
Pixmap - Returns a pixmap. If the contents is not already a pixmap, the
contents are thrown away and a blank pixmap is returned.
Icon - Returns an icon. If the contents is not already an icon, the Icon - Returns an icon. If the contents is not already an icon, the
contents are thrown away and a blank icon is returned. contents are thrown away and a blank icon is returned.
Pixmap - Returns a pixmap. If the contents is not already a pixmap, the
contents are thrown away and a blank pixmap is returned.
} }
TPicture = class(TPersistent) TPicture = class(TPersistent)
@ -338,10 +350,14 @@ type
FOnProgress: TProgressEvent; FOnProgress: TProgressEvent;
procedure ForceType(GraphicType: TGraphicClass); procedure ForceType(GraphicType: TGraphicClass);
function GetBitmap: TBitmap; function GetBitmap: TBitmap;
function GetPixmap: TPixmap;
function GetIconp: TIcon;
function GetHeight: Integer; function GetHeight: Integer;
function GetWidth: Integer; function GetWidth: Integer;
procedure ReadData(Stream: TStream); procedure ReadData(Stream: TStream);
procedure SetBitmap(Value: TBitmap); procedure SetBitmap(Value: TBitmap);
procedure SetPixmap(Value: TPixmap);
procedure SetIconp(Value: TIcon);
procedure SetGraphic(Value: TGraphic); procedure SetGraphic(Value: TGraphic);
procedure WriteData(Stream: TStream); procedure WriteData(Stream: TStream);
protected protected
@ -349,22 +365,27 @@ type
procedure Changed(Sender: TObject); dynamic; procedure Changed(Sender: TObject); dynamic;
procedure DefineProperties(Filer: TFiler); override; procedure DefineProperties(Filer: TFiler); override;
procedure Progress(Sender: TObject; Stage: TProgressStage; procedure Progress(Sender: TObject; Stage: TProgressStage;
PercentDone: Byte; RedrawNow: Boolean; const R: TRect; PercentDone: Byte; RedrawNow: Boolean; const R: TRect;
const Msg: string); dynamic; const Msg: string); dynamic;
public public
constructor Create; constructor Create;
destructor Destroy; override; destructor Destroy; override;
procedure LoadFromFile(const Filename: string); procedure LoadFromFile(const Filename: string);
procedure SaveToFile(const Filename: string); procedure SaveToFile(const Filename: string);
//class function SupportsClipboardFormat(AFormat: Word): Boolean; procedure LoadFromClipboardFormat(FormatID: TClipboardFormat);
procedure SaveToClipboardFormat(FormatID: TClipboardFormat);
class function SupportsClipboardFormat(FormatID: TClipboardFormat): Boolean;
procedure Assign(Source: TPersistent); override; procedure Assign(Source: TPersistent); override;
class procedure RegisterFileFormat(const AnExtension, ADescription: string; class procedure RegisterFileFormat(const AnExtension, ADescription: string;
AGraphicClass: TGraphicClass); AGraphicClass: TGraphicClass);
//class procedure RegisterClipboardFormat(AFormat: Word; class procedure RegisterClipboardFormat(FormatID: TClipboardFormat;
// AGraphicClass: TGraphicClass); AGraphicClass: TGraphicClass);
class procedure UnregisterGraphicClass(AClass: TGraphicClass); class procedure UnregisterGraphicClass(AClass: TGraphicClass);
property Bitmap: TBitmap read GetBitmap write SetBitmap; property Bitmap: TBitmap read GetBitmap write SetBitmap;
property Pixmap: TPixmap read GetPixmap write SetPixmap;
property Icon: TIcon read GetIcon write SetIcon;
property Graphic: TGraphic read FGraphic write SetGraphic; property Graphic: TGraphic read FGraphic write SetGraphic;
//property PictureAdapter: IChangeNotifier read FNotify write FNotify;
property Height: Integer read GetHeight; property Height: Integer read GetHeight;
property Width: Integer read GetWidth; property Width: Integer read GetWidth;
property OnChange: TNotifyEvent read FOnChange write FOnChange; property OnChange: TNotifyEvent read FOnChange write FOnChange;
@ -723,6 +744,9 @@ end.
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.25 2002/03/09 11:55:13 lazarus
MG: fixed class method completion
Revision 1.24 2002/03/08 16:16:55 lazarus Revision 1.24 2002/03/08 16:16:55 lazarus
MG: fixed parser of end blocks in initialization section added label sections MG: fixed parser of end blocks in initialization section added label sections

View File

@ -499,15 +499,10 @@ begin
raise Exception.Create('TClipboard.AssignToPixmap not implemented yet'); raise Exception.Create('TClipboard.AssignToPixmap not implemented yet');
end; end;
procedure TClipboard.AssignTo(Dest: TPersistent); procedure TClipboard.AssignToIcon(Dest: TIcon);
begin begin
if Dest is TPicture then // ToDo
AssignToPicture(TPicture(Dest)) raise Exception.Create('TClipboard.AssignToIcon not implemented yet');
else if Dest is TBitmap then
AssignToBitmap(TBitmap(Dest))
else if Dest is TPixmap then
AssignToPixmap(TPixmap(Dest))
else inherited AssignTo(Dest);
end; end;
procedure TClipboard.AssignPicture(Source: TPicture); procedure TClipboard.AssignPicture(Source: TPicture);
@ -531,6 +526,17 @@ begin
else inherited Assign(Source); else inherited Assign(Source);
end; end;
procedure TClipboard.AssignTo(Dest: TPersistent);
begin
if Dest is TPicture then
AssignToPicture(TPicture(Dest))
else if Dest is TBitmap then
AssignToBitmap(TBitmap(Dest))
else if Dest is TPixmap then
AssignToPixmap(TPixmap(Dest))
else inherited AssignTo(Dest);
end;
{function TClipboard.GetAsHandle(Format: Word): THandle; {function TClipboard.GetAsHandle(Format: Word): THandle;
begin begin
Open; Open;
@ -588,6 +594,9 @@ end;
{ {
$Log$ $Log$
Revision 1.6 2002/03/09 11:55:13 lazarus
MG: fixed class method completion
Revision 1.5 2001/11/14 19:10:03 lazarus Revision 1.5 2001/11/14 19:10:03 lazarus
MG: fixes for parser and linkscanner and small cleanups MG: fixes for parser and linkscanner and small cleanups