home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Bila Vrana
/
BILA_VRANA.iso
/
028A
/
AUROR.ZIP
/
TREE.AML
< prev
next >
Wrap
Text File
|
1996-07-17
|
21KB
|
790 lines
//--------------------------------------------------------------------
// DIRTREE.AML
// Directory Tree, (C) 1993-1996 by nuText Systems
//
// (see Tree.dox for user help)
//
// This macro displays an expandable/collapsable directory tree for your
// computer.
//
// Usage:
//
// Select this macro from the Macro List (on the Macro menu), or run it
// from the macro picklist <shift f12>.
//
// This macro can also be run by selecting 'Tree..' on the File menu.
//--------------------------------------------------------------------
// compile time macros and function definitions
include bootpath "define.aml"
// initial tree window width
constant tree_width = 42
// colors
constant tree_border_color = color black on gray
constant tree_border_flash_color = color brightgreen on gray
constant tree_south_title_color = color black on green
constant tree_text_color = color black on gray
constant tree_cursor_color = color black on brightgreen
constant tree_plus_color = color brown on gray
constant tree_menu_color = color black on green
constant tree_menu_hotkey_color = color red
constant tree_menu_hilite_color = color black on brightgreen
// syntax object for directory tree window
object xtree
syntax
'bcfd' // options:
// b=show through marked block
// c=highlight cursor line
// d=show through closed folds
// f=use only foreground colors
// i=ignore keyword case
// n=highlight numbers
'└─├│-' // symbol set 1
'+' // symbol set 2
'' // string characters
'' // string literal char
'' // numeric symbol
'' 0 // eol comment 1 / start column
'' 0 // eol comment 2 / start column
'' '' // multi-line comment 1
'' '' // multi-line comment 2
0 // number of lines to scan backward
// colors
color brightcyan on black // keyword
color darkgray on gray // symbol set 1
color brown on gray // symbol set 2
color brightred on brightred // string
color brightred on brightred // numeric
color darkgray on gray // eol comment 1
color yellow on yellow // eol comment 2
color brightgreen on brightgreen // comment 1
color brightcyan on brightcyan // comment 2
// go back to original object
object entry
forward opendir
forward edittree
forward refreshtree
forward insertdir
forward deletedir
forward renamedir
forward printdir
forward statdir
forward openbr
forward openall
forward closebr
forward closeblock
forward closeall
forward printtree
forward helptree
variable treewindow, resultbuf, dircount, currentdrive, nomsg, initialpath
variable showfiles
leftmargin = 1
// create the dirtree window
private function createtreewin
treewindow = createwindow
setframe ">bsmvh"
setcolor border_color tree_border_color
setcolor north_title_color tree_border_color
setcolor text_color tree_text_color
setcolor fold_color tree_text_color
setcolor border_flash_color tree_border_flash_color
setcolor south_title_color tree_south_title_color
setcolor menu_color tree_menu_color
setcolor menu_hotkey_color tree_menu_hotkey_color
setcolor menu_hilite_color tree_menu_hilite_color
settitle "Tree"
setwinctrl "≡" 2
setborder "1"
setshadow 2 1
setsyntax ON "xtree"
prf.dirtree = prf.dirtree + 1
menubar '' 1
item "&File" "Tfile"
item "&View" "Tview"
item "&Print" "Tprint"
item "&Window" "Twin"
item "&Help" "Thelp"
end
menu "Tfile"
item " &Open <enter>" opendir
item " &Print" printdir
item " &Statistics.. <ctrl v>" statdir
item "-"
item " &Delete <del>" deletedir
item " &Insert.. <ins>" insertdir
item " Re&name.. <ctrl n>" renamedir
item "─"
item " &Edit Tree <ctrl e>" edittree
item " &Refresh.. <ctrl r>" refreshtree
item "-"
item " &Close <esc>" destroyobject
end
menu "Tview"
item " &Close Branch <shift left>" closebr
item " Close &All Branches <alt left>" closeall
item "-"
item " &Open Branch <shift right>" openbr '' 1
item " Open Branch with &Files <ctrl right>" openbr 'f' 1
item " Open All &Branches <alt right>" openall
item " O&pen All Branches with Files" openall 'f'
end
menu "Tprint"
item " &Print Tree <ctrl p>" printtree
item " Print &Formfeed" printstr '\x0C'
item " Print &Settings..|*" runcfg "print"
end
menu "Twin"
item " &Restore" restore
item " &Move/Size <ctrl f5>" sizekey
item " M&inimize" minimize
item " Ma&ximize <ctrl z>" maximize
item " &Next <ctrl a>" nextwindow
item "─"
item " Ca&scade <shift f5>" cascade
item " Tile &Horz <shift f4>" tile 'h'
item " Tile &Vert <shift f3>" tile 'v'
end
menu "Thelp"
item " &Keys and Mouse.." helptree
end
// center the window
width = tree_width
height = getvidrows - 5
ox = (getvidcols - width) / 2
oy = (getvidrows - height) / 2
sizewindow ox oy ox + width oy + height "ad"
end
diroptions = 'dhvs' + _NameStyle
fileoptions = 'dfhvs' + _NameStyle
private function scandir (path directory treestr expand)
addline treestr + directory '' '' resultbuf
// scan window status line
dircount = dircount + 1
if not nomsg then
settitle "Directories/Files: " + dircount 'sl' 2
display
end
// get a directory listing
path = path + directory + '\\'
// load files if specified
if expand and showfiles then
if loadbuf path + "*.*" '' '' fileoptions then
if getloadinfo 'f' then
treestrfile = treestr
if length treestrfile > leftmargin then
treestrfile [length treestrfile - 3..TO_END] =
if? treestrfile [length treestrfile - 3] == '└' " " "│ "
end
treestrfile = treestrfile + (if? (getloadinfo 'd') "│ " " ")
// sort the listing
sortblock '' "*a"
repeat
line = gettext
if not pos '\\' line then
addline treestrfile + line '' '' resultbuf
end
until not down
end
destroybuf
end
end
if loadbuf path + "*.*" '' '' diroptions then
if getloadinfo 'd' then
if not expand then
if initialpath and (pos path initialpath) == 1 and
length path < length initialpath then
expand = 1
elseif length treestr > leftmargin then
ovltext "+ " (length treestr - 1) (getlines resultbuf) resultbuf
end
end
if expand then
if length treestr > leftmargin then
treestr [length treestr - 3..TO_END] =
if? treestr [length treestr - 3] == '└' " " "│ "
end
// sort the directory listing
sortblock '' "*a"
repeat
scandir path gettext [1 : getlinelen - 1]
treestr + (if? getrow == getlines "└── " "├── ") expand - 1
until not down
end
end
destroybuf
end
end
// get system drives (except floppies)
drives = sub 'B' '' (