[
    2 3
]
[
    3 4
]
[
    b c
]
[
    c
]
[b]
[1 2]
[1 2]
[2]
[1 2 
    3
]
[1 2]
[1 2]
[a 1 
    2 3
]
[a 1 2]
[a [1 2]]
[1 2]
[0 2]
[
    2 2
]
[a 1 2]
[a 1]
[
    a
]
[1 
    2
]
make object! [
    type: 'face
    offset: 0x0
    size: 16x200
    span: none
    pane: none
    text: none
    color: 100.100.100
    image: none
    effect: none
    data: 0
    edge: make object! [
        color: 128.128.128
        image: none
        effect: 'ibevel
        size: 0x0
    ]
    font: none
    para: none
    feel: make object! [
        redraw: func [face act pos][
            face/data: max 0 min 1 face/data 
            if face/data <> face/state [
                pos: face/size - face/pane/1/size - (2 * face/edge/size) - (2 * face/clip) 
                either face/size/x > face/size/y [face/pane/1/offset/x: face/data * pos/x + face/clip/x] [
                    face/pane/1/offset/y: face/data * pos/y + face/clip/y
                ] 
                face/state: face/data 
                if act = 'draw [show face/pane/1]
            ]
        ]
        detect: none
        over: none
        engage: func [f act evt /local tmp][
            if act = 'down [
                tmp: f/axis 
                do-face pick reduce [f/pane/3 f/pane/2] evt/offset/:tmp > f/pane/1/offset/:tmp f/page
            ]
        ]
    ]
    saved-area: none
    rate: none
    show?: true
    options: none
    parent-face: none
    old-offset: none
    old-size: none
    line-list: none
    changes: none
    face-flags: 0
    action: none
    state: false
    access: make object! [
        set-face*: func [face value][
            if not number? value [
                make error! reform [face/style "must be set to a number"]
            ] 
            face/data: value
        ]
        get-face*: func [face][face/data]
        clear-face*: func [face][face/data: 0]
        reset-face*: func [face][face/data: 0]
    ]
    style: 'SLIDER
    alt-action: none
    facets: [with [
            speed: 20 
            edge: [size: 0x0] 
            feel: svvf/scroll 
            reset: does [data: 0] 
            resize: func [new /x /y /local tmp] [
                either any [x y] [
                    if x [size/x: new] 
                    if y [size/y: new]
                ] [
                    size: any [new size]
                ] 
                tmp: pick [y x] axis = 'x 
                clip: pane/2/size: pane/3/size: size/:tmp - (2 * edge/size/:tmp) * 1x1 
                pane/3/offset: size/:axis - pane/3/size/:axis - (2 * edge/size/:axis) * 0x1 
                if tmp: axis = 'x [pane/3/offset: reverse pane/3/offset] 
                pane/2/data: pick [left up] tmp 
                pane/3/data: pick [right down] tmp 
                state: pane/2/effect: pane/3/effect: none 
                do pane/2/init do pane/3/init 
                pane/1/offset: 0x0 
                redrag any [ratio 0.1]
            ] 
            init: [
                pane: reduce [
                    make dragger [edge: make edge []] 
                    axis: make svv/vid-styles/arrow [dir: -1 edge: make edge [] 
                        color: first colors: [128.128.128 200.200.200] 
                        action: get in svvf 'move-drag 
                        feel: make svvf/scroll-button []
                    ] 
                    make axis [dir: 1 edge: make edge []]
                ] 
                if colors [
                    color: first colors pane/1/color: second colors 
                    pane/2/colors: pane/3/colors: append copy at colors 2 pane/2/colors/2
                ] 
                axis: pick [y x] size/y >= size/x 
                resize size
            ]
        ]]
    related: none
    words: none
    colors: none
    texts: none
    images: none
    file: none
    var: none
    keycode: none
    reset: func [][data: 0]
    styles: none
    init: [
        pane: reduce [
            make dragger [edge: make edge []] 
            axis: make svv/vid-styles/arrow [dir: -1 edge: make edge [] 
                color: first colors: [128.128.128 200.200.200] 
                action: get in svvf 'move-drag 
                feel: make svvf/scroll-button []
            ] 
            make axis [dir: 1 edge: make edge []]
        ] 
        if colors [
            color: first colors pane/1/color: second colors 
            pane/2/colors: pane/3/colors: append copy at colors 2 pane/2/colors/2
        ] 
        axis: pick [y x] size/y >= size/x 
        resize size
    ]
    multi: make object! [
        text: func [face blk][
            if pick blk 1 [
                face/text: first blk 
                face/texts: copy blk
            ]
        ]
        size: func [face blk][
            if pick blk 1 [
                if pair? first blk [face/size: first blk] 
                if integer? first blk [
                    if none? face/size [face/size: -1x-1] 
                    face/size/x: first blk
                ]
            ]
        ]
        file: func [face blk][
            if pick blk 1 [
                face/image: load-image face/file: first blk 
                if pick blk 2 [
                    face/colors: reduce [face/image] 
                    foreach i next blk [
                        append face/colors load-image i
                    ]
                ]
            ]
        ]
        image: func [face blk][
            if pick blk 1 [
                face/image: first blk 
                if pick blk 2 [face/images: copy blk]
            ]
        ]
        color: func [face blk][
            if pick blk 1 [
                either flag-face? face text [
                    set-font face color first blk 
                    if pick blk 2 [face/color: second blk]
                ] [
                    face/color: first blk
                ] 
                if pick blk 2 [face/colors: copy blk]
            ]
        ]
        block: func [face blk][
            if pick blk 1 [
                face/action: func [face value] pick blk 1 
                if pick blk 2 [face/alt-action: func [face value] pick blk 2]
            ]
        ]
    ]
    blinker: none
    pane-size: none
    dirty?: none
    help: none
    user-data: none
    flags: [input]
    doc: make object! [
        info: "base face style"
        string: none
        image: none
        logic: none
        integer: none
        pair: none
        tuple: none
        file: none
        url: none
        decimal: none
        time: none
        block: none
        keywords: none
    ]
    step: 0.02
    ratio: none
    page: none
    axis: none
    clip: 0x0
    dragger: make object! [
        type: 'face
        offset: 0x0
        size: 100x100
        span: none
        pane: none
        text: none
        color: 128.128.128
        image: none
        effect: none
        data: none
        edge: make object! [
            color: 128.128.128
            image: none
            effect: 'bevel
            size: 1x1
        ]
        font: none
        para: none
        feel: make object! [
            redraw: none
            detect: none
            over: none
            engage: func [face action event][
                if find [over away] action [
                    drag-off face/parent-face face face/offset + event/offset - face/data 
                    show face
                ] 
                if find [down alt-down] action [face/data: event/offset]
            ]
        ]
        saved-area: none
        rate: none
        show?: true
        options: none
        parent-face: none
        old-offset: none
        old-size: none
        line-list: none
        changes: none
        face-flags: 0
        action: none
    ]
    redrag: func [val /local tmp][
        state: none 
        ratio: min 1 max 0 val 
        page: any [all [ratio = 1 0] ratio / (1 - ratio)] 
        pane/1/size: val: size - (2 * edge/size) - (2 * clip * pick [0x1 1x0] axis = 'y) 
        tmp: val/:axis * ratio 
        if tmp < 10 [page: either val/:axis = tmp: 10 [1] [tmp / (val/:axis - tmp)]] 
        either axis = 'y [pane/1/size/y: tmp] [pane/1/size/x: tmp]
    ]
    speed: 20
    resize: func [new /x /y /local tmp][
        either any [x y] [
            if x [size/x: new] 
            if y [size/y: new]
        ] [
            size: any [new size]
        ] 
        tmp: pick [y x] axis = 'x 
        clip: pane/2/size: pane/3/size: size/:tmp - (2 * edge/size/:tmp) * 1x1 
        pane/3/offset: size/:axis - pane/3/size/:axis - (2 * edge/size/:axis) * 0x1 
        if tmp: axis = 'x [pane/3/offset: reverse pane/3/offset] 
        pane/2/data: pick [left up] tmp 
        pane/3/data: pick [right down] tmp 
        state: pane/2/effect: pane/3/effect: none 
        do pane/2/init do pane/3/init 
        pane/1/offset: 0x0 
        redrag any [ratio 0.1]
    ]
]
[
    if :action [feel: svvf/hot saved-area: true] 
    if all [not flag-face? self as-is string? text] [trim/lines text] 
    if none? text [text: copy ""] 
    change font/colors font/color 
    if none? size [size: -1x-1] 
    xy: size 
    if any [size/x < 0 size/y < 0] [
        state: max 1x1 pane-size * 9 / 10 - offset 
        if size/x < 0 [size/x: state/x] 
        if size/y < 0 [size/y: state/y] 
        size: (size-text self) + (edge-size? self) 
        + (to-pair all [para (to-pair para/margin) + to-pair para/origin])
    ] 
    if xy/x > 0 [size/x: xy/x] 
    if xy/y > 0 [size/y: xy/y] 
    sz: size 
    sn: 0 
    slf: :self 
    act: :action 
    if none? data [data: any [texts copy []]] 
    lines: data 
    picked: copy [] 
    iter: make-face/size 'txt sz * 1x0 + -16x20 
    iter/para: make self/para [origin: 2x0] 
    iter/font: make self/font [] 
    lc: to-integer sz/y / iter/size/y: second size-text iter 
    iter/feel: make iter/feel [
        redraw: func [f a i] [
            iter/color: color 
            if flag-face? slf striped [iter/color: pick next colors odd? cnt] 
            if find picked iter/text [iter/color: svvc/field-select]
        ] 
        engage: func [f a e] [
            if a = 'down [
                if cnt > length? slf/data [exit] 
                if not e/control [f/state: cnt clear picked] 
                alter picked f/text 
                do :act slf f/text
            ] 
            if a = 'up [f/state: none] 
            show pane
        ]
    ] 
    pane: layout/size [
        origin 0 space 0 
        sub-area: box slf/color sz - 16x0 ibevel with [pane: :text-pane] 
        at sz * 1x0 - 16x0 
        sld: scroller sz * 0x1 + 16x0 [
            if sn = value: max 0 to-integer value * ((1 + length? slf/data) - lc) [exit] 
            sn: value 
            show sub-area
        ]
    ] size 
    pane/offset: 0x0 
    sld/redrag lc / max 1 length? data
]
[
    data func [new args][new/text: pick new/texts: second args 1 next args]
]
[200x200 with [
        feel: none 
        access: ctx-access/data-pick 
        color: snow 
        colors: reduce [snow snow - 32] 
        sz: 
        iter: 
        sub-area: 
        sld: 
        sn: 
        lc: 
        picked: 
        cnt: 
        act: 
        slf: 
        lines: 
        none 
        append flags [as-is input] 
        text-pane: func [face id] [
            if pair? id [return 1 + second id / iter/size] 
            iter/offset: iter/old-offset: id - 1 * iter/size * 0x1 
            if iter/offset/y + iter/size/y > size/y [return none] 
            cnt: id: id + sn 
            if iter/text: pick data id [
                lines: at data id 
                iter
            ]
        ] 
        update: has [item value] [
            sld/redrag lc / max 1 length? data 
            if item: find data picked/1 [
                sld/data: min 1 (index? item) / (max 1 lc) 
                sn: max 0 to-integer sld/data * ((1 + length? data) - lc)
            ] [
                sld/value: 0.0 
                pane/offset: 0x0
            ] 
            self
        ] 
        resize: func [new /x /y /local tmp] [
            either any [x y] [
                if x [size/x: new] 
                if y [size/y: new]
            ] [
                size: any [new size]
            ] 
            pane/size: sz: size 
            sld/offset/x: first sub-area/size: size - 16x0 
            sld/resize/y: size/y 
            iter/size/x: first sub-area/size - sub-area/edge/size 
            lc: to-integer sz/y / iter/size/y 
            self
        ] 
        append init [
            sz: size 
            sn: 0 
            slf: :self 
            act: :action 
            if none? data [data: any [texts copy []]] 
            lines: data 
            picked: copy [] 
            iter: make-face/size 'txt sz * 1x0 + -16x20 
            iter/para: make self/para [origin: 2x0] 
            iter/font: make self/font [] 
            lc: to-integer sz/y / iter/size/y: second size-text iter 
            iter/feel: make iter/feel [
                redraw: func [f a i] [
                    iter/color: color 
                    if flag-face? slf striped [iter/color: pick next colors odd? cnt] 
                    if find picked iter/text [iter/color: svvc/field-select]
                ] 
                engage: func [f a e] [
                    if a = 'down [
                        if cnt > length? slf/data [exit] 
                        if not e/control [f/state: cnt clear picked] 
                        alter picked f/text 
                        do :act slf f/text
                    ] 
                    if a = 'up [f/state: none] 
                    show pane
                ]
            ] 
            pane: layout/size [
                origin 0 space 0 
                sub-area: box slf/color sz - 16x0 ibevel with [pane: :text-pane] 
                at sz * 1x0 - 16x0 
                sld: scroller sz * 0x1 + 16x0 [
                    if sn = value: max 0 to-integer value * ((1 + length? slf/data) - lc) [exit] 
                    sn: value 
                    show sub-area
                ]
            ] size 
            pane/offset: 0x0 
            sld/redrag lc / max 1 length? data
        ] 
        words: [
            data func [new args][new/text: pick new/texts: second args 1 next args]
        ]
    ]]
