📄 pinyinframe.cpp.rej
字号:
+ //vertical line which seperates chinese/english indicator with pinyin inputed
painter.setPen(penGray);
painter.drawLine(x+rect.width()+2,y,x+rect.width()+2,y+rect.height());
painter.setPen(penWhite);
****************** 292,297 **** QRect about = metric.boundingRect(QString(ABOUT));
painter.drawText(width-2-about.width(),rect.height(),QString(ABOUT));
painter.drawLine(width-2-about.width(),rect.height()+1,width-2,rect.height()+1);
///////////////////////////////////////////////
//the second row -- hanzi candicates
--- 344,351 ---- QRect about = metric.boundingRect(QString(ABOUT));
painter.drawText(width-2-about.width(),rect.height(),QString(ABOUT));
painter.drawLine(width-2-about.width(),rect.height()+1,width-2,rect.height()+1);
+
+ painter.drawPixmap(width-2-about.width()-28,rect.height()-10,QPixmap((const char**)kb_xpm));
///////////////////////////////////////////////
//the second row -- hanzi candicates
****************** 304,310 ****
if(m_ime_info.prev_page_available()){
QPixmap prev((const char **)pix_prev);
- painter.drawPixmap(x,y+2,prev);
x+=prev.width()+2;
}
--- 358,364 ----
if(m_ime_info.prev_page_available()){
QPixmap prev((const char **)pix_prev);
+ painter.drawPixmap(x,y,prev);
x+=prev.width()+2;
}
****************** 323,351 **** str+=get_char(i);
}
hanzi=metric.boundingRect(str);
-
- if(xx+hanzi.width()>=(unsigned int)m_rightbtn_rect.left()){//no space for this hanzi and right button
if(i<m_ime_info.candidates_count-1){ //but we need another page
break; //so give up to draw this hanzi
}
else{
//this is the last page,do not need to show next button
//so just check if the left space is enough to show this hanzi
- if(xx+hanzi.width()>width){
break;//Ooops
}
}
}
painter.drawText(xx,yy,str);
- xx+=hanzi.width()+10;
m_ime_info.candidates_on_page++;
}
if(m_ime_info.next_page_available()){
QPixmap next((const char **)pix_next);
- painter.drawPixmap(width-2-next.width(),y+2,next);
}
}
bool QPinyinFrame::prev_page()
--- 377,407 ---- str+=get_char(i);
}
hanzi=metric.boundingRect(str);
+ cand_width=hanzi.width();
+ if(xx+cand_width>=(unsigned int)m_rightbtn_rect.left()){//no space for this hanzi and right button
if(i<m_ime_info.candidates_count-1){ //but we need another page
break; //so give up to draw this hanzi
}
else{
//this is the last page,do not need to show next button
//so just check if the left space is enough to show this hanzi
+ if(xx+cand_width>width){
break;//Ooops
}
}
}
painter.drawText(xx,yy,str);
+ xx+=cand_width+10;
m_ime_info.candidates_on_page++;
}
if(m_ime_info.next_page_available()){
QPixmap next((const char **)pix_next);
+ painter.drawPixmap(width-2-next.width(),y,next);
}
+ if(m_bShowKeyboard)
+ drawKeyboard(painter,-1);
}
bool QPinyinFrame::prev_page()
****************** 354,360 **** printX86("prev page,firt visible index %d->",m_ime_info.first_visible);
m_ime_info.first_visible-=m_ime_info.candidates_on_prev_page;
printX86("%d\n",m_ime_info.first_visible);
- update();
return true;
}
else{
--- 410,417 ---- printX86("prev page,firt visible index %d->",m_ime_info.first_visible);
m_ime_info.first_visible-=m_ime_info.candidates_on_prev_page;
printX86("%d\n",m_ime_info.first_visible);
+ //update();
+ repaint(0,0,m_cand_rect.right(),m_cand_rect.bottom());
return true;
}
else{
****************** 369,375 **** m_ime_info.candidates_on_prev_page=m_ime_info.candidates_on_page;
m_ime_info.first_visible+=m_ime_info.candidates_on_page;
printX86("%d\n",m_ime_info.first_visible);
- update();
return true;
}
else{
--- 426,433 ---- m_ime_info.candidates_on_prev_page=m_ime_info.candidates_on_page;
m_ime_info.first_visible+=m_ime_info.candidates_on_page;
printX86("%d\n",m_ime_info.first_visible);
+ //update();
+ repaint(0,0,m_cand_rect.right(),m_cand_rect.bottom());
return true;
}
else{
****************** 529,535 ****
if(bUpdate){
- update();
}
if(!bKeyProcessed){
--- 587,594 ----
if(bUpdate){
+ //update();
+ repaint(0,0,m_cand_rect.right(),m_cand_rect.bottom());
}
if(!bKeyProcessed){
****************** 552,557 **** QFrame::hide ();
QPEApplication::ungrabKeyboard();
resetState();
m_engine.save_table();
//qwsServer->setKeyboardFilter (NULL);
}
--- 611,617 ---- QFrame::hide ();
QPEApplication::ungrabKeyboard();
resetState();
+ sched_yield();
m_engine.save_table();
//qwsServer->setKeyboardFilter (NULL);
}
****************** 573,578 **** int x=m->x();
int y=m->y();
if(hit_test_helper(x,y,m_about_rect)){
//show about infomation
QMessageBox::information(this,"About",
--- 633,639 ---- int x=m->x();
int y=m->y();
+ printX86("x=%d y=%d\n",x,y);
if(hit_test_helper(x,y,m_about_rect)){
//show about infomation
QMessageBox::information(this,"About",
****************** 584,604 **** "written by James Su(suzhe@tsinghua.org.cn)<br><br>"
"This small piece of cake is released under GPL;)");
}
- else if(hit_test_helper(x,y,m_leftbtn_rect)){
- prev_page();
- }
- else if(hit_test_helper(x,y,m_rightbtn_rect)){
- next_page();
- }
else if(hit_test_helper(x,y,m_indicator_rect)){
//switch between English/Chinese mode
m_bEnglishMode=!m_bEnglishMode;
bUpdate=true;
}
-
if(bUpdate){
- update();
}
}
--- 645,706 ---- "written by James Su(suzhe@tsinghua.org.cn)<br><br>"
"This small piece of cake is released under GPL;)");
}
+ else if(hit_test_helper(x,y,m_cand_rect)) {
+ printX86("candrect x %d y %d width %d height %d",m_cand_rect.x(),m_cand_rect.y(),m_cand_rect.width(),m_cand_rect.height());
+ int width=0,i=0;
+ if(m_ime_info.prev_page_available())
+ width+=m_leftbtn_rect.width();
+
+ if(m_ime_info.prev_page_available()&&
+ hit_test_helper(x,y,m_leftbtn_rect)){
+ prev_page();
+ }else if(m_ime_info.next_page_available()&&
+ hit_test_helper(x,y,m_rightbtn_rect)){
+ next_page();
+ }else { //we are hit the number area of the displayed candidates
+ if((i=m_ime_info.candidates_on_page)>0){
+ width=x-width;
+ i=width/(cand_width+10);
+ printX86("index=%d,m_cand_rect.width()=%d,x=%d,m_ime_info.candidates_on_page=%d,cand_width=%d\n",i,width,x,m_ime_info.candidates_on_page,cand_width);
+ commit_selection('1'+i);
+ bUpdate=true;
+ }
+ }
+ }
else if(hit_test_helper(x,y,m_indicator_rect)){
//switch between English/Chinese mode
m_bEnglishMode=!m_bEnglishMode;
bUpdate=true;
+ }else if(hit_test_helper(x,y,m_kbdbtn_rect)) {
+ QPoint p=pos();
+ m_bShowKeyboard=!m_bShowKeyboard;
+ adjustSize();
+ if(m_bShowKeyboard) {
+ p.setY(p.y()-65);
+ move(p);
+ }else{
+ p.setY(p.y()+65);
+ move(p);
+ }
+ Global::hideInputMethod();
+ Global::showInputMethod();
+ }
+ else if(m_bShowKeyboard&&hit_test_helper(x,y,m_kbd_rect)) {
+ if(pressTid==0)
+ clearHighlight();
+ #if defined(Q_WS_QWS)|| defined(_WS_QWS_)
+ if(unicode!=-1) {
+ emit key(unicode,qkeycode,modifiers,false,false);
+ repeatTimer->stop();
+ }
+ #endif
+ pressed = FALSE;
}
if(bUpdate){
+ //update();
+ //repaint(m_cand_rect);
+ repaint(0,0,m_cand_rect.right(),m_cand_rect.bottom());
}
}
****************** 611,616 **** qwsServer->sendKeyEvent ( u , c, 0, true, false);
qwsServer->sendKeyEvent ( u , c, 0, false, false);
}
/*
* Revision history
*
--- 713,1381 ---- qwsServer->sendKeyEvent ( u , c, 0, true, false);
qwsServer->sendKeyEvent ( u , c, 0, false, false);
}
+
+ //PC keyboard layout and scancodes
+
+ /*
+ Format: length, code, length, code, ..., 0
+
+ length is measured in half the width of a standard key.
+ If code < 0x80, code gives the ASCII value of the key
+
+ If code >= 0x80, the key is looked up in specialM[].
+
+ */
+
+ static const uchar * const keyboard_opti[5] = {
+ (const uchar *const) "\001\223\003\240\002\20\002\41\002\26\002\62\002\56\002\45\002\54\003\200\001\223\002\226\002\235\002\234\002\236",
+ (const uchar *const) "\001\223\003\201\004\207\002\30\002\24\002\43\004\207\003\203\001\223\006\002\002\065",
+ (const uchar *const) "\001\223\003\202\002\60\002\37\002\23\002\22\002\36\002\21\002\55\003\203\001\223\006\005\002\055",
+ (const uchar *const) "\001\223\003\205\004\207\002\27\002\61\002\40\004\207\003\204\001\223\006\010\002\014",
+ (const uchar *const) "\001\223\003\206\002\44\002\31\002\57\002\42\002\46\002\25\002\207\003\204\001\223\002\013\002\064\002\015\002\230"
+ };
+
+
+ static const uchar * const keyboard_standard[5] = {
+
+ #ifdef USE_SMALL_BACKSPACE
+ (const uchar *const)"\002\240\002`\0021\0022\0023\0024\0025\0026\0027\0028\0029\0020\002-\002=\002\200\002\223\002\215\002\216\002\217",
+ #else
+ (const uchar *const)"\002\051\0021\0022\0023\0024\0025\0026\0027\0028\0029\0020\002-\002=\004\200\002\223\002\215\002\216\002\217",
+ #endif
+ //~ + 123...+ BACKSPACE //+ INSERT + HOME + PGUP
+
+ (const uchar *const)"\003\201\002q\002w\002e\002r\002t\002y\002u\002i\002o\002p\002[\002]\002\\\001\224\002\223\002\221\002\220\002\222",
+ //TAB + qwerty.. + backslash //+ DEL + END + PGDN
+
+ (const uchar *const)"\004\202\002a\002s\002d\002f\002g\002h\002j\002k\002l\002;\002'\004\203",
+ //CAPS + asdf.. + RETURN
+
+ (const uchar *const)"\005\204\002z\002x\002c\002v\002b\002n\002m\002,\002.\002/\005\204\002\223\002\223\002\211",
+ //SHIFT + zxcv... //+ UP
+
+ (const uchar *const)"\003\205\003\206\022\207\003\206\003\205\002\223\002\212\002\213\002\214"
+ //CTRL + ALT + SPACE //+ LEFT + DOWN + RIGHT
+
+ };
+
+
+ struct ShiftMap {
+ char normal;
+ char shifted;
+ };
+
+
+ static const ShiftMap shiftMap[] = {
+ { '`', '~' },
+ { '1', '!' },
+ { '2', '@' },
+ { '3', '#' },
+ { '4', '$' },
+ { '5', '%' },
+ { '6', '^' },
+ { '7', '&' },
+ { '8', '*' },
+ { '9', '(' },
+ { '0', ')' },
+ { '-', '_' },
+ { '=', '+' },
+ { '\\', '|' },
+ { '[', '{' },
+ { ']', '}' },
+ { ';', ':' },
+ { '\'', '"' },
+ { ',', '<' },
+ { '.', '>' },
+ { '/', '?' }
+ };
+
+
+ /* XPM */
+ static const char * const uparrow_xpm[]={
+ "9 9 2 1",
+ "a c #000000",
+ ". c None",
+ ".........",
+ "....a....",
+ "...aaa...",
+ "..aaaaa..",
+ "....a....",
+ "....a....",
+ "....a....",
+ "....a....",
+ "........."};
+ /* XPM */
+ static const char * const leftarrow_xpm[]={
+ "9 9 2 1",
+ "a c #000000",
+ ". c None",
+ ".........",
+ ".........",
+ "...a.....",
+ "..aa.....",
+ ".aaaaaaa.",
+ "..aa.....",
+ "...a.....",
+ ".........",
+ "........."};
+ /* XPM */
+ static const char * const downarrow_xpm[]={
+ "9 9 2 1",
+ "a c #000000",
+ ". c None",
+ ".........",
+ "....a....",
+ "....a....",
+ "....a....",
+ "....a....",
+ "..aaaaa..",
+ "...aaa...",
+ "....a....",
+ "........."};
+ /* XPM */
+ static const char * const rightarrow_xpm[]={
+ "9 9 2 1",
+ "a c #000000",
+ ". c None",
+ ".........",
+ ".........",
+ ".....a...",
+ ".....aa..",
+ ".aaaaaaa.",
+ ".....aa..",
+ ".....a...",
+ ".........",
+ "........."};
+ /* XPM */
+ static const char * const insert_xpm[]={
+ "9 9 2 1",
+ "a c #000000",
+ ". c None",
+ ".........",
+ "a........",
+ "a.aaa.aaa",
+ "a.a.a.a..",
+ "a.a.a..a.",
+ "a.a.a...a",
+ "a.a.a.aaa",
+ ".........",
+ "........."};
+ /* XPM */
+ static const char * const delete_xpm[]={
+ "9 9 2 1",
+ "a c #000000",
+ ". c None",
+ ".........",
+ "aa......a",
+ "a.a.aaa.a",
+ "a.a.a.a.a",
+ "a.a.aaa.a.",
+ "a.a.a...a",
+ "aaa.aaa.a",
+ ".........",
+ "........."};
+ /* XPM */
+ static const char * const home_xpm[]={
+ "9 9 2 1",
+ "a c #000000",
+ ". c None",
+ "....a....",
+ "...a.a...",
+ "..a...a..",
+ ".a.....a.",
+ "aa.aaa.aa",
+ ".a.a.a.a.",
+ ".a.a.a.a.",
+ ".aaaaaaa.",
+ "........."};
+ /* XPM */
+ static const char * const end_xpm[]={
+ "10 9 2 1",
+ "a c #000000",
+ ". c None",
+ "..........",
+ "aa.......a",
+ "a..aaa.aaa",
+ "aa.a.a.a.a",
+ "a..a.a.a.a",
+ "a..a.a.a.a",
+ "aa.a.a.aaa",
+ "..........",
+ ".........."};
+ /* XPM */
+ static const char * const pageup_xpm[]={
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -