From 93b9ab962b1dcee63a87fd2722b7e17ad09b4ae3 Mon Sep 17 00:00:00 2001 From: nathancorvussolis Date: Sat, 20 Dec 2014 16:04:31 +0900 Subject: [PATCH] 1.8.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ・動的補完のレスポンスを改善しました。  ・xxmagaiさん、情報ありがとうございます。 --- common/common.h | 19 ++----- common/common.vcxproj | 1 + common/common.vcxproj.filters | 3 ++ common/version.h | 20 ++++++++ imcrvcnf/DlgProcDisplay.cpp | 8 +-- imcrvcnf/imcrvcnf.rc | Bin 58632 -> 58634 bytes imcrvmgr/imcrvmgr.cpp | 79 +++++++++++++++++++++--------- imcrvmgr/imcrvmgr.rc | Bin 1708 -> 1710 bytes imcrvtip/CandidateList.cpp | 10 ++++ imcrvtip/CandidateList.h | 3 ++ imcrvtip/CandidatePaint.cpp | 22 +++++++-- imcrvtip/CandidateWindow.cpp | 34 ++++++++++--- imcrvtip/CandidateWindow.h | 1 + imcrvtip/KeyHandlerControl.cpp | 12 ++++- imcrvtip/KeyHandlerConv.cpp | 43 +++++++++++++--- imcrvtip/KeyHandlerDictionary.cpp | 7 ++- imcrvtip/TextService.h | 3 +- imcrvtip/imcrvtip.rc | Bin 3712 -> 3714 bytes installer/README.TXT | 2 +- installer/corvusskk-x64.wxs | 2 +- installer/corvusskk-x86.wxs | 2 +- 21 files changed, 203 insertions(+), 68 deletions(-) create mode 100644 common/version.h diff --git a/common/common.h b/common/common.h index ec2800f1..f507878c 100644 --- a/common/common.h +++ b/common/common.h @@ -2,20 +2,7 @@ #ifndef COMMON_H #define COMMON_H -#define TEXTSERVICE_NAME L"CorvusSKK" -#define TEXTSERVICE_VER L"1.8.0" - -#ifndef _DEBUG -#define TEXTSERVICE_DESC TEXTSERVICE_NAME -#else -#define TEXTSERVICE_DESC TEXTSERVICE_NAME L"_DEBUG" -#endif - -//for resource -#define RC_AUTHOR "nathancorvussolis" -#define RC_PRODUCT "CorvusSKK" -#define RC_VERSION "1.8.0" -#define RC_VERSION_D 1,8,0,0 +#include "version.h" #define MAX_KRNLOBJNAME 256 #define CONV_POINT_NUM 256 @@ -44,6 +31,10 @@ #define REQ_USER_DEL_0 L'C' //ユーザー辞書削除(送りあり、補完なし) #define REQ_USER_DEL_1 L'D' //ユーザー辞書削除(送りなし、補完あり) #define REQ_USER_SAVE L'S' //ユーザー辞書保存 +#ifdef _DEBUG +#define REQ_DEBUGOUT_ON L'[' +#define REQ_DEBUGOUT_OFF L']' +#endif //reply #define REP_OK L'T' //hit #define REP_FALSE L'F' //nothing diff --git a/common/common.vcxproj b/common/common.vcxproj index a5819bf1..7bd54874 100644 --- a/common/common.vcxproj +++ b/common/common.vcxproj @@ -155,6 +155,7 @@ + diff --git a/common/common.vcxproj.filters b/common/common.vcxproj.filters index 583396ec..fe63f2cb 100644 --- a/common/common.vcxproj.filters +++ b/common/common.vcxproj.filters @@ -39,6 +39,9 @@ Header Files + + Header Files + diff --git a/common/version.h b/common/version.h new file mode 100644 index 00000000..54be04cf --- /dev/null +++ b/common/version.h @@ -0,0 +1,20 @@ + +#ifndef VERSION_H +#define VERSION_H + +#define TEXTSERVICE_NAME L"CorvusSKK" +#define TEXTSERVICE_VER L"1.8.1" + +#ifndef _DEBUG +#define TEXTSERVICE_DESC TEXTSERVICE_NAME +#else +#define TEXTSERVICE_DESC TEXTSERVICE_NAME L"_DEBUG" +#endif + +//for resource +#define RC_AUTHOR "nathancorvussolis" +#define RC_PRODUCT "CorvusSKK" +#define RC_VERSION "1.8.1" +#define RC_VERSION_D 1,8,1,0 + +#endif diff --git a/imcrvcnf/DlgProcDisplay.cpp b/imcrvcnf/DlgProcDisplay.cpp index 079a2999..13714bb0 100644 --- a/imcrvcnf/DlgProcDisplay.cpp +++ b/imcrvcnf/DlgProcDisplay.cpp @@ -3,6 +3,8 @@ #include "imcrvcnf.h" #include "resource.h" +#define DISPLAY_FONTSIZE 10 + static struct { int id; LPCWSTR value; @@ -71,7 +73,7 @@ INT_PTR CALLBACK DlgProcDisplay(HWND hDlg, UINT message, WPARAM wParam, LPARAM l SetDlgItemTextW(hDlg, IDC_EDIT_FONTNAME, fontname); hdc = GetDC(hDlg); - hFont = CreateFontW(-MulDiv(10, GetDeviceCaps(hdc, LOGPIXELSY), 72), 0, 0, 0, + hFont = CreateFontW(-MulDiv(DISPLAY_FONTSIZE, GetDeviceCaps(hdc, LOGPIXELSY), 72), 0, 0, 0, fontweight, fontitalic, FALSE, FALSE, SHIFTJIS_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, fontname); SendMessageW(GetDlgItem(hDlg, IDC_EDIT_FONTNAME), WM_SETFONT, (WPARAM)hFont, 0); @@ -168,10 +170,10 @@ INT_PTR CALLBACK DlgProcDisplay(HWND hDlg, UINT message, WPARAM wParam, LPARAM l PropSheet_Changed(GetParent(hDlg), hDlg); SetDlgItemTextW(hDlg, IDC_EDIT_FONTNAME, lf.lfFaceName); - lf.lfHeight = -MulDiv(10, GetDeviceCaps(hdc, LOGPIXELSY), 72); + lf.lfHeight = -MulDiv(DISPLAY_FONTSIZE, GetDeviceCaps(hdc, LOGPIXELSY), 72); hFont = CreateFontIndirect(&lf); SendMessageW(GetDlgItem(hDlg, IDC_EDIT_FONTNAME), WM_SETFONT, (WPARAM)hFont, 0); - SetDlgItemInt(hDlg, IDC_EDIT_FONTPOINT, cf.iPointSize / 10, FALSE); + SetDlgItemInt(hDlg, IDC_EDIT_FONTPOINT, cf.iPointSize / DISPLAY_FONTSIZE, FALSE); } ReleaseDC(hDlg, hdc); diff --git a/imcrvcnf/imcrvcnf.rc b/imcrvcnf/imcrvcnf.rc index d392a71ba4277210fe234dd6af39e6aae0a8c0b0..896cc1975bc596517d90fe8b16c53925ac3d13e1 100644 GIT binary patch delta 22 dcmeA;#oTp@c|r+i8AB>V5koOU=EmyYCjehR2!H?p delta 20 bcmeA=#oTdfirst) + L"\t\t\t\n"; + result += sc_itr->first + L"\t\t\t\n"; } } else @@ -425,6 +425,14 @@ void SrvProc(WCHAR command, const std::wstring &argument, std::wstring &result) result += L"\n"; break; +#ifdef _DEBUG + case REQ_DEBUGOUT_ON: + case REQ_DEBUGOUT_OFF: + result = REP_OK; + result += L"\n"; + break; +#endif + default: result = REP_FALSE; result += L"\n"; @@ -444,6 +452,7 @@ unsigned int __stdcall SrvThread(void *p) std::wstring dedit, tedit; std::wregex re; std::wstring fmt; + static BOOL debugout = TRUE; #endif while(true) @@ -478,38 +487,60 @@ unsigned int __stdcall SrvThread(void *p) command = pipebuf[0]; #ifdef _DEBUG - if(command == REQ_USER_SAVE) + switch(command) { - dedit.clear(); + case REQ_DEBUGOUT_ON: + debugout = TRUE; + break; + default: + break; } - tedit.assign(pipebuf); - re.assign(L"\n"); - fmt.assign(L"\r\n"); - tedit = std::regex_replace(tedit, re, fmt); - re.assign(L"\t"); - fmt.assign(L"»"); - tedit = std::regex_replace(tedit, re, fmt); - - dedit.append(tedit); - SetWindowTextW(hwndEdit, dedit.c_str()); + if(debugout) + { + tedit.assign(pipebuf); + re.assign(L"\n"); + fmt.assign(L"\r\n"); + tedit = std::regex_replace(tedit, re, fmt); + re.assign(L"\t"); + fmt.assign(L"»"); + tedit = std::regex_replace(tedit, re, fmt); + + dedit.append(tedit); + SetWindowTextW(hwndEdit, dedit.c_str()); + } #endif SrvProc(command, &pipebuf[2], wspipebuf); wcsncpy_s(pipebuf, wspipebuf.c_str(), _TRUNCATE); #ifdef _DEBUG - tedit.assign(pipebuf); - re.assign(L"\n"); - fmt.assign(L"\r\n"); - tedit = std::regex_replace(tedit, re, fmt); - re.assign(L"\t"); - fmt.assign(L"»"); - tedit = std::regex_replace(tedit, re, fmt); - - dedit.append(tedit); - SetWindowTextW(hwndEdit, dedit.c_str()); - SendMessageW(hwndEdit, WM_VSCROLL, SB_BOTTOM, 0); + if(debugout) + { + tedit.assign(pipebuf); + re.assign(L"\n"); + fmt.assign(L"\r\n"); + tedit = std::regex_replace(tedit, re, fmt); + re.assign(L"\t"); + fmt.assign(L"»"); + tedit = std::regex_replace(tedit, re, fmt); + + dedit.append(tedit); + SetWindowTextW(hwndEdit, dedit.c_str()); + SendMessageW(hwndEdit, WM_VSCROLL, SB_BOTTOM, 0); + } + + switch(command) + { + case REQ_USER_SAVE: + dedit.clear(); + break; + case REQ_DEBUGOUT_OFF: + debugout = FALSE; + break; + default: + break; + } #endif bytesWrite = (DWORD)((wcslen(pipebuf) + 1) * sizeof(WCHAR)); diff --git a/imcrvmgr/imcrvmgr.rc b/imcrvmgr/imcrvmgr.rc index ec9a1a747d073a6ae63bbbc08a45816ea3868586..d0f1d7dcb094919e5357a9f516a108424a7af6e4 100644 GIT binary patch delta 20 bcmZ3(yN-8)8)q3qDnk)NF+=7?-*`3vK_ms> delta 18 ZcmZ3-yM}jy8+$TCK0_`;?neK3HUKs$1!DjJ diff --git a/imcrvtip/CandidateList.cpp b/imcrvtip/CandidateList.cpp index 57d23444..10d113d4 100644 --- a/imcrvtip/CandidateList.cpp +++ b/imcrvtip/CandidateList.cpp @@ -238,6 +238,8 @@ HRESULT CCandidateList::_StartCandidateList(TfClientId tfClientId, ITfDocumentMg _ec = ec; + _comp = comp; + if(_AdviseContextKeyEventSink() != S_OK) { goto exit; @@ -441,3 +443,11 @@ void CCandidateList::_Move(LPRECT lpr) _pCandidateWindow->_Move(lpr); } } + +void CCandidateList::_UpdateComp() +{ + if(_pCandidateWindow != NULL) + { + _pCandidateWindow->_UpdateComp(); + } +} diff --git a/imcrvtip/CandidateList.h b/imcrvtip/CandidateList.h index d33f45ce..b34e156f 100644 --- a/imcrvtip/CandidateList.h +++ b/imcrvtip/CandidateList.h @@ -38,6 +38,7 @@ class CCandidateList : void _Show(BOOL bShow); void _SetText(const std::wstring &text, BOOL fixed, BOOL showcandlist, BOOL showreg); void _Move(LPRECT lpr); + void _UpdateComp(); private: LONG _cRef; @@ -59,6 +60,8 @@ class CCandidateList : HWND _hwndParent; CCandidateWindow *_pCandidateWindow; + + BOOL _comp; }; #endif //CANDIDATELIST_H diff --git a/imcrvtip/CandidatePaint.cpp b/imcrvtip/CandidatePaint.cpp index ce067764..d2b447ce 100644 --- a/imcrvtip/CandidatePaint.cpp +++ b/imcrvtip/CandidatePaint.cpp @@ -328,14 +328,17 @@ std::wstring CCandidateWindow::_MakeCandidateString(UINT page, UINT count, UINT break; case CL_COLOR_SC: - if(_pTextService->cx_annotation && - !candidates[count + _uShowedCount + idx].first.second.empty()) + if(!_comp) { - if(!_comp) + if(_pTextService->cx_annotation && + !candidates[count + _uShowedCount + idx].first.second.empty()) { s.append(markAnnotation); } - else + } + else + { + if(!candidates[count + _uShowedCount + idx].first.second.empty()) { s.append(markNBSP); } @@ -343,7 +346,7 @@ std::wstring CCandidateWindow::_MakeCandidateString(UINT page, UINT count, UINT break; case CL_COLOR_AN: - //if(!_comp) + if(!_comp) { if(_pTextService->cx_annotation && !candidates[count + _uShowedCount + idx].first.second.empty()) @@ -353,6 +356,15 @@ std::wstring CCandidateWindow::_MakeCandidateString(UINT page, UINT count, UINT std::wregex(markSP), std::wstring(markNBSP))); } } + else + { + if(!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) { diff --git a/imcrvtip/CandidateWindow.cpp b/imcrvtip/CandidateWindow.cpp index 90d7eb10..1270c3cf 100644 --- a/imcrvtip/CandidateWindow.cpp +++ b/imcrvtip/CandidateWindow.cpp @@ -521,6 +521,18 @@ void CCandidateWindow::_End() } } +void CCandidateWindow::_UpdateComp() +{ + _comp = TRUE; + candidates = _pTextService->candidates; + candidx = _pTextService->candidx; + searchkey = _pTextService->searchkey; + + _InitList(); + _Update(); + _UpdateUIElement(); +} + void CCandidateWindow::_InitList() { UINT i; @@ -766,14 +778,17 @@ void CCandidateWindow::_PrevComp() GetCurrentPage(&uOldPage); + _InvokeSfHandler(SKK_PREV_COMP); + if(_uIndex == 0) { - _EndCandidateList(SKK_CANCEL); + candidx = (size_t)-1; + _InitList(); + _Update(); + _UpdateUIElement(); return; } - _InvokeSfHandler(SKK_PREV_COMP); - candidx--; _uIndex--; @@ -1148,13 +1163,16 @@ void CCandidateWindow::_Update() void CCandidateWindow::_EndCandidateList(BYTE sf) { _InvokeSfHandler(sf); - //複数動的補完は自身で終了しない + + if(_pTextService != NULL) + { + _pTextService->showcandlist = FALSE; + } + + //直後に複数動的補完を表示する場合使い回しする + //_InvokeSfHandler() ---> _UpdateComp() -> _comp = TRUE if(!_comp) { - if(_pTextService != NULL) - { - _pTextService->showcandlist = FALSE; - } if(_pCandidateList != NULL) { _pCandidateList->_EndCandidateList(); diff --git a/imcrvtip/CandidateWindow.h b/imcrvtip/CandidateWindow.h index 83ad8221..47207619 100644 --- a/imcrvtip/CandidateWindow.h +++ b/imcrvtip/CandidateWindow.h @@ -51,6 +51,7 @@ class CCandidateWindow : public ITfCandidateListUIElementBehavior void _SetText(const std::wstring &text, BOOL fixed, BOOL showcandlist, BOOL showreg); void _PreEnd(); void _End(); + void _UpdateComp(); private: void _InitList(); diff --git a/imcrvtip/KeyHandlerControl.cpp b/imcrvtip/KeyHandlerControl.cpp index 68673f8c..67929524 100644 --- a/imcrvtip/KeyHandlerControl.cpp +++ b/imcrvtip/KeyHandlerControl.cpp @@ -1,6 +1,7 @@  #include "imcrvtip.h" #include "TextService.h" +#include "CandidateList.h" HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE sf, WCHAR ch) { @@ -377,8 +378,15 @@ HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE if(cx_dyncompmulti && complement && candidx == 0 && pContext != NULL) { - showcandlist = FALSE; - _ShowCandidateList(ec, pContext, FALSE, TRUE); + if(_pCandidateList == NULL) + { + showcandlist = FALSE; + _ShowCandidateList(ec, pContext, FALSE, TRUE); + } + else + { + _pCandidateList->_UpdateComp(); + } } return S_OK; } diff --git a/imcrvtip/KeyHandlerConv.cpp b/imcrvtip/KeyHandlerConv.cpp index 4d7af9ef..59cd3ffc 100644 --- a/imcrvtip/KeyHandlerConv.cpp +++ b/imcrvtip/KeyHandlerConv.cpp @@ -1,6 +1,7 @@  #include "imcrvtip.h" #include "TextService.h" +#include "CandidateList.h" WCHAR CTextService::_GetCh(BYTE vk, BYTE vkoff) { @@ -535,10 +536,18 @@ void CTextService::_DynamicComp(TfEditCookie ec, ITfContext *pContext, BOOL sel) std::wstring kana_bak = kana; size_t cursoridx_bak = cursoridx; +#ifdef _DEBUG + _CommandDic(REQ_DEBUGOUT_OFF); +#endif + //補完 complement = FALSE; _NextComp(); +#ifdef _DEBUG + _CommandDic(REQ_DEBUGOUT_ON); +#endif + cursoridx = cursoridx_bak; if(complement) @@ -546,7 +555,7 @@ void CTextService::_DynamicComp(TfEditCookie ec, ITfContext *pContext, BOOL sel) if(cx_compuserdic) { //ユーザー辞書検索 - _UserDicComp(); + _UserDicComp(MAX_SELKEY_C); if(!candidates.empty()) { kana += markSP + candidates[0].first.second; @@ -579,8 +588,15 @@ void CTextService::_DynamicComp(TfEditCookie ec, ITfContext *pContext, BOOL sel) candidx = (size_t)-1; } - showcandlist = FALSE; - _ShowCandidateList(ec, pContext, FALSE, TRUE); + if(_pCandidateList != NULL && _pCandidateList->_IsShowCandidateWindow()) + { + _pCandidateList->_UpdateComp(); + } + else + { + showcandlist = FALSE; + _ShowCandidateList(ec, pContext, FALSE, TRUE); + } } complement = FALSE; @@ -592,16 +608,25 @@ void CTextService::_DynamicComp(TfEditCookie ec, ITfContext *pContext, BOOL sel) } } -void CTextService::_UserDicComp() +void CTextService::_UserDicComp(size_t max) { std::wstring kana_bak = kana; std::wstring searchkey_bak = searchkey; CANDIDATES candidates_bak = candidates; size_t candidx_bak = candidx; - size_t i; + size_t i, count = 0; + +#ifdef _DEBUG + _CommandDic(REQ_DEBUGOUT_OFF); +#endif FORWARD_ITERATION_I(candidates_bak_itr, candidates_bak) { + if(max < ++count) + { + break; + } + //ユーザー辞書検索 kana = candidates_bak_itr->first.first; _StartSubConv(REQ_SEARCHUSER); @@ -609,11 +634,11 @@ void CTextService::_UserDicComp() if(!candidates.empty() && cx_untilcandlist > 1) { candidates_bak_itr->first.second = L"/"; - i = 2; + i = 1; FORWARD_ITERATION_I(candidates_itr, candidates) { //「候補一覧表示に要する変換回数」-1 個まで - if(cx_untilcandlist < i++) + if(cx_untilcandlist < ++i) { break; } @@ -627,6 +652,10 @@ void CTextService::_UserDicComp() } } +#ifdef _DEBUG + _CommandDic(REQ_DEBUGOUT_ON); +#endif + kana = kana_bak; searchkey = searchkey_bak; candidates = candidates_bak; diff --git a/imcrvtip/KeyHandlerDictionary.cpp b/imcrvtip/KeyHandlerDictionary.cpp index af5a440b..ea307416 100644 --- a/imcrvtip/KeyHandlerDictionary.cpp +++ b/imcrvtip/KeyHandlerDictionary.cpp @@ -247,12 +247,17 @@ void CTextService::_DelUserDic(WCHAR command, const std::wstring &key, const std } void CTextService::_SaveUserDic() +{ + _CommandDic(REQ_USER_SAVE); +} + +void CTextService::_CommandDic(WCHAR command) { DWORD bytesWrite, bytesRead; _ConnectDic(); - pipebuf[0] = REQ_USER_SAVE; + pipebuf[0] = command; pipebuf[1] = L'\n'; pipebuf[2] = L'\0'; diff --git a/imcrvtip/TextService.h b/imcrvtip/TextService.h index a39159a8..33fbce7c 100644 --- a/imcrvtip/TextService.h +++ b/imcrvtip/TextService.h @@ -170,7 +170,7 @@ class CTextService : void _PrevComp(); void _SetComp(const std::wstring &candidate); void _DynamicComp(TfEditCookie ec, ITfContext *pContext, BOOL sel = FALSE); - void _UserDicComp(); + void _UserDicComp(size_t max = (size_t)-1); void _ConvRoman(); BOOL _ConvShift(WCHAR ch); BOOL _ConvN(); @@ -185,6 +185,7 @@ class CTextService : void _AddUserDic(WCHAR command, const std::wstring &key, const std::wstring &candidate, const std::wstring &annotation); void _DelUserDic(WCHAR command, const std::wstring &key, const std::wstring &candidate); void _SaveUserDic(); + void _CommandDic(WCHAR command); void _StartManager(); void _StartConfigure(); void _StartProcess(LPCWSTR fname); diff --git a/imcrvtip/imcrvtip.rc b/imcrvtip/imcrvtip.rc index 754c74ca6b089ad23149b66acc717da0a425c31a..180eb1e8cf22e0295164e6bdd9815325dc4a81fd 100644 GIT binary patch delta 20 bcmZpWZIYef##zRY%232m%#gX!*O(6gJd6c| delta 18 ZcmZpYZIGSd#-7ZO&ydTIyV2j64*)U&1qT2C diff --git a/installer/README.TXT b/installer/README.TXT index cd9d9fa1..f8b55bfd 100644 --- a/installer/README.TXT +++ b/installer/README.TXT @@ -1,6 +1,6 @@  ============================================================================== - CorvusSKK version 1.8.0 + CorvusSKK version 1.8.1 https://code.google.com/p/corvus-skk/ nathancorvussolis@gmail.com diff --git a/installer/corvusskk-x64.wxs b/installer/corvusskk-x64.wxs index 675c7cd5..5c112edb 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 2f2161c2..9c6c3f73 100644 --- a/installer/corvusskk-x86.wxs +++ b/installer/corvusskk-x86.wxs @@ -1,7 +1,7 @@ - +