Jürgen Spitzmüller wrote:
Abdelrazak Younes wrote:
I'd rather do:
- if (layout->labeltype == LABEL_SENSITIVE) {
+ if (cur.innerInsetOfType(InsetBase::CAPTION_CODE) ||
layout->labeltype == LABEL_SENSITIVE) {
Yes. That's what I meant in my previous comment (obviously InsetCaption
derives from InsetText, not LyXText).
But instead of using 'cur' I'd rather have a new method in LyXText:
InsetText * parent();
InsetText const * parent() const;
Then the above code will be
+ if (parent()->lyxCode() == InsetBase::CAPTION_CODE) ||
layout->labeltype == LABEL_SENSITIVE) {
That would of course mean that we pass the Parent at LyXText
construction. I think that having access to the parent InsetText will
remove may hacks in the code.
What if we are inside an OptArg inset (or any other nested inset)
This is another special case indeed.
inside the
caption inset? That's why I'm scanning through the cursor slices.
I understand but I still don't like the scanning... :-)
Abdel.