[DEVELOPMENT ENVIRONMENT]
* NEW: Now the controls declared in the form editor can be directly shown in the form editor from a link in the local help git-svn-id: svn://localhost/gambas/trunk@2194 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
9184fbe716
commit
263b03d1be
3 changed files with 143 additions and 113 deletions
|
@ -66,7 +66,9 @@ Public Sub ShowSymbolHelp(hEditor As Editor, hSymbol As CSymbolInfo)
|
|||
Dim sLink As String
|
||||
Dim sName As String
|
||||
Dim sComp As String
|
||||
|
||||
Dim hClass As Class
|
||||
Dim sClass As String
|
||||
sClass = hSymbol.Class
|
||||
txtHelp.RichText = IIf(hSymbol.IsStatic(), "STATIC", "") & " " & IIf(hSymbol.NotPublic, "PRIVATE", "PUBLIC") & " " &
|
||||
Replace(hSymbol.GetDescription(), hSymbol.Name, "<b>" & hSymbol.Name & "</b>")
|
||||
txtHelp.RichText &= "<br><font color=green>Kind: </font><b>"
|
||||
|
@ -79,28 +81,30 @@ Public Sub ShowSymbolHelp(hEditor As Editor, hSymbol As CSymbolInfo)
|
|||
txtHelp.RichText &= "Sub/Function"
|
||||
Case "C"
|
||||
txtHelp.RichText &= "Constant"
|
||||
Case "t"
|
||||
txtHelp.RichText &= "Form control"
|
||||
sClass = hSymbol.Type
|
||||
Case Else
|
||||
txtHelp.Text &= hSymbol.Kind
|
||||
|
||||
End Select
|
||||
|
||||
txtHelp.RichText &= "</b>"
|
||||
|
||||
If hSymbol.LineNumber Then
|
||||
|
||||
txtHelp.RichText &= Subst("<br>Def.: " & "<a href=\"file://&1.&2\">&1.&2</a> ", hSymbol.Class, hSymbol.LineNumber)
|
||||
'Symbole locale
|
||||
'sResult = "<b><u>Syntax</u></b><br>"
|
||||
|
||||
|
||||
'txtHelp.RichText = "<font color=green>Component: </font>This project" &
|
||||
' " <Font color=red>Class: </font>" & hSymbol.Class &
|
||||
' " <Font color=blue>Symbol: </font>" & hSymbol.Name
|
||||
|
||||
txtHelp.RichText &= "<hr>" & GetLocalHelp(hSymbol)
|
||||
'Definition
|
||||
txtHelp.RichText &= Subst("<br>Def.: " & "<a href=\"file://&1.&2\">&1.&2</a> ", sClass, hSymbol.LineNumber)
|
||||
'Afficher l'aide Locale
|
||||
txtHelp.RichText &= GetLocalHelp(hSymbol)
|
||||
|
||||
Else
|
||||
'Symbole externe
|
||||
|
||||
txtHelp.RichText &= Subst("<br><font color=blue>&1</font> > <Font color=red>&2</font>", hSymbol.Component, hSymbol.Class)
|
||||
|
||||
'Afficher le formulaire
|
||||
If hSymbol.Kind = "t" Then txtHelp.Text &= Subst("<br>Def.: <a href=\"form://&1.&2\">&1.&2</a>", hSymbol.Class, hSymbol.name)
|
||||
|
||||
'Filiation
|
||||
txtHelp.RichText &= Subst("<br><font color=blue>&1</font> > <Font color=red>&2</font>", hSymbol.Component, sClass)
|
||||
|
||||
|
||||
sName = LCase(hSymbol.Name)
|
||||
|
||||
|
@ -111,7 +115,7 @@ Public Sub ShowSymbolHelp(hEditor As Editor, hSymbol As CSymbolInfo)
|
|||
sComp = hSymbol.Component
|
||||
If sComp = "gb.qt4" Or If sComp = "gb.gtk" Or If sComp = "gb.gui" Then sComp = "gb.qt"
|
||||
sLink &= "/" & sComp
|
||||
If hSymbol.Class <> "." Then sLink &= "/" & LCase(hSymbol.Class)
|
||||
If hSymbol.Class <> "." Then sLink &= "/" & LCase(sClass)
|
||||
Endif
|
||||
|
||||
sLink &/= sName
|
||||
|
@ -225,6 +229,7 @@ Private Function GetLocalHelp(hSymbol As CSymbolInfo) As String
|
|||
iLine = hSymbol.HelpLineNumber
|
||||
|
||||
If hSymbol.HelpLineNumber Then
|
||||
sResult &= "<hr>"
|
||||
Do
|
||||
s = LTrim(hEdit.Lines[iLine].Text)
|
||||
If Left(s, 2) <> "''" Then Break
|
||||
|
@ -232,6 +237,7 @@ Private Function GetLocalHelp(hSymbol As CSymbolInfo) As String
|
|||
Inc iLine
|
||||
If iLine >= hEdit.Lines.Count Then Break
|
||||
Loop
|
||||
|
||||
Return sResult
|
||||
Endif
|
||||
End
|
||||
|
@ -277,5 +283,9 @@ Public Sub txtHelp_Link(Path As String)
|
|||
Project.OpenFile(Project.FindPath(aRes[0]), CInt(aRes[1]))
|
||||
|
||||
Endif
|
||||
If Left(Path, 6) = "form:/" Then
|
||||
aRes = Scan(Path, "form://*.*")
|
||||
Project.OpenForm(aRes[0],, aRes[1])
|
||||
Endif
|
||||
|
||||
End
|
||||
|
|
|
@ -2169,7 +2169,7 @@ Private Function IsKeyword(iCpt As Integer) As Boolean
|
|||
End
|
||||
|
||||
|
||||
Private Sub FindDefinition()
|
||||
Private Sub FindDefinition(bPopupHelp As Boolean)
|
||||
|
||||
Dim sLig As String
|
||||
Dim iCol As Integer
|
||||
|
@ -2217,17 +2217,30 @@ Private Sub FindDefinition()
|
|||
Endif
|
||||
Endif
|
||||
|
||||
MHelp.GotoKeyword(sKeyword, sKeyword2)
|
||||
If bPopupHelp Then
|
||||
MHelp.GotoKeyword(sKeyword, sKeyword2)
|
||||
Else
|
||||
FHelp.ShowKeywordHelp(Editor, sKeyword, sKeyword2)
|
||||
Endif
|
||||
Return
|
||||
|
||||
Else If Highlight.Types[iCpt] = Highlight.DataType Then
|
||||
|
||||
sKeyword = Highlight.Symbols[iCpt]
|
||||
If MHelp.GotoDataType(sKeyword) Then
|
||||
hClass = CComponent.Classes[sKeyword]
|
||||
If hClass Then
|
||||
MHelp.GotoClass(hClass.Component, hClass.Name)
|
||||
Endif
|
||||
If bPopupHelp Then
|
||||
If MHelp.GotoDataType(sKeyword) Then
|
||||
hClass = CComponent.Classes[sKeyword]
|
||||
If hClass Then
|
||||
MHelp.GotoClass(hClass.Component, hClass.Name)
|
||||
Endif
|
||||
Endif
|
||||
Else
|
||||
If FHelp.ShowDatatypeHelp(Editor, sKeyword) Then
|
||||
hClass = CComponent.Classes[sKeyword]
|
||||
If hClass Then
|
||||
FHelp.ShowClassHelp(Editor, hClass.Component, hClass.Name)
|
||||
Endif
|
||||
Endif
|
||||
Endif
|
||||
Return
|
||||
Endif
|
||||
|
@ -2239,97 +2252,101 @@ Private Sub FindDefinition()
|
|||
|
||||
'PRINT hSymbol.Class
|
||||
|
||||
If hSymbol.LineNumber Then
|
||||
If hSymbol.LineNumber And If Not bPopupHelp Then
|
||||
Project.SavePosition()
|
||||
Project.OpenFile(hSymbol.Class, hSymbol.LineNumber)
|
||||
Else
|
||||
MHelp.GotoSymbol(hSymbol)
|
||||
If bPopupHelp Then
|
||||
FHelp.ShowSymbolHelp(Editor, hSymbol)
|
||||
Else
|
||||
MHelp.GotoSymbol(hSymbol)
|
||||
Endif
|
||||
Endif
|
||||
|
||||
End
|
||||
|
||||
Private Sub ShowHelp()
|
||||
|
||||
Dim sLig As String
|
||||
Dim iCol As Integer
|
||||
Dim hSymbol As CSymbolInfo
|
||||
Dim hClass As CClassInfo
|
||||
Dim iCpt As Integer
|
||||
Dim sKeyword As String
|
||||
Dim sKeyword2 As String
|
||||
|
||||
sLig = Highlight.Purge(Editor.Lines[Editor.Line].Text)
|
||||
If Editor.Selected Then
|
||||
If Editor.Selection.EndLine > Editor.Selection.StartLine Then Return
|
||||
iCol = Editor.Selection.EndColumn
|
||||
Else
|
||||
iCol = Editor.Column
|
||||
Endif
|
||||
|
||||
Repeat
|
||||
Inc iCol
|
||||
If iCol > Len(sLig) Then Break
|
||||
Until InStr(IDENT_CAR, Mid$(sLig, iCol, 1)) = 0
|
||||
|
||||
If iCol < Len(sLig) Then
|
||||
If InStr("[(", Mid$(sLig, iCol, 1)) Then
|
||||
Inc iCol
|
||||
Endif
|
||||
Endif
|
||||
|
||||
sLig = Left$(sLig, iCol - 1)
|
||||
|
||||
|
||||
If Right(sLig) = "[" Then sLig &= "]"
|
||||
|
||||
Highlight.Analyze(sLig)
|
||||
'IF IsCurrentProc() THEN RETURN
|
||||
|
||||
iCpt = Highlight.Types.Count - 1
|
||||
|
||||
If iCpt >= 0 Then
|
||||
If IsKeyword(iCpt) Then
|
||||
|
||||
sKeyword = Highlight.Symbols[iCpt]
|
||||
If iCpt > 0 Then
|
||||
Dec iCpt
|
||||
If IsKeyword(iCpt) Then
|
||||
sKeyword2 = Highlight.Symbols[iCpt] & sKeyword
|
||||
Endif
|
||||
Endif
|
||||
FHelp.ShowKeywordHelp(Editor, sKeyword, sKeyword2)
|
||||
'MHelp.GotoKeyword(sKeyword, sKeyword2)
|
||||
Return
|
||||
|
||||
Else If Highlight.Types[iCpt] = Highlight.DataType Then
|
||||
|
||||
sKeyword = Highlight.Symbols[iCpt]
|
||||
If FHelp.ShowDataTypeHelp(Editor, sKeyword) Then
|
||||
hClass = CComponent.Classes[sKeyword]
|
||||
If hClass Then
|
||||
FHelp.ShowClassHelp(Editor, hClass.Component, hClass.Name)
|
||||
'MHelp.GotoClass(hClass.Component, hClass.Name)
|
||||
Endif
|
||||
Endif
|
||||
Return
|
||||
Endif
|
||||
Endif
|
||||
|
||||
'Editor.Analyze(Left$(sLig, iCol - 1))
|
||||
hSymbol = GetExpressionSymbol(Highlight.Symbols, Highlight.Types)
|
||||
If Not hSymbol Then Return
|
||||
|
||||
'PRINT hSymbol.Class
|
||||
|
||||
'If hSymbol.LineNumber Then
|
||||
' Project.SavePosition()
|
||||
' Project.OpenFile(hSymbol.Class, hSymbol.LineNumber)
|
||||
'Else
|
||||
FHelp.ShowSymbolHelp(Editor, hSymbol)
|
||||
'MHelp.GotoSymbol(hSymbol)
|
||||
'Endif
|
||||
|
||||
End
|
||||
' Private Sub ShowHelp()
|
||||
'
|
||||
' Dim sLig As String
|
||||
' Dim iCol As Integer
|
||||
' Dim hSymbol As CSymbolInfo
|
||||
' Dim hClass As CClassInfo
|
||||
' Dim iCpt As Integer
|
||||
' Dim sKeyword As String
|
||||
' Dim sKeyword2 As String
|
||||
'
|
||||
' sLig = Highlight.Purge(Editor.Lines[Editor.Line].Text)
|
||||
' If Editor.Selected Then
|
||||
' If Editor.Selection.EndLine > Editor.Selection.StartLine Then Return
|
||||
' iCol = Editor.Selection.EndColumn
|
||||
' Else
|
||||
' iCol = Editor.Column
|
||||
' Endif
|
||||
'
|
||||
' Repeat
|
||||
' Inc iCol
|
||||
' If iCol > Len(sLig) Then Break
|
||||
' Until InStr(IDENT_CAR, Mid$(sLig, iCol, 1)) = 0
|
||||
'
|
||||
' If iCol < Len(sLig) Then
|
||||
' If InStr("[(", Mid$(sLig, iCol, 1)) Then
|
||||
' Inc iCol
|
||||
' Endif
|
||||
' Endif
|
||||
'
|
||||
' sLig = Left$(sLig, iCol - 1)
|
||||
'
|
||||
'
|
||||
' If Right(sLig) = "[" Then sLig &= "]"
|
||||
'
|
||||
' Highlight.Analyze(sLig)
|
||||
' 'IF IsCurrentProc() THEN RETURN
|
||||
'
|
||||
' iCpt = Highlight.Types.Count - 1
|
||||
'
|
||||
' If iCpt >= 0 Then
|
||||
' If IsKeyword(iCpt) Then
|
||||
'
|
||||
' sKeyword = Highlight.Symbols[iCpt]
|
||||
' If iCpt > 0 Then
|
||||
' Dec iCpt
|
||||
' If IsKeyword(iCpt) Then
|
||||
' sKeyword2 = Highlight.Symbols[iCpt] & sKeyword
|
||||
' Endif
|
||||
' Endif
|
||||
' FHelp.ShowKeywordHelp(Editor, sKeyword, sKeyword2)
|
||||
' 'MHelp.GotoKeyword(sKeyword, sKeyword2)
|
||||
' Return
|
||||
'
|
||||
' Else If Highlight.Types[iCpt] = Highlight.DataType Then
|
||||
'
|
||||
' sKeyword = Highlight.Symbols[iCpt]
|
||||
' If FHelp.ShowDataTypeHelp(Editor, sKeyword) Then
|
||||
' hClass = CComponent.Classes[sKeyword]
|
||||
' If hClass Then
|
||||
' FHelp.ShowClassHelp(Editor, hClass.Component, hClass.Name)
|
||||
' 'MHelp.GotoClass(hClass.Component, hClass.Name)
|
||||
' Endif
|
||||
' Endif
|
||||
' Return
|
||||
' Endif
|
||||
' Endif
|
||||
'
|
||||
' 'Editor.Analyze(Left$(sLig, iCol - 1))
|
||||
' hSymbol = GetExpressionSymbol(Highlight.Symbols, Highlight.Types)
|
||||
' If Not hSymbol Then Return
|
||||
'
|
||||
' 'PRINT hSymbol.Class
|
||||
'
|
||||
' 'If hSymbol.LineNumber Then
|
||||
' ' Project.SavePosition()
|
||||
' ' Project.OpenFile(hSymbol.Class, hSymbol.LineNumber)
|
||||
' 'Else
|
||||
' FHelp.ShowSymbolHelp(Editor, hSymbol)
|
||||
' 'MHelp.GotoSymbol(hSymbol)
|
||||
' 'Endif
|
||||
'
|
||||
' End
|
||||
|
||||
Public Sub OnProjectDebug()
|
||||
|
||||
|
@ -2741,7 +2758,7 @@ End
|
|||
|
||||
Public Sub mnuDefinition_Click()
|
||||
|
||||
FindDefinition
|
||||
FindDefinition(False)
|
||||
|
||||
End
|
||||
|
||||
|
@ -2835,6 +2852,6 @@ End
|
|||
|
||||
Public Sub timShowHelp_Timer()
|
||||
|
||||
ShowHelp
|
||||
FindDefinition(True)
|
||||
|
||||
End
|
||||
|
|
|
@ -1501,13 +1501,16 @@ End
|
|||
|
||||
|
||||
|
||||
Public Sub OpenForm(sName As String, Optional sModule As String = "form")
|
||||
Public Sub OpenForm(sName As String, Optional sModule As String = "form", Optional sControl As String)
|
||||
|
||||
Dim sPath As String
|
||||
|
||||
Dim hForm As FForm
|
||||
sPath = $cSourceDir[sName & "." & sModule]
|
||||
If Exist(sPath) Then OpenFile(sPath)
|
||||
|
||||
If Exist(sPath) Then
|
||||
hForm = OpenFile(sPath)
|
||||
If sControl Then hForm.SelectControl(sControl)
|
||||
Endif
|
||||
|
||||
End
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue