Mattias Gaertner wrote:
On 16 Jan 2006 21:36:09 +0100
Darius Blaszijk <[EMAIL PROTECTED]> wrote:
On Mon, 2006-01-16 at 19:59, Mattias Gaertner wrote:
What we need:
1. a hint window to right of the completion box.
2. the search for the fpdoc/xml path
3. the parsing of the fpdoc xml item and showing as formatted text
If someone implements 1 and 3, I will do 2.
The fpdoc/xml path is already known, you set it for LazDoc already, so
perhaps you can use that.
I meant the full path. Example
docs/xml/lcl/controls.xml#TCustomControl.Paint
Mattias
I'll start with 3, 1 & 2 would be meaningless without 3.
I'll create a class to store the properties of the found element.
Below is a prototype, do add in if i missed something.
//*****************************************************************************
TCompletionItemDesc = class
sPackage: string;
sModule: string;
sShort: string;
sDescription: string;
sSeeAlso: string;
end;
TCompletionItemInfo = class(TComponent)
private
//Stores info of currently selected
FCurrentElement: TCompletionItemDesc;
//XML FileName (absolute path).
//If filename different, load slLazDocXML again.
//If file not found, clear slLazDocXML.
FXMLFileName: string;
procedure SetXMLFileName(sFileName: string);
protected
//Stores Doc XML
slLazDocXML: TStrings;
public
constructor Create(AOwner: TComponent): override;
destructor Destroy; override;
//Locates and store info into CurrentElement returns true if found
function Fill_CurrentElement(sElementName: string): Boolean;
//Locate and fill CurrentElement by specifying a path
//e.g. /usr/local/lazarus/docs/xml/lcl/controls.xml#TCustomControl.Paint
//Function will parse sPath,
//load XML file if necessary, file not found -- Exit,
//locate Element specified at end of path,
//finally fill up CurrentElement by parsing up to next '</element>' tag.
//Returns true if successful, clear CurrentElement members if false.
function Get_Element_from_Path(sPath: string): Boolean;
property CurrentElement: TCompletionItemDesc read FCurrentElement
write FCurrentElement;
property XMLFileName: string read FXMLFileName write SetXMLFileName;
end;
//*****************************************************************************
So basically the usage is to invoke function Get_Element_from_Path,
if it succeeds, get the values from members of CurrentElement property.
If above prototype is correct, i'll start working on the body.
Should the above be placed in the SourceEditProcs.pas?
Any content populated 'controls.xml' files i can test with?
Initially i was planning to have a quick hint of the whole view of the item
when the mouse moves over an item in the completion box. This can be achieved
by a MouseMove method which calculates the Y value to know which item
the mouse is pointing at. Then extracting the hint from a 'hint list' which
is maintained by modifying PaintCompletionItem method to return the formated
string to the hint list base on the index value. So the 'hint list' only needs
to maintain a few number of strings=NBLinesInWindow (i.e. the displayed items).
Funky Beast
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives