Click here to Skip to main content
Click here to Skip to main content
Articles » Multimedia » OpenGL » General » Downloads
 
Add your own
alternative version

Basic Curves And Surfaces Modeler

, 18 Apr 2012
A basic demo of modeling curves and surfaces in OpenGL.
cadsurfexe.zip
CadSurfexe
CadSurf.exe
VKGeom.dll
VKGraphic.dll
cadsurf_demo.zip
cadsurf_src.zip
CadSurf_src
VKernel
VKGraphic
VKGraphic.dsp
VKGraphic.dsw
VKGraphic.plg
VKGeom
VKGeom.dsp
VKGeom.dsw
cadsurf
CadSurf.clw
CadSurf.dsp
cadsurf.dsw
Thumbs.db
res
bmp00001.bmp
cadsurf.ico
CADSURFDOC.ICO
new_splash.bmp
new_splash.PNG
new_splash_small.bmp
tb_geom.bmp
Thumbs.db
toolbar.bmp
toolbar1.bmp
untitled.bmp
XPStyle.manifest
CadSurf_VS2008.zip
CadSurf
cadsurf
CadSurf.suo
res
bmp00001.bmp
cadsurf.ico
CADSURFDOC.ICO
new_splash.bmp
new_splash.PNG
new_splash_small.bmp
tb_geom.bmp
Thumbs.db
toolbar.bmp
toolbar1.bmp
untitled.bmp
VKernel
VKGeom
VKGraphic
VKGraphic.plg
// SplitterWndEx.cpp : implementation file
//

#include "stdafx.h"
#include "CadSurf.h"
#include "SplitterWndEx.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CSplitterWndEx

CSplitterWndEx::CSplitterWndEx()
{
	m_bIsAutomaticSplit = false;
	m_bSplittingDone = false;
}

CSplitterWndEx::~CSplitterWndEx()
{
}


BEGIN_MESSAGE_MAP(CSplitterWndEx, CSplitterWnd)
	//{{AFX_MSG_MAP(CSplitterWndEx)
	ON_WM_MOUSEMOVE()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// CSplitterWndEx message handlers
void CSplitterWndEx::OnDrawSplitter(CDC* pDC, ESplitType nType, const CRect& rectArg)
{
	int x_ActivePane, y_ActivePane; 
	COLORREF hilightcolor = 
	 RGB(255,255,0);
	
	GetActivePane(x_ActivePane, y_ActivePane);
	if( ((GetRowCount()>1) ||(GetColumnCount()>1)) && (nType == splitBorder))
	{
		int pRow = 0;
		int pCol = 0;
		if(rectArg.top)
		{
			pRow = 1;	
		}
		if(rectArg.left)
		{
			pCol = 1;
		}
		if((pCol == y_ActivePane) && (pRow == x_ActivePane)) 
		{
			if (pDC == NULL)
			{
				RedrawWindow(rectArg, NULL, RDW_INVALIDATE|RDW_NOCHILDREN);
				return; 		
			}
			ASSERT_VALID(pDC);	
			CRect rect = 
			rectArg;pDC->Draw3dRect(rect, hilightcolor, hilightcolor);
			int dx = -GetSystemMetrics(SM_CXBORDER);
			int dy = 
			-GetSystemMetrics(SM_CYBORDER);
			rect.InflateRect(dx,dy);pDC->Draw3dRect(rect, hilightcolor, hilightcolor);
			return;
		}
	}
	CSplitterWnd::OnDrawSplitter(pDC,nType,rectArg);
}

//This Method draw an extra Rectangle around the ActivePane with the color <hilighcolor>. 

//Note: you can set 2 colors (see help for Draw3dRect). 

void CSplitterWndEx::RefreshSplitBars(void)
{
	CRect rectInside;
	GetInsideRect(rectInside);
	DrawAllSplitBars(NULL, rectInside.right, rectInside.bottom);
}

void CSplitterWndEx::StartTracking(int ht)
{
	//save the current cursor ...
	HCURSOR theCurrentCursor = GetCursor();

	CSplitterWnd::StartTracking(ht); 

	if ( m_bIsAutomaticSplit )
	{
		//...and restore it immediatelly if in AutomaticSplit mode
		SetCursor(theCurrentCursor);
	}
}

void CSplitterWndEx::StopTracking(BOOL bAccept)
{
	CSplitterWnd::StopTracking(bAccept);

	//now the is splitting done
	m_bIsAutomaticSplit = false;
	m_bSplittingDone = true;
}

BOOL CSplitterWndEx::DoAutomaticSplit()
{
	//save the current mouse position
	POINT theInitialMousePosition;
	GetCursorPos(&theInitialMousePosition);

	//set the splitting done to false ( of course )
	m_bSplittingDone = false;

	//and automaitic to true 
	m_bIsAutomaticSplit = true;
	
	//do the split
	BOOL RetVal = CSplitterWnd::DoKeyboardSplit();

	//restore immediatelly the old mouse poition
	SetCursorPos(theInitialMousePosition.x,theInitialMousePosition.y);
	return RetVal;
}

BOOL CSplitterWndEx::DoKeyboardSplit()
{
	m_bSplittingDone = false;
	m_bIsAutomaticSplit = false;
	return CSplitterWnd::DoKeyboardSplit();
}

void CSplitterWndEx::OnMouseMove(UINT nFlags, CPoint point) 
{
	if ( m_bIsAutomaticSplit )
	{
		//if AutomaticSplit mode : We are not able to choose the position of the splitters
		// -> Exiting to next step
		StopTracking(TRUE);
		return;
	}
	CSplitterWnd::OnMouseMove(nFlags, point);
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Sharjith
Engineer Tata Technologies Ltd
India India
Sharjith is a Mechanical Engineer with strong passion for Automobiles, Aircrafts and Software development.

| Advertise | Privacy | Mobile
Web03 | 2.8.140827.1 | Last Updated 18 Apr 2012
Article Copyright 2003 by Sharjith
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid