예제 #1
0
void BaseEditor::OnMouseWheelEvt(wxMouseEvent& event)
{
	int lines = -event.GetWheelRotation() / event.GetWheelDelta();

	if (event.ShiftDown())
	{
		int nPos = GetScrollPos(wxHORIZONTAL);
		SetScrollPos(wxHORIZONTAL, nPos + lines * event.GetLinesPerAction() * SCROLL_LINE_DISTANCE);
		UpdateScrollPosition(GetScrollPos(wxHORIZONTAL), GetScrollPos(wxVERTICAL));
	}
	else if (event.ControlDown())
	{
		if (lines < 0)
		{
			ZoomIn();
		}
		else
		{
			ZoomOut();
		}
	}
	else
	{
		int nPos = GetScrollPos(wxVERTICAL);
		SetScrollPos(wxVERTICAL, nPos + lines * event.GetLinesPerAction() * SCROLL_LINE_DISTANCE);
		UpdateScrollPosition(GetScrollPos(wxHORIZONTAL), GetScrollPos(wxVERTICAL));
	}
}
예제 #2
0
void BaseEditor::OnScrollThumbTrackEvt(wxScrollWinEvent& event)
{
	int nOrientation = event.GetOrientation();
	int nPos = event.GetPosition();
	if (nOrientation == wxHORIZONTAL)
	{
		UpdateScrollPosition(nPos, GetScrollPos(wxVERTICAL));
	}
	else
	{
		UpdateScrollPosition(GetScrollPos(wxHORIZONTAL), nPos);
	}
}
예제 #3
0
long CMemoryCardView::OnVScroll(unsigned int nType, unsigned int nThumb)
{
	switch(nType)
	{
	case SB_LINEDOWN:
		m_viewState.m_nScrollPosition += 5;
		break;
	case SB_LINEUP:
		m_viewState.m_nScrollPosition -= 5;
		break;
	case SB_PAGEDOWN:
		m_viewState.m_nScrollPosition += 35;
		break;
	case SB_PAGEUP:
		m_viewState.m_nScrollPosition -= 35;
		break;
	case SB_THUMBPOSITION:
	case SB_THUMBTRACK:
		m_viewState.m_nScrollPosition = GetVerticalScrollBar().GetThumbPosition();
		break;
	default:
		return FALSE;
		break;
	}

	UpdateScrollPosition();

	return TRUE;	
}
예제 #4
0
void BaseEditor::OnScrollThumbReleaseEvt(wxScrollWinEvent& event)
{
	int nOrientation = event.GetOrientation();
	int nPos = event.GetPosition();
	SetScrollPos(nOrientation, nPos, true);
	UpdateScrollPosition(GetScrollPos(wxHORIZONTAL), GetScrollPos(wxVERTICAL));
}
예제 #5
0
void BaseEditor::OnScrollPageDownEvt(wxScrollWinEvent& event)
{
	int nOrientation = event.GetOrientation();
	int nDistance = GetScrollThumb(nOrientation);
	int nPos = GetScrollPos(nOrientation);
	SetScrollPos(nOrientation, nPos+nDistance, true);
	UpdateScrollPosition(GetScrollPos(wxHORIZONTAL), GetScrollPos(wxVERTICAL));
}
예제 #6
0
void BaseEditor::OnScrollLineDownEvt(wxScrollWinEvent& event)
{
	int nOrientation = event.GetOrientation();

	int nPos = GetScrollPos(nOrientation);
	SetScrollPos(nOrientation, nPos+SCROLL_LINE_DISTANCE, true);
	UpdateScrollPosition(GetScrollPos(wxHORIZONTAL), GetScrollPos(wxVERTICAL));
}
예제 #7
0
void CWFView::AutoScroll(CPoint &point)
{
	CBTEditDoc* pDoc = GetDocument();
	RECT ClientRect;
	GetClientRect(&ClientRect);

	SWORD TWidth = (SWORD)pDoc->GetTextureWidth();
	SWORD THeight = (SWORD)pDoc->GetTextureHeight();

	if(point.x > ClientRect.right - TWidth) {
		RECT WindowRect;
		GetWindowRect(&WindowRect);
		m_ScrollX += pDoc->GetTextureWidth();
		UpdateScrollPosition();
		SetCursorPos(WindowRect.left+point.x-TWidth,WindowRect.top+point.y);
	}

	if(point.y > ClientRect.bottom - THeight) {
		RECT WindowRect;
		GetWindowRect(&WindowRect);
		m_ScrollY += pDoc->GetTextureHeight();
		UpdateScrollPosition();
		SetCursorPos(WindowRect.left+point.x,WindowRect.top+point.y-THeight);
	}

	if(point.x < TWidth) {
		RECT WindowRect;
		GetWindowRect(&WindowRect);
		m_ScrollX -= pDoc->GetTextureWidth();
		UpdateScrollPosition();
		SetCursorPos(WindowRect.left+point.x+TWidth,WindowRect.top+point.y);
	}

	if(point.y < THeight) {
		RECT WindowRect;
		GetWindowRect(&WindowRect);
		m_ScrollY -= pDoc->GetTextureHeight();
		UpdateScrollPosition();
		SetCursorPos(WindowRect.left+point.x,WindowRect.top+point.y+THeight);
	}
}
예제 #8
0
bool BaseEditor::Zoom(int zoom)
{
	if (zoom < ZOOM_MIN || zoom > ZOOM_MAX) return false;
	if (m_nZoom == zoom) return true;

	m_ptOriginOffset = (m_ptOriginOffset/m_nZoom)*zoom;
	m_nZoom = zoom;
	UpdateVirtualSize();
	UpdateScrollPosition(GetScrollPos(wxHORIZONTAL), GetScrollPos(wxVERTICAL));

	return true;
}
예제 #9
0
bool ClipBitmapStyleEditor::SetClipBitmapStyle(const ClipBitmapStyle* pClipBitmapStyle)
{
	if (m_pClipBitmapStyle == pClipBitmapStyle) return false;
	m_pClipBitmapStyle = pClipBitmapStyle;

	UpdateSubBitmapRect();

	SetSelState(IStyle::SS_NUM);
	UpdateVirtualSize();
	UpdateScrollPosition(GetScrollPos(wxHORIZONTAL), GetScrollPos(wxVERTICAL));
	return true;
}
예제 #10
0
long CMemoryCardView::OnMouseWheel(int x, int y, short z)
{
	if(z < 0)
	{
		m_viewState.m_nScrollPosition += 35;
	}
	else
	{
		m_viewState.m_nScrollPosition -= 35;
	}

	UpdateScrollPosition();
	return TRUE;
}
예제 #11
0
void CWFView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) 
{
	m_KeyHandler->HandleKeyDown(nChar);

	CBTEditDoc* pDoc = GetDocument();

	if(pDoc->Get2DMode() == M2D_WORLD) {
		BOOL Changed = FALSE;	
// Adjust x position.
		if(m_KeyHandler->GetKeyState(VK_LEFT)) {
			m_ScrollX-=pDoc->GetTextureWidth();
			Changed = TRUE;
		} else {
			if(m_KeyHandler->GetKeyState(VK_RIGHT)) {
				m_ScrollX+=pDoc->GetTextureWidth();
				Changed = TRUE;
			}
		}

// Adjust y position
		if(m_KeyHandler->GetKeyState(VK_UP)) {
			m_ScrollY-=pDoc->GetTextureHeight();
			Changed = TRUE;
		} else {
			if(m_KeyHandler->GetKeyState(VK_DOWN)) {
				m_ScrollY+=pDoc->GetTextureHeight();
				Changed = TRUE;
			}
		}

// If things have changed then update views.
		if(Changed) {
			UpdateScrollPosition();
		}

		D3DVECTOR	CameraPos,CameraRot;
		CBTEditDoc* pDoc = GetDocument();
		CHeightMap* HeightMap = pDoc->GetHeightMap();
		int Selected;
		CPoint ScrollPos = GetScrollPosition();
		ScrollPos.x -= pDoc->GetTextureWidth()*OVERSCAN;
		ScrollPos.y -= pDoc->GetTextureHeight()*OVERSCAN;


		switch(nChar) {
			case	'S':		// Sync view positions.
				pDoc->GetCamera(CameraRot,CameraPos);
				SyncPosition(CameraPos);
				break;

			case	VK_DELETE:
				HeightMap->SetObjectTileFlags(TF_SHOW);
				HeightMap->DeleteSelected3DObjects();
				HeightMap->SetObjectTileFlags(TF_HIDE);
  				UpdateAndValidate();
  				pDoc->Invalidate3D();
				break;

			case	KEY_ROTATETILE:
   				Selected = pDoc->Select2DFace(m_MouseX,m_MouseY,ScrollPos.x,ScrollPos.y);
   				if(Selected >= 0) {

					g_UndoRedo->AddUndo(&(HeightMap->GetMapTiles()[Selected]));
					
					DWORD Rotate = pDoc->GetHeightMap()->GetTextureRotate(Selected);
					Rotate++;
					Rotate &= 3;
					pDoc->GetHeightMap()->SetTextureRotate(Selected,Rotate);
					UpdateAndValidate();
  				}
				break;

			case	KEY_ROTATETILE2:
   				Selected = pDoc->Select2DFace(m_MouseX,m_MouseY,ScrollPos.x,ScrollPos.y);
   				if(Selected >= 0) {

					g_UndoRedo->AddUndo(&(HeightMap->GetMapTiles()[Selected]));
					
					DWORD Rotate = pDoc->GetHeightMap()->GetTextureRotate(Selected);
					Rotate--;
					Rotate &= 3;
					pDoc->GetHeightMap()->SetTextureRotate(Selected,Rotate);
					UpdateAndValidate();
  				}
				break;

			case	KEY_XFLIPTILE:
   				Selected = pDoc->Select2DFace(m_MouseX,m_MouseY,ScrollPos.x,ScrollPos.y);
   				if(Selected >= 0) {

					g_UndoRedo->AddUndo(&(HeightMap->GetMapTiles()[Selected]));
					
					BOOL FlipX = pDoc->GetHeightMap()->GetTextureFlipX(Selected);
					BOOL FlipY = pDoc->GetHeightMap()->GetTextureFlipY(Selected);
					DWORD Rotate = pDoc->GetHeightMap()->GetTextureRotate(Selected);
					if(Rotate & 1) {
						pDoc->GetHeightMap()->SetTextureFlip(Selected,FlipX,!FlipY);
					} else {
						pDoc->GetHeightMap()->SetTextureFlip(Selected,!FlipX,FlipY);
					}
					UpdateAndValidate();
  				}
				break;

			case	KEY_YFLIPTILE:
   				Selected = pDoc->Select2DFace(m_MouseX,m_MouseY,ScrollPos.x,ScrollPos.y);
   				if(Selected >= 0) {

					g_UndoRedo->AddUndo(&(HeightMap->GetMapTiles()[Selected]));
					
					BOOL FlipX = pDoc->GetHeightMap()->GetTextureFlipX(Selected);
					BOOL FlipY = pDoc->GetHeightMap()->GetTextureFlipY(Selected);
					DWORD Rotate = pDoc->GetHeightMap()->GetTextureRotate(Selected);
					if(Rotate & 1) {
						pDoc->GetHeightMap()->SetTextureFlip(Selected,!FlipX,FlipY);
					} else {
						pDoc->GetHeightMap()->SetTextureFlip(Selected,FlipX,!FlipY);
					}
					UpdateAndValidate();
  				}
				break;
		}
	}


	CScrollView::OnKeyDown(nChar, nRepCnt, nFlags);
}
예제 #12
0
void CMemoryCardView::EnsureItemFullyVisible(unsigned int nItem)
{
	m_viewState.EnsureItemFullyVisible(nItem);
	UpdateScrollPosition();
}
예제 #13
0
void BaseEditor::OnSizeEvt(wxSizeEvent& event)
{
	UpdateVirtualSize();
	UpdateScrollPosition(GetScrollPos(wxHORIZONTAL), GetScrollPos(wxVERTICAL));
	event.Skip();
}