TIM问题解答
TIM FAQ

1. TIM是干什么的?
1. What is TIM?

TIM (Table-based Input Method) 是GTK+ 2的一个键盘输入模块,该输入 法由其转换码表控制,你可以方便地修改或增加码表来定义自己的输入法。
TIM (Table-based Input Method) is a GTK+ 2 input method module whose conversion table is stored in a file. You can define your own input method by creating your own conversion table.

2. 怎样安装TIM?
2. How to install TIM?

拿到wenju-*.*.tar.gz后,解开

    tar zxf wenju-*.*.tar.gz
进入wenju区,
    cd wenju-*.*
再行常事
    ./configure; make; make install
当然,你的系统里得有GTK+ 2。
After getting wenju-*.*.tar.gz,
    tar zxf wenju-*.*.tar.gz
Change to wenju directory,
    cd wenju-*.*
and just as any other packages,
    ./configure; make; make install
Of cause, you should have GTK+ 2 pre-installed.

这时,TIM模块已装到/usr/lib/gtk-2.0/2.0.0//immodules目录下,你得告 诉GTK+ 2你新加的输入模块在哪里。运行

    gtk-query-immodules-2.0 > ~/.gtk-2.0/gtk.immodules
将收集你机器中的所有输入模块,列出表来,然后把表gtk.immodules放到 目录~/.gtk-2.0下。设好环境变量
    export GTK_IM_MODULE_FILE=~/.gtk-2.0/gtk.immodules
于是所有GTK+程序就都能用你的TIM输入法了。
Now, TIM module files are loaded into directory /usr/lib/gtk-2.0/2.0.0/immodules. Your job is to inform GTK+ 2 where those input method modules are. Run
    gtk-query-immodules-2.0 > ~/.gtk-2.0/gtk.immodules
It will list all your input method modules and save the list in the directory ~/.gtk-2.0. Set environment variable
    export GTK_IM_MODULE_FILE=~/.gtk-2.0/gtk.immodules
Then you should be able to invoke TIM in all the GTK+ applications.

3. 前面说的还是太过复杂,能不能列出简单几步?
3. Still sounds too complicated, any simple procedures?

简单地说,先在你的~/.bash_profile里加上一行

    export GTK_IM_MODULE_FILE=~/.gtk-2.0/gtk.immodules
然后在字符终端里运行
    tar zxfp wenju-*.*.tar.gz
    cd wenju-*.*
    ./configure; make; make install
即告安装完毕。重新登录后,作为普通用户,运行
    tim-config
然后用任何GTK+ 2程序,比如testtext,右点鼠标弹出一菜单,选其中 Inupt Methods下的Table-based Input Method或以[TIM]结束的, 就可以开始用了。
In summary, add one line in your ~/.bash_profile
export GTK_IM_MODULE_FILE=~/.gtk-2.0/gtk.immodules
Run the following commands in a terminal window:
    tar zxfp wenju-*.*.tar.gz
    cd wenju-*.*
    ./configure; make; make install
After re-login, in your normal user account, run
    tim-config
Then you can launch any GTK+ 2 application, 'texttext' for example, and right click to popup a menu. From which select 'Table-based Input Method' or one of the entry ending with '[TIM]' under ' Input Methods'. You should be able to try TIM now.

4. 怎样修改码表?
4. How to modify conversion table?

码表文件为当前目录下的table.tim及~/.wenju/目录下的所有以.tim结尾 的文件。你可以用你熟悉的编辑工具修改这些码表,其中每一行包含两部 分,中间用'='号空开。前一部分是键码,后一部分是对应的字或词。如果 系重码,则对应同一串键码的几个字或词间用'|'号隔开。比如五笔码表的 头几行

a=工
aaa=工
aaaa=工|恭恭敬敬
aaad=工期
aaag=工巧
aaah=葡萄牙
aaan=工艺
aaaq=工区
aaar=工匠
Conversion tables are file table.tim under your current directory and all the files under ~/.wenju/ with extension '.tim'. You can modify those tables using your favorite editor. It is a plain text file in UTF-8. Each line has two parts which are separated by '='. The first part is key sequence and the second part is the corresponding character or word. If more than one character/word corresponding to the same key sequence, the characters/words are separated by '|'. For example
a=a
A=A
b=b
B=B
C=C|Copyright
'=‘|’
"=“|”
T=T|TIM
@=@|at
w=w
www=World Wide Web
wwww=World Wide Wait|World Worm Web

