On Tue, 17 Jan 2006 21:07:48 +0800
Funky Beast <[EMAIL PROTECTED]> wrote:

> Mattias Gaertner wrote:
> > On Tue, 17 Jan 2006 17:04:57 +0800
> > Funky Beast <[EMAIL PROTECTED]> wrote:
> > 
> > 
> >>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
> > 
> > 
> > Every designtime package can register its own help files.
> > Actually the help generates paths of type TPascalHelpContextList defined
> > in ideintf/helpintf.pas
> > For example:
> > pihcFilename:      '/path/of/your/package/docs'
> > pihcType:          'TYourComponent'
> > pihcProcedure:     'YourMethod'
> > pihcParameterList: ''
> > 
> 
> I see.
> 
> > which is converted by the TFPDocHTMLHelpDatabase to the fpdoc html path.
> > I will extend TFPDocHTMLHelpDatabase to create the fpdoc xml path.
> > 
> >  
> > 
> >>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;
> > 
> > 
> > What's package and what's module? Can you add some comments?
> > 
> I was extracting whatever tags i could find in the xml documents.
> sPackage represents the tag e.g. <package name="lcl"> at beginning
> of every xml doc.
> sModule represents the tag e.g. <module name="StdCtrls"> also at begin
> of every xml doc.
> If there are any irrelevent tags included, do not hesitate to remove it.
> >  
> > 
> >>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?
> > 
> > 
> > No. Start a new unit, say 'CodeHelp' (ide/codehelp.pas).
> Roger that.
> > 
> >  
> > 
> >>Any content populated 'controls.xml' files i can test with?
> > 
> > 
> > Maybe stdctrls.xml TEdit entries.
> > 
> >  
> > 
> >>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).
> > 
> > 
> > The PaintCompletionItem does not need the list, so you don't need them
> > neither. Just retrieve the item on the fly as PaintCompletionItem.
> > Although I think, when the completion help box is already there, you can
> > easier use the up/down keys than move your hand to the mouse.
> > 
> 
> Agreed, that was my initial thoughts when i couldn't identify my projects'
> functions which have names that are too long to display entirely in the
> completion box (had to do trial and error).
> 
> A tiny question, what about identifiers in user's projects which might not
> have an xml document to refer to?

Show a text 'no help found' or something like that.
We could show the code. For example some identifiers have a comment or the
code around helps understanding.
For example:

---------------------------------------------
no help found for bg

Source:
... gtkwidget.pp 209 ...
            klass : PGtkStyleClass;
            fg : array[0..4] of TGdkColor;
-->         bg : array[0..4] of TGdkColor;
            light : array[0..4] of TGdkColor;
            dark : array[0..4] of TGdkColor;
... gtkwidget.pp 213 ...
---------------------------------------------

'bg' is too short to understand, but seeing 'fg', 'light' and 'dark' gives a
clue, that background is meant.
 

Mattias

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to