2012-04-25 02:20 UTC+0200 Viktor Szakats (harbour syenar.net)

* include/harbour.hbx
  * src/rtl/inkey.c
    + added HB_KEYCODE( <cChar> ) -> <nExtKey>
    ; pls review me. It helps replacing ASC() calls in unicode apps
      where it's used to convert characters (f.e. hotkeys) to keyboard
      codes.
This commit is contained in:
Viktor Szakats
2012-04-25 00:21:07 +00:00
parent 16e307a8c4
commit 83cc2881dd
3 changed files with 32 additions and 1 deletions

View File

@@ -16,6 +16,14 @@
The license applies to all entries newer than 2009-04-28.
*/
2012-04-25 02:20 UTC+0200 Viktor Szakats (harbour syenar.net)
* include/harbour.hbx
* src/rtl/inkey.c
+ added HB_KEYCODE( <cChar> ) -> <nExtKey>
; pls review me. It helps replacing ASC() calls in unicode apps
where it's used to convert characters (f.e. hotkeys) to keyboard
codes.
2012-04-25 00:03 UTC+0200 Viktor Szakats (harbour syenar.net)
* contrib/hbmisc/udpds.prg
+ updated to be CP agnostic

View File

@@ -623,6 +623,7 @@ DYNAMIC hb_jsonDecode
DYNAMIC hb_jsonEncode
DYNAMIC hb_keyChar
DYNAMIC hb_keyClear
DYNAMIC hb_keyCode
DYNAMIC hb_keyIns
DYNAMIC hb_keyLast
DYNAMIC hb_keyNext

View File

@@ -54,7 +54,7 @@
* The following parts are Copyright of the individual authors.
* www - http://harbour-project.org
*
* Copyright 1999-2001 Viktor Szakats (harbour syenar.net)
* Copyright 1999-2012 Viktor Szakats (harbour syenar.net)
* HB_KEYPUT()
*
* Copyright 2003-2012 Przemyslaw Czerpak <druzus@acn.waw.pl>
@@ -220,6 +220,28 @@ HB_FUNC( HB_SETLASTKEY )
hb_retni( hb_inkeySetLast( hb_parni( 1 ) ) );
}
HB_FUNC( HB_KEYCODE )
{
const char * szValue = hb_parc( 1 );
int iKey;
if( szValue )
{
PHB_CODEPAGE cdp = hb_vmCDP();
HB_SIZE nIndex = 0;
HB_WCHAR wc;
if( HB_CDPCHAR_GET( cdp, szValue, hb_parclen( 1 ), &nIndex, &wc ) )
iKey = wc >= 128 ? HB_INKEY_NEW_UNICODE( wc ) : wc;
else
iKey = 0;
}
else
iKey = 0;
hb_retni( iKey );
}
HB_FUNC( HB_KEYCHAR )
{
char szKeyChr[ HB_MAX_CHAR_LEN ];