亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? pinyinframe.cpp

?? 嵌入式Linux上的拼音輸入法
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
/**********************************************************************
** Copyright (C) 2004 MurphyTalk
**
** This file is part of the MurphyTalk PinYin Chinese input method,
** which is for the Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
**
** murphytalk@gmail.com
** $Date: 2004/07/31 17:20:19 $
**
**********************************************************************/
#include "PinyinFrame.h"

#include <qpe/global.h>

#include <qpainter.h>
#include <qlist.h>
#include <qbitmap.h>
#include <qlayout.h>
#include <qvbox.h>
#include <qhbuttongroup.h>
#include <qpushbutton.h>
#include <qmessagebox.h>
#include <qcolor.h> 
#include <qpen.h>
#include <qwindowsystem_qws.h>
#include <qpe/qpeapplication.h>
#include <qnamespace.h>

#include "public.h"
#include "Config.h"

const char table_file[]=
#ifdef X86
"/root/pinyin_table.txt";
#else
"/home/zaurus/.murphytalk/pinyin_table.txt";
#endif

const char phrase_index_file[]=
#ifdef X86
"/root/murphytalk_phrase_idx.txt";
#else
"/home/zaurus/.murphytalk/murphytalk_phrase_idx.txt";
#endif

const char config_file[]=
#ifdef X86
"/root/murphytalk.conf";
#else
"/etc/murphytalk.conf";
#endif


/* XPM */
static const char * pix_prev[] = {
"16 13 3 1",
" 	c #C0C0C0C0C0C0",
"#	c #000000000000",
".	c #00000000FFFF",
"          #     ",
"         ##     ",
"        #.#     ",
"       #..#     ",
"      #...#     ",
"     #....#     ",
"    #.....#     ",
"     #....#     ",
"      #...#     ",
"       #..#     ",
"        #.#     ",
"         ##     ",
"          #     "};

static const char * pix_next[] = {
"16 13 3 1",
" 	c #C0C0C0C0C0C0",
"#	c #000000000000",
".	c #00000000FFFF",
"     #          ",
"     ##         ",
"     #.#        ",
"     #..#       ",
"     #...#      ",
"     #....#     ",
"     #.....#    ",
"     #....#     ",
"     #...#      ",
"     #..#       ",
"     #.#        ",
"     ##         ",
"     #          "};

const int PINYIN_X = 2;
const int PINYIN_Y = 2;

const unsigned short ZHONG = 0x4e2d;   //Hanzi : Chinese 
const unsigned short YING  = 0x82f1;   //Hanzi : English

const char ABOUT[]="About";

const char MAKEPHRASE_OPEN [] = "\xe3\x80\x90\xe9\x80\xa0\xe8\xaf\x8d\x20";
const char MAKEPHRASE_CLOSE[] = "\xe3\x80\x91";

//the following marks encoded in ucs-2(unicode 16 big endian)
const int COMMA_MARK	=0xff0c;
const int PERIOD_MARK	=0x3002;
const int BOOK_MARK1	=0x300a;
const int BOOK_MARK2	=0x300b;
const int QUESTION_MARK	=0xff1f;
const int COLON_MARK	=0xff1a;

QPinyinFrame::QPinyinFrame(QWidget* parent, const char* name, WFlags f) :
	QFrame(parent,name,f),m_engine(table_file,phrase_index_file),
	m_bEnglishMode(false),m_bMakingPhrase(false)
{
	(new QHBoxLayout(this))->setAutoAdd(TRUE);
	QPEApplication::grabKeyboard(); 
	qwsServer->setKeyboardFilter (this);

	Config config(config_file);

	String font_name=config.get_as_string("font");
	int    font_size=config.get_as_int("font-size");

	printX86("from config -> font=%s\n",font_name.c_str());
	printX86("from config -> font-size=%d\n",font_size);

	if(font_name.size()>0){
		if(font_size<=0){
			font_size=font().pointSize();
		}
		setFont(QFont(font_name.c_str(),font_size));
	}	
}

QPinyinFrame::~QPinyinFrame()
{
	printX86("ime killed\n");	
	QPEApplication::ungrabKeyboard(); 
}

