Exemplo n.º 1
0
static void deleteArea(int rowPos, int track, int bufferWidth, int bufferHeight)
{
	int i, j;
	const int track_count = getTrackCount();
	struct sync_track** tracks = getTracks();

	Commands_beginMulti("deleteArea");

	for (i = 0; i < bufferWidth; ++i) 
	{
		struct sync_track* t;
		int trackPos = track + i;
		int trackIndex = trackPos;

		if (trackPos >= track_count) 
			continue;

		t = tracks[trackIndex];

		for (j = 0; j < bufferHeight; ++j) 
		{
			int row = rowPos + j;

			Commands_deleteKey(trackIndex, row);
		}
	}

	Commands_endMulti();
	updateNeedsSaving();
}
Exemplo n.º 2
0
static void biasSelection(float value)
{
	int track, row;
	struct sync_track** tracks = getTracks();
	TrackViewInfo* viewInfo = getTrackViewInfo();
	int selectLeft = mini(viewInfo->selectStartTrack, viewInfo->selectStopTrack);
	int selectRight = maxi(viewInfo->selectStartTrack, viewInfo->selectStopTrack);
	int selectTop = mini(viewInfo->selectStartRow, viewInfo->selectStopRow);
	int selectBottom = maxi(viewInfo->selectStartRow, viewInfo->selectStopRow);
	
	// If we have no selection and no currenty key bias the previous key

	if (selectLeft == selectRight && selectTop == selectBottom)
	{
		int idx;
		struct sync_track* track;
		struct sync_track** tracks = getTracks();

		if (!tracks || !tracks[getActiveTrack()]->keys)
			return;

		track = tracks[getActiveTrack()];

		idx = sync_find_key(track, getRowPos());
		
		if (idx < 0) 
		{
			idx = -idx - 1;
			selectTop = selectBottom = track->keys[emaxi(idx - 1, 0)].row;
		}
	}
	
	Commands_beginMulti("biasSelection");

	for (track = selectLeft; track <= selectRight; ++track) 
	{
		struct sync_track* t = tracks[track];

		for (row = selectTop; row <= selectBottom; ++row) 
		{
			struct track_key newKey;
			int idx = sync_find_key(t, row);
			if (idx < 0) 
				continue;

			newKey = t->keys[idx];
			newKey.value += value;

			Commands_updateKey(track, &newKey);
		}
	}

	Commands_endMulti();
	updateNeedsSaving();
}
Exemplo n.º 3
0
void Commands_clearBookmarks(TrackData* trackData)
{
	int i, bookmarkCount = trackData->bookmarkCount;
	int* bookmarks = trackData->bookmarks;

	if (trackData->bookmarkCount == 0)
		return;

	Commands_beginMulti("clearBookmarks");

	for (i = 0; i < bookmarkCount; ++i)
	{
		const int bookmark = *bookmarks++;

		if (bookmark == 0)
			continue;

		Commands_toggleBookmark(trackData, bookmark);
	}

	Commands_endMulti();
}
Exemplo n.º 4
0
void Commands_clearLoopmarks(TrackData* trackData)
{
	int i, loopmarkCount = trackData->loopmarkCount;
	int* loopmarks = trackData->loopmarks;

	if (trackData->loopmarkCount == 0)
		return;

	Commands_beginMulti("clearLoopmarks");

	for (i = 0; i < loopmarkCount; ++i)
	{
		const int loopmark = *loopmarks++;

		if (loopmark == 0)
			continue;

		Commands_toggleLoopmark(trackData, loopmark);
	}

	Commands_endMulti();
}
Exemplo n.º 5
0
static void onPaste()
{
	const int buffer_width = s_copyData.bufferWidth;
	const int buffer_height = s_copyData.bufferHeight;
	const int buffer_size = s_copyData.count;
	const int track_count = getTrackCount();
	const int row_pos = getRowPos();
	const int active_track = getActiveTrack();
	int i, trackPos;

	if (!s_copyData.entries)
		return;

	// First clear the paste area

	deleteArea(row_pos, active_track, buffer_width, buffer_height);

	Commands_beginMulti("pasteArea");

	for (i = 0; i < buffer_size; ++i)
	{
		const CopyEntry* ce = &s_copyData.entries[i];
		
		trackPos = active_track + ce->track;
		if (trackPos < track_count)
		{
			size_t trackIndex = trackPos;
			struct track_key key = ce->keyFrame;
			key.row += row_pos;

			Commands_addOrUpdateKey(trackIndex, &key);
		}
	}

	Commands_endMulti();
	updateNeedsSaving();
}