This is an old revision of the document!
書式設定切替マクロ
- New QX ではメニューの「その他」に「書式設定一覧」という項目が追加になり、現在選択されているものとは違う書式を読み込む手間がかなりわかりやすく簡単になりましたが、一覧を表示して「読み込み」ボタンを押すという手間がかかります。マクロだとメニューから選択すると同時に書式が切り替わります。
'書式を選択・読込み / Ver. 0.90 for New QX / by kabuneko 2021/03/07
'書式の最大数を30に変更・設定がないものはリストから除外
proc main
if @hwnd = 0 then exit proc
dim i, j, sel, pos, line, top, mode$[32]
'現在のカーソル位置を保存
pos = @BytePosCr
line = @ScrLineToCrLine(@Line)
top = @Line - @TopLine
'現在の書式番号を取得
sel = @StyleNo
'メニュー内容を設定
mode$[1] = "・ 書式選択 ・"
mode$[2] = chr$(1) + "-"
'存在する書式(1-30)をメニューに加える。メニューアイテムは3から開始。
j=3
for i = 1 to 30
if @@StyleComment$(i) <> "" then
mode$[j] = cformat$("&%s.", chr$(j+62)) + " " \
+ @@StyleComment$(i) + " (" + @@StyleName$(i) + ")"
if i = sel then mode$[j] = chr$(2) + mode$[j]
j++
end if
next
'メニューを表示・選択アイテムを実行
sel = popupmenu(mode$)
if 2 < sel and sel < 18 then @StyleNo = sel-2
'カーソル位置復元
@Line = @CrLineToScrLine(line)
@ByteposCr = pos
@TopLine = @Line - top
end proc