'常駐リストに機能追加 / Ver. 0.80 / by Kabuneko 99/12/28 proc ListCaption '常駐リストで見出し一覧・レベル変更 if @hwnd=0 then exit proc dim i, sel, count, a$, f$, s$ dim set[10], check[10], item$[10], menu$[14] 'カーソル位置を保存 dim line, pos, top line = @Line pos = @BytePos top = @TopLine 'これが初回の実行であるとき、グローバル変数設定 f$ = @Filename$ '★次行末尾の文字列でデフォルト表示見出し設定 1 = ON if @@Global$(f$ + "caption") = "" then @@Global$(f$ + "caption") \ = "1110000000" for i = 1 to 10 if @Caption$(i) = "" then set[i] = 0 else set[i] = 1 item$[i] =@Caption$(i) end if next 'チェックマーク初期化 for i = 1 to 10 check[i] = val(mid$(@@Global$(f$ + "caption"), i, 1)) next 'メニューアイテム設定 menu$[1] = "< 見出し表示 >" menu$[2] = chr$(1) + "-" menu$[13] = chr$(1) + "-" 'オンの見出しにチェックマークをつけてメニュー表示 do while 1 count = 0 for i = 1 to 10 a$ = "" if set[i] = 0 then a$ = chr$(1) elseif check[i] = 1 then a$ = chr$(2) count++ end if menu$[i+2] = a$ + cformat$("%2d.", i) + " " + @Caption$(i) next if count > 0 then menu$[14] = "・更新・" else menu$[14] = chr$(1) + "・更新・" end if '★次行末尾の数字でメニュー位置設定 sel = popupmenu(menu$,100,100) '選択されたらチェックのオン・オフ if sel < 2 then exit proc if sel > 12 then exit do if check[sel-2] = 1 then check[sel-2] = 0 else check[sel-2] = 1 end if loop for i = 1 to 10 if set[i] = 1 and check[i] = 0 then @Caption$(i) = "" s$ = s$ + cformat$("%d", check[i]) next @@Global$(f$ + "caption") = s$ @@ToolListMiscDoc = -1 '強調位置連動オン @@ToolListAutoUpdate = 0 '自動更新オフ @@PrintToolList = -1 '常駐リストを表示 @@ToolListType = 4 'その他リストを表示 @@ListAutoClose = 1 @ListCaption for i = 1 to 10 '無効にしたものを復活 if set[i] = 1 and check[i] = 0 then @Caption$(i) = item$[i] next @Line = line @BytePos = pos @TopLine = top end procproc ShowList 'その他のリスト・一覧を表示 if @hwnd = 0 then exit proc dim i, sel, list, item$[10], s$ '常駐リストの種類取得 list = @@ToolListType '文字列一覧の表示準備 s$ = @@ListUserString$ if s$ = "" then s$ = "[未設定]" else s$ = """" + s$ + """" end if 'メニュー内容設定 i = 1 item$[i++] = "常駐リストで一覧" item$[i++] = chr$(1) + "-" item$[i++] = "見出し" item$[i++] = "マーク" item$[i++] = "関数" item$[i++] = "コメント" item$[i++] = "文字列 " + s$ item$[i++] = "文字列・設定" 'ポップアップメニューを表示 sel = popupmenu(item$) if sel < 3 then exit proc @@ToolListMiscDoc = -1 '強調位置連動オン @@ToolListAutoUpdate = 1 '自動更新オン @@PrintToolList = -1 '常駐リストを表示 @@ToolListType = 4 'その他リストを表示 @@ListAutoClose = 1 '選択結果にしたがって実行 if sel = 3 then @ListCaption elseif sel = 4 then @ListMark elseif sel = 5 then @ListFunction elseif sel = 6 then @ListComment elseif sel = 7 then @ListUser elseif sel = 8 then @ListUserInput 'キャンセルのときは常駐リストの種類復帰 if @@DialogCancel = -1 then @@ToolListType = list exit proc end if end if end procproc DirList 'フォルダリストから移動・開く・保存 dim i, r, sel, sel2, f$, file$, s$, path$, item$[30], item2$[10] '常駐リストでファイルが選択されていなければカレントファイルを基準にする file$ = @@Command$(1) if file$ = "" then if @hwnd = 0 then exit proc file$ = @Pathname$ end if 'ファイルのフルパス名からパスのみを切り出す path$ = left$(file$, inrstr(file$, "\")) '履歴ファイルの指定 f$ = @@QxDirectory$ + "\" + "l_dhist.txt" 'メニューアイテムの設定 i = 1 item$[i++] = "終了" item$[i++] = "-" item$[i++] = path$ + " を追加" '履歴ファイルあれば履歴を読込み(20個まで) if dir$(f$) <> "" then item$[i++] = "-" open f$ for input as #1 do until eof(1) lineinput #1, s$ item$[i++] = s$ if i > 24 then exit do loop close #1 end if 'ポップアップメニューを表示・選択させる sel = popupmenu(item$) if sel < 3 then exit proc '選択したフォルダを最新履歴にして実行 if sel > 4 then path$ = item$[sel] i = 1 item2$[i++] = "終了" item2$[i++] = "-" item2$[i++] = path$ + " を常駐表示" item2$[i++] = path$ + " からファイルを開く" item2$[i++] = path$ + " にこのファイルを保存" sel2 = popupmenu(item2$) if sel2 < 3 or sel2 > 5 then exit proc end if 'フォルダ履歴の書き戻し for i = 5 to 24 if path$ = item$[i] then item$[i] = "" next open f$ for output as #1 item$[4] = path$ for i = 4 to 24 if item$[i] <> "" then print #1, item$[i] next close #1 if sel < 5 then exit proc 'このフォルダを常駐リストで表示 if sel2 = 3 then @@ToolListType = 3 @@ToolListFile$ = path$ + "*.*" 'このフォルダからファイルを開く elseif sel2 = 4 then @@FileOpenDir path$ 'このフォルダにこのファイルを保存 else if @hwnd = 0 then exit proc s$ = inputbox$("《ファイル保存》" + chr$(10) + \ path$ + " に保存します", \ " ◆ フォルダ指定で保存", @FileName$) if s$ = chr$(&H1B) then exit proc r = @SaveAs(path$ + s$) if r = -1 then call msgbox(path$ + s$ + " を保存しました。") end if end procproc OpenFileDir 'このファイルのフォルダから開く dim f$, path$ f$ = @@Command$(1) if f$ = "" then if @hwnd = 0 then exit proc f$ = @PathName$ end if path$ = left$(f$, inrstr(f$, "\")) @@FileOpenDir path$ end procproc ShowFileDir 'このファイルのフォルダを常駐表示 dim f$, path$ f$ = @@Command$(1) if f$ = "" then if @hwnd = 0 then exit proc f$ = @PathName$ end if path$ = left$(f$, inrstr(f$, "\")) @@ToolListType = 3 @@ToolListFile$ = path$ + "*.*" end procproc SaveToFileDir 'このファイルのフォルダに保存 if @hwnd = 0 then exit proc dim r, f$, s$, path$ f$ = @@Command$(1) path$ = left$(f$, inrstr(f$, "\")) s$ = inputbox$("《ファイル保存》" + chr$(10) + \ path$ + " に保存します", \ " ◆ フォルダ指定で保存", @FileName$) if s$ = chr$(&H1B) then exit proc r = @SaveAs(path$ + s$) if r = -1 then call msgbox(path$ + s$ + " を保存しました。") end procproc ChangeFileOrder 'ファイル一覧・並びを変更 dim i dim item$[5] item$[1] = "名前" item$[2] = "拡張子" item$[3] = "日付(古い順)" item$[4] = "日付(新しい順)" item$[5] = "フォルダ" i = popupmenu(item$) if i = 5 then @@ToolListFile$ = left$(@@ToolListFile$, inrstr(@@ToolListFile$, "\")) exit proc else @@OpenDlgSort = i @@ToolListFile$=@@ToolListFile$ end if end procproc ExecMacro '常駐リストからマクロを実行 dim i, j, sel, file$, line$, proc$, item$[30] file$ = @@Command$(1) if file$ = "" or lcase$(right$(file$, 4)) <> ".mac" then call msgbox("マクロファイルが選択されていません") exit proc end if i = 1 open file$ for input as #1 item$[i++] = file$ lineinput #1, line$ if left$(line$, 1) = "'" then item$[i++] = line$ item$[i++] = chr$(1) + "-" : j = i do until eof(1) if lcase$(left$(line$, 5)) = "proc " then item$[i++] = mid$(line$, 6) end if lineinput #1, line$ loop close #1 sel = popupmenu(item$) if sel < j then exit proc i = instr(item$[sel], " ") if i = 0 then i = instr(item$[sel], chr$(&h09)) if i = 0 then i = instr(item$[sel], "'") if i > 0 then proc$ = left$(item$[sel], i) else proc$ = item$[sel] end if if right$(proc$, 2) = "()" then proc$ = left$(proc$, len(proc$)-2) end if @@JumpMacro file$ + "," + proc$ end procproc FileInfo 'ファイル情報をコピー dim f$, s$, i, item$[2] f$ = @@Command$(1) if f$ = "" then if @hwnd = 0 then exit proc f$ = @PathName$ end if s$ = filedatetime$(f$) item$[1] = "ファイル名のみ" item$[2] = "ファイル名+タイムスタンプ" i = popupmenu(item$) if i = 1 then clipboard$ = f$ exit proc else '日付のスペースをゼロに置換 do while 1 i = instr(s$, "/ ") if i = 0 then exit do s$ = left$(s$, i) + "0" + mid$(s$, i + 2) loop clipboard$ = f$ + " " + s$ end if end procproc DosWindow '常駐リスト・ファイル一覧からDOS画面へ dim file$, path$ file$ = @@Command$(1) if file$ = "" then if @hwnd = 0 then exit proc file$ = @PathName$ end if path$ = left$(file$, inrstr(file$, "\")) chdrive path$ : chdir path$ call shell("command.com", 1) end proc