diff options
Diffstat (limited to 'ipl/gprogs/colormap.icn')
-rw-r--r-- | ipl/gprogs/colormap.icn | 119 |
1 files changed, 119 insertions, 0 deletions
diff --git a/ipl/gprogs/colormap.icn b/ipl/gprogs/colormap.icn new file mode 100644 index 0000000..076abbd --- /dev/null +++ b/ipl/gprogs/colormap.icn @@ -0,0 +1,119 @@ +############################################################################ +# +# File: colormap.icn +# +# Subject: Program to display palette from color list +# +# Author: Ralph E. Griswold +# +# Date: November 17, 1997 +# +############################################################################ +# +# This file is in the public domain. +# +############################################################################ +# +# This program shows the colors given color list files given on the +# command line. +# +# colormap will display color lists with more than 256 entries but, +# of course, it cannot display more than 256 different colors (if that +# many). +# +############################################################################ +# +# Requires: Version 9 graphics +# +############################################################################ +# +# Links: colrlist, drawcolr, interact, io, vsetup +# +############################################################################ + +$define CellWidth 20 +$define Cells 16 + +link colrlist +link drawcolr +link interact +link io +link vsetup + +global colors + +procedure main() + local vidgets + + vidgets := ui() + + GetEvents(vidgets["root"], , shortcuts) + +end + +procedure file_cb(vidgets, value) + + case value[1] of { + "load @L": load_colors() + "snapshot @S": snapshot(colors) + "quit @Q": exit() + } + + return + +end + +procedure reload_cb() + + return + +end + +procedure load_colors() + local clist + static file + + initial file := "" + + repeat { + if OpenDialog("Specify color list file:", file) == "Cancel" then fail + clist := colrlist(dialog_value) | { + Notice("Cannot process color list " || image(dialog_value) || ".") + next + } + WClose(\colors) + colors := draw_colors(clist) + Raise() + return + } + +end + +procedure shortcuts(e) + + if &meta then case map(e) of { + "l": load_colors() + "q": exit() + "r": reload_cb() + "s": snapshot() + } + + return + +end + +#===<<vib:begin>>=== modify using vib; do not remove this marker line +procedure ui_atts() + return ["size=197,288", "bg=gray-white"] +end + +procedure ui(win, cbk) +return vsetup(win, cbk, + [":Sizer:::0,0,197,288:",], + ["file:Menu:pull::1,0,36,21:File",file_cb, + ["load @L","snapshot @S","quit @Q"]], + ["line1:Line:::0,24,197,24:",], + ["reload:Button:regular::26,56,49,20:reload",reload_cb], + ) +end +#===<<vib:end>>=== end of section maintained by vib |