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


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

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


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

示例1: onMouseMove

LRESULT TrackView::onMouseMove(UINT /*flags*/, POINTS pos)
{
	if (GetCapture() == hwnd) {
		SyncDocument *doc = getDocument();
		const int posTrack = getTrackFromX(pos.x),
		    trackCount = getTrackCount();

		if (!doc || posTrack < 0 || posTrack >= trackCount)
			return FALSE;

		if (posTrack > anchorTrack) {
			for (int i = anchorTrack; i < posTrack; ++i)
				doc->swapTrackOrder(i, i + 1);
			anchorTrack = posTrack;
			setEditTrack(posTrack);
			InvalidateRect(hwnd, NULL, FALSE);
		} else if (posTrack < anchorTrack) {
			for (int i = anchorTrack; i > posTrack; --i)
				doc->swapTrackOrder(i, i - 1);
			anchorTrack = posTrack;
			setEditTrack(posTrack);
			InvalidateRect(hwnd, NULL, FALSE);
		}
	}
	return FALSE;
}
开发者ID:henrikno,项目名称:rocket,代码行数:26,代码来源:trackview.cpp

示例2: onKeyDown

LRESULT TrackView::onKeyDown(UINT keyCode, UINT /*flags*/)
{
	SyncDocument *doc = getDocument();
	if (NULL == doc) return FALSE;
	
	if (!editString.empty())
	{
		switch(keyCode)
		{
		case VK_UP:
		case VK_DOWN:
		case VK_LEFT:
		case VK_RIGHT:
		case VK_PRIOR:
		case VK_NEXT:
		case VK_HOME:
		case VK_END:
			editEnterValue();
		}
	}
	
	if (editString.empty())
	{
		switch (keyCode)
		{
		case VK_LEFT:
			if (GetKeyState(VK_CONTROL) < 0) {
				if (0 < editTrack)
					doc->swapTrackOrder(editTrack, editTrack - 1);
				else
					MessageBeep(~0U);
			}
			if (0 != getTrackCount())
				setEditTrack(editTrack - 1);
			else
				MessageBeep(~0U);
			break;
		
		case VK_RIGHT:
			if (GetKeyState(VK_CONTROL) < 0) {
				if (int(getTrackCount()) > editTrack + 1)
					doc->swapTrackOrder(editTrack, editTrack + 1);
				else
					MessageBeep(~0U);
			}
			if (0 != getTrackCount())
				setEditTrack(editTrack + 1);
			else
				MessageBeep(~0U);
			break;
		}
	}

	if (editString.empty() && doc->clientSocket.clientPaused) {
		switch (keyCode) {
		case VK_UP:
			if (GetKeyState(VK_CONTROL) < 0)
			{
				float bias = 1.0f;
				if (GetKeyState(VK_SHIFT) < 0) bias = 0.1f;
				if (int(getTrackCount()) > editTrack) editBiasValue(bias);
				else
					MessageBeep(~0U);
			}
			else setEditRow(editRow - 1);
			break;
		
		case VK_DOWN:
			if (GetKeyState(VK_CONTROL) < 0)
			{
				float bias = 1.0f;
				if (GetKeyState(VK_SHIFT) < 0) bias = 0.1f;
				if (int(getTrackCount()) > editTrack) editBiasValue(-bias);
				else
					MessageBeep(~0U);
			}
			else setEditRow(editRow + 1);
			break;
		
		case VK_PRIOR:
			if (GetKeyState(VK_CONTROL) < 0)
			{
				float bias = 10.0f;
				if (GetKeyState(VK_SHIFT) < 0) bias = 100.0f;
				editBiasValue(bias);
			}
			else setEditRow(editRow - 0x10);
			break;
		
		case VK_NEXT:
			if (GetKeyState(VK_CONTROL) < 0)
			{
				float bias = 10.0f;
				if (GetKeyState(VK_SHIFT) < 0) bias = 100.0f;
				editBiasValue(-bias);
			}
			else setEditRow(editRow + 0x10);
			break;
		
		case VK_HOME:
//.........这里部分代码省略.........
开发者ID:henrikno,项目名称:rocket,代码行数:101,代码来源:trackview.cpp


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