Skip to content

Commit

Permalink
ts.Language を削除
Browse files Browse the repository at this point in the history
- ttxkanjimenu 日本語/韓国語を切り替えられるようにした
- "/LA" コマンドを削除
  • Loading branch information
zmatsuo committed Sep 9, 2024
1 parent a0dcdf2 commit aad1621
Show file tree
Hide file tree
Showing 19 changed files with 325 additions and 486 deletions.
51 changes: 38 additions & 13 deletions TTXKanjiMenu/ttxkanjimenu.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@
#define IniSection "TTXKanjiMenu"
#define ORDER 5000

#define ID_MI_KANJIRECV 54010 // 受信/送受
#define ID_MI_KANJISEND 54110 // 送信
#define ID_MI_USEONESETTING 54200 // Use one setting
#define ID_MI_KANJIRECV 54010 // 受信/送受
#define ID_MI_KANJISEND 54110 // 送信
#define ID_MI_USEONESETTING 54200 // Use one setting
#define ID_MI_JAPANESE 54201 // 日本語メニュー
#define ID_MI_KOREAN 54202 // 韓国語メニュー

// メニュー項目名の情報
typedef struct {
Expand All @@ -53,6 +55,8 @@ static const MenuInfo MenuNameRecvJ[] = {
{ ID_MI_KANJISEND + 3, IdUTF8, L"Send: U&TF-8", "MENU_SEND_UTF8" },
{ 0, 0, NULL, NULL },
{ ID_MI_USEONESETTING, 0, L"Use &one setting", "MENU_USE_ONE_SETTING" },
{ 0, 0, NULL, NULL },
{ ID_MI_KOREAN, 0, L"Korean menu", NULL },
};

// 送受同漢字コード (日本語)
Expand All @@ -63,6 +67,8 @@ static const MenuInfo MenuNameOneJ[] = {
{ ID_MI_KANJIRECV + 3, IdUTF8, L"Recv/Send: &UTF-8", "MENU_UTF8" },
{ 0, 0, NULL, NULL },
{ ID_MI_USEONESETTING, 0, L"Use &one setting", "MENU_USE_ONE_SETTING" },
{ 0, 0, NULL, NULL },
{ ID_MI_KOREAN, 0, L"Korean menu", NULL },
};

// 送受別漢字コード (韓国語)
Expand All @@ -74,6 +80,8 @@ static const MenuInfo MenuNameRecvK[] = {
{ ID_MI_KANJISEND + 1, IdUTF8, L"Send: U&TF-8", "MENU_SEND_UTF8" },
{ 0, 0, NULL, NULL },
{ ID_MI_USEONESETTING, 0, L"Use &one setting", "MENU_USE_ONE_SETTING" },
{ 0, 0, NULL, NULL },
{ ID_MI_JAPANESE, 0, L"Japanese menu", NULL },
};

// 送受同漢字コード (韓国語)
Expand All @@ -82,6 +90,8 @@ static const MenuInfo MenuNameOneK[] = {
{ ID_MI_KANJIRECV + 1, IdUTF8, L"Recv/Send: &UTF-8", "MENU_UTF8" },
{ 0, 0, NULL, NULL },
{ ID_MI_USEONESETTING, 0, L"Use &one setting", "MENU_USE_ONE_SETTING" },
{ 0, 0, NULL, NULL },
{ ID_MI_JAPANESE, 0, L"Japanese menu", NULL },
};

static HANDLE hInst; /* Instance handle of TTX*.DLL */
Expand All @@ -95,6 +105,10 @@ typedef struct {
PWriteIniFile origWriteIniFile;
BOOL UseOneSetting;
BOOL NeedResetCharSet;
enum {
MENU_JAPANESE,
MENU_KOREAN,
} language;
const MenuInfo *menu_info_ptr;
size_t menu_info_count;
} TInstVar;
Expand Down Expand Up @@ -274,7 +288,7 @@ static void PASCAL TTXGetUIHooks(TTXUIHooks *hooks) {
// 内部状態リセットの為に呼び出された場合
*hooks->SetupTerminal = ResetCharSet;
}
else if (pvar->UseOneSetting && (pvar->ts->Language == IdJapanese || pvar->ts->Language == IdKorean)) {
else if (pvar->UseOneSetting && (pvar->language == MENU_JAPANESE || pvar->language == MENU_KOREAN)) {
// UseOneSetting が TRUE の時は端末設定ダイアログの後処理の為にフックする
pvar->origSetupTermDlg = *hooks->SetupTerminal;
*hooks->SetupTerminal = TTXKanjiMenuSetupTerminal;
Expand Down Expand Up @@ -306,9 +320,9 @@ static void PASCAL TTXKanjiMenuReadIniFile(const wchar_t *fn, PTTSet ts) {
else {
pvar->UseOneSetting = TRUE;
// UseOneSetting が on の場合は、送受信設定が同じになるように調整する
switch (pvar->ts->Language){
case IdJapanese:
case IdKorean:
switch (pvar->language){
case MENU_JAPANESE:
case MENU_KOREAN:
pvar->ts->KanjiCodeSend = pvar->ts->KanjiCode;
break;
}
Expand Down Expand Up @@ -353,8 +367,8 @@ static void UpdateMenu(HMENU menu, BOOL UseOneSetting)
const MenuInfo *menu_info_ptr;
size_t menu_info_count;

switch (pvar->ts->Language) {
case IdJapanese:
switch (pvar->language) {
case MENU_JAPANESE:
if (UseOneSetting) {
menu_info_ptr = MenuNameOneJ;
menu_info_count = _countof(MenuNameOneJ);
Expand All @@ -364,7 +378,7 @@ static void UpdateMenu(HMENU menu, BOOL UseOneSetting)
menu_info_count = _countof(MenuNameRecvJ);
}
break;
case IdKorean:
case MENU_KOREAN:
if (UseOneSetting) {
menu_info_ptr = MenuNameOneK;
menu_info_count = _countof(MenuNameOneK);
Expand Down Expand Up @@ -393,16 +407,16 @@ static void PASCAL TTXModifyMenu(HMENU menu)
MENUITEMINFOW mi = {0};
wchar_t *uimsg;
// 言語が日本語または韓国語の時のみメニューに追加する
if (pvar->ts->Language != IdJapanese && pvar->ts->Language != IdKorean) {
if (pvar->language != MENU_JAPANESE && pvar->language != MENU_KOREAN) {
return;
}

pvar->hmEncode = CreateMenu();

if (pvar->ts->Language == IdJapanese) {
if (pvar->language == MENU_JAPANESE) {
GetI18nStrWW(IniSection, "MENU_KANJI", L"&KanjiCode", pvar->ts->UILanguageFileW, &uimsg);
}
else { // IdKorean
else { // MENU_KOREAN
GetI18nStrWW(IniSection, "MENU_KANJI_K", L"Coding(&K)", pvar->ts->UILanguageFileW, &uimsg);
}

Expand Down Expand Up @@ -498,6 +512,16 @@ static int PASCAL TTXProcessCommand(HWND hWin, WORD cmd) {
UpdateMenu(pvar->hmEncode, pvar->UseOneSetting);
return 1;
}
else if (cmd == ID_MI_KOREAN) {
DeleteMenus(pvar->hmEncode);
pvar->language = MENU_KOREAN;
UpdateMenu(pvar->hmEncode, pvar->UseOneSetting);
}
else if (cmd == ID_MI_JAPANESE) {
DeleteMenus(pvar->hmEncode);
pvar->language = MENU_JAPANESE;
UpdateMenu(pvar->hmEncode, pvar->UseOneSetting);
}

return 0;
}
Expand Down Expand Up @@ -564,6 +588,7 @@ BOOL WINAPI DllMain(HANDLE hInstance,
/* do process initialization */
hInst = hInstance;
pvar = &InstVar;
pvar->language = MENU_JAPANESE;
break;
case DLL_PROCESS_DETACH:
/* do process cleanup */
Expand Down
5 changes: 3 additions & 2 deletions doc/en/html/about/history.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ <h3 id="teraterm_5.4">YYYY.MM.DD (Ver 5.4 not released yet)</h3>
<ul>
<li>changed to use transmit character code when sending clipboard (OSC 52).<br>
Before fix, when transmit character code is not UTF-8, it used ACP.</li>
<li>Remove /LA command line options because language mode was removed</li>
</ul>
</li>

Expand Down Expand Up @@ -2079,12 +2080,12 @@ <h3 id="teraterm_4.63">2009.7.5 (Ver 4.63)</h3>
<li>Changed the BroadcastCommand functional specification. When the BroadcastCommand is not the real-time mode, a user can send a message at the selected window in the list box.</li>
<li>added UTF-8 language
<ul>
<li>added the <a href="../commandline/teraterm.html#la">/LA</a> command line option for <a href="../menu/setup-general.html">language mode</a> specification.</li>
<li>added the /LA command line option for <a href="../menu/setup-general.html">language mode</a> specification.</li>
</ul></li>
<li>In UTF-8 transmission mode, when the input character is recognized as invalid character, Tera Term sends the Replacement Character(U+FFFD).</li>
<li>changed Korean language implementation
<ul>
<li>added support for Korean mode with <a href="../commandline/teraterm.html#la">/LA</a> command line option, which specifies the <a href="../menu/setup-general.html">language mode</a>.</li>
<li>added support for Korean mode with /LA command line option, which specifies the <a href="../menu/setup-general.html">language mode</a>.</li>
<li>added support for the IME in-line conversion.</li>
<li>added the `UTF-8m' selection for the receiving character code.</li>
<li>added the KS5601 at the KanjiSend and KanjiReceive entry in the teraterm.ini file.</li>
Expand Down
12 changes: 1 addition & 11 deletions doc/en/html/commandline/teraterm.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ <h1>Tera Term command line</h1>
[/F=&lt;setup file&gt;] [/FD=&lt;file transfer directory&gt;]
[/H] [/I] [/K=&lt;keyboard setup file&gt;]
[/KR=&lt;kanji code (receive)&gt;] [/KT=&lt;kanji code (transmit)&gt;]
[/L=&lt;log file&gt;] [/LA=&lt;language&gt;] [/M=&lt;macro file&gt;] [/NOLOG]
[/L=&lt;log file&gt;] [/M=&lt;macro file&gt;] [/NOLOG]
[/P=&lt;TCP port#&gt;] [/R=&lt;replay file&gt;] [/SPEED=&lt;speed&gt;] [/T=&lt;telnet flag&gt;]
[/TEKICON=&lt;icon name&gt;] [/TIMEOUT=&lt;connecting timeout value&gt;]
[/V] [/VTICON=&lt;icon name&gt;] [/W="&lt;window title&gt;"] [/WAITCOM]
Expand Down Expand Up @@ -194,16 +194,6 @@ <h2 id="options">Options</h2>
File name can include <a href="../menu/setup-additional-log.html#LogFileNameFormat">formats of Tera Term and strftime</a>.<br />
If this value is not a full path, file name is <a href="../menu/setup-additional-log.html#LogFullpath">converted to fullpath</a> before open.</dd>

<dt id="la">/LA=&lt;language&gt;</dt>
<dd>Language mode.
<ul>
<li><span class="syntax">/LA=E</span> English</li>
<li><span class="syntax">/LA=J</span> Japanese</li>
<li><span class="syntax">/LA=K</span> Korean</li>
<li><span class="syntax">/LA=R</span> Russian</li>
<li><span class="syntax">/LA=U</span> UTF-8</li>
</ul></dd>

<dt id="m">/M=&lt;macro file&gt;</dt>
<dd>Start Tera Term with macro.<br>
If this value is not a full path, it is understood as a relative path from %APPDATA%\teraterm5\.</dd>
Expand Down
5 changes: 3 additions & 2 deletions doc/ja/html/about/history.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ <h3 id="teraterm_5.4">YYYY.MM.DD (Ver 5.4 not released yet)</h3>
<ul>
<li>クリップボードの送信(OSC 52)時、送信文字コードで送信するように変更した<br>
修正前はUTF-8 以外の時、ACPで送信していた。</li>
<li>言語モードを削除したため /LA コマンドラインオプションを削除した</li>
</ul>
</li>

Expand Down Expand Up @@ -2078,12 +2079,12 @@ <h3 id="teraterm_4.63">2009.7.5 (Ver 4.63)</h3>
<li>BroadcastCommand(非Realtime mode)において、リストボックスで選択された端末に対してのみ、メッセージを送信するようにした。</li>
<li>UTF-8モードを追加
<ul>
<li><a href="../menu/setup-general.html">言語モード</a>を指定する <a href="../commandline/teraterm.html#la">/LA</a> コマンドラインオプションで、UTF-8モードを指定できるようにした。</li>
<li><a href="../menu/setup-general.html">言語モード</a>を指定する /LA コマンドラインオプションで、UTF-8モードを指定できるようにした。</li>
</ul></li>
<li>送信漢字コードの設定がUTF-8の時、入力された文字がUTF-8に変換出来ない場合(不正な文字)は代わりにReplacement Character(U+FFFD)を送信するようにした。</li>
<li>韓国語モードの調整
<ul>
<li><a href="../menu/setup-general.html">言語モード</a>を指定する <a href="../commandline/teraterm.html#la">/LA</a> コマンドラインオプションで、韓国語モードを指定できるようにした。</li>
<li><a href="../menu/setup-general.html">言語モード</a>を指定する /LA コマンドラインオプションで、韓国語モードを指定できるようにした。</li>
<li>IMEのインライン変換を韓国語モードでも行えるようにした。</li>
<li>受信文字コードの選択肢に UTF-8m を追加した。</li>
<li>teraterm.iniのKanjiSend/KanjiReceiveエントリで、KS5601を受け付けるようにした。</li>
Expand Down
12 changes: 1 addition & 11 deletions doc/ja/html/commandline/teraterm.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
[/F=&lt;setup file&gt;] [/FD=&lt;file transfer directory&gt;]
[/H] [/I] [/K=&lt;keyboard setup file&gt;]
[/KR=&lt;kanji code (receive)&gt;] [/KT=&lt;kanji code (transmit)&gt;]
[/L=&lt;log file&gt;] [/LA=&lt;language&gt;] [/M=&lt;macro file&gt;] [/NOLOG]
[/L=&lt;log file&gt;] [/M=&lt;macro file&gt;] [/NOLOG]
[/P=&lt;TCP port#&gt;] [/R=&lt;replay file&gt;] [/SPEED=&lt;speed&gt;] [/T=&lt;telnet flag&gt;]
[/TEKICON=&lt;icon name&gt;] [/TIMEOUT=&lt;connecting timeout value&gt;]
[/V] [/VTICON=&lt;icon name&gt;] [/W="&lt;window title&gt;"] [/WAITCOM]
Expand Down Expand Up @@ -195,16 +195,6 @@
ファイル名に含まれた<a href="../menu/setup-additional-log.html#LogFileNameFormat">Tera Term と strftime の書式</a>が解釈されます。<br />
ファイル名がフルパスでないときは、<a href="../menu/setup-additional-log.html#LogFullpath">フルパスに変換</a>して開かれます。</dd>

<dt id="la">/LA=&lt;language&gt;</dt>
<dd>言語モード
<ul>
<li><span class="syntax">/LA=E</span> 英語</li>
<li><span class="syntax">/LA=J</span> 日本語</li>
<li><span class="syntax">/LA=K</span> 韓国語</li>
<li><span class="syntax">/LA=R</span> ロシア語</li>
<li><span class="syntax">/LA=U</span> UTF-8</li>
</ul></dd>

<dt id="m">/M=&lt;macro file&gt;</dt>
<dd>起動時にマクロを実行<br>
ファイル名が絶対パスでないときは、%APPDATA%\teraterm5\ からの相対パスと見なされます。</dd>
Expand Down
Loading

0 comments on commit aad1621

Please sign in to comment.