World: r3wp
[View] discuss view related issues
older newer | first last |
amacleod 1-Oct-2008 [8134] | Is there a way to append an image object (a box for example) to a face that has already been displayed. I'm looking to get simple highlight functionality in an app in which a string is scanned for in a series of text faces. I've been able to highlight the search word in each face but if I click in any of the text faces the face looses the highlight effect sort of like loosing focus on normal highlighting. I would like the highlight to remain until no longer needed. |
Graham 1-Oct-2008 [8135] | you could have the boxes there already and just hide them until you need them. |
amacleod 1-Oct-2008 [8136x4] | The string is meant to be a search keyword which can change. No predicting what one might seach for... |
What I got working: rebol [] pad: 20x30 window: layout [ bx: box red 0x0 panel: panel [ text 400 "Here is a simple example how to use DRAW dialect for into alpha channel of the image. I think with the function make-alpha (bellow in the example) you can draw almost any kind of transparent shape though it is not the fastest method....IMO the possibility to use DRAW pens for alpha channel should be done at Rebol's native level" t: text 400 "Here is a simple example how to use DRAW dialect for e-alpha (bellow in the example) you can draw almost any kind of transparent shape though it is not the fastest method....IMO the possiinto alpha channel of the image. I think with the function make-alpha (bellow in the example) you can draw almost any kind of transparent shape though it is not the fastest method....IMO the possibility to use DRAW pens for alpha channel should be done at Rebol's native level" text 500 "can draw almost any kind of transparent shape though it is not the fastest method....IMO the possibility to use DRAW pens for alpha channel should be done at Rebol's naHere is a simple example how to use DRAW dialect for into alpha channel of the image. I think with the function make-alpha (bellow in the example) you can draw almost any kind of transparent shape though it is not the fastest method....IMO the possibility to use DRAW pens for alpha channel should be done at Rebol's native level"] button "Highlight" [foreach face panel/pane [if face/style = 'text [ system/view/focal-face: face system/view/highlight-start: find face/text "into alpha channel of the image" system/view/highlight-end: find/tail face/text "into alpha channel of the image" show face ]]] button "Paint" [foreach face panel/pane [if face/style = 'text [ ;system/view/focal-face: face keyword: "transparent" ;xy: caret-to-offset face system/view/highlight-start: find face/text k ;yx: caret-to-offset face system/view/highlight-end: find/tail face/text k xy: caret-to-offset face find face/text keyword bx/offset: face/offset + pad + xy bx/size: as-pair (5.9 * length? keyword) 15 show face ;unfocus face ;wait 1 ]]] ] view window | |
The first button hilights a string. The second button "paint" the string in red. The last painted string in hte last face remains when clicked in the face but the others disappear when clicked. How can I prevent that from happening? | |
Ignore the commented out lines... | |
Henrik 1-Oct-2008 [8140] | if possible, you should append faces in a pane that belongs to the text face. you can do that as you want. it's only a matter of regular block manipulation and then SHOWing the text face again. |
Anton 3-Oct-2008 [8141x2] | Minor update to ARROW360 style: - Now it's smoother (more is calculated with decimal! instead of pair!) (also updated the demo file). |
load-thru/update http://anton.wildit.net.au/rebol/gui/arrow360.r do-thru/update http://anton.wildit.net.au/rebol/gui/demo-arrow360.r | |
Pekr 3-Oct-2008 [8143] | there is one small "bug". When you move arrow close enough to the top or to the left window border, underlying content moves some 1-2 pixels? |
Izkata 3-Oct-2008 [8144] | Bleh, I used to know this... I can't seem to get 'draw to work with text - is there something wrong with this? view layout [box 200x100 effect [draw [pen black text 10x10 {Testing}]]] |
Graham 3-Oct-2008 [8145x4] | Linux? |
and 10x10 is very small | |
works on windows for me | |
http://www.compkarori.com/vanilla/display/AGG | |
Izkata 3-Oct-2008 [8149x3] | yeah, on linux.. /view version 2.7.5 |
10x10 should be the offset | |
Ah, thanks - that font thing makes it work | |
Anton 4-Oct-2008 [8152x5] | Pekr, yes. That is a View rendering bug, not a bug of arrow360 in particular. |
Two pixels: | |
It can be seen with just: | |
view layout [text "Will be moved up 2 pixels" pad 28x-50 box effect [merge luma -20]] | |
A quite old bug, if I remember correctly. | |
Henrik 4-Oct-2008 [8157x2] | Text is only moved up one pixel here. |
Is it in RAMBO? | |
Anton 4-Oct-2008 [8159x2] | Probably the same root as this bug report. |
http://www.rebol.net/cgi-bin/rambo.r?id=4269& | |
Henrik 12-Oct-2008 [8161] | I'm toying around with a VID dialect for postscript. I've done that by copying the VID source for LAYOUT, STYLIZE and all related functions in the SYSTEM/VIEW/VID. So far so good, but now I want to implement styles, so I can write some layouts and am wondering what the formal way would be to add the very first style in what is equivalent to SYSTEM/VIEW/VID/VID-STYLES ? |
Anton 13-Oct-2008 [8162x2] | Hmm.. interesting. Do you have a base object (eg. similar to svv/vid-face ?) |
Not familiar with postscript, I am wondering why you couldn't just make a function "to-postscript" that accepts a face argument (similar to to-image), instead of reimplementing all of VID. | |
Henrik 13-Oct-2008 [8164x3] | yes, I have a base face similar to vid-face. I even added it to the style list manually to see if that would work, but it doesn't. |
Anton, good idea. | |
Anton, thanks. Now it's moving forward. Got some primitive face renderings in postscript now. | |
Anton 13-Oct-2008 [8167] | I suppose you would be cloning face/color, face/text, face/edge rendering (whatever you need first) at a simple level, and gradually improving it towards perfection afterwards. |
Henrik 13-Oct-2008 [8168x3] | My biggest problem right now is the coordinate system, vertical positioning of text and text wrapping. The rest is almost in place. |
http://rebol.hmkdesign.dk/files/vid-postscript.png<--- so far so good :-) | |
(I wish I had thought of this sooner!) | |
Anton 13-Oct-2008 [8171] | That looks like fun, Henrik. |
Henrik 13-Oct-2008 [8172] | I've already fixed top/middle/bottom alignment. Text is placed a couple of mm too far to the right. |
Anton 13-Oct-2008 [8173] | I suppose you don't know how to do the equivalent of SIZE-TEXT in postscript yet. |
Henrik 13-Oct-2008 [8174] | Actually I rely fully on VID's coordinate system. SIZE-TEXT in PS is apparently only possible on the width of the text, not the height, which is why just I use VID instead. It seems to work fine, if we can live with integer positioning. |
Anton 13-Oct-2008 [8175] | Mmm. The font rendering looks nicer. |
Henrik 13-Oct-2008 [8176] | text wrapping is a different problem... |
Anton 13-Oct-2008 [8177] | Ah yes, I see. |
Henrik 13-Oct-2008 [8178] | Remembering from amacleod's multi-highlight problem, detecting where wraps are in a text box might be buried in some natives that we can't get to. |
Anton 13-Oct-2008 [8179x2] | I solved that in caret-to-offset-patch.r It behaves very very close to native (except efficiency), so should be usable for this situation. |
http://anton.wildit.net.au/rebol/patch/caret-to-offset-patch.r | |
Henrik 13-Oct-2008 [8181] | thanks, I'll have a look |
Anton 13-Oct-2008 [8182x2] | and the test file to do is test-caret-to-offset-patch.r |
If you want to save yourself literally days of reverse engineering... | |
older newer | first last |