Imported Upstream version 0.1.0
Aron Xu
10 years ago
0 | cmake_minimum_required(VERSION 2.6) | |
1 | ||
2 | project(fcitx-unikey) | |
3 | ||
4 | set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH}) | |
5 | ||
6 | # uninstall target | |
7 | configure_file( | |
8 | "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" | |
9 | "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" | |
10 | IMMEDIATE @ONLY) | |
11 | ||
12 | add_custom_target(uninstall | |
13 | COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) | |
14 | ||
15 | set(CMAKE_C_FLAGS "-Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -fvisibility=hidden ${CMAKE_C_FLAGS}") | |
16 | set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -fvisibility=hidden ${CMAKE_CXX_FLAGS}") | |
17 | set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed ${CMAKE_SHARED_LINKER_FLAGS}") | |
18 | set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--as-needed ${CMAKE_MODULE_LINKER_FLAGS}") | |
19 | ||
20 | find_package(Fcitx 4.2.3 REQUIRED) | |
21 | find_package(Libiconv REQUIRED) | |
22 | find_package(Gettext REQUIRED) | |
23 | ||
24 | configure_file(config.h.in config.h) | |
25 | ||
26 | add_subdirectory(src) | |
27 | add_subdirectory(data) | |
28 | add_subdirectory(po)⏎ |
0 | GNU GENERAL PUBLIC LICENSE | |
1 | Version 3, 29 June 2007 | |
2 | ||
3 | Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> | |
4 | Everyone is permitted to copy and distribute verbatim copies | |
5 | of this license document, but changing it is not allowed. | |
6 | ||
7 | Preamble | |
8 | ||
9 | The GNU General Public License is a free, copyleft license for | |
10 | software and other kinds of works. | |
11 | ||
12 | The licenses for most software and other practical works are designed | |
13 | to take away your freedom to share and change the works. By contrast, | |
14 | the GNU General Public License is intended to guarantee your freedom to | |
15 | share and change all versions of a program--to make sure it remains free | |
16 | software for all its users. We, the Free Software Foundation, use the | |
17 | GNU General Public License for most of our software; it applies also to | |
18 | any other work released this way by its authors. You can apply it to | |
19 | your programs, too. | |
20 | ||
21 | When we speak of free software, we are referring to freedom, not | |
22 | price. Our General Public Licenses are designed to make sure that you | |
23 | have the freedom to distribute copies of free software (and charge for | |
24 | them if you wish), that you receive source code or can get it if you | |
25 | want it, that you can change the software or use pieces of it in new | |
26 | free programs, and that you know you can do these things. | |
27 | ||
28 | To protect your rights, we need to prevent others from denying you | |
29 | these rights or asking you to surrender the rights. Therefore, you have | |
30 | certain responsibilities if you distribute copies of the software, or if | |
31 | you modify it: responsibilities to respect the freedom of others. | |
32 | ||
33 | For example, if you distribute copies of such a program, whether | |
34 | gratis or for a fee, you must pass on to the recipients the same | |
35 | freedoms that you received. You must make sure that they, too, receive | |
36 | or can get the source code. And you must show them these terms so they | |
37 | know their rights. | |
38 | ||
39 | Developers that use the GNU GPL protect your rights with two steps: | |
40 | (1) assert copyright on the software, and (2) offer you this License | |
41 | giving you legal permission to copy, distribute and/or modify it. | |
42 | ||
43 | For the developers' and authors' protection, the GPL clearly explains | |
44 | that there is no warranty for this free software. For both users' and | |
45 | authors' sake, the GPL requires that modified versions be marked as | |
46 | changed, so that their problems will not be attributed erroneously to | |
47 | authors of previous versions. | |
48 | ||
49 | Some devices are designed to deny users access to install or run | |
50 | modified versions of the software inside them, although the manufacturer | |
51 | can do so. This is fundamentally incompatible with the aim of | |
52 | protecting users' freedom to change the software. The systematic | |
53 | pattern of such abuse occurs in the area of products for individuals to | |
54 | use, which is precisely where it is most unacceptable. Therefore, we | |
55 | have designed this version of the GPL to prohibit the practice for those | |
56 | products. If such problems arise substantially in other domains, we | |
57 | stand ready to extend this provision to those domains in future versions | |
58 | of the GPL, as needed to protect the freedom of users. | |
59 | ||
60 | Finally, every program is threatened constantly by software patents. | |
61 | States should not allow patents to restrict development and use of | |
62 | software on general-purpose computers, but in those that do, we wish to | |
63 | avoid the special danger that patents applied to a free program could | |
64 | make it effectively proprietary. To prevent this, the GPL assures that | |
65 | patents cannot be used to render the program non-free. | |
66 | ||
67 | The precise terms and conditions for copying, distribution and | |
68 | modification follow. | |
69 | ||
70 | TERMS AND CONDITIONS | |
71 | ||
72 | 0. Definitions. | |
73 | ||
74 | "This License" refers to version 3 of the GNU General Public License. | |
75 | ||
76 | "Copyright" also means copyright-like laws that apply to other kinds of | |
77 | works, such as semiconductor masks. | |
78 | ||
79 | "The Program" refers to any copyrightable work licensed under this | |
80 | License. Each licensee is addressed as "you". "Licensees" and | |
81 | "recipients" may be individuals or organizations. | |
82 | ||
83 | To "modify" a work means to copy from or adapt all or part of the work | |
84 | in a fashion requiring copyright permission, other than the making of an | |
85 | exact copy. The resulting work is called a "modified version" of the | |
86 | earlier work or a work "based on" the earlier work. | |
87 | ||
88 | A "covered work" means either the unmodified Program or a work based | |
89 | on the Program. | |
90 | ||
91 | To "propagate" a work means to do anything with it that, without | |
92 | permission, would make you directly or secondarily liable for | |
93 | infringement under applicable copyright law, except executing it on a | |
94 | computer or modifying a private copy. Propagation includes copying, | |
95 | distribution (with or without modification), making available to the | |
96 | public, and in some countries other activities as well. | |
97 | ||
98 | To "convey" a work means any kind of propagation that enables other | |
99 | parties to make or receive copies. Mere interaction with a user through | |
100 | a computer network, with no transfer of a copy, is not conveying. | |
101 | ||
102 | An interactive user interface displays "Appropriate Legal Notices" | |
103 | to the extent that it includes a convenient and prominently visible | |
104 | feature that (1) displays an appropriate copyright notice, and (2) | |
105 | tells the user that there is no warranty for the work (except to the | |
106 | extent that warranties are provided), that licensees may convey the | |
107 | work under this License, and how to view a copy of this License. If | |
108 | the interface presents a list of user commands or options, such as a | |
109 | menu, a prominent item in the list meets this criterion. | |
110 | ||
111 | 1. Source Code. | |
112 | ||
113 | The "source code" for a work means the preferred form of the work | |
114 | for making modifications to it. "Object code" means any non-source | |
115 | form of a work. | |
116 | ||
117 | A "Standard Interface" means an interface that either is an official | |
118 | standard defined by a recognized standards body, or, in the case of | |
119 | interfaces specified for a particular programming language, one that | |
120 | is widely used among developers working in that language. | |
121 | ||
122 | The "System Libraries" of an executable work include anything, other | |
123 | than the work as a whole, that (a) is included in the normal form of | |
124 | packaging a Major Component, but which is not part of that Major | |
125 | Component, and (b) serves only to enable use of the work with that | |
126 | Major Component, or to implement a Standard Interface for which an | |
127 | implementation is available to the public in source code form. A | |
128 | "Major Component", in this context, means a major essential component | |
129 | (kernel, window system, and so on) of the specific operating system | |
130 | (if any) on which the executable work runs, or a compiler used to | |
131 | produce the work, or an object code interpreter used to run it. | |
132 | ||
133 | The "Corresponding Source" for a work in object code form means all | |
134 | the source code needed to generate, install, and (for an executable | |
135 | work) run the object code and to modify the work, including scripts to | |
136 | control those activities. However, it does not include the work's | |
137 | System Libraries, or general-purpose tools or generally available free | |
138 | programs which are used unmodified in performing those activities but | |
139 | which are not part of the work. For example, Corresponding Source | |
140 | includes interface definition files associated with source files for | |
141 | the work, and the source code for shared libraries and dynamically | |
142 | linked subprograms that the work is specifically designed to require, | |
143 | such as by intimate data communication or control flow between those | |
144 | subprograms and other parts of the work. | |
145 | ||
146 | The Corresponding Source need not include anything that users | |
147 | can regenerate automatically from other parts of the Corresponding | |
148 | Source. | |
149 | ||
150 | The Corresponding Source for a work in source code form is that | |
151 | same work. | |
152 | ||
153 | 2. Basic Permissions. | |
154 | ||
155 | All rights granted under this License are granted for the term of | |
156 | copyright on the Program, and are irrevocable provided the stated | |
157 | conditions are met. This License explicitly affirms your unlimited | |
158 | permission to run the unmodified Program. The output from running a | |
159 | covered work is covered by this License only if the output, given its | |
160 | content, constitutes a covered work. This License acknowledges your | |
161 | rights of fair use or other equivalent, as provided by copyright law. | |
162 | ||
163 | You may make, run and propagate covered works that you do not | |
164 | convey, without conditions so long as your license otherwise remains | |
165 | in force. You may convey covered works to others for the sole purpose | |
166 | of having them make modifications exclusively for you, or provide you | |
167 | with facilities for running those works, provided that you comply with | |
168 | the terms of this License in conveying all material for which you do | |
169 | not control copyright. Those thus making or running the covered works | |
170 | for you must do so exclusively on your behalf, under your direction | |
171 | and control, on terms that prohibit them from making any copies of | |
172 | your copyrighted material outside their relationship with you. | |
173 | ||
174 | Conveying under any other circumstances is permitted solely under | |
175 | the conditions stated below. Sublicensing is not allowed; section 10 | |
176 | makes it unnecessary. | |
177 | ||
178 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. | |
179 | ||
180 | No covered work shall be deemed part of an effective technological | |
181 | measure under any applicable law fulfilling obligations under article | |
182 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or | |
183 | similar laws prohibiting or restricting circumvention of such | |
184 | measures. | |
185 | ||
186 | When you convey a covered work, you waive any legal power to forbid | |
187 | circumvention of technological measures to the extent such circumvention | |
188 | is effected by exercising rights under this License with respect to | |
189 | the covered work, and you disclaim any intention to limit operation or | |
190 | modification of the work as a means of enforcing, against the work's | |
191 | users, your or third parties' legal rights to forbid circumvention of | |
192 | technological measures. | |
193 | ||
194 | 4. Conveying Verbatim Copies. | |
195 | ||
196 | You may convey verbatim copies of the Program's source code as you | |
197 | receive it, in any medium, provided that you conspicuously and | |
198 | appropriately publish on each copy an appropriate copyright notice; | |
199 | keep intact all notices stating that this License and any | |
200 | non-permissive terms added in accord with section 7 apply to the code; | |
201 | keep intact all notices of the absence of any warranty; and give all | |
202 | recipients a copy of this License along with the Program. | |
203 | ||
204 | You may charge any price or no price for each copy that you convey, | |
205 | and you may offer support or warranty protection for a fee. | |
206 | ||
207 | 5. Conveying Modified Source Versions. | |
208 | ||
209 | You may convey a work based on the Program, or the modifications to | |
210 | produce it from the Program, in the form of source code under the | |
211 | terms of section 4, provided that you also meet all of these conditions: | |
212 | ||
213 | a) The work must carry prominent notices stating that you modified | |
214 | it, and giving a relevant date. | |
215 | ||
216 | b) The work must carry prominent notices stating that it is | |
217 | released under this License and any conditions added under section | |
218 | 7. This requirement modifies the requirement in section 4 to | |
219 | "keep intact all notices". | |
220 | ||
221 | c) You must license the entire work, as a whole, under this | |
222 | License to anyone who comes into possession of a copy. This | |
223 | License will therefore apply, along with any applicable section 7 | |
224 | additional terms, to the whole of the work, and all its parts, | |
225 | regardless of how they are packaged. This License gives no | |
226 | permission to license the work in any other way, but it does not | |
227 | invalidate such permission if you have separately received it. | |
228 | ||
229 | d) If the work has interactive user interfaces, each must display | |
230 | Appropriate Legal Notices; however, if the Program has interactive | |
231 | interfaces that do not display Appropriate Legal Notices, your | |
232 | work need not make them do so. | |
233 | ||
234 | A compilation of a covered work with other separate and independent | |
235 | works, which are not by their nature extensions of the covered work, | |
236 | and which are not combined with it such as to form a larger program, | |
237 | in or on a volume of a storage or distribution medium, is called an | |
238 | "aggregate" if the compilation and its resulting copyright are not | |
239 | used to limit the access or legal rights of the compilation's users | |
240 | beyond what the individual works permit. Inclusion of a covered work | |
241 | in an aggregate does not cause this License to apply to the other | |
242 | parts of the aggregate. | |
243 | ||
244 | 6. Conveying Non-Source Forms. | |
245 | ||
246 | You may convey a covered work in object code form under the terms | |
247 | of sections 4 and 5, provided that you also convey the | |
248 | machine-readable Corresponding Source under the terms of this License, | |
249 | in one of these ways: | |
250 | ||
251 | a) Convey the object code in, or embodied in, a physical product | |
252 | (including a physical distribution medium), accompanied by the | |
253 | Corresponding Source fixed on a durable physical medium | |
254 | customarily used for software interchange. | |
255 | ||
256 | b) Convey the object code in, or embodied in, a physical product | |
257 | (including a physical distribution medium), accompanied by a | |
258 | written offer, valid for at least three years and valid for as | |
259 | long as you offer spare parts or customer support for that product | |
260 | model, to give anyone who possesses the object code either (1) a | |
261 | copy of the Corresponding Source for all the software in the | |
262 | product that is covered by this License, on a durable physical | |
263 | medium customarily used for software interchange, for a price no | |
264 | more than your reasonable cost of physically performing this | |
265 | conveying of source, or (2) access to copy the | |
266 | Corresponding Source from a network server at no charge. | |
267 | ||
268 | c) Convey individual copies of the object code with a copy of the | |
269 | written offer to provide the Corresponding Source. This | |
270 | alternative is allowed only occasionally and noncommercially, and | |
271 | only if you received the object code with such an offer, in accord | |
272 | with subsection 6b. | |
273 | ||
274 | d) Convey the object code by offering access from a designated | |
275 | place (gratis or for a charge), and offer equivalent access to the | |
276 | Corresponding Source in the same way through the same place at no | |
277 | further charge. You need not require recipients to copy the | |
278 | Corresponding Source along with the object code. If the place to | |
279 | copy the object code is a network server, the Corresponding Source | |
280 | may be on a different server (operated by you or a third party) | |
281 | that supports equivalent copying facilities, provided you maintain | |
282 | clear directions next to the object code saying where to find the | |
283 | Corresponding Source. Regardless of what server hosts the | |
284 | Corresponding Source, you remain obligated to ensure that it is | |
285 | available for as long as needed to satisfy these requirements. | |
286 | ||
287 | e) Convey the object code using peer-to-peer transmission, provided | |
288 | you inform other peers where the object code and Corresponding | |
289 | Source of the work are being offered to the general public at no | |
290 | charge under subsection 6d. | |
291 | ||
292 | A separable portion of the object code, whose source code is excluded | |
293 | from the Corresponding Source as a System Library, need not be | |
294 | included in conveying the object code work. | |
295 | ||
296 | A "User Product" is either (1) a "consumer product", which means any | |
297 | tangible personal property which is normally used for personal, family, | |
298 | or household purposes, or (2) anything designed or sold for incorporation | |
299 | into a dwelling. In determining whether a product is a consumer product, | |
300 | doubtful cases shall be resolved in favor of coverage. For a particular | |
301 | product received by a particular user, "normally used" refers to a | |
302 | typical or common use of that class of product, regardless of the status | |
303 | of the particular user or of the way in which the particular user | |
304 | actually uses, or expects or is expected to use, the product. A product | |
305 | is a consumer product regardless of whether the product has substantial | |
306 | commercial, industrial or non-consumer uses, unless such uses represent | |
307 | the only significant mode of use of the product. | |
308 | ||
309 | "Installation Information" for a User Product means any methods, | |
310 | procedures, authorization keys, or other information required to install | |
311 | and execute modified versions of a covered work in that User Product from | |
312 | a modified version of its Corresponding Source. The information must | |
313 | suffice to ensure that the continued functioning of the modified object | |
314 | code is in no case prevented or interfered with solely because | |
315 | modification has been made. | |
316 | ||
317 | If you convey an object code work under this section in, or with, or | |
318 | specifically for use in, a User Product, and the conveying occurs as | |
319 | part of a transaction in which the right of possession and use of the | |
320 | User Product is transferred to the recipient in perpetuity or for a | |
321 | fixed term (regardless of how the transaction is characterized), the | |
322 | Corresponding Source conveyed under this section must be accompanied | |
323 | by the Installation Information. But this requirement does not apply | |
324 | if neither you nor any third party retains the ability to install | |
325 | modified object code on the User Product (for example, the work has | |
326 | been installed in ROM). | |
327 | ||
328 | The requirement to provide Installation Information does not include a | |
329 | requirement to continue to provide support service, warranty, or updates | |
330 | for a work that has been modified or installed by the recipient, or for | |
331 | the User Product in which it has been modified or installed. Access to a | |
332 | network may be denied when the modification itself materially and | |
333 | adversely affects the operation of the network or violates the rules and | |
334 | protocols for communication across the network. | |
335 | ||
336 | Corresponding Source conveyed, and Installation Information provided, | |
337 | in accord with this section must be in a format that is publicly | |
338 | documented (and with an implementation available to the public in | |
339 | source code form), and must require no special password or key for | |
340 | unpacking, reading or copying. | |
341 | ||
342 | 7. Additional Terms. | |
343 | ||
344 | "Additional permissions" are terms that supplement the terms of this | |
345 | License by making exceptions from one or more of its conditions. | |
346 | Additional permissions that are applicable to the entire Program shall | |
347 | be treated as though they were included in this License, to the extent | |
348 | that they are valid under applicable law. If additional permissions | |
349 | apply only to part of the Program, that part may be used separately | |
350 | under those permissions, but the entire Program remains governed by | |
351 | this License without regard to the additional permissions. | |
352 | ||
353 | When you convey a copy of a covered work, you may at your option | |
354 | remove any additional permissions from that copy, or from any part of | |
355 | it. (Additional permissions may be written to require their own | |
356 | removal in certain cases when you modify the work.) You may place | |
357 | additional permissions on material, added by you to a covered work, | |
358 | for which you have or can give appropriate copyright permission. | |
359 | ||
360 | Notwithstanding any other provision of this License, for material you | |
361 | add to a covered work, you may (if authorized by the copyright holders of | |
362 | that material) supplement the terms of this License with terms: | |
363 | ||
364 | a) Disclaiming warranty or limiting liability differently from the | |
365 | terms of sections 15 and 16 of this License; or | |
366 | ||
367 | b) Requiring preservation of specified reasonable legal notices or | |
368 | author attributions in that material or in the Appropriate Legal | |
369 | Notices displayed by works containing it; or | |
370 | ||
371 | c) Prohibiting misrepresentation of the origin of that material, or | |
372 | requiring that modified versions of such material be marked in | |
373 | reasonable ways as different from the original version; or | |
374 | ||
375 | d) Limiting the use for publicity purposes of names of licensors or | |
376 | authors of the material; or | |
377 | ||
378 | e) Declining to grant rights under trademark law for use of some | |
379 | trade names, trademarks, or service marks; or | |
380 | ||
381 | f) Requiring indemnification of licensors and authors of that | |
382 | material by anyone who conveys the material (or modified versions of | |
383 | it) with contractual assumptions of liability to the recipient, for | |
384 | any liability that these contractual assumptions directly impose on | |
385 | those licensors and authors. | |
386 | ||
387 | All other non-permissive additional terms are considered "further | |
388 | restrictions" within the meaning of section 10. If the Program as you | |
389 | received it, or any part of it, contains a notice stating that it is | |
390 | governed by this License along with a term that is a further | |
391 | restriction, you may remove that term. If a license document contains | |
392 | a further restriction but permits relicensing or conveying under this | |
393 | License, you may add to a covered work material governed by the terms | |
394 | of that license document, provided that the further restriction does | |
395 | not survive such relicensing or conveying. | |
396 | ||
397 | If you add terms to a covered work in accord with this section, you | |
398 | must place, in the relevant source files, a statement of the | |
399 | additional terms that apply to those files, or a notice indicating | |
400 | where to find the applicable terms. | |
401 | ||
402 | Additional terms, permissive or non-permissive, may be stated in the | |
403 | form of a separately written license, or stated as exceptions; | |
404 | the above requirements apply either way. | |
405 | ||
406 | 8. Termination. | |
407 | ||
408 | You may not propagate or modify a covered work except as expressly | |
409 | provided under this License. Any attempt otherwise to propagate or | |
410 | modify it is void, and will automatically terminate your rights under | |
411 | this License (including any patent licenses granted under the third | |
412 | paragraph of section 11). | |
413 | ||
414 | However, if you cease all violation of this License, then your | |
415 | license from a particular copyright holder is reinstated (a) | |
416 | provisionally, unless and until the copyright holder explicitly and | |
417 | finally terminates your license, and (b) permanently, if the copyright | |
418 | holder fails to notify you of the violation by some reasonable means | |
419 | prior to 60 days after the cessation. | |
420 | ||
421 | Moreover, your license from a particular copyright holder is | |
422 | reinstated permanently if the copyright holder notifies you of the | |
423 | violation by some reasonable means, this is the first time you have | |
424 | received notice of violation of this License (for any work) from that | |
425 | copyright holder, and you cure the violation prior to 30 days after | |
426 | your receipt of the notice. | |
427 | ||
428 | Termination of your rights under this section does not terminate the | |
429 | licenses of parties who have received copies or rights from you under | |
430 | this License. If your rights have been terminated and not permanently | |
431 | reinstated, you do not qualify to receive new licenses for the same | |
432 | material under section 10. | |
433 | ||
434 | 9. Acceptance Not Required for Having Copies. | |
435 | ||
436 | You are not required to accept this License in order to receive or | |
437 | run a copy of the Program. Ancillary propagation of a covered work | |
438 | occurring solely as a consequence of using peer-to-peer transmission | |
439 | to receive a copy likewise does not require acceptance. However, | |
440 | nothing other than this License grants you permission to propagate or | |
441 | modify any covered work. These actions infringe copyright if you do | |
442 | not accept this License. Therefore, by modifying or propagating a | |
443 | covered work, you indicate your acceptance of this License to do so. | |
444 | ||
445 | 10. Automatic Licensing of Downstream Recipients. | |
446 | ||
447 | Each time you convey a covered work, the recipient automatically | |
448 | receives a license from the original licensors, to run, modify and | |
449 | propagate that work, subject to this License. You are not responsible | |
450 | for enforcing compliance by third parties with this License. | |
451 | ||
452 | An "entity transaction" is a transaction transferring control of an | |
453 | organization, or substantially all assets of one, or subdividing an | |
454 | organization, or merging organizations. If propagation of a covered | |
455 | work results from an entity transaction, each party to that | |
456 | transaction who receives a copy of the work also receives whatever | |
457 | licenses to the work the party's predecessor in interest had or could | |
458 | give under the previous paragraph, plus a right to possession of the | |
459 | Corresponding Source of the work from the predecessor in interest, if | |
460 | the predecessor has it or can get it with reasonable efforts. | |
461 | ||
462 | You may not impose any further restrictions on the exercise of the | |
463 | rights granted or affirmed under this License. For example, you may | |
464 | not impose a license fee, royalty, or other charge for exercise of | |
465 | rights granted under this License, and you may not initiate litigation | |
466 | (including a cross-claim or counterclaim in a lawsuit) alleging that | |
467 | any patent claim is infringed by making, using, selling, offering for | |
468 | sale, or importing the Program or any portion of it. | |
469 | ||
470 | 11. Patents. | |
471 | ||
472 | A "contributor" is a copyright holder who authorizes use under this | |
473 | License of the Program or a work on which the Program is based. The | |
474 | work thus licensed is called the contributor's "contributor version". | |
475 | ||
476 | A contributor's "essential patent claims" are all patent claims | |
477 | owned or controlled by the contributor, whether already acquired or | |
478 | hereafter acquired, that would be infringed by some manner, permitted | |
479 | by this License, of making, using, or selling its contributor version, | |
480 | but do not include claims that would be infringed only as a | |
481 | consequence of further modification of the contributor version. For | |
482 | purposes of this definition, "control" includes the right to grant | |
483 | patent sublicenses in a manner consistent with the requirements of | |
484 | this License. | |
485 | ||
486 | Each contributor grants you a non-exclusive, worldwide, royalty-free | |
487 | patent license under the contributor's essential patent claims, to | |
488 | make, use, sell, offer for sale, import and otherwise run, modify and | |
489 | propagate the contents of its contributor version. | |
490 | ||
491 | In the following three paragraphs, a "patent license" is any express | |
492 | agreement or commitment, however denominated, not to enforce a patent | |
493 | (such as an express permission to practice a patent or covenant not to | |
494 | sue for patent infringement). To "grant" such a patent license to a | |
495 | party means to make such an agreement or commitment not to enforce a | |
496 | patent against the party. | |
497 | ||
498 | If you convey a covered work, knowingly relying on a patent license, | |
499 | and the Corresponding Source of the work is not available for anyone | |
500 | to copy, free of charge and under the terms of this License, through a | |
501 | publicly available network server or other readily accessible means, | |
502 | then you must either (1) cause the Corresponding Source to be so | |
503 | available, or (2) arrange to deprive yourself of the benefit of the | |
504 | patent license for this particular work, or (3) arrange, in a manner | |
505 | consistent with the requirements of this License, to extend the patent | |
506 | license to downstream recipients. "Knowingly relying" means you have | |
507 | actual knowledge that, but for the patent license, your conveying the | |
508 | covered work in a country, or your recipient's use of the covered work | |
509 | in a country, would infringe one or more identifiable patents in that | |
510 | country that you have reason to believe are valid. | |
511 | ||
512 | If, pursuant to or in connection with a single transaction or | |
513 | arrangement, you convey, or propagate by procuring conveyance of, a | |
514 | covered work, and grant a patent license to some of the parties | |
515 | receiving the covered work authorizing them to use, propagate, modify | |
516 | or convey a specific copy of the covered work, then the patent license | |
517 | you grant is automatically extended to all recipients of the covered | |
518 | work and works based on it. | |
519 | ||
520 | A patent license is "discriminatory" if it does not include within | |
521 | the scope of its coverage, prohibits the exercise of, or is | |
522 | conditioned on the non-exercise of one or more of the rights that are | |
523 | specifically granted under this License. You may not convey a covered | |
524 | work if you are a party to an arrangement with a third party that is | |
525 | in the business of distributing software, under which you make payment | |
526 | to the third party based on the extent of your activity of conveying | |
527 | the work, and under which the third party grants, to any of the | |
528 | parties who would receive the covered work from you, a discriminatory | |
529 | patent license (a) in connection with copies of the covered work | |
530 | conveyed by you (or copies made from those copies), or (b) primarily | |
531 | for and in connection with specific products or compilations that | |
532 | contain the covered work, unless you entered into that arrangement, | |
533 | or that patent license was granted, prior to 28 March 2007. | |
534 | ||
535 | Nothing in this License shall be construed as excluding or limiting | |
536 | any implied license or other defenses to infringement that may | |
537 | otherwise be available to you under applicable patent law. | |
538 | ||
539 | 12. No Surrender of Others' Freedom. | |
540 | ||
541 | If conditions are imposed on you (whether by court order, agreement or | |
542 | otherwise) that contradict the conditions of this License, they do not | |
543 | excuse you from the conditions of this License. If you cannot convey a | |
544 | covered work so as to satisfy simultaneously your obligations under this | |
545 | License and any other pertinent obligations, then as a consequence you may | |
546 | not convey it at all. For example, if you agree to terms that obligate you | |
547 | to collect a royalty for further conveying from those to whom you convey | |
548 | the Program, the only way you could satisfy both those terms and this | |
549 | License would be to refrain entirely from conveying the Program. | |
550 | ||
551 | 13. Use with the GNU Affero General Public License. | |
552 | ||
553 | Notwithstanding any other provision of this License, you have | |
554 | permission to link or combine any covered work with a work licensed | |
555 | under version 3 of the GNU Affero General Public License into a single | |
556 | combined work, and to convey the resulting work. The terms of this | |
557 | License will continue to apply to the part which is the covered work, | |
558 | but the special requirements of the GNU Affero General Public License, | |
559 | section 13, concerning interaction through a network will apply to the | |
560 | combination as such. | |
561 | ||
562 | 14. Revised Versions of this License. | |
563 | ||
564 | The Free Software Foundation may publish revised and/or new versions of | |
565 | the GNU General Public License from time to time. Such new versions will | |
566 | be similar in spirit to the present version, but may differ in detail to | |
567 | address new problems or concerns. | |
568 | ||
569 | Each version is given a distinguishing version number. If the | |
570 | Program specifies that a certain numbered version of the GNU General | |
571 | Public License "or any later version" applies to it, you have the | |
572 | option of following the terms and conditions either of that numbered | |
573 | version or of any later version published by the Free Software | |
574 | Foundation. If the Program does not specify a version number of the | |
575 | GNU General Public License, you may choose any version ever published | |
576 | by the Free Software Foundation. | |
577 | ||
578 | If the Program specifies that a proxy can decide which future | |
579 | versions of the GNU General Public License can be used, that proxy's | |
580 | public statement of acceptance of a version permanently authorizes you | |
581 | to choose that version for the Program. | |
582 | ||
583 | Later license versions may give you additional or different | |
584 | permissions. However, no additional obligations are imposed on any | |
585 | author or copyright holder as a result of your choosing to follow a | |
586 | later version. | |
587 | ||
588 | 15. Disclaimer of Warranty. | |
589 | ||
590 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY | |
591 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT | |
592 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY | |
593 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, | |
594 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
595 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM | |
596 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF | |
597 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. | |
598 | ||
599 | 16. Limitation of Liability. | |
600 | ||
601 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING | |
602 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS | |
603 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY | |
604 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE | |
605 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF | |
606 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD | |
607 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), | |
608 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF | |
609 | SUCH DAMAGES. | |
610 | ||
611 | 17. Interpretation of Sections 15 and 16. | |
612 | ||
613 | If the disclaimer of warranty and limitation of liability provided | |
614 | above cannot be given local legal effect according to their terms, | |
615 | reviewing courts shall apply local law that most closely approximates | |
616 | an absolute waiver of all civil liability in connection with the | |
617 | Program, unless a warranty or assumption of liability accompanies a | |
618 | copy of the Program in return for a fee. | |
619 | ||
620 | END OF TERMS AND CONDITIONS | |
621 | ||
622 | How to Apply These Terms to Your New Programs | |
623 | ||
624 | If you develop a new program, and you want it to be of the greatest | |
625 | possible use to the public, the best way to achieve this is to make it | |
626 | free software which everyone can redistribute and change under these terms. | |
627 | ||
628 | To do so, attach the following notices to the program. It is safest | |
629 | to attach them to the start of each source file to most effectively | |
630 | state the exclusion of warranty; and each file should have at least | |
631 | the "copyright" line and a pointer to where the full notice is found. | |
632 | ||
633 | <one line to give the program's name and a brief idea of what it does.> | |
634 | Copyright (C) <year> <name of author> | |
635 | ||
636 | This program is free software: you can redistribute it and/or modify | |
637 | it under the terms of the GNU General Public License as published by | |
638 | the Free Software Foundation, either version 3 of the License, or | |
639 | (at your option) any later version. | |
640 | ||
641 | This program is distributed in the hope that it will be useful, | |
642 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
643 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
644 | GNU General Public License for more details. | |
645 | ||
646 | You should have received a copy of the GNU General Public License | |
647 | along with this program. If not, see <http://www.gnu.org/licenses/>. | |
648 | ||
649 | Also add information on how to contact you by electronic and paper mail. | |
650 | ||
651 | If the program does terminal interaction, make it output a short | |
652 | notice like this when it starts in an interactive mode: | |
653 | ||
654 | <program> Copyright (C) <year> <name of author> | |
655 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. | |
656 | This is free software, and you are welcome to redistribute it | |
657 | under certain conditions; type `show c' for details. | |
658 | ||
659 | The hypothetical commands `show w' and `show c' should show the appropriate | |
660 | parts of the General Public License. Of course, your program's commands | |
661 | might be different; for a GUI interface, you would use an "about box". | |
662 | ||
663 | You should also get your employer (if you work as a programmer) or school, | |
664 | if any, to sign a "copyright disclaimer" for the program, if necessary. | |
665 | For more information on this, and how to apply and follow the GNU GPL, see | |
666 | <http://www.gnu.org/licenses/>. | |
667 | ||
668 | The GNU General Public License does not permit incorporating your program | |
669 | into proprietary programs. If your program is a subroutine library, you | |
670 | may consider it more useful to permit linking proprietary applications with | |
671 | the library. If this is what you want to do, use the GNU Lesser General | |
672 | Public License instead of this License. But first, please read | |
673 | <http://www.gnu.org/philosophy/why-not-lgpl.html>. |
0 | # Try to find Libiconv functionality | |
1 | # Once done this will define | |
2 | # | |
3 | # LIBICONV_FOUND - system has Libiconv | |
4 | # LIBICONV_INCLUDE_DIR - Libiconv include directory | |
5 | # LIBICONV_LIBRARIES - Libraries needed to use Libiconv | |
6 | # LIBICONV_SECOND_ARGUMENT_IS_CONST - iconv second argument is const | |
7 | # | |
8 | # TODO: This will enable translations only if Gettext functionality is | |
9 | # present in libc. Must have more robust system for release, where Gettext | |
10 | # functionality can also reside in standalone Gettext library, or the one | |
11 | # embedded within kdelibs (cf. gettext.m4 from Gettext source). | |
12 | ||
13 | # Copyright (c) 2006, Chusslove Illich, <caslav.ilic@gmx.net> | |
14 | # Copyright (c) 2007, Alexander Neundorf, <neundorf@kde.org> | |
15 | # | |
16 | # Redistribution and use is allowed according to the terms of the BSD license. | |
17 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file. | |
18 | ||
19 | if(LIBICONV_INCLUDE_DIR AND LIBICONV_LIB_FOUND) | |
20 | set(Libiconv_FIND_QUIETLY TRUE) | |
21 | endif(LIBICONV_INCLUDE_DIR AND LIBICONV_LIB_FOUND) | |
22 | ||
23 | include(CheckCCompilerFlag) | |
24 | include(CheckCSourceCompiles) | |
25 | ||
26 | find_path(LIBICONV_INCLUDE_DIR iconv.h) | |
27 | ||
28 | set(LIBICONV_LIB_FOUND FALSE) | |
29 | ||
30 | if(LIBICONV_INCLUDE_DIR) | |
31 | include(CheckFunctionExists) | |
32 | check_function_exists(iconv_open LIBICONV_LIBC_HAS_ICONV_OPEN) | |
33 | ||
34 | if (LIBICONV_LIBC_HAS_ICONV_OPEN) | |
35 | set(LIBICONV_LIBRARIES) | |
36 | set(LIBICONV_LIB_FOUND TRUE) | |
37 | else (LIBICONV_LIBC_HAS_ICONV_OPEN) | |
38 | find_library(LIBICONV_LIBRARIES NAMES iconv) | |
39 | if(LIBICONV_LIBRARIES) | |
40 | set(LIBICONV_LIB_FOUND TRUE) | |
41 | endif(LIBICONV_LIBRARIES) | |
42 | endif (LIBICONV_LIBC_HAS_ICONV_OPEN) | |
43 | ||
44 | if (LIBICONV_LIB_FOUND) | |
45 | check_c_compiler_flag("-Werror" ICONV_HAVE_WERROR) | |
46 | set (CMAKE_C_FLAGS_BACKUP "${CMAKE_C_FLAGS}") | |
47 | if(ICONV_HAVE_WERROR) | |
48 | set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror") | |
49 | endif(ICONV_HAVE_WERROR) | |
50 | set(CMAKE_REQUIRED_INCLUDES "${LIBICONV_INCLUDE_DIR}") | |
51 | set(CMAKE_REQUIRED_LIBRARIES "${LIBICONV_LIBRARIES}") | |
52 | check_c_source_compiles(" | |
53 | #include <iconv.h> | |
54 | int main(){ | |
55 | iconv_t conv = 0; | |
56 | const char* in = 0; | |
57 | size_t ilen = 0; | |
58 | char* out = 0; | |
59 | size_t olen = 0; | |
60 | iconv(conv, &in, &ilen, &out, &olen); | |
61 | return 0; | |
62 | } | |
63 | " LIBICONV_SECOND_ARGUMENT_IS_CONST ) | |
64 | set(CMAKE_REQUIRED_INCLUDES) | |
65 | set(CMAKE_REQUIRED_LIBRARIES) | |
66 | set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS_BACKUP}") | |
67 | endif(LIBICONV_LIB_FOUND) | |
68 | ||
69 | endif(LIBICONV_INCLUDE_DIR) | |
70 | ||
71 | include(FindPackageHandleStandardArgs) | |
72 | find_package_handle_standard_args(Libiconv DEFAULT_MSG LIBICONV_INCLUDE_DIR LIBICONV_LIB_FOUND) | |
73 | ||
74 | mark_as_advanced(LIBICONV_INCLUDE_DIR LIBICONV_LIBRARIES LIBICONV_LIBC_HAS_ICONV_OPEN LIBICONV_LIB_FOUND) |
0 | if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") | |
1 | message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") | |
2 | endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") | |
3 | ||
4 | file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) | |
5 | string(REGEX REPLACE "\n" ";" files "${files}") | |
6 | foreach (file ${files}) | |
7 | message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") | |
8 | if (EXISTS "$ENV{DESTDIR}${file}" OR IS_SYMLINK "$ENV{DESTDIR}${file}") | |
9 | execute_process( | |
10 | COMMAND @CMAKE_COMMAND@ -E remove "$ENV{DESTDIR}${file}" | |
11 | OUTPUT_VARIABLE rm_out | |
12 | RESULT_VARIABLE rm_retval | |
13 | ) | |
14 | if(NOT ${rm_retval} EQUAL 0) | |
15 | message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") | |
16 | endif (NOT ${rm_retval} EQUAL 0) | |
17 | else (EXISTS "$ENV{DESTDIR}${file}" OR IS_SYMLINK "$ENV{DESTDIR}${file}") | |
18 | message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") | |
19 | endif (EXISTS "$ENV{DESTDIR}${file}" OR IS_SYMLINK "$ENV{DESTDIR}${file}") | |
20 | endforeach(file)⏎ |
0 | #cmakedefine LIBICONV_SECOND_ARGUMENT_IS_CONST⏎ |
0 | fcitx_add_addon_conf_file(fcitx-unikey.conf) | |
1 | fcitx_add_configdesc_file(fcitx-unikey.desc) | |
2 | fcitx_add_inputmethod_conf_file(unikey.conf) | |
3 | ||
4 | install(FILES unikey.png DESTINATION ${FCITX4_PREFIX}/share/fcitx/skin/default/) | |
5 | install(FILES unikey.png RENAME fcitx-unikey.png DESTINATION share/icons/hicolor/256x256/apps/)⏎ |
0 | [Addon] | |
1 | Name=fcitx-unikey | |
2 | _GeneralName=Unikey | |
3 | _Comment=Unikey Wrapper For Fcitx | |
4 | Category=InputMethod | |
5 | Enabled=True | |
6 | Library=fcitx-unikey.so | |
7 | Type=SharedLibrary | |
8 | IMRegisterMethod=ConfigFile |
0 | [Unikey/InputMethod] | |
1 | Type=Enum | |
2 | DefaultValue=Telex | |
3 | Description=Input Method | |
4 | EnumCount=4 | |
5 | Enum0=Telex | |
6 | Enum1=Vni | |
7 | Enum2=STelex | |
8 | Enum3=STelex2 | |
9 | ||
10 | [Unikey/OutputCharset] | |
11 | Type=Enum | |
12 | DefaultValue=Unicode | |
13 | Description=Output Charset | |
14 | EnumCount=8 | |
15 | Enum0=Unicode | |
16 | Enum1=TCVN3 | |
17 | Enum2=VNI Win | |
18 | Enum3=VIQR | |
19 | Enum4=BK HCM 2 | |
20 | Enum5=CString | |
21 | Enum6=NCR Decimal | |
22 | Enum7=NCR Hex | |
23 | ||
24 | [Unikey/SpellCheck] | |
25 | Type=Boolean | |
26 | DefaultValue=True | |
27 | Description=Enable spell check | |
28 | ||
29 | [Unikey/Macro] | |
30 | Type=Boolean | |
31 | DefaultValue=False | |
32 | Description=Enable macro | |
33 | ||
34 | [Unikey/ModernStyle] | |
35 | Type=Boolean | |
36 | DefaultValue=False | |
37 | Description=Use oà, _uý (instead of òa, úy) | |
38 | ||
39 | [Unikey/FreeMarking] | |
40 | Type=Boolean | |
41 | DefaultValue=True | |
42 | Description=Allow type with more freedom | |
43 | ||
44 | [Unikey/AutoNonVnRestore] | |
45 | Type=Boolean | |
46 | DefaultValue=True | |
47 | Description=Auto restore keys with invalid words | |
48 | ||
49 | [Unikey/ProcessWAtBegin] | |
50 | Type=Boolean | |
51 | DefaultValue=True | |
52 | Description=Process W at word begin | |
53 | ||
54 | [DescriptionFile] | |
55 | LocaleDomain=fcitx-unikey |
0 | [InputMethod] | |
1 | UniqueName=unikey | |
2 | _Name=Unikey | |
3 | IconName=unikey | |
4 | Priority=1 | |
5 | LangCode=vi | |
6 | Parent=fcitx-unikey |
Binary diff not shown
0 | file(GLOB PO_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.po) | |
1 | file(RELATIVE_PATH REL_SOURCE_ROOT ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}) | |
2 | if ("${REL_SOURCE_ROOT}" STREQUAL "") | |
3 | set(REL_SOURCE_ROOT ".") | |
4 | endif("${REL_SOURCE_ROOT}" STREQUAL "") | |
5 | ||
6 | set(POT_FILE fcitx-unikey.pot) | |
7 | ||
8 | configure_file(POTFILES.in.in ${CMAKE_CURRENT_BINARY_DIR}/POTFILES.in) | |
9 | ||
10 | extract_fcitx_addon_conf_postring() | |
11 | ||
12 | add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/desc.po | |
13 | COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/getdescpo ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} | |
14 | DEPENDS getdescpo) | |
15 | ||
16 | add_custom_target( | |
17 | pot | |
18 | COMMAND INTLTOOL_EXTRACT=${INTLTOOL_EXTRACT} srcdir=${CMAKE_CURRENT_BINARY_DIR} ${INTLTOOL_UPDATE} --gettext-package fcitx-unikey --pot | |
19 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | |
20 | DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/conf.po ${CMAKE_CURRENT_BINARY_DIR}/desc.po | |
21 | ) | |
22 | ||
23 | # Update .po files and compile them to binary .gmo files | |
24 | gettext_create_translations(${POT_FILE} ALL ${PO_FILES}) | |
25 |
0 | # List of source files which contain translatable strings. | |
1 | ./po/desc.po | |
2 | ./po/conf.po | |
3 | @REL_SOURCE_ROOT@/src/unikey-ui.cpp | |
4 | @REL_SOURCE_ROOT@/src/unikey-config.cpp | |
5 | @REL_SOURCE_ROOT@/src/unikey-config.h | |
6 | @REL_SOURCE_ROOT@/src/unikey-im.cpp | |
7 | @REL_SOURCE_ROOT@/src/unikey-im.h | |
8 | @REL_SOURCE_ROOT@/data/fcitx-unikey.conf.in | |
9 | @REL_SOURCE_ROOT@/data/unikey.conf.in |
0 | # SOME DESCRIPTIVE TITLE. | |
1 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER | |
2 | # This file is distributed under the same license as the PACKAGE package. | |
3 | # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. | |
4 | # | |
5 | #, fuzzy | |
6 | msgid "" | |
7 | msgstr "" | |
8 | "Project-Id-Version: PACKAGE VERSION\n" | |
9 | "Report-Msgid-Bugs-To: \n" | |
10 | "POT-Creation-Date: 2012-05-05 16:38+0800\n" | |
11 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | |
12 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | |
13 | "Language-Team: LANGUAGE <LL@li.org>\n" | |
14 | "Language: \n" | |
15 | "MIME-Version: 1.0\n" | |
16 | "Content-Type: text/plain; charset=UTF-8\n" | |
17 | "Content-Transfer-Encoding: 8bit\n" | |
18 | ||
19 | #: /home/saber/Develop/fcitx-unikey/data/fcitx-unikey.desc:4 | |
20 | msgid "Input Method" | |
21 | msgstr "" | |
22 | ||
23 | #: /home/saber/Develop/fcitx-unikey/data/fcitx-unikey.desc:14 | |
24 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:137 | |
25 | msgid "Output Charset" | |
26 | msgstr "" | |
27 | ||
28 | #: /home/saber/Develop/fcitx-unikey/data/fcitx-unikey.desc:28 | |
29 | msgid "Enable spell check" | |
30 | msgstr "" | |
31 | ||
32 | #: /home/saber/Develop/fcitx-unikey/data/fcitx-unikey.desc:33 | |
33 | msgid "Enable macro" | |
34 | msgstr "" | |
35 | ||
36 | #: /home/saber/Develop/fcitx-unikey/data/fcitx-unikey.desc:38 | |
37 | msgid "Use oà, _uý (instead of òa, úy)" | |
38 | msgstr "" | |
39 | ||
40 | #: /home/saber/Develop/fcitx-unikey/data/fcitx-unikey.desc:43 | |
41 | msgid "Allow type with more freedom" | |
42 | msgstr "" | |
43 | ||
44 | #: /home/saber/Develop/fcitx-unikey/data/fcitx-unikey.desc:48 | |
45 | msgid "Auto restore keys with invalid words" | |
46 | msgstr "" | |
47 | ||
48 | #: /home/saber/Develop/fcitx-unikey/data/fcitx-unikey.desc:53 | |
49 | msgid "Process W at word begin" | |
50 | msgstr "" | |
51 | ||
52 | # unknown | |
53 | #: /home/saber/Develop/fcitx-unikey/build/po/tmp/fcitx-unikey.conf.in.h:1 | |
54 | #: /home/saber/Develop/fcitx-unikey/build/po/tmp/unikey.conf.in.h:1 | |
55 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-im.cpp:131 | |
56 | msgid "Unikey" | |
57 | msgstr "" | |
58 | ||
59 | #: unknown | |
60 | msgid "BK HCM 2" | |
61 | msgstr "" | |
62 | ||
63 | #: unknown | |
64 | msgid "CString" | |
65 | msgstr "" | |
66 | ||
67 | #: unknown | |
68 | msgid "NCR Decimal" | |
69 | msgstr "" | |
70 | ||
71 | #: unknown | |
72 | msgid "NCR Hex" | |
73 | msgstr "" | |
74 | ||
75 | #: unknown | |
76 | msgid "STelex" | |
77 | msgstr "" | |
78 | ||
79 | #: unknown | |
80 | msgid "STelex2" | |
81 | msgstr "" | |
82 | ||
83 | #: unknown | |
84 | msgid "TCVN3" | |
85 | msgstr "" | |
86 | ||
87 | #: unknown | |
88 | msgid "Telex" | |
89 | msgstr "" | |
90 | ||
91 | #: unknown | |
92 | msgid "Unicode" | |
93 | msgstr "" | |
94 | ||
95 | #: unknown | |
96 | msgid "VIQR" | |
97 | msgstr "" | |
98 | ||
99 | #: unknown | |
100 | msgid "Vni" | |
101 | msgstr "" | |
102 | ||
103 | #: unknown | |
104 | msgid "VNI Win" | |
105 | msgstr "" | |
106 | ||
107 | #: /home/saber/Develop/fcitx-unikey/build/po/tmp/fcitx-unikey.conf.in.h:2 | |
108 | msgid "Unikey Wrapper For Fcitx" | |
109 | msgstr "" | |
110 | ||
111 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:86 | |
112 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:153 | |
113 | msgid "Choose input method" | |
114 | msgstr "" | |
115 | ||
116 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:94 | |
117 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:159 | |
118 | msgid "Choose output charset" | |
119 | msgstr "" | |
120 | ||
121 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:100 | |
122 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:163 | |
123 | msgid "Spell Check" | |
124 | msgstr "" | |
125 | ||
126 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:101 | |
127 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:164 | |
128 | msgid "Enable Spell Check" | |
129 | msgstr "" | |
130 | ||
131 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:108 | |
132 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:168 | |
133 | msgid "Macro" | |
134 | msgstr "" | |
135 | ||
136 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:109 | |
137 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:169 | |
138 | msgid "Enable Macro" | |
139 | msgstr "" | |
140 | ||
141 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:123 | |
142 | msgid "Unikey Input Method" | |
143 | msgstr "" | |
144 | ||
145 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:163 | |
146 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:168 | |
147 | msgid "N" | |
148 | msgstr "" |
0 | #!/bin/sh | |
1 | filename=desc.po | |
2 | indir=$1 | |
3 | outdir=$2 | |
4 | ||
5 | cd "$outdir" | |
6 | ||
7 | rm -f "$outdir/$filename"; touch "$outdir/$filename" | |
8 | ||
9 | cat > "$outdir/$filename" <<EOF | |
10 | # SOME DESCRIPTIVE TITLE. | |
11 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER | |
12 | # This file is distributed under the same license as the PACKAGE package. | |
13 | # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. | |
14 | # | |
15 | #, fuzzy | |
16 | msgid "" | |
17 | msgstr "" | |
18 | "Project-Id-Version: PACKAGE VERSION\n" | |
19 | "Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n" | |
20 | "POT-Creation-Date: 2010-11-17 11:48+0800\n" | |
21 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | |
22 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | |
23 | "Language-Team: LANGUAGE <LL@li.org>\n" | |
24 | "Language: \n" | |
25 | "MIME-Version: 1.0\n" | |
26 | "Content-Type: text/plain; charset=UTF-8\n" | |
27 | "Content-Transfer-Encoding: 8bit\n" | |
28 | EOF | |
29 | ||
30 | cd $indir | |
31 | ||
32 | descfiles=`find "$indir" -name ".hg" -prune -or -name "test" -prune -or -iname "*.desc" | grep desc` | |
33 | ||
34 | # Extract Description | |
35 | for f in $descfiles | |
36 | do | |
37 | awk '/^[\t ]*Description=/ { print "\n#: '$f':" NR"\n" "msgid \"" substr($0, 13)"\"\n" "msgstr \"\""}' "$f" >> "$outdir/$filename" | |
38 | done | |
39 | ||
40 | # Extract Group Name | |
41 | grep -nH '^\[' $descfiles | grep -v 'DescriptionFile' | awk ' "^[" { split($0, a, ":"); split(a[3], b, "/"); print substr(b[1], 2); }' | sort | uniq | awk '{ print "# unknown\nmsgid \""$0"\"\nmsgstr \"\"\n"; }' >> "$outdir/$filename" | |
42 | ||
43 | # Extract Enum Name | |
44 | grep -h 'Enum[0-9]' $descfiles | sed -e 's/Enum[0-9]=//g' | sort | uniq | awk '{ print "#: unknown\nmsgid \""$0"\"\nmsgstr \"\"\n"; }' >> "$outdir/$filename" | |
45 |
0 | # Vietnamese translations for ibus-unikey package | |
1 | # Bản dịch Việt ngữ cho gói tin ibus-unikey. | |
2 | # Copyright (C) 2009 Free Software Foundation, Inc. | |
3 | # This file is distributed under the same license as the ibus-unikey package. | |
4 | # | |
5 | # Lê Quốc Tuấn <mr.lequoctuan@gmail.com>, 2009. | |
6 | # Weng Xuetian <wengxt@gmail.com>, 2012. | |
7 | msgid "" | |
8 | msgstr "" | |
9 | "Project-Id-Version: ibus-unikey 0.6.1\n" | |
10 | "Report-Msgid-Bugs-To: \n" | |
11 | "POT-Creation-Date: 2012-05-05 16:38+0800\n" | |
12 | "PO-Revision-Date: 2012-05-05 16:39+0800\n" | |
13 | "Last-Translator: Weng Xuetian <wengxt@gmail.com>\n" | |
14 | "Language-Team: Chinese Simplified <kde-i18n-doc@kde.org>\n" | |
15 | "Language: zh_CN\n" | |
16 | "MIME-Version: 1.0\n" | |
17 | "Content-Type: text/plain; charset=UTF-8\n" | |
18 | "Content-Transfer-Encoding: 8bit\n" | |
19 | "Plural-Forms: nplurals=1; plural=0;\n" | |
20 | "X-Poedit-Language: Vietnamese\n" | |
21 | "X-Poedit-Country: VIET NAM\n" | |
22 | "X-Poedit-SourceCharset: utf-8\n" | |
23 | "X-Generator: Lokalize 1.4\n" | |
24 | ||
25 | #: /home/saber/Develop/fcitx-unikey/data/fcitx-unikey.desc:43 | |
26 | msgid "Allow type with more freedom" | |
27 | msgstr "Tự động trả phím khi gõ từ không hợp lệ" | |
28 | ||
29 | #: /home/saber/Develop/fcitx-unikey/data/fcitx-unikey.desc:48 | |
30 | msgid "Auto restore keys with invalid words" | |
31 | msgstr "Tự động trả phím khi gõ từ không hợp lệ" | |
32 | ||
33 | #: unknown | |
34 | msgid "BK HCM 2" | |
35 | msgstr "BK HCM 2" | |
36 | ||
37 | #: unknown | |
38 | msgid "CString" | |
39 | msgstr "CString" | |
40 | ||
41 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:86 | |
42 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:153 | |
43 | msgid "Choose input method" | |
44 | msgstr "Chọn kiểu gõ" | |
45 | ||
46 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:94 | |
47 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:159 | |
48 | msgid "Choose output charset" | |
49 | msgstr "Chọn bảng mã" | |
50 | ||
51 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:109 | |
52 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:169 | |
53 | msgid "Enable Macro" | |
54 | msgstr "Bật gõ tắt" | |
55 | ||
56 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:101 | |
57 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:164 | |
58 | msgid "Enable Spell Check" | |
59 | msgstr "Bật kiểm tra chính tả" | |
60 | ||
61 | #: /home/saber/Develop/fcitx-unikey/data/fcitx-unikey.desc:33 | |
62 | msgid "Enable macro" | |
63 | msgstr "Bật gõ tắt" | |
64 | ||
65 | #: /home/saber/Develop/fcitx-unikey/data/fcitx-unikey.desc:28 | |
66 | msgid "Enable spell check" | |
67 | msgstr "Bật kiểm tra chính tả" | |
68 | ||
69 | #: /home/saber/Develop/fcitx-unikey/data/fcitx-unikey.desc:4 | |
70 | msgid "Input Method" | |
71 | msgstr "Kiểu gõ" | |
72 | ||
73 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:108 | |
74 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:168 | |
75 | msgid "Macro" | |
76 | msgstr "gõ tắt" | |
77 | ||
78 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:163 | |
79 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:168 | |
80 | msgid "N" | |
81 | msgstr "N" | |
82 | ||
83 | #: unknown | |
84 | msgid "NCR Decimal" | |
85 | msgstr "NCR Decimal" | |
86 | ||
87 | #: unknown | |
88 | msgid "NCR Hex" | |
89 | msgstr "NCR Hex" | |
90 | ||
91 | #: /home/saber/Develop/fcitx-unikey/data/fcitx-unikey.desc:14 | |
92 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:137 | |
93 | msgid "Output Charset" | |
94 | msgstr "Bảng mã" | |
95 | ||
96 | #: /home/saber/Develop/fcitx-unikey/data/fcitx-unikey.desc:53 | |
97 | msgid "Process W at word begin" | |
98 | msgstr "Xử lý phím W ở đầu từ" | |
99 | ||
100 | #: unknown | |
101 | msgid "STelex" | |
102 | msgstr "STelex" | |
103 | ||
104 | #: unknown | |
105 | msgid "STelex2" | |
106 | msgstr "STelex2" | |
107 | ||
108 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:100 | |
109 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:163 | |
110 | msgid "Spell Check" | |
111 | msgstr "kiểm tra chính tả" | |
112 | ||
113 | #: unknown | |
114 | msgid "TCVN3" | |
115 | msgstr "TCVN3" | |
116 | ||
117 | #: unknown | |
118 | msgid "Telex" | |
119 | msgstr "Telex" | |
120 | ||
121 | #: unknown | |
122 | msgid "Unicode" | |
123 | msgstr "Unicode" | |
124 | ||
125 | # unknown | |
126 | #: /home/saber/Develop/fcitx-unikey/build/po/tmp/fcitx-unikey.conf.in.h:1 | |
127 | #: /home/saber/Develop/fcitx-unikey/build/po/tmp/unikey.conf.in.h:1 | |
128 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-im.cpp:131 | |
129 | msgid "Unikey" | |
130 | msgstr "Unikey" | |
131 | ||
132 | #: /home/saber/Develop/fcitx-unikey/build/po/../..//src/unikey-ui.cpp:123 | |
133 | msgid "Unikey Input Method" | |
134 | msgstr "Unikey Kiểu gõ" | |
135 | ||
136 | #: /home/saber/Develop/fcitx-unikey/build/po/tmp/fcitx-unikey.conf.in.h:2 | |
137 | msgid "Unikey Wrapper For Fcitx" | |
138 | msgstr "" | |
139 | ||
140 | #: /home/saber/Develop/fcitx-unikey/data/fcitx-unikey.desc:38 | |
141 | msgid "Use oà, _uý (instead of òa, úy)" | |
142 | msgstr "Dùng oà, _uý (thay vì òa, úy)" | |
143 | ||
144 | #: unknown | |
145 | msgid "VIQR" | |
146 | msgstr "VIQR" | |
147 | ||
148 | #: unknown | |
149 | msgid "VNI Win" | |
150 | msgstr "VNI Win" | |
151 | ||
152 | #: unknown | |
153 | msgid "Vni" | |
154 | msgstr "Vni" | |
155 | ||
156 | #~ msgid "(replace text)" | |
157 | #~ msgstr "(chuỗi thay thế)" | |
158 | ||
159 | #~ msgid "<b>Input/Output</b>" | |
160 | #~ msgstr "<b>Nhập/Xuất</b>" | |
161 | ||
162 | #~ msgid "<b>Options</b>" | |
163 | #~ msgstr "<b>Tùy chọn</b>" | |
164 | ||
165 | #~ msgid "Auto send PreEdit string to Application when mouse move or click" | |
166 | #~ msgstr "" | |
167 | #~ "Tự động gửi chuỗi PreEdit đến ứng dụng khi chuột di chuyển hoặc click" | |
168 | ||
169 | #~ msgid "Capture _mouse event" | |
170 | #~ msgstr "Bắt sự _kiện chuột" | |
171 | ||
172 | #~ msgid "Capture mouse event" | |
173 | #~ msgstr "Bắt sự kiện chuột" | |
174 | ||
175 | #~ msgid "Choose file to export" | |
176 | #~ msgstr "Chọn tập tin để xuất" | |
177 | ||
178 | #~ msgid "Choose file to import" | |
179 | #~ msgstr "Chọn tập tin để nhập" | |
180 | ||
181 | #~ msgid "Delete _all" | |
182 | #~ msgstr "Xóa _hết" | |
183 | ||
184 | #~ msgid "Full setup utility for IBus-Unikey" | |
185 | #~ msgstr "Tiện ích cài đặt đầy đủ cho IBus-Unikey" | |
186 | ||
187 | #~ msgid "Full setup..." | |
188 | #~ msgstr "Cài đặt đầy đủ..." | |
189 | ||
190 | #~ msgid "IBus-Unikey Setup" | |
191 | #~ msgstr "Cài đặt IBus-Unikey" | |
192 | ||
193 | #~ msgid "If enable, you can decrease mistake when typing" | |
194 | #~ msgstr "Nếu bật, bạn có thể giảm lỗi chính tả khi gõ" | |
195 | ||
196 | #~ msgid "Macro table definition" | |
197 | #~ msgstr "Định nghĩa bảng gõ tắt" | |
198 | ||
199 | #~ msgid "Options" | |
200 | #~ msgstr "Tùy chọn" | |
201 | ||
202 | #~ msgid "Options for Unikey" | |
203 | #~ msgstr "Tùy chọn cho Unikey" | |
204 | ||
205 | #~ msgid "Replace with" | |
206 | #~ msgstr "Thay thế bởi" | |
207 | ||
208 | #~ msgid "Simple Telex" | |
209 | #~ msgstr "Simple Telex" | |
210 | ||
211 | #~ msgid "Simple Telex 2" | |
212 | #~ msgstr "Simple Telex 2" | |
213 | ||
214 | #, fuzzy | |
215 | #~ msgid "Toggle Macro" | |
216 | #~ msgstr "Bật gõ tắt" | |
217 | ||
218 | #, fuzzy | |
219 | #~ msgid "Toggle Spell Check" | |
220 | #~ msgstr "Bật kiểm tra chính tả" | |
221 | ||
222 | #~ msgid "" | |
223 | #~ "Vietnamese Input Method Engine for IBus using Unikey Engine\n" | |
224 | #~ "Usage:\n" | |
225 | #~ " - Choose input method, output charset, options in language bar.\n" | |
226 | #~ " - There are 4 input methods: Telex, Vni, STelex (simple telex) and " | |
227 | #~ "STelex2 (which same as STelex, the difference is it use w as ư).\n" | |
228 | #~ " - And 7 output charsets: Unicode (UTF-8), TCVN3, VNI Win, VIQR, " | |
229 | #~ "CString, NCR Decimal and NCR Hex.\n" | |
230 | #~ " - Use <Shift>+<Space> or <Shift>+<Shift> to restore keystrokes.\n" | |
231 | #~ " - Use <Control> to commit a word." | |
232 | #~ msgstr "" | |
233 | #~ "Bộ gõ tiếng Việt cho IBus dùng Unikey Engine\n" | |
234 | #~ "Sử dụng:\n" | |
235 | #~ " - Chọn kiểu gõ, bảng mã, tùy chọn trên thanh ngôn ngữ.\n" | |
236 | #~ " - Có 4 kiểu gõ: Telex, Vni, STelex (telex đơn giản) và STelex2 (giống " | |
237 | #~ "như STelex, chỉ khác là nó dùng w như ư).\n" | |
238 | #~ " - Và 7 bảng mã: Unicode (UTF-8), TCVN3, VNI Win, VIQR, CString, NCR " | |
239 | #~ "Decimal và NCR Hex.\n" | |
240 | #~ " - Dùng <Shift>+<Space> hoặc <Shift>+<Shift> để khôi phục phím.\n" | |
241 | #~ " - Dùng <Control> để xác nhận từ (kết thúc từ)." | |
242 | ||
243 | #~ msgid "Word" | |
244 | #~ msgstr "Từ" | |
245 | ||
246 | #~ msgid "_Edit macro" | |
247 | #~ msgstr "_Sửa bảng gõ tắt" | |
248 | ||
249 | #~ msgid "_Export..." | |
250 | #~ msgstr "_Xuất..." | |
251 | ||
252 | #~ msgid "_Import..." | |
253 | #~ msgstr "_Nhập..." |
0 | include_directories ( | |
1 | ${PROJECT_SOURCE_DIR}/unikey | |
2 | ${FCITX4_FCITX_INCLUDE_DIRS} | |
3 | ${FCITX4_FCITX_CONFIG_INCLUDE_DIRS} | |
4 | ${FCITX4_FCITX_UTILS_INCLUDE_DIRS} | |
5 | ${PROJECT_BINARY_DIR} | |
6 | ${LIBICONV_INCLUDE_DIR} | |
7 | ) | |
8 | ||
9 | set( fcitx_unikey_sources | |
10 | unikey-im.cpp | |
11 | unikey-config.cpp | |
12 | unikey-ui.cpp | |
13 | ) | |
14 | ||
15 | set(UNIKEY_SRCS | |
16 | ../unikey/byteio.cpp | |
17 | ../unikey/byteio.h | |
18 | ../unikey/charset.cpp | |
19 | ../unikey/charset.h | |
20 | ../unikey/convert.cpp | |
21 | ../unikey/data.cpp | |
22 | ../unikey/data.h | |
23 | ../unikey/error.cpp | |
24 | ../unikey/inputproc.cpp | |
25 | ../unikey/inputproc.h | |
26 | ../unikey/keycons.h | |
27 | ../unikey/mactab.cpp | |
28 | ../unikey/mactab.h | |
29 | ../unikey/pattern.cpp | |
30 | ../unikey/pattern.h | |
31 | ../unikey/ukengine.cpp | |
32 | ../unikey/ukengine.h | |
33 | ../unikey/unikey.cpp | |
34 | ../unikey/unikey.h | |
35 | ../unikey/usrkeymap.cpp | |
36 | ../unikey/usrkeymap.h | |
37 | ../unikey/vnconv.h | |
38 | ../unikey/vnlexi.h | |
39 | ) | |
40 | ||
41 | add_definitions( -DLOCALEDIR=\"${CMAKE_INSTALL_PREFIX}/share/locale\" ) | |
42 | ||
43 | fcitx_add_addon(fcitx-unikey ${fcitx_unikey_sources} ${UNIKEY_SRCS} ) |
0 | /*************************************************************************** | |
1 | * Copyright (C) 2012~2012 by CSSlayer * | |
2 | * wengxt@gmail.com * | |
3 | * * | |
4 | * This program is free software: you can redistribute it and/or modify * | |
5 | * it under the terms of the GNU General Public License as published by * | |
6 | * the Free Software Foundation, either version 3 of the License, or * | |
7 | * (at your option) any later version. * | |
8 | * * | |
9 | * This program is distributed in the hope that it will be useful, * | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | |
12 | * GNU General Public License for more details. * | |
13 | * * | |
14 | * You should have received a copy of the GNU General Public License * | |
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. * | |
16 | * * | |
17 | ***************************************************************************/ | |
18 | ||
19 | #include "unikey-config.h" | |
20 | ||
21 | /* USE fcitx provided macro to bind config and variable */ | |
22 | CONFIG_BINDING_BEGIN(UnikeyConfig) | |
23 | CONFIG_BINDING_REGISTER("Unikey", "InputMethod", im) | |
24 | CONFIG_BINDING_REGISTER("Unikey", "OuputCharset", oc) | |
25 | CONFIG_BINDING_REGISTER("Unikey", "SpellCheck", spellCheck) | |
26 | CONFIG_BINDING_REGISTER("Unikey", "Macro", macro) | |
27 | CONFIG_BINDING_REGISTER("Unikey", "ModernStyle", modernStyle) | |
28 | CONFIG_BINDING_REGISTER("Unikey", "FreeMarking", freeMarking) | |
29 | CONFIG_BINDING_REGISTER("Unikey", "AutoNonVnRestore", autoNonVnRestore) | |
30 | CONFIG_BINDING_REGISTER("Unikey", "ProcessWAtBegin", process_w_at_begin) | |
31 | CONFIG_BINDING_END()⏎ |
0 | /*************************************************************************** | |
1 | * Copyright (C) 2012~2012 by CSSlayer * | |
2 | * wengxt@gmail.com * | |
3 | * * | |
4 | * This program is free software: you can redistribute it and/or modify * | |
5 | * it under the terms of the GNU General Public License as published by * | |
6 | * the Free Software Foundation, either version 3 of the License, or * | |
7 | * (at your option) any later version. * | |
8 | * * | |
9 | * This program is distributed in the hope that it will be useful, * | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | |
12 | * GNU General Public License for more details. * | |
13 | * * | |
14 | * You should have received a copy of the GNU General Public License * | |
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. * | |
16 | * * | |
17 | ***************************************************************************/ | |
18 | ||
19 | #ifndef UNIKEY_CONFIG_H | |
20 | #define UNIKEY_CONFIG_H | |
21 | #include <keycons.h> | |
22 | #include <fcitx-config/fcitx-config.h> | |
23 | ||
24 | enum UkConv { | |
25 | UKCONV_XUTF8, | |
26 | UKCONV_TCVN3, | |
27 | UKCONV_VNIWIN, | |
28 | UKCONV_VIQR, | |
29 | UKCONV_BKHCM2, | |
30 | UKCONV_UNI_CSTRING, | |
31 | UKCONV_UNIREF, | |
32 | UKCONV_UNIREF_HEX | |
33 | }; | |
34 | ||
35 | struct UnikeyConfig | |
36 | { | |
37 | FcitxGenericConfig gconfig; | |
38 | UkInputMethod im; | |
39 | UkConv oc; | |
40 | boolean spellCheck; | |
41 | boolean macro; | |
42 | boolean process_w_at_begin; | |
43 | boolean autoNonVnRestore; | |
44 | boolean modernStyle; | |
45 | boolean freeMarking; | |
46 | }; | |
47 | ||
48 | ||
49 | CONFIG_BINDING_DECLARE(UnikeyConfig); | |
50 | ||
51 | #endif // UNIKEY_CONFIG_H⏎ |
0 | /*************************************************************************** | |
1 | * Copyright (C) 2012~2012 by CSSlayer * | |
2 | * wengxt@gmail.com * | |
3 | * * | |
4 | * This program is free software: you can redistribute it and/or modify * | |
5 | * it under the terms of the GNU General Public License as published by * | |
6 | * the Free Software Foundation, either version 3 of the License, or * | |
7 | * (at your option) any later version. * | |
8 | * * | |
9 | * This program is distributed in the hope that it will be useful, * | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | |
12 | * GNU General Public License for more details. * | |
13 | * * | |
14 | * You should have received a copy of the GNU General Public License * | |
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. * | |
16 | * * | |
17 | ***************************************************************************/ | |
18 | ||
19 | #include <iconv.h> | |
20 | ||
21 | #include <string> | |
22 | ||
23 | #include <fcitx/fcitx.h> | |
24 | #include <fcitx/ime.h> | |
25 | #include <fcitx/hook.h> | |
26 | #include <fcitx/instance.h> | |
27 | #include <fcitx-config/xdg.h> | |
28 | #include <fcitx-utils/log.h> | |
29 | #include <errno.h> | |
30 | ||
31 | #include "config.h" | |
32 | #include "unikey.h" | |
33 | #include "keycons.h" | |
34 | #include "vnconv.h" | |
35 | #include "unikey-config.h" | |
36 | #include "unikey-im.h" | |
37 | #include "unikey-ui.h" | |
38 | ||
39 | #define CONVERT_BUF_SIZE 1024 | |
40 | ||
41 | #ifdef LIBICONV_SECOND_ARGUMENT_IS_CONST | |
42 | typedef const char* IconvStr; | |
43 | #else | |
44 | typedef char* IconvStr; | |
45 | #endif | |
46 | ||
47 | static void* FcitxUnikeyCreate(FcitxInstance* instance); | |
48 | static void FcitxUnikeyDestroy(void* arg); | |
49 | static INPUT_RETURN_VALUE FcitxUnikeyDoInput(void* arg, FcitxKeySym sym, unsigned int state); | |
50 | static boolean FcitxUnikeyInit(void* arg); | |
51 | static void FcitxUnikeyReset(void* arg); | |
52 | static void FcitxUnikeyResetUI(void* arg); | |
53 | static INPUT_RETURN_VALUE FcitxUnikeyDoInputPreedit(FcitxUnikey* unikey, FcitxKeySym sym, unsigned int state); | |
54 | static void FcitxUnikeyEraseChars(FcitxUnikey *unikey, int num_chars); | |
55 | static void FcitxUnikeyUpdatePreedit(FcitxUnikey *unikey); | |
56 | ||
57 | static boolean LoadUnikeyConfig(UnikeyConfig* config); | |
58 | static void ConfigUnikey(FcitxUnikey* unikey); | |
59 | static void ReloadConfigFcitxUnikey(void* arg); | |
60 | static void SaveUnikeyConfig(UnikeyConfig* fa); | |
61 | ||
62 | static int latinToUtf(unsigned char* dst, unsigned char* src, int inSize, int* pOutSize); | |
63 | ||
64 | FCITX_EXPORT_API | |
65 | FcitxIMClass ime = { | |
66 | FcitxUnikeyCreate, | |
67 | FcitxUnikeyDestroy | |
68 | }; | |
69 | FCITX_EXPORT_API | |
70 | int ABI_VERSION = FCITX_ABI_VERSION; | |
71 | static const unsigned int Unikey_OC[] = {CONV_CHARSET_XUTF8, | |
72 | CONV_CHARSET_TCVN3, | |
73 | CONV_CHARSET_VNIWIN, | |
74 | CONV_CHARSET_VIQR, | |
75 | CONV_CHARSET_BKHCM2, | |
76 | CONV_CHARSET_UNI_CSTRING, | |
77 | CONV_CHARSET_UNIREF, | |
78 | CONV_CHARSET_UNIREF_HEX}; | |
79 | static const unsigned int NUM_OUTPUTCHARSET = sizeof(Unikey_OC)/sizeof(Unikey_OC[0]); | |
80 | ||
81 | static const unsigned char WordBreakSyms[] = | |
82 | { | |
83 | ',', ';', ':', '.', '\"', '\'', '!', '?', ' ', | |
84 | '<', '>', '=', '+', '-', '*', '/', '\\', | |
85 | '_', '~', '`', '@', '#', '$', '%', '^', '&', '(', ')', '{', '}', '[', ']', | |
86 | '|' | |
87 | }; | |
88 | ||
89 | static const unsigned char WordAutoCommit[] = | |
90 | { | |
91 | '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', | |
92 | 'b', 'c', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', | |
93 | 'p', 'q', 'r', 's', 't', 'v', 'x', 'z', | |
94 | 'B', 'C', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', | |
95 | 'P', 'Q', 'R', 'S', 'T', 'V', 'X', 'Z' | |
96 | }; | |
97 | ||
98 | ||
99 | ||
100 | int FcitxUnikeyUcs4ToUtf8(FcitxUnikey* unikey, const unsigned int c, char buf[UTF8_MAX_LENGTH + 1]) | |
101 | { | |
102 | unsigned int str[2]; | |
103 | str[0] = c; | |
104 | str[1] = 0; | |
105 | ||
106 | size_t ucslen = 1; | |
107 | size_t len = UTF8_MAX_LENGTH; | |
108 | len *= sizeof(char); | |
109 | ucslen *= sizeof(unsigned int); | |
110 | char* p = buf; | |
111 | IconvStr src = (IconvStr) str; | |
112 | iconv(unikey->conv, &src, &ucslen, &p, &len); | |
113 | return (UTF8_MAX_LENGTH - len) / sizeof(char); | |
114 | } | |
115 | ||
116 | ||
117 | void* FcitxUnikeyCreate(FcitxInstance* instance) | |
118 | { | |
119 | FcitxUnikey* unikey = (FcitxUnikey*) fcitx_utils_malloc0(sizeof(FcitxUnikey)); | |
120 | ||
121 | if (!LoadUnikeyConfig(&unikey->config)) | |
122 | { | |
123 | free(unikey); | |
124 | return NULL; | |
125 | } | |
126 | unikey->owner = instance; | |
127 | unikey->preeditstr = new std::string; | |
128 | union { | |
129 | short s; | |
130 | unsigned char b[2]; | |
131 | } endian; | |
132 | endian.s = 0x1234; | |
133 | if (endian.b[0] == 0x12) | |
134 | unikey->conv = iconv_open("utf-8", "ucs-4be"); | |
135 | else | |
136 | unikey->conv = iconv_open("utf-8", "ucs-4le"); | |
137 | ||
138 | FcitxIMIFace iface; | |
139 | memset(&iface, 0, sizeof(FcitxIMIFace)); | |
140 | iface.Init = FcitxUnikeyInit; | |
141 | iface.ResetIM = FcitxUnikeyReset; | |
142 | iface.DoInput = FcitxUnikeyDoInput; | |
143 | iface.ReloadConfig = ReloadConfigFcitxUnikey; | |
144 | ||
145 | FcitxInstanceRegisterIMv2( | |
146 | instance, | |
147 | unikey, | |
148 | "unikey", | |
149 | _("Unikey"), | |
150 | "unikey", | |
151 | iface, | |
152 | 1, | |
153 | "vi" | |
154 | ); | |
155 | ||
156 | UnikeySetup(); | |
157 | ||
158 | InitializeBar(unikey); | |
159 | InitializeMenu(unikey); | |
160 | ||
161 | ConfigUnikey(unikey); | |
162 | ||
163 | FcitxIMEventHook hk; | |
164 | hk.arg = unikey; | |
165 | hk.func = FcitxUnikeyResetUI; | |
166 | ||
167 | FcitxInstanceRegisterResetInputHook(instance, hk); | |
168 | ||
169 | return unikey; | |
170 | } | |
171 | ||
172 | void FcitxUnikeyDestroy(void* arg) | |
173 | { | |
174 | UnikeyCleanup(); | |
175 | } | |
176 | ||
177 | ||
178 | boolean FcitxUnikeyInit(void* arg) | |
179 | { | |
180 | return true; | |
181 | } | |
182 | ||
183 | void FcitxUnikeyReset(void* arg) | |
184 | { | |
185 | FcitxUnikey* unikey = (FcitxUnikey*) arg; | |
186 | ||
187 | UnikeyResetBuf(); | |
188 | unikey->preeditstr->clear(); | |
189 | } | |
190 | ||
191 | void FcitxUnikeyCommit(FcitxUnikey* unikey) | |
192 | { | |
193 | if (unikey->preeditstr->length() > 0) { | |
194 | FcitxInstanceCommitString(unikey->owner, FcitxInstanceGetCurrentIC(unikey->owner), unikey->preeditstr->c_str()); | |
195 | } | |
196 | FcitxUnikeyReset(unikey); | |
197 | } | |
198 | ||
199 | INPUT_RETURN_VALUE FcitxUnikeyDoInput(void* arg, FcitxKeySym sym, unsigned int state) | |
200 | { | |
201 | FcitxUnikey* unikey = (FcitxUnikey*) arg; | |
202 | INPUT_RETURN_VALUE tmp; | |
203 | FcitxInputState* input = FcitxInstanceGetInputState(unikey->owner); | |
204 | /* use origin sym and state here */ | |
205 | sym = (FcitxKeySym) FcitxInputStateGetKeySym(input); | |
206 | state = FcitxInputStateGetKeyState(input); | |
207 | ||
208 | tmp = FcitxUnikeyDoInputPreedit(unikey, sym, state); | |
209 | ||
210 | // check last keyevent with shift | |
211 | if (sym >= FcitxKey_space && sym <=FcitxKey_asciitilde) | |
212 | { | |
213 | unikey->last_key_with_shift = state & FcitxKeyState_Shift; | |
214 | } | |
215 | else | |
216 | { | |
217 | unikey->last_key_with_shift = false; | |
218 | } // end check last keyevent with shift | |
219 | ||
220 | return tmp; | |
221 | } | |
222 | ||
223 | INPUT_RETURN_VALUE FcitxUnikeyDoInputPreedit(FcitxUnikey* unikey, FcitxKeySym sym, unsigned int state) | |
224 | { | |
225 | ||
226 | if (state & FcitxKeyState_Ctrl | |
227 | || state & FcitxKeyState_Alt // alternate mask | |
228 | || sym == FcitxKey_Control_L | |
229 | || sym == FcitxKey_Control_R | |
230 | || sym == FcitxKey_Tab | |
231 | || sym == FcitxKey_Return | |
232 | || sym == FcitxKey_Delete | |
233 | || sym == FcitxKey_KP_Enter | |
234 | || (sym >= FcitxKey_Home && sym <= FcitxKey_Insert) | |
235 | || (sym >= FcitxKey_KP_Home && sym <= FcitxKey_KP_Delete) | |
236 | ) | |
237 | { | |
238 | FcitxUnikeyCommit(unikey); | |
239 | return IRV_FLAG_FORWARD_KEY; | |
240 | } | |
241 | ||
242 | else if ((sym >= FcitxKey_Caps_Lock && sym <= FcitxKey_Hyper_R) | |
243 | || (!(state & FcitxKeyState_Shift) && (sym == FcitxKey_Shift_L || sym == FcitxKey_Shift_R)) // when press one shift key | |
244 | ) | |
245 | { | |
246 | return IRV_TO_PROCESS; | |
247 | } | |
248 | ||
249 | // capture BackSpace | |
250 | else if (sym == FcitxKey_BackSpace) | |
251 | { | |
252 | UnikeyBackspacePress(); | |
253 | ||
254 | if (UnikeyBackspaces == 0 || unikey->preeditstr->empty()) | |
255 | { | |
256 | FcitxUnikeyCommit(unikey); | |
257 | return IRV_FLAG_FORWARD_KEY; | |
258 | } | |
259 | else | |
260 | { | |
261 | if (unikey->preeditstr->length() <= (unsigned int)UnikeyBackspaces) | |
262 | { | |
263 | unikey->preeditstr->clear(); | |
264 | unikey->auto_commit = true; | |
265 | } | |
266 | else | |
267 | { | |
268 | FcitxUnikeyEraseChars(unikey, UnikeyBackspaces); | |
269 | FcitxUnikeyUpdatePreedit(unikey); | |
270 | } | |
271 | ||
272 | // change tone position after press backspace | |
273 | if (UnikeyBufChars > 0) | |
274 | { | |
275 | if (unikey->config.oc == UKCONV_XUTF8) | |
276 | { | |
277 | unikey->preeditstr->append((const char*)UnikeyBuf, UnikeyBufChars); | |
278 | } | |
279 | else | |
280 | { | |
281 | static unsigned char buf[CONVERT_BUF_SIZE]; | |
282 | int bufSize = CONVERT_BUF_SIZE; | |
283 | ||
284 | latinToUtf(buf, UnikeyBuf, UnikeyBufChars, &bufSize); | |
285 | unikey->preeditstr->append((const char*)buf, CONVERT_BUF_SIZE - bufSize); | |
286 | } | |
287 | ||
288 | unikey->auto_commit = false; | |
289 | FcitxUnikeyUpdatePreedit(unikey); | |
290 | } | |
291 | } | |
292 | return IRV_DISPLAY_MESSAGE; | |
293 | } // end capture BackSpace | |
294 | ||
295 | else if (sym >=FcitxKey_KP_Multiply && sym <=FcitxKey_KP_9) | |
296 | { | |
297 | FcitxUnikeyCommit(unikey); | |
298 | return IRV_FLAG_FORWARD_KEY; | |
299 | } | |
300 | ||
301 | // capture ascii printable char | |
302 | else if ((sym >= FcitxKey_space && sym <=FcitxKey_asciitilde) | |
303 | || sym == FcitxKey_Shift_L || sym == FcitxKey_Shift_R) // sure this have FcitxKey_SHIFT_MASK | |
304 | { | |
305 | unsigned int i = 0; | |
306 | ||
307 | UnikeySetCapsState(state & FcitxKeyState_Shift, state & FcitxKeyState_CapsLock); | |
308 | ||
309 | // process sym | |
310 | ||
311 | // auto commit word that never need to change later in preedit string (like consonant - phu am) | |
312 | // if macro enabled, then not auto commit. Because macro may change any word | |
313 | if (unikey->ukopt.macroEnabled == 0 && (UnikeyAtWordBeginning() || unikey->auto_commit)) | |
314 | { | |
315 | for (i =0; i < sizeof(WordAutoCommit); i++) | |
316 | { | |
317 | if (sym == WordAutoCommit[i]) | |
318 | { | |
319 | UnikeyPutChar(sym); | |
320 | unikey->auto_commit = true; | |
321 | return IRV_FLAG_FORWARD_KEY; | |
322 | } | |
323 | } | |
324 | } // end auto commit | |
325 | ||
326 | if ((unikey->config.im == UkTelex || unikey->config.im == UkSimpleTelex2) | |
327 | && unikey->config.process_w_at_begin == false | |
328 | && UnikeyAtWordBeginning() | |
329 | && (sym == FcitxKey_w || sym == FcitxKey_W)) | |
330 | { | |
331 | UnikeyPutChar(sym); | |
332 | if (unikey->ukopt.macroEnabled == 0) | |
333 | { | |
334 | return IRV_TO_PROCESS; | |
335 | } | |
336 | else | |
337 | { | |
338 | unikey->preeditstr->append(sym==FcitxKey_w?"w":"W"); | |
339 | FcitxUnikeyUpdatePreedit(unikey); | |
340 | return IRV_DISPLAY_MESSAGE; | |
341 | } | |
342 | } | |
343 | ||
344 | unikey->auto_commit = false; | |
345 | ||
346 | // shift + space, shift + shift event | |
347 | if ((unikey->last_key_with_shift == false && state & FcitxKeyState_Shift | |
348 | && sym == FcitxKey_space && !UnikeyAtWordBeginning()) | |
349 | || (sym == FcitxKey_Shift_L || sym == FcitxKey_Shift_R) // (&& state & FcitxKey_SHIFT_MASK), sure this have FcitxKey_SHIFT_MASK | |
350 | ) | |
351 | { | |
352 | UnikeyRestoreKeyStrokes(); | |
353 | } // end shift + space, shift + shift event | |
354 | ||
355 | else | |
356 | { | |
357 | UnikeyFilter(sym); | |
358 | } | |
359 | // end process sym | |
360 | ||
361 | // process result of ukengine | |
362 | if (UnikeyBackspaces > 0) | |
363 | { | |
364 | if (unikey->preeditstr->length() <= (unsigned int)UnikeyBackspaces) | |
365 | { | |
366 | unikey->preeditstr->clear(); | |
367 | } | |
368 | else | |
369 | { | |
370 | FcitxUnikeyEraseChars(unikey, UnikeyBackspaces); | |
371 | } | |
372 | } | |
373 | ||
374 | if (UnikeyBufChars > 0) | |
375 | { | |
376 | if (unikey->config.oc == UKCONV_XUTF8) | |
377 | { | |
378 | unikey->preeditstr->append((const char*)UnikeyBuf, UnikeyBufChars); | |
379 | } | |
380 | else | |
381 | { | |
382 | unsigned char buf[CONVERT_BUF_SIZE + 1]; | |
383 | int bufSize = CONVERT_BUF_SIZE; | |
384 | ||
385 | latinToUtf(buf, UnikeyBuf, UnikeyBufChars, &bufSize); | |
386 | unikey->preeditstr->append((const char*)buf, CONVERT_BUF_SIZE - bufSize); | |
387 | } | |
388 | } | |
389 | else if (sym != FcitxKey_Shift_L && sym != FcitxKey_Shift_R) // if ukengine not process | |
390 | { | |
391 | int n; | |
392 | char s[7] = {0, 0, 0, 0, 0, 0, 0}; | |
393 | ||
394 | n = FcitxUnikeyUcs4ToUtf8(unikey, (unsigned int)sym, s); // convert ucs4 to utf8 char | |
395 | unikey->preeditstr->append(s, n); | |
396 | } | |
397 | // end process result of ukengine | |
398 | ||
399 | // commit string: if need | |
400 | if (unikey->preeditstr->length() > 0) | |
401 | { | |
402 | unsigned int i; | |
403 | for (i = 0; i < sizeof(WordBreakSyms); i++) | |
404 | { | |
405 | if (WordBreakSyms[i] == unikey->preeditstr->at(unikey->preeditstr->length()-1) | |
406 | && WordBreakSyms[i] == sym) | |
407 | { | |
408 | FcitxUnikeyCommit(unikey); | |
409 | return IRV_DO_NOTHING; | |
410 | } | |
411 | } | |
412 | } | |
413 | // end commit string | |
414 | ||
415 | FcitxUnikeyUpdatePreedit(unikey); | |
416 | return IRV_DISPLAY_MESSAGE; | |
417 | } //end capture printable char | |
418 | ||
419 | // non process key | |
420 | ||
421 | FcitxUnikeyCommit(unikey); | |
422 | return IRV_FLAG_FORWARD_KEY; | |
423 | } | |
424 | ||
425 | ||
426 | // code from x-unikey, for convert charset that not is XUtf-8 | |
427 | int latinToUtf(unsigned char* dst, unsigned char* src, int inSize, int* pOutSize) | |
428 | { | |
429 | int i; | |
430 | int outLeft; | |
431 | unsigned char ch; | |
432 | ||
433 | outLeft = *pOutSize; | |
434 | ||
435 | for (i=0; i<inSize; i++) | |
436 | { | |
437 | ch = *src++; | |
438 | if (ch < 0x80) | |
439 | { | |
440 | outLeft -= 1; | |
441 | if (outLeft >= 0) | |
442 | *dst++ = ch; | |
443 | } | |
444 | else | |
445 | { | |
446 | outLeft -= 2; | |
447 | if (outLeft >= 0) | |
448 | { | |
449 | *dst++ = (0xC0 | ch >> 6); | |
450 | *dst++ = (0x80 | (ch & 0x3F)); | |
451 | } | |
452 | } | |
453 | } | |
454 | ||
455 | *pOutSize = outLeft; | |
456 | return (outLeft >= 0); | |
457 | } | |
458 | ||
459 | ||
460 | static void FcitxUnikeyEraseChars(FcitxUnikey *unikey, int num_chars) | |
461 | { | |
462 | int i, k; | |
463 | unsigned char c; | |
464 | k = num_chars; | |
465 | ||
466 | for ( i = unikey->preeditstr->length()-1; i >= 0 && k > 0; i--) | |
467 | { | |
468 | c = unikey->preeditstr->at(i); | |
469 | ||
470 | // count down if byte is begin byte of utf-8 char | |
471 | if (c < (unsigned char)'\x80' || c >= (unsigned char)'\xC0') | |
472 | { | |
473 | k--; | |
474 | } | |
475 | } | |
476 | ||
477 | unikey->preeditstr->erase(i+1); | |
478 | } | |
479 | ||
480 | ||
481 | static void FcitxUnikeyUpdatePreedit(FcitxUnikey *unikey) | |
482 | { | |
483 | FcitxInputState* input = FcitxInstanceGetInputState(unikey->owner); | |
484 | FcitxMessages* preedit = FcitxInputStateGetPreedit(input); | |
485 | FcitxMessages* clientPreedit = FcitxInputStateGetClientPreedit(input); | |
486 | FcitxInputContext* ic = FcitxInstanceGetCurrentIC(unikey->owner); | |
487 | FcitxProfile* profile = FcitxInstanceGetProfile(unikey->owner); | |
488 | FcitxInstanceCleanInputWindowUp(unikey->owner); | |
489 | if (ic && ((ic->contextCaps & CAPACITY_PREEDIT) == 0 || !profile->bUsePreedit)) { | |
490 | FcitxMessagesAddMessageAtLast(preedit, MSG_INPUT, "%s", unikey->preeditstr->c_str()); | |
491 | FcitxInputStateSetCursorPos(input, unikey->preeditstr->size()); | |
492 | } | |
493 | FcitxMessagesAddMessageAtLast(clientPreedit, MSG_INPUT, "%s", unikey->preeditstr->c_str()); | |
494 | FcitxInputStateSetClientCursorPos(input, unikey->preeditstr->size()); | |
495 | } | |
496 | ||
497 | CONFIG_DESC_DEFINE(GetUnikeyConfigDesc, "fcitx-unikey.desc") | |
498 | ||
499 | boolean LoadUnikeyConfig(UnikeyConfig* config) | |
500 | { | |
501 | FcitxConfigFileDesc *configDesc = GetUnikeyConfigDesc(); | |
502 | if (!configDesc) | |
503 | return false; | |
504 | ||
505 | FILE *fp = FcitxXDGGetFileUserWithPrefix("conf", "fcitx-unikey.config", "r", NULL); | |
506 | ||
507 | if (!fp) | |
508 | { | |
509 | if (errno == ENOENT) | |
510 | SaveUnikeyConfig(config); | |
511 | } | |
512 | FcitxConfigFile *cfile = FcitxConfigParseConfigFileFp(fp, configDesc); | |
513 | ||
514 | UnikeyConfigConfigBind(config, cfile, configDesc); | |
515 | FcitxConfigBindSync(&config->gconfig); | |
516 | ||
517 | if (fp) | |
518 | fclose(fp); | |
519 | return true; | |
520 | } | |
521 | ||
522 | void ConfigUnikey(FcitxUnikey* unikey) | |
523 | { | |
524 | unikey->ukopt.macroEnabled = unikey->config.macro; | |
525 | unikey->ukopt.spellCheckEnabled = unikey->config.spellCheck; | |
526 | unikey->ukopt.autoNonVnRestore = unikey->config.autoNonVnRestore; | |
527 | unikey->ukopt.modernStyle = unikey->config.modernStyle; | |
528 | unikey->ukopt.freeMarking = unikey->config.freeMarking; | |
529 | UnikeySetInputMethod(unikey->config.im); | |
530 | UnikeySetOutputCharset(Unikey_OC[unikey->config.oc]); | |
531 | UnikeySetOptions(&unikey->ukopt); | |
532 | ||
533 | UpdateUnikeyUI(unikey); | |
534 | } | |
535 | ||
536 | void ReloadConfigFcitxUnikey(void* arg) | |
537 | { | |
538 | FcitxUnikey* unikey = (FcitxUnikey*) arg; | |
539 | LoadUnikeyConfig(&unikey->config); | |
540 | ConfigUnikey(unikey); | |
541 | } | |
542 | ||
543 | void SaveUnikeyConfig(UnikeyConfig* fa) | |
544 | { | |
545 | FcitxConfigFileDesc *configDesc = GetUnikeyConfigDesc(); | |
546 | FILE *fp = FcitxXDGGetFileUserWithPrefix("conf", "fcitx-unikey.config", "w", NULL); | |
547 | FcitxConfigSaveConfigFileFp(fp, &fa->gconfig, configDesc); | |
548 | if (fp) | |
549 | fclose(fp); | |
550 | } | |
551 | ||
552 | void FcitxUnikeyResetUI(void* arg) | |
553 | { | |
554 | FcitxUnikey* unikey = (FcitxUnikey*) arg; | |
555 | FcitxInstance* instance = unikey->owner; | |
556 | FcitxIM* im = FcitxInstanceGetCurrentIM(instance); | |
557 | boolean visible; | |
558 | if (!im || strcmp(im->uniqueName, "unikey") != 0) | |
559 | visible = false; | |
560 | else | |
561 | visible = true; | |
562 | FcitxUISetStatusVisable(instance, "unikey-input-method", visible); | |
563 | FcitxUISetStatusVisable(instance, "unikey-output-charset", visible); | |
564 | FcitxUISetStatusVisable(instance, "unikey-spell-check", visible); | |
565 | FcitxUISetStatusVisable(instance, "unikey-macro", visible); | |
566 | } | |
567 | ||
568 | void UpdateUnikeyConfig(FcitxUnikey* unikey) | |
569 | { | |
570 | ConfigUnikey(unikey); | |
571 | SaveUnikeyConfig(&unikey->config); | |
572 | } | |
573 |
0 | /*************************************************************************** | |
1 | * Copyright (C) 2012~2012 by CSSlayer * | |
2 | * wengxt@gmail.com * | |
3 | * * | |
4 | * This program is free software: you can redistribute it and/or modify * | |
5 | * it under the terms of the GNU General Public License as published by * | |
6 | * the Free Software Foundation, either version 3 of the License, or * | |
7 | * (at your option) any later version. * | |
8 | * * | |
9 | * This program is distributed in the hope that it will be useful, * | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | |
12 | * GNU General Public License for more details. * | |
13 | * * | |
14 | * You should have received a copy of the GNU General Public License * | |
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. * | |
16 | * * | |
17 | ***************************************************************************/ | |
18 | ||
19 | #ifndef UNIKEY_IM_H | |
20 | #define UNIKEY_IM_H | |
21 | #include <iconv.h> | |
22 | #include <string> | |
23 | #include <fcitx/instance.h> | |
24 | #include <libintl.h> | |
25 | ||
26 | #define _(x) dgettext("fcitx-unikey", (x)) | |
27 | #include "unikey-config.h" | |
28 | ||
29 | struct FcitxUnikey | |
30 | { | |
31 | UnikeyConfig config; | |
32 | std::string* preeditstr; | |
33 | UnikeyOptions ukopt; | |
34 | FcitxInstance* owner; | |
35 | bool auto_commit; | |
36 | bool last_key_with_shift; | |
37 | iconv_t conv; | |
38 | FcitxUIMenu imMenu; | |
39 | FcitxUIMenu ocMenu; | |
40 | }; | |
41 | ||
42 | void UpdateUnikeyConfig(FcitxUnikey* unikey); | |
43 | ||
44 | #endif //UNIKEY_IM_H⏎ |
0 | /*************************************************************************** | |
1 | * Copyright (C) 2012~2012 by CSSlayer * | |
2 | * wengxt@gmail.com * | |
3 | * * | |
4 | * This program is free software: you can redistribute it and/or modify * | |
5 | * it under the terms of the GNU General Public License as published by * | |
6 | * the Free Software Foundation, either version 3 of the License, or * | |
7 | * (at your option) any later version. * | |
8 | * * | |
9 | * This program is distributed in the hope that it will be useful, * | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | |
12 | * GNU General Public License for more details. * | |
13 | * * | |
14 | * You should have received a copy of the GNU General Public License * | |
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. * | |
16 | * * | |
17 | ***************************************************************************/ | |
18 | ||
19 | #include "unikey-im.h" | |
20 | ||
21 | const char* Unikey_IMNames[] = {"Telex", "Vni", "STelex", "STelex2"}; | |
22 | const UkInputMethod Unikey_IM[] = {UkTelex, UkVni, UkSimpleTelex, UkSimpleTelex2}; | |
23 | const unsigned int NUM_INPUTMETHOD = sizeof(Unikey_IM)/sizeof(Unikey_IM[0]); | |
24 | ||
25 | const char* Unikey_OCNames[] = {"Unicode", | |
26 | "TCVN3", | |
27 | "VNI Win", | |
28 | "VIQR", | |
29 | "BK HCM 2", | |
30 | "CString", | |
31 | "NCR Decimal", | |
32 | "NCR Hex"}; | |
33 | const unsigned int NUM_OUTPUTCHARSET = sizeof(Unikey_OCNames)/sizeof(Unikey_OCNames[0]); | |
34 | ||
35 | void UpdateIMMenu(FcitxUIMenu *menu) | |
36 | { | |
37 | FcitxUnikey* unikey = (FcitxUnikey*) menu->priv; | |
38 | menu->mark = unikey->config.im; | |
39 | } | |
40 | ||
41 | boolean IMMenuAction(FcitxUIMenu *menu, int index) | |
42 | { | |
43 | FcitxUnikey* unikey = (FcitxUnikey*) menu->priv; | |
44 | unikey->config.im = (UkInputMethod) index; | |
45 | UpdateUnikeyConfig(unikey); | |
46 | return true; | |
47 | } | |
48 | ||
49 | void UpdateOCMenu(FcitxUIMenu *menu) | |
50 | { | |
51 | FcitxUnikey* unikey = (FcitxUnikey*) menu->priv; | |
52 | menu->mark = unikey->config.oc; | |
53 | } | |
54 | ||
55 | boolean OCMenuAction(FcitxUIMenu *menu, int index) | |
56 | { | |
57 | FcitxUnikey* unikey = (FcitxUnikey*) menu->priv; | |
58 | unikey->config.oc =(UkConv) index; | |
59 | UpdateUnikeyConfig(unikey); | |
60 | return true; | |
61 | } | |
62 | ||
63 | static const char* GetIMIconName(void* arg) | |
64 | { | |
65 | return ""; | |
66 | } | |
67 | ||
68 | static const char* GetOCIconName(void* arg) | |
69 | { | |
70 | return ""; | |
71 | } | |
72 | ||
73 | void ToggleSpellCheck(void *arg) | |
74 | { | |
75 | FcitxUnikey* unikey = (FcitxUnikey*) arg; | |
76 | unikey->config.spellCheck = !unikey->config.spellCheck; | |
77 | UpdateUnikeyConfig(unikey); | |
78 | } | |
79 | ||
80 | boolean GetSpellCheck(void *arg) | |
81 | { | |
82 | FcitxUnikey* unikey = (FcitxUnikey*) arg; | |
83 | return unikey->config.spellCheck; | |
84 | } | |
85 | ||
86 | void ToggleMacro(void *arg) | |
87 | { | |
88 | FcitxUnikey* unikey = (FcitxUnikey*) arg; | |
89 | unikey->config.macro = !unikey->config.macro; | |
90 | UpdateUnikeyConfig(unikey); | |
91 | } | |
92 | ||
93 | boolean GetMacro(void *arg) | |
94 | { | |
95 | FcitxUnikey* unikey = (FcitxUnikey*) arg; | |
96 | return unikey->config.spellCheck; | |
97 | } | |
98 | ||
99 | void InitializeBar(FcitxUnikey* unikey) { | |
100 | FcitxInstance* instance = unikey->owner; | |
101 | FcitxUIRegisterComplexStatus(instance, unikey, | |
102 | "unikey-input-method", | |
103 | "", | |
104 | _("Choose input method"), | |
105 | NULL, | |
106 | GetIMIconName | |
107 | ); | |
108 | ||
109 | FcitxUIRegisterComplexStatus(instance, unikey, | |
110 | "unikey-output-charset", | |
111 | "", | |
112 | _("Choose output charset"), | |
113 | NULL, | |
114 | GetOCIconName | |
115 | ); | |
116 | FcitxUIRegisterStatus(instance, unikey, | |
117 | "unikey-spell-check", | |
118 | _("Spell Check"), | |
119 | _("Enable Spell Check"), | |
120 | ToggleSpellCheck, | |
121 | GetSpellCheck | |
122 | ); | |
123 | ||
124 | FcitxUIRegisterStatus(instance, unikey, | |
125 | "unikey-macro", | |
126 | _("Macro"), | |
127 | _("Enable Macro"), | |
128 | ToggleMacro, | |
129 | GetMacro | |
130 | ); | |
131 | FcitxUISetStatusVisable(instance, "unikey-input-method", false); | |
132 | FcitxUISetStatusVisable(instance, "unikey-output-charset", false); | |
133 | FcitxUISetStatusVisable(instance, "unikey-spell-check", false); | |
134 | FcitxUISetStatusVisable(instance, "unikey-macro", false); | |
135 | } | |
136 | ||
137 | void InitializeMenu(FcitxUnikey* unikey) { | |
138 | FcitxInstance* instance = unikey->owner; | |
139 | FcitxMenuInit(&unikey->imMenu); | |
140 | FcitxUIMenu* imMenu = &unikey->imMenu; | |
141 | imMenu->name = strdup(_("Unikey Input Method")); | |
142 | imMenu->candStatusBind = strdup("unikey-input-method"); | |
143 | imMenu->UpdateMenu = UpdateIMMenu; | |
144 | imMenu->MenuAction = IMMenuAction; | |
145 | imMenu->priv = unikey; | |
146 | imMenu->isSubMenu = false; | |
147 | int i; | |
148 | for (i = 0; i < NUM_INPUTMETHOD; i ++) | |
149 | FcitxMenuAddMenuItem(imMenu, _(Unikey_IMNames[i]), MENUTYPE_SIMPLE, NULL); | |
150 | ||
151 | FcitxUIRegisterMenu(instance, imMenu); | |
152 | ||
153 | FcitxMenuInit(&unikey->ocMenu); | |
154 | FcitxUIMenu* ocMenu = &unikey->ocMenu; | |
155 | ocMenu->name = strdup(_("Output Charset")); | |
156 | ocMenu->candStatusBind = strdup("unikey-output-charset"); | |
157 | ocMenu->UpdateMenu = UpdateOCMenu; | |
158 | ocMenu->MenuAction = OCMenuAction; | |
159 | ocMenu->priv = unikey; | |
160 | ocMenu->isSubMenu = false; | |
161 | for (i = 0; i < NUM_INPUTMETHOD; i ++) | |
162 | FcitxMenuAddMenuItem(ocMenu, _(Unikey_OCNames[i]), MENUTYPE_SIMPLE, NULL); | |
163 | FcitxUIRegisterMenu(instance, ocMenu); | |
164 | } | |
165 | ||
166 | void UpdateUnikeyUI(FcitxUnikey* unikey) | |
167 | { | |
168 | FcitxUISetStatusString(unikey->owner, | |
169 | "unikey-input-method", | |
170 | _(Unikey_IMNames[unikey->config.im]), | |
171 | _("Choose input method")); | |
172 | ||
173 | ||
174 | FcitxUISetStatusString(unikey->owner, | |
175 | "unikey-output-charset", | |
176 | _(Unikey_OCNames[unikey->config.oc]), | |
177 | _("Choose output charset")); | |
178 | ||
179 | FcitxUISetStatusString(unikey->owner, | |
180 | "unikey-spell-check", | |
181 | unikey->config.spellCheck? _("Spell Check"): _("N"), | |
182 | _("Enable Spell Check")); | |
183 | ||
184 | FcitxUISetStatusString(unikey->owner, | |
185 | "unikey-macro", | |
186 | unikey->config.macro? _("Macro"): _("N"), | |
187 | _("Enable Macro")); | |
188 | } |
0 | /*************************************************************************** | |
1 | * Copyright (C) 2012~2012 by CSSlayer * | |
2 | * wengxt@gmail.com * | |
3 | * * | |
4 | * This program is free software: you can redistribute it and/or modify * | |
5 | * it under the terms of the GNU General Public License as published by * | |
6 | * the Free Software Foundation, either version 3 of the License, or * | |
7 | * (at your option) any later version. * | |
8 | * * | |
9 | * This program is distributed in the hope that it will be useful, * | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | |
12 | * GNU General Public License for more details. * | |
13 | * * | |
14 | * You should have received a copy of the GNU General Public License * | |
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. * | |
16 | * * | |
17 | ***************************************************************************/ | |
18 | ||
19 | #ifndef UNIKEY_UI_H | |
20 | #define UNIKEY_UI_H | |
21 | #include "unikey-im.h" | |
22 | ||
23 | void InitializeBar(FcitxUnikey* unikey); | |
24 | void InitializeMenu(FcitxUnikey* unikey); | |
25 | void UpdateUnikeyUI(FcitxUnikey* unikey); | |
26 | ||
27 | #endif //UNIKEY_UI_H⏎ |
0 | GNU LIBRARY GENERAL PUBLIC LICENSE | |
1 | Version 2, June 1991 | |
2 | ||
3 | Copyright (C) 1991 Free Software Foundation, Inc. | |
4 | 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
5 | Everyone is permitted to copy and distribute verbatim copies | |
6 | of this license document, but changing it is not allowed. | |
7 | ||
8 | [This is the first released version of the library GPL. It is | |
9 | numbered 2 because it goes with version 2 of the ordinary GPL.] | |
10 | ||
11 | Preamble | |
12 | ||
13 | The licenses for most software are designed to take away your | |
14 | freedom to share and change it. By contrast, the GNU General Public | |
15 | Licenses are intended to guarantee your freedom to share and change | |
16 | free software--to make sure the software is free for all its users. | |
17 | ||
18 | This license, the Library General Public License, applies to some | |
19 | specially designated Free Software Foundation software, and to any | |
20 | other libraries whose authors decide to use it. You can use it for | |
21 | your libraries, too. | |
22 | ||
23 | When we speak of free software, we are referring to freedom, not | |
24 | price. Our General Public Licenses are designed to make sure that you | |
25 | have the freedom to distribute copies of free software (and charge for | |
26 | this service if you wish), that you receive source code or can get it | |
27 | if you want it, that you can change the software or use pieces of it | |
28 | in new free programs; and that you know you can do these things. | |
29 | ||
30 | To protect your rights, we need to make restrictions that forbid | |
31 | anyone to deny you these rights or to ask you to surrender the rights. | |
32 | These restrictions translate to certain responsibilities for you if | |
33 | you distribute copies of the library, or if you modify it. | |
34 | ||
35 | For example, if you distribute copies of the library, whether gratis | |
36 | or for a fee, you must give the recipients all the rights that we gave | |
37 | you. You must make sure that they, too, receive or can get the source | |
38 | code. If you link a program with the library, you must provide | |
39 | complete object files to the recipients so that they can relink them | |
40 | with the library, after making changes to the library and recompiling | |
41 | it. And you must show them these terms so they know their rights. | |
42 | ||
43 | Our method of protecting your rights has two steps: (1) copyright | |
44 | the library, and (2) offer you this license which gives you legal | |
45 | permission to copy, distribute and/or modify the library. | |
46 | ||
47 | Also, for each distributor's protection, we want to make certain | |
48 | that everyone understands that there is no warranty for this free | |
49 | library. If the library is modified by someone else and passed on, we | |
50 | want its recipients to know that what they have is not the original | |
51 | version, so that any problems introduced by others will not reflect on | |
52 | the original authors' reputations. | |
53 | ||
54 | Finally, any free program is threatened constantly by software | |
55 | patents. We wish to avoid the danger that companies distributing free | |
56 | software will individually obtain patent licenses, thus in effect | |
57 | transforming the program into proprietary software. To prevent this, | |
58 | we have made it clear that any patent must be licensed for everyone's | |
59 | free use or not licensed at all. | |
60 | ||
61 | Most GNU software, including some libraries, is covered by the ordinary | |
62 | GNU General Public License, which was designed for utility programs. This | |
63 | license, the GNU Library General Public License, applies to certain | |
64 | designated libraries. This license is quite different from the ordinary | |
65 | one; be sure to read it in full, and don't assume that anything in it is | |
66 | the same as in the ordinary license. | |
67 | ||
68 | The reason we have a separate public license for some libraries is that | |
69 | they blur the distinction we usually make between modifying or adding to a | |
70 | program and simply using it. Linking a program with a library, without | |
71 | changing the library, is in some sense simply using the library, and is | |
72 | analogous to running a utility program or application program. However, in | |
73 | a textual and legal sense, the linked executable is a combined work, a | |
74 | derivative of the original library, and the ordinary General Public License | |
75 | treats it as such. | |
76 | ||
77 | Because of this blurred distinction, using the ordinary General | |
78 | Public License for libraries did not effectively promote software | |
79 | sharing, because most developers did not use the libraries. We | |
80 | concluded that weaker conditions might promote sharing better. | |
81 | ||
82 | However, unrestricted linking of non-free programs would deprive the | |
83 | users of those programs of all benefit from the free status of the | |
84 | libraries themselves. This Library General Public License is intended to | |
85 | permit developers of non-free programs to use free libraries, while | |
86 | preserving your freedom as a user of such programs to change the free | |
87 | libraries that are incorporated in them. (We have not seen how to achieve | |
88 | this as regards changes in header files, but we have achieved it as regards | |
89 | changes in the actual functions of the Library.) The hope is that this | |
90 | will lead to faster development of free libraries. | |
91 | ||
92 | The precise terms and conditions for copying, distribution and | |
93 | modification follow. Pay close attention to the difference between a | |
94 | "work based on the library" and a "work that uses the library". The | |
95 | former contains code derived from the library, while the latter only | |
96 | works together with the library. | |
97 | ||
98 | Note that it is possible for a library to be covered by the ordinary | |
99 | General Public License rather than by this special one. | |
100 | ||
101 | GNU LIBRARY GENERAL PUBLIC LICENSE | |
102 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION | |
103 | ||
104 | 0. This License Agreement applies to any software library which | |
105 | contains a notice placed by the copyright holder or other authorized | |
106 | party saying it may be distributed under the terms of this Library | |
107 | General Public License (also called "this License"). Each licensee is | |
108 | addressed as "you". | |
109 | ||
110 | A "library" means a collection of software functions and/or data | |
111 | prepared so as to be conveniently linked with application programs | |
112 | (which use some of those functions and data) to form executables. | |
113 | ||
114 | The "Library", below, refers to any such software library or work | |
115 | which has been distributed under these terms. A "work based on the | |
116 | Library" means either the Library or any derivative work under | |
117 | copyright law: that is to say, a work containing the Library or a | |
118 | portion of it, either verbatim or with modifications and/or translated | |
119 | straightforwardly into another language. (Hereinafter, translation is | |
120 | included without limitation in the term "modification".) | |
121 | ||
122 | "Source code" for a work means the preferred form of the work for | |
123 | making modifications to it. For a library, complete source code means | |
124 | all the source code for all modules it contains, plus any associated | |
125 | interface definition files, plus the scripts used to control compilation | |
126 | and installation of the library. | |
127 | ||
128 | Activities other than copying, distribution and modification are not | |
129 | covered by this License; they are outside its scope. The act of | |
130 | running a program using the Library is not restricted, and output from | |
131 | such a program is covered only if its contents constitute a work based | |
132 | on the Library (independent of the use of the Library in a tool for | |
133 | writing it). Whether that is true depends on what the Library does | |
134 | and what the program that uses the Library does. | |
135 | ||
136 | 1. You may copy and distribute verbatim copies of the Library's | |
137 | complete source code as you receive it, in any medium, provided that | |
138 | you conspicuously and appropriately publish on each copy an | |
139 | appropriate copyright notice and disclaimer of warranty; keep intact | |
140 | all the notices that refer to this License and to the absence of any | |
141 | warranty; and distribute a copy of this License along with the | |
142 | Library. | |
143 | ||
144 | You may charge a fee for the physical act of transferring a copy, | |
145 | and you may at your option offer warranty protection in exchange for a | |
146 | fee. | |
147 | ||
148 | 2. You may modify your copy or copies of the Library or any portion | |
149 | of it, thus forming a work based on the Library, and copy and | |
150 | distribute such modifications or work under the terms of Section 1 | |
151 | above, provided that you also meet all of these conditions: | |
152 | ||
153 | a) The modified work must itself be a software library. | |
154 | ||
155 | b) You must cause the files modified to carry prominent notices | |
156 | stating that you changed the files and the date of any change. | |
157 | ||
158 | c) You must cause the whole of the work to be licensed at no | |
159 | charge to all third parties under the terms of this License. | |
160 | ||
161 | d) If a facility in the modified Library refers to a function or a | |
162 | table of data to be supplied by an application program that uses | |
163 | the facility, other than as an argument passed when the facility | |
164 | is invoked, then you must make a good faith effort to ensure that, | |
165 | in the event an application does not supply such function or | |
166 | table, the facility still operates, and performs whatever part of | |
167 | its purpose remains meaningful. | |
168 | ||
169 | (For example, a function in a library to compute square roots has | |
170 | a purpose that is entirely well-defined independent of the | |
171 | application. Therefore, Subsection 2d requires that any | |
172 | application-supplied function or table used by this function must | |
173 | be optional: if the application does not supply it, the square | |
174 | root function must still compute square roots.) | |
175 | ||
176 | These requirements apply to the modified work as a whole. If | |
177 | identifiable sections of that work are not derived from the Library, | |
178 | and can be reasonably considered independent and separate works in | |
179 | themselves, then this License, and its terms, do not apply to those | |
180 | sections when you distribute them as separate works. But when you | |
181 | distribute the same sections as part of a whole which is a work based | |
182 | on the Library, the distribution of the whole must be on the terms of | |
183 | this License, whose permissions for other licensees extend to the | |
184 | entire whole, and thus to each and every part regardless of who wrote | |
185 | it. | |
186 | ||
187 | Thus, it is not the intent of this section to claim rights or contest | |
188 | your rights to work written entirely by you; rather, the intent is to | |
189 | exercise the right to control the distribution of derivative or | |
190 | collective works based on the Library. | |
191 | ||
192 | In addition, mere aggregation of another work not based on the Library | |
193 | with the Library (or with a work based on the Library) on a volume of | |
194 | a storage or distribution medium does not bring the other work under | |
195 | the scope of this License. | |
196 | ||
197 | 3. You may opt to apply the terms of the ordinary GNU General Public | |
198 | License instead of this License to a given copy of the Library. To do | |
199 | this, you must alter all the notices that refer to this License, so | |
200 | that they refer to the ordinary GNU General Public License, version 2, | |
201 | instead of to this License. (If a newer version than version 2 of the | |
202 | ordinary GNU General Public License has appeared, then you can specify | |
203 | that version instead if you wish.) Do not make any other change in | |
204 | these notices. | |
205 | ||
206 | Once this change is made in a given copy, it is irreversible for | |
207 | that copy, so the ordinary GNU General Public License applies to all | |
208 | subsequent copies and derivative works made from that copy. | |
209 | ||
210 | This option is useful when you wish to copy part of the code of | |
211 | the Library into a program that is not a library. | |
212 | ||
213 | 4. You may copy and distribute the Library (or a portion or | |
214 | derivative of it, under Section 2) in object code or executable form | |
215 | under the terms of Sections 1 and 2 above provided that you accompany | |
216 | it with the complete corresponding machine-readable source code, which | |
217 | must be distributed under the terms of Sections 1 and 2 above on a | |
218 | medium customarily used for software interchange. | |
219 | ||
220 | If distribution of object code is made by offering access to copy | |
221 | from a designated place, then offering equivalent access to copy the | |
222 | source code from the same place satisfies the requirement to | |
223 | distribute the source code, even though third parties are not | |
224 | compelled to copy the source along with the object code. | |
225 | ||
226 | 5. A program that contains no derivative of any portion of the | |
227 | Library, but is designed to work with the Library by being compiled or | |
228 | linked with it, is called a "work that uses the Library". Such a | |
229 | work, in isolation, is not a derivative work of the Library, and | |
230 | therefore falls outside the scope of this License. | |
231 | ||
232 | However, linking a "work that uses the Library" with the Library | |
233 | creates an executable that is a derivative of the Library (because it | |
234 | contains portions of the Library), rather than a "work that uses the | |
235 | library". The executable is therefore covered by this License. | |
236 | Section 6 states terms for distribution of such executables. | |
237 | ||
238 | When a "work that uses the Library" uses material from a header file | |
239 | that is part of the Library, the object code for the work may be a | |
240 | derivative work of the Library even though the source code is not. | |
241 | Whether this is true is especially significant if the work can be | |
242 | linked without the Library, or if the work is itself a library. The | |
243 | threshold for this to be true is not precisely defined by law. | |
244 | ||
245 | If such an object file uses only numerical parameters, data | |
246 | structure layouts and accessors, and small macros and small inline | |
247 | functions (ten lines or less in length), then the use of the object | |
248 | file is unrestricted, regardless of whether it is legally a derivative | |
249 | work. (Executables containing this object code plus portions of the | |
250 | Library will still fall under Section 6.) | |
251 | ||
252 | Otherwise, if the work is a derivative of the Library, you may | |
253 | distribute the object code for the work under the terms of Section 6. | |
254 | Any executables containing that work also fall under Section 6, | |
255 | whether or not they are linked directly with the Library itself. | |
256 | ||
257 | 6. As an exception to the Sections above, you may also compile or | |
258 | link a "work that uses the Library" with the Library to produce a | |
259 | work containing portions of the Library, and distribute that work | |
260 | under terms of your choice, provided that the terms permit | |
261 | modification of the work for the customer's own use and reverse | |
262 | engineering for debugging such modifications. | |
263 | ||
264 | You must give prominent notice with each copy of the work that the | |
265 | Library is used in it and that the Library and its use are covered by | |
266 | this License. You must supply a copy of this License. If the work | |
267 | during execution displays copyright notices, you must include the | |
268 | copyright notice for the Library among them, as well as a reference | |
269 | directing the user to the copy of this License. Also, you must do one | |
270 | of these things: | |
271 | ||
272 | a) Accompany the work with the complete corresponding | |
273 | machine-readable source code for the Library including whatever | |
274 | changes were used in the work (which must be distributed under | |
275 | Sections 1 and 2 above); and, if the work is an executable linked | |
276 | with the Library, with the complete machine-readable "work that | |
277 | uses the Library", as object code and/or source code, so that the | |
278 | user can modify the Library and then relink to produce a modified | |
279 | executable containing the modified Library. (It is understood | |
280 | that the user who changes the contents of definitions files in the | |
281 | Library will not necessarily be able to recompile the application | |
282 | to use the modified definitions.) | |
283 | ||
284 | b) Accompany the work with a written offer, valid for at | |
285 | least three years, to give the same user the materials | |
286 | specified in Subsection 6a, above, for a charge no more | |
287 | than the cost of performing this distribution. | |
288 | ||
289 | c) If distribution of the work is made by offering access to copy | |
290 | from a designated place, offer equivalent access to copy the above | |
291 | specified materials from the same place. | |
292 | ||
293 | d) Verify that the user has already received a copy of these | |
294 | materials or that you have already sent this user a copy. | |
295 | ||
296 | For an executable, the required form of the "work that uses the | |
297 | Library" must include any data and utility programs needed for | |
298 | reproducing the executable from it. However, as a special exception, | |
299 | the source code distributed need not include anything that is normally | |
300 | distributed (in either source or binary form) with the major | |
301 | components (compiler, kernel, and so on) of the operating system on | |
302 | which the executable runs, unless that component itself accompanies | |
303 | the executable. | |
304 | ||
305 | It may happen that this requirement contradicts the license | |
306 | restrictions of other proprietary libraries that do not normally | |
307 | accompany the operating system. Such a contradiction means you cannot | |
308 | use both them and the Library together in an executable that you | |
309 | distribute. | |
310 | ||
311 | 7. You may place library facilities that are a work based on the | |
312 | Library side-by-side in a single library together with other library | |
313 | facilities not covered by this License, and distribute such a combined | |
314 | library, provided that the separate distribution of the work based on | |
315 | the Library and of the other library facilities is otherwise | |
316 | permitted, and provided that you do these two things: | |
317 | ||
318 | a) Accompany the combined library with a copy of the same work | |
319 | based on the Library, uncombined with any other library | |
320 | facilities. This must be distributed under the terms of the | |
321 | Sections above. | |
322 | ||
323 | b) Give prominent notice with the combined library of the fact | |
324 | that part of it is a work based on the Library, and explaining | |
325 | where to find the accompanying uncombined form of the same work. | |
326 | ||
327 | 8. You may not copy, modify, sublicense, link with, or distribute | |
328 | the Library except as expressly provided under this License. Any | |
329 | attempt otherwise to copy, modify, sublicense, link with, or | |
330 | distribute the Library is void, and will automatically terminate your | |
331 | rights under this License. However, parties who have received copies, | |
332 | or rights, from you under this License will not have their licenses | |
333 | terminated so long as such parties remain in full compliance. | |
334 | ||
335 | 9. You are not required to accept this License, since you have not | |
336 | signed it. However, nothing else grants you permission to modify or | |
337 | distribute the Library or its derivative works. These actions are | |
338 | prohibited by law if you do not accept this License. Therefore, by | |
339 | modifying or distributing the Library (or any work based on the | |
340 | Library), you indicate your acceptance of this License to do so, and | |
341 | all its terms and conditions for copying, distributing or modifying | |
342 | the Library or works based on it. | |
343 | ||
344 | 10. Each time you redistribute the Library (or any work based on the | |
345 | Library), the recipient automatically receives a license from the | |
346 | original licensor to copy, distribute, link with or modify the Library | |
347 | subject to these terms and conditions. You may not impose any further | |
348 | restrictions on the recipients' exercise of the rights granted herein. | |
349 | You are not responsible for enforcing compliance by third parties to | |
350 | this License. | |
351 | ||
352 | 11. If, as a consequence of a court judgment or allegation of patent | |
353 | infringement or for any other reason (not limited to patent issues), | |
354 | conditions are imposed on you (whether by court order, agreement or | |
355 | otherwise) that contradict the conditions of this License, they do not | |
356 | excuse you from the conditions of this License. If you cannot | |
357 | distribute so as to satisfy simultaneously your obligations under this | |
358 | License and any other pertinent obligations, then as a consequence you | |
359 | may not distribute the Library at all. For example, if a patent | |
360 | license would not permit royalty-free redistribution of the Library by | |
361 | all those who receive copies directly or indirectly through you, then | |
362 | the only way you could satisfy both it and this License would be to | |
363 | refrain entirely from distribution of the Library. | |
364 | ||
365 | If any portion of this section is held invalid or unenforceable under any | |
366 | particular circumstance, the balance of the section is intended to apply, | |
367 | and the section as a whole is intended to apply in other circumstances. | |
368 | ||
369 | It is not the purpose of this section to induce you to infringe any | |
370 | patents or other property right claims or to contest validity of any | |
371 | such claims; this section has the sole purpose of protecting the | |
372 | integrity of the free software distribution system which is | |
373 | implemented by public license practices. Many people have made | |
374 | generous contributions to the wide range of software distributed | |
375 | through that system in reliance on consistent application of that | |
376 | system; it is up to the author/donor to decide if he or she is willing | |
377 | to distribute software through any other system and a licensee cannot | |
378 | impose that choice. | |
379 | ||
380 | This section is intended to make thoroughly clear what is believed to | |
381 | be a consequence of the rest of this License. | |
382 | ||
383 | 12. If the distribution and/or use of the Library is restricted in | |
384 | certain countries either by patents or by copyrighted interfaces, the | |
385 | original copyright holder who places the Library under this License may add | |
386 | an explicit geographical distribution limitation excluding those countries, | |
387 | so that distribution is permitted only in or among countries not thus | |
388 | excluded. In such case, this License incorporates the limitation as if | |
389 | written in the body of this License. | |
390 | ||
391 | 13. The Free Software Foundation may publish revised and/or new | |
392 | versions of the Library General Public License from time to time. | |
393 | Such new versions will be similar in spirit to the present version, | |
394 | but may differ in detail to address new problems or concerns. | |
395 | ||
396 | Each version is given a distinguishing version number. If the Library | |
397 | specifies a version number of this License which applies to it and | |
398 | "any later version", you have the option of following the terms and | |
399 | conditions either of that version or of any later version published by | |
400 | the Free Software Foundation. If the Library does not specify a | |
401 | license version number, you may choose any version ever published by | |
402 | the Free Software Foundation. | |
403 | ||
404 | 14. If you wish to incorporate parts of the Library into other free | |
405 | programs whose distribution conditions are incompatible with these, | |
406 | write to the author to ask for permission. For software which is | |
407 | copyrighted by the Free Software Foundation, write to the Free | |
408 | Software Foundation; we sometimes make exceptions for this. Our | |
409 | decision will be guided by the two goals of preserving the free status | |
410 | of all derivatives of our free software and of promoting the sharing | |
411 | and reuse of software generally. | |
412 | ||
413 | NO WARRANTY | |
414 | ||
415 | 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO | |
416 | WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. | |
417 | EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR | |
418 | OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY | |
419 | KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE | |
420 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
421 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE | |
422 | LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME | |
423 | THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. | |
424 | ||
425 | 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN | |
426 | WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY | |
427 | AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU | |
428 | FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR | |
429 | CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE | |
430 | LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING | |
431 | RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A | |
432 | FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF | |
433 | SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH | |
434 | DAMAGES. | |
435 | ||
436 | END OF TERMS AND CONDITIONS | |
437 | ||
438 | How to Apply These Terms to Your New Libraries | |
439 | ||
440 | If you develop a new library, and you want it to be of the greatest | |
441 | possible use to the public, we recommend making it free software that | |
442 | everyone can redistribute and change. You can do so by permitting | |
443 | redistribution under these terms (or, alternatively, under the terms of the | |
444 | ordinary General Public License). | |
445 | ||
446 | To apply these terms, attach the following notices to the library. It is | |
447 | safest to attach them to the start of each source file to most effectively | |
448 | convey the exclusion of warranty; and each file should have at least the | |
449 | "copyright" line and a pointer to where the full notice is found. | |
450 | ||
451 | <one line to give the library's name and a brief idea of what it does.> | |
452 | Copyright (C) <year> <name of author> | |
453 | ||
454 | This library is free software; you can redistribute it and/or | |
455 | modify it under the terms of the GNU Library General Public | |
456 | License as published by the Free Software Foundation; either | |
457 | version 2 of the License, or (at your option) any later version. | |
458 | ||
459 | This library is distributed in the hope that it will be useful, | |
460 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
461 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
462 | Library General Public License for more details. | |
463 | ||
464 | You should have received a copy of the GNU Library General Public | |
465 | License along with this library; if not, write to the | |
466 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
467 | Boston, MA 02111-1307 USA. | |
468 | ||
469 | Also add information on how to contact you by electronic and paper mail. | |
470 | ||
471 | You should also get your employer (if you work as a programmer) or your | |
472 | school, if any, to sign a "copyright disclaimer" for the library, if | |
473 | necessary. Here is a sample; alter the names: | |
474 | ||
475 | Yoyodyne, Inc., hereby disclaims all copyright interest in the | |
476 | library `Frob' (a library for tweaking knobs) written by James Random Hacker. | |
477 | ||
478 | <signature of Ty Coon>, 1 April 1990 | |
479 | Ty Coon, President of Vice | |
480 | ||
481 | That's all there is to it! |
0 | This folder contains ukengine (with changes | |
1 | for better use in my project) taking from project | |
2 | x-unikey (http://www.unikey.org). | |
3 | ||
4 | Read COPYING for License of ukengine. | |
5 |
0 | // -*- coding:unix; mode:c++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- | |
1 | #include <string.h> | |
2 | #include "byteio.h" | |
3 | ||
4 | //------------------------------------------------ | |
5 | StringBIStream::StringBIStream(UKBYTE *data, int len, int elementSize) | |
6 | { | |
7 | m_data = m_current = data; | |
8 | m_len = m_left = len; | |
9 | if (len == -1) { | |
10 | if (elementSize == 2) | |
11 | m_eos = (*(UKWORD *)data == 0); | |
12 | else if (elementSize == 4) | |
13 | m_eos = (*(UKDWORD *)data == 4); | |
14 | else | |
15 | m_eos = (*data == 0); | |
16 | } | |
17 | else | |
18 | m_eos = (len <= 0); | |
19 | m_didBookmark = 0; | |
20 | } | |
21 | ||
22 | //------------------------------------------------ | |
23 | int StringBIStream::eos() | |
24 | { | |
25 | return m_eos; | |
26 | } | |
27 | ||
28 | //------------------------------------------------ | |
29 | int StringBIStream::getNext(UKBYTE & b) | |
30 | { | |
31 | if (m_eos) | |
32 | return 0; | |
33 | b = *m_current++; | |
34 | if (m_len == -1) { | |
35 | m_eos = (b == 0); | |
36 | } | |
37 | else { | |
38 | m_left--; | |
39 | m_eos = (m_left <= 0); | |
40 | } | |
41 | return 1; | |
42 | } | |
43 | ||
44 | //------------------------------------------------ | |
45 | int StringBIStream::unget(UKBYTE b) | |
46 | { | |
47 | if (m_current != m_data) { | |
48 | *--m_current = b; | |
49 | m_eos = 0; | |
50 | if (m_len != -1) | |
51 | m_left++; | |
52 | } | |
53 | return 1; | |
54 | } | |
55 | ||
56 | //------------------------------------------------ | |
57 | int StringBIStream::getNextW(UKWORD & w) | |
58 | { | |
59 | if (m_eos) return 0; | |
60 | w = *((UKWORD *)m_current); | |
61 | m_current += 2; | |
62 | if (m_len == -1) | |
63 | m_eos = (w == 0); | |
64 | else { | |
65 | m_left -= 2; | |
66 | m_eos = (m_left <= 0); | |
67 | } | |
68 | return 1; | |
69 | } | |
70 | ||
71 | //------------------------------------------------ | |
72 | int StringBIStream::getNextDW(UKDWORD & dw) | |
73 | { | |
74 | if (m_eos) return 0; | |
75 | ||
76 | dw = *((UKDWORD *)m_current); | |
77 | m_current += 4; | |
78 | if (m_len == -1) | |
79 | m_eos = (dw == 0); | |
80 | else { | |
81 | m_left -= 4; | |
82 | m_eos = (m_left <= 0); | |
83 | } | |
84 | return 1; | |
85 | } | |
86 | ||
87 | //------------------------------------------------ | |
88 | int StringBIStream::peekNext(UKBYTE & b) | |
89 | { | |
90 | if (m_eos) | |
91 | return 0; | |
92 | b = *m_current; | |
93 | return 1; | |
94 | } | |
95 | ||
96 | //------------------------------------------------ | |
97 | int StringBIStream::peekNextW(UKWORD & w) | |
98 | { | |
99 | if (m_eos) | |
100 | return 0; | |
101 | w = *((UKWORD *)m_current); | |
102 | return 1; | |
103 | } | |
104 | ||
105 | /* | |
106 | //------------------------------------------------ | |
107 | int StringBIStream::peekNextDW(UKDWORD & dw) | |
108 | { | |
109 | if (m_eos) | |
110 | return 0; | |
111 | dw = *((UKDWORD *)m_current); | |
112 | return 1; | |
113 | } | |
114 | */ | |
115 | ||
116 | //------------------------------------------------ | |
117 | void StringBIStream::reopen() | |
118 | { | |
119 | m_current = m_data; | |
120 | m_left = m_len; | |
121 | if (m_len == -1) | |
122 | m_eos = (m_data == 0); | |
123 | else | |
124 | m_eos = (m_len <= 0); | |
125 | m_didBookmark = 0; | |
126 | } | |
127 | ||
128 | //------------------------------------------------ | |
129 | int StringBIStream::bookmark() | |
130 | { | |
131 | m_didBookmark = 1; | |
132 | m_bookmark.current = m_current; | |
133 | m_bookmark.data = m_data; | |
134 | m_bookmark.eos = m_eos; | |
135 | m_bookmark.left = m_left; | |
136 | m_bookmark.len = m_len; | |
137 | return 1; | |
138 | } | |
139 | ||
140 | //------------------------------------------------ | |
141 | int StringBIStream::gotoBookmark() | |
142 | { | |
143 | if (!m_didBookmark) | |
144 | return 0; | |
145 | m_current = m_bookmark.current; | |
146 | m_data = m_bookmark.data; | |
147 | m_eos = m_bookmark.eos; | |
148 | m_left = m_bookmark.left; | |
149 | m_len = m_bookmark.len; | |
150 | return 1; | |
151 | } | |
152 | ||
153 | //------------------------------------------------ | |
154 | int StringBIStream::close() | |
155 | { | |
156 | return 1; | |
157 | }; | |
158 | ||
159 | ////////////////////////////////////////////////// | |
160 | // Class StringBOStream | |
161 | ////////////////////////////////////////////////// | |
162 | ||
163 | //------------------------------------------------ | |
164 | StringBOStream::StringBOStream(UKBYTE *buf, int len) | |
165 | { | |
166 | m_current = m_buf = buf; | |
167 | m_len = len; | |
168 | m_out = 0; | |
169 | m_bad = 0; | |
170 | } | |
171 | ||
172 | //------------------------------------------------ | |
173 | int StringBOStream::putB(UKBYTE b) | |
174 | { | |
175 |