On Wed, Dec 10, 2003 at 12:37:41PM +0000, Angus Leeming spake thusly:
> 
> Shouldn't this snippet of LyX's output be changed:
> 
> -\begin_inset Greyedout
> +\begin_inset Note Greyedout
>  collapsed false
> 
>  \begin_layout Standard
> 
>  some important comment
>  \end_layout
> 
>  \end_inset 
> 
> With the corresponding change in factory.C's readInset
> -               } else if (tmptok == "Note"     || tmptok == "Comment"
> -                               || tmptok == "Greyedout") {
> +               } else if (tmptok == "Note") {
> 
> As it stands, InsetNote has no idea what its type is because 
> InsetNoteParams::type is not set on read.

 
Probably a good idea, consistent with how other insets do it.


> Furthermore, I've been triggering a crash with
>         "dialog-show-new-inset note"
> here:
> 
> void QNote::update_contents()
> {
>         QRadioButton * rb = 0;
>         string type(controller().params().type);
> 
>         if (type == "Note")
>                 rb = dialog_->noteRB;
>         else if (type == "Comment")
>                 rb = dialog_->commentRB;
>         else if (type == "Greyedout")
>                 rb = dialog_->greyedoutRB;
> 
>         rb->setChecked(true);
> }

I remember working around this on the xforms side :-(
 
> because controller().params().type is empty and so rb is not set. I 
> propose changing:
> struct InsetNoteParams {
>         std::string type;
> };
> 
> to
> struct InsetNoteParams {
>         enum Type {
>                 Note,
>                 Comment,
>                 Greyedout
>         };
>         Type type;
> };
> 
> as this seems much safer to me.


Go for it.

- Martin

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to