[DEVELOPMENT ENVIRONMENT]

* NEW: Procedure list contents is now sorted differently: public symbols 
  first, and then static symbols first.


git-svn-id: svn://localhost/gambas/trunk@6464 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2014-09-10 01:36:17 +00:00
parent 3b32652f00
commit d8e7b4e359
4 changed files with 92 additions and 18 deletions

View file

@ -1,7 +1,7 @@
' Gambas class file ' Gambas class file
Static Private $aNativeDatatypes As String[] = ["Boolean 0", "Byte 0", "Short 0", "Integer 0", "Long 0", "Single 0", "Float 0", "Date 0", "String 0", "Object 0", "Variant 0", "Pointer 0"] Static Private $aNativeDatatypes As String[] = ["Boolean 0", "Byte 0", "Short 0", "Integer 0", "Long 0", "Single 0", "Float 0", "Date 0", "String 0", "Object 0", "Variant 0", "Pointer 0"]
Static Private $aSpecialMethods As String[] = ["_attach", "_call", "_compare", "_get", "_init", "_new", "_next", "_property", "_put", "_unknown"] Static Private $aSpecialMethods As String[] = ["_attach", "_call", "_compare", "_get", "_init", "_new", "_next", "_property", "_put", "_unknown", "_exit"]
Static Private $hClassPicture As Picture Static Private $hClassPicture As Picture

View file

@ -494,14 +494,15 @@ Private Sub CreateMenu()
mnuGoto.Children.Clear mnuGoto.Children.Clear
cSymbol = CComponent.GetClassSymbols(Me.Name) cSymbol = CComponent.GetClassSymbols(Me.Name)
If cSymbol Then
For Each hSymbol In cSymbol For Each hSymbol In cSymbol
If LCase(hSymbol.Kind) <> "m" Then Continue If LCase(hSymbol.Kind) <> "m" Then Continue
If hSymbol.LineNumber = 0 Then Continue If hSymbol.LineNumber = 0 Then Continue
cFunc.Add(hSymbol.Name) cFunc.Add(hSymbol.Name)
Next Next
Endif
cFunc.Sort(gb.IgnoreCase + gb.Natural) cFunc.Sort(gb.IgnoreCase + gb.Natural)
hParent = mnuGoto hParent = mnuGoto
@ -2785,6 +2786,10 @@ Private Sub FillProcCombo()
Dim cSymbol As Collection Dim cSymbol As Collection
Dim sText As String Dim sText As String
Dim sName As String Dim sName As String
Dim aPrivate As String[]
Dim aStaticPrivate As String[]
Dim aStaticPublic As String[]
Dim aPublic As String[]
'DIM fTime AS Float 'DIM fTime AS Float
'DIM iInd AS Integer 'DIM iInd AS Integer
@ -2809,23 +2814,65 @@ Private Sub FillProcCombo()
If Project.IsSourcePath(Path) Then If Project.IsSourcePath(Path) Then
cSymbol = CComponent.GetClassSymbols(Me.Name) cSymbol = CComponent.GetClassSymbols(Me.Name)
If Not cSymbol Then cSymbol = New Collection
Else Else
cSymbol = CComponent.ScanSingleClass(Me) cSymbol = CComponent.ScanSingleClass(Me)
Endif Endif
aStaticPrivate = New String[]
aPrivate = New String[]
aStaticPublic = New String[]
aPublic = New String[]
For Each hSymbol In cSymbol For Each hSymbol In cSymbol
If LCase(hSymbol.Kind) <> "m" Then Continue If LCase(hSymbol.Kind) <> "m" Then Continue
If hSymbol.LineNumber = 0 Then Continue If hSymbol.LineNumber = 0 Then Continue
If hSymbol.Class <> Me.Name Then Continue If hSymbol.Class <> Me.Name Then Continue
$aProc.Add(hSymbol.Name)
sName = hSymbol.Name
If hSymbol.IsStatic() Then
If hSymbol.NotPublic Then
aStaticPrivate.Add(sName)
Else
aStaticPublic.Add(sName)
Endif
Else
If hSymbol.NotPublic Then
aPrivate.Add(sName)
Else
aPublic.Add(sName)
Endif
Endif
Next Next
$aProc.Sort(gb.IgnoreCase) aStaticPrivate.Sort(gb.IgnoreCase)
aPrivate.Sort(gb.IgnoreCase)
aStaticPublic.Sort(gb.IgnoreCase)
aPublic.Sort(gb.IgnoreCase)
If aStaticPublic.Count Then
$aProc.Add("-STATIC PUBLIC")
$aProc.Insert(aStaticPublic)
Endif
If aPublic.Count Then
$aProc.Add("-PUBLIC")
$aProc.Insert(aPublic)
Endif
If aStaticPrivate.Count Then
$aProc.Add("-STATIC PRIVATE")
$aProc.Insert(aStaticPrivate)
Endif
If aPrivate.Count Then
$aProc.Add("-PRIVATE")
$aProc.Insert(aPrivate)
Endif
For Each sName In $aProc For Each sName In $aProc
If sName Begins "-" Then Continue
hSymbol = cSymbol[sName] hSymbol = cSymbol[sName]
'cmbProc.Add(sName) 'cmbProc.Add(sName)
$cProc[hSymbol.Name] = hSymbol.LineNumber - 1 $cProc[hSymbol.Name] = hSymbol.LineNumber - 1

View file

@ -21,6 +21,8 @@ End
Public Sub Init(hModule As FEditor, sClass As String, aProc As String[], iCurrent As Integer, W As Integer, H As Integer) Public Sub Init(hModule As FEditor, sClass As String, aProc As String[], iCurrent As Integer, W As Integer, H As Integer)
Dim I As Integer
$hModule = hModule $hModule = hModule
$sClass = sClass $sClass = sClass
' Copy it, as it can disappear during the Editor_Change() method ' Copy it, as it can disappear during the Editor_Change() method
@ -32,9 +34,12 @@ Public Sub Init(hModule As FEditor, sClass As String, aProc As String[], iCurren
gvwProc.Rows.UnselectAll gvwProc.Rows.UnselectAll
gvwProc.Columns.Count = 1 gvwProc.Columns.Count = 1
Project.SetNormalFont(gvwProc) Project.SetNormalFont(gvwProc)
gvwProc.Rows.H = gvwProc.Font.Height + 4 'gvwProc.Rows.H = gvwProc.Font.Height + 4
For I = 0 To aProc.Max
If aProc[I] Begins "-" Then gvwProc.Rows[I].H = Desktop.Scale * 1.5
Next
Me.Resize(W, Min(H, gvwProc.Rows.Count * gvwProc.Rows.Height + 2)) Me.Resize(W, Min(H, gvwProc.ScrollHeight + 2))
Try gvwProc[$iCurrent, 0].EnsureVisible Try gvwProc[$iCurrent, 0].EnsureVisible
$sFind = "" $sFind = ""
@ -54,11 +59,11 @@ Public Sub gvwProc_Data(Row As Integer, (Column) As Integer)
Dim hSymbol As CSymbolInfo Dim hSymbol As CSymbolInfo
Dim sName As String Dim sName As String
'Dim hColor As Color
Try sName = $aProc[Row] Try sName = $aProc[Row]
If Not sName Then Return If Not sName Then Return
If sName Begins "-" Then Return
gvwProc.Data.Text = sName gvwProc.Data.Text = sName
If $sClass Then If $sClass Then
@ -84,7 +89,7 @@ Public Sub gvwProc_Data(Row As Integer, (Column) As Integer)
'gvwProc.Data.Picture = Picture["img/16/point.png"] 'gvwProc.Data.Picture = Picture["img/16/point.png"]
'gvwProc.Data.Foreground = Color.Lighter(Color.Foreground) 'gvwProc.Data.Foreground = Color.Lighter(Color.Foreground)
If FCompletion.GetSpecialMethods().Exist(sName, gb.IgnoreCase) Then If FCompletion.GetSpecialMethods().Exist(sName, gb.IgnoreCase) Then
gvwProc.Data.Background = Color.Background gvwProc.Data.Foreground = Color.SelectedBackground
Endif Endif
Else If InStr(sName, "_") Then Else If InStr(sName, "_") Then
'gvwProc.Data.Picture = Picture["img/16/event.png"] 'gvwProc.Data.Picture = Picture["img/16/event.png"]
@ -97,7 +102,7 @@ Public Sub gvwProc_Data(Row As Integer, (Column) As Integer)
gvwProc.Data.Background = Color.SelectedBackground gvwProc.Data.Background = Color.SelectedBackground
gvwProc.Data.Foreground = Color.SelectedForeground gvwProc.Data.Foreground = Color.SelectedForeground
Else If Row = $iInit Then Else If Row = $iInit Then
gvwProc.Data.Background = Color.LightBackground gvwProc.Data.Background = Color.Merge(Color.LightBackground, Color.TextBackground)
Endif Endif
End End
@ -113,6 +118,7 @@ Private Sub SetCurrent(iCurrent As Integer)
Dim iOld As Integer = $iCurrent Dim iOld As Integer = $iCurrent
If iCurrent = iOld Then Return If iCurrent = iOld Then Return
If iCurrent >= 0 And If $aProc[iCurrent] = "-" Then Return
$iCurrent = iCurrent $iCurrent = iCurrent
If iOld >= 0 Then gvwProc.Rows[iOld].Refresh If iOld >= 0 Then gvwProc.Rows[iOld].Refresh
@ -200,3 +206,23 @@ End
' Debug gvwProc.ScrollY ' Debug gvwProc.ScrollY
' '
' End ' End
Public Sub gvwProc_Draw(X As Integer, Y As Integer, Width As Integer, Height As Integer, Row As Integer, Column As Integer)
Dim sName As String
Dim WT As Float
Try sName = $aProc[Row]
If sName Not Begins "-" Then Return
sName = Mid$(sName, 2)
Paint.Font.Grade = -3
WT = Paint.TextSize(sName).Width + Desktop.Scale
Paint.FillRect(X - 2, Y + Height \ 2, Width + 4, 1, Color.LightForeground)
Paint.FillRect(X + (Width - WT) / 2, Y, WT, Height, Color.TextBackground)
Paint.Background = Color.LightForeground
Paint.DrawText(sName, X, Y, Width, Height, Align.Center)
End

View file

@ -16,6 +16,7 @@
Mouse = Mouse.Pointing Mouse = Mouse.Pointing
Border = False Border = False
Grid = False Grid = False
Padding = 1
} }
} }
} }