home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / historic / v941.tgz / icon.v941src.tar / icon.v941src / ipl / gprogs / colrpick.icn < prev    next >
Text File  |  2000-07-29  |  2KB  |  71 lines

  1. ############################################################################
  2. #
  3. #    File:     colrpick.icn
  4. #
  5. #    Subject:  Program to pick RGB or HLS colors
  6. #
  7. #    Author:   Gregg M. Townsend
  8. #
  9. #    Date:     February 27, 1995
  10. #
  11. ############################################################################
  12. #
  13. #   This file is in the public domain.
  14. #
  15. ############################################################################
  16. #
  17. #      colrpick provides a command-level interface to the ColorDialog
  18. #   procedure.  The ColorValue() of the selected color is written to
  19. #   standard output when the Okay button is pressed.  If the Cancel
  20. #   button is pressed, colorpick exits with an error by calling stop().
  21. #
  22. #      A default color can be specified by one or more command arguments,
  23. #   for example "colrpick deep green".
  24. #
  25. ############################################################################
  26. #
  27. #  Requires:  Version 9 graphics
  28. #
  29. ############################################################################
  30. #
  31. #  Links: graphics, vsetup
  32. #
  33. ############################################################################
  34.  
  35. link graphics
  36. link vsetup
  37.  
  38. procedure main(args)
  39.    local dflt
  40.  
  41.    Window ! put(ui_atts(), "canvas=hidden", args)
  42.    ui()                # just to get standard VIB font
  43.  
  44.    if *args > 0 then {
  45.       dflt := ""
  46.       every dflt ||:= " " || !args
  47.       if not ColorValue(dflt) then {
  48.          write(&errout, "  illegal default color: ", dflt)
  49.          dflt := &null
  50.          }
  51.       }
  52.  
  53.    case ColorDialog(, dflt) of {
  54.       "Okay":    write(dialog_value)
  55.       "Cancel":    stop()
  56.       }
  57. end
  58.  
  59.  
  60. #===<<vib:begin>>===    modify using vib; do not remove this marker line
  61. procedure ui_atts()
  62.    return ["size=340,320", "bg=pale gray"]
  63. end
  64.  
  65. procedure ui(win, cbk)
  66. return vsetup(win, cbk,
  67.    [":Sizer:::0,0,340,320:",],
  68.    )
  69. end
  70. #===<<vib:end>>===    end of section maintained by vib
  71.