5. 怎样使用TIM?
5. How to use TIM?

TIM在开始时处于码表模式下,即使用码表输入定义好的字符。按Shift+space 后换到字符模式,就跟普通的键盘一样,可以输入大小写字母、数字、符号 等。Shift+space可在这两种模式间换来换去。
TIM is initially in table mode which makes use of your defined conversion table. Press Shift+space switches to ascii mode which just is the same as normal keyboard. You can input alphebit, number, etc. in ascii mode. You can use Shift+space to switch between ascii mode and table mode.

在码表模式下,以上面的五笔码表为例,按键a时,TIM立即去查 表,只得一‘工’,于是屏幕上显示出下有横线,黑底白字的‘工’。因为无重 码,便没有多选择窗口弹出;否则如有重码,就会显示对应的对种选择,用 .,键可以前后调换不同的字或词。

如再按一a键,查表aa码不对应任何字,此时屏幕上显示出下有 横线,黑底白字的aa。

第三次按a键后,查表aaa又仅对应一个‘工’字,屏幕上重显出 下有横线,黑底白字的‘工’。

第四次按a键后,查表aaaa对应‘工’字或‘恭恭敬敬’,屏幕上仍 显出下有横线,黑底白字的键码aaaa,但弹出多选择窗口,内有“1.工 2.恭 恭敬敬”供选择,

此时按.键则‘恭恭敬敬’排到‘工’的前面,再按. 后又回到‘工’,如此循环往复。

如果想选中‘恭恭敬敬’,可当‘恭恭敬敬’在最前面时按space 键,则多选择窗口消失,‘恭恭敬敬’取代键码aaaa,显作下有横线、白底黑 字样,表示其已选中,但还没有送给当前文本。

你可以继续输入更多的字或词,最后按Enter键送达当前文本。

可见,下列键有特殊用途:

Shift+space 在字母模式和码表模式间换来换去
. 显示对应于当前同一键码的下一个字或词
> 显示对应于当前同一键码的下十个字或词
, 显示对应于当前同一键码的前一个字或词
< 显示对应于当前同一键码的前十个字或词
space 选中显示的字或词
Enter 将输入法下的字符都送到当前文本

此外,如果有多个选择,直接按选择前的数字可以立刻选中某一字或词。如 果数字是键码的一部分,则把数字当作键码:假如不想这样,而一定要把数 字当成选择键,可以在按着某一控制键的同时,按下该数字键。

Using the example of the above conversion table, when you type ' w', TIM will lookup the table and find only 'w'. The resulting 'w' is displayed on screen as white on black with underline. No candidates window popup since there is only one result; otherwise, the candidates window will popup and if you press '.' or ',' key, you will see the candidates change position and you can iterate through them one by one.

If you type 'w' again, key sequence "ww" has no resulting character. The display shows the key sequence as is, "ww" as white on black with underline.

Typing 'w' the third time, from the conversion table, "www" corresponds to "World Wide Web". The display shows "World Wide Web" as white on black with under line.

Typing 'w' the fourth time, from the conversion table, "wwww" corresponds to 'World Wide Wait' or "World Worm Web". The display is the key sequence "wwww" as white on black with underline. In the mean time, a candidates window pops up showing "0.World Wide Wait 1.World Worm Web". If you press '.' key, candidate "World Worm Web" comes first and so forth. If you want to select "World Worm Web", just press space bar while you see "World Worm Web" as the first candidate. Now "World Worm Web" is shown as black on white with underline indicating it has been selected but not commited to the text widget. You can continue your input the same way. In the end, press Enter key to commit your input to the text widget.

As you can see, the following keys has special meanings:

Shift+space Switching between ascii mode and table mode
. Moving to the next candidate of the key sequence
> Moving to the next tenth candidate of the key sequence
, Moving to the previous candidate of the key sequence
< Moving to the previous tenth candidate of the key sequence
space Select the current candidate as converted
Enter Commit the whole converted text to the widget

Press the number before a candidate selects the candidates directly. If the number happens to be part of the key sequence, it is treated as the key sequence. If you want to force a selection, you can press the number key while hoding down a control key.