//インクリメントナンバー //内容・クリップボードにあるテキストの数値をインクリメントしてペースト //1997/11/29 Masayuki Ohta ///#include <_wz.h> void IncNumLine(tx *text) { int mode; txJumpParaEnd(text); //行末に移動 mode = 0; while (1) { left; IBUFF str=GetChar; // printf("%d\n",str); if (str != '.') { if (str >= '0' && str <= '9') { if (mode < 2) { if (str == '9') { str = '0'; mode = 1; } else { str += 1; mode = 2; } //書き込み DeleteChar; InsertChar(str); left; } } else { if (mode == 1) { right; InsertChar('1'); left; left; } mode = 0; } } if (IsCurParaTop) break; } } void IncNumLoop (tx *text) { jumpfiletop; // while (1) { if (IsCurReturn==0) { IncNumLine(text); } if (!nextpara) break; } } incrementnumber(TX *text) { //##incrementnumber //インクリメントナンバー //内容・クリップボードにあるテキストの数値をインクリメントしてペースト //1997/11/29 Masayuki Ohta //20000525 選択されていたら削除 if (txSelectGetMode(text)) { //選択範囲されていれば txSelectDelete(text); } TX text2; txInitText(&text2); txOpenText(&text2); txPaste(&text2); IncNumLoop(&text2); txSelectAll(&text2); txInsertTextSelect(text, &text2); txSelectAll(&text2); txSelectCopy(&text2); txClose(&text2); } //////////////////////////////////////////////////////////////////// void FullLetter(TX *text, int num) { char szstr[] = "0123456789"; insertchar(szstr[num*2]); insertchar(szstr[num*2+1]); } void FullDayOfWeek(TX *text, int i) { char szstr[] = "日月火水木金土"; insertchar(szstr[i*2]); insertchar(szstr[i*2+1]); } void FullNumber(TX *text, int num) { int i, j = 0; i = 10000; while (i>0) { if (num>=i || j == 1) { FullLetter( text, num/i ); j = 1; } num = num % i; i = i / 10; } } InsertDate { //日記用の日付を挿入 //1997/12/28 Masayuki Ohta char *lc, *lcExt; BOOL bHtml; lc = text->szfilename; lcExt = NULL; while (*(++lc) != '\0') { if (*lc == '.') lcExt = lc+1; } bHtml = FALSE; if (lcExt) { if (strcmp(lcExt, "html") == 0) bHtml = TRUE; } if (bHtml) Insertf("

"); FullNumber( text, timeGetYear() ); Insertf("年"); FullNumber( text, timeGetMonth() ); Insertf("月"); FullNumber( text, timeGetDay() ); Insertf("日("); FullDayOfWeek( text, timeGetDayofWeek() ); Insertf(")"); if (bHtml) Insertf("

"); Insertf("\n"); }