0
|
1 /*
|
|
2 * $Id: uif.c,v 1.2 2001/06/14 18:16:13 ura Exp $
|
|
3 */
|
|
4
|
|
5 /*
|
|
6 * FreeWnn is a network-extensible Kana-to-Kanji conversion system.
|
|
7 * This file is part of FreeWnn.
|
|
8 *
|
|
9 * Copyright Kyoto University Research Institute for Mathematical Sciences
|
|
10 * 1987, 1988, 1989, 1990, 1991, 1992
|
|
11 * Copyright OMRON Corporation. 1987, 1988, 1989, 1990, 1991, 1992, 1999
|
|
12 * Copyright ASTEC, Inc. 1987, 1988, 1989, 1990, 1991, 1992
|
|
13 * Copyright 1991, 1992 by Massachusetts Institute of Technology
|
|
14 *
|
|
15 * Author: OMRON SOFTWARE Co., Ltd. <freewnn@rd.kyoto.omronsoft.co.jp>
|
|
16 *
|
|
17 * This program is free software; you can redistribute it and/or modify
|
|
18 * it under the terms of the GNU General Public License as published by
|
|
19 * the Free Software Foundation; either version 2, or (at your option)
|
|
20 * any later version.
|
|
21 *
|
|
22 * This program is distributed in the hope that it will be useful,
|
|
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
25 * GNU General Public License for more details.
|
|
26 *
|
|
27 * You should have received a copy of the GNU General Public License
|
|
28 * along with GNU Emacs; see the file COPYING. If not, write to the
|
|
29 * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
30 *
|
|
31 * Commentary:
|
|
32 *
|
|
33 * Change log:
|
|
34 *
|
|
35 * Last modified date: 8,Feb.1999
|
|
36 *
|
|
37 * Code:
|
|
38 *
|
|
39 */
|
|
40 /* Version 4.0
|
|
41 */
|
|
42 #include <stdio.h>
|
|
43 #include "jslib.h"
|
|
44 #include "commonhd.h"
|
|
45 #include "sdefine.h"
|
|
46 #include "xjutil.h"
|
|
47 #include "sxheader.h"
|
|
48 #include "rk_spclval.h" /* defines of CHMSIG, NISEBP */
|
|
49 #include "xext.h"
|
|
50
|
|
51
|
|
52 static int henkan_mode;
|
|
53 /* 0: select
|
|
54 1: yomi_nyuuryoku
|
|
55 2: bunsetu_nobasi
|
|
56 3: kara
|
|
57 */
|
|
58
|
|
59 static void
|
|
60 change_to_insert_mode ()
|
|
61 {
|
|
62 c_b->key_table = main_table[1];
|
|
63 c_b->rk_clear_tbl = romkan_clear_tbl[1];
|
|
64 c_b->key_in_fun = NULL;
|
|
65 c_b->ctrl_code_fun = NULL;
|
|
66 c_b->hanten = 0x08 | 0x20;
|
|
67 henkan_mode = 1;
|
|
68 kk_cursor_normal ();
|
|
69 }
|
|
70
|
|
71 static void
|
|
72 change_to_empty_mode ()
|
|
73 {
|
|
74 c_b->key_table = main_table[3];
|
|
75 c_b->rk_clear_tbl = romkan_clear_tbl[3];
|
|
76 c_b->key_in_fun = NULL;
|
|
77 c_b->ctrl_code_fun = NULL;
|
|
78 c_b->hanten = 0x08 | 0x20;
|
|
79 henkan_mode = 3;
|
|
80 throw_col (0);
|
|
81 kk_cursor_normal ();
|
|
82 }
|
|
83
|
|
84 int
|
|
85 empty_modep ()
|
|
86 {
|
|
87 return (henkan_mode == 3);
|
|
88 }
|
|
89
|
|
90 int
|
|
91 insert_modep ()
|
|
92 {
|
|
93 return (henkan_mode == 1);
|
|
94 }
|
|
95
|
|
96 int
|
|
97 redraw_nisemono_c ()
|
|
98 {
|
|
99 redraw_nisemono ();
|
|
100 if (c_b->maxlen == 0)
|
|
101 {
|
|
102 change_to_empty_mode ();
|
|
103 }
|
|
104 return (0);
|
|
105 }
|
|
106
|
|
107 int
|
|
108 isconect_jserver ()
|
|
109 {
|
|
110 if (js_isconnect (cur_env))
|
|
111 {
|
|
112 connect_server ();
|
|
113 }
|
|
114 if (js_isconnect (cur_env))
|
|
115 {
|
|
116 print_msg_getc (" jserver(?)", NULL, NULL, NULL);
|
|
117 t_print_l ();
|
|
118 return (0);
|
|
119 }
|
|
120 return (1);
|
|
121 }
|
|
122
|
|
123 int
|
|
124 kill_c ()
|
|
125 {
|
|
126 t_kill ();
|
|
127 if (c_b->maxlen == 0)
|
|
128 {
|
|
129 change_to_empty_mode ();
|
|
130 }
|
|
131 return (0);
|
|
132 }
|
|
133
|
|
134 int
|
|
135 delete_c (c, romkan)
|
|
136 int c, romkan;
|
|
137 {
|
|
138 t_delete_char (c, romkan);
|
|
139 if ((c_b->maxlen == 0) && is_HON (romkan))
|
|
140 {
|
|
141 change_to_empty_mode ();
|
|
142 }
|
|
143 return (0);
|
|
144 }
|
|
145
|
|
146 int
|
|
147 rubout_c (c, romkan)
|
|
148 int c, romkan;
|
|
149 {
|
|
150 t_rubout (c, romkan);
|
|
151 if ((c_b->maxlen == 0) && is_HON (romkan))
|
|
152 {
|
|
153 change_to_empty_mode ();
|
|
154 }
|
|
155 return (0);
|
|
156 }
|
|
157
|
|
158
|
|
159
|
|
160 int
|
|
161 backward_c ()
|
|
162 {
|
|
163 if (!isconect_jserver ())
|
|
164 {
|
|
165 return (0);
|
|
166 }
|
|
167 if (c_b->t_c_p == c_b->t_m_start)
|
|
168 {
|
|
169 }
|
|
170 else
|
|
171 {
|
|
172 backward_char ();
|
|
173 }
|
|
174 return (0);
|
|
175 }
|
|
176
|
|
177 int
|
|
178 insert_it_as_yomi ()
|
|
179 {
|
|
180 change_to_insert_mode ();
|
|
181 c_b->t_m_start = 0;
|
|
182 cur_bnst_ = 0;
|
|
183 t_print_l ();
|
|
184 return (0);
|
|
185 }
|
|
186
|
|
187 int
|
|
188 reconnect_server ()
|
|
189 {
|
|
190 return (0);
|
|
191 }
|
|
192
|
|
193 int
|
|
194 disconnect_server ()
|
|
195 {
|
|
196 WnnEnv *p;
|
|
197
|
|
198 for (p = normal_env; p; p = p->next)
|
|
199 {
|
|
200 if (p->env != NULL && js_isconnect (p->env))
|
|
201 {
|
|
202 js_close (p->env->js_id);
|
|
203 }
|
|
204 }
|
|
205 return (1);
|
|
206 }
|