[DEVELOPMENT ENVIRONMENT]
* NEW: Now the popup help is a popup top window. The help is showed when you are staying on a word more than one second with the mouse. [GB.QT4.EXT] * NEW: The function PosToCol of the editor now return false if the mouse is not on the text. git-svn-id: svn://localhost/gambas/trunk@2252 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
13234bbff7
commit
911e1d6e8e
6 changed files with 81 additions and 59 deletions
|
@ -702,7 +702,7 @@ Public Sub timBreakpoint_Timer()
|
|||
Wend
|
||||
|
||||
hEditor = Project.Files[Project.FindPath(sClass)]
|
||||
If Not hEditor Then Continue
|
||||
'If Not hEditor Then Continue
|
||||
For Each iInd In hEditor.GetBreakpoints()
|
||||
sProc = hEditor.GetProcAt(iInd)
|
||||
cvwBreak.Add(sClass & "." & sProc & "." & CStr(iInd), sClass)
|
||||
|
|
|
@ -21,6 +21,9 @@ Private $iPosSignature As Integer
|
|||
Private $bCompletion As Boolean
|
||||
Private $bCleanOnSave As Boolean
|
||||
Private $bShowPopupHelp As Boolean
|
||||
Private $X As Integer
|
||||
Private $Y As Integer
|
||||
|
||||
|
||||
Static Private $hVirtualSymbol As New CSymbolInfo
|
||||
|
||||
|
@ -2177,7 +2180,7 @@ Private Function IsKeyword(iCpt As Integer) As Boolean
|
|||
End
|
||||
|
||||
|
||||
Private Sub FindDefinition(bPopupHelp As Boolean)
|
||||
Private Sub FindDefinition(bPopupHelp As Boolean, Optional iX As Integer, Optional iY As Integer)
|
||||
|
||||
Dim sLig As String
|
||||
Dim iCol As Integer
|
||||
|
@ -2186,15 +2189,24 @@ Private Sub FindDefinition(bPopupHelp As Boolean)
|
|||
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
|
||||
Dim iLine As Integer
|
||||
|
||||
If Not bPopupHelp Then
|
||||
iLine = Editor.Line
|
||||
iCol = Editor.Column
|
||||
If Editor.Selected Then
|
||||
If Editor.Selection.EndLine > Editor.Selection.StartLine Then Return
|
||||
iCol = Editor.Selection.EndColumn
|
||||
Else
|
||||
iCol = Editor.Column
|
||||
Endif
|
||||
Else
|
||||
iCol = Editor.PosToColumn(iX, iY)
|
||||
iLine = Editor.PosToLine(iY)
|
||||
Endif
|
||||
|
||||
|
||||
sLig = Highlight.Purge(Editor.Lines[iLine].Text)
|
||||
|
||||
Repeat
|
||||
Inc iCol
|
||||
If iCol > Len(sLig) Then Break
|
||||
|
@ -2208,8 +2220,9 @@ Private Sub FindDefinition(bPopupHelp As Boolean)
|
|||
|
||||
sLig = Left$(sLig, iCol - 1)
|
||||
If Right(sLig) = "[" Then sLig &= "]"
|
||||
|
||||
'Editor.ShowWord(iLine, iCol, 3)
|
||||
Highlight.Analyze(sLig)
|
||||
Print sLig
|
||||
'IF IsCurrentProc() THEN RETURN
|
||||
|
||||
iCpt = Highlight.Types.Count - 1
|
||||
|
@ -2226,7 +2239,7 @@ Private Sub FindDefinition(bPopupHelp As Boolean)
|
|||
Endif
|
||||
|
||||
If bPopupHelp Then
|
||||
FHelp.ShowKeywordHelp(Editor, sKeyword, sKeyword2)
|
||||
FHelp.ShowKeywordHelp(Editor, sKeyword, sKeyword2, iX, iY)
|
||||
Else
|
||||
MHelp.GotoKeyword(sKeyword, sKeyword2)
|
||||
Endif
|
||||
|
@ -2235,10 +2248,10 @@ Private Sub FindDefinition(bPopupHelp As Boolean)
|
|||
Else If Highlight.Types[iCpt] = Highlight.DataType Then
|
||||
sKeyword = Highlight.Symbols[iCpt]
|
||||
If bPopupHelp Then
|
||||
If FHelp.ShowDatatypeHelp(Editor, sKeyword) Then
|
||||
If FHelp.ShowDatatypeHelp(Editor, sKeyword, ix, iy) Then
|
||||
hClass = CComponent.Classes[sKeyword]
|
||||
If hClass Then
|
||||
FHelp.ShowClassHelp(Editor, hClass.Component, hClass.Name)
|
||||
FHelp.ShowClassHelp(Editor, hClass.Component, hClass.Name, iX, iY)
|
||||
Endif
|
||||
Endif
|
||||
Else
|
||||
|
@ -2264,7 +2277,7 @@ Private Sub FindDefinition(bPopupHelp As Boolean)
|
|||
Project.OpenFile(hSymbol.Class, hSymbol.LineNumber)
|
||||
Else
|
||||
If bPopupHelp Then
|
||||
FHelp.ShowSymbolHelp(Editor, hSymbol)
|
||||
FHelp.ShowSymbolHelp(Editor, hSymbol, iX, iY)
|
||||
Else
|
||||
MHelp.GotoSymbol(hSymbol)
|
||||
Endif
|
||||
|
@ -2351,15 +2364,31 @@ Public Sub Editors_GotFocus()
|
|||
|
||||
End
|
||||
|
||||
Public Sub Editors_MouseMove()
|
||||
|
||||
If Not Project.Running Then
|
||||
If FDebugInfo.IsHelpVisible() Or $bShowPopupHelp Then
|
||||
If Not timShowHelp.Enabled Then
|
||||
timShowHelp.Enabled = True
|
||||
|
||||
Endif
|
||||
Endif
|
||||
$X = Mouse.X
|
||||
$Y = Mouse.Y
|
||||
Endif
|
||||
|
||||
End
|
||||
|
||||
|
||||
Public Sub Editors_MouseUp()
|
||||
|
||||
HideMessage
|
||||
If Not Editor.Selected Then Return
|
||||
If Editor.Selection.StartLine < Editor.Selection.EndLine Then Return
|
||||
If Not Project.Running Then
|
||||
If FDebugInfo.IsHelpVisible() Or $bShowPopupHelp Then timShowHelp.Trigger
|
||||
Return
|
||||
Endif
|
||||
'If Not Project.Running Then
|
||||
'If FDebugInfo.IsHelpVisible() Or $bShowPopupHelp Then timShowHelp.Trigger
|
||||
' Return
|
||||
'Endif
|
||||
|
||||
FDebugInfo.InstantWatch(Trim(Editor.Selection.Text), Editor,
|
||||
Editor.CursorX + Editor.CharWidth * ((Editor.Selection.StartColumn + Editor.Selection.EndColumn) / 2 - Editor.Column),
|
||||
|
@ -2784,6 +2813,6 @@ End
|
|||
|
||||
Public Sub timShowHelp_Timer()
|
||||
|
||||
FindDefinition(True)
|
||||
|
||||
If Editor.PosToColumn($X, $Y) Then FindDefinition(True, $X, $Y)
|
||||
timShowHelp.Enabled = False
|
||||
End
|
||||
|
|
|
@ -1,44 +1,31 @@
|
|||
' Gambas class file
|
||||
|
||||
|
||||
Private Sub ShowHelp(hEditor As Editor)
|
||||
Dim iX, iY As Integer
|
||||
|
||||
Private Sub ShowHelp(hEditor As Editor, iX As Integer, iy As Integer)
|
||||
'Dim iX, iY As Integer
|
||||
Dim hCont As Container
|
||||
|
||||
If Not FDebugInfo.IsHelpVisible() Then
|
||||
Me.Background = Color.LightBackground
|
||||
Me.Ignore = True
|
||||
Me.Reparent(hEditor.Parent)
|
||||
Me.Reparent(Null)
|
||||
Me.Height = Min(txtHelp.TextHeight + 15, Desktop.Height / 4)
|
||||
Me.Width = Desktop.Width / 3
|
||||
iY = hEditor.Y + hEditor.CursorY + 20 + hEditor.LineHeight
|
||||
Me.Padding = 2
|
||||
|
||||
If (iY + Me.Height) > (hEditor.Y + hEditor.H) Then
|
||||
iY = hEditor.Y + hEditor.CursorY - 15 - Me.Height
|
||||
Endif
|
||||
|
||||
hcont = hEditor.Parent
|
||||
iX = hEditor.CursorX
|
||||
|
||||
Do
|
||||
If hCont Is Form Then Break
|
||||
|
||||
iX += hCont.X
|
||||
iY += hCont.Y
|
||||
hCont = hCont.Parent
|
||||
Loop
|
||||
|
||||
iX = Max(0, Min(iX, hEditor.W - Me.Width))
|
||||
Me.Move(iX, iY)
|
||||
|
||||
'iX = Max(0, Min(iX, hEditor.W - Me.Width))
|
||||
Me.Move(hEditor.ScreenX + iX + 15, hEditor.ScreenY + iY + hEditor.LineHeight + 15)
|
||||
Me.Visible = True
|
||||
Form_Show
|
||||
hEditor.Window.SetFocus
|
||||
hEditor.SetFocus
|
||||
Endif
|
||||
|
||||
End
|
||||
|
||||
|
||||
Public Sub ShowKeywordHelp(hEditor As Editor, sName As String, Optional sName2 As String) As Boolean
|
||||
Public Sub ShowKeywordHelp(hEditor As Editor, sName As String, Optional sName2 As String, iX As Integer, iY As Integer) As Boolean
|
||||
Dim sPath As String
|
||||
|
||||
txtHelp.RichText = "<b>" & sName & "</b>"
|
||||
|
@ -53,7 +40,7 @@ Public Sub ShowKeywordHelp(hEditor As Editor, sName As String, Optional sName2 A
|
|||
sPath = GetPath("help/lang" &/ LCase(sName)) & ".html"
|
||||
If Not Exist(sPath) Then Return True
|
||||
txtHelp.RichText &= GetHelp(sPath)
|
||||
ShowHelp(hEditor)
|
||||
ShowHelp(hEditor, iX, iY)
|
||||
|
||||
Catch
|
||||
Return True
|
||||
|
@ -61,7 +48,7 @@ Catch
|
|||
End
|
||||
|
||||
|
||||
Public Sub ShowSymbolHelp(hEditor As Editor, hSymbol As CSymbolInfo)
|
||||
Public Sub ShowSymbolHelp(hEditor As Editor, hSymbol As CSymbolInfo, iX As Integer, iY As Integer)
|
||||
Dim sLink As String
|
||||
Dim sName As String
|
||||
Dim sComp As String
|
||||
|
@ -129,19 +116,19 @@ Public Sub ShowSymbolHelp(hEditor As Editor, hSymbol As CSymbolInfo)
|
|||
txtHelp.RichText &= GetHelp(sLink)
|
||||
Endif
|
||||
|
||||
ShowHelp(hEditor)
|
||||
ShowHelp(hEditor, iX, iY)
|
||||
|
||||
End
|
||||
|
||||
|
||||
Public Sub ShowClassHelp(hEditor As Editor, sComponent As String, sName As String)
|
||||
Public Sub ShowClassHelp(hEditor As Editor, sComponent As String, sName As String, iX As Integer, iY As Integer)
|
||||
|
||||
'Description de la Classe
|
||||
txtHelp.RichText = "<b>" & sName & "</b>"
|
||||
txtHelp.RichText &= "<br><font color=green>Kind: </font><b>Class</b>"
|
||||
txtHelp.RichText = Subst("<br><font color=blue>&1</font>", sComponent)
|
||||
|
||||
ShowHelp(hEditor)
|
||||
ShowHelp(hEditor, iX, iY)
|
||||
|
||||
End
|
||||
|
||||
|
@ -160,7 +147,7 @@ Private Function GetHelp(sFile As String) As String
|
|||
|
||||
End
|
||||
|
||||
Public Function ShowDatatypeHelp(hEditor As Editor, sName As String) As Boolean
|
||||
Public Function ShowDatatypeHelp(hEditor As Editor, sName As String, iX As Integer, iY As Integer) As Boolean
|
||||
|
||||
Dim sPath As String
|
||||
|
||||
|
@ -171,7 +158,7 @@ Public Function ShowDatatypeHelp(hEditor As Editor, sName As String) As Boolean
|
|||
txtHelp.RichText &= "<br><font color=green>Kind: </font><b>DataType</b>"
|
||||
txtHelp.RichText &= GetHelp(GetPath("help/lang/type" &/ LCase(sName)) & ".html")
|
||||
|
||||
ShowHelp(hEditor)
|
||||
ShowHelp(hEditor, iX, iY)
|
||||
|
||||
End
|
||||
|
||||
|
@ -256,7 +243,7 @@ End
|
|||
Public Sub txtHelp_Leave()
|
||||
|
||||
|
||||
If Not FDebugInfo.IsHelpVisible() Then tmrHide.Enabled = True
|
||||
If Not FDebugInfo.IsHelpVisible() Then Me.Hide 'tmrHide.Enabled = True
|
||||
|
||||
End
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
[Breakpoints]
|
||||
Count=0
|
||||
Breakpoint[1]="DBusObject.80"
|
||||
Count=1
|
||||
|
||||
[DebugWindow]
|
||||
Count=0
|
||||
|
@ -27,11 +28,11 @@ SearchComment=False
|
|||
SearchString=True
|
||||
|
||||
[OpenFile]
|
||||
File[1]="/home/benoit/gambas/3.0/trunk/gb.dbus/src/gb.dbus/.src/MMain.module:22.0"
|
||||
File[2]="/home/benoit/gambas/3.0/trunk/gb.dbus/src/gb.dbus/.src/DBusObject.class:207.4"
|
||||
File[3]="/home/benoit/gambas/3.0/trunk/gb.dbus/src/gb.dbus/.src/DBusApplication.class:43.0"
|
||||
Active=4
|
||||
File[4]="/home/benoit/gambas/3.0/trunk/gb.dbus/src/gb.dbus/.src/DBus.class:32.0"
|
||||
Active=1
|
||||
File[1]="/home/fabien/gambas/gb.dbus/src/gb.dbus/.src/DBusObject.class:100.25"
|
||||
File[2]="/home/fabien/gambas/gb.dbus/src/gb.dbus/.src/MMain.module:23.0"
|
||||
File[3]="/home/fabien/gambas/gb.dbus/src/gb.dbus/.src/DBusApplication.class:55.52"
|
||||
File[4]="/home/fabien/gambas/gb.dbus/src/gb.dbus/.src/DBus.class:32.0"
|
||||
Count=4
|
||||
|
||||
[Watches]
|
||||
|
|
|
@ -78,6 +78,7 @@ Private Sub GetMethodSignature(sMethod As String) As String
|
|||
Endif
|
||||
|
||||
sSignIn &= ":" & sSignOut
|
||||
message("")
|
||||
$cSignature[sMethod] = sSignIn
|
||||
Return sSignIn
|
||||
|
||||
|
|
|
@ -826,9 +826,13 @@ END_METHOD
|
|||
|
||||
BEGIN_METHOD(CEDITOR_pos_to_column, GB_INTEGER x; GB_INTEGER y)
|
||||
|
||||
int line, col;
|
||||
int col, line;
|
||||
|
||||
WIDGET->posToCursor(VARG(x), VARG(y), &line, &col);
|
||||
line = WIDGET->posToLine(VARG(y));
|
||||
col = WIDGET->posToColumn(line, VARG(x)); //posToCursor(VARG(x), VARG(y), &line, &col);
|
||||
col = QMAX(0, col);
|
||||
if (col > DOC->lineLength(line)) { col=false;}
|
||||
|
||||
GB.ReturnInteger(col);
|
||||
|
||||
END_METHOD
|
||||
|
|
Loading…
Reference in a new issue