示例#1
0
/////////////////////////////////////////////////////////////////////
// TEditorClient
// -------------
// Exclude the current info. windows from current dc clipping region
void
TMapDC::SetupClipping()
{
	// Set clipping for client rect. of window
	TRect clientRect (0, 0, pEditor->ClientSize.cx, pEditor->ClientSize.cy);
	SelectClipRgn (TRegion (clientRect));

	if ( pEditor->InfoWinShown )
	{
		switch (pEditor->EditMode)
		{
		case OBJ_THINGS:
			ExcludeClipWindow (pEditor->pThingInfo);
			break;

		case OBJ_LINEDEFS:
			ExcludeClipWindow (pEditor->pLineDefInfo);
			ExcludeClipWindow (pEditor->pSideDef1Info);
			ExcludeClipWindow (pEditor->pSideDef2Info);
			break;

		case OBJ_VERTEXES:
			ExcludeClipWindow (pEditor->pVertexInfo);
			break;

		case OBJ_SECTORS:
			ExcludeClipWindow (pEditor->pSectorInfo);
			break;
		}
	}
}
示例#2
0
BOOL	TTabButtonGadget :: GetRegion ( TRegion &  Region, TRegionType  type )
   {
	TPoint			TabPoints [6] ;
	TPoint			Points    [8] ;
	register BOOL           Status		=  TRUE ;
	register int		i,
				HiliteDelta = HiliteUnits / 2, 	// Servent à épaissir
				ShadowDelta = ShadowUnits / 2 ; // les bordures diagonales
	register int		Width	    = Bounds. Width ( ) ;



	if  ( Overlap )	
		Width += dX ;

	ComputePoints ( TabPoints ) ;


	switch  ( type )
	   {

	// Partie visible : calculer ce qui n'est pas recouvert
	// Il faut bien faire attention de calculer la coordonnée du gadget
	// DANS la fenêtre pour que la région de clipping soit correcte.
		case	VisibleRegion :
		case	OuterRegion :
			for  ( i = 0 ; i < 6 ; i ++ )
			   {
				TabPoints [i]. x += Bounds. left ;
				TabPoints [i]. y += Bounds. top ;
			    }

			Region = TRegion ( TabPoints, 6, ALTERNATE ) ;

			if  ( Overlap  &&  type  ==  VisibleRegion )
				CheckOverlappedRegion ( Region ) ;
			break ;


	// Partie englobant la totalité du gadget, sans la bordure
		case	InnerRegion :
			TabPoints [0]. x	+=  cxBorder ;
			TabPoints [0]. y 	+=  cyBorder ;

			TabPoints [1]. x 	-=  cxBorder ;
			TabPoints [1]. y	+=  cyBorder ;

			TabPoints [2]. x 	-=  cxBorder ;
			TabPoints [2]. y	-=  2 * cyBorder ;

			TabPoints [3]. x	-=  cxBorder ;
			TabPoints [3]. y	-=  2 * cyBorder ;

			TabPoints [4]. x	+=  cxBorder ;
			TabPoints [4]. y 	-=  2 * cyBorder ;

			TabPoints [5]. x	+=  cxBorder ;
			TabPoints [5]. y 	-=  2 * cyBorder ;
				       

	// et avec la bordure
		case	BorderRegion :
			Region = TRegion ( TabPoints, 6, ALTERNATE ) ;
			break ;


	// Partie dessinable
		case	DrawableRegion :
		   {
			int		delta 	=  ( State  ==  Up  ||
							( Overlap  &&  State  ==  Down ) ) ?
							0 : HiliteUnits ;
			register int	W	=  Width          -
						   HiliteUnits        -
						   ShadowUnits        -
						   ( 2 * dX )         -
						   ( 2 * cxBorder ),
					H	=  Bounds. Height ( ) -
						   HiliteUnits	      -
						   ShadowUnits 	      -
						   ( 2 * cyBorder ),
					X	=  cxBorder + HiliteUnits + delta + dX,
					Y 	=  cyBorder + HiliteUnits + delta ;


			Region = TRegion ( TRect ( X, Y, X + W, Y + H ) ) ;
			break ;
		     }


	// Partie éclairée
		case	HiliteRegion :
			Points [0]. x = cxBorder ;
			Points [0]. y = cyBorder ;

			Points [1]. x = Width - cxBorder ;
			Points [1]. y = cyBorder ;

			Points [2]. x = Width - cxBorder ;
			Points [2]. y = cyBorder + HiliteUnits ;

			Points [3]. x = cxBorder + HiliteUnits ;
			Points [3]. y = cyBorder + HiliteUnits ;

			Points [4]. x = cxBorder + HiliteUnits  ;
			Points [4]. y = cySoftCorner - cyBorder - HiliteDelta ;

			Points [5]. x = dX + cxBorder + HiliteUnits + HiliteDelta ;
			Points [5]. y = Bounds. Height ( ) - cyBorder ;

			Points [6]. x = dX + cxBorder ;
			Points [6]. y = Bounds. Height ( ) - cyBorder ;

			Points [7]. x = cxBorder ;
			Points [7]. y = cySoftCorner - cyBorder ;

			Region = TRegion ( Points, 8, ALTERNATE ) ;
			break ;


	// Partie ombrée 
		case	ShadowRegion :
			Points [0]. x = Width - cxBorder ;
			Points [0]. y = cyBorder ;

			Points [1]. x = Width - cxBorder ;
			Points [1]. y = cySoftCorner - cyBorder ;

			Points [2]. x = Width - dX - cxBorder ;
			Points [2]. y = Bounds. Height ( ) - cyBorder ;

			Points [3]. x = dX - 1 ;
			Points [3]. y = Bounds. Height ( ) - cyBorder ;

			Points [4]. x = dX + HiliteUnits - 1 ;
			Points [4]. y = Bounds. Height ( ) - cyBorder - ShadowUnits ;

			Points [5]. x = Width - dX - cxBorder - ShadowDelta ;
			Points [5]. y = Bounds. Height ( ) - cyBorder - ShadowUnits ;
	
			Points [6]. x = Width - cxBorder - ShadowUnits ;
			Points [6]. y = cySoftCorner - cyBorder - ShadowDelta ;

			Points [7]. x = Width - cxBorder - ShadowUnits ;
			Points [7]. y = cyBorder + HiliteUnits ;


			Region = TRegion ( Points, 8, ALTERNATE ) ;
			break ;


		case	OtherShadowRegion :
			Status = FALSE ;
			break ;
				
	
	// Autre : ne devrait jamais arriver
		default :
			Status = false ;
	     }



	return  ( Status ) ;
    }