⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 murphytalk-patch

📁 对MurphyPinyin的改进版
💻
📖 第 1 页 / 共 3 页
字号:
 	else{
@@ -529,7 +587,8 @@ 	
 
 	if(bUpdate){
-		update();
+		//update();
+		repaint(0,0,m_cand_rect.right(),m_cand_rect.bottom());
 	}
 	
 	if(!bKeyProcessed){
@@ -552,6 +611,7 @@ 	QFrame::hide ();
 	QPEApplication::ungrabKeyboard(); 
 	resetState();
+	sched_yield();
 	m_engine.save_table();	
 	//qwsServer->setKeyboardFilter (NULL);
 }
@@ -573,6 +633,7 @@ 	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,21 +645,62 @@ 					 "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_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();
+		//update();
+		//repaint(m_cand_rect);
+		repaint(0,0,m_cand_rect.right(),m_cand_rect.bottom());
 	}
 }
 
@@ -611,6 +713,669 @@ 	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[]={
+"9 9 2 1",
+"a c #000000",
+". c None",
+".aaa.aaa.",
+".a.a.a.a.",
+".aaa..aa.",
+".a...aaa.",
+".........",
+".a.a.aaa.",
+".a.a.a.a.",
+".aaa.aaa.",
+".....a..."};
+/* XPM */
+static const char * const pagedown_xpm[]={
+"9 9 2 1",
+"a c #000000",
+". c None",
+".aaa.aaa.",
+".a.a.a.a.",
+".aaa..aa.",
+".a...aaa.",
+".........",
+"...a.....",
+".aaa.aaa.",
+".a.a.a.a.",
+".aaa.a.a."};
+/* XPM */
+static const char * const expand_xpm[]={
+"4 9 2 1",
+"a c #408040",
+". c None",
+"a...",
+"aa..",
+"aaa.",
+"aaaa",
+"aaaa",
+"aaaa",
+"aaa.",
+"aa..",
+"a..."};
+/* XPM */
+#ifdef USE_SMALL_BACKSPACE
+static const char * const backspace_xpm[]={
+"9 9 2 1",
+"a c #000000",
+". c None",
+".........",
+".........",
+"...a.....",
+"..aa.....",
+".aaaaaaaa",
+"..aa.....",
+"...a.....",
+".........",
+"........."};
+#else
+static const char * const backspace_xpm[]={
+"21 9 2 1",
+"a c #000000",
+". c None",
+".....................",
+".....................",
+".....aaa..a..........",
+".a...a..a.a.a.aaa.aaa",
+"aaaa.aaa..aa..aa..a.a",
+".a...a..a.aaa..aa.a.a",
+".....aaaa.a.a.aaa.aa.",
+"..................a..",
+"....................."};
+#endif
+/* XPM */
+static const char * const escape_xpm[]={
+"9 9 2 1",
+"a c #000000",
+". c None",
+".........",
+".........",
+".aa.aa.aa",
+".a..a..a.",
+".aa.aa.a.",
+".a...a.a.",
+".aa.aa.aa",
+".........",
+"........."};
+
+
+enum { BSCode = 0x80, TabCode, CapsCode, RetCode, 
+       ShiftCode, CtrlCode, AltCode, SpaceCode, BackSlash,
+       UpCode, LeftCode, DownCode, RightCode, Blank, Expand,
+       Opti, ResetDict,
+       Divide, Multiply, Add, Subtract, Decimal, Equal,
+       Percent, Sqrt, Inverse, Escape };
+
+typedef struct SpecialMap {
+    int qcode;
+    ushort unicode;
+    const char * label;
+    const char * const *xpm;
+};
+
+
+static const SpecialMap specialM[] = {
+    {	Qt::Key_Backspace,	8,	"<",     backspace_xpm },
+    {	Qt::Key_Tab,		9,	"Tab",   NULL }, // No tr
+    {	Qt::Key_CapsLock,	0xffff,	"Caps",  NULL }, // No tr
+    {	Qt::Key_Return,		13,	"Ret",   NULL }, // No tr
+    {	Qt::Key_Shift,		0xffff,	"Shift", NULL }, // No tr
+    {	Qt::Key_Control,	0xffff,	"Ctrl",  NULL }, // No tr
+    {	Qt::Key_Alt,		0xffff,	"Alt",   NULL }, // No tr
+    {	Qt::Key_Space,		' ',	"",      NULL },
+    {	BackSlash,		43,	"\\",    NULL },
+
+    // Need images?
+    {	Qt::Key_Up,		0xffff,	"^",     uparrow_xpm },
+    {	Qt::Key_Left,		0xffff,	"<",     leftarrow_xpm },
+    {	Qt::Key_Down,		0xffff,	"v",     downarrow_xpm },
+    {	Qt::Key_Right,		0xffff,	">",     rightarrow_xpm },
+    {	Qt::Key_Insert,		0xffff,	"I",     insert_xpm },
+    {	Qt::Key_Home,		0xffff,	"H",     home_xpm },
+    {	Qt::Key_PageUp,		0xffff,	"U",     pageup_xpm },
+    {	Qt::Key_End,		0xffff,	"E",     end_xpm },
+    {	Qt::Key_Delete,		0xffff,	"X",     delete_xpm },
+    {	Qt::Key_PageDown,	0xffff,	"D",     pagedown_xpm },
+    {	Blank,			0,	" ",     NULL },
+    {	Expand,			0xffff,	"->",    expand_xpm },
+    {	Opti,			0xffff,	"#",     NULL },
+    {	ResetDict,		0xffff,	"R",     NULL },
+   
+    // number pad stuff
+    {	Divide,			0,	"/",     NULL },
+    {	Multiply,		0,	"*",     NULL },
+    {	Add,			0,	"+",     NULL },
+    {	Subtract,		0,	"-",     NULL },
+    {	Decimal,		0,	".",     NULL },
+    {	Equal,			0,	"=",     NULL },
+    {	Percent,		0,	"%",     NULL },
+    {	Sqrt,			0,	"^1/2",	 NULL },
+    {	Inverse,		0,	"1/x",	 NULL },
+
+    {	Escape,			27,	"ESC",	 escape_xpm }
+};
+
+
+/*
+  return scancode and width of first key in row \a j if \a j >= 0,
+  or next key on current row if \a j < 0.
+  
+*/
+int useOptiKeys=0;
+int getKey( int &w, int j ) {
+    static const uchar *row = 0;
+    static int key_i = 0;
+    static int scancode = 0;
+    static int half = 0;
+    
+    if ( j >= 0 && j < 5 ) {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -