mirror of
https://github.com/VincentWei/MiniGUI.git
synced 2026-09-30 06:23:22 +08:00
Merge branch 'master' of github.com:VincentWei/minigui
This commit is contained in:
+14
-10
@@ -2463,30 +2463,34 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
case MSG_CHAR:
|
||||
{
|
||||
unsigned char charBuffer [3];
|
||||
unsigned char charBuffer [4];
|
||||
int chars;
|
||||
|
||||
_MG_PRINTF("get char-----------------char----%p\n", (PVOID)wParam);
|
||||
|
||||
if (wParam == 127) // BS
|
||||
wParam = '\b';
|
||||
|
||||
if (dwStyle & ES_READONLY)
|
||||
return 0;
|
||||
|
||||
charBuffer [0] = LOBYTE (wParam);
|
||||
charBuffer [1] = HIBYTE (wParam);
|
||||
charBuffer [2] = (0x00ff0000 & wParam) >> 16;
|
||||
|
||||
if (charBuffer [2]) {
|
||||
charBuffer [0] = FIRSTBYTE (wParam);
|
||||
charBuffer [1] = SECONDBYTE (wParam);
|
||||
charBuffer [2] = THIRDBYTE (wParam);
|
||||
charBuffer [3] = FOURTHBYTE (wParam);
|
||||
|
||||
if (charBuffer [3]) {
|
||||
chars = 4;
|
||||
}
|
||||
else if (charBuffer [2]) {
|
||||
chars = 3;
|
||||
}
|
||||
else if (HIBYTE (wParam)) {
|
||||
else if (charBuffer [1]) {
|
||||
chars = 2;
|
||||
}
|
||||
else {
|
||||
chars = 1;
|
||||
|
||||
if (charBuffer [0] == 127) // BS
|
||||
charBuffer [0] = '\b';
|
||||
|
||||
if (dwStyle & ES_UPPERCASE) {
|
||||
charBuffer [0] = toupper (charBuffer[0]);
|
||||
}
|
||||
|
||||
+17
-9
@@ -2070,30 +2070,38 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
return sleKeyDown (hWnd, wParam, lParam);
|
||||
}
|
||||
|
||||
case MSG_UTF8CHAR:
|
||||
_ERR_PRINTF ("CONTROL>EDIT: MSG_UTF8CHAR is not implemented.\n");
|
||||
break;
|
||||
|
||||
case MSG_CHAR:
|
||||
{
|
||||
unsigned char charBuffer [3];
|
||||
unsigned char charBuffer [4];
|
||||
int chars;
|
||||
|
||||
if (wParam == 127) // BS
|
||||
wParam = '\b';
|
||||
|
||||
if (dwStyle & ES_READONLY)
|
||||
return 0;
|
||||
|
||||
charBuffer [0] = LOBYTE (wParam);
|
||||
charBuffer [1] = HIBYTE (wParam);
|
||||
charBuffer [2] = (0x00ff0000 & wParam) >> 16;
|
||||
charBuffer [0] = FIRSTBYTE (wParam);
|
||||
charBuffer [1] = SECONDBYTE (wParam);
|
||||
charBuffer [2] = THIRDBYTE (wParam);
|
||||
charBuffer [3] = FOURTHBYTE (wParam);
|
||||
|
||||
if (charBuffer [2]) {
|
||||
if (charBuffer [3]) {
|
||||
chars = 4;
|
||||
}
|
||||
else if (charBuffer [2]) {
|
||||
chars = 3;
|
||||
}
|
||||
else if (HIBYTE (wParam)) {
|
||||
else if (charBuffer [1]) {
|
||||
chars = 2;
|
||||
}
|
||||
else {
|
||||
chars = 1;
|
||||
|
||||
if (charBuffer [0] == 127) // BS
|
||||
charBuffer [0] = '\b';
|
||||
|
||||
if (dwStyle & ES_UPPERCASE) {
|
||||
charBuffer [0] = toupper (charBuffer[0]);
|
||||
}
|
||||
|
||||
+13
-5
@@ -1990,7 +1990,7 @@ static void teSetCaretPosOnChar (HWND hWnd, PTEDATA ptedata, int old_caret_pos)
|
||||
static void teOnChar (HWND hWnd, PTEDATA ptedata, WPARAM wParam)
|
||||
{
|
||||
int chlen;
|
||||
unsigned char ch[3];
|
||||
unsigned char ch[4];
|
||||
TextNode *node;
|
||||
TextMark *mark;
|
||||
TextDoc *txtdoc;
|
||||
@@ -2004,11 +2004,15 @@ static void teOnChar (HWND hWnd, PTEDATA ptedata, WPARAM wParam)
|
||||
return;
|
||||
}
|
||||
|
||||
ch [0] = LOBYTE (wParam);
|
||||
ch [1] = HIBYTE (wParam);
|
||||
ch [2] = (0x0ff0000 & wParam) >> 16;
|
||||
ch [0] = FIRSTBYTE (wParam);
|
||||
ch [1] = SECONDBYTE (wParam);
|
||||
ch [2] = THIRDBYTE (wParam);
|
||||
ch [3] = FOURTHBYTE (wParam);
|
||||
|
||||
if (ch[2]) {
|
||||
if (ch[3]) {
|
||||
chlen = 4;
|
||||
}
|
||||
else if (ch[2]) {
|
||||
chlen = 3;
|
||||
}
|
||||
else if (ch[1]) {
|
||||
@@ -3214,6 +3218,10 @@ static LRESULT TextEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM
|
||||
break;
|
||||
}
|
||||
|
||||
case MSG_UTF8CHAR:
|
||||
_ERR_PRINTF ("CONTROL>EDIT: MSG_UTF8CHAR is not implemented.\n");
|
||||
break;
|
||||
|
||||
case MSG_CHAR:
|
||||
if (wParam == 127) /* BS */
|
||||
wParam = '\b';
|
||||
|
||||
+8
-8
@@ -3525,7 +3525,7 @@ static int utf16le_len_first_char (const unsigned char* mstr, int len)
|
||||
if (len < 2)
|
||||
return 0;
|
||||
|
||||
w1 = MAKEWORD (mstr[0], mstr[1]);
|
||||
w1 = MAKEWORD16 (mstr[0], mstr[1]);
|
||||
|
||||
if (w1 < 0xD800 || w1 > 0xDFFF)
|
||||
return 2;
|
||||
@@ -3533,7 +3533,7 @@ static int utf16le_len_first_char (const unsigned char* mstr, int len)
|
||||
if (w1 >= 0xD800 && w1 <= 0xDBFF) {
|
||||
if (len < 4)
|
||||
return 0;
|
||||
w2 = MAKEWORD (mstr[2], mstr[3]);
|
||||
w2 = MAKEWORD16 (mstr[2], mstr[3]);
|
||||
if (w2 < 0xDC00 || w2 > 0xDFFF)
|
||||
return 0;
|
||||
}
|
||||
@@ -3547,12 +3547,12 @@ static Glyph32 utf16le_char_glyph_value (const unsigned char* pre_mchar,
|
||||
UChar16 w1, w2;
|
||||
UChar32 wc;
|
||||
|
||||
w1 = MAKEWORD (cur_mchar[0], cur_mchar[1]);
|
||||
w1 = MAKEWORD16 (cur_mchar[0], cur_mchar[1]);
|
||||
|
||||
if (w1 < 0xD800 || w1 > 0xDFFF)
|
||||
return w1;
|
||||
|
||||
w2 = MAKEWORD (cur_mchar[2], cur_mchar[3]);
|
||||
w2 = MAKEWORD16 (cur_mchar[2], cur_mchar[3]);
|
||||
|
||||
wc = w1;
|
||||
wc <<= 10;
|
||||
@@ -3765,7 +3765,7 @@ static int utf16be_len_first_char (const unsigned char* mstr, int len)
|
||||
if (len < 2)
|
||||
return 0;
|
||||
|
||||
w1 = MAKEWORD (mstr[1], mstr[0]);
|
||||
w1 = MAKEWORD16 (mstr[1], mstr[0]);
|
||||
|
||||
if (w1 < 0xD800 || w1 > 0xDFFF)
|
||||
return 2;
|
||||
@@ -3773,7 +3773,7 @@ static int utf16be_len_first_char (const unsigned char* mstr, int len)
|
||||
if (w1 >= 0xD800 && w1 <= 0xDBFF) {
|
||||
if (len < 4)
|
||||
return 0;
|
||||
w2 = MAKEWORD (mstr[3], mstr[2]);
|
||||
w2 = MAKEWORD16 (mstr[3], mstr[2]);
|
||||
if (w2 < 0xDC00 || w2 > 0xDFFF)
|
||||
return 0;
|
||||
}
|
||||
@@ -3787,12 +3787,12 @@ static Glyph32 utf16be_char_glyph_value (const unsigned char* pre_mchar,
|
||||
UChar16 w1, w2;
|
||||
UChar32 wc;
|
||||
|
||||
w1 = MAKEWORD (cur_mchar[1], cur_mchar[0]);
|
||||
w1 = MAKEWORD16 (cur_mchar[1], cur_mchar[0]);
|
||||
|
||||
if (w1 < 0xD800 || w1 > 0xDFFF)
|
||||
return w1;
|
||||
|
||||
w2 = MAKEWORD (cur_mchar[3], cur_mchar[2]);
|
||||
w2 = MAKEWORD16 (cur_mchar[3], cur_mchar[2]);
|
||||
|
||||
wc = w1;
|
||||
wc <<= 10;
|
||||
|
||||
@@ -62,7 +62,7 @@ static void output_gbhz_py_tab (void)
|
||||
int j;
|
||||
GBHZ_PINYIN* p = gbhz_py_tab + i;
|
||||
|
||||
printf ("\t{0x%04X /* %c%c */, 0, {", p->encoding, HIBYTE (p->encoding), LOBYTE (p->encoding));
|
||||
printf ("\t{0x%04X /* %c%c */, 0, {", p->encoding, HIBYTE_WORD16 (p->encoding), LOBYTE_WORD16 (p->encoding));
|
||||
for (j = 0; j < MAX_NR_PINYIN; j++) {
|
||||
int no_py, tone;
|
||||
if (p->pinyin [j] == 0)
|
||||
@@ -113,7 +113,7 @@ static int set_gbhz_pinyin (unsigned char ch1, unsigned char ch2, unsigned short
|
||||
|
||||
p = gbhz_py_tab + index;
|
||||
|
||||
p->encoding = MAKEWORD (ch2, ch1);
|
||||
p->encoding = MAKEWORD16 (ch2, ch1);
|
||||
for (i = 0; i < MAX_NR_PINYIN; i++) {
|
||||
if (p->pinyin [i] == 0) {
|
||||
p->pinyin [i] = no_py;
|
||||
|
||||
+10
-10
@@ -406,7 +406,7 @@ static void handle_scancode_on_keydown (int scancode, key_info* kinfo)
|
||||
if (key_map)
|
||||
keysym = key_map [scancode];
|
||||
|
||||
kinfo->type =HIBYTE(keysym);
|
||||
kinfo->type = HIBYTE (keysym);
|
||||
/*Now, the kinfo->type maybe changed to KT_ARABIC_COMPOSE.
|
||||
* So we have to deal with this situation */
|
||||
if(kinfo->type >= 0xf0){
|
||||
@@ -423,7 +423,7 @@ static void handle_scancode_on_keydown (int scancode, key_info* kinfo)
|
||||
key_map = __mg_key_maps[shift_final ^(1<<KG_SHIFT)];
|
||||
if (key_map)
|
||||
keysym = key_map [scancode];
|
||||
kinfo->type =HIBYTE(keysym);
|
||||
kinfo->type = HIBYTE (keysym);
|
||||
|
||||
if(kinfo->type >= 0xf0){
|
||||
kinfo->type -= 0xf0;
|
||||
@@ -559,13 +559,13 @@ BOOL GUIAPI TranslateMessage (PMSG pMsg)
|
||||
SendNotifyMessage (pMsg->hwnd, MSG_CHAR, __mg_kinfo.buff[0], pMsg->lParam);
|
||||
}
|
||||
else if (__mg_kinfo.pos == 2 && arabic_compose_flag) {
|
||||
/*
|
||||
#if 0
|
||||
SendNotifyMessage (pMsg->hwnd, MSG_CHAR,
|
||||
MAKEWORD (__mg_kinfo.buff[0], __mg_kinfo.buff[1]),
|
||||
pMsg->lParam);
|
||||
*/
|
||||
MAKEWPARAM (__mg_kinfo.buff[0], __mg_kinfo.buff[1], 0, 0), pMsg->lParam);
|
||||
#else
|
||||
SendNotifyMessage (pMsg->hwnd, MSG_CHAR, __mg_kinfo.buff[0], pMsg->lParam);
|
||||
SendNotifyMessage (pMsg->hwnd, MSG_CHAR, __mg_kinfo.buff[1], pMsg->lParam);
|
||||
#endif
|
||||
arabic_compose_flag =0;
|
||||
}
|
||||
else {
|
||||
@@ -610,13 +610,13 @@ BOOL GUIAPI TranslateMessage (PMSG pMsg)
|
||||
SendNotifyMessage (pMsg->hwnd, MSG_CHAR, kinfo.buff[0], pMsg->lParam);
|
||||
}
|
||||
else if (kinfo.pos == 2 && arabic_compose_flag) {
|
||||
/*
|
||||
#if 0
|
||||
SendNotifyMessage (pMsg->hwnd, MSG_CHAR,
|
||||
MAKEWORD (__mg_kinfo.buff[0], __mg_kinfo.buff[1]),
|
||||
pMsg->lParam);
|
||||
*/
|
||||
MAKEWPARAM (__mg_kinfo.buff[0], __mg_kinfo.buff[1], 0, 0), pMsg->lParam);
|
||||
#else
|
||||
SendNotifyMessage (pMsg->hwnd, MSG_CHAR, kinfo.buff[0], pMsg->lParam);
|
||||
SendNotifyMessage (pMsg->hwnd, MSG_CHAR, kinfo.buff[1], pMsg->lParam);
|
||||
#endif
|
||||
arabic_compose_flag =0;
|
||||
}
|
||||
else {
|
||||
|
||||
+7
-6
@@ -138,7 +138,7 @@ void VFBSetCaption(const char* caption)
|
||||
/*one XVFBCaptionEventData struct costs 8 bytes,
|
||||
* change that '8' below if the struct is changed*/
|
||||
if (mg_writesocket(__mg_pcxvfb_client_sockfd, ced, 8+len) < (8+len)) {
|
||||
_MG_PRINTF ("IAL>PCXVFB: error occurred when calling VFBSetCaption.\n");
|
||||
_ERR_PRINTF ("IAL>PCXVFB: error occurred when calling VFBSetCaption.\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ void VFBOpenIME(int bOpen)
|
||||
return;
|
||||
|
||||
if (mg_writesocket(__mg_pcxvfb_client_sockfd, &ime, sizeof(ime)) < sizeof(ime)) {
|
||||
_MG_PRINTF ("IAL>PCXVFB: error occurred when calling VFBOpenIME.\n");
|
||||
_ERR_PRINTF ("IAL>PCXVFB: error occurred when calling VFBOpenIME.\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ void VFBShowWindow(int show)
|
||||
return;
|
||||
|
||||
if (mg_writesocket(__mg_pcxvfb_client_sockfd, info, sizeof(info)) < sizeof(info)) {
|
||||
_MG_PRINTF ("IAL>PCXVFB: error occurred when calling VFBShowWindow.\n");
|
||||
_ERR_PRINTF ("IAL>PCXVFB: error occurred when calling VFBShowWindow.\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -267,7 +267,7 @@ static void write_rec (const void* buf, size_t n)
|
||||
/* TODO: */
|
||||
#else
|
||||
if (write(record_fd, buf, n) < n) {
|
||||
_MG_PRINTF ("IAL>PCXVFB: error occurred when calling write_rec.\n");
|
||||
_ERR_PRINTF ("IAL>PCXVFB: error occurred when calling write_rec.\n");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -346,7 +346,7 @@ static void mouse_setxy (int x, int y)
|
||||
return;
|
||||
|
||||
if (mg_writesocket (__mg_pcxvfb_client_sockfd, &mouse_event, sizeof(XVFBEVENT)) < sizeof(XVFBEVENT)) {
|
||||
_MG_PRINTF ("IAL>PCXVFB: error occurred when setting mouse position.\n");
|
||||
_ERR_PRINTF ("IAL>PCXVFB: error occurred when setting mouse position.\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -423,7 +423,8 @@ static int keyboard_update (void)
|
||||
}
|
||||
else {
|
||||
scancode = unicode;
|
||||
//printf ("scancode = %d\n", scancode);
|
||||
_DBG_PRINTF ("IAL>PCXVFB: get a key state change (%s): scancode = %d\n",
|
||||
press?"pressed":"released", scancode);
|
||||
kbd_state [scancode] = press;
|
||||
if (press)
|
||||
last = scancode;
|
||||
|
||||
+1
-1
@@ -1348,7 +1348,7 @@ void __mg_ime_writemsg (BYTE *buffer, int len, LPARAM lParam, BOOL bDByte)
|
||||
|
||||
if (bDByte) {
|
||||
for (i=0; i<len; i+=2) {
|
||||
wDByte = MAKEWORD (buffer[i], buffer[i+1]);
|
||||
wDByte = MAKEWORD16 (buffer[i], buffer[i+1]);
|
||||
if (sg_hTargetWnd)
|
||||
PostMessage (sg_hTargetWnd, MSG_CHAR, wDByte, 0);
|
||||
#if defined(_LITE_VERSION) && !defined(_STAND_ALONE)
|
||||
|
||||
@@ -38,7 +38,7 @@ const char *__mg_msgstr1 [] =
|
||||
"MSG_KEYLONGPRESS ", // 0x0016
|
||||
"MSG_KEYALWAYSPRESS ", // 0x0017
|
||||
"MSG_KEYSYM ", // 0x0018
|
||||
"", // 0x0019
|
||||
"MSG_UTF8CHAR ", // 0x0019
|
||||
"", // 0x001A
|
||||
"", // 0x001B
|
||||
"", // 0x001C
|
||||
|
||||
@@ -70,14 +70,14 @@ void* win_PCXVFbInit (char* execl_file, char* etc_param, const char *skin)
|
||||
char caption[64] = "wvfb";
|
||||
char cmdline[512];
|
||||
STARTUPINFO si;
|
||||
WORD wVersionRequested;
|
||||
WORD16 wVersionRequested;
|
||||
WSADATA wsaData;
|
||||
struct sockaddr_in ser_addr;
|
||||
struct sockaddr_in c_addr;
|
||||
int client_len;
|
||||
|
||||
// Initial for the socket ......
|
||||
wVersionRequested = MAKEWORD(2, 2);
|
||||
wVersionRequested = MAKEWORD16 (2, 2);
|
||||
if (0 != WSAStartup(wVersionRequested, &wsaData))
|
||||
{
|
||||
return NULL;
|
||||
|
||||
+6
-6
@@ -360,12 +360,12 @@ Uint32 GAL_MapRGB(GAL_PixelFormat *format, Uint8 r, Uint8 g, Uint8 b)
|
||||
| (b >> format->Bloss) << format->Bshift
|
||||
| format->Amask;
|
||||
#ifdef _NEWGAL_SWAP16
|
||||
pixv = (pixv & 0xFFFF0000) | ArchSwap16((unsigned short)pixv);
|
||||
pixv = (pixv & 0xFFFF0000) | ArchSwap16((unsigned short)pixv);
|
||||
#endif
|
||||
#if defined(_EM86_IAL) || defined (_EM85_IAL)
|
||||
if (pixv == 0) pixv ++;
|
||||
if (pixv == 0) pixv ++;
|
||||
#endif
|
||||
return pixv;
|
||||
return pixv;
|
||||
} else {
|
||||
if (format->DitheredPalette)
|
||||
return GAL_FindDitheredColor (format->BitsPerPixel, r, g, b);
|
||||
@@ -378,14 +378,14 @@ Uint32 GAL_MapRGB(GAL_PixelFormat *format, Uint8 r, Uint8 g, Uint8 b)
|
||||
Uint32 GAL_MapRGBA(GAL_PixelFormat *format, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
|
||||
{
|
||||
if ( format->palette == NULL ) {
|
||||
Uint32 pixv = (r >> format->Rloss) << format->Rshift
|
||||
Uint32 pixv = (r >> format->Rloss) << format->Rshift
|
||||
| (g >> format->Gloss) << format->Gshift
|
||||
| (b >> format->Bloss) << format->Bshift
|
||||
| ((a >> format->Aloss) << format->Ashift & format->Amask);
|
||||
#ifdef _NEWGAL_SWAP16
|
||||
pixv = (pixv & 0xFFFF0000) | ArchSwap16((unsigned short)pixv);
|
||||
pixv = (pixv & 0xFFFF0000) | ArchSwap16((unsigned short)pixv);
|
||||
#endif
|
||||
return pixv;
|
||||
return pixv;
|
||||
} else {
|
||||
if (format->DitheredPalette)
|
||||
return GAL_FindDitheredColor (format->BitsPerPixel, r, g, b);
|
||||
|
||||
+6
-6
@@ -677,8 +677,8 @@ static void _dc_draw_pixel_span_and_1 (COMP_CTXT* comp_ctxt, int w)
|
||||
#ifdef ASM_memandset4
|
||||
if (comp_ctxt->step == 1 && !((Uint32)row & 3)
|
||||
&& !(w & 3) && (w > 3)) {
|
||||
Uint16 _w = MAKEWORD (comp_ctxt->cur_pixel, comp_ctxt->cur_pixel);
|
||||
Uint32 _u = MAKELONG (_w, _w);
|
||||
Uint16 _w = MAKEWORD16 (comp_ctxt->cur_pixel, comp_ctxt->cur_pixel);
|
||||
Uint32 _u = MAKELONG32 (_w, _w);
|
||||
ASM_memandset4 (row, _u, w >> 2);
|
||||
return;
|
||||
}
|
||||
@@ -751,8 +751,8 @@ static void _dc_draw_pixel_span_or_1 (COMP_CTXT* comp_ctxt, int w)
|
||||
#ifdef ASM_memorset4
|
||||
if (comp_ctxt->step == 1 && !((Uint32)row & 3)
|
||||
&& !(w & 3) && (w > 3)) {
|
||||
Uint16 _w = MAKEWORD (comp_ctxt->cur_pixel, comp_ctxt->cur_pixel);
|
||||
Uint32 _u = MAKELONG (_w, _w);
|
||||
Uint16 _w = MAKEWORD16 (comp_ctxt->cur_pixel, comp_ctxt->cur_pixel);
|
||||
Uint32 _u = MAKELONG32 (_w, _w);
|
||||
ASM_memorset4 (row, _u, w >> 2);
|
||||
return;
|
||||
}
|
||||
@@ -826,8 +826,8 @@ static void _dc_draw_pixel_span_xor_1 (COMP_CTXT* comp_ctxt, int w)
|
||||
#ifdef ASM_memxorset4
|
||||
if (comp_ctxt->step == 1 && !((Uint32)comp_ctxt->cur_dst & 3)
|
||||
&& !(w & 3) && (w > 3)) {
|
||||
Uint16 _w = MAKEWORD (comp_ctxt->cur_pixel, comp_ctxt->cur_pixel);
|
||||
Uint32 _u = MAKELONG (_w, _w);
|
||||
Uint16 _w = MAKEWORD16 (comp_ctxt->cur_pixel, comp_ctxt->cur_pixel);
|
||||
Uint32 _u = MAKELONG32 (_w, _w);
|
||||
ASM_memxorset4 (comp_ctxt->cur_dst, _u, w >> 2);
|
||||
return;
|
||||
}
|
||||
|
||||
+1
-1
@@ -830,7 +830,7 @@ RES_KEY Str2Key (const char* str)
|
||||
l = (strlen(str)+1) / 2;
|
||||
|
||||
for (i=0; i<l; i++) {
|
||||
unsigned short w = MAKEWORD(str[i<<1], str[(i<<1)+1]);
|
||||
Uint16 w = MAKEWORD(str[i<<1], str[(i<<1)+1]);
|
||||
ret ^= (w<<(i&0x0f));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
** $Id: resource.c 12916 2010-05-14 03:51:46Z wanzheng $
|
||||
**
|
||||
|
||||
+18
-11
@@ -4312,25 +4312,28 @@ static int texteditor_get_text_char_size(mTextEditor* self, int begin)
|
||||
return char_size;
|
||||
}
|
||||
|
||||
static int mTextEditor_onChar(mTextEditor *self, int asciiCode, DWORD keyFlags)
|
||||
static int mTextEditor_onChar(mTextEditor *self, WPARAM eucCode, DWORD keyFlags)
|
||||
{
|
||||
int selBegin, selEnd, chlen;
|
||||
unsigned char ch[3];
|
||||
unsigned char ch[4];
|
||||
int replace_char_size = 0;
|
||||
|
||||
if (!TE_VALID_OBJ(self) || _read_only(self) || (keyFlags & KS_CTRL))
|
||||
return 0;
|
||||
|
||||
if(asciiCode == 127 || asciiCode == '\b')
|
||||
{
|
||||
if(eucCode == 127 || eucCode == '\b') {
|
||||
_remove_chars(self, TRUE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ch [0] = LOBYTE (asciiCode);
|
||||
ch [1] = HIBYTE (asciiCode);
|
||||
ch [2] = (0x0ff0000 & asciiCode) >> 16;
|
||||
if (ch[2]) {
|
||||
ch [0] = FIRSTBYTE (eucCode);
|
||||
ch [1] = SECONDBYTE (eucCode);
|
||||
ch [2] = THIRDBYTE (eucCode);
|
||||
ch [3] = FOURTHBYTE (eucCode);
|
||||
if (ch[3]) {
|
||||
chlen = 4;
|
||||
}
|
||||
else if (ch[2]) {
|
||||
chlen = 3;
|
||||
}
|
||||
else if (ch[1]) {
|
||||
@@ -4369,10 +4372,10 @@ static int mTextEditor_onChar(mTextEditor *self, int asciiCode, DWORD keyFlags)
|
||||
|
||||
if (chlen == 1) {
|
||||
if (GetWindowStyle(self->hwnd) & NCSS_TE_UPPERCASE) {
|
||||
asciiCode = toupper(asciiCode);
|
||||
eucCode = toupper(eucCode);
|
||||
}
|
||||
else if (GetWindowStyle(self->hwnd) & NCSS_TE_LOWERCASE) {
|
||||
asciiCode = tolower(asciiCode);
|
||||
eucCode = tolower(eucCode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4386,7 +4389,7 @@ static int mTextEditor_onChar(mTextEditor *self, int asciiCode, DWORD keyFlags)
|
||||
|
||||
|
||||
_c(self->textBuffer)->replace(self->textBuffer,
|
||||
selBegin, selEnd - selBegin, (char*)&asciiCode, -1);
|
||||
selBegin, selEnd - selBegin, (char*)&eucCode, -1);
|
||||
|
||||
ncsNotifyParent (self, NCSN_TE_CHANGE);
|
||||
_set_cont_changed(self, TRUE);
|
||||
@@ -6380,6 +6383,10 @@ static int mTextEditor_wndProc(mTextEditor *self, int message, WPARAM wParam, LP
|
||||
case MSG_CHAR:
|
||||
return _c(self)->onChar(self, wParam, lParam);
|
||||
|
||||
case MSG_UTF8CHAR:
|
||||
_ERR_PRINTF ("CONTROL>EDIT: MSG_UTF8CHAR is not implemented.\n");
|
||||
break;
|
||||
|
||||
case MSG_FONTCHANGED:
|
||||
_c(self)->onFontChanged(self);
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user