+2003-10-20 Martin Vermeer <martin.vermeer@hut.fi>
+
+ * text.C: re-introduce display() for insets, fixing the
+ various bugs (stretch of line above, math inset
+ positioning, ...)
+
2003-10-20 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* text.C (rightMargin): remove spurious semicolon
+2003-10-20 Martin Vermeer <martin.vermeer@hut.fi>
+
+ * inset.h:
+ * insetfloat.h:
+ * insetfootlike.h: re-introduce display() for insets,
+ fixing the various bugs (stretch of line above, math inset
+ positioning, ...)
+
2003-10-17 Lars Gullik Bjønnes <larsbj@gullik.net>
* insetbase.C (dispatch): new func
// is this equivalent to a space (which is BTW different from
// a line separator)?
virtual bool isSpace() const { return false; }
+ // should we have a non-filled line before this inset?
+ virtual bool display() const { return false; }
// should we break lines after this inset?
virtual bool isLineSeparator() const { return false; }
// if this inset has paragraphs should they be output all as default
///
~InsetFloat();
///
+ virtual bool display() const { return true; }
+ ///
void write(Buffer const & buf, std::ostream & os) const;
///
void read(Buffer const & buf, LyXLex & lex);
///
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
+2003-10-20 Martin Vermeer <martin.vermeer@hut.fi>
+
+ * formula.[Ch]: re-introduce display() for insets, fixing the
+ various bugs (stretch of line above, math inset
+ positioning, ...)
+
2003-10-17 Lars Gullik Bjønnes <larsbj@gullik.net>
* ref_inset.C (priv_dispatch): take the code from localDispatch
//p.pain.rectangle(x, y - a, w, h, LColor::mathframe);
}
- par_->draw(p, x + offset_, y);
+ par_->draw(p, x, y);
}
xo_ = x;
dim.des += 1;
}
- if (display()) {
- offset_ = (m.base.textwidth - dim.wid) / 2;
- dim.wid = m.base.textwidth;
- } else {
- offset_ = 0;
- }
-
dim_ = dim;
}
/// contents
MathAtom par_;
- /// x offset for drawing displayed formula
- mutable int offset_;
/// The pointer never changes although *preview_'s contents may.
boost::scoped_ptr<RenderPreview> const preview_;
point = i;
break;
}
+ InsetOld * in;
+ // Break before...
+ if (i + 1 < last) {
+ in = pit->getInset(i + 1);
+ if (in && in->display()) {
+ point = i;
+ break;
+ }
+ // ...and after.
+ in = pit->getInset(i);
+ if (in && in->display()) {
+ point = i;
+ break;
+ }
+ }
char const c = pit->getChar(i);
if (i > endPosOfFontSpan) {
x += thiswidth;
chunkwidth += thiswidth;
- InsetOld * in = pit->isInset(i) ? pit->getInset(i) : 0;
+ in = pit->getInset(i);
// break before a character that will fall off
// the right of the row
align = LYX_ALIGN_LEFT;
}
+ // 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;
+ if (inset && inset->display()) {
+ align = LYX_ALIGN_CENTER;
+ }
+
switch (align) {
case LYX_ALIGN_BLOCK:
{
int const ns = numberOfSeparators(*pit, *rit);
RowList::iterator next_row = boost::next(rit);
+ bool disp_inset = false;
+ if (next_row != pit->rows.end()) {
+ InsetOld * in = pit->getInset(next_row->pos());
+ if (in)
+ disp_inset = in->display();
+ }
+ // If we have separators, this is not the last row of a
+ // par, does not end in newline, and is not row above a
+ // display inset... then stretch it
if (ns
&& next_row != pit->rows.end()
&& !pit->isNewline(next_row->pos() - 1)
+ && !disp_inset
) {
fill_separator = w / ns;
} else if (is_rtl) {