r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[View] discuss view related issues

Gregg
21-May-2008
[7739]
randomize: func [
    "Reseed the random number generator."

    /with seed "date, time, and integer values are used directly; others 
    are converted."
][

    random/seed either find [date! time! integer!] type?/word seed [seed] 
    [
        to-integer checksum/secure form any [seed now/precise]
    ]
]

img: make image! 512x512 
repeat i 512 [
	randomize
	wait .001
	repeat j 512 [
		either i < 256 [
			if 2 = random 2 [
				img/(as-pair i - 1 j - 1): 255.255.255
			]			
		][
			if 2 = random/secure 2 [
				img/(as-pair i - 1 j - 1): 255.255.255
			]
		]
	]
]


view layout [image img across text "RANDOM" tab tab tab text "RANDOM/SECURE"]
Rebolek
21-May-2008
[7740]
great!
Geomol
22-May-2008
[7741]
Nice view, Rebolek!!! :-)
Anton
22-May-2008
[7742x2]
Nice! By the way, here's the fastest optimization I could come up 
with (about 30% faster):
t0: now/precise
img: make image! 512x512
i: 0
loop 512 [
	loop 256 [i: i + 1 if 2 = random 2 [poke img i 255.255.255]]

 loop 256 [i: i + 1 if 2 = random/secure 2 [poke img i 255.255.255]]
]
print difference now/precise t0
Graham
22-May-2008
[7744]
amacleod - I don't know where grahamchat.r is either .. but they 
same should be in synapsechat in the contest entries on viewtop
Graham
25-May-2008
[7745]
How does one determine how many lines there are of text in an area 
filled with text?
Rebolek
25-May-2008
[7746]
height-of-area / height-of-font ?
Graham
25-May-2008
[7747]
but if the text only partially fills the area?
Henrik
25-May-2008
[7748x3]
hmm.. can't you do something with setting the caret to a large position 
and read the position that way?
with offset-to-caret
unless it returns the index of the string and not a pair.
Graham
25-May-2008
[7751]
I'll try that ... wonder why the area just doesn't track the number 
of lines
Henrik
25-May-2008
[7752]
can't remember if the way it formats text is native. it probably 
is.
Graham
25-May-2008
[7753]
What I am trying to do as in the video i posted on the rebgui channel 
is to open the area just enough to show all the text .. no less, 
and no more.
Henrik
25-May-2008
[7754x2]
if you have fixed width or height, you could make a face of that 
fixed with or height with the text in it with the same font as for 
the area. then you can with SIZE-TEXT get the size back of the required 
size of the area. BTN does this.
the face you are using should be of quite large height or width, 
depending on what you want to size the area on. SIZE-TEXT bases the 
size of the text on the visible amount of text in the face, so if 
the face is too small, it will use the face size and not the text 
size.
Graham
25-May-2008
[7756]
I fetch the text asynchronously ie. I don't have the text at the 
time I construct the layout .. oh well...
Chris
25-May-2008
[7757]
; You could make the text face dynamically each time:


make-textbox: func [width [integer!] text [string!] /local textbox][
	textbox: make-face/size 'text (width * 1x0)
	textbox/text: :text
	textbox/size/y: second size-text textbox
	textbox
]
Gregg
25-May-2008
[7758]
Does the line-list facet hold it?
Gabriele
26-May-2008
[7759]
open the area just enough to show all the text
 - size-text ?
james_nak
27-May-2008
[7760x2]
Amacleod and Graham, my apologies for the two week delay. I don't 
know where I got it either now though it was written by Didec with 
Notes: "Code abstracted from altme offline reader by Graham Chiu 
and used for this chat client". I just saw the Graham part when I 
first saw it so I thought he had written it. Of course the cool thing 
is the scrollable boxes work great.
Nope, can't find where I got it from. : (
amacleod
28-May-2008
[7762]
Can you post it again. I would like to have a look.
Rebolek
11-Jun-2008
[7763x2]
I recently found this on my HD and as I'm not sure I've ever posted 
it somewhere, I'm posting it here. Do what you want with it.
do http://bolek.techno.cz/reb/request-color.r
Also check this small GUI experiment:
do http://bolek.techno.cz/reb/efflist-complete.r


rearange the effects using drag'n'drop, duplicate effect whit green 
"o", remove them with red "x" (that's not good idea, as you cannot 
add removed effects back) and set their values with knobs, check 
box and color-picker.
Henrik
11-Jun-2008
[7765x4]
nice. could it be simplified?
if we could get that color wheel in along with the sliders and a 
storage for colors, that would be nice.
(I'm considering that colorwheel for R3 VID
)
Rebolek
11-Jun-2008
[7769]
Thanks, it could be simplified, I've added the preset paletes so 
one can get consistent color shades, but it can be easily removed.
Henrik
11-Jun-2008
[7770]
what's the license? BSD?
Rebolek
11-Jun-2008
[7771x2]
I think it should be much faster under R3. At least I hope ;)
Yes, BSD
Henrik
11-Jun-2008
[7773]
I will post this in the internal VID3 group.
Rebolek
11-Jun-2008
[7774]
but I may change to MIT or even PD. It's been sleeping on my HD for 
1.5 year without any usage :)
Henrik
11-Jun-2008
[7775]
are there any known bugs in it?
Rebolek
11-Jun-2008
[7776]
Just that the precision of picking color in the triangle is limited. 
You can test it if you try to move the picker to one of the edges 
and you will see that the sliders won't go to min/max values. There's 
some rounding involved, missing decimal pair! and of course, to be 
really precise, the color wheel should be at least 256pixels wide. 
But you can alwas finetune using sliders.
Henrik
11-Jun-2008
[7777x2]
do you directly read the color in the triangle or calculate it based 
on the cursor position?
(the latter might give increased precision, I think)
Rebolek
11-Jun-2008
[7779]
I was reading the color from the triangle but there's difference 
between calculated value and value from the gradient so now I'm calculating 
it from the cursor position. There's some comented code to show you 
the difference between both methods.
Henrik
11-Jun-2008
[7780]
ok
Anton
11-Jun-2008
[7781]
Very nice work, Rebolek!

Nice GUI elements used; I like the rearrangement method used in the 
list of effects, and I see you've done some nice rotate knobs.
Graham
14-Jun-2008
[7782]
Anyone got a simple busy animation I can use with draw?
Henrik
15-Jun-2008
[7783x3]
http://hmkdesign.dk/rebol/wait-anim.r

Not sure it isn't broken though. Never used it.
I see certain things I would have done differently today. :-)
do http://hmkdesign.dk/rebol/wait-anim.r

view layout [a: wait-image tog "Wait for it" [either value [a/start][a/stop]]]
Graham
15-Jun-2008
[7786]
nice
Henrik
15-Jun-2008
[7787x2]
I remember not using it, because it didn't work with networking somehow. 
When View doesn't receive events, it can't work.
If you're using BEER, maybe you don't have that problem.