[DEVELOPMENT ENVIRONMENT]

* NEW: Automatic completion of icon paths (i.e. strings beginning with 
  "icon:/").
* BUG: The Backspace key now works correctly with autocompletion of project 
  paths (i.e. strings beginning with "./").


git-svn-id: svn://localhost/gambas/trunk@5834 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2013-09-07 13:45:16 +00:00
parent 5752d9b20c
commit fd639b312b
2 changed files with 52 additions and 14 deletions

View file

@ -558,10 +558,36 @@ Private Sub FillWithFiles(sWord As String)
Dim sDir As String
Dim hPictFile As Picture = Picture["icon:/16/file"]
Dim hPictDir As Picture = Picture["icon:/16/directory"]
Dim aDir As String[]
ClearRows
sDir = sWord
If sDir = "icon:/" Then
aDir = ["small", "medium", "large", "huge", "16", "22", "32", "48", "96", "128", "256"]
For Each sName In aDir.Sort(gb.Natural)
'hPict = Desktop.GetFileIcon(sDir &/ sName, 16)
'If Not hPict Then hPict = hPictFile
AddRow(CStr(MHelp.TYPE_FILE) & sName, sName, hPictDir)
$iMaxLen = Max($iMaxLen, String.Len(sName))
Next
Else If sDir Like "icon:/*/" Then
aDir = Stock.Icons
For Each sName In aDir.Sort(gb.Natural)
'hPict = Desktop.GetFileIcon(sDir &/ sName, 16)
'If Not hPict Then hPict = hPictFile
AddRow(CStr(MHelp.TYPE_FILE) & sName, sName, Picture["icon:/small" &/ sName])
$iMaxLen = Max($iMaxLen, String.Len(sName))
Next
Else
If sDir And If Left(sDir) <> "/" And If sDir Not Begins "~/" Then
sDir = Project.Dir &/ sDir
Endif
@ -570,13 +596,17 @@ Private Sub FillWithFiles(sWord As String)
sDir = Left(sDir, iPos)
If Not IsDir(sDir) Then Return
For Each sName In Dir(sDir, "*").Sort(gb.IgnoreCase + gb.Natural)
aDir = Dir(sDir, "*").Sort(gb.IgnoreCase + gb.Natural)
For Each sName In aDir
'hPict = Desktop.GetFileIcon(sDir &/ sName, 16)
'If Not hPict Then hPict = hPictFile
AddRow(CStr(MHelp.TYPE_FILE) & sName, sName, If(IsDir(sDir &/ sName), hPictDir, hPictFile))
$iMaxLen = Max($iMaxLen, String.Len(sName))
Next
Endif
$bShowHelp = False
End
@ -941,3 +971,11 @@ Public Sub timHideLater_Timer()
Me.Hide
End
Static Public Sub IsPath(sWord As String) As Boolean
If Left(sWord) = "/" Or If Left(sWord) = "~" Or If Left(sWord, 2) = "./" Or If sWord Begins "icon:/" Then Return True
End

View file

@ -2106,7 +2106,7 @@ Private Sub CheckCompletion(sMode As String)
If sWord Then
If Left(sWord) = "/" Or If Left(sWord) = "~" Then
If FCompletion.IsPath(sWord) Then
FCompletion.Open(Me, "/", sWord)
Return
Endif