I'm getting to the point where I need
a Script-Fu template that I can understand
and modify. Here's a guy named Simon who
has come to my rescue:
Simon Budigs
He has written a Script-Fu template
which he keeps here:
Script-Fu Template
I've looked at this script
and it is 116 lines long.
The call to script-fu-menu-register
comes last. In my version
of the script, this function
call is spread across lines
115 and 116.
Apparently there is something
here I do not fully understand.
I thought it was 2nd argument
to script-fu-register that
determines where the the script
is hung in a menu.
From reading the code, I can see
that this is clearly not the case
in this script. It appears, in
this script that the second argument
to script-fu-register provides
a description of the menu item but
does not hang the menu item in place.
Line 104 in my version of this script
says "Rectangle..." which is
a pretty good description of what
the menu item does. Line 104 is
the second argument to script-fu-register.
So, I'd say that my orginal assumptions
are not correct if a call to
script-fu-menu-register is present.
Seems that script-fu-menu-register plays
the role of menu-item-hanger and the 2nd argument
to script-fu-register plays the
role of menu-item-descriptor. At least, that's
the appearance.
Let me try the script again . . .
OK. I'm back. My new assumptions turn out
to be correct. Argument number 2 to
script-fu-register is the descriptor
for the menu item. Not only that, but
argument 3 to script-fu-register is
the tool tip. This makes total sense.
OK. Now I now, script-fu-menu-register
is for menu hanging only. That is to say, the
only purpose of this function is placement of
the script in a specific menu.
OK. I totally understand now. The second
argument to script-fu-register has
what is called in Unix a dirname and
a basename.
The basename is the final part of the path,
typically a file name. The dirname is
everything leading up to the basename,
typically a diretory path to a filename.
In Unix, basename and dirname
are actual commands used at the shell command
line.
Now I understand the second argument to
script-fu-register completely. It
is a dirname/basename approach. The dirname
is the location of the menu item in
the menu system. The basename is the
descriptor of the menu item in
the menu system.
Here's a concrete example:
"/Xtns/Script-Fu/_ATG/Strawberries"
Everthing up to the word Strawberries
is a menu path. Once the menu item is hung
in the proper location, Strawberries
is the label for the menu item.
Where does script-fu-menu-register
come to play in all this? It is an alternative
menu hanger. If you want, you make the
second argument to script-fu-register a
menu-item label only. If you do things this
way, it is then left up to script-fu-menu-register
to provide a path to the menu item.
Confused? Here's an even simpler way to look
at it. You need to do two things to make your
script appear as a menu item:
- Provide a menu path to the menu
item - Provide a label for the menu item
You can either have script-fu-register
do both of these things or you can have
script-fu-register do one and have
script-fu-menu-register do the other.
The lesson here? Like all things in life,
software is subject to revision. I suspect
that script-fu-menu-register was
introduced at some point as a software revision
of some kind.
If this were the case, script-fu-register
would still continue to function the way it
always did so as to preserve backwards compatibility.
All of this is pure speculation on my part. Why
two functions are capable of providing the same
specific functionality is uncertain.
Ed Abbott
No comments:
Post a Comment