Final touch 'inset display()'; fix 'is a bit silly' bug

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7941 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Martin Vermeer 2003-10-21 13:04:14 +00:00
parent 50bbb55cb0
commit de039bb341
8 changed files with 34 additions and 14 deletions

View File

@ -1,3 +1,9 @@
2003-10-21 Martin Vermeer <martin.vermeer@hut.fi>
* text.C: (1) finish off the inset display() work;
(2) fix the "is a bit silly" bug (accessing char
past end of par).
2003-10-20 Martin Vermeer <martin.vermeer@hut.fi>
* text.C: re-introduce display() for insets, fixing the

View File

@ -1,3 +1,13 @@
2003-10-21 Martin Vermeer <martin.vermeer@hut.fi>
* insetcollapsable.h:
* insetcommand.h:
* insetfloat.h:
* insetfootlike.h:
* insetinclude.h: (1) finish off the inset display() work;
(2) fix the "is a bit silly" bug (accessing char
past end of par).
2003-10-20 Martin Vermeer <martin.vermeer@hut.fi>
* inset.h:

View File

@ -120,6 +120,8 @@ public:
///
LyXCursor const & cursor(BufferView *) const;
///
virtual bool display() const { return isOpen(); }
///
bool isOpen() const;
///
void open(BufferView *);

View File

@ -55,7 +55,9 @@ public:
virtual int docbook(Buffer const &, std::ostream &, bool) const;
///
InsetOld::Code lyxCode() const { return InsetOld::NO_CODE; }
///
virtual bool display() const { return true; }
///
InsetCommandParams const & params() const { return p_; }
///

View File

@ -45,8 +45,6 @@ public:
///
~InsetFloat();
///
virtual bool display() const { return true; }
///
void write(Buffer const & buf, std::ostream & os) const;
///
void read(Buffer const & buf, LyXLex & lex);

View File

@ -28,8 +28,6 @@ public:
///
void write(Buffer const & buf, std::ostream & os) const;
///
bool display() const { return true; }
///
bool insetAllowed(InsetOld::Code) const;
/** returns true if, when outputing LaTeX, font changes should
be closed before generating this inset. This is needed for

View File

@ -38,6 +38,8 @@ public:
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo & pi, int x, int y) const;
///
virtual bool display() const { return true; }
/// get the parameters
InsetCommandParams const & params(void) const;

View File

@ -691,10 +691,9 @@ pos_type LyXText::rowBreakPoint(ParagraphList::iterator pit,
point = i;
break;
}
InsetOld * in;
// Break before...
if (i + 1 < last) {
in = pit->getInset(i + 1);
InsetOld * in = pit->getInset(i + 1);
if (in && in->display()) {
point = i;
break;
@ -731,15 +730,18 @@ pos_type LyXText::rowBreakPoint(ParagraphList::iterator pit,
x += thiswidth;
chunkwidth += thiswidth;
in = pit->getInset(i);
InsetOld * in = pit->getInset(i);
// break before a character that will fall off
// the right of the row
if (x >= width) {
// if no break before, break here
if (point == last || chunkwidth >= width - left)
point = (pos < i) ? i - 1 : i;
break;
if (point == last || chunkwidth >= width - left) {
if (pos < i) {
point = i - 1;
break;
}
}
}
if (!in || in->isChar()) {
@ -1461,9 +1463,9 @@ void LyXText::prepareToPrint(ParagraphList::iterator pit,
}
// Display-style insets should always be on a centred row
// (Simplify this to inset = pit->getInset(rit->pos()) once
// the "bit silly" bug is fixed, MV)
inset = pit->isInset(rit->pos()) ? pit->getInset(rit->pos()) : 0;
// The test on pit->size() is to catch zero-size pars, which
// would trigger the assert in Paragraph::getInset().
inset = pit->size() ? pit->getInset(rit->pos()) : 0;
if (inset && inset->display()) {
align = LYX_ALIGN_CENTER;
}