From: Georg Baum Date: Sat, 18 Mar 2006 17:39:54 +0000 (+0000) Subject: * src/insets/insetbase.h X-Git-Tag: 1.6.10~13482 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=70b8cfdf59d4436af2baa9c0bce15bb5a60b5f03;p=lyx.git * src/insets/insetbase.h * src/insets/insettext.h (asTextInset): constify * src/rowpainter.C (RowPainter::paintInset): remove unneeded casts (paintPar): ditto git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13420 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/insets/insetbase.h b/src/insets/insetbase.h index 448c2dab4b..885c6356a0 100644 --- a/src/insets/insetbase.h +++ b/src/insets/insetbase.h @@ -220,7 +220,7 @@ public: /// does this contain text that can be change track marked in DVI? virtual bool canTrackChanges() const { return false; } /// is this inset based on the TextInset class? - virtual InsetText * asTextInset() const { return 0; } + virtual InsetText const * asTextInset() const { return 0; } /// return true if the inset should be removed automatically virtual bool autoDelete() const; diff --git a/src/insets/insettext.h b/src/insets/insettext.h index 1e17937c45..0307dcf788 100644 --- a/src/insets/insettext.h +++ b/src/insets/insettext.h @@ -59,7 +59,7 @@ public: /// bool canTrackChanges() const { return true; } /// - InsetText * asTextInset() const { return const_cast(this); } + InsetText const * asTextInset() const { return this; } /// int latex(Buffer const &, std::ostream &, OutputParams const &) const; diff --git a/src/rowpainter.C b/src/rowpainter.C index b387a83ac3..77a1ebd7b5 100644 --- a/src/rowpainter.C +++ b/src/rowpainter.C @@ -164,10 +164,10 @@ void RowPainter::paintInset(pos_type const pos, LyXFont const & font) pi.ltr_pos = (text_.bidi.level(pos) % 2 == 0); pi.erased_ = erased_ || isDeletedText(par_, pos); theCoords.insets().add(inset, int(x_), yo_); - InsetBase * in = const_cast(inset); + InsetText const * const in = inset->asTextInset(); // non-wide insets are painted completely. Recursive bool tmp = bv_.repaintAll(); - if (!in->asTextInset() || !static_cast(in)->Wide()) { + if (!in || !in->Wide()) { bv_.repaintAll(true); lyxerr[Debug::PAINTING] << endl << "Paint inset fully" << endl; } @@ -812,12 +812,12 @@ void paintPar // If this is the only object on the row, we can make it wide for (pos_type i = rit->pos() ; i != rit->endpos(); ++i) { - InsetBase* in - = const_cast(par.getInset(i)); - if (in && in->asTextInset()) { - static_cast(in)->Wide() - = in_inset_alone_on_row && - static_cast(in)->Tall(); + InsetBase const * const in = par.getInset(i); + if (in) { + InsetText const * const t = in->asTextInset(); + if (t) + t->Wide() = in_inset_alone_on_row && + t->Tall(); } }