diff --git a/app/src/gambas3/.src/Editor/Code/CCompletion.class b/app/src/gambas3/.src/Editor/Code/CCompletion.class index e826683bd..28d78cd9c 100644 --- a/app/src/gambas3/.src/Editor/Code/CCompletion.class +++ b/app/src/gambas3/.src/Editor/Code/CCompletion.class @@ -98,7 +98,7 @@ Public Sub CheckCompletion_Timer() hEditor.Goto(iSave, hEditor.Line) Endif - Return + Goto CHECK_SIGNATURE Endif @@ -108,6 +108,10 @@ Public Sub CheckCompletion_Timer() $hModule.CheckCompletion() +CHECK_SIGNATURE: + + Try $hModule.CheckSignature() + End Public Sub OnKeyPress() As Boolean @@ -275,3 +279,4 @@ Public Sub GetRightString(sLine As String) As String If bInside Then Return Mid$(sLine, iPos + 1) End + diff --git a/app/src/gambas3/.src/Editor/Code/FCompletion.class b/app/src/gambas3/.src/Editor/Code/FCompletion.class index 18900421a..9f7cea48a 100644 --- a/app/src/gambas3/.src/Editor/Code/FCompletion.class +++ b/app/src/gambas3/.src/Editor/Code/FCompletion.class @@ -108,6 +108,8 @@ Public Sub Position(hEditor As TextEditor) hCont = hCont.Parent Loop + FixPosition($hEditor, ByRef iX, ByRef iY) + Dec Application.Busy If Me.Parent = $hForm And If iX = Me.X And iY = Me.Y And Me.Visible Then Return @@ -120,6 +122,46 @@ Public Sub Position(hEditor As TextEditor) End +Static Public Sub FixPosition(hEditor As TextEditor, Optional ByRef X As Integer, ByRef Y As Integer) + + Dim bCompletion As Boolean + Dim bSignature As Boolean + + If IsMissing(X) And If IsMissing(Y) Then + bCompletion = FCompletion.VisibleFrom(hEditor) + bSignature = True + Else + bCompletion = True + bSignature = FSignature.VisibleFrom(hEditor) + Endif + + If bCompletion And If bSignature Then + + If IsMissing(X) And If IsMissing(Y) Then + X = FCompletion.X + Y = FCompletion.Y + Endif + + 'Debug Y;; "/";; FSignature.Y;; FSignature.H + + If X >= FSignature.X And If X + Me.W <= FSignature.X + FSignature.W Then + + If Y = FSignature.Y Then + Y += FSignature.H - 1 + Else If Y + FCompletion.H = FSignature.Y + FSignature.H Then + Y -= FSignature.H - 1 + Endif + + If IsMissing(X) And If IsMissing(Y) Then + FCompletion.Move(X, Y) + Endif + + Endif + + Endif + +End + Public Sub Open(hCompletion As CCompletion, sMode As String, Optional sClass As String, Optional bStatic As Boolean, Optional bHidden As Boolean) @@ -787,59 +829,61 @@ Public Function ManageKey() As Boolean Case Key.Up, Key.PageUp - iRow = gvwComp.Row - If(Key.Code = Key.Up, 1, 8) - If iRow < 0 Then iRow = gvwComp.Rows.Count - 1 + iRow = gvwComp.Row - If(Key.Code = Key.Up, 1, gvwComp.ClientH \ gvwComp.Rows.Height) + If Key.Code = Key.Up Then + If iRow < 0 Then iRow = gvwComp.Rows.Count - 1 + Else + If iRow < 0 Then iRow = 0 + Endif gvwComp.Row = iRow $bUserChoice = True Case Key.Down, Key.PageDown - iRow = gvwComp.Row + If(Key.Code = Key.Down, 1, 8) - If iRow >= gvwComp.Rows.Count Then iRow = 0 + iRow = gvwComp.Row + If(Key.Code = Key.Down, 1, gvwComp.ClientH \ gvwComp.Rows.Height) + If Key.Code = Key.Down Then + If iRow >= gvwComp.Rows.Count Then iRow = 0 + Else + If iRow >= gvwComp.Rows.Count Then iRow = gvwComp.Rows.Max + Endif gvwComp.Row = iRow $bUserChoice = True Case Key.Home - If gvwComp.Row = 0 Then - HideMe - Return - Endif + If gvwComp.Row = 0 Then Goto HIDE_ME gvwComp.Row = 0 $bUserChoice = True Case Key.End - If gvwComp.Row = gvwComp.Rows.Count - 1 Then - HideMe - Return - Endif + If gvwComp.Row = gvwComp.Rows.Count - 1 Then Goto HIDE_ME gvwComp.Row = gvwComp.Rows.Count - 1 $bUserChoice = True - Case Key.Escape - HideMe - - Case Key.Left, Key.Right - HideMe - Return + Case Key.Escape, Key.Left, Key.Right + + Goto HIDE_ME Case Key.Enter, Key.Return + InsertItem 'IF Key.Code <> Key.Tab THEN RETURN Case Key.Space + If Key.Control Then If UCase($sText) = "NEW" Then Return InsertItem(True) + Return False Else - HideMe + Goto HIDE_ME Endif - Return False Case Key.Backspace + 'Debug $iLen;; $sText If String.Len($sText) > $iLen Then SetText(String.Left$($sText, -1)) @@ -866,38 +910,49 @@ Public Function ManageKey() As Boolean $sText &= Key.Text Return FindItem() - Else If InStr(FEditor.IDENT_CAR, Key.Text) Then + Else If Key.Text = "[" And If Not $sText Then + + Else If InStr(FEditor.IDENT_CAR, Key.Text) And If Key.Text <> "$" Then If Key.Text = "_" Then - If GetEvents($sText) Then - HideMe - Return - Endif + If GetEvents($sText) Then Goto HIDE_ME Endif Return SetText($sText & Key.Text, True) - Else If Key.Text = "[" And If Not $sText Then + Else If $bGambas And If InStr(". A<", $sMode) Then - HideMe + If InStr("([.!$", Key.Text) > 0 Then - Else If $bGambas And If InStr("([.!", Key.Text) > 0 And If InStr(". A<", $sMode) Then - - InsertItem - - Else - - HideMe + InsertItem + Return + + Else If InStr("=+-*/^", Key.Text) Then + + InsertItem(False, " " & Key.Text & " ") + Return True + + Else If InStr(":", Key.Text) Then + + InsertItem(False, ": ") + Return True + + Endif Endif - - Return False + + Goto HIDE_ME Endif End Select Return True + +HIDE_ME: + + HideMe + Return End @@ -952,7 +1007,7 @@ Private Function FindItem(Optional bNoInsert As Boolean) As Boolean End -Private Function InsertItem(Optional bNoSpace As Boolean) As Boolean +Private Function InsertItem(Optional bNoSpace As Boolean, sMore As String) As Boolean Dim sText As String Dim hClass As CClassInfo @@ -961,7 +1016,7 @@ Private Function InsertItem(Optional bNoSpace As Boolean) As Boolean Try sText = gvwComp.Current.Text If Not sText Then Return True - + If gvwComp[gvwComp.Row, 0].Picture = Picture["$symbol:event"] Then If $hForm.IsProc($hEditor[$hEditor.Line].Text) Then hClass = Project.Documentation.Classes[$sEventClass] @@ -973,6 +1028,9 @@ Private Function InsertItem(Optional bNoSpace As Boolean) As Boolean If bNoSpace Then If Right(sText) = " " Then sText = Left$(sText, -1) + Else If sMore Then + If sMore Begins " " Then sText = RTrim(sText) + sText &= sMore Endif With $hEditor diff --git a/app/src/gambas3/.src/Editor/Code/FEditor.class b/app/src/gambas3/.src/Editor/Code/FEditor.class index fe1c86566..6b58e3995 100644 --- a/app/src/gambas3/.src/Editor/Code/FEditor.class +++ b/app/src/gambas3/.src/Editor/Code/FEditor.class @@ -77,7 +77,7 @@ Private $hCompletion As CCompletion Private $hInsertDate As CInsertDate Private $bDiffMode As Boolean -Private $hTimerSignature As Timer +'Private $hTimerSignature As Timer 'Static Private $cLastClassCount As New Collection @@ -122,8 +122,8 @@ Public Sub _new(sPath As String) $hCompletion = New CCompletion(Me) $hInsertDate = New CInsertDate(Me, btnInsertDate) - $hTimerSignature = New Timer As "CheckSignature" - $hTimerSignature.Delay = 50 + ' $hTimerSignature = New Timer As "CheckSignature" + ' $hTimerSignature.Delay = 50 ReadConfig Refresh @@ -381,7 +381,6 @@ Private Sub RefreshLineInfo(Optional bForce As Boolean) As Boolean Else If $bCheckSignature Or If FSignature.VisibleFrom($hEditor) Then - $bCheckSignature = False CheckSignature Endif @@ -2154,23 +2153,16 @@ Private Function GetExpressionSymbol(aExpr As String[], aType As Integer[]) As C End -Private Sub CheckSignature() +Public Sub CheckSignature() - If Not $hCompletion.Enabled Then Return - CheckSignature_Timer - - '$hTimerSignature.Restart - -End - -Public Sub CheckSignature_Timer() - Dim sLig As String Dim hSymbol As CSymbolInfo Dim sKind As String - $hTimerSignature.Stop + If Not $hCompletion.Enabled Then Return + $bCheckSignature = False + 'sLig = Left$(edtEditor.GetPurgedLine(edtEditor.Line), edtEditor.Column) & sText sLig = String.Left$(Highlight.Purge($hEditor.Current.Text), $hEditor.Column) Highlight.Analyze(sLig) diff --git a/app/src/gambas3/.src/Editor/Code/FSignature.class b/app/src/gambas3/.src/Editor/Code/FSignature.class index f23b6e63b..221d5bc08 100644 --- a/app/src/gambas3/.src/Editor/Code/FSignature.class +++ b/app/src/gambas3/.src/Editor/Code/FSignature.class @@ -81,19 +81,20 @@ Private Sub UpdateSignature(Optional hForm As FEditor) iX -= 3 iX = Max(0, Min(iX, $hEditor.W - Me.Width)) - + If Not hForm Then Me.Move(iX, iY) - Return + Else + If Me.Parent <> hForm Or If iX <> Me.X Or If iY <> Me.Y Or If Me.Visible Then + Me.Reparent(hForm, iX, iY) + Me.Show + Me.Raise + $hEditor.SetFocus + Endif Endif - If Me.Parent = hForm And If iX = Me.X And iY = Me.Y And Me.Visible Then Return + FCompletion.FixPosition($hEditor) - Me.Reparent(hForm, iX, iY) - Me.Show - Me.Raise - $hEditor.SetFocus - End Public Sub Position(hForm As FEditor) diff --git a/app/src/gambas3/.src/Project/FOpenProject.form b/app/src/gambas3/.src/Project/FOpenProject.form index 353769116..0b38ad171 100644 --- a/app/src/gambas3/.src/Project/FOpenProject.form +++ b/app/src/gambas3/.src/Project/FOpenProject.form @@ -40,7 +40,6 @@ Border = Border.Plain { txtFilter ButtonBox MoveScaled(0,0,24,4) - Foreground = Color.LightForeground Picture = Picture["icon:/small/clear"] Border = False } diff --git a/app/src/gambas3/.src/Welcome/FWelcome.form b/app/src/gambas3/.src/Welcome/FWelcome.form index 2965b8cc0..adae19be6 100644 --- a/app/src/gambas3/.src/Welcome/FWelcome.form +++ b/app/src/gambas3/.src/Welcome/FWelcome.form @@ -62,21 +62,18 @@ Padding = 1 { txtFilter ButtonBox MoveScaled(1,0,5,4) - Foreground = Color.LightForeground Picture = Picture["icon:/small/clear"] Border = False } { txtFilterExample ButtonBox MoveScaled(7,0,5,4) Visible = False - Foreground = Color.LightForeground Picture = Picture["icon:/small/clear"] Border = False } { txtFilterSoft ButtonBox MoveScaled(13,0,6,4) Visible = False - Foreground = Color.LightForeground Picture = Picture["icon:/small/clear"] Border = False }