Пример #1
0
//-----------------------------------------------------------------------------
// Purpose: Calls ReplaceView with the appropriate runtime class information to
//			switch the active view to given view type.
// Input  : eViewType - 2d xy, xz, 3d textured, flat, etc.
//-----------------------------------------------------------------------------
void CChildFrame::SetViewType(DrawType_t eViewType)
{
	CMapView *pNewView = NULL;

	switch (eViewType)
	{
		case VIEW2D_XY:
		case VIEW2D_XZ:
		case VIEW2D_YZ:
		{
			pNewView = (CMapView2D *)ReplaceView(RUNTIME_CLASS(CMapView2D));
			break;
		}

		case VIEW3D_WIREFRAME:
		case VIEW3D_POLYGON:
		case VIEW3D_TEXTURED:
		case VIEW3D_LIGHTMAP_GRID:
		case VIEW3D_LIGHTING_PREVIEW:
		case VIEW3D_SMOOTHING_GROUP:
		{
			pNewView = (CMapView *)ReplaceView(RUNTIME_CLASS(CMapView3D));
			break;
		}
	}

	if (pNewView != NULL)
	{
		SetActiveView(pNewView);
		pNewView->SetDrawType(eViewType);
		pNewView->UpdateWindow();
	}
}
Пример #2
0
//-----------------------------------------------------------------------------
// Purpose: Calls ReplaceView with the appropriate runtime class information to
//			switch the active view to given view type.
// Input  : eViewType - 2d xy, xz, 3d textured, flat, etc.
//-----------------------------------------------------------------------------
void CChildFrame::SetViewType(DrawType_t eViewType)
{
	CMapView *pNewView = NULL;
	
	switch (eViewType)
	{
		case VIEW2D_XY:
		case VIEW2D_XZ:
		case VIEW2D_YZ:
			pNewView = (CMapView2D *)ReplaceView(RUNTIME_CLASS(CMapView2D));
			break;

		case VIEW_LOGICAL:
			pNewView = (CMapViewLogical *)ReplaceView(RUNTIME_CLASS(CMapViewLogical));
			break;

		default:
		case VIEW3D_WIREFRAME:
		case VIEW3D_POLYGON:
		case VIEW3D_TEXTURED:
		case VIEW3D_TEXTURED_SHADED:
		case VIEW3D_LIGHTMAP_GRID:
		case VIEW3D_LIGHTING_PREVIEW2:
		case VIEW3D_LIGHTING_PREVIEW_RAYTRACED:
		case VIEW3D_SMOOTHING_GROUP:
		//case VIEW3D_ENGINE:
			pNewView = (CMapView3D *)ReplaceView(RUNTIME_CLASS(CMapView3D));
			break;
	}

	if (pNewView != NULL)
	{
		SetActiveView( dynamic_cast<CView*>(pNewView->GetViewWnd()) );
		pNewView->SetDrawType(eViewType);
		pNewView->UpdateView( MAPVIEW_UPDATE_OBJECTS );
	}
}
Пример #3
0
//-----------------------------------------------------------------------------
// Purpose: Overloaded to handle the 2x2 splitter. If the splitter is enabled,
//			the splitter window is createed and one 3D view and three 2D views
//			are added to it.
// Input  : lpcs - 
//			pContext - 
// Output : Returns TRUE on success, FALSE on failure.
//-----------------------------------------------------------------------------
BOOL CChildFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext *pContext)
{
	//
	// If we are using the splitter, create the splitter and 4 views.
	//
	if (bUsingSplitter)
	{
		m_wndSplitter = new CMySplitterWnd;
		Assert(m_wndSplitter != NULL);
		
		if (m_wndSplitter == NULL)
		{
			return(FALSE);
		}

		if (!m_wndSplitter->CreateStatic(this, 2, 2))
		{
			delete m_wndSplitter;
			m_wndSplitter = NULL;
			TRACE0("Failed to create split bar ");
			return(FALSE);
		}
		
		//
		// Calculate the size of each view within the splitter,
		//
		CRect r;
		GetClientRect(r);
		CSize sizeView((r.Width() / 2) - 3, (r.Height() / 2) - 3);

		//
		// Create the 4 views as they were when the user last closed the app.
		//
		DrawType_t eDrawType[2][2];

		eDrawType[0][0] = (DrawType_t)APP()->GetProfileInt("Splitter", "DrawType0,0", VIEW3D_WIREFRAME);
		eDrawType[0][1] = (DrawType_t)APP()->GetProfileInt("Splitter", "DrawType0,1", VIEW2D_XY);
		eDrawType[1][0] = (DrawType_t)APP()->GetProfileInt("Splitter", "DrawType1,0", VIEW2D_YZ);
		eDrawType[1][1] = (DrawType_t)APP()->GetProfileInt("Splitter", "DrawType1,1", VIEW2D_XZ);

		for (int nRow = 0; nRow < 2; nRow++)
		{
			for (int nCol = 0; nCol < 2; nCol++)
			{
				// These might be lying around in people's registry.
				if ((eDrawType[nRow][nCol] == VIEW3D_ENGINE) || (eDrawType[nRow][nCol] >= VIEW_TYPE_LAST))
				{
					eDrawType[nRow][nCol] = VIEW3D_TEXTURED;
				}
			
				switch (eDrawType[nRow][nCol])
				{
					case VIEW2D_XY:
					case VIEW2D_XZ:
					case VIEW2D_YZ:
					{
						m_wndSplitter->CreateView(nRow, nCol, RUNTIME_CLASS(CMapView2D), sizeView, pContext);
						break;
					}

					case VIEW_LOGICAL:
					{
						m_wndSplitter->CreateView(nRow, nCol, RUNTIME_CLASS(CMapViewLogical), sizeView, pContext);
						break;
					}

					case VIEW3D_WIREFRAME:
					case VIEW3D_POLYGON:
					case VIEW3D_TEXTURED:
					case VIEW3D_TEXTURED_SHADED:
					case VIEW3D_LIGHTMAP_GRID:
					case VIEW3D_LIGHTING_PREVIEW2:
					case VIEW3D_LIGHTING_PREVIEW_RAYTRACED:
					case VIEW3D_SMOOTHING_GROUP:
					{
						m_wndSplitter->CreateView(nRow, nCol, RUNTIME_CLASS(CMapView3D), sizeView, pContext);
						break;
					}
				}

				CMapView *pView = dynamic_cast<CMapView*>(m_wndSplitter->GetPane(nRow, nCol));
				if (pView != NULL)
				{
					pView->SetDrawType(eDrawType[nRow][nCol]);
				}
			}
		}
		
		int nWidth = APP()->GetProfileInt("Splitter", "SplitterWidth", -1);
		int nHeight = APP()->GetProfileInt("Splitter", "SplitterHeight", -1);

		if ( nWidth != -1 && nHeight != -1 )
		{
			m_wndSplitter->SetRowInfo( 0, nHeight, 0 );
			m_wndSplitter->SetColumnInfo( 0, nWidth, 0 );
			m_wndSplitter->RecalcLayout();
		}
		else
		{
			m_bNeedsCentered = TRUE;
		}

        m_bReady = TRUE;
		return TRUE;
	}

	//
	// No splitter, call default creation code.
	//
	return(CMDIChildWnd::OnCreateClient(lpcs, pContext));
}
Пример #4
0
//-----------------------------------------------------------------------------
// Purpose: Overloaded to handle the 2x2 splitter. If the splitter is enabled,
//			the splitter window is createed and one 3D view and three 2D views
//			are added to it.
// Input  : lpcs - 
//			pContext - 
// Output : Returns TRUE on success, FALSE on failure.
//-----------------------------------------------------------------------------
BOOL CChildFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext *pContext)
{
	//
	// If we are using the splitter, create the splitter and 4 views.
	//
	if (bUsingSplitter)
	{
		m_wndSplitter = new CMySplitterWnd;
		ASSERT(m_wndSplitter != NULL);
		
		if (m_wndSplitter == NULL)
		{
			return(FALSE);
		}

		if (!m_wndSplitter->CreateStatic(this, 2, 2))
		{
			delete m_wndSplitter;
			m_wndSplitter = NULL;
			TRACE0("Failed to create split bar ");
			return(FALSE);
		}
		
		//
		// Calculate the size of each view within the splitter,
		//
		CRect r;
		GetClientRect(r);
		CSize sizeView((r.Width() / 2) - 3, (r.Height() / 2) - 3);

		//
		// Create the 4 views as they were when the user last closed the app.
		//
		DrawType_t eDrawType[2][2];

		eDrawType[0][0] = (DrawType_t)APP()->GetProfileInt("Splitter", "DrawType0,0", VIEW3D_WIREFRAME);
		eDrawType[0][1] = (DrawType_t)APP()->GetProfileInt("Splitter", "DrawType0,1", VIEW2D_XY);
		eDrawType[1][0] = (DrawType_t)APP()->GetProfileInt("Splitter", "DrawType1,0", VIEW2D_YZ);
		eDrawType[1][1] = (DrawType_t)APP()->GetProfileInt("Splitter", "DrawType1,1", VIEW2D_XZ);

		for (int nRow = 0; nRow < 2; nRow++)
		{
			for (int nCol = 0; nCol < 2; nCol++)
			{
				switch (eDrawType[nRow][nCol])
				{
					case VIEW2D_XY:
					case VIEW2D_XZ:
					case VIEW2D_YZ:
					{
						m_wndSplitter->CreateView(nRow, nCol, RUNTIME_CLASS(CMapView2D), sizeView, pContext);
						break;
					}

					case VIEW3D_WIREFRAME:
					case VIEW3D_POLYGON:
					case VIEW3D_TEXTURED:
					case VIEW3D_LIGHTMAP_GRID:
					case VIEW3D_LIGHTING_PREVIEW:
					case VIEW3D_SMOOTHING_GROUP:
					{
						m_wndSplitter->CreateView(nRow, nCol, RUNTIME_CLASS(CMapView3D), sizeView, pContext);
						break;
					}
				}

				CMapView *pView = (CMapView *)m_wndSplitter->GetPane(nRow, nCol);
				if (pView != NULL)
				{
					pView->SetDrawType(eDrawType[nRow][nCol]);
				}
			}
		}

		m_bReady = TRUE;

		return TRUE;
	}

	//
	// No splitter, call default creation code.
	//
	return(CMDIChildWnd::OnCreateClient(lpcs, pContext));
}