summaryrefslogtreecommitdiff
path: root/ipl/gprogs/colrpick.icn
blob: a8c90f2f0e05f1b8c5670d6e10f2d62d2b1fcecb (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
64
65
66
67
68
69
70
############################################################################
#
#	File:     colrpick.icn
#
#	Subject:  Program to pick RGB or HLS colors
#
#	Author:   Gregg M. Townsend
#
#	Date:     February 27, 1995
#
############################################################################
#
#   This file is in the public domain.
#
############################################################################
#
#      colrpick provides a command-level interface to the ColorDialog
#   procedure.  The ColorValue() of the selected color is written to
#   standard output when the Okay button is pressed.  If the Cancel
#   button is pressed, colorpick exits with an error by calling stop().
#
#      A default color can be specified by one or more command arguments,
#   for example "colrpick deep green".
#
############################################################################
#
#  Requires:  Version 9 graphics
#
############################################################################
#
#  Links: graphics, vsetup
#
############################################################################

link graphics
link vsetup

procedure main(args)
   local dflt

   Window ! put(ui_atts(), "canvas=hidden", args)
   ui()				# just to get standard VIB font

   if *args > 0 then {
      dflt := ""
      every dflt ||:= " " || !args
      if not ColorValue(dflt) then {
         write(&errout, "  illegal default color: ", dflt)
         dflt := &null
         }
      }

   case ColorDialog(, dflt) of {
      "Okay":	write(dialog_value)
      "Cancel":	stop()
      }
end


#===<<vib:begin>>===	modify using vib; do not remove this marker line
procedure ui_atts()
   return ["size=340,320", "bg=pale gray"]
end

procedure ui(win, cbk)
return vsetup(win, cbk,
   [":Sizer:::0,0,340,320:",],
   )
end
#===<<vib:end>>===	end of section maintained by vib