Project tree: Allow move action only when dragging a source code file.

[DEVELOPMENT ENVIRONMENT]
* BUG: Project tree: Allow move action only when dragging a source code file.
This commit is contained in:
gambas 2021-10-22 21:22:48 +02:00
parent d97f8dd764
commit da50778ffa
2 changed files with 11 additions and 2 deletions

View file

@ -1719,22 +1719,27 @@ End
Public Sub tvwProject_DragMove()
'Debug Drag.X;; Drag.Y;; Drag.Action
If Not tvwProject.FindAt(Drag.X, Drag.Y) Then
$sKey = tvwProject.Item.Key
If Project.IsLocked($sKey) Then Goto STOP_EVENT
If Drag.Format = MMime.DATA And If Drag.Source Then
If Not IsDataKey($sKey) Then Goto STOP_EVENT
Else If Drag.Format = MMime.CLASS And If Drag.Source Then
If $sKey <> Project.KEY_SOURCE Then
If Not Project.IsSourcePath($sKey, True) Then Goto STOP_EVENT
Endif
If Drag.Action <> Drag.Move Then Goto STOP_EVENT
Else If Drag.Format = MMime.URI Then
If Not IsDataKey($sKey) Then Goto STOP_EVENT
Else
Goto STOP_EVENT
Endif
With tvwProject[$sKey]
If .Children Then
If Not timOpen.Enabled Or $sKey <> $sKeyDrag Then
@ -1794,7 +1799,7 @@ Public Sub tvwProject_Drop()
Dim aFile As String[]
Dim sSrc As String = Drag.Data
'Debug Drag.Format;; Drag.Data
'Debug Drag.Action;; Drag.Format;; Drag.Data
'
$hProjectTree.FillDir($sKey)
@ -1829,6 +1834,8 @@ Public Sub tvwProject_MouseDrag()
Dim sKey As String
'Debug Mouse.StartX;; Mouse.StartY
If Not Mouse.Left Then Return
If tvwProject.FindAt(Mouse.StartX, Mouse.StartY) Then Return
@ -2133,6 +2140,8 @@ End
Public Sub tvwProject_Drag()
'Debug
End
Public Sub mnuStatusBar_Click()

View file

@ -5289,7 +5289,7 @@ Public Sub MoveFile(sSrc As String, sDst As String, Optional bOther As Boolean)
Catch
FMain.ShowError(Subst(("Cannot move file &1."), File.Name(sSrc)) & "\n\n" & Error.Text & "\n<tt>" & Error.Backtrace.Join(" ") & "</tt>", sSrc)
FMain.ShowErrorWith(Subst(("Cannot move file &1."), File.Name(sSrc)))
End