|
|
|
@ -13,14 +13,34 @@ import (
|
|
|
|
|
func handleMouse(event *cview.EventMouse) *cview.EventMouse { |
|
|
|
|
if event.Action()&cview.MouseDown != 0 && event.Buttons()&tcell.Button1 != 0 { |
|
|
|
|
mouseX, mouseY := event.Position() |
|
|
|
|
if mouseY > 0 && mouseY < mainBufHeight+1 { |
|
|
|
|
if mouseY >= 0 && mouseY < mainBufHeight { |
|
|
|
|
if queueFocused { |
|
|
|
|
queueFocused = false |
|
|
|
|
go app.QueueUpdateDraw(updateLists) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// TODO Delay playing while cursor is moved
|
|
|
|
|
if mouseY-1 < len(mainBufferFiles)+1 { |
|
|
|
|
if mouseY > 0 && mouseY < mainBufHeight-1 && mouseY-1 < len(mainBufferFiles)+1 { |
|
|
|
|
mainBufferCursor = mainBufferOrigin + (mouseY - 1) |
|
|
|
|
go app.QueueUpdateDraw(updateMain) |
|
|
|
|
go app.QueueUpdateDraw(updateLists) |
|
|
|
|
go listSelect() |
|
|
|
|
} |
|
|
|
|
return nil |
|
|
|
|
} else if mouseY >= mainBufHeight && mouseY < screenHeight-2 { |
|
|
|
|
if !queueFocused { |
|
|
|
|
queueFocused = true |
|
|
|
|
go app.QueueUpdateDraw(updateLists) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if mouseY > mainBufHeight && mouseY < screenHeight-3 { |
|
|
|
|
mouseHit := (mouseY - mainBufHeight) - 1 |
|
|
|
|
if mouseHit < len(queueFiles) { |
|
|
|
|
queueCursor = queueOrigin + mouseHit |
|
|
|
|
go app.QueueUpdateDraw(updateLists) |
|
|
|
|
go queueSelect() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return nil |
|
|
|
|
} else if mouseY == screenHeight-1 { |
|
|
|
|
if mouseX >= seekStart && mouseX <= seekEnd { |
|
|
|
|
if strings.ToLower(path.Ext(playingFileName)) == ".flac" { |
|
|
|
|