Example #1
0
void CmUseDefaultContour( int index )					// switch default to indexed default
{
	Contour *contour;
	HCURSOR cur;

	contour = IndexedContour( index );
	if ( contour )										// have a default contour for index
		{
		if ( StampContour ) delete StampContour;			// delete existing point contour
		StampContour = new Contour( *contour );				// make copy of default to use as point contour
		SetCursor( LoadCursor( 0, IDC_WAIT ) );				// in case StampCursor is in use
		cur = StampCursor;									// remember handle for destroy
		StampCursor = MakeStampCursor( StampContour );		// create new cursor from contour
		DestroyCursor( cur );								// destroy old cursor
		SetToolCursor( appWnd );							// restore original cursor
		CurrSeries->defaultBorder = StampContour->border;	// set default attributes for all tools
		CurrSeries->defaultFill = StampContour->fill;
		CurrSeries->defaultMode = StampContour->mode;
		strcpy(CurrSeries->defaultName,StampContour->name);
		strcpy(CurrSeries->defaultComment,StampContour->comment);
		PushPaletteButton( index );
		}
}
Example #2
0
void CmPrecisionCursor( void )
{
	UsePrecisionCursor = !UsePrecisionCursor;	// switch precision cursor state
	SetToolCursor( appWnd );					// and update cursor diasplay
}
Example #3
0
int TextProc(
/************************************************************************/
HWND 	hWindow,
LPARAM 	lParam,
UINT 	msg)
{
int x, y;
BOOL fCancel = NO;
WORD wKey;
STRING szString;
static BOOL bTrackObject;
static int xMove, yMove;

if ( bTrackObject )
	{
	ToyProc( hWindow, lParam, msg );
	bTrackObject = Tool.bActive;
	Tool.bActive = YES;
	return( TRUE );
	}

x = LOWORD( lParam );
y = HIWORD( lParam );
switch (msg)
    {
    case WM_CREATE:	// The first mouse down message
	Tool.bActive = YES;
	break; // Never get sent since Tool.bActive is already set in the dialog

    case WM_LBUTTONDOWN:
	// Call the sticker mover tool first to see if he wants to take over
	Tool.bActive = NO;
	ToyProc( hWindow, lParam, WM_CREATE );
	if ( bTrackObject = Tool.bActive )
		{
		ToyProc( hWindow, lParam, msg );
		break;
		}
	if ( bTextBegun )
		Tool.bActive = YES;
	xMove = x;
	yMove = y;
//	TextMove(hWindow, x, y);
	break;

    case WM_LBUTTONUP:
	break;

	case WM_SETCURSOR:
	return( SetToolCursor( hWindow, ID_MOVE_OBJECT, ID_PLAY_OBJECT ) );

    case WM_MOUSEMOVE:	// sent when ToolActive is on
	if ( Tool.bActive && Window.fLButtonDown )
		TextOffset(hWindow, x - xMove, y - yMove);
	xMove = x;
	yMove = y;
	break;

    case WM_KILLFOCUS:
	break;

    case WM_SETFOCUS:
//	TextDisplayCaret( hWindow, NULL );
	break;

    case WM_CHAR:
	wKey = (WORD)lParam;
	TextKeystroke(hWindow, wKey);
	if ( wKey == VK_RETURN )
		{
		TextAnchor( hWindow );
		RandomizeActiveColor();
		break;
		}
	szString[0] = '_';
	szString[1] = wKey;
	szString[2] = '\0';
	Lowercase( szString );
	SoundStartResource( szString, NO/*bLoop*/, NULL/*hInstance*/ );
	break;

    case WM_KEYDOWN:
	wKey = lParam;
	switch (wKey)
		{
		case VK_UP:
			TextRMove(hWindow, 0, -1);
			break;
		case VK_DOWN:
			TextRMove(hWindow, 0, 1);
			break;
		case VK_LEFT:
			TextRMove(hWindow, -1, 0);
			break;
		case VK_RIGHT:
			TextRMove(hWindow, 1, 0);
			break;
		default:
			break;
		}
	break;

    case WM_DESTROY:	// The cancel and DeactivateTool() message
	fCancel = (lParam == 1L);
	if ( fCancel )
		{ // an "escape" cancel
		TextKeystroke( hWindow, VK_ESCAPE );
		}
	else
		{ // a deactivate
		TextKeystroke( hWindow, VK_RETURN );
		TextAnchor( hWindow );
		RandomizeActiveColor();
		HideCaret( hWindow );
		DestroyCaret();
		AstralUpdateWindow( hWindow );
		}
	break;

    case WM_LBUTTONDBLCLK:
	break;
    }
return(TRUE);
}
Example #4
0
int LinesProc( HWND hWindow, LPARAM lParam, UINT msg )
/************************************************************************/
{
int x, y, fx, fy;
LPOBJECT lpObject;
RGBS rgb;
LPFRAME lpFrame;
STRING szOptions;
static RGBS rgbLast;

x = LOWORD(lParam);
y = HIWORD(lParam);
switch (msg)
    {
    case WM_CREATE:	// The first mouse down message
	if (!ONIMAGE(x, y))
		break;
	Display2File(&x, &y);
	if ( !ImgSelectObjectType( lpImage, x, y,
		YES/*bAllowBase*/, YES/*bAllowMovable*/, NO/*bAllowPlayable*/ ) )
			break;
	if (!Retouch.hBrush)
		break;
	GetActiveRGB( &rgb );
	if ( rgb.red != rgbLast.red || rgb.green != rgbLast.green ||
		 rgb.blue != rgbLast.blue )
		{ // if a color change, restuff the brush source
		OptionGetString( hOptions, iTool+1, szOptions );
		lpFrame = TiffResource2Frame( hOptions, (LPSTR)MAKEINTRESOURCE(iTool+1) );
		SetSimpleBrushSource( Retouch.hBrush, lpFrame, szOptions );
		rgbLast = rgb;
		}
	Tool.bActive = YES;
	break;

	case WM_SETCURSOR:
	return( SetToolCursor( hWindow, NULL/*idMoveObject*/, ID_PLAY_OBJECT ) );

	case WM_ACTIVATE:
	if (!lParam) // a deactivate
		{
		if (Retouch.hBrush)
			DestroySimpleBrush(Retouch.hBrush);
		Retouch.hBrush = NULL;
		}
	else
		{ // an activate ( to re-create brush)
		if ( Tool.hRibbon )
			SendMessage( Tool.hRibbon, WM_CONTROLENABLE, 1, 0L );
		}
	break;

    case WM_LBUTTONDOWN:
	Tool.bActive = NO;
	if (ImgCountSelObjects(lpImage, NULL) == 1)
		lpObject = ImgGetSelObject(lpImage, NULL);
	else
		{
		fx = x;
		fy = y;
		Display2File( &fx, &fy );
		lpObject = ImgFindSelObject(lpImage, fx, fy, NO);
		}
	if (!lpObject)
		break;
	if (!ImgEditInit(lpImage, ET_OBJECT, UT_DATA, lpObject))
		break;

	if (!SimpleBrushBegin(hWindow, &lpObject->Pixmap,
		lpObject->rObject.left, lpObject->rObject.top, Retouch.hBrush))
	    break;
	ImgEditedObject(lpImage, lpObject, IDS_UNDOCHANGE, NULL);
	Tool.bActive = SimpleBrushActive();

	/* fall through to WM_MOUSEMOVE */

    case WM_MOUSEMOVE:	// sent when ToolActive is on
	fx = x;
	fy = y;
	Display2File( &fx, &fy );
	SimpleBrushStroke(fx, fy, x, y);
	break;

    case WM_LBUTTONUP:
	SimpleBrushEnd(NO);
	Tool.bActive = NO;
	break;

    case WM_LBUTTONDBLCLK:
	break;

    case WM_DESTROY:	// The cancel operation message
	SimpleBrushEnd(NO);
	Tool.bActive = NO;
	break;
    }

return(TRUE);
}