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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
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
|