POV-Ray : Newsgroups : povray.general : Some FEATURES I would like to see : Re: Some FEATURES I would like to see Server Time
13 Aug 2024 21:21:49 EDT (-0400)
  Re: Some FEATURES I would like to see  
From: Scott Hill
Date: 19 Aug 1998 10:09:04
Message: <01bdc6c0$bdd7d120$8c00a8c0@shindo.ddlinks.co.uk>
povray.org admin team <new### [at] DESPAMpovrayorg> wrote in article
<35d19bcc.69573461@news.povray.org>...
> >GUI Features:
> >
> >* A rectangle selection tool to easily set start_row, start_collumn,...
> 
> If someone contributes some WinAPI C code that does rubberbanding in
> a window this will be added. Otherwise it won't ('cause we don't feel
> like reinventing the wheel).
> 

	Erm, you want something along the lines of :

When you get a WM_LBUTTONDOWN, do :

	SetCapture(hwnd);
	g_bDragging=TRUE; // g_bDragging is a globally defined boolean.
	g_nEndXPos=g_nStartXPos=LOWORD(lParam);
	g_nEndYPos=g_nStartYPos=LOWORD(lParam);

then during WM_MOUSEMOVE messages, do :

	if(TRUE==g_bDragging)
	{
		hdc=GetDC(hwnd);
		rop2=GetROP2(hdc);
		SetRop2(hdc,R2_XORPEN);
		Rectangle(hdc,g_nStartXPos,g_nStartYPos,g_nEndXPos,g_nEndYPos);
		g_nEndXPos=LOWORD(lParam);
		g_nEndYPos=LOWORD(lParam);
		Rectangle(hdc,g_nStartXPos,g_nStartYPos,g_nEndXPos,g_nEndYPos);
		SetRop2(hdc,rop2);
		ReleaseDC(hwnd,hdc);
	}

and, finally, on receiving a WM_LBUTTONUP, do :

	if(TRUE==g_bDragging)
	{
		hdc=GetDC(hwnd);
		rop2=GetROP2(hdc);
		SetRop2(hdc,R2_XORPEN);
		Rectangle(hdc,g_nStartXPos,g_nStartYPos,g_nEndXPos,g_nEndYPos);
		SetRop2(hdc,rop2);
		ReleaseDC(hwnd,hdc);

		ReleaseCapture(hwnd);
		g_bDragging=FALSE;
	}

The coordinates of the selected rectangle will be stored in g_nStartXPos,
g_nStartYPos, g_nEndXPos and g_nEndYPos.

HTH,
-- 
Scott Hill
Sco### [at] DDLinkscouk
Software Engineer (and all round nice guy)
Company homepage : http://www.ddlinks.demon.co.uk

"The best trick the devil ever pulled was convincing people he didn't
exist..."
								- Verbal Kint.

"the Internet is here so we can waste time talking about nothing in 
 particular when we should be working" - Marcus Hill.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.