############################################################################ # # 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 #===<>=== 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 #===<>=== end of section maintained by vib