当前位置: 首页>>代码示例>>C++>>正文


C++ SyncDocument::endMacro方法代码示例

本文整理汇总了C++中SyncDocument::endMacro方法的典型用法代码示例。如果您正苦于以下问题:C++ SyncDocument::endMacro方法的具体用法?C++ SyncDocument::endMacro怎么用?C++ SyncDocument::endMacro使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SyncDocument的用法示例。


在下文中一共展示了SyncDocument::endMacro方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: editBiasValue

void TrackView::editBiasValue(float amount)
{
	SyncDocument *doc = getDocument();

	if (0 == getTrackCount()) {
		QApplication::beep();
		return;
	}

	QRect selection = getSelection();

	doc->beginMacro("bias");
	for (int track = selection.left(); track <= selection.right(); ++track) {
		Q_ASSERT(track < getTrackCount());
		SyncTrack *t = getTrack(track);

		for (int row = selection.top(); row <= selection.bottom(); ++row) {
			if (t->isKeyFrame(row)) {
				SyncTrack::TrackKey k = t->getKeyFrame(row); // copy old key
				k.value += amount; // modify value

				// add sub-command
				doc->setKeyFrame(t, k);
			}
		}
	}
	doc->endMacro();

	dirtyCurrentValue();
}
开发者ID:kusma,项目名称:rocket,代码行数:30,代码来源:trackview.cpp

示例2: editClear

void TrackView::editClear()
{
	SyncDocument *doc = getDocument();

	QRect selection = getSelection();

	if (0 == getTrackCount()) return;
	Q_ASSERT(selection.right() < getTrackCount());

	doc->beginMacro("clear");
	for (int track = selection.left(); track <= selection.right(); ++track) {
		SyncTrack *t = getTrack(track);

		for (int row = selection.top(); row <= selection.bottom(); ++row) {
			if (t->isKeyFrame(row))
				doc->deleteKeyFrame(t, row);
		}
	}

	doc->endMacro();
	dirtyCurrentValue();
}
开发者ID:kusma,项目名称:rocket,代码行数:22,代码来源:trackview.cpp

示例3: editPaste

void TrackView::editPaste()
{
	SyncDocument *doc = getDocument();

	if (0 == getTrackCount()) {
		QApplication::beep();
		return;
	}

	const QMimeData *mimeData = QApplication::clipboard()->mimeData();
	if (mimeData->hasFormat("application/x-gnu-rocket")) {
		const QByteArray mimeDataBuffer = mimeData->data("application/x-gnu-rocket");
		const char *clipbuf = mimeDataBuffer.data();

		// copy data
		int buffer_width, buffer_height, buffer_size;
		memcpy(&buffer_width,  clipbuf + 0,               sizeof(int));
		memcpy(&buffer_height, clipbuf + sizeof(int),     sizeof(int));
		memcpy(&buffer_size,   clipbuf + 2 * sizeof(int), sizeof(int));

		doc->beginMacro("paste");
		for (int i = 0; i < buffer_width; ++i) {
			int trackPos = editTrack + i;
			if (trackPos >= getTrackCount()) continue;

			SyncTrack *t = getTrack(trackPos);
			for (int j = 0; j < buffer_height; ++j) {
				int row = editRow + j;
				if (t->isKeyFrame(row))
					doc->deleteKeyFrame(t, row);
			}
		}

		const char *src = clipbuf + 2 * sizeof(int) + sizeof(size_t);
		for (int i = 0; i < buffer_size; ++i)
		{
			struct CopyEntry ce;
			memcpy(&ce, src, sizeof(CopyEntry));
			src += sizeof(CopyEntry);

			Q_ASSERT(ce.track >= 0);
			Q_ASSERT(ce.track < buffer_width);
			Q_ASSERT(ce.keyFrame.row >= 0);
			Q_ASSERT(ce.keyFrame.row < buffer_height);

			int trackPos = editTrack + ce.track;
			if (trackPos < getTrackCount()) {
				SyncTrack::TrackKey key = ce.keyFrame;
				key.row += editRow;

				// since we deleted all keyframes in the edit-box already, we can just insert this one.
				doc->setKeyFrame(getTrack(trackPos), key);
			}
		}
		doc->endMacro();

		dirtyCurrentValue();

		clipbuf = NULL;
	} else
		QApplication::beep();
}
开发者ID:kusma,项目名称:rocket,代码行数:62,代码来源:trackview.cpp


注:本文中的SyncDocument::endMacro方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。