QSize QPinyinFrame::sizeHint() const
{
	QPinyinFrame *This=const_cast<QPinyinFrame*>(this);
	int height=This->init_gui_dimention();
	return QSize(maximumWidth(), height);
}

/*
 * return frame height
 */
int QPinyinFrame::init_gui_dimention()
{
	static int sHeight = -1;

	if(sHeight>0)      return sHeight;

#if 0
	QPixmap next((const char **)pix_next);
	printX86("direction pix (%d,%d)\n",next.width(),next.height());
#endif
	const int pix_width=16,pix_height=13;

	QPainter painter(this);	
	QFontMetrics metric=painter.fontMetrics();
	QRect rect = metric.boundingRect(QChar(ZHONG));

	int width=640;
	printX86("text metric is %d,%d\n",rect.width(),rect.height());

	int x=PINYIN_X;
	int y=PINYIN_Y;
	painter.drawText(x,rect.height(),QChar(m_bEnglishMode?YING:ZHONG));
       	m_indicator_rect=QRect(x,y,rect.width(),rect.height());
	printX86("indicator rect(%d,%d,%d,%d)\n",m_indicator_rect.left(),m_indicator_rect.top(),m_indicator_rect.width(),m_indicator_rect.height());

	//horizonal line which seperates pinyin and hanzi candidates
	y+=rect.height()+2;
	QRect about = metric.boundingRect(QString(ABOUT));
	m_about_rect = QRect(width-2-about.width(),PINYIN_Y,about.width(),about.height());
	printX86("about rect(%d,%d,%d,%d)\n",m_about_rect.left(),m_about_rect.top(),m_about_rect.width(),m_about_rect.height());

	///////////////////////////////////////////////
	//the second row --  hanzi candicates
	y+=2;

	m_leftbtn_rect=QRect(x,y+2,pix_width,pix_height);		
	printX86("left btn rect(%d,%d,%d,%d)\n",m_leftbtn_rect.left(),m_leftbtn_rect.top(),m_leftbtn_rect.width(),
		       m_leftbtn_rect.height());

	m_rightbtn_rect=QRect(width-2-pix_width,y+2,pix_width,pix_height);		
	printX86("right btn rect(%d,%d,%d,%d)\n",m_rightbtn_rect.left(),m_rightbtn_rect.top(),m_rightbtn_rect.width(),
		       m_rightbtn_rect.height());

	sHeight=y+rect.height()+5;

	return sHeight;
}

bool QPinyinFrame::filter (int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat)
{   
	if (!isHidden()&& isPress) {
		if(m_bEnglishMode){
			if(unicode == 9 && keycode == Qt::Key_Tab){
				m_bEnglishMode = false;
				update();			
			}
			else{
				SendKey(unicode,keycode); 
			}
			return true;		
		}

		if (GetKey (unicode, keycode))
			return true;
		else
			return false;
	} 
	else
		return false;
}   

