Skip to content
Commits on Source (2)
......@@ -159,6 +159,7 @@ Public Sub btnOK_Click()
If Left($sIcon) = "/" Then $sIcon = Mid$($sIcon, 2)
Case 1
If Not icwStock.Key Then Return
$sIcon = "icon:/" &/ $sSize &/ icwStock.Key
Settings["FSelectIcon/Size"] = $sSize
......
......@@ -3144,7 +3144,7 @@ Private Sub ToggleProcList()
iCurrent = FProcedureList.Popup(Me, Me.Name, $aProc, iCurrent, btnProc.ScreenX, btnProc.ScreenY + btnProc.H, btnProc.W, Me.ClientH - panToolbar.H - Desktop.Scale)
If iCurrent >= 0 Then
Try iLine = $cProc[$aProc[iCurrent]]
GotoFunction(iLine)
If Not Error Then GotoFunction(iLine)
Endif
End
......
......@@ -2,7 +2,6 @@
{ Form Form
MoveScaled(0,0,143,56)
Icon = Picture["img/16/form.png"]
Persistent = True
Arrangement = Arrange.Vertical
{ mnuForm Menu
......
......@@ -143,6 +143,9 @@ End
Public Sub tvwProject_Activate()
Dim sKey As String
Dim sMime As String
Dim hProgList As DesktopFile[]
Dim hProcess As Process
sKey = tvwProject.Key
......@@ -154,7 +157,17 @@ Public Sub tvwProject_Activate()
sKey = File.SetExt(sKey, "class")
Endif
Endif
Project.OpenFile(sKey)
Project.OpenFile(sKey,,, True)
If Project.FileWasUnknown() Then
sMime = MMime.GetMime(sKey)
If sMime Then
hProgList = DesktopFile.FromMime(sMime)
If hProgList.Count Then
hProcess = hProgList[0].Run(sKey)
hProcess.Ignore = True
Endif
Endif
Endif
Endif
Endif
......
......@@ -216,6 +216,8 @@ Private $bBackgroundValid As Boolean
' Another one is created for the offline wiki
Public Documentation As CDocumentation
Private $bFileIsUnknown As Boolean
' If GetFileIcon() has been called on an added file
'Private $bLastAdded As Boolean
......@@ -1943,7 +1945,7 @@ Public Sub IsPatchFile(sPath As String) As Boolean
End
Public Function LoadFile(sPath As String) As Object
Public Function LoadFile(sPath As String, Optional bNoErrorIfUnknown As Boolean) As Object
Dim hForm As Object
Dim bError As Boolean
......@@ -2012,7 +2014,11 @@ Public Function LoadFile(sPath As String) As Object
Dec Application.Busy
Files[sPath] = Null
FMain.ShowError(("Cannot open a binary file."), sPath)
If bNoErrorIfUnknown Then
$bFileIsUnknown = True
Else
FMain.ShowError(("Cannot open a binary file."), sPath)
Endif
Return
Endif
......@@ -2079,7 +2085,14 @@ Public Sub ShowFile(hForm As Form)
End
Public Sub OpenFile(sPath As String, Optional iLine As Integer, Optional iColumn As Integer = -1) As Object
Public Sub FileWasUnknown() As Boolean
Return $bFileIsUnknown
End
Public Sub OpenFile(sPath As String, Optional iLine As Integer, Optional iColumn As Integer = -1, Optional bNoErrorIfUnknown As Boolean) As Object
Dim hForm As Object
Dim bAlreadyLoaded As Boolean
......@@ -2107,7 +2120,8 @@ Public Sub OpenFile(sPath As String, Optional iLine As Integer, Optional iColumn
If Files[sPath] Then bAlreadyLoaded = True
LoadFile(sPath)
$bFileIsUnknown = False
If Not LoadFile(sPath, bNoErrorIfUnknown) Then Return
If Not InsideDirectory(sPath, Project.Dir) Then Tree.AddExtern(sPath)
......
......@@ -549,7 +549,7 @@ Public Sub GetFileIcon(sPath As String, Optional iSize As Integer, hStat As Stat
'bConflict = VersionControl.InConflict(sPath)
If $bCurrentProject Then bConflict = Project.IsConflict(sPath)
sIcon = sPrefix &/ "file"
sIcon = "" 'sPrefix &/ "file"
sExt = File.Ext(sPath)
Select Case sExt
......@@ -603,7 +603,15 @@ Public Sub GetFileIcon(sPath As String, Optional iSize As Integer, hStat As Stat
Case "console"
sIcon = sLocalPrefix &/ "console.png"
Case Else
hImage = DesktopMime.FromFile(sPath).GetIcon(If(iSize, iSize, 16))
If hImage Then
sIcon = "//"
Else
sIcon = sPrefix &/ "file"
Endif
End Select
Endif
......@@ -612,7 +620,8 @@ Public Sub GetFileIcon(sPath As String, Optional iSize As Integer, hStat As Stat
If Left$(sIcon) = "/" Then
Try hImage = Image.Load(sIcon)
If Not hImage Then Try hImage = Image.Load(sIcon)
If hImage Then
fRapport = hImage.Width / hImage.Height
......@@ -712,7 +721,6 @@ ADD_EMBLEM:
Return
End
Private Function IsSourcePath(sPath As String) As Boolean
......