forked from EasyIME/PIME
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 5545858
Showing
26 changed files
with
1,782 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Hong Jen Yee/�x���� (PCMan) <[email protected]> |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include "ChewingImeModule.h" | ||
#include "ChewingTextService.h" | ||
|
||
using namespace Chewing; | ||
|
||
ImeModule::ImeModule(HMODULE module): | ||
Ime::ImeModule(module) { | ||
} | ||
|
||
ImeModule::~ImeModule(void) { | ||
} | ||
|
||
// virtual | ||
Ime::TextService* ImeModule::createTextService() { | ||
TextService* service = new Chewing::TextService(); | ||
return service; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#ifndef CHEWING_IME_MODULE_H | ||
#define CHEWING_IME_MODULE_H | ||
|
||
#include <LibIME/ImeModule.h> | ||
|
||
namespace Chewing { | ||
|
||
class ImeModule : public Ime::ImeModule { | ||
public: | ||
ImeModule(HMODULE module); | ||
virtual ~ImeModule(void); | ||
|
||
virtual Ime::TextService* createTextService(); | ||
}; | ||
|
||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include "ChewingTextService.h" | ||
|
||
using namespace Chewing; | ||
|
||
TextService::TextService(void) { | ||
} | ||
|
||
TextService::~TextService(void) { | ||
} | ||
|
||
bool TextService::onKeyDown(long key) { | ||
return true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
LIBRARY ChewingTextService.dll | ||
|
||
EXPORTS | ||
DllGetClassObject PRIVATE | ||
DllCanUnloadNow PRIVATE | ||
DllRegisterServer PRIVATE | ||
DllUnregisterServer PRIVATE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#ifndef CHEWING_TEXT_SERVICE_H | ||
#define CHEWING_TEXT_SERVICE_H | ||
|
||
#include <LibIME/TextService.h> | ||
|
||
namespace Chewing { | ||
|
||
class TextService: public Ime::TextService { | ||
public: | ||
TextService(void); | ||
virtual ~TextService(void); | ||
|
||
virtual bool onKeyDown(long key); | ||
}; | ||
|
||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<ItemGroup Label="ProjectConfigurations"> | ||
<ProjectConfiguration Include="Debug|Win32"> | ||
<Configuration>Debug</Configuration> | ||
<Platform>Win32</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Debug|x64"> | ||
<Configuration>Debug</Configuration> | ||
<Platform>x64</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Release|Win32"> | ||
<Configuration>Release</Configuration> | ||
<Platform>Win32</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Release|x64"> | ||
<Configuration>Release</Configuration> | ||
<Platform>x64</Platform> | ||
</ProjectConfiguration> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="ChewingTextService.def" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClCompile Include="ChewingImeModule.cpp" /> | ||
<ClCompile Include="ChewingTextService.cpp" /> | ||
<ClCompile Include="DllEntry.cpp" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClInclude Include="ChewingImeModule.h" /> | ||
<ClInclude Include="ChewingTextService.h" /> | ||
</ItemGroup> | ||
<PropertyGroup Label="Globals"> | ||
<ProjectGuid>{C2843899-A670-4753-B79D-776A42F7BC77}</ProjectGuid> | ||
<Keyword>Win32Proj</Keyword> | ||
<RootNamespace>ChewingTextService</RootNamespace> | ||
</PropertyGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> | ||
<ConfigurationType>DynamicLibrary</ConfigurationType> | ||
<UseDebugLibraries>true</UseDebugLibraries> | ||
<CharacterSet>Unicode</CharacterSet> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> | ||
<ConfigurationType>DynamicLibrary</ConfigurationType> | ||
<UseDebugLibraries>true</UseDebugLibraries> | ||
<CharacterSet>Unicode</CharacterSet> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> | ||
<ConfigurationType>DynamicLibrary</ConfigurationType> | ||
<UseDebugLibraries>false</UseDebugLibraries> | ||
<WholeProgramOptimization>true</WholeProgramOptimization> | ||
<CharacterSet>Unicode</CharacterSet> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> | ||
<ConfigurationType>DynamicLibrary</ConfigurationType> | ||
<UseDebugLibraries>false</UseDebugLibraries> | ||
<WholeProgramOptimization>true</WholeProgramOptimization> | ||
<CharacterSet>Unicode</CharacterSet> | ||
</PropertyGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | ||
<ImportGroup Label="ExtensionSettings"> | ||
</ImportGroup> | ||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
</ImportGroup> | ||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
</ImportGroup> | ||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
</ImportGroup> | ||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
</ImportGroup> | ||
<PropertyGroup Label="UserMacros" /> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||
<LinkIncremental>true</LinkIncremental> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||
<LinkIncremental>true</LinkIncremental> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||
<LinkIncremental>false</LinkIncremental> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||
<LinkIncremental>false</LinkIncremental> | ||
</PropertyGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||
<ClCompile> | ||
<PrecompiledHeader> | ||
</PrecompiledHeader> | ||
<WarningLevel>Level3</WarningLevel> | ||
<Optimization>Disabled</Optimization> | ||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;CHEWINGTEXTSERVICE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
<AdditionalIncludeDirectories>$(ProjectDir)\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||
</ClCompile> | ||
<Link> | ||
<SubSystem>Windows</SubSystem> | ||
<GenerateDebugInformation>true</GenerateDebugInformation> | ||
<AdditionalDependencies>$(OutDir)\libIme.lib;%(AdditionalDependencies)</AdditionalDependencies> | ||
<ModuleDefinitionFile>ChewingTextService.def</ModuleDefinitionFile> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||
<ClCompile> | ||
<PrecompiledHeader> | ||
</PrecompiledHeader> | ||
<WarningLevel>Level3</WarningLevel> | ||
<Optimization>Disabled</Optimization> | ||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;CHEWINGTEXTSERVICE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
<AdditionalIncludeDirectories>$(ProjectDir)\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||
</ClCompile> | ||
<Link> | ||
<SubSystem>Windows</SubSystem> | ||
<GenerateDebugInformation>true</GenerateDebugInformation> | ||
<AdditionalDependencies>$(OutDir)\libIme.lib;%(AdditionalDependencies)</AdditionalDependencies> | ||
<ModuleDefinitionFile>ChewingTextService.def</ModuleDefinitionFile> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||
<ClCompile> | ||
<WarningLevel>Level3</WarningLevel> | ||
<PrecompiledHeader> | ||
</PrecompiledHeader> | ||
<Optimization>MaxSpeed</Optimization> | ||
<FunctionLevelLinking>true</FunctionLevelLinking> | ||
<IntrinsicFunctions>true</IntrinsicFunctions> | ||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;CHEWINGTEXTSERVICE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
<AdditionalIncludeDirectories>$(ProjectDir)\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||
</ClCompile> | ||
<Link> | ||
<SubSystem>Windows</SubSystem> | ||
<GenerateDebugInformation>true</GenerateDebugInformation> | ||
<EnableCOMDATFolding>true</EnableCOMDATFolding> | ||
<OptimizeReferences>true</OptimizeReferences> | ||
<AdditionalDependencies>$(OutDir)\libIme.lib;%(AdditionalDependencies)</AdditionalDependencies> | ||
<ModuleDefinitionFile>ChewingTextService.def</ModuleDefinitionFile> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||
<ClCompile> | ||
<WarningLevel>Level3</WarningLevel> | ||
<PrecompiledHeader> | ||
</PrecompiledHeader> | ||
<Optimization>MaxSpeed</Optimization> | ||
<FunctionLevelLinking>true</FunctionLevelLinking> | ||
<IntrinsicFunctions>true</IntrinsicFunctions> | ||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;CHEWINGTEXTSERVICE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
<AdditionalIncludeDirectories>$(ProjectDir)\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||
</ClCompile> | ||
<Link> | ||
<SubSystem>Windows</SubSystem> | ||
<GenerateDebugInformation>true</GenerateDebugInformation> | ||
<EnableCOMDATFolding>true</EnableCOMDATFolding> | ||
<OptimizeReferences>true</OptimizeReferences> | ||
<AdditionalDependencies>$(OutDir)\libIme.lib;%(AdditionalDependencies)</AdditionalDependencies> | ||
<ModuleDefinitionFile>ChewingTextService.def</ModuleDefinitionFile> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||
<ImportGroup Label="ExtensionTargets"> | ||
</ImportGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#include "ChewingImeModule.h" | ||
|
||
Chewing::ImeModule* g_imeModule = NULL; | ||
|
||
// CLSID of our Text service | ||
// {13F2EF08-575C-4D8C-88E0-F67BB8052B84} | ||
static const CLSID g_textServiceClsid = { | ||
0x13f2ef08, 0x575c, 0x4d8c, { 0x88, 0xe0, 0xf6, 0x7b, 0xb8, 0x5, 0x2b, 0x84 } | ||
}; | ||
|
||
// GUID of our language profile | ||
// {CE45F71D-CE79-41D1-967D-640B65A380E3} | ||
static const GUID g_profileGuid = { | ||
0xce45f71d, 0xce79, 0x41d1, { 0x96, 0x7d, 0x64, 0xb, 0x65, 0xa3, 0x80, 0xe3 } | ||
}; | ||
|
||
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { | ||
switch (ul_reason_for_call) { | ||
case DLL_PROCESS_ATTACH: | ||
::DisableThreadLibraryCalls(hModule); // disable DllMain calls due to new thread creation | ||
g_imeModule = new Chewing::ImeModule(hModule); | ||
break; | ||
case DLL_PROCESS_DETACH: | ||
if(g_imeModule) { | ||
g_imeModule->Release(); | ||
g_imeModule = NULL; | ||
} | ||
break; | ||
} | ||
return TRUE; | ||
} | ||
|
||
STDAPI DllCanUnloadNow(void) { | ||
return g_imeModule->canUnloadNow(); | ||
} | ||
|
||
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppvObj) { | ||
return g_imeModule->getClassObject(rclsid, riid, ppvObj); | ||
} | ||
|
||
STDAPI DllUnregisterServer(void) { | ||
return g_imeModule->unregisterServer(g_textServiceClsid, g_profileGuid); | ||
} | ||
|
||
STDAPI DllRegisterServer(void) { | ||
return g_imeModule->registerServer( | ||
L"·s»Åµ¿é¤Jªk", | ||
g_textServiceClsid, | ||
g_profileGuid, | ||
MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
LibIME contains a library which aims to be a simple wrapper for Windows Text Service Framework (TSF). | ||
|
||
ChewingTextService contains an implementation of Windows text service for libchewing using libIME. | ||
|
||
Both parts are licensed under GNU LGPL license. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 11.00 | ||
# Visual Studio 2010 | ||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libIME", "libIME\libIME.vcxproj", "{5BB824BB-2835-4D47-ACFC-292467D571A1}" | ||
EndProject | ||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ChewingTextService", "ChewingTextService\ChewingTextService.vcxproj", "{C2843899-A670-4753-B79D-776A42F7BC77}" | ||
ProjectSection(ProjectDependencies) = postProject | ||
{5BB824BB-2835-4D47-ACFC-292467D571A1} = {5BB824BB-2835-4D47-ACFC-292467D571A1} | ||
EndProjectSection | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Win32 = Debug|Win32 | ||
Debug|x64 = Debug|x64 | ||
Release|Win32 = Release|Win32 | ||
Release|x64 = Release|x64 | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{5BB824BB-2835-4D47-ACFC-292467D571A1}.Debug|Win32.ActiveCfg = Debug|Win32 | ||
{5BB824BB-2835-4D47-ACFC-292467D571A1}.Debug|Win32.Build.0 = Debug|Win32 | ||
{5BB824BB-2835-4D47-ACFC-292467D571A1}.Debug|x64.ActiveCfg = Debug|x64 | ||
{5BB824BB-2835-4D47-ACFC-292467D571A1}.Debug|x64.Build.0 = Debug|x64 | ||
{5BB824BB-2835-4D47-ACFC-292467D571A1}.Release|Win32.ActiveCfg = Release|Win32 | ||
{5BB824BB-2835-4D47-ACFC-292467D571A1}.Release|Win32.Build.0 = Release|Win32 | ||
{5BB824BB-2835-4D47-ACFC-292467D571A1}.Release|x64.ActiveCfg = Release|x64 | ||
{5BB824BB-2835-4D47-ACFC-292467D571A1}.Release|x64.Build.0 = Release|x64 | ||
{C2843899-A670-4753-B79D-776A42F7BC77}.Debug|Win32.ActiveCfg = Debug|Win32 | ||
{C2843899-A670-4753-B79D-776A42F7BC77}.Debug|Win32.Build.0 = Debug|Win32 | ||
{C2843899-A670-4753-B79D-776A42F7BC77}.Debug|x64.ActiveCfg = Debug|x64 | ||
{C2843899-A670-4753-B79D-776A42F7BC77}.Debug|x64.Build.0 = Debug|x64 | ||
{C2843899-A670-4753-B79D-776A42F7BC77}.Release|Win32.ActiveCfg = Release|Win32 | ||
{C2843899-A670-4753-B79D-776A42F7BC77}.Release|Win32.Build.0 = Release|Win32 | ||
{C2843899-A670-4753-B79D-776A42F7BC77}.Release|x64.ActiveCfg = Release|x64 | ||
{C2843899-A670-4753-B79D-776A42F7BC77}.Release|x64.Build.0 = Release|x64 | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#include "EditSession.h" | ||
#include "TextService.h" | ||
#include <assert.h> | ||
|
||
using namespace Ime; | ||
|
||
EditSession::EditSession(TextService* service, ITfContext* context): | ||
textService_(service), | ||
context_(context), | ||
refCount_(1) { | ||
if(textService_) | ||
textService_->AddRef(); | ||
if(context_) | ||
context_->AddRef(); | ||
} | ||
|
||
EditSession::~EditSession(void) { | ||
if(textService_) | ||
textService_->Release(); | ||
if(context_) | ||
context_->Release(); | ||
} | ||
|
||
// COM stuff | ||
|
||
// IUnknown | ||
STDMETHODIMP EditSession::QueryInterface(REFIID riid, void **ppvObj) { | ||
if (ppvObj == NULL) | ||
return E_INVALIDARG; | ||
|
||
if(IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_ITfEditSession)) | ||
*ppvObj = (ITfEditSession*)this; | ||
else | ||
*ppvObj = NULL; | ||
|
||
if(*ppvObj) { | ||
AddRef(); | ||
return S_OK; | ||
} | ||
return E_NOINTERFACE; | ||
} | ||
|
||
// IUnknown implementation | ||
STDMETHODIMP_(ULONG) EditSession::AddRef(void) { | ||
return ++refCount_; | ||
} | ||
|
||
STDMETHODIMP_(ULONG) EditSession::Release(void) { | ||
assert(refCount_ > 0); | ||
--refCount_; | ||
if(0 == refCount_) | ||
delete this; | ||
return refCount_; | ||
} |
Oops, something went wrong.