[DEVELOPMENT ENVIRONMENT]

* BUG: Editor: Completion popup now opens at the right position on wrapped lines.
* NEW: Text editor: Show compression message inside the editor.


git-svn-id: svn://localhost/gambas/trunk@7642 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2016-03-19 00:00:15 +00:00
parent cf3ac47267
commit 6e894e0df3
4 changed files with 22 additions and 17 deletions

View file

@ -59,6 +59,7 @@ Public Sub Open(hForm As Object, sMode As String, Optional sClass As String, Opt
Dim hCont As Container
Dim sText As String
Dim W, H As Integer
Dim hPos As Point
If hForm.GetEditor() <> $hEditor Then HideFrom($hEditor)
$bHideLater = False
@ -180,11 +181,13 @@ Public Sub Open(hForm As Object, sMode As String, Optional sClass As String, Opt
sText &= Key.Text
Endif
iX = $hEditor.X + $hEditor.ToPosX(0) + $hEditor.TextWidth(sText)
hPos = $hEditor.ToPos($hEditor.Line, $iCol)
iX = $hEditor.X + hPos.X
iX = Max(0, Min(iX, $hEditor.Window.ClientW - Me.Width))
iY = $hEditor.Y + $hEditor.ToPosY() + $hEditor.Current.Height
iY = hPos.Y + $hEditor.LineHeight
If (iY + Me.Height) > ($hEditor.Y + $hEditor.H) Then
iY = $hEditor.Y + $hEditor.ToPosY() - Me.Height

View file

@ -2606,7 +2606,7 @@ Public Sub ShowWatchResult(sStr As String, X As Integer, Y As Integer)
bError = True
Endif
$hEditor.ShowMessageLabel(Html(sStr), X, Y, bError)
$hEditor.ShowMessageLabel(Html(sStr), X, Y, If(bError, Highlight.Breakpoint, Highlight.CurrentLine))
End
@ -2653,7 +2653,7 @@ Public Sub ShowErrorMessage(sMsg As String, (sIcon) As String)
$hEditor.SetFocus
Wait
$hEditor.ShowMessageLabel(sMsg, $hEditor.ToPosX(), $hEditor.ToPosY() + $hEditor.LineHeight, True)
$hEditor.ShowMessageLabel(sMsg, $hEditor.ToPosX(), $hEditor.ToPosY() + $hEditor.LineHeight, Highlight.Breakpoint)
End

View file

@ -876,7 +876,7 @@ Public Sub Compress() As Boolean
$hEditor.Save(sPath)
Endif
SetText(sText)
CompressMessage = "<b>" & Subst(("The file has been compressed from &1 to &2 bytes (&3)."), Str(iLen), Str(Len(sText)), Format(fGain, "#.##%")) & "</b><p>" & ("Original file has been saved in the <b>Project</b> folder.")
CompressMessage = "<b>" & Subst(("The file has been compressed from &1 to &2 bytes (&3)."), Str(iLen), Str(Len(sText)), Format(fGain, "#.##%")) & "</b> " & ("Original file has been saved in the <b>Project</b> folder.")
Endif
Catch
@ -893,7 +893,7 @@ Public Sub mnuCompress_Click()
If Compress() Then
FMain.ShowError(CompressMessage)
Else
If CompressMessage Then FMain.ShowInfo(CompressMessage)
If CompressMessage Then $hEditor.ShowMessageLabel(CompressMessage)
Endif
End
@ -993,7 +993,7 @@ Public Sub ShowErrorMessage(sMsg As String, (sIcon) As String)
$hEditor.SetFocus
Wait
$hEditor.ShowMessageLabel(sMsg, $hEditor.ToPosX(), $hEditor.ToPosY() + $hEditor.LineHeight, True)
$hEditor.ShowMessageLabel(sMsg, $hEditor.ToPosX(), $hEditor.ToPosY() + $hEditor.LineHeight, Highlight.Breakpoint)
End

View file

@ -201,35 +201,37 @@ Public Sub Label_MouseDown()
End
Public Sub ShowMessageLabel(sStr As String, X As Integer, Y As Integer, Optional bError As Boolean)
Public Sub ShowMessageLabel(sStr As String, Optional X As Integer, Y As Integer, iStyle As Integer)
Dim hParent As Container
If Not $hLabel Then
hParent = Me.Parent
If hParent Is HSplit Or If hParent Is VSplit Then hParent = hParent.Parent
$hLabel = New TextLabel(hParent) As "Label"
$hLabel.Ignore = True
$hLabel.AutoResize = True
$hLabel.Border = Border.Plain
$hLabel.Border = If(IsMissing(Y), Border.None, Border.Plain)
$hLabel.Padding = 2
$hLabel.Wrap = False
$hLabelTimer = New Timer As "LabelTimer"
$hLabelTimer.Delay = 10000
Endif
$hLabel.Foreground = Me.Styles[Highlight.Normal].Color
If IsMissing(iStyle) Then iStyle = Highlight.Highlight
$hLabel.Background = Color.Merge(Me.Styles[iStyle].Color, Style.BackgroundOf(Me), 0.3)
$hLabel.Text = "&nbsp;&nbsp;" & Replace(Replace(sStr, "<p>", " "), "<br>", " ") & "&nbsp;&nbsp;"
If IsMissing(X) Then X = 0
If IsMissing(Y) Then Y = Container(Me.Proxy).ClientH - $hLabel.H
X = Me.ScreenX + X - $hLabel.Parent.ScreenX
Y = Me.ScreenY + Y - $hLabel.Parent.ScreenY
$hLabel.Foreground = Me.Styles[Highlight.Normal].Color
If bError Then
$hLabel.Background = Color.Merge(Me.Styles[Highlight.Breakpoint].Color, Style.BackgroundOf(Me), 0.3)
Else
$hLabel.Background = Color.Merge(Me.Styles[Highlight.CurrentLine].Color, Style.BackgroundOf(Me), 0.3)
Endif
$hLabel.Text = Replace(Replace(sStr, "<p>", " "), "<br>", " ")
If (Y + $hLabel.H) > $hLabel.Parent.ClientH Then Y -= $hLabel.H + Me.LineHeight
$hLabel.Move(X, Y)