From 9499d9da38008090800230394578be0104b80473 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Sun, 31 Oct 2004 12:30:26 +0000 Subject: [PATCH] insetcharstyle drawing cosmetics git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9152 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 4 ++++ src/insets/ChangeLog | 4 ++++ src/insets/insetcharstyle.C | 28 +++++++++++++++------------- src/text.C | 5 +++-- 4 files changed, 26 insertions(+), 15 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index f67a4a020b..fa4973e950 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2004-10-31 Jürgen Spitzmüller + + * text.C (leftMargin): do not indent paragraphs in charstyle insets. + 2004-10-30 José Matos * paragraph.[Ch] (onlyText): Checks if the paragraph contains only diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index e9674b7d6e..a9bcff86e4 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,7 @@ +2004-10-31 Jürgen Spitzmüller + + * insetcharstyle.C: drawing cosmetics. + 2004-10-30 José Matos * insetcharstyle.C (docbook): a compromisse solution. Don't output diff --git a/src/insets/insetcharstyle.C b/src/insets/insetcharstyle.C index b13cfdbca5..bee8b2bc4b 100644 --- a/src/insets/insetcharstyle.C +++ b/src/insets/insetcharstyle.C @@ -44,12 +44,14 @@ void InsetCharStyle::init() { 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(BufferParams const & bp, InsetCharStyle::InsetCharStyle(InsetCharStyle const & in) - : InsetCollapsable(in), params_(in.params_), has_label_(true) + : InsetCollapsable(in), params_(in.params_) { init(); } @@ -98,7 +100,7 @@ void InsetCharStyle::metrics(MetricsInfo & mi, Dimension & dim) const { 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 @@ void InsetCharStyle::draw(PainterInfo & pi, int x, int y) const { 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 @@ void InsetCharStyle::draw(PainterInfo & pi, int x, int y) const 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); } } diff --git a/src/text.C b/src/text.C index 6dcc706c3d..fc41964fa0 100644 --- a/src/text.C +++ b/src/text.C @@ -609,9 +609,10 @@ int LyXText::leftMargin(par_type const pit, pos_type const pos) const && !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)) -- 2.39.2