summaryrefslogtreecommitdiff
path: root/ipl/gprogs/snapper.icn
blob: 4411efd57d03c62612b5964c2d6c621ca2d0af35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
############################################################################
#
#	File:     snapper.icn
#
#	Subject:  Program to display images
#
#	Authors:  Ralph E. Griswold and Clinton L. Jeffery
#
#	Date:     May 2, 2001
#
############################################################################
#
#   This file is in the public domain.
#
############################################################################
#
#  This is just a simple program to display black-and-white versions of screen
#  dumps.
#
#  Type the name of an XBM or XPM file on the prompt in the input window.
#  Get rid of an image by click in the image window.  Exit the program
#  by clicking in the input window.
#
#  As an exercise, you might want to make this program more versatile --
#  and perhaps write a program to do slide shows.
#
############################################################################
#
#  Requires:  Version 9 graphics
#
############################################################################
#
#  Links:  wopen
#
############################################################################

link wopen

procedure main(av)
   local name, window, winput

   if *av > 0 then {
      every name := !av do {
         (window := WOpen("label=" || name, "image=" || name,"pos=400,200")) | 
            write(&errout,"cannot open image ",name)
	 }
      Active()
   } else {
      winput := WOpen("label=snapper! (click mouse in this window to exit)") |
	 stop("** can't open window")

      repeat {
	 close(\window)
	 writes(winput, "next image: ")
	 name := read(winput)
	 (window := WOpen("label=" || name, "image=" || name,"pos=400,200")) | 
	    write(winput,"cannot open image")
         if Event(winput) === (&lpress | &mpress | &rpress) then
            exit()
      }
   }
   
end