Create a gist now

Instantly share code, notes, and snippets.

Red [] L: charset "ABCDEFGHI" D: union N: charset "123456789" charset "0"
repeat y 9 [repeat x 9 [col: either x = 1 [#" "][#"A" + (x - 2)]
append p: [] set ref: (to word! rejoin [col y - 1]) make face! [size: 90x24
type: pick [text field] header?: (y = 1) or (x = 1)
offset: -20x10 + as-pair ((x - 1) * size/x + 2) ((y - 1) * size/y + 1)
text: form case [y = 1 [col] x = 1 [y - 1] 'else [copy ""]]
para: make para! [align: pick [center right] header?]
extra: object [name: form ref formula: old: none]
actors: context [on-create: on-unfocus: function [f e][f/color: none
if rel: f/extra/old [react/unlink rel 'all]
if #"=" = first f/extra/formula: copy text: copy f/text [parse remove text
[any [p: L N not ["/" skip not N] insert p " " insert "/data "
| L skip | p: some D opt [dot some D] insert p " " insert " " | skip]]
f/text: rejoin [f/extra/name "/data: any [math/safe [" text {] "#UND"]}]
if f/data [any [react f/extra/old: f/data do f/data]]]
] on-focus: func [f e][f/text: any [f/extra/formula f/text] f/color: yello]
;-- Temporary definition until we get `to issue!` proper support --
to-hexa: func [t [tuple!]][
load head replace/all next
rejoin [mold to-hex/size t/1 2 mold to-hex/size t/2 2 mold to-hex/size t/3 2]
A1/text: "R:"
B1/text: "250"
C1/text: "IP address:"
D1/text: ""
F1/text: "Boolean Logic"
A2/text: "G:"
B2/text: "200"
C2/text: "Netmask:"
D2/text: ""
E2/text: "A"
F2/text: "true"
A3/text: "B:"
B3/text: "200"
C3/text: "Network:"
D3/text: "=D1 and D2"
E3/text: "B"
F3/text: "false"
A4/text: "RGB:"
B4/text: "=B6/color: as-color B1 B2 B3"
C4/text: "Broadcast:"
D6/text: ""
D4/text: "=D6 or D3"
E4/text: "A or B"
F4/text: "=form (get F2) or (get F3)"
A5/text: "Hex format:"
B5/text: "=to-hexa B4"
E5/text: "A and B"
F5/text: "=form (get F2) and (get F3)"
A6/text: "Color:"
C6/text: "Broadcast mask:"
E6/text: "A xor B"
F6/text: "=form (get F2) xor (get F3)"
E7/text: "A nor B"
F7/text: "=form not (get F2) or (get F3)"
E8/text: "A nand B"
F8/text: "=form not (get F2) and (get F3)"
view make face! [type: 'window text: "PicoSheet" size: 840x250 pane: p]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment