"
+ Endif
+
+ Endif
+
+ If hClassInfo.AutoCreatable Then sInfo = ("This class can be used like an object by creating an hidden instance on demand. ")
+ If hClassInfo.Creatable Then sInfo &= ("This class is creatable. ")
+
+ If Not Component Or If Component = CComponent.PROJECT_NAME Then sWhere = "gambas://project/" & sClass & "?showfile"
+ sTitle = sClass
+ If sWhere Then sTitle = "" & sTitle & ""
+
+ sHtml = File.Load("help/class-help.html")
+ sHtml = Replace(sHtml, "$(help)", sHelp)
+
+ If sInfo Then
+ sHtml = Replace(sHtml, "", sInfo & "")
+ Endif
+
+ If hClassInfo.Parent Then
+
+ sParent = hClassInfo.Parent
+
+ hParentClass = CComponent.Classes[hClassInfo.ParentComponent &/ sParent]
+ If Not hParentClass Then hParentClass = CComponent.GetClassDescription(sParent)
+
+ sHtml = SubstPart(sHtml, "ShowInherits", True)
+ sHtml = SubstPart(sHtml, "ShowParConst", aParentConst.Count > 0)
+ sHtml = Replace(sHtml, "$(ParConst)", aParentConst.Join(" "))
+
+ sHtml = Replace(sHtml, "$(Inherits)", Subst(("This class inherits &1."), Subst("&2", Html(hParentClass.GetHelpURL()), sParent)))
+ sHtml = Replace(sHtml, "$(ParSymbols)", sParSymbols)
+
+ Else
+
+ sHtml = SubstPart(sHtml, "ShowInherits", False)
+
+ Endif
+
+ sHtml = SubstPart(sHtml, "ShowConst", aConst.Count > 0)
+ sHtml = Replace(sHtml, "$(Const)", aConst.Join(" "))
+
+ sHtml = Replace(sHtml, "$(title)", sTitle)
+ sHtml = Replace(sHtml, "$(Symbols)", sSymbols)
+
+ sHtml = Replace(sHtml, "''Symbols''", ("Symbols"))
+ sHtml = Replace(sHtml, "''Constants''", ("Constants"))
+
+ sHtml = Replace(sHtml, "$(hide-title)", "")
+
+ Return sHtml
+
+End
diff --git a/app/src/gambas3/.src/Component/CComponent.class b/app/src/gambas3/.src/Component/CComponent.class
index a45ba36cb..0c44ccbbf 100644
--- a/app/src/gambas3/.src/Component/CComponent.class
+++ b/app/src/gambas3/.src/Component/CComponent.class
@@ -36,6 +36,7 @@ Public Hidden As Boolean
Public {Library} As Boolean
Public Path As String
+Public Help As String
Static Public Features As New Collection
@@ -464,6 +465,8 @@ Public Sub Load()
All[sLig].Load
Endif
Next
+
+ Help = hLibraryInfo.GetHelp()
Else
@@ -1417,13 +1420,17 @@ Public Sub GetHelpURL() As String
If Key And If Key <> CComponent.PROJECT_NAME Then
- sPath = MHelp.GetURL("comp")
- sComp = Key
- 'If sComp = "gb.qt4" Or If sComp = "gb.gtk" Or If sComp = "gb.gui" Then sComp = "gb.qt"
- 'If sComp = "gb.qt4.ext" Then sComp = "gb.qt.ext"
- sPath &/= LCase(sComp)
-
- Return sPath & "?help&v3&" & MHelp.GetLanguage()
+ If {Library} Then
+ Return "gambas://library" &/ Key
+ Else
+ sPath = MHelp.GetURL("comp")
+ sComp = Key
+ 'If sComp = "gb.qt4" Or If sComp = "gb.gtk" Or If sComp = "gb.gui" Then sComp = "gb.qt"
+ 'If sComp = "gb.qt4.ext" Then sComp = "gb.qt.ext"
+ sPath &/= LCase(sComp)
+
+ Return sPath & "?help&v3&" & MHelp.GetLanguage()
+ Endif
Endif
@@ -1439,3 +1446,43 @@ Public Sub ExistClassEvenArray(sClass As String) As Boolean
Loop
End
+
+Public Sub GetHelpHTML() As String
+
+ Dim sClass As String = Name
+ Dim sHtml As String
+ Dim sDesc As String
+ Dim hClass As CClassInfo
+ Dim sHelp As String
+
+ If Name = PROJECT_NAME Then
+ sHelp = Project.Description
+ Else If {Library} Then
+ sHelp = Help
+ Else
+ Return
+ Endif
+
+ sHtml = File.Load("help/component-help.html")
+
+ sHtml = Replace(sHtml, "$(help)", sHelp)
+
+ sDesc = ""
+
+ For Each sClass In ClassList
+
+ hClass = Classes[sClass]
+ sDesc &= "" & sClass & " "
+
+ Next
+
+ sHtml = Replace(sHtml, "$(classes)", sDesc)
+ sHtml = Replace(sHtml, "$(title)", Name)
+
+ sHtml = Replace(sHtml, "''Classes''", ("Classes"))
+
+ sHtml = Replace(sHtml, "$(hide-title)", "")
+
+ Return sHtml
+
+End
diff --git a/app/src/gambas3/.src/Component/CSymbolInfo.class b/app/src/gambas3/.src/Component/CSymbolInfo.class
index 60991c846..1f8c70382 100644
--- a/app/src/gambas3/.src/Component/CSymbolInfo.class
+++ b/app/src/gambas3/.src/Component/CSymbolInfo.class
@@ -739,35 +739,46 @@ Static Public Function TransformSignature(sSign As String, bBalise As Boolean) A
End
-Public Function GetHelpURL() As String
+Public Function GetHelpURL(Optional bShowFile As Boolean) As String
Dim sPath As String
Dim sName As String
Dim sComp As String
+ Dim hComp As CComponent
If Component = "gb" And If Class = "." Then
Return MHelp.GetLangURL(Name)
Endif
-
- If Component And If Component <> CComponent.PROJECT_NAME Then
- sPath = MHelp.GetURL("comp")
- sComp = Component
- 'If sComp = "gb.qt4" Or If sComp = "gb.gtk" Or If sComp = "gb.gui" Then sComp = "gb.qt"
- 'If sComp = "gb.qt4.ext" Then sComp = "gb.qt.ext"
- sPath &/= LCase(sComp)
- sPath &/= LCase(Left(Class) & Replace(Mid(Class, 2), "_", "."))
-
- sName = LCase(Name)
- sName = Left(sName) & Replace(Mid$(sName, 2), "_", ".")
- sName = Replace(sName, ":", ".")
- sPath &/= sName
-
- Return sPath & "?help&v3&" & MHelp.GetLanguage()
+ If Component And If Component <> CComponent.PROJECT_NAME Then hComp = CComponent.All[Component]
+
+ If hComp Then
+
+ If hComp.Library Then
+
+ Return Subst("gambas://library/&1/&2/&3", Component, Class, Name)
+
+ Else
+
+ sPath = MHelp.GetURL("comp")
+ sComp = Component
+ 'If sComp = "gb.qt4" Or If sComp = "gb.gtk" Or If sComp = "gb.gui" Then sComp = "gb.qt"
+ 'If sComp = "gb.qt4.ext" Then sComp = "gb.qt.ext"
+ sPath &/= LCase(sComp)
+ sPath &/= LCase(Left(Class) & Replace(Mid(Class, 2), "_", "."))
+
+ sName = LCase(Name)
+ sName = Left(sName) & Replace(Mid$(sName, 2), "_", ".")
+ sName = Replace(sName, ":", ".")
+ sPath &/= sName
+
+ Return sPath & "?help&v3&" & MHelp.GetLanguage()
+
+ Endif
Else
- Return Subst("gambas://project/&1/&2#&3?showfile", Class, Name, LineNumber)
+ Return Subst("gambas://project/&1/&2#&3&4", Class, Name, LineNumber, If(bShowFile, "?showfile", ""))
Endif
@@ -948,10 +959,10 @@ Public Sub GetHelpMarkup() As String
For i = iLine - 1 To 0 Step -1
sLine = Trim(hEdit.Lines[i].Text)
- If sLine Begins "'' " Then
+ If sLine Begins "'' " Or If sLine = "''" Then
sHelp = RTrim(Mid(sLine, 4)) & "\n" & sHelp
Else
- If Trim(sLine) = "" Then Continue
+ If sLine = "" Then Continue
Break
Endif
Next
@@ -1018,9 +1029,9 @@ Public Function GetHelpHTML() As String
sHTML = Replace(sHTML, "$(syntax)", sSyntax)
sHTML = Replace(sHTML, "$(help)", sHelp)
- If Component = CComponent.PROJECT_NAME Then sTitle = ""
+ If Not Component Or If Component = CComponent.PROJECT_NAME Then sTitle = ""
sTitle &= {Class} & "." & Name
- If Component = CComponent.PROJECT_NAME Then sTitle &= ""
+ If Not Component Or If Component = CComponent.PROJECT_NAME Then sTitle &= ""
sHTML = Replace(sHTML, "$(title)", sTitle)
diff --git a/app/src/gambas3/.src/Help/FHelpBrowser.class b/app/src/gambas3/.src/Help/FHelpBrowser.class
index ab9e6e006..0e8059c55 100644
--- a/app/src/gambas3/.src/Help/FHelpBrowser.class
+++ b/app/src/gambas3/.src/Help/FHelpBrowser.class
@@ -221,7 +221,7 @@ Private Sub FillTree()
tvwClasses.Clear
- tvwClasses.Add("$", "Project", Picture["img/16/gambas.png"])
+ tvwClasses.Add("$", Project.Name, Project.GetIcon(Project.Dir, 16))
For Each sClass In Project.GetClasses()
tvwClasses.Add("$" &/ sClass, sClass,, "$")
@@ -251,19 +251,19 @@ Private Sub FillTree()
End
-Public Sub tvwClasses_MouseUp()
+Public Sub tvwClasses_Select()
- Dim ars As String[]
+ Dim aKey As String[]
Dim sKey As String
sKey = tvwClasses.Current.Key
- If sKey = "$" Then Return
+ If Not sKey Or If sKey = "$" Then Return
- ars = Split(sKey, "/")
- If ars.count = 2 Then
- MHelp.InitWebViewWith(webHelp, MHelp.TYPE_CLASS, ars[1])
- Else If ars.Count = 1 Then
- MHelp.InitWebViewWith(webHelp, MHelp.TYPE_COMPONENT, ars[0])
+ aKey = Split(sKey, "/")
+ If aKey.Count = 2 Then
+ MHelp.InitWebViewWith(webHelp, MHelp.TYPE_CLASS, aKey[0] &/ aKey[1])
+ Else If aKey.Count = 1 Then
+ MHelp.InitWebViewWith(webHelp, MHelp.TYPE_COMPONENT, aKey[0])
Endif
End
diff --git a/app/src/gambas3/.src/Help/FHelpBrowser.form b/app/src/gambas3/.src/Help/FHelpBrowser.form
index 080a11ad7..5c20658f7 100644
--- a/app/src/gambas3/.src/Help/FHelpBrowser.form
+++ b/app/src/gambas3/.src/Help/FHelpBrowser.form
@@ -100,6 +100,7 @@
MoveScaled(8,1,31,27)
Visible = False
Expand = True
+ Sorted = True
Border = False
}
{ !webHelp WebView
diff --git a/app/src/gambas3/.src/Help/MHelp.module b/app/src/gambas3/.src/Help/MHelp.module
index 92b0a01ce..7fe387a0b 100644
--- a/app/src/gambas3/.src/Help/MHelp.module
+++ b/app/src/gambas3/.src/Help/MHelp.module
@@ -382,11 +382,12 @@ Public Sub InitWebViewWith(hWebView As WebView, iType As Integer, sSymbol As Str
If hClass.Component And If hClass.Component <> CComponent.PROJECT_NAME And If Not CComponent.All[hClass.Component].Library Then
sUrl = hClass.GetHelpURL()
Else If hClass.Help Then
- sHtml = GetProjectClassHelpHTML(sSymbol, hClass.Help)
+ sHtml = hClass.GetHelpHTML()
sUrl = hClass.Component & "-" & sSymbol
Endif
Else If Project.GetClasses().Exist(sSymbol) Then
- sHtml = GetProjectClassHelpHTML(sSymbol)
+ CComponent.GetClassSymbols(sSymbol)
+ sHtml = CComponent.GetLastClass().GetHelpHTML()
sUrl = "-" & sSymbol
Endif
@@ -397,7 +398,12 @@ Public Sub InitWebViewWith(hWebView As WebView, iType As Integer, sSymbol As Str
Else If iType = TYPE_COMPONENT
Try hComp = CComponent.All[sSymbol]
- If hComp Then sUrl = hComp.GetHelpURL()
+ If hComp.Library Then
+ sUrl = sSymbol
+ sHtml = hComp.GetHelpHTML()
+ Else
+ sUrl = hComp.GetHelpURL()
+ Endif
Endif
@@ -407,7 +413,7 @@ Public Sub InitWebViewWith(hWebView As WebView, iType As Integer, sSymbol As Str
sTemp = File.Dir(Temp$()) &/ "help"
Try Mkdir sTemp
- sTemp &/= sUrl & ".html"
+ sTemp &/= Replace(sUrl, "/", "|") & ".html"
File.Save(sTemp, sHtml)
hWebView.Url = "file://" & sTemp
@@ -459,200 +465,187 @@ Public Sub ShowHelpBrowserWith(hWebView As WebView, iType As Integer, sSymbol As
End
-Private Sub SubstPart(sHtml As String, sPart As String, bShow As Boolean) As String
-
- If bShow Then
- sHtml = Replace(sHtml, sPart & "[", "")
- sHtml = Replace(sHtml, sPart & "]", "")
- Else
- sHtml = Replace(sHtml, sPart & "[", "")
- Endif
-
- Return sHtml
-
-End
'' +Description
-'' Return the formated help of the local class if it exist
+'' Return the formated help of the local class if it exists
'' +Arguments
'' - #sClass# is the class to analyze
-'' - #hWebView# is the WebView control to use.
+'' - #sMarkup# is the markup to convert to HTML
-Private Function GetProjectClassHelpHTML(sClass As String, Optional sMarkup As String) As String
-
- Dim sHelp, sHtml, sLine, sWhere, sSymbols, sParSymbols, sInfo As String
- Dim hForm As FEditor
- Dim hEdit As Editor
- Dim i As Integer
- Dim hSymbol As CSymbolInfo
- Dim cClassSymbols As Collection
- Dim hClassInfo, hParentClass As CClassInfo
- Dim aProperty, aEvent, aMethod, aConst, aVar As New String[]
- Dim aParentProperty, aParentEvent, aParentMethod, aParentConst, aParentVar As New String[]
- Dim sComp, sSymbolName As String
- Dim hArray As String[]
- Dim sParent As String
-
- If Not sMarkup Then
-
- hForm = Project.LoadFile(Project.FindPath(sClass))
- Try hEdit = hForm.Editor
-
- If Not hEdit Then Return
-
- For i = 0 To hEdit.Lines.Count - 1
- sLine = Trim(hEdit.Lines[i].Text)
- If sLine Begins "''' " Then
- sMarkup &= Trim(Mid$(sLine, 4)) & "\n"
- Else
- If sMarkup Then Break
- If sLine Not Begins "'" Then Break
- Endif
- Next
-
- Endif
-
- sHelp = Markup.Convert(sMarkup)
-
- hClassInfo = CComponent.GetClassDescription(sClass)
- cClassSymbols = CComponent.GetClassSymbols(sClass)
-
- 'If hClassInfo.Name = sClass Then hClassInfo.Name = hClassInfo.Parent ????? Do not modify the class info!
-
- If cClassSymbols.Count > 0 Then
-
- For Each hSymbol In cClassSymbols
-
- sSymbolName = hSymbol.Name
- If Left(sSymbolName) = ":" Then sSymbolName = Mid$(sSymbolName, 2)
-
- sComp = Subst("&2", Html(hSymbol.GetHelpURL()), sSymbolName)
-
- If hSymbol.NotPublic Or If hSymbol.IsHidden() Then Continue
-
- If IsLetter(hSymbol.Kind) And If hSymbol.Kind = UCase(hSymbol.Kind) Then sComp = "" & sComp & ""
-
- If hSymbol.Class = sClass Then
-
- Select Case LCase(hSymbol.Kind)
- Case ":"
- aEvent.Add(sComp)
- Case "m"
- aMethod.Add(sComp)
- Case "p", "r"
- aProperty.Add(sComp)
- Case "c"
- aConst.Add(sComp)
- Case "v"
- aVar.Add(sComp)
- End Select
-
- Else
-
- Select Case LCase(hSymbol.Kind)
- Case ":"
- aParentEvent.Add(sComp)
- Case "m"
- aParentMethod.Add(sComp)
- Case "p", "r"
- aParentProperty.Add(sComp)
- Case "c"
- aParentConst.Add(sComp)
- Case "v"
- aParentVar.Add(sComp)
- End Select
-
- Endif
-
- Next
-
- For Each hArray In [aConst, aEvent, aMethod, aProperty, aVar, aParentConst, aParentEvent, aParentMethod, aParentProperty, aParentVar]
- hArray.Sort
- Next
-
- sParSymbols = ""
- If aParentProperty.Count + aParentMethod.Count + aParentEvent.Count + aParentVar.Count Then
- sParSymbols &= "
"
- If aParentProperty.Count Then sParSymbols &= "
" & ("Properties") & "
"
- If aParentVar.Count Then sParSymbols &= "
" & ("Variables") & "
"
- If aParentMethod.Count Then sParSymbols &= "
" & ("Methods") & "
"
- If aParentEvent.Count Then sParSymbols &= "
" & ("Events") & "
"
- sParSymbols &= "
"
- sParSymbols &= "
"
- If aParentProperty.Count Then sParSymbols &= "