Changes to the within-inset row rendering caching code.

* insets/insetenv.h: 
	* insets/insetcollapsable.h: remove method
	* insets/insettabular.h:
	* insets/insetbase.h: rename, add methods
	* insets/insettext.[Ch]: rename method; add Tall()
	* paragraph_pimpl.C
	(Paragraph::Pimpl::simpleTeXSpecialC): rename call
	* mathed/math_hullinset.h: rename method
	* rowpainter.C
	(RowPainter::paintInset):
	(paintPar): remove isTrueTextInset, move to insets 



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13415 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Martin Vermeer 2006-03-17 19:45:28 +00:00
parent 3626d1ce04
commit 3d0c878966
9 changed files with 27 additions and 23 deletions

View File

@ -21,6 +21,7 @@ class BufferView;
class CursorSlice;
class FuncRequest;
class FuncStatus;
class InsetText;
class LaTeXFeatures;
class LCursor;
class LyXLex;
@ -216,8 +217,10 @@ public:
virtual EDITABLE editable() const;
/// can we go further down on mouse click?
virtual bool descendable() const { return false; }
///
virtual bool isTextInset() const { return false; }
/// 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; }
/// return true if the inset should be removed automatically
virtual bool autoDelete() const;

View File

@ -57,8 +57,6 @@ public:
/// can we go further down on mouse click?
bool descendable() const;
///
bool isTextInset() const { return true; }
///
void setLabel(std::string const & l);
///
virtual void setButtonLabel() {}

View File

@ -34,8 +34,6 @@ public:
///
InsetBase::EDITABLE editable() const { return HIGHLY_EDITABLE; }
///
bool isTextInset() const { return true; }
///
LyXLayout_ptr const & layout() const;
/** returns true if, when outputing LaTeX, font changes should
be closed before generating this inset. This is needed for

View File

@ -69,7 +69,7 @@ public:
///
bool insetAllowed(InsetBase::Code) const { return true; }
///
bool isTextInset() const { return true; }
bool canTrackChanges() const { return true; }
/** returns true if, when outputing LaTeX, font changes should
be closed before generating this inset. This is needed for
insets that may contain several paragraphs */

View File

@ -258,6 +258,12 @@ InsetBase * InsetText::editXY(LCursor & cur, int x, int y)
}
bool const InsetText::Tall() const
{
return text_.ascent() + text_.descent() > 2 * defaultRowHeight();
}
void InsetText::doDispatch(LCursor & cur, FuncRequest & cmd)
{
lyxerr[Debug::DEBUG] << BOOST_CURRENT_FUNCTION

View File

@ -57,7 +57,9 @@ public:
///
EDITABLE editable() const { return HIGHLY_EDITABLE; }
///
bool isTextInset() const { return true; }
bool canTrackChanges() const { return true; }
///
InsetText * asTextInset() const { return const_cast<InsetText *>(this); }
///
int latex(Buffer const &, std::ostream &,
OutputParams const &) const;
@ -139,6 +141,8 @@ public:
InsetText(InsetText const &);
///
bool & Wide() const { return wide_inset_; }
///
bool const Tall() const;
protected:
///

View File

@ -189,7 +189,7 @@ public:
/// what appears in the minibuffer when opening
virtual std::string const editMessage() const;
///
virtual bool isTextInset() const { return true; }
virtual bool canTrackChanges() const { return true; }
///
virtual void mutateToText();
///

View File

@ -536,7 +536,7 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const & buf,
&& runparams.flavor == OutputParams::LATEX
&& features.isAvailable("dvipost");
if (inset->isTextInset()) {
if (inset->canTrackChanges()) {
column += Changes::latexMarkChange(os, running_change,
Change::UNCHANGED, output);
running_change = Change::UNCHANGED;

View File

@ -151,15 +151,6 @@ int RowPainter::leftMargin() const
}
bool isTrueTextInset(InsetBase * in)
{
// Math and tabular insets have isTextInset = true, though they are
// not derived from InsetText. Paint them fully
return (in && in->isTextInset() && in->asMathInset() == 0
&& in->lyxCode() != InsetBase::TABULAR_CODE);
}
void RowPainter::paintInset(pos_type const pos, LyXFont const & font)
{
InsetBase const * inset = par_.getInset(pos);
@ -176,8 +167,10 @@ void RowPainter::paintInset(pos_type const pos, LyXFont const & font)
InsetBase * in = const_cast<InsetBase *>(inset);
// non-wide insets are painted completely. Recursive
bool tmp = bv_.repaintAll();
if (!isTrueTextInset(in) || !static_cast<InsetText*>(in)->Wide())
if (!in->asTextInset() || !static_cast<InsetText*>(in)->Wide()) {
bv_.repaintAll(true);
lyxerr[Debug::PAINTING] << endl << "Paint inset fully" << endl;
}
if (bv_.repaintAll())
inset->drawSelection(pi, int(x_), yo_);
inset->draw(pi, int(x_), yo_);
@ -821,9 +814,11 @@ void paintPar
for (pos_type i = rit->pos() ; i != rit->endpos(); ++i) {
InsetBase* in
= const_cast<InsetBase*>(par.getInset(i));
if (isTrueTextInset(in))
if (in && in->asTextInset()) {
static_cast<InsetText*>(in)->Wide()
= in_inset_alone_on_row;
= in_inset_alone_on_row &&
static_cast<InsetText*>(in)->Tall();
}
}
// If selection is on, the current row signature differs