@ -965,7 +965,7 @@ def duplicateBlock(blockId, times = 1):
callbacks . _updateTrack ( id ( track ) )
#callbacks._setCursor()
def duplicateContentLinkBlock ( blockId , times = 1 ) :
def duplicateContentLinkBlock ( blockId , times = 1 ) :
track , block = session . data . blockById ( blockId )
session . history . register ( lambda i = id ( track ) , l = track . asListOfBlockIds ( ) : rearrangeBlocks ( i , l ) , descriptionString = " content link block " )
for i in range ( times ) :
@ -973,6 +973,23 @@ def duplicateContentLinkBlock(blockId, times = 1):
callbacks . _updateTrack ( id ( track ) )
#callbacks._setCursor() #this will make the GUI jump around because it centers on the cursor
def duplicateToReservedSpaceBlock ( blockId , times = 1 ) :
""" Create a new block that has the same duration as the given one.
The duration will be reserved .
Intended for the composition phase .
For example used to create a template for a second voice , where the total duration
is already known and can be reserved , so the following blocks are in the right place . """
track , block = session . data . blockById ( blockId )
session . history . register ( lambda i = id ( track ) , l = track . asListOfBlockIds ( ) : rearrangeBlocks ( i , l ) , descriptionString = " duplicate block as reserved space " )
for i in range ( times ) :
track . duplicateToReservedSpaceBlock ( block )
callbacks . _updateTrack ( id ( track ) )
def duplicateToReservedSpaceCurrentBlock ( ) :
currentBlockId = id ( session . data . currentTrack ( ) . currentBlock ( ) )
duplicateToReservedSpaceBlock ( currentBlockId , 1 ) #handles callbacks and undo
def moveBlockToOtherTrack ( blockId , newTrackId , listOfBlockIdsForNewTrack ) :
""" First move the block to the new track and then
rearrange both tracks
@ -1106,15 +1123,6 @@ def moveCurrentBlockToStartOfTrack():
moveBlockToStartOfTrack ( id ( session . data . currentTrack ( ) . currentBlock ( ) ) )
#deprecated
def _setBlockData ( block , newData ) :
""" DEPRECATED. This did not work. The linked blocks were not reduced.
At point of the bug reports , instead of fixing this , we used
duplicate block and delete which already provides all functionality """
session . history . register ( lambda bl = block , old = block . data : _setBlockData ( bl , old ) , descriptionString = " set block data " )
block . data = newData
#no callbacks needed.
#Cursor
def getCursorPitch ( ) :