BOOL TabletBase::LoadCheckWintab(void){ // char WName[50]; /* String to hold window name */ struct tagAXIS TpOri[3]; /* The capabilities of tilt */ double tpvar; /* A temp for converting fix to double */ if(!LoadWintab()) return FALSE; if (!gpWTInfoA(0, 0, NULL)) return FALSE; /* get info about tilt */ m_TiltSupport = gpWTInfoA(WTI_DEVICES,DVC_ORIENTATION,&TpOri); if (m_TiltSupport) { /* does the tablet support azimuth and altitude */ if (TpOri[0].axResolution && TpOri[1].axResolution) { /* convert azimuth resulution to double */ tpvar = FIX_DOUBLE(TpOri[0].axResolution); /* convert from resolution to radians */ m_aziFactor = tpvar/(2*M_PI); /* convert altitude resolution to double */ tpvar = FIX_DOUBLE(TpOri[1].axResolution); /* scale to arbitrary value to get decent line length */ m_altFactor = tpvar/1000; /* adjust for maximum value at vertical */ m_altAdjust = (double)TpOri[1].axMax/m_altFactor; } else { /* no so dont do tilt stuff */ m_TiltSupport = FALSE; } } return TRUE; }
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; }