On Thursday 20 February 2003 4:02 pm, John Levon wrote:
> On Thu, Feb 20, 2003 at 01:54:38PM +0000, Angus Leeming wrote:
> > >>         virtual string const Inset::stringForDialog() const
> > >> method perhaps.
> > >
> > > don't we already have names for the insets ?
> >
> > You mean
> >         class Inset {
> >                 string const name_;
> >         };
> > ? I don't think so. Anyway, what's your point?
>
> Why are we adding stringForDialog() when we already have getInsetName()

1. Thanks. I didn't know the function existed ;-)
Now I do...

However, it is used in a few insets only and is output to the LyX file.

That is NOT what I want. I want a unique identifier for the different dialogs, 
inset or otherwise. I could use an enum and a switch in Dialogs.C, but I 
chose to use a string.

2. stringForDialog() is my clumsy attempt to describe this for example:

string const
InsetCommandMailer::params2string(InsetCommandParams const & params)
{
        ostringstream data;
        params.write(data);
        data << "\\end_inset\n";

        return data.str();
}

This string is the 'data' passed to the frontends through 
        Dialogs::show("citation", data, *inset);

and is unscrambled at the other end, in this case with:

void InsetCommandMailer::string2params(string const & in,
                                       InsetCommandParams & params)
{
        params.setCmdName(string());
        params.setContents(string());
        params.setOptions(string());

        if (in.empty())
                return;

        istringstream data(in);
        LyXLex lex(0,0);
        lex.setStream(data);

        params.read(lex);
}

Perhaps I should just post the patch?
Angus

Reply via email to