well, quite a diff..

Giving a unique name for each params is a good idea. I didn't dare to
touch getOptions() etc. functions since they are called everywhere. I
see that you are bold enough. :) Thanks for the patch. I can
participate by getting rid of those get/set functions, if you wish. It
should finish before the weekend.

The patch seems OK. I haven't tested it, yet, I will finish in a day or two.

thanks again.

Ugras

On 10/15/06, Georg Baum <[EMAIL PROTECTED]> wrote:
Here comes the first part of the rework of InsetCommandParams I have been
working on.

All parameters do now have a name, and the plan is to get rid of
getOptions, getSecOptions, getContents etc. in a second step. That will
make the inset and dialog code easier to understand (especially of the
more complicated insets like InsetCitation). Right now it is not easy to
see from the inset code what parameters an inset has. The new code makes
this more clear, and it is now trivial to add support for commands like

\psfrag{placeholder}[cr][bl]{replacement with $\frac{a}{b}$ formula}

I did not use a map (or multi_map because we need sorted parameters) for
the parameters, because we currently have at most 3 parameters, so
searching in a vector is cheap. I don't expect that we get much more
parameters in the future, but if that should happen one could still change
the implementation.

Since the number and kind of parameters for a particular command is now
always known we can now also do some stronger checking. I already found
out this way that the second option of \cite is set from the frontend.

I have to check the parameter names of the cite commands, I believe that
some need to be swapped. The command parser in lyx2lyx has also to be
changed to something that understands nesting. I'll probably simply use
the code from InsetCommandParams::scanCommand unless somebody has a better
idea.

If I get no objections I will put this in next week, and after that change
all code that uses the old getOptions() etc. methods to the new interface.
Then it will be easy to put in the new nomencl inset from Ugras.


Georg


Rework InsetCommandParams interface and file storage

        * src/insets/insetcommandparams.[Ch]:
        (operator[]): New, access a parameter
        (clear): New, clear all parameters
        (info_): New, store info about this command
        (cmdname): Rename to name_
        (contents, options, sec_options): Replace with params_. Parameters
        are now stored as docstring.
        (findInfo): New factor for command info for all commands
        (read, write): Use new syntax
        (parameter set and get methods): reimplemenmt for new parameter storage

        * src/insets/insetcommand.h
        (getParam): New, get a parameter
        (setParam): New, set a parameter
        (parameter set and get methods): Adjust to InsetCommandParams changes

        * src/insets/insetbibitem.[Ch]
        (write): Remove, not needed anymore
        (directWrite): ditto

        * src/insets/insetbibitem.C
        (InsetBibitem::read): Use InsetCommand::read

        * src/insets/insetref.C
        (InsetRef::latex): Use new InsetCommandParams interface

        * src/mathed/InsetMathHull.C
        (InsetMathHull::doDispatch): ditto

        * src/text3.C
        (LyXText::dispatch): ditto

        * src/factory.C
        (createInset): Create InsetCommandParams with command name
        (readInset): ditto
        (readInset): Remove error message for bibitem, since bibitem is
        now a normal command inset

        * src/buffer.C: Bump file format number

        * src/frontends/controllers/ControlCommand.[Ch]
        (ControlCommand): take an additional command name parameter

        * src/text.C
        (readParToken): Remove code for \bibitem

        * lib/lyx2lyx/LyX.py: Bump latest file format number

        * lib/lyx2lyx/lyx_1_5.py
        (convert_bibitem, convert_commandparams): new, convert to new format
        (revert_commandparams): new, convert to old format

        * development/FORMAT: document new format

        * many other files: Adjust to the changes above




Reply via email to