void QPinyinFrame::paintEvent(QPaintEvent * e)
{
	QFrame::paintEvent(e);
	
	QPainter painter(this);
	painter.setClipRect (e->rect ());

	//FIXME: how to get screen size
	unsigned int width  = 640;

	///////////////////////////////////////////////
	//the first row - pinyin inputed 

	QFontMetrics metric=painter.fontMetrics();
	QRect rect = metric.boundingRect(QChar(ZHONG));

	int x=PINYIN_X;
	int y=PINYIN_Y;
	painter.drawText(x,rect.height(),QChar(m_bEnglishMode?YING:ZHONG));

	QPen penGray (QColor(128,128,128));
	QPen penWhite(QColor(255,255,255));
	QPen penText (QColor(0,0,0));
	QPen penPage (QColor(0,0,255));

	//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);
	painter.drawLine(x+rect.width()+3,y,x+rect.width()+3,y+rect.height());

	//making phrase?
	int X=x+rect.width()+7;
	int Y=rect.height();
	if(m_bMakingPhrase){
		QRect temp;

	        QString s=QString::fromUtf8(MAKEPHRASE_OPEN);
		painter.setPen(penText);
		painter.drawText(X,Y,s);
		temp = metric.boundingRect(s);
		X+=temp.width();

		painter.setPen(penPage);
		painter.drawText(X,Y,m_ime_info.phrase);
		temp = metric.boundingRect(m_ime_info.phrase);
		X+=temp.width();

		s=QString::fromUtf8(MAKEPHRASE_CLOSE);
		painter.setPen(penText);
		painter.drawText(X,Y,s);			
		temp = metric.boundingRect(s);
		X+=temp.width()+2;
	}
	//pinyin inputed by user
	painter.setPen(penText);
	painter.drawText(X,Y,QString(m_engine.get_formatted_pinyin().c_str()));

	//horizonal line which seperates pinyin and hanzi candidates
	y+=rect.height()+2;
	painter.setPen(penGray);
	painter.drawLine(x,y,x+width,y);
	painter.setPen(penWhite);
	painter.drawLine(x,y+1,x+width,y+1);


	//about
	painter.setPen(penPage);
	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
	y+=2;

	//horizonal line at the bottom
	Y=y+rect.height();
	painter.setPen(penWhite);
	painter.drawLine(x,Y,x+width,Y);

	if(m_ime_info.prev_page_available()){
		QPixmap prev((const char **)pix_prev);
		painter.drawPixmap(x,y+2,prev);
		x+=prev.width()+2;
	}

	//hanzi candidates
	
	m_ime_info.candidates_on_page=0;	
	QString str;
	QRect hanzi;
	painter.setPen(penText);
	for(unsigned int i=m_ime_info.first_visible,xx=x,yy=Y-3;m_ime_info.candidates_on_page<10&&i<m_ime_info.candidates_count;i++){
		str.sprintf("%d.",(i-m_ime_info.first_visible+1)%10);//1. 2. ... 9. 0.
     		if(m_engine.isPhrase()){
			str+=get_phrase(i);
		}
		else{
			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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产欧美日韩在线视频| 欧美a级理论片| 日韩视频免费直播| 日本韩国视频一区二区| 国产精品一二一区| 蜜桃av一区二区在线观看| 三级在线观看一区二区| 亚洲精品网站在线观看| 国产精品久久免费看| 精品国产免费一区二区三区香蕉| 北条麻妃一区二区三区| 国产一区二区三区久久久| 午夜久久久久久电影| 一区二区欧美视频| 久久网站热最新地址| 日韩欧美国产一区二区在线播放 | 9191精品国产综合久久久久久 | 久久精品夜夜夜夜久久| 日韩一区二区三区三四区视频在线观看| av欧美精品.com| av午夜一区麻豆| jlzzjlzz亚洲日本少妇| 色视频一区二区| 在线亚洲一区观看| 欧美网站一区二区| 日韩三级在线免费观看| 日韩一级完整毛片| 欧美一区永久视频免费观看| 欧美一区二区在线视频| 欧美哺乳videos| 久久丝袜美腿综合| 国产精品国产精品国产专区不片| 中文字幕一区二区在线观看| 亚洲男人天堂av| 婷婷亚洲久悠悠色悠在线播放| 人人爽香蕉精品| 国产精品乡下勾搭老头1| 成人h动漫精品一区二区| 成人av免费在线观看| 在线精品视频小说1| 欧美一区二区视频在线观看2022 | 国产成人自拍高清视频在线免费播放| 久久精品国产一区二区| 免费看日韩a级影片| 国产在线观看一区二区| 色一区在线观看| 精品人伦一区二区色婷婷| 国产日韩影视精品| 亚洲h动漫在线| 国产成人一区在线| 欧美视频一区在线观看| 国产婷婷色一区二区三区| 一区二区三区加勒比av| 韩国一区二区三区| 欧美色视频在线观看| 国产日韩欧美精品一区| 五月综合激情婷婷六月色窝| 成人免费av资源| 欧美精选一区二区| 欧美变态tickling挠脚心| 中文字幕一区二区三| 精品一区二区在线视频| 色菇凉天天综合网| 久久久久久日产精品| 亚洲成人综合视频| 成人国产精品免费观看视频| 日韩精品一区二区三区视频在线观看 | 奇米777欧美一区二区| 色综合天天综合网天天看片| 欧美精品一区二区三区久久久| 亚洲综合免费观看高清完整版| 免费人成精品欧美精品| 欧美亚洲日本一区| 亚洲日本一区二区三区| 久久精品国产999大香线蕉| 欧美三级视频在线观看| 亚洲欧美色图小说| 顶级嫩模精品视频在线看| 日韩情涩欧美日韩视频| 日韩av一区二区三区四区| 欧美在线免费观看亚洲| 久久久91精品国产一区二区三区| 天天色天天爱天天射综合| 在线观看国产日韩| 亚洲人成7777| 91免费看`日韩一区二区| 欧美国产精品中文字幕| 国产米奇在线777精品观看| 精品国产a毛片| 亚洲成人久久影院| 欧美日本在线看| 午夜欧美电影在线观看| 欧美日韩日日夜夜| 午夜精品一区在线观看| 9191成人精品久久| 综合久久国产九一剧情麻豆| 99久久国产免费看| 一区二区三区久久| 91亚洲午夜精品久久久久久| 亚洲精品第1页| 欧美日韩免费一区二区三区视频| 香蕉乱码成人久久天堂爱免费| 欧美精品第1页| 一区二区三区在线观看国产| 在线观看亚洲a| 免费视频最近日韩| 亚洲国产精品成人久久综合一区| 99麻豆久久久国产精品免费| 亚洲精选一二三| 制服丝袜日韩国产| 国产美女视频一区| 亚洲免费资源在线播放| 在线播放亚洲一区| 国产一区二区美女诱惑| 亚洲视频狠狠干| 在线精品亚洲一区二区不卡| 五月激情六月综合| 精品入口麻豆88视频| 色综合中文综合网| 久久国产精品色| 国产欧美综合在线观看第十页| 一本到高清视频免费精品| 亚洲国产另类av| 91麻豆精品国产91久久久资源速度 | 国产精品国产三级国产有无不卡| 91影院在线免费观看| 蜜桃久久精品一区二区| 久久久久久久一区| 91成人国产精品| 国产一区二区三区黄视频| 亚洲色图在线播放| 久久综合色婷婷| 欧美在线观看一区| 国产一区二区不卡老阿姨| 亚洲综合区在线| 国产精品麻豆视频| 精品国一区二区三区| 色综合天天综合狠狠| 天天影视色香欲综合网老头| 国产精品丝袜91| 精品国内二区三区| 欧美精品久久99| 色综合中文综合网| 粉嫩av一区二区三区粉嫩| 亚洲电影激情视频网站| 综合久久国产九一剧情麻豆| 久久毛片高清国产| 日韩精品一区二区在线观看| 日韩视频在线你懂得| 欧美一级在线免费| 欧美日本在线观看| 欧美高清精品3d| 欧美乱妇15p| 日韩免费视频一区二区| 欧美高清www午色夜在线视频| 欧美日韩国产中文| 欧美一级艳片视频免费观看| 538在线一区二区精品国产| 欧美久久一二三四区| 欧美一卡二卡三卡| 久久女同性恋中文字幕| 中文字幕av免费专区久久| 亚洲欧洲成人自拍| 亚洲精品视频观看| 偷窥国产亚洲免费视频| 久久91精品国产91久久小草| 国产一区美女在线| 国产一区二区h| 91蜜桃视频在线| 欧美日韩高清影院| 精品福利在线导航| 国产精品久久久久久久午夜片| 亚洲美女区一区| 日本不卡免费在线视频| 成人午夜激情影院| 色噜噜狠狠成人中文综合| 欧美久久久久中文字幕| 久久天天做天天爱综合色| 亚洲欧美综合另类在线卡通| 一区二区免费在线| 国内国产精品久久| 91网址在线看| 精品盗摄一区二区三区| 亚洲天堂久久久久久久| 日韩高清在线电影| 成a人片亚洲日本久久| 欧美色网站导航| 国产日韩欧美高清| 日韩中文字幕1| 99久久99久久免费精品蜜臀| 制服.丝袜.亚洲.另类.中文 | 欧美三级电影网| 26uuu成人网一区二区三区| 亚洲欧美激情插| 精品综合久久久久久8888| 色综合久久久网| 久久精品一区四区| 蜜臀av性久久久久蜜臀av麻豆| 91麻豆自制传媒国产之光| 欧美成人乱码一区二区三区|