Skip to content

Instantly share code, notes, and snippets.

@toomasv
Created March 20, 2019 14:01
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toomasv/295c92b28c024ae1e9e430397fa4ecd7 to your computer and use it in GitHub Desktop.
Save toomasv/295c92b28c024ae1e9e430397fa4ecd7 to your computer and use it in GitHub Desktop.
Layout adjustment demo
Red []
context [
env: self
canvas: none
tab-pan: drawing-panel-tab: animations: none
info-panel: edit-options-panel: options-panel: drawing-panel: figs-panel: anim-panel: none
layer: layer1: drawing: selection-layer: grid-layer: drawing-layer: edit-layer: none
win: layout/options compose/deep [;
title "Drawing pad"
size 540x465
tab-pan: tab-panel 520x445 [
"Drawing" [backdrop rebolor
across
info-panel: panel 500x25 gold [origin 0x0 space 4x0]
return
edit-options-panel: panel 500x25 brick [origin 0x0 space 4x0]
return
options-panel: panel 80x335 water [origin 0x0 space 0x0]
drawing-panel: panel 300x300 snow [
origin 0x0 space 0x0
style layer: box glass ;draw []
style drawing: base glass 300x300
layer1: layer ;255.255.255.0
do [env/canvas: layer1]
at 0x0 selection-layer: box hidden
at 0x0 grid-layer: box hidden
at 0x0 drawing-layer: drawing ;transparent
at 0x0 edit-layer: base 300x300 transparent hidden
]
figs-panel: panel 100x335 beige []
return
at 100x390 anim-panel: panel 300x25 crimson [origin 0x0 space 4x0]
]
"Animation" [origin 0x0 space 0x0
animations: area 517x421 ;!!!
]
]
do [
drawing-panel-tab: pane/1/pane/1
animations-panel-tab: pane/1/pane/2
;drawing-panel-tab/size: animations-panel-tab/size:
]
][
actors: object [
on-resizing: func [face event][
tab-pan/size: win/size - 20
foreach tab tab-pan/pane [
tab/offset: tab/parent/offset + 2x24
tab/size: tab/parent/size - 5x27
]
info-panel/size/x: info-panel/parent/size/x - info-panel/offset/x - 10
edit-options-panel/size/x: edit-options-panel/parent/size/x - edit-options-panel/offset/x - 10
options-panel/size/y: options-panel/parent/size/y - options-panel/offset/y - 10
drawing-panel/size: drawing-panel/parent/size - drawing-panel/offset - 120x45
foreach-face drawing-panel [face/size: drawing-panel/size]
canvas/size: drawing-panel/size ; grid-layer/size: selection-layer/size: drawing-layer/size:
figs-panel/offset/x: figs-panel/parent/size/x - 110
figs-panel/size/y: figs-panel/parent/size/y - figs-panel/offset/y - 10
anim-panel/offset/x: drawing-panel/offset/x
anim-panel/offset/y: anim-panel/parent/size/y - 35
anim-panel/size/x: drawing-panel/size/x
animations/size: animations/parent/size - 1x0
;show win
]
]
]
view/flags win [resize]
]
@dockimbel
Copy link

dockimbel commented Aug 15, 2019

@toomasv @qtxie This demo flickers a lot on Win7 on master branch, is that normal?

@toomasv
Copy link
Author

toomasv commented Aug 16, 2019

It doesn't flicker (more than usual) on W10
Red 0.6.4 for Windows built 9-Aug-2019/0:39:52+03:00 commit #1bbb021
layout

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment