Rebface 1247031 view behaviour
[1/10] from: james::mustard::co::nz at: 13-Jul-2004 10:46
Hi All,
Does anyone know of docs regarding the differences between behaviour and
command availability between Rebface and Rebview?
In Rebview I am used to using view myFace: make face [size: sa offset:
0x0 ...] - the same works fine under Rebface except that after executing
and displaying the face it acts more like view/new in face with no wait
in program flow - is this a bug or intentional? If intentional what is
the preferred method to halt further program execution until the face
has been dealt with?
(This applies to all Rebface versions I have tried including the latest
1247031)
Regards,
James.
[2/10] from: james:mustard at: 13-Jul-2004 10:53
This is the code I am currently testing it on:
REBOL []
sa: system/view/screen-face/size
sx: sa * 1x0
sy: sa * 0x1
calc-vert: func [/local step p1 p2 s1][
s1: copy ""
for step 0 8 1 [
p1: (sx - ((sx / 4) + (step * sx / 16)) + (sy / 6))
p2: (sx - (step * sx / 8) + sy - (sy / 6))
s1: join s1 ["line " p1 " " p2 newline]
]
return s1
]
calc-intercepts: func [y /local b pa pb p1 p2 pj][
;this will use points a and b to calculate the x coords given y on a
line
;far side line
pa: (sx - (sx / 4) + (sy / 6))
pb: (sx + sy - (sy / 6))
m: (pa/y - pb/y) / (pa/x - pb/x)
b: pa/y - (m * pa/x)
p1: as-pair ((y - b) / m) y
;near side line
pa: (sx - ((sx / 4) + (8 * sx / 16)) + (sy / 6))
pb: (sx - (8 * sx / 8) + sy - (sy / 6))
m: (pa/y - pb/y) / (pa/x - pb/x)
b: pa/y - (m * pa/x)
p2: as-pair ((y - b) / m) y
pj: compose [(p1) (p2)]
]
calc-horz: func [/local step pa s1][
s1: copy ""
for step 0 8 1 [
pa: calc-intercepts second ((sy / 6) + (step * sy / 12))
s1: join s1 ["line " pa/1 " " pa/2 newline]
;s1: join s1 ["fill-pen 0.0.255 flood " pa/1 + 0x5 " " newline]
]
return s1
]
thegrid: compose [
pen 255.255.255
(to-block calc-vert)
(to-block calc-horz)
]
view desktop: make face [
size: sa
offset: 0x0
color: 192.192.192
effect: [fit draw thegrid]
pane: copy []
image: edge: none
feel: make feel [
engage: func [f a e][
if a = 'down [quit]
]
]
]
[3/10] from: g:santilli:tiscalinet:it at: 13-Jul-2004 12:45
Hi James,
On Tuesday, July 13, 2004, 12:46:31 AM, you wrote:
JM> Does anyone know of docs regarding the differences between behaviour and
JM> command availability between Rebface and Rebview?
Face is View without all the mezzanine code.
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amiga Group Italia sez. L'Aquila --- SOON: http://www.rebol.it/
[4/10] from: james:mustard at: 14-Jul-2004 10:58
GS > Face is View without all the mezzanine code.
Heh, well funnily enough i've been using view for 3 years and I had
never once suspected the rebol view command was a mezzanine.. lol
Thank you Gabriele :)
[5/10] from: james:mustard at: 14-Jul-2004 13:34
Ok, i've just brought the mezzanine for source across to rebface and
there is NO difference in the view function source of Rebview and
Rebface - HOWEVER there IS a difference in behaviour. In Rebview the
view command will pause on displaying a face unless view/new is used.
In Rebface there is no pause regardless of the extension. This is the
same behaviour I was talking about earlier.
try the following under rebview and rebface - notice the difference
(rebview waits - rebface runs and quits)
rebol[]
view make face [size: 200x200 offset: 100x100]
Regards,
James.
> Gabriele Santilli wrote:
>
>>Hi James,
>>
>>On Tuesday, July 13, 2004, 12:46:31 AM, you wrote:
>>
>>JM> Does anyone know of docs regarding the differences between
behaviour and
[6/10] from: cyphre:seznam:cz at: 14-Jul-2004 8:31
Hi James,
the difference is caused by this:
In RebFace there is no initialized EVENT-PORT. This port have to be also in
system/ports/wait-list so when the VIEW function calls DO-EVENTS at his end,
interpreter goes to the wait loop. When there is nothing in the
system/ports/wait-list the wait [] loop return to the console.
So you need to "include" in RebFace this function: OPEN-EVENTS.
You can do it like this:
;add the fuction to the system/view object
system/view: make system/view [open-events: does [
if event-port [exit]
event-port: open [scheme: 'event]
event-port/awake: func [port] [wake-event port]
insert system/ports/wait-list event-port
]
]
;initialize and insert the EVENT-PORT
system/view/open-events
;try your example
view make face [size: 200x200 offset: 100x100]
HTH,
Cyphre
[7/10] from: james:mustard at: 14-Jul-2004 20:20
Cyphre wrote:
>Hi James,
>
>the difference is caused by this:
>
>In RebFace there is no initialized EVENT-PORT. This port have to be
also in
>system/ports/wait-list so when the VIEW function calls DO-EVENTS at
his end,
>interpreter goes to the wait loop. When there is nothing in the
>system/ports/wait-list the wait [] loop return to the console.
Thank you Cyphre, I had always assumed that the event handling in
rebface was the same as rebview - a sure sign that I need to do less
REBOL coding when I'm busy with other projects - so little time to
explore :(
I guess this means I should go and fix my Rebtravex demo ;)
Regards,
James.
[8/10] from: g:santilli:tiscalinet:it at: 14-Jul-2004 13:01
Hi James,
On Wednesday, July 14, 2004, 3:34:11 AM, you wrote:
JM> try the following under rebview and rebface - notice the difference
JM> (rebview waits - rebface runs and quits)
Hmm, it looks like some mezzanines are actually present in rebface
(though I think they aren't in enface). However, VID is not there,
and more importantly, SYSTEM/PORTS/WAIT-LIST is empty, and the
event port need to be opened.
I.e. you need to add this:
insert system/ports/wait-list system/view/event-port: open event://
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amiga Group Italia sez. L'Aquila --- SOON: http://www.rebol.it/
[9/10] from: petr:krenzelok:trz:cz at: 14-Jul-2004 13:19
Gabriele Santilli napsal(a):
>Hi James,
>On Wednesday, July 14, 2004, 3:34:11 AM, you wrote:
<<quoted lines omitted: 6>>
>I.e. you need to add this:
>insert system/ports/wait-list system/view/event-port: open event://
I am not strong on View, but is it necessary to not having event port
open as with full View?
thanks,
-pekr-
[10/10] from: rotenca:telvia:it at: 14-Jul-2004 13:31
Hi James,
> try the following under rebview and rebface - notice the difference
> (rebview waits - rebface runs and quits)
You must do at the start of your script:
open-events
It makes what Cyphre and Gabriele say.
The point is that view-object.r is included by default by rebface, but the the
event system is started by view.r which is not included by rebface.
---
Ciao
Romano
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted