Pictures viewer

By ^silk on Nov 04, 2007

Pictures viewer
Code written by ^silk
Choose a file -> displays info and picture into the dialog.Please note that the file type must be of the following: jpg,bmp,png,ico,jpeg,or gif. /picv to open this script. You can also double click the image to get a larger preview. Once in the preview, right-click the pic and click close if you wish to exit.

Click Set directory and set your pictures directory. Click Open picture and it opens the pic through your default pictures editor.

Thanks,
^silk

; Pictures viewer 
; Code written by ^silk
; Choose a file -> displays info and picture into the dialog.
; Please note that the file type must be of the following: jpg,bmp,png,ico,jpeg,or gif.
; /picv to open this script
; You can also double click the image to get a larger preview
; Once in the preview, right-click the pic and click close if you wish to exit.
; Thanks,
;   ^silk

alias picv dialog $iif($dialog(picv),-v,-m) picv picv
dialog picv {
  title "Pictures viewer"
  size -1 -1 207 248
  option pixels
  icon 1, 2 29 200 144
  edit "<file name>", 2, 3 5 152 21, read autohs
  button "Choose:", 3, 155 3 50 23, flat
  text "Width: 0", 4, 12 180 72 17
  text "Height: 0", 5, 117 179 72 18
  edit "<filepath>", 6, 4 202 198 20, read autohs
  button "Open picture", 7, 3 222 75 25, disable
  button "Set directory", 8, 78 222 75 25
  button "Close", 9, 153 222 51 25
}

on *:dialog:picv:sclick:3:{ 
  %current.pic.disp = $$sfile($iif(%pic.directory,$($v1,2),$mircdir),Choose picture to display)
  if ($($+(%,current,.,pic,.,disp),2) && $regex($gettok($nopath(%current.pic.disp),2,46),/^[.]?[jpg|bmp|png|gif|ico|jpeg]/)) { 
    did -ra $dname 2 $nopath(%current.pic.disp) 
    did -ra $dname 4 Width: $+($pic($+(",%current.pic.disp,")).width,w) 
    did -ra $dname 5 Height: $+($pic($+(",%current.pic.disp,")).height,h)
    did -g $dname 1 $+(",%current.pic.disp,")
    did -ra $dname 6 $($+(%,current,.,pic,.,disp),2)
    did -e $dname 7
  }
}

on *:dialog:picv:close:0:unset %current.pic.disp
on *:dialog:picv:dclick:1:{ 
  window -pdhka +b @pic 1 1 $pic($+(",%current.pic.disp,")).width $pic($+(",%current.pic.disp,")).height
  drawpic @pic 0 0 $+(",%current.pic.disp,")
}

on *:dialog:picv:sclick:9:{ 
  if ($window(pic)) window -c @pick
  dialog -x $dname $dname
}

on *:dialog:picv:sclick:8:{
  var %sd = $$sdir($mircdir,Select directory)
  if (%sd) set %pic.directory %sd
}

menu @pic { 
  close:window -c @pic 
}

Comments

Sign in to comment.
^silk   -  Nov 05, 2007

pretty good job, nice idea ^^ thanks

 Respond  
guest598594   -  Nov 05, 2007

pretty good job, nice idea

 Respond  
^silk   -  Nov 04, 2007

You can double-click the picture in the dialog and it should open a new window with the adjusted size.

 Respond  
Korvin   -  Nov 04, 2007

try and make the size adjust to how big the picture is =]

 Respond  
^silk   -  Nov 04, 2007

Thanks Korvin.

 Respond  
Korvin   -  Nov 04, 2007

its pretty good =]

 Respond  
^silk   -  Nov 04, 2007

Alright, made a few updates. Added a larger preview and added a directory function. Feedback is much appreciated. :]

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.