Revision: 8482 https://osdn.net/projects/ttssh2/scm/svn/commits/8482 Author: doda Date: 2020-01-18 03:15:05 +0900 (Sat, 18 Jan 2020) Log Message: ----------- コードの細かい修正。外から見える動作の変更等は無し。 ・インデントを調整 ・行末の空白を削除 ・コメントの追加&整理 ・不要な PASCAL 呼出規約指定を削除 ・内部状態リセットの為の端末設定ダイアログ呼び出しを関数にまとめた Modified Paths: -------------- trunk/TTXKanjiMenu/ttxkanjimenu.c -------------- next part -------------- Modified: trunk/TTXKanjiMenu/ttxkanjimenu.c =================================================================== --- trunk/TTXKanjiMenu/ttxkanjimenu.c 2020-01-17 07:02:51 UTC (rev 8481) +++ trunk/TTXKanjiMenu/ttxkanjimenu.c 2020-01-17 18:15:05 UTC (rev 8482) @@ -1,7 +1,7 @@ /* * TTX KanjiMenu Plugin * Copyright (C) 2007 Sunao HARA (naoh****@nagoy*****) - * (C) 2007-2009 TeraTerm Project + * (C) 2007-2020 TeraTerm Project */ //// ORIGINAL SOURCE CODE: ttxtest.c @@ -8,7 +8,7 @@ /* Tera Term extension mechanism Robert O'Callahan (roc+t****@cs*****) - + Tera Term by Takashi Teranishi (teran****@rikax*****) */ @@ -70,6 +70,11 @@ pvar->NeedResetCharSet = FALSE; } +/* + * \x92[\x96\x96\x90ݒ\xE8\x83_\x83C\x83A\x83\x8D\x83O\x82̃t\x83b\x83N\x8A\x941: UseOneSetting \x97p + * + * \x91\x97\x90M\x82Ǝ\xF3\x90M\x82̊\xBF\x8E\x9A\x83R\x81[\x83h\x90ݒ肪\x93\xAF\x82\xB6\x82ɂȂ\xE9\x82悤\x82ɒ\xB2\x90\xAE\x82\xB7\x82\xE9\x81B + */ static BOOL PASCAL TTXKanjiMenuSetupTerminal(HWND parent, PTTSet ts) { WORD orgRecvCode, orgSendCode; BOOL ret; @@ -101,6 +106,12 @@ return ret; } +/* + * \x92[\x96\x96\x90ݒ\xE8\x83_\x83C\x83A\x83\x8D\x83O\x82̃t\x83b\x83N\x8A\x942: \x93\xE0\x95\x94\x8F\xF3\x91ԃ\x8A\x83Z\x83b\x83g\x97p + * + * \x92[\x96\x96\x90ݒ\xE8\x83_\x83C\x83A\x83\x8D\x83O\x82\xF0\x83t\x83b\x83N\x82\xB5\x81A\x90ݒ\xE8\x83_\x83C\x83A\x83\x8D\x83O\x82\xF0\x8AJ\x82\xA9\x82\xB8\x82\xC9 TRUE \x82\xF0\x95Ԃ\xB7\x8E\x96\x82ɂ\xE6\x82\xC1\x82\xC4 + * \x90ݒ\xE8\x83_\x83C\x83A\x83\x8D\x83O\x8Cďo\x82̌㏈\x97\x9D\x82݂̂𗘗p\x82\xB7\x82\xE9\x81B + */ static BOOL PASCAL ResetCharSet(HWND parent, PTTSet ts) { pvar->NeedResetCharSet = FALSE; return TRUE; @@ -108,14 +119,25 @@ static void PASCAL TTXGetUIHooks(TTXUIHooks *hooks) { if (pvar->NeedResetCharSet) { + // \x93\xE0\x95\x94\x8F\xF3\x91ԃ\x8A\x83Z\x83b\x83g\x82ׂ̈ɌĂяo\x82\xB3\x82ꂽ\x8Fꍇ *hooks->SetupTerminal = ResetCharSet; } else if (pvar->UseOneSetting && (pvar->ts->Language == IdJapanese || pvar->ts->Language == IdKorean)) { + // UseOneSetting \x82\xAA TRUE \x82̎\x9E\x82͒[\x96\x96\x90ݒ\xE8\x83_\x83C\x83A\x83\x8D\x83O\x82̌㏈\x97\x9D\x82ׂ̈Ƀt\x83b\x83N\x82\xB7\x82\xE9 pvar->origSetupTermDlg = *hooks->SetupTerminal; *hooks->SetupTerminal = TTXKanjiMenuSetupTerminal; } } +/* + * \x8A\xBF\x8E\x9A\x83R\x81[\x83h\x8A֘A\x82̓\xE0\x95\x94\x8F\xF3\x91Ԃ̃\x8A\x83Z\x83b\x83g + * TTX\x82\xA9\x82\xE7\x82\xCDTera Term\x82̓\xE0\x95\x94\x8F\xF3\x91Ԃڂ\xA2\x82\xB6\x82\xEA\x82Ȃ\xA2\x88ׁA\x92[\x96\x96\x90ݒ\xE8\x83_\x83C\x83A\x83\x8D\x83O\x82̌㏈\x97\x9D\x82𗘗p\x82\xB7\x82\xE9\x81B + */ +static void CallResetCharSet(HWND hWin){ + pvar->NeedResetCharSet = TRUE; + SendMessage(hWin, WM_COMMAND, MAKELONG(ID_SETUP_TERMINAL, 0), 0); +} + static void PASCAL TTXKanjiMenuReadIniFile(PCHAR fn, PTTSet ts) { char buff[20]; @@ -159,12 +181,11 @@ *hooks->WriteIniFile = TTXKanjiMenuWriteIniFile; } -// #define ID_MI_KANJIMASK 0xFF00 #define ID_MI_KANJIRECV 54009 #define ID_MI_KANJISEND 54109 #define ID_MI_USEONESETTING 54200 -static void PASCAL InsertSendKcodeMenu(HMENU menu) { +static void InsertSendKcodeMenu(HMENU menu) { UINT flag = MF_BYPOSITION | MF_STRING | MF_CHECKED; if (pvar->ts->Language == IdJapanese) { @@ -171,16 +192,16 @@ InsertMenu(menu, 5, MF_BYPOSITION | MF_SEPARATOR, 0, NULL); GetI18nStr(IniSection, "MENU_SEND_SJIS", pvar->ts->UIMsg, sizeof(pvar->ts->UIMsg), - "Send: S&hift_JIS", pvar->ts->UILanguageFile); + "Send: S&hift_JIS", pvar->ts->UILanguageFile); InsertMenu(menu, 6, flag, ID_MI_KANJISEND+IdSJIS, pvar->ts->UIMsg); GetI18nStr(IniSection, "MENU_SEND_EUCJP", pvar->ts->UIMsg, sizeof(pvar->ts->UIMsg), - "Send: EU&C-JP", pvar->ts->UILanguageFile); + "Send: EU&C-JP", pvar->ts->UILanguageFile); InsertMenu(menu, 7, flag, ID_MI_KANJISEND+IdEUC, pvar->ts->UIMsg); GetI18nStr(IniSection, "MENU_SEND_JIS", pvar->ts->UIMsg, sizeof(pvar->ts->UIMsg), - "Send: J&IS", pvar->ts->UILanguageFile); + "Send: J&IS", pvar->ts->UILanguageFile); InsertMenu(menu, 8, flag, ID_MI_KANJISEND+IdJIS, pvar->ts->UIMsg); GetI18nStr(IniSection, "MENU_SEND_UTF8", pvar->ts->UIMsg, sizeof(pvar->ts->UIMsg), - "Send: U&TF-8", pvar->ts->UILanguageFile); + "Send: U&TF-8", pvar->ts->UILanguageFile); InsertMenu(menu, 9, flag, ID_MI_KANJISEND+IdUTF8, pvar->ts->UIMsg); } else { // IdKorean @@ -187,16 +208,16 @@ InsertMenu(menu, 2, MF_BYPOSITION | MF_SEPARATOR, 0, NULL); GetI18nStr(IniSection, "MENU_SEND_KS5601", pvar->ts->UIMsg, sizeof(pvar->ts->UIMsg), - "Send: K&S5601", pvar->ts->UILanguageFile); + "Send: K&S5601", pvar->ts->UILanguageFile); InsertMenu(menu, 3, flag, ID_MI_KANJISEND+IdSJIS, pvar->ts->UIMsg); GetI18nStr(IniSection, "MENU_SEND_UTF8", pvar->ts->UIMsg, sizeof(pvar->ts->UIMsg), - "Send: U&TF-8", pvar->ts->UILanguageFile); + "Send: U&TF-8", pvar->ts->UILanguageFile); InsertMenu(menu, 4, flag, ID_MI_KANJISEND+IdUTF8, pvar->ts->UIMsg); } } -static void PASCAL DeleteSendKcodeMenu(HMENU menu) { +static void DeleteSendKcodeMenu(HMENU menu) { if (pvar->ts->Language == IdJapanese) { DeleteMenu(menu, 5, MF_BYPOSITION); DeleteMenu(menu, 5, MF_BYPOSITION); @@ -211,7 +232,7 @@ } } -static void PASCAL UpdateRecvMenuCaption(HMENU menu, BOOL UseOneSetting) { +static void UpdateRecvMenuCaption(HMENU menu, BOOL UseOneSetting) { if (UseOneSetting) { if (pvar->ts->Language == IdJapanese) { GetI18nStr(IniSection, "MENU_SJIS", pvar->ts->UIMsg, sizeof(pvar->ts->UIMsg), @@ -288,7 +309,7 @@ static void PASCAL TTXModifyMenu(HMENU menu) { UINT flag = MF_ENABLED; - // \x8C\xBE\x8Cꂪ\x93\xFA\x96{\x8C\xEA\x82̂Ƃ\xAB\x82̂݃\x81\x83j\x83\x85\x81[\x82ɒlj\xC1\x82\xB3\x82\xEA\x82\xE9\x82悤\x82ɂ\xB5\x82\xBD\x81B (2007.7.14 maya) + // \x8C\xBE\x8Cꂪ\x93\xFA\x96{\x8C\xEA\x82܂\xBD\x82͊؍\x91\x8C\xEA\x82̎\x9E\x82̂݃\x81\x83j\x83\x85\x81[\x82ɒlj\xC1\x82\xB7\x82\xE9 if (pvar->ts->Language != IdJapanese && pvar->ts->Language != IdKorean) { return; } @@ -324,27 +345,27 @@ flag = MF_STRING|MF_CHECKED; if (pvar->ts->Language == IdJapanese) { GetI18nStr(IniSection, "MENU_RECV_SJIS", pvar->ts->UIMsg, sizeof(pvar->ts->UIMsg), - "Recv: &Shift_JIS", pvar->ts->UILanguageFile); + "Recv: &Shift_JIS", pvar->ts->UILanguageFile); AppendMenu(pvar->hmEncode, flag, ID_MI_KANJIRECV+IdSJIS, pvar->ts->UIMsg); GetI18nStr(IniSection, "MENU_RECV_EUCJP", pvar->ts->UIMsg, sizeof(pvar->ts->UIMsg), - "Recv: &EUC-JP", pvar->ts->UILanguageFile); + "Recv: &EUC-JP", pvar->ts->UILanguageFile); AppendMenu(pvar->hmEncode, flag, ID_MI_KANJIRECV+IdEUC, pvar->ts->UIMsg); GetI18nStr(IniSection, "MENU_RECV_JIS", pvar->ts->UIMsg, sizeof(pvar->ts->UIMsg), - "Recv: &JIS", pvar->ts->UILanguageFile); + "Recv: &JIS", pvar->ts->UILanguageFile); AppendMenu(pvar->hmEncode, flag, ID_MI_KANJIRECV+IdJIS, pvar->ts->UIMsg); GetI18nStr(IniSection, "MENU_RECV_UTF8", pvar->ts->UIMsg, sizeof(pvar->ts->UIMsg), - "Recv: &UTF-8", pvar->ts->UILanguageFile); + "Recv: &UTF-8", pvar->ts->UILanguageFile); AppendMenu(pvar->hmEncode, flag, ID_MI_KANJIRECV+IdUTF8, pvar->ts->UIMsg); GetI18nStr(IniSection, "MENU_RECV_UTF8m", pvar->ts->UIMsg, sizeof(pvar->ts->UIMsg), - "Recv: UTF-8&m", pvar->ts->UILanguageFile); + "Recv: UTF-8&m", pvar->ts->UILanguageFile); AppendMenu(pvar->hmEncode, flag, ID_MI_KANJIRECV+IdUTF8m, pvar->ts->UIMsg); } else { // IdKorean GetI18nStr(IniSection, "MENU_RECV_KS5601", pvar->ts->UIMsg, sizeof(pvar->ts->UIMsg), - "Recv: &KS5601", pvar->ts->UILanguageFile); + "Recv: &KS5601", pvar->ts->UILanguageFile); AppendMenu(pvar->hmEncode, flag, ID_MI_KANJIRECV+IdSJIS, pvar->ts->UIMsg); GetI18nStr(IniSection, "MENU_RECV_UTF8", pvar->ts->UIMsg, sizeof(pvar->ts->UIMsg), - "Recv: &UTF-8", pvar->ts->UILanguageFile); + "Recv: &UTF-8", pvar->ts->UILanguageFile); AppendMenu(pvar->hmEncode, flag, ID_MI_KANJIRECV+IdUTF8, pvar->ts->UIMsg); } @@ -390,9 +411,6 @@ WORD val; if ((cmd > ID_MI_KANJIRECV) && (cmd <= ID_MI_KANJIRECV+IdUTF8m)) { - // \x94͈̓`\x83F\x83b\x83N\x82\xF0\x92lj\xC1 - // TTProxy\x82̃o\x81[\x83W\x83\x87\x83\x93\x83_\x83C\x83A\x83\x8D\x83O\x82\xF0\x8AJ\x82\xAD\x82ƁA\x93\x96\x8AY\x83n\x83\x93\x83h\x83\x89\x82\xAA\x8CĂ\xEA\x81A\x8C듮\x8D삵\x82Ă\xA2\x82\xBD\x82̂\xF0\x8FC\x90\xB3\x81B - // (2007.7.13 yutaka) val = cmd - ID_MI_KANJIRECV; pvar->cv->KanjiCodeEcho = pvar->ts->KanjiCode = val; if (pvar->UseOneSetting) { @@ -401,8 +419,7 @@ } pvar->cv->KanjiCodeSend = pvar->ts->KanjiCodeSend = val; } - pvar->NeedResetCharSet = TRUE; - SendMessage(hWin, WM_COMMAND, MAKELONG(ID_SETUP_TERMINAL, 0), 0); + CallResetCharSet(hWin); return UpdateRecvMenu(pvar->ts->KanjiCode)?1:0; } else if ((cmd > ID_MI_KANJISEND) && (cmd <= ID_MI_KANJISEND+IdUTF8)) { @@ -410,13 +427,11 @@ pvar->cv->KanjiCodeSend = pvar->ts->KanjiCodeSend = val; if (pvar->UseOneSetting) { pvar->cv->KanjiCodeEcho = pvar->ts->KanjiCode = val; - pvar->NeedResetCharSet = TRUE; - SendMessage(hWin, WM_COMMAND, MAKELONG(ID_SETUP_TERMINAL, 0), 0); + CallResetCharSet(hWin); return UpdateRecvMenu(pvar->ts->KanjiCode)?1:0; } else { - pvar->NeedResetCharSet = TRUE; - SendMessage(hWin, WM_COMMAND, MAKELONG(ID_SETUP_TERMINAL, 0), 0); + CallResetCharSet(hWin); return UpdateSendMenu(pvar->ts->KanjiCodeSend)?1:0; } } @@ -490,7 +505,7 @@ return TRUE; } -BOOL WINAPI DllMain(HANDLE hInstance, +BOOL WINAPI DllMain(HANDLE hInstance, ULONG ul_reason_for_call, LPVOID lpReserved) { @@ -513,3 +528,5 @@ } return TRUE; } + +/* vim: set ts=4 sw=4 ff=dos : */