コード例 #1
0
LOCAL void PrsInit()
//////////////////////////////////////////////////////////////////////////////
{
	AXIS np;
	LOGCONTEXT lc;
	BYTE logBtns[32];
	UINT btnMarks[2];
	UINT size;

	// discover the LOGICAL button generated by the pressure channel
	// get the PHYSICAL button from the cursor category and run it 
	// through that cursor's button map ( usually the identity map )
	wPrsBtn = ( UINT ) - 1;
	WTInfo( WTI_CURSORS + wActiveCsr, CSR_NPBUTTON, &wPrsBtn );
	size = WTInfo( WTI_CURSORS + wActiveCsr, CSR_BUTTONMAP, &logBtns );
	if( wPrsBtn < size )
		wPrsBtn = logBtns[ wPrsBtn ];

	// get the current context for its device variable
	WTGet( hContext, &lc );

	// get the size of the pressure axis
	WTInfo( WTI_DEVICES + lc.lcDevice, DVC_NPRESSURE, &np );
	prsNoBtnOrg = ( UINT )np.axMin;
	prsNoBtnExt = ( UINT )np.axMax - ( UINT )np.axMin;

	// get the button marks ( up & down generation thresholds ) 
	// and calculate what pressure range we get when pressure-button is down.
	WTInfo( WTI_CURSORS + wActiveCsr, CSR_NPBTNMARKS, btnMarks );
	prsYesBtnOrg = btnMarks[ 1 ];
	prsYesBtnExt = ( UINT )np.axMax - btnMarks[ 1 ];
}
コード例 #2
0
BOOL TabletStart()
//  This function must be called before any mouse activity to stop the Wintab
//  default context from preempting packet activity.
//////////////////////////////////////////////////////////////////////////////
{
    LOGCONTEXT lcPictPub;
    BOOL bSuccess = FALSE;

    if( Control.UseTablet && ( hContext == NULL ))  // context not created yet
    {
        WORD errormode = SetErrorMode( SEM_NOOPENFILEERRORBOX );

	    // check if WinTab available
	    bSuccess = WTInfo( 0, 0, NULL );
        if( !bSuccess )
            return( FALSE ); 

        SetErrorMode( errormode );

    	// get default region
	    bSuccess = WTInfo( WTI_DEFSYSCTX, 0, &lcPictPub );
        if( !bSuccess )
            return( FALSE ); 

	    // modify the digitizing region
	    lstrcpy( lcPictPub.lcName, "PPLogContext" );
	    lcPictPub.lcOptions     |= CXO_MESSAGES;
	    lcPictPub.lcPktData     = PACKETDATA;
	    lcPictPub.lcPktMode     = PACKETMODE;
	    lcPictPub.lcMoveMask    = PACKETDATA;
	    lcPictPub.lcBtnUpMask   = lcPictPub.lcBtnDnMask;
	    lcPictPub.lcOutOrgX     = lcPictPub.lcOutOrgY = 0;

        // X axis origin is the same as in Windows.
        // Y axis is reversed because WinTab origin is at lower-left
	    lcPictPub.lcOutExtX     =  GetSystemMetrics( SM_CXSCREEN );
	    lcPictPub.lcOutExtY     = -GetSystemMetrics( SM_CYSCREEN );

	    // open the region
	    hContext = WTOpen( AfxGetMainWnd()->GetSafeHwnd(), &lcPictPub, TRUE );

        if( !hContext || !( SetTabletQueueSize( NPACKETQSIZE )))
            return( FALSE );
    }
    return( Control.UseTablet );
}
コード例 #3
0
ファイル: moTablet.cpp プロジェクト: moldeo/moldeoplugins
BOOL moTablet::IsTabletInstalled()
{
	struct	tagAXIS TpOri[3];	// The capabilities of tilt (required)
	double	dblTpvar;				// A temp for converting fix to double (for example)

	BOOL bReturn = TRUE;

	// check if WinTab available.
	if (!WTInfo(0, 0, NULL))
	{
		MODebug2->Push("WinTab Services Not Available.");
		bReturn = FALSE;
	}

	if (bReturn)
	{
		// get info about tilt
		t_bTiltSupport = WTInfo(WTI_DEVICES,DVC_ORIENTATION,&TpOri);
		if (t_bTiltSupport)
		{
			//used for example
			// does the tablet support azimuth and altitude
			if (TpOri[0].axResolution && TpOri[1].axResolution) {

				// convert azimuth resulution to double
				dblTpvar = FIX_DOUBLE(TpOri[0].axResolution);
				// convert from resolution to radians
				t_dblAziFactor = dblTpvar/(2*moMathf::PI);

				// convert altitude resolution to double
				dblTpvar = FIX_DOUBLE(TpOri[1].axResolution);
				// scale to arbitrary value to get decent line length
				t_dblAltFactor = dblTpvar/1000;
				 // adjust for maximum value at vertical
				t_dblAltAdjust = (double)TpOri[1].axMax/t_dblAltFactor;
			}
			//end of used for example
		}
		else {  // no so don't do tilt stuff
			t_bTiltSupport = FALSE;
			MODebug2->Push("Tablet does NOT supports tilt!");
		}	//end tilt support
	}	//end does tablet exists
	return bReturn;
}
コード例 #4
0
ファイル: RULE.C プロジェクト: fughz/frayer
/* return scaling factors in thousandths of cm per axis unit */
static void TabletScaling(FIX32 scale[])
{
	AXIS aXY[2];
	int i;
	UINT wDevice;

	/* get the data */
	WTInfo(WTI_DEFCONTEXT, CTX_DEVICE, &wDevice);
	WTInfo(WTI_DEVICES+wDevice, DVC_X, &aXY[0]);
	WTInfo(WTI_DEVICES+wDevice, DVC_Y, &aXY[1]);

	/* calculate the scaling factors */
	for (i = 0; i < 2; i++) {
		FIX_DIV(scale[i], CASTFIX32(1000), aXY[i].axResolution);
		if (aXY[i].axUnits == TU_INCHES) {
			FIX_MUL(scale[i], scale[i], Inch2Cm);
		}
	}
}
コード例 #5
0
ファイル: moTablet.cpp プロジェクト: moldeo/moldeoplugins
moText moTablet::GetTabletName()
{

	char	chrWName[50];			// String to hold window name
#ifdef MO_WIN32
	WTInfo(WTI_DEVICES, DVC_NAME, chrWName);
#endif
	moText strName = chrWName;
	return strName;
}
コード例 #6
0
ファイル: BTNMAP.C プロジェクト: fughz/frayer
void
set_xBtnMap( HWND hWnd, HMGR hMgr )
{
    FARPROC lpProcDlg;
	xBtn_info info;
	unsigned i;
	int tag;

	/* Open a dialog to choose which cursor to use. */
	lpProcDlg = MakeProcInstance( CursInfoDlgProc, hInst );
	info.wCsr = DialogBoxParam( hInst, MAKEINTRESOURCE(IDD_INFOLIST),
		hWnd, lpProcDlg, WTI_CURSORS );
	FreeProcInstance( lpProcDlg );

	if( info.wCsr != 0xffffffff ) {
		/* Find xBtnMask info */
		i = 0;
		while( WTInfo( WTI_EXTENSIONS + i, EXT_TAG, &tag ) && tag != WTX_XBTNMASK )
			i++;

		if( tag != WTX_XBTNMASK )
			MessageBox( hWnd, "XBTNMASK extension not supported.", "MgrTest", MB_ICONHAND | MB_OK );

		/* Read the xBtn map info */
		if( !WTInfo( WTI_EXTENSIONS + i, EXT_CURSORS + info.wCsr, info.sysBtns ) )
			MessageBox( hWnd, "This cursor does not support XBTNMASK.", "MgrTest", MB_ICONHAND | MB_OK );
		else {
			int id;

			/* Start the XBUTTONS dialog */
			lpProcDlg = MakeProcInstance( xButtonDlgProc, hInst );
			id = DialogBoxParam( hInst, MAKEINTRESOURCE(IDD_XBUTTONS),
				hWnd, lpProcDlg, (long)&info );
			FreeProcInstance( lpProcDlg );

			if( id == IDOK )
				if( !WTMgrCsrExt( hMgr, info.wCsr, WTX_XBTNMASK, info.sysBtns ) )
					MessageBox( hWnd, "WTMgrCsrExt failed.", "MgrTest", MB_ICONHAND | MB_OK );
		}
	}
}
コード例 #7
0
ファイル: moTablet.cpp プロジェクト: moldeo/moldeoplugins
HCTX moTablet::InitTablet(HWND hWnd)
{
	//TABLET: get current settings as a starting point for this context of the tablet.
	//WTInfo(WTI_DEFCONTEXT, 0, &lcMine);	// default settings may be different to current settings
	WTInfo(WTI_DEFSYSCTX, 0, &lcMine);	// current settings as set in control panel

	lcMine.lcOptions |= CXO_MESSAGES;	// keep existing options and make sure message handling is on for this context
	//TABLET: PACKETDATA must be defined FIRST before including pktdef.h. See the header file of this class for more details
	lcMine.lcPktData = PACKETDATA;	// these settings MUST be defined in the pktdef.h file, see notes
	lcMine.lcPktMode = PACKETMODE;
	lcMine.lcMoveMask = PACKETDATA;

	return WTOpen(hWnd, &lcMine, TRUE);
}
コード例 #8
0
ファイル: RULE.C プロジェクト: fughz/frayer
/* -------------------------------------------------------------------------- */
HCTX static NEAR TabletInit(HWND hWnd, FIX32 scale[])
{
	LOGCONTEXT lcMine;

	/* get default region */
	WTInfo(WTI_DEFCONTEXT, 0, &lcMine);

	/* modify the digitizing region */
	strcpy(lcMine.lcName, "Rule Digitizing");
	lcMine.lcPktData = PACKETDATA;
	lcMine.lcPktMode = PACKETMODE;
	lcMine.lcMoveMask = 0;
	lcMine.lcBtnUpMask = lcMine.lcBtnDnMask;

	/* output in 1000ths of cm */
	lcMine.lcOutOrgX = lcMine.lcOutOrgY = 0;
	lcMine.lcOutExtX = INT(scale[0] * lcMine.lcInExtX);
	lcMine.lcOutExtY = INT(scale[1] * lcMine.lcInExtY);

	/* open the region */
	return WTOpen(hWnd, &lcMine, TRUE);

}