├── Installer ├── Installer.h ├── Installer.rc ├── Installer.cpp ├── Installer.vcproj ├── Installer.dsw ├── Resource.h └── Installer.dsp ├── License.txt ├── ChewingIME.nsi ├── Data ├── statusbg.bmp ├── statuswnd.bmp ├── statusbg_gs.bmp └── statusbg_gs_norm.bmp ├── HashEd ├── HashEd.rc ├── icon.bmp ├── HashEd.vcproj ├── res │ ├── HashEd.ico │ └── HashEd.rc2 ├── StdAfx.cpp ├── HashEd.dsw ├── StdAfx.h ├── HashEd.h ├── HashEd.cpp ├── hash.h ├── resource.h ├── CHashContext.h ├── HashEdDlg.h └── HashEd.dsp ├── UserGuide ├── bug.htm ├── about.htm ├── cool.png ├── usage.htm ├── Chewing.hhp ├── PhraseEd.htm ├── config.htm ├── config_1.gif ├── config_2.gif ├── config_3.gif ├── config_4.gif ├── config_5.gif ├── default.htm ├── phraseed.PNG ├── toolbar.PNG ├── toolbar.gif ├── changelog.htm ├── copyright.htm ├── knownissue.htm └── Table of Contents.hhc ├── ChewingIME ├── chi.ico ├── eng.ico ├── full.ico ├── half.ico ├── icon.bmp ├── config.ico ├── ChewingIME.rc ├── mainicon.ico ├── ChewingIME.cpp ├── status_bar24.bmp ├── ChewingIME.vcproj ├── IMEUILock.h ├── ChewingIME.def ├── DrawUtil.h ├── CandWnd.h ├── Window.cpp ├── IMCLock.h ├── Tooltip.h ├── CandList.cpp ├── IMEUILock.cpp ├── IMEChildWnd.h ├── CandList.h ├── ChewingIME.dsw ├── StatusWnd.h ├── Window.h ├── CompWnd.h ├── IMEUI.h ├── DrawUtil.cpp ├── IMCLock.cpp ├── CompStr.h ├── ChewingIME.h ├── XPToolbar.h ├── IMEChildWnd.cpp ├── ChewingClient.h ├── Tooltip.cpp ├── resource.h ├── CompStr.cpp ├── CompWnd.cpp ├── XPToolbar.cpp ├── StatusWnd.cpp └── ChewingIME.dsp ├── dat2bin ├── dat2bin.cpp ├── build_data.bat ├── dat2bin.vcproj └── dat2binUTF8.vcproj ├── HashEd-UTF8 ├── HashEd.rc ├── icon.bmp ├── Pho2Chewing.h ├── res │ ├── HashEd.ico │ └── HashEd.rc2 ├── StdAfx.cpp ├── HashEd.dsw ├── StdAfx.h ├── HashEd.exe.manifest ├── HashEd.h ├── HashEd.cpp ├── PhraseList.h ├── resource.h ├── HashEdDlg.h ├── CHashContext.h ├── HashEd.dsp ├── Pho2Chewing.cpp └── HashEd-UTF8.vcproj ├── ChewingIME_MultiLang.nsi ├── OnlineUpdate ├── Update.ico ├── OnlineUpdate.cpp ├── OnlineUpdate.rc ├── OnlineUpdate.vcproj ├── Update.exe.manifest └── resource.h ├── ChangeLog ├── big52utf8 ├── big52utf8.vcproj └── big52utf8.cpp ├── nsis ├── translations │ ├── tradchinese.nsh │ └── english.nsh └── lang.nsh ├── AUTHORS ├── ChewingServer ├── main.cpp ├── ChewingServer.dsw ├── ChewingMsg.h ├── ChewingServer.dsp ├── ChewingServerUTF8.vcproj └── chewing.cpp ├── TODO ├── Include ├── pipe.h ├── Chewingpp.h └── ChewingServer.h ├── win32chewing.dsw ├── Chewing.sln └── common └── pipe.cpp /Installer/Installer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "resource.h" 4 | -------------------------------------------------------------------------------- /License.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/License.txt -------------------------------------------------------------------------------- /ChewingIME.nsi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/ChewingIME.nsi -------------------------------------------------------------------------------- /Data/statusbg.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/Data/statusbg.bmp -------------------------------------------------------------------------------- /HashEd/HashEd.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/HashEd/HashEd.rc -------------------------------------------------------------------------------- /HashEd/icon.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/HashEd/icon.bmp -------------------------------------------------------------------------------- /UserGuide/bug.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/UserGuide/bug.htm -------------------------------------------------------------------------------- /ChewingIME/chi.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/ChewingIME/chi.ico -------------------------------------------------------------------------------- /ChewingIME/eng.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/ChewingIME/eng.ico -------------------------------------------------------------------------------- /ChewingIME/full.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/ChewingIME/full.ico -------------------------------------------------------------------------------- /ChewingIME/half.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/ChewingIME/half.ico -------------------------------------------------------------------------------- /ChewingIME/icon.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/ChewingIME/icon.bmp -------------------------------------------------------------------------------- /Data/statuswnd.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/Data/statuswnd.bmp -------------------------------------------------------------------------------- /UserGuide/about.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/UserGuide/about.htm -------------------------------------------------------------------------------- /UserGuide/cool.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/UserGuide/cool.png -------------------------------------------------------------------------------- /UserGuide/usage.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/UserGuide/usage.htm -------------------------------------------------------------------------------- /dat2bin/dat2bin.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/dat2bin/dat2bin.cpp -------------------------------------------------------------------------------- /ChewingIME/config.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/ChewingIME/config.ico -------------------------------------------------------------------------------- /Data/statusbg_gs.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/Data/statusbg_gs.bmp -------------------------------------------------------------------------------- /HashEd-UTF8/HashEd.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/HashEd-UTF8/HashEd.rc -------------------------------------------------------------------------------- /HashEd-UTF8/icon.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/HashEd-UTF8/icon.bmp -------------------------------------------------------------------------------- /HashEd/HashEd.vcproj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/HashEd/HashEd.vcproj -------------------------------------------------------------------------------- /HashEd/res/HashEd.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/HashEd/res/HashEd.ico -------------------------------------------------------------------------------- /Installer/Installer.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/Installer/Installer.rc -------------------------------------------------------------------------------- /UserGuide/Chewing.hhp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/UserGuide/Chewing.hhp -------------------------------------------------------------------------------- /UserGuide/PhraseEd.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/UserGuide/PhraseEd.htm -------------------------------------------------------------------------------- /UserGuide/config.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/UserGuide/config.htm -------------------------------------------------------------------------------- /UserGuide/config_1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/UserGuide/config_1.gif -------------------------------------------------------------------------------- /UserGuide/config_2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/UserGuide/config_2.gif -------------------------------------------------------------------------------- /UserGuide/config_3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/UserGuide/config_3.gif -------------------------------------------------------------------------------- /UserGuide/config_4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/UserGuide/config_4.gif -------------------------------------------------------------------------------- /UserGuide/config_5.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/UserGuide/config_5.gif -------------------------------------------------------------------------------- /UserGuide/default.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/UserGuide/default.htm -------------------------------------------------------------------------------- /UserGuide/phraseed.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/UserGuide/phraseed.PNG -------------------------------------------------------------------------------- /UserGuide/toolbar.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/UserGuide/toolbar.PNG -------------------------------------------------------------------------------- /UserGuide/toolbar.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/UserGuide/toolbar.gif -------------------------------------------------------------------------------- /dat2bin/build_data.bat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/dat2bin/build_data.bat -------------------------------------------------------------------------------- /dat2bin/dat2bin.vcproj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/dat2bin/dat2bin.vcproj -------------------------------------------------------------------------------- /ChewingIME/ChewingIME.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/ChewingIME/ChewingIME.rc -------------------------------------------------------------------------------- /ChewingIME/mainicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/ChewingIME/mainicon.ico -------------------------------------------------------------------------------- /ChewingIME_MultiLang.nsi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/ChewingIME_MultiLang.nsi -------------------------------------------------------------------------------- /Installer/Installer.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/Installer/Installer.cpp -------------------------------------------------------------------------------- /OnlineUpdate/Update.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/OnlineUpdate/Update.ico -------------------------------------------------------------------------------- /UserGuide/changelog.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/UserGuide/changelog.htm -------------------------------------------------------------------------------- /UserGuide/copyright.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/UserGuide/copyright.htm -------------------------------------------------------------------------------- /UserGuide/knownissue.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/UserGuide/knownissue.htm -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | 2005-09-30 PCMan (Hong Jen Yee) 2 | 3 | * Import Win32 port of Chewing. 4 | -------------------------------------------------------------------------------- /ChewingIME/ChewingIME.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/ChewingIME/ChewingIME.cpp -------------------------------------------------------------------------------- /ChewingIME/status_bar24.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/ChewingIME/status_bar24.bmp -------------------------------------------------------------------------------- /Data/statusbg_gs_norm.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/Data/statusbg_gs_norm.bmp -------------------------------------------------------------------------------- /HashEd-UTF8/Pho2Chewing.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/HashEd-UTF8/Pho2Chewing.h -------------------------------------------------------------------------------- /HashEd-UTF8/res/HashEd.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/HashEd-UTF8/res/HashEd.ico -------------------------------------------------------------------------------- /Installer/Installer.vcproj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/Installer/Installer.vcproj -------------------------------------------------------------------------------- /big52utf8/big52utf8.vcproj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/big52utf8/big52utf8.vcproj -------------------------------------------------------------------------------- /dat2bin/dat2binUTF8.vcproj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/dat2bin/dat2binUTF8.vcproj -------------------------------------------------------------------------------- /ChewingIME/ChewingIME.vcproj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/ChewingIME/ChewingIME.vcproj -------------------------------------------------------------------------------- /OnlineUpdate/OnlineUpdate.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/OnlineUpdate/OnlineUpdate.cpp -------------------------------------------------------------------------------- /OnlineUpdate/OnlineUpdate.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/OnlineUpdate/OnlineUpdate.rc -------------------------------------------------------------------------------- /OnlineUpdate/OnlineUpdate.vcproj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/OnlineUpdate/OnlineUpdate.vcproj -------------------------------------------------------------------------------- /UserGuide/Table of Contents.hhc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/UserGuide/Table of Contents.hhc -------------------------------------------------------------------------------- /nsis/translations/tradchinese.nsh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chewing/windows-chewing/HEAD/nsis/translations/tradchinese.nsh -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Lead Developer 2 | -------------- 3 | PCMan 4 | 5 | Contributors 6 | ------------ 7 | seamxr 8 | andyhorng 9 | -------------------------------------------------------------------------------- /nsis/lang.nsh: -------------------------------------------------------------------------------- 1 | !macro CHEWING_LANG_BEGIN 2 | !macroend 3 | 4 | !macro CHEWING_LANG_END 5 | !macroend 6 | 7 | !macro CHEWING_LANG LABEL VALUE 8 | LangString "${LABEL}" 0 VALUE 9 | !macroend 10 | 11 | ; vim:ft=nsis 12 | -------------------------------------------------------------------------------- /HashEd/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // HashEd.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /HashEd-UTF8/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // HashEd.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ChewingIME/IMEUILock.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class IMEUI; 6 | class IMEUILock 7 | { 8 | public: 9 | IMEUILock(HWND hUIWnd); 10 | ~IMEUILock(void); 11 | IMEUI* getIMEUI(); 12 | private: 13 | HGLOBAL hIMEUI; 14 | IMEUI* ui; 15 | HWND hUIWnd; 16 | public: 17 | IMEUI* createIMEUI(void); 18 | }; 19 | -------------------------------------------------------------------------------- /ChewingIME/ChewingIME.def: -------------------------------------------------------------------------------- 1 | LIBRARY CHEWING 2 | 3 | EXPORTS 4 | ImeConversionList 5 | ImeConfigure 6 | ImeDestroy 7 | ImeEscape 8 | ImeInquire 9 | ImeProcessKey 10 | ImeSelect 11 | ImeSetActiveContext 12 | ImeToAsciiEx 13 | NotifyIME 14 | ImeRegisterWord 15 | ImeUnregisterWord 16 | ImeGetRegisterWordStyle 17 | ImeEnumRegisterWord 18 | ImeSetCompositionString 19 | ImeGetImeMenuItems 20 | -------------------------------------------------------------------------------- /ChewingIME/DrawUtil.h: -------------------------------------------------------------------------------- 1 | #ifndef _DRAW_UTIL_H_ 2 | #define _DRAW_UTIL_H_ 3 | 4 | #include 5 | 6 | void FillSolidRect( HDC dc, LPRECT rc, COLORREF color ); 7 | void FillSolidRect( HDC dc, int l, int t, int w, int h, COLORREF color ); 8 | void Draw3DBorder(HDC hdc, LPRECT rc, COLORREF light, COLORREF dark, int width = 1); 9 | void DrawBitmap(HDC dc, HBITMAP bmp, int x, int y, int w, int h, int srcx, int srcy ); 10 | 11 | #endif -------------------------------------------------------------------------------- /HashEd/res/HashEd.rc2: -------------------------------------------------------------------------------- 1 | // 2 | // HASHED.RC2 - resources Microsoft Visual C++ does not edit directly 3 | // 4 | 5 | #ifdef APSTUDIO_INVOKED 6 | #error this file is not editable by Microsoft Visual C++ 7 | #endif //APSTUDIO_INVOKED 8 | 9 | 10 | ///////////////////////////////////////////////////////////////////////////// 11 | // Add manually edited resources here... 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | -------------------------------------------------------------------------------- /HashEd-UTF8/res/HashEd.rc2: -------------------------------------------------------------------------------- 1 | // 2 | // HASHED.RC2 - resources Microsoft Visual C++ does not edit directly 3 | // 4 | 5 | #ifdef APSTUDIO_INVOKED 6 | #error this file is not editable by Microsoft Visual C++ 7 | #endif //APSTUDIO_INVOKED 8 | 9 | 10 | ///////////////////////////////////////////////////////////////////////////// 11 | // Add manually edited resources here... 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | -------------------------------------------------------------------------------- /ChewingServer/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "ChewingServer.h" 4 | 5 | 6 | int APIENTRY WinMain(HINSTANCE hInstance, 7 | HINSTANCE hPrevInstance, 8 | LPSTR lpCmdLine, 9 | int nCmdShow) 10 | { 11 | char classname[512]; 12 | _gen_event_name(classname, sizeof(classname), chewingServerClassName); 13 | if( FindWindow( classname, NULL) ) 14 | return -1; 15 | ChewingServer server; 16 | return ! server.run(); 17 | } 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /ChewingIME/CandWnd.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "IMEChildWnd.h" 4 | 5 | class IMCLock; 6 | class CandWnd : public IMEChildWnd 7 | { 8 | public: 9 | CandWnd(void); 10 | ~CandWnd(void); 11 | 12 | static BOOL registerClass(void); 13 | void setFont( HFONT f){ font = f; } 14 | protected: 15 | static LRESULT wndProc( HWND hwnd , UINT msg, WPARAM wp , LPARAM lp); 16 | void onPaint(HIMC hIMC, PAINTSTRUCT& ps); 17 | public: 18 | void getSize(int* w, int* h); 19 | void updateSize(void); 20 | bool create(HWND imeUIWnd); 21 | void UpdateFont(); 22 | 23 | HFONT font; 24 | int font_size; 25 | }; 26 | -------------------------------------------------------------------------------- /ChewingIME/Window.cpp: -------------------------------------------------------------------------------- 1 | // Window.cpp: implementation of the Window class. 2 | // 3 | ////////////////////////////////////////////////////////////////////// 4 | 5 | #include "Window.h" 6 | 7 | ////////////////////////////////////////////////////////////////////// 8 | // Construction/Destruction 9 | ////////////////////////////////////////////////////////////////////// 10 | 11 | Window::Window() 12 | { 13 | 14 | } 15 | 16 | Window::~Window() 17 | { 18 | if(hwnd) 19 | DestroyWindow(hwnd); 20 | } 21 | 22 | void Window::destroy(void) 23 | { 24 | if( hwnd ) 25 | DestroyWindow(hwnd); 26 | hwnd = NULL; 27 | } 28 | -------------------------------------------------------------------------------- /ChewingIME/IMCLock.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "imm.h" 5 | 6 | class CompStr; 7 | class CandList; 8 | 9 | class IMCLock 10 | { 11 | public: 12 | IMCLock(HIMC hIMC); 13 | ~IMCLock(void); 14 | protected: 15 | HIMC himc; 16 | INPUTCONTEXT* ic; 17 | CompStr* compStr; 18 | CandList* candList; 19 | public: 20 | CompStr* getCompStr(void); 21 | CandList* getCandList(void); 22 | INPUTCONTEXT* getIC(){ return ic; } 23 | HIMC getHIMC(){ return himc; } 24 | bool lock(void); 25 | void unlock(void); 26 | bool isChinese(void); 27 | bool isFullShape(void); 28 | bool isVerticalComp(void); 29 | }; 30 | -------------------------------------------------------------------------------- /ChewingIME/Tooltip.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "window.h" 3 | 4 | class Tooltip : 5 | public Window 6 | { 7 | public: 8 | Tooltip(void); 9 | virtual ~Tooltip(void); 10 | static BOOL registerClass(void); 11 | static void unregisterClass(); 12 | protected: 13 | LRESULT wndProc(UINT msg, WPARAM wp, LPARAM lp); 14 | static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp); 15 | public: 16 | void onPaint(PAINTSTRUCT& ps); 17 | void showTip(int x, int y, LPCWSTR tip_text, DWORD duration = 0); 18 | protected: 19 | UINT timerID; 20 | LPWSTR text; 21 | public: 22 | BOOL create(void); 23 | void hideTip(void); 24 | }; 25 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | 1. Server/Client --- Done 2 | 2. Support user defined phrases. --- Done 3 | 3. Better UI. --- Partially done 4 | 4. Let users change selection keys. 5 | 5. Let users change font and colors. 6 | 6. Add notification window? 7 | 7. Enable English mode by default or not should be an option. --- Done 8 | 8. Add a toggle key to switch between Chinese and English, 9 | may be we can use Shift key. --- Done 10 | 9. Better installer and uninstaller. 11 | 10.Save the position of status window. 12 | 11.The built-in phrases of libchewing should be fixed. 13 | 12.Type numbers directly using numpad. --- Partially done 14 | 13.Developer's Guide 15 | -------------------------------------------------------------------------------- /HashEd/HashEd.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 6.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "HashEd"=.\HashEd.dsp - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | }}} 15 | 16 | ############################################################################### 17 | 18 | Global: 19 | 20 | Package=<5> 21 | {{{ 22 | }}} 23 | 24 | Package=<3> 25 | {{{ 26 | }}} 27 | 28 | ############################################################################### 29 | 30 | -------------------------------------------------------------------------------- /HashEd-UTF8/HashEd.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 6.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "HashEd"=.\HashEd.dsp - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | }}} 15 | 16 | ############################################################################### 17 | 18 | Global: 19 | 20 | Package=<5> 21 | {{{ 22 | }}} 23 | 24 | Package=<3> 25 | {{{ 26 | }}} 27 | 28 | ############################################################################### 29 | 30 | -------------------------------------------------------------------------------- /HashEd/StdAfx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #if !defined(AFX_STDAFX_H__AFB27F37_FB8E_47A7_A476_A178D4AA2A58__INCLUDED_) 7 | #define AFX_STDAFX_H__AFB27F37_FB8E_47A7_A476_A178D4AA2A58__INCLUDED_ 8 | 9 | #if _MSC_VER > 1000 10 | #pragma once 11 | #endif // _MSC_VER > 1000 12 | 13 | #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | 20 | #endif // !defined(AFX_STDAFX_H__AFB27F37_FB8E_47A7_A476_A178D4AA2A58__INCLUDED_) 21 | -------------------------------------------------------------------------------- /Installer/Installer.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 6.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "Installer"=".\Installer.dsp" - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | }}} 15 | 16 | ############################################################################### 17 | 18 | Global: 19 | 20 | Package=<5> 21 | {{{ 22 | }}} 23 | 24 | Package=<3> 25 | {{{ 26 | }}} 27 | 28 | ############################################################################### 29 | 30 | -------------------------------------------------------------------------------- /HashEd-UTF8/StdAfx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #if !defined(AFX_STDAFX_H__AFB27F37_FB8E_47A7_A476_A178D4AA2A58__INCLUDED_) 7 | #define AFX_STDAFX_H__AFB27F37_FB8E_47A7_A476_A178D4AA2A58__INCLUDED_ 8 | 9 | #if _MSC_VER > 1000 10 | #pragma once 11 | #endif // _MSC_VER > 1000 12 | 13 | #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | 20 | #endif // !defined(AFX_STDAFX_H__AFB27F37_FB8E_47A7_A476_A178D4AA2A58__INCLUDED_) 21 | -------------------------------------------------------------------------------- /ChewingServer/ChewingServer.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 6.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "ChewingServer"=".\ChewingServer.dsp" - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | }}} 15 | 16 | ############################################################################### 17 | 18 | Global: 19 | 20 | Package=<5> 21 | {{{ 22 | }}} 23 | 24 | Package=<3> 25 | {{{ 26 | }}} 27 | 28 | ############################################################################### 29 | 30 | -------------------------------------------------------------------------------- /ChewingIME/CandList.cpp: -------------------------------------------------------------------------------- 1 | #include ".\candlist.h" 2 | 3 | CandList::CandList(void) 4 | { 5 | ci.dwSize = sizeof(CandList); 6 | ci.dwCount = 1; 7 | ci.dwOffset[0] = (DWORD) (size_t(&cl) - size_t(&ci)); 8 | ci.dwPrivateSize = 0; 9 | 10 | cl.dwSize = sizeof(cl)+sizeof(offset)+sizeof(candStr); 11 | cl.dwStyle = IME_CAND_READ; 12 | cl.dwCount = 0; 13 | cl.dwSelection = 0; 14 | cl.dwPageStart = 0; 15 | 16 | for( int i = 0; i <= (sizeof(offset)/sizeof(DWORD)); ++i ) 17 | { 18 | cl.dwOffset[i] = ((UINT_PTR)candStr[i] - (UINT_PTR)&cl); 19 | *candStr[i] = 0; 20 | } 21 | 22 | } 23 | 24 | CandList::~CandList(void) 25 | { 26 | } 27 | 28 | void CandList::setCand( int i, LPCWSTR cand ) 29 | { 30 | wcscpy( candStr[i], cand ); 31 | } 32 | 33 | -------------------------------------------------------------------------------- /ChewingIME/IMEUILock.cpp: -------------------------------------------------------------------------------- 1 | #include ".\imeuilock.h" 2 | #include "IMEUI.h" 3 | 4 | IMEUILock::IMEUILock(HWND hIMEUIWnd) : ui(NULL), hUIWnd(hIMEUIWnd) 5 | { 6 | hIMEUI = (HGLOBAL)GetWindowLong(hUIWnd, IMMGWL_PRIVATE); 7 | } 8 | 9 | IMEUILock::~IMEUILock(void) 10 | { 11 | if( ui ) 12 | GlobalUnlock(hIMEUI); 13 | } 14 | 15 | IMEUI* IMEUILock::getIMEUI() 16 | { 17 | if( ui ) 18 | return ui; 19 | ui = (IMEUI*)GlobalLock(hIMEUI); 20 | return ui; 21 | } 22 | 23 | 24 | 25 | IMEUI* IMEUILock::createIMEUI(void) 26 | { 27 | hIMEUI = GlobalAlloc(GHND, sizeof(IMEUI)); 28 | SetWindowLong(hUIWnd, IMMGWL_PRIVATE, (UINT_PTR)hIMEUI ); 29 | ui = (IMEUI*)GlobalLock(hIMEUI); 30 | if( ui ) 31 | return new(ui) IMEUI(hUIWnd); // placement new 32 | return NULL; 33 | } 34 | -------------------------------------------------------------------------------- /HashEd-UTF8/HashEd.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 5 | 10 | Hash Editor 11 | 12 | 13 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /OnlineUpdate/Update.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 5 | 10 | Update Notifier for Win32 Chewing 11 | 12 | 13 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /ChewingIME/IMEChildWnd.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "imm.h" 5 | #include "window.h" 6 | 7 | class IMEChildWnd : virtual public Window 8 | { 9 | public: 10 | IMEChildWnd(); 11 | virtual ~IMEChildWnd(void); 12 | 13 | virtual void getSize(int* w, int* h){ *w=0; *h=0; } 14 | HIMC getIMC(){ return (HIMC)GetWindowLong( GetParent(hwnd), IMMGWL_IMC ); } 15 | static HIMC getIMC(HWND hwnd){ return (HIMC)GetWindowLong( GetParent(hwnd), IMMGWL_IMC ); } 16 | void move(int x, int y); 17 | // static IMEChildWnd* getAssocWndObj(HWND hwnd); 18 | protected: 19 | POINTS oldPos; 20 | // void assocWndObj(void); 21 | protected: 22 | void onLButtonDown(WPARAM wp, LPARAM lp); 23 | void onLButtonUp(WPARAM wp, LPARAM lp); 24 | void onMouseMove(WPARAM wp, LPARAM lp); 25 | public: 26 | virtual bool create(HWND imeUIWnd) = 0; 27 | }; 28 | -------------------------------------------------------------------------------- /ChewingIME/CandList.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include "imm.h" 6 | 7 | class CandList 8 | { 9 | public: 10 | CandList(void); 11 | ~CandList(void); 12 | void setTotalCount(int c){ cl.dwCount = c; } 13 | int getTotalCount(){ return cl.dwCount; } 14 | void setPageSize(int s){ cl.dwPageSize = s; } 15 | int getPageSize(){ return cl.dwPageSize; } 16 | void setPageStart(int i){ cl.dwPageStart = i; } 17 | void setSelection( int i ) { cl.dwSelection = i; } 18 | int getSelection() { return cl.dwSelection; } 19 | int getPageStart(){ return cl.dwPageStart; } 20 | void setCand(int i, LPCWSTR cand); 21 | LPCWSTR getCand(int i){ return candStr[i]; } 22 | protected: 23 | CANDIDATEINFO ci; 24 | CANDIDATELIST cl; 25 | DWORD offset[1024-1]; 26 | wchar_t candStr[1024][12]; // unicode string 27 | }; 28 | -------------------------------------------------------------------------------- /HashEd/HashEd.h: -------------------------------------------------------------------------------- 1 | // HashEd.h : main header file for the HASHED application 2 | // 3 | 4 | #if !defined(AFX_HASHED_H__69C59549_6152_4802_A835_892AD84C996D__INCLUDED_) 5 | #define AFX_HASHED_H__69C59549_6152_4802_A835_892AD84C996D__INCLUDED_ 6 | 7 | #if _MSC_VER > 1000 8 | #pragma once 9 | #endif // _MSC_VER > 1000 10 | 11 | #include "stdafx.h" 12 | 13 | #include "resource.h" // main symbols 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | // CHashEdApp: 17 | // See HashEd.cpp for the implementation of this class 18 | // 19 | 20 | ///////////////////////////////////////////////////////////////////////////// 21 | 22 | //{{AFX_INSERT_LOCATION}} 23 | // Microsoft Visual C++ will insert additional declarations immediately before the previous line. 24 | 25 | #endif // !defined(AFX_HASHED_H__69C59549_6152_4802_A835_892AD84C996D__INCLUDED_) 26 | -------------------------------------------------------------------------------- /HashEd-UTF8/HashEd.h: -------------------------------------------------------------------------------- 1 | // HashEd.h : main header file for the HASHED application 2 | // 3 | 4 | #if !defined(AFX_HASHED_H__69C59549_6152_4802_A835_892AD84C996D__INCLUDED_) 5 | #define AFX_HASHED_H__69C59549_6152_4802_A835_892AD84C996D__INCLUDED_ 6 | 7 | #if _MSC_VER > 1000 8 | #pragma once 9 | #endif // _MSC_VER > 1000 10 | 11 | #include "stdafx.h" 12 | 13 | #include "resource.h" // main symbols 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | // CHashEdApp: 17 | // See HashEd.cpp for the implementation of this class 18 | // 19 | 20 | ///////////////////////////////////////////////////////////////////////////// 21 | 22 | //{{AFX_INSERT_LOCATION}} 23 | // Microsoft Visual C++ will insert additional declarations immediately before the previous line. 24 | 25 | #endif // !defined(AFX_HASHED_H__69C59549_6152_4802_A835_892AD84C996D__INCLUDED_) 26 | -------------------------------------------------------------------------------- /Include/pipe.h: -------------------------------------------------------------------------------- 1 | #ifndef _LIBCHEWING_WIN32_PIPE_IMPLEMENT_ 2 | #define _LIBCHEWING_WIN32_PIPE_IMPLEMENT_ 3 | 4 | 5 | #include 6 | 7 | 8 | 9 | class ChewingPipeServ 10 | { 11 | public: 12 | BOOL fetch(); 13 | 14 | BOOL read(); 15 | 16 | BOOL reply(unsigned int dat); 17 | 18 | BOOL get_param(unsigned int &session, unsigned int &cmd, unsigned int &dat); 19 | 20 | void disconnect(); 21 | 22 | ChewingPipeServ(); 23 | ~ChewingPipeServ(); 24 | 25 | private: 26 | unsigned int _d[3]; 27 | unsigned int _szd; 28 | HANDLE _h; 29 | }; 30 | 31 | 32 | 33 | class ChewingPipeClnt 34 | { 35 | public: 36 | unsigned int SendMessageReply(unsigned int session, unsigned int cmd, unsigned int dat); 37 | 38 | ChewingPipeClnt(); 39 | ~ChewingPipeClnt(); 40 | 41 | private: 42 | char _n[MAX_PATH]; 43 | HANDLE _h; 44 | }; 45 | 46 | 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /ChewingIME/ChewingIME.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 6.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "ChewingIME"=".\ChewingIME.dsp" - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | }}} 15 | 16 | ############################################################################### 17 | 18 | Project: "ChewingServer"=".\ChewingServer\ChewingServer.dsp" - Package Owner=<4> 19 | 20 | Package=<5> 21 | {{{ 22 | }}} 23 | 24 | Package=<4> 25 | {{{ 26 | }}} 27 | 28 | ############################################################################### 29 | 30 | Global: 31 | 32 | Package=<5> 33 | {{{ 34 | }}} 35 | 36 | Package=<3> 37 | {{{ 38 | }}} 39 | 40 | ############################################################################### 41 | 42 | -------------------------------------------------------------------------------- /OnlineUpdate/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by OnlineUpdate.rc 4 | // 5 | #define IDD_POPUP 101 6 | #define IDR_RT_MANIFEST1 102 7 | #define IDI_ICON1 104 8 | #define IDI_ICON 104 9 | #define IDC_CHANGELOG 1001 10 | #define IDC_WEBPAGE 1002 11 | #define IDC_VERSION 1003 12 | #define IDC_TITLE 1004 13 | #define IDC_INFOICON 1005 14 | #define IDC_RELEASEDTIME 1006 15 | 16 | // Next default values for new objects 17 | // 18 | #ifdef APSTUDIO_INVOKED 19 | #ifndef APSTUDIO_READONLY_SYMBOLS 20 | #define _APS_NEXT_RESOURCE_VALUE 105 21 | #define _APS_NEXT_COMMAND_VALUE 40001 22 | #define _APS_NEXT_CONTROL_VALUE 1006 23 | #define _APS_NEXT_SYMED_VALUE 101 24 | #endif 25 | #endif 26 | -------------------------------------------------------------------------------- /ChewingIME/StatusWnd.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "IMEChildWnd.h" 4 | #include "XPToolbar.h" 5 | 6 | class StatusWnd : public IMEChildWnd, public XPToolbar 7 | { 8 | public: 9 | StatusWnd(); 10 | ~StatusWnd(void); 11 | static BOOL registerClass(void); 12 | protected: 13 | // HWND toolbar; 14 | static LRESULT wndProc( HWND hwnd , UINT msg, WPARAM wp , LPARAM lp); 15 | // void onPaint(PAINTSTRUCT& ps); 16 | 17 | public: 18 | protected: 19 | void onCommand(UINT id, HIMC hIMC); 20 | HICON iconChi; 21 | HICON iconEng; 22 | HICON iconFull; 23 | HICON iconHalf; 24 | HICON iconConfig; 25 | bool dragging; 26 | LRESULT wndProc(UINT msg, WPARAM wp, LPARAM lp); 27 | public: 28 | virtual void getSize(int* w, int* h); 29 | bool create(HWND imeUIWnd); 30 | void enableChiEng(bool enable=true); 31 | void disableChiEng(){ enableChiEng(false); } 32 | void toggleChiEngMode(HIMC hIMC); 33 | void toggleShapeMode(HIMC hIMC); 34 | void updateIcons(HIMC hIMC); 35 | }; 36 | -------------------------------------------------------------------------------- /Installer/Resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Installer.rc 4 | // 5 | #define IDC_MYICON 2 6 | #define IDD_INSTALLER_DIALOG 102 7 | #define IDS_APP_TITLE 103 8 | #define IDM_ABOUT 104 9 | #define IDM_EXIT 105 10 | #define IDI_INSTALLER 107 11 | #define IDI_SMALL 108 12 | #define IDC_INSTALLER 109 13 | #define IDR_MAINFRAME 128 14 | #define IDC_STATIC -1 15 | 16 | // Next default values for new objects 17 | // 18 | #ifdef APSTUDIO_INVOKED 19 | #ifndef APSTUDIO_READONLY_SYMBOLS 20 | #define _APS_NO_MFC 1 21 | #define _APS_NEXT_RESOURCE_VALUE 129 22 | #define _APS_NEXT_COMMAND_VALUE 32771 23 | #define _APS_NEXT_CONTROL_VALUE 1000 24 | #define _APS_NEXT_SYMED_VALUE 110 25 | #endif 26 | #endif 27 | -------------------------------------------------------------------------------- /ChewingIME/Window.h: -------------------------------------------------------------------------------- 1 | // Window.h: interface for the Window class. 2 | // 3 | ////////////////////////////////////////////////////////////////////// 4 | 5 | #if !defined(AFX_WINDOW_H__86D89A4E_5040_4FF8_B991_0C7D6502119D__INCLUDED_) 6 | #define AFX_WINDOW_H__86D89A4E_5040_4FF8_B991_0C7D6502119D__INCLUDED_ 7 | 8 | #if _MSC_VER > 1000 9 | #pragma once 10 | #endif // _MSC_VER > 1000 11 | 12 | #include 13 | 14 | class Window 15 | { 16 | public: 17 | Window(); 18 | virtual ~Window(); 19 | 20 | HWND getHwnd(){ return hwnd; } 21 | void destroy(void); 22 | BOOL isVisible(){ return IsWindowVisible(hwnd); } 23 | BOOL isWindow(){ return IsWindow(hwnd); } 24 | void show() 25 | { 26 | if( hwnd ) 27 | ShowWindow(hwnd, SW_SHOWNA); 28 | } 29 | void hide(){ ShowWindow(hwnd, SW_HIDE); } 30 | void refresh() { InvalidateRect( hwnd, NULL, FALSE ); } 31 | 32 | protected: 33 | HWND hwnd; 34 | 35 | }; 36 | 37 | #endif // !defined(AFX_WINDOW_H__86D89A4E_5040_4FF8_B991_0C7D6502119D__INCLUDED_) 38 | -------------------------------------------------------------------------------- /HashEd/HashEd.cpp: -------------------------------------------------------------------------------- 1 | // HashEd.cpp : Defines the class behaviors for the application. 2 | // 3 | 4 | #include "stdafx.h" 5 | #include "HashEd.h" 6 | #include "HashEdDlg.h" 7 | 8 | #ifdef _DEBUG 9 | #define new DEBUG_NEW 10 | #undef THIS_FILE 11 | static char THIS_FILE[] = __FILE__; 12 | #endif 13 | 14 | ///////////////////////////////////////////////////////////////////////////// 15 | // CHashEdApp 16 | 17 | ///////////////////////////////////////////////////////////////////////////// 18 | // CHashEdApp initialization 19 | 20 | int WINAPI WinMain( HINSTANCE hinst, HINSTANCE hprev, LPSTR lpcmd, int nShow ) 21 | { 22 | InitCommonControls(); 23 | 24 | CHashEdDlg dlg; 25 | int nResponse = dlg.DoModal(); 26 | if (nResponse == IDOK) 27 | { 28 | // TODO: Place code here to handle when the dialog is 29 | // dismissed with OK 30 | } 31 | else if (nResponse == IDCANCEL) 32 | { 33 | // TODO: Place code here to handle when the dialog is 34 | // dismissed with Cancel 35 | } 36 | return 0; 37 | }; 38 | -------------------------------------------------------------------------------- /ChewingIME/CompWnd.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "IMEChildWnd.h" 4 | #include "IMCLock.h" 5 | 6 | #include 7 | 8 | using namespace std; 9 | 10 | class CompWnd : public IMEChildWnd 11 | { 12 | public: 13 | CompWnd(void); 14 | ~CompWnd(void); 15 | static BOOL registerClass(void); 16 | protected: 17 | static LRESULT wndProc( HWND hwnd , UINT msg, WPARAM wp , LPARAM lp); 18 | int indexToXPos( wstring compStr, int idx); 19 | void onPaint(IMCLock& imc, PAINTSTRUCT& ps); 20 | HFONT font; 21 | public: 22 | void setFont(LOGFONT* lf); 23 | HFONT getFont(){ return font; } 24 | void getSize(int* w, int* h); 25 | wstring getDisplayedCompStr(IMCLock& imc); 26 | wstring getDisplayedZuin( IMCLock& imc ); 27 | int getDisplayedCursorPos(IMCLock& imc); 28 | wstring getDisplayedCompStr(){ return getDisplayedCompStr(IMCLock(getIMC())); } 29 | int getDisplayedCursorPos(){ return getDisplayedCursorPos(IMCLock(getIMC())); } 30 | public: 31 | bool create(HWND imeUIWnd); 32 | void getRelativeCandPos(IMCLock& imc, POINT* pt); 33 | void getCandPos(IMCLock& imc, POINT* pt); 34 | DWORD* getIntervalAry( IMCLock& imc, DWORD& count ); 35 | }; 36 | -------------------------------------------------------------------------------- /HashEd-UTF8/HashEd.cpp: -------------------------------------------------------------------------------- 1 | // HashEd.cpp : Defines the class behaviors for the application. 2 | // 3 | 4 | #include "stdafx.h" 5 | #include "HashEd.h" 6 | #include "HashEdDlg.h" 7 | 8 | #include "PhraseList.h" 9 | 10 | #ifdef _DEBUG 11 | #define new DEBUG_NEW 12 | #undef THIS_FILE 13 | static char THIS_FILE[] = __FILE__; 14 | #endif 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | // CHashEdApp 18 | 19 | ///////////////////////////////////////////////////////////////////////////// 20 | // CHashEdApp initialization 21 | 22 | int WINAPI WinMain( HINSTANCE hinst, HINSTANCE hprev, LPSTR lpcmd, int nShow ) 23 | { 24 | InitCommonControls(); 25 | 26 | // Init RichEdit 2.0 27 | HMODULE riched20 = LoadLibraryA("RICHED20.DLL"); 28 | 29 | // Init Phrase List Control 30 | CPhraseList::init(); 31 | 32 | CHashEdDlg dlg; 33 | int nResponse = dlg.DoModal(); 34 | if (nResponse == IDOK) 35 | { 36 | // TODO: Place code here to handle when the dialog is 37 | // dismissed with OK 38 | } 39 | else if (nResponse == IDCANCEL) 40 | { 41 | // TODO: Place code here to handle when the dialog is 42 | // dismissed with Cancel 43 | } 44 | 45 | FreeLibrary( riched20 ); 46 | return 0; 47 | }; 48 | -------------------------------------------------------------------------------- /ChewingIME/IMEUI.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "CompWnd.h" 6 | #include "CandWnd.h" 7 | #include "StatusWnd.h" 8 | #include "Tooltip.h" 9 | 10 | class IMEUI 11 | { 12 | public: 13 | IMEUI(HWND hUIWnd); 14 | ~IMEUI(void); 15 | 16 | CompWnd compWnd; 17 | CandWnd candWnd; 18 | StatusWnd statusWnd; 19 | Tooltip tooltip; 20 | HWND hwnd; 21 | POINT fixedCompWndPos; 22 | 23 | static BOOL IMEUI::registerUIClasses(); 24 | protected: 25 | static LRESULT CALLBACK wndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ); 26 | LRESULT onIMENotify( HIMC hIMC, WPARAM wp , LPARAM lp ); 27 | LRESULT wndProc( UINT msg, WPARAM wp, LPARAM lp); 28 | 29 | void closeStatusWnd(void); 30 | void openStatusWnd(HIMC hIMC); 31 | void openCandWnd(void); 32 | void closeCandWnd(void); 33 | 34 | public: 35 | static void unregisterUIClasses(); 36 | static bool getWorkingArea(RECT* rc, HWND app_wnd); 37 | LRESULT onComposition(HIMC hIMC, WPARAM wp , LPARAM lp); 38 | POINT getCompWndPos(IMCLock& imc); 39 | // void setCompWndPos(IMCLock& imc); 40 | POINT getCandWndPos(IMCLock& imc); 41 | HIMC getIMC(){ return (HIMC)GetWindowLong( hwnd, IMMGWL_IMC ); } 42 | protected: 43 | void showCandWnd(void); 44 | public: 45 | void showUserNotify(IMCLock& imc); 46 | }; 47 | 48 | -------------------------------------------------------------------------------- /nsis/translations/english.nsh: -------------------------------------------------------------------------------- 1 | !ifdef CURLANG 2 | !undef CURLANG 3 | !endif 4 | !define CURLANG ${LANG_ENGLISH} 5 | 6 | !insertmacro CHEWING_LANG_BEGIN 7 | 8 | LicenseLangString LICENSE_FILE ${CURLANG} "License.txt" 9 | 10 | LangString NAME ${CURLANG} "New Chewing ${PRODUCT_VERSION}" 11 | 12 | LangString DETECTED_OLD_VERSION ${CURLANG} "Old version already installed" 13 | LangString REINSTALL_CONFIRM ${CURLANG} ", do you want to uninstall old version?" 14 | 15 | LangString VISIT_WEBSITE ${CURLANG} "Visit New Chewing web site: " 16 | 17 | LangString INSTALL_FAIL ${CURLANG} "Install failed. Please make sure you have administrator privilege and old version is not in use.$\n$\nYou can uninstall old version from Control Panel and try to install again." 18 | 19 | LangString UNINSTALL_SUCCESS ${CURLANG} "Uninstall $(^Name) successful" 20 | LangString UNINSTALL_CONFIRM ${CURLANG} "Are you sure to uninstall $(^Name) and all its components?" 21 | 22 | LangString STARTMENU_FOLDER_NAME ${CURLANG} "New Chewing" 23 | LangString LNK_USER_MANUAL ${CURLANG} "User Manual" 24 | LangString LNK_DB_EDITOR ${CURLANG} "User word database edit tool" 25 | LangString LNK_UPDATE_CHECKER ${CURLANG} "Online Update" 26 | LangString LNK_UNINSTALL ${CURLANG} "Uninstall" 27 | 28 | !insertmacro CHEWING_LANG_END 29 | -------------------------------------------------------------------------------- /win32chewing.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 6.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "ChewingIME"=".\ChewingIME\ChewingIME.dsp" - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | Begin Project Dependency 15 | Project_Dep_Name ChewingServer 16 | End Project Dependency 17 | }}} 18 | 19 | ############################################################################### 20 | 21 | Project: "ChewingServer"=".\ChewingServer\ChewingServer.dsp" - Package Owner=<4> 22 | 23 | Package=<5> 24 | {{{ 25 | }}} 26 | 27 | Package=<4> 28 | {{{ 29 | }}} 30 | 31 | ############################################################################### 32 | 33 | Project: "HashEd"=".\HashEd\HashEd.dsp" - Package Owner=<4> 34 | 35 | Package=<5> 36 | {{{ 37 | }}} 38 | 39 | Package=<4> 40 | {{{ 41 | }}} 42 | 43 | ############################################################################### 44 | 45 | Global: 46 | 47 | Package=<5> 48 | {{{ 49 | }}} 50 | 51 | Package=<3> 52 | {{{ 53 | }}} 54 | 55 | ############################################################################### 56 | 57 | -------------------------------------------------------------------------------- /HashEd/hash.h: -------------------------------------------------------------------------------- 1 | /** 2 | * hash.h 3 | * 4 | * Copyright (c) 1999, 2000, 2001 5 | * Lu-chuan Kung and Kang-pen Chen. 6 | * All rights reserved. 7 | * 8 | * Copyright (c) 2004 9 | * libchewing Core Team. See ChangeLog for details. 10 | * 11 | * See the file "COPYING" for information on usage and redistribution 12 | * of this file. 13 | */ 14 | 15 | #ifndef HASH_H 16 | #define HASH_H 17 | #include "global.h" 18 | #include "userphrase.h" 19 | 20 | #define FIELD_SIZE (125) 21 | #define N_HASH_BIT (14) 22 | #define HASH_FILE "hash.dat" 23 | #define HASH_TABLE_SIZE (1< 2 | 3 | void SetKeyboardLayout(int kb); 4 | void SetHsuSelectionKeyType(int type); 5 | 6 | // Debugging-only retuine. 7 | void Dump(); 8 | 9 | int Space(); 10 | int Esc(); 11 | int Enter(); 12 | int Delete(); 13 | int Backspace(); 14 | int Tab(); 15 | int ShiftLeft(); 16 | int ShiftRight(); 17 | int ShiftSpace(); 18 | int Right(); 19 | int Left(); 20 | int Up(); 21 | int Down(); 22 | int Home(); 23 | int End(); 24 | int Capslock(); 25 | int Key(unsigned int code); 26 | int CtrlNum(unsigned int code); 27 | int CtrlOption(unsigned int code); 28 | int DoubleTab(); 29 | 30 | // Return the i-th selection key, i >= 0. 31 | char SelKey(int i); 32 | void SelKey(char* selkey); 33 | 34 | char* ZuinStr(); 35 | char* CommitStr(); 36 | char* CommitStr(int from); 37 | char* CommitStr(int from, int to); 38 | int CommitReady(); 39 | 40 | char* Buffer(); 41 | char* Buffer(int from); 42 | char* Buffer(int from,int to); 43 | int BufferLen(); 44 | 45 | int CursorPos(); 46 | int PointStart(); 47 | int PointEnd(); 48 | int KeystrokeRtn(); 49 | int KeystrokeIgnore(); 50 | 51 | int ChineseMode(); 52 | 53 | // CandidateWindow-related routines 54 | int Candidate(); 55 | int ChoicePerPage(); 56 | int TotalChoice(); 57 | int TotalPage(); 58 | int CurrentPage(); 59 | 60 | // Return the i-th selection wchar, i >= 0. 61 | char* Selection(int i); 62 | void SetFullShape(bool full); 63 | bool GetFullShape(void); 64 | -------------------------------------------------------------------------------- /ChewingIME/DrawUtil.cpp: -------------------------------------------------------------------------------- 1 | #include "DrawUtil.h" 2 | 3 | void FillSolidRect( HDC dc, LPRECT rc, COLORREF color ) 4 | { 5 | SetBkColor( dc, color ); 6 | ::ExtTextOut(dc, 0, 0, ETO_OPAQUE, rc, NULL, 0, NULL); 7 | } 8 | 9 | void FillSolidRect( HDC dc, int l, int t, int w, int h, COLORREF color ) 10 | { 11 | RECT rc; 12 | rc.left = l; 13 | rc.top = t; 14 | rc.right = rc.left + w; 15 | rc.bottom = rc.top + h; 16 | SetBkColor( dc, color ); 17 | ::ExtTextOut(dc, 0, 0, ETO_OPAQUE, &rc, NULL, 0, NULL); 18 | } 19 | 20 | void Draw3DBorder(HDC hdc, LPRECT rc, COLORREF light, COLORREF dark, int width) 21 | { 22 | MoveToEx( hdc, rc->left, rc->bottom, NULL); 23 | 24 | HPEN light_pen = CreatePen( PS_SOLID|PS_INSIDEFRAME, width, light ); 25 | HGDIOBJ oldPen = SelectObject( hdc, light_pen ); 26 | LineTo( hdc, rc->left, rc->top ); 27 | LineTo( hdc, rc->right-width, rc->top ); 28 | SelectObject( hdc, oldPen ); 29 | DeleteObject( light_pen ); 30 | 31 | HPEN dark_pen = CreatePen( PS_SOLID|PS_INSIDEFRAME, width, dark ); 32 | oldPen = SelectObject( hdc, dark_pen ); 33 | LineTo( hdc, rc->right-width, rc->bottom-width ); 34 | LineTo( hdc, rc->left, rc->bottom-width ); 35 | DeleteObject( dark_pen ); 36 | SelectObject( hdc, oldPen ); 37 | } 38 | 39 | void DrawBitmap(HDC dc, HBITMAP bmp, int x, int y, int w, int h, int srcx, int srcy ) 40 | { 41 | HDC memdc = CreateCompatibleDC(dc); 42 | HGDIOBJ oldobj = SelectObject( memdc, bmp ); 43 | BitBlt( dc, x, y, w, h, memdc, srcx, srcy, SRCCOPY); 44 | SelectObject(memdc, oldobj ); 45 | DeleteDC(memdc); 46 | } -------------------------------------------------------------------------------- /ChewingIME/IMCLock.cpp: -------------------------------------------------------------------------------- 1 | #include ".\imclock.h" 2 | 3 | IMCLock::IMCLock(HIMC hIMC) 4 | : himc(hIMC), ic(NULL), compStr(NULL), candList(NULL) 5 | { 6 | lock(); 7 | } 8 | 9 | IMCLock::~IMCLock(void) 10 | { 11 | unlock(); 12 | } 13 | 14 | CompStr* IMCLock::getCompStr(void) 15 | { 16 | if( compStr ) 17 | return compStr; 18 | if( ic ) 19 | return (CompStr*)ImmLockIMCC(ic->hCompStr); 20 | return NULL; 21 | } 22 | 23 | CandList* IMCLock::getCandList(void) 24 | { 25 | if( candList ) 26 | return candList; 27 | if( ic ) 28 | return (CandList*)ImmLockIMCC(ic->hCandInfo); 29 | return NULL; 30 | } 31 | 32 | 33 | bool IMCLock::lock(void) 34 | { 35 | if( !ic ) 36 | ic = himc ? ImmLockIMC(himc) : NULL; 37 | return !!ic; 38 | } 39 | 40 | void IMCLock::unlock(void) 41 | { 42 | if( ic ) 43 | { 44 | if( compStr ) 45 | { 46 | ImmUnlockIMCC(ic->hCompStr); 47 | compStr = NULL; 48 | } 49 | if( candList ) 50 | { 51 | ImmUnlockIMCC(ic->hCandInfo); 52 | candList = NULL; 53 | } 54 | ImmUnlockIMC(himc); 55 | ic = NULL; 56 | } 57 | } 58 | 59 | bool IMCLock::isChinese(void) 60 | { 61 | INPUTCONTEXT* ic = getIC(); 62 | if(ic) 63 | return !!(ic->fdwConversion & IME_CMODE_CHINESE ); 64 | return false; 65 | } 66 | 67 | bool IMCLock::isFullShape(void) 68 | { 69 | INPUTCONTEXT* ic = getIC(); 70 | if(ic) 71 | return !!(ic->fdwConversion & IME_CMODE_FULLSHAPE ); 72 | 73 | return false; 74 | } 75 | 76 | 77 | bool IMCLock::isVerticalComp(void) 78 | { 79 | return ( getIC() && ((LOGFONT&)ic->lfFont).lfEscapement == 2700 ); 80 | } 81 | -------------------------------------------------------------------------------- /big52utf8/big52utf8.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | // lpCmd: file to convert 5 | int WINAPI WinMain(HINSTANCE hinst, HINSTANCE hprev, LPSTR lpCmd, int nShow ) 6 | { 7 | HANDLE hHashFile = CreateFile( lpCmd, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL ); 8 | if( hHashFile == INVALID_HANDLE_VALUE ) 9 | return 0; /* absence of hash.dat simply means "nothing", 10 | and should not rise an error to NSIS. */ 11 | 12 | DWORD size = GetFileSize( hHashFile, NULL ); 13 | DWORD buflen = (size * 3 / 2) + 1; 14 | char *buf = new char[ buflen ]; 15 | if( buf ) { 16 | if( ReadFile( hHashFile, buf, size, &size, NULL ) ) { 17 | CloseHandle( hHashFile ); 18 | 19 | DWORD usize = MultiByteToWideChar( 950, 0, buf, size + 1, NULL, 0 ); 20 | wchar_t* ubuf = new wchar_t[usize]; 21 | if( ubuf ) { 22 | usize = MultiByteToWideChar( 950, 0, buf, size + 1, ubuf, usize ); 23 | size = WideCharToMultiByte( CP_UTF8, 0, ubuf, usize, NULL, 0, NULL, NULL ); 24 | if ( buf!=NULL ) { 25 | delete [] buf; 26 | buf = new char[size+1]; 27 | } 28 | size = WideCharToMultiByte( CP_UTF8, 0, ubuf, usize, buf, size, NULL, NULL ); 29 | 30 | TCHAR* name = _tcsrchr( lpCmd, '\\' ); 31 | if( name ) 32 | strcpy( (name + 1), _T("uhash.dat") ); 33 | 34 | hHashFile = CreateFile( lpCmd, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, 0, NULL ); 35 | if( hHashFile != INVALID_HANDLE_VALUE ) { 36 | WriteFile( hHashFile, buf, size, &size, NULL ); 37 | CloseHandle( hHashFile ); 38 | } 39 | delete []ubuf; 40 | } 41 | } 42 | delete []buf; 43 | } 44 | return 0; 45 | } 46 | 47 | -------------------------------------------------------------------------------- /HashEd-UTF8/PhraseList.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | // This class is used to replace list view provided by Windows 10 | 11 | class CPhraseList 12 | { 13 | public: 14 | CPhraseList(void); 15 | ~CPhraseList(void); 16 | static BOOL init(void); 17 | static CPhraseList* fromHandle(HWND hwnd){ return (CPhraseList*)GetWindowLongPtr(hwnd, GWL_USERDATA); } 18 | HWND getHwnd() { return hwnd; } 19 | int itemFromPoint( int x, int y ); 20 | void setCurSel(int idx); 21 | int getCurSel(void); 22 | int count(void); 23 | void insertItem( int pos, std::wstring text, void* user_data ); 24 | std::wstring getItemText( int idx ); 25 | void* getItemData( int idx ); 26 | void deleteItem( int idx ); 27 | void clear(void); 28 | void getItemRect( int idx, RECT& rc ); 29 | 30 | void lockUpdate(void); 31 | void unlockUpdate(void); 32 | 33 | protected: 34 | LRESULT CPhraseList::wndProc( UINT msg, WPARAM wp, LPARAM lp ); 35 | static LRESULT wndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp); 36 | void onSize( WPARAM wp, long cx, long cy ); 37 | void onVScroll( int code, int pos ); 38 | void onPaint(void); 39 | void onLButtonDown(WPARAM wp, int x, int y); 40 | void recalcLayout(void); 41 | void onSetFont(HFONT hfont); 42 | void onMouseWheel(int delta); 43 | bool onKeyDown(int key, LPARAM lp); 44 | 45 | protected: 46 | HWND hwnd; 47 | int sel; // Current selected item; 48 | int itemsPerRow; 49 | int lineCount; 50 | std::vector< std::pair > data; 51 | bool lock; 52 | int itemHeight; 53 | HFONT font; 54 | public: 55 | void ensureItemVisible(int idx); 56 | }; 57 | 58 | -------------------------------------------------------------------------------- /HashEd/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Developer Studio generated include file. 3 | // Used by HashEd.rc 4 | // 5 | #define IDM_ABOUTBOX 0x0010 6 | #define IDD_ABOUTBOX 100 7 | #define IDS_ABOUTBOX 101 8 | #define IDD_HASHED_DIALOG 102 9 | #define IDS_ALLOW_CHI_STRING 102 10 | #define IDS_INPUT_RULE 103 11 | #define IDS_PHRASE_EXIST 104 12 | #define IDS_SAVE_CONFIRM 105 13 | #define IDS_SAVE_BTN_FACE 106 14 | #define IDS_NUM_OF_PHRASES 107 15 | #define IDS_LOADING 108 16 | #define IDS_SUGGEST_DO_SAVE 109 17 | #define IDB_COOL 122 18 | #define IDR_MAINFRAME 128 19 | #define IDC_PHRASE_LIST 1001 20 | #define IDC_NEW_PHRASE_EDIT 1002 21 | #define IDC_ADD_PHRASE 1003 22 | #define IDC_DEL_PHRASE 1004 23 | #define IDC_FIND_PHRASE 1005 24 | #define IDC_IMPORT 1006 25 | #define IDC_IMPORT2 1007 26 | #define IDC_SAVE 1007 27 | #define IDC_SAVE_AS 1008 28 | #define IDC_ABOUT 1009 29 | #define IDC_BANNER 1010 30 | 31 | // Next default values for new objects 32 | // 33 | #ifdef APSTUDIO_INVOKED 34 | #ifndef APSTUDIO_READONLY_SYMBOLS 35 | #define _APS_NEXT_RESOURCE_VALUE 129 36 | #define _APS_NEXT_COMMAND_VALUE 32771 37 | #define _APS_NEXT_CONTROL_VALUE 1011 38 | #define _APS_NEXT_SYMED_VALUE 101 39 | #endif 40 | #endif 41 | -------------------------------------------------------------------------------- /ChewingIME/CompStr.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include "imm.h" 6 | 7 | class CompStr 8 | { 9 | public: 10 | CompStr(void); 11 | ~CompStr(void); 12 | protected: 13 | COMPOSITIONSTRING cs; 14 | wchar_t readStr[256]; // unicode string 15 | BYTE readAttr[ 256/sizeof(TCHAR) ]; 16 | DWORD readClause[2]; 17 | 18 | wchar_t compStr[256]; // unicode string 19 | BYTE compAttr[ 256/sizeof(TCHAR) ]; 20 | DWORD compClause[257]; 21 | 22 | wchar_t resultReadStr[256]; // unicode string 23 | DWORD resultReadClause[2]; 24 | 25 | wchar_t resultStr[256]; // unicode string 26 | DWORD resultClause[257]; 27 | 28 | // private data; 29 | wchar_t showMsg[50]; 30 | 31 | // for IE workaround 32 | DWORD bakCompStrLen; 33 | DWORD bakCompClauseLen; 34 | DWORD bakCompAttrLen; 35 | DWORD bakCompReadStrLen; 36 | DWORD bakCompReadClauseLen; 37 | DWORD bakCompReadAttrLen; 38 | DWORD bakCursorPos; 39 | 40 | public: 41 | wchar_t* getCompStr() { return &compStr[0]; } 42 | wchar_t* getResultStr() { return &resultStr[0]; } 43 | wchar_t* getShowMsg() { return &showMsg[0]; } 44 | wchar_t* getZuin() { return &readStr[0]; } 45 | DWORD getCursorPos() { return cs.dwCursorPos; } 46 | void setCompStr(LPCWSTR comp_str); 47 | void setResultStr(LPCWSTR result_str); 48 | void setShowMsg(LPCWSTR show_msg); 49 | void setCursorPos(int pos); 50 | void setZuin(LPCWSTR zuin); 51 | void beforeGenerateMsg(void); 52 | void setIntervalArray( unsigned char* interval, int count ); 53 | DWORD* getIntervalArray() { return compClause; } 54 | DWORD getInternalLen() { return cs.dwCompClauseLen / sizeof(DWORD); } 55 | 56 | // for IE workaround 57 | void backupCompLen(void); 58 | void resetCompLen(void); 59 | void restoreCompLen(void); 60 | }; 61 | -------------------------------------------------------------------------------- /HashEd-UTF8/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by HashEd.rc 4 | // 5 | #define IDM_ABOUTBOX 0x0010 6 | #define IDD_ABOUTBOX 100 7 | #define IDS_ABOUTBOX 101 8 | #define IDD_HASHED_DIALOG 102 9 | #define IDS_ALLOW_CHI_STRING 102 10 | #define IDS_INPUT_RULE 103 11 | #define IDS_PHRASE_EXIST 104 12 | #define IDS_SAVE_CONFIRM 105 13 | #define IDS_SAVE_BTN_FACE 106 14 | #define IDS_NUM_OF_PHRASES 107 15 | #define IDS_LOADING 108 16 | #define IDS_SUGGEST_DO_SAVE 109 17 | #define IDS_NOTFOUND 110 18 | #define IDB_COOL 122 19 | #define IDR_MAINFRAME 128 20 | #define IDR_RT_MANIFEST1 129 21 | #define IDC_PHRASE_LIST 1001 22 | #define IDC_NEW_PHRASE_EDIT 1002 23 | #define IDC_ADD_PHRASE 1003 24 | #define IDC_DEL_PHRASE 1004 25 | #define IDC_FIND_PHRASE 1005 26 | #define IDC_IMPORT 1006 27 | #define IDC_IMPORT2 1007 28 | #define IDC_SAVE 1007 29 | #define IDC_SAVE_AS 1008 30 | #define IDC_ABOUT 1009 31 | #define IDC_BANNER 1010 32 | #define IDC_LIST1 1011 33 | #define IDC_COMBO1 1015 34 | 35 | // Next default values for new objects 36 | // 37 | #ifdef APSTUDIO_INVOKED 38 | #ifndef APSTUDIO_READONLY_SYMBOLS 39 | #define _APS_NEXT_RESOURCE_VALUE 130 40 | #define _APS_NEXT_COMMAND_VALUE 32771 41 | #define _APS_NEXT_CONTROL_VALUE 1016 42 | #define _APS_NEXT_SYMED_VALUE 101 43 | #endif 44 | #endif 45 | -------------------------------------------------------------------------------- /ChewingIME/ChewingIME.h: -------------------------------------------------------------------------------- 1 | #ifndef _PCMANIME_H_ 2 | #define _PCMANIME_H_ 3 | 4 | #include 5 | #include 6 | #include "imm.h" 7 | #include "ChewingClient.h" 8 | 9 | extern HINSTANCE g_dllInst; 10 | extern bool g_isWindowNT; 11 | extern bool g_useUnicode; 12 | extern bool g_isWinLogon; 13 | 14 | const LPCTSTR g_chewingIMEClass = _T("ChewingIME"); 15 | const LPCTSTR g_compWndClass = _T("ChewingComp"); 16 | const LPCTSTR g_candWndClass = _T("ChewingCand"); 17 | const LPCTSTR g_statusWndClass = _T("ChewingStatus"); 18 | 19 | #define WM_IME_RELOADCONFIG (WM_APP+1) 20 | 21 | #define DEF_FONT_SIZE 16 22 | 23 | extern const TCHAR** g_selKeyNames; 24 | extern DWORD g_selKeyType; 25 | 26 | extern DWORD g_keyboardLayout; 27 | extern DWORD g_candPerRow; 28 | extern DWORD g_hideStatusWnd; 29 | extern DWORD g_enableShift; 30 | extern DWORD g_fixCompWnd; 31 | extern DWORD g_ColorCandWnd; 32 | extern DWORD g_ColoredCompCursor; 33 | extern DWORD g_enableSimp; 34 | extern DWORD g_FontSize; 35 | extern DWORD g_cursorCandList; 36 | extern DWORD g_phraseMark; 37 | 38 | extern ChewingClient* g_chewing; 39 | 40 | inline BOOL IsImeMessage(UINT msg) 41 | { 42 | return ( (msg >= WM_IME_STARTCOMPOSITION && msg <= WM_IME_KEYLAST) 43 | || (msg >= WM_IME_SETCONTEXT && msg <= WM_IME_KEYUP) ); 44 | } 45 | 46 | void LoadConfig(); 47 | void ToggleChiEngMode(HIMC hIMC); 48 | void ToggleFullShapeMode(HIMC hIMC); 49 | 50 | BOOL GenerateIMEMessage(HIMC hIMC, UINT msg, WPARAM wp=0, LPARAM lp=0); 51 | 52 | void ToggleChiEngMode(HIMC hIMC); 53 | 54 | void ConfigureChewingIME(HWND parent); 55 | 56 | typedef struct _tagTRANSMSG { 57 | UINT message; 58 | WPARAM wParam; 59 | LPARAM lParam; 60 | } TRANSMSG, *LPTRANSMSG; 61 | 62 | struct KeyInfo 63 | { 64 | UINT repeatCount:16; 65 | UINT scanCode:8; 66 | UINT isExtended:1; 67 | UINT reserved:4; 68 | UINT contextCode:1; 69 | UINT prevKeyState:1; 70 | UINT isKeyUp:1; // transition state 71 | }; 72 | 73 | inline KeyInfo GetKeyInfo(LPARAM lparam) 74 | { return *(KeyInfo*)&lparam; } 75 | 76 | inline bool IsKeyDown(BYTE keystate){ return !!(keystate & 0xF0); } 77 | inline bool IsKeyToggled(BYTE keystate){ return !!(keystate & 0x0F); } 78 | 79 | BOOL ProcessKeyEvent( UINT key, KeyInfo ki, const BYTE* keystate ); 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /ChewingIME/XPToolbar.h: -------------------------------------------------------------------------------- 1 | // XPToolbar.h: interface for the XPToolbar class. 2 | // 3 | ////////////////////////////////////////////////////////////////////// 4 | 5 | #if !defined(AFX_XPTOOLBAR_H__B78EEDE7_6867_422E_B87B_5291E8EEFFF6__INCLUDED_) 6 | #define AFX_XPTOOLBAR_H__B78EEDE7_6867_422E_B87B_5291E8EEFFF6__INCLUDED_ 7 | 8 | #if _MSC_VER > 1000 9 | #pragma once 10 | #endif // _MSC_VER > 1000 11 | 12 | #include "window.h" 13 | #include 14 | #include 15 | #include 16 | 17 | using namespace std; 18 | 19 | class XPToolbarBtn 20 | { 21 | friend class XPToolbar; 22 | protected: 23 | XPToolbarBtn(UINT cmdid, int image, LPCTSTR tooltip_text=_T(""), int btnstate=0) 24 | : iImage(image), id(cmdid), tooltip(tooltip_text), state(btnstate){} 25 | union{ 26 | int iImage; 27 | HICON hIcon; 28 | }; 29 | UINT id; 30 | int state; 31 | string tooltip; 32 | }; 33 | 34 | class Tooltip; 35 | 36 | class XPToolbar : virtual public Window 37 | { 38 | public: 39 | int prevHilightBtn; 40 | void setBtnImage(int idx, HICON icon); 41 | void setCmdTarget(HWND target){ cmdTarget = target; } 42 | int hitTest( int x, int y ); 43 | void getSize(int* w, int* h); 44 | int addBtn(UINT id, int iImage, LPCTSTR tooltip=_T("")); 45 | int addBtn(UINT id, HICON hIcon, LPCTSTR tooltip=_T("") ){ return addBtn(id, (int)hIcon, tooltip); } 46 | void drawBtn(HDC dc, int idx); 47 | void setTheme(HBITMAP bmp); 48 | bool create(HWND parent, UINT id, LONG style, int x, int y, int w, int h); 49 | static void unregisterClass(); 50 | static BOOL registerClass(); 51 | XPToolbar(int gripperw = 10, int btnw = 20, int btnh = 21); 52 | ~XPToolbar(); 53 | 54 | protected: 55 | void onCaptureChanged(LPARAM lp); 56 | void onPaint( PAINTSTRUCT& ps ); 57 | LRESULT wndProc(UINT msg, WPARAM wp, LPARAM lp); 58 | static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp); 59 | bool onLButtonDown(WPARAM wp, LPARAM lp); 60 | bool onLButtonUp(WPARAM wp, LPARAM lp); 61 | bool onMouseMove(WPARAM wp, LPARAM lp); 62 | 63 | HWND cmdTarget; 64 | HBITMAP themeBmp; 65 | int gripperW; 66 | int btnW; 67 | int btnH; 68 | int curPressedBtn; 69 | vector buttons; 70 | public: 71 | void setTooltip(Tooltip* tip); 72 | bool getBtnRect(int idx, RECT& rc); 73 | protected: 74 | Tooltip* tooltip; 75 | }; 76 | 77 | #endif // !defined(AFX_XPTOOLBAR_H__B78EEDE7_6867_422E_B87B_5291E8EEFFF6__INCLUDED_) 78 | -------------------------------------------------------------------------------- /ChewingIME/IMEChildWnd.cpp: -------------------------------------------------------------------------------- 1 | #include ".\IMEChildWnd.h" 2 | #include "ChewingIME.h" 3 | #include "IMCLock.h" 4 | #include "IMEUI.h" 5 | 6 | IMEChildWnd::IMEChildWnd() 7 | { 8 | } 9 | 10 | 11 | 12 | IMEChildWnd::~IMEChildWnd(void) 13 | { 14 | destroy(); 15 | } 16 | 17 | /* 18 | void IMEChildWnd::assocWndObj(void) 19 | { 20 | if( sizeof(IMEChildWnd*) > sizeof(LONG) ) // pointer size > 32 bit (64 bit environment) 21 | { 22 | void* ptr = this; 23 | LONG ptrparts[] = {0, 0}; 24 | memcpy( ptrparts, &ptr, sizeof(IMEChildWnd*) ); 25 | SetWindowLongPtr( hwnd, GWL_USERDATA, ptrparts[0] ); 26 | SetWindowLongPtr( hwnd, IMMGWL_PRIVATE, ptrparts[1] ); 27 | } 28 | else 29 | SetWindowLongPtr( hwnd, GWL_USERDATA, (LONG)this ); 30 | } 31 | 32 | IMEChildWnd* IMEChildWnd::getAssocWndObj(HWND hwnd) 33 | { 34 | if( sizeof(void*) > sizeof(LONG) ) // pointer size > 32 bit (64 bit environment) 35 | { 36 | IMEChildWnd* ptr = NULL; 37 | LONG ptrparts[] = {0, 0}; 38 | ptrparts[0] = GetWindowLongPtr( hwnd, GWL_USERDATA ); 39 | ptrparts[1] = GetWindowLongPtr( hwnd, IMMGWL_PRIVATE ); 40 | memcpy( &ptr, ptrparts, sizeof(IMEChildWnd*) ); 41 | return ptr; 42 | } 43 | else 44 | return (IMEChildWnd*)GetWindowLongPtr( hwnd, GWL_USERDATA ); 45 | 46 | return NULL; 47 | } 48 | */ 49 | 50 | void IMEChildWnd::onLButtonDown(WPARAM wp, LPARAM lp) 51 | { 52 | oldPos = MAKEPOINTS(lp); 53 | SetCapture(hwnd); 54 | } 55 | 56 | void IMEChildWnd::onLButtonUp(WPARAM wp, LPARAM lp) 57 | { 58 | ReleaseCapture(); 59 | } 60 | 61 | void IMEChildWnd::onMouseMove(WPARAM wp, LPARAM lp) 62 | { 63 | if( GetCapture() != hwnd ) 64 | return; 65 | POINTS pt = MAKEPOINTS(lp); 66 | RECT rc; 67 | GetWindowRect( hwnd, &rc ); 68 | OffsetRect( &rc, (pt.x - oldPos.x), (pt.y - oldPos.y) ); 69 | // MoveWindow( hwnd, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, TRUE ); 70 | move(rc.left, rc.top); 71 | } 72 | 73 | void IMEChildWnd::move(int x, int y) 74 | { 75 | int w, h; 76 | getSize(&w, &h); 77 | 78 | RECT rc; 79 | HIMC hIMC = getIMC(); 80 | if( hIMC ) 81 | { 82 | IMCLock imc(hIMC); 83 | if( imc.getIC() ) 84 | IMEUI::getWorkingArea( &rc, imc.getIC()->hWnd ); 85 | } 86 | if( x < rc.left ) 87 | x = rc.left; 88 | else if( (x + w) > rc.right ) 89 | x = rc.right - w; 90 | 91 | if( y < rc.top ) 92 | y = rc.top; 93 | else if( (y + h) > rc.bottom ) 94 | y = rc.bottom - h; 95 | 96 | MoveWindow( hwnd, x, y, w, h, TRUE ); 97 | } 98 | -------------------------------------------------------------------------------- /HashEd/CHashContext.h: -------------------------------------------------------------------------------- 1 | #ifndef _CHEWING_WIN32__HASHED_ 2 | #define _CHEWING_WIN32__HASHED_ 3 | 4 | 5 | #include 6 | #include "hash.h" 7 | 8 | 9 | /** 10 | * A context that load a hash.dat, 11 | * and provide some function to manipulate the context. 12 | */ 13 | class CHashContext 14 | { 15 | public: 16 | /** 17 | * Load specify hash.dat 18 | * retval -1 find bad data entry 19 | */ 20 | int load_hash(const char *file, bool doClear=true); 21 | 22 | /** 23 | * Save current context to target file 24 | */ 25 | bool save_hash(const char *destFile); 26 | 27 | /** 28 | * Sort the phrases 29 | */ 30 | void sort_phrase(); 31 | 32 | /** 33 | * Delete redundancy phrase 34 | */ 35 | bool arrange_phrase(); 36 | 37 | /** 38 | * Fro debug purpose only. 39 | */ 40 | void list_phrase(); 41 | 42 | /** 43 | * Find phrase by HASH_ITEM.item_index 44 | */ 45 | HASH_ITEM* get_phrase_by_id(int index); 46 | 47 | /** 48 | * Remove phrase by HASH_ITEM.item_index 49 | */ 50 | void del_phrase_by_id(int index); 51 | 52 | /** 53 | * Append a phrase into context 54 | * You must provide the big5 string and its phoneSeq 55 | */ 56 | HASH_ITEM* append_phrase(const char *str, uint16 *phoneSeq); 57 | 58 | /** 59 | * Find a phrase in exactly match. 60 | */ 61 | HASH_ITEM* find_phrase_exact(const char *str, uint16 *phoneSeq); 62 | 63 | /** 64 | * Find a phrase in partial match. 65 | */ 66 | HASH_ITEM* find_phrase_partial(const char *str); 67 | 68 | /** 69 | * How many phrase in this context? 70 | */ 71 | int get_phrase_count(); 72 | 73 | /** 74 | * Connect | launch chewing-server 75 | */ 76 | void _connect_server(void); 77 | 78 | /** 79 | * Retrive lastest phoneSeq info from chewing-server 80 | */ 81 | int _get_phone_seq_from_server(uint16 *pPhoneSeq); 82 | 83 | /** 84 | * Shutdown chewing-server 85 | */ 86 | void shutdown_server(); 87 | 88 | /** 89 | */ 90 | void release__HASH_ITEM(HASH_ITEM *pItem); 91 | 92 | /** 93 | */ 94 | void clear(); 95 | 96 | /** 97 | */ 98 | static BOOL _isDbcsString(char *str); 99 | 100 | CHashContext(); 101 | ~CHashContext(); 102 | 103 | private: 104 | std::vector pool; 105 | int chewing_lifetime; 106 | 107 | HWND serverWnd; 108 | char filemapName[MAX_PATH]; 109 | char formatstring[ 30 ]; 110 | }; 111 | 112 | 113 | 114 | 115 | 116 | #endif -------------------------------------------------------------------------------- /HashEd/HashEdDlg.h: -------------------------------------------------------------------------------- 1 | // HashEdDlg.h : header file 2 | // 3 | 4 | #if !defined(AFX_HASHEDDLG_H__35818C20_FC7D_4643_ABE9_61774E0F5CBC__INCLUDED_) 5 | #define AFX_HASHEDDLG_H__35818C20_FC7D_4643_ABE9_61774E0F5CBC__INCLUDED_ 6 | 7 | #include "chashcontext.h" 8 | 9 | #if _MSC_VER > 1000 10 | #pragma once 11 | #endif // _MSC_VER > 1000 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | // CHashEdDlg dialog 15 | 16 | using namespace std; 17 | 18 | class CHashEdDlg 19 | { 20 | // Construction 21 | public: 22 | CHashEdDlg(); // standard constructor 23 | int DoModal(){ 24 | return DialogBoxParam( (HINSTANCE)GetModuleHandle(NULL), LPCTSTR(IDD), 25 | HWND_DESKTOP, (DLGPROC)wndProc, LPARAM(this) ); 26 | } 27 | 28 | // Dialog Data 29 | enum { IDD = IDD_HASHED_DIALOG }; 30 | HWND m_btnAbout; 31 | HWND m_banner; 32 | HWND m_btnSaveAs; 33 | HWND m_btnFindPhrase; 34 | HWND m_listing; // List control 35 | HWND m_btnAddPhrase; 36 | HWND m_btnDelPhrase; 37 | HWND m_Import; 38 | HWND m_edtPhrase; 39 | HWND m_btnSave; 40 | 41 | CHashContext m_context; 42 | uint16 m_PhoneSeq[MAX_PHONE_SEQ_LEN+1]; 43 | int m_NumPhoneSeq; 44 | char m_string[(MAX_PHONE_SEQ_LEN+1)*2]; 45 | char m_msgStr[256]; 46 | TCHAR m_strHashFolder[ MAX_PATH + 1 ]; 47 | 48 | // Implementation 49 | protected: 50 | HWND m_hWnd; 51 | 52 | HICON m_hIcon; 53 | 54 | static BOOL wndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp); 55 | LRESULT wndProc(UINT msg, WPARAM wp, LPARAM lp); 56 | // Generated message map functions 57 | virtual BOOL OnInitDialog(); 58 | void OnUpdateNewPhraseEdit(); 59 | void OnChangeNewPhraseEdit(); 60 | void OnAddPhrase(); 61 | void OnKillfocusNewPhraseEdit(); 62 | void OnFindPhrase(); 63 | void OnImport(); 64 | void OnSave(); 65 | void OnDelPhrase(); 66 | void OnSaveAs(); 67 | void OnAbout(); 68 | void OnTimer(UINT nIDEvent); 69 | 70 | BOOL _isDbcsString(char *str); 71 | int _isMatch(char *string, int id); 72 | int find(char *tok, BOOL &bExactMatch, int hi=-1, int lo=-1); 73 | void GetHashLocation(); 74 | void _save(const char *pathfile, BOOL bSaveNoSwap); 75 | void _enable_buttons(BOOL bEnable); 76 | void ReloadListCtrl(); 77 | void UpdateBanner(const char *message=NULL); 78 | void SelItem(int idx); 79 | void Reload(char* hashfile, bool bClearContext); 80 | char *GetStringFromTab(int id); 81 | 82 | public: 83 | void onCommand(UINT cmd); 84 | }; 85 | 86 | //{{AFX_INSERT_LOCATION}} 87 | // Microsoft Visual C++ will insert additional declarations immediately before the previous line. 88 | 89 | #endif // !defined(AFX_HASHEDDLG_H__35818C20_FC7D_4643_ABE9_61774E0F5CBC__INCLUDED_) 90 | -------------------------------------------------------------------------------- /Include/Chewingpp.h: -------------------------------------------------------------------------------- 1 | /* @(#)Chewingpp.h 2 | */ 3 | 4 | #ifndef _CHEWINGPP_H 5 | #define _CHEWINGPP_H 1 6 | 7 | #include 8 | #pragma comment(lib, "chewing") 9 | 10 | #ifdef MAX_UTF8_SIZE 11 | #define MAX_CHAR_SIZE (MAX_UTF8_SIZE) 12 | #else 13 | #define MAX_CHAR_SIZE (2) 14 | #endif 15 | 16 | #if !defined(MAX_PHONE_SEQ_LEN) 17 | #define MAX_PHONE_SEQ_LEN 50 18 | #endif 19 | 20 | class Chewing 21 | { 22 | ChewingContext *ctx; 23 | 24 | static uint16 g_lastPhoneSeq[MAX_PHONE_SEQ_LEN]; 25 | 26 | public: 27 | static bool LoadDataFiles( const char* dataDir, const char* userDir ); 28 | static void ReloadSymbolTable( const char* datadir, const char* userDir ); 29 | static uint16* GetLastPhoneSeq( void ); 30 | 31 | Chewing( bool spaceAsSelection = true, int keyLayout=0); 32 | ~Chewing(); 33 | 34 | void SetKeyboardLayout(int kb); 35 | void SetHsuSelectionKeyType(int type); 36 | 37 | // Debugging-only retuine. 38 | void Dump(); 39 | 40 | int Space(); 41 | int Esc(); 42 | int Enter(); 43 | int Delete(); 44 | int Backspace(); 45 | int Tab(); 46 | int ShiftLeft(); 47 | int ShiftRight(); 48 | int ShiftSpace(); 49 | int Right(); 50 | int Left(); 51 | int Up(); 52 | int Down(); 53 | int Home(); 54 | int End(); 55 | int Capslock(); 56 | int Key(unsigned int code); 57 | int CtrlNum(unsigned int code); 58 | int NumPad(unsigned int code); 59 | int DoubleTab(); 60 | 61 | // Return the i-th selection key, i >= 0. 62 | char SelKey(int i); 63 | void SelKey(char* selkey); 64 | 65 | char* ZuinStr(); 66 | char* CommitStr(); 67 | uint16* PhoneSeq(); 68 | int CommitReady(); 69 | 70 | char* Buffer(); 71 | int BufferLen(); 72 | 73 | int CursorPos(); 74 | int KeystrokeIgnore(); 75 | 76 | int ChineseMode(); 77 | 78 | // CandidateWindow-related routines 79 | int Candidate(); 80 | int ChoicePerPage(); 81 | int TotalChoice(); 82 | int TotalPage(); 83 | int CurrentPage(); 84 | 85 | // Return the i-th selection wchar, i >= 0. 86 | char* Selection(int i); 87 | void SetFullShape(bool full); 88 | bool GetFullShape(void); 89 | void SetSpaceAsSelection(bool spaceAsSelection); 90 | void SetAdvanceAfterSelection(int bDo); 91 | void SetEasySymbolInput(int bSet); 92 | int ShowMsgLen(void); 93 | char* ShowMsg(void); 94 | void SetAddPhraseForward(bool add_forward); 95 | bool GetAddPhraseForward(void); 96 | void SetCandPerPage(int len); 97 | void SetEscCleanAllBuf( bool escCleanAllBuf ); 98 | 99 | int IntervalLen(); 100 | unsigned char* IntervalArray(); 101 | }; 102 | 103 | #endif /* _CHEWING_H */ 104 | 105 | -------------------------------------------------------------------------------- /HashEd-UTF8/HashEdDlg.h: -------------------------------------------------------------------------------- 1 | // HashEdDlg.h : header file 2 | // 3 | 4 | #if !defined(AFX_HASHEDDLG_H__35818C20_FC7D_4643_ABE9_61774E0F5CBC__INCLUDED_) 5 | #define AFX_HASHEDDLG_H__35818C20_FC7D_4643_ABE9_61774E0F5CBC__INCLUDED_ 6 | 7 | #include "chashcontext.h" 8 | 9 | #if _MSC_VER > 1000 10 | #pragma once 11 | #endif // _MSC_VER > 1000 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | // CHashEdDlg dialog 15 | 16 | using namespace std; 17 | 18 | class CPhraseList; 19 | 20 | class CHashEdDlg 21 | { 22 | // Construction 23 | public: 24 | CHashEdDlg(); // standard constructor 25 | int DoModal(){ 26 | return DialogBoxParam( (HINSTANCE)GetModuleHandle(NULL), LPCTSTR(IDD), 27 | HWND_DESKTOP, (DLGPROC)wndProc, LPARAM(this) ); 28 | } 29 | 30 | // Dialog Data 31 | enum { IDD = IDD_HASHED_DIALOG }; 32 | HWND m_btnAbout; 33 | HWND m_banner; 34 | HWND m_btnSaveAs; 35 | HWND m_btnFindPhrase; 36 | HWND m_btnAddPhrase; 37 | HWND m_btnDelPhrase; 38 | HWND m_Import; 39 | HWND m_edtPhrase; 40 | HWND m_btnSave; 41 | CPhraseList* phraseList; // Phrase List control 42 | 43 | CHashContext m_context; 44 | uint16 m_PhoneSeq[MAX_PHONE_SEQ_LEN+1]; 45 | int m_NumPhoneSeq; 46 | char m_string[(MAX_PHONE_SEQ_LEN+1)*2]; 47 | char m_msgStr[256]; 48 | TCHAR m_strHashFolder[ MAX_PATH + 1 ]; 49 | 50 | // Implementation 51 | protected: 52 | HWND m_hWnd; 53 | 54 | HICON m_hIcon; 55 | 56 | static BOOL wndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp); 57 | LRESULT wndProc(UINT msg, WPARAM wp, LPARAM lp); 58 | // Generated message map functions 59 | virtual BOOL OnInitDialog(); 60 | void OnUpdateNewPhraseEdit(); 61 | void OnChangeNewPhraseEdit(); 62 | void OnAddPhrase(); 63 | void OnKillfocusNewPhraseEdit(); 64 | void OnFindPhrase(); 65 | void OnImport(); 66 | void OnSave(); 67 | void OnDelPhrase(); 68 | void OnSaveAs(); 69 | void OnAbout(); 70 | void OnTimer(UINT nIDEvent); 71 | 72 | int _isMatch(const char *string, int id); 73 | int find(const char *tok, BOOL &bExactMatch, int hi=-1, int lo=-1); 74 | void GetHashLocation(); 75 | void _save(const char *pathfile, BOOL bSaveNoSwap); 76 | void _enable_buttons(BOOL bEnable); 77 | void ReloadListCtrl(); 78 | void UpdateBanner(const char *message=NULL); 79 | void SelItem(int idx); 80 | void Reload(char* hashfile, bool bClearContext); 81 | char *GetStringFromTab(int id); 82 | 83 | public: 84 | void onCommand(UINT cmd); 85 | }; 86 | 87 | //{{AFX_INSERT_LOCATION}} 88 | // Microsoft Visual C++ will insert additional declarations immediately before the previous line. 89 | 90 | #endif // !defined(AFX_HASHEDDLG_H__35818C20_FC7D_4643_ABE9_61774E0F5CBC__INCLUDED_) 91 | -------------------------------------------------------------------------------- /HashEd-UTF8/CHashContext.h: -------------------------------------------------------------------------------- 1 | #ifndef _CHEWING_WIN32__HASHED_ 2 | #define _CHEWING_WIN32__HASHED_ 3 | 4 | 5 | #include 6 | #include "hash-private.h" 7 | 8 | 9 | /** 10 | * A context that load a hash.dat, 11 | * and provide some function to manipulate the context. 12 | */ 13 | class CHashContext 14 | { 15 | public: 16 | /** 17 | * Load specify hash.dat 18 | * retval -1 find bad data entry 19 | */ 20 | int load_hash(const char *file, bool doClear=true); 21 | 22 | /** 23 | * Save current context to target file 24 | */ 25 | bool save_hash(const char *destFile); 26 | 27 | /** 28 | * Sort the phrases 29 | */ 30 | void sort_phrase(); 31 | 32 | /** 33 | * Delete redundancy phrase 34 | */ 35 | bool arrange_phrase(); 36 | 37 | /** 38 | * Fro debug purpose only. 39 | */ 40 | void list_phrase(); 41 | 42 | /** 43 | * Find phrase by array index of CHashContext.pool 44 | */ 45 | HASH_ITEM* get_phrase_by_id(int array_index); 46 | 47 | /** 48 | * Remove phrase by HASH_ITEM.item_index 49 | */ 50 | void del_phrase_by_id(int index); 51 | 52 | /** 53 | * Append a phrase into context 54 | * You must provide the big5 string and its phoneSeq 55 | */ 56 | HASH_ITEM* append_phrase(const char *str, uint16 *phoneSeq); 57 | 58 | /** 59 | * Find a phrase in exactly match. 60 | */ 61 | HASH_ITEM* find_phrase_exact(const char *str, uint16 *phoneSeq); 62 | 63 | /** 64 | * Find a phrase in partial match. 65 | */ 66 | HASH_ITEM* find_phrase_partial(const char *str); 67 | 68 | /** 69 | * How many phrase in this context? 70 | */ 71 | int get_phrase_count(); 72 | 73 | /** 74 | * Connect | launch chewing-server 75 | */ 76 | void _connect_server(void); 77 | 78 | /** 79 | * Retrive lastest phoneSeq info from chewing-server 80 | */ 81 | int _get_phone_seq_from_server(uint16 *pPhoneSeq); 82 | 83 | /** 84 | * Shutdown chewing-server 85 | */ 86 | void shutdown_server(); 87 | 88 | /** 89 | */ 90 | void release__HASH_ITEM(HASH_ITEM *pItem); 91 | 92 | /** 93 | */ 94 | void clear(); 95 | 96 | /** 97 | */ 98 | static BOOL isChineseString(const char *str); 99 | 100 | CHashContext(); 101 | ~CHashContext(); 102 | 103 | private: 104 | std::vector pool; 105 | int chewing_lifetime; 106 | 107 | HWND serverWnd; 108 | char filemapName[MAX_PATH]; 109 | char formatstring[ 30 ]; 110 | }; 111 | 112 | 113 | 114 | 115 | 116 | #endif -------------------------------------------------------------------------------- /ChewingIME/ChewingClient.h: -------------------------------------------------------------------------------- 1 | // ChewingClient.h: interface for the ChewingClient class. 2 | // 3 | ////////////////////////////////////////////////////////////////////// 4 | 5 | #if !defined(AFX_CHEWINGCLIENT_H__E54E6740_17FB_4E1D_B912_751FF053FFD1__INCLUDED_) 6 | #define AFX_CHEWINGCLIENT_H__E54E6740_17FB_4E1D_B912_751FF053FFD1__INCLUDED_ 7 | 8 | #if _MSC_VER > 1000 9 | #pragma once 10 | #endif // _MSC_VER > 1000 11 | 12 | #include 13 | #include "ChewingServer.h" 14 | 15 | class ChewingClient 16 | { 17 | public: 18 | ChewingClient( int kbLayout, bool spaceAsSel = true, const char* selKeys="1234567890", bool AdvAfterSel=true, bool EscCleanAllBuf = false ); 19 | ~ChewingClient(); 20 | 21 | public: 22 | void SetKeyboardLayout(int kb); 23 | void SetHsuSelectionKeyType(int type); 24 | 25 | int Space(); 26 | int Esc(); 27 | int Enter(); 28 | int Delete(); 29 | int Backspace(); 30 | int Tab(); 31 | int ShiftLeft(); 32 | int ShiftRight(); 33 | int ShiftSpace(); 34 | int Right(); 35 | int Left(); 36 | int Up(); 37 | int Down(); 38 | int Home(); 39 | int End(); 40 | int Capslock(); 41 | int Key(unsigned int code); 42 | int CtrlNum(unsigned int code); 43 | int NumPad(unsigned int code); 44 | int DoubleTab(); 45 | 46 | // Return the i-th selection key, i >= 0. 47 | char SelKey(int i); 48 | void SelKey(char* selkey); 49 | void SetAdvanceAfterSelection(bool bDo); 50 | void SetEasySymbolInput(bool bSet); 51 | 52 | char* ZuinStr(); 53 | char* CommitStr(); 54 | int CommitReady(); 55 | 56 | char* Buffer(); 57 | int BufferLen(); 58 | 59 | int CursorPos(); 60 | int KeystrokeIgnore(); 61 | 62 | int ChineseMode(); 63 | 64 | // CandidateWindow-related routines 65 | int Candidate(); 66 | int ChoicePerPage(); 67 | int TotalChoice(); 68 | int TotalPage(); 69 | int CurrentPage(); 70 | 71 | // Return the i-th selection wchar_t, i >= 0. 72 | char* Selection(int i); 73 | void SetFullShape(bool full); 74 | bool GetFullShape(void); 75 | 76 | unsigned int EchoFromServer(); 77 | bool CheckServer(); 78 | 79 | unsigned char* GetIntervalArray(int& len); 80 | 81 | protected: 82 | unsigned char* GetDataFromSharedMem(int len); 83 | HANDLE sharedMem; 84 | LPARAM chewingID; 85 | HWND serverWnd; 86 | TCHAR filemapName[MAX_PATH]; 87 | char *pSelKeys; 88 | 89 | public: 90 | void SetSpaceAsSelection(bool spaceAsSelection); 91 | void SetEscCleanAllBuf( bool escCleanAllBuf ); 92 | void ConnectServer(void); 93 | protected: 94 | bool spaceAsSelection; 95 | bool advAfterSelection; 96 | bool escCleanAllBuf; 97 | int keyLayout; 98 | public: 99 | int ShowMsgLen(void); 100 | char* ShowMsg(void); 101 | void SetAddPhraseForward(bool add_forward); 102 | int GetAddPhraseForward(void); 103 | void SetCandPerPage(int len); 104 | void ReloadSymbolTable(void); 105 | }; 106 | 107 | #endif // !defined(AFX_CHEWINGCLIENT_H__E54E6740_17FB_4E1D_B912_751FF053FFD1__INCLUDED_) 108 | -------------------------------------------------------------------------------- /Include/ChewingServer.h: -------------------------------------------------------------------------------- 1 | // ChewingServer.h: interface for the ChewingServer class. 2 | // 3 | ////////////////////////////////////////////////////////////////////// 4 | 5 | #if !defined(AFX_CHEWINGSERVER_H__BA0A82BD_DE77_4E22_9B6C_443D7E3D22EB__INCLUDED_) 6 | #define AFX_CHEWINGSERVER_H__BA0A82BD_DE77_4E22_9B6C_443D7E3D22EB__INCLUDED_ 7 | 8 | #if _MSC_VER > 1000 9 | #pragma once 10 | #endif // _MSC_VER > 1000 11 | #pragma warning(disable : 4786) 12 | 13 | #include 14 | //#include 15 | #include 16 | #include "chewingpp.h" 17 | #include "pipe.h" 18 | 19 | using namespace std; 20 | 21 | typedef int (Chewing::*ChewingMemberFuncII)(int); 22 | typedef int (Chewing::*ChewingMemberFuncIV)(void); 23 | typedef char* (Chewing::*ChewingMemberFuncCI)(int); 24 | typedef char* (Chewing::*ChewingMemberFuncCV)(void); 25 | typedef char (Chewing::*GetSelKeyFunc)(int); 26 | typedef void (Chewing::*SetSelKeyFunc)(char*); 27 | 28 | #define chewingServerClassName _T("ChewingServer") 29 | #define CHEWINGSERVER_BUF_SIZE 4096 30 | 31 | class ChewingServer 32 | { 33 | public: 34 | enum ChewingCmd 35 | { 36 | cmdFirst = (WM_APP + 1), 37 | // int (void), void (void) 38 | cmdSpace = cmdFirst, 39 | cmdEsc, 40 | cmdEnter, 41 | cmdDelete, 42 | cmdBackspace, 43 | cmdTab, 44 | cmdShiftLeft, 45 | cmdShiftRight, 46 | cmdShiftSpace, 47 | cmdRight, 48 | cmdLeft, 49 | cmdUp, 50 | cmdDown, 51 | cmdHome, 52 | cmdEnd, 53 | cmdCapslock, 54 | cmdDoubleTab, 55 | cmdCommitReady, 56 | cmdBufferLen, 57 | cmdCursorPos, 58 | cmdKeystrokeIgnore, 59 | cmdChineseMode, 60 | cmdGetFullShape, 61 | cmdCandidate, 62 | cmdChoicePerPage, 63 | cmdTotalChoice, 64 | cmdTotalPage, 65 | cmdCurrentPage, 66 | cmdShowMsgLen, 67 | cmdGetAddPhraseForward, 68 | 69 | // int (int) or void (int) 70 | cmdKey, 71 | cmdCtrlNum, 72 | cmdNumPad, 73 | cmdGetSelKey, 74 | 75 | cmdSetFullShape, 76 | cmdSetSpaceAsSelection, 77 | cmdSetAddPhraseForward, 78 | cmdSetKeyboardLayout, 79 | cmdSetHsuSelectionKeyType, 80 | cmdSetCandPerPage, 81 | cmdSetEscCleanAllBuf, 82 | cmdAdvanceAfterSelection, 83 | cmdEasySymbolInput, 84 | 85 | // char* (void) or unsigned char* (void) 86 | cmdZuinStr, 87 | cmdCommitStr, 88 | cmdBuffer, 89 | cmdIntervalArray, 90 | cmdShowMsg, 91 | 92 | // char* (int) 93 | cmdSelection, 94 | 95 | // void (char*) 96 | cmdSetSelKey, 97 | 98 | cmdLast, 99 | 100 | cmdAddClient, 101 | cmdRemoveClient, 102 | cmdEcho, 103 | cmdLastPhoneSeq, 104 | cmdReloadSymbolTable, 105 | cmdShutdownServer 106 | }; 107 | 108 | public: 109 | bool run(); 110 | ChewingServer(); 111 | virtual ~ChewingServer(); 112 | protected: 113 | LRESULT parseChewingCmd(UINT cmd, int param, Chewing *chewing); 114 | bool startServer(); 115 | bool processor(); 116 | 117 | unsigned int NewChewingClient(ChewingPipeServ *cs); 118 | unsigned int RemoveChewingClient(unsigned int client); 119 | unsigned int Echo(unsigned int client); 120 | unsigned int LastPhoneSeq(); 121 | unsigned int ReloadSymbolTables(); 122 | unsigned int ShutdownServer(); 123 | void checkNewVersion(void); 124 | bool fireReadyEvent(); 125 | 126 | LRESULT wndProc( UINT msg, WPARAM wp, LPARAM lp); 127 | static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp); 128 | 129 | void write_to_client(char *str, unsigned int len); 130 | 131 | map chewingClients; 132 | HWND hwnd; 133 | static ChewingMemberFuncCI chewingCmdTable[]; 134 | HANDLE sharedMem; 135 | UINT checkTimer; 136 | }; 137 | 138 | 139 | // Generate class, event name according to the user account. 140 | char* _gen_event_name(char *buf, int szbuf, const char *prefix); 141 | 142 | #endif // !defined(AFX_CHEWINGSERVER_H__BA0A82BD_DE77_4E22_9B6C_443D7E3D22EB__INCLUDED_) 143 | -------------------------------------------------------------------------------- /ChewingIME/Tooltip.cpp: -------------------------------------------------------------------------------- 1 | #include ".\tooltip.h" 2 | #include 3 | #include "DrawUtil.h" 4 | 5 | static LPCTSTR tooltipClass = _T("Tooltip"); 6 | 7 | Tooltip::Tooltip(void) 8 | : timerID(0), text(NULL) 9 | { 10 | } 11 | 12 | Tooltip::~Tooltip(void) 13 | { 14 | if( timerID ) 15 | KillTimer( hwnd, timerID ); 16 | if( text ) 17 | free( text ); 18 | } 19 | 20 | BOOL Tooltip::registerClass(void) 21 | { 22 | WNDCLASSEX wc; 23 | wc.cbSize = sizeof(WNDCLASSEX); 24 | wc.style = CS_HREDRAW|CS_VREDRAW; 25 | wc.lpfnWndProc = (WNDPROC)Tooltip::wndProc; 26 | wc.cbClsExtra = 0; 27 | wc.cbWndExtra = sizeof(LONG) * (sizeof(void*) > sizeof(LONG) ? 2 : 1); 28 | wc.hInstance = (HINSTANCE)GetModuleHandle(NULL); 29 | wc.hCursor = LoadCursor( NULL, IDC_ARROW ); 30 | wc.hIcon = NULL; 31 | wc.lpszMenuName = (LPTSTR)NULL; 32 | wc.lpszClassName = tooltipClass; 33 | wc.hbrBackground = HBRUSH(COLOR_INFOBK+1); 34 | wc.hIconSm = NULL; 35 | 36 | if( !RegisterClassEx( (LPWNDCLASSEX)&wc ) ) 37 | return FALSE; 38 | 39 | return TRUE; 40 | } 41 | 42 | void Tooltip::unregisterClass() 43 | { 44 | UnregisterClass(tooltipClass, (HINSTANCE)GetModuleHandle(NULL)); 45 | } 46 | 47 | LRESULT CALLBACK Tooltip::wndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) 48 | { 49 | Tooltip* pthis = NULL; 50 | 51 | pthis = (Tooltip*)GetWindowLongPtr( hwnd, GWLP_USERDATA ); 52 | if( pthis ) 53 | return pthis->wndProc(msg, wp, lp); 54 | return DefWindowProc(hwnd, msg, wp, lp ); 55 | } 56 | 57 | LRESULT Tooltip::wndProc(UINT msg, WPARAM wp, LPARAM lp) 58 | { 59 | switch(msg) 60 | { 61 | case WM_PAINT: 62 | { 63 | PAINTSTRUCT ps; 64 | BeginPaint( hwnd, &ps ); 65 | onPaint(ps); 66 | EndPaint(hwnd, &ps); 67 | } 68 | break; 69 | case WM_TIMER: 70 | hideTip(); 71 | break; 72 | case WM_MOUSEACTIVATE: 73 | return MA_NOACTIVATE; 74 | default: 75 | return DefWindowProc(hwnd, msg, wp, lp); 76 | } 77 | return 0; 78 | } 79 | 80 | void Tooltip::onPaint(PAINTSTRUCT& ps) 81 | { 82 | int len = (int) wcslen(text); 83 | RECT rc, textrc = {0}; 84 | GetClientRect( hwnd, &rc ); 85 | 86 | Draw3DBorder( ps.hdc, &rc, GetSysColor(COLOR_BTNFACE), GetSysColor(COLOR_3DDKSHADOW), 1); 87 | 88 | SetBkMode( ps.hdc, TRANSPARENT ); 89 | SetTextColor(ps.hdc, GetSysColor(COLOR_INFOTEXT) ); 90 | HGDIOBJ old_font = SelectObject( ps.hdc, GetStockObject(DEFAULT_GUI_FONT)); 91 | 92 | SIZE size; 93 | GetTextExtentPoint32W( ps.hdc, text, len, &size ); 94 | rc.top += (rc.bottom - size.cy)/2; 95 | rc.left += (rc.right - size.cx)/2; 96 | ExtTextOutW( ps.hdc, rc.left, rc.top, 0, &textrc, text, len, NULL ); 97 | 98 | SelectObject( ps.hdc, old_font ); 99 | } 100 | 101 | void Tooltip::showTip(int x, int y, LPCWSTR tip_text, DWORD duration) 102 | { 103 | if( !isWindow() ) 104 | create(); 105 | 106 | if( text ) 107 | free( text ); 108 | text = wcsdup( tip_text ); 109 | 110 | SIZE size = {0}; 111 | HDC dc = GetDC(hwnd); 112 | HGDIOBJ old_font = SelectObject( dc, GetStockObject(DEFAULT_GUI_FONT)); 113 | GetTextExtentPointW( dc, text, wcslen(text), &size ); 114 | SelectObject( dc, old_font ); 115 | ReleaseDC(hwnd, dc); 116 | 117 | SetWindowPos( hwnd, HWND_TOPMOST, x, y, size.cx + 4, size.cy + 4, SWP_NOACTIVATE ); 118 | if( IsWindowVisible(hwnd) ) 119 | InvalidateRect( hwnd, NULL, TRUE ); 120 | else 121 | ShowWindow( hwnd, SW_SHOWNA ); 122 | if( duration > 0 ) 123 | { 124 | if(timerID) 125 | KillTimer( hwnd, timerID ); 126 | timerID = SetTimer( hwnd, 1, duration, NULL ); 127 | } 128 | } 129 | 130 | BOOL Tooltip::create(void) 131 | { 132 | hwnd = CreateWindowEx( WS_EX_TOOLWINDOW, tooltipClass, NULL, WS_POPUP, 0, 0, 0, 0, 133 | HWND_DESKTOP, NULL, HINSTANCE(GetModuleHandle(NULL)), NULL); 134 | if( !hwnd ) 135 | return FALSE; 136 | SetWindowLongPtr( hwnd, GWLP_USERDATA, LONG_PTR(this)); 137 | return TRUE; 138 | } 139 | 140 | void Tooltip::hideTip(void) 141 | { 142 | if( timerID ) 143 | { 144 | KillTimer( hwnd, timerID ); 145 | timerID = 0; 146 | } 147 | hide(); 148 | } 149 | -------------------------------------------------------------------------------- /Chewing.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 10.00 2 | # Visual C++ Express 2008 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Installer", "Installer\Installer.vcproj", "{C7C053CC-FDDC-4398-881E-F31FF82340BD}" 4 | EndProject 5 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ChewingIME", "ChewingIME\ChewingIME.vcproj", "{517658CE-EFFE-4C17-BF82-55F743CB3123}" 6 | EndProject 7 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ChewingServerUTF8", "ChewingServer\ChewingServerUTF8.vcproj", "{FF074876-659D-4BFD-9361-6E22C99BABE2}" 8 | EndProject 9 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HashEd-UTF8", "HashEd-UTF8\HashEd-UTF8.vcproj", "{269E68D9-551A-4A1B-8DEF-A8C6DA04DA2A}" 10 | EndProject 11 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "big52utf8", "big52utf8\big52utf8.vcproj", "{FEA2192A-7A54-46C9-A194-16B2B4268C26}" 12 | EndProject 13 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OnlineUpdate", "OnlineUpdate\OnlineUpdate.vcproj", "{DC981667-BE17-4BFF-BD24-8E5417B8C5D0}" 14 | EndProject 15 | Global 16 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 17 | Debug|Win32 = Debug|Win32 18 | Debug|x64 = Debug|x64 19 | Release|Win32 = Release|Win32 20 | Release|x64 = Release|x64 21 | EndGlobalSection 22 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 23 | {C7C053CC-FDDC-4398-881E-F31FF82340BD}.Debug|Win32.ActiveCfg = Debug|Win32 24 | {C7C053CC-FDDC-4398-881E-F31FF82340BD}.Debug|x64.ActiveCfg = Debug|Win32 25 | {C7C053CC-FDDC-4398-881E-F31FF82340BD}.Release|Win32.ActiveCfg = Release|Win32 26 | {C7C053CC-FDDC-4398-881E-F31FF82340BD}.Release|Win32.Build.0 = Release|Win32 27 | {C7C053CC-FDDC-4398-881E-F31FF82340BD}.Release|x64.ActiveCfg = Release|Win32 28 | {517658CE-EFFE-4C17-BF82-55F743CB3123}.Debug|Win32.ActiveCfg = Debug|Win32 29 | {517658CE-EFFE-4C17-BF82-55F743CB3123}.Debug|Win32.Build.0 = Debug|Win32 30 | {517658CE-EFFE-4C17-BF82-55F743CB3123}.Debug|x64.ActiveCfg = Debug|x64 31 | {517658CE-EFFE-4C17-BF82-55F743CB3123}.Debug|x64.Build.0 = Debug|x64 32 | {517658CE-EFFE-4C17-BF82-55F743CB3123}.Release|Win32.ActiveCfg = Release|Win32 33 | {517658CE-EFFE-4C17-BF82-55F743CB3123}.Release|Win32.Build.0 = Release|Win32 34 | {517658CE-EFFE-4C17-BF82-55F743CB3123}.Release|x64.ActiveCfg = Release|x64 35 | {517658CE-EFFE-4C17-BF82-55F743CB3123}.Release|x64.Build.0 = Release|x64 36 | {FF074876-659D-4BFD-9361-6E22C99BABE2}.Debug|Win32.ActiveCfg = Debug|Win32 37 | {FF074876-659D-4BFD-9361-6E22C99BABE2}.Debug|Win32.Build.0 = Debug|Win32 38 | {FF074876-659D-4BFD-9361-6E22C99BABE2}.Debug|x64.ActiveCfg = Debug|Win32 39 | {FF074876-659D-4BFD-9361-6E22C99BABE2}.Release|Win32.ActiveCfg = Release|Win32 40 | {FF074876-659D-4BFD-9361-6E22C99BABE2}.Release|Win32.Build.0 = Release|Win32 41 | {FF074876-659D-4BFD-9361-6E22C99BABE2}.Release|x64.ActiveCfg = Release|Win32 42 | {269E68D9-551A-4A1B-8DEF-A8C6DA04DA2A}.Debug|Win32.ActiveCfg = Debug|Win32 43 | {269E68D9-551A-4A1B-8DEF-A8C6DA04DA2A}.Debug|Win32.Build.0 = Debug|Win32 44 | {269E68D9-551A-4A1B-8DEF-A8C6DA04DA2A}.Debug|x64.ActiveCfg = Debug|Win32 45 | {269E68D9-551A-4A1B-8DEF-A8C6DA04DA2A}.Release|Win32.ActiveCfg = Release|Win32 46 | {269E68D9-551A-4A1B-8DEF-A8C6DA04DA2A}.Release|Win32.Build.0 = Release|Win32 47 | {269E68D9-551A-4A1B-8DEF-A8C6DA04DA2A}.Release|x64.ActiveCfg = Release|Win32 48 | {FEA2192A-7A54-46C9-A194-16B2B4268C26}.Debug|Win32.ActiveCfg = Debug|Win32 49 | {FEA2192A-7A54-46C9-A194-16B2B4268C26}.Debug|Win32.Build.0 = Debug|Win32 50 | {FEA2192A-7A54-46C9-A194-16B2B4268C26}.Debug|x64.ActiveCfg = Debug|Win32 51 | {FEA2192A-7A54-46C9-A194-16B2B4268C26}.Release|Win32.ActiveCfg = Release|Win32 52 | {FEA2192A-7A54-46C9-A194-16B2B4268C26}.Release|Win32.Build.0 = Release|Win32 53 | {FEA2192A-7A54-46C9-A194-16B2B4268C26}.Release|x64.ActiveCfg = Release|Win32 54 | {DC981667-BE17-4BFF-BD24-8E5417B8C5D0}.Debug|Win32.ActiveCfg = Debug|Win32 55 | {DC981667-BE17-4BFF-BD24-8E5417B8C5D0}.Debug|Win32.Build.0 = Debug|Win32 56 | {DC981667-BE17-4BFF-BD24-8E5417B8C5D0}.Debug|x64.ActiveCfg = Debug|Win32 57 | {DC981667-BE17-4BFF-BD24-8E5417B8C5D0}.Release|Win32.ActiveCfg = Release|Win32 58 | {DC981667-BE17-4BFF-BD24-8E5417B8C5D0}.Release|Win32.Build.0 = Release|Win32 59 | {DC981667-BE17-4BFF-BD24-8E5417B8C5D0}.Release|x64.ActiveCfg = Release|Win32 60 | EndGlobalSection 61 | GlobalSection(SolutionProperties) = preSolution 62 | HideSolutionNode = FALSE 63 | EndGlobalSection 64 | EndGlobal 65 | -------------------------------------------------------------------------------- /Installer/Installer.dsp: -------------------------------------------------------------------------------- 1 | # Microsoft Developer Studio Project File - Name="Installer" - Package Owner=<4> 2 | # Microsoft Developer Studio Generated Build File, Format Version 6.00 3 | # ** DO NOT EDIT ** 4 | 5 | # TARGTYPE "Win32 (x86) Application" 0x0101 6 | 7 | CFG=Installer - Win32 Debug 8 | !MESSAGE This is not a valid makefile. To build this project using NMAKE, 9 | !MESSAGE use the Export Makefile command and run 10 | !MESSAGE 11 | !MESSAGE NMAKE /f "Installer.mak". 12 | !MESSAGE 13 | !MESSAGE You can specify a configuration when running NMAKE 14 | !MESSAGE by defining the macro CFG on the command line. For example: 15 | !MESSAGE 16 | !MESSAGE NMAKE /f "Installer.mak" CFG="Installer - Win32 Debug" 17 | !MESSAGE 18 | !MESSAGE Possible choices for configuration are: 19 | !MESSAGE 20 | !MESSAGE "Installer - Win32 Release" (based on "Win32 (x86) Application") 21 | !MESSAGE "Installer - Win32 Debug" (based on "Win32 (x86) Application") 22 | !MESSAGE 23 | 24 | # Begin Project 25 | # PROP AllowPerConfigDependencies 0 26 | # PROP Scc_ProjName "" 27 | # PROP Scc_LocalPath "" 28 | CPP=cl.exe 29 | MTL=midl.exe 30 | RSC=rc.exe 31 | 32 | !IF "$(CFG)" == "Installer - Win32 Release" 33 | 34 | # PROP BASE Use_MFC 0 35 | # PROP BASE Use_Debug_Libraries 0 36 | # PROP BASE Output_Dir "Installer___Win32_Release" 37 | # PROP BASE Intermediate_Dir "Installer___Win32_Release" 38 | # PROP BASE Target_Dir "" 39 | # PROP Use_MFC 0 40 | # PROP Use_Debug_Libraries 0 41 | # PROP Output_Dir "Release" 42 | # PROP Intermediate_Dir "Release" 43 | # PROP Ignore_Export_Lib 0 44 | # PROP Target_Dir "" 45 | # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c 46 | # ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c 47 | # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 48 | # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 49 | # ADD BASE RSC /l 0x404 /d "NDEBUG" 50 | # ADD RSC /l 0x404 /d "NDEBUG" 51 | BSC32=bscmake.exe 52 | # ADD BASE BSC32 /nologo 53 | # ADD BSC32 /nologo 54 | LINK32=link.exe 55 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 56 | # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib imm32.lib /nologo /subsystem:windows /machine:I386 57 | 58 | !ELSEIF "$(CFG)" == "Installer - Win32 Debug" 59 | 60 | # PROP BASE Use_MFC 0 61 | # PROP BASE Use_Debug_Libraries 1 62 | # PROP BASE Output_Dir "Installer___Win32_Debug" 63 | # PROP BASE Intermediate_Dir "Installer___Win32_Debug" 64 | # PROP BASE Target_Dir "" 65 | # PROP Use_MFC 0 66 | # PROP Use_Debug_Libraries 1 67 | # PROP Output_Dir "Debug" 68 | # PROP Intermediate_Dir "Debug" 69 | # PROP Ignore_Export_Lib 0 70 | # PROP Target_Dir "" 71 | # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c 72 | # ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c 73 | # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 74 | # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 75 | # ADD BASE RSC /l 0x404 /d "_DEBUG" 76 | # ADD RSC /l 0x404 /d "_DEBUG" 77 | BSC32=bscmake.exe 78 | # ADD BASE BSC32 /nologo 79 | # ADD BSC32 /nologo 80 | LINK32=link.exe 81 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept 82 | # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib imm32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept 83 | 84 | !ENDIF 85 | 86 | # Begin Target 87 | 88 | # Name "Installer - Win32 Release" 89 | # Name "Installer - Win32 Debug" 90 | # Begin Group "Source Files" 91 | 92 | # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" 93 | # Begin Source File 94 | 95 | SOURCE=.\Installer.cpp 96 | # End Source File 97 | # End Group 98 | # Begin Group "Header Files" 99 | 100 | # PROP Default_Filter "h;hpp;hxx;hm;inl" 101 | # Begin Source File 102 | 103 | SOURCE=.\Installer.h 104 | # End Source File 105 | # Begin Source File 106 | 107 | SOURCE=.\Resource.h 108 | # End Source File 109 | # End Group 110 | # Begin Group "Resource Files" 111 | 112 | # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" 113 | # End Group 114 | # End Target 115 | # End Project 116 | -------------------------------------------------------------------------------- /HashEd/HashEd.dsp: -------------------------------------------------------------------------------- 1 | # Microsoft Developer Studio Project File - Name="HashEd" - Package Owner=<4> 2 | # Microsoft Developer Studio Generated Build File, Format Version 6.00 3 | # ** DO NOT EDIT ** 4 | 5 | # TARGTYPE "Win32 (x86) Application" 0x0101 6 | 7 | CFG=HashEd - Win32 Debug 8 | !MESSAGE This is not a valid makefile. To build this project using NMAKE, 9 | !MESSAGE use the Export Makefile command and run 10 | !MESSAGE 11 | !MESSAGE NMAKE /f "HashEd.mak". 12 | !MESSAGE 13 | !MESSAGE You can specify a configuration when running NMAKE 14 | !MESSAGE by defining the macro CFG on the command line. For example: 15 | !MESSAGE 16 | !MESSAGE NMAKE /f "HashEd.mak" CFG="HashEd - Win32 Debug" 17 | !MESSAGE 18 | !MESSAGE Possible choices for configuration are: 19 | !MESSAGE 20 | !MESSAGE "HashEd - Win32 Release" (based on "Win32 (x86) Application") 21 | !MESSAGE "HashEd - Win32 Debug" (based on "Win32 (x86) Application") 22 | !MESSAGE 23 | 24 | # Begin Project 25 | # PROP AllowPerConfigDependencies 0 26 | # PROP Scc_ProjName "" 27 | # PROP Scc_LocalPath "" 28 | CPP=cl.exe 29 | MTL=midl.exe 30 | RSC=rc.exe 31 | 32 | !IF "$(CFG)" == "HashEd - Win32 Release" 33 | 34 | # PROP BASE Use_MFC 6 35 | # PROP BASE Use_Debug_Libraries 0 36 | # PROP BASE Output_Dir "Release" 37 | # PROP BASE Intermediate_Dir "Release" 38 | # PROP BASE Target_Dir "" 39 | # PROP Use_MFC 5 40 | # PROP Use_Debug_Libraries 0 41 | # PROP Output_Dir "Release" 42 | # PROP Intermediate_Dir "Release" 43 | # PROP Ignore_Export_Lib 0 44 | # PROP Target_Dir "" 45 | # ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c 46 | # ADD CPP /nologo /W3 /GX /O2 /I "..\..\libchewing\branches\win32\include" /I "..\Include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c 47 | # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 48 | # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 49 | # ADD BASE RSC /l 0x404 /d "NDEBUG" /d "_AFXDLL" 50 | # ADD RSC /l 0x404 /d "NDEBUG" 51 | BSC32=bscmake.exe 52 | # ADD BASE BSC32 /nologo 53 | # ADD BSC32 /nologo 54 | LINK32=link.exe 55 | # ADD BASE LINK32 /nologo /subsystem:windows /machine:I386 56 | # ADD LINK32 comctl32.lib kernel32.lib user32.lib comdlg32.lib shell32.lib /nologo /subsystem:windows /map /machine:I386 /out:"Release/PhraseEd.exe" 57 | # SUBTRACT LINK32 /debug /nodefaultlib 58 | 59 | !ELSEIF "$(CFG)" == "HashEd - Win32 Debug" 60 | 61 | # PROP BASE Use_MFC 6 62 | # PROP BASE Use_Debug_Libraries 1 63 | # PROP BASE Output_Dir "Debug" 64 | # PROP BASE Intermediate_Dir "Debug" 65 | # PROP BASE Target_Dir "" 66 | # PROP Use_MFC 6 67 | # PROP Use_Debug_Libraries 1 68 | # PROP Output_Dir "Debug" 69 | # PROP Intermediate_Dir "Debug" 70 | # PROP Ignore_Export_Lib 0 71 | # PROP Target_Dir "" 72 | # ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c 73 | # ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\libchewing\branches\win32\include" /I "..\Include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /FR /FD /GZ /c 74 | # SUBTRACT CPP /YX /Yc /Yu 75 | # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 76 | # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 77 | # ADD BASE RSC /l 0x404 /d "_DEBUG" /d "_AFXDLL" 78 | # ADD RSC /l 0x404 /d "_DEBUG" /d "_AFXDLL" 79 | BSC32=bscmake.exe 80 | # ADD BASE BSC32 /nologo 81 | # ADD BSC32 /nologo 82 | LINK32=link.exe 83 | # ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept 84 | # ADD LINK32 comctl32.lib kernel32.lib user32.lib comdlg32.lib shell32.lib /nologo /subsystem:windows /debug /machine:I386 /out:"Debug/PhraseEd.exe" /pdbtype:sept 85 | 86 | !ENDIF 87 | 88 | # Begin Target 89 | 90 | # Name "HashEd - Win32 Release" 91 | # Name "HashEd - Win32 Debug" 92 | # Begin Group "Source Files" 93 | 94 | # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" 95 | # Begin Source File 96 | 97 | SOURCE=.\CHashContext.cpp 98 | 99 | !IF "$(CFG)" == "HashEd - Win32 Release" 100 | 101 | !ELSEIF "$(CFG)" == "HashEd - Win32 Debug" 102 | 103 | # SUBTRACT CPP /YX /Yc /Yu 104 | 105 | !ENDIF 106 | 107 | # End Source File 108 | # Begin Source File 109 | 110 | SOURCE=..\..\libchewing\branches\win32\src\hash.c 111 | 112 | !IF "$(CFG)" == "HashEd - Win32 Release" 113 | 114 | # SUBTRACT CPP /YX /Yc /Yu 115 | 116 | !ELSEIF "$(CFG)" == "HashEd - Win32 Debug" 117 | 118 | !ENDIF 119 | 120 | # End Source File 121 | # Begin Source File 122 | 123 | SOURCE=.\HashEd.cpp 124 | # End Source File 125 | # Begin Source File 126 | 127 | SOURCE=.\HashEd.rc 128 | # End Source File 129 | # Begin Source File 130 | 131 | SOURCE=.\HashEdDlg.cpp 132 | # End Source File 133 | # Begin Source File 134 | 135 | SOURCE=.\StdAfx.cpp 136 | # ADD CPP /Yc"stdafx.h" 137 | # End Source File 138 | # End Group 139 | # Begin Group "Header Files" 140 | 141 | # PROP Default_Filter "h;hpp;hxx;hm;inl" 142 | # Begin Source File 143 | 144 | SOURCE=.\CHashContext.h 145 | # End Source File 146 | # Begin Source File 147 | 148 | SOURCE=.\HashEd.h 149 | # End Source File 150 | # Begin Source File 151 | 152 | SOURCE=.\HashEdDlg.h 153 | # End Source File 154 | # Begin Source File 155 | 156 | SOURCE=.\Resource.h 157 | # End Source File 158 | # Begin Source File 159 | 160 | SOURCE=.\StdAfx.h 161 | # End Source File 162 | # End Group 163 | # Begin Group "Resource Files" 164 | 165 | # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" 166 | # Begin Source File 167 | 168 | SOURCE=.\res\HashEd.ico 169 | # End Source File 170 | # Begin Source File 171 | 172 | SOURCE=.\res\HashEd.rc2 173 | # End Source File 174 | # Begin Source File 175 | 176 | SOURCE=.\icon.bmp 177 | # End Source File 178 | # End Group 179 | # Begin Source File 180 | 181 | SOURCE=.\ReadMe.txt 182 | # End Source File 183 | # End Target 184 | # End Project 185 | -------------------------------------------------------------------------------- /HashEd-UTF8/HashEd.dsp: -------------------------------------------------------------------------------- 1 | # Microsoft Developer Studio Project File - Name="HashEd" - Package Owner=<4> 2 | # Microsoft Developer Studio Generated Build File, Format Version 6.00 3 | # ** DO NOT EDIT ** 4 | 5 | # TARGTYPE "Win32 (x86) Application" 0x0101 6 | 7 | CFG=HashEd - Win32 Debug 8 | !MESSAGE This is not a valid makefile. To build this project using NMAKE, 9 | !MESSAGE use the Export Makefile command and run 10 | !MESSAGE 11 | !MESSAGE NMAKE /f "HashEd.mak". 12 | !MESSAGE 13 | !MESSAGE You can specify a configuration when running NMAKE 14 | !MESSAGE by defining the macro CFG on the command line. For example: 15 | !MESSAGE 16 | !MESSAGE NMAKE /f "HashEd.mak" CFG="HashEd - Win32 Debug" 17 | !MESSAGE 18 | !MESSAGE Possible choices for configuration are: 19 | !MESSAGE 20 | !MESSAGE "HashEd - Win32 Release" (based on "Win32 (x86) Application") 21 | !MESSAGE "HashEd - Win32 Debug" (based on "Win32 (x86) Application") 22 | !MESSAGE 23 | 24 | # Begin Project 25 | # PROP AllowPerConfigDependencies 0 26 | # PROP Scc_ProjName "" 27 | # PROP Scc_LocalPath "" 28 | CPP=cl.exe 29 | MTL=midl.exe 30 | RSC=rc.exe 31 | 32 | !IF "$(CFG)" == "HashEd - Win32 Release" 33 | 34 | # PROP BASE Use_MFC 6 35 | # PROP BASE Use_Debug_Libraries 0 36 | # PROP BASE Output_Dir "Release" 37 | # PROP BASE Intermediate_Dir "Release" 38 | # PROP BASE Target_Dir "" 39 | # PROP Use_MFC 5 40 | # PROP Use_Debug_Libraries 0 41 | # PROP Output_Dir "Release" 42 | # PROP Intermediate_Dir "Release" 43 | # PROP Ignore_Export_Lib 0 44 | # PROP Target_Dir "" 45 | # ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c 46 | # ADD CPP /nologo /W3 /GX /O2 /I "..\..\libchewing\branches\win32\include" /I "..\Include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c 47 | # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 48 | # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 49 | # ADD BASE RSC /l 0x404 /d "NDEBUG" /d "_AFXDLL" 50 | # ADD RSC /l 0x404 /d "NDEBUG" 51 | BSC32=bscmake.exe 52 | # ADD BASE BSC32 /nologo 53 | # ADD BSC32 /nologo 54 | LINK32=link.exe 55 | # ADD BASE LINK32 /nologo /subsystem:windows /machine:I386 56 | # ADD LINK32 comctl32.lib kernel32.lib user32.lib comdlg32.lib shell32.lib /nologo /subsystem:windows /map /machine:I386 /out:"Release/PhraseEd.exe" 57 | # SUBTRACT LINK32 /debug /nodefaultlib 58 | 59 | !ELSEIF "$(CFG)" == "HashEd - Win32 Debug" 60 | 61 | # PROP BASE Use_MFC 6 62 | # PROP BASE Use_Debug_Libraries 1 63 | # PROP BASE Output_Dir "Debug" 64 | # PROP BASE Intermediate_Dir "Debug" 65 | # PROP BASE Target_Dir "" 66 | # PROP Use_MFC 6 67 | # PROP Use_Debug_Libraries 1 68 | # PROP Output_Dir "Debug" 69 | # PROP Intermediate_Dir "Debug" 70 | # PROP Ignore_Export_Lib 0 71 | # PROP Target_Dir "" 72 | # ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c 73 | # ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\libchewing\branches\win32\include" /I "..\Include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /FR /FD /GZ /c 74 | # SUBTRACT CPP /YX /Yc /Yu 75 | # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 76 | # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 77 | # ADD BASE RSC /l 0x404 /d "_DEBUG" /d "_AFXDLL" 78 | # ADD RSC /l 0x404 /d "_DEBUG" /d "_AFXDLL" 79 | BSC32=bscmake.exe 80 | # ADD BASE BSC32 /nologo 81 | # ADD BSC32 /nologo 82 | LINK32=link.exe 83 | # ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept 84 | # ADD LINK32 comctl32.lib kernel32.lib user32.lib comdlg32.lib shell32.lib /nologo /subsystem:windows /debug /machine:I386 /out:"Debug/PhraseEd.exe" /pdbtype:sept 85 | 86 | !ENDIF 87 | 88 | # Begin Target 89 | 90 | # Name "HashEd - Win32 Release" 91 | # Name "HashEd - Win32 Debug" 92 | # Begin Group "Source Files" 93 | 94 | # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" 95 | # Begin Source File 96 | 97 | SOURCE=.\CHashContext.cpp 98 | 99 | !IF "$(CFG)" == "HashEd - Win32 Release" 100 | 101 | !ELSEIF "$(CFG)" == "HashEd - Win32 Debug" 102 | 103 | # SUBTRACT CPP /YX /Yc /Yu 104 | 105 | !ENDIF 106 | 107 | # End Source File 108 | # Begin Source File 109 | 110 | SOURCE=..\..\libchewing\branches\win32\src\hash.c 111 | 112 | !IF "$(CFG)" == "HashEd - Win32 Release" 113 | 114 | # SUBTRACT CPP /YX /Yc /Yu 115 | 116 | !ELSEIF "$(CFG)" == "HashEd - Win32 Debug" 117 | 118 | !ENDIF 119 | 120 | # End Source File 121 | # Begin Source File 122 | 123 | SOURCE=.\HashEd.cpp 124 | # End Source File 125 | # Begin Source File 126 | 127 | SOURCE=.\HashEd.rc 128 | # End Source File 129 | # Begin Source File 130 | 131 | SOURCE=.\HashEdDlg.cpp 132 | # End Source File 133 | # Begin Source File 134 | 135 | SOURCE=.\StdAfx.cpp 136 | # ADD CPP /Yc"stdafx.h" 137 | # End Source File 138 | # End Group 139 | # Begin Group "Header Files" 140 | 141 | # PROP Default_Filter "h;hpp;hxx;hm;inl" 142 | # Begin Source File 143 | 144 | SOURCE=.\CHashContext.h 145 | # End Source File 146 | # Begin Source File 147 | 148 | SOURCE=.\HashEd.h 149 | # End Source File 150 | # Begin Source File 151 | 152 | SOURCE=.\HashEdDlg.h 153 | # End Source File 154 | # Begin Source File 155 | 156 | SOURCE=.\Resource.h 157 | # End Source File 158 | # Begin Source File 159 | 160 | SOURCE=.\StdAfx.h 161 | # End Source File 162 | # End Group 163 | # Begin Group "Resource Files" 164 | 165 | # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" 166 | # Begin Source File 167 | 168 | SOURCE=.\res\HashEd.ico 169 | # End Source File 170 | # Begin Source File 171 | 172 | SOURCE=.\res\HashEd.rc2 173 | # End Source File 174 | # Begin Source File 175 | 176 | SOURCE=.\icon.bmp 177 | # End Source File 178 | # End Group 179 | # Begin Source File 180 | 181 | SOURCE=.\ReadMe.txt 182 | # End Source File 183 | # End Target 184 | # End Project 185 | -------------------------------------------------------------------------------- /common/pipe.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "pipe.h" 4 | 5 | 6 | 7 | #define PIPE_MAX_BUFFER_SZ 64 8 | #define PIPE_NAME_PREFIX "LIBCHEWING_WIN32_PIPE_" 9 | 10 | 11 | 12 | class PipeImpl 13 | { 14 | public: 15 | static HANDLE create(char *name); 16 | 17 | static HANDLE open(char *name); 18 | 19 | static unsigned int send_and_read(HANDLE h, char *data, unsigned int dlen, char *buffer, unsigned int blen, BOOL &isMoreData); 20 | 21 | static unsigned int write(HANDLE h, char *dat, unsigned int sz); 22 | 23 | static unsigned int read(HANDLE h, char *buf, unsigned int sz, BOOL &isMoreData); 24 | 25 | static void get_pipe_name(char *buf, unsigned int len); 26 | 27 | static void disconnect(HANDLE h); 28 | 29 | static BOOL fetch(HANDLE h); 30 | 31 | static void close(HANDLE h); 32 | }; 33 | 34 | HANDLE PipeImpl::create(char *name) 35 | { 36 | return 37 | CreateNamedPipe( 38 | name, 39 | PIPE_ACCESS_DUPLEX, 40 | PIPE_TYPE_MESSAGE|PIPE_READMODE_MESSAGE|PIPE_WAIT, 41 | PIPE_UNLIMITED_INSTANCES, 42 | PIPE_MAX_BUFFER_SZ, 43 | PIPE_MAX_BUFFER_SZ, 44 | NMPWAIT_USE_DEFAULT_WAIT, 45 | NULL); 46 | } 47 | 48 | HANDLE PipeImpl::open(char *n) 49 | { 50 | HANDLE h = INVALID_HANDLE_VALUE; 51 | int lop = 0; 52 | 53 | while ( lop<3 ) { 54 | h = CreateFile(n, GENERIC_READ|GENERIC_WRITE, 0, 55 | NULL, OPEN_EXISTING, 0, NULL); 56 | if ( INVALID_HANDLE_VALUE!=h ) { 57 | DWORD m = PIPE_READMODE_MESSAGE|PIPE_WAIT; 58 | if ( TRUE==SetNamedPipeHandleState(h, &m, NULL, NULL) ) { 59 | break; 60 | } 61 | 62 | CloseHandle(h); 63 | h = INVALID_HANDLE_VALUE; 64 | } 65 | else if ( FALSE==WaitNamedPipe(n, 5000) ) { 66 | break; 67 | } 68 | lop++; 69 | }; 70 | 71 | return h; 72 | } 73 | 74 | unsigned int PipeImpl::send_and_read(HANDLE h, 75 | char *data, unsigned int dlen, 76 | char *buffer, unsigned int blen, 77 | BOOL &isMoreData) 78 | { 79 | unsigned int szo = 0; 80 | isMoreData = FALSE; 81 | if ( 0==TransactNamedPipe(h, (LPVOID) data, dlen, 82 | (LPVOID) buffer, blen, (LPDWORD) &szo, NULL) ) 83 | { 84 | szo = GetLastError(); 85 | if ( ERROR_MORE_DATA==szo ) { 86 | isMoreData = TRUE; 87 | } 88 | szo = 0; 89 | } 90 | return szo; 91 | } 92 | 93 | unsigned int PipeImpl::write(HANDLE h, char *dat, unsigned int sz) 94 | { 95 | if ( NULL==dat || 0==sz ) { 96 | return FALSE; 97 | } 98 | 99 | DWORD wlen = 0; 100 | BOOL br = TRUE; 101 | WriteFile(h, dat, sz, &wlen, NULL); 102 | FlushFileBuffers(h); 103 | return wlen; 104 | } 105 | 106 | unsigned int PipeImpl::read(HANDLE h, char *buf, unsigned int sz, BOOL &isMoreData) 107 | { 108 | BOOL br = FALSE; 109 | DWORD rlen = 0; 110 | 111 | isMoreData = FALSE; 112 | br = ReadFile(h, buf, sz, &rlen, NULL); 113 | if ( FALSE==br || 0==rlen ) { 114 | rlen = 0; 115 | } 116 | return rlen; 117 | } 118 | 119 | void PipeImpl::get_pipe_name(char *buf, unsigned int len) 120 | { 121 | char tc[MAX_PATH], tu[MAX_PATH]; 122 | DWORD tlen; 123 | 124 | tlen = sizeof(tc); 125 | if ( FALSE==GetComputerName(tc, &tlen) ) { 126 | strncpy(tc, "unknown_com", sizeof(tc)); 127 | tc[sizeof(tc)-1] = '\0'; 128 | } 129 | 130 | tlen = sizeof(tu); 131 | if ( FALSE==GetUserName(tu, &tlen) ) { 132 | strncpy(tu, "unknown_user", sizeof(tu)); 133 | tc[sizeof(tu)-1] = '\0'; 134 | } 135 | 136 | _snprintf(buf, len, "\\\\.\\pipe\\%s_%s_%s", PIPE_NAME_PREFIX, tc, tu); 137 | buf[len-1] = '\0'; 138 | } 139 | 140 | void PipeImpl::disconnect(HANDLE h) 141 | { 142 | if ( INVALID_HANDLE_VALUE!=h ) { 143 | DisconnectNamedPipe(h); 144 | } 145 | } 146 | 147 | void PipeImpl::close(HANDLE h) 148 | { 149 | if ( INVALID_HANDLE_VALUE!=h ) { 150 | CloseHandle(h); 151 | } 152 | } 153 | 154 | BOOL PipeImpl::fetch(HANDLE h) 155 | { 156 | return ConnectNamedPipe(h, NULL) 157 | ? TRUE : (GetLastError()==ERROR_PIPE_CONNECTED); 158 | } 159 | 160 | ChewingPipeServ::ChewingPipeServ() 161 | { 162 | char name[MAX_PATH]; 163 | 164 | PipeImpl::get_pipe_name(name, sizeof(name)); 165 | _h = PipeImpl::create(name); 166 | } 167 | 168 | ChewingPipeServ::~ChewingPipeServ() 169 | { 170 | PipeImpl::close(_h); 171 | } 172 | 173 | BOOL ChewingPipeServ::fetch() 174 | { 175 | return PipeImpl::fetch(_h); 176 | } 177 | 178 | BOOL ChewingPipeServ::read() 179 | { 180 | BOOL bl = FALSE; 181 | _szd = PipeImpl::read(_h, (char*)_d, sizeof(_d), bl); 182 | if ( sizeof(_d)!=_szd ) { 183 | return FALSE; 184 | } 185 | return TRUE; 186 | } 187 | 188 | BOOL ChewingPipeServ::reply(unsigned int dat) 189 | { 190 | unsigned int len = PipeImpl::write(_h, (char*)&dat, sizeof(dat)); 191 | if ( sizeof(dat)!=len ) { 192 | return FALSE; 193 | } 194 | return TRUE; 195 | } 196 | 197 | BOOL ChewingPipeServ::get_param(unsigned int &session, unsigned int &cmd, unsigned int &dat) 198 | { 199 | if ( sizeof(_d)!=_szd ) { 200 | return FALSE; 201 | } 202 | 203 | session = _d[0]; 204 | cmd = _d[1]; 205 | dat = _d[2]; 206 | return TRUE; 207 | } 208 | 209 | void ChewingPipeServ::disconnect() 210 | { 211 | PipeImpl::disconnect(_h); 212 | } 213 | 214 | unsigned int ChewingPipeClnt::SendMessageReply(unsigned int session, unsigned int cmd, unsigned int dat) 215 | { 216 | if ( INVALID_HANDLE_VALUE==_h ) { 217 | return 0; 218 | } 219 | 220 | BOOL bl = FALSE; 221 | unsigned int d[3], ret=0, len=0; 222 | d[0] = session; 223 | d[1] = cmd; 224 | d[2] = dat; 225 | 226 | len = PipeImpl::send_and_read(_h, (char*)d, sizeof(d), (char*)&ret, 227 | sizeof(ret), bl); 228 | if ( sizeof(ret)!=len ) { 229 | return 0; 230 | } 231 | return ret; 232 | } 233 | 234 | ChewingPipeClnt::ChewingPipeClnt() 235 | { 236 | PipeImpl::get_pipe_name(_n, sizeof(_n)); 237 | _h = PipeImpl::open(_n); 238 | } 239 | 240 | ChewingPipeClnt::~ChewingPipeClnt() 241 | { 242 | PipeImpl::disconnect(_h); 243 | PipeImpl::close(_h); 244 | } 245 | 246 | -------------------------------------------------------------------------------- /ChewingServer/ChewingServer.dsp: -------------------------------------------------------------------------------- 1 | # Microsoft Developer Studio Project File - Name="ChewingServer" - Package Owner=<4> 2 | # Microsoft Developer Studio Generated Build File, Format Version 6.00 3 | # ** DO NOT EDIT ** 4 | 5 | # TARGTYPE "Win32 (x86) Application" 0x0101 6 | 7 | CFG=ChewingServer - Win32 Debug 8 | !MESSAGE This is not a valid makefile. To build this project using NMAKE, 9 | !MESSAGE use the Export Makefile command and run 10 | !MESSAGE 11 | !MESSAGE NMAKE /f "ChewingServer.mak". 12 | !MESSAGE 13 | !MESSAGE You can specify a configuration when running NMAKE 14 | !MESSAGE by defining the macro CFG on the command line. For example: 15 | !MESSAGE 16 | !MESSAGE NMAKE /f "ChewingServer.mak" CFG="ChewingServer - Win32 Debug" 17 | !MESSAGE 18 | !MESSAGE Possible choices for configuration are: 19 | !MESSAGE 20 | !MESSAGE "ChewingServer - Win32 Release" (based on "Win32 (x86) Application") 21 | !MESSAGE "ChewingServer - Win32 Debug" (based on "Win32 (x86) Application") 22 | !MESSAGE 23 | 24 | # Begin Project 25 | # PROP AllowPerConfigDependencies 0 26 | # PROP Scc_ProjName "" 27 | # PROP Scc_LocalPath "" 28 | CPP=cl.exe 29 | MTL=midl.exe 30 | RSC=rc.exe 31 | 32 | !IF "$(CFG)" == "ChewingServer - Win32 Release" 33 | 34 | # PROP BASE Use_MFC 0 35 | # PROP BASE Use_Debug_Libraries 0 36 | # PROP BASE Output_Dir "Release" 37 | # PROP BASE Intermediate_Dir "Release" 38 | # PROP BASE Target_Dir "" 39 | # PROP Use_MFC 0 40 | # PROP Use_Debug_Libraries 0 41 | # PROP Output_Dir "Release" 42 | # PROP Intermediate_Dir "Release" 43 | # PROP Ignore_Export_Lib 0 44 | # PROP Target_Dir "" 45 | # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c 46 | # ADD CPP /nologo /W3 /GX /O2 /I "..\..\libchewing\branches\win32\include" /I "..\Include" /D "NDEBUG" /D "USE_BINARY_DAT" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "DISABLE_ATEXIT" /FR /YX /FD /c 47 | # SUBTRACT CPP /Z 48 | # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 49 | # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 50 | # ADD BASE RSC /l 0x404 /d "NDEBUG" 51 | # ADD RSC /l 0x404 /d "NDEBUG" 52 | BSC32=bscmake.exe 53 | # ADD BASE BSC32 /nologo 54 | # ADD BSC32 /nologo 55 | LINK32=link.exe 56 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 57 | # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /map /machine:I386 58 | # SUBTRACT LINK32 /debug 59 | 60 | !ELSEIF "$(CFG)" == "ChewingServer - Win32 Debug" 61 | 62 | # PROP BASE Use_MFC 0 63 | # PROP BASE Use_Debug_Libraries 1 64 | # PROP BASE Output_Dir "Debug" 65 | # PROP BASE Intermediate_Dir "Debug" 66 | # PROP BASE Target_Dir "" 67 | # PROP Use_MFC 0 68 | # PROP Use_Debug_Libraries 1 69 | # PROP Output_Dir "Debug" 70 | # PROP Intermediate_Dir "Debug" 71 | # PROP Ignore_Export_Lib 0 72 | # PROP Target_Dir "" 73 | # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c 74 | # ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\libchewing\branches\win32\include" /I "..\Include" /D "_DEBUG" /D "USE_BINARY_DAT" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "DISABLE_ATEXIT" /FR /YX /FD /GZ /c 75 | # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 76 | # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 77 | # ADD BASE RSC /l 0x404 /d "_DEBUG" 78 | # ADD RSC /l 0x404 /d "_DEBUG" 79 | BSC32=bscmake.exe 80 | # ADD BASE BSC32 /nologo 81 | # ADD BSC32 /nologo 82 | LINK32=link.exe 83 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept 84 | # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept 85 | 86 | !ENDIF 87 | 88 | # Begin Target 89 | 90 | # Name "ChewingServer - Win32 Release" 91 | # Name "ChewingServer - Win32 Debug" 92 | # Begin Group "Source Files" 93 | 94 | # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" 95 | # Begin Source File 96 | 97 | SOURCE=..\..\libchewing\branches\win32\src\char.c 98 | # End Source File 99 | # Begin Source File 100 | 101 | SOURCE=.\chewing.cpp 102 | # End Source File 103 | # Begin Source File 104 | 105 | SOURCE=..\..\libchewing\branches\win32\src\chewingio.c 106 | # End Source File 107 | # Begin Source File 108 | 109 | SOURCE=.\ChewingServer.cpp 110 | # End Source File 111 | # Begin Source File 112 | 113 | SOURCE=..\..\libchewing\branches\win32\src\chewingutil.c 114 | # End Source File 115 | # Begin Source File 116 | 117 | SOURCE=..\..\libchewing\branches\win32\src\choice.c 118 | # End Source File 119 | # Begin Source File 120 | 121 | SOURCE=..\..\libchewing\branches\win32\src\dict.c 122 | # End Source File 123 | # Begin Source File 124 | 125 | SOURCE=..\..\libchewing\branches\win32\src\hanyupinying.c 126 | # End Source File 127 | # Begin Source File 128 | 129 | SOURCE=..\..\libchewing\branches\win32\src\hash.c 130 | # End Source File 131 | # Begin Source File 132 | 133 | SOURCE=..\..\libchewing\branches\win32\src\common\key2pho.c 134 | # End Source File 135 | # Begin Source File 136 | 137 | SOURCE=.\main.cpp 138 | # End Source File 139 | # Begin Source File 140 | 141 | SOURCE=..\..\libchewing\branches\win32\src\tree.c 142 | 143 | !IF "$(CFG)" == "ChewingServer - Win32 Release" 144 | 145 | # ADD CPP /FAs 146 | 147 | !ELSEIF "$(CFG)" == "ChewingServer - Win32 Debug" 148 | 149 | !ENDIF 150 | 151 | # End Source File 152 | # Begin Source File 153 | 154 | SOURCE=..\..\libchewing\branches\win32\src\userphrase.c 155 | # End Source File 156 | # Begin Source File 157 | 158 | SOURCE=..\..\libchewing\branches\win32\src\zuin.c 159 | # End Source File 160 | # End Group 161 | # Begin Group "Header Files" 162 | 163 | # PROP Default_Filter "h;hpp;hxx;hm;inl" 164 | # Begin Source File 165 | 166 | SOURCE=..\..\libchewing\branches\win32\src\private.h 167 | # End Source File 168 | # End Group 169 | # Begin Group "Resource Files" 170 | 171 | # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" 172 | # End Group 173 | # Begin Source File 174 | 175 | SOURCE=.\ReadMe.txt 176 | # End Source File 177 | # End Target 178 | # End Project 179 | -------------------------------------------------------------------------------- /ChewingIME/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by ChewingIME.rc 4 | // 5 | #define IDI_ICON 5 6 | #define IDC_STATUS_TB 20 7 | #define IDI_ICON1 101 8 | #define ID_CHI_ENG 101 9 | #define ID_FULL_HALF 102 10 | #define IDI_ICON2 102 11 | #define ID_CONFIG 103 12 | #define IDS_CONFIGTIELE 104 13 | #define ID_MENU 105 14 | #define IDI_CONFIG 119 15 | #define IDI_CHI 120 16 | #define IDR_POPUP 120 17 | #define IDI_ENG 121 18 | #define IDD_ABOUT 121 19 | #define IDI_FULL 122 20 | #define IDB_COOL 122 21 | #define IDI_HALF 123 22 | #define IDD_UI 124 23 | #define IDD_TYPING 125 24 | #define IDD_UPDATE 126 25 | #define IDD_SYMBOLS 127 26 | #define IDD_DIALOG1 135 27 | #define IDD_KEYBOARD 135 28 | #define IDD_EZ_SYMBOLS 136 29 | #define IDC_KB1 1001 30 | #define IDC_KB2 1002 31 | #define IDC_KB3 1003 32 | #define IDC_KB4 1004 33 | #define IDC_KB5 1005 34 | #define IDC_KB6 1006 35 | #define IDC_KB7 1007 36 | #define IDC_KB8 1008 37 | #define IDC_BUTTON1 1009 38 | #define IDC_KB9 1009 39 | #define IDC_SELKEY_COLOR 1009 40 | #define IDC_CAND_PER_ROW 1010 41 | #define IDC_BUTTON2 1010 42 | #define IDC_CAND_PER_ROW_SPIN 1011 43 | #define IDC_BUTTON3 1011 44 | #define IDC_CAND_PER_PAGE 1012 45 | #define IDC_BUTTON4 1012 46 | #define IDC_DEFAULT_ENG 1013 47 | #define IDC_BUTTON5 1013 48 | #define IDC_COMBO1 1014 49 | #define IDC_SELKEYS 1014 50 | #define IDC_BUTTON6 1014 51 | #define IDC_SHIFT_CAPITAL 1015 52 | #define IDC_BUTTON7 1015 53 | #define IDC_SPACESEL 1016 54 | #define IDC_CAND_COLOR2 1016 55 | #define IDC_BUTTON8 1016 56 | #define IDC_FIX_COMPWND 1017 57 | #define IDC_BUTTON9 1017 58 | #define IDC_ADD_PHRASE_FORWARD 1018 59 | #define IDC_BUTTON10 1018 60 | #define IDC_HIDE_STATUSWND 1019 61 | #define IDC_BUTTON11 1019 62 | #define IDC_DEFAULT_FS 1020 63 | #define IDC_BUTTON12 1020 64 | #define IDC_ENABLE_SHIFT 1021 65 | #define IDC_BUTTON13 1021 66 | #define IDC_CAND_PER_PAGE_SPIN 1022 67 | #define IDC_BUTTON14 1022 68 | #define IDC_COLOR_CANDIDATE 1023 69 | #define IDC_BUTTON15 1023 70 | #define IDC_BLOCK_CURSOR 1024 71 | #define IDC_BUTTON16 1024 72 | #define IDC_ADV_AFTER_SEL 1025 73 | #define IDC_BUTTON17 1025 74 | #define IDC_FONT_SIZE 1026 75 | #define IDC_BUTTON18 1026 76 | #define IDC_ADV_AFTER_SEL2 1026 77 | #define IDC_SHIFT_SYMBOL 1026 78 | #define IDC_COMP_FONT 1027 79 | #define IDC_BUTTON19 1027 80 | #define IDC_SHIFT_SYMBOL2 1027 81 | #define IDC_CTRL_SYMBOL 1027 82 | #define IDC_FONT_SIZE_SPIN 1028 83 | #define IDC_BUTTON20 1028 84 | #define IDC_ENABLE_Simp 1028 85 | #define IDC_CURSOR_CANDLIST 1029 86 | #define IDC_BUTTON21 1029 87 | #define IDC_ENABLE_CAPSLOCK 1030 88 | #define IDC_BUTTON22 1030 89 | #define IDC_SHIFT_FULLSHAPE 1031 90 | #define IDC_BUTTON23 1031 91 | #define IDC_CHECK1 1032 92 | #define IDC_PHRASE_MARK 1032 93 | #define IDC_CHECK_NEW_VERSION 1032 94 | #define IDC_BUTTON24 1032 95 | #define IDC_CHECK2 1033 96 | #define IDC_ESC_CLEAN_ALL_BUF 1033 97 | #define IDC_EDIT 1037 98 | #define IDC_EZEDIT 1038 99 | #define IDC_BUTTON25 1053 100 | #define IDC_BUTTON26 1054 101 | #define IDC_BUTTON27 1055 102 | #define IDC_BUTTON28 1056 103 | #define IDC_BUTTON29 1057 104 | #define IDC_BUTTON30 1058 105 | #define IDC_BUTTON31 1059 106 | #define IDC_BUTTON32 1060 107 | #define IDC_BUTTON33 1061 108 | #define IDC_BUTTON35 1063 109 | #define IDC_BUTTON36 1064 110 | #define IDC_BUTTON37 1065 111 | #define IDC_BUTTON38 1066 112 | #define IDC_BUTTON39 1067 113 | #define IDC_BUTTON40 1068 114 | #define IDC_BUTTON41 1069 115 | #define IDC_BUTTON42 1073 116 | #define IDC_BUTTON43 1074 117 | #define ID_ABOUT 40001 118 | #define ID_WEBSITE 40002 119 | #define ID_GROUP 40003 120 | #define ID_DICT_BUGREPORT 40005 121 | #define ID_BUGREPORT 40006 122 | #define ID_CHEWING_HELP 40009 123 | #define ID_DICT 40015 124 | #define ID_SIMPDICT 40016 125 | #define ID_LITTLEDICT 40017 126 | #define ID_PROVERBDICT 40018 127 | #define ID_HASHED 40022 128 | #define ID_CHECK_NEW_VER 40025 129 | #define ID_EDIT_UNDO 40032 130 | #define ID_EDIT_CUT 40033 131 | #define ID_EDIT_COPY 40034 132 | #define ID_EDIT_PASTE 40035 133 | #define ID_EDIT_DELETE 40036 134 | #define ID_EDIT_SELALL 40037 135 | 136 | // Next default values for new objects 137 | // 138 | #ifdef APSTUDIO_INVOKED 139 | #ifndef APSTUDIO_READONLY_SYMBOLS 140 | #define _APS_NEXT_RESOURCE_VALUE 136 141 | #define _APS_NEXT_COMMAND_VALUE 40038 142 | #define _APS_NEXT_CONTROL_VALUE 1039 143 | #define _APS_NEXT_SYMED_VALUE 106 144 | #endif 145 | #endif 146 | -------------------------------------------------------------------------------- /ChewingServer/ChewingServerUTF8.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | 28 | 31 | 34 | 37 | 40 | 49 | 69 | 72 | 77 | 80 | 92 | 95 | 98 | 101 | 104 | 107 | 110 | 113 | 114 | 124 | 127 | 130 | 133 | 136 | 145 | 165 | 168 | 173 | 176 | 192 | 195 | 198 | 201 | 204 | 207 | 210 | 213 | 214 | 215 | 216 | 217 | 218 | 222 | 225 | 226 | 229 | 230 | 233 | 234 | 237 | 238 | 239 | 243 | 246 | 247 | 250 | 251 | 252 | 256 | 257 | 260 | 261 | 262 | 263 | 264 | 265 | -------------------------------------------------------------------------------- /ChewingIME/CompStr.cpp: -------------------------------------------------------------------------------- 1 | #include "ChewingIME.h" 2 | #include ".\compstr.h" 3 | 4 | // Disable warning on converting pointer to DWORD in VC++ 5 | #pragma warning( disable: 4244 ) 6 | 7 | CompStr::CompStr(void) 8 | { 9 | cs.dwSize = sizeof(CompStr); 10 | cs.dwDeltaStart = 0; 11 | cs.dwCursorPos = 0; 12 | 13 | cs.dwCompReadStrOffset = (BYTE*)&readStr[0] - (BYTE*)this; 14 | cs.dwCompReadStrLen = 0; 15 | memset( readStr, 0, sizeof(readStr) ); 16 | 17 | cs.dwCompReadAttrOffset = (BYTE*)&readAttr[0] - (BYTE*)this; 18 | cs.dwCompReadAttrLen = 0; 19 | memset( readAttr, 0, sizeof(readAttr) ); 20 | 21 | cs.dwCompReadClauseOffset = DWORD( (BYTE*)&readClause[0] - (BYTE*)this); 22 | cs.dwCompReadClauseLen = 0; 23 | memset( readClause, 0, sizeof(readClause) ); 24 | 25 | 26 | cs.dwCompStrOffset = (BYTE*)&compStr[0] - (BYTE*)this; 27 | cs.dwCompStrLen = 0; 28 | memset( compStr, 0, sizeof(compStr) ); 29 | 30 | cs.dwCompAttrOffset = (BYTE*)&compAttr[0] - (BYTE*)(this); 31 | cs.dwCompAttrLen = 0; 32 | memset( compAttr, 0, sizeof(compAttr) ); 33 | 34 | cs.dwCompClauseOffset = DWORD( (BYTE*) &compClause[0] - (BYTE*)this); 35 | cs.dwCompClauseLen = 0; 36 | memset( compClause, 0, sizeof(compClause) ); 37 | 38 | 39 | cs.dwResultReadStrOffset = (BYTE*)&resultReadStr[0] - (BYTE*)this; 40 | cs.dwResultReadStrLen = 0; 41 | memset( resultReadStr, 0, sizeof(resultReadStr) ); 42 | 43 | cs.dwResultReadClauseOffset = DWORD( (BYTE*)&resultReadClause[0] - (BYTE*)this); 44 | cs.dwResultReadClauseLen = 0; 45 | memset( resultReadClause, 0, sizeof(resultReadClause) ); 46 | 47 | cs.dwResultStrOffset = (BYTE*)&resultStr[0] - (BYTE*)this; 48 | cs.dwResultStrLen = 0; 49 | memset( resultStr, 0, sizeof(resultStr) ); 50 | 51 | cs.dwResultClauseOffset = DWORD( (BYTE*)&resultClause[0] - (BYTE*)this); 52 | cs.dwResultClauseLen = 0; 53 | memset( resultClause, 0, sizeof(resultClause) ); 54 | 55 | 56 | cs.dwPrivateOffset = DWORD( (BYTE*)&showMsg[0] - (BYTE*)this); 57 | cs.dwPrivateSize = sizeof(showMsg); 58 | memset( showMsg, 0, sizeof(showMsg) ); 59 | } 60 | 61 | CompStr::~CompStr(void) 62 | { 63 | } 64 | 65 | void CompStr::setCompStr(LPCWSTR comp_str) 66 | { 67 | wcscpy( compStr, comp_str ); 68 | cs.dwCompStrLen = wcslen( compStr ); 69 | cs.dwCompAttrLen = cs.dwCompStrLen; 70 | memset( (char*)compAttr, ATTR_CONVERTED, cs.dwCompAttrLen ); 71 | } 72 | 73 | void CompStr::setShowMsg(LPCWSTR show_msg) 74 | { 75 | wcscpy( showMsg, show_msg ); 76 | } 77 | 78 | void CompStr::setResultStr(LPCWSTR result_str) 79 | { 80 | if (GetVersion() < 0x80000000) 81 | { 82 | wchar_t resulttemp[256]; 83 | if (g_enableSimp) 84 | { 85 | wcscpy( resulttemp , result_str ); 86 | LCMapStringW( 87 | 0x0404, LCMAP_SIMPLIFIED_CHINESE, 88 | (LPCWSTR) resulttemp, -1, 89 | (LPWSTR) resultStr, 256); 90 | } 91 | else 92 | { 93 | wcscpy( resultStr, result_str ); 94 | } 95 | } 96 | else 97 | { 98 | wcscpy( resultStr, result_str ); 99 | } 100 | cs.dwResultStrLen = wcslen( resultStr ); 101 | cs.dwResultClauseLen = sizeof(resultClause); 102 | resultClause[0] = 0; 103 | resultClause[1] = cs.dwResultStrLen; 104 | cs.dwResultReadStrLen = 0; 105 | } 106 | 107 | void CompStr::setCursorPos(int pos) 108 | { 109 | // ATTR_INPUT Character currently being entered. 110 | // ATTR_TARGET_CONVERTED Character currently being converted (already converted). 111 | // ATTR_CONVERTED Character given from the conversion. 112 | // ATTR_TARGET_NOTCONVERTED Character currently being converted (yet to be converted). 113 | 114 | cs.dwCursorPos = pos; 115 | } 116 | 117 | void CompStr::setZuin(LPCWSTR zuin) 118 | { 119 | wcscpy( readStr, zuin ); 120 | cs.dwCompReadStrLen = wcslen(readStr); 121 | 122 | cs.dwCompReadAttrLen = cs.dwCompReadStrLen; 123 | if(cs.dwCompReadStrLen) 124 | memset( (char*)readAttr, ATTR_TARGET_NOTCONVERTED, cs.dwCompReadStrLen ); 125 | } 126 | 127 | void CompStr::beforeGenerateMsg(void) 128 | { 129 | wchar_t* sinsert = compStr + cs.dwCursorPos; 130 | 131 | memmove( sinsert + cs.dwCompReadStrLen, 132 | sinsert, sizeof(wchar_t) * (cs.dwCompStrLen - cs.dwCursorPos) ); 133 | wcsncpy( sinsert, readStr, cs.dwCompReadStrLen ); 134 | cs.dwCompStrLen += cs.dwCompReadStrLen; 135 | compStr[cs.dwCompStrLen] = '\0'; 136 | 137 | if (cs.dwCompReadAttrLen == 0 && cs.dwCompAttrLen != 0) { 138 | for (int i = 0; i+1 < cs.dwCompClauseLen; i++) 139 | if (compClause[i] <= cs.dwCursorPos && cs.dwCursorPos < compClause[i+1]) { 140 | for(int j=compClause[i]; jcompWnd.onPaint( imc, ps ); 61 | EndPaint(hwnd, &ps); 62 | break; 63 | } 64 | case WM_ERASEBKGND: 65 | return TRUE; 66 | break; 67 | case WM_LBUTTONDOWN: 68 | if( ui ) 69 | ui->compWnd.onLButtonDown(wp, lp); 70 | break; 71 | case WM_MOUSEMOVE: 72 | if( ui ) 73 | ui->compWnd.onMouseMove(wp, lp); 74 | break; 75 | case WM_LBUTTONUP: 76 | if( ui ) 77 | ui->compWnd.onLButtonUp(wp, lp); 78 | break; 79 | case WM_MOUSEACTIVATE: 80 | return MA_NOACTIVATE; 81 | default: 82 | if (!IsImeMessage(msg)) 83 | return DefWindowProc(hwnd, msg, wp, lp); 84 | } 85 | return 0; 86 | } 87 | 88 | 89 | 90 | void CompWnd::onPaint(IMCLock& imc, PAINTSTRUCT& ps) 91 | { 92 | wstring compStr = getDisplayedCompStr(imc); 93 | wstring zuin = getDisplayedZuin( imc ); 94 | int cursorPos = getDisplayedCursorPos(imc); 95 | 96 | HFONT oldFont; 97 | RECT rc; 98 | 99 | 100 | GetClientRect( hwnd, &rc ); 101 | HDC memdc = CreateCompatibleDC( ps.hdc ); 102 | HBITMAP membmp = CreateCompatibleBitmap( ps.hdc, rc.right, rc.bottom ); 103 | HGDIOBJ oldbmp = SelectObject( memdc, membmp ); 104 | 105 | HBRUSH hBrush = (HBRUSH)NULL; 106 | HBRUSH hOldBrush = (HBRUSH)NULL; 107 | HPEN hPen = (HPEN)CreatePen(PS_SOLID, (int)(rc.bottom-rc.top)/10, RGB(0, 0, 255)); 108 | HPEN hOldPen = (HPEN)SelectObject(memdc, hPen); 109 | 110 | InflateRect( &rc, -1, -1 ); 111 | 112 | oldFont = (HFONT)SelectObject(memdc, font); 113 | if( !compStr.empty() ) 114 | { 115 | SetTextColor( memdc, GetSysColor( COLOR_WINDOWTEXT ) ); 116 | SetBkColor( memdc, GetSysColor( COLOR_WINDOW ) ); 117 | ExtTextOutW( memdc, 1, 1, ETO_OPAQUE, &rc, compStr.c_str(), 118 | compStr.length(), NULL); 119 | int cursor = indexToXPos( compStr, cursorPos ); 120 | if ( g_ColoredCompCursor==false ) 121 | { 122 | BitBlt( memdc, cursor, 0, 2, rc.bottom, memdc, cursor, 0, NOTSRCCOPY ); 123 | } 124 | else 125 | { 126 | // #15235, block cursor 127 | int selend = indexToXPos( compStr, cursorPos + 1 ); 128 | int curWidth = selend - cursor; 129 | 130 | BitBlt( memdc, cursor, 0, curWidth, rc.bottom, memdc, cursor, 0, DSTINVERT ); 131 | } 132 | 133 | if( g_phraseMark ) { 134 | DWORD len = 0; 135 | DWORD* interval = getIntervalAry( imc, len ); 136 | if ( len>0 && interval!=NULL ){ 137 | for( DWORD i = 0; i < len - 1; ++i ) 138 | { 139 | if( interval[i+1] - interval[i] < 2 ) 140 | continue; 141 | MoveToEx( memdc, indexToXPos( compStr, interval[i] ) + 3, rc.bottom-2, NULL ); 142 | LineTo( memdc, indexToXPos( compStr, interval[i+1] ) - 3, rc.bottom-2 ); 143 | } 144 | } 145 | } 146 | } 147 | 148 | SelectObject(memdc, hOldPen); 149 | DeleteObject(hPen); 150 | 151 | InflateRect( &rc, 1, 1 ); 152 | Draw3DBorder( memdc, &rc, GetSysColor(COLOR_3DFACE), 0/*GetSysColor(COLOR_3DDKSHADOW)*/); 153 | 154 | BitBlt( ps.hdc, ps.rcPaint.left, ps.rcPaint.top, 155 | (ps.rcPaint.right-ps.rcPaint.left), 156 | (ps.rcPaint.bottom-ps.rcPaint.top), 157 | memdc, ps.rcPaint.left, ps.rcPaint.top, SRCCOPY); 158 | 159 | SelectObject( memdc, oldbmp ); 160 | DeleteObject( membmp ); 161 | DeleteDC( memdc ); 162 | 163 | SelectObject(memdc, oldFont); 164 | } 165 | 166 | void CompWnd::setFont(LOGFONT* lf) 167 | { 168 | LOGFONT lf2; 169 | memcpy( &lf2, lf, sizeof( lf2) ); 170 | if( g_useUnicode ) { 171 | // Convert unicode font face to ANSI encoding 172 | WideCharToMultiByte( CP_ACP, 0, (LPCWSTR)lf->lfFaceName, wcslen( (LPCWSTR)lf->lfFaceName)+1, 173 | lf2.lfFaceName, sizeof(lf2.lfFaceName), NULL, NULL ); 174 | } 175 | 176 | if( abs(lf2.lfHeight) < 16 ) 177 | lf2.lfHeight = 16; 178 | 179 | if( font ) 180 | DeleteObject( font ); 181 | 182 | font = CreateFontIndirect( &lf2 ); 183 | } 184 | 185 | void CompWnd::getSize(int* w, int* h) 186 | { 187 | HDC dc = GetDC( hwnd ); 188 | HGDIOBJ oldfont = SelectObject( dc, font ); 189 | SIZE size; 190 | wstring compStr = getDisplayedCompStr(); 191 | GetTextExtentPointW( dc, compStr.c_str(), compStr.length(), &size ); 192 | SelectObject( dc, oldfont ); 193 | ReleaseDC( hwnd, dc ); 194 | *w = size.cx + 4; 195 | *h = size.cy + 4; 196 | } 197 | 198 | /* 199 | void CompWnd::setCursorPos(int pos) 200 | { 201 | int x = indexToXPos( cursorPos ); 202 | RECT rc; 203 | GetClientRect( hwnd, &rc ); 204 | HDC dc = GetDC( hwnd ); 205 | BitBlt( dc, x, 0, 1, rc.bottom, dc, x, 0, SRCINVERT ); 206 | cursorPos = pos; 207 | x = indexToXPos( pos ); 208 | BitBlt( dc, x, 0, 1, rc.bottom, dc, x, 0, SRCINVERT ); 209 | } 210 | */ 211 | 212 | int CompWnd::indexToXPos( wstring compStr, int idx) 213 | { 214 | if( compStr.empty() || idx <=0 ) 215 | return 2; 216 | HDC dc = GetDC( hwnd ); 217 | HGDIOBJ oldfont = SelectObject( dc, font ); 218 | SIZE size; 219 | GetTextExtentPointW( dc, compStr.c_str(), idx, &size ); 220 | SelectObject( dc, oldfont ); 221 | ReleaseDC( hwnd, dc ); 222 | return size.cx + 2; 223 | } 224 | 225 | 226 | 227 | wstring CompWnd::getDisplayedCompStr(IMCLock& imc) 228 | { 229 | CompStr* compStr = imc.getCompStr(); 230 | if( compStr ) 231 | return wstring( compStr->getCompStr() ); 232 | return wstring( L"" ); 233 | } 234 | 235 | wstring CompWnd::getDisplayedZuin( IMCLock& imc ) 236 | { 237 | CompStr* compStr = imc.getCompStr(); 238 | if( compStr ) 239 | return wstring( compStr->getZuin() ); 240 | return wstring( L"" ); 241 | } 242 | 243 | int CompWnd::getDisplayedCursorPos(IMCLock& imc) 244 | { 245 | INPUTCONTEXT* ic = imc.getIC(); 246 | if( !ic ) 247 | return 0; 248 | CompStr* compStr = imc.getCompStr(); 249 | if( !compStr ) 250 | return 0; 251 | int cursorPos = compStr->getCursorPos(); 252 | return cursorPos; 253 | } 254 | 255 | bool CompWnd::create(HWND imeUIWnd) 256 | { 257 | /* RECT rc; 258 | IMCLock imc( getIMC(imeUIWnd) ); 259 | if( imc.getIC() ) 260 | IMEUI::getWorkingArea( &rc, imc.getIC()->hWnd ); 261 | rc.left += 10; 262 | rc.bottom -= 50; 263 | */ 264 | hwnd = CreateWindowEx(0, g_compWndClass, NULL, 265 | WS_POPUP|WS_CLIPCHILDREN, 266 | /*rc.left, rc.bottom*/ 0, 0, 0, 0, imeUIWnd, NULL, g_dllInst, NULL); 267 | return !!hwnd; 268 | } 269 | 270 | void CompWnd::getRelativeCandPos(IMCLock& imc, POINT* pt) 271 | { 272 | RECT rc; 273 | GetWindowRect(hwnd, &rc ); 274 | INPUTCONTEXT* ic = imc.getIC(); 275 | if(!ic) 276 | return; 277 | wstring compstr = imc.getCompStr()->getCompStr(); 278 | pt->x = indexToXPos( compstr, getDisplayedCursorPos()); 279 | pt->y = (rc.bottom - rc.top); 280 | 281 | } 282 | 283 | void CompWnd::getCandPos(IMCLock& imc, POINT* pt) 284 | { 285 | RECT rc; 286 | GetWindowRect(hwnd, &rc ); 287 | INPUTCONTEXT* ic = imc.getIC(); 288 | if(!ic) 289 | return; 290 | getRelativeCandPos(imc, pt); 291 | 292 | ic->cfCandForm->ptCurrentPos = imc.getIC()->cfCompForm.ptCurrentPos; 293 | ic->cfCandForm->ptCurrentPos.y += pt->y; 294 | ic->cfCandForm->ptCurrentPos.x += pt->x; 295 | *pt = ic->cfCandForm->ptCurrentPos; 296 | } 297 | 298 | DWORD* CompWnd::getIntervalAry( IMCLock& imc, DWORD& count ) { 299 | CompStr* compStr = imc.getCompStr(); 300 | count = compStr->getInternalLen(); 301 | return compStr->getIntervalArray(); 302 | } 303 | -------------------------------------------------------------------------------- /ChewingServer/chewing.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "Chewingpp.h" 3 | 4 | uint16 Chewing::g_lastPhoneSeq[MAX_PHONE_SEQ_LEN] = {0}; 5 | 6 | Chewing::Chewing( bool spaceAsSelection, int keyLayout ) { 7 | ctx = chewing_new(); 8 | 9 | chewing_set_KBType( ctx, keyLayout ); 10 | chewing_set_candPerPage( ctx, 9 ); 11 | chewing_set_maxChiSymbolLen( ctx, 20 ); 12 | //chewing_set_addPhraseDirection( ctx, 1 ); 13 | //chewing_set_selKey( ctx, selKey_define, 10 ); 14 | chewing_set_spaceAsSelection( ctx, spaceAsSelection ); 15 | } 16 | 17 | Chewing::~Chewing() 18 | { 19 | chewing_Terminate(); 20 | chewing_delete(ctx); 21 | } 22 | 23 | void Chewing::SetHsuSelectionKeyType(int type) 24 | { 25 | if(type > HSU_SELKEY_TYPE2) 26 | chewing_set_hsuSelKeyType( ctx, HSU_SELKEY_TYPE1 ); 27 | else 28 | chewing_set_hsuSelKeyType( ctx, type ); 29 | } 30 | 31 | void Chewing::SetKeyboardLayout(int kb) 32 | { 33 | /* if (kb==KB_HSU) { 34 | if(cd->config.hsuSelKeyType == HSU_SELKEY_TYPE2) { 35 | SelKey("asdfzxcv89"); 36 | } else { 37 | SelKey("asdfjkl789"); 38 | } 39 | } else if (kb==KB_DVORAK_HSU) SelKey("aoeuhtn789"); 40 | else SelKey("1234567890"); 41 | */ 42 | chewing_set_KBType(ctx, kb); 43 | } 44 | 45 | /* 46 | * Return i-th selection-key. i starts from 0. 47 | */ 48 | char Chewing::SelKey(int i) { 49 | char ret; 50 | int *selkey = chewing_get_selKey( ctx ); 51 | if ( 0 <= i && i < 10 ) 52 | ret = selkey[i]; 53 | else 54 | ret = 0; 55 | chewing_free( selkey ); 56 | return ret; 57 | } 58 | 59 | void Chewing::SelKey(char *selkey) { 60 | int sk[10]; 61 | for (int i = 0; i < 10;i++ ) 62 | sk[i] = selkey[i]; 63 | chewing_set_selKey( ctx, sk, 10 ); 64 | } 65 | 66 | int Chewing::Space() { return chewing_handle_Space(ctx); } 67 | int Chewing::Enter() { 68 | int rt; 69 | uint16 *oldSeq = chewing_get_phoneSeq(ctx); 70 | int seqLen = chewing_get_phoneSeqLen(ctx); 71 | rt = chewing_handle_Enter(ctx); 72 | if (chewing_commit_Check(ctx)) { 73 | memcpy(g_lastPhoneSeq, oldSeq, seqLen*sizeof(uint16)); 74 | g_lastPhoneSeq[seqLen] = 0; 75 | } 76 | chewing_free(oldSeq); 77 | return rt; 78 | } 79 | int Chewing::Delete() { return chewing_handle_Del(ctx); } 80 | int Chewing::Backspace() { return chewing_handle_Backspace(ctx); } 81 | int Chewing::Tab() { return chewing_handle_Tab(ctx); } 82 | int Chewing::ShiftLeft() { return chewing_handle_ShiftLeft(ctx); } 83 | int Chewing::ShiftRight() { return chewing_handle_ShiftRight(ctx); } 84 | int Chewing::ShiftSpace() { return chewing_handle_ShiftSpace(ctx); } 85 | int Chewing::Right() { return chewing_handle_Right(ctx);} 86 | int Chewing::Left() { return chewing_handle_Left(ctx);} 87 | int Chewing::Up() { return chewing_handle_Up(ctx);} 88 | int Chewing::Down() { return chewing_handle_Down(ctx);} 89 | int Chewing::Home() { return chewing_handle_Home(ctx);} 90 | int Chewing::End() { return chewing_handle_End(ctx);} 91 | int Chewing::Capslock() { return chewing_handle_Capslock(ctx);} 92 | int Chewing::DoubleTab() { return chewing_handle_DblTab(ctx);} 93 | int Chewing::Esc() { return chewing_handle_Esc(ctx); } 94 | int Chewing::CtrlNum(unsigned int code) { return chewing_handle_CtrlNum(ctx ,(int)code);} 95 | int Chewing::NumPad(unsigned int code) { return chewing_handle_Numlock(ctx, (int)code);} 96 | int Chewing::Key(unsigned int code) { 97 | //SetKeyboardLayout(kbLayout); 98 | return chewing_handle_Default(ctx, (int)code); 99 | } 100 | 101 | uint16* Chewing::GetLastPhoneSeq() { 102 | return g_lastPhoneSeq; 103 | } 104 | 105 | /* 106 | CommitReady() returns TRUE if it currnet input state 107 | is at the "end-of-a-char". 108 | */ 109 | int Chewing::CommitReady() { 110 | return chewing_commit_Check(ctx); 111 | } 112 | 113 | /* 114 | CommitStr() retrun currnet commit string, regardless 115 | current input state. 116 | 117 | Alwasy returns a char pointer, caller must free it. 118 | */ 119 | 120 | char* Chewing::CommitStr() { 121 | return chewing_commit_String(ctx); 122 | } 123 | 124 | /* 125 | Always returns a char pointer, caller must free it. 126 | */ 127 | char* Chewing::ZuinStr() { 128 | return chewing_zuin_String(ctx, NULL); 129 | } 130 | 131 | char* Chewing::Buffer() { 132 | return chewing_buffer_String(ctx); 133 | } 134 | 135 | int Chewing::BufferLen() { 136 | return chewing_buffer_Len(ctx); 137 | } 138 | 139 | int Chewing::CursorPos() { 140 | return (int)chewing_cursor_Current(ctx); 141 | } 142 | 143 | int Chewing::KeystrokeIgnore() { 144 | return chewing_keystroke_CheckIgnore(ctx); 145 | } 146 | 147 | int Chewing::ChineseMode() { 148 | return (chewing_get_ChiEngMode(ctx) == CHINESE_MODE); 149 | } 150 | 151 | int Chewing::Candidate() { 152 | return chewing_cand_TotalPage(ctx); 153 | } 154 | 155 | int Chewing::ChoicePerPage() { 156 | return chewing_cand_ChoicePerPage(ctx); 157 | } 158 | 159 | int Chewing::TotalChoice() { 160 | return chewing_cand_TotalChoice(ctx); 161 | } 162 | 163 | int Chewing::TotalPage() { 164 | return chewing_cand_TotalPage(ctx); 165 | } 166 | 167 | int Chewing::CurrentPage() { 168 | return chewing_cand_CurrentPage(ctx); 169 | } 170 | 171 | /* 172 | * Return the i-th candidate wchar (WCH_SIZE bytes), i starts from 0. 173 | * User MUST free() the return value of this sub-routine, 174 | * even if it's a false value. 175 | */ 176 | char* Chewing::Selection(int i) { 177 | /* FIXME: This can be more efficient */ 178 | int j = 0; 179 | chewing_cand_Enumerate(ctx); 180 | for (j = 0; chewing_cand_hasNext(ctx) && j < i; j++) 181 | chewing_free(chewing_cand_String(ctx)); 182 | return chewing_cand_String(ctx); 183 | } 184 | 185 | // A debugging purpose Dumping routing. Output current inputed Zuin 186 | // and Commit string. 187 | void Chewing::Dump() { 188 | #if 0 189 | fprintf(stderr,"nCommitStr = %d\n",co->nCommitStr); 190 | 191 | fprintf(stderr,"zuin: "); 192 | 193 | int i; 194 | for(i=0;izuinBuf[i].s) 196 | fprintf(stderr,"%s",co->zuinBuf[i].s); 197 | fprintf(stderr,"\n"); 198 | 199 | fprintf(stderr,"commit: "); 200 | for(i=0;inCommitStr;i++) 201 | fprintf(stderr,"%s",co->commitStr[i].s); 202 | fprintf(stderr,"\n"); 203 | fprintf(stderr,"-----\n"); 204 | #endif 205 | } 206 | 207 | void Chewing::SetFullShape(bool full) 208 | { 209 | chewing_set_ShapeMode(ctx, full ? FULLSHAPE_MODE : HALFSHAPE_MODE ); 210 | } 211 | 212 | bool Chewing::GetFullShape(void) 213 | { 214 | return chewing_get_ShapeMode(ctx) == FULLSHAPE_MODE; 215 | } 216 | 217 | void Chewing::SetAdvanceAfterSelection(int bDo) 218 | { 219 | chewing_set_autoShiftCur(ctx, bDo); 220 | } 221 | 222 | void Chewing::SetEasySymbolInput(int bSet) 223 | { 224 | chewing_set_easySymbolInput(ctx, bSet); 225 | } 226 | 227 | bool Chewing::LoadDataFiles(const char *dataDir, const char *userDir) 228 | { 229 | chewing_Init(dataDir, userDir); 230 | return true; 231 | } 232 | 233 | void Chewing::SetSpaceAsSelection(bool spaceAsSelection) 234 | { 235 | chewing_set_spaceAsSelection(ctx, spaceAsSelection); 236 | } 237 | 238 | void Chewing::SetEscCleanAllBuf( bool escCleanAllBuf ) { 239 | chewing_set_escCleanAllBuf(ctx, escCleanAllBuf); 240 | } 241 | 242 | int Chewing::ShowMsgLen(void) 243 | { 244 | return chewing_aux_Length(ctx); 245 | } 246 | 247 | char* Chewing::ShowMsg(void) 248 | { 249 | return chewing_aux_String(ctx); 250 | } 251 | 252 | void Chewing::SetAddPhraseForward(bool add_forward) 253 | { 254 | chewing_set_addPhraseDirection(ctx, add_forward); 255 | } 256 | 257 | bool Chewing::GetAddPhraseForward(void) 258 | { 259 | return !!chewing_get_addPhraseDirection(ctx); 260 | } 261 | 262 | void Chewing::SetCandPerPage(int len) 263 | { 264 | chewing_set_candPerPage(ctx, len); 265 | } 266 | 267 | // Return the length of interval array 268 | int Chewing::IntervalLen() 269 | { 270 | int i; 271 | chewing_interval_Enumerate(ctx); 272 | for (i = 0; chewing_interval_hasNext(ctx); i++) 273 | chewing_interval_Get(ctx, NULL); 274 | return i*2; 275 | } 276 | 277 | // Return interval array 278 | // caller must free return value 279 | unsigned char* Chewing::IntervalArray() 280 | { 281 | unsigned char* interval = (unsigned char*)calloc( IntervalLen(), sizeof( unsigned char ) ); 282 | IntervalType it; 283 | chewing_interval_Enumerate(ctx); 284 | for( int i = 0; chewing_interval_hasNext(ctx); ++i ) { 285 | chewing_interval_Get(ctx, &it); 286 | interval[i * 2] = it.from; 287 | interval[i * 2 + 1] = it.to; 288 | } 289 | return interval; 290 | } 291 | 292 | void TerminateSymbolTable(); 293 | void TerminateEasySymbolTable(); 294 | int InitSymbolTable( const char *prefix ); 295 | int InitEasySymbolInput( const char *prefix ); 296 | 297 | void Chewing::ReloadSymbolTable(const char* dataDir, const char* userDir ) 298 | { 299 | chewing_Terminate(); 300 | chewing_Init(dataDir, userDir); 301 | } 302 | -------------------------------------------------------------------------------- /ChewingIME/XPToolbar.cpp: -------------------------------------------------------------------------------- 1 | // XPToolbar.cpp: implementation of the XPToolbar class. 2 | // 3 | ////////////////////////////////////////////////////////////////////// 4 | 5 | #include ".\xptoolbar.h" 6 | #include 7 | #include "DrawUtil.h" 8 | #include "Tooltip.h" 9 | 10 | ////////////////////////////////////////////////////////////////////// 11 | // Construction/Destruction 12 | ////////////////////////////////////////////////////////////////////// 13 | 14 | static LPCTSTR xpToolbarClass = _T("XPToolbar"); 15 | 16 | XPToolbar::XPToolbar(int gripperw, int btnw, int btnh) 17 | : themeBmp(NULL), gripperW(gripperw), btnW(btnw), btnH(btnh), 18 | prevHilightBtn(-1), curPressedBtn(-1), cmdTarget(NULL) 19 | , tooltip(NULL) 20 | { 21 | } 22 | 23 | XPToolbar::~XPToolbar() 24 | { 25 | } 26 | 27 | // NOT USED IN CHEWING IME 28 | BOOL XPToolbar::registerClass() 29 | { 30 | WNDCLASSEX wc; 31 | wc.cbSize = sizeof(WNDCLASSEX); 32 | wc.style = CS_HREDRAW|CS_VREDRAW; 33 | wc.lpfnWndProc = (WNDPROC)XPToolbar::wndProc; 34 | wc.cbClsExtra = 0; 35 | wc.cbWndExtra = sizeof(LONG) * (sizeof(void*) > sizeof(LONG) ? 2 : 1); 36 | wc.hInstance = (HINSTANCE)GetModuleHandle(NULL); 37 | wc.hCursor = LoadCursor( NULL, IDC_ARROW ); 38 | wc.hIcon = NULL; 39 | wc.lpszMenuName = (LPTSTR)NULL; 40 | wc.lpszClassName = xpToolbarClass; 41 | wc.hbrBackground = NULL; 42 | wc.hIconSm = NULL; 43 | 44 | if( !RegisterClassEx( (LPWNDCLASSEX)&wc ) ) 45 | return FALSE; 46 | 47 | return TRUE; 48 | } 49 | 50 | LRESULT CALLBACK XPToolbar::wndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) 51 | { 52 | XPToolbar* pthis = NULL; 53 | 54 | pthis = (XPToolbar*)GetWindowLongPtr( hwnd, GWLP_USERDATA ); 55 | if( pthis ) 56 | return pthis->wndProc(msg, wp, lp); 57 | return DefWindowProc(hwnd, msg, wp, lp ); 58 | } 59 | 60 | LRESULT XPToolbar::wndProc(UINT msg, WPARAM wp, LPARAM lp) 61 | { 62 | switch(msg) 63 | { 64 | case WM_PAINT: 65 | { 66 | PAINTSTRUCT ps; 67 | BeginPaint( hwnd, &ps ); 68 | onPaint(ps); 69 | EndPaint(hwnd, &ps); 70 | } 71 | case WM_NCDESTROY: 72 | hwnd = NULL; 73 | break; 74 | case WM_CAPTURECHANGED: 75 | onCaptureChanged(lp); 76 | break; 77 | } 78 | return DefWindowProc(hwnd, msg, wp, lp ); 79 | } 80 | 81 | // NOT USED IN CHEWING IME 82 | void XPToolbar::unregisterClass() 83 | { 84 | UnregisterClass(xpToolbarClass, (HINSTANCE)GetModuleHandle(NULL)); 85 | } 86 | 87 | void XPToolbar::onPaint(PAINTSTRUCT &ps) 88 | { 89 | if ( IsWindow(hwnd)==FALSE ) return; 90 | RECT rc; 91 | GetClientRect( hwnd, &rc ); 92 | 93 | HDC memdc = CreateCompatibleDC( ps.hdc ); 94 | HBITMAP membmp = CreateCompatibleBitmap( ps.hdc, rc.right, rc.bottom ); 95 | HGDIOBJ oldobj = SelectObject( memdc, membmp ); 96 | ::DrawBitmap( memdc, themeBmp, 0, 0, gripperW, rc.bottom, 0, 0 ); 97 | for( int i = 0; i < 3; ++i ) 98 | drawBtn( memdc, i ); 99 | ::DrawBitmap( memdc, themeBmp, rc.right-4, 0, 4, rc.bottom, gripperW + btnW * 3, 0 ); 100 | BitBlt( ps.hdc, 0, 0, rc.right, rc.bottom, memdc, 0, 0, SRCCOPY ); 101 | SelectObject(memdc, oldobj); 102 | DeleteDC( memdc ); 103 | 104 | } 105 | 106 | // NOT USED IN CHEWING IME 107 | bool XPToolbar::create(HWND parent, UINT id, LONG style, int x, int y, int w, int h) 108 | { 109 | hwnd = CreateWindowEx( 0, xpToolbarClass, NULL, WS_CHILD|WS_VISIBLE, x, y, w, h, 110 | parent, NULL, HINSTANCE(GetModuleHandle(NULL)), NULL); 111 | SetWindowLongPtr( hwnd, GWLP_USERDATA, LONG_PTR(this)); 112 | return !!hwnd; 113 | } 114 | 115 | bool XPToolbar::onLButtonDown(WPARAM wp, LPARAM lp) 116 | { 117 | if ( IsWindow(hwnd)==FALSE ) return false; 118 | POINTS pt = MAKEPOINTS(lp); 119 | curPressedBtn = hitTest(pt.x, pt.y); 120 | if(curPressedBtn < 0) 121 | return false; 122 | 123 | SetCapture(hwnd); 124 | buttons[curPressedBtn].state = -1; 125 | HDC dc = GetDC(hwnd); 126 | drawBtn( dc, curPressedBtn ); 127 | ReleaseDC(hwnd, dc); 128 | return true; 129 | } 130 | 131 | bool XPToolbar::onLButtonUp(WPARAM wp, LPARAM lp) 132 | { 133 | if ( IsWindow(hwnd)==FALSE ) return false; 134 | if( curPressedBtn < 0 ) 135 | return false; 136 | POINTS pt = MAKEPOINTS(lp); 137 | int idx = hitTest(pt.x, pt.y); 138 | if( idx >= 0 ) 139 | { 140 | if(idx == prevHilightBtn ) 141 | { 142 | HDC dc = GetDC(hwnd); 143 | buttons[prevHilightBtn].state = 1; 144 | drawBtn( dc, prevHilightBtn ); 145 | ReleaseDC(hwnd, dc); 146 | } 147 | if( idx == curPressedBtn ) 148 | PostMessage( cmdTarget, WM_COMMAND, buttons[idx].id, 0); 149 | } 150 | ReleaseCapture(); 151 | prevHilightBtn = curPressedBtn = -1; 152 | return true; 153 | } 154 | 155 | bool XPToolbar::onMouseMove(WPARAM wp, LPARAM lp) 156 | { 157 | if ( IsWindow(hwnd)==FALSE ) return false; 158 | POINTS pt = MAKEPOINTS(lp); 159 | int idx = hitTest(pt.x, pt.y); 160 | 161 | if( idx < 0 ) 162 | { 163 | if( prevHilightBtn >=0 && prevHilightBtn != idx ) 164 | { 165 | HDC dc = GetDC(hwnd); 166 | buttons[prevHilightBtn].state = 0; 167 | drawBtn( dc, prevHilightBtn ); 168 | ReleaseDC(hwnd, dc); 169 | if( tooltip ) 170 | tooltip->hideTip(); 171 | } 172 | prevHilightBtn = -1; 173 | 174 | if( curPressedBtn < 0 ) 175 | { 176 | ReleaseCapture(); 177 | return false; 178 | } 179 | return true; 180 | } 181 | 182 | SetCursor( LoadCursor( NULL, IDC_ARROW ) ); 183 | SetCapture(hwnd); 184 | 185 | if( idx == prevHilightBtn ) 186 | return true; 187 | 188 | if( curPressedBtn == idx ) 189 | buttons[idx].state = -1; 190 | else 191 | buttons[idx].state = ( curPressedBtn < 0 ? 1 : 0 ); 192 | 193 | HDC dc = GetDC(hwnd); 194 | if( prevHilightBtn >=0 && prevHilightBtn != idx ) 195 | { 196 | if( prevHilightBtn != idx ) 197 | { 198 | buttons[prevHilightBtn].state = 0; 199 | drawBtn( dc, prevHilightBtn ); 200 | } 201 | } 202 | 203 | if(tooltip && !buttons[idx].tooltip.empty() ) 204 | { 205 | RECT rc; 206 | getBtnRect( idx, rc ); 207 | POINT pt; pt.x = rc.left; pt.y = rc.bottom; 208 | ClientToScreen( hwnd, &pt ); 209 | 210 | int len = MultiByteToWideChar( CP_ACP, 0, buttons[idx].tooltip.c_str(), 211 | (int) buttons[idx].tooltip.length(), NULL, 0 ); 212 | wchar_t* wtip = new wchar_t[len + 1]; 213 | MultiByteToWideChar( CP_ACP, 0, buttons[idx].tooltip.c_str(), 214 | (int) buttons[idx].tooltip.length()+1, wtip, len + 1 ); 215 | 216 | tooltip->showTip( pt.x, pt.y, wtip, 6000 ); 217 | delete wtip; 218 | } 219 | 220 | drawBtn( dc, idx ); 221 | prevHilightBtn = idx; 222 | ReleaseDC(hwnd, dc); 223 | return true; 224 | } 225 | 226 | void XPToolbar::setTheme(HBITMAP bmp) 227 | { 228 | if ( IsWindow(hwnd)==FALSE ) return; 229 | themeBmp = bmp; 230 | } 231 | 232 | void XPToolbar::drawBtn(HDC dc, int idx) 233 | { 234 | if ( IsWindow(hwnd)==FALSE ) return; 235 | int left = gripperW + btnW * idx; 236 | int iconleft = left + (btnW-16) / 2; 237 | int icontop = (btnH-16)/2; 238 | int state = buttons[idx].state; 239 | int srcx; 240 | if( state == 0 ) 241 | srcx = gripperW; 242 | else if( state < 0 ) 243 | { 244 | srcx = gripperW + btnW * 2; 245 | ++iconleft; 246 | ++icontop; 247 | } 248 | else 249 | srcx = gripperW + btnW; 250 | 251 | ::DrawBitmap( dc, themeBmp, left, 0, btnW, btnH, srcx, 0 ); 252 | 253 | DrawIconEx( dc, iconleft, icontop, buttons[idx].hIcon 254 | , 16, 16, 0, NULL, DI_NORMAL ); 255 | } 256 | 257 | int XPToolbar::addBtn(UINT id, int iImage, LPCTSTR tooltip) 258 | { 259 | buttons.push_back( XPToolbarBtn(id, iImage, tooltip, 0) ); 260 | return (int) buttons.size(); 261 | } 262 | 263 | void XPToolbar::getSize(int *w, int *h) 264 | { 265 | if ( IsWindow(hwnd)==FALSE ) return; 266 | *w = gripperW + btnW * buttons.size() + 4; 267 | *h = btnH; 268 | } 269 | 270 | int XPToolbar::hitTest(int x, int y) 271 | { 272 | if ( IsWindow(hwnd)==FALSE ) return 0; 273 | RECT rc; 274 | GetClientRect(hwnd, &rc); 275 | int ymargin = (rc.bottom - 21)/2; 276 | if( y < (ymargin+1) || y > (rc.bottom - ymargin)) 277 | return -1; 278 | if( x < gripperW || x >= (rc.right - 4) ) 279 | return -1; 280 | return ((x-gripperW) / btnW); 281 | } 282 | 283 | void XPToolbar::setBtnImage(int idx, HICON icon) 284 | { 285 | if ( IsWindow(hwnd)==FALSE ) return; 286 | if( buttons[idx].hIcon == icon ) 287 | return; 288 | buttons[idx].hIcon = icon; 289 | HDC dc = GetDC(hwnd); 290 | drawBtn(dc, idx); 291 | ReleaseDC(hwnd, dc); 292 | } 293 | 294 | void XPToolbar::onCaptureChanged( LPARAM lp ) 295 | { 296 | if ( IsWindow(hwnd)==FALSE ) return; 297 | if( HWND(lp) != hwnd && prevHilightBtn >= 0 ) 298 | { 299 | HDC dc = GetDC(hwnd); 300 | buttons[prevHilightBtn].state = 0; 301 | drawBtn( dc, prevHilightBtn ); 302 | ReleaseDC(hwnd, dc); 303 | if( tooltip ) 304 | tooltip->hideTip(); 305 | } 306 | } 307 | 308 | void XPToolbar::setTooltip(Tooltip* tip) 309 | { 310 | tooltip = tip; 311 | } 312 | 313 | bool XPToolbar::getBtnRect(int idx, RECT& rc) 314 | { 315 | if( idx >= (int) buttons.size() ) 316 | return false; 317 | GetClientRect( hwnd, &rc ); 318 | int ymargin = (rc.bottom - 21)/2; 319 | 320 | rc.left = gripperW + btnW * idx; 321 | rc.right = rc.left + btnW; 322 | rc.top = ymargin; 323 | rc.bottom = rc.top + btnH; 324 | return true; 325 | } 326 | -------------------------------------------------------------------------------- /HashEd-UTF8/Pho2Chewing.cpp: -------------------------------------------------------------------------------- 1 | // NewPho2NewChewing.cpp : 定義主控台應用程式的進入點 2 | // 3 | 4 | #include 5 | #include 6 | 7 | #include "Pho2Chewing.h" 8 | 9 | using namespace std; 10 | 11 | const ZuinKeyCompareTable *zuin_imap, *zuin_fmap, *zuin_tmap; 12 | int zuin_inum, zuin_fnum, zuin_tnum; 13 | 14 | static ZuinKeyCompareTable *zuin_initial() 15 | { 16 | static ZuinKeyCompareTable map[] = { 17 | {"ㄅ","1"}, {"ㄆ","q"}, {"ㄇ","a"}, {"ㄈ","z"}, {"ㄉ","2"}, {"ㄊ","w"}, 18 | {"ㄋ","s"}, {"ㄌ","x"}, {"ㄍ","e"}, {"ㄎ","d"}, {"ㄏ","c"}, {"ㄐ","r"}, 19 | {"ㄑ","f"}, {"ㄒ","v"}, {"ㄓ","5"}, {"ㄔ","t"}, {"ㄕ","g"}, {"ㄖ","b"}, 20 | {"ㄗ","y"}, {"ㄘ","h"}, {"ㄙ","n"} 21 | }; 22 | 23 | zuin_inum = sizeof(map)/sizeof(map[0]); 24 | return map; 25 | } 26 | 27 | static ZuinKeyCompareTable *zuin_final() 28 | { 29 | static ZuinKeyCompareTable map[] = { 30 | {"ㄧㄚ","u8"}, {"ㄧㄠ","ul"}, {"ㄧㄝ","u,"}, {"ㄧㄡ","u."}, {"ㄧㄢ","u0"}, 31 | {"ㄧㄣ","up"}, {"ㄧㄤ","u;"}, {"ㄧㄥ","u/"}, {"ㄧㄞ","u9"}, {"ㄧㄛ","ui"}, 32 | {"ㄨㄚ","j8"}, {"ㄨㄛ","ji"}, {"ㄨㄞ","j9"}, {"ㄨㄟ","jo"}, {"ㄨㄢ","j0"}, 33 | {"ㄨㄣ","jp"}, {"ㄨㄤ","j;"}, {"ㄨㄥ","j/"}, 34 | {"ㄩㄝ","m,"}, {"ㄩㄢ","m0"}, {"ㄩㄣ","mp"}, {"ㄩㄥ","m/"}, 35 | {"ㄧ","u"}, {"ㄨ","j"}, {"ㄩ","m"}, {"ㄚ","8"}, {"ㄛ","i"}, {"ㄜ","k"}, 36 | {"ㄝ",","}, {"ㄞ","9"}, {"ㄟ","o"}, {"ㄠ","l"}, {"ㄡ","."}, {"ㄢ","0"}, 37 | {"ㄣ","p"}, {"ㄤ",";"}, {"ㄥ","/"}, {"ㄦ","-"} 38 | }; 39 | 40 | zuin_fnum = sizeof(map)/sizeof(map[0]); 41 | return map; 42 | } 43 | 44 | static ZuinKeyCompareTable *zuin_tone() 45 | { 46 | static ZuinKeyCompareTable map[] = { 47 | {"˙","7"}, {"ˊ","6"}, {"ˇ","3"}, {"ˋ","4"} 48 | }; 49 | 50 | zuin_tnum = sizeof(map)/sizeof(map[0]); 51 | return map; 52 | } 53 | 54 | void FreeMap() 55 | { 56 | } 57 | 58 | void InitMap() 59 | { 60 | zuin_imap=zuin_initial(); 61 | zuin_fmap=zuin_final(); 62 | zuin_tmap=zuin_tone(); 63 | } 64 | 65 | int key_lookup(const ZuinKeyCompareTable *table, 66 | int table_size, 67 | char *target) 68 | { 69 | string pstring; 70 | int i,j; 71 | 72 | pstring=string(target); 73 | for ( i = 0; i < table_size; i++ ) { 74 | j = pstring.find( table[ i ].zuin ); 75 | if (j>=0) { 76 | return i; 77 | } 78 | } 79 | return table_size; 80 | } 81 | 82 | int Big52UTF8(string filename) 83 | { 84 | HANDLE hHashFile = CreateFile( filename.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL ); 85 | if( hHashFile == INVALID_HANDLE_VALUE ) 86 | return 0; /* absence of hash.dat simply means "nothing", 87 | and should not rise an error to NSIS. */ 88 | 89 | DWORD size = GetFileSize( hHashFile, NULL ); 90 | DWORD buflen = (size *3/2) +1; 91 | char *buf = new char[ buflen ]; 92 | if( buf ) { 93 | if( ReadFile( hHashFile, buf, size, &size, NULL ) ) { 94 | CloseHandle( hHashFile ); 95 | DWORD usize = MultiByteToWideChar( 950, 0, buf, size + 1, NULL, 0 ); 96 | wchar_t* ubuf = new wchar_t[usize]; 97 | if( ubuf ) { 98 | usize = MultiByteToWideChar( 950, 0, buf, size + 1, ubuf, usize ); 99 | size = WideCharToMultiByte( CP_UTF8, 0, ubuf, usize, NULL, 0, NULL, NULL ); 100 | if ( buf!=NULL ) { 101 | delete [] buf; 102 | buf = new char[size+1]; 103 | } 104 | size = WideCharToMultiByte( CP_UTF8, 0, ubuf, usize, buf, size, NULL, NULL ); 105 | hHashFile = CreateFile( "~temp1.tmp", GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, 0, NULL ); 106 | if( hHashFile != INVALID_HANDLE_VALUE ) { 107 | WriteFile( hHashFile, buf, size, &size, NULL ); 108 | CloseHandle( hHashFile ); 109 | } 110 | delete []ubuf; 111 | } 112 | } 113 | delete []buf; 114 | } 115 | return 0; 116 | } 117 | 118 | int UTF16LE2UTF8(string filename) 119 | { 120 | HANDLE hHashFile = CreateFile( filename.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL ); 121 | if( hHashFile == INVALID_HANDLE_VALUE ) 122 | return 0; /* absence of hash.dat simply means "nothing", 123 | and should not rise an error to NSIS. */ 124 | 125 | DWORD size = GetFileSize( hHashFile, NULL ); 126 | DWORD buflen = (size *3) +1; 127 | wchar_t *buf = new wchar_t[ buflen ]; 128 | if( buf ) { 129 | if( ReadFile( hHashFile, buf, size, &size, NULL ) ) { 130 | CloseHandle( hHashFile ); 131 | DWORD usize = WideCharToMultiByte( CP_UTF8, 0, buf, size, NULL, 0, NULL, NULL ); 132 | char* ubuf = new char[usize]; 133 | if( ubuf ) { 134 | size = WideCharToMultiByte( CP_UTF8, 0, buf, size/2, ubuf, usize, NULL, NULL ); 135 | hHashFile = CreateFile( "~temp1.tmp", GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, 0, NULL ); 136 | if( hHashFile != INVALID_HANDLE_VALUE ) { 137 | WriteFile( hHashFile, ubuf, size, &size, NULL ); 138 | CloseHandle( hHashFile ); 139 | } 140 | delete []ubuf; 141 | } 142 | } 143 | delete []buf; 144 | } 145 | return 0; 146 | } 147 | 148 | void Pos2Begin(string file) 149 | { 150 | fstream txtfile; 151 | txtfile.open(file.c_str(), ios_base::in); 152 | 153 | txtfile.seekp(0, ios_base::beg); 154 | } 155 | 156 | bool DetectUTF16LEBom(string file) 157 | { 158 | const char utf16le_bom[] = {'\xff', '\xfe'}; 159 | bool isutf16le = false; 160 | 161 | fstream txtfile; 162 | txtfile.open(file.c_str(), ios_base::in); 163 | 164 | Pos2Begin(file); 165 | char buf[2]; 166 | if (txtfile.read(buf, 2)) { 167 | isutf16le = strncmp(buf, utf16le_bom, 2) == 0; 168 | } 169 | txtfile.close(); 170 | 171 | Pos2Begin(file); 172 | return isutf16le; 173 | } 174 | 175 | int _tmain(int argc, _TCHAR* argv[]) 176 | { 177 | char phase[100]; 178 | bool isbig5utf16le; 179 | string filename; 180 | char *p; 181 | 182 | int i,j; 183 | uint16 num; 184 | 185 | fstream utf8newphonetic; 186 | fstream chewingphone; 187 | 188 | cout << " enter the file name = "; 189 | cin >> filename; 190 | 191 | isbig5utf16le=DetectUTF16LEBom(filename); 192 | (isbig5utf16le)? (UTF16LE2UTF8(filename)):(Big52UTF8(filename)); 193 | 194 | utf8newphonetic.open("~temp1.tmp", ios_base::in); 195 | chewingphone.open("~temp2.tmp",ios_base::out); 196 | 197 | InitMap(); 198 | 199 | while(!utf8newphonetic.getline(phase, 100, '\n').eof()) 200 | { 201 | p=strtok(phase," "); 202 | chewingphone << p << " "; 203 | 204 | p=strtok(NULL," "); 205 | 206 | while(p != NULL) 207 | { 208 | i=key_lookup(zuin_imap, zuin_inum, p); 209 | if (i != zuin_inum) chewingphone << zuin_imap[i].keysel; 210 | i=key_lookup(zuin_fmap, zuin_fnum, p); 211 | if (i != zuin_fnum) chewingphone << zuin_fmap[i].keysel; 212 | i=key_lookup(zuin_tmap, zuin_tnum, p); 213 | if (i != zuin_tnum) chewingphone << zuin_tmap[i].keysel; 214 | 215 | chewingphone << " "; 216 | p=strtok(NULL," "); 217 | }; 218 | chewingphone << "\n"; 219 | }; 220 | utf8newphonetic.close(); 221 | chewingphone.close(); 222 | ///////////////////////////////////////////////////////////////// 223 | bool k=0; 224 | char phoneBuf[128]; 225 | 226 | string uhashname, vocabulary; 227 | chewing chewingdata; 228 | 229 | fstream chewingfone; 230 | fstream uhashfile; 231 | 232 | chewingfone.open("~temp2.tmp",ios_base::in); 233 | cout << "enter file name of uhash = "; 234 | cin >> uhashname; 235 | uhashfile.open(uhashname.c_str(), ios_base::out|ios_base::app|ios_base::binary); 236 | if(!uhashfile) 237 | { 238 | cerr << "ERROR!" << endl; 239 | return 0; 240 | } 241 | 242 | chewingdata.lastfreq=1; 243 | chewingdata.lasttime=0; 244 | chewingdata.maxfreq=1; 245 | chewingdata.systemfreq=1; 246 | 247 | //if utf16le -> utf8, utf8 file has BOM, seek 3 bits to 避開 BOM 248 | if (isbig5utf16le) chewingfone.seekg(3, ios_base::beg); 249 | 250 | while(!chewingfone.getline(phase, 100, '\n').eof()) 251 | { 252 | p=strtok(phase," "); 253 | vocabulary=string(p); 254 | 255 | chewingdata.phonenum=int((double) vocabulary.length()/3.0); 256 | 257 | p=strtok(NULL," "); 258 | 259 | uhashfile.write((char*) &chewingdata.lastfreq, sizeof(int)); 260 | uhashfile.write((char*) &chewingdata.lasttime, sizeof(int)); 261 | uhashfile.write((char*) &chewingdata.maxfreq, sizeof(int)); 262 | uhashfile.write((char*) &chewingdata.systemfreq, sizeof(int)); 263 | uhashfile.write((char*) &chewingdata.phonenum, sizeof(bool)); 264 | 265 | while(p != NULL) 266 | { 267 | //KB_DEFAULT=0; 268 | PhoneFromKey(phoneBuf, p, 0, 1); 269 | num=UintFromPhone(phoneBuf); 270 | uhashfile.write((char*) &num, sizeof(uint16)); 271 | p=strtok(NULL," "); 272 | }; 273 | chewingdata.bits=3*chewingdata.phonenum; 274 | uhashfile.write((char*) &chewingdata.bits, sizeof(bool)); 275 | uhashfile << vocabulary; 276 | 277 | /* bytes = chewingdata.lastfreq + chewingdata.lasttime + chewingdata.maxfreq + 278 | chewingdata.systemfreq + chewingdata.phonenum + zuinserial(unsigned integer = 2 bytes 279 | have chewingdata.phonenum s zuinserial) + words(in utf8, word = 3 bytes, 280 | have chewingdata.phonenum s words);*/ 281 | i=4*4+1+2*chewingdata.phonenum+1+3*chewingdata.phonenum; 282 | for(j=0;j<(125-i);j++) 283 | { 284 | uhashfile.write((char*) &k, sizeof(bool)); 285 | } 286 | }; 287 | chewingfone.close(); 288 | uhashfile.close(); 289 | ///////////////////////////////////////////////////// 290 | 291 | return 0; 292 | } -------------------------------------------------------------------------------- /ChewingIME/StatusWnd.cpp: -------------------------------------------------------------------------------- 1 | #include "ChewingIME.h" 2 | #include ".\statuswnd.h" 3 | #include "DrawUtil.h" 4 | #include "resource.h" 5 | 6 | #include "CompStr.h" 7 | #include "IMCLock.h" 8 | #include "IMEUI.h" 9 | #include "IMEUILock.h" 10 | 11 | #include "XPToolbar.h" 12 | 13 | BOOL AboutDlgProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) 14 | { 15 | if( msg == WM_COMMAND ) 16 | { 17 | EndDialog( hwnd, LOWORD(wp) ); 18 | return TRUE; 19 | } 20 | return FALSE; 21 | } 22 | 23 | StatusWnd::StatusWnd() : XPToolbar(9, 20, 26), dragging(false) 24 | { 25 | } 26 | 27 | StatusWnd::~StatusWnd(void) 28 | { 29 | DestroyIcon( iconChi ); 30 | DestroyIcon( iconEng ); 31 | DestroyIcon( iconFull ); 32 | DestroyIcon( iconHalf ); 33 | DestroyIcon( iconConfig ); 34 | } 35 | 36 | BOOL StatusWnd::registerClass(void) 37 | { 38 | WNDCLASSEX wc; 39 | wc.cbSize = sizeof(WNDCLASSEX); 40 | wc.style = CS_IME; 41 | wc.lpfnWndProc = (WNDPROC)StatusWnd::wndProc; 42 | wc.cbClsExtra = 0; 43 | wc.cbWndExtra = 0; 44 | wc.hInstance = g_dllInst; 45 | wc.hCursor = LoadCursor( NULL, IDC_SIZEALL ); 46 | wc.hIcon = NULL; 47 | wc.lpszMenuName = (LPTSTR)NULL; 48 | wc.lpszClassName = g_statusWndClass; 49 | wc.hbrBackground = NULL; 50 | wc.hIconSm = NULL; 51 | 52 | if( !RegisterClassEx( (LPWNDCLASSEX)&wc ) ) 53 | return FALSE; 54 | 55 | return TRUE; 56 | } 57 | 58 | 59 | LRESULT StatusWnd::wndProc( HWND hwnd, UINT msg, WPARAM wp , LPARAM lp ) 60 | { 61 | IMEUILock lock( GetParent(hwnd) ); 62 | IMEUI* ui = lock.getIMEUI(); 63 | if( ui && ui->statusWnd.getHwnd() ) 64 | return ui->statusWnd.wndProc( msg, wp, lp ); 65 | return DefWindowProc(hwnd, msg, wp, lp); 66 | } 67 | 68 | bool StatusWnd::create(HWND imeUIWnd) 69 | { 70 | HIMC hIMC = (HIMC)GetWindowLong( imeUIWnd, IMMGWL_IMC ); 71 | if ( g_isWinLogon ) 72 | return false; 73 | IMCLock imc(hIMC); 74 | 75 | hwnd = CreateWindowEx(0, g_statusWndClass, NULL, 76 | WS_POPUP|WS_CLIPCHILDREN, 77 | 0, 0, 0, 0, imeUIWnd, NULL, g_dllInst, NULL); 78 | if( !hwnd ) 79 | return false; 80 | 81 | TCHAR bmppath[MAX_PATH]; 82 | GetSystemDirectory( bmppath, MAX_PATH ); 83 | _tcscat( bmppath, _T("\\IME\\Chewing\\statuswnd.bmp") ); 84 | HBITMAP tbbmp = (HBITMAP)LoadImage( NULL, bmppath, IMAGE_BITMAP, 85 | 0, 0, LR_DEFAULTCOLOR|LR_LOADFROMFILE); 86 | 87 | this->setTheme(tbbmp); 88 | iconChi = (HICON)LoadImage( g_dllInst, LPCTSTR (IDI_CHI), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR ); 89 | iconEng = (HICON)LoadImage( g_dllInst, LPCTSTR (IDI_ENG), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR ); 90 | iconFull = (HICON)LoadImage( g_dllInst, LPCTSTR (IDI_FULL), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR ); 91 | iconHalf = (HICON)LoadImage( g_dllInst, LPCTSTR (IDI_HALF), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR ); 92 | iconConfig = (HICON)LoadImage( g_dllInst, LPCTSTR (IDI_CONFIG), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR ); 93 | 94 | TCHAR tip[128]; 95 | LoadString(g_dllInst, ID_CHI_ENG, tip, sizeof(tip) ); 96 | addBtn( ID_CHI_ENG, imc.isChinese() ? iconChi : iconEng, tip ); 97 | LoadString(g_dllInst, ID_FULL_HALF, tip, sizeof(tip) ); 98 | addBtn( ID_FULL_HALF, imc.isFullShape() ? iconFull : iconHalf, tip ); 99 | // This should be disabled in WinLogon for security reason. 100 | if( ! g_isWinLogon ) 101 | { 102 | LoadString(g_dllInst, ID_MENU, tip, sizeof(tip) ); 103 | addBtn( ID_MENU, iconConfig, tip ); 104 | } 105 | 106 | IMEUILock ui(GetParent(hwnd)); 107 | setTooltip( &ui.getIMEUI()->tooltip ); 108 | setCmdTarget(hwnd); 109 | 110 | int w, h; 111 | XPToolbar::getSize(&w, &h); 112 | SetWindowPos( hwnd, NULL, 0, 0, w, h, SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOZORDER ); 113 | 114 | return true; 115 | } 116 | 117 | void StatusWnd::enableChiEng(bool enable) 118 | { 119 | // SendMessage( GetDlgItem( hwnd, IDC_STATUS_TB), TB_ENABLEBUTTON, ID_CHI_ENG, enable ); 120 | } 121 | 122 | void StatusWnd::toggleChiEngMode(HIMC hIMC) 123 | { 124 | ToggleChiEngMode(hIMC); 125 | /// FIXME: icons should indicate whether capslock is toggled or not. 126 | updateIcons(hIMC); 127 | } 128 | 129 | void StatusWnd::toggleShapeMode(HIMC hIMC) 130 | { 131 | ToggleFullShapeMode( hIMC ); 132 | updateIcons(hIMC); 133 | } 134 | 135 | void StatusWnd::updateIcons(HIMC hIMC) 136 | { 137 | if ( g_isWinLogon ) 138 | return; 139 | IMCLock imc(hIMC); 140 | bool isChinese; 141 | // if( g_enableShift ) 142 | isChinese = imc.isChinese(); 143 | // else 144 | // isChinese = !LOBYTE(GetKeyState(VK_CAPITAL)); 145 | this->setBtnImage( 0, isChinese ? iconChi : iconEng ); 146 | this->setBtnImage( 1, imc.isFullShape() ? iconFull : iconHalf ); 147 | } 148 | 149 | LRESULT StatusWnd::wndProc(UINT msg, WPARAM wp, LPARAM lp) 150 | { 151 | if ( g_isWinLogon ) 152 | return 0; 153 | HIMC hIMC = getIMC(hwnd); 154 | IMCLock imc( hIMC ); 155 | 156 | switch (msg) 157 | { 158 | case WM_PAINT: 159 | { 160 | PAINTSTRUCT ps; 161 | BeginPaint( hwnd, &ps ); 162 | XPToolbar::onPaint(ps); 163 | EndPaint(hwnd, &ps); 164 | break; 165 | } 166 | case WM_COMMAND: 167 | onCommand( LOWORD(wp), hIMC ); 168 | break; 169 | /* case WM_NOTIFY: 170 | { 171 | switch( ((NMHDR*)lp)->code ) 172 | { 173 | case TTN_GETDISPINFO: 174 | { 175 | LPTOOLTIPTEXT pttt; 176 | pttt = (LPTOOLTIPTEXT)lp; 177 | pttt->hinst = g_dllInst; 178 | pttt->lpszText = MAKEINTRESOURCE(pttt->hdr.idFrom); 179 | break; 180 | } 181 | } 182 | } 183 | break; 184 | */ case WM_LBUTTONDOWN: 185 | if( !XPToolbar::onLButtonDown(wp, lp) ) 186 | { 187 | dragging = true; 188 | IMEChildWnd::onLButtonDown(wp, lp); 189 | } 190 | break; 191 | case WM_MOUSEMOVE: 192 | if( dragging || !XPToolbar::onMouseMove(wp, lp) ) 193 | IMEChildWnd::onMouseMove(wp, lp); 194 | break; 195 | case WM_LBUTTONUP: 196 | if( dragging || !XPToolbar::onLButtonUp(wp, lp) ) 197 | { 198 | dragging = false; 199 | IMEChildWnd::onLButtonUp(wp, lp); 200 | } 201 | break; 202 | case WM_MOUSEACTIVATE: 203 | return MA_NOACTIVATE; 204 | case WM_SHOWWINDOW: 205 | if( ! wp ) 206 | { 207 | RECT rc; 208 | GetWindowRect( hwnd, &rc ); 209 | INPUTCONTEXT* ic = imc.getIC(); 210 | if( ic ) 211 | { 212 | ic->ptStatusWndPos.x = rc.left; 213 | ic->ptStatusWndPos.y = rc.top; 214 | } 215 | } 216 | break; 217 | case WM_DESTROY: 218 | { 219 | RECT rc; 220 | GetWindowRect( hwnd, &rc ); 221 | INPUTCONTEXT* ic = imc.getIC(); 222 | if( ic ) 223 | { 224 | ic->ptStatusWndPos.x = rc.left; 225 | ic->ptStatusWndPos.y = rc.top; 226 | } 227 | // DeleteObject(tbbmp); 228 | } 229 | break; 230 | case WM_CAPTURECHANGED: 231 | onCaptureChanged(lp); 232 | break; 233 | 234 | default: 235 | return DefWindowProc(hwnd, msg, wp, lp); 236 | } 237 | return 0; 238 | } 239 | 240 | void StatusWnd::getSize(int *w, int *h) 241 | { 242 | XPToolbar::getSize(w, h); 243 | } 244 | 245 | void StatusWnd::onCommand(UINT id, HIMC hIMC) 246 | { 247 | switch( id ) 248 | { 249 | case ID_CHI_ENG: 250 | toggleChiEngMode(hIMC); 251 | break; 252 | case ID_FULL_HALF: 253 | toggleShapeMode(hIMC); 254 | break; 255 | case ID_MENU: 256 | { 257 | HMENU menu = LoadMenu( g_dllInst, LPCTSTR(IDR_POPUP)); 258 | HMENU popup = GetSubMenu( menu, 0 ); 259 | RECT rc; 260 | GetWindowRect(hwnd, &rc); 261 | rc.left += 9; 262 | UINT flag; 263 | long y; 264 | if((rc.top * 2) > GetSystemMetrics(SM_CYSCREEN) ) 265 | { 266 | y = rc.top; 267 | flag = TPM_BOTTOMALIGN|TPM_LEFTALIGN; 268 | } 269 | else 270 | { 271 | y = rc.bottom; 272 | flag = TPM_TOPALIGN|TPM_LEFTALIGN; 273 | } 274 | TrackPopupMenu( popup, flag, rc.left, y, 0, hwnd, NULL); 275 | DestroyMenu(menu); 276 | break; 277 | } 278 | case ID_CONFIG: 279 | case ID_ABOUT: 280 | try { 281 | HWND top = hwnd; 282 | HWND desktop = GetDesktopWindow(), parent = NULL; 283 | while( (parent=GetParent(top)) != desktop && parent ) 284 | top = parent; 285 | EnableWindow( hwnd, FALSE ); 286 | if( id == ID_CONFIG ) 287 | ConfigureChewingIME(top); 288 | else 289 | DialogBox(g_dllInst, LPCTSTR(IDD_ABOUT), top, (DLGPROC)AboutDlgProc); 290 | EnableWindow( hwnd, TRUE ); 291 | } catch (...) 292 | { 293 | OutputDebugString("Using die wnd"); 294 | } 295 | break; 296 | case ID_WEBSITE: 297 | ShellExecute( NULL, "open", _T("http://chewing.im/"), NULL, NULL, SW_SHOWNORMAL ); 298 | break; 299 | case ID_GROUP: 300 | ShellExecute( NULL, "open", _T("http://groups.google.com/group/chewing"), NULL, NULL, SW_SHOWNORMAL ); 301 | break; 302 | case ID_BUGREPORT: 303 | ShellExecute( NULL, "open", _T("http://code.google.com/p/chewing/issues"), NULL, NULL, SW_SHOWNORMAL ); 304 | break; 305 | case ID_DICT_BUGREPORT: 306 | ShellExecute( NULL, "open", _T("http://of.openfoundry.org/projects/436/rt"), NULL, NULL, SW_SHOWNORMAL ); 307 | break; 308 | case ID_HASHED: 309 | case ID_CHEWING_HELP: 310 | case ID_CHECK_NEW_VER: 311 | { 312 | TCHAR path[MAX_PATH]; 313 | GetSystemDirectory( path, MAX_PATH ); 314 | _tcscat( path, _T("\\IME\\Chewing\\") ); 315 | int showcmd; 316 | if( id == ID_CHEWING_HELP ) { 317 | _tcscat( path, _T("Chewing.chm")); 318 | showcmd = SW_SHOWMAXIMIZED; 319 | } 320 | else if( id == ID_CHECK_NEW_VER ) { 321 | _tcscat( path, _T("Update.exe")); 322 | showcmd = SW_SHOWNORMAL; 323 | } 324 | else { 325 | _tcscat( path, _T("HashEd.exe")); 326 | showcmd = SW_SHOWNORMAL; 327 | } 328 | ShellExecute( NULL, "open", path, NULL, NULL, showcmd ); 329 | break; 330 | } 331 | case ID_DICT: 332 | case ID_SIMPDICT: 333 | case ID_LITTLEDICT: 334 | case ID_PROVERBDICT: 335 | { 336 | LPCTSTR url[]={ 337 | _T("http://dict.revised.moe.edu.tw/"), 338 | _T("http://dict.concised.moe.edu.tw/main/cover/main.htm"), 339 | _T("http://dict.mini.moe.edu.tw/"), 340 | _T("http://dict.idioms.moe.edu.tw/sort_pho.htm")}; 341 | ShellExecute( NULL, "open", url[ id - ID_DICT ], NULL, NULL, SW_SHOWNORMAL ); 342 | break; 343 | } 344 | 345 | } 346 | } 347 | -------------------------------------------------------------------------------- /HashEd-UTF8/HashEd-UTF8.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | 28 | 31 | 34 | 37 | 40 | 49 | 68 | 71 | 76 | 79 | 92 | 95 | 98 | 101 | 104 | 107 | 110 | 113 | 114 | 124 | 127 | 130 | 133 | 136 | 145 | 163 | 166 | 171 | 174 | 187 | 190 | 193 | 196 | 199 | 202 | 205 | 208 | 209 | 210 | 211 | 212 | 213 | 217 | 220 | 221 | 224 | 225 | 228 | 229 | 232 | 235 | 240 | 241 | 244 | 252 | 253 | 254 | 257 | 258 | 261 | 264 | 269 | 270 | 273 | 281 | 282 | 283 | 286 | 287 | 290 | 291 | 294 | 297 | 303 | 304 | 307 | 316 | 317 | 318 | 319 | 323 | 326 | 327 | 330 | 331 | 334 | 335 | 338 | 339 | 342 | 343 | 346 | 347 | 350 | 351 | 354 | 355 | 358 | 359 | 360 | 364 | 367 | 368 | 371 | 372 | 375 | 376 | 377 | 380 | 381 | 384 | 385 | 386 | 387 | 391 | 392 | 393 | -------------------------------------------------------------------------------- /ChewingIME/ChewingIME.dsp: -------------------------------------------------------------------------------- 1 | # Microsoft Developer Studio Project File - Name="ChewingIME" - Package Owner=<4> 2 | # Microsoft Developer Studio Generated Build File, Format Version 6.00 3 | # ** DO NOT EDIT ** 4 | 5 | # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 6 | 7 | CFG=ChewingIME - Win32 Debug 8 | !MESSAGE This is not a valid makefile. To build this project using NMAKE, 9 | !MESSAGE use the Export Makefile command and run 10 | !MESSAGE 11 | !MESSAGE NMAKE /f "ChewingIME.mak". 12 | !MESSAGE 13 | !MESSAGE You can specify a configuration when running NMAKE 14 | !MESSAGE by defining the macro CFG on the command line. For example: 15 | !MESSAGE 16 | !MESSAGE NMAKE /f "ChewingIME.mak" CFG="ChewingIME - Win32 Debug" 17 | !MESSAGE 18 | !MESSAGE Possible choices for configuration are: 19 | !MESSAGE 20 | !MESSAGE "ChewingIME - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") 21 | !MESSAGE "ChewingIME - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") 22 | !MESSAGE 23 | 24 | # Begin Project 25 | # PROP AllowPerConfigDependencies 0 26 | # PROP Scc_ProjName "" 27 | # PROP Scc_LocalPath "" 28 | CPP=cl.exe 29 | MTL=midl.exe 30 | RSC=rc.exe 31 | 32 | !IF "$(CFG)" == "ChewingIME - Win32 Release" 33 | 34 | # PROP BASE Use_MFC 0 35 | # PROP BASE Use_Debug_Libraries 0 36 | # PROP BASE Output_Dir "ChewingIME___Win32_Release" 37 | # PROP BASE Intermediate_Dir "ChewingIME___Win32_Release" 38 | # PROP BASE Target_Dir "" 39 | # PROP Use_MFC 0 40 | # PROP Use_Debug_Libraries 0 41 | # PROP Output_Dir "Release" 42 | # PROP Intermediate_Dir "Release" 43 | # PROP Ignore_Export_Lib 0 44 | # PROP Target_Dir "" 45 | # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CHEWINGIME_EXPORTS" /YX /FD /c 46 | # ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\libchewing\branches\win32\include" /I "..\ChewingServer" /D "USE_BINARY_DAT" /D "NDEBUG" /D "NOIME" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CHEWINGIME_EXPORTS" /D WINVER=0x040A /D "COMPILE_MULTIMON_STUBS" /FR /YX /FD /c 47 | # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 48 | # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 49 | # ADD BASE RSC /l 0x404 /d "NDEBUG" 50 | # ADD RSC /l 0x404 /d "NDEBUG" 51 | BSC32=bscmake.exe 52 | # ADD BASE BSC32 /nologo 53 | # ADD BSC32 /nologo 54 | LINK32=link.exe 55 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 56 | # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib imm32.lib comctl32.lib /nologo /dll /map /machine:I386 /out:"Release/Chewing.ime" /libpath:"..\..\libchewing\branches\win32\win32\Release" 57 | # SUBTRACT LINK32 /debug 58 | 59 | !ELSEIF "$(CFG)" == "ChewingIME - Win32 Debug" 60 | 61 | # PROP BASE Use_MFC 0 62 | # PROP BASE Use_Debug_Libraries 1 63 | # PROP BASE Output_Dir "ChewingIME___Win32_Debug" 64 | # PROP BASE Intermediate_Dir "ChewingIME___Win32_Debug" 65 | # PROP BASE Target_Dir "" 66 | # PROP Use_MFC 0 67 | # PROP Use_Debug_Libraries 1 68 | # PROP Output_Dir "Debug" 69 | # PROP Intermediate_Dir "Debug" 70 | # PROP Ignore_Export_Lib 0 71 | # PROP Target_Dir "" 72 | # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CHEWINGIME_EXPORTS" /YX /FD /GZ /c 73 | # ADD CPP /nologo /MTd /W3 /GX /ZI /Od /I "..\..\libchewing\branches\win32\include" /I "..\ChewingServer" /D "USE_BINARY_DAT" /D "_DEBUG" /D "NOIME" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CHEWINGIME_EXPORTS" /D WINVER=0x040A /D "COMPILE_MULTIMON_STUBS" /FR /YX /FD /GZ /c 74 | # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 75 | # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 76 | # ADD BASE RSC /l 0x404 /d "_DEBUG" 77 | # ADD RSC /l 0x404 /d "_DEBUG" 78 | BSC32=bscmake.exe 79 | # ADD BASE BSC32 /nologo 80 | # ADD BSC32 /nologo 81 | LINK32=link.exe 82 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept 83 | # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib imm32.lib libchewing.lib comctl32.lib /nologo /dll /debug /machine:I386 /out:"Debug/Chewing.ime" /pdbtype:sept /libpath:"..\..\libchewing\branches\win32\win32\Release" 84 | # Begin Special Build Tool 85 | SOURCE="$(InputPath)" 86 | PostBuild_Cmds=@echo on del C:\Windows\System32\Chewing.ime copy .\Debug\Chewing.ime c:\windows\system32\Chewing.ime 87 | # End Special Build Tool 88 | 89 | !ENDIF 90 | 91 | # Begin Target 92 | 93 | # Name "ChewingIME - Win32 Release" 94 | # Name "ChewingIME - Win32 Debug" 95 | # Begin Group "Source Files" 96 | 97 | # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" 98 | # Begin Source File 99 | 100 | SOURCE=.\CandList.cpp 101 | # End Source File 102 | # Begin Source File 103 | 104 | SOURCE=.\CandWnd.cpp 105 | # End Source File 106 | # Begin Source File 107 | 108 | SOURCE=..\..\libchewing\branches\win32\src\char.c 109 | # End Source File 110 | # Begin Source File 111 | 112 | SOURCE=.\ChewingClient.cpp 113 | # End Source File 114 | # Begin Source File 115 | 116 | SOURCE=.\ChewingIME.cpp 117 | # End Source File 118 | # Begin Source File 119 | 120 | SOURCE=.\ChewingIME.def 121 | # End Source File 122 | # Begin Source File 123 | 124 | SOURCE=.\ChewingIME.rc 125 | # End Source File 126 | # Begin Source File 127 | 128 | SOURCE=..\..\libchewing\branches\win32\src\chewingio.c 129 | # End Source File 130 | # Begin Source File 131 | 132 | SOURCE=..\..\libchewing\branches\win32\src\chewingutil.c 133 | # End Source File 134 | # Begin Source File 135 | 136 | SOURCE=..\..\libchewing\branches\win32\src\choice.c 137 | # End Source File 138 | # Begin Source File 139 | 140 | SOURCE=.\CompStr.cpp 141 | # End Source File 142 | # Begin Source File 143 | 144 | SOURCE=.\CompWnd.cpp 145 | # End Source File 146 | # Begin Source File 147 | 148 | SOURCE=..\..\libchewing\branches\win32\src\dict.c 149 | # End Source File 150 | # Begin Source File 151 | 152 | SOURCE=.\DrawUtil.cpp 153 | # End Source File 154 | # Begin Source File 155 | 156 | SOURCE=..\..\libchewing\branches\win32\src\hanyupinying.c 157 | # End Source File 158 | # Begin Source File 159 | 160 | SOURCE=..\..\libchewing\branches\win32\src\hash.c 161 | # End Source File 162 | # Begin Source File 163 | 164 | SOURCE=.\IMCLock.cpp 165 | # End Source File 166 | # Begin Source File 167 | 168 | SOURCE=.\IMEChildWnd.cpp 169 | # End Source File 170 | # Begin Source File 171 | 172 | SOURCE=.\IMEUI.cpp 173 | # End Source File 174 | # Begin Source File 175 | 176 | SOURCE=.\IMEUILock.cpp 177 | # End Source File 178 | # Begin Source File 179 | 180 | SOURCE=..\..\libchewing\branches\win32\src\common\key2pho.c 181 | # End Source File 182 | # Begin Source File 183 | 184 | SOURCE=.\StatusWnd.cpp 185 | # End Source File 186 | # Begin Source File 187 | 188 | SOURCE=.\Tooltip.cpp 189 | # End Source File 190 | # Begin Source File 191 | 192 | SOURCE=..\..\libchewing\branches\win32\src\tree.c 193 | # End Source File 194 | # Begin Source File 195 | 196 | SOURCE=..\..\libchewing\branches\win32\src\userphrase.c 197 | # End Source File 198 | # Begin Source File 199 | 200 | SOURCE=.\Window.cpp 201 | # End Source File 202 | # Begin Source File 203 | 204 | SOURCE=.\XPToolbar.cpp 205 | # End Source File 206 | # Begin Source File 207 | 208 | SOURCE=..\..\libchewing\branches\win32\src\zuin.c 209 | # End Source File 210 | # End Group 211 | # Begin Group "Header Files" 212 | 213 | # PROP Default_Filter "h;hpp;hxx;hm;inl" 214 | # Begin Source File 215 | 216 | SOURCE=.\CandList.h 217 | # End Source File 218 | # Begin Source File 219 | 220 | SOURCE=.\CandWnd.h 221 | # End Source File 222 | # Begin Source File 223 | 224 | SOURCE=.\ChewingIME.h 225 | # End Source File 226 | # Begin Source File 227 | 228 | SOURCE=.\CompStr.h 229 | # End Source File 230 | # Begin Source File 231 | 232 | SOURCE=.\CompWnd.h 233 | # End Source File 234 | # Begin Source File 235 | 236 | SOURCE=.\DrawUtil.h 237 | # End Source File 238 | # Begin Source File 239 | 240 | SOURCE=.\IMCLock.h 241 | # End Source File 242 | # Begin Source File 243 | 244 | SOURCE=.\IMEChildWnd.h 245 | # End Source File 246 | # Begin Source File 247 | 248 | SOURCE=.\IMEUI.h 249 | # End Source File 250 | # Begin Source File 251 | 252 | SOURCE=.\IMEUILock.h 253 | # End Source File 254 | # Begin Source File 255 | 256 | SOURCE=.\imm.h 257 | # End Source File 258 | # Begin Source File 259 | 260 | SOURCE=..\..\libchewing\branches\win32\src\private.h 261 | # End Source File 262 | # Begin Source File 263 | 264 | SOURCE=.\resource.h 265 | # End Source File 266 | # Begin Source File 267 | 268 | SOURCE=.\StatusWnd.h 269 | # End Source File 270 | # Begin Source File 271 | 272 | SOURCE=.\Tooltip.h 273 | # End Source File 274 | # Begin Source File 275 | 276 | SOURCE=.\Window.h 277 | # End Source File 278 | # Begin Source File 279 | 280 | SOURCE=.\XPToolbar.h 281 | # End Source File 282 | # End Group 283 | # Begin Group "Resource Files" 284 | 285 | # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" 286 | # Begin Source File 287 | 288 | SOURCE=.\chi.ico 289 | # End Source File 290 | # Begin Source File 291 | 292 | SOURCE=.\config.ico 293 | # End Source File 294 | # Begin Source File 295 | 296 | SOURCE=.\config1.ico 297 | # End Source File 298 | # Begin Source File 299 | 300 | SOURCE=.\congi.ico 301 | # End Source File 302 | # Begin Source File 303 | 304 | SOURCE=.\eng.ico 305 | # End Source File 306 | # Begin Source File 307 | 308 | SOURCE=.\full.ico 309 | # End Source File 310 | # Begin Source File 311 | 312 | SOURCE=.\fullshap.ico 313 | # End Source File 314 | # Begin Source File 315 | 316 | SOURCE=.\half.ico 317 | # End Source File 318 | # Begin Source File 319 | 320 | SOURCE=.\icon.bmp 321 | # End Source File 322 | # Begin Source File 323 | 324 | SOURCE=.\icon1.ico 325 | # End Source File 326 | # Begin Source File 327 | 328 | SOURCE=.\icon2.ico 329 | # End Source File 330 | # Begin Source File 331 | 332 | SOURCE=.\icon3.ico 333 | # End Source File 334 | # Begin Source File 335 | 336 | SOURCE=.\Mainicon.ico 337 | # End Source File 338 | # Begin Source File 339 | 340 | SOURCE=.\status_bar24.bmp 341 | # End Source File 342 | # Begin Source File 343 | 344 | SOURCE=.\status_bar256.bmp 345 | # End Source File 346 | # End Group 347 | # End Target 348 | # End Project 349 | --------------------------------------------------------------------------------