Skip to content

Commit

Permalink
1.8.1
Browse files Browse the repository at this point in the history
・動的補完のレスポンスを改善しました。
 ・xxmagaiさん、情報ありがとうございます。
  • Loading branch information
nathancorvussolis committed Dec 20, 2014
1 parent 8118279 commit 93b9ab9
Show file tree
Hide file tree
Showing 21 changed files with 203 additions and 68 deletions.
19 changes: 5 additions & 14 deletions common/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions common/common.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@
<ClInclude Include="parseskkdic.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="utf8.h" />
<ClInclude Include="version.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="common.cpp" />
Expand Down
3 changes: 3 additions & 0 deletions common/common.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
<ClInclude Include="utf8.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="version.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
Expand Down
20 changes: 20 additions & 0 deletions common/version.h
Original file line number Diff line number Diff line change
@@ -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
8 changes: 5 additions & 3 deletions imcrvcnf/DlgProcDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include "imcrvcnf.h"
#include "resource.h"

#define DISPLAY_FONTSIZE 10

static struct {
int id;
LPCWSTR value;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
Binary file modified imcrvcnf/imcrvcnf.rc
Binary file not shown.
79 changes: 55 additions & 24 deletions imcrvmgr/imcrvmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ void SrvProc(WCHAR command, const std::wstring &argument, std::wstring &result)
result += L"\n";
FORWARD_ITERATION_I(sc_itr, sc)
{
result += ParseConcat(sc_itr->first) + L"\t\t\t\n";
result += sc_itr->first + L"\t\t\t\n";
}
}
else
Expand Down Expand Up @@ -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";
Expand All @@ -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)
Expand Down Expand Up @@ -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));
Expand Down
Binary file modified imcrvmgr/imcrvmgr.rc
Binary file not shown.
10 changes: 10 additions & 0 deletions imcrvtip/CandidateList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ HRESULT CCandidateList::_StartCandidateList(TfClientId tfClientId, ITfDocumentMg

_ec = ec;

_comp = comp;

if(_AdviseContextKeyEventSink() != S_OK)
{
goto exit;
Expand Down Expand Up @@ -441,3 +443,11 @@ void CCandidateList::_Move(LPRECT lpr)
_pCandidateWindow->_Move(lpr);
}
}

void CCandidateList::_UpdateComp()
{
if(_pCandidateWindow != NULL)
{
_pCandidateWindow->_UpdateComp();
}
}
3 changes: 3 additions & 0 deletions imcrvtip/CandidateList.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -59,6 +60,8 @@ class CCandidateList :

HWND _hwndParent;
CCandidateWindow *_pCandidateWindow;

BOOL _comp;
};

#endif //CANDIDATELIST_H
22 changes: 17 additions & 5 deletions imcrvtip/CandidatePaint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,22 +328,25 @@ 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);
}
}
break;

case CL_COLOR_AN:
//if(!_comp)
if(!_comp)
{
if(_pTextService->cx_annotation &&
!candidates[count + _uShowedCount + idx].first.second.empty())
Expand All @@ -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)
{
Expand Down
34 changes: 26 additions & 8 deletions imcrvtip/CandidateWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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--;
Expand Down Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions imcrvtip/CandidateWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
12 changes: 10 additions & 2 deletions imcrvtip/KeyHandlerControl.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

#include "imcrvtip.h"
#include "TextService.h"
#include "CandidateList.h"

HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE sf, WCHAR ch)
{
Expand Down Expand Up @@ -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;
}
Expand Down
Loading

0 comments on commit 93b9ab9

Please sign in to comment.