HB_SIZE hb_inkeyKeyString( int iKey, char * buffer, HB_SIZE nSize ) { HB_SIZE nLen = 0; HB_TRACE( HB_TR_DEBUG, ( "hb_inkeyKeyString(%d,%p, %" HB_PFS "u)", iKey, buffer, nSize ) ); if( HB_INKEY_ISUNICODE( iKey ) ) { nLen = hb_cdpTextPutU16( hb_vmCDP(), buffer, nSize, HB_INKEY_VALUE( iKey ) ); } else { if( HB_INKEY_ISCHAR( iKey ) ) iKey = HB_INKEY_VALUE( iKey ); else if( HB_INKEY_ISKEY( iKey ) ) { int iFlags = HB_INKEY_FLAGS( iKey ); iKey = HB_INKEY_VALUE( iKey ); if( iKey > 0 && iKey <= ( int ) HB_SIZEOFARRAY( s_transKeyFun ) ) iKey = s_inkeyTransChar( iKey, iFlags, &s_transKeyFun[ iKey - 1 ] ); else if( iKey >= 32 && iKey <= 127 ) iKey = s_inkeyTransChar( iKey, iFlags, &s_transKeyStd[ iKey - 32 ] ); } if( iKey >= 32 && iKey <= 255 && iKey != 127 ) { PHB_CODEPAGE cdp = hb_vmCDP(); nLen = hb_cdpTextPutU16( cdp, buffer, nSize, hb_cdpGetU16( cdp, ( HB_UCHAR ) iKey ) ); } } return nLen; }
static int hb_inkeyKeyXHB( int iKey ) { HB_TRACE( HB_TR_DEBUG, ( "hb_inkeyKeyXHB(%d)", iKey ) ); if( HB_INKEY_ISEXT( iKey ) ) { int iFlags = HB_INKEY_FLAGS( iKey ), iValue = HB_INKEY_VALUE( iKey ); if( HB_INKEY_ISKEY( iKey ) ) { if( ( iFlags & ( HB_KF_SHIFT | HB_KF_CTRL | HB_KF_ALT ) ) == HB_KF_SHIFT && iValue >= 0 && iValue < 32 ) { switch( iValue ) { case HB_KX_LEFT: return XHB_K_SH_LEFT; case HB_KX_UP: return XHB_K_SH_UP; case HB_KX_RIGHT: return XHB_K_SH_RIGHT; case HB_KX_DOWN: return XHB_K_SH_DOWN; case HB_KX_INS: return XHB_K_SH_INS; case HB_KX_DEL: return XHB_K_SH_DEL; case HB_KX_HOME: return XHB_K_SH_HOME; case HB_KX_END: return XHB_K_SH_END; case HB_KX_PGUP: return XHB_K_SH_PGUP; case HB_KX_PGDN: return XHB_K_SH_PGDN; case HB_KX_ENTER: return XHB_K_SH_ENTER; } } } if( HB_INKEY_ISKEY( iKey ) || HB_INKEY_ISCHAR( iKey ) || HB_INKEY_ISUNICODE( iKey ) ) { if( ( iFlags & ( HB_KF_CTRL | HB_KF_ALT ) ) == HB_KF_CTRL ) { if( iValue >= 'A' && iValue <= 'Z' ) return 512 + ( iValue - 'A' ) + 1; else if( iValue >= 'a' && iValue <= 'z' ) return 512 + ( iValue - 'a' ) + 1; } } } return hb_inkeyKeyStd( iKey ); }
int hb_inkeyKeyStd( int iKey ) { HB_TRACE( HB_TR_DEBUG, ( "hb_inkeyKeyStd(%d)", iKey ) ); if( HB_INKEY_ISEXT( iKey ) ) { int iFlags = HB_INKEY_FLAGS( iKey ); if( HB_INKEY_ISMOUSEPOS( iKey ) ) iKey = K_MOUSEMOVE; else if( HB_INKEY_ISKEY( iKey ) ) { iKey = HB_INKEY_VALUE( iKey ); if( iKey > 0 && iKey <= ( int ) HB_SIZEOFARRAY( s_transKeyFun ) ) iKey = s_inkeyTransChar( iKey, iFlags, &s_transKeyFun[ iKey - 1 ] ); else if( iKey >= 32 && iKey <= 127 ) iKey = s_inkeyTransChar( iKey, iFlags, &s_transKeyStd[ iKey - 32 ] ); } else if( HB_INKEY_ISCHAR( iKey ) || HB_INKEY_ISUNICODE( iKey ) ) { int iVal = HB_INKEY_VALUE( iKey ); if( iVal >= 32 && iVal <= 127 && ( iFlags & ( HB_KF_ALT | HB_KF_CTRL ) ) != 0 ) iKey = s_inkeyTransChar( iVal, iFlags, &s_transKeyStd[ iVal - 32 ] ); else if( HB_INKEY_ISUNICODE( iKey ) ) { HB_WCHAR wc = ( HB_WCHAR ) iVal; if( wc ) { HB_UCHAR uc = hb_cdpGetUC( hb_vmCDP(), wc, 0 ); if( uc != 0 ) iKey = uc; } else iKey = 0; } else iKey = iVal; } else /* HB_INKEY_ISMOUSEKEY | HB_INKEY_ISEVENT */ iKey = HB_INKEY_VALUE( iKey ); } return iKey; }
HB_SIZE hb_inkeyKeyString( int iKey, char * buffer, HB_SIZE nSize ) { HB_SIZE nLen = 0; HB_TRACE( HB_TR_DEBUG, ( "hb_inkeyKeyString(%d,%p, %" HB_PFS "u)", iKey, buffer, nSize ) ); if( HB_INKEY_ISUNICODE( iKey ) ) { nLen = hb_cdpTextPutU16( hb_vmCDP(), buffer, nSize, HB_INKEY_VALUE( iKey ) ); } else { if( HB_INKEY_ISCHAR( iKey ) ) iKey = HB_INKEY_VALUE( iKey ); if( iKey >= 32 && iKey <= 255 && iKey != 127 ) { PHB_CODEPAGE cdp = hb_vmCDP(); nLen = hb_cdpTextPutU16( cdp, buffer, nSize, hb_cdpGetU16( cdp, ( HB_UCHAR ) iKey ) ); } } return nLen; }