diff --git a/honoka/configure.ac b/honoka/configure.ac index e65e9e1..143f7dd 100644 --- a/honoka/configure.ac +++ b/honoka/configure.ac @@ -1,21 +1,21 @@ # Process this file with autoconf to produce a configure script. -AC_INIT(scim-wnn, 0.3.0, tam-t@par.odn.ne.jp) -AC_CONFIG_SRCDIR([src/scim_wnn_imengine.h]) +AC_INIT(honoka, 0.3.0, tam-t@par.odn.ne.jp) +AC_CONFIG_SRCDIR([src/honoka_imengine.h]) # Save this value here, since automake will set cflags and cxxflags later cflags_set=${CFLAGS+set} cppflags_set=${CPPFLAGS+set} -SCIM_WNN_MAJOR_VERSION=0 -SCIM_WNN_MINOR_VERSION=3 -SCIM_WNN_MICRO_VERSION=0 +HONOKA_MAJOR_VERSION=0 +HONOKA_MINOR_VERSION=3 +HONOKA_MICRO_VERSION=0 -SCIM_WNN_VERSION=$SCIM_WNN_MAJOR_VERSION.$SCIM_WNN_MINOR_VERSION.$SCIM_WNN_MICRO_VERSION +HONOKA_VERSION=$HONOKA_MAJOR_VERSION.$HONOKA_MINOR_VERSION.$HONOKA_MICRO_VERSION -AC_SUBST(SCIM_WNN_MAJOR_VERSION) -AC_SUBST(SCIM_WNN_MINOR_VERSION) -AC_SUBST(SCIM_WNN_MICRO_VERSION) -AC_SUBST(SCIM_WNN_VERSION) +AC_SUBST(HONOKA_MAJOR_VERSION) +AC_SUBST(HONOKA_MINOR_VERSION) +AC_SUBST(HONOKA_MICRO_VERSION) +AC_SUBST(HONOKA_VERSION) # Init automake stuff AM_INIT_AUTOMAKE @@ -25,7 +25,7 @@ ALL_LINGUAS="ja" AM_GNU_GETTEXT -GETTEXT_PACKAGE=scim-wnn +GETTEXT_PACKAGE=honoka AC_SUBST(GETTEXT_PACKAGE) AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [The gettext domain]) diff --git a/honoka/data/Makefile.am b/honoka/data/Makefile.am index dd159d1..c16b2ec 100644 --- a/honoka/data/Makefile.am +++ b/honoka/data/Makefile.am @@ -1,7 +1,7 @@ MAINTAINERCLEANFILES = Makefile.in icondir = $(SCIM_ICONDIR) -icon_DATA = scim-wnn.png -tabledir = $(SCIM_DATADIR)/scim-wnn -table_DATA = scim-wnn-def.rkt like-msime.rkt kigou-def.rkt +icon_DATA = honoka.png +tabledir = $(SCIM_DATADIR)/honoka +table_DATA = honoka-def.rkt like-msime.rkt kigou-def.rkt EXTRA_DIST = $(icon_DATA) $(table_DATA) diff --git a/honoka/data/honoka-def.rkt b/honoka/data/honoka-def.rkt new file mode 100644 index 0000000..052aa7b --- /dev/null +++ b/honoka/data/honoka-def.rkt @@ -0,0 +1,350 @@ +# utf8 +# 「nn」を「ん」に変換するかどうか。 +$nnMode false +# ローマ字変換できなかった英字を捨てるかどうか。 +$RemoveRemainder false +# Ascii/WideAsciiモードでキャンセルキーによる離脱を有効にするか。 +$AsciiModeCancel true +# Ascii/WideAsciiモードへの移行キー。 +$Key/Ascii q +$Key/WideAscii Shift+Q +# フックを使う +$Hook Z +# 特殊キー +#!Control+Up ↑ +#!Control+Down ↓ +#!Control+Left ← +#!Control+Right → + +a あ +i い +u う +e え +o お +ka か +ki き +ku く +ke け +ko こ +sa さ +si し +su す +se せ +so そ +ta た +ti ち +tu つ +te て +to と +na な +ni に +nu ぬ +ne ね +no の +ha は +hi ひ +hu ふ +he へ +ho ほ +ma ま +mi み +mu む +me め +mo も +ya や +yi い +yu ゆ +ye いぇ +yo よ +ra ら +ri り +ru る +re れ +ro ろ +la ら +li り +lu る +le れ +lo ろ +wa わ +wi ゐ +wu う +we ゑ +wo を +nn ん +N ん +xa ぁ +xi ぃ +xu ぅ +xe ぇ +xo ぉ +xtu っ +xya ゃ +xyu ゅ +xyo ょ +ga が +gi ぎ +gu ぐ +ge げ +go ご +za ざ +zi じ +zu ず +ze ぜ +zo ぞ +da だ +di ぢ +du づ +de で +do ど +ba ば +bi び +bu ぶ +be べ +bo ぼ +pa ぱ +pi ぴ +pu ぷ +pe ぺ +po ぽ +kya きゃ +kyi きぃ +kyu きゅ +kye きぇ +kyo きょ +sya しゃ +syi し +syu しゅ +sye しぇ +syo しょ +sha しゃ +shi し +shu しゅ +she しぇ +sho しょ +cha ちゃ +chi ち +chu ちゅ +che ちぇ +cho ちょ +tya ちゃ +tyi てぃ +tyu ちゅ +tye ちぇ +tyo ちょ +dya ぢゃ +dyi でぃ +dyu ぢゅ +dye ぢぇ +dyo ぢょ +va ヴぁ +vi ヴぃ +vu ヴ +ve ヴぇ +vo ヴぉ +zya じゃ +zyi じぃ +zyu じゅ +zye じぇ +zyo じょ +ja じゃ +ji じ +ju じゅ +je じぇ +jo じょ +fa ふぁ +fi ふぃ +fu ふ +fe ふぇ +fo ふぉ +hya ひゃ +hyi ひぃ +hyu ひゅ +hye ひぇ +hyo ひょ +rya りゃ +ryi りぃ +ryu りゅ +rye りぇ +ryo りょ +nya にゃ +nyi にぃ +nyu にゅ +nye にぇ +nyo にょ +gya ぎゃ +gyi ぎぃ +gyu ぎゅ +gye ぎぇ +gyo ぎょ +bya びゃ +byi びぃ +byu びゅ +bye びぇ +byo びょ +pya ぴゃ +pyi ぴぃ +pyu ぴゅ +pye ぴぇ +pyo ぴょ +mya みゃ +myi みぃ +myu みゅ +mye みぇ +myo みょ +Za a +Zb b +Zc c +Zd d +Ze e +Zf f +Zg g +Zh h +Zi i +Zj j +Zk k +Zl l +Zm m +Zn n +Zo o +Zp p +Zq q +Zr r +Zs s +Zt t +Zu u +Zv v +Zw w +Zx x +Zy y +Zz z +ZA A +ZB B +ZC C +ZD D +ZE E +ZF F +ZG G +ZH H +ZI I +ZJ J +ZK K +ZL L +ZM M +ZN N +ZO O +ZP P +ZQ Q +ZR R +ZS S +ZT T +ZU U +ZV V +ZW W +ZX X +ZY Y +ZZ Z +Z1 1 +Z2 2 +Z3 3 +Z4 4 +Z5 5 +Z6 6 +Z7 7 +Z8 8 +Z9 9 +Z0 0 + +Z^ ^ +z1 ○ +z2 ▽ +z3 △ +z4 □ +z5 ◇ +z6 ☆ +z7 ◎ +z8 ¢ +z9 ♂ +z0 ♀ +z- ~ +z^ ★ +z\\ \ +z, ‥ +z. … +z/ ・ + +- ー +[ 「 +] 」 +. 。 +, 、 +{ { +} } +@ @ +: : +; ; +? ? +< < +> > +* * ++ + +/ / +\\ ¥ + +z- ~ +z[ 『 +z] 』 +z. … +z, ‥ +z{ 〔 +z} 〕 +z@ ▼ +z: ゜ +z; ゛ +z? ∞ +z< ≦ +z> ≧ +z* × +z+ ± +z/ ・ + +Z- - +Z[ [ +Z] ] +Z. . +Z, , +Z{ { +Z} } +Z@ @ +Z: : +Z; ; +Z? ? +Z< < +Z> > +Z* * +Z+ + +Z/ / +Z\\ ¥ +Z,   + +zb ° +zc 〇 +zd ゝ +zf 〃 +zg ‐ +zh ← +zj ↓ +zk ↑ +zl → +zm ″ +zn ′ +zp 〒 +zq 《 +zr 々 +zs ヽ +zt 〆 +zv ※ +zw 》 +zx :- +Z\   # 全角スペース + diff --git a/honoka/data/honoka.png b/honoka/data/honoka.png new file mode 100644 index 0000000..6e3fc76 --- /dev/null +++ b/honoka/data/honoka.png Binary files differ diff --git a/honoka/data/scim-wnn-def.rkt b/honoka/data/scim-wnn-def.rkt deleted file mode 100644 index 052aa7b..0000000 --- a/honoka/data/scim-wnn-def.rkt +++ /dev/null @@ -1,350 +0,0 @@ -# utf8 -# 「nn」を「ん」に変換するかどうか。 -$nnMode false -# ローマ字変換できなかった英字を捨てるかどうか。 -$RemoveRemainder false -# Ascii/WideAsciiモードでキャンセルキーによる離脱を有効にするか。 -$AsciiModeCancel true -# Ascii/WideAsciiモードへの移行キー。 -$Key/Ascii q -$Key/WideAscii Shift+Q -# フックを使う -$Hook Z -# 特殊キー -#!Control+Up ↑ -#!Control+Down ↓ -#!Control+Left ← -#!Control+Right → - -a あ -i い -u う -e え -o お -ka か -ki き -ku く -ke け -ko こ -sa さ -si し -su す -se せ -so そ -ta た -ti ち -tu つ -te て -to と -na な -ni に -nu ぬ -ne ね -no の -ha は -hi ひ -hu ふ -he へ -ho ほ -ma ま -mi み -mu む -me め -mo も -ya や -yi い -yu ゆ -ye いぇ -yo よ -ra ら -ri り -ru る -re れ -ro ろ -la ら -li り -lu る -le れ -lo ろ -wa わ -wi ゐ -wu う -we ゑ -wo を -nn ん -N ん -xa ぁ -xi ぃ -xu ぅ -xe ぇ -xo ぉ -xtu っ -xya ゃ -xyu ゅ -xyo ょ -ga が -gi ぎ -gu ぐ -ge げ -go ご -za ざ -zi じ -zu ず -ze ぜ -zo ぞ -da だ -di ぢ -du づ -de で -do ど -ba ば -bi び -bu ぶ -be べ -bo ぼ -pa ぱ -pi ぴ -pu ぷ -pe ぺ -po ぽ -kya きゃ -kyi きぃ -kyu きゅ -kye きぇ -kyo きょ -sya しゃ -syi し -syu しゅ -sye しぇ -syo しょ -sha しゃ -shi し -shu しゅ -she しぇ -sho しょ -cha ちゃ -chi ち -chu ちゅ -che ちぇ -cho ちょ -tya ちゃ -tyi てぃ -tyu ちゅ -tye ちぇ -tyo ちょ -dya ぢゃ -dyi でぃ -dyu ぢゅ -dye ぢぇ -dyo ぢょ -va ヴぁ -vi ヴぃ -vu ヴ -ve ヴぇ -vo ヴぉ -zya じゃ -zyi じぃ -zyu じゅ -zye じぇ -zyo じょ -ja じゃ -ji じ -ju じゅ -je じぇ -jo じょ -fa ふぁ -fi ふぃ -fu ふ -fe ふぇ -fo ふぉ -hya ひゃ -hyi ひぃ -hyu ひゅ -hye ひぇ -hyo ひょ -rya りゃ -ryi りぃ -ryu りゅ -rye りぇ -ryo りょ -nya にゃ -nyi にぃ -nyu にゅ -nye にぇ -nyo にょ -gya ぎゃ -gyi ぎぃ -gyu ぎゅ -gye ぎぇ -gyo ぎょ -bya びゃ -byi びぃ -byu びゅ -bye びぇ -byo びょ -pya ぴゃ -pyi ぴぃ -pyu ぴゅ -pye ぴぇ -pyo ぴょ -mya みゃ -myi みぃ -myu みゅ -mye みぇ -myo みょ -Za a -Zb b -Zc c -Zd d -Ze e -Zf f -Zg g -Zh h -Zi i -Zj j -Zk k -Zl l -Zm m -Zn n -Zo o -Zp p -Zq q -Zr r -Zs s -Zt t -Zu u -Zv v -Zw w -Zx x -Zy y -Zz z -ZA A -ZB B -ZC C -ZD D -ZE E -ZF F -ZG G -ZH H -ZI I -ZJ J -ZK K -ZL L -ZM M -ZN N -ZO O -ZP P -ZQ Q -ZR R -ZS S -ZT T -ZU U -ZV V -ZW W -ZX X -ZY Y -ZZ Z -Z1 1 -Z2 2 -Z3 3 -Z4 4 -Z5 5 -Z6 6 -Z7 7 -Z8 8 -Z9 9 -Z0 0 - -Z^ ^ -z1 ○ -z2 ▽ -z3 △ -z4 □ -z5 ◇ -z6 ☆ -z7 ◎ -z8 ¢ -z9 ♂ -z0 ♀ -z- ~ -z^ ★ -z\\ \ -z, ‥ -z. … -z/ ・ - -- ー -[ 「 -] 」 -. 。 -, 、 -{ { -} } -@ @ -: : -; ; -? ? -< < -> > -* * -+ + -/ / -\\ ¥ - -z- ~ -z[ 『 -z] 』 -z. … -z, ‥ -z{ 〔 -z} 〕 -z@ ▼ -z: ゜ -z; ゛ -z? ∞ -z< ≦ -z> ≧ -z* × -z+ ± -z/ ・ - -Z- - -Z[ [ -Z] ] -Z. . -Z, , -Z{ { -Z} } -Z@ @ -Z: : -Z; ; -Z? ? -Z< < -Z> > -Z* * -Z+ + -Z/ / -Z\\ ¥ -Z,   - -zb ° -zc 〇 -zd ゝ -zf 〃 -zg ‐ -zh ← -zj ↓ -zk ↑ -zl → -zm ″ -zn ′ -zp 〒 -zq 《 -zr 々 -zs ヽ -zt 〆 -zv ※ -zw 》 -zx :- -Z\   # 全角スペース - diff --git a/honoka/data/scim-wnn.png b/honoka/data/scim-wnn.png deleted file mode 100644 index 6e3fc76..0000000 --- a/honoka/data/scim-wnn.png +++ /dev/null Binary files differ diff --git a/honoka/m4/Makefile b/honoka/m4/Makefile index b58c7ef..4dba651 100644 --- a/honoka/m4/Makefile +++ b/honoka/m4/Makefile @@ -16,9 +16,9 @@ srcdir = . top_srcdir = .. -pkgdatadir = $(datadir)/scim-wnn -pkglibdir = $(libdir)/scim-wnn -pkgincludedir = $(includedir)/scim-wnn +pkgdatadir = $(datadir)/honoka +pkglibdir = $(libdir)/honoka +pkgincludedir = $(includedir)/honoka top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = /usr/bin/install -c @@ -61,15 +61,15 @@ SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = ${SHELL} /home/tamra/ANef/scim-wnn/missing --run aclocal-1.9 +ACLOCAL = ${SHELL} /home/tamra/ANef/honoka/missing --run aclocal-1.9 ALLOCA = AMDEP_FALSE = # AMDEP_TRUE = -AMTAR = ${SHELL} /home/tamra/ANef/scim-wnn/missing --run tar +AMTAR = ${SHELL} /home/tamra/ANef/honoka/missing --run tar AR = ar -AUTOCONF = ${SHELL} /home/tamra/ANef/scim-wnn/missing --run autoconf -AUTOHEADER = ${SHELL} /home/tamra/ANef/scim-wnn/missing --run autoheader -AUTOMAKE = ${SHELL} /home/tamra/ANef/scim-wnn/missing --run automake-1.9 +AUTOCONF = ${SHELL} /home/tamra/ANef/honoka/missing --run autoconf +AUTOHEADER = ${SHELL} /home/tamra/ANef/honoka/missing --run autoheader +AUTOMAKE = ${SHELL} /home/tamra/ANef/honoka/missing --run automake-1.9 AWK = gawk BUILD_INCLUDED_LIBINTL = no CATOBJEXT = .gmo @@ -97,13 +97,17 @@ F77 = g77 FFLAGS = -g -O2 GENCAT = gencat -GETTEXT_PACKAGE = scim-wnn +GETTEXT_PACKAGE = honoka GLIBC21 = yes GMSGFMT = /usr/bin/msgfmt HAVE_ASPRINTF = 1 HAVE_POSIX_PRINTF = 1 HAVE_SNPRINTF = 1 HAVE_WPRINTF = 0 +HONOKA_MAJOR_VERSION = 0 +HONOKA_MICRO_VERSION = 0 +HONOKA_MINOR_VERSION = 3 +HONOKA_VERSION = 0.3.0 INSTALL_DATA = ${INSTALL} -m 644 INSTALL_LTDL_FALSE = INSTALL_LTDL_TRUE = # @@ -127,16 +131,16 @@ LTLIBICONV = LTLIBINTL = LTLIBOBJS = -MAKEINFO = ${SHELL} /home/tamra/ANef/scim-wnn/missing --run makeinfo +MAKEINFO = ${SHELL} /home/tamra/ANef/honoka/missing --run makeinfo MKINSTALLDIRS = $(top_builddir)/./mkinstalldirs MSGFMT = /usr/bin/msgfmt MSGMERGE = /usr/bin/msgmerge OBJEXT = o -PACKAGE = scim-wnn +PACKAGE = honoka PACKAGE_BUGREPORT = tam-t@par.odn.ne.jp -PACKAGE_NAME = scim-wnn -PACKAGE_STRING = scim-wnn 0.3.0 -PACKAGE_TARNAME = scim-wnn +PACKAGE_NAME = honoka +PACKAGE_STRING = honoka 0.3.0 +PACKAGE_TARNAME = honoka PACKAGE_VERSION = 0.3.0 PATH_SEPARATOR = : PKG_CONFIG = /usr/bin/pkg-config @@ -154,10 +158,6 @@ SCIM_LIBS = -lscim-1.0 SCIM_MODULEDIR = /usr/lib/scim-1.0 SCIM_VERSION = 1.2.0 -SCIM_WNN_MAJOR_VERSION = 0 -SCIM_WNN_MICRO_VERSION = 0 -SCIM_WNN_MINOR_VERSION = 3 -SCIM_WNN_VERSION = 0.3.0 SET_MAKE = SHELL = /bin/sh STRIP = strip @@ -196,7 +196,7 @@ host_vendor = redhat includedir = ${prefix}/include infodir = ${prefix}/info -install_sh = /home/tamra/ANef/scim-wnn/install-sh +install_sh = /home/tamra/ANef/honoka/install-sh libdir = ${exec_prefix}/lib libexecdir = ${exec_prefix}/libexec localstatedir = ${prefix}/var diff --git a/honoka/m4/Makefile.in b/honoka/m4/Makefile.in index 8e68db6..2b20a38 100644 --- a/honoka/m4/Makefile.in +++ b/honoka/m4/Makefile.in @@ -104,6 +104,10 @@ HAVE_POSIX_PRINTF = @HAVE_POSIX_PRINTF@ HAVE_SNPRINTF = @HAVE_SNPRINTF@ HAVE_WPRINTF = @HAVE_WPRINTF@ +HONOKA_MAJOR_VERSION = @HONOKA_MAJOR_VERSION@ +HONOKA_MICRO_VERSION = @HONOKA_MICRO_VERSION@ +HONOKA_MINOR_VERSION = @HONOKA_MINOR_VERSION@ +HONOKA_VERSION = @HONOKA_VERSION@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_LTDL_FALSE = @INSTALL_LTDL_FALSE@ INSTALL_LTDL_TRUE = @INSTALL_LTDL_TRUE@ @@ -154,10 +158,6 @@ SCIM_LIBS = @SCIM_LIBS@ SCIM_MODULEDIR = @SCIM_MODULEDIR@ SCIM_VERSION = @SCIM_VERSION@ -SCIM_WNN_MAJOR_VERSION = @SCIM_WNN_MAJOR_VERSION@ -SCIM_WNN_MICRO_VERSION = @SCIM_WNN_MICRO_VERSION@ -SCIM_WNN_MINOR_VERSION = @SCIM_WNN_MINOR_VERSION@ -SCIM_WNN_VERSION = @SCIM_WNN_VERSION@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ diff --git a/honoka/po/POTFILES.in b/honoka/po/POTFILES.in index cf80f20..e43d241 100644 --- a/honoka/po/POTFILES.in +++ b/honoka/po/POTFILES.in @@ -1,6 +1,6 @@ -src/scim_wnn_imengine.cpp -src/scim_wnn_imengine.h -src/scim_wnn_imengine_setup.cpp +src/honoka_imengine.cpp +src/honoka_imengine.h +src/honoka_imengine_setup.cpp src/romkan.h src/romkan.cpp src/kanainput.h diff --git a/honoka/po/honoka.pot b/honoka/po/honoka.pot new file mode 100644 index 0000000..e4b919f --- /dev/null +++ b/honoka/po/honoka.pot @@ -0,0 +1,512 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Free Software Foundation, Inc. +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2005-04-08 16:51+0900\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/honoka_imengine.cpp:85 src/honoka_imengine.cpp:92 +#: src/honoka_imengine_setup.cpp:96 +msgid "Honoka" +msgstr "" + +#: src/honoka_imengine.cpp:105 +msgid "ja_JP" +msgstr "" + +#: src/honoka_imengine.cpp:117 +msgid "(C) 2004 TAM(Teppei Tamra) " +msgstr "" + +#: src/honoka_imengine.cpp:127 +msgid "SCIM-WNN HELP" +msgstr "" + +#: src/honoka_imengine.cpp:339 +msgid "input mode" +msgstr "" + +#: src/honoka_imengine.cpp:343 src/honoka_imengine.cpp:346 +msgid "mode status" +msgstr "" + +#: src/honoka_imengine.cpp:348 +msgid "conversion mode" +msgstr "" + +#: src/honoka_imengine.cpp:359 +msgid "Kanji" +msgstr "" + +#: src/honoka_imengine.cpp:360 +msgid "Yosoku" +msgstr "" + +#: src/honoka_imengine.cpp:366 +msgid "AUTO" +msgstr "" + +#: src/honoka_imengine.cpp:367 +msgid "REN" +msgstr "" + +#: src/honoka_imengine.cpp:908 src/honoka_imengine.cpp:916 +#: src/honoka_imengine.cpp:943 src/honoka_imengine.cpp:955 +msgid "could not connect to jserver." +msgstr "" + +#: src/honoka_imengine.cpp:995 +msgid "Ikeiji lookup result" +msgstr "" + +#: src/honoka_imengine.cpp:999 +msgid "association lookup result" +msgstr "" + +#: src/honoka_imengine.cpp:1003 +msgid "yosoku lookup result" +msgstr "" + +#: src/honoka_imengine.cpp:1007 +msgid "lookup result" +msgstr "" + +#: src/honoka_imengine_setup.cpp:101 +msgid "A Honoka IMEngine Module." +msgstr "" + +#: src/honoka_imengine_setup.cpp:177 +msgid "Wnn4 or FreeWnn" +msgstr "" + +#: src/honoka_imengine_setup.cpp:182 +msgid "Wnn6" +msgstr "" + +#: src/honoka_imengine_setup.cpp:187 +msgid "Wnn7" +msgstr "" + +#: src/honoka_imengine_setup.cpp:192 +msgid "Wnn8" +msgstr "" + +#: src/honoka_imengine_setup.cpp:197 +msgid "Roma-Kana input" +msgstr "" + +#: src/honoka_imengine_setup.cpp:202 +msgid "Kana input" +msgstr "" + +#: src/honoka_imengine_setup.cpp:216 +msgid "Commit keys:" +msgstr "" + +#: src/honoka_imengine_setup.cpp:217 +msgid "Select commit keys" +msgstr "" + +#: src/honoka_imengine_setup.cpp:218 +msgid "The key events to commit the preedit string. " +msgstr "" + +#: src/honoka_imengine_setup.cpp:225 +msgid "Convert keys:" +msgstr "" + +#: src/honoka_imengine_setup.cpp:226 +msgid "Select convert keys" +msgstr "" + +#: src/honoka_imengine_setup.cpp:227 +msgid "The key events to convert the preedit string to kanji. " +msgstr "" + +#: src/honoka_imengine_setup.cpp:234 +msgid "Cancel keys:" +msgstr "" + +#: src/honoka_imengine_setup.cpp:235 +msgid "Select cancel keys" +msgstr "" + +#: src/honoka_imengine_setup.cpp:236 +msgid "The key events to cancel preediting or converting. " +msgstr "" + +#: src/honoka_imengine_setup.cpp:243 +msgid "Backspace keys:" +msgstr "" + +#: src/honoka_imengine_setup.cpp:244 +msgid "Select backspace keys" +msgstr "" + +#: src/honoka_imengine_setup.cpp:245 +msgid "The key events to delete a character before caret. " +msgstr "" + +#: src/honoka_imengine_setup.cpp:252 +msgid "Delete keys:" +msgstr "" + +#: src/honoka_imengine_setup.cpp:253 +msgid "Select delete keys" +msgstr "" + +#: src/honoka_imengine_setup.cpp:254 +msgid "The key events to delete a character after caret. " +msgstr "" + +#: src/honoka_imengine_setup.cpp:274 +msgid "Move forward keys:" +msgstr "" + +#: src/honoka_imengine_setup.cpp:275 +msgid "Select move caret forward keys" +msgstr "" + +#: src/honoka_imengine_setup.cpp:276 +msgid "The key events to move the caret to forward. " +msgstr "" + +#: src/honoka_imengine_setup.cpp:283 +msgid "Move backward keys:" +msgstr "" + +#: src/honoka_imengine_setup.cpp:284 +msgid "Select move caret backward keys" +msgstr "" + +#: src/honoka_imengine_setup.cpp:285 +msgid "The key events to move the caret to backward. " +msgstr "" + +#: src/honoka_imengine_setup.cpp:305 +msgid "Next segment keys:" +msgstr "" + +#: src/honoka_imengine_setup.cpp:306 +msgid "Select next segment keys" +msgstr "" + +#: src/honoka_imengine_setup.cpp:307 +msgid "The key events to select next segment. " +msgstr "" + +#: src/honoka_imengine_setup.cpp:314 +msgid "Previous segment keys:" +msgstr "" + +#: src/honoka_imengine_setup.cpp:315 +msgid "Select previous segment keys" +msgstr "" + +#: src/honoka_imengine_setup.cpp:316 +msgid "The key events to select previous segment. " +msgstr "" + +#: src/honoka_imengine_setup.cpp:323 +msgid "Shrink segment keys:" +msgstr "" + +#: src/honoka_imengine_setup.cpp:324 +msgid "Select shrink segment keys" +msgstr "" + +#: src/honoka_imengine_setup.cpp:325 +msgid "The key events to shrink the selected segment. " +msgstr "" + +#: src/honoka_imengine_setup.cpp:332 +msgid "Expand segment keys:" +msgstr "" + +#: src/honoka_imengine_setup.cpp:333 +msgid "Select expand segment keys" +msgstr "" + +#: src/honoka_imengine_setup.cpp:334 +msgid "The key events to expand the selected segment. " +msgstr "" + +#: src/honoka_imengine_setup.cpp:354 +msgid "Next keys:" +msgstr "" + +#: src/honoka_imengine_setup.cpp:355 +msgid "Select next candidate keys" +msgstr "" + +#: src/honoka_imengine_setup.cpp:356 +msgid "The key events to select next candidate. " +msgstr "" + +#: src/honoka_imengine_setup.cpp:363 +msgid "Previous keys:" +msgstr "" + +#: src/honoka_imengine_setup.cpp:364 +msgid "Select previous candidate keys" +msgstr "" + +#: src/honoka_imengine_setup.cpp:365 +msgid "The key events to select previous candidate. " +msgstr "" + +#: src/honoka_imengine_setup.cpp:372 +msgid "candidates list keys:" +msgstr "" + +#: src/honoka_imengine_setup.cpp:373 +msgid "Select candidates list keys" +msgstr "" + +#: src/honoka_imengine_setup.cpp:374 +msgid "The key events to popup candidates list. " +msgstr "" + +#: src/honoka_imengine_setup.cpp:381 +msgid "Page up keys:" +msgstr "" + +#: src/honoka_imengine_setup.cpp:382 +msgid "Select page up candidates keys" +msgstr "" + +#: src/honoka_imengine_setup.cpp:383 +msgid "The key events to select page up candidates. " +msgstr "" + +#: src/honoka_imengine_setup.cpp:390 +msgid "Page down keys:" +msgstr "" + +#: src/honoka_imengine_setup.cpp:391 +msgid "Select page down candidates keys" +msgstr "" + +#: src/honoka_imengine_setup.cpp:392 +msgid "The key events to select page down candidates. " +msgstr "" + +#: src/honoka_imengine_setup.cpp:412 +msgid "auto conversion mode keys:" +msgstr "" + +#: src/honoka_imengine_setup.cpp:413 +msgid "Select auto conversion mode keys" +msgstr "" + +#: src/honoka_imengine_setup.cpp:414 +msgid "The key events to change auto conversion mode. " +msgstr "" + +#: src/honoka_imengine_setup.cpp:421 +msgid "Yosoku keys:" +msgstr "" + +#: src/honoka_imengine_setup.cpp:422 +msgid "Select yosoku keys" +msgstr "" + +#: src/honoka_imengine_setup.cpp:423 +msgid "The key events to select from completion list. " +msgstr "" + +#: src/honoka_imengine_setup.cpp:430 +msgid "Convert to ikeiji keys:" +msgstr "" + +#: src/honoka_imengine_setup.cpp:431 +msgid "Select ikeiji keys" +msgstr "" + +#: src/honoka_imengine_setup.cpp:432 +msgid "The key events to convert the selected candidate to ikei-kanji. " +msgstr "" + +#: src/honoka_imengine_setup.cpp:439 +msgid "Convert to rensou keys:" +msgstr "" + +#: src/honoka_imengine_setup.cpp:440 +msgid "Select rensou keys" +msgstr "" + +#: src/honoka_imengine_setup.cpp:441 +msgid "" +"The key events to convert the selected candidate to the associated " +"acceptation string. " +msgstr "" + +#: src/honoka_imengine_setup.cpp:448 +msgid "Convert to HIRAGANA keys:" +msgstr "" + +#: src/honoka_imengine_setup.cpp:449 +msgid "Select convert to HIRAGANA keys" +msgstr "" + +#: src/honoka_imengine_setup.cpp:450 +msgid "" +"The key events to convert the selected candidate or the preedit string to " +"HIRAGANA. " +msgstr "" + +#: src/honoka_imengine_setup.cpp:457 +msgid "Convert to KATAKANA keys:" +msgstr "" + +#: src/honoka_imengine_setup.cpp:458 +msgid "Select convert to KATAGANA keys" +msgstr "" + +#: src/honoka_imengine_setup.cpp:459 +msgid "" +"The key events to convert the selected candidate or the preedit string to " +"KATAKANA. " +msgstr "" + +#: src/honoka_imengine_setup.cpp:476 +msgid "Common keys" +msgstr "" + +#: src/honoka_imengine_setup.cpp:477 +msgid "Preedit keys" +msgstr "" + +#: src/honoka_imengine_setup.cpp:478 +msgid "Candidates keys" +msgstr "" + +#: src/honoka_imengine_setup.cpp:479 +msgid "Other function keys" +msgstr "" + +#: src/honoka_imengine_setup.cpp:529 +msgid "_Server: " +msgstr "" + +#: src/honoka_imengine_setup.cpp:546 +msgid "input the server name to connect." +msgstr "" + +#: src/honoka_imengine_setup.cpp:550 +msgid "_wnnenvrc: " +msgstr "" + +#: src/honoka_imengine_setup.cpp:565 src/honoka_imengine_setup.cpp:712 +#: src/honoka_imengine_setup.cpp:792 +msgid "..." +msgstr "" + +#: src/honoka_imengine_setup.cpp:572 +msgid "input the path of wnnenvrc." +msgstr "" + +#: src/honoka_imengine_setup.cpp:575 +msgid "Server_type: " +msgstr "" + +#: src/honoka_imengine_setup.cpp:595 +msgid "select the server type from Wnn4 / Wnn6 / Wnn7." +msgstr "" + +#: src/honoka_imengine_setup.cpp:598 +msgid "Default_PreEditor: " +msgstr "" + +#: src/honoka_imengine_setup.cpp:617 +msgid "select the default preeditor." +msgstr "" + +#: src/honoka_imengine_setup.cpp:621 +msgid "_Auto candidates popup: " +msgstr "" + +#: src/honoka_imengine_setup.cpp:638 +msgid "" +"set the count of conversion until displaying the list of lookup result " +"automatically." +msgstr "" + +#: src/honoka_imengine_setup.cpp:641 +msgid "_NumKey selection: " +msgstr "" + +#: src/honoka_imengine_setup.cpp:656 +msgid "If you use the candidate selection by numkey, check this." +msgstr "" + +#: src/honoka_imengine_setup.cpp:659 +msgid "Auto _conversion: " +msgstr "" + +#: src/honoka_imengine_setup.cpp:674 +msgid "If you set default to the auto conversion mode use, check this." +msgstr "" + +#: src/honoka_imengine_setup.cpp:678 +msgid "_YOSOKU-input: " +msgstr "" + +#: src/honoka_imengine_setup.cpp:693 +msgid "if you use YOSOKU-input , check this." +msgstr "" + +#: src/honoka_imengine_setup.cpp:697 +msgid "_Roma-Kana table: " +msgstr "" + +#: src/honoka_imengine_setup.cpp:718 +msgid "input the path of Roma-Kana convert table file." +msgstr "" + +#: src/honoka_imengine_setup.cpp:832 +msgid "Options" +msgstr "" + +#: src/romkan.cpp:507 +msgid "Roma-Kana" +msgstr "" + +#: src/romkan.cpp:511 +msgid "Roma-Katakana" +msgstr "" + +#: src/romkan.cpp:515 +msgid "Half Roma-Kana" +msgstr "" + +#: src/romkan.cpp:519 +msgid "Ascii" +msgstr "" + +#: src/romkan.cpp:523 +msgid "Wide Ascii" +msgstr "" + +#: src/romkan.cpp:586 +msgid "Roma" +msgstr "" + +#: src/kanainput.cpp:132 +msgid "KANA" +msgstr "" + +#: src/kanainput.cpp:140 +msgid "Kana" +msgstr "" diff --git a/honoka/po/ja.po b/honoka/po/ja.po index f22537c..8b9b85c 100644 --- a/honoka/po/ja.po +++ b/honoka/po/ja.po @@ -9,7 +9,7 @@ msgstr "" "Project-Id-Version: ja\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-03-28 12:41+0900\n" +"POT-Creation-Date: 2005-04-08 16:51+0900\n" "PO-Revision-Date: 2004-12-01 14:29+0900\n" "Last-Translator: TAM (Teppei Tamra) \n" "Language-Team: Japanese\n" @@ -18,466 +18,466 @@ "Content-Transfer-Encoding: 8bit\n" "X-Generator: KBabel 1.9.1\n" -#: src/scim_wnn_imengine.cpp:87 src/scim_wnn_imengine.cpp:94 -#: src/scim_wnn_imengine_setup.cpp:96 -msgid "Wnn" -msgstr "Wnn" +#: src/honoka_imengine.cpp:85 src/honoka_imengine.cpp:92 +#: src/honoka_imengine_setup.cpp:96 +msgid "Honoka" +msgstr "ほのか" -#: src/scim_wnn_imengine.cpp:107 +#: src/honoka_imengine.cpp:105 msgid "ja_JP" msgstr "ja_JP" -#: src/scim_wnn_imengine.cpp:119 +#: src/honoka_imengine.cpp:117 msgid "(C) 2004 TAM(Teppei Tamra) " msgstr "(C) 2004 TAM(Teppei Tamra) " -#: src/scim_wnn_imengine.cpp:129 +#: src/honoka_imengine.cpp:127 msgid "SCIM-WNN HELP" msgstr "適当にそれっぽく操作して下さい。" -#: src/scim_wnn_imengine.cpp:343 +#: src/honoka_imengine.cpp:339 msgid "input mode" msgstr "入力モード" -#: src/scim_wnn_imengine.cpp:347 src/scim_wnn_imengine.cpp:350 +#: src/honoka_imengine.cpp:343 src/honoka_imengine.cpp:346 msgid "mode status" msgstr "状態" -#: src/scim_wnn_imengine.cpp:352 +#: src/honoka_imengine.cpp:348 msgid "conversion mode" msgstr "変換モード" -#: src/scim_wnn_imengine.cpp:363 +#: src/honoka_imengine.cpp:359 msgid "Kanji" msgstr "[漢]" -#: src/scim_wnn_imengine.cpp:364 +#: src/honoka_imengine.cpp:360 msgid "Yosoku" msgstr "[予]" -#: src/scim_wnn_imengine.cpp:370 +#: src/honoka_imengine.cpp:366 msgid "AUTO" msgstr "[逐]" -#: src/scim_wnn_imengine.cpp:371 +#: src/honoka_imengine.cpp:367 msgid "REN" msgstr "[連]" -#: src/scim_wnn_imengine.cpp:912 src/scim_wnn_imengine.cpp:920 -#: src/scim_wnn_imengine.cpp:947 src/scim_wnn_imengine.cpp:959 +#: src/honoka_imengine.cpp:908 src/honoka_imengine.cpp:916 +#: src/honoka_imengine.cpp:943 src/honoka_imengine.cpp:955 msgid "could not connect to jserver." msgstr "サーバに接続できませんでした" -#: src/scim_wnn_imengine.cpp:999 +#: src/honoka_imengine.cpp:995 msgid "Ikeiji lookup result" msgstr "異形字変換" -#: src/scim_wnn_imengine.cpp:1003 +#: src/honoka_imengine.cpp:999 msgid "association lookup result" msgstr "連想変換" -#: src/scim_wnn_imengine.cpp:1007 +#: src/honoka_imengine.cpp:1003 msgid "yosoku lookup result" msgstr "予測候補" -#: src/scim_wnn_imengine.cpp:1011 +#: src/honoka_imengine.cpp:1007 msgid "lookup result" msgstr "候補一覧" -#: src/scim_wnn_imengine_setup.cpp:101 -msgid "A Wnn IMEngine Module." -msgstr "Wnn IMエンジンモジュール" +#: src/honoka_imengine_setup.cpp:101 +msgid "A Honoka IMEngine Module." +msgstr "ほのかIMエンジンモジュール" -#: src/scim_wnn_imengine_setup.cpp:177 +#: src/honoka_imengine_setup.cpp:177 msgid "Wnn4 or FreeWnn" msgstr "Wnn4又はFreeWnn" -#: src/scim_wnn_imengine_setup.cpp:182 +#: src/honoka_imengine_setup.cpp:182 msgid "Wnn6" msgstr "Wnn6" -#: src/scim_wnn_imengine_setup.cpp:187 +#: src/honoka_imengine_setup.cpp:187 msgid "Wnn7" msgstr "Wnn7" -#: src/scim_wnn_imengine_setup.cpp:192 +#: src/honoka_imengine_setup.cpp:192 msgid "Wnn8" msgstr "Wnn8" -#: src/scim_wnn_imengine_setup.cpp:197 +#: src/honoka_imengine_setup.cpp:197 msgid "Roma-Kana input" msgstr "ローマ字入力" -#: src/scim_wnn_imengine_setup.cpp:202 +#: src/honoka_imengine_setup.cpp:202 msgid "Kana input" msgstr "かな入力" -#: src/scim_wnn_imengine_setup.cpp:216 +#: src/honoka_imengine_setup.cpp:216 msgid "Commit keys:" msgstr "確定キー:" -#: src/scim_wnn_imengine_setup.cpp:217 +#: src/honoka_imengine_setup.cpp:217 msgid "Select commit keys" msgstr "確定キーの設定" -#: src/scim_wnn_imengine_setup.cpp:218 +#: src/honoka_imengine_setup.cpp:218 msgid "The key events to commit the preedit string. " msgstr "文字列を確定するキーイベント" -#: src/scim_wnn_imengine_setup.cpp:225 +#: src/honoka_imengine_setup.cpp:225 msgid "Convert keys:" msgstr "変換キー:" -#: src/scim_wnn_imengine_setup.cpp:226 +#: src/honoka_imengine_setup.cpp:226 msgid "Select convert keys" msgstr "変換キーの設定" -#: src/scim_wnn_imengine_setup.cpp:227 +#: src/honoka_imengine_setup.cpp:227 msgid "The key events to convert the preedit string to kanji. " msgstr "文字列を漢字へ変換するキーイベント" -#: src/scim_wnn_imengine_setup.cpp:234 +#: src/honoka_imengine_setup.cpp:234 msgid "Cancel keys:" msgstr "キャンセルキー:" -#: src/scim_wnn_imengine_setup.cpp:235 +#: src/honoka_imengine_setup.cpp:235 msgid "Select cancel keys" msgstr "キャンセルキーの設定" -#: src/scim_wnn_imengine_setup.cpp:236 +#: src/honoka_imengine_setup.cpp:236 msgid "The key events to cancel preediting or converting. " msgstr "文字入力や文字変換をキャンセルするキーイベント" -#: src/scim_wnn_imengine_setup.cpp:243 +#: src/honoka_imengine_setup.cpp:243 msgid "Backspace keys:" msgstr "バックスペースキー:" -#: src/scim_wnn_imengine_setup.cpp:244 +#: src/honoka_imengine_setup.cpp:244 msgid "Select backspace keys" msgstr "バックスペースキーの設定" -#: src/scim_wnn_imengine_setup.cpp:245 +#: src/honoka_imengine_setup.cpp:245 msgid "The key events to delete a character before caret. " msgstr "キャレットの前の文字を一文字削除するキーイベント" -#: src/scim_wnn_imengine_setup.cpp:252 +#: src/honoka_imengine_setup.cpp:252 msgid "Delete keys:" msgstr "削除キー:" -#: src/scim_wnn_imengine_setup.cpp:253 +#: src/honoka_imengine_setup.cpp:253 msgid "Select delete keys" msgstr "削除キーの設定" -#: src/scim_wnn_imengine_setup.cpp:254 +#: src/honoka_imengine_setup.cpp:254 msgid "The key events to delete a character after caret. " msgstr "キャレットの後の文字を一文字削除するキーイベント" -#: src/scim_wnn_imengine_setup.cpp:274 +#: src/honoka_imengine_setup.cpp:274 msgid "Move forward keys:" msgstr "前方へ移動するキー:" -#: src/scim_wnn_imengine_setup.cpp:275 +#: src/honoka_imengine_setup.cpp:275 msgid "Select move caret forward keys" msgstr "キャレットを前方へ移動するキーの設定" -#: src/scim_wnn_imengine_setup.cpp:276 +#: src/honoka_imengine_setup.cpp:276 msgid "The key events to move the caret to forward. " msgstr "キャレットを前方へ移動するキーイベント" -#: src/scim_wnn_imengine_setup.cpp:283 +#: src/honoka_imengine_setup.cpp:283 msgid "Move backward keys:" msgstr "後方へ移動するキー:" -#: src/scim_wnn_imengine_setup.cpp:284 +#: src/honoka_imengine_setup.cpp:284 msgid "Select move caret backward keys" msgstr "キャレットを後方へ移動するキーの設定" -#: src/scim_wnn_imengine_setup.cpp:285 +#: src/honoka_imengine_setup.cpp:285 msgid "The key events to move the caret to backward. " msgstr "キャレットを後方へ移動するキーイベント" -#: src/scim_wnn_imengine_setup.cpp:305 +#: src/honoka_imengine_setup.cpp:305 msgid "Next segment keys:" msgstr "次の文節へ移動するキー:" -#: src/scim_wnn_imengine_setup.cpp:306 +#: src/honoka_imengine_setup.cpp:306 msgid "Select next segment keys" msgstr "次の文節へ移動するキーの設定" -#: src/scim_wnn_imengine_setup.cpp:307 +#: src/honoka_imengine_setup.cpp:307 msgid "The key events to select next segment. " msgstr "次の文節を選択するキーイベント" -#: src/scim_wnn_imengine_setup.cpp:314 +#: src/honoka_imengine_setup.cpp:314 msgid "Previous segment keys:" msgstr "前の文節へ移動するキー:" -#: src/scim_wnn_imengine_setup.cpp:315 +#: src/honoka_imengine_setup.cpp:315 msgid "Select previous segment keys" msgstr "前の文節へ移動するキーの設定" -#: src/scim_wnn_imengine_setup.cpp:316 +#: src/honoka_imengine_setup.cpp:316 msgid "The key events to select previous segment. " msgstr "前の文節を選択するキーイベント" -#: src/scim_wnn_imengine_setup.cpp:323 +#: src/honoka_imengine_setup.cpp:323 msgid "Shrink segment keys:" msgstr "文節を縮めるキー:" -#: src/scim_wnn_imengine_setup.cpp:324 +#: src/honoka_imengine_setup.cpp:324 msgid "Select shrink segment keys" msgstr "文節を縮めるキーの設定" -#: src/scim_wnn_imengine_setup.cpp:325 +#: src/honoka_imengine_setup.cpp:325 msgid "The key events to shrink the selected segment. " msgstr "選択文節を縮めるキーイベント" -#: src/scim_wnn_imengine_setup.cpp:332 +#: src/honoka_imengine_setup.cpp:332 msgid "Expand segment keys:" msgstr "文節を拡げるキー" -#: src/scim_wnn_imengine_setup.cpp:333 +#: src/honoka_imengine_setup.cpp:333 msgid "Select expand segment keys" msgstr "文節を拡げるキーの設定" -#: src/scim_wnn_imengine_setup.cpp:334 +#: src/honoka_imengine_setup.cpp:334 msgid "The key events to expand the selected segment. " msgstr "選択文節を拡げるキーイベント" -#: src/scim_wnn_imengine_setup.cpp:354 +#: src/honoka_imengine_setup.cpp:354 msgid "Next keys:" msgstr "次へ移動するキー:" -#: src/scim_wnn_imengine_setup.cpp:355 +#: src/honoka_imengine_setup.cpp:355 msgid "Select next candidate keys" msgstr "次の候補を選択するキーの設定" -#: src/scim_wnn_imengine_setup.cpp:356 +#: src/honoka_imengine_setup.cpp:356 msgid "The key events to select next candidate. " msgstr "次の候補を選択するキーイベント" -#: src/scim_wnn_imengine_setup.cpp:363 +#: src/honoka_imengine_setup.cpp:363 msgid "Previous keys:" msgstr "前へ移動するキー:" -#: src/scim_wnn_imengine_setup.cpp:364 +#: src/honoka_imengine_setup.cpp:364 msgid "Select previous candidate keys" msgstr "前の候補を選択するキーの設定" -#: src/scim_wnn_imengine_setup.cpp:365 +#: src/honoka_imengine_setup.cpp:365 msgid "The key events to select previous candidate. " msgstr "前の候補を選択するキーイベント" -#: src/scim_wnn_imengine_setup.cpp:372 +#: src/honoka_imengine_setup.cpp:372 msgid "candidates list keys:" msgstr "候補一覧キー:" -#: src/scim_wnn_imengine_setup.cpp:373 +#: src/honoka_imengine_setup.cpp:373 msgid "Select candidates list keys" msgstr "候補一覧を表示するキーの設定" -#: src/scim_wnn_imengine_setup.cpp:374 +#: src/honoka_imengine_setup.cpp:374 msgid "The key events to popup candidates list. " msgstr "候補一覧を表示するキーイベント" -#: src/scim_wnn_imengine_setup.cpp:381 +#: src/honoka_imengine_setup.cpp:381 msgid "Page up keys:" msgstr "前のページへ移動するキー:" -#: src/scim_wnn_imengine_setup.cpp:382 +#: src/honoka_imengine_setup.cpp:382 msgid "Select page up candidates keys" msgstr "前のページへ移動するキーの設定" -#: src/scim_wnn_imengine_setup.cpp:383 +#: src/honoka_imengine_setup.cpp:383 msgid "The key events to select page up candidates. " msgstr "前のページへ移動するキーイベント" -#: src/scim_wnn_imengine_setup.cpp:390 +#: src/honoka_imengine_setup.cpp:390 msgid "Page down keys:" msgstr "次のページへ移動するキー:" -#: src/scim_wnn_imengine_setup.cpp:391 +#: src/honoka_imengine_setup.cpp:391 msgid "Select page down candidates keys" msgstr "次のページへ移動するキーの設定" -#: src/scim_wnn_imengine_setup.cpp:392 +#: src/honoka_imengine_setup.cpp:392 msgid "The key events to select page down candidates. " msgstr "次のページへ移動するキーイベント" -#: src/scim_wnn_imengine_setup.cpp:412 +#: src/honoka_imengine_setup.cpp:412 msgid "auto conversion mode keys:" msgstr "逐次変換モードキー:" -#: src/scim_wnn_imengine_setup.cpp:413 +#: src/honoka_imengine_setup.cpp:413 msgid "Select auto conversion mode keys" msgstr "逐次変換モードキーの設定" -#: src/scim_wnn_imengine_setup.cpp:414 +#: src/honoka_imengine_setup.cpp:414 msgid "The key events to change auto conversion mode. " msgstr "逐次変換モードを切り替えるキーイベント" -#: src/scim_wnn_imengine_setup.cpp:421 +#: src/honoka_imengine_setup.cpp:421 msgid "Yosoku keys:" msgstr "予測入力キー:" -#: src/scim_wnn_imengine_setup.cpp:422 +#: src/honoka_imengine_setup.cpp:422 msgid "Select yosoku keys" msgstr "予測入力キーの設定" -#: src/scim_wnn_imengine_setup.cpp:423 +#: src/honoka_imengine_setup.cpp:423 msgid "The key events to select from completion list. " msgstr "予測入力候補から選択するキーイベント" -#: src/scim_wnn_imengine_setup.cpp:430 +#: src/honoka_imengine_setup.cpp:430 msgid "Convert to ikeiji keys:" msgstr "異形字変換キー:" -#: src/scim_wnn_imengine_setup.cpp:431 +#: src/honoka_imengine_setup.cpp:431 msgid "Select ikeiji keys" msgstr "異形字変換キーの設定" -#: src/scim_wnn_imengine_setup.cpp:432 +#: src/honoka_imengine_setup.cpp:432 msgid "The key events to convert the selected candidate to ikei-kanji. " msgstr "選択された候補を異形字漢字へ変換するキーイベント" -#: src/scim_wnn_imengine_setup.cpp:439 +#: src/honoka_imengine_setup.cpp:439 msgid "Convert to rensou keys:" msgstr "連想変換キー:" -#: src/scim_wnn_imengine_setup.cpp:440 +#: src/honoka_imengine_setup.cpp:440 msgid "Select rensou keys" msgstr "連想変換キーの設定" -#: src/scim_wnn_imengine_setup.cpp:441 +#: src/honoka_imengine_setup.cpp:441 msgid "" "The key events to convert the selected candidate to the associated " "acceptation string. " msgstr "選択された候補を連想変換するキーイベント" -#: src/scim_wnn_imengine_setup.cpp:448 +#: src/honoka_imengine_setup.cpp:448 msgid "Convert to HIRAGANA keys:" msgstr "ひらがな変換キー:" -#: src/scim_wnn_imengine_setup.cpp:449 +#: src/honoka_imengine_setup.cpp:449 msgid "Select convert to HIRAGANA keys" msgstr "ひらがな変換キーの設定" -#: src/scim_wnn_imengine_setup.cpp:450 +#: src/honoka_imengine_setup.cpp:450 msgid "" "The key events to convert the selected candidate or the preedit string to " "HIRAGANA. " msgstr "選択された候補、あるいは変換前文字列をひらがなへ変換するキーイベント" -#: src/scim_wnn_imengine_setup.cpp:457 +#: src/honoka_imengine_setup.cpp:457 msgid "Convert to KATAKANA keys:" msgstr "カタカナ変換キー:" -#: src/scim_wnn_imengine_setup.cpp:458 +#: src/honoka_imengine_setup.cpp:458 msgid "Select convert to KATAGANA keys" msgstr "カタカナ変換キーの設定" -#: src/scim_wnn_imengine_setup.cpp:459 +#: src/honoka_imengine_setup.cpp:459 msgid "" "The key events to convert the selected candidate or the preedit string to " "KATAKANA. " msgstr "選択された候補、あるいは変換前文字列をカタカナへ変換するキーイベント" -#: src/scim_wnn_imengine_setup.cpp:476 +#: src/honoka_imengine_setup.cpp:476 msgid "Common keys" msgstr "一般キー" -#: src/scim_wnn_imengine_setup.cpp:477 +#: src/honoka_imengine_setup.cpp:477 msgid "Preedit keys" msgstr "編集キー" -#: src/scim_wnn_imengine_setup.cpp:478 +#: src/honoka_imengine_setup.cpp:478 msgid "Candidates keys" msgstr "候補キー" -#: src/scim_wnn_imengine_setup.cpp:479 +#: src/honoka_imengine_setup.cpp:479 msgid "Other function keys" msgstr "その他機能キー" -#: src/scim_wnn_imengine_setup.cpp:529 +#: src/honoka_imengine_setup.cpp:529 msgid "_Server: " msgstr "サーバ(_S):" -#: src/scim_wnn_imengine_setup.cpp:546 +#: src/honoka_imengine_setup.cpp:546 msgid "input the server name to connect." msgstr "接続するサーバ名を指定します。" -#: src/scim_wnn_imengine_setup.cpp:550 +#: src/honoka_imengine_setup.cpp:550 msgid "_wnnenvrc: " msgstr "wnnenvrc(_W):" -#: src/scim_wnn_imengine_setup.cpp:565 src/scim_wnn_imengine_setup.cpp:712 -#: src/scim_wnn_imengine_setup.cpp:792 +#: src/honoka_imengine_setup.cpp:565 src/honoka_imengine_setup.cpp:712 +#: src/honoka_imengine_setup.cpp:792 msgid "..." msgstr "..." -#: src/scim_wnn_imengine_setup.cpp:572 +#: src/honoka_imengine_setup.cpp:572 msgid "input the path of wnnenvrc." msgstr "wnnenvrcファイルを指定します" -#: src/scim_wnn_imengine_setup.cpp:575 +#: src/honoka_imengine_setup.cpp:575 msgid "Server_type: " msgstr "サーバタイプ(_T):" -#: src/scim_wnn_imengine_setup.cpp:595 +#: src/honoka_imengine_setup.cpp:595 msgid "select the server type from Wnn4 / Wnn6 / Wnn7." msgstr "サーバの種類を Wnn4 / Wnn6 / Wnn7 から選択します。" -#: src/scim_wnn_imengine_setup.cpp:598 +#: src/honoka_imengine_setup.cpp:598 msgid "Default_PreEditor: " msgstr "標準の読み入力方式(_P):" -#: src/scim_wnn_imengine_setup.cpp:617 +#: src/honoka_imengine_setup.cpp:617 msgid "select the default preeditor." msgstr "標準のよみ入力方式を選びます。" -#: src/scim_wnn_imengine_setup.cpp:621 +#: src/honoka_imengine_setup.cpp:621 msgid "_Auto candidates popup: " msgstr "自動候補ポップアップ(_A):" -#: src/scim_wnn_imengine_setup.cpp:638 +#: src/honoka_imengine_setup.cpp:638 msgid "" "set the count of conversion until displaying the list of lookup result " "automatically." msgstr "何回変換動作をすれば自動的に候補一覧を表示するかを指定します。" -#: src/scim_wnn_imengine_setup.cpp:641 +#: src/honoka_imengine_setup.cpp:641 msgid "_NumKey selection: " msgstr "数字キーによる選択(_N):" -#: src/scim_wnn_imengine_setup.cpp:656 +#: src/honoka_imengine_setup.cpp:656 msgid "If you use the candidate selection by numkey, check this." msgstr "候補から数字キーを使って選択できるようにするにはここをチェックします。" -#: src/scim_wnn_imengine_setup.cpp:659 +#: src/honoka_imengine_setup.cpp:659 msgid "Auto _conversion: " msgstr "逐次変換(_C):" -#: src/scim_wnn_imengine_setup.cpp:674 +#: src/honoka_imengine_setup.cpp:674 msgid "If you set default to the auto conversion mode use, check this." msgstr "逐次変換をデフォルトで有効にするにはここをチェックします。" -#: src/scim_wnn_imengine_setup.cpp:678 +#: src/honoka_imengine_setup.cpp:678 msgid "_YOSOKU-input: " msgstr "予測入力(_Y):" -#: src/scim_wnn_imengine_setup.cpp:693 +#: src/honoka_imengine_setup.cpp:693 msgid "if you use YOSOKU-input , check this." msgstr "予測入力を利用する場合はここをチェックします" -#: src/scim_wnn_imengine_setup.cpp:697 +#: src/honoka_imengine_setup.cpp:697 msgid "_Roma-Kana table: " msgstr "ローマ字変換テーブル(_R):" -#: src/scim_wnn_imengine_setup.cpp:718 +#: src/honoka_imengine_setup.cpp:718 msgid "input the path of Roma-Kana convert table file." msgstr "ローマ字かな変換テーブルファイルを指定します" -#: src/scim_wnn_imengine_setup.cpp:832 +#: src/honoka_imengine_setup.cpp:832 msgid "Options" msgstr "オプション" @@ -512,3 +512,6 @@ #: src/kanainput.cpp:140 msgid "Kana" msgstr "かな入力" + +#~ msgid "Wnn" +#~ msgstr "Wnn" diff --git a/honoka/src/Makefile.am b/honoka/src/Makefile.am index 4071a9f..d968c16 100644 --- a/honoka/src/Makefile.am +++ b/honoka/src/Makefile.am @@ -21,43 +21,43 @@ -I$(top_srcdir) \ -I$(top_srcdir)/src \ -DSCIM_ICONDIR=\"@SCIM_ICONDIR@\" \ - -DSCIM_WNN_LOCALEDIR=\"$(datadir)/locale\" \ - -DSCIM_WNN_DATADIR=\"@SCIM_DATADIR@/scim-wnn\" \ - -DSCIM_WNN_ICON_FILE=\"@SCIM_ICONDIR@/scim-wnn.png\" + -DHONOKA_LOCALEDIR=\"$(datadir)/locale\" \ + -DHONOKA_DATADIR=\"@SCIM_DATADIR@/honoka\" \ + -DHONOKA_ICON_FILE=\"@SCIM_ICONDIR@/honoka.png\" -noinst_HEADERS = scim_wnn_imengine.h wnnproto.h romkan.h romkan_table.h \ - wnnconversion.h scim_wnn_def.h preeditor.h kanainput.h convertor.h anthyconversion.h +noinst_HEADERS = honoka_imengine.h wnnproto.h romkan.h romkan_table.h \ + wnnconversion.h honoka_def.h preeditor.h kanainput.h convertor.h anthyconversion.h moduledir = @SCIM_MODULEDIR@/IMEngine -module_LTLIBRARIES = wnn.la +module_LTLIBRARIES = honoka.la -wnn_la_SOURCES = scim_wnn_imengine.cpp romkan.cpp wnnconversion.cpp \ +honoka_la_SOURCES = honoka_imengine.cpp romkan.cpp wnnconversion.cpp \ preeditor.cpp kanainput.cpp convertor.cpp anthyconversion.cpp -wnn_la_CFLAGS = @SCIM_CFLAGS@ @SCIM_DEBUG_FLAGS@ -wnn_la_CXXFLAGS = @SCIM_CFLAGS@ @SCIM_DEBUG_FLAGS@ +honoka_la_CFLAGS = @SCIM_CFLAGS@ @SCIM_DEBUG_FLAGS@ +honoka_la_CXXFLAGS = @SCIM_CFLAGS@ @SCIM_DEBUG_FLAGS@ -wnn_la_LDFLAGS = -avoid-version -module -rpath $(moduledir) \ +honoka_la_LDFLAGS = -avoid-version -module -rpath $(moduledir) \ @LIBTOOL_EXPORT_OPTIONS@ @INTLLIBS@ @SCIM_LIBS@ if SCIM_BUILD_SETUP -SETUP_MODULE = wnn-imengine-setup.la +SETUP_MODULE = honoka-imengine-setup.la endif setupmoduledir = @SCIM_MODULEDIR@/SetupUI setupmodule_LTLIBRARIES = $(SETUP_MODULE) -wnn_imengine_setup_la_SOURCES = scim_wnn_imengine_setup.cpp +honoka_imengine_setup_la_SOURCES = honoka_imengine_setup.cpp -wnn_imengine_setup_la_CFLAGS = @SCIM_GTKUTILS_CFLAGS@ @SCIM_CFLAGS@ @SCIM_DEBUG_FLAGS@ +honoka_imengine_setup_la_CFLAGS = @SCIM_GTKUTILS_CFLAGS@ @SCIM_CFLAGS@ @SCIM_DEBUG_FLAGS@ -wnn_imengine_setup_la_CXXFLAGS= @SCIM_GTKUTILS_CFLAGS@ @SCIM_CFLAGS@ @SCIM_DEBUG_FLAGS@ +honoka_imengine_setup_la_CXXFLAGS= @SCIM_GTKUTILS_CFLAGS@ @SCIM_CFLAGS@ @SCIM_DEBUG_FLAGS@ -wnn_imengine_setup_la_LDFLAGS = -avoid-version \ +honoka_imengine_setup_la_LDFLAGS = -avoid-version \ -rpath $(setupmoduledir) \ -module \ @LIBTOOL_EXPORT_OPTIONS@ \ @SCIM_GTKUTILS_LIBS@ \ @INTLLIBS@ \ @SCIM_LIBS@ -wnn_la_LIBADD = +honoka_la_LIBADD = diff --git a/honoka/src/honoka_def.h b/honoka/src/honoka_def.h new file mode 100644 index 0000000..7aee6a9 --- /dev/null +++ b/honoka/src/honoka_def.h @@ -0,0 +1,121 @@ +/*************************************************************************** + * Copyright (C) 2004 by TAM(Teppei Tamra) * + * tam-t@par.odn.ne.jp * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef HONOKA_DEF_H +#define HONOKA_DEF_H + +#define HONOKA_CONFIG_KEY_CONVERSION_START "/IMEngine/Honoka/Key/ConversionStart" +#define HONOKA_DEFAULT_KEY_CONVERSION_START "space" +#define HONOKA_CONFIG_KEY_CANCEL "/IMEngine/Honoka/Key/Cancel" +#define HONOKA_DEFAULT_KEY_CANCEL "Escape,Control+g" +#define HONOKA_CONFIG_KEY_DELETE "/IMEngine/Honoka/Key/Delete" +#define HONOKA_DEFAULT_KEY_DELETE "Delete" +#define HONOKA_CONFIG_KEY_BACKSPACE "/IMEngine/Honoka/Key/BackSpace" +#define HONOKA_DEFAULT_KEY_BACKSPACE "BackSpace" +#define HONOKA_CONFIG_KEY_COMMIT "/IMEngine/Honoka/Key/Commit" +#define HONOKA_DEFAULT_KEY_COMMIT "Return" +#define HONOKA_CONFIG_KEY_CONVERSION_NEXT "/IMEngine/Honoka/Key/ConversionNext" +#define HONOKA_DEFAULT_KEY_CONVERSION_NEXT "space,Down" +#define HONOKA_CONFIG_KEY_CONVERSION_PREV "/IMEngine/Honoka/Key/ConversionPrev" +#define HONOKA_DEFAULT_KEY_CONVERSION_PREV "Up" +#define HONOKA_CONFIG_KEY_CONVERSION_EXPAND "/IMEngine/Honoka/Key/ConversionExpand" +#define HONOKA_DEFAULT_KEY_CONVERSION_EXPAND "Shift+Right,Control+o" +#define HONOKA_CONFIG_KEY_CONVERSION_SHRINK "/IMEngine/Honoka/Key/ConversionShrink" +#define HONOKA_DEFAULT_KEY_CONVERSION_SHRINK "Shift+Left,Control+i" +#define HONOKA_CONFIG_KEY_CONVERSION_FORWARD "/IMEngine/Honoka/Key/ConversionForward" +#define HONOKA_DEFAULT_KEY_CONVERSION_FORWARD "Right" +#define HONOKA_CONFIG_KEY_CONVERSION_BACKWARD "/IMEngine/Honoka/Key/ConversionBackward" +#define HONOKA_DEFAULT_KEY_CONVERSION_BACKWARD "Left" +#define HONOKA_CONFIG_KEY_FORWARD "/IMEngine/Honoka/Key/Forward" +#define HONOKA_DEFAULT_KEY_FORWARD "Right" +#define HONOKA_CONFIG_KEY_BACKWARD "/IMEngine/Honoka/Key/Backword" +#define HONOKA_DEFAULT_KEY_BACKWARD "Left" +#define HONOKA_CONFIG_KEY_HOME "/IMEngine/Honoka/Key/Home" +#define HONOKA_DEFAULT_KEY_HOME "Home" +#define HONOKA_CONFIG_KEY_END "/IMEngine/Honoka/Key/End" +#define HONOKA_DEFAULT_KEY_END "End" +#define HONOKA_CONFIG_KEY_LOOKUPPOPUP "/IMEngine/Honoka/Key/LookupPopup" +#define HONOKA_DEFAULT_KEY_LOOKUPPOPUP "Alt+s" +#define HONOKA_CONFIG_KEY_LOOKUPPAGEUP "/IMEngine/Honoka/Key/LookupPageUp" +#define HONOKA_DEFAULT_KEY_LOOKUPPAGEUP "Page_Up" +#define HONOKA_CONFIG_KEY_LOOKUPPAGEDOWN "/IMEngine/Honoka/Key/LookupPageDown" +#define HONOKA_DEFAULT_KEY_LOOKUPPAGEDOWN "Page_Down" +#define HONOKA_CONFIG_KEY_CONVERT_HIRAGANA "/IMEngine/Honoka/Key/ConvertHiragana" +#define HONOKA_DEFAULT_KEY_CONVERT_HIRAGANA "Alt+h" +#define HONOKA_CONFIG_KEY_CONVERT_KATAKANA "/IMEngine/Honoka/Key/ConvertKatakana" +#define HONOKA_DEFAULT_KEY_CONVERT_KATAKANA "Alt+k" +#define HONOKA_CONFIG_KEY_CONVERT_HALF "/IMEngine/Honoka/Key/ConvertHalf" +#define HONOKA_DEFAULT_KEY_CONVERT_HALF "F6" +#define HONOKA_CONFIG_KEY_CONVERT_WIDE "/IMEngine/Honoka/Key/ConvertWide" +#define HONOKA_DEFAULT_KEY_CONVERT_WIDE "F5" + +#define HONOKA_CONFIG_KEY_CONVERSION_IKEIJI "/IMEngine/Honoka/Key/ConversionIkeiji" +#define HONOKA_DEFAULT_KEY_CONVERSION_IKEIJI "Shift+F8" +#define HONOKA_CONFIG_KEY_CONVERSION_RENSOU "/IMEngine/Honoka/Key/ConversionRensou" +#define HONOKA_DEFAULT_KEY_CONVERSION_RENSOU "Shift+F9" +#define HONOKA_CONFIG_KEY_SELECT_YOSOKU "/IMEngine/Honoka/Key/SelectYosoku" +#define HONOKA_DEFAULT_KEY_SELECT_YOSOKU "Tab" +#define HONOKA_CONFIG_KEY_AUTO_CONVERSION "/IMEngine/Honoka/Key/AutoConversion" +#define HONOKA_DEFAULT_KEY_AUTO_CONVERSION "Alt+a" + +#define HONOKA_CONFIG_ALP "/IMEngine/Honoka/AutoLookupPopup" +#define HONOKA_DEFAULT_ALP 3 +#define HONOKA_CONFIG_SERVER "/IMEngine/Honoka/Server" +#define HONOKA_DEFAULT_SERVER "localhost" +#define HONOKA_CONFIG_RC "/IMEngine/Honoka/Rc" +#define HONOKA_DEFAULT_RC "/usr/lib/wnn7/ja_JP/wnnenvrc" +#define HONOKA_CONFIG_AUTO_CONVERSION "/IMEngine/Honoka/AutoConversion" +#define HONOKA_DEFAULT_AUTO_CONVERSION false +#define HONOKA_CONFIG_NUMKEY_SELECT "/IMEngine/Honoka/NumkeySelection" +#define HONOKA_DEFAULT_NUMKEY_SELECT true +#define HONOKA_CONFIG_DEFAULT_PREEDITOR "/IMEngine/Honoka/DefaultPreEditor" +#define HONOKA_DEFAULT_DEFAULT_PREEDITOR "Romkan" +#define HONOKA_CONFIG_SERVERTYPE "/IMEngine/Honoka/ServerType" +#ifdef HAVE_LIBWNN7 + #define HONOKA_DEFAULT_SERVERTYPE "Wnn7" +#else + #define HONOKA_DEFAULT_SERVERTYPE "Wnn4" +#endif + +#define HONOKA_CONFIG_MINISTATUS "/IMEngine/Honoka/MiniStatus" +#define HONOKA_DEFAULT_MINISTATUS false + +#define HONOKA_CONFIG_YOSOKU "/IMEngine/Honoka/Yosoku" +#ifdef HAVE_LIBWNN7 + #define HONOKA_DEFAULT_YOSOKU true +#else + #define HONOKA_DEFAULT_YOSOKU false +#endif + +#define SCIM_PROP_WNN_MODESTATUS "/IMEngine/Honoka/Property/ModeStatus" +#define SCIM_PROP_WNN_INPUTMODE "/IMEngine/Honoka/InputMode" +#define SCIM_PROP_WNN_CONVERSIONMODE "/IMEngine/Honoka/ConversionMode" + + +// Romkan + +#define HONOKA_CONFIG_ROMKAN_TABLE_FILE "/IMEngine/Honoka/Romkan/TableFile" +#define HONOKA_DEFAULT_ROMKAN_TABLE_FILE "honoka-def.rkt" + +// KanaInput +#define HONOKA_CONFIG_KANAINPUT_FAKEKANA "/IMEngine/Honoka/KanaInput/FakeKanaKey" +#define HONOKA_DEFAULT_KANAINPUT_FAKEKANA true + +#endif diff --git a/honoka/src/honoka_imengine.cpp b/honoka/src/honoka_imengine.cpp new file mode 100644 index 0000000..bb97f7c --- /dev/null +++ b/honoka/src/honoka_imengine.cpp @@ -0,0 +1,1019 @@ +/*************************************************************************** + * Copyright (C) 2004 by TAM(Teppei Tamra) * + * tam-t@par.odn.ne.jp * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + + +#define Uses_SCIM_UTILITY +#define Uses_SCIM_IMENGINE +#define Uses_SCIM_LOOKUP_TABLE +#define Uses_SCIM_CONFIG_BASE +#define Uses_SCIM_ICONV + +#ifdef HAVE_CONFIG_H + #include +#endif + +// ��ݲ��Τ��ޤ��ʤ��� +#ifdef HAVE_GETTEXT + #include + #define _(String) dgettext(GETTEXT_PACKAGE,String) + #define N_(String) (String) +#else + #define _(String) (String) + #define N_(String) (String) + #define bindtextdomain(Package,Directory) + #define textdomain(domain) + #define bind_textdomain_codeset(domain,codeset) +#endif + +// scim�Τ��ޤ��ʤ��� +#include "honoka_imengine.h" +#include "honoka_def.h" + +#define scim_module_init honoka_LTX_scim_module_init +#define scim_module_exit honoka_LTX_scim_module_exit +#define scim_imengine_module_init honoka_LTX_scim_imengine_module_init +#define scim_imengine_module_create_factory honoka_LTX_scim_imengine_module_create_factory +#ifndef HONOKA_ICON_FILE + #define HONOKA_ICON_FILE (SCIM_ICONDIR "/honoka.png") +#endif + + +static Pointer _honoka_factory; +static ConfigPointer _scim_config; + +extern "C" { + void scim_module_init (void) + { + bindtextdomain (GETTEXT_PACKAGE, HONOKA_LOCALEDIR); + bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); + } + + void scim_module_exit (void) + { + _honoka_factory.reset (); + _scim_config.reset (); + } + + unsigned int scim_imengine_module_init (const ConfigPointer &config) + { + _scim_config = config; + return 1; + } + + IMEngineFactoryPointer scim_imengine_module_create_factory (unsigned int factory) + { + if (factory != 0) return NULL; + if (_honoka_factory.null ()) { + _honoka_factory = + new HonokaFactory (utf8_mbstowcs (String (_("Honoka"))),String("ja_JP")); + } + return _honoka_factory; + } +} + +HonokaFactory::HonokaFactory() { + m_name = utf8_mbstowcs(_("Honoka")); + set_languages(String("ja_JP")); +} + +HonokaFactory::~ HonokaFactory() { +} + +HonokaFactory::HonokaFactory(const WideString & name, const String & languages) { + if (name.length () <= 8) + m_name = name; + else + m_name.assign (name.begin (), name.begin () + 8); + if (languages == String ("default")) + set_languages (String (_("ja_JP"))); + else + set_languages (languages); +} + +WideString HonokaFactory::get_name () const +{ + return m_name; +} + +WideString HonokaFactory::get_authors () const +{ + return utf8_mbstowcs (String (_("(C) 2004 TAM(Teppei Tamra) "))); +} + +WideString HonokaFactory::get_credits () const +{ + return WideString (); +} + +WideString HonokaFactory::get_help () const +{ + return utf8_mbstowcs (String (_("SCIM-WNN HELP"))); +} + +String HonokaFactory::get_uuid () const +{ + return String ("c069395a-d62f-4a77-8229-446e44a99976"); +} + +String HonokaFactory::get_icon_file () const +{ + return String (HONOKA_ICON_FILE); +} + +IMEngineInstancePointer HonokaFactory::create_instance (const String& encoding, int id) +{ + return new HonokaInstance (this, encoding, id); +} + + + +// �������٥�ȥ����å� + +void HonokaKeyEventList::append(const KeyEvent &k) { + push_back(k); +} + +void HonokaKeyEventList::append(int code,int mask) { + KeyEvent k; + k.code = code; + k.mask = mask; + append(k); +} + +bool HonokaKeyEventList::comp(const KeyEvent &k) { + int kc = k.get_ascii_code(); + if ((kc > 0x60) && (kc < 0x7b)) kc -= 0x20; + else if ((kc > 0x40) && (kc < 0x5b)) kc += 0x20; + for (unsigned int i = 0;i < size();i ++) { + if ((at(i).code == k.code) && (at(i).mask == k.mask)) { + return(true); + } + if (kc && (at(i).code == kc) && (at(i).mask == k.mask)) { + return(true); + } + } + return(false); +} + + +// ��ʪ�� + + +HonokaInstance::HonokaInstance (HonokaFactory *factory, const String& encoding, int id) + : IMEngineInstanceBase (factory, encoding, id) +{ + m_iconv.set_encoding ("EUC-JP"); + preeditors.push_back(new Romkan(_scim_config)); + preeditors.push_back(new KanaInput(_scim_config)); + m_preeditor = preeditors.at(0); + wnn = 0; + init(); +} + +HonokaInstance::~HonokaInstance() +{ + for(unsigned int i = 0;i < preeditors.size();i ++) { + delete(preeditors.at(i)); + } + if (wnn->isConnected()) wnn->disconnect(); +} + + +/*! + \fn HonokaInstance::init() + */ +void HonokaInstance::init() +{ + m_conversion = false; + m_yosoku = false; + m_lookup = false; + + // @todo if connected to jserver, should disconnect this. + + alp = _scim_config->read(String(HONOKA_CONFIG_ALP),HONOKA_DEFAULT_ALP); + mini_status = _scim_config->read(String(HONOKA_CONFIG_MINISTATUS),HONOKA_DEFAULT_MINISTATUS); + numkeyselect = _scim_config->read(String(HONOKA_CONFIG_NUMKEY_SELECT),HONOKA_DEFAULT_NUMKEY_SELECT); + yosoku = _scim_config->read(String(HONOKA_CONFIG_YOSOKU),HONOKA_DEFAULT_YOSOKU); + sType = _scim_config->read(String(HONOKA_CONFIG_SERVERTYPE),String(HONOKA_DEFAULT_SERVERTYPE)); + + if (wnn) delete(wnn); + #ifdef HAVE_LIBANTHY + if (sType == "Anthy") + wnn = new AnthyConversion(_scim_config); + else + #endif + wnn = new WnnConversion(_scim_config); + + + defaultPreEditor = _scim_config->read(String(HONOKA_CONFIG_DEFAULT_PREEDITOR),String(HONOKA_DEFAULT_DEFAULT_PREEDITOR)); + auto_conversion = _scim_config->read(String(HONOKA_CONFIG_AUTO_CONVERSION),HONOKA_DEFAULT_AUTO_CONVERSION);; + + // �ǥե���ȥ������ꡣ + scim_string_to_key_list(k_conversion_start, + _scim_config->read(String(HONOKA_CONFIG_KEY_CONVERSION_START), + String(HONOKA_DEFAULT_KEY_CONVERSION_START))); + scim_string_to_key_list(k_cancel, + _scim_config->read(String(HONOKA_CONFIG_KEY_CANCEL), + String(HONOKA_DEFAULT_KEY_CANCEL))); + scim_string_to_key_list(k_delete, + _scim_config->read(String(HONOKA_CONFIG_KEY_DELETE), + String(HONOKA_DEFAULT_KEY_DELETE))); + scim_string_to_key_list(k_backspace, + _scim_config->read(String(HONOKA_CONFIG_KEY_BACKSPACE), + String(HONOKA_DEFAULT_KEY_BACKSPACE))); + scim_string_to_key_list(k_commit, + _scim_config->read(String(HONOKA_CONFIG_KEY_COMMIT), + String(HONOKA_DEFAULT_KEY_COMMIT))); + scim_string_to_key_list(k_conversion_next, + _scim_config->read(String(HONOKA_CONFIG_KEY_CONVERSION_NEXT), + String(HONOKA_DEFAULT_KEY_CONVERSION_NEXT))); + scim_string_to_key_list(k_conversion_prev, + _scim_config->read(String(HONOKA_CONFIG_KEY_CONVERSION_PREV), + String(HONOKA_DEFAULT_KEY_CONVERSION_PREV))); + scim_string_to_key_list(k_conversion_expand, + _scim_config->read(String(HONOKA_CONFIG_KEY_CONVERSION_EXPAND), + String(HONOKA_DEFAULT_KEY_CONVERSION_EXPAND))); + scim_string_to_key_list(k_conversion_shrink, + _scim_config->read(String(HONOKA_CONFIG_KEY_CONVERSION_SHRINK), + String(HONOKA_DEFAULT_KEY_CONVERSION_SHRINK))); + scim_string_to_key_list(k_conversion_forward, + _scim_config->read(String(HONOKA_CONFIG_KEY_CONVERSION_FORWARD), + String(HONOKA_DEFAULT_KEY_CONVERSION_FORWARD))); + scim_string_to_key_list(k_conversion_backward, + _scim_config->read(String(HONOKA_CONFIG_KEY_CONVERSION_BACKWARD), + String(HONOKA_DEFAULT_KEY_CONVERSION_BACKWARD))); + scim_string_to_key_list(k_forward, + _scim_config->read(String(HONOKA_CONFIG_KEY_FORWARD), + String(HONOKA_DEFAULT_KEY_FORWARD))); + scim_string_to_key_list(k_backward, + _scim_config->read(String(HONOKA_CONFIG_KEY_BACKWARD), + String(HONOKA_DEFAULT_KEY_BACKWARD))); + scim_string_to_key_list(k_home, + _scim_config->read(String(HONOKA_CONFIG_KEY_HOME), + String(HONOKA_DEFAULT_KEY_HOME))); + scim_string_to_key_list(k_end, + _scim_config->read(String(HONOKA_CONFIG_KEY_END), + String(HONOKA_DEFAULT_KEY_END))); + scim_string_to_key_list(k_lookup_popup, + _scim_config->read(String(HONOKA_CONFIG_KEY_LOOKUPPOPUP), + String(HONOKA_DEFAULT_KEY_LOOKUPPOPUP))); + scim_string_to_key_list(k_lookup_pageup, + _scim_config->read(String(HONOKA_CONFIG_KEY_LOOKUPPAGEUP), + String(HONOKA_DEFAULT_KEY_LOOKUPPAGEUP))); + scim_string_to_key_list(k_lookup_pagedown, + _scim_config->read(String(HONOKA_CONFIG_KEY_LOOKUPPAGEDOWN), + String(HONOKA_DEFAULT_KEY_LOOKUPPAGEDOWN))); + scim_string_to_key_list(k_convert_hiragana, + _scim_config->read(String(HONOKA_CONFIG_KEY_CONVERT_HIRAGANA), + String(HONOKA_DEFAULT_KEY_CONVERT_HIRAGANA))); + scim_string_to_key_list(k_convert_katakana, + _scim_config->read(String(HONOKA_CONFIG_KEY_CONVERT_KATAKANA), + String(HONOKA_DEFAULT_KEY_CONVERT_KATAKANA))); + scim_string_to_key_list(k_convert_half, + _scim_config->read(String(HONOKA_CONFIG_KEY_CONVERT_HALF), + String(HONOKA_DEFAULT_KEY_CONVERT_HALF))); + scim_string_to_key_list(k_convert_wide, + _scim_config->read(String(HONOKA_CONFIG_KEY_CONVERT_WIDE), + String(HONOKA_DEFAULT_KEY_CONVERT_WIDE))); + + scim_string_to_key_list(k_conversion_rensou, + _scim_config->read(String(HONOKA_CONFIG_KEY_CONVERSION_RENSOU), + String(HONOKA_DEFAULT_KEY_CONVERSION_RENSOU))); + scim_string_to_key_list(k_conversion_ikeiji, + _scim_config->read(String(HONOKA_CONFIG_KEY_CONVERSION_IKEIJI), + String(HONOKA_DEFAULT_KEY_CONVERSION_IKEIJI))); + scim_string_to_key_list(k_select_yosoku, + _scim_config->read(String(HONOKA_CONFIG_KEY_SELECT_YOSOKU), + String(HONOKA_DEFAULT_KEY_SELECT_YOSOKU))); + scim_string_to_key_list(k_auto_conversion, + _scim_config->read(String(HONOKA_CONFIG_KEY_AUTO_CONVERSION), + String(HONOKA_DEFAULT_KEY_AUTO_CONVERSION))); + + changePreEditor(defaultPreEditor); + + // �����ǰ�����³���Ƥ������� + wnn->connect(); + +} + + +/*! + \fn HonokaInstance::changePreEditor(const String &name) + */ +void HonokaInstance::changePreEditor(const String &name) +{ + for(unsigned int i = 0;i < preeditors.size();i ++) { + if (preeditors[i]->getPropertyName() == name) { + m_preeditor = preeditors[i]; + return; + } + } + return; +} + + +/*! + \fn HonokaInstance::updateProperty() + */ +void HonokaInstance::updateProperty() +{ + if (m_proplist.empty()) { + Property p; + p = Property(SCIM_PROP_WNN_INPUTMODE,"",String(""),_("input mode")); + m_proplist.push_back(p); + for(unsigned int i = 0;i < preeditors.size();i ++) { + p = Property(String(SCIM_PROP_WNN_INPUTMODE) + String("/") + preeditors[i]->getPropertyName(), + preeditors[i]->getName(),String(""),_("mode status")); + m_proplist.push_back(p); + } + p = Property(SCIM_PROP_WNN_MODESTATUS,"",String(""),_("mode status")); + m_proplist.push_back(p); + p = Property(SCIM_PROP_WNN_CONVERSIONMODE,"",String(""),_("conversion mode")); + m_proplist.push_back(p); + } + PropertyList::iterator it; + it = find(m_proplist.begin(),m_proplist.end(),SCIM_PROP_WNN_INPUTMODE); + if (it != m_proplist.end()) { + it->set_label(m_preeditor->getName()); + } + update_property(*it); + it = find(m_proplist.begin(),m_proplist.end(),SCIM_PROP_WNN_MODESTATUS); + if (it != m_proplist.end()) { + if (m_conversion) it->set_label(_("Kanji")); + else if (m_yosoku) it->set_label(_("Yosoku")); + else it->set_label(m_preeditor->getModeName()); + } + update_property(*it); + it = find(m_proplist.begin(),m_proplist.end(),SCIM_PROP_WNN_CONVERSIONMODE); + if (it != m_proplist.end()) { + if (auto_conversion) it->set_label(_("AUTO")); + else it->set_label(_("REN")); + } + update_property(*it); + register_properties(m_proplist); +} + + +/*! + \fn HonokaInstance::updatePreEditor() + */ +void HonokaInstance::updatePreEditor() +{ + if (m_preeditor->getTextLength()) { + if (auto_conversion && (m_preeditor->getTextLength() == m_preeditor->getPos())) + autoConversion(); + else { + show_preedit_string(); + update_preedit_string(m_preeditor->getText(),m_preeditor->getAttributeList()); + update_preedit_caret(m_preeditor->getPos()); + } + if ((!m_conversion) && yosoku && wnn->isConnected() && (sType == "Wnn7") && (!auto_conversion)) { + m_convList = wnn->getYosokuList(m_preeditor->getText()); + if (m_convList.count) { + m_lookup_table.clear(); + for(unsigned int i = 0;i < m_convList.count;i ++) { + m_lookup_table.append_candidate(m_convList.kouho.at(i)); + } + startLookup(); + } else { + //m_lookup_table.clear(); + hide_lookup_table(); + } + } else hide_lookup_table(); + } else { + hide_preedit_string(); + hide_lookup_table(); + } + if (mini_status) { + update_aux_string(utf8_mbstowcs(m_preeditor->getModeName())); + show_aux_string(); + } else { + hide_aux_string(); + } + + updateProperty(); +} +/*! + \fn HonokaInstance::updateConversion() + */ +void HonokaInstance::updateConversion() +{ + update_preedit_string(wnn->getText(),wnn->getAttributeList()); + update_preedit_caret(wnn->getCaretPos()); + if (m_lookup) { + m_lookup_table.set_cursor_pos(m_convList.pos); + update_lookup_table(m_lookup_table); + show_lookup_table(); + } else { + hide_lookup_table(); + hide_aux_string(); + } + updateProperty(); +} + + +bool HonokaInstance::process_key_event (const KeyEvent& key) +{ + if (key.is_key_release()) return(false); + KeyEvent ke = key; + if (ke.mask & SCIM_KEY_CapsLockMask) ke.mask -= SCIM_KEY_CapsLockMask; + if (ke.mask & SCIM_KEY_NumLockMask) ke.mask -= SCIM_KEY_NumLockMask; + if (ke.mask & SCIM_KEY_ScrollLockMask) ke.mask -= SCIM_KEY_ScrollLockMask; + if (m_conversion) return(process_conversion_key_event(ke)); + else if (m_yosoku) return(process_yosoku_key_event(ke)); + else return(process_preedit_key_event(ke)); +} + + +/*! + \fn HonokaInstance::process_preedit_key_event(const KeyEvent &key) + */ +bool HonokaInstance::process_preedit_key_event(const KeyEvent &key) +{ + // PreEditor�Υ������٥�ȥեå��� + if (m_preeditor->keyEventHook(key)) { + updatePreEditor(); + return(true); + } else + + // �Хåե������Ǥ�̵����硣 + if (m_preeditor->getTextLength()) { + if (k_conversion_start.comp(key)) { + startConversion(m_preeditor->getText(true)); + alp_count ++; + return(true); + } else + if (k_commit.comp(key)) { + if (auto_conversion) { + commit_string(wnn->getText()); + wnn->reset(); + } else commit_string(m_preeditor->getText(true)); + m_preeditor->reset(); + updatePreEditor(); + return(true); + } else + if (k_forward.comp(key) || k_backward.comp(key)) { + k_backward.comp(key) ? m_preeditor->setPos(m_preeditor->getPos() - 1) : m_preeditor->setPos(m_preeditor->getPos() + 1); + updatePreEditor(); + return(true); + } else + if (k_home.comp(key) || k_end.comp(key)) { + k_end.comp(key) ? m_preeditor->setPos(m_preeditor->getTextLength()) : m_preeditor->setPos(0); + updatePreEditor(); + return(true); + } else + if ((k_backspace.comp(key)) || (k_delete.comp(key))) { + k_backspace.comp(key) ? m_preeditor->backspace(): m_preeditor->del(); + updatePreEditor(); + return(true); + } else + if (k_convert_hiragana.comp(key)) { + m_preeditor->kataHira(); + updatePreEditor(); + return(true); + } else + if (k_convert_katakana.comp(key)) { + m_preeditor->hiraKata(); + updatePreEditor(); + return(true); + } else + if (k_convert_half.comp(key)) { + m_preeditor->toHalf(); + updatePreEditor(); + return(true); + } else + if (k_convert_wide.comp(key)) { + m_preeditor->toWide(); + updatePreEditor(); + return(true); + } else + if (k_select_yosoku.comp(key) && yosoku) { + if ((m_convList.kType == YOSOKU) && (m_convList.count)) { + return(process_yosoku_key_event(key)); + } + } + } + + // �Хåե���¸�ߤˤ�����餺�� + if (k_cancel.comp(key)) { + if (m_preeditor->cancelEvent()) { + updatePreEditor(); + return(true); + } + if (m_preeditor->getTextLength()) { + m_preeditor->reset(); + } + updatePreEditor(); + return(true); + } + + if (k_auto_conversion.comp(key)) { + auto_conversion ? auto_conversion = false : auto_conversion = true; + updatePreEditor(); + return(true); + } + + if (m_preeditor->inputEvent(key)) { + updatePreEditor(); + + return(true); + } else { + // preeditor�ǽ����Ǥ��ʤ��ä����Ϥ�Ϥ�commit���ƥ��ץꥱ���������֤��٤����� + if (m_preeditor->getTextLength()) { + if (auto_conversion) { + commit_string(wnn->getText()); + wnn->reset(); + } else commit_string(m_preeditor->getText(true)); + } + m_preeditor->reset(); + updatePreEditor(); + } + + return(false); +} + +/*! + \fn HonokaInstance::process_conversion_key_event(const KeyEvent &key) + */ +bool HonokaInstance::process_conversion_key_event(const KeyEvent &key) +{ + if ((key.code == SCIM_KEY_Shift_L) || + (key.code == SCIM_KEY_Shift_R) || + (key.code == SCIM_KEY_Control_L) || + (key.code == SCIM_KEY_Control_R) || + (key.code == SCIM_KEY_Alt_L) || + (key.code == SCIM_KEY_Alt_R) || + (key.code == SCIM_KEY_Super_L) || + (key.code == SCIM_KEY_Super_R) || + (key.code == SCIM_KEY_Hyper_L) || + (key.code == SCIM_KEY_Hyper_R)) return(true); + + if ((alp <= alp_count) && (alp != 0)) { + if (!m_lookup) startLookup(); + } + + if (k_lookup_popup.comp(key)) { + if (m_lookup) return(true); + startLookup(); + return(true); + } else + if (k_lookup_pageup.comp(key)) { + if (m_lookup) { + lookup_table_page_up(); + } + } else + if (k_lookup_pagedown.comp(key)) { + if (m_lookup) { + lookup_table_page_down(); + } + } else + if (k_commit.comp(key)) { + commit_string(wnn->getText()); + wnn->updateFrequency(); + m_preeditor->reset(); + wnn->reset(); + m_conversion = false; + updatePreEditor(); + m_lookup = false; + alp_count = 1; + return(true); + } else + if (k_cancel.comp(key) || k_backspace.comp(key)) { + wnn->reset(); + m_conversion = false; + m_lookup = false; + alp_count = 0; + updatePreEditor(); + return(true); + } else + if (k_conversion_next.comp(key) || k_conversion_prev.comp(key)) { + k_conversion_prev.comp(key) ? m_convList.pos --: m_convList.pos ++; + if (m_convList.pos >= m_convList.count) m_convList.pos = 0; + else if (m_convList.pos < 0) m_convList.pos = m_convList.count - 1; + alp_count ++; + + wnn->select(m_convList.pos); + updateConversion(); + return(true); + } else + if (k_conversion_expand.comp(key) || k_conversion_shrink.comp(key)) { + bool r; + k_conversion_shrink.comp(key) ? r = wnn->resizeRegion(-1) : r = wnn->resizeRegion(1); + if (!r) return(true); + m_convList = wnn->getResultList(); + if (alp == -1) { + startLookup(); + } else m_lookup = false; + updateConversion(); + alp_count = 1; + return(true); + } else + if (k_conversion_rensou.comp(key) && ((sType == "Wnn7") || (sType == "Wnn8")) ) { + m_convList = wnn->getResultList(wnn->getPos(),RENSOU); + if (m_convList.count == 0) return(true); + startLookup(); + updateConversion(); + alp_count = 1; + return(true); + } else + if (k_conversion_ikeiji.comp(key) && ((sType == "Wnn7") || (sType == "Wnn8")) ) { + m_convList = wnn->getResultList(wnn->getPos(),IKEIJI); + if (m_convList.count == 0) return(true); + startLookup(); + updateConversion(); + alp_count = 1; + return(true); + } else + if (k_conversion_forward.comp(key) || k_conversion_backward.comp(key)) { + k_conversion_backward.comp(key) ? wnn->setPos(wnn->getPos() - 1) : wnn->setPos(wnn->getPos() + 1); + m_convList = wnn->getResultList(); + if (alp == -1) { + startLookup(); + } else m_lookup = false; + updateConversion(); + alp_count = 1; + return(true); + } else + if (k_convert_hiragana.comp(key) || k_convert_katakana.comp(key)) { + WideString res = m_convList.Yomi; + k_convert_hiragana.comp(key) ? m_preeditor->convKataHira(res) : m_preeditor->convHiraKata(res); + for(unsigned int i = 0;i < m_convList.count;i ++) { + if (res == m_convList.kouho[i]) { + m_convList.pos = i; + wnn->select(m_convList.pos); + updateConversion(); + break; + } + } + return(true); + } else + if (key.get_ascii_code()) { + if (key.mask & (SCIM_KEY_AltMask | SCIM_KEY_ControlMask)) return(false); + if (m_lookup && numkeyselect) { + char numk[] = "1234567890"; + int numc = 0; + bool numkey = false; + for(;numk[numc]; ++ numc) { + if (key.get_ascii_code() == numk[numc]) { + numkey = true; + break; + } + } + if (numkey) { + if (m_lookup_table.get_current_page_size() < numc) return(true); + m_convList.pos = numc + m_lookup_table.get_current_page_start(); + wnn->select(m_convList.pos); + wnn->setPos(wnn->getPos() + 1); + m_convList = wnn->getResultList(); + updateConversion(); + startLookup(); + return(true); + } + } + + commit_string(wnn->getText()); + wnn->updateFrequency(); + m_preeditor->reset(); + wnn->reset(); + m_conversion = false; + m_lookup = false; + alp_count = 0; + updatePreEditor(); + return(process_preedit_key_event(key)); + } + + + return(true); +} + + + +/*! + \fn HonokaInstance::process_yosoku_key_event(const KeyEvent &key) + */ +bool HonokaInstance::process_yosoku_key_event(const KeyEvent &key) +{ + if (!m_yosoku) { + m_yosoku = true; + update_preedit_string(m_convList.kouho.at(m_convList.pos)); + update_preedit_caret(0); + show_preedit_string(); + updateProperty(); + return(true); + } + + if (k_lookup_pageup.comp(key)) { + lookup_table_page_up(); + return(true); + } else + if (k_lookup_pagedown.comp(key)) { + lookup_table_page_down(); + return(true); + } else + if (k_conversion_next.comp(key) || k_conversion_prev.comp(key) || k_select_yosoku.comp(key)) { + k_conversion_prev.comp(key) ? m_convList.pos --: m_convList.pos ++; + if (m_convList.pos >= m_convList.count) m_convList.pos = 0; + else if (m_convList.pos < 0) m_convList.pos = m_convList.count - 1; + m_lookup_table.set_cursor_pos(m_convList.pos); + update_lookup_table(m_lookup_table); + update_preedit_string(m_convList.kouho.at(m_convList.pos)); + update_preedit_caret(0); +// select_candidate((unsigned int)m_convList.pos); + updateProperty(); + return(true); + } else + if (k_commit.comp(key)) { + m_yosoku = false; + commit_string(m_convList.kouho.at(m_convList.pos)); + m_preeditor->reset(); + updatePreEditor(); + return(true); + } else + if (k_cancel.comp(key) || k_backspace.comp(key)) { + m_yosoku = false; + updatePreEditor(); + return(true); + } + if (!key.get_ascii_code()) return(true); + if ((!(key.is_control_down() || key.is_alt_down() || key.is_shift_down())) && numkeyselect) { + char numk[] = "1234567890"; + for(int numc = 0;numk[numc]; ++ numc) { + if (key.get_ascii_code() == numk[numc]) { + if (m_lookup_table.get_current_page_size() > numc) + select_candidate((unsigned int)numc); + return(true); + } + } + } + + m_yosoku = false; + commit_string(m_convList.kouho.at(m_convList.pos)); + m_preeditor->reset(); + updatePreEditor(); + return(process_preedit_key_event(key)); +} + + + +void HonokaInstance::move_preedit_caret (unsigned int pos) +{ + //if (!m_conversion) m_preeditor->setPos(pos); + //update_preedit_caret(pos); +} + +void HonokaInstance::select_candidate (unsigned int item) +{ + if (!m_lookup_table.number_of_candidates()) return; + + int p = m_lookup_table.get_current_page_start() + item; + m_convList.pos = p; + wnn->select(m_convList.pos); + if (m_convList.kType != YOSOKU) { + update_preedit_string(wnn->getText(),wnn->getAttributeList()); + update_preedit_caret(wnn->getCaretPos()); + } else { + update_preedit_string(m_convList.kouho.at(m_convList.pos)); + update_preedit_caret(0); + if (!m_yosoku) { + // �ޥ��������򤷤�����ͽ¬����⡼�ɤ������� + m_yosoku = true; + show_preedit_string(); + updateProperty(); + } + } + m_lookup_table.set_cursor_pos(m_convList.pos); + update_lookup_table(m_lookup_table); +} + +void HonokaInstance::update_lookup_table_page_size (unsigned int page_size) +{ + m_lookup_table.set_page_size (page_size); +} + +void HonokaInstance::lookup_table_page_up () +{ + if (!m_lookup_table.number_of_candidates () || !m_lookup_table.get_current_page_start ()) return; + + int p = m_convList.pos - m_lookup_table.get_current_page_size(); + if (p < 0) p = 0; + m_convList.pos = p; + wnn->select(m_convList.pos); + update_preedit_string(wnn->getText(),wnn->getAttributeList()); + update_preedit_caret(wnn->getCaretPos()); + m_lookup_table.set_cursor_pos(m_convList.pos); + update_lookup_table(m_lookup_table); +} + +void HonokaInstance::lookup_table_page_down () +{ + if (!m_lookup_table.number_of_candidates () || + m_lookup_table.get_current_page_start () + m_lookup_table.get_current_page_size () >= + m_lookup_table.number_of_candidates ()) + return; + + int p = m_convList.pos + m_lookup_table.get_current_page_size(); + if (p >= m_convList.count) p = m_convList.count - 1; + m_convList.pos = p; + wnn->select(m_convList.pos); + update_preedit_string(wnn->getText(),wnn->getAttributeList()); + update_preedit_caret(wnn->getCaretPos()); + m_lookup_table.set_cursor_pos(m_convList.pos); + update_lookup_table(m_lookup_table); +} + +void HonokaInstance::reset () +{ + // Qt-immodule+scim-qtimm�ǤϤ��Υ᥽�åɤ����̤˸ƤФ��褦������¾�ǤϤɤ��ʤΤ����� + alp_count = 0; + m_conversion = false; + m_lookup = false; + wnn->reset(); + m_preeditor->reset(); + //if (wnn->isConnected()) wnn->wnnDisconnect(); + //wnn->wnnConnect(String("scim-wnn"),host,rc,sType,0); + //updatePreEditor(); +} + +void HonokaInstance::focus_in () +{ + if (!m_conversion) updatePreEditor(); + else updateProperty(); +} + +void HonokaInstance::focus_out () +{ + if (m_conversion) { + commit_string(wnn->getText()); + wnn->updateFrequency(); + wnn->reset(); + m_conversion = false; + m_lookup = false; + alp_count = 0; + } else if (m_preeditor->getTextLength()) { + commit_string(m_preeditor->getText(true)); + } + m_preeditor->reset(); + updatePreEditor(); +} + +void HonokaInstance::trigger_property (const String &property) +{ + String s = SCIM_PROP_WNN_INPUTMODE; + if ((property.length() > s.length()) && (property.substr(0,s.length()) == s)) { + changePreEditor(property.substr(s.length() + 1)); + updateProperty(); + } + s = SCIM_PROP_WNN_CONVERSIONMODE; + if (property == s) { + auto_conversion ? auto_conversion = false : auto_conversion = true; + updatePreEditor(); + } +} + + + + + + +/*! + \fn HonokaInstance::startConversion(WideString s) + */ +void HonokaInstance::startConversion(WideString s) +{ + // ����lookup�Ͼä��Ƥ������� + m_lookup = false; + m_lookup_table.clear(); + hide_lookup_table(); + + hide_aux_string(); + if (!wnn->isConnected()) { + if (!wnn->connect()) { + update_aux_string(utf8_mbstowcs(String(_("could not connect to jserver.")))); + show_aux_string(); + return; + } + } + + wnn->setYomiText(s); + if (wnn->ren_conversion() == -1) { + update_aux_string(utf8_mbstowcs(String(_("could not connect to jserver.")))); + show_aux_string(); + return; + } + m_convList.kouho.clear(); + m_convList = wnn->getResultList(); + m_conversion = true; + + alp_count = 1; + + show_preedit_string(); + update_preedit_string(wnn->getText(),wnn->getAttributeList()); + update_preedit_caret(wnn->getCaretPos()); + if (alp == -1) { + startLookup(); + } + updateProperty(); +} + + +/*! + \fn HonokaInstance::autoConversion() + */ +void HonokaInstance::autoConversion() +{ + if (!wnn->isConnected()) { + if (!wnn->connect()) { + update_aux_string(utf8_mbstowcs(String(_("could not connect to jserver.")))); + show_aux_string(); + show_preedit_string(); + update_preedit_string(m_preeditor->getText(),m_preeditor->getAttributeList()); + update_preedit_caret(m_preeditor->getPos()); + return; + } + } + + wnn->reset(); + wnn->setYomiText(m_preeditor->getText(true)); + if (wnn->ren_conversion() == -1) { + update_aux_string(utf8_mbstowcs(String(_("could not connect to jserver.")))); + show_aux_string(); + show_preedit_string(); + update_preedit_string(m_preeditor->getText(),m_preeditor->getAttributeList()); + update_preedit_caret(m_preeditor->getPos()); + return; + } + + show_preedit_string(); + update_preedit_string(wnn->getText()); + update_preedit_caret(wnn->getText().size()); +} + + +/*! + \fn HonokaInstance::createLookupTable(ResultList cList) + */ +void HonokaInstance::createLookupTable(ResultList cList) +{ + hide_lookup_table(); + m_lookup_table.clear(); + if (!cList.count) return; + for (unsigned int i = 0;i < cList.count;i ++) { + m_lookup_table.append_candidate(cList.kouho.at(i)); + } + m_lookup_table.set_cursor_pos(cList.pos); + update_lookup_table(m_lookup_table); +} + + +/*! + \fn HonokaInstance::startLookup() + */ +void HonokaInstance::startLookup() +{ + createLookupTable(m_convList); + if (m_convList.count == 0) return; + m_lookup = true; + switch(m_convList.kType) { + case IKEIJI: { + update_aux_string(utf8_mbstowcs(String(_("Ikeiji lookup result")))); + break; + } + case RENSOU: { + update_aux_string(utf8_mbstowcs(String(_("association lookup result")))); + break; + } + case YOSOKU: { + update_aux_string(utf8_mbstowcs(String(_("yosoku lookup result")))); + break; + } + default: { + update_aux_string(utf8_mbstowcs(String(_("lookup result")))); + break; + } + } + show_aux_string(); + show_lookup_table(); +} + + + + + + diff --git a/honoka/src/honoka_imengine.h b/honoka/src/honoka_imengine.h new file mode 100644 index 0000000..2afff4e --- /dev/null +++ b/honoka/src/honoka_imengine.h @@ -0,0 +1,157 @@ +/*************************************************************************** + * Copyright (C) 2004 by TAM(Teppei Tamra) * + * tam-t@par.odn.ne.jp * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef SCIM_WNN_IMENGINE_H +#define SCIM_WNN_IMENGINE_H + +#include +#include +#include +#include +#include +#include +#include +#define Uses_SCIM_ICONV +#include +#include + +#ifdef HAVE_CONFIG_H +#include +#endif + + +using namespace scim; +using namespace std; + +class HonokaFactory : public IMEngineFactoryBase +{ +protected: + friend class HonokaInstance; + WideString m_name; +public: + HonokaFactory (); + HonokaFactory (const WideString & name, const String & languages); + virtual ~HonokaFactory (); + virtual WideString get_name () const; + virtual WideString get_authors () const; + virtual WideString get_credits () const; + virtual WideString get_help () const; + virtual String get_uuid () const; + virtual String get_icon_file () const; + virtual IMEngineInstancePointer create_instance (const String& encoding, int id = -1); +protected: + +}; + +class HonokaKeyEventList : public KeyEventList +{ + // �ꥹ�Ȥ˥������٥�Ȥ��ɲä��ơ�comp(KeyEvent)��Ƚ�̡� +public: + void append(const KeyEvent &k); + void append(int code,int mask); + bool comp(const KeyEvent &k); +}; + + +class HonokaInstance : public IMEngineInstanceBase +{ +public: + HonokaInstance (HonokaFactory *factory, const String &encoding, int id = -1); + virtual ~HonokaInstance (); + virtual bool process_key_event (const KeyEvent& key); + virtual void move_preedit_caret (unsigned int pos); + virtual void select_candidate (unsigned int item); + virtual void update_lookup_table_page_size (unsigned int page_size); + virtual void lookup_table_page_up (); + virtual void lookup_table_page_down (); + virtual void reset (); + virtual void focus_in (); + virtual void focus_out (); + virtual void trigger_property (const String &property); + void startLookup(); + +protected: + CommonLookupTable m_lookup_table; + PreEditor *m_preeditor; + Convertor *wnn; + bool m_conversion; + bool m_yosoku; + bool m_lookup; + ResultList m_convList; + PropertyList m_proplist; + int alp; + int alp_count; + bool numkeyselect; + bool mini_status; + bool yosoku; + bool auto_conversion; + String defaultPreEditor; + IConvert m_iconv; + vector preeditors; + String sType; +protected: + bool process_preedit_key_event(const KeyEvent &key); + bool process_conversion_key_event(const KeyEvent &key); + bool process_yosoku_key_event(const KeyEvent &key); + void startConversion(WideString s); + void createLookupTable(ResultList cList); + void init(); + void updatePreEditor(); + void updateProperty(); + void updateConversion(); + void changePreEditor(const String &name); + void autoConversion(); + +private: + HonokaKeyEventList + k_conversion_start, // �Ѵ����� + k_cancel, // ����󥻥륭�� + k_delete, // ��� + k_backspace, // �Хå����ڡ��� + k_commit, // ���� + k_conversion_next, // ������ + k_conversion_prev, // ������ + k_conversion_expand, // ���� + k_conversion_shrink, // �̾� + k_conversion_forward, // ��ʸ�� + k_conversion_backward, // ��ʸ�� + k_forward, // ���������ư/�� + k_backward, // ���������ư/��� + k_home, // ���������ư/��Ƭ + k_end, // ���������ư/���� + k_lookup_popup, // �������ɽ�� + k_lookup_pageup, // ����������� + k_lookup_pagedown, // ����������� + k_convert_hiragana, // �Ҥ餬���Ѵ� + k_convert_katakana, // ���������Ѵ� + k_convert_half, // Ⱦ���Ѵ� + k_convert_wide, // �����Ѵ� + k_auto_conversion, // �Ѵ��⡼�ɥȥ��� + + // for Wnn7 + k_conversion_ikeiji, // �۷����Ѵ� + k_conversion_rensou, // Ϣ���Ѵ� + k_select_yosoku, // ͽ¬���� + + k_dummy; +}; + + +#endif + diff --git a/honoka/src/honoka_imengine_setup.cpp b/honoka/src/honoka_imengine_setup.cpp new file mode 100644 index 0000000..194cfb8 --- /dev/null +++ b/honoka/src/honoka_imengine_setup.cpp @@ -0,0 +1,1134 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Copyright (C) 2004 TAM (Teppei Tamra) + * Copyright (C) 2004 Hiroyuki Ikezoe + * Copyright (C) 2004 Takuro Ashie + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* + * Based on scim-hangul. + * Copyright (c) 2004 James Su + */ + +#define Uses_SCIM_CONFIG_BASE + +#include + +#ifdef HAVE_CONFIG_H + #include +#endif + +#include +#include +#include "honoka_def.h" + +#ifdef HAVE_GETTEXT + #include + #define _(String) dgettext(GETTEXT_PACKAGE,String) + #define N_(String) (String) +#else + #define _(String) (String) + #define N_(String) (String) + #define bindtextdomain(Package,Directory) + #define textdomain(domain) + #define bind_textdomain_codeset(domain,codeset) +#endif + +using namespace scim; + +#define scim_module_init honoka_imengine_setup_LTX_scim_module_init +#define scim_module_exit honoka_imengine_setup_LTX_scim_module_exit + +#define scim_setup_module_create_ui honoka_imengine_setup_LTX_scim_setup_module_create_ui +#define scim_setup_module_get_category honoka_imengine_setup_LTX_scim_setup_module_get_category +#define scim_setup_module_get_name honoka_imengine_setup_LTX_scim_setup_module_get_name +#define scim_setup_module_get_description honoka_imengine_setup_LTX_scim_setup_module_get_description +#define scim_setup_module_load_config honoka_imengine_setup_LTX_scim_setup_module_load_config +#define scim_setup_module_save_config honoka_imengine_setup_LTX_scim_setup_module_save_config +#define scim_setup_module_query_changed honoka_imengine_setup_LTX_scim_setup_module_query_changed + + + +static GtkWidget * create_setup_window (); +static void load_config (const ConfigPointer &config); +static void save_config (const ConfigPointer &config); +static bool query_changed (); + +// Module Interface. + +extern "C" { + void scim_module_init (void) + { + bindtextdomain (GETTEXT_PACKAGE, HONOKA_LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + } + + void scim_module_exit (void) + { + } + + GtkWidget * scim_setup_module_create_ui (void) + { + return create_setup_window (); + } + + String scim_setup_module_get_category (void) + { + return String ("IMEngine"); + } + + String scim_setup_module_get_name (void) + { + return String (_("Honoka")); + } + + String scim_setup_module_get_description (void) + { + return String (_("A Honoka IMEngine Module.")); + } + + void scim_setup_module_load_config (const ConfigPointer &config) + { + load_config (config); + } + + void scim_setup_module_save_config (const ConfigPointer &config) + { + save_config (config); + } + + bool scim_setup_module_query_changed () + { + return query_changed (); + } +} // extern "C" + + +// Internal data structure +struct KeyboardConfigData +{ + const char *key; + String data; + const char *label; + const char *title; + const char *tooltip; + GtkWidget *entry; + GtkWidget *button; +}; + +struct KeyboardConfigPage +{ + const char *label; + KeyboardConfigData *data; +}; + +struct ListData +{ + GtkWidget *widget; + String name; + gchar *label; +}; + +// Internal data declaration. +//static bool __config_use_kana = false; +static String __config_server = HONOKA_DEFAULT_SERVER; +static String __config_wnn_rc = HONOKA_DEFAULT_RC; +static String __config_servertype = HONOKA_DEFAULT_SERVERTYPE; +static String __config_preeditor = HONOKA_DEFAULT_DEFAULT_PREEDITOR; +static bool __config_yosoku = HONOKA_DEFAULT_YOSOKU; +static bool __config_numkeyselect = HONOKA_DEFAULT_NUMKEY_SELECT; +static bool __config_autoconversion = HONOKA_DEFAULT_AUTO_CONVERSION; +static int __config_alp = HONOKA_DEFAULT_ALP; +static String __config_romkan_table = HONOKA_DEFAULT_ROMKAN_TABLE_FILE; + +static bool __have_changed = true; + +//static GtkWidget * __widget_use_kana = 0; +static GtkWidget * __widget_server = 0; +static GtkWidget * __widget_servertype = 0; +static GtkWidget * __widget_preeditor = 0; +static GtkWidget * __widget_wnn_rc = 0; +static GtkWidget * __widget_yosoku = 0; +static GtkWidget * __widget_alp = 0; +static GtkWidget * __widget_numkeyselect = 0; +static GtkWidget * __widget_autoconversion = 0; +static GtkWidget * __widget_romkan_table = 0; +static GtkTooltips * __widget_tooltips = 0; + +static ListData __list_data [] = +{ + { + NULL, + String("Wnn4"), + N_("Wnn4 or FreeWnn"), + }, + { + NULL, + String("Wnn6"), + N_("Wnn6"), + }, + { + NULL, + String("Wnn7"), + N_("Wnn7"), + }, + { + NULL, + String("Wnn8"), + N_("Wnn8"), + }, + { + NULL, + String("Romkan"), + N_("Roma-Kana input"), + }, + { + NULL, + String("KanaInput"), + N_("Kana input"), + }, + { + NULL, + String(), + NULL, + }, +}; + +static KeyboardConfigData __config_keyboards_common [] = +{ + { + HONOKA_CONFIG_KEY_COMMIT, + HONOKA_DEFAULT_KEY_COMMIT, + N_("Commit keys:"), + N_("Select commit keys"), + N_("The key events to commit the preedit string. "), + NULL, + NULL, + }, + { + HONOKA_CONFIG_KEY_CONVERSION_START, + HONOKA_DEFAULT_KEY_CONVERSION_START, + N_("Convert keys:"), + N_("Select convert keys"), + N_("The key events to convert the preedit string to kanji. "), + NULL, + NULL, + }, + { + HONOKA_CONFIG_KEY_CANCEL, + HONOKA_DEFAULT_KEY_CANCEL, + N_("Cancel keys:"), + N_("Select cancel keys"), + N_("The key events to cancel preediting or converting. "), + NULL, + NULL, + }, + { + HONOKA_CONFIG_KEY_BACKSPACE, + HONOKA_DEFAULT_KEY_BACKSPACE, + N_("Backspace keys:"), + N_("Select backspace keys"), + N_("The key events to delete a character before caret. "), + NULL, + NULL, + }, + { + HONOKA_CONFIG_KEY_DELETE, + HONOKA_DEFAULT_KEY_DELETE, + N_("Delete keys:"), + N_("Select delete keys"), + N_("The key events to delete a character after caret. "), + NULL, + NULL, + }, + { + NULL, + "", + NULL, + NULL, + NULL, + NULL, + NULL, + }, +}; + +static KeyboardConfigData __config_keyboards_caret [] = +{ + { + HONOKA_CONFIG_KEY_FORWARD, + HONOKA_DEFAULT_KEY_FORWARD, + N_("Move forward keys:"), + N_("Select move caret forward keys"), + N_("The key events to move the caret to forward. "), + NULL, + NULL, + }, + { + HONOKA_CONFIG_KEY_BACKWARD, + HONOKA_DEFAULT_KEY_BACKWARD, + N_("Move backward keys:"), + N_("Select move caret backward keys"), + N_("The key events to move the caret to backward. "), + NULL, + NULL, + }, + { + NULL, + "", + NULL, + NULL, + NULL, + NULL, + NULL, + }, +}; + +static KeyboardConfigData __config_keyboards_segment [] = +{ + { + HONOKA_CONFIG_KEY_CONVERSION_FORWARD, + HONOKA_DEFAULT_KEY_CONVERSION_FORWARD, + N_("Next segment keys:"), + N_("Select next segment keys"), + N_("The key events to select next segment. "), + NULL, + NULL, + }, + { + HONOKA_CONFIG_KEY_CONVERSION_BACKWARD, + HONOKA_DEFAULT_KEY_CONVERSION_BACKWARD, + N_("Previous segment keys:"), + N_("Select previous segment keys"), + N_("The key events to select previous segment. "), + NULL, + NULL, + }, + { + HONOKA_CONFIG_KEY_CONVERSION_SHRINK, + HONOKA_DEFAULT_KEY_CONVERSION_SHRINK, + N_("Shrink segment keys:"), + N_("Select shrink segment keys"), + N_("The key events to shrink the selected segment. "), + NULL, + NULL, + }, + { + HONOKA_CONFIG_KEY_CONVERSION_EXPAND, + HONOKA_DEFAULT_KEY_CONVERSION_EXPAND, + N_("Expand segment keys:"), + N_("Select expand segment keys"), + N_("The key events to expand the selected segment. "), + NULL, + NULL, + }, + { + NULL, + "", + NULL, + NULL, + NULL, + NULL, + NULL, + }, +}; + +static KeyboardConfigData __config_keyboards_candidates [] = +{ + { + HONOKA_CONFIG_KEY_CONVERSION_NEXT, + HONOKA_DEFAULT_KEY_CONVERSION_NEXT, + N_("Next keys:"), + N_("Select next candidate keys"), + N_("The key events to select next candidate. "), + NULL, + NULL, + }, + { + HONOKA_CONFIG_KEY_CONVERSION_PREV, + HONOKA_DEFAULT_KEY_CONVERSION_PREV, + N_("Previous keys:"), + N_("Select previous candidate keys"), + N_("The key events to select previous candidate. "), + NULL, + NULL, + }, + { + HONOKA_CONFIG_KEY_LOOKUPPOPUP, + HONOKA_DEFAULT_KEY_LOOKUPPOPUP, + N_("candidates list keys:"), + N_("Select candidates list keys"), + N_("The key events to popup candidates list. "), + NULL, + NULL, + }, + { + HONOKA_CONFIG_KEY_LOOKUPPAGEUP, + HONOKA_DEFAULT_KEY_LOOKUPPAGEUP, + N_("Page up keys:"), + N_("Select page up candidates keys"), + N_("The key events to select page up candidates. "), + NULL, + NULL, + }, + { + HONOKA_CONFIG_KEY_LOOKUPPAGEDOWN, + HONOKA_DEFAULT_KEY_LOOKUPPAGEDOWN, + N_("Page down keys:"), + N_("Select page down candidates keys"), + N_("The key events to select page down candidates. "), + NULL, + NULL, + }, + { + NULL, + "", + NULL, + NULL, + NULL, + NULL, + NULL, + }, +}; + +static KeyboardConfigData __config_keyboards_other [] = +{ + { + HONOKA_CONFIG_KEY_AUTO_CONVERSION, + HONOKA_DEFAULT_KEY_AUTO_CONVERSION, + N_("auto conversion mode keys:"), + N_("Select auto conversion mode keys"), + N_("The key events to change auto conversion mode. "), + NULL, + NULL, + }, + { + HONOKA_CONFIG_KEY_SELECT_YOSOKU, + HONOKA_DEFAULT_KEY_SELECT_YOSOKU, + N_("Yosoku keys:"), + N_("Select yosoku keys"), + N_("The key events to select from completion list. "), + NULL, + NULL, + }, + { + HONOKA_CONFIG_KEY_CONVERSION_IKEIJI, + HONOKA_DEFAULT_KEY_CONVERSION_IKEIJI, + N_("Convert to ikeiji keys:"), + N_("Select ikeiji keys"), + N_("The key events to convert the selected candidate to ikei-kanji. "), + NULL, + NULL, + }, + { + HONOKA_CONFIG_KEY_CONVERSION_RENSOU, + HONOKA_DEFAULT_KEY_CONVERSION_RENSOU, + N_("Convert to rensou keys:"), + N_("Select rensou keys"), + N_("The key events to convert the selected candidate to the associated acceptation string. "), + NULL, + NULL, + }, + { + HONOKA_CONFIG_KEY_CONVERT_HIRAGANA, + HONOKA_DEFAULT_KEY_CONVERT_HIRAGANA, + N_("Convert to HIRAGANA keys:"), + N_("Select convert to HIRAGANA keys"), + N_("The key events to convert the selected candidate or the preedit string to HIRAGANA. "), + NULL, + NULL, + }, + { + HONOKA_CONFIG_KEY_CONVERT_KATAKANA, + HONOKA_DEFAULT_KEY_CONVERT_KATAKANA, + N_("Convert to KATAKANA keys:"), + N_("Select convert to KATAGANA keys"), + N_("The key events to convert the selected candidate or the preedit string to KATAKANA. "), + NULL, + NULL, + }, + { + NULL, + "", + NULL, + NULL, + NULL, + NULL, + NULL, + }, +}; + +static struct KeyboardConfigPage __key_conf_pages[] = +{ + {N_("Common keys"), __config_keyboards_common}, + {N_("Preedit keys"), __config_keyboards_caret}, + {N_("Candidates keys"), __config_keyboards_candidates}, + {N_("Other function keys"), __config_keyboards_other}, +}; +static unsigned int __key_conf_pages_num = sizeof (__key_conf_pages) / sizeof (KeyboardConfigPage); + +static void on_default_editable_changed (GtkEditable *editable, + gpointer user_data); +static void on_default_number_changed (GtkEditable *editable, + gpointer user_data); +static void on_default_toggle_button_toggled (GtkToggleButton *togglebutton, + gpointer user_data); +static void on_default_key_selection_clicked (GtkButton *button, + gpointer user_data); +static void on_default_file_selection_button (GtkButton *button, + gpointer user_data); +static void on_default_list_changed (GtkList *list, + GtkWidget *widget, + gpointer user_data); +static void setup_widget_value (void); + + +static GtkWidget * +create_options_page () +{ + GtkWidget *vbox, *table, *label, *button, *button2; + unsigned int i; + GList *list = NULL; + + vbox = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox); + + for(i = 0;__list_data[i].label;i ++) { + __list_data[i].widget = gtk_list_item_new_with_label(_(__list_data[i].label)); + gtk_widget_show (__list_data[i].widget); + } + + //__widget_use_kana = gtk_check_button_new_with_mnemonic (_("Use _Kana Table")); + //gtk_widget_show (__widget_use_kana); + //gtk_box_pack_start (GTK_BOX (vbox), __widget_use_kana, FALSE, FALSE, 4); + //gtk_container_set_border_width (GTK_CONTAINER (__widget_use_kana), 4); + + // Connect all signals. + //g_signal_connect ((gpointer) __widget_use_kana, "toggled", + // G_CALLBACK (on_default_toggle_button_toggled), + // &__config_use_kana); + + table = gtk_table_new (3, 6, FALSE); + gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0); + gtk_widget_show (table); + + /* server */ + label = gtk_label_new_with_mnemonic (_("_Server: ")); + gtk_widget_show (label); + gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); + gtk_misc_set_padding (GTK_MISC (label), 4, 0); + gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 4, 4); + + __widget_server = gtk_entry_new (); + gtk_widget_show (__widget_server); + gtk_table_attach (GTK_TABLE (table), __widget_server, 1, 2, 0, 1, + (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), + (GtkAttachOptions) (GTK_FILL), 4, 4); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), __widget_server); + if (!__widget_tooltips) + __widget_tooltips = gtk_tooltips_new(); + gtk_tooltips_set_tip (__widget_tooltips, __widget_server, + _("input the server name to connect."), NULL); + + + /* wnnenvrc */ + label = gtk_label_new_with_mnemonic (_("_wnnenvrc: ")); + gtk_widget_show (label); + gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); + gtk_misc_set_padding (GTK_MISC (label), 4, 0); + gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 4, 4); + + __widget_wnn_rc = gtk_entry_new (); + gtk_widget_show (__widget_wnn_rc); + gtk_table_attach (GTK_TABLE (table), __widget_wnn_rc, 1, 2, 1, 2, + (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), + (GtkAttachOptions) (GTK_FILL), 4, 4); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), __widget_wnn_rc); + + button = gtk_button_new_with_label (_("...")); + gtk_widget_show (button); + gtk_table_attach (GTK_TABLE (table), button, 2, 3, 1, 2, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 4, 4); + //gtk_label_set_mnemonic_widget (GTK_LABEL (label), button); + gtk_tooltips_set_tip (__widget_tooltips, __widget_wnn_rc, + _("input the path of wnnenvrc."), NULL); + + /* servertype */ + label = gtk_label_new_with_mnemonic (_("Server_type: ")); + gtk_widget_show (label); + gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); + gtk_misc_set_padding (GTK_MISC (label), 4, 0); + gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 4, 4); + + list = g_list_append(list,__list_data[0].widget); + list = g_list_append(list,__list_data[1].widget); + list = g_list_append(list,__list_data[2].widget); + list = g_list_append(list,__list_data[3].widget); + __widget_servertype = gtk_list_new (); + gtk_list_append_items(GTK_LIST(__widget_servertype),list); + gtk_widget_show (__widget_servertype); + gtk_table_attach (GTK_TABLE (table), __widget_servertype, 1, 2, 2, 3, + (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), + (GtkAttachOptions) (GTK_FILL), 4, 4); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), __list_data[0].widget); + gtk_tooltips_set_tip (__widget_tooltips, __widget_servertype, + _("select the server type from Wnn4 / Wnn6 / Wnn7."), NULL); + + /* default preeditor */ + label = gtk_label_new_with_mnemonic (_("Default_PreEditor: ")); + gtk_widget_show (label); + gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); + gtk_misc_set_padding (GTK_MISC (label), 4, 0); + gtk_table_attach (GTK_TABLE (table), label, 0, 1, 3, 4, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 4, 4); + + list = NULL; + list = g_list_append(list,__list_data[4].widget); + list = g_list_append(list,__list_data[5].widget); + __widget_preeditor = gtk_list_new (); + gtk_list_append_items(GTK_LIST(__widget_preeditor),list); + gtk_widget_show (__widget_preeditor); + gtk_table_attach (GTK_TABLE (table), __widget_preeditor, 1, 2, 3, 4, + (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), + (GtkAttachOptions) (GTK_FILL), 4, 4); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), __list_data[3].widget); + gtk_tooltips_set_tip (__widget_tooltips, __widget_preeditor, + _("select the default preeditor."), NULL); + + + /* ALP */ + label = gtk_label_new_with_mnemonic (_("_Auto candidates popup: ")); + gtk_widget_show (label); + gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); + gtk_misc_set_padding (GTK_MISC (label), 4, 0); + gtk_table_attach (GTK_TABLE (table), label, 0, 1, 4, 5, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 4, 4); + + GtkAdjustment* aj; + aj = (GtkAdjustment *) gtk_adjustment_new(0,-1,10,1,1,1); + __widget_alp = gtk_spin_button_new(aj,1,0); + gtk_widget_show (__widget_alp); + gtk_table_attach (GTK_TABLE (table), __widget_alp, 1, 2, 4, 5, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 4, 4); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), __widget_alp); + gtk_tooltips_set_tip (__widget_tooltips, __widget_alp, + _("set the count of conversion until displaying the list of lookup result automatically."), NULL); + + /* numkeyselection */ + label = gtk_label_new_with_mnemonic (_("_NumKey selection: ")); + gtk_widget_show (label); + gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); + gtk_misc_set_padding (GTK_MISC (label), 4, 0); + gtk_table_attach (GTK_TABLE (table), label, 0, 1, 5, 6, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 4, 4); + + __widget_numkeyselect = gtk_check_button_new(); + gtk_widget_show (__widget_numkeyselect); + gtk_table_attach (GTK_TABLE (table), __widget_numkeyselect, 1, 2, 5, 6, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 4, 4); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), __widget_numkeyselect); + gtk_tooltips_set_tip (__widget_tooltips, __widget_numkeyselect, + _("If you use the candidate selection by numkey, check this."), NULL); + + /* auto conversion */ + label = gtk_label_new_with_mnemonic (_("Auto _conversion: ")); + gtk_widget_show (label); + gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); + gtk_misc_set_padding (GTK_MISC (label), 4, 0); + gtk_table_attach (GTK_TABLE (table), label, 0, 1, 6, 7, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 4, 4); + + __widget_autoconversion = gtk_check_button_new(); + gtk_widget_show (__widget_autoconversion); + gtk_table_attach (GTK_TABLE (table), __widget_autoconversion, 1, 2, 6, 7, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 4, 4); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), __widget_autoconversion); + gtk_tooltips_set_tip (__widget_tooltips, __widget_autoconversion, + _("If you set default to the auto conversion mode use, check this."), NULL); + + + /* completion */ + label = gtk_label_new_with_mnemonic (_("_YOSOKU-input: ")); + gtk_widget_show (label); + gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); + gtk_misc_set_padding (GTK_MISC (label), 4, 0); + gtk_table_attach (GTK_TABLE (table), label, 0, 1, 7, 8, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 4, 4); + + __widget_yosoku = gtk_check_button_new(); + gtk_widget_show (__widget_yosoku); + gtk_table_attach (GTK_TABLE (table), __widget_yosoku, 1, 2, 7, 8, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 4, 4); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), __widget_yosoku); + gtk_tooltips_set_tip (__widget_tooltips, __widget_yosoku, + _("if you use YOSOKU-input , check this."), NULL); + + + // romkan_table + label = gtk_label_new_with_mnemonic (_("_Roma-Kana table: ")); + gtk_widget_show (label); + gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); + gtk_misc_set_padding (GTK_MISC (label), 4, 0); + gtk_table_attach (GTK_TABLE (table), label, 0, 1, 8, 9, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 4, 4); + + __widget_romkan_table = gtk_entry_new (); + gtk_widget_show (__widget_romkan_table); + gtk_table_attach (GTK_TABLE (table), __widget_romkan_table, 1, 2, 8, 9, + (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), + (GtkAttachOptions) (GTK_FILL), 4, 4); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), __widget_romkan_table); + + button2 = gtk_button_new_with_label (_("...")); + gtk_widget_show (button2); + gtk_table_attach (GTK_TABLE (table), button2, 2, 3, 8, 9, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 4, 4); + gtk_tooltips_set_tip (__widget_tooltips, __widget_romkan_table, + _("input the path of Roma-Kana convert table file."), NULL); + + + + /* connect all signals */ + g_signal_connect ((gpointer) __widget_server, "changed", + G_CALLBACK (on_default_editable_changed), + &__config_server); + g_signal_connect ((gpointer) __widget_wnn_rc, "changed", + G_CALLBACK (on_default_editable_changed), + &__config_wnn_rc); + g_signal_connect ((gpointer) button, "clicked", + G_CALLBACK (on_default_file_selection_button), + __widget_wnn_rc); + g_signal_connect ((gpointer) __widget_servertype, "select-child", + G_CALLBACK (on_default_list_changed), + &__config_servertype); + g_signal_connect ((gpointer) __widget_preeditor, "select-child", + G_CALLBACK (on_default_list_changed), + &__config_preeditor); + g_signal_connect ((gpointer) __widget_alp, "changed", + G_CALLBACK (on_default_number_changed), + &__config_alp); + g_signal_connect ((gpointer) __widget_numkeyselect, "toggled", + G_CALLBACK (on_default_toggle_button_toggled), + &__config_numkeyselect); + g_signal_connect ((gpointer) __widget_autoconversion, "toggled", + G_CALLBACK (on_default_toggle_button_toggled), + &__config_autoconversion); + g_signal_connect ((gpointer) __widget_yosoku, "toggled", + G_CALLBACK (on_default_toggle_button_toggled), + &__config_yosoku); + g_signal_connect ((gpointer) __widget_romkan_table, "changed", + G_CALLBACK (on_default_editable_changed), + &__config_romkan_table); + g_signal_connect ((gpointer) button2, "clicked", + G_CALLBACK (on_default_file_selection_button), + __widget_romkan_table); + + return vbox; +} + +static GtkWidget * +create_keyboard_page (unsigned int page) +{ + GtkWidget *table; + GtkWidget *label; + + if (page >= __key_conf_pages_num) + return NULL; + + KeyboardConfigData *data = __key_conf_pages[page].data; + + table = gtk_table_new (3, 3, FALSE); + gtk_widget_show (table); + + // Create keyboard setting. + for (unsigned int i = 0; data[i].key; ++ i) { + label = gtk_label_new (NULL); + gtk_label_set_text_with_mnemonic (GTK_LABEL (label), _(data[i].label)); + gtk_widget_show (label); + gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); + gtk_misc_set_padding (GTK_MISC (label), 4, 0); + gtk_table_attach (GTK_TABLE (table), label, 0, 1, i, i+1, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 4, 4); + + data[i].entry = gtk_entry_new (); + gtk_widget_show (data[i].entry); + gtk_table_attach (GTK_TABLE (table), data[i].entry, 1, 2, i, i+1, + (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), + (GtkAttachOptions) (GTK_FILL), 4, 4); + gtk_entry_set_editable (GTK_ENTRY (data[i].entry), FALSE); + + data[i].button = gtk_button_new_with_label (_("...")); + gtk_widget_show (data[i].button); + gtk_table_attach (GTK_TABLE (table), data[i].button, 2, 3, i, i+1, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 4, 4); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), data[i].button); + } + + for (unsigned int i = 0; data[i].key; ++ i) { + g_signal_connect ((gpointer) data[i].button, "clicked", + G_CALLBACK (on_default_key_selection_clicked), + &(data[i])); + g_signal_connect ((gpointer) data[i].entry, "changed", + G_CALLBACK (on_default_editable_changed), + &(data[i].data)); + } + + if (!__widget_tooltips) + __widget_tooltips = gtk_tooltips_new(); + for (unsigned int i = 0; data[i].key; ++ i) { + gtk_tooltips_set_tip (__widget_tooltips, data[i].entry, + _(data[i].tooltip), NULL); + } + + return table; +} + +static GtkWidget * +create_setup_window () +{ + static GtkWidget *window = NULL; + + if (!window) { + GtkWidget *notebook = gtk_notebook_new(); + gtk_widget_show (notebook); + window = notebook; + gtk_notebook_set_scrollable (GTK_NOTEBOOK (notebook), TRUE); + + // Create the first page. + GtkWidget *page = create_options_page (); + GtkWidget *label = gtk_label_new (_("Options")); + gtk_widget_show (label); + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, label); + + setup_widget_value (); + + // Create the second page. + for (unsigned int i = 0; i < __key_conf_pages_num; i++) { + page = create_keyboard_page (i); + label = gtk_label_new (_(__key_conf_pages[i].label)); + gtk_widget_show (label); + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, label); + } + + setup_widget_value (); + } + + return window; +} + +static void +setup_widget_value (void) +{ +// if (__widget_use_kana) { +// gtk_toggle_button_set_active ( +// GTK_TOGGLE_BUTTON (__widget_use_kana), +// __config_use_kana); +// } + if (__widget_server) { + gtk_entry_set_text ( + GTK_ENTRY (__widget_server), + __config_server.c_str ()); + } + + if (__widget_wnn_rc) { + gtk_entry_set_text ( + GTK_ENTRY (__widget_wnn_rc), + __config_wnn_rc.c_str ()); + } + + if (__widget_servertype) { + for(unsigned int i = 0;__list_data[i].widget;i ++) { + if (__list_data[i].name == __config_servertype) { + gtk_list_select_child(GTK_LIST(__widget_servertype),__list_data[i].widget); + break; + } + } + } + + if (__widget_preeditor) { + for(unsigned int i = 0;__list_data[i].widget;i ++) { + if (__list_data[i].name == __config_preeditor) { + gtk_list_select_child(GTK_LIST(__widget_preeditor),__list_data[i].widget); + break; + } + } + } + + if (__widget_alp) { + gtk_spin_button_set_value ( + GTK_SPIN_BUTTON (__widget_alp), + __config_alp); + } + + if (__widget_numkeyselect) { + gtk_toggle_button_set_active ( + GTK_TOGGLE_BUTTON (__widget_numkeyselect), + __config_numkeyselect); + } + + if (__widget_autoconversion) { + gtk_toggle_button_set_active ( + GTK_TOGGLE_BUTTON (__widget_autoconversion), + __config_autoconversion); + } + + if (__widget_yosoku) { + gtk_toggle_button_set_active ( + GTK_TOGGLE_BUTTON (__widget_yosoku), + __config_yosoku); + } + + if (__widget_romkan_table) { + gtk_entry_set_text ( + GTK_ENTRY (__widget_romkan_table), + __config_romkan_table.c_str ()); + } + + for (unsigned int j = 0; j < __key_conf_pages_num; ++ j) { + for (unsigned int i = 0; __key_conf_pages[j].data[i].key; ++ i) { + if (__key_conf_pages[j].data[i].entry) { + gtk_entry_set_text ( + GTK_ENTRY (__key_conf_pages[j].data[i].entry), + __key_conf_pages[j].data[i].data.c_str ()); + } + } + } +} + +static void +load_config (const ConfigPointer &config) +{ + if (!config.null ()) { + // __config_use_kana = + // config->read (String (SCIM_CONFIG_IMENGINE_ANTHY_USE_KANA), + // __config_use_kana); + __config_server = + config->read (String (HONOKA_CONFIG_SERVER), + __config_server); + __config_wnn_rc = + config->read (String (HONOKA_CONFIG_RC), + __config_wnn_rc); + __config_servertype = + config->read (String (HONOKA_CONFIG_SERVERTYPE), + __config_servertype); + __config_preeditor = + config->read (String (HONOKA_CONFIG_DEFAULT_PREEDITOR), + __config_preeditor); + __config_alp = + config->read (String (HONOKA_CONFIG_ALP), + __config_alp); + __config_numkeyselect = + config->read (String (HONOKA_CONFIG_NUMKEY_SELECT), + __config_numkeyselect); + __config_autoconversion = + config->read (String (HONOKA_CONFIG_AUTO_CONVERSION), + __config_autoconversion); + __config_yosoku = + config->read (String (HONOKA_CONFIG_YOSOKU), + __config_yosoku); + __config_romkan_table = + config->read (String (HONOKA_CONFIG_ROMKAN_TABLE_FILE), + __config_romkan_table); + + for (unsigned int j = 0; j < __key_conf_pages_num; j++) { + for (unsigned int i = 0; __key_conf_pages[j].data[i].key; ++ i) { + __key_conf_pages[j].data[i].data = + config->read (String (__key_conf_pages[j].data[i].key), + __key_conf_pages[j].data[i].data); + } + } + + setup_widget_value (); + + __have_changed = false; + } +} + +static void +save_config (const ConfigPointer &config) +{ + if (!config.null ()) { + // config->write (String (SCIM_CONFIG_IMENGINE_ANTHY_USE_KANA), + // __config_use_kana); + config->write (String (HONOKA_CONFIG_SERVER), + __config_server); + config->write (String (HONOKA_CONFIG_RC), + __config_wnn_rc); + config->write (String (HONOKA_CONFIG_SERVERTYPE), + __config_servertype); + config->write (String (HONOKA_CONFIG_DEFAULT_PREEDITOR), + __config_preeditor); + config->write (String (HONOKA_CONFIG_ALP), + __config_alp); + config->write (String (HONOKA_CONFIG_NUMKEY_SELECT), + __config_numkeyselect); + config->write (String (HONOKA_CONFIG_AUTO_CONVERSION), + __config_autoconversion); + config->write (String (HONOKA_CONFIG_YOSOKU), + __config_yosoku); + config->write (String (HONOKA_CONFIG_ROMKAN_TABLE_FILE), + __config_romkan_table); + + for (unsigned j = 0; j < __key_conf_pages_num; j++) { + for (unsigned int i = 0; __key_conf_pages[j].data[i].key; ++ i) { + config->write (String (__key_conf_pages[j].data[i].key), + __key_conf_pages[j].data[i].data); + } + } + + __have_changed = false; + } +} + +static bool +query_changed () +{ + return __have_changed; +} + + +static void +on_default_toggle_button_toggled (GtkToggleButton *togglebutton, + gpointer user_data) +{ + bool *toggle = static_cast (user_data); + + if (toggle) { + *toggle = gtk_toggle_button_get_active (togglebutton); + __have_changed = true; + } +} + +static void +on_default_editable_changed (GtkEditable *editable, + gpointer user_data) +{ + String *str = static_cast (user_data); + + if (str) { + *str = String (gtk_entry_get_text (GTK_ENTRY (editable))); + __have_changed = true; + } +} + +static void +on_default_number_changed (GtkEditable *editable, + gpointer user_data) +{ + int *num = static_cast (user_data); + + if (num) { + *num = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (editable)); + __have_changed = true; + } +} + +static void +on_default_list_changed (GtkList *list, + GtkWidget *widget, + gpointer user_data) +{ + String *str = static_cast (user_data); + + if (str) { + for(unsigned int i = 0;__list_data[i].widget;i ++) { + if (__list_data[i].widget == widget) + *str = __list_data[i].name; + } + __have_changed = true; + } +} + +static void +on_default_key_selection_clicked (GtkButton *button, + gpointer user_data) +{ + KeyboardConfigData *data = static_cast (user_data); + + if (data) { + GtkWidget *dialog = scim_key_selection_dialog_new (_(data->title)); + gint result; + + scim_key_selection_dialog_set_keys ( + SCIM_KEY_SELECTION_DIALOG (dialog), + gtk_entry_get_text (GTK_ENTRY (data->entry))); + + result = gtk_dialog_run (GTK_DIALOG (dialog)); + + if (result == GTK_RESPONSE_OK) { + const gchar *keys = scim_key_selection_dialog_get_keys ( + SCIM_KEY_SELECTION_DIALOG (dialog)); + + if (!keys) keys = ""; + + if (strcmp (keys, gtk_entry_get_text (GTK_ENTRY (data->entry))) != 0) + gtk_entry_set_text (GTK_ENTRY (data->entry), keys); + } + + gtk_widget_destroy (dialog); + } +} + +static void +on_ok_clicked (GtkButton *button, gpointer user_data) +{ + bool *ok = static_cast(user_data); + if (ok) + *ok = true; +} + +static void +on_default_file_selection_button (GtkButton *button, gpointer user_data) +{ + GtkEntry *entry = GTK_ENTRY (user_data); + const char *path = gtk_entry_get_text (entry); + bool ok = false; + + GtkFileSelection *sel = GTK_FILE_SELECTION (gtk_file_selection_new ("Select a file")); + gtk_file_selection_set_filename (sel, path); + g_signal_connect (G_OBJECT (sel->ok_button), "clicked", + G_CALLBACK (on_ok_clicked), + (gpointer) &ok); + gtk_window_set_transient_for ( + GTK_WINDOW (sel), + GTK_WINDOW (gtk_widget_get_toplevel(GTK_WIDGET (entry)))); + gtk_dialog_run (GTK_DIALOG (sel)); + + if (ok) + gtk_entry_set_text (entry, gtk_file_selection_get_filename (sel)); + + gtk_widget_destroy (GTK_WIDGET (sel)); +} diff --git a/honoka/src/kanainput.cpp b/honoka/src/kanainput.cpp index 0e40ab7..63496f4 100644 --- a/honoka/src/kanainput.cpp +++ b/honoka/src/kanainput.cpp @@ -18,7 +18,7 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "kanainput.h" -#include "scim_wnn_def.h" +#include "honoka_def.h" #ifdef HAVE_CONFIG_H #include @@ -116,7 +116,7 @@ KanaInput::KanaInput(ConfigPointer cfg) : PreEditor(cfg) { - fakeKanaInput = cfg->read(SCIM_CONFIG_WNN_KANAINPUT_FAKEKANA,SCIM_DEFAULT_WNN_KANAINPUT_FAKEKANA); + fakeKanaInput = cfg->read(HONOKA_CONFIG_KANAINPUT_FAKEKANA,HONOKA_DEFAULT_KANAINPUT_FAKEKANA); } diff --git a/honoka/src/romkan.cpp b/honoka/src/romkan.cpp index 45f19f6..8dfe023 100644 --- a/honoka/src/romkan.cpp +++ b/honoka/src/romkan.cpp @@ -18,7 +18,7 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "romkan.h" -#include "scim_wnn_def.h" +#include "honoka_def.h" #ifdef HAVE_CONFIG_H #include @@ -59,8 +59,8 @@ { FILE *f = fopen(filename.c_str(),"r"); if (!f) { - #ifdef SCIM_WNN_DATADIR - String fn = SCIM_WNN_DATADIR; + #ifdef HONOKA_DATADIR + String fn = HONOKA_DATADIR; fn += "/" + filename; f = fopen(fn.c_str(),"r"); if (!f) return; @@ -154,7 +154,7 @@ keepTable.clear(); tableConfig.clear(); - String rk_table = config->read(SCIM_CONFIG_WNN_ROMKAN_TABLE_FILE,String(SCIM_DEFAULT_WNN_ROMKAN_TABLE_FILE)); + String rk_table = config->read(HONOKA_CONFIG_ROMKAN_TABLE_FILE,String(HONOKA_DEFAULT_ROMKAN_TABLE_FILE)); if (rk_table.size()) { loadTable(rk_table); diff --git a/honoka/src/scim_wnn_def.h b/honoka/src/scim_wnn_def.h deleted file mode 100644 index a64310c..0000000 --- a/honoka/src/scim_wnn_def.h +++ /dev/null @@ -1,124 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2004 by TAM(Teppei Tamra) * - * tam-t@par.odn.ne.jp * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ - -#ifndef SCIM_WNN_DEF_H -#define SCIM_WNN_DEF_H - -#define SCIM_CONFIG_WNN_KEY_CONVERSION_START "/IMEngine/Wnn/Key/ConversionStart" -#define SCIM_DEFAULT_WNN_KEY_CONVERSION_START "space" -#define SCIM_CONFIG_WNN_KEY_CANCEL "/IMEngine/Wnn/Key/Cancel" -#define SCIM_DEFAULT_WNN_KEY_CANCEL "Escape,Control+g" -#define SCIM_CONFIG_WNN_KEY_DELETE "/IMEngine/Wnn/Key/Delete" -#define SCIM_DEFAULT_WNN_KEY_DELETE "Delete" -#define SCIM_CONFIG_WNN_KEY_BACKSPACE "/IMEngine/Wnn/Key/BackSpace" -#define SCIM_DEFAULT_WNN_KEY_BACKSPACE "BackSpace" -#define SCIM_CONFIG_WNN_KEY_COMMIT "/IMEngine/Wnn/Key/Commit" -#define SCIM_DEFAULT_WNN_KEY_COMMIT "Return" -#define SCIM_CONFIG_WNN_KEY_CONVERSION_NEXT "/IMEngine/Wnn/Key/ConversionNext" -#define SCIM_DEFAULT_WNN_KEY_CONVERSION_NEXT "space,Down" -#define SCIM_CONFIG_WNN_KEY_CONVERSION_PREV "/IMEngine/Wnn/Key/ConversionPrev" -#define SCIM_DEFAULT_WNN_KEY_CONVERSION_PREV "Up" -#define SCIM_CONFIG_WNN_KEY_CONVERSION_EXPAND "/IMEngine/Wnn/Key/ConversionExpand" -#define SCIM_DEFAULT_WNN_KEY_CONVERSION_EXPAND "Shift+Right,Control+o" -#define SCIM_CONFIG_WNN_KEY_CONVERSION_SHRINK "/IMEngine/Wnn/Key/ConversionShrink" -#define SCIM_DEFAULT_WNN_KEY_CONVERSION_SHRINK "Shift+Left,Control+i" -#define SCIM_CONFIG_WNN_KEY_CONVERSION_FORWARD "/IMEngine/Wnn/Key/ConversionForward" -#define SCIM_DEFAULT_WNN_KEY_CONVERSION_FORWARD "Right" -#define SCIM_CONFIG_WNN_KEY_CONVERSION_BACKWARD "/IMEngine/Wnn/Key/ConversionBackward" -#define SCIM_DEFAULT_WNN_KEY_CONVERSION_BACKWARD "Left" -#define SCIM_CONFIG_WNN_KEY_FORWARD "/IMEngine/Wnn/Key/Forward" -#define SCIM_DEFAULT_WNN_KEY_FORWARD "Right" -#define SCIM_CONFIG_WNN_KEY_BACKWARD "/IMEngine/Wnn/Key/Backword" -#define SCIM_DEFAULT_WNN_KEY_BACKWARD "Left" -#define SCIM_CONFIG_WNN_KEY_HOME "/IMEngine/Wnn/Key/Home" -#define SCIM_DEFAULT_WNN_KEY_HOME "Home" -#define SCIM_CONFIG_WNN_KEY_END "/IMEngine/Wnn/Key/End" -#define SCIM_DEFAULT_WNN_KEY_END "End" -#define SCIM_CONFIG_WNN_KEY_LOOKUPPOPUP "/IMEngine/Wnn/Key/LookupPopup" -#define SCIM_DEFAULT_WNN_KEY_LOOKUPPOPUP "Alt+s" -#define SCIM_CONFIG_WNN_KEY_LOOKUPPAGEUP "/IMEngine/Wnn/Key/LookupPageUp" -#define SCIM_DEFAULT_WNN_KEY_LOOKUPPAGEUP "Page_Up" -#define SCIM_CONFIG_WNN_KEY_LOOKUPPAGEDOWN "/IMEngine/Wnn/Key/LookupPageDown" -#define SCIM_DEFAULT_WNN_KEY_LOOKUPPAGEDOWN "Page_Down" -#define SCIM_CONFIG_WNN_KEY_CONVERT_HIRAGANA "/IMEngine/Wnn/Key/ConvertHiragana" -#define SCIM_DEFAULT_WNN_KEY_CONVERT_HIRAGANA "Alt+h" -#define SCIM_CONFIG_WNN_KEY_CONVERT_KATAKANA "/IMEngine/Wnn/Key/ConvertKatakana" -#define SCIM_DEFAULT_WNN_KEY_CONVERT_KATAKANA "Alt+k" -#define SCIM_CONFIG_WNN_KEY_CONVERT_HALF "/IMEngine/Wnn/Key/ConvertHalf" -#define SCIM_DEFAULT_WNN_KEY_CONVERT_HALF "F6" -#define SCIM_CONFIG_WNN_KEY_CONVERT_WIDE "/IMEngine/Wnn/Key/ConvertWide" -#define SCIM_DEFAULT_WNN_KEY_CONVERT_WIDE "F5" - -#define SCIM_CONFIG_WNN_KEY_CONVERSION_IKEIJI "/IMEngine/Wnn/Key/ConversionIkeiji" -#define SCIM_DEFAULT_WNN_KEY_CONVERSION_IKEIJI "Shift+F8" -#define SCIM_CONFIG_WNN_KEY_CONVERSION_RENSOU "/IMEngine/Wnn/Key/ConversionRensou" -#define SCIM_DEFAULT_WNN_KEY_CONVERSION_RENSOU "Shift+F9" -#define SCIM_CONFIG_WNN_KEY_SELECT_YOSOKU "/IMEngine/Wnn/Key/SelectYosoku" -#define SCIM_DEFAULT_WNN_KEY_SELECT_YOSOKU "Tab" -#define SCIM_CONFIG_WNN_KEY_AUTO_CONVERSION "/IMEngine/Wnn/Key/AutoConversion" -#define SCIM_DEFAULT_WNN_KEY_AUTO_CONVERSION "Alt+a" - -#define SCIM_CONFIG_WNN_ALP "/IMEngine/Wnn/AutoLookupPopup" -#define SCIM_DEFAULT_WNN_ALP 3 -#define SCIM_CONFIG_WNN_SERVER "/IMEngine/Wnn/Server" -#define SCIM_DEFAULT_WNN_SERVER "localhost" -#define SCIM_CONFIG_WNN_RC "/IMEngine/Wnn/Rc" -#define SCIM_DEFAULT_WNN_RC "/usr/lib/wnn7/ja_JP/wnnenvrc" -#define SCIM_CONFIG_WNN_AUTO_CONVERSION "/IMEngine/Wnn/AutoConversion" -#define SCIM_DEFAULT_WNN_AUTO_CONVERSION false -#define SCIM_CONFIG_WNN_NUMKEY_SELECT "/IMEngine/Wnn/NumkeySelection" -#define SCIM_DEFAULT_WNN_NUMKEY_SELECT true -#define SCIM_CONFIG_WNN_DEFAULT_PREEDITOR "/IMEngine/Wnn/DefaultPreEditor" -#define SCIM_DEFAULT_WNN_DEFAULT_PREEDITOR "Romkan" -#define SCIM_CONFIG_WNN_SERVERTYPE "/IMEngine/Wnn/ServerType" -#ifdef HAVE_LIBWNN7 - #define SCIM_DEFAULT_WNN_SERVERTYPE "Wnn7" -#else - #define SCIM_DEFAULT_WNN_SERVERTYPE "Wnn4" -#endif - -#define SCIM_CONFIG_WNN_MINISTATUS "/IMEngine/Wnn/MiniStatus" -#define SCIM_DEFAULT_WNN_MINISTATUS false - -#define SCIM_CONFIG_WNN_YOSOKU "/IMEngine/Wnn/Yosoku" -#ifdef HAVE_LIBWNN7 - #define SCIM_DEFAULT_WNN_YOSOKU true -#else - #define SCIM_DEFAULT_WNN_YOSOKU false -#endif - -#define SCIM_PROP_WNN_MODESTATUS "/IMEngine/Wnn/Property/ModeStatus" -#define SCIM_PROP_WNN_INPUTMODE "/IMEngine/Wnn/InputMode" -#define SCIM_PROP_WNN_CONVERSIONMODE "/IMEngine/Wnn/ConversionMode" - - -// Romkan - -#define SCIM_CONFIG_WNN_ROMKAN_TABLE_FILE "/IMEngine/Wnn/Romkan/TableFile" -#define SCIM_DEFAULT_WNN_ROMKAN_TABLE_FILE "scim-wnn-def.rkt" - -// KanaInput -#define SCIM_CONFIG_WNN_KANAINPUT_FAKEKANA "/IMEngine/Wnn/KanaInput/FakeKanaKey" -#define SCIM_DEFAULT_WNN_KANAINPUT_FAKEKANA true - - - -#endif - diff --git a/honoka/src/scim_wnn_imengine.cpp b/honoka/src/scim_wnn_imengine.cpp deleted file mode 100644 index fd0bc55..0000000 --- a/honoka/src/scim_wnn_imengine.cpp +++ /dev/null @@ -1,1021 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2004 by TAM(Teppei Tamra) * - * tam-t@par.odn.ne.jp * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ - -// �äƸ��������Wnn��C++������ͥ������߹�����Τ褦�ʥ饤�֥��㤷����˾�� -// ���������Ǥ��͡��֤��������פǤ���͡� - -#define Uses_SCIM_UTILITY -#define Uses_SCIM_IMENGINE -#define Uses_SCIM_LOOKUP_TABLE -#define Uses_SCIM_CONFIG_BASE -#define Uses_SCIM_ICONV - -#ifdef HAVE_CONFIG_H - #include -#endif - -// ��ݲ��Τ��ޤ��ʤ��� -#ifdef HAVE_GETTEXT - #include - #define _(String) dgettext(GETTEXT_PACKAGE,String) - #define N_(String) (String) -#else - #define _(String) (String) - #define N_(String) (String) - #define bindtextdomain(Package,Directory) - #define textdomain(domain) - #define bind_textdomain_codeset(domain,codeset) -#endif - -// scim�Τ��ޤ��ʤ��� -#include "scim_wnn_imengine.h" -#include "scim_wnn_def.h" - -#define scim_module_init wnn_LTX_scim_module_init -#define scim_module_exit wnn_LTX_scim_module_exit -#define scim_imengine_module_init wnn_LTX_scim_imengine_module_init -#define scim_imengine_module_create_factory wnn_LTX_scim_imengine_module_create_factory -#ifndef SCIM_WNN_ICON_FILE - #define SCIM_WNN_ICON_FILE (SCIM_ICONDIR "/scim-wnn.png") -#endif - - -static Pointer _scim_wnn_factory; -static ConfigPointer _scim_config; - -extern "C" { - void scim_module_init (void) - { - bindtextdomain (GETTEXT_PACKAGE, SCIM_WNN_LOCALEDIR); - bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); - } - - void scim_module_exit (void) - { - _scim_wnn_factory.reset (); - _scim_config.reset (); - } - - unsigned int scim_imengine_module_init (const ConfigPointer &config) - { - _scim_config = config; - return 1; - } - - IMEngineFactoryPointer scim_imengine_module_create_factory (unsigned int factory) - { - if (factory != 0) return NULL; - if (_scim_wnn_factory.null ()) { - _scim_wnn_factory = - new WnnFactory (utf8_mbstowcs (String (_("Wnn"))),String("ja_JP")); - } - return _scim_wnn_factory; - } -} - -WnnFactory::WnnFactory() { - m_name = utf8_mbstowcs(_("Wnn")); - set_languages(String("ja_JP")); -} - -WnnFactory::~ WnnFactory() { -} - -WnnFactory::WnnFactory(const WideString & name, const String & languages) { - if (name.length () <= 8) - m_name = name; - else - m_name.assign (name.begin (), name.begin () + 8); - if (languages == String ("default")) - set_languages (String (_("ja_JP"))); - else - set_languages (languages); -} - -WideString WnnFactory::get_name () const -{ - return m_name; -} - -WideString WnnFactory::get_authors () const -{ - return utf8_mbstowcs (String (_("(C) 2004 TAM(Teppei Tamra) "))); -} - -WideString WnnFactory::get_credits () const -{ - return WideString (); -} - -WideString WnnFactory::get_help () const -{ - return utf8_mbstowcs (String (_("SCIM-WNN HELP"))); -} - -String WnnFactory::get_uuid () const -{ - return String ("c069395a-d62f-4a77-8229-446e44a99976"); -} - -String WnnFactory::get_icon_file () const -{ - return String (SCIM_WNN_ICON_FILE); -} - -IMEngineInstancePointer WnnFactory::create_instance (const String& encoding, int id) -{ - return new WnnInstance (this, encoding, id); -} - - - -// �������٥�ȥ����å� - -void WnnKeyEventList::append(const KeyEvent &k) { - push_back(k); -} - -void WnnKeyEventList::append(int code,int mask) { - KeyEvent k; - k.code = code; - k.mask = mask; - append(k); -} - -bool WnnKeyEventList::comp(const KeyEvent &k) { - int kc = k.get_ascii_code(); - if ((kc > 0x60) && (kc < 0x7b)) kc -= 0x20; - else if ((kc > 0x40) && (kc < 0x5b)) kc += 0x20; - for (unsigned int i = 0;i < size();i ++) { - if ((at(i).code == k.code) && (at(i).mask == k.mask)) { - return(true); - } - if (kc && (at(i).code == kc) && (at(i).mask == k.mask)) { - return(true); - } - } - return(false); -} - - -// ��ʪ�� - - -WnnInstance::WnnInstance (WnnFactory *factory, const String& encoding, int id) - : IMEngineInstanceBase (factory, encoding, id) -{ - m_iconv.set_encoding ("EUC-JP"); - preeditors.push_back(new Romkan(_scim_config)); - preeditors.push_back(new KanaInput(_scim_config)); - m_preeditor = preeditors.at(0); - wnn = 0; - init(); -} - -WnnInstance::~WnnInstance() -{ - for(unsigned int i = 0;i < preeditors.size();i ++) { - delete(preeditors.at(i)); - } - if (wnn->isConnected()) wnn->disconnect(); -} - - -/*! - \fn WnnInstance::init() - */ -void WnnInstance::init() -{ - m_conversion = false; - m_yosoku = false; - m_lookup = false; - - // @todo if connected to jserver, should disconnect this. - - alp = _scim_config->read(String(SCIM_CONFIG_WNN_ALP),SCIM_DEFAULT_WNN_ALP); - mini_status = _scim_config->read(String(SCIM_CONFIG_WNN_MINISTATUS),SCIM_DEFAULT_WNN_MINISTATUS); - numkeyselect = _scim_config->read(String(SCIM_CONFIG_WNN_NUMKEY_SELECT),SCIM_DEFAULT_WNN_NUMKEY_SELECT); - yosoku = _scim_config->read(String(SCIM_CONFIG_WNN_YOSOKU),SCIM_DEFAULT_WNN_YOSOKU); - sType = _scim_config->read(String(SCIM_CONFIG_WNN_SERVERTYPE),String(SCIM_DEFAULT_WNN_SERVERTYPE)); - - if (wnn) delete(wnn); - #ifdef HAVE_LIBANTHY - if (sType == "Anthy") - wnn = new AnthyConversion(_scim_config); - else - #endif - wnn = new WnnConversion(_scim_config); - - - defaultPreEditor = _scim_config->read(String(SCIM_CONFIG_WNN_DEFAULT_PREEDITOR),String(SCIM_DEFAULT_WNN_DEFAULT_PREEDITOR)); - auto_conversion = _scim_config->read(String(SCIM_CONFIG_WNN_AUTO_CONVERSION),SCIM_DEFAULT_WNN_AUTO_CONVERSION);; - - // �ǥե���ȥ������ꡣ - scim_string_to_key_list(k_conversion_start, - _scim_config->read(String(SCIM_CONFIG_WNN_KEY_CONVERSION_START), - String(SCIM_DEFAULT_WNN_KEY_CONVERSION_START))); - scim_string_to_key_list(k_cancel, - _scim_config->read(String(SCIM_CONFIG_WNN_KEY_CANCEL), - String(SCIM_DEFAULT_WNN_KEY_CANCEL))); - scim_string_to_key_list(k_delete, - _scim_config->read(String(SCIM_CONFIG_WNN_KEY_DELETE), - String(SCIM_DEFAULT_WNN_KEY_DELETE))); - scim_string_to_key_list(k_backspace, - _scim_config->read(String(SCIM_CONFIG_WNN_KEY_BACKSPACE), - String(SCIM_DEFAULT_WNN_KEY_BACKSPACE))); - scim_string_to_key_list(k_commit, - _scim_config->read(String(SCIM_CONFIG_WNN_KEY_COMMIT), - String(SCIM_DEFAULT_WNN_KEY_COMMIT))); - scim_string_to_key_list(k_conversion_next, - _scim_config->read(String(SCIM_CONFIG_WNN_KEY_CONVERSION_NEXT), - String(SCIM_DEFAULT_WNN_KEY_CONVERSION_NEXT))); - scim_string_to_key_list(k_conversion_prev, - _scim_config->read(String(SCIM_CONFIG_WNN_KEY_CONVERSION_PREV), - String(SCIM_DEFAULT_WNN_KEY_CONVERSION_PREV))); - scim_string_to_key_list(k_conversion_expand, - _scim_config->read(String(SCIM_CONFIG_WNN_KEY_CONVERSION_EXPAND), - String(SCIM_DEFAULT_WNN_KEY_CONVERSION_EXPAND))); - scim_string_to_key_list(k_conversion_shrink, - _scim_config->read(String(SCIM_CONFIG_WNN_KEY_CONVERSION_SHRINK), - String(SCIM_DEFAULT_WNN_KEY_CONVERSION_SHRINK))); - scim_string_to_key_list(k_conversion_forward, - _scim_config->read(String(SCIM_CONFIG_WNN_KEY_CONVERSION_FORWARD), - String(SCIM_DEFAULT_WNN_KEY_CONVERSION_FORWARD))); - scim_string_to_key_list(k_conversion_backward, - _scim_config->read(String(SCIM_CONFIG_WNN_KEY_CONVERSION_BACKWARD), - String(SCIM_DEFAULT_WNN_KEY_CONVERSION_BACKWARD))); - scim_string_to_key_list(k_forward, - _scim_config->read(String(SCIM_CONFIG_WNN_KEY_FORWARD), - String(SCIM_DEFAULT_WNN_KEY_FORWARD))); - scim_string_to_key_list(k_backward, - _scim_config->read(String(SCIM_CONFIG_WNN_KEY_BACKWARD), - String(SCIM_DEFAULT_WNN_KEY_BACKWARD))); - scim_string_to_key_list(k_home, - _scim_config->read(String(SCIM_CONFIG_WNN_KEY_HOME), - String(SCIM_DEFAULT_WNN_KEY_HOME))); - scim_string_to_key_list(k_end, - _scim_config->read(String(SCIM_CONFIG_WNN_KEY_END), - String(SCIM_DEFAULT_WNN_KEY_END))); - scim_string_to_key_list(k_lookup_popup, - _scim_config->read(String(SCIM_CONFIG_WNN_KEY_LOOKUPPOPUP), - String(SCIM_DEFAULT_WNN_KEY_LOOKUPPOPUP))); - scim_string_to_key_list(k_lookup_pageup, - _scim_config->read(String(SCIM_CONFIG_WNN_KEY_LOOKUPPAGEUP), - String(SCIM_DEFAULT_WNN_KEY_LOOKUPPAGEUP))); - scim_string_to_key_list(k_lookup_pagedown, - _scim_config->read(String(SCIM_CONFIG_WNN_KEY_LOOKUPPAGEDOWN), - String(SCIM_DEFAULT_WNN_KEY_LOOKUPPAGEDOWN))); - scim_string_to_key_list(k_convert_hiragana, - _scim_config->read(String(SCIM_CONFIG_WNN_KEY_CONVERT_HIRAGANA), - String(SCIM_DEFAULT_WNN_KEY_CONVERT_HIRAGANA))); - scim_string_to_key_list(k_convert_katakana, - _scim_config->read(String(SCIM_CONFIG_WNN_KEY_CONVERT_KATAKANA), - String(SCIM_DEFAULT_WNN_KEY_CONVERT_KATAKANA))); - scim_string_to_key_list(k_convert_half, - _scim_config->read(String(SCIM_CONFIG_WNN_KEY_CONVERT_HALF), - String(SCIM_DEFAULT_WNN_KEY_CONVERT_HALF))); - scim_string_to_key_list(k_convert_wide, - _scim_config->read(String(SCIM_CONFIG_WNN_KEY_CONVERT_WIDE), - String(SCIM_DEFAULT_WNN_KEY_CONVERT_WIDE))); - - scim_string_to_key_list(k_conversion_rensou, - _scim_config->read(String(SCIM_CONFIG_WNN_KEY_CONVERSION_RENSOU), - String(SCIM_DEFAULT_WNN_KEY_CONVERSION_RENSOU))); - scim_string_to_key_list(k_conversion_ikeiji, - _scim_config->read(String(SCIM_CONFIG_WNN_KEY_CONVERSION_IKEIJI), - String(SCIM_DEFAULT_WNN_KEY_CONVERSION_IKEIJI))); - scim_string_to_key_list(k_select_yosoku, - _scim_config->read(String(SCIM_CONFIG_WNN_KEY_SELECT_YOSOKU), - String(SCIM_DEFAULT_WNN_KEY_SELECT_YOSOKU))); - scim_string_to_key_list(k_auto_conversion, - _scim_config->read(String(SCIM_CONFIG_WNN_KEY_AUTO_CONVERSION), - String(SCIM_DEFAULT_WNN_KEY_AUTO_CONVERSION))); - - changePreEditor(defaultPreEditor); - - // �����ǰ�����³���Ƥ������� - wnn->connect(); - -} - - -/*! - \fn WnnInstance::changePreEditor(const String &name) - */ -void WnnInstance::changePreEditor(const String &name) -{ - for(unsigned int i = 0;i < preeditors.size();i ++) { - if (preeditors[i]->getPropertyName() == name) { - m_preeditor = preeditors[i]; - return; - } - } - return; -} - - -/*! - \fn WnnInstance::updateProperty() - */ -void WnnInstance::updateProperty() -{ - if (m_proplist.empty()) { - Property p; - p = Property(SCIM_PROP_WNN_INPUTMODE,"",String(""),_("input mode")); - m_proplist.push_back(p); - for(unsigned int i = 0;i < preeditors.size();i ++) { - p = Property(String(SCIM_PROP_WNN_INPUTMODE) + String("/") + preeditors[i]->getPropertyName(), - preeditors[i]->getName(),String(""),_("mode status")); - m_proplist.push_back(p); - } - p = Property(SCIM_PROP_WNN_MODESTATUS,"",String(""),_("mode status")); - m_proplist.push_back(p); - p = Property(SCIM_PROP_WNN_CONVERSIONMODE,"",String(""),_("conversion mode")); - m_proplist.push_back(p); - } - PropertyList::iterator it; - it = find(m_proplist.begin(),m_proplist.end(),SCIM_PROP_WNN_INPUTMODE); - if (it != m_proplist.end()) { - it->set_label(m_preeditor->getName()); - } - update_property(*it); - it = find(m_proplist.begin(),m_proplist.end(),SCIM_PROP_WNN_MODESTATUS); - if (it != m_proplist.end()) { - if (m_conversion) it->set_label(_("Kanji")); - else if (m_yosoku) it->set_label(_("Yosoku")); - else it->set_label(m_preeditor->getModeName()); - } - update_property(*it); - it = find(m_proplist.begin(),m_proplist.end(),SCIM_PROP_WNN_CONVERSIONMODE); - if (it != m_proplist.end()) { - if (auto_conversion) it->set_label(_("AUTO")); - else it->set_label(_("REN")); - } - update_property(*it); - register_properties(m_proplist); -} - - -/*! - \fn WnnInstance::updatePreEditor() - */ -void WnnInstance::updatePreEditor() -{ - if (m_preeditor->getTextLength()) { - if (auto_conversion && (m_preeditor->getTextLength() == m_preeditor->getPos())) - autoConversion(); - else { - show_preedit_string(); - update_preedit_string(m_preeditor->getText(),m_preeditor->getAttributeList()); - update_preedit_caret(m_preeditor->getPos()); - } - if ((!m_conversion) && yosoku && wnn->isConnected() && (sType == "Wnn7") && (!auto_conversion)) { - m_convList = wnn->getYosokuList(m_preeditor->getText()); - if (m_convList.count) { - m_lookup_table.clear(); - for(unsigned int i = 0;i < m_convList.count;i ++) { - m_lookup_table.append_candidate(m_convList.kouho.at(i)); - } - startLookup(); - } else { - //m_lookup_table.clear(); - hide_lookup_table(); - } - } else hide_lookup_table(); - } else { - hide_preedit_string(); - hide_lookup_table(); - } - if (mini_status) { - update_aux_string(utf8_mbstowcs(m_preeditor->getModeName())); - show_aux_string(); - } else { - hide_aux_string(); - } - - updateProperty(); -} -/*! - \fn WnnInstance::updateConversion() - */ -void WnnInstance::updateConversion() -{ - update_preedit_string(wnn->getText(),wnn->getAttributeList()); - update_preedit_caret(wnn->getCaretPos()); - if (m_lookup) { - m_lookup_table.set_cursor_pos(m_convList.pos); - update_lookup_table(m_lookup_table); - show_lookup_table(); - } else { - hide_lookup_table(); - hide_aux_string(); - } - updateProperty(); -} - - -bool WnnInstance::process_key_event (const KeyEvent& key) -{ - if (key.is_key_release()) return(false); - KeyEvent ke = key; - if (ke.mask & SCIM_KEY_CapsLockMask) ke.mask -= SCIM_KEY_CapsLockMask; - if (ke.mask & SCIM_KEY_NumLockMask) ke.mask -= SCIM_KEY_NumLockMask; - if (ke.mask & SCIM_KEY_ScrollLockMask) ke.mask -= SCIM_KEY_ScrollLockMask; - if (m_conversion) return(process_conversion_key_event(ke)); - else if (m_yosoku) return(process_yosoku_key_event(ke)); - else return(process_preedit_key_event(ke)); -} - - -/*! - \fn WnnInstance::process_preedit_key_event(const KeyEvent &key) - */ -bool WnnInstance::process_preedit_key_event(const KeyEvent &key) -{ - // PreEditor�Υ������٥�ȥեå��� - if (m_preeditor->keyEventHook(key)) { - updatePreEditor(); - return(true); - } else - - // �Хåե������Ǥ�̵����硣 - if (m_preeditor->getTextLength()) { - if (k_conversion_start.comp(key)) { - startConversion(m_preeditor->getText(true)); - alp_count ++; - return(true); - } else - if (k_commit.comp(key)) { - if (auto_conversion) { - commit_string(wnn->getText()); - wnn->reset(); - } else commit_string(m_preeditor->getText(true)); - m_preeditor->reset(); - updatePreEditor(); - return(true); - } else - if (k_forward.comp(key) || k_backward.comp(key)) { - k_backward.comp(key) ? m_preeditor->setPos(m_preeditor->getPos() - 1) : m_preeditor->setPos(m_preeditor->getPos() + 1); - updatePreEditor(); - return(true); - } else - if (k_home.comp(key) || k_end.comp(key)) { - k_end.comp(key) ? m_preeditor->setPos(m_preeditor->getTextLength()) : m_preeditor->setPos(0); - updatePreEditor(); - return(true); - } else - if ((k_backspace.comp(key)) || (k_delete.comp(key))) { - k_backspace.comp(key) ? m_preeditor->backspace(): m_preeditor->del(); - updatePreEditor(); - return(true); - } else - if (k_convert_hiragana.comp(key)) { - m_preeditor->kataHira(); - updatePreEditor(); - return(true); - } else - if (k_convert_katakana.comp(key)) { - m_preeditor->hiraKata(); - updatePreEditor(); - return(true); - } else - if (k_convert_half.comp(key)) { - m_preeditor->toHalf(); - updatePreEditor(); - return(true); - } else - if (k_convert_wide.comp(key)) { - m_preeditor->toWide(); - updatePreEditor(); - return(true); - } else - if (k_select_yosoku.comp(key) && yosoku) { - if ((m_convList.kType == YOSOKU) && (m_convList.count)) { - return(process_yosoku_key_event(key)); - } - } - } - - // �Хåե���¸�ߤˤ�����餺�� - if (k_cancel.comp(key)) { - if (m_preeditor->cancelEvent()) { - updatePreEditor(); - return(true); - } - if (m_preeditor->getTextLength()) { - m_preeditor->reset(); - } - updatePreEditor(); - return(true); - } - - if (k_auto_conversion.comp(key)) { - auto_conversion ? auto_conversion = false : auto_conversion = true; - updatePreEditor(); - return(true); - } - - if (m_preeditor->inputEvent(key)) { - updatePreEditor(); - - return(true); - } else { - // preeditor�ǽ����Ǥ��ʤ��ä����Ϥ�Ϥ�commit���ƥ��ץꥱ���������֤��٤����� - if (m_preeditor->getTextLength()) { - if (auto_conversion) { - commit_string(wnn->getText()); - wnn->reset(); - } else commit_string(m_preeditor->getText(true)); - } - m_preeditor->reset(); - updatePreEditor(); - } - - return(false); -} - -/*! - \fn WnnInstance::process_conversion_key_event(const KeyEvent &key) - */ -bool WnnInstance::process_conversion_key_event(const KeyEvent &key) -{ - if ((key.code == SCIM_KEY_Shift_L) || - (key.code == SCIM_KEY_Shift_R) || - (key.code == SCIM_KEY_Control_L) || - (key.code == SCIM_KEY_Control_R) || - (key.code == SCIM_KEY_Alt_L) || - (key.code == SCIM_KEY_Alt_R) || - (key.code == SCIM_KEY_Super_L) || - (key.code == SCIM_KEY_Super_R) || - (key.code == SCIM_KEY_Hyper_L) || - (key.code == SCIM_KEY_Hyper_R)) return(true); - - if ((alp <= alp_count) && (alp != 0)) { - if (!m_lookup) startLookup(); - } - - if (k_lookup_popup.comp(key)) { - if (m_lookup) return(true); - startLookup(); - return(true); - } else - if (k_lookup_pageup.comp(key)) { - if (m_lookup) { - lookup_table_page_up(); - } - } else - if (k_lookup_pagedown.comp(key)) { - if (m_lookup) { - lookup_table_page_down(); - } - } else - if (k_commit.comp(key)) { - commit_string(wnn->getText()); - wnn->updateFrequency(); - m_preeditor->reset(); - wnn->reset(); - m_conversion = false; - updatePreEditor(); - m_lookup = false; - alp_count = 1; - return(true); - } else - if (k_cancel.comp(key) || k_backspace.comp(key)) { - wnn->reset(); - m_conversion = false; - m_lookup = false; - alp_count = 0; - updatePreEditor(); - return(true); - } else - if (k_conversion_next.comp(key) || k_conversion_prev.comp(key)) { - k_conversion_prev.comp(key) ? m_convList.pos --: m_convList.pos ++; - if (m_convList.pos >= m_convList.count) m_convList.pos = 0; - else if (m_convList.pos < 0) m_convList.pos = m_convList.count - 1; - alp_count ++; - - wnn->select(m_convList.pos); - updateConversion(); - return(true); - } else - if (k_conversion_expand.comp(key) || k_conversion_shrink.comp(key)) { - bool r; - k_conversion_shrink.comp(key) ? r = wnn->resizeRegion(-1) : r = wnn->resizeRegion(1); - if (!r) return(true); - m_convList = wnn->getResultList(); - if (alp == -1) { - startLookup(); - } else m_lookup = false; - updateConversion(); - alp_count = 1; - return(true); - } else - if (k_conversion_rensou.comp(key) && ((sType == "Wnn7") || (sType == "Wnn8")) ) { - m_convList = wnn->getResultList(wnn->getPos(),RENSOU); - if (m_convList.count == 0) return(true); - startLookup(); - updateConversion(); - alp_count = 1; - return(true); - } else - if (k_conversion_ikeiji.comp(key) && ((sType == "Wnn7") || (sType == "Wnn8")) ) { - m_convList = wnn->getResultList(wnn->getPos(),IKEIJI); - if (m_convList.count == 0) return(true); - startLookup(); - updateConversion(); - alp_count = 1; - return(true); - } else - if (k_conversion_forward.comp(key) || k_conversion_backward.comp(key)) { - k_conversion_backward.comp(key) ? wnn->setPos(wnn->getPos() - 1) : wnn->setPos(wnn->getPos() + 1); - m_convList = wnn->getResultList(); - if (alp == -1) { - startLookup(); - } else m_lookup = false; - updateConversion(); - alp_count = 1; - return(true); - } else - if (k_convert_hiragana.comp(key) || k_convert_katakana.comp(key)) { - WideString res = m_convList.Yomi; - k_convert_hiragana.comp(key) ? m_preeditor->convKataHira(res) : m_preeditor->convHiraKata(res); - for(unsigned int i = 0;i < m_convList.count;i ++) { - if (res == m_convList.kouho[i]) { - m_convList.pos = i; - wnn->select(m_convList.pos); - updateConversion(); - break; - } - } - return(true); - } else - if (key.get_ascii_code()) { - if (key.mask & (SCIM_KEY_AltMask | SCIM_KEY_ControlMask)) return(false); - if (m_lookup && numkeyselect) { - char numk[] = "1234567890"; - int numc = 0; - bool numkey = false; - for(;numk[numc]; ++ numc) { - if (key.get_ascii_code() == numk[numc]) { - numkey = true; - break; - } - } - if (numkey) { - if (m_lookup_table.get_current_page_size() < numc) return(true); - m_convList.pos = numc + m_lookup_table.get_current_page_start(); - wnn->select(m_convList.pos); - wnn->setPos(wnn->getPos() + 1); - m_convList = wnn->getResultList(); - updateConversion(); - startLookup(); - return(true); - } - } - - commit_string(wnn->getText()); - wnn->updateFrequency(); - m_preeditor->reset(); - wnn->reset(); - m_conversion = false; - m_lookup = false; - alp_count = 0; - updatePreEditor(); - return(process_preedit_key_event(key)); - } - - - return(true); -} - - - -/*! - \fn WnnInstance::process_yosoku_key_event(const KeyEvent &key) - */ -bool WnnInstance::process_yosoku_key_event(const KeyEvent &key) -{ - if (!m_yosoku) { - m_yosoku = true; - update_preedit_string(m_convList.kouho.at(m_convList.pos)); - update_preedit_caret(0); - show_preedit_string(); - updateProperty(); - return(true); - } - - if (k_lookup_pageup.comp(key)) { - lookup_table_page_up(); - return(true); - } else - if (k_lookup_pagedown.comp(key)) { - lookup_table_page_down(); - return(true); - } else - if (k_conversion_next.comp(key) || k_conversion_prev.comp(key) || k_select_yosoku.comp(key)) { - k_conversion_prev.comp(key) ? m_convList.pos --: m_convList.pos ++; - if (m_convList.pos >= m_convList.count) m_convList.pos = 0; - else if (m_convList.pos < 0) m_convList.pos = m_convList.count - 1; - m_lookup_table.set_cursor_pos(m_convList.pos); - update_lookup_table(m_lookup_table); - update_preedit_string(m_convList.kouho.at(m_convList.pos)); - update_preedit_caret(0); -// select_candidate((unsigned int)m_convList.pos); - updateProperty(); - return(true); - } else - if (k_commit.comp(key)) { - m_yosoku = false; - commit_string(m_convList.kouho.at(m_convList.pos)); - m_preeditor->reset(); - updatePreEditor(); - return(true); - } else - if (k_cancel.comp(key) || k_backspace.comp(key)) { - m_yosoku = false; - updatePreEditor(); - return(true); - } - if (!key.get_ascii_code()) return(true); - if ((!(key.is_control_down() || key.is_alt_down() || key.is_shift_down())) && numkeyselect) { - char numk[] = "1234567890"; - for(int numc = 0;numk[numc]; ++ numc) { - if (key.get_ascii_code() == numk[numc]) { - if (m_lookup_table.get_current_page_size() > numc) - select_candidate((unsigned int)numc); - return(true); - } - } - } - - m_yosoku = false; - commit_string(m_convList.kouho.at(m_convList.pos)); - m_preeditor->reset(); - updatePreEditor(); - return(process_preedit_key_event(key)); -} - - - -void WnnInstance::move_preedit_caret (unsigned int pos) -{ - //if (!m_conversion) m_preeditor->setPos(pos); - //update_preedit_caret(pos); -} - -void WnnInstance::select_candidate (unsigned int item) -{ - if (!m_lookup_table.number_of_candidates()) return; - - int p = m_lookup_table.get_current_page_start() + item; - m_convList.pos = p; - wnn->select(m_convList.pos); - if (m_convList.kType != YOSOKU) { - update_preedit_string(wnn->getText(),wnn->getAttributeList()); - update_preedit_caret(wnn->getCaretPos()); - } else { - update_preedit_string(m_convList.kouho.at(m_convList.pos)); - update_preedit_caret(0); - if (!m_yosoku) { - // �ޥ��������򤷤�����ͽ¬����⡼�ɤ������� - m_yosoku = true; - show_preedit_string(); - updateProperty(); - } - } - m_lookup_table.set_cursor_pos(m_convList.pos); - update_lookup_table(m_lookup_table); -} - -void WnnInstance::update_lookup_table_page_size (unsigned int page_size) -{ - m_lookup_table.set_page_size (page_size); -} - -void WnnInstance::lookup_table_page_up () -{ - if (!m_lookup_table.number_of_candidates () || !m_lookup_table.get_current_page_start ()) return; - - int p = m_convList.pos - m_lookup_table.get_current_page_size(); - if (p < 0) p = 0; - m_convList.pos = p; - wnn->select(m_convList.pos); - update_preedit_string(wnn->getText(),wnn->getAttributeList()); - update_preedit_caret(wnn->getCaretPos()); - m_lookup_table.set_cursor_pos(m_convList.pos); - update_lookup_table(m_lookup_table); -} - -void WnnInstance::lookup_table_page_down () -{ - if (!m_lookup_table.number_of_candidates () || - m_lookup_table.get_current_page_start () + m_lookup_table.get_current_page_size () >= - m_lookup_table.number_of_candidates ()) - return; - - int p = m_convList.pos + m_lookup_table.get_current_page_size(); - if (p >= m_convList.count) p = m_convList.count - 1; - m_convList.pos = p; - wnn->select(m_convList.pos); - update_preedit_string(wnn->getText(),wnn->getAttributeList()); - update_preedit_caret(wnn->getCaretPos()); - m_lookup_table.set_cursor_pos(m_convList.pos); - update_lookup_table(m_lookup_table); -} - -void WnnInstance::reset () -{ - // Qt-immodule+scim-qtimm�ǤϤ��Υ᥽�åɤ����̤˸ƤФ��褦������¾�ǤϤɤ��ʤΤ����� - alp_count = 0; - m_conversion = false; - m_lookup = false; - wnn->reset(); - m_preeditor->reset(); - //if (wnn->isConnected()) wnn->wnnDisconnect(); - //wnn->wnnConnect(String("scim-wnn"),host,rc,sType,0); - //updatePreEditor(); -} - -void WnnInstance::focus_in () -{ - if (!m_conversion) updatePreEditor(); - else updateProperty(); -} - -void WnnInstance::focus_out () -{ - if (m_conversion) { - commit_string(wnn->getText()); - wnn->updateFrequency(); - wnn->reset(); - m_conversion = false; - m_lookup = false; - alp_count = 0; - } else if (m_preeditor->getTextLength()) { - commit_string(m_preeditor->getText(true)); - } - m_preeditor->reset(); - updatePreEditor(); -} - -void WnnInstance::trigger_property (const String &property) -{ - String s = SCIM_PROP_WNN_INPUTMODE; - if ((property.length() > s.length()) && (property.substr(0,s.length()) == s)) { - changePreEditor(property.substr(s.length() + 1)); - updateProperty(); - } - s = SCIM_PROP_WNN_CONVERSIONMODE; - if (property == s) { - auto_conversion ? auto_conversion = false : auto_conversion = true; - updatePreEditor(); - } -} - - - - - - -/*! - \fn WnnInstance::startConversion(WideString s) - */ -void WnnInstance::startConversion(WideString s) -{ - // ����lookup�Ͼä��Ƥ������� - m_lookup = false; - m_lookup_table.clear(); - hide_lookup_table(); - - hide_aux_string(); - if (!wnn->isConnected()) { - if (!wnn->connect()) { - update_aux_string(utf8_mbstowcs(String(_("could not connect to jserver.")))); - show_aux_string(); - return; - } - } - - wnn->setYomiText(s); - if (wnn->ren_conversion() == -1) { - update_aux_string(utf8_mbstowcs(String(_("could not connect to jserver.")))); - show_aux_string(); - return; - } - m_convList.kouho.clear(); - m_convList = wnn->getResultList(); - m_conversion = true; - - alp_count = 1; - - show_preedit_string(); - update_preedit_string(wnn->getText(),wnn->getAttributeList()); - update_preedit_caret(wnn->getCaretPos()); - if (alp == -1) { - startLookup(); - } - updateProperty(); -} - - -/*! - \fn WnnInstance::autoConversion() - */ -void WnnInstance::autoConversion() -{ - if (!wnn->isConnected()) { - if (!wnn->connect()) { - update_aux_string(utf8_mbstowcs(String(_("could not connect to jserver.")))); - show_aux_string(); - show_preedit_string(); - update_preedit_string(m_preeditor->getText(),m_preeditor->getAttributeList()); - update_preedit_caret(m_preeditor->getPos()); - return; - } - } - - wnn->reset(); - wnn->setYomiText(m_preeditor->getText(true)); - if (wnn->ren_conversion() == -1) { - update_aux_string(utf8_mbstowcs(String(_("could not connect to jserver.")))); - show_aux_string(); - show_preedit_string(); - update_preedit_string(m_preeditor->getText(),m_preeditor->getAttributeList()); - update_preedit_caret(m_preeditor->getPos()); - return; - } - - show_preedit_string(); - update_preedit_string(wnn->getText()); - update_preedit_caret(wnn->getText().size()); -} - - -/*! - \fn WnnInstance::createLookupTable(ResultList cList) - */ -void WnnInstance::createLookupTable(ResultList cList) -{ - hide_lookup_table(); - m_lookup_table.clear(); - if (!cList.count) return; - for (unsigned int i = 0;i < cList.count;i ++) { - m_lookup_table.append_candidate(cList.kouho.at(i)); - } - m_lookup_table.set_cursor_pos(cList.pos); - update_lookup_table(m_lookup_table); -} - - -/*! - \fn WnnInstance::startLookup() - */ -void WnnInstance::startLookup() -{ - createLookupTable(m_convList); - if (m_convList.count == 0) return; - m_lookup = true; - switch(m_convList.kType) { - case IKEIJI: { - update_aux_string(utf8_mbstowcs(String(_("Ikeiji lookup result")))); - break; - } - case RENSOU: { - update_aux_string(utf8_mbstowcs(String(_("association lookup result")))); - break; - } - case YOSOKU: { - update_aux_string(utf8_mbstowcs(String(_("yosoku lookup result")))); - break; - } - default: { - update_aux_string(utf8_mbstowcs(String(_("lookup result")))); - break; - } - } - show_aux_string(); - show_lookup_table(); -} - - - - - - diff --git a/honoka/src/scim_wnn_imengine.h b/honoka/src/scim_wnn_imengine.h deleted file mode 100644 index aa866c0..0000000 --- a/honoka/src/scim_wnn_imengine.h +++ /dev/null @@ -1,157 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2004 by TAM(Teppei Tamra) * - * tam-t@par.odn.ne.jp * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ -#ifndef SCIM_WNN_IMENGINE_H -#define SCIM_WNN_IMENGINE_H - -#include -#include -#include -#include -#include -#include -#include -#define Uses_SCIM_ICONV -#include -#include - -#ifdef HAVE_CONFIG_H -#include -#endif - - -using namespace scim; -using namespace std; - -class WnnFactory : public IMEngineFactoryBase -{ -protected: - friend class WnnInstance; - WideString m_name; -public: - WnnFactory (); - WnnFactory (const WideString & name, const String & languages); - virtual ~WnnFactory (); - virtual WideString get_name () const; - virtual WideString get_authors () const; - virtual WideString get_credits () const; - virtual WideString get_help () const; - virtual String get_uuid () const; - virtual String get_icon_file () const; - virtual IMEngineInstancePointer create_instance (const String& encoding, int id = -1); -protected: - -}; - -class WnnKeyEventList : public KeyEventList -{ - // �ꥹ�Ȥ˥������٥�Ȥ��ɲä��ơ�comp(KeyEvent)��Ƚ�̡� -public: - void append(const KeyEvent &k); - void append(int code,int mask); - bool comp(const KeyEvent &k); -}; - - -class WnnInstance : public IMEngineInstanceBase -{ -public: - WnnInstance (WnnFactory *factory, const String &encoding, int id = -1); - virtual ~WnnInstance (); - virtual bool process_key_event (const KeyEvent& key); - virtual void move_preedit_caret (unsigned int pos); - virtual void select_candidate (unsigned int item); - virtual void update_lookup_table_page_size (unsigned int page_size); - virtual void lookup_table_page_up (); - virtual void lookup_table_page_down (); - virtual void reset (); - virtual void focus_in (); - virtual void focus_out (); - virtual void trigger_property (const String &property); - void startLookup(); - -protected: - CommonLookupTable m_lookup_table; - PreEditor *m_preeditor; - Convertor *wnn; - bool m_conversion; - bool m_yosoku; - bool m_lookup; - ResultList m_convList; - PropertyList m_proplist; - int alp; - int alp_count; - bool numkeyselect; - bool mini_status; - bool yosoku; - bool auto_conversion; - String defaultPreEditor; - IConvert m_iconv; - vector preeditors; - String sType; -protected: - bool process_preedit_key_event(const KeyEvent &key); - bool process_conversion_key_event(const KeyEvent &key); - bool process_yosoku_key_event(const KeyEvent &key); - void startConversion(WideString s); - void createLookupTable(ResultList cList); - void init(); - void updatePreEditor(); - void updateProperty(); - void updateConversion(); - void changePreEditor(const String &name); - void autoConversion(); - -private: - WnnKeyEventList - k_conversion_start, // �Ѵ����� - k_cancel, // ����󥻥륭�� - k_delete, // ��� - k_backspace, // �Хå����ڡ��� - k_commit, // ���� - k_conversion_next, // ������ - k_conversion_prev, // ������ - k_conversion_expand, // ���� - k_conversion_shrink, // �̾� - k_conversion_forward, // ��ʸ�� - k_conversion_backward, // ��ʸ�� - k_forward, // ���������ư/�� - k_backward, // ���������ư/��� - k_home, // ���������ư/��Ƭ - k_end, // ���������ư/���� - k_lookup_popup, // �������ɽ�� - k_lookup_pageup, // ����������� - k_lookup_pagedown, // ����������� - k_convert_hiragana, // �Ҥ餬���Ѵ� - k_convert_katakana, // ���������Ѵ� - k_convert_half, // Ⱦ���Ѵ� - k_convert_wide, // �����Ѵ� - k_auto_conversion, // �Ѵ��⡼�ɥȥ��� - - // for Wnn7 - k_conversion_ikeiji, // �۷����Ѵ� - k_conversion_rensou, // Ϣ���Ѵ� - k_select_yosoku, // ͽ¬���� - - k_dummy; -}; - - -#endif - diff --git a/honoka/src/scim_wnn_imengine_setup.cpp b/honoka/src/scim_wnn_imengine_setup.cpp deleted file mode 100644 index a4b81e1..0000000 --- a/honoka/src/scim_wnn_imengine_setup.cpp +++ /dev/null @@ -1,1134 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * Copyright (C) 2004 TAM (Teppei Tamra) - * Copyright (C) 2004 Hiroyuki Ikezoe - * Copyright (C) 2004 Takuro Ashie - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - * Based on scim-hangul. - * Copyright (c) 2004 James Su - */ - -#define Uses_SCIM_CONFIG_BASE - -#include - -#ifdef HAVE_CONFIG_H - #include -#endif - -#include -#include -#include "scim_wnn_def.h" - -#ifdef HAVE_GETTEXT - #include - #define _(String) dgettext(GETTEXT_PACKAGE,String) - #define N_(String) (String) -#else - #define _(String) (String) - #define N_(String) (String) - #define bindtextdomain(Package,Directory) - #define textdomain(domain) - #define bind_textdomain_codeset(domain,codeset) -#endif - -using namespace scim; - -#define scim_module_init wnn_imengine_setup_LTX_scim_module_init -#define scim_module_exit wnn_imengine_setup_LTX_scim_module_exit - -#define scim_setup_module_create_ui wnn_imengine_setup_LTX_scim_setup_module_create_ui -#define scim_setup_module_get_category wnn_imengine_setup_LTX_scim_setup_module_get_category -#define scim_setup_module_get_name wnn_imengine_setup_LTX_scim_setup_module_get_name -#define scim_setup_module_get_description wnn_imengine_setup_LTX_scim_setup_module_get_description -#define scim_setup_module_load_config wnn_imengine_setup_LTX_scim_setup_module_load_config -#define scim_setup_module_save_config wnn_imengine_setup_LTX_scim_setup_module_save_config -#define scim_setup_module_query_changed wnn_imengine_setup_LTX_scim_setup_module_query_changed - - - -static GtkWidget * create_setup_window (); -static void load_config (const ConfigPointer &config); -static void save_config (const ConfigPointer &config); -static bool query_changed (); - -// Module Interface. - -extern "C" { - void scim_module_init (void) - { - bindtextdomain (GETTEXT_PACKAGE, SCIM_WNN_LOCALEDIR); - bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); - } - - void scim_module_exit (void) - { - } - - GtkWidget * scim_setup_module_create_ui (void) - { - return create_setup_window (); - } - - String scim_setup_module_get_category (void) - { - return String ("IMEngine"); - } - - String scim_setup_module_get_name (void) - { - return String (_("Wnn")); - } - - String scim_setup_module_get_description (void) - { - return String (_("A Wnn IMEngine Module.")); - } - - void scim_setup_module_load_config (const ConfigPointer &config) - { - load_config (config); - } - - void scim_setup_module_save_config (const ConfigPointer &config) - { - save_config (config); - } - - bool scim_setup_module_query_changed () - { - return query_changed (); - } -} // extern "C" - - -// Internal data structure -struct KeyboardConfigData -{ - const char *key; - String data; - const char *label; - const char *title; - const char *tooltip; - GtkWidget *entry; - GtkWidget *button; -}; - -struct KeyboardConfigPage -{ - const char *label; - KeyboardConfigData *data; -}; - -struct ListData -{ - GtkWidget *widget; - String name; - gchar *label; -}; - -// Internal data declaration. -//static bool __config_use_kana = false; -static String __config_server = SCIM_DEFAULT_WNN_SERVER; -static String __config_wnn_rc = SCIM_DEFAULT_WNN_RC; -static String __config_servertype = SCIM_DEFAULT_WNN_SERVERTYPE; -static String __config_preeditor = SCIM_DEFAULT_WNN_DEFAULT_PREEDITOR; -static bool __config_yosoku = SCIM_DEFAULT_WNN_YOSOKU; -static bool __config_numkeyselect = SCIM_DEFAULT_WNN_NUMKEY_SELECT; -static bool __config_autoconversion = SCIM_DEFAULT_WNN_AUTO_CONVERSION; -static int __config_alp = SCIM_DEFAULT_WNN_ALP; -static String __config_romkan_table = SCIM_DEFAULT_WNN_ROMKAN_TABLE_FILE; - -static bool __have_changed = true; - -//static GtkWidget * __widget_use_kana = 0; -static GtkWidget * __widget_server = 0; -static GtkWidget * __widget_servertype = 0; -static GtkWidget * __widget_preeditor = 0; -static GtkWidget * __widget_wnn_rc = 0; -static GtkWidget * __widget_yosoku = 0; -static GtkWidget * __widget_alp = 0; -static GtkWidget * __widget_numkeyselect = 0; -static GtkWidget * __widget_autoconversion = 0; -static GtkWidget * __widget_romkan_table = 0; -static GtkTooltips * __widget_tooltips = 0; - -static ListData __list_data [] = -{ - { - NULL, - String("Wnn4"), - N_("Wnn4 or FreeWnn"), - }, - { - NULL, - String("Wnn6"), - N_("Wnn6"), - }, - { - NULL, - String("Wnn7"), - N_("Wnn7"), - }, - { - NULL, - String("Wnn8"), - N_("Wnn8"), - }, - { - NULL, - String("Romkan"), - N_("Roma-Kana input"), - }, - { - NULL, - String("KanaInput"), - N_("Kana input"), - }, - { - NULL, - String(), - NULL, - }, -}; - -static KeyboardConfigData __config_keyboards_common [] = -{ - { - SCIM_CONFIG_WNN_KEY_COMMIT, - SCIM_DEFAULT_WNN_KEY_COMMIT, - N_("Commit keys:"), - N_("Select commit keys"), - N_("The key events to commit the preedit string. "), - NULL, - NULL, - }, - { - SCIM_CONFIG_WNN_KEY_CONVERSION_START, - SCIM_DEFAULT_WNN_KEY_CONVERSION_START, - N_("Convert keys:"), - N_("Select convert keys"), - N_("The key events to convert the preedit string to kanji. "), - NULL, - NULL, - }, - { - SCIM_CONFIG_WNN_KEY_CANCEL, - SCIM_DEFAULT_WNN_KEY_CANCEL, - N_("Cancel keys:"), - N_("Select cancel keys"), - N_("The key events to cancel preediting or converting. "), - NULL, - NULL, - }, - { - SCIM_CONFIG_WNN_KEY_BACKSPACE, - SCIM_DEFAULT_WNN_KEY_BACKSPACE, - N_("Backspace keys:"), - N_("Select backspace keys"), - N_("The key events to delete a character before caret. "), - NULL, - NULL, - }, - { - SCIM_CONFIG_WNN_KEY_DELETE, - SCIM_DEFAULT_WNN_KEY_DELETE, - N_("Delete keys:"), - N_("Select delete keys"), - N_("The key events to delete a character after caret. "), - NULL, - NULL, - }, - { - NULL, - "", - NULL, - NULL, - NULL, - NULL, - NULL, - }, -}; - -static KeyboardConfigData __config_keyboards_caret [] = -{ - { - SCIM_CONFIG_WNN_KEY_FORWARD, - SCIM_DEFAULT_WNN_KEY_FORWARD, - N_("Move forward keys:"), - N_("Select move caret forward keys"), - N_("The key events to move the caret to forward. "), - NULL, - NULL, - }, - { - SCIM_CONFIG_WNN_KEY_BACKWARD, - SCIM_DEFAULT_WNN_KEY_BACKWARD, - N_("Move backward keys:"), - N_("Select move caret backward keys"), - N_("The key events to move the caret to backward. "), - NULL, - NULL, - }, - { - NULL, - "", - NULL, - NULL, - NULL, - NULL, - NULL, - }, -}; - -static KeyboardConfigData __config_keyboards_segment [] = -{ - { - SCIM_CONFIG_WNN_KEY_CONVERSION_FORWARD, - SCIM_DEFAULT_WNN_KEY_CONVERSION_FORWARD, - N_("Next segment keys:"), - N_("Select next segment keys"), - N_("The key events to select next segment. "), - NULL, - NULL, - }, - { - SCIM_CONFIG_WNN_KEY_CONVERSION_BACKWARD, - SCIM_DEFAULT_WNN_KEY_CONVERSION_BACKWARD, - N_("Previous segment keys:"), - N_("Select previous segment keys"), - N_("The key events to select previous segment. "), - NULL, - NULL, - }, - { - SCIM_CONFIG_WNN_KEY_CONVERSION_SHRINK, - SCIM_DEFAULT_WNN_KEY_CONVERSION_SHRINK, - N_("Shrink segment keys:"), - N_("Select shrink segment keys"), - N_("The key events to shrink the selected segment. "), - NULL, - NULL, - }, - { - SCIM_CONFIG_WNN_KEY_CONVERSION_EXPAND, - SCIM_DEFAULT_WNN_KEY_CONVERSION_EXPAND, - N_("Expand segment keys:"), - N_("Select expand segment keys"), - N_("The key events to expand the selected segment. "), - NULL, - NULL, - }, - { - NULL, - "", - NULL, - NULL, - NULL, - NULL, - NULL, - }, -}; - -static KeyboardConfigData __config_keyboards_candidates [] = -{ - { - SCIM_CONFIG_WNN_KEY_CONVERSION_NEXT, - SCIM_DEFAULT_WNN_KEY_CONVERSION_NEXT, - N_("Next keys:"), - N_("Select next candidate keys"), - N_("The key events to select next candidate. "), - NULL, - NULL, - }, - { - SCIM_CONFIG_WNN_KEY_CONVERSION_PREV, - SCIM_DEFAULT_WNN_KEY_CONVERSION_PREV, - N_("Previous keys:"), - N_("Select previous candidate keys"), - N_("The key events to select previous candidate. "), - NULL, - NULL, - }, - { - SCIM_CONFIG_WNN_KEY_LOOKUPPOPUP, - SCIM_DEFAULT_WNN_KEY_LOOKUPPOPUP, - N_("candidates list keys:"), - N_("Select candidates list keys"), - N_("The key events to popup candidates list. "), - NULL, - NULL, - }, - { - SCIM_CONFIG_WNN_KEY_LOOKUPPAGEUP, - SCIM_DEFAULT_WNN_KEY_LOOKUPPAGEUP, - N_("Page up keys:"), - N_("Select page up candidates keys"), - N_("The key events to select page up candidates. "), - NULL, - NULL, - }, - { - SCIM_CONFIG_WNN_KEY_LOOKUPPAGEDOWN, - SCIM_DEFAULT_WNN_KEY_LOOKUPPAGEDOWN, - N_("Page down keys:"), - N_("Select page down candidates keys"), - N_("The key events to select page down candidates. "), - NULL, - NULL, - }, - { - NULL, - "", - NULL, - NULL, - NULL, - NULL, - NULL, - }, -}; - -static KeyboardConfigData __config_keyboards_other [] = -{ - { - SCIM_CONFIG_WNN_KEY_AUTO_CONVERSION, - SCIM_DEFAULT_WNN_KEY_AUTO_CONVERSION, - N_("auto conversion mode keys:"), - N_("Select auto conversion mode keys"), - N_("The key events to change auto conversion mode. "), - NULL, - NULL, - }, - { - SCIM_CONFIG_WNN_KEY_SELECT_YOSOKU, - SCIM_DEFAULT_WNN_KEY_SELECT_YOSOKU, - N_("Yosoku keys:"), - N_("Select yosoku keys"), - N_("The key events to select from completion list. "), - NULL, - NULL, - }, - { - SCIM_CONFIG_WNN_KEY_CONVERSION_IKEIJI, - SCIM_DEFAULT_WNN_KEY_CONVERSION_IKEIJI, - N_("Convert to ikeiji keys:"), - N_("Select ikeiji keys"), - N_("The key events to convert the selected candidate to ikei-kanji. "), - NULL, - NULL, - }, - { - SCIM_CONFIG_WNN_KEY_CONVERSION_RENSOU, - SCIM_DEFAULT_WNN_KEY_CONVERSION_RENSOU, - N_("Convert to rensou keys:"), - N_("Select rensou keys"), - N_("The key events to convert the selected candidate to the associated acceptation string. "), - NULL, - NULL, - }, - { - SCIM_CONFIG_WNN_KEY_CONVERT_HIRAGANA, - SCIM_DEFAULT_WNN_KEY_CONVERT_HIRAGANA, - N_("Convert to HIRAGANA keys:"), - N_("Select convert to HIRAGANA keys"), - N_("The key events to convert the selected candidate or the preedit string to HIRAGANA. "), - NULL, - NULL, - }, - { - SCIM_CONFIG_WNN_KEY_CONVERT_KATAKANA, - SCIM_DEFAULT_WNN_KEY_CONVERT_KATAKANA, - N_("Convert to KATAKANA keys:"), - N_("Select convert to KATAGANA keys"), - N_("The key events to convert the selected candidate or the preedit string to KATAKANA. "), - NULL, - NULL, - }, - { - NULL, - "", - NULL, - NULL, - NULL, - NULL, - NULL, - }, -}; - -static struct KeyboardConfigPage __key_conf_pages[] = -{ - {N_("Common keys"), __config_keyboards_common}, - {N_("Preedit keys"), __config_keyboards_caret}, - {N_("Candidates keys"), __config_keyboards_candidates}, - {N_("Other function keys"), __config_keyboards_other}, -}; -static unsigned int __key_conf_pages_num = sizeof (__key_conf_pages) / sizeof (KeyboardConfigPage); - -static void on_default_editable_changed (GtkEditable *editable, - gpointer user_data); -static void on_default_number_changed (GtkEditable *editable, - gpointer user_data); -static void on_default_toggle_button_toggled (GtkToggleButton *togglebutton, - gpointer user_data); -static void on_default_key_selection_clicked (GtkButton *button, - gpointer user_data); -static void on_default_file_selection_button (GtkButton *button, - gpointer user_data); -static void on_default_list_changed (GtkList *list, - GtkWidget *widget, - gpointer user_data); -static void setup_widget_value (void); - - -static GtkWidget * -create_options_page () -{ - GtkWidget *vbox, *table, *label, *button, *button2; - unsigned int i; - GList *list = NULL; - - vbox = gtk_vbox_new (FALSE, 0); - gtk_widget_show (vbox); - - for(i = 0;__list_data[i].label;i ++) { - __list_data[i].widget = gtk_list_item_new_with_label(_(__list_data[i].label)); - gtk_widget_show (__list_data[i].widget); - } - - //__widget_use_kana = gtk_check_button_new_with_mnemonic (_("Use _Kana Table")); - //gtk_widget_show (__widget_use_kana); - //gtk_box_pack_start (GTK_BOX (vbox), __widget_use_kana, FALSE, FALSE, 4); - //gtk_container_set_border_width (GTK_CONTAINER (__widget_use_kana), 4); - - // Connect all signals. - //g_signal_connect ((gpointer) __widget_use_kana, "toggled", - // G_CALLBACK (on_default_toggle_button_toggled), - // &__config_use_kana); - - table = gtk_table_new (3, 6, FALSE); - gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0); - gtk_widget_show (table); - - /* server */ - label = gtk_label_new_with_mnemonic (_("_Server: ")); - gtk_widget_show (label); - gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); - gtk_misc_set_padding (GTK_MISC (label), 4, 0); - gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (GTK_FILL), 4, 4); - - __widget_server = gtk_entry_new (); - gtk_widget_show (__widget_server); - gtk_table_attach (GTK_TABLE (table), __widget_server, 1, 2, 0, 1, - (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), - (GtkAttachOptions) (GTK_FILL), 4, 4); - gtk_label_set_mnemonic_widget (GTK_LABEL (label), __widget_server); - if (!__widget_tooltips) - __widget_tooltips = gtk_tooltips_new(); - gtk_tooltips_set_tip (__widget_tooltips, __widget_server, - _("input the server name to connect."), NULL); - - - /* wnnenvrc */ - label = gtk_label_new_with_mnemonic (_("_wnnenvrc: ")); - gtk_widget_show (label); - gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); - gtk_misc_set_padding (GTK_MISC (label), 4, 0); - gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (GTK_FILL), 4, 4); - - __widget_wnn_rc = gtk_entry_new (); - gtk_widget_show (__widget_wnn_rc); - gtk_table_attach (GTK_TABLE (table), __widget_wnn_rc, 1, 2, 1, 2, - (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), - (GtkAttachOptions) (GTK_FILL), 4, 4); - gtk_label_set_mnemonic_widget (GTK_LABEL (label), __widget_wnn_rc); - - button = gtk_button_new_with_label (_("...")); - gtk_widget_show (button); - gtk_table_attach (GTK_TABLE (table), button, 2, 3, 1, 2, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (GTK_FILL), 4, 4); - //gtk_label_set_mnemonic_widget (GTK_LABEL (label), button); - gtk_tooltips_set_tip (__widget_tooltips, __widget_wnn_rc, - _("input the path of wnnenvrc."), NULL); - - /* servertype */ - label = gtk_label_new_with_mnemonic (_("Server_type: ")); - gtk_widget_show (label); - gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); - gtk_misc_set_padding (GTK_MISC (label), 4, 0); - gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (GTK_FILL), 4, 4); - - list = g_list_append(list,__list_data[0].widget); - list = g_list_append(list,__list_data[1].widget); - list = g_list_append(list,__list_data[2].widget); - list = g_list_append(list,__list_data[3].widget); - __widget_servertype = gtk_list_new (); - gtk_list_append_items(GTK_LIST(__widget_servertype),list); - gtk_widget_show (__widget_servertype); - gtk_table_attach (GTK_TABLE (table), __widget_servertype, 1, 2, 2, 3, - (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), - (GtkAttachOptions) (GTK_FILL), 4, 4); - gtk_label_set_mnemonic_widget (GTK_LABEL (label), __list_data[0].widget); - gtk_tooltips_set_tip (__widget_tooltips, __widget_servertype, - _("select the server type from Wnn4 / Wnn6 / Wnn7."), NULL); - - /* default preeditor */ - label = gtk_label_new_with_mnemonic (_("Default_PreEditor: ")); - gtk_widget_show (label); - gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); - gtk_misc_set_padding (GTK_MISC (label), 4, 0); - gtk_table_attach (GTK_TABLE (table), label, 0, 1, 3, 4, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (GTK_FILL), 4, 4); - - list = NULL; - list = g_list_append(list,__list_data[4].widget); - list = g_list_append(list,__list_data[5].widget); - __widget_preeditor = gtk_list_new (); - gtk_list_append_items(GTK_LIST(__widget_preeditor),list); - gtk_widget_show (__widget_preeditor); - gtk_table_attach (GTK_TABLE (table), __widget_preeditor, 1, 2, 3, 4, - (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), - (GtkAttachOptions) (GTK_FILL), 4, 4); - gtk_label_set_mnemonic_widget (GTK_LABEL (label), __list_data[3].widget); - gtk_tooltips_set_tip (__widget_tooltips, __widget_preeditor, - _("select the default preeditor."), NULL); - - - /* ALP */ - label = gtk_label_new_with_mnemonic (_("_Auto candidates popup: ")); - gtk_widget_show (label); - gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); - gtk_misc_set_padding (GTK_MISC (label), 4, 0); - gtk_table_attach (GTK_TABLE (table), label, 0, 1, 4, 5, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (GTK_FILL), 4, 4); - - GtkAdjustment* aj; - aj = (GtkAdjustment *) gtk_adjustment_new(0,-1,10,1,1,1); - __widget_alp = gtk_spin_button_new(aj,1,0); - gtk_widget_show (__widget_alp); - gtk_table_attach (GTK_TABLE (table), __widget_alp, 1, 2, 4, 5, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (GTK_FILL), 4, 4); - gtk_label_set_mnemonic_widget (GTK_LABEL (label), __widget_alp); - gtk_tooltips_set_tip (__widget_tooltips, __widget_alp, - _("set the count of conversion until displaying the list of lookup result automatically."), NULL); - - /* numkeyselection */ - label = gtk_label_new_with_mnemonic (_("_NumKey selection: ")); - gtk_widget_show (label); - gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); - gtk_misc_set_padding (GTK_MISC (label), 4, 0); - gtk_table_attach (GTK_TABLE (table), label, 0, 1, 5, 6, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (GTK_FILL), 4, 4); - - __widget_numkeyselect = gtk_check_button_new(); - gtk_widget_show (__widget_numkeyselect); - gtk_table_attach (GTK_TABLE (table), __widget_numkeyselect, 1, 2, 5, 6, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (GTK_FILL), 4, 4); - gtk_label_set_mnemonic_widget (GTK_LABEL (label), __widget_numkeyselect); - gtk_tooltips_set_tip (__widget_tooltips, __widget_numkeyselect, - _("If you use the candidate selection by numkey, check this."), NULL); - - /* auto conversion */ - label = gtk_label_new_with_mnemonic (_("Auto _conversion: ")); - gtk_widget_show (label); - gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); - gtk_misc_set_padding (GTK_MISC (label), 4, 0); - gtk_table_attach (GTK_TABLE (table), label, 0, 1, 6, 7, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (GTK_FILL), 4, 4); - - __widget_autoconversion = gtk_check_button_new(); - gtk_widget_show (__widget_autoconversion); - gtk_table_attach (GTK_TABLE (table), __widget_autoconversion, 1, 2, 6, 7, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (GTK_FILL), 4, 4); - gtk_label_set_mnemonic_widget (GTK_LABEL (label), __widget_autoconversion); - gtk_tooltips_set_tip (__widget_tooltips, __widget_autoconversion, - _("If you set default to the auto conversion mode use, check this."), NULL); - - - /* completion */ - label = gtk_label_new_with_mnemonic (_("_YOSOKU-input: ")); - gtk_widget_show (label); - gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); - gtk_misc_set_padding (GTK_MISC (label), 4, 0); - gtk_table_attach (GTK_TABLE (table), label, 0, 1, 7, 8, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (GTK_FILL), 4, 4); - - __widget_yosoku = gtk_check_button_new(); - gtk_widget_show (__widget_yosoku); - gtk_table_attach (GTK_TABLE (table), __widget_yosoku, 1, 2, 7, 8, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (GTK_FILL), 4, 4); - gtk_label_set_mnemonic_widget (GTK_LABEL (label), __widget_yosoku); - gtk_tooltips_set_tip (__widget_tooltips, __widget_yosoku, - _("if you use YOSOKU-input , check this."), NULL); - - - // romkan_table - label = gtk_label_new_with_mnemonic (_("_Roma-Kana table: ")); - gtk_widget_show (label); - gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); - gtk_misc_set_padding (GTK_MISC (label), 4, 0); - gtk_table_attach (GTK_TABLE (table), label, 0, 1, 8, 9, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (GTK_FILL), 4, 4); - - __widget_romkan_table = gtk_entry_new (); - gtk_widget_show (__widget_romkan_table); - gtk_table_attach (GTK_TABLE (table), __widget_romkan_table, 1, 2, 8, 9, - (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), - (GtkAttachOptions) (GTK_FILL), 4, 4); - gtk_label_set_mnemonic_widget (GTK_LABEL (label), __widget_romkan_table); - - button2 = gtk_button_new_with_label (_("...")); - gtk_widget_show (button2); - gtk_table_attach (GTK_TABLE (table), button2, 2, 3, 8, 9, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (GTK_FILL), 4, 4); - gtk_tooltips_set_tip (__widget_tooltips, __widget_romkan_table, - _("input the path of Roma-Kana convert table file."), NULL); - - - - /* connect all signals */ - g_signal_connect ((gpointer) __widget_server, "changed", - G_CALLBACK (on_default_editable_changed), - &__config_server); - g_signal_connect ((gpointer) __widget_wnn_rc, "changed", - G_CALLBACK (on_default_editable_changed), - &__config_wnn_rc); - g_signal_connect ((gpointer) button, "clicked", - G_CALLBACK (on_default_file_selection_button), - __widget_wnn_rc); - g_signal_connect ((gpointer) __widget_servertype, "select-child", - G_CALLBACK (on_default_list_changed), - &__config_servertype); - g_signal_connect ((gpointer) __widget_preeditor, "select-child", - G_CALLBACK (on_default_list_changed), - &__config_preeditor); - g_signal_connect ((gpointer) __widget_alp, "changed", - G_CALLBACK (on_default_number_changed), - &__config_alp); - g_signal_connect ((gpointer) __widget_numkeyselect, "toggled", - G_CALLBACK (on_default_toggle_button_toggled), - &__config_numkeyselect); - g_signal_connect ((gpointer) __widget_autoconversion, "toggled", - G_CALLBACK (on_default_toggle_button_toggled), - &__config_autoconversion); - g_signal_connect ((gpointer) __widget_yosoku, "toggled", - G_CALLBACK (on_default_toggle_button_toggled), - &__config_yosoku); - g_signal_connect ((gpointer) __widget_romkan_table, "changed", - G_CALLBACK (on_default_editable_changed), - &__config_romkan_table); - g_signal_connect ((gpointer) button2, "clicked", - G_CALLBACK (on_default_file_selection_button), - __widget_romkan_table); - - return vbox; -} - -static GtkWidget * -create_keyboard_page (unsigned int page) -{ - GtkWidget *table; - GtkWidget *label; - - if (page >= __key_conf_pages_num) - return NULL; - - KeyboardConfigData *data = __key_conf_pages[page].data; - - table = gtk_table_new (3, 3, FALSE); - gtk_widget_show (table); - - // Create keyboard setting. - for (unsigned int i = 0; data[i].key; ++ i) { - label = gtk_label_new (NULL); - gtk_label_set_text_with_mnemonic (GTK_LABEL (label), _(data[i].label)); - gtk_widget_show (label); - gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); - gtk_misc_set_padding (GTK_MISC (label), 4, 0); - gtk_table_attach (GTK_TABLE (table), label, 0, 1, i, i+1, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (GTK_FILL), 4, 4); - - data[i].entry = gtk_entry_new (); - gtk_widget_show (data[i].entry); - gtk_table_attach (GTK_TABLE (table), data[i].entry, 1, 2, i, i+1, - (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), - (GtkAttachOptions) (GTK_FILL), 4, 4); - gtk_entry_set_editable (GTK_ENTRY (data[i].entry), FALSE); - - data[i].button = gtk_button_new_with_label (_("...")); - gtk_widget_show (data[i].button); - gtk_table_attach (GTK_TABLE (table), data[i].button, 2, 3, i, i+1, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (GTK_FILL), 4, 4); - gtk_label_set_mnemonic_widget (GTK_LABEL (label), data[i].button); - } - - for (unsigned int i = 0; data[i].key; ++ i) { - g_signal_connect ((gpointer) data[i].button, "clicked", - G_CALLBACK (on_default_key_selection_clicked), - &(data[i])); - g_signal_connect ((gpointer) data[i].entry, "changed", - G_CALLBACK (on_default_editable_changed), - &(data[i].data)); - } - - if (!__widget_tooltips) - __widget_tooltips = gtk_tooltips_new(); - for (unsigned int i = 0; data[i].key; ++ i) { - gtk_tooltips_set_tip (__widget_tooltips, data[i].entry, - _(data[i].tooltip), NULL); - } - - return table; -} - -static GtkWidget * -create_setup_window () -{ - static GtkWidget *window = NULL; - - if (!window) { - GtkWidget *notebook = gtk_notebook_new(); - gtk_widget_show (notebook); - window = notebook; - gtk_notebook_set_scrollable (GTK_NOTEBOOK (notebook), TRUE); - - // Create the first page. - GtkWidget *page = create_options_page (); - GtkWidget *label = gtk_label_new (_("Options")); - gtk_widget_show (label); - gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, label); - - setup_widget_value (); - - // Create the second page. - for (unsigned int i = 0; i < __key_conf_pages_num; i++) { - page = create_keyboard_page (i); - label = gtk_label_new (_(__key_conf_pages[i].label)); - gtk_widget_show (label); - gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, label); - } - - setup_widget_value (); - } - - return window; -} - -static void -setup_widget_value (void) -{ -// if (__widget_use_kana) { -// gtk_toggle_button_set_active ( -// GTK_TOGGLE_BUTTON (__widget_use_kana), -// __config_use_kana); -// } - if (__widget_server) { - gtk_entry_set_text ( - GTK_ENTRY (__widget_server), - __config_server.c_str ()); - } - - if (__widget_wnn_rc) { - gtk_entry_set_text ( - GTK_ENTRY (__widget_wnn_rc), - __config_wnn_rc.c_str ()); - } - - if (__widget_servertype) { - for(unsigned int i = 0;__list_data[i].widget;i ++) { - if (__list_data[i].name == __config_servertype) { - gtk_list_select_child(GTK_LIST(__widget_servertype),__list_data[i].widget); - break; - } - } - } - - if (__widget_preeditor) { - for(unsigned int i = 0;__list_data[i].widget;i ++) { - if (__list_data[i].name == __config_preeditor) { - gtk_list_select_child(GTK_LIST(__widget_preeditor),__list_data[i].widget); - break; - } - } - } - - if (__widget_alp) { - gtk_spin_button_set_value ( - GTK_SPIN_BUTTON (__widget_alp), - __config_alp); - } - - if (__widget_numkeyselect) { - gtk_toggle_button_set_active ( - GTK_TOGGLE_BUTTON (__widget_numkeyselect), - __config_numkeyselect); - } - - if (__widget_autoconversion) { - gtk_toggle_button_set_active ( - GTK_TOGGLE_BUTTON (__widget_autoconversion), - __config_autoconversion); - } - - if (__widget_yosoku) { - gtk_toggle_button_set_active ( - GTK_TOGGLE_BUTTON (__widget_yosoku), - __config_yosoku); - } - - if (__widget_romkan_table) { - gtk_entry_set_text ( - GTK_ENTRY (__widget_romkan_table), - __config_romkan_table.c_str ()); - } - - for (unsigned int j = 0; j < __key_conf_pages_num; ++ j) { - for (unsigned int i = 0; __key_conf_pages[j].data[i].key; ++ i) { - if (__key_conf_pages[j].data[i].entry) { - gtk_entry_set_text ( - GTK_ENTRY (__key_conf_pages[j].data[i].entry), - __key_conf_pages[j].data[i].data.c_str ()); - } - } - } -} - -static void -load_config (const ConfigPointer &config) -{ - if (!config.null ()) { - // __config_use_kana = - // config->read (String (SCIM_CONFIG_IMENGINE_ANTHY_USE_KANA), - // __config_use_kana); - __config_server = - config->read (String (SCIM_CONFIG_WNN_SERVER), - __config_server); - __config_wnn_rc = - config->read (String (SCIM_CONFIG_WNN_RC), - __config_wnn_rc); - __config_servertype = - config->read (String (SCIM_CONFIG_WNN_SERVERTYPE), - __config_servertype); - __config_preeditor = - config->read (String (SCIM_CONFIG_WNN_DEFAULT_PREEDITOR), - __config_preeditor); - __config_alp = - config->read (String (SCIM_CONFIG_WNN_ALP), - __config_alp); - __config_numkeyselect = - config->read (String (SCIM_CONFIG_WNN_NUMKEY_SELECT), - __config_numkeyselect); - __config_autoconversion = - config->read (String (SCIM_CONFIG_WNN_AUTO_CONVERSION), - __config_autoconversion); - __config_yosoku = - config->read (String (SCIM_CONFIG_WNN_YOSOKU), - __config_yosoku); - __config_romkan_table = - config->read (String (SCIM_CONFIG_WNN_ROMKAN_TABLE_FILE), - __config_romkan_table); - - for (unsigned int j = 0; j < __key_conf_pages_num; j++) { - for (unsigned int i = 0; __key_conf_pages[j].data[i].key; ++ i) { - __key_conf_pages[j].data[i].data = - config->read (String (__key_conf_pages[j].data[i].key), - __key_conf_pages[j].data[i].data); - } - } - - setup_widget_value (); - - __have_changed = false; - } -} - -static void -save_config (const ConfigPointer &config) -{ - if (!config.null ()) { - // config->write (String (SCIM_CONFIG_IMENGINE_ANTHY_USE_KANA), - // __config_use_kana); - config->write (String (SCIM_CONFIG_WNN_SERVER), - __config_server); - config->write (String (SCIM_CONFIG_WNN_RC), - __config_wnn_rc); - config->write (String (SCIM_CONFIG_WNN_SERVERTYPE), - __config_servertype); - config->write (String (SCIM_CONFIG_WNN_DEFAULT_PREEDITOR), - __config_preeditor); - config->write (String (SCIM_CONFIG_WNN_ALP), - __config_alp); - config->write (String (SCIM_CONFIG_WNN_NUMKEY_SELECT), - __config_numkeyselect); - config->write (String (SCIM_CONFIG_WNN_AUTO_CONVERSION), - __config_autoconversion); - config->write (String (SCIM_CONFIG_WNN_YOSOKU), - __config_yosoku); - config->write (String (SCIM_CONFIG_WNN_ROMKAN_TABLE_FILE), - __config_romkan_table); - - for (unsigned j = 0; j < __key_conf_pages_num; j++) { - for (unsigned int i = 0; __key_conf_pages[j].data[i].key; ++ i) { - config->write (String (__key_conf_pages[j].data[i].key), - __key_conf_pages[j].data[i].data); - } - } - - __have_changed = false; - } -} - -static bool -query_changed () -{ - return __have_changed; -} - - -static void -on_default_toggle_button_toggled (GtkToggleButton *togglebutton, - gpointer user_data) -{ - bool *toggle = static_cast (user_data); - - if (toggle) { - *toggle = gtk_toggle_button_get_active (togglebutton); - __have_changed = true; - } -} - -static void -on_default_editable_changed (GtkEditable *editable, - gpointer user_data) -{ - String *str = static_cast (user_data); - - if (str) { - *str = String (gtk_entry_get_text (GTK_ENTRY (editable))); - __have_changed = true; - } -} - -static void -on_default_number_changed (GtkEditable *editable, - gpointer user_data) -{ - int *num = static_cast (user_data); - - if (num) { - *num = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (editable)); - __have_changed = true; - } -} - -static void -on_default_list_changed (GtkList *list, - GtkWidget *widget, - gpointer user_data) -{ - String *str = static_cast (user_data); - - if (str) { - for(unsigned int i = 0;__list_data[i].widget;i ++) { - if (__list_data[i].widget == widget) - *str = __list_data[i].name; - } - __have_changed = true; - } -} - -static void -on_default_key_selection_clicked (GtkButton *button, - gpointer user_data) -{ - KeyboardConfigData *data = static_cast (user_data); - - if (data) { - GtkWidget *dialog = scim_key_selection_dialog_new (_(data->title)); - gint result; - - scim_key_selection_dialog_set_keys ( - SCIM_KEY_SELECTION_DIALOG (dialog), - gtk_entry_get_text (GTK_ENTRY (data->entry))); - - result = gtk_dialog_run (GTK_DIALOG (dialog)); - - if (result == GTK_RESPONSE_OK) { - const gchar *keys = scim_key_selection_dialog_get_keys ( - SCIM_KEY_SELECTION_DIALOG (dialog)); - - if (!keys) keys = ""; - - if (strcmp (keys, gtk_entry_get_text (GTK_ENTRY (data->entry))) != 0) - gtk_entry_set_text (GTK_ENTRY (data->entry), keys); - } - - gtk_widget_destroy (dialog); - } -} - -static void -on_ok_clicked (GtkButton *button, gpointer user_data) -{ - bool *ok = static_cast(user_data); - if (ok) - *ok = true; -} - -static void -on_default_file_selection_button (GtkButton *button, gpointer user_data) -{ - GtkEntry *entry = GTK_ENTRY (user_data); - const char *path = gtk_entry_get_text (entry); - bool ok = false; - - GtkFileSelection *sel = GTK_FILE_SELECTION (gtk_file_selection_new ("Select a file")); - gtk_file_selection_set_filename (sel, path); - g_signal_connect (G_OBJECT (sel->ok_button), "clicked", - G_CALLBACK (on_ok_clicked), - (gpointer) &ok); - gtk_window_set_transient_for ( - GTK_WINDOW (sel), - GTK_WINDOW (gtk_widget_get_toplevel(GTK_WIDGET (entry)))); - gtk_dialog_run (GTK_DIALOG (sel)); - - if (ok) - gtk_entry_set_text (entry, gtk_file_selection_get_filename (sel)); - - gtk_widget_destroy (GTK_WIDGET (sel)); -} diff --git a/honoka/src/wnnconversion.cpp b/honoka/src/wnnconversion.cpp index 6b43fc2..21632a6 100644 --- a/honoka/src/wnnconversion.cpp +++ b/honoka/src/wnnconversion.cpp @@ -18,7 +18,7 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "wnnconversion.h" -#include +#include #ifdef HAVE_CONFIG_H #include @@ -89,9 +89,9 @@ */ bool WnnConversion::connect() { - String host = config->read(String(SCIM_CONFIG_WNN_SERVER),String(SCIM_DEFAULT_WNN_SERVER)); - String rc = config->read(String(SCIM_CONFIG_WNN_RC),String(SCIM_DEFAULT_WNN_RC)); - String t = config->read(String(SCIM_CONFIG_WNN_SERVERTYPE),String(SCIM_DEFAULT_WNN_SERVERTYPE)); + String host = config->read(String(HONOKA_CONFIG_SERVER),String(HONOKA_DEFAULT_SERVER)); + String rc = config->read(String(HONOKA_CONFIG_RC),String(HONOKA_DEFAULT_RC)); + String t = config->read(String(HONOKA_CONFIG_SERVERTYPE),String(HONOKA_DEFAULT_SERVERTYPE)); if (t == "Wnn6") { sType = Wnn6;