José Abílio Oliveira Matos wrote: > But if you nest two of the them the inside style gets its label visible. > :-)
I have the label working now. The inset font, though, seems to be a general problem (you can also see this in ERT, it gets only red/typewriter when nested, maybe also related: paragraph indentation is only shown in text insets, not in the main text). So I'll commit what I have now (patch attached). Jürgen BTW, as to your latest change: I think we should not allow paragraph breaks in the char style inset at all (leads to LaTeX error also and is not what inline insets are designed for IMO). Alternatively, we could close the macro/tag and reopen in a new paragraph. But that would be much more tricky i guess.
Index: ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v retrieving revision 1.2017 diff -u -r1.2017 ChangeLog --- ChangeLog 30 Oct 2004 22:14:01 -0000 1.2017 +++ ChangeLog 31 Oct 2004 12:25:32 -0000 @@ -1,3 +1,7 @@ +2004-10-31 Jürgen Spitzmüller <[EMAIL PROTECTED]> + + * text.C (leftMargin): do not indent paragraphs in charstyle insets. + 2004-10-30 José Matos <[EMAIL PROTECTED]> * paragraph.[Ch] (onlyText): Checks if the paragraph contains only Index: text.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text.C,v retrieving revision 1.583 diff -u -r1.583 text.C --- text.C 23 Oct 2004 11:04:39 -0000 1.583 +++ text.C 31 Oct 2004 12:25:37 -0000 @@ -609,9 +609,10 @@ && !isFirstInSequence(pit, pars_))) && align == LYX_ALIGN_BLOCK && !par.params().noindent() - // in tabulars and ert paragraphs are never indented! + // in charstyles, tabulars and ert paragraphs are never indented! && (par.ownerCode() != InsetBase::TEXT_CODE - && par.ownerCode() != InsetBase::ERT_CODE) + && par.ownerCode() != InsetBase::ERT_CODE + && par.ownerCode() != InsetBase::CHARSTYLE_CODE) && (par.layout() != tclass.defaultLayout() || bv()->buffer()->params().paragraph_separation == BufferParams::PARSEP_INDENT)) Index: insets/ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/ChangeLog,v retrieving revision 1.1066 diff -u -r1.1066 ChangeLog --- insets/ChangeLog 30 Oct 2004 22:14:02 -0000 1.1066 +++ insets/ChangeLog 31 Oct 2004 12:26:02 -0000 @@ -1,3 +1,7 @@ +2004-10-31 Jürgen Spitzmüller <[EMAIL PROTECTED]> + + * insetcharstyle.C: drawing cosmetics. + 2004-10-30 José Matos <[EMAIL PROTECTED]> * insetcharstyle.C (docbook): a compromisse solution. Don't output Index: insets/insetcharstyle.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetcharstyle.C,v retrieving revision 1.23 diff -u -r1.23 insetcharstyle.C --- insets/insetcharstyle.C 30 Oct 2004 22:14:02 -0000 1.23 +++ insets/insetcharstyle.C 31 Oct 2004 12:26:02 -0000 @@ -44,12 +44,14 @@ { setInsetName("CharStyle"); setStatus(Inlined); + setDrawFrame(false); + has_label_ = true; } InsetCharStyle::InsetCharStyle(BufferParams const & bp, CharStyles::iterator cs) - : InsetCollapsable(bp), has_label_(true) + : InsetCollapsable(bp) { params_.type = cs->name; params_.latextype = cs->latextype; @@ -62,7 +64,7 @@ InsetCharStyle::InsetCharStyle(InsetCharStyle const & in) - : InsetCollapsable(in), params_(in.params_), has_label_(true) + : InsetCollapsable(in), params_(in.params_) { init(); } @@ -98,7 +100,7 @@ { LyXFont tmpfont = mi.base.font; getDrawFont(mi.base.font); - InsetCollapsable::metrics(mi, dim); + InsetText::metrics(mi, dim); mi.base.font = tmpfont; dim_ = dim; if (has_label_) @@ -110,19 +112,20 @@ { setPosCache(pi, x, y); - // FIXME: setStatus(Inlined); this is not a const operation LyXFont tmpfont = pi.base.font; - //setDrawFrame(InsetText::NEVER); getDrawFont(pi.base.font); InsetText::draw(pi, x, y); pi.base.font = tmpfont; - pi.pain.line(x + 2, y + InsetText::descent() - 4, x + 2, - y + InsetText::descent(), params_.labelfont.color()); - pi.pain.line(x + 2, y + InsetText::descent(), x + dim_.wid - 2, - y + InsetText::descent(), params_.labelfont.color()); - pi.pain.line(x + dim_.wid - 2, y + InsetText::descent(), x + dim_.wid - 2, - y + InsetText::descent() - 4, params_.labelfont.color()); + int desc = InsetText::descent(); + if (has_label_) + desc -= ascent(); + + pi.pain.line(x, y + desc - 4, x, y + desc, params_.labelfont.color()); + pi.pain.line(x, y + desc, x + dim_.wid - 2, y + desc, + params_.labelfont.color()); + pi.pain.line(x + dim_.wid - 2, y + desc, x + dim_.wid - 2, y + desc - 4, + params_.labelfont.color()); if (has_label_) { LyXFont font(params_.labelfont); @@ -133,8 +136,7 @@ int a = 0; int d = 0; font_metrics::rectText(params_.type, font, w, a, d); - pi.pain.rectText(x + (dim_.wid - w) / 2, - y + InsetText::descent() + a, + pi.pain.rectText(x + (dim_.wid - w) / 2, y + desc + a, params_.type, font, LColor::none, LColor::none); } }