//----------------------------------------------------------------------------- // Delmonta's Line Macro for HIDEMARU EDITOR // Copyright (c) 1995 Delmonta //----------------------------------------------------------------------------- // $Id: ds_line.mac 1.3 2003/05/31 08:17:10 delmonta Exp $ //----------------------------------------------------------------------------- //------------------------- 定数・パターン文字列の定義 ------------------------ #Num_type = 7; // パターンの数 // $Type : どのように文を寄せるか // L,C,R == 左寄せ・センタリング・右寄せ(pre/postfixあり) // l,c,r == 左寄せ・センタリング・右寄せ(pre/postfixなし) $Type[1] = "C"; $Type[2] = "L"; $Type[3] = "C"; $Type[4] = "C"; $Type[5] = "C"; $Type[6] = "C"; $Type[7] = "C"; // $Padding : 罫線のパターン(単位の長さで) $Padding[1] = "-"; $Padding[2] = " "; $Padding[3] = " "; $Padding[4] = "*"; $Padding[5] = "- "; $Padding[6] = "─"; $Padding[7] = "━"; // $Pattern : メニューに表示するパターン $Pattern[1] = "-------通常の区切り-------"; $Pattern[2] = "解説部に "; $Pattern[3] = " センタリング "; $Pattern[4] = "****** 大きな区切りに ******"; $Pattern[5] = "- - - HTMLその他用の破線 - - - "; $Pattern[6] = "──── JIS 細線 ────"; $Pattern[7] = "━━━━ JIS 太線 ━━━━"; //------------------------- ファイル名から拡張子を得る ------------------------ $ext = basename; while (strstr($ext,".")>=0) $ext=rightstr($ext, strlen($ext) - (strstr($ext,".")+1) ); $ext = "." + $ext + "."; //--------------------- 拡張子からprefix/postfixを決定する -------------------- $prefix=""; $postfix=""; if (strstr(".c.h.cpp.hpp.cc.hh.css.",$ext)>=0) {$prefix="/*"; $postfix="*/";} else if (strstr(".htm.html.shtml.",$ext)>=0) {$prefix="";} else if ($ext==".pas.") {$prefix="{"; $postfix="}";} else if ($ext==".mac.") $prefix="//"; else if (strstr(".tex.sty.cls.clo.ps.eps",$ext)>=0) $prefix="%"; else if (strstr(".bas.frm.",$ext)>=0) $prefix="'"; else if (strstr( ".sed.v.pl.sh.csh.tcsh.cgi.xsession.htaccess.",$ext)>=0) $prefix="#"; else if (strstr(".ini.asm.a86.def.p86.inc.el.emacs.",$ext)>=0) $prefix=";"; else if (strstr(".bat.cws.",$ext)>=0) $prefix="rem "; else if ($ext==".ntf.") $prefix=".\\"; //--------------------------- メニューを作成して表示 -------------------------- #i = 1; while (#i<=#Num_type) { $a = $Pattern[#i]; if (ascii($Type[#i]) <= ascii("a")) $a = $prefix + $a + $postfix; $menuinfo[#i] = "&"+str(#i)+" ["+$a+"]"; #i = #i+1; } $menuinfo[0] = "線のパターンを選択してください"; menu_again: menuarray $menuinfo,#Num_type+1; if (result==0) endmacro; else if (result==1) #n = 1; else #n = result-1; #unitsize = strlen($Padding[#n]); //----------------------------------- 出力! ----------------------------------- if ( ascii($Type[#n]) >= ascii("a") ) { $prefix = ""; $postfix = ""; } //---------------------------- 空行に線だけ引く場合 --------------------------- if (linelen==0) { insert $prefix; insertfix $postfix; while (strlen($Padding[#n])