Skip to content

Commit

Permalink
活用しない語を縮めた時に活用する語に移行しない交ぜ書き変換開始シーケンス追加
Browse files Browse the repository at this point in the history
  • Loading branch information
deton committed Oct 20, 2016
1 parent 460cc44 commit 02c0476
Show file tree
Hide file tree
Showing 5 changed files with 180 additions and 159 deletions.
22 changes: 14 additions & 8 deletions imcrvtip/KeyHandlerControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1103,23 +1103,29 @@ void CTextService::_HandleFunc(TfEditCookie ec, ITfContext *pContext, const ROMA
//後置型交ぜ書き変換
else if(wcsncmp(rkc.hiragana, L"Maze", 4) == 0)
{
int offset = 4;
BOOL isKatuyo = FALSE;
if(rkc.hiragana[4] == L'K')
{
offset = 5;
isKatuyo = TRUE;
}
if(postconvctx != PCC_COMPOSITION)
{
int offset = 4;
bool isKatuyo = false;
bool resizeWithInflection = true;
if(rkc.hiragana[4] == L'K')
{
offset = 5;
isKatuyo = true;
}
else if(rkc.hiragana[4] == L'k')
{
offset = 5;
resizeWithInflection = false;
}
//前置型交ぜ書き変換で入力中の読みの一部に対する後置型交ぜ書き変換
//は未対応。候補表示等の制御が面倒なので。
int count = _wtoi(rkc.hiragana + offset);
if(count < 0) //count=0の場合、なるべく長く読みとみなす
{
count = 1;
}
_HandlePostMaze(ec, pContext, count, postconvctx, isKatuyo);
_HandlePostMaze(ec, pContext, count, postconvctx, isKatuyo, resizeWithInflection);
}
else
{
Expand Down
10 changes: 7 additions & 3 deletions imcrvtip/KeyHandlerPostConv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@
#include "mozc/win32/base/input_state.h"
#include "moji.h"

//後置型交ぜ書き変換
HRESULT CTextService::_HandlePostMaze(TfEditCookie ec, ITfContext *pContext, int count, PostConvContext postconvctx, BOOL isKatuyo)
/**
* 後置型交ぜ書き変換を開始する
* @param isKatuyo 活用する語として変換を開始するか
* @param resizeWithInflection 活用しない語を縮めた時に、活用する語としての変換を試みるか
*/
HRESULT CTextService::_HandlePostMaze(TfEditCookie ec, ITfContext *pContext, int count, PostConvContext postconvctx, bool isKatuyo, bool resizeWithInflection)
{
postmazeContext.Deactivate();
//カーソル直前の文字列を取得
Expand All @@ -28,7 +32,7 @@ HRESULT CTextService::_HandlePostMaze(TfEditCookie ec, ITfContext *pContext, int
}
std::wstring yomi(text);
//count==0:文字数指定無しの場合は縮めながら変換
postmazeContext.Activate(yomi, (isKatuyo == TRUE), (count == 0));
postmazeContext.Activate(yomi, isKatuyo, (count == 0), resizeWithInflection);
if(isKatuyo)
{
//TODO:読みに含まれる語尾を―に置き換えて変換
Expand Down
Loading

0 comments on commit 02c0476

Please sign in to comment.