Re: Inserting code into Gnumeric



On Wed, Jan 03, 2001 at 04:18:17PM -0500, Ser Nam Lim wrote:

If I want to add some code such that I can add a button on the top panel
of the Gnumeric application and clicking on the button can result in the
execution of some function that I have written, what are the various
places that I need to modify and add?

It depends alot in what you are trying to do, and how general it is.
There are currently 2,5 approaches available to you

1) extend the gui directly in workbook-control-gui.c (and
gnumeric.xml for bonobo).  You would register a new verb and add an
entry for it in the existing toolbars or menus.  This is working and
well defined.  However, we do not support registering verbs from a
plugin yet.  So you would be forced to directly modify Gnumeric.

2) If you use the experimental Bonobo enabled version you can define
a component which when activated will merge in a new menu item or
toolbar.  The downside is that the Bonobo enabled version is still
considered unstable, and is not appropriate for use in a production
setting.

2.5) Define a button on the sheet itself.  Unfortunately we have no
framework for defining new procedures (which are different from
functions) so you would need to do some work for this to be usable.
 
I know that new functions can be added via python plugin but how can I
change the graphical appearance of the Gnumeric application to include an
extra button to invoke the new function? Also, if I don't want to use
python to add a new function, is there any other way for me to do it?

There are at least two misunderstandings here.

1) function vs procedure
    A function should have no state and returns a result.
    A procedure has a state and does not return a result.

Gnumeric has a well defined interface for creating new functions.
Very little work has been done to support adding user procedures
yet.

2) Functions can be written in C, python, guile, GB,
   and perl (although perl is a bit dusty currently).
   Most functions are written in C currently.

Good Luck
    Jody




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]