📄 dictionary_touch_5_touch.c
字号:
gui_set_text_color(UI_COLOR_RED);
gui_print_text(L"have no this word!");
gui_BLT_double_buffer(0,0,UI_device_width-1,UI_device_height-1);
return;
}
if((str_ch= strstr(token_pt, input_word2))!= NULL)
{
while( *(--str_ch) != '\t')
{
while(*str_ch != '\t')
{
str_ch++;
}
str_ch = strstr(str_ch, input_word2); //match in the less wide area
}
str_en = str_ch;
token_pt = str_ch;
while(*token_pt != '\n') //store the token_pt;
{
token_pt++;
}
count_j=0;
while(*str_ch != '\n')
{
str_ch++;
count_j++;
}
str_ch -= count_j;
/*for(count_k=0; count_k<20; count_k++)
{
tmp_word[2][count_k]=' ';
}
for(count_k=0; count_k<40; count_k++)
{
tmp_word_chan[2][count_k]=' ';
}*/
memcpy(tmp_word[2],tmp_word_clean,20);
memcpy(tmp_word_chan[2],tmp_word_chan_clean,40);
memcpy(tmp_word[2],str_ch,count_j);
Convert_GBK_to_Unicode4(tmp_word[2],(U16 *)tmp_word_chan[2],40);
count_j=0;
while(*str_en != '\n')
{
str_en--;
count_j++;
}
str_en++;
count_j--;
/*for(count_k=0; count_k<20; count_k++)
{
tmp_word[3][count_k]=' ';
}
for(count_k=0; count_k<40; count_k++)
{
tmp_word_chan[3][count_k]=' ';
}*/
memcpy(tmp_word[3],tmp_word_clean,20);
memcpy(tmp_word_chan[3],tmp_word_chan_clean,40);
memcpy(tmp_word[3],str_en,count_j);
Convert_GBK_to_Unicode4(tmp_word[3],(U16 *)tmp_word_chan[3],40); //占用太大内存,把str_ch清空了
}
if((str_ch= strstr(token_pt, input_word2))!= NULL)
{
while( *(--str_ch) != '\t')
{
while(*str_ch != '\t')
{
str_ch++;
}
str_ch = strstr(str_ch, input_word2); //match in the less wide area
}
str_en = str_ch;
token_pt = str_ch;
while(*token_pt != '\n') //store the token_pt;
{
token_pt++;
}
count_j=0;
while(*str_ch != '\n')
{
str_ch++;
count_j++;
}
str_ch -= count_j;
/*for(count_k=0; count_k<20; count_k++)
{
tmp_word[4][count_k]=' ';
}
for(count_k=0; count_k<40; count_k++)
{
tmp_word_chan[4][count_k]=' ';
}*/
memcpy(tmp_word[4],tmp_word_clean,20);
memcpy(tmp_word_chan[4],tmp_word_chan_clean,40);
memcpy(tmp_word[4],str_ch,count_j);
Convert_GBK_to_Unicode4(tmp_word[4],(U16 *)tmp_word_chan[4],40);
count_j=0;
while(*str_en != '\n')
{
str_en--;
count_j++;
}
str_en++;
count_j--;
/*for(count_k=0; count_k<20; count_k++)
{
tmp_word[5][count_k]=' ';
}
for(count_k=0; count_k<40; count_k++)
{
tmp_word_chan[5][count_k]=' ';
}*/
memcpy(tmp_word[5],tmp_word_clean,20);
memcpy(tmp_word_chan[5],tmp_word_chan_clean,40);
memcpy(tmp_word[5],str_en,count_j);
Convert_GBK_to_Unicode4(tmp_word[5],(U16 *)tmp_word_chan[5],40); //占用太大内存,把str_ch清空了
}
if((str_ch= strstr(token_pt, input_word2))!= NULL)
{
while( *(--str_ch) != '\t')
{
while(*str_ch != '\t')
{
str_ch++;
}
str_ch = strstr(str_ch, input_word2); //match in the less wide area
}
str_en = str_ch;
token_pt = str_ch;
while(*token_pt != '\n') //store the token_pt;
{
token_pt++;
}
count_j=0;
while(*str_ch != '\n')
{
str_ch++;
count_j++;
}
str_ch -= count_j;
/*for(count_k=0; count_k<20; count_k++)
{
tmp_word[6][count_k]=' ';
}
for(count_k=0; count_k<40; count_k++)
{
tmp_word_chan[6][count_k]=' ';
}*/
memcpy(tmp_word[6],tmp_word_clean,20);
memcpy(tmp_word_chan[6],tmp_word_chan_clean,40);
memcpy(tmp_word[6],str_ch,count_j);
Convert_GBK_to_Unicode4(tmp_word[6],(U16 *)tmp_word_chan[6],40);
count_j=0;
while(*str_en != '\n')
{
str_en--;
count_j++;
}
str_en++;
count_j--;
/*for(count_k=0; count_k<20; count_k++)
{
tmp_word[7][count_k]=' ';
}
for(count_k=0; count_k<40; count_k++)
{
tmp_word_chan[7][count_k]=' ';
}*/
memcpy(tmp_word[7],tmp_word_clean,20);
memcpy(tmp_word_chan[7],tmp_word_chan_clean,40);
memcpy(tmp_word[7],str_en,count_j);
Convert_GBK_to_Unicode4(tmp_word[7],(U16 *)tmp_word_chan[7],40); //占用太大内存,把str_ch清空了
}
//GoBackHistory();
My_Main22();
//Dic_Input_Show();
}
void My_Main2(void)
{
/*EntryNewScreen(4555,NULL,My_Main2,NULL);
entry_full_screen();
clear_screen();
*/
ShowCategory5Screen(0,0,STR_GLOBAL_OPTIONS,IMG_GLOBAL_OPTIONS,STR_GLOBAL_CLEAR,IMG_GLOBAL_CLEAR,INPUT_TYPE_ALPHANUMERIC_SENTENCECASE, input_words, 60,NULL);
SetLeftSoftkeyFunction(My_Translation,KEY_EVENT_UP);
SetRightSoftkeyFunction(GoBackHistory,KEY_EVENT_UP);
}
void My_Translation(void)
{
U16 count_i;
strcpy(head,input_words); //just can copy the first char
Convert_Unicode_to_GBK(head,(U16 *)head_chan,2);
if( (head_chan[0] >= 'a' && head_chan[0] <= 'z') || (head_chan[0] >= 'A' && head_chan[0] <= 'Z') )
{
Convert_Unicode_to_GBK(input_words,(U16 *)input_words_chan,10); //if you get too much memory, it will give you a break.
strcpy(input_word, input_words_chan); //can't use = to the address instance
for(count_i=0; count_i<strlen(input_word); count_i++)
{
input_word[count_i] = Tolower(input_word[count_i]);
}
English_to_Chinese();
}
else
{
if( strcmp(head_chan, head_chan2) == 0) //'' 与 0 与 NULL 区别?
{
gui_move_text_cursor(10,150);
gui_set_text_color(UI_COLOR_RED);
gui_print_text(L"input words, please!");
gui_BLT_double_buffer(0,0,UI_device_width-1,UI_device_height-1);
}
else
{
Convert_Unicode_to_GBK(input_words,(U16 *)input_words_chan,4);
strcpy(input_word2, input_words_chan); //take all of your global variables to the head
Chinese_to_English();
}
}
//SetLeftSoftkeyFunction(My_Main22,KEY_EVENT_UP);
}
//the parameter of point will be past to function of mmi_pen_register_down_handler inderecly
void Touch_Screen(mmi_pen_point_struct point)
{
if(point.x > 16 && point.x < 204 && point.y > 20 && point.y < 200)
{
My_Main2();
}
}
void Dic_Input_Show(void)
{
EntryNewScreen(4335,NULL,Dic_Input_Show,NULL);
entry_full_screen();
clear_screen();
gui_move_text_cursor(50,12);
gui_set_text_color(UI_COLOR_RED);
gui_print_text(L"input word");
gui_BLT_double_buffer(0,0,UI_device_width-1,UI_device_height-1);
memcpy(input_words,tmp_word_clean,20);
gui_draw_rectangle(16,36,204,174,UI_COLOR_RED); //input area
gui_fill_rectangle(20,40,200,170,UI_COLOR_GREY);
gui_move_text_cursor(22,42);
gui_set_text_color(UI_COLOR_RED);
gui_print_text((U16 *)input_words);
gui_BLT_double_buffer(0,0,UI_device_width-1,UI_device_height-1);
mmi_pen_register_down_handler((mmi_pen_hdlr)Touch_Screen);
SetLeftSoftkeyFunction(My_Main2,KEY_EVENT_UP);
SetRightSoftkeyFunction(GoBackHistory,KEY_EVENT_UP);
}
void Touch_Screen2(mmi_pen_point_struct point)
{
if(point.x > 16 && point.x < 204 && point.y > 20 && point.y < 200)
{
GoBackHistory();
}
}
void My_Main22(void)
{
S32 x1,y1,x2,y2;
U16 count_j=0;
U16 count_k=0;
EntryNewScreen(4565,NULL,My_Main22,NULL);
entry_full_screen();
clear_screen();
gui_move_text_cursor(50,12);
gui_set_text_color(UI_COLOR_RED);
gui_print_text(L"input word");
gui_BLT_double_buffer(0,0,UI_device_width-1,UI_device_height-1);
gui_draw_rectangle(16,36,204,74,UI_COLOR_RED); //input area
gui_fill_rectangle(20,40,200,70,UI_COLOR_GREY);
gui_move_text_cursor(22,42);
gui_set_text_color(UI_COLOR_RED);
gui_print_text((U16 *)input_words);
gui_BLT_double_buffer(0,0,UI_device_width-1,UI_device_height-1);
memcpy(input_words,tmp_word_clean,20);
gui_move_text_cursor(22,90);
gui_set_text_color(UI_COLOR_RED);
gui_print_text(L"some words about");
gui_BLT_double_buffer(0,0,UI_device_width-1,UI_device_height-1);
gui_draw_rectangle(16,116,204,254,UI_COLOR_RED); //output area
gui_fill_rectangle(20,120,200,250,UI_COLOR_GREY);
gui_move_text_cursor(22,122);
gui_set_text_color(UI_COLOR_RED);
gui_print_text((U16 *)tmp_word_chan[0]);
gui_BLT_double_buffer(0,0,UI_device_width-1,UI_device_height-1);
memcpy(tmp_word[0],tmp_word_clean,20);
memcpy(tmp_word_chan[0],tmp_word_chan_clean,40);
/*for(count_k=0; count_k<40; count_k++) //why useless
{
tmp_word_chan[0][count_k]=' ';
}*/
gui_move_text_cursor(102,122);
gui_set_text_color(UI_COLOR_RED);
gui_print_text((U16 *)tmp_word_chan[1]);
gui_BLT_double_buffer(0,0,UI_device_width-1,UI_device_height-1);
memcpy(tmp_word[1],tmp_word_clean,20);
memcpy(tmp_word_chan[1],tmp_word_chan_clean,40);
/*for(count_k=0; count_k<40; count_k++)
{
tmp_word_chan[1][count_k]=' ';
}*/
/*y2 = 152;
//for(count_j=2; count_j<5; count_j++)
//{
gui_move_text_cursor(22,y2);
gui_set_text_color(UI_COLOR_RED);
gui_print_text(tmp_word_chan[count_j]); //print EN
gui_BLT_double_buffer(0,0,UI_device_width-1,UI_device_height-1);
gui_move_text_cursor(102,y2);
gui_set_text_color(UI_COLOR_RED);
gui_print_text(tmp_word_chan[count_j+1]);
gui_BLT_double_buffer(0,0,UI_device_width-1,UI_device_height-1);
//y2 = 152+(count_j-1)*30;
//}*/
gui_move_text_cursor(22,152);
gui_set_text_color(UI_COLOR_RED);
gui_print_text((U16 *)tmp_word_chan[2]); //print EN
gui_BLT_double_buffer(0,0,UI_device_width-1,UI_device_height-1);
memcpy(tmp_word[2],tmp_word_clean,20);
memcpy(tmp_word_chan[2],tmp_word_chan_clean,40);
/*for(count_k=0; count_k<40; count_k++)
{
tmp_word_chan[2][count_k]=' ';
}*/
gui_move_text_cursor(102,152);
gui_set_text_color(UI_COLOR_RED);
gui_print_text((U16 *)tmp_word_chan[3]);
gui_BLT_double_buffer(0,0,UI_device_width-1,UI_device_height-1);
memcpy(tmp_word[3],tmp_word_clean,20);
memcpy(tmp_word_chan[3],tmp_word_chan_clean,40);
/*for(count_k=0; count_k<40; count_k++)
{
tmp_word_chan[3][count_k]=' ';
}*/
gui_move_text_cursor(22,182);
gui_set_text_color(UI_COLOR_RED);
gui_print_text((U16 *)tmp_word_chan[4]); //print EN
gui_BLT_double_buffer(0,0,UI_device_width-1,UI_device_height-1);
memcpy(tmp_word[4],tmp_word_clean,20);
memcpy(tmp_word_chan[4],tmp_word_chan_clean,40);
/*for(count_k=0; count_k<40; count_k++)
{
tmp_word_chan[4][count_k]=' ';
}*/
gui_move_text_cursor(102,182);
gui_set_text_color(UI_COLOR_RED);
gui_print_text((U16 *)tmp_word_chan[5]);
gui_BLT_double_buffer(0,0,UI_device_width-1,UI_device_height-1);
memcpy(tmp_word[5],tmp_word_clean,20);
memcpy(tmp_word_chan[5],tmp_word_chan_clean,40);
/*for(count_k=0; count_k<40; count_k++)
{
tmp_word_chan[5][count_k]=' ';
}
*/
gui_move_text_cursor(22,212);
gui_set_text_color(UI_COLOR_RED);
gui_print_text((U16 *)tmp_word_chan[6]); //print EN
gui_BLT_double_buffer(0,0,UI_device_width-1,UI_device_height-1);
memcpy(tmp_word[6],tmp_word_clean,20);
memcpy(tmp_word_chan[6],tmp_word_chan_clean,40);
/*for(count_k=0; count_k<40; count_k++)
{
tmp_word_chan[6][count_k]=' ';
}*/
gui_move_text_cursor(102,212);
gui_set_text_color(UI_COLOR_RED);
gui_print_text((U16 *)tmp_word_chan[7]);
gui_BLT_double_buffer(0,0,UI_device_width-1,UI_device_height-1);
memcpy(tmp_word[7],tmp_word_clean,20);
memcpy(tmp_word_chan[7],tmp_word_chan_clean,40);
/*for(count_k=0; count_k<40; count_k++)
{
tmp_word_chan[7][count_k]=' ';
}*/
mmi_pen_register_down_handler((mmi_pen_hdlr)Touch_Screen2);
SetLeftSoftkeyFunction(My_Main2,KEY_EVENT_UP);
SetRightSoftkeyFunction(GoBackHistory,KEY_EVENT_UP);
}
/*
void My_Main(void)
{
U16 nStrItemList[3];
U16 nNumofItem;
U16 a[2]={2,3};
U16 b[2]={3,5};
EntryNewScreen(4265,NULL,My_Main,NULL);
entry_full_screen();
clear_screen();
nNumofItem = GetNumOfChild(MENU_ID_MY_PICTURE);
GetSequenceStringIds(MENU_ID_MY_PICTURE, nStrItemList);
//ShowCategory5Screen(0,0,STR_GLOBAL_OPTIONS,IMG_GLOBAL_OPTIONS,STR_GLOBAL_CLEAR,IMG_GLOBAL_CLEAR,INPUT_TYPE_ALPHANUMERIC_SENTENCECASE, input_words, 60,NULL);
ShowCategory15Screen(0,0,STR_GLOBAL_YES,IMG_GLOBAL_YES,STR_GLOBAL_BACK,IMG_GLOBAL_BACK,2,a,b,LIST_MENU,0,NULL);
}*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -