pax_global_header00006660000000000000000000000064147541471200014517gustar00rootroot0000000000000052 comment=697ffe27eed1af2960ce630f3981604fede0a3e5 kasumi-2.5+debian2/000077500000000000000000000000001475414712000141565ustar00rootroot00000000000000kasumi-2.5+debian2/.gitignore000066400000000000000000000000571475414712000161500ustar00rootroot00000000000000/Makefile /kasumi /kasumi.desktop /po/Makefile kasumi-2.5+debian2/AUTHORS000066400000000000000000000006441475414712000152320ustar00rootroot00000000000000Creator: Takashi Nakamoto Developer team: Takashi Nakamoto Takuro Ashie Ikuya Awashiro Japanese localization team: Takashi Nakamoto Italian localization team: Diego 'Flameeyes' Pettenò Contributors: Diego 'Flameeyes' Pettenò kasumi-2.5+debian2/COPYING000066400000000000000000000431311475414712000152130ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. kasumi-2.5+debian2/ChangeLog000066400000000000000000000343011475414712000157310ustar00rootroot000000000000002023-10-28 Boyuan Yang * Incorporate Debian patches: - 0001-validate_kasumi.desktop.patch - 0003-cope-with-the-upstream-version-string-of-Debian-fork.patch - 0004-Fix-the-missing-descriptions-in-manpage.patch * po/ja.po: Convert encoding from EUC-JP to UTF-8. * configure.ac: Refreshed using autoupdate. * Prepare release 2.5+debian1. 2015-08-26 Marc-Antoine Perennou * Migrate to GTK3: - (see fork https://github.com/Keruspe/kasumi) 2009-07-29 Takuro Ashie * preparation for release (ver 2.5) 2009-07-21 Takuro Ashie * fix: - Fix paddings in the KasumiAddWindow. 2009-07-16 Takuro Ashie * fix: - Use stock objects for buttons on KasumiAddWindow. - Remove neeldless key accelerators for KasumiAddWindow. 2009-07-16 Takuro Ashie * fix: - Fix paddings in the main window. - Fix minimum size of columns in the word list view. - Remove needless key accelerators in main window. Use mnemonic instead. - Remove some needless codes. 2009-07-13 Takuro Ashie * fix: - Fix a compile time warning. - Rename some strang variable names. 2009-07-13 Takuro Ashie * enhancement: - Added some word type subcategories. Thanks to Jun Oizumi. 2009-06-25 Takuro Ashie * fix - Kill duplicated Ikuya Awashiro in man page! Thanks to Jun Oizumi. 2009-06-25 Takuro Ashie * fix - Remove "SIKU" conjugation. Thanks to Jun Oizumi. 2009-01-29 Takuro Ashie * preparation for release (ver 2.4) 2009-01-20 Ikuya Awashiro * KasumiAddWindow.cxx: - addded an include file. Thanks to Mike Fabian. * KasumiWord.cxx: - DITTO. * main.cxx: - DITTO. 2009-01-20 Takuro Ashie * enhancement: - Support ANTHY_UTF8_ENCODING and set it as default. You can switch to ANTHY_EUC_JP_ENCODING by -E or --eucjp option. 2007-10-30 Ikuya Awashiro * fix: - FTBFS with GCC 4.3: missing #includes http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=417266 Thaks to Martin Michlmayr . - kasumi dumps core on x86_64 systems when trying to add new words to the dictionary https://bugzilla.novell.com/show_bug.cgi?id=253788 Thanks to Mike Fabian. - fail in the judgment of the version. http://kasumi.sourceforge.jp/index.php?%A5%D0%A5%B0%CA%F3%B9%F0%2F95 Thanks to dtana. * preparation for release (ver 2.3) 2006-11-29 Takashi Nakamoto * preparation for release (ver 2.2) 2006-11-28 Takashi Nakamoto * enhancement: - change the text color on the search entry box if Kasumi failed to find specified text - ask Gtk+ library to keep above the exclusive mode window * fix: - scroll to the undermost of the view after adding a new word 2006-11-27 Takashi Nakamoto * fix: - the bug raised while sorting 2006-10-15 Takashi Nakamoto * enhancement: - add exclusive mode 2006-10-14 Ikuya Awashiro * configure.in: 2.1 * This release is a result at the CodeFest Kyoto 2006 hosted by FSIJ. 2006-10-14 Takashi Nakamoto * enhancement: - add new word type category combo box * fix: - export embedded string to po files - changed adding window title - remove unnecessary words - improve portability - support dakuon mark 2006-06-28 Takashi Nakamoto * fix: AUTHORS - reconstruction of AUTHORS file - added Italian l10n team 2006-06-26 Takashi Nakamoto * fix: KasumiException.cxx - security fix * fix: KasumiDicEventListener.hxx KasumiWordEventListener.hxx - add virtual destructor to avoid compilation warnings * fix: configure.in main.cxx Makefile.am acconfig.h - removed acconfig.h deprecated in autoconf 2.5 - correctly handling "--disable-nls" option on no-glibc platform - thanks to Diego's patch * fix: AUTHORS - typo of my email address :( 2006-06-25 Takashi Nakamoto * fix: KasumiAddWindow.cxx po/*.po po/*.pot - fixed typo: "Invlid" -> "Invalid" * New feature: - Italian localization 2006-06-23 Ikuya Awashiro * KasumiMainWindow.hxx: - fixed compile error on gcc 4.1. thanks to sgtom. 2006-06-21 Takashi Nakamoto * fix: configure.in - require Gtk+ version is 2.6 or higher for GtkCellRendererCombo 2006-06-20 Takashi Nakamoto * fix: KasumiDic.cxx - fix the defect that Kasumi failes when the private dictionary doesn't have any word. 2006-06-03 Ikuya Awashiro * kasumi.desktop.in: - added. * Makefile.am, configure.in: - resistered in GNOME/K menu. 2006-06-02 Ikuya Awashiro * Makefile.am: - kasumi.png was placed in /usr/share/pixmaps instead /usr/share/kasumi. - add man page. * kasumi.1: - added. 2006-05-29 Takashi Nakamoto * preparation for release (ver 2.0) * fix: KasumiWord.cxx, configure.in - accept ASCII character in sound entries * fix: AUTHORS - add Ikuya to AUTHORS * fix: POTFILES.in ja.po - translated newly created message * enhancement: KasumiMainWindow.cxx KasumiMainWindow.hxx - obsolete "Add Mode" button 2006-05-28 Takashi Nakamoto * fix: main.cxx - changed copyright notice * fix: KasumiWordType.hxx, KasumiWord.cxx - don't issue modification event when the same value are set 2006-05-27 Takashi Nakamoto * fix: KasumiDic.cxx, KasumiWordType.cxx - set an alternative word type if specified one does not exist - measures against an anthy's defect that it returns error code even when it is right and no word is registered. * fix: - inserted copyright and license terms into the head of each source file or header file. * fix: KasumiAddWindow.cxx - changed the page size of the spin button 2006-05-17 Takashi Nakamoto * fix: KasumiDic.cxx - change the condition of anthy version 2006-05-14 Takashi Nakamoto * fix - KasumiAddWindow - search function for KasumiMainWindow * enhancement - implement of KasumiWordEventListener 2006-05-7 Takashi Nakamoto * drastic changes for new version 2.0 2006-03-26 Ikuya Awashiro * KasumiMainWindow.hxx, KasumiAddWindow.hxx: Fixed with G++ 4.1: friends not declared Thanks to Martin Michlmayr 2005-12-06 Takashi Nakamoto * preparation for release (ver 1.0) * fix - rearrangement of some manuals 2005-12-01 Takashi Nakamoto * enhancement - Output notification when duplicated process was found. 2005-11-30 Takuro Ashie * enhancement - Check duplicated process. 2005-11-22 Takashi Nakamoto * obolete - DefaultWindowPosX and DefaultWindowPosY option 2005-11-08 Takashi Nakamoto * fix (KasumiString.cxx) - load words including "=" properly 2005-10-15 Takuro Ashie * KasumiMainWindow.cxx, KasumiAddWindow.cxx: Set default window position to GTK_WIN_POS_MOUSE. If you feel unpleasant, please revert it. 2005-10-15 Takashi Nakamoto * fix - request >=gtk2.4.0 for GTK_COMBO_BOX 2005-09-19 Takashi Nakamoto * preparation for release (ver 0.10) 2005-09-07 Takashi Nakamoto * fix - No save, when add a new word in adding mode 2005-09-05 Takashi Nakamoto * enhancement - tooltips for adding window - obsolete KasumiOutOfBoundException - make columns resizable 2005-09-01 Takashi Nakamoto * fix - changed exception handling system * fix (in KasumiAddWindow.cxx) - wrong string for verb option 2005-08-29 Takashi Nakamoto * enhancement - make adding mode buttons not to display string for neat appearance * enhancement - sort function for word class * enhancement - sort function for sound * enhancement make typical buttons to use stock 2005-08-23 Takashi Nakamoto * feature - sort function ( Just supporting sorting by frequency only because it is still experiment. ) * enhancement - a new option to ignore X selection thanks to nubata http://kasumi.sourceforge.jp/index.php?%A5%D0%A5%B0%CA%F3%B9%F0%2F50 2005-06-02 Takashi Nakamoto * fix (in KasumiString.cxx) - avoid comparison with unsigned int value and "npos" ("npos" can be negative value 2005-05-27 Takashi Nakamoto * preparation for release (ver 0.9) * fix - verb can be registered only with anthy 6131 or later 2005-05-23 Takashi Nakamoto * fix - changed behavior when changing a word class in adding mode not to jump to unconcerned position * enhancement - Verb registration support 2005-05-18 Takashi Nakamoto * enhancement - save dictionary when "Add" button clicked in "Adding" mode * fix - typo: "versoin" -> "version" - type definition "size_type" -> "string::size_type" - for http://kasumi.sourceforge.jp/index?%A5%D0%A5%B0%CA%F3%B9%F0%2F45 thanks to pinkmonkey http://d.hatena.ne.jp/pinkmonkey/20050411 2005-04-11 Takashi Nakamoto * fix - avoid comparison with unsigned int value and "npos" ("npos" can be negative value) 2005-04-08 Takashi Nakamoto * fix - make the button in adding window smaller * preparation for release (ver 0.8) 2005-04-07 Takashi Nakamoto * fix - trivial change for no-warning compilation 2005-04-06 Takashi Nakamoto * New feature - When Kasumi is launched in adding mode, the selected utf8 string will be set in the spelling entry * fix - to enable "--version" and "--help" option 2005-04-04 Takashi Nakamoto * fix - updated automake version from 1.4 to 1.7.9 - updated autoconf version from 2.13 to 2.59 2005-04-02 Takashi Nakamoto * fix - revise UI for adding new word 2005-03-02 Takashi Nakamoto * New feature - A new icon for Kasumi (kasumi.png) It will be installed in /usr/local/share/kasumi/ by default * fix - launch correctly unless ~/.anthy directory exists 2005-03-01 Takashi Nakamoto * fix - typo * fix - solved inability to change mode * fix - change the type of 'i' to be compared with 'npos' from unsigned int to (signed) int because npos can be negative value in x86_64 machine. 2005-01-31 Takashi Nakamoto * fix - quit correctly when close button clicked 2005-01-08 Takashi Nakamoto * fix - do not accept non-Hiragana character in Sound entry 2005-01-07 Takashi Nakamoto * New feature - mode switch 2005-01-06 Takashi Nakamoto * fix - validate method for configurations 2004-12-30 Takashi Nakamoto * preparation for release (ver 0.7) 2004-12-28 Takashi Nakamoto * New feature - incremental search 2004-12-27 Takashi Nakamoto * New feature - configuration option for default window position 2004-12-21 Takashi Nakamoto * New feature - flexible default values in various fields 2004-12-20 Takashi Nakamoto * New feature - shortcut key configuration * New feature - Users can change default/maximum/minimum frequency value - Remove "Add" button and add "New Word" button 2004-12-08 Takashi Nakamoto * New feature - configuration framework 2004-12-07 Takashi Nakamoto * KasumiMainWindow.cxx: Feature - default status of prefix search is set checked 2004-12-02 Takashi Nakamoto * main.cxx: Fix - fix argument handling codes to resolve segumentation fault which rises if wrong argument (such as "--ad") specified. - remove the message about dictionary file reading from output string which displayed when "--help" option specified 2004-11-27 Takashi Nakamoto * Fix - trivial code and comment change for easy code reading 2004-11-26 Takashi Nakamoto * KasumiAddWindow.cxx: New feature - shortcut key for add window * KasumiAddWindow:cxx: Fix - to resize add window acorrding to content size 2004-11-25 Takashi Nakamoto * New feature - Shortcut key * Fix - trivial change for Changed* methods' argument 2004-11-14 Takashi Nakamoto * Fix - trivial change for temporary file * New feature - prefix search function 2004-11-12 Takashi Nakamoto * Fix - adjust default frequency value and upper bounds 2004-11-10 Takashi Nakamoto * New feature - search function (complete version) 2004-11-10 Takashi Nakamoto * KasumiDic.cxx: Load dictionary directly from "anthy-dic-tool --dump" storing into temporary file. If user removed word, it will be removed correctly from Anthy's internal dictionary. * Solved some compile warnings * KasumiMainWindow.cxx: changed add word operation. * New feature - search function (test version) 2004-11-05 Takashi Nakamoto * New feature - Add Window. 2004-11-03 Takashi Nakamoto * New version of Kasumi rewritten by C++. * KasumiMainWindow.cxx: New option pane for noun and adverbs. kasumi-2.5+debian2/Makefile.am000066400000000000000000000021621475414712000162130ustar00rootroot00000000000000bin_PROGRAMS = kasumi kasumi_SOURCES = src/main.cc src/intl.h \ src/KasumiDic.cc src/KasumiDic.hh \ src/KasumiWord.cc src/KasumiWord.hh \ src/KasumiWordType.cc src/KasumiWordType.hh \ src/KasumiString.cc src/KasumiString.hh \ src/KasumiException.cc src/KasumiException.hh \ src/KasumiMainWindow.cc src/KasumiMainWindow.hh \ src/KasumiAddWindow.cc src/KasumiAddWindow.hh \ src/KasumiDicEventListener.hh \ src/KasumiWordEventListener.hh \ src/KasumiConfiguration.cc src/KasumiConfiguration.hh \ src/cellrendererspin.c src/cellrendererspin.h \ kasumi.png \ kasumi.1 \ kasumi.desktop.in appicondir = $(datadir)/pixmaps appicon_DATA = kasumi.png man_MANS = kasumi.1 EXTRA_DIST = $(man_MANS) desktopdir = $(datadir)/applications Desktop_in_files = kasumi.desktop.in desktop_DATA = $(Desktop_in_files:.desktop.in=.desktop) localedir = $(datadir)/locale AM_CPPFLAGS=-DLOCALEDIR=\"$(localedir)\" AM_CXXFLAGS=-DLOCALEDIR=\"$(localedir)\" SUBDIRS = po ACLOCAL_AMFLAGS = -I m4 CLEANFILES = $(desktop_DATA) kasumi_CPPFLAGS = $(GTK_CFLAGS) -Isrc/ kasumi_LDADD = $(INTLLIBS) $(GTK_LIBS) $(ANTHY_LIBS) $(GOBJECT_LIBS) kasumi-2.5+debian2/autogen.sh000077500000000000000000000011271475414712000161600ustar00rootroot00000000000000#!/bin/bash scan_build() { scan-build --use-analyzer=/usr/bin/clang "${@}" } run_action() { local action="${1}" shift local configure_args=( --prefix=/usr --sysconfdir=/etc ) case "${action}" in configure-full) ./configure "${configure_args[@]}" "${@}" ;; scan-build) scan_build ./configure "${configure_args[@]}" "${@}" scan_build make ;; esac } main() { autoreconf -i -Wall intltoolize --force --automake [[ "#{#}" != 0 ]] && run_action "${@}" } main "${@}" kasumi-2.5+debian2/configure.ac000066400000000000000000000025151475414712000164470ustar00rootroot00000000000000AC_PREREQ([2.69]) AC_INIT([kasumi],[2.5+debian1],[https://tracker.debian.org/pkg/kasumi]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_SRCDIR([src/]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_AUX_DIR([build-aux]) AC_PREFIX_DEFAULT([/usr]) AM_INIT_AUTOMAKE([subdir-objects check-news foreign no-dist-gzip dist-xz tar-ustar -Wall]) AM_SILENT_RULES([yes]) AC_PROG_AWK AC_PROG_SED AC_PROG_MKDIR_P AC_PROG_LN_S AC_PROG_INSTALL AC_PROG_MAKE_SET AC_PROG_CPP AC_PROG_CC AC_PROG_CC_C_O AC_PROG_CXX AC_C_INLINE AC_CHECK_HEADER_STDBOOL CC_ATTRIBUTE_UNUSED CC_ATTRIBUTE_VISIBILITY([default]) GETTEXT_PACKAGE=$PACKAGE_NAME AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"], [Gettext Package]) AC_SUBST(GETTEXT_PACKAGE) AM_GNU_GETTEXT([external]) AM_GNU_GETTEXT_VERSION([0.21]) IT_PROG_INTLTOOL([0.50.0]) PKG_PROG_PKG_CONFIG([0.22]) PKG_CHECK_MODULES(GTK, [gtk+-3.0]) PKG_CHECK_MODULES(ANTHY, [anthy]) AC_CONFIG_FILES([ Makefile po/Makefile.in kasumi.desktop ]) AC_OUTPUT AC_MSG_RESULT([ $PACKAGE_NAME $VERSION ======== prefix: ${prefix} exec_prefix: ${exec_prefix} sysconfdir: ${sysconfdir} libdir: ${libdir} includedir: ${includedir} compiler: ${CC} cflags: ${CFLAGS} ldflags: ${LDFLAGS} ]) kasumi-2.5+debian2/kasumi.1000066400000000000000000000033511475414712000155330ustar00rootroot00000000000000.\"Generated by db2man.xsl. Don't modify this, modify the source. .de Sh \" Subsection .br .if t .Sp .ne 5 .PP \fB\\$1\fR .PP .. .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Ip \" List item .br .ie \\n(.$>=3 .ne \\$3 .el .ne 3 .IP "\\$1" \\$2 .. .TH "KASUMI" 1 "May 2006" "" "" .SH NAME kasumi \- a personal dictionary manager for Anthy .SH "SYNOPSIS" .ad l .hy 0 .HP 7 \fBkasumi\fR [\fIoptions\fR] .ad .hy .SH "DESCRIPTION" .PP \fBkasumi\fR is a personal dictionary manager for Anthy\&. .SH "OPTIONS" .TP \fB\-h\fR \fB\-\-help\fR Show summary of options .TP \fB\-v\fR \fB\-\-version\fR Show Kasumi's version and copyright information .TP \fB\-m\fR \fB\-\-manage\fR Run Kasumi in Manage mode\&. You may abbreviate this option .TP \fB\-a\fR \fB\-\-add\fR Run Kasumi in Add mode\&. .TP \fB\-e\fR \fB\-\-exclusive\fR Run Kasumi in Exclusive mode\&. .TP \fB\-\-sound val\fR Set default sound entry (only in Add mode) .TP \fB\-\-spelling val\fR Set default spelling entry (only in Add mode) .TP \fB\-\-wordclass val\fR Set default word class entry (only in Add mode) .TP \fB\-i\fR \fB\-\-import\fR Import selected text as a spelling .TP \fB\-I\fR \fB\-\-ignore\fR Ignore selected text .TP \fB\-E\fR \fB\-\-eucjp\fR Use EUC-JP encoding for dictionary .SH "AUTHOR" .PP This manual page was written by Ikuya Awashiro for the Debian™ system (but may be used by others)\&. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 any later version published by the Free Software Foundation\&. .PP On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common\-licenses/GPL\&. kasumi-2.5+debian2/kasumi.desktop.in000066400000000000000000000007321475414712000174510ustar00rootroot00000000000000[Desktop Entry] Version=1.0 Name=Anthy Dictionary editor Name[ja]=Anthy 辞書管理 GenericName=Management tool for anthy private dictionary GenericName[ja]=Anthy 個人辞書管理ツール Comment=Edit Anthy dictionary. Comment[ja]=Anthy の個人辞書に単語を登録、削除、編集するツールです。 Exec=kasumi Icon=kasumi StartupNotify=true Terminal=false Type=Application Categories=Settings; Keywords=Japanese;Dictionary; Keywords[ja]=日本語;辞書; kasumi-2.5+debian2/kasumi.png000066400000000000000000000046511475414712000161630ustar00rootroot00000000000000PNG  IHDR szzbKGD pHYs  tIMEu`tEXtCommentCreated with The GIMPd%n IDATXÝW{lg=l:q쵕8$ MJ"ї* "*(jJ PUGjUTTIjinu};^KIFZvof~3CLpHs`6(s12KFOoq$H}pbŷ aTm/ d`*}3a&crY"L|:2ޚ)冾]&f_2rs^Jm],C`ŢA27?ry홵>7D[nЅ2N^s;p>c0E!i Xa#+thO . }ar/N!AI* 5w։,ii6 HlBUN /֔?ϖu0Ề/r_\_GZgT.mIG/륲JGCJf-k(/MX(--Vh9wft$HBiÉ @B=BnLeԺ߹splk2ϛi?S:1E; m >d]6.weB3X# Cqh˯|瑱|9:%`]0L&\>m_omF2H AHrpE3R|A&gB@USPKPu1SN~s^j(89ўy4$ g&8 p2nyJMF{Ҁ~cUq' s[Ɛ c am U%Mƀ#މ}8p]u%ѾT\~~ZT0¯%AT)!lȉݠ `JA4L m !X\Oɞ=&f躖2am-Mr8N8 \ uВ9rs0>3ʽ_jJ]UU6M\<D:TMxu@ @@%00=[T6;d8e !d;!U䆥{_~ !~E.0v4 K@ hz }׷Pob1Rvy8_3c@Ujٲ!֚1vU)kb 4mw d_'5h3  !Ppy9Ǵ,5M !$m;%l΍h4'rk\aLS@JI/ _k R[yk?]3]/ő#וnW,$JH Mf`I \]ɑ{w2ǫQ 3#1|/CA:XQM.4\l>J.]@*peJosK(wd*"GFn=o9Ų 0]>ߛ6 u w/l'6m@L~){~]1q|$BUTB(৕%EbxHEZ ႄ r#7K/&˒<>o0,K⸈Pd@VN+ gg o;SW%#$"X--ƻ5p F &=b@c wG?pNlP/ޟsj7is^PlH,BP)_A2$ 0Q g ӧX说^6"_,Z( {gw'bQl8j9hi$!4g w'/*϶`Ot(-&m#`qEuvQ< \U!`۶u<`H0&@F36=C8X? ~+ *Oo "p64* '7Ecrs:Eb ld~nArq8+SO_Ij*2NKAiwxJk~qTD@<!6_ dnl Copyright (c) 2006-2008 xine project dnl Copyright (c) 2012-2015 Marc-Antoine Perennou dnl dnl This program is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by dnl the Free Software Foundation; either version 2, or (at your option) dnl any later version. dnl dnl This program is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the dnl GNU General Public License for more details. dnl dnl You should have received a copy of the GNU General Public License dnl along with this program; if not, write to the Free Software dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA dnl 02110-1301, USA. dnl dnl As a special exception, the copyright owners of the dnl macro gives unlimited permission to copy, distribute and modify the dnl configure scripts that are the output of Autoconf when processing the dnl Macro. You need not follow the terms of the GNU General Public dnl License when using or distributing such scripts, even though portions dnl of the text of the Macro appear in them. The GNU General Public dnl License (GPL) does govern all other use of the material that dnl constitutes the Autoconf Macro. dnl dnl This special exception to the GPL applies to versions of the dnl Autoconf Macro released by this project. When you make and dnl distribute a modified version of the Autoconf Macro, you may extend dnl this special exception to the GPL to apply to your modified version as dnl well. dnl Check if the flag is supported by compiler dnl CC_CHECK_CFLAGS_SILENT([FLAG], [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND]) AC_DEFUN([CC_CHECK_CFLAGS_SILENT], [ AC_CACHE_VAL(AS_TR_SH([cc_cv_cflags_$1]), [ac_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $1" AC_COMPILE_IFELSE([AC_LANG_SOURCE([int a;])], [eval "AS_TR_SH([cc_cv_cflags_$1])='yes'"], [eval "AS_TR_SH([cc_cv_cflags_$1])='no'"]) CFLAGS="$ac_save_CFLAGS" ]) AS_IF([eval test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes], [$2], [$3]) ]) dnl Check if the flag is supported by compiler (cacheable) dnl CC_CHECK_CFLAGS([FLAG], [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND]) AC_DEFUN([CC_CHECK_CFLAGS], [ AC_CACHE_CHECK([if $CC supports $1 flag], AS_TR_SH([cc_cv_cflags_$1]), CC_CHECK_CFLAGS_SILENT([$1]) dnl Don't execute actions here! ) AS_IF([eval test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes], [$2], [$3]) ]) dnl CC_CHECK_CFLAG_APPEND(FLAG, [action-if-found], [action-if-not-found]) dnl Check for CFLAG and appends them to CFLAGS if supported AC_DEFUN([CC_CHECK_CFLAG_APPEND], [ AC_CACHE_CHECK([if $CC supports $1 flag], AS_TR_SH([cc_cv_cflags_$1]), CC_CHECK_CFLAGS_SILENT([$1]) dnl Don't execute actions here! ) AS_IF([eval test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes], [CFLAGS="$CFLAGS $1"; DEBUG_CFLAGS="$DEBUG_CFLAGS $1"; $2], [$3]) ]) dnl CC_CHECK_CFLAGS_APPEND([FLAG1 FLAG2], [action-if-found], [action-if-not]) AC_DEFUN([CC_CHECK_CFLAGS_APPEND], [ for flag in $1; do CC_CHECK_CFLAG_APPEND($flag, [$2], [$3]) done ]) dnl Check if the flag is supported by linker dnl CC_CHECK_LDFLAGS_SILENT([FLAG], [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND]) AC_DEFUN([CC_CHECK_LDFLAGS_SILENT], [ AC_CACHE_VAL(AS_TR_SH([cc_cv_ldflags_$1]), [ac_save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $1" AC_LINK_IFELSE([AC_LANG_SOURCE([int main() { return 1; }])], [eval "AS_TR_SH([cc_cv_ldflags_$1])='yes'"], [eval "AS_TR_SH([cc_cv_ldflags_$1])="]) LDFLAGS="$ac_save_LDFLAGS" ]) AS_IF([eval test x$]AS_TR_SH([cc_cv_ldflags_$1])[ = xyes], [$2], [$3]) ]) dnl Check if the flag is supported by linker (cacheable) dnl CC_CHECK_LDFLAGS([FLAG], [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND]) AC_DEFUN([CC_CHECK_LDFLAGS], [ AC_CACHE_CHECK([if $CC supports $1 flag], AS_TR_SH([cc_cv_ldflags_$1]), CC_CHECK_LDFLAGS_SILENT([$1]) dnl Don't execute actions here! ) AS_IF([eval test x$]AS_TR_SH([cc_cv_ldflags_$1])[ = xyes], [$2], [$3]) ]) dnl CC_CHECK_LDFLAG_APPEND(FLAG, [action-if-found], [action-if-not-found]) dnl Check for LDFLAG and appends them to LDFLAGS if supported AC_DEFUN([CC_CHECK_LDFLAG_APPEND], [ AC_CACHE_CHECK([if $CC supports $1 flag], AS_TR_SH([cc_cv_ldflags_$1]), CC_CHECK_LDFLAGS_SILENT([$1]) dnl Don't execute actions here! ) AS_IF([eval test x$]AS_TR_SH([cc_cv_ldflags_$1])[ = xyes], [LDFLAGS="$LDFLAGS $1"; DEBUG_LDFLAGS="$DEBUG_LDFLAGS $1"; $2], [$3]) ]) dnl CC_CHECK_LDFLAGS_APPEND([FLAG1 FLAG2], [action-if-found], [action-if-not]) AC_DEFUN([CC_CHECK_LDFLAGS_APPEND], [ for flag in $1; do CC_CHECK_LDFLAG_APPEND($flag, [$2], [$3]) done ]) dnl define the LDFLAGS_NOUNDEFINED variable with the correct value for dnl the current linker to avoid undefined references in a shared object. AC_DEFUN([CC_NOUNDEFINED], [ dnl We check $host for which systems to enable this for. AC_REQUIRE([AC_CANONICAL_HOST]) case $host in dnl FreeBSD (et al.) does not complete linking for shared objects when pthreads dnl are requested, as different implementations are present; to avoid problems dnl use -Wl,-z,defs only for those platform not behaving this way. *-freebsd* | *-openbsd*) ;; *) dnl First of all check for the --no-undefined variant of GNU ld. This allows dnl for a much more readable commandline, so that people can understand what dnl it does without going to look for what the heck -z defs does. for possible_flags in "-Wl,--no-undefined" "-Wl,-z,defs"; do CC_CHECK_LDFLAGS([$possible_flags], [LDFLAGS_NOUNDEFINED="$possible_flags"]) break done ;; esac AC_SUBST([LDFLAGS_NOUNDEFINED]) ]) dnl Check for a -Werror flag or equivalent. -Werror is the GCC dnl and ICC flag that tells the compiler to treat all the warnings dnl as fatal. We usually need this option to make sure that some dnl constructs (like attributes) are not simply ignored. dnl dnl Other compilers don't support -Werror per se, but they support dnl an equivalent flag: dnl - Sun Studio compiler supports -errwarn=%all AC_DEFUN([CC_CHECK_WERROR], [ AC_CACHE_CHECK( [for $CC way to treat warnings as errors], [cc_cv_werror], [CC_CHECK_CFLAGS_SILENT([-Werror], [cc_cv_werror=-Werror], [CC_CHECK_CFLAGS_SILENT([-errwarn=%all], [cc_cv_werror=-errwarn=%all])]) ]) ]) AC_DEFUN([CC_CHECK_ATTRIBUTE], [ AC_REQUIRE([CC_CHECK_WERROR]) AC_CACHE_CHECK([if $CC supports __attribute__(( ifelse([$2], , [$1], [$2]) ))], AS_TR_SH([cc_cv_attribute_$1]), [ac_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $cc_cv_werror" AC_COMPILE_IFELSE([AC_LANG_SOURCE([$3])], [eval "AS_TR_SH([cc_cv_attribute_$1])='yes'"], [eval "AS_TR_SH([cc_cv_attribute_$1])='no'"]) CFLAGS="$ac_save_CFLAGS" ]) AS_IF([eval test x$]AS_TR_SH([cc_cv_attribute_$1])[ = xyes], [AC_DEFINE( AS_TR_CPP([SUPPORT_ATTRIBUTE_$1]), 1, [Define this if the compiler supports __attribute__(( ifelse([$2], , [$1], [$2]) ))] ) $4], [$5]) ]) AC_DEFUN([CC_ATTRIBUTE_CONSTRUCTOR], [ CC_CHECK_ATTRIBUTE( [constructor],, [void __attribute__((constructor)) ctor() { int a; }], [$1], [$2]) ]) AC_DEFUN([CC_ATTRIBUTE_FORMAT], [ CC_CHECK_ATTRIBUTE( [format], [format(printf, n, n)], [void __attribute__((format(printf, 1, 2))) printflike(const char *fmt, ...) { fmt = (void *)0; }], [$1], [$2]) ]) AC_DEFUN([CC_ATTRIBUTE_FORMAT_ARG], [ CC_CHECK_ATTRIBUTE( [format_arg], [format_arg(printf)], [char *__attribute__((format_arg(1))) gettextlike(const char *fmt) { fmt = (void *)0; }], [$1], [$2]) ]) AC_DEFUN([CC_ATTRIBUTE_VISIBILITY], [ CC_CHECK_ATTRIBUTE( [visibility_$1], [visibility("$1")], [void __attribute__((visibility("$1"))) $1_function() { }], [$2], [$3]) ]) AC_DEFUN([CC_ATTRIBUTE_NONNULL], [ CC_CHECK_ATTRIBUTE( [nonnull], [nonnull()], [void __attribute__((nonnull())) some_function(void *foo, void *bar) { foo = (void*)0; bar = (void*)0; }], [$1], [$2]) ]) AC_DEFUN([CC_ATTRIBUTE_UNUSED], [ CC_CHECK_ATTRIBUTE( [unused], , [void some_function(void *foo, __attribute__((unused)) void *bar);], [$1], [$2]) ]) AC_DEFUN([CC_ATTRIBUTE_SENTINEL], [ CC_CHECK_ATTRIBUTE( [sentinel], , [void some_function(void *foo, ...) __attribute__((sentinel));], [$1], [$2]) ]) AC_DEFUN([CC_ATTRIBUTE_DEPRECATED], [ CC_CHECK_ATTRIBUTE( [deprecated], , [void some_function(void *foo, ...) __attribute__((deprecated));], [$1], [$2]) ]) AC_DEFUN([CC_ATTRIBUTE_ALIAS], [ CC_CHECK_ATTRIBUTE( [alias], [weak, alias], [void other_function(void *foo) { } void some_function(void *foo) __attribute__((weak, alias("other_function")));], [$1], [$2]) ]) AC_DEFUN([CC_ATTRIBUTE_MALLOC], [ CC_CHECK_ATTRIBUTE( [malloc], , [void * __attribute__((malloc)) my_alloc(int n);], [$1], [$2]) ]) AC_DEFUN([CC_ATTRIBUTE_PACKED], [ CC_CHECK_ATTRIBUTE( [packed], , [struct astructure { char a; int b; long c; void *d; } __attribute__((packed));], [$1], [$2]) ]) AC_DEFUN([CC_ATTRIBUTE_CONST], [ CC_CHECK_ATTRIBUTE( [const], , [int __attribute__((const)) twopow(int n) { return 1 << n; } ], [$1], [$2]) ]) AC_DEFUN([CC_FLAG_VISIBILITY], [ AC_REQUIRE([CC_CHECK_WERROR]) AC_CACHE_CHECK([if $CC supports -fvisibility=hidden], [cc_cv_flag_visibility], [cc_flag_visibility_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $cc_cv_werror" CC_CHECK_CFLAGS_SILENT([-fvisibility=hidden], cc_cv_flag_visibility='yes', cc_cv_flag_visibility='no') CFLAGS="$cc_flag_visibility_save_CFLAGS"]) AS_IF([test "x$cc_cv_flag_visibility" = "xyes"], [AC_DEFINE([SUPPORT_FLAG_VISIBILITY], 1, [Define this if the compiler supports the -fvisibility flag]) $1], [$2]) ]) AC_DEFUN([CC_FUNC_EXPECT], [ AC_REQUIRE([CC_CHECK_WERROR]) AC_CACHE_CHECK([if compiler has __builtin_expect function], [cc_cv_func_expect], [ac_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $cc_cv_werror" AC_COMPILE_IFELSE([AC_LANG_SOURCE( [int some_function() { int a = 3; return (int)__builtin_expect(a, 3); }])], [cc_cv_func_expect=yes], [cc_cv_func_expect=no]) CFLAGS="$ac_save_CFLAGS" ]) AS_IF([test "x$cc_cv_func_expect" = "xyes"], [AC_DEFINE([SUPPORT__BUILTIN_EXPECT], 1, [Define this if the compiler supports __builtin_expect() function]) $1], [$2]) ]) AC_DEFUN([CC_ATTRIBUTE_ALIGNED], [ AC_REQUIRE([CC_CHECK_WERROR]) AC_CACHE_CHECK([highest __attribute__ ((aligned ())) supported], [cc_cv_attribute_aligned], [ac_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $cc_cv_werror" for cc_attribute_align_try in 64 32 16 8 4 2; do AC_COMPILE_IFELSE([AC_LANG_SOURCE([ int main() { static char c __attribute__ ((aligned($cc_attribute_align_try))) = 0; return c; }])], [cc_cv_attribute_aligned=$cc_attribute_align_try; break]) done CFLAGS="$ac_save_CFLAGS" ]) if test "x$cc_cv_attribute_aligned" != "x"; then AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX], [$cc_cv_attribute_aligned], [Define the highest alignment supported]) fi ]) kasumi-2.5+debian2/po/000077500000000000000000000000001475414712000145745ustar00rootroot00000000000000kasumi-2.5+debian2/po/LINGUAS000066400000000000000000000000061475414712000156150ustar00rootroot00000000000000it ja kasumi-2.5+debian2/po/Makevars000066400000000000000000000034501475414712000162720ustar00rootroot00000000000000# Makefile variables for PO directory in any package using GNU gettext. # Usually the message domain is the same as the package name. DOMAIN = $(PACKAGE) # These two variables depend on the location of this directory. subdir = po top_builddir = .. # These options get passed to xgettext. XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ # This is the copyright holder that gets inserted into the header of the # $(DOMAIN).pot file. Set this to the copyright holder of the surrounding # package. (Note that the msgstr strings, extracted from the package's # sources, belong to the copyright holder of the package.) Translators are # expected to transfer the copyright for their translations to this person # or entity, or to disclaim their copyright. The empty string stands for # the public domain; in this case the translators are expected to disclaim # their copyright. COPYRIGHT_HOLDER = Free Software Foundation, Inc. # This is the email address or URL to which the translators shall report # bugs in the untranslated strings: # - Strings which are not entire sentences, see the maintainer guidelines # in the GNU gettext documentation, section 'Preparing Strings'. # - Strings which use unclear terms or require additional context to be # understood. # - Strings which make invalid assumptions about notation of date, time or # money. # - Pluralisation problems. # - Incorrect English spelling. # - Incorrect formatting. # It can be your email address, or a mailing list address where translators # can write to without being subscribed, or the URL of a web page through # which the translators can contact you. MSGID_BUGS_ADDRESS = Marc-Antoine@Perennou.com # This is the list of locale categories, beyond LC_MESSAGES, for which the # message catalogs shall be used. It is usually empty. EXTRA_LOCALE_CATEGORIES = kasumi-2.5+debian2/po/POTFILES.in000066400000000000000000000005461475414712000163560ustar00rootroot00000000000000src/main.cc src/KasumiString.hh src/KasumiDic.hh src/KasumiDic.cc src/KasumiWord.hh src/KasumiWord.cc src/KasumiString.cc src/KasumiString.hh src/KasumiException.hh src/KasumiException.cc src/KasumiMainWindow.hh src/KasumiMainWindow.cc src/KasumiAddWindow.hh src/KasumiAddWindow.cc src/KasumiConfiguration.cc src/KasumiConfiguration.hh src/KasumiWordType.cc kasumi-2.5+debian2/po/it.po000066400000000000000000000163051475414712000155550ustar00rootroot00000000000000# translation of it.po to Italian # Copyright (C) 2006 Free Software Foundation, Inc. # This file is distributed under the same license as the PACKAGE package. # # Diego 'Flameeyes' Pettenò , 2006. msgid "" msgstr "" "Project-Id-Version: it\n" "Report-Msgid-Bugs-To: Marc-Antoine@Perennou.com\n" "POT-Creation-Date: 2015-08-26 16:51+0200\n" "PO-Revision-Date: 2006-06-25 13:04+0900\n" "Last-Translator: Diego 'Flameeyes' Pettenò \n" "Language-Team: Italian\n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: KBabel 1.11.2\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: ../src/KasumiWord.cc:191 ../src/KasumiWord.cc:214 msgid "" "Sound must consist of only Hiragana characters. You have entered invalid " "character: " msgstr "" "Il suono deve contenere solo caratteri Hiragana. Sono stati inseriti " "caratteri non validi." #: ../src/KasumiMainWindow.cc:81 msgid "Kasumi" msgstr "Kasumi" #: ../src/KasumiMainWindow.cc:106 msgid "Search:" msgstr "" #: ../src/KasumiMainWindow.cc:118 msgid "Search by Spelling" msgstr "Cerca per ortografia" #: ../src/KasumiMainWindow.cc:124 msgid "Search by Sound" msgstr "Cerca per suono" #. creating text entries for "Spelling" #: ../src/KasumiMainWindow.cc:180 ../src/KasumiAddWindow.cc:68 msgid "Spelling" msgstr "Ortografia" #. creating text entries for "Sound" #: ../src/KasumiMainWindow.cc:196 ../src/KasumiAddWindow.cc:85 msgid "Sound" msgstr "Suono" #. creating spin button for "Frequency" #: ../src/KasumiMainWindow.cc:222 ../src/KasumiAddWindow.cc:102 msgid "Frequency" msgstr "Frequenza" #: ../src/KasumiMainWindow.cc:257 msgid "WordClass" msgstr "WordClass" #: ../src/KasumiMainWindow.cc:375 msgid "" "Your dictionary was changed. Do you save these changes before Kasumi quits?" msgstr "" "Il tuo vocabolario è stato cambiato. Si vogliono salvare queste modifiche " "prima di uscire da Kasumi?" #: ../src/KasumiAddWindow.cc:58 msgid "Kasumi (Register words)" msgstr "" #. creating combo box for "Word Type" #: ../src/KasumiAddWindow.cc:124 msgid "Word Type" msgstr "Tipo di parola" #. creating combo box for "Subcategory of Word Type" #: ../src/KasumiAddWindow.cc:173 msgid "Subcategory of Word Type" msgstr "" #: ../src/KasumiAddWindow.cc:206 #, fuzzy msgid "Add entered word and quit registration." msgstr "Salva il vocabolario ed esci da questa applicazione." #: ../src/KasumiAddWindow.cc:213 #, fuzzy msgid "Cancel registration and quit." msgstr "Salva il vocabolario ed esci da questa applicazione." #: ../src/KasumiAddWindow.cc:226 msgid "Add entered word" msgstr "Aggiungi la parola inserita" #: ../src/KasumiAddWindow.cc:233 msgid "Manage mode" msgstr "Modalità gestione" #: ../src/KasumiAddWindow.cc:240 msgid "Quit this application" msgstr "Esci da questa applicazione" #: ../src/KasumiAddWindow.cc:291 msgid "Invalid entry for Sound." msgstr "Elemento per \"suono\" non valido." #: ../src/KasumiAddWindow.cc:304 msgid "Invalid entry for Spelling." msgstr "Elemento per \"ortografia\" non valido. " #: ../src/KasumiWordType.cc:36 ../src/KasumiWordType.cc:37 #: ../src/KasumiWordType.cc:38 ../src/KasumiWordType.cc:39 #: ../src/KasumiWordType.cc:40 ../src/KasumiWordType.cc:41 #, fuzzy msgid "Noun" msgstr "Suono" #: ../src/KasumiWordType.cc:36 msgid "General Noun" msgstr "" #: ../src/KasumiWordType.cc:37 msgid "followed by NA, SA and SURU" msgstr "" #: ../src/KasumiWordType.cc:38 msgid "followed by NA and SA" msgstr "" #: ../src/KasumiWordType.cc:39 msgid "followed by NA and SURU" msgstr "" #: ../src/KasumiWordType.cc:40 msgid "followed by NA" msgstr "" #: ../src/KasumiWordType.cc:41 ../src/KasumiWordType.cc:51 msgid "followed by SURU" msgstr "" #: ../src/KasumiWordType.cc:42 ../src/KasumiWordType.cc:43 #: ../src/KasumiWordType.cc:44 msgid "Proper Noun" msgstr "" #: ../src/KasumiWordType.cc:42 msgid "Name of people" msgstr "" #: ../src/KasumiWordType.cc:43 msgid "Geographic Name" msgstr "" #: ../src/KasumiWordType.cc:44 msgid "Corporate Name" msgstr "" #: ../src/KasumiWordType.cc:45 msgid "Numeral" msgstr "" #: ../src/KasumiWordType.cc:46 msgid "Adjective (Keiyoushi)" msgstr "" #: ../src/KasumiWordType.cc:47 ../src/KasumiWordType.cc:48 #: ../src/KasumiWordType.cc:49 ../src/KasumiWordType.cc:50 #: ../src/KasumiWordType.cc:51 msgid "Adverb" msgstr "" #: ../src/KasumiWordType.cc:47 msgid "General Adverb" msgstr "" #: ../src/KasumiWordType.cc:48 msgid "followed by TO and TARU" msgstr "" #: ../src/KasumiWordType.cc:49 msgid "followed by TO and SURU" msgstr "" #: ../src/KasumiWordType.cc:50 msgid "followed by TO" msgstr "" #: ../src/KasumiWordType.cc:52 msgid "Interjection" msgstr "" #: ../src/KasumiWordType.cc:53 msgid "Adnominal adjunct" msgstr "" #: ../src/KasumiWordType.cc:54 msgid "Single Kanji Character" msgstr "" #: ../src/KasumiWordType.cc:55 ../src/KasumiWordType.cc:56 #: ../src/KasumiWordType.cc:57 ../src/KasumiWordType.cc:58 #: ../src/KasumiWordType.cc:59 ../src/KasumiWordType.cc:60 #: ../src/KasumiWordType.cc:61 ../src/KasumiWordType.cc:62 #: ../src/KasumiWordType.cc:63 msgid "Verb" msgstr "" #: ../src/KasumiWordType.cc:55 ../src/KasumiWordType.cc:64 msgid "Ka 5" msgstr "" #: ../src/KasumiWordType.cc:56 ../src/KasumiWordType.cc:65 msgid "Ga 5" msgstr "" #: ../src/KasumiWordType.cc:57 ../src/KasumiWordType.cc:66 msgid "Sa 5" msgstr "" #: ../src/KasumiWordType.cc:58 ../src/KasumiWordType.cc:67 msgid "Ta 5" msgstr "" #: ../src/KasumiWordType.cc:59 ../src/KasumiWordType.cc:68 msgid "Na 5" msgstr "" #: ../src/KasumiWordType.cc:60 ../src/KasumiWordType.cc:69 msgid "Ba 5" msgstr "" #: ../src/KasumiWordType.cc:61 ../src/KasumiWordType.cc:70 msgid "Ma 5" msgstr "" #: ../src/KasumiWordType.cc:62 ../src/KasumiWordType.cc:71 msgid "Ra 5" msgstr "" #: ../src/KasumiWordType.cc:63 ../src/KasumiWordType.cc:72 msgid "Wa 5" msgstr "" #: ../src/KasumiWordType.cc:64 ../src/KasumiWordType.cc:65 #: ../src/KasumiWordType.cc:66 ../src/KasumiWordType.cc:67 #: ../src/KasumiWordType.cc:68 ../src/KasumiWordType.cc:69 #: ../src/KasumiWordType.cc:70 ../src/KasumiWordType.cc:71 #: ../src/KasumiWordType.cc:72 msgid "Verb*" msgstr "" #, fuzzy #~ msgid "" #~ "If all the necessary items are filled in, add entered word and quit " #~ "registration." #~ msgstr "" #~ "Se tutti gli oggetti necessari sono stati riempiti, aggiungi la parola " #~ "inserita." #~ msgid "If all the necessary items are filled in, add entered word." #~ msgstr "" #~ "Se tutti gli oggetti necessari sono stati riempiti, aggiungi la parola " #~ "inserita." #~ msgid "Make the shift to manage mode to modify and remove registered words." #~ msgstr "" #~ "Passa a modalità gestione per modificare e rimuovere le parole registrate." #~ msgid "Save dictionary and quit this application." #~ msgstr "Salva il vocabolario ed esci da questa applicazione." #~ msgid "search" #~ msgstr "cerca" #, fuzzy #~ msgid "Word Type Category" #~ msgstr "Tipo di parola" #~ msgid "Add" #~ msgstr "Aggiungi" #~ msgid "Quit" #~ msgstr "Esci" #~ msgid "Edit" #~ msgstr "Modifica" #~ msgid "Cannot find a specific word. Search from first?" #~ msgstr "" #~ "Impossibile trovare una parola specifica. Si vuole cercare dall'inizio?" #~ msgid "Cannot find a specific word." #~ msgstr "Impossibile trovare una parola specifica." kasumi-2.5+debian2/po/ja.po000066400000000000000000000220051475414712000155250ustar00rootroot00000000000000# Kasumi's Japanese translated message # Copyright (C) 2004-2006 Takashi Nakamoto # This file is distributed under the same license as the Kasumi package. # Takashi Nakamoto , 2006 # msgid "" msgstr "" "Project-Id-Version: 0.4.0\n" "Report-Msgid-Bugs-To: Marc-Antoine@Perennou.com\n" "POT-Creation-Date: 2015-08-26 16:51+0200\n" "PO-Revision-Date: 2006-10-15 22:30+0900\n" "Last-Translator: Takashi Nakamoto \n" "Language-Team: Takashi Nakamoto \n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: ../src/KasumiWord.cc:191 ../src/KasumiWord.cc:214 msgid "" "Sound must consist of only Hiragana characters. You have entered invalid " "character: " msgstr "読みにひらがな以外の文字を入力することはできません: " #: ../src/KasumiMainWindow.cc:81 msgid "Kasumi" msgstr "霞" #: ../src/KasumiMainWindow.cc:106 msgid "Search:" msgstr "検索:" #: ../src/KasumiMainWindow.cc:118 msgid "Search by Spelling" msgstr "単語で検索" #: ../src/KasumiMainWindow.cc:124 msgid "Search by Sound" msgstr "読みで検索" #. creating text entries for "Spelling" #: ../src/KasumiMainWindow.cc:180 ../src/KasumiAddWindow.cc:68 msgid "Spelling" msgstr "単語" #. creating text entries for "Sound" #: ../src/KasumiMainWindow.cc:196 ../src/KasumiAddWindow.cc:85 msgid "Sound" msgstr "読み" #. creating spin button for "Frequency" #: ../src/KasumiMainWindow.cc:222 ../src/KasumiAddWindow.cc:102 msgid "Frequency" msgstr "頻度" #: ../src/KasumiMainWindow.cc:257 msgid "WordClass" msgstr "品詞" #: ../src/KasumiMainWindow.cc:375 msgid "" "Your dictionary was changed. Do you save these changes before Kasumi quits?" msgstr "辞書に変更が加えられました。霞を終了する前に保存しますか?" #: ../src/KasumiAddWindow.cc:58 msgid "Kasumi (Register words)" msgstr "霞 (単語登録)" # 品詞の分類 #. creating combo box for "Word Type" #: ../src/KasumiAddWindow.cc:124 msgid "Word Type" msgstr "品詞" #. creating combo box for "Subcategory of Word Type" #: ../src/KasumiAddWindow.cc:173 msgid "Subcategory of Word Type" msgstr "品詞の細分類" #: ../src/KasumiAddWindow.cc:206 msgid "Add entered word and quit registration." msgstr "入力された単語を登録し、単語登録を終了します。" #: ../src/KasumiAddWindow.cc:213 msgid "Cancel registration and quit." msgstr "単語登録を中断します" #: ../src/KasumiAddWindow.cc:226 msgid "Add entered word" msgstr "入力された単語を追加する" #: ../src/KasumiAddWindow.cc:233 msgid "Manage mode" msgstr "辞書管理モード" #: ../src/KasumiAddWindow.cc:240 msgid "Quit this application" msgstr "このアプリケーションを終了する" #: ../src/KasumiAddWindow.cc:291 msgid "Invalid entry for Sound." msgstr "「読み」の項目を正しく入力してください" #: ../src/KasumiAddWindow.cc:304 msgid "Invalid entry for Spelling." msgstr "「単語」の項目を正しく入力してください" #: ../src/KasumiWordType.cc:36 ../src/KasumiWordType.cc:37 #: ../src/KasumiWordType.cc:38 ../src/KasumiWordType.cc:39 #: ../src/KasumiWordType.cc:40 ../src/KasumiWordType.cc:41 msgid "Noun" msgstr "名詞" #: ../src/KasumiWordType.cc:36 msgid "General Noun" msgstr "一般名詞" #: ../src/KasumiWordType.cc:37 msgid "followed by NA, SA and SURU" msgstr "「な」「さ」「する」に接続" #: ../src/KasumiWordType.cc:38 msgid "followed by NA and SA" msgstr "「な」「さ」に接続" #: ../src/KasumiWordType.cc:39 msgid "followed by NA and SURU" msgstr "「な」「する」に接続" #: ../src/KasumiWordType.cc:40 msgid "followed by NA" msgstr "「な」に接続" #: ../src/KasumiWordType.cc:41 ../src/KasumiWordType.cc:51 msgid "followed by SURU" msgstr "「する」に接続" #: ../src/KasumiWordType.cc:42 ../src/KasumiWordType.cc:43 #: ../src/KasumiWordType.cc:44 msgid "Proper Noun" msgstr "固有名詞" #: ../src/KasumiWordType.cc:42 msgid "Name of people" msgstr "人名" #: ../src/KasumiWordType.cc:43 msgid "Geographic Name" msgstr "地名" #: ../src/KasumiWordType.cc:44 msgid "Corporate Name" msgstr "会社名" #: ../src/KasumiWordType.cc:45 msgid "Numeral" msgstr "数詞" #: ../src/KasumiWordType.cc:46 msgid "Adjective (Keiyoushi)" msgstr "形容詞" #: ../src/KasumiWordType.cc:47 ../src/KasumiWordType.cc:48 #: ../src/KasumiWordType.cc:49 ../src/KasumiWordType.cc:50 #: ../src/KasumiWordType.cc:51 msgid "Adverb" msgstr "副詞" #: ../src/KasumiWordType.cc:47 msgid "General Adverb" msgstr "一般的な副詞" #: ../src/KasumiWordType.cc:48 msgid "followed by TO and TARU" msgstr "「と」「たる」に接続" #: ../src/KasumiWordType.cc:49 msgid "followed by TO and SURU" msgstr "「と」「する」に接続" #: ../src/KasumiWordType.cc:50 msgid "followed by TO" msgstr "「と」に接続" #: ../src/KasumiWordType.cc:52 msgid "Interjection" msgstr "感動詞・接続詞" #: ../src/KasumiWordType.cc:53 msgid "Adnominal adjunct" msgstr "連体詞" #: ../src/KasumiWordType.cc:54 msgid "Single Kanji Character" msgstr "単漢字" #: ../src/KasumiWordType.cc:55 ../src/KasumiWordType.cc:56 #: ../src/KasumiWordType.cc:57 ../src/KasumiWordType.cc:58 #: ../src/KasumiWordType.cc:59 ../src/KasumiWordType.cc:60 #: ../src/KasumiWordType.cc:61 ../src/KasumiWordType.cc:62 #: ../src/KasumiWordType.cc:63 msgid "Verb" msgstr "動詞" #: ../src/KasumiWordType.cc:55 ../src/KasumiWordType.cc:64 msgid "Ka 5" msgstr "カ行5段" #: ../src/KasumiWordType.cc:56 ../src/KasumiWordType.cc:65 msgid "Ga 5" msgstr "ガ行5段" #: ../src/KasumiWordType.cc:57 ../src/KasumiWordType.cc:66 msgid "Sa 5" msgstr "サ行5段" #: ../src/KasumiWordType.cc:58 ../src/KasumiWordType.cc:67 msgid "Ta 5" msgstr "タ行5段" #: ../src/KasumiWordType.cc:59 ../src/KasumiWordType.cc:68 msgid "Na 5" msgstr "ナ行5段" #: ../src/KasumiWordType.cc:60 ../src/KasumiWordType.cc:69 msgid "Ba 5" msgstr "バ行5段" #: ../src/KasumiWordType.cc:61 ../src/KasumiWordType.cc:70 msgid "Ma 5" msgstr "マ行5段" #: ../src/KasumiWordType.cc:62 ../src/KasumiWordType.cc:71 msgid "Ra 5" msgstr "ラ行5段" #: ../src/KasumiWordType.cc:63 ../src/KasumiWordType.cc:72 msgid "Wa 5" msgstr "ワ行5段" #: ../src/KasumiWordType.cc:64 ../src/KasumiWordType.cc:65 #: ../src/KasumiWordType.cc:66 ../src/KasumiWordType.cc:67 #: ../src/KasumiWordType.cc:68 ../src/KasumiWordType.cc:69 #: ../src/KasumiWordType.cc:70 ../src/KasumiWordType.cc:71 #: ../src/KasumiWordType.cc:72 msgid "Verb*" msgstr "動詞 (連用形が名詞)" #~ msgid "" #~ "If all the necessary items are filled in, add entered word and quit " #~ "registration." #~ msgstr "" #~ "全ての必要事項が埋められていたら、入力された単語を登録し、単語登録をしゅう" #~ "りょうします。" #~ msgid "If all the necessary items are filled in, add entered word." #~ msgstr "全ての必要事項が埋められていたら、入力された単語を追加します。" #~ msgid "Make the shift to manage mode to modify and remove registered words." #~ msgstr "単語の変更や削除が行える辞書管理モードに移行します。" #~ msgid "Save dictionary and quit this application." #~ msgstr "辞書を保存して、このアプリケーションを終了します。" #~ msgid "Add" #~ msgstr "追加" #~ msgid "Cancel" #~ msgstr "中断" #~ msgid "Quit" #~ msgstr "終了" #~ msgid "Edit" #~ msgstr "編集" #~ msgid "search" #~ msgstr "検索" #~ msgid "Cannot find a specific word. Search from first?" #~ msgstr "検索しても見つかりませんでした。最初から検索しますか?" #~ msgid "Cannot find a specific word." #~ msgstr "検索しても見つかりませんでした。" #~ msgid "Add mode" #~ msgstr "単語追加モード" #~ msgid "Word Class" #~ msgstr "品詞" #~ msgid "Person's name" #~ msgstr "人名" #~ msgid "Place-name" #~ msgstr "地名" #~ msgid "NA connection" #~ msgstr "な接続" #~ msgid "SA connection" #~ msgstr "さ接続" #~ msgid "Can be Bunnsetsu" #~ msgstr "語幹のみで文節" #~ msgid "KAKUJOSHI connection" #~ msgstr "格助詞接続" #~ msgid "TO connection" #~ msgstr "と接続" #~ msgid "TARU connection" #~ msgstr "たる接続" #~ msgid "VerbType" #~ msgstr "活用形" #~ msgid "Ba line, 5 columns" #~ msgstr "バ行五段活用" #~ msgid "Ga line, 5 columns" #~ msgstr "ガ行五段活用" #~ msgid "Ka line, 5 columns" #~ msgstr "カ行五段活用" #~ msgid "Ma line, 5 columns" #~ msgstr "マ行五段活用" #~ msgid "Na line, 5 columns" #~ msgstr "ナ行五段活用" #~ msgid "Ra line, 5 columns" #~ msgstr "ラ行五段活用" #~ msgid "Sa line, 5 columns" #~ msgstr "サ行五段活用" #~ msgid "Ta line, 5 columns" #~ msgstr "タ行五段活用" #~ msgid "Wa line, 5 columns" #~ msgstr "ワ行五段活用" #~ msgid "Can be Meishi when Renyou type" #~ msgstr "連用形の名詞化" #~ msgid "Find By Sound" #~ msgstr "読みで検索" #~ msgid "Store" #~ msgstr "保存" #~ msgid "New Word" #~ msgstr "新規作成" #~ msgid "Remove" #~ msgstr "削除" kasumi-2.5+debian2/src/000077500000000000000000000000001475414712000147455ustar00rootroot00000000000000kasumi-2.5+debian2/src/KasumiAddWindow.cc000066400000000000000000000415771475414712000203240ustar00rootroot00000000000000/********************************************************************* * * KasumiAddWindow.cxx * * Kasumi - a management tool for a private dictionary of anthy * * Copyright (C) 2004-2006 Takashi Nakamoto * Copyright (C) 2005 Takuro Ashie * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. * *********************************************************************/ #include #include #include #include "KasumiAddWindow.hh" #include "KasumiWord.hh" #include "KasumiDic.hh" #include "KasumiString.hh" #include "KasumiConfiguration.hh" #include "KasumiMainWindow.hh" #include #include "intl.h" extern "C"{ // ad-hoc solution for a defect of Anthy #include "anthy/dicutil.h" } #ifdef HAVE_CONFIG_H #include "config.h" #endif using namespace std; KasumiAddWindow::KasumiAddWindow(KasumiDic *aDictionary, KasumiConfiguration *conf){ this->conf = conf; bool IsEUCJP = conf->getPropertyValueByBool("UseEUCJP"); dictionary = aDictionary; window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_position (GTK_WINDOW(window), GTK_WIN_POS_MOUSE); gtk_window_set_title(GTK_WINDOW(window), _("Kasumi (Register words)")); g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(_call_back_add_window_delete_event), this); // creating vbox for text entries, spin button and so on. GtkWidget *vbox = gtk_vbox_new(FALSE,0); gtk_container_set_border_width(GTK_CONTAINER(vbox), 6); gtk_container_add(GTK_CONTAINER(window),vbox); // creating text entries for "Spelling" GtkWidget *label = gtk_label_new(_("Spelling")); GtkWidget *alignment = gtk_alignment_new(0, 0.5, 0, 0); gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 0, 0, 6, 6); gtk_container_add(GTK_CONTAINER(alignment),GTK_WIDGET(label)); gtk_box_pack_start(GTK_BOX(vbox),GTK_WIDGET(alignment),FALSE,FALSE,0); SpellingEntry = gtk_entry_new(); string spelling = conf->getPropertyValue("DefaultAddingSpelling"); if (IsEUCJP) spelling = KasumiWord::convertEUCJPToUTF8(spelling); gtk_entry_set_text(GTK_ENTRY(SpellingEntry), spelling.c_str()); alignment = gtk_alignment_new(0, 0.5, 1.0, 1.0); gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 0, 6, 6, 6); gtk_container_add(GTK_CONTAINER(alignment), SpellingEntry); gtk_box_pack_start(GTK_BOX(vbox),GTK_WIDGET(alignment),FALSE,FALSE,0); // creating text entries for "Sound" label = gtk_label_new(_("Sound")); alignment = gtk_alignment_new(0, 0.5, 0, 0); gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 0, 0, 6, 6); gtk_container_add(GTK_CONTAINER(alignment),GTK_WIDGET(label)); gtk_box_pack_start(GTK_BOX(vbox),GTK_WIDGET(alignment),FALSE,FALSE,0); SoundEntry = gtk_entry_new(); string sound = conf->getPropertyValue("DefaultAddingSound"); if (IsEUCJP) sound = KasumiWord::convertEUCJPToUTF8(sound); gtk_entry_set_text(GTK_ENTRY(SoundEntry), sound.c_str()); alignment = gtk_alignment_new(0, 0.5, 1.0, 1.0); gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 0, 6, 6, 6); gtk_container_add(GTK_CONTAINER(alignment), SoundEntry); gtk_box_pack_start(GTK_BOX(vbox),GTK_WIDGET(alignment),FALSE,FALSE,0); // creating spin button for "Frequency" label = gtk_label_new(_("Frequency")); alignment = gtk_alignment_new(0, 0.5, 0, 0); gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 0, 0, 6, 6); gtk_container_add(GTK_CONTAINER(alignment),GTK_WIDGET(label)); gtk_box_pack_start(GTK_BOX(vbox),GTK_WIDGET(alignment),FALSE,FALSE,0); const int FREQ_DEFAULT = conf->getPropertyValueByInt("DefaultFrequency"); const int FREQ_LBOUND = conf->getPropertyValueByInt("MinFrequency"); const int FREQ_UBOUND = conf->getPropertyValueByInt("MaxFrequency"); GtkAdjustment *adjustment = gtk_adjustment_new(FREQ_DEFAULT, FREQ_LBOUND, FREQ_UBOUND, 1, FREQ_UBOUND / 100 ,0); FrequencySpin = gtk_spin_button_new(GTK_ADJUSTMENT(adjustment),1.0,0); alignment = gtk_alignment_new(0, 0.5, 1.0, 1.0); gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 0, 6, 6, 6); gtk_container_add(GTK_CONTAINER(alignment), FrequencySpin); gtk_box_pack_start(GTK_BOX(vbox),GTK_WIDGET(alignment),FALSE,FALSE,0); // creating combo box for "Word Type" label = gtk_label_new(_("Word Type")); alignment = gtk_alignment_new(0, 0.5, 0, 0); gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 0, 0, 6, 6); gtk_container_add(GTK_CONTAINER(alignment),GTK_WIDGET(label)); gtk_box_pack_start(GTK_BOX(vbox),GTK_WIDGET(alignment),FALSE,FALSE,0); string defaultCannaTab = conf->getPropertyValue("DefaultAddingWordType"); GtkListStore *gWordTypeCategoryList = gtk_list_store_new(WORDTYPE_NUM_COLS,G_TYPE_STRING,G_TYPE_POINTER); GtkTreeIter iter; WordTypeList::iterator p = KasumiWordType::beginWordTypeList(); list wordCategoryList; while(p != KasumiWordType::endWordTypeList()) { string category = (*p)->getCategory(); if( find( wordCategoryList.begin(), wordCategoryList.end(), category ) == wordCategoryList.end() ) { wordCategoryList.push_back( category ); gtk_list_store_append(gWordTypeCategoryList,&iter); gtk_list_store_set(gWordTypeCategoryList,&iter, COL_UI_STRING, category.c_str(), COL_WORDTYPE_POINTER, (*p), -1); if((*p)->getCannaTab() == defaultCannaTab) defaultWordTypeCategoryIter = iter; } p++; } WordTypeCategoryCombo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(gWordTypeCategoryList)); GtkCellRenderer *renderer = GTK_CELL_RENDERER(gtk_cell_renderer_text_new()); gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(WordTypeCategoryCombo), renderer, TRUE); gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(WordTypeCategoryCombo), renderer, "text", COL_UI_STRING, NULL); gtk_combo_box_set_active_iter(GTK_COMBO_BOX(WordTypeCategoryCombo), &defaultWordTypeCategoryIter); alignment = gtk_alignment_new(0, 0.5, 1.0, 1.0); gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 0, 6, 6, 6); gtk_container_add(GTK_CONTAINER(alignment), WordTypeCategoryCombo); gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(alignment),FALSE,FALSE,0); g_signal_connect(G_OBJECT(WordTypeCategoryCombo),"changed", G_CALLBACK(_call_back_word_type_category_changed),this); // creating combo box for "Subcategory of Word Type" label = gtk_label_new(_("Subcategory of Word Type")); alignment = gtk_alignment_new(0, 0.5, 0, 0); gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 0, 0, 6, 6); gtk_container_add(GTK_CONTAINER(alignment),GTK_WIDGET(label)); gtk_box_pack_start(GTK_BOX(vbox),GTK_WIDGET(alignment),FALSE,FALSE,0); GtkListStore *gWordTypeList = gtk_list_store_new(WORDTYPE_NUM_COLS,G_TYPE_STRING,G_TYPE_POINTER); // dummy model WordTypeCombo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(gWordTypeList)); renderer = GTK_CELL_RENDERER(gtk_cell_renderer_text_new()); gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(WordTypeCombo), renderer, TRUE); gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(WordTypeCombo), renderer, "text", COL_UI_STRING, NULL); alignment = gtk_alignment_new(0, 0.5, 1.0, 1.0); gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 0, 12, 6, 6); gtk_container_add(GTK_CONTAINER(alignment), WordTypeCombo); gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(alignment),FALSE,FALSE,0); ChangeWordTypeList(true); // creating box for buttons GtkWidget *hbutton_box = gtk_hbutton_box_new(); gtk_box_set_spacing(GTK_BOX(hbutton_box),6); gtk_button_box_set_layout(GTK_BUTTON_BOX(hbutton_box),GTK_BUTTONBOX_SPREAD); gtk_box_pack_start(GTK_BOX(vbox),GTK_WIDGET(hbutton_box),FALSE,FALSE,6); if( conf->getPropertyValue("StartupMode") == "EXCLUSIVE" ) { GtkWidget *button = gtk_button_new_from_stock(GTK_STOCK_ADD); gtk_box_pack_start(GTK_BOX(hbutton_box),GTK_WIDGET(button),TRUE,TRUE,0); g_signal_connect(G_OBJECT(button),"clicked", G_CALLBACK(_call_back_add_window_add),this); gtk_widget_set_tooltip_text(button, _("Add entered word and quit registration.")); button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); gtk_box_pack_start(GTK_BOX(hbutton_box),GTK_WIDGET(button),TRUE,TRUE,0); g_signal_connect(G_OBJECT(button),"clicked", G_CALLBACK(_call_back_add_window_quit),this); gtk_widget_set_tooltip_text(button, _("Cancel registration and quit.")); gtk_window_set_keep_above(GTK_WINDOW(window), TRUE); } else { // ADD mode // creating buttons and configure shortcut key GtkWidget *button = gtk_button_new_from_stock(GTK_STOCK_ADD); gtk_box_pack_start(GTK_BOX(hbutton_box),GTK_WIDGET(button),TRUE,TRUE,0); g_signal_connect(G_OBJECT(button),"clicked", G_CALLBACK(_call_back_add_window_add),this); gtk_widget_set_tooltip_text (button, _("Add entered word")); button = gtk_button_new_from_stock(GTK_STOCK_EDIT); gtk_box_pack_start(GTK_BOX(hbutton_box),GTK_WIDGET(button),TRUE,TRUE,0); g_signal_connect(G_OBJECT(button),"clicked", G_CALLBACK(_call_back_manage_mode),this); gtk_widget_set_tooltip_text (button, _("Manage mode")); button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); gtk_box_pack_start(GTK_BOX(hbutton_box),GTK_WIDGET(button),TRUE,TRUE,0); g_signal_connect(G_OBJECT(button),"clicked", G_CALLBACK(_call_back_add_window_quit),this); gtk_widget_set_tooltip_text (button, _("Quit this application")); // get selection at the time of launching g_signal_connect(G_OBJECT(SpellingEntry),"selection_received", G_CALLBACK(_call_back_selection_data_received),NULL); } gtk_widget_show_all(window); // resize window appropriate size gtk_window_reshow_with_initial_size(GTK_WINDOW(window)); gtk_window_set_resizable(GTK_WINDOW(window),true); // set default window position // int x = conf->getPropertyValueByInt("DefaultWindowPosX"); // int y = conf->getPropertyValueByInt("DefaultWindowPosY"); // if(x >= 0 && y >= 0){ // gtk_window_move(GTK_WINDOW(window),x,y); // } if(conf->getPropertyValue("DefaultAddingSpelling") == "" && conf->getPropertyValueByBool("ImportSelectedText")){ get_targets(SpellingEntry); } } KasumiAddWindow::~KasumiAddWindow(){ destroy(); } void KasumiAddWindow::destroy(){ gtk_widget_destroy(window); } void KasumiAddWindow::quit(){ dictionary->store(); // anthy_dic_util_quit(); delete dictionary; delete this; gtk_main_quit(); } void KasumiAddWindow::ClickedAddButton(GtkWidget *widget){ KasumiWord *word = KasumiWord::createNewWord(conf); try{ // register entered word if(string(gtk_entry_get_text(GTK_ENTRY(SoundEntry))) == ""){ GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW(window), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, _("Invalid entry for Sound.")); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); delete(word); return; } word->setSoundByUTF8(string(gtk_entry_get_text(GTK_ENTRY(SoundEntry)))); if(string(gtk_entry_get_text(GTK_ENTRY(SpellingEntry))) == ""){ GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW(window), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, _("Invalid entry for Spelling.") ); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); delete(word); return; } word->setSpellingByUTF8(string(gtk_entry_get_text( GTK_ENTRY(SpellingEntry)))); word->setFrequency(gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON(FrequencySpin))); GtkTreeIter iter; KasumiWordType *type; GtkTreeModel *model = gtk_combo_box_get_model(GTK_COMBO_BOX(WordTypeCombo)); gtk_combo_box_get_active_iter(GTK_COMBO_BOX(WordTypeCombo), &iter); gtk_tree_model_get(model, &iter, COL_WORDTYPE_POINTER, &type, -1); word->setWordType(type); dictionary->appendWord(word); string mode = conf->getPropertyValue("StartupMode"); if( mode == "EXCLUSIVE" ) { cout << word->getSpelling() << "," << word->getSound() << "," << word->getFrequency() << "," << word->getWordType()->getCannaTab() << endl; quit(); } else if( mode == "ADD" ) { gtk_entry_set_text(GTK_ENTRY(SoundEntry), ""); gtk_entry_set_text(GTK_ENTRY(SpellingEntry), ""); const int FREQ_DEFAULT = conf->getPropertyValueByInt("DefaultFrequency"); gtk_spin_button_set_value(GTK_SPIN_BUTTON(FrequencySpin),FREQ_DEFAULT); gtk_combo_box_set_active_iter(GTK_COMBO_BOX(WordTypeCategoryCombo), &defaultWordTypeCategoryIter); ChangeWordTypeList(true); } }catch(KasumiException e){ handleException(e); } } void KasumiAddWindow::SwitchToManageMode(){ new KasumiMainWindow(dictionary,conf); delete this; } void KasumiAddWindow::ChangeWordTypeList(bool toDefault = false){ GtkTreeIter iter; GtkTreeIter defaultIter; bool defaultFlag = false; KasumiWordType *tmp; string category; string defaultCannaTab = conf->getPropertyValue("DefaultAddingWordType"); gtk_combo_box_get_active_iter(GTK_COMBO_BOX(WordTypeCategoryCombo), &iter); gtk_tree_model_get(gtk_combo_box_get_model( GTK_COMBO_BOX(WordTypeCategoryCombo)), &iter, COL_WORDTYPE_POINTER, &tmp, -1 ); category = tmp->getCategory(); GtkListStore *gWordTypeList = gtk_list_store_new(WORDTYPE_NUM_COLS,G_TYPE_STRING,G_TYPE_POINTER); WordTypeList::iterator p = KasumiWordType::beginWordTypeList(); while(p != KasumiWordType::endWordTypeList()) { if( (*p)->getCategory() == category ) { gtk_list_store_append(gWordTypeList,&iter); if( (*p)->getPos().size() != 0 ) gtk_list_store_set(gWordTypeList,&iter, COL_UI_STRING, (*p)->getPos().c_str(), COL_WORDTYPE_POINTER, (*p), -1); else gtk_list_store_set(gWordTypeList,&iter, COL_UI_STRING, (*p)->getCategory().c_str(), COL_WORDTYPE_POINTER, (*p), -1); if( (*p)->getCannaTab() == defaultCannaTab ) { defaultFlag = true; defaultIter = iter; } } p++; } gtk_combo_box_set_model(GTK_COMBO_BOX(WordTypeCombo), GTK_TREE_MODEL(gWordTypeList)); if( defaultFlag && toDefault ) gtk_combo_box_set_active_iter(GTK_COMBO_BOX(WordTypeCombo), &defaultIter); else gtk_combo_box_set_active(GTK_COMBO_BOX(WordTypeCombo), 0); } void _call_back_add_window_delete_event(GtkWidget *widget, GdkEvent *event, gpointer data){ KasumiAddWindow *window = (KasumiAddWindow *)data; window->quit(); } void _call_back_add_window_quit(GtkWidget *widget, gpointer data){ KasumiAddWindow *window = (KasumiAddWindow *)data; window->quit(); } void _call_back_add_window_add(GtkWidget *widget, gpointer data){ KasumiAddWindow *window = (KasumiAddWindow *)data; window->ClickedAddButton(widget); } void _call_back_manage_mode(GtkWidget *widget, gpointer data){ KasumiAddWindow *window = (KasumiAddWindow *)data; window->SwitchToManageMode(); } // to set selected string to SpellingEntry void _call_back_selection_data_received(GtkWidget *widget, GtkSelectionData *selection_data, gpointer data){ if(gtk_selection_data_get_length (selection_data) < 0){ // failed retrieving selection // do nothing return; } string atom_name = string(gdk_atom_name(gtk_selection_data_get_data_type (selection_data))); const gchar *str = reinterpret_cast(gtk_selection_data_get_data (selection_data)); if(atom_name == "UTF8_STRING"){ gtk_entry_set_text(GTK_ENTRY(widget), str); } return; } // to get selected string void get_targets(GtkWidget *data){ static GdkAtom targets_atom = GDK_NONE; GtkWidget *window = (GtkWidget *)data; targets_atom = gdk_atom_intern("UTF8_STRING", FALSE); gtk_selection_convert(window, GDK_SELECTION_PRIMARY, targets_atom, GDK_CURRENT_TIME); } void _call_back_word_type_category_changed(GtkWidget *widget, gpointer data) { KasumiAddWindow *window = (KasumiAddWindow *)data; window->ChangeWordTypeList(); } kasumi-2.5+debian2/src/KasumiAddWindow.hh000066400000000000000000000064501475414712000203250ustar00rootroot00000000000000/********************************************************************* * * KasumiAddWindow.hh * * Kasumi - a management tool for a private dictionary of anthy * * Copyright (C) 2004-2006 Takashi Nakamoto * Copyright (C) 2006 Ikuya Awashiro * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. * *********************************************************************/ #ifndef __KASUMI_ADD_WINDOW_HXX__ #define __KASUMI_ADD_WINDOW_HXX__ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "KasumiDic.hh" #include "KasumiWord.hh" #include "KasumiConfiguration.hh" void _call_back_add_window_delete_event(GtkWidget *widget, GdkEvent *event, gpointer data); void _call_back_add_window_quit(GtkWidget *widget, gpointer data); void _call_back_add_window_add(GtkWidget *widget, gpointer data); void _call_back_manage_mode(GtkWidget *widget, gpointer data); void _call_back_selection_data_received(GtkWidget *widget, GtkSelectionData *selection_data, gpointer data); void _call_back_word_type_category_changed(GtkWidget *widget, gpointer data); class KasumiAddWindow{ friend void _call_back_add_window_delete_event(GtkWidget *widget, GdkEvent *event, gpointer data); friend void _call_back_add_window_quit(GtkWidget *widget, gpointer data); friend void _call_back_add_window_add(GtkWidget *widget, gpointer data); friend void _call_back_manage_mode(GtkWidget *widget, gpointer data); friend void _call_back_add_window_changed_word_type_combo(GtkWidget *widget, gpointer data); friend void _call_back_selection_data_received(GtkWidget *widget, GtkSelectionData *selection_data, gpointer data) ; friend void _call_back_word_type_category_changed(GtkWidget *widget, gpointer data); private: KasumiDic *dictionary; KasumiConfiguration *conf; GtkWidget *window; GtkWidget *SpellingEntry; GtkWidget *SoundEntry; GtkWidget *FrequencySpin; GtkWidget *WordTypeCategoryCombo; GtkWidget *WordTypeCombo; GtkTreeIter defaultWordTypeCategoryIter; void destroy(); void quit(); void ClickedAddButton(GtkWidget *widget); void SwitchToManageMode(); void ChangeWordTypeList( bool toDefault ); public: KasumiAddWindow(KasumiDic *aDictionary, KasumiConfiguration *conf); ~KasumiAddWindow(); }; void get_targets(GtkWidget *data); #endif kasumi-2.5+debian2/src/KasumiConfiguration.cc000066400000000000000000000355051475414712000212450ustar00rootroot00000000000000/********************************************************************* * * KasumiConfiguration.cxx * * Kasumi - a management tool for a private dictionary of anthy * * Copyright (C) 2004-2006 Takashi Nakamoto * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. * *********************************************************************/ #include #include #include #include #include #include /* for getopt_long() */ #include #include "KasumiConfiguration.hh" #include "KasumiException.hh" #include "KasumiString.hh" #include "KasumiWordType.hh" #include "intl.h" #ifdef HAVE_CONFIG_H #include "config.h" #endif using namespace std; // if you want to add a new configuration settings, do the following: // 1. Set default value: Add a line to loadDefaultProperties() method // like; // config[string("NewKey")] = string("DefaultValue"); // 2. Add check routine for validating the setting in checkValidity method. // If it accepts only an integer value, it is the best to add the new key's // name to intValueKeyNames list like; // intValueKeyNames.push_back("NewKey"); // Or if it is a shortcut key setting, add the new key's name to keyName // list like: // keyName.push_back("NewKey"); // 3. If the setting may be set by command line arguments, add some routines // to loadConfigurationFromArgument method KasumiConfiguration::KasumiConfiguration(int argc, char *argv[]) throw(KasumiException){ try{ loadDefaultProperties(); // ~/.kasumi must be encoded in EUC-JP char *home = getenv("HOME"); if(home == NULL){ throw KasumiException(string("Cannot find $HOME environment variable."), STDERR, KILL); } ConfFileName = string(home) + "/.kasumi"; loadConfigurationFile(); }catch(KasumiException e){ throw e; } loadConfigurationFromArgument(argc, argv); checkValidity(); } KasumiConfiguration::~KasumiConfiguration(){ saveConfiguration(); } void KasumiConfiguration::loadDefaultProperties() throw(KasumiException){ char *home = getenv("HOME"); if(home == NULL){ throw KasumiException(string("Cannot find $HOME environment variable."), STDERR, KILL); } config[string("StartupMode")] = string("MANAGE"); config[string("DefaultFrequency")] = string("500"); config[string("MaxFrequency")] = string("1000"); config[string("MinFrequency")] = string("1"); // config[string("QuitShortcutKey")] = string("Ctrl+Q"); // config[string("StoreShortcutKey")] = string("Ctrl+S"); // config[string("NewWordShortcutKey")] = string("Ctrl+N"); // config[string("RemoveShortcutKey")] = string("Ctrl+R"); // config[string("AddShortcutKey")] = string("Ctrl+A"); // config[string("AddingModeShortcutKey")] = string("Ctrl+J"); // config[string("ManageModeShortcutKey")] = string("Ctrl+M"); config[string("DefaultSpelling")] = string(""); config[string("DefaultSound")] = string(""); config[string("DefaultWordType")] = string("#T35"); config[string("DefaultAddingSpelling")] = string(""); config[string("DefaultAddingSound")] = string(""); config[string("DefaultAddingWordType")] = string("#T35"); // config[string("DefaultWindowPosX")] = string("-1"); // config[string("DefaultWindowPosY")] = string("-1"); config[string("ImportSelectedText")] = string("true"); #ifdef HAS_ANTHY_DICUTIL_SET_ENCODING config[string("UseEUCJP")] = string("false"); #else // HAS_ANTHY_DICUTIL_SET_ENCODING config[string("UseEUCJP")] = string("true"); #endif // HAS_ANTHY_DICUTIL_SET_ENCODING } void KasumiConfiguration::loadConfigurationFromArgument(int argc, char *argv[]) throw(KasumiException){ int option_index = 0; static struct option long_options[] = { {"help", no_argument, NULL, 'h'}, {"version", no_argument, NULL, 'v'}, {"add", no_argument, NULL, 'a'}, {"exclusive", no_argument, NULL, 'e'}, {"manage", no_argument, NULL, 'm'}, {"sound", required_argument, NULL, 's'}, {"spelling", required_argument, NULL, 't'}, {"wordclass", required_argument, NULL, 'w'}, // {"x", required_argument, NULL, 'x'}, // {"y", required_argument, NULL, 'y'}, {"import", no_argument, NULL, 'i'}, {"ignore", no_argument, NULL, 'I'}, #ifdef HAS_ANTHY_DICUTIL_SET_ENCODING {"eucjp", no_argument, NULL, 'E'}, #endif // HAS_ANTHY_DICUTIL_SET_ENCODING {0,0,0,0} }; string message; int c; while(1){ // c = getopt_long(argc, argv, "hvamiIns:t:w:x:y:", long_options, &option_index); #ifdef HAS_ANTHY_DICUTIL_SET_ENCODING c = getopt_long(argc, argv, "hvaemiInEs:t:w:", long_options, &option_index); #else // HAS_ANTHY_DICUTIL_SET_ENCODING c = getopt_long(argc, argv, "hvaemiIns:t:w:", long_options, &option_index); #endif // HAS_ANTHY_DICUTIL_SET_ENCODING if(c == -1) break; // no more argument switch(c){ case 'h': setPropertyValue(string("StartupMode"),string("HELP")); break; case 'v': setPropertyValue(string("StartupMode"),string("VERSION")); break; case 'a': setPropertyValue(string("StartupMode"),string("ADD")); break; case 'm': setPropertyValue(string("StartupMode"),string("MANAGE")); break; case 'e': setPropertyValue(string("StartupMode"),string("EXCLUSIVE")); break; case 's': setPropertyValue(string("DefaultAddingSound"),string(optarg)); break; case 't': setPropertyValue(string("DefaultAddingSpelling"),string(optarg)); break; case 'w': setPropertyValue(string("DefaultAddingWordType"),string(optarg)); break; // case 'x': // setPropertyValue(string("DefaultWindowPosX"),string(optarg)); // break; // case 'y': // setPropertyValue(string("DefaultWindowPosY"),string(optarg)); // break; case 'i': setPropertyValue(string("ImportSelectedText"),string("true")); break; case 'I': setPropertyValue(string("ImportSelectedText"),string("false")); break; case 'E': setPropertyValue(string("UseEUCJP"),string("true")); break; case '?': case ':': message = string("Invalid argument error. Try '") + argv[0] + string(" --help' for more information."); throw KasumiException(message, STDERR, KILL); break; } } if(optind < argc){ message = string("Found non-option argument '") + argv[optind] + string("'. Try '") + argv[0] + string(" --help' for more information."); throw KasumiException(message, STDERR, KILL); } } void KasumiConfiguration::loadConfigurationFile() throw(KasumiException){ int line = 0; string Contents = string(); KasumiString Buffer; ifstream ConfFile(ConfFileName.c_str()); if(!ConfFile.is_open()){ return; // do not load configuration file } // analyze Kasumi Configuration file reading each line while(getline(ConfFile, Buffer, '\n')){ line++; if(Buffer.isCommentLine()){ // commented line; nothing to do }else if(Buffer.isEmptyLine()){ // empty line; nothing to do }else if(Buffer.isKeyValLine()){ config[Buffer.getKey()] = Buffer.getVal(); }else{ // not classfied line; configuration file is invalid! string message = ConfFileName + string(":") + int2str(line) + string(": invalid entry in configuration file."); throw KasumiException(message, STDERR, KILL); } } } // ToDo: implement saveConfiguration method void KasumiConfiguration::saveConfiguration() throw(KasumiException){ } void KasumiConfiguration::checkValidity() throw(KasumiException){ if(config[string("StartupMode")] != string("MANAGE") && config[string("StartupMode")] != string("ADD") && config[string("StartupMode")] != string("EXCLUSIVE") && config[string("StartupMode")] != string("HELP") && config[string("StartupMode")] != string("VERSION")){ string message("StartupMode variable must be \"MANAGE\", \"EXCLUSIVE\" or \"ADD\""); throw KasumiException(message, STDERR, KILL); } // check conrresponding settings being an integer list intValueKeyNames; intValueKeyNames.push_back(string("DefaultFrequency")); intValueKeyNames.push_back(string("MaxFrequency")); intValueKeyNames.push_back(string("MinFrequency")); // intValueKeyNames.push_back(string("DefaultWindowPosX")); // intValueKeyNames.push_back(string("DefaultWindowPosY")); while(!intValueKeyNames.empty()){ string keyName = intValueKeyNames.front(); intValueKeyNames.pop_front(); if(!isInt(config[keyName])){ string message = keyName + string(" variable must be an integer"); throw KasumiException(message, STDERR, KILL); } } // check integer value are suitable int def = str2int(config[string("DefaultFrequency")]); int max = str2int(config[string("MaxFrequency")]); int min = str2int(config[string("MinFrequency")]); if(min < 1){ throw KasumiException(string("MinFrequency must be greater than 0"), STDERR, KILL); }else if(max < min){ throw KasumiException(string("MinFrequency must not be greater than MaxFrequency."), STDERR, KILL); }else if(def > max){ throw KasumiException(string("DefaultFrequency must not be greater than MaxFrequency"), STDERR, KILL); }else if(def < min){ throw KasumiException(string("DefaultFrequency must not be less than MinFrequency"), STDERR, KILL); } // int x = str2int(config[string("DefaultWindowPosX")]); // int y = str2int(config[string("DefaultWindowPosY")]); // if(x < -1){ // throw KasumiException(string("DefaultWindowPosX must be -1 or more"), // STDERR, KILL); // }else if(y < -1){ // throw KasumiException(string("DefaultWindowPosY must be -1 or more"), // STDERR, KILL); // } // check key configurations // throws exeption if there is an invalid key or duplication // map registeredKey; // list keyNames; // keyNames.push_back(string("QuitShortcutKey")); // keyNames.push_back(string("StoreShortcutKey")); // keyNames.push_back(string("NewWordShortcutKey")); // keyNames.push_back(string("RemoveShortcutKey")); // keyNames.push_back(string("AddShortcutKey")); // keyNames.push_back(string("AddingModeShortcutKey")); // keyNames.push_back(string("ManageModeShortcutKey")); // while(!keyNames.empty()){ // string keyName = keyNames.front(); // keyNames.pop_front(); // // string shortKey = config[string(keyName)]; // if(!isValidShortcutKey(shortKey)){ // string message = string("Invalid shortcut key configuration for ") + // keyName + string(": ") + shortKey; // throw KasumiException(message, STDERR, KILL); // } // if(registeredKey.find(shortKey) == registeredKey.end()){ // registeredKey.insert(make_pair(shortKey,keyName)); // }else{ // string message = string("Failed to set ") + keyName + string(" variable; ") + shortKey + string(" has been already registered as ") + registeredKey[shortKey]; // throw KasumiException(message, STDERR, KILL); // } // } // check WordType configuration list keyForWordType; map validWordType; keyForWordType.push_back(string("DefaultWordType")); keyForWordType.push_back(string("DefaultAddingWordType")); WordTypeList::iterator p = KasumiWordType::beginWordTypeList(); while(p != KasumiWordType::endWordTypeList()) { validWordType.insert(make_pair((*p)->getCannaTab(),true)); p++; } while(!keyForWordType.empty()){ string keyName = keyForWordType.front(); keyForWordType.pop_front(); string val = config[keyName]; if(validWordType.find(val) == validWordType.end()){ string message = val + string(" is an invalid word type for ") + keyName; throw KasumiException(message, STDERR, KILL); } } // check conrresponding settings being an boolean list booleanValueKeyNames; booleanValueKeyNames.push_back(string("ImportSelectedText")); while(!booleanValueKeyNames.empty()){ string keyName = booleanValueKeyNames.front(); booleanValueKeyNames.pop_front(); if(config[keyName] != "true" && config[keyName] != "false"){ throw KasumiException(keyName + string(" variable must be a boolean"), STDERR, KILL); } } // no check for: // DefaultSpelling // DefaultSound // DefaultAddingSpelling // DefaultAddingSound // ToDo: confirm default sounds do not have invalid character } void KasumiConfiguration::setPropertyValue(const string &name, const string &value){ map::iterator p; p = config.find(name); if(p == config.end()){ cerr << "error: you cannot set " << name << " property." << endl; exit(1); } config[name] = value; } string KasumiConfiguration::getPropertyValue(const string &name){ map::iterator p; p = config.find(name); if(p == config.end()){ cerr << "error: " << name << " property has not been set yet." << endl; exit(1); } return p->second; } int KasumiConfiguration::getPropertyValueByInt(const string &name){ map::iterator p; p = config.find(name); if(p == config.end()){ cerr << "error: " << name << " property has not been set yet." << endl; exit(1); } return str2int(p->second); } bool KasumiConfiguration::getPropertyValueByBool(const string &name){ map::iterator p; p = config.find(name); if(p == config.end()){ cerr << "error: " << name << " property has not been set yet." << endl; exit(1); } if(p->second == "true"){ return true; } else{ return false; } } /* bool isValidShortcutKey(const string &key){ string::size_type i; i = key.find("+",0); string shortkey = key.substr(i+1); if(shortkey.length() != 1){ return false; } char c = shortkey.c_str()[0]; if((c < 'A' || c > 'Z') && (c < '0' || c > '9')){ return false; } i = key.find("+",0); if(i == key.npos){ return true; } string mask = key.substr(0,i); if(mask == "Ctrl"){ return true; }else if(mask == "Alt"){ return true; } return false; } */ kasumi-2.5+debian2/src/KasumiConfiguration.hh000066400000000000000000000036471475414712000212610ustar00rootroot00000000000000/********************************************************************* * * KasumiConfiguration.hh * * Kasumi - a management tool for a private dictionary of anthy * * Copyright (C) 2004-2006 Takashi Nakamoto * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. * *********************************************************************/ #ifndef __KASUMI_CONFIGURATION_HXX__ #define __KASUMI_CONFIGURATION_HXX__ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "KasumiException.hh" class KasumiConfiguration{ private: map config; string ConfFileName; void loadDefaultProperties() throw(KasumiException); void loadConfigurationFile() throw (KasumiException); void loadConfigurationFromArgument(int argc, char *argv[]) throw(KasumiException); void saveConfiguration() throw (KasumiException); void setPropertyValue(const string &name, const string &value); void checkValidity() throw(KasumiException); public: KasumiConfiguration(int argc, char *argv[]) throw (KasumiException); ~KasumiConfiguration(); string getPropertyValue(const string &name); int getPropertyValueByInt(const string &name); bool getPropertyValueByBool(const string &name); }; bool isValidShortcutKey(const string &key); #endif kasumi-2.5+debian2/src/KasumiDic.cc000066400000000000000000000177521475414712000171410ustar00rootroot00000000000000/********************************************************************* * * KasumiDic.cxx * * Kasumi - a management tool for a private dictionary of anthy * * Copyright (C) 2004-2006 Takashi Nakamoto * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. * *********************************************************************/ #include "KasumiDic.hh" #include "KasumiWord.hh" #include "KasumiString.hh" #include "KasumiException.hh" #include "KasumiConfiguration.hh" extern "C"{ // ad-hoc solution for a defect of Anthy #include } #include #include #include #include #include #include #include #include #include using namespace std; #define OptionOutput( Word, OptionName ) (string(OptionName) + " = " + (Word->getOption(OptionName) ? "y" : "n")) #define BUFFER_SIZE (255) KasumiDic::KasumiDic(KasumiConfiguration *conf) throw(KasumiException){ try{ load(conf); }catch(KasumiException e){ throw e; } } KasumiDic::~KasumiDic() { list::iterator p; while(!mWordList.empty()) { p = mWordList.begin(); mWordList.pop_front(); delete (*p); } } void KasumiDic::load(KasumiConfiguration *conf) throw(KasumiException){ const int FREQ_LBOUND = conf->getPropertyValueByInt("MinFrequency"); const int FREQ_UBOUND = conf->getPropertyValueByInt("MaxFrequency"); // "anthy" on Debian uses forked upstream source based on 9100h-25 // with its upstream version numbered as 0.3 on buster/sid as of 2018/July // while handling version order issue with "epoch" trick. // // Debian anthy packages as of 2018/July // o-o-stable: 9100h-16 wheezy // oldstable: 9100h-24 jessie // stable: 9100h-25 stretch // testing: 1:0.3-7 buster // unstable: 1:0.3-7 sid // // "kasumi" assumes version number is like 9100 and address issues with very // old version before 7716. // When conversting version string to number, "kasumi" assumes it is an // integer which can be conversted by atoi(). Also, "kasumi" performed // assertion operation to check this atoi() produced real number other than // 0. With the recent upstream version of Debian forked source, version 0.3 // becomes 0 and its assertion fails as reported on BTS: #885918 // https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=885918 // // Since pre-7716 version of "anthy" is non-existing, it is most simple to // remove code addressing re-7716 version of "anthy". In order to keep this // somewhat invasive change, I keep the pertinent lines commented out by this // patch. try{ if(anthy_priv_dic_select_first_entry() == -1){ // no word return; } else if(anthy_priv_dic_select_first_entry() == -3) { // always through exception since anthy is post 7716 version. string message = string("Failed to read private dictionary. This problem might be a problem of Anthy.\n"); throw KasumiException(message, STDERR, KILL); } char sound[BUFFER_SIZE], wt[BUFFER_SIZE], spelling[BUFFER_SIZE]; int freq; do{ if (anthy_priv_dic_get_index(sound, BUFFER_SIZE) && anthy_priv_dic_get_wtype(wt, BUFFER_SIZE) && anthy_priv_dic_get_word(spelling, BUFFER_SIZE)) { freq = anthy_priv_dic_get_freq(); // corret frequency value crossing the bounds if(FREQ_LBOUND > freq) freq = FREQ_LBOUND; if(FREQ_UBOUND < freq) freq = FREQ_UBOUND; KasumiWord *newWord = KasumiWord::createNewWord(conf); newWord->setSound(string(sound)); // anthy is post 7710 version. newWord->setSpelling(string(spelling)); newWord->setFrequency(freq); newWord->setWordType(KasumiWordType::getWordTypeFromCannaTab(string(wt))); appendWord(newWord); } }while(anthy_priv_dic_select_next_entry() == 0); }catch(KasumiException e){ throw e; } } void KasumiDic::appendWord(KasumiWord *word){ // check duplication list::iterator p = mWordList.begin(); while(p != mWordList.end() ) { if((*p)->getID() == word->getID()) return; // nothing to do p++; } word->registerEventListener(this); mWordList.push_back(word); // raise event for(size_t i=0;iappendedWord(word); } } void KasumiDic::removeWord(unsigned int id) { int flag = 0; list::iterator p = mWordList.begin(); while(p != mWordList.end() ) { if((*p)->getID() == id) { mWordList.erase(p); (*p)->removeEventListener(this); free(*p); flag = 1; break; } p++; } // raise event if(flag) for(size_t i=0;iremovedWord(id); } } void KasumiDic::store() throw(KasumiException) { list::iterator p = mWordList.begin(); anthy_priv_dic_delete(); while( p != mWordList.end() ) { string spelling = (*p)->getSpelling(); string sound = (*p)->getSound(); string wt = (*p)->getWordType()->getCannaTab(); int freq = (*p)->getFrequency(); int ret = anthy_priv_dic_add_entry(sound.c_str(), spelling.c_str(), wt.c_str(), freq); if (ret == -1) { throw KasumiException(string("Failed to register") + sound, ERR_DIALOG, KILL); } p++; } } void KasumiDic::registerEventListener(KasumiDicEventListener *listener){ int i,size; size = EventListeners.size(); // if the listener have been already registered, nothing to do // assuring no duplication for(i=0;i::iterator i; KasumiDicEventListener *p; for(i=EventListeners.begin();i!=EventListeners.end();i++){ p = *i; if(p == listener){ EventListeners.erase(i); return; } } } void KasumiDic::changedFrequency(KasumiWord *word) { for(size_t i=0;imodifiedWord(word); } } void KasumiDic::changedSpelling(KasumiWord *word) { for(size_t i=0;imodifiedWord(word); } } void KasumiDic::changedSound(KasumiWord *word) { for(size_t i=0;imodifiedWord(word); } } void KasumiDic::changedWordType(KasumiWord *word) { for(size_t i=0;imodifiedWord(word); } } /* // for debug // // % g++ -g KasumiDic.cxx KasumiWord.cxx KasumiException.cxx KasumiConfiguration.cxx KasumiWordType.cxx KasumiString.cxx `pkg-config --libs --cflags anthy gtk+-2.0` void output(KasumiDic *dic) { list::iterator p = dic->firstWordIter(); while(p != dic->endWordIter()){ cout << (*p)->getID() << " " << (*p)->getSpelling() << endl; p++; } } int main(int argc, char *argv[]) { anthy_dic_util_init(); KasumiWordType::initWordTypeList(); KasumiConfiguration *conf = new KasumiConfiguration(argc, argv); KasumiDic *dic = new KasumiDic(conf); KasumiWord *word = KasumiWord::createNewWord(conf); word->setSpellingByUTF8("テスト"); word->setSoundByUTF8("てすと"); dic->appendWord(word); output(dic); while(1); dic->removeWord(1); output(dic); } */ kasumi-2.5+debian2/src/KasumiDic.hh000066400000000000000000000045451475414712000171470ustar00rootroot00000000000000/********************************************************************* * * KasumiDic.hh * * Kasumi - a management tool for a private dictionary of anthy * * Copyright (C) 2004-2006 Takashi Nakamoto * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. * *********************************************************************/ #ifndef __KASUMI_DIC_HXX__ #define __KASUMI_DIC_HXX__ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include "KasumiWord.hh" #include "KasumiException.hh" #include "KasumiDicEventListener.hh" #include "KasumiWordEventListener.hh" #include "KasumiConfiguration.hh" #define ERROR 0 #define VALID 1 using namespace std; class KasumiDic : public KasumiWordEventListener{ private: list mWordList; vector EventListeners; void load(KasumiConfiguration *conf) throw (KasumiException); public: KasumiDic(KasumiConfiguration *conf) throw(KasumiException); ~KasumiDic(); void store() throw(KasumiException); void appendWord(KasumiWord *word); // returns this word's ID void removeWord(unsigned int id); void registerEventListener(KasumiDicEventListener *listener); void removeEventListener(KasumiDicEventListener *listener); list::iterator firstWordIter(){ return mWordList.begin(); }; list::iterator endWordIter(){ return mWordList.end(); }; void changedFrequency(KasumiWord *word); void changedSpelling(KasumiWord *word); void changedSound(KasumiWord *word); void changedWordType(KasumiWord *word); // KasumiWord *getWordWithID(unsigned int id) throw(KasumiException); // int getUpperBoundOfWordID(); }; #endif kasumi-2.5+debian2/src/KasumiDicEventListener.hh000066400000000000000000000026411475414712000216520ustar00rootroot00000000000000/********************************************************************* * * KasumiDicEventListener.hh * * Kasumi - a management tool for a private dictionary of anthy * * Copyright (C) 2004-2006 Takashi Nakamoto * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. * *********************************************************************/ #ifndef __KASUMI_DIC_EVENT_LISTENER_HXX__ #define __KASUMI_DIC_EVENT_LISTENER_HXX__ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "KasumiWord.hh" class KasumiDicEventListener{ private: public: virtual ~KasumiDicEventListener() {}; virtual void removedWord(unsigned int id) = 0; virtual void appendedWord(KasumiWord *word) = 0; virtual void modifiedWord(KasumiWord *word) = 0; }; #endif kasumi-2.5+debian2/src/KasumiException.cc000066400000000000000000000044271475414712000203730ustar00rootroot00000000000000/********************************************************************* * * KasumiException.cxx * * Kasumi - a management tool for a private dictionary of anthy * * Copyright (C) 2004-2006 Takashi Nakamoto * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. * *********************************************************************/ #include #include #include #include "KasumiException.hh" #ifdef HAVE_CONFIG_H #include "config.h" #endif using namespace std; void handleException(KasumiException e){ GtkWidget *dialog; switch(e.getOutput()){ case STDERR: cerr << e.getMessage() << endl; break; case STDOUT: cout << e.getMessage() << endl; break; case ERR_DIALOG: dialog = gtk_message_dialog_new(NULL, (GtkDialogFlags)0, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "%s", e.getMessage().c_str()); gtk_dialog_run(GTK_DIALOG (dialog)); gtk_widget_destroy(dialog); break; case WARNING_DIALOG: dialog = gtk_message_dialog_new(NULL, (GtkDialogFlags)0, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, "%s", e.getMessage().c_str()); gtk_dialog_run(GTK_DIALOG (dialog)); gtk_widget_destroy(dialog); break; } switch(e.getDisposal()){ case KILL: exit(1); break; case QUIT: exit(0); break; case ALERT_ONLY: // nothing to do break; } } kasumi-2.5+debian2/src/KasumiException.hh000066400000000000000000000033061475414712000204000ustar00rootroot00000000000000/********************************************************************* * * KasumiException.hh * * Kasumi - a management tool for a private dictionary of anthy * * Copyright (C) 2004-2006 Takashi Nakamoto * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. * *********************************************************************/ #ifndef __KASUMI_EXCEPTION_HXX__ #define __KASUMI_EXCEPTION_HXX__ #ifdef HAVE_CONFIG_H #include "config.h" #endif using namespace std; enum _output {STDOUT, STDERR, ERR_DIALOG, WARNING_DIALOG}; typedef _output Output; enum _disposal {KILL, QUIT, ALERT_ONLY}; typedef _disposal Disposal; class KasumiException{ private: string message; Output output; Disposal disposal; public: KasumiException(string aMessage, Output aOutput, Disposal aDisposal){ message = aMessage; output = aOutput; disposal = aDisposal; } string getMessage() { return message; } Output getOutput() { return output; } Disposal getDisposal() { return disposal; } }; void handleException(KasumiException e); #endif kasumi-2.5+debian2/src/KasumiMainWindow.cc000066400000000000000000000774561475414712000205250ustar00rootroot00000000000000/********************************************************************* * * KasumiMainWindow.cxx * * Kasumi - a management tool for a private dictionary of anthy * * Copyright (C) 2004-2006 Takashi Nakamoto * Copyright (C) 2005 Takuro Ashie * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. * *********************************************************************/ #include #include "cellrendererspin.h" #include #include #include "KasumiMainWindow.hh" #include "KasumiException.hh" #include "KasumiWord.hh" #include "KasumiDic.hh" #include "KasumiString.hh" #include "KasumiAddWindow.hh" #include "KasumiConfiguration.hh" #include #include "intl.h" extern "C"{ // ad-hoc solution for a defect of Anthy #include "anthy/dicutil.h" } #ifdef HAVE_CONFIG_H #include "config.h" #endif using namespace std; KasumiMainWindow::KasumiMainWindow(KasumiDic *aDictionary, KasumiConfiguration *conf){ this->conf = conf; dictionary = aDictionary; modificationFlag = false; createWindow(); createWordList(); registerCallbackFunctions(); gtk_window_set_position (GTK_WINDOW(mWindow), GTK_WIN_POS_MOUSE); gtk_window_resize(GTK_WINDOW(mWindow), 300,300); // ToDo: reset window size to be same as the window size when Kasumi quit the last time gtk_widget_show(mWindow); refresh(); dictionary->registerEventListener(this); } void KasumiMainWindow::createWindow() { GtkWidget *vbox1; GtkWidget *vbox2; GtkWidget *label1; GtkWidget *hbox1; GSList *mSpellingRadio_group = NULL; GtkWidget *alignment; GtkWidget *hbuttonbox1; mWindow = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_widget_set_size_request(mWindow, -1, 400); gtk_window_set_title (GTK_WINDOW (mWindow), _("Kasumi")); vbox1 = gtk_vbox_new (FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(vbox1), 6); gtk_widget_show (vbox1); gtk_container_add (GTK_CONTAINER (mWindow), vbox1); mScrolledWindow = gtk_scrolled_window_new (NULL, NULL); gtk_container_set_border_width(GTK_CONTAINER(mScrolledWindow), 6); gtk_widget_show (mScrolledWindow); gtk_box_pack_start (GTK_BOX (vbox1), mScrolledWindow, TRUE, TRUE, 0); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (mScrolledWindow), GTK_SHADOW_IN); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(mScrolledWindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); mWordListView = gtk_tree_view_new (); gtk_widget_show (mWordListView); gtk_container_add (GTK_CONTAINER (mScrolledWindow), mWordListView); vbox2 = gtk_vbox_new (FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(vbox2), 6); gtk_widget_show (vbox2); gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0); label1 = gtk_label_new (NULL); gtk_label_set_markup (GTK_LABEL (label1), _("Search:")); gtk_widget_show (label1); gtk_box_pack_start (GTK_BOX (vbox2), label1, FALSE, FALSE, 0); gtk_misc_set_alignment (GTK_MISC (label1), 0, 0.5); gtk_misc_set_padding (GTK_MISC (label1), 4, 4); hbox1 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox1); gtk_box_pack_start (GTK_BOX (vbox2), hbox1, TRUE, TRUE, 0); mSpellingRadio = gtk_radio_button_new_with_mnemonic (NULL, _("Search by Spelling")); gtk_widget_show (mSpellingRadio); gtk_box_pack_start (GTK_BOX (hbox1), mSpellingRadio, FALSE, FALSE, 20); gtk_radio_button_set_group (GTK_RADIO_BUTTON (mSpellingRadio), mSpellingRadio_group); mSpellingRadio_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (mSpellingRadio)); mSoundRadio = gtk_radio_button_new_with_mnemonic (NULL, _("Search by Sound")); gtk_widget_show (mSoundRadio); gtk_box_pack_start (GTK_BOX (hbox1), mSoundRadio, FALSE, FALSE, 0); gtk_radio_button_set_group (GTK_RADIO_BUTTON (mSoundRadio), mSpellingRadio_group); mSpellingRadio_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (mSoundRadio)); alignment = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_widget_show (alignment); gtk_box_pack_start (GTK_BOX (vbox2), alignment, FALSE, FALSE, 6); gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 0, 18, 0); mSearchEntry = gtk_entry_new (); gtk_widget_show (mSearchEntry); gtk_container_add (GTK_CONTAINER (alignment), mSearchEntry); alignment = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_widget_show (alignment); gtk_box_pack_start (GTK_BOX (vbox1), alignment, FALSE, FALSE, 6); gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 0, 6, 6); hbuttonbox1 = gtk_hbutton_box_new (); gtk_widget_show (hbuttonbox1); gtk_container_add (GTK_CONTAINER (alignment), hbuttonbox1); gtk_box_set_spacing(GTK_BOX(hbuttonbox1), 6); gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox1), GTK_BUTTONBOX_END); mSaveButton = gtk_button_new_from_stock ("gtk-save"); gtk_widget_show (mSaveButton); gtk_box_pack_start (GTK_BOX (hbuttonbox1), mSaveButton, FALSE, TRUE, 0); gtk_widget_set_can_default (mSaveButton, TRUE); mAddButton = gtk_button_new_from_stock ("gtk-add"); gtk_widget_show (mAddButton); gtk_box_pack_start (GTK_BOX (hbuttonbox1), mAddButton, FALSE, TRUE, 0); gtk_widget_set_can_default (mAddButton, TRUE); mRemoveButton = gtk_button_new_from_stock ("gtk-delete"); gtk_widget_show (mRemoveButton); gtk_box_pack_start (GTK_BOX (hbuttonbox1), mRemoveButton, FALSE, TRUE, 0); gtk_widget_set_can_default (mRemoveButton, TRUE); mQuitButton = gtk_button_new_from_stock ("gtk-close"); gtk_widget_show (mQuitButton); gtk_box_pack_end (GTK_BOX (hbuttonbox1), mQuitButton, FALSE, TRUE, 0); gtk_widget_set_can_default (mQuitButton, TRUE); } void KasumiMainWindow::createWordList() { // renderer and column GtkCellRenderer *renderer = gtk_cell_renderer_text_new(); g_signal_connect(G_OBJECT(renderer), "edited", G_CALLBACK(_call_back_edited_spelling_column), this); g_signal_connect(G_OBJECT(renderer), "editing-started", G_CALLBACK(_call_back_editing_started_spelling_column), this); g_object_set(renderer, "editable", TRUE, NULL); mSpellingColumn = gtk_tree_view_column_new_with_attributes(_("Spelling"), renderer, "text", COL_WORD, NULL); gtk_tree_view_column_set_min_width(mSpellingColumn, 80); gtk_tree_view_column_set_resizable(mSpellingColumn, true); gtk_tree_view_insert_column(GTK_TREE_VIEW(mWordListView), mSpellingColumn, -1); renderer = gtk_cell_renderer_text_new(); g_signal_connect(G_OBJECT(renderer), "edited", G_CALLBACK(_call_back_edited_sound_column), this); g_signal_connect(G_OBJECT(renderer), "editing-started", G_CALLBACK(_call_back_editing_started_sound_column), this); g_object_set(renderer, "editable", TRUE, NULL); mSoundColumn = gtk_tree_view_column_new_with_attributes(_("Sound"), renderer, "text", COL_YOMI, NULL); gtk_tree_view_column_set_min_width(mSoundColumn, 80); gtk_tree_view_column_set_resizable(mSoundColumn, true); gtk_tree_view_insert_column(GTK_TREE_VIEW(mWordListView),mSoundColumn,-1); gtk_tree_view_column_set_clickable(mSoundColumn,TRUE); g_signal_connect(G_OBJECT(mSoundColumn), "clicked", G_CALLBACK(_call_back_clicked_column_header), this); const int FREQ_LBOUND = conf->getPropertyValueByInt("MinFrequency"); const int FREQ_UBOUND = conf->getPropertyValueByInt("MaxFrequency"); renderer = gui_cell_renderer_spin_new(FREQ_LBOUND, FREQ_UBOUND, 1, FREQ_UBOUND / 100, FREQ_UBOUND / 100, 10, 0); g_signal_connect(G_OBJECT(renderer), "edited", G_CALLBACK(_call_back_edited_freq_column), this); g_signal_connect(G_OBJECT(renderer), "editing-started", G_CALLBACK(_call_back_editing_started_freq_column), this); g_object_set(renderer, "editable", TRUE, NULL); mFreqColumn = gtk_tree_view_column_new_with_attributes(_("Frequency"), renderer, "text", COL_FREQ, NULL); gtk_tree_view_column_set_min_width(mFreqColumn, 60); gtk_tree_view_column_set_resizable(mFreqColumn, true); gtk_tree_view_insert_column(GTK_TREE_VIEW(mWordListView),mFreqColumn,-1); gtk_tree_view_column_set_clickable(mFreqColumn, TRUE); g_signal_connect(G_OBJECT(mFreqColumn), "clicked", G_CALLBACK(_call_back_clicked_column_header), this); // word type column - combo renderer GtkListStore *gWordTypeList = gtk_list_store_new(WORDTYPE_NUM_COLS,G_TYPE_STRING,G_TYPE_POINTER); GtkTreeIter iter; WordTypeList::iterator p = KasumiWordType::beginWordTypeList(); while(p != KasumiWordType::endWordTypeList()) { gtk_list_store_append(gWordTypeList,&iter); gtk_list_store_set(gWordTypeList,&iter, COL_UI_STRING, (*p)->getUIString().c_str(), COL_WORDTYPE_POINTER, (*p), -1); p++; } renderer = gtk_cell_renderer_combo_new(); g_signal_connect(G_OBJECT(renderer), "editing-started", G_CALLBACK(_call_back_editing_started_wordtype_column), this); g_object_set(renderer, "model", gWordTypeList, "text-column", COL_UI_STRING, "has-entry", FALSE, "editable", TRUE, NULL); mWordTypeColumn = gtk_tree_view_column_new_with_attributes(_("WordClass"), renderer, "text", COL_PART, NULL); gtk_tree_view_column_set_resizable(mWordTypeColumn, true); gtk_tree_view_insert_column(GTK_TREE_VIEW(mWordListView),mWordTypeColumn,-1); gtk_tree_view_column_set_clickable(mWordTypeColumn, TRUE); g_signal_connect(G_OBJECT(mWordTypeColumn), "clicked", G_CALLBACK(_call_back_clicked_column_header), this); // model WordList = gtk_list_store_new(NUM_COLS,G_TYPE_UINT, G_TYPE_STRING,G_TYPE_STRING, G_TYPE_UINT,G_TYPE_STRING); SortList = gtk_tree_model_sort_new_with_model(GTK_TREE_MODEL(WordList)); gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(SortList), COL_YOMI, sortFuncBySound, NULL, NULL); gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(SortList), COL_FREQ, sortFuncByFreq, NULL, NULL); gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(SortList), COL_PART, sortFuncByWordClass, NULL, NULL); gtk_tree_view_set_model(GTK_TREE_VIEW(mWordListView), GTK_TREE_MODEL(SortList)); SortListSelection = gtk_tree_view_get_selection(GTK_TREE_VIEW(mWordListView)); gtk_tree_selection_set_mode(SortListSelection, GTK_SELECTION_SINGLE); // destroy model automatically with view g_object_unref(GTK_TREE_MODEL(WordList)); } void KasumiMainWindow::registerCallbackFunctions() { // window g_signal_connect(G_OBJECT(mWindow), "delete_event", G_CALLBACK(_call_back_delete_event), this); // buttons g_signal_connect(G_OBJECT(mQuitButton), "clicked", G_CALLBACK(_call_back_quit), this); g_signal_connect(G_OBJECT(mSaveButton), "clicked", G_CALLBACK(_call_back_store), this); g_signal_connect(G_OBJECT(mAddButton), "clicked", G_CALLBACK(_call_back_add), this); g_signal_connect(G_OBJECT(mRemoveButton), "clicked", G_CALLBACK(_call_back_remove), this); /* // This button is obsolete g_signal_connect(G_OBJECT(mChangeModeButton), "clicked", G_CALLBACK(_call_back_adding_mode), this); */ // search entry g_signal_connect(G_OBJECT(mSearchEntry), "changed", G_CALLBACK(_call_back_changed_search_entry), this); g_signal_connect(G_OBJECT(mSearchEntry), "activate", G_CALLBACK(_call_back_activate_search_entry), this); // called when Entry key is pressed } void KasumiMainWindow::refresh(){ GtkTreeModel *model = GTK_TREE_MODEL(SortList); GtkTreeIter iter; gtk_list_store_clear(WordList); list::iterator p = dictionary->firstWordIter(); while(p != dictionary->endWordIter()){ try{ KasumiWord *word = (*p); if(word != NULL && word->getFrequency() != 0){ gtk_list_store_append(WordList,&iter); gtk_list_store_set(WordList,&iter, COL_ID,word->getID(), COL_WORD,word->getSpellingByUTF8().c_str(), COL_YOMI,word->getSoundByUTF8().c_str(), COL_FREQ,word->getFrequency(), COL_PART,word->getWordTypeUIString().c_str(), -1); } }catch(KasumiException e){ handleException(e); } p++; } // If no words, nothing to do more if(!gtk_tree_model_get_iter_first(model, &iter)) return; // select first word gtk_tree_selection_select_iter(SortListSelection,&iter); } KasumiMainWindow::~KasumiMainWindow(){ dictionary->removeEventListener(this); destroy(); } void KasumiMainWindow::destroy(){ gtk_widget_destroy(mWindow); } void KasumiMainWindow::quit(){ if(modificationFlag){ GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW(mWindow), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, _("Your dictionary was changed. Do you save these changes " "before Kasumi quits?")); switch(gtk_dialog_run (GTK_DIALOG (dialog))){ case GTK_RESPONSE_YES: dictionary->store(); break; case GTK_RESPONSE_NO: break; default: cerr << "Error: Unexcepted return value of dialog's run" << endl; exit(1); } gtk_widget_destroy (dialog); } delete dictionary; delete this; gtk_main_quit(); } void KasumiMainWindow::ClickedStoreButton(){ try{ dictionary->store(); modificationFlag = false; }catch(KasumiException e){ cerr << e.getMessage() << endl; exit(1); } } void KasumiMainWindow::ClickedAddButton(){ KasumiWord *word = KasumiWord::createNewWord(conf); dictionary->appendWord(word); } void KasumiMainWindow::ClickedRemoveButton(){ GtkTreeModel *model = GTK_TREE_MODEL(SortList); GtkTreeIter iter; unsigned int id; if(gtk_tree_selection_get_selected(SortListSelection, &model, &iter)){ gtk_tree_model_get(model, &iter, COL_ID, &id, -1); dictionary->removeWord(id); } } void KasumiMainWindow::SwitchToAddingMode(){ new KasumiAddWindow(dictionary,conf); delete this; } void KasumiMainWindow::startedEditingTextColumn(GtkCellEditable *editable, string path, TextColumn col) { editingPath = gtk_tree_path_new_from_string(path.c_str()); g_signal_connect(G_OBJECT(editable), "key-press-event", G_CALLBACK(_call_back_key_pressed_text_column), this); } void KasumiMainWindow::pressedKeyOnTextColumn(GtkWidget *widget, GdkEventKey *event) { lastKeyState = event->state; lastKeyVal = event->keyval; } void KasumiMainWindow::editedTextColumn(GtkCellRendererText *renderer, const string &newText, TextColumn col) { try{ if(editingPath == NULL) throw KasumiException(string("internal error: editingPath is already freed."), STDERR, KILL); GtkTreeIter iter; gtk_tree_model_get_iter(SortList, &iter, editingPath); unsigned int id; gtk_tree_model_get(SortList, &iter, COL_ID, &id, -1); KasumiWord *word = KasumiWord::getWordFromID(id); if(col == SPELLING) { word->setSpellingByUTF8(newText); } else if(col == SOUND) { word->setSoundByUTF8(newText); } else if(col == FREQ) { word->setFrequency(str2int(newText)); } GtkTreePath *editedPath = gtk_tree_path_copy(editingPath); gtk_tree_path_free(editingPath); editingPath = NULL; // set cursor right or left GtkTreeViewColumn *postCol = NULL; if(lastKeyVal == GDK_KEY_Tab) { if(lastKeyState & GDK_CONTROL_MASK) { // set cursor left switch(col){ case SPELLING: postCol = NULL; break; case SOUND: postCol = mSpellingColumn; break; case FREQ: postCol = mSoundColumn; break; } } else { // set cursor right switch(col){ case SPELLING: postCol = mSoundColumn; break; case SOUND: postCol = mFreqColumn; break; case FREQ: postCol = mWordTypeColumn; break; } } } gtk_tree_view_set_cursor(GTK_TREE_VIEW(mWordListView), editedPath, postCol, false); gtk_tree_path_free(editedPath); }catch(KasumiException e){ handleException(e); } } void KasumiMainWindow::startedEditingWordTypeColumn(GtkCellEditable *editable, string path) { editingPath = gtk_tree_path_new_from_string(path.c_str()); g_signal_connect(G_OBJECT(editable), "changed", G_CALLBACK(_call_back_changed_wordtype_column), this); } void KasumiMainWindow::changedWordTypeColumn(GtkComboBox *combo) { try{ // get which word type was selected GtkTreeIter iter; KasumiWordType *type; GtkTreeModel *model = gtk_combo_box_get_model(combo); gtk_combo_box_get_active_iter(combo, &iter); gtk_tree_model_get(model, &iter, COL_WORDTYPE_POINTER, &type, -1); // get edited word if(editingPath == NULL) throw KasumiException(string("internal error: editingPath is already freed."), STDERR, KILL); gtk_tree_model_get_iter(SortList, &iter, editingPath); unsigned int id; gtk_tree_model_get(SortList, &iter, COL_ID, &id, -1); KasumiWord *word = KasumiWord::getWordFromID(id); word->setWordType(type); gtk_tree_path_free(editingPath); editingPath = NULL; }catch(KasumiException e){ handleException(e); } } void KasumiMainWindow::FindNext(bool fromCurrent){ GtkTreeModel *model = GTK_TREE_MODEL(SortList); GtkTreeIter iter; KasumiWord *word; GtkTreeIter StartIter; unsigned int id; string searchString = string(gtk_entry_get_text(GTK_ENTRY(mSearchEntry))); string comparedString; // undo the modified text color gtk_widget_modify_text(mSearchEntry, GTK_STATE_NORMAL, NULL); SearchBy by = SPELLING; if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mSoundRadio))){ by = SOUND; } if(!gtk_tree_selection_get_selected(SortListSelection, &model, &iter)){ if(!gtk_tree_model_get_iter_first(model, &iter)){ // If no words, do nothing. return; } } StartIter = iter; if(fromCurrent){ // Search from the selected word // nothing to do // to prevent from calling gtk_tree_model_iter_next ) }else if(!gtk_tree_model_iter_next(model,&iter)){ // Search from next word if a certain word is selected. // If the selected is the last word, seek from the first word. // If no words, do nothing; if(!gtk_tree_model_get_iter_first(model, &iter)) return; } // liner search! do{ gtk_tree_model_get(model, &iter, COL_ID, &id, -1); word = KasumiWord::getWordFromID(id); if(by == SPELLING){ comparedString = word->getSpellingByUTF8(); }else{ comparedString = word->getSoundByUTF8(); } if(comparedString.find(searchString,0) == 0){ // if found, select that word and don't search any more gtk_tree_selection_select_iter(SortListSelection,&iter); return; } }while(gtk_tree_model_iter_next(model, &iter)); // from first gtk_tree_model_get_iter_first(model, &iter); do{ gtk_tree_model_get(model, &iter, COL_ID, &id, -1); word = KasumiWord::getWordFromID(id); if(by == SPELLING){ comparedString = word->getSpellingByUTF8(); }else{ comparedString = word->getSoundByUTF8(); } if(comparedString.find(searchString,0) == 0){ gtk_tree_selection_select_iter(SortListSelection, &iter); return; // succeed searching } }while(gtk_tree_model_iter_next(model, &iter) && (StartIter.user_data != iter.user_data || StartIter.user_data2 != iter.user_data2 || StartIter.user_data3 != iter.user_data3)); // found nothing GdkColor red; red.red = 65535; red.green = red.blue = 0; gtk_widget_modify_text(mSearchEntry, GTK_STATE_NORMAL, &red); } void KasumiMainWindow::SortBy(GtkTreeViewColumn *column){ GtkSortType order; order = gtk_tree_view_column_get_sort_order(column); order = (order == GTK_SORT_ASCENDING) ? GTK_SORT_DESCENDING : GTK_SORT_ASCENDING; gtk_tree_view_column_set_sort_indicator(mSoundColumn,FALSE); gtk_tree_view_column_set_sort_indicator(mFreqColumn,FALSE); gtk_tree_view_column_set_sort_indicator(mWordTypeColumn,FALSE); if(column == mSoundColumn){ gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(SortList), COL_YOMI, order); }else if(column == mFreqColumn){ gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(SortList), COL_FREQ, order); }else if(column == mWordTypeColumn){ gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(SortList), COL_PART, order); } gtk_tree_view_column_set_sort_indicator(column,TRUE); gtk_tree_view_column_set_sort_order(column,order); } void KasumiMainWindow::removedWord(unsigned int id){ refresh(); modificationFlag = true; } void KasumiMainWindow::appendedWord(KasumiWord *word){ GtkTreeIter iter; gtk_list_store_append(WordList,&iter); gtk_list_store_set(WordList, &iter, COL_ID, word->getID(), COL_WORD, word->getSpellingByUTF8().c_str(), COL_YOMI, word->getSoundByUTF8().c_str(), COL_FREQ, word->getFrequency(), COL_PART, word->getWordTypeUIString().c_str(), -1); GtkTreeIter sort_iter; gtk_tree_model_sort_convert_child_iter_to_iter(GTK_TREE_MODEL_SORT(SortList), &sort_iter,&iter); gtk_tree_selection_select_iter(SortListSelection,&sort_iter); modificationFlag = true; // set the vertical scroll bar of the tree view undermost // removed: These codes doesn't work well. /* GtkAdjustment *adjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(mScrolledWindow)); gtk_adjustment_set_value(adjustment, adjustment->upper); */ // start editing for spelling forcibly GtkTreePath *path = gtk_tree_model_get_path(SortList, &sort_iter); gtk_tree_view_set_cursor(GTK_TREE_VIEW(mWordListView), path, mSpellingColumn, true); gtk_tree_path_free(path); } void KasumiMainWindow::modifiedWord(KasumiWord *word){ unsigned int id = word->getID(); GtkTreeIter *iter = findCorrespondingIter(id); if(iter != NULL) gtk_list_store_set(WordList,iter, COL_ID,id, COL_WORD,word->getSpellingByUTF8().c_str(), COL_YOMI,word->getSoundByUTF8().c_str(), COL_FREQ,word->getFrequency(), COL_PART,word->getWordTypeUIString().c_str(), -1); free(iter); modificationFlag = true; } // Do not returns iter of SortList but WordList GtkTreeIter *KasumiMainWindow::findCorrespondingIter(unsigned int id){ unsigned int i; GtkTreeModel *model = GTK_TREE_MODEL(WordList); GtkTreeIter *iter = (GtkTreeIter*)calloc(1,sizeof(GtkTreeIter)); gtk_tree_model_get_iter_first(model, iter); do{ gtk_tree_model_get(model, iter, COL_ID, &i, -1); if(id == i){ return iter; } }while(gtk_tree_model_iter_next(model, iter)); return NULL; } void _call_back_delete_event(GtkWidget *widget, GdkEvent *event, gpointer data){ KasumiMainWindow *window = (KasumiMainWindow *)data; window->quit(); } void _call_back_quit(GtkWidget *widget, gpointer data){ KasumiMainWindow *window = (KasumiMainWindow *)data; window->quit(); } void _call_back_store(GtkWidget *widget, gpointer data){ KasumiMainWindow *window = (KasumiMainWindow *)data; window->ClickedStoreButton(); } void _call_back_add(GtkWidget *widget, gpointer data){ KasumiMainWindow *window = (KasumiMainWindow *)data; window->ClickedAddButton(); } void _call_back_remove(GtkWidget *widget, gpointer data){ KasumiMainWindow *window = (KasumiMainWindow *)data; window->ClickedRemoveButton(); } /* // obsolete void _call_back_adding_mode(GtkWidget *widget, gpointer data){ KasumiMainWindow *window = (KasumiMainWindow *)data; window->SwitchToAddingMode(); } */ void _call_back_changed_search_entry(GtkWidget *widget, gpointer data){ KasumiMainWindow *window = (KasumiMainWindow *)data; window->FindNext(true); } void _call_back_activate_search_entry(GtkWidget *widget, gpointer data){ KasumiMainWindow *window = (KasumiMainWindow *)data; window->FindNext(false); } void _call_back_clicked_column_header(GtkTreeViewColumn *column, gpointer data){ KasumiMainWindow *window = (KasumiMainWindow *)data; window->SortBy(column); } gboolean _call_back_key_pressed_text_column(GtkWidget *widget, GdkEventKey *event, gpointer data) { KasumiMainWindow *window = (KasumiMainWindow *)data; window->pressedKeyOnTextColumn(widget, event); return FALSE; } void _call_back_editing_started_sound_column(GtkCellRenderer *render, GtkCellEditable *editable, gchar *path, gpointer data) { KasumiMainWindow *window = (KasumiMainWindow *)data; window->startedEditingTextColumn(editable, string(path), SOUND); } void _call_back_edited_sound_column(GtkCellRendererText *renderer, gchar *arg1, gchar *arg2, gpointer data) { KasumiMainWindow *window = (KasumiMainWindow *)data; window->editedTextColumn(renderer, string(arg2), SOUND); } void _call_back_editing_started_spelling_column(GtkCellRenderer *render, GtkCellEditable *editable, gchar *path, gpointer data) { KasumiMainWindow *window = (KasumiMainWindow *)data; window->startedEditingTextColumn(editable, string(path), SPELLING); } void _call_back_edited_spelling_column(GtkCellRendererText *renderer, gchar *arg1, gchar *arg2, gpointer data) { KasumiMainWindow *window = (KasumiMainWindow *)data; window->editedTextColumn(renderer, string(arg2), SPELLING); } void _call_back_editing_started_freq_column(GtkCellRenderer *render, GtkCellEditable *editable, gchar *path, gpointer data) { KasumiMainWindow *window = (KasumiMainWindow *)data; window->startedEditingTextColumn(editable, string(path), FREQ); } void _call_back_edited_freq_column(GtkCellRendererText *renderer, gchar *arg1, gchar *arg2, gpointer data) { KasumiMainWindow *window = (KasumiMainWindow *)data; window->editedTextColumn(renderer, string(arg2), FREQ); } void _call_back_editing_started_wordtype_column(GtkCellRenderer *render, GtkCellEditable *editable, gchar *path, gpointer data) { KasumiMainWindow *window = (KasumiMainWindow *)data; window->startedEditingWordTypeColumn(editable, string(path)); } void _call_back_changed_wordtype_column(GtkComboBox *combo, gpointer data) { KasumiMainWindow *window = (KasumiMainWindow *)data; window->changedWordTypeColumn(combo); } guint getAccelKey(const string &key){ string::size_type i; i = key.find("+",0); string shortkey = key.substr(i+1); if(shortkey == "A") return GDK_KEY_A; else if(shortkey == "B") return GDK_KEY_B; else if(shortkey == "C") return GDK_KEY_C; else if(shortkey == "D") return GDK_KEY_D; else if(shortkey == "E") return GDK_KEY_E; else if(shortkey == "F") return GDK_KEY_F; else if(shortkey == "G") return GDK_KEY_G; else if(shortkey == "H") return GDK_KEY_H; else if(shortkey == "I") return GDK_KEY_I; else if(shortkey == "J") return GDK_KEY_J; else if(shortkey == "K") return GDK_KEY_K; else if(shortkey == "L") return GDK_KEY_L; else if(shortkey == "M") return GDK_KEY_M; else if(shortkey == "N") return GDK_KEY_N; else if(shortkey == "O") return GDK_KEY_O; else if(shortkey == "P") return GDK_KEY_P; else if(shortkey == "Q") return GDK_KEY_Q; else if(shortkey == "R") return GDK_KEY_R; else if(shortkey == "S") return GDK_KEY_S; else if(shortkey == "T") return GDK_KEY_T; else if(shortkey == "U") return GDK_KEY_U; else if(shortkey == "V") return GDK_KEY_V; else if(shortkey == "W") return GDK_KEY_W; else if(shortkey == "X") return GDK_KEY_X; else if(shortkey == "Y") return GDK_KEY_Y; else if(shortkey == "Z") return GDK_KEY_Z; else if(shortkey == "0") return GDK_KEY_0; else if(shortkey == "1") return GDK_KEY_1; else if(shortkey == "2") return GDK_KEY_2; else if(shortkey == "3") return GDK_KEY_3; else if(shortkey == "4") return GDK_KEY_4; else if(shortkey == "5") return GDK_KEY_5; else if(shortkey == "6") return GDK_KEY_5; else if(shortkey == "7") return GDK_KEY_7; else if(shortkey == "8") return GDK_KEY_8; else if(shortkey == "9") return GDK_KEY_9; cerr << "Invalid shortcut key option: " << key << endl; exit(1); } GdkModifierType getModifierType(const string &key){ string::size_type i; i = key.find("+",0); if(i == (unsigned int) key.npos){ return (GdkModifierType)0; } string mask = key.substr(0,i); if(mask == "Ctrl"){ return GDK_CONTROL_MASK; }else if(mask == "Alt"){ return GDK_MOD1_MASK; } cerr << "Invalid mask option: " << key << endl; exit(1); } gint sortFuncByFreq(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer user_data){ unsigned int id_a, id_b; gtk_tree_model_get(model, a, COL_ID, &id_a, -1); gtk_tree_model_get(model, b, COL_ID, &id_b, -1); KasumiWord *word_a = KasumiWord::getWordFromID(id_a); KasumiWord *word_b = KasumiWord::getWordFromID(id_b); return word_a->getFrequency() - word_b->getFrequency(); } gint sortFuncBySound(GtkTreeModel *model, GtkTreeIter *iter_a, GtkTreeIter *iter_b, gpointer user_data){ unsigned int id_a, id_b; gtk_tree_model_get(model, iter_a, COL_ID, &id_a, -1); gtk_tree_model_get(model, iter_b, COL_ID, &id_b, -1); KasumiWord *word_a = KasumiWord::getWordFromID(id_a); KasumiWord *word_b = KasumiWord::getWordFromID(id_b); const char *str_a = word_a->getSoundByUTF8().c_str(); const char *str_b = word_b->getSoundByUTF8().c_str(); int size_a = word_a->getSound().size(); int size_b = word_b->getSound().size(); int size = (size_a < size_b) ? size_a : size_b; int i,a,b; unsigned char first_a,second_a,third_a; unsigned char first_b,second_b,third_b; // compare Hiragana string encoded in UTF8 for(i=0;i (str_a[i]); second_a = static_cast (str_a[i+1]); third_a = static_cast (str_a[i+2]); first_b = static_cast (str_b[i]); second_b = static_cast (str_b[i+1]); third_b = static_cast (str_b[i+2]); // confirm that current characters are Hiragana a = first_a * 65535 + second_a * 256 + third_a; b = first_b * 65535 + second_b * 256 + third_b; if(a != b){ return a - b; } } // one string is the beginning part of another string // compare string size return size_a - size_b; } gint sortFuncByWordClass(GtkTreeModel *model, GtkTreeIter *iter_a, GtkTreeIter *iter_b, gpointer user_data){ unsigned int id_a, id_b; gtk_tree_model_get(model, iter_a, COL_ID, &id_a, -1); gtk_tree_model_get(model, iter_b, COL_ID, &id_b, -1); KasumiWord *word_a = KasumiWord::getWordFromID(id_a); KasumiWord *word_b = KasumiWord::getWordFromID(id_b); return word_a->getWordType()->comp(word_b->getWordType()); } kasumi-2.5+debian2/src/KasumiMainWindow.hh000066400000000000000000000205751475414712000205250ustar00rootroot00000000000000/********************************************************************* * * KasumiMainWindow.hh * * Kasumi - a management tool for a private dictionary of anthy * * Copyright (C) 2004-2006 Takashi Nakamoto * Copyright (C) 2006 Ikuya Awashiro * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. * *********************************************************************/ #ifndef __KASUMI_MAIN_WINDOW_HXX__ #define __KASUMI_MAIN_WINDOW_HXX__ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "KasumiDic.hh" #include "KasumiDicEventListener.hh" #include "KasumiConfiguration.hh" enum column_name { COL_ID = 0, COL_WORD, COL_YOMI, COL_FREQ, COL_PART, NUM_COLS }; enum wordtype_column_name { COL_UI_STRING = 0, COL_WORDTYPE_POINTER, WORDTYPE_NUM_COLS }; enum _TextColumnEnum { SPELLING = 0, SOUND, FREQ }; typedef _TextColumnEnum SearchBy; typedef _TextColumnEnum TextColumn; void _call_back_changed_wordtype_column(GtkComboBox *combo, gpointer data); gboolean _call_back_key_pressed_text_column(GtkWidget *widget, GdkEventKey *event, gpointer data); void _call_back_activate_search_entry(GtkWidget *widget, gpointer data); void _call_back_changed_search_entry(GtkWidget *widget, gpointer data); void _call_back_remove(GtkWidget *widget, gpointer data); void _call_back_delete_event(GtkWidget *widget, GdkEvent *event, gpointer data); void _call_back_quit(GtkWidget *widget, gpointer data); void _call_back_store(GtkWidget *widget, gpointer data); void _call_back_add(GtkWidget *widget, gpointer data); void _call_back_clicked_column_header(GtkTreeViewColumn *column, gpointer data); gboolean _call_back_key_pressed_text_column(GtkWidget *widget, GdkEventKey *event, gpointer data); void _call_back_editing_started_sound_column(GtkCellRenderer *render, GtkCellEditable *editable, gchar *path, gpointer data); void _call_back_edited_sound_column(GtkCellRendererText *renderer, gchar *arg1, gchar *arg2, gpointer data); void _call_back_editing_started_spelling_column(GtkCellRenderer *render, GtkCellEditable *editable, gchar *path, gpointer data); void _call_back_edited_spelling_column(GtkCellRendererText *renderer, gchar *arg1, gchar *arg2, gpointer data); void _call_back_editing_started_freq_column(GtkCellRenderer *render, GtkCellEditable *editable, gchar *path, gpointer data); void _call_back_edited_freq_column(GtkCellRendererText *renderer, gchar *arg1, gchar *arg2, gpointer data); void _call_back_editing_started_wordtype_column(GtkCellRenderer *render, GtkCellEditable *editable, gchar *path, gpointer data); class KasumiMainWindow : public KasumiDicEventListener{ friend void _call_back_delete_event(GtkWidget *widget, GdkEvent *event, gpointer data); friend void _call_back_quit(GtkWidget *widget, gpointer data); friend void _call_back_store(GtkWidget *widget, gpointer data); friend void _call_back_add(GtkWidget *widget, gpointer data); friend void _call_back_remove(GtkWidget *widget, gpointer data); /* // obsolete friend void _call_back_adding_mode(GtkWidget *widget, gpointer data); */ friend void _call_back_changed_search_entry(GtkWidget *widget, gpointer data); friend void _call_back_activate_search_entry(GtkWidget *widget, gpointer data); friend void _call_back_clicked_column_header(GtkTreeViewColumn *column, gpointer data); friend gboolean _call_back_key_pressed_text_column(GtkWidget *widget, GdkEventKey *event, gpointer data); friend void _call_back_editing_started_sound_column(GtkCellRenderer *render, GtkCellEditable *editable, gchar *path, gpointer data); friend void _call_back_edited_sound_column(GtkCellRendererText *renderer, gchar *arg1, gchar *arg2, gpointer data); friend void _call_back_editing_started_spelling_column(GtkCellRenderer *render, GtkCellEditable *editable, gchar *path, gpointer data); friend void _call_back_edited_spelling_column(GtkCellRendererText *renderer, gchar *arg1, gchar *arg2, gpointer data); friend void _call_back_editing_started_freq_column(GtkCellRenderer *render, GtkCellEditable *editable, gchar *path, gpointer data); friend void _call_back_edited_freq_column(GtkCellRendererText *renderer, gchar *arg1, gchar *arg2, gpointer data); friend void _call_back_editing_started_wordtype_column(GtkCellRenderer *render, GtkCellEditable *editable, gchar *path, gpointer data); friend void _call_back_changed_wordtype_column(GtkComboBox *combo, gpointer data); private: KasumiDic *dictionary; KasumiConfiguration *conf; GtkWidget *mWindow; GtkWidget *mSpellingRadio; GtkWidget *mSoundRadio; GtkWidget *mSearchEntry; GtkWidget *mWordListView; GtkWidget *mScrolledWindow; GtkWidget *mQuitButton; GtkWidget *mSaveButton; GtkWidget *mAddButton; GtkWidget *mRemoveButton; // GtkWidget *mChangeModeButton; // obsolete GtkListStore *WordList; GtkTreeModel *SortList; GtkTreeSelection *SortListSelection; GtkTreeViewColumn *mSpellingColumn; GtkTreeViewColumn *mSoundColumn; GtkTreeViewColumn *mFreqColumn; GtkTreeViewColumn *mWordTypeColumn; GtkTreePath *editingPath; guint lastKeyState; guint lastKeyVal; bool modificationFlag; string previousSoundEntryText; void createWindow(); void createWordList(); void registerCallbackFunctions(); void destroy(); void quit(); void ClickedStoreButton(); void ClickedAddButton(); void ClickedRemoveButton(); void SwitchToAddingMode(); void startedEditingTextColumn(GtkCellEditable *editable, string path, TextColumn col); void pressedKeyOnTextColumn(GtkWidget *widget, GdkEventKey *event); void editedTextColumn(GtkCellRendererText *renderer, const string &newSound, TextColumn col); void startedEditingWordTypeColumn(GtkCellEditable *editable, string path); void changedWordTypeColumn(GtkComboBox *combo); void FindNext(bool fromCurrent); GtkTreeIter *findCorrespondingIter(unsigned int id); void SortBy(GtkTreeViewColumn *column); public: KasumiMainWindow(KasumiDic *aDictionary, KasumiConfiguration *conf); virtual ~KasumiMainWindow(); void refresh(); void removedWord(unsigned int id); void appendedWord(KasumiWord *word); void modifiedWord(KasumiWord *word); }; guint getAccelKey(const string &key); GdkModifierType getModifierType(const string &key); gint sortFuncByFreq(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer user_data); gint sortFuncBySound(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer user_data); gint sortFuncByWordClass(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer user_data); #endif kasumi-2.5+debian2/src/KasumiString.cc000066400000000000000000000066371475414712000177100ustar00rootroot00000000000000/********************************************************************* * * KasumiString.cxx * * Kasumi - a management tool for a private dictionary of anthy * * Copyright (C) 2004-2006 Takashi Nakamoto * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. * *********************************************************************/ #include "KasumiString.hh" #include #include #include using namespace std; bool KasumiString::isCommentLine(){ // comment line is commented out by "#" if(find("#",0) == 0){ return true; } return false; } bool KasumiString::isEmptyLine(){ if(length() == 0){ return true; } return false; } bool KasumiString::isEntryLine(){ string::size_type i; // if(isKeyValLine()){ // return false; // } i = find(" ",0); if(i == npos){ return false; } i = find(" ",i+1); if(i == npos){ return false; } return true; } bool KasumiString::isKeyValLine(){ string::size_type i; i = find("=",0); if(i == npos){ return false; } return true; } string KasumiString::getSound(){ string::size_type i; if(isEntryLine()){ i = find(" ",0); return substr(0,i); } return NULL; } unsigned int KasumiString::getFrequency(){ string::size_type i,j; unsigned int ret=0; string sub; if(isEntryLine()){ i = find(" ",0); j = find(" ",i+1); sub = substr(i+1,j-i-1); ret = atoi(sub.c_str()); } return ret; } string KasumiString::getSpelling(){ int i; if(isEntryLine()){ // allow spelling to contain space // thanks to pinkmonky http://d.hatena.ne.jp/pinkmonkey/20050411 i = find(" ",0); i = find(" ",i+1); return substr(i+1); } return NULL; } string KasumiString::getKey(){ int i; if(isKeyValLine()){ i = find("=",0); while(c_str()[i-1] == ' ' || c_str()[i-1] == '\t'){ i--; } return substr(0,i); } return NULL; } string KasumiString::getVal(){ int i; if(isKeyValLine()){ i = find("=",0); while(c_str()[i+1] == ' ' || c_str()[i-1] == '\t'){ i++; } return substr(i+1); } return NULL; } int str2int(const string &str){ if(isInt(str)){ stringstream ss(str); int i; ss >> i; return i; } return 0; } string int2str(int i){ stringstream ss; ss << i; return ss.str(); } bool isInt(const string &str){ unsigned int i; if(str == "-" || str == ""){ return false; } if(str == "0"){ return true; } if(str.c_str()[0] == '-'){ i=1; }else{ i=0; } if(str.c_str()[i] >= '1' && str.c_str()[i] <= '9'){ for(i++;i '9'){ return false; } } return true; } return false; } kasumi-2.5+debian2/src/KasumiString.hh000066400000000000000000000056741475414712000177220ustar00rootroot00000000000000/********************************************************************* * * KasumiString.hh * * Kasumi - a management tool for a private dictionary of anthy * * Copyright (C) 2004-2006 Takashi Nakamoto * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. * *********************************************************************/ #ifndef __KASUMI_STRING_HXX__ #define __KASUMI_STRING_HXX__ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #define EUCJP_HINNSHI "\xc9\xca\xbb\xec" #define EUCJP_MEISHI "\xcc\xbe\xbb\xec" #define EUCJP_FUKUSHI "\xc9\xfb\xbb\xec" #define EUCJP_JINNMEI "\xbf\xcd\xcc\xbe" #define EUCJP_CHIMEI "\xc3\xcf\xcc\xbe" #define EUCJP_KEIYOUSHI "\xb7\xc1\xcd\xc6\xbb\xec" #define EUCJP_DOUSHI "\xc6\xb0\xbb\xec" #define EUCJP_NASETSUZOKU "\xa4\xca\xc0\xdc\xc2\xb3" #define EUCJP_GOKANNNOMIDEBUNNSETSU "\xb8\xec\xb4\xb4\xa4\xce\xa4\xdf\xa4\xc7\xca\xb8\xc0\xe1" #define EUCJP_SASETSUZOKU "\xa4\xb5\xc0\xdc\xc2\xb3" #define EUCJP_SURUSETSUZOKU "\xa4\xb9\xa4\xeb\xc0\xdc\xc2\xb3" #define EUCJP_KAKUJOSHISETSUZOKU "\xb3\xca\xbd\xf5\xbb\xec\xc0\xdc\xc2\xb3" #define EUCJP_TOSETSUZOKU "\xa4\xc8\xc0\xdc\xc2\xb3" #define EUCJP_TARUSETSUZOKU "\xa4\xbf\xa4\xeb\xc0\xdc\xc2\xb3" #define EUCJP_KATSUYOU "\xb3\xe8\xcd\xd1" #define EUCJP_BAGYOUGODAN "\xa5\xd0\xb9\xd4\xb8\xde\xc3\xca" #define EUCJP_GAGYOUGODAN "\xa5\xac\xb9\xd4\xb8\xde\xc3\xca" #define EUCJP_KAGYOUGODAN "\xa5\xab\xb9\xd4\xb8\xde\xc3\xca" #define EUCJP_MAGYOUGODAN "\xa5\xde\xb9\xd4\xb8\xde\xc3\xca" #define EUCJP_NAGYOUGODAN "\xa5\xca\xb9\xd4\xb8\xde\xc3\xca" #define EUCJP_RAGYOUGODAN "\xa5\xe9\xb9\xd4\xb8\xde\xc3\xca" #define EUCJP_SAGYOUGODAN "\xa5\xb5\xb9\xd4\xb8\xde\xc3\xca" #define EUCJP_TAGYOUGODAN "\xa5\xbf\xb9\xd4\xb8\xde\xc3\xca" #define EUCJP_WAGYOUGODAN "\xa5\xef\xb9\xd4\xb8\xde\xc3\xca" #define EUCJP_RENNYOUKEINOMEISHIKA "\xcf\xa2\xcd\xd1\xb7\xc1\xa4\xce\xcc\xbe\xbb\xec\xb2\xbd" using namespace std; class KasumiString : public string{ private: public: // methods to examine one line string bool isCommentLine(); bool isEmptyLine(); bool isEntryLine(); bool isKeyValLine(); string getSound(); unsigned int getFrequency(); string getSpelling(); string getKey(); string getVal(); }; int str2int(const string &str); string int2str(int i); bool isInt(const string &str); #endif kasumi-2.5+debian2/src/KasumiWord.cc000066400000000000000000000231421475414712000173430ustar00rootroot00000000000000/********************************************************************* * * KasumiWord.cxx * * Kasumi - a management tool for a private dictionary of anthy * * Copyright (C) 2004-2006 Takashi Nakamoto * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. * *********************************************************************/ #include #include #include #include #include #include "KasumiWord.hh" #include "KasumiException.hh" #include "KasumiConfiguration.hh" #include "KasumiString.hh" // for EUCJP_***(constant string) #include "intl.h" #include #define VECTOR_UNIT 10 using namespace std; iconv_t KasumiWord::IconvUTF8_To_EUCJP = iconv_open("EUC-JP", "UTF-8"); iconv_t KasumiWord::IconvEUCJP_To_UTF8 = iconv_open("UTF-8", "EUC-JP"); unsigned int KasumiWord::id_generator = 0; vector KasumiWord::words = vector(VECTOR_UNIT); string KasumiWord::convertUTF8ToEUCJP(const string &aUTF8){ char *utf8 = (char*)malloc(strlen(aUTF8.c_str())+1); strcpy(utf8, aUTF8.c_str()); size_t len = strlen(utf8)+1; size_t len_eucjp = len*2; char *eucjp_buf = (char*)malloc(len_eucjp); char *eucjp = eucjp_buf; iconv(IconvUTF8_To_EUCJP, const_cast(&utf8), &len, &eucjp_buf, &len_eucjp); return string(eucjp); } string KasumiWord::convertEUCJPToUTF8(const string &aEUCJP){ char *eucjp = (char*)malloc(strlen(aEUCJP.c_str())+1); strcpy(eucjp, aEUCJP.c_str()); size_t len = strlen(eucjp)+1; size_t len_utf8 = len*2; char *utf8_buf = (char*)malloc(len_utf8); char *utf8 = utf8_buf; iconv(IconvEUCJP_To_UTF8, const_cast(&eucjp), &len, &utf8_buf, &len_utf8); return string(utf8); } string KasumiWord::extractInvalidCharacterFromSound(string soundByUTF8){ const char *str = soundByUTF8.c_str(); unsigned char first,second,third; char res[5]; int i,size; size = soundByUTF8.size(); for(i=0;i (str[i]); second = static_cast (str[i+1]); third = static_cast (str[i+2]); if(first >= 0x21 && first <= 0x7e){ // ASCII character continue; }else if(first <= 0x7f){ res[0] = str[i]; res[1] = 0; return string(res); }else if(first >= 0x80 && first <= 0xc1){ // Even it is not encoded in UTF-8 string("non-UTF8 code detected"); }else if(first >= 0xc2 && first <= 0xdf){ res[0] = str[i]; res[1] = str[i+1]; res[2] = 0; return string(res); }else if(first >= 0xe0 && first <= 0xef){ if(first == 0xe3 && second == 0x83 && third == 0xbc){ // dash continue; }else if(first == 0xe3 && second == 0x80 && (third == 0x81 || third == 0x82)){ // punctuaiton mark continue; }else if(first == 0xe3 && second == 0x80 && (third == 0x8c || third == 0x8d)){ // corner brackets continue; }else if(first == 0xe3 && second == 0x80 && third == 0x9c){ // wave dash continue; }else if(first == 0xe3 && second == 0x81 && third >= 0x81 && third <= 0xbf){ // hiragana from "A" to "MI" continue; }else if(first == 0xe3 && second == 0x82 && third >= 0x80 && third <= 0x94){ // the rest of hiragana continue; }else if(first == 0xef && second == 0xbc && third >= 0x81 && third <= 0xa0){ // symbol marks of two-byte characters continue; }else if(first == 0xe3 && second == 0x82 && third == 0x9b){ // dakuon mark continue; }else{ res[0] = str[i]; res[1] = str[i+1]; res[2] = str[i+2]; res[3] = 0; return string(res); } }else if(first >= 0xf0 && first <= 0xf4){ res[0] = str[i]; res[1] = str[i+1]; res[2] = str[i+2]; res[3] = str[i+3]; res[4] = 0; return string(res); }else{ // Even it is not encoded in UTF-8 string("non-UTF8 code detected"); } } return string(); } KasumiWord::KasumiWord(KasumiConfiguration *conf){ IsEUCJP = conf->getPropertyValueByBool("UseEUCJP"); setSound(conf->getPropertyValue("DefaultSound")); setSpelling(conf->getPropertyValue("DefaultSpelling")); Frequency = conf->getPropertyValueByInt("DefaultFrequency"); try{ mWordType = NULL; setWordType(KasumiWordType::getWordTypeFromCannaTab(conf->getPropertyValue("DefaultWordType"))); }catch(KasumiException e){ cout << e.getMessage() << endl; exit(1); } } KasumiWord* KasumiWord::createNewWord(KasumiConfiguration *conf) { KasumiWord *word = new KasumiWord(conf); word->id = id_generator++; if(word->id >= words.size()) words.resize(words.size() + VECTOR_UNIT, NULL); KasumiWord::words[word->id] = word; return word; } void KasumiWord::setSound(const string &aSound) throw(KasumiException){ if(aSound == Sound) return; string tmp = IsEUCJP ? convertEUCJPToUTF8(Sound) : aSound; string invalidChar = extractInvalidCharacterFromSound(tmp); if(invalidChar != ""){ string message; message = string(_("Sound must consist of only Hiragana characters. You have entered invalid character: ")); message += invalidChar; throw KasumiException(message, ERR_DIALOG, ALERT_ONLY); } Sound = aSound; Sound_UTF8 = IsEUCJP ? convertEUCJPToUTF8(Sound) : Sound; for(size_t i=0;ichangedSound(this); } } void KasumiWord::setSoundByUTF8(const string &aSound) throw(KasumiException){ if(aSound == Sound_UTF8) return; string invalidChar = extractInvalidCharacterFromSound(aSound); if(invalidChar != ""){ string message; message = string(_("Sound must consist of only Hiragana characters. You have entered invalid character: ")); message += invalidChar; throw KasumiException(message, ERR_DIALOG, ALERT_ONLY); } Sound_UTF8 = aSound; Sound = IsEUCJP ? convertUTF8ToEUCJP(Sound_UTF8) : Sound_UTF8; for(size_t i=0;ichangedSound(this); } } void KasumiWord::setSpelling(const string &aSpelling){ if(aSpelling == Spelling) return; Spelling = aSpelling; Spelling_UTF8 = IsEUCJP ? convertEUCJPToUTF8(Spelling) : Spelling; for(size_t i=0;ichangedSpelling(this); } } void KasumiWord::setSpellingByUTF8(const string &aSpelling){ if(aSpelling == Spelling_UTF8) return; Spelling_UTF8 = aSpelling; Spelling = IsEUCJP ? convertUTF8ToEUCJP(Spelling_UTF8) : Spelling_UTF8; for(size_t i=0;ichangedSpelling(this); } } void KasumiWord::setFrequency(int aFrequency) { if(aFrequency == Frequency) return; Frequency = aFrequency; for(size_t i=0;ichangedFrequency(this); } } void KasumiWord::setWordType(KasumiWordType *aType) { if(aType->equal(mWordType)) return; mWordType = aType; for(size_t i=0;ichangedWordType(this); } } string KasumiWord::getWordTypeUIString() { if(mWordType != NULL) return mWordType->getUIString(); else return string(""); } KasumiWord* KasumiWord::getWordFromID(unsigned int id) { return KasumiWord::words[id]; } void KasumiWord::registerEventListener(KasumiWordEventListener *listener){ int i,size; size = EventListeners.size(); // if the listener have been already registered, nothing to do // assuring no duplication for(i=0;i::iterator i; KasumiWordEventListener *p; for(i=EventListeners.begin();i!=EventListeners.end();i++){ p = *i; if(p == listener){ EventListeners.erase(i); return; } } } /* // for debug int main(int argc, char *argv[]) { KasumiWordType::addNewWordType("̾", "̾", "#T35"); KasumiWordType::addNewWordType("̾", "̾", "#JN"); KasumiWordType::addNewWordType("̾", "̾", "#CN"); KasumiWordType::addNewWordType("̾", "", "#KK"); KasumiWordType::addNewWordType("̾", "³", "#T30"); KasumiWordType::addNewWordType("", "", "#NN"); KasumiWordType::addNewWordType("ƻ", "", "#KY"); KasumiWordType::addNewWordType("ƻ", "", "#KYT"); KasumiWordType::addNewWordType("ư", "", "#T05"); KasumiWordType::addNewWordType("", "", "#F04"); KasumiWordType::addNewWordType("ư", "", "#CJ"); KasumiWordType::addNewWordType("Ϣλ", "", "#RT"); KasumiWordType::addNewWordType("ñ", "", "#KJ"); KasumiWord *newWord = new KasumiWord(); newWord->setSound(""); newWord->setSpelling(""); newWord->setFrequency(180); newWord->setWordType(KasumiWordType::getWordTypeFromCannaTab("#T35")); cout << newWord->getSound() << " " << newWord->getSpelling() << " "; cout << newWord->getFrequency() << " " << endl; cout << newWord->getWordType()->getPos() << endl; cout << newWord->getWordType()->getCategory() << endl; } */ kasumi-2.5+debian2/src/KasumiWord.hh000066400000000000000000000062241475414712000173570ustar00rootroot00000000000000/********************************************************************* * * KasumiWord.hh * * Kasumi - a management tool for a private dictionary of anthy * * Copyright (C) 2004-2006 Takashi Nakamoto * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. * *********************************************************************/ #ifndef __KASUMI_WORD_HXX__ #define __KASUMI_WORD_HXX__ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "KasumiException.hh" #include "KasumiConfiguration.hh" #include "KasumiWordType.hh" #include "KasumiWordEventListener.hh" #include #include using namespace std; class KasumiWord{ private: bool IsEUCJP; string Sound; // corresponding "Yomi" in private-dic.src string Sound_UTF8; int Frequency; // corresponding "Hindo" string Spelling; // corresponding "Tango" string Spelling_UTF8; unsigned int id; vector EventListeners; KasumiWordType *mWordType; static iconv_t IconvUTF8_To_EUCJP; static iconv_t IconvEUCJP_To_UTF8; // confirms if the given sound consists of only Hiragana // if no invalid character, returns empty string static string extractInvalidCharacterFromSound(string soundByUTF8); static unsigned int id_generator; static vector words; KasumiWord(KasumiConfiguration *conf); public: static KasumiWord* createNewWord(KasumiConfiguration *conf); // property functions void setSound(const string &aSound) throw(KasumiException); void setSoundByUTF8(const string &aSound) throw(KasumiException); string getSound(){ return Sound; }; string getSoundByUTF8(){ return Sound_UTF8; }; void setFrequency(int aFrequency); int getFrequency(){ return Frequency; }; void setSpelling(const string &aSpelling); void setSpellingByUTF8(const string &aSpelling); string getSpelling(){ return Spelling; }; string getSpellingByUTF8(){ return Spelling_UTF8; }; void setWordType(KasumiWordType *aType); KasumiWordType *getWordType() { return mWordType; }; string getWordTypeUIString(); // UTF8 unsigned int getID(){ return id; }; void registerEventListener(KasumiWordEventListener *listener); void removeEventListener(KasumiWordEventListener *listener); static KasumiWord *getWordFromID(unsigned int id); static string convertUTF8ToEUCJP(const string &aEUCJP); static string convertEUCJPToUTF8(const string &aUTF8); }; #endif kasumi-2.5+debian2/src/KasumiWordEventListener.hh000066400000000000000000000027721475414712000220730ustar00rootroot00000000000000/********************************************************************* * * KasumiWordEventListener.hh * * Kasumi - a management tool for a private dictionary of anthy * * Copyright (C) 2004-2006 Takashi Nakamoto * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. * *********************************************************************/ #ifndef __KASUMI_WORD_EVENT_LISTENER_HXX__ #define __KASUMI_WORD_EVENT_LISTENER_HXX__ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "KasumiWord.hh" class KasumiWord; class KasumiWordEventListener{ private: public: virtual ~KasumiWordEventListener() {}; virtual void changedFrequency(KasumiWord *word) = 0; virtual void changedSpelling(KasumiWord *word) = 0; virtual void changedSound(KasumiWord *word) = 0; virtual void changedWordType(KasumiWord *word) = 0; }; #endif kasumi-2.5+debian2/src/KasumiWordType.cc000066400000000000000000000127311475414712000202070ustar00rootroot00000000000000/********************************************************************* * * KasumiWordType.cxx * * Kasumi - a management tool for a private dictionary of anthy * * Copyright (C) 2004-2006 Takashi Nakamoto * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. * *********************************************************************/ #include "KasumiWordType.hh" #include "KasumiWord.hh" #include "intl.h" // static members of KasumiWordType WordTypeList KasumiWordType::_lWordTypes; int KasumiWordType::comp_seed = 0; void KasumiWordType::initWordTypeList() { KasumiWordType::addNewWordType(_("Noun"), _("General Noun"), "#T35"); KasumiWordType::addNewWordType(_("Noun"), _("followed by NA, SA and SURU"), "#T00"); KasumiWordType::addNewWordType(_("Noun"), _("followed by NA and SA"), "#T05"); KasumiWordType::addNewWordType(_("Noun"), _("followed by NA and SURU"), "#T10"); KasumiWordType::addNewWordType(_("Noun"), _("followed by NA"), "#T15"); KasumiWordType::addNewWordType(_("Noun"), _("followed by SURU"), "#T30"); KasumiWordType::addNewWordType(_("Proper Noun"), _("Name of people"), "#JN"); KasumiWordType::addNewWordType(_("Proper Noun"), _("Geographic Name"), "#CN"); KasumiWordType::addNewWordType(_("Proper Noun"), _("Corporate Name"), "#KK"); KasumiWordType::addNewWordType(_("Numeral"), "", "#NN"); KasumiWordType::addNewWordType(_("Adjective (Keiyoushi)"), "", "#KY"); KasumiWordType::addNewWordType(_("Adverb"), _("General Adverb"), "#F14"); KasumiWordType::addNewWordType(_("Adverb"), _("followed by TO and TARU"), "#F02"); KasumiWordType::addNewWordType(_("Adverb"), _("followed by TO and SURU"), "#F04"); KasumiWordType::addNewWordType(_("Adverb"), _("followed by TO"), "#F06"); KasumiWordType::addNewWordType(_("Adverb"), _("followed by SURU"), "#F12"); KasumiWordType::addNewWordType(_("Interjection"), "", "#CJ"); KasumiWordType::addNewWordType(_("Adnominal adjunct"), "", "#RT"); KasumiWordType::addNewWordType(_("Single Kanji Character"), "", "#KJ"); KasumiWordType::addNewWordType(_("Verb"), _("Ka 5"), "#K5"); KasumiWordType::addNewWordType(_("Verb"), _("Ga 5"), "#G5"); KasumiWordType::addNewWordType(_("Verb"), _("Sa 5"), "#S5"); KasumiWordType::addNewWordType(_("Verb"), _("Ta 5"), "#T5"); KasumiWordType::addNewWordType(_("Verb"), _("Na 5"), "#N5"); KasumiWordType::addNewWordType(_("Verb"), _("Ba 5"), "#B5"); KasumiWordType::addNewWordType(_("Verb"), _("Ma 5"), "#M5"); KasumiWordType::addNewWordType(_("Verb"), _("Ra 5"), "#R5"); KasumiWordType::addNewWordType(_("Verb"), _("Wa 5"), "#W5"); KasumiWordType::addNewWordType(_("Verb*"), _("Ka 5"), "#K5r"); KasumiWordType::addNewWordType(_("Verb*"), _("Ga 5"), "#G5r"); KasumiWordType::addNewWordType(_("Verb*"), _("Sa 5"), "#S5r"); KasumiWordType::addNewWordType(_("Verb*"), _("Ta 5"), "#T5r"); KasumiWordType::addNewWordType(_("Verb*"), _("Na 5"), "#N5r"); KasumiWordType::addNewWordType(_("Verb*"), _("Ba 5"), "#B5r"); KasumiWordType::addNewWordType(_("Verb*"), _("Ma 5"), "#M5r"); KasumiWordType::addNewWordType(_("Verb*"), _("Ra 5"), "#R5r"); KasumiWordType::addNewWordType(_("Verb*"), _("Wa 5"), "#W5r"); } KasumiWordType::KasumiWordType(string sCategory, string sPos, string sCannaTab) { msPos = sPos; msCategory = sCategory; msCannaTab = sCannaTab; mnComp = comp_seed++; } void KasumiWordType::addNewWordType(string sPos, string sCategory, string sCannaTab) { _lWordTypes.push_back(new KasumiWordType(sPos, sCategory, sCannaTab)); } KasumiWordType* KasumiWordType::getWordTypeFromCannaTab(string sCannaTab) { // return the completely same word type WordTypeList::iterator p = _lWordTypes.begin(); while(p != _lWordTypes.end()){ if( (*p)->getCannaTab() == sCannaTab ) return (*p); p++; } // return the alternative word type whose first character is equal to // specified one's char first_char = sCannaTab.c_str()[0]; p = _lWordTypes.begin(); while(p != _lWordTypes.end()){ if( first_char == (*p)->getCannaTab().c_str()[0] ) return (*p); p++; } // return the first word type as a fallback return *(_lWordTypes.begin()); } KasumiWordType* KasumiWordType::getWordTypeFromPos(string sPos) { WordTypeList::iterator p = _lWordTypes.begin(); while(p != _lWordTypes.end()){ if( (*p)->getPos() == sPos ) return (*p); p++; } // return the first word type as a fallback return *(_lWordTypes.begin()); } string KasumiWordType::getUIString() { if(msPos.size() != 0) return msCategory + " - " + msPos; else return msCategory; } /* // for debug int main() { KasumiWordType::addNewWordType("名詞", "一般名詞", "#T35"); KasumiWordType::addNewWordType("名詞", "人名", "#JN"); KasumiWordType::addNewWordType("名詞", "地名", "#CN"); } */ kasumi-2.5+debian2/src/KasumiWordType.hh000066400000000000000000000044711475414712000202230ustar00rootroot00000000000000/********************************************************************* * * KasumiWordType.hh * * Kasumi - a management tool for a private dictionary of anthy * * Copyright (C) 2004-2006 Takashi Nakamoto * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. * *********************************************************************/ #ifndef __KASUMI_WORD_TYPE_HXX__ #define __KASUMI_WORD_TYPE_HXX__ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include using namespace std; class KasumiWordType; // pre-declaration typedef list WordTypeList; class KasumiWordType { private: string msPos; // part of speech such as noun, verb and so on string msCategory; // subcategory of Pos string msCannaTab; int mnComp; static int comp_seed; KasumiWordType(string sPos, string sCategory, string sCannaTab); static WordTypeList _lWordTypes; public: static void initWordTypeList(); string getPos(){ return msPos; }; string getCategory(){ return msCategory; }; string getCannaTab(){ return msCannaTab; }; string getUIString(); static WordTypeList::iterator beginWordTypeList(){ return _lWordTypes.begin(); }; static WordTypeList::iterator endWordTypeList(){ return _lWordTypes.end(); }; static void addNewWordType(string sPos, string sCategory, string sCannaTab); static KasumiWordType* getWordTypeFromCannaTab(string sCannaTab); static KasumiWordType* getWordTypeFromPos(string sPos); int comp(KasumiWordType *op){ return op ? mnComp - op->mnComp : -1; }; // for sort function bool equal(KasumiWordType *op){ return comp(op) == 0 ? true : false; }; }; #endif kasumi-2.5+debian2/src/cellrendererspin.c000066400000000000000000000315261475414712000204600ustar00rootroot00000000000000/*************************************************************************** * This file is derived from the repository of Veejay project * - Homepage: http://veejay.dyne.org/ * - File: trunk/veejay-devel/gveejay-reloaded/widgets/cellrendererspin.c * - Rivision: 501 * * a little bit modifications are made by Takashi Nakamoto ***************************************************************************/ /*************************************************************************** cellrendererspin.c ------------------ begin : Tue Oct 21 2003 copyright : (C) 2003 by Tim-Philipp Mller email : t.i.m at orange dot net ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ /* * * This is a dirty 15-minute hack that tries to * make editable cells with spin buttons instead * of the text entry widget. * * Modify how you please. At the moment you need * to hook up your own cell data function to make * sure that the number of digits is the same in * editing mode as it is in non-editing mode. * * The parameters passed to _new() should probably * be properties, and probably we don't need most * of them anyway. Also, it would be good if there * was a better method to ensure that the number * of digits is the same without this. * * Maybe one should just rip out the whole _render * stuff from GtkCellRendererText and make a * whole new specialised GtkCellRenderFloat * or something. * * If anyone ever completes this code to sth useful, * or achieves sth similar in another way, or has * any comments on it, please drop me a mail. */ #include "cellrendererspin.h" #include #include #define GUI_CELL_RENDERER_SPIN_PATH "gui-cell-renderer-spin-path" #define GUI_CELL_RENDERER_SPIN_INFO "gui-cell-renderer-spin-info" /* Some boring function declarations: GObject type system stuff */ static void gui_cell_renderer_spin_init (GuiCellRendererSpin *cellspin); static void gui_cell_renderer_spin_class_init (GuiCellRendererSpinClass *klass); static void gui_cell_renderer_spin_finalize (GObject *gobject); static gpointer parent_class; static GtkCellEditable *gui_cell_renderer_spin_start_editing (GtkCellRenderer *cell, GdkEvent *event, GtkWidget *widget, const gchar *path, const GdkRectangle *background_area, const GdkRectangle *cell_area, GtkCellRendererState flags); struct _GCRSpinInfo { gulong focus_out_id; }; typedef struct _GCRSpinInfo GCRSpinInfo; /*************************************************************************** * * gui_cell_renderer_spin_get_type * * Here we register our type with the GObject type system if we * haven't done so yet. Everything else is done in the callbacks. * ***************************************************************************/ GType gui_cell_renderer_spin_get_type (void) { static GType cell_spin_type = 0; if (cell_spin_type) return cell_spin_type; if (1) { static const GTypeInfo cell_spin_info = { sizeof (GuiCellRendererSpinClass), NULL, /* base_init */ NULL, /* base_finalize */ (GClassInitFunc) gui_cell_renderer_spin_class_init, NULL, /* class_finalize */ NULL, /* class_data */ sizeof (GuiCellRendererSpin), 0, /* n_preallocs */ (GInstanceInitFunc) gui_cell_renderer_spin_init, }; /* Derive from GtkCellRenderer */ cell_spin_type = g_type_register_static (GTK_TYPE_CELL_RENDERER_TEXT, "GuiCellRendererSpin", &cell_spin_info, 0); } return cell_spin_type; } /*************************************************************************** * * gui_cell_renderer_spin_init * * Set some default properties of the parent (GtkCellRendererText). * ***************************************************************************/ static void gui_cell_renderer_spin_init (GuiCellRendererSpin *cellrendererspin) { return; } /*************************************************************************** * * gui_cell_renderer_spin_class_init: * ***************************************************************************/ static void gui_cell_renderer_spin_class_init (GuiCellRendererSpinClass *klass) { GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS(klass); GObjectClass *object_class = G_OBJECT_CLASS(klass); parent_class = g_type_class_peek_parent (klass); object_class->finalize = gui_cell_renderer_spin_finalize; /* Override the cell renderer's edit-related methods */ cell_class->start_editing = gui_cell_renderer_spin_start_editing; } /*************************************************************************** * * gui_cell_renderer_spin_finalize: free any resources here * ***************************************************************************/ static void gui_cell_renderer_spin_finalize (GObject *object) { /* GuiCellRendererSpin *cellrendererspin = GUI_CELL_RENDERER_SPIN(object); */ /* Free any dynamically allocated resources here */ /* chain up to parent class to make sure * they release all their memory as well */ (* G_OBJECT_CLASS (parent_class)->finalize) (object); } /*************************************************************************** * * gui_cell_renderer_spin_new * * return a new cell renderer instance * (all the parameters should really be properties) * * Not sure which of all these values are really * relevant for the spin button - needs checking! * ***************************************************************************/ GtkCellRenderer * gui_cell_renderer_spin_new (gdouble lower, gdouble upper, gdouble step_inc, gdouble page_inc, gdouble page_size, gdouble climb_rate, guint digits) { GtkCellRenderer *cell; GuiCellRendererSpin *spincell; cell = g_object_new(GUI_TYPE_CELL_RENDERER_SPIN, NULL); spincell = GUI_CELL_RENDERER_SPIN(cell); spincell->lower = lower; spincell->upper = upper; spincell->step_inc = step_inc; spincell->page_inc = page_inc; spincell->page_size = page_size; spincell->climb_rate = climb_rate; spincell->digits = digits; return cell; } /*************************************************************************** * * gui_cell_renderer_spin_editing_done * ***************************************************************************/ static void gui_cell_renderer_spin_editing_done (GtkCellEditable *spinbutton, gpointer data) { const gchar *path; const gchar *new_text; GCRSpinInfo *info; info = g_object_get_data (G_OBJECT (data), GUI_CELL_RENDERER_SPIN_INFO); if (info->focus_out_id > 0) { g_signal_handler_disconnect (spinbutton, info->focus_out_id); info->focus_out_id = 0; } gboolean editing_canceled; g_object_get (spinbutton, "editing-canceled", &editing_canceled, NULL); if (editing_canceled) return; path = g_object_get_data (G_OBJECT (spinbutton), GUI_CELL_RENDERER_SPIN_PATH); new_text = gtk_entry_get_text (GTK_ENTRY(spinbutton)); g_signal_emit_by_name(data, "edited", path, new_text); } /*************************************************************************** * * gui_cell_renderer_spin_focus_out_event * ***************************************************************************/ static gboolean gui_cell_renderer_spin_focus_out_event (GtkWidget *spinbutton, GdkEvent *event, gpointer data) { gui_cell_renderer_spin_editing_done (GTK_CELL_EDITABLE (spinbutton), data); /* entry needs focus-out-event */ return FALSE; } /*************************************************************************** * * gui_cell_renderer_spin_start_editing * ***************************************************************************/ static gboolean onButtonPress (GtkWidget *spinbutton, GdkEventButton *bevent, gpointer data) { if (bevent->button == 1 && (bevent->type == GDK_2BUTTON_PRESS || bevent->type == GDK_3BUTTON_PRESS)) { /* g_print ("double or triple click caught and ignored.\n");*/ return TRUE; /* don't invoke other handlers */ } return FALSE; } /*************************************************************************** * * gui_cell_renderer_spin_start_editing * ***************************************************************************/ static GtkCellEditable * gui_cell_renderer_spin_start_editing (GtkCellRenderer *cell, GdkEvent *event, GtkWidget *widget, const gchar *path, const GdkRectangle *background_area, const GdkRectangle *cell_area, GtkCellRendererState flags) { GtkCellRendererText *celltext; GuiCellRendererSpin *spincell; gboolean editable; gchar *curtext; GtkAdjustment *adj; GtkWidget *spinbutton; GCRSpinInfo *info; gdouble curval = 0.0; celltext = GTK_CELL_RENDERER_TEXT(cell); spincell = GUI_CELL_RENDERER_SPIN(cell); /* If the cell isn't editable we return NULL. */ g_object_get(celltext, "editable", &editable, NULL); if (editable == FALSE) return NULL; spinbutton = g_object_new (GTK_TYPE_SPIN_BUTTON, "has_frame", FALSE, "numeric", TRUE, NULL); /* dirty */ g_object_get(celltext, "text", &curtext, NULL); if (curtext) curval = atof(curtext); adj = GTK_ADJUSTMENT(gtk_adjustment_new(curval, spincell->lower, spincell->upper, spincell->step_inc, spincell->page_inc, spincell->page_size)); gtk_spin_button_configure(GTK_SPIN_BUTTON(spinbutton), adj, spincell->climb_rate, spincell->digits); g_object_set_data_full (G_OBJECT(spinbutton), GUI_CELL_RENDERER_SPIN_PATH, g_strdup (path), g_free); gtk_editable_select_region (GTK_EDITABLE (spinbutton), 0, -1); gtk_widget_show (spinbutton); g_signal_connect (spinbutton, "editing_done", G_CALLBACK (gui_cell_renderer_spin_editing_done), celltext); /* hack trying to catch the quite annoying effect * a double click has while editing */ g_signal_connect (spinbutton, "button_press_event", G_CALLBACK (onButtonPress), NULL); info = g_new0(GCRSpinInfo, 1); info->focus_out_id = g_signal_connect (spinbutton, "focus_out_event", G_CALLBACK (gui_cell_renderer_spin_focus_out_event), celltext); g_object_set_data_full (G_OBJECT (cell), GUI_CELL_RENDERER_SPIN_INFO, info, g_free); return GTK_CELL_EDITABLE (spinbutton); } kasumi-2.5+debian2/src/cellrendererspin.h000066400000000000000000000066411475414712000204650ustar00rootroot00000000000000/*************************************************************************** * This file is derived from the repository of Veejay project * - Homepage: http://veejay.dyne.org/ * - File: trunk/veejay-devel/gveejay-reloaded/widgets/cellrendererspin.h * - Rivision: 501 * * a little bit modifications are made by Takashi Nakamoto ***************************************************************************/ /*************************************************************************** cellrendererspin.h ------------------ begin : Tue Oct 21 2003 copyright : (C) 2003 by Tim-Philipp Mller email : t.i.m at orange dot net ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef _cellrendererspin_h_included_ #define _cellrendererspin_h_included_ #include G_BEGIN_DECLS /* Some boilerplate GObject type check and type cast macros */ #define GUI_TYPE_CELL_RENDERER_SPIN (gui_cell_renderer_spin_get_type()) #define GUI_CELL_RENDERER_SPIN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GUI_TYPE_CELL_RENDERER_SPIN, GuiCellRendererSpin)) #define GUI_CELL_RENDERER_SPIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GUI_TYPE_CELL_RENDERER_SPIN, GuiCellRendererSpinClass)) #define GUI_IS_CELL_RENDERER_SPIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GUI_TYPE_CELL_RENDERER_SPIN)) #define GUI_IS_CELL_RENDERER_SPIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GUI_TYPE_CELL_RENDERER_SPIN)) #define GUI_CELL_RENDERER_SPIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GUI_TYPE_CELL_RENDERER_SPIN, GuiCellRendererSpinClass)) typedef struct _GuiCellRendererSpin GuiCellRendererSpin; typedef struct _GuiCellRendererSpinClass GuiCellRendererSpinClass; struct _GuiCellRendererSpin { GtkCellRendererText parent; gdouble lower; gdouble upper; gdouble step_inc; gdouble page_inc; gdouble page_size; gdouble climb_rate; guint digits; }; struct _GuiCellRendererSpinClass { GtkCellRendererTextClass parent_class; }; GType gui_cell_renderer_spin_get_type (void); GtkCellRenderer *gui_cell_renderer_spin_new (gdouble lower, gdouble upper, gdouble step_inc, gdouble page_inc, gdouble page_size, gdouble climb_rate, guint digits); G_END_DECLS #endif /* _spinbar_renderer_h_included_ */ kasumi-2.5+debian2/src/intl.h000066400000000000000000000011171475414712000160640ustar00rootroot00000000000000#ifndef __INTL_H__ #define __INTL_H__ #ifdef ENABLE_NLS # include # define _(String) dgettext(PACKAGE,String) # ifdef gettext_noop # define N_(String) gettext_noop(String) # else # define N_(String) (String) # endif /* gettext_noop */ #else # define _(String) (String) # define N_(String) (String) # define textdomain(String) (String) # define gettext(String) (String) # define dgettext(Domain,String) (String) # define dcgettext(Domain,String,Type) (String) # define bindtextdomain(Domain,Directory) (Domain) #endif /* ENABLE_NLS */ #endif /* __INTL_H__ */ kasumi-2.5+debian2/src/main.cc000066400000000000000000000166101475414712000162040ustar00rootroot00000000000000/********************************************************************* * * main.cxx * * Kasumi - a management tool for a private dictionary of anthy * * Copyright (C) 2004-2006 Takashi Nakamoto * Copyright (C) 2005 Takuro Ashie * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. * *********************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include "KasumiDic.hh" #include "KasumiMainWindow.hh" #include "KasumiAddWindow.hh" #include "KasumiConfiguration.hh" #include "KasumiException.hh" #include "intl.h" extern "C"{ // ad-hoc solution for a defect of Anthy #include #include } using namespace std; void showHelp(){ cout << "Usage: kasumi [option]" << endl; cout << "Option:" << endl; cout << " -h --help Show this message." << endl; cout << " -v --version Show Kasumi's version and copyright" << endl;; cout << " information" << endl; cout << " -m --manage Run Kasumi in Manage mode." << endl; cout << " You may abbreviate this option." << endl; cout << " -a --add Run Kasumi in Add mode." << endl; cout << " -e --exclusive Run Kasumi in Exclusive mode." << endl; cout << " --sound val Set default sound entry (only in Add mode)" << endl; cout << " --spelling val Set default spelling entry (only in Add mode)" << endl; cout << " --wordclass val Set default word class entry (only in Add mode)" << endl; // cout << " -x val Set default horizontal window position" << endl; // cout << " -y val Set default vertical window position" << endl; cout << " -i --import Import selected text as a spelling" << endl; cout << " -I --ignore Ignore selected text" << endl; #ifdef HAS_ANTHY_DICUTIL_SET_ENCODING cout << " -E --eucjp Use EUC-JP encoding for dictionary" << endl; #endif // HAS_ANTHY_DICUTIL_SET_ENCODING cout << endl; } void showVersion(){ cout << "Kasumi " << VERSION << " - a personal dictionary manager for Anthy" << endl; cout << "Copyright (C) 2004-2006 Takashi Nakamoto.\n"; cout << "This program comes with NO WARRANTY, to the extent permitted " \ "by law. \nYou may redistribute it under the terms of the GNU " \ "General Public License; \nsee the file named COPYING for " \ "details."; cout << endl; } enum { TARGET_STRING }; static GtkTargetEntry targets[]={ {"STRING", 0, TARGET_STRING}, }; static GdkAtom atom0; /* for checking process */ static GdkAtom atom1; /* for sending arguments */ static gchar *arg_text = NULL; static gint instance = -1; static void cb_selection_get(GtkWidget *widget, GtkSelectionData *data, guint info, guint time, GtkWidget *window) { gchar *text = NULL; gint length = 0; if (gtk_selection_data_get_selection (data) == atom0) { text = "Kasumi Selection"; length = strlen(text); gtk_selection_convert(window, atom1, GDK_SELECTION_TYPE_STRING, GDK_CURRENT_TIME); } else if (gtk_selection_data_get_selection (data) == atom1 && arg_text != NULL) { text = arg_text; arg_text = NULL; length = strlen(text); } if (text != NULL) { gtk_selection_data_set_text(data, text, length); if (gtk_selection_data_get_selection (data) == atom1) g_free(text); } } static void cb_selection_received(GtkWidget *widget, GtkSelectionData *data, guint time, gpointer user_data) { if (gtk_selection_data_get_selection (data) == atom0) { instance = MAX(gtk_selection_data_get_length (data), 0); } else if (gtk_selection_data_get_selection (data) == atom1 && gtk_selection_data_get_length (data) > 0) { } } static GtkWidget *check_duplicated_process (int argc, char *argv[]) { GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gint i, length = 0; gtk_widget_realize(window); atom0 = gdk_atom_intern("Kasumi InterProcess communication 0", FALSE); atom1 = gdk_atom_intern("Kasumi InterProcess communication 1", FALSE); gtk_selection_add_targets(window, atom0, targets, 1); gtk_selection_add_targets(window, atom1, targets, 1); g_signal_connect (window, "selection-get", G_CALLBACK(cb_selection_get), window); g_signal_connect (window, "selection-received", G_CALLBACK(cb_selection_received), window); for (i = 0; i < argc; i++) { gint len; len = strlen(argv[i]) * sizeof(gchar); arg_text = (gchar*) g_realloc(arg_text, length + len + sizeof(gchar)); g_memmove(arg_text + length, argv[i], len); length += len; arg_text[length++] = '\n'; } if (length > 0) { arg_text[length - 1] = '\0'; gtk_selection_owner_set(window, atom1, GDK_CURRENT_TIME); } gtk_selection_convert(window,atom0, GDK_SELECTION_TYPE_STRING, GDK_CURRENT_TIME); while (instance < 0) while (gtk_events_pending()) gtk_main_iteration(); if (instance > 0) { /* Kasumi process already exists */ while (arg_text != NULL) while (gtk_events_pending()) gtk_main_iteration(); gtk_widget_destroy(window); cerr << "Kasumi process already exists." << endl; return NULL; } g_free(arg_text); arg_text = NULL; gtk_selection_owner_set(window, atom0, GDK_CURRENT_TIME); return window; } int main(int argc, char *argv[]) { gtk_init(&argc, &argv); #ifdef ENABLE_NLS // for gettext setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); bind_textdomain_codeset(PACKAGE, "UTF-8"); textdomain(PACKAGE); #endif // #ifdef ENABLE_NLS GtkWidget *server = check_duplicated_process (argc, argv); if (!server) return 0; try{ anthy_dic_util_init(); KasumiWordType::initWordTypeList(); KasumiConfiguration *conf = new KasumiConfiguration(argc, argv); #ifdef HAS_ANTHY_DICUTIL_SET_ENCODING if (conf->getPropertyValueByBool("UseEUCJP")) anthy_dic_util_set_encoding(ANTHY_EUC_JP_ENCODING); else anthy_dic_util_set_encoding(ANTHY_UTF8_ENCODING); #endif // HAS_ANTHY_DICUTIL_SET_ENCODING KasumiDic *dic = new KasumiDic(conf); string startupMode = conf->getPropertyValue("StartupMode"); if(startupMode == string("HELP")){ showHelp(); }else if(startupMode == string("VERSION")){ showVersion(); }else if(startupMode == string("MANAGE")){ new KasumiMainWindow(dic,conf); gtk_main(); }else if(startupMode == string("ADD")){ new KasumiAddWindow(dic,conf); gtk_main(); }else if(startupMode == string("EXCLUSIVE")){ new KasumiAddWindow(dic,conf); gtk_main(); } }catch(KasumiException e){ handleException(e); } gtk_widget_destroy (server); return 0; }