//#拡張子連動文字コード つくったひと:20000718 /* 内容 ・拡張子に連動して漢字コード設定 */ /* 履歴 20000718 */ #include "_idmcmd.h" #include void __pluginGetProperty(mchar* prop,txstr res) { if (!stricmp(prop,"name")) res = "拡張子連動文字コード"; if (!stricmp(prop,"author")) res = "m.ohta"; if (!stricmp(prop,"version")) res = "0.01"; } BOOL EUC2SJIS(TX* text) { //全部変換 BOOL bChange = FALSE; txJumpFileTop(text); while(!txIsCurEof(text)) { unsigned char ch = txGetChar(text); if (ch == 0x8E) { txDeleteChar(text); txRight(text); bChange = TRUE; continue; } if (ch>=0xA1 && ch<=0xDE) { unsigned char c = ch & 0x7f; c = ((c - 0x21) >> 1) + 0x81; if (c > 0x9f) c += 0x40; txDeleteChar(text); txInsertChar(text,c); c = txGetChar(text); c = c & 0x7f; c += (ch & 1) ? 0x1f : 0x7d; if (c >= 0x7f) c++; txDeleteChar(text); txInsertChar(text,c); bChange = TRUE; continue; } txRight(text); } return bChange; } //起動時イベント void __on_txFrameNew(TX* text) { char *lc, *lcExt; lc = text->szfilename; while (*(++lc) != '\0') { if (*lc == '.') lcExt = lc+1; } if (lcExt) { if (strcmp(lcExt, "cgi") == 0) { if (text->kcSave == KC_SJIS) { text->kcSave = KC_EUC; txSetUndispEx(text); txSetHigh(text); BOOL bChange = EUC2SJIS(text); txResetHigh(text); txSetDispEx(text); if (bChange) statprintf("SJISからEUCに変更してみました"); } } } }