keymap in text style feel/engage
[1/5] from: anton::lexicon::net at: 20-Apr-2002 21:36
Can anyone help me find where in the system object
this word 'keymap is ?
Look in the feel of the text style to see it.
probe get in get-style 'text 'feel
I am making a new style like this:
stylize [
pair-edit: text with [
feel: make feel [
engage: func [...][
. . .
; I pasted the original engage code here
; with reference to keymap
. . .
]
]
]
]
(You can read the above code like this:
pair-edit is a text with these extra things:
- a feel based on the old feel with these extra things...
)
Two words were not defined after I did this:
- view* (it's easy, system/view)
- keymap (where is it?)
I had a flop around with anamonitor and didn't see it
yet. Anyone with clearer vision?
Anton.
[2/5] from: brett:codeconscious at: 20-Apr-2002 22:27
Hi Anton,
> Two words were not defined after I did this:
> - view* (it's easy, system/view)
> - keymap (where is it?)
>> get in ctx-text 'keymap
== [
#"^H" back-char
#"^-" tab-char
#"^~" del-char
#"^M" enter
#"^A" all-text
#"^C" copy-text
#"^...
Regards,
Brett.
[3/5] from: dockimbel:free at: 20-Apr-2002 19:42
Hi Brett,
Brett Handley wrote:
> Hi Anton,
>
> > Two words were not defined after I did this:
> > - view* (it's easy, system/view)
> > - keymap (where is it?)
I don't think so, 'view* is defined in ctx-text.
I quickly made a little tool to find where those words are defined, it may help
in such cases :
>> where? view*
...found in 'ctx-text
>> where? keymap
...found in 'user-prefs
...found in 'ctx-text
>> where? timeout
...found in 'system/schemes/default
...found in 'system/schemes/Finger
...found in 'system/schemes/Whois
...found in 'system/schemes/Daytime
...found in 'system/schemes/SMTP
...found in 'system/schemes/POP
...found in 'system/schemes/IMAP
...found in 'system/schemes/HTTP
...found in 'system/schemes/FTP
...found in 'system/schemes/NNTP
...found in 'system/error/access
...found in 'system/standard/port
>> where? feel
...found in 'face
...found in 'blank-face
...found in 'ctx-text/view*/screen-face
...found in 'ctx-text/view*/VID/vid-face
...found in 'ctx-text/view*/VID/choice-face
...found in 'svv/vid-face
...found in 'svv/choice-face
...found in 'system/standard/face
...found in 'system/view/screen-face
...found in 'system/view/VID/vid-face
...found in 'system/view/VID/choice-face
Here is the source :
REBOL [
Title: "Where tool"
Author: "Nenad Rakocevic"
Date: 20/04/2001
File: %where.r
Version: 0.1
Purpose: "Find in which objects words are defined"
]
context [
ctx: fword: cto: val: pos: none
iter: has [w][
w: to-path :ctx
if find first w :fword [
pos: either pos: find/match :ctx 'system/words [:pos][:ctx]
if empty? :pos [pos: either value? fword ["global context"][none]]
if pos [print ["...found in" :pos]]
]
foreach w next first w [
cto: to-path :ctx
set/any 'val get/any in cto :w
if all [
value? 'val
not any-function? :val
object? val
:ctx <> 'system/words
:w <> 'system
:w <> 'REBOL
][
insert tail :ctx :w
iter
]
]
remove back tail ctx
]
set 'where? func ['word][
ctx: to-lit-path 'system
fword: :word
iter
]
]
I didn't upload it in library because it's a quick hack and it may crash
your REBOL if it encounters circular references like in this case (/View) :
>> desktop
>> where? editor
*** crash ***
So, if anyone is interested in improving this script, please do. :)
Cheers,
-DocKimbel.
[4/5] from: brett:codeconscious at: 21-Apr-2002 10:30
Hi DocKimbel,
> I don't think so, 'view* is defined in ctx-text.
I like your "where?" function - that is going to be very handy. :^)
Anton, the the engage function you are interested in lives in a shared feel
object "ctx-text/swipe":
>> same? ctx-text/swipe get in get-style 'text 'feel
== true
>> same? ctx-text/swipe get in get-style 'txt 'feel
== true
>> same? ctx-text/swipe get in get-style 'h1 'feel
== true
>> same? ctx-text/swipe get in get-style 'body 'feel
== true
That is - every style except LABEL that is derived from VTEXT
- see http://www.codeconscious.com/rebsite/vid-ancestry.r
I think if you bind your new modified engage function to "in ctx-text 'self"
you will
find that both view* and keymap will be set correctly. Also for free, you
get
copy-text and unlight-text set too which you will probably need.
Regards
Brett.
[5/5] from: anton:lexicon at: 24-Apr-2002 11:51
You are right Brett, that did the trick.
Vid-ancestry is very useful. How forgetful I am of
this resource. I put it in my links/programs/ section.
I ended up changing the style to build on from text
to field, because I wanted edit capability.
One would expect that a fair bit of stuff would be
different, but the impact was extremely minimal.
I only had to change one or two
lines (in which I modified code in init.)
How nice rebol is sometimes.
Anton.