Skip to content

Commit

Permalink
1.8.0
Browse files Browse the repository at this point in the history
・オプション「動的補完を使用する」を追加しました。
 ・見出し語が入力されたとき補完された見出し語を表示します。
 ・「▽表示属性」の「*送り」の色が使用されます。

・オプション「複数動的補完を使用する」を追加しました。
 ・見出し語が入力されたとき補完された見出し語を7個ずつ表示します。

・オプション「補完のときユーザー辞書を検索する」を追加しました。
 ・補完/動的補完/複数動的補完のときユーザー辞書の検索結果を追加して表示します。
 ・表示する候補の数は最大で「候補一覧表示に要する変換回数」-1 です。
 ・補完/動的補完では「▽表示属性」の「*送り」の色が使用されます。
 ・複数動的補完では「候補一覧の色」の「注釈」の色が使用されます。

・ユーザー入力による辞書登録において非表示となっている入力モード表示が表示されてしまうことがあるバグを修正しました。
  • Loading branch information
nathancorvussolis committed Dec 14, 2014
1 parent c0fa02d commit 8118279
Show file tree
Hide file tree
Showing 37 changed files with 863 additions and 195 deletions.
6 changes: 3 additions & 3 deletions common/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
7 changes: 4 additions & 3 deletions common/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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' //候補変換
Expand Down
3 changes: 3 additions & 0 deletions common/configxml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions common/configxml.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 11 additions & 0 deletions imcrvcnf/DlgProcBehavior.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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:
Expand All @@ -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

Expand Down
Binary file modified imcrvcnf/imcrvcnf.rc
Binary file not shown.
3 changes: 3 additions & 0 deletions imcrvcnf/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion imcrvmgr/SearchDictionary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
3 changes: 2 additions & 1 deletion imcrvmgr/SearchUserDictionary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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""));
}
Expand Down
30 changes: 25 additions & 5 deletions imcrvmgr/imcrvmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
// request "1\n<key>\t<key(original)>\t<okuri>\n"
// reply "T\n<candidate(display)>\t<candidate(regist)>\t<annotation(display)>\t<annotation(regist)>\n...\n":hit
// "F\n":nothing
//search candidate (user dictionary only)
// request "2\n<key>\t<key(original)>\t<okuri>\n"
// reply "T\n<candidate(display)>\t<candidate(regist)>\t<annotation(display)>\t<annotation(regist)>\n...\n":hit
// "F\n":nothing
//search key for complement
// request "4\n<key>\t\t\n"
// reply "T\n<key>\t\t\t\n...\n":hit
Expand Down Expand Up @@ -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);
Expand All @@ -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())
{
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
19 changes: 13 additions & 6 deletions imcrvtip/CandidateList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
{
Expand All @@ -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;
}
Expand All @@ -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;
}
}

Expand Down
3 changes: 2 additions & 1 deletion imcrvtip/CandidateList.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading

0 comments on commit 8118279

Please sign in to comment.