Skip to content
Commits on Source (6)
......@@ -58,7 +58,7 @@ Public Sub gvwProc_MouseUp()
End
Private Sub SetCurrent(iCurrent As Integer)
Private Sub SetCurrent(iCurrent As Integer, Optional bEnsureVisible As Boolean = True)
Dim iOld As Integer = $iCurrent
......@@ -69,20 +69,20 @@ Private Sub SetCurrent(iCurrent As Integer)
If iOld >= 0 Then gvwProc.Rows[iOld].Refresh
If iCurrent >= 0 Then
gvwProc.Rows[iCurrent].Refresh
gvwProc[iCurrent, 0].EnsureVisible
If bEnsureVisible Then gvwProc[iCurrent, 0].EnsureVisible
Endif
End
Public Sub gvwProc_MouseMove()
SetCurrent(gvwProc.RowAt(Mouse.Y))
SetCurrent(gvwProc.RowAt(Mouse.Y), True)
End
Public Sub gvwProc_MouseWheel()
Public Sub gvwProc_Scroll()
gvwProc_MouseMove
SetCurrent(gvwProc.RowAt(Mouse.Y), False)
End
......
# Gambas Project File 3.0
Title=More controls for graphical components
Startup=FTestColorChooser
Startup=FTestFileView
Version=3.11.90
VersionFile=1
Component=gb.image
Component=gb.gui
Component=gb.settings
Authors="Benoît Minisini"
Environment="GB_GUI=gb.gtk3"
Environment="GB_GUI=gb.qt4"
TabSize=2
Translate=1
Language=en
......
......@@ -42,9 +42,12 @@ Private $bShowHidden As Boolean
Private $bShowDir As Boolean
Private $bShowPreview As Boolean
Private $hIconView As IconView
Private $hColumnView As ColumnView
Private $sSortDir As String
Private $iSort As Integer
Private $bAsc As Boolean = True
Private $aFilter As String[]
Private $hPict As Picture
Private $hRefresh As Timer
......@@ -62,6 +65,9 @@ Private $hWatcher As Watcher
Private $bVisible As Boolean
Private $bInvalidate As Boolean
Static Private $iIconExecSize As Integer
Static Private $hIconExec As Picture
Static Public Sub _init()
$cExt["html"] = "html"
......@@ -225,7 +231,13 @@ Private Sub GetIcon(sPath As String, iSize As Integer) As Picture
With DirCache[File.Dir(sPath)].GetInfo(File.Name(sPath))
If InStr(.Perm[System.User.Name], "x") Then Return Picture["icon:/" & CStr(iSize) &/ "exec"]
If InStr(.Perm[System.User.Name], "x") Then
If Not $hIconExec Or If $iIconExecSize <> iSize Then
$iIconExecSize = iSize
$hIconExec = Picture["icon:/" & CStr(iSize) &/ "exec"]
Endif
Return $hIconExec
Endif
End With
......@@ -317,7 +329,10 @@ Private Sub RefreshView()
If $hColumnView.Visible Then
SX = $hColumnView.ScrollX
SY = $hColumnView.ScrollY
If Not $bWatch Or If $bRefreshAll Then $hColumnView.Clear
If Not $bWatch Or If $bRefreshAll Then
$hColumnView.Clear
$hColumnView._Begin()
Endif
$hColumnView.Sorted = False
hPictFile = Picture["icon:/small/file"]
hPictFolder = Picture["icon:/small/directory"]
......@@ -434,6 +449,7 @@ Finally
$bRefreshIcon = False
$bRefreshAll = False
If $hColumnView.Visible Then
$hColumnView._End
$hColumnView.Sorted = True
Else
$hIconView._End
......@@ -705,14 +721,9 @@ Public Sub View_Menu()
End
Public Sub View_Compare((Key) As String, OtherKey As String)
Dim hStat As Stat
Dim hStat2 As Stat
Dim sDir As String
Dim iComp As Integer
Public Sub View_BeforeSort()
sDir = GetCurrentDir()
$sSortDir = GetCurrentDir()
If $hColumnView.Visible Then
$iSort = $hColumnView.Columns.Sort
......@@ -721,13 +732,22 @@ Public Sub View_Compare((Key) As String, OtherKey As String)
$hIconView.Ascending = $bAsc
Endif
End
Public Sub View_Compare((Key) As String, OtherKey As String)
Dim hStat As Stat
Dim hStat2 As Stat
Dim iComp As Integer
iComp = Comp(Asc(Key), Asc(OtherKey))
If iComp = 0 Then
If $iSort Then
hStat = DirCache[sDir].GetInfo(Mid$(Key, 2))
hStat2 = DirCache[sDir].GetInfo(Mid$(OtherKey, 2))
hStat = DirCache[$sSortDir].GetInfo(Mid$(Key, 2))
hStat2 = DirCache[$sSortDir].GetInfo(Mid$(OtherKey, 2))
Endif
Select $iSort
......
......@@ -33,6 +33,7 @@ Private $hShowButtonRight As DrawingArea
Private $hTimerAnim As Timer
Private $iTarget As Integer
Private $bLockRefresh As Boolean
' Static Public Sub _init()
'
......@@ -303,7 +304,7 @@ Private Sub CreateShowButton(hParent As Container) As DrawingArea
hCtrl.Ignore = True
hCtrl.Resize(Desktop.Scale, Desktop.Scale)
hCtrl.Mouse = Mouse.Pointing
hCtrl.Tooltip = Me.Parent.NAme
hCtrl.Tooltip = Me.Parent.Tooltip
Return hCtrl
......@@ -436,13 +437,18 @@ End
Public Sub RefreshAll()
Dim hParent As Container
Dim hParent As SidePanel
Dim hTabStrip As TabStrip
Dim iIndex As Integer
Dim D As Integer
Dim hCont As Container
If Not $bOpened Then Return
'Debug Me.Parent.Name;; Me.X;; Me.Y;; Me.W;; panMove.W;; Me.Parent.ClientH
If $bLockRefresh Then Return
$bLockRefresh = True
hParent = GetParent()
btnSide.Visible = Not $bTransparent Or $bVisible
btnSide2.Visible = btnSide.Visible
......@@ -464,20 +470,21 @@ Public Sub RefreshAll()
If Not $hShowPanel And If $bTransparent Then
hParent = Me.Parent.Parent
hCont = Me.Parent.Parent
If hParent Is TabStrip Then
hTabStrip = hParent
If hCont Is TabStrip Then
hTabStrip = hCont
iIndex = hTabStrip.Index
hTabStrip.Index = hTabStrip.FindIndex(Me.Parent)
Endif
$hShowButtonLeft = CreateShowButton(hParent)
$hShowButtonRight = CreateShowButton(hParent)
$hShowButtonLeft = CreateShowButton(hCont)
$hShowButtonRight = CreateShowButton(hCont)
$hShowPanel = New Panel(hParent) As "panMove"
$hShowPanel = New Panel(hCont) As "panMove"
$hShowPanel.Ignore = True
$hShowPanel.Mouse = Mouse.Pointing
$hShowPanel.Tooltip = GetParent().Tooltip
If hTabStrip Then hTabStrip.Index = iIndex
......@@ -490,8 +497,7 @@ Public Sub RefreshAll()
MoveShowButton
Endif
'UpdateBackground
RefreshArrow
RefreshPanel
RefreshButtons
......@@ -499,6 +505,8 @@ Public Sub RefreshAll()
sepSide.Raise
panMove.Raise
$bLockRefresh = False
End
Private Sub AfterTogglePanel()
......@@ -837,6 +845,11 @@ Public Sub SetTooltip(Value As String)
btnSide.ToolTip = Value
btnSide2.ToolTip = Value
panMove.ToolTip = Value
If $hShowButtonLeft Then
$hShowButtonLeft.Tooltip = Value
$hShowButtonRight.Tooltip = Value
$hShowPanel.Tooltip = Value
Endif
End
......
......@@ -14,7 +14,7 @@ Event Hide
Property Read Editor As Control
Property NoKeyboard As Boolean
Property ShowCursor As Boolean
'Property ShowCursor As Boolean
Private $hTextBox As TextBox
Private $hComboBox As ComboBox
......@@ -28,7 +28,7 @@ Private $hWatcher As Watcher
Private $bNoKeyboard As Boolean
Private $hTimer As Timer
Private $bDoNotHideEditor As Boolean
Private $bShowCursor As Boolean
'Private $bShowCursor As Boolean
Public Sub _new()
......@@ -111,7 +111,7 @@ Private Sub HideEditor(Optional bNoSave As Boolean) As Boolean
Endif
Endif
UpdateShowCursor
'UpdateShowCursor
Return bCancel
......@@ -172,7 +172,7 @@ Private Sub MoveEditor()
$hPanel.Background = $hEditor.Background
Endif
UpdateShowCursor
'UpdateShowCursor
$hPanel.Move(X, Y, W, H)
$hEditor.Move(P, P, W - P * 2, H - P * 2)
......@@ -538,21 +538,21 @@ Public Sub Clear()
End
Private Function ShowCursor_Read() As Boolean
Return $bShowCursor
End
Private Sub UpdateShowCursor()
Super.ShowCursor = $bShowCursor 'And IsNull($hEditor)
End
Private Sub ShowCursor_Write(Value As Boolean)
$bShowCursor = Value
UpdateShowCursor
End
' Private Function ShowCursor_Read() As Boolean
'
' Return $bShowCursor
'
' End
'
' Private Sub UpdateShowCursor()
'
' Super.ShowCursor = $bShowCursor 'And IsNull($hEditor)
'
' End
'
' Private Sub ShowCursor_Write(Value As Boolean)
'
' $bShowCursor = Value
' UpdateShowCursor
'
' End
......@@ -28,11 +28,11 @@ End
Public Sub FileChooser1_Change()
If FileChooser1.SelectedPath Then
FileProperties1.Path = FileChooser1.SelectedPath
Else
FileProperties1.Path = FileChooser1.Dir
Endif
' If FileChooser1.SelectedPath Then
' FileProperties1.Path = FileChooser1.SelectedPath
' Else
' FileProperties1.Path = FileChooser1.Dir
' Endif
End
......@@ -46,6 +46,7 @@ End
Public Sub Form_Open()
FileChooser1.SelectedPath = "/home/benoit/gambas/git/master/app/src/gambas3/img/broken.svg"
FileChooser1.Dir = "/usr/bin"
'FileChooser1.SelectedPath = "/home/benoit/gambas/git/master/app/src/gambas3/img/broken.svg"
End
......@@ -65,12 +65,13 @@
Expand = True
Spacing = True
{ FileChooser1 FileChooser
MoveScaled(4,4,55,56)
MoveScaled(10,4,77,56)
Expand = True
ReadOnly = True
}
{ FileProperties1 FileProperties
MoveScaled(62,4,52,36)
MoveScaled(97,2,28,36)
Visible = False
}
}
}
# Gambas Project File 3.0
Title=Common controls and classes for GUI components
Startup=FGridView
Startup=FIconView
Version=3.11.90
VersionFile=1
Component=gb.image
Component=gb.gui
Arguments=[["-style=oxygen"],["-style=qtcurve"]]
CurrentArgument=0
Environment="GB_GUI=gb.qt5\nLIBOVERLAY_SCROLLBAR=0"
Environment="GB_GUI=gb.gtk3\nLIBOVERLAY_SCROLLBAR=0"
TabSize=2
Language=fr
Type=Component
......
......@@ -534,9 +534,12 @@ Public Sub ScrollArea_Arrange()
Dim W, H As Integer
Dim nRow As Integer
Dim DS As Integer
If $iLock Then Return
DS = Desktop.Scale
W = $hView.ClientWidth
H = $hView.ClientHeight
......@@ -550,16 +553,16 @@ Public Sub ScrollArea_Arrange()
If $bHorizontal Then
$iGridHeight = Max(8, $iIconSize) + 16
$iGridHeight = Max($iGridHeight, Me.Font.Height * $iIconLines + 8)
$iGridHeight = Max(DS, $iIconSize) + DS * 2
$iGridHeight = Max($iGridHeight, Me.Font.Height * $iIconLines + DS)
If $iGridSize Then
$iGridWidth = $iGridSize * Desktop.Scale
$iGridWidth = $iGridSize * DS
Else
$iGridWidth = $iIconSize + 16
$iGridWidth = $iIconSize + DS * 2
Endif
$iGridWidth = Max($iGridWidth, $iIconSize + 8)
$iGridWidth = Max($iGridWidth, $iIconSize + DS)
$nColumn = Max(1, (H - $iPad * 2) \ $iGridHeight)
nRow = ($aItems.Count + $nColumn - 1) \ $nColumn
......@@ -574,14 +577,14 @@ Public Sub ScrollArea_Arrange()
Else
$iGridHeight = Max(8, $iIconSize) + $iIconLines * Me.Font.Height + 28
$iGridHeight = Max(DS * 4, $iIconSize) + $iIconLines * Me.Font.Height + DS * 3
If $iGridSize Then
$iGridWidth = $iGridSize * Desktop.Scale
$iGridWidth = $iGridSize * DS
Else
$iGridWidth = $iIconSize + 16
$iGridWidth = $iIconSize + DS * 2
Endif
$iGridWidth = Max($iGridWidth, Me.Font.Height * 8)
$iGridWidth = Max($iGridWidth, Me.Font.Height * DS)
$nColumn = Max(1, (W - $iPad * 2) \ $iGridWidth)
$iGridWidth = Max(1, (W - $iPad * 2) \ $nColumn)
......
......@@ -259,6 +259,18 @@ Private Sub DrawText(sText As String, sRichText As String, X As Float, Y As Floa
End
Private Sub GetIconSize(ByRef PW As Integer, ByRef PH As Integer)
If $hPicture Then
PW = $hPicture.W
PH = $hPicture.H
Else
PW = Max(Desktop.Scale * 4, GetIconView().IconSize)
PH = PW
Endif
End
Public Sub _Draw(hRect As Rect, hClip As Rect, hIconView As IconView, bHorizontal As Boolean, bFocus As Boolean, bHover As Boolean, bCurrent As Boolean)
......@@ -266,7 +278,10 @@ Public Sub _Draw(hRect As Rect, hClip As Rect, hIconView As IconView, bHorizonta
Dim iColor As Integer
Dim bFrame As Boolean
Dim sText As String
Dim hRect1, hRect2 As Rect
Dim hRect1, hRect2, hRectBg As Rect
Dim DS As Integer
DS = Desktop.Scale
hRect.Adjust(2)
......@@ -274,10 +289,7 @@ Public Sub _Draw(hRect As Rect, hClip As Rect, hIconView As IconView, bHorizonta
bFrame = True
Endif
If $hPicture Then
PW = $hPicture.W
PH = $hPicture.H
Endif
GetIconSize(ByRef PW, ByRef PH)
'iColor = hIconView.Background
'If iColor = Color.Default Then iColor = Color.TextBackground
......@@ -312,8 +324,11 @@ Public Sub _Draw(hRect As Rect, hClip As Rect, hIconView As IconView, bHorizonta
' Paint.Rectangle(hRect.X + 0.5, hRect.Y + 0.5, hRect.W, hRect.H)
' Paint.Stroke
hClip.Adjust(-1)
hRect.Adjust(Desktop.Scale, Desktop.Scale \ 2)
'hClip.Adjust(-1)
hRectBg = hRect.Copy()
hRectBg.Adjust(1)
hRect.Adjust(DS, DS \ 2)
If bHorizontal Then
......@@ -327,7 +342,7 @@ Public Sub _Draw(hRect As Rect, hClip As Rect, hIconView As IconView, bHorizonta
If Not sText Then sText = Html($sText)
H = hIconView.Font.RichTextHeight(sText, W)
HT = hRect.H + Desktop.Scale \ 2
HT = hRect.H + DS \ 2
If H > HT Then
sText = Paint.TrimRichText(sText, W, HT)
......@@ -338,12 +353,15 @@ Public Sub _Draw(hRect As Rect, hClip As Rect, hIconView As IconView, bHorizonta
Endif
Paint.ClipRect = hClip
hRect1 = hRectBg.Copy()
'hRect1.Adjust(1)
GoSub PAINT_BACKGROUND
hRect1 = hClip.Copy()
hRect1.Adjust(1)
GoSub PAINT_BACKGROUND
Paint.ClipRect = hClip
If System.RightToLeft Then
If $hPicture Then
......@@ -372,7 +390,7 @@ Public Sub _Draw(hRect As Rect, hClip As Rect, hIconView As IconView, bHorizonta
Else
Y = hRect.Y
If $hPicture Then Y += $hPicture.H + 4
Y += PH + DS \ 2
If $sText Or If $sRichText Then
......@@ -391,8 +409,8 @@ Public Sub _Draw(hRect As Rect, hClip As Rect, hIconView As IconView, bHorizonta
Endif
If $hPicture Then hRect1 = Rect(hRect.X + (hRect.W - PW) / 2 - 4, hRect.Y - 4, PW + 8, PH + 8)
If $sText Or If $sRichText Then hRect2 = Rect(hRect.X - 4, Y - 6, hRect.W + 8, hIconView.Font.RichTextHeight(sText, hRect.W) + 10)
hRect1 = Rect(hRect.X + (hRect.W - PW) / 2 - DS \ 2, hRect.Y - DS \ 2, PW + DS, PH + DS)
If $sText Or If $sRichText Then hRect2 = Rect(hRect.X - DS \ 2, Y - DS \ 2, hRect.W + DS, hIconView.Font.RichTextHeight(sText, hRect.W) + DS)
GoSub PAINT_BACKGROUND
'Paint.Save
......@@ -423,8 +441,8 @@ Public Sub _Draw(hRect As Rect, hClip As Rect, hIconView As IconView, bHorizonta
PAINT_RECTS:
If hRect1 Then Paint.Rectangle(hRect1.X, hRect1.Y, hRect1.W, hRect1.H, 6)
If hRect2 Then Paint.Rectangle(hRect2.X, hRect2.Y, hRect2.W, hRect2.H, 6)
If hRect1 Then Paint.Rectangle(hRect1.X, hRect1.Y, hRect1.W, hRect1.H, Desktop.Scale / 2)
If hRect2 Then Paint.Rectangle(hRect2.X, hRect2.Y, hRect2.W, hRect2.H, Desktop.Scale / 2)
Return
PAINT_BACKGROUND:
......@@ -434,21 +452,30 @@ PAINT_BACKGROUND:
Paint.Save
Paint.ClipRect = hClip
If bHover And If Not $bSelected Then
If bHover Then
GoSub PAINT_RECTS
Paint.Background = GetBackground(hIconView, True, bFocus)
Paint.LineWidth = 1
Paint.Stroke
If bCurrent Or If $bSelected Then
Paint.Background = Color.Merge(iColor, Color.TextForeground, 0.2)
Else
Paint.Background = GetBackground(hIconView, True, bFocus)
Endif
Paint.Fill 'LineWidth = 1
'Paint.Stroke
Else If bCurrent Then
Endif
If bCurrent Then
GoSub PAINT_RECTS
Paint.Background = Color.Merge(iColor, Color.TextForeground, 0.1)
Paint.Fill
Endif
If bCurrent Or If bHover Then
If hRect1 Then hRect1.Adjust(1)
If hRect2 Then hRect2.Adjust(1)
Endif
GoSub PAINT_RECTS
......@@ -523,13 +550,7 @@ Public Sub _Intersect(hRect As Rect, hOther As Rect, bHorizontal As Boolean) As
Else
If $hPicture Then
PW = $hPicture.W
PH = $hPicture.H
Else If Not $sText Then
PW = 8
PH = 8
Endif
GetIconSize(ByRef PW, ByRef PH)
YT = hRect.Y
......@@ -564,13 +585,7 @@ Public Sub _Inside(hRect As Rect, hIconView As IconView, bHorizontal As Boolean,
Else
If $hPicture Then
PW = $hPicture.W
PH = $hPicture.H
Else If Not $sText Then
PW = 8
PH = 8
Endif
GetIconSize(ByRef PW, ByRef PH)
YT = hRect.Y
......
......@@ -19,10 +19,9 @@
}
}
{ IconView1 IconView
MoveScaled(3,13,42,31)
MoveScaled(3,13,38,31)
Expand = True
Mode = Select.Multiple
Orientation = Arrange.Horizontal
Sorted = True
Editable = True
GridSize = 24
......