global gTraccia, gOn, gGrooveSel, gSync, gFirstClick, gGreen, virTracklIst
if gOn and not (the visible of window "help") then
if not gSync or (gSync and gFirstClick) then
set gFirstClick to 0
set nomeSprite to the name of member the memberNum of sprite the clickOn
if (chars(nomeSprite, 1, 2) <> "gr") and (char 1 of nomeSprite <> "h") then
put EMPTY into field "fieldRandom"
if gTraccia then
set the foreColor of word 2 of line getAt(virTracklIst, gTraccia) of field "fieldAudio" to gGreen
end if
set gTraccia to 0
set pos to the clickOn - 29
set hg to "H" & chars(nomeSprite, 2, length(nomeSprite))
puppetSprite(12, 1)
set the memberNum of sprite 12 to the number of member hg
set the ink of sprite 12 to 36
set the loc of sprite 12 to the loc of sprite the clickOn
set gGrooveSel to integer(chars(nomeSprite, 2, length(nomeSprite)))
groove_mem(pos)
end if
end if
end if
set the editable of member "fieldBpm" to 0
end
on rightMouseDown
global startPos, startRect, gOn, gGrooveSel, gSync, markerList
if gOn and not gSync and not (the visible of window "help") then
if (chars(the name of member the memberNum of sprite the clickOn, 1, 2) <> "gr") and (chars(the name of member the memberNum of sprite the clickOn, 2, length(the name of member the memberNum of sprite the clickOn)) <> string(gGrooveSel)) then
set startPos to the loc of sprite the clickOn
set startRect to the rect of sprite the clickOn
set the memberNum of sprite 58 to the number of member the memberNum of sprite the clickOn
set the ink of sprite 58 to 36
set the visible of sprite the clickOn to 0
repeat while the mouseDown
set the locH of sprite 58 to the mouseH
set the locV of sprite 58 to the mouseV
updateStage()
end repeat
end if
end if
end
on rightMouseUp
global startPos, startRect, gOn, gGrooveSel, glastmarker, gSync, markerList
if gOn and not gSync and not (the visible of window "help") then
set trovato to 0
set newPos to point(the mouseH, the mouseV)
if inside(newPos, startRect) then
set the loc of sprite the clickOn to startPos
set trovato to 1
end if
if not trovato then
set numero to the name of member the memberNum of sprite the clickOn
set numero to integer(chars(numero, 2, length(numero)))
repeat with i = numero + 1 to the lineCount of member "grooveMem"
put line i of field "grooveMem" into line i - 1 of field "grooveMem"
end repeat
put EMPTY into line the lineCount of member "grooveMem" of field "grooveMem"
delete char -30003 of field "grooveMem"
set the loc of sprite the clickOn to startPos
case the lineCount of member "grooveMem" of
0:
repeat with i = 1 to 8
set nome to "groove" & i
set the memberNum of sprite (29 + i) to the number of member nome
end repeat
otherwise:
if (the clickOn = 30) and (the lineCount of member "grooveMem" = (numero - 1)) then
set nS to "g" & numero - 1
set the memberNum of sprite 30 to the number of member nS
else
set j to numero - 1
repeat with i = the clickOn - 29 to 8
set j to j + 1
if j <= the lineCount of member "grooveMem" then
set nS to "g" & j
else
set nS to "groove" & i
end if
set the memberNum of sprite (29 + i) to the number of member nS
end repeat
end if
end case
if gGrooveSel then
if gGrooveSel > integer(numero) then
set gGrooveSel to gGrooveSel - 1
end if
repeat with i = 37 down to 29
if chars(the name of member the memberNum of sprite i, 1, 2) <> "gr" then
set lastNum to integer(chars(the name of member the memberNum of sprite i, 2, length(the name of member the memberNum of sprite i)))
exit repeat
end if
end repeat
set firstNum to integer(chars(the name of member the memberNum of sprite 30, 2, length(the name of member the memberNum of sprite 30)))
if (gGrooveSel >= firstNum) and (gGrooveSel <= lastNum) then
puppetSprite(12, 1)
set nS to "h" & gGrooveSel
set the memberNum of sprite 12 to the number of member nS
set the loc of sprite 12 to the loc of sprite (29 + (gGrooveSel - firstNum + 1))
end if
end if
updateStage()
if markerList <> [] then
repeat while getPos(markerList, numero)
if numero <= glastmarker then
set glastmarker to glastmarker - 1
end if
deleteAt(markerList, getPos(markerList, numero))
end repeat
put EMPTY into field "fieldMarkerSeq"
repeat with i = 1 to count(markerList)
if getAt(markerList, i) > numero then
setAt(markerList, i, getAt(markerList, i) - 1)
end if
put getAt(markerList, i) & " " after field "fieldMarkerSeq"
end repeat
set the textFont of member "fieldMarkerSeq" to "Arial"