menu * {
.picture viewer:dialog -vmd pic pic
}
dialog pic {
title "picture viewer"
size -1 -1 530 250
option pixels
icon 1, 5 145 100 100
icon 2, 110 145 100 100
icon 3, 215 145 100 100
icon 4, 320 145 100 100
icon 5, 425 145 100 100
box "" 13, 5 5 520 35
button "add pic" 6, 10 15 50 20
button "add directory" 7, 115 15 80 20
button "del directory" 8, 200 15 80 20
button "del pic" 9, 65 15 45 20
button "list view" 10, 285 15 60 20
button "slideshow" 11, 350 15 60 20
button "refresh directories" 12, 415 15 105 20
button "<" 14, 185 100 60 20
button ">" 15, 285 100 60 20
button "Open" 16, 225 75 80 20
edit "" 17, 5 45 520 20, read autohs
list 18, 5 70 410 155, hide
icon 19, 420 70 100 100
text "" 20, 420 180 100 17, hide
text "" 21, 420 200 100 20, hide
text "" 22, 420 220 100 20, hide
text "" 23, 420 240 100 20, hide
button "open" 24, 5 225 410 20, hide
box "" 25, 400 68 120 70
text "" 26, 410 78 100 17
text "" 27, 410 98 100 17
text "" 28, 410 118 100 17
list 29, 5 70 520 155, hide
button "delete" 30, 5 225 255 20, hide
button "done" 31, 265 225 255 20, hide
}
dialog pic2 {
title "slide menu"
size 5 5 108 24
option pixels
button "<" 1, 2 2 20 20
button ">" 2, 23 2 20 20
button "||" 3, 44 2 20 20
button "|>" 5, 65 2 20 20
button "X" 4, 86 2 20 20
}
alias change { inc %show | dialog -c pic2 | window -c @pic | window -paCzdk0 +tnbL @pic 1 1 $pic($+(",$read(pictures.txt,%show),")).width $pic($+(",$read(pictures.txt,%show),")).height | drawpic @pic 0 0 $+(",$read(pictures.txt,%show),") | dialog -vmd pic2 pic2
}
on *:DIALOG:pic:init:*:{
set %select 1
did -g $dname 1 $+(",$read(pictures.txt,1),")
did -g $dname 2 $+(",$read(pictures.txt,2),")
did -g $dname 3 $+(",$read(pictures.txt,3),")
did -g $dname 4 $+(",$read(pictures.txt,4),")
did -g $dname 5 $+(",$read(pictures.txt,5),")
var %z = 1, %q = pictures.txt
while ( %z <= $lines(%q) ) {
did -a pic 18 $nopath($read(%q,%z))
inc %z }
var %r = 1, %e = picdir.txt
while ( %r <= $lines(%e) ) {
did -a pic 29 $read(%e,%r)
inc %r }
}
on *:dialog:pic:close:* { unset %select | unset %show | .timerpic off | unset %sele | unset %lstsel | unset %speed | dialog -c pic2 | .timerref off
}
on *:DIALOG:pic:sclick:*:{
if ($did = 14) {
if (%select = 1) halt
else { dec %select
did -g $dname 1 $+(",$read(pictures.txt,$calc(%select * 1)),")
did -g $dname 2 $+(",$read(pictures.txt,$calc(%select * 2)),")
did -g $dname 3 $+(",$read(pictures.txt,$calc(%select * 3)),")
did -g $dname 4 $+(",$read(pictures.txt,$calc(%select * 4)),")
did -g $dname 5 $+(",$read(pictures.txt,$calc(%select * 5)),")
}
}
if ($did = 15) { set %linz $calc($lines(pictures.txt) / 5)
if (%Select = %linz) halt
else { inc %select
did -g $dname 1 $+(",$read(pictures.txt,$calc(%select * 1)),")
did -g $dname 2 $+(",$read(pictures.txt,$calc(%select * 2)),")
did -g $dname 3 $+(",$read(pictures.txt,$calc(%select * 3)),")
did -g $dname 4 $+(",$read(pictures.txt,$calc(%select * 4)),")
did -g $dname 5 $+(",$read(pictures.txt,$calc(%select * 5)),")
}
}
if ($did = 9) { if (!$did(18).sel) && ($did(10) = pic view) noop $input(Please select a file from the drop down menu,uwo) halt
if ( $did(pic,18).sel ) && ($did(10) = pic view) { set %rem $did(pic,18).sel | write $+(-dl,%rem) pictures.txt | write $+(-dl,%rem) addedpic.txt | did -r pic 18
var %z = 1, %q = pictures.txt
while ( %z <= $lines(%q) ) {
did -a pic 18 $nopath($read(%q,%z))
inc %z }
}
}
if ($did = 24) { window -c @pic | window -paCzdk0 +tnbL @pic 1 1 $pic($+(",$read(pictures.txt,%lstsel),")).width $pic($+(",$read(pictures.txt,%lstsel),")).height | drawpic @pic 0 0 $+(",$read(pictures.txt,%lstsel),") }
if ($did = 18) { set %lstsel $did(pic,18).sel | did -ra pic 17 $read(pictures.txt,%lstsel) | did -g pic 19 $+(",$read(pictures.txt,%lstsel),") | did -ra pic 20 width: $pic($+(",$read(pictures.txt,%lstsel),")).width $+ w | did -ra pic 21 height: $pic($+(",$read(pictures.txt,%lstsel),")).height $+ h | did -ra pic 22 size: $bytes($file($read(pictures.txt,%lstsel)).size).suf }
if ($did = 10) { if ($did(10) = list view) { did -h pic 1-5,14-16,25-28 | did -v pic 18-24 | did -ra pic 10 pic view {
}
}
else { did -v pic 1-5,14-16,25-28 | did -h pic 18-24 | did -ra pic 10 list view }
}
if ($did = 29) { did -ra pic 17 $did(pic,29).seltext }
if ($did = 8) { write -c pictures.txt | did -v pic 29-31 | did -h pic 1-5,14-16,25-28 | did -r pic 17
var %r = 2, %e = addedpic.txt
while ( %r <= $lines(%e) ) {
write pictures.txt $read(%e,%r)
inc %r }
var %a = 1, %b = picdir.txt
while ( %a <= $lines(%b) ) {
$findfile($read(picdir.txt,%a),*.jpg,0,write pictures.txt $1-)
inc %a }
}
if ($did = 31) { did -h pic 29-31 | did -v pic 1-5,14-16,25-28 }
if ($did = 30) { did -r pic 18,29 | var %rem $did(pic,29).sel | write $+(-dl,%rem) picdir.txt | $findfile($did(pic,29).seltext,*.jpg,0,write -dl pictures.txt $1-) | $findfile($read(picdir.txt,%rem),*.jpg,did -r pic 18 $nopath($vl)) | did -r pic 17
var %z = 1, %q = pictures.txt
while ( %z <= $lines(%q) ) {
did -a pic 18 $nopath($read(%q,%z))
inc %z }
var %r = 1, %e = picdir.txt
while ( %r <= $lines(%e) ) {
did -ra pic 29 $read(%e,%r)
inc %r }
}
if ($did = 16) { window -c @pic | window -paCzdk0 +tnbL @pic 1 1 $pic($+(",$read(pictures.txt,%sele),")).width $pic($+(",$read(pictures.txt,%sele),")).height | drawpic @pic 0 0 $+(",$read(pictures.txt,%sele),") }
if ($did = 11) { set %speed $?="how fast do you want each picture to change (secs)" | set %show 1 | dialog -vmd pic2 pic2 | window -c @pic | window -paCzdk0 +tnbL @pic 1 1 $pic($+(",$read(pictures.txt,1),")).width $pic($+(",$read(pictures.txt,1),")).height | drawpic @pic 0 0 $+(",$read(pictures.txt,1),") | .timerpic 0 %speed change }
if ($did = 6) { var %pic = $sfile(add picture) | write pictures.txt %pic | write addedpic.txt %pic }
if ($did = 7) { var %dir $sdir="Mp3 Directory"
if (%dir isin $read(picdir.txt)) { noop $input(directory exists,uwo,Error) | halt {
}
}
else { write picdir.txt %dir | $findfile(%dir,*.jpg,0,write pictures.txt $1-) }
}
if ($did = 12) { write -c pictures.txt
var %r = 2, %e = addedpic.txt
while ( %r <= $lines(%e) ) {
write pictures.txt $read(%e,%r)
inc %r }
var %a = 1, %b = picdir.txt
while ( %a <= $lines(%b) ) {
$findfile($read(picdir.txt,%a),*.jpg,0,write pictures.txt $1-)
inc %a }
}
}
on *:DIALOG:pic2:sclick:*:{
if ($did = 3) { .timerpic off }
if ($did = 4) { .timerpic off | window -c @pic | dialog -c pic2 }
if ($did = 5) { .timerpic 0 %speed change }
if ($did = 2) { set %linz $lines(pictures.txt)
if (%Show = %linz) halt
.timerpic off | inc %show | dialog -c pic2 | window -c @pic | window -paCzdk0 +tnbL @pic 1 1 $pic($+(",$read(pictures.txt,%show),")).width $pic($+(",$read(pictures.txt,%show),")).height | drawpic @pic 0 0 $+(",$read(pictures.txt,%show),") | .timerpic 0 %speed change | dialog -vmd pic2 pic2 }
if ($did = 1) { if (%show = 1) halt
.timerpic off | dec %show | dialog -c pic2 | window -c @pic | window -paCzdk0 +tnbL @pic 1 1 $pic($+(",$read(pictures.txt,%show),")).width $pic($+(",$read(pictures.txt,%show),")).height | drawpic @pic 0 0 $+(",$read(pictures.txt,%show),") | .timerpic 0 %speed change | dialog -vmd pic2 pic2 }
}
on *:dialog:pic:dclick:*:{
if ($did isnum 1-5) { set %sele $calc(%select * $did)
did -ra pic 17 $read(pictures.txt,%sele) | did -ra pic 26 width: $pic($+(",$read(pictures.txt,%sele),")).width $+ w | did -ra pic 27 height: $pic($+(",$read(pictures.txt,%sele),")).height $+ h | did -ra pic 28 size: $bytes($file($read(pictures.txt,%sele)).size).suf }
}
}
}