From 263b03d1be53e68e49b956e4225ba89cc12c939e Mon Sep 17 00:00:00 2001 From: Fabien Bodard Date: Thu, 30 Jul 2009 19:22:55 +0000 Subject: [PATCH] [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 --- app/src/gambas3/.src/Debug/FHelp.class | 42 ++-- .../gambas3/.src/Editor/Code/FEditor.class | 203 ++++++++++-------- app/src/gambas3/.src/Project.module | 11 +- 3 files changed, 143 insertions(+), 113 deletions(-) diff --git a/app/src/gambas3/.src/Debug/FHelp.class b/app/src/gambas3/.src/Debug/FHelp.class index 96a22168c..52ca20f16 100644 --- a/app/src/gambas3/.src/Debug/FHelp.class +++ b/app/src/gambas3/.src/Debug/FHelp.class @@ -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, "" & hSymbol.Name & "") txtHelp.RichText &= "
Kind: " @@ -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 &= "" If hSymbol.LineNumber Then - - txtHelp.RichText &= Subst("
Def.: " & "&1.&2 ", hSymbol.Class, hSymbol.LineNumber) - 'Symbole locale - 'sResult = "Syntax
" - - - 'txtHelp.RichText = "Component: This project" & - ' "   Class: " & hSymbol.Class & - ' "   Symbol: " & hSymbol.Name - - txtHelp.RichText &= "
" & GetLocalHelp(hSymbol) + 'Definition + txtHelp.RichText &= Subst("
Def.: " & "&1.&2 ", sClass, hSymbol.LineNumber) + 'Afficher l'aide Locale + txtHelp.RichText &= GetLocalHelp(hSymbol) Else 'Symbole externe - - txtHelp.RichText &= Subst("
&1 > &2", hSymbol.Component, hSymbol.Class) - + 'Afficher le formulaire + If hSymbol.Kind = "t" Then txtHelp.Text &= Subst("
Def.: &1.&2", hSymbol.Class, hSymbol.name) + + 'Filiation + txtHelp.RichText &= Subst("
&1 > &2", 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 &= "
" 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 diff --git a/app/src/gambas3/.src/Editor/Code/FEditor.class b/app/src/gambas3/.src/Editor/Code/FEditor.class index 75ba6e925..753a800a6 100644 --- a/app/src/gambas3/.src/Editor/Code/FEditor.class +++ b/app/src/gambas3/.src/Editor/Code/FEditor.class @@ -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 diff --git a/app/src/gambas3/.src/Project.module b/app/src/gambas3/.src/Project.module index f4bce5391..596560976 100644 --- a/app/src/gambas3/.src/Project.module +++ b/app/src/gambas3/.src/Project.module @@ -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