Skip to content

Commit

Permalink
1.7.12
Browse files Browse the repository at this point in the history
・ローマ字仮名変換表の内部構造を配列から木構造に変更しました。
 ・ローマ字の検索方法を、これまでの最短一致検索から最長一致検索に変更しています。
 ・ローマ字入力の場合、ローマ字仮名変換表に「n、ん、ン、ン」の行を追加してください。何行目でもOKです。
 ・ローマ字仮名変換表のローマ字「nb」,「nc」,「nd」〜「nz」の行は不要となりますが、あっても問題ありません。

・送り仮名の先頭が入力し直されたときの送りローマ字が上書きされていなかったバグを修正しました。
 ・ローマ字入力のサンプル設定で「HasiGru」と入力したとき、「はしg」ではなく、"g"はキャンセルされて「はしr」で辞書検索するようになります。

・変換位置指定の「代替」と「送り」が異なるACTなどの設定のとき、ローマ字2文字目以降で送り仮名を開始すると送りローマ字に「送り」ではなく「代替」が使われていたバグを修正しました。
 ・ACTのサンプル設定で「AcU」と入力したとき「あc」ではなく「あk」で辞書検索するようになります。

・Windows8以降のタッチキーボードでCtrl+次頁またはCtrl+前頁を押したとき「次頁」や「前頁」という文字列が入力されないようにしました。
  • Loading branch information
nathancorvussolis committed Nov 20, 2014
1 parent 0b29ed1 commit b6a4f14
Show file tree
Hide file tree
Showing 19 changed files with 399 additions and 287 deletions.
2 changes: 1 addition & 1 deletion CorvusSKK.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Express 2013 for Windows Desktop
VisualStudioVersion = 12.0.30723.0
VisualStudioVersion = 12.0.31101.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "installer", "installer\installer.vcxproj", "{C65505E2-5456-473C-91B1-C6D91B294DC3}"
ProjectSection(ProjectDependencies) = postProject
Expand Down
6 changes: 3 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.11"
#define TEXTSERVICE_VER L"1.7.12"

#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.11"
#define RC_VERSION_D 1,7,11,0
#define RC_VERSION "1.7.12"
#define RC_VERSION_D 1,7,12,0

#define MAX_KRNLOBJNAME 256
#define CONV_POINT_NUM 256
Expand Down
6 changes: 3 additions & 3 deletions imcrvcnf/PropertyConfDictionary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ void LoadSKKDicAdd(SKKDIC &skkdic, const std::wstring &key, const std::wstring &
}
else
{
bool hit = false;
bool exist = false;
FORWARD_ITERATION_I(sc_itr, skkdic_itr->second)
{
if(sc_itr->first == candidate)
Expand All @@ -107,11 +107,11 @@ void LoadSKKDicAdd(SKKDIC &skkdic, const std::wstring &key, const std::wstring &
sc_itr->second.assign(MakeConcat(annotation_esc));
}
}
hit = true;
exist = true;
break;
}
}
if(!hit)
if(!exist)
{
skkdic_itr->second.push_back(SKKDICCANDIDATE(candidate, MakeConcat(annotation_seps)));
}
Expand Down
20 changes: 2 additions & 18 deletions imcrvcnf/convtable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,25 +64,9 @@ const ROMAN_KANA_CONV roman_kana_conv_default[ROMAN_KANA_TBL_DEF_NUM] =
{L"fya", L"ふゃ", L"フャ", L"フャ"}, {L"fyi", L"ふぃ", L"フィ", L"フィ"}, {L"fyu", L"ふゅ", L"フュ", L"フュ"}, {L"fye", L"ふぇ", L"フェ", L"フェ"}, {L"fyo", L"ふょ", L"フョ", L"フョ"},
{L"hwya", L"ふゃ", L"フャ", L"フャ"}, {L"hwyi", L"ふぃ", L"フィ", L"フィ"}, {L"hwyu", L"ふゅ", L"フュ", L"フュ"}, {L"hwye", L"ふぇ", L"フェ", L"フェ"}, {L"hwyo", L"ふょ", L"フョ", L"フョ"},

{L"n", L"", L"", L""},
{L"nn", L"", L"", L""},
{L"n'", L"", L"", L""},
{L"nb", L"", L"", L"", TRUE},
{L"nc", L"", L"", L"", TRUE},
{L"nd", L"", L"", L"", TRUE},
{L"nf", L"", L"", L"", TRUE},
{L"ng", L"", L"", L"", TRUE},
{L"nh", L"", L"", L"", TRUE},
{L"nj", L"", L"", L"", TRUE},
{L"nk", L"", L"", L"", TRUE},
{L"nm", L"", L"", L"", TRUE},
{L"np", L"", L"", L"", TRUE},
{L"nr", L"", L"", L"", TRUE},
{L"ns", L"", L"", L"", TRUE},
{L"nt", L"", L"", L"", TRUE},
{L"nv", L"", L"", L"", TRUE},
{L"nw", L"", L"", L"", TRUE},
{L"nx", L"", L"", L"", TRUE},
{L"nz", L"", L"", L"", TRUE},

{L"mb", L"", L"", L"", TRUE},
{L"mm", L"", L"", L"", TRUE},
Expand All @@ -104,8 +88,8 @@ const ROMAN_KANA_CONV roman_kana_conv_default[ROMAN_KANA_TBL_DEF_NUM] =
{L"tt", L"", L"", L"", TRUE},
{L"vv", L"", L"", L"", TRUE},
{L"ww", L"", L"", L"", TRUE},
{L"yy", L"", L"", L"", TRUE},
{L"xx", L"", L"", L"", TRUE},
{L"yy", L"", L"", L"", TRUE},
{L"zz", L"", L"", L"", TRUE},

{L"xa", L"", L"", L""},
Expand Down
12 changes: 6 additions & 6 deletions imcrvmgr/SearchUserDictionary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,16 +369,16 @@ BOOL LoadSKKUserDic()
{
FORWARD_ITERATION_I(sc_itr1, so_itr1->second)
{
bool hit = false;
bool exist = false;
FORWARD_ITERATION_I(sc_itr, so_itr->second)
{
if(sc_itr->first == sc_itr1->first)
{
hit = true;
exist = true;
break;
}
}
if(!hit)
if(!exist)
{
so_itr->second.push_back(*sc_itr1);
}
Expand All @@ -397,16 +397,16 @@ BOOL LoadSKKUserDic()
{
FORWARD_ITERATION(sc_itr, so_itr->second)
{
bool hit = false;
bool exist = false;
REVERSE_ITERATION_I(sc_ritr, sc)
{
if(sc_itr->first == sc_ritr->first)
{
hit = true;
exist = true;
break;
}
}
if(!hit)
if(!exist)
{
sc_itr = so_itr->second.erase(sc_itr);
}
Expand Down
132 changes: 120 additions & 12 deletions imcrvtip/FnConfigure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -576,8 +576,12 @@ void CTextService::_LoadConvPoint()
{
APPDATAXMLLIST list;
int i = 0;
CONV_POINT cp;

ZeroMemory(conv_point, sizeof(conv_point));
conv_point_s.clear();
conv_point_s.shrink_to_fit();
conv_point_a.clear();
conv_point_a.shrink_to_fit();

if(ReadList(pathconfigxml, SectionConvPoint, list) == S_OK && list.size() != 0)
{
Expand All @@ -588,22 +592,40 @@ void CTextService::_LoadConvPoint()
break;
}

ZeroMemory(&cp, sizeof(cp));

FORWARD_ITERATION_I(r_itr, *l_itr)
{
if(r_itr->first == AttributeCPStart)
{
conv_point[i][0] = r_itr->second.c_str()[0];
cp.ch[0] = r_itr->second.c_str()[0];
}
else if(r_itr->first == AttributeCPAlter)
{
conv_point[i][1] = r_itr->second.c_str()[0];
cp.ch[1] = r_itr->second.c_str()[0];
}
else if(r_itr->first == AttributeCPOkuri)
{
conv_point[i][2] = r_itr->second.c_str()[0];
cp.ch[2] = r_itr->second.c_str()[0];
}
}

auto vs_itr = std::lower_bound(conv_point_s.begin(), conv_point_s.end(),
cp.ch[0], [] (CONV_POINT m, WCHAR v) { return (m.ch[0] < v); });

if(vs_itr == conv_point_s.end() || cp.ch[0] != vs_itr->ch[0])
{
conv_point_s.insert(vs_itr, cp);
}

auto va_itr = std::lower_bound(conv_point_a.begin(), conv_point_a.end(),
cp.ch[1], [] (CONV_POINT m, WCHAR v) { return (m.ch[1] < v); });

if(va_itr == conv_point_a.end() || cp.ch[1] != va_itr->ch[1])
{
conv_point_a.insert(va_itr, cp);
}

i++;
}
}
Expand All @@ -619,8 +641,10 @@ void CTextService::_LoadKana()
std::wregex re(L"[\\x00-\\x19]");
std::wstring fmt(L"");

roman_kana_conv.clear();
roman_kana_conv.shrink_to_fit();
roman_kana_tree.ch = L'\0';
ZeroMemory(&roman_kana_tree.conv, sizeof(roman_kana_tree.conv));
roman_kana_tree.nodes.clear();
roman_kana_tree.nodes.shrink_to_fit();

if(ReadList(pathconfigxml, SectionKana, list) == S_OK && list.size() != 0)
{
Expand Down Expand Up @@ -669,12 +693,84 @@ void CTextService::_LoadKana()
}
}

roman_kana_conv.push_back(rkc);
_AddKanaTree(roman_kana_tree, rkc, 0);

i++;
}
}
}

BOOL CTextService::_AddKanaTree(ROMAN_KANA_NODE &tree, ROMAN_KANA_CONV rkc, int depth)
{
BOOL added = FALSE;

if((_countof(rkc.roman) <= depth) || (rkc.roman[depth] == L'\0'))
{
return FALSE;
}

auto v_itr = std::lower_bound(tree.nodes.begin(), tree.nodes.end(),
rkc.roman[depth], [] (ROMAN_KANA_NODE m, WCHAR v) { return (m.ch < v); });

if(v_itr != tree.nodes.end() && v_itr->ch == rkc.roman[depth])
{
if(rkc.roman[depth + 1] == L'\0')
{
if(v_itr->conv.roman[0] == L'\0')
{
//ローマ字探索最後のノードにローマ字仮名変換がなければ更新
v_itr->conv = rkc;
}
added = TRUE;
}
else
{
//子ノードを探索
added = _AddKanaTree(*v_itr, rkc, depth + 1);
}
}

if(!added)
{
//子ノードを追加
_AddKanaTreeItem(tree, rkc, depth);
added = TRUE;
}

return added;
}

void CTextService::_AddKanaTreeItem(ROMAN_KANA_NODE &tree, ROMAN_KANA_CONV rkc, int depth)
{
ROMAN_KANA_NODE rkn;

ZeroMemory(&rkn, sizeof(rkn));

if((_countof(rkc.roman) <= depth) || (rkc.roman[depth] == L'\0'))
{
return;
}

rkn.ch = rkc.roman[depth];

auto v_itr = std::lower_bound(tree.nodes.begin(), tree.nodes.end(),
rkn.ch, [] (ROMAN_KANA_NODE m, WCHAR v) { return (m.ch < v); });

if(rkc.roman[depth + 1] == L'\0')
{
//ローマ字探索最後のノードにローマ字仮名変換ありの子ノードを追加
rkn.conv = rkc;
tree.nodes.insert(v_itr, rkn);
}
else
{
//ローマ字探索途中のノードに探索対象のローマ字のみの子ノードを追加
v_itr = tree.nodes.insert(v_itr, rkn);
//子ノードを探索
_AddKanaTreeItem(*v_itr, rkc, depth + 1);
}
}

void CTextService::_LoadJLatin()
{
APPDATAXMLLIST list;
Expand All @@ -683,8 +779,10 @@ void CTextService::_LoadJLatin()
size_t blen = 0;
std::wregex re(L"[\\x00-\\x19]");
std::wstring fmt(L"");
ASCII_JLATIN_CONV ajc;

ZeroMemory(ascii_jlatin_conv, sizeof(ascii_jlatin_conv));
ascii_jlatin_conv.clear();
ascii_jlatin_conv.shrink_to_fit();

if(ReadList(pathconfigxml, SectionJLatin, list) == S_OK && list.size() != 0)
{
Expand All @@ -695,19 +793,21 @@ void CTextService::_LoadJLatin()
break;
}

ZeroMemory(&ajc, sizeof(ajc));

FORWARD_ITERATION_I(r_itr, *l_itr)
{
pszb = NULL;

if(r_itr->first == AttributeLatin)
{
pszb = ascii_jlatin_conv[i].ascii;
blen = _countof(ascii_jlatin_conv[i].ascii);
pszb = ajc.ascii;
blen = _countof(ajc.ascii);
}
else if(r_itr->first == AttributeJLatin)
{
pszb = ascii_jlatin_conv[i].jlatin;
blen = _countof(ascii_jlatin_conv[i].jlatin);
pszb = ajc.jlatin;
blen = _countof(ajc.jlatin);
}

if(pszb != NULL)
Expand All @@ -716,6 +816,14 @@ void CTextService::_LoadJLatin()
}
}

auto v_itr = std::lower_bound(ascii_jlatin_conv.begin(), ascii_jlatin_conv.end(),
ajc.ascii[0], [] (ASCII_JLATIN_CONV m, WCHAR v) { return (m.ascii[0] < v); });

if(v_itr == ascii_jlatin_conv.end() || ajc.ascii[0] != v_itr->ascii[0])
{
ascii_jlatin_conv.insert(v_itr, ajc);
}

i++;
}
}
Expand Down
Loading

0 comments on commit b6a4f14

Please sign in to comment.