Merge branch 'master' of gitlab.com:prokopyl/gambas into cmake
This commit is contained in:
commit
689cd7f156
16 changed files with 283 additions and 19 deletions
|
@ -1,6 +1,6 @@
|
|||
[Component]
|
||||
Key=gb.term.form
|
||||
Version=3.10.90
|
||||
Version=3.9.90
|
||||
State=2
|
||||
Authors=Fabien Bodard (gambas.fr@gmail.com)
|
||||
Needs=ImageIO
|
||||
|
|
|
@ -647,6 +647,14 @@ _DefaultForeGround
|
|||
r
|
||||
i
|
||||
|
||||
_ClientHeight
|
||||
r
|
||||
i
|
||||
|
||||
_ClientWidth
|
||||
r
|
||||
i
|
||||
|
||||
_AllowFocus
|
||||
v
|
||||
b
|
||||
|
@ -842,6 +850,50 @@ Count
|
|||
r
|
||||
i
|
||||
|
||||
Text
|
||||
r
|
||||
s
|
||||
|
||||
:Activate
|
||||
:
|
||||
|
||||
|
||||
:Change
|
||||
:
|
||||
|
||||
|
||||
EnsureVisible
|
||||
m
|
||||
|
||||
|
||||
_Render
|
||||
m
|
||||
|
||||
|
||||
_KeyPress
|
||||
m
|
||||
|
||||
|
||||
_MouseDown
|
||||
m
|
||||
|
||||
|
||||
_MouseUp
|
||||
m
|
||||
|
||||
|
||||
_MouseMove
|
||||
m
|
||||
|
||||
|
||||
_put
|
||||
m
|
||||
|
||||
(Value)s(Index)i
|
||||
_get
|
||||
m
|
||||
s
|
||||
(Index)i
|
||||
#TermPanel
|
||||
TermContainer
|
||||
C
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
# Gambas Project File 3.0
|
||||
# Compiled with Gambas 3.10.90
|
||||
Startup=trfTest
|
||||
# Compiled with Gambas 3.9.90
|
||||
Startup=FTest2
|
||||
UseTerminal=1
|
||||
RedirectStderr=1
|
||||
Version=3.10.90
|
||||
Version=3.9.90
|
||||
VersionFile=1
|
||||
Component=gb.image
|
||||
Component=gb.image.io
|
||||
|
|
|
@ -34,6 +34,12 @@ Property Read HaveFocus As Boolean
|
|||
Property Read _DefaultBackground As Integer
|
||||
Property Read _DefaultForeGround As Integer
|
||||
|
||||
Property Read _ClientHeight As Integer
|
||||
Property Read _ClientWidth As Integer
|
||||
|
||||
|
||||
|
||||
|
||||
Private $iColorMode As Integer
|
||||
Private $iBorder As Integer
|
||||
|
||||
|
@ -403,7 +409,7 @@ End
|
|||
|
||||
Private Sub Foreground_Write(Value As Integer)
|
||||
|
||||
$iBackGround = Value
|
||||
$iForeground = Value
|
||||
Me.Refresh
|
||||
|
||||
End
|
||||
|
@ -735,5 +741,14 @@ Private Function _DefaultForeGround_Read() As Integer
|
|||
End
|
||||
|
||||
|
||||
Private Function _ClientHeight_Read() As Integer
|
||||
|
||||
Return $rectClient.Height
|
||||
|
||||
End
|
||||
|
||||
Private Function _ClientWidth_Read() As Integer
|
||||
|
||||
Return $rectClient.Width
|
||||
|
||||
End
|
||||
|
|
|
@ -3,42 +3,174 @@
|
|||
Export
|
||||
Inherits TermControl
|
||||
|
||||
|
||||
Property List As String[]
|
||||
Property Index As Integer
|
||||
Property Read Count As Integer
|
||||
|
||||
Property Read Text As String
|
||||
Private $iIndex As Integer
|
||||
Private $aList As New String[]
|
||||
|
||||
|
||||
Private $iFirstVisible As Integer
|
||||
Event Activate
|
||||
Event Change
|
||||
Class Rect
|
||||
|
||||
Private Function List_Read() As String[]
|
||||
|
||||
|
||||
Return $aList
|
||||
|
||||
End
|
||||
|
||||
Private Sub List_Write(Value As String[])
|
||||
|
||||
|
||||
$aList = Value
|
||||
|
||||
End
|
||||
|
||||
Private Function Index_Read() As Integer
|
||||
|
||||
|
||||
Return $iIndex
|
||||
|
||||
End
|
||||
|
||||
Private Sub Index_Write(Value As Integer)
|
||||
|
||||
|
||||
$iIndex = Min($aList.Max, Max(0, Value))
|
||||
EnsureVisible
|
||||
|
||||
End
|
||||
|
||||
Private Function Count_Read() As Integer
|
||||
|
||||
|
||||
Return $aList.Count
|
||||
|
||||
End
|
||||
|
||||
Public Sub _Render()
|
||||
|
||||
Dim hAttr As New Attr
|
||||
Dim iAttr, iAttr2 As Integer
|
||||
Dim i, il, k, ilen As Integer
|
||||
Dim s As String
|
||||
Dim hRectC As Rect = Me._GetClientRect()
|
||||
Dim hRect As Rect = Me._GetClientRect()
|
||||
Dim iCursorPos As Integer
|
||||
If Not Me._NeedRender Then Return
|
||||
Super._Render
|
||||
|
||||
hAttr.FillFrom(Me._Content[0][0].Attr)
|
||||
|
||||
Swap hAttr.Background, hAttr.Foreground
|
||||
iAttr = hAttr.GetInteger()
|
||||
k = $iFirstVisible
|
||||
For i = 0 To Me._Content.Max
|
||||
If k > $aList.Max Then Break
|
||||
s = $aList[k]
|
||||
ilen = String.Len(s)
|
||||
For il = 0 To IIf(k = $iIndex, hRect.width - 2, Min(hRect.width - 2, ilen))
|
||||
'iAttr = Me._Content[i][il].
|
||||
If k = $iIndex Then Me._Content[i][il].Attr = iAttr
|
||||
If il < ilen Then Me._Content[i][il].c = String.Code(String.Mid(s, il + 1, 1))
|
||||
Next
|
||||
|
||||
Inc k
|
||||
Next
|
||||
|
||||
ilen = Me._Content[0].Max
|
||||
'Render the scrollbar
|
||||
For i = 1 To Me._Content.Max - 2
|
||||
Me._Content[i][ilen].c = &H2591
|
||||
Next
|
||||
Me._Content[0][ilen].c = &H25B2
|
||||
Me._Content[Me._Content.Max - 1][ilen].c = &H25BC
|
||||
|
||||
hAttr.Foreground = TermColor.Black
|
||||
iAttr = hAttr.GetInteger()
|
||||
iCursorPos = ($iFirstVisible + hRect.height) / $aList.Count * (hRect.Height - 3)
|
||||
Me._Content[iCursorPos][hRect.width - 1] = Char(String.Chr(&H2588), iAttr)
|
||||
|
||||
|
||||
|
||||
Me._NeedRender = False
|
||||
Fin:
|
||||
|
||||
End
|
||||
|
||||
Public Sub _KeyPress()
|
||||
|
||||
Select Key.Code
|
||||
Case Key.Up
|
||||
Dec Me.Index
|
||||
Raise Change
|
||||
Case Key.Down
|
||||
Inc Me.Index
|
||||
Raise Change
|
||||
Case Key.Return, Key.Enter
|
||||
Raise Activate
|
||||
|
||||
Default
|
||||
|
||||
End Select
|
||||
Super._KeyPress
|
||||
End
|
||||
|
||||
Public Sub _MouseDown()
|
||||
|
||||
Super._MouseDown
|
||||
Me.Index = $iFirstVisible + Mouse.Row
|
||||
Raise Change
|
||||
'EnsureVisible
|
||||
End
|
||||
|
||||
Public Sub _MouseUp()
|
||||
Super._MouseUp
|
||||
Raise Activate
|
||||
Raise Click
|
||||
|
||||
End
|
||||
|
||||
Public Sub _MouseMove()
|
||||
Super._MouseMove
|
||||
_MouseDown
|
||||
|
||||
End
|
||||
|
||||
Public Sub EnsureVisible()
|
||||
|
||||
Dim hRect As Rect = Me._GetClientRect()
|
||||
|
||||
If $iFirstVisible + (hRect.Height - 1) < $iIndex Then
|
||||
$iFirstVisible = $iIndex - hRect.Height + 1
|
||||
Endif
|
||||
If $iIndex < $iFirstVisible Then
|
||||
$iFirstVisible = $iIndex
|
||||
Endif
|
||||
Me.Refresh
|
||||
|
||||
End
|
||||
|
||||
|
||||
Public Sub _put(Value As String, Index As Integer)
|
||||
|
||||
$aList[Index] = Value
|
||||
If IsVisible(Index) Then Me.Refresh
|
||||
End
|
||||
|
||||
|
||||
Public Function _get(Index As Integer) As String
|
||||
|
||||
Return $aList[Index]
|
||||
|
||||
End
|
||||
|
||||
|
||||
Private Sub IsVisible(Index As Integer) As Boolean
|
||||
|
||||
If Index >= $iFirstVisible And If Index < $iFirstVisible + Me._ClientHeight Then Return True
|
||||
|
||||
End
|
||||
|
||||
Private Function Text_Read() As String
|
||||
|
||||
Return $aList[$iIndex]
|
||||
|
||||
End
|
||||
|
|
|
@ -271,7 +271,7 @@ Static Public Sub File_Read()
|
|||
Endif
|
||||
i = 10
|
||||
ipos2 = 10
|
||||
If String.InStr(S, "B") Then Stop
|
||||
' If String.InStr(S, "B") Then Stop
|
||||
For Each ss In ["~", "A", "B", "C", "D", "H", "F", "P", "Q", "R", "S", "M", "Z"]
|
||||
i = InStr(s, ss, ipos)
|
||||
If i = 0 Then Continue
|
||||
|
|
52
comp/src/gb.term.form/.src/Test/FTest2.class
Normal file
52
comp/src/gb.term.form/.src/Test/FTest2.class
Normal file
|
@ -0,0 +1,52 @@
|
|||
' Gambas class file
|
||||
|
||||
Inherits TermForm
|
||||
Private aList As New String[]
|
||||
Private hTim As New Timer As "Tim"
|
||||
Private hList As TermListBox
|
||||
Private k As Integer
|
||||
Private hLbl As TermLabel
|
||||
|
||||
Public Sub _new()
|
||||
Dim i As Integer
|
||||
'aList = ["Chien", "Chat", "Eléphant", "Hiène", "Phoque", "Canard", "Hippoppo"]
|
||||
Me.Spacing = 2
|
||||
|
||||
hList = New TermListBox(Me) As "ListBox1"
|
||||
hLbl = New TermLabel(Me)
|
||||
|
||||
For i = 1 To 200
|
||||
aList.Add("Item" & i)
|
||||
Next
|
||||
'hList._Shadow = True
|
||||
hList.List = aList
|
||||
Me.Move(0, 0, 60, 20)
|
||||
Me._Arrangement = Arrange.Vertical
|
||||
hList.Move(1, 1, 3, 3)
|
||||
'Me._Arrangement = Arrange.Fill
|
||||
hList.Expand = True
|
||||
Me.Border = 1
|
||||
hList.Background = termColor.Blue
|
||||
Me.Center
|
||||
Me.Show
|
||||
Me.Title = "Test 1"
|
||||
hTim.Delay = 500
|
||||
hTim.Start
|
||||
|
||||
hLbl.Background = TermColor.Green
|
||||
hLbl.Foreground = TermColor.Black
|
||||
End
|
||||
|
||||
|
||||
Public Sub tim_Timer()
|
||||
|
||||
hList[5] = k
|
||||
Inc k
|
||||
End
|
||||
|
||||
|
||||
Public Sub ListBox1_Change()
|
||||
|
||||
hLbl.Text = Last.Text
|
||||
|
||||
End
|
10
comp/src/gb.term.form/.startup
Normal file
10
comp/src/gb.term.form/.startup
Normal file
|
@ -0,0 +1,10 @@
|
|||
FTest2
|
||||
|
||||
0
|
||||
0
|
||||
3.9.90
|
||||
|
||||
gb.image
|
||||
gb.image.io
|
||||
gb.term
|
||||
|
|
@ -245,6 +245,7 @@ static char *array_from_dbus_type(const char *signature)
|
|||
|
||||
if (type_contents != type)
|
||||
strcpy(type, type_contents);
|
||||
GB.GetArrayClass(GB.FindClass(type));
|
||||
strcat(type, "[]");
|
||||
return type;
|
||||
}
|
||||
|
|
|
@ -131,6 +131,7 @@ const void *const GAMBAS_Api[] =
|
|||
(void *)GB_ExistClassLocal,
|
||||
(void *)CLASS_find,
|
||||
(void *)GB_GetArrayType,
|
||||
(void *)CLASS_get_array_class,
|
||||
(void *)GB_Is,
|
||||
(void *)GB_Ref,
|
||||
(void *)GB_Unref,
|
||||
|
|
|
@ -977,6 +977,7 @@ typedef
|
|||
bool (*ExistClassLocal)(const char *);
|
||||
GB_CLASS (*FindClassLocal)(const char *);
|
||||
GB_TYPE (*GetArrayType)(GB_CLASS);
|
||||
GB_CLASS (*GetArrayClass)(GB_CLASS);
|
||||
bool (*Is)(void *, GB_CLASS);
|
||||
void (*Ref)(void *);
|
||||
void (*Unref)(void **);
|
||||
|
|
Loading…
Reference in a new issue