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); }
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 ); }
/* -------------------------------------------------------------------------- */ 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); }