if not gPlaySeq and not (the name of member the memberNum of sprite the clickOn = "marker") and not (the visible of window "help") then
set startPos to the loc of sprite the clickOn
set the memberNum of sprite 48 to the number of member the memberNum of sprite the clickOn
set the ink of sprite 48 to 36
set the visible of sprite the clickOn to 0
repeat while the mouseDown
set the locH of sprite 48 to the mouseH
set the locV of sprite 48 to the mouseV
updateStage()
end repeat
end if
end
on mouseUp
global startPos, gfirstmarker, glastmarker, gPlaySeq, gStartSeq, gBlue, markerList
if not gPlaySeq and not (the name of member the memberNum of sprite the clickOn = "marker") and not (the visible of window "help") then
set interseca to 0
repeat with i = 2 to 9
if sprite 48 intersects sprite(i) then
set interseca to 1
exit repeat
end if
end repeat
set the memberNum of sprite 48 to 1000
if (the mouseH >= (integer(chars(word 1 of string(startPos), 7, length(word 1 of string(startPos)) - 1)) - 5)) and (the mouseH <= (integer(chars(word 1 of string(startPos), 7, length(word 1 of string(startPos)) - 1)) + 5)) and (the mouseV >= (integer(chars(word 2 of string(startPos), 1, length(word 2 of string(startPos)) - 1)) - 5)) and (the mouseV <= (integer(chars(word 2 of string(startPos), 1, length(word 2 of string(startPos)) - 1)) + 5)) then
set the loc of sprite the clickOn to startPos
set the visible of sprite the clickOn to 1
set interseca to 1
set i to the clickOn
end if
if interseca then
set num to integer(chars(the name of member the memberNum of sprite the clickOn, 2, length(the name of member the memberNum of sprite the clickOn)))
if the name of member the memberNum of sprite i = "marker" then
deleteAt(markerList, gfirstmarker + the clickOn - 2)
append(markerList, num)
set the loc of sprite the clickOn to startPos
set the visible of sprite the clickOn to 1
repeat with i = 2 to 9
set the memberNum of sprite i to the number of member "marker"
end repeat
set j to 1
repeat with i = gfirstmarker to 7 + gfirstmarker
set j to j + 1
if i > count(markerList) then
exit repeat
next repeat
end if
set gN to "g" & getAt(markerList, i)
set the memberNum of sprite j to the number of member gN
set glastmarker to i
end repeat
else
deleteAt(markerList, gfirstmarker + the clickOn - 2)
set gN to "g" & num
addAt(markerList, gfirstmarker + i - 2, num)
set the loc of sprite the clickOn to startPos
set the visible of sprite the clickOn to 1
repeat with i = 2 to 9
set the memberNum of sprite i to the number of member "marker"
end repeat
set j to 1
repeat with i = gfirstmarker to 7 + gfirstmarker
set j to j + 1
if i > count(markerList) then
exit repeat
else
set gN to "g" & getAt(markerList, i)
set the memberNum of sprite j to the number of member gN
set glastmarker to i
end if
updateStage()
end repeat
end if
else
deleteAt(markerList, gfirstmarker + the clickOn - 2)
set the loc of sprite the clickOn to startPos
set the visible of sprite the clickOn to 1
repeat with i = 2 to 9
set the memberNum of sprite i to the number of member "marker"
end repeat
set j to 1
repeat with i = gfirstmarker to 7 + gfirstmarker
set j to j + 1
if i > count(markerList) then
exit repeat
else
set gN to "g" & getAt(markerList, i)
set the memberNum of sprite j to the number of member gN
set glastmarker to i
end if
updateStage()
end repeat
if (the name of member the memberNum of sprite 2 = "marker") and (markerList <> []) then
set nS to "g" & getLast(markerList)
set the memberNum of sprite 2 to the number of member nS
set gfirstmarker to getLast(markerList)
set glastmarker to getLast(markerList)
updateStage()
end if
end if
put EMPTY into field "fieldMarkerSeq"
repeat with i = 1 to count(markerList)
put getAt(markerList, i) & " " after field "fieldMarkerSeq"
end repeat
set the textFont of member "fieldMarkerSeq" to "arial"
set the textSize of member "fieldMarkerSeq" to 10
set the foreColor of member "fieldMarkerSeq" to 0
case word 2 of field "fieldDuration" of
"sec":
set sec to 1920 * the number of words in field "fieldMarkerSeq" / float(field "fieldBpm")
set sec to integer(sec)
set min to sec / 60
if min = 0 then
set min to "00"
end if
if (min >= 1) and (min <= 9) then
set min to "0" & min
end if
set sec to sec mod 60
if sec = 0 then
set sec to "00"
end if
if (sec >= 1) and (sec <= 9) then
set sec to "0" & sec
end if
put min & ":" & sec & " sec" into field "fieldDuration"
otherwise:
put 8 * the number of words in field "fieldMarkerSeq" & " bars" into field "fieldDuration"
end case
set the textFont of member "fieldDuration" to "IK10"
set the foreColor of member "fieldDuration" to gBlue