* 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
This commit is contained in:
Georg Baum 2006-03-18 17:39:54 +00:00
parent be102d1c13
commit 70b8cfdf59
3 changed files with 10 additions and 10 deletions

View File

@ -220,7 +220,7 @@ public:
/// does this contain text that can be change track marked in DVI? /// does this contain text that can be change track marked in DVI?
virtual bool canTrackChanges() const { return false; } virtual bool canTrackChanges() const { return false; }
/// is this inset based on the TextInset class? /// 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 /// return true if the inset should be removed automatically
virtual bool autoDelete() const; virtual bool autoDelete() const;

View File

@ -59,7 +59,7 @@ public:
/// ///
bool canTrackChanges() const { return true; } bool canTrackChanges() const { return true; }
/// ///
InsetText * asTextInset() const { return const_cast<InsetText *>(this); } InsetText const * asTextInset() const { return this; }
/// ///
int latex(Buffer const &, std::ostream &, int latex(Buffer const &, std::ostream &,
OutputParams const &) const; OutputParams const &) const;

View File

@ -164,10 +164,10 @@ void RowPainter::paintInset(pos_type const pos, LyXFont const & font)
pi.ltr_pos = (text_.bidi.level(pos) % 2 == 0); pi.ltr_pos = (text_.bidi.level(pos) % 2 == 0);
pi.erased_ = erased_ || isDeletedText(par_, pos); pi.erased_ = erased_ || isDeletedText(par_, pos);
theCoords.insets().add(inset, int(x_), yo_); theCoords.insets().add(inset, int(x_), yo_);
InsetBase * in = const_cast<InsetBase *>(inset); InsetText const * const in = inset->asTextInset();
// non-wide insets are painted completely. Recursive // non-wide insets are painted completely. Recursive
bool tmp = bv_.repaintAll(); bool tmp = bv_.repaintAll();
if (!in->asTextInset() || !static_cast<InsetText*>(in)->Wide()) { if (!in || !in->Wide()) {
bv_.repaintAll(true); bv_.repaintAll(true);
lyxerr[Debug::PAINTING] << endl << "Paint inset fully" << endl; 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 // If this is the only object on the row, we can make it wide
for (pos_type i = rit->pos() ; i != rit->endpos(); ++i) { for (pos_type i = rit->pos() ; i != rit->endpos(); ++i) {
InsetBase* in InsetBase const * const in = par.getInset(i);
= const_cast<InsetBase*>(par.getInset(i)); if (in) {
if (in && in->asTextInset()) { InsetText const * const t = in->asTextInset();
static_cast<InsetText*>(in)->Wide() if (t)
= in_inset_alone_on_row && t->Wide() = in_inset_alone_on_row &&
static_cast<InsetText*>(in)->Tall(); t->Tall();
} }
} }