services.r
[1/9] from: gchiu::compkarori::co::nz at: 2-May-2001 19:34
Does editing the services.r work for anyone?
I've added and changed text - makes no difference. Quit and
restarted Rebol. Nothing.
--
Graham Chiu
[2/9] from: arolls:bigpond:au at: 2-May-2001 20:26
Yes, I commented out the goto line
and the goto menu no longer appears
when I start rebol.
We are of course talking about the
view/desktop/services.r file.
What were you trying to do?
Anton.
[3/9] from: gchiu:compkarori at: 3-May-2001 7:50
On Wed, 2 May 2001 20:26:58 +1000
"Anton" <[arolls--bigpond--net--au]> wrote:
> Yes, I commented out the goto line
> and the goto menu no longer appears
> when I start rebol.
>
> We are of course talking about the
> view/desktop/services.r file.
Yep.
> What were you trying to do?
>
Just add a menu item that brings up the editor to edit one
of my remote files
--
Graham Chiu
[4/9] from: larry:ecotope at: 2-May-2001 22:22
"Graham Chiu" <[gchiu--compkarori--co--nz]> wrote:
> Just add a menu item that brings up the editor to edit one
> of my remote files
Hi Graham
A service has to be either a word or a url/file. Make a script called edit.r
with these lines
REBOL []
editor http://www.rebol.com ;change file/url as necessary
and put in the view-root directory.
Add this line to services.r
service "Edit" %edit.r
This will invoke the editor on the file or url specified. The line
editor 'same
invokes the editor with a blank document.
-Larry
[5/9] from: arolls:bigpond:au at: 4-May-2001 3:55
Larry,
How did you find this out?
Where's the source that understands the "service" dialect?
In which context are the words that you can use
with service; goto, help and quit?
Anton.
[6/9] from: larry:ecotope at: 3-May-2001 12:12
Hi Anton
OK, as a public service, I will reveal one of my secret Jedi methods. :-)
This one is called "Use the Source!"
All of the desktop code is in ctx-viewtop which is initially a spec block
for an object (or context). When the desktop is invoked ctx-viewtop is
converted (if necessary) to an object. It is about 1000 lines of code.
You can make yourself a cheat-sheet as follows, will work with either block
or object
echo %viewtop.txt
print mold ctx-viewtop
echo none
With regard to services, look for the function show-services. You can show
it as follows if ctx-viewtop is an object. The conversion (if necessary)
should be done this way.
if block? ctx-viewtop [ctx-viewtop: context ctx-viewtop]
>> print mold get in ctx-viewtop 'show-services
func [file /local path services f x][
clear next dts-face/pane
x: dts-face/pane/1/size/x
path: full-path file
if all [services: load-index path services/icons] [
foreach icon services/icons [
if icon/type = 'service [
f: make-face dts-proto
f/text: icon/name
f/size: 200x20
f/line-list: none
f/action: compose/deep [
do-file (either word? icon/item [to-lit-word icon/item]
[icon/item]
)
(if icon/stats [reduce [icon/stats]])
]
f/size/x: 4 + first size-text f
x: x + 8
f/offset/x: x
x: x + f/size/x
append dts-face/pane f
]
]
]
dtm-services/pane: dts-face/pane
dtm-services/size: dts-face/size
dtm-services/size/x: x
show dtm-services
]
The line starting f/action: tells us the action that happens when we click
the item in the services bar. In this case, it will call the function
do-file on the argument.
>> print mold get in ctx-viewtop 'do-file
func [path stats /local orig][
if none? path [exit]
orig: path
if word? path [
switch path [
goto [goto-view]
help [help-view]
console [halt-view]
quit [quit]
]
exit
]
if email? path [emailer/to path exit]
if not any [url? path (first path) = #"/"] [path: full-path path]
either not read-binary path stats [
alert reform ["Missing file:" path]
] [
switch/default map-suffix to-file path [
rebol [start path]
text [editor path-thru path]
image [show-image path]
] [
either url? orig [browse orig] [browse path-thru path]
]
]
]
Reading the above code and a couple of quick experiments gave me the
information for my email below.
Happy Hacking
-Larry
PS The functions INIT-DESKTOP and CONNECT-VIEW are worth study.
[7/9] from: arolls:bigpond:au at: 4-May-2001 15:44
Thankyou Larry.
A quick visual inspection of ctx-viewtop did not reveal
to my eyes "service" anywhere. However, had I used:
>> foreach word first ctx-viewtop [if find to-string word "service" [print
word]]
dtm-services
show-services
== none
I would have found these two interesting words.
Anton.
[8/9] from: gchiu:compkarori at: 11-May-2001 17:09
> > Does editing the services.r work for anyone?
> >
> > I've added and changed text - makes no difference.
> Quit and
> > restarted Rebol. Nothing.
Just replying to myself. The View/Pro 1.2 version I just
downloaded suddenly decided to respect the changes I had
made to my services.r file!
--
Graham Chiu
[9/9] from: petr:krenzelok:trz:cz at: 11-May-2001 7:49
Graham Chiu wrote:
> > > Does editing the services.r work for anyone?
> > >
<<quoted lines omitted: 4>>
> downloaded suddenly decided to respect the changes I had
> made to my services.r file!
but! - installation offered me /C/rebol/view, while I use /d/rebol/view
and I never used /C/ disc for rebol storage, and also my proxy earlier
settings were not used ... not to say strange left X axis desktop offset
is still annoyingly being used ...
-pekr-
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted