diff --git a/common/common.cpp b/common/common.cpp index c272c835..0777cb65 100644 --- a/common/common.cpp +++ b/common/common.cpp @@ -38,12 +38,12 @@ const TF_DISPLAYATTRIBUTE c_daDisplayAttributeInputText = const TF_DISPLAYATTRIBUTE c_daDisplayAttributeInputOkuri = { - {TF_CT_NONE, RGB(0x00, 0x00, 0x00)}, // TF_DA_COLOR crText; - {TF_CT_NONE, RGB(0xFF, 0xFF, 0xFF)}, // TF_DA_COLOR crBk; + {TF_CT_COLORREF, RGB(0x00, 0x80, 0xFF)}, // TF_DA_COLOR crText; + {TF_CT_COLORREF, RGB(0xFF, 0xFF, 0xFF)}, // TF_DA_COLOR crBk; TF_LS_DASH, // TF_DA_LINESTYLE lsStyle; FALSE, // BOOL fBoldLine; {TF_CT_NONE, 0}, // TF_DA_COLOR crLine; - TF_ATTR_INPUT // TF_DA_ATTR_INFO bAttr; + TF_ATTR_FIXEDCONVERTED // TF_DA_ATTR_INFO bAttr; }; const TF_DISPLAYATTRIBUTE c_daDisplayAttributeConvMark = diff --git a/common/common.h b/common/common.h index d3e136f5..ec2800f1 100644 --- a/common/common.h +++ b/common/common.h @@ -3,7 +3,7 @@ #define COMMON_H #define TEXTSERVICE_NAME L"CorvusSKK" -#define TEXTSERVICE_VER L"1.7.14" +#define TEXTSERVICE_VER L"1.8.0" #ifndef _DEBUG #define TEXTSERVICE_DESC TEXTSERVICE_NAME @@ -14,8 +14,8 @@ //for resource #define RC_AUTHOR "nathancorvussolis" #define RC_PRODUCT "CorvusSKK" -#define RC_VERSION "1.7.14" -#define RC_VERSION_D 1,7,14,0 +#define RC_VERSION "1.8.0" +#define RC_VERSION_D 1,8,0,0 #define MAX_KRNLOBJNAME 256 #define CONV_POINT_NUM 256 @@ -35,6 +35,7 @@ //request #define REQ_SEARCH L'1' //辞書検索 +#define REQ_SEARCHUSER L'2' //辞書検索(ユーザー辞書のみ) #define REQ_COMPLEMENT L'4' //補完 #define REQ_CONVERTKEY L'5' //見出し語変換 #define REQ_CONVERTCND L'6' //候補変換 diff --git a/common/configxml.cpp b/common/configxml.cpp index 4f99a6f8..11c393bc 100644 --- a/common/configxml.cpp +++ b/common/configxml.cpp @@ -63,6 +63,9 @@ LPCWSTR ValueBackIncEnter = L"backincenter"; LPCWSTR ValueAddCandKtkn = L"addcandktkn"; LPCWSTR ValueShiftNNOkuri = L"shiftnnokuri"; LPCWSTR ValuePrecedeOkuri = L"precedeokuri"; +LPCWSTR ValueDynamicComp = L"dynamiccomp"; +LPCWSTR ValueDynCompMulti = L"dyncompmulti"; +LPCWSTR ValueCompUserDic = L"compuserdic"; //font section diff --git a/common/configxml.h b/common/configxml.h index 9d1dead7..64f532b3 100644 --- a/common/configxml.h +++ b/common/configxml.h @@ -93,6 +93,9 @@ extern LPCWSTR ValueBackIncEnter; extern LPCWSTR ValueAddCandKtkn; extern LPCWSTR ValueShiftNNOkuri; extern LPCWSTR ValuePrecedeOkuri; +extern LPCWSTR ValueDynamicComp; +extern LPCWSTR ValueDynCompMulti; +extern LPCWSTR ValueCompUserDic; //font section diff --git a/imcrvcnf/DlgProcBehavior.cpp b/imcrvcnf/DlgProcBehavior.cpp index a5a62c5c..ff3ca614 100644 --- a/imcrvcnf/DlgProcBehavior.cpp +++ b/imcrvcnf/DlgProcBehavior.cpp @@ -21,6 +21,9 @@ INT_PTR CALLBACK DlgProcBehavior(HWND hDlg, UINT message, WPARAM wParam, LPARAM LoadCheckButton(hDlg, IDC_CHECKBOX_ADDCANDKTKN, SectionBehavior, ValueAddCandKtkn); LoadCheckButton(hDlg, IDC_CHECKBOX_SHIFTNNOKURI, SectionBehavior, ValueShiftNNOkuri, L"1"); LoadCheckButton(hDlg, IDC_CHECKBOX_PRECEDEOKURI, SectionBehavior, ValuePrecedeOkuri); + LoadCheckButton(hDlg, IDC_CHECKBOX_DYNAMINCOMP, SectionBehavior, ValueDynamicComp); + LoadCheckButton(hDlg, IDC_CHECKBOX_DYNCOMPMULTI, SectionBehavior, ValueDynCompMulti); + LoadCheckButton(hDlg, IDC_CHECKBOX_COMPUSERDIC, SectionBehavior, ValueCompUserDic); return TRUE; @@ -37,7 +40,12 @@ INT_PTR CALLBACK DlgProcBehavior(HWND hDlg, UINT message, WPARAM wParam, LPARAM case IDC_CHECKBOX_ADDCANDKTKN: case IDC_CHECKBOX_SHIFTNNOKURI: case IDC_CHECKBOX_PRECEDEOKURI: + case IDC_CHECKBOX_DYNAMINCOMP: + case IDC_CHECKBOX_DYNCOMPMULTI: + case IDC_CHECKBOX_COMPUSERDIC: + PropSheet_Changed(GetParent(hDlg), hDlg); + return TRUE; default: @@ -60,6 +68,9 @@ INT_PTR CALLBACK DlgProcBehavior(HWND hDlg, UINT message, WPARAM wParam, LPARAM SaveCheckButton(hDlg, IDC_CHECKBOX_ADDCANDKTKN, ValueAddCandKtkn); SaveCheckButton(hDlg, IDC_CHECKBOX_SHIFTNNOKURI, ValueShiftNNOkuri); SaveCheckButton(hDlg, IDC_CHECKBOX_PRECEDEOKURI, ValuePrecedeOkuri); + SaveCheckButton(hDlg, IDC_CHECKBOX_DYNAMINCOMP, ValueDynamicComp); + SaveCheckButton(hDlg, IDC_CHECKBOX_DYNCOMPMULTI, ValueDynCompMulti); + SaveCheckButton(hDlg, IDC_CHECKBOX_COMPUSERDIC, ValueCompUserDic); WriterEndSection(pXmlWriter); //End of SectionBehavior diff --git a/imcrvcnf/imcrvcnf.rc b/imcrvcnf/imcrvcnf.rc index 6058aab9..d392a71b 100644 Binary files a/imcrvcnf/imcrvcnf.rc and b/imcrvcnf/imcrvcnf.rc differ diff --git a/imcrvcnf/resource.h b/imcrvcnf/resource.h index 93fa5252..187f78b0 100644 --- a/imcrvcnf/resource.h +++ b/imcrvcnf/resource.h @@ -45,6 +45,9 @@ #define IDC_CHECKBOX_ADDCANDKTKN 1108 #define IDC_CHECKBOX_SHIFTNNOKURI 1109 #define IDC_CHECKBOX_PRECEDEOKURI 1110 +#define IDC_CHECKBOX_DYNAMINCOMP 1111 +#define IDC_CHECKBOX_DYNCOMPMULTI 1112 +#define IDC_CHECKBOX_COMPUSERDIC 1113 #define IDC_EDIT_FONTNAME 2001 #define IDC_EDIT_FONTPOINT 2002 diff --git a/imcrvmgr/SearchDictionary.cpp b/imcrvmgr/SearchDictionary.cpp index 81de8b6d..42698554 100644 --- a/imcrvmgr/SearchDictionary.cpp +++ b/imcrvmgr/SearchDictionary.cpp @@ -114,7 +114,7 @@ std::wstring SearchSKKDic(const std::wstring &searchkey) fseek(fpdic, pos, SEEK_SET); memset(wbuf, 0, sizeof(wbuf)); - + fgetws(wbuf, _countof(wbuf), fpdic); wsbuf = wbuf; diff --git a/imcrvmgr/SearchUserDictionary.cpp b/imcrvmgr/SearchUserDictionary.cpp index 69a930cb..767a3c21 100644 --- a/imcrvmgr/SearchUserDictionary.cpp +++ b/imcrvmgr/SearchUserDictionary.cpp @@ -78,7 +78,8 @@ void SearchComplement(const std::wstring &searchkey, SKKDICCANDIDATES &sc) { REVERSE_ITERATION_I(keyorder_ritr, complements) { - if(keyorder_ritr->compare(0, searchkey.size(), searchkey) == 0) + if(keyorder_ritr->compare(0, searchkey.size(), searchkey) == 0 && + searchkey.size() < keyorder_ritr->size()) { sc.push_back(SKKDICCANDIDATE(*keyorder_ritr, L"")); } diff --git a/imcrvmgr/imcrvmgr.cpp b/imcrvmgr/imcrvmgr.cpp index afa0b693..c67b4320 100644 --- a/imcrvmgr/imcrvmgr.cpp +++ b/imcrvmgr/imcrvmgr.cpp @@ -185,6 +185,10 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) // request "1\n\t\t\n" // reply "T\n\t\t\t\n...\n":hit // "F\n":nothing +//search candidate (user dictionary only) +// request "2\n\t\t\n" +// reply "T\n\t\t\t\n...\n":hit +// "F\n":nothing //search key for complement // request "4\n\t\t\n" // reply "T\n\t\t\t\n...\n":hit @@ -224,6 +228,7 @@ void SrvProc(WCHAR command, const std::wstring &argument, std::wstring &result) switch(command) { case REQ_SEARCH: + case REQ_SEARCHUSER: re.assign(L"(.*)\t(.*)\t(.*)\n"); fmt.assign(L"$1"); key = std::regex_replace(argument, re, fmt); @@ -232,7 +237,21 @@ void SrvProc(WCHAR command, const std::wstring &argument, std::wstring &result) fmt.assign(L"$3"); okuri = std::regex_replace(argument, re, fmt); - SearchDictionary(key, okuri, sc); + switch(command) + { + case REQ_SEARCH: + SearchDictionary(key, okuri, sc); + break; + case REQ_SEARCHUSER: + candidate = SearchUserDic(key, okuri); + re.assign(L"[\\x00-\\x19]"); + fmt.assign(L""); + candidate = std::regex_replace(candidate, re, fmt); + ParseSKKDicCandiate(candidate, sc); + break; + default: + break; + } if(!sc.empty()) { @@ -420,6 +439,7 @@ unsigned int __stdcall SrvThread(void *p) DWORD bytesRead, bytesWrite; BOOL bRet; std::wstring wspipebuf; + WCHAR command; #ifdef _DEBUG std::wstring dedit, tedit; std::wregex re; @@ -455,14 +475,15 @@ unsigned int __stdcall SrvThread(void *p) continue; } + command = pipebuf[0]; + #ifdef _DEBUG - if(pipebuf[0] == REQ_USER_SAVE) + if(command == REQ_USER_SAVE) { dedit.clear(); } tedit.assign(pipebuf); - tedit.append(L"\n"); re.assign(L"\n"); fmt.assign(L"\r\n"); tedit = std::regex_replace(tedit, re, fmt); @@ -474,12 +495,11 @@ unsigned int __stdcall SrvThread(void *p) SetWindowTextW(hwndEdit, dedit.c_str()); #endif - SrvProc(pipebuf[0], &pipebuf[2], wspipebuf); + SrvProc(command, &pipebuf[2], wspipebuf); wcsncpy_s(pipebuf, wspipebuf.c_str(), _TRUNCATE); #ifdef _DEBUG tedit.assign(pipebuf); - tedit.append(L"\n"); re.assign(L"\n"); fmt.assign(L"\r\n"); tedit = std::regex_replace(tedit, re, fmt); diff --git a/imcrvtip/CandidateList.cpp b/imcrvtip/CandidateList.cpp index aeb2627e..57d23444 100644 --- a/imcrvtip/CandidateList.cpp +++ b/imcrvtip/CandidateList.cpp @@ -2,8 +2,8 @@ #include "imcrvtip.h" #include "TextService.h" #include "EditSession.h" -#include "CandidateWindow.h" #include "CandidateList.h" +#include "CandidateWindow.h" class CGetTextExtEditSession : public CEditSessionBase { @@ -206,7 +206,7 @@ STDAPI CCandidateList::OnLayoutChange(ITfContext *pContext, TfLayoutCode lcode, } HRESULT CCandidateList::_StartCandidateList(TfClientId tfClientId, ITfDocumentMgr *pDocumentMgr, - ITfContext *pContext, TfEditCookie ec, ITfRange *pRange, BOOL reg) + ITfContext *pContext, TfEditCookie ec, ITfRange *pRange, BOOL reg, BOOL comp) { HRESULT hr = E_FAIL; TfEditCookie ecTextStore; @@ -250,7 +250,7 @@ HRESULT CCandidateList::_StartCandidateList(TfClientId tfClientId, ITfDocumentMg try { - _pCandidateWindow = new CCandidateWindow(_pTextService); + _pCandidateWindow = new CCandidateWindow(_pTextService, this); if(pContext->GetActiveView(&pContextView) != S_OK) { @@ -276,7 +276,7 @@ HRESULT CCandidateList::_StartCandidateList(TfClientId tfClientId, ITfDocumentMg SafeRelease(&pContextView); - if(!_pCandidateWindow->_Create(hwnd, NULL, 0, 0, reg)) + if(!_pCandidateWindow->_Create(hwnd, NULL, 0, 0, reg, comp)) { goto exit; } @@ -299,12 +299,19 @@ HRESULT CCandidateList::_StartCandidateList(TfClientId tfClientId, ITfDocumentMg return hr; } +void CCandidateList::_InvokeKeyHandler(WPARAM key) +{ + if(_pTextService != NULL && _pContextDocument != NULL) + { + _pTextService->_InvokeKeyHandler(_pContextDocument, (WPARAM)key, (LPARAM)0, 0); + } +} + void CCandidateList::_InvokeSfHandler(BYTE sf) { - if(_pTextService && _pContextDocument) + if(_pTextService != NULL && _pContextDocument != NULL) { _pTextService->_InvokeKeyHandler(_pContextDocument, (WPARAM)0, (LPARAM)0, sf); - _pTextService->showcandlist = FALSE; } } diff --git a/imcrvtip/CandidateList.h b/imcrvtip/CandidateList.h index 7a110784..d33f45ce 100644 --- a/imcrvtip/CandidateList.h +++ b/imcrvtip/CandidateList.h @@ -27,12 +27,13 @@ class CCandidateList : STDMETHODIMP OnLayoutChange(ITfContext *pContext, TfLayoutCode lcode, ITfContextView *pContextView); HRESULT _StartCandidateList(TfClientId tid, ITfDocumentMgr *pDocumentMgr, - ITfContext *pContext, TfEditCookie ec, ITfRange *pRange, BOOL regdic); + ITfContext *pContext, TfEditCookie ec, ITfRange *pRange, BOOL reg, BOOL comp); void _EndCandidateList(); BOOL _IsShowCandidateWindow(); BOOL _IsContextCandidateWindow(ITfContext *pContext); + void _InvokeKeyHandler(WPARAM key); void _InvokeSfHandler(BYTE sf); void _Show(BOOL bShow); void _SetText(const std::wstring &text, BOOL fixed, BOOL showcandlist, BOOL showreg); diff --git a/imcrvtip/CandidatePaint.cpp b/imcrvtip/CandidatePaint.cpp index 471fa587..ce067764 100644 --- a/imcrvtip/CandidatePaint.cpp +++ b/imcrvtip/CandidatePaint.cpp @@ -3,7 +3,6 @@ #include "TextService.h" #include "CandidateList.h" #include "CandidateWindow.h" -#include "InputModeWindow.h" #define MERGIN_X 2 #define MERGIN_Y 4 @@ -98,7 +97,7 @@ void CCandidateWindow::_WindowProcPaint(HWND hWnd) for(i = 0; i < _CandCount[page]; i++) { s.clear(); - for(cycle = 0; cycle <= 4; cycle++) + for(cycle = CL_COLOR_BG; cycle < DISPLAY_COLOR_NUM; cycle++) { s += _MakeCandidateString(page, count, i, cycle); } @@ -121,7 +120,7 @@ void CCandidateWindow::_WindowProcPaint(HWND hWnd) DT_CALCRECT | DT_NOCLIP | DT_NOPREFIX | DT_SINGLELINE | DT_WORDBREAK | DT_NOFULLWIDTHCHARBREAK); } - if(_pTextService->cx_verticalcand) + if(_pTextService->cx_verticalcand || _comp) { if(i != 0) { @@ -172,7 +171,7 @@ void CCandidateWindow::_WindowProcPaint(HWND hWnd) DT_CALCRECT | DT_NOCLIP | DT_NOPREFIX | DT_SINGLELINE | DT_WORDBREAK | DT_NOFULLWIDTHCHARBREAK); } - if(_pTextService->cx_verticalcand) + if(_pTextService->cx_verticalcand || _comp) { pt.x = MERGIN_X; pt.y += height; @@ -205,6 +204,7 @@ void CCandidateWindow::_WindowProcPaint(HWND hWnd) else { SetTextColor(hmemdc, _pTextService->cx_colors[CL_COLOR_NO]); + SetBkMode(hdc, TRANSPARENT); DrawTextW(hmemdc, strPage, -1, &rc, DT_NOCLIP | DT_NOPREFIX | DT_SINGLELINE | DT_WORDBREAK | DT_NOFULLWIDTHCHARBREAK); @@ -274,6 +274,7 @@ void CCandidateWindow::_PaintRegWord(HDC hdc, LPRECT lpr) else { SetTextColor(hdc, _pTextService->cx_colors[CL_COLOR_CA]); + SetBkMode(hdc, TRANSPARENT); DrawTextW(hdc, s.c_str(), -1, lpr, DT_NOCLIP | DT_NOPREFIX | DT_SINGLELINE | DT_WORDBREAK | DT_NOFULLWIDTHCHARBREAK); @@ -286,35 +287,86 @@ std::wstring CCandidateWindow::_MakeCandidateString(UINT page, UINT count, UINT switch(cycle) { - case 0: + case CL_COLOR_BG: s.append(markNBSP); - s.append(_pTextService->selkey[(idx % MAX_SELKEY_C)][0]); break; - case 1: - s.append(markNo); + + case CL_COLOR_FR: break; - case 2: - s.append( - std::regex_replace(_pTextService->candidates[ count + _uShowedCount + idx ].first.first, - std::wregex(markSP), std::wstring(markNBSP))); + + case CL_COLOR_SE: + if(!_comp) + { + s.append(_pTextService->selkey[(idx % MAX_SELKEY_C)][0]); + } + else + { + s.append(searchkey); + } break; - case 3: - if(_pTextService->cx_annotation && - !_pTextService->candidates[count + _uShowedCount + idx].first.second.empty()) + + case CL_COLOR_CO: + if(!_comp) { - s.append(markAnnotation); + s.append(markNo); } break; - case 4: - if(_pTextService->cx_annotation && - !_pTextService->candidates[count + _uShowedCount + idx].first.second.empty()) + + case CL_COLOR_CA: + if(!_comp) + { + s.append( + std::regex_replace(candidates[ count + _uShowedCount + idx ].first.first, + std::wregex(markSP), std::wstring(markNBSP))); + } + else { s.append( - std::regex_replace(_pTextService->candidates[count + _uShowedCount + idx].first.second, + std::regex_replace(candidates[ count + _uShowedCount + idx ].first.first.substr(searchkey.size()), std::wregex(markSP), std::wstring(markNBSP))); } - s.append(markCandEnd); break; + + case CL_COLOR_SC: + if(_pTextService->cx_annotation && + !candidates[count + _uShowedCount + idx].first.second.empty()) + { + if(!_comp) + { + s.append(markAnnotation); + } + else + { + s.append(markNBSP); + } + } + break; + + case CL_COLOR_AN: + //if(!_comp) + { + if(_pTextService->cx_annotation && + !candidates[count + _uShowedCount + idx].first.second.empty()) + { + s.append( + std::regex_replace(candidates[count + _uShowedCount + idx].first.second, + std::wregex(markSP), std::wstring(markNBSP))); + } + } + + if(_pTextService->cx_verticalcand || _comp) + { + s.append(markNBSP); + } + else + { + s.append(markCandEnd); + } + break; + + case CL_COLOR_NO: + break; + default: break; } @@ -334,7 +386,7 @@ void CCandidateWindow::_PaintCandidate(HDC hdc, LPRECT lpr, UINT page, UINT coun r_ex = *lpr; r_ex.right = r_ex.left; - for(cycle = 0; cycle <= 4; cycle++) + for(cycle = CL_COLOR_BG; cycle < DISPLAY_COLOR_NUM; cycle++) { s = _MakeCandidateString(page, count, idx, cycle); @@ -354,8 +406,17 @@ void CCandidateWindow::_PaintCandidate(HDC hdc, LPRECT lpr, UINT page, UINT coun rd2d = D2D1::RectF((FLOAT)r.left, (FLOAT)r.top, (FLOAT)r.right, (FLOAT)r.bottom); - _pD2DDCRT->DrawText(s.c_str(), (UINT32)s.size(), - _pDWTF, &rd2d, _pD2DBrush[cycle + 2], _drawtext_option); + if(_comp && (count + _uShowedCount + idx == candidx) && (cycle == CL_COLOR_SE || cycle == CL_COLOR_CA)) + { + _pD2DDCRT->FillRectangle(&rd2d, _pD2DBrush[CL_COLOR_SE]); + _pD2DDCRT->DrawText(s.c_str(), (UINT32)s.size(), + _pDWTF, &rd2d, _pD2DBrush[CL_COLOR_BG], _drawtext_option); + } + else + { + _pD2DDCRT->DrawText(s.c_str(), (UINT32)s.size(), + _pDWTF, &rd2d, _pD2DBrush[cycle], _drawtext_option); + } } else { @@ -367,7 +428,17 @@ void CCandidateWindow::_PaintCandidate(HDC hdc, LPRECT lpr, UINT page, UINT coun r_ex.right = r.right; - SetTextColor(hdc, _pTextService->cx_colors[cycle + 2]); + if(_comp && (count + _uShowedCount + idx == candidx) && (cycle == CL_COLOR_SE || cycle == CL_COLOR_CA)) + { + SetTextColor(hdc, _pTextService->cx_colors[CL_COLOR_BG]); + SetBkColor(hdc, _pTextService->cx_colors[CL_COLOR_SE]); + SetBkMode(hdc, OPAQUE); + } + else + { + SetTextColor(hdc, _pTextService->cx_colors[cycle]); + SetBkMode(hdc, TRANSPARENT); + } DrawTextW(hdc, s.c_str(), -1, &r, DT_NOCLIP | DT_NOPREFIX | DT_SINGLELINE | DT_WORDBREAK | DT_NOFULLWIDTHCHARBREAK); @@ -462,7 +533,7 @@ void CCandidateWindow::_CalcWindowRect() for(i = 0; i < _CandCount[page]; i++) { s.clear(); - for(cycle = 0; cycle <= 4; cycle++) + for(cycle = CL_COLOR_BG; cycle < DISPLAY_COLOR_NUM; cycle++) { s += _MakeCandidateString(page, count, i, cycle); } @@ -520,7 +591,7 @@ void CCandidateWindow::_CalcWindowRect() for(i = 0; i < _CandCount[page]; i++) { s.clear(); - for(cycle = 0; cycle <= 4; cycle++) + for(cycle = CL_COLOR_BG; cycle < DISPLAY_COLOR_NUM; cycle++) { s += _MakeCandidateString(page, count, i, cycle); } @@ -543,7 +614,7 @@ void CCandidateWindow::_CalcWindowRect() DT_CALCRECT | DT_NOCLIP | DT_NOPREFIX | DT_SINGLELINE | DT_WORDBREAK | DT_NOFULLWIDTHCHARBREAK); } - if(_pTextService->cx_verticalcand) + if(_pTextService->cx_verticalcand || _comp) { if(i != 0) { @@ -588,7 +659,7 @@ void CCandidateWindow::_CalcWindowRect() DT_CALCRECT | DT_NOCLIP | DT_NOPREFIX | DT_SINGLELINE | DT_WORDBREAK | DT_NOFULLWIDTHCHARBREAK); } - if(_pTextService->cx_verticalcand) + if(_pTextService->cx_verticalcand || _comp) { pt.x = 0; pt.y += height; diff --git a/imcrvtip/CandidateUIElement.cpp b/imcrvtip/CandidateUIElement.cpp index 3699b093..1253775d 100644 --- a/imcrvtip/CandidateUIElement.cpp +++ b/imcrvtip/CandidateUIElement.cpp @@ -1,13 +1,13 @@  #include "imcrvtip.h" #include "TextService.h" -#include "CandidateWindow.h" #include "CandidateList.h" +#include "CandidateWindow.h" static LPCWSTR markNo = L":"; static LPCWSTR markAnnotation = L";"; -CCandidateWindow::CCandidateWindow(CTextService *pTextService) +CCandidateWindow::CCandidateWindow(CTextService *pTextService, CCandidateList *pCandidateList) { DllAddRef(); @@ -16,7 +16,7 @@ CCandidateWindow::CCandidateWindow(CTextService *pTextService) _pTextService = pTextService; _pTextService->AddRef(); - _pCandidateList = _pTextService->_GetCandidateList(); + _pCandidateList = pCandidateList; _pCandidateList->AddRef(); _pCandidateWindow = NULL; @@ -52,6 +52,11 @@ CCandidateWindow::CCandidateWindow(CTextService *pTextService) _pDWTF = NULL; _reg = FALSE; + _comp = FALSE; + + candidates.clear(); + candidx = 0; + searchkey.clear(); regword = FALSE; regwordul = FALSE; @@ -202,7 +207,14 @@ STDAPI CCandidateWindow::Show(BOOL bShow) if(_pInputModeWindow != NULL && regword) { - _pInputModeWindow->_Show(bShow); +#ifndef _DEBUG + if(_pCandidateWindow == NULL) + { +#endif + _pInputModeWindow->_Show(bShow); +#ifndef _DEBUG + } +#endif } return S_OK; @@ -441,14 +453,30 @@ STDAPI CCandidateWindow::SetPageIndex(UINT *pIndex, UINT uPageCnt) break; } - _CandStr.push_back(_pTextService->selkey[(i % MAX_SELKEY_C)][0]); - _CandStr[k].append(markNo + _pTextService->candidates[_uShowedCount + k].first.first); + if(!_comp) + { + _CandStr.push_back(_pTextService->selkey[(i % MAX_SELKEY_C)][0]); + _CandStr[k].append(markNo); + } + else + { + _CandStr.push_back(L""); + } + + _CandStr[k].append(candidates[_uShowedCount + k].first.first); if(_pTextService->cx_annotation && - !_pTextService->candidates[_uShowedCount + k].first.second.empty()) + !candidates[_uShowedCount + k].first.second.empty()) { - _CandStr[k].append(markAnnotation + - _pTextService->candidates[_uShowedCount + k].first.second); + if(!_comp) + { + _CandStr[k].append(markAnnotation); + } + else + { + _CandStr[k].append(markSP); + } + _CandStr[k].append(candidates[_uShowedCount + k].first.second); } ++k; diff --git a/imcrvtip/CandidateWindow.cpp b/imcrvtip/CandidateWindow.cpp index ac32fc1d..90d7eb10 100644 --- a/imcrvtip/CandidateWindow.cpp +++ b/imcrvtip/CandidateWindow.cpp @@ -5,7 +5,7 @@ #include "CandidateWindow.h" #include "InputModeWindow.h" -BOOL CCandidateWindow::_Create(HWND hwndParent, CCandidateWindow *pCandidateWindowParent, DWORD dwUIElementId, UINT depth, BOOL reg) +BOOL CCandidateWindow::_Create(HWND hwndParent, CCandidateWindow *pCandidateWindowParent, DWORD dwUIElementId, UINT depth, BOOL reg, BOOL comp) { _hwndParent = hwndParent; _pCandidateWindowParent = pCandidateWindowParent; @@ -86,6 +86,12 @@ BOOL CCandidateWindow::_Create(HWND hwndParent, CCandidateWindow *pCandidateWind } _reg = reg; + _comp = comp; + + candidates = _pTextService->candidates; + candidx = _pTextService->candidx; + searchkey = _pTextService->searchkey; + if(reg) { //辞書登録開始 @@ -318,6 +324,37 @@ HRESULT CCandidateWindow::_OnKeyDown(UINT uVKey) _GetChSf(uVKey, ch, sf); + //複数動的補完 + if(_comp) + { + switch(sf) + { + case SKK_NEXT_COMP: + if(candidx == (size_t)-1) + { + candidx = 0; + _InvokeSfHandler(SKK_NEXT_COMP); + } + else + { + _NextComp(); + } + break; + case SKK_PREV_COMP: + if(candidx != (size_t)-1) + { + _PrevComp(); + } + break; + default: + _InvokeKeyHandler(uVKey); + break; + } + + return S_OK; + } + + //候補選択 switch(sf) { case SKK_CANCEL: @@ -336,13 +373,13 @@ HRESULT CCandidateWindow::_OnKeyDown(UINT uVKey) _RestoreStatusReg(); } _PreEndReq(); - _HandleKey(0, NULL, 0, SKK_CANCEL); + _HandleKey(0, SKK_CANCEL); _EndReq(); } } else { - _HandleKey(0, NULL, 0, SKK_CANCEL); + _HandleKey(0, SKK_CANCEL); _Update(); } } @@ -387,14 +424,14 @@ HRESULT CCandidateWindow::_OnKeyDown(UINT uVKey) } _PreEndReq(); _pTextService->candidx = index; - _HandleKey(0, NULL, 0, SKK_ENTER); + _HandleKey(0, SKK_ENTER); _EndReq(); } } else { _pTextService->candidx = index; - _HandleKey(0, NULL, 0, SKK_ENTER); + _HandleKey(0, SKK_ENTER); _Update(); } break; @@ -488,20 +525,43 @@ void CCandidateWindow::_InitList() { UINT i; - _uShowedCount = (UINT)_pTextService->cx_untilcandlist - 1; - _uCount = (UINT)_pTextService->candidates.size() - _uShowedCount; + if(!_comp) + { + _uShowedCount = (UINT)_pTextService->cx_untilcandlist - 1; + } + else + { + _uShowedCount = 0; + } + _uCount = (UINT)candidates.size() - _uShowedCount; _CandStr.clear(); for(i = 0; i < _uCount; i++) { - _CandStr.push_back(_pTextService->selkey[(i % MAX_SELKEY)][0]); - _CandStr[i].append(markNo + _pTextService->candidates[_uShowedCount + i].first.first); + if(!_comp) + { + _CandStr.push_back(_pTextService->selkey[(i % MAX_SELKEY)][0]); + _CandStr[i].append(markNo); + } + else + { + _CandStr.push_back(L""); + } + + _CandStr[i].append(candidates[_uShowedCount + i].first.first); if(_pTextService->cx_annotation && - !_pTextService->candidates[_uShowedCount + i].first.second.empty()) + !candidates[_uShowedCount + i].first.second.empty()) { - _CandStr[i].append(markAnnotation + - _pTextService->candidates[_uShowedCount + i].first.second); + if(!_comp) + { + _CandStr[i].append(markAnnotation); + } + else + { + _CandStr[i].append(markSP); + } + _CandStr[i].append(candidates[_uShowedCount + i].first.second); } } @@ -617,7 +677,7 @@ void CCandidateWindow::_PrevPage() _RestoreStatusReg(); } _PreEndReq(); - _HandleKey(0, NULL, 0, SKK_CANCEL); + _HandleKey(0, SKK_CANCEL); _EndReq(); } } @@ -636,7 +696,7 @@ void CCandidateWindow::_PrevPage() } _PreEndReq(); _pTextService->candidx = _pTextService->cx_untilcandlist - 1; - _HandleKey(0, NULL, 0, SKK_PREV_CAND); + _HandleKey(0, SKK_PREV_CAND); _EndReq(); } } @@ -645,12 +705,12 @@ void CCandidateWindow::_PrevPage() { if(_pTextService->cx_untilcandlist == 1) { - _HandleKey(0, NULL, 0, SKK_CANCEL); + _HandleKey(0, SKK_CANCEL); } else { _pTextService->candidx = _pTextService->cx_untilcandlist - 1; - _HandleKey(0, NULL, 0, SKK_PREV_CAND); + _HandleKey(0, SKK_PREV_CAND); } _Update(); @@ -672,6 +732,63 @@ void CCandidateWindow::_PrevPage() _UpdateUIElement(); } +void CCandidateWindow::_NextComp() +{ + UINT uOldPage, uNewPage; + + GetCurrentPage(&uOldPage); + + if(_uIndex + 1 >= _uCount) + { + return; + } + + _InvokeSfHandler(SKK_NEXT_COMP); + + candidx++; + + _uIndex++; + GetCurrentPage(&uNewPage); + + _dwFlags = TF_CLUIE_SELECTION; + if(uNewPage != uOldPage) + { + _dwFlags |= TF_CLUIE_CURRENTPAGE; + } + + _Update(); + _UpdateUIElement(); +} + +void CCandidateWindow::_PrevComp() +{ + UINT uOldPage, uNewPage; + + GetCurrentPage(&uOldPage); + + if(_uIndex == 0) + { + _EndCandidateList(SKK_CANCEL); + return; + } + + _InvokeSfHandler(SKK_PREV_COMP); + + candidx--; + + _uIndex--; + GetCurrentPage(&uNewPage); + + _dwFlags = TF_CLUIE_SELECTION; + if(uNewPage != uOldPage) + { + _dwFlags |= TF_CLUIE_CURRENTPAGE; + } + + _Update(); + _UpdateUIElement(); +} + void CCandidateWindow::_OnKeyDownRegword(UINT uVKey) { std::wstring s; @@ -688,7 +805,7 @@ void CCandidateWindow::_OnKeyDownRegword(UINT uVKey) if(!regwordfixed) { _pTextService->showcandlist = FALSE; //候補一覧表示をループさせる - _HandleKey(0, NULL, (WPARAM)uVKey, SKK_NULL); + _HandleKey((WPARAM)uVKey, SKK_NULL); _Update(); if(_pInputModeWindow != NULL) @@ -764,11 +881,11 @@ void CCandidateWindow::_OnKeyDownRegword(UINT uVKey) _PreEndReq(); if(_pTextService->candidates.empty()) { - _HandleKey(0, NULL, 0, SKK_CANCEL); + _HandleKey(0, SKK_CANCEL); } else { - _HandleKey(0, NULL, 0, SKK_PREV_CAND); + _HandleKey(0, SKK_PREV_CAND); } _EndReq(); } @@ -814,7 +931,7 @@ void CCandidateWindow::_OnKeyDownRegword(UINT uVKey) else { _PreEndReq(); - _HandleKey(0, NULL, 0, SKK_ENTER); + _HandleKey(0, SKK_ENTER); _EndReq(); } } @@ -861,11 +978,11 @@ void CCandidateWindow::_OnKeyDownRegword(UINT uVKey) _PreEndReq(); if(_pTextService->candidates.empty()) { - _HandleKey(0, NULL, 0, SKK_CANCEL); + _HandleKey(0, SKK_CANCEL); } else { - _HandleKey(0, NULL, 0, SKK_PREV_CAND); + _HandleKey(0, SKK_PREV_CAND); } _EndReq(); } @@ -988,7 +1105,7 @@ void CCandidateWindow::_OnKeyDownRegword(UINT uVKey) break; default: - _HandleKey(0, NULL, (WPARAM)uVKey, SKK_NULL); + _HandleKey((WPARAM)uVKey, SKK_NULL); if(_pInputModeWindow != NULL) { @@ -1030,19 +1147,52 @@ void CCandidateWindow::_Update() void CCandidateWindow::_EndCandidateList(BYTE sf) { - _pCandidateList->_InvokeSfHandler(sf); - _pCandidateList->_EndCandidateList(); + _InvokeSfHandler(sf); + //複数動的補完は自身で終了しない + if(!_comp) + { + if(_pTextService != NULL) + { + _pTextService->showcandlist = FALSE; + } + if(_pCandidateList != NULL) + { + _pCandidateList->_EndCandidateList(); + } + } +} + +void CCandidateWindow::_InvokeSfHandler(BYTE sf) +{ + if(_pCandidateList != NULL) + { + _pCandidateList->_InvokeSfHandler(sf); + } +} + +void CCandidateWindow::_InvokeKeyHandler(UINT uVKey) +{ + if(_pCandidateList != NULL) + { + _pCandidateList->_InvokeKeyHandler(uVKey); + } } -HRESULT CCandidateWindow::_HandleKey(TfEditCookie ec, ITfContext *pContext, WPARAM wParam, BYTE bSf) +void CCandidateWindow::_HandleKey(WPARAM wParam, BYTE bSf) { - return _pTextService->_HandleKey(ec, pContext, wParam, bSf); + if(_pTextService != NULL) + { + _pTextService->_HandleKey(0, NULL, wParam, bSf); + } } void CCandidateWindow::_GetChSf(UINT uVKey, WCHAR &ch, BYTE &sf, BYTE vkoff) { - ch = _pTextService->_GetCh(uVKey, vkoff); - sf = _pTextService->_GetSf(uVKey, ch); + if(_pTextService != NULL) + { + ch = _pTextService->_GetCh(uVKey, vkoff); + sf = _pTextService->_GetSf(uVKey, ch); + } } void CCandidateWindow::_BackUpStatus() @@ -1128,8 +1278,8 @@ void CCandidateWindow::_CreateNext(BOOL reg) { try { - _pCandidateWindow = new CCandidateWindow(_pTextService); - _pCandidateWindow->_Create(_hwndParent, this, _dwUIElementId, _depth + 1, reg); + _pCandidateWindow = new CCandidateWindow(_pTextService, _pCandidateList); + _pCandidateWindow->_Create(_hwndParent, this, _dwUIElementId, _depth + 1, reg, FALSE); #ifdef _DEBUG RECT rc; diff --git a/imcrvtip/CandidateWindow.h b/imcrvtip/CandidateWindow.h index dd74b22a..83ad8221 100644 --- a/imcrvtip/CandidateWindow.h +++ b/imcrvtip/CandidateWindow.h @@ -9,7 +9,7 @@ class CCandidateWindow : public ITfCandidateListUIElementBehavior { public: - CCandidateWindow(CTextService *pTextService); + CCandidateWindow(CTextService *pTextService, CCandidateList *pCandidateList); ~CCandidateWindow(); // IUnknown @@ -38,7 +38,7 @@ class CCandidateWindow : public ITfCandidateListUIElementBehavior STDMETHODIMP Finalize(); STDMETHODIMP Abort(); - BOOL _Create(HWND hwndParent, CCandidateWindow *pCandidateWindowParent, DWORD dwUIElementId, UINT depth, BOOL reg); + BOOL _Create(HWND hwndParent, CCandidateWindow *pCandidateWindowParent, DWORD dwUIElementId, UINT depth, BOOL reg, BOOL comp); static LRESULT CALLBACK _WindowPreProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); LRESULT CALLBACK _WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); void _Destroy(); @@ -57,10 +57,14 @@ class CCandidateWindow : public ITfCandidateListUIElementBehavior void _UpdateUIElement(); void _NextPage(); void _PrevPage(); + void _NextComp(); + void _PrevComp(); void _OnKeyDownRegword(UINT uVKey); void _Update(); void _EndCandidateList(BYTE sf); - HRESULT _HandleKey(TfEditCookie ec, ITfContext *pContext, WPARAM wParam, BYTE bSf); + void _InvokeSfHandler(BYTE sf); + void _InvokeKeyHandler(UINT uVKey); + void _HandleKey(WPARAM wParam, BYTE bSf); void _GetChSf(UINT uVKey, WCHAR &ch, BYTE &sf, BYTE vkoff = 0); void _BackUpStatus(); void _ClearStatus(); @@ -91,6 +95,7 @@ class CCandidateWindow : public ITfCandidateListUIElementBehavior std::vector< std::wstring > _CandStr; LONG _cRef; + CTextService *_pTextService; CCandidateList *_pCandidateList; CCandidateWindow *_pCandidateWindow; //子 @@ -107,6 +112,7 @@ class CCandidateWindow : public ITfCandidateListUIElementBehavior std::wstring disptext; //表示文字列 HFONT hFont; //フォント + //Direct2D/DirectWrite ID2D1Factory *_pD2DFactory; ID2D1DCRenderTarget *_pD2DDCRT; ID2D1SolidColorBrush *_pD2DBrush[DISPLAY_COLOR_NUM]; @@ -115,6 +121,11 @@ class CCandidateWindow : public ITfCandidateListUIElementBehavior IDWriteTextFormat *_pDWTF; BOOL _reg; //初期表示から辞書登録 + BOOL _comp; //複数動的補完 + + CANDIDATES candidates; //描画用候補 + size_t candidx; //描画用候補インデックス + std::wstring searchkey; //描画用見出し語 //辞書登録 BOOL regword; //モード diff --git a/imcrvtip/CompartmentEventSink.cpp b/imcrvtip/CompartmentEventSink.cpp index 52323630..5b267267 100644 --- a/imcrvtip/CompartmentEventSink.cpp +++ b/imcrvtip/CompartmentEventSink.cpp @@ -1,8 +1,6 @@  #include "imcrvtip.h" #include "TextService.h" -#include "CandidateList.h" -#include "LanguageBar.h" STDAPI CTextService::OnChange(REFGUID rguid) { diff --git a/imcrvtip/Composition.cpp b/imcrvtip/Composition.cpp index d49ee95a..37496de0 100644 --- a/imcrvtip/Composition.cpp +++ b/imcrvtip/Composition.cpp @@ -2,16 +2,12 @@ #include "imcrvtip.h" #include "TextService.h" #include "EditSession.h" -#include "CandidateList.h" #include "InputModeWindow.h" STDAPI CTextService::OnCompositionTerminated(TfEditCookie ecWrite, ITfComposition *pComposition) { - if(_pCandidateList != NULL) - { - _pCandidateList->_EndCandidateList(); - } - SafeRelease(&_pCandidateList); + _EndCandidateList(); + showcandlist = FALSE; if(pComposition != NULL) { @@ -230,11 +226,8 @@ void CTextService::_ClearComposition() { HRESULT hr; - if(_pCandidateList != NULL) - { - _pCandidateList->_EndCandidateList(); - } - SafeRelease(&_pCandidateList); + _EndCandidateList(); + showcandlist = FALSE; _EndInputModeWindow(); diff --git a/imcrvtip/FnConfigure.cpp b/imcrvtip/FnConfigure.cpp index fbc13669..ebda70b3 100644 --- a/imcrvtip/FnConfigure.cpp +++ b/imcrvtip/FnConfigure.cpp @@ -1,8 +1,8 @@  #include "configxml.h" +#include "convtype.h" #include "imcrvtip.h" #include "TextService.h" -#include "convtype.h" static const struct { BYTE skkfunc; @@ -118,6 +118,9 @@ void CTextService::_LoadBehavior() _ReadBoolValue(SectionBehavior, ValueBackIncEnter, cx_backincenter, TRUE); _ReadBoolValue(SectionBehavior, ValueAddCandKtkn, cx_addcandktkn, FALSE); _ReadBoolValue(SectionBehavior, ValueShiftNNOkuri, cx_shiftnnokuri, TRUE); + _ReadBoolValue(SectionBehavior, ValueDynamicComp, cx_dynamiccomp, FALSE); + _ReadBoolValue(SectionBehavior, ValueDynCompMulti, cx_dyncompmulti, FALSE); + _ReadBoolValue(SectionBehavior, ValueCompUserDic, cx_compuserdic, FALSE); //Font diff --git a/imcrvtip/InputModeWindow.h b/imcrvtip/InputModeWindow.h index e017e66f..05feb51c 100644 --- a/imcrvtip/InputModeWindow.h +++ b/imcrvtip/InputModeWindow.h @@ -31,7 +31,7 @@ class CInputModeWindow : public ITfTextLayoutSink void _Show(BOOL bShow); void _Redraw(); void _GetRect(LPRECT lpRect); - + BOOL _term; private: diff --git a/imcrvtip/KeyEventSink.cpp b/imcrvtip/KeyEventSink.cpp index 116176d3..8da9e9fa 100644 --- a/imcrvtip/KeyEventSink.cpp +++ b/imcrvtip/KeyEventSink.cpp @@ -2,7 +2,6 @@ #include "imcrvtip.h" #include "TextService.h" #include "CandidateList.h" -#include "LanguageBar.h" static LPCWSTR c_PreservedKeyDesc = L"OnOff"; diff --git a/imcrvtip/KeyHandler.cpp b/imcrvtip/KeyHandler.cpp index 0878a7ec..3249fa20 100644 --- a/imcrvtip/KeyHandler.cpp +++ b/imcrvtip/KeyHandler.cpp @@ -3,8 +3,6 @@ #include "imcrvtip.h" #include "EditSession.h" #include "TextService.h" -#include "LanguageBar.h" -#include "CandidateList.h" class CKeyHandlerEditSession : public CEditSessionBase { @@ -97,7 +95,15 @@ HRESULT CTextService::_HandleKey(TfEditCookie ec, ITfContext *pContext, WPARAM w { complement = FALSE; //補完終了 kana = kana.erase(cursoridx); - _Update(ec, pContext); + + if(cx_dynamiccomp || cx_dyncompmulti) + { + _DynamicComp(ec, pContext); + } + else + { + _Update(ec, pContext); + } return S_OK; } break; @@ -105,6 +111,7 @@ HRESULT CTextService::_HandleKey(TfEditCookie ec, ITfContext *pContext, WPARAM w if(complement) { complement = FALSE; //補完終了 + _EndCompletionList(ec, pContext); } break; } diff --git a/imcrvtip/KeyHandlerChar.cpp b/imcrvtip/KeyHandlerChar.cpp index 267dc26b..4005b003 100644 --- a/imcrvtip/KeyHandlerChar.cpp +++ b/imcrvtip/KeyHandlerChar.cpp @@ -1,7 +1,6 @@  #include "imcrvtip.h" #include "TextService.h" -#include "CandidateList.h" HRESULT CTextService::_HandleChar(TfEditCookie ec, ITfContext *pContext, WPARAM wParam, WCHAR ch, WCHAR chO) { @@ -31,7 +30,15 @@ HRESULT CTextService::_HandleChar(TfEditCookie ec, ITfContext *pContext, WPARAM { kana.insert(cursoridx, 1, ch); cursoridx++; - _Update(ec, pContext); + + if(cx_dynamiccomp || cx_dyncompmulti) + { + _DynamicComp(ec, pContext); + } + else + { + _Update(ec, pContext); + } } else { @@ -146,13 +153,24 @@ HRESULT CTextService::_HandleChar(TfEditCookie ec, ITfContext *pContext, WPARAM { cursoridx = kana.size(); showentry = TRUE; - _StartConv(); + _StartConv(ec, pContext); + _Update(ec, pContext); + break; } - else if(rkc.soku) + + if(rkc.soku) { roman.push_back(ch); } - _Update(ec, pContext); + + if(cx_dynamiccomp || cx_dyncompmulti) + { + _DynamicComp(ec, pContext); + } + else + { + _Update(ec, pContext); + } } else { @@ -264,6 +282,8 @@ HRESULT CTextService::_HandleChar(TfEditCookie ec, ITfContext *pContext, WPARAM HRESULT CTextService::_HandleCharReturn(TfEditCookie ec, ITfContext *pContext, BOOL back) { + _EndCompletionList(ec, pContext); + //terminate composition cursoridx = kana.size(); _Update(ec, pContext, TRUE, back); @@ -277,6 +297,8 @@ HRESULT CTextService::_HandleCharShift(TfEditCookie ec, ITfContext *pContext) { if(showentry || (!inputkey && !kana.empty() && roman.empty())) { + _EndCompletionList(ec, pContext); + //leave composition cursoridx = kana.size(); _Update(ec, pContext, TRUE); diff --git a/imcrvtip/KeyHandlerComposition.cpp b/imcrvtip/KeyHandlerComposition.cpp index 7bc9a3f5..4d08c1ce 100644 --- a/imcrvtip/KeyHandlerComposition.cpp +++ b/imcrvtip/KeyHandlerComposition.cpp @@ -2,7 +2,6 @@ #include "imcrvtip.h" #include "TextService.h" #include "CandidateList.h" -#include "InputModeWindow.h" HRESULT CTextService::_Update(TfEditCookie ec, ITfContext *pContext, BOOL fixed, BOOL back) { @@ -124,7 +123,7 @@ HRESULT CTextService::_Update(TfEditCookie ec, ITfContext *pContext, BOOL fixed, { _SetText(ec, pContext, comptext, cchCursor, cchOkuri, FALSE); //辞書登録表示開始 - return _ShowCandidateList(ec, pContext, TRUE); + return _ShowCandidateList(ec, pContext, TRUE, FALSE); } } } @@ -168,7 +167,7 @@ HRESULT CTextService::_Update(TfEditCookie ec, ITfContext *pContext, BOOL fixed, { comptext.append(kana.substr(0, okuriidx)); cchOkuri = (LONG)comptext.size(); - if(!fixed && showmodemark) + if(!fixed && showmodemark && !complement) { comptext.append(markOkuri); } @@ -191,6 +190,11 @@ HRESULT CTextService::_Update(TfEditCookie ec, ITfContext *pContext, BOOL fixed, } else { + if(complement && okuriidx != 0) + { + comptext.insert(okuriidx + 1, L"["); + comptext.append(L"]"); + } comptext.insert(cursoridx + 1, markCursor); } } @@ -309,7 +313,7 @@ HRESULT CTextService::_Update(TfEditCookie ec, ITfContext *pContext, BOOL fixed, //候補一覧表示開始 showcandlist = TRUE; candidx = 0; - return _ShowCandidateList(ec, pContext, FALSE); + return _ShowCandidateList(ec, pContext, FALSE, FALSE); } } @@ -367,7 +371,8 @@ HRESULT CTextService::_SetText(TfEditCookie ec, ITfContext *pContext, const std: if(cchCursor == 0) { cchRes = (LONG)cursoridx - (LONG)kana.size(); - if(!cx_showmodemark && okuriidx != 0 && cursoridx <= okuriidx && cursoridx < kana.size()) + if((complement && okuriidx != 0) || + (!cx_showmodemark && okuriidx != 0 && cursoridx <= okuriidx && cursoridx < kana.size())) { cchRes += 1; } @@ -535,7 +540,7 @@ HRESULT CTextService::_SetText(TfEditCookie ec, ITfContext *pContext, const std: return S_OK; } -HRESULT CTextService::_ShowCandidateList(TfEditCookie ec, ITfContext *pContext, BOOL reg) +HRESULT CTextService::_ShowCandidateList(TfEditCookie ec, ITfContext *pContext, BOOL reg, BOOL comp) { HRESULT hr = E_FAIL; @@ -552,7 +557,7 @@ HRESULT CTextService::_ShowCandidateList(TfEditCookie ec, ITfContext *pContext, ITfRange *pRange; if(_pComposition->GetRange(&pRange) == S_OK) { - hr = _pCandidateList->_StartCandidateList(_ClientId, pDocumentMgr, pContext, ec, pRange, reg); + hr = _pCandidateList->_StartCandidateList(_ClientId, pDocumentMgr, pContext, ec, pRange, reg, comp); SafeRelease(&pRange); } SafeRelease(&pDocumentMgr); @@ -564,3 +569,20 @@ HRESULT CTextService::_ShowCandidateList(TfEditCookie ec, ITfContext *pContext, return hr; } + +void CTextService::_EndCandidateList() +{ + if(_pCandidateList != NULL) + { + _pCandidateList->_EndCandidateList(); + } + SafeRelease(&_pCandidateList); +} + +void CTextService::_EndCompletionList(TfEditCookie ec, ITfContext *pContext) +{ + if(pContext != NULL && !showcandlist) + { + _EndCandidateList(); + } +} diff --git a/imcrvtip/KeyHandlerControl.cpp b/imcrvtip/KeyHandlerControl.cpp index 1074e840..68673f8c 100644 --- a/imcrvtip/KeyHandlerControl.cpp +++ b/imcrvtip/KeyHandlerControl.cpp @@ -1,8 +1,6 @@  #include "imcrvtip.h" #include "TextService.h" -#include "LanguageBar.h" -#include "convtype.h" HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE sf, WCHAR ch) { @@ -15,6 +13,7 @@ HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE { break; } + switch(inputmode) { case im_hiragana: @@ -28,8 +27,7 @@ HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE okuriidx = 0; } //ひらがな/カタカナに変換 - _ConvKanaToKana(kana, (inputmode == im_hiragana ? im_katakana : im_hiragana), - kana, inputmode); + _ConvKanaToKana(kana, inputmode, kana, (inputmode == im_hiragana ? im_katakana : im_hiragana)); _HandleCharReturn(ec, pContext); } else @@ -89,6 +87,7 @@ HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE return S_OK; break; } + switch(inputmode) { case im_hiragana: @@ -102,7 +101,7 @@ HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE okuriidx = 0; } //半角カタカナに変換 - _ConvKanaToKana(kana, im_katakana_ank, kana, inputmode); + _ConvKanaToKana(kana, inputmode, kana, im_katakana_ank); _HandleCharReturn(ec, pContext); } else @@ -147,6 +146,7 @@ HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE { break; } + switch(inputmode) { case im_hiragana: @@ -200,6 +200,7 @@ HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE { break; } + switch(inputmode) { case im_hiragana: @@ -225,6 +226,7 @@ HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE { break; } + if(showentry || (inputkey && kana.empty() && roman.empty())) { if(showentry) @@ -239,6 +241,7 @@ HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE _Update(ec, pContext); return S_OK; } + switch(inputmode) { case im_hiragana: @@ -254,7 +257,7 @@ HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE { //辞書検索開始(接頭辞) showentry = TRUE; - _StartConv(); + _StartConv(ec, pContext); } } _Update(ec, pContext); @@ -287,12 +290,13 @@ HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE okuriidx = 0; } } + if(!kana.empty()) { //候補表示開始 cursoridx = kana.size(); showentry = TRUE; - _StartConv(); + _StartConv(ec, pContext); } _Update(ec, pContext); return S_OK; @@ -303,7 +307,15 @@ HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE if(showentry) { _PrevConv(); - _Update(ec, pContext); + + if(!showentry && (cx_dynamiccomp || cx_dyncompmulti)) + { + _DynamicComp(ec, pContext); + } + else + { + _Update(ec, pContext); + } return S_OK; } break; @@ -338,7 +350,36 @@ HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE { _ConvRoman(); _NextComp(); - _Update(ec, pContext); + + if(complement && cx_compuserdic) + { + if(candidx == 0) + { + _UserDicComp(); + } + + okuriidx = kana.size(); + if(candidx < candidates.size() && !candidates[candidx].first.second.empty()) + { + kana += markSP + candidates[candidx].first.second; + } + kana.insert(okuriidx, 1, CHAR_SKK_OKURI); + + _Update(ec, pContext); + + kana.erase(okuriidx); + okuriidx = 0; + } + else + { + _Update(ec, pContext); + } + + if(cx_dyncompmulti && complement && candidx == 0 && pContext != NULL) + { + showcandlist = FALSE; + _ShowCandidateList(ec, pContext, FALSE, TRUE); + } return S_OK; } break; @@ -347,7 +388,29 @@ HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE if(inputkey && !showentry) { _PrevComp(); - _Update(ec, pContext); + + if(complement && cx_compuserdic) + { + okuriidx = kana.size(); + if(candidx < candidates.size() && !candidates[candidx].first.second.empty()) + { + kana += markSP + candidates[candidx].first.second; + } + kana.insert(okuriidx, 1, CHAR_SKK_OKURI); + + _Update(ec, pContext); + + kana.erase(okuriidx); + okuriidx = 0; + } + else if(!complement && (cx_dynamiccomp || cx_dyncompmulti)) + { + _DynamicComp(ec, pContext, TRUE); + } + else + { + _Update(ec, pContext); + } return S_OK; } break; @@ -357,11 +420,13 @@ HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE { break; } + if(showentry) { candidx = 0; showentry = FALSE; } + _ConvRoman(); if(!kana.empty() && kana.find_first_of(CHAR_SKK_HINT) == std::wstring::npos) @@ -380,6 +445,7 @@ HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE { break; } + switch(inputmode) { case im_hiragana: @@ -388,6 +454,7 @@ HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE { _HandleCharShift(ec, pContext); } + if(!inputkey) { if(_ConvShift(ch)) @@ -412,6 +479,7 @@ HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE _Update(ec, pContext); } } + if(ch == L'\0') { return S_OK; @@ -452,13 +520,22 @@ HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE okuriidx = 0; cursoridx = kana.size(); } + if(cx_delcvposcncl && okuriidx != 0) { kana.erase(okuriidx, 1); okuriidx = 0; cursoridx--; } - _Update(ec, pContext); + + if(cx_dynamiccomp || cx_dyncompmulti) + { + _DynamicComp(ec, pContext); + } + else + { + _Update(ec, pContext); + } } else { @@ -532,6 +609,7 @@ HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE } } } + if(okuriidx != 0 && okuriidx + 1 == cursoridx) { kana.erase(cursoridx - 1, 1); @@ -539,13 +617,21 @@ HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE okuriidx = 0; } } + if(!inputkey && roman.empty() && kana.empty()) { _HandleCharReturn(ec, pContext); } else { - _Update(ec, pContext); + if(cx_dynamiccomp || cx_dyncompmulti) + { + _DynamicComp(ec, pContext); + } + else + { + _Update(ec, pContext); + } } return S_OK; break; @@ -555,11 +641,13 @@ HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE { break; } + if(okuriidx != 0 && okuriidx == cursoridx) { kana.erase(cursoridx, 1); okuriidx = 0; } + // surrogate pair if(kana.size() - cursoridx >= 2 && IS_SURROGATE_PAIR(kana[cursoridx], kana[cursoridx + 1])) @@ -586,7 +674,15 @@ HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE } } } - _Update(ec, pContext); + + if(cx_dynamiccomp || cx_dyncompmulti) + { + _DynamicComp(ec, pContext); + } + else + { + _Update(ec, pContext); + } return S_OK; break; @@ -599,6 +695,7 @@ HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE { break; } + if(!roman.empty()) { _ConvRoman(); @@ -621,7 +718,15 @@ HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE cursoridx--; } } - _Update(ec, pContext); + + if(cx_dynamiccomp || cx_dyncompmulti) + { + _DynamicComp(ec, pContext); + } + else + { + _Update(ec, pContext); + } return S_OK; break; @@ -630,6 +735,7 @@ HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE { break; } + if(!roman.empty()) { _ConvRoman(); @@ -639,7 +745,15 @@ HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE { cursoridx = 0; } - _Update(ec, pContext); + + if(cx_dynamiccomp || cx_dyncompmulti) + { + _DynamicComp(ec, pContext); + } + else + { + _Update(ec, pContext); + } return S_OK; break; @@ -648,6 +762,7 @@ HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE { break; } + if(!roman.empty()) { _ConvRoman(); @@ -665,12 +780,21 @@ HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE { cursoridx++; } + if(okuriidx != 0 && okuriidx + 1 == cursoridx) { cursoridx++; } } - _Update(ec, pContext); + + if(cx_dynamiccomp || cx_dyncompmulti) + { + _DynamicComp(ec, pContext); + } + else + { + _Update(ec, pContext); + } return S_OK; break; @@ -679,6 +803,7 @@ HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE { break; } + if(!roman.empty()) { _ConvRoman(); @@ -688,7 +813,15 @@ HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE { cursoridx = kana.size(); } - _Update(ec, pContext); + + if(cx_dynamiccomp || cx_dyncompmulti) + { + _DynamicComp(ec, pContext); + } + else + { + _Update(ec, pContext); + } return S_OK; break; @@ -716,7 +849,14 @@ HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE okuriidx += s.size(); } cursoridx += s.size(); - _Update(ec, pContext); + if(cx_dynamiccomp || cx_dyncompmulti) + { + _DynamicComp(ec, pContext); + } + else + { + _Update(ec, pContext); + } GlobalUnlock(hCB); } } diff --git a/imcrvtip/KeyHandlerConv.cpp b/imcrvtip/KeyHandlerConv.cpp index 7b5d6168..4d7af9ef 100644 --- a/imcrvtip/KeyHandlerConv.cpp +++ b/imcrvtip/KeyHandlerConv.cpp @@ -1,8 +1,6 @@  #include "imcrvtip.h" #include "TextService.h" -#include "CandidateList.h" -#include "convtype.h" WCHAR CTextService::_GetCh(BYTE vk, BYTE vkoff) { @@ -225,7 +223,7 @@ HRESULT CTextService::_ConvAsciiJLatin(ASCII_JLATIN_CONV *pconv) return ret; } -void CTextService::_StartConv() +void CTextService::_StartConv(TfEditCookie ec, ITfContext *pContext) { CANDIDATES candidates_sel; CANDIDATES candidates_hint; @@ -234,11 +232,13 @@ void CTextService::_StartConv() size_t okuriidx_bak; size_t i; + _EndCompletionList(ec, pContext); + size_t hintchidx = kana.find_first_of(CHAR_SKK_HINT); if(!hintmode || hintchidx == std::wstring::npos) { - _StartSubConv(); + _StartSubConv(REQ_SEARCH); } else { @@ -256,14 +256,14 @@ void CTextService::_StartConv() //ヒント検索 kana = hint; - _StartSubConv(); + _StartSubConv(REQ_SEARCH); candidates_hint = candidates; //通常検索 okuriidx = okuriidx_bak; kana = key; cursoridx = kana.size(); - _StartSubConv(); + _StartSubConv(REQ_SEARCH); //ヒント候補の文字を含む通常候補をヒント候補順で抽出 FORWARD_ITERATION_I(candidates_hint_itr, candidates_hint) @@ -303,7 +303,7 @@ void CTextService::_StartConv() hintmode = FALSE; } -void CTextService::_StartSubConv() +void CTextService::_StartSubConv(WCHAR command) { CANDIDATES candidates_bak; CANDIDATES candidates_num; @@ -315,12 +315,12 @@ void CTextService::_StartSubConv() //仮名を平仮名にして検索 if(okuriidx != 0) { - _ConvKanaToKana(searchkey, im_hiragana, kana.substr(0, okuriidx), inputmode); + _ConvKanaToKana(kana.substr(0, okuriidx), inputmode, searchkey, im_hiragana); searchkey += kana.substr(okuriidx, 1); } else { - _ConvKanaToKana(searchkey, im_hiragana, kana, inputmode); + _ConvKanaToKana(kana, inputmode, searchkey, im_hiragana); } candidates.clear(); @@ -330,7 +330,7 @@ void CTextService::_StartSubConv() searchkeyorg = searchkey; //通常検索 - _SearchDic(REQ_SEARCH); + _SearchDic(command); //片仮名変換 if(cx_addcandktkn && !abbrevmode) @@ -341,11 +341,11 @@ void CTextService::_StartSubConv() case im_katakana: if(okuriidx != 0) { - _ConvKanaToKana(kanaconv, im_katakana, kana.substr(0, okuriidx), inputmode); + _ConvKanaToKana(kana.substr(0, okuriidx), inputmode, kanaconv, im_katakana); } else { - _ConvKanaToKana(kanaconv, im_katakana, kana, inputmode); + _ConvKanaToKana(kana, inputmode, kanaconv, im_katakana); } break; default: @@ -366,7 +366,7 @@ void CTextService::_StartSubConv() if(!searchkey.empty() && searchkey != searchkeyorg) { //変換済み見出し語検索 - _SearchDic(REQ_SEARCH); + _SearchDic(command); } candidates_num = candidates; @@ -458,7 +458,7 @@ void CTextService::_NextComp() } else { - _ConvKanaToKana(searchkey, im_hiragana, kana, inputmode); + _ConvKanaToKana(kana, inputmode, searchkey, im_hiragana); } candidates.clear(); @@ -514,7 +514,7 @@ void CTextService::_SetComp(const std::wstring &candidate) } else { - _ConvKanaToKana(kana, inputmode, candidate, im_hiragana); + _ConvKanaToKana(candidate, im_hiragana, kana, inputmode); } if(cursoridx > kana.size()) @@ -523,6 +523,116 @@ void CTextService::_SetComp(const std::wstring &candidate) } } +void CTextService::_DynamicComp(TfEditCookie ec, ITfContext *pContext, BOOL sel) +{ + if(kana.empty() || !roman.empty()) + { + _EndCompletionList(ec, pContext); + _Update(ec, pContext); + return; + } + + std::wstring kana_bak = kana; + size_t cursoridx_bak = cursoridx; + + //補完 + complement = FALSE; + _NextComp(); + + cursoridx = cursoridx_bak; + + if(complement) + { + if(cx_compuserdic) + { + //ユーザー辞書検索 + _UserDicComp(); + if(!candidates.empty()) + { + kana += markSP + candidates[0].first.second; + } + } + + okuriidx = kana_bak.size(); + + if(cx_dynamiccomp || (cx_compuserdic && !cx_dyncompmulti)) + { + kana.insert(okuriidx, 1, CHAR_SKK_OKURI); + + _Update(ec, pContext); + + kana.erase(okuriidx); + okuriidx = 0; + } + else + { + kana.erase(okuriidx); + okuriidx = 0; + + _Update(ec, pContext); + } + + if(cx_dyncompmulti && pContext != NULL) + { + if(!sel) + { + candidx = (size_t)-1; + } + + showcandlist = FALSE; + _ShowCandidateList(ec, pContext, FALSE, TRUE); + } + + complement = FALSE; + } + else + { + _EndCompletionList(ec, pContext); + _Update(ec, pContext); + } +} + +void CTextService::_UserDicComp() +{ + std::wstring kana_bak = kana; + std::wstring searchkey_bak = searchkey; + CANDIDATES candidates_bak = candidates; + size_t candidx_bak = candidx; + size_t i; + + FORWARD_ITERATION_I(candidates_bak_itr, candidates_bak) + { + //ユーザー辞書検索 + kana = candidates_bak_itr->first.first; + _StartSubConv(REQ_SEARCHUSER); + + if(!candidates.empty() && cx_untilcandlist > 1) + { + candidates_bak_itr->first.second = L"/"; + i = 2; + FORWARD_ITERATION_I(candidates_itr, candidates) + { + //「候補一覧表示に要する変換回数」-1 個まで + if(cx_untilcandlist < i++) + { + break; + } + candidates_bak_itr->first.second += candidates_itr->first.first + L"/"; + } + + if(cx_untilcandlist - 1 < candidates.size()) + { + candidates_bak_itr->first.second += L"…"; + } + } + } + + kana = kana_bak; + searchkey = searchkey_bak; + candidates = candidates_bak; + candidx = candidx_bak; +} + void CTextService::_ConvRoman() { if(!_ConvShift(WCHAR_MAX)) @@ -740,7 +850,7 @@ BOOL CTextService::_ConvN() return FALSE; } -void CTextService::_ConvKanaToKana(std::wstring &dst, int dstmode, const std::wstring &src, int srcmode) +void CTextService::_ConvKanaToKana(const std::wstring &src, int srcmode, std::wstring &dst, int dstmode) { size_t i; BOOL exist; @@ -785,7 +895,7 @@ void CTextService::_ConvKanaToKana(std::wstring &dst, int dstmode, const std::ws srckana[1] = L'\0'; } - exist = _SearchKanaByKana(roman_kana_tree, srcmode, srckana, dstmode, dsttmp); + exist = _SearchKanaByKana(roman_kana_tree, srckana, srcmode, dsttmp, dstmode); if(!exist) //ローマ字仮名変換表に無ければそのまま { @@ -796,7 +906,7 @@ void CTextService::_ConvKanaToKana(std::wstring &dst, int dstmode, const std::ws dst.assign(dsttmp); } -BOOL CTextService::_SearchKanaByKana(const ROMAN_KANA_NODE &tree, int srcmode, const WCHAR *src, int dstmode, std::wstring &dst) +BOOL CTextService::_SearchKanaByKana(const ROMAN_KANA_NODE &tree, const WCHAR *src, int srcmode, std::wstring &dst, int dstmode) { ROMAN_KANA_CONV rkc; BOOL exist = FALSE; @@ -843,7 +953,7 @@ BOOL CTextService::_SearchKanaByKana(const ROMAN_KANA_NODE &tree, int srcmode, c } else if(!v_itr->nodes.empty()) { - exist = _SearchKanaByKana(*v_itr, srcmode, src, dstmode, dst); + exist = _SearchKanaByKana(*v_itr, src, srcmode, dst, dstmode); if(exist) { diff --git a/imcrvtip/KeyHandlerDictionary.cpp b/imcrvtip/KeyHandlerDictionary.cpp index e36ba7ee..af5a440b 100644 --- a/imcrvtip/KeyHandlerDictionary.cpp +++ b/imcrvtip/KeyHandlerDictionary.cpp @@ -248,23 +248,22 @@ void CTextService::_DelUserDic(WCHAR command, const std::wstring &key, const std void CTextService::_SaveUserDic() { - WCHAR buf[3]; DWORD bytesWrite, bytesRead; _ConnectDic(); - buf[0] = REQ_USER_SAVE; - buf[1] = L'\n'; - buf[2] = L'\0'; + pipebuf[0] = REQ_USER_SAVE; + pipebuf[1] = L'\n'; + pipebuf[2] = L'\0'; bytesWrite = (DWORD)((wcslen(pipebuf) + 1) * sizeof(WCHAR)); - if(WriteFile(hPipe, &buf, bytesWrite, &bytesWrite, NULL) == FALSE) + if(WriteFile(hPipe, pipebuf, bytesWrite, &bytesWrite, NULL) == FALSE) { goto exit; } bytesRead = 0; - if(ReadFile(hPipe, &buf, 4, &bytesRead, NULL) == FALSE) + if(ReadFile(hPipe, pipebuf, sizeof(pipebuf), &bytesRead, NULL) == FALSE) { goto exit; } diff --git a/imcrvtip/TextService.h b/imcrvtip/TextService.h index 71221825..a39159a8 100644 --- a/imcrvtip/TextService.h +++ b/imcrvtip/TextService.h @@ -101,10 +101,6 @@ class CTextService : { return _pComposition; } - CCandidateList *_GetCandidateList() - { - return _pCandidateList; - } // Compartment HRESULT _SetCompartment(REFGUID rguid, const VARIANT *pvar); @@ -153,7 +149,9 @@ class CTextService : // KeyHandlerCompostion HRESULT _Update(TfEditCookie ec, ITfContext *pContext, BOOL fixed = FALSE, BOOL back = FALSE); HRESULT _SetText(TfEditCookie ec, ITfContext *pContext, const std::wstring &text, LONG cchCursor, LONG cchOkuri, BOOL fixed); - HRESULT _ShowCandidateList(TfEditCookie ec, ITfContext *pContext, BOOL reg); + HRESULT _ShowCandidateList(TfEditCookie ec, ITfContext *pContext, BOOL reg, BOOL comp); + void _EndCandidateList(); + void _EndCompletionList(TfEditCookie ec, ITfContext *pContext); // KeyHandlerControl HRESULT _HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE sf, WCHAR ch); @@ -164,18 +162,20 @@ class CTextService : HRESULT _ConvRomanKana(ROMAN_KANA_CONV *pconv); HRESULT _SearchRomanKanaNode(const ROMAN_KANA_NODE &tree, ROMAN_KANA_CONV *pconv, int depth); HRESULT _ConvAsciiJLatin(ASCII_JLATIN_CONV *pconv); - void _StartConv(); - void _StartSubConv(); + void _StartConv(TfEditCookie ec, ITfContext *pContext); + void _StartSubConv(WCHAR command); void _NextConv(); void _PrevConv(); void _NextComp(); void _PrevComp(); void _SetComp(const std::wstring &candidate); + void _DynamicComp(TfEditCookie ec, ITfContext *pContext, BOOL sel = FALSE); + void _UserDicComp(); void _ConvRoman(); BOOL _ConvShift(WCHAR ch); BOOL _ConvN(); - void _ConvKanaToKana(std::wstring &dst, int dstmode, const std::wstring &src, int srcmode); - BOOL _SearchKanaByKana(const ROMAN_KANA_NODE &tree, int srcmode, const WCHAR *src, int dstmode, std::wstring &dst); + void _ConvKanaToKana(const std::wstring &src, int srcmode, std::wstring &dst, int dstmode); + BOOL _SearchKanaByKana(const ROMAN_KANA_NODE &tree, const WCHAR *src, int srcmode, std::wstring &dst, int dstmode); // KeyHandlerDictionary void _ConnectDic(); @@ -342,6 +342,9 @@ class CTextService : BOOL cx_backincenter; //後退に確定を含める BOOL cx_addcandktkn; //候補に片仮名変換を追加する BOOL cx_shiftnnokuri; //送り仮名で撥音を送り出す + BOOL cx_dynamiccomp; //動的補完を使用する + BOOL cx_dyncompmulti; //複数動的補完を使用する + BOOL cx_compuserdic; //補完のときユーザー辞書を検索する //ローマ字・仮名 std::wstring roman; //ローマ字 diff --git a/installer/README.TXT b/installer/README.TXT index 820cbeb9..cd9d9fa1 100644 --- a/installer/README.TXT +++ b/installer/README.TXT @@ -1,10 +1,10 @@  -================================================================================ - CorvusSKK version 1.7.14 +============================================================================== + CorvusSKK version 1.8.0 https://code.google.com/p/corvus-skk/ nathancorvussolis@gmail.com -================================================================================ +============================================================================== Windowsで動作するSKK風のIMEです。 @@ -20,9 +20,9 @@ --------------------------------------------------------------------------------- +============================================================================== インストール --------------------------------------------------------------------------------- +============================================================================== ・DirectX 9 以上をサポートしたGPU (推奨) @@ -82,9 +82,9 @@ --------------------------------------------------------------------------------- +============================================================================== 設定 --------------------------------------------------------------------------------- +============================================================================== ・設定ダイアログ @@ -107,9 +107,11 @@ 各種設定及び取込済SKK辞書は、ディレクトリ %AppData%\CorvusSKK の各ファイルに 保存されます。 + ---------------------------------------------------------------------------- || config.xml || 各種設定 || skkdict.dic || 取込済SKK辞書 || skkdict.idx || 取込済SKK辞書インデックス + ---------------------------------------------------------------------------- 各種設定の config.xml ファイルは、UTF-8 の XML フォーマットのテキストファイル となっており、テキストエディタで編集可能です。 @@ -120,7 +122,9 @@ ユーザー辞書は、ディレクトリ %AppData%\CorvusSKK のファイルに保存されます。 + ---------------------------------------------------------------------------- || userdict.txt || ユーザー辞書 + ---------------------------------------------------------------------------- UTF-16(LE, BOMあり)のSKK辞書フォーマットとなっています。 @@ -165,33 +169,63 @@ || *機能* || *備考* ---------------------------------------------------------------------------- || 初期入力モード || プログラム起動時の入力モードを指定します。 + || || || 送り仮名が決定したとき変換を開始する || 送り仮名を入力したとき自動的に変換を開始します。接頭辞も同様です。 + || || || 取消のとき変換位置を削除する || ▼モードから▽モードに遷移する際、送り仮名の位置情報を削除します。 + || || || 取消のとき送り仮名を削除する || ▼モードから▽モードに遷移する際、送り仮名の部分を削除します。 + || || || 後退に確定を含める || ▼モードのとき後退すると一文字削除した上で確定します。 || || OFFでは▼モードのとき後退は前候補と同じ機能を有します。 + || || || 候補に片仮名変換を追加する || 見出し語を片仮名に変換した候補を追加します。 + || || || 送り仮名で撥音を送り出す || 送り仮名入力開始後の変換位置指定を含む「な/にゃ」行の入力で「ん」を送り出します。 || || 例) ON:「NoNO」→「▽の*んお」/ OFF:「NoNO」→「▽の*の」 + || || || 送り仮名が一致した候補を優先する || 送り仮名ブロックの送り仮名が一致する候補を優先して出力します。 + || || + || 動的補完を使用する || 見出し語が入力されたとき補完された見出し語を表示します。 + || || 「▽表示属性」の「*送り」の色が使用されます。 + || || + || 複数動的補完を使用する || 見出し語が入力されたとき補完された見出し語を7個ずつ表示します。 + || || 補完対象は「候補一覧の色」の「選択」、補完部分は「候補」の色が使用されます。 + || || + || 補完のときユーザー辞書を検索する || 補完/動的補完/複数動的補完のときユーザー辞書の検索結果を追加して表示します。 + || || 表示する候補の数は最大で「候補一覧表示に要する変換回数」-1 です。 + || || 補完/動的補完では「▽表示属性」の「*送り」の色が使用されます。 + || || 複数動的補完では「候補一覧の色」の「注釈」の色が使用されます。 + ---------------------------------------------------------------------------- ・表示 || *機能* || *備考* ---------------------------------------------------------------------------- || 候補一覧のフォント || 候補一覧に表示するフォントの種類、スタイル、サイズを指定します。 + || || || 候補一覧の最大幅 || 候補一覧の最大幅のサイズを指定します。 + || || || 候補一覧の色 || 候補一覧の色を指定します。 + || || || 候補一覧の描画API || 候補一覧の描画を行うAPIを指定します。 || || Direct2Dと彩色の指定でカラーフォントをその色で表示します。(Windows8.1以降) + || || || 候補一覧表示に要する変換回数(0は表示無し) || 指定した回数変換すると候補一覧が表示されます。 + || || || 候補一覧が表示無しのとき候補数を表示する || (<現在の候補の番号>/<候補数>) の形式を追加して表示します。 + || || || 候補一覧を縦に表示する || 候補一覧で候補を縦に並べて表示します。 + || || || 注釈を表示する || <候補><セミコロン><注釈> の形式で注釈を表示します。 + || || || 入力モードを表示する || キャレットまたは辞書登録ウィンドウ付近に入力モードを表示します。 || || タイミングは、IME ON、入力モード変更、「*無効*」キー押下のときです。 + || || || ▽▼*マークを表示する || 大切なものは目に見えないようです。 + || || || ローマ字を表示する || 仮名文字のローマ字プレフィックスを表示します。 + ---------------------------------------------------------------------------- ・表示属性 @@ -211,9 +245,11 @@ します。 候補一覧が表示されているとき、Kanaキーロックは無視されます。 + ---------------------------------------------------------------------------- || 数字 || 選択キー(1〜9で固定) || 表示 || 選択キー(必須、候補一覧の表示にも使用) || 予備 || 選択キー(空でもOK) + ---------------------------------------------------------------------------- ・キー設定(ON/OFF) @@ -249,6 +285,7 @@ || || 漢字 || 0x19 || || (Alt+半角/全角 Alt+`) || 0x19 || || 半角/全角(Ctrl+`) || 0xF3, 0xF4 + ---------------------------------------------------------------------------- キー設定(文字) @@ -280,6 +317,7 @@ || 右移動 || Ctrl+f || || 末尾移動 || Ctrl+e || || 貼付 || Ctrl+y Ctrl+v || クリップボードの文字列を貼り付け + ---------------------------------------------------------------------------- キー設定(仮想キー) @@ -311,6 +349,7 @@ || 右移動 || 0x27 (カーソル右) || || 末尾移動 || 0x28 (カーソル下) || || 貼付 || || クリップボードの文字列を貼り付け + ---------------------------------------------------------------------------- ・キー設定と入力モード遷移図 @@ -359,9 +398,11 @@ 変換位置での挙動を指定します。最大で256行です。 - || 開始 || 変換位置開始キー - || 代替 || 変換位置開始キーに代わってローマ字仮名変換に使用する - || 送り || 辞書検索に使用する送りローマ字 + ---------------------------------------------------------------------------- + || 開始 || 変換位置開始キー + || 代替 || 変換位置開始キーに代わってローマ字仮名変換に使用する + || 送り || 辞書検索に使用する送りローマ字 + ---------------------------------------------------------------------------- 例1)AZIK風に、ローマ字仮名変換表で「q ん ン ン 0」と設定し、 開始「Q」代替「q」送り「n」と設定する。 @@ -421,9 +462,9 @@ --------------------------------------------------------------------------------- +============================================================================== その他 --------------------------------------------------------------------------------- +============================================================================== ・Lua拡張 @@ -502,6 +543,7 @@ || #6 || タイプ6 ローマ数字(独自) ||「1234」→「MCCXXXIV」 || #8 || タイプ8 桁区切り ||「1234567890」→「1,234,567,890」 || #9 || タイプ9 将棋 ||「12kin」→「1二金」 + ---------------------------------------------------------------------------- ・Unicodeコードポイント変換 @@ -576,3 +618,5 @@ Visual Studio Express 2013 for Windows Desktop Update 4 WiX Toolset v3.9 + +============================================================================== diff --git a/installer/config-sample/config - act.xml b/installer/config-sample/config - act.xml index a1cef83b..7d68c7ab 100644 --- a/installer/config-sample/config - act.xml +++ b/installer/config-sample/config - act.xml @@ -25,6 +25,9 @@ + + +
@@ -57,7 +60,7 @@
- + diff --git a/installer/config-sample/config - azik-jpkbd.xml b/installer/config-sample/config - azik-jpkbd.xml index c750a722..9d7a1db9 100644 --- a/installer/config-sample/config - azik-jpkbd.xml +++ b/installer/config-sample/config - azik-jpkbd.xml @@ -25,6 +25,9 @@ + + +
@@ -57,7 +60,7 @@
- + diff --git a/installer/config-sample/config - azik-uskbd.xml b/installer/config-sample/config - azik-uskbd.xml index 38c277b6..741858d9 100644 --- a/installer/config-sample/config - azik-uskbd.xml +++ b/installer/config-sample/config - azik-uskbd.xml @@ -25,6 +25,9 @@ + + +
@@ -57,7 +60,7 @@
- + diff --git a/installer/config-sample/config - gact10.xml b/installer/config-sample/config - gact10.xml index 212b9c61..833df84f 100644 --- a/installer/config-sample/config - gact10.xml +++ b/installer/config-sample/config - gact10.xml @@ -60,6 +60,9 @@ + + +
@@ -92,7 +95,7 @@
- + diff --git a/installer/config-sample/config - kana.xml b/installer/config-sample/config - kana.xml index 724deb5d..313eb3b6 100644 --- a/installer/config-sample/config - kana.xml +++ b/installer/config-sample/config - kana.xml @@ -38,6 +38,9 @@ + + +
@@ -70,7 +73,7 @@
- + diff --git a/installer/config-sample/config - roman.xml b/installer/config-sample/config - roman.xml index 27c6a13f..594399cf 100644 --- a/installer/config-sample/config - roman.xml +++ b/installer/config-sample/config - roman.xml @@ -25,6 +25,9 @@ + + +
@@ -57,7 +60,7 @@
- + diff --git a/installer/corvusskk-x64.wxs b/installer/corvusskk-x64.wxs index 7cf29b39..675c7cd5 100644 --- a/installer/corvusskk-x64.wxs +++ b/installer/corvusskk-x64.wxs @@ -1,7 +1,7 @@ - + diff --git a/installer/corvusskk-x86.wxs b/installer/corvusskk-x86.wxs index 995e9c53..2f2161c2 100644 --- a/installer/corvusskk-x86.wxs +++ b/installer/corvusskk-x86.wxs @@ -1,7 +1,7 @@ - +