├── macro-editor ├── macro-editor.json ├── CMakeLists.txt ├── common.h ├── dialog.h ├── dialog.cpp ├── main.h ├── main.cpp ├── editor.h ├── model.h ├── dialog.ui ├── editor.ui ├── model.cpp └── editor.cpp ├── config.h.in ├── data ├── unikey.png └── CMakeLists.txt ├── unikey ├── data.cpp ├── README ├── data.h ├── CMakeLists.txt ├── usrkeymap.h ├── error.cpp ├── pattern.h ├── mactab.h ├── keycons.h ├── pattern.cpp ├── inputproc.h ├── vnconv.h ├── vnlexi.h ├── unikey.h ├── byteio.h ├── ukengine.h ├── unikey.cpp ├── convert.cpp ├── usrkeymap.cpp ├── mactab.cpp ├── charset.h └── inputproc.cpp ├── .gitignore ├── ChangeLog ├── src ├── unikey.conf.in ├── fcitx-unikey.conf.in ├── CMakeLists.txt ├── fcitx-unikey.desc ├── unikey-ui.h ├── unikey-im.h ├── unikey-config.cpp ├── unikey-config.h └── unikey-ui.cpp ├── README ├── po ├── CMakeLists.txt ├── POTFILES.in.in ├── fcitx-unikey.pot ├── zh_TW.po ├── zh_CN.po ├── ko.po ├── da.po ├── ja.po ├── tr.po ├── de.po ├── ca.po ├── ru.po └── vi.po ├── cmake ├── cmake_uninstall.cmake.in └── FindLibIntl.cmake └── CMakeLists.txt /macro-editor/macro-editor.json: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | -------------------------------------------------------------------------------- /config.h.in: -------------------------------------------------------------------------------- 1 | #cmakedefine LIBICONV_SECOND_ARGUMENT_IS_CONST -------------------------------------------------------------------------------- /data/unikey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fcitx/fcitx-unikey/HEAD/data/unikey.png -------------------------------------------------------------------------------- /unikey/data.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fcitx/fcitx-unikey/HEAD/unikey/data.cpp -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build/* 2 | *.kdev4 3 | .kdev_include_paths 4 | .directory 5 | *.kate-swp 6 | *.orig 7 | *~ 8 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | 2013-07-15: CSSlayer 2 | * 0.2.2 3 | - Fix unikey doesn't show in list 4 | - fix icon install path 5 | -------------------------------------------------------------------------------- /src/unikey.conf.in: -------------------------------------------------------------------------------- 1 | [InputMethod] 2 | UniqueName=unikey 3 | _Name=Unikey 4 | IconName=unikey 5 | Priority=1 6 | LangCode=vi 7 | Parent=fcitx-unikey 8 | -------------------------------------------------------------------------------- /data/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | install(FILES unikey.png DESTINATION ${FCITX4_PREFIX}/share/fcitx/imicon/) 2 | install(FILES unikey.png RENAME fcitx-unikey.png DESTINATION share/icons/hicolor/256x256/apps/) 3 | -------------------------------------------------------------------------------- /unikey/README: -------------------------------------------------------------------------------- 1 | This folder contains ukengine (with changes 2 | for better use in my project) taking from project 3 | x-unikey (http://www.unikey.org). 4 | 5 | Read COPYING for License of ukengine. 6 | 7 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Unikey (Vietnamese Input Method) engine support for Fcitx 2 | 3 | Released under GPLv3+ 4 | 5 | Install: 6 | $ mkdir build && cd build 7 | $ cmake -DCMAKE_INSTALL_PREFIX=`fcitx4-config --prefix` .. 8 | $ make 9 | # make install 10 | -------------------------------------------------------------------------------- /src/fcitx-unikey.conf.in: -------------------------------------------------------------------------------- 1 | [Addon] 2 | Name=fcitx-unikey 3 | _GeneralName=Unikey 4 | _Comment=Unikey Wrapper For Fcitx 5 | Category=InputMethod 6 | Enabled=True 7 | Library=fcitx-unikey.so 8 | Type=SharedLibrary 9 | IMRegisterMethod=ConfigFile 10 | SubConfig=Macro:native:unikey/macro,fcitx-unikey:domain 11 | -------------------------------------------------------------------------------- /po/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB PO_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" *.po) 2 | 3 | foreach(po_file ${PO_FILES}) 4 | string(REPLACE ".po" "" po_lang "${po_file}") 5 | fcitx_translate_add_po_file("${po_lang}" "${po_file}") 6 | endforeach() 7 | fcitx_translate_set_pot_target(pot fcitx-unikey fcitx-unikey.pot) 8 | -------------------------------------------------------------------------------- /po/POTFILES.in.in: -------------------------------------------------------------------------------- 1 | # List of source files which contain translatable strings. 2 | ./po/desc.po 3 | ./po/conf.po 4 | @REL_SOURCE_ROOT@/src/unikey-ui.cpp 5 | @REL_SOURCE_ROOT@/src/unikey-config.cpp 6 | @REL_SOURCE_ROOT@/src/unikey-config.h 7 | @REL_SOURCE_ROOT@/src/unikey-im.cpp 8 | @REL_SOURCE_ROOT@/src/unikey-im.h 9 | @REL_SOURCE_ROOT@/macro-editor/dialog.cpp 10 | @REL_SOURCE_ROOT@/macro-editor/editor.cpp 11 | @REL_SOURCE_ROOT@/macro-editor/main.cpp 12 | @REL_SOURCE_ROOT@/macro-editor/model.cpp 13 | @REL_SOURCE_ROOT@/data/fcitx-unikey.conf.in.in 14 | @REL_SOURCE_ROOT@/data/unikey.conf.in 15 | -------------------------------------------------------------------------------- /unikey/data.h: -------------------------------------------------------------------------------- 1 | // -*- coding:unix; mode:c++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- 2 | #ifndef VIETNAMESE_CHARSET_DATA_H 3 | #define VIETNAMESE_CHARSET_DATA_H 4 | 5 | // This header defines some special characters 6 | const StdVnChar StdStartQuote = (VnStdCharOffset + 201); // 0x93 in the Western charset 7 | // 201 is the offset of character 0x93 (start quote) in Vn charsets 8 | const StdVnChar StdEndQuote = (VnStdCharOffset + 202); // 0x94 in the Western charset 9 | const StdVnChar StdEllipsis = (VnStdCharOffset + 190); // 0x85 in Western charet. 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | include_directories ( 3 | ${PROJECT_SOURCE_DIR}/unikey 4 | ${FCITX4_FCITX_INCLUDE_DIRS} 5 | ${FCITX4_FCITX_CONFIG_INCLUDE_DIRS} 6 | ${FCITX4_FCITX_UTILS_INCLUDE_DIRS} 7 | ${PROJECT_BINARY_DIR} 8 | ${LIBICONV_INCLUDE_DIR} 9 | ) 10 | 11 | set( fcitx_unikey_sources 12 | unikey-im.cpp 13 | unikey-config.cpp 14 | unikey-ui.cpp 15 | ) 16 | 17 | add_definitions( -DLOCALEDIR=\"${CMAKE_INSTALL_PREFIX}/share/locale\" ) 18 | 19 | fcitx_add_addon_full(unikey 20 | SOURCES ${fcitx_unikey_sources} 21 | DESC 22 | LINK_LIBS unikey 23 | IM_CONFIG unikey.conf 24 | ) 25 | -------------------------------------------------------------------------------- /unikey/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | set(UNIKEY_SRCS 3 | byteio.cpp 4 | byteio.h 5 | charset.cpp 6 | charset.h 7 | convert.cpp 8 | data.cpp 9 | data.h 10 | error.cpp 11 | inputproc.cpp 12 | inputproc.h 13 | keycons.h 14 | mactab.cpp 15 | mactab.h 16 | pattern.cpp 17 | pattern.h 18 | ukengine.cpp 19 | ukengine.h 20 | unikey.cpp 21 | unikey.h 22 | usrkeymap.cpp 23 | usrkeymap.h 24 | vnconv.h 25 | vnlexi.h 26 | ) 27 | 28 | 29 | add_library(unikey STATIC ${UNIKEY_SRCS}) 30 | set_target_properties(unikey PROPERTIES COMPILE_FLAGS "-fPIC") 31 | target_link_libraries(unikey LibIntl::LibIntl) 32 | -------------------------------------------------------------------------------- /cmake/cmake_uninstall.cmake.in: -------------------------------------------------------------------------------- 1 | if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 2 | message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") 3 | endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 4 | 5 | file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) 6 | string(REGEX REPLACE "\n" ";" files "${files}") 7 | foreach (file ${files}) 8 | message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") 9 | if (EXISTS "$ENV{DESTDIR}${file}" OR IS_SYMLINK "$ENV{DESTDIR}${file}") 10 | execute_process( 11 | COMMAND @CMAKE_COMMAND@ -E remove "$ENV{DESTDIR}${file}" 12 | OUTPUT_VARIABLE rm_out 13 | RESULT_VARIABLE rm_retval 14 | ) 15 | if(NOT ${rm_retval} EQUAL 0) 16 | message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") 17 | endif (NOT ${rm_retval} EQUAL 0) 18 | else (EXISTS "$ENV{DESTDIR}${file}" OR IS_SYMLINK "$ENV{DESTDIR}${file}") 19 | message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") 20 | endif (EXISTS "$ENV{DESTDIR}${file}" OR IS_SYMLINK "$ENV{DESTDIR}${file}") 21 | endforeach(file) -------------------------------------------------------------------------------- /src/fcitx-unikey.desc: -------------------------------------------------------------------------------- 1 | [Unikey/InputMethod] 2 | Type=Enum 3 | DefaultValue=Telex 4 | Description=Input Method 5 | EnumCount=7 6 | Enum0=Telex 7 | Enum1=VNI 8 | Enum2=VIQR 9 | Enum3=Microsoft Vietnamese 10 | Enum4=UserIM 11 | Enum5=Simple Telex 12 | Enum6=Simple Telex2 13 | 14 | [Unikey/OutputCharset] 15 | Type=Enum 16 | DefaultValue=Unicode 17 | Description=Output Charset 18 | EnumCount=8 19 | Enum0=Unicode 20 | Enum1=TCVN3 21 | Enum2=VNI Win 22 | Enum3=VIQR 23 | Enum4=BK HCM 2 24 | Enum5=CString 25 | Enum6=NCR Decimal 26 | Enum7=NCR Hex 27 | 28 | [Unikey/SpellCheck] 29 | Type=Boolean 30 | DefaultValue=False 31 | Description=Enable spell check 32 | 33 | [Unikey/Macro] 34 | Type=Boolean 35 | DefaultValue=True 36 | Description=Enable macro 37 | 38 | [Unikey/ModernStyle] 39 | Type=Boolean 40 | DefaultValue=False 41 | Description=Use oà, _uý (instead of òa, úy) 42 | 43 | [Unikey/FreeMarking] 44 | Type=Boolean 45 | DefaultValue=True 46 | Description=Allow type with more freedom 47 | 48 | [Unikey/AutoNonVnRestore] 49 | Type=Boolean 50 | DefaultValue=True 51 | Description=Auto restore keys with invalid words 52 | 53 | [Unikey/ProcessWAtBegin] 54 | Type=Boolean 55 | DefaultValue=True 56 | Description=Process W at word begin 57 | 58 | [DescriptionFile] 59 | LocaleDomain=fcitx-unikey 60 | -------------------------------------------------------------------------------- /macro-editor/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | set(MACRO_EDITOR_SRCS 4 | model.cpp 5 | main.cpp 6 | editor.cpp 7 | dialog.cpp 8 | ) 9 | set(MACRO_EDITOR_HDRS 10 | model.h 11 | editor.h 12 | dialog.h 13 | main.h 14 | ) 15 | fcitx_translate_add_sources( 16 | ${MACRO_EDITOR_SRCS} 17 | ${MACRO_EDITOR_HDRS}) 18 | 19 | if (NOT ENABLE_QT) 20 | return() 21 | endif (NOT ENABLE_QT) 22 | 23 | include_directories( 24 | ${CMAKE_CURRENT_BINARY_DIR} 25 | ${PROJECT_SOURCE_DIR}/unikey 26 | ) 27 | 28 | link_directories( 29 | ${FCITX4_FCITX_UTILS_LIBRARY_DIRS} 30 | ${FCITX4_FCITX_CONFIG_LIBRARY_DIRS} 31 | ) 32 | qt5_wrap_ui(MACRO_EDITOR_SRCS editor.ui dialog.ui) 33 | add_library(fcitx-unikey-macro-editor 34 | MODULE ${MACRO_EDITOR_SRCS} ${MACRO_EDITOR_MOCS}) 35 | set_target_properties(fcitx-unikey-macro-editor PROPERTIES 36 | LINK_FLAGS "-Wl,--no-undefined" 37 | AUTOMOC TRUE 38 | ) 39 | target_link_libraries(fcitx-unikey-macro-editor 40 | Qt5::Core 41 | Qt5::Widgets 42 | FcitxQt5::WidgetsAddons 43 | LibIntl::LibIntl 44 | unikey 45 | ${FCITX4_FCITX_UTILS_LIBRARIES} 46 | ${FCITX4_FCITX_CONFIG_LIBRARIES} 47 | ) 48 | 49 | install(TARGETS fcitx-unikey-macro-editor DESTINATION ${FCITX4_ADDON_INSTALL_DIR}/qt) 50 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6) 2 | 3 | project(fcitx-unikey) 4 | 5 | set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH}) 6 | 7 | option(ENABLE_QT "Enable Qt based macro editor" On) 8 | 9 | # uninstall target 10 | configure_file( 11 | "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" 12 | "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" 13 | IMMEDIATE @ONLY) 14 | 15 | add_custom_target(uninstall 16 | COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) 17 | 18 | set(CMAKE_C_FLAGS "-Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -fvisibility=hidden ${CMAKE_C_FLAGS}") 19 | set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -fvisibility=hidden ${CMAKE_CXX_FLAGS}") 20 | set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed ${CMAKE_SHARED_LINKER_FLAGS}") 21 | set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--as-needed ${CMAKE_MODULE_LINKER_FLAGS}") 22 | 23 | find_package(Fcitx 4.2.8 REQUIRED) 24 | find_package(Gettext REQUIRED) 25 | find_package(LibIntl REQUIRED) 26 | 27 | if (ENABLE_QT) 28 | find_package(Qt5 5.7 REQUIRED COMPONENTS Core Gui Widgets) 29 | find_package(FcitxQt5WidgetsAddons 1.1 REQUIRED) 30 | 31 | endif (ENABLE_QT) 32 | 33 | configure_file(config.h.in config.h) 34 | 35 | add_subdirectory(po) 36 | add_subdirectory(unikey) 37 | add_subdirectory(src) 38 | add_subdirectory(data) 39 | add_subdirectory(macro-editor) 40 | -------------------------------------------------------------------------------- /cmake/FindLibIntl.cmake: -------------------------------------------------------------------------------- 1 | # - find where dlopen and friends are located. 2 | # LIBINTL_FOUND - system has dynamic linking interface available 3 | # LIBINTL_INCLUDE_DIR - where dlfcn.h is located. 4 | # LIBINTL_LIBRARY - libraries needed to use dlopen 5 | 6 | include(CheckFunctionExists) 7 | 8 | find_path(LIBINTL_INCLUDE_DIR NAMES libintl.h) 9 | find_library(LIBINTL_LIBRARY NAMES intl) 10 | if(LIBINTL_LIBRARY) 11 | set(LIBINTL_FOUND TRUE) 12 | else(LIBINTL_LIBRARY) 13 | check_function_exists(dgettext LIBINTL_FOUND) 14 | # If dlopen can be found without linking in dl then dlopen is part 15 | # of libc, so don't need to link extra libs. 16 | set(LIBINTL_LIBRARY "") 17 | endif(LIBINTL_LIBRARY) 18 | 19 | include(FindPackageHandleStandardArgs) 20 | find_package_handle_standard_args(LIBINTL 21 | FOUND_VAR 22 | LIBINTL_FOUND 23 | REQUIRED_VARS 24 | LIBINTL_INCLUDE_DIR 25 | ) 26 | 27 | mark_as_advanced(LIBINTL_INCLUDE_DIR LIBINTL_LIBRARY) 28 | 29 | if(LIBINTL_FOUND AND NOT TARGET LibIntl::LibIntl) 30 | if (LIBINTL_LIBRARY) 31 | add_library(LibIntl::LibIntl UNKNOWN IMPORTED) 32 | set_target_properties(LibIntl::LibIntl PROPERTIES 33 | IMPORTED_LOCATION "${LIBINTL_LIBRARY}") 34 | else() 35 | add_library(LibIntl::LibIntl INTERFACE IMPORTED ) 36 | endif() 37 | set_target_properties(LibIntl::LibIntl PROPERTIES 38 | INTERFACE_INCLUDE_DIRECTORIES "${LIBINTL_INCLUDE_DIR}" 39 | ) 40 | endif() 41 | 42 | -------------------------------------------------------------------------------- /unikey/usrkeymap.h: -------------------------------------------------------------------------------- 1 | // -*- coding:unix; mode:c++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- 2 | /* Unikey Vietnamese Input Method 3 | * Copyright (C) 2000-2005 Pham Kim Long 4 | * Contact: 5 | * unikey@gmail.com 6 | * UniKey project: http://unikey.org 7 | * 8 | * This library is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License as published by the Free Software Foundation; either 11 | * version 2 of the License, or (at your option) any later version. 12 | * 13 | * This library is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | * Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public 19 | * License along with this library; if not, write to the 20 | * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | 24 | #ifndef __UNIKEY_USER_KEY_MAP_H 25 | #define __UNIKEY_USER_KEY_MAP_H 26 | 27 | #include "inputproc.h" 28 | struct UkKeyMapPair { 29 | unsigned char key; 30 | int action; 31 | }; 32 | 33 | DllInterface int UkLoadKeyMap(const char *fileName, int keyMap[256]); 34 | DllInterface int UkLoadKeyOrderMap(const char *fileName, UkKeyMapPair *pMap, int *pMapCount); 35 | DllInterface int UkStoreKeyOrderMap(const char *fileName, UkKeyMapPair *pMap, int mapCount); 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /macro-editor/common.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2012~2012 by CSSlayer * 3 | * wengxt@gmail.com * 4 | * * 5 | * This program is free software: you can redistribute it and/or modify * 6 | * it under the terms of the GNU General Public License as published by * 7 | * the Free Software Foundation, either version 3 of the License, or * 8 | * (at your option) any later version. * 9 | * * 10 | * This program is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 13 | * GNU General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU General Public License * 16 | * along with this program. If not, see . * 17 | * * 18 | ***************************************************************************/ 19 | 20 | #ifndef _FCITX_UNIKEY_COMMON_H 21 | #define _FCITX_UNIKEY_COMMON_H 22 | 23 | #include 24 | 25 | #define _(x) QString::fromUtf8(dgettext("fcitx-unikey", x)) 26 | 27 | #endif // _FCITX_UNIKEY_COMMON_H 28 | -------------------------------------------------------------------------------- /src/unikey-ui.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2012~2012 by CSSlayer * 3 | * wengxt@gmail.com * 4 | * * 5 | * This program is free software: you can redistribute it and/or modify * 6 | * it under the terms of the GNU General Public License as published by * 7 | * the Free Software Foundation, either version 3 of the License, or * 8 | * (at your option) any later version. * 9 | * * 10 | * This program is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 13 | * GNU General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU General Public License * 16 | * along with this program. If not, see . * 17 | * * 18 | ***************************************************************************/ 19 | 20 | #ifndef UNIKEY_UI_H 21 | #define UNIKEY_UI_H 22 | #include "unikey-im.h" 23 | 24 | void InitializeBar(FcitxUnikey* unikey); 25 | void InitializeMenu(FcitxUnikey* unikey); 26 | void UpdateUnikeyUI(FcitxUnikey* unikey); 27 | 28 | #endif //UNIKEY_UI_H -------------------------------------------------------------------------------- /unikey/error.cpp: -------------------------------------------------------------------------------- 1 | // -*- coding:unix; mode:c++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- 2 | /*------------------------------------------------------------------------------ 3 | VnConv: Vietnamese Encoding Converter Library 4 | UniKey Project: http://unikey.sourceforge.net 5 | Copyleft (C) 1998-2002 Pham Kim Long 6 | Contact: longp@cslab.felk.cvut.cz 7 | 8 | This program is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU General Public License 10 | as published by the Free Software Foundation; either version 2 11 | of the License, or (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 21 | --------------------------------------------------------------------------------*/ 22 | // For some unknown reasons, the functions in this file cannot be exported 23 | // We had to move them to convert.cpp. 24 | // TODO: inspect this problem later! 25 | /* 26 | #include "stdafx.h" 27 | #include "vnconv.h" 28 | 29 | char *ErrTable[VNCONV_LAST_ERROR] = 30 | {"No error", 31 | "Unknown error", 32 | "Invalid charset", 33 | "Error opening input file", 34 | "Error opening output file", 35 | "Error writing to output stream", 36 | "Not enough memory", 37 | }; 38 | 39 | DllExport const char * VnConvErrMsg(int errCode) 40 | { 41 | if (errCode < 0 || errCode >= VNCONV_LAST_ERROR) 42 | errCode = VNCONV_UNKNOWN_ERROR; 43 | return ErrTable[errCode]; 44 | } 45 | 46 | */ -------------------------------------------------------------------------------- /macro-editor/dialog.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2012~2012 by CSSlayer * 3 | * wengxt@gmail.com * 4 | * * 5 | * This program is free software: you can redistribute it and/or modify * 6 | * it under the terms of the GNU General Public License as published by * 7 | * the Free Software Foundation, either version 3 of the License, or * 8 | * (at your option) any later version. * 9 | * * 10 | * This program is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 13 | * GNU General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU General Public License * 16 | * along with this program. If not, see . * 17 | * * 18 | ***************************************************************************/ 19 | 20 | #include 21 | 22 | class CMacroTable; 23 | namespace Ui { 24 | class Dialog; 25 | } 26 | 27 | namespace fcitx_unikey { 28 | class MacroDialog : public QDialog { 29 | Q_OBJECT 30 | public: 31 | explicit MacroDialog(QWidget* parent = 0); 32 | virtual ~MacroDialog(); 33 | QString macro() const; 34 | QString word() const; 35 | 36 | private: 37 | Ui::Dialog* m_ui; 38 | }; 39 | } -------------------------------------------------------------------------------- /macro-editor/dialog.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2012~2012 by CSSlayer * 3 | * wengxt@gmail.com * 4 | * * 5 | * This program is free software: you can redistribute it and/or modify * 6 | * it under the terms of the GNU General Public License as published by * 7 | * the Free Software Foundation, either version 3 of the License, or * 8 | * (at your option) any later version. * 9 | * * 10 | * This program is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 13 | * GNU General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU General Public License * 16 | * along with this program. If not, see . * 17 | * * 18 | ***************************************************************************/ 19 | 20 | #include "ui_dialog.h" 21 | #include "dialog.h" 22 | 23 | namespace fcitx_unikey { 24 | MacroDialog::MacroDialog(QWidget* parent): QDialog(parent), 25 | m_ui(new Ui::Dialog) 26 | { 27 | m_ui->setupUi(this); 28 | } 29 | 30 | MacroDialog::~MacroDialog() 31 | { 32 | delete m_ui; 33 | } 34 | 35 | QString MacroDialog::macro() const 36 | { 37 | return m_ui->macroLineEdit->text(); 38 | } 39 | 40 | QString MacroDialog::word() const 41 | { 42 | return m_ui->wordLineEdit->text(); 43 | } 44 | 45 | 46 | } -------------------------------------------------------------------------------- /macro-editor/main.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2012~2012 by CSSlayer * 3 | * wengxt@gmail.com * 4 | * * 5 | * This program is free software: you can redistribute it and/or modify * 6 | * it under the terms of the GNU General Public License as published by * 7 | * the Free Software Foundation, either version 3 of the License, or * 8 | * (at your option) any later version. * 9 | * * 10 | * This program is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 13 | * GNU General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU General Public License * 16 | * along with this program. If not, see . * 17 | * * 18 | ***************************************************************************/ 19 | 20 | #ifndef _MAIN_H_ 21 | #define _MAIN_H_ 22 | 23 | #include 24 | 25 | class MacroEditorPlugin : public FcitxQtConfigUIPlugin { 26 | Q_OBJECT 27 | public: 28 | Q_PLUGIN_METADATA(IID FcitxQtConfigUIFactoryInterface_iid FILE "macro-editor.json") 29 | explicit MacroEditorPlugin(QObject* parent = 0); 30 | virtual QString name(); 31 | virtual QStringList files(); 32 | virtual QString domain(); 33 | virtual FcitxQtConfigUIWidget* create(const QString& key); 34 | }; 35 | 36 | #endif // FCITX_TOOLS_GUI_MAIN_H_ 37 | -------------------------------------------------------------------------------- /src/unikey-im.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2012~2012 by CSSlayer * 3 | * wengxt@gmail.com * 4 | * * 5 | * This program is free software: you can redistribute it and/or modify * 6 | * it under the terms of the GNU General Public License as published by * 7 | * the Free Software Foundation, either version 3 of the License, or * 8 | * (at your option) any later version. * 9 | * * 10 | * This program is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 13 | * GNU General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU General Public License * 16 | * along with this program. If not, see . * 17 | * * 18 | ***************************************************************************/ 19 | 20 | #ifndef UNIKEY_IM_H 21 | #define UNIKEY_IM_H 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | #define _(x) dgettext("fcitx-unikey", (x)) 28 | #include "unikey-config.h" 29 | 30 | struct FcitxUnikey 31 | { 32 | UnikeyConfig config; 33 | std::string* preeditstr; 34 | UnikeyOptions ukopt; 35 | FcitxInstance* owner; 36 | bool auto_commit; 37 | bool last_key_with_shift; 38 | FcitxKeySym lastShiftPressed; 39 | FcitxUIMenu imMenu; 40 | FcitxUIMenu ocMenu; 41 | }; 42 | 43 | void UpdateUnikeyConfig(FcitxUnikey* unikey); 44 | 45 | #endif //UNIKEY_IM_H 46 | -------------------------------------------------------------------------------- /src/unikey-config.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2012~2012 by CSSlayer * 3 | * wengxt@gmail.com * 4 | * * 5 | * This program is free software: you can redistribute it and/or modify * 6 | * it under the terms of the GNU General Public License as published by * 7 | * the Free Software Foundation, either version 3 of the License, or * 8 | * (at your option) any later version. * 9 | * * 10 | * This program is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 13 | * GNU General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU General Public License * 16 | * along with this program. If not, see . * 17 | * * 18 | ***************************************************************************/ 19 | 20 | #include "unikey-config.h" 21 | 22 | /* USE fcitx provided macro to bind config and variable */ 23 | CONFIG_BINDING_BEGIN(UnikeyConfig) 24 | CONFIG_BINDING_REGISTER("Unikey", "InputMethod", im) 25 | CONFIG_BINDING_REGISTER("Unikey", "OuputCharset", oc) 26 | CONFIG_BINDING_REGISTER("Unikey", "SpellCheck", spellCheck) 27 | CONFIG_BINDING_REGISTER("Unikey", "Macro", macro) 28 | CONFIG_BINDING_REGISTER("Unikey", "ModernStyle", modernStyle) 29 | CONFIG_BINDING_REGISTER("Unikey", "FreeMarking", freeMarking) 30 | CONFIG_BINDING_REGISTER("Unikey", "AutoNonVnRestore", autoNonVnRestore) 31 | CONFIG_BINDING_REGISTER("Unikey", "ProcessWAtBegin", process_w_at_begin) 32 | CONFIG_BINDING_END() -------------------------------------------------------------------------------- /src/unikey-config.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2012~2012 by CSSlayer * 3 | * wengxt@gmail.com * 4 | * * 5 | * This program is free software: you can redistribute it and/or modify * 6 | * it under the terms of the GNU General Public License as published by * 7 | * the Free Software Foundation, either version 3 of the License, or * 8 | * (at your option) any later version. * 9 | * * 10 | * This program is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 13 | * GNU General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU General Public License * 16 | * along with this program. If not, see . * 17 | * * 18 | ***************************************************************************/ 19 | 20 | #ifndef UNIKEY_CONFIG_H 21 | #define UNIKEY_CONFIG_H 22 | #include 23 | #include 24 | 25 | enum UkConv { 26 | UKCONV_XUTF8, 27 | UKCONV_TCVN3, 28 | UKCONV_VNIWIN, 29 | UKCONV_VIQR, 30 | UKCONV_BKHCM2, 31 | UKCONV_UNI_CSTRING, 32 | UKCONV_UNIREF, 33 | UKCONV_UNIREF_HEX 34 | }; 35 | 36 | struct UnikeyConfig 37 | { 38 | FcitxGenericConfig gconfig; 39 | UkInputMethod im; 40 | UkConv oc; 41 | boolean spellCheck; 42 | boolean macro; 43 | boolean process_w_at_begin; 44 | boolean autoNonVnRestore; 45 | boolean modernStyle; 46 | boolean freeMarking; 47 | }; 48 | 49 | 50 | CONFIG_BINDING_DECLARE(UnikeyConfig); 51 | 52 | #endif // UNIKEY_CONFIG_H -------------------------------------------------------------------------------- /macro-editor/main.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2012~2012 by CSSlayer * 3 | * wengxt@gmail.com * 4 | * * 5 | * This program is free software: you can redistribute it and/or modify * 6 | * it under the terms of the GNU General Public License as published by * 7 | * the Free Software Foundation, either version 3 of the License, or * 8 | * (at your option) any later version. * 9 | * * 10 | * This program is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 13 | * GNU General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU General Public License * 16 | * along with this program. If not, see . * 17 | * * 18 | ***************************************************************************/ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include "main.h" 25 | #include "editor.h" 26 | #include "model.h" 27 | 28 | MacroEditorPlugin::MacroEditorPlugin(QObject* parent): FcitxQtConfigUIPlugin(parent) 29 | { 30 | 31 | } 32 | 33 | FcitxQtConfigUIWidget* MacroEditorPlugin::create(const QString& key) 34 | { 35 | Q_UNUSED(key); 36 | return new fcitx_unikey::MacroEditor; 37 | } 38 | 39 | QStringList MacroEditorPlugin::files() 40 | { 41 | return QStringList("unikey/macro"); 42 | } 43 | 44 | QString MacroEditorPlugin::name() 45 | { 46 | return "unikey-macro-editor"; 47 | } 48 | 49 | QString MacroEditorPlugin::domain() 50 | { 51 | return "fcitx-unikey"; 52 | } 53 | -------------------------------------------------------------------------------- /unikey/pattern.h: -------------------------------------------------------------------------------- 1 | // -*- coding:unix; mode:c++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- 2 | /*------------------------------------------------------------------------------ 3 | VnConv: Vietnamese Encoding Converter Library 4 | UniKey Project: http://unikey.sourceforge.net 5 | Copyleft (C) 1998-2002 Pham Kim Long 6 | Contact: longp@cslab.felk.cvut.cz 7 | 8 | This program is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU General Public License 10 | as published by the Free Software Foundation; either version 2 11 | of the License, or (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 21 | --------------------------------------------------------------------------------*/ 22 | 23 | #ifndef __PATTERN_H 24 | #define __PATTERN_H 25 | 26 | #if defined(_WIN32) 27 | #if defined(UNIKEYHOOK) 28 | #define DllInterface __declspec( dllexport ) 29 | #else 30 | #define DllInterface __declspec( dllimport ) 31 | #endif 32 | #else 33 | #define DllInterface //not used 34 | #endif 35 | 36 | #define MAX_PATTERN_LEN 40 37 | 38 | class DllInterface PatternState 39 | { 40 | public: 41 | char *m_pattern; 42 | int m_border[MAX_PATTERN_LEN+1]; 43 | int m_pos; 44 | int m_found; 45 | void init(char *pattern); 46 | void reset(); 47 | int foundAtNextChar(char ch); //get next input char, returns 1 if pattern is found. 48 | }; 49 | 50 | class DllInterface PatternList 51 | { 52 | public: 53 | PatternState *m_patterns; 54 | int m_count; 55 | void init(char **patterns, int count); 56 | int foundAtNextChar(char ch); 57 | void reset(); 58 | 59 | PatternList() { 60 | m_count = 0; 61 | m_patterns = 0; 62 | } 63 | 64 | ~PatternList() 65 | { 66 | if (m_patterns) 67 | delete [] m_patterns; 68 | } 69 | }; 70 | 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /macro-editor/editor.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2012~2012 by CSSlayer * 3 | * wengxt@gmail.com * 4 | * * 5 | * This program is free software: you can redistribute it and/or modify * 6 | * it under the terms of the GNU General Public License as published by * 7 | * the Free Software Foundation, either version 3 of the License, or * 8 | * (at your option) any later version. * 9 | * * 10 | * This program is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 13 | * GNU General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU General Public License * 16 | * along with this program. If not, see . * 17 | * * 18 | ***************************************************************************/ 19 | 20 | #include 21 | 22 | class CMacroTable; 23 | namespace Ui { 24 | class Editor; 25 | } 26 | 27 | namespace fcitx_unikey { 28 | 29 | class MacroModel; 30 | class MacroEditor : public FcitxQtConfigUIWidget { 31 | Q_OBJECT 32 | public: 33 | explicit MacroEditor(QWidget* parent = 0); 34 | virtual ~MacroEditor(); 35 | virtual void load(); 36 | virtual void save(); 37 | virtual QString title(); 38 | virtual QString addon(); 39 | virtual QString icon(); 40 | 41 | static QString getData(CMacroTable* table, int i, bool iskey); 42 | private slots: 43 | void addWord(); 44 | void deleteWord(); 45 | void deleteAllWord(); 46 | void itemFocusChanged(); 47 | void addWordAccepted(); 48 | void importMacro(); 49 | void exportMacro(); 50 | void importFileSelected(); 51 | void exportFileSelected(); 52 | private: 53 | Ui::Editor* m_ui; 54 | CMacroTable* m_table; 55 | MacroModel* m_model; 56 | }; 57 | } 58 | -------------------------------------------------------------------------------- /unikey/mactab.h: -------------------------------------------------------------------------------- 1 | // -*- coding:unix; mode:c++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- 2 | /* Unikey Vietnamese Input Method 3 | * Copyright (C) 2000-2005 Pham Kim Long 4 | * Contact: 5 | * unikey@gmail.com 6 | * UniKey project: http://unikey.org 7 | * 8 | * This library is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License as published by the Free Software Foundation; either 11 | * version 2 of the License, or (at your option) any later version. 12 | * 13 | * This library is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | * Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public 19 | * License along with this library; if not, write to the 20 | * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | 24 | #ifndef __MACRO_TABLE_H 25 | #define __MACRO_TABLE_H 26 | 27 | #include "keycons.h" 28 | #include "charset.h" 29 | 30 | #if defined(_WIN32) 31 | #if defined(UNIKEYHOOK) 32 | #define DllInterface __declspec( dllexport ) 33 | #else 34 | #define DllInterface __declspec( dllimport ) 35 | #endif 36 | #else 37 | #define DllInterface //not used 38 | #define DllExport 39 | #define DllImport 40 | #endif 41 | 42 | struct MacroDef 43 | { 44 | int keyOffset; 45 | int textOffset; 46 | }; 47 | 48 | #if !defined(WIN32) 49 | typedef char TCHAR; 50 | #endif 51 | 52 | class DllInterface CMacroTable 53 | { 54 | public: 55 | void init(); 56 | int loadFromFile(const char *fname); 57 | int writeToFile(const char *fname); 58 | int writeToFp(FILE* f); 59 | 60 | const StdVnChar *lookup(StdVnChar *key); 61 | const StdVnChar *getKey(int idx) const; 62 | const StdVnChar *getText(int idx) const; 63 | int getCount() const { return m_count; } 64 | void resetContent(); 65 | int addItem(const char *item, int charset); 66 | int addItem(const void *key, const void *text, int charset); 67 | 68 | protected: 69 | bool readHeader(FILE *f, int & version); 70 | void writeHeader(FILE *f); 71 | 72 | MacroDef m_table[MAX_MACRO_ITEMS]; 73 | char m_macroMem[MACRO_MEM_SIZE]; 74 | 75 | int m_count; 76 | int m_memSize, m_occupied; 77 | }; 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /macro-editor/model.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2012~2012 by CSSlayer * 3 | * wengxt@gmail.com * 4 | * * 5 | * This program is free software: you can redistribute it and/or modify * 6 | * it under the terms of the GNU General Public License as published by * 7 | * the Free Software Foundation, either version 3 of the License, or * 8 | * (at your option) any later version. * 9 | * * 10 | * This program is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 13 | * GNU General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU General Public License * 16 | * along with this program. If not, see . * 17 | * * 18 | ***************************************************************************/ 19 | 20 | #include 21 | #include 22 | #include "mactab.h" 23 | 24 | namespace fcitx_unikey { 25 | class MacroModel : public QAbstractTableModel { 26 | Q_OBJECT 27 | public: 28 | explicit MacroModel(QObject* parent = 0); 29 | virtual ~MacroModel(); 30 | 31 | virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; 32 | virtual int rowCount(const QModelIndex& parent = QModelIndex()) const; 33 | virtual int columnCount(const QModelIndex& parent = QModelIndex()) const; 34 | virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; 35 | void load(CMacroTable* table); 36 | void addItem(const QString& macro, const QString& word); 37 | void deleteItem(int row); 38 | void deleteAllItem(); 39 | void save(CMacroTable* m_table); 40 | bool needSave(); 41 | 42 | signals: 43 | void needSaveChanged(bool m_needSave); 44 | 45 | private: 46 | void setNeedSave(bool needSave); 47 | bool m_needSave; 48 | QSet m_keyset; 49 | QList >m_list; 50 | }; 51 | 52 | } -------------------------------------------------------------------------------- /macro-editor/dialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | Dialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 334 10 | 91 11 | 12 | 13 | 14 | Dialog 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | Word: 26 | 27 | 28 | 29 | 30 | 31 | 32 | Macro: 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | Qt::Horizontal 45 | 46 | 47 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok 48 | 49 | 50 | 51 | 52 | 53 | 54 | macroLineEdit 55 | wordLineEdit 56 | buttonBox 57 | 58 | 59 | 60 | 61 | buttonBox 62 | accepted() 63 | Dialog 64 | accept() 65 | 66 | 67 | 248 68 | 254 69 | 70 | 71 | 157 72 | 274 73 | 74 | 75 | 76 | 77 | buttonBox 78 | rejected() 79 | Dialog 80 | reject() 81 | 82 | 83 | 316 84 | 260 85 | 86 | 87 | 286 88 | 274 89 | 90 | 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /unikey/keycons.h: -------------------------------------------------------------------------------- 1 | // -*- coding:unix; mode:c++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- 2 | /*------------------------------------------------------------------------------ 3 | UniKey - Open-source Vietnamese Keyboard 4 | Copyright (C) 1998-2004 Pham Kim Long 5 | Contact: 6 | unikey@gmail.com 7 | http://unikey.org 8 | 9 | This program is free software; you can redistribute it and/or 10 | modify it under the terms of the GNU General Public License 11 | as published by the Free Software Foundation; either version 2 12 | of the License, or (at your option) any later version. 13 | 14 | This program is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with this program; if not, write to the Free Software 21 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 22 | --------------------------------------------------------------------------------*/ 23 | #ifndef __KEY_CONS_H 24 | #define __KEY_CONS_H 25 | 26 | // macro table constants 27 | #define MAX_MACRO_KEY_LEN 16 28 | //#define MAX_MACRO_TEXT_LEN 256 29 | #define MAX_MACRO_TEXT_LEN 1024 30 | #define MAX_MACRO_ITEMS 1024 31 | #define MAX_MACRO_LINE (MAX_MACRO_TEXT_LEN + MAX_MACRO_KEY_LEN) 32 | 33 | #define MACRO_MEM_SIZE (1024*128) //128 KB 34 | 35 | #define CP_US_ANSI 1252 36 | 37 | typedef enum {UkTelex, UkVni, UkViqr, UkMsVi, UkUsrIM, UkSimpleTelex, UkSimpleTelex2} UkInputMethod; 38 | typedef struct _UnikeyOptions UnikeyOptions; 39 | 40 | struct _UnikeyOptions 41 | { 42 | int freeMarking; 43 | int modernStyle; 44 | int macroEnabled; 45 | int useUnicodeClipboard; 46 | int alwaysMacro; 47 | int strictSpellCheck; 48 | int useIME; //for Win32 only 49 | int spellCheckEnabled; 50 | int autoNonVnRestore; 51 | }; 52 | 53 | #define UKOPT_FLAG_ALL 0xFFFFFFFF 54 | #define UKOPT_FLAG_FREE_STYLE 0x00000001 55 | //#define UKOPT_FLAG_MANUAL_TONE 0x00000002 56 | #define UKOPT_FLAG_MODERN 0x00000004 57 | #define UKOPT_FLAG_MACRO_ENABLED 0x00000008 58 | #define UKOPT_FLAG_USE_CLIPBOARD 0x00000010 59 | #define UKOPT_FLAG_ALWAYS_MACRO 0x00000020 60 | #define UKOPT_FLAG_STRICT_SPELL 0x00000040 61 | #define UKOPT_FLAG_USE_IME 0x00000080 62 | #define UKOPT_FLAG_SPELLCHECK_ENABLED 0x00000100 63 | 64 | #if defined(WIN32) 65 | typedef struct _UnikeySysInfo UnikeySysInfo; 66 | struct _UnikeySysInfo 67 | { 68 | int switchKey; 69 | HHOOK keyHook; 70 | HHOOK mouseHook; 71 | HWND hMainDlg; 72 | UINT iconMsgId; 73 | HICON hVietIcon,hEnIcon; 74 | int unicodePlatform; 75 | DWORD winMajorVersion, winMinorVersion; 76 | }; 77 | #endif 78 | 79 | typedef enum {UkCharOutput, UkKeyOutput} UkOutputType; 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /macro-editor/editor.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | Editor 4 | 5 | 6 | 7 | 0 8 | 0 9 | 375 10 | 366 11 | 12 | 13 | 14 | MainWindow 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | Qt::Horizontal 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | Qt::Vertical 98 | 99 | 100 | 101 | 20 102 | 40 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /unikey/pattern.cpp: -------------------------------------------------------------------------------- 1 | // -*- coding:unix; mode:c++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- 2 | /*------------------------------------------------------------------------------ 3 | VnConv: Vietnamese Encoding Converter Library 4 | UniKey Project: http://unikey.sourceforge.net 5 | Copyleft (C) 1998-2002 Pham Kim Long 6 | Contact: longp@cslab.felk.cvut.cz 7 | 8 | This program is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU General Public License 10 | as published by the Free Software Foundation; either version 2 11 | of the License, or (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 21 | --------------------------------------------------------------------------------*/ 22 | 23 | #include "pattern.h" 24 | 25 | ////////////////////////////////////////////////// 26 | // Pattern matching (based on KPM algorithm) 27 | ////////////////////////////////////////////////// 28 | 29 | //---------------------------- 30 | void PatternState::reset() 31 | { 32 | m_pos = 0; 33 | m_found = 0; 34 | } 35 | 36 | //---------------------------- 37 | void PatternState::init(char *pattern) 38 | { 39 | m_pos = 0; 40 | m_found = 0; 41 | m_pattern = pattern; 42 | 43 | int i=0, j=-1; 44 | m_border[i]=j; 45 | while (m_pattern[i]) 46 | { 47 | while (j>=0 && m_pattern[i]!=m_pattern[j]) j=m_border[j]; 48 | i++; j++; 49 | m_border[i]=j; 50 | } 51 | } 52 | 53 | //----------------------------------------------------- 54 | //get next input char, returns 1 if pattern is found. 55 | //----------------------------------------------------- 56 | int PatternState::foundAtNextChar(char ch) 57 | { 58 | int ret = 0; 59 | //int j = m_pos; 60 | while (m_pos>=0 && ch!=m_pattern[m_pos]) m_pos=m_border[m_pos]; 61 | m_pos++; 62 | if (m_pattern[m_pos]==0) { 63 | m_found++; 64 | m_pos = m_border[m_pos]; 65 | ret = 1; 66 | } 67 | return ret; 68 | } 69 | 70 | //----------------------------------------------------- 71 | void PatternList::init(char **patterns, int count) 72 | { 73 | m_count = count; 74 | delete [] m_patterns; 75 | m_patterns = new PatternState[count]; 76 | for (int i=0; i u+ , ] -> o+ 50 | vneEscChar, 51 | vneNormal, //does not belong to any of the above categories 52 | vneCount //just to count how many event types there are 53 | }; 54 | 55 | enum UkCharType { 56 | ukcVn, 57 | ukcWordBreak, 58 | ukcNonVn, 59 | ukcReset 60 | }; 61 | 62 | struct UkKeyEvent { 63 | int evType; 64 | UkCharType chType; 65 | VnLexiName vnSym; //meaningful only when chType==ukcVn 66 | unsigned int keyCode; 67 | int tone; //meaningful only when this is a vowel 68 | }; 69 | 70 | struct UkKeyMapping { 71 | unsigned char key; 72 | int action; 73 | }; 74 | 75 | /////////////////////////////////////////// 76 | class UkInputProcessor { 77 | 78 | public: 79 | //don't do anything with constructor, because 80 | //this object can be allocated in shared memory 81 | //Use init method instead 82 | //UkInputProcessor(); 83 | 84 | void init(); 85 | 86 | UkInputMethod getIM() 87 | { 88 | return m_im; 89 | } 90 | 91 | void keyCodeToEvent(unsigned int keyCode, UkKeyEvent & ev); 92 | void keyCodeToSymbol(unsigned int keyCode, UkKeyEvent & ev); 93 | int setIM(UkInputMethod im); 94 | int setIM(int map[256]); 95 | void getKeyMap(int map[256]); 96 | 97 | UkCharType getCharType(unsigned int keyCode); 98 | 99 | protected: 100 | static bool m_classInit; 101 | 102 | UkInputMethod m_im; 103 | int m_keyMap[256]; 104 | 105 | void useBuiltIn(UkKeyMapping *map); 106 | 107 | }; 108 | 109 | void UkResetKeyMap(int keyMap[256]); 110 | void SetupInputClassifierTable(); 111 | 112 | DllInterface extern UkKeyMapping TelexMethodMapping[]; 113 | DllInterface extern UkKeyMapping SimpleTelexMethodMapping[]; 114 | DllInterface extern UkKeyMapping VniMethodMapping[]; 115 | DllInterface extern UkKeyMapping VIQRMethodMapping[]; 116 | DllInterface extern UkKeyMapping MsViMethodMapping[]; 117 | 118 | extern VnLexiName IsoVnLexiMap[]; 119 | inline VnLexiName IsoToVnLexi(unsigned int keyCode) 120 | { 121 | return (keyCode >= 256)? vnl_nonVnChar : IsoVnLexiMap[keyCode]; 122 | } 123 | 124 | #endif 125 | -------------------------------------------------------------------------------- /unikey/vnconv.h: -------------------------------------------------------------------------------- 1 | // -*- coding:unix; mode:c++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- 2 | /*------------------------------------------------------------------------------ 3 | VnConv: Vietnamese Encoding Converter Library 4 | UniKey Project: http://unikey.sourceforge.net 5 | Copyleft (C) 1998-2002 Pham Kim Long 6 | Contact: longp@cslab.felk.cvut.cz 7 | 8 | This program is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU General Public License 10 | as published by the Free Software Foundation; either version 2 11 | of the License, or (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 21 | --------------------------------------------------------------------------------*/ 22 | 23 | // 24 | #ifndef __VN_CONVERT_H 25 | #define __VN_CONVERT_H 26 | 27 | #if defined(_WIN32) 28 | #if defined(UNIKEYHOOK) 29 | #define DllInterface __declspec( dllexport ) 30 | #else 31 | #define DllInterface __declspec( dllimport ) 32 | #endif 33 | #define DllExport __declspec( dllexport ) 34 | #define DllImport __declspec( dllimport ) 35 | #else 36 | #define DllInterface //not used 37 | #define DllExport 38 | #define DllImport 39 | #endif 40 | 41 | #define CONV_CHARSET_UNICODE 0 42 | #define CONV_CHARSET_UNIUTF8 1 43 | #define CONV_CHARSET_UNIREF 2 //&#D; 44 | #define CONV_CHARSET_UNIREF_HEX 3 45 | #define CONV_CHARSET_UNIDECOMPOSED 4 46 | #define CONV_CHARSET_WINCP1258 5 47 | #define CONV_CHARSET_UNI_CSTRING 6 48 | #define CONV_CHARSET_VNSTANDARD 7 49 | 50 | #define CONV_CHARSET_VIQR 10 51 | #define CONV_CHARSET_UTF8VIQR 11 52 | #define CONV_CHARSET_XUTF8 12 53 | 54 | #define CONV_CHARSET_TCVN3 20 55 | #define CONV_CHARSET_VPS 21 56 | #define CONV_CHARSET_VISCII 22 57 | #define CONV_CHARSET_BKHCM1 23 58 | #define CONV_CHARSET_VIETWAREF 24 59 | #define CONV_CHARSET_ISC 25 60 | 61 | #define CONV_CHARSET_VNIWIN 40 62 | #define CONV_CHARSET_BKHCM2 41 63 | #define CONV_CHARSET_VIETWAREX 42 64 | #define CONV_CHARSET_VNIMAC 43 65 | 66 | #define CONV_TOTAL_SINGLE_CHARSETS 6 67 | #define CONV_TOTAL_DOUBLE_CHARSETS 4 68 | 69 | 70 | #define IS_SINGLE_BYTE_CHARSET(x) (x >= CONV_CHARSET_TCVN3 && x < CONV_CHARSET_TCVN3+CONV_TOTAL_SINGLE_CHARSETS) 71 | #define IS_DOUBLE_BYTE_CHARSET(x) (x >= CONV_CHARSET_VNIWIN && x < CONV_CHARSET_VNIWIN+CONV_TOTAL_DOUBLE_CHARSETS) 72 | 73 | typedef unsigned char UKBYTE; 74 | 75 | #if defined(__cplusplus) 76 | extern "C" { 77 | #endif 78 | DllInterface int VnConvert(int inCharset, int outCharset, UKBYTE *input, UKBYTE *output, 79 | int * pInLen, int * pMaxOutLen); 80 | 81 | DllInterface int VnFileConvert(int inCharset, int outCharset, const char *inFile, const char *outFile); 82 | 83 | #if defined(__cplusplus) 84 | } 85 | #endif 86 | 87 | DllInterface const char * VnConvErrMsg(int errCode); 88 | 89 | enum VnConvError { 90 | VNCONV_NO_ERROR, 91 | VNCONV_UNKNOWN_ERROR, 92 | VNCONV_INVALID_CHARSET, 93 | VNCONV_ERR_INPUT_FILE, 94 | VNCONV_ERR_OUTPUT_FILE, 95 | VNCONV_OUT_OF_MEMORY, 96 | VNCONV_ERR_WRITING, 97 | VNCONV_LAST_ERROR 98 | }; 99 | 100 | typedef struct _CharsetNameId CharsetNameId; 101 | 102 | struct _CharsetNameId { 103 | const char *name; 104 | int id; 105 | }; 106 | 107 | typedef struct _VnConvOptions VnConvOptions; 108 | 109 | struct _VnConvOptions { 110 | int viqrMixed; 111 | int viqrEsc; 112 | int toUpper; 113 | int toLower; 114 | int removeTone; 115 | int smartViqr; 116 | }; 117 | 118 | DllInterface void VnConvSetOptions(VnConvOptions *pOptions); 119 | DllInterface void VnConvGetOptions(VnConvOptions *pOptions); 120 | DllInterface void VnConvResetOptions(VnConvOptions *pOptions); 121 | 122 | #endif 123 | -------------------------------------------------------------------------------- /unikey/vnlexi.h: -------------------------------------------------------------------------------- 1 | // -*- coding:unix; mode:c++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- 2 | /* Unikey Vietnamese Input Method 3 | * Copyright (C) 2000-2005 Pham Kim Long 4 | * Contact: 5 | * unikey@gmail.com 6 | * UniKey project: http://unikey.org 7 | * 8 | * This library is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License as published by the Free Software Foundation; either 11 | * version 2 of the License, or (at your option) any later version. 12 | * 13 | * This library is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | * Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public 19 | * License along with this library; if not, write to the 20 | * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | 24 | #ifndef __VN_LEXI_H 25 | #define __VN_LEXI_H 26 | 27 | enum VnLexiName { 28 | vnl_nonVnChar = -1, 29 | vnl_A, vnl_a, vnl_A1, vnl_a1, vnl_A2, vnl_a2, vnl_A3, vnl_a3, vnl_A4, vnl_a4, vnl_A5, vnl_a5, 30 | vnl_Ar, vnl_ar, vnl_Ar1, vnl_ar1, vnl_Ar2, vnl_ar2, vnl_Ar3, vnl_ar3, vnl_Ar4, vnl_ar4, vnl_Ar5, vnl_ar5, 31 | vnl_Ab, vnl_ab, vnl_Ab1, vnl_ab1, vnl_Ab2, vnl_ab2, vnl_Ab3, vnl_ab3, vnl_Ab4, vnl_ab4, vnl_Ab5, vnl_ab5, 32 | vnl_B, vnl_b, vnl_C, vnl_c, 33 | vnl_D, vnl_d, vnl_DD, vnl_dd, 34 | vnl_E, vnl_e, vnl_E1, vnl_e1, vnl_E2, vnl_e2, vnl_E3, vnl_e3, vnl_E4, vnl_e4, vnl_E5, vnl_e5, 35 | vnl_Er, vnl_er, vnl_Er1, vnl_er1, vnl_Er2, vnl_er2, vnl_Er3, vnl_er3, vnl_Er4, vnl_er4, vnl_Er5, vnl_er5, 36 | vnl_F, vnl_f, vnl_G, vnl_g, vnl_H, vnl_h, 37 | vnl_I, vnl_i, vnl_I1, vnl_i1, vnl_I2, vnl_i2, vnl_I3, vnl_i3, vnl_I4, vnl_i4, vnl_I5, vnl_i5, 38 | vnl_J, vnl_j, vnl_K, vnl_k, vnl_L, vnl_l, vnl_M, vnl_m, vnl_N, vnl_n, 39 | vnl_O, vnl_o, vnl_O1, vnl_o1, vnl_O2, vnl_o2, vnl_O3, vnl_o3, vnl_O4, vnl_o4, vnl_O5, vnl_o5, 40 | vnl_Or, vnl_or, vnl_Or1, vnl_or1, vnl_Or2, vnl_or2, vnl_Or3, vnl_or3, vnl_Or4, vnl_or4, vnl_Or5, vnl_or5, 41 | vnl_Oh, vnl_oh, vnl_Oh1, vnl_oh1, vnl_Oh2, vnl_oh2, vnl_Oh3, vnl_oh3, vnl_Oh4, vnl_oh4, vnl_Oh5, vnl_oh5, 42 | vnl_P, vnl_p, vnl_Q, vnl_q, vnl_R, vnl_r, vnl_S, vnl_s, vnl_T, vnl_t, 43 | vnl_U, vnl_u, vnl_U1, vnl_u1, vnl_U2, vnl_u2, vnl_U3, vnl_u3, vnl_U4, vnl_u4, vnl_U5, vnl_u5, 44 | vnl_Uh, vnl_uh, vnl_Uh1, vnl_uh1, vnl_Uh2, vnl_uh2, vnl_Uh3, vnl_uh3, vnl_Uh4, vnl_uh4, vnl_Uh5, vnl_uh5, 45 | vnl_V, vnl_v, vnl_W, vnl_w, vnl_X, vnl_x, 46 | vnl_Y, vnl_y, vnl_Y1, vnl_y1, vnl_Y2, vnl_y2, vnl_Y3, vnl_y3, vnl_Y4, vnl_y4, vnl_Y5, vnl_y5, 47 | vnl_Z, vnl_z, 48 | 49 | vnl_lastChar, 50 | }; 51 | 52 | enum VowelSeq { 53 | vs_nil = -1, 54 | vs_a, 55 | vs_ar, 56 | vs_ab, 57 | vs_e, 58 | vs_er, 59 | vs_i, 60 | vs_o, 61 | vs_or, 62 | vs_oh, 63 | vs_u, 64 | vs_uh, 65 | vs_y, 66 | vs_ai, 67 | vs_ao, 68 | vs_au, 69 | vs_ay, 70 | vs_aru, 71 | vs_ary, 72 | vs_eo, 73 | vs_eu, 74 | vs_eru, 75 | vs_ia, 76 | vs_ie, 77 | vs_ier, 78 | vs_iu, 79 | vs_oa, 80 | vs_oab, 81 | vs_oe, 82 | vs_oi, 83 | vs_ori, 84 | vs_ohi, 85 | vs_ua, 86 | vs_uar, 87 | vs_ue, 88 | vs_uer, 89 | vs_ui, 90 | vs_uo, 91 | vs_uor, 92 | vs_uoh, 93 | vs_uu, 94 | vs_uy, 95 | vs_uha, 96 | vs_uhi, 97 | vs_uho, 98 | vs_uhoh, 99 | vs_uhu, 100 | vs_ye, 101 | vs_yer, 102 | vs_ieu, 103 | vs_ieru, 104 | vs_oai, 105 | vs_oay, 106 | vs_oeo, 107 | vs_uay, 108 | vs_uary, 109 | vs_uoi, 110 | vs_uou, 111 | vs_uori, 112 | vs_uohi, 113 | vs_uohu, 114 | vs_uya, 115 | vs_uye, 116 | vs_uyer, 117 | vs_uyu, 118 | vs_uhoi, 119 | vs_uhou, 120 | vs_uhohi, 121 | vs_uhohu, 122 | vs_yeu, 123 | vs_yeru 124 | }; 125 | 126 | enum ConSeq { 127 | cs_nil = -1, 128 | cs_b, 129 | cs_c, 130 | cs_ch, 131 | cs_d, 132 | cs_dd, 133 | cs_dz, 134 | cs_g, 135 | cs_gh, 136 | cs_gi, 137 | cs_gin, 138 | cs_h, 139 | cs_k, 140 | cs_kh, 141 | cs_l, 142 | cs_m, 143 | cs_n, 144 | cs_ng, 145 | cs_ngh, 146 | cs_nh, 147 | cs_p, 148 | cs_ph, 149 | cs_q, 150 | cs_qu, 151 | cs_r, 152 | cs_s, 153 | cs_t, 154 | cs_th, 155 | cs_tr, 156 | cs_v, 157 | cs_x 158 | }; 159 | 160 | 161 | 162 | #endif 163 | -------------------------------------------------------------------------------- /po/fcitx-unikey.pot: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the PACKAGE package. 4 | # FIRST AUTHOR , YEAR. 5 | # 6 | #, fuzzy 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: PACKAGE VERSION\n" 10 | "Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n" 11 | "POT-Creation-Date: 2016-09-17 12:02-0700\n" 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 13 | "Last-Translator: FULL NAME \n" 14 | "Language-Team: LANGUAGE \n" 15 | "Language: LANG\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=utf-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | 20 | #: macro-editor/editor.cpp:41 21 | msgid "&Add" 22 | msgstr "" 23 | 24 | #: macro-editor/editor.cpp:42 25 | msgid "&Delete" 26 | msgstr "" 27 | 28 | #: macro-editor/editor.cpp:43 29 | msgid "De&lete All" 30 | msgstr "" 31 | 32 | #: macro-editor/editor.cpp:44 33 | msgid "&Import" 34 | msgstr "" 35 | 36 | #: macro-editor/editor.cpp:45 37 | msgid "&Export" 38 | msgstr "" 39 | 40 | #: macro-editor/editor.cpp:48 macro-editor/editor.cpp:76 41 | msgid "Unikey Macro Editor" 42 | msgstr "" 43 | 44 | #: macro-editor/model.cpp:44 src/unikey-ui.cpp:127 src/unikey-ui.cpp:187 45 | #: src/fcitx-unikey.conf.in:10 46 | msgid "Macro" 47 | msgstr "" 48 | 49 | #: macro-editor/model.cpp:46 50 | msgid "Word" 51 | msgstr "" 52 | 53 | #: src/unikey-im.cpp:116 src/fcitx-unikey.conf.in:3 src/unikey.conf.in:3 54 | #: src/fcitx-unikey.desc:1 src/fcitx-unikey.desc:14 src/fcitx-unikey.desc:28 55 | #: src/fcitx-unikey.desc:33 src/fcitx-unikey.desc:38 src/fcitx-unikey.desc:43 56 | #: src/fcitx-unikey.desc:48 src/fcitx-unikey.desc:53 57 | msgid "Unikey" 58 | msgstr "" 59 | 60 | #: src/unikey-ui.cpp:105 src/unikey-ui.cpp:172 61 | msgid "Choose input method" 62 | msgstr "" 63 | 64 | #: src/unikey-ui.cpp:113 src/unikey-ui.cpp:178 65 | msgid "Choose output charset" 66 | msgstr "" 67 | 68 | #: src/unikey-ui.cpp:119 src/unikey-ui.cpp:182 69 | msgid "Spell Check" 70 | msgstr "" 71 | 72 | #: src/unikey-ui.cpp:120 73 | msgid "Enable Spell Check" 74 | msgstr "" 75 | 76 | #: src/unikey-ui.cpp:128 77 | msgid "Enable Macro" 78 | msgstr "" 79 | 80 | #: src/unikey-ui.cpp:142 81 | msgid "Unikey Input Method" 82 | msgstr "" 83 | 84 | #: src/unikey-ui.cpp:156 src/fcitx-unikey.desc:17 85 | msgid "Output Charset" 86 | msgstr "" 87 | 88 | #: src/unikey-ui.cpp:182 89 | msgid "No Spell Check" 90 | msgstr "" 91 | 92 | #: src/unikey-ui.cpp:183 93 | msgid "Toggle Spell Check" 94 | msgstr "" 95 | 96 | #: src/unikey-ui.cpp:187 97 | msgid "No Macro" 98 | msgstr "" 99 | 100 | #: src/unikey-ui.cpp:188 101 | msgid "Toggle Macro" 102 | msgstr "" 103 | 104 | #: src/fcitx-unikey.conf.in:4 105 | msgid "Unikey Wrapper For Fcitx" 106 | msgstr "" 107 | 108 | #: src/fcitx-unikey.desc:4 109 | msgid "Input Method" 110 | msgstr "" 111 | 112 | #: src/fcitx-unikey.desc:6 113 | msgid "Telex" 114 | msgstr "" 115 | 116 | #: src/fcitx-unikey.desc:7 117 | msgid "VNI" 118 | msgstr "" 119 | 120 | #: src/fcitx-unikey.desc:8 src/fcitx-unikey.desc:22 121 | msgid "VIQR" 122 | msgstr "" 123 | 124 | #: src/fcitx-unikey.desc:9 125 | msgid "Microsoft Vietnamese" 126 | msgstr "" 127 | 128 | #: src/fcitx-unikey.desc:10 129 | msgid "UserIM" 130 | msgstr "" 131 | 132 | #: src/fcitx-unikey.desc:11 133 | msgid "Simple Telex" 134 | msgstr "" 135 | 136 | #: src/fcitx-unikey.desc:12 137 | msgid "Simple Telex2" 138 | msgstr "" 139 | 140 | #: src/fcitx-unikey.desc:19 141 | msgid "Unicode" 142 | msgstr "" 143 | 144 | #: src/fcitx-unikey.desc:20 145 | msgid "TCVN3" 146 | msgstr "" 147 | 148 | #: src/fcitx-unikey.desc:21 149 | msgid "VNI Win" 150 | msgstr "" 151 | 152 | #: src/fcitx-unikey.desc:23 153 | msgid "BK HCM 2" 154 | msgstr "" 155 | 156 | #: src/fcitx-unikey.desc:24 157 | msgid "CString" 158 | msgstr "" 159 | 160 | #: src/fcitx-unikey.desc:25 161 | msgid "NCR Decimal" 162 | msgstr "" 163 | 164 | #: src/fcitx-unikey.desc:26 165 | msgid "NCR Hex" 166 | msgstr "" 167 | 168 | #: src/fcitx-unikey.desc:31 169 | msgid "Enable spell check" 170 | msgstr "" 171 | 172 | #: src/fcitx-unikey.desc:36 173 | msgid "Enable macro" 174 | msgstr "" 175 | 176 | #: src/fcitx-unikey.desc:41 177 | msgid "Use oà, _uý (instead of òa, úy)" 178 | msgstr "" 179 | 180 | #: src/fcitx-unikey.desc:46 181 | msgid "Allow type with more freedom" 182 | msgstr "" 183 | 184 | #: src/fcitx-unikey.desc:51 185 | msgid "Auto restore keys with invalid words" 186 | msgstr "" 187 | 188 | #: src/fcitx-unikey.desc:56 189 | msgid "Process W at word begin" 190 | msgstr "" 191 | -------------------------------------------------------------------------------- /unikey/unikey.h: -------------------------------------------------------------------------------- 1 | // -*- coding:unix; mode:c++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- 2 | /*------------------------------------------------------------------------------ 3 | UniKey - Open-source Vietnamese Keyboard 4 | Copyright (C) 2000-2005 Pham Kim Long 5 | Contact: 6 | unikey@gmail.com 7 | http://unikey.org 8 | 9 | This program is free software; you can redistribute it and/or 10 | modify it under the terms of the GNU General Public License 11 | as published by the Free Software Foundation; either version 2 12 | of the License, or (at your option) any later version. 13 | 14 | This program is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with this program; if not, write to the Free Software 21 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 22 | --------------------------------------------------------------------------------*/ 23 | 24 | #ifndef __UNIKEY_H 25 | #define __UNIKEY_H 26 | 27 | #include "keycons.h" 28 | 29 | /*---------------------------------------------------- 30 | Initialization steps: 31 | 1. UnikeySetup: This will initialized Unikey module, 32 | with default options, input method = TELEX, output format = UTF-8 33 | 2. If you want a different settings: 34 | + Call UnikeySetInputMethod to change input method 35 | + Call UnikeySetOutputVIQR/UTF8 to chang output format 36 | + Call UnikeySetOptions to change extra options 37 | 38 | Key event handling: 39 | 40 | - Call UnikeyFilter when a key event occurs, examine results in 41 | + UnikeyBackspaces: number of backspaces that need to be sent 42 | + UnikeyBufChars: number of chars in buffer that need to be sent 43 | + UnikeyAnsiBuf: buffer containing output characters. 44 | + UnikeyUniBuf: not used 45 | 46 | You should also call UnikeySetCapsState() before calling UnikeyFilter. 47 | 48 | To make this module portable across platforms, UnikeyFilter should not 49 | be called on special keys: Enter, Tab, movement keys, delete, backspace... 50 | 51 | - Special events: 52 | + Call UnikeyResetBuf to reset the engine's state in situations such as: 53 | focus lost, movement keys: arrow keys, pgup, pgdown.... 54 | + If a backspace is received, call UnikeyBackspacePress, 55 | then examine the result: 56 | UnikeyBackspaces is the number of backspaces actually required to 57 | remove one character. 58 | 59 | Clean up: 60 | - When the Engine is no longer needed, call UnikeyCleanup 61 | ------------------------------------------------------*/ 62 | 63 | #if defined(__cplusplus) 64 | extern "C" { 65 | #endif 66 | extern unsigned char UnikeyBuf[]; 67 | extern int UnikeyBackspaces; 68 | extern int UnikeyBufChars; 69 | extern UkOutputType UnikeyOutput; 70 | 71 | void UnikeySetup(); // always call this first 72 | void UnikeyCleanup(); // call this when unloading unikey module 73 | 74 | // call this to reset Unikey's state when focus, context is changed or 75 | // some control key is pressed 76 | void UnikeyResetBuf(); 77 | 78 | // main handler, call every time a character input is received 79 | void UnikeyFilter(unsigned int ch); 80 | void UnikeyPutChar(unsigned int ch); // put new char without filtering 81 | 82 | // call this before UnikeyFilter for correctly processing some TELEX shortcuts 83 | void UnikeySetCapsState(int shiftPressed, int CapsLockOn); 84 | 85 | // call this when backspace is pressed 86 | void UnikeyBackspacePress(); 87 | 88 | // call this to restore to original key strokes 89 | void UnikeyRestoreKeyStrokes(); 90 | 91 | //set extra options 92 | void UnikeySetOptions(UnikeyOptions *pOpt); 93 | void CreateDefaultUnikeyOptions(UnikeyOptions *pOpt); 94 | 95 | void UnikeyGetOptions(UnikeyOptions *pOpt); 96 | 97 | // set input method 98 | // im: TELEX_INPUT, VNI_INPUT, VIQR_INPUT, VIQR_STAR_INPUT 99 | void UnikeySetInputMethod(UkInputMethod im); 100 | // set output format 101 | // void UnikeySetOutputVIQR(); 102 | // void UnikeySetOutputUTF8(); 103 | int UnikeySetOutputCharset(int charset); 104 | 105 | int UnikeyLoadMacroTable(const char *fileName); 106 | int UnikeyLoadUserKeyMap(const char *fileName); 107 | 108 | //call this to enable typing vietnamese even in a non-vn sequence 109 | //e.g: GD&DDT,QDDND... 110 | //The engine will return to normal mode when a word-break occurs. 111 | void UnikeySetSingleMode(); 112 | 113 | bool UnikeyAtWordBeginning(); 114 | #if defined(__cplusplus) 115 | } 116 | #endif 117 | 118 | #endif 119 | -------------------------------------------------------------------------------- /unikey/byteio.h: -------------------------------------------------------------------------------- 1 | // -*- coding:unix; mode:c++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- 2 | #ifndef BYTE_IO_STREAM_H 3 | #define BYTE_IO_STREAM_H 4 | 5 | 6 | //#include "vnconv.h" 7 | #include 8 | 9 | typedef unsigned char UKBYTE; 10 | typedef unsigned short UKWORD; 11 | typedef unsigned int UKDWORD; 12 | 13 | //---------------------------------------------------- 14 | class ByteStream { 15 | public: 16 | virtual ~ByteStream(){}; 17 | }; 18 | 19 | //---------------------------------------------------- 20 | class ByteInStream: public ByteStream 21 | { 22 | public: 23 | virtual int getNext(UKBYTE &b) = 0; 24 | virtual int peekNext(UKBYTE &b) = 0; 25 | virtual int unget(UKBYTE b) = 0; 26 | 27 | virtual int getNextW(UKWORD &w) = 0; 28 | virtual int peekNextW(UKWORD &w) = 0; 29 | 30 | virtual int getNextDW(UKDWORD &dw) = 0; 31 | 32 | virtual int bookmark() //no support for bookmark by default 33 | { 34 | return 0; 35 | } 36 | 37 | virtual int gotoBookmark() 38 | { 39 | return 0; 40 | } 41 | 42 | virtual int eos() = 0; //end of stream 43 | virtual int close() = 0; 44 | }; 45 | 46 | //---------------------------------------------------- 47 | class ByteOutStream: public ByteStream 48 | { 49 | public: 50 | virtual int putB(UKBYTE b) = 0; 51 | virtual int putW(UKWORD w) = 0; 52 | virtual int puts(const char *s, int size = -1) = 0; // write an 8-bit string 53 | virtual int isOK() = 0;// get current stream state 54 | }; 55 | 56 | //---------------------------------------------------- 57 | class StringBIStream : public ByteInStream 58 | { 59 | protected: 60 | int m_eos; 61 | UKBYTE *m_data, *m_current; 62 | int m_len, m_left; 63 | 64 | struct { 65 | int eos; 66 | UKBYTE *data, *current; 67 | int len, left; 68 | } m_bookmark; 69 | 70 | int m_didBookmark; 71 | 72 | public: 73 | StringBIStream(UKBYTE *data, int len, int elementSize = 1); 74 | virtual int getNext(UKBYTE &b); 75 | virtual int peekNext(UKBYTE &b); 76 | virtual int unget(UKBYTE b); 77 | 78 | virtual int getNextW(UKWORD &w); 79 | virtual int peekNextW(UKWORD &w); 80 | 81 | virtual int getNextDW(UKDWORD &dw); 82 | 83 | virtual int eos(); //end of stream 84 | virtual int close(); 85 | 86 | virtual int bookmark(); 87 | virtual int gotoBookmark(); 88 | 89 | void reopen(); 90 | int left() { 91 | return m_left; 92 | } 93 | }; 94 | 95 | //---------------------------------------------------- 96 | class FileBIStream : public ByteInStream 97 | { 98 | protected: 99 | FILE *m_file; 100 | int m_bufSize; 101 | char *m_buf; 102 | int m_own; 103 | int m_didBookmark; 104 | 105 | struct { 106 | long pos; 107 | } m_bookmark; 108 | 109 | //some systems don't have wide char IO functions 110 | //we have to use this variables to implement that 111 | UKBYTE m_readByte; 112 | int m_readAhead; 113 | int m_lastIsAhead; 114 | 115 | public: 116 | 117 | FileBIStream(int bufsize = 8192, char *buf = NULL); 118 | // FileBIStream(char *fileName, int bufsize = 8192, void *buf = NULL); 119 | 120 | int open(const char *fileName); 121 | void attach(FILE *f); 122 | virtual int close(); 123 | 124 | virtual int getNext(UKBYTE &b); 125 | virtual int peekNext(UKBYTE &b); 126 | virtual int unget(UKBYTE b); 127 | 128 | virtual int getNextW(UKWORD &w); 129 | virtual int peekNextW(UKWORD &w); 130 | 131 | virtual int getNextDW(UKDWORD &dw); 132 | 133 | virtual int eos(); //end of stream 134 | 135 | virtual int bookmark(); 136 | virtual int gotoBookmark(); 137 | 138 | virtual ~FileBIStream(); 139 | }; 140 | 141 | 142 | //---------------------------------------------------- 143 | class StringBOStream : public ByteOutStream 144 | { 145 | protected: 146 | UKBYTE *m_buf, *m_current; 147 | int m_out; 148 | int m_len; 149 | int m_bad; 150 | public: 151 | StringBOStream(UKBYTE *buf, int len); 152 | virtual int putB(UKBYTE b); 153 | virtual int putW(UKWORD w); 154 | virtual int puts(const char *s, int size = -1); 155 | virtual int isOK(); // get current stream state 156 | 157 | virtual int close() 158 | { 159 | return 1; 160 | }; 161 | 162 | void reopen(); 163 | int getOutBytes() { 164 | return m_out; 165 | } 166 | }; 167 | 168 | //---------------------------------------------------- 169 | class FileBOStream : public ByteOutStream 170 | { 171 | protected: 172 | FILE *m_file; 173 | int m_bufSize; 174 | char *m_buf; 175 | int m_own; 176 | int m_bad; 177 | 178 | public: 179 | FileBOStream(int bufsize = 8192, char *buf = NULL); 180 | // FileBOStream(char *fileName, int bufsize = 8192, void *buf = NULL); 181 | 182 | int open(const char *fileName); 183 | void attach(FILE *); 184 | virtual int close(); 185 | 186 | virtual int putB(UKBYTE b); 187 | virtual int putW(UKWORD w); 188 | virtual int puts(const char *s, int size = -1); 189 | virtual int isOK(); // get current stream state 190 | virtual ~FileBOStream(); 191 | }; 192 | 193 | 194 | #endif 195 | -------------------------------------------------------------------------------- /macro-editor/model.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2012~2012 by CSSlayer * 3 | * wengxt@gmail.com * 4 | * * 5 | * This program is free software: you can redistribute it and/or modify * 6 | * it under the terms of the GNU General Public License as published by * 7 | * the Free Software Foundation, either version 3 of the License, or * 8 | * (at your option) any later version. * 9 | * * 10 | * This program is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 13 | * GNU General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU General Public License * 16 | * along with this program. If not, see . * 17 | * * 18 | ***************************************************************************/ 19 | 20 | #include 21 | 22 | #include "model.h" 23 | #include "common.h" 24 | #include "editor.h" 25 | 26 | namespace fcitx_unikey { 27 | 28 | typedef QPair ItemType; 29 | 30 | MacroModel::MacroModel(QObject* parent): QAbstractTableModel(parent) 31 | ,m_needSave(false) 32 | { 33 | } 34 | 35 | MacroModel::~MacroModel() 36 | { 37 | 38 | } 39 | 40 | QVariant MacroModel::headerData(int section, Qt::Orientation orientation, int role) const 41 | { 42 | if (orientation == Qt::Horizontal && role == Qt::DisplayRole) { 43 | if (section == 0) 44 | return _("Macro"); 45 | else if (section == 1) 46 | return _("Word"); 47 | } 48 | return QVariant(); 49 | } 50 | 51 | int MacroModel::rowCount(const QModelIndex& parent) const 52 | { 53 | return m_list.count(); 54 | } 55 | 56 | int MacroModel::columnCount(const QModelIndex& parent) const 57 | { 58 | return 2; 59 | } 60 | 61 | QVariant MacroModel::data(const QModelIndex& index, int role) const 62 | { 63 | do { 64 | if (role == Qt::DisplayRole && index.row() < m_list.count()) { 65 | if (index.column() == 0) { 66 | return m_list[index.row()].first; 67 | } else if (index.column() == 1) { 68 | return m_list[index.row()].second; 69 | } 70 | } 71 | } while(0); 72 | return QVariant(); 73 | } 74 | 75 | void MacroModel::addItem(const QString& macro, const QString& word) 76 | { 77 | if (m_keyset.contains(macro)) 78 | return; 79 | beginInsertRows(QModelIndex(), m_list.size(), m_list.size()); 80 | m_list.append(QPair(macro, word)); 81 | m_keyset.insert(macro); 82 | endInsertRows(); 83 | setNeedSave(true); 84 | } 85 | 86 | void MacroModel::deleteItem(int row) 87 | { 88 | if (row >= m_list.count()) 89 | return; 90 | QPair item = m_list.at(row); 91 | QString key = item.first; 92 | beginRemoveRows(QModelIndex(), row, row); 93 | m_list.removeAt(row); 94 | m_keyset.remove(key); 95 | endRemoveRows(); 96 | setNeedSave(true); 97 | } 98 | 99 | void MacroModel::deleteAllItem() 100 | { 101 | if (m_list.count()) 102 | setNeedSave(true); 103 | beginResetModel(); 104 | m_list.clear(); 105 | m_keyset.clear(); 106 | endResetModel(); 107 | } 108 | 109 | void MacroModel::setNeedSave(bool needSave) 110 | { 111 | if (m_needSave != needSave) { 112 | m_needSave = needSave; 113 | emit needSaveChanged(m_needSave); 114 | } 115 | } 116 | 117 | bool MacroModel::needSave() 118 | { 119 | return m_needSave; 120 | } 121 | 122 | 123 | void MacroModel::load(CMacroTable* table) 124 | { 125 | beginResetModel(); 126 | m_list.clear(); 127 | m_keyset.clear(); 128 | for (int i = 0; i < table->getCount(); i++) { 129 | QString key = MacroEditor::getData(table, i, true); 130 | QString value = MacroEditor::getData(table, i, false); 131 | m_list.append(QPair(key, value)); 132 | m_keyset.insert(key); 133 | } 134 | endResetModel(); 135 | } 136 | 137 | void MacroModel::save(CMacroTable* m_table) 138 | { 139 | m_table->resetContent(); 140 | foreach(const ItemType& item, m_list) { 141 | m_table->addItem(item.first.toUtf8().data(), item.second.toUtf8().data(), CONV_CHARSET_XUTF8); 142 | } 143 | setNeedSave(false); 144 | } 145 | 146 | 147 | } -------------------------------------------------------------------------------- /po/zh_TW.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the PACKAGE package. 4 | # 5 | # Translators: 6 | # Alisha , 2012 7 | # BrLi , 2014 8 | # pan93412 , 2019 9 | # Lau YeeYu, 2023 10 | msgid "" 11 | msgstr "" 12 | "Project-Id-Version: fcitx\n" 13 | "Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n" 14 | "POT-Creation-Date: 2023-04-25 20:26+0000\n" 15 | "PO-Revision-Date: 2012-05-05 08:41+0000\n" 16 | "Last-Translator: Lau YeeYu, 2023\n" 17 | "Language-Team: Chinese (Taiwan) (http://app.transifex.com/fcitx/fcitx/" 18 | "language/zh_TW/)\n" 19 | "Language: zh_TW\n" 20 | "MIME-Version: 1.0\n" 21 | "Content-Type: text/plain; charset=UTF-8\n" 22 | "Content-Transfer-Encoding: 8bit\n" 23 | "Plural-Forms: nplurals=1; plural=0;\n" 24 | 25 | #: macro-editor/editor.cpp:41 26 | msgid "&Add" 27 | msgstr "新增(&A)" 28 | 29 | #: macro-editor/editor.cpp:42 30 | msgid "&Delete" 31 | msgstr "刪除(&D)" 32 | 33 | #: macro-editor/editor.cpp:45 34 | msgid "&Export" 35 | msgstr "匯出(&E)" 36 | 37 | #: macro-editor/editor.cpp:44 38 | msgid "&Import" 39 | msgstr "匯入(&I)" 40 | 41 | #: src/fcitx-unikey.desc:46 42 | msgid "Allow type with more freedom" 43 | msgstr "允許自由輸入" 44 | 45 | #: src/fcitx-unikey.desc:51 46 | msgid "Auto restore keys with invalid words" 47 | msgstr "自動回復無效的單字" 48 | 49 | #: src/fcitx-unikey.desc:23 50 | msgid "BK HCM 2" 51 | msgstr "BK HCM 2" 52 | 53 | #: src/fcitx-unikey.desc:24 54 | msgid "CString" 55 | msgstr "CString" 56 | 57 | #: src/unikey-ui.cpp:105 src/unikey-ui.cpp:172 58 | msgid "Choose input method" 59 | msgstr "選擇輸入法" 60 | 61 | #: src/unikey-ui.cpp:113 src/unikey-ui.cpp:178 62 | msgid "Choose output charset" 63 | msgstr "選擇輸出字元集" 64 | 65 | #: macro-editor/editor.cpp:43 66 | msgid "De&lete All" 67 | msgstr "全部刪除(&L)" 68 | 69 | #: src/unikey-ui.cpp:128 70 | msgid "Enable Macro" 71 | msgstr "啟用巨集" 72 | 73 | #: src/unikey-ui.cpp:120 74 | msgid "Enable Spell Check" 75 | msgstr "啟用拼字檢查" 76 | 77 | #: src/fcitx-unikey.desc:36 78 | msgid "Enable macro" 79 | msgstr "啟用巨集" 80 | 81 | #: src/fcitx-unikey.desc:31 82 | msgid "Enable spell check" 83 | msgstr "啟用拼字檢查" 84 | 85 | #: src/fcitx-unikey.desc:4 86 | msgid "Input Method" 87 | msgstr "輸入法" 88 | 89 | #: macro-editor/model.cpp:44 src/unikey-ui.cpp:127 src/unikey-ui.cpp:187 90 | #: src/fcitx-unikey.conf.in:10 91 | msgid "Macro" 92 | msgstr "巨集" 93 | 94 | #: src/fcitx-unikey.desc:9 95 | msgid "Microsoft Vietnamese" 96 | msgstr "微軟越南語" 97 | 98 | #: src/fcitx-unikey.desc:25 99 | msgid "NCR Decimal" 100 | msgstr "NCR Decimal" 101 | 102 | #: src/fcitx-unikey.desc:26 103 | msgid "NCR Hex" 104 | msgstr "NCR Hex" 105 | 106 | #: src/unikey-ui.cpp:187 107 | msgid "No Macro" 108 | msgstr "停用巨集" 109 | 110 | #: src/unikey-ui.cpp:182 111 | msgid "No Spell Check" 112 | msgstr "停用拼寫檢查" 113 | 114 | #: src/unikey-ui.cpp:156 src/fcitx-unikey.desc:17 115 | msgid "Output Charset" 116 | msgstr "輸出字元集" 117 | 118 | #: src/fcitx-unikey.desc:56 119 | msgid "Process W at word begin" 120 | msgstr "在字首加入 W" 121 | 122 | #: src/fcitx-unikey.desc:11 123 | msgid "Simple Telex" 124 | msgstr "簡易 Telex" 125 | 126 | #: src/fcitx-unikey.desc:12 127 | msgid "Simple Telex2" 128 | msgstr "簡易 Telex2" 129 | 130 | #: src/unikey-ui.cpp:119 src/unikey-ui.cpp:182 131 | msgid "Spell Check" 132 | msgstr "拼字檢查" 133 | 134 | #: src/fcitx-unikey.desc:20 135 | msgid "TCVN3" 136 | msgstr "TCVN3" 137 | 138 | #: src/fcitx-unikey.desc:6 139 | msgid "Telex" 140 | msgstr "Telex" 141 | 142 | #: src/unikey-ui.cpp:188 143 | msgid "Toggle Macro" 144 | msgstr "切換巨集" 145 | 146 | #: src/unikey-ui.cpp:183 147 | msgid "Toggle Spell Check" 148 | msgstr "切換拼字檢查" 149 | 150 | #: src/fcitx-unikey.desc:19 151 | msgid "Unicode" 152 | msgstr "萬國碼" 153 | 154 | #: src/unikey-im.cpp:158 src/fcitx-unikey.conf.in:3 src/unikey.conf.in:3 155 | #: src/fcitx-unikey.desc:1 src/fcitx-unikey.desc:14 src/fcitx-unikey.desc:28 156 | #: src/fcitx-unikey.desc:33 src/fcitx-unikey.desc:38 src/fcitx-unikey.desc:43 157 | #: src/fcitx-unikey.desc:48 src/fcitx-unikey.desc:53 158 | msgid "Unikey" 159 | msgstr "Unikey" 160 | 161 | #: src/unikey-ui.cpp:142 162 | msgid "Unikey Input Method" 163 | msgstr "Unikey 輸入法" 164 | 165 | #: macro-editor/editor.cpp:48 macro-editor/editor.cpp:76 166 | msgid "Unikey Macro Editor" 167 | msgstr "Unikey 巨集編輯器" 168 | 169 | #: src/fcitx-unikey.conf.in:4 170 | msgid "Unikey Wrapper For Fcitx" 171 | msgstr "Fcitx 的 Unikey 封裝" 172 | 173 | #: src/fcitx-unikey.desc:41 174 | msgid "Use oà, _uý (instead of òa, úy)" 175 | msgstr "使用 oà, _uý(替換òa, úy)" 176 | 177 | #: src/fcitx-unikey.desc:10 178 | msgid "UserIM" 179 | msgstr "使用者輸入法" 180 | 181 | #: src/fcitx-unikey.desc:8 src/fcitx-unikey.desc:22 182 | msgid "VIQR" 183 | msgstr "VIQR" 184 | 185 | #: src/fcitx-unikey.desc:7 186 | msgid "VNI" 187 | msgstr "VNI" 188 | 189 | #: src/fcitx-unikey.desc:21 190 | msgid "VNI Win" 191 | msgstr "VNI Win" 192 | 193 | #: macro-editor/model.cpp:46 194 | msgid "Word" 195 | msgstr "單字" 196 | -------------------------------------------------------------------------------- /po/zh_CN.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the PACKAGE package. 4 | # 5 | # Translators: 6 | # Christopher Meng , 2012 7 | # marguerite su , 2012,2014 8 | # csslayer , 2013-2014,2016 9 | # csslayer , 2012 10 | msgid "" 11 | msgstr "" 12 | "Project-Id-Version: fcitx\n" 13 | "Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n" 14 | "POT-Creation-Date: 2020-01-13 00:01-0800\n" 15 | "PO-Revision-Date: 2017-09-19 12:28+0000\n" 16 | "Last-Translator: csslayer \n" 17 | "Language-Team: Chinese (China) (http://www.transifex.com/fcitx/fcitx/" 18 | "language/zh_CN/)\n" 19 | "Language: zh_CN\n" 20 | "MIME-Version: 1.0\n" 21 | "Content-Type: text/plain; charset=UTF-8\n" 22 | "Content-Transfer-Encoding: 8bit\n" 23 | "Plural-Forms: nplurals=1; plural=0;\n" 24 | 25 | #: macro-editor/editor.cpp:41 26 | msgid "&Add" 27 | msgstr "添加(&A)" 28 | 29 | #: macro-editor/editor.cpp:42 30 | msgid "&Delete" 31 | msgstr "删除(&D)" 32 | 33 | #: macro-editor/editor.cpp:45 34 | msgid "&Export" 35 | msgstr "导出(&E)" 36 | 37 | #: macro-editor/editor.cpp:44 38 | msgid "&Import" 39 | msgstr "导入(&I)" 40 | 41 | #: src/fcitx-unikey.desc:46 42 | msgid "Allow type with more freedom" 43 | msgstr "允许更自由的输入" 44 | 45 | #: src/fcitx-unikey.desc:51 46 | msgid "Auto restore keys with invalid words" 47 | msgstr "自动恢复无效词的键" 48 | 49 | #: src/fcitx-unikey.desc:23 50 | msgid "BK HCM 2" 51 | msgstr "BK HCM 2" 52 | 53 | #: src/fcitx-unikey.desc:24 54 | msgid "CString" 55 | msgstr "CString" 56 | 57 | #: src/unikey-ui.cpp:105 src/unikey-ui.cpp:172 58 | msgid "Choose input method" 59 | msgstr "选择输入法" 60 | 61 | #: src/unikey-ui.cpp:113 src/unikey-ui.cpp:178 62 | msgid "Choose output charset" 63 | msgstr "选择输出字符集" 64 | 65 | #: macro-editor/editor.cpp:43 66 | msgid "De&lete All" 67 | msgstr "全部删除(&L)" 68 | 69 | #: src/unikey-ui.cpp:128 70 | msgid "Enable Macro" 71 | msgstr "开启宏" 72 | 73 | #: src/unikey-ui.cpp:120 74 | msgid "Enable Spell Check" 75 | msgstr "启用拼写检查" 76 | 77 | #: src/fcitx-unikey.desc:36 78 | msgid "Enable macro" 79 | msgstr "启用宏" 80 | 81 | #: src/fcitx-unikey.desc:31 82 | msgid "Enable spell check" 83 | msgstr "启用拼写检查" 84 | 85 | #: src/fcitx-unikey.desc:4 86 | msgid "Input Method" 87 | msgstr "输入法" 88 | 89 | #: macro-editor/model.cpp:44 src/unikey-ui.cpp:127 src/unikey-ui.cpp:187 90 | #: src/fcitx-unikey.conf.in:10 91 | msgid "Macro" 92 | msgstr "宏" 93 | 94 | #: src/fcitx-unikey.desc:9 95 | msgid "Microsoft Vietnamese" 96 | msgstr "微软越南语" 97 | 98 | #: src/fcitx-unikey.desc:25 99 | msgid "NCR Decimal" 100 | msgstr "十进制 NCR" 101 | 102 | #: src/fcitx-unikey.desc:26 103 | msgid "NCR Hex" 104 | msgstr "十六进制 NCR" 105 | 106 | #: src/unikey-ui.cpp:187 107 | msgid "No Macro" 108 | msgstr "禁用宏" 109 | 110 | #: src/unikey-ui.cpp:182 111 | msgid "No Spell Check" 112 | msgstr "禁用拼写检查" 113 | 114 | #: src/unikey-ui.cpp:156 src/fcitx-unikey.desc:17 115 | msgid "Output Charset" 116 | msgstr "输出字符集" 117 | 118 | #: src/fcitx-unikey.desc:56 119 | msgid "Process W at word begin" 120 | msgstr "在单词开头处理 W" 121 | 122 | #: src/fcitx-unikey.desc:11 123 | msgid "Simple Telex" 124 | msgstr "简化 Telex" 125 | 126 | #: src/fcitx-unikey.desc:12 127 | msgid "Simple Telex2" 128 | msgstr "简化 Telex2" 129 | 130 | #: src/unikey-ui.cpp:119 src/unikey-ui.cpp:182 131 | msgid "Spell Check" 132 | msgstr "拼写检查" 133 | 134 | #: src/fcitx-unikey.desc:20 135 | msgid "TCVN3" 136 | msgstr "TCVN3" 137 | 138 | #: src/fcitx-unikey.desc:6 139 | msgid "Telex" 140 | msgstr "Telex" 141 | 142 | #: src/unikey-ui.cpp:188 143 | msgid "Toggle Macro" 144 | msgstr "切换宏功能" 145 | 146 | #: src/unikey-ui.cpp:183 147 | msgid "Toggle Spell Check" 148 | msgstr "切换拼写检查" 149 | 150 | #: src/fcitx-unikey.desc:19 151 | msgid "Unicode" 152 | msgstr "Unicode" 153 | 154 | #: src/unikey-im.cpp:116 src/fcitx-unikey.conf.in:3 src/unikey.conf.in:3 155 | #: src/fcitx-unikey.desc:1 src/fcitx-unikey.desc:14 src/fcitx-unikey.desc:28 156 | #: src/fcitx-unikey.desc:33 src/fcitx-unikey.desc:38 src/fcitx-unikey.desc:43 157 | #: src/fcitx-unikey.desc:48 src/fcitx-unikey.desc:53 158 | msgid "Unikey" 159 | msgstr "Unikey" 160 | 161 | #: src/unikey-ui.cpp:142 162 | msgid "Unikey Input Method" 163 | msgstr "Unikey 输入法" 164 | 165 | #: macro-editor/editor.cpp:48 macro-editor/editor.cpp:76 166 | msgid "Unikey Macro Editor" 167 | msgstr "Unikey 宏编辑器" 168 | 169 | #: src/fcitx-unikey.conf.in:4 170 | msgid "Unikey Wrapper For Fcitx" 171 | msgstr "Fcitx 的 Unikey 封装" 172 | 173 | #: src/fcitx-unikey.desc:41 174 | msgid "Use oà, _uý (instead of òa, úy)" 175 | msgstr "使用 oà, _uý (替换 òa, úy)" 176 | 177 | #: src/fcitx-unikey.desc:10 178 | msgid "UserIM" 179 | msgstr "用户输入法" 180 | 181 | #: src/fcitx-unikey.desc:8 src/fcitx-unikey.desc:22 182 | msgid "VIQR" 183 | msgstr "VIQR" 184 | 185 | #: src/fcitx-unikey.desc:7 186 | msgid "VNI" 187 | msgstr "VNI" 188 | 189 | #: src/fcitx-unikey.desc:21 190 | msgid "VNI Win" 191 | msgstr "VNI Win" 192 | 193 | #: macro-editor/model.cpp:46 194 | msgid "Word" 195 | msgstr "单词" 196 | -------------------------------------------------------------------------------- /po/ko.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the PACKAGE package. 4 | # 5 | # Translators: 6 | # Bon Keun Seo , 2017 7 | # JungHee Lee , 2020 8 | # JungHee Lee , 2022 9 | # JungHee Lee , 2022 10 | # JungHee Lee , 2020 11 | msgid "" 12 | msgstr "" 13 | "Project-Id-Version: fcitx\n" 14 | "Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n" 15 | "POT-Creation-Date: 2022-11-20 06:36+0000\n" 16 | "PO-Revision-Date: 2012-05-05 08:41+0000\n" 17 | "Last-Translator: JungHee Lee , 2022\n" 18 | "Language-Team: Korean (http://www.transifex.com/fcitx/fcitx/language/ko/)\n" 19 | "Language: ko\n" 20 | "MIME-Version: 1.0\n" 21 | "Content-Type: text/plain; charset=UTF-8\n" 22 | "Content-Transfer-Encoding: 8bit\n" 23 | "Plural-Forms: nplurals=1; plural=0;\n" 24 | 25 | #: macro-editor/editor.cpp:41 26 | msgid "&Add" 27 | msgstr "추가(&A)" 28 | 29 | #: macro-editor/editor.cpp:42 30 | msgid "&Delete" 31 | msgstr "삭제(&D)" 32 | 33 | #: macro-editor/editor.cpp:45 34 | msgid "&Export" 35 | msgstr "내보내기(&E)" 36 | 37 | #: macro-editor/editor.cpp:44 38 | msgid "&Import" 39 | msgstr "가져오기(&I)" 40 | 41 | #: src/fcitx-unikey.desc:46 42 | msgid "Allow type with more freedom" 43 | msgstr "더 자유로운 입력 허용" 44 | 45 | #: src/fcitx-unikey.desc:51 46 | msgid "Auto restore keys with invalid words" 47 | msgstr "유효하지 않은 단어에 자동 복구 키 사용" 48 | 49 | #: src/fcitx-unikey.desc:23 50 | msgid "BK HCM 2" 51 | msgstr "BK HCM 2" 52 | 53 | #: src/fcitx-unikey.desc:24 54 | msgid "CString" 55 | msgstr "CString" 56 | 57 | #: src/unikey-ui.cpp:105 src/unikey-ui.cpp:172 58 | msgid "Choose input method" 59 | msgstr "입력기 선택" 60 | 61 | #: src/unikey-ui.cpp:113 src/unikey-ui.cpp:178 62 | msgid "Choose output charset" 63 | msgstr "출력 문자셋 선택" 64 | 65 | #: macro-editor/editor.cpp:43 66 | msgid "De&lete All" 67 | msgstr "모두 지우기(&L)" 68 | 69 | #: src/unikey-ui.cpp:128 70 | msgid "Enable Macro" 71 | msgstr "매크로 활성화" 72 | 73 | #: src/unikey-ui.cpp:120 74 | msgid "Enable Spell Check" 75 | msgstr "철자 검사 활성화" 76 | 77 | #: src/fcitx-unikey.desc:36 78 | msgid "Enable macro" 79 | msgstr "매크로 활성화" 80 | 81 | #: src/fcitx-unikey.desc:31 82 | msgid "Enable spell check" 83 | msgstr "철자 검사 활성화" 84 | 85 | #: src/fcitx-unikey.desc:4 86 | msgid "Input Method" 87 | msgstr "입력기" 88 | 89 | #: macro-editor/model.cpp:44 src/unikey-ui.cpp:127 src/unikey-ui.cpp:187 90 | #: src/fcitx-unikey.conf.in:10 91 | msgid "Macro" 92 | msgstr "매크로" 93 | 94 | #: src/fcitx-unikey.desc:9 95 | msgid "Microsoft Vietnamese" 96 | msgstr "Microsoft 베트남어" 97 | 98 | #: src/fcitx-unikey.desc:25 99 | msgid "NCR Decimal" 100 | msgstr "NCR 10진수" 101 | 102 | #: src/fcitx-unikey.desc:26 103 | msgid "NCR Hex" 104 | msgstr "NCR 16진수" 105 | 106 | #: src/unikey-ui.cpp:187 107 | msgid "No Macro" 108 | msgstr "매크로 사용 안함" 109 | 110 | #: src/unikey-ui.cpp:182 111 | msgid "No Spell Check" 112 | msgstr "철자 검사 안함" 113 | 114 | #: src/unikey-ui.cpp:156 src/fcitx-unikey.desc:17 115 | msgid "Output Charset" 116 | msgstr "출력 문자셋" 117 | 118 | #: src/fcitx-unikey.desc:56 119 | msgid "Process W at word begin" 120 | msgstr "단어 시작 시 W 처리" 121 | 122 | #: src/fcitx-unikey.desc:11 123 | msgid "Simple Telex" 124 | msgstr "Simple Telex" 125 | 126 | #: src/fcitx-unikey.desc:12 127 | msgid "Simple Telex2" 128 | msgstr "Simple Telex2" 129 | 130 | #: src/unikey-ui.cpp:119 src/unikey-ui.cpp:182 131 | msgid "Spell Check" 132 | msgstr "철자 검사" 133 | 134 | #: src/fcitx-unikey.desc:20 135 | msgid "TCVN3" 136 | msgstr "TCVN3" 137 | 138 | #: src/fcitx-unikey.desc:6 139 | msgid "Telex" 140 | msgstr "텔렉스" 141 | 142 | #: src/unikey-ui.cpp:188 143 | msgid "Toggle Macro" 144 | msgstr "매크로 전환" 145 | 146 | #: src/unikey-ui.cpp:183 147 | msgid "Toggle Spell Check" 148 | msgstr "철자 검사 전환" 149 | 150 | #: src/fcitx-unikey.desc:19 151 | msgid "Unicode" 152 | msgstr "유니코드" 153 | 154 | #: src/unikey-im.cpp:158 src/fcitx-unikey.conf.in:3 src/unikey.conf.in:3 155 | #: src/fcitx-unikey.desc:1 src/fcitx-unikey.desc:14 src/fcitx-unikey.desc:28 156 | #: src/fcitx-unikey.desc:33 src/fcitx-unikey.desc:38 src/fcitx-unikey.desc:43 157 | #: src/fcitx-unikey.desc:48 src/fcitx-unikey.desc:53 158 | msgid "Unikey" 159 | msgstr "유니키" 160 | 161 | #: src/unikey-ui.cpp:142 162 | msgid "Unikey Input Method" 163 | msgstr "유니키 입력기" 164 | 165 | #: macro-editor/editor.cpp:48 macro-editor/editor.cpp:76 166 | msgid "Unikey Macro Editor" 167 | msgstr "유니키 매크로 편집기" 168 | 169 | #: src/fcitx-unikey.conf.in:4 170 | msgid "Unikey Wrapper For Fcitx" 171 | msgstr "Fcitx용 Unikey 래퍼" 172 | 173 | #: src/fcitx-unikey.desc:41 174 | msgid "Use oà, _uý (instead of òa, úy)" 175 | msgstr "òa, úy 대신 oà, _uý 사용" 176 | 177 | #: src/fcitx-unikey.desc:10 178 | msgid "UserIM" 179 | msgstr "사용자IM" 180 | 181 | #: src/fcitx-unikey.desc:8 src/fcitx-unikey.desc:22 182 | msgid "VIQR" 183 | msgstr "VIQR" 184 | 185 | #: src/fcitx-unikey.desc:7 186 | msgid "VNI" 187 | msgstr "VNI" 188 | 189 | #: src/fcitx-unikey.desc:21 190 | msgid "VNI Win" 191 | msgstr "VNI Win" 192 | 193 | #: macro-editor/model.cpp:46 194 | msgid "Word" 195 | msgstr "단어" 196 | -------------------------------------------------------------------------------- /po/da.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the PACKAGE package. 4 | # 5 | # Translators: 6 | # scootergrisen, 2017 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: fcitx\n" 10 | "Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n" 11 | "POT-Creation-Date: 2016-09-17 12:02-0700\n" 12 | "PO-Revision-Date: 2017-09-11 21:23+0000\n" 13 | "Last-Translator: scootergrisen\n" 14 | "Language-Team: Danish (http://www.transifex.com/fcitx/fcitx/language/da/)\n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "Language: da\n" 19 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 20 | 21 | #: macro-editor/editor.cpp:41 22 | msgid "&Add" 23 | msgstr "&Tilføj" 24 | 25 | #: macro-editor/editor.cpp:42 26 | msgid "&Delete" 27 | msgstr "&Slet" 28 | 29 | #: macro-editor/editor.cpp:43 30 | msgid "De&lete All" 31 | msgstr "S&let alle" 32 | 33 | #: macro-editor/editor.cpp:44 34 | msgid "&Import" 35 | msgstr "&Importér" 36 | 37 | #: macro-editor/editor.cpp:45 38 | msgid "&Export" 39 | msgstr "&Eksportér" 40 | 41 | #: macro-editor/editor.cpp:48 macro-editor/editor.cpp:76 42 | msgid "Unikey Macro Editor" 43 | msgstr "Unikey-makroredigering" 44 | 45 | #: macro-editor/model.cpp:44 src/unikey-ui.cpp:127 src/unikey-ui.cpp:187 46 | #: src/fcitx-unikey.conf.in:10 47 | msgid "Macro" 48 | msgstr "Makro" 49 | 50 | #: macro-editor/model.cpp:46 51 | msgid "Word" 52 | msgstr "Ord" 53 | 54 | #: src/unikey-im.cpp:116 src/fcitx-unikey.conf.in:3 src/unikey.conf.in:3 55 | #: src/fcitx-unikey.desc:1 src/fcitx-unikey.desc:14 src/fcitx-unikey.desc:28 56 | #: src/fcitx-unikey.desc:33 src/fcitx-unikey.desc:38 src/fcitx-unikey.desc:43 57 | #: src/fcitx-unikey.desc:48 src/fcitx-unikey.desc:53 58 | msgid "Unikey" 59 | msgstr "Unikey" 60 | 61 | #: src/unikey-ui.cpp:105 src/unikey-ui.cpp:172 62 | msgid "Choose input method" 63 | msgstr "Vælg inputmetode" 64 | 65 | #: src/unikey-ui.cpp:113 src/unikey-ui.cpp:178 66 | msgid "Choose output charset" 67 | msgstr "Vælg outputtegnsæt" 68 | 69 | #: src/unikey-ui.cpp:119 src/unikey-ui.cpp:182 70 | msgid "Spell Check" 71 | msgstr "Stavekontrol" 72 | 73 | #: src/unikey-ui.cpp:120 74 | msgid "Enable Spell Check" 75 | msgstr "Aktivér stavekontrol" 76 | 77 | #: src/unikey-ui.cpp:128 78 | msgid "Enable Macro" 79 | msgstr "Aktivér makro" 80 | 81 | #: src/unikey-ui.cpp:142 82 | msgid "Unikey Input Method" 83 | msgstr "Unikey-inputmetode" 84 | 85 | #: src/unikey-ui.cpp:156 src/fcitx-unikey.desc:17 86 | msgid "Output Charset" 87 | msgstr "Outputtegnsæt" 88 | 89 | #: src/unikey-ui.cpp:182 90 | msgid "No Spell Check" 91 | msgstr "Ingen stavekontrol" 92 | 93 | #: src/unikey-ui.cpp:183 94 | msgid "Toggle Spell Check" 95 | msgstr "Stavekontrol til/fra" 96 | 97 | #: src/unikey-ui.cpp:187 98 | msgid "No Macro" 99 | msgstr "Ingen makro" 100 | 101 | #: src/unikey-ui.cpp:188 102 | msgid "Toggle Macro" 103 | msgstr "Makro til/fra" 104 | 105 | #: src/fcitx-unikey.conf.in:4 106 | msgid "Unikey Wrapper For Fcitx" 107 | msgstr "Unikey-wrapper for Fcitx" 108 | 109 | #: src/fcitx-unikey.desc:4 110 | msgid "Input Method" 111 | msgstr "Inputmetode" 112 | 113 | #: src/fcitx-unikey.desc:6 114 | msgid "Telex" 115 | msgstr "Telex" 116 | 117 | #: src/fcitx-unikey.desc:7 118 | msgid "VNI" 119 | msgstr "VNI" 120 | 121 | #: src/fcitx-unikey.desc:8 src/fcitx-unikey.desc:22 122 | msgid "VIQR" 123 | msgstr "VIQR" 124 | 125 | #: src/fcitx-unikey.desc:9 126 | msgid "Microsoft Vietnamese" 127 | msgstr "Microsoft vietnamesisk" 128 | 129 | #: src/fcitx-unikey.desc:10 130 | msgid "UserIM" 131 | msgstr "BrugerIM" 132 | 133 | #: src/fcitx-unikey.desc:11 134 | msgid "Simple Telex" 135 | msgstr "Simpel telex" 136 | 137 | #: src/fcitx-unikey.desc:12 138 | msgid "Simple Telex2" 139 | msgstr "Simpel telex2" 140 | 141 | #: src/fcitx-unikey.desc:19 142 | msgid "Unicode" 143 | msgstr "Unicode" 144 | 145 | #: src/fcitx-unikey.desc:20 146 | msgid "TCVN3" 147 | msgstr "TCVN3" 148 | 149 | #: src/fcitx-unikey.desc:21 150 | msgid "VNI Win" 151 | msgstr "VNI Win" 152 | 153 | #: src/fcitx-unikey.desc:23 154 | msgid "BK HCM 2" 155 | msgstr "BK HCM 2" 156 | 157 | #: src/fcitx-unikey.desc:24 158 | msgid "CString" 159 | msgstr "CStreng" 160 | 161 | #: src/fcitx-unikey.desc:25 162 | msgid "NCR Decimal" 163 | msgstr "NCR-decimal" 164 | 165 | #: src/fcitx-unikey.desc:26 166 | msgid "NCR Hex" 167 | msgstr "NCR-heksadecimal" 168 | 169 | #: src/fcitx-unikey.desc:31 170 | msgid "Enable spell check" 171 | msgstr "Aktivér stavekontrol" 172 | 173 | #: src/fcitx-unikey.desc:36 174 | msgid "Enable macro" 175 | msgstr "Aktivér makro" 176 | 177 | #: src/fcitx-unikey.desc:41 178 | msgid "Use oà, _uý (instead of òa, úy)" 179 | msgstr "Brug oà, _uý (i stedet for òa, úy)" 180 | 181 | #: src/fcitx-unikey.desc:46 182 | msgid "Allow type with more freedom" 183 | msgstr "Tillad type med mere frihed" 184 | 185 | #: src/fcitx-unikey.desc:51 186 | msgid "Auto restore keys with invalid words" 187 | msgstr "Gendan automatisk nøgler med ugyldige ord" 188 | 189 | #: src/fcitx-unikey.desc:56 190 | msgid "Process W at word begin" 191 | msgstr "Behandl W ved ords begyndelse" 192 | -------------------------------------------------------------------------------- /po/ja.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the PACKAGE package. 4 | # 5 | # Translators: 6 | # shirou - しろう , 2013 7 | # ABE Tsunehiko, 2017 8 | # ABE Tsunehiko, 2017 9 | # shirou - しろう , 2013 10 | # Takuro Onoue , 2020 11 | # UTUMI Hirosi , 2021 12 | # shirou - しろう , 2013 13 | msgid "" 14 | msgstr "" 15 | "Project-Id-Version: fcitx\n" 16 | "Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n" 17 | "POT-Creation-Date: 2021-11-20 15:09+0000\n" 18 | "PO-Revision-Date: 2021-11-20 07:44+0000\n" 19 | "Last-Translator: UTUMI Hirosi \n" 20 | "Language-Team: Japanese (http://www.transifex.com/fcitx/fcitx/language/ja/)\n" 21 | "Language: ja\n" 22 | "MIME-Version: 1.0\n" 23 | "Content-Type: text/plain; charset=UTF-8\n" 24 | "Content-Transfer-Encoding: 8bit\n" 25 | "Plural-Forms: nplurals=1; plural=0;\n" 26 | 27 | #: macro-editor/editor.cpp:41 28 | msgid "&Add" 29 | msgstr "追加 (&A)" 30 | 31 | #: macro-editor/editor.cpp:42 32 | msgid "&Delete" 33 | msgstr "削除 (&D)" 34 | 35 | #: macro-editor/editor.cpp:45 36 | msgid "&Export" 37 | msgstr "エクスポート (&E)" 38 | 39 | #: macro-editor/editor.cpp:44 40 | msgid "&Import" 41 | msgstr "インポート (&I)" 42 | 43 | #: src/fcitx-unikey.desc:46 44 | msgid "Allow type with more freedom" 45 | msgstr "より自由なタイプを許可する" 46 | 47 | #: src/fcitx-unikey.desc:51 48 | msgid "Auto restore keys with invalid words" 49 | msgstr "無効な単語を含むキーの自動復元" 50 | 51 | #: src/fcitx-unikey.desc:23 52 | msgid "BK HCM 2" 53 | msgstr "BK HCM 2" 54 | 55 | #: src/fcitx-unikey.desc:24 56 | msgid "CString" 57 | msgstr "CString" 58 | 59 | #: src/unikey-ui.cpp:105 src/unikey-ui.cpp:172 60 | msgid "Choose input method" 61 | msgstr "入力メソッドを選択" 62 | 63 | #: src/unikey-ui.cpp:113 src/unikey-ui.cpp:178 64 | msgid "Choose output charset" 65 | msgstr "出力文字セットを選択" 66 | 67 | #: macro-editor/editor.cpp:43 68 | msgid "De&lete All" 69 | msgstr "全削除 (&l)" 70 | 71 | #: src/unikey-ui.cpp:128 72 | msgid "Enable Macro" 73 | msgstr "マクロを有効に" 74 | 75 | #: src/unikey-ui.cpp:120 76 | msgid "Enable Spell Check" 77 | msgstr "スペルチェックを有効に" 78 | 79 | #: src/fcitx-unikey.desc:36 80 | msgid "Enable macro" 81 | msgstr "マクロを有効に" 82 | 83 | #: src/fcitx-unikey.desc:31 84 | msgid "Enable spell check" 85 | msgstr "スペルチェックを有効に" 86 | 87 | #: src/fcitx-unikey.desc:4 88 | msgid "Input Method" 89 | msgstr "入力メソッド" 90 | 91 | #: macro-editor/model.cpp:44 src/unikey-ui.cpp:127 src/unikey-ui.cpp:187 92 | #: src/fcitx-unikey.conf.in:10 93 | msgid "Macro" 94 | msgstr "マクロ" 95 | 96 | #: src/fcitx-unikey.desc:9 97 | msgid "Microsoft Vietnamese" 98 | msgstr "Microsoft ベトナム語" 99 | 100 | #: src/fcitx-unikey.desc:25 101 | msgid "NCR Decimal" 102 | msgstr "NCR Decimal" 103 | 104 | #: src/fcitx-unikey.desc:26 105 | msgid "NCR Hex" 106 | msgstr "NCR Hex" 107 | 108 | #: src/unikey-ui.cpp:187 109 | msgid "No Macro" 110 | msgstr "マクロなし" 111 | 112 | #: src/unikey-ui.cpp:182 113 | msgid "No Spell Check" 114 | msgstr "スペルチェックなし" 115 | 116 | #: src/unikey-ui.cpp:156 src/fcitx-unikey.desc:17 117 | msgid "Output Charset" 118 | msgstr "出力文字セット" 119 | 120 | #: src/fcitx-unikey.desc:56 121 | msgid "Process W at word begin" 122 | msgstr "単語の先頭で W を処理する" 123 | 124 | #: src/fcitx-unikey.desc:11 125 | msgid "Simple Telex" 126 | msgstr "シンプルTelex" 127 | 128 | #: src/fcitx-unikey.desc:12 129 | msgid "Simple Telex2" 130 | msgstr "シンプルTelex2" 131 | 132 | #: src/unikey-ui.cpp:119 src/unikey-ui.cpp:182 133 | msgid "Spell Check" 134 | msgstr "スペルチェク" 135 | 136 | #: src/fcitx-unikey.desc:20 137 | msgid "TCVN3" 138 | msgstr "TCVN3" 139 | 140 | #: src/fcitx-unikey.desc:6 141 | msgid "Telex" 142 | msgstr "Telex" 143 | 144 | #: src/unikey-ui.cpp:188 145 | msgid "Toggle Macro" 146 | msgstr "マクロの状態を切り替える" 147 | 148 | #: src/unikey-ui.cpp:183 149 | msgid "Toggle Spell Check" 150 | msgstr "スペルチェックの状態を切り替える" 151 | 152 | #: src/fcitx-unikey.desc:19 153 | msgid "Unicode" 154 | msgstr "Unicode" 155 | 156 | #: src/unikey-im.cpp:158 src/fcitx-unikey.conf.in:3 src/unikey.conf.in:3 157 | #: src/fcitx-unikey.desc:1 src/fcitx-unikey.desc:14 src/fcitx-unikey.desc:28 158 | #: src/fcitx-unikey.desc:33 src/fcitx-unikey.desc:38 src/fcitx-unikey.desc:43 159 | #: src/fcitx-unikey.desc:48 src/fcitx-unikey.desc:53 160 | msgid "Unikey" 161 | msgstr "Unikey" 162 | 163 | #: src/unikey-ui.cpp:142 164 | msgid "Unikey Input Method" 165 | msgstr "Unikey 入力メソッド" 166 | 167 | #: macro-editor/editor.cpp:48 macro-editor/editor.cpp:76 168 | msgid "Unikey Macro Editor" 169 | msgstr "Unikey マクロエディター" 170 | 171 | #: src/fcitx-unikey.conf.in:4 172 | msgid "Unikey Wrapper For Fcitx" 173 | msgstr "Fcitx 用 Unikey ラッパー" 174 | 175 | #: src/fcitx-unikey.desc:41 176 | msgid "Use oà, _uý (instead of òa, úy)" 177 | msgstr "oà, _uý を使う (òa, úyの代替)" 178 | 179 | #: src/fcitx-unikey.desc:10 180 | msgid "UserIM" 181 | msgstr "ユーザーIM" 182 | 183 | #: src/fcitx-unikey.desc:8 src/fcitx-unikey.desc:22 184 | msgid "VIQR" 185 | msgstr "VIQR" 186 | 187 | #: src/fcitx-unikey.desc:7 188 | msgid "VNI" 189 | msgstr "VNI" 190 | 191 | #: src/fcitx-unikey.desc:21 192 | msgid "VNI Win" 193 | msgstr "VNI Win" 194 | 195 | #: macro-editor/model.cpp:46 196 | msgid "Word" 197 | msgstr "単語" 198 | -------------------------------------------------------------------------------- /unikey/ukengine.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- 2 | /* Unikey Vietnamese Input Method 3 | * Copyright (C) 2000-2005 Pham Kim Long 4 | * Contact: 5 | * unikey@gmail.com 6 | * UniKey project: http://unikey.org 7 | * 8 | * This library is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License as published by the Free Software Foundation; either 11 | * version 2 of the License, or (at your option) any later version. 12 | * 13 | * This library is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | * Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public 19 | * License along with this library; if not, write to the 20 | * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | 24 | #ifndef __UKENGINE_H 25 | #define __UKENGINE_H 26 | 27 | #include "charset.h" 28 | #include "vnlexi.h" 29 | #include "inputproc.h" 30 | #include "mactab.h" 31 | 32 | //This is a shared object among processes, do not put any pointer in it 33 | struct UkSharedMem { 34 | //states 35 | int initialized; 36 | int vietKey; 37 | 38 | UnikeyOptions options; 39 | UkInputProcessor input; 40 | int usrKeyMapLoaded; 41 | int usrKeyMap[256]; 42 | int charsetId; 43 | 44 | CMacroTable macStore; 45 | }; 46 | 47 | #define MAX_UK_ENGINE 128 48 | 49 | enum VnWordForm {vnw_nonVn, vnw_empty, vnw_c, vnw_v, vnw_cv, vnw_vc, vnw_cvc}; 50 | 51 | typedef void (* CheckKeyboardCaseCb)(int *pShiftPressed, int *pCapslockOn); 52 | 53 | struct KeyBufEntry { 54 | UkKeyEvent ev; 55 | bool converted; 56 | }; 57 | 58 | class UkEngine 59 | { 60 | public: 61 | UkEngine(); 62 | void setCtrlInfo(UkSharedMem *p) 63 | { 64 | m_pCtrl = p; 65 | } 66 | 67 | void setCheckKbCaseFunc(CheckKeyboardCaseCb pFunc) 68 | { 69 | m_keyCheckFunc = pFunc; 70 | } 71 | 72 | bool atWordBeginning(); 73 | 74 | int process(unsigned int keyCode, int & backs, unsigned char *outBuf, int & outSize, UkOutputType & outType); 75 | void pass(int keyCode); //just pass through without filtering 76 | void setSingleMode(); 77 | 78 | int processBackspace(int & backs, unsigned char *outBuf, int & outSize, UkOutputType & outType); 79 | void reset(); 80 | int restoreKeyStrokes(int & backs, unsigned char *outBuf, int & outSize, UkOutputType & outType); 81 | 82 | //following methods must be public just to enable the use of pointers to them 83 | //they should not be called from outside. 84 | int processTone(UkKeyEvent & ev); 85 | int processRoof(UkKeyEvent & ev); 86 | int processHook(UkKeyEvent & ev); 87 | int processAppend(UkKeyEvent & ev); 88 | int appendVowel(UkKeyEvent & ev); 89 | int appendConsonnant(UkKeyEvent & ev); 90 | int processDd(UkKeyEvent & ev); 91 | int processMapChar(UkKeyEvent & ev); 92 | int processTelexW(UkKeyEvent & ev); 93 | int processEscChar(UkKeyEvent & ev); 94 | 95 | protected: 96 | static bool m_classInit; 97 | CheckKeyboardCaseCb m_keyCheckFunc; 98 | UkSharedMem *m_pCtrl; 99 | 100 | int m_changePos; 101 | int m_backs; 102 | int m_bufSize; 103 | int m_current; 104 | int m_singleMode; 105 | 106 | int m_keyBufSize; 107 | //unsigned int m_keyStrokes[MAX_UK_ENGINE]; 108 | KeyBufEntry m_keyStrokes[MAX_UK_ENGINE]; 109 | int m_keyCurrent; 110 | bool m_toEscape; 111 | 112 | //varables valid in one session 113 | unsigned char *m_pOutBuf; 114 | int *m_pOutSize; 115 | bool m_outputWritten; 116 | bool m_reverted; 117 | bool m_keyRestored; 118 | bool m_keyRestoring; 119 | UkOutputType m_outType; 120 | 121 | struct WordInfo { 122 | //info for word ending at this position 123 | VnWordForm form; 124 | int c1Offset, vOffset, c2Offset; 125 | 126 | union { 127 | VowelSeq vseq; 128 | ConSeq cseq; 129 | }; 130 | 131 | //info for current symbol 132 | int caps, tone; 133 | //canonical symbol, after caps, tone are removed 134 | //for non-Vn, vnSym == -1 135 | VnLexiName vnSym; 136 | int keyCode; 137 | }; 138 | 139 | WordInfo m_buffer[MAX_UK_ENGINE]; 140 | 141 | int processHookWithUO(UkKeyEvent & ev); 142 | int macroMatch(UkKeyEvent & ev); 143 | void markChange(int pos); 144 | void prepareBuffer(); //make sure we have a least 10 entries available 145 | int writeOutput(unsigned char *outBuf, int & outSize); 146 | //int getSeqLength(int first, int last); 147 | int getSeqSteps(int first, int last); 148 | int getTonePosition(VowelSeq vs, bool terminated); 149 | void resetKeyBuf(); 150 | int checkEscapeVIQR(UkKeyEvent & ev); 151 | int processNoSpellCheck(UkKeyEvent & ev); 152 | int processWordEnd(UkKeyEvent & ev); 153 | void synchKeyStrokeBuffer(); 154 | bool lastWordHasVnMark(); 155 | bool lastWordIsNonVn(); 156 | }; 157 | 158 | void SetupUnikeyEngine(); 159 | 160 | #endif 161 | -------------------------------------------------------------------------------- /po/tr.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the PACKAGE package. 4 | # 5 | # Translators: 6 | # Gökhan Kalayci , 2017 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: fcitx\n" 10 | "Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n" 11 | "POT-Creation-Date: 2016-09-17 12:02-0700\n" 12 | "PO-Revision-Date: 2017-04-20 20:33+0000\n" 13 | "Last-Translator: Gökhan Kalayci \n" 14 | "Language-Team: Turkish (http://www.transifex.com/fcitx/fcitx/language/tr/)\n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "Language: tr\n" 19 | "Plural-Forms: nplurals=2; plural=(n > 1);\n" 20 | 21 | #: macro-editor/editor.cpp:41 22 | msgid "&Add" 23 | msgstr "&Ekle" 24 | 25 | #: macro-editor/editor.cpp:42 26 | msgid "&Delete" 27 | msgstr "&Sil" 28 | 29 | #: macro-editor/editor.cpp:43 30 | msgid "De&lete All" 31 | msgstr "&Tümünü Sil" 32 | 33 | #: macro-editor/editor.cpp:44 34 | msgid "&Import" 35 | msgstr "&İçeri Aktar" 36 | 37 | #: macro-editor/editor.cpp:45 38 | msgid "&Export" 39 | msgstr "&Dışarı Aktar" 40 | 41 | #: macro-editor/editor.cpp:48 macro-editor/editor.cpp:76 42 | msgid "Unikey Macro Editor" 43 | msgstr "Unikey Makro Editör" 44 | 45 | #: macro-editor/model.cpp:44 src/unikey-ui.cpp:127 src/unikey-ui.cpp:187 46 | #: src/fcitx-unikey.conf.in:10 47 | msgid "Macro" 48 | msgstr "Makro" 49 | 50 | #: macro-editor/model.cpp:46 51 | msgid "Word" 52 | msgstr "Kelime" 53 | 54 | #: src/unikey-im.cpp:116 src/fcitx-unikey.conf.in:3 src/unikey.conf.in:3 55 | #: src/fcitx-unikey.desc:1 src/fcitx-unikey.desc:14 src/fcitx-unikey.desc:28 56 | #: src/fcitx-unikey.desc:33 src/fcitx-unikey.desc:38 src/fcitx-unikey.desc:43 57 | #: src/fcitx-unikey.desc:48 src/fcitx-unikey.desc:53 58 | msgid "Unikey" 59 | msgstr "Unikey" 60 | 61 | #: src/unikey-ui.cpp:105 src/unikey-ui.cpp:172 62 | msgid "Choose input method" 63 | msgstr "Giriş yöntemi seçin" 64 | 65 | #: src/unikey-ui.cpp:113 src/unikey-ui.cpp:178 66 | msgid "Choose output charset" 67 | msgstr "Çıktı karakter setini seçin" 68 | 69 | #: src/unikey-ui.cpp:119 src/unikey-ui.cpp:182 70 | msgid "Spell Check" 71 | msgstr "Yazım Denetimi" 72 | 73 | #: src/unikey-ui.cpp:120 74 | msgid "Enable Spell Check" 75 | msgstr "Yazım Denetimini Etkinleştir" 76 | 77 | #: src/unikey-ui.cpp:128 78 | msgid "Enable Macro" 79 | msgstr "Makroyu Etkinleştir" 80 | 81 | #: src/unikey-ui.cpp:142 82 | msgid "Unikey Input Method" 83 | msgstr "Unikey Giriş Yöntemi" 84 | 85 | #: src/unikey-ui.cpp:156 src/fcitx-unikey.desc:17 86 | msgid "Output Charset" 87 | msgstr "Çıktı Karakter Seti" 88 | 89 | #: src/unikey-ui.cpp:182 90 | msgid "No Spell Check" 91 | msgstr "Yazım Denetimi Yok" 92 | 93 | #: src/unikey-ui.cpp:183 94 | msgid "Toggle Spell Check" 95 | msgstr "Yazım Denetimi'ni Aç / Kapat" 96 | 97 | #: src/unikey-ui.cpp:187 98 | msgid "No Macro" 99 | msgstr "Makro Yok" 100 | 101 | #: src/unikey-ui.cpp:188 102 | msgid "Toggle Macro" 103 | msgstr "Makro Aç/Kapat" 104 | 105 | #: src/fcitx-unikey.conf.in:4 106 | msgid "Unikey Wrapper For Fcitx" 107 | msgstr "Fcitx için Unikey Wrapper" 108 | 109 | #: src/fcitx-unikey.desc:4 110 | msgid "Input Method" 111 | msgstr "Giriş Yöntemi" 112 | 113 | #: src/fcitx-unikey.desc:6 114 | msgid "Telex" 115 | msgstr "Teleks" 116 | 117 | #: src/fcitx-unikey.desc:7 118 | msgid "VNI" 119 | msgstr "VNI" 120 | 121 | #: src/fcitx-unikey.desc:8 src/fcitx-unikey.desc:22 122 | msgid "VIQR" 123 | msgstr "VIQR" 124 | 125 | #: src/fcitx-unikey.desc:9 126 | msgid "Microsoft Vietnamese" 127 | msgstr "Microsoft Vietnamca" 128 | 129 | #: src/fcitx-unikey.desc:10 130 | msgid "UserIM" 131 | msgstr "Kullanıcı IM" 132 | 133 | #: src/fcitx-unikey.desc:11 134 | msgid "Simple Telex" 135 | msgstr "Basik Teleks" 136 | 137 | #: src/fcitx-unikey.desc:12 138 | msgid "Simple Telex2" 139 | msgstr "Basit Teleks2" 140 | 141 | #: src/fcitx-unikey.desc:19 142 | msgid "Unicode" 143 | msgstr "Unicode" 144 | 145 | #: src/fcitx-unikey.desc:20 146 | msgid "TCVN3" 147 | msgstr "TCVN3" 148 | 149 | #: src/fcitx-unikey.desc:21 150 | msgid "VNI Win" 151 | msgstr "VNI Win" 152 | 153 | #: src/fcitx-unikey.desc:23 154 | msgid "BK HCM 2" 155 | msgstr "BK HCM 2" 156 | 157 | #: src/fcitx-unikey.desc:24 158 | msgid "CString" 159 | msgstr "CString" 160 | 161 | #: src/fcitx-unikey.desc:25 162 | msgid "NCR Decimal" 163 | msgstr "NCR Decimal" 164 | 165 | #: src/fcitx-unikey.desc:26 166 | msgid "NCR Hex" 167 | msgstr "NCR Hex" 168 | 169 | #: src/fcitx-unikey.desc:31 170 | msgid "Enable spell check" 171 | msgstr "Yazım denetimini etkinleştir" 172 | 173 | #: src/fcitx-unikey.desc:36 174 | msgid "Enable macro" 175 | msgstr "Makroyu etkinleştir" 176 | 177 | #: src/fcitx-unikey.desc:41 178 | msgid "Use oà, _uý (instead of òa, úy)" 179 | msgstr "Use oà, _uý (instead of òa, úy)" 180 | 181 | #: src/fcitx-unikey.desc:46 182 | msgid "Allow type with more freedom" 183 | msgstr "Daha fazla özgürlük ile türe izin ver" 184 | 185 | #: src/fcitx-unikey.desc:51 186 | msgid "Auto restore keys with invalid words" 187 | msgstr "Geçersiz kelimeleri olan anahtarları otomatik olarak geri yükle" 188 | 189 | #: src/fcitx-unikey.desc:56 190 | msgid "Process W at word begin" 191 | msgstr "Kelime başlangıcında W işleci" 192 | -------------------------------------------------------------------------------- /po/de.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the PACKAGE package. 4 | # 5 | # Translators: 6 | # mar well , 2013 7 | # mar well , 2014,2017 8 | msgid "" 9 | msgstr "" 10 | "Project-Id-Version: fcitx\n" 11 | "Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n" 12 | "POT-Creation-Date: 2017-07-28 06:03-0700\n" 13 | "PO-Revision-Date: 2017-07-28 12:26+0000\n" 14 | "Last-Translator: mar well \n" 15 | "Language-Team: German (http://www.transifex.com/fcitx/fcitx/language/de/)\n" 16 | "Language: de\n" 17 | "MIME-Version: 1.0\n" 18 | "Content-Type: text/plain; charset=UTF-8\n" 19 | "Content-Transfer-Encoding: 8bit\n" 20 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 21 | 22 | #: macro-editor/editor.cpp:41 23 | msgid "&Add" 24 | msgstr "&Hinzufügen" 25 | 26 | #: macro-editor/editor.cpp:42 27 | msgid "&Delete" 28 | msgstr "&Löschen" 29 | 30 | #: macro-editor/editor.cpp:45 31 | msgid "&Export" 32 | msgstr "&Export" 33 | 34 | #: macro-editor/editor.cpp:44 35 | msgid "&Import" 36 | msgstr "&Import" 37 | 38 | #: src/fcitx-unikey.desc:46 39 | msgid "Allow type with more freedom" 40 | msgstr "Mit mehr Freiheit tippen erlauben" 41 | 42 | #: src/fcitx-unikey.desc:51 43 | msgid "Auto restore keys with invalid words" 44 | msgstr "Automatisches Wiederherstellen der Tasten bei ungültigen Worten" 45 | 46 | #: src/fcitx-unikey.desc:23 47 | msgid "BK HCM 2" 48 | msgstr "BK HCM 2" 49 | 50 | #: src/fcitx-unikey.desc:24 51 | msgid "CString" 52 | msgstr "CString" 53 | 54 | #: src/unikey-ui.cpp:105 src/unikey-ui.cpp:172 55 | msgid "Choose input method" 56 | msgstr "Eingabemethode auswählen" 57 | 58 | #: src/unikey-ui.cpp:113 src/unikey-ui.cpp:178 59 | msgid "Choose output charset" 60 | msgstr "Zeichensatz Ausgabe wählen" 61 | 62 | #: macro-editor/editor.cpp:43 63 | msgid "De&lete All" 64 | msgstr "De&lete All" 65 | 66 | #: src/unikey-ui.cpp:128 67 | msgid "Enable Macro" 68 | msgstr "Makro aktivieren" 69 | 70 | #: src/unikey-ui.cpp:120 71 | msgid "Enable Spell Check" 72 | msgstr "Rechtschreibprüfung aktivieren" 73 | 74 | #: src/fcitx-unikey.desc:36 75 | msgid "Enable macro" 76 | msgstr "Makro einschalten" 77 | 78 | #: src/fcitx-unikey.desc:31 79 | msgid "Enable spell check" 80 | msgstr "Rechtschreibung einschalten" 81 | 82 | #: src/fcitx-unikey.desc:4 83 | msgid "Input Method" 84 | msgstr "Eingabemethode" 85 | 86 | #: macro-editor/model.cpp:44 src/unikey-ui.cpp:127 src/unikey-ui.cpp:187 87 | #: src/fcitx-unikey.conf.in:10 88 | msgid "Macro" 89 | msgstr "Makro" 90 | 91 | #: src/fcitx-unikey.desc:9 92 | msgid "Microsoft Vietnamese" 93 | msgstr "Microsoft Vietnamesisch" 94 | 95 | #: src/fcitx-unikey.desc:25 96 | msgid "NCR Decimal" 97 | msgstr "NCR Dezimal" 98 | 99 | #: src/fcitx-unikey.desc:26 100 | msgid "NCR Hex" 101 | msgstr "NCR Hex" 102 | 103 | #: src/unikey-ui.cpp:187 104 | msgid "No Macro" 105 | msgstr "Keine Makros" 106 | 107 | #: src/unikey-ui.cpp:182 108 | msgid "No Spell Check" 109 | msgstr "Keine Rechtschreibprüfung" 110 | 111 | #: src/unikey-ui.cpp:156 src/fcitx-unikey.desc:17 112 | msgid "Output Charset" 113 | msgstr "Zeichensatz Ausgabe" 114 | 115 | #: src/fcitx-unikey.desc:56 116 | msgid "Process W at word begin" 117 | msgstr "W ausführen am Wortanfang" 118 | 119 | #: src/fcitx-unikey.desc:11 120 | msgid "Simple Telex" 121 | msgstr "Einfaches Telex" 122 | 123 | #: src/fcitx-unikey.desc:12 124 | msgid "Simple Telex2" 125 | msgstr "Einfaches Telex2" 126 | 127 | #: src/unikey-ui.cpp:119 src/unikey-ui.cpp:182 128 | msgid "Spell Check" 129 | msgstr "Rechtschreibprüfung" 130 | 131 | #: src/fcitx-unikey.desc:20 132 | msgid "TCVN3" 133 | msgstr "TCVN3" 134 | 135 | #: src/fcitx-unikey.desc:6 136 | msgid "Telex" 137 | msgstr "Telex" 138 | 139 | #: src/unikey-ui.cpp:188 140 | msgid "Toggle Macro" 141 | msgstr "Makro überspringen" 142 | 143 | #: src/unikey-ui.cpp:183 144 | msgid "Toggle Spell Check" 145 | msgstr "Rechtschreibprüfung überspringen" 146 | 147 | #: src/fcitx-unikey.desc:19 148 | msgid "Unicode" 149 | msgstr "Unicode" 150 | 151 | #: src/unikey-im.cpp:116 src/fcitx-unikey.conf.in:3 src/unikey.conf.in:3 152 | #: src/fcitx-unikey.desc:1 src/fcitx-unikey.desc:14 src/fcitx-unikey.desc:28 153 | #: src/fcitx-unikey.desc:33 src/fcitx-unikey.desc:38 src/fcitx-unikey.desc:43 154 | #: src/fcitx-unikey.desc:48 src/fcitx-unikey.desc:53 155 | msgid "Unikey" 156 | msgstr "Unikey" 157 | 158 | #: src/unikey-ui.cpp:142 159 | msgid "Unikey Input Method" 160 | msgstr "Unikey Eingabemethode" 161 | 162 | #: macro-editor/editor.cpp:48 macro-editor/editor.cpp:76 163 | msgid "Unikey Macro Editor" 164 | msgstr "Unikey Macro Editor" 165 | 166 | #: src/fcitx-unikey.conf.in:4 167 | msgid "Unikey Wrapper For Fcitx" 168 | msgstr "Unikey Wrapper für Fcitx" 169 | 170 | #: src/fcitx-unikey.desc:41 171 | msgid "Use oà, _uý (instead of òa, úy)" 172 | msgstr "oà, _uý benutzen (statt òa, úy)" 173 | 174 | #: src/fcitx-unikey.desc:10 175 | msgid "UserIM" 176 | msgstr "Benutzer-Eingabemethode" 177 | 178 | #: src/fcitx-unikey.desc:8 src/fcitx-unikey.desc:22 179 | msgid "VIQR" 180 | msgstr "VIQR" 181 | 182 | #: src/fcitx-unikey.desc:7 183 | msgid "VNI" 184 | msgstr "VNI" 185 | 186 | #: src/fcitx-unikey.desc:21 187 | msgid "VNI Win" 188 | msgstr "VNI Win" 189 | 190 | #: macro-editor/model.cpp:46 191 | msgid "Word" 192 | msgstr "Wort" 193 | -------------------------------------------------------------------------------- /po/ca.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the PACKAGE package. 4 | # 5 | # Translators: 6 | # Robert Antoni Buj Gelonch , 2017-2018 7 | # Walter Garcia-Fontes , 2017 8 | msgid "" 9 | msgstr "" 10 | "Project-Id-Version: fcitx\n" 11 | "Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n" 12 | "POT-Creation-Date: 2019-11-03 12:28-0800\n" 13 | "PO-Revision-Date: 2018-06-13 07:04+0000\n" 14 | "Last-Translator: Robert Antoni Buj Gelonch \n" 15 | "Language-Team: Catalan (http://www.transifex.com/fcitx/fcitx/language/ca/)\n" 16 | "Language: ca\n" 17 | "MIME-Version: 1.0\n" 18 | "Content-Type: text/plain; charset=UTF-8\n" 19 | "Content-Transfer-Encoding: 8bit\n" 20 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 21 | 22 | #: macro-editor/editor.cpp:41 23 | msgid "&Add" 24 | msgstr "&Afegeix" 25 | 26 | #: macro-editor/editor.cpp:42 27 | msgid "&Delete" 28 | msgstr "Eli&mina" 29 | 30 | #: macro-editor/editor.cpp:45 31 | msgid "&Export" 32 | msgstr "&Exporta" 33 | 34 | #: macro-editor/editor.cpp:44 35 | msgid "&Import" 36 | msgstr "&Importa" 37 | 38 | #: src/fcitx-unikey.desc:46 39 | msgid "Allow type with more freedom" 40 | msgstr "Permet escriure amb més llibertat" 41 | 42 | #: src/fcitx-unikey.desc:51 43 | msgid "Auto restore keys with invalid words" 44 | msgstr "Restaura automàticament les tecles amb paraules no vàlides" 45 | 46 | #: src/fcitx-unikey.desc:23 47 | msgid "BK HCM 2" 48 | msgstr "BK HCM 2" 49 | 50 | #: src/fcitx-unikey.desc:24 51 | msgid "CString" 52 | msgstr "CString" 53 | 54 | #: src/unikey-ui.cpp:105 src/unikey-ui.cpp:172 55 | msgid "Choose input method" 56 | msgstr "Escolliu el mètode d'entrada" 57 | 58 | #: src/unikey-ui.cpp:113 src/unikey-ui.cpp:178 59 | msgid "Choose output charset" 60 | msgstr "Escolliu el conjunt de caràcters de sortida" 61 | 62 | #: macro-editor/editor.cpp:43 63 | msgid "De&lete All" 64 | msgstr "E&linina tot" 65 | 66 | #: src/unikey-ui.cpp:128 67 | msgid "Enable Macro" 68 | msgstr "Habilita la macro" 69 | 70 | #: src/unikey-ui.cpp:120 71 | msgid "Enable Spell Check" 72 | msgstr "Habilita el corrector ortogràfic" 73 | 74 | #: src/fcitx-unikey.desc:36 75 | msgid "Enable macro" 76 | msgstr "Habilita la macro" 77 | 78 | #: src/fcitx-unikey.desc:31 79 | msgid "Enable spell check" 80 | msgstr "Habilita el corrector ortogràfic" 81 | 82 | #: src/fcitx-unikey.desc:4 83 | msgid "Input Method" 84 | msgstr "Mètode d'entrada" 85 | 86 | #: macro-editor/model.cpp:44 src/unikey-ui.cpp:127 src/unikey-ui.cpp:187 87 | #: src/fcitx-unikey.conf.in:10 88 | msgid "Macro" 89 | msgstr "Macro" 90 | 91 | #: src/fcitx-unikey.desc:9 92 | msgid "Microsoft Vietnamese" 93 | msgstr "Vietnamita Microsoft" 94 | 95 | #: src/fcitx-unikey.desc:25 96 | msgid "NCR Decimal" 97 | msgstr "NCR Decimal" 98 | 99 | #: src/fcitx-unikey.desc:26 100 | msgid "NCR Hex" 101 | msgstr "NCR Hex" 102 | 103 | #: src/unikey-ui.cpp:187 104 | msgid "No Macro" 105 | msgstr "Cap macro" 106 | 107 | #: src/unikey-ui.cpp:182 108 | msgid "No Spell Check" 109 | msgstr "Cap corrector ortogràfic" 110 | 111 | #: src/unikey-ui.cpp:156 src/fcitx-unikey.desc:17 112 | msgid "Output Charset" 113 | msgstr "Conjunt de caràcters de sortida" 114 | 115 | #: src/fcitx-unikey.desc:56 116 | msgid "Process W at word begin" 117 | msgstr "Processa W a l'inici de paraula" 118 | 119 | #: src/fcitx-unikey.desc:11 120 | msgid "Simple Telex" 121 | msgstr "Telex simple" 122 | 123 | #: src/fcitx-unikey.desc:12 124 | msgid "Simple Telex2" 125 | msgstr "Telex2 simple" 126 | 127 | #: src/unikey-ui.cpp:119 src/unikey-ui.cpp:182 128 | msgid "Spell Check" 129 | msgstr "Corrector ortogràfic" 130 | 131 | #: src/fcitx-unikey.desc:20 132 | msgid "TCVN3" 133 | msgstr "TCVN3" 134 | 135 | #: src/fcitx-unikey.desc:6 136 | msgid "Telex" 137 | msgstr "Telex" 138 | 139 | #: src/unikey-ui.cpp:188 140 | msgid "Toggle Macro" 141 | msgstr "Commuta la macro" 142 | 143 | #: src/unikey-ui.cpp:183 144 | msgid "Toggle Spell Check" 145 | msgstr "Commuta el corrector ortogràfic" 146 | 147 | #: src/fcitx-unikey.desc:19 148 | msgid "Unicode" 149 | msgstr "Unicode" 150 | 151 | #: src/unikey-im.cpp:116 src/fcitx-unikey.conf.in:3 src/unikey.conf.in:3 152 | #: src/fcitx-unikey.desc:1 src/fcitx-unikey.desc:14 src/fcitx-unikey.desc:28 153 | #: src/fcitx-unikey.desc:33 src/fcitx-unikey.desc:38 src/fcitx-unikey.desc:43 154 | #: src/fcitx-unikey.desc:48 src/fcitx-unikey.desc:53 155 | msgid "Unikey" 156 | msgstr "Unikey" 157 | 158 | #: src/unikey-ui.cpp:142 159 | msgid "Unikey Input Method" 160 | msgstr "Mètode d'entrada unikey" 161 | 162 | #: macro-editor/editor.cpp:48 macro-editor/editor.cpp:76 163 | msgid "Unikey Macro Editor" 164 | msgstr "Editor de macros unikey" 165 | 166 | #: src/fcitx-unikey.conf.in:4 167 | msgid "Unikey Wrapper For Fcitx" 168 | msgstr "Contenidor unikey per a fcitx" 169 | 170 | #: src/fcitx-unikey.desc:41 171 | msgid "Use oà, _uý (instead of òa, úy)" 172 | msgstr "Utilitza oà, _uý (en comptes de òa, úy)" 173 | 174 | #: src/fcitx-unikey.desc:10 175 | msgid "UserIM" 176 | msgstr "Mètode d'entrada de l'usuari" 177 | 178 | #: src/fcitx-unikey.desc:8 src/fcitx-unikey.desc:22 179 | msgid "VIQR" 180 | msgstr "VIQR" 181 | 182 | #: src/fcitx-unikey.desc:7 183 | msgid "VNI" 184 | msgstr "VNI" 185 | 186 | #: src/fcitx-unikey.desc:21 187 | msgid "VNI Win" 188 | msgstr "VNI Win" 189 | 190 | #: macro-editor/model.cpp:46 191 | msgid "Word" 192 | msgstr "Paraula" 193 | -------------------------------------------------------------------------------- /po/ru.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the PACKAGE package. 4 | # 5 | # Translators: 6 | # Dmitry , 2023 7 | # TotalCaesar659 , 2016 8 | # TotalCaesar659 , 2016 9 | msgid "" 10 | msgstr "" 11 | "Project-Id-Version: fcitx\n" 12 | "Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n" 13 | "POT-Creation-Date: 2023-03-23 20:26+0000\n" 14 | "PO-Revision-Date: 2012-05-05 08:41+0000\n" 15 | "Last-Translator: Dmitry , 2023\n" 16 | "Language-Team: Russian (http://www.transifex.com/fcitx/fcitx/language/ru/)\n" 17 | "Language: ru\n" 18 | "MIME-Version: 1.0\n" 19 | "Content-Type: text/plain; charset=UTF-8\n" 20 | "Content-Transfer-Encoding: 8bit\n" 21 | "Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && " 22 | "n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || " 23 | "(n%100>=11 && n%100<=14)? 2 : 3);\n" 24 | 25 | #: macro-editor/editor.cpp:41 26 | msgid "&Add" 27 | msgstr "&Добавить" 28 | 29 | #: macro-editor/editor.cpp:42 30 | msgid "&Delete" 31 | msgstr "&Удалить" 32 | 33 | #: macro-editor/editor.cpp:45 34 | msgid "&Export" 35 | msgstr "&Экспорт" 36 | 37 | #: macro-editor/editor.cpp:44 38 | msgid "&Import" 39 | msgstr "&Импорт" 40 | 41 | #: src/fcitx-unikey.desc:46 42 | msgid "Allow type with more freedom" 43 | msgstr "Разрешать тип с большей свободой" 44 | 45 | #: src/fcitx-unikey.desc:51 46 | msgid "Auto restore keys with invalid words" 47 | msgstr "Автоматически восстанавливать клавиши при некорректных словах" 48 | 49 | #: src/fcitx-unikey.desc:23 50 | msgid "BK HCM 2" 51 | msgstr "BK HCM 2" 52 | 53 | #: src/fcitx-unikey.desc:24 54 | msgid "CString" 55 | msgstr "CString" 56 | 57 | #: src/unikey-ui.cpp:105 src/unikey-ui.cpp:172 58 | msgid "Choose input method" 59 | msgstr "Выбрать метод ввода" 60 | 61 | #: src/unikey-ui.cpp:113 src/unikey-ui.cpp:178 62 | msgid "Choose output charset" 63 | msgstr "Выбрать кодировку на выходе" 64 | 65 | #: macro-editor/editor.cpp:43 66 | msgid "De&lete All" 67 | msgstr "Уд&алить все" 68 | 69 | #: src/unikey-ui.cpp:128 70 | msgid "Enable Macro" 71 | msgstr "Включить макросы" 72 | 73 | #: src/unikey-ui.cpp:120 74 | msgid "Enable Spell Check" 75 | msgstr "Включить проверку правописания" 76 | 77 | #: src/fcitx-unikey.desc:36 78 | msgid "Enable macro" 79 | msgstr "Включить макросы" 80 | 81 | #: src/fcitx-unikey.desc:31 82 | msgid "Enable spell check" 83 | msgstr "Включить проверку правописания" 84 | 85 | #: src/fcitx-unikey.desc:4 86 | msgid "Input Method" 87 | msgstr "Метод ввода" 88 | 89 | #: macro-editor/model.cpp:44 src/unikey-ui.cpp:127 src/unikey-ui.cpp:187 90 | #: src/fcitx-unikey.conf.in:10 91 | msgid "Macro" 92 | msgstr "Макрос" 93 | 94 | #: src/fcitx-unikey.desc:9 95 | msgid "Microsoft Vietnamese" 96 | msgstr "Вьетнамский Microsoft" 97 | 98 | #: src/fcitx-unikey.desc:25 99 | msgid "NCR Decimal" 100 | msgstr "Десятичный NCR" 101 | 102 | #: src/fcitx-unikey.desc:26 103 | msgid "NCR Hex" 104 | msgstr "Шестнадцатиричный NCR" 105 | 106 | #: src/unikey-ui.cpp:187 107 | msgid "No Macro" 108 | msgstr "Нет макросов" 109 | 110 | #: src/unikey-ui.cpp:182 111 | msgid "No Spell Check" 112 | msgstr "Нет проверки правописания" 113 | 114 | #: src/unikey-ui.cpp:156 src/fcitx-unikey.desc:17 115 | msgid "Output Charset" 116 | msgstr "Кодировка на выходе" 117 | 118 | #: src/fcitx-unikey.desc:56 119 | msgid "Process W at word begin" 120 | msgstr "Наберите W в начале слова" 121 | 122 | #: src/fcitx-unikey.desc:11 123 | msgid "Simple Telex" 124 | msgstr "Простой Telex" 125 | 126 | #: src/fcitx-unikey.desc:12 127 | msgid "Simple Telex2" 128 | msgstr "Простой Telex2" 129 | 130 | #: src/unikey-ui.cpp:119 src/unikey-ui.cpp:182 131 | msgid "Spell Check" 132 | msgstr "Проверка правописания" 133 | 134 | #: src/fcitx-unikey.desc:20 135 | msgid "TCVN3" 136 | msgstr "TCVN3" 137 | 138 | #: src/fcitx-unikey.desc:6 139 | msgid "Telex" 140 | msgstr "Telex" 141 | 142 | #: src/unikey-ui.cpp:188 143 | msgid "Toggle Macro" 144 | msgstr "Переключить макросы" 145 | 146 | #: src/unikey-ui.cpp:183 147 | msgid "Toggle Spell Check" 148 | msgstr "Пререключить проверку правописания" 149 | 150 | #: src/fcitx-unikey.desc:19 151 | msgid "Unicode" 152 | msgstr "Юникод" 153 | 154 | #: src/unikey-im.cpp:158 src/fcitx-unikey.conf.in:3 src/unikey.conf.in:3 155 | #: src/fcitx-unikey.desc:1 src/fcitx-unikey.desc:14 src/fcitx-unikey.desc:28 156 | #: src/fcitx-unikey.desc:33 src/fcitx-unikey.desc:38 src/fcitx-unikey.desc:43 157 | #: src/fcitx-unikey.desc:48 src/fcitx-unikey.desc:53 158 | msgid "Unikey" 159 | msgstr "Unikey" 160 | 161 | #: src/unikey-ui.cpp:142 162 | msgid "Unikey Input Method" 163 | msgstr "Метод ввода Unikey" 164 | 165 | #: macro-editor/editor.cpp:48 macro-editor/editor.cpp:76 166 | msgid "Unikey Macro Editor" 167 | msgstr "Редактор макросов Unikey" 168 | 169 | #: src/fcitx-unikey.conf.in:4 170 | msgid "Unikey Wrapper For Fcitx" 171 | msgstr "Обертка Wrapper для Fcitx" 172 | 173 | #: src/fcitx-unikey.desc:41 174 | msgid "Use oà, _uý (instead of òa, úy)" 175 | msgstr "Использовать oà, _uý (вместо òa, úy)" 176 | 177 | #: src/fcitx-unikey.desc:10 178 | msgid "UserIM" 179 | msgstr "UserIM" 180 | 181 | #: src/fcitx-unikey.desc:8 src/fcitx-unikey.desc:22 182 | msgid "VIQR" 183 | msgstr "VIQR" 184 | 185 | #: src/fcitx-unikey.desc:7 186 | msgid "VNI" 187 | msgstr "VNI" 188 | 189 | #: src/fcitx-unikey.desc:21 190 | msgid "VNI Win" 191 | msgstr "VNI Win" 192 | 193 | #: macro-editor/model.cpp:46 194 | msgid "Word" 195 | msgstr "Слово" 196 | -------------------------------------------------------------------------------- /po/vi.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the PACKAGE package. 4 | # 5 | # Translators: 6 | # ddk.jk , 2013 7 | # Trong Dzang , 2013 8 | # csslayer , 2016 9 | # ddk.jk , 2013 10 | # ddk.jk , 2013 11 | # ddk.jk , 2013 12 | # dinhdangkhoi , 2014 13 | # dinhdangkhoi , 2014 14 | # Lê Quốc Tuấn , 2009 15 | # Trong Dzang , 2013 16 | # csslayer , 2016 17 | # csslayer , 2012-2013 18 | # Zen Fas, 2022 19 | msgid "" 20 | msgstr "" 21 | "Project-Id-Version: fcitx\n" 22 | "Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n" 23 | "POT-Creation-Date: 2022-11-20 06:36+0000\n" 24 | "PO-Revision-Date: 2012-05-05 08:41+0000\n" 25 | "Last-Translator: Zen Fas, 2022\n" 26 | "Language-Team: Vietnamese (http://www.transifex.com/fcitx/fcitx/language/" 27 | "vi/)\n" 28 | "Language: vi\n" 29 | "MIME-Version: 1.0\n" 30 | "Content-Type: text/plain; charset=UTF-8\n" 31 | "Content-Transfer-Encoding: 8bit\n" 32 | "Plural-Forms: nplurals=1; plural=0;\n" 33 | 34 | #: macro-editor/editor.cpp:41 35 | msgid "&Add" 36 | msgstr "&Thêm" 37 | 38 | #: macro-editor/editor.cpp:42 39 | msgid "&Delete" 40 | msgstr "&Xóa" 41 | 42 | #: macro-editor/editor.cpp:45 43 | msgid "&Export" 44 | msgstr "&Xuất" 45 | 46 | #: macro-editor/editor.cpp:44 47 | msgid "&Import" 48 | msgstr "&Nhập" 49 | 50 | #: src/fcitx-unikey.desc:46 51 | msgid "Allow type with more freedom" 52 | msgstr "Cho phép gõ tự do" 53 | 54 | #: src/fcitx-unikey.desc:51 55 | msgid "Auto restore keys with invalid words" 56 | msgstr "Tự động khôi phục phím với từ không hợp lệ" 57 | 58 | #: src/fcitx-unikey.desc:23 59 | msgid "BK HCM 2" 60 | msgstr "BK HCM 2" 61 | 62 | #: src/fcitx-unikey.desc:24 63 | msgid "CString" 64 | msgstr "CString" 65 | 66 | #: src/unikey-ui.cpp:105 src/unikey-ui.cpp:172 67 | msgid "Choose input method" 68 | msgstr "Chọn kiểu gõ" 69 | 70 | #: src/unikey-ui.cpp:113 src/unikey-ui.cpp:178 71 | msgid "Choose output charset" 72 | msgstr "Chọn bảng mã" 73 | 74 | #: macro-editor/editor.cpp:43 75 | msgid "De&lete All" 76 | msgstr "Xóa &hết" 77 | 78 | #: src/unikey-ui.cpp:128 79 | msgid "Enable Macro" 80 | msgstr "Bật Gõ tắt" 81 | 82 | #: src/unikey-ui.cpp:120 83 | msgid "Enable Spell Check" 84 | msgstr "Bật kiểm tra chính tả" 85 | 86 | #: src/fcitx-unikey.desc:36 87 | msgid "Enable macro" 88 | msgstr "Bật gõ tắt" 89 | 90 | #: src/fcitx-unikey.desc:31 91 | msgid "Enable spell check" 92 | msgstr "Cho phép kiểm tra chính tả" 93 | 94 | #: src/fcitx-unikey.desc:4 95 | msgid "Input Method" 96 | msgstr "Kiểu gõ" 97 | 98 | #: macro-editor/model.cpp:44 src/unikey-ui.cpp:127 src/unikey-ui.cpp:187 99 | #: src/fcitx-unikey.conf.in:10 100 | msgid "Macro" 101 | msgstr "Gõ tắt" 102 | 103 | #: src/fcitx-unikey.desc:9 104 | msgid "Microsoft Vietnamese" 105 | msgstr "Microsoft Việt" 106 | 107 | #: src/fcitx-unikey.desc:25 108 | msgid "NCR Decimal" 109 | msgstr "Hệ thập phân NCR" 110 | 111 | #: src/fcitx-unikey.desc:26 112 | msgid "NCR Hex" 113 | msgstr "Hệ thập lục phân NCR" 114 | 115 | #: src/unikey-ui.cpp:187 116 | msgid "No Macro" 117 | msgstr "Không Gõ tắt" 118 | 119 | #: src/unikey-ui.cpp:182 120 | msgid "No Spell Check" 121 | msgstr "Không kiểm tra chính tả" 122 | 123 | #: src/unikey-ui.cpp:156 src/fcitx-unikey.desc:17 124 | msgid "Output Charset" 125 | msgstr "Bảng mã" 126 | 127 | #: src/fcitx-unikey.desc:56 128 | msgid "Process W at word begin" 129 | msgstr "Xử lý phím W ở đầu từ" 130 | 131 | #: src/fcitx-unikey.desc:11 132 | msgid "Simple Telex" 133 | msgstr "Simple Telex" 134 | 135 | #: src/fcitx-unikey.desc:12 136 | msgid "Simple Telex2" 137 | msgstr "Simple Telex2" 138 | 139 | #: src/unikey-ui.cpp:119 src/unikey-ui.cpp:182 140 | msgid "Spell Check" 141 | msgstr "Kiểm tra chính tả" 142 | 143 | #: src/fcitx-unikey.desc:20 144 | msgid "TCVN3" 145 | msgstr "TCVN3" 146 | 147 | #: src/fcitx-unikey.desc:6 148 | msgid "Telex" 149 | msgstr "Telex" 150 | 151 | #: src/unikey-ui.cpp:188 152 | msgid "Toggle Macro" 153 | msgstr "Bật gõ tắt" 154 | 155 | #: src/unikey-ui.cpp:183 156 | msgid "Toggle Spell Check" 157 | msgstr "Bật kiểm tra chính tả" 158 | 159 | #: src/fcitx-unikey.desc:19 160 | msgid "Unicode" 161 | msgstr "Unicode" 162 | 163 | #: src/unikey-im.cpp:158 src/fcitx-unikey.conf.in:3 src/unikey.conf.in:3 164 | #: src/fcitx-unikey.desc:1 src/fcitx-unikey.desc:14 src/fcitx-unikey.desc:28 165 | #: src/fcitx-unikey.desc:33 src/fcitx-unikey.desc:38 src/fcitx-unikey.desc:43 166 | #: src/fcitx-unikey.desc:48 src/fcitx-unikey.desc:53 167 | msgid "Unikey" 168 | msgstr "Unikey" 169 | 170 | #: src/unikey-ui.cpp:142 171 | msgid "Unikey Input Method" 172 | msgstr "Kiểu gõ Unikey" 173 | 174 | #: macro-editor/editor.cpp:48 macro-editor/editor.cpp:76 175 | msgid "Unikey Macro Editor" 176 | msgstr "Bảng gõ tắt cho Unikey" 177 | 178 | #: src/fcitx-unikey.conf.in:4 179 | msgid "Unikey Wrapper For Fcitx" 180 | msgstr "Bộ Unikey dành cho Fcitx" 181 | 182 | #: src/fcitx-unikey.desc:41 183 | msgid "Use oà, _uý (instead of òa, úy)" 184 | msgstr "Đặt dấu theo dạng oà , _uý (thay vì òa, úy)" 185 | 186 | #: src/fcitx-unikey.desc:10 187 | msgid "UserIM" 188 | msgstr "Tự định nghĩa" 189 | 190 | #: src/fcitx-unikey.desc:8 src/fcitx-unikey.desc:22 191 | msgid "VIQR" 192 | msgstr "VIQR" 193 | 194 | #: src/fcitx-unikey.desc:7 195 | msgid "VNI" 196 | msgstr "VNI" 197 | 198 | #: src/fcitx-unikey.desc:21 199 | msgid "VNI Win" 200 | msgstr "VNI Win" 201 | 202 | #: macro-editor/model.cpp:46 203 | msgid "Word" 204 | msgstr "Từ" 205 | -------------------------------------------------------------------------------- /unikey/unikey.cpp: -------------------------------------------------------------------------------- 1 | // -*- coding:unix; mode:c++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- 2 | /*------------------------------------------------------------------------------ 3 | UniKey - Open-source Vietnamese Keyboard 4 | Copyright (C) 1998-2004 Pham Kim Long 5 | Contact: 6 | longcz@yahoo.com 7 | http://unikey.sf.net 8 | 9 | This program is free software; you can redistribute it and/or 10 | modify it under the terms of the GNU General Public License 11 | as published by the Free Software Foundation; either version 2 12 | of the License, or (at your option) any later version. 13 | 14 | This program is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with this program; if not, write to the Free Software 21 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 22 | --------------------------------------------------------------------------------*/ 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include "unikey.h" 29 | #include "ukengine.h" 30 | #include "usrkeymap.h" 31 | 32 | using namespace std; 33 | 34 | //---- exported variables for use in UkEnginge class ---- 35 | UkSharedMem *pShMem = 0; 36 | 37 | UkEngine MyKbEngine; 38 | 39 | int UnikeyCapsLockOn = 0; 40 | int UnikeyShiftPressed = 0; 41 | //---------------------------------------------------- 42 | 43 | unsigned char UnikeyBuf[1024]; 44 | int UnikeyBackspaces; 45 | int UnikeyBufChars; 46 | UkOutputType UnikeyOutput; 47 | 48 | //-------------------------------------------- 49 | void UnikeySetInputMethod(UkInputMethod im) 50 | { 51 | if (im == UkTelex || im == UkVni || im == UkSimpleTelex || im == UkSimpleTelex2 || im == UkViqr || im == UkMsVi) { 52 | pShMem->input.setIM(im); 53 | MyKbEngine.reset(); 54 | } 55 | else if (im == UkUsrIM && pShMem->usrKeyMapLoaded) { 56 | //cout << "Switched to user mode\n"; //DEBUG 57 | pShMem->input.setIM(pShMem->usrKeyMap); 58 | MyKbEngine.reset(); 59 | } 60 | 61 | //cout << "IM changed to: " << im << endl; //DEBUG 62 | } 63 | 64 | 65 | //-------------------------------------------- 66 | void UnikeySetCapsState(int shiftPressed, int CapsLockOn) 67 | { 68 | //UnikeyCapsAll = (shiftPressed && !CapsLockOn) || (!shiftPressed && CapsLockOn); 69 | UnikeyCapsLockOn = CapsLockOn; 70 | UnikeyShiftPressed = shiftPressed; 71 | } 72 | 73 | //-------------------------------------------- 74 | int UnikeySetOutputCharset(int charset) 75 | { 76 | pShMem->charsetId = charset; 77 | MyKbEngine.reset(); 78 | return 1; 79 | } 80 | 81 | //-------------------------------------------- 82 | void UnikeySetOptions(UnikeyOptions *pOpt) 83 | { 84 | pShMem->options.freeMarking = pOpt->freeMarking; 85 | pShMem->options.modernStyle = pOpt->modernStyle; 86 | pShMem->options.macroEnabled = pOpt->macroEnabled; 87 | pShMem->options.useUnicodeClipboard = pOpt->useUnicodeClipboard; 88 | pShMem->options.alwaysMacro = pOpt->alwaysMacro; 89 | pShMem->options.spellCheckEnabled = pOpt->spellCheckEnabled; 90 | pShMem->options.autoNonVnRestore = pOpt->autoNonVnRestore; 91 | } 92 | 93 | //-------------------------------------------- 94 | void UnikeyGetOptions(UnikeyOptions *pOpt) 95 | { 96 | *pOpt = pShMem->options; 97 | } 98 | 99 | //-------------------------------------------- 100 | void CreateDefaultUnikeyOptions(UnikeyOptions *pOpt) 101 | { 102 | pOpt->freeMarking = 1; 103 | pOpt->modernStyle = 0; 104 | pOpt->macroEnabled = 0; 105 | pOpt->useUnicodeClipboard = 0; 106 | pOpt->alwaysMacro = 0; 107 | pOpt->spellCheckEnabled = 1; 108 | pOpt->autoNonVnRestore = 0; 109 | } 110 | 111 | //-------------------------------------------- 112 | void UnikeyCheckKbCase(int *pShiftPressed, int *pCapsLockOn) 113 | { 114 | *pShiftPressed = UnikeyShiftPressed; 115 | *pCapsLockOn = UnikeyCapsLockOn; 116 | } 117 | 118 | //-------------------------------------------- 119 | void UnikeySetup() 120 | { 121 | SetupUnikeyEngine(); 122 | pShMem = new UkSharedMem; 123 | pShMem->input.init(); 124 | pShMem->macStore.init(); 125 | pShMem->vietKey = 1; 126 | pShMem->usrKeyMapLoaded = 0; 127 | MyKbEngine.setCtrlInfo(pShMem); 128 | MyKbEngine.setCheckKbCaseFunc(&UnikeyCheckKbCase); 129 | UnikeySetInputMethod(UkTelex); 130 | UnikeySetOutputCharset(CONV_CHARSET_XUTF8); 131 | pShMem->initialized = 1; 132 | CreateDefaultUnikeyOptions(&pShMem->options); 133 | } 134 | 135 | //-------------------------------------------- 136 | void UnikeyCleanup() 137 | { 138 | delete pShMem; 139 | } 140 | 141 | //-------------------------------------------- 142 | void UnikeyFilter(unsigned int ch) 143 | { 144 | UnikeyBufChars = sizeof(UnikeyBuf); 145 | MyKbEngine.process(ch, UnikeyBackspaces, UnikeyBuf, UnikeyBufChars, UnikeyOutput); 146 | } 147 | 148 | //-------------------------------------------- 149 | void UnikeyPutChar(unsigned int ch) 150 | { 151 | MyKbEngine.pass(ch); 152 | UnikeyBufChars = 0; 153 | UnikeyBackspaces = 0; 154 | } 155 | 156 | //-------------------------------------------- 157 | void UnikeyResetBuf() 158 | { 159 | MyKbEngine.reset(); 160 | } 161 | 162 | //-------------------------------------------- 163 | void UnikeySetSingleMode() 164 | { 165 | MyKbEngine.setSingleMode(); 166 | } 167 | 168 | //-------------------------------------------- 169 | void UnikeyBackspacePress() 170 | { 171 | UnikeyBufChars = sizeof(UnikeyBuf); 172 | MyKbEngine.processBackspace(UnikeyBackspaces, UnikeyBuf, UnikeyBufChars, UnikeyOutput); 173 | // printf("Backspaces: %d\n",UnikeyBackspaces); 174 | } 175 | 176 | //-------------------------------------------- 177 | int UnikeyLoadMacroTable(const char *fileName) 178 | { 179 | return pShMem->macStore.loadFromFile(fileName); 180 | } 181 | 182 | //-------------------------------------------- 183 | int UnikeyLoadUserKeyMap(const char *fileName) 184 | { 185 | if (UkLoadKeyMap(fileName, pShMem->usrKeyMap)) { 186 | //cout << "User key map loaded!\n"; //DEBUG 187 | pShMem->usrKeyMapLoaded = 1; 188 | return 1; 189 | } 190 | return 0; 191 | } 192 | 193 | //-------------------------------------------- 194 | void UnikeyRestoreKeyStrokes() 195 | { 196 | UnikeyBufChars = sizeof(UnikeyBuf); 197 | MyKbEngine.restoreKeyStrokes(UnikeyBackspaces, UnikeyBuf, UnikeyBufChars, UnikeyOutput); 198 | } 199 | 200 | bool UnikeyAtWordBeginning() 201 | { 202 | return MyKbEngine.atWordBeginning(); 203 | } 204 | 205 | -------------------------------------------------------------------------------- /src/unikey-ui.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2012~2012 by CSSlayer * 3 | * wengxt@gmail.com * 4 | * * 5 | * This program is free software: you can redistribute it and/or modify * 6 | * it under the terms of the GNU General Public License as published by * 7 | * the Free Software Foundation, either version 3 of the License, or * 8 | * (at your option) any later version. * 9 | * * 10 | * This program is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 13 | * GNU General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU General Public License * 16 | * along with this program. If not, see . * 17 | * * 18 | ***************************************************************************/ 19 | 20 | #include "unikey-im.h" 21 | 22 | const char* Unikey_IMNames[] = {"Telex", "VNI", "VIQR", "Microsoft Vietnamese", "UserIM", "Simple Telex", "Simple Telex2"}; 23 | const UkInputMethod Unikey_IM[] = {UkTelex, UkVni, UkViqr, UkMsVi, UkUsrIM, UkSimpleTelex, UkSimpleTelex2}; 24 | const unsigned int NUM_INPUTMETHOD = sizeof(Unikey_IM)/sizeof(Unikey_IM[0]); 25 | 26 | const char* Unikey_OCNames[] = {"Unicode", 27 | "TCVN3", 28 | "VNI Win", 29 | "VIQR", 30 | "BK HCM 2", 31 | "CString", 32 | "NCR Decimal", 33 | "NCR Hex"}; 34 | const unsigned int NUM_OUTPUTCHARSET = sizeof(Unikey_OCNames)/sizeof(Unikey_OCNames[0]); 35 | 36 | void UpdateIMMenu(FcitxUIMenu *menu) 37 | { 38 | FcitxUnikey* unikey = (FcitxUnikey*) menu->priv; 39 | menu->mark = unikey->config.im; 40 | } 41 | 42 | boolean IMMenuAction(FcitxUIMenu *menu, int index) 43 | { 44 | FcitxUnikey* unikey = (FcitxUnikey*) menu->priv; 45 | unikey->config.im = (UkInputMethod) index; 46 | UpdateUnikeyConfig(unikey); 47 | return true; 48 | } 49 | 50 | void UpdateOCMenu(FcitxUIMenu *menu) 51 | { 52 | FcitxUnikey* unikey = (FcitxUnikey*) menu->priv; 53 | menu->mark = unikey->config.oc; 54 | } 55 | 56 | boolean OCMenuAction(FcitxUIMenu *menu, int index) 57 | { 58 | FcitxUnikey* unikey = (FcitxUnikey*) menu->priv; 59 | unikey->config.oc =(UkConv) index; 60 | UpdateUnikeyConfig(unikey); 61 | return true; 62 | } 63 | 64 | static const char* GetIMIconName(void* arg) 65 | { 66 | return ""; 67 | } 68 | 69 | static const char* GetOCIconName(void* arg) 70 | { 71 | return ""; 72 | } 73 | 74 | void ToggleSpellCheck(void *arg) 75 | { 76 | FcitxUnikey* unikey = (FcitxUnikey*) arg; 77 | unikey->config.spellCheck = !unikey->config.spellCheck; 78 | UpdateUnikeyConfig(unikey); 79 | } 80 | 81 | boolean GetSpellCheck(void *arg) 82 | { 83 | FcitxUnikey* unikey = (FcitxUnikey*) arg; 84 | return unikey->config.spellCheck; 85 | } 86 | 87 | void ToggleMacro(void *arg) 88 | { 89 | FcitxUnikey* unikey = (FcitxUnikey*) arg; 90 | unikey->config.macro = !unikey->config.macro; 91 | UpdateUnikeyConfig(unikey); 92 | } 93 | 94 | boolean GetMacro(void *arg) 95 | { 96 | FcitxUnikey* unikey = (FcitxUnikey*) arg; 97 | return unikey->config.spellCheck; 98 | } 99 | 100 | void InitializeBar(FcitxUnikey* unikey) { 101 | FcitxInstance* instance = unikey->owner; 102 | FcitxUIRegisterComplexStatus(instance, unikey, 103 | "unikey-input-method", 104 | "", 105 | _("Choose input method"), 106 | NULL, 107 | GetIMIconName 108 | ); 109 | 110 | FcitxUIRegisterComplexStatus(instance, unikey, 111 | "unikey-output-charset", 112 | "", 113 | _("Choose output charset"), 114 | NULL, 115 | GetOCIconName 116 | ); 117 | FcitxUIRegisterStatus(instance, unikey, 118 | "unikey-spell-check", 119 | _("Spell Check"), 120 | _("Enable Spell Check"), 121 | ToggleSpellCheck, 122 | GetSpellCheck 123 | ); 124 | 125 | FcitxUIRegisterStatus(instance, unikey, 126 | "unikey-macro", 127 | _("Macro"), 128 | _("Enable Macro"), 129 | ToggleMacro, 130 | GetMacro 131 | ); 132 | FcitxUISetStatusVisable(instance, "unikey-input-method", false); 133 | FcitxUISetStatusVisable(instance, "unikey-output-charset", false); 134 | FcitxUISetStatusVisable(instance, "unikey-spell-check", false); 135 | FcitxUISetStatusVisable(instance, "unikey-macro", false); 136 | } 137 | 138 | void InitializeMenu(FcitxUnikey* unikey) { 139 | FcitxInstance* instance = unikey->owner; 140 | FcitxMenuInit(&unikey->imMenu); 141 | FcitxUIMenu* imMenu = &unikey->imMenu; 142 | imMenu->name = strdup(_("Unikey Input Method")); 143 | imMenu->candStatusBind = strdup("unikey-input-method"); 144 | imMenu->UpdateMenu = UpdateIMMenu; 145 | imMenu->MenuAction = IMMenuAction; 146 | imMenu->priv = unikey; 147 | imMenu->isSubMenu = false; 148 | int i; 149 | for (i = 0; i < NUM_INPUTMETHOD; i ++) 150 | FcitxMenuAddMenuItem(imMenu, _(Unikey_IMNames[i]), MENUTYPE_SIMPLE, NULL); 151 | 152 | FcitxUIRegisterMenu(instance, imMenu); 153 | 154 | FcitxMenuInit(&unikey->ocMenu); 155 | FcitxUIMenu* ocMenu = &unikey->ocMenu; 156 | ocMenu->name = strdup(_("Output Charset")); 157 | ocMenu->candStatusBind = strdup("unikey-output-charset"); 158 | ocMenu->UpdateMenu = UpdateOCMenu; 159 | ocMenu->MenuAction = OCMenuAction; 160 | ocMenu->priv = unikey; 161 | ocMenu->isSubMenu = false; 162 | for (i = 0; i < NUM_INPUTMETHOD; i ++) 163 | FcitxMenuAddMenuItem(ocMenu, _(Unikey_OCNames[i]), MENUTYPE_SIMPLE, NULL); 164 | FcitxUIRegisterMenu(instance, ocMenu); 165 | } 166 | 167 | void UpdateUnikeyUI(FcitxUnikey* unikey) 168 | { 169 | FcitxUISetStatusString(unikey->owner, 170 | "unikey-input-method", 171 | _(Unikey_IMNames[unikey->config.im]), 172 | _("Choose input method")); 173 | 174 | 175 | FcitxUISetStatusString(unikey->owner, 176 | "unikey-output-charset", 177 | _(Unikey_OCNames[unikey->config.oc]), 178 | _("Choose output charset")); 179 | 180 | FcitxUISetStatusString(unikey->owner, 181 | "unikey-spell-check", 182 | unikey->config.spellCheck? _("Spell Check"): _("No Spell Check"), 183 | _("Toggle Spell Check")); 184 | 185 | FcitxUISetStatusString(unikey->owner, 186 | "unikey-macro", 187 | unikey->config.macro? _("Macro"): _("No Macro"), 188 | _("Toggle Macro")); 189 | } 190 | -------------------------------------------------------------------------------- /macro-editor/editor.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Copyright (C) 2012~2012 by CSSlayer * 3 | * wengxt@gmail.com * 4 | * * 5 | * This program is free software: you can redistribute it and/or modify * 6 | * it under the terms of the GNU General Public License as published by * 7 | * the Free Software Foundation, either version 3 of the License, or * 8 | * (at your option) any later version. * 9 | * * 10 | * This program is distributed in the hope that it will be useful, * 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 13 | * GNU General Public License for more details. * 14 | * * 15 | * You should have received a copy of the GNU General Public License * 16 | * along with this program. If not, see . * 17 | * * 18 | ***************************************************************************/ 19 | 20 | #include 21 | #include 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #include "editor.h" 29 | #include "model.h" 30 | #include "dialog.h" 31 | #include "mactab.h" 32 | #include "ui_editor.h" 33 | #include "common.h" 34 | 35 | namespace fcitx_unikey { 36 | 37 | MacroEditor::MacroEditor(QWidget* parent): FcitxQtConfigUIWidget(parent) 38 | ,m_ui(new Ui::Editor) 39 | { 40 | m_ui->setupUi(this); 41 | m_ui->addButton->setText(_("&Add")); 42 | m_ui->deleteButton->setText(_("&Delete")); 43 | m_ui->clearButton->setText(_("De&lete All")); 44 | m_ui->importButton->setText(_("&Import")); 45 | m_ui->exportButton->setText(_("&Export")); 46 | m_ui->macroTableView->setSelectionMode(QAbstractItemView::SingleSelection); 47 | m_ui->macroTableView->setSelectionBehavior(QAbstractItemView::SelectRows); 48 | setWindowTitle(_("Unikey Macro Editor")); 49 | 50 | connect(m_ui->addButton, SIGNAL(clicked(bool)), this, SLOT(addWord())); 51 | connect(m_ui->deleteButton, SIGNAL(clicked(bool)), this, SLOT(deleteWord())); 52 | connect(m_ui->clearButton, SIGNAL(clicked(bool)), this, SLOT(deleteAllWord())); 53 | connect(m_ui->importButton, SIGNAL(clicked(bool)), this, SLOT(importMacro())); 54 | connect(m_ui->exportButton, SIGNAL(clicked(bool)), this, SLOT(exportMacro())); 55 | load(); 56 | itemFocusChanged(); 57 | } 58 | 59 | MacroEditor::~MacroEditor() 60 | { 61 | delete m_ui; 62 | } 63 | 64 | QString MacroEditor::addon() 65 | { 66 | return "fcitx-unikey"; 67 | } 68 | 69 | QString MacroEditor::icon() 70 | { 71 | return "fcitx-unikey"; 72 | } 73 | 74 | QString MacroEditor::title() 75 | { 76 | return _("Unikey Macro Editor"); 77 | } 78 | 79 | void MacroEditor::itemFocusChanged() 80 | { 81 | m_ui->deleteButton->setEnabled(m_ui->macroTableView->currentIndex().isValid()); 82 | } 83 | 84 | void MacroEditor::deleteWord() 85 | { 86 | if (!m_ui->macroTableView->currentIndex().isValid()) 87 | return; 88 | int row = m_ui->macroTableView->currentIndex().row(); 89 | m_model->deleteItem(row); 90 | } 91 | 92 | void MacroEditor::deleteAllWord() 93 | { 94 | m_model->deleteAllItem(); 95 | } 96 | 97 | void MacroEditor::addWord() 98 | { 99 | MacroDialog* dialog = new MacroDialog(this); 100 | dialog->setAttribute(Qt::WA_DeleteOnClose, true); 101 | dialog->open(); 102 | connect(dialog, SIGNAL(accepted()), this, SLOT(addWordAccepted())); 103 | } 104 | 105 | QString MacroEditor::getData(CMacroTable* table, int i, bool iskey) { 106 | 107 | char key[MAX_MACRO_KEY_LEN*3]; 108 | char value[MAX_MACRO_TEXT_LEN*3]; 109 | do { 110 | if (i < table->getCount()) { 111 | const StdVnChar* p = NULL; 112 | int maxOutLen = 0; 113 | const char* result = NULL; 114 | if (iskey) { 115 | p = table->getKey(i); 116 | maxOutLen = sizeof(key); 117 | result = key; 118 | } else { 119 | p = table->getText(i); 120 | maxOutLen = sizeof(value); 121 | result = value; 122 | } 123 | 124 | if (!p) 125 | break; 126 | int inLen = -1; 127 | int ret = VnConvert(CONV_CHARSET_VNSTANDARD, CONV_CHARSET_XUTF8, 128 | (UKBYTE*) p, (UKBYTE*)result, 129 | &inLen, &maxOutLen); 130 | if (ret != 0) 131 | break; 132 | return QString::fromUtf8(result); 133 | } 134 | } while(0); 135 | return QString(); 136 | } 137 | 138 | void MacroEditor::addWordAccepted() 139 | { 140 | const MacroDialog* dialog = qobject_cast< const MacroDialog* >(QObject::sender()); 141 | 142 | m_model->addItem(dialog->macro(), dialog->word()); 143 | } 144 | 145 | void MacroEditor::load() 146 | { 147 | m_table = new CMacroTable; 148 | m_table->init(); 149 | char* fileName; 150 | FcitxXDGGetFileUserWithPrefix("unikey", "macro", NULL, &fileName); 151 | m_table->loadFromFile(fileName); 152 | free(fileName); 153 | m_model = new MacroModel(this); 154 | m_model->load(m_table); 155 | m_ui->macroTableView->horizontalHeader()->setStretchLastSection(true); 156 | m_ui->macroTableView->verticalHeader()->setVisible(false); 157 | m_ui->macroTableView->setModel(m_model); 158 | connect(m_ui->macroTableView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(itemFocusChanged())); 159 | connect(m_model, SIGNAL(needSaveChanged(bool)), this, SIGNAL(changed(bool))); 160 | 161 | } 162 | 163 | void MacroEditor::save() 164 | { 165 | m_model->save(m_table); 166 | FILE* f = FcitxXDGGetFileUserWithPrefix("unikey", "macro", "w", NULL); 167 | m_table->writeToFp(f); 168 | } 169 | 170 | void MacroEditor::importMacro() 171 | { 172 | QFileDialog* dialog = new QFileDialog(this); 173 | dialog->setAttribute(Qt::WA_DeleteOnClose, true); 174 | dialog->setFileMode(QFileDialog::ExistingFile); 175 | dialog->setAcceptMode(QFileDialog::AcceptOpen); 176 | dialog->open(); 177 | connect(dialog, SIGNAL(accepted()), this, SLOT(importFileSelected())); 178 | } 179 | 180 | void MacroEditor::importFileSelected() 181 | { 182 | const QFileDialog* dialog = qobject_cast< const QFileDialog* >(QObject::sender()); 183 | qDebug() << dialog->selectedFiles(); 184 | } 185 | 186 | void MacroEditor::exportMacro() 187 | { 188 | QFileDialog* dialog = new QFileDialog(this); 189 | dialog->setAttribute(Qt::WA_DeleteOnClose, true); 190 | dialog->setDirectory("macro"); 191 | dialog->setAcceptMode(QFileDialog::AcceptSave); 192 | dialog->open(); 193 | connect(dialog, SIGNAL(accepted()), this, SLOT(exportFileSelected())); 194 | } 195 | 196 | void MacroEditor::exportFileSelected() 197 | { 198 | const QFileDialog* dialog = qobject_cast< const QFileDialog* >(QObject::sender()); 199 | if (dialog->selectedFiles().length() <= 0) 200 | return; 201 | QString file = dialog->selectedFiles()[0]; 202 | m_table->writeToFile(file.toUtf8().data()); 203 | } 204 | 205 | 206 | 207 | 208 | } 209 | -------------------------------------------------------------------------------- /unikey/convert.cpp: -------------------------------------------------------------------------------- 1 | // -*- coding:unix; mode:c++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- 2 | /*------------------------------------------------------------------------------ 3 | VnConv: Vietnamese Encoding Converter Library 4 | UniKey Project: http://unikey.sourceforge.net 5 | Copyleft (C) 1998-2002 Pham Kim Long 6 | Contact: longp@cslab.felk.cvut.cz 7 | 8 | This program is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU General Public License 10 | as published by the Free Software Foundation; either version 2 11 | of the License, or (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 21 | --------------------------------------------------------------------------------*/ 22 | 23 | #include "charset.h" 24 | #include 25 | #include 26 | #include 27 | 28 | #if defined(_WIN32) 29 | #include 30 | #include 31 | #endif 32 | 33 | #include "vnconv.h" 34 | 35 | int vnFileStreamConvert(int inCharset, int outCharset, FILE * inf, FILE *outf); 36 | 37 | DllExport int genConvert(VnCharset & incs, VnCharset & outcs, ByteInStream & input, ByteOutStream & output) 38 | { 39 | StdVnChar stdChar; 40 | int bytesRead, bytesWritten; 41 | 42 | incs.startInput(); 43 | outcs.startOutput(); 44 | 45 | int ret = 1; 46 | while (!input.eos()) { 47 | stdChar = 0; 48 | if (incs.nextInput(input, stdChar, bytesRead)) { 49 | if (stdChar != INVALID_STD_CHAR) { 50 | if (VnCharsetLibObj.m_options.toLower) 51 | stdChar = StdVnToLower(stdChar); 52 | else if (VnCharsetLibObj.m_options.toUpper) 53 | stdChar = StdVnToUpper(stdChar); 54 | if (VnCharsetLibObj.m_options.removeTone) 55 | stdChar = StdVnGetRoot(stdChar); 56 | ret = outcs.putChar(output, stdChar, bytesWritten); 57 | } 58 | } 59 | else break; 60 | } 61 | return (ret? 0 : VNCONV_OUT_OF_MEMORY); 62 | } 63 | 64 | //---------------------------------------------- 65 | // Arguments: 66 | // inCharset: charset of input 67 | // outCharset: charset of output 68 | // input: input data 69 | // output: output data 70 | // inLen: [in] size of input. if inLen = -1, input data is null-terminated. 71 | // [out] if input inLen != -1, output iLen is the numbers of byte left in input. 72 | // maxOutLen: [in] size of output. 73 | // [out] number of bytes output, if enough memory 74 | // number of bytes needed for output, if not enough memory 75 | // Returns: 0 if successful 76 | // error code: if failed 77 | //---------------------------------------------- 78 | //int VnConvert(int inCharset, int outCharset, UKBYTE *input, UKBYTE *output, int & inLen, int & maxOutLen) 79 | 80 | DllExport int VnConvert(int inCharset, int outCharset, UKBYTE *input, UKBYTE *output, 81 | int * pInLen, int * pMaxOutLen) 82 | { 83 | int inLen, maxOutLen; 84 | int ret = -1; 85 | 86 | inLen = *pInLen; 87 | maxOutLen = *pMaxOutLen; 88 | 89 | if (inLen != -1 && inLen < 0) // invalid inLen 90 | return ret; 91 | 92 | VnCharset *pInCharset = VnCharsetLibObj.getVnCharset(inCharset); 93 | VnCharset *pOutCharset = VnCharsetLibObj.getVnCharset(outCharset); 94 | 95 | if (!pInCharset || !pOutCharset) 96 | return VNCONV_INVALID_CHARSET; 97 | 98 | StringBIStream is(input, inLen, pInCharset->elementSize()); 99 | StringBOStream os(output, maxOutLen); 100 | 101 | ret = genConvert(*pInCharset, *pOutCharset, is, os); 102 | *pMaxOutLen = os.getOutBytes(); 103 | *pInLen = is.left(); 104 | return ret; 105 | } 106 | 107 | //--------------------------------------- 108 | // Arguments: 109 | // inFile: input file name. NULL if STDIN is used 110 | // outFile: output file name, NULL if STDOUT is used 111 | // Returns: 112 | // 0: successful 113 | // errCode: if failed 114 | //--------------------------------------- 115 | DllExport int VnFileConvert(int inCharset, int outCharset, const char *inFile, const char *outFile) 116 | { 117 | FILE *inf = NULL; 118 | FILE *outf = NULL; 119 | int ret = 0; 120 | char tmpName[32]; 121 | 122 | if (inFile == NULL) { 123 | inf = stdin; 124 | #if defined(_WIN32) 125 | _setmode( _fileno(stdin), _O_BINARY); 126 | #endif 127 | } 128 | else { 129 | inf = fopen(inFile, "rb"); 130 | if (inf == NULL) { 131 | ret = VNCONV_ERR_INPUT_FILE; 132 | goto end; 133 | } 134 | } 135 | 136 | if (outFile == NULL) 137 | outf = stdout; 138 | else { 139 | // setup temporary output file (because real output file may be the same as input file 140 | char outDir[256]; 141 | strcpy(outDir, outFile); 142 | 143 | #if defined(_WIN32) 144 | char *p = strrchr(outDir, '\\'); 145 | #else 146 | char *p = strrchr(outDir, '/'); 147 | #endif 148 | 149 | if (p == NULL) 150 | outDir[0] = 0; 151 | else 152 | *p = 0; 153 | 154 | strcpy(tmpName, outDir); 155 | strcat(tmpName, "XXXXXX"); 156 | 157 | if (mkstemp(tmpName) == -1) { 158 | fclose(inf); 159 | ret = VNCONV_ERR_OUTPUT_FILE; 160 | goto end; 161 | } 162 | outf = fopen(tmpName, "wb"); 163 | 164 | if (outf == NULL) { 165 | fclose(inf); 166 | ret = VNCONV_ERR_OUTPUT_FILE; 167 | goto end; 168 | } 169 | } 170 | 171 | 172 | ret = vnFileStreamConvert(inCharset, outCharset, inf, outf); 173 | if (inf != stdin) 174 | fclose(inf); 175 | if (outf != stdout) { 176 | fclose(outf); 177 | 178 | // delete output file if exisits 179 | if (ret == 0) { 180 | remove(outFile); 181 | #if !defined(_WIN32) 182 | char cmd[256]; 183 | sprintf(cmd, "mv %s %s", tmpName, outFile); 184 | cmd[0] = system(cmd); 185 | #else 186 | if (rename(tmpName, outFile) != 0) { 187 | remove(tmpName); 188 | ret = VNCONV_ERR_OUTPUT_FILE; 189 | goto end; 190 | } 191 | #endif 192 | } 193 | else 194 | remove(tmpName); 195 | } 196 | 197 | end: 198 | #if defined(_WIN32) 199 | if (inf == stdin) { 200 | _setmode( _fileno(stdin), _O_BINARY); 201 | } 202 | #endif 203 | return ret; 204 | } 205 | 206 | //------------------------------------------------ 207 | // Returns: 208 | // 0: successful 209 | // errCode: if failed 210 | //--------------------------------------- 211 | int vnFileStreamConvert(int inCharset, int outCharset, FILE * inf, FILE *outf) 212 | { 213 | VnCharset *pInCharset = VnCharsetLibObj.getVnCharset(inCharset); 214 | VnCharset *pOutCharset = VnCharsetLibObj.getVnCharset(outCharset); 215 | 216 | if (!pInCharset || !pOutCharset) 217 | return VNCONV_INVALID_CHARSET; 218 | 219 | if (outCharset == CONV_CHARSET_UNICODE) { 220 | UKWORD sign = 0xFEFF; 221 | fwrite(&sign, sizeof(UKWORD), 1, outf); 222 | } 223 | 224 | FileBIStream is; 225 | FileBOStream os; 226 | 227 | is.attach(inf); 228 | os.attach(outf); 229 | 230 | return genConvert(*pInCharset, *pOutCharset, is, os); 231 | } 232 | 233 | const char *ErrTable[VNCONV_LAST_ERROR] = 234 | {"No error", 235 | "Unknown error", 236 | "Invalid charset", 237 | "Error opening input file", 238 | "Error opening output file", 239 | "Error writing to output stream", 240 | "Not enough memory", 241 | }; 242 | 243 | DllExport const char * VnConvErrMsg(int errCode) 244 | { 245 | if (errCode < 0 || errCode >= VNCONV_LAST_ERROR) 246 | errCode = VNCONV_UNKNOWN_ERROR; 247 | return ErrTable[errCode]; 248 | } 249 | 250 | -------------------------------------------------------------------------------- /unikey/usrkeymap.cpp: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- 2 | /* Unikey Vietnamese Input Method 3 | * Copyright (C) 2000-2005 Pham Kim Long 4 | * Contact: 5 | * unikey@gmail.com 6 | * UniKey project: http://unikey.org 7 | * 8 | * This library is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License as published by the Free Software Foundation; either 11 | * version 2 of the License, or (at your option) any later version. 12 | * 13 | * This library is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | * Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public 19 | * License along with this library; if not, write to the 20 | * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | 24 | #include 25 | #include 26 | #include 27 | using namespace std; 28 | 29 | #include 30 | #include "usrkeymap.h" 31 | 32 | 33 | int getLabelIndex(int action); 34 | void initKeyMap(int keyMap[256]); 35 | 36 | #define OPT_COMMENT_CHAR ';' 37 | 38 | struct UkEventLabelPair 39 | { 40 | char label[32]; 41 | int ev; 42 | }; 43 | 44 | UkEventLabelPair UkEvLabelList[] = { 45 | {"Tone0", vneTone0}, 46 | {"Tone1", vneTone1}, 47 | {"Tone2", vneTone2}, 48 | {"Tone3", vneTone3}, 49 | {"Tone4", vneTone4}, 50 | {"Tone5", vneTone5}, 51 | {"Roof-All", vneRoofAll}, 52 | {"Roof-A", vneRoof_a}, 53 | {"Roof-E", vneRoof_e}, 54 | {"Roof-O", vneRoof_o}, 55 | {"Hook-Bowl", vneHookAll}, 56 | {"Hook-UO", vneHook_uo}, 57 | {"Hook-U", vneHook_u}, 58 | {"Hook-O", vneHook_o}, 59 | {"Bowl", vneBowl}, 60 | {"D-Mark", vneDd}, 61 | {"Telex-W", vne_telex_w}, 62 | {"Escape", vneEscChar}, 63 | {"DD", vneCount + vnl_DD}, 64 | {"dd", vneCount + vnl_dd}, 65 | {"A^", vneCount + vnl_Ar}, 66 | {"a^", vneCount + vnl_ar}, 67 | {"A(", vneCount + vnl_Ab}, 68 | {"a(", vneCount + vnl_ab}, 69 | {"E^", vneCount + vnl_Er}, 70 | {"e^", vneCount + vnl_er}, 71 | {"O^", vneCount + vnl_Or}, 72 | {"o^", vneCount + vnl_or}, 73 | {"O+", vneCount + vnl_Oh}, 74 | {"o+", vneCount + vnl_oh}, 75 | {"U+", vneCount + vnl_Uh}, 76 | {"u+", vneCount + vnl_uh} 77 | }; 78 | 79 | const int UkEvLabelCount = sizeof(UkEvLabelList)/sizeof(UkEventLabelPair); 80 | 81 | //-------------------------------------------------- 82 | static int parseNameValue(char *line, char **name, char **value) 83 | { 84 | char *p, *mark; 85 | char ch; 86 | 87 | if (line == 0) 88 | return 0; 89 | 90 | // get rid of comment 91 | p = strchr(line, OPT_COMMENT_CHAR); 92 | if (p) 93 | *p = 0; 94 | 95 | //get option name 96 | for (p=line; *p == ' '; p++); 97 | if (*p == 0) 98 | return 0; 99 | 100 | *name = p; 101 | mark = p; //mark the last non-space character 102 | p++; 103 | while ((ch=*p) != '=' && ch!=0) { 104 | if (ch != ' ') 105 | mark = p; 106 | p++; 107 | } 108 | 109 | if (ch == 0) 110 | return 0; 111 | *(mark+1) = 0; //terminate name with a null character 112 | 113 | //get option value 114 | p++; 115 | while (*p == ' ') p++; 116 | if (*p == 0) 117 | return 0; 118 | 119 | *value = p; 120 | mark = p; 121 | while (*p) { //strip trailing spaces 122 | if (*p != ' ') 123 | mark = p; 124 | p++; 125 | } 126 | *++mark = 0; 127 | return 1; 128 | } 129 | 130 | //----------------------------------------------------- 131 | DllExport int UkLoadKeyMap(const char *fileName, int keyMap[256]) 132 | { 133 | int i, mapCount; 134 | UkKeyMapPair orderMap[256]; 135 | if (!UkLoadKeyOrderMap(fileName, orderMap, &mapCount)) 136 | return 0; 137 | 138 | initKeyMap(keyMap); 139 | for (i=0; i < mapCount; i++) { 140 | keyMap[orderMap[i].key] = orderMap[i].action; 141 | if (orderMap[i].action < vneCount) { 142 | keyMap[tolower(orderMap[i].key)] = orderMap[i].action; 143 | } 144 | } 145 | return 1; 146 | } 147 | 148 | //------------------------------------------------------------------ 149 | DllExport int UkLoadKeyOrderMap(const char *fileName, UkKeyMapPair *pMap, int *pMapCount) 150 | { 151 | FILE *f; 152 | char *buf; 153 | char *name, *value; 154 | size_t len; 155 | int i, bufSize, lineCount; 156 | unsigned char c; 157 | int mapCount; 158 | int keyMap[256]; 159 | 160 | f = fopen(fileName, "r"); 161 | if (f == 0) { 162 | cerr << "Failed to open file: " << fileName << endl; 163 | return 0; 164 | } 165 | 166 | initKeyMap(keyMap); 167 | bufSize = 256; 168 | buf = new char[bufSize]; 169 | 170 | lineCount = 0; 171 | mapCount = 0; 172 | while (!feof(f)) { 173 | if (fgets((char *)buf, bufSize, f) == 0) 174 | break; 175 | lineCount++; 176 | len = strlen(buf); 177 | if (len == 0) 178 | break; 179 | 180 | if (buf[len-1] == '\n') 181 | buf[len-1] = 0; 182 | if (parseNameValue(buf, (char **)&name, (char **)&value)) { 183 | if (strlen(name) == 1) { 184 | for (i=0; i < UkEvLabelCount; i++) { 185 | if (strcmp(UkEvLabelList[i].label, value) == 0) { 186 | c = (unsigned char)name[0]; 187 | if (keyMap[c] != vneNormal) { 188 | //already assigned, don't accept this map 189 | break; 190 | } 191 | //cout << "key: " << c << " value: " << UkEvLabelList[i].ev << endl; //DEBUG 192 | keyMap[c] = UkEvLabelList[i].ev; 193 | pMap[mapCount].action = UkEvLabelList[i].ev; 194 | if (keyMap[c] < vneCount) { 195 | pMap[mapCount].key = toupper(c); 196 | keyMap[toupper(c)] = UkEvLabelList[i].ev; 197 | } 198 | else { 199 | pMap[mapCount].key = c; 200 | } 201 | mapCount++; 202 | break; 203 | } 204 | } 205 | if (i == UkEvLabelCount) { 206 | cerr << "Error in user key layout, line " << lineCount << ": command not found" << endl; 207 | } 208 | } 209 | else { 210 | cerr << "Error in user key layout, line " << lineCount 211 | << ": key name is not a single character" << endl; 212 | } 213 | } 214 | } 215 | delete [] buf; 216 | fclose(f); 217 | 218 | *pMapCount = mapCount; 219 | 220 | return 1; 221 | } 222 | 223 | //------------------------------------------- 224 | void initKeyMap(int keyMap[256]) 225 | { 226 | unsigned int c; 227 | for (c=0; c<256; c++) 228 | keyMap[c] = vneNormal; 229 | } 230 | 231 | const char *UkKeyMapHeader = 232 | "; This is UniKey user-defined key mapping file, generated from UniKey (Windows)\n\n"; 233 | 234 | DllExport int UkStoreKeyOrderMap(const char *fileName, UkKeyMapPair *pMap, int mapCount) 235 | { 236 | FILE *f; 237 | int i; 238 | int labelIndex; 239 | char line[128]; 240 | 241 | f = fopen(fileName, "wt"); 242 | if (f == 0) { 243 | cerr << "Failed to open file: " << fileName << endl; 244 | return 0; 245 | } 246 | 247 | fputs(UkKeyMapHeader, f); 248 | for (i=0; i < mapCount; i++) { 249 | labelIndex = getLabelIndex(pMap[i].action); 250 | if (labelIndex != -1) { 251 | sprintf(line, "%c = %s\n", pMap[i].key, UkEvLabelList[labelIndex].label); 252 | fputs(line, f); 253 | } 254 | } 255 | fclose(f); 256 | return 1; 257 | } 258 | 259 | int getLabelIndex(int event) 260 | { 261 | int i; 262 | for (i = 0; i < UkEvLabelCount; i++) { 263 | if (UkEvLabelList[i].ev == event) 264 | return i; 265 | } 266 | return -1; 267 | } 268 | -------------------------------------------------------------------------------- /unikey/mactab.cpp: -------------------------------------------------------------------------------- 1 | // -*- coding:unix; mode:c++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- 2 | /* Unikey Vietnamese Input Method 3 | * Copyright (C) 2000-2005 Pham Kim Long 4 | * Contact: 5 | * unikey@gmail.com 6 | * UniKey project: http://unikey.org 7 | * 8 | * This library is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License as published by the Free Software Foundation; either 11 | * version 2 of the License, or (at your option) any later version. 12 | * 13 | * This library is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | * Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public 19 | * License along with this library; if not, write to the 20 | * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include "mactab.h" 29 | #include "vnconv.h" 30 | 31 | using namespace std; 32 | #define UKMACRO_VERSION_UTF8 1 33 | 34 | //--------------------------------------------------------------- 35 | void CMacroTable::init() 36 | { 37 | m_memSize = MACRO_MEM_SIZE; 38 | m_count = 0; 39 | m_occupied = 0; 40 | } 41 | 42 | //--------------------------------------------------------------- 43 | char *MacCompareStartMem; 44 | 45 | #define STD_TO_LOWER(x) (((x) >= VnStdCharOffset && \ 46 | (x) < (VnStdCharOffset + TOTAL_ALPHA_VNCHARS) && \ 47 | !((x) & 1)) ? \ 48 | (x+1) : (x)) 49 | 50 | int macCompare(const void *p1, const void *p2) 51 | { 52 | StdVnChar *s1 = (StdVnChar *) ((char *)MacCompareStartMem + ((MacroDef *)p1)->keyOffset); 53 | StdVnChar *s2 = (StdVnChar *) ((char *)MacCompareStartMem + ((MacroDef *)p2)->keyOffset); 54 | 55 | int i; 56 | StdVnChar ls1, ls2; 57 | 58 | for (i=0; s1[i] != 0 && s2[i] != 0; i++) { 59 | ls1 = STD_TO_LOWER(s1[i]); 60 | ls2 = STD_TO_LOWER(s2[i]); 61 | if (ls1 > ls2) 62 | return 1; 63 | if (ls1 < ls2) 64 | return -1; 65 | /* 66 | if (s1[i] > s2[i]) 67 | return 1; 68 | if (s1[i] < s2[i]) 69 | return -1; 70 | */ 71 | } 72 | if (s1[i] == 0) 73 | return (s2[i] == 0)? 0 : -1; 74 | return 1; 75 | } 76 | 77 | //--------------------------------------------------------------- 78 | int macKeyCompare(const void *key, const void *ele) 79 | { 80 | StdVnChar *s1 = (StdVnChar *)key; 81 | StdVnChar *s2 = (StdVnChar *) ((char *)MacCompareStartMem + ((MacroDef *)ele)->keyOffset); 82 | 83 | StdVnChar ls1, ls2; 84 | int i; 85 | for (i=0; s1[i] != 0 && s2[i] != 0; i++) { 86 | ls1 = STD_TO_LOWER(s1[i]); 87 | ls2 = STD_TO_LOWER(s2[i]); 88 | if (ls1 > ls2) 89 | return 1; 90 | if (ls1 < ls2) 91 | return -1; 92 | /* 93 | if (s1[i] > s2[i]) 94 | return 1; 95 | if (s1[i] < s2[i]) 96 | return -1; 97 | */ 98 | } 99 | if (s1[i] == 0) 100 | return (s2[i] == 0)? 0 : -1; 101 | return 1; 102 | } 103 | 104 | //--------------------------------------------------------------- 105 | const StdVnChar *CMacroTable::lookup(StdVnChar *key) 106 | { 107 | MacCompareStartMem = m_macroMem; 108 | MacroDef *p = (MacroDef *)bsearch(key, m_table, m_count, sizeof(MacroDef), macKeyCompare); 109 | if (p) 110 | return (StdVnChar *)(m_macroMem + p->textOffset); 111 | return 0; 112 | } 113 | 114 | //---------------------------------------------------------------------------- 115 | // Read header, if it's present in the file. Get the version of the file 116 | // If header is absent, go back to the beginning of file and set version to 0 117 | // Return false if reading failed. 118 | // 119 | // Header format: ;[DO NOT DELETE THIS LINE]***version=n 120 | //---------------------------------------------------------------------------- 121 | bool CMacroTable::readHeader(FILE *f, int & version) 122 | { 123 | char line[MAX_MACRO_LINE]; 124 | if (!fgets(line, sizeof(line), f)) { 125 | if (feof(f)) { 126 | fseek(f, 0, SEEK_SET); 127 | version = 0; 128 | return true; 129 | } 130 | return false; 131 | } 132 | 133 | //if BOM is available, skip it 134 | char *p = line; 135 | size_t len = strlen(line); 136 | if (len >= 3 && (unsigned char)line[0] == 0xEF && (unsigned char)line[1] == 0xBB && 137 | (unsigned char)line[2] == 0xBF) 138 | { 139 | p += 3; 140 | } 141 | 142 | //read version number 143 | p = strstr(p, "***"); 144 | if (p) { 145 | p += 3; 146 | //skip possible spaces 147 | while (*p == ' ') p++; 148 | if (sscanf(p, "version=%d", &version) == 1) 149 | return true; 150 | } 151 | 152 | fseek(f, 0, SEEK_SET); 153 | version = 0; 154 | return true; 155 | } 156 | 157 | //---------------------------------------------------------------- 158 | void CMacroTable::writeHeader(FILE *f) 159 | { 160 | #if defined(WIN32) 161 | fprintf(f, "\xEF\xBB\xBF;DO NOT DELETE THIS LINE*** version=%d ***\n", UKMACRO_VERSION_UTF8); 162 | #else 163 | fprintf(f, "DO NOT DELETE THIS LINE*** version=%d ***\n", UKMACRO_VERSION_UTF8); 164 | #endif 165 | } 166 | //--------------------------------------------------------------- 167 | int CMacroTable::loadFromFile(const char *fname) 168 | { 169 | FILE *f; 170 | #if defined(WIN32) 171 | f = _tfopen(fname, _TEXT("rt")); 172 | #else 173 | f = fopen(fname, "r"); 174 | #endif 175 | 176 | if (f == NULL) 177 | return 0; 178 | char line[MAX_MACRO_LINE]; 179 | size_t len; 180 | 181 | resetContent(); 182 | 183 | //read possible header 184 | int version; 185 | if (!readHeader(f, version)) { 186 | version = 0; 187 | } 188 | 189 | while (fgets(line, sizeof(line), f)) { 190 | len = strlen(line); 191 | if (len > 0 && line[len-1] == '\n') 192 | line[len-1] = 0; 193 | if (len > 1 && line[len-2] == '\r') 194 | line[len-2] = 0; 195 | if (version == UKMACRO_VERSION_UTF8) 196 | addItem(line, CONV_CHARSET_UNIUTF8); 197 | else 198 | addItem(line, CONV_CHARSET_VIQR); 199 | } 200 | fclose(f); 201 | MacCompareStartMem = m_macroMem; 202 | qsort(m_table, m_count, sizeof(MacroDef), macCompare); 203 | // Convert old version 204 | if (version != UKMACRO_VERSION_UTF8) { 205 | writeToFile(fname); 206 | } 207 | return 1; 208 | } 209 | 210 | //--------------------------------------------------------------- 211 | int CMacroTable::writeToFile(const char *fname) 212 | { 213 | FILE *f; 214 | #if defined(WIN32) 215 | f = _tfopen(fname, _TEXT("wt")); 216 | #else 217 | f = fopen(fname, "w"); 218 | #endif 219 | return writeToFp(f); 220 | } 221 | 222 | int CMacroTable::writeToFp(FILE* f) 223 | { 224 | int ret; 225 | int inLen, maxOutLen; 226 | 227 | if (f == NULL) 228 | return 0; 229 | 230 | char line[MAX_MACRO_LINE*3]; //1 VnChar may need 3 chars in UTF8 231 | char key[MAX_MACRO_KEY_LEN*3]; 232 | char text[MAX_MACRO_TEXT_LEN*3]; 233 | 234 | writeHeader(f); 235 | 236 | UKBYTE *p; 237 | for (int i=0; i < m_count; i++) { 238 | p = (UKBYTE *)m_macroMem + m_table[i].keyOffset; 239 | inLen = -1; 240 | maxOutLen = sizeof(key); 241 | ret = VnConvert(CONV_CHARSET_VNSTANDARD, CONV_CHARSET_UNIUTF8, 242 | (UKBYTE *) p, (UKBYTE *)key, 243 | &inLen, &maxOutLen); 244 | if (ret != 0) 245 | continue; 246 | 247 | p = (UKBYTE *)m_macroMem + m_table[i].textOffset; 248 | inLen = -1; 249 | maxOutLen = sizeof(text); 250 | ret = VnConvert(CONV_CHARSET_VNSTANDARD, CONV_CHARSET_UNIUTF8, 251 | p, (UKBYTE *)text, 252 | &inLen, &maxOutLen); 253 | if (ret != 0) 254 | continue; 255 | if (i < m_count-1) 256 | sprintf(line, "%s:%s\n", key, text); 257 | else 258 | sprintf(line, "%s:%s", key, text); 259 | fputs(line, f); 260 | } 261 | 262 | fclose(f); 263 | return 1; 264 | } 265 | 266 | //--------------------------------------------------------------- 267 | int CMacroTable::addItem(const void *key, const void *text, int charset) 268 | { 269 | int ret; 270 | int inLen, maxOutLen; 271 | int offset = m_occupied; 272 | char *p = m_macroMem + offset; 273 | 274 | if (m_count >= MAX_MACRO_ITEMS) 275 | return -1; 276 | 277 | m_table[m_count].keyOffset = offset; 278 | 279 | // Convert macro key to VN standard 280 | inLen = -1; //input is null-terminated 281 | maxOutLen = MAX_MACRO_KEY_LEN * sizeof(StdVnChar); 282 | if (maxOutLen + offset > m_memSize) 283 | maxOutLen = m_memSize - offset; 284 | ret = VnConvert(charset, CONV_CHARSET_VNSTANDARD, 285 | (UKBYTE *)key, (UKBYTE *)p, 286 | &inLen, &maxOutLen); 287 | if (ret != 0) 288 | return -1; 289 | 290 | offset += maxOutLen; 291 | p += maxOutLen; 292 | 293 | //convert macro text to VN standard 294 | m_table[m_count].textOffset = offset; 295 | inLen = -1; //input is null-terminated 296 | maxOutLen = MAX_MACRO_TEXT_LEN * sizeof(StdVnChar); 297 | if (maxOutLen + offset > m_memSize) 298 | maxOutLen = m_memSize - offset; 299 | ret = VnConvert(charset, CONV_CHARSET_VNSTANDARD, 300 | (UKBYTE *)text, (UKBYTE *)p, 301 | &inLen, &maxOutLen); 302 | if (ret != 0) 303 | return -1; 304 | 305 | m_occupied = offset + maxOutLen; 306 | m_count++; 307 | return (m_count-1); 308 | } 309 | 310 | //--------------------------------------------------------------- 311 | // add a new macro into the sorted macro table 312 | // item format: key:text (key and text are separated by a colon) 313 | //--------------------------------------------------------------- 314 | int CMacroTable::addItem(const char *item, int charset) 315 | { 316 | char key[MAX_MACRO_KEY_LEN]; 317 | 318 | // Parse the input item 319 | char * pos = (char*)strchr(item, ':'); 320 | if (pos == NULL) 321 | return -1; 322 | int keyLen = (int)(pos - item); 323 | if (keyLen > MAX_MACRO_KEY_LEN-1) 324 | keyLen = MAX_MACRO_KEY_LEN-1; 325 | strncpy(key, item, keyLen); 326 | key[keyLen] = '\0'; 327 | return addItem(key, ++pos, charset); 328 | } 329 | 330 | //--------------------------------------------------------------- 331 | void CMacroTable::resetContent() 332 | { 333 | m_occupied = 0; 334 | m_count = 0; 335 | } 336 | 337 | //--------------------------------------------------------------- 338 | const StdVnChar *CMacroTable::getKey(int idx) const 339 | { 340 | if (idx < 0 || idx >= m_count) 341 | return 0; 342 | return (StdVnChar *)(m_macroMem + m_table[idx].keyOffset); 343 | } 344 | 345 | //--------------------------------------------------------------- 346 | const StdVnChar *CMacroTable::getText(int idx) const 347 | { 348 | if (idx < 0 || idx >= m_count) 349 | return 0; 350 | return (StdVnChar *)(m_macroMem + m_table[idx].textOffset); 351 | } 352 | -------------------------------------------------------------------------------- /unikey/charset.h: -------------------------------------------------------------------------------- 1 | // -*- coding:unix; mode:c++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- 2 | /*------------------------------------------------------------------------------ 3 | VnConv: Vietnamese Encoding Converter Library 4 | UniKey Project: http://unikey.sourceforge.net 5 | Copyleft (C) 1998-2002 Pham Kim Long 6 | Contact: longp@cslab.felk.cvut.cz 7 | 8 | This program is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU General Public License 10 | as published by the Free Software Foundation; either version 2 11 | of the License, or (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 21 | --------------------------------------------------------------------------------*/ 22 | 23 | #ifndef __CHARSET_CONVERT_H 24 | #define __CHARSET_CONVERT_H 25 | 26 | #if !defined(_WIN32) 27 | #include 28 | #endif 29 | 30 | #if defined(_WIN32) 31 | #if defined(UNIKEYHOOK) 32 | #define DllInterface __declspec( dllexport ) 33 | #else 34 | #define DllInterface __declspec( dllimport ) 35 | #endif 36 | #else 37 | #define DllInterface //not used 38 | #define DllExport 39 | #define DllImport 40 | #endif 41 | 42 | #include "vnconv.h" 43 | #include "byteio.h" 44 | #include "pattern.h" 45 | 46 | #define TOTAL_VNCHARS 213 47 | #define TOTAL_ALPHA_VNCHARS 186 48 | 49 | #if defined(_WIN32) 50 | typedef unsigned __int32 StdVnChar; 51 | typedef unsigned __int16 UnicodeChar; 52 | typedef unsigned __int16 UKWORD; 53 | typedef unsigned __int32 UKDWORD; 54 | #else 55 | //typedef unsigned int StdVnChar; //the size should be more specific 56 | typedef uint32_t StdVnChar; 57 | typedef uint16_t UnicodeChar; 58 | typedef uint16_t UKWORD; 59 | typedef uint32_t UKDWORD; 60 | #endif 61 | 62 | //typedef unsigned short UnicodeChar; 63 | //typedef unsigned short UKWORD; 64 | 65 | //typedef unsigned int UKDWORD; //the size should be more specific 66 | 67 | #ifndef LOWORD 68 | #define LOWORD(l) ((UKWORD)(l)) 69 | #endif 70 | 71 | #ifndef HIWORD 72 | #define HIWORD(l) ((UKWORD)(((UKDWORD)(l) >> 16) & 0xFFFF)) 73 | #endif 74 | 75 | #ifndef MAKEWORD 76 | #define MAKEWORD(a, b) ((UKWORD)(((UKBYTE)(a)) | ((UKWORD)((UKBYTE)(b))) << 8)) 77 | #endif 78 | 79 | const StdVnChar VnStdCharOffset = 0x10000; 80 | const StdVnChar INVALID_STD_CHAR = 0xFFFFFFFF; 81 | //const unsigned char PadChar = '?'; //? is used for VIQR charset 82 | const unsigned char PadChar = '#'; 83 | const unsigned char PadStartQuote = '\"'; 84 | const unsigned char PadEndQuote = '\"'; 85 | const unsigned char PadEllipsis = '.'; 86 | 87 | class DllInterface VnCharset { 88 | public: 89 | virtual void startInput() {}; 90 | virtual void startOutput() {}; 91 | // virtual UKBYTE *nextInput(UKBYTE *input, int inLen, StdVnChar & stdChar, int & bytesRead) = 0; 92 | virtual int nextInput(ByteInStream & is, StdVnChar & stdChar, int & bytesRead) = 0; 93 | 94 | //------------------------------------------------------------------------ 95 | // put a character to the output after converting it 96 | // Arguments: 97 | // output[in]: output buffer 98 | // stdChar[in]: character in standard charset 99 | // outLen[out]: length of converted sequence 100 | // maxAvail[in]: max length available. 101 | // Returns: next position in output 102 | //------------------------------------------------------------------------ 103 | virtual int putChar(ByteOutStream & os, StdVnChar stdChar, int & outLen) = 0; 104 | virtual int elementSize(); 105 | virtual ~VnCharset() {} 106 | }; 107 | 108 | //-------------------------------------------------- 109 | class SingleByteCharset: public VnCharset { 110 | protected: 111 | UKWORD m_stdMap[256]; 112 | unsigned char * m_vnChars; 113 | public: 114 | SingleByteCharset(unsigned char * vnChars); 115 | virtual int nextInput(ByteInStream & is, StdVnChar & stdChar, int & bytesRead); 116 | virtual int putChar(ByteOutStream & os, StdVnChar stdChar, int & outLen); 117 | }; 118 | 119 | //-------------------------------------------------- 120 | class VnInternalCharset: public VnCharset { 121 | public: 122 | VnInternalCharset() {}; 123 | virtual int nextInput(ByteInStream & is, StdVnChar & stdChar, int & bytesRead); 124 | virtual int putChar(ByteOutStream & os, StdVnChar stdChar, int & outLen); 125 | virtual int elementSize(); 126 | }; 127 | 128 | //-------------------------------------------------- 129 | class UnicodeCharset: public VnCharset { 130 | protected: 131 | UKDWORD m_vnChars[TOTAL_VNCHARS]; 132 | UnicodeChar * m_toUnicode; 133 | public: 134 | UnicodeCharset(UnicodeChar *vnChars); 135 | virtual int nextInput(ByteInStream & is, StdVnChar & stdChar, int & bytesRead); 136 | virtual int putChar(ByteOutStream & os, StdVnChar stdChar, int & outLen); 137 | virtual int elementSize(); 138 | }; 139 | 140 | //-------------------------------------------------- 141 | class DoubleByteCharset: public VnCharset { 142 | protected: 143 | UKWORD m_stdMap[256]; 144 | UKDWORD m_vnChars[TOTAL_VNCHARS]; 145 | UKWORD * m_toDoubleChar; 146 | public: 147 | DoubleByteCharset(UKWORD *vnChars); 148 | virtual int nextInput(ByteInStream & is, StdVnChar & stdChar, int & bytesRead); 149 | virtual int putChar(ByteOutStream & os, StdVnChar stdChar, int & outLen); 150 | }; 151 | 152 | //-------------------------------------------------- 153 | class UnicodeUTF8Charset: public UnicodeCharset 154 | { 155 | public: 156 | UnicodeUTF8Charset(UnicodeChar *vnChars) : UnicodeCharset(vnChars) {} 157 | 158 | virtual int nextInput(ByteInStream & is, StdVnChar & stdChar, int & bytesRead); 159 | virtual int putChar(ByteOutStream & os, StdVnChar stdChar, int & outLen); 160 | }; 161 | 162 | //-------------------------------------------------- 163 | class UnicodeRefCharset: public UnicodeCharset 164 | { 165 | public: 166 | UnicodeRefCharset(UnicodeChar *vnChars) : UnicodeCharset(vnChars) {} 167 | 168 | virtual int nextInput(ByteInStream & is, StdVnChar & stdChar, int & bytesRead); 169 | virtual int putChar(ByteOutStream & os, StdVnChar stdChar, int & outLen); 170 | }; 171 | 172 | //-------------------------------------------------- 173 | class UnicodeHexCharset: public UnicodeRefCharset 174 | { 175 | public: 176 | UnicodeHexCharset(UnicodeChar *vnChars) : UnicodeRefCharset(vnChars) {} 177 | virtual int putChar(ByteOutStream & os, StdVnChar stdChar, int & outLen); 178 | }; 179 | 180 | //-------------------------------------------------- 181 | class UnicodeCStringCharset: public UnicodeCharset 182 | { 183 | protected: 184 | int m_prevIsHex; 185 | public: 186 | UnicodeCStringCharset(UnicodeChar *vnChars) : UnicodeCharset(vnChars) {} 187 | virtual int nextInput(ByteInStream & is, StdVnChar & stdChar, int & bytesRead); 188 | virtual int putChar(ByteOutStream & os, StdVnChar stdChar, int & outLen); 189 | virtual void startInput(); 190 | }; 191 | 192 | //-------------------------------------------------- 193 | class WinCP1258Charset: public VnCharset { 194 | protected: 195 | UKWORD m_stdMap[256]; 196 | UKDWORD m_vnChars[TOTAL_VNCHARS*2]; 197 | UKWORD *m_toDoubleChar; 198 | int m_totalChars; 199 | 200 | public: 201 | WinCP1258Charset(UKWORD *compositeChars, UKWORD *precomposedChars); 202 | virtual int nextInput(ByteInStream & is, StdVnChar & stdChar, int & bytesRead); 203 | virtual int putChar(ByteOutStream & os, StdVnChar stdChar, int & outLen); 204 | }; 205 | 206 | //-------------------------------------------------- 207 | struct UniCompCharInfo { 208 | UKDWORD compChar; 209 | int stdIndex; 210 | }; 211 | 212 | class UnicodeCompCharset: public VnCharset { 213 | protected: 214 | UniCompCharInfo m_info[TOTAL_VNCHARS*2]; 215 | UKDWORD *m_uniCompChars; 216 | int m_totalChars; 217 | public: 218 | UnicodeCompCharset(UnicodeChar *uniChars, UKDWORD *uniCompChars); 219 | virtual int nextInput(ByteInStream & is, StdVnChar & stdChar, int & bytesRead); 220 | virtual int putChar(ByteOutStream & os, StdVnChar stdChar, int & outLen); 221 | virtual int elementSize(); 222 | }; 223 | 224 | //-------------------------------------------------- 225 | class VIQRCharset: public VnCharset { 226 | protected: 227 | UKDWORD *m_vnChars; 228 | UKWORD m_stdMap[256]; 229 | int m_atWordBeginning; 230 | int m_escapeBowl; 231 | int m_escapeRoof; 232 | int m_escapeHook; 233 | int m_escapeTone; 234 | int m_gotTone; 235 | int m_escAll; 236 | int m_noOutEsc; 237 | public: 238 | int m_suspicious; 239 | VIQRCharset(UKDWORD *vnChars); 240 | virtual void startInput(); 241 | virtual void startOutput(); 242 | virtual int nextInput(ByteInStream & is, StdVnChar & stdChar, int & bytesRead); 243 | virtual int putChar(ByteOutStream & os, StdVnChar stdChar, int & outLen); 244 | }; 245 | 246 | //-------------------------------------------------- 247 | class UTF8VIQRCharset: public VnCharset { 248 | 249 | protected: 250 | VIQRCharset *m_pViqr; 251 | UnicodeUTF8Charset *m_pUtf; 252 | 253 | public: 254 | UTF8VIQRCharset(UnicodeUTF8Charset *pUtf, VIQRCharset *pViqr); 255 | virtual void startInput(); 256 | virtual void startOutput(); 257 | virtual int nextInput(ByteInStream & is, StdVnChar & stdChar, int & bytesRead); 258 | virtual int putChar(ByteOutStream & os, StdVnChar stdChar, int & outLen); 259 | }; 260 | 261 | 262 | //-------------------------------------------------- 263 | class DllInterface CVnCharsetLib { 264 | protected: 265 | SingleByteCharset * m_sgCharsets[CONV_TOTAL_SINGLE_CHARSETS]; 266 | DoubleByteCharset * m_dbCharsets[CONV_TOTAL_DOUBLE_CHARSETS]; 267 | UnicodeCharset * m_pUniCharset; 268 | UnicodeCompCharset * m_pUniCompCharset; 269 | UnicodeUTF8Charset * m_pUniUTF8; 270 | UnicodeRefCharset * m_pUniRef; 271 | UnicodeHexCharset * m_pUniHex; 272 | VIQRCharset * m_pVIQRCharObj; 273 | UTF8VIQRCharset * m_pUVIQRCharObj; 274 | WinCP1258Charset * m_pWinCP1258; 275 | UnicodeCStringCharset *m_pUniCString; 276 | VnInternalCharset *m_pVnIntCharset; 277 | 278 | public: 279 | PatternList m_VIQREscPatterns, m_VIQROutEscPatterns; 280 | VnConvOptions m_options; 281 | CVnCharsetLib(); 282 | ~CVnCharsetLib(); 283 | VnCharset * getVnCharset(int charsetIdx); 284 | }; 285 | 286 | extern unsigned char SingleByteTables[][TOTAL_VNCHARS]; 287 | extern UKWORD DoubleByteTables[][TOTAL_VNCHARS]; 288 | extern UnicodeChar UnicodeTable[TOTAL_VNCHARS]; 289 | extern UKDWORD VIQRTable[TOTAL_VNCHARS]; 290 | extern UKDWORD UnicodeComposite[TOTAL_VNCHARS]; 291 | extern UKWORD WinCP1258[TOTAL_VNCHARS]; 292 | extern UKWORD WinCP1258Pre[TOTAL_VNCHARS]; 293 | 294 | extern DllInterface CVnCharsetLib VnCharsetLibObj; 295 | extern VnConvOptions VnConvGlobalOptions; 296 | extern int StdVnNoTone[TOTAL_VNCHARS]; 297 | extern int StdVnRootChar[TOTAL_VNCHARS]; 298 | 299 | DllInterface int genConvert(VnCharset & incs, VnCharset & outcs, ByteInStream & input, ByteOutStream & output); 300 | 301 | StdVnChar StdVnToUpper(StdVnChar ch); 302 | StdVnChar StdVnToLower(StdVnChar ch); 303 | StdVnChar StdVnGetRoot(StdVnChar ch); 304 | 305 | #endif 306 | -------------------------------------------------------------------------------- /unikey/inputproc.cpp: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- 2 | /* Unikey Vietnamese Input Method 3 | * Copyright (C) 2000-2005 Pham Kim Long 4 | * Contact: 5 | * unikey@gmail.com 6 | * UniKey project: http://unikey.org 7 | * 8 | * This library is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License as published by the Free Software Foundation; either 11 | * version 2 of the License, or (at your option) any later version. 12 | * 13 | * This library is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | * Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public 19 | * License along with this library; if not, write to the 20 | * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | 24 | #include 25 | #include "inputproc.h" 26 | 27 | using namespace std; 28 | 29 | /* 30 | unsigned char WordBreakSyms[] = { 31 | ',', ';', ':', '.', '\"', '\'', '!', '?', ' ', 32 | '<', '>', '=', '+', '-', '*', '/', '\\', 33 | '_', '~', '`', '@', '#', '$', '%', '^', '&', '(', ')', '{', '}', '[', ']'}; 34 | */ 35 | 36 | unsigned char WordBreakSyms[] = { 37 | ',', ';', ':', '.', '\"', '\'', '!', '?', ' ', 38 | '<', '>', '=', '+', '-', '*', '/', '\\', 39 | '_', '@', '#', '$', '%', '&', '(', ')', '{', '}', '[', ']', '|'}; //we excluded ~, `, ^ 40 | 41 | VnLexiName AZLexiUpper[] = 42 | {vnl_A, vnl_B, vnl_C, vnl_D, vnl_E, vnl_F, vnl_G, vnl_H, vnl_I, vnl_J, 43 | vnl_K, vnl_L, vnl_M, vnl_N, vnl_O, vnl_P, vnl_Q, vnl_R, vnl_S, vnl_T, 44 | vnl_U, vnl_V, vnl_W, vnl_X, vnl_Y, vnl_Z}; 45 | 46 | VnLexiName AZLexiLower[] = 47 | {vnl_a, vnl_b, vnl_c, vnl_d, vnl_e, vnl_f, vnl_g, vnl_h, vnl_i, vnl_j, 48 | vnl_k, vnl_l, vnl_m, vnl_n, vnl_o, vnl_p, vnl_q, vnl_r, vnl_s, vnl_t, 49 | vnl_u, vnl_v, vnl_w, vnl_x, vnl_y, vnl_z}; 50 | 51 | UkCharType UkcMap[256]; 52 | 53 | struct _ascVnLexi { 54 | int asc; 55 | VnLexiName lexi; 56 | }; 57 | 58 | //List of western characters outside range A-Z that are 59 | //also Vietnamese characters 60 | _ascVnLexi AscVnLexiList[] = { 61 | {0xC0, vnl_A2}, 62 | {0xC1, vnl_A1}, 63 | {0xC2, vnl_Ar}, 64 | {0xC2, vnl_A4}, 65 | {0xC8, vnl_E2}, 66 | {0xC9, vnl_E1}, 67 | {0xCA, vnl_Er}, 68 | {0xCC, vnl_I2}, 69 | {0xCD, vnl_I1}, 70 | {0xD2, vnl_O2}, 71 | {0xD3, vnl_O1}, 72 | {0xD4, vnl_Or}, 73 | {0xD5, vnl_O4}, 74 | {0xD9, vnl_U2}, 75 | {0xDA, vnl_U1}, 76 | {0xDD, vnl_Y1}, 77 | {0xE0, vnl_a2}, 78 | {0xE1, vnl_a1}, 79 | {0xE2, vnl_ar}, 80 | {0xE3, vnl_a4}, 81 | {0xE8, vnl_e2}, 82 | {0xE9, vnl_e1}, 83 | {0xEA, vnl_er}, 84 | {0xEC, vnl_i2}, 85 | {0xED, vnl_i1}, 86 | {0xF2, vnl_o2}, 87 | {0xF3, vnl_o1}, 88 | {0xF4, vnl_or}, 89 | {0xF5, vnl_o4}, 90 | {0xF9, vnl_u2}, 91 | {0xFA, vnl_u1}, 92 | {0xFD, vnl_y1}, 93 | {0x00, vnl_nonVnChar} 94 | }; 95 | 96 | VnLexiName IsoVnLexiMap[256]; 97 | 98 | bool ClassifierTableInitialized = false; 99 | 100 | DllExport UkKeyMapping TelexMethodMapping[] = { 101 | {'Z', vneTone0}, 102 | {'S', vneTone1}, 103 | {'F', vneTone2}, 104 | {'R', vneTone3}, 105 | {'X', vneTone4}, 106 | {'J', vneTone5}, 107 | {'W', vne_telex_w}, 108 | {'A', vneRoof_a}, 109 | {'E', vneRoof_e}, 110 | {'O', vneRoof_o}, 111 | {'D', vneDd}, 112 | {'[', vneCount + vnl_oh}, 113 | {']', vneCount + vnl_uh}, 114 | {'{', vneCount + vnl_Oh}, 115 | {'}', vneCount + vnl_Uh}, 116 | {0, vneNormal} 117 | }; 118 | 119 | DllExport UkKeyMapping SimpleTelexMethodMapping[] = { 120 | {'Z', vneTone0}, 121 | {'S', vneTone1}, 122 | {'F', vneTone2}, 123 | {'R', vneTone3}, 124 | {'X', vneTone4}, 125 | {'J', vneTone5}, 126 | {'W', vneHookAll}, 127 | {'A', vneRoof_a}, 128 | {'E', vneRoof_e}, 129 | {'O', vneRoof_o}, 130 | {'D', vneDd}, 131 | {0, vneNormal} 132 | }; 133 | 134 | DllExport UkKeyMapping SimpleTelex2MethodMapping[] = { 135 | {'Z', vneTone0}, 136 | {'S', vneTone1}, 137 | {'F', vneTone2}, 138 | {'R', vneTone3}, 139 | {'X', vneTone4}, 140 | {'J', vneTone5}, 141 | {'W', vne_telex_w}, 142 | {'A', vneRoof_a}, 143 | {'E', vneRoof_e}, 144 | {'O', vneRoof_o}, 145 | {'D', vneDd}, 146 | {0, vneNormal} 147 | }; 148 | 149 | DllExport UkKeyMapping VniMethodMapping[] = { 150 | {'0', vneTone0}, 151 | {'1', vneTone1}, 152 | {'2', vneTone2}, 153 | {'3', vneTone3}, 154 | {'4', vneTone4}, 155 | {'5', vneTone5}, 156 | {'6', vneRoofAll}, 157 | {'7', vneHook_uo}, 158 | {'8', vneBowl}, 159 | {'9', vneDd}, 160 | {0, vneNormal} 161 | }; 162 | 163 | DllExport UkKeyMapping VIQRMethodMapping[] = { 164 | {'0', vneTone0}, 165 | {'\'', vneTone1}, 166 | {'`', vneTone2}, 167 | {'?', vneTone3}, 168 | {'~', vneTone4}, 169 | {'.', vneTone5}, 170 | {'^', vneRoofAll}, 171 | {'+', vneHook_uo}, 172 | {'*', vneHook_uo}, 173 | {'(', vneBowl}, 174 | {'D', vneDd}, 175 | {'\\', vneEscChar}, 176 | {0, vneNormal} 177 | }; 178 | 179 | DllExport UkKeyMapping MsViMethodMapping[] = { 180 | {'5', vneTone2}, 181 | {'%', vneTone2}, 182 | {'6', vneTone3}, 183 | {'^', vneTone3}, 184 | {'7', vneTone4}, 185 | {'&', vneTone4}, 186 | {'8', vneTone1}, 187 | {'*', vneTone1}, 188 | {'9', vneTone5}, 189 | {'(', vneTone5}, 190 | {'1', vneCount + vnl_ab}, 191 | {'!', vneCount + vnl_Ab}, 192 | {'2', vneCount + vnl_ar}, 193 | {'@', vneCount + vnl_Ar}, 194 | {'3', vneCount + vnl_er}, 195 | {'#', vneCount + vnl_Er}, 196 | {'4', vneCount + vnl_or}, 197 | {'$', vneCount + vnl_Or}, 198 | {'0', vneCount + vnl_dd}, 199 | {')', vneCount + vnl_DD}, 200 | {'[', vneCount + vnl_uh}, 201 | {']', vneCount + vnl_oh}, 202 | {'{', vneCount + vnl_Uh}, 203 | {'}', vneCount + vnl_Oh}, 204 | {0, vneNormal} 205 | }; 206 | 207 | //------------------------------------------- 208 | void SetupInputClassifierTable() 209 | { 210 | unsigned int c; 211 | int i; 212 | 213 | for (c=0; c<=32; c++) { 214 | UkcMap[c] = ukcReset; 215 | } 216 | 217 | for (c=33; c<256; c++) { 218 | UkcMap[c] = ukcNonVn; 219 | } 220 | 221 | /* 222 | for (c = '0'; c <= '9'; c++) 223 | UkcMap[c] = ukcNonVn; 224 | */ 225 | 226 | for (c = 'a'; c <= 'z'; c++) 227 | UkcMap[c] = ukcVn; 228 | for (c = 'A'; c <= 'Z'; c++) 229 | UkcMap[c] = ukcVn; 230 | 231 | for (i=0; AscVnLexiList[i].asc; i++) { 232 | UkcMap[AscVnLexiList[i].asc] = ukcVn; 233 | } 234 | 235 | UkcMap[(unsigned char)'j'] = ukcNonVn; 236 | UkcMap[(unsigned char)'J'] = ukcNonVn; 237 | UkcMap[(unsigned char)'f'] = ukcNonVn; 238 | UkcMap[(unsigned char)'F'] = ukcNonVn; 239 | UkcMap[(unsigned char)'w'] = ukcNonVn; 240 | UkcMap[(unsigned char)'W'] = ukcNonVn; 241 | 242 | int count = sizeof(WordBreakSyms)/sizeof(unsigned char); 243 | for (i = 0; i < count; i++) 244 | UkcMap[WordBreakSyms[i]] = ukcWordBreak; 245 | 246 | //Calculate IsoVnLexiMap 247 | for (i = 0; i < 256; i++) { 248 | IsoVnLexiMap[i] = vnl_nonVnChar; 249 | } 250 | 251 | for (i = 0; AscVnLexiList[i].asc; i++) { 252 | IsoVnLexiMap[AscVnLexiList[i].asc] = AscVnLexiList[i].lexi; 253 | } 254 | 255 | for (c = 'a'; c <= 'z'; c++) { 256 | IsoVnLexiMap[c] = AZLexiLower[c - 'a']; 257 | } 258 | 259 | for (c = 'A'; c <= 'Z'; c++) { 260 | IsoVnLexiMap[c] = AZLexiUpper[c - 'A']; 261 | } 262 | } 263 | 264 | //------------------------------------------- 265 | void UkInputProcessor::init() 266 | { 267 | if (!ClassifierTableInitialized) { 268 | SetupInputClassifierTable(); 269 | ClassifierTableInitialized = true; 270 | } 271 | setIM(UkTelex); 272 | } 273 | 274 | //------------------------------------------- 275 | int UkInputProcessor::setIM(UkInputMethod im) 276 | { 277 | m_im = im; 278 | switch (im) { 279 | case UkTelex: 280 | useBuiltIn(TelexMethodMapping); 281 | break; 282 | case UkSimpleTelex: 283 | useBuiltIn(SimpleTelexMethodMapping); 284 | break; 285 | case UkSimpleTelex2: 286 | useBuiltIn(SimpleTelex2MethodMapping); 287 | break; 288 | case UkVni: 289 | useBuiltIn(VniMethodMapping); 290 | break; 291 | case UkViqr: 292 | useBuiltIn(VIQRMethodMapping); 293 | break; 294 | case UkMsVi: 295 | useBuiltIn(MsViMethodMapping); 296 | break; 297 | default: 298 | m_im = UkTelex; 299 | useBuiltIn(TelexMethodMapping); 300 | } 301 | return 1; 302 | } 303 | 304 | //------------------------------------------- 305 | int UkInputProcessor::setIM(int map[256]) 306 | { 307 | int i; 308 | m_im = UkUsrIM; 309 | for (i=0; i<256; i++) 310 | m_keyMap[i] = map[i]; 311 | return 1; 312 | } 313 | 314 | 315 | //------------------------------------------- 316 | void UkResetKeyMap(int keyMap[256]) 317 | { 318 | unsigned int c; 319 | for (c=0; c<256; c++) 320 | keyMap[c] = vneNormal; 321 | } 322 | 323 | //------------------------------------------- 324 | void UkInputProcessor::useBuiltIn(UkKeyMapping *map) 325 | { 326 | UkResetKeyMap(m_keyMap); 327 | for (int i=0; map[i].key; i++) { 328 | m_keyMap[map[i].key] = map[i].action; 329 | if (map[i].action < vneCount) { 330 | if (islower(map[i].key)) { 331 | m_keyMap[toupper(map[i].key)] = map[i].action; 332 | } 333 | else if (isupper(map[i].key)) { 334 | m_keyMap[tolower(map[i].key)] = map[i].action; 335 | } 336 | } 337 | } 338 | } 339 | 340 | //------------------------------------------- 341 | void UkInputProcessor::keyCodeToEvent(unsigned int keyCode, UkKeyEvent & ev) 342 | { 343 | ev.keyCode = keyCode; 344 | if (keyCode > 255) { 345 | ev.evType = vneNormal; 346 | ev.vnSym = IsoToVnLexi(keyCode); 347 | ev.chType = (ev.vnSym == vnl_nonVnChar)? ukcNonVn : ukcVn; 348 | } 349 | else { 350 | ev.chType = UkcMap[keyCode]; 351 | ev.evType = m_keyMap[keyCode]; 352 | 353 | if (ev.evType >= vneTone0 && ev.evType <= vneTone5) { 354 | ev.tone = ev.evType - vneTone0; 355 | } 356 | 357 | if (ev.evType >= vneCount) { 358 | ev.chType = ukcVn; 359 | ev.vnSym = (VnLexiName)(ev.evType - vneCount); 360 | ev.evType = vneMapChar; 361 | } 362 | else { 363 | ev.vnSym = IsoToVnLexi(keyCode); 364 | } 365 | } 366 | } 367 | 368 | //---------------------------------------------------------------- 369 | // This method translates a key stroke to a symbol. 370 | // Key strokes are simply considered character input, not action keys as in 371 | // keyCodeToEvent method 372 | //---------------------------------------------------------------- 373 | void UkInputProcessor::keyCodeToSymbol(unsigned int keyCode, UkKeyEvent & ev) 374 | { 375 | ev.keyCode = keyCode; 376 | ev.evType = vneNormal; 377 | ev.vnSym = IsoToVnLexi(keyCode); 378 | if (keyCode > 255) { 379 | ev.chType = (ev.vnSym == vnl_nonVnChar)? ukcNonVn : ukcVn; 380 | } 381 | else { 382 | ev.chType = UkcMap[keyCode]; 383 | } 384 | } 385 | 386 | //------------------------------------------- 387 | UkCharType UkInputProcessor::getCharType(unsigned int keyCode) 388 | { 389 | if (keyCode > 255) 390 | return (IsoToVnLexi(keyCode) == vnl_nonVnChar) ? ukcNonVn : ukcVn; 391 | return UkcMap[keyCode]; 392 | } 393 | 394 | //------------------------------------------- 395 | void UkInputProcessor::getKeyMap(int map[256]) 396 | { 397 | int i; 398 | for (i=0; i<256; i++) 399 | map[i] = m_keyMap[i]; 400 | } 401 | 402 | --------------------------------------------------------------------------------