[GB.FORM]

* NEW: FileChooser: Typing a file name automatically selects it.
* BUG: DirView does not raise its Click event twice anymore.
* NEW: FileView: Selection property is now writable.
* BUG: FileView: Delayed refresh is now forced when needed.

[GB.JIT]
* NEW: A little cosmetic change in the autoconf message about LLVM version 
  checking.


git-svn-id: svn://localhost/gambas/trunk@6340 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2014-06-23 00:15:12 +00:00
parent 3dc54264c3
commit 1481162a4f
8 changed files with 81 additions and 53 deletions

View file

@ -662,10 +662,6 @@ TreeView_Activate
m
TreeView_Click
m
TreeView_Menu
m
@ -1023,7 +1019,7 @@ p
b
Selection
r
p
String[]
Filter

View file

@ -1,7 +1,7 @@
# Gambas Project File 3.0
# Compiled with Gambas 3.5.90
Title=More controls for graphical components
Startup=Form2
Startup=Form5
Version=3.5.90
VersionFile=1
Component=gb.image
@ -9,7 +9,7 @@ Component=gb.gui
Component=gb.form
Component=gb.settings
Authors="Benoît Minisini"
Environment="GB_GUI=gb.gtk3"
Environment="GB_GUI=gb.qt4"
TabSize=2
Translate=1
Language=en

View file

@ -149,6 +149,8 @@ Public Sub dvwChoose_Click()
If txtFile.ReadOnly Then
txtFile.Text = ""
Else
txtFile_Change
Endif
Raise Change
@ -1430,3 +1432,9 @@ Public Sub panToolbar_Arrange()
UpdateDirText
End
Public Sub txtFile_Change()
Try fvwChoose.Current = txtFile.Text
End

View file

@ -250,12 +250,12 @@ Public Sub TreeView_Activate()
End
Public Sub TreeView_Click()
If $bNoEvent Then Return
Raise Click
End
' Public Sub TreeView_Click()
'
' If $bNoEvent Then Return
' Raise Click
'
' End
Public Sub TreeView_Menu()

View file

@ -20,7 +20,7 @@ Property Current As String
Property Mode As Integer
Property ShowDetailed As Boolean
Property ShowPreview As Boolean
Property Read Selection As String[]
Property Selection As String[]
Property Filter As String[]
Property Icon As Picture
Property IconSize As Integer
@ -33,6 +33,9 @@ Property Foreground As Integer
'Static Private $aImgExt As String[] = ["png", "jpeg", "jpg", "gif", "xpm"]
Static Private $cExt As New Collection(gb.IgnoreCase)
Private Const PREFIX_DIR As String = "0"
Private Const PREFIX_FILE As String = "1"
Private $sDir As String
Private $bShowHidden As Boolean
Private $bShowDir As Boolean
@ -245,6 +248,16 @@ Private Sub GetIconSize() As Integer
End
Private Sub GetCurrentDir() As String
If $sDir Then
Return $sDir
Else
Return User.Home
Endif
End
Private Sub RefreshView(Optional bInvalidate As Boolean)
Dim sFile As String
@ -264,6 +277,7 @@ Private Sub RefreshView(Optional bInvalidate As Boolean)
Inc Application.Busy
$bRefreshTriggered = False
$bDesktopIsLoaded = Component.IsLoaded("gb.desktop")
iHiddenFg = Color.Merge(Color.TextBackground, Color.TextForeground, 0.66)
@ -283,8 +297,7 @@ Private Sub RefreshView(Optional bInvalidate As Boolean)
iSize = GetIconSize()
sDir = $sDir
If Not sDir Then sDir = User.Home
sDir = GetCurrentDir()
hCache = DirCache[sDir]
If bInvalidate Then hCache.Invalidate
@ -298,10 +311,10 @@ Private Sub RefreshView(Optional bInvalidate As Boolean)
With hCache.GetInfo(sFile)
If hCache.IsDir(sFile) Then
If Not $bShowDir Then Continue
sPrefix = "0"
sPrefix = PREFIX_DIR
Else
If $aFilter And If CheckFilter(sFile) Then Continue
sPrefix = "1"
sPrefix = PREFIX_FILE
Endif
hPict = GetIcon(sDir &/ sFile, iSize)
If Not hPict Then
@ -364,7 +377,7 @@ Private Sub RunPreview()
If $hPreview Then $hPreview.Stop
$hPreview = New CTaskPreview($sDir, GetIconSize()) As "TaskPreview"
$hPreview = New CTaskPreview(GetCurrentDir(), GetIconSize()) As "TaskPreview"
End
@ -388,7 +401,7 @@ Public Sub TaskPreview_Read(Data As String)
sPath = Left(sLine, iPos - 1)
sPreview = Mid$(sLine, iPos + 1)
Try GetView()["1" & sPath].Picture = Image.Load(sPreview).Picture
Try GetView()[PREFIX_FILE & sPath].Picture = Image.Load(sPreview).Picture
Next
@ -404,7 +417,7 @@ End
Private Sub RefreshViewLater()
If $bRefreshTriggered Then Return
$bRefreshTriggered = True
$hRefresh.Trigger
@ -412,7 +425,7 @@ End
Public Sub Refresh_Timer()
$bRefreshTriggered = False
If Not $bRefreshTriggered Then Return
RefreshView
End
@ -482,15 +495,23 @@ Catch
End
Private Sub EnsureRefresh()
Refresh_Timer
End
Private Sub Current_Write(sFile As String)
Dim sKey As String
'Debug sFile
EnsureRefresh
GetView().UnselectAll
sKey = "0" & sFile
If Not GetView().Exist(sKey) Then sKey = "1" & sFile
sKey = PREFIX_DIR & sFile
If Not GetView().Exist(sKey) Then sKey = PREFIX_FILE & sFile
If Not GetView().Exist(sKey) Then Return
GetView()[sKey].Selected = True
@ -575,8 +596,7 @@ Public Sub View_Compare(Key As String, OtherKey As String)
Dim sDir As String
Dim iComp As Integer
sDir = $sDir
If Not sDir Then sDir = User.Home
sDir = GetCurrentDir()
If $hColumnView.Visible Then
$iSort = $hColumnView.Columns.Sort
@ -634,12 +654,9 @@ Private Function Selection_Read() As String[]
Dim hView As Object
Dim aSel As New String[]
If $hIconView.Visible Then
hView = $hIconView
Else
hView = $hColumnView
Endif
EnsureRefresh
hView = GetView()
hView.MoveFirst
While hView.Available
If hView.Item.Selected Then
@ -652,6 +669,27 @@ Private Function Selection_Read() As String[]
End
Private Sub Selection_Write(Value As String[])
Dim hView As Object
Dim sFile As String
Dim hCache As DirCache
If $hIconView.Mode = Select.None Then Return
EnsureRefresh
hCache = DirCache[GetCurrentDir()]
hView = GetView()
hView.UnselectAll
For Each sFile In Value
sFile = If(hCache.IsDir(sFile), PREFIX_DIR, PREFIX_FILE) & sFile
Try hView[sFile].Selected = True
Next
End
Private Sub TakeSelection()
Dim hSrc As Object
@ -788,6 +826,7 @@ End
Public Sub SelectAll()
If $hIconView.Mode <> Select.Multiple Then Return
EnsureRefresh
GetView().SelectAll()
End
@ -855,7 +894,7 @@ Public Sub View_Rename()
Dim hView As Object = GetView()
Dim sKey As String = hView.Item.Key
Dim sOldPath As String = $sDir &/ Mid$(sKey, 2)
Dim sOldPath As String = GetCurrentDir() &/ Mid$(sKey, 2)
Dim sNewName As String = hView.Item.Text
Dim sMsg As String
@ -888,3 +927,4 @@ Catch
Message.Error(("Cannot rename file.") & "\n\n" & Error.Text)
End

View file

@ -110,12 +110,6 @@ End
Public Sub Main()
'Dim hMime As DesktopMime
'Component.Load("gb.desktop")
Application.Theme = "gambas"
'hMime = DesktopMime.FromFile("~/plugin-1.11.193.tar.gz")
'Print hMime.GetIcon("64")
Print Stock["48/tablet"]
End

View file

@ -1,7 +1,8 @@
# Gambas Form File 3.0
{ Form Form
MoveScaled(0,0,44,32)
MoveScaled(0,0,92,79)
Arrangement = Arrange.Fill
Margin = True
{ Menu1 Menu
{ Menu2 Menu
@ -17,18 +18,7 @@
Text = ("Menu5")
}
}
{ ButtonBox1 ButtonBox
MoveScaled(1,1,29,5)
Text = ("ButtonBox1")
}
{ ButtonBox2 ButtonBox
MoveScaled(2,8,29,5)
Text = ("ButtonBox1")
Border = False
}
{ SwitchButton1 SwitchButton
MoveScaled(6,18,16,4)
Value = True
Animated = True
{ FileChooser1 FileChooser
MoveScaled(2,1,78,59)
}
}

View file

@ -15,7 +15,7 @@ AC_PATH_PROG([LLVM_CONFIG], [llvm-config], [no])
if test "x$LLVM_CONFIG" = xno; then
touch DISABLED DISABLED.gb.jit
else
AC_MSG_CHECKING([for LLVM - version >= $min_llvm_version])
AC_MSG_CHECKING([for LLVM, version >= $min_llvm_version])
LLVM_VERSION=`$LLVM_CONFIG